@stakekit/widget 0.0.287 → 0.0.288

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/bundle/Result-D66k67e4.js +3 -0
  2. package/dist/bundle/Schema-CnO1Nnkx.js +2 -0
  3. package/dist/bundle/{cardano-connector-Cg1NVNSz.js → cardano-connector-BdmhtPwK.js} +1 -1
  4. package/dist/{website/assets/configured-chains-C5lih9lm.js → bundle/configured-chains-BVaAJPl7.js} +1 -1
  5. package/dist/bundle/{cosmos-connector-meta-B3hXlZyj.js → cosmos-connector-meta-CsjY5xv_.js} +1 -1
  6. package/dist/bundle/{current-value-stream-sEIwrVMJ.js → current-value-stream-BphKxe9G.js} +1 -1
  7. package/dist/bundle/{esm-B8ixy8Ti.js → esm-BioWy-zm.js} +1 -1
  8. package/dist/bundle/index.bundle.css +1 -1
  9. package/dist/bundle/index.bundle.js +132 -100
  10. package/dist/bundle/{ledger-connector-ScKbHFK2.js → ledger-connector-BeFXqMQm.js} +2 -2
  11. package/dist/bundle/{network-DRjEa3NO.js → network-BR2dx0lQ.js} +1 -1
  12. package/dist/bundle/{polkadot-ledger-transaction-CSI9csNM.js → polkadot-ledger-transaction-CCpzhicj.js} +1 -1
  13. package/dist/bundle/{safe-connector-BuI_vM2N.js → safe-connector-BW8tBAGV.js} +1 -1
  14. package/dist/bundle/{solana-connector-BXIkWGi1.js → solana-connector-CEoNnJWx.js} +1 -1
  15. package/dist/bundle/{stellar-connector-D5G2p6aO.js → stellar-connector-C3GFN35d.js} +1 -1
  16. package/dist/bundle/{substrate-connector-AJ6EWjQP.js → substrate-connector-B7COXHL7.js} +1 -1
  17. package/dist/{website/assets/ton-connector-DWz2WVCw.js → bundle/ton-connector-DnPSYtXm.js} +1 -1
  18. package/dist/bundle/transaction-3CLRKFvX.js +1 -0
  19. package/dist/{website/assets/transaction-BJ3RmuAw.js → bundle/transaction-BDuN1rLk.js} +2 -2
  20. package/dist/bundle/{transaction-NX-vBbnh.js → transaction-DU8AaOQz.js} +1 -1
  21. package/dist/bundle/{tron-connector-nZfhLwx4.js → tron-connector-iA7bb0__.js} +1 -1
  22. package/dist/bundle/{utils-CfBIlQsz.js → utils-llPzGe7v.js} +1 -1
  23. package/dist/bundle/wagmi-connect-result-DOu6hDDM.js +11 -0
  24. package/dist/bundle/{wallet-errors-Bvwwydi9.js → wallet-errors-MrbcJr3I.js} +1 -1
  25. package/dist/bundle/{wallet-manager-C-MB05Qs.js → wallet-manager-D2AeCPRs.js} +2 -2
  26. package/dist/package/{Result-Cem4lYBf.js → Result-BA6lrqKV.js} +117 -49
  27. package/dist/package/{Schema-DFoi51wt.js → Schema-CUut1r-H.js} +1135 -1310
  28. package/dist/package/{cardano-connector-B9UToMFP.js → cardano-connector-ApyBIRYL.js} +3 -3
  29. package/dist/package/{configured-chains-BfQ8ESmR.js → configured-chains-CeRB7Tdy.js} +1 -1
  30. package/dist/package/{cosmos-connector-meta-UMFrkViG.js → cosmos-connector-meta-NNACISY5.js} +1 -1
  31. package/dist/package/{current-value-stream-BPaLLDf4.js → current-value-stream-Cs2IFPhP.js} +1 -1
  32. package/dist/package/{esm-89IrCtWy.js → esm-3BtHXmV9.js} +1 -1
  33. package/dist/package/index.package.css +21 -0
  34. package/dist/package/index.package.js +8452 -3822
  35. package/dist/package/{ledger-connector-B8D8xJOD.js → ledger-connector-ebEnv7IA.js} +9 -9
  36. package/dist/package/{network-DiYap-9L.js → network-Df21Fcdz.js} +1 -1
  37. package/dist/package/{polkadot-ledger-transaction-Bi14PyTF.js → polkadot-ledger-transaction-Cq_ImU8s.js} +1 -1
  38. package/dist/package/{safe-connector-lVCS_bS5.js → safe-connector-CMgopygU.js} +4 -4
  39. package/dist/package/{solana-connector-P-TqgNNC.js → solana-connector-B2Rf5Tyj.js} +3 -3
  40. package/dist/package/{stellar-connector-BMB2Cql4.js → stellar-connector-DdzqZgoG.js} +4 -4
  41. package/dist/package/{substrate-connector-a7SNpKjf.js → substrate-connector-DO7OAvZ9.js} +2 -2
  42. package/dist/package/{ton-connector-CMzOI2bi.js → ton-connector-CUtYVysK.js} +5 -5
  43. package/dist/package/{transaction-CmOScFm6.js → transaction-BjGgdyu0.js} +5 -5
  44. package/dist/package/{transaction-Do9wZHM8.js → transaction-MMiSjtGI.js} +1 -1
  45. package/dist/package/{transaction-C1e6h8J1.js → transaction-fIZimEky.js} +1 -1
  46. package/dist/package/{tron-connector-PLpMhB65.js → tron-connector-DT1NdAaP.js} +2 -2
  47. package/dist/package/{wagmi-connect-result-BJ91_jis.js → wagmi-connect-result-Bh6qH5iI.js} +593 -462
  48. package/dist/package/{wallet-errors-B4cGcGNy.js → wallet-errors-BMdJQ_kv.js} +1 -1
  49. package/dist/package/{wallet-manager-BsDss9DQ.js → wallet-manager-BbL7EBi6.js} +5 -5
  50. package/dist/types/domain/network/network.d.ts +2 -2
  51. package/dist/types/generated/api/legacy-schema.d.ts +3503 -1952
  52. package/dist/types/generated/api/yield-schema.d.ts +1492 -1113
  53. package/dist/types/public-api/types.d.ts +2 -2
  54. package/dist/website/assets/Result-D66k67e4.js +3 -0
  55. package/dist/website/assets/Schema-CnO1Nnkx.js +2 -0
  56. package/dist/website/assets/{cardano-connector-JluaLQJr.js → cardano-connector-DkgQsbib.js} +1 -1
  57. package/dist/{bundle/configured-chains-C5lih9lm.js → website/assets/configured-chains-BVaAJPl7.js} +1 -1
  58. package/dist/website/assets/{cosmos-connector-meta-B3hXlZyj.js → cosmos-connector-meta-CsjY5xv_.js} +1 -1
  59. package/dist/website/assets/{current-value-stream-sEIwrVMJ.js → current-value-stream-BphKxe9G.js} +1 -1
  60. package/dist/website/assets/{esm-DmRWC3up.js → esm-DJUTv1_r.js} +1 -1
  61. package/dist/website/assets/{index-CYwddl65.css → index-B_e-5cjt.css} +1 -1
  62. package/dist/website/assets/index-Ifmhd5nI.js +592 -0
  63. package/dist/website/assets/{ledger-connector-zHWvy_21.js → ledger-connector-CMFH1Z0M.js} +3 -3
  64. package/dist/website/assets/{network-DRjEa3NO.js → network-BR2dx0lQ.js} +1 -1
  65. package/dist/website/assets/{polkadot-ledger-transaction-CSI9csNM.js → polkadot-ledger-transaction-CCpzhicj.js} +1 -1
  66. package/dist/website/assets/{safe-connector-B_IWbdsx.js → safe-connector-BDc3OqKV.js} +1 -1
  67. package/dist/website/assets/{solana-connector-DUrUEFXI.js → solana-connector-Ij-Dm1HM.js} +1 -1
  68. package/dist/website/assets/{stellar-connector-D5G2p6aO.js → stellar-connector-C3GFN35d.js} +1 -1
  69. package/dist/website/assets/{substrate-connector-DxgYUQY4.js → substrate-connector-B-LTNtpz.js} +1 -1
  70. package/dist/{bundle/ton-connector-DWz2WVCw.js → website/assets/ton-connector-DnPSYtXm.js} +1 -1
  71. package/dist/{bundle/transaction-BJ3RmuAw.js → website/assets/transaction-BDuN1rLk.js} +2 -2
  72. package/dist/website/assets/{transaction-BIBBEBi6.js → transaction-Cth5mVGJ.js} +1 -1
  73. package/dist/website/assets/transaction-peV0IJTV.js +1 -0
  74. package/dist/website/assets/{tron-connector-C3nKPxdx.js → tron-connector-D_NeRPfc.js} +1 -1
  75. package/dist/website/assets/{utils-DVCp0qSW.js → utils-DOZR2zEE.js} +1 -1
  76. package/dist/website/assets/wagmi-connect-result-DOu6hDDM.js +11 -0
  77. package/dist/website/assets/{wallet-errors-Bvwwydi9.js → wallet-errors-MrbcJr3I.js} +1 -1
  78. package/dist/website/assets/{wallet-manager-9-XcN6SR.js → wallet-manager-DGQAWJIz.js} +3 -3
  79. package/dist/website/index.html +13 -13
  80. package/package.json +12 -11
  81. package/dist/bundle/Result-3MQjLy1V.js +0 -3
  82. package/dist/bundle/Schema-DgreXIef.js +0 -2
  83. package/dist/bundle/transaction-BnkP6nIP.js +0 -1
  84. package/dist/bundle/wagmi-connect-result-CqXaJhOa.js +0 -11
  85. package/dist/website/assets/Result-3MQjLy1V.js +0 -3
  86. package/dist/website/assets/Schema-DgreXIef.js +0 -2
  87. package/dist/website/assets/index-CbH5OQ2T.js +0 -560
  88. package/dist/website/assets/transaction-Sqg4_vo7.js +0 -1
  89. package/dist/website/assets/wagmi-connect-result-CqXaJhOa.js +0 -11
@@ -1,7 +1,41 @@
1
1
  "use client";
2
- import { At as isNotUndefined, Ct as hasProperty, Dt as isFunction, Et as isError, Ft as isString, Gt as dual, Jt as memoize, Lt as isUnknown, Mt as isObject, Nt as isObjectKeyword, Pt as isPropertyKey, Qt as pipeArguments, St as symbol, T as args, Tt as isBoolean, X as assignProperty, Yt as memoizeIdempotent, Zt as Class, _t as hash, bt as string$1, ct as formatPropertyKey, d as succeed$1, ft as equals$1, gt as combine, h as Error$2, it as format$1, jt as isNumber, kt as isNotNullish, l as mapError, mt as symbol$1, ot as formatJson, pt as makeCompareSet, qt as identity, st as formatPath, t as fail$1, tt as NodeInspectSymbol, vt as number$1, wt as isBigInt } from "./Result-Cem4lYBf.js";
3
- import { $t as mapEager, Ar as isFailReason, At as fail$2, Bi as isReadonlyArrayNonEmpty, Ca as isLessThanOrEqualTo$3, Dt as die, Ea as make$7, Fr as effectIsExit, Ft as flatMapEager, In as try_, Ki as Service, Mr as map$4, Mt as failCauseSync, On as succeed$3, Pt as flatMap, Qt as mapBothEager, Rr as iterateEager, Rt as fnUntracedEager, Sn as runSyncExit, Sr as IllegalArgumentError, Ti as append, Ui as map$2, Xr as setStackTraceLimit, Yr as getStackTraceLimit, br as succeed$2, bt as catchCause, da as isSome, fa as liftThrowable, ga as some, gr as failCause, ha as none, hi as millis, hr as fail$3, ki as empty$1, kn as succeedNone, kt as exit, ma as match$1, na as filter$1, pa as map$3, ri as TaggedError$1, tr as currentTimeMillis, ua as isNone, wa as make$8, xa as isGreaterThanOrEqualTo$1, xr as void_, xt as catchEager, ya as Number$4, yr as isSuccess, zi as isArrayNonEmpty, zr as map$1 } from "./wagmi-connect-result-BJ91_jis.js";
4
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/Record.js
2
+ import { Bt as isUnknown, Dt as isBoolean, Et as isBigInt, Ft as isObject, It as isObjectKeyword, Jt as dual, Lt as isPropertyKey, Mt as isNotNullish, Nt as isNotUndefined, Ot as isError, Pt as isNumber, Qt as memoizeIdempotent, Rt as isString, St as string$1, T as args, Tt as hasProperty, Xt as identity, Z as assignProperty, Zt as memoize, _t as array, b as PipeInspectableProto, bt as number$1, d as succeed$1, dt as formatPropertyKey, en as Class, et as getStackTraceLimit, gt as symbol$1, h as Error$2, ht as equals$1, it as NodeInspectSymbol, jt as isNever$1, kt as isFunction, l as mapError, lt as formatJson, nt as BaseProto, st as format$1, t as fail$1, tn as pipeArguments, tt as setStackTraceLimit, ut as formatPath, vt as combine, wt as symbol, yt as hash } from "./Result-BA6lrqKV.js";
3
+ import { $t as mapEager, Ar as isFailReason, At as fail$2, Bi as isReadonlyArrayNonEmpty, Br as map$1, Ca as isLessThanOrEqualTo$3, Da as strictEqual, Dt as die, Ea as make$9, Fr as effectIsExit, Ft as flatMapEager, Gr as resolveConcurrency, Hi as makeEquivalence$2, In as try_, Ki as Service, Mr as map$4, Mt as failCauseSync, On as succeed$3, Pi as fromIterable$1, Pt as flatMap, Qt as mapBothEager, Rr as iterateConcurrent, Rt as fnUntracedEager, Sa as isLessThan$1, Sn as runSyncExit, Sr as IllegalArgumentError, Ta as Tuple$1, Ti as append, Ui as map$2, ba as isGreaterThan$1, br as succeed$2, bt as catchCause, da as isSome, fa as liftThrowable, ga as some, gr as failCause, ha as none, hi as millis, hr as fail$3, ki as empty$2, kn as succeedNone, kt as exit, ma as match$1, na as filter$1, pa as map$3, ri as TaggedError$1, tr as currentTimeMillis, ua as isNone, vi as seconds, wa as make$8, xa as isGreaterThanOrEqualTo$1, xr as void_, xt as catchEager, ya as Number$4, yr as isSuccess, zi as isArrayNonEmpty, zr as iterateEager } from "./wagmi-connect-result-Bh6qH5iI.js";
4
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Tuple.js
5
+ /**
6
+ * Creates an `Equivalence` for tuples by comparing corresponding elements
7
+ * using the provided per-position `Equivalence`s. Two tuples are equivalent
8
+ * when all their corresponding elements are equivalent.
9
+ *
10
+ * **When to use**
11
+ *
12
+ * Use when you need an `Equivalence` to compare tuples element-by-element.
13
+ *
14
+ * **Details**
15
+ *
16
+ * This is an alias of `Equivalence.Tuple`.
17
+ *
18
+ * **Example** (Comparing tuples for equivalence)
19
+ *
20
+ * ```ts import.meta.vitest
21
+ * import { Equivalence, Tuple } from "effect"
22
+ *
23
+ * const eq = Tuple.makeEquivalence([
24
+ * Equivalence.strictEqual<string>(),
25
+ * Equivalence.strictEqual<number>()
26
+ * ])
27
+ *
28
+ * eq(["Alice", 30], ["Alice", 30]) // => true
29
+ * eq(["Alice", 30], ["Bob", 30]) // => false
30
+ * ```
31
+ *
32
+ * @see {@link makeOrder} – create an `Order` for tuples
33
+ * @category instances
34
+ * @since 4.0.0
35
+ */
36
+ var makeEquivalence$1 = Tuple$1;
37
+ //#endregion
38
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Record.js
5
39
  /**
6
40
  * Creates a new, empty record.
7
41
  *
@@ -21,7 +55,7 @@ import { $t as mapEager, Ar as isFailReason, At as fail$2, Bi as isReadonlyArray
21
55
  * @category constructors
22
56
  * @since 2.0.0
23
57
  */
