@equinor/fusion-framework-vite-plugin-spa 5.0.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3712,13 +3712,13 @@ function fromIterable(iterable) {
3712
3712
  }
3713
3713
  function fromAsyncIterable(asyncIterable) {
3714
3714
  return new Observable(function (subscriber) {
3715
- process$2(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
3715
+ process$1(asyncIterable, subscriber).catch(function (err) { return subscriber.error(err); });
3716
3716
  });
3717
3717
  }
3718
3718
  function fromReadableStreamLike(readableStream) {
3719
3719
  return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
3720
3720
  }
3721
- function process$2(asyncIterable, subscriber) {
3721
+ function process$1(asyncIterable, subscriber) {
3722
3722
  var asyncIterable_1, asyncIterable_1_1;
3723
3723
  var e_2, _a;
3724
3724
  return __awaiter(this, void 0, void 0, function () {
@@ -4499,16 +4499,23 @@ function jsonStringifyReplacer(_, value) {
4499
4499
  return value.toString();
4500
4500
  return value;
4501
4501
  }
4502
+ // the accessor lives on a shared prototype: an own accessor makes every box a dictionary-mode object (~360 B and a slow load per read against ~100 B and an inlined getter here)
4503
+ class Cached {
4504
+ constructor(getter) {
4505
+ this._getter = getter;
4506
+ this._value = undefined;
4507
+ }
4508
+ get value() {
4509
+ const getter = this._getter;
4510
+ if (getter !== undefined) {
4511
+ this._value = getter();
4512
+ this._getter = undefined;
4513
+ }
4514
+ return this._value;
4515
+ }
4516
+ }
4502
4517
  function cached(getter) {
4503
- return {
4504
- get value() {
4505
- {
4506
- const value = getter();
4507
- Object.defineProperty(this, "value", { value });
4508
- return value;
4509
- }
4510
- },
4511
- };
4518
+ return new Cached(getter);
4512
4519
  }
4513
4520
  function nullish(input) {
4514
4521
  return input === null || input === undefined;
@@ -4535,6 +4542,71 @@ function assignProp(target, prop, value) {
4535
4542
  configurable: true,
4536
4543
  });
4537
4544
  }
4545
+ /**
4546
+ * Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
4547
+ *
4548
+ * Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
4549
+ */
4550
+ function rawShape(def) {
4551
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
4552
+ return desc?.get ? desc.get.raw : desc?.value;
4553
+ }
4554
+ // where a builder reads its source's keys and descriptors, resolving only a shape a def answers for itself. A shape resolves by object spread, so only its enumerable keys are ever part of it.
4555
+ function sourceShape(schema) {
4556
+ return rawShape(schema._zod.def) ?? schema._zod.def.shape;
4557
+ }
4558
+ // a key whose value is not settled yet, self-caching so every read after the first gets the same one
4559
+ function deferProp(target, key, getter) {
4560
+ Object.defineProperty(target, key, {
4561
+ get() {
4562
+ const value = getter();
4563
+ assignProp(this, key, value);
4564
+ return value;
4565
+ },
4566
+ enumerable: true,
4567
+ configurable: true,
4568
+ });
4569
+ }
4570
+ // Writes a settled key. A plain assignment is much cheaper than `defineProperty` and produces the same descriptor, but it runs whatever setter already answers to the key — an accessor this shape deferred, or an inherited one, which `__proto__` has on every object and prototype pollution can add for any name.
4571
+ function putProp(target, key, value) {
4572
+ if (key in target)
4573
+ assignProp(target, key, value);
4574
+ else
4575
+ target[key] = value;
4576
+ }
4577
+ /**
4578
+ * Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
4579
+ *
4580
+ * A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
4581
+ */
4582
+ function mirrorShape(target, source, keys, wrap) {
4583
+ const raw = sourceShape(source);
4584
+ for (const key of keys) {
4585
+ const desc = Object.getOwnPropertyDescriptor(raw, key);
4586
+ if (!desc.enumerable)
4587
+ continue;
4588
+ if (desc.get) {
4589
+ deferProp(target, key, () => {
4590
+ const value = source._zod.def.shape[key];
4591
+ return wrap ? wrap(value, key) : value;
4592
+ });
4593
+ }
4594
+ else
4595
+ putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
4596
+ }
4597
+ }
4598
+ // same, for a plain shape a caller passed rather than a schema's
4599
+ function mirrorProps(target, source) {
4600
+ for (const key of Reflect.ownKeys(source)) {
4601
+ const desc = Object.getOwnPropertyDescriptor(source, key);
4602
+ if (!desc.enumerable)
4603
+ continue;
4604
+ if (desc.get)
4605
+ deferProp(target, key, () => source[key]);
4606
+ else
4607
+ putProp(target, key, desc.value);
4608
+ }
4609
+ }
4538
4610
  function mergeDefs(...defs) {
4539
4611
  const mergedDescriptors = {};
4540
4612
  for (const def of defs) {
@@ -4653,6 +4725,10 @@ const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
4653
4725
  float32: [-34028234663852886e22, 3.4028234663852886e38],
4654
4726
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
4655
4727
  }))();
4728
+ const BIGINT_FORMAT_RANGES = {
4729
+ int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
4730
+ uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
4731
+ };
4656
4732
  function pick(schema, mask) {
4657
4733
  const currDef = schema._zod.def;
4658
4734
  const checks = currDef.checks;
@@ -4660,24 +4736,23 @@ function pick(schema, mask) {
4660
4736
  if (hasChecks) {
4661
4737
  throw new Error(".pick() cannot be used on object schemas containing refinements");
4662
4738
  }
4663
- const def = mergeDefs(schema._zod.def, {
4664
- get shape() {
4665
- const newShape = {};
4666
- // `for...in` skips symbols, so a symbol in the mask would select nothing
4667
- for (const key of Reflect.ownKeys(mask)) {
4668
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
4669
- throw new Error(`Unrecognized key: "${String(key)}"`);
4670
- }
4671
- if (!mask[key])
4672
- continue;
4673
- assignProp(newShape, key, currDef.shape[key]);
4674
- }
4675
- assignProp(this, "shape", newShape); // self-caching
4676
- return newShape;
4677
- },
4678
- checks: [],
4679
- });
4680
- return clone(schema, def);
4739
+ const newShape = {};
4740
+ mirrorShape(newShape, schema, maskedKeys(schema, mask));
4741
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
4742
+ }
4743
+ // the mask keys that select something, checked against the source's shape without resolving it
4744
+ function maskedKeys(schema, mask) {
4745
+ const raw = sourceShape(schema);
4746
+ const keys = [];
4747
+ // `for...in` skips symbols, so a symbol in the mask would select nothing
4748
+ for (const key of Reflect.ownKeys(mask)) {
4749
+ if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
4750
+ throw new Error(`Unrecognized key: "${String(key)}"`);
4751
+ }
4752
+ if (mask[key])
4753
+ keys.push(key);
4754
+ }
4755
+ return keys;
4681
4756
  }
4682
4757
  function omit(schema, mask) {
4683
4758
  const currDef = schema._zod.def;
@@ -4686,23 +4761,10 @@ function omit(schema, mask) {
4686
4761
  if (hasChecks) {
4687
4762
  throw new Error(".omit() cannot be used on object schemas containing refinements");
4688
4763
  }
4689
- const def = mergeDefs(schema._zod.def, {
4690
- get shape() {
4691
- const newShape = { ...schema._zod.def.shape };
4692
- for (const key of Reflect.ownKeys(mask)) {
4693
- if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
4694
- throw new Error(`Unrecognized key: "${String(key)}"`);
4695
- }
4696
- if (!mask[key])
4697
- continue;
4698
- delete newShape[key];
4699
- }
4700
- assignProp(this, "shape", newShape); // self-caching
4701
- return newShape;
4702
- },
4703
- checks: [],
4704
- });
4705
- return clone(schema, def);
4764
+ const omitted = new Set(maskedKeys(schema, mask));
4765
+ const newShape = {};
4766
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
4767
+ return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
4706
4768
  }
4707
4769
  function extend(schema, shape) {
4708
4770
  if (!isPlainObject$2(shape)) {
@@ -4712,34 +4774,27 @@ function extend(schema, shape) {
4712
4774
  const hasChecks = checks && checks.length > 0;
4713
4775
  if (hasChecks) {
4714
4776
  // Only throw if new shape overlaps with existing shape. Use getOwnPropertyDescriptor to check key existence without accessing values
4715
- const existingShape = schema._zod.def.shape;
4777
+ const existingShape = sourceShape(schema);
4716
4778
  for (const key of Reflect.ownKeys(shape)) {
4717
4779
  if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
4718
4780
  throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
4719
4781
  }
4720
4782
  }
4721
4783
  }
4722
- const def = mergeDefs(schema._zod.def, {
4723
- get shape() {
4724
- const _shape = { ...schema._zod.def.shape, ...shape };
4725
- assignProp(this, "shape", _shape); // self-caching
4726
- return _shape;
4727
- },
4728
- });
4729
- return clone(schema, def);
4784
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
4785
+ }
4786
+ // the source's keys, then the caller's overlaid on top
4787
+ function extended(schema, shape) {
4788
+ const newShape = {};
4789
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
4790
+ mirrorProps(newShape, shape);
4791
+ return newShape;
4730
4792
  }
4731
4793
  function safeExtend(schema, shape) {
4732
4794
  if (!isPlainObject$2(shape)) {
4733
4795
  throw new Error("Invalid input to safeExtend: expected a plain object");
4734
4796
  }
4735
- const def = mergeDefs(schema._zod.def, {
4736
- get shape() {
4737
- const _shape = { ...schema._zod.def.shape, ...shape };
4738
- assignProp(this, "shape", _shape); // self-caching
4739
- return _shape;
4740
- },
4741
- });
4742
- return clone(schema, def);
4797
+ return clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
4743
4798
  }
4744
4799
  function merge(a, b) {
4745
4800
  if (!b?._zod?.def) {
@@ -4748,12 +4803,11 @@ function merge(a, b) {
4748
4803
  if (a._zod.def.checks?.length) {
4749
4804
  throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
4750
4805
  }
4806
+ const newShape = {};
4807
+ mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
4808
+ mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
4751
4809
  const def = mergeDefs(a._zod.def, {
4752
- get shape() {
4753
- const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
4754
- assignProp(this, "shape", _shape); // self-caching
4755
- return _shape;
4756
- },
4810
+ shape: newShape,
4757
4811
  get catchall() {
4758
4812
  return b._zod.def.catchall;
4759
4813
  },
@@ -4768,78 +4822,19 @@ function partial(Class, schema, mask, name = "partial") {
4768
4822
  if (hasChecks) {
4769
4823
  throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
4770
4824
  }
4771
- const def = mergeDefs(schema._zod.def, {
4772
- get shape() {
4773
- const oldShape = schema._zod.def.shape;
4774
- const shape = { ...oldShape };
4775
- if (mask) {
4776
- for (const key of Reflect.ownKeys(mask)) {
4777
- if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
4778
- throw new Error(`Unrecognized key: "${String(key)}"`);
4779
- }
4780
- if (!mask[key])
4781
- continue;
4782
- // if (oldShape[key]!._zod.optin === "optional") continue;
4783
- shape[key] = Class
4784
- ? new Class({
4785
- type: "optional",
4786
- innerType: oldShape[key],
4787
- })
4788
- : oldShape[key];
4789
- }
4790
- }
4791
- else {
4792
- // the spread copies symbol keys; `for...in` would not reach them
4793
- for (const key of Reflect.ownKeys(oldShape)) {
4794
- // if (oldShape[key]!._zod.optin === "optional") continue;
4795
- shape[key] = Class
4796
- ? new Class({
4797
- type: "optional",
4798
- innerType: oldShape[key],
4799
- })
4800
- : oldShape[key];
4801
- }
4802
- }
4803
- assignProp(this, "shape", shape); // self-caching
4804
- return shape;
4805
- },
4806
- checks: [],
4807
- });
4808
- return clone(schema, def);
4825
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
4826
+ const newShape = {};
4827
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class &&
4828
+ ((value, key) => (selected && !selected.has(key) ? value : new Class({ type: "optional", innerType: value }))));
4829
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
4809
4830
  }
4810
4831
  function required(Class, schema, mask) {
4811
- const def = mergeDefs(schema._zod.def, {
4812
- get shape() {
4813
- const oldShape = schema._zod.def.shape;
4814
- const shape = { ...oldShape };
4815
- if (mask) {
4816
- for (const key of Reflect.ownKeys(mask)) {
4817
- if (!Object.prototype.hasOwnProperty.call(shape, key)) {
4818
- throw new Error(`Unrecognized key: "${String(key)}"`);
4819
- }
4820
- if (!mask[key])
4821
- continue;
4822
- // overwrite with non-optional
4823
- shape[key] = new Class({
4824
- type: "nonoptional",
4825
- innerType: oldShape[key],
4826
- });
4827
- }
4828
- }
4829
- else {
4830
- for (const key of Reflect.ownKeys(oldShape)) {
4831
- // overwrite with non-optional
4832
- shape[key] = new Class({
4833
- type: "nonoptional",
4834
- innerType: oldShape[key],
4835
- });
4836
- }
4837
- }
4838
- assignProp(this, "shape", shape); // self-caching
4839
- return shape;
4840
- },
4841
- });
4842
- return clone(schema, def);
4832
+ const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
4833
+ const newShape = {};
4834
+ mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) =>
4835
+ // overwrite with non-optional
4836
+ selected && !selected.has(key) ? value : new Class({ type: "nonoptional", innerType: value }));
4837
+ return clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
4843
4838
  }
4844
4839
  // invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
4845
4840
  function aborted(x, startIndex = 0) {
@@ -4901,13 +4896,19 @@ function finalizeIssue(iss, ctx, config) {
4901
4896
  unwrapMessage(config.customError?.(iss)) ??
4902
4897
  unwrapMessage(config.localeError?.(iss)) ??
4903
4898
  "Invalid input");
4904
- const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
4905
- rest.path ?? (rest.path = []);
4906
- rest.message = message;
4899
+ // an explicit own-key copy beats object rest with excluded keys, which v8 routes through a generic runtime call; Object.keys rather than for-in so an issue pushed with a prototype does not leak inherited keys, and an own __proto__ key is dropped rather than assigned through the setter
4900
+ const full = {};
4901
+ for (const k of Object.keys(iss)) {
4902
+ if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
4903
+ continue;
4904
+ full[k] = iss[k];
4905
+ }
4906
+ full.path ?? (full.path = []);
4907
+ full.message = message;
4907
4908
  if (ctx?.reportInput) {
4908
- rest.input = _input;
4909
+ full.input = iss.input;
4909
4910
  }
4910
- return rest;
4911
+ return full;
4911
4912
  }
4912
4913
  const highSurrogate = /[\uD800-\uDBFF]/;
4913
4914
  // Code points in `str`: a surrogate pair counts once, a lone surrogate as itself. Hand-rolled because the string iterator allocates and runs ~250x slower on this path; the regex probe exits ~50x quicker for a string with no astral characters.
@@ -4992,6 +4993,24 @@ function own(inst, key, value, enumerable = true) {
4992
4993
  function hide(inst, key, value) {
4993
4994
  return own(inst, key, value, false);
4994
4995
  }
4996
+ /** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
4997
+ function derived(computes, table) {
4998
+ for (const key in computes) {
4999
+ const compute = computes[key];
5000
+ // an object literal's accessor is configurable and enumerable, and `members` copies the descriptor as written
5001
+ Object.defineProperty(table, key, {
5002
+ configurable: true,
5003
+ enumerable: true,
5004
+ get() {
5005
+ return own(this, key, compute(this));
5006
+ },
5007
+ set(value) {
5008
+ own(this, key, value);
5009
+ },
5010
+ });
5011
+ }
5012
+ return table;
5013
+ }
4995
5014
  function defineBound(proto, key, fn) {
4996
5015
  Object.defineProperty(proto, key, {
4997
5016
  configurable: true,
@@ -5104,7 +5123,7 @@ const NEVER = /*@__PURE__*/ Object.freeze({
5104
5123
  });
5105
5124
  /* Shared descriptor for installing `_zod`; defineProperty reads it
5106
5125
  * synchronously, so reusing one object avoids a per-instance allocation. */
5107
- const _zodDesc$1 = { value: undefined, enumerable: false };
5126
+ const _zodDesc = { value: undefined, enumerable: false };
5108
5127
  // null where suppressing the capture would be unrecoverable: `parse()` puts the frames back with `captureStackTrace`, so without it the throw would lose its stack. also latched to null once `stackTraceLimit` proves unassignable, which a realm can do at any point by hardening Error
5109
5128
  let _E = "captureStackTrace" in Error ? Error : null;
5110
5129
  // v8 captures a stack trace inside the Error constructor, which dominates a failed parse; costs only the frames, and parse() restores those. the constructor must RUN: Object.create is cheaper and passes instanceof, but Error.isError and util.types.isNativeError check an internal slot
@@ -5147,16 +5166,16 @@ proto, params) {
5147
5166
  const initialized = protoMembers && new WeakSet();
5148
5167
  function init(inst, def) {
5149
5168
  if (!inst._zod) {
5150
- _zodDesc$1.value = new Internals(def);
5169
+ _zodDesc.value = new Internals(def);
5151
5170
  try {
5152
- Object.defineProperty(inst, "_zod", _zodDesc$1);
5171
+ Object.defineProperty(inst, "_zod", _zodDesc);
5153
5172
  }
5154
5173
  finally {
5155
5174
  // Cleared even on throw, so the shared descriptor never leaks one instance's internals into the next.
5156
- _zodDesc$1.value = undefined;
5175
+ _zodDesc.value = undefined;
5157
5176
  }
5158
5177
  }
5159
- if (inst._zod.traits.has(name)) {
5178
+ else if (inst._zod.traits.has(name)) {
5160
5179
  return;
5161
5180
  }
5162
5181
  inst._zod.traits.add(name);
@@ -5256,7 +5275,6 @@ const _messageDesc = {
5256
5275
  enumerable: true,
5257
5276
  configurable: true,
5258
5277
  };
5259
- const _zodDesc = { value: undefined, enumerable: false };
5260
5278
  const _issuesDesc = { value: undefined, enumerable: false };
5261
5279
  /* Prototypes that already carry the lazy `toString`. Seeded with the
5262
5280
  * intrinsics so that `init` on a foreign object — it accepts any object —
@@ -5264,12 +5282,10 @@ const _issuesDesc = { value: undefined, enumerable: false };
5264
5282
  const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
5265
5283
  const initializer$1 = (inst, def) => {
5266
5284
  inst.name = "$ZodError";
5267
- _zodDesc.value = inst._zod;
5268
- Object.defineProperty(inst, "_zod", _zodDesc);
5285
+ // `_zod` is already non-enumerable: $constructor's init defined it with this same descriptor
5269
5286
  _issuesDesc.value = def;
5270
5287
  Object.defineProperty(inst, "issues", _issuesDesc);
5271
- // Clear the shared slots; a retained `value` pins the last error's issues.
5272
- _zodDesc.value = undefined;
5288
+ // Clear the shared slot; a retained `value` pins the last error's issues.
5273
5289
  _issuesDesc.value = undefined;
5274
5290
  Object.defineProperty(inst, "message", _messageDesc);
5275
5291
  /* `toString` lives as a non-enumerable lazy getter on the shared
@@ -5293,9 +5309,6 @@ const initializer$1 = (inst, def) => {
5293
5309
  }
5294
5310
  };
5295
5311
  const $ZodError = $constructor("$ZodError", initializer$1);
5296
- const $ZodRealError = $constructor("$ZodError", initializer$1, undefined, {
5297
- Parent: Error,
5298
- });
5299
5312
  /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
5300
5313
  * ("toString", "constructor") would otherwise read through to the prototype, and assigning
5301
5314
  * "__proto__" would hit the setter instead of creating a key. */
@@ -5424,27 +5437,81 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
5424
5437
  if (result instanceof Promise) {
5425
5438
  throw new $ZodAsyncError();
5426
5439
  }
5427
- return result.issues.length
5428
- ? {
5429
- success: false,
5430
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))),
5431
- }
5432
- : { success: true, data: result.value };
5440
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
5433
5441
  };
5434
- const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
5442
+ // the error is built on the first read of `error`: finalizing the issues and constructing the instance is most of a failing parse, and a caller that only branches on `success` never pays it. a getter in the literal keeps this small; the alternative, one shared accessor descriptor plus a hidden state slot, reads ~15% faster but costs ~75 B gzipped in every bundle
5443
+ function failure(Err, issues, ctx) {
5444
+ let error;
5445
+ return {
5446
+ success: false,
5447
+ get error() {
5448
+ if (!error) {
5449
+ error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, config())));
5450
+ // finalizeIssue drops `input`, so the built error holds nothing; keeping the raw issues past this point pins the parsed value for the life of the result
5451
+ issues = undefined;
5452
+ ctx = undefined;
5453
+ }
5454
+ return error;
5455
+ },
5456
+ set error(e) {
5457
+ error = e;
5458
+ // a replacement makes the getter's branch unreachable, so the captures have to go here too
5459
+ issues = undefined;
5460
+ ctx = undefined;
5461
+ },
5462
+ };
5463
+ }
5435
5464
  const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
