repo-dive 0.11.1 → 0.13.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.
package/dist/cli.js CHANGED
@@ -15,7 +15,7 @@ import * as NodeUrl from "node:url";
15
15
  import { fileURLToPath, pathToFileURL } from "node:url";
16
16
  import { access, mkdir, mkdtemp, readFile, readdir, rm, writeFile } from "node:fs/promises";
17
17
  import * as readline from "node:readline";
18
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Pipeable.js
18
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Pipeable.js
19
19
  /**
20
20
  * The `Pipeable` module defines the shared interface and implementation helpers
21
21
  * for values that support Effect-style method chaining with `.pipe(...)`.
@@ -117,7 +117,7 @@ var Class$3 = /*#__PURE__*/ function() {
117
117
  return PipeableBase;
118
118
  }();
119
119
  //#endregion
120
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Function.js
120
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Function.js
121
121
  /**
122
122
  * Creates a function that can be called in data-first style or data-last
123
123
  * (`pipe`-friendly) style.
@@ -395,8 +395,44 @@ function memoize(f) {
395
395
  return result;
396
396
  };
397
397
  }
398
+ /**
399
+ * Creates a memoized idempotent object transformation that caches both inputs
400
+ * and their outputs by object identity.
401
+ *
402
+ * **When to use**
403
+ *
404
+ * Use when an object transformation is idempotent and its output can be safely
405
+ * reused as a fixed point.
406
+ *
407
+ * **Details**
408
+ *
409
+ * After computing an input, the returned function caches both the input and
410
+ * the output. Calling it with either reference returns the output without
411
+ * invoking the supplied function again.
412
+ *
413
+ * **Gotchas**
414
+ *
415
+ * The returned function treats each computed output as a fixed point. If
416
+ * applying the supplied function to an output would produce an observably
417
+ * different value, this memoization changes that behavior.
418
+ *
419
+ * @see {@link memoize} for memoizing functions without an idempotence requirement
420
+ * @category caching
421
+ * @since 4.0.0
422
+ */
423
+ function memoizeIdempotent(f) {
424
+ const cache = /* @__PURE__ */ new WeakMap();
425
+ return (a) => {
426
+ const cached = cache.get(a);
427
+ if (cached !== void 0) return cached;
428
+ const result = f(a);
429
+ cache.set(a, result);
430
+ cache.set(result, result);
431
+ return result;
432
+ };
433
+ }
398
434
  //#endregion
399
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/equal.js
435
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/equal.js
400
436
  /** @internal */