24
- var empty = () => ({});
58
+ var empty$1 = () => ({});
25
59
  /**
26
60
  * Determines if a mutable record is empty.
27
61
  *
@@ -115,7 +149,7 @@ var map = /*#__PURE__*/ dual(2, (self, f) => {
115
149
  * @since 2.0.0
116
150
  */
117
151
  var filter = /*#__PURE__*/ dual(2, (self, predicate) => {
118
- const out = empty();
152
+ const out = empty$1();
119
153
  for (const key of keys(self)) if (predicate(self[key], key)) assignProperty(out, key, self[key]);
120
154
  return out;
121
155
  });
@@ -183,7 +217,7 @@ var isSubrecordBy = (equivalence) => dual(2, (self, that) => {
183
217
  var union$1 = /*#__PURE__*/ dual(3, (self, that, combine) => {
184
218
  if (isEmptyRecord(self)) return { ...that };
185
219
  if (isEmptyRecord(that)) return { ...self };
186
- const out = empty();
220
+ const out = empty$1();
187
221
  for (const key of keys(self)) if (has(that, key)) assignProperty(out, key, combine(self[key], that[key]));
188
222
  else assignProperty(out, key, self[key]);
189
223
  for (const key of keys(that)) if (!has(out, key)) assignProperty(out, key, that[key]);
@@ -212,13 +246,13 @@ var makeEquivalence = (equivalence) => {
212
246
  return (self, that) => is(self, that) && is(that, self);
213
247
  };
214
248
  //#endregion
215
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/internal/dateTime.js
249
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/dateTime.js
216
250
  /** @internal */
217
- var TypeId$6 = "~effect/time/DateTime";
251
+ var TypeId$8 = "~effect/DateTime";
218
252
  /** @internal */
219
- var TimeZoneTypeId = "~effect/time/DateTime/TimeZone";
220
- var Proto = {
221
- [TypeId$6]: TypeId$6,
253
+ var TimeZoneTypeId = "~effect/DateTime/TimeZone";
254
+ var Proto$2 = {
255
+ [TypeId$8]: TypeId$8,
222
256
  pipe() {
223
257
  return pipeArguments(this, arguments);
224
258
  },
@@ -230,7 +264,7 @@ var Proto = {
230
264
  }
231
265
  };
232
266
  var ProtoUtc = {
233
- ...Proto,
267
+ ...Proto$2,
234
268
  _tag: "Utc",
235
269
  [symbol]() {
236
270
  return number$1(this.epochMilliseconds);
@@ -243,7 +277,7 @@ var ProtoUtc = {
243
277
  }
244
278
  };
245
279
  var ProtoZoned = {
246
- ...Proto,
280
+ ...Proto$2,
247
281
  _tag: "Zoned",
248
282
  [symbol]() {
249
283
  return combine(number$1(this.epochMilliseconds))(hash(this.zone));
@@ -305,16 +339,14 @@ var makeZonedProto = (epochMillis, zone, partsUtc) => {
305
339
  return self;
306
340
  };
307
341
  /** @internal */
308
- var isDateTime$1 = (u) => hasProperty(u, TypeId$6);
342
+ var isDateTime$1 = (u) => hasProperty(u, TypeId$8);
309
343
  var isDateTimeArgs = (args) => isDateTime$1(args[0]);
310
344
  /** @internal */
311
345
  var isTimeZone = (u) => hasProperty(u, TimeZoneTypeId);
312
346
  /** @internal */
313
347
  var isUtc$1 = (self) => self._tag === "Utc";
314
348
  /** @internal */
315
- var Equivalence$2 = /*#__PURE__*/ make$7((a, b) => a.epochMilliseconds === b.epochMilliseconds);
316
- /** @internal */
317
- var Order$2 = /*#__PURE__*/ make$8((self, that) => self.epochMilliseconds < that.epochMilliseconds ? -1 : self.epochMilliseconds > that.epochMilliseconds ? 1 : 0);
349
+ var Order$1 = /*#__PURE__*/ make$8((self, that) => self.epochMilliseconds < that.epochMilliseconds ? -1 : self.epochMilliseconds > that.epochMilliseconds ? 1 : 0);
318
350
  var makeUtc = (epochMillis) => {
319
351
  const self = Object.create(ProtoUtc);
320
352
  self.epochMilliseconds = epochMillis;
@@ -326,22 +358,22 @@ var makeUtc = (epochMillis) => {
326
358
  return self;
327
359
  };
328
360
  /** @internal */
329
- var fromDateUnsafe$1 = (date) => {
361
+ var fromDateUnsafe = (date) => {
330
362
  const epochMillis = date.getTime();
331
363
  if (Number.isNaN(epochMillis)) throw new IllegalArgumentError("Invalid date");
332
364
  return makeUtc(epochMillis);
333
365
  };
334
366
  /** @internal */
335
- var makeUnsafe = (input) => {
367
+ var makeUnsafe$1 = (input) => {
336
368
  if (isDateTime$1(input)) return input;
337
- else if (input instanceof Date) return fromDateUnsafe$1(input);
369
+ else if (input instanceof Date) return fromDateUnsafe(input);
338
370
  else if (typeof input === "object") {
339
- if ("epochMilliseconds" in input) return fromDateUnsafe$1(new Date(input.epochMilliseconds));
371
+ if ("epochMilliseconds" in input) return fromDateUnsafe(new Date(input.epochMilliseconds));
340
372
  const date = /* @__PURE__ */ new Date(0);
341
373
  setPartsDate(date, input);
342
- return fromDateUnsafe$1(date);
343
- } else if (typeof input === "string" && !hasZone(input)) return fromDateUnsafe$1(/* @__PURE__ */ new Date(input + "Z"));
344
- return fromDateUnsafe$1(new Date(input));
374
+ return fromDateUnsafe(date);
375
+ } else if (typeof input === "string" && !hasZone(input)) return fromDateUnsafe(/* @__PURE__ */ new Date(input + "Z"));
376
+ return fromDateUnsafe(new Date(input));
345
377
  };
346
378
  /**
347
379
  * Detects whether a date string already contains timezone info.
@@ -352,7 +384,7 @@ var makeUnsafe = (input) => {
352
384
  */
353
385
  var hasZone = (input) => /Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(input);
354
386
  /** @internal */
355
- var make$6 = /*#__PURE__*/ liftThrowable(makeUnsafe);
387
+ var make$7 = /*#__PURE__*/ liftThrowable(makeUnsafe$1);
356
388
  /** @internal */
357
389
  var now$1 = /*#__PURE__*/ map$1(currentTimeMillis, makeUtc);
358
390
  /** @internal */
@@ -387,7 +419,7 @@ var zoneMakeLocal$1 = () => zoneMakeIntl(new Intl.DateTimeFormat("en-US", format
387
419
  /** @internal */
388
420
  var distance$1 = /*#__PURE__*/ dual(2, (self, other) => millis(toEpochMillis$1(other) - toEpochMillis$1(self)));
389
421
  /** @internal */
390
- var isLessThanOrEqualTo$2 = /*#__PURE__*/ isLessThanOrEqualTo$3(Order$2);
422
+ var isLessThanOrEqualTo$2 = /*#__PURE__*/ isLessThanOrEqualTo$3(Order$1);
391
423
  /** @internal */
392
424
  var toDateUtc$1 = (self) => new Date(self.epochMilliseconds);
393
425
  /** @internal */
@@ -444,9 +476,7 @@ var toPartsUtc = (self) => {
444
476
  return self.partsUtc;
445
477
  };
446
478
  var setPartsDate = (date, parts) => {
447
- if (parts.year !== void 0) date.setUTCFullYear(parts.year);
448
- if (parts.month !== void 0) date.setUTCMonth(parts.month - 1);
449
- if (parts.day !== void 0) date.setUTCDate(parts.day);
479
+ if (parts.year !== void 0 || parts.month !== void 0 || parts.day !== void 0) date.setUTCFullYear(parts.year ?? date.getUTCFullYear(), parts.month !== void 0 ? parts.month - 1 : date.getUTCMonth(), parts.day ?? date.getUTCDate());
450
480
  if (parts.weekDay !== void 0) {
451
481
  const diff = parts.weekDay - date.getUTCDay();
452
482
  date.setUTCDate(date.getUTCDate() + diff);
@@ -550,6 +580,11 @@ var subtract$1 = /*#__PURE__*/ dual(2, (self, parts) => {
550
580
  /** @internal */
551
581
  var formatLocal$1 = /*#__PURE__*/ dual(isDateTimeArgs, (self, options) => new Intl.DateTimeFormat(options?.locale, options).format(self.epochMilliseconds));
552
582
  /** @internal */
583
+ var formatUtc$1 = /*#__PURE__*/ dual(isDateTimeArgs, (self, options) => new Intl.DateTimeFormat(options?.locale, {
584
+ ...options,
585
+ timeZone: "UTC"
586
+ }).format(self.epochMilliseconds));
587
+ /** @internal */
553
588
  var formatIso$1 = (self) => toDateUtc$1(self).toISOString();
554
589
  /** @internal */
555
590
  var formatIsoOffset = (self) => {
@@ -643,7 +678,7 @@ var trim$2 = (self) => self.trim();
643
678
  */
644
679
  var startsWith = (searchString, position) => (self) => self.startsWith(searchString, position);
645
680
  //#endregion
646
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/BigDecimal.js
681
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/BigDecimal.js
647
682
  /**
648
683
  * Decimal numbers and arithmetic for cases where JavaScript `number` rounding
649
684
  * is not precise enough. A `BigDecimal` stores digits as a `bigint` plus a
@@ -653,9 +688,9 @@ var startsWith = (searchString, position) => (self) => self.startsWith(searchStr
653
688
  *
654
689
  * @since 2.0.0
655
690
  */
656
- var TypeId$5 = "~effect/BigDecimal";
691
+ var TypeId$7 = "~effect/BigDecimal";
657
692
  var BigDecimalProto = {
658
- [TypeId$5]: TypeId$5,
693
+ [TypeId$7]: TypeId$7,
659
694
  [symbol]() {
660
695
  const normalized = normalize(this);
661
696
  return combine(hash(normalized.value), number$1(normalized.scale));
@@ -702,15 +737,19 @@ var BigDecimalProto = {
702
737
  * @category guards
703
738
  * @since 2.0.0
704
739
  */
705
- var isBigDecimal = (u) => hasProperty(u, TypeId$5);
740
+ var isBigDecimal = (u) => hasProperty(u, TypeId$7);
706
741
  /**
707
- * Creates a `BigDecimal` from a `bigint` value and a scale.
742
+ * Creates a `BigDecimal` from a `bigint` value and a safe integer scale.
708
743
  *
709
744
  * **When to use**
710
745
  *
711
746
  * Use to construct a decimal directly from its unscaled integer value and
712
747
  * decimal scale.
713
748
  *
749
+ * **Gotchas**
750
+ *
751
+ * Throws a `RangeError` if `scale` is not a safe integer.
752
+ *
714
753
  * **Example** (Creating decimals from bigint and scale)
715
754
  *
716
755
  * ```ts import.meta.vitest
@@ -730,7 +769,8 @@ var isBigDecimal = (u) => hasProperty(u, TypeId$5);
730
769
  * @category constructors
731
770
  * @since 2.0.0
732
771
  */
733
- var make$5 = (value, scale) => {
772
+ var make$6 = (value, scale) => {
773
+ if (!Number.isSafeInteger(scale)) throw new RangeError(`Scale must be a safe integer, got ${scale}`);
734
774
  const o = Object.create(BigDecimalProto);
735
775
  o.value = value;
736
776
  o.scale = scale;
@@ -743,11 +783,12 @@ var make$5 = (value, scale) => {
743
783
  */
744
784
  var makeNormalizedUnsafe = (value, scale) => {
745
785
  if (value !== bigint0 && value % bigint10 === bigint0) throw new RangeError("Value must be normalized");
746
- const o = make$5(value, scale);
786
+ const o = make$6(value, scale);
747
787
  o.normalized = o;
748
788
  return o;
749
789
  };
750
790
  var bigint0 = /*#__PURE__*/ BigInt(0);
791
+ var bigint1 = /*#__PURE__*/ BigInt(1);
751
792
  var bigint10 = /*#__PURE__*/ BigInt(10);
752
793
  var zero = /*#__PURE__*/ makeNormalizedUnsafe(bigint0, 0);
753
794
  /**
@@ -789,45 +830,55 @@ var normalize = (self) => {
789
830
  }
790
831
  return self.normalized;
791
832
  };
833
+ var MAX_COMPARISON_SCALE_ALIGNMENT = 100;
834
+ var comparisonPowersOfTen = [bigint1];
835
+ var compareBigInt = (self, that) => self === that ? 0 : self < that ? -1 : 1;
836
+ var compareMagnitude = (self, that) => {
837
+ const selfDigits = `${self.value < bigint0 ? -self.value : self.value}`;
838
+ const thatDigits = `${that.value < bigint0 ? -that.value : that.value}`;
839
+ const exponentDifference = BigInt(selfDigits.length - thatDigits.length) - BigInt(self.scale) + BigInt(that.scale);
840
+ if (exponentDifference !== bigint0) return exponentDifference < bigint0 ? -1 : 1;
841
+ const length = Math.max(selfDigits.length, thatDigits.length);
842
+ for (let i = 0; i < length; i++) {
843
+ const selfDigit = i < selfDigits.length ? selfDigits.charCodeAt(i) : 48;
844
+ const thatDigit = i < thatDigits.length ? thatDigits.charCodeAt(i) : 48;
845
+ if (selfDigit !== thatDigit) return selfDigit < thatDigit ? -1 : 1;
846
+ }
847
+ return 0;
848
+ };
849
+ var compare = (self, that) => {
850
+ if (self.scale === that.scale) return compareBigInt(self.value, that.value);
851
+ const selfSign = sign(self);
852
+ const thatSign = sign(that);
853
+ if (selfSign !== thatSign) return selfSign < thatSign ? -1 : 1;
854
+ if (selfSign === 0) return 0;
855
+ const scaleDifference = self.scale - that.scale;
856
+ const absoluteScaleDifference = Math.abs(scaleDifference);
857
+ if (absoluteScaleDifference > MAX_COMPARISON_SCALE_ALIGNMENT) return selfSign === -1 ? compareMagnitude(that, self) : compareMagnitude(self, that);
858
+ const powerOfTen = comparisonPowersOfTen[absoluteScaleDifference] ??= bigint10 ** BigInt(absoluteScaleDifference);
859
+ return scaleDifference > 0 ? compareBigInt(self.value, that.value * powerOfTen) : compareBigInt(self.value * powerOfTen, that.value);
860
+ };
792
861
  /**
793
- * Changes a `BigDecimal` to the specified scale.
862
+ * Determines the sign of a given `BigDecimal`.
794
863
  *
795
864
  * **When to use**
796
865
  *
797
- * Use to change how many decimal places are represented by a `BigDecimal`.
798
- *
799
- * **Details**
800
- *
801
- * Increasing the scale appends decimal zeros. Decreasing the scale discards
802
- * digits beyond the target scale by `bigint` division, which truncates toward
803
- * zero.
866
+ * Use to classify a `BigDecimal` as negative, zero, or positive.
804
867
  *
805
- * **Example** (Scaling decimal precision)
868
+ * **Example** (Reading decimal signs)
806
869
  *
807
870
  * ```ts import.meta.vitest
808
871
  * import { BigDecimal } from "effect"
809
872
  *
810
- * const decimal = BigDecimal.fromNumberUnsafe(123.45)
811
- *
812
- * // Increase scale (add more precision)
813
- * const scaled = BigDecimal.scale(decimal, 4)
814
- * const scaledStorage = [scaled.value, scaled.scale] // => [1234500n, 4]
815
- *
816
- * // Decrease scale (reduce precision, truncating toward zero)
817
- * const reduced = BigDecimal.scale(decimal, 1)
818
- * reduced // => BigDecimal.fromStringUnsafe("123.4")
873
+ * BigDecimal.sign(BigDecimal.fromStringUnsafe("-5")) // => -1
874
+ * BigDecimal.sign(BigDecimal.fromStringUnsafe("0")) // => 0
875
+ * BigDecimal.sign(BigDecimal.fromStringUnsafe("5")) // => 1
819
876
  * ```
820
877
  *
821
- * @see {@link round} for changing scale with configurable rounding
822
- *
823
- * @category scaling
878
+ * @category math
824
879
  * @since 2.0.0
825
880
  */
826
- var scale = /*#__PURE__*/ dual(2, (self, scale) => {
827
- if (scale > self.scale) return make$5(self.value * bigint10 ** BigInt(scale - self.scale), scale);
828
- if (scale < self.scale) return make$5(self.value / bigint10 ** BigInt(self.scale - scale), scale);
829
- return self;
830
- });
881
+ var sign = (n) => n.value === bigint0 ? 0 : n.value < bigint0 ? -1 : 1;
831
882
  /**
832
883
  * Determines the absolute value of a given `BigDecimal`.
833
884
  *
@@ -848,7 +899,7 @@ var scale = /*#__PURE__*/ dual(2, (self, scale) => {
848
899
  * @category math
849
900
  * @since 2.0.0
850
901
  */
851
- var abs = (n) => n.value < bigint0 ? make$5(-n.value, n.scale) : n;
902
+ var abs = (n) => n.value < bigint0 ? make$6(-n.value, n.scale) : n;
852
903
  /**
853
904
  * Provides an `Equivalence` instance for `BigDecimal` that determines equality between BigDecimal values.
854
905
  *
@@ -873,11 +924,7 @@ var abs = (n) => n.value < bigint0 ? make$5(-n.value, n.scale) : n;
873
924
  * @category instances
874
925
  * @since 2.0.0
875
926
  */
876
- var Equivalence$1 = /*#__PURE__*/ make$7((self, that) => {
877
- if (self.scale > that.scale) return scale(that, self.scale).value === self.value;
878
- if (self.scale < that.scale) return scale(self, that.scale).value === that.value;
879
- return self.value === that.value;
880
- });
927
+ var Equivalence$1 = /*#__PURE__*/ make$9((self, that) => compare(self, that) === 0);
881
928
  /**
882
929
  * Checks whether two `BigDecimal`s are equal.
883
930
  *
@@ -1029,7 +1076,7 @@ var isZero = (n) => n.value === bigint0;
1029
1076
  */
1030
1077
  var isNegative = (n) => n.value < bigint0;
1031
1078
  //#endregion
1032
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/DateTime.js
1079
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/DateTime.js
1033
1080
  /**
1034
1081
  * Checks whether a value is a `DateTime`.
1035
1082
  *
@@ -1060,75 +1107,40 @@ var isDateTime = isDateTime$1;
1060
1107
  */
1061
1108
  var isUtc = isUtc$1;
1062
1109
  /**
1063
- * Provides an `Equivalence` for comparing two `DateTime` values for equality.
1064
- *
1065
- * **Details**
1066
- *
1067
- * Two `DateTime` values are considered equivalent if they represent the same
1068
- * point in time, regardless of their time zone.
1069
- *
1070
- * **Example** (Comparing DateTime values for equivalence)
1071
- *
1072
- * ```ts import.meta.vitest
1073
- * import { DateTime } from "effect"
1074
- *
1075
- * const utc = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
1076
- * const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
1077
- * timeZone: "Europe/London"
1078
- * })
1110
+ * Create a `DateTime` from supported input values.
1079
1111
  *
1080
- * DateTime.Equivalence(utc, zoned) // => true
1081
- * ```
1112
+ * **When to use**
1082
1113
  *
1083
- * @category instances
1084
- * @since 3.6.0
1085
- */
1086
- var Equivalence = Equivalence$2;
1087
- /**
1088
- * Provides an `Order` for comparing and sorting `DateTime` values.
1114
+ * Use when creating a `DateTime` from trusted input and construction failures
1115
+ * should throw an `IllegalArgumentError` instead of returning `Option.none`.
1089
1116
  *
1090
1117
  * **Details**
1091
1118
  *
1092
- * `DateTime` values are ordered by their epoch milliseconds, so earlier times
1093
- * come before later times regardless of time zone.
1119
+ * - A `DateTime`
1120
+ * - A `Date` instance (invalid dates will throw an `IllegalArgumentError`)
1121
+ * - The `number` of milliseconds since the Unix epoch
1122
+ * - An object with the parts of a date
1123
+ * - A `string` that can be parsed by `Date.parse`
1094
1124
  *
1095
- * **Example** (Sorting DateTime values chronologically)
1125
+ * **Example** (Creating DateTime values unsafely)
1096
1126
  *
1097
1127
  * ```ts import.meta.vitest
1098
- * import { Array, DateTime } from "effect"
1099
- *
1100
- * const dates = [
1101
- * DateTime.makeUnsafe("2024-03-01"),
1102
- * DateTime.makeUnsafe("2024-01-01"),
1103
- * DateTime.makeUnsafe("2024-02-01")
1104
- * ]
1105
- *
1106
- * Array.sort(dates, DateTime.Order).map(DateTime.formatIsoDateUtc) // => ["2024-01-01", "2024-02-01", "2024-03-01"]
1107
- * ```
1108
- *
1109
- * @category instances
1110
- * @since 3.6.0
1111
- */
1112
- var Order = Order$2;
1113
- /**
1114
- * Create a `DateTime` from a `Date`.
1115
- *
1116
- * **Details**
1117
- *
1118
- * If the `Date` is invalid, an `IllegalArgumentError` will be thrown.
1128
+ * import { DateTime } from "effect"
1119
1129
  *
1120
- * **Example** (Creating DateTime values from Dates)
1130
+ * // from Date
1131
+ * DateTime.makeUnsafe(new Date("2024-01-01T12:00:00Z")) // => DateTime.makeUnsafe("2024-01-01T12:00:00Z")
1121
1132
  *
1122
- * ```ts import.meta.vitest
1123
- * import { DateTime } from "effect"
1133
+ * // from parts
1134
+ * DateTime.makeUnsafe({ year: 2024 }) // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
1124
1135
  *
1125
- * DateTime.fromDateUnsafe(new Date("2024-01-01T12:00:00Z")) // => DateTime.makeUnsafe("2024-01-01T12:00:00Z")
1136
+ * // from string
1137
+ * DateTime.makeUnsafe("2024-01-01") // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
1126
1138
  * ```
1127
1139
  *
1128
1140
  * @category constructors
1129
1141
  * @since 4.0.0
1130
1142
  */
1131
- var fromDateUnsafe = fromDateUnsafe$1;
1143
+ var makeUnsafe = makeUnsafe$1;
1132
1144
  /**
1133
1145
  * Creates a `DateTime` safely from supported input values.
1134
1146
  *
@@ -1164,7 +1176,7 @@ var fromDateUnsafe = fromDateUnsafe$1;
1164
1176
  * @category constructors
1165
1177
  * @since 3.6.0
1166
1178
  */
1167
- var make$4 = make$6;
1179
+ var make$5 = make$7;
1168
1180
  /**
1169
1181
  * Gets the current time using the `Clock` service and converts it to a `DateTime`.
1170
1182
  *
@@ -1321,29 +1333,6 @@ var distance = distance$1;
1321
1333
  */
1322
1334
  var isLessThanOrEqualTo$1 = isLessThanOrEqualTo$2;
1323
1335
  /**
1324
- * Gets the UTC `Date` of a `DateTime`.
1325
- *
1326
- * **Details**
1327
- *
1328
- * This always returns the UTC representation, ignoring any time zone information.
1329
- *
1330
- * **Example** (Converting DateTime values to UTC Dates)
1331
- *
1332
- * ```ts import.meta.vitest
1333
- * import { DateTime } from "effect"
1334
- *
1335
- * const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
1336
- * timeZone: "Europe/London"
1337
- * })
1338
- *
1339
- * DateTime.toDateUtc(dt).toISOString() // => "2024-01-01T12:00:00.000Z"
1340
- * ```
1341
- *
1342
- * @category converting
1343
- * @since 3.6.0
1344
- */
1345
- var toDateUtc = toDateUtc$1;
1346
- /**
1347
1336
  * Gets the milliseconds since the Unix epoch of a `DateTime`.
1348
1337
  *
1349
1338
  * **Details**
@@ -1430,6 +1419,37 @@ var subtract = subtract$1;
1430
1419
  */
1431
1420
  var formatLocal = formatLocal$1;
1432
1421
  /**
1422
+ * Formats a `DateTime` with `Intl.DateTimeFormat` using the UTC time zone.
1423
+ *
1424
+ * **Details**
1425
+ *
1426
+ * This forces the time zone to be UTC.
1427
+ *
1428
+ * **Example** (Formatting DateTime values in UTC)
1429
+ *
1430
+ * ```ts import.meta.vitest
1431
+ * import { DateTime } from "effect"
1432
+ *
1433
+ * const dt = DateTime.makeZonedUnsafe("2024-06-15T14:30:00Z", {
1434
+ * timeZone: "Europe/London"
1435
+ * })
1436
+ *
1437
+ * // Force UTC formatting regardless of time zone
1438
+ * DateTime.formatUtc(dt, {
1439
+ * year: "numeric",
1440
+ * month: "2-digit",
1441
+ * day: "2-digit",
1442
+ * hour: "2-digit",
1443
+ * minute: "2-digit",
1444
+ * timeZoneName: "short"
1445
+ * })
1446
+ * ```
1447
+ *
1448
+ * @category formatting
1449
+ * @since 3.6.0
1450
+ */
1451
+ var formatUtc = formatUtc$1;
1452
+ /**
1433
1453
  * Formats a `DateTime` as a UTC ISO string.
1434
1454
  *
1435
1455
  * **Details**
@@ -1454,7 +1474,7 @@ var formatLocal = formatLocal$1;
1454
1474
  */
1455
1475
  var formatIso = formatIso$1;
1456
1476
  //#endregion
1457
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/internal/schema/annotations.js
1477
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/annotations.js
1458
1478
  /** @internal */
1459
1479
  function resolve(ast) {
1460
1480
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
@@ -1478,15 +1498,21 @@ var getExpected = /*#__PURE__*/ memoize((ast) => {
1478
1498
  return ast.getExpected(getExpected);
1479
1499
  });
1480
1500
  //#endregion
1481
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/internal/schema/parser.js
1501
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/parser.js
1502
+ /** @internal */
1482
1503
  var missing = /*#__PURE__*/ Symbol();
1504
+ /** @internal */
1483
1505
  var succeed = succeed$2;
1506
+ /** @internal */
1484
1507
  var missingExit = /*#__PURE__*/ succeed(missing);
1508
+ /** @internal */
1485
1509
  var sameExit = /*#__PURE__*/ succeed(missing);
1510
+ /** @internal */
1486
1511
  var toOption = (value) => value === missing ? none() : some(value);
1512
+ /** @internal */
1487
1513
  var fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed(option.value);
1488
1514
  //#endregion
1489
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/SchemaIssue.js
1515
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaIssue.js
1490
1516
  /**
1491
1517
  * Describes problems found while decoding, encoding, or checking data with
1492
1518
  * schemas.
@@ -1498,7 +1524,7 @@ var fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed(
1498
1524
  *
1499
1525
  * @since 4.0.0
1500
1526
  */
1501
- var TypeId$4 = "~effect/SchemaIssue/Issue";
1527
+ var TypeId$6 = "~effect/SchemaIssue/Issue";
1502
1528
  /**
1503
1529
  * Returns `true` if the given value is an {@link Issue}.
1504
1530
  *
@@ -1528,7 +1554,7 @@ var TypeId$4 = "~effect/SchemaIssue/Issue";
1528
1554
  * @since 4.0.0
1529
1555
  */
1530
1556
  function isIssue(u) {
1531
- return hasProperty(u, TypeId$4) && u[TypeId$4] === TypeId$4;
1557
+ return hasProperty(u, TypeId$6) && u[TypeId$6] === TypeId$6;
1532
1558
  }
1533
1559
  /**
1534
1560
  * Returns `true` when an issue contains an input reported by the schema parser.
@@ -1562,53 +1588,19 @@ function isIssue(u) {
1562
1588
  function hasInput(issue) {
1563
1589
  return Object.hasOwn(issue, "input");
1564
1590
  }
1565
- var Base$1 = class {
1566
- [TypeId$4] = TypeId$4;
1591
+ var IssueNodeImpl = class {
1592
+ [TypeId$6] = TypeId$6;
1567
1593
  constructor(input, options) {
1568
1594
  if (options?.reportInput === true && input !== missing) this.input = input;
1569
1595
  }
1570
1596
  };
1571
1597
  /**
1572
- * Represents a schema issue produced when a schema filter (refinement check) fails.
1573
- *
1574
- * **When to use**
1575
- *
1576
- * Use when you need to inspect a schema issue that records which refinement
1577
- * check rejected the value.
1578
- *
1579
- * **Details**
1580
- *
1581
- * - `filter` is the AST filter node that produced this issue.
1582
- * - `issue` is the inner issue describing the failure reason.
1583
- *
1584
- * **Example** (Matching a Filter issue)
1585
- *
1586
- * ```ts import.meta.vitest
1587
- * import { SchemaAST, SchemaIssue } from "effect"
1588
- *
1589
- * const formatIssue = SchemaIssue.makeFormatterDefault()
1590
- *
1591
- * function describe(issue: SchemaIssue.Issue): string {
1592
- * if (issue._tag === "Filter") {
1593
- * return `Filter failed: ${formatIssue(issue.issue)}`
1594
- * }
1595
- * return formatIssue(issue)
1596
- * }
1597
- *
1598
- * const issue = new SchemaIssue.Filter(
1599
- * SchemaAST.isPattern(/^valid$/),
1600
- * new SchemaIssue.InvalidValue()
1601
- * )
1602
- * describe(issue) // => `Filter failed: Expected a valid value`
1603
- * ```
1598
+ * Constructs a schema issue for a failed refinement check.
1604
1599
  *
1605
- * @see {@link Leaf} — terminal issue types that commonly appear as the inner `issue`
1606
- * @see {@link CheckHook} — formatter hook for `Filter` issues
1607
- *
1608
- * @category models
1600
+ * @category constructors
1609
1601
  * @since 4.0.0
1610
1602
  */
1611
- var Filter$1 = class extends Base$1 {
1603
+ var Filter$1 = class extends IssueNodeImpl {
1612
1604
  _tag = "Filter";
1613
1605
  /**
1614
1606
  * The filter that failed.
@@ -1625,25 +1617,12 @@ var Filter$1 = class extends Base$1 {
1625
1617
  }
1626
1618
  };
1627
1619
  /**
1628
- * Represents a schema issue produced when a schema transformation (encode/decode step) fails.
1629
- *
1630
- * **When to use**
1620
+ * Constructs a schema issue for a failed transformation.
1631
1621
  *
1632
- * Use when you need to inspect failures from `Schema.decodeTo` / `Schema.encodeTo`
1633
- * transformations.
1634
- *
1635
- * **Details**
1636
- *
1637
- * - `ast` is the AST node for the transformation that failed.
1638
- * - `issue` is the inner issue describing the failure.
1639
- *
1640
- * @see {@link Filter} — failure from a refinement check (not a transformation)
1641
- * @see {@link Composite} — multiple issues from a single schema node
1642
- *
1643
- * @category models
1622
+ * @category constructors
1644
1623
  * @since 4.0.0
1645
1624
  */
1646
- var Encoding = class extends Base$1 {
1625
+ var Encoding = class extends IssueNodeImpl {
1647
1626
  _tag = "Encoding";
1648
1627
  /**
1649
1628
  * The schema that caused the issue.
@@ -1660,26 +1639,12 @@ var Encoding = class extends Base$1 {
1660
1639
  }
1661
1640
  };
1662
1641
  /**
1663
- * Wraps an inner {@link Issue} with a property-key path, indicating *where* in
1664
- * a nested structure the error occurred.
1665
- *
1666
- * **When to use**
1642
+ * Constructs a schema issue that points to a nested location.
1667
1643
  *
1668
- * Use when you need to walk the issue tree to accumulate path segments for error
1669
- * reporting.
1670
- *
1671
- * **Details**
1672
- *
1673
- * - `path` is an array of property keys (strings, numbers, or symbols).
1674
- * - Formatters concatenate nested `Pointer` paths into a single path like
1675
- * `["a"]["b"][0]`.
1676
- *
1677
- * @see {@link Composite} — groups multiple issues under one schema node
1678
- *
1679
- * @category models
1680
- * @since 3.10.0
1644
+ * @category constructors
1645
+ * @since 4.0.0
1681
1646
  */
1682
- var Pointer = class extends Base$1 {
1647
+ var Pointer = class extends IssueNodeImpl {
1683
1648
  _tag = "Pointer";
1684
1649
  /**
1685
1650
  * The path to the location in the input that caused the issue.
@@ -1696,23 +1661,12 @@ var Pointer = class extends Base$1 {
1696
1661
  }
1697
1662
  };
1698
1663
  /**
1699
- * Represents a schema issue produced when a required key or tuple index is missing from the input.
1664
+ * Constructs a schema issue for a missing key or tuple index.
1700
1665
  *
1701
- * **When to use**
1702
- *
1703
- * Use when you need to detect absent fields in struct/tuple validation.
1704
- *
1705
- * **Details**
1706
- *
1707
- * - `annotations` may contain a custom `messageMissingKey` for formatting.
1708
- *
1709
- * @see {@link Pointer} — wraps this issue with the missing key's path
1710
- * @see {@link UnexpectedKey} — the opposite case (extra key present)
1711
- *
1712
- * @category models
1666
+ * @category constructors
1713
1667
  * @since 4.0.0
1714
1668
  */
1715
- var MissingKey = class extends Base$1 {
1669
+ var MissingKey = class extends IssueNodeImpl {
1716
1670
  _tag = "MissingKey";
1717
1671
  /**
1718
1672
  * The metadata for the issue.
@@ -1724,28 +1678,12 @@ var MissingKey = class extends Base$1 {
1724
1678
  }
1725
1679
  };
1726
1680
  /**
1727
- * Represents a schema issue produced when an input object or tuple contains a key/index not
1728
- * declared by the schema.
1681
+ * Constructs a schema issue for an unexpected key or tuple index.
1729
1682
  *
1730
- * **When to use**
1731
- *
1732
- * Use when you need to detect excess properties during strict struct/tuple
1733
- * validation.
1734
- *
1735
- * **Details**
1736
- *
1737
- * - `ast` is the schema that was being validated against.
1738
- * - `annotations` on `ast` may contain a custom `messageUnexpectedKey`.
1739
- * - The default formatter renders this as `"Expected no excess property"`, or
1740
- * `"Unexpected key with value <input>"` when the issue reports an input.
1741
- *
1742
- * @see {@link MissingKey} — the opposite case (required key absent)
1743
- * @see {@link Pointer} — wraps this issue with the unexpected key's path
1744
- *
1745
- * @category models
1683
+ * @category constructors
1746
1684
  * @since 4.0.0
1747
1685
  */
1748
- var UnexpectedKey = class extends Base$1 {
1686
+ var UnexpectedKey = class extends IssueNodeImpl {
1749
1687
  _tag = "UnexpectedKey";
1750
1688
  /**
1751
1689
  * The schema that caused the issue.
@@ -1757,25 +1695,12 @@ var UnexpectedKey = class extends Base$1 {
1757
1695
  }
1758
1696
  };
1759
1697
  /**
1760
- * Represents a schema issue that groups multiple child issues under a single schema node.
1698
+ * Constructs a schema issue that groups multiple child issues.
1761
1699
  *
1762
- * **When to use**
1763
- *
1764
- * Use when you need to walk the issue tree for struct/tuple schemas that collect
1765
- * all field errors rather than failing on the first.
1766
- *
1767
- * **Details**
1768
- *
1769
- * - `issues` is a non-empty readonly array (at least one child).
1770
- * - Formatters flatten `Composite` by recursing into each child.
1771
- *
1772
- * @see {@link AnyOf} — used for union no-match errors (similar but different semantics)
1773
- * @see {@link Pointer} — adds path context to individual issues
1774
- *
1775
- * @category models
1776
- * @since 3.10.0
1700
+ * @category constructors
1701
+ * @since 4.0.0
1777
1702
  */
1778
- var Composite = class extends Base$1 {
1703
+ var Composite = class extends IssueNodeImpl {
1779
1704
  _tag = "Composite";
1780
1705
  /**
1781
1706
  * The schema that caused the issue.
@@ -1792,36 +1717,12 @@ var Composite = class extends Base$1 {
1792
1717
  }
1793
1718
  };
1794
1719
  /**
1795
- * Represents a schema issue produced when the runtime type of the input does not match the type
1796
- * expected by the schema.
1797
- *
1798
- * **When to use**
1799
- *
1800
- * Use when you need to detect basic type mismatches, such as a wrong primitive
1801
- * or `null` where an object was expected.
1802
- *
1803
- * **Details**
1804
- *
1805
- * - `ast` is the schema node that expected a different type.
1806
- * - The default formatter renders this as `"Expected <type>"`, adding
1807
- * `", got <input>"` when the issue reports an input.
1720
+ * Constructs a schema issue for an input with an invalid runtime type.
1808
1721
  *
1809
- * **Example** (Formatting a type mismatch)
1810
- *
1811
- * ```ts import.meta.vitest
1812
- * import { Schema, SchemaIssue } from "effect"
1813
- *
1814
- * const formatIssue = SchemaIssue.makeFormatterDefault()
1815
- * const issue = new SchemaIssue.InvalidType(Schema.String.ast)
1816
- * formatIssue(issue) // => "Expected string"
1817
- * ```
1818
- *
1819
- * @see {@link InvalidValue} — the input has the right type but fails a value constraint
1820
- *
1821
- * @category models
1722
+ * @category constructors
1822
1723
  * @since 4.0.0
1823
1724
  */
1824
- var InvalidType = class extends Base$1 {
1725
+ var InvalidType = class extends IssueNodeImpl {
1825
1726
  _tag = "InvalidType";
1826
1727
  /**
1827
1728
  * The schema that caused the issue.
@@ -1833,41 +1734,12 @@ var InvalidType = class extends Base$1 {
1833
1734
  }
1834
1735
  };
1835
1736
  /**
1836
- * Represents a schema issue produced when the input has the correct type but its value violates a
1837
- * constraint (e.g. a string that is too short, a number out of range).
1838
- *
1839
- * **When to use**
1840
- *
1841
- * Use when you need to detect constraint violations from `Schema.filter`,
1842
- * `Schema.minLength`, `Schema.greaterThan`, or similar checks.
1843
- *
1844
- * **Details**
1845
- *
1846
- * - A `message` annotation is returned unchanged and takes precedence over all
1847
- * other default formatting.
1848
- * - Without `message`, an `expected` annotation is formatted as
1849
- * `"Expected <expected>"`, adding `", got <input>"` when input is reported.
1850
- * - Without either annotation, the default formatter renders
1851
- * `"Expected a valid value"`, or `"Invalid data <input>"` when input is
1852
- * reported.
1853
- *
1854
- * **Example** (Returning InvalidValue from a custom filter)
1855
- *
1856
- * ```ts import.meta.vitest
1857
- * import { SchemaIssue } from "effect"
1858
- *
1859
- * const formatIssue = SchemaIssue.makeFormatterDefault()
1860
- * const issue = new SchemaIssue.InvalidValue({ message: "must not be empty" })
1861
- * formatIssue(issue) // => "must not be empty"
1862
- * ```
1863
- *
1864
- * @see {@link InvalidType} — the input has the wrong type entirely
1865
- * @see {@link Filter} — composite wrapper when a schema filter produces this issue
1737
+ * Constructs a schema issue for a value that violates a constraint.
1866
1738
  *
1867
- * @category models
1739
+ * @category constructors
1868
1740
  * @since 4.0.0
1869
1741
  */
1870
- var InvalidValue = class extends Base$1 {
1742
+ var InvalidValue = class extends IssueNodeImpl {
1871
1743
  _tag = "InvalidValue";
1872
1744
  /**
1873
1745
  * The metadata for the issue.
@@ -1883,37 +1755,12 @@ function makeCompositeAtKey(compositeAst, pointerKey, pointerIssue, compositeInp
1883
1755
  return new Composite(compositeAst, [new Pointer([pointerKey], pointerIssue)], compositeInput, parseOptions);
1884
1756
  }
1885
1757
  /**
1886
- * Represents a schema issue produced when a forbidden operation is encountered during parsing,
1887
- * such as an asynchronous Effect running inside `Schema.decodeUnknownSync`.
1888
- *
1889
- * **When to use**
1890
- *
1891
- * Use when you need to detect that a schema requires async execution but was run
1892
- * synchronously.
1758
+ * Constructs a schema issue for a forbidden parsing operation.
1893
1759
  *
1894
- * **Details**
1895
- *
1896
- * - `annotations` optionally carries a `message` string.
1897
- * - The default formatter renders this as `"Forbidden operation"`.
1898
- *
1899
- * **Example** (Creating a Forbidden issue)
1900
- *
1901
- * ```ts import.meta.vitest
1902
- * import { SchemaIssue } from "effect"
1903
- *
1904
- * const formatIssue = SchemaIssue.makeFormatterDefault()
1905
- * const issue = new SchemaIssue.Forbidden(
1906
- * { message: "async operation not allowed in sync context" }
1907
- * )
1908
- * formatIssue(issue) // => "async operation not allowed in sync context"
1909
- * ```
1910
- *
1911
- * @see {@link InvalidValue} — for value-constraint failures (not operation failures)
1912
- *
1913
- * @category models
1914
- * @since 3.10.0
1760
+ * @category constructors
1761
+ * @since 4.0.0
1915
1762
  */
1916
- var Forbidden = class extends Base$1 {
1763
+ var Forbidden = class extends IssueNodeImpl {
1917
1764
  _tag = "Forbidden";
1918
1765
  /**
1919
1766
  * The metadata for the issue.
@@ -1925,31 +1772,12 @@ var Forbidden = class extends Base$1 {
1925
1772
  }
1926
1773
  };
1927
1774
  /**
1928
- * Represents a schema issue produced when a value does not match *any* member of a union schema.
1929
- *
1930
- * **When to use**
1775
+ * Constructs a schema issue for a value that matches no union member.
1931
1776
  *
1932
- * Use when you need to inspect which union members were attempted and why each
1933
- * failed.
1934
- *
1935
- * **Details**
1936
- *
1937
- * - `ast` is the `Union` AST node.
1938
- * - `issues` contains the per-member failures.
1939
- *
1940
- * **Gotchas**
1941
- *
1942
- * `issues` is empty when no union member was applicable. In that case, the
1943
- * default formatter reports the expected type for the union and appends
1944
- * `", got <input>"` when input is reported.
1945
- *
1946
- * @see {@link OneOf} — the opposite: *too many* members matched
1947
- * @see {@link Composite} — groups multiple issues under a non-union schema
1948
- *
1949
- * @category models
1777
+ * @category constructors
1950
1778
  * @since 4.0.0
1951
1779
  */
1952
- var AnyOf = class extends Base$1 {
1780
+ var AnyOf = class extends IssueNodeImpl {
1953
1781
  _tag = "AnyOf";
1954
1782
  /**
1955
1783
  * The schema that caused the issue.
@@ -1966,29 +1794,12 @@ var AnyOf = class extends Base$1 {
1966
1794
  }
1967
1795
  };
1968
1796
  /**
1969
- * Represents a schema issue produced when a value matches *multiple* members of a union that is
1970
- * configured to allow exactly one match (oneOf mode).
1971
- *
1972
- * **When to use**
1973
- *
1974
- * Use when you need to detect ambiguous union matches when `oneOf` validation is
1975
- * enabled.
1976
- *
1977
- * **Details**
1978
- *
1979
- * - `ast` is the `Union` AST node.
1980
- * - `successes` lists the AST nodes of each member that accepted the input.
1981
- * - The default formatter renders this as
1982
- * `"Expected exactly one member to match"`, or
1983
- * `"Expected exactly one member to match the input <input>"` when input is
1984
- * reported.
1985
- *
1986
- * @see {@link AnyOf} — the opposite: *no* members matched
1797
+ * Constructs a schema issue for a value that matches multiple union members.
1987
1798
  *
1988
- * @category models
1799
+ * @category constructors
1989
1800
  * @since 4.0.0
1990
1801
  */
1991
- var OneOf = class extends Base$1 {
1802
+ var OneOf = class extends IssueNodeImpl {
1992
1803
  _tag = "OneOf";
1993
1804
  /**
1994
1805
  * The schema that caused the issue.
@@ -2278,7 +2089,7 @@ function findMessage(issue) {
2278
2089
  if (typeof message === "string") return message;
2279
2090
  }
2280
2091
  //#endregion
2281
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/internal/schema/cause.js
2092
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/cause.js
2282
2093
  /** @internal */
2283
2094
  function getSchemaIssue(cause) {
2284
2095
  let issue;
@@ -2295,58 +2106,14 @@ function getSchemaIssueOrThrow(cause, message) {
2295
2106
  return issue;
2296
2107
  }
2297
2108
  //#endregion
2298
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/SchemaGetter.js
2109
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaGetter.js
2299
2110
  /**
2300
- * Builds one-way conversions used by schemas.
2301
- *
2302
- * A `Getter<T, E, R>` receives an optional encoded value and returns an
2303
- * optional decoded value. It can also report a schema issue or require Effect
2304
- * services. Schema transformations use getters to describe one direction of a
2305
- * conversion, for example decoding a field from input data. This module
2306
- * includes basic getters, validation helpers, pure and effectful conversions,
2307
- * and ready-made conversions for common string, number, binary, date, form, and
2308
- * URL-related values.
2111
+ * Constructs a composable schema getter.
2309
2112
  *
2113
+ * @category constructors
2310
2114
  * @since 4.0.0
2311
2115
  */
2312
- /**
2313
- * Represents a composable transformation from an encoded type `E` to a decoded type `T`.
2314
- *
2315
- * **When to use**
2316
- *
2317
- * Use when you need a schema getter to build and compose custom transformations
2318
- * for `Schema.decodeTo` or `Schema.decode`.
2319
- *
2320
- * **Details**
2321
- *
2322
- * A getter wraps a function `Option<E> -> Effect<Option<T>, Issue, R>`. It
2323
- * receives `Option.None` when the encoded key is absent, such as a missing
2324
- * struct field, and returns `Option.None` to omit the value from the decoded
2325
- * output. It fails with `Issue` on invalid input and may require Effect
2326
- * services via `R`. `.map(f)` applies `f` to the decoded value inside `Some`
2327
- * while leaving `None` unchanged. `.compose(other)` chains two getters by
2328
- * feeding the output of `this` into `other`; passthrough getters on either side
2329
- * are optimized away.
2330
- *
2331
- * **Example** (Creating and composing getters)
2332
- *
2333
- * ```ts import.meta.vitest
2334
- * import { Effect, Option, SchemaGetter } from "effect"
2335
- *
2336
- * const parseNumber = SchemaGetter.transform<number, string>((s) => Number(s))
2337
- * const double = SchemaGetter.transform<number, number>((n) => n * 2)
2338
- * const composed = parseNumber.compose(double)
2339
- * await Effect.runPromise(composed.run(Option.some("21"), {})) // => Option.some(42)
2340
- * ```
2341
- *
2342
- * @see {@link transform} to create a getter from a pure function
2343
- * @see {@link passthrough} for the identity getter
2344
- * @see {@link transformOrFail} for fallible transformation
2345
- *
2346
- * @category models
2347
- * @since 4.0.0
2348
- */
2349
- var Getter = class Getter extends Class {
2116
+ var Getter = class extends Class {
2350
2117
  run;
2351
2118
  constructor(run) {
2352
2119
  super();
@@ -2433,6 +2200,35 @@ function forbidden(message) {
2433
2200
  return isSome(oe) ? new Forbidden(annotations, oe.value, options) : new Forbidden(annotations);
2434
2201
  });
2435
2202
  }
2203
+ /**
2204
+ * Getter that always fails with a `Forbidden` issue indicating that encoding is unsupported.
2205
+ *
2206
+ * **When to use**
2207
+ *
2208
+ * Use as the encode side of a decode-only Schema transformation.
2209
+ *
2210
+ * **Details**
2211
+ *
2212
+ * Its `Getter<never, unknown>` type is assignable to every encoding getter because it accepts any input and never
2213
+ * produces an output value.
2214
+ *
2215
+ * **Example** (Rejecting encoding)
2216
+ *
2217
+ * ```ts import.meta.vitest
2218
+ * import { Effect, Option, SchemaGetter } from "effect"
2219
+ *
2220
+ * const issue = await Effect.runPromise(
2221
+ * Effect.flip(SchemaGetter.forbiddenEncoding.run(Option.some("value"), {}))
2222
+ * )
2223
+ * issue._tag // => "Forbidden"
2224
+ * ```
2225
+ *
2226
+ * @see {@link forbidden} for a forbidden getter with a custom message
2227
+ *
2228
+ * @category constructors
2229
+ * @since 4.0.0
2230
+ */
2231
+ var forbiddenEncoding = /*#__PURE__*/ forbidden(() => "Encoding is not supported");
2436
2232
  var passthrough_$1 = /*#__PURE__*/ new Getter(succeed$3);
2437
2233
  function isPassthrough(getter) {
2438
2234
  return getter.run === passthrough_$1.run;
@@ -2468,7 +2264,7 @@ function passthrough$1() {
2468
2264
  *
2469
2265
  * @see {@link onNone} to handle only absent values
2470
2266
  * @see {@link transform} for a simpler pure transformation of present values
2471
- * @see {@link transformOrFail} for fallible transformation of present values
2267
+ * @see {@link transformEffect} for effectful transformation of present values
2472
2268
  *
2473
2269
  * @category transforming
2474
2270
  * @since 4.0.0
@@ -2506,7 +2302,7 @@ function onSome(f) {
2506
2302
  * Schema.decodeSync(NumberFromString)("42") // => 42
2507
2303
  * ```
2508
2304
  *
2509
- * @see {@link transformOrFail} when the transformation can fail
2305
+ * @see {@link transformEffect} when the transformation returns an `Effect`
2510
2306
  * @see {@link transformOptional} when you need to handle `None` inputs
2511
2307
  * @see {@link passthrough} when no transformation is needed
2512
2308
  *
@@ -2517,7 +2313,7 @@ function transform$1(f) {
2517
2313
  return transformOptional$1(map$3(f));
2518
2314
  }
2519
2315
  /**
2520
- * Creates a getter that applies a fallible, effectful transformation to present values.
2316
+ * Creates a getter that applies an effectful transformation to present values.
2521
2317
  *
2522
2318
  * **When to use**
2523
2319
  *
@@ -2535,7 +2331,7 @@ function transform$1(f) {
2535
2331
  * ```ts import.meta.vitest
2536
2332
  * import { Effect, Option, SchemaGetter, SchemaIssue } from "effect"
2537
2333
  *
2538
- * const safeParseInt = SchemaGetter.transformOrFail<number, string>(
2334
+ * const safeParseInt = SchemaGetter.transformEffect<number, string>(
2539
2335
  * (s, options) => {
2540
2336
  * const n = parseInt(s, 10)
2541
2337
  * return isNaN(n)
@@ -2552,7 +2348,7 @@ function transform$1(f) {
2552
2348
  * @category transforming
2553
2349
  * @since 4.0.0
2554
2350
  */
2555
- function transformOrFail$1(f) {
2351
+ function transformEffect$1(f) {
2556
2352
  return onSome((e, options) => f(e, options).pipe(mapEager(some)));
2557
2353
  }
2558
2354
  /**
@@ -2674,7 +2470,7 @@ function String$3() {
2674
2470
  * await Effect.runPromise(toNumber.run(Option.some("42"), {})) // => Option.some(42)
2675
2471
  * ```
2676
2472
  *
2677
- * @see {@link transformOrFail} for validated number parsing
2473
+ * @see {@link transformEffect} for effectful or validated number parsing
2678
2474
  *
2679
2475
  * @category converting
2680
2476
  * @since 4.0.0
@@ -2850,7 +2646,7 @@ function encodeUriComponent() {
2850
2646
  * @since 4.0.0
2851
2647
  */
2852
2648
  function decodeUriComponent() {
2853
- return transformOrFail$1((input, options) => {
2649
+ return transformEffect$1((input, options) => {
2854
2650
  try {
2855
2651
  return succeed$3(globalThis.decodeURIComponent(input));
2856
2652
  } catch {
@@ -2859,52 +2655,14 @@ function decodeUriComponent() {
2859
2655
  });
2860
2656
  }
2861
2657
  //#endregion
2862
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/SchemaTransformation.js
2658
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaTransformation.js
2863
2659
  /**
2864
- * Middleware that wraps the entire parsing `Effect` pipeline for both
2865
- * decode and encode directions.
2866
- *
2867
- * **When to use**
2868
- *
2869
- * Use when you need a schema middleware to catch or recover from parsing
2870
- * errors (e.g. `Schema.catchDecoding`), run side effects around the parsing
2871
- * pipeline, or access the full `Effect` rather than a single decoded value.
2872
- *
2873
- * **Details**
2874
- *
2875
- * Unlike `Transformation`, which operates on individual values via `Getter`,
2876
- * `Middleware` receives the full `Effect` produced by the inner schema and can
2877
- * intercept, modify, retry, or replace it.
2660
+ * Constructs schema middleware from its decode and encode functions.
2878
2661
  *
2879
- * - `decode` receives an `Effect<Option<E>, Issue, RDE>` and returns
2880
- * `Effect<Option<T>, Issue, RDT>`.
2881
- * - `encode` receives an `Effect<Option<T>, Issue, RET>` and returns
2882
- * `Effect<Option<E>, Issue, REE>`.
2883
- * - `flip()` swaps the decode and encode functions, producing a
2884
- * `Middleware<E, T, ...>`.
2885
- *
2886
- * Typically constructed indirectly via `Schema.middlewareDecoding` or
2887
- * `Schema.middlewareEncoding` rather than instantiating this class directly.
2888
- *
2889
- * **Example** (Creating a middleware that falls back on decode failure)
2890
- *
2891
- * ```ts import.meta.vitest
2892
- * import { Effect, Option, SchemaIssue, SchemaTransformation } from "effect"
2893
- *
2894
- * const fallback = new SchemaTransformation.Middleware<string, string, never, never, never, never>(
2895
- * (effect) => Effect.catch(effect, () => Effect.succeed(Option.some("fallback"))),
2896
- * (effect) => effect
2897
- * )
2898
- * const issue = new SchemaIssue.InvalidValue({ message: "Missing value" })
2899
- * await Effect.runPromise(fallback.decode(Effect.fail(issue), {})) // => Option.some("fallback")
2900
- * ```
2901
- *
2902
- * @see {@link Transformation} — value-level bidirectional transformation
2903
- *
2904
- * @category models
2662
+ * @category constructors
2905
2663
  * @since 4.0.0
2906
2664
  */
2907
- var Middleware = class Middleware {
2665
+ var Middleware = class {
2908
2666
  _tag = "Middleware";
2909
2667
  decode;
2910
2668
  encode;
@@ -2916,50 +2674,15 @@ var Middleware = class Middleware {
2916
2674
  return new Middleware(this.encode, this.decode);
2917
2675
  }
2918
2676
  };
2919
- var TypeId$3 = "~effect/SchemaTransformation/Transformation";
2677
+ var TypeId$5 = "~effect/SchemaTransformation/Transformation";
2920
2678
  /**
2921
- * Represents a bidirectional transformation between a decoded type `T` and an encoded
2922
- * type `E`, built from a pair of `Getter`s.
2923
- *
2924
- * **When to use**
2925
- *
2926
- * Use when you need a schema transformation that defines how a schema converts
2927
- * between two representations.
2928
- * - You want to compose multiple transformations into a pipeline.
2929
- * - You want to flip a transformation to swap decode/encode.
2930
- *
2931
- * **Details**
2679
+ * Constructs a bidirectional schema transformation from its decode and encode getters.
2932
2680
  *
2933
- * This is the primary building block for `Schema.decodeTo`, `Schema.encodeTo`,
2934
- * `Schema.decode`, `Schema.encode`, and `Schema.link`. Each direction is a
2935
- * `SchemaGetter.Getter` that handles optionality, failure, and Effect services.
2936
- *
2937
- * - Immutable — `flip()` and `compose()` return new instances.
2938
- * - `flip()` swaps the decode and encode getters.
2939
- * - `compose(other)` chains: `this.decode` then `other.decode` for decoding,
2940
- * `other.encode` then `this.encode` for encoding.
2941
- *
2942
- * **Example** (Composing two transformations)
2943
- *
2944
- * ```ts import.meta.vitest
2945
- * import { SchemaTransformation } from "effect"
2946
- *
2947
- * const trimAndLower = SchemaTransformation.trim().compose(
2948
- * SchemaTransformation.toLowerCase()
2949
- * )
2950
- * trimAndLower._tag // => "Transformation"
2951
- * ```
2952
- *
2953
- * @see {@link make} — construct from `{ decode, encode }` getters
2954
- * @see {@link transform} — construct from pure functions
2955
- * @see {@link transformOrFail} — construct from effectful functions
2956
- * @see {@link Middleware} — effect-pipeline-level alternative
2957
- *
2958
- * @category models
2681
+ * @category constructors
2959
2682
  * @since 4.0.0
2960
2683
  */
2961
- var Transformation = class Transformation {
2962
- [TypeId$3] = TypeId$3;
2684
+ var Transformation = class {
2685
+ [TypeId$5] = TypeId$5;
2963
2686
  _tag = "Transformation";
2964
2687
  decode;
2965
2688
  encode;
@@ -3003,7 +2726,7 @@ var Transformation = class Transformation {
3003
2726
  * @since 4.0.0
3004
2727
  */
3005
2728
  function isTransformation(u) {
3006
- return hasProperty(u, TypeId$3) && u[TypeId$3] === TypeId$3;
2729
+ return hasProperty(u, TypeId$5) && u[TypeId$5] === TypeId$5;
3007
2730
  }
3008
2731
  /**
3009
2732
  * Constructs a `Transformation` from an object with `decode` and `encode`
@@ -3032,19 +2755,18 @@ function isTransformation(u) {
3032
2755
  * ```
3033
2756
  *
3034
2757
  * @see {@link transform} — simpler constructor from pure functions
3035
- * @see {@link transformOrFail} — constructor from effectful functions
2758
+ * @see {@link transformEffect} — constructor from effectful functions
3036
2759
  * @see {@link Transformation}
3037
2760
  *
3038
2761
  * @category constructors
3039
2762
  * @since 3.10.0
3040
2763
  */
3041
- var make$3 = (options) => {
2764
+ var make$4 = (options) => {
3042
2765
  if (isTransformation(options)) return options;
3043
2766
  return new Transformation(options.decode, options.encode);
3044
2767
  };
3045
2768
  /**
3046
- * Creates a `Transformation` from effectful decode and encode functions that
3047
- * can fail with `Issue`.
2769
+ * Creates a `Transformation` from effectful decode and encode functions.
3048
2770
  *
3049
2771
  * **When to use**
3050
2772
  *
@@ -3065,7 +2787,7 @@ var make$3 = (options) => {
3065
2787
  * const DateFromString = Schema.String.pipe(
3066
2788
  * Schema.decodeTo(
3067
2789
  * Schema.Date,
3068
- * SchemaTransformation.transformOrFail({
2790
+ * SchemaTransformation.transformEffect({
3069
2791
  * decode: (s, options) => {
3070
2792
  * const d = new Date(s)
3071
2793
  * return isNaN(d.getTime())
@@ -3086,8 +2808,8 @@ var make$3 = (options) => {
3086
2808
  * @category transforming
3087
2809
  * @since 3.10.0
3088
2810
  */
3089
- function transformOrFail(options) {
3090
- return new Transformation(transformOrFail$1(options.decode), transformOrFail$1(options.encode));
2811
+ function transformEffect(options) {
2812
+ return new Transformation(transformEffect$1(options.decode), transformEffect$1(options.encode));
3091
2813
  }
3092
2814
  /**
3093
2815
  * Creates a `Transformation` from pure (sync, infallible) decode and encode
@@ -3121,7 +2843,7 @@ function transformOrFail(options) {
3121
2843
  * Schema.decodeSync(CentsFromDollars)(2.5) // => 250
3122
2844
  * ```
3123
2845
  *
3124
- * @see {@link transformOrFail} — for fallible or effectful transformations
2846
+ * @see {@link transformEffect} — for fallible or effectful transformations
3125
2847
  * @see {@link transformOptional} — for transformations that handle missing keys
3126
2848
  * @see {@link passthrough} — when no conversion is needed
3127
2849
  *
@@ -3399,38 +3121,8 @@ var defectFromJson = (options) => transform({
3399
3121
  function fromJsonString$1(options) {
3400
3122
  return new Transformation(parseJson(options ?? {}), stringifyJson(options));
3401
3123
  }
3402
- /**
3403
- * Decodes a date-time string into a `DateTime.Utc` and encodes it back to an ISO
3404
- * string.
3405
- *
3406
- * **When to use**
3407
- *
3408
- * Use when you need a schema transformation to decode date-time strings to a
3409
- * normalized `DateTime.Utc` and encode back as a UTC ISO string.
3410
- *
3411
- * **Details**
3412
- *
3413
- * Decode accepts strings supported by `DateTime.make`, converts the result to
3414
- * UTC, and fails with `InvalidValue` when parsing fails. Encode uses
3415
- * `DateTime.formatIso`.
3416
- *
3417
- * @see {@link dateFromString} for decoding into JavaScript `Date`
3418
- * @see {@link dateTimeZonedFromString} for ISO strings that should preserve zoned date-time information
3419
- *
3420
- * @category transforming
3421
- * @since 4.0.0
3422
- */
3423
- var dateTimeUtcFromString = /*#__PURE__*/ transformOrFail({
3424
- decode: (s, options) => {
3425
- return match$1(make$4(s), {
3426
- onNone: () => fail$2(new InvalidValue({ expected: "a valid UTC DateTime string" }, s, options)),
3427
- onSome: (result) => succeed$3(toUtc(result))
3428
- });
3429
- },
3430
- encode: (utc) => succeed$3(formatIso(utc))
3431
- });
3432
3124
  //#endregion
3433
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/SchemaAST.js
3125
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaAST.js
3434
3126
  /**
3435
3127
  * Represents Effect schemas as runtime trees.
3436
3128
  *
@@ -3525,22 +3217,9 @@ var isObjects = /*#__PURE__*/ makeGuard("Objects");
3525
3217
  */
3526
3218
  var isSuspend = /*#__PURE__*/ makeGuard("Suspend");
3527
3219
  /**
3528
- * Represents a single step in an {@link Encoding} chain.
3220
+ * Constructs a {@link Link}.
3529
3221
  *
3530
- * **Details**
3531
- *
3532
- * A link pairs a target {@link AST} with a `Transformation` or `Middleware`
3533
- * that converts values between the current node and the target.
3534
- *
3535
- * - `to` — the AST node on the other side of this transformation step.
3536
- * - `transformation` — the bidirectional conversion logic (decode/encode).
3537
- *
3538
- * Links are composed into a non-empty array ({@link Encoding}) attached to
3539
- * AST nodes that have a different encoded representation.
3540
- *
3541
- * @see {@link Encoding}
3542
- * @see {@link decodeTo}
3543
- * @category models
3222
+ * @category constructors
3544
3223
  * @since 4.0.0
3545
3224
  */
3546
3225
  var Link = class {
@@ -3554,24 +3233,9 @@ var Link = class {
3554
3233
  /** @internal */
3555
3234
  var defaultParseOptions = {};
3556
3235
  /**
3557
- * Represents per-property metadata attached to AST nodes via {@link Base.context}.
3236
+ * Constructs a {@link Context}.
3558
3237
  *
3559
- * **Details**
3560
- *
3561
- * Tracks whether a property key is optional, mutable, has a constructor
3562
- * default, or carries key-level annotations. Typically set by helpers like
3563
- * {@link optionalKey} and `Schema.mutableKey`.
3564
- *
3565
- * - `isOptional` — the property key may be absent from the input.
3566
- * - `isMutable` — the property is `readonly` when `false`.
3567
- * - `constructorDefault` — a {@link Link} applied during construction to
3568
- * supply missing values.
3569
- * - `annotations` — key-level annotations (e.g. description of the key
3570
- * itself).
3571
- *
3572
- * @see {@link optionalKey}
3573
- * @see {@link isOptional}
3574
- * @category models
3238
+ * @category constructors
3575
3239
  * @since 4.0.0
3576
3240
  */
3577
3241
  var Context = class {
@@ -3587,29 +3251,9 @@ var Context = class {
3587
3251
  this.annotations = annotations;
3588
3252
  }
3589
3253
  };
3590
- var TypeId$2 = "~effect/Schema";
3591
- /**
3592
- * Represents the abstract base class for all {@link AST} node variants.
3593
- *
3594
- * **Details**
3595
- *
3596
- * Every AST node extends `Base` and inherits these fields:
3597
- *
3598
- * - `annotations` — user-supplied metadata (identifier, title, description,
3599
- * arbitrary keys).
3600
- * - `checks` — optional {@link Checks} for post-type-match validation.
3601
- * - `encoding` — optional {@link Encoding} chain for type ↔ wire
3602
- * transformations.
3603
- * - `context` — optional {@link Context} for per-property metadata.
3604
- *
3605
- * Subclasses add a `_tag` discriminant and variant-specific data.
3606
- *
3607
- * @see {@link AST}
3608
- * @category models
3609
- * @since 4.0.0
3610
- */
3611
- var Base = class {
3612
- [TypeId$2] = TypeId$2;
3254
+ var TypeId$4 = "~effect/Schema";
3255
+ var ASTNodeImpl = class {
3256
+ [TypeId$4] = TypeId$4;
3613
3257
  annotations;
3614
3258
  checks;
3615
3259
  encoding;
@@ -3625,32 +3269,19 @@ var Base = class {
3625
3269
  }
3626
3270
  };
3627
3271
  /**
3628
- * AST node for user-defined opaque types with custom parsing logic.
3272
+ * Constructs a {@link Declaration}.
3629
3273
  *
3630
- * **When to use**
3631
- *
3632
- * Use when you need a custom schema AST node because none of the built-in
3633
- * nodes fit.
3634
- *
3635
- * **Details**
3636
- *
3637
- * - `typeParameters` — inner schemas this declaration is parameterized over
3638
- * (e.g. the element type for a custom collection).
3639
- * - `run` — factory that receives `typeParameters` and returns a parser that
3640
- * validates or transforms raw input.
3641
- *
3642
- * @see {@link isDeclaration}
3643
- * @category models
3644
- * @since 3.10.0
3274
+ * @category constructors
3275
+ * @since 4.0.0
3645
3276
  */
3646
- var Declaration = class Declaration extends Base {
3277
+ var Declaration = class extends ASTNodeImpl {
3647
3278
  _tag = "Declaration";
3648
3279
  typeParameters;
3649
3280
  run;
3650
3281
  encodingChecks;
3651
3282
  /**
3652
3283
  * Parser factory {@link flip} swaps in, so a declaration can behave
3653
- * differently when encoding. `undefined` reuses {@link run}.
3284
+ * differently when encoding. `undefined` reuses `run`.
3654
3285
  */
3655
3286
  encodingRun;
3656
3287
  constructor(typeParameters, run, annotations, checks, encoding, context, encodingChecks, encodingRun) {
@@ -3688,18 +3319,12 @@ var Declaration = class Declaration extends Base {
3688
3319
  }
3689
3320
  };
3690
3321
  /**
3691
- * AST node matching the `null` literal value.
3692
- *
3693
- * **Details**
3694
- *
3695
- * Parsing succeeds only when the input is exactly `null`.
3322
+ * Constructs a {@link Null}.
3696
3323
  *
3697
- * @see {@link null_ null}
3698
- * @see {@link isNull}
3699
- * @category models
3324
+ * @category constructors
3700
3325
  * @since 4.0.0
3701
3326
  */
3702
- var Null$1 = class extends Base {
3327
+ var Null$1 = class extends ASTNodeImpl {
3703
3328
  _tag = "Null";
3704
3329
  /** @internal */
3705
3330
  getParser() {
@@ -3712,18 +3337,12 @@ var Null$1 = class extends Base {
3712
3337
  };
3713
3338
  var null_ = /*#__PURE__*/ new Null$1();
3714
3339
  /**
3715
- * AST node matching the `undefined` value.
3716
- *
3717
- * **Details**
3340
+ * Constructs a {@link Undefined}.
3718
3341
  *
3719
- * Parsing succeeds only when the input is exactly `undefined`.
3720
- *
3721
- * @see {@link undefined}
3722
- * @see {@link isUndefined}
3723
- * @category models
3342
+ * @category constructors
3724
3343
  * @since 4.0.0
3725
3344
  */
3726
- var Undefined$1 = class extends Base {
3345
+ var Undefined$1 = class extends ASTNodeImpl {
3727
3346
  _tag = "Undefined";
3728
3347
  /** @internal */
3729
3348
  getParser() {
@@ -3741,19 +3360,44 @@ var Undefined$1 = class extends Base {
3741
3360
  var undefinedToNull = /*#__PURE__*/ new Link(null_, /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$1(() => void 0), /*#__PURE__*/ transform$1(() => null)));
3742
3361
  var undefined_ = /*#__PURE__*/ new Undefined$1();
3743
3362
  /**
3744
- * AST node representing the `unknown` type — every value matches.
3363
+ * Constructs a {@link Never}.
3745
3364
  *
3746
- * **Details**
3365
+ * @category constructors
3366
+ * @since 4.0.0
3367
+ */
3368
+ var Never$1 = class extends ASTNodeImpl {
3369
+ _tag = "Never";
3370
+ /** @internal */
3371
+ getParser() {
3372
+ return fromRefinement(this, isNever$1);
3373
+ }
3374
+ /** @internal */
3375
+ getExpected() {
3376
+ return "never";
3377
+ }
3378
+ };
3379
+ /**
3380
+ * Provides the singleton {@link Never} AST instance.
3747
3381
  *
3748
- * Unlike {@link Any}, this is type-safe: the parsed result is typed as
3749
- * `unknown` rather than `any`.
3382
+ * **When to use**
3383
+ *
3384
+ * Use to reuse the canonical bottom-type AST node when constructing,
3385
+ * comparing, or returning ASTs.
3386
+ *
3387
+ * @see {@link Never} for the AST node class
3388
+ * @see {@link isNever} for narrowing an AST to a `Never` node
3389
+ *
3390
+ * @category constructors
3391
+ * @since 4.0.0
3392
+ */
3393
+ var never = /*#__PURE__*/ new Never$1();
3394
+ /**
3395
+ * Constructs a {@link Unknown}.
3750
3396
  *
3751
- * @see {@link unknown}
3752
- * @see {@link isUnknown}
3753
- * @category models
3397
+ * @category constructors
3754
3398
  * @since 4.0.0
3755
3399
  */
3756
- var Unknown$1 = class extends Base {
3400
+ var Unknown$1 = class extends ASTNodeImpl {
3757
3401
  _tag = "Unknown";
3758
3402
  /** @internal */
3759
3403
  getParser() {
@@ -3778,31 +3422,49 @@ var Unknown$1 = class extends Base {
3778
3422
  * @since 4.0.0
3779
3423
  */
3780
3424
  var unknown = /*#__PURE__*/ new Unknown$1();
3781
- function isTemplateLiteralPart(ast) {
3425
+ function formatTemplateLiteralPath(path) {
3426
+ return typeof path === "number" ? `parts[${path}]` : path;
3427
+ }
3428
+ function isTemplateLiteralPart(ast, path, validated) {
3429
+ if (validated.has(ast)) return true;
3430
+ if (ast.encoding) throw new Error(`TemplateLiteral parts cannot have an encoding at ${formatTemplateLiteralPath(path)}`);
3431
+ let valid;
3782
3432
  switch (ast._tag) {
3783
3433
  case "String":
3784
3434
  case "Number":
3785
- case "BigInt": return true;
3435
+ case "BigInt":
3436
+ valid = true;
3437
+ break;
3786
3438
  case "Literal":
3787
- case "TemplateLiteral": return !ast.checks;
3788
- case "Union": return !ast.checks && ast.types.every(isTemplateLiteralPart);
3439
+ valid = !ast.checks;
3440
+ break;
3441
+ case "TemplateLiteral": {
3442
+ const currentPath = formatTemplateLiteralPath(path);
3443
+ valid = !ast.checks && ast.parts.every((part, index) => isTemplateLiteralPart(part, `${currentPath}.parts[${index}]`, validated));
3444
+ break;
3445
+ }
3446
+ case "Union": {
3447
+ const currentPath = formatTemplateLiteralPath(path);
3448
+ valid = !ast.checks && ast.types.every((part, index) => isTemplateLiteralPart(part, `${currentPath}.types[${index}]`, validated));
3449
+ break;
3450
+ }
3789
3451
  default: return false;
3790
3452
  }
3453
+ if (valid) validated.add(ast);
3454
+ return valid;
3791
3455
  }
3792
3456
  /**
3793
- * AST node representing a TypeScript template literal type
3794
- * (e.g. `` `user_${string}` ``).
3457
+ * Constructs a {@link TemplateLiteral}.
3795
3458
  *
3796
- * **Details**
3459
+ * **Gotchas**
3797
3460
  *
3798
- * `parts` is an array of AST nodes; each part contributes to matching
3799
- * strings at runtime.
3461
+ * Throws if a part contains an encoding, including inside unions or nested
3462
+ * template literals. Parts must describe their values without transformations.
3800
3463
  *
3801
- * @see {@link isTemplateLiteral}
3802
- * @category models
3803
- * @since 3.10.0
3464
+ * @category constructors
3465
+ * @since 4.0.0
3804
3466
  */
3805
- var TemplateLiteral$1 = class extends Base {
3467
+ var TemplateLiteral$1 = class extends ASTNodeImpl {
3806
3468
  _tag = "TemplateLiteral";
3807
3469
  parts;
3808
3470
  /** @internal */
@@ -3815,12 +3477,12 @@ var TemplateLiteral$1 = class extends Base {
3815
3477
  super(annotations, checks, encoding, context);
3816
3478
  const encodedParts = [];
3817
3479
  const literals = [];
3818
- for (const part of parts) {
3819
- const encoded = toEncoded(part);
3820
- if (isTemplateLiteralPart(encoded)) {
3821
- encodedParts.push(encoded);
3822
- literals.push(encoded._tag === "Literal" ? globalThis.String(encoded.literal) : void 0);
3823
- } else throw new Error(`Invalid TemplateLiteral part ${encoded._tag}`);
3480
+ const validated = /* @__PURE__ */ new Set();
3481
+ for (let index = 0; index < parts.length; index++) {
3482
+ const part = parts[index];
3483
+ if (!isTemplateLiteralPart(part, index, validated)) throw new Error(`Invalid TemplateLiteral part ${part._tag}`);
3484
+ encodedParts.push(part);
3485
+ literals.push(part._tag === "Literal" ? globalThis.String(part.literal) : void 0);
3824
3486
  }
3825
3487
  const suffixLengths = new Array(encodedParts.length + 1);
3826
3488
  suffixLengths[encodedParts.length] = 0;
@@ -3832,7 +3494,7 @@ var TemplateLiteral$1 = class extends Base {
3832
3494
  }
3833
3495
  /** @internal */
3834
3496
  getParser(compile) {
3835
- const parser = compile(this.asTemplateLiteralParser());
3497
+ const parser = compile(decodeTo$1(string, new Arrays(false, this.parts.map(partFromString), []), templateLiteralTransformation(this)));
3836
3498
  return (input, options) => {
3837
3499
  if (input === missing) return missingExit;
3838
3500
  const result = parser(input, options);
@@ -3851,40 +3513,21 @@ var TemplateLiteral$1 = class extends Base {
3851
3513
  matchPart(s, options) {
3852
3514
  return segmentTemplateLiteralParts(this, s, options) === void 0 ? void 0 : s;
3853
3515
  }
3854
- /** @internal */
3855
- asTemplateLiteralParser() {
3856
- return decodeTo$1(string, new Arrays(false, this.parts.map(partFromString), []), new Transformation(transformOrFail$1((s, options) => {
3857
- const segments = segmentTemplateLiteralParts(this, s, options);
3858
- if (segments) return succeed$3(segments);
3859
- return fail$2(new InvalidValue({ expected: "a string matching template literal parts" }, s, options));
3860
- }), transform$1((parts) => parts.join(""))));
3861
- }
3862
3516
  };
3517
+ function templateLiteralTransformation(template) {
3518
+ return new Transformation(transformEffect$1((s, options) => {
3519
+ const segments = segmentTemplateLiteralParts(template, s, options);
3520
+ if (segments) return succeed$3(segments);
3521
+ return fail$2(new InvalidValue({ expected: "a string matching template literal parts" }, s, options));
3522
+ }), transform$1((parts) => parts.join("")));
3523
+ }
3863
3524
  /**
3864
- * AST node matching an exact primitive value (string, number, boolean, or
3865
- * bigint).
3866
- *
3867
- * **Details**
3868
- *
3869
- * Parsing succeeds only when the input is strictly equal (`===`) to the
3870
- * stored `literal`. Numeric literals must be finite — `Infinity`, `-Infinity`,
3871
- * and `NaN` are rejected at construction time.
3525
+ * Constructs a {@link Literal}.
3872
3526
  *
3873
- * **Example** (Creating a literal AST)
3874
- *
3875
- * ```ts import.meta.vitest
3876
- * import { SchemaAST } from "effect"
3877
- *
3878
- * const ast = new SchemaAST.Literal("active")
3879
- * ast.literal // => "active"
3880
- * ```
3881
- *
3882
- * @see {@link LiteralValue}
3883
- * @see {@link isLiteral}
3884
- * @category models
3885
- * @since 3.10.0
3527
+ * @category constructors
3528
+ * @since 4.0.0
3886
3529
  */
3887
- var Literal$1 = class extends Base {
3530
+ var Literal$1 = class extends ASTNodeImpl {
3888
3531
  _tag = "Literal";
3889
3532
  literal;
3890
3533
  constructor(literal, annotations, checks, encoding, context) {
@@ -3918,15 +3561,12 @@ function literalToString(ast) {
3918
3561
  return replaceEncoding(ast, [new Link(new Literal$1(literalAsString), new Transformation(transform$1(() => ast.literal), transform$1(() => literalAsString)))]);
3919
3562
  }
3920
3563
  /**
3921
- * AST node matching any `string` value.
3564
+ * Constructs a {@link String}.
3922
3565
  *
3923
- * @see {@link string}
3924
- * @see {@link isString}
3925
- *
3926
- * @category models
3566
+ * @category constructors
3927
3567
  * @since 4.0.0
3928
3568
  */
3929
- var String$2 = class extends Base {
3569
+ var String$2 = class extends ASTNodeImpl {
3930
3570
  _tag = "String";
3931
3571
  /** @internal */
3932
3572
  getParser() {
@@ -3957,25 +3597,12 @@ var String$2 = class extends Base {
3957
3597
  */
3958
3598
  var string = /*#__PURE__*/ new String$2();
3959
3599
  /**
3960
- * AST node matching any `number` value (including `NaN`, `Infinity`,
3961
- * `-Infinity`).
3962
- *
3963
- * **Details**
3600
+ * Constructs a {@link Number}.
3964
3601
  *
3965
- * Default JSON serialization:
3966
- *
3967
- * - Finite numbers are serialized as JSON numbers.
3968
- * - `Infinity`, `-Infinity`, and `NaN` are serialized as JSON strings.
3969
- *
3970
- * If the node has an `isFinite` or `isInt` check, the string fallback is
3971
- * skipped since non-finite values cannot occur.
3972
- *
3973
- * @see {@link number}
3974
- * @see {@link isNumber}
3975
- * @category models
3602
+ * @category constructors
3976
3603
  * @since 4.0.0
3977
3604
  */
3978
- var Number$2 = class extends Base {
3605
+ var Number$2 = class extends ASTNodeImpl {
3979
3606
  _tag = "Number";
3980
3607
  /** @internal */
3981
3608
  getParser() {
@@ -4029,15 +3656,12 @@ function hasCheck(checks, id) {
4029
3656
  */
4030
3657
  var number = /*#__PURE__*/ new Number$2();
4031
3658
  /**
4032
- * AST node matching any `boolean` value (`true` or `false`).
3659
+ * Constructs a {@link Boolean}.
4033
3660
  *
4034
- * @see {@link boolean}
4035
- * @see {@link isBoolean}
4036
- *
4037
- * @category models
3661
+ * @category constructors
4038
3662
  * @since 4.0.0
4039
3663
  */
4040
- var Boolean$1 = class extends Base {
3664
+ var Boolean$1 = class extends ASTNodeImpl {
4041
3665
  _tag = "Boolean";
4042
3666
  /** @internal */
4043
3667
  getParser() {
@@ -4064,19 +3688,12 @@ var Boolean$1 = class extends Base {
4064
3688
  */
4065
3689
  var boolean = /*#__PURE__*/ new Boolean$1();
4066
3690
  /**
4067
- * AST node matching any `bigint` value.
4068
- *
4069
- * **Details**
3691
+ * Constructs a {@link BigInt}.
4070
3692
  *
4071
- * When serialized to a string-based codec, bigints are converted to/from
4072
- * their decimal string representation.
4073
- *
4074
- * @see {@link bigInt}
4075
- * @see {@link isBigInt}
4076
- * @category models
3693
+ * @category constructors
4077
3694
  * @since 4.0.0
4078
3695
  */
4079
- var BigInt$2 = class extends Base {
3696
+ var BigInt$2 = class extends ASTNodeImpl {
4080
3697
  _tag = "BigInt";
4081
3698
  /** @internal */
4082
3699
  getParser() {
@@ -4114,48 +3731,12 @@ var BigInt$2 = class extends Base {
4114
3731
  */
4115
3732
  var bigInt = /*#__PURE__*/ new BigInt$2();
4116
3733
  /**
4117
- * AST node for array-like types — both tuples and arrays.
3734
+ * Constructs a {@link Arrays}.
4118
3735
  *
4119
- * **When to use**
4120
- *
4121
- * Use when constructing or inspecting AST nodes for tuple or array-like schemas,
4122
- * including rest elements.
4123
- *
4124
- * **Details**
4125
- *
4126
- * - `elements` — positional element types (tuple elements). An element is
4127
- * optional if its {@link Context.isOptional} is `true`.
4128
- * - `rest` — the rest/variadic element types. When non-empty, the first
4129
- * entry is the "spread" type (e.g. `...Array<string>`), and subsequent
4130
- * entries are trailing positional elements after the spread.
4131
- * - `isMutable` — whether the resulting array is `readonly` (`false`) or
4132
- * mutable (`true`).
4133
- *
4134
- * **Gotchas**
4135
- *
4136
- * Construction enforces TypeScript ordering rules: a required element
4137
- * cannot follow an optional one, and an optional element cannot follow a
4138
- * rest element.
4139
- *
4140
- * **Example** (Inspecting a tuple AST)
4141
- *
4142
- * ```ts import.meta.vitest
4143
- * import { Schema, SchemaAST } from "effect"
4144
- *
4145
- * const schema = Schema.Tuple([Schema.String, Schema.Number])
4146
- * const ast = schema.ast
4147
- *
4148
- * if (SchemaAST.isArrays(ast)) {
4149
- * [ast.elements.length, ast.rest.length] // => [2, 0]
4150
- * }
4151
- * ```
4152
- *
4153
- * @see {@link isArrays}
4154
- * @see {@link Objects}
4155
- * @category models
3736
+ * @category constructors
4156
3737
  * @since 4.0.0
4157
3738
  */
4158
- var Arrays = class Arrays extends Base {
3739
+ var Arrays = class extends ASTNodeImpl {
4159
3740
  _tag = "Arrays";
4160
3741
  isMutable;
4161
3742
  elements;
@@ -4209,9 +3790,11 @@ var Arrays = class Arrays extends Base {
4209
3790
  issues: void 0,
4210
3791
  options
4211
3792
  };
4212
- const eff = parseArray(state, input, {
4213
- concurrency: resolveConcurrency(options?.concurrency)?.concurrency,
4214
- end: ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen)
3793
+ const end = ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen);
3794
+ const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);
3795
+ const eff = concurrency === 1 ? parseArray(state, input, 0, end) : parseArrayConcurrent(state, input, {
3796
+ concurrency,
3797
+ end
4215
3798
  });
4216
3799
  if (eff) yield* eff;
4217
3800
  if (ast.rest.length === 0 && len > elementLen) for (let i = elementLen; i <= len - 1; i++) {
@@ -4244,7 +3827,7 @@ var Arrays = class Arrays extends Base {
4244
3827
  return "array";
4245
3828
  }
4246
3829
  };
4247
- var parseArray = /*#__PURE__*/ iterateEager()({
3830
+ var parseArrayOptions = {
4248
3831
  onItem(s, item, i) {
4249
3832
  const value = i < s.len ? item : missing;
4250
3833
  return s.getParser(s.tailThreshold, i).parser(value, s.options);
@@ -4263,11 +3846,9 @@ var parseArray = /*#__PURE__*/ iterateEager()({
4263
3846
  } else return fail$3(new Composite(s.ast, [issue], s.input, s.options));
4264
3847
  }
4265
3848
  }
4266
- });
4267
- var resolveConcurrency = (value) => {
4268
- value = value === "unbounded" ? Infinity : value ?? 1;
4269
- return value > 1 ? { concurrency: value } : void 0;
4270
3849
  };
3850
+ var parseArray = /*#__PURE__*/ iterateEager()(parseArrayOptions);
3851
+ var parseArrayConcurrent = /*#__PURE__*/ iterateConcurrent()(parseArrayOptions);
4271
3852
  var wrapPropertyKeyIssue = (s, ast, key, exit) => {
4272
3853
  if (exit.cause.reasons.length === 0) return exit;
4273
3854
  const issue = getSchemaIssue(exit.cause);
@@ -4303,17 +3884,10 @@ function getIndexSignatureKeys(input, parameter, options = defaultParseOptions)
4303
3884
  return go(parameterFromPropertyKey(toEncoded(parameter)));
4304
3885
  }
4305
3886
  /**
4306
- * Represents a named property within an {@link Objects} node.
3887
+ * Constructs a {@link PropertySignature}.
4307
3888
  *
4308
- * **Details**
4309
- *
4310
- * Pairs a `name` (any `PropertyKey`) with a `type` ({@link AST}). The
4311
- * property's optionality and mutability are determined by the `type`'s
4312
- * {@link Context}.
4313
- *
4314
- * @see {@link Objects}
4315
- * @category models
4316
- * @since 3.10.0
3889
+ * @category constructors
3890
+ * @since 4.0.0
4317
3891
  */
4318
3892
  var PropertySignature = class {
4319
3893
  name;
@@ -4333,32 +3907,25 @@ function isIndexSignatureParameterSide(ast) {
4333
3907
  default: return false;
4334
3908
  }
4335
3909
  }
3910
+ function isIndexSignatureParameterEncodedSide(ast) {
3911
+ const encoded = getLastEncoding(ast);
3912
+ switch (encoded._tag) {
3913
+ case "String":
3914
+ case "Number":
3915
+ case "Symbol":
3916
+ case "TemplateLiteral": return true;
3917
+ case "Union": return encoded.types.every(isIndexSignatureParameterEncodedSide);
3918
+ default: return false;
3919
+ }
3920
+ }
4336
3921
  function isIndexSignatureParameter(ast) {
4337
- return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterSide(toEncoded(ast));
3922
+ return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterEncodedSide(ast);
4338
3923
  }
4339
3924
  /**
4340
- * Represents an index signature entry within an {@link Objects} node.
4341
- *
4342
- * **When to use**
4343
- *
4344
- * Use when constructing or inspecting object AST entries for record-like keys
4345
- * and values.
4346
- *
4347
- * **Details**
4348
- *
4349
- * - `parameter` — the key type AST (e.g. {@link String} for `string` keys,
4350
- * {@link TemplateLiteral} for patterned keys).
4351
- * - `type` — the value type SchemaAST.
3925
+ * Constructs a {@link IndexSignature}.
4352
3926
  *
4353
- * **Gotchas**
4354
- *
4355
- * Using `Schema.optionalKey` on the value type is not allowed for index
4356
- * signatures (throws at construction); use `Schema.optional` instead.
4357
- *
4358
- * @see {@link Objects}
4359
- * @see {@link PropertySignature}
4360
- * @category models
4361
- * @since 3.10.0
3927
+ * @category constructors
3928
+ * @since 4.0.0
4362
3929
  */
4363
3930
  var IndexSignature = class {
4364
3931
  parameter;
@@ -4371,48 +3938,12 @@ var IndexSignature = class {
4371
3938
  }
4372
3939
  };
4373
3940
  /**
4374
- * AST node for object-like schemas, including structs and records.
4375
- *
4376
- * **When to use**
4377
- *
4378
- * Use when constructing or inspecting AST nodes for structs or records rather
4379
- * than array-like schemas.
4380
- *
4381
- * **Details**
4382
- *
4383
- * - `propertySignatures` — named properties with their types (struct fields).
4384
- * - `indexSignatures` — index signature entries (record patterns), each with
4385
- * a `parameter` AST for matching keys and a `type` AST for values.
4386
- *
4387
- * An `Objects` node with no properties and no index signatures performs only a
4388
- * non-nullish check: it accepts any value except `null` and `undefined`,
4389
- * including primitive values.
4390
- *
4391
- * **Gotchas**
4392
- *
4393
- * Duplicate property names throw at construction time.
4394
- *
4395
- * **Example** (Inspecting a struct AST)
4396
- *
4397
- * ```ts import.meta.vitest
4398
- * import { Schema, SchemaAST } from "effect"
4399
- *
4400
- * const schema = Schema.Struct({ name: Schema.String })
4401
- * const ast = schema.ast
3941
+ * Constructs a {@link Objects}.
4402
3942
  *
4403
- * if (SchemaAST.isObjects(ast)) {
4404
- * ast.propertySignatures.map((ps) => [ps.name, ps.type._tag]) // => [["name", "String"]]
4405
- * }
4406
- * ```
4407
- *
4408
- * @see {@link isObjects}
4409
- * @see {@link PropertySignature}
4410
- * @see {@link IndexSignature}
4411
- * @see {@link Arrays}
4412
- * @category models
3943
+ * @category constructors
4413
3944
  * @since 4.0.0
4414
3945
  */
4415
- var Objects = class Objects extends Base {
3946
+ var Objects = class extends ASTNodeImpl {
4416
3947
  _tag = "Objects";
4417
3948
  propertySignatures;
4418
3949
  indexSignatures;
@@ -4422,14 +3953,20 @@ var Objects = class Objects extends Base {
4422
3953
  this.propertySignatures = propertySignatures;
4423
3954
  this.indexSignatures = indexSignatures;
4424
3955
  this.encodingChecks = encodingChecks;
4425
- const duplicates = propertySignatures.map((ps) => ps.name).filter((name, i, arr) => arr.indexOf(name) !== i);
3956
+ const seen = /* @__PURE__ */ new Set();
3957
+ const duplicates = [];
3958
+ for (const propertySignature of propertySignatures) {
3959
+ const name = propertySignature.name;
3960
+ if (seen.has(name)) duplicates.push(name);
3961
+ else seen.add(name);
3962
+ }
4426
3963
  if (duplicates.length > 0) throw new Error(`Duplicate identifiers: ${JSON.stringify(duplicates)}. ts(2300)`);
4427
3964
  }
4428
3965
  /** @internal */
4429
3966
  getParser(compile, compileConstructorDefault = compile) {
4430
3967
  const ast = this;
4431
3968
  const expectedKeys = [];
4432
- for (const ps of ast.propertySignatures) expectedKeys.push(ps.name);
3969
+ for (const ps of ast.propertySignatures) expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
4433
3970
  const hasProperties = expectedKeys.length;
4434
3971
  const indexCount = ast.indexSignatures.length;
4435
3972
  let expectedKeysSet = hasProperties && indexCount ? new Set(expectedKeys) : void 0;
@@ -4440,7 +3977,7 @@ var Objects = class Objects extends Base {
4440
3977
  if (exitValue._tag === "Failure") return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? void_;
4441
3978
  const value = exitValue === sameExit ? inputValue : exitValue[args];
4442
3979
  if (k2 !== missing && value !== missing) {
4443
- if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(k2))) return void_;
3980
+ if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(typeof k2 === "number" ? globalThis.String(k2) : k2))) return void_;
4444
3981
  assignProperty(s.out, k2, value);
4445
3982
  }
4446
3983
  return void_;
@@ -4462,9 +3999,9 @@ var Objects = class Objects extends Base {
4462
3999
  const result = index.parserValue(inputValue, s.options);
4463
4000
  return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : flatMap(exit(result), (exit) => finishIndex(s, key, key, inputValue, exit));
4464
4001
  };
4465
- const parseIndexes = indexCount ? iterateEager()({
4466
- onItem: (s, [key, index]) => parseIndex(s, key, index),
4467
- step: (_s, _, exit) => exit._tag === "Failure" ? exit : void 0
4002
+ const parseIndexes = indexCount ? iterateConcurrent()({
4003
+ onItem: (s, [key, index]) => index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),
4004
+ step: (_s, _item, exit) => exit._tag === "Failure" ? exit : void 0
4468
4005
  }) : void 0;
4469
4006
  const compileMembers = () => {
4470
4007
  if (!properties) {
@@ -4496,35 +4033,34 @@ var Objects = class Objects extends Base {
4496
4033
  };
4497
4034
  const errorsAllOption = options.errors === "all";
4498
4035
  const onExcessPropertyError = options.onExcessProperty === "error";
4499
- const onExcessPropertyPreserve = options.onExcessProperty === "preserve";
4500
- let inputKeys;
4501
- if (!indexCount && (onExcessPropertyError || onExcessPropertyPreserve)) {
4036
+ const concurrency = options.concurrency === void 0 ? 1 : resolveConcurrency(options.concurrency);
4037
+ const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map((index) => getIndexSignatureKeys(record, index.parameter, options)) : void 0;
4038
+ if (onExcessPropertyError) {
4502
4039
  expectedKeysSet ??= new Set(expectedKeys);
4503
- inputKeys = Reflect.ownKeys(record);
4040
+ const coveredKeys = indexKeys ? new Set(expectedKeysSet) : expectedKeysSet;
4041
+ if (indexKeys) for (const keys of indexKeys) for (const key of keys) coveredKeys.add(key);
4042
+ const inputKeys = Reflect.ownKeys(record);
4504
4043
  for (let i = 0; i < inputKeys.length; i++) {
4505
4044
  const key = inputKeys[i];
4506
- if (!expectedKeysSet.has(key)) {
4507
- if (onExcessPropertyError) {
4508
- const unexpected = new UnexpectedKey(ast, record[key], options);
4509
- const issue = new Pointer([key], unexpected);
4510
- if (errorsAllOption) {
4511
- if (state.issues) state.issues.push(issue);
4512
- else state.issues = [issue];
4513
- continue;
4514
- } else return yield* fail$2(new Composite(ast, [issue], input, options));
4515
- } else assignProperty(out, key, record[key]);
4045
+ if (!coveredKeys.has(key)) {
4046
+ const unexpected = new UnexpectedKey(ast, record[key], options);
4047
+ const issue = new Pointer([key], unexpected);
4048
+ if (errorsAllOption) {
4049
+ if (state.issues) state.issues.push(issue);
4050
+ else state.issues = [issue];
4051
+ continue;
4052
+ } else return yield* fail$2(new Composite(ast, [issue], input, options));
4516
4053
  }
4517
4054
  }
4518
4055
  }
4519
- const concurrency = resolveConcurrency(options?.concurrency);
4520
4056
  if (hasProperties) {
4521
- const eff = parseProperties(state, properties, concurrency);
4057
+ const eff = concurrency === 1 ? parseProperties(state, properties) : parsePropertiesConcurrent(state, properties, { concurrency });
4522
4058
  if (eff) yield* eff;
4523
4059
  }
4524
- if (indexCount && !concurrency) for (let i = 0; i < indexCount; i++) {
4060
+ if (indexCount && concurrency === 1) for (let i = 0; i < indexCount; i++) {
4525
4061
  const index = indexes[i];
4526
4062
  const parse = index.is.parameter === string ? parseStringIndex : parseIndex;
4527
- const keys = index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options);
4063
+ const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
4528
4064
  for (let j = 0; j < keys.length; j++) {
4529
4065
  const eff = parse(state, keys[j], index);
4530
4066
  if (!effectIsExit(eff)) yield* eff;
@@ -4532,22 +4068,16 @@ var Objects = class Objects extends Base {
4532
4068
  }
4533
4069
  }
4534
4070
  else if (parseIndexes) {
4535
- const keyPairs = empty$1();
4071
+ const keyPairs = empty$2();
4536
4072
  for (let i = 0; i < indexCount; i++) {
4537
4073
  const index = indexes[i];
4538
- const keys = getIndexSignatureKeys(record, index.is.parameter, options);
4074
+ const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
4539
4075
  for (let j = 0; j < keys.length; j++) keyPairs.push([keys[j], index]);
4540
4076
  }
4541
- const eff = parseIndexes(state, keyPairs, concurrency);
4077
+ const eff = parseIndexes(state, keyPairs, { concurrency });
4542
4078
  if (eff) yield* eff;
4543
4079
  }
4544
4080
  if (state.issues) return yield* fail$2(new Composite(ast, state.issues, input, options));
4545
- if (options.propertyOrder === "original") {
4546
- const keys = (inputKeys ?? Reflect.ownKeys(record)).concat(expectedKeys);
4547
- const preserved = {};
4548
- for (const key of keys) if (Object.hasOwn(out, key)) assignProperty(preserved, key, out[key]);
4549
- return preserved;
4550
- }
4551
4081
  return out;
4552
4082
  });
4553
4083
  if (indexCount) return fallback;
@@ -4563,7 +4093,7 @@ var Objects = class Objects extends Base {
4563
4093
  };
4564
4094
  return (input, options) => {
4565
4095
  if (input === missing) return missingExit;
4566
- if (options.errors === "all" || options.onExcessProperty !== void 0 || options.propertyOrder === "original" || options.concurrency !== void 0) return fallback(input, options);
4096
+ if (options.errors === "all" || options.onExcessProperty !== void 0 || options.concurrency !== void 0 && resolveConcurrency(options.concurrency) !== 1) return fallback(input, options);
4567
4097
  if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return fail$2(new InvalidType(ast, input, options));
4568
4098
  const props = compileMembers();
4569
4099
  const record = input;
@@ -4579,7 +4109,7 @@ var Objects = class Objects extends Base {
4579
4109
  for (let index = 0; index < props.length; index++) {
4580
4110
  const property = props[index];
4581
4111
  const name = property.name;
4582
- const hasKey = Object.hasOwn(record, name);
4112
+ const hasKey = hasPropertySignature(record, name);
4583
4113
  const value = hasKey ? record[name] : missing;
4584
4114
  const exit = property.parser(value, options);
4585
4115
  if (!effectIsExit(exit)) return resume(state, index, exit);
@@ -4640,15 +4170,17 @@ function stepProperty(s, p, exit) {
4640
4170
  } else return fail$3(new Composite(s.ast, [issue], s.input, s.options));
4641
4171
  }
4642
4172
  }
4643
- var parseProperties = /*#__PURE__*/ iterateEager()({
4173
+ var parsePropertiesOptions = {
4644
4174
  onItem(s, p) {
4645
- if (!Object.hasOwn(s.input, p.name)) return p.parser(missing, s.options);
4175
+ if (!hasPropertySignature(s.input, p.name)) return p.parser(missing, s.options);
4646
4176
  const value = s.input[p.name];
4647
4177
  assignProperty(s.out, p.name, value);
4648
4178
  return p.parser(value, s.options);
4649
4179
  },
4650
4180
  step: stepProperty
4651
- });
4181
+ };
4182
+ var parseProperties = /*#__PURE__*/ iterateEager()(parsePropertiesOptions);
4183
+ var parsePropertiesConcurrent = /*#__PURE__*/ iterateConcurrent()(parsePropertiesOptions);
4652
4184
  function combineChecks(a, b) {
4653
4185
  if (!a) return b;
4654
4186
  if (!b) return a;
@@ -4669,8 +4201,8 @@ function tuple(elements, checks = void 0) {
4669
4201
  return new Arrays(false, elements.map((e) => e.ast), [], void 0, checks);
4670
4202
  }
4671
4203
  /** @internal */
4672
- function union(members, mode, checks) {
4673
- return new Union$1(members.map(getAST), mode, void 0, checks);
4204
+ function union(members, options, checks) {
4205
+ return new Union$1(members.map(getAST), options, void 0, checks);
4674
4206
  }
4675
4207
  /** @internal */
4676
4208
  function structWithRest(ast, records) {
@@ -4783,6 +4315,7 @@ function collectSentinels(ast) {
4783
4315
  }
4784
4316
  var candidateIndexCache = /*#__PURE__*/ new WeakMap();
4785
4317
  var emptyCandidates = /*#__PURE__*/ Object.freeze([]);
4318
+ var hasPropertySignature = (input, key) => key === "__proto__" ? Object.hasOwn(input, key) : key in input;
4786
4319
  function getIndex(types) {
4787
4320
  let index = candidateIndexCache.get(types);
4788
4321
  if (index) return index;
@@ -4831,7 +4364,7 @@ function getIndex(types) {
4831
4364
  for (const [literal, indexes] of byValue) candidates.set(literal, Object.freeze(Array.from(indexes, (index) => types[index])));
4832
4365
  index = (input, isConstructor) => {
4833
4366
  if (isObjectKeyword(input)) {
4834
- const value = Object.hasOwn(input, key) ? input[key] : void 0;
4367
+ const value = hasPropertySignature(input, key) ? input[key] : void 0;
4835
4368
  if (value !== void 0) return candidates.get(value) ?? emptyCandidates;
4836
4369
  if (isConstructor) return types;
4837
4370
  }
@@ -4847,7 +4380,7 @@ function getIndex(types) {
4847
4380
  let directKey;
4848
4381
  if (commonSentinel) {
4849
4382
  const [key, [byValue]] = commonSentinel;
4850
- const hasKey = Object.hasOwn(input, key);
4383
+ const hasKey = hasPropertySignature(input, key);
4851
4384
  const value = hasKey ? input[key] : void 0;
4852
4385
  if (hasKey && (!isConstructor || value !== void 0)) {
4853
4386
  const match = byValue.get(value);
@@ -4857,7 +4390,7 @@ function getIndex(types) {
4857
4390
  }
4858
4391
  }
4859
4392
  if (directKey === void 0) for (const [key, [byValue, all]] of bySentinel) {
4860
- const hasKey = Object.hasOwn(input, key);
4393
+ const hasKey = hasPropertySignature(input, key);
4861
4394
  const value = hasKey ? input[key] : void 0;
4862
4395
  if (hasKey && (!isConstructor || value !== void 0)) {
4863
4396
  const match = byValue.get(value);
@@ -4866,7 +4399,7 @@ function getIndex(types) {
4866
4399
  }
4867
4400
  for (const [key, [byValue, all]] of bySentinel) {
4868
4401
  if (key === directKey) continue;
4869
- const hasKey = Object.hasOwn(input, key);
4402
+ const hasKey = hasPropertySignature(input, key);
4870
4403
  const value = hasKey ? input[key] : void 0;
4871
4404
  if (hasKey && (!isConstructor || value !== void 0)) {
4872
4405
  const match = byValue.get(value);
@@ -4897,44 +4430,20 @@ function getCandidates(input, types, isConstructor = false) {
4897
4430
  return getIndex(types)(input, isConstructor);
4898
4431
  }
4899
4432
  /**
4900
- * AST node representing a union of schemas.
4901
- *
4902
- * **Details**
4903
- *
4904
- * - `types` — the member AST nodes.
4905
- * - `mode` — `"anyOf"` succeeds on the first match (like TypeScript unions);
4906
- * `"oneOf"` requires exactly one member to match (fails if multiple do).
4907
- *
4908
- * During parsing, members are tried in order. An internal candidate index
4909
- * narrows which members to try based on the runtime type of the input and
4910
- * discriminant ("sentinel") fields, making large unions efficient.
4911
- *
4912
- * **Example** (Inspecting a union AST)
4913
- *
4914
- * ```ts import.meta.vitest
4915
- * import { Schema, SchemaAST } from "effect"
4916
- *
4917
- * const schema = Schema.Union([Schema.String, Schema.Number])
4918
- * const ast = schema.ast
4919
- *
4920
- * if (SchemaAST.isUnion(ast)) {
4921
- * [ast.types.length, ast.mode] // => [2, "anyOf"]
4922
- * }
4923
- * ```
4433
+ * Constructs a {@link Union}.
4924
4434
  *
4925
- * @see {@link isUnion}
4926
- * @category models
4927
- * @since 3.10.0
4435
+ * @category constructors
4436
+ * @since 4.0.0
4928
4437
  */
4929
- var Union$1 = class Union$1 extends Base {
4438
+ var Union$1 = class extends ASTNodeImpl {
4930
4439
  _tag = "Union";
4931
4440
  types;
4932
- mode;
4441
+ options;
4933
4442
  encodingChecks;
4934
- constructor(types, mode, annotations, checks, encoding, context, encodingChecks) {
4443
+ constructor(types, options, annotations, checks, encoding, context, encodingChecks) {
4935
4444
  super(annotations, checks, encoding, context);
4936
4445
  this.types = types;
4937
- this.mode = mode;
4446
+ this.options = options;
4938
4447
  this.encodingChecks = encodingChecks;
4939
4448
  }
4940
4449
  /** @internal */
@@ -4943,6 +4452,7 @@ var Union$1 = class Union$1 extends Base {
4943
4452
  return (input, options) => {
4944
4453
  if (input === missing) return missingExit;
4945
4454
  const candidates = getCandidates(input, ast.types, compileConstructorDefault !== void 0);
4455
+ if (candidates.length === 0) return fail$2(new AnyOf(ast, [], input, options));
4946
4456
  if (candidates.length === 1) {
4947
4457
  const result = compile(candidates[0])(input, options);
4948
4458
  if (result._tag === "Success") return result;
@@ -4953,15 +4463,11 @@ var Union$1 = class Union$1 extends Base {
4953
4463
  compile,
4954
4464
  input,
4955
4465
  out: void 0,
4956
- successes: ast.mode === "oneOf" ? [] : void 0,
4466
+ successes: ast.options?.mode === "oneOf" ? [] : void 0,
4957
4467
  issues: void 0,
4958
4468
  options
4959
4469
  };
4960
- const concurrency = resolveConcurrency(options?.concurrency);
4961
- const eff = parseUnion(state, candidates, concurrency ? {
4962
- ...concurrency,
4963
- orderedStep: true
4964
- } : void 0);
4470
+ const eff = parseUnion(state, candidates);
4965
4471
  if (!eff) {
4966
4472
  if (state.out) return state.out;
4967
4473
  return fail$2(new AnyOf(ast, state.issues ?? [], input, options));
@@ -4975,7 +4481,7 @@ var Union$1 = class Union$1 extends Base {
4975
4481
  }
4976
4482
  _rebuild(recur, checks, encodingChecks) {
4977
4483
  const types = mapOrSame(this.types, recur);
4978
- return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Union$1(types, this.mode, this.annotations, checks, void 0, this.context, encodingChecks);
4484
+ return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Union$1(types, this.options, this.annotations, checks, void 0, this.context, encodingChecks);
4979
4485
  }
4980
4486
  /** @internal */
4981
4487
  recur(recur) {
@@ -5046,62 +4552,27 @@ var nonFiniteLiterals = /*#__PURE__*/ new Union$1([
5046
4552
  /*#__PURE__*/ new Literal$1("Infinity"),
5047
4553
  /*#__PURE__*/ new Literal$1("-Infinity"),
5048
4554
  /*#__PURE__*/ new Literal$1("NaN")
5049
- ], "anyOf");
4555
+ ]);
5050
4556
  function formatIsMutable(isMutable) {
5051
4557
  return isMutable ? "" : "readonly ";
5052
4558
  }
5053
4559
  function formatIsOptional(isOptional) {
5054
4560
  return isOptional ? "?" : "";
5055
4561
  }
5056
- /** @internal */
5057
- function memoizeThunk(f) {
5058
- let done = false;
5059
- let a;
5060
- return () => {
5061
- if (done) return a;
5062
- a = f();
5063
- done = true;
5064
- return a;
5065
- };
5066
- }
5067
4562
  /**
5068
- * AST node for lazy/recursive schemas.
5069
- *
5070
- * **Details**
5071
- *
5072
- * Wraps a thunk (`() => AST`) that is memoized on first call. Use this to
5073
- * define recursive or mutually recursive schemas without infinite loops at
5074
- * construction time.
4563
+ * Constructs a {@link Suspend}.
5075
4564
  *
5076
- * **Example** (Defining recursive schema ASTs)
5077
- *
5078
- * ```ts import.meta.vitest
5079
- * import { Schema, SchemaAST } from "effect"
5080
- *
5081
- * interface Category {
5082
- * readonly name: string
5083
- * readonly children: ReadonlyArray<Category>
5084
- * }
5085
- *
5086
- * const Category = Schema.Struct({
5087
- * name: Schema.String,
5088
- * children: Schema.Array(Schema.suspend((): Schema.Codec<Category> => Category))
5089
- * })
5090
- *
5091
- * SchemaAST.isObjects(Category.ast) // => true
5092
- * ```
5093
- *
5094
- * @see {@link isSuspend}
5095
- * @category models
5096
- * @since 3.10.0
4565
+ * @category constructors
4566
+ * @since 4.0.0
5097
4567
  */
5098
- var Suspend = class Suspend extends Base {
4568
+ var Suspend = class extends ASTNodeImpl {
5099
4569
  _tag = "Suspend";
5100
4570
  thunk;
5101
4571
  constructor(thunk, annotations, checks, encoding, context) {
5102
4572
  if (checks) throw new Error("Cannot add checks to Suspend");
5103
4573
  super(annotations, void 0, encoding, context);
5104
- this.thunk = memoizeThunk(thunk);
4574
+ let ast;
4575
+ this.thunk = () => ast ??= thunk();
5105
4576
  }
5106
4577
  /** @internal */
5107
4578
  getParser(compile) {
@@ -5118,27 +4589,12 @@ var Suspend = class Suspend extends Base {
5118
4589
  }
5119
4590
  };
5120
4591
  /**
5121
- * Represents a single validation check attached to an AST node.
5122
- *
5123
- * **Details**
5124
- *
5125
- * - `run` — the validation function. Returns `undefined` on success, or an
5126
- * `Issue` on failure.
5127
- * - `annotations` — optional filter-level annotations (expected message,
5128
- * representation, arbitrary constraint hints).
5129
- * - `aborted` — when `true`, parsing stops immediately after this filter
5130
- * fails (no further checks run).
4592
+ * Constructs a {@link Filter}.
5131
4593
  *
5132
- * Use `.annotate()` to add metadata and `.abort()` to mark as aborting.
5133
- * Combine with another check via `.and()` to form a {@link FilterGroup}.
5134
- *
5135
- * @see {@link FilterGroup}
5136
- * @see {@link Check}
5137
- * @see {@link isPattern}
5138
- * @category models
4594
+ * @category constructors
5139
4595
  * @since 4.0.0
5140
4596
  */
5141
- var Filter = class Filter extends Class {
4597
+ var Filter = class extends Class {
5142
4598
  _tag = "Filter";
5143
4599
  run;
5144
4600
  annotations;
@@ -5166,20 +4622,12 @@ var Filter = class Filter extends Class {
5166
4622
  }
5167
4623
  };
5168
4624
  /**
5169
- * Represents a composite validation check grouping multiple {@link Check} values.
4625
+ * Constructs a {@link FilterGroup}.
5170
4626
  *
5171
- * **Details**
5172
- *
5173
- * Created by calling `.and()` on a {@link Filter} or another `FilterGroup`.
5174
- * All inner checks are run; failures from aborted filters still stop
5175
- * evaluation.
5176
- *
5177
- * @see {@link Filter}
5178
- * @see {@link Check}
5179
- * @category models
4627
+ * @category constructors
5180
4628
  * @since 4.0.0
5181
4629
  */
5182
- var FilterGroup = class FilterGroup extends Class {
4630
+ var FilterGroup = class extends Class {
5183
4631
  _tag = "FilterGroup";
5184
4632
  checks;
5185
4633
  annotations;
@@ -5212,16 +4660,13 @@ function isFinite$1(annotations) {
5212
4660
  },
5213
4661
  toJsonSchema: () => ({ type: "number" }),
5214
4662
  toCode: () => ({ runtime: "Schema.isFinite()" }),
5215
- arbitrary: { constraint: {
5216
- noInfinity: true,
5217
- noNaN: true
5218
- } },
4663
+ arbitraryConstraint: { number: "finite" },
5219
4664
  ...annotations
5220
4665
  });
5221
4666
  }
5222
4667
  /** @internal */
5223
4668
  var finite = /*#__PURE__*/ appendChecks(number, [/*#__PURE__*/ isFinite$1()]);
5224
- var numberToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finite, nonFiniteLiterals], "anyOf"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$3(), /*#__PURE__*/ transform$1((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
4669
+ var numberToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finite, nonFiniteLiterals]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$3(), /*#__PURE__*/ transform$1((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
5225
4670
  /**
5226
4671
  * Creates a {@link Filter} that validates strings by running `RegExp.test`.
5227
4672
  *
@@ -5241,8 +4686,12 @@ var numberToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finite, non
5241
4686
  *
5242
4687
  * **Gotchas**
5243
4688
  *
5244
- * When deriving an arbitrary, only `regExp.source` is used. Regular expression
5245
- * flags are ignored because fast-check does not support them.
4689
+ * Arbitrary metadata preserves both `regExp.source` and `regExp.flags`.
4690
+ * Implementations that cannot consume all flags may still use the source as a
4691
+ * generation hint because the Schema filter validates every generated value.
4692
+ * JSON Schema has no way to carry JavaScript regular-expression flags. The
4693
+ * generated `pattern` contains the source only, so validation can differ when
4694
+ * the RegExp uses flags or relies on JavaScript's non-Unicode behavior.
5246
4695
  *
5247
4696
  * **Example** (Validating an email pattern)
5248
4697
  *
@@ -5274,7 +4723,10 @@ function isPattern$1(regExp, annotations) {
5274
4723
  }
5275
4724
  },
5276
4725
  toJsonSchema: () => ({ pattern: source }),
5277
- arbitrary: { constraint: { patterns: [regExp.source] } },
4726
+ arbitraryConstraint: { patterns: [{
4727
+ source: regExp.source,
4728
+ flags: regExp.flags
4729
+ }] },
5278
4730
  ...annotations
5279
4731
  });
5280
4732
  }
@@ -5307,6 +4759,10 @@ function replaceContext(ast, context) {
5307
4759
  return out;
5308
4760
  }
5309
4761
  /** @internal */
4762
+ function getLastEncoding(ast) {
4763
+ return ast.encoding ? getLastEncoding(ast.encoding[ast.encoding.length - 1].to) : ast;
4764
+ }
4765
+ /** @internal */
5310
4766
  function annotate(ast, annotations) {
5311
4767
  if (ast.checks) {
5312
4768
  const last = ast.checks[ast.checks.length - 1];
@@ -5398,7 +4854,7 @@ var optionalKey$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
5398
4854
  });
5399
4855
  var optionalKeyLastLink = /*#__PURE__*/ applyToLastLink(optionalKey$1);
5400
4856
  /** @internal */
5401
- var optional$1 = /*#__PURE__*/ memoize((ast) => optionalKey$1(new Union$1([ast, undefined_], "anyOf")));
4857
+ var optional$1 = /*#__PURE__*/ memoize((ast) => optionalKey$1(new Union$1([ast, undefined_])));
5402
4858
  /** @internal */
5403
4859
  function withConstructorDefault$1(ast, defaultValue) {
5404
4860
  const constructorDefault = new Link(unknown, new Transformation(withDefault(defaultValue), passthrough$1()));
@@ -5410,9 +4866,8 @@ function withConstructorDefault$1(ast, defaultValue) {
5410
4866
  *
5411
4867
  * **Details**
5412
4868
  *
5413
- * This is the low-level primitive behind `Schema.transform` and
5414
- * `Schema.transformOrFail`. It appends a {@link Link} to the `to` node's
5415
- * encoding chain.
4869
+ * This is the low-level primitive behind `Schema.decodeTo`. It appends a
4870
+ * {@link Link} to the `to` node's encoding chain.
5416
4871
  *
5417
4872
  * - Returns a new AST with the same type as `to`.
5418
4873
  *
@@ -5462,7 +4917,7 @@ function record(key, value) {
5462
4917
  * Checks `ast.context?.isOptional`. Defaults to `false` when no
5463
4918
  * {@link Context} is set.
5464
4919
  *
5465
- * @see {@link optionalKey}
4920
+ * @see `Schema.optionalKey`
5466
4921
  * @see {@link Context}
5467
4922
  * @category predicates
5468
4923
  * @since 4.0.0
@@ -5590,10 +5045,10 @@ function containsUndefined(ast) {
5590
5045
  }
5591
5046
  }
5592
5047
  function fromConst(ast, value) {
5593
- const succeed$4 = succeed(value);
5048
+ const succeed$5 = value === 0 ? sameExit : succeed(value);
5594
5049
  return (input, options) => {
5595
5050
  if (input === missing) return missingExit;
5596
- if (input === value) return succeed$4;
5051
+ if (input === value) return succeed$5;
5597
5052
  return fail$2(new InvalidType(ast, input, options));
5598
5053
  };
5599
5054
  }
@@ -5692,7 +5147,7 @@ function isStringFinite$1(annotations) {
5692
5147
  }
5693
5148
  var finiteString = /*#__PURE__*/ appendChecks(string, [/*#__PURE__*/ isStringFinite$1()]);
5694
5149
  var finiteToString = /*#__PURE__*/ new Link(finiteString, numberFromString);
5695
- var numberToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finiteString, nonFiniteLiterals], "anyOf"), numberFromString);
5150
+ var numberToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finiteString, nonFiniteLiterals]), numberFromString);
5696
5151
  var isStringBigIntRegExp = /*#__PURE__*/ new globalThis.RegExp(`^-?\\d+$`);
5697
5152
  /** @internal */
5698
5153
  function isStringBigInt(annotations) {
@@ -5800,13 +5255,12 @@ var Json$1 = /*#__PURE__*/ new Declaration([], () => (input, ast, options) => is
5800
5255
  },
5801
5256
  expected: "JSON value",
5802
5257
  toCodecJson: () => void 0,
5803
- toCodecStringTree: () => unknownToStringTree,
5804
- toArbitrary: () => (fc) => fc.jsonValue()
5258
+ toCodecStringTree: () => unknownToStringTree
5805
5259
  });
5806
5260
  /** @internal */
5807
5261
  var unknownToJson = /*#__PURE__*/ new Link(Json$1, /*#__PURE__*/ passthrough());
5808
5262
  /** @internal */
5809
- var objectKeywordToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Arrays(false, [], [Json$1]), /*#__PURE__*/ new Objects([], [/*#__PURE__*/ new IndexSignature(string, Json$1)])], "anyOf"), /*#__PURE__*/ passthrough());
5263
+ var objectKeywordToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Arrays(false, [], [Json$1]), /*#__PURE__*/ new Objects([], [/*#__PURE__*/ new IndexSignature(string, Json$1)])]), /*#__PURE__*/ passthrough());
5810
5264
  /**
5811
5265
  * Returns true if the value is a StringTree value.
5812
5266
  *
@@ -5823,7 +5277,7 @@ var unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declaration
5823
5277
  toCodecStringTree: () => void 0
5824
5278
  }), /*#__PURE__*/ passthrough());
5825
5279
  //#endregion
5826
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/SchemaParser.js
5280
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaParser.js
5827
5281
  /**
5828
5282
  * Runs schemas against real values.
5829
5283
  *
@@ -5854,9 +5308,10 @@ var unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declaration
5854
5308
  * @since 4.0.0
5855
5309
  */
5856
5310
  function makeEffect(schema) {
5857
- const parser = runWithCompiler(constructorCompiler, toType$1(schema.ast));
5311
+ const ast = schema.ast;
5312
+ let parser;
5858
5313
  return (input, options) => {
5859
- return parser(input, options?.disableChecks ? options?.parseOptions ? {
5314
+ return (parser ??= runWithCompiler(constructorCompiler, toType$1(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
5860
5315
  ...options.parseOptions,
5861
5316
  disableChecks: true
5862
5317
  } : { disableChecks: true } : options?.parseOptions);
@@ -5914,7 +5369,7 @@ function makeOption(schema) {
5914
5369
  * @category constructors
5915
5370
  * @since 4.0.0
5916
5371
  */
5917
- function make$2(schema) {
5372
+ function make$3(schema) {
5918
5373
  const parser = makeEffect(schema);
5919
5374
  return (input, options) => {
5920
5375
  const exit = runSyncExit(parser(input, options));
@@ -6115,11 +5570,7 @@ function makeParser(ast, compile, compileConstructorDefault, constructorDefault)
6115
5570
  const checks = ast.checks;
6116
5571
  const links = constructorDefault ? ast.encoding ? [...ast.encoding, constructorDefault] : [constructorDefault] : ast.encoding;
6117
5572
  const encodingChecks = ast.encodingChecks;
6118
- const astOptions = (checks ? checks[checks.length - 1].annotations : ast.annotations)?.["parseOptions"];
6119
- if (!links && !checks && !encodingChecks) {
6120
- if (!astOptions) return parser;
6121
- return (input, options) => parser(input, mergeParseOptions(options, astOptions));
6122
- }
5573
+ if (!links && !checks && !encodingChecks) return parser;
6123
5574
  let encodingParsers;
6124
5575
  const parseLocal = (input, options) => {
6125
5576
  let result = parser(input, options);
@@ -6158,9 +5609,8 @@ function makeParser(ast, compile, compileConstructorDefault, constructorDefault)
6158
5609
  }
6159
5610
  return result;
6160
5611
  };
6161
- if (!links) return astOptions ? (input, options) => parseLocal(input, mergeParseOptions(options, astOptions)) : parseLocal;
5612
+ if (!links) return parseLocal;
6162
5613
  return (input, options) => {
6163
- if (astOptions) options = mergeParseOptions(options, astOptions);
6164
5614
  const parsers = encodingParsers ??= links.map((link) => compile(link.to));
6165
5615
  let current = input;
6166
5616
  let result = parsers[parsers.length - 1](input, options);
@@ -6190,11 +5640,11 @@ function makeParser(ast, compile, compileConstructorDefault, constructorDefault)
6190
5640
  };
6191
5641
  }
6192
5642
  //#endregion
6193
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/internal/schema/schema.js
5643
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/make.js
6194
5644
  /** @internal */
6195
- var TypeId$1 = "~effect/Schema/Schema";
5645
+ var TypeId$3 = "~effect/Schema/Schema";
6196
5646
  var SchemaProto = {
6197
- [TypeId$1]: TypeId$1,
5647
+ [TypeId$3]: TypeId$3,
6198
5648
  pipe() {
6199
5649
  return pipeArguments(this, arguments);
6200
5650
  },
@@ -6209,58 +5659,436 @@ var SchemaProto = {
6209
5659
  }
6210
5660
  };
6211
5661
  /** @internal */
6212
- function make$1(ast, options) {
5662
+ function make$2(ast, options) {
6213
5663
  function Schema() {}
6214
- const self = Object.defineProperties(Object.setPrototypeOf(Schema, SchemaProto), Object.getOwnPropertyDescriptors({ ...options }));
5664
+ const self = Object.setPrototypeOf(Schema, SchemaProto);
5665
+ if (options && (Object.hasOwn(options, "name") || Object.hasOwn(options, "length") || Object.hasOwn(options, "__proto__"))) Object.defineProperties(self, Object.getOwnPropertyDescriptors({ ...options }));
5666
+ else Object.assign(self, options);
6215
5667
  self.ast = ast;
6216
- self.rebuild = (ast) => make$1(ast, options);
5668
+ self.rebuild = (ast) => make$2(ast, options);
6217
5669
  self.makeEffect = makeEffect(self);
6218
- self.make = make$2(self);
5670
+ self.make = make$3(self);
6219
5671
  self.makeOption = makeOption(self);
6220
5672
  return self;
6221
5673
  }
6222
5674
  //#endregion
6223
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/Struct.js
5675
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toCodec.js
5676
+ /** @internal */
5677
+ function toCodecJson$1(schema) {
5678
+ return make$2(toCodecJsonAST(schema.ast), { schema });
5679
+ }
5680
+ /** @internal */
5681
+ var toCodecJsonAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
5682
+ const out = toCodecJsonASTStep(ast, toCodecJsonAST);
5683
+ const context = ast.context;
5684
+ if (out === ast || context === void 0) return out;
5685
+ return replaceContextLastLink(out, withoutConstructorDefault(context));
5686
+ });
5687
+ function withoutConstructorDefault(context) {
5688
+ return context.constructorDefault === void 0 ? context : new Context(context.isOptional, context.isMutable, void 0, context.annotations);
5689
+ }
5690
+ function validateCanonicalObjectPropertyNames(ast) {
5691
+ if (ast.propertySignatures.some((ps) => typeof ps.name !== "string")) throw new globalThis.Error("Objects property names must be strings", { cause: ast });
5692
+ }
5693
+ function makeReorder(getPriority) {
5694
+ return (types) => {
5695
+ const indexMap = /* @__PURE__ */ new Map();
5696
+ for (let i = 0; i < types.length; i++) indexMap.set(toEncoded(types[i]), i);
5697
+ const sortedTypes = [...types].sort((a, b) => {
5698
+ a = toEncoded(a);
5699
+ b = toEncoded(b);
5700
+ const pa = getPriority(a);
5701
+ const pb = getPriority(b);
5702
+ if (pa !== pb) return pa - pb;
5703
+ return indexMap.get(a) - indexMap.get(b);
5704
+ });
5705
+ if (!sortedTypes.some((ast, index) => ast !== types[index])) return types;
5706
+ return sortedTypes;
5707
+ };
5708
+ }
5709
+ var toCodecJsonReorder = /*#__PURE__*/ makeReorder((ast) => {
5710
+ switch (ast._tag) {
5711
+ case "BigInt":
5712
+ case "Symbol":
5713
+ case "UniqueSymbol": return 0;
5714
+ default: return 1;
5715
+ }
5716
+ });
5717
+ function toCodecJsonASTStep(ast, recur) {
5718
+ switch (ast._tag) {
5719
+ case "Declaration": {
5720
+ const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
5721
+ if (!isFunction(getLink)) return replaceEncoding(ast, [unknownToJson]);
5722
+ const link = getLink(ast.typeParameters.map((tp) => make$2(toEncoded(tp))));
5723
+ return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, recur)]);
5724
+ }
5725
+ case "Unknown": return replaceEncoding(ast, [unknownToJson]);
5726
+ case "ObjectKeyword": return replaceEncoding(ast, [objectKeywordToJson]);
5727
+ case "Undefined":
5728
+ case "Void":
5729
+ case "Literal":
5730
+ case "Number": return ast.toCodecJson();
5731
+ case "UniqueSymbol":
5732
+ case "Symbol":
5733
+ case "BigInt": return ast.toCodecStringTree();
5734
+ case "Objects":
5735
+ validateCanonicalObjectPropertyNames(ast);
5736
+ return ast.recur(recur, parameterFromString);
5737
+ case "Union": {
5738
+ const sortedTypes = toCodecJsonReorder(ast.types);
5739
+ if (sortedTypes !== ast.types) return new Union$1(sortedTypes, ast.options, ast.annotations, ast.checks, ast.encoding, ast.context, ast.encodingChecks).recur(recur);
5740
+ return ast.recur(recur);
5741
+ }
5742
+ case "Arrays":
5743
+ case "Suspend": return ast.recur(recur);
5744
+ }
5745
+ return ast;
5746
+ }
5747
+ //#endregion
5748
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Struct.js
5749
+ /**
5750
+ * Wraps a plain function as a {@link Lambda} value so it can be used with
5751
+ * {@link map}, {@link mapPick}, and {@link mapOmit}.
5752
+ *
5753
+ * **When to use**
5754
+ *
5755
+ * Use to create a typed lambda for struct mapping APIs that need type-level
5756
+ * input and output tracking.
5757
+ *
5758
+ * **Details**
5759
+ *
5760
+ * The type parameter `L` encodes both the input and output types at the type
5761
+ * level, allowing the compiler to track how struct value types change. At
5762
+ * runtime, the returned value is the same function; `lambda` only adjusts the
5763
+ * type.
5764
+ *
5765
+ * **Example** (Wrapping values in arrays)
5766
+ *
5767
+ * ```ts import.meta.vitest
5768
+ * import { pipe, Struct } from "effect"
5769
+ *
5770
+ * interface AsArray extends Struct.Lambda {
5771
+ * <A>(self: A): Array<A>
5772
+ * readonly "~lambda.out": Array<this["~lambda.in"]>
5773
+ * }
5774
+ *
5775
+ * const asArray = Struct.lambda<AsArray>((a) => [a])
5776
+ * const result = pipe({ x: 1, y: "hello" }, Struct.map(asArray))
5777
+ * result // => { x: [1], y: ["hello"] }
5778
+ * ```
5779
+ *
5780
+ * @see {@link Lambda} – the type-level interface
5781
+ * @see {@link map} – apply a lambda to all struct values
5782
+ * @category constructors
5783
+ * @since 4.0.0
5784
+ */
5785
+ var lambda = (f) => f;
5786
+ //#endregion
5787
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schemaError.js
5788
+ var SchemaErrorTypeId = "~effect/Schema/SchemaError";
5789
+ function isSchemaError$1(u) {
5790
+ return hasProperty(u, "~effect/Schema/SchemaError") && u["~effect/Schema/SchemaError"] === "~effect/Schema/SchemaError";
5791
+ }
5792
+ //#endregion
5793
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/Cookies.js
5794
+ /**
5795
+ * Models HTTP cookies and cookie collections for requests and responses.
5796
+ *
5797
+ * A `Cookie` stores a name, value, encoded value, and standard cookie
5798
+ * attributes. A `Cookies` value is an immutable collection keyed by cookie
5799
+ * name. This module parses request `Cookie` headers, builds response
5800
+ * `Set-Cookie` headers, and provides helpers for adding, removing, merging, and
5801
+ * expiring cookies.
5802
+ *
5803
+ * @since 4.0.0
5804
+ */
5805
+ var TypeId$2 = "~effect/http/Cookies";
5806
+ var CookieTypeId = "~effect/http/Cookies/Cookie";
5807
+ TaggedError$1("CookiesError");
5808
+ var Proto$1 = {
5809
+ [TypeId$2]: TypeId$2,
5810
+ ...BaseProto,
5811
+ toJSON() {
5812
+ return {
5813
+ _id: "effect/Cookies",
5814
+ cookies: map(this.cookies, (cookie) => cookie.toJSON())
5815
+ };
5816
+ },
5817
+ pipe() {
5818
+ return pipeArguments(this, arguments);
5819
+ }
5820
+ };
5821
+ /**
5822
+ * Creates a `Cookies` collection from an existing readonly record of cookies keyed by cookie name.
5823
+ *
5824
+ * @category constructors
5825
+ * @since 4.0.0
5826
+ */
5827
+ var fromReadonlyRecord = (cookies) => {
5828
+ const self = Object.create(Proto$1);
5829
+ self.cookies = cookies;
5830
+ return self;
5831
+ };
5832
+ /**
5833
+ * Create a Cookies object from an Iterable
5834
+ *
5835
+ * @category constructors
5836
+ * @since 4.0.0
5837
+ */
5838
+ var fromIterable = (cookies) => {
5839
+ const record = {};
5840
+ for (const cookie of cookies) assignProperty(record, cookie.name, cookie);
5841
+ return fromReadonlyRecord(record);
5842
+ };
5843
+ /**
5844
+ * Create a Cookies object from a set of Set-Cookie headers
5845
+ *
5846
+ * @category constructors
5847
+ * @since 4.0.0
5848
+ */
5849
+ var fromSetCookie = (headers) => {
5850
+ const arrayHeaders = typeof headers === "string" ? [headers] : headers;
5851
+ const cookies = [];
5852
+ for (const header of arrayHeaders) {
5853
+ const cookie = parseSetCookie(header.trim());
5854
+ if (cookie) cookies.push(cookie);
5855
+ }
5856
+ return fromIterable(cookies);
5857
+ };
5858
+ function parseSetCookie(header) {
5859
+ const parts = header.split(";").map((_) => _.trim()).filter((_) => _ !== "");
5860
+ if (parts.length === 0) return;
5861
+ const firstEqual = parts[0].indexOf("=");
5862
+ if (firstEqual === -1) return;
5863
+ const name = parts[0].slice(0, firstEqual);
5864
+ if (!cookieNameRegExp.test(name)) return;
5865
+ const valueEncoded = parts[0].slice(firstEqual + 1);
5866
+ const value = tryDecodeURIComponent(valueEncoded);
5867
+ if (parts.length === 1) return Object.assign(Object.create(CookieProto), {
5868
+ name,
5869
+ value,
5870
+ valueEncoded
5871
+ });
5872
+ const options = {};
5873
+ for (let i = 1; i < parts.length; i++) {
5874
+ const part = parts[i];
5875
+ const equalIndex = part.indexOf("=");
5876
+ const key = equalIndex === -1 ? part : part.slice(0, equalIndex).trim();
5877
+ const value = equalIndex === -1 ? void 0 : part.slice(equalIndex + 1).trim();
5878
+ switch (key.toLowerCase()) {
5879
+ case "domain": {
5880
+ if (value === void 0) break;
5881
+ const domain = value.trim().replace(/^\./, "");
5882
+ if (domain) options.domain = domain;
5883
+ break;
5884
+ }
5885
+ case "expires": {
5886
+ if (value === void 0) break;
5887
+ const date = new Date(value);
5888
+ if (!isNaN(date.getTime())) options.expires = date;
5889
+ break;
5890
+ }
5891
+ case "max-age": {
5892
+ if (value === void 0) break;
5893
+ const maxAge = parseInt(value, 10);
5894
+ if (!isNaN(maxAge)) options.maxAge = seconds(maxAge);
5895
+ break;
5896
+ }
5897
+ case "path":
5898
+ if (value === void 0) break;
5899
+ if (value[0] === "/") options.path = value;
5900
+ break;
5901
+ case "priority":
5902
+ if (value === void 0) break;
5903
+ switch (value.toLowerCase()) {
5904
+ case "low":
5905
+ options.priority = "low";
5906
+ break;
5907
+ case "medium":
5908
+ options.priority = "medium";
5909
+ break;
5910
+ case "high": options.priority = "high";
5911
+ }
5912
+ break;
5913
+ case "httponly":
5914
+ options.httpOnly = true;
5915
+ break;
5916
+ case "secure":
5917
+ options.secure = true;
5918
+ break;
5919
+ case "partitioned":
5920
+ options.partitioned = true;
5921
+ break;
5922
+ case "samesite":
5923
+ if (value === void 0) break;
5924
+ switch (value.toLowerCase()) {
5925
+ case "lax":
5926
+ options.sameSite = "lax";
5927
+ break;
5928
+ case "strict":
5929
+ options.sameSite = "strict";
5930
+ break;
5931
+ case "none": options.sameSite = "none";
5932
+ }
5933
+ }
5934
+ }
5935
+ return Object.assign(Object.create(CookieProto), {
5936
+ name,
5937
+ value,
5938
+ valueEncoded,
5939
+ options: Object.keys(options).length > 0 ? options : void 0
5940
+ });
5941
+ }
5942
+ var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
5943
+ var CookieProto = {
5944
+ [CookieTypeId]: CookieTypeId,
5945
+ ...BaseProto,
5946
+ toJSON() {
5947
+ return {
5948
+ _id: "effect/Cookies/Cookie",
5949
+ name: this.name,
5950
+ value: this.value,
5951
+ options: this.options
5952
+ };
5953
+ }
5954
+ };
5955
+ var tryDecodeURIComponent = (str) => {
5956
+ try {
5957
+ return decodeURIComponent(str);
5958
+ } catch (_) {
5959
+ return str;
5960
+ }
5961
+ };
5962
+ //#endregion
5963
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/http/UrlParams.js
5964
+ /**
5965
+ * Models URL query parameters as ordered string pairs.
5966
+ *
5967
+ * `UrlParams` is used for HTTP client query strings, URL-encoded form bodies,
5968
+ * and server-side decoding. Values can be built from records, iterables, or
5969
+ * native `URLSearchParams`, then updated, serialized, converted to a `URL`, or
5970
+ * decoded with schemas.
5971
+ *
5972
+ * @since 4.0.0
5973
+ */
5974
+ var TypeId$1 = "~effect/http/UrlParams";
5975
+ /**
5976
+ * Returns `true` when a value is a `UrlParams` instance.
5977
+ *
5978
+ * @category guards
5979
+ * @since 4.0.0
5980
+ */
5981
+ var isUrlParams = (u) => hasProperty(u, TypeId$1);
5982
+ var Proto = {
5983
+ ...PipeInspectableProto,
5984
+ [TypeId$1]: TypeId$1,
5985
+ [Symbol.iterator]() {
5986
+ return this.params[Symbol.iterator]();
5987
+ },
5988
+ toJSON() {
5989
+ return {
5990
+ _id: "UrlParams",
5991
+ params: Object.fromEntries(this.params)
5992
+ };
5993
+ },
5994
+ [symbol$1](that) {
5995
+ return Equivalence(this, that);
5996
+ },
5997
+ [symbol]() {
5998
+ return array(this.params.flat());
5999
+ }
6000
+ };
6224
6001
  /**
6225
- * Wraps a plain function as a {@link Lambda} value so it can be used with
6226
- * {@link map}, {@link mapPick}, and {@link mapOmit}.
6002
+ * Creates `UrlParams` from ordered string key-value pairs.
6227
6003
  *
6228
- * **When to use**
6004
+ * **Details**
6229
6005
  *
6230
- * Use to create a typed lambda for struct mapping APIs that need type-level
6231
- * input and output tracking.
6006
+ * The input pairs are used as-is and are not coerced or normalized.
6007
+ *
6008
+ * @category constructors
6009
+ * @since 4.0.0
6010
+ */
6011
+ var make$1 = (params) => {
6012
+ const self = Object.create(Proto);
6013
+ self.params = params;
6014
+ return self;
6015
+ };
6016
+ /**
6017
+ * Creates `UrlParams` from a supported input shape.
6232
6018
  *
6233
6019
  * **Details**
6234
6020
  *
6235
- * The type parameter `L` encodes both the input and output types at the type
6236
- * level, allowing the compiler to track how struct value types change. At
6237
- * runtime, the returned value is the same function; `lambda` only adjusts the
6238
- * type.
6021
+ * Primitive values are converted to strings, arrays produce repeated parameters,
6022
+ * nested records use bracket notation, and `undefined` values are omitted.
6239
6023
  *
6240
- * **Example** (Wrapping values in arrays)
6024
+ * @category constructors
6025
+ * @since 4.0.0
6026
+ */
6027
+ var fromInput = (input) => {
6028
+ if (isUrlParams(input)) return input;
6029
+ const parsed = fromInputNested(input);
6030
+ const out = [];
6031
+ for (let i = 0; i < parsed.length; i++) if (Array.isArray(parsed[i][0])) {
6032
+ const [keys, value] = parsed[i];
6033
+ out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value]);
6034
+ } else out.push(parsed[i]);
6035
+ return make$1(out);
6036
+ };
6037
+ var fromInputNested = (input) => {
6038
+ const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$1(input) : Object.entries(input);
6039
+ const out = [];
6040
+ for (const [key, value] of entries) if (Array.isArray(value)) {
6041
+ for (let i = 0; i < value.length; i++) if (value[i] !== void 0) out.push([key, String(value[i])]);
6042
+ } else if (value !== null && typeof value === "object") {
6043
+ const nested = fromInputNested(value);
6044
+ for (const [k, v] of nested) out.push([[key, ...typeof k === "string" ? [k] : k], v]);
6045
+ } else if (value !== void 0) out.push([key, String(value)]);
6046
+ return out;
6047
+ };
6048
+ /**
6049
+ * Provides an order-sensitive `Equivalence` instance for `UrlParams`.
6241
6050
  *
6242
- * ```ts import.meta.vitest
6243
- * import { pipe, Struct } from "effect"
6051
+ * **Details**
6244
6052
  *
6245
- * interface AsArray extends Struct.Lambda {
6246
- * <A>(self: A): Array<A>
6247
- * readonly "~lambda.out": Array<this["~lambda.in"]>
6248
- * }
6053
+ * Two values are equivalent when they contain the same key-value pairs in the same
6054
+ * order.
6249
6055
  *
6250
- * const asArray = Struct.lambda<AsArray>((a) => [a])
6251
- * const result = pipe({ x: 1, y: "hello" }, Struct.map(asArray))
6252
- * result // => { x: [1], y: ["hello"] }
6253
- * ```
6056
+ * @category instances
6057
+ * @since 4.0.0
6058
+ */
6059
+ var Equivalence = /*#__PURE__*/ make$9((a, b) => arrayEquivalence(a.params, b.params));
6060
+ var arrayEquivalence = /*#__PURE__*/ makeEquivalence$2(/*#__PURE__*/ makeEquivalence$1([/*#__PURE__*/ strictEqual(), /*#__PURE__*/ strictEqual()]));
6061
+ /**
6062
+ * An empty `UrlParams` value.
6254
6063
  *
6255
- * @see {@link Lambda} – the type-level interface
6256
- * @see {@link map} – apply a lambda to all struct values
6257
6064
  * @category constructors
6258
6065
  * @since 4.0.0
6259
6066
  */
6260
- var lambda = (f) => f;
6067
+ var empty = /*#__PURE__*/ make$1([]);
6068
+ /**
6069
+ * Sets multiple query parameters from input.
6070
+ *
6071
+ * **Details**
6072
+ *
6073
+ * Keys present in the input replace existing values for those keys, while
6074
+ * unmentioned existing parameters are preserved.
6075
+ *
6076
+ * @category combinators
6077
+ * @since 4.0.0
6078
+ */
6079
+ var setAll = /*#__PURE__*/ dual(2, (self, input) => {
6080
+ const params = fromInput(input).params.slice();
6081
+ const keys = /* @__PURE__ */ new Set();
6082
+ for (let i = 0; i < params.length; i++) keys.add(params[i][0]);
6083
+ for (let i = 0; i < self.params.length; i++) {
6084
+ if (keys.has(self.params[i][0])) continue;
6085
+ params.push(self.params[i]);
6086
+ }
6087
+ return make$1(params);
6088
+ });
6261
6089
  //#endregion
6262
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.112/node_modules/effect/dist/Schema.js
6263
- var TypeId = TypeId$1;
6090
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Schema.js
6091
+ var TypeId = TypeId$3;
6264
6092
  /**
6265
6093
  * Creates a schema for a **parametric** type (a generic container such as
6266
6094
  * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
@@ -6356,7 +6184,6 @@ function declareConstructor() {
6356
6184
  function declare(is, annotations) {
6357
6185
  return declareConstructor()([], () => (input, ast, options) => is(input) ? succeed$3(input) : fail$2(new InvalidType(ast, input, options)), annotations);
6358
6186
  }
6359
- var SchemaErrorTypeId = "~effect/SchemaError/SchemaError";
6360
6187
  /**
6361
6188
  * Error thrown or returned when schema decoding or encoding fails.
6362
6189
  *
@@ -6426,7 +6253,28 @@ var SchemaError = class extends TaggedError$1("SchemaError") {
6426
6253
  * @since 4.0.0
6427
6254
  */
6428
6255
  function isSchemaError(u) {
6429
- return hasProperty(u, SchemaErrorTypeId) && u[SchemaErrorTypeId] === SchemaErrorTypeId;
6256
+ return isSchemaError$1(u);
6257
+ }
6258
+ function fromIssueEffect(self) {
6259
+ if (effectIsExit(self)) return fromIssueExit(self);
6260
+ return catchCause(self, (cause) => failCauseSync(() => map$4(cause, (issue) => new SchemaError(issue))));
6261
+ }
6262
+ function fromIssueExit(exit) {
6263
+ return isSuccess(exit) ? exit : failCause(map$4(exit.cause, (issue) => new SchemaError(issue)));
6264
+ }
6265
+ function getSchemaErrorOrThrow(cause, message) {
6266
+ let schemaError;
6267
+ for (const reason of cause.reasons) {
6268
+ if (!isFailReason(reason) || !isSchemaError(reason.error)) throw new globalThis.Error(message, { cause });
6269
+ schemaError ??= reason.error;
6270
+ }
6271
+ if (schemaError === void 0) throw new globalThis.Error(message, { cause });
6272
+ return schemaError;
6273
+ }
6274
+ function runSchemaErrorSync(self) {
6275
+ const exit = runSyncExit(self);
6276
+ if (isSuccess(exit)) return exit.value;
6277
+ throw getSchemaErrorOrThrow(exit.cause, "Sync adapter can only throw schema errors");
6430
6278
  }
6431
6279
  /**
6432
6280
  * Creates a type guard function that checks if a value conforms to a given
@@ -6493,10 +6341,6 @@ function decodeUnknownEffect(schema, options) {
6493
6341
  return fromIssueEffect(parser(input, options));
6494
6342
  };
6495
6343
  }
6496
- function fromIssueEffect(self) {
6497
- if (effectIsExit(self)) return fromIssueExit(self);
6498
- return catchCause(self, (cause) => failCauseSync(() => map$4(cause, (issue) => new SchemaError(issue))));
6499
- }
6500
6344
  /**
6501
6345
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
6502
6346
  * returning an `Effect` that succeeds with the decoded value or fails with a
@@ -6519,23 +6363,6 @@ function fromIssueEffect(self) {
6519
6363
  * @since 4.0.0
6520
6364
  */
6521
6365
  var decodeEffect = decodeUnknownEffect;
6522
- function getSchemaErrorOrThrow(cause, message) {
6523
- let schemaError;
6524
- for (const reason of cause.reasons) {
6525
- if (!isFailReason(reason) || !isSchemaError(reason.error)) throw new globalThis.Error(message, { cause });
6526
- schemaError ??= reason.error;
6527
- }
6528
- if (schemaError === void 0) throw new globalThis.Error(message, { cause });
6529
- return schemaError;
6530
- }
6531
- function runSchemaErrorSync(self) {
6532
- const exit = runSyncExit(self);
6533
- if (isSuccess(exit)) return exit.value;
6534
- throw getSchemaErrorOrThrow(exit.cause, "Sync adapter can only throw schema errors");
6535
- }
6536
- function fromIssueExit(exit) {
6537
- return isSuccess(exit) ? exit : failCause(map$4(exit.cause, (issue) => new SchemaError(issue)));
6538
- }
6539
6366
  /**
6540
6367
  * Decodes an `unknown` input against a schema, returning an `Option` that is
6541
6368
  * `Some` with the decoded value on success or `None` for schema mismatches.
@@ -6799,7 +6626,7 @@ var encodeEffect = encodeUnknownEffect;
6799
6626
  * @category constructors
6800
6627
  * @since 3.10.0
6801
6628
  */
6802
- var make = make$1;
6629
+ var make = make$2;
6803
6630
  /**
6804
6631
  * Checks whether a value is a `Schema`.
6805
6632
  *
@@ -6904,8 +6731,8 @@ function Literal(literal) {
6904
6731
  });
6905
6732
  return out;
6906
6733
  }
6907
- function templateLiteralFromParts(parts) {
6908
- return new TemplateLiteral$1(parts.map((part) => isSchema(part) ? part.ast : new Literal$1(part)));
6734
+ function templateLiteralParts(parts) {
6735
+ return parts.map((part) => isSchema(part) ? part.ast : new Literal$1(part));
6909
6736
  }
6910
6737
  /**
6911
6738
  * Creates a schema that validates strings by matching ordered template literal
@@ -6922,6 +6749,13 @@ function templateLiteralFromParts(parts) {
6922
6749
  * encoded type is `string`, `number`, or `bigint`. Checks on string, number,
6923
6750
  * and bigint schema parts are applied while matching each segment.
6924
6751
  *
6752
+ * **Gotchas**
6753
+ *
6754
+ * Parts must not contain encodings, including inside unions or nested templates.
6755
+ * Construction throws for transformed parts even when their decoded and encoded
6756
+ * types are the same. Use {@link TemplateLiteralParser} to decode transformed parts.
6757
+ * Brands and supported checks without encodings remain valid.
6758
+ *
6925
6759
  * **Example** (Defining a URL path pattern)
6926
6760
  *
6927
6761
  * ```ts import.meta.vitest
@@ -6936,9 +6770,16 @@ function templateLiteralFromParts(parts) {
6936
6770
  * @since 3.10.0
6937
6771
  */
6938
6772
  function TemplateLiteral(parts) {
6939
- return make(templateLiteralFromParts(parts), { parts });
6773
+ return make(new TemplateLiteral$1(templateLiteralParts(parts)), { parts });
6940
6774
  }
6941
6775
  /**
6776
+ * Schema for the `never` type. Always fails validation — no value satisfies it.
6777
+ *
6778
+ * @category schemas
6779
+ * @since 3.10.0
6780
+ */
6781
+ var Never = /*#__PURE__*/ make(never);
6782
+ /**
6942
6783
  * Schema for the `unknown` type. Accepts any value without validation.
6943
6784
  *
6944
6785
  * **When to use**
@@ -7035,6 +6876,9 @@ function makeStruct(ast, fields) {
7035
6876
  *
7036
6877
  * The resulting schema's `Type` is a readonly object type with the fields'
7037
6878
  * decoded types. The `Encoded` form mirrors the field schemas' encoded types.
6879
+ * Declared fields may be inherited and are copied to own properties in the
6880
+ * output. The `__proto__` field is accepted only when it is an own property.
6881
+ * Parsing does not guarantee that output keys retain their input order.
7038
6882
  *
7039
6883
  * **Example** (Defining a basic struct)
7040
6884
  *
@@ -7131,8 +6975,9 @@ function extendTo(fields, derive) {
7131
6975
  *
7132
6976
  * When decoded or encoded key transformations produce the same property key,
7133
6977
  * sequential parsing applies selected own properties in selection order, so
7134
- * the later selected property overwrites the earlier value. With concurrency
7135
- * greater than `1`, completion order determines which value is retained.
6978
+ * the later selected property overwrites the earlier value. Dynamic key
6979
+ * selection always examines own properties. Finite literal keys are declared
6980
+ * fields and may therefore be inherited. Output key order is not guaranteed.
7136
6981
  *
7137
6982
  * **Example** (Defining a string-keyed record of numbers)
7138
6983
  *
@@ -7223,30 +7068,12 @@ function Tuple(elements) {
7223
7068
  * @since 4.0.0
7224
7069
  */
7225
7070
  var ArraySchema = /*#__PURE__*/ lambda((schema) => make(new Arrays(false, [], [schema.ast]), { value: schema }));
7226
- /**
7227
- * Defines a non-empty `ReadonlyArray` schema — at least one element required.
7228
- * Type is `readonly [T, ...T[]]`.
7229
- *
7230
- * **Example** (Defining a non-empty array of numbers)
7231
- *
7232
- * ```ts import.meta.vitest
7233
- * import { Schema } from "effect"
7234
- *
7235
- * const schema = Schema.NonEmptyArray(Schema.Number)
7236
- *
7237
- * Schema.decodeUnknownSync(schema)([1, 2, 3]) // => [1, 2, 3]
7238
- * ```
7239
- *
7240
- * @category constructors
7241
- * @since 3.10.0
7242
- */
7243
- var NonEmptyArray = /*#__PURE__*/ lambda((schema) => make(new Arrays(false, [schema.ast], [schema.ast]), { value: schema }));
7244
7071
  function makeUnion(ast, members) {
7245
7072
  return make(ast, {
7246
7073
  members,
7247
7074
  mapMembers(f, options) {
7248
7075
  const members = f(this.members);
7249
- return makeUnion(union(members, this.ast.mode, options?.unsafePreserveChecks ? this.ast.checks : void 0), members);
7076
+ return makeUnion(union(members, this.ast.options, options?.unsafePreserveChecks ? this.ast.checks : void 0), members);
7250
7077
  }
7251
7078
  });
7252
7079
  }
@@ -7275,7 +7102,7 @@ function makeUnion(ast, members) {
7275
7102
  * @since 3.10.0
7276
7103
  */
7277
7104
  function Union(members, options) {
7278
- return makeUnion(union(members, options?.mode ?? "anyOf", void 0), members);
7105
+ return makeUnion(union(members, options, void 0), members);
7279
7106
  }
7280
7107
  /**
7281
7108
  * Creates a union schema from an array of literal values.
@@ -7295,7 +7122,7 @@ function Union(members, options) {
7295
7122
  */
7296
7123
  function Literals(literals) {
7297
7124
  const members = literals.map(Literal);
7298
- return make(union(members, "anyOf", void 0), {
7125
+ return make(union(members, void 0, void 0), {
7299
7126
  literals,
7300
7127
  members,
7301
7128
  mapMembers(f) {
@@ -7458,13 +7285,24 @@ function catchDecodingWithContext(f) {
7458
7285
  }
7459
7286
  function decodeTo(to, transformation) {
7460
7287
  return (from) => {
7461
- return make(decodeTo$1(from.ast, to.ast, transformation ? make$3(transformation) : passthrough()), {
7288
+ return make(decodeTo$1(from.ast, to.ast, transformation ? make$4(transformation) : passthrough()), {
7462
7289
  from,
7463
7290
  to
7464
7291
  });
7465
7292
  };
7466
7293
  }
7467
7294
  /**
7295
+ * Constructs a decode-only `SchemaAST.Link`.
7296
+ *
7297
+ * @internal
7298
+ */
7299
+ function linkDecoding() {
7300
+ return (to, decode) => link()(to, {
7301
+ decode,
7302
+ encode: forbiddenEncoding
7303
+ });
7304
+ }
7305
+ /**
7468
7306
  * Applies a transformation to a schema, creating a new schema with the same type but transformed encoding/decoding.
7469
7307
  *
7470
7308
  * **When to use**
@@ -7648,7 +7486,7 @@ function instanceOf(constructor, annotations) {
7648
7486
  */
7649
7487
  function link() {
7650
7488
  return (encodeTo, transformation) => {
7651
- return new Link(encodeTo.ast, make$3(transformation));
7489
+ return new Link(encodeTo.ast, make$4(transformation));
7652
7490
  };
7653
7491
  }
7654
7492
  /**
@@ -7723,7 +7561,7 @@ var TRIMMED_PATTERN = "^\\S[\\s\\S]*\\S$|^\\S$|^$";
7723
7561
  *
7724
7562
  * Arbitrary:
7725
7563
  *
7726
- * When generating test data with fast-check, this applies a `patterns`
7564
+ * During arbitrary generation, this applies a `patterns`
7727
7565
  * constraint to ensure generated strings match the trimmed pattern.
7728
7566
  *
7729
7567
  * @category validation
@@ -7739,7 +7577,10 @@ function isTrimmed(annotations) {
7739
7577
  },
7740
7578
  toJsonSchema: () => ({ pattern: regExp.source }),
7741
7579
  toCode: () => ({ runtime: "Schema.isTrimmed()" }),
7742
- arbitrary: { constraint: { patterns: [TRIMMED_PATTERN] } },
7580
+ arbitraryConstraint: { patterns: [{
7581
+ source: TRIMMED_PATTERN,
7582
+ flags: ""
7583
+ }] },
7743
7584
  ...annotations
7744
7585
  });
7745
7586
  }
@@ -7750,11 +7591,13 @@ function isTrimmed(annotations) {
7750
7591
  *
7751
7592
  * JSON Schema:
7752
7593
  *
7753
- * This check corresponds to the `pattern` constraint in JSON Schema.
7594
+ * JSON Schema receives the RegExp source as a `pattern`. JavaScript flags are
7595
+ * not represented, so validation can differ when the RegExp uses flags or
7596
+ * relies on JavaScript's non-Unicode behavior.
7754
7597
  *
7755
7598
  * Arbitrary:
7756
7599
  *
7757
- * When generating test data with fast-check, this applies a `patterns`
7600
+ * During arbitrary generation, this applies a `patterns`
7758
7601
  * constraint to ensure generated strings match the specified RegExp pattern.
7759
7602
  *
7760
7603
  * @category validation
@@ -7781,7 +7624,7 @@ function isPattern(regExp, annotations) {
7781
7624
  *
7782
7625
  * Arbitrary:
7783
7626
  *
7784
- * When generating test data with fast-check, this applies a `patterns`
7627
+ * During arbitrary generation, this applies a `patterns`
7785
7628
  * constraint to ensure generated strings match the number string pattern.
7786
7629
  *
7787
7630
  * @category validation
@@ -7812,8 +7655,7 @@ var Finite = /*#__PURE__*/ make(finite);
7812
7655
  *
7813
7656
  * Arbitrary:
7814
7657
  *
7815
- * When generating test data with fast-check, this applies `noNaN: true` and
7816
- * `noInfinity: true` constraints to ensure generated numbers are finite.
7658
+ * During arbitrary generation, this applies a finite-number constraint.
7817
7659
  *
7818
7660
  * @category validation
7819
7661
  * @since 4.0.0
@@ -7832,10 +7674,10 @@ function makeIsGreaterThanOrEqualTo(options) {
7832
7674
  return (minimum, annotations) => {
7833
7675
  return makeFilter((input) => gte(input, minimum), {
7834
7676
  expected: `a value greater than or equal to ${formatter(minimum)}`,
7835
- arbitrary: { constraint: { ordered: {
7677
+ arbitraryConstraint: {
7836
7678
  order: options.order,
7837
7679
  minimum
7838
- } } },
7680
+ },
7839
7681
  ...options.annotate?.(minimum),
7840
7682
  ...annotations
7841
7683
  });
@@ -7854,15 +7696,45 @@ function makeIsLessThanOrEqualTo(options) {
7854
7696
  return (maximum, annotations) => {
7855
7697
  return makeFilter((input) => lte(input, maximum), {
7856
7698
  expected: `a value less than or equal to ${formatter(maximum)}`,
7857
- arbitrary: { constraint: { ordered: {
7699
+ arbitraryConstraint: {
7858
7700
  order: options.order,
7859
7701
  maximum
7860
- } } },
7702
+ },
7861
7703
  ...options.annotate?.(maximum),
7862
7704
  ...annotations
7863
7705
  });
7864
7706
  };
7865
7707
  }
7708
+ /**
7709
+ * Creates an inclusive or exclusive range check for any ordered type from an
7710
+ * `Order.Order` instance.
7711
+ *
7712
+ * @category validation
7713
+ * @since 4.0.0
7714
+ */
7715
+ function makeIsBetween(deriveOptions) {
7716
+ const greaterThanOrEqualTo = isGreaterThanOrEqualTo$1(deriveOptions.order);
7717
+ const greaterThan = isGreaterThan$1(deriveOptions.order);
7718
+ const lessThanOrEqualTo = isLessThanOrEqualTo$3(deriveOptions.order);
7719
+ const lessThan = isLessThan$1(deriveOptions.order);
7720
+ const formatter = deriveOptions.formatter ?? format$1;
7721
+ return (options, annotations) => {
7722
+ const gte = options.exclusiveMinimum ? greaterThan : greaterThanOrEqualTo;
7723
+ const lte = options.exclusiveMaximum ? lessThan : lessThanOrEqualTo;
7724
+ return makeFilter((input) => gte(input, options.minimum) && lte(input, options.maximum), {
7725
+ expected: `a value between ${formatter(options.minimum)}${options.exclusiveMinimum ? " (excluded)" : ""} and ${formatter(options.maximum)}${options.exclusiveMaximum ? " (excluded)" : ""}`,
7726
+ arbitraryConstraint: {
7727
+ order: deriveOptions.order,
7728
+ minimum: options.minimum,
7729
+ maximum: options.maximum,
7730
+ ...options.exclusiveMinimum && { exclusiveMinimum: true },
7731
+ ...options.exclusiveMaximum && { exclusiveMaximum: true }
7732
+ },
7733
+ ...deriveOptions.annotate?.(options),
7734
+ ...annotations
7735
+ });
7736
+ };
7737
+ }
7866
7738
  function encodeNumberPayload(number) {
7867
7739
  if (!globalThis.Number.isFinite(number)) throw new globalThis.RangeError(`Expected a finite number, got ${format$1(number)}`);
7868
7740
  return number;
@@ -7879,7 +7751,7 @@ function encodeNumberPayload(number) {
7879
7751
  *
7880
7752
  * Arbitrary:
7881
7753
  *
7882
- * When generating test data with fast-check, this applies a `minimum` constraint
7754
+ * During arbitrary generation, this applies a `minimum` constraint
7883
7755
  * to ensure generated numbers are greater than or equal to the specified value.
7884
7756
  *
7885
7757
  * @category validation
@@ -7908,7 +7780,7 @@ var isGreaterThanOrEqualTo = /*#__PURE__*/ makeIsGreaterThanOrEqualTo({
7908
7780
  *
7909
7781
  * Arbitrary:
7910
7782
  *
7911
- * When generating test data with fast-check, this applies a `maximum` constraint
7783
+ * During arbitrary generation, this applies a `maximum` constraint
7912
7784
  * to ensure generated numbers are less than or equal to the specified value.
7913
7785
  *
7914
7786
  * @category validation
@@ -7926,6 +7798,50 @@ var isLessThanOrEqualTo = /*#__PURE__*/ makeIsLessThanOrEqualTo({
7926
7798
  })
7927
7799
  });
7928
7800
  /**
7801
+ * Validates that a number is within a specified range. The range boundaries can
7802
+ * be inclusive or exclusive based on the provided options.
7803
+ *
7804
+ * **Details**
7805
+ *
7806
+ * JSON Schema:
7807
+ *
7808
+ * This check corresponds to `minimum`/`maximum` or `exclusiveMinimum`/`exclusiveMaximum`
7809
+ * constraints in JSON Schema, depending on the options provided.
7810
+ *
7811
+ * Arbitrary:
7812
+ *
7813
+ * During arbitrary generation, this applies `minimum` and
7814
+ * `maximum` constraints with optional `exclusiveMinimum` and
7815
+ * `exclusiveMaximum` flags to ensure generated numbers fall within the
7816
+ * specified range.
7817
+ *
7818
+ * @category validation
7819
+ * @since 4.0.0
7820
+ */
7821
+ var isBetween = /*#__PURE__*/ makeIsBetween({
7822
+ order: Number$4,
7823
+ annotate: (options) => {
7824
+ const exclusiveMinimum = options.exclusiveMinimum ? true : void 0;
7825
+ const exclusiveMaximum = options.exclusiveMaximum ? true : void 0;
7826
+ return {
7827
+ representation: {
7828
+ id: "effect/schema/isBetween",
7829
+ payload: {
7830
+ minimum: encodeNumberPayload(options.minimum),
7831
+ maximum: encodeNumberPayload(options.maximum),
7832
+ ...exclusiveMinimum && { exclusiveMinimum },
7833
+ ...exclusiveMaximum && { exclusiveMaximum }
7834
+ }
7835
+ },
7836
+ toJsonSchema: () => ({
7837
+ [exclusiveMinimum ? "exclusiveMinimum" : "minimum"]: options.minimum,
7838
+ [exclusiveMaximum ? "exclusiveMaximum" : "maximum"]: options.maximum
7839
+ }),
7840
+ toCode: () => ({ runtime: `Schema.isBetween({ minimum: ${format$1(options.minimum)}, maximum: ${format$1(options.maximum)}, exclusiveMinimum: ${format$1(exclusiveMinimum)}, exclusiveMaximum: ${format$1(exclusiveMaximum)} })` })
7841
+ };
7842
+ }
7843
+ });
7844
+ /**
7929
7845
  * Validates that a number is a safe integer (within the safe integer range
7930
7846
  * that can be exactly represented in JavaScript).
7931
7847
  *
@@ -7937,8 +7853,7 @@ var isLessThanOrEqualTo = /*#__PURE__*/ makeIsLessThanOrEqualTo({
7937
7853
  *
7938
7854
  * Arbitrary:
7939
7855
  *
7940
- * When generating test data with fast-check, this applies an `integer: true`
7941
- * constraint to ensure generated numbers are integers.
7856
+ * During arbitrary generation, this applies an integer constraint.
7942
7857
  *
7943
7858
  * @category validation
7944
7859
  * @since 4.0.0
@@ -7952,11 +7867,18 @@ function isInt(annotations) {
7952
7867
  },
7953
7868
  toJsonSchema: () => ({ type: "integer" }),
7954
7869
  toCode: () => ({ runtime: "Schema.isInt()" }),
7955
- arbitrary: { constraint: { integer: true } },
7870
+ arbitraryConstraint: { number: "integer" },
7956
7871
  ...annotations
7957
7872
  });
7958
7873
  }
7959
7874
  /**
7875
+ * Schema for integers, rejecting `NaN`, `Infinity`, and `-Infinity`.
7876
+ *
7877
+ * @category schemas
7878
+ * @since 3.10.0
7879
+ */
7880
+ var Int = /*#__PURE__*/ Number$1.check(/*#__PURE__*/ isInt());
7881
+ /**
7960
7882
  * Schema for non-negative safe integers, including zero.
7961
7883
  *
7962
7884
  * **When to use**
@@ -7968,7 +7890,7 @@ function isInt(annotations) {
7968
7890
  * @category schemas
7969
7891
  * @since 4.0.0
7970
7892
  */
7971
- var Natural = /*#__PURE__*/ (/* @__PURE__ */ Number$1.check(/*#__PURE__*/ isInt())).check(/*#__PURE__*/ isGreaterThanOrEqualTo(0));
7893
+ var Natural = /*#__PURE__*/ Int.check(/*#__PURE__*/ isGreaterThanOrEqualTo(0));
7972
7894
  /**
7973
7895
  * Validates that a value has at least the specified length. Works with strings
7974
7896
  * and arrays.
@@ -7977,12 +7899,13 @@ var Natural = /*#__PURE__*/ (/* @__PURE__ */ Number$1.check(/*#__PURE__*/ isInt(
7977
7899
  *
7978
7900
  * JSON Schema:
7979
7901
  *
7980
- * This check corresponds to the `minLength` constraint for strings or the
7981
- * `minItems` constraint for arrays in JSON Schema.
7902
+ * For arrays, this check corresponds to `minItems`. For strings, it corresponds
7903
+ * to `minLength`. JavaScript counts UTF-16 code units while JSON Schema counts
7904
+ * Unicode code points, so the two validations can differ for some strings.
7982
7905
  *
7983
7906
  * Arbitrary:
7984
7907
  *
7985
- * When generating test data with fast-check, this applies a `minLength`
7908
+ * During arbitrary generation, this applies a `minLength`
7986
7909
  * constraint to ensure generated strings or arrays have at least the required
7987
7910
  * length.
7988
7911
  *
@@ -8011,7 +7934,7 @@ function isMinLength(minLength, annotations) {
8011
7934
  toJsonSchema: ({ type }) => type === "array" ? { minItems: minLength } : { minLength },
8012
7935
  toCode: () => ({ runtime: `Schema.isMinLength(${minLength})` }),
8013
7936
  [STRUCTURAL_ANNOTATION_KEY]: true,
8014
- arbitrary: { constraint: { minLength } },
7937
+ arbitraryConstraint: { minLength },
8015
7938
  ...annotations
8016
7939
  });
8017
7940
  }
@@ -8028,7 +7951,7 @@ function isMinLength(minLength, annotations) {
8028
7951
  *
8029
7952
  * Arbitrary:
8030
7953
  *
8031
- * When generating test data with fast-check, this applies a `minLength: 1`
7954
+ * During arbitrary generation, this applies a `minLength: 1`
8032
7955
  * constraint to ensure generated strings or arrays are non-empty.
8033
7956
  *
8034
7957
  * @category validation
@@ -8050,7 +7973,7 @@ function isNonEmpty(annotations) {
8050
7973
  *
8051
7974
  * Arbitrary:
8052
7975
  *
8053
- * When generating test data with fast-check, this applies a `maxLength`
7976
+ * During arbitrary generation, this applies a `maxLength`
8054
7977
  * constraint to ensure generated strings or arrays have at most the required
8055
7978
  * length.
8056
7979
  *
@@ -8068,7 +7991,7 @@ function isMaxLength(maxLength, annotations) {
8068
7991
  toJsonSchema: ({ type }) => type === "array" ? { maxItems: maxLength } : { maxLength },
8069
7992
  toCode: () => ({ runtime: `Schema.isMaxLength(${maxLength})` }),
8070
7993
  [STRUCTURAL_ANNOTATION_KEY]: true,
8071
- arbitrary: { constraint: { maxLength } },
7994
+ arbitraryConstraint: { maxLength },
8072
7995
  ...annotations
8073
7996
  });
8074
7997
  }
@@ -8142,35 +8065,6 @@ function Defect(options) {
8142
8065
  defectSchemaCache[key] = schema;
8143
8066
  return schema;
8144
8067
  }
8145
- function withRecursion(fc, ctx, terminal, arbitrary) {
8146
- return {
8147
- arbitrary: terminal === void 0 || ctx.recursion === void 0 ? arbitrary : fc.oneof(ctx.recursion, terminal, arbitrary),
8148
- terminal
8149
- };
8150
- }
8151
- function arrayFromItems(fc, item, constraints, comparator) {
8152
- return comparator === void 0 ? fc.array(item, constraints) : fc.uniqueArray(item, {
8153
- ...constraints,
8154
- comparator
8155
- });
8156
- }
8157
- function collectionArbitrary(fc, ctx, item, terminalItem, fromIterable, comparator) {
8158
- const constraint = ctx.constraint;
8159
- const constraints = constraint === void 0 || constraint.minLength === void 0 && constraint.maxLength === void 0 ? void 0 : {
8160
- ...constraint.minLength !== void 0 ? { minLength: constraint.minLength } : {},
8161
- ...constraint.maxLength !== void 0 ? { maxLength: constraint.maxLength } : {}
8162
- };
8163
- if (constraints?.minLength !== void 0 && constraints.maxLength !== void 0 && constraints.minLength > constraints.maxLength) throw new globalThis.Error("Unable to derive an arbitrary for size constraints");
8164
- const minLength = constraints?.minLength ?? 0;
8165
- const arrays = withRecursion(fc, ctx, minLength === 0 ? fc.constant([]) : terminalItem === void 0 ? void 0 : arrayFromItems(fc, terminalItem, {
8166
- ...constraints,
8167
- maxLength: minLength
8168
- }, comparator), arrayFromItems(fc, item, constraints, comparator));
8169
- return {
8170
- arbitrary: arrays.arbitrary.map(fromIterable),
8171
- terminal: arrays.terminal?.map(fromIterable)
8172
- };
8173
- }
8174
8068
  /**
8175
8069
  * Schema for readonly sets whose values conform to the provided element schema.
8176
8070
  *
@@ -8198,34 +8092,13 @@ function ReadonlySet(value) {
8198
8092
  }),
8199
8093
  expected: "ReadonlySet",
8200
8094
  toCodec: ([value]) => link()(ArraySchema(value), transform({
8201
- decode: (e) => new globalThis.Set(e),
8095
+ decode: (values) => new globalThis.Set(values),
8202
8096
  encode: (set) => [...set.values()]
8203
- })),
8204
- toArbitrary: ([value]) => (fc, ctx) => collectionArbitrary(fc, ctx, value.arbitrary, value.terminal, (as) => new globalThis.Set(as), equals$1),
8205
- toEquivalence: ([value]) => makeCompareSet(value),
8206
- toFormatter: ([value]) => (t) => {
8207
- const size = t.size;
8208
- if (size === 0) return "ReadonlySet(0) {}";
8209
- return `ReadonlySet(${size}) { ${globalThis.Array.from(t.values()).sort().map((v) => `${value(v)}`).join(", ")} }`;
8210
- }
8097
+ }))
8211
8098
  }).ast, { value });
8212
8099
  }
8213
8100
  globalThis.RegExp;
8214
8101
  globalThis.URL;
8215
- function dateArbitraryConstraints(ordered, base, toDate) {
8216
- const out = { ...base };
8217
- if (ordered?.minimum !== void 0) {
8218
- const minimum = toDate === void 0 ? ordered.minimum : toDate(ordered.minimum);
8219
- const nextMin = ordered.exclusiveMinimum ? new globalThis.Date(minimum.getTime() + 1) : minimum;
8220
- if (out.min === void 0 || nextMin.getTime() > out.min.getTime()) out.min = nextMin;
8221
- }
8222
- if (ordered?.maximum !== void 0) {
8223
- const maximum = toDate === void 0 ? ordered.maximum : toDate(ordered.maximum);
8224
- const nextMax = ordered.exclusiveMaximum ? new globalThis.Date(maximum.getTime() - 1) : maximum;
8225
- if (out.max === void 0 || nextMax.getTime() < out.max.getTime()) out.max = nextMax;
8226
- }
8227
- return out;
8228
- }
8229
8102
  var JsonString = /*#__PURE__*/ String$1.annotate({
8230
8103
  expected: "a string that will be decoded as JSON",
8231
8104
  contentMediaType: "application/json"
@@ -8333,6 +8206,28 @@ var Trimmed = /*#__PURE__*/ String$1.check(/*#__PURE__*/ isTrimmed());
8333
8206
  */
8334
8207
  var Trim = /*#__PURE__*/ String$1.annotate({ expected: "a string that will be decoded as a trimmed string" }).pipe(/*#__PURE__*/ decodeTo(Trimmed, /*#__PURE__*/ trim()));
8335
8208
  globalThis.Uint8Array;
8209
+ var dateTimeUtcFromString = /*#__PURE__*/ transformEffect({
8210
+ decode: (s, options) => {
8211
+ return match$1(make$5(s), {
8212
+ onNone: () => fail$2(new InvalidValue({ expected: "a valid UTC DateTime string" }, s, options)),
8213
+ onSome: (result) => succeed$3(toUtc(result))
8214
+ });
8215
+ },
8216
+ encode: (utc) => succeed$3(formatIso(utc))
8217
+ });
8218
+ var arbitraryMinimumDateTimestamp = -864e13;
8219
+ var arbitraryMaximumDateTimestamp = 864e13;
8220
+ function dateTimeArbitraryBounds(constraint, domainMinimum, domainMaximum) {
8221
+ const minimum = Math.max(domainMinimum, constraint?.minimum === void 0 ? domainMinimum : constraint.minimum.epochMilliseconds + (constraint.exclusiveMinimum === true ? 1 : 0));
8222
+ const maximum = Math.min(domainMaximum, constraint?.maximum === void 0 ? domainMaximum : constraint.maximum.epochMilliseconds - (constraint.exclusiveMaximum === true ? 1 : 0));
8223
+ return minimum <= maximum ? [minimum, maximum] : [domainMinimum, domainMaximum];
8224
+ }
8225
+ function dateTimeArbitraryInteger(minimum, maximum) {
8226
+ return Int.check(isBetween({
8227
+ minimum,
8228
+ maximum
8229
+ }));
8230
+ }
8336
8231
  /**
8337
8232
  * Schema for `DateTime.Utc` values.
8338
8233
  *
@@ -8365,10 +8260,12 @@ var DateTimeUtc = /*#__PURE__*/ declare((u) => isDateTime(u) && isUtc(u), {
8365
8260
  importDeclarations: [`import * as DateTime from "effect/DateTime"`]
8366
8261
  }),
8367
8262
  expected: "DateTime.Utc",
8263
+ toCodecArbitrary: ({ constraint }) => {
8264
+ const [minimum, maximum] = dateTimeArbitraryBounds(constraint, arbitraryMinimumDateTimestamp, arbitraryMaximumDateTimestamp);
8265
+ return linkDecoding()(dateTimeArbitraryInteger(minimum, maximum), transform$1(makeUnsafe));
8266
+ },
8368
8267
  toCodecJson: () => link()(String$1, dateTimeUtcFromString),
8369
- toArbitrary: () => (fc, ctx) => fc.date(dateArbitraryConstraints(ctx?.constraint?.ordered?.order === Order ? ctx.constraint.ordered : void 0, { noInvalidDate: true }, toDateUtc)).map((date) => fromDateUnsafe(date)),
8370
- toFormatter: () => (utc) => utc.toString(),
8371
- toEquivalence: () => Equivalence
8268
+ toFormatter: () => (utc) => utc.toString()
8372
8269
  });
8373
8270
  /**
8374
8271
  * Schema that decodes a date-time string into a `DateTime.Utc`.
@@ -8427,7 +8324,7 @@ function makeClass(Inherited, identifier, struct$1, annotations, proto) {
8427
8324
  return getClassSchema(this).rebuild(ast);
8428
8325
  }
8429
8326
  static make(input, options) {
8430
- return new this(input, options);
8327
+ return make$3(getClassSchema(this))(input ?? {}, options);
8431
8328
  }
8432
8329
  static makeOption(input, options) {
8433
8330
  return makeOption(getClassSchema(this))(input ?? {}, options);
@@ -8487,10 +8384,7 @@ function getClassSchemaFactory(from, identifier, annotations) {
8487
8384
  link: new Link(from, transformation)
8488
8385
  }),
8489
8386
  toCodec: ([from]) => new Link(from.ast, transformation),
8490
- toArbitrary: ([from]) => () => ({
8491
- arbitrary: from.arbitrary.map((args) => new self(args)),
8492
- terminal: from.terminal?.map((args) => new self(args))
8493
- }),
8387
+ toEquivalence: ([from]) => from,
8494
8388
  toFormatter: ([from]) => (t) => `${self.identifier}(${from(t)})`,
8495
8389
  [SENTINELS_ANNOTATION_KEY]: collectSentinels(from.ast),
8496
8390
  ...annotations
@@ -8591,76 +8485,7 @@ var TaggedError = (identifier) => {
8591
8485
  * @category converting
8592
8486
  * @since 4.0.0
8593
8487
  */
8594
- function toCodecJson(schema) {
8595
- return make(toCodecJsonAST(schema.ast), { schema });
8596
- }
8597
- /** @internal */
8598
- var toCodecJsonAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
8599
- const out = toCodecJsonASTStep(ast, toCodecJsonAST);
8600
- const context = ast.context;
8601
- if (out === ast || context === void 0) return out;
8602
- return replaceContextLastLink(out, withoutConstructorDefault(context));
8603
- });
8604
- function withoutConstructorDefault(context) {
8605
- return context.constructorDefault === void 0 ? context : new Context(context.isOptional, context.isMutable, void 0, context.annotations);
8606
- }
8607
- function validateCanonicalObjectPropertyNames(ast) {
8608
- if (ast.propertySignatures.some((ps) => typeof ps.name !== "string")) throw new globalThis.Error("Objects property names must be strings", { cause: ast });
8609
- }
8610
- function makeReorder(getPriority) {
8611
- return (types) => {
8612
- const indexMap = /* @__PURE__ */ new Map();
8613
- for (let i = 0; i < types.length; i++) indexMap.set(toEncoded(types[i]), i);
8614
- const sortedTypes = [...types].sort((a, b) => {
8615
- a = toEncoded(a);
8616
- b = toEncoded(b);
8617
- const pa = getPriority(a);
8618
- const pb = getPriority(b);
8619
- if (pa !== pb) return pa - pb;
8620
- return indexMap.get(a) - indexMap.get(b);
8621
- });
8622
- if (!sortedTypes.some((ast, index) => ast !== types[index])) return types;
8623
- return sortedTypes;
8624
- };
8625
- }
8626
- var toCodecJsonReorder = /*#__PURE__*/ makeReorder((ast) => {
8627
- switch (ast._tag) {
8628
- case "BigInt":
8629
- case "Symbol":
8630
- case "UniqueSymbol": return 0;
8631
- default: return 1;
8632
- }
8633
- });
8634
- function toCodecJsonASTStep(ast, recur) {
8635
- switch (ast._tag) {
8636
- case "Declaration": {
8637
- const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
8638
- if (!isFunction(getLink)) return replaceEncoding(ast, [unknownToJson]);
8639
- const link = getLink(ast.typeParameters.map((tp) => make$1(toEncoded(tp))));
8640
- return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, recur)]);
8641
- }
8642
- case "Unknown": return replaceEncoding(ast, [unknownToJson]);
8643
- case "ObjectKeyword": return replaceEncoding(ast, [objectKeywordToJson]);
8644
- case "Undefined":
8645
- case "Void":
8646
- case "Literal":
8647
- case "Number": return ast.toCodecJson();
8648
- case "UniqueSymbol":
8649
- case "Symbol":
8650
- case "BigInt": return ast.toCodecStringTree();
8651
- case "Objects":
8652
- validateCanonicalObjectPropertyNames(ast);
8653
- return ast.recur(recur, parameterFromString);
8654
- case "Union": {
8655
- const sortedTypes = toCodecJsonReorder(ast.types);
8656
- if (sortedTypes !== ast.types) return new Union$1(sortedTypes, ast.mode, ast.annotations, ast.checks, ast.encoding, ast.context, ast.encodingChecks).recur(recur);
8657
- return ast.recur(recur);
8658
- }
8659
- case "Arrays":
8660
- case "Suspend": return ast.recur(recur);
8661
- }
8662
- return ast;
8663
- }
8488
+ var toCodecJson = toCodecJson$1;
8664
8489
  /**
8665
8490
  * Schema that accepts and validates any immutable JSON-compatible value.
8666
8491
  *
@@ -8680,4 +8505,4 @@ var Json = /*#__PURE__*/ make(/*#__PURE__*/ annotate(Json$1, { toCode: () => ({
8680
8505
  Type: "Schema.Json"
8681
8506
  }) }));
8682
8507
  //#endregion
8683
- export { isInt as $, UndefinedOr as A, nowUnsafe as At, decodeSync as B, filter as Bt, String$1 as C, MissingKey as Ct, TemplateLiteral as D, formatLocal as Dt, TaggedError as E, formatIso as Et, declare as F, zoneMakeLocal as Ft, decodeUnknownSync as G, decodeUnknownEffect as H, map as Ht, decode as I, capitalize as It, fromJsonString as J, encodeEffect as K, decodeEffect as L, startsWith as Lt, Unknown as M, subtract as Mt, brand as N, toEpochMillis as Nt, Trim as O, isLessThanOrEqualTo$1 as Ot, catchDecoding as P, toParts as Pt, isGreaterThanOrEqualTo as Q, decodeOption as R, toLowerCase$2 as Rt, SchemaError as S, transformOrFail$1 as St, StructWithRest as T, distance as Tt, decodeUnknownOption as U, toEntries as Ut, decodeTo as V, makeEquivalence as Vt, decodeUnknownResult as W, union$1 as Wt, is as X, instanceOf as Y, isFinite as Z, Null as _, transformOptional as _t, DateTimeUtc as a, link as at, ReadonlySet as b, forbidden as bt, Error$1 as c, optionalKey as ct, Json as d, toCodecJson as dt, isLessThanOrEqualTo as et, Literal as f, toType as ft, NonEmptyString as g, transform as gt, NonEmptyArray as h, toLowerCase as ht, Boolean as i, isStringFinite as it, Union as j, setZone as jt, Tuple as k, now as kt, Finite as l, suspend as lt, Natural as m, decodeUnknownEffect$1 as mt, BigInt$1 as n, isMinLength as nt, DateTimeUtcFromString as o, makeFilter as ot, Literals as p, withConstructorDefault as pt, extendTo as q, BigIntFromString as r, isPattern as rt, Defect as s, optional as st, ArraySchema as t, isMaxLength as tt, FiniteFromString as u, tag as ut, NullOr as v, decodeUriComponent as vt, Struct as w, makeFormatterStandardSchemaV1 as wt, Record as x, transform$1 as xt, Number$1 as y, encodeUriComponent as yt, decodeResult as z, empty as zt };
8508
+ export { isInt as $, UndefinedOr as A, formatLocal as At, decodeSync as B, capitalize as Bt, String$1 as C, forbidden as Ct, TemplateLiteral as D, makeFormatterStandardSchemaV1 as Dt, TaggedError as E, MissingKey as Et, declare as F, setZone as Ft, decodeUnknownSync as G, makeEquivalence as Gt, decodeUnknownEffect as H, toLowerCase$2 as Ht, decode as I, subtract as It, fromJsonString as J, encodeEffect as K, toEntries as Kt, decodeEffect as L, toEpochMillis as Lt, Unknown as M, isLessThanOrEqualTo$1 as Mt, brand as N, now as Nt, Trim as O, distance as Ot, catchDecoding as P, nowUnsafe as Pt, isGreaterThanOrEqualTo as Q, decodeOption as R, toParts as Rt, SchemaError as S, encodeUriComponent as St, StructWithRest as T, transformEffect$1 as Tt, decodeUnknownOption as U, empty$1 as Ut, decodeTo as V, startsWith as Vt, decodeUnknownResult as W, filter as Wt, is as X, instanceOf as Y, isFinite as Z, Null as _, decodeUnknownEffect$1 as _t, DateTimeUtc as a, makeFilter as at, ReadonlySet as b, transformOptional as bt, Error$1 as c, suspend as ct, Json as d, toType as dt, isLessThanOrEqualTo as et, Literal as f, withConstructorDefault as ft, NonEmptyString as g, fromSetCookie as gt, Never as h, setAll as ht, Boolean as i, isStringFinite as it, Union as j, formatUtc as jt, Tuple as k, formatIso as kt, Finite as l, tag as lt, Natural as m, fromInput as mt, BigInt$1 as n, isMinLength as nt, DateTimeUtcFromString as o, optional as ot, Literals as p, empty as pt, extendTo as q, union$1 as qt, BigIntFromString as r, isPattern as rt, Defect as s, optionalKey as st, ArraySchema as t, isMaxLength as tt, FiniteFromString as u, toCodecJson as ut, NullOr as v, toLowerCase as vt, Struct as w, transform$1 as wt, Record as x, decodeUriComponent as xt, Number$1 as y, transform as yt, decodeResult as z, zoneMakeLocal as zt };