5436
5465
  const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
5437
5466
  let result = schema._zod.run({ value, issues: [] }, ctx);
5438
5467
  if (result instanceof Promise)
5439
5468
  result = await result;
5440
- return result.issues.length
5441
- ? {
5442
- success: false,
5443
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))),
5444
- }
5445
- : { success: true, data: result.value };
5469
+ return result.issues.length ? failure(_Err, result.issues, ctx) : { success: true, data: result.value };
5470
+ };
5471
+ // registry mirrors of the compiler's sentinels, so this module never imports the compiler
5472
+ const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
5473
+ const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
5474
+ // Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.
5475
+ const validate = ((schema, value, _ctx) => {
5476
+ const validator = schema._zod.bag.validator;
5477
+ if (validator !== undefined) {
5478
+ if (validator(value) !== COMPILE_INVALID)
5479
+ return true;
5480
+ // a definite sentinel means the runtime would reject, so skip the re-parse; a ctx can still change the answer
5481
+ if (validator.definite === true && _ctx === undefined)
5482
+ return false;
5483
+ }
5484
+ return validateFallback(schema, value, _ctx);
5485
+ });
5486
+ function validateFallback(schema, value, _ctx) {
5487
+ const ctx = _ctx
5488
+ ? { ..._ctx, async: false, abortEarly: true }
5489
+ : { async: false, abortEarly: true };
5490
+ const fallbackRun = schema._zod.bag.fallbackRun;
5491
+ let result;
5492
+ if (fallbackRun) {
5493
+ // skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound
5494
+ ctx[COMPILE_FALLBACK] = true;
5495
+ result = fallbackRun({ value, issues: [] }, ctx);
5496
+ }
5497
+ else {
5498
+ result = schema._zod.run({ value, issues: [] }, ctx);
5499
+ }
5500
+ if (result instanceof Promise) {
5501
+ throw new $ZodAsyncError();
5502
+ }
5503
+ return result.issues.length === 0;
5504
+ }
5505
+ // no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
5506
+ const validateAsync$1 = async (schema, value, _ctx) => {
5507
+ const ctx = _ctx
5508
+ ? { ..._ctx, async: true, abortEarly: true }
5509
+ : { async: true, abortEarly: true };
5510
+ let result = schema._zod.run({ value, issues: [] }, ctx);
5511
+ if (result instanceof Promise)
5512
+ result = await result;
5513
+ return result.issues.length === 0;
5446
5514
  };
