@codeforbreakfast/commy-mcp 0.14.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +2137 -636
package/server.js CHANGED
@@ -90,12 +90,12 @@ var require_code = __commonJS((exports) => {
90
90
  return item === "" || item === '""';
91
91
  }
92
92
  get str() {
93
- var _a;
94
- return (_a = this._str) !== null && _a !== undefined ? _a : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
93
+ var _a3;
94
+ return (_a3 = this._str) !== null && _a3 !== undefined ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
95
95
  }
96
96
  get names() {
97
- var _a;
98
- return (_a = this._names) !== null && _a !== undefined ? _a : this._names = this._items.reduce((names, c) => {
97
+ var _a3;
98
+ return (_a3 = this._names) !== null && _a3 !== undefined ? _a3 : this._names = this._items.reduce((names, c) => {
99
99
  if (c instanceof Name)
100
100
  names[c.str] = (names[c.str] || 0) + 1;
101
101
  return names;
@@ -240,8 +240,8 @@ var require_scope = __commonJS((exports) => {
240
240
  return `${prefix}${ng.index++}`;
241
241
  }
242
242
  _nameGroup(prefix) {
243
- var _a, _b;
244
- if (((_b = (_a = this._parent) === null || _a === undefined ? undefined : _a._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
243
+ var _a3, _b;
244
+ if (((_b = (_a3 = this._parent) === null || _a3 === undefined ? undefined : _a3._prefixes) === null || _b === undefined ? undefined : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
245
245
  throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
246
246
  }
247
247
  return this._names[prefix] = { prefix, index: 0 };
@@ -276,12 +276,12 @@ var require_scope = __commonJS((exports) => {
276
276
  return new ValueScopeName(prefix, this._newName(prefix));
277
277
  }
278
278
  value(nameOrPrefix, value5) {
279
- var _a;
279
+ var _a3;
280
280
  if (value5.ref === undefined)
281
281
  throw new Error("CodeGen: ref must be passed in value");
282
282
  const name = this.toName(nameOrPrefix);
283
283
  const { prefix } = name;
284
- const valueKey = (_a = value5.key) !== null && _a !== undefined ? _a : value5.ref;
284
+ const valueKey = (_a3 = value5.key) !== null && _a3 !== undefined ? _a3 : value5.ref;
285
285
  let vs = this._values[prefix];
286
286
  if (vs) {
287
287
  const _name = vs.get(valueKey);
@@ -609,8 +609,8 @@ var require_codegen = __commonJS((exports) => {
609
609
  return this;
610
610
  }
611
611
  optimizeNames(names, constants2) {
612
- var _a;
613
- this.else = (_a = this.else) === null || _a === undefined ? undefined : _a.optimizeNames(names, constants2);
612
+ var _a3;
613
+ this.else = (_a3 = this.else) === null || _a3 === undefined ? undefined : _a3.optimizeNames(names, constants2);
614
614
  if (!(super.optimizeNames(names, constants2) || this.else))
615
615
  return;
616
616
  this.condition = optimizeExpr(this.condition, names, constants2);
@@ -721,16 +721,16 @@ var require_codegen = __commonJS((exports) => {
721
721
  return code;
722
722
  }
723
723
  optimizeNodes() {
724
- var _a, _b;
724
+ var _a3, _b;
725
725
  super.optimizeNodes();
726
- (_a = this.catch) === null || _a === undefined || _a.optimizeNodes();
726
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNodes();
727
727
  (_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
728
728
  return this;
729
729
  }
730
730
  optimizeNames(names, constants2) {
731
- var _a, _b;
731
+ var _a3, _b;
732
732
  super.optimizeNames(names, constants2);
733
- (_a = this.catch) === null || _a === undefined || _a.optimizeNames(names, constants2);
733
+ (_a3 = this.catch) === null || _a3 === undefined || _a3.optimizeNames(names, constants2);
734
734
  (_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants2);
735
735
  return this;
736
736
  }
@@ -1453,8 +1453,8 @@ var require_applicability = __commonJS((exports) => {
1453
1453
  }
1454
1454
  exports.shouldUseGroup = shouldUseGroup;
1455
1455
  function shouldUseRule(schema, rule) {
1456
- var _a;
1457
- return schema[rule.keyword] !== undefined || ((_a = rule.definition.implements) === null || _a === undefined ? undefined : _a.some((kwd) => schema[kwd] !== undefined));
1456
+ var _a3;
1457
+ return schema[rule.keyword] !== undefined || ((_a3 = rule.definition.implements) === null || _a3 === undefined ? undefined : _a3.some((kwd) => schema[kwd] !== undefined));
1458
1458
  }
1459
1459
  exports.shouldUseRule = shouldUseRule;
1460
1460
  });
@@ -1829,14 +1829,14 @@ var require_keyword = __commonJS((exports) => {
1829
1829
  }
1830
1830
  exports.macroKeywordCode = macroKeywordCode;
1831
1831
  function funcKeywordCode(cxt, def) {
1832
- var _a;
1832
+ var _a3;
1833
1833
  const { gen: gen5, keyword, schema, parentSchema, $data, it } = cxt;
1834
1834
  checkAsyncKeyword(it, def);
1835
1835
  const validate7 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
1836
1836
  const validateRef = useKeyword(gen5, keyword, validate7);
1837
1837
  const valid = gen5.let("valid");
1838
1838
  cxt.block$data(valid, validateKeyword);
1839
- cxt.ok((_a = def.valid) !== null && _a !== undefined ? _a : valid);
1839
+ cxt.ok((_a3 = def.valid) !== null && _a3 !== undefined ? _a3 : valid);
1840
1840
  function validateKeyword() {
1841
1841
  if (def.errors === false) {
1842
1842
  assignValid();
@@ -1867,8 +1867,8 @@ var require_keyword = __commonJS((exports) => {
1867
1867
  gen5.assign(valid, (0, codegen_1._)`${_await4}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
1868
1868
  }
1869
1869
  function reportErrs(errors3) {
1870
- var _a2;
1871
- gen5.if((0, codegen_1.not)((_a2 = def.valid) !== null && _a2 !== undefined ? _a2 : valid), errors3);
1870
+ var _a4;
1871
+ gen5.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== undefined ? _a4 : valid), errors3);
1872
1872
  }
1873
1873
  }
1874
1874
  exports.funcKeywordCode = funcKeywordCode;
@@ -2823,7 +2823,7 @@ var require_compile = __commonJS((exports) => {
2823
2823
 
2824
2824
  class SchemaEnv {
2825
2825
  constructor(env3) {
2826
- var _a;
2826
+ var _a3;
2827
2827
  this.refs = {};
2828
2828
  this.dynamicAnchors = {};
2829
2829
  let schema;
@@ -2832,7 +2832,7 @@ var require_compile = __commonJS((exports) => {
2832
2832
  this.schema = env3.schema;
2833
2833
  this.schemaId = env3.schemaId;
2834
2834
  this.root = env3.root || this;
2835
- this.baseId = (_a = env3.baseId) !== null && _a !== undefined ? _a : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env3.schemaId || "$id"]);
2835
+ this.baseId = (_a3 = env3.baseId) !== null && _a3 !== undefined ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === undefined ? undefined : schema[env3.schemaId || "$id"]);
2836
2836
  this.schemaPath = env3.schemaPath;
2837
2837
  this.localRefs = env3.localRefs;
2838
2838
  this.meta = env3.meta;
@@ -2927,14 +2927,14 @@ var require_compile = __commonJS((exports) => {
2927
2927
  }
2928
2928
  exports.compileSchema = compileSchema;
2929
2929
  function resolveRef(root, baseId, ref) {
2930
- var _a;
2930
+ var _a3;
2931
2931
  ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
2932
2932
  const schOrFunc = root.refs[ref];
2933
2933
  if (schOrFunc)
2934
2934
  return schOrFunc;
2935
2935
  let _sch = resolve3.call(this, root, ref);
2936
2936
  if (_sch === undefined) {
2937
- const schema = (_a = root.localRefs) === null || _a === undefined ? undefined : _a[ref];
2937
+ const schema = (_a3 = root.localRefs) === null || _a3 === undefined ? undefined : _a3[ref];
2938
2938
  const { schemaId } = this.opts;
2939
2939
  if (schema)
2940
2940
  _sch = new SchemaEnv({ schema, schemaId, root, baseId });
@@ -3003,8 +3003,8 @@ var require_compile = __commonJS((exports) => {
3003
3003
  "definitions"
3004
3004
  ]);
3005
3005
  function getJsonPointer(parsedRef, { baseId, schema, root }) {
3006
- var _a;
3007
- if (((_a = parsedRef.fragment) === null || _a === undefined ? undefined : _a[0]) !== "/")
3006
+ var _a3;
3007
+ if (((_a3 = parsedRef.fragment) === null || _a3 === undefined ? undefined : _a3[0]) !== "/")
3008
3008
  return;
3009
3009
  for (const part of parsedRef.fragment.slice(1).split("/")) {
3010
3010
  if (typeof schema === "boolean")
@@ -3953,9 +3953,9 @@ var require_core = __commonJS((exports) => {
3953
3953
  };
3954
3954
  var MAX_EXPRESSION = 200;
3955
3955
  function requiredOptions(o) {
3956
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
3956
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
3957
3957
  const s = o.strict;
3958
- const _optz = (_a = o.code) === null || _a === undefined ? undefined : _a.optimize;
3958
+ const _optz = (_a3 = o.code) === null || _a3 === undefined ? undefined : _a3.optimize;
3959
3959
  const optimize2 = _optz === true || _optz === undefined ? 1 : _optz || 0;
3960
3960
  const regExp = (_c = (_b = o.code) === null || _b === undefined ? undefined : _b.regExp) !== null && _c !== undefined ? _c : defaultRegExp;
3961
3961
  const uriResolver = (_d = o.uriResolver) !== null && _d !== undefined ? _d : uri_1.default;
@@ -4014,19 +4014,19 @@ var require_core = __commonJS((exports) => {
4014
4014
  this.addKeyword("$async");
4015
4015
  }
4016
4016
  _addDefaultMetaSchema() {
4017
- const { $data, meta, schemaId } = this.opts;
4017
+ const { $data, meta: meta2, schemaId } = this.opts;
4018
4018
  let _dataRefSchema = $dataRefSchema;
4019
4019
  if (schemaId === "id") {
4020
4020
  _dataRefSchema = { ...$dataRefSchema };
4021
4021
  _dataRefSchema.id = _dataRefSchema.$id;
4022
4022
  delete _dataRefSchema.$id;
4023
4023
  }
4024
- if (meta && $data)
4024
+ if (meta2 && $data)
4025
4025
  this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
4026
4026
  }
4027
4027
  defaultMeta() {
4028
- const { meta, schemaId } = this.opts;
4029
- return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined;
4028
+ const { meta: meta2, schemaId } = this.opts;
4029
+ return this.opts.defaultMeta = typeof meta2 == "object" ? meta2[schemaId] || meta2 : undefined;
4030
4030
  }
4031
4031
  validate(schemaKeyRef, data) {
4032
4032
  let v;
@@ -4046,12 +4046,12 @@ var require_core = __commonJS((exports) => {
4046
4046
  const sch = this._addSchema(schema, _meta);
4047
4047
  return sch.validate || this._compileSchemaEnv(sch);
4048
4048
  }
4049
- compileAsync(schema, meta) {
4049
+ compileAsync(schema, meta2) {
4050
4050
  if (typeof this.opts.loadSchema != "function") {
4051
4051
  throw new Error("options.loadSchema should be a function");
4052
4052
  }
4053
4053
  const { loadSchema } = this.opts;
4054
- return runCompileAsync.call(this, schema, meta);
4054
+ return runCompileAsync.call(this, schema, meta2);
4055
4055
  async function runCompileAsync(_schema, _meta) {
4056
4056
  await loadMetaSchema.call(this, _schema.$schema);
4057
4057
  const sch = this._addSchema(_schema, _meta);
@@ -4083,7 +4083,7 @@ var require_core = __commonJS((exports) => {
4083
4083
  if (!this.refs[ref])
4084
4084
  await loadMetaSchema.call(this, _schema.$schema);
4085
4085
  if (!this.refs[ref])
4086
- this.addSchema(_schema, ref, meta);
4086
+ this.addSchema(_schema, ref, meta2);
4087
4087
  }
4088
4088
  async function _loadSchema(ref) {
4089
4089
  const p = this._loading[ref];
@@ -4287,7 +4287,7 @@ var require_core = __commonJS((exports) => {
4287
4287
  }
4288
4288
  }
4289
4289
  }
4290
- _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
4290
+ _addSchema(schema, meta2, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
4291
4291
  let id3;
4292
4292
  const { schemaId } = this.opts;
4293
4293
  if (typeof schema == "object") {
@@ -4303,7 +4303,7 @@ var require_core = __commonJS((exports) => {
4303
4303
  return sch;
4304
4304
  baseId = (0, resolve_1.normalizeId)(id3 || baseId);
4305
4305
  const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
4306
- sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
4306
+ sch = new compile_1.SchemaEnv({ schema, schemaId, meta: meta2, baseId, localRefs });
4307
4307
  this._cache.set(sch.schema, sch);
4308
4308
  if (addSchema && !baseId.startsWith("#")) {
4309
4309
  if (baseId)
@@ -4414,7 +4414,7 @@ var require_core = __commonJS((exports) => {
4414
4414
  }
4415
4415
  }
4416
4416
  function addRule(keyword, definition, dataType) {
4417
- var _a;
4417
+ var _a3;
4418
4418
  const post5 = definition === null || definition === undefined ? undefined : definition.post;
4419
4419
  if (dataType && post5)
4420
4420
  throw new Error('keyword with "post" flag cannot have "type"');
@@ -4440,7 +4440,7 @@ var require_core = __commonJS((exports) => {
4440
4440
  else
4441
4441
  ruleGroup.rules.push(rule);
4442
4442
  RULES.all[keyword] = rule;
4443
- (_a = definition.implements) === null || _a === undefined || _a.forEach((kwd) => this.addKeyword(kwd));
4443
+ (_a3 = definition.implements) === null || _a3 === undefined || _a3.forEach((kwd) => this.addKeyword(kwd));
4444
4444
  }
4445
4445
  function addBeforeRule(ruleGroup, rule, before3) {
4446
4446
  const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before3);
@@ -4568,10 +4568,10 @@ var require_ref = __commonJS((exports) => {
4568
4568
  gen5.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
4569
4569
  }
4570
4570
  function addEvaluatedFrom(source) {
4571
- var _a;
4571
+ var _a3;
4572
4572
  if (!it.opts.unevaluated)
4573
4573
  return;
4574
- const schEvaluated = (_a = sch === null || sch === undefined ? undefined : sch.validate) === null || _a === undefined ? undefined : _a.evaluated;
4574
+ const schEvaluated = (_a3 = sch === null || sch === undefined ? undefined : sch.validate) === null || _a3 === undefined ? undefined : _a3.evaluated;
4575
4575
  if (it.props !== true) {
4576
4576
  if (schEvaluated && !schEvaluated.dynamicProps) {
4577
4577
  if (schEvaluated.props !== undefined) {
@@ -6098,7 +6098,7 @@ var require_discriminator = __commonJS((exports) => {
6098
6098
  return _valid;
6099
6099
  }
6100
6100
  function getMapping() {
6101
- var _a;
6101
+ var _a3;
6102
6102
  const oneOfMapping = {};
6103
6103
  const topRequired = hasRequired(parentSchema);
6104
6104
  let tagRequired = true;
@@ -6112,7 +6112,7 @@ var require_discriminator = __commonJS((exports) => {
6112
6112
  if (sch === undefined)
6113
6113
  throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
6114
6114
  }
6115
- const propSch = (_a = sch === null || sch === undefined ? undefined : sch.properties) === null || _a === undefined ? undefined : _a[tagName];
6115
+ const propSch = (_a3 = sch === null || sch === undefined ? undefined : sch.properties) === null || _a3 === undefined ? undefined : _a3[tagName];
6116
6116
  if (typeof propSch != "object") {
6117
6117
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
6118
6118
  }
@@ -6645,9 +6645,9 @@ var require_dist = __commonJS((exports, module) => {
6645
6645
  return f;
6646
6646
  };
6647
6647
  function addFormats(ajv, list, fs, exportName) {
6648
- var _a;
6648
+ var _a3;
6649
6649
  var _b;
6650
- (_a = (_b = ajv.opts.code).formats) !== null && _a !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
6650
+ (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
6651
6651
  for (const f of list)
6652
6652
  ajv.addFormat(f, fs[f]);
6653
6653
  }
@@ -6657,7 +6657,7 @@ var require_dist = __commonJS((exports, module) => {
6657
6657
  });
6658
6658
 
6659
6659
  // packages/mcp/server.ts
6660
- import { basename as basename2, join as join8 } from "node:path";
6660
+ import { basename as basename2, join as join9 } from "node:path";
6661
6661
  // node_modules/.bun/effect@3.21.4/node_modules/effect/dist/esm/Array.js
6662
6662
  var exports_Array = {};
6663
6663
  __export(exports_Array, {
@@ -48495,16 +48495,16 @@ var zulipAdapter = (config2) => exports_Effect.gen(function* () {
48495
48495
  };
48496
48496
  });
48497
48497
  var attachmentReference = (upload) => `[${upload.filename}](${upload.url})`;
48498
- // node_modules/.bun/@effect+platform-node@0.107.0+ae4c33d685bbc006/node_modules/@effect/platform-node/dist/esm/NodeContext.js
48498
+ // node_modules/.bun/@effect+platform-node@0.107.0+00b092e1ced32cfa/node_modules/@effect/platform-node/dist/esm/NodeContext.js
48499
48499
  var exports_NodeContext = {};
48500
48500
  __export(exports_NodeContext, {
48501
48501
  layer: () => layer13
48502
48502
  });
48503
48503
 
48504
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
48504
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
48505
48505
  import * as ChildProcess from "node:child_process";
48506
48506
 
48507
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/error.js
48507
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/error.js
48508
48508
  var handleErrnoException = (module, method) => (err, [path]) => {
48509
48509
  let reason = "Unknown";
48510
48510
  switch (err.code) {
@@ -48541,7 +48541,7 @@ var handleErrnoException = (module, method) => (err, [path]) => {
48541
48541
  });
48542
48542
  };
48543
48543
 
48544
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.js
48544
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.js
48545
48545
  var fromReadable = (evaluate3, onError5, options5) => fromChannel3(fromReadableChannel(evaluate3, onError5, options5));
48546
48546
  var fromReadableChannel = (evaluate3, onError5, options5) => suspend14(() => unsafeReadableRead(evaluate3(), onError5, make13(undefined), options5));
48547
48547
  var writeInput = (writable, onFailure, {
@@ -48629,7 +48629,7 @@ var unsafeReadableRead = (readable, onError5, exit3, options5) => {
48629
48629
  }));
48630
48630
  };
48631
48631
 
48632
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.js
48632
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.js
48633
48633
  var fromWritable = (evaluate3, onError5, options5) => fromChannel4(fromWritableChannel(evaluate3, onError5, options5));
48634
48634
  var fromWritableChannel = (writable, onError5, options5) => flatMap23(zip10(sync8(() => writable()), make28()), ([writable2, deferred]) => embedInput2(writableOutput(writable2, deferred, onError5), writeInput(writable2, (cause3) => failCause2(deferred, cause3), options5, complete(deferred, _void))));
48635
48635
  var writableOutput = (writable, deferred, onError5) => suspend5(() => {
@@ -48642,7 +48642,7 @@ var writableOutput = (writable, deferred, onError5) => suspend5(() => {
48642
48642
  }));
48643
48643
  });
48644
48644
 
48645
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
48645
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
48646
48646
  var inputToStdioOption = (stdin3) => typeof stdin3 === "string" ? stdin3 : "pipe";
48647
48647
  var outputToStdioOption = (output) => typeof output === "string" ? output : "pipe";
48648
48648
  var toError = (err) => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));
@@ -48762,7 +48762,7 @@ var runCommand = (fileSystem) => (command) => {
48762
48762
  };
48763
48763
  var layer3 = /* @__PURE__ */ effect(CommandExecutor2, /* @__PURE__ */ pipe(FileSystem, /* @__PURE__ */ map21((fileSystem) => makeExecutor2(runCommand(fileSystem)))));
48764
48764
 
48765
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
48765
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
48766
48766
  var layer4 = layer3;
48767
48767
 
48768
48768
  // node_modules/.bun/@effect+platform@0.96.2+db9539d6c7dc5883/node_modules/@effect/platform/dist/esm/internal/effectify.js
@@ -48783,7 +48783,7 @@ var effectify = (fn2, onError5, onSyncError) => (...args2) => async((resume2) =>
48783
48783
  // node_modules/.bun/@effect+platform@0.96.2+db9539d6c7dc5883/node_modules/@effect/platform/dist/esm/Effectify.js
48784
48784
  var effectify2 = effectify;
48785
48785
 
48786
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.js
48786
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.js
48787
48787
  import * as Crypto from "node:crypto";
48788
48788
  import * as NFS from "node:fs";
48789
48789
  import * as OS from "node:os";
@@ -49143,7 +49143,7 @@ var makeFileSystem = /* @__PURE__ */ map21(/* @__PURE__ */ serviceOption2(WatchB
49143
49143
  }));
49144
49144
  var layer5 = /* @__PURE__ */ effect(FileSystem, makeFileSystem);
49145
49145
 
49146
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js
49146
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js
49147
49147
  var layer6 = layer5;
49148
49148
 
49149
49149
  // node_modules/.bun/@effect+platform@0.96.2+db9539d6c7dc5883/node_modules/@effect/platform/dist/esm/internal/path.js
@@ -49634,7 +49634,7 @@ var posixImpl = /* @__PURE__ */ Path3.of({
49634
49634
  var TypeId39 = TypeId38;
49635
49635
  var Path4 = Path3;
49636
49636
 
49637
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/path.js
49637
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/path.js
49638
49638
  import * as NodePath from "node:path";
49639
49639
  import * as NodeUrl from "node:url";
49640
49640
  var fromFileUrl2 = (url3) => try_3({
@@ -49674,7 +49674,7 @@ var layer8 = /* @__PURE__ */ succeed14(Path4, /* @__PURE__ */ Path4.of({
49674
49674
  toFileUrl: toFileUrl2
49675
49675
  }));
49676
49676
 
49677
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/NodePath.js
49677
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/NodePath.js
49678
49678
  var layer9 = layer8;
49679
49679
 
49680
49680
  // node_modules/.bun/@effect+platform@0.96.2+db9539d6c7dc5883/node_modules/@effect/platform/dist/esm/internal/terminal.js
@@ -50104,7 +50104,7 @@ var isMailbox = (u) => hasProperty(u, TypeId41);
50104
50104
  var make75 = make74;
50105
50105
  var toChannel5 = toChannel4;
50106
50106
 
50107
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.js
50107
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.js
50108
50108
  import * as readline from "node:readline";
50109
50109
  var defaultShouldQuit = (input) => input.key.ctrl && (input.key.name === "c" || input.key.name === "d");
50110
50110
  var make76 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQuit) {
@@ -50177,7 +50177,7 @@ var make76 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
50177
50177
  });
50178
50178
  var layer10 = /* @__PURE__ */ scoped4(Terminal2, /* @__PURE__ */ make76(defaultShouldQuit));
50179
50179
 
50180
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.js
50180
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.js
50181
50181
  var layer11 = layer10;
50182
50182
 
50183
50183
  // node_modules/.bun/effect@3.21.4/node_modules/effect/dist/esm/FiberSet.js
@@ -50474,7 +50474,7 @@ var makePlatform2 = makePlatform;
50474
50474
  var PlatformWorker2 = PlatformWorker;
50475
50475
  var layerManager2 = layerManager;
50476
50476
 
50477
- // node_modules/.bun/@effect+platform-node@0.107.0+ae4c33d685bbc006/node_modules/@effect/platform-node/dist/esm/internal/worker.js
50477
+ // node_modules/.bun/@effect+platform-node@0.107.0+00b092e1ced32cfa/node_modules/@effect/platform-node/dist/esm/internal/worker.js
50478
50478
  var platformWorkerImpl = /* @__PURE__ */ makePlatform2()({
50479
50479
  setup({
50480
50480
  scope: scope5,
@@ -50535,12 +50535,12 @@ var platformWorkerImpl = /* @__PURE__ */ makePlatform2()({
50535
50535
  var layerWorker = /* @__PURE__ */ succeed14(PlatformWorker2, platformWorkerImpl);
50536
50536
  var layerManager3 = /* @__PURE__ */ provide3(layerManager2, layerWorker);
50537
50537
 
50538
- // node_modules/.bun/@effect+platform-node@0.107.0+ae4c33d685bbc006/node_modules/@effect/platform-node/dist/esm/NodeWorker.js
50538
+ // node_modules/.bun/@effect+platform-node@0.107.0+00b092e1ced32cfa/node_modules/@effect/platform-node/dist/esm/NodeWorker.js
50539
50539
  var layerManager4 = layerManager3;
50540
50540
 
50541
- // node_modules/.bun/@effect+platform-node@0.107.0+ae4c33d685bbc006/node_modules/@effect/platform-node/dist/esm/NodeContext.js
50541
+ // node_modules/.bun/@effect+platform-node@0.107.0+00b092e1ced32cfa/node_modules/@effect/platform-node/dist/esm/NodeContext.js
50542
50542
  var layer13 = /* @__PURE__ */ pipe(/* @__PURE__ */ mergeAll6(layer9, layer4, layer11, layerManager4), /* @__PURE__ */ provideMerge2(layer6));
50543
- // node_modules/.bun/@effect+platform-node@0.107.0+ae4c33d685bbc006/node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
50543
+ // node_modules/.bun/@effect+platform-node@0.107.0+00b092e1ced32cfa/node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
50544
50544
  var exports_NodeRuntime = {};
50545
50545
  __export(exports_NodeRuntime, {
50546
50546
  runMain: () => runMain3
@@ -50579,7 +50579,7 @@ var makeRunMain = (f) => dual((args2) => isEffect2(args2[0]), (effect4, options5
50579
50579
  });
50580
50580
  });
50581
50581
 
50582
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/internal/runtime.js
50582
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/internal/runtime.js
50583
50583
  var runMain = /* @__PURE__ */ makeRunMain(({
50584
50584
  fiber,
50585
50585
  teardown
@@ -50608,34 +50608,41 @@ var runMain = /* @__PURE__ */ makeRunMain(({
50608
50608
  process.on("SIGTERM", onSigint);
50609
50609
  });
50610
50610
 
50611
- // node_modules/.bun/@effect+platform-node-shared@0.60.0+ae4c33d685bbc006/node_modules/@effect/platform-node-shared/dist/esm/NodeRuntime.js
50611
+ // node_modules/.bun/@effect+platform-node-shared@0.60.0+00b092e1ced32cfa/node_modules/@effect/platform-node-shared/dist/esm/NodeRuntime.js
50612
50612
  var runMain2 = runMain;
50613
50613
 
50614
- // node_modules/.bun/@effect+platform-node@0.107.0+ae4c33d685bbc006/node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
50614
+ // node_modules/.bun/@effect+platform-node@0.107.0+00b092e1ced32cfa/node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
50615
50615
  var runMain3 = runMain2;
50616
50616
  // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
50617
- import process2 from "node:process";
50617
+ import process3 from "node:process";
50618
50618
 
50619
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/core.js
50620
- var NEVER = Object.freeze({
50621
- status: "aborted"
50622
- });
50619
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/core.js
50620
+ var _a;
50623
50621
  function $constructor(name, initializer, params) {
50624
50622
  function init2(inst, def) {
50625
- var _a;
50626
- Object.defineProperty(inst, "_zod", {
50627
- value: inst._zod ?? {},
50628
- enumerable: false
50629
- });
50630
- (_a = inst._zod).traits ?? (_a.traits = new Set);
50623
+ if (!inst._zod) {
50624
+ Object.defineProperty(inst, "_zod", {
50625
+ value: {
50626
+ def,
50627
+ constr: _,
50628
+ traits: new Set
50629
+ },
50630
+ enumerable: false
50631
+ });
50632
+ }
50633
+ if (inst._zod.traits.has(name)) {
50634
+ return;
50635
+ }
50631
50636
  inst._zod.traits.add(name);
50632
50637
  initializer(inst, def);
50633
- for (const k in _.prototype) {
50634
- if (!(k in inst))
50635
- Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
50638
+ const proto14 = _.prototype;
50639
+ const keys6 = Object.keys(proto14);
50640
+ for (let i = 0;i < keys6.length; i++) {
50641
+ const k = keys6[i];
50642
+ if (!(k in inst)) {
50643
+ inst[k] = proto14[k].bind(inst);
50644
+ }
50636
50645
  }
50637
- inst._zod.constr = _;
50638
- inst._zod.def = def;
50639
50646
  }
50640
50647
  const Parent = params?.Parent ?? Object;
50641
50648
 
@@ -50643,10 +50650,10 @@ function $constructor(name, initializer, params) {
50643
50650
  }
50644
50651
  Object.defineProperty(Definition, "name", { value: name });
50645
50652
  function _(def) {
50646
- var _a;
50653
+ var _a2;
50647
50654
  const inst = params?.Parent ? new Definition : this;
50648
50655
  init2(inst, def);
50649
- (_a = inst._zod).deferred ?? (_a.deferred = []);
50656
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
50650
50657
  for (const fn2 of inst._zod.deferred) {
50651
50658
  fn2();
50652
50659
  }
@@ -50670,17 +50677,31 @@ class $ZodAsyncError extends Error {
50670
50677
  super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
50671
50678
  }
50672
50679
  }
50673
- var globalConfig = {};
50680
+
50681
+ class $ZodEncodeError extends Error {
50682
+ constructor(name) {
50683
+ super(`Encountered unidirectional transform during encode: ${name}`);
50684
+ this.name = "ZodEncodeError";
50685
+ }
50686
+ }
50687
+ (_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
50688
+ var globalConfig = globalThis.__zod_globalConfig;
50674
50689
  function config2(newConfig) {
50675
50690
  if (newConfig)
50676
50691
  Object.assign(globalConfig, newConfig);
50677
50692
  return globalConfig;
50678
50693
  }
50679
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/util.js
50694
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/util.js
50680
50695
  var exports_util2 = {};
50681
50696
  __export(exports_util2, {
50682
50697
  unwrapMessage: () => unwrapMessage,
50698
+ uint8ArrayToHex: () => uint8ArrayToHex,
50699
+ uint8ArrayToBase64url: () => uint8ArrayToBase64url,
50700
+ uint8ArrayToBase64: () => uint8ArrayToBase64,
50683
50701
  stringifyPrimitive: () => stringifyPrimitive,
50702
+ slugify: () => slugify,
50703
+ shallowClone: () => shallowClone,
50704
+ safeExtend: () => safeExtend,
50684
50705
  required: () => required3,
50685
50706
  randomString: () => randomString,
50686
50707
  propertyKeyTypes: () => propertyKeyTypes,
@@ -50689,17 +50710,21 @@ __export(exports_util2, {
50689
50710
  prefixIssues: () => prefixIssues,
50690
50711
  pick: () => pick6,
50691
50712
  partial: () => partial3,
50713
+ parsedType: () => parsedType,
50692
50714
  optionalKeys: () => optionalKeys,
50693
50715
  omit: () => omit6,
50716
+ objectClone: () => objectClone,
50694
50717
  numKeys: () => numKeys,
50695
50718
  nullish: () => nullish,
50696
50719
  normalizeParams: () => normalizeParams,
50720
+ mergeDefs: () => mergeDefs,
50697
50721
  merge: () => merge13,
50698
50722
  jsonStringifyReplacer: () => jsonStringifyReplacer,
50699
50723
  joinValues: () => joinValues,
50700
50724
  issue: () => issue,
50701
50725
  isPlainObject: () => isPlainObject,
50702
50726
  isObject: () => isObject2,
50727
+ hexToUint8Array: () => hexToUint8Array,
50703
50728
  getSizableOrigin: () => getSizableOrigin,
50704
50729
  getParsedType: () => getParsedType,
50705
50730
  getLengthableOrigin: () => getLengthableOrigin,
@@ -50708,15 +50733,19 @@ __export(exports_util2, {
50708
50733
  floatSafeRemainder: () => floatSafeRemainder,
50709
50734
  finalizeIssue: () => finalizeIssue,
50710
50735
  extend: () => extend5,
50736
+ explicitlyAborted: () => explicitlyAborted,
50711
50737
  escapeRegex: () => escapeRegex,
50712
50738
  esc: () => esc,
50713
50739
  defineLazy: () => defineLazy,
50714
50740
  createTransparentProxy: () => createTransparentProxy,
50741
+ cloneDef: () => cloneDef,
50715
50742
  clone: () => clone2,
50716
50743
  cleanRegex: () => cleanRegex,
50717
50744
  cleanEnum: () => cleanEnum,
50718
50745
  captureStackTrace: () => captureStackTrace,
50719
50746
  cached: () => cached4,
50747
+ base64urlToUint8Array: () => base64urlToUint8Array,
50748
+ base64ToUint8Array: () => base64ToUint8Array,
50720
50749
  assignProp: () => assignProp,
50721
50750
  assertNotEqual: () => assertNotEqual,
50722
50751
  assertNever: () => assertNever,
@@ -50737,7 +50766,7 @@ function assertNotEqual(val) {
50737
50766
  }
50738
50767
  function assertIs(_arg) {}
50739
50768
  function assertNever(_x) {
50740
- throw new Error;
50769
+ throw new Error("Unexpected value in exhaustive check");
50741
50770
  }
50742
50771
  function assert(_) {}
50743
50772
  function getEnumValues(entries3) {
@@ -50775,23 +50804,26 @@ function cleanRegex(source) {
50775
50804
  return source.slice(start5, end6);
50776
50805
  }
50777
50806
  function floatSafeRemainder(val, step4) {
50778
- const valDecCount = (val.toString().split(".")[1] || "").length;
50779
- const stepDecCount = (step4.toString().split(".")[1] || "").length;
50780
- const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
50781
- const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
50782
- const stepInt = Number.parseInt(step4.toFixed(decCount).replace(".", ""));
50783
- return valInt % stepInt / 10 ** decCount;
50807
+ const ratio = val / step4;
50808
+ const roundedRatio = Math.round(ratio);
50809
+ const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
50810
+ if (Math.abs(ratio - roundedRatio) < tolerance)
50811
+ return 0;
50812
+ return ratio - roundedRatio;
50784
50813
  }
50814
+ var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
50785
50815
  function defineLazy(object, key, getter) {
50786
- const set13 = false;
50816
+ let value5 = undefined;
50787
50817
  Object.defineProperty(object, key, {
50788
50818
  get() {
50789
- if (!set13) {
50790
- const value5 = getter();
50791
- object[key] = value5;
50792
- return value5;
50819
+ if (value5 === EVALUATING) {
50820
+ return;
50793
50821
  }
50794
- throw new Error("cached value already set");
50822
+ if (value5 === undefined) {
50823
+ value5 = EVALUATING;
50824
+ value5 = getter();
50825
+ }
50826
+ return value5;
50795
50827
  },
50796
50828
  set(v) {
50797
50829
  Object.defineProperty(object, key, {
@@ -50801,6 +50833,9 @@ function defineLazy(object, key, getter) {
50801
50833
  configurable: true
50802
50834
  });
50803
50835
  }
50836
+ function objectClone(obj) {
50837
+ return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
50838
+ }
50804
50839
  function assignProp(target, prop, value5) {
50805
50840
  Object.defineProperty(target, prop, {
50806
50841
  value: value5,
@@ -50809,6 +50844,17 @@ function assignProp(target, prop, value5) {
50809
50844
  configurable: true
50810
50845
  });
50811
50846
  }
50847
+ function mergeDefs(...defs) {
50848
+ const mergedDescriptors = {};
50849
+ for (const def of defs) {
50850
+ const descriptors = Object.getOwnPropertyDescriptors(def);
50851
+ Object.assign(mergedDescriptors, descriptors);
50852
+ }
50853
+ return Object.defineProperties({}, mergedDescriptors);
50854
+ }
50855
+ function cloneDef(schema) {
50856
+ return mergeDefs(schema._zod.def);
50857
+ }
50812
50858
  function getElementAtPath(obj, path) {
50813
50859
  if (!path)
50814
50860
  return obj;
@@ -50836,11 +50882,17 @@ function randomString(length6 = 10) {
50836
50882
  function esc(str) {
50837
50883
  return JSON.stringify(str);
50838
50884
  }
50839
- var captureStackTrace = Error.captureStackTrace ? Error.captureStackTrace : (..._args) => {};
50885
+ function slugify(input) {
50886
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
50887
+ }
50888
+ var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
50840
50889
  function isObject2(data) {
50841
50890
  return typeof data === "object" && data !== null && !Array.isArray(data);
50842
50891
  }
50843
- var allowsEval = cached4(() => {
50892
+ var allowsEval = /* @__PURE__ */ cached4(() => {
50893
+ if (globalConfig.jitless) {
50894
+ return false;
50895
+ }
50844
50896
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
50845
50897
  return false;
50846
50898
  }
@@ -50858,6 +50910,8 @@ function isPlainObject(o) {
50858
50910
  const ctor = o.constructor;
50859
50911
  if (ctor === undefined)
50860
50912
  return true;
50913
+ if (typeof ctor !== "function")
50914
+ return true;
50861
50915
  const prot = ctor.prototype;
50862
50916
  if (isObject2(prot) === false)
50863
50917
  return false;
@@ -50866,6 +50920,17 @@ function isPlainObject(o) {
50866
50920
  }
50867
50921
  return true;
50868
50922
  }
50923
+ function shallowClone(o) {
50924
+ if (isPlainObject(o))
50925
+ return { ...o };
50926
+ if (Array.isArray(o))
50927
+ return [...o];
50928
+ if (o instanceof Map)
50929
+ return new Map(o);
50930
+ if (o instanceof Set)
50931
+ return new Set(o);
50932
+ return o;
50933
+ }
50869
50934
  function numKeys(data) {
50870
50935
  let keyCount = 0;
50871
50936
  for (const key in data) {
@@ -50919,8 +50984,15 @@ var getParsedType = (data) => {
50919
50984
  throw new Error(`Unknown data type: ${t}`);
50920
50985
  }
50921
50986
  };
50922
- var propertyKeyTypes = new Set(["string", "number", "symbol"]);
50923
- var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
50987
+ var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
50988
+ var primitiveTypes = /* @__PURE__ */ new Set([
50989
+ "string",
50990
+ "number",
50991
+ "bigint",
50992
+ "boolean",
50993
+ "symbol",
50994
+ "undefined"
50995
+ ]);
50924
50996
  function escapeRegex(str) {
50925
50997
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
50926
50998
  }
@@ -51003,135 +51075,201 @@ var BIGINT_FORMAT_RANGES = {
51003
51075
  uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
51004
51076
  };
51005
51077
  function pick6(schema, mask) {
51006
- const newShape = {};
51007
51078
  const currDef = schema._zod.def;
51008
- for (const key in mask) {
51009
- if (!(key in currDef.shape)) {
51010
- throw new Error(`Unrecognized key: "${key}"`);
51011
- }
51012
- if (!mask[key])
51013
- continue;
51014
- newShape[key] = currDef.shape[key];
51079
+ const checks = currDef.checks;
51080
+ const hasChecks = checks && checks.length > 0;
51081
+ if (hasChecks) {
51082
+ throw new Error(".pick() cannot be used on object schemas containing refinements");
51015
51083
  }
51016
- return clone2(schema, {
51017
- ...schema._zod.def,
51018
- shape: newShape,
51084
+ const def = mergeDefs(schema._zod.def, {
51085
+ get shape() {
51086
+ const newShape = {};
51087
+ for (const key in mask) {
51088
+ if (!(key in currDef.shape)) {
51089
+ throw new Error(`Unrecognized key: "${key}"`);
51090
+ }
51091
+ if (!mask[key])
51092
+ continue;
51093
+ newShape[key] = currDef.shape[key];
51094
+ }
51095
+ assignProp(this, "shape", newShape);
51096
+ return newShape;
51097
+ },
51019
51098
  checks: []
51020
51099
  });
51100
+ return clone2(schema, def);
51021
51101
  }
51022
51102
  function omit6(schema, mask) {
51023
- const newShape = { ...schema._zod.def.shape };
51024
51103
  const currDef = schema._zod.def;
51025
- for (const key in mask) {
51026
- if (!(key in currDef.shape)) {
51027
- throw new Error(`Unrecognized key: "${key}"`);
51028
- }
51029
- if (!mask[key])
51030
- continue;
51031
- delete newShape[key];
51104
+ const checks = currDef.checks;
51105
+ const hasChecks = checks && checks.length > 0;
51106
+ if (hasChecks) {
51107
+ throw new Error(".omit() cannot be used on object schemas containing refinements");
51032
51108
  }
51033
- return clone2(schema, {
51034
- ...schema._zod.def,
51035
- shape: newShape,
51109
+ const def = mergeDefs(schema._zod.def, {
51110
+ get shape() {
51111
+ const newShape = { ...schema._zod.def.shape };
51112
+ for (const key in mask) {
51113
+ if (!(key in currDef.shape)) {
51114
+ throw new Error(`Unrecognized key: "${key}"`);
51115
+ }
51116
+ if (!mask[key])
51117
+ continue;
51118
+ delete newShape[key];
51119
+ }
51120
+ assignProp(this, "shape", newShape);
51121
+ return newShape;
51122
+ },
51036
51123
  checks: []
51037
51124
  });
51125
+ return clone2(schema, def);
51038
51126
  }
51039
51127
  function extend5(schema, shape) {
51040
51128
  if (!isPlainObject(shape)) {
51041
51129
  throw new Error("Invalid input to extend: expected a plain object");
51042
51130
  }
51043
- const def = {
51044
- ...schema._zod.def,
51131
+ const checks = schema._zod.def.checks;
51132
+ const hasChecks = checks && checks.length > 0;
51133
+ if (hasChecks) {
51134
+ const existingShape = schema._zod.def.shape;
51135
+ for (const key in shape) {
51136
+ if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
51137
+ throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
51138
+ }
51139
+ }
51140
+ }
51141
+ const def = mergeDefs(schema._zod.def, {
51045
51142
  get shape() {
51046
51143
  const _shape = { ...schema._zod.def.shape, ...shape };
51047
51144
  assignProp(this, "shape", _shape);
51048
51145
  return _shape;
51049
- },
51050
- checks: []
51051
- };
51146
+ }
51147
+ });
51148
+ return clone2(schema, def);
51149
+ }
51150
+ function safeExtend(schema, shape) {
51151
+ if (!isPlainObject(shape)) {
51152
+ throw new Error("Invalid input to safeExtend: expected a plain object");
51153
+ }
51154
+ const def = mergeDefs(schema._zod.def, {
51155
+ get shape() {
51156
+ const _shape = { ...schema._zod.def.shape, ...shape };
51157
+ assignProp(this, "shape", _shape);
51158
+ return _shape;
51159
+ }
51160
+ });
51052
51161
  return clone2(schema, def);
51053
51162
  }
51054
51163
  function merge13(a, b) {
51055
- return clone2(a, {
51056
- ...a._zod.def,
51164
+ if (a._zod.def.checks?.length) {
51165
+ throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
51166
+ }
51167
+ const def = mergeDefs(a._zod.def, {
51057
51168
  get shape() {
51058
51169
  const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
51059
51170
  assignProp(this, "shape", _shape);
51060
51171
  return _shape;
51061
51172
  },
51062
- catchall: b._zod.def.catchall,
51063
- checks: []
51173
+ get catchall() {
51174
+ return b._zod.def.catchall;
51175
+ },
51176
+ checks: b._zod.def.checks ?? []
51064
51177
  });
51178
+ return clone2(a, def);
51065
51179
  }
51066
51180
  function partial3(Class7, schema, mask) {
51067
- const oldShape = schema._zod.def.shape;
51068
- const shape = { ...oldShape };
51069
- if (mask) {
51070
- for (const key in mask) {
51071
- if (!(key in oldShape)) {
51072
- throw new Error(`Unrecognized key: "${key}"`);
51073
- }
51074
- if (!mask[key])
51075
- continue;
51076
- shape[key] = Class7 ? new Class7({
51077
- type: "optional",
51078
- innerType: oldShape[key]
51079
- }) : oldShape[key];
51080
- }
51081
- } else {
51082
- for (const key in oldShape) {
51083
- shape[key] = Class7 ? new Class7({
51084
- type: "optional",
51085
- innerType: oldShape[key]
51086
- }) : oldShape[key];
51087
- }
51181
+ const currDef = schema._zod.def;
51182
+ const checks = currDef.checks;
51183
+ const hasChecks = checks && checks.length > 0;
51184
+ if (hasChecks) {
51185
+ throw new Error(".partial() cannot be used on object schemas containing refinements");
51088
51186
  }
51089
- return clone2(schema, {
51090
- ...schema._zod.def,
51091
- shape,
51187
+ const def = mergeDefs(schema._zod.def, {
51188
+ get shape() {
51189
+ const oldShape = schema._zod.def.shape;
51190
+ const shape = { ...oldShape };
51191
+ if (mask) {
51192
+ for (const key in mask) {
51193
+ if (!(key in oldShape)) {
51194
+ throw new Error(`Unrecognized key: "${key}"`);
51195
+ }
51196
+ if (!mask[key])
51197
+ continue;
51198
+ shape[key] = Class7 ? new Class7({
51199
+ type: "optional",
51200
+ innerType: oldShape[key]
51201
+ }) : oldShape[key];
51202
+ }
51203
+ } else {
51204
+ for (const key in oldShape) {
51205
+ shape[key] = Class7 ? new Class7({
51206
+ type: "optional",
51207
+ innerType: oldShape[key]
51208
+ }) : oldShape[key];
51209
+ }
51210
+ }
51211
+ assignProp(this, "shape", shape);
51212
+ return shape;
51213
+ },
51092
51214
  checks: []
51093
51215
  });
51216
+ return clone2(schema, def);
51094
51217
  }
51095
51218
  function required3(Class7, schema, mask) {
51096
- const oldShape = schema._zod.def.shape;
51097
- const shape = { ...oldShape };
51098
- if (mask) {
51099
- for (const key in mask) {
51100
- if (!(key in shape)) {
51101
- throw new Error(`Unrecognized key: "${key}"`);
51102
- }
51103
- if (!mask[key])
51104
- continue;
51105
- shape[key] = new Class7({
51106
- type: "nonoptional",
51107
- innerType: oldShape[key]
51108
- });
51109
- }
51110
- } else {
51111
- for (const key in oldShape) {
51112
- shape[key] = new Class7({
51113
- type: "nonoptional",
51114
- innerType: oldShape[key]
51115
- });
51219
+ const def = mergeDefs(schema._zod.def, {
51220
+ get shape() {
51221
+ const oldShape = schema._zod.def.shape;
51222
+ const shape = { ...oldShape };
51223
+ if (mask) {
51224
+ for (const key in mask) {
51225
+ if (!(key in shape)) {
51226
+ throw new Error(`Unrecognized key: "${key}"`);
51227
+ }
51228
+ if (!mask[key])
51229
+ continue;
51230
+ shape[key] = new Class7({
51231
+ type: "nonoptional",
51232
+ innerType: oldShape[key]
51233
+ });
51234
+ }
51235
+ } else {
51236
+ for (const key in oldShape) {
51237
+ shape[key] = new Class7({
51238
+ type: "nonoptional",
51239
+ innerType: oldShape[key]
51240
+ });
51241
+ }
51242
+ }
51243
+ assignProp(this, "shape", shape);
51244
+ return shape;
51116
51245
  }
51117
- }
51118
- return clone2(schema, {
51119
- ...schema._zod.def,
51120
- shape,
51121
- checks: []
51122
51246
  });
51247
+ return clone2(schema, def);
51123
51248
  }
51124
51249
  function aborted(x, startIndex = 0) {
51250
+ if (x.aborted === true)
51251
+ return true;
51125
51252
  for (let i = startIndex;i < x.issues.length; i++) {
51126
- if (x.issues[i]?.continue !== true)
51253
+ if (x.issues[i]?.continue !== true) {
51127
51254
  return true;
51255
+ }
51256
+ }
51257
+ return false;
51258
+ }
51259
+ function explicitlyAborted(x, startIndex = 0) {
51260
+ if (x.aborted === true)
51261
+ return true;
51262
+ for (let i = startIndex;i < x.issues.length; i++) {
51263
+ if (x.issues[i]?.continue === false) {
51264
+ return true;
51265
+ }
51128
51266
  }
51129
51267
  return false;
51130
51268
  }
51131
51269
  function prefixIssues(path, issues) {
51132
51270
  return issues.map((iss) => {
51133
- var _a;
51134
- (_a = iss).path ?? (_a.path = []);
51271
+ var _a2;
51272
+ (_a2 = iss).path ?? (_a2.path = []);
51135
51273
  iss.path.unshift(path);
51136
51274
  return iss;
51137
51275
  });
@@ -51140,17 +51278,14 @@ function unwrapMessage(message) {
51140
51278
  return typeof message === "string" ? message : message?.message;
51141
51279
  }
51142
51280
  function finalizeIssue(iss, ctx, config3) {
51143
- const full = { ...iss, path: iss.path ?? [] };
51144
- if (!iss.message) {
51145
- const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config3.customError?.(iss)) ?? unwrapMessage(config3.localeError?.(iss)) ?? "Invalid input";
51146
- full.message = message;
51281
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config3.customError?.(iss)) ?? unwrapMessage(config3.localeError?.(iss)) ?? "Invalid input";
51282
+ const { inst: _inst, continue: _continue3, input: _input, ...rest } = iss;
51283
+ rest.path ?? (rest.path = []);
51284
+ rest.message = message;
51285
+ if (ctx?.reportInput) {
51286
+ rest.input = _input;
51147
51287
  }
51148
- delete full.inst;
51149
- delete full.continue;
51150
- if (!ctx?.reportInput) {
51151
- delete full.input;
51152
- }
51153
- return full;
51288
+ return rest;
51154
51289
  }
51155
51290
  function getSizableOrigin(input) {
51156
51291
  if (input instanceof Set)
@@ -51168,6 +51303,27 @@ function getLengthableOrigin(input) {
51168
51303
  return "string";
51169
51304
  return "unknown";
51170
51305
  }
51306
+ function parsedType(data) {
51307
+ const t = typeof data;
51308
+ switch (t) {
51309
+ case "number": {
51310
+ return Number.isNaN(data) ? "nan" : "number";
51311
+ }
51312
+ case "object": {
51313
+ if (data === null) {
51314
+ return "null";
51315
+ }
51316
+ if (Array.isArray(data)) {
51317
+ return "array";
51318
+ }
51319
+ const obj = data;
51320
+ if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
51321
+ return obj.constructor.name;
51322
+ }
51323
+ }
51324
+ }
51325
+ return t;
51326
+ }
51171
51327
  function issue(...args2) {
51172
51328
  const [iss, input, inst] = args2;
51173
51329
  if (typeof iss === "string") {
@@ -51185,12 +51341,49 @@ function cleanEnum(obj) {
51185
51341
  return Number.isNaN(Number.parseInt(k, 10));
51186
51342
  }).map((el) => el[1]);
51187
51343
  }
51344
+ function base64ToUint8Array(base64) {
51345
+ const binaryString = atob(base64);
51346
+ const bytes = new Uint8Array(binaryString.length);
51347
+ for (let i = 0;i < binaryString.length; i++) {
51348
+ bytes[i] = binaryString.charCodeAt(i);
51349
+ }
51350
+ return bytes;
51351
+ }
51352
+ function uint8ArrayToBase64(bytes) {
51353
+ let binaryString = "";
51354
+ for (let i = 0;i < bytes.length; i++) {
51355
+ binaryString += String.fromCharCode(bytes[i]);
51356
+ }
51357
+ return btoa(binaryString);
51358
+ }
51359
+ function base64urlToUint8Array(base64url) {
51360
+ const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
51361
+ const padding = "=".repeat((4 - base64.length % 4) % 4);
51362
+ return base64ToUint8Array(base64 + padding);
51363
+ }
51364
+ function uint8ArrayToBase64url(bytes) {
51365
+ return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
51366
+ }
51367
+ function hexToUint8Array(hex) {
51368
+ const cleanHex = hex.replace(/^0x/, "");
51369
+ if (cleanHex.length % 2 !== 0) {
51370
+ throw new Error("Invalid hex string length");
51371
+ }
51372
+ const bytes = new Uint8Array(cleanHex.length / 2);
51373
+ for (let i = 0;i < cleanHex.length; i += 2) {
51374
+ bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
51375
+ }
51376
+ return bytes;
51377
+ }
51378
+ function uint8ArrayToHex(bytes) {
51379
+ return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
51380
+ }
51188
51381
 
51189
51382
  class Class7 {
51190
51383
  constructor(..._args) {}
51191
51384
  }
51192
51385
 
51193
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/errors.js
51386
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/errors.js
51194
51387
  var initializer = (inst, def) => {
51195
51388
  inst.name = "$ZodError";
51196
51389
  Object.defineProperty(inst, "_zod", {
@@ -51201,12 +51394,7 @@ var initializer = (inst, def) => {
51201
51394
  value: def,
51202
51395
  enumerable: false
51203
51396
  });
51204
- Object.defineProperty(inst, "message", {
51205
- get() {
51206
- return JSON.stringify(def, jsonStringifyReplacer, 2);
51207
- },
51208
- enumerable: true
51209
- });
51397
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
51210
51398
  Object.defineProperty(inst, "toString", {
51211
51399
  value: () => inst.message,
51212
51400
  enumerable: false
@@ -51227,35 +51415,35 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
51227
51415
  }
51228
51416
  return { formErrors, fieldErrors };
51229
51417
  }
51230
- function formatError(error, _mapper) {
51231
- const mapper = _mapper || function(issue2) {
51232
- return issue2.message;
51233
- };
51418
+ function formatError(error, mapper = (issue2) => issue2.message) {
51234
51419
  const fieldErrors = { _errors: [] };
51235
- const processError = (error2) => {
51420
+ const processError = (error2, path = []) => {
51236
51421
  for (const issue2 of error2.issues) {
51237
51422
  if (issue2.code === "invalid_union" && issue2.errors.length) {
51238
- issue2.errors.map((issues) => processError({ issues }));
51423
+ issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
51239
51424
  } else if (issue2.code === "invalid_key") {
51240
- processError({ issues: issue2.issues });
51425
+ processError({ issues: issue2.issues }, [...path, ...issue2.path]);
51241
51426
  } else if (issue2.code === "invalid_element") {
51242
- processError({ issues: issue2.issues });
51243
- } else if (issue2.path.length === 0) {
51244
- fieldErrors._errors.push(mapper(issue2));
51427
+ processError({ issues: issue2.issues }, [...path, ...issue2.path]);
51245
51428
  } else {
51246
- let curr = fieldErrors;
51247
- let i = 0;
51248
- while (i < issue2.path.length) {
51249
- const el = issue2.path[i];
51250
- const terminal = i === issue2.path.length - 1;
51251
- if (!terminal) {
51252
- curr[el] = curr[el] || { _errors: [] };
51253
- } else {
51254
- curr[el] = curr[el] || { _errors: [] };
51255
- curr[el]._errors.push(mapper(issue2));
51429
+ const fullpath = [...path, ...issue2.path];
51430
+ if (fullpath.length === 0) {
51431
+ fieldErrors._errors.push(mapper(issue2));
51432
+ } else {
51433
+ let curr = fieldErrors;
51434
+ let i = 0;
51435
+ while (i < fullpath.length) {
51436
+ const el = fullpath[i];
51437
+ const terminal = i === fullpath.length - 1;
51438
+ if (!terminal) {
51439
+ curr[el] = curr[el] || { _errors: [] };
51440
+ } else {
51441
+ curr[el] = curr[el] || { _errors: [] };
51442
+ curr[el]._errors.push(mapper(issue2));
51443
+ }
51444
+ curr = curr[el];
51445
+ i++;
51256
51446
  }
51257
- curr = curr[el];
51258
- i++;
51259
51447
  }
51260
51448
  }
51261
51449
  }
@@ -51264,9 +51452,9 @@ function formatError(error, _mapper) {
51264
51452
  return fieldErrors;
51265
51453
  }
51266
51454
 
51267
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/parse.js
51455
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/parse.js
51268
51456
  var _parse = (_Err) => (schema, value5, _ctx, _params) => {
51269
- const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
51457
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
51270
51458
  const result = schema._zod.run({ value: value5, issues: [] }, ctx);
51271
51459
  if (result instanceof Promise) {
51272
51460
  throw new $ZodAsyncError;
@@ -51279,7 +51467,7 @@ var _parse = (_Err) => (schema, value5, _ctx, _params) => {
51279
51467
  return result.value;
51280
51468
  };
51281
51469
  var _parseAsync = (_Err) => async (schema, value5, _ctx, params) => {
51282
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
51470
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
51283
51471
  let result = schema._zod.run({ value: value5, issues: [] }, ctx);
51284
51472
  if (result instanceof Promise)
51285
51473
  result = await result;
@@ -51303,7 +51491,7 @@ var _safeParse = (_Err) => (schema, value5, _ctx) => {
51303
51491
  };
51304
51492
  var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
51305
51493
  var _safeParseAsync = (_Err) => async (schema, value5, _ctx) => {
51306
- const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
51494
+ const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
51307
51495
  let result = schema._zod.run({ value: value5, issues: [] }, ctx);
51308
51496
  if (result instanceof Promise)
51309
51497
  result = await result;
@@ -51313,8 +51501,36 @@ var _safeParseAsync = (_Err) => async (schema, value5, _ctx) => {
51313
51501
  } : { success: true, data: result.value };
51314
51502
  };
51315
51503
  var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
51316
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/regexes.js
51317
- var cuid = /^[cC][^\s-]{8,}$/;
51504
+ var _encode = (_Err) => (schema, value5, _ctx) => {
51505
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
51506
+ return _parse(_Err)(schema, value5, ctx);
51507
+ };
51508
+ var _decode = (_Err) => (schema, value5, _ctx) => {
51509
+ return _parse(_Err)(schema, value5, _ctx);
51510
+ };
51511
+ var _encodeAsync = (_Err) => async (schema, value5, _ctx) => {
51512
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
51513
+ return _parseAsync(_Err)(schema, value5, ctx);
51514
+ };
51515
+ var _decodeAsync = (_Err) => async (schema, value5, _ctx) => {
51516
+ return _parseAsync(_Err)(schema, value5, _ctx);
51517
+ };
51518
+ var _safeEncode = (_Err) => (schema, value5, _ctx) => {
51519
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
51520
+ return _safeParse(_Err)(schema, value5, ctx);
51521
+ };
51522
+ var _safeDecode = (_Err) => (schema, value5, _ctx) => {
51523
+ return _safeParse(_Err)(schema, value5, _ctx);
51524
+ };
51525
+ var _safeEncodeAsync = (_Err) => async (schema, value5, _ctx) => {
51526
+ const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
51527
+ return _safeParseAsync(_Err)(schema, value5, ctx);
51528
+ };
51529
+ var _safeDecodeAsync = (_Err) => async (schema, value5, _ctx) => {
51530
+ return _safeParseAsync(_Err)(schema, value5, _ctx);
51531
+ };
51532
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/regexes.js
51533
+ var cuid = /^[cC][0-9a-z]{6,}$/;
51318
51534
  var cuid2 = /^[0-9a-z]+$/;
51319
51535
  var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
51320
51536
  var xid = /^[0-9a-vA-V]{20}$/;
@@ -51324,7 +51540,7 @@ var duration5 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H
51324
51540
  var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
51325
51541
  var uuid = (version) => {
51326
51542
  if (!version)
51327
- return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
51543
+ return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
51328
51544
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
51329
51545
  };
51330
51546
  var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
@@ -51333,13 +51549,13 @@ function emoji() {
51333
51549
  return new RegExp(_emoji, "u");
51334
51550
  }
51335
51551
  var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
51336
- var ipv6 = /^(([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})$/;
51552
+ var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
51337
51553
  var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
51338
51554
  var 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])$/;
51339
51555
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
51340
51556
  var base64url = /^[A-Za-z0-9_-]*$/;
51341
- var hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
51342
- var e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
51557
+ var httpProtocol = /^https?$/;
51558
+ var e164 = /^\+[1-9]\d{6,14}$/;
51343
51559
  var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
51344
51560
  var date4 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
51345
51561
  function timeSource(args2) {
@@ -51356,7 +51572,7 @@ function datetime(args2) {
51356
51572
  if (args2.local)
51357
51573
  opts.push("");
51358
51574
  if (args2.offset)
51359
- opts.push(`([+-]\\d{2}:\\d{2})`);
51575
+ opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
51360
51576
  const timeRegex = `${time2}(?:${opts.join("|")})`;
51361
51577
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
51362
51578
  }
@@ -51364,19 +51580,19 @@ var string9 = (params) => {
51364
51580
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
51365
51581
  return new RegExp(`^${regex}$`);
51366
51582
  };
51367
- var integer4 = /^\d+$/;
51368
- var number7 = /^-?\d+(?:\.\d+)?/i;
51369
- var boolean5 = /true|false/i;
51370
- var _null2 = /null/i;
51583
+ var integer4 = /^-?\d+$/;
51584
+ var number7 = /^-?\d+(?:\.\d+)?$/;
51585
+ var boolean5 = /^(?:true|false)$/i;
51586
+ var _null2 = /^null$/i;
51371
51587
  var lowercase = /^[^A-Z]*$/;
51372
51588
  var uppercase = /^[^a-z]*$/;
51373
51589
 
51374
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/checks.js
51590
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/checks.js
51375
51591
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
51376
- var _a;
51592
+ var _a2;
51377
51593
  inst._zod ?? (inst._zod = {});
51378
51594
  inst._zod.def = def;
51379
- (_a = inst._zod).onattach ?? (_a.onattach = []);
51595
+ (_a2 = inst._zod).onattach ?? (_a2.onattach = []);
51380
51596
  });
51381
51597
  var numericOriginMap = {
51382
51598
  number: "number",
@@ -51403,7 +51619,7 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
51403
51619
  payload.issues.push({
51404
51620
  origin,
51405
51621
  code: "too_big",
51406
- maximum: def.value,
51622
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
51407
51623
  input: payload.value,
51408
51624
  inclusive: def.inclusive,
51409
51625
  inst,
@@ -51431,7 +51647,7 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
51431
51647
  payload.issues.push({
51432
51648
  origin,
51433
51649
  code: "too_small",
51434
- minimum: def.value,
51650
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
51435
51651
  input: payload.value,
51436
51652
  inclusive: def.inclusive,
51437
51653
  inst,
@@ -51442,8 +51658,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
51442
51658
  var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
51443
51659
  $ZodCheck.init(inst, def);
51444
51660
  inst._zod.onattach.push((inst2) => {
51445
- var _a;
51446
- (_a = inst2._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
51661
+ var _a2;
51662
+ (_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
51447
51663
  });
51448
51664
  inst._zod.check = (payload) => {
51449
51665
  if (typeof payload.value !== typeof def.value)
@@ -51483,6 +51699,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
51483
51699
  expected: origin,
51484
51700
  format: def.format,
51485
51701
  code: "invalid_type",
51702
+ continue: false,
51486
51703
  input,
51487
51704
  inst
51488
51705
  });
@@ -51497,6 +51714,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
51497
51714
  note: "Integers must be within the safe integer range.",
51498
51715
  inst,
51499
51716
  origin,
51717
+ inclusive: true,
51500
51718
  continue: !def.abort
51501
51719
  });
51502
51720
  } else {
@@ -51507,6 +51725,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
51507
51725
  note: "Integers must be within the safe integer range.",
51508
51726
  inst,
51509
51727
  origin,
51728
+ inclusive: true,
51510
51729
  continue: !def.abort
51511
51730
  });
51512
51731
  }
@@ -51530,15 +51749,17 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
51530
51749
  input,
51531
51750
  code: "too_big",
51532
51751
  maximum,
51533
- inst
51752
+ inclusive: true,
51753
+ inst,
51754
+ continue: !def.abort
51534
51755
  });
51535
51756
  }
51536
51757
  };
51537
51758
  });
51538
51759
  var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
51539
- var _a;
51760
+ var _a2;
51540
51761
  $ZodCheck.init(inst, def);
51541
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
51762
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
51542
51763
  const val = payload.value;
51543
51764
  return !nullish(val) && val.length !== undefined;
51544
51765
  });
@@ -51565,9 +51786,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
51565
51786
  };
51566
51787
  });
51567
51788
  var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
51568
- var _a;
51789
+ var _a2;
51569
51790
  $ZodCheck.init(inst, def);
51570
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
51791
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
51571
51792
  const val = payload.value;
51572
51793
  return !nullish(val) && val.length !== undefined;
51573
51794
  });
@@ -51594,9 +51815,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
51594
51815
  };
51595
51816
  });
51596
51817
  var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
51597
- var _a;
51818
+ var _a2;
51598
51819
  $ZodCheck.init(inst, def);
51599
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
51820
+ (_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
51600
51821
  const val = payload.value;
51601
51822
  return !nullish(val) && val.length !== undefined;
51602
51823
  });
@@ -51625,7 +51846,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
51625
51846
  };
51626
51847
  });
51627
51848
  var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
51628
- var _a, _b;
51849
+ var _a2, _b;
51629
51850
  $ZodCheck.init(inst, def);
51630
51851
  inst._zod.onattach.push((inst2) => {
51631
51852
  const bag = inst2._zod.bag;
@@ -51636,7 +51857,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
51636
51857
  }
51637
51858
  });
51638
51859
  if (def.pattern)
51639
- (_a = inst._zod).check ?? (_a.check = (payload) => {
51860
+ (_a2 = inst._zod).check ?? (_a2.check = (payload) => {
51640
51861
  def.pattern.lastIndex = 0;
51641
51862
  if (def.pattern.test(payload.value))
51642
51863
  return;
@@ -51755,7 +51976,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
51755
51976
  };
51756
51977
  });
51757
51978
 
51758
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/doc.js
51979
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/doc.js
51759
51980
  class Doc {
51760
51981
  constructor(args2 = []) {
51761
51982
  this.content = [];
@@ -51793,16 +52014,16 @@ class Doc {
51793
52014
  }
51794
52015
  }
51795
52016
 
51796
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/versions.js
52017
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/versions.js
51797
52018
  var version = {
51798
52019
  major: 4,
51799
- minor: 0,
51800
- patch: 0
52020
+ minor: 4,
52021
+ patch: 3
51801
52022
  };
51802
52023
 
51803
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/schemas.js
52024
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/schemas.js
51804
52025
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
51805
- var _a;
52026
+ var _a2;
51806
52027
  inst ?? (inst = {});
51807
52028
  inst._zod.def = def;
51808
52029
  inst._zod.bag = inst._zod.bag || {};
@@ -51817,7 +52038,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
51817
52038
  }
51818
52039
  }
51819
52040
  if (checks.length === 0) {
51820
- (_a = inst._zod).deferred ?? (_a.deferred = []);
52041
+ (_a2 = inst._zod).deferred ?? (_a2.deferred = []);
51821
52042
  inst._zod.deferred?.push(() => {
51822
52043
  inst._zod.run = inst._zod.parse;
51823
52044
  });
@@ -51827,6 +52048,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
51827
52048
  let asyncResult;
51828
52049
  for (const ch of checks2) {
51829
52050
  if (ch._zod.def.when) {
52051
+ if (explicitlyAborted(payload))
52052
+ continue;
51830
52053
  const shouldRun = ch._zod.def.when(payload);
51831
52054
  if (!shouldRun)
51832
52055
  continue;
@@ -51862,7 +52085,32 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
51862
52085
  }
51863
52086
  return payload;
51864
52087
  };
52088
+ const handleCanaryResult = (canary, payload, ctx) => {
52089
+ if (aborted(canary)) {
52090
+ canary.aborted = true;
52091
+ return canary;
52092
+ }
52093
+ const checkResult = runChecks(payload, checks, ctx);
52094
+ if (checkResult instanceof Promise) {
52095
+ if (ctx.async === false)
52096
+ throw new $ZodAsyncError;
52097
+ return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
52098
+ }
52099
+ return inst._zod.parse(checkResult, ctx);
52100
+ };
51865
52101
  inst._zod.run = (payload, ctx) => {
52102
+ if (ctx.skipChecks) {
52103
+ return inst._zod.parse(payload, ctx);
52104
+ }
52105
+ if (ctx.direction === "backward") {
52106
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
52107
+ if (canary instanceof Promise) {
52108
+ return canary.then((canary2) => {
52109
+ return handleCanaryResult(canary2, payload, ctx);
52110
+ });
52111
+ }
52112
+ return handleCanaryResult(canary, payload, ctx);
52113
+ }
51866
52114
  const result = inst._zod.parse(payload, ctx);
51867
52115
  if (result instanceof Promise) {
51868
52116
  if (ctx.async === false)
@@ -51872,7 +52120,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
51872
52120
  return runChecks(result, checks, ctx);
51873
52121
  };
51874
52122
  }
51875
- inst["~standard"] = {
52123
+ defineLazy(inst, "~standard", () => ({
51876
52124
  validate: (value5) => {
51877
52125
  try {
51878
52126
  const r = safeParse(inst, value5);
@@ -51883,7 +52131,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
51883
52131
  },
51884
52132
  vendor: "zod",
51885
52133
  version: 1
51886
- };
52134
+ }));
51887
52135
  });
51888
52136
  var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
51889
52137
  $ZodType.init(inst, def);
@@ -51940,9 +52188,21 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
51940
52188
  $ZodStringFormat.init(inst, def);
51941
52189
  inst._zod.check = (payload) => {
51942
52190
  try {
51943
- const orig = payload.value;
51944
- const url3 = new URL(orig);
51945
- const href = url3.href;
52191
+ const trimmed2 = payload.value.trim();
52192
+ if (!def.normalize && def.protocol?.source === httpProtocol.source) {
52193
+ if (!/^https?:\/\//i.test(trimmed2)) {
52194
+ payload.issues.push({
52195
+ code: "invalid_format",
52196
+ format: "url",
52197
+ note: "Invalid URL format",
52198
+ input: payload.value,
52199
+ inst,
52200
+ continue: !def.abort
52201
+ });
52202
+ return;
52203
+ }
52204
+ }
52205
+ const url3 = new URL(trimmed2);
51946
52206
  if (def.hostname) {
51947
52207
  def.hostname.lastIndex = 0;
51948
52208
  if (!def.hostname.test(url3.hostname)) {
@@ -51950,7 +52210,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
51950
52210
  code: "invalid_format",
51951
52211
  format: "url",
51952
52212
  note: "Invalid hostname",
51953
- pattern: hostname.source,
52213
+ pattern: def.hostname.source,
51954
52214
  input: payload.value,
51955
52215
  inst,
51956
52216
  continue: !def.abort
@@ -51971,10 +52231,10 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
51971
52231
  });
51972
52232
  }
51973
52233
  }
51974
- if (!orig.endsWith("/") && href.endsWith("/")) {
51975
- payload.value = href.slice(0, -1);
52234
+ if (def.normalize) {
52235
+ payload.value = url3.href;
51976
52236
  } else {
51977
- payload.value = href;
52237
+ payload.value = trimmed2;
51978
52238
  }
51979
52239
  return;
51980
52240
  } catch (_) {
@@ -52035,18 +52295,12 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
52035
52295
  var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
52036
52296
  def.pattern ?? (def.pattern = ipv4);
52037
52297
  $ZodStringFormat.init(inst, def);
52038
- inst._zod.onattach.push((inst2) => {
52039
- const bag = inst2._zod.bag;
52040
- bag.format = `ipv4`;
52041
- });
52298
+ inst._zod.bag.format = `ipv4`;
52042
52299
  });
52043
52300
  var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
52044
52301
  def.pattern ?? (def.pattern = ipv6);
52045
52302
  $ZodStringFormat.init(inst, def);
52046
- inst._zod.onattach.push((inst2) => {
52047
- const bag = inst2._zod.bag;
52048
- bag.format = `ipv6`;
52049
- });
52303
+ inst._zod.bag.format = `ipv6`;
52050
52304
  inst._zod.check = (payload) => {
52051
52305
  try {
52052
52306
  new URL(`http://[${payload.value}]`);
@@ -52069,8 +52323,11 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
52069
52323
  def.pattern ?? (def.pattern = cidrv6);
52070
52324
  $ZodStringFormat.init(inst, def);
52071
52325
  inst._zod.check = (payload) => {
52072
- const [address, prefix] = payload.value.split("/");
52326
+ const parts2 = payload.value.split("/");
52073
52327
  try {
52328
+ if (parts2.length !== 2)
52329
+ throw new Error;
52330
+ const [address, prefix] = parts2;
52074
52331
  if (!prefix)
52075
52332
  throw new Error;
52076
52333
  const prefixNum = Number(prefix);
@@ -52093,6 +52350,8 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
52093
52350
  function isValidBase64(data) {
52094
52351
  if (data === "")
52095
52352
  return true;
52353
+ if (/\s/.test(data))
52354
+ return false;
52096
52355
  if (data.length % 4 !== 0)
52097
52356
  return false;
52098
52357
  try {
@@ -52105,9 +52364,7 @@ function isValidBase64(data) {
52105
52364
  var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
52106
52365
  def.pattern ?? (def.pattern = base64);
52107
52366
  $ZodStringFormat.init(inst, def);
52108
- inst._zod.onattach.push((inst2) => {
52109
- inst2._zod.bag.contentEncoding = "base64";
52110
- });
52367
+ inst._zod.bag.contentEncoding = "base64";
52111
52368
  inst._zod.check = (payload) => {
52112
52369
  if (isValidBase64(payload.value))
52113
52370
  return;
@@ -52130,9 +52387,7 @@ function isValidBase64URL(data) {
52130
52387
  var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
52131
52388
  def.pattern ?? (def.pattern = base64url);
52132
52389
  $ZodStringFormat.init(inst, def);
52133
- inst._zod.onattach.push((inst2) => {
52134
- inst2._zod.bag.contentEncoding = "base64url";
52135
- });
52390
+ inst._zod.bag.contentEncoding = "base64url";
52136
52391
  inst._zod.check = (payload) => {
52137
52392
  if (isValidBase64URL(payload.value))
52138
52393
  return;
@@ -52206,7 +52461,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
52206
52461
  return payload;
52207
52462
  };
52208
52463
  });
52209
- var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
52464
+ var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
52210
52465
  $ZodCheckNumberFormat.init(inst, def);
52211
52466
  $ZodNumber.init(inst, def);
52212
52467
  });
@@ -52302,48 +52557,102 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
52302
52557
  return payload;
52303
52558
  };
52304
52559
  });
52305
- function handleObjectResult(result, final, key) {
52560
+ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
52561
+ const isPresent = key in input;
52306
52562
  if (result.issues.length) {
52563
+ if (isOptionalIn && isOptionalOut && !isPresent) {
52564
+ return;
52565
+ }
52307
52566
  final.issues.push(...prefixIssues(key, result.issues));
52308
52567
  }
52309
- final.value[key] = result.value;
52310
- }
52311
- function handleOptionalObjectResult(result, final, key, input) {
52312
- if (result.issues.length) {
52313
- if (input[key] === undefined) {
52314
- if (key in input) {
52315
- final.value[key] = undefined;
52316
- } else {
52317
- final.value[key] = result.value;
52318
- }
52319
- } else {
52320
- final.issues.push(...prefixIssues(key, result.issues));
52568
+ if (!isPresent && !isOptionalIn) {
52569
+ if (!result.issues.length) {
52570
+ final.issues.push({
52571
+ code: "invalid_type",
52572
+ expected: "nonoptional",
52573
+ input: undefined,
52574
+ path: [key]
52575
+ });
52321
52576
  }
52322
- } else if (result.value === undefined) {
52323
- if (key in input)
52577
+ return;
52578
+ }
52579
+ if (result.value === undefined) {
52580
+ if (isPresent) {
52324
52581
  final.value[key] = undefined;
52582
+ }
52325
52583
  } else {
52326
52584
  final.value[key] = result.value;
52327
52585
  }
52328
52586
  }
52587
+ function normalizeDef(def) {
52588
+ const keys6 = Object.keys(def.shape);
52589
+ for (const k of keys6) {
52590
+ if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
52591
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
52592
+ }
52593
+ }
52594
+ const okeys = optionalKeys(def.shape);
52595
+ return {
52596
+ ...def,
52597
+ keys: keys6,
52598
+ keySet: new Set(keys6),
52599
+ numKeys: keys6.length,
52600
+ optionalKeys: new Set(okeys)
52601
+ };
52602
+ }
52603
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
52604
+ const unrecognized = [];
52605
+ const keySet3 = def.keySet;
52606
+ const _catchall = def.catchall._zod;
52607
+ const t = _catchall.def.type;
52608
+ const isOptionalIn = _catchall.optin === "optional";
52609
+ const isOptionalOut = _catchall.optout === "optional";
52610
+ for (const key in input) {
52611
+ if (key === "__proto__")
52612
+ continue;
52613
+ if (keySet3.has(key))
52614
+ continue;
52615
+ if (t === "never") {
52616
+ unrecognized.push(key);
52617
+ continue;
52618
+ }
52619
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
52620
+ if (r instanceof Promise) {
52621
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
52622
+ } else {
52623
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
52624
+ }
52625
+ }
52626
+ if (unrecognized.length) {
52627
+ payload.issues.push({
52628
+ code: "unrecognized_keys",
52629
+ keys: unrecognized,
52630
+ input,
52631
+ inst
52632
+ });
52633
+ }
52634
+ if (!proms.length)
52635
+ return payload;
52636
+ return Promise.all(proms).then(() => {
52637
+ return payload;
52638
+ });
52639
+ }
52329
52640
  var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
52330
52641
  $ZodType.init(inst, def);
52331
- const _normalized = cached4(() => {
52332
- const keys6 = Object.keys(def.shape);
52333
- for (const k of keys6) {
52334
- if (!(def.shape[k] instanceof $ZodType)) {
52335
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
52642
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
52643
+ if (!desc?.get) {
52644
+ const sh = def.shape;
52645
+ Object.defineProperty(def, "shape", {
52646
+ get: () => {
52647
+ const newSh = { ...sh };
52648
+ Object.defineProperty(def, "shape", {
52649
+ value: newSh
52650
+ });
52651
+ return newSh;
52336
52652
  }
52337
- }
52338
- const okeys = optionalKeys(def.shape);
52339
- return {
52340
- shape: def.shape,
52341
- keys: keys6,
52342
- keySet: new Set(keys6),
52343
- numKeys: keys6.length,
52344
- optionalKeys: new Set(okeys)
52345
- };
52346
- });
52653
+ });
52654
+ }
52655
+ const _normalized = cached4(() => normalizeDef(def));
52347
52656
  defineLazy(inst._zod, "propValues", () => {
52348
52657
  const shape = def.shape;
52349
52658
  const propValues = {};
@@ -52357,6 +52666,45 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
52357
52666
  }
52358
52667
  return propValues;
52359
52668
  });
52669
+ const isObject3 = isObject2;
52670
+ const catchall = def.catchall;
52671
+ let value5;
52672
+ inst._zod.parse = (payload, ctx) => {
52673
+ value5 ?? (value5 = _normalized.value);
52674
+ const input = payload.value;
52675
+ if (!isObject3(input)) {
52676
+ payload.issues.push({
52677
+ expected: "object",
52678
+ code: "invalid_type",
52679
+ input,
52680
+ inst
52681
+ });
52682
+ return payload;
52683
+ }
52684
+ payload.value = {};
52685
+ const proms = [];
52686
+ const shape = value5.shape;
52687
+ for (const key of value5.keys) {
52688
+ const el = shape[key];
52689
+ const isOptionalIn = el._zod.optin === "optional";
52690
+ const isOptionalOut = el._zod.optout === "optional";
52691
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
52692
+ if (r instanceof Promise) {
52693
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
52694
+ } else {
52695
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
52696
+ }
52697
+ }
52698
+ if (!catchall) {
52699
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
52700
+ }
52701
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
52702
+ };
52703
+ });
52704
+ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
52705
+ $ZodObject.init(inst, def);
52706
+ const superParse = inst._zod.parse;
52707
+ const _normalized = cached4(() => normalizeDef(def));
52360
52708
  const generateFastpass = (shape) => {
52361
52709
  const doc = new Doc(["shape", "payload", "ctx"]);
52362
52710
  const normalized = _normalized.value;
@@ -52370,41 +52718,79 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
52370
52718
  for (const key of normalized.keys) {
52371
52719
  ids3[key] = `key_${counter6++}`;
52372
52720
  }
52373
- doc.write(`const newResult = {}`);
52721
+ doc.write(`const newResult = {};`);
52374
52722
  for (const key of normalized.keys) {
52375
- if (normalized.optionalKeys.has(key)) {
52376
- const id3 = ids3[key];
52377
- doc.write(`const ${id3} = ${parseStr(key)};`);
52378
- const k = esc(key);
52723
+ const id3 = ids3[key];
52724
+ const k = esc(key);
52725
+ const schema = shape[key];
52726
+ const isOptionalIn = schema?._zod?.optin === "optional";
52727
+ const isOptionalOut = schema?._zod?.optout === "optional";
52728
+ doc.write(`const ${id3} = ${parseStr(key)};`);
52729
+ if (isOptionalIn && isOptionalOut) {
52379
52730
  doc.write(`
52380
52731
  if (${id3}.issues.length) {
52381
- if (input[${k}] === undefined) {
52382
- if (${k} in input) {
52383
- newResult[${k}] = undefined;
52384
- }
52385
- } else {
52386
- payload.issues = payload.issues.concat(
52387
- ${id3}.issues.map((iss) => ({
52388
- ...iss,
52389
- path: iss.path ? [${k}, ...iss.path] : [${k}],
52390
- }))
52391
- );
52732
+ if (${k} in input) {
52733
+ payload.issues = payload.issues.concat(${id3}.issues.map(iss => ({
52734
+ ...iss,
52735
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
52736
+ })));
52737
+ }
52738
+ }
52739
+
52740
+ if (${id3}.value === undefined) {
52741
+ if (${k} in input) {
52742
+ newResult[${k}] = undefined;
52392
52743
  }
52393
- } else if (${id3}.value === undefined) {
52394
- if (${k} in input) newResult[${k}] = undefined;
52395
52744
  } else {
52396
52745
  newResult[${k}] = ${id3}.value;
52397
52746
  }
52398
- `);
52747
+
52748
+ `);
52749
+ } else if (!isOptionalIn) {
52750
+ doc.write(`
52751
+ const ${id3}_present = ${k} in input;
52752
+ if (${id3}.issues.length) {
52753
+ payload.issues = payload.issues.concat(${id3}.issues.map(iss => ({
52754
+ ...iss,
52755
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
52756
+ })));
52757
+ }
52758
+ if (!${id3}_present && !${id3}.issues.length) {
52759
+ payload.issues.push({
52760
+ code: "invalid_type",
52761
+ expected: "nonoptional",
52762
+ input: undefined,
52763
+ path: [${k}]
52764
+ });
52765
+ }
52766
+
52767
+ if (${id3}_present) {
52768
+ if (${id3}.value === undefined) {
52769
+ newResult[${k}] = undefined;
52770
+ } else {
52771
+ newResult[${k}] = ${id3}.value;
52772
+ }
52773
+ }
52774
+
52775
+ `);
52399
52776
  } else {
52400
- const id3 = ids3[key];
52401
- doc.write(`const ${id3} = ${parseStr(key)};`);
52402
52777
  doc.write(`
52403
- if (${id3}.issues.length) payload.issues = payload.issues.concat(${id3}.issues.map(iss => ({
52778
+ if (${id3}.issues.length) {
52779
+ payload.issues = payload.issues.concat(${id3}.issues.map(iss => ({
52404
52780
  ...iss,
52405
- path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
52406
- })));`);
52407
- doc.write(`newResult[${esc(key)}] = ${id3}.value`);
52781
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
52782
+ })));
52783
+ }
52784
+
52785
+ if (${id3}.value === undefined) {
52786
+ if (${k} in input) {
52787
+ newResult[${k}] = undefined;
52788
+ }
52789
+ } else {
52790
+ newResult[${k}] = ${id3}.value;
52791
+ }
52792
+
52793
+ `);
52408
52794
  }
52409
52795
  }
52410
52796
  doc.write(`payload.value = newResult;`);
@@ -52431,61 +52817,15 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
52431
52817
  });
52432
52818
  return payload;
52433
52819
  }
52434
- const proms = [];
52435
52820
  if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
52436
52821
  if (!fastpass)
52437
52822
  fastpass = generateFastpass(def.shape);
52438
52823
  payload = fastpass(payload, ctx);
52439
- } else {
52440
- payload.value = {};
52441
- const shape = value5.shape;
52442
- for (const key of value5.keys) {
52443
- const el = shape[key];
52444
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
52445
- const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
52446
- if (r instanceof Promise) {
52447
- proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
52448
- } else if (isOptional) {
52449
- handleOptionalObjectResult(r, payload, key, input);
52450
- } else {
52451
- handleObjectResult(r, payload, key);
52452
- }
52453
- }
52454
- }
52455
- if (!catchall) {
52456
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
52457
- }
52458
- const unrecognized = [];
52459
- const keySet3 = value5.keySet;
52460
- const _catchall = catchall._zod;
52461
- const t = _catchall.def.type;
52462
- for (const key of Object.keys(input)) {
52463
- if (keySet3.has(key))
52464
- continue;
52465
- if (t === "never") {
52466
- unrecognized.push(key);
52467
- continue;
52468
- }
52469
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
52470
- if (r instanceof Promise) {
52471
- proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
52472
- } else {
52473
- handleObjectResult(r, payload, key);
52474
- }
52475
- }
52476
- if (unrecognized.length) {
52477
- payload.issues.push({
52478
- code: "unrecognized_keys",
52479
- keys: unrecognized,
52480
- input,
52481
- inst
52482
- });
52824
+ if (!catchall)
52825
+ return payload;
52826
+ return handleCatchall([], input, payload, ctx, value5, inst);
52483
52827
  }
52484
- if (!proms.length)
52485
- return payload;
52486
- return Promise.all(proms).then(() => {
52487
- return payload;
52488
- });
52828
+ return superParse(payload, ctx);
52489
52829
  };
52490
52830
  });
52491
52831
  function handleUnionResults(results, final, inst, ctx) {
@@ -52495,6 +52835,11 @@ function handleUnionResults(results, final, inst, ctx) {
52495
52835
  return final;
52496
52836
  }
52497
52837
  }
52838
+ const nonaborted = results.filter((r) => !aborted(r));
52839
+ if (nonaborted.length === 1) {
52840
+ final.value = nonaborted[0].value;
52841
+ return nonaborted[0];
52842
+ }
52498
52843
  final.issues.push({
52499
52844
  code: "invalid_union",
52500
52845
  input: final.value,
@@ -52520,7 +52865,11 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
52520
52865
  }
52521
52866
  return;
52522
52867
  });
52868
+ const first2 = def.options.length === 1 ? def.options[0]._zod.run : null;
52523
52869
  inst._zod.parse = (payload, ctx) => {
52870
+ if (first2) {
52871
+ return first2(payload, ctx);
52872
+ }
52524
52873
  let async2 = false;
52525
52874
  const results = [];
52526
52875
  for (const option7 of def.options) {
@@ -52545,6 +52894,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
52545
52894
  };
52546
52895
  });
52547
52896
  var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
52897
+ def.inclusive = false;
52548
52898
  $ZodUnion.init(inst, def);
52549
52899
  const _super = inst._zod.parse;
52550
52900
  defineLazy(inst._zod, "propValues", () => {
@@ -52567,7 +52917,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
52567
52917
  const opts = def.options;
52568
52918
  const map32 = new Map;
52569
52919
  for (const o of opts) {
52570
- const values7 = o._zod.propValues[def.discriminator];
52920
+ const values7 = o._zod.propValues?.[def.discriminator];
52571
52921
  if (!values7 || values7.size === 0)
52572
52922
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
52573
52923
  for (const v of values7) {
@@ -52594,13 +52944,15 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
52594
52944
  if (opt) {
52595
52945
  return opt._zod.run(payload, ctx);
52596
52946
  }
52597
- if (def.unionFallback) {
52947
+ if (def.unionFallback || ctx.direction === "backward") {
52598
52948
  return _super(payload, ctx);
52599
52949
  }
52600
52950
  payload.issues.push({
52601
52951
  code: "invalid_union",
52602
52952
  errors: [],
52603
52953
  note: "No matching discriminator",
52954
+ discriminator: def.discriminator,
52955
+ options: Array.from(disc.value.keys()),
52604
52956
  input,
52605
52957
  path: [def.discriminator],
52606
52958
  inst
@@ -52668,11 +53020,34 @@ function mergeValues(a, b) {
52668
53020
  return { valid: false, mergeErrorPath: [] };
52669
53021
  }
52670
53022
  function handleIntersectionResults(result, left3, right3) {
52671
- if (left3.issues.length) {
52672
- result.issues.push(...left3.issues);
53023
+ const unrecKeys = new Map;
53024
+ let unrecIssue;
53025
+ for (const iss of left3.issues) {
53026
+ if (iss.code === "unrecognized_keys") {
53027
+ unrecIssue ?? (unrecIssue = iss);
53028
+ for (const k of iss.keys) {
53029
+ if (!unrecKeys.has(k))
53030
+ unrecKeys.set(k, {});
53031
+ unrecKeys.get(k).l = true;
53032
+ }
53033
+ } else {
53034
+ result.issues.push(iss);
53035
+ }
53036
+ }
53037
+ for (const iss of right3.issues) {
53038
+ if (iss.code === "unrecognized_keys") {
53039
+ for (const k of iss.keys) {
53040
+ if (!unrecKeys.has(k))
53041
+ unrecKeys.set(k, {});
53042
+ unrecKeys.get(k).r = true;
53043
+ }
53044
+ } else {
53045
+ result.issues.push(iss);
53046
+ }
52673
53047
  }
52674
- if (right3.issues.length) {
52675
- result.issues.push(...right3.issues);
53048
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
53049
+ if (bothKeys.length && unrecIssue) {
53050
+ result.issues.push({ ...unrecIssue, keys: bothKeys });
52676
53051
  }
52677
53052
  if (aborted(result))
52678
53053
  return result;
@@ -52697,30 +53072,48 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
52697
53072
  return payload;
52698
53073
  }
52699
53074
  const proms = [];
52700
- if (def.keyType._zod.values) {
52701
- const values7 = def.keyType._zod.values;
53075
+ const values7 = def.keyType._zod.values;
53076
+ if (values7) {
52702
53077
  payload.value = {};
53078
+ const recordKeys = new Set;
52703
53079
  for (const key of values7) {
52704
53080
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
53081
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
53082
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
53083
+ if (keyResult instanceof Promise) {
53084
+ throw new Error("Async schemas not supported in object keys currently");
53085
+ }
53086
+ if (keyResult.issues.length) {
53087
+ payload.issues.push({
53088
+ code: "invalid_key",
53089
+ origin: "record",
53090
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config2())),
53091
+ input: key,
53092
+ path: [key],
53093
+ inst
53094
+ });
53095
+ continue;
53096
+ }
53097
+ const outKey = keyResult.value;
52705
53098
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
52706
53099
  if (result instanceof Promise) {
52707
53100
  proms.push(result.then((result2) => {
52708
53101
  if (result2.issues.length) {
52709
53102
  payload.issues.push(...prefixIssues(key, result2.issues));
52710
53103
  }
52711
- payload.value[key] = result2.value;
53104
+ payload.value[outKey] = result2.value;
52712
53105
  }));
52713
53106
  } else {
52714
53107
  if (result.issues.length) {
52715
53108
  payload.issues.push(...prefixIssues(key, result.issues));
52716
53109
  }
52717
- payload.value[key] = result.value;
53110
+ payload.value[outKey] = result.value;
52718
53111
  }
52719
53112
  }
52720
53113
  }
52721
53114
  let unrecognized;
52722
53115
  for (const key in input) {
52723
- if (!values7.has(key)) {
53116
+ if (!recordKeys.has(key)) {
52724
53117
  unrecognized = unrecognized ?? [];
52725
53118
  unrecognized.push(key);
52726
53119
  }
@@ -52738,20 +53131,35 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
52738
53131
  for (const key of Reflect.ownKeys(input)) {
52739
53132
  if (key === "__proto__")
52740
53133
  continue;
52741
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
53134
+ if (!Object.prototype.propertyIsEnumerable.call(input, key))
53135
+ continue;
53136
+ let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
52742
53137
  if (keyResult instanceof Promise) {
52743
53138
  throw new Error("Async schemas not supported in object keys currently");
52744
53139
  }
53140
+ const checkNumericKey = typeof key === "string" && number7.test(key) && keyResult.issues.length;
53141
+ if (checkNumericKey) {
53142
+ const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
53143
+ if (retryResult instanceof Promise) {
53144
+ throw new Error("Async schemas not supported in object keys currently");
53145
+ }
53146
+ if (retryResult.issues.length === 0) {
53147
+ keyResult = retryResult;
53148
+ }
53149
+ }
52745
53150
  if (keyResult.issues.length) {
52746
- payload.issues.push({
52747
- origin: "record",
52748
- code: "invalid_key",
52749
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config2())),
52750
- input: key,
52751
- path: [key],
52752
- inst
52753
- });
52754
- payload.value[keyResult.value] = keyResult.value;
53151
+ if (def.mode === "loose") {
53152
+ payload.value[key] = input[key];
53153
+ } else {
53154
+ payload.issues.push({
53155
+ code: "invalid_key",
53156
+ origin: "record",
53157
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config2())),
53158
+ input: key,
53159
+ path: [key],
53160
+ inst
53161
+ });
53162
+ }
52755
53163
  continue;
52756
53164
  }
52757
53165
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
@@ -52779,11 +53187,12 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
52779
53187
  var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
52780
53188
  $ZodType.init(inst, def);
52781
53189
  const values7 = getEnumValues(def.entries);
52782
- inst._zod.values = new Set(values7);
53190
+ const valuesSet = new Set(values7);
53191
+ inst._zod.values = valuesSet;
52783
53192
  inst._zod.pattern = new RegExp(`^(${values7.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
52784
53193
  inst._zod.parse = (payload, _ctx) => {
52785
53194
  const input = payload.value;
52786
- if (inst._zod.values.has(input)) {
53195
+ if (valuesSet.has(input)) {
52787
53196
  return payload;
52788
53197
  }
52789
53198
  payload.issues.push({
@@ -52797,11 +53206,15 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
52797
53206
  });
52798
53207
  var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
52799
53208
  $ZodType.init(inst, def);
52800
- inst._zod.values = new Set(def.values);
52801
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? o.toString() : String(o)).join("|")})$`);
53209
+ if (def.values.length === 0) {
53210
+ throw new Error("Cannot create literal schema with no valid values");
53211
+ }
53212
+ const values7 = new Set(def.values);
53213
+ inst._zod.values = values7;
53214
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
52802
53215
  inst._zod.parse = (payload, _ctx) => {
52803
53216
  const input = payload.value;
52804
- if (inst._zod.values.has(input)) {
53217
+ if (values7.has(input)) {
52805
53218
  return payload;
52806
53219
  }
52807
53220
  payload.issues.push({
@@ -52815,12 +53228,17 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
52815
53228
  });
52816
53229
  var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
52817
53230
  $ZodType.init(inst, def);
52818
- inst._zod.parse = (payload, _ctx) => {
53231
+ inst._zod.optin = "optional";
53232
+ inst._zod.parse = (payload, ctx) => {
53233
+ if (ctx.direction === "backward") {
53234
+ throw new $ZodEncodeError(inst.constructor.name);
53235
+ }
52819
53236
  const _out = def.transform(payload.value, payload);
52820
- if (_ctx.async) {
53237
+ if (ctx.async) {
52821
53238
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
52822
53239
  return output.then((output2) => {
52823
53240
  payload.value = output2;
53241
+ payload.fallback = true;
52824
53242
  return payload;
52825
53243
  });
52826
53244
  }
@@ -52828,9 +53246,16 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
52828
53246
  throw new $ZodAsyncError;
52829
53247
  }
52830
53248
  payload.value = _out;
53249
+ payload.fallback = true;
52831
53250
  return payload;
52832
53251
  };
52833
53252
  });
53253
+ function handleOptionalResult(result, input) {
53254
+ if (input === undefined && (result.issues.length || result.fallback)) {
53255
+ return { issues: [], value: undefined };
53256
+ }
53257
+ return result;
53258
+ }
52834
53259
  var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
52835
53260
  $ZodType.init(inst, def);
52836
53261
  inst._zod.optin = "optional";
@@ -52844,7 +53269,11 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
52844
53269
  });
52845
53270
  inst._zod.parse = (payload, ctx) => {
52846
53271
  if (def.innerType._zod.optin === "optional") {
52847
- return def.innerType._zod.run(payload, ctx);
53272
+ const input = payload.value;
53273
+ const result = def.innerType._zod.run(payload, ctx);
53274
+ if (result instanceof Promise)
53275
+ return result.then((r) => handleOptionalResult(r, input));
53276
+ return handleOptionalResult(result, input);
52848
53277
  }
52849
53278
  if (payload.value === undefined) {
52850
53279
  return payload;
@@ -52852,6 +53281,14 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
52852
53281
  return def.innerType._zod.run(payload, ctx);
52853
53282
  };
52854
53283
  });
53284
+ var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
53285
+ $ZodOptional.init(inst, def);
53286
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
53287
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
53288
+ inst._zod.parse = (payload, ctx) => {
53289
+ return def.innerType._zod.run(payload, ctx);
53290
+ };
53291
+ });
52855
53292
  var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
52856
53293
  $ZodType.init(inst, def);
52857
53294
  defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
@@ -52874,6 +53311,9 @@ var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
52874
53311
  inst._zod.optin = "optional";
52875
53312
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
52876
53313
  inst._zod.parse = (payload, ctx) => {
53314
+ if (ctx.direction === "backward") {
53315
+ return def.innerType._zod.run(payload, ctx);
53316
+ }
52877
53317
  if (payload.value === undefined) {
52878
53318
  payload.value = def.defaultValue;
52879
53319
  return payload;
@@ -52896,6 +53336,9 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
52896
53336
  inst._zod.optin = "optional";
52897
53337
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
52898
53338
  inst._zod.parse = (payload, ctx) => {
53339
+ if (ctx.direction === "backward") {
53340
+ return def.innerType._zod.run(payload, ctx);
53341
+ }
52899
53342
  if (payload.value === undefined) {
52900
53343
  payload.value = def.defaultValue;
52901
53344
  }
@@ -52933,6 +53376,9 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
52933
53376
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
52934
53377
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
52935
53378
  inst._zod.parse = (payload, ctx) => {
53379
+ if (ctx.direction === "backward") {
53380
+ return def.innerType._zod.run(payload, ctx);
53381
+ }
52936
53382
  const result = def.innerType._zod.run(payload, ctx);
52937
53383
  if (result instanceof Promise) {
52938
53384
  return result.then((result2) => {
@@ -52946,6 +53392,7 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
52946
53392
  input: payload.value
52947
53393
  });
52948
53394
  payload.issues = [];
53395
+ payload.fallback = true;
52949
53396
  }
52950
53397
  return payload;
52951
53398
  });
@@ -52960,6 +53407,7 @@ var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
52960
53407
  input: payload.value
52961
53408
  });
52962
53409
  payload.issues = [];
53410
+ payload.fallback = true;
52963
53411
  }
52964
53412
  return payload;
52965
53413
  };
@@ -52969,27 +53417,42 @@ var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
52969
53417
  defineLazy(inst._zod, "values", () => def.in._zod.values);
52970
53418
  defineLazy(inst._zod, "optin", () => def.in._zod.optin);
52971
53419
  defineLazy(inst._zod, "optout", () => def.out._zod.optout);
53420
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
52972
53421
  inst._zod.parse = (payload, ctx) => {
53422
+ if (ctx.direction === "backward") {
53423
+ const right3 = def.out._zod.run(payload, ctx);
53424
+ if (right3 instanceof Promise) {
53425
+ return right3.then((right4) => handlePipeResult(right4, def.in, ctx));
53426
+ }
53427
+ return handlePipeResult(right3, def.in, ctx);
53428
+ }
52973
53429
  const left3 = def.in._zod.run(payload, ctx);
52974
53430
  if (left3 instanceof Promise) {
52975
- return left3.then((left4) => handlePipeResult(left4, def, ctx));
53431
+ return left3.then((left4) => handlePipeResult(left4, def.out, ctx));
52976
53432
  }
52977
- return handlePipeResult(left3, def, ctx);
53433
+ return handlePipeResult(left3, def.out, ctx);
52978
53434
  };
52979
53435
  });
52980
- function handlePipeResult(left3, def, ctx) {
52981
- if (aborted(left3)) {
53436
+ function handlePipeResult(left3, next4, ctx) {
53437
+ if (left3.issues.length) {
53438
+ left3.aborted = true;
52982
53439
  return left3;
52983
53440
  }
52984
- return def.out._zod.run({ value: left3.value, issues: left3.issues }, ctx);
53441
+ return next4._zod.run({ value: left3.value, issues: left3.issues, fallback: left3.fallback }, ctx);
52985
53442
  }
53443
+ var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
53444
+ $ZodPipe.init(inst, def);
53445
+ });
52986
53446
  var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
52987
53447
  $ZodType.init(inst, def);
52988
53448
  defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
52989
53449
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
52990
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
52991
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
53450
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
53451
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
52992
53452
  inst._zod.parse = (payload, ctx) => {
53453
+ if (ctx.direction === "backward") {
53454
+ return def.innerType._zod.run(payload, ctx);
53455
+ }
52993
53456
  const result = def.innerType._zod.run(payload, ctx);
52994
53457
  if (result instanceof Promise) {
52995
53458
  return result.then(handleReadonlyResult);
@@ -53031,38 +53494,19 @@ function handleRefineResult(result, payload, input, inst) {
53031
53494
  payload.issues.push(issue(_iss));
53032
53495
  }
53033
53496
  }
53034
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/locales/en.js
53035
- var parsedType = (data) => {
53036
- const t = typeof data;
53037
- switch (t) {
53038
- case "number": {
53039
- return Number.isNaN(data) ? "NaN" : "number";
53040
- }
53041
- case "object": {
53042
- if (Array.isArray(data)) {
53043
- return "array";
53044
- }
53045
- if (data === null) {
53046
- return "null";
53047
- }
53048
- if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
53049
- return data.constructor.name;
53050
- }
53051
- }
53052
- }
53053
- return t;
53054
- };
53497
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/en.js
53055
53498
  var error = () => {
53056
53499
  const Sizable = {
53057
53500
  string: { unit: "characters", verb: "to have" },
53058
53501
  file: { unit: "bytes", verb: "to have" },
53059
53502
  array: { unit: "items", verb: "to have" },
53060
- set: { unit: "items", verb: "to have" }
53503
+ set: { unit: "items", verb: "to have" },
53504
+ map: { unit: "entries", verb: "to have" }
53061
53505
  };
53062
53506
  function getSizing(origin) {
53063
53507
  return Sizable[origin] ?? null;
53064
53508
  }
53065
- const Nouns = {
53509
+ const FormatDictionary = {
53066
53510
  regex: "input",
53067
53511
  email: "email address",
53068
53512
  url: "URL",
@@ -53083,6 +53527,7 @@ var error = () => {
53083
53527
  duration: "ISO duration",
53084
53528
  ipv4: "IPv4 address",
53085
53529
  ipv6: "IPv6 address",
53530
+ mac: "MAC address",
53086
53531
  cidrv4: "IPv4 range",
53087
53532
  cidrv6: "IPv6 range",
53088
53533
  base64: "base64-encoded string",
@@ -53092,10 +53537,17 @@ var error = () => {
53092
53537
  jwt: "JWT",
53093
53538
  template_literal: "input"
53094
53539
  };
53540
+ const TypeDictionary = {
53541
+ nan: "NaN"
53542
+ };
53095
53543
  return (issue2) => {
53096
53544
  switch (issue2.code) {
53097
- case "invalid_type":
53098
- return `Invalid input: expected ${issue2.expected}, received ${parsedType(issue2.input)}`;
53545
+ case "invalid_type": {
53546
+ const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
53547
+ const receivedType = parsedType(issue2.input);
53548
+ const received = TypeDictionary[receivedType] ?? receivedType;
53549
+ return `Invalid input: expected ${expected}, received ${received}`;
53550
+ }
53099
53551
  case "invalid_value":
53100
53552
  if (issue2.values.length === 1)
53101
53553
  return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
@@ -53126,7 +53578,7 @@ var error = () => {
53126
53578
  return `Invalid string: must include "${_issue.includes}"`;
53127
53579
  if (_issue.format === "regex")
53128
53580
  return `Invalid string: must match pattern ${_issue.pattern}`;
53129
- return `Invalid ${Nouns[_issue.format] ?? issue2.format}`;
53581
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
53130
53582
  }
53131
53583
  case "not_multiple_of":
53132
53584
  return `Invalid number: must be a multiple of ${issue2.divisor}`;
@@ -53135,6 +53587,10 @@ var error = () => {
53135
53587
  case "invalid_key":
53136
53588
  return `Invalid key in ${issue2.origin}`;
53137
53589
  case "invalid_union":
53590
+ if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
53591
+ const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
53592
+ return `Invalid discriminator value. Expected ${opts}`;
53593
+ }
53138
53594
  return "Invalid input";
53139
53595
  case "invalid_element":
53140
53596
  return `Invalid value in ${issue2.origin}`;
@@ -53148,28 +53604,26 @@ function en_default() {
53148
53604
  localeError: error()
53149
53605
  };
53150
53606
  }
53151
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/registries.js
53607
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/registries.js
53608
+ var _a2;
53152
53609
  var $output = Symbol("ZodOutput");
53153
53610
  var $input = Symbol("ZodInput");
53154
53611
 
53155
53612
  class $ZodRegistry {
53156
53613
  constructor() {
53157
- this._map = new Map;
53614
+ this._map = new WeakMap;
53158
53615
  this._idmap = new Map;
53159
53616
  }
53160
53617
  add(schema, ..._meta) {
53161
53618
  const meta = _meta[0];
53162
53619
  this._map.set(schema, meta);
53163
53620
  if (meta && typeof meta === "object" && "id" in meta) {
53164
- if (this._idmap.has(meta.id)) {
53165
- throw new Error(`ID ${meta.id} already exists in the registry`);
53166
- }
53167
53621
  this._idmap.set(meta.id, schema);
53168
53622
  }
53169
53623
  return this;
53170
53624
  }
53171
53625
  clear() {
53172
- this._map = new Map;
53626
+ this._map = new WeakMap;
53173
53627
  this._idmap = new Map;
53174
53628
  return this;
53175
53629
  }
@@ -53186,7 +53640,8 @@ class $ZodRegistry {
53186
53640
  if (p) {
53187
53641
  const pm = { ...this.get(p) ?? {} };
53188
53642
  delete pm.id;
53189
- return { ...pm, ...this._map.get(schema) };
53643
+ const f = { ...pm, ...this._map.get(schema) };
53644
+ return Object.keys(f).length ? f : undefined;
53190
53645
  }
53191
53646
  return this._map.get(schema);
53192
53647
  }
@@ -53197,8 +53652,9 @@ class $ZodRegistry {
53197
53652
  function registry() {
53198
53653
  return new $ZodRegistry;
53199
53654
  }
53200
- var globalRegistry = /* @__PURE__ */ registry();
53201
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/api.js
53655
+ (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
53656
+ var globalRegistry = globalThis.__zod_globalRegistry;
53657
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/api.js
53202
53658
  function _string(Class8, params) {
53203
53659
  return new Class8({
53204
53660
  type: "string",
@@ -53606,6 +54062,9 @@ function _toLowerCase() {
53606
54062
  function _toUpperCase() {
53607
54063
  return _overwrite((input) => input.toUpperCase());
53608
54064
  }
54065
+ function _slugify() {
54066
+ return _overwrite((input) => slugify(input));
54067
+ }
53609
54068
  function _array(Class8, element2, params) {
53610
54069
  return new Class8({
53611
54070
  type: "array",
@@ -53633,7 +54092,715 @@ function _refine(Class8, fn2, _params) {
53633
54092
  });
53634
54093
  return schema;
53635
54094
  }
53636
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/iso.js
54095
+ function _superRefine(fn2, params) {
54096
+ const ch = _check((payload) => {
54097
+ payload.addIssue = (issue2) => {
54098
+ if (typeof issue2 === "string") {
54099
+ payload.issues.push(issue(issue2, payload.value, ch._zod.def));
54100
+ } else {
54101
+ const _issue = issue2;
54102
+ if (_issue.fatal)
54103
+ _issue.continue = false;
54104
+ _issue.code ?? (_issue.code = "custom");
54105
+ _issue.input ?? (_issue.input = payload.value);
54106
+ _issue.inst ?? (_issue.inst = ch);
54107
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
54108
+ payload.issues.push(issue(_issue));
54109
+ }
54110
+ };
54111
+ return fn2(payload.value, payload);
54112
+ }, params);
54113
+ return ch;
54114
+ }
54115
+ function _check(fn2, params) {
54116
+ const ch = new $ZodCheck({
54117
+ check: "custom",
54118
+ ...normalizeParams(params)
54119
+ });
54120
+ ch._zod.check = fn2;
54121
+ return ch;
54122
+ }
54123
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
54124
+ function initializeContext(params) {
54125
+ let target = params?.target ?? "draft-2020-12";
54126
+ if (target === "draft-4")
54127
+ target = "draft-04";
54128
+ if (target === "draft-7")
54129
+ target = "draft-07";
54130
+ return {
54131
+ processors: params.processors ?? {},
54132
+ metadataRegistry: params?.metadata ?? globalRegistry,
54133
+ target,
54134
+ unrepresentable: params?.unrepresentable ?? "throw",
54135
+ override: params?.override ?? (() => {}),
54136
+ io: params?.io ?? "output",
54137
+ counter: 0,
54138
+ seen: new Map,
54139
+ cycles: params?.cycles ?? "ref",
54140
+ reused: params?.reused ?? "inline",
54141
+ external: params?.external ?? undefined
54142
+ };
54143
+ }
54144
+ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
54145
+ var _a3;
54146
+ const def = schema._zod.def;
54147
+ const seen = ctx.seen.get(schema);
54148
+ if (seen) {
54149
+ seen.count++;
54150
+ const isCycle = _params.schemaPath.includes(schema);
54151
+ if (isCycle) {
54152
+ seen.cycle = _params.path;
54153
+ }
54154
+ return seen.schema;
54155
+ }
54156
+ const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
54157
+ ctx.seen.set(schema, result);
54158
+ const overrideSchema = schema._zod.toJSONSchema?.();
54159
+ if (overrideSchema) {
54160
+ result.schema = overrideSchema;
54161
+ } else {
54162
+ const params = {
54163
+ ..._params,
54164
+ schemaPath: [..._params.schemaPath, schema],
54165
+ path: _params.path
54166
+ };
54167
+ if (schema._zod.processJSONSchema) {
54168
+ schema._zod.processJSONSchema(ctx, result.schema, params);
54169
+ } else {
54170
+ const _json = result.schema;
54171
+ const processor = ctx.processors[def.type];
54172
+ if (!processor) {
54173
+ throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
54174
+ }
54175
+ processor(schema, ctx, _json, params);
54176
+ }
54177
+ const parent = schema._zod.parent;
54178
+ if (parent) {
54179
+ if (!result.ref)
54180
+ result.ref = parent;
54181
+ process2(parent, ctx, params);
54182
+ ctx.seen.get(parent).isParent = true;
54183
+ }
54184
+ }
54185
+ const meta = ctx.metadataRegistry.get(schema);
54186
+ if (meta)
54187
+ Object.assign(result.schema, meta);
54188
+ if (ctx.io === "input" && isTransforming(schema)) {
54189
+ delete result.schema.examples;
54190
+ delete result.schema.default;
54191
+ }
54192
+ if (ctx.io === "input" && "_prefault" in result.schema)
54193
+ (_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
54194
+ delete result.schema._prefault;
54195
+ const _result = ctx.seen.get(schema);
54196
+ return _result.schema;
54197
+ }
54198
+ function extractDefs(ctx, schema) {
54199
+ const root = ctx.seen.get(schema);
54200
+ if (!root)
54201
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
54202
+ const idToSchema = new Map;
54203
+ for (const entry of ctx.seen.entries()) {
54204
+ const id3 = ctx.metadataRegistry.get(entry[0])?.id;
54205
+ if (id3) {
54206
+ const existing = idToSchema.get(id3);
54207
+ if (existing && existing !== entry[0]) {
54208
+ throw new Error(`Duplicate schema id "${id3}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
54209
+ }
54210
+ idToSchema.set(id3, entry[0]);
54211
+ }
54212
+ }
54213
+ const makeURI = (entry) => {
54214
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
54215
+ if (ctx.external) {
54216
+ const externalId = ctx.external.registry.get(entry[0])?.id;
54217
+ const uriGenerator = ctx.external.uri ?? ((id4) => id4);
54218
+ if (externalId) {
54219
+ return { ref: uriGenerator(externalId) };
54220
+ }
54221
+ const id3 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
54222
+ entry[1].defId = id3;
54223
+ return { defId: id3, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id3}` };
54224
+ }
54225
+ if (entry[1] === root) {
54226
+ return { ref: "#" };
54227
+ }
54228
+ const uriPrefix = `#`;
54229
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
54230
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
54231
+ return { defId, ref: defUriPrefix + defId };
54232
+ };
54233
+ const extractToDef = (entry) => {
54234
+ if (entry[1].schema.$ref) {
54235
+ return;
54236
+ }
54237
+ const seen = entry[1];
54238
+ const { ref, defId } = makeURI(entry);
54239
+ seen.def = { ...seen.schema };
54240
+ if (defId)
54241
+ seen.defId = defId;
54242
+ const schema2 = seen.schema;
54243
+ for (const key in schema2) {
54244
+ delete schema2[key];
54245
+ }
54246
+ schema2.$ref = ref;
54247
+ };
54248
+ if (ctx.cycles === "throw") {
54249
+ for (const entry of ctx.seen.entries()) {
54250
+ const seen = entry[1];
54251
+ if (seen.cycle) {
54252
+ throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
54253
+ }
54254
+ }
54255
+ }
54256
+ for (const entry of ctx.seen.entries()) {
54257
+ const seen = entry[1];
54258
+ if (schema === entry[0]) {
54259
+ extractToDef(entry);
54260
+ continue;
54261
+ }
54262
+ if (ctx.external) {
54263
+ const ext = ctx.external.registry.get(entry[0])?.id;
54264
+ if (schema !== entry[0] && ext) {
54265
+ extractToDef(entry);
54266
+ continue;
54267
+ }
54268
+ }
54269
+ const id3 = ctx.metadataRegistry.get(entry[0])?.id;
54270
+ if (id3) {
54271
+ extractToDef(entry);
54272
+ continue;
54273
+ }
54274
+ if (seen.cycle) {
54275
+ extractToDef(entry);
54276
+ continue;
54277
+ }
54278
+ if (seen.count > 1) {
54279
+ if (ctx.reused === "ref") {
54280
+ extractToDef(entry);
54281
+ continue;
54282
+ }
54283
+ }
54284
+ }
54285
+ }
54286
+ function finalize(ctx, schema) {
54287
+ const root = ctx.seen.get(schema);
54288
+ if (!root)
54289
+ throw new Error("Unprocessed schema. This is a bug in Zod.");
54290
+ const flattenRef = (zodSchema) => {
54291
+ const seen = ctx.seen.get(zodSchema);
54292
+ if (seen.ref === null)
54293
+ return;
54294
+ const schema2 = seen.def ?? seen.schema;
54295
+ const _cached = { ...schema2 };
54296
+ const ref = seen.ref;
54297
+ seen.ref = null;
54298
+ if (ref) {
54299
+ flattenRef(ref);
54300
+ const refSeen = ctx.seen.get(ref);
54301
+ const refSchema = refSeen.schema;
54302
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
54303
+ schema2.allOf = schema2.allOf ?? [];
54304
+ schema2.allOf.push(refSchema);
54305
+ } else {
54306
+ Object.assign(schema2, refSchema);
54307
+ }
54308
+ Object.assign(schema2, _cached);
54309
+ const isParentRef = zodSchema._zod.parent === ref;
54310
+ if (isParentRef) {
54311
+ for (const key in schema2) {
54312
+ if (key === "$ref" || key === "allOf")
54313
+ continue;
54314
+ if (!(key in _cached)) {
54315
+ delete schema2[key];
54316
+ }
54317
+ }
54318
+ }
54319
+ if (refSchema.$ref && refSeen.def) {
54320
+ for (const key in schema2) {
54321
+ if (key === "$ref" || key === "allOf")
54322
+ continue;
54323
+ if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) {
54324
+ delete schema2[key];
54325
+ }
54326
+ }
54327
+ }
54328
+ }
54329
+ const parent = zodSchema._zod.parent;
54330
+ if (parent && parent !== ref) {
54331
+ flattenRef(parent);
54332
+ const parentSeen = ctx.seen.get(parent);
54333
+ if (parentSeen?.schema.$ref) {
54334
+ schema2.$ref = parentSeen.schema.$ref;
54335
+ if (parentSeen.def) {
54336
+ for (const key in schema2) {
54337
+ if (key === "$ref" || key === "allOf")
54338
+ continue;
54339
+ if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) {
54340
+ delete schema2[key];
54341
+ }
54342
+ }
54343
+ }
54344
+ }
54345
+ }
54346
+ ctx.override({
54347
+ zodSchema,
54348
+ jsonSchema: schema2,
54349
+ path: seen.path ?? []
54350
+ });
54351
+ };
54352
+ for (const entry of [...ctx.seen.entries()].reverse()) {
54353
+ flattenRef(entry[0]);
54354
+ }
54355
+ const result = {};
54356
+ if (ctx.target === "draft-2020-12") {
54357
+ result.$schema = "https://json-schema.org/draft/2020-12/schema";
54358
+ } else if (ctx.target === "draft-07") {
54359
+ result.$schema = "http://json-schema.org/draft-07/schema#";
54360
+ } else if (ctx.target === "draft-04") {
54361
+ result.$schema = "http://json-schema.org/draft-04/schema#";
54362
+ } else if (ctx.target === "openapi-3.0") {} else {}
54363
+ if (ctx.external?.uri) {
54364
+ const id3 = ctx.external.registry.get(schema)?.id;
54365
+ if (!id3)
54366
+ throw new Error("Schema is missing an `id` property");
54367
+ result.$id = ctx.external.uri(id3);
54368
+ }
54369
+ Object.assign(result, root.def ?? root.schema);
54370
+ const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
54371
+ if (rootMetaId !== undefined && result.id === rootMetaId)
54372
+ delete result.id;
54373
+ const defs = ctx.external?.defs ?? {};
54374
+ for (const entry of ctx.seen.entries()) {
54375
+ const seen = entry[1];
54376
+ if (seen.def && seen.defId) {
54377
+ if (seen.def.id === seen.defId)
54378
+ delete seen.def.id;
54379
+ defs[seen.defId] = seen.def;
54380
+ }
54381
+ }
54382
+ if (ctx.external) {} else {
54383
+ if (Object.keys(defs).length > 0) {
54384
+ if (ctx.target === "draft-2020-12") {
54385
+ result.$defs = defs;
54386
+ } else {
54387
+ result.definitions = defs;
54388
+ }
54389
+ }
54390
+ }
54391
+ try {
54392
+ const finalized = JSON.parse(JSON.stringify(result));
54393
+ Object.defineProperty(finalized, "~standard", {
54394
+ value: {
54395
+ ...schema["~standard"],
54396
+ jsonSchema: {
54397
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
54398
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
54399
+ }
54400
+ },
54401
+ enumerable: false,
54402
+ writable: false
54403
+ });
54404
+ return finalized;
54405
+ } catch (_err) {
54406
+ throw new Error("Error converting schema to JSON.");
54407
+ }
54408
+ }
54409
+ function isTransforming(_schema, _ctx) {
54410
+ const ctx = _ctx ?? { seen: new Set };
54411
+ if (ctx.seen.has(_schema))
54412
+ return false;
54413
+ ctx.seen.add(_schema);
54414
+ const def = _schema._zod.def;
54415
+ if (def.type === "transform")
54416
+ return true;
54417
+ if (def.type === "array")
54418
+ return isTransforming(def.element, ctx);
54419
+ if (def.type === "set")
54420
+ return isTransforming(def.valueType, ctx);
54421
+ if (def.type === "lazy")
54422
+ return isTransforming(def.getter(), ctx);
54423
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
54424
+ return isTransforming(def.innerType, ctx);
54425
+ }
54426
+ if (def.type === "intersection") {
54427
+ return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
54428
+ }
54429
+ if (def.type === "record" || def.type === "map") {
54430
+ return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
54431
+ }
54432
+ if (def.type === "pipe") {
54433
+ if (_schema._zod.traits.has("$ZodCodec"))
54434
+ return true;
54435
+ return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
54436
+ }
54437
+ if (def.type === "object") {
54438
+ for (const key in def.shape) {
54439
+ if (isTransforming(def.shape[key], ctx))
54440
+ return true;
54441
+ }
54442
+ return false;
54443
+ }
54444
+ if (def.type === "union") {
54445
+ for (const option7 of def.options) {
54446
+ if (isTransforming(option7, ctx))
54447
+ return true;
54448
+ }
54449
+ return false;
54450
+ }
54451
+ if (def.type === "tuple") {
54452
+ for (const item of def.items) {
54453
+ if (isTransforming(item, ctx))
54454
+ return true;
54455
+ }
54456
+ if (def.rest && isTransforming(def.rest, ctx))
54457
+ return true;
54458
+ return false;
54459
+ }
54460
+ return false;
54461
+ }
54462
+ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
54463
+ const ctx = initializeContext({ ...params, processors });
54464
+ process2(schema, ctx);
54465
+ extractDefs(ctx, schema);
54466
+ return finalize(ctx, schema);
54467
+ };
54468
+ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
54469
+ const { libraryOptions, target } = params ?? {};
54470
+ const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
54471
+ process2(schema, ctx);
54472
+ extractDefs(ctx, schema);
54473
+ return finalize(ctx, schema);
54474
+ };
54475
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
54476
+ var formatMap = {
54477
+ guid: "uuid",
54478
+ url: "uri",
54479
+ datetime: "date-time",
54480
+ json_string: "json-string",
54481
+ regex: ""
54482
+ };
54483
+ var stringProcessor = (schema, ctx, _json, _params) => {
54484
+ const json4 = _json;
54485
+ json4.type = "string";
54486
+ const { minimum, maximum, format: format8, patterns, contentEncoding } = schema._zod.bag;
54487
+ if (typeof minimum === "number")
54488
+ json4.minLength = minimum;
54489
+ if (typeof maximum === "number")
54490
+ json4.maxLength = maximum;
54491
+ if (format8) {
54492
+ json4.format = formatMap[format8] ?? format8;
54493
+ if (json4.format === "")
54494
+ delete json4.format;
54495
+ if (format8 === "time") {
54496
+ delete json4.format;
54497
+ }
54498
+ }
54499
+ if (contentEncoding)
54500
+ json4.contentEncoding = contentEncoding;
54501
+ if (patterns && patterns.size > 0) {
54502
+ const regexes = [...patterns];
54503
+ if (regexes.length === 1)
54504
+ json4.pattern = regexes[0].source;
54505
+ else if (regexes.length > 1) {
54506
+ json4.allOf = [
54507
+ ...regexes.map((regex) => ({
54508
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
54509
+ pattern: regex.source
54510
+ }))
54511
+ ];
54512
+ }
54513
+ }
54514
+ };
54515
+ var numberProcessor = (schema, ctx, _json, _params) => {
54516
+ const json4 = _json;
54517
+ const { minimum, maximum, format: format8, multipleOf: multipleOf2, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
54518
+ if (typeof format8 === "string" && format8.includes("int"))
54519
+ json4.type = "integer";
54520
+ else
54521
+ json4.type = "number";
54522
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
54523
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
54524
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
54525
+ if (exMin) {
54526
+ if (legacy) {
54527
+ json4.minimum = exclusiveMinimum;
54528
+ json4.exclusiveMinimum = true;
54529
+ } else {
54530
+ json4.exclusiveMinimum = exclusiveMinimum;
54531
+ }
54532
+ } else if (typeof minimum === "number") {
54533
+ json4.minimum = minimum;
54534
+ }
54535
+ if (exMax) {
54536
+ if (legacy) {
54537
+ json4.maximum = exclusiveMaximum;
54538
+ json4.exclusiveMaximum = true;
54539
+ } else {
54540
+ json4.exclusiveMaximum = exclusiveMaximum;
54541
+ }
54542
+ } else if (typeof maximum === "number") {
54543
+ json4.maximum = maximum;
54544
+ }
54545
+ if (typeof multipleOf2 === "number")
54546
+ json4.multipleOf = multipleOf2;
54547
+ };
54548
+ var booleanProcessor = (_schema, _ctx, json4, _params) => {
54549
+ json4.type = "boolean";
54550
+ };
54551
+ var nullProcessor = (_schema, ctx, json4, _params) => {
54552
+ if (ctx.target === "openapi-3.0") {
54553
+ json4.type = "string";
54554
+ json4.nullable = true;
54555
+ json4.enum = [null];
54556
+ } else {
54557
+ json4.type = "null";
54558
+ }
54559
+ };
54560
+ var neverProcessor = (_schema, _ctx, json4, _params) => {
54561
+ json4.not = {};
54562
+ };
54563
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
54564
+ var enumProcessor = (schema, _ctx, json4, _params) => {
54565
+ const def = schema._zod.def;
54566
+ const values7 = getEnumValues(def.entries);
54567
+ if (values7.every((v) => typeof v === "number"))
54568
+ json4.type = "number";
54569
+ if (values7.every((v) => typeof v === "string"))
54570
+ json4.type = "string";
54571
+ json4.enum = values7;
54572
+ };
54573
+ var literalProcessor = (schema, ctx, json4, _params) => {
54574
+ const def = schema._zod.def;
54575
+ const vals = [];
54576
+ for (const val of def.values) {
54577
+ if (val === undefined) {
54578
+ if (ctx.unrepresentable === "throw") {
54579
+ throw new Error("Literal `undefined` cannot be represented in JSON Schema");
54580
+ } else {}
54581
+ } else if (typeof val === "bigint") {
54582
+ if (ctx.unrepresentable === "throw") {
54583
+ throw new Error("BigInt literals cannot be represented in JSON Schema");
54584
+ } else {
54585
+ vals.push(Number(val));
54586
+ }
54587
+ } else {
54588
+ vals.push(val);
54589
+ }
54590
+ }
54591
+ if (vals.length === 0) {} else if (vals.length === 1) {
54592
+ const val = vals[0];
54593
+ json4.type = val === null ? "null" : typeof val;
54594
+ if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
54595
+ json4.enum = [val];
54596
+ } else {
54597
+ json4.const = val;
54598
+ }
54599
+ } else {
54600
+ if (vals.every((v) => typeof v === "number"))
54601
+ json4.type = "number";
54602
+ if (vals.every((v) => typeof v === "string"))
54603
+ json4.type = "string";
54604
+ if (vals.every((v) => typeof v === "boolean"))
54605
+ json4.type = "boolean";
54606
+ if (vals.every((v) => v === null))
54607
+ json4.type = "null";
54608
+ json4.enum = vals;
54609
+ }
54610
+ };
54611
+ var customProcessor = (_schema, ctx, _json, _params) => {
54612
+ if (ctx.unrepresentable === "throw") {
54613
+ throw new Error("Custom types cannot be represented in JSON Schema");
54614
+ }
54615
+ };
54616
+ var transformProcessor = (_schema, ctx, _json, _params) => {
54617
+ if (ctx.unrepresentable === "throw") {
54618
+ throw new Error("Transforms cannot be represented in JSON Schema");
54619
+ }
54620
+ };
54621
+ var arrayProcessor = (schema, ctx, _json, params) => {
54622
+ const json4 = _json;
54623
+ const def = schema._zod.def;
54624
+ const { minimum, maximum } = schema._zod.bag;
54625
+ if (typeof minimum === "number")
54626
+ json4.minItems = minimum;
54627
+ if (typeof maximum === "number")
54628
+ json4.maxItems = maximum;
54629
+ json4.type = "array";
54630
+ json4.items = process2(def.element, ctx, {
54631
+ ...params,
54632
+ path: [...params.path, "items"]
54633
+ });
54634
+ };
54635
+ var objectProcessor = (schema, ctx, _json, params) => {
54636
+ const json4 = _json;
54637
+ const def = schema._zod.def;
54638
+ json4.type = "object";
54639
+ json4.properties = {};
54640
+ const shape = def.shape;
54641
+ for (const key in shape) {
54642
+ json4.properties[key] = process2(shape[key], ctx, {
54643
+ ...params,
54644
+ path: [...params.path, "properties", key]
54645
+ });
54646
+ }
54647
+ const allKeys = new Set(Object.keys(shape));
54648
+ const requiredKeys = new Set([...allKeys].filter((key) => {
54649
+ const v = def.shape[key]._zod;
54650
+ if (ctx.io === "input") {
54651
+ return v.optin === undefined;
54652
+ } else {
54653
+ return v.optout === undefined;
54654
+ }
54655
+ }));
54656
+ if (requiredKeys.size > 0) {
54657
+ json4.required = Array.from(requiredKeys);
54658
+ }
54659
+ if (def.catchall?._zod.def.type === "never") {
54660
+ json4.additionalProperties = false;
54661
+ } else if (!def.catchall) {
54662
+ if (ctx.io === "output")
54663
+ json4.additionalProperties = false;
54664
+ } else if (def.catchall) {
54665
+ json4.additionalProperties = process2(def.catchall, ctx, {
54666
+ ...params,
54667
+ path: [...params.path, "additionalProperties"]
54668
+ });
54669
+ }
54670
+ };
54671
+ var unionProcessor = (schema, ctx, json4, params) => {
54672
+ const def = schema._zod.def;
54673
+ const isExclusive = def.inclusive === false;
54674
+ const options5 = def.options.map((x, i) => process2(x, ctx, {
54675
+ ...params,
54676
+ path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
54677
+ }));
54678
+ if (isExclusive) {
54679
+ json4.oneOf = options5;
54680
+ } else {
54681
+ json4.anyOf = options5;
54682
+ }
54683
+ };
54684
+ var intersectionProcessor = (schema, ctx, json4, params) => {
54685
+ const def = schema._zod.def;
54686
+ const a = process2(def.left, ctx, {
54687
+ ...params,
54688
+ path: [...params.path, "allOf", 0]
54689
+ });
54690
+ const b = process2(def.right, ctx, {
54691
+ ...params,
54692
+ path: [...params.path, "allOf", 1]
54693
+ });
54694
+ const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
54695
+ const allOf = [
54696
+ ...isSimpleIntersection(a) ? a.allOf : [a],
54697
+ ...isSimpleIntersection(b) ? b.allOf : [b]
54698
+ ];
54699
+ json4.allOf = allOf;
54700
+ };
54701
+ var recordProcessor = (schema, ctx, _json, params) => {
54702
+ const json4 = _json;
54703
+ const def = schema._zod.def;
54704
+ json4.type = "object";
54705
+ const keyType = def.keyType;
54706
+ const keyBag = keyType._zod.bag;
54707
+ const patterns = keyBag?.patterns;
54708
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
54709
+ const valueSchema = process2(def.valueType, ctx, {
54710
+ ...params,
54711
+ path: [...params.path, "patternProperties", "*"]
54712
+ });
54713
+ json4.patternProperties = {};
54714
+ for (const pattern2 of patterns) {
54715
+ json4.patternProperties[pattern2.source] = valueSchema;
54716
+ }
54717
+ } else {
54718
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
54719
+ json4.propertyNames = process2(def.keyType, ctx, {
54720
+ ...params,
54721
+ path: [...params.path, "propertyNames"]
54722
+ });
54723
+ }
54724
+ json4.additionalProperties = process2(def.valueType, ctx, {
54725
+ ...params,
54726
+ path: [...params.path, "additionalProperties"]
54727
+ });
54728
+ }
54729
+ const keyValues = keyType._zod.values;
54730
+ if (keyValues) {
54731
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
54732
+ if (validKeyValues.length > 0) {
54733
+ json4.required = validKeyValues;
54734
+ }
54735
+ }
54736
+ };
54737
+ var nullableProcessor = (schema, ctx, json4, params) => {
54738
+ const def = schema._zod.def;
54739
+ const inner = process2(def.innerType, ctx, params);
54740
+ const seen = ctx.seen.get(schema);
54741
+ if (ctx.target === "openapi-3.0") {
54742
+ seen.ref = def.innerType;
54743
+ json4.nullable = true;
54744
+ } else {
54745
+ json4.anyOf = [inner, { type: "null" }];
54746
+ }
54747
+ };
54748
+ var nonoptionalProcessor = (schema, ctx, _json, params) => {
54749
+ const def = schema._zod.def;
54750
+ process2(def.innerType, ctx, params);
54751
+ const seen = ctx.seen.get(schema);
54752
+ seen.ref = def.innerType;
54753
+ };
54754
+ var defaultProcessor = (schema, ctx, json4, params) => {
54755
+ const def = schema._zod.def;
54756
+ process2(def.innerType, ctx, params);
54757
+ const seen = ctx.seen.get(schema);
54758
+ seen.ref = def.innerType;
54759
+ json4.default = JSON.parse(JSON.stringify(def.defaultValue));
54760
+ };
54761
+ var prefaultProcessor = (schema, ctx, json4, params) => {
54762
+ const def = schema._zod.def;
54763
+ process2(def.innerType, ctx, params);
54764
+ const seen = ctx.seen.get(schema);
54765
+ seen.ref = def.innerType;
54766
+ if (ctx.io === "input")
54767
+ json4._prefault = JSON.parse(JSON.stringify(def.defaultValue));
54768
+ };
54769
+ var catchProcessor = (schema, ctx, json4, params) => {
54770
+ const def = schema._zod.def;
54771
+ process2(def.innerType, ctx, params);
54772
+ const seen = ctx.seen.get(schema);
54773
+ seen.ref = def.innerType;
54774
+ let catchValue;
54775
+ try {
54776
+ catchValue = def.catchValue(undefined);
54777
+ } catch {
54778
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
54779
+ }
54780
+ json4.default = catchValue;
54781
+ };
54782
+ var pipeProcessor = (schema, ctx, _json, params) => {
54783
+ const def = schema._zod.def;
54784
+ const inIsTransform = def.in._zod.traits.has("$ZodTransform");
54785
+ const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
54786
+ process2(innerType, ctx, params);
54787
+ const seen = ctx.seen.get(schema);
54788
+ seen.ref = innerType;
54789
+ };
54790
+ var readonlyProcessor = (schema, ctx, json4, params) => {
54791
+ const def = schema._zod.def;
54792
+ process2(def.innerType, ctx, params);
54793
+ const seen = ctx.seen.get(schema);
54794
+ seen.ref = def.innerType;
54795
+ json4.readOnly = true;
54796
+ };
54797
+ var optionalProcessor = (schema, ctx, _json, params) => {
54798
+ const def = schema._zod.def;
54799
+ process2(def.innerType, ctx, params);
54800
+ const seen = ctx.seen.get(schema);
54801
+ seen.ref = def.innerType;
54802
+ };
54803
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/iso.js
53637
54804
  var exports_iso = {};
53638
54805
  __export(exports_iso, {
53639
54806
  time: () => time2,
@@ -53674,7 +54841,7 @@ function duration6(params) {
53674
54841
  return _isoDuration(ZodISODuration, params);
53675
54842
  }
53676
54843
 
53677
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/errors.js
54844
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/errors.js
53678
54845
  var initializer2 = (inst, issues) => {
53679
54846
  $ZodError.init(inst, issues);
53680
54847
  inst.name = "ZodError";
@@ -53686,10 +54853,16 @@ var initializer2 = (inst, issues) => {
53686
54853
  value: (mapper) => flattenError(inst, mapper)
53687
54854
  },
53688
54855
  addIssue: {
53689
- value: (issue2) => inst.issues.push(issue2)
54856
+ value: (issue2) => {
54857
+ inst.issues.push(issue2);
54858
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
54859
+ }
53690
54860
  },
53691
54861
  addIssues: {
53692
- value: (issues2) => inst.issues.push(...issues2)
54862
+ value: (issues2) => {
54863
+ inst.issues.push(...issues2);
54864
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
54865
+ }
53693
54866
  },
53694
54867
  isEmpty: {
53695
54868
  get() {
@@ -53698,102 +54871,246 @@ var initializer2 = (inst, issues) => {
53698
54871
  }
53699
54872
  });
53700
54873
  };
53701
- var ZodError = $constructor("ZodError", initializer2);
53702
- var ZodRealError = $constructor("ZodError", initializer2, {
54874
+ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
53703
54875
  Parent: Error
53704
54876
  });
53705
54877
 
53706
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/parse.js
53707
- var parse4 = /* @__PURE__ */ _parse(ZodRealError);
53708
- var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
54878
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/parse.js
54879
+ var parse5 = /* @__PURE__ */ _parse(ZodRealError);
54880
+ var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
53709
54881
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
53710
54882
  var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
53711
-
53712
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/schemas.js
54883
+ var encode6 = /* @__PURE__ */ _encode(ZodRealError);
54884
+ var decode7 = /* @__PURE__ */ _decode(ZodRealError);
54885
+ var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
54886
+ var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
54887
+ var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
54888
+ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
54889
+ var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
54890
+ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
54891
+
54892
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
54893
+ var _installedGroups = /* @__PURE__ */ new WeakMap;
54894
+ function _installLazyMethods(inst, group2, methods) {
54895
+ const proto14 = Object.getPrototypeOf(inst);
54896
+ let installed = _installedGroups.get(proto14);
54897
+ if (!installed) {
54898
+ installed = new Set;
54899
+ _installedGroups.set(proto14, installed);
54900
+ }
54901
+ if (installed.has(group2))
54902
+ return;
54903
+ installed.add(group2);
54904
+ for (const key in methods) {
54905
+ const fn2 = methods[key];
54906
+ Object.defineProperty(proto14, key, {
54907
+ configurable: true,
54908
+ enumerable: false,
54909
+ get() {
54910
+ const bound = fn2.bind(this);
54911
+ Object.defineProperty(this, key, {
54912
+ configurable: true,
54913
+ writable: true,
54914
+ enumerable: true,
54915
+ value: bound
54916
+ });
54917
+ return bound;
54918
+ },
54919
+ set(v) {
54920
+ Object.defineProperty(this, key, {
54921
+ configurable: true,
54922
+ writable: true,
54923
+ enumerable: true,
54924
+ value: v
54925
+ });
54926
+ }
54927
+ });
54928
+ }
54929
+ }
53713
54930
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
53714
54931
  $ZodType.init(inst, def);
54932
+ Object.assign(inst["~standard"], {
54933
+ jsonSchema: {
54934
+ input: createStandardJSONSchemaMethod(inst, "input"),
54935
+ output: createStandardJSONSchemaMethod(inst, "output")
54936
+ }
54937
+ });
54938
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
53715
54939
  inst.def = def;
54940
+ inst.type = def.type;
53716
54941
  Object.defineProperty(inst, "_def", { value: def });
53717
- inst.check = (...checks2) => {
53718
- return inst.clone({
53719
- ...def,
53720
- checks: [
53721
- ...def.checks ?? [],
53722
- ...checks2.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
53723
- ]
53724
- });
53725
- };
53726
- inst.clone = (def2, params) => clone2(inst, def2, params);
53727
- inst.brand = () => inst;
53728
- inst.register = (reg, meta) => {
53729
- reg.add(inst, meta);
53730
- return inst;
53731
- };
53732
- inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
54942
+ inst.parse = (data, params) => parse5(inst, data, params, { callee: inst.parse });
53733
54943
  inst.safeParse = (data, params) => safeParse2(inst, data, params);
53734
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
54944
+ inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
53735
54945
  inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
53736
54946
  inst.spa = inst.safeParseAsync;
53737
- inst.refine = (check3, params) => inst.check(refine(check3, params));
53738
- inst.superRefine = (refinement) => inst.check(superRefine(refinement));
53739
- inst.overwrite = (fn2) => inst.check(_overwrite(fn2));
53740
- inst.optional = () => optional2(inst);
53741
- inst.nullable = () => nullable(inst);
53742
- inst.nullish = () => optional2(nullable(inst));
53743
- inst.nonoptional = (params) => nonoptional(inst, params);
53744
- inst.array = () => array8(inst);
53745
- inst.or = (arg) => union14([inst, arg]);
53746
- inst.and = (arg) => intersection7(inst, arg);
53747
- inst.transform = (tx) => pipe3(inst, transform5(tx));
53748
- inst.default = (def2) => _default(inst, def2);
53749
- inst.prefault = (def2) => prefault(inst, def2);
53750
- inst.catch = (params) => _catch3(inst, params);
53751
- inst.pipe = (target) => pipe3(inst, target);
53752
- inst.readonly = () => readonly(inst);
53753
- inst.describe = (description) => {
53754
- const cl = inst.clone();
53755
- globalRegistry.add(cl, { description });
53756
- return cl;
53757
- };
54947
+ inst.encode = (data, params) => encode6(inst, data, params);
54948
+ inst.decode = (data, params) => decode7(inst, data, params);
54949
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
54950
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
54951
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
54952
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
54953
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
54954
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
54955
+ _installLazyMethods(inst, "ZodType", {
54956
+ check(...chks) {
54957
+ const def2 = this.def;
54958
+ return this.clone(exports_util2.mergeDefs(def2, {
54959
+ checks: [
54960
+ ...def2.checks ?? [],
54961
+ ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
54962
+ ]
54963
+ }), { parent: true });
54964
+ },
54965
+ with(...chks) {
54966
+ return this.check(...chks);
54967
+ },
54968
+ clone(def2, params) {
54969
+ return clone2(this, def2, params);
54970
+ },
54971
+ brand() {
54972
+ return this;
54973
+ },
54974
+ register(reg, meta2) {
54975
+ reg.add(this, meta2);
54976
+ return this;
54977
+ },
54978
+ refine(check3, params) {
54979
+ return this.check(refine(check3, params));
54980
+ },
54981
+ superRefine(refinement, params) {
54982
+ return this.check(superRefine(refinement, params));
54983
+ },
54984
+ overwrite(fn2) {
54985
+ return this.check(_overwrite(fn2));
54986
+ },
54987
+ optional() {
54988
+ return optional2(this);
54989
+ },
54990
+ exactOptional() {
54991
+ return exactOptional(this);
54992
+ },
54993
+ nullable() {
54994
+ return nullable(this);
54995
+ },
54996
+ nullish() {
54997
+ return optional2(nullable(this));
54998
+ },
54999
+ nonoptional(params) {
55000
+ return nonoptional(this, params);
55001
+ },
55002
+ array() {
55003
+ return array8(this);
55004
+ },
55005
+ or(arg) {
55006
+ return union14([this, arg]);
55007
+ },
55008
+ and(arg) {
55009
+ return intersection7(this, arg);
55010
+ },
55011
+ transform(tx) {
55012
+ return pipe3(this, transform5(tx));
55013
+ },
55014
+ default(d) {
55015
+ return _default(this, d);
55016
+ },
55017
+ prefault(d) {
55018
+ return prefault(this, d);
55019
+ },
55020
+ catch(params) {
55021
+ return _catch3(this, params);
55022
+ },
55023
+ pipe(target) {
55024
+ return pipe3(this, target);
55025
+ },
55026
+ readonly() {
55027
+ return readonly(this);
55028
+ },
55029
+ describe(description) {
55030
+ const cl = this.clone();
55031
+ globalRegistry.add(cl, { description });
55032
+ return cl;
55033
+ },
55034
+ meta(...args2) {
55035
+ if (args2.length === 0)
55036
+ return globalRegistry.get(this);
55037
+ const cl = this.clone();
55038
+ globalRegistry.add(cl, args2[0]);
55039
+ return cl;
55040
+ },
55041
+ isOptional() {
55042
+ return this.safeParse(undefined).success;
55043
+ },
55044
+ isNullable() {
55045
+ return this.safeParse(null).success;
55046
+ },
55047
+ apply(fn2) {
55048
+ return fn2(this);
55049
+ }
55050
+ });
53758
55051
  Object.defineProperty(inst, "description", {
53759
55052
  get() {
53760
55053
  return globalRegistry.get(inst)?.description;
53761
55054
  },
53762
55055
  configurable: true
53763
55056
  });
53764
- inst.meta = (...args2) => {
53765
- if (args2.length === 0) {
53766
- return globalRegistry.get(inst);
53767
- }
53768
- const cl = inst.clone();
53769
- globalRegistry.add(cl, args2[0]);
53770
- return cl;
53771
- };
53772
- inst.isOptional = () => inst.safeParse(undefined).success;
53773
- inst.isNullable = () => inst.safeParse(null).success;
53774
55057
  return inst;
53775
55058
  });
53776
55059
  var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
53777
55060
  $ZodString.init(inst, def);
53778
55061
  ZodType.init(inst, def);
55062
+ inst._zod.processJSONSchema = (ctx, json4, params) => stringProcessor(inst, ctx, json4, params);
53779
55063
  const bag = inst._zod.bag;
53780
55064
  inst.format = bag.format ?? null;
53781
55065
  inst.minLength = bag.minimum ?? null;
53782
55066
  inst.maxLength = bag.maximum ?? null;
53783
- inst.regex = (...args2) => inst.check(_regex(...args2));
53784
- inst.includes = (...args2) => inst.check(_includes(...args2));
53785
- inst.startsWith = (...args2) => inst.check(_startsWith(...args2));
53786
- inst.endsWith = (...args2) => inst.check(_endsWith(...args2));
53787
- inst.min = (...args2) => inst.check(_minLength(...args2));
53788
- inst.max = (...args2) => inst.check(_maxLength(...args2));
53789
- inst.length = (...args2) => inst.check(_length(...args2));
53790
- inst.nonempty = (...args2) => inst.check(_minLength(1, ...args2));
53791
- inst.lowercase = (params) => inst.check(_lowercase(params));
53792
- inst.uppercase = (params) => inst.check(_uppercase(params));
53793
- inst.trim = () => inst.check(_trim());
53794
- inst.normalize = (...args2) => inst.check(_normalize(...args2));
53795
- inst.toLowerCase = () => inst.check(_toLowerCase());
53796
- inst.toUpperCase = () => inst.check(_toUpperCase());
55067
+ _installLazyMethods(inst, "_ZodString", {
55068
+ regex(...args2) {
55069
+ return this.check(_regex(...args2));
55070
+ },
55071
+ includes(...args2) {
55072
+ return this.check(_includes(...args2));
55073
+ },
55074
+ startsWith(...args2) {
55075
+ return this.check(_startsWith(...args2));
55076
+ },
55077
+ endsWith(...args2) {
55078
+ return this.check(_endsWith(...args2));
55079
+ },
55080
+ min(...args2) {
55081
+ return this.check(_minLength(...args2));
55082
+ },
55083
+ max(...args2) {
55084
+ return this.check(_maxLength(...args2));
55085
+ },
55086
+ length(...args2) {
55087
+ return this.check(_length(...args2));
55088
+ },
55089
+ nonempty(...args2) {
55090
+ return this.check(_minLength(1, ...args2));
55091
+ },
55092
+ lowercase(params) {
55093
+ return this.check(_lowercase(params));
55094
+ },
55095
+ uppercase(params) {
55096
+ return this.check(_uppercase(params));
55097
+ },
55098
+ trim() {
55099
+ return this.check(_trim());
55100
+ },
55101
+ normalize(...args2) {
55102
+ return this.check(_normalize(...args2));
55103
+ },
55104
+ toLowerCase() {
55105
+ return this.check(_toLowerCase());
55106
+ },
55107
+ toUpperCase() {
55108
+ return this.check(_toUpperCase());
55109
+ },
55110
+ slugify() {
55111
+ return this.check(_slugify());
55112
+ }
55113
+ });
53797
55114
  });
53798
55115
  var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
53799
55116
  $ZodString.init(inst, def);
@@ -53912,21 +55229,54 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
53912
55229
  var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
53913
55230
  $ZodNumber.init(inst, def);
53914
55231
  ZodType.init(inst, def);
53915
- inst.gt = (value5, params) => inst.check(_gt(value5, params));
53916
- inst.gte = (value5, params) => inst.check(_gte(value5, params));
53917
- inst.min = (value5, params) => inst.check(_gte(value5, params));
53918
- inst.lt = (value5, params) => inst.check(_lt(value5, params));
53919
- inst.lte = (value5, params) => inst.check(_lte(value5, params));
53920
- inst.max = (value5, params) => inst.check(_lte(value5, params));
53921
- inst.int = (params) => inst.check(int2(params));
53922
- inst.safe = (params) => inst.check(int2(params));
53923
- inst.positive = (params) => inst.check(_gt(0, params));
53924
- inst.nonnegative = (params) => inst.check(_gte(0, params));
53925
- inst.negative = (params) => inst.check(_lt(0, params));
53926
- inst.nonpositive = (params) => inst.check(_lte(0, params));
53927
- inst.multipleOf = (value5, params) => inst.check(_multipleOf(value5, params));
53928
- inst.step = (value5, params) => inst.check(_multipleOf(value5, params));
53929
- inst.finite = () => inst;
55232
+ inst._zod.processJSONSchema = (ctx, json4, params) => numberProcessor(inst, ctx, json4, params);
55233
+ _installLazyMethods(inst, "ZodNumber", {
55234
+ gt(value5, params) {
55235
+ return this.check(_gt(value5, params));
55236
+ },
55237
+ gte(value5, params) {
55238
+ return this.check(_gte(value5, params));
55239
+ },
55240
+ min(value5, params) {
55241
+ return this.check(_gte(value5, params));
55242
+ },
55243
+ lt(value5, params) {
55244
+ return this.check(_lt(value5, params));
55245
+ },
55246
+ lte(value5, params) {
55247
+ return this.check(_lte(value5, params));
55248
+ },
55249
+ max(value5, params) {
55250
+ return this.check(_lte(value5, params));
55251
+ },
55252
+ int(params) {
55253
+ return this.check(int2(params));
55254
+ },
55255
+ safe(params) {
55256
+ return this.check(int2(params));
55257
+ },
55258
+ positive(params) {
55259
+ return this.check(_gt(0, params));
55260
+ },
55261
+ nonnegative(params) {
55262
+ return this.check(_gte(0, params));
55263
+ },
55264
+ negative(params) {
55265
+ return this.check(_lt(0, params));
55266
+ },
55267
+ nonpositive(params) {
55268
+ return this.check(_lte(0, params));
55269
+ },
55270
+ multipleOf(value5, params) {
55271
+ return this.check(_multipleOf(value5, params));
55272
+ },
55273
+ step(value5, params) {
55274
+ return this.check(_multipleOf(value5, params));
55275
+ },
55276
+ finite() {
55277
+ return this;
55278
+ }
55279
+ });
53930
55280
  const bag = inst._zod.bag;
53931
55281
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
53932
55282
  inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
@@ -53947,6 +55297,7 @@ function int2(params) {
53947
55297
  var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
53948
55298
  $ZodBoolean.init(inst, def);
53949
55299
  ZodType.init(inst, def);
55300
+ inst._zod.processJSONSchema = (ctx, json4, params) => booleanProcessor(inst, ctx, json4, params);
53950
55301
  });
53951
55302
  function boolean6(params) {
53952
55303
  return _boolean(ZodBoolean, params);
@@ -53954,6 +55305,7 @@ function boolean6(params) {
53954
55305
  var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
53955
55306
  $ZodNull.init(inst, def);
53956
55307
  ZodType.init(inst, def);
55308
+ inst._zod.processJSONSchema = (ctx, json4, params) => nullProcessor(inst, ctx, json4, params);
53957
55309
  });
53958
55310
  function _null4(params) {
53959
55311
  return _null3(ZodNull, params);
@@ -53961,6 +55313,7 @@ function _null4(params) {
53961
55313
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
53962
55314
  $ZodUnknown.init(inst, def);
53963
55315
  ZodType.init(inst, def);
55316
+ inst._zod.processJSONSchema = (ctx, json4, params) => unknownProcessor(inst, ctx, json4, params);
53964
55317
  });
53965
55318
  function unknown() {
53966
55319
  return _unknown(ZodUnknown);
@@ -53968,6 +55321,7 @@ function unknown() {
53968
55321
  var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
53969
55322
  $ZodNever.init(inst, def);
53970
55323
  ZodType.init(inst, def);
55324
+ inst._zod.processJSONSchema = (ctx, json4, params) => neverProcessor(inst, ctx, json4, params);
53971
55325
  });
53972
55326
  function never9(params) {
53973
55327
  return _never2(ZodNever, params);
@@ -53975,42 +55329,82 @@ function never9(params) {
53975
55329
  var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
53976
55330
  $ZodArray.init(inst, def);
53977
55331
  ZodType.init(inst, def);
55332
+ inst._zod.processJSONSchema = (ctx, json4, params) => arrayProcessor(inst, ctx, json4, params);
53978
55333
  inst.element = def.element;
53979
- inst.min = (minLength2, params) => inst.check(_minLength(minLength2, params));
53980
- inst.nonempty = (params) => inst.check(_minLength(1, params));
53981
- inst.max = (maxLength2, params) => inst.check(_maxLength(maxLength2, params));
53982
- inst.length = (len, params) => inst.check(_length(len, params));
53983
- inst.unwrap = () => inst.element;
55334
+ _installLazyMethods(inst, "ZodArray", {
55335
+ min(n, params) {
55336
+ return this.check(_minLength(n, params));
55337
+ },
55338
+ nonempty(params) {
55339
+ return this.check(_minLength(1, params));
55340
+ },
55341
+ max(n, params) {
55342
+ return this.check(_maxLength(n, params));
55343
+ },
55344
+ length(n, params) {
55345
+ return this.check(_length(n, params));
55346
+ },
55347
+ unwrap() {
55348
+ return this.element;
55349
+ }
55350
+ });
53984
55351
  });
53985
55352
  function array8(element2, params) {
53986
55353
  return _array(ZodArray, element2, params);
53987
55354
  }
53988
55355
  var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
53989
- $ZodObject.init(inst, def);
55356
+ $ZodObjectJIT.init(inst, def);
53990
55357
  ZodType.init(inst, def);
53991
- exports_util2.defineLazy(inst, "shape", () => def.shape);
53992
- inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
53993
- inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
53994
- inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
53995
- inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
53996
- inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never9() });
53997
- inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
53998
- inst.extend = (incoming) => {
53999
- return exports_util2.extend(inst, incoming);
54000
- };
54001
- inst.merge = (other) => exports_util2.merge(inst, other);
54002
- inst.pick = (mask) => exports_util2.pick(inst, mask);
54003
- inst.omit = (mask) => exports_util2.omit(inst, mask);
54004
- inst.partial = (...args2) => exports_util2.partial(ZodOptional, inst, args2[0]);
54005
- inst.required = (...args2) => exports_util2.required(ZodNonOptional, inst, args2[0]);
55358
+ inst._zod.processJSONSchema = (ctx, json4, params) => objectProcessor(inst, ctx, json4, params);
55359
+ exports_util2.defineLazy(inst, "shape", () => {
55360
+ return def.shape;
55361
+ });
55362
+ _installLazyMethods(inst, "ZodObject", {
55363
+ keyof() {
55364
+ return _enum(Object.keys(this._zod.def.shape));
55365
+ },
55366
+ catchall(catchall) {
55367
+ return this.clone({ ...this._zod.def, catchall });
55368
+ },
55369
+ passthrough() {
55370
+ return this.clone({ ...this._zod.def, catchall: unknown() });
55371
+ },
55372
+ loose() {
55373
+ return this.clone({ ...this._zod.def, catchall: unknown() });
55374
+ },
55375
+ strict() {
55376
+ return this.clone({ ...this._zod.def, catchall: never9() });
55377
+ },
55378
+ strip() {
55379
+ return this.clone({ ...this._zod.def, catchall: undefined });
55380
+ },
55381
+ extend(incoming) {
55382
+ return exports_util2.extend(this, incoming);
55383
+ },
55384
+ safeExtend(incoming) {
55385
+ return exports_util2.safeExtend(this, incoming);
55386
+ },
55387
+ merge(other) {
55388
+ return exports_util2.merge(this, other);
55389
+ },
55390
+ pick(mask) {
55391
+ return exports_util2.pick(this, mask);
55392
+ },
55393
+ omit(mask) {
55394
+ return exports_util2.omit(this, mask);
55395
+ },
55396
+ partial(...args2) {
55397
+ return exports_util2.partial(ZodOptional, this, args2[0]);
55398
+ },
55399
+ required(...args2) {
55400
+ return exports_util2.required(ZodNonOptional, this, args2[0]);
55401
+ }
55402
+ });
54006
55403
  });
54007
55404
  function object(shape, params) {
54008
55405
  const def = {
54009
55406
  type: "object",
54010
- get shape() {
54011
- exports_util2.assignProp(this, "shape", { ...shape });
54012
- return this.shape;
54013
- },
55407
+ shape: shape ?? {},
54014
55408
  ...exports_util2.normalizeParams(params)
54015
55409
  };
54016
55410
  return new ZodObject(def);
@@ -54018,10 +55412,7 @@ function object(shape, params) {
54018
55412
  function looseObject(shape, params) {
54019
55413
  return new ZodObject({
54020
55414
  type: "object",
54021
- get shape() {
54022
- exports_util2.assignProp(this, "shape", { ...shape });
54023
- return this.shape;
54024
- },
55415
+ shape,
54025
55416
  catchall: unknown(),
54026
55417
  ...exports_util2.normalizeParams(params)
54027
55418
  });
@@ -54029,6 +55420,7 @@ function looseObject(shape, params) {
54029
55420
  var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
54030
55421
  $ZodUnion.init(inst, def);
54031
55422
  ZodType.init(inst, def);
55423
+ inst._zod.processJSONSchema = (ctx, json4, params) => unionProcessor(inst, ctx, json4, params);
54032
55424
  inst.options = def.options;
54033
55425
  });
54034
55426
  function union14(options5, params) {
@@ -54053,6 +55445,7 @@ function discriminatedUnion(discriminator3, options5, params) {
54053
55445
  var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
54054
55446
  $ZodIntersection.init(inst, def);
54055
55447
  ZodType.init(inst, def);
55448
+ inst._zod.processJSONSchema = (ctx, json4, params) => intersectionProcessor(inst, ctx, json4, params);
54056
55449
  });
54057
55450
  function intersection7(left3, right3) {
54058
55451
  return new ZodIntersection({
@@ -54064,10 +55457,19 @@ function intersection7(left3, right3) {
54064
55457
  var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
54065
55458
  $ZodRecord.init(inst, def);
54066
55459
  ZodType.init(inst, def);
55460
+ inst._zod.processJSONSchema = (ctx, json4, params) => recordProcessor(inst, ctx, json4, params);
54067
55461
  inst.keyType = def.keyType;
54068
55462
  inst.valueType = def.valueType;
54069
55463
  });
54070
55464
  function record3(keyType, valueType, params) {
55465
+ if (!valueType || !valueType._zod) {
55466
+ return new ZodRecord({
55467
+ type: "record",
55468
+ keyType: string10(),
55469
+ valueType: keyType,
55470
+ ...exports_util2.normalizeParams(valueType)
55471
+ });
55472
+ }
54071
55473
  return new ZodRecord({
54072
55474
  type: "record",
54073
55475
  keyType,
@@ -54078,6 +55480,7 @@ function record3(keyType, valueType, params) {
54078
55480
  var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
54079
55481
  $ZodEnum.init(inst, def);
54080
55482
  ZodType.init(inst, def);
55483
+ inst._zod.processJSONSchema = (ctx, json4, params) => enumProcessor(inst, ctx, json4, params);
54081
55484
  inst.enum = def.entries;
54082
55485
  inst.options = Object.values(def.entries);
54083
55486
  const keys6 = new Set(Object.keys(def.entries));
@@ -54123,6 +55526,7 @@ function _enum(values7, params) {
54123
55526
  var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
54124
55527
  $ZodLiteral.init(inst, def);
54125
55528
  ZodType.init(inst, def);
55529
+ inst._zod.processJSONSchema = (ctx, json4, params) => literalProcessor(inst, ctx, json4, params);
54126
55530
  inst.values = new Set(def.values);
54127
55531
  Object.defineProperty(inst, "value", {
54128
55532
  get() {
@@ -54143,7 +55547,11 @@ function literal3(value5, params) {
54143
55547
  var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
54144
55548
  $ZodTransform.init(inst, def);
54145
55549
  ZodType.init(inst, def);
55550
+ inst._zod.processJSONSchema = (ctx, json4, params) => transformProcessor(inst, ctx, json4, params);
54146
55551
  inst._zod.parse = (payload, _ctx) => {
55552
+ if (_ctx.direction === "backward") {
55553
+ throw new $ZodEncodeError(inst.constructor.name);
55554
+ }
54147
55555
  payload.addIssue = (issue2) => {
54148
55556
  if (typeof issue2 === "string") {
54149
55557
  payload.issues.push(exports_util2.issue(issue2, payload.value, def));
@@ -54154,7 +55562,6 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
54154
55562
  _issue.code ?? (_issue.code = "custom");
54155
55563
  _issue.input ?? (_issue.input = payload.value);
54156
55564
  _issue.inst ?? (_issue.inst = inst);
54157
- _issue.continue ?? (_issue.continue = true);
54158
55565
  payload.issues.push(exports_util2.issue(_issue));
54159
55566
  }
54160
55567
  };
@@ -54162,10 +55569,12 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
54162
55569
  if (output instanceof Promise) {
54163
55570
  return output.then((output2) => {
54164
55571
  payload.value = output2;
55572
+ payload.fallback = true;
54165
55573
  return payload;
54166
55574
  });
54167
55575
  }
54168
55576
  payload.value = output;
55577
+ payload.fallback = true;
54169
55578
  return payload;
54170
55579
  };
54171
55580
  });
@@ -54178,6 +55587,7 @@ function transform5(fn2) {
54178
55587
  var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
54179
55588
  $ZodOptional.init(inst, def);
54180
55589
  ZodType.init(inst, def);
55590
+ inst._zod.processJSONSchema = (ctx, json4, params) => optionalProcessor(inst, ctx, json4, params);
54181
55591
  inst.unwrap = () => inst._zod.def.innerType;
54182
55592
  });
54183
55593
  function optional2(innerType) {
@@ -54186,9 +55596,22 @@ function optional2(innerType) {
54186
55596
  innerType
54187
55597
  });
54188
55598
  }
55599
+ var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
55600
+ $ZodExactOptional.init(inst, def);
55601
+ ZodType.init(inst, def);
55602
+ inst._zod.processJSONSchema = (ctx, json4, params) => optionalProcessor(inst, ctx, json4, params);
55603
+ inst.unwrap = () => inst._zod.def.innerType;
55604
+ });
55605
+ function exactOptional(innerType) {
55606
+ return new ZodExactOptional({
55607
+ type: "optional",
55608
+ innerType
55609
+ });
55610
+ }
54189
55611
  var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
54190
55612
  $ZodNullable.init(inst, def);
54191
55613
  ZodType.init(inst, def);
55614
+ inst._zod.processJSONSchema = (ctx, json4, params) => nullableProcessor(inst, ctx, json4, params);
54192
55615
  inst.unwrap = () => inst._zod.def.innerType;
54193
55616
  });
54194
55617
  function nullable(innerType) {
@@ -54200,6 +55623,7 @@ function nullable(innerType) {
54200
55623
  var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
54201
55624
  $ZodDefault.init(inst, def);
54202
55625
  ZodType.init(inst, def);
55626
+ inst._zod.processJSONSchema = (ctx, json4, params) => defaultProcessor(inst, ctx, json4, params);
54203
55627
  inst.unwrap = () => inst._zod.def.innerType;
54204
55628
  inst.removeDefault = inst.unwrap;
54205
55629
  });
@@ -54208,13 +55632,14 @@ function _default(innerType, defaultValue) {
54208
55632
  type: "default",
54209
55633
  innerType,
54210
55634
  get defaultValue() {
54211
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
55635
+ return typeof defaultValue === "function" ? defaultValue() : exports_util2.shallowClone(defaultValue);
54212
55636
  }
54213
55637
  });
54214
55638
  }
54215
55639
  var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
54216
55640
  $ZodPrefault.init(inst, def);
54217
55641
  ZodType.init(inst, def);
55642
+ inst._zod.processJSONSchema = (ctx, json4, params) => prefaultProcessor(inst, ctx, json4, params);
54218
55643
  inst.unwrap = () => inst._zod.def.innerType;
54219
55644
  });
54220
55645
  function prefault(innerType, defaultValue) {
@@ -54222,13 +55647,14 @@ function prefault(innerType, defaultValue) {
54222
55647
  type: "prefault",
54223
55648
  innerType,
54224
55649
  get defaultValue() {
54225
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
55650
+ return typeof defaultValue === "function" ? defaultValue() : exports_util2.shallowClone(defaultValue);
54226
55651
  }
54227
55652
  });
54228
55653
  }
54229
55654
  var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
54230
55655
  $ZodNonOptional.init(inst, def);
54231
55656
  ZodType.init(inst, def);
55657
+ inst._zod.processJSONSchema = (ctx, json4, params) => nonoptionalProcessor(inst, ctx, json4, params);
54232
55658
  inst.unwrap = () => inst._zod.def.innerType;
54233
55659
  });
54234
55660
  function nonoptional(innerType, params) {
@@ -54241,6 +55667,7 @@ function nonoptional(innerType, params) {
54241
55667
  var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
54242
55668
  $ZodCatch.init(inst, def);
54243
55669
  ZodType.init(inst, def);
55670
+ inst._zod.processJSONSchema = (ctx, json4, params) => catchProcessor(inst, ctx, json4, params);
54244
55671
  inst.unwrap = () => inst._zod.def.innerType;
54245
55672
  inst.removeCatch = inst.unwrap;
54246
55673
  });
@@ -54254,6 +55681,7 @@ function _catch3(innerType, catchValue) {
54254
55681
  var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
54255
55682
  $ZodPipe.init(inst, def);
54256
55683
  ZodType.init(inst, def);
55684
+ inst._zod.processJSONSchema = (ctx, json4, params) => pipeProcessor(inst, ctx, json4, params);
54257
55685
  inst.in = def.in;
54258
55686
  inst.out = def.out;
54259
55687
  });
@@ -54264,9 +55692,15 @@ function pipe3(in_, out) {
54264
55692
  out
54265
55693
  });
54266
55694
  }
55695
+ var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
55696
+ ZodPipe.init(inst, def);
55697
+ $ZodPreprocess.init(inst, def);
55698
+ });
54267
55699
  var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
54268
55700
  $ZodReadonly.init(inst, def);
54269
55701
  ZodType.init(inst, def);
55702
+ inst._zod.processJSONSchema = (ctx, json4, params) => readonlyProcessor(inst, ctx, json4, params);
55703
+ inst.unwrap = () => inst._zod.def.innerType;
54270
55704
  });
54271
55705
  function readonly(innerType) {
54272
55706
  return new ZodReadonly({
@@ -54277,44 +55711,25 @@ function readonly(innerType) {
54277
55711
  var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
54278
55712
  $ZodCustom.init(inst, def);
54279
55713
  ZodType.init(inst, def);
55714
+ inst._zod.processJSONSchema = (ctx, json4, params) => customProcessor(inst, ctx, json4, params);
54280
55715
  });
54281
- function check3(fn2) {
54282
- const ch = new $ZodCheck({
54283
- check: "custom"
54284
- });
54285
- ch._zod.check = fn2;
54286
- return ch;
54287
- }
54288
55716
  function custom3(fn2, _params) {
54289
55717
  return _custom(ZodCustom, fn2 ?? (() => true), _params);
54290
55718
  }
54291
55719
  function refine(fn2, _params = {}) {
54292
55720
  return _refine(ZodCustom, fn2, _params);
54293
55721
  }
54294
- function superRefine(fn2) {
54295
- const ch = check3((payload) => {
54296
- payload.addIssue = (issue2) => {
54297
- if (typeof issue2 === "string") {
54298
- payload.issues.push(exports_util2.issue(issue2, payload.value, ch._zod.def));
54299
- } else {
54300
- const _issue = issue2;
54301
- if (_issue.fatal)
54302
- _issue.continue = false;
54303
- _issue.code ?? (_issue.code = "custom");
54304
- _issue.input ?? (_issue.input = payload.value);
54305
- _issue.inst ?? (_issue.inst = ch);
54306
- _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
54307
- payload.issues.push(exports_util2.issue(_issue));
54308
- }
54309
- };
54310
- return fn2(payload.value, payload);
54311
- });
54312
- return ch;
55722
+ function superRefine(fn2, params) {
55723
+ return _superRefine(fn2, params);
54313
55724
  }
54314
55725
  function preprocess(fn2, schema) {
54315
- return pipe3(transform5(fn2), schema);
55726
+ return new ZodPreprocess({
55727
+ type: "pipe",
55728
+ in: transform5(fn2),
55729
+ out: schema
55730
+ });
54316
55731
  }
54317
- // node_modules/.bun/zod@3.25.76/node_modules/zod/v4/classic/external.js
55732
+ // node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/external.js
54318
55733
  config2(en_default());
54319
55734
 
54320
55735
  // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
@@ -55184,7 +56599,7 @@ function serializeMessage(message) {
55184
56599
 
55185
56600
  // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
55186
56601
  class StdioServerTransport {
55187
- constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
56602
+ constructor(_stdin = process3.stdin, _stdout = process3.stdout) {
55188
56603
  this._stdin = _stdin;
55189
56604
  this._stdout = _stdout;
55190
56605
  this._readBuffer = new ReadBuffer;
@@ -55343,8 +56758,8 @@ var renderConfigError = (error2) => {
55343
56758
  return walk(error2);
55344
56759
  };
55345
56760
  var requiredBrand = (key, schema, brand2) => {
55346
- const decode7 = exports_ParseResult.decodeUnknownEither(schema);
55347
- return exports_Config.string(key).pipe(rejectPlaceholder(key), exports_Config.mapOrFail((value5) => decode7(value5).pipe(exports_Either.mapBoth({
56761
+ const decode8 = exports_ParseResult.decodeUnknownEither(schema);
56762
+ return exports_Config.string(key).pipe(rejectPlaceholder(key), exports_Config.mapOrFail((value5) => decode8(value5).pipe(exports_Either.mapBoth({
55348
56763
  onLeft: (issue2) => exports_ConfigError.InvalidData([key], exports_ParseResult.TreeFormatter.formatIssueSync(issue2)),
55349
56764
  onRight: brand2
55350
56765
  }))));
@@ -55385,10 +56800,10 @@ var optionalBotName = (key) => optionalNonEmpty(key).pipe(exports_Config.mapOrFa
55385
56800
  onSome: (raw3) => exports_Either.fromOption(parseBotName(raw3), () => exports_ConfigError.InvalidData([key], `${key} must be substrate-safe (lowercase ASCII, digits, dashes, underscores; starts with letter; max 40 chars) — received: ${raw3}`)).pipe(exports_Either.map(exports_Option.some))
55386
56801
  })));
55387
56802
  var optionalApiKey = (key) => {
55388
- const decode7 = exports_ParseResult.decodeUnknownEither(apiKeySchema);
56803
+ const decode8 = exports_ParseResult.decodeUnknownEither(apiKeySchema);
55389
56804
  return optionalNonEmpty(key).pipe(exports_Config.mapOrFail((option7) => exports_Option.match(option7, {
55390
56805
  onNone: () => exports_Either.right(exports_Option.none()),
55391
- onSome: (raw3) => decode7(raw3).pipe(exports_Either.mapBoth({
56806
+ onSome: (raw3) => decode8(raw3).pipe(exports_Either.mapBoth({
55392
56807
  onLeft: (issue2) => exports_ConfigError.InvalidData([key], exports_ParseResult.TreeFormatter.formatIssueSync(issue2)),
55393
56808
  onRight: (value5) => exports_Option.some(exports_Redacted.make(value5))
55394
56809
  }))
@@ -55510,7 +56925,7 @@ var formatMessage = (event, botIdentityId) => {
55510
56925
  const sender = msg.sender;
55511
56926
  const mentionNames = exports_Array.map(msg.mentions, (m) => safeAttr(m.name));
55512
56927
  const mentioned = botIdentityId !== undefined && msg.mentions.some((m) => m.id === botIdentityId) ? "true" : undefined;
55513
- const meta = buildMeta([
56928
+ const meta2 = buildMeta([
55514
56929
  ["channel_id", ref.channel.id],
55515
56930
  ["channel_name", ref.channel.name],
55516
56931
  ["thread", ref.thread?.name],
@@ -55527,12 +56942,12 @@ var formatMessage = (event, botIdentityId) => {
55527
56942
  ]);
55528
56943
  return {
55529
56944
  content: msg.body,
55530
- meta: mentionNames.length > 0 ? { ...meta, mentions: mentionNames.join(";") } : meta
56945
+ meta: mentionNames.length > 0 ? { ...meta2, mentions: mentionNames.join(";") } : meta2
55531
56946
  };
55532
56947
  };
55533
56948
  var formatReaction = (event, observedAt) => {
55534
56949
  const action = event.kind === "reaction-added" ? "add" : "remove";
55535
- const meta = buildMeta([
56950
+ const meta2 = buildMeta([
55536
56951
  ["target_message_id", event.target.id],
55537
56952
  ["target_channel_name", event.target.channel.name],
55538
56953
  ["target_thread", event.target.thread?.name],
@@ -55544,12 +56959,12 @@ var formatReaction = (event, observedAt) => {
55544
56959
  ["by_kind", event.by.kind],
55545
56960
  ["ts", String(observedAt)]
55546
56961
  ]);
55547
- return { content: `[reaction ${action}] ${event.emoji}`, meta };
56962
+ return { content: `[reaction ${action}] ${event.emoji}`, meta: meta2 };
55548
56963
  };
55549
56964
  var formatError2 = (kind, message) => {
55550
56965
  const resolvedKind = exports_String.isEmpty(kind) ? "unknown" : kind;
55551
- const meta = buildMeta([["error_kind", resolvedKind]]);
55552
- return { content: message, meta };
56966
+ const meta2 = buildMeta([["error_kind", resolvedKind]]);
56967
+ return { content: message, meta: meta2 };
55553
56968
  };
55554
56969
 
55555
56970
  // packages/mcp/mentions-catch-up.ts
@@ -55756,7 +57171,7 @@ var startEventPump = (deps) => exports_Effect.gen(function* () {
55756
57171
  });
55757
57172
  var channelNotifier = (mcp) => (payload) => {
55758
57173
  const machineFrame = { content: payload.content, meta: payload.meta };
55759
- const displayMeta = exports_Array.reduce(IDENTITY_ID_META_KEYS, payload.meta, (meta, key) => exports_Record.remove(meta, key));
57174
+ const displayMeta = exports_Array.reduce(IDENTITY_ID_META_KEYS, payload.meta, (meta2, key) => exports_Record.remove(meta2, key));
55760
57175
  const displayFrame = { content: payload.content, meta: displayMeta };
55761
57176
  return Promise.all([
55762
57177
  mcp.notification({ method: "notifications/claude/channel", params: displayFrame }),
@@ -55795,11 +57210,11 @@ var createEphemeralIdentityCache = (deps) => exports_Effect.map(exports_Synchron
55795
57210
  sessionId,
55796
57211
  ...project3 !== undefined ? { project: project3 } : {}
55797
57212
  });
55798
- const wrapWithOnAcquire = (project3) => (n) => deps.acquire(n).pipe(exports_Effect.tap((acquired) => deps.onAcquire !== undefined ? deps.onAcquire(acquired, project3) : exports_Effect.void));
55799
- const acquireForTransition = (priorEnsure, project3) => (n) => priorEnsure.current() !== undefined ? deps.release().pipe(exports_Effect.zipRight(wrapWithOnAcquire(project3)(n))) : wrapWithOnAcquire(project3)(n);
57213
+ const wrapWithOnAcquire = (project3, sessionId) => (n) => deps.acquire(n).pipe(exports_Effect.tap((acquired) => deps.onAcquire !== undefined ? deps.onAcquire(acquired, project3, sessionId) : exports_Effect.void));
57214
+ const acquireForTransition = (priorEnsure, project3, sessionId) => (n) => priorEnsure.current() !== undefined ? deps.release().pipe(exports_Effect.zipRight(wrapWithOnAcquire(project3, sessionId)(n))) : wrapWithOnAcquire(project3, sessionId)(n);
55800
57215
  const mintSlot = (sessionId, project3, nowMs, prior) => {
55801
57216
  const name = deriveBotName(sessionId, project3);
55802
- const acquire = prior !== undefined ? acquireForTransition(prior.ensureBound, project3) : wrapWithOnAcquire(project3);
57217
+ const acquire = prior !== undefined ? acquireForTransition(prior.ensureBound, project3, sessionId) : wrapWithOnAcquire(project3, sessionId);
55803
57218
  return createEnsureBound({ acquire, name }).pipe(exports_Effect.map((ensureBound) => [ensureBound, { sessionId, ensureBound, lastUsedMs: nowMs }]));
55804
57219
  };
55805
57220
  const releaseBoundSlot = exports_SynchronizedRef.updateEffect(slotRef, (slot) => exports_Effect.as(slot !== undefined && slot.ensureBound.current() !== undefined ? deps.release() : exports_Effect.void, undefined));
@@ -55890,9 +57305,9 @@ function isTerminal(status3) {
55890
57305
  return status3 === "completed" || status3 === "failed" || status3 === "cancelled";
55891
57306
  }
55892
57307
 
55893
- // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Options.js
57308
+ // node_modules/.bun/zod-to-json-schema@3.25.2+68a1e3a0c4588df3/node_modules/zod-to-json-schema/dist/esm/Options.js
55894
57309
  var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
55895
- // node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
57310
+ // node_modules/.bun/zod-to-json-schema@3.25.2+68a1e3a0c4588df3/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
55896
57311
  var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
55897
57312
  // node_modules/.bun/@modelcontextprotocol+sdk@1.29.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
55898
57313
  function getMethodLiteral(schema) {
@@ -57243,7 +58658,7 @@ class Server extends Protocol {
57243
58658
  }
57244
58659
 
57245
58660
  // packages/mcp/mcp-server.ts
57246
- var PLUGIN_VERSION = "0.14.2";
58661
+ var PLUGIN_VERSION = "0.15.0";
57247
58662
  var COMMY_INSTRUCTIONS = `**Substrate.** commy is the inter-agent channel: agents and humans coordinate here. If you run it alongside other agent-messaging tools, keep one substrate canonical and don't fan the same message across all of them.
57248
58663
 
57249
58664
  **Channels.** Each project has one channel: \`#<project-slug>\` where the slug is resolved per session as \`COMMY_PROJECT\` env > git remote \`origin\` basename > git root basename. Sessions launched outside a git repo (e.g. \`/tmp\`, \`$HOME\`) have no project channel and should post to \`#general\` instead. Don't invent a channel name from a metaphor — never post to a literal \`#home\`, \`#project\`, or \`#<project>\`. Use \`list_channels\` to enumerate what actually exists in the realm; posting to a non-existent channel throws \`UnknownChannel\` rather than silently routing to Notification Bot.
@@ -57279,6 +58694,19 @@ var intentKey = (intent) => exports_Match.value(intent).pipe(exports_Match.discr
57279
58694
  thread: (i) => threadKeyOf(i.channelName, i.threadName),
57280
58695
  "new-topics-in-channel": (i) => newTopicsKeyOf(i.channelName)
57281
58696
  }));
58697
+ var keyToIntent = (key) => exports_Match.value(key).pipe(exports_Match.discriminatorsExhaustive("kind")({
58698
+ mentions: () => ({ kind: "mentions" }),
58699
+ channel: (k) => ({ kind: "channel", channelName: k.channelName }),
58700
+ thread: (k) => ({
58701
+ kind: "thread",
58702
+ channelName: k.channelName,
58703
+ threadName: k.threadName
58704
+ }),
58705
+ "new-topics": (k) => ({
58706
+ kind: "new-topics-in-channel",
58707
+ channelName: k.channelName
58708
+ })
58709
+ }));
57282
58710
  var channelKey = (ref) => channelKeyOf(ref.channel.name);
57283
58711
  var newTopicsKey = (ref) => newTopicsKeyOf(ref.channel.name);
57284
58712
  var threadKey = (ref) => exports_Option.fromNullable(ref.thread).pipe(exports_Option.map((thread) => threadKeyOf(ref.channel.name, thread.name)));
@@ -57313,6 +58741,10 @@ var createNarrowSet = () => {
57313
58741
  intents = exports_HashSet.remove(intents, intentKey(intent));
57314
58742
  },
57315
58743
  size: () => exports_HashSet.size(intents),
58744
+ intents: () => exports_Array.fromIterable(intents).map(keyToIntent),
58745
+ replace: (next4) => {
58746
+ intents = exports_HashSet.fromIterable(next4.map(intentKey));
58747
+ },
57316
58748
  matches: (event, botIdentityId) => exports_Match.value(event).pipe(exports_Match.discriminatorsExhaustive("kind")({
57317
58749
  "message-posted": (e) => messagePostedMatches(e.message.ref) || mentionsMatches(intents, e.message.mentions, botIdentityId),
57318
58750
  "mention-received": (e) => refMatches(e.message.ref, intents) || mentionsMatches(intents, e.mentions, botIdentityId),
@@ -57326,6 +58758,45 @@ var createNarrowSet = () => {
57326
58758
  var DEFAULT_TIMEOUT_MS = 5000;
57327
58759
  var raceReleaseAgainstTimeout = (release, timeoutMs = DEFAULT_TIMEOUT_MS) => release.pipe(exports_Effect.tapDefect((cause3) => exports_Effect.logError(`release failed: ${exports_Cause.pretty(cause3)}`)), exports_Effect.catchAllDefect(() => exports_Effect.void), exports_Effect.timeoutOption(exports_Duration.millis(timeoutMs)), exports_Effect.flatMap((result) => exports_Option.isNone(result) ? exports_Effect.logError(`release timed out after ${timeoutMs}ms`) : exports_Effect.void));
57328
58760
 
58761
+ // packages/mcp/subscription-restore.ts
58762
+ var applyRestored = (deps, intents) => exports_Effect.sync(() => deps.narrowSet.replace(intents)).pipe(exports_Effect.zipRight(exports_Effect.forEach(intents, (intent) => intentToTarget(intent).pipe(exports_Effect.flatMap(deps.inbox.subscribe)), { discard: true })));
58763
+ var restoreOrSeedSubscriptions = (deps, sessionId, project3) => deps.subscriptionStore.read(sessionId).pipe(exports_Effect.flatMap(exports_Option.match({
58764
+ onNone: () => deps.registerDefaults(project3),
58765
+ onSome: (intents) => applyRestored(deps, intents)
58766
+ })));
58767
+ var persistSubscriptions = (store, narrowSet, sessionId) => store.write(sessionId, narrowSet.intents());
58768
+
58769
+ // packages/mcp/subscription-store.ts
58770
+ import { homedir as homedir2 } from "node:os";
58771
+ import { join as join8 } from "node:path";
58772
+ class SubscriptionStoreTag extends exports_Context.Tag("SubscriptionStore")() {
58773
+ }
58774
+ var SubscribeIntentSchema = exports_Schema.Union(exports_Schema.Struct({ kind: exports_Schema.Literal("mentions") }), exports_Schema.Struct({ kind: exports_Schema.Literal("channel"), channelName: ChannelNameSchema }), exports_Schema.Struct({
58775
+ kind: exports_Schema.Literal("thread"),
58776
+ channelName: ChannelNameSchema,
58777
+ threadName: ThreadNameSchema
58778
+ }), exports_Schema.Struct({ kind: exports_Schema.Literal("new-topics-in-channel"), channelName: ChannelNameSchema }));
58779
+ var SubscriptionsFileSchema = exports_Schema.parseJson(exports_Schema.Array(SubscribeIntentSchema));
58780
+ var decodeSubscriptionsFile = exports_Schema.decodeUnknown(SubscriptionsFileSchema);
58781
+ var FILENAME_SAFE2 = /[^a-zA-Z0-9._-]/g;
58782
+ var subscriptionFilename = (id3) => {
58783
+ const safe = id3.replace(FILENAME_SAFE2, "_");
58784
+ return `${safe}.json`;
58785
+ };
58786
+ var isNotFound2 = (error2) => error2._tag === "SystemError" && error2.reason === "NotFound";
58787
+ var readSubscriptions = (fs, path) => fs.readFileString(path).pipe(exports_Effect.flatMap(decodeSubscriptionsFile), exports_Effect.map((intents) => exports_Option.some(intents)), exports_Effect.catchIf(isNotFound2, () => exports_Effect.succeed(exports_Option.none())));
58788
+ var createFileSubscriptionStore = (deps) => {
58789
+ const { dir, fs } = deps;
58790
+ const pathFor = (id3) => join8(dir, subscriptionFilename(id3));
58791
+ const read3 = (id3) => readSubscriptions(fs, pathFor(id3));
58792
+ const write4 = (id3, intents) => fs.makeDirectory(dir, { recursive: true }).pipe(exports_Effect.zipRight(fs.writeFileString(pathFor(id3), JSON.stringify(intents))));
58793
+ return { read: read3, write: write4 };
58794
+ };
58795
+ var STATE_SEGMENT2 = "commy";
58796
+ var stateBaseConfig2 = exports_Config.nonEmptyString("XDG_STATE_HOME").pipe(exports_Config.withDefault(join8(homedir2(), ".local", "state")));
58797
+ var subscriptionDirConfig = stateBaseConfig2.pipe(exports_Config.map((base) => join8(base, STATE_SEGMENT2, "subscriptions")));
58798
+ var FileSubscriptionStoreLive = exports_Layer.effect(SubscriptionStoreTag, exports_Effect.all([exports_FileSystem.FileSystem, exports_Effect.orDie(subscriptionDirConfig)]).pipe(exports_Effect.map(([fs, dir]) => createFileSubscriptionStore({ dir, fs }))));
58799
+
57329
58800
  // packages/mcp/tools.ts
57330
58801
  var emptyObjectSchema = {
57331
58802
  type: "object",
@@ -57760,7 +59231,9 @@ var buildToolDefs = (deps, cache) => {
57760
59231
  target: {
57761
59232
  type: "string",
57762
59233
  description: 'Subscribe-target token: "channel:<name>", "thread:<channel>/<thread>", "new-topics:<channel>", or "mentions"'
57763
- }
59234
+ },
59235
+ session_id: sessionIdField,
59236
+ cwd: cwdField
57764
59237
  },
57765
59238
  required: ["target"],
57766
59239
  additionalProperties: false
@@ -57769,9 +59242,16 @@ var buildToolDefs = (deps, cache) => {
57769
59242
  await runEdge(exports_Effect.gen(function* () {
57770
59243
  const { target: raw3 } = yield* exports_Schema.decodeUnknown(SubscribeArgs)(args2);
57771
59244
  const intent = yield* parseSubscribeTarget(raw3);
59245
+ const sessionId = readSessionId(args2);
59246
+ if (sessionId !== undefined && deps.ensureSessionSubscriptions !== undefined) {
59247
+ yield* deps.ensureSessionSubscriptions(sessionId, yield* projectForArgs(args2));
59248
+ }
57772
59249
  narrowSet.add(intent);
57773
59250
  const target = yield* intentToTarget(intent);
57774
59251
  yield* adapter4.inbox.subscribe(target);
59252
+ if (sessionId !== undefined && deps.persistSessionSubscriptions !== undefined) {
59253
+ yield* deps.persistSessionSubscriptions(sessionId);
59254
+ }
57775
59255
  }));
57776
59256
  return {};
57777
59257
  }
@@ -57785,7 +59265,9 @@ var buildToolDefs = (deps, cache) => {
57785
59265
  target: {
57786
59266
  type: "string",
57787
59267
  description: 'Subscribe-target token: "channel:<name>", "thread:<channel>/<thread>", "new-topics:<channel>", or "mentions"'
57788
- }
59268
+ },
59269
+ session_id: sessionIdField,
59270
+ cwd: cwdField
57789
59271
  },
57790
59272
  required: ["target"],
57791
59273
  additionalProperties: false
@@ -57794,9 +59276,16 @@ var buildToolDefs = (deps, cache) => {
57794
59276
  await runEdge(exports_Effect.gen(function* () {
57795
59277
  const { target: raw3 } = yield* exports_Schema.decodeUnknown(SubscribeArgs)(args2);
57796
59278
  const intent = yield* parseSubscribeTarget(raw3);
59279
+ const sessionId = readSessionId(args2);
59280
+ if (sessionId !== undefined && deps.ensureSessionSubscriptions !== undefined) {
59281
+ yield* deps.ensureSessionSubscriptions(sessionId, yield* projectForArgs(args2));
59282
+ }
57797
59283
  narrowSet.remove(intent);
57798
59284
  const target = yield* intentToTarget(intent);
57799
59285
  yield* adapter4.inbox.unsubscribe(target);
59286
+ if (sessionId !== undefined && deps.persistSessionSubscriptions !== undefined) {
59287
+ yield* deps.persistSessionSubscriptions(sessionId);
59288
+ }
57800
59289
  }));
57801
59290
  return {};
57802
59291
  }
@@ -58027,7 +59516,7 @@ var forkIdleSweep = (cache, intervalMs) => {
58027
59516
  };
58028
59517
  var createType2DefaultsOnAcquire = (narrowSet, inbox) => {
58029
59518
  const registerIntent = (intent) => exports_Effect.sync(() => narrowSet.add(intent)).pipe(exports_Effect.zipRight(intentToTarget(intent).pipe(exports_Effect.flatMap((target) => inbox.subscribe(target)))));
58030
- return (_identity, project3) => registerIntent({ kind: "mentions" }).pipe(exports_Effect.zipRight(project3 !== undefined ? exports_Effect.all([decodeChannelName(project3), decodeThreadName("general")]).pipe(exports_Effect.flatMap(([channelName, threadName3]) => registerIntent({ kind: "thread", channelName, threadName: threadName3 }))) : exports_Effect.void), exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: Type-2 default narrow registration failed: ${exports_Cause.pretty(exports_Cause.fail(err))}`)));
59519
+ return (project3) => registerIntent({ kind: "mentions" }).pipe(exports_Effect.zipRight(project3 !== undefined ? exports_Effect.all([decodeChannelName(project3), decodeThreadName("general")]).pipe(exports_Effect.flatMap(([channelName, threadName3]) => registerIntent({ kind: "thread", channelName, threadName: threadName3 }))) : exports_Effect.void), exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: Type-2 default narrow registration failed: ${exports_Cause.pretty(exports_Cause.fail(err))}`)));
58031
59520
  };
58032
59521
  var logType1Failure = (err) => exports_Effect.logError(`commy plugin: Type-1 default narrow registration failed: ${exports_Cause.pretty(exports_Cause.fail(err))}`);
58033
59522
  var registerType1DefaultsOnBoot = (inbox, narrowSet, project3) => (project3 !== undefined ? exports_Effect.all([decodeChannelName(project3), decodeThreadName("general")]).pipe(exports_Effect.map(([channelName, threadName3]) => [
@@ -58054,6 +59543,7 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
58054
59543
  const parsed = yield* parseEnv;
58055
59544
  const adapter4 = yield* SubstrateAdapter;
58056
59545
  const cursorStore = yield* CursorStoreTag;
59546
+ const subscriptionStore = yield* SubscriptionStoreTag;
58057
59547
  const fs = yield* exports_FileSystem.FileSystem;
58058
59548
  const loggerLayer = params.loggerLayer ?? stderrLoggerLayer;
58059
59549
  const commandExecutor = yield* exports_CommandExecutor.CommandExecutor;
@@ -58079,7 +59569,16 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
58079
59569
  const mcp = buildMcpServer();
58080
59570
  const notifier = params.notifier ?? channelNotifier(mcp);
58081
59571
  const registerType2Defaults = parsed.botName === undefined ? createType2DefaultsOnAcquire(narrowSet, adapter4.inbox) : undefined;
58082
- const ephemeralOnAcquire = parsed.botName === undefined ? (acquired, project3) => (registerType2Defaults !== undefined ? registerType2Defaults(acquired, project3) : exports_Effect.void).pipe(exports_Effect.zipRight(catchUpMentions({
59572
+ const restoredSessions = yield* exports_SynchronizedRef.make(exports_HashSet.empty());
59573
+ const seedDefaults = (project3) => registerType2Defaults !== undefined ? registerType2Defaults(project3) : exports_Effect.void;
59574
+ const ensureSessionSubscriptions = (sessionId, project3) => parsed.botName !== undefined ? exports_Effect.void : exports_SynchronizedRef.updateEffect(restoredSessions, (seen) => exports_HashSet.has(seen, sessionId) ? exports_Effect.succeed(seen) : restoreOrSeedSubscriptions({
59575
+ subscriptionStore,
59576
+ narrowSet,
59577
+ inbox: adapter4.inbox,
59578
+ registerDefaults: seedDefaults
59579
+ }, sessionId, project3).pipe(exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: subscription restore failed for ${sessionId}: ${exports_Predicate.isError(err) ? err.message : String(err)}`).pipe(exports_Effect.zipRight(seedDefaults(project3)))), exports_Effect.provide(loggerLayer), exports_Effect.as(exports_HashSet.add(seen, sessionId))));
59580
+ const persistSessionSubscriptions = (sessionId) => parsed.botName !== undefined ? exports_Effect.void : persistSubscriptions(subscriptionStore, narrowSet, sessionId).pipe(exports_Effect.catchAll((err) => exports_Effect.logError(`commy plugin: subscription persist failed for ${sessionId}: ${exports_Predicate.isError(err) ? err.message : String(err)}`)), exports_Effect.provide(loggerLayer));
59581
+ const ephemeralOnAcquire = parsed.botName === undefined ? (acquired, project3, sessionId) => ensureSessionSubscriptions(sessionId, project3).pipe(exports_Effect.zipRight(catchUpMentions({
58083
59582
  cursorStore,
58084
59583
  inbox: adapter4.inbox,
58085
59584
  identityId: acquired.identity.id,
@@ -58107,10 +59606,12 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
58107
59606
  identityCache,
58108
59607
  narrowSet,
58109
59608
  projectForCwd,
59609
+ ensureSessionSubscriptions,
59610
+ persistSessionSubscriptions,
58110
59611
  downloadFile: (urlPath) => exports_Effect.gen(function* () {
58111
59612
  const result = yield* adapter4.downloadFile(urlPath);
58112
59613
  const dir = yield* fs.makeTempDirectory({ prefix: "commy-dl-" });
58113
- const filePath = join8(dir, basename2(urlPath));
59614
+ const filePath = join9(dir, basename2(urlPath));
58114
59615
  yield* fs.writeFile(filePath, result.data);
58115
59616
  return { filePath, contentType: result.contentType, size: result.data.byteLength };
58116
59617
  }),
@@ -58171,7 +59672,7 @@ var makeProgram = (params = {}) => exports_Effect.scoped(exports_Effect.gen(func
58171
59672
  }
58172
59673
  yield* exports_Effect.raceFirst(pump.done, params.shutdownSignal ?? exports_Effect.never);
58173
59674
  }));
58174
- var AppLayer = exports_Layer.mergeAll(ZulipAdapterLive, FileCursorStoreLive, stderrLoggerLayer);
59675
+ var AppLayer = exports_Layer.mergeAll(ZulipAdapterLive, FileCursorStoreLive, FileSubscriptionStoreLive, stderrLoggerLayer);
58175
59676
  var PlatformLive = exports_Layer.mergeAll(exports_Layer.setConfigProvider(exports_ConfigProvider.fromEnv()), exports_FetchHttpClient.layer, exports_NodeContext.layer);
58176
59677
  var MainLive = exports_Layer.provideMerge(AppLayer, PlatformLive);
58177
59678
  var clientDisconnect = (stdin3) => exports_Effect.async((resume2) => {