401
437
  var getAllObjectKeys = (obj) => {
402
438
  const keys = new Set(Reflect.ownKeys(obj));
@@ -415,7 +451,7 @@ var getAllObjectKeys = (obj) => {
415
451
  /** @internal */
416
452
  var byReferenceInstances = /*#__PURE__*/ new WeakSet();
417
453
  //#endregion
418
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Predicate.js
454
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Predicate.js
419
455
  /**
420
456
  * Defines runtime checks for values.
421
457
  *
@@ -1019,7 +1055,7 @@ function isIterable(input) {
1019
1055
  return hasProperty(input, Symbol.iterator) || isString(input);
1020
1056
  }
1021
1057
  //#endregion
1022
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Hash.js
1058
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Hash.js
1023
1059
  /**
1024
1060
  * Computes Effect hash values and defines the interface for objects that want
1025
1061
  * to provide their own hash implementation. Hashes are small numeric
@@ -1432,7 +1468,7 @@ function withVisitedTracking$1(obj, fn) {
1432
1468
  return result;
1433
1469
  }
1434
1470
  //#endregion
1435
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Equal.js
1471
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Equal.js
1436
1472
  /**
1437
1473
  * Defines the unique string identifier for the `Equal` interface.
1438
1474
  *
@@ -1658,7 +1694,7 @@ var compareSets = /*#__PURE__*/ makeCompareSet(compareBoth);
1658
1694
  */
1659
1695
  var isEqual = (u) => hasProperty(u, symbol$2);
1660
1696
  //#endregion
1661
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Redactable.js
1697
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Redactable.js
1662
1698
  /**
1663
1699
  * Defines the symbol used to identify objects that implement the {@link Redactable}
1664
1700
  * protocol.
@@ -1777,7 +1813,7 @@ var emptyContext$1 = {
1777
1813
  }
1778
1814
  };
1779
1815
  //#endregion
1780
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Formatter.js
1816
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Formatter.js
1781
1817
  /**
1782
1818
  * Formats JavaScript values into readable strings.
1783
1819
  *
@@ -2011,7 +2047,7 @@ function formatJson(input, options) {
2011
2047
  }, options?.space) ?? "null";
2012
2048
  }
2013
2049
  //#endregion
2014
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Inspectable.js
2050
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Inspectable.js
2015
2051
  /**
2016
2052
  * Controls how values appear in logs and debugging output.
2017
2053
  *
@@ -2158,7 +2194,7 @@ var BaseProto = {
2158
2194
  }
2159
2195
  };
2160
2196
  //#endregion
2161
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Utils.js
2197
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Utils.js
2162
2198
  /**
2163
2199
  * Yields its wrapped value exactly once through an `IterableIterator`.
2164
2200
  *
@@ -2245,7 +2281,7 @@ var pickInternalCall = () => {
2245
2281
  /** @internal */
2246
2282
  var internalCall = /*#__PURE__*/ pickInternalCall();
2247
2283
  //#endregion
2248
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/record.js
2284
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/record.js
2249
2285
  /** @internal */
2250
2286
  function assignProperty(self, key, value) {
2251
2287
  if (key === "__proto__") Object.defineProperty(self, key, {
@@ -2261,7 +2297,7 @@ function assignProperties(self, source) {
2261
2297
  for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProperty(self, key, source[key]);
2262
2298
  }
2263
2299
  //#endregion
2264
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/core.js
2300
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/core.js
2265
2301
  /** @internal */
2266
2302
  var EffectTypeId = `~effect/Effect`;
2267
2303
  /** @internal */
@@ -2634,7 +2670,7 @@ var done$2 = (value) => {
2634
2670
  return exitFail(Done$1(value));
2635
2671
  };
2636
2672
  //#endregion
2637
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Equivalence.js
2673
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Equivalence.js
2638
2674
  /**
2639
2675
  * Creates a custom equivalence relation with an optimized reference equality check.
2640
2676
  *
@@ -2744,14 +2780,14 @@ function Array_(item) {
2744
2780
  });
2745
2781
  }
2746
2782
  //#endregion
2747
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/array.js
2783
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/array.js
2748
2784
  /**
2749
2785
  * @since 2.0.0
2750
2786
  */
2751
2787
  /** @internal */
2752
2788
  var isArrayNonEmpty$1 = (self) => self.length > 0;
2753
2789
  //#endregion
2754
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/option.js
2790
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/option.js
2755
2791
  /**
2756
2792
  * @since 2.0.0
2757
2793
  */
@@ -2821,7 +2857,7 @@ var some$1 = (value) => {
2821
2857
  return a;
2822
2858
  };
2823
2859
  //#endregion
2824
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/result.js
2860
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/result.js
2825
2861
  var TypeId$51 = "~effect/data/Result";
2826
2862
  var CommonProto = {
2827
2863
  [TypeId$51]: {
@@ -2893,7 +2929,7 @@ var succeed$9 = (success) => {
2893
2929
  return a;
2894
2930
  };
2895
2931
  //#endregion
2896
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Order.js
2932
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Order.js
2897
2933
  /**
2898
2934
  * Defines comparison functions for ordered values.
2899
2935
  *
@@ -3136,7 +3172,7 @@ var isLessThanOrEqualTo$1 = (O) => dual(2, (self, that) => O(self, that) !== 1);
3136
3172
  */
3137
3173
  var isGreaterThanOrEqualTo$2 = (O) => dual(2, (self, that) => O(self, that) !== -1);
3138
3174
  //#endregion
3139
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Option.js
3175
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Option.js
3140
3176
  /**
3141
3177
  * Creates an `Option` representing the absence of a value.
3142
3178
  *
@@ -3608,7 +3644,7 @@ var filter = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() :
3608
3644
  */
3609
3645
  var exists$1 = /*#__PURE__*/ dual(2, (self, refinement) => isNone(self) ? false : refinement(self.value));
3610
3646
  //#endregion
3611
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Result.js
3647
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Result.js
3612
3648
  /**
3613
3649
  * Creates a `Result` holding a `Success` value.
3614
3650
  *
@@ -3726,7 +3762,7 @@ var isFailure$1 = isFailure$2;
3726
3762
  */
3727
3763
  var match$4 = /*#__PURE__*/ dual(2, (self, { onFailure, onSuccess }) => isFailure$1(self) ? onFailure(self.failure) : onSuccess(self.success));
3728
3764
  //#endregion
3729
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Iterable.js
3765
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Iterable.js
3730
3766
  /**
3731
3767
  * Returns the first element that satisfies the specified
3732
3768
  * predicate, or `None` if no such element exists.
@@ -3779,7 +3815,7 @@ var findFirst$1 = /*#__PURE__*/ dual(2, (self, f) => {
3779
3815
  return none();
3780
3816
  });
3781
3817
  //#endregion
3782
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Record.js
3818
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Record.js
3783
3819
  /**
3784
3820
  * Checks whether a given `key` exists in a record.
3785
3821
  *
@@ -3890,7 +3926,7 @@ var makeEquivalence$2 = (equivalence) => {
3890
3926
  return (self, that) => is(self, that) && is(that, self);
3891
3927
  };
3892
3928
  //#endregion
3893
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Array.js
3929
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Array.js
3894
3930
  /**
3895
3931
  * Works with JavaScript arrays, readonly arrays, and non-empty arrays.
3896
3932
  *
@@ -4422,7 +4458,7 @@ var dedupe = (self) => {
4422
4458
  return out;
4423
4459
  };
4424
4460
  //#endregion
4425
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Effectable.js
4461
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Effectable.js
4426
4462
  /**
4427
4463
  * Create a low-level `Effect` prototype.
4428
4464
  *
@@ -4446,39 +4482,7 @@ var Prototype = (options) => makePrimitiveProto({
4446
4482
  [evaluate]: options.evaluate
4447
4483
  });
4448
4484
  //#endregion
4449
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/stackTraceLimit.js
4450
- /**
4451
- * Check if `Error.stackTraceLimit` is writable.
4452
- * Returns `false` if the property is frozen, non-writable, or `Error` is non-extensible.
4453
- *
4454
- * @internal
4455
- */
4456
- var isStackTraceLimitWritable = () => {
4457
- const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
4458
- if (desc === void 0) return Object.isExtensible(Error);
4459
- return Object.hasOwn(desc, "writable") ? desc.writable === true : desc.set !== void 0;
4460
- };
4461
- var canWriteStackTraceLimit = /*#__PURE__*/ isStackTraceLimitWritable();
4462
- /**
4463
- * Get the current `Error.stackTraceLimit` value.
4464
- * Returns `undefined` if the property doesn't exist.
4465
- *
4466
- * @internal
4467
- */
4468
- var getStackTraceLimit = () => Error.stackTraceLimit;
4469
- /**
4470
- * Safely set `Error.stackTraceLimit` if possible, otherwise no-op.
4471
- *
4472
- * Accepts `undefined` so a value read via {@link getStackTraceLimit} can be
4473
- * restored faithfully.
4474
- *
4475
- * @internal
4476
- */
4477
- var setStackTraceLimit = (value) => {
4478
- if (canWriteStackTraceLimit) Error.stackTraceLimit = value;
4479
- };
4480
- //#endregion
4481
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Context.js
4485
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Context.js
4482
4486
  /**
4483
4487
  * Runtime type identifier attached to `Context` service keys and used by
4484
4488
  * `isKey` to recognize them.
@@ -4538,16 +4542,9 @@ var ServiceTypeId = "~effect/Context/Service";
4538
4542
  * @since 4.0.0
4539
4543
  */
4540
4544
  var Service$1 = function() {
4541
- const prevLimit = getStackTraceLimit();
4542
- setStackTraceLimit(2);
4543
- const err = /* @__PURE__ */ new Error();
4544
- setStackTraceLimit(prevLimit);
4545
4545
  function KeyClass() {}
4546
4546
  const self = KeyClass;
4547
4547
  Object.setPrototypeOf(self, ServiceProto);
4548
- Object.defineProperty(self, "stack", { get() {
4549
- return err.stack;
4550
- } });
4551
4548
  const init = (key, options) => {
4552
4549
  self.key = key;
4553
4550
  if (options?.defaultValue) {
@@ -4571,8 +4568,7 @@ var ServiceProto = {
4571
4568
  toJSON() {
4572
4569
  return {
4573
4570
  _id: "Service",
4574
- key: this.key,
4575
- stack: this.stack
4571
+ key: this.key
4576
4572
  };
4577
4573
  },
4578
4574
  of(self) {
@@ -4936,13 +4932,6 @@ var getDefaultValue = (ref) => {
4936
4932
  };
4937
4933
  var serviceNotFoundError = (service) => {
4938
4934
  const error = /* @__PURE__ */ new Error(`Service not found${service.key ? `: ${String(service.key)}` : ""}`);
4939
- if (service.stack) {
4940
- const lines = service.stack.split("\n");
4941
- if (lines.length > 2) {
4942
- const afterAt = lines[2].match(/at (.*)/);
4943
- if (afterAt) error.message = error.message + ` (defined at ${afterAt[1]})`;
4944
- }
4945
- }
4946
4935
  if (error.stack) {
4947
4936
  const lines = error.stack.split("\n");
4948
4937
  lines.splice(1, 3);
@@ -5121,7 +5110,7 @@ var mergeAll$1 = (...ctxs) => {
5121
5110
  */
5122
5111
  var Reference = Service$1;
5123
5112
  //#endregion
5124
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Duration.js
5113
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Duration.js
5125
5114
  var TypeId$49 = "~effect/time/Duration";
5126
5115
  var bigint0$2 = /*#__PURE__*/ BigInt(0);
5127
5116
  var bigint1 = /*#__PURE__*/ BigInt(1);
@@ -5795,7 +5784,7 @@ var format$2 = (self) => {
5795
5784
  return pieces.join(" ");
5796
5785
  };
5797
5786
  //#endregion
5798
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Filter.js
5787
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Filter.js
5799
5788
  /**
5800
5789
  * Composes two filters sequentially, passing the successful output of the first
5801
5790
  * filter to the second.
@@ -5816,7 +5805,7 @@ var composePassthrough = /*#__PURE__*/ dual(2, (left, right) => (input) => {
5816
5805
  return rightOut;
5817
5806
  });
5818
5807
  //#endregion
5819
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Scheduler.js
5808
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Scheduler.js
5820
5809
  /**
5821
5810
  * Controls how runnable Effect fiber tasks are dispatched.
5822
5811
  *
@@ -6032,7 +6021,7 @@ var PreventSchedulerYield = /*#__PURE__*/ Reference("effect/Scheduler/PreventSch
6032
6021
  defaultValue: () => false
6033
6022
  });
6034
6023
  //#endregion
6035
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Tracer.js
6024
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Tracer.js
6036
6025
  /**
6037
6026
  * Defines the low-level tracing model used by Effect.
6038
6027
  *
@@ -6345,11 +6334,11 @@ var randomHexString = /*#__PURE__*/ function() {
6345
6334
  };
6346
6335
  }();
6347
6336
  //#endregion
6348
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/metric.js
6337
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/metric.js
6349
6338
  /** @internal */
6350
6339
  var FiberRuntimeMetricsKey = "effect/observability/Metric/FiberRuntimeMetricsKey";
6351
6340
  //#endregion
6352
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/references.js
6341
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/references.js
6353
6342
  /** @internal */
6354
6343
  var CurrentErrorReporters = /*#__PURE__*/ Reference("effect/ErrorReporter/CurrentErrorReporters", { defaultValue: () => /* @__PURE__ */ new Set() });
6355
6344
  /** @internal */
@@ -6380,7 +6369,39 @@ var MinimumLogLevel$1 = /*#__PURE__*/ Reference("effect/References/MinimumLogLev
6380
6369
  /** @internal */
6381
6370
  var CurrentLogSpans = /*#__PURE__*/ Reference("effect/References/CurrentLogSpans", { defaultValue: () => [] });
6382
6371
  //#endregion
6383
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/tracer.js
6372
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/stackTraceLimit.js
6373
+ /**
6374
+ * Check if `Error.stackTraceLimit` is writable.
6375
+ * Returns `false` if the property is frozen, non-writable, or `Error` is non-extensible.
6376
+ *
6377
+ * @internal
6378
+ */
6379
+ var isStackTraceLimitWritable = () => {
6380
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
6381
+ if (desc === void 0) return Object.isExtensible(Error);
6382
+ return Object.hasOwn(desc, "writable") ? desc.writable === true : desc.set !== void 0;
6383
+ };
6384
+ var canWriteStackTraceLimit = /*#__PURE__*/ isStackTraceLimitWritable();
6385
+ /**
6386
+ * Get the current `Error.stackTraceLimit` value.
6387
+ * Returns `undefined` if the property doesn't exist.
6388
+ *
6389
+ * @internal
6390
+ */
6391
+ var getStackTraceLimit = () => Error.stackTraceLimit;
6392
+ /**
6393
+ * Safely set `Error.stackTraceLimit` if possible, otherwise no-op.
6394
+ *
6395
+ * Accepts `undefined` so a value read via {@link getStackTraceLimit} can be
6396
+ * restored faithfully.
6397
+ *
6398
+ * @internal
6399
+ */
6400
+ var setStackTraceLimit = (value) => {
6401
+ if (canWriteStackTraceLimit) Error.stackTraceLimit = value;
6402
+ };
6403
+ //#endregion
6404
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/tracer.js
6384
6405
  /** @internal */
6385
6406
  var addSpanStackTrace = (options) => {
6386
6407
  if (options?.captureStackTrace === false) return options;
@@ -6410,7 +6431,7 @@ var makeStackCleaner = (line) => (stack) => {
6410
6431
  };
6411
6432
  var spanCleaner = /*#__PURE__*/ makeStackCleaner(3);
6412
6433
  //#endregion
6413
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/effect.js
6434
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/effect.js
6414
6435
  /** @internal */
6415
6436
  var Interrupt = class extends ReasonBase {
6416
6437
  fiberId;
@@ -8037,10 +8058,8 @@ var useSpan$1 = (name, ...args) => {
8037
8058
  return withFiber$1((fiber) => {
8038
8059
  const span = makeSpanUnsafe(fiber, name, options);
8039
8060
  const clock = fiber.getRef(ClockRef);
8040
- return onExit$1(internalCall(() => evaluate(span)), (exit) => sync$1(() => {
8041
- if (span.status._tag === "Ended") return;
8042
- span.end(clock.currentTimeNanosUnsafe(), exit);
8043
- }));
8061
+ const timingEnabled = fiber.getRef(TracerTimingEnabled);
8062
+ return onExit$1(internalCall(() => evaluate(span)), (exit) => endSpan(span, exit, clock, timingEnabled));
8044
8063
  });
8045
8064
  };
8046
8065
  var provideParentSpan = /*#__PURE__*/ provideService$1(ParentSpan);
@@ -8330,7 +8349,7 @@ var reportCauseUnsafe = (fiber, cause, defectsOnly) => {
8330
8349
  reporters.forEach((reporter) => reporter.report(opts));
8331
8350
  };
8332
8351
  //#endregion
8333
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Deferred.js
8352
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Deferred.js
8334
8353
  var TypeId$48 = "~effect/Deferred";
8335
8354
  /**
8336
8355
  * Checks whether a value is a `Deferred`.
@@ -8504,7 +8523,7 @@ var doneUnsafe = (self, effect) => {
8504
8523
  return true;
8505
8524
  };
8506
8525
  //#endregion
8507
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Exit.js
8526
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Exit.js
8508
8527
  /**
8509
8528
  * Checks whether an unknown value is an Exit.
8510
8529
  *
@@ -8732,7 +8751,7 @@ var isSuccess = exitIsSuccess;
8732
8751
  */
8733
8752
  var isFailure = exitIsFailure;
8734
8753
  //#endregion
8735
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/References.js
8754
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/References.js
8736
8755
  /**
8737
8756
  * Context reference for managing log annotations that are automatically added to all log entries.
8738
8757
  * These annotations provide contextual metadata that appears in every log message.
@@ -8866,7 +8885,7 @@ var CurrentLogLevel = CurrentLogLevel$1;
8866
8885
  */
8867
8886
  var MinimumLogLevel = MinimumLogLevel$1;
8868
8887
  //#endregion
8869
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Scope.js
8888
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Scope.js
8870
8889
  /**
8871
8890
  * Controls how long resources stay open.
8872
8891
  *
@@ -9160,7 +9179,7 @@ var close = scopeClose;
9160
9179
  */
9161
9180
  var closeUnsafe = scopeCloseUnsafe;
9162
9181
  //#endregion
9163
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Layer.js
9182
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Layer.js
9164
9183
  var TypeId$47 = "~effect/Layer";
9165
9184
  var MemoMapTypeId = "~effect/Layer/MemoMap";
9166
9185
  var memoMapReuse = (entry, scope) => {
@@ -9978,7 +9997,7 @@ var provideMerge = /*#__PURE__*/ dual(2, (self, that) => provideWith(self, that,
9978
9997
  */
9979
9998
  var launch = (self) => scoped$1(andThen$1(build(self), never$2));
9980
9999
  //#endregion
9981
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Cause.js
10000
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Cause.js
9982
10001
  /**
9983
10002
  * Records the full reason an `Effect` failed.
9984
10003
  *
@@ -10531,7 +10550,7 @@ var UnknownError$1 = UnknownError$2;
10531
10550
  var StackTrace = class extends Service$1()("effect/Cause/StackTrace") {};
10532
10551
  Service$1()("effect/Cause/InterruptorStackTrace");
10533
10552
  //#endregion
10534
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Data.js
10553
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Data.js
10535
10554
  /**
10536
10555
  * Provides a base class for immutable data types.
10537
10556
  *
@@ -10741,7 +10760,7 @@ var Error$2 = Error$3;
10741
10760
  */
10742
10761
  var TaggedError$1 = TaggedError$2;
10743
10762
  //#endregion
10744
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Clock.js
10763
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Clock.js
10745
10764
  /**
10746
10765
  * Context reference for the active time service in the environment.
10747
10766
  *
@@ -10821,7 +10840,7 @@ var Clock = ClockRef;
10821
10840
  */
10822
10841
  var currentTimeMillis = currentTimeMillis$1;
10823
10842
  //#endregion
10824
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/dateTime.js
10843
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/dateTime.js
10825
10844
  /** @internal */
10826
10845
  var TypeId$46 = "~effect/time/DateTime";
10827
10846
  /** @internal */
@@ -10974,7 +10993,7 @@ var round = /*#__PURE__*/ dual(2, (self, precision) => {
10974
10993
  return Math.round(self * factor) / factor;
10975
10994
  });
10976
10995
  //#endregion
10977
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Pull.js
10996
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Pull.js
10978
10997
  /**
10979
10998
  * Models one low-level pull step for stream-like consumers.
10980
10999
  *
@@ -11129,7 +11148,7 @@ var matchEffect$1 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$1(
11129
11148
  }
11130
11149
  }));
11131
11150
  //#endregion
11132
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Schedule.js
11151
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Schedule.js
11133
11152
  var TypeId$45 = "~effect/Schedule";
11134
11153
  /**
11135
11154
  * Context reference containing metadata for the currently running schedule step.
@@ -11434,12 +11453,12 @@ var while_ = /*#__PURE__*/ dual(2, (self, predicate) => fromStep(map$9(toStep(se
11434
11453
  */
11435
11454
  var forever$1 = /*#__PURE__*/ spaced(zero$1);
11436
11455
  //#endregion
11437
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/layer.js
11456
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/layer.js
11438
11457
  var provideLayer = (self, layer, options) => scopedWith$1((scope) => flatMap$2(options?.local ? buildWithMemoMap(layer, makeMemoMapUnsafe(), scope) : buildWithScope(layer, scope), (context) => provideContext$3(self, context)));
11439
11458
  /** @internal */
11440
11459
  var provide$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, source, options) => isContext(source) ? provideContext$3(self, source) : provideLayer(self, Array.isArray(source) ? mergeAll(...source) : source, options));
11441
11460
  //#endregion
11442
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/schedule.js
11461
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/schedule.js
11443
11462
  /** @internal */
11444
11463
  var retryOrElse = /*#__PURE__*/ dual(3, (self, policy, orElse) => flatMap$2(toStepWithMetadata(policy), (step) => {
11445
11464
  let meta = CurrentMetadata.defaultValue();
@@ -11473,7 +11492,7 @@ var buildFromOptions = (options) => {
11473
11492
  return schedule;
11474
11493
  };
11475
11494
  //#endregion
11476
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Effect.js
11495
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Effect.js
11477
11496
  /**
11478
11497
  * Checks whether a value is an `Effect`.
11479
11498
  *
@@ -15345,7 +15364,7 @@ var flatMapEager = flatMapEager$1;
15345
15364
  */
15346
15365
  var fnUntracedEager = fnUntracedEager$1;
15347
15366
  //#endregion
15348
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/PlatformError.js
15367
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/PlatformError.js
15349
15368
  /**
15350
15369
  * Normalized errors for platform APIs.
15351
15370
  *
@@ -15497,7 +15516,7 @@ var systemError = (options) => new PlatformError(new SystemError(options));
15497
15516
  */
15498
15517
  var badArgument = (options) => new PlatformError(new BadArgument(options));
15499
15518
  //#endregion
15500
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Fiber.js
15519
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Fiber.js
15501
15520
  /**
15502
15521
  * Joins a fiber, blocking until it completes. If the fiber succeeds,
15503
15522
  * returns its value. If it fails, the error is propagated.
@@ -15628,7 +15647,7 @@ var getCurrent = getCurrentFiber;
15628
15647
  */
15629
15648
  var runIn = fiberRunIn;
15630
15649
  //#endregion
15631
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Latch.js
15650
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Latch.js
15632
15651
  /**
15633
15652
  * Creates a `Latch` synchronously, outside of `Effect`.
15634
15653
  *
@@ -15665,7 +15684,7 @@ var runIn = fiberRunIn;
15665
15684
  */
15666
15685
  var makeUnsafe$3 = makeLatchUnsafe;
15667
15686
  //#endregion
15668
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/MutableRef.js
15687
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/MutableRef.js
15669
15688
  var TypeId$43 = "~effect/MutableRef";
15670
15689
  var MutableRefProto = {
15671
15690
  [TypeId$43]: TypeId$43,
@@ -15715,7 +15734,7 @@ var make$43 = (value) => {
15715
15734
  return ref;
15716
15735
  };
15717
15736
  //#endregion
15718
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/MutableList.js
15737
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/MutableList.js
15719
15738
  /**
15720
15739
  * Mutable lists for collecting ordered values and draining them from the front.
15721
15740
  * A `MutableList<A>` can append values to the end, prepend values to the
@@ -15982,7 +16001,7 @@ var take$1 = (self) => {
15982
16001
  return message;
15983
16002
  };
15984
16003
  //#endregion
15985
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Queue.js
16004
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Queue.js
15986
16005
  /**
15987
16006
  * Passes values asynchronously between fibers.
15988
16007
  *
@@ -16897,7 +16916,7 @@ var finalize = (self, exit) => {
16897
16916
  openState.awaiters.clear();
16898
16917
  };
16899
16918
  //#endregion
16900
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Semaphore.js
16919
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Semaphore.js
16901
16920
  /**
16902
16921
  * Creates a `Semaphore` synchronously with the specified total
16903
16922
  * number of permits.
@@ -17058,7 +17077,7 @@ var SemaphoreImpl = class {
17058
17077
  */
17059
17078
  var make$40 = (permits) => sync$1(() => new SemaphoreImpl(permits));
17060
17079
  //#endregion
17061
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Channel.js
17080
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Channel.js
17062
17081
  /**
17063
17082
  * Provides low-level building blocks for streaming data through Effect.
17064
17083
  *
@@ -17967,7 +17986,7 @@ var runFold = /*#__PURE__*/ dual(3, (self, initial, f) => suspend$2(() => {
17967
17986
  */
17968
17987
  var toPullScoped = (self, scope) => toTransform(self)(done(), scope);
17969
17988
  //#endregion
17970
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/stream.js
17989
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/stream.js
17971
17990
  var TypeId$40 = "~effect/Stream";
17972
17991
  var streamVariance = {
17973
17992
  _R: identity,
@@ -17987,7 +18006,7 @@ var fromChannel$2 = (channel) => {
17987
18006
  return self;
17988
18007
  };
17989
18008
  //#endregion
17990
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Sink.js
18009
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Sink.js
17991
18010
  var TypeId$39 = "~effect/Sink";
17992
18011
  var endVoid = /*#__PURE__*/ succeed$4([void 0]);
17993
18012
  var sinkVariance = {
@@ -18209,7 +18228,7 @@ var forEachArray = (f) => fromTransform((upstream) => upstream.pipe(flatMap$1(f)
18209
18228
  */
18210
18229
  var unwrap$1 = (effect) => fromChannel$1(unwrap$2(map$7(effect, toChannel$1)));
18211
18230
  //#endregion
18212
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/MutableHashMap.js
18231
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/MutableHashMap.js
18213
18232
  var TypeId$38 = "~effect/collections/MutableHashMap";
18214
18233
  var MutableHashMapProto = {
18215
18234
  [TypeId$38]: TypeId$38,
@@ -18556,7 +18575,7 @@ var clear = (self) => {
18556
18575
  */
18557
18576
  var size = (self) => self.backing.size;
18558
18577
  //#endregion
18559
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/RcMap.js
18578
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/RcMap.js
18560
18579
  /**
18561
18580
  * Shares scoped resources by key and releases them when no one is using them.
18562
18581
  *
@@ -18757,7 +18776,7 @@ var release = (self, key, entry) => withFiber((fiber) => {
18757
18776
  return void_$1;
18758
18777
  });
18759
18778
  //#endregion
18760
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/rcRef.js
18779
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/rcRef.js
18761
18780
  var TypeId$36 = "~effect/RcRef";
18762
18781
  var stateEmpty = { _tag: "Empty" };
18763
18782
  var stateClosed = { _tag: "Closed" };
@@ -18794,7 +18813,7 @@ var make$38 = (options) => withFiber((fiber) => {
18794
18813
  return close$2;
18795
18814
  }), ref);
18796
18815
  });
18797
- var getState = (self) => uninterruptibleMask((restore) => {
18816
+ var getState = (self) => uninterruptibleMask(function loop(restore) {
18798
18817
  switch (self.state._tag) {
18799
18818
  case "Closed": return interrupt$1;
18800
18819
  case "Acquired":
@@ -18802,18 +18821,21 @@ var getState = (self) => uninterruptibleMask((restore) => {
18802
18821
  return self.state.fiber ? as(interrupt(self.state.fiber), self.state) : succeed$4(self.state);
18803
18822
  case "Empty": {
18804
18823
  const scope = makeUnsafe$5();
18805
- return self.semaphore.withPermits(1)(restore(provideContext$2(self.acquire, add(self.context, Scope, scope))).pipe(map$7((value) => {
18806
- const state = {
18807
- _tag: "Acquired",
18808
- value,
18809
- scope,
18810
- fiber: void 0,
18811
- refCount: 1,
18812
- invalidated: false
18813
- };
18814
- self.state = state;
18815
- return state;
18816
- })));
18824
+ return self.semaphore.withPermit(suspend$2(() => {
18825
+ if (self.state._tag !== "Empty") return loop(restore);
18826
+ return restore(provideContext$2(self.acquire, add(self.context, Scope, scope))).pipe(map$7((value) => {
18827
+ const state = {
18828
+ _tag: "Acquired",
18829
+ value,
18830
+ scope,
18831
+ fiber: void 0,
18832
+ refCount: 1,
18833
+ invalidated: false
18834
+ };
18835
+ self.state = state;
18836
+ return state;
18837
+ }), onExit((exit) => isFailure(exit) ? close(scope, exit) : void_$1));
18838
+ }));
18817
18839
  }
18818
18840
  }
18819
18841
  });
@@ -18845,7 +18867,7 @@ var get$1 = /*#__PURE__*/ fnUntraced(function* (self_) {
18845
18867
  return state.value;
18846
18868
  });
18847
18869
  //#endregion
18848
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/RcRef.js
18870
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/RcRef.js
18849
18871
  /**
18850
18872
  * Creates an `RcRef` from an acquire effect.
18851
18873
  *
@@ -18939,7 +18961,7 @@ var make$37 = make$38;
18939
18961
  */
18940
18962
  var get = get$1;
18941
18963
  //#endregion
18942
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Stream.js
18964
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Stream.js
18943
18965
  /**
18944
18966
  * Describes effectful sources that emit values over time.
18945
18967
  *
@@ -19616,7 +19638,7 @@ var runForEachArray = /*#__PURE__*/ dual(2, (self, f) => runForEach$1(self.chann
19616
19638
  */
19617
19639
  var mkString = (self) => runFold(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
19618
19640
  //#endregion
19619
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/FileSystem.js
19641
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/FileSystem.js
19620
19642
  /**
19621
19643
  * Defines the portable file system service for Effect programs.
19622
19644
  *
@@ -19828,7 +19850,7 @@ var FileTypeId = "~effect/platform/FileSystem/File";
19828
19850
  */
19829
19851
  var WatchBackend = class extends Service$1()("effect/platform/FileSystem/WatchBackend") {};
19830
19852
  //#endregion
19831
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Path.js
19853
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Path.js
19832
19854
  /**
19833
19855
  * Provides path operations through the Effect environment.
19834
19856
  *
@@ -19922,7 +19944,7 @@ var TypeId$33 = "~effect/platform/Path";
19922
19944
  */
19923
19945
  var Path$1 = /*#__PURE__*/ Service$1("effect/Path");
19924
19946
  //#endregion
19925
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/schema/annotations.js
19947
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/schema/annotations.js
19926
19948
  /** @internal */
19927
19949
  function resolve(ast) {
19928
19950
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
@@ -19982,7 +20004,15 @@ var annotationExcludedKeys = /*#__PURE__*/ new Set([
19982
20004
  "toCodecIso"
19983
20005
  ]);
19984
20006
  //#endregion
19985
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/SchemaIssue.js
20007
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/schema/parser.js
20008
+ var missing = /*#__PURE__*/ Symbol();
20009
+ var succeed$1 = succeed$6;
20010
+ var missingExit = /*#__PURE__*/ succeed$1(missing);
20011
+ var sameExit = /*#__PURE__*/ succeed$1(missing);
20012
+ var toOption = (value) => value === missing ? none() : some(value);
20013
+ var fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed$1(option.value);
20014
+ //#endregion
20015
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/SchemaIssue.js
19986
20016
  var TypeId$32 = "~effect/SchemaIssue/Issue";
19987
20017
  /**
19988
20018
  * Returns `true` if the given value is an {@link Issue}.
@@ -20015,10 +20045,42 @@ var TypeId$32 = "~effect/SchemaIssue/Issue";
20015
20045
  function isIssue(u) {
20016
20046
  return hasProperty(u, TypeId$32) && u[TypeId$32] === TypeId$32;
20017
20047
  }
20048
+ /**
20049
+ * Returns `true` when an issue contains an input reported by the schema parser.
20050
+ *
20051
+ * **When to use**
20052
+ *
20053
+ * Use when reading `Issue.input`, especially when `undefined` is a valid input
20054
+ * value.
20055
+ *
20056
+ * **Details**
20057
+ *
20058
+ * Reported input is stored as an own property. This guard checks for that
20059
+ * property and narrows `input` from optional to required.
20060
+ *
20061
+ * **Example** (Reading a reported input)
20062
+ *
20063
+ * ```ts import.meta.vitest
20064
+ * import { Result, Schema, SchemaIssue } from "effect"
20065
+ *
20066
+ * const result = Schema.decodeUnknownResult(Schema.String)(1, { reportInput: true })
20067
+ * if (Result.isFailure(result) && SchemaIssue.hasInput(result.failure.issue)) {
20068
+ * result.failure.issue.input // => 1
20069
+ * }
20070
+ * ```
20071
+ *
20072
+ * @see {@link Issue} for the complete issue model
20073
+ *
20074
+ * @category guards
20075
+ * @since 4.0.0
20076
+ */
20077
+ function hasInput(issue) {
20078
+ return Object.hasOwn(issue, "input");
20079
+ }
20018
20080
  var Base$1 = class {
20019
20081
  [TypeId$32] = TypeId$32;
20020
- toString() {
20021
- return defaultFormatter$1(this);
20082
+ constructor(input, options) {
20083
+ if (options?.reportInput === true && input !== missing) this.input = input;
20022
20084
  }
20023
20085
  };
20024
20086
  /**
@@ -20039,11 +20101,13 @@ var Base$1 = class {
20039
20101
  * ```ts import.meta.vitest
20040
20102
  * import { SchemaAST, SchemaIssue } from "effect"
20041
20103
  *
20104
+ * const formatIssue = SchemaIssue.makeFormatterDefault()
20105
+ *
20042
20106
  * function describe(issue: SchemaIssue.Issue): string {
20043
20107
  * if (issue._tag === "Filter") {
20044
- * return `Filter failed: ${String(issue.issue)}`
20108
+ * return `Filter failed: ${formatIssue(issue.issue)}`
20045
20109
  * }
20046
- * return String(issue)
20110
+ * return formatIssue(issue)
20047
20111
  * }
20048
20112
  *
20049
20113
  * const issue = new SchemaIssue.Filter(
@@ -20069,8 +20133,8 @@ var Filter$1 = class extends Base$1 {
20069
20133
  * The issue that occurred.
20070
20134
  */
20071
20135
  issue;
20072
- constructor(filter, issue) {
20073
- super();
20136
+ constructor(filter, issue, input, options) {
20137
+ super(input, options);
20074
20138
  this.filter = filter;
20075
20139
  this.issue = issue;
20076
20140
  }
@@ -20104,8 +20168,8 @@ var Encoding = class extends Base$1 {
20104
20168
  * The issue that occurred.
20105
20169
  */
20106
20170
  issue;
20107
- constructor(ast, issue) {
20108
- super();
20171
+ constructor(ast, issue, input, options) {
20172
+ super(input, options);
20109
20173
  this.ast = ast;
20110
20174
  this.issue = issue;
20111
20175
  }
@@ -20187,7 +20251,8 @@ var MissingKey = class extends Base$1 {
20187
20251
  *
20188
20252
  * - `ast` is the schema that was being validated against.
20189
20253
  * - `annotations` on `ast` may contain a custom `messageUnexpectedKey`.
20190
- * - The default formatter renders this as `"Expected no excess property"`.
20254
+ * - The default formatter renders this as `"Expected no excess property"`, or
20255
+ * `"Unexpected key with value <input>"` when the issue reports an input.
20191
20256
  *
20192
20257
  * @see {@link MissingKey} — the opposite case (required key absent)
20193
20258
  * @see {@link Pointer} — wraps this issue with the unexpected key's path
@@ -20201,8 +20266,8 @@ var UnexpectedKey = class extends Base$1 {
20201
20266
  * The schema that caused the issue.
20202
20267
  */
20203
20268
  ast;
20204
- constructor(ast) {
20205
- super();
20269
+ constructor(ast, input, options) {
20270
+ super(input, options);
20206
20271
  this.ast = ast;
20207
20272
  }
20208
20273
  };
@@ -20235,8 +20300,8 @@ var Composite = class extends Base$1 {
20235
20300
  * The issues that occurred.
20236
20301
  */
20237
20302
  issues;
20238
- constructor(ast, issues) {
20239
- super();
20303
+ constructor(ast, issues, input, options) {
20304
+ super(input, options);
20240
20305
  this.ast = ast;
20241
20306
  this.issues = issues;
20242
20307
  }
@@ -20253,15 +20318,17 @@ var Composite = class extends Base$1 {
20253
20318
  * **Details**
20254
20319
  *
20255
20320
  * - `ast` is the schema node that expected a different type.
20256
- * - The default formatter renders this as `"Expected <type>"`.
20321
+ * - The default formatter renders this as `"Expected <type>"`, adding
20322
+ * `", got <input>"` when the issue reports an input.
20257
20323
  *
20258
20324
  * **Example** (Formatting a type mismatch)
20259
20325
  *
20260
20326
  * ```ts import.meta.vitest
20261
20327
  * import { Schema, SchemaIssue } from "effect"
20262
20328
  *
20329
+ * const formatIssue = SchemaIssue.makeFormatterDefault()
20263
20330
  * const issue = new SchemaIssue.InvalidType(Schema.String.ast)
20264
- * String(issue) // => "Expected string"
20331
+ * formatIssue(issue) // => "Expected string"
20265
20332
  * ```
20266
20333
  *
20267
20334
  * @see {@link InvalidValue} — the input has the right type but fails a value constraint
@@ -20275,8 +20342,8 @@ var InvalidType = class extends Base$1 {
20275
20342
  * The schema that caused the issue.
20276
20343
  */
20277
20344
  ast;
20278
- constructor(ast) {
20279
- super();
20345
+ constructor(ast, input, options) {
20346
+ super(input, options);
20280
20347
  this.ast = ast;
20281
20348
  }
20282
20349
  };
@@ -20291,17 +20358,22 @@ var InvalidType = class extends Base$1 {
20291
20358
  *
20292
20359
  * **Details**
20293
20360
  *
20294
- * - `annotations` optionally carries a `message` string for formatting.
20295
- * - The default formatter renders this as `"Expected a valid value"` unless a
20296
- * custom `message` annotation is provided.
20361
+ * - A `message` annotation is returned unchanged and takes precedence over all
20362
+ * other default formatting.
20363
+ * - Without `message`, an `expected` annotation is formatted as
20364
+ * `"Expected <expected>"`, adding `", got <input>"` when input is reported.
20365
+ * - Without either annotation, the default formatter renders
20366
+ * `"Expected a valid value"`, or `"Invalid data <input>"` when input is
20367
+ * reported.
20297
20368
  *
20298
20369
  * **Example** (Returning InvalidValue from a custom filter)
20299
20370
  *
20300
20371
  * ```ts import.meta.vitest
20301
20372
  * import { SchemaIssue } from "effect"
20302
20373
  *
20374
+ * const formatIssue = SchemaIssue.makeFormatterDefault()
20303
20375
  * const issue = new SchemaIssue.InvalidValue({ message: "must not be empty" })
20304
- * String(issue) // => "must not be empty"
20376
+ * formatIssue(issue) // => "must not be empty"
20305
20377
  * ```
20306
20378
  *
20307
20379
  * @see {@link InvalidType} — the input has the wrong type entirely
@@ -20316,11 +20388,15 @@ var InvalidValue$1 = class extends Base$1 {
20316
20388
  * The metadata for the issue.
20317
20389
  */
20318
20390
  annotations;
20319
- constructor(annotations) {
20320
- super();
20391
+ constructor(annotations, input, options) {
20392
+ super(input, options);
20321
20393
  this.annotations = annotations;
20322
20394
  }
20323
20395
  };
20396
+ /** @internal */
20397
+ function makeCompositeAtKey(compositeAst, pointerKey, pointerIssue, compositeInput, parseOptions) {
20398
+ return new Composite(compositeAst, [new Pointer([pointerKey], pointerIssue)], compositeInput, parseOptions);
20399
+ }
20324
20400
  /**
20325
20401
  * Represents a schema issue produced when a forbidden operation is encountered during parsing,
20326
20402
  * such as an asynchronous Effect running inside `Schema.decodeUnknownSync`.
@@ -20340,10 +20416,11 @@ var InvalidValue$1 = class extends Base$1 {
20340
20416
  * ```ts import.meta.vitest
20341
20417
  * import { SchemaIssue } from "effect"
20342
20418
  *
20419
+ * const formatIssue = SchemaIssue.makeFormatterDefault()
20343
20420
  * const issue = new SchemaIssue.Forbidden(
20344
20421
  * { message: "async operation not allowed in sync context" }
20345
20422
  * )
20346
- * String(issue) // => "async operation not allowed in sync context"
20423
+ * formatIssue(issue) // => "async operation not allowed in sync context"
20347
20424
  * ```
20348
20425
  *
20349
20426
  * @see {@link InvalidValue} — for value-constraint failures (not operation failures)
@@ -20357,8 +20434,8 @@ var Forbidden = class extends Base$1 {
20357
20434
  * The metadata for the issue.
20358
20435
  */
20359
20436
  annotations;
20360
- constructor(annotations) {
20361
- super();
20437
+ constructor(annotations, input, options) {
20438
+ super(input, options);
20362
20439
  this.annotations = annotations;
20363
20440
  }
20364
20441
  };
@@ -20378,7 +20455,8 @@ var Forbidden = class extends Base$1 {
20378
20455
  * **Gotchas**
20379
20456
  *
20380
20457
  * `issues` is empty when no union member was applicable. In that case, the
20381
- * default formatter reports the expected type for the union.
20458
+ * default formatter reports the expected type for the union and appends
20459
+ * `", got <input>"` when input is reported.
20382
20460
  *
20383
20461
  * @see {@link OneOf} — the opposite: *too many* members matched
20384
20462
  * @see {@link Composite} — groups multiple issues under a non-union schema
@@ -20396,8 +20474,8 @@ var AnyOf = class extends Base$1 {
20396
20474
  * The issues that occurred.
20397
20475
  */
20398
20476
  issues;
20399
- constructor(ast, issues) {
20400
- super();
20477
+ constructor(ast, issues, input, options) {
20478
+ super(input, options);
20401
20479
  this.ast = ast;
20402
20480
  this.issues = issues;
20403
20481
  }
@@ -20416,7 +20494,9 @@ var AnyOf = class extends Base$1 {
20416
20494
  * - `ast` is the `Union` AST node.
20417
20495
  * - `successes` lists the AST nodes of each member that accepted the input.
20418
20496
  * - The default formatter renders this as
20419
- * `"Expected exactly one member to match"`.
20497
+ * `"Expected exactly one member to match"`, or
20498
+ * `"Expected exactly one member to match the input <input>"` when input is
20499
+ * reported.
20420
20500
  *
20421
20501
  * @see {@link AnyOf} — the opposite: *no* members matched
20422
20502
  *
@@ -20433,31 +20513,31 @@ var OneOf = class extends Base$1 {
20433
20513
  * The schemas that were successful.
20434
20514
  */
20435
20515
  successes;
20436
- constructor(ast, successes) {
20437
- super();
20516
+ constructor(ast, successes, input, options) {
20517
+ super(input, options);
20438
20518
  this.ast = ast;
20439
20519
  this.successes = successes;
20440
20520
  }
20441
20521
  };
20442
- function makeFilterIssue(entry) {
20522
+ function makeFilterIssue(entry, input, options) {
20443
20523
  if (isIssue(entry)) return entry;
20444
- if (typeof entry === "string") return new InvalidValue$1({ message: entry });
20445
- const inner = typeof entry.issue === "string" ? new InvalidValue$1({ message: entry.issue }) : entry.issue;
20524
+ if (typeof entry === "string") return new InvalidValue$1({ message: entry }, input, options);
20525
+ const inner = typeof entry.issue === "string" ? new InvalidValue$1({ message: entry.issue }, input, options) : entry.issue;
20446
20526
  return new Pointer(entry.path, inner);
20447
20527
  }
20448
20528
  /** @internal */
20449
- function makeSingle$1(out) {
20529
+ function makeSingle$1(out, input, options) {
20450
20530
  if (out === void 0) return;
20451
- if (typeof out === "boolean") return out ? void 0 : new InvalidValue$1();
20452
- return makeFilterIssue(out);
20531
+ if (typeof out === "boolean") return out ? void 0 : new InvalidValue$1(void 0, input, options);
20532
+ return makeFilterIssue(out, input, options);
20453
20533
  }
20454
20534
  /** @internal */
20455
- function normalizeFilterOutput(ast, out) {
20535
+ function normalizeFilterOutput(ast, out, input, options) {
20456
20536
  if (Array.isArray(out)) {
20457
20537
  if (!isReadonlyArrayNonEmpty(out)) return;
20458
- return out.length === 1 ? makeFilterIssue(out[0]) : new Composite(ast, map$10(out, makeFilterIssue));
20538
+ return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, map$10(out, (entry) => makeFilterIssue(entry, input, options)), input, options);
20459
20539
  }
20460
- return makeSingle$1(out);
20540
+ return makeSingle$1(out, input, options);
20461
20541
  }
20462
20542
  /**
20463
20543
  * Returns the built-in {@link LeafHook} used by default formatters.
@@ -20469,13 +20549,18 @@ function normalizeFilterOutput(ast, out) {
20469
20549
  * **Details**
20470
20550
  *
20471
20551
  * - Checks for a `message` annotation first; returns it if present.
20472
- * - Otherwise generates a default message per `_tag`:
20473
- * - `InvalidType` → `"Expected <type>"`
20474
- * - `InvalidValue` → `"Expected a valid value"`
20552
+ * - For `InvalidValue`, an `expected` annotation uses the standard expected
20553
+ * value message and includes reported input when available.
20554
+ * - Otherwise generates a default message per `_tag`. When the issue reports
20555
+ * input, the message includes its formatted value where applicable:
20556
+ * - `InvalidType` → `"Expected <type>"` or `"Expected <type>, got <input>"`
20557
+ * - `InvalidValue` → `"Expected a valid value"` or `"Invalid data <input>"`
20475
20558
  * - `MissingKey` → `"Missing key"`
20476
- * - `UnexpectedKey` → `"Expected no excess property"`
20559
+ * - `UnexpectedKey` → `"Expected no excess property"` or
20560
+ * `"Unexpected key with value <input>"`
20477
20561
  * - `Forbidden` → `"Forbidden operation"`
20478
- * - `OneOf` → `"Expected exactly one member to match"`
20562
+ * - `OneOf` → `"Expected exactly one member to match"` or
20563
+ * `"Expected exactly one member to match the input <input>"`
20479
20564
  *
20480
20565
  * **Example** (Formatting Standard Schema issues with defaultLeafHook)
20481
20566
  *
@@ -20498,12 +20583,23 @@ var defaultLeafHook = (issue) => {
20498
20583
  const message = findMessage(issue);
20499
20584
  if (message !== void 0) return message;
20500
20585
  switch (issue._tag) {
20501
- case "InvalidType": return getExpectedMessage(getExpected(issue.ast));
20502
- case "InvalidValue": return "Expected a valid value";
20586
+ case "InvalidType": return getExpectedMessage(getExpected(issue.ast), issue);
20587
+ case "InvalidValue": {
20588
+ const expected = findExpected(issue);
20589
+ if (expected !== void 0) return getExpectedMessage(expected, issue);
20590
+ const input = formatInput(issue);
20591
+ return input === void 0 ? "Expected a valid value" : `Invalid data ${input}`;
20592
+ }
20503
20593
  case "MissingKey": return "Missing key";
20504
- case "UnexpectedKey": return "Expected no excess property";
20594
+ case "UnexpectedKey": {
20595
+ const input = formatInput(issue);
20596
+ return input === void 0 ? "Expected no excess property" : `Unexpected key with value ${input}`;
20597
+ }
20505
20598
  case "Forbidden": return "Forbidden operation";
20506
- case "OneOf": return "Expected exactly one member to match";
20599
+ case "OneOf": {
20600
+ const input = formatInput(issue);
20601
+ return input === void 0 ? "Expected exactly one member to match" : `Expected exactly one member to match the input ${input}`;
20602
+ }
20507
20603
  }
20508
20604
  };
20509
20605
  /**
@@ -20518,7 +20614,8 @@ var defaultLeafHook = (issue) => {
20518
20614
  * - Looks for a `message` annotation on the inner issue first, then on the
20519
20615
  * filter itself.
20520
20616
  * - Returns `undefined` when no annotation is found, causing the formatter to
20521
- * fall back to `"Expected <filter>"`.
20617
+ * fall back to `"Expected <filter>"` or, when the filter reports input,
20618
+ * `"Expected <filter>, got <input>"`.
20522
20619
  *
20523
20620
  * @see {@link CheckHook}
20524
20621
  * @see {@link makeFormatterStandardSchemaV1}
@@ -20526,11 +20623,17 @@ var defaultLeafHook = (issue) => {
20526
20623
  * @category formatting
20527
20624
  * @since 4.0.0
20528
20625
  */
20529
- var defaultCheckHook = (issue) => {
20530
- return findMessage(issue.issue) ?? findMessage(issue);
20531
- };
20532
- function getExpectedMessage(expected) {
20533
- return `Expected ${expected}`;
20626
+ var defaultCheckHook = (issue) => findMessage(issue.issue) ?? findMessage(issue);
20627
+ function formatInput(issue) {
20628
+ return hasInput(issue) ? format$3(issue.input) : void 0;
20629
+ }
20630
+ function findExpected(issue) {
20631
+ const expected = issue.annotations?.expected;
20632
+ return typeof expected === "string" ? expected : void 0;
20633
+ }
20634
+ function getExpectedMessage(expected, issue) {
20635
+ const input = formatInput(issue);
20636
+ return input === void 0 ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;
20534
20637
  }
20535
20638
  function toDefaultIssues(issue, path, leafHook, checkHook) {
20536
20639
  switch (issue._tag) {
@@ -20540,13 +20643,12 @@ function toDefaultIssues(issue, path, leafHook, checkHook) {
20540
20643
  path,
20541
20644
  message
20542
20645
  }];
20543
- switch (issue.issue._tag) {
20544
- case "InvalidValue": return [{
20545
- path,
20546
- message: getExpectedMessage(formatCheck(issue.filter))
20547
- }];
20548
- default: return toDefaultIssues(issue.issue, path, leafHook, checkHook);
20549
- }
20646
+ if (issue.issue._tag !== "InvalidValue") return toDefaultIssues(issue.issue, path, leafHook, checkHook);
20647
+ const expected = findExpected(issue.issue);
20648
+ return [{
20649
+ path,
20650
+ message: expected === void 0 ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue)
20651
+ }];
20550
20652
  }
20551
20653
  case "Encoding": return toDefaultIssues(issue.issue, path, leafHook, checkHook);
20552
20654
  case "Pointer": return toDefaultIssues(issue.issue, [...path, ...issue.path], leafHook, checkHook);
@@ -20554,7 +20656,7 @@ function toDefaultIssues(issue, path, leafHook, checkHook) {
20554
20656
  case "AnyOf":
20555
20657
  if (issue.issues.length === 0) return [{
20556
20658
  path,
20557
- message: findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast))
20659
+ message: findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue)
20558
20660
  }];
20559
20661
  return issue.issues.flatMap((issue) => toDefaultIssues(issue, path, leafHook, checkHook));
20560
20662
  default: return [{
@@ -20582,13 +20684,19 @@ function formatCheck(check) {
20582
20684
  *
20583
20685
  * **Details**
20584
20686
  *
20585
- * This is the default formatter used by `SchemaIssue.toString()`.
20586
- *
20587
20687
  * - Flattens the issue tree into `{ message, path }` entries using
20588
20688
  * {@link defaultLeafHook} and {@link defaultCheckHook}.
20689
+ * - Includes reported input in default messages when the node producing the
20690
+ * message has an `input` field.
20589
20691
  * - Each entry is rendered as `"<message>"` or `"<message>\n at <path>"`.
20590
20692
  * - Multiple entries are joined with newlines.
20591
20693
  *
20694
+ * **Gotchas**
20695
+ *
20696
+ * Formatting an issue can disclose input retained with `reportInput: true`.
20697
+ * Wrapper inputs are not inherited by child messages, and custom messages are
20698
+ * returned unchanged.
20699
+ *
20592
20700
  * **Example** (Formatting an issue as a string)
20593
20701
  *
20594
20702
  * ```ts import.meta.vitest
@@ -20636,7 +20744,7 @@ function getMessageAnnotation(annotations, type = "message") {
20636
20744
  if (typeof message === "string") return message;
20637
20745
  }
20638
20746
  //#endregion
20639
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/schema/cause.js
20747
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/schema/cause.js
20640
20748
  /** @internal */
20641
20749
  function getSchemaIssue(cause) {
20642
20750
  let issue;
@@ -20653,15 +20761,7 @@ function getSchemaIssueOrThrow(cause, message) {
20653
20761
  return issue;
20654
20762
  }
20655
20763
  //#endregion
20656
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/schema/parser.js
20657
- var missing = /*#__PURE__*/ Symbol();
20658
- var succeed$1 = succeed$6;
20659
- var missingExit = /*#__PURE__*/ succeed$1(missing);
20660
- var sameExit = /*#__PURE__*/ succeed$1(missing);
20661
- var toOption = (value) => value === missing ? none() : some(value);
20662
- var fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed$1(option.value);
20663
- //#endregion
20664
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/DateTime.js
20764
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/DateTime.js
20665
20765
  /**
20666
20766
  * Checks whether a value is a `DateTime`.
20667
20767
  *
@@ -20892,7 +20992,7 @@ Service$1()("effect/DateTime/CurrentTimeZone");
20892
20992
  */
20893
20993
  var formatIso = formatIso$1;
20894
20994
  //#endregion
20895
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Encoding.js
20995
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Encoding.js
20896
20996
  /**
20897
20997
  * Encoding and decoding helpers for Base64, Base64Url, and hexadecimal text.
20898
20998
  * The functions convert between strings, UTF-8 text, and `Uint8Array` bytes.
@@ -21270,7 +21370,7 @@ var base64codes = [
21270
21370
  51
21271
21371
  ];
21272
21372
  //#endregion
21273
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/SchemaGetter.js
21373
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/SchemaGetter.js
21274
21374
  /**
21275
21375
  * Builds one-way conversions used by schemas.
21276
21376
  *
@@ -21347,7 +21447,8 @@ var Getter = class Getter extends Class$3 {
21347
21447
  * **Details**
21348
21448
  *
21349
21449
  * - Always fails with the `Issue` returned by `f`.
21350
- * - The failure function receives the original `Option<E>` input for error context.
21450
+ * - The failure function receives the original `Option<E>` input and the
21451
+ * effective `ParseOptions` for error context.
21351
21452
  *
21352
21453
  * **Example** (Defining an always-failing getter)
21353
21454
  *
@@ -21368,7 +21469,7 @@ var Getter = class Getter extends Class$3 {
21368
21469
  * @since 4.0.0
21369
21470
  */
21370
21471
  function fail(f) {
21371
- return new Getter((oe) => fail$3(f(oe)));
21472
+ return new Getter((oe, options) => fail$3(f(oe, options)));
21372
21473
  }
21373
21474
  /**
21374
21475
  * Creates a getter that always fails with a `Forbidden` issue.
@@ -21402,7 +21503,10 @@ function fail(f) {
21402
21503
  * @since 4.0.0
21403
21504
  */
21404
21505
  function forbidden(message) {
21405
- return fail((oe) => new Forbidden({ message: message(oe) }));
21506
+ return fail((oe, options) => {
21507
+ const annotations = { message: message(oe) };
21508
+ return isSome(oe) ? new Forbidden(annotations, oe.value, options) : new Forbidden(annotations);
21509
+ });
21406
21510
  }
21407
21511
  var passthrough_$1 = /*#__PURE__*/ new Getter(succeed$4);
21408
21512
  function isPassthrough(getter) {
@@ -21507,10 +21611,10 @@ function transform$2(f) {
21507
21611
  * import { Effect, Option, SchemaGetter, SchemaIssue } from "effect"
21508
21612
  *
21509
21613
  * const safeParseInt = SchemaGetter.transformOrFail<number, string>(
21510
- * (s) => {
21614
+ * (s, options) => {
21511
21615
  * const n = parseInt(s, 10)
21512
21616
  * return isNaN(n)
21513
- * ? Effect.fail(new SchemaIssue.InvalidValue({ message: "not an integer" }))
21617
+ * ? Effect.fail(new SchemaIssue.InvalidValue({ message: "not an integer" }, s, options))
21514
21618
  * : Effect.succeed(n)
21515
21619
  * }
21516
21620
  * )
@@ -21762,10 +21866,10 @@ function encodeBase64() {
21762
21866
  * @since 4.0.0
21763
21867
  */
21764
21868
  function decodeBase64() {
21765
- return transformOrFail$1((input) => mapErrorEager(fromResult(decodeBase64$1(input)), () => new InvalidValue$1({ message: "Expected a valid Base64 string" })));
21869
+ return transformOrFail$1((input, options) => mapErrorEager(fromResult(decodeBase64$1(input)), () => new InvalidValue$1({ expected: "a valid Base64 string" }, input, options)));
21766
21870
  }
21767
21871
  //#endregion
21768
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/BigDecimal.js
21872
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/BigDecimal.js
21769
21873
  /**
21770
21874
  * Decimal numbers and arithmetic for cases where JavaScript `number` rounding
21771
21875
  * is not precise enough. A `BigDecimal` stores digits as a `bigint` plus a
@@ -22149,7 +22253,7 @@ var isZero = (n) => n.value === bigint0;
22149
22253
  */
22150
22254
  var isNegative = (n) => n.value < bigint0;
22151
22255
  //#endregion
22152
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/SchemaTransformation.js
22256
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/SchemaTransformation.js
22153
22257
  var TypeId$30 = "~effect/SchemaTransformation/Transformation";
22154
22258
  /**
22155
22259
  * Represents a bidirectional transformation between a decoded type `T` and an encoded
@@ -22300,10 +22404,10 @@ var make$32 = (options) => {
22300
22404
  * Schema.decodeTo(
22301
22405
  * Schema.Date,
22302
22406
  * SchemaTransformation.transformOrFail({
22303
- * decode: (s) => {
22407
+ * decode: (s, options) => {
22304
22408
  * const d = new Date(s)
22305
22409
  * return isNaN(d.getTime())
22306
- * ? Effect.fail(new SchemaIssue.InvalidValue({ message: "Invalid date" }))
22410
+ * ? Effect.fail(new SchemaIssue.InvalidValue({ message: "Invalid date" }, s, options))
22307
22411
  * : Effect.succeed(d)
22308
22412
  * },
22309
22413
  * encode: (d) => Effect.succeed(d.toISOString())
@@ -22534,16 +22638,16 @@ var uint8ArrayFromBase64String = /*#__PURE__*/ new Transformation(/*#__PURE__*/
22534
22638
  * @since 4.0.0
22535
22639
  */
22536
22640
  var dateTimeUtcFromString = /*#__PURE__*/ transformOrFail({
22537
- decode: (s) => {
22641
+ decode: (s, options) => {
22538
22642
  return match$5(make$34(s), {
22539
- onNone: () => fail$3(new InvalidValue$1({ message: "Expected a valid UTC DateTime string" })),
22643
+ onNone: () => fail$3(new InvalidValue$1({ expected: "a valid UTC DateTime string" }, s, options)),
22540
22644
  onSome: (result) => succeed$4(toUtc(result))
22541
22645
  });
22542
22646
  },
22543
22647
  encode: (utc) => succeed$4(formatIso(utc))
22544
22648
  });
22545
22649
  //#endregion
22546
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/SchemaAST.js
22650
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/SchemaAST.js
22547
22651
  /**
22548
22652
  * Represents Effect schemas as runtime trees.
22549
22653
  *
@@ -22631,13 +22735,6 @@ var isArrays = /*#__PURE__*/ makeGuard("Arrays");
22631
22735
  */
22632
22736
  var isObjects = /*#__PURE__*/ makeGuard("Objects");
22633
22737
  /**
22634
- * Narrows an {@link AST} to {@link Union}.
22635
- *
22636
- * @category guards
22637
- * @since 3.10.0
22638
- */
22639
- var isUnion = /*#__PURE__*/ makeGuard("Union");
22640
- /**
22641
22738
  * Narrows an {@link AST} to {@link Suspend}.
22642
22739
  *
22643
22740
  * @category guards
@@ -23063,7 +23160,7 @@ var TemplateLiteral$1 = class extends Base {
23063
23160
  if (result._tag === "Success") return sameExit;
23064
23161
  return mapBothEager(result, {
23065
23162
  onSuccess: () => input,
23066
- onFailure: (issue) => new Composite(this, [issue])
23163
+ onFailure: (issue) => new Composite(this, [issue], input, options)
23067
23164
  });
23068
23165
  };
23069
23166
  }
@@ -23080,7 +23177,7 @@ var TemplateLiteral$1 = class extends Base {
23080
23177
  return decodeTo$1(string$5, new Arrays(false, this.parts.map(partFromString), []), new Transformation(transformOrFail$1((s, options) => {
23081
23178
  const segments = segmentTemplateLiteralParts(this, s, options);
23082
23179
  if (segments) return succeed$4(segments);
23083
- return fail$3(new InvalidValue$1({ message: "Expected a string matching template literal parts" }));
23180
+ return fail$3(new InvalidValue$1({ expected: "a string matching template literal parts" }, s, options));
23084
23181
  }), transform$2((parts) => parts.join(""))));
23085
23182
  }
23086
23183
  };
@@ -23414,7 +23511,7 @@ var Arrays = class Arrays extends Base {
23414
23511
  }
23415
23512
  return fnUntracedEager(function* (input, options) {
23416
23513
  if (input === missing) return missing;
23417
- if (!Array.isArray(input)) return yield* fail$3(new InvalidType(ast));
23514
+ if (!Array.isArray(input)) return yield* fail$3(new InvalidType(ast, input, options));
23418
23515
  if (!elements) {
23419
23516
  elements = ast.elements.map((ast) => ({
23420
23517
  ast,
@@ -23442,12 +23539,13 @@ var Arrays = class Arrays extends Base {
23442
23539
  });
23443
23540
  if (eff) yield* eff;
23444
23541
  if (ast.rest.length === 0 && len > elementLen) for (let i = elementLen; i <= len - 1; i++) {
23445
- const issue = new Pointer([i], new UnexpectedKey(ast));
23542
+ const unexpected = new UnexpectedKey(ast, input[i], options);
23543
+ const issue = new Pointer([i], unexpected);
23446
23544
  if (options.errors === "all") if (state.issues) state.issues.push(issue);
23447
23545
  else state.issues = [issue];
23448
- else return yield* fail$3(new Composite(ast, [issue]));
23546
+ else return yield* fail$3(new Composite(ast, [issue], input, options));
23449
23547
  }
23450
- if (state.issues) return yield* fail$3(new Composite(ast, state.issues));
23548
+ if (state.issues) return yield* fail$3(new Composite(ast, state.issues, input, options));
23451
23549
  return state.output;
23452
23550
  });
23453
23551
  }
@@ -23484,7 +23582,7 @@ var parseArray = /*#__PURE__*/ iterateEager()({
23484
23582
  const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));
23485
23583
  if (s.options.errors === "all") if (s.issues) s.issues.push(issue);
23486
23584
  else s.issues = [issue];
23487
- else return fail$5(new Composite(s.ast, [issue]));
23585
+ else return fail$5(new Composite(s.ast, [issue], s.input, s.options));
23488
23586
  }
23489
23587
  }
23490
23588
  });
@@ -23495,11 +23593,11 @@ var resolveConcurrency = (value) => {
23495
23593
  var wrapPropertyKeyIssue = (s, ast, key, exit) => {
23496
23594
  if (exit.cause.reasons.length === 0) return exit;
23497
23595
  const issue = getSchemaIssue(exit.cause);
23498
- if (issue === void 0) return failCause$3(map$8(exit.cause, (issue) => new Composite(ast, [new Pointer([key], issue)])));
23596
+ if (issue === void 0) return failCause$3(map$8(exit.cause, (issue) => new Composite(ast, [new Pointer([key], issue)], s.input, s.options)));
23499
23597
  const pointer = new Pointer([key], issue);
23500
23598
  if (s.options.errors === "all") if (s.issues) s.issues.push(pointer);
23501
23599
  else s.issues = [pointer];
23502
- else return fail$5(new Composite(ast, [pointer]));
23600
+ else return fail$5(new Composite(ast, [pointer], s.input, s.options));
23503
23601
  };
23504
23602
  /**
23505
23603
  * floating point or integer, with optional exponent
@@ -23691,7 +23789,7 @@ var Objects = class Objects extends Base {
23691
23789
  }) : void 0;
23692
23790
  return fnUntracedEager(function* (input, options) {
23693
23791
  if (input === missing) return missing;
23694
- if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return yield* fail$3(new InvalidType(ast));
23792
+ if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return yield* fail$3(new InvalidType(ast, input, options));
23695
23793
  if (!properties) {
23696
23794
  properties = ast.propertySignatures.map((ps) => ({
23697
23795
  parser: compileConstructorDefault(ps.type),
@@ -23723,12 +23821,13 @@ var Objects = class Objects extends Base {
23723
23821
  for (let i = 0; i < inputKeys.length; i++) {
23724
23822
  const key = inputKeys[i];
23725
23823
  if (!expectedKeysSet.has(key)) if (onExcessPropertyError) {
23726
- const issue = new Pointer([key], new UnexpectedKey(ast));
23824
+ const unexpected = new UnexpectedKey(ast, record[key], options);
23825
+ const issue = new Pointer([key], unexpected);
23727
23826
  if (errorsAllOption) {
23728
23827
  if (state.issues) state.issues.push(issue);
23729
23828
  else state.issues = [issue];
23730
23829
  continue;
23731
- } else return yield* fail$3(new Composite(ast, [issue]));
23830
+ } else return yield* fail$3(new Composite(ast, [issue], input, options));
23732
23831
  } else assignProperty(out, key, record[key]);
23733
23832
  }
23734
23833
  }
@@ -23757,7 +23856,7 @@ var Objects = class Objects extends Base {
23757
23856
  const eff = parseIndexes(state, keyPairs, concurrency);
23758
23857
  if (eff) yield* eff;
23759
23858
  }
23760
- if (state.issues) return yield* fail$3(new Composite(ast, state.issues));
23859
+ if (state.issues) return yield* fail$3(new Composite(ast, state.issues, input, options));
23761
23860
  if (options.propertyOrder === "original") {
23762
23861
  const keys = (inputKeys ?? Reflect.ownKeys(record)).concat(expectedKeys);
23763
23862
  const preserved = {};
@@ -23815,7 +23914,7 @@ var parseProperties = /*#__PURE__*/ iterateEager()({
23815
23914
  if (s.issues) s.issues.push(issue);
23816
23915
  else s.issues = [issue];
23817
23916
  return;
23818
- } else return fail$5(new Composite(s.ast, [issue]));
23917
+ } else return fail$5(new Composite(s.ast, [issue], s.input, s.options));
23819
23918
  }
23820
23919
  }
23821
23920
  });
@@ -23842,7 +23941,7 @@ function tuple(elements, checks = void 0) {
23842
23941
  function union(members, mode, checks) {
23843
23942
  return new Union$1(members.map(getAST), mode, void 0, checks);
23844
23943
  }
23845
- var toCandidate = /*#__PURE__*/ memoize((ast) => {
23944
+ var toCandidate = /*#__PURE__*/ memoizeIdempotent((ast) => {
23846
23945
  while (true) {
23847
23946
  if (isSuspend(ast)) return unknown;
23848
23947
  const encoding = ast.encoding;
@@ -24068,7 +24167,7 @@ var Union$1 = class Union$1 extends Base {
24068
24167
  if (candidates.length === 1) {
24069
24168
  const result = compile(candidates[0])(input, options);
24070
24169
  if (result._tag === "Success") return result;
24071
- return effectIsExit(result) ? failSingleUnionCandidate(ast, result.cause) : catchCause$1(result, (cause) => failSingleUnionCandidate(ast, cause));
24170
+ return effectIsExit(result) ? failSingleUnionCandidate(ast, result.cause, input, options) : catchCause$1(result, (cause) => failSingleUnionCandidate(ast, cause, input, options));
24072
24171
  }
24073
24172
  const state = {
24074
24173
  ast,
@@ -24084,9 +24183,14 @@ var Union$1 = class Union$1 extends Base {
24084
24183
  ...concurrency,
24085
24184
  orderedStep: true
24086
24185
  } : void 0);
24087
- if (!eff) return state.out ?? fail$3(new AnyOf(ast, state.issues ?? []));
24186
+ if (!eff) {
24187
+ if (state.out) return state.out;
24188
+ return fail$3(new AnyOf(ast, state.issues ?? [], input, options));
24189
+ }
24088
24190
  return flatMapEager(eff, (_) => {
24089
- return state.out === sameExit ? succeed$4(input) : state.out ?? fail$3(new AnyOf(ast, state.issues ?? []));
24191
+ if (state.out === sameExit) return succeed$4(input);
24192
+ if (state.out) return state.out;
24193
+ return fail$3(new AnyOf(ast, state.issues ?? [], input, options));
24090
24194
  });
24091
24195
  };
24092
24196
  }
@@ -24133,9 +24237,10 @@ var Union$1 = class Union$1 extends Base {
24133
24237
  return Array.from(new Set(types)).join(" | ");
24134
24238
  }
24135
24239
  };
24136
- function failSingleUnionCandidate(ast, cause) {
24240
+ function failSingleUnionCandidate(ast, cause, input, options) {
24137
24241
  const issue = getSchemaIssue(cause);
24138
- return issue ? fail$5(new AnyOf(ast, [issue])) : failCause$3(cause);
24242
+ if (!issue) return failCause$3(cause);
24243
+ return fail$5(new AnyOf(ast, [issue], input, options));
24139
24244
  }
24140
24245
  var parseUnion = /*#__PURE__*/ iterateEager()({
24141
24246
  onItem(s, ast) {
@@ -24150,7 +24255,7 @@ var parseUnion = /*#__PURE__*/ iterateEager()({
24150
24255
  } else {
24151
24256
  if (s.out && s.successes) {
24152
24257
  s.successes.push(candidate);
24153
- return fail$5(new OneOf(s.ast, s.successes));
24258
+ return fail$5(new OneOf(s.ast, s.successes, s.input, s.options));
24154
24259
  }
24155
24260
  s.out = exit;
24156
24261
  if (s.successes) s.successes.push(candidate);
@@ -24252,7 +24357,7 @@ var FilterGroup = class FilterGroup extends Class$3 {
24252
24357
  };
24253
24358
  /** @internal */
24254
24359
  function makeFilter$1(filter, annotations, aborted = false) {
24255
- return new Filter((input, ast, options) => normalizeFilterOutput(ast, filter(input, ast, options)), annotations, aborted);
24360
+ return new Filter((input, ast, options) => normalizeFilterOutput(ast, filter(input, ast, options), input, options), annotations, aborted);
24256
24361
  }
24257
24362
  /** @internal */
24258
24363
  function isFinite$1(annotations) {
@@ -24334,6 +24439,11 @@ function modifyOwnPropertyDescriptors(ast, f) {
24334
24439
  f(d);
24335
24440
  return Object.create(Object.getPrototypeOf(ast), d);
24336
24441
  }
24442
+ var contextOwners = /*#__PURE__*/ new WeakMap();
24443
+ /** @internal */
24444
+ function getContextOwner(ast) {
24445
+ return contextOwners.get(ast) ?? ast;
24446
+ }
24337
24447
  /** @internal */
24338
24448
  function replaceEncoding(ast, encoding) {
24339
24449
  if (ast.encoding === encoding) return ast;
@@ -24344,9 +24454,13 @@ function replaceEncoding(ast, encoding) {
24344
24454
  /** @internal */
24345
24455
  function replaceContext(ast, context) {
24346
24456
  if (ast.context === context) return ast;
24347
- return modifyOwnPropertyDescriptors(ast, (d) => {
24457
+ const owner = getContextOwner(ast);
24458
+ if (owner.context === context) return owner;
24459
+ const out = modifyOwnPropertyDescriptors(ast, (d) => {
24348
24460
  d.context.value = context;
24349
24461
  });
24462
+ contextOwners.set(out, owner);
24463
+ return out;
24350
24464
  }
24351
24465
  /** @internal */
24352
24466
  function getLastEncoding(ast) {
@@ -24397,11 +24511,15 @@ function replaceContextLastLink(ast, context) {
24397
24511
  return applyToLastLink((ast) => replaceContext(ast, context))(ast);
24398
24512
  }
24399
24513
  /** @internal */
24400
- function applyToSelfOrLastLinkEncoding(f) {
24514
+ function applyToSelfOrLastLinkEncodingIdempotent(f, options) {
24401
24515
  function out(ast) {
24402
- return ast.encoding ? replaceEncoding(ast, updateLastLink(ast.encoding, out)) : f(ast);
24516
+ if (ast.encoding) {
24517
+ const last = ast.encoding[ast.encoding.length - 1];
24518
+ return options?.stopAt?.(last) ? ast : replaceEncoding(ast, updateLastLink(ast.encoding, out));
24519
+ }
24520
+ return f(ast);
24403
24521
  }
24404
- return memoize(out);
24522
+ return memoizeIdempotent(out);
24405
24523
  }
24406
24524
  function appendTransformation(from, transformation, to) {
24407
24525
  const link = new Link(from, transformation);
@@ -24425,24 +24543,13 @@ function annotateKey(ast, annotations) {
24425
24543
  ...annotations
24426
24544
  }) : new Context(false, false, void 0, annotations));
24427
24545
  }
24428
- var optionalKeyLastLink = /*#__PURE__*/ applyToLastLink(optionalKey$1);
24429
- /**
24430
- * Marks an AST node's property key as optional by setting
24431
- * {@link Context.isOptional} to `true`.
24432
- *
24433
- * **Details**
24434
- *
24435
- * Also propagates the optional flag through the last link of the encoding
24436
- * chain if present.
24437
- *
24438
- * @see {@link isOptional}
24439
- * @see {@link Context}
24440
- * @category transforming
24441
- * @since 4.0.0
24442
- */
24443
- function optionalKey$1(ast) {
24546
+ /** @internal */
24547
+ var optionalKey$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
24444
24548
  return optionalKeyLastLink(replaceContext(ast, ast.context ? ast.context.isOptional === false ? new Context(true, ast.context.isMutable, ast.context.constructorDefault, ast.context.annotations) : ast.context : new Context(true, false)));
24445
- }
24549
+ });
24550
+ var optionalKeyLastLink = /*#__PURE__*/ applyToLastLink(optionalKey$1);
24551
+ /** @internal */
24552
+ var optional$4 = /*#__PURE__*/ memoize((ast) => optionalKey$1(new Union$1([ast, undefined_], "anyOf")));
24446
24553
  /** @internal */
24447
24554
  function withConstructorDefault$1(ast, defaultValue) {
24448
24555
  const constructorDefault = new Link(unknown, new Transformation(withDefault$2(defaultValue), passthrough$1()));
@@ -24554,7 +24661,7 @@ function extractStructuralChecks(checks) {
24554
24661
  * @category transforming
24555
24662
  * @since 4.0.0
24556
24663
  */
24557
- var toType$1 = /*#__PURE__*/ memoize((ast) => {
24664
+ var toType$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
24558
24665
  if (ast.encoding) return toType$1(replaceEncoding(ast, void 0));
24559
24666
  const out = ast;
24560
24667
  const type = out.recur?.(toType$1) ?? out;
@@ -24594,7 +24701,7 @@ var toType$1 = /*#__PURE__*/ memoize((ast) => {
24594
24701
  * @category transforming
24595
24702
  * @since 4.0.0
24596
24703
  */
24597
- var toEncoded$1 = /*#__PURE__*/ memoize((ast) => {
24704
+ var toEncoded$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
24598
24705
  return toType$1(flip(ast));
24599
24706
  });
24600
24707
  function flipEncoding(ast, encoding) {
@@ -24639,15 +24746,17 @@ function containsUndefined(ast) {
24639
24746
  }
24640
24747
  function fromConst(ast, value) {
24641
24748
  const succeed = succeed$1(value);
24642
- return (input) => {
24749
+ return (input, options) => {
24643
24750
  if (input === missing) return missingExit;
24644
- return input === value ? succeed : fail$3(new InvalidType(ast));
24751
+ if (input === value) return succeed;
24752
+ return fail$3(new InvalidType(ast, input, options));
24645
24753
  };
24646
24754
  }
24647
24755
  function fromRefinement(ast, refinement) {
24648
- return (input) => {
24756
+ return (input, options) => {
24649
24757
  if (input === missing) return missingExit;
24650
- return refinement(input) ? sameExit : fail$3(new InvalidType(ast));
24758
+ if (refinement(input)) return sameExit;
24759
+ return fail$3(new InvalidType(ast, input, options));
24651
24760
  };
24652
24761
  }
24653
24762
  function segmentTemplateLiteralParts(ast, input, options) {
@@ -24697,7 +24806,7 @@ function segmentTemplateLiteralParts(ast, input, options) {
24697
24806
  }
24698
24807
  return go(0, 0) ? out : void 0;
24699
24808
  }
24700
- var parameterFromPropertyKey = /*#__PURE__*/ applyToSelfOrLastLinkEncoding((ast) => {
24809
+ var parameterFromPropertyKey = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
24701
24810
  switch (ast._tag) {
24702
24811
  default: return ast;
24703
24812
  case "Number": return ast.toCodecStringTree();
@@ -24705,7 +24814,7 @@ var parameterFromPropertyKey = /*#__PURE__*/ applyToSelfOrLastLinkEncoding((ast)
24705
24814
  }
24706
24815
  });
24707
24816
  /** @internal */
24708
- var parameterFromString = /*#__PURE__*/ applyToSelfOrLastLinkEncoding((ast) => {
24817
+ var parameterFromString = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
24709
24818
  switch (ast._tag) {
24710
24819
  default: return ast;
24711
24820
  case "Symbol":
@@ -24713,7 +24822,7 @@ var parameterFromString = /*#__PURE__*/ applyToSelfOrLastLinkEncoding((ast) => {
24713
24822
  case "Union": return ast.recur(parameterFromString);
24714
24823
  }
24715
24824
  });
24716
- var partFromString = /*#__PURE__*/ applyToSelfOrLastLinkEncoding((ast) => {
24825
+ var partFromString = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
24717
24826
  switch (ast._tag) {
24718
24827
  default: return ast;
24719
24828
  case "Number":
@@ -24768,7 +24877,7 @@ function collectIssues(checks, value, issues, ast, options) {
24768
24877
  } else {
24769
24878
  const issue = check.run(value, ast, options);
24770
24879
  if (issue) {
24771
- const filter = new Filter$1(check, issue);
24880
+ const filter = new Filter$1(check, issue, value, options);
24772
24881
  if (issues) issues.push(filter);
24773
24882
  else issues = [filter];
24774
24883
  if (options.errors !== "all" || check.aborted) return issues;
@@ -24853,7 +24962,7 @@ function isJson(u) {
24853
24962
  return isTree(u, isJsonLeaf);
24854
24963
  }
24855
24964
  /** @internal */
24856
- var Json$1 = /*#__PURE__*/ new Declaration([], () => (input, ast) => isJson(input) ? sameExit : fail$3(new InvalidType(ast)), {
24965
+ var Json$1 = /*#__PURE__*/ new Declaration([], () => (input, ast, options) => isJson(input) ? sameExit : fail$3(new InvalidType(ast, input, options)), {
24857
24966
  representation: {
24858
24967
  id: "effect/schema/Json",
24859
24968
  payload: null
@@ -24883,12 +24992,12 @@ function isStringTree(u) {
24883
24992
  return isTree(u, isStringTreeLeaf);
24884
24993
  }
24885
24994
  /** @internal */
24886
- var unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declaration([], () => (input, ast) => isStringTree(input) ? sameExit : fail$3(new InvalidType(ast)), {
24995
+ var unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declaration([], () => (input, ast, options) => isStringTree(input) ? sameExit : fail$3(new InvalidType(ast, input, options)), {
24887
24996
  expected: "StringTree",
24888
24997
  toCodecStringTree: () => void 0
24889
24998
  }), /*#__PURE__*/ passthrough());
24890
24999
  //#endregion
24891
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Brand.js
25000
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Brand.js
24892
25001
  /**
24893
25002
  * Returns a `Constructor` that **does not apply any runtime checks** and just
24894
25003
  * returns the provided value.
@@ -24912,7 +25021,7 @@ function nominal() {
24912
25021
  });
24913
25022
  }
24914
25023
  //#endregion
24915
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/process/ChildProcessSpawner.js
25024
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/process/ChildProcessSpawner.js
24916
25025
  /**
24917
25026
  * Service boundary for starting and controlling child processes.
24918
25027
  *
@@ -24984,7 +25093,7 @@ var make$31 = (spawn) => {
24984
25093
  */
24985
25094
  var ChildProcessSpawner = class extends Service$1()("effect/process/ChildProcessSpawner") {};
24986
25095
  //#endregion
24987
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/process/ChildProcess.js
25096
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/process/ChildProcess.js
24988
25097
  /**
24989
25098
  * Describes child processes before they are started.
24990
25099
  *
@@ -25192,7 +25301,7 @@ var concatTokens = (prevTokens, nextTokens, isSeparated) => isSeparated || prevT
25192
25301
  ...nextTokens.slice(1)
25193
25302
  ];
25194
25303
  //#endregion
25195
- //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.105_effect@4.0.0-beta.104/node_modules/@effect/platform-node-shared/dist/internal/utils.js
25304
+ //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.106_effect@4.0.0-beta.106/node_modules/@effect/platform-node-shared/dist/internal/utils.js
25196
25305
  /** @internal */
25197
25306
  var handleErrnoException = (module, method) => (err, [path]) => {
25198
25307
  let reason = "Unknown";
@@ -25227,7 +25336,7 @@ var handleErrnoException = (module, method) => (err, [path]) => {
25227
25336
  });
25228
25337
  };
25229
25338
  //#endregion
25230
- //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.105_effect@4.0.0-beta.104/node_modules/@effect/platform-node-shared/dist/NodeSink.js
25339
+ //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.106_effect@4.0.0-beta.106/node_modules/@effect/platform-node-shared/dist/NodeSink.js
25231
25340
  /**
25232
25341
  * Creates a `Sink` that writes chunks to a Node writable stream, respecting
25233
25342
  * backpressure, mapping writable errors with `onError`, and ending the stream
@@ -25292,7 +25401,7 @@ var pullIntoWritable = (options) => options.pull.pipe(flatMap$1((chunk) => {
25292
25401
  });
25293
25402
  }) : identity);
25294
25403
  //#endregion
25295
- //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.105_effect@4.0.0-beta.104/node_modules/@effect/platform-node-shared/dist/NodeStream.js
25404
+ //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.106_effect@4.0.0-beta.106/node_modules/@effect/platform-node-shared/dist/NodeStream.js
25296
25405
  /**
25297
25406
  * Adapters between Node streams and Effect streams, channels, and readables.
25298
25407
  *
@@ -25372,7 +25481,7 @@ var readableToPullUnsafe = (options) => {
25372
25481
  };
25373
25482
  var defaultOnError = (error) => new UnknownError$1(error);
25374
25483
  //#endregion
25375
- //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.105_effect@4.0.0-beta.104/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
25484
+ //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.106_effect@4.0.0-beta.106/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
25376
25485
  var toError = (error) => error instanceof globalThis.Error ? error : new globalThis.Error(String(error));
25377
25486
  var toPlatformError = (method, error, command) => {
25378
25487
  const { commands } = flattenCommand(command);
@@ -25770,7 +25879,7 @@ var flattenCommand = (command) => {
25770
25879
  };
25771
25880
  };
25772
25881
  //#endregion
25773
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Ref.js
25882
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Ref.js
25774
25883
  /**
25775
25884
  * Stores fiber-safe mutable state inside Effect programs.
25776
25885
  *
@@ -25879,66 +25988,7 @@ var make$28 = (value) => sync(() => makeUnsafe(value));
25879
25988
  */
25880
25989
  var updateAndGet = /*#__PURE__*/ dual(2, (self, f) => sync(() => self.ref.current = f(self.ref.current)));
25881
25990
  //#endregion
25882
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/SchemaError.js
25883
- /**
25884
- * @since 4.0.0
25885
- */
25886
- var TypeId$27 = "~effect/SchemaError/SchemaError";
25887
- /**
25888
- * Error thrown (or returned as the error channel value) when schema decoding
25889
- * or encoding fails.
25890
- *
25891
- * **Details**
25892
- *
25893
- * The `issue` field contains a structured {@link Issue} tree describing
25894
- * every validation failure, including the path to the problematic value and
25895
- * the expected type or constraint. Built-in issues have no `actual` field,
25896
- * and built-in messages do not include the rejected value. Other Issue fields
25897
- * and custom annotations or messages are not sanitized. `message` renders the
25898
- * issue tree as a human-readable string.
25899
- *
25900
- * Use {@link isSchemaError} to narrow an unknown value to `SchemaError`.
25901
- *
25902
- * **Example** (Catching a SchemaError)
25903
- *
25904
- * ```ts import.meta.vitest
25905
- * import { Schema } from "effect"
25906
- *
25907
- * try {
25908
- * Schema.decodeUnknownSync(Schema.Number)("not a number")
25909
- * } catch (err) {
25910
- * if (Schema.isSchemaError(err)) {
25911
- * err.message // => "Expected number"
25912
- * }
25913
- * }
25914
- * ```
25915
- *
25916
- * @category errors
25917
- * @since 4.0.0
25918
- */
25919
- var SchemaError = class extends TaggedError$1("SchemaError") {
25920
- [TypeId$27] = TypeId$27;
25921
- constructor(issue) {
25922
- super({ issue });
25923
- }
25924
- get message() {
25925
- return this.issue.toString();
25926
- }
25927
- toString() {
25928
- return `SchemaError(${this.message})`;
25929
- }
25930
- };
25931
- /**
25932
- * Returns `true` if `u` is a {@link SchemaError}.
25933
- *
25934
- * @category guards
25935
- * @since 4.0.0
25936
- */
25937
- function isSchemaError(u) {
25938
- return hasProperty(u, TypeId$27) && u[TypeId$27] === TypeId$27;
25939
- }
25940
- //#endregion
25941
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/SchemaParser.js
25991
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/SchemaParser.js
25942
25992
  /**
25943
25993
  * Runs schemas against real values.
25944
25994
  *
@@ -26016,6 +26066,9 @@ function makeOption(schema) {
26016
26066
  *
26017
26067
  * The returned function constructs a value from constructor input and throws an
26018
26068
  * `Error` with the `SchemaIssue.Issue` in its `cause` when construction fails.
26069
+ * Schema validation failures use the generic message `"Schema validation failed"`.
26070
+ * Format the `cause` explicitly with `SchemaIssue.makeFormatterDefault()` when
26071
+ * human-readable details are needed.
26019
26072
  *
26020
26073
  * **Gotchas**
26021
26074
  *
@@ -26032,7 +26085,7 @@ function make$27(schema) {
26032
26085
  const exit = runSyncExit(parser(input, options));
26033
26086
  if (isSuccess(exit)) return exit.value;
26034
26087
  const issue = getSchemaIssueOrThrow(exit.cause, "Constructor adapter can only throw schema issues");
26035
- throw new Error(issue.toString(), { cause: issue });
26088
+ throw new Error("Schema validation failed", { cause: issue });
26036
26089
  };
26037
26090
  }
26038
26091
  /**
@@ -26201,13 +26254,13 @@ function makeParser$1(ast, compile, compileConstructorDefault, constructorDefaul
26201
26254
  const output = result === sameExit ? input : result[args];
26202
26255
  if (input !== missing && output !== missing) {
26203
26256
  const issues = collectIssues(encodingChecks, input, void 0, ast, options);
26204
- if (issues) result = fail$3(new Composite(ast, issues));
26257
+ if (issues) result = fail$3(new Composite(ast, issues, input, options));
26205
26258
  }
26206
26259
  }
26207
26260
  } else result = flatMap$1(result, (value) => {
26208
26261
  if (input !== missing && value !== missing) {
26209
26262
  const issues = collectIssues(encodingChecks, input, void 0, ast, options);
26210
- if (issues) return fail$3(new Composite(ast, issues));
26263
+ if (issues) return fail$3(new Composite(ast, issues, input, options));
26211
26264
  }
26212
26265
  return succeed$4(value);
26213
26266
  });
@@ -26216,12 +26269,12 @@ function makeParser$1(ast, compile, compileConstructorDefault, constructorDefaul
26216
26269
  const value = result === sameExit ? input : result[args];
26217
26270
  if (value === missing) return result;
26218
26271
  const issues = collectIssues(checks, value, void 0, ast, options);
26219
- if (issues) result = fail$3(new Composite(ast, issues));
26272
+ if (issues) result = fail$3(new Composite(ast, issues, value, options));
26220
26273
  }
26221
26274
  } else result = flatMap$1(result, (value) => {
26222
26275
  if (value !== missing) {
26223
26276
  const issues = collectIssues(checks, value, void 0, ast, options);
26224
- if (issues) return fail$3(new Composite(ast, issues));
26277
+ if (issues) return fail$3(new Composite(ast, issues, value, options));
26225
26278
  }
26226
26279
  return succeed$4(value);
26227
26280
  });
@@ -26251,7 +26304,7 @@ function makeParser$1(ast, compile, compileConstructorDefault, constructorDefaul
26251
26304
  const local = parseLocal(value, options);
26252
26305
  return local === sameExit ? result : local;
26253
26306
  }
26254
- result = catchCause$1(result, (cause) => failCauseSync(() => map$8(cause, (issue) => new Encoding(ast, issue))));
26307
+ result = catchCause$1(result, (cause) => failCauseSync(() => map$8(cause, (issue) => new Encoding(ast, issue, input, options))));
26255
26308
  return flatMapEager(result, (value) => {
26256
26309
  const local = parseLocal(value, options);
26257
26310
  return local === sameExit ? succeed$1(value) : local;
@@ -26259,11 +26312,11 @@ function makeParser$1(ast, compile, compileConstructorDefault, constructorDefaul
26259
26312
  };
26260
26313
  }
26261
26314
  //#endregion
26262
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/schema/schema.js
26315
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/schema/schema.js
26263
26316
  /** @internal */
26264
- var TypeId$26 = "~effect/Schema/Schema";
26317
+ var TypeId$27 = "~effect/Schema/Schema";
26265
26318
  var SchemaProto = {
26266
- [TypeId$26]: TypeId$26,
26319
+ [TypeId$27]: TypeId$27,
26267
26320
  pipe() {
26268
26321
  return pipeArguments(this, arguments);
26269
26322
  },
@@ -26283,18 +26336,13 @@ function make$26(ast, options) {
26283
26336
  const self = Object.defineProperties(Object.setPrototypeOf(Schema, SchemaProto), Object.getOwnPropertyDescriptors({ ...options }));
26284
26337
  self.ast = ast;
26285
26338
  self.rebuild = (ast) => make$26(ast, options);
26286
- const makeEffect$1 = makeEffect(self);
26287
- self.makeEffect = (input, options) => fromIssueEffect(makeEffect$1(input, options));
26339
+ self.makeEffect = makeEffect(self);
26288
26340
  self.make = make$27(self);
26289
26341
  self.makeOption = makeOption(self);
26290
26342
  return self;
26291
26343
  }
26292
- /** @internal */
26293
- function fromIssueEffect(self) {
26294
- return catchCause$1(self, (cause) => failCauseSync(() => map$8(cause, (issue) => new SchemaError(issue))));
26295
- }
26296
26344
  //#endregion
26297
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Struct.js
26345
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Struct.js
26298
26346
  /**
26299
26347
  * Wraps a plain function as a {@link Lambda} value so it can be used with
26300
26348
  * {@link map}, {@link mapPick}, and {@link mapOmit}.
@@ -26333,14 +26381,14 @@ function fromIssueEffect(self) {
26333
26381
  */
26334
26382
  var lambda = (f) => f;
26335
26383
  //#endregion
26336
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/errors.js
26384
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/errors.js
26337
26385
  /** @internal */
26338
26386
  function errorWithPath(message, path) {
26339
26387
  if (path.length > 0) message += `\n at ${formatPath(path)}`;
26340
26388
  return new Error(message);
26341
26389
  }
26342
26390
  //#endregion
26343
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/JsonPointer.js
26391
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/JsonPointer.js
26344
26392
  /**
26345
26393
  * Helpers for escaping and unescaping JSON Pointer path segments. JSON Pointer
26346
26394
  * uses `/` to separate path tokens inside a JSON document, so token text must
@@ -26384,6 +26432,109 @@ function errorWithPath(message, path) {
26384
26432
  function escapeToken(token) {
26385
26433
  return token.replace(/~/g, "~0").replace(/\//g, "~1");
26386
26434
  }
26435
+ /**
26436
+ * Decodes a JSON Pointer reference token according to RFC 6901 escaping rules.
26437
+ *
26438
+ * **When to use**
26439
+ *
26440
+ * Use when you need to decode a single escaped JSON Pointer path segment.
26441
+ *
26442
+ * **Details**
26443
+ *
26444
+ * - Returns a new unescaped string
26445
+ * - Replaces `~1` with `/` (forward slash) and `~0` with `~` (tilde)
26446
+ * - Returns the input unchanged if it contains no escaped sequences
26447
+ * - Empty strings are valid and returned unchanged
26448
+ *
26449
+ * **Gotchas**
26450
+ *
26451
+ * The replacement order matters: `~1` is replaced before `~0` to prevent incorrect decoding.
26452
+ *
26453
+ * **Example** (Unescaping special characters)
26454
+ *
26455
+ * ```ts import.meta.vitest
26456
+ * import { JsonPointer } from "effect"
26457
+ *
26458
+ * JsonPointer.unescapeToken("a~1b") // => "a/b"
26459
+ * JsonPointer.unescapeToken("c~0d") // => "c~d"
26460
+ * JsonPointer.unescapeToken("path~1to~0key") // => "path/to~key"
26461
+ * ```
26462
+ *
26463
+ * @see {@link escapeToken} The inverse operation for encoding tokens
26464
+ * @category decoding
26465
+ * @since 4.0.0
26466
+ */
26467
+ function unescapeToken(token) {
26468
+ return token.replace(/~1/g, "/").replace(/~0/g, "~");
26469
+ }
26470
+ [.../* @__PURE__ */ new Set([
26471
+ "$ref",
26472
+ "type",
26473
+ "required",
26474
+ "enum",
26475
+ "title",
26476
+ "description",
26477
+ "default",
26478
+ "format",
26479
+ "pattern",
26480
+ "minLength",
26481
+ "maxLength",
26482
+ "minItems",
26483
+ "maxItems",
26484
+ "minProperties",
26485
+ "maxProperties",
26486
+ "multipleOf",
26487
+ "uniqueItems"
26488
+ ])];
26489
+ function transformSchema(node, transform) {
26490
+ return walk(node);
26491
+ function walk(node) {
26492
+ if (!isObject(node)) return node;
26493
+ const out = {};
26494
+ for (const key of Object.keys(node)) {
26495
+ const value = node[key];
26496
+ let transformed = value;
26497
+ switch (key) {
26498
+ case "$defs":
26499
+ case "properties":
26500
+ case "patternProperties":
26501
+ case "dependentSchemas":
26502
+ transformed = mapObject(value, walk) ?? value;
26503
+ break;
26504
+ case "allOf":
26505
+ case "anyOf":
26506
+ case "oneOf":
26507
+ case "prefixItems":
26508
+ transformed = Array.isArray(value) ? value.map(walk) : value;
26509
+ break;
26510
+ case "not":
26511
+ case "additionalProperties":
26512
+ case "propertyNames":
26513
+ case "unevaluatedProperties":
26514
+ case "items":
26515
+ case "contains":
26516
+ case "unevaluatedItems":
26517
+ case "if":
26518
+ case "then":
26519
+ case "else":
26520
+ case "contentSchema": transformed = walk(value);
26521
+ }
26522
+ assignProperty(out, key, transformed);
26523
+ }
26524
+ return transform(out);
26525
+ }
26526
+ }
26527
+ /** @internal */
26528
+ function rewriteRefs(schema, rewrite) {
26529
+ return transformSchema(schema, (schema) => rewriteSchemaRef(schema, rewrite));
26530
+ }
26531
+ function rewriteSchemaRef(schema, rewrite) {
26532
+ if (typeof schema.$ref === "string") assignProperty(schema, "$ref", rewrite(schema.$ref));
26533
+ return schema;
26534
+ }
26535
+ function mapObject(value, f) {
26536
+ return isObject(value) ? map$11(value, f) : void 0;
26537
+ }
26387
26538
  globalThis.RegExp;
26388
26539
  /**
26389
26540
  * Escapes special characters in a regular expression pattern.
@@ -26405,12 +26556,14 @@ globalThis.RegExp;
26405
26556
  */
26406
26557
  var escape = (string) => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
26407
26558
  //#endregion
26408
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
26559
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
26409
26560
  var jsonSchemaAnnotationExcludedKeys = /*#__PURE__*/ new Set([
26410
26561
  ...annotationExcludedKeys,
26411
26562
  IDENTIFIER_FALLBACK_KEY,
26412
26563
  ...jsonSchemaAnnotationKeys
26413
26564
  ]);
26565
+ /** @internal */
26566
+ var toRepresentationOptions = { isAnonymousReferenceAllowed: (ast) => !isDeclaration(ast) };
26414
26567
  function collectJsonSchemaAnnotations(annotations, options) {
26415
26568
  if (annotations === void 0) return void 0;
26416
26569
  const out = {};
@@ -26506,19 +26659,21 @@ function appendJsonSchema(left, right) {
26506
26659
  };
26507
26660
  }
26508
26661
  function compileJsonSchema(representations, rootPaths, references, options) {
26509
- const definitions = {};
26510
26662
  const definitionStates = /* @__PURE__ */ new Map();
26511
26663
  const compiledRepresentations = /* @__PURE__ */ new WeakMap();
26512
26664
  const fallbackDefinitions = /* @__PURE__ */ new Map();
26665
+ let hasAliases = false;
26513
26666
  const referenceKeys = Object.keys(references);
26514
26667
  for (const key of referenceKeys) compileDefinition(key, ["references", key]);
26668
+ const schemas = map$10(representations, (representation, index) => finalizeJsonSchema(recur(representation, rootPaths[index])));
26669
+ const definitions = {};
26515
26670
  for (const key of referenceKeys) {
26516
26671
  const compiled = definitionStates.get(key);
26517
- if (typeof compiled !== "string") assignProperty(definitions, key, compiled);
26672
+ if (typeof compiled !== "string") assignProperty(definitions, key, finalizeJsonSchema(compiled));
26518
26673
  }
26519
26674
  return {
26520
26675
  dialect: "draft-2020-12",
26521
- schemas: map$10(representations, (representation, index) => recur(representation, rootPaths[index])),
26676
+ schemas,
26522
26677
  definitions
26523
26678
  };
26524
26679
  function compileDefinition(key, path) {
@@ -26535,6 +26690,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
26535
26690
  if (match === void 0) if (candidates === void 0) fallbackDefinitions.set(fallback, [key]);
26536
26691
  else candidates.push(key);
26537
26692
  else {
26693
+ hasAliases = true;
26538
26694
  definitionStates.set(key, match);
26539
26695
  return match;
26540
26696
  }
@@ -26542,6 +26698,13 @@ function compileJsonSchema(representations, rootPaths, references, options) {
26542
26698
  definitionStates.set(key, schema);
26543
26699
  return key;
26544
26700
  }
26701
+ function finalizeJsonSchema(schema) {
26702
+ if (!hasAliases) return schema;
26703
+ return rewriteRefs(schema, ($ref) => $ref.replace(/^#\/\$defs\/([^/]*)/, (match, token) => {
26704
+ const canonical = definitionStates.get(unescapeToken(token));
26705
+ return typeof canonical === "string" ? `#/$defs/${escapeToken(canonical)}` : match;
26706
+ }));
26707
+ }
26545
26708
  function getIdentifierFallback(representation) {
26546
26709
  if (representation._tag === "Reference") return void 0;
26547
26710
  const annotations = representation.checks.length === 0 ? representation.annotations : representation.checks[representation.checks.length - 1].annotations;
@@ -26838,24 +27001,46 @@ function toJsonSchemaDocument$1(document, options) {
26838
27001
  };
26839
27002
  }
26840
27003
  //#endregion
26841
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/schema/toRepresentation.js
27004
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/schema/toRepresentation.js
26842
27005
  /** @internal */
26843
- function toRepresentation(ast) {
26844
- const { references, representations } = toRepresentations([ast]);
27006
+ function toRepresentation(ast, options) {
27007
+ const { references, representations } = toRepresentations([ast], options);
26845
27008
  return {
26846
27009
  representation: representations[0],
26847
27010
  references
26848
27011
  };
26849
27012
  }
26850
27013
  /** @internal */
26851
- function toRepresentations(asts) {
26852
- return fromASTs(asts);
27014
+ function toRepresentations(asts, options) {
27015
+ return fromASTs(asts, options);
26853
27016
  }
26854
27017
  function annotationsField(annotations) {
26855
27018
  return annotations === void 0 ? void 0 : { annotations };
26856
27019
  }
26857
- function isShareable(ast) {
26858
- return isArrays(ast) || isObjects(ast) || isUnion(ast) && ast.types.some(isShareable);
27020
+ function hasShareableStructure(ast, isAnonymousReferenceAllowed) {
27021
+ if (isAnonymousReferenceAllowed?.(ast) === false) return false;
27022
+ switch (ast._tag) {
27023
+ case "Arrays":
27024
+ case "Objects":
27025
+ case "Suspend": return true;
27026
+ case "Declaration": return true;
27027
+ case "Union": return ast.types.some((ast) => hasShareableStructure(ast, isAnonymousReferenceAllowed));
27028
+ default: return false;
27029
+ }
27030
+ }
27031
+ function isWorthReferencing(bodyCost, occurrences) {
27032
+ return occurrences * bodyCost > bodyCost + occurrences + 1;
27033
+ }
27034
+ function isAnonymousReferenceEligible(ast, occurrences, isAnonymousReferenceAllowed) {
27035
+ if (isAnonymousReferenceAllowed?.(ast) === false) return false;
27036
+ if (hasShareableStructure(ast, isAnonymousReferenceAllowed)) return true;
27037
+ switch (ast._tag) {
27038
+ case "Union": return isWorthReferencing(ast.types.length + 1, occurrences);
27039
+ case "Enum": return isWorthReferencing(ast.enums.length + 1, occurrences);
27040
+ case "TemplateLiteral": return isWorthReferencing(ast.parts.length + 1, occurrences);
27041
+ case "Literal": return typeof ast.literal === "string" && isWorthReferencing(ast.literal.length / 32 + 1, occurrences);
27042
+ default: return false;
27043
+ }
26859
27044
  }
26860
27045
  function resolveReferenceIdentifier(input, encoded) {
26861
27046
  const identifier = resolveIdentifier(encoded);
@@ -26866,16 +27051,13 @@ function resolveReferenceIdentifier(input, encoded) {
26866
27051
  fallback
26867
27052
  };
26868
27053
  }
26869
- function fromASTs(asts) {
27054
+ function fromASTs(asts, options) {
26870
27055
  const references = {};
26871
27056
  const anonymousReferences = /* @__PURE__ */ new Map();
26872
27057
  const referenceOwners = /* @__PURE__ */ new Map();
26873
- const valueIds = /* @__PURE__ */ new Map();
26874
- const canonicalByKey = /* @__PURE__ */ new Map();
26875
- let nextValueId = 0;
26876
27058
  const buildingReferences = /* @__PURE__ */ new Set();
26877
27059
  const visiting = /* @__PURE__ */ new Set();
26878
- const visited = /* @__PURE__ */ new Set();
27060
+ const occurrences = /* @__PURE__ */ new Map();
26879
27061
  const shared = /* @__PURE__ */ new Set();
26880
27062
  for (const ast of asts) visit(ast);
26881
27063
  return {
@@ -26892,28 +27074,6 @@ function fromASTs(asts) {
26892
27074
  referenceOwners.set(candidate, owner);
26893
27075
  return candidate;
26894
27076
  }
26895
- function getValueId(value) {
26896
- if (typeof value === "number" && globalThis.Number.isNaN(value)) return nextValueId++;
26897
- const found = valueIds.get(value);
26898
- if (found !== void 0) return found;
26899
- const id = nextValueId++;
26900
- valueIds.set(value, id);
26901
- return id;
26902
- }
26903
- function getIdentityKey(ast) {
26904
- let identity = ast._tag;
26905
- for (const [key, value] of Object.entries(ast)) if (key !== "_tag" && key !== "context") identity += `:${getValueId(value)}`;
26906
- return identity;
26907
- }
26908
- function getCanonicalAST(ast) {
26909
- const key = getIdentityKey(ast);
26910
- const canonical = canonicalByKey.get(key);
26911
- if (canonical === void 0) {
26912
- canonicalByKey.set(key, ast);
26913
- return ast;
26914
- }
26915
- return canonical;
26916
- }
26917
27077
  function annotateReference(ast, referenceIdentifier, reference) {
26918
27078
  const fallback = referenceIdentifier.fallback;
26919
27079
  if (fallback !== void 0) return resolveIdentifierFallback(ast) === fallback ? ast : annotate$1(ast, { [IDENTIFIER_FALLBACK_KEY]: fallback });
@@ -26933,12 +27093,13 @@ function fromASTs(asts) {
26933
27093
  }
26934
27094
  function visit(input) {
26935
27095
  const ast = getLastEncoding(input);
26936
- const owner = getCanonicalAST(ast);
26937
- if (visited.has(owner)) {
26938
- if (isShareable(ast)) shared.add(owner);
27096
+ const owner = getContextOwner(ast);
27097
+ const count = (occurrences.get(owner) ?? 0) + 1;
27098
+ occurrences.set(owner, count);
27099
+ if (count > 1) {
27100
+ if (!shared.has(owner) && isAnonymousReferenceEligible(owner, count, options?.isAnonymousReferenceAllowed)) shared.add(owner);
26939
27101
  return;
26940
27102
  }
26941
- visited.add(owner);
26942
27103
  visitChecks(ast.checks);
26943
27104
  switch (ast._tag) {
26944
27105
  case "Declaration":
@@ -26964,7 +27125,7 @@ function fromASTs(asts) {
26964
27125
  }
26965
27126
  function recur(input) {
26966
27127
  const ast = getLastEncoding(input);
26967
- const owner = getCanonicalAST(ast);
27128
+ const owner = getContextOwner(ast);
26968
27129
  const referenceIdentifier = resolveReferenceIdentifier(input, ast);
26969
27130
  if (referenceIdentifier !== void 0) {
26970
27131
  const reference = getReference(referenceIdentifier.identifier, owner);
@@ -27135,7 +27296,7 @@ function fromASTs(asts) {
27135
27296
  }
27136
27297
  }
27137
27298
  //#endregion
27138
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/internal/redacted.js
27299
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/internal/redacted.js
27139
27300
  /** @internal */
27140
27301
  var redactedRegistry = /*#__PURE__*/ new WeakMap();
27141
27302
  /** @internal */
@@ -27144,7 +27305,7 @@ var value$1 = (self) => {
27144
27305
  else throw new Error("Unable to get redacted value" + (self.label ? ` with label: "${self.label}"` : ""));
27145
27306
  };
27146
27307
  //#endregion
27147
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Redacted.js
27308
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Redacted.js
27148
27309
  /**
27149
27310
  * Wraps sensitive values so normal output does not reveal them.
27150
27311
  *
@@ -27157,7 +27318,7 @@ var value$1 = (self) => {
27157
27318
  *
27158
27319
  * @since 3.3.0
27159
27320
  */
27160
- var TypeId$25 = "~effect/data/Redacted";
27321
+ var TypeId$26 = "~effect/data/Redacted";
27161
27322
  /**
27162
27323
  * Returns `true` if a value is a `Redacted` wrapper.
27163
27324
  *
@@ -27185,7 +27346,7 @@ var TypeId$25 = "~effect/data/Redacted";
27185
27346
  * @category guards
27186
27347
  * @since 3.3.0
27187
27348
  */
27188
- var isRedacted = (u) => hasProperty(u, TypeId$25);
27349
+ var isRedacted = (u) => hasProperty(u, TypeId$26);
27189
27350
  /**
27190
27351
  * Creates a `Redacted` wrapper for a sensitive value.
27191
27352
  *
@@ -27219,7 +27380,7 @@ var make$25 = (value, options) => {
27219
27380
  return self;
27220
27381
  };
27221
27382
  var Proto$13 = {
27222
- [TypeId$25]: { _A: (_) => _ },
27383
+ [TypeId$26]: { _A: (_) => _ },
27223
27384
  label: void 0,
27224
27385
  ...PipeInspectableProto,
27225
27386
  toJSON() {
@@ -27287,8 +27448,67 @@ var value = value$1;
27287
27448
  */
27288
27449
  var makeEquivalence = (isEquivalent) => make$50((x, y) => isEquivalent(value(x), value(y)));
27289
27450
  //#endregion
27290
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Schema.js
27291
- var TypeId$24 = TypeId$26;
27451
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/SchemaError.js
27452
+ /**
27453
+ * @since 4.0.0
27454
+ */
27455
+ var TypeId$25 = "~effect/SchemaError/SchemaError";
27456
+ /**
27457
+ * Error thrown (or returned as the error channel value) when schema decoding
27458
+ * or encoding fails.
27459
+ *
27460
+ * **Details**
27461
+ *
27462
+ * The `issue` field contains a structured {@link SchemaIssue.Issue} tree describing
27463
+ * every validation failure, including the path to the problematic value and
27464
+ * the expected type or constraint. The `message` field renders the issue tree
27465
+ * with the default formatter. When input reporting is enabled, the message may
27466
+ * include reported input. Other Issue fields and custom annotations or messages
27467
+ * are not sanitized.
27468
+ *
27469
+ * Use {@link isSchemaError} to narrow an unknown value to `SchemaError`.
27470
+ *
27471
+ * **Example** (Catching a SchemaError)
27472
+ *
27473
+ * ```ts import.meta.vitest
27474
+ * import { Schema } from "effect"
27475
+ *
27476
+ * try {
27477
+ * Schema.decodeUnknownSync(Schema.Number)("not a number")
27478
+ * } catch (err) {
27479
+ * if (Schema.isSchemaError(err)) {
27480
+ * err.message // => "Expected number"
27481
+ * }
27482
+ * }
27483
+ * ```
27484
+ *
27485
+ * @category errors
27486
+ * @since 4.0.0
27487
+ */
27488
+ var SchemaError = class extends TaggedError$1("SchemaError") {
27489
+ [TypeId$25] = TypeId$25;
27490
+ constructor(issue) {
27491
+ super({ issue });
27492
+ }
27493
+ get message() {
27494
+ return defaultFormatter$1(this.issue);
27495
+ }
27496
+ toString() {
27497
+ return `SchemaError(${this.message})`;
27498
+ }
27499
+ };
27500
+ /**
27501
+ * Returns `true` if `u` is a {@link SchemaError}.
27502
+ *
27503
+ * @category guards
27504
+ * @since 4.0.0
27505
+ */
27506
+ function isSchemaError(u) {
27507
+ return hasProperty(u, TypeId$25) && u[TypeId$25] === TypeId$25;
27508
+ }
27509
+ //#endregion
27510
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Schema.js
27511
+ var TypeId$24 = TypeId$27;
27292
27512
  /**
27293
27513
  * Creates a schema for a **parametric** type (a generic container such as
27294
27514
  * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
@@ -27313,7 +27533,7 @@ var TypeId$24 = TypeId$26;
27313
27533
  * **Example** (Schema for a parametric `Box<A>` type)
27314
27534
  *
27315
27535
  * ```ts import.meta.vitest
27316
- * import { Effect, Schema, SchemaIssue as Issue, SchemaParser } from "effect"
27536
+ * import { Effect, Schema, SchemaIssue, SchemaParser } from "effect"
27317
27537
  *
27318
27538
  * interface Box<A> {
27319
27539
  * readonly value: A
@@ -27328,7 +27548,7 @@ var TypeId$24 = TypeId$26;
27328
27548
  * ([itemCodec]) =>
27329
27549
  * (u, ast, options) => {
27330
27550
  * if (!isBox(u)) {
27331
- * return Effect.fail(new SchemaIssue.InvalidType(ast))
27551
+ * return Effect.fail(new SchemaIssue.InvalidType(ast, u, options))
27332
27552
  * }
27333
27553
  * return Effect.map(
27334
27554
  * SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),
@@ -27382,7 +27602,7 @@ function declareConstructor() {
27382
27602
  * @since 3.10.0
27383
27603
  */
27384
27604
  function declare(is, annotations) {
27385
- return declareConstructor()([], () => (input, ast) => is(input) ? succeed$4(input) : fail$3(new InvalidType(ast)), annotations);
27605
+ return declareConstructor()([], () => (input, ast, options) => is(input) ? succeed$4(input) : fail$3(new InvalidType(ast, input, options)), annotations);
27386
27606
  }
27387
27607
  /**
27388
27608
  * Creates a type guard function that checks if a value conforms to a given
@@ -27449,6 +27669,9 @@ function decodeUnknownEffect(schema, options) {
27449
27669
  return fromIssueEffect(parser(input, options));
27450
27670
  };
27451
27671
  }
27672
+ function fromIssueEffect(self) {
27673
+ return catchCause$1(self, (cause) => failCauseSync(() => map$8(cause, (issue) => new SchemaError(issue))));
27674
+ }
27452
27675
  function getSchemaErrorOrThrow(cause, message) {
27453
27676
  let schemaError;
27454
27677
  for (const reason of cause.reasons) {
@@ -27755,7 +27978,10 @@ var optionalKey = /*#__PURE__*/ lambda((schema) => make$24(optionalKey$1(schema.
27755
27978
  * @category combinators
27756
27979
  * @since 3.10.0
27757
27980
  */
27758
- var optional$3 = /*#__PURE__*/ lambda((self) => optionalKey(UndefinedOr(self)));
27981
+ var optional$3 = /*#__PURE__*/ lambda((self) => {
27982
+ const schema = UndefinedOr(self);
27983
+ return make$24(optional$4(self.ast), { schema });
27984
+ });
27759
27985
  /**
27760
27986
  * Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,
27761
27987
  * discarding the encoding transformation path.
@@ -28217,7 +28443,7 @@ function decodeTo(to, transformation) {
28217
28443
  * ```
28218
28444
  *
28219
28445
  * @category transforming
28220
- * @since 3.10.0
28446
+ * @since 4.0.0
28221
28447
  */
28222
28448
  function decode$1(transformation) {
28223
28449
  return (self) => {
@@ -28230,7 +28456,7 @@ function decode$1(transformation) {
28230
28456
  * **Details**
28231
28457
  *
28232
28458
  * Constructor defaults are applied only during `make*`, not during decoding or
28233
- * encoding.
28459
+ * encoding. Failures are represented directly as `SchemaIssue.Issue` values.
28234
28460
  *
28235
28461
  * **Example** (Defining an optional field with a static default)
28236
28462
  *
@@ -28251,7 +28477,7 @@ function decode$1(transformation) {
28251
28477
  * @since 3.10.0
28252
28478
  */
28253
28479
  function withConstructorDefault(defaultValue) {
28254
- return (schema) => make$24(withConstructorDefault$1(schema.ast, toIssueEffect(defaultValue)), { schema });
28480
+ return (schema) => make$24(withConstructorDefault$1(schema.ast, defaultValue), { schema });
28255
28481
  }
28256
28482
  function toIssueEffect(self) {
28257
28483
  return catchCause$1(self, (cause) => failCauseSync(() => map$8(cause, (error) => error.issue)));
@@ -28655,10 +28881,10 @@ function Redacted(value$3, options) {
28655
28881
  if (isRedacted(input)) return flatMapEager(decodeLabel !== void 0 ? mapErrorEager(decodeLabel(input.label, poptions), (issue) => new Pointer(["label"], issue)) : void_$1, () => mapBothEager(decodeUnknownEffect$1(value$2)(value(input), poptions), {
28656
28882
  onSuccess: () => input,
28657
28883
  onFailure: () => {
28658
- return new Composite(ast, [new Pointer(["value"], new InvalidValue$1())]);
28884
+ return new Composite(ast, [new Pointer(["value"], new InvalidValue$1(void 0, input, poptions))], input, poptions);
28659
28885
  }
28660
28886
  }));
28661
- return fail$3(new InvalidType(ast));
28887
+ return fail$3(new InvalidType(ast, input, poptions));
28662
28888
  }, {
28663
28889
  representation: {
28664
28890
  id: "effect/schema/Redacted",
@@ -28704,15 +28930,15 @@ function Redacted(value$3, options) {
28704
28930
  */
28705
28931
  function CauseReason(error, defect) {
28706
28932
  return make$24(declareConstructor()([error, defect], ([error, defect]) => (input, ast, options) => {
28707
- if (!isReason(input)) return fail$3(new InvalidType(ast));
28933
+ if (!isReason(input)) return fail$3(new InvalidType(ast, input, options));
28708
28934
  switch (input._tag) {
28709
28935
  case "Fail": return mapBothEager(decodeUnknownEffect$1(error)(input.error, options), {
28710
28936
  onSuccess: makeFailReason,
28711
- onFailure: (issue) => new Composite(ast, [new Pointer(["error"], issue)])
28937
+ onFailure: (issue) => makeCompositeAtKey(ast, "error", issue, input, options)
28712
28938
  });
28713
28939
  case "Die": return mapBothEager(decodeUnknownEffect$1(defect)(input.defect, options), {
28714
28940
  onSuccess: makeDieReason,
28715
- onFailure: (issue) => new Composite(ast, [new Pointer(["defect"], issue)])
28941
+ onFailure: (issue) => makeCompositeAtKey(ast, "defect", issue, input, options)
28716
28942
  });
28717
28943
  case "Interrupt": return succeed$4(input);
28718
28944
  }
@@ -28808,10 +29034,10 @@ function Cause(error, defect) {
28808
29034
  return make$24(declareConstructor()([error, defect], ([error, defect]) => {
28809
29035
  const failures = ArraySchema(CauseReason(error, defect));
28810
29036
  return (input, ast, options) => {
28811
- if (!isCause(input)) return fail$3(new InvalidType(ast));
29037
+ if (!isCause(input)) return fail$3(new InvalidType(ast, input, options));
28812
29038
  return mapBothEager(decodeUnknownEffect$1(failures)(input.reasons, options), {
28813
29039
  onSuccess: fromReasons,
28814
- onFailure: (issue) => new Composite(ast, [new Pointer(["failures"], issue)])
29040
+ onFailure: (issue) => makeCompositeAtKey(ast, "failures", issue, input, options)
28815
29041
  });
28816
29042
  };
28817
29043
  }, {
@@ -28933,15 +29159,15 @@ function Exit(value, error, defect) {
28933
29159
  ], ([value, error, defect]) => {
28934
29160
  const cause = Cause(error, defect);
28935
29161
  return (input, ast, options) => {
28936
- if (!isExit(input)) return fail$3(new InvalidType(ast));
29162
+ if (!isExit(input)) return fail$3(new InvalidType(ast, input, options));
28937
29163
  switch (input._tag) {
28938
29164
  case "Success": return mapBothEager(decodeUnknownEffect$1(value)(input.value, options), {
28939
29165
  onSuccess: succeed$6,
28940
- onFailure: (issue) => new Composite(ast, [new Pointer(["value"], issue)])
29166
+ onFailure: (issue) => makeCompositeAtKey(ast, "value", issue, input, options)
28941
29167
  });
28942
29168
  case "Failure": return mapBothEager(decodeUnknownEffect$1(cause)(input.cause, options), {
28943
29169
  onSuccess: failCause$3,
28944
- onFailure: (issue) => new Composite(ast, [new Pointer(["cause"], issue)])
29170
+ onFailure: (issue) => makeCompositeAtKey(ast, "cause", issue, input, options)
28945
29171
  });
28946
29172
  }
28947
29173
  };
@@ -29252,8 +29478,8 @@ function getClassSchemaFactory(from, identifier, annotations) {
29252
29478
  const ClassTypeId = getClassTypeId(identifier);
29253
29479
  const isClassValue = (input) => input instanceof self || hasProperty(input, ClassTypeId);
29254
29480
  const transformation = getClassTransformation(self);
29255
- return memo = decodeTo(make$24(new Declaration([from.ast], () => (input, ast) => {
29256
- return isClassValue(input) ? succeed$4(input) : fail$3(new InvalidType(ast));
29481
+ return memo = decodeTo(make$24(new Declaration([from.ast], () => (input, ast, options) => {
29482
+ return isClassValue(input) ? succeed$4(input) : fail$3(new InvalidType(ast, input, options));
29257
29483
  }, {
29258
29484
  identifier,
29259
29485
  [CONSTRUCTOR_ANNOTATION_KEY]: ([from]) => ({
@@ -29276,8 +29502,8 @@ function isStruct(schema) {
29276
29502
  }
29277
29503
  /**
29278
29504
  * Creates a schema-backed class whose constructor validates input against a
29279
- * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
29280
- * input.
29505
+ * {@link Struct} schema. Construction throws an `Error` with a
29506
+ * `SchemaIssue.Issue` in its `cause` on invalid input.
29281
29507
  *
29282
29508
  * **When to use**
29283
29509
  *
@@ -29436,7 +29662,7 @@ var TaggedError = (identifier) => {
29436
29662
  * @since 4.0.0
29437
29663
  */
29438
29664
  function toJsonSchemaDocument(schema, options) {
29439
- return toJsonSchemaDocument$1(toRepresentation(toCodecJsonAST(schema.ast)), options);
29665
+ return toJsonSchemaDocument$1(toRepresentation(toCodecJsonAST(schema.ast), toRepresentationOptions), options);
29440
29666
  }
29441
29667
  /**
29442
29668
  * Derives a canonical JSON codec from a schema. The encoded form is `Json`, and
@@ -29457,12 +29683,12 @@ function toCodecJson(schema) {
29457
29683
  return make$24(toCodecJsonAST(schema.ast), { schema });
29458
29684
  }
29459
29685
  /** @internal */
29460
- var toCodecJsonAST = /*#__PURE__*/ memoize(/* @__PURE__ */ applyToSelfOrLastLinkEncoding((ast) => {
29461
- const out = toCodecJsonBase(ast, toCodecJsonAST);
29686
+ var toCodecJsonAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
29687
+ const out = toCodecJsonASTStep(ast, toCodecJsonAST);
29462
29688
  const context = ast.context;
29463
29689
  if (out === ast || context === void 0) return out;
29464
29690
  return replaceContextLastLink(out, withoutConstructorDefault(context));
29465
- }));
29691
+ });
29466
29692
  function withoutConstructorDefault(context) {
29467
29693
  return context.constructorDefault === void 0 ? context : new Context(context.isOptional, context.isMutable, void 0, context.annotations);
29468
29694
  }
@@ -29493,7 +29719,7 @@ var toCodecJsonReorder = /*#__PURE__*/ makeReorder((ast) => {
29493
29719
  default: return 1;
29494
29720
  }
29495
29721
  });
29496
- function toCodecJsonBase(ast, recur) {
29722
+ function toCodecJsonASTStep(ast, recur) {
29497
29723
  switch (ast._tag) {
29498
29724
  case "Declaration": {
29499
29725
  const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
@@ -29537,7 +29763,7 @@ function toCodecJsonBase(ast, recur) {
29537
29763
  * @since 4.0.0
29538
29764
  */
29539
29765
  function toCodecStringTree(schema) {
29540
- return make$24(serializerStringTree(schema.ast), { schema });
29766
+ return make$24(toCodecStringTreeAST(schema.ast), { schema });
29541
29767
  }
29542
29768
  var toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
29543
29769
  switch (ast._tag) {
@@ -29550,7 +29776,7 @@ var toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
29550
29776
  default: return 1;
29551
29777
  }
29552
29778
  });
29553
- function serializerTree(ast, recur, onMissingAnnotation) {
29779
+ function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
29554
29780
  switch (ast._tag) {
29555
29781
  case "Declaration": {
29556
29782
  const typeParameters = ast.typeParameters.map((tp) => make$24(recur(toEncoded$1(tp))));
@@ -29591,16 +29817,15 @@ function serializerTree(ast, recur, onMissingAnnotation) {
29591
29817
  }
29592
29818
  var nullToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Literal$1("null"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$2(() => null), /*#__PURE__*/ transform$2(() => "null")));
29593
29819
  var booleanToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Literal$1("true"), /*#__PURE__*/ new Literal$1("false")], "anyOf"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$2((s) => s === "true"), /*#__PURE__*/ String$3()));
29594
- var SERIALIZER_ENSURE_ARRAY = "~effect/Schema/SERIALIZER_ENSURE_ARRAY";
29595
- var isSerializerArrayFromSingle = (ast) => isUnion(ast) && ast.annotations?.[SERIALIZER_ENSURE_ARRAY] === true;
29596
- var serializerStringTree = /*#__PURE__*/ applyToSelfOrLastLinkEncoding((ast) => {
29597
- if (isSerializerArrayFromSingle(ast)) return ast;
29598
- const out = serializerTree(ast, serializerStringTree, (ast) => {
29820
+ var arrayFromSingleTransformation = /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$2((input) => typeof input === "string" ? [input] : input), /*#__PURE__*/ passthrough$1());
29821
+ var isCodecArrayFromSingleLink = (link) => link.transformation === arrayFromSingleTransformation;
29822
+ var toCodecStringTreeAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
29823
+ const out = toCodecStringTreeASTStep(ast, toCodecStringTreeAST, (ast) => {
29599
29824
  throw new globalThis.Error("Missing structural codec for StringTree", { cause: ast });
29600
29825
  });
29601
29826
  if (out !== ast && ast.context !== void 0) return replaceContextLastLink(out, withoutConstructorDefault(ast.context));
29602
29827
  return out;
29603
- });
29828
+ }, { stopAt: isCodecArrayFromSingleLink });
29604
29829
  /**
29605
29830
  * Schema that accepts and validates any immutable JSON-compatible value.
29606
29831
  *
@@ -29631,7 +29856,7 @@ var MutableJson = /*#__PURE__*/ make$24(/*#__PURE__*/ annotate$1(MutableJson$1,
29631
29856
  Type: "Schema.MutableJson"
29632
29857
  }) }));
29633
29858
  //#endregion
29634
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/Cookies.js
29859
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/Cookies.js
29635
29860
  /**
29636
29861
  * Models HTTP cookies and cookie collections for requests and responses.
29637
29862
  *
@@ -29689,7 +29914,7 @@ var fromIterable = (cookies) => {
29689
29914
  var empty$3 = /*#__PURE__*/ fromIterable([]);
29690
29915
  ({ ...BaseProto });
29691
29916
  //#endregion
29692
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/Headers.js
29917
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/Headers.js
29693
29918
  /**
29694
29919
  * Models HTTP headers for the unstable HTTP client and server modules.
29695
29920
  *
@@ -29872,7 +30097,7 @@ var CurrentRedactedNames = /*#__PURE__*/ Reference("effect/Headers/CurrentRedact
29872
30097
  ] });
29873
30098
  ({ ...PipeInspectableProto });
29874
30099
  //#endregion
29875
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/HttpBody.js
30100
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/HttpBody.js
29876
30101
  /**
29877
30102
  * Describes HTTP request and response bodies before they reach a platform
29878
30103
  * adapter.
@@ -29927,7 +30152,7 @@ var Empty$1 = class extends Proto$9 {
29927
30152
  */
29928
30153
  var empty$1 = /*#__PURE__*/ new Empty$1();
29929
30154
  //#endregion
29930
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/HttpClientError.js
30155
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/HttpClientError.js
29931
30156
  /**
29932
30157
  * Typed failure model for Effect HTTP client operations.
29933
30158
  *
@@ -29960,7 +30185,7 @@ Error$1(TypeId$19)({
29960
30185
  cause: /*#__PURE__*/ optional$3(/*#__PURE__*/ Defect())
29961
30186
  });
29962
30187
  //#endregion
29963
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/FindMyWay/internal/queryString.js
30188
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/FindMyWay/internal/queryString.js
29964
30189
  /**
29965
30190
  * @since 1.0.0
29966
30191
  */
@@ -30025,7 +30250,7 @@ function parse$2(input) {
30025
30250
  return result;
30026
30251
  }
30027
30252
  //#endregion
30028
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/FindMyWay/internal/router.js
30253
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/FindMyWay/internal/router.js
30029
30254
  var FULL_PATH_REGEXP = /^https?:\/\/.*?\//;
30030
30255
  var OPTIONAL_PARAM_REGEXP = /(\/:[^/()]*?)\?(\/?)/;
30031
30256
  /** @internal */
@@ -30574,7 +30799,7 @@ var httpMethods = [
30574
30799
  "UNSUBSCRIBE"
30575
30800
  ];
30576
30801
  //#endregion
30577
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/FindMyWay.js
30802
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/FindMyWay.js
30578
30803
  /**
30579
30804
  * A radix-tree HTTP router used by the unstable HTTP routing modules.
30580
30805
  *
@@ -30615,7 +30840,7 @@ var make$20 = make$21;
30615
30840
  */
30616
30841
  var isGreaterThanOrEqualTo = /*#__PURE__*/ isGreaterThanOrEqualTo$2(LogLevelOrder);
30617
30842
  //#endregion
30618
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/ErrorReporter.js
30843
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/ErrorReporter.js
30619
30844
  /**
30620
30845
  * Defines the runtime property key used to mark an object error as ignored by error
30621
30846
  * reporting.
@@ -30652,7 +30877,7 @@ var isGreaterThanOrEqualTo = /*#__PURE__*/ isGreaterThanOrEqualTo$2(LogLevelOrde
30652
30877
  */
30653
30878
  var ignore = "~effect/ErrorReporter/ignore";
30654
30879
  //#endregion
30655
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/HttpServerResponse.js
30880
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/HttpServerResponse.js
30656
30881
  var TypeId$16 = "~effect/http/HttpServerResponse";
30657
30882
  /**
30658
30883
  * Creates an empty HTTP response.
@@ -30741,7 +30966,7 @@ TaggedError$1("MultipartError");
30741
30966
  var HttpServerRequest = /*#__PURE__*/ Service$1("effect/http/HttpServerRequest");
30742
30967
  Service$1()("effect/http/ParsedSearchParams");
30743
30968
  //#endregion
30744
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/internal/preResponseHandler.js
30969
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/internal/preResponseHandler.js
30745
30970
  /** @internal */
30746
30971
  var requestPreResponseHandlers = /*#__PURE__*/ new WeakMap();
30747
30972
  /** @internal */
@@ -30751,7 +30976,7 @@ var appendPreResponseHandlerUnsafe$1 = (request, handler) => {
30751
30976
  requestPreResponseHandlers.set(request.source, next);
30752
30977
  };
30753
30978
  //#endregion
30754
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/HttpMiddleware.js
30979
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/HttpMiddleware.js
30755
30980
  var loggerDisabledRequests = /*#__PURE__*/ new WeakSet();
30756
30981
  /**
30757
30982
  * Runs an effect with HTTP response logging disabled for the current server request.
@@ -30765,7 +30990,7 @@ var withLoggerDisabled = (self) => withFiber((fiber) => {
30765
30990
  return self;
30766
30991
  });
30767
30992
  //#endregion
30768
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/HttpEffect.js
30993
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/HttpEffect.js
30769
30994
  /**
30770
30995
  * Registers a pre-response handler for the supplied HTTP server request.
30771
30996
  *
@@ -30774,7 +30999,7 @@ var withLoggerDisabled = (self) => withFiber((fiber) => {
30774
30999
  */
30775
31000
  var appendPreResponseHandlerUnsafe = appendPreResponseHandlerUnsafe$1;
30776
31001
  //#endregion
30777
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/http/HttpRouter.js
31002
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/http/HttpRouter.js
30778
31003
  /**
30779
31004
  * Builds server-side routers for Effect HTTP applications.
30780
31005
  *
@@ -30900,7 +31125,7 @@ var getMiddleware = (context) => {
30900
31125
  };
30901
31126
  (/*#__PURE__*/ middleware(withLoggerDisabled)).layer;
30902
31127
  //#endregion
30903
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/workers/Transferable.js
31128
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/workers/Transferable.js
30904
31129
  /**
30905
31130
  * Marks encoded worker message fields that should move through `postMessage` as
30906
31131
  * transfer-list entries.
@@ -30949,7 +31174,7 @@ var makeCollectorUnsafe = () => {
30949
31174
  });
30950
31175
  };
30951
31176
  //#endregion
30952
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/PrimaryKey.js
31177
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/PrimaryKey.js
30953
31178
  /**
30954
31179
  * Defines the unique identifier used to identify objects that implement the `PrimaryKey` interface.
30955
31180
  *
@@ -30967,7 +31192,7 @@ var makeCollectorUnsafe = () => {
30967
31192
  */
30968
31193
  var symbol = "~effect/interfaces/PrimaryKey";
30969
31194
  //#endregion
30970
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/RpcSchema.js
31195
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/RpcSchema.js
30971
31196
  /**
30972
31197
  * RPC schema markers and interruption annotations.
30973
31198
  *
@@ -31026,7 +31251,7 @@ var ClientAbort = class extends Service$1()("effect/rpc/RpcSchema/ClientAbort")
31026
31251
  }));
31027
31252
  };
31028
31253
  //#endregion
31029
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/Rpc.js
31254
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/Rpc.js
31030
31255
  var TypeId$12 = "~effect/rpc/Rpc";
31031
31256
  /**
31032
31257
  * Represents server-side metadata for the client associated with an RPC request.
@@ -31213,7 +31438,7 @@ var WrapperTypeId = "~effect/rpc/Rpc/Wrapper";
31213
31438
  */
31214
31439
  var isWrapper = (u) => WrapperTypeId in u;
31215
31440
  //#endregion
31216
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/RpcMessage.js
31441
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/RpcMessage.js
31217
31442
  /**
31218
31443
  * Converts a bigint or string request id into the branded `RequestId` type.
31219
31444
  *
@@ -33071,7 +33296,7 @@ defaultPackr.pack;
33071
33296
  defaultPackr.pack;
33072
33297
  var { NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT } = FLOAT32_OPTIONS;
33073
33298
  //#endregion
33074
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/RpcSerialization.js
33299
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/RpcSerialization.js
33075
33300
  /**
33076
33301
  * Service that describes how RPC protocol messages are encoded and decoded,
33077
33302
  * including the content type and whether the serialization format provides
@@ -33340,7 +33565,7 @@ function encodeJsonRpcMessage(response) {
33340
33565
  }
33341
33566
  var jsonRpcInternalError = -32603;
33342
33567
  //#endregion
33343
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/Utils.js
33568
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/Utils.js
33344
33569
  /**
33345
33570
  * Builds a service with a `run` method that buffers writes until `run` installs
33346
33571
  * a writer, replays buffered writes with their original contexts, and restores
@@ -33418,7 +33643,7 @@ var withRunClient = (f) => suspend$2(() => {
33418
33643
  }));
33419
33644
  });
33420
33645
  //#endregion
33421
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/RpcClient.js
33646
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/RpcClient.js
33422
33647
  var requestIdCounter = 0;
33423
33648
  /**
33424
33649
  * Creates an RPC client for an already-decoded message channel, returning the
@@ -33784,7 +34009,7 @@ var Protocol$1 = class extends Service$1()("effect/rpc/RpcClient/Protocol") {
33784
34009
  Service$1()("effect/rpc/RpcClient/ConnectionHooks");
33785
34010
  var decodeDefect = /*#__PURE__*/ decodeSync(/*#__PURE__*/ Defect());
33786
34011
  //#endregion
33787
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Stdio.js
34012
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Stdio.js
33788
34013
  /**
33789
34014
  * Service contract for command-line arguments and standard input, output, and
33790
34015
  * error output. It lets programs depend on standard I/O through the Effect
@@ -33836,8 +34061,9 @@ var Stdio = /*#__PURE__*/ Service$1(TypeId$11);
33836
34061
  *
33837
34062
  * **Details**
33838
34063
  *
33839
- * The returned service reuses the supplied fields unchanged and only adds the
33840
- * `Stdio` type identifier; it does not create a `Layer` or provide defaults.
34064
+ * The returned service reuses the supplied fields unchanged and adds the
34065
+ * `Stdio` type identifier. Omitted terminal-detection fields default to
34066
+ * effects that succeed with `false`.
33841
34067
  *
33842
34068
  * @see {@link layerTest} for a test layer with default fields that can be overridden
33843
34069
  *
@@ -33846,10 +34072,12 @@ var Stdio = /*#__PURE__*/ Service$1(TypeId$11);
33846
34072
  */
33847
34073
  var make$13 = (options) => ({
33848
34074
  [TypeId$11]: TypeId$11,
34075
+ stdinIsTerminal: succeed$4(false),
34076
+ stdoutIsTerminal: succeed$4(false),
33849
34077
  ...options
33850
34078
  });
33851
34079
  //#endregion
33852
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/RpcServer.js
34080
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/RpcServer.js
33853
34081
  /**
33854
34082
  * Creates an RPC server for an already-decoded message channel, running
33855
34083
  * handlers for a group and sending decoded server responses through
@@ -34170,7 +34398,7 @@ var make$12 = /*#__PURE__*/ fnUntraced(function* (group, options) {
34170
34398
  const clients = /* @__PURE__ */ new Map();
34171
34399
  const handleEncode = (client, requestId, encodeDefect, collector, effect, onSuccess) => (collector ? provideService(effect, Collector, collector) : effect).pipe(flatMap$1((a) => send(client.id, onSuccess(a), collector && collector.clearUnsafe())), catchCause$1((cause) => {
34172
34400
  client.schemas.delete(requestId);
34173
- const defect = squash(map$8(cause, (e) => e.issue.toString()));
34401
+ const defect = squash(map$8(cause, (e) => defaultFormatter$1(e.issue)));
34174
34402
  return andThen(sendRequestDefect(client, requestId, encodeDefect, defect), server.write(client.id, {
34175
34403
  _tag: "Interrupt",
34176
34404
  requestId,
@@ -34216,7 +34444,7 @@ var make$12 = /*#__PURE__*/ fnUntraced(function* (group, options) {
34216
34444
  if (!rpc) return sendRequestDefect(client, requestId, (defect) => succeed$4(defect), `Unknown request tag: ${tag}`);
34217
34445
  const schemas = getSchemas(rpc);
34218
34446
  return matchEffect(provideContext$2(schemas.decode(request.payload), schemas.context), {
34219
- onFailure: (error) => sendRequestDefect(client, requestId, schemas.encodeDefect, error.issue.toString()),
34447
+ onFailure: (error) => sendRequestDefect(client, requestId, schemas.encodeDefect, defaultFormatter$1(error.issue)),
34220
34448
  onSuccess: (payload) => {
34221
34449
  client.schemas.set(requestId, supportsTransferables ? {
34222
34450
  ...schemas,
@@ -34311,7 +34539,7 @@ var layerProtocolStdio = /*#__PURE__*/ effect(Protocol, /* @__PURE__ */ gen(func
34311
34539
  }));
34312
34540
  }));
34313
34541
  //#endregion
34314
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/RpcGroup.js
34542
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/RpcGroup.js
34315
34543
  var RpcGroupProto = {
34316
34544
  add(...rpcs) {
34317
34545
  const requests = new Map(this.requests);
@@ -34445,7 +34673,7 @@ var make$11 = (...rpcs) => makeProto$1({
34445
34673
  annotations: empty$8()
34446
34674
  });
34447
34675
  //#endregion
34448
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/ConfigProvider.js
34676
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/ConfigProvider.js
34449
34677
  /**
34450
34678
  * Data sources used by `Config` to load raw configuration values. A
34451
34679
  * `ConfigProvider` reads paths from places such as environment variables,
@@ -34669,13 +34897,45 @@ function emptyStringAsMissing(value, preserveEmptyStrings) {
34669
34897
  return value === "" && !preserveEmptyStrings ? void 0 : value;
34670
34898
  }
34671
34899
  /**
34900
+ * Creates a `ConfigProvider` backed by an explicit environment record.
34901
+ *
34902
+ * **When to use**
34903
+ *
34904
+ * Use when a restricted runtime cannot evaluate the automatic environment
34905
+ * detection performed by {@link fromEnv}, or whenever the environment record
34906
+ * must be supplied explicitly.
34907
+ *
34908
+ * **Details**
34909
+ *
34910
+ * `undefined` values are ignored. Path lookup and child discovery otherwise
34911
+ * use the same environment-variable semantics as {@link fromEnv}.
34912
+ *
34913
+ * Environment variable names are captured at construction time to establish
34914
+ * record keys and array lengths. The supplied record remains live for value
34915
+ * lookups, so updates to known paths are observed by later loads. Keys added
34916
+ * after construction can be loaded directly, but do not appear in captured
34917
+ * parent record keys or array lengths.
34918
+ *
34919
+ * Literal empty strings are treated as missing values by default. Pass
34920
+ * `{ preserveEmptyStrings: true }` to keep empty strings as explicit values.
34921
+ *
34922
+ * @see {@link fromEnv} – automatically reads the runtime environment
34923
+ *
34924
+ * @category constructors
34925
+ * @since 4.0.0
34926
+ */
34927
+ function fromEnvRecord(env, options) {
34928
+ const preserveEmptyStrings = options?.preserveEmptyStrings === true;
34929
+ const trie = buildEnvTrie(env);
34930
+ return make$10((path) => succeed$4(nodeAtEnv(trie, env, path, preserveEmptyStrings)));
34931
+ }
34932
+ /**
34672
34933
  * Creates a `ConfigProvider` backed by environment variables.
34673
34934
  *
34674
34935
  * **When to use**
34675
34936
  *
34676
34937
  * Use to read configuration from `process.env`, which is the default when no
34677
- * provider is explicitly set, or pass a custom env record for testing or
34678
- * non-Node runtimes.
34938
+ * provider is explicitly set, or pass a custom env record for testing.
34679
34939
  *
34680
34940
  * **Details**
34681
34941
  *
@@ -34716,23 +34976,21 @@ function emptyStringAsMissing(value, preserveEmptyStrings) {
34716
34976
  * ```
34717
34977
  *
34718
34978
  * @see {@link fromUnknown} – for JSON objects
34979
+ * @see {@link fromEnvRecord} – for explicit records in restricted runtimes
34719
34980
  * @see {@link constantCase} – bridge camelCase keys to SCREAMING_SNAKE_CASE
34720
34981
  *
34721
34982
  * @category constructors
34722
34983
  * @since 2.0.0
34723
34984
  */
34724
34985
  function fromEnv(options) {
34725
- const env = options?.env ?? {
34986
+ return fromEnvRecord(options?.env ?? {
34726
34987
  ...globalThis.process?.env,
34727
34988
  "BASE_URL": "/",
34728
34989
  "DEV": false,
34729
34990
  "MODE": "production",
34730
34991
  "PROD": true,
34731
34992
  "SSR": false
34732
- };
34733
- const preserveEmptyStrings = options?.preserveEmptyStrings === true;
34734
- const trie = buildEnvTrie(env);
34735
- return make$10((path) => succeed$4(nodeAtEnv(trie, env, path, preserveEmptyStrings)));
34993
+ }, { preserveEmptyStrings: options?.preserveEmptyStrings });
34736
34994
  }
34737
34995
  function buildEnvTrie(env) {
34738
34996
  const trie = {};
@@ -34811,7 +35069,7 @@ var Boolean$1 = /*#__PURE__*/ Literals([...TrueValues.literals, ...FalseValues.l
34811
35069
  encode: (value) => value ? "true" : "false"
34812
35070
  })));
34813
35071
  //#endregion
34814
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Crypto.js
35072
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Crypto.js
34815
35073
  /**
34816
35074
  * Defines a platform-independent service for cryptographic operations.
34817
35075
  *
@@ -34959,7 +35217,7 @@ var formatUUIDv7 = (timestampMillis, bytes) => {
34959
35217
  return formatUUID(bytes);
34960
35218
  };
34961
35219
  //#endregion
34962
- //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.105_effect@4.0.0-beta.104/node_modules/@effect/platform-node-shared/dist/NodeCrypto.js
35220
+ //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.106_effect@4.0.0-beta.106/node_modules/@effect/platform-node-shared/dist/NodeCrypto.js
34963
35221
  /**
34964
35222
  * Node-compatible implementation of Effect's `Crypto` service.
34965
35223
  *
@@ -34989,7 +35247,7 @@ var digest = (algorithm, data) => try_({
34989
35247
  })
34990
35248
  });
34991
35249
  //#endregion
34992
- //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.104_effect@4.0.0-beta.104_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeCrypto.js
35250
+ //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.106_effect@4.0.0-beta.106_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeCrypto.js
34993
35251
  /**
34994
35252
  * The `NodeCrypto` module provides the Node.js `Crypto` service layer for
34995
35253
  * Effect programs. Provide {@link layer} at the edge of a Node application,
@@ -35014,7 +35272,7 @@ var layer$10 = /* @__PURE__ */ succeed$5(Crypto, /* @__PURE__ */ make$9({
35014
35272
  digest
35015
35273
  }));
35016
35274
  //#endregion
35017
- //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.105_effect@4.0.0-beta.104/node_modules/@effect/platform-node-shared/dist/NodeFileSystem.js
35275
+ //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.106_effect@4.0.0-beta.106/node_modules/@effect/platform-node-shared/dist/NodeFileSystem.js
35018
35276
  /**
35019
35277
  * Shared Node-compatible implementation of Effect's `FileSystem` service.
35020
35278
  *
@@ -35368,7 +35626,7 @@ var makeFileSystem = /*#__PURE__*/ map$7(/*#__PURE__*/ serviceOption(WatchBacken
35368
35626
  writeFile: writeFile$1
35369
35627
  }));
35370
35628
  //#endregion
35371
- //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.104_effect@4.0.0-beta.104_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeFileSystem.js
35629
+ //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.106_effect@4.0.0-beta.106_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeFileSystem.js
35372
35630
  /**
35373
35631
  * Node.js `FileSystem` layer for programs that perform real filesystem I/O.
35374
35632
  *
@@ -35387,7 +35645,7 @@ var makeFileSystem = /*#__PURE__*/ map$7(/*#__PURE__*/ serviceOption(WatchBacken
35387
35645
  */
35388
35646
  var layer$8 = /* @__PURE__ */ effect(FileSystem)(makeFileSystem);
35389
35647
  //#endregion
35390
- //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.105_effect@4.0.0-beta.104/node_modules/@effect/platform-node-shared/dist/NodePath.js
35648
+ //#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.106_effect@4.0.0-beta.106/node_modules/@effect/platform-node-shared/dist/NodePath.js
35391
35649
  /**
35392
35650
  * Node-backed provider for Effect's `Path` service.
35393
35651
  *
@@ -35425,7 +35683,7 @@ var fileUrlOps = (windows) => ({
35425
35683
  .../*#__PURE__*/ fileUrlOps(true)
35426
35684
  });
35427
35685
  //#endregion
35428
- //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.104_effect@4.0.0-beta.104_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodePath.js
35686
+ //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.106_effect@4.0.0-beta.106_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodePath.js
35429
35687
  /**
35430
35688
  * Node.js layers for Effect's `Path` service.
35431
35689
  *
@@ -35449,7 +35707,7 @@ var layer$6 = /* @__PURE__ */ succeed$5(Path$1)({
35449
35707
  .../*#__PURE__*/ fileUrlOps(void 0)
35450
35708
  });
35451
35709
  //#endregion
35452
- //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.104_effect@4.0.0-beta.104_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeStdio.js
35710
+ //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.106_effect@4.0.0-beta.106_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeStdio.js
35453
35711
  /**
35454
35712
  * Node.js `Stdio` layer for the current process.
35455
35713
  *
@@ -35503,7 +35761,7 @@ var layer$4 = /* @__PURE__ */ succeed$5(Stdio, /*#__PURE__*/ make$13({
35503
35761
  })
35504
35762
  }));
35505
35763
  //#endregion
35506
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Terminal.js
35764
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Terminal.js
35507
35765
  var TypeId$8 = "~effect/platform/Terminal";
35508
35766
  var QuitErrorTypeId = "effect/platform/Terminal/QuitError";
35509
35767
  /**
@@ -35600,34 +35858,37 @@ var layer$3 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fnUn
35600
35858
  };
35601
35859
  stdin.once("end", onStdinEnd);
35602
35860
  yield* addFinalizer(() => sync(() => stdin.off("end", onStdinEnd)));
35603
- const rlRef = yield* make$37({ acquire: acquireRelease(sync(() => {
35604
- const rl = readline.createInterface({
35605
- input: stdin,
35606
- escapeCodeTimeout: 50
35607
- });
35608
- const onLine = (line) => offerUnsafe(lines, line);
35609
- const onClose = () => {
35861
+ const rlRef = yield* make$37({
35862
+ acquire: acquireRelease(sync(() => {
35863
+ const rl = readline.createInterface({
35864
+ input: stdin,
35865
+ escapeCodeTimeout: 50
35866
+ });
35867
+ const onLine = (line) => offerUnsafe(lines, line);
35868
+ const onClose = () => {
35869
+ readlineActive = false;
35870
+ endUnsafe(lines);
35871
+ };
35872
+ readlineActive = true;
35873
+ readline.emitKeypressEvents(stdin, rl);
35874
+ rl.on("line", onLine);
35875
+ rl.once("close", onClose);
35876
+ if (stdin.isTTY) stdin.setRawMode(true);
35877
+ return {
35878
+ rl,
35879
+ onClose,
35880
+ onLine
35881
+ };
35882
+ }), ({ rl, onClose, onLine }) => sync(() => {
35610
35883
  readlineActive = false;
35611
- endUnsafe(lines);
35612
- };
35613
- readlineActive = true;
35614
- readline.emitKeypressEvents(stdin, rl);
35615
- rl.on("line", onLine);
35616
- rl.once("close", onClose);
35617
- if (stdin.isTTY) stdin.setRawMode(true);
35618
- return {
35619
- rl,
35620
- onClose,
35621
- onLine
35622
- };
35623
- }), ({ rl, onClose, onLine }) => sync(() => {
35624
- readlineActive = false;
35625
- rl.off("line", onLine);
35626
- rl.off("close", onClose);
35627
- if (stdin.isTTY) stdin.setRawMode(false);
35628
- rl.close();
35629
- if (inputEnded) endUnsafe(lines);
35630
- })) });
35884
+ rl.off("line", onLine);
35885
+ rl.off("close", onClose);
35886
+ if (stdin.isTTY) stdin.setRawMode(false);
35887
+ rl.close();
35888
+ if (inputEnded) endUnsafe(lines);
35889
+ })),
35890
+ idleTimeToLive: "10 millis"
35891
+ });
35631
35892
  const columns = sync(() => stdout.columns ?? 0);
35632
35893
  const rows = sync(() => stdout.rows ?? 0);
35633
35894
  const readInput = gen(function* () {
@@ -35687,7 +35948,7 @@ function defaultShouldQuit(input) {
35687
35948
  return input.key.ctrl && (input.key.name === "c" || input.key.name === "d");
35688
35949
  }
35689
35950
  //#endregion
35690
- //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.104_effect@4.0.0-beta.104_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeServices.js
35951
+ //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.106_effect@4.0.0-beta.106_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeServices.js
35691
35952
  /**
35692
35953
  * Provides the default Node implementations for child process spawning,
35693
35954
  * filesystem, path, stdio, and terminal services.
@@ -35697,7 +35958,7 @@ function defaultShouldQuit(input) {
35697
35958
  */
35698
35959
  var layer$1 = /*#__PURE__*/ provideMerge(layer$12, /*#__PURE__*/ mergeAll(layer$8, layer$10, layer$6, layer$4, layer$3));
35699
35960
  //#endregion
35700
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Runtime.js
35961
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Runtime.js
35701
35962
  /**
35702
35963
  * Helpers for turning an `Effect` program into a host application's main entry
35703
35964
  * point. This module is the low-level layer used by platform adapters to run a
@@ -35981,7 +36242,7 @@ var getErrorReported = (u) => {
35981
36242
  return true;
35982
36243
  };
35983
36244
  //#endregion
35984
- //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.104_effect@4.0.0-beta.104_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeRuntime.js
36245
+ //#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.106_effect@4.0.0-beta.106_ioredis@5.11.1_supports-color@7.2.0_/node_modules/@effect/platform-node/dist/NodeRuntime.js
35985
36246
  /**
35986
36247
  * Node.js process runner for Effect programs.
35987
36248
  *
@@ -36033,7 +36294,7 @@ var runMain = /* @__PURE__ */ makeRunMain(({ fiber, teardown }) => {
36033
36294
  process.on("SIGTERM", onSigint);
36034
36295
  });
36035
36296
  //#endregion
36036
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Console.js
36297
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Console.js
36037
36298
  /**
36038
36299
  * Context reference for the current console service in the Effect system, allowing access to the active console implementation from within the Effect context.
36039
36300
  *
@@ -36168,7 +36429,7 @@ var log = (...args) => consoleWith((console) => sync$1(() => {
36168
36429
  console.log(...args);
36169
36430
  }));
36170
36431
  //#endregion
36171
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Logger.js
36432
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/Logger.js
36172
36433
  /**
36173
36434
  * Context reference that routes the built-in default logger and TTY pretty
36174
36435
  * console logger to stderr.
@@ -36192,7 +36453,7 @@ var log = (...args) => consoleWith((console) => sync$1(() => {
36192
36453
  */
36193
36454
  var LogToStderr = LogToStderr$1;
36194
36455
  //#endregion
36195
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/CliError.js
36456
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/CliError.js
36196
36457
  /**
36197
36458
  * Defines structured errors for the unstable CLI parser and runner.
36198
36459
  *
@@ -36664,7 +36925,7 @@ var ShowHelp = class extends TaggedError(`${TypeId$7}/ShowHelp`)("ShowHelp", {
36664
36925
  }
36665
36926
  };
36666
36927
  //#endregion
36667
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/Primitive.js
36928
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/Primitive.js
36668
36929
  /**
36669
36930
  * Parses raw command-line strings into typed values.
36670
36931
  *
@@ -36927,7 +37188,7 @@ var getChoiceKeys = (primitive) => primitive._tag === "Choice" ? primitive.choic
36927
37188
  /** @internal */
36928
37189
  var getPathType = (primitive) => primitive._tag === "Path" ? primitive.pathType : void 0;
36929
37190
  //#endregion
36930
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/ansi.js
37191
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/ansi.js
36931
37192
  /**
36932
37193
  * Internal ANSI escape sequence helpers used by the unstable CLI rendering
36933
37194
  * implementation. This module centralizes the control codes for text styling,
@@ -37007,7 +37268,7 @@ var eraseLines = (rows) => {
37007
37268
  return command;
37008
37269
  };
37009
37270
  //#endregion
37010
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/Prompt.js
37271
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/Prompt.js
37011
37272
  /**
37012
37273
  * Builds interactive terminal prompts for CLI applications.
37013
37274
  *
@@ -38583,7 +38844,7 @@ var entriesToDisplay = (cursor, total, maxVisible) => {
38583
38844
  };
38584
38845
  };
38585
38846
  //#endregion
38586
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/Param.js
38847
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/Param.js
38587
38848
  var TypeId$5 = "~effect/cli/Param";
38588
38849
  /**
38589
38850
  * Defines the kind discriminator for positional argument parameters.
@@ -39280,7 +39541,7 @@ var getParamMetadata = (param) => {
39280
39541
  });
39281
39542
  };
39282
39543
  //#endregion
39283
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/Argument.js
39544
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/Argument.js
39284
39545
  /**
39285
39546
  * Creates a positional string argument.
39286
39547
  *
@@ -39316,7 +39577,7 @@ var string$2 = (name) => string$3(argumentKind, name);
39316
39577
  */
39317
39578
  var withDescription$2 = /*#__PURE__*/ dual(2, (self, description) => withDescription$3(self, description));
39318
39579
  //#endregion
39319
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/CliOutput.js
39580
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/CliOutput.js
39320
39581
  /**
39321
39582
  * Formats CLI help and errors as text.
39322
39583
  *
@@ -39564,7 +39825,7 @@ var formatHelpDocImpl = (doc, colors) => {
39564
39825
  return sections.join("\n");
39565
39826
  };
39566
39827
  //#endregion
39567
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/completions/bash.js
39828
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/completions/bash.js
39568
39829
  var escapeForBash = (s) => s.replace(/'/g, "'\\''");
39569
39830
  var sanitizeFunctionName = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
39570
39831
  var flagNamesForWordlist = (flag) => {
@@ -39768,7 +40029,7 @@ var generate$3 = (executableName, descriptor) => {
39768
40029
  return lines.join("\n");
39769
40030
  };
39770
40031
  //#endregion
39771
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/completions/fish.js
40032
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/completions/fish.js
39772
40033
  var escapeFishString = (s) => s.replace(/'/g, "\\'");
39773
40034
  /**
39774
40035
  * Build a Fish condition that checks the current subcommand context.
@@ -39906,7 +40167,7 @@ var generate$2 = (executableName, descriptor) => {
39906
40167
  return lines.join("\n");
39907
40168
  };
39908
40169
  //#endregion
39909
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/completions/zsh.js
40170
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/completions/zsh.js
39910
40171
  var escapeZsh = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "'\\''").replace(/:/g, "\\:");
39911
40172
  var sanitize = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
39912
40173
  /**
@@ -40043,7 +40304,7 @@ var generate$1 = (executableName, descriptor) => {
40043
40304
  return lines.join("\n");
40044
40305
  };
40045
40306
  //#endregion
40046
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/Completions.js
40307
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/Completions.js
40047
40308
  /**
40048
40309
  * The `Completions` module turns a plain description of an Effect CLI command
40049
40310
  * tree into shell completion scripts for Bash, Zsh, and Fish. It is the
@@ -40079,7 +40340,7 @@ var generate = (executableName, shell, descriptor) => {
40079
40340
  }
40080
40341
  };
40081
40342
  //#endregion
40082
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/Flag.js
40343
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/Flag.js
40083
40344
  /**
40084
40345
  * Creates a string flag that accepts text input.
40085
40346
  *
@@ -40345,7 +40606,7 @@ var withDefault = withDefault$1;
40345
40606
  */
40346
40607
  var map$1 = /*#__PURE__*/ dual(2, (self, f) => map$2(self, f));
40347
40608
  //#endregion
40348
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/config.js
40609
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/config.js
40349
40610
  /**
40350
40611
  * Config Internal
40351
40612
  * ================
@@ -40464,7 +40725,7 @@ var reconstructTree = (tree, results) => {
40464
40725
  }
40465
40726
  };
40466
40727
  //#endregion
40467
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/command.js
40728
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/command.js
40468
40729
  /**
40469
40730
  * Command Implementation
40470
40731
  * ======================
@@ -40655,7 +40916,7 @@ var checkForDuplicateFlags = (parent, subcommands, options) => {
40655
40916
  }
40656
40917
  };
40657
40918
  //#endregion
40658
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/completions/descriptor.js
40919
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/completions/descriptor.js
40659
40920
  /**
40660
40921
  * CommandDescriptor — pure-data representation of a command tree for
40661
40922
  * shell completion generation.
@@ -40753,7 +41014,7 @@ var fromCommand = (cmd) => {
40753
41014
  };
40754
41015
  };
40755
41016
  //#endregion
40756
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/help.js
41017
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/help.js
40757
41018
  /**
40758
41019
  * Help Documentation
40759
41020
  * ================
@@ -40862,7 +41123,7 @@ var getHelpForCommandPath = (command, commandPath, builtIns) => gen(function* ()
40862
41123
  };
40863
41124
  });
40864
41125
  //#endregion
40865
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/GlobalFlag.js
41126
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/GlobalFlag.js
40866
41127
  /**
40867
41128
  * Global flags for Effect CLI command trees. Global flags are parsed outside a
40868
41129
  * single command's local flags and can apply to a command and its descendants.
@@ -41033,7 +41294,7 @@ var BuiltIns = [
41033
41294
  LogLevel
41034
41295
  ];
41035
41296
  //#endregion
41036
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/CliConfig.js
41297
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/CliConfig.js
41037
41298
  /**
41038
41299
  * Configuration for Effect CLI command execution.
41039
41300
  *
@@ -41060,7 +41321,7 @@ var CliConfig = class extends Reference("effect/unstable/cli/CliConfig", { defau
41060
41321
  */
41061
41322
  var defaults = { builtIns: BuiltIns };
41062
41323
  //#endregion
41063
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/lexer.js
41324
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/lexer.js
41064
41325
  /** @internal */
41065
41326
  function lex(argv) {
41066
41327
  const endIndex = argv.indexOf("--");
@@ -41119,7 +41380,7 @@ var lexTokens = (args) => {
41119
41380
  return tokens;
41120
41381
  };
41121
41382
  //#endregion
41122
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/auto-suggest.js
41383
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/auto-suggest.js
41123
41384
  /**
41124
41385
  * Simple Levenshtein distance implementation (small N, no perf worries)
41125
41386
  */
@@ -41147,7 +41408,7 @@ var suggest = (input, candidates) => {
41147
41408
  return distances.filter(([d]) => d === minDistance).map(([, c]) => c);
41148
41409
  };
41149
41410
  //#endregion
41150
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/parser.js
41411
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/parser.js
41151
41412
  /**
41152
41413
  * Parsing Pipeline for CLI Commands
41153
41414
  * ==================================
@@ -41673,7 +41934,7 @@ var scanCommandLevel = (tokens, context) => {
41673
41934
  return toLeafResult(state);
41674
41935
  };
41675
41936
  //#endregion
41676
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/wizard.js
41937
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/internal/wizard.js
41677
41938
  var run$1 = /*#__PURE__*/ fnUntraced(function* (command, options) {
41678
41939
  const commandPath = options?.commandPath ?? [command.name];
41679
41940
  const selected = getCommandAtPath(command, commandPath);
@@ -41833,7 +42094,7 @@ var wrapCommand = (commandLine) => {
41833
42094
  };
41834
42095
  var formatShellArg = (arg) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'"'"'`)}'`;
41835
42096
  //#endregion
41836
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/Command.js
42097
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/cli/Command.js
41837
42098
  /**
41838
42099
  * Returns `true` if the provided value is a `Command`.
41839
42100
  *
@@ -42433,7 +42694,7 @@ var runWith = (command, config) => {
42433
42694
  };
42434
42695
  var package_default = {
42435
42696
  name: "repo-dive",
42436
- version: "0.11.1",
42697
+ version: "0.13.0",
42437
42698
  description: "Dive into a git repo's history: per-commit snapshots, an indexed metrics catalog and an interactive dashboard",
42438
42699
  keywords: [
42439
42700
  "git",
@@ -42509,8 +42770,8 @@ var package_default = {
42509
42770
  "@changesets/changelog-github": "0.7.0",
42510
42771
  "@changesets/cli": "2.31.1",
42511
42772
  "@changesets/config": "3.1.4",
42512
- "@effect/platform-node": "4.0.0-beta.104",
42513
- "@effect/vitest": "4.0.0-beta.104",
42773
+ "@effect/platform-node": "4.0.0-beta.106",
42774
+ "@effect/vitest": "4.0.0-beta.106",
42514
42775
  "@kachkaev/eslint-config-base": "1.2.0",
42515
42776
  "@kachkaev/markdownlint-config": "1.0.1",
42516
42777
  "@kachkaev/prettier-config": "2.2.1",
@@ -42519,7 +42780,7 @@ var package_default = {
42519
42780
  "@tsconfig/node-ts": "23.6.4",
42520
42781
  "@tsconfig/strictest": "2.0.8",
42521
42782
  "@types/babel__core": "7.20.5",
42522
- "@types/node": "26.1.2",
42783
+ "@types/node": "26.2.0",
42523
42784
  "@types/react": "19.2.18",
42524
42785
  "@types/react-dom": "19.2.4",
42525
42786
  "@typescript/native": "npm:typescript@7.0.2",
@@ -42533,13 +42794,13 @@ var package_default = {
42533
42794
  "babel-plugin-react-compiler": "1.0.0",
42534
42795
  "class-variance-authority": "0.7.1",
42535
42796
  "cspell": "10.0.1",
42536
- "effect": "4.0.0-beta.104",
42797
+ "effect": "4.0.0-beta.106",
42537
42798
  "eslint": "9.39.5",
42538
42799
  "eslint-plugin-react-hooks": "7.1.1",
42539
42800
  "husky": "9.1.7",
42540
42801
  "knip": "6.32.0",
42541
42802
  "lint-staged": "17.3.0",
42542
- "lucide-react": "1.29.0",
42803
+ "lucide-react": "1.30.0",
42543
42804
  "markdownlint-cli": "0.49.1",
42544
42805
  "npm-run-all2": "9.0.3",
42545
42806
  "prettier": "3.9.6",
@@ -49803,6 +50064,19 @@ var collectorsCommand = make$5("collectors").pipe(withDescription("List availabl
49803
50064
  var prettifyAuthorEmail = (email) => {
49804
50065
  return /^(?:\d+\+)?([^@]+)@users\.noreply\.github\.com$/.exec(email)?.[1] ?? email;
49805
50066
  };
50067
+ /**
50068
+ * The username an address is built around: `alice@example.com` → `alice`. What
50069
+ * a chart falls back to when nobody's name is known, so a published report
50070
+ * names people without spelling out an address anyone can scrape.
50071
+ *
50072
+ * `undefined` when there is no username to take — an identity that is not an
50073
+ * address at all (a bare `Co-authored-by: Some Name`, or an already-prettified
50074
+ * noreply handle), which is then shown as it stands.
50075
+ */
50076
+ var usernameFromEmail = (email) => {
50077
+ const at = email.indexOf("@");
50078
+ return at > 0 ? email.slice(0, at) : void 0;
50079
+ };
49806
50080
  /** Config file names, in resolution order. First match wins. */
49807
50081
  var configFileNames = [
49808
50082
  "repo-dive.config.ts",
@@ -49823,10 +50097,18 @@ var defaultCatalogDirName = ".repo-dive";
49823
50097
  var defaultDashboardPort = 2141;
49824
50098
  /** Automation bots — commits that don't reflect authored work. */
49825
50099
  var botPattern = /\brenovate\b|\bdependabot\b|github-actions|\[bot\]/i;
50100
+ /**
50101
+ * A trailing "bot" word in the display name — `Release bot`, `deploy-bot`.
50102
+ * Requires a space or hyphen before it so ordinary names that merely end in
50103
+ * those letters, like `Kate Talbot`, stay human.
50104
+ */
50105
+ var botNameSuffixPattern = /[\s-]bot$/i;
49826
50106
  /** Known AI coding agents (mirrors the co-author heuristic in indexing.ts). */
49827
50107
  var aiPattern = /claude|copilot|cursor|chatgpt|openai|gemini|aider|devin|coderabbit|codegen|sweep|windsurf/i;
50108
+ /** `"Name <email>"` → `"Name"`; identities without an email part are used as-is. */
50109
+ var identityName = (identity) => identity.replace(/\s*<[^<>]*>\s*$/, "").trim();
49828
50110
  /** Classifies a `"Name <email>"` identity when the config leaves `kind` unset. */
49829
- var deriveContributorKind = (identity) => botPattern.test(identity) ? "bot" : aiPattern.test(identity) ? "ai" : "human";
50111
+ var deriveContributorKind = (identity) => botPattern.test(identity) || botNameSuffixPattern.test(identityName(identity)) ? "bot" : aiPattern.test(identity) ? "ai" : "human";
49830
50112
  /**
49831
50113
  * Tidies an auto-derived name for display. The kind badge (🤖 / ✨) already
49832
50114
  * marks bots and AI agents, so the `[bot]` suffix GitHub bakes into author names
@@ -49844,7 +50126,7 @@ var bareResolveContributor = (aliases, email, name) => {
49844
50126
  const canonicalEmail = prettifyAuthorEmail(entry?.canonicalEmail ?? email);
49845
50127
  return {
49846
50128
  canonicalEmail,
49847
- label: entry?.displayName ?? normalizeContributorName(canonicalEmail),
50129
+ label: entry?.displayName ?? normalizeContributorName(usernameFromEmail(canonicalEmail) ?? canonicalEmail),
49848
50130
  displayName: entry?.displayName,
49849
50131
  url: entry?.url,
49850
50132
  kind: entry?.kind ?? deriveContributorKind(`${name ?? ""} <${email}>`)
@@ -51261,11 +51543,33 @@ var buildDashboardData = (repoRoot, commits, config, remoteUrl) => {
51261
51543
  rule,
51262
51544
  count
51263
51545
  })) : [];
51264
- const authorNameByEmail = /* @__PURE__ */ new Map();
51265
- for (const commit of commits) if (commit.authorName) authorNameByEmail.set(commit.authorEmail.toLowerCase(), commit.authorName);
51546
+ /**
51547
+ * The name as spelled on this commit (author line or trailer): a configured
51548
+ * displayName wins, otherwise the observed spelling, tidied so a bot's
51549
+ * `[bot]` suffix doesn't double up with its kind badge. Falls back to the
51550
+ * resolved label (the canonical email's username) for an identity git never
51551
+ * spelled a name for.
51552
+ */
51553
+ const nameOf = (resolved, observedName) => resolved.displayName ?? (observedName ? normalizeContributorName(observedName) : resolved.label);
51554
+ /** Raw email → the name git spelled beside it, for kind derivation. */
51555
+ const nameByEmail = /* @__PURE__ */ new Map();
51556
+ /**
51557
+ * Canonical email → the name that identity's chart bands carry. Keyed by the
51558
+ * canonical email so every alias of one person names the same band, and
51559
+ * written in commit order (oldest first) so the newest spelling wins — the
51560
+ * rule the contributors list below follows too.
51561
+ */
51562
+ const nameByCanonicalEmail = /* @__PURE__ */ new Map();
51563
+ for (const commit of commits) {
51564
+ if (!commit.authorName) continue;
51565
+ nameByEmail.set(commit.authorEmail.toLowerCase(), commit.authorName);
51566
+ const resolved = config.resolveContributor(commit.authorEmail, commit.authorName);
51567
+ nameByCanonicalEmail.set(resolved.canonicalEmail.toLowerCase(), nameOf(resolved, commit.authorName));
51568
+ }
51266
51569
  const survivalLabelOf = (email) => {
51267
- const resolved = config.resolveContributor(email, authorNameByEmail.get(email.toLowerCase()));
51268
- return resolved.kind === "human" ? resolved.label : kindGroupLabels[resolved.kind];
51570
+ const resolved = config.resolveContributor(email, nameByEmail.get(email.toLowerCase()));
51571
+ if (resolved.kind !== "human") return kindGroupLabels[resolved.kind];
51572
+ return nameByCanonicalEmail.get(resolved.canonicalEmail.toLowerCase()) ?? resolved.label;
51269
51573
  };
51270
51574
  const survival = commits.filter((commit) => hasMetric(commit, "survival.lines")).map((commit) => {
51271
51575
  const byContributorYear = {};
@@ -51292,12 +51596,6 @@ var buildDashboardData = (repoRoot, commits, config, remoteUrl) => {
51292
51596
  });
51293
51597
  const contributorMap = /* @__PURE__ */ new Map();
51294
51598
  /**
51295
- * The name as spelled on this commit (author line or trailer): a configured
51296
- * displayName wins, otherwise the observed spelling, tidied so a bot's
51297
- * `[bot]` suffix doesn't double up with its kind badge.
51298
- */
51299
- const nameOf = (resolved, observedName) => resolved.displayName ?? (observedName ? normalizeContributorName(observedName) : resolved.label);
51300
- /**
51301
51599
  * Fetches or creates a contributor's bucket.
51302
51600
  *
51303
51601
  * Humans key off their canonical email alone, so an alias group folds every
@@ -51509,7 +51807,7 @@ var runIndex = ({ repoPath }) => gen(function* () {
51509
51807
  //#region src/cli/index-command.ts
51510
51808
  var indexCommand = make$5("index", { repoPath: string$1("repo").pipe(withDefault("."), withDescription$1("Path to the git repository whose catalog to index (defaults to the current directory)")) }).pipe(withDescription("Normalize collected snapshots into the metrics cube (SQLite) and dashboard data (always rebuilt from raw outputs)"), withHandler((config) => runIndex({ repoPath: config.repoPath })));
51511
51809
  //#endregion
51512
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/Response.js
51810
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/Response.js
51513
51811
  /**
51514
51812
  * Schema for HTTP request details associated with an AI response.
51515
51813
  *
@@ -51625,7 +51923,7 @@ Class("effect/ai/AiResponse/Usage")({
51625
51923
  })
51626
51924
  });
51627
51925
  //#endregion
51628
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/AiError.js
51926
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/AiError.js
51629
51927
  /**
51630
51928
  * Defines shared errors for AI operations.
51631
51929
  *
@@ -52861,7 +53159,7 @@ var isAiErrorReason = (u) => hasProperty(u, ReasonTypeId);
52861
53159
  */
52862
53160
  var make$4 = (params) => new AiError(params);
52863
53161
  //#endregion
52864
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/Tool.js
53162
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/Tool.js
52865
53163
  /**
52866
53164
  * Definitions and helpers for tools that AI models can request during a
52867
53165
  * workflow.
@@ -53241,7 +53539,7 @@ var OpenWorld = /*#__PURE__*/ Reference("effect/ai/Tool/OpenWorld", { defaultVal
53241
53539
  */
53242
53540
  var EmptyParams = /*#__PURE__*/ Record(String$1, Never);
53243
53541
  //#endregion
53244
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/Toolkit.js
53542
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/Toolkit.js
53245
53543
  var TypeId$1 = "~effect/ai/Toolkit";
53246
53544
  var Proto = {
53247
53545
  .../*#__PURE__*/ Prototype({
@@ -53434,7 +53732,7 @@ var resolveInput = (...tools) => {
53434
53732
  */
53435
53733
  var make$2 = (...tools) => makeProto(resolveInput(...tools));
53436
53734
  //#endregion
53437
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/internal/mcpProtocol.js
53735
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/internal/mcpProtocol.js
53438
53736
  /** @internal */
53439
53737
  var make$1 = (options) => {
53440
53738
  const payloadCodecsCache = /* @__PURE__ */ new WeakMap();
@@ -53456,7 +53754,7 @@ var make$1 = (options) => {
53456
53754
  };
53457
53755
  };
53458
53756
  //#endregion
53459
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/rpc/RpcMiddleware.js
53757
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/rpc/RpcMiddleware.js
53460
53758
  /**
53461
53759
  * Middleware services for the unstable RPC runtime.
53462
53760
  *
@@ -53502,7 +53800,7 @@ var Service = () => (id, options) => {
53502
53800
  return ServiceClass;
53503
53801
  };
53504
53802
  //#endregion
53505
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/McpSchema.js
53803
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/McpSchema.js
53506
53804
  /**
53507
53805
  * Defines schemas for Model Context Protocol messages.
53508
53806
  *
@@ -55417,7 +55715,7 @@ var ServerNotificationRpcs = class extends make$11(CancelledNotification, Progre
55417
55715
  */
55418
55716
  var EnabledWhen = class extends Service$1()("effect/unstable/ai/McpSchema/EnabledWhen") {};
55419
55717
  //#endregion
55420
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/McpProtocol.js
55718
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/McpProtocol.js
55421
55719
  /**
55422
55720
  * The MCP 2025-06-18 protocol implementation.
55423
55721
  *
@@ -55436,7 +55734,7 @@ var v2025_06_18 = /*#__PURE__*/ make$1({
55436
55734
  serverNotificationRpcs: ServerNotificationRpcs
55437
55735
  });
55438
55736
  //#endregion
55439
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/internal/mcpProtocolRegistry.js
55737
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/internal/mcpProtocolRegistry.js
55440
55738
  var prefix = (protocol) => `@effect/mcp/${encodeURIComponent(protocol.protocolVersion)}/`;
55441
55739
  var asRpcGroup = (group) => group;
55442
55740
  /** @internal */
@@ -55461,7 +55759,7 @@ var make = /*#__PURE__*/ fnUntraced(function* (protocols) {
55461
55759
  };
55462
55760
  });
55463
55761
  //#endregion
55464
- //#region node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/ai/McpServer.js
55762
+ //#region node_modules/.pnpm/effect@4.0.0-beta.106/node_modules/effect/dist/unstable/ai/McpServer.js
55465
55763
  /**
55466
55764
  * Builds Model Context Protocol (MCP) servers with Effect.
55467
55765
  *
@@ -55637,7 +55935,7 @@ var runWithProtocolState = /*#__PURE__*/ fnUntraced(function* (options, protocol
55637
55935
  const isHttp = isSome(yield* serviceOption(HttpRouter));
55638
55936
  const sessions = protocolState.sessions;
55639
55937
  const clientProtocols = /* @__PURE__ */ new Map();
55640
- const cancelledRequests = /* @__PURE__ */ new Map();
55938
+ const activeRequests = /* @__PURE__ */ new Map();
55641
55939
  const handlers = yield* build(layerHandlers(options, {
55642
55940
  sessions,
55643
55941
  protocolRegistry
@@ -55693,11 +55991,11 @@ var runWithProtocolState = /*#__PURE__*/ fnUntraced(function* (options, protocol
55693
55991
  ...protocol,
55694
55992
  send: (clientId, response) => {
55695
55993
  if (response._tag === "Exit") {
55696
- const requests = cancelledRequests.get(clientId);
55697
- if (requests?.delete(requestKey(response.requestId)) === true) {
55698
- if (requests.size === 0) cancelledRequests.delete(clientId);
55699
- return void_$1;
55700
- }
55994
+ const requests = activeRequests.get(clientId);
55995
+ const key = requestKey(response.requestId);
55996
+ const cancelled = requests?.get(key);
55997
+ if (requests !== void 0 && requests.delete(key) && requests.size === 0) activeRequests.delete(clientId);
55998
+ if (cancelled === true) return void_$1;
55701
55999
  }
55702
56000
  return protocol.send(clientId, response);
55703
56001
  },
@@ -55738,9 +56036,10 @@ var runWithProtocolState = /*#__PURE__*/ fnUntraced(function* (options, protocol
55738
56036
  return void_$1;
55739
56037
  }
55740
56038
  if (request.tag === "notifications/cancelled") return decodeCancelledNotification(request.payload).pipe(flatMap$1(({ requestId }) => {
55741
- const requests = cancelledRequests.get(clientId) ?? /* @__PURE__ */ new Set();
55742
- requests.add(requestKey(requestId));
55743
- cancelledRequests.set(clientId, requests);
56039
+ const key = requestKey(requestId);
56040
+ const requests = activeRequests.get(clientId);
56041
+ if (requests?.has(key) !== true) return void_$1;
56042
+ requests.set(key, true);
55744
56043
  return f(clientId, {
55745
56044
  _tag: "Interrupt",
55746
56045
  requestId: RequestId$1(requestId)
@@ -55778,7 +56077,14 @@ var runWithProtocolState = /*#__PURE__*/ fnUntraced(function* (options, protocol
55778
56077
  });
55779
56078
  }
55780
56079
  return selectedProtocol.payloadCodecs(rpc).decode(request.payload).pipe(matchEffect({
55781
- onSuccess: () => f(clientId, routedRequest),
56080
+ onSuccess: () => {
56081
+ if (request.isNotification !== true) {
56082
+ const requests = activeRequests.get(clientId) ?? /* @__PURE__ */ new Map();
56083
+ requests.set(requestKey(request.id), false);
56084
+ activeRequests.set(clientId, requests);
56085
+ }
56086
+ return f(clientId, routedRequest);
56087
+ },
55782
56088
  onFailure: () => request.isNotification ? void_$1 : protocol.send(clientId, {
55783
56089
  _tag: "Exit",
55784
56090
  requestId: request.id,
@@ -55796,7 +56102,7 @@ var runWithProtocolState = /*#__PURE__*/ fnUntraced(function* (options, protocol
55796
56102
  case "Ack":
55797
56103
  case "Interrupt": return f(clientId, request);
55798
56104
  case "Eof":
55799
- cancelledRequests.delete(clientId);
56105
+ activeRequests.delete(clientId);
55800
56106
  return f(clientId, request);
55801
56107
  case "Pong":
55802
56108
  case "Exit":