5447
- const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
5448
5515
  const _encode = (_Err) => {
5449
5516
  const parse = _parse(_Err);
5450
5517
  const fn = (schema, value, _ctx, _params) => {
@@ -5517,10 +5584,10 @@ const uuid = (version) => {
5517
5584
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
5518
5585
  };
5519
5586
  /** Practical email validation */
5520
- const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
5587
+ const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
5521
5588
  // from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
5522
- // Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match.
5523
- const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
5589
+ // Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match. The leading lookahead then demands one anchor — a pictograph, a regional indicator, or the enclosing keycap — because `\p{Emoji_Component}` on its own covers ASCII digits, `#`, `*`, ZWJ, variation selectors and skin tone modifiers, none of which is an emoji without a base.
5590
+ const _emoji$1 = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
5524
5591
  function emoji() {
5525
5592
  return new RegExp(_emoji$1, "u");
5526
5593
  }
@@ -5530,7 +5597,7 @@ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-
5530
5597
  const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
5531
5598
  // https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
5532
5599
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
5533
- const base64url = /^[A-Za-z0-9_-]*$/;
5600
+ const base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
5534
5601
  const httpProtocol = /^https?$/;
5535
5602
  // https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces) E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15
5536
5603
  const e164 = /^\+[1-9]\d{6,14}$/;
@@ -5567,10 +5634,8 @@ function datetime(args) {
5567
5634
  const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
5568
5635
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
5569
5636
  }
5570
- const string$1 = (params) => {
5571
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
5572
- return new RegExp(`^${regex}$`);
5573
- };
5637
+ // the unbounded form of `string()` as a literal, so every plain string shares one instance instead of building its own
5638
+ const anyString = /^[\s\S]{0,}$/;
5574
5639
  const integer = /^-?\d+$/;
5575
5640
  const number$1 = /^-?\d+(?:\.\d+)?$/;
5576
5641
  const boolean$1 = /^(?:true|false)$/i;
@@ -5599,16 +5664,6 @@ const numericOriginMap = {
5599
5664
  const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
5600
5665
  $ZodCheck.init(inst, def);
5601
5666
  const origin = numericOriginMap[typeof def.value];
5602
- inst._zod.onattach.push((inst) => {
5603
- const bag = inst._zod.bag;
5604
- const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
5605
- if (def.value < curr) {
5606
- if (def.inclusive)
5607
- bag.maximum = def.value;
5608
- else
5609
- bag.exclusiveMaximum = def.value;
5610
- }
5611
- });
5612
5667
  inst._zod.check = (payload) => {
5613
5668
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
5614
5669
  return;
@@ -5627,16 +5682,6 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
5627
5682
  const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
5628
5683
  $ZodCheck.init(inst, def);
5629
5684
  const origin = numericOriginMap[typeof def.value];
5630
- inst._zod.onattach.push((inst) => {
5631
- const bag = inst._zod.bag;
5632
- const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
5633
- if (def.value > curr) {
5634
- if (def.inclusive)
5635
- bag.minimum = def.value;
5636
- else
5637
- bag.exclusiveMinimum = def.value;
5638
- }
5639
- });
5640
5685
  inst._zod.check = (payload) => {
5641
5686
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
5642
5687
  return;
@@ -5655,10 +5700,6 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
5655
5700
  const $ZodCheckMultipleOf =
5656
5701
  /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
5657
5702
  $ZodCheck.init(inst, def);
5658
- inst._zod.onattach.push((inst) => {
5659
- var _a;
5660
- (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
5661
- });
5662
5703
  inst._zod.check = (payload) => {
5663
5704
  if (typeof payload.value !== typeof def.value)
5664
5705
  throw new Error("Cannot mix number and bigint in multiple_of check.");
@@ -5684,14 +5725,6 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
5684
5725
  const isInt = def.format?.includes("int");
5685
5726
  const origin = isInt ? "int" : "number";
5686
5727
  const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
5687
- inst._zod.onattach.push((inst) => {
5688
- const bag = inst._zod.bag;
5689
- bag.format = def.format;
5690
- bag.minimum = minimum;
5691
- bag.maximum = maximum;
5692
- if (isInt)
5693
- bag.pattern = integer;
5694
- });
5695
5728
  inst._zod.check = (payload) => {
5696
5729
  const input = payload.value;
5697
5730
  if (isInt) {
@@ -5781,11 +5814,6 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
5781
5814
  var _a;
5782
5815
  $ZodCheck.init(inst, def);
5783
5816
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
5784
- inst._zod.onattach.push((inst) => {
5785
- const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
5786
- if (def.maximum < curr)
5787
- inst._zod.bag.maximum = def.maximum;
5788
- });
5789
5817
  inst._zod.check = (payload) => {
5790
5818
  const input = payload.value;
5791
5819
  const units = input.length;
@@ -5809,11 +5837,6 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
5809
5837
  var _a;
5810
5838
  $ZodCheck.init(inst, def);
5811
5839
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
5812
- inst._zod.onattach.push((inst) => {
5813
- const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
5814
- if (def.minimum > curr)
5815
- inst._zod.bag.minimum = def.minimum;
5816
- });
5817
5840
  inst._zod.check = (payload) => {
5818
5841
  const input = payload.value;
5819
5842
  const units = input.length;
@@ -5839,12 +5862,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
5839
5862
  var _a;
5840
5863
  $ZodCheck.init(inst, def);
5841
5864
  (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
5842
- inst._zod.onattach.push((inst) => {
5843
- const bag = inst._zod.bag;
5844
- bag.minimum = def.length;
5845
- bag.maximum = def.length;
5846
- bag.length = def.length;
5847
- });
5848
5865
  inst._zod.check = (payload) => {
5849
5866
  const input = payload.value;
5850
5867
  const units = input.length;
@@ -5870,14 +5887,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
5870
5887
  const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
5871
5888
  var _a, _b;
5872
5889
  $ZodCheck.init(inst, def);
5873
- inst._zod.onattach.push((inst) => {
5874
- const bag = inst._zod.bag;
5875
- bag.format = def.format;
5876
- if (def.pattern) {
5877
- bag.patterns ?? (bag.patterns = new Set());
5878
- bag.patterns.add(def.pattern);
5879
- }
5880
- });
5881
5890
  if (def.pattern)
5882
5891
  (_a = inst._zod).check ?? (_a.check = (payload) => {
5883
5892
  def.pattern.lastIndex = 0;
@@ -5929,11 +5938,6 @@ const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst,
5929
5938
  // (`{N,}`), not exactly `position` chars (`{N}`).
5930
5939
  const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
5931
5940
  def.pattern = pattern;
5932
- inst._zod.onattach.push((inst) => {
5933
- const bag = inst._zod.bag;
5934
- bag.patterns ?? (bag.patterns = new Set());
5935
- bag.patterns.add(pattern);
5936
- });
5937
5941
  inst._zod.check = (payload) => {
5938
5942
  if (payload.value.includes(def.includes, def.position))
5939
5943
  return;
@@ -5952,11 +5956,6 @@ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (i
5952
5956
  $ZodCheck.init(inst, def);
5953
5957
  const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
5954
5958
  def.pattern ?? (def.pattern = pattern);
5955
- inst._zod.onattach.push((inst) => {
5956
- const bag = inst._zod.bag;
5957
- bag.patterns ?? (bag.patterns = new Set());
5958
- bag.patterns.add(pattern);
5959
- });
5960
5959
  inst._zod.check = (payload) => {
5961
5960
  if (payload.value.startsWith(def.prefix))
5962
5961
  return;
@@ -5975,11 +5974,6 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
5975
5974
  $ZodCheck.init(inst, def);
5976
5975
  const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
5977
5976
  def.pattern ?? (def.pattern = pattern);
5978
- inst._zod.onattach.push((inst) => {
5979
- const bag = inst._zod.bag;
5980
- bag.patterns ?? (bag.patterns = new Set());
5981
- bag.patterns.add(pattern);
5982
- });
5983
5977
  inst._zod.check = (payload) => {
5984
5978
  if (payload.value.endsWith(def.suffix))
5985
5979
  return;
@@ -5994,6 +5988,45 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
5994
5988
  });
5995
5989
  };
5996
5990
  });
5991
+ ///////////////////////////////////
5992
+ ///// $ZodCheckProperty /////
5993
+ ///////////////////////////////////
5994
+ function handleCheckPropertyResult(result, payload, property) {
5995
+ if (result.issues.length) {
5996
+ payload.issues.push(...prefixIssues(property, result.issues));
5997
+ }
5998
+ }
5999
+ const $ZodCheckProperties = /*@__PURE__*/ $constructor("$ZodCheckProperties", (inst, def) => {
6000
+ $ZodCheck.init(inst, def);
6001
+ hide(inst, Symbol.iterator, function* () {
6002
+ yield inst;
6003
+ });
6004
+ // key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
6005
+ let entries;
6006
+ inst._zod.check = (payload) => {
6007
+ // the base schema already typed the value, so only a nullish one is rejected here: the properties read on a primitive too, matching z.property() on a string's length
6008
+ if (payload.value == null) {
6009
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
6010
+ return undefined;
6011
+ }
6012
+ entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
6013
+ const input = payload.value;
6014
+ let proms;
6015
+ for (const [key, schema] of entries) {
6016
+ const result = schema._zod.run({ value: input[key], issues: [] }, {});
6017
+ if (result instanceof Promise) {
6018
+ proms ?? (proms = []);
6019
+ proms.push(result.then((result) => handleCheckPropertyResult(result, payload, key)));
6020
+ }
6021
+ else {
6022
+ handleCheckPropertyResult(result, payload, key);
6023
+ }
6024
+ }
6025
+ if (proms)
6026
+ return Promise.all(proms).then(() => undefined);
6027
+ return undefined;
6028
+ };
6029
+ });
5997
6030
  const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => {
5998
6031
  $ZodCheck.init(inst, def);
5999
6032
  inst._zod.check = (payload) => {
@@ -6008,10 +6041,15 @@ class Doc {
6008
6041
  this.args = args;
6009
6042
  this.closed = closed;
6010
6043
  }
6044
+ // the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
6011
6045
  indented(fn) {
6012
6046
  this.indent += 1;
6013
- fn(this);
6014
- this.indent -= 1;
6047
+ try {
6048
+ fn(this);
6049
+ }
6050
+ finally {
6051
+ this.indent -= 1;
6052
+ }
6015
6053
  }
6016
6054
  write(arg) {
6017
6055
  if (typeof arg === "function") {
@@ -6037,8 +6075,8 @@ class Doc {
6037
6075
 
6038
6076
  const version$3 = {
6039
6077
  major: 4,
6040
- minor: 5,
6041
- patch: 4,
6078
+ minor: 6,
6079
+ patch: 5,
6042
6080
  };
6043
6081
 
6044
6082
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
@@ -6164,16 +6202,24 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
6164
6202
  },
6165
6203
  });
6166
6204
  /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
6167
- const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
6205
+ // a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
6206
+ const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value };
6207
+ async function validateAsync(inst, value) {
6208
+ const ctx = { async: true };
6209
+ return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
6210
+ }
6168
6211
  function standardProps(inst) {
6169
6212
  return {
6170
6213
  validate: (value) => {
6214
+ const ctx = { async: false };
6171
6215
  try {
6172
- return toStandardResult(safeParse$1(inst, value));
6173
- }
6174
- catch (_) {
6175
- return safeParseAsync$1(inst, value).then(toStandardResult);
6216
+ const r = inst._zod.run({ value, issues: [] }, ctx);
6217
+ if (!(r instanceof Promise))
6218
+ return toStandardResult(r, ctx);
6176
6219
  }
6220
+ catch (_) { }
6221
+ // async function so a synchronously throwing check rejects instead of escaping validate
6222
+ return validateAsync(inst, value);
6177
6223
  },
6178
6224
  vendor: "zod",
6179
6225
  version: 1,
@@ -6181,7 +6227,8 @@ function standardProps(inst) {
6181
6227
  }
6182
6228
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
6183
6229
  $ZodType.init(inst, def);
6184
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? string$1(inst._zod.bag);
6230
+ // a format's own pattern, else unbounded; a template literal derives the check-aware form itself
6231
+ inst._zod.pattern = def.pattern ?? anyString;
6185
6232
  inst._zod.parse = (payload, _) => {
6186
6233
  if (def.coerce)
6187
6234
  try {
@@ -6235,15 +6282,37 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
6235
6282
  });
6236
6283
  /** The `://` guard rejected the input before the URL constructor saw it. */
6237
6284
  const URL_BAD_FORMAT = 1;
6238
- /** The URL constructor rejected the input. */
6285
+ /** The URL parser rejected the input. */
6239
6286
  const URL_UNPARSEABLE = 2;
6240
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
6287
+ function canParseURL(input) {
6288
+ try {
6289
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function")
6290
+ return URL.canParse(input);
6291
+ new URL(input);
6292
+ return true;
6293
+ }
6294
+ catch {
6295
+ return false;
6296
+ }
6297
+ }
6298
+ function validateURL(trimmed, def) {
6299
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
6300
+ return canParseURL(trimmed) || URL_UNPARSEABLE;
6301
+ }
6302
+ return parseURLObject(trimmed, def);
6303
+ }
6304
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
6241
6305
  function parseURLObject(trimmed, def) {
6242
6306
  // When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
6243
6307
  if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
6244
6308
  return URL_BAD_FORMAT;
6245
6309
  }
6246
6310
  try {
6311
+ if (typeof URL !== "undefined") {
6312
+ const URLStatic = URL;
6313
+ if (typeof URLStatic.parse === "function")
6314
+ return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
6315
+ }
6247
6316
  // @ts-ignore
6248
6317
  return new URL(trimmed);
6249
6318
  }
@@ -6270,7 +6339,7 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
6270
6339
  try {
6271
6340
  // Trim whitespace from input
6272
6341
  const trimmed = payload.value.trim();
6273
- const url = parseURLObject(trimmed, def);
6342
+ const url = validateURL(trimmed, def);
6274
6343
  if (url === URL_BAD_FORMAT) {
6275
6344
  payload.issues.push({
6276
6345
  code: "invalid_format",
@@ -6292,6 +6361,10 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
6292
6361
  });
6293
6362
  return;
6294
6363
  }
6364
+ if (url === true) {
6365
+ payload.value = stripTabAndNewline(trimmed);
6366
+ return;
6367
+ }
6295
6368
  if (def.hostname && !urlHostnameOk(url, def.hostname)) {
6296
6369
  payload.issues.push({
6297
6370
  code: "invalid_format",
@@ -6367,13 +6440,6 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
6367
6440
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
6368
6441
  def.pattern ?? (def.pattern = datetime(def));
6369
6442
  $ZodStringFormat.init(inst, def);
6370
- // these two drop the offset or seconds `date-time` requires — on the bag not the def, since `z.string().check(...)` lands the format on a different schema
6371
- if (def.local || def.precision === -1) {
6372
- inst._zod.bag.laxFormat = true;
6373
- inst._zod.onattach.push((s) => {
6374
- s._zod.bag.laxFormat = true;
6375
- });
6376
- }
6377
6443
  });
6378
6444
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
6379
6445
  def.pattern ?? (def.pattern = date);
@@ -6390,26 +6456,17 @@ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def
6390
6456
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
6391
6457
  def.pattern ?? (def.pattern = ipv4);
6392
6458
  $ZodStringFormat.init(inst, def);
6393
- inst._zod.bag.format = `ipv4`;
6394
6459
  });
6395
6460
  /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
6396
6461
  const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
6397
6462
  function isValidIPv6(value) {
6398
6463
  if (!ipv6Alphabet.test(value))
6399
6464
  return false;
6400
- try {
6401
- // @ts-ignore
6402
- new URL(`http://[${value}]`);
6403
- return true;
6404
- }
6405
- catch {
6406
- return false;
6407
- }
6465
+ return canParseURL(`http://[${value}]`);
6408
6466
  }
6409
6467
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
6410
6468
  def.pattern ?? (def.pattern = ipv6);
6411
6469
  $ZodStringFormat.init(inst, def);
6412
- inst._zod.bag.format = `ipv6`;
6413
6470
  inst._zod.check = (payload) => {
6414
6471
  if (!isValidIPv6(payload.value)) {
6415
6472
  payload.issues.push({
@@ -6473,10 +6530,11 @@ function isValidBase64(data) {
6473
6530
  return false;
6474
6531
  }
6475
6532
  }
6533
+ // lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
6534
+ const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
6476
6535
  const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
6477
- def.pattern ?? (def.pattern = base64);
6536
+ def.pattern ?? (def.pattern = base64Charset);
6478
6537
  $ZodStringFormat.init(inst, def);
6479
- inst._zod.bag.contentEncoding = "base64";
6480
6538
  inst._zod.check = (payload) => {
6481
6539
  if (isValidBase64(payload.value))
6482
6540
  return;
@@ -6489,18 +6547,19 @@ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
6489
6547
  });
6490
6548
  };
6491
6549
  });
6492
- ////////////////////////////// ZodBase64 //////////////////////////////
6550
+ ////////////////////////////// ZodBase64URL //////////////////////////////
6551
+ // lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
6552
+ const base64urlCharset = /^[A-Za-z0-9_-]*$/;
6493
6553
  function isValidBase64URL(data) {
6494
- if (!base64url.test(data))
6554
+ if (!base64urlCharset.test(data))
6495
6555
  return false;
6496
6556
  const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
6497
6557
  const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
6498
6558
  return isValidBase64(padded);
6499
6559
  }
6500
6560
  const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
6501
- def.pattern ?? (def.pattern = base64url);
6561
+ def.pattern ?? (def.pattern = base64urlCharset);
6502
6562
  $ZodStringFormat.init(inst, def);
6503
- inst._zod.bag.contentEncoding = "base64url";
6504
6563
  inst._zod.check = (payload) => {
6505
6564
  if (isValidBase64URL(payload.value))
6506
6565
  return;
@@ -6556,7 +6615,7 @@ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
6556
6615
  });
6557
6616
  const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
6558
6617
  $ZodType.init(inst, def);
6559
- inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
6618
+ inst._zod.pattern = number$1;
6560
6619
  inst._zod.parse = (payload, _ctx) => {
6561
6620
  if (def.coerce)
6562
6621
  try {
@@ -6648,6 +6707,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
6648
6707
  }
6649
6708
  payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
6650
6709
  const proms = [];
6710
+ const abortEarly = ctx?.abortEarly;
6651
6711
  for (let i = 0; i < input.length; i++) {
6652
6712
  const item = input[i];
6653
6713
  const result = def.element._zod.run({
@@ -6659,6 +6719,9 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
6659
6719
  }
6660
6720
  else {
6661
6721
  handleArrayResult(result, payload, i);
6722
+ // the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
6723
+ if (abortEarly && result.issues.length !== 0 && aborted(result))
6724
+ break;
6662
6725
  }
6663
6726
  }
6664
6727
  if (proms.length) {
@@ -6693,7 +6756,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
6693
6756
  return;
6694
6757
  }
6695
6758
  if (result.value === undefined) {
6696
- if (isPresent) {
6759
+ if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
6697
6760
  final.value[key] = undefined;
6698
6761
  }
6699
6762
  }
@@ -6725,14 +6788,21 @@ function normalizeDef(def) {
6725
6788
  optionalKeys: new Set(okeys),
6726
6789
  };
6727
6790
  }
6728
- function handleCatchall(proms, input, payload, ctx, def, inst) {
6791
+ function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
6729
6792
  const unrecognized = [];
6730
6793
  const keySet = def.keySet;
6731
6794
  const _catchall = def.catchall._zod;
6732
6795
  const t = _catchall.def.type;
6733
6796
  const optin = _catchall.optin;
6734
6797
  const optout = _catchall.optout;
6798
+ // starts at 0, not the current length: the shape phase already ran and may have aborted
6799
+ let seen = 0;
6735
6800
  for (const key in input) {
6801
+ if (abortEarly && payload.issues.length !== seen) {
6802
+ if (aborted(payload, seen))
6803
+ break;
6804
+ seen = payload.issues.length;
6805
+ }
6736
6806
  // Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
6737
6807
  if (keySet.has(key))
6738
6808
  continue;
@@ -6770,26 +6840,22 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
6770
6840
  return payload;
6771
6841
  });
6772
6842
  }
6773
- // Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it. Keyed by def, so a def rebuilt by a builder is simply absent rather than inheriting the source's. Read its keys with `Object.keys`, which does not invoke them — that is what lets a discriminated union check its discriminator without resolving an option whose getters reference the union being constructed.
6774
- const propShapes = new WeakMap();
6775
6843
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
6776
6844
  // requires cast because technically $ZodObject doesn't extend
6777
6845
  $ZodType.init(inst, def);
6778
- // const sh = def.shape;
6779
6846
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
6780
- if (!desc?.get) {
6781
- const sh = def.shape;
6782
- propShapes.set(def, sh);
6783
- Object.defineProperty(def, "shape", {
6784
- get: () => {
6785
- const newSh = { ...sh };
6786
- Object.defineProperty(def, "shape", {
6787
- value: newSh,
6788
- });
6789
- propShapes.set(def, newSh);
6790
- return newSh;
6791
- },
6792
- });
6847
+ // a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
6848
+ const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
6849
+ if (sh) {
6850
+ // Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
6851
+ const get = () => {
6852
+ const newSh = { ...sh };
6853
+ Object.defineProperty(def, "shape", { value: newSh });
6854
+ get.raw = newSh;
6855
+ return newSh;
6856
+ };
6857
+ get.raw = sh;
6858
+ Object.defineProperty(def, "shape", { get });
6793
6859
  }
6794
6860
  const _normalized = cached(() => normalizeDef(def));
6795
6861
  defineLazyInternal(inst, "propValues", (zod) => {
@@ -6830,7 +6896,14 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
6830
6896
  payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
6831
6897
  const proms = [];
6832
6898
  const shape = value.shape;
6899
+ const abortEarly = ctx?.abortEarly;
6900
+ let seen = payload.issues.length;
6833
6901
  for (const key of value.allKeys) {
6902
+ if (abortEarly && payload.issues.length !== seen) {
6903
+ if (aborted(payload, seen))
6904
+ break;
6905
+ seen = payload.issues.length;
6906
+ }
6834
6907
  if (key === "__proto__")
6835
6908
  continue;
6836
6909
  const el = shape[key];
@@ -6847,7 +6920,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
6847
6920
  if (!catchall) {
6848
6921
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
6849
6922
  }
6850
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
6923
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
6851
6924
  };
6852
6925
  });
6853
6926
  const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
@@ -6862,12 +6935,18 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
6862
6935
  // a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
6863
6936
  const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
6864
6937
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
6865
- // Prefixes in place, like util.prefixIssues does for every interpreted path.
6938
+ // prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
6866
6939
  const prefixStr = (id, k) => `
6940
+ let ${id}_ab = false;
6867
6941
  for (let i = 0; i < ${id}.issues.length; i++) {
6868
6942
  const iss = ${id}.issues[i];
6869
6943
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
6870
6944
  payload.issues.push(iss);
6945
+ if (iss.continue !== true) ${id}_ab = true;
6946
+ }
6947
+ if (${id}_ab && ctx && ctx.abortEarly) {
6948
+ payload.value = newResult;
6949
+ return payload;
6871
6950
  }`;
6872
6951
  doc.write(`const input = payload.value;`);
6873
6952
  const ids = Object.create(null);
@@ -6916,6 +6995,10 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
6916
6995
  input: undefined,
6917
6996
  path: [${k}]
6918
6997
  });
6998
+ if (ctx && ctx.abortEarly) {
6999
+ payload.value = newResult;
7000
+ return payload;
7001
+ }
6919
7002
  }
6920
7003
 
6921
7004
  if (${id}_present) {
@@ -6928,16 +7011,17 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
6928
7011
  doc.write(`
6929
7012
  if (${id}.issues.length) {${prefixStr(id, k)}
6930
7013
  }
6931
-
6932
- if (${id}.value === undefined) {
6933
- if (${isPresent}) {
6934
- newResult[${k}] = undefined;
6935
- }
6936
- } else {
7014
+ `);
7015
+ if (optin === "defaulted") {
7016
+ doc.write(`newResult[${k}] = ${id}.value;`);
7017
+ }
7018
+ else {
7019
+ doc.write(`
7020
+ if (${id}.value !== undefined || ${isPresent}) {
6937
7021
  newResult[${k}] = ${id}.value;
6938
7022
  }
6939
-
6940
7023
  `);
7024
+ }
6941
7025
  }
6942
7026
  }
6943
7027
  doc.write(`payload.value = newResult;`);
@@ -6971,7 +7055,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
6971
7055
  payload = fastpass(payload, ctx);
6972
7056
  if (!catchall)
6973
7057
  return payload;
6974
- return handleCatchall([], input, payload, ctx, value, inst);
7058
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
6975
7059
  }
6976
7060
  return superParse(payload, ctx);
6977
7061
  };
@@ -7181,6 +7265,7 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
7181
7265
  });
7182
7266
  return payload;
7183
7267
  }
7268
+ // no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
7184
7269
  const proms = [];
7185
7270
  const values = def.keyType._zod.values;
7186
7271
  if (values && !def.partial) {
@@ -7340,9 +7425,11 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
7340
7425
  const values = getEnumValues(def.entries);
7341
7426
  const valuesSet = new Set(values);
7342
7427
  inst._zod.values = valuesSet;
7343
- const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
7344
- // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
7345
- inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
7428
+ defineLazyInternal(inst, "pattern", (zod) => {
7429
+ const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
7430
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
7431
+ return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
7432
+ });
7346
7433
  inst._zod.parse = (payload, _ctx) => {
7347
7434
  const input = payload.value;
7348
7435
  if (valuesSet.has(input)) {
@@ -7361,12 +7448,15 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
7361
7448
  $ZodType.init(inst, def);
7362
7449
  const values = new Set(def.values);
7363
7450
  inst._zod.values = values;
7364
- // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
7365
- inst._zod.pattern = new RegExp(def.values.length
7366
- ? `^(${def.values
7367
- .map((o) => (typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)))
7368
- .join("|")})$`
7369
- : "^[^\\s\\S]$");
7451
+ defineLazyInternal(inst, "pattern", (zod) => {
7452
+ const vals = zod.def.values;
7453
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
7454
+ return new RegExp(vals.length
7455
+ ? `^(${vals
7456
+ .map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o))
7457
+ .join("|")})$`
7458
+ : "^[^\\s\\S]$");
7459
+ });
7370
7460
  inst._zod.parse = (payload, _ctx) => {
7371
7461
  const input = payload.value;
7372
7462
  if (values.has(input)) {
@@ -7666,32 +7756,62 @@ class $ZodCyclicError extends Error {
7666
7756
  /** Keyed off the context object every schema in one parse call already shares. */
7667
7757
  const STATE$1 = "~memo";
7668
7758
  const NO_ISSUES = [];
7759
+ // a value a cycle can close through
7760
+ function isRef(value) {
7761
+ return value !== null && typeof value === "object";
7762
+ }
7669
7763
  // Receivers prefix paths in place, so the cache and every hand-out need their own copies.
7670
7764
  function cloneIssues(issues) {
7671
7765
  return issues.map((iss) => (iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }));
7672
7766
  }
7673
7767
  const recursive = /*@__PURE__*/ new WeakMap();
7768
+ /** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
7769
+ const NONE = 0;
7770
+ const ASSUMED = 1;
7771
+ const PROVEN = 2;
7674
7772
  /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
7675
- function isRecursive(inst, stack) {
7773
+ function isRecursive(inst, stack, resolve) {
7676
7774
  const cached = recursive.get(inst);
7677
7775
  if (cached !== undefined)
7678
- return cached;
7776
+ return cached ? PROVEN : NONE;
7679
7777
  // Relative to the walk in progress, so not cached.
7680
7778
  if (stack.has(inst))
7681
- return true;
7779
+ return PROVEN;
7682
7780
  stack.add(inst);
7683
- let result = false;
7781
+ let result = NONE;
7684
7782
  const check = (child) => {
7685
- if (!result && child?._zod && isRecursive(child, stack))
7686
- result = true;
7783
+ if (result !== PROVEN && child?._zod) {
7784
+ const answer = isRecursive(child, stack);
7785
+ if (answer > result)
7786
+ result = answer;
7787
+ }
7788
+ };
7789
+ // `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen
7790
+ const shape = (sh, spread) => {
7791
+ let answer = NONE;
7792
+ for (const key of Reflect.ownKeys(sh)) {
7793
+ const desc = Object.getOwnPropertyDescriptor(sh, key);
7794
+ // an object resolves its shape by spread, so a key it does not enumerate is never parsed; `z.properties` reads every own key and so keeps them all
7795
+ if (!desc.enumerable)
7796
+ continue;
7797
+ // resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle
7798
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack) : NONE;
7799
+ if (child > answer)
7800
+ answer = child;
7801
+ }
7802
+ return answer;
7803
+ };
7804
+ const merge = (answer) => {
7805
+ if (answer > result)
7806
+ result = answer;
7687
7807
  };
7688
7808
  const def = inst._zod.def;
7689
7809
  const kind = def.type;
7690
7810
  switch (kind) {
7691
7811
  case "object": {
7692
- // `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen
7693
- for (const key of Reflect.ownKeys(def.shape))
7694
- check(def.shape[key]);
7812
+ const raw = rawShape(def);
7813
+ // a def with no raw shape answers `shape` from an accessor of its own, and running that can mint a whole fresh subtree
7814
+ merge(raw ? shape(raw) : ASSUMED);
7695
7815
  check(def.catchall);
7696
7816
  break;
7697
7817
  }
@@ -7738,10 +7858,13 @@ function isRecursive(inst, stack) {
7738
7858
  check(def.input);
7739
7859
  check(def.output);
7740
7860
  break;
7741
- // reading `_zod.innerType` resolves the getter once and caches it
7742
- case "lazy":
7743
- check(inst._zod.innerType);
7861
+ // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
7862
+ case "lazy": {
7863
+ const inner = def._cachedInner ?? (undefined);
7864
+ // walked with resolution off: one hop sees past the deferral, and a lazy that yields only another unresolved lazy is generative, so it stops there
7865
+ merge(inner ? isRecursive(inner, stack) : ASSUMED);
7744
7866
  break;
7867
+ }
7745
7868
  // a leaf by choice: `parts` are regex fragments, not data positions
7746
7869
  case "template_literal":
7747
7870
  // leaves
@@ -7783,13 +7906,18 @@ function isRecursive(inst, stack) {
7783
7906
  }
7784
7907
  }
7785
7908
  stack.delete(inst);
7786
- recursive.set(inst, result);
7787
- return result;
7909
+ return settle(inst, result);
7910
+ }
7911
+ /** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
7912
+ function settle(inst, answer) {
7913
+ if (answer !== ASSUMED)
7914
+ recursive.set(inst, answer === PROVEN);
7915
+ return answer;
7788
7916
  }
7789
7917
  function bucketFor(state, inst) {
7790
7918
  let bucket = state.buckets.get(inst);
7791
7919
  if (!bucket) {
7792
- bucket = new Map();
7920
+ bucket = new WeakMap();
7793
7921
  state.buckets.set(inst, bucket);
7794
7922
  }
7795
7923
  return bucket;
@@ -7828,7 +7956,8 @@ const memo = {
7828
7956
  attach(inst) {
7829
7957
  var _a;
7830
7958
  let isRecursiveInst;
7831
- // `bucket` memoized for one parse; a recursive schema is re-entered many times and its bucket never changes
7959
+ let rechecked = false;
7960
+ // a recursive schema is re-entered many times per parse and its bucket never changes
7832
7961
  let lastCtx;
7833
7962
  let lastBucket;
7834
7963
  // Wraps `parse` in a deferred so it sees the container's final parse. Core's own deferred copies `parse` into `run` when there are no checks, and it ran first, so `run` is patched to match; with checks, `run` reads `parse` dynamically.
@@ -7837,21 +7966,26 @@ const memo = {
7837
7966
  const base = inst._zod.parse;
7838
7967
  const wrapped = (payload, ctx) => {
7839
7968
  if (isRecursiveInst === undefined) {
7840
- isRecursiveInst = isRecursive(inst, new Set());
7841
- if (!isRecursiveInst) {
7969
+ const walked = isRecursive(inst, new Set());
7970
+ if (walked === NONE) {
7842
7971
  // Nothing here can ever fire, so take it back out.
7843
7972
  inst._zod.parse = base;
7844
7973
  if (inst._zod.run === wrapped)
7845
7974
  inst._zod.run = base;
7846
7975
  return base(payload, ctx);
7847
7976
  }
7977
+ // this parse resolves the deferred edges on its own path, so ask once more before latching
7978
+ if (walked === PROVEN || rechecked)
7979
+ isRecursiveInst = true;
7980
+ else
7981
+ rechecked = true;
7848
7982
  }
7849
7983
  const input = payload.value;
7850
- if (input === null || typeof input !== "object")
7984
+ if (!isRef(input))
7851
7985
  return base(payload, ctx);
7852
7986
  let state = ctx[STATE$1];
7853
7987
  if (!state) {
7854
- state = { buckets: new Map(), backEdges: undefined };
7988
+ state = { buckets: new WeakMap(), backEdges: undefined };
7855
7989
  ctx[STATE$1] = state;
7856
7990
  }
7857
7991
  let bucket;
@@ -7873,7 +8007,7 @@ const memo = {
7873
8007
  else {
7874
8008
  // Still being parsed: its own checks cover it, so skip them here.
7875
8009
  payload.memo = true;
7876
- state.backEdges ?? (state.backEdges = new Set());
8010
+ state.backEdges ?? (state.backEdges = new WeakSet());
7877
8011
  state.backEdges.add(hit.value);
7878
8012
  }
7879
8013
  return payload;
@@ -7909,7 +8043,7 @@ function memoizer() {
7909
8043
  /** Whether this value is a node a back-edge resolved to before it finished. */
7910
8044
  function isBackEdge(ctx, value) {
7911
8045
  const backEdges = ctx[STATE$1]?.backEdges;
7912
- return backEdges !== undefined && value !== null && typeof value === "object" && backEdges.has(value);
8046
+ return backEdges !== undefined && isRef(value) && backEdges.has(value);
7913
8047
  }
7914
8048
 
7915
8049
  const error = () => {
@@ -7951,7 +8085,9 @@ const error = () => {
7951
8085
  base64url: "base64url-encoded string",
7952
8086
  json_string: "JSON string",
7953
8087
  e164: "E.164 number",
8088
+ currency_code: "currency code",
7954
8089
  credit_card: "credit card number",
8090
+ iban: "IBAN",
7955
8091
  jwt: "JWT",
7956
8092
  template_literal: "input",
7957
8093
  };
@@ -8085,12 +8221,14 @@ function registry() {
8085
8221
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
8086
8222
  const globalRegistry = globalThis.__zod_globalRegistry;
8087
8223
 
8224
+ function snapshotChecks(def) {
8225
+ if (def.checks)
8226
+ def.checks = [...def.checks];
8227
+ return def;
8228
+ }
8088
8229
  // @__NO_SIDE_EFFECTS__
8089
8230
  function _string(Class, params) {
8090
- return new Class({
8091
- type: "string",
8092
- ...normalizeParams(params),
8093
- });
8231
+ return new Class(snapshotChecks({ type: "string", ...normalizeParams(params) }));
8094
8232
  }
8095
8233
  // @__NO_SIDE_EFFECTS__
8096
8234
  function _email(Class, params) {
@@ -8362,11 +8500,7 @@ function _isoDuration(Class, params) {
8362
8500
  }
8363
8501
  // @__NO_SIDE_EFFECTS__
8364
8502
  function _number(Class, params) {
8365
- return new Class({
8366
- type: "number",
8367
- checks: [],
8368
- ...normalizeParams(params),
8369
- });
8503
+ return new Class(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
8370
8504
  }
8371
8505
  // @__NO_SIDE_EFFECTS__
8372
8506
  function _int(Class, params) {
@@ -8520,6 +8654,14 @@ function _endsWith(suffix, params) {
8520
8654
  });
8521
8655
  }
8522
8656
  // @__NO_SIDE_EFFECTS__
8657
+ function _properties(shape, params) {
8658
+ return new $ZodCheckProperties({
8659
+ check: "properties",
8660
+ shape,
8661
+ ...normalizeParams(params),
8662
+ });
8663
+ }
8664
+ // @__NO_SIDE_EFFECTS__
8523
8665
  function _overwrite(tx) {
8524
8666
  return new $ZodCheckOverwrite({
8525
8667
  check: "overwrite",
@@ -8678,7 +8820,8 @@ function handleUnrepresentable(schema, ctx, json, params, message) {
8678
8820
  Object.assign(json, result);
8679
8821
  return true;
8680
8822
  }
8681
- function process$1(schema, ctx, _params = { path: [], schemaPath: [] }) {
8823
+ // never rename this back to `process`: bundler polyfills inject a top-level `const process` that a lexical declaration of the same name collides with (#6397)
8824
+ function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
8682
8825
  var _a;
8683
8826
  const def = schema._zod.def;
8684
8827
  // check for schema in seens
@@ -8724,7 +8867,7 @@ function process$1(schema, ctx, _params = { path: [], schemaPath: [] }) {
8724
8867
  // Also set ref if processor didn't (for inheritance)
8725
8868
  if (!result.ref)
8726
8869
  result.ref = parent;
8727
- process$1(parent, ctx, params);
8870
+ processSchema(parent, ctx, params);
8728
8871
  ctx.seen.get(parent).isParent = true;
8729
8872
  }
8730
8873
  }
@@ -8861,8 +9004,6 @@ function extractDefs(ctx, schema
8861
9004
  if (seen.count > 1) {
8862
9005
  if (ctx.reused === "ref") {
8863
9006
  extractToDef(entry);
8864
- // biome-ignore lint:
8865
- continue;
8866
9007
  }
8867
9008
  }
8868
9009
  }
@@ -9251,18 +9392,111 @@ function isTransforming(_schema, _ctx) {
9251
9392
  */
9252
9393
  const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
9253
9394
  const ctx = initializeContext({ ...params, processors });
9254
- process$1(schema, ctx);
9395
+ processSchema(schema, ctx);
9255
9396
  extractDefs(ctx, schema);
9256
9397
  return finalize(ctx, schema);
9257
9398
  };
9258
9399
  const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
9259
9400
  const { libraryOptions, target } = params ?? {};
9260
9401
  const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
9261
- process$1(schema, ctx);
9402
+ processSchema(schema, ctx);
9262
9403
  extractDefs(ctx, schema);
9263
9404
  return finalize(ctx, schema);
9264
9405
  };
9265
9406
 
9407
+ const narrowMin = (agg, key, value) => {
9408
+ if (agg[key] === undefined || value > agg[key])
9409
+ agg[key] = value;
9410
+ };
9411
+ const narrowMax = (agg, key, value) => {
9412
+ if (agg[key] === undefined || value < agg[key])
9413
+ agg[key] = value;
9414
+ };
9415
+ const narrowBoth = (agg, value) => {
9416
+ narrowMin(agg, "minimum", value);
9417
+ narrowMax(agg, "maximum", value);
9418
+ };
9419
+ const addDivisor = (agg, value) => {
9420
+ agg.multipleOf ?? (agg.multipleOf = []);
9421
+ if (!agg.multipleOf.includes(value))
9422
+ agg.multipleOf.push(value);
9423
+ };
9424
+ const addPattern = (agg, pattern) => {
9425
+ agg.patterns ?? (agg.patterns = new Set());
9426
+ agg.patterns.add(pattern);
9427
+ };
9428
+ const intersectMime = (agg, mime) => {
9429
+ agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
9430
+ };
9431
+ // last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one
9432
+ const setFormat = (agg, format) => {
9433
+ agg.format = format;
9434
+ if (format.includes("int"))
9435
+ agg.isInt = true;
9436
+ };
9437
+ const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
9438
+ const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
9439
+ const formatContributor = (ranges) => (agg, def) => {
9440
+ setFormat(agg, def.format);
9441
+ const [minimum, maximum] = ranges[def.format];
9442
+ narrowMin(agg, "minimum", minimum);
9443
+ narrowMax(agg, "maximum", maximum);
9444
+ };
9445
+ const contributors = {
9446
+ greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
9447
+ less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
9448
+ multiple_of: (agg, def) => addDivisor(agg, def.value),
9449
+ number_format: formatContributor(NUMBER_FORMAT_RANGES),
9450
+ bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
9451
+ min_length: minContributor,
9452
+ max_length: maxContributor,
9453
+ length_equals: (agg, def) => narrowBoth(agg, def.length),
9454
+ min_size: minContributor,
9455
+ max_size: maxContributor,
9456
+ size_equals: (agg, def) => narrowBoth(agg, def.size),
9457
+ string_format: (agg, def) => {
9458
+ setFormat(agg, def.format);
9459
+ if (def.pattern)
9460
+ addPattern(agg, def.pattern);
9461
+ if (def.format === "base64" || def.format === "base64url")
9462
+ agg.contentEncoding = def.format;
9463
+ if (def.local || def.precision === -1)
9464
+ agg.laxFormat = true;
9465
+ },
9466
+ mime_type: (agg, def) => intersectMime(agg, def.mime),
9467
+ };
9468
+ function aggregateChecks(schema) {
9469
+ const agg = {};
9470
+ const def = schema._zod.def;
9471
+ // a format schema is its own first check, same rule as $ZodType init
9472
+ const list = schema._zod.traits.has("$ZodCheck")
9473
+ ? [schema, ...(def.checks ?? [])]
9474
+ : (def.checks ?? []);
9475
+ for (const ch of list)
9476
+ contributors[ch._zod.def.check]?.(agg, ch._zod.def);
9477
+ // reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other
9478
+ const bag = schema._zod.bag;
9479
+ if (bag.minimum !== undefined)
9480
+ narrowMin(agg, "minimum", bag.minimum);
9481
+ if (bag.exclusiveMinimum !== undefined)
9482
+ narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
9483
+ if (bag.maximum !== undefined)
9484
+ narrowMax(agg, "maximum", bag.maximum);
9485
+ if (bag.exclusiveMaximum !== undefined)
9486
+ narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
9487
+ if (bag.multipleOf !== undefined)
9488
+ addDivisor(agg, bag.multipleOf);
9489
+ if (bag.format !== undefined) {
9490
+ agg.format ?? (agg.format = bag.format);
9491
+ if (bag.format.includes("int"))
9492
+ agg.isInt = true;
9493
+ }
9494
+ if (bag.mime)
9495
+ intersectMime(agg, bag.mime);
9496
+ for (const pattern of bag.patterns ?? [])
9497
+ addPattern(agg, pattern);
9498
+ return agg;
9499
+ }
9266
9500
  const formatMap = {
9267
9501
  guid: "uuid",
9268
9502
  url: "uri",
@@ -9271,11 +9505,16 @@ const formatMap = {
9271
9505
  regex: "", // do not set
9272
9506
  };
9273
9507
  // ==================== SIMPLE TYPE PROCESSORS ====================
9508
+ // the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes
9509
+ const exactPatterns = new Map([
9510
+ [base64Charset, base64],
9511
+ [base64urlCharset, base64url],
9512
+ ]);
9513
+ const exactPattern = (p) => exactPatterns.get(p) ?? p;
9274
9514
  const stringProcessor = (schema, ctx, _json, _params) => {
9275
9515
  const json = _json;
9276
9516
  json.type = "string";
9277
- const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod
9278
- .bag;
9517
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
9279
9518
  if (typeof minimum === "number")
9280
9519
  json.minLength = minimum;
9281
9520
  if (typeof maximum === "number")
@@ -9293,7 +9532,7 @@ const stringProcessor = (schema, ctx, _json, _params) => {
9293
9532
  if (contentEncoding)
9294
9533
  json.contentEncoding = contentEncoding;
9295
9534
  if (patterns && patterns.size > 0) {
9296
- const patternList = [...patterns];
9535
+ const patternList = [...patterns].map(exactPattern);
9297
9536
  if (patternList.length === 1)
9298
9537
  json.pattern = patternList[0].source;
9299
9538
  else if (patternList.length > 1) {
@@ -9310,11 +9549,8 @@ const stringProcessor = (schema, ctx, _json, _params) => {
9310
9549
  };
9311
9550
  const numberProcessor = (schema, ctx, _json, params) => {
9312
9551
  const json = _json;
9313
- const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
9314
- if (typeof format === "string" && format.includes("int"))
9315
- json.type = "integer";
9316
- else
9317
- json.type = "number";
9552
+ const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
9553
+ json.type = isInt ? "integer" : "number";
9318
9554
  // when both minimum and exclusiveMinimum exist, pick the more restrictive one
9319
9555
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
9320
9556
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
@@ -9343,12 +9579,21 @@ const numberProcessor = (schema, ctx, _json, params) => {
9343
9579
  else if (typeof maximum === "number") {
9344
9580
  json.maximum = maximum;
9345
9581
  }
9346
- if (typeof multipleOf === "number") {
9582
+ if (multipleOf) {
9347
9583
  // JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.
9348
- if (Number.isFinite(multipleOf) && multipleOf !== 0)
9349
- json.multipleOf = Math.abs(multipleOf);
9350
- else
9351
- handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
9584
+ const divisors = new Set();
9585
+ for (const divisor of multipleOf) {
9586
+ if (Number.isFinite(divisor) && divisor !== 0)
9587
+ divisors.add(Math.abs(divisor));
9588
+ else
9589
+ handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
9590
+ }
9591
+ // chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns
9592
+ const [first, ...rest] = divisors;
9593
+ if (first !== undefined)
9594
+ json.multipleOf = first;
9595
+ if (rest.length)
9596
+ json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];
9352
9597
  }
9353
9598
  };
9354
9599
  const booleanProcessor = (_schema, _ctx, json, _params) => {
@@ -9432,13 +9677,13 @@ const transformProcessor = (schema, ctx, json, params) => {
9432
9677
  const arrayProcessor = (schema, ctx, _json, params) => {
9433
9678
  const json = _json;
9434
9679
  const def = schema._zod.def;
9435
- const { minimum, maximum } = schema._zod.bag;
9680
+ const { minimum, maximum } = aggregateChecks(schema);
9436
9681
  if (typeof minimum === "number")
9437
9682
  json.minItems = minimum;
9438
9683
  if (typeof maximum === "number")
9439
9684
  json.maxItems = maximum;
9440
9685
  json.type = "array";
9441
- json.items = process$1(def.element, ctx, {
9686
+ json.items = processSchema(def.element, ctx, {
9442
9687
  ...params,
9443
9688
  path: [...params.path, "items"],
9444
9689
  });
@@ -9472,24 +9717,21 @@ const objectProcessor = (schema, ctx, _json, params) => {
9472
9717
  json.properties = {};
9473
9718
  for (const key in shape) {
9474
9719
  // assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
9475
- assignProp(json.properties, key, process$1(shape[key], ctx, {
9720
+ assignProp(json.properties, key, processSchema(shape[key], ctx, {
9476
9721
  ...params,
9477
9722
  path: [...params.path, "properties", key],
9478
9723
  }));
9479
9724
  }
9480
9725
  // required keys
9481
- const allKeys = new Set(Object.keys(shape));
9482
- const requiredKeys = new Set([...allKeys].filter((key) => {
9726
+ const requiredKeys = [];
9727
+ for (const key of Object.keys(shape)) {
9483
9728
  const field = def.shape[key];
9484
- if (ctx.io === "input") {
9485
- return inputOptin(field) === undefined;
9729
+ if (ctx.io === "input" ? inputOptin(field) === undefined : field._zod.optout === undefined) {
9730
+ requiredKeys.push(key);
9486
9731
  }
9487
- else {
9488
- return field._zod.optout === undefined;
9489
- }
9490
- }));
9491
- if (requiredKeys.size > 0) {
9492
- json.required = Array.from(requiredKeys);
9732
+ }
9733
+ if (requiredKeys.length > 0) {
9734
+ json.required = requiredKeys;
9493
9735
  }
9494
9736
  // catchall
9495
9737
  if (def.catchall?._zod.def.type === "never") {
@@ -9502,7 +9744,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
9502
9744
  json.additionalProperties = false;
9503
9745
  }
9504
9746
  else if (def.catchall) {
9505
- json.additionalProperties = process$1(def.catchall, ctx, {
9747
+ json.additionalProperties = processSchema(def.catchall, ctx, {
9506
9748
  ...params,
9507
9749
  path: [...params.path, "additionalProperties"],
9508
9750
  });
@@ -9512,7 +9754,7 @@ const unionProcessor = (schema, ctx, json, params) => {
9512
9754
  const def = schema._zod.def;
9513
9755
  // Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
9514
9756
  const isExclusive = def.inclusive === false;
9515
- const options = def.options.map((x, i) => process$1(x, ctx, {
9757
+ const options = def.options.map((x, i) => processSchema(x, ctx, {
9516
9758
  ...params,
9517
9759
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
9518
9760
  }));
@@ -9525,11 +9767,11 @@ const unionProcessor = (schema, ctx, json, params) => {
9525
9767
  };
9526
9768
  const intersectionProcessor = (schema, ctx, json, params) => {
9527
9769
  const def = schema._zod.def;
9528
- const a = process$1(def.left, ctx, {
9770
+ const a = processSchema(def.left, ctx, {
9529
9771
  ...params,
9530
9772
  path: [...params.path, "allOf", 0],
9531
9773
  });
9532
- const b = process$1(def.right, ctx, {
9774
+ const b = processSchema(def.right, ctx, {
9533
9775
  ...params,
9534
9776
  path: [...params.path, "allOf", 1],
9535
9777
  });
@@ -9629,23 +9871,22 @@ const recordProcessor = (schema, ctx, _json, params) => {
9629
9871
  json.type = "object";
9630
9872
  // For looseRecord with regex patterns, use patternProperties. This correctly represents "only validate keys matching the pattern" semantics and composes well with allOf (intersections)
9631
9873
  const keyType = def.keyType;
9632
- const keyBag = keyType._zod.bag;
9633
- const patterns = keyBag?.patterns;
9874
+ const patterns = aggregateChecks(keyType).patterns;
9634
9875
  if (def.mode === "loose" && patterns && patterns.size > 0) {
9635
9876
  // Use patternProperties for looseRecord with regex patterns
9636
- const valueSchema = process$1(def.valueType, ctx, {
9877
+ const valueSchema = processSchema(def.valueType, ctx, {
9637
9878
  ...params,
9638
9879
  path: [...params.path, "patternProperties", "*"],
9639
9880
  });
9640
9881
  json.patternProperties = {};
9641
9882
  for (const pattern of patterns) {
9642
- assignProp(json.patternProperties, pattern.source, valueSchema);
9883
+ assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
9643
9884
  }
9644
9885
  }
9645
9886
  else {
9646
9887
  // Default behavior: use propertyNames + additionalProperties
9647
9888
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
9648
- json.propertyNames = process$1(def.keyType, ctx, {
9889
+ json.propertyNames = processSchema(def.keyType, ctx, {
9649
9890
  ...params,
9650
9891
  path: [...params.path, "propertyNames"],
9651
9892
  });
@@ -9657,7 +9898,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
9657
9898
  }
9658
9899
  pending.push(schema);
9659
9900
  }
9660
- json.additionalProperties = process$1(def.valueType, ctx, {
9901
+ json.additionalProperties = processSchema(def.valueType, ctx, {
9661
9902
  ...params,
9662
9903
  path: [...params.path, "additionalProperties"],
9663
9904
  });
@@ -9675,7 +9916,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
9675
9916
  };
9676
9917
  const nullableProcessor = (schema, ctx, json, params) => {
9677
9918
  const def = schema._zod.def;
9678
- const inner = process$1(def.innerType, ctx, params);
9919
+ const inner = processSchema(def.innerType, ctx, params);
9679
9920
  const seen = ctx.seen.get(schema);
9680
9921
  if (ctx.target === "openapi-3.0") {
9681
9922
  seen.ref = def.innerType;
@@ -9687,7 +9928,7 @@ const nullableProcessor = (schema, ctx, json, params) => {
9687
9928
  };
9688
9929
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
9689
9930
  const def = schema._zod.def;
9690
- process$1(def.innerType, ctx, params);
9931
+ processSchema(def.innerType, ctx, params);
9691
9932
  const seen = ctx.seen.get(schema);
9692
9933
  seen.ref = def.innerType;
9693
9934
  };
@@ -9710,7 +9951,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
9710
9951
  }
9711
9952
  const defaultProcessor = (schema, ctx, json, params) => {
9712
9953
  const def = schema._zod.def;
9713
- process$1(def.innerType, ctx, params);
9954
+ processSchema(def.innerType, ctx, params);
9714
9955
  const seen = ctx.seen.get(schema);
9715
9956
  seen.ref = def.innerType;
9716
9957
  const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
@@ -9719,7 +9960,7 @@ const defaultProcessor = (schema, ctx, json, params) => {
9719
9960
  };
9720
9961
  const prefaultProcessor = (schema, ctx, json, params) => {
9721
9962
  const def = schema._zod.def;
9722
- process$1(def.innerType, ctx, params);
9963
+ processSchema(def.innerType, ctx, params);
9723
9964
  const seen = ctx.seen.get(schema);
9724
9965
  seen.ref = def.innerType;
9725
9966
  if (ctx.io !== "input")
@@ -9730,7 +9971,7 @@ const prefaultProcessor = (schema, ctx, json, params) => {
9730
9971
  };
9731
9972
  const catchProcessor = (schema, ctx, json, params) => {
9732
9973
  const def = schema._zod.def;
9733
- process$1(def.innerType, ctx, params);
9974
+ processSchema(def.innerType, ctx, params);
9734
9975
  const seen = ctx.seen.get(schema);
9735
9976
  seen.ref = def.innerType;
9736
9977
  let catchValue;
@@ -9747,20 +9988,20 @@ const pipeProcessor = (schema, ctx, _json, params) => {
9747
9988
  const def = schema._zod.def;
9748
9989
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
9749
9990
  const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
9750
- process$1(innerType, ctx, params);
9991
+ processSchema(innerType, ctx, params);
9751
9992
  const seen = ctx.seen.get(schema);
9752
9993
  seen.ref = innerType;
9753
9994
  };
9754
9995
  const readonlyProcessor = (schema, ctx, json, params) => {
9755
9996
  const def = schema._zod.def;
9756
- process$1(def.innerType, ctx, params);
9997
+ processSchema(def.innerType, ctx, params);
9757
9998
  const seen = ctx.seen.get(schema);
9758
9999
  seen.ref = def.innerType;
9759
10000
  json.readOnly = true;
9760
10001
  };
9761
10002
  const optionalProcessor = (schema, ctx, _json, params) => {
9762
10003
  const def = schema._zod.def;
9763
- process$1(def.innerType, ctx, params);
10004
+ processSchema(def.innerType, ctx, params);
9764
10005
  const seen = ctx.seen.get(schema);
9765
10006
  seen.ref = def.innerType;
9766
10007
  };
@@ -9977,6 +10218,12 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
9977
10218
  set spa(value) {
9978
10219
  own(this, "spa", value);
9979
10220
  },
10221
+ validate(data, params) {
10222
+ return validate(this, data, params);
10223
+ },
10224
+ validateAsync(data, params) {
10225
+ return validateAsync$1(this, data, params);
10226
+ },
9980
10227
  encode: function _encode(data, params) {
9981
10228
  return encode(this, data, params, { callee: _encode });
9982
10229
  },
@@ -10018,10 +10265,11 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
10018
10265
  $ZodString.init(inst, def);
10019
10266
  ZodType.init(inst, def);
10020
10267
  inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json);
10021
- const bag = inst._zod.bag;
10022
- inst.format = bag.format ?? null;
10023
- inst.minLength = bag.minimum ?? null;
10024
- inst.maxLength = bag.maximum ?? null;
10268
+ },
10269
+ /*@__PURE__*/ derived({
10270
+ format: (inst) => aggregateChecks(inst).format ?? null,
10271
+ minLength: (inst) => aggregateChecks(inst).minimum ?? null,
10272
+ maxLength: (inst) => aggregateChecks(inst).maximum ?? null,
10025
10273
  }, {
10026
10274
  regex(...args) {
10027
10275
  return this.check(_regex(...args));
@@ -10068,7 +10316,7 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
10068
10316
  slugify() {
10069
10317
  return this.check(_slugify());
10070
10318
  },
10071
- });
10319
+ }));
10072
10320
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
10073
10321
  $ZodString.init(inst, def);
10074
10322
  _ZodString.init(inst, def);
@@ -10277,14 +10525,22 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
10277
10525
  $ZodNumber.init(inst, def);
10278
10526
  ZodType.init(inst, def);
10279
10527
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
10280
- const bag = inst._zod.bag;
10281
- inst.minValue =
10282
- Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
10283
- inst.maxValue =
10284
- Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
10285
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
10286
10528
  inst.isFinite = true;
10287
- inst.format = bag.format ?? null;
10529
+ },
10530
+ /*@__PURE__*/ derived({
10531
+ minValue: (inst) => {
10532
+ const { minimum, exclusiveMinimum } = aggregateChecks(inst);
10533
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
10534
+ },
10535
+ maxValue: (inst) => {
10536
+ const { maximum, exclusiveMaximum } = aggregateChecks(inst);
10537
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
10538
+ },
10539
+ isInt: (inst) => {
10540
+ const { isInt, multipleOf } = aggregateChecks(inst);
10541
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
10542
+ },
10543
+ format: (inst) => aggregateChecks(inst).format ?? null,
10288
10544
  }, {
10289
10545
  gt(value, params) {
10290
10546
  return this.check(_gt(value, params));
@@ -10331,7 +10587,7 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
10331
10587
  finite() {
10332
10588
  return this;
10333
10589
  },
10334
- });
10590
+ }));
10335
10591
  function number(params) {
10336
10592
  return _number(ZodNumber, params);
10337
10593
  }
@@ -10403,19 +10659,20 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
10403
10659
  return _enum(Object.keys(this._zod.def.shape));
10404
10660
  },
10405
10661
  catchall(catchall) {
10406
- return this.clone({ ...this._zod.def, catchall: catchall });
10662
+ // `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
10663
+ return this.clone(mergeDefs(this._zod.def, { catchall: catchall }));
10407
10664
  },
10408
10665
  passthrough() {
10409
- return this.clone({ ...this._zod.def, catchall: unknown() });
10666
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
10410
10667
  },
10411
10668
  loose() {
10412
- return this.clone({ ...this._zod.def, catchall: unknown() });
10669
+ return this.clone(mergeDefs(this._zod.def, { catchall: unknown() }));
10413
10670
  },
10414
10671
  strict() {
10415
- return this.clone({ ...this._zod.def, catchall: never() });
10672
+ return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
10416
10673
  },
10417
10674
  strip() {
10418
- return this.clone({ ...this._zod.def, catchall: undefined });
10675
+ return this.clone(mergeDefs(this._zod.def, { catchall: undefined }));
10419
10676
  },
10420
10677
  extend(incoming) {
10421
10678
  return extend(this, incoming);
@@ -10505,7 +10762,8 @@ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
10505
10762
  ZodType.init(inst, def);
10506
10763
  inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json);
10507
10764
  inst.enum = def.entries;
10508
- inst.options = Object.values(def.entries);
10765
+ // reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
10766
+ inst.options = [...inst._zod.values];
10509
10767
  const keys = new Set(Object.keys(def.entries));
10510
10768
  inst.extract = (values, params) => {
10511
10769
  const newEntries = {};
@@ -10762,8 +11020,16 @@ function refine(fn, _params = {}) {
10762
11020
  function superRefine(fn, params) {
10763
11021
  return _superRefine(fn, params);
10764
11022
  }
11023
+ const ZodInstanceOf = /*@__PURE__*/ $constructor("ZodInstanceOf", (inst, def) => {
11024
+ ZodCustom.init(inst, def);
11025
+ }, {
11026
+ properties(shape, params) {
11027
+ // asserts in place, so the narrowed output type is truthful without a wrapper
11028
+ return this.check(_properties(shape, params));
11029
+ },
11030
+ });
10765
11031
  function _instanceof(cls, params = {}) {
10766
- const inst = new ZodCustom({
11032
+ const inst = new ZodInstanceOf({
10767
11033
  type: "custom",
10768
11034
  check: "custom",
10769
11035
  fn: (data) => data instanceof cls,
@@ -10792,13 +11058,14 @@ const ZodIssueCode = {
10792
11058
  custom: "custom",
10793
11059
  };
10794
11060
 
10795
- var isMergeableObject;
10796
- var hasRequiredIsMergeableObject;
11061
+ var cjs;
11062
+ var hasRequiredCjs;
10797
11063
 
10798
- function requireIsMergeableObject () {
10799
- if (hasRequiredIsMergeableObject) return isMergeableObject;
10800
- hasRequiredIsMergeableObject = 1;
10801
- isMergeableObject = function isMergeableObject(value) {
11064
+ function requireCjs () {
11065
+ if (hasRequiredCjs) return cjs;
11066
+ hasRequiredCjs = 1;
11067
+
11068
+ var isMergeableObject = function isMergeableObject(value) {
10802
11069
  return isNonNullObject(value)
10803
11070
  && !isSpecial(value)
10804
11071
  };
@@ -10822,16 +11089,6 @@ function requireIsMergeableObject () {
10822
11089
  function isReactElement(value) {
10823
11090
  return value.$$typeof === REACT_ELEMENT_TYPE
10824
11091
  }
10825
- return isMergeableObject;
10826
- }
10827
-
10828
- var deepmerge_1;
10829
- var hasRequiredDeepmerge;
10830
-
10831
- function requireDeepmerge () {
10832
- if (hasRequiredDeepmerge) return deepmerge_1;
10833
- hasRequiredDeepmerge = 1;
10834
- var defaultIsMergeableObject = requireIsMergeableObject();
10835
11092
 
10836
11093
  function emptyTarget(val) {
10837
11094
  return Array.isArray(val) ? [] : {}
@@ -10908,7 +11165,7 @@ function requireDeepmerge () {
10908
11165
  function deepmerge(target, source, options) {
10909
11166
  options = options || {};
10910
11167
  options.arrayMerge = options.arrayMerge || defaultArrayMerge;
10911
- options.isMergeableObject = options.isMergeableObject || defaultIsMergeableObject;
11168
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
10912
11169
  // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
10913
11170
  // implementations can use it. The caller may not replace it.
10914
11171
  options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
@@ -10936,12 +11193,14 @@ function requireDeepmerge () {
10936
11193
  }, {})
10937
11194
  };
10938
11195
 
10939
- deepmerge_1 = deepmerge;
10940
- return deepmerge_1;
11196
+ var deepmerge_1 = deepmerge;
11197
+
11198
+ cjs = deepmerge_1;
11199
+ return cjs;
10941
11200
  }
10942
11201
 
10943
- var deepmergeExports = requireDeepmerge();
10944
- var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(deepmergeExports);
11202
+ var cjsExports = requireCjs();
11203
+ var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
10945
11204
 
10946
11205
  /**
10947
11206
  * Enum representing the severity levels of telemetry items.
@@ -11075,7 +11334,7 @@ const TelemetryCustomEventSchema = TelemetryEventSchema.extend({
11075
11334
  type: literal(TelemetryType.Custom),
11076
11335
  }).passthrough();
11077
11336
 
11078
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11337
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11079
11338
  /*
11080
11339
  * Copyright (c) Microsoft Corporation. All rights reserved.
11081
11340
  * Licensed under the MIT License.
@@ -11129,7 +11388,7 @@ const RESOURCE = "resource";
11129
11388
  const CLI_DATA = "clidata";
11130
11389
  const ATTRIBUTE_TOKENS = "attribute_tokens";
11131
11390
 
11132
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11391
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11133
11392
  /*
11134
11393
  * Copyright (c) Microsoft Corporation. All rights reserved.
11135
11394
  * Licensed under the MIT License.
@@ -11363,7 +11622,7 @@ const JsonWebTokenTypes = {
11363
11622
  // Token renewal offset default in seconds
11364
11623
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
11365
11624
 
11366
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11625
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11367
11626
  /*
11368
11627
  * Copyright (c) Microsoft Corporation. All rights reserved.
11369
11628
  * Licensed under the MIT License.
@@ -11392,7 +11651,7 @@ function createAuthError(code, correlationId, additionalMessage) {
11392
11651
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
11393
11652
  }
11394
11653
 
11395
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11654
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11396
11655
 
11397
11656
  /*
11398
11657
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11415,7 +11674,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
11415
11674
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
11416
11675
  }
11417
11676
 
11418
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11677
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11419
11678
  /*
11420
11679
  * Copyright (c) Microsoft Corporation. All rights reserved.
11421
11680
  * Licensed under the MIT License.
@@ -11453,7 +11712,7 @@ const methodNotImplemented = "method_not_implemented";
11453
11712
  const resourceParameterRequired = "resource_parameter_required";
11454
11713
  const misplacedResourceParam = "misplaced_resource_parameter";
11455
11714
 
11456
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11715
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11457
11716
 
11458
11717
  /*
11459
11718
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11491,7 +11750,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
11491
11750
  };
11492
11751
  }
11493
11752
 
11494
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11753
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11495
11754
 
11496
11755
  /*
11497
11756
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11557,7 +11816,7 @@ function getJWSPayload(authToken, correlationId) {
11557
11816
  return matches[2];
11558
11817
  }
11559
11818
 
11560
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11819
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11561
11820
 
11562
11821
  /*
11563
11822
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11645,7 +11904,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
11645
11904
  return updatedAccountInfo;
11646
11905
  }
11647
11906
 
11648
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11907
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11649
11908
  /*
11650
11909
  * Copyright (c) Microsoft Corporation. All rights reserved.
11651
11910
  * Licensed under the MIT License.
@@ -11659,7 +11918,7 @@ const AuthorityType = {
11659
11918
  Ciam: 3,
11660
11919
  };
11661
11920
 
11662
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11921
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11663
11922
  /*
11664
11923
  * Copyright (c) Microsoft Corporation. All rights reserved.
11665
11924
  * Licensed under the MIT License.
@@ -11681,7 +11940,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
11681
11940
  return null;
11682
11941
  }
11683
11942
 
11684
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11943
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11685
11944
  /*
11686
11945
  * Copyright (c) Microsoft Corporation. All rights reserved.
11687
11946
  * Licensed under the MIT License.
@@ -11705,7 +11964,7 @@ const ProtocolMode = {
11705
11964
  EAR: "EAR",
11706
11965
  };
11707
11966
 
11708
- /*! @azure/msal-common v16.14.0 2026-08-28 */
11967
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11709
11968
  /**
11710
11969
  * Returns the AccountInfo interface for this account.
11711
11970
  * @internal
@@ -11894,7 +12153,7 @@ function isAccountEntity(entity) {
11894
12153
  entity.hasOwnProperty("authorityType"));
11895
12154
  }
11896
12155
 
11897
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12156
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11898
12157
  /*
11899
12158
  * Copyright (c) Microsoft Corporation. All rights reserved.
11900
12159
  * Licensed under the MIT License.
@@ -11904,7 +12163,7 @@ function isAccountEntity(entity) {
11904
12163
  */
11905
12164
  const unexpectedError = "unexpected_error";
11906
12165
 
11907
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12166
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11908
12167
 
11909
12168
  /*
11910
12169
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11924,7 +12183,7 @@ function createClientConfigurationError(errorCode, correlationId) {
11924
12183
  return new ClientConfigurationError(errorCode, correlationId);
11925
12184
  }
11926
12185
 
11927
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12186
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11928
12187
  /*
11929
12188
  * Copyright (c) Microsoft Corporation. All rights reserved.
11930
12189
  * Licensed under the MIT License.
@@ -11955,7 +12214,7 @@ const invalidDpopHtu = "invalid_dpop_htu";
11955
12214
  const invalidDpopNonce = "invalid_dpop_nonce";
11956
12215
  const dpopMissingResourceContext = "dpop_missing_resource_context";
11957
12216
 
11958
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12217
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11959
12218
  /*
11960
12219
  * Copyright (c) Microsoft Corporation. All rights reserved.
11961
12220
  * Licensed under the MIT License.
@@ -11967,7 +12226,7 @@ function isOpenIdConfigResponse(response) {
11967
12226
  response.hasOwnProperty("jwks_uri"));
11968
12227
  }
11969
12228
 
11970
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12229
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
11971
12230
  /*
11972
12231
  * Copyright (c) Microsoft Corporation. All rights reserved.
11973
12232
  * Licensed under the MIT License.
@@ -12047,7 +12306,7 @@ class StringUtils {
12047
12306
  }
12048
12307
  }
12049
12308
 
12050
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12309
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12051
12310
 
12052
12311
  /*
12053
12312
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12205,7 +12464,7 @@ class UrlString {
12205
12464
  }
12206
12465
  }
12207
12466
 
12208
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12467
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12209
12468
 
12210
12469
  /*
12211
12470
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12359,7 +12618,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
12359
12618
  return null;
12360
12619
  }
12361
12620
 
12362
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12621
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12363
12622
  /*
12364
12623
  * Copyright (c) Microsoft Corporation. All rights reserved.
12365
12624
  * Licensed under the MIT License.
@@ -12368,7 +12627,7 @@ const AzureCloudInstance = {
12368
12627
  // AzureCloudInstance is not specified.
12369
12628
  None: "none"};
12370
12629
 
12371
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12630
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12372
12631
  /*
12373
12632
  * Copyright (c) Microsoft Corporation. All rights reserved.
12374
12633
  * Licensed under the MIT License.
@@ -12378,7 +12637,7 @@ function isCloudInstanceDiscoveryResponse(response) {
12378
12637
  response.hasOwnProperty("metadata"));
12379
12638
  }
12380
12639
 
12381
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12640
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12382
12641
  /*
12383
12642
  * Copyright (c) Microsoft Corporation. All rights reserved.
12384
12643
  * Licensed under the MIT License.
@@ -12388,7 +12647,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
12388
12647
  response.hasOwnProperty("error_description"));
12389
12648
  }
12390
12649
 
12391
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12650
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12392
12651
  /*
12393
12652
  * Copyright (c) Microsoft Corporation. All rights reserved.
12394
12653
  * Licensed under the MIT License.
@@ -12459,7 +12718,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
12459
12718
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
12460
12719
  const SetUserData = "setUserData";
12461
12720
 
12462
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12721
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12463
12722
  /*
12464
12723
  * Copyright (c) Microsoft Corporation. All rights reserved.
12465
12724
  * Licensed under the MIT License.
@@ -12552,7 +12811,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
12552
12811
  };
12553
12812
  };
12554
12813
 
12555
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12814
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12556
12815
 
12557
12816
  /*
12558
12817
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12663,7 +12922,7 @@ RegionDiscovery.IMDS_OPTIONS = {
12663
12922
  },
12664
12923
  };
12665
12924
 
12666
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12925
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12667
12926
  /*
12668
12927
  * Copyright (c) Microsoft Corporation. All rights reserved.
12669
12928
  * Licensed under the MIT License.
@@ -12728,7 +12987,7 @@ function wasClockTurnedBack(cachedAt) {
12728
12987
  return cachedAtSec > nowSeconds();
12729
12988
  }
12730
12989
 
12731
- /*! @azure/msal-common v16.14.0 2026-08-28 */
12990
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
12732
12991
 
12733
12992
  /*
12734
12993
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -13015,7 +13274,7 @@ function serializeAttributeTokens(attributeTokens) {
13015
13274
  return [...attributeTokens].sort().join(" ");
13016
13275
  }
13017
13276
 
13018
- /*! @azure/msal-common v16.14.0 2026-08-28 */
13277
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
13019
13278
 
13020
13279
  /*
13021
13280
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -13983,7 +14242,7 @@ function buildStaticAuthorityOptions(authOptions) {
13983
14242
  };
13984
14243
  }
13985
14244
 
13986
- /*! @azure/msal-common v16.14.0 2026-08-28 */
14245
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
13987
14246
 
13988
14247
  /*
13989
14248
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14017,7 +14276,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
14017
14276
  }
14018
14277
  }
14019
14278
 
14020
- /*! @azure/msal-common v16.14.0 2026-08-28 */
14279
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14021
14280
 
14022
14281
  /*
14023
14282
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14213,7 +14472,7 @@ class ScopeSet {
14213
14472
  }
14214
14473
  }
14215
14474
 
14216
- /*! @azure/msal-common v16.14.0 2026-08-28 */
14475
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14217
14476
 
14218
14477
  /*
14219
14478
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14699,7 +14958,7 @@ function addAttributeTokens(parameters, attributeTokens) {
14699
14958
  }
14700
14959
  }
14701
14960
 
14702
- /*! @azure/msal-common v16.14.0 2026-08-28 */
14961
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14703
14962
 
14704
14963
  /*
14705
14964
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14821,7 +15080,7 @@ function validateUrl(url, logger, correlationId) {
14821
15080
  }
14822
15081
  }
14823
15082
 
14824
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15083
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14825
15084
 
14826
15085
  /*
14827
15086
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14869,7 +15128,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
14869
15128
  },
14870
15129
  };
14871
15130
 
14872
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15131
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14873
15132
 
14874
15133
  /*
14875
15134
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14892,7 +15151,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
14892
15151
  },
14893
15152
  };
14894
15153
 
14895
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15154
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
14896
15155
  /*
14897
15156
  * Copyright (c) Microsoft Corporation. All rights reserved.
14898
15157
  * Licensed under the MIT License.
@@ -15167,12 +15426,12 @@ class Logger {
15167
15426
  }
15168
15427
  }
15169
15428
 
15170
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15429
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
15171
15430
  /* eslint-disable header/header */
15172
15431
  const name$1 = "@azure/msal-common";
15173
- const version$2 = "16.14.0";
15432
+ const version$2 = "16.14.1";
15174
15433
 
15175
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15434
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
15176
15435
  /*
15177
15436
  * Copyright (c) Microsoft Corporation. All rights reserved.
15178
15437
  * Licensed under the MIT License.
@@ -15180,7 +15439,7 @@ const version$2 = "16.14.0";
15180
15439
  const cacheQuotaExceeded = "cache_quota_exceeded";
15181
15440
  const cacheErrorUnknown = "cache_error_unknown";
15182
15441
 
15183
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15442
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
15184
15443
 
15185
15444
  /*
15186
15445
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -15218,7 +15477,7 @@ function createCacheError(e) {
15218
15477
  }
15219
15478
  }
15220
15479
 
15221
- /*! @azure/msal-common v16.14.0 2026-08-28 */
15480
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
15222
15481
 
15223
15482
  /*
15224
15483
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16405,7 +16664,7 @@ class DefaultStorageClass extends CacheManager {
16405
16664
  }
16406
16665
  }
16407
16666
 
16408
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16667
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16409
16668
  /*
16410
16669
  * Copyright (c) Microsoft Corporation. All rights reserved.
16411
16670
  * Licensed under the MIT License.
@@ -16419,7 +16678,7 @@ class DefaultStorageClass extends CacheManager {
16419
16678
  const PerformanceEventStatus = {
16420
16679
  InProgress: 1};
16421
16680
 
16422
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16681
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16423
16682
 
16424
16683
  /*
16425
16684
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16477,7 +16736,7 @@ class StubPerformanceClient {
16477
16736
  }
16478
16737
  }
16479
16738
 
16480
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16739
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16481
16740
 
16482
16741
  /*
16483
16742
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16575,7 +16834,7 @@ function isOidcProtocolMode(config) {
16575
16834
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
16576
16835
  }
16577
16836
 
16578
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16837
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16579
16838
  /*
16580
16839
  * Copyright (c) Microsoft Corporation. All rights reserved.
16581
16840
  * Licensed under the MIT License.
@@ -16602,7 +16861,7 @@ function isOidcProtocolMode(config) {
16602
16861
  }
16603
16862
  }
16604
16863
 
16605
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16864
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16606
16865
 
16607
16866
  /*
16608
16867
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16623,7 +16882,7 @@ function createJoseHeaderError(code, correlationId) {
16623
16882
  return new JoseHeaderError(code, correlationId);
16624
16883
  }
16625
16884
 
16626
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16885
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16627
16886
  /*
16628
16887
  * Copyright (c) Microsoft Corporation. All rights reserved.
16629
16888
  * Licensed under the MIT License.
@@ -16648,7 +16907,7 @@ function isPlainObject(value) {
16648
16907
  return Object.getPrototypeOf(value) === proto;
16649
16908
  }
16650
16909
 
16651
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16910
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16652
16911
  /*
16653
16912
  * Copyright (c) Microsoft Corporation. All rights reserved.
16654
16913
  * Licensed under the MIT License.
@@ -16658,7 +16917,7 @@ const missingAlgError = "missing_alg_error";
16658
16917
  const missingJwkError = "missing_jwk_error";
16659
16918
  const invalidJwkError = "invalid_jwk_error";
16660
16919
 
16661
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16920
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16662
16921
 
16663
16922
  /*
16664
16923
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16724,7 +16983,7 @@ class JoseHeader {
16724
16983
  }
16725
16984
  }
16726
16985
 
16727
- /*! @azure/msal-common v16.14.0 2026-08-28 */
16986
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16728
16987
 
16729
16988
  /*
16730
16989
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16825,7 +17084,7 @@ class PopTokenGenerator {
16825
17084
  }
16826
17085
  }
16827
17086
 
16828
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17087
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16829
17088
 
16830
17089
  /*
16831
17090
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -16970,7 +17229,7 @@ class DpopProofGenerator {
16970
17229
  }
16971
17230
  }
16972
17231
 
16973
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17232
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
16974
17233
  /*
16975
17234
  * Copyright (c) Microsoft Corporation. All rights reserved.
16976
17235
  * Licensed under the MIT License.
@@ -17021,7 +17280,7 @@ const badToken = "bad_token";
17021
17280
  */
17022
17281
  const interruptedUser = "interrupted_user";
17023
17282
 
17024
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17283
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17025
17284
 
17026
17285
  /*
17027
17286
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17088,7 +17347,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
17088
17347
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
17089
17348
  }
17090
17349
 
17091
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17350
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17092
17351
 
17093
17352
  /*
17094
17353
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17107,7 +17366,7 @@ class ServerError extends AuthError {
17107
17366
  }
17108
17367
  }
17109
17368
 
17110
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17369
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17111
17370
 
17112
17371
  /*
17113
17372
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17178,7 +17437,7 @@ function parseRequestState(base64Decode, state, correlationId) {
17178
17437
  }
17179
17438
  }
17180
17439
 
17181
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17440
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17182
17441
 
17183
17442
  /*
17184
17443
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17251,11 +17510,26 @@ class ResponseHandler {
17251
17510
  let idTokenClaims;
17252
17511
  if (serverTokenResponse.id_token) {
17253
17512
  idTokenClaims = extractTokenClaims(serverTokenResponse.id_token || "", this.cryptoObj.base64Decode, request.correlationId);
17254
- // token nonce check (TODO: Add a warning if no nonce is given?)
17255
- if (authCodePayload && authCodePayload.nonce) {
17256
- if (idTokenClaims.nonce !== authCodePayload.nonce) {
17257
- throw createClientAuthError(nonceMismatch, request.correlationId);
17258
- }
17513
+ }
17514
+ /*
17515
+ * Callers opt in to strict nonce-presence validation by including
17516
+ * the nonce property, even when its value is undefined.
17517
+ */
17518
+ if (authCodePayload &&
17519
+ Object.prototype.hasOwnProperty.call(authCodePayload, "nonce")) {
17520
+ const expectedNonce = authCodePayload.nonce;
17521
+ const tokenNonce = idTokenClaims?.nonce;
17522
+ // Warn when the ID Token nonce cannot be bound to the request.
17523
+ if (tokenNonce !== undefined && expectedNonce === undefined) {
17524
+ this.logger.warning("0thba9", request.correlationId);
17525
+ throw createClientAuthError(nonceMismatch, request.correlationId);
17526
+ }
17527
+ // If the request supplies a nonce, the ID Token value must be a matching string.
17528
+ if (expectedNonce !== undefined &&
17529
+ (typeof expectedNonce !== "string" ||
17530
+ typeof tokenNonce !== "string" ||
17531
+ expectedNonce !== tokenNonce)) {
17532
+ throw createClientAuthError(nonceMismatch, request.correlationId);
17259
17533
  }
17260
17534
  }
17261
17535
  // generate homeAccountId
@@ -17591,7 +17865,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
17591
17865
  return baseAccount;
17592
17866
  }
17593
17867
 
17594
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17868
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17595
17869
  /*
17596
17870
  * Copyright (c) Microsoft Corporation. All rights reserved.
17597
17871
  * Licensed under the MIT License.
@@ -17601,7 +17875,7 @@ const CcsCredentialType = {
17601
17875
  UPN: "UPN",
17602
17876
  };
17603
17877
 
17604
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17878
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17605
17879
  /*
17606
17880
  * Copyright (c) Microsoft Corporation. All rights reserved.
17607
17881
  * Licensed under the MIT License.
@@ -17620,7 +17894,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
17620
17894
  }
17621
17895
  }
17622
17896
 
17623
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17897
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17624
17898
 
17625
17899
  /*
17626
17900
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17644,7 +17918,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
17644
17918
  };
17645
17919
  }
17646
17920
 
17647
- /*! @azure/msal-common v16.14.0 2026-08-28 */
17921
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17648
17922
 
17649
17923
  /*
17650
17924
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17730,7 +18004,7 @@ class ThrottlingUtils {
17730
18004
  }
17731
18005
  }
17732
18006
 
17733
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18007
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17734
18008
 
17735
18009
  /*
17736
18010
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17761,7 +18035,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
17761
18035
  return new NetworkError(error, httpStatus, responseHeaders);
17762
18036
  }
17763
18037
 
17764
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18038
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17765
18039
 
17766
18040
  /*
17767
18041
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17894,7 +18168,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
17894
18168
  return response;
17895
18169
  }
17896
18170
 
17897
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18171
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
17898
18172
 
17899
18173
  /*
17900
18174
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -18158,7 +18432,7 @@ class AuthorizationCodeClient {
18158
18432
  }
18159
18433
  }
18160
18434
 
18161
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18435
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
18162
18436
 
18163
18437
  /*
18164
18438
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -18385,7 +18659,7 @@ function extractLoginHint(account) {
18385
18659
  return account.loginHint || account.idTokenClaims?.login_hint || null;
18386
18660
  }
18387
18661
 
18388
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18662
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
18389
18663
 
18390
18664
  /*
18391
18665
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -18619,7 +18893,7 @@ class RefreshTokenClient {
18619
18893
  }
18620
18894
  }
18621
18895
 
18622
- /*! @azure/msal-common v16.14.0 2026-08-28 */
18896
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
18623
18897
 
18624
18898
  /*
18625
18899
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -18912,7 +19186,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
18912
19186
  clearNativeBrokerErrorCode() { }
18913
19187
  }
18914
19188
 
18915
- /*! @azure/msal-common v16.14.0 2026-08-28 */
19189
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
18916
19190
 
18917
19191
  /*
18918
19192
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19039,7 +19313,7 @@ class SilentFlowClient {
19039
19313
  }
19040
19314
  }
19041
19315
 
19042
- /*! @azure/msal-common v16.14.0 2026-08-28 */
19316
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
19043
19317
 
19044
19318
  /*
19045
19319
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19055,7 +19329,7 @@ const StubbedNetworkModule = {
19055
19329
  },
19056
19330
  };
19057
19331
 
19058
- /*! @azure/msal-common v16.14.0 2026-08-28 */
19332
+ /*! @azure/msal-common v16.14.1 2026-09-15 */
19059
19333
 
19060
19334
  /*
19061
19335
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19088,7 +19362,7 @@ function containsResourceParam(params) {
19088
19362
  return Object.prototype.hasOwnProperty.call(params, "resource");
19089
19363
  }
19090
19364
 
19091
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19365
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19092
19366
  /*
19093
19367
  * Copyright (c) Microsoft Corporation. All rights reserved.
19094
19368
  * Licensed under the MIT License.
@@ -19215,7 +19489,7 @@ const DecryptEarResponse = "decryptEarResponse";
19215
19489
  */
19216
19490
  const WaitForBridgeLateResponse = "waitForBridgeLateResponse";
19217
19491
 
19218
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19492
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19219
19493
 
19220
19494
  /*
19221
19495
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19238,7 +19512,7 @@ function createBrowserAuthError(errorCode, correlationId, subError) {
19238
19512
  return new BrowserAuthError(errorCode, correlationId, subError);
19239
19513
  }
19240
19514
 
19241
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19515
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19242
19516
  /*
19243
19517
  * Copyright (c) Microsoft Corporation. All rights reserved.
19244
19518
  * Licensed under the MIT License.
@@ -19296,7 +19570,7 @@ const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
19296
19570
  const timedOut = "timed_out";
19297
19571
  const emptyResponse = "empty_response";
19298
19572
 
19299
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19573
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19300
19574
 
19301
19575
  /*
19302
19576
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19335,7 +19609,7 @@ function base64DecToArr(base64String) {
19335
19609
  return Uint8Array.from(binString, (m) => m.codePointAt(0) || 0);
19336
19610
  }
19337
19611
 
19338
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19612
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19339
19613
 
19340
19614
  /*
19341
19615
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19521,7 +19795,7 @@ const iFrameRenewalPolicies = [
19521
19795
  CacheLookupPolicy.RefreshTokenAndNetwork,
19522
19796
  ];
19523
19797
 
19524
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19798
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19525
19799
  /*
19526
19800
  * Copyright (c) Microsoft Corporation. All rights reserved.
19527
19801
  * Licensed under the MIT License.
@@ -19566,7 +19840,7 @@ function base64EncArr(aBytes) {
19566
19840
  return btoa(binString);
19567
19841
  }
19568
19842
 
19569
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
19843
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19570
19844
 
19571
19845
  /*
19572
19846
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19913,7 +20187,7 @@ async function computeJwkThumbprint(publicJwk, correlationId) {
19913
20187
  return hashString(thumbprintJson);
19914
20188
  }
19915
20189
 
19916
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20190
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19917
20191
 
19918
20192
  /*
19919
20193
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19933,7 +20207,7 @@ function createBrowserConfigurationAuthError(errorCode, correlationId) {
19933
20207
  return new BrowserConfigurationAuthError(errorCode, correlationId, getDefaultErrorMessage(errorCode));
19934
20208
  }
19935
20209
 
19936
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20210
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19937
20211
  /*
19938
20212
  * Copyright (c) Microsoft Corporation. All rights reserved.
19939
20213
  * Licensed under the MIT License.
@@ -19941,7 +20215,7 @@ function createBrowserConfigurationAuthError(errorCode, correlationId) {
19941
20215
  const storageNotSupported = "storage_not_supported";
19942
20216
  const inMemRedirectUnavailable = "in_mem_redirect_unavailable";
19943
20217
 
19944
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20218
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
19945
20219
 
19946
20220
  /*
19947
20221
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20282,7 +20556,7 @@ function createGuid() {
20282
20556
  return createNewGuid();
20283
20557
  }
20284
20558
 
20285
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20559
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20286
20560
 
20287
20561
  /*
20288
20562
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20485,7 +20759,7 @@ class DatabaseStorage {
20485
20759
  }
20486
20760
  }
20487
20761
 
20488
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20762
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20489
20763
  /*
20490
20764
  * Copyright (c) Microsoft Corporation. All rights reserved.
20491
20765
  * Licensed under the MIT License.
@@ -20531,7 +20805,7 @@ class MemoryStorage {
20531
20805
  }
20532
20806
  }
20533
20807
 
20534
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20808
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20535
20809
 
20536
20810
  /*
20537
20811
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20669,7 +20943,7 @@ class AsyncMemoryStorage {
20669
20943
  }
20670
20944
  }
20671
20945
 
20672
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
20946
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20673
20947
 
20674
20948
  /*
20675
20949
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20817,7 +21091,7 @@ TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES = [
20817
21091
  "verify",
20818
21092
  ];
20819
21093
 
20820
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21094
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20821
21095
 
20822
21096
  /*
20823
21097
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -20953,7 +21227,7 @@ class CryptoOps {
20953
21227
  }
20954
21228
  }
20955
21229
 
20956
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21230
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
20957
21231
  /*
20958
21232
  * Copyright (c) Microsoft Corporation. All rights reserved.
20959
21233
  * Licensed under the MIT License.
@@ -21000,7 +21274,7 @@ const LocalStorageUpdated = "localStorageUpdated";
21000
21274
  */
21001
21275
  const SsoCapable = "ssoCapable";
21002
21276
 
21003
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21277
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21004
21278
  /*
21005
21279
  * Copyright (c) Microsoft Corporation. All rights reserved.
21006
21280
  * Licensed under the MIT License.
@@ -21029,7 +21303,7 @@ function getTokenKeysCacheKey(clientId, schema = CREDENTIAL_SCHEMA_VERSION) {
21029
21303
  return `${PREFIX}.${schema}.${TOKEN_KEYS}.${clientId}`;
21030
21304
  }
21031
21305
 
21032
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21306
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21033
21307
 
21034
21308
  /*
21035
21309
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21120,7 +21394,7 @@ function getCookieExpirationTime(cookieLifeDays) {
21120
21394
  return expr.toUTCString();
21121
21395
  }
21122
21396
 
21123
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21397
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21124
21398
 
21125
21399
  /*
21126
21400
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21162,7 +21436,7 @@ function getTokenKeys(clientId, storage, schemaVersion) {
21162
21436
  };
21163
21437
  }
21164
21438
 
21165
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21439
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21166
21440
  /*
21167
21441
  * Copyright (c) Microsoft Corporation. All rights reserved.
21168
21442
  * Licensed under the MIT License.
@@ -21173,7 +21447,7 @@ function isEncrypted(data) {
21173
21447
  data.hasOwnProperty("data"));
21174
21448
  }
21175
21449
 
21176
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21450
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21177
21451
 
21178
21452
  /*
21179
21453
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21475,7 +21749,7 @@ class LocalStorage {
21475
21749
  }
21476
21750
  }
21477
21751
 
21478
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21752
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21479
21753
 
21480
21754
  /*
21481
21755
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21517,7 +21791,7 @@ class SessionStorage {
21517
21791
  }
21518
21792
  }
21519
21793
 
21520
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21794
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21521
21795
  /*
21522
21796
  * Copyright (c) Microsoft Corporation. All rights reserved.
21523
21797
  * Licensed under the MIT License.
@@ -21545,12 +21819,12 @@ const EventType = {
21545
21819
  BROKER_CONNECTION_ESTABLISHED: "msal:brokerConnectionEstablished",
21546
21820
  };
21547
21821
 
21548
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21822
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21549
21823
  /* eslint-disable header/header */
21550
21824
  const name = "@azure/msal-browser";
21551
- const version$1 = "5.20.0";
21825
+ const version$1 = "5.23.0";
21552
21826
 
21553
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21827
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21554
21828
  /*
21555
21829
  * Copyright (c) Microsoft Corporation. All rights reserved.
21556
21830
  * Licensed under the MIT License.
@@ -21567,7 +21841,7 @@ function removeElementFromArray(array, element) {
21567
21841
  }
21568
21842
  }
21569
21843
 
21570
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
21844
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
21571
21845
 
21572
21846
  /*
21573
21847
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23013,7 +23287,7 @@ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, even
23013
23287
  return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient, eventHandler, staticAuthorityOptions, tokenBindingKeyManager);
23014
23288
  };
23015
23289
 
23016
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23290
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23017
23291
  /*
23018
23292
  * Copyright (c) Microsoft Corporation. All rights reserved.
23019
23293
  * Licensed under the MIT License.
@@ -23060,7 +23334,7 @@ function getActiveAccount(browserStorage, correlationId) {
23060
23334
  return browserStorage.getActiveAccount(correlationId);
23061
23335
  }
23062
23336
 
23063
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23337
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23064
23338
 
23065
23339
  /*
23066
23340
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23164,7 +23438,7 @@ class EventHandler {
23164
23438
  }
23165
23439
  }
23166
23440
 
23167
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23441
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23168
23442
 
23169
23443
  /*
23170
23444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23307,7 +23581,7 @@ async function clearCacheOnLogout(browserStorage, browserCrypto, logger, correla
23307
23581
  }
23308
23582
  }
23309
23583
 
23310
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23584
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23311
23585
 
23312
23586
  /*
23313
23587
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23445,7 +23719,7 @@ function validateRequestMethod(interactionRequest, protocolMode) {
23445
23719
  return httpMethod;
23446
23720
  }
23447
23721
 
23448
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23722
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23449
23723
 
23450
23724
  /*
23451
23725
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23652,7 +23926,7 @@ async function initializeAuthorizationRequest(request, interactionType, config,
23652
23926
  return validatedRequest;
23653
23927
  }
23654
23928
 
23655
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23929
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23656
23930
  /*
23657
23931
  * Copyright (c) Microsoft Corporation. All rights reserved.
23658
23932
  * Licensed under the MIT License.
@@ -23670,7 +23944,7 @@ async function initializeAuthorizationRequest(request, interactionType, config,
23670
23944
  */
23671
23945
  const POPUP_RELAY_RESPONSE_TYPE = "msal:popup-relay-response:v1";
23672
23946
 
23673
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
23947
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23674
23948
 
23675
23949
  /*
23676
23950
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23776,7 +24050,7 @@ async function waitForPopupRelayResponse(timeoutMs, logger, request, popupWindow
23776
24050
  });
23777
24051
  }
23778
24052
 
23779
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24053
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23780
24054
 
23781
24055
  /*
23782
24056
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23800,7 +24074,7 @@ function extractBrowserRequestState(browserCrypto, state, correlationId) {
23800
24074
  }
23801
24075
  }
23802
24076
 
23803
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24077
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23804
24078
 
23805
24079
  /*
23806
24080
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23839,7 +24113,7 @@ function validateInteractionType(response, browserCrypto, interactionType, corre
23839
24113
  }
23840
24114
  }
23841
24115
 
23842
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24116
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23843
24117
 
23844
24118
  /*
23845
24119
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -23928,7 +24202,52 @@ class InteractionHandler {
23928
24202
  }
23929
24203
  }
23930
24204
 
23931
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24205
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
24206
+
24207
+ /*
24208
+ * Copyright (c) Microsoft Corporation. All rights reserved.
24209
+ * Licensed under the MIT License.
24210
+ */
24211
+ /**
24212
+ * Token types supported by the platform broker request contract.
24213
+ */
24214
+ const PlatformAuthTokenType = {
24215
+ DPOP_WITH_PROOF: "dpop+proof",
24216
+ };
24217
+ const PROOF_OF_POSSESSION_TOKEN_TYPES = [
24218
+ AuthenticationScheme.POP,
24219
+ AuthenticationScheme.DPOP,
24220
+ PlatformAuthTokenType.DPOP_WITH_PROOF,
24221
+ ];
24222
+ /**
24223
+ * Returns whether a platform broker token type requires proof request metadata.
24224
+ */
24225
+ function isProofOfPossessionTokenType(tokenType) {
24226
+ return (tokenType !== undefined &&
24227
+ PROOF_OF_POSSESSION_TOKEN_TYPES.includes(tokenType));
24228
+ }
24229
+ /**
24230
+ * Adds canonical proof request fields to the broker no-cache property bag.
24231
+ */
24232
+ function createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionRequest, resourceRequestMethod, resourceRequestUri, dpopNonce) {
24233
+ if (!isProofOfPossessionRequest) {
24234
+ return extraParametersNoCache;
24235
+ }
24236
+ return {
24237
+ ...extraParametersNoCache,
24238
+ ...(resourceRequestMethod && {
24239
+ pop_method: resourceRequestMethod,
24240
+ }),
24241
+ ...(resourceRequestUri && {
24242
+ pop_url: resourceRequestUri,
24243
+ }),
24244
+ ...(dpopNonce && {
24245
+ pop_nonce: dpopNonce,
24246
+ }),
24247
+ };
24248
+ }
24249
+
24250
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23932
24251
  /*
23933
24252
  * Copyright (c) Microsoft Corporation. All rights reserved.
23934
24253
  * Licensed under the MIT License.
@@ -23937,7 +24256,7 @@ const contentError = "ContentError";
23937
24256
  const pageException = "PageException";
23938
24257
  const userSwitch = "user_switch";
23939
24258
 
23940
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24259
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23941
24260
  /*
23942
24261
  * Copyright (c) Microsoft Corporation. All rights reserved.
23943
24262
  * Licensed under the MIT License.
@@ -23950,7 +24269,7 @@ const DISABLED = "DISABLED";
23950
24269
  const ACCOUNT_UNAVAILABLE = "ACCOUNT_UNAVAILABLE";
23951
24270
  const UI_NOT_ALLOWED = "UI_NOT_ALLOWED";
23952
24271
 
23953
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24272
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
23954
24273
 
23955
24274
  /*
23956
24275
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -24022,7 +24341,7 @@ function createNativeAuthError(code, correlationId, description, ext) {
24022
24341
  return error;
24023
24342
  }
24024
24343
 
24025
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24344
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
24026
24345
 
24027
24346
  /*
24028
24347
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -24071,7 +24390,7 @@ class SilentCacheClient extends StandardInteractionClient {
24071
24390
  }
24072
24391
  }
24073
24392
 
24074
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
24393
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
24075
24394
 
24076
24395
  /*
24077
24396
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -24214,6 +24533,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24214
24533
  scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
24215
24534
  account: cachedAccount,
24216
24535
  forceRefresh: false,
24536
+ resource: request.extraParameters?.resource,
24217
24537
  };
24218
24538
  // Preserve FMI partition semantics for silent cache filtering.
24219
24539
  if (request.attributeTokens) {
@@ -24551,6 +24871,9 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24551
24871
  }
24552
24872
  : undefined;
24553
24873
  const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
24874
+ if (request.extraParameters?.resource) {
24875
+ cachedAccessToken.resource = request.extraParameters.resource;
24876
+ }
24554
24877
  // save idtoken credential in configured browser storage
24555
24878
  if (!!cachedIdToken && storeInCache?.idToken !== false) {
24556
24879
  await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
@@ -24635,7 +24958,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24635
24958
  * scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
24636
24959
  * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
24637
24960
  */
24638
- const { scopes, claims } = request;
24961
+ const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
24639
24962
  const scopeSet = new ScopeSet(scopes || [], this.correlationId);
24640
24963
  scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
24641
24964
  const mergedClaims = buildMergedClaims(claims, configClaims?.length ? configClaims : undefined);
@@ -24668,6 +24991,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24668
24991
  resourceRequestUri: request.resourceRequestUri,
24669
24992
  shrClaims: request.shrClaims,
24670
24993
  shrNonce: request.shrNonce,
24994
+ extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
24671
24995
  };
24672
24996
  if (hasAttributeTokens) {
24673
24997
  validatedRequest.attributeTokens =
@@ -24791,7 +25115,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
24791
25115
  }
24792
25116
  }
24793
25117
 
24794
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25118
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
24795
25119
 
24796
25120
  /*
24797
25121
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25104,7 +25428,7 @@ async function handleResponseEAR(request, response, apiId, config, authority, br
25104
25428
  return (await invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), HandleServerTokenResponse, logger, performanceClient, request.correlationId)(decryptedData, authority, nowSeconds(), request, apiId, additionalData, undefined, undefined, undefined, undefined));
25105
25429
  }
25106
25430
 
25107
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25431
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25108
25432
 
25109
25433
  /*
25110
25434
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25159,7 +25483,7 @@ async function generateCodeChallengeFromVerifier(pkceCodeVerifier, performanceCl
25159
25483
  }
25160
25484
  }
25161
25485
 
25162
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25486
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25163
25487
 
25164
25488
  /*
25165
25489
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25202,7 +25526,7 @@ class NavigationClient {
25202
25526
  }
25203
25527
  }
25204
25528
 
25205
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25529
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25206
25530
 
25207
25531
  /*
25208
25532
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25349,7 +25673,7 @@ function getHeaderDict(headers) {
25349
25673
  }
25350
25674
  }
25351
25675
 
25352
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25676
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25353
25677
 
25354
25678
  /*
25355
25679
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25480,7 +25804,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
25480
25804
  return overlayedConfig;
25481
25805
  }
25482
25806
 
25483
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
25807
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25484
25808
 
25485
25809
  /*
25486
25810
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25507,9 +25831,12 @@ class PlatformAuthExtensionHandler {
25507
25831
  async sendMessage(request) {
25508
25832
  this.logger.trace(`0on4p2 ${this.platformAuthType}`, request.correlationId);
25509
25833
  // fall back to native calls
25834
+ const extensionRequest = { ...request };
25835
+ delete extensionRequest.resourceRequestMethod;
25836
+ delete extensionRequest.resourceRequestUri;
25510
25837
  const messageBody = {
25511
25838
  method: NativeExtensionMethod.GetToken,
25512
- request: request,
25839
+ request: extensionRequest,
25513
25840
  };
25514
25841
  const req = {
25515
25842
  channel: PlatformAuthConstants.CHANNEL_ID,
@@ -25741,7 +26068,7 @@ class PlatformAuthExtensionHandler {
25741
26068
  }
25742
26069
  }
25743
26070
 
25744
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
26071
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25745
26072
 
25746
26073
  /*
25747
26074
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25802,7 +26129,9 @@ class PlatformAuthDOMHandler {
25802
26129
  }
25803
26130
  initializePlatformDOMRequest(request) {
25804
26131
  this.logger.trace(`15d6yv ${this.platformAuthType}`, request.correlationId);
25805
- const { accountId, clientId, authority, scope, redirectUri, correlationId, state, extraParameters, ...remainingProperties } = request;
26132
+ const { accountId, clientId, authority, scope, redirectUri, correlationId, state, preferBinding, enclave, reqCnf, extraParametersNoCache, extraParameters, ...remainingProperties } = request;
26133
+ delete remainingProperties.resourceRequestMethod;
26134
+ delete remainingProperties.resourceRequestUri;
25806
26135
  const validExtraParameters = this.getDOMExtraParams(remainingProperties, correlationId);
25807
26136
  const platformDOMRequest = {
25808
26137
  accountId: accountId,
@@ -25818,6 +26147,10 @@ class PlatformAuthDOMHandler {
25818
26147
  redirectUri: redirectUri,
25819
26148
  scope: scope,
25820
26149
  state: state,
26150
+ preferBinding: preferBinding,
26151
+ enclave: enclave,
26152
+ requestConfirmation: reqCnf,
26153
+ extraParametersNoCache,
25821
26154
  };
25822
26155
  return platformDOMRequest;
25823
26156
  }
@@ -25851,6 +26184,8 @@ class PlatformAuthDOMHandler {
25851
26184
  }
25852
26185
  convertToPlatformBrokerResponse(response, correlationId) {
25853
26186
  this.logger.trace(`14913t ${this.platformAuthType}`, correlationId);
26187
+ const responseProperties = response.properties || {};
26188
+ const bindingAttested = this.parseDOMBoolean(responseProperties.binding_attested, "binding_attested", correlationId);
25854
26189
  const nativeResponse = {
25855
26190
  access_token: response.accessToken,
25856
26191
  id_token: response.idToken,
@@ -25859,12 +26194,24 @@ class PlatformAuthDOMHandler {
25859
26194
  expires_in: response.expiresIn,
25860
26195
  scope: response.scopes,
25861
26196
  state: response.state || "",
25862
- properties: response.properties || {},
26197
+ properties: responseProperties,
25863
26198
  extendedLifetimeToken: response.extendedLifetimeToken ?? false,
25864
26199
  shr: response.proofOfPossessionPayload,
26200
+ token_type: responseProperties.token_type,
26201
+ DPoP: responseProperties.dpop_proof,
26202
+ binding_attested: bindingAttested,
25865
26203
  };
25866
26204
  return nativeResponse;
25867
26205
  }
26206
+ parseDOMBoolean(value, propertyName, correlationId) {
26207
+ if (value === undefined) {
26208
+ return undefined;
26209
+ }
26210
+ if (value === "true" || value === "false") {
26211
+ return value === "true";
26212
+ }
26213
+ throw createAuthError(unexpectedError, correlationId, `Platform broker returned invalid ${propertyName} value.`);
26214
+ }
25868
26215
  getDOMExtraParams(extraParameters, correlationId) {
25869
26216
  try {
25870
26217
  const stringifiedProperties = {};
@@ -25889,7 +26236,7 @@ class PlatformAuthDOMHandler {
25889
26236
  }
25890
26237
  }
25891
26238
 
25892
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
26239
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25893
26240
  async function getPlatformAuthProvider(logger, performanceClient, correlationId, nativeBrokerHandshakeTimeout, enablePlatformBrokerDOMSupport) {
25894
26241
  logger.trace("134j0v", correlationId);
25895
26242
  logger.trace(`04c81g ${enablePlatformBrokerDOMSupport}`, correlationId);
@@ -25954,7 +26301,7 @@ function isPlatformAuthAllowed(config, logger, correlationId, platformAuthProvid
25954
26301
  return true;
25955
26302
  }
25956
26303
 
25957
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
26304
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
25958
26305
 
25959
26306
  /*
25960
26307
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -26463,7 +26810,7 @@ class PopupClient extends StandardInteractionClient {
26463
26810
  }
26464
26811
  }
26465
26812
 
26466
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
26813
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
26467
26814
 
26468
26815
  /*
26469
26816
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -26493,12 +26840,17 @@ class RedirectClient extends StandardInteractionClient {
26493
26840
  async acquireToken(request) {
26494
26841
  const validRequest = await invokeAsync(initializeAuthorizationRequest, StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, this.correlationId)(request, InteractionType.Redirect, this.config, this.browserCrypto, this.browserStorage, this.logger, this.performanceClient, this.correlationId);
26495
26842
  validRequest.platformBroker = isPlatformAuthAllowed(this.config, this.logger, this.correlationId, this.platformAuthProvider, request.authenticationScheme);
26843
+ let rejectBackButtonCancellation;
26844
+ const backButtonCancellation = new Promise((_, reject) => {
26845
+ rejectBackButtonCancellation = reject;
26846
+ });
26496
26847
  const handleBackButton = (event) => {
26497
26848
  // Clear temporary cache if the back button is clicked during the redirect flow.
26498
26849
  if (event.persisted) {
26499
26850
  this.logger.verbose("0udvtt", this.correlationId);
26500
26851
  this.browserStorage.resetRequestCache(this.correlationId);
26501
26852
  this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, this.correlationId, InteractionType.Redirect);
26853
+ rejectBackButtonCancellation(createBrowserAuthError(userCancelled, this.correlationId));
26502
26854
  }
26503
26855
  };
26504
26856
  const redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
@@ -26508,12 +26860,10 @@ class RedirectClient extends StandardInteractionClient {
26508
26860
  // Clear temporary cache if the back button is clicked during the redirect flow.
26509
26861
  window.addEventListener("pageshow", handleBackButton);
26510
26862
  try {
26511
- if (this.config.system.protocolMode === ProtocolMode.EAR) {
26512
- await this.executeEarFlow(validRequest);
26513
- }
26514
- else {
26515
- await this.executeCodeFlow(validRequest);
26516
- }
26863
+ const redirectOperation = this.config.system.protocolMode === ProtocolMode.EAR
26864
+ ? this.executeEarFlow(validRequest)
26865
+ : this.executeCodeFlow(validRequest);
26866
+ await Promise.race([redirectOperation, backButtonCancellation]);
26517
26867
  }
26518
26868
  catch (e) {
26519
26869
  if (e instanceof AuthError) {
@@ -26910,7 +27260,7 @@ class RedirectClient extends StandardInteractionClient {
26910
27260
  }
26911
27261
  }
26912
27262
 
26913
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27263
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
26914
27264
 
26915
27265
  /*
26916
27266
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -26976,7 +27326,7 @@ function removeHiddenIframe(iframe) {
26976
27326
  }
26977
27327
  }
26978
27328
 
26979
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27329
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
26980
27330
 
26981
27331
  /*
26982
27332
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27214,7 +27564,7 @@ class SilentIframeClient extends StandardInteractionClient {
27214
27564
  }
27215
27565
  }
27216
27566
 
27217
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27567
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27218
27568
 
27219
27569
  /*
27220
27570
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27281,7 +27631,7 @@ class SilentRefreshClient extends StandardInteractionClient {
27281
27631
  }
27282
27632
  }
27283
27633
 
27284
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27634
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27285
27635
 
27286
27636
  /*
27287
27637
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27294,7 +27644,7 @@ class HybridSpaAuthorizationCodeClient extends AuthorizationCodeClient {
27294
27644
  }
27295
27645
  }
27296
27646
 
27297
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27647
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27298
27648
 
27299
27649
  /*
27300
27650
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -27367,7 +27717,7 @@ class SilentAuthCodeClient extends StandardInteractionClient {
27367
27717
  }
27368
27718
  }
27369
27719
 
27370
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27720
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27371
27721
  function collectInstanceStats(currentClientId, performanceEvent, logger, correlationId) {
27372
27722
  const frameInstances =
27373
27723
  // @ts-ignore
@@ -27383,7 +27733,7 @@ function collectInstanceStats(currentClientId, performanceEvent, logger, correla
27383
27733
  });
27384
27734
  }
27385
27735
 
27386
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
27736
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
27387
27737
 
27388
27738
  /*
27389
27739
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -28883,7 +29233,7 @@ function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheL
28883
29233
  return isSilentlyResolvable && tryIframeRenewal;
28884
29234
  }
28885
29235
 
28886
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
29236
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
28887
29237
 
28888
29238
  /*
28889
29239
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -28988,7 +29338,7 @@ class BaseOperatingContext {
28988
29338
  }
28989
29339
  }
28990
29340
 
28991
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
29341
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
28992
29342
 
28993
29343
  /*
28994
29344
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -29035,7 +29385,7 @@ StandardOperatingContext.MODULE_NAME = "";
29035
29385
  */
29036
29386
  StandardOperatingContext.ID = "StandardOperatingContext";
29037
29387
 
29038
- /*! @azure/msal-browser v5.20.0 2026-08-28 */
29388
+ /*! @azure/msal-browser v5.23.0 2026-09-23 */
29039
29389
 
29040
29390
  /*
29041
29391
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -29667,7 +30017,7 @@ const createClientLogCallback = (provider, metadata, scope) => {
29667
30017
  };
29668
30018
 
29669
30019
  // Generated by genversion.
29670
- const version = '12.0.0';
30020
+ const version = '12.0.1';
29671
30021
 
29672
30022
  /**
29673
30023
  * Zod schema for telemetry configuration validation.
@@ -31658,4 +32008,4 @@ const configureMsal = (configure) => ({
31658
32008
  });
31659
32009
 
31660
32010
  export { TelemetryEventSchema as $, reduce as A, lastValueFrom as B, filter as C, BaseModuleProvider as D, EMPTY_SUBSCRIPTION as E, catchError as F, of as G, object as H, _instanceof as I, _enum as J, string as K, boolean as L, ModuleEventLevel as M, record as N, Observable as O, union as P, __rest as Q, __assign as R, Subscription as S, switchMap as T, observeOn as U, deepmerge as V, BaseConfigBuilder as W, TelemetryExceptionSchema as X, TelemetryItemNames as Y, TelemetryType as Z, __extends as _, arrRemove as a, TelemetryMetricSchema as a0, TelemetryCustomEventSchema as a1, array as a2, TelemetryLevel as a3, enableMSAL as a4, MsalConfigurator as a5, module$1 as a6, __values as b, createErrorClass as c, __spreadArray as d, errorContext as e, __read as f, SafeSubscriber as g, EmptyError as h, isFunction as i, executeSchedule as j, innerFrom as k, createOperatorSubscriber as l, map as m, mergeMap as n, operate as o, identity as p, isArrayLike as q, isScheduler as r, popScheduler as s, popNumber as t, EMPTY as u, from as v, mergeInternals as w, scanInternals as x, noop as y, popResultSelector as z };
31661
- //# sourceMappingURL=module-DMrP0Kg2.js.map
32011
+ //# sourceMappingURL=module-Xg35JJRU.js.map