@chrischall/gemini-mcp 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -639,12 +639,12 @@ function isValidCidr(ip, version2) {
639
639
  }
640
640
  return false;
641
641
  }
642
- function floatSafeRemainder(val, step) {
642
+ function floatSafeRemainder(val, step2) {
643
643
  const valDecCount = (val.toString().split(".")[1] || "").length;
644
- const stepDecCount = (step.toString().split(".")[1] || "").length;
644
+ const stepDecCount = (step2.toString().split(".")[1] || "").length;
645
645
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
646
646
  const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
647
- const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
647
+ const stepInt = Number.parseInt(step2.toFixed(decCount).replace(".", ""));
648
648
  return valInt % stepInt / 10 ** decCount;
649
649
  }
650
650
  function deepPartialify(schema) {
@@ -4178,8 +4178,8 @@ function cleanRegex(source) {
4178
4178
  const end = source.endsWith("$") ? source.length - 1 : source.length;
4179
4179
  return source.slice(start, end);
4180
4180
  }
4181
- function floatSafeRemainder2(val, step) {
4182
- const ratio = val / step;
4181
+ function floatSafeRemainder2(val, step2) {
4182
+ const ratio = val / step2;
4183
4183
  const roundedRatio = Math.round(ratio);
4184
4184
  const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
4185
4185
  if (Math.abs(ratio - roundedRatio) < tolerance)
@@ -5174,9 +5174,9 @@ var init_regexes = __esm({
5174
5174
  });
5175
5175
 
5176
5176
  // node_modules/zod/v4/core/checks.js
5177
- function handleCheckPropertyResult(result, payload2, property) {
5177
+ function handleCheckPropertyResult(result, payload, property) {
5178
5178
  if (result.issues.length) {
5179
- payload2.issues.push(...prefixIssues(property, result.issues));
5179
+ payload.issues.push(...prefixIssues(property, result.issues));
5180
5180
  }
5181
5181
  }
5182
5182
  var $ZodCheck, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckNumberFormat, $ZodCheckBigIntFormat, $ZodCheckMaxSize, $ZodCheckMinSize, $ZodCheckSizeEquals, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckStringFormat, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckProperty, $ZodCheckMimeType, $ZodCheckOverwrite;
@@ -5209,15 +5209,15 @@ var init_checks = __esm({
5209
5209
  bag.exclusiveMaximum = def.value;
5210
5210
  }
5211
5211
  });
5212
- inst._zod.check = (payload2) => {
5213
- if (def.inclusive ? payload2.value <= def.value : payload2.value < def.value) {
5212
+ inst._zod.check = (payload) => {
5213
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
5214
5214
  return;
5215
5215
  }
5216
- payload2.issues.push({
5216
+ payload.issues.push({
5217
5217
  origin,
5218
5218
  code: "too_big",
5219
5219
  maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
5220
- input: payload2.value,
5220
+ input: payload.value,
5221
5221
  inclusive: def.inclusive,
5222
5222
  inst,
5223
5223
  continue: !def.abort
@@ -5237,15 +5237,15 @@ var init_checks = __esm({
5237
5237
  bag.exclusiveMinimum = def.value;
5238
5238
  }
5239
5239
  });
5240
- inst._zod.check = (payload2) => {
5241
- if (def.inclusive ? payload2.value >= def.value : payload2.value > def.value) {
5240
+ inst._zod.check = (payload) => {
5241
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
5242
5242
  return;
5243
5243
  }
5244
- payload2.issues.push({
5244
+ payload.issues.push({
5245
5245
  origin,
5246
5246
  code: "too_small",
5247
5247
  minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
5248
- input: payload2.value,
5248
+ input: payload.value,
5249
5249
  inclusive: def.inclusive,
5250
5250
  inst,
5251
5251
  continue: !def.abort
@@ -5258,17 +5258,17 @@ var init_checks = __esm({
5258
5258
  var _a3;
5259
5259
  (_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value);
5260
5260
  });
5261
- inst._zod.check = (payload2) => {
5262
- if (typeof payload2.value !== typeof def.value)
5261
+ inst._zod.check = (payload) => {
5262
+ if (typeof payload.value !== typeof def.value)
5263
5263
  throw new Error("Cannot mix number and bigint in multiple_of check.");
5264
- const isMultiple = typeof payload2.value === "bigint" ? payload2.value % def.value === BigInt(0) : floatSafeRemainder2(payload2.value, def.value) === 0;
5264
+ const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder2(payload.value, def.value) === 0;
5265
5265
  if (isMultiple)
5266
5266
  return;
5267
- payload2.issues.push({
5268
- origin: typeof payload2.value,
5267
+ payload.issues.push({
5268
+ origin: typeof payload.value,
5269
5269
  code: "not_multiple_of",
5270
5270
  divisor: def.value,
5271
- input: payload2.value,
5271
+ input: payload.value,
5272
5272
  inst,
5273
5273
  continue: !def.abort
5274
5274
  });
@@ -5288,11 +5288,11 @@ var init_checks = __esm({
5288
5288
  if (isInt)
5289
5289
  bag.pattern = integer;
5290
5290
  });
5291
- inst._zod.check = (payload2) => {
5292
- const input = payload2.value;
5291
+ inst._zod.check = (payload) => {
5292
+ const input = payload.value;
5293
5293
  if (isInt) {
5294
5294
  if (!Number.isInteger(input)) {
5295
- payload2.issues.push({
5295
+ payload.issues.push({
5296
5296
  expected: origin,
5297
5297
  format: def.format,
5298
5298
  code: "invalid_type",
@@ -5304,7 +5304,7 @@ var init_checks = __esm({
5304
5304
  }
5305
5305
  if (!Number.isSafeInteger(input)) {
5306
5306
  if (input > 0) {
5307
- payload2.issues.push({
5307
+ payload.issues.push({
5308
5308
  input,
5309
5309
  code: "too_big",
5310
5310
  maximum: Number.MAX_SAFE_INTEGER,
@@ -5315,7 +5315,7 @@ var init_checks = __esm({
5315
5315
  continue: !def.abort
5316
5316
  });
5317
5317
  } else {
5318
- payload2.issues.push({
5318
+ payload.issues.push({
5319
5319
  input,
5320
5320
  code: "too_small",
5321
5321
  minimum: Number.MIN_SAFE_INTEGER,
@@ -5330,7 +5330,7 @@ var init_checks = __esm({
5330
5330
  }
5331
5331
  }
5332
5332
  if (input < minimum) {
5333
- payload2.issues.push({
5333
+ payload.issues.push({
5334
5334
  origin: "number",
5335
5335
  input,
5336
5336
  code: "too_small",
@@ -5341,7 +5341,7 @@ var init_checks = __esm({
5341
5341
  });
5342
5342
  }
5343
5343
  if (input > maximum) {
5344
- payload2.issues.push({
5344
+ payload.issues.push({
5345
5345
  origin: "number",
5346
5346
  input,
5347
5347
  code: "too_big",
@@ -5362,10 +5362,10 @@ var init_checks = __esm({
5362
5362
  bag.minimum = minimum;
5363
5363
  bag.maximum = maximum;
5364
5364
  });
5365
- inst._zod.check = (payload2) => {
5366
- const input = payload2.value;
5365
+ inst._zod.check = (payload) => {
5366
+ const input = payload.value;
5367
5367
  if (input < minimum) {
5368
- payload2.issues.push({
5368
+ payload.issues.push({
5369
5369
  origin: "bigint",
5370
5370
  input,
5371
5371
  code: "too_small",
@@ -5376,7 +5376,7 @@ var init_checks = __esm({
5376
5376
  });
5377
5377
  }
5378
5378
  if (input > maximum) {
5379
- payload2.issues.push({
5379
+ payload.issues.push({
5380
5380
  origin: "bigint",
5381
5381
  input,
5382
5382
  code: "too_big",
@@ -5391,8 +5391,8 @@ var init_checks = __esm({
5391
5391
  $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
5392
5392
  var _a3;
5393
5393
  $ZodCheck.init(inst, def);
5394
- (_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
5395
- const val = payload2.value;
5394
+ (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
5395
+ const val = payload.value;
5396
5396
  return !nullish(val) && val.size !== void 0;
5397
5397
  });
5398
5398
  inst._zod.onattach.push((inst2) => {
@@ -5400,12 +5400,12 @@ var init_checks = __esm({
5400
5400
  if (def.maximum < curr)
5401
5401
  inst2._zod.bag.maximum = def.maximum;
5402
5402
  });
5403
- inst._zod.check = (payload2) => {
5404
- const input = payload2.value;
5403
+ inst._zod.check = (payload) => {
5404
+ const input = payload.value;
5405
5405
  const size = input.size;
5406
5406
  if (size <= def.maximum)
5407
5407
  return;
5408
- payload2.issues.push({
5408
+ payload.issues.push({
5409
5409
  origin: getSizableOrigin(input),
5410
5410
  code: "too_big",
5411
5411
  maximum: def.maximum,
@@ -5419,8 +5419,8 @@ var init_checks = __esm({
5419
5419
  $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
5420
5420
  var _a3;
5421
5421
  $ZodCheck.init(inst, def);
5422
- (_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
5423
- const val = payload2.value;
5422
+ (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
5423
+ const val = payload.value;
5424
5424
  return !nullish(val) && val.size !== void 0;
5425
5425
  });
5426
5426
  inst._zod.onattach.push((inst2) => {
@@ -5428,12 +5428,12 @@ var init_checks = __esm({
5428
5428
  if (def.minimum > curr)
5429
5429
  inst2._zod.bag.minimum = def.minimum;
5430
5430
  });
5431
- inst._zod.check = (payload2) => {
5432
- const input = payload2.value;
5431
+ inst._zod.check = (payload) => {
5432
+ const input = payload.value;
5433
5433
  const size = input.size;
5434
5434
  if (size >= def.minimum)
5435
5435
  return;
5436
- payload2.issues.push({
5436
+ payload.issues.push({
5437
5437
  origin: getSizableOrigin(input),
5438
5438
  code: "too_small",
5439
5439
  minimum: def.minimum,
@@ -5447,8 +5447,8 @@ var init_checks = __esm({
5447
5447
  $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
5448
5448
  var _a3;
5449
5449
  $ZodCheck.init(inst, def);
5450
- (_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
5451
- const val = payload2.value;
5450
+ (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
5451
+ const val = payload.value;
5452
5452
  return !nullish(val) && val.size !== void 0;
5453
5453
  });
5454
5454
  inst._zod.onattach.push((inst2) => {
@@ -5457,18 +5457,18 @@ var init_checks = __esm({
5457
5457
  bag.maximum = def.size;
5458
5458
  bag.size = def.size;
5459
5459
  });
5460
- inst._zod.check = (payload2) => {
5461
- const input = payload2.value;
5460
+ inst._zod.check = (payload) => {
5461
+ const input = payload.value;
5462
5462
  const size = input.size;
5463
5463
  if (size === def.size)
5464
5464
  return;
5465
5465
  const tooBig2 = size > def.size;
5466
- payload2.issues.push({
5466
+ payload.issues.push({
5467
5467
  origin: getSizableOrigin(input),
5468
5468
  ...tooBig2 ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
5469
5469
  inclusive: true,
5470
5470
  exact: true,
5471
- input: payload2.value,
5471
+ input: payload.value,
5472
5472
  inst,
5473
5473
  continue: !def.abort
5474
5474
  });
@@ -5477,8 +5477,8 @@ var init_checks = __esm({
5477
5477
  $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
5478
5478
  var _a3;
5479
5479
  $ZodCheck.init(inst, def);
5480
- (_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
5481
- const val = payload2.value;
5480
+ (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
5481
+ const val = payload.value;
5482
5482
  return !nullish(val) && val.length !== void 0;
5483
5483
  });
5484
5484
  inst._zod.onattach.push((inst2) => {
@@ -5486,13 +5486,13 @@ var init_checks = __esm({
5486
5486
  if (def.maximum < curr)
5487
5487
  inst2._zod.bag.maximum = def.maximum;
5488
5488
  });
5489
- inst._zod.check = (payload2) => {
5490
- const input = payload2.value;
5489
+ inst._zod.check = (payload) => {
5490
+ const input = payload.value;
5491
5491
  const length = input.length;
5492
5492
  if (length <= def.maximum)
5493
5493
  return;
5494
5494
  const origin = getLengthableOrigin(input);
5495
- payload2.issues.push({
5495
+ payload.issues.push({
5496
5496
  origin,
5497
5497
  code: "too_big",
5498
5498
  maximum: def.maximum,
@@ -5506,8 +5506,8 @@ var init_checks = __esm({
5506
5506
  $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
5507
5507
  var _a3;
5508
5508
  $ZodCheck.init(inst, def);
5509
- (_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
5510
- const val = payload2.value;
5509
+ (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
5510
+ const val = payload.value;
5511
5511
  return !nullish(val) && val.length !== void 0;
5512
5512
  });
5513
5513
  inst._zod.onattach.push((inst2) => {
@@ -5515,13 +5515,13 @@ var init_checks = __esm({
5515
5515
  if (def.minimum > curr)
5516
5516
  inst2._zod.bag.minimum = def.minimum;
5517
5517
  });
5518
- inst._zod.check = (payload2) => {
5519
- const input = payload2.value;
5518
+ inst._zod.check = (payload) => {
5519
+ const input = payload.value;
5520
5520
  const length = input.length;
5521
5521
  if (length >= def.minimum)
5522
5522
  return;
5523
5523
  const origin = getLengthableOrigin(input);
5524
- payload2.issues.push({
5524
+ payload.issues.push({
5525
5525
  origin,
5526
5526
  code: "too_small",
5527
5527
  minimum: def.minimum,
@@ -5535,8 +5535,8 @@ var init_checks = __esm({
5535
5535
  $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
5536
5536
  var _a3;
5537
5537
  $ZodCheck.init(inst, def);
5538
- (_a3 = inst._zod.def).when ?? (_a3.when = (payload2) => {
5539
- const val = payload2.value;
5538
+ (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
5539
+ const val = payload.value;
5540
5540
  return !nullish(val) && val.length !== void 0;
5541
5541
  });
5542
5542
  inst._zod.onattach.push((inst2) => {
@@ -5545,19 +5545,19 @@ var init_checks = __esm({
5545
5545
  bag.maximum = def.length;
5546
5546
  bag.length = def.length;
5547
5547
  });
5548
- inst._zod.check = (payload2) => {
5549
- const input = payload2.value;
5548
+ inst._zod.check = (payload) => {
5549
+ const input = payload.value;
5550
5550
  const length = input.length;
5551
5551
  if (length === def.length)
5552
5552
  return;
5553
5553
  const origin = getLengthableOrigin(input);
5554
5554
  const tooBig2 = length > def.length;
5555
- payload2.issues.push({
5555
+ payload.issues.push({
5556
5556
  origin,
5557
5557
  ...tooBig2 ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
5558
5558
  inclusive: true,
5559
5559
  exact: true,
5560
- input: payload2.value,
5560
+ input: payload.value,
5561
5561
  inst,
5562
5562
  continue: !def.abort
5563
5563
  });
@@ -5575,15 +5575,15 @@ var init_checks = __esm({
5575
5575
  }
5576
5576
  });
5577
5577
  if (def.pattern)
5578
- (_a3 = inst._zod).check ?? (_a3.check = (payload2) => {
5578
+ (_a3 = inst._zod).check ?? (_a3.check = (payload) => {
5579
5579
  def.pattern.lastIndex = 0;
5580
- if (def.pattern.test(payload2.value))
5580
+ if (def.pattern.test(payload.value))
5581
5581
  return;
5582
- payload2.issues.push({
5582
+ payload.issues.push({
5583
5583
  origin: "string",
5584
5584
  code: "invalid_format",
5585
5585
  format: def.format,
5586
- input: payload2.value,
5586
+ input: payload.value,
5587
5587
  ...def.pattern ? { pattern: def.pattern.toString() } : {},
5588
5588
  inst,
5589
5589
  continue: !def.abort
@@ -5595,15 +5595,15 @@ var init_checks = __esm({
5595
5595
  });
5596
5596
  $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
5597
5597
  $ZodCheckStringFormat.init(inst, def);
5598
- inst._zod.check = (payload2) => {
5598
+ inst._zod.check = (payload) => {
5599
5599
  def.pattern.lastIndex = 0;
5600
- if (def.pattern.test(payload2.value))
5600
+ if (def.pattern.test(payload.value))
5601
5601
  return;
5602
- payload2.issues.push({
5602
+ payload.issues.push({
5603
5603
  origin: "string",
5604
5604
  code: "invalid_format",
5605
5605
  format: "regex",
5606
- input: payload2.value,
5606
+ input: payload.value,
5607
5607
  pattern: def.pattern.toString(),
5608
5608
  inst,
5609
5609
  continue: !def.abort
@@ -5628,15 +5628,15 @@ var init_checks = __esm({
5628
5628
  bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
5629
5629
  bag.patterns.add(pattern);
5630
5630
  });
5631
- inst._zod.check = (payload2) => {
5632
- if (payload2.value.includes(def.includes, def.position))
5631
+ inst._zod.check = (payload) => {
5632
+ if (payload.value.includes(def.includes, def.position))
5633
5633
  return;
5634
- payload2.issues.push({
5634
+ payload.issues.push({
5635
5635
  origin: "string",
5636
5636
  code: "invalid_format",
5637
5637
  format: "includes",
5638
5638
  includes: def.includes,
5639
- input: payload2.value,
5639
+ input: payload.value,
5640
5640
  inst,
5641
5641
  continue: !def.abort
5642
5642
  });
@@ -5651,15 +5651,15 @@ var init_checks = __esm({
5651
5651
  bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
5652
5652
  bag.patterns.add(pattern);
5653
5653
  });
5654
- inst._zod.check = (payload2) => {
5655
- if (payload2.value.startsWith(def.prefix))
5654
+ inst._zod.check = (payload) => {
5655
+ if (payload.value.startsWith(def.prefix))
5656
5656
  return;
5657
- payload2.issues.push({
5657
+ payload.issues.push({
5658
5658
  origin: "string",
5659
5659
  code: "invalid_format",
5660
5660
  format: "starts_with",
5661
5661
  prefix: def.prefix,
5662
- input: payload2.value,
5662
+ input: payload.value,
5663
5663
  inst,
5664
5664
  continue: !def.abort
5665
5665
  });
@@ -5674,15 +5674,15 @@ var init_checks = __esm({
5674
5674
  bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
5675
5675
  bag.patterns.add(pattern);
5676
5676
  });
5677
- inst._zod.check = (payload2) => {
5678
- if (payload2.value.endsWith(def.suffix))
5677
+ inst._zod.check = (payload) => {
5678
+ if (payload.value.endsWith(def.suffix))
5679
5679
  return;
5680
- payload2.issues.push({
5680
+ payload.issues.push({
5681
5681
  origin: "string",
5682
5682
  code: "invalid_format",
5683
5683
  format: "ends_with",
5684
5684
  suffix: def.suffix,
5685
- input: payload2.value,
5685
+ input: payload.value,
5686
5686
  inst,
5687
5687
  continue: !def.abort
5688
5688
  });
@@ -5690,15 +5690,15 @@ var init_checks = __esm({
5690
5690
  });
5691
5691
  $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
5692
5692
  $ZodCheck.init(inst, def);
5693
- inst._zod.check = (payload2) => {
5693
+ inst._zod.check = (payload) => {
5694
5694
  const result = def.schema._zod.run({
5695
- value: payload2.value[def.property],
5695
+ value: payload.value[def.property],
5696
5696
  issues: []
5697
5697
  }, {});
5698
5698
  if (result instanceof Promise) {
5699
- return result.then((result2) => handleCheckPropertyResult(result2, payload2, def.property));
5699
+ return result.then((result2) => handleCheckPropertyResult(result2, payload, def.property));
5700
5700
  }
5701
- handleCheckPropertyResult(result, payload2, def.property);
5701
+ handleCheckPropertyResult(result, payload, def.property);
5702
5702
  return;
5703
5703
  };
5704
5704
  });
@@ -5708,13 +5708,13 @@ var init_checks = __esm({
5708
5708
  inst._zod.onattach.push((inst2) => {
5709
5709
  inst2._zod.bag.mime = def.mime;
5710
5710
  });
5711
- inst._zod.check = (payload2) => {
5712
- if (mimeSet.has(payload2.value.type))
5711
+ inst._zod.check = (payload) => {
5712
+ if (mimeSet.has(payload.value.type))
5713
5713
  return;
5714
- payload2.issues.push({
5714
+ payload.issues.push({
5715
5715
  code: "invalid_value",
5716
5716
  values: def.mime,
5717
- input: payload2.value.type,
5717
+ input: payload.value.type,
5718
5718
  inst,
5719
5719
  continue: !def.abort
5720
5720
  });
@@ -5722,8 +5722,8 @@ var init_checks = __esm({
5722
5722
  });
5723
5723
  $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
5724
5724
  $ZodCheck.init(inst, def);
5725
- inst._zod.check = (payload2) => {
5726
- payload2.value = def.tx(payload2.value);
5725
+ inst._zod.check = (payload) => {
5726
+ payload.value = def.tx(payload.value);
5727
5727
  };
5728
5728
  });
5729
5729
  }
@@ -5873,7 +5873,7 @@ function normalizeDef(def) {
5873
5873
  optionalKeys: new Set(okeys)
5874
5874
  };
5875
5875
  }
5876
- function handleCatchall(proms, input, payload2, ctx, def, inst) {
5876
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
5877
5877
  const unrecognized = [];
5878
5878
  const keySet = def.keySet;
5879
5879
  const _catchall = def.catchall._zod;
@@ -5891,13 +5891,13 @@ function handleCatchall(proms, input, payload2, ctx, def, inst) {
5891
5891
  }
5892
5892
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
5893
5893
  if (r instanceof Promise) {
5894
- proms.push(r.then((r2) => handlePropertyResult(r2, payload2, key, input, isOptionalIn, isOptionalOut)));
5894
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
5895
5895
  } else {
5896
- handlePropertyResult(r, payload2, key, input, isOptionalIn, isOptionalOut);
5896
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
5897
5897
  }
5898
5898
  }
5899
5899
  if (unrecognized.length) {
5900
- payload2.issues.push({
5900
+ payload.issues.push({
5901
5901
  code: "unrecognized_keys",
5902
5902
  keys: unrecognized,
5903
5903
  input,
@@ -5905,9 +5905,9 @@ function handleCatchall(proms, input, payload2, ctx, def, inst) {
5905
5905
  });
5906
5906
  }
5907
5907
  if (!proms.length)
5908
- return payload2;
5908
+ return payload;
5909
5909
  return Promise.all(proms).then(() => {
5910
- return payload2;
5910
+ return payload;
5911
5911
  });
5912
5912
  }
5913
5913
  function handleUnionResults(results, final, inst, ctx) {
@@ -6114,22 +6114,22 @@ function handleOptionalResult(result, input) {
6114
6114
  }
6115
6115
  return result;
6116
6116
  }
6117
- function handleDefaultResult(payload2, def) {
6118
- if (payload2.value === void 0) {
6119
- payload2.value = def.defaultValue;
6117
+ function handleDefaultResult(payload, def) {
6118
+ if (payload.value === void 0) {
6119
+ payload.value = def.defaultValue;
6120
6120
  }
6121
- return payload2;
6121
+ return payload;
6122
6122
  }
6123
- function handleNonOptionalResult(payload2, inst) {
6124
- if (!payload2.issues.length && payload2.value === void 0) {
6125
- payload2.issues.push({
6123
+ function handleNonOptionalResult(payload, inst) {
6124
+ if (!payload.issues.length && payload.value === void 0) {
6125
+ payload.issues.push({
6126
6126
  code: "invalid_type",
6127
6127
  expected: "nonoptional",
6128
- input: payload2.value,
6128
+ input: payload.value,
6129
6129
  inst
6130
6130
  });
6131
6131
  }
6132
- return payload2;
6132
+ return payload;
6133
6133
  }
6134
6134
  function handlePipeResult(left, next, ctx) {
6135
6135
  if (left.issues.length) {
@@ -6165,11 +6165,11 @@ function handleCodecTxResult(left, value, nextSchema, ctx) {
6165
6165
  }
6166
6166
  return nextSchema._zod.run({ value, issues: left.issues }, ctx);
6167
6167
  }
6168
- function handleReadonlyResult(payload2) {
6169
- payload2.value = Object.freeze(payload2.value);
6170
- return payload2;
6168
+ function handleReadonlyResult(payload) {
6169
+ payload.value = Object.freeze(payload.value);
6170
+ return payload;
6171
6171
  }
6172
- function handleRefineResult(result, payload2, input, inst) {
6172
+ function handleRefineResult(result, payload, input, inst) {
6173
6173
  if (!result) {
6174
6174
  const _iss = {
6175
6175
  code: "custom",
@@ -6183,7 +6183,7 @@ function handleRefineResult(result, payload2, input, inst) {
6183
6183
  };
6184
6184
  if (inst._zod.def.params)
6185
6185
  _iss.params = inst._zod.def.params;
6186
- payload2.issues.push(issue(_iss));
6186
+ payload.issues.push(issue(_iss));
6187
6187
  }
6188
6188
  }
6189
6189
  var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodMAC, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodCustomStringFormat, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodBigInt, $ZodBigIntFormat, $ZodSymbol, $ZodUndefined, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodVoid, $ZodDate, $ZodArray, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodXor, $ZodDiscriminatedUnion, $ZodIntersection, $ZodTuple, $ZodRecord, $ZodMap, $ZodSet, $ZodEnum, $ZodLiteral, $ZodFile, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodSuccess, $ZodCatch, $ZodNaN, $ZodPipe, $ZodCodec, $ZodPreprocess, $ZodReadonly, $ZodTemplateLiteral, $ZodFunction, $ZodPromise, $ZodLazy, $ZodCustom;
@@ -6218,54 +6218,54 @@ var init_schemas = __esm({
6218
6218
  inst._zod.run = inst._zod.parse;
6219
6219
  });
6220
6220
  } else {
6221
- const runChecks = (payload2, checks2, ctx) => {
6222
- let isAborted2 = aborted(payload2);
6221
+ const runChecks = (payload, checks2, ctx) => {
6222
+ let isAborted2 = aborted(payload);
6223
6223
  let asyncResult;
6224
6224
  for (const ch of checks2) {
6225
6225
  if (ch._zod.def.when) {
6226
- if (explicitlyAborted(payload2))
6226
+ if (explicitlyAborted(payload))
6227
6227
  continue;
6228
- const shouldRun = ch._zod.def.when(payload2);
6228
+ const shouldRun = ch._zod.def.when(payload);
6229
6229
  if (!shouldRun)
6230
6230
  continue;
6231
6231
  } else if (isAborted2) {
6232
6232
  continue;
6233
6233
  }
6234
- const currLen = payload2.issues.length;
6235
- const _ = ch._zod.check(payload2);
6234
+ const currLen = payload.issues.length;
6235
+ const _ = ch._zod.check(payload);
6236
6236
  if (_ instanceof Promise && ctx?.async === false) {
6237
6237
  throw new $ZodAsyncError();
6238
6238
  }
6239
6239
  if (asyncResult || _ instanceof Promise) {
6240
6240
  asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
6241
6241
  await _;
6242
- const nextLen = payload2.issues.length;
6242
+ const nextLen = payload.issues.length;
6243
6243
  if (nextLen === currLen)
6244
6244
  return;
6245
6245
  if (!isAborted2)
6246
- isAborted2 = aborted(payload2, currLen);
6246
+ isAborted2 = aborted(payload, currLen);
6247
6247
  });
6248
6248
  } else {
6249
- const nextLen = payload2.issues.length;
6249
+ const nextLen = payload.issues.length;
6250
6250
  if (nextLen === currLen)
6251
6251
  continue;
6252
6252
  if (!isAborted2)
6253
- isAborted2 = aborted(payload2, currLen);
6253
+ isAborted2 = aborted(payload, currLen);
6254
6254
  }
6255
6255
  }
6256
6256
  if (asyncResult) {
6257
6257
  return asyncResult.then(() => {
6258
- return payload2;
6258
+ return payload;
6259
6259
  });
6260
6260
  }
6261
- return payload2;
6261
+ return payload;
6262
6262
  };
6263
- const handleCanaryResult = (canary, payload2, ctx) => {
6263
+ const handleCanaryResult = (canary, payload, ctx) => {
6264
6264
  if (aborted(canary)) {
6265
6265
  canary.aborted = true;
6266
6266
  return canary;
6267
6267
  }
6268
- const checkResult = runChecks(payload2, checks, ctx);
6268
+ const checkResult = runChecks(payload, checks, ctx);
6269
6269
  if (checkResult instanceof Promise) {
6270
6270
  if (ctx.async === false)
6271
6271
  throw new $ZodAsyncError();
@@ -6273,20 +6273,20 @@ var init_schemas = __esm({
6273
6273
  }
6274
6274
  return inst._zod.parse(checkResult, ctx);
6275
6275
  };
6276
- inst._zod.run = (payload2, ctx) => {
6276
+ inst._zod.run = (payload, ctx) => {
6277
6277
  if (ctx.skipChecks) {
6278
- return inst._zod.parse(payload2, ctx);
6278
+ return inst._zod.parse(payload, ctx);
6279
6279
  }
6280
6280
  if (ctx.direction === "backward") {
6281
- const canary = inst._zod.parse({ value: payload2.value, issues: [] }, { ...ctx, skipChecks: true });
6281
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
6282
6282
  if (canary instanceof Promise) {
6283
6283
  return canary.then((canary2) => {
6284
- return handleCanaryResult(canary2, payload2, ctx);
6284
+ return handleCanaryResult(canary2, payload, ctx);
6285
6285
  });
6286
6286
  }
6287
- return handleCanaryResult(canary, payload2, ctx);
6287
+ return handleCanaryResult(canary, payload, ctx);
6288
6288
  }
6289
- const result = inst._zod.parse(payload2, ctx);
6289
+ const result = inst._zod.parse(payload, ctx);
6290
6290
  if (result instanceof Promise) {
6291
6291
  if (ctx.async === false)
6292
6292
  throw new $ZodAsyncError();
@@ -6311,21 +6311,21 @@ var init_schemas = __esm({
6311
6311
  $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
6312
6312
  $ZodType.init(inst, def);
6313
6313
  inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
6314
- inst._zod.parse = (payload2, _) => {
6314
+ inst._zod.parse = (payload, _) => {
6315
6315
  if (def.coerce)
6316
6316
  try {
6317
- payload2.value = String(payload2.value);
6317
+ payload.value = String(payload.value);
6318
6318
  } catch (_2) {
6319
6319
  }
6320
- if (typeof payload2.value === "string")
6321
- return payload2;
6322
- payload2.issues.push({
6320
+ if (typeof payload.value === "string")
6321
+ return payload;
6322
+ payload.issues.push({
6323
6323
  expected: "string",
6324
6324
  code: "invalid_type",
6325
- input: payload2.value,
6325
+ input: payload.value,
6326
6326
  inst
6327
6327
  });
6328
- return payload2;
6328
+ return payload;
6329
6329
  };
6330
6330
  });
6331
6331
  $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
@@ -6362,16 +6362,16 @@ var init_schemas = __esm({
6362
6362
  });
6363
6363
  $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
6364
6364
  $ZodStringFormat.init(inst, def);
6365
- inst._zod.check = (payload2) => {
6365
+ inst._zod.check = (payload) => {
6366
6366
  try {
6367
- const trimmed = payload2.value.trim();
6367
+ const trimmed = payload.value.trim();
6368
6368
  if (!def.normalize && def.protocol?.source === httpProtocol.source) {
6369
6369
  if (!/^https?:\/\//i.test(trimmed)) {
6370
- payload2.issues.push({
6370
+ payload.issues.push({
6371
6371
  code: "invalid_format",
6372
6372
  format: "url",
6373
6373
  note: "Invalid URL format",
6374
- input: payload2.value,
6374
+ input: payload.value,
6375
6375
  inst,
6376
6376
  continue: !def.abort
6377
6377
  });
@@ -6382,12 +6382,12 @@ var init_schemas = __esm({
6382
6382
  if (def.hostname) {
6383
6383
  def.hostname.lastIndex = 0;
6384
6384
  if (!def.hostname.test(url2.hostname)) {
6385
- payload2.issues.push({
6385
+ payload.issues.push({
6386
6386
  code: "invalid_format",
6387
6387
  format: "url",
6388
6388
  note: "Invalid hostname",
6389
6389
  pattern: def.hostname.source,
6390
- input: payload2.value,
6390
+ input: payload.value,
6391
6391
  inst,
6392
6392
  continue: !def.abort
6393
6393
  });
@@ -6396,28 +6396,28 @@ var init_schemas = __esm({
6396
6396
  if (def.protocol) {
6397
6397
  def.protocol.lastIndex = 0;
6398
6398
  if (!def.protocol.test(url2.protocol.endsWith(":") ? url2.protocol.slice(0, -1) : url2.protocol)) {
6399
- payload2.issues.push({
6399
+ payload.issues.push({
6400
6400
  code: "invalid_format",
6401
6401
  format: "url",
6402
6402
  note: "Invalid protocol",
6403
6403
  pattern: def.protocol.source,
6404
- input: payload2.value,
6404
+ input: payload.value,
6405
6405
  inst,
6406
6406
  continue: !def.abort
6407
6407
  });
6408
6408
  }
6409
6409
  }
6410
6410
  if (def.normalize) {
6411
- payload2.value = url2.href;
6411
+ payload.value = url2.href;
6412
6412
  } else {
6413
- payload2.value = trimmed;
6413
+ payload.value = trimmed;
6414
6414
  }
6415
6415
  return;
6416
6416
  } catch (_) {
6417
- payload2.issues.push({
6417
+ payload.issues.push({
6418
6418
  code: "invalid_format",
6419
6419
  format: "url",
6420
- input: payload2.value,
6420
+ input: payload.value,
6421
6421
  inst,
6422
6422
  continue: !def.abort
6423
6423
  });
@@ -6477,14 +6477,14 @@ var init_schemas = __esm({
6477
6477
  def.pattern ?? (def.pattern = ipv6);
6478
6478
  $ZodStringFormat.init(inst, def);
6479
6479
  inst._zod.bag.format = `ipv6`;
6480
- inst._zod.check = (payload2) => {
6480
+ inst._zod.check = (payload) => {
6481
6481
  try {
6482
- new URL(`http://[${payload2.value}]`);
6482
+ new URL(`http://[${payload.value}]`);
6483
6483
  } catch {
6484
- payload2.issues.push({
6484
+ payload.issues.push({
6485
6485
  code: "invalid_format",
6486
6486
  format: "ipv6",
6487
- input: payload2.value,
6487
+ input: payload.value,
6488
6488
  inst,
6489
6489
  continue: !def.abort
6490
6490
  });
@@ -6503,8 +6503,8 @@ var init_schemas = __esm({
6503
6503
  $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
6504
6504
  def.pattern ?? (def.pattern = cidrv6);
6505
6505
  $ZodStringFormat.init(inst, def);
6506
- inst._zod.check = (payload2) => {
6507
- const parts = payload2.value.split("/");
6506
+ inst._zod.check = (payload) => {
6507
+ const parts = payload.value.split("/");
6508
6508
  try {
6509
6509
  if (parts.length !== 2)
6510
6510
  throw new Error();
@@ -6518,10 +6518,10 @@ var init_schemas = __esm({
6518
6518
  throw new Error();
6519
6519
  new URL(`http://[${address}]`);
6520
6520
  } catch {
6521
- payload2.issues.push({
6521
+ payload.issues.push({
6522
6522
  code: "invalid_format",
6523
6523
  format: "cidrv6",
6524
- input: payload2.value,
6524
+ input: payload.value,
6525
6525
  inst,
6526
6526
  continue: !def.abort
6527
6527
  });
@@ -6532,13 +6532,13 @@ var init_schemas = __esm({
6532
6532
  def.pattern ?? (def.pattern = base64);
6533
6533
  $ZodStringFormat.init(inst, def);
6534
6534
  inst._zod.bag.contentEncoding = "base64";
6535
- inst._zod.check = (payload2) => {
6536
- if (isValidBase64(payload2.value))
6535
+ inst._zod.check = (payload) => {
6536
+ if (isValidBase64(payload.value))
6537
6537
  return;
6538
- payload2.issues.push({
6538
+ payload.issues.push({
6539
6539
  code: "invalid_format",
6540
6540
  format: "base64",
6541
- input: payload2.value,
6541
+ input: payload.value,
6542
6542
  inst,
6543
6543
  continue: !def.abort
6544
6544
  });
@@ -6548,13 +6548,13 @@ var init_schemas = __esm({
6548
6548
  def.pattern ?? (def.pattern = base64url);
6549
6549
  $ZodStringFormat.init(inst, def);
6550
6550
  inst._zod.bag.contentEncoding = "base64url";
6551
- inst._zod.check = (payload2) => {
6552
- if (isValidBase64URL(payload2.value))
6551
+ inst._zod.check = (payload) => {
6552
+ if (isValidBase64URL(payload.value))
6553
6553
  return;
6554
- payload2.issues.push({
6554
+ payload.issues.push({
6555
6555
  code: "invalid_format",
6556
6556
  format: "base64url",
6557
- input: payload2.value,
6557
+ input: payload.value,
6558
6558
  inst,
6559
6559
  continue: !def.abort
6560
6560
  });
@@ -6566,13 +6566,13 @@ var init_schemas = __esm({
6566
6566
  });
6567
6567
  $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
6568
6568
  $ZodStringFormat.init(inst, def);
6569
- inst._zod.check = (payload2) => {
6570
- if (isValidJWT2(payload2.value, def.alg))
6569
+ inst._zod.check = (payload) => {
6570
+ if (isValidJWT2(payload.value, def.alg))
6571
6571
  return;
6572
- payload2.issues.push({
6572
+ payload.issues.push({
6573
6573
  code: "invalid_format",
6574
6574
  format: "jwt",
6575
- input: payload2.value,
6575
+ input: payload.value,
6576
6576
  inst,
6577
6577
  continue: !def.abort
6578
6578
  });
@@ -6580,13 +6580,13 @@ var init_schemas = __esm({
6580
6580
  });
6581
6581
  $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringFormat", (inst, def) => {
6582
6582
  $ZodStringFormat.init(inst, def);
6583
- inst._zod.check = (payload2) => {
6584
- if (def.fn(payload2.value))
6583
+ inst._zod.check = (payload) => {
6584
+ if (def.fn(payload.value))
6585
6585
  return;
6586
- payload2.issues.push({
6586
+ payload.issues.push({
6587
6587
  code: "invalid_format",
6588
6588
  format: def.format,
6589
- input: payload2.value,
6589
+ input: payload.value,
6590
6590
  inst,
6591
6591
  continue: !def.abort
6592
6592
  });
@@ -6595,25 +6595,25 @@ var init_schemas = __esm({
6595
6595
  $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
6596
6596
  $ZodType.init(inst, def);
6597
6597
  inst._zod.pattern = inst._zod.bag.pattern ?? number;
6598
- inst._zod.parse = (payload2, _ctx) => {
6598
+ inst._zod.parse = (payload, _ctx) => {
6599
6599
  if (def.coerce)
6600
6600
  try {
6601
- payload2.value = Number(payload2.value);
6601
+ payload.value = Number(payload.value);
6602
6602
  } catch (_) {
6603
6603
  }
6604
- const input = payload2.value;
6604
+ const input = payload.value;
6605
6605
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
6606
- return payload2;
6606
+ return payload;
6607
6607
  }
6608
6608
  const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
6609
- payload2.issues.push({
6609
+ payload.issues.push({
6610
6610
  expected: "number",
6611
6611
  code: "invalid_type",
6612
6612
  input,
6613
6613
  inst,
6614
6614
  ...received ? { received } : {}
6615
6615
  });
6616
- return payload2;
6616
+ return payload;
6617
6617
  };
6618
6618
  });
6619
6619
  $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
@@ -6623,42 +6623,42 @@ var init_schemas = __esm({
6623
6623
  $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
6624
6624
  $ZodType.init(inst, def);
6625
6625
  inst._zod.pattern = boolean;
6626
- inst._zod.parse = (payload2, _ctx) => {
6626
+ inst._zod.parse = (payload, _ctx) => {
6627
6627
  if (def.coerce)
6628
6628
  try {
6629
- payload2.value = Boolean(payload2.value);
6629
+ payload.value = Boolean(payload.value);
6630
6630
  } catch (_) {
6631
6631
  }
6632
- const input = payload2.value;
6632
+ const input = payload.value;
6633
6633
  if (typeof input === "boolean")
6634
- return payload2;
6635
- payload2.issues.push({
6634
+ return payload;
6635
+ payload.issues.push({
6636
6636
  expected: "boolean",
6637
6637
  code: "invalid_type",
6638
6638
  input,
6639
6639
  inst
6640
6640
  });
6641
- return payload2;
6641
+ return payload;
6642
6642
  };
6643
6643
  });
6644
6644
  $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
6645
6645
  $ZodType.init(inst, def);
6646
6646
  inst._zod.pattern = bigint;
6647
- inst._zod.parse = (payload2, _ctx) => {
6647
+ inst._zod.parse = (payload, _ctx) => {
6648
6648
  if (def.coerce)
6649
6649
  try {
6650
- payload2.value = BigInt(payload2.value);
6650
+ payload.value = BigInt(payload.value);
6651
6651
  } catch (_) {
6652
6652
  }
6653
- if (typeof payload2.value === "bigint")
6654
- return payload2;
6655
- payload2.issues.push({
6653
+ if (typeof payload.value === "bigint")
6654
+ return payload;
6655
+ payload.issues.push({
6656
6656
  expected: "bigint",
6657
6657
  code: "invalid_type",
6658
- input: payload2.value,
6658
+ input: payload.value,
6659
6659
  inst
6660
6660
  });
6661
- return payload2;
6661
+ return payload;
6662
6662
  };
6663
6663
  });
6664
6664
  $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, def) => {
@@ -6667,126 +6667,126 @@ var init_schemas = __esm({
6667
6667
  });
6668
6668
  $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
6669
6669
  $ZodType.init(inst, def);
6670
- inst._zod.parse = (payload2, _ctx) => {
6671
- const input = payload2.value;
6670
+ inst._zod.parse = (payload, _ctx) => {
6671
+ const input = payload.value;
6672
6672
  if (typeof input === "symbol")
6673
- return payload2;
6674
- payload2.issues.push({
6673
+ return payload;
6674
+ payload.issues.push({
6675
6675
  expected: "symbol",
6676
6676
  code: "invalid_type",
6677
6677
  input,
6678
6678
  inst
6679
6679
  });
6680
- return payload2;
6680
+ return payload;
6681
6681
  };
6682
6682
  });
6683
6683
  $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => {
6684
6684
  $ZodType.init(inst, def);
6685
6685
  inst._zod.pattern = _undefined;
6686
6686
  inst._zod.values = /* @__PURE__ */ new Set([void 0]);
6687
- inst._zod.parse = (payload2, _ctx) => {
6688
- const input = payload2.value;
6687
+ inst._zod.parse = (payload, _ctx) => {
6688
+ const input = payload.value;
6689
6689
  if (typeof input === "undefined")
6690
- return payload2;
6691
- payload2.issues.push({
6690
+ return payload;
6691
+ payload.issues.push({
6692
6692
  expected: "undefined",
6693
6693
  code: "invalid_type",
6694
6694
  input,
6695
6695
  inst
6696
6696
  });
6697
- return payload2;
6697
+ return payload;
6698
6698
  };
6699
6699
  });
6700
6700
  $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
6701
6701
  $ZodType.init(inst, def);
6702
6702
  inst._zod.pattern = _null;
6703
6703
  inst._zod.values = /* @__PURE__ */ new Set([null]);
6704
- inst._zod.parse = (payload2, _ctx) => {
6705
- const input = payload2.value;
6704
+ inst._zod.parse = (payload, _ctx) => {
6705
+ const input = payload.value;
6706
6706
  if (input === null)
6707
- return payload2;
6708
- payload2.issues.push({
6707
+ return payload;
6708
+ payload.issues.push({
6709
6709
  expected: "null",
6710
6710
  code: "invalid_type",
6711
6711
  input,
6712
6712
  inst
6713
6713
  });
6714
- return payload2;
6714
+ return payload;
6715
6715
  };
6716
6716
  });
6717
6717
  $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
6718
6718
  $ZodType.init(inst, def);
6719
- inst._zod.parse = (payload2) => payload2;
6719
+ inst._zod.parse = (payload) => payload;
6720
6720
  });
6721
6721
  $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
6722
6722
  $ZodType.init(inst, def);
6723
- inst._zod.parse = (payload2) => payload2;
6723
+ inst._zod.parse = (payload) => payload;
6724
6724
  });
6725
6725
  $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
6726
6726
  $ZodType.init(inst, def);
6727
- inst._zod.parse = (payload2, _ctx) => {
6728
- payload2.issues.push({
6727
+ inst._zod.parse = (payload, _ctx) => {
6728
+ payload.issues.push({
6729
6729
  expected: "never",
6730
6730
  code: "invalid_type",
6731
- input: payload2.value,
6731
+ input: payload.value,
6732
6732
  inst
6733
6733
  });
6734
- return payload2;
6734
+ return payload;
6735
6735
  };
6736
6736
  });
6737
6737
  $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
6738
6738
  $ZodType.init(inst, def);
6739
- inst._zod.parse = (payload2, _ctx) => {
6740
- const input = payload2.value;
6739
+ inst._zod.parse = (payload, _ctx) => {
6740
+ const input = payload.value;
6741
6741
  if (typeof input === "undefined")
6742
- return payload2;
6743
- payload2.issues.push({
6742
+ return payload;
6743
+ payload.issues.push({
6744
6744
  expected: "void",
6745
6745
  code: "invalid_type",
6746
6746
  input,
6747
6747
  inst
6748
6748
  });
6749
- return payload2;
6749
+ return payload;
6750
6750
  };
6751
6751
  });
6752
6752
  $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
6753
6753
  $ZodType.init(inst, def);
6754
- inst._zod.parse = (payload2, _ctx) => {
6754
+ inst._zod.parse = (payload, _ctx) => {
6755
6755
  if (def.coerce) {
6756
6756
  try {
6757
- payload2.value = new Date(payload2.value);
6757
+ payload.value = new Date(payload.value);
6758
6758
  } catch (_err) {
6759
6759
  }
6760
6760
  }
6761
- const input = payload2.value;
6761
+ const input = payload.value;
6762
6762
  const isDate = input instanceof Date;
6763
6763
  const isValidDate = isDate && !Number.isNaN(input.getTime());
6764
6764
  if (isValidDate)
6765
- return payload2;
6766
- payload2.issues.push({
6765
+ return payload;
6766
+ payload.issues.push({
6767
6767
  expected: "date",
6768
6768
  code: "invalid_type",
6769
6769
  input,
6770
6770
  ...isDate ? { received: "Invalid Date" } : {},
6771
6771
  inst
6772
6772
  });
6773
- return payload2;
6773
+ return payload;
6774
6774
  };
6775
6775
  });
6776
6776
  $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
6777
6777
  $ZodType.init(inst, def);
6778
- inst._zod.parse = (payload2, ctx) => {
6779
- const input = payload2.value;
6778
+ inst._zod.parse = (payload, ctx) => {
6779
+ const input = payload.value;
6780
6780
  if (!Array.isArray(input)) {
6781
- payload2.issues.push({
6781
+ payload.issues.push({
6782
6782
  expected: "array",
6783
6783
  code: "invalid_type",
6784
6784
  input,
6785
6785
  inst
6786
6786
  });
6787
- return payload2;
6787
+ return payload;
6788
6788
  }
6789
- payload2.value = Array(input.length);
6789
+ payload.value = Array(input.length);
6790
6790
  const proms = [];
6791
6791
  for (let i = 0; i < input.length; i++) {
6792
6792
  const item = input[i];
@@ -6795,15 +6795,15 @@ var init_schemas = __esm({
6795
6795
  issues: []
6796
6796
  }, ctx);
6797
6797
  if (result instanceof Promise) {
6798
- proms.push(result.then((result2) => handleArrayResult(result2, payload2, i)));
6798
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
6799
6799
  } else {
6800
- handleArrayResult(result, payload2, i);
6800
+ handleArrayResult(result, payload, i);
6801
6801
  }
6802
6802
  }
6803
6803
  if (proms.length) {
6804
- return Promise.all(proms).then(() => payload2);
6804
+ return Promise.all(proms).then(() => payload);
6805
6805
  }
6806
- return payload2;
6806
+ return payload;
6807
6807
  };
6808
6808
  });
6809
6809
  $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
@@ -6838,19 +6838,19 @@ var init_schemas = __esm({
6838
6838
  const isObject2 = isObject;
6839
6839
  const catchall = def.catchall;
6840
6840
  let value;
6841
- inst._zod.parse = (payload2, ctx) => {
6841
+ inst._zod.parse = (payload, ctx) => {
6842
6842
  value ?? (value = _normalized.value);
6843
- const input = payload2.value;
6843
+ const input = payload.value;
6844
6844
  if (!isObject2(input)) {
6845
- payload2.issues.push({
6845
+ payload.issues.push({
6846
6846
  expected: "object",
6847
6847
  code: "invalid_type",
6848
6848
  input,
6849
6849
  inst
6850
6850
  });
6851
- return payload2;
6851
+ return payload;
6852
6852
  }
6853
- payload2.value = {};
6853
+ payload.value = {};
6854
6854
  const proms = [];
6855
6855
  const shape = value.shape;
6856
6856
  for (const key of value.keys) {
@@ -6859,15 +6859,15 @@ var init_schemas = __esm({
6859
6859
  const isOptionalOut = el._zod.optout === "optional";
6860
6860
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
6861
6861
  if (r instanceof Promise) {
6862
- proms.push(r.then((r2) => handlePropertyResult(r2, payload2, key, input, isOptionalIn, isOptionalOut)));
6862
+ proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
6863
6863
  } else {
6864
- handlePropertyResult(r, payload2, key, input, isOptionalIn, isOptionalOut);
6864
+ handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
6865
6865
  }
6866
6866
  }
6867
6867
  if (!catchall) {
6868
- return proms.length ? Promise.all(proms).then(() => payload2) : payload2;
6868
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
6869
6869
  }
6870
- return handleCatchall(proms, input, payload2, ctx, _normalized.value, inst);
6870
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
6871
6871
  };
6872
6872
  });
6873
6873
  $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -6965,7 +6965,7 @@ var init_schemas = __esm({
6965
6965
  doc.write(`payload.value = newResult;`);
6966
6966
  doc.write(`return payload;`);
6967
6967
  const fn = doc.compile();
6968
- return (payload2, ctx) => fn(shape, payload2, ctx);
6968
+ return (payload, ctx) => fn(shape, payload, ctx);
6969
6969
  };
6970
6970
  let fastpass;
6971
6971
  const isObject2 = isObject;
@@ -6974,27 +6974,27 @@ var init_schemas = __esm({
6974
6974
  const fastEnabled = jit && allowsEval2.value;
6975
6975
  const catchall = def.catchall;
6976
6976
  let value;
6977
- inst._zod.parse = (payload2, ctx) => {
6977
+ inst._zod.parse = (payload, ctx) => {
6978
6978
  value ?? (value = _normalized.value);
6979
- const input = payload2.value;
6979
+ const input = payload.value;
6980
6980
  if (!isObject2(input)) {
6981
- payload2.issues.push({
6981
+ payload.issues.push({
6982
6982
  expected: "object",
6983
6983
  code: "invalid_type",
6984
6984
  input,
6985
6985
  inst
6986
6986
  });
6987
- return payload2;
6987
+ return payload;
6988
6988
  }
6989
6989
  if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
6990
6990
  if (!fastpass)
6991
6991
  fastpass = generateFastpass(def.shape);
6992
- payload2 = fastpass(payload2, ctx);
6992
+ payload = fastpass(payload, ctx);
6993
6993
  if (!catchall)
6994
- return payload2;
6995
- return handleCatchall([], input, payload2, ctx, value, inst);
6994
+ return payload;
6995
+ return handleCatchall([], input, payload, ctx, value, inst);
6996
6996
  }
6997
- return superParse(payload2, ctx);
6997
+ return superParse(payload, ctx);
6998
6998
  };
6999
6999
  });
7000
7000
  $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
@@ -7015,15 +7015,15 @@ var init_schemas = __esm({
7015
7015
  return void 0;
7016
7016
  });
7017
7017
  const first = def.options.length === 1 ? def.options[0]._zod.run : null;
7018
- inst._zod.parse = (payload2, ctx) => {
7018
+ inst._zod.parse = (payload, ctx) => {
7019
7019
  if (first) {
7020
- return first(payload2, ctx);
7020
+ return first(payload, ctx);
7021
7021
  }
7022
7022
  let async = false;
7023
7023
  const results = [];
7024
7024
  for (const option of def.options) {
7025
7025
  const result = option._zod.run({
7026
- value: payload2.value,
7026
+ value: payload.value,
7027
7027
  issues: []
7028
7028
  }, ctx);
7029
7029
  if (result instanceof Promise) {
@@ -7036,9 +7036,9 @@ var init_schemas = __esm({
7036
7036
  }
7037
7037
  }
7038
7038
  if (!async)
7039
- return handleUnionResults(results, payload2, inst, ctx);
7039
+ return handleUnionResults(results, payload, inst, ctx);
7040
7040
  return Promise.all(results).then((results2) => {
7041
- return handleUnionResults(results2, payload2, inst, ctx);
7041
+ return handleUnionResults(results2, payload, inst, ctx);
7042
7042
  });
7043
7043
  };
7044
7044
  });
@@ -7046,15 +7046,15 @@ var init_schemas = __esm({
7046
7046
  $ZodUnion.init(inst, def);
7047
7047
  def.inclusive = false;
7048
7048
  const first = def.options.length === 1 ? def.options[0]._zod.run : null;
7049
- inst._zod.parse = (payload2, ctx) => {
7049
+ inst._zod.parse = (payload, ctx) => {
7050
7050
  if (first) {
7051
- return first(payload2, ctx);
7051
+ return first(payload, ctx);
7052
7052
  }
7053
7053
  let async = false;
7054
7054
  const results = [];
7055
7055
  for (const option of def.options) {
7056
7056
  const result = option._zod.run({
7057
- value: payload2.value,
7057
+ value: payload.value,
7058
7058
  issues: []
7059
7059
  }, ctx);
7060
7060
  if (result instanceof Promise) {
@@ -7065,9 +7065,9 @@ var init_schemas = __esm({
7065
7065
  }
7066
7066
  }
7067
7067
  if (!async)
7068
- return handleExclusiveUnionResults(results, payload2, inst, ctx);
7068
+ return handleExclusiveUnionResults(results, payload, inst, ctx);
7069
7069
  return Promise.all(results).then((results2) => {
7070
- return handleExclusiveUnionResults(results2, payload2, inst, ctx);
7070
+ return handleExclusiveUnionResults(results2, payload, inst, ctx);
7071
7071
  });
7072
7072
  };
7073
7073
  });
@@ -7107,25 +7107,25 @@ var init_schemas = __esm({
7107
7107
  }
7108
7108
  return map2;
7109
7109
  });
7110
- inst._zod.parse = (payload2, ctx) => {
7111
- const input = payload2.value;
7110
+ inst._zod.parse = (payload, ctx) => {
7111
+ const input = payload.value;
7112
7112
  if (!isObject(input)) {
7113
- payload2.issues.push({
7113
+ payload.issues.push({
7114
7114
  code: "invalid_type",
7115
7115
  expected: "object",
7116
7116
  input,
7117
7117
  inst
7118
7118
  });
7119
- return payload2;
7119
+ return payload;
7120
7120
  }
7121
7121
  const opt = disc.value.get(input?.[def.discriminator]);
7122
7122
  if (opt) {
7123
- return opt._zod.run(payload2, ctx);
7123
+ return opt._zod.run(payload, ctx);
7124
7124
  }
7125
7125
  if (def.unionFallback || ctx.direction === "backward") {
7126
- return _super(payload2, ctx);
7126
+ return _super(payload, ctx);
7127
7127
  }
7128
- payload2.issues.push({
7128
+ payload.issues.push({
7129
7129
  code: "invalid_union",
7130
7130
  errors: [],
7131
7131
  note: "No matching discriminator",
@@ -7135,45 +7135,45 @@ var init_schemas = __esm({
7135
7135
  path: [def.discriminator],
7136
7136
  inst
7137
7137
  });
7138
- return payload2;
7138
+ return payload;
7139
7139
  };
7140
7140
  });
7141
7141
  $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
7142
7142
  $ZodType.init(inst, def);
7143
- inst._zod.parse = (payload2, ctx) => {
7144
- const input = payload2.value;
7143
+ inst._zod.parse = (payload, ctx) => {
7144
+ const input = payload.value;
7145
7145
  const left = def.left._zod.run({ value: input, issues: [] }, ctx);
7146
7146
  const right = def.right._zod.run({ value: input, issues: [] }, ctx);
7147
7147
  const async = left instanceof Promise || right instanceof Promise;
7148
7148
  if (async) {
7149
7149
  return Promise.all([left, right]).then(([left2, right2]) => {
7150
- return handleIntersectionResults(payload2, left2, right2);
7150
+ return handleIntersectionResults(payload, left2, right2);
7151
7151
  });
7152
7152
  }
7153
- return handleIntersectionResults(payload2, left, right);
7153
+ return handleIntersectionResults(payload, left, right);
7154
7154
  };
7155
7155
  });
7156
7156
  $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
7157
7157
  $ZodType.init(inst, def);
7158
7158
  const items = def.items;
7159
- inst._zod.parse = (payload2, ctx) => {
7160
- const input = payload2.value;
7159
+ inst._zod.parse = (payload, ctx) => {
7160
+ const input = payload.value;
7161
7161
  if (!Array.isArray(input)) {
7162
- payload2.issues.push({
7162
+ payload.issues.push({
7163
7163
  input,
7164
7164
  inst,
7165
7165
  expected: "tuple",
7166
7166
  code: "invalid_type"
7167
7167
  });
7168
- return payload2;
7168
+ return payload;
7169
7169
  }
7170
- payload2.value = [];
7170
+ payload.value = [];
7171
7171
  const proms = [];
7172
7172
  const optinStart = getTupleOptStart(items, "optin");
7173
7173
  const optoutStart = getTupleOptStart(items, "optout");
7174
7174
  if (!def.rest) {
7175
7175
  if (input.length < optinStart) {
7176
- payload2.issues.push({
7176
+ payload.issues.push({
7177
7177
  code: "too_small",
7178
7178
  minimum: optinStart,
7179
7179
  inclusive: true,
@@ -7181,10 +7181,10 @@ var init_schemas = __esm({
7181
7181
  inst,
7182
7182
  origin: "array"
7183
7183
  });
7184
- return payload2;
7184
+ return payload;
7185
7185
  }
7186
7186
  if (input.length > items.length) {
7187
- payload2.issues.push({
7187
+ payload.issues.push({
7188
7188
  code: "too_big",
7189
7189
  maximum: items.length,
7190
7190
  inclusive: true,
@@ -7212,35 +7212,35 @@ var init_schemas = __esm({
7212
7212
  i++;
7213
7213
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
7214
7214
  if (result instanceof Promise) {
7215
- proms.push(result.then((r) => handleTupleResult(r, payload2, i)));
7215
+ proms.push(result.then((r) => handleTupleResult(r, payload, i)));
7216
7216
  } else {
7217
- handleTupleResult(result, payload2, i);
7217
+ handleTupleResult(result, payload, i);
7218
7218
  }
7219
7219
  }
7220
7220
  }
7221
7221
  if (proms.length) {
7222
- return Promise.all(proms).then(() => handleTupleResults(itemResults, payload2, items, input, optoutStart));
7222
+ return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
7223
7223
  }
7224
- return handleTupleResults(itemResults, payload2, items, input, optoutStart);
7224
+ return handleTupleResults(itemResults, payload, items, input, optoutStart);
7225
7225
  };
7226
7226
  });
7227
7227
  $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
7228
7228
  $ZodType.init(inst, def);
7229
- inst._zod.parse = (payload2, ctx) => {
7230
- const input = payload2.value;
7229
+ inst._zod.parse = (payload, ctx) => {
7230
+ const input = payload.value;
7231
7231
  if (!isPlainObject(input)) {
7232
- payload2.issues.push({
7232
+ payload.issues.push({
7233
7233
  expected: "record",
7234
7234
  code: "invalid_type",
7235
7235
  input,
7236
7236
  inst
7237
7237
  });
7238
- return payload2;
7238
+ return payload;
7239
7239
  }
7240
7240
  const proms = [];
7241
7241
  const values = def.keyType._zod.values;
7242
7242
  if (values) {
7243
- payload2.value = {};
7243
+ payload.value = {};
7244
7244
  const recordKeys = /* @__PURE__ */ new Set();
7245
7245
  for (const key of values) {
7246
7246
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
@@ -7250,7 +7250,7 @@ var init_schemas = __esm({
7250
7250
  throw new Error("Async schemas not supported in object keys currently");
7251
7251
  }
7252
7252
  if (keyResult.issues.length) {
7253
- payload2.issues.push({
7253
+ payload.issues.push({
7254
7254
  code: "invalid_key",
7255
7255
  origin: "record",
7256
7256
  issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
@@ -7265,15 +7265,15 @@ var init_schemas = __esm({
7265
7265
  if (result instanceof Promise) {
7266
7266
  proms.push(result.then((result2) => {
7267
7267
  if (result2.issues.length) {
7268
- payload2.issues.push(...prefixIssues(key, result2.issues));
7268
+ payload.issues.push(...prefixIssues(key, result2.issues));
7269
7269
  }
7270
- payload2.value[outKey] = result2.value;
7270
+ payload.value[outKey] = result2.value;
7271
7271
  }));
7272
7272
  } else {
7273
7273
  if (result.issues.length) {
7274
- payload2.issues.push(...prefixIssues(key, result.issues));
7274
+ payload.issues.push(...prefixIssues(key, result.issues));
7275
7275
  }
7276
- payload2.value[outKey] = result.value;
7276
+ payload.value[outKey] = result.value;
7277
7277
  }
7278
7278
  }
7279
7279
  }
@@ -7285,7 +7285,7 @@ var init_schemas = __esm({
7285
7285
  }
7286
7286
  }
7287
7287
  if (unrecognized && unrecognized.length > 0) {
7288
- payload2.issues.push({
7288
+ payload.issues.push({
7289
7289
  code: "unrecognized_keys",
7290
7290
  input,
7291
7291
  inst,
@@ -7293,7 +7293,7 @@ var init_schemas = __esm({
7293
7293
  });
7294
7294
  }
7295
7295
  } else {
7296
- payload2.value = {};
7296
+ payload.value = {};
7297
7297
  for (const key of Reflect.ownKeys(input)) {
7298
7298
  if (key === "__proto__")
7299
7299
  continue;
@@ -7315,9 +7315,9 @@ var init_schemas = __esm({
7315
7315
  }
7316
7316
  if (keyResult.issues.length) {
7317
7317
  if (def.mode === "loose") {
7318
- payload2.value[key] = input[key];
7318
+ payload.value[key] = input[key];
7319
7319
  } else {
7320
- payload2.issues.push({
7320
+ payload.issues.push({
7321
7321
  code: "invalid_key",
7322
7322
  origin: "record",
7323
7323
  issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
@@ -7332,80 +7332,80 @@ var init_schemas = __esm({
7332
7332
  if (result instanceof Promise) {
7333
7333
  proms.push(result.then((result2) => {
7334
7334
  if (result2.issues.length) {
7335
- payload2.issues.push(...prefixIssues(key, result2.issues));
7335
+ payload.issues.push(...prefixIssues(key, result2.issues));
7336
7336
  }
7337
- payload2.value[keyResult.value] = result2.value;
7337
+ payload.value[keyResult.value] = result2.value;
7338
7338
  }));
7339
7339
  } else {
7340
7340
  if (result.issues.length) {
7341
- payload2.issues.push(...prefixIssues(key, result.issues));
7341
+ payload.issues.push(...prefixIssues(key, result.issues));
7342
7342
  }
7343
- payload2.value[keyResult.value] = result.value;
7343
+ payload.value[keyResult.value] = result.value;
7344
7344
  }
7345
7345
  }
7346
7346
  }
7347
7347
  if (proms.length) {
7348
- return Promise.all(proms).then(() => payload2);
7348
+ return Promise.all(proms).then(() => payload);
7349
7349
  }
7350
- return payload2;
7350
+ return payload;
7351
7351
  };
7352
7352
  });
7353
7353
  $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
7354
7354
  $ZodType.init(inst, def);
7355
- inst._zod.parse = (payload2, ctx) => {
7356
- const input = payload2.value;
7355
+ inst._zod.parse = (payload, ctx) => {
7356
+ const input = payload.value;
7357
7357
  if (!(input instanceof Map)) {
7358
- payload2.issues.push({
7358
+ payload.issues.push({
7359
7359
  expected: "map",
7360
7360
  code: "invalid_type",
7361
7361
  input,
7362
7362
  inst
7363
7363
  });
7364
- return payload2;
7364
+ return payload;
7365
7365
  }
7366
7366
  const proms = [];
7367
- payload2.value = /* @__PURE__ */ new Map();
7367
+ payload.value = /* @__PURE__ */ new Map();
7368
7368
  for (const [key, value] of input) {
7369
7369
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
7370
7370
  const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
7371
7371
  if (keyResult instanceof Promise || valueResult instanceof Promise) {
7372
7372
  proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
7373
- handleMapResult(keyResult2, valueResult2, payload2, key, input, inst, ctx);
7373
+ handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);
7374
7374
  }));
7375
7375
  } else {
7376
- handleMapResult(keyResult, valueResult, payload2, key, input, inst, ctx);
7376
+ handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
7377
7377
  }
7378
7378
  }
7379
7379
  if (proms.length)
7380
- return Promise.all(proms).then(() => payload2);
7381
- return payload2;
7380
+ return Promise.all(proms).then(() => payload);
7381
+ return payload;
7382
7382
  };
7383
7383
  });
7384
7384
  $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
7385
7385
  $ZodType.init(inst, def);
7386
- inst._zod.parse = (payload2, ctx) => {
7387
- const input = payload2.value;
7386
+ inst._zod.parse = (payload, ctx) => {
7387
+ const input = payload.value;
7388
7388
  if (!(input instanceof Set)) {
7389
- payload2.issues.push({
7389
+ payload.issues.push({
7390
7390
  input,
7391
7391
  inst,
7392
7392
  expected: "set",
7393
7393
  code: "invalid_type"
7394
7394
  });
7395
- return payload2;
7395
+ return payload;
7396
7396
  }
7397
7397
  const proms = [];
7398
- payload2.value = /* @__PURE__ */ new Set();
7398
+ payload.value = /* @__PURE__ */ new Set();
7399
7399
  for (const item of input) {
7400
7400
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
7401
7401
  if (result instanceof Promise) {
7402
- proms.push(result.then((result2) => handleSetResult(result2, payload2)));
7402
+ proms.push(result.then((result2) => handleSetResult(result2, payload)));
7403
7403
  } else
7404
- handleSetResult(result, payload2);
7404
+ handleSetResult(result, payload);
7405
7405
  }
7406
7406
  if (proms.length)
7407
- return Promise.all(proms).then(() => payload2);
7408
- return payload2;
7407
+ return Promise.all(proms).then(() => payload);
7408
+ return payload;
7409
7409
  };
7410
7410
  });
7411
7411
  $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
@@ -7414,18 +7414,18 @@ var init_schemas = __esm({
7414
7414
  const valuesSet = new Set(values);
7415
7415
  inst._zod.values = valuesSet;
7416
7416
  inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
7417
- inst._zod.parse = (payload2, _ctx) => {
7418
- const input = payload2.value;
7417
+ inst._zod.parse = (payload, _ctx) => {
7418
+ const input = payload.value;
7419
7419
  if (valuesSet.has(input)) {
7420
- return payload2;
7420
+ return payload;
7421
7421
  }
7422
- payload2.issues.push({
7422
+ payload.issues.push({
7423
7423
  code: "invalid_value",
7424
7424
  values,
7425
7425
  input,
7426
7426
  inst
7427
7427
  });
7428
- return payload2;
7428
+ return payload;
7429
7429
  };
7430
7430
  });
7431
7431
  $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
@@ -7436,57 +7436,57 @@ var init_schemas = __esm({
7436
7436
  const values = new Set(def.values);
7437
7437
  inst._zod.values = values;
7438
7438
  inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
7439
- inst._zod.parse = (payload2, _ctx) => {
7440
- const input = payload2.value;
7439
+ inst._zod.parse = (payload, _ctx) => {
7440
+ const input = payload.value;
7441
7441
  if (values.has(input)) {
7442
- return payload2;
7442
+ return payload;
7443
7443
  }
7444
- payload2.issues.push({
7444
+ payload.issues.push({
7445
7445
  code: "invalid_value",
7446
7446
  values: def.values,
7447
7447
  input,
7448
7448
  inst
7449
7449
  });
7450
- return payload2;
7450
+ return payload;
7451
7451
  };
7452
7452
  });
7453
7453
  $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
7454
7454
  $ZodType.init(inst, def);
7455
- inst._zod.parse = (payload2, _ctx) => {
7456
- const input = payload2.value;
7455
+ inst._zod.parse = (payload, _ctx) => {
7456
+ const input = payload.value;
7457
7457
  if (input instanceof File)
7458
- return payload2;
7459
- payload2.issues.push({
7458
+ return payload;
7459
+ payload.issues.push({
7460
7460
  expected: "file",
7461
7461
  code: "invalid_type",
7462
7462
  input,
7463
7463
  inst
7464
7464
  });
7465
- return payload2;
7465
+ return payload;
7466
7466
  };
7467
7467
  });
7468
7468
  $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
7469
7469
  $ZodType.init(inst, def);
7470
7470
  inst._zod.optin = "optional";
7471
- inst._zod.parse = (payload2, ctx) => {
7471
+ inst._zod.parse = (payload, ctx) => {
7472
7472
  if (ctx.direction === "backward") {
7473
7473
  throw new $ZodEncodeError(inst.constructor.name);
7474
7474
  }
7475
- const _out = def.transform(payload2.value, payload2);
7475
+ const _out = def.transform(payload.value, payload);
7476
7476
  if (ctx.async) {
7477
7477
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
7478
7478
  return output.then((output2) => {
7479
- payload2.value = output2;
7480
- payload2.fallback = true;
7481
- return payload2;
7479
+ payload.value = output2;
7480
+ payload.fallback = true;
7481
+ return payload;
7482
7482
  });
7483
7483
  }
7484
7484
  if (_out instanceof Promise) {
7485
7485
  throw new $ZodAsyncError();
7486
7486
  }
7487
- payload2.value = _out;
7488
- payload2.fallback = true;
7489
- return payload2;
7487
+ payload.value = _out;
7488
+ payload.fallback = true;
7489
+ return payload;
7490
7490
  };
7491
7491
  });
7492
7492
  $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
@@ -7500,26 +7500,26 @@ var init_schemas = __esm({
7500
7500
  const pattern = def.innerType._zod.pattern;
7501
7501
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
7502
7502
  });
7503
- inst._zod.parse = (payload2, ctx) => {
7503
+ inst._zod.parse = (payload, ctx) => {
7504
7504
  if (def.innerType._zod.optin === "optional") {
7505
- const input = payload2.value;
7506
- const result = def.innerType._zod.run(payload2, ctx);
7505
+ const input = payload.value;
7506
+ const result = def.innerType._zod.run(payload, ctx);
7507
7507
  if (result instanceof Promise)
7508
7508
  return result.then((r) => handleOptionalResult(r, input));
7509
7509
  return handleOptionalResult(result, input);
7510
7510
  }
7511
- if (payload2.value === void 0) {
7512
- return payload2;
7511
+ if (payload.value === void 0) {
7512
+ return payload;
7513
7513
  }
7514
- return def.innerType._zod.run(payload2, ctx);
7514
+ return def.innerType._zod.run(payload, ctx);
7515
7515
  };
7516
7516
  });
7517
7517
  $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
7518
7518
  $ZodOptional.init(inst, def);
7519
7519
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
7520
7520
  defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
7521
- inst._zod.parse = (payload2, ctx) => {
7522
- return def.innerType._zod.run(payload2, ctx);
7521
+ inst._zod.parse = (payload, ctx) => {
7522
+ return def.innerType._zod.run(payload, ctx);
7523
7523
  };
7524
7524
  });
7525
7525
  $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
@@ -7533,25 +7533,25 @@ var init_schemas = __esm({
7533
7533
  defineLazy(inst._zod, "values", () => {
7534
7534
  return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
7535
7535
  });
7536
- inst._zod.parse = (payload2, ctx) => {
7537
- if (payload2.value === null)
7538
- return payload2;
7539
- return def.innerType._zod.run(payload2, ctx);
7536
+ inst._zod.parse = (payload, ctx) => {
7537
+ if (payload.value === null)
7538
+ return payload;
7539
+ return def.innerType._zod.run(payload, ctx);
7540
7540
  };
7541
7541
  });
7542
7542
  $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
7543
7543
  $ZodType.init(inst, def);
7544
7544
  inst._zod.optin = "optional";
7545
7545
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
7546
- inst._zod.parse = (payload2, ctx) => {
7546
+ inst._zod.parse = (payload, ctx) => {
7547
7547
  if (ctx.direction === "backward") {
7548
- return def.innerType._zod.run(payload2, ctx);
7548
+ return def.innerType._zod.run(payload, ctx);
7549
7549
  }
7550
- if (payload2.value === void 0) {
7551
- payload2.value = def.defaultValue;
7552
- return payload2;
7550
+ if (payload.value === void 0) {
7551
+ payload.value = def.defaultValue;
7552
+ return payload;
7553
7553
  }
7554
- const result = def.innerType._zod.run(payload2, ctx);
7554
+ const result = def.innerType._zod.run(payload, ctx);
7555
7555
  if (result instanceof Promise) {
7556
7556
  return result.then((result2) => handleDefaultResult(result2, def));
7557
7557
  }
@@ -7562,14 +7562,14 @@ var init_schemas = __esm({
7562
7562
  $ZodType.init(inst, def);
7563
7563
  inst._zod.optin = "optional";
7564
7564
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
7565
- inst._zod.parse = (payload2, ctx) => {
7565
+ inst._zod.parse = (payload, ctx) => {
7566
7566
  if (ctx.direction === "backward") {
7567
- return def.innerType._zod.run(payload2, ctx);
7567
+ return def.innerType._zod.run(payload, ctx);
7568
7568
  }
7569
- if (payload2.value === void 0) {
7570
- payload2.value = def.defaultValue;
7569
+ if (payload.value === void 0) {
7570
+ payload.value = def.defaultValue;
7571
7571
  }
7572
- return def.innerType._zod.run(payload2, ctx);
7572
+ return def.innerType._zod.run(payload, ctx);
7573
7573
  };
7574
7574
  });
7575
7575
  $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
@@ -7578,8 +7578,8 @@ var init_schemas = __esm({
7578
7578
  const v = def.innerType._zod.values;
7579
7579
  return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
7580
7580
  });
7581
- inst._zod.parse = (payload2, ctx) => {
7582
- const result = def.innerType._zod.run(payload2, ctx);
7581
+ inst._zod.parse = (payload, ctx) => {
7582
+ const result = def.innerType._zod.run(payload, ctx);
7583
7583
  if (result instanceof Promise) {
7584
7584
  return result.then((result2) => handleNonOptionalResult(result2, inst));
7585
7585
  }
@@ -7588,19 +7588,19 @@ var init_schemas = __esm({
7588
7588
  });
7589
7589
  $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {
7590
7590
  $ZodType.init(inst, def);
7591
- inst._zod.parse = (payload2, ctx) => {
7591
+ inst._zod.parse = (payload, ctx) => {
7592
7592
  if (ctx.direction === "backward") {
7593
7593
  throw new $ZodEncodeError("ZodSuccess");
7594
7594
  }
7595
- const result = def.innerType._zod.run(payload2, ctx);
7595
+ const result = def.innerType._zod.run(payload, ctx);
7596
7596
  if (result instanceof Promise) {
7597
7597
  return result.then((result2) => {
7598
- payload2.value = result2.issues.length === 0;
7599
- return payload2;
7598
+ payload.value = result2.issues.length === 0;
7599
+ return payload;
7600
7600
  });
7601
7601
  }
7602
- payload2.value = result.issues.length === 0;
7603
- return payload2;
7602
+ payload.value = result.issues.length === 0;
7603
+ return payload;
7604
7604
  };
7605
7605
  });
7606
7606
  $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
@@ -7608,56 +7608,56 @@ var init_schemas = __esm({
7608
7608
  inst._zod.optin = "optional";
7609
7609
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
7610
7610
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
7611
- inst._zod.parse = (payload2, ctx) => {
7611
+ inst._zod.parse = (payload, ctx) => {
7612
7612
  if (ctx.direction === "backward") {
7613
- return def.innerType._zod.run(payload2, ctx);
7613
+ return def.innerType._zod.run(payload, ctx);
7614
7614
  }
7615
- const result = def.innerType._zod.run(payload2, ctx);
7615
+ const result = def.innerType._zod.run(payload, ctx);
7616
7616
  if (result instanceof Promise) {
7617
7617
  return result.then((result2) => {
7618
- payload2.value = result2.value;
7618
+ payload.value = result2.value;
7619
7619
  if (result2.issues.length) {
7620
- payload2.value = def.catchValue({
7621
- ...payload2,
7620
+ payload.value = def.catchValue({
7621
+ ...payload,
7622
7622
  error: {
7623
7623
  issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
7624
7624
  },
7625
- input: payload2.value
7625
+ input: payload.value
7626
7626
  });
7627
- payload2.issues = [];
7628
- payload2.fallback = true;
7627
+ payload.issues = [];
7628
+ payload.fallback = true;
7629
7629
  }
7630
- return payload2;
7630
+ return payload;
7631
7631
  });
7632
7632
  }
7633
- payload2.value = result.value;
7633
+ payload.value = result.value;
7634
7634
  if (result.issues.length) {
7635
- payload2.value = def.catchValue({
7636
- ...payload2,
7635
+ payload.value = def.catchValue({
7636
+ ...payload,
7637
7637
  error: {
7638
7638
  issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
7639
7639
  },
7640
- input: payload2.value
7640
+ input: payload.value
7641
7641
  });
7642
- payload2.issues = [];
7643
- payload2.fallback = true;
7642
+ payload.issues = [];
7643
+ payload.fallback = true;
7644
7644
  }
7645
- return payload2;
7645
+ return payload;
7646
7646
  };
7647
7647
  });
7648
7648
  $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => {
7649
7649
  $ZodType.init(inst, def);
7650
- inst._zod.parse = (payload2, _ctx) => {
7651
- if (typeof payload2.value !== "number" || !Number.isNaN(payload2.value)) {
7652
- payload2.issues.push({
7653
- input: payload2.value,
7650
+ inst._zod.parse = (payload, _ctx) => {
7651
+ if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
7652
+ payload.issues.push({
7653
+ input: payload.value,
7654
7654
  inst,
7655
7655
  expected: "nan",
7656
7656
  code: "invalid_type"
7657
7657
  });
7658
- return payload2;
7658
+ return payload;
7659
7659
  }
7660
- return payload2;
7660
+ return payload;
7661
7661
  };
7662
7662
  });
7663
7663
  $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
@@ -7666,15 +7666,15 @@ var init_schemas = __esm({
7666
7666
  defineLazy(inst._zod, "optin", () => def.in._zod.optin);
7667
7667
  defineLazy(inst._zod, "optout", () => def.out._zod.optout);
7668
7668
  defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
7669
- inst._zod.parse = (payload2, ctx) => {
7669
+ inst._zod.parse = (payload, ctx) => {
7670
7670
  if (ctx.direction === "backward") {
7671
- const right = def.out._zod.run(payload2, ctx);
7671
+ const right = def.out._zod.run(payload, ctx);
7672
7672
  if (right instanceof Promise) {
7673
7673
  return right.then((right2) => handlePipeResult(right2, def.in, ctx));
7674
7674
  }
7675
7675
  return handlePipeResult(right, def.in, ctx);
7676
7676
  }
7677
- const left = def.in._zod.run(payload2, ctx);
7677
+ const left = def.in._zod.run(payload, ctx);
7678
7678
  if (left instanceof Promise) {
7679
7679
  return left.then((left2) => handlePipeResult(left2, def.out, ctx));
7680
7680
  }
@@ -7687,16 +7687,16 @@ var init_schemas = __esm({
7687
7687
  defineLazy(inst._zod, "optin", () => def.in._zod.optin);
7688
7688
  defineLazy(inst._zod, "optout", () => def.out._zod.optout);
7689
7689
  defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
7690
- inst._zod.parse = (payload2, ctx) => {
7690
+ inst._zod.parse = (payload, ctx) => {
7691
7691
  const direction = ctx.direction || "forward";
7692
7692
  if (direction === "forward") {
7693
- const left = def.in._zod.run(payload2, ctx);
7693
+ const left = def.in._zod.run(payload, ctx);
7694
7694
  if (left instanceof Promise) {
7695
7695
  return left.then((left2) => handleCodecAResult(left2, def, ctx));
7696
7696
  }
7697
7697
  return handleCodecAResult(left, def, ctx);
7698
7698
  } else {
7699
- const right = def.out._zod.run(payload2, ctx);
7699
+ const right = def.out._zod.run(payload, ctx);
7700
7700
  if (right instanceof Promise) {
7701
7701
  return right.then((right2) => handleCodecAResult(right2, def, ctx));
7702
7702
  }
@@ -7713,11 +7713,11 @@ var init_schemas = __esm({
7713
7713
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
7714
7714
  defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
7715
7715
  defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
7716
- inst._zod.parse = (payload2, ctx) => {
7716
+ inst._zod.parse = (payload, ctx) => {
7717
7717
  if (ctx.direction === "backward") {
7718
- return def.innerType._zod.run(payload2, ctx);
7718
+ return def.innerType._zod.run(payload, ctx);
7719
7719
  }
7720
- const result = def.innerType._zod.run(payload2, ctx);
7720
+ const result = def.innerType._zod.run(payload, ctx);
7721
7721
  if (result instanceof Promise) {
7722
7722
  return result.then(handleReadonlyResult);
7723
7723
  }
@@ -7745,28 +7745,28 @@ var init_schemas = __esm({
7745
7745
  }
7746
7746
  }
7747
7747
  inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
7748
- inst._zod.parse = (payload2, _ctx) => {
7749
- if (typeof payload2.value !== "string") {
7750
- payload2.issues.push({
7751
- input: payload2.value,
7748
+ inst._zod.parse = (payload, _ctx) => {
7749
+ if (typeof payload.value !== "string") {
7750
+ payload.issues.push({
7751
+ input: payload.value,
7752
7752
  inst,
7753
7753
  expected: "string",
7754
7754
  code: "invalid_type"
7755
7755
  });
7756
- return payload2;
7756
+ return payload;
7757
7757
  }
7758
7758
  inst._zod.pattern.lastIndex = 0;
7759
- if (!inst._zod.pattern.test(payload2.value)) {
7760
- payload2.issues.push({
7761
- input: payload2.value,
7759
+ if (!inst._zod.pattern.test(payload.value)) {
7760
+ payload.issues.push({
7761
+ input: payload.value,
7762
7762
  inst,
7763
7763
  code: "invalid_format",
7764
7764
  format: def.format ?? "template_literal",
7765
7765
  pattern: inst._zod.pattern.source
7766
7766
  });
7767
- return payload2;
7767
+ return payload;
7768
7768
  }
7769
- return payload2;
7769
+ return payload;
7770
7770
  };
7771
7771
  });
7772
7772
  $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
@@ -7799,23 +7799,23 @@ var init_schemas = __esm({
7799
7799
  return result;
7800
7800
  };
7801
7801
  };
7802
- inst._zod.parse = (payload2, _ctx) => {
7803
- if (typeof payload2.value !== "function") {
7804
- payload2.issues.push({
7802
+ inst._zod.parse = (payload, _ctx) => {
7803
+ if (typeof payload.value !== "function") {
7804
+ payload.issues.push({
7805
7805
  code: "invalid_type",
7806
7806
  expected: "function",
7807
- input: payload2.value,
7807
+ input: payload.value,
7808
7808
  inst
7809
7809
  });
7810
- return payload2;
7810
+ return payload;
7811
7811
  }
7812
7812
  const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
7813
7813
  if (hasPromiseOutput) {
7814
- payload2.value = inst.implementAsync(payload2.value);
7814
+ payload.value = inst.implementAsync(payload.value);
7815
7815
  } else {
7816
- payload2.value = inst.implement(payload2.value);
7816
+ payload.value = inst.implement(payload.value);
7817
7817
  }
7818
- return payload2;
7818
+ return payload;
7819
7819
  };
7820
7820
  inst.input = (...args) => {
7821
7821
  const F = inst.constructor;
@@ -7848,8 +7848,8 @@ var init_schemas = __esm({
7848
7848
  });
7849
7849
  $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => {
7850
7850
  $ZodType.init(inst, def);
7851
- inst._zod.parse = (payload2, ctx) => {
7852
- return Promise.resolve(payload2.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
7851
+ inst._zod.parse = (payload, ctx) => {
7852
+ return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
7853
7853
  };
7854
7854
  });
7855
7855
  $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
@@ -7864,24 +7864,24 @@ var init_schemas = __esm({
7864
7864
  defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
7865
7865
  defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? void 0);
7866
7866
  defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? void 0);
7867
- inst._zod.parse = (payload2, ctx) => {
7867
+ inst._zod.parse = (payload, ctx) => {
7868
7868
  const inner = inst._zod.innerType;
7869
- return inner._zod.run(payload2, ctx);
7869
+ return inner._zod.run(payload, ctx);
7870
7870
  };
7871
7871
  });
7872
7872
  $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
7873
7873
  $ZodCheck.init(inst, def);
7874
7874
  $ZodType.init(inst, def);
7875
- inst._zod.parse = (payload2, _) => {
7876
- return payload2;
7875
+ inst._zod.parse = (payload, _) => {
7876
+ return payload;
7877
7877
  };
7878
- inst._zod.check = (payload2) => {
7879
- const input = payload2.value;
7878
+ inst._zod.check = (payload) => {
7879
+ const input = payload.value;
7880
7880
  const r = def.fn(input);
7881
7881
  if (r instanceof Promise) {
7882
- return r.then((r2) => handleRefineResult(r2, payload2, input, inst));
7882
+ return r.then((r2) => handleRefineResult(r2, payload, input, inst));
7883
7883
  }
7884
- handleRefineResult(r, payload2, input, inst);
7884
+ handleRefineResult(r, payload, input, inst);
7885
7885
  return;
7886
7886
  };
7887
7887
  });
@@ -15172,22 +15172,22 @@ function _refine(Class2, fn, _params) {
15172
15172
  }
15173
15173
  // @__NO_SIDE_EFFECTS__
15174
15174
  function _superRefine(fn, params) {
15175
- const ch = /* @__PURE__ */ _check((payload2) => {
15176
- payload2.addIssue = (issue2) => {
15175
+ const ch = /* @__PURE__ */ _check((payload) => {
15176
+ payload.addIssue = (issue2) => {
15177
15177
  if (typeof issue2 === "string") {
15178
- payload2.issues.push(issue(issue2, payload2.value, ch._zod.def));
15178
+ payload.issues.push(issue(issue2, payload.value, ch._zod.def));
15179
15179
  } else {
15180
15180
  const _issue = issue2;
15181
15181
  if (_issue.fatal)
15182
15182
  _issue.continue = false;
15183
15183
  _issue.code ?? (_issue.code = "custom");
15184
- _issue.input ?? (_issue.input = payload2.value);
15184
+ _issue.input ?? (_issue.input = payload.value);
15185
15185
  _issue.inst ?? (_issue.inst = ch);
15186
15186
  _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
15187
- payload2.issues.push(issue(_issue));
15187
+ payload.issues.push(issue(_issue));
15188
15188
  }
15189
15189
  };
15190
- return fn(payload2.value, payload2);
15190
+ return fn(payload.value, payload);
15191
15191
  }, params);
15192
15192
  return ch;
15193
15193
  }
@@ -15246,7 +15246,7 @@ function _stringbool(Classes, _params) {
15246
15246
  type: "pipe",
15247
15247
  in: stringSchema,
15248
15248
  out: booleanSchema,
15249
- transform: ((input, payload2) => {
15249
+ transform: ((input, payload) => {
15250
15250
  let data = input;
15251
15251
  if (params.case !== "sensitive")
15252
15252
  data = data.toLowerCase();
@@ -15255,11 +15255,11 @@ function _stringbool(Classes, _params) {
15255
15255
  } else if (falsySet.has(data)) {
15256
15256
  return false;
15257
15257
  } else {
15258
- payload2.issues.push({
15258
+ payload.issues.push({
15259
15259
  code: "invalid_value",
15260
15260
  expected: "stringbool",
15261
15261
  values: [...truthySet, ...falsySet],
15262
- input: payload2.value,
15262
+ input: payload.value,
15263
15263
  inst: codec2,
15264
15264
  continue: false
15265
15265
  });
@@ -17693,12 +17693,12 @@ function _instanceof(cls, params = {}) {
17693
17693
  ...util_exports.normalizeParams(params)
17694
17694
  });
17695
17695
  inst._zod.bag.Class = cls;
17696
- inst._zod.check = (payload2) => {
17697
- if (!(payload2.value instanceof cls)) {
17698
- payload2.issues.push({
17696
+ inst._zod.check = (payload) => {
17697
+ if (!(payload.value instanceof cls)) {
17698
+ payload.issues.push({
17699
17699
  code: "invalid_type",
17700
17700
  expected: cls.name,
17701
- input: payload2.value,
17701
+ input: payload.value,
17702
17702
  inst,
17703
17703
  path: [...inst._zod.def.path ?? []]
17704
17704
  });
@@ -18365,34 +18365,34 @@ var init_schemas3 = __esm({
18365
18365
  $ZodTransform.init(inst, def);
18366
18366
  ZodType2.init(inst, def);
18367
18367
  inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params);
18368
- inst._zod.parse = (payload2, _ctx) => {
18368
+ inst._zod.parse = (payload, _ctx) => {
18369
18369
  if (_ctx.direction === "backward") {
18370
18370
  throw new $ZodEncodeError(inst.constructor.name);
18371
18371
  }
18372
- payload2.addIssue = (issue2) => {
18372
+ payload.addIssue = (issue2) => {
18373
18373
  if (typeof issue2 === "string") {
18374
- payload2.issues.push(util_exports.issue(issue2, payload2.value, def));
18374
+ payload.issues.push(util_exports.issue(issue2, payload.value, def));
18375
18375
  } else {
18376
18376
  const _issue = issue2;
18377
18377
  if (_issue.fatal)
18378
18378
  _issue.continue = false;
18379
18379
  _issue.code ?? (_issue.code = "custom");
18380
- _issue.input ?? (_issue.input = payload2.value);
18380
+ _issue.input ?? (_issue.input = payload.value);
18381
18381
  _issue.inst ?? (_issue.inst = inst);
18382
- payload2.issues.push(util_exports.issue(_issue));
18382
+ payload.issues.push(util_exports.issue(_issue));
18383
18383
  }
18384
18384
  };
18385
- const output = def.transform(payload2.value, payload2);
18385
+ const output = def.transform(payload.value, payload);
18386
18386
  if (output instanceof Promise) {
18387
18387
  return output.then((output2) => {
18388
- payload2.value = output2;
18389
- payload2.fallback = true;
18390
- return payload2;
18388
+ payload.value = output2;
18389
+ payload.fallback = true;
18390
+ return payload;
18391
18391
  });
18392
18392
  }
18393
- payload2.value = output;
18394
- payload2.fallback = true;
18395
- return payload2;
18393
+ payload.value = output;
18394
+ payload.fallback = true;
18395
+ return payload;
18396
18396
  };
18397
18397
  });
18398
18398
  ZodOptional2 = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
@@ -32825,88 +32825,6 @@ var init_clipboard = __esm({
32825
32825
  }
32826
32826
  });
32827
32827
 
32828
- // src/media-url.ts
32829
- var media_url_exports = {};
32830
- __export(media_url_exports, {
32831
- MEDIA_URL_TTL_MS: () => MEDIA_URL_TTL_MS,
32832
- SIGNING_SECRET_KV_KEY: () => SIGNING_SECRET_KV_KEY,
32833
- base64UrlDecode: () => base64UrlDecode,
32834
- base64UrlEncode: () => base64UrlEncode,
32835
- buildMediaUrl: () => buildMediaUrl,
32836
- loadSigningKey: () => loadSigningKey,
32837
- resolveSigningKey: () => resolveSigningKey,
32838
- signMediaKey: () => signMediaKey,
32839
- verifyMediaSignature: () => verifyMediaSignature
32840
- });
32841
- function base64UrlEncode(bytes) {
32842
- const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
32843
- let binary = "";
32844
- for (let i = 0; i < view.length; i++) binary += String.fromCharCode(view[i]);
32845
- return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
32846
- }
32847
- function base64UrlDecode(text) {
32848
- const padded = text.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(text.length / 4) * 4, "=");
32849
- const binary = atob(padded);
32850
- const out = new Uint8Array(binary.length);
32851
- for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
32852
- return out;
32853
- }
32854
- async function importKey(material) {
32855
- return crypto.subtle.importKey("raw", new TextEncoder().encode(material), { name: "HMAC", hash: "SHA-256" }, false, [
32856
- "sign",
32857
- "verify"
32858
- ]);
32859
- }
32860
- async function resolveSigningKey(secret, store) {
32861
- let material = secret?.trim();
32862
- if (!material) {
32863
- material = await store.get(SIGNING_SECRET_KV_KEY) ?? void 0;
32864
- if (!material) {
32865
- const generated = base64UrlEncode(crypto.getRandomValues(new Uint8Array(32)));
32866
- await store.put(SIGNING_SECRET_KV_KEY, generated);
32867
- material = await store.get(SIGNING_SECRET_KV_KEY) ?? generated;
32868
- }
32869
- }
32870
- return importKey(material);
32871
- }
32872
- async function loadSigningKey(secret, store) {
32873
- const material = secret?.trim() || await store.get(SIGNING_SECRET_KV_KEY);
32874
- return material ? importKey(material) : void 0;
32875
- }
32876
- function payload(key, expiresAtMs2) {
32877
- return new TextEncoder().encode(`${key}
32878
- ${expiresAtMs2}`);
32879
- }
32880
- async function signMediaKey(signingKey, key, expiresAtMs2) {
32881
- return base64UrlEncode(await crypto.subtle.sign("HMAC", signingKey, payload(key, expiresAtMs2)));
32882
- }
32883
- async function verifyMediaSignature(signingKey, key, exp, sig, nowMs) {
32884
- if (!exp || !sig) return { ok: false, reason: "missing" };
32885
- const expiresAtMs2 = Number(exp);
32886
- if (!Number.isFinite(expiresAtMs2)) return { ok: false, reason: "invalid" };
32887
- let valid;
32888
- try {
32889
- valid = await crypto.subtle.verify("HMAC", signingKey, base64UrlDecode(sig), payload(key, expiresAtMs2));
32890
- } catch {
32891
- return { ok: false, reason: "invalid" };
32892
- }
32893
- if (!valid) return { ok: false, reason: "invalid" };
32894
- if (nowMs > expiresAtMs2) return { ok: false, reason: "expired" };
32895
- return { ok: true };
32896
- }
32897
- function buildMediaUrl(baseUrl, key, expiresAtMs2, signature) {
32898
- const path = key.split("/").map(encodeURIComponent).join("/");
32899
- return `${baseUrl.replace(/\/+$/, "")}/${path}?exp=${expiresAtMs2}&sig=${signature}`;
32900
- }
32901
- var MEDIA_URL_TTL_MS, SIGNING_SECRET_KV_KEY;
32902
- var init_media_url = __esm({
32903
- "src/media-url.ts"() {
32904
- "use strict";
32905
- MEDIA_URL_TTL_MS = 48 * 60 * 60 * 1e3;
32906
- SIGNING_SECRET_KV_KEY = "media:url-signing-secret";
32907
- }
32908
- });
32909
-
32910
32828
  // src/index.ts
32911
32829
  init_dist();
32912
32830
 
@@ -32920,7 +32838,65 @@ async function loadStdioDotenv() {
32920
32838
  }
32921
32839
 
32922
32840
  // src/version.ts
32923
- var VERSION = "1.6.0";
32841
+ var VERSION = "1.6.2";
32842
+
32843
+ // src/errors.ts
32844
+ init_dist();
32845
+ var MAX_CAUSE_DEPTH = 5;
32846
+ function describeError(err) {
32847
+ const seen = /* @__PURE__ */ new Set();
32848
+ const describe3 = (value, depth) => {
32849
+ if (!(value instanceof Error)) {
32850
+ if (typeof value === "string") return value;
32851
+ try {
32852
+ return typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
32853
+ } catch {
32854
+ return String(value);
32855
+ }
32856
+ }
32857
+ const named = value.name && value.name !== "Error" && value.name !== "McpToolError" ? `${value.name}: ${value.message}` : value.message;
32858
+ const hint = value instanceof McpToolError && value.hint && !value.message.includes(value.hint) ? ` ${value.hint}` : "";
32859
+ const cause = value.cause;
32860
+ if (cause === void 0 || cause === null || depth >= MAX_CAUSE_DEPTH || seen.has(cause)) {
32861
+ return `${named}${hint}`;
32862
+ }
32863
+ seen.add(cause);
32864
+ return `${named}${hint} [caused by: ${describe3(cause, depth + 1)}]`;
32865
+ };
32866
+ seen.add(err);
32867
+ return describe3(err, 0);
32868
+ }
32869
+ async function step(label, run) {
32870
+ try {
32871
+ return await run();
32872
+ } catch (err) {
32873
+ if (err instanceof StepError) throw err;
32874
+ throw new StepError(`${label}: ${describeError(err)}`, err);
32875
+ }
32876
+ }
32877
+ var StepError = class extends McpToolError {
32878
+ constructor(message, cause) {
32879
+ super(message, { cause });
32880
+ this.name = "McpToolError";
32881
+ }
32882
+ };
32883
+ function surfaceToolErrors(server) {
32884
+ return new Proxy(server, {
32885
+ get(target, prop, receiver) {
32886
+ const value = Reflect.get(target, prop, receiver);
32887
+ if (prop !== "registerTool" || typeof value !== "function") {
32888
+ return typeof value === "function" ? value.bind(target) : value;
32889
+ }
32890
+ return (name, config2, handler) => value.call(target, name, config2, async (...args) => {
32891
+ try {
32892
+ return await handler(...args);
32893
+ } catch (err) {
32894
+ throw new McpToolError(`${name} failed: ${describeError(err)}`, { cause: err });
32895
+ }
32896
+ });
32897
+ }
32898
+ });
32899
+ }
32924
32900
 
32925
32901
  // src/tools/models.ts
32926
32902
  init_dist();
@@ -33355,6 +33331,22 @@ init_zod();
33355
33331
  init_dist();
33356
33332
  init_images();
33357
33333
 
33334
+ // src/signed-url.ts
33335
+ function signedObjectUrl(baseUrl, key, params) {
33336
+ const path = key.split("/").map(encodeURIComponent).join("/");
33337
+ const query = new URLSearchParams();
33338
+ for (const [name, value] of Object.entries(params)) query.set(name, String(value));
33339
+ return `${baseUrl.replace(/\/+$/, "")}/${path}?${query}`;
33340
+ }
33341
+ function signedLinks(baseUrl) {
33342
+ const base = baseUrl.replace(/\/+$/, "");
33343
+ return {
33344
+ base,
33345
+ media: (key, expiresAtMs2, signature) => signedObjectUrl(base, key, { exp: expiresAtMs2, sig: signature }),
33346
+ upload: (key, contentType, expiresAtMs2, signature) => signedObjectUrl(base, key, { ct: contentType.toLowerCase(), exp: expiresAtMs2, sig: signature })
33347
+ };
33348
+ }
33349
+
33358
33350
  // src/storage/media.ts
33359
33351
  function createDiskSink() {
33360
33352
  return {
@@ -33384,7 +33376,7 @@ function createR2Sink(bucket, opts) {
33384
33376
  const now = opts.now ?? (() => /* @__PURE__ */ new Date());
33385
33377
  const randomId = opts.randomId ?? (() => crypto.randomUUID().slice(0, 8));
33386
33378
  const publicBase = opts.publicBaseUrl?.replace(/\/+$/, "");
33387
- const signedBase = opts.signedBaseUrl?.replace(/\/+$/, "");
33379
+ const signedBase = opts.links?.base ?? opts.signedBaseUrl?.replace(/\/+$/, "");
33388
33380
  const ttlMs = opts.urlTtlMs ?? 0;
33389
33381
  const readPrefixes = [prefix, ...opts.readPrefixes ?? []];
33390
33382
  let tenantCache;
@@ -33434,9 +33426,9 @@ function createR2Sink(bucket, opts) {
33434
33426
  async function describe3(key, expiresAtMs2) {
33435
33427
  if (publicBase) return { ref: `${publicBase}/${key}`, key };
33436
33428
  if (signedBase && opts.sign) {
33437
- const { buildMediaUrl: buildMediaUrl2 } = await Promise.resolve().then(() => (init_media_url(), media_url_exports));
33438
33429
  const signature = await opts.sign(key, expiresAtMs2);
33439
- return { ref: buildMediaUrl2(signedBase, key, expiresAtMs2, signature), key, expiresAt: new Date(expiresAtMs2).toISOString() };
33430
+ const link = (opts.links ?? signedLinks(signedBase)).media(key, expiresAtMs2, signature);
33431
+ return { ref: link, key, expiresAt: new Date(expiresAtMs2).toISOString() };
33440
33432
  }
33441
33433
  return { ref: key, key, unavailable: true };
33442
33434
  }
@@ -34504,20 +34496,24 @@ function createR2Library(bucket, opts) {
34504
34496
  };
34505
34497
  }
34506
34498
 
34499
+ // src/media-url.ts
34500
+ var MEDIA_URL_TTL_MS = 48 * 60 * 60 * 1e3;
34501
+
34507
34502
  // src/upload-url.ts
34508
- init_media_url();
34509
34503
  var UPLOAD_URL_TTL_MS = 10 * 60 * 1e3;
34510
34504
  var UPLOAD_MAX_BYTES = 15 * 1024 * 1024;
34511
34505
  var UPLOAD_KEY_PREFIX = "up";
34512
- function buildUploadUrl(baseUrl, key, contentType, expiresAtMs2, signature) {
34513
- const path = key.split("/").map(encodeURIComponent).join("/");
34514
- return `${baseUrl.replace(/\/+$/, "")}/${path}?ct=${encodeURIComponent(contentType.toLowerCase())}&exp=${expiresAtMs2}&sig=${signature}`;
34515
- }
34516
34506
  var RASTER_IMAGE_TYPE_PATTERN = /^image\/(jpeg|png|webp|gif|avif|heic|heif|bmp|tiff)$/i;
34517
34507
  function acceptableUploadType(contentType) {
34518
34508
  return RASTER_IMAGE_TYPE_PATTERN.test(contentType);
34519
34509
  }
34520
34510
  function createUploadUrlMinter(opts) {
34511
+ const links = opts.links ?? (opts.baseUrl ? signedLinks(opts.baseUrl) : void 0);
34512
+ if (!links) {
34513
+ throw new Error(
34514
+ "createUploadUrlMinter requires `links` (preferred) or `baseUrl`: there is nowhere to point a signed upload URL. Hosted, both come from the blob store \u2014 check MCP_BLOB_BASE_URL is set on the deployment."
34515
+ );
34516
+ }
34521
34517
  const now = opts.now ?? (() => /* @__PURE__ */ new Date());
34522
34518
  const randomId = opts.randomId ?? (() => crypto.randomUUID().slice(0, 8));
34523
34519
  const ttlMs = opts.ttlMs ?? UPLOAD_URL_TTL_MS;
@@ -34534,7 +34530,7 @@ function createUploadUrlMinter(opts) {
34534
34530
  const key = `${UPLOAD_KEY_PREFIX}/${tenant}/${day}/${randomId()}-${safeKeySegment(filename)}`;
34535
34531
  const expiresAtMs2 = now().getTime() + ttlMs;
34536
34532
  const signature = await opts.sign(key, ct, expiresAtMs2);
34537
- return { url: buildUploadUrl(opts.baseUrl, key, ct, expiresAtMs2, signature), key, contentType: ct, expiresAtMs: expiresAtMs2 };
34533
+ return { url: links.upload(key, ct, expiresAtMs2, signature), key, contentType: ct, expiresAtMs: expiresAtMs2 };
34538
34534
  }
34539
34535
  };
34540
34536
  }
@@ -34551,7 +34547,7 @@ var DEFAULT_TTL_MS = 60 * 60 * 1e3;
34551
34547
  function base64url3(bytes) {
34552
34548
  return Buffer.from(bytes).toString("base64url");
34553
34549
  }
34554
- async function hmac(secret, payload2) {
34550
+ async function hmac(secret, payload) {
34555
34551
  const key = await crypto.subtle.importKey(
34556
34552
  "raw",
34557
34553
  new TextEncoder().encode(secret),
@@ -34559,10 +34555,18 @@ async function hmac(secret, payload2) {
34559
34555
  false,
34560
34556
  ["sign"]
34561
34557
  );
34562
- return base64url3(await crypto.subtle.sign("HMAC", key, new TextEncoder().encode(payload2)));
34558
+ return base64url3(await crypto.subtle.sign("HMAC", key, new TextEncoder().encode(payload)));
34563
34559
  }
34564
34560
  function prefixFromBaseUrl(baseUrl) {
34565
- const path = new URL(baseUrl).pathname.replace(/^\/+|\/+$/g, "");
34561
+ let parsed;
34562
+ try {
34563
+ parsed = new URL(baseUrl);
34564
+ } catch {
34565
+ throw new Error(
34566
+ `MCP_BLOB_BASE_URL is not a valid URL (got ${JSON.stringify(baseUrl)}). It should look like https://<host>/b/<registrationId> \u2014 check the deployment's environment.`
34567
+ );
34568
+ }
34569
+ const path = parsed.pathname.replace(/^\/+|\/+$/g, "");
34566
34570
  const marker = path.startsWith("b/") ? path.slice(2) : path;
34567
34571
  return marker;
34568
34572
  }
@@ -34574,8 +34578,8 @@ function createBlobBucket(opts) {
34574
34578
  const now = opts.now ?? (() => Date.now());
34575
34579
  const full = (key) => `${prefix}/${key}`;
34576
34580
  const encode3 = (key) => key.split("/").map(encodeURIComponent).join("/");
34577
- async function signedUrl(key, payload2, exp) {
34578
- const sig = await hmac(opts.signingKey, payload2);
34581
+ async function signedUrl(key, payload, exp) {
34582
+ const sig = await hmac(opts.signingKey, payload);
34579
34583
  return `${base}/${encode3(key)}?exp=${exp}&sig=${encodeURIComponent(sig)}`;
34580
34584
  }
34581
34585
  return {
@@ -34590,8 +34594,8 @@ function createBlobBucket(opts) {
34590
34594
  const contentType = options?.httpMetadata?.contentType ?? "application/octet-stream";
34591
34595
  const exp = now() + ttl;
34592
34596
  const permanent = key.startsWith(`${PERMANENT_PREFIX}/`);
34593
- const payload2 = permanent ? WRITE_PERMANENT(full(key), contentType, exp) : WRITE(full(key), contentType, exp);
34594
- const url2 = await signedUrl(key, payload2, exp) + (permanent ? "&retain=permanent" : "");
34597
+ const payload = permanent ? WRITE_PERMANENT(full(key), contentType, exp) : WRITE(full(key), contentType, exp);
34598
+ const url2 = await signedUrl(key, payload, exp) + (permanent ? "&retain=permanent" : "");
34595
34599
  const body = typeof value === "string" ? value : toArrayBuffer(value);
34596
34600
  const res = await doFetch(url2, { method: "PUT", headers: { "content-type": contentType }, body });
34597
34601
  if (!res.ok) throw new Error(`blob put failed (${res.status}) for ${key}`);
@@ -34643,7 +34647,7 @@ function blobStoreFromEnv(env = process.env, overrides = {}) {
34643
34647
  const signingKey = overrides.signingKey ?? env.MCP_BLOB_SIGNING_KEY;
34644
34648
  if (!baseUrl || !signingKey) return void 0;
34645
34649
  const bucket = createBlobBucket({ ...overrides, baseUrl, signingKey });
34646
- return { bucket, baseUrl, signRead: bucket.signRead, signWrite: bucket.signWrite };
34650
+ return { bucket, baseUrl, links: signedLinks(baseUrl), signRead: bucket.signRead, signWrite: bucket.signWrite };
34647
34651
  }
34648
34652
 
34649
34653
  // src/session.ts
@@ -35275,19 +35279,19 @@ var GeminiClient = class {
35275
35279
  const textParts = [];
35276
35280
  const searchQueries = [];
35277
35281
  const searchSuggestions = /* @__PURE__ */ new Set();
35278
- for (const step of data.steps ?? []) {
35279
- if (step.type === "google_search_call") {
35280
- for (const q of step.arguments?.queries ?? []) if (q?.trim()) searchQueries.push(q);
35282
+ for (const step2 of data.steps ?? []) {
35283
+ if (step2.type === "google_search_call") {
35284
+ for (const q of step2.arguments?.queries ?? []) if (q?.trim()) searchQueries.push(q);
35281
35285
  continue;
35282
35286
  }
35283
- if (step.type === "google_search_result") {
35287
+ if (step2.type === "google_search_result") {
35284
35288
  if (searchTypes?.includes("image_search")) {
35285
- for (const r of step.result ?? []) if (r.search_suggestions?.trim()) searchSuggestions.add(r.search_suggestions);
35289
+ for (const r of step2.result ?? []) if (r.search_suggestions?.trim()) searchSuggestions.add(r.search_suggestions);
35286
35290
  }
35287
35291
  continue;
35288
35292
  }
35289
- if (step.type !== "model_output") continue;
35290
- for (const parts of [step.content ?? [], step.summary ?? []]) {
35293
+ if (step2.type !== "model_output") continue;
35294
+ for (const parts of [step2.content ?? [], step2.summary ?? []]) {
35291
35295
  for (const part of parts) {
35292
35296
  const mime = part.mime_type ?? part.mimeType;
35293
35297
  if (part.data) {
@@ -35315,9 +35319,13 @@ function hostedStorage() {
35315
35319
  const tenant = () => tenantIdFor(readEnvVar("GEMINI_API_KEY") ?? "local");
35316
35320
  return {
35317
35321
  mediaSink: createR2Sink(blob.bucket, {
35318
- signedBaseUrl: blob.baseUrl,
35322
+ // The SAME `links` object the minter gets below. Media GETs and upload
35323
+ // PUTs are one store reached two ways; handing each its own base URL is
35324
+ // how the re-host moved the media links to /b/<registrationId>/ and left
35325
+ // the upload links behind. One object, two shapes, no second edit.
35326
+ links: blob.links,
35319
35327
  sign: blob.signRead,
35320
- urlTtlMs: MEDIA_URL_TTL_MS2,
35328
+ urlTtlMs: BLOB_URL_TTL_MS,
35321
35329
  // Hard ceiling on any PER-PERSIST override. `gemini_image_set` asks for
35322
35330
  // a 7-day link (SET_URL_TTL_MS) — reasonable against a bucket we own,
35323
35331
  // but the blob store refuses any signature over 24h, so without this
@@ -35331,10 +35339,10 @@ function hostedStorage() {
35331
35339
  tenant
35332
35340
  }),
35333
35341
  library: createR2Library(blob.bucket, { tenant }),
35334
- uploadUrls: createUploadUrlMinter({ baseUrl: blob.baseUrl, sign: blob.signWrite, tenant })
35342
+ uploadUrls: createUploadUrlMinter({ links: blob.links, sign: blob.signWrite, tenant })
35335
35343
  };
35336
35344
  }
35337
- var MEDIA_URL_TTL_MS2 = 60 * 60 * 1e3;
35345
+ var BLOB_URL_TTL_MS = 24 * 60 * 60 * 1e3;
35338
35346
  var BLOB_MAX_TTL_MS = 24 * 60 * 60 * 1e3;
35339
35347
  var client = new GeminiClient(hostedStorage());
35340
35348
 
@@ -35949,7 +35957,7 @@ function registerUploadUrlTools(server, client2) {
35949
35957
  server.registerTool(
35950
35958
  "gemini_get_upload_url",
35951
35959
  {
35952
- description: `Mint a short-lived (~10 min) signed PUT URL for uploading one reference image to this connector with NO auth headers \u2014 usable from any shell: curl -sS -X PUT -H "Content-Type: image/jpeg" --data-binary @photo.jpg "<upload_url>". The response to the PUT returns an \`r2_key\` to reference the upload: pass it in \`images_r2_keys\` on generation tools, save it permanently with gemini_save_character, or convert it to a ~48h Files API reference with gemini_upload_file({ r2_key }). Prefer this over images_base64 (which costs ~14k tokens per photo) whenever the caller has a shell. Images only, up to ${wholeMb(UPLOAD_MAX_BYTES)}MB.`,
35960
+ description: `Mint a short-lived (~10 min) signed PUT URL for uploading one reference image to this connector with NO auth headers \u2014 usable from any shell: curl -sS -X PUT -H "Content-Type: image/jpeg" --data-binary @photo.jpg "<upload_url>". A 2xx from that PUT means the bytes are stored; the key to reference them is the \`r2_key\` in THIS result (the PUT itself returns no useful body). Pass that r2_key in \`images_r2_keys\` on generation tools, save it permanently with gemini_save_character, or convert it to a ~48h Files API reference with gemini_upload_file({ r2_key }). Prefer this over images_base64 (which costs ~14k tokens per photo) whenever the caller has a shell. Images only, up to ${wholeMb(UPLOAD_MAX_BYTES)}MB. The PUT must send exactly the Content-Type this URL was minted for \u2014 the signature covers it, so a mismatched header is rejected.`,
35953
35961
  annotations: { readOnlyHint: true, openWorldHint: false },
35954
35962
  inputSchema: {
35955
35963
  filename: external_exports.string().min(1).max(120).describe('Filename of the upload (e.g. "finn.jpg") \u2014 sanitized into the object key and the suggested curl command'),
@@ -35957,12 +35965,10 @@ function registerUploadUrlTools(server, client2) {
35957
35965
  }
35958
35966
  },
35959
35967
  async (args) => {
35960
- let minted;
35961
- try {
35962
- minted = await minter.mint(args.filename, args.content_type);
35963
- } catch (err) {
35964
- throw new McpToolError(err instanceof Error ? err.message : String(err));
35965
- }
35968
+ const minted = await step(
35969
+ `minting a signed upload URL for ${args.filename} (${args.content_type})`,
35970
+ () => minter.mint(args.filename, args.content_type)
35971
+ );
35966
35972
  return textResult({
35967
35973
  upload_url: minted.url,
35968
35974
  method: "PUT",
@@ -35971,7 +35977,10 @@ function registerUploadUrlTools(server, client2) {
35971
35977
  expires_at: new Date(minted.expiresAtMs).toISOString(),
35972
35978
  max_bytes: UPLOAD_MAX_BYTES,
35973
35979
  curl_hint: `curl -sS -X PUT -H "Content-Type: ${minted.contentType}" --data-binary @${args.filename} "${minted.url}"`,
35974
- hint: "PUT the raw bytes within ~10 minutes; no Authorization header is needed (the signature in the URL is the auth). Then reference the returned r2_key: images_r2_keys on generation tools (master_images_r2_keys on gemini_image_set), gemini_save_character to keep it with no expiry, or gemini_upload_file({ r2_key }) for a ~48h files/\u2026 reference. Uploads themselves follow the media retention schedule (default 7 days)."
35980
+ // Named for what it is: the PUT's own body is the object store's, not
35981
+ // this connector's, so 2xx is the whole success signal.
35982
+ success_is: "any 2xx from the PUT; the response body is not part of the contract and carries no r2_key",
35983
+ hint: "PUT the raw bytes within ~10 minutes with exactly the Content-Type above; no Authorization header is needed (the signature in the URL is the auth, and it covers the content type). On a 2xx, reference the `r2_key` from THIS result \u2014 not the PUT response: images_r2_keys on generation tools (master_images_r2_keys on gemini_image_set), gemini_save_character to keep it with no expiry, or gemini_upload_file({ r2_key }) for a ~48h files/\u2026 reference. Uploads themselves follow the media retention schedule (default 7 days)."
35975
35984
  });
35976
35985
  }
35977
35986
  );
@@ -36152,26 +36161,27 @@ function registerLibraryTools(server, client2) {
36152
36161
  );
36153
36162
  }
36154
36163
 
36164
+ // src/registrars.ts
36165
+ var reporting = (register) => (server, deps) => register(surfaceToolErrors(server), deps);
36166
+ var TOOL_REGISTRARS = [
36167
+ registerModelTools,
36168
+ registerGenerateTools,
36169
+ registerSetTools,
36170
+ registerInteractTools,
36171
+ registerVideoTools,
36172
+ registerMusicTools,
36173
+ registerJobTools,
36174
+ registerFileTools,
36175
+ registerUploadUrlTools,
36176
+ registerLibraryTools
36177
+ ].map(reporting);
36178
+
36155
36179
  // src/index.ts
36156
36180
  await loadStdioDotenv();
36157
36181
  await runMcp({
36158
36182
  name: "gemini-mcp",
36159
36183
  version: VERSION,
36160
36184
  banner: "[gemini-mcp] This project was developed and is maintained by AI (Claude). Use at your own discretion.",
36161
- tools: [
36162
- registerModelTools,
36163
- registerGenerateTools,
36164
- registerSetTools,
36165
- registerInteractTools,
36166
- registerVideoTools,
36167
- registerMusicTools,
36168
- registerJobTools,
36169
- registerFileTools,
36170
- // Both gate on the client having somewhere to put bytes: hosted with a
36171
- // blob store they register, and on a local install they no-op rather than
36172
- // advertising a tool that cannot work.
36173
- registerUploadUrlTools,
36174
- registerLibraryTools
36175
- ],
36185
+ tools: TOOL_REGISTRARS,
36176
36186
  deps: client
36177
36187
  });