@lmvz-ds/components 0.18.2 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +45 -100
  3. package/assets/icons/checkmark.svg +4 -0
  4. package/cjs/{aria-loader-CfFuAbJn.js → aria-loader-Cec1zR2g.js} +1 -1
  5. package/cjs/ds.constants-DSnxZ3ia.js +16 -0
  6. package/cjs/icons-BQASWgk-.js +80 -0
  7. package/cjs/{index--7IqZZqn.js → index-3g9Z9sfF.js} +765 -2854
  8. package/cjs/index.cjs.js +12 -12
  9. package/cjs/lmvz-button.cjs.entry.js +4 -4
  10. package/cjs/lmvz-card.cjs.entry.js +1 -1
  11. package/cjs/lmvz-checkbox.cjs.entry.js +113 -0
  12. package/cjs/lmvz-chip.cjs.entry.js +68 -4
  13. package/cjs/lmvz-components.cjs.js +1 -1
  14. package/cjs/lmvz-header_2.cjs.entry.js +3 -3
  15. package/cjs/lmvz-icon.cjs.entry.js +10 -8
  16. package/cjs/lmvz-input.cjs.entry.js +4 -4
  17. package/cjs/lmvz-menuitem.cjs.entry.js +4 -4
  18. package/cjs/lmvz-select.cjs.entry.js +3 -3
  19. package/cjs/loader.cjs.js +1 -1
  20. package/cjs/{logger-Bn2yoZGP.js → logger-DsM6xg6V.js} +3063 -833
  21. package/cjs/{reactive-controller-host-CtaVAiYJ.js → reactive-controller-host-BA4ZhjKA.js} +10 -10
  22. package/cjs/svg-BMBduILB.js +125 -0
  23. package/collection/api/ds.constants.js +2 -0
  24. package/collection/assets/icons/checkmark.svg +4 -0
  25. package/collection/collection-manifest.json +1 -0
  26. package/collection/components/lmvz-button/lmvz-button.css +1 -2
  27. package/collection/components/lmvz-button/lmvz-button.js +6 -3
  28. package/collection/components/lmvz-card/lmvz-card.css +1 -2
  29. package/collection/components/lmvz-checkbox/lmvz-checkbox.css +207 -0
  30. package/collection/components/lmvz-checkbox/lmvz-checkbox.js +424 -0
  31. package/collection/components/lmvz-chip/lmvz-chip.css +84 -1
  32. package/collection/components/lmvz-chip/lmvz-chip.js +110 -13
  33. package/collection/components/lmvz-header/lmvz-header.js +2 -2
  34. package/collection/components/lmvz-icon/lmvz-icon.css +11 -10
  35. package/collection/components/lmvz-icon/lmvz-icon.js +8 -7
  36. package/collection/components/lmvz-input/lmvz-input.js +4 -4
  37. package/collection/components/lmvz-menuitem/lmvz-menuitem.css +1 -1
  38. package/collection/components/lmvz-menuitem/lmvz-menuitem.js +11 -5
  39. package/collection/components/lmvz-select/lmvz-select.js +1 -1
  40. package/collection/index.js +1 -1
  41. package/collection/integration/header-integration/header-integration.js +1 -1
  42. package/collection/utils/aria/aria-validation-controller.js +1 -0
  43. package/collection/utils/icons/icons.js +2 -13
  44. package/collection/utils/icons/icons.unit.js +3 -15
  45. package/collection/utils/reactive-controller-host.js +9 -9
  46. package/components/index.d.ts +2 -0
  47. package/components/index.d.ts.bak +2 -0
  48. package/components/index.js +1 -1
  49. package/components/lmvz-button.js +1 -1
  50. package/components/lmvz-card.js +1 -1
  51. package/components/lmvz-checkbox.d.ts +11 -0
  52. package/components/lmvz-checkbox.d.ts.bak +11 -0
  53. package/components/lmvz-checkbox.js +1 -0
  54. package/components/lmvz-chip.js +1 -1
  55. package/components/lmvz-header.js +1 -1
  56. package/components/lmvz-icon.js +1 -1
  57. package/components/lmvz-input.js +1 -1
  58. package/components/lmvz-menuitem.js +1 -1
  59. package/components/lmvz-select.js +1 -1
  60. package/components/p-0s99QfRy.js +12 -0
  61. package/components/{p-CBLAeife.js → p-BuFx0tTm.js} +1 -1
  62. package/components/p-CGmJG63p.js +1 -0
  63. package/components/p-CcxjkCOx.js +1 -0
  64. package/components/{p-DQEkWkMh.js → p-DIrAQ4IB.js} +1 -1
  65. package/esm/{aria-loader-BF_AYtbb.js → aria-loader-BVolm0lC.js} +1 -1
  66. package/esm/ds.constants-Bmi89ll1.js +9 -0
  67. package/esm/icons-CmuFKDRz.js +75 -0
  68. package/esm/{index-7Ru1khgk.js → index-Dh_9sN0q.js} +389 -2478
  69. package/esm/index.js +5 -11
  70. package/esm/lmvz-button.entry.js +4 -4
  71. package/esm/lmvz-card.entry.js +1 -1
  72. package/esm/lmvz-checkbox.entry.js +111 -0
  73. package/esm/lmvz-chip.entry.js +69 -5
  74. package/esm/lmvz-components.js +1 -1
  75. package/esm/lmvz-header_2.entry.js +3 -3
  76. package/esm/lmvz-icon.entry.js +10 -8
  77. package/esm/lmvz-input.entry.js +4 -4
  78. package/esm/lmvz-menuitem.entry.js +4 -4
  79. package/esm/lmvz-select.entry.js +3 -3
  80. package/esm/loader.js +1 -1
  81. package/esm/{logger-fiRXhuXK.js → logger-CGmJG63p.js} +2870 -765
  82. package/esm/{reactive-controller-host-sR2jJxNG.js → reactive-controller-host-DHcPpJW7.js} +10 -10
  83. package/esm/svg-B2YoIRuh.js +121 -0
  84. package/hydrate/index.js +2383 -42
  85. package/hydrate/index.mjs +2383 -42
  86. package/lmvz-components/index.esm.js +1 -1
  87. package/lmvz-components/lmvz-components.esm.js +1 -1
  88. package/lmvz-components/{p-5aa17cd2.entry.js → p-0f7a4236.entry.js} +1 -1
  89. package/lmvz-components/p-0s99QfRy.js +12 -0
  90. package/lmvz-components/{p-30b99f11.entry.js → p-2f83d7a2.entry.js} +1 -1
  91. package/lmvz-components/{p-6dbb3f13.entry.js → p-32171f4f.entry.js} +1 -1
  92. package/lmvz-components/{p-59383f3a.entry.js → p-400b2318.entry.js} +1 -1
  93. package/lmvz-components/p-851969bd.entry.js +1 -0
  94. package/lmvz-components/p-9f9d845d.entry.js +1 -0
  95. package/lmvz-components/p-Bmi89ll1.js +1 -0
  96. package/lmvz-components/p-CFsC37ww.js +1 -0
  97. package/lmvz-components/p-CGmJG63p.js +1 -0
  98. package/lmvz-components/p-CcxjkCOx.js +1 -0
  99. package/lmvz-components/{p-Bkfdgg0T.js → p-GdMr6Qlp.js} +1 -1
  100. package/lmvz-components/p-a12f95da.entry.js +1 -0
  101. package/lmvz-components/{p-84267405.entry.js → p-ab4437dc.entry.js} +1 -1
  102. package/lmvz-components/{p-7a6bec13.entry.js → p-d0a0e206.entry.js} +1 -1
  103. package/lmvz-components/{p-B3dnXEPG.js → p-dhVSUYqd.js} +1 -1
  104. package/manifest.json +544 -28
  105. package/package.json +5 -1
  106. package/types/api/ds.constants.d.ts +6 -1
  107. package/types/components/lmvz-action/lmvz-action.d.ts +0 -1
  108. package/types/components/lmvz-button/lmvz-button.d.ts +0 -1
  109. package/types/components/lmvz-card/lmvz-card.d.ts +0 -1
  110. package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +39 -0
  111. package/types/components/lmvz-chip/lmvz-chip.d.ts +18 -3
  112. package/types/components/lmvz-header/lmvz-header.d.ts +0 -1
  113. package/types/components/lmvz-icon/lmvz-icon.d.ts +0 -1
  114. package/types/components/lmvz-input/lmvz-input.d.ts +0 -1
  115. package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +0 -1
  116. package/types/components/lmvz-select/lmvz-select.d.ts +0 -1
  117. package/types/components.d.ts +221 -12
  118. package/types/index.d.ts +1 -2
  119. package/types/utils/aria/aria-validation-controller.d.ts +1 -2
  120. package/types/utils/aria/element-activation-controller.d.ts +0 -1
  121. package/types/utils/aria/list-keyboard-controller.d.ts +0 -1
  122. package/types/utils/assets.d.ts +0 -1
  123. package/types/utils/component.d.ts +0 -1
  124. package/types/utils/environment.d.ts +0 -1
  125. package/types/utils/http.d.ts +0 -1
  126. package/types/utils/http.unit.d.ts +0 -1
  127. package/types/utils/icons/icons-registry.d.ts +0 -1
  128. package/types/utils/icons/icons.d.ts +0 -2
  129. package/types/utils/icons/icons.unit.d.ts +0 -1
  130. package/types/utils/icons/public.d.ts +0 -1
  131. package/types/utils/public.d.ts +0 -1
  132. package/types/utils/reactive-controller-host.d.ts +0 -1
  133. package/cjs/icons-swqMn6s2.js +0 -163
  134. package/components/p-DXOTa5VF.js +0 -12
  135. package/components/p-fiRXhuXK.js +0 -1
  136. package/esm/icons-Ca8oMiRa.js +0 -157
  137. package/lmvz-components/p-0a41cc24.entry.js +0 -1
  138. package/lmvz-components/p-5f150890.entry.js +0 -1
  139. package/lmvz-components/p-Bh2Epkwf.js +0 -1
  140. package/lmvz-components/p-DXOTa5VF.js +0 -12
  141. package/lmvz-components/p-fiRXhuXK.js +0 -1
@@ -273,19 +273,19 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
273
273
  * @category constructors
274
274
  * @since 2.0.0
275
275
  */
276
- const make$8 = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
276
+ const make$b = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
277
277
  /**
278
278
  * @category mapping
279
279
  * @since 2.0.0
280
280
  */
281
- const mapInput = /*#__PURE__*/dual(2, (self, f) => make$8((x, y) => self(f(x), f(y))));
281
+ const mapInput = /*#__PURE__*/dual(2, (self, f) => make$b((x, y) => self(f(x), f(y))));
282
282
  /**
283
283
  * Creates a new `Equivalence` for an array of values based on a given `Equivalence` for the elements of the array.
284
284
  *
285
285
  * @category combinators
286
286
  * @since 2.0.0
287
287
  */
288
- const array$1 = item => make$8((self, that) => {
288
+ const array$1 = item => make$b((self, that) => {
289
289
  if (self.length !== that.length) {
290
290
  return false;
291
291
  }
@@ -598,7 +598,7 @@ const getBugErrorMessage = message => `BUG: ${message} - please report an issue
598
598
  * @category constructors
599
599
  * @since 2.0.0
600
600
  */
601
- class SingleShotGen {
601
+ let SingleShotGen$1 = class SingleShotGen {
602
602
  self;
603
603
  called = false;
604
604
  constructor(self) {
@@ -637,7 +637,7 @@ class SingleShotGen {
637
637
  [Symbol.iterator]() {
638
638
  return new SingleShotGen(this.self);
639
639
  }
640
- }
640
+ };
641
641
  const defaultIncHi = 0x14057b7e;
642
642
  const defaultIncLo = 0xf767814f;
643
643
  const MUL_HI = 0x5851f42d >>> 0;
@@ -899,7 +899,7 @@ const random = self => {
899
899
  * @since 2.0.0
900
900
  * @category hashing
901
901
  */
902
- const combine$1 = b => self => self * 53 ^ b;
902
+ const combine$5 = b => self => self * 53 ^ b;
903
903
  /**
904
904
  * @since 2.0.0
905
905
  * @category hashing
@@ -946,7 +946,7 @@ const string = str => {
946
946
  const structureKeys = (o, keys) => {
947
947
  let h = 12289;
948
948
  for (let i = 0; i < keys.length; i++) {
949
- h ^= pipe(string(keys[i]), combine$1(hash(o[keys[i]])));
949
+ h ^= pipe(string(keys[i]), combine$5(hash(o[keys[i]])));
950
950
  }
951
951
  return optimize(h);
952
952
  };
@@ -962,7 +962,7 @@ const structure = o => structureKeys(o, Object.keys(o));
962
962
  const array = arr => {
963
963
  let h = 6151;
964
964
  for (let i = 0; i < arr.length; i++) {
965
- h = pipe(h, combine$1(hash(arr[i])));
965
+ h = pipe(h, combine$5(hash(arr[i])));
966
966
  }
967
967
  return optimize(h);
968
968
  };
@@ -1223,7 +1223,7 @@ let moduleVersion = "3.21.1";
1223
1223
  const getCurrentVersion = () => moduleVersion;
1224
1224
 
1225
1225
  /** @internal */
1226
- const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
1226
+ const EffectTypeId$1 = /*#__PURE__*/Symbol.for("effect/Effect");
1227
1227
  /** @internal */
1228
1228
  const StreamTypeId = /*#__PURE__*/Symbol.for("effect/Stream");
1229
1229
  /** @internal */
@@ -1270,7 +1270,7 @@ const channelVariance = {
1270
1270
  };
1271
1271
  /** @internal */
1272
1272
  const EffectPrototype$1 = {
1273
- [EffectTypeId]: effectVariance,
1273
+ [EffectTypeId$1]: effectVariance,
1274
1274
  [StreamTypeId]: effectVariance,
1275
1275
  [SinkTypeId]: sinkVariance,
1276
1276
  [ChannelTypeId]: channelVariance,
@@ -1281,7 +1281,7 @@ const EffectPrototype$1 = {
1281
1281
  return cached(this, random(this));
1282
1282
  },
1283
1283
  [Symbol.iterator]() {
1284
- return new SingleShotGen(new YieldWrap(this));
1284
+ return new SingleShotGen$1(new YieldWrap(this));
1285
1285
  },
1286
1286
  pipe() {
1287
1287
  return pipeArguments(this, arguments);
@@ -1326,10 +1326,10 @@ const Base$1 = /*#__PURE__*/function () {
1326
1326
  /**
1327
1327
  * @since 2.0.0
1328
1328
  */
1329
- const TypeId$5 = /*#__PURE__*/Symbol.for("effect/Option");
1329
+ const TypeId$6 = /*#__PURE__*/Symbol.for("effect/Option");
1330
1330
  const CommonProto$1 = {
1331
1331
  ...EffectPrototype$1,
1332
- [TypeId$5]: {
1332
+ [TypeId$6]: {
1333
1333
  _A: _ => _
1334
1334
  },
1335
1335
  [NodeInspectSymbol]() {
@@ -1346,7 +1346,7 @@ const SomeProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonPr
1346
1346
  return isOption(that) && isSome$1(that) && equals(this.value, that.value);
1347
1347
  },
1348
1348
  [symbol$1]() {
1349
- return cached(this, combine$1(hash(this._tag))(hash(this.value)));
1349
+ return cached(this, combine$5(hash(this._tag))(hash(this.value)));
1350
1350
  },
1351
1351
  toJSON() {
1352
1352
  return {
@@ -1374,13 +1374,13 @@ const NoneProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonPr
1374
1374
  }
1375
1375
  });
1376
1376
  /** @internal */
1377
- const isOption = input => hasProperty(input, TypeId$5);
1377
+ const isOption = input => hasProperty(input, TypeId$6);
1378
1378
  /** @internal */
1379
1379
  const isNone$1 = fa => fa._tag === "None";
1380
1380
  /** @internal */
1381
1381
  const isSome$1 = fa => fa._tag === "Some";
1382
1382
  /** @internal */
1383
- const none$2 = /*#__PURE__*/Object.create(NoneProto);
1383
+ const none$4 = /*#__PURE__*/Object.create(NoneProto);
1384
1384
  /** @internal */
1385
1385
  const some$1 = value => {
1386
1386
  const a = Object.create(SomeProto);
@@ -1394,10 +1394,10 @@ const some$1 = value => {
1394
1394
  /**
1395
1395
  * @internal
1396
1396
  */
1397
- const TypeId$4 = /*#__PURE__*/Symbol.for("effect/Either");
1397
+ const TypeId$5 = /*#__PURE__*/Symbol.for("effect/Either");
1398
1398
  const CommonProto = {
1399
1399
  ...EffectPrototype$1,
1400
- [TypeId$4]: {
1400
+ [TypeId$5]: {
1401
1401
  _R: _ => _
1402
1402
  },
1403
1403
  [NodeInspectSymbol]() {
@@ -1414,7 +1414,7 @@ const RightProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonP
1414
1414
  return isEither(that) && isRight$1(that) && equals(this.right, that.right);
1415
1415
  },
1416
1416
  [symbol$1]() {
1417
- return combine$1(hash(this._tag))(hash(this.right));
1417
+ return combine$5(hash(this._tag))(hash(this.right));
1418
1418
  },
1419
1419
  toJSON() {
1420
1420
  return {
@@ -1431,7 +1431,7 @@ const LeftProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonPr
1431
1431
  return isEither(that) && isLeft$1(that) && equals(this.left, that.left);
1432
1432
  },
1433
1433
  [symbol$1]() {
1434
- return combine$1(hash(this._tag))(hash(this.left));
1434
+ return combine$5(hash(this._tag))(hash(this.left));
1435
1435
  },
1436
1436
  toJSON() {
1437
1437
  return {
@@ -1442,7 +1442,7 @@ const LeftProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonPr
1442
1442
  }
1443
1443
  });
1444
1444
  /** @internal */
1445
- const isEither = input => hasProperty(input, TypeId$4);
1445
+ const isEither = input => hasProperty(input, TypeId$5);
1446
1446
  /** @internal */
1447
1447
  const isLeft$1 = ma => ma._tag === "Left";
1448
1448
  /** @internal */
@@ -1460,7 +1460,7 @@ const right$1 = right => {
1460
1460
  return a;
1461
1461
  };
1462
1462
  /** @internal */
1463
- const getRight$1 = self => isLeft$1(self) ? none$2 : some$1(self.right);
1463
+ const getRight$1 = self => isLeft$1(self) ? none$4 : some$1(self.right);
1464
1464
 
1465
1465
  /**
1466
1466
  * @since 2.0.0
@@ -1608,7 +1608,7 @@ const isNonEmptyArray$1 = self => self.length > 0;
1608
1608
  * @category Constructors
1609
1609
  * @since 2.0.0
1610
1610
  */
1611
- const none$1 = () => none$2;
1611
+ const none$3 = () => none$4;
1612
1612
  /**
1613
1613
  * Wraps the given value into an `Option` to represent its presence.
1614
1614
  *
@@ -1836,7 +1836,7 @@ const orElseSome = /*#__PURE__*/dual(2, (self, onNone) => isNone(self) ? some(on
1836
1836
  * @category Conversions
1837
1837
  * @since 2.0.0
1838
1838
  */
1839
- const fromNullable = nullableValue => nullableValue == null ? none$1() : some(nullableValue);
1839
+ const fromNullable = nullableValue => nullableValue == null ? none$3() : some(nullableValue);
1840
1840
  /**
1841
1841
  * Returns the value contained in the `Option` if it is `Some`; otherwise,
1842
1842
  * returns `undefined`.
@@ -1899,7 +1899,7 @@ const getOrUndefined = /*#__PURE__*/getOrElse(constUndefined);
1899
1899
  * @category Mapping
1900
1900
  * @since 2.0.0
1901
1901
  */
1902
- const map$4 = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none$1() : some(f(self.value)));
1902
+ const map$6 = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none$3() : some(f(self.value)));
1903
1903
  /**
1904
1904
  * Applies a function to the value of a `Some` and flattens the resulting
1905
1905
  * `Option`. If the input is `None`, it remains `None`.
@@ -1953,7 +1953,7 @@ const map$4 = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none$1() : some(f
1953
1953
  * @category Sequencing
1954
1954
  * @since 2.0.0
1955
1955
  */
1956
- const flatMap$3 = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none$1() : f(self.value));
1956
+ const flatMap$4 = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none$3() : f(self.value));
1957
1957
  /**
1958
1958
  * Returns a function that checks if an `Option` contains a specified value,
1959
1959
  * using a provided equivalence function.
@@ -1988,7 +1988,7 @@ const flatMap$3 = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none$1() : f(
1988
1988
  * @since 2.0.0
1989
1989
  */
1990
1990
  const containsWith = isEquivalent => dual(2, (self, a) => isNone(self) ? false : isEquivalent(self.value, a));
1991
- const _equivalence$2 = /*#__PURE__*/equivalence();
1991
+ const _equivalence$3 = /*#__PURE__*/equivalence();
1992
1992
  /**
1993
1993
  * Returns a function that checks if an `Option` contains a specified value
1994
1994
  * using the default `Equivalence`.
@@ -2020,7 +2020,7 @@ const _equivalence$2 = /*#__PURE__*/equivalence();
2020
2020
  * @category Elements
2021
2021
  * @since 2.0.0
2022
2022
  */
2023
- const contains = /*#__PURE__*/containsWith(_equivalence$2);
2023
+ const contains = /*#__PURE__*/containsWith(_equivalence$3);
2024
2024
  /**
2025
2025
  * Merges two optional values, applying a function if both exist.
2026
2026
  * Unlike {@link zipWith}, this function returns `None` only if both inputs are `None`.
@@ -2055,7 +2055,7 @@ const mergeWith = f => (o1, o2) => {
2055
2055
  * @category constructors
2056
2056
  * @since 2.0.0
2057
2057
  */
2058
- const make$7 = (...elements) => elements;
2058
+ const make$a = (...elements) => elements;
2059
2059
 
2060
2060
  /**
2061
2061
  * This module provides utility functions for working with arrays in TypeScript.
@@ -2120,7 +2120,7 @@ const makeBy = /*#__PURE__*/dual(2, (n, f) => {
2120
2120
  * @category constructors
2121
2121
  * @since 2.0.0
2122
2122
  */
2123
- const fromIterable$4 = collection => Array.isArray(collection) ? collection : Array.from(collection);
2123
+ const fromIterable$5 = collection => Array.isArray(collection) ? collection : Array.from(collection);
2124
2124
  /**
2125
2125
  * Creates a new `Array` from a value that might not be an iterable.
2126
2126
  *
@@ -2153,7 +2153,7 @@ const ensure = self => Array.isArray(self) ? self : [self];
2153
2153
  * @category concatenating
2154
2154
  * @since 2.0.0
2155
2155
  */
2156
- const prepend$1 = /*#__PURE__*/dual(2, (self, head) => [head, ...self]);
2156
+ const prepend$2 = /*#__PURE__*/dual(2, (self, head) => [head, ...self]);
2157
2157
  /**
2158
2158
  * Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`.
2159
2159
  *
@@ -2177,7 +2177,7 @@ const append$1 = /*#__PURE__*/dual(2, (self, last) => [...self, last]);
2177
2177
  * @category concatenating
2178
2178
  * @since 2.0.0
2179
2179
  */
2180
- const appendAll$1 = /*#__PURE__*/dual(2, (self, that) => fromIterable$4(self).concat(fromIterable$4(that)));
2180
+ const appendAll$2 = /*#__PURE__*/dual(2, (self, that) => fromIterable$5(self).concat(fromIterable$5(that)));
2181
2181
  /**
2182
2182
  * Determine if an `Array` is empty narrowing down the type to `[]`.
2183
2183
  *
@@ -2254,9 +2254,9 @@ const clamp = (i, as) => Math.floor(Math.min(Math.max(0, i), as.length));
2254
2254
  * @category getters
2255
2255
  * @since 2.0.0
2256
2256
  */
2257
- const get$5 = /*#__PURE__*/dual(2, (self, index) => {
2257
+ const get$6 = /*#__PURE__*/dual(2, (self, index) => {
2258
2258
  const i = Math.floor(index);
2259
- return isOutOfBounds(i, self) ? none$1() : some(self[i]);
2259
+ return isOutOfBounds(i, self) ? none$3() : some(self[i]);
2260
2260
  });
2261
2261
  /**
2262
2262
  * Gets an element unsafely, will throw on out of bounds.
@@ -2277,7 +2277,7 @@ const unsafeGet$3 = /*#__PURE__*/dual(2, (self, index) => {
2277
2277
  * @category getters
2278
2278
  * @since 2.0.0
2279
2279
  */
2280
- const head$1 = /*#__PURE__*/get$5(0);
2280
+ const head$1 = /*#__PURE__*/get$6(0);
2281
2281
  /**
2282
2282
  * Get the first element of a non empty array.
2283
2283
  *
@@ -2300,7 +2300,7 @@ const headNonEmpty$1 = /*#__PURE__*/unsafeGet$3(0);
2300
2300
  * @category getters
2301
2301
  * @since 2.0.0
2302
2302
  */
2303
- const last = self => isNonEmptyReadonlyArray(self) ? some(lastNonEmpty(self)) : none$1();
2303
+ const last = self => isNonEmptyReadonlyArray(self) ? some(lastNonEmpty(self)) : none$3();
2304
2304
  /**
2305
2305
  * Get the last element of a non empty array.
2306
2306
  *
@@ -2371,7 +2371,7 @@ const span = /*#__PURE__*/dual(2, (self, predicate) => splitAt$1(self, spanIndex
2371
2371
  * @since 2.0.0
2372
2372
  */
2373
2373
  const drop$1 = /*#__PURE__*/dual(2, (self, n) => {
2374
- const input = fromIterable$4(self);
2374
+ const input = fromIterable$5(self);
2375
2375
  return input.slice(clamp(n, input), input.length);
2376
2376
  });
2377
2377
  /**
@@ -2389,7 +2389,7 @@ const drop$1 = /*#__PURE__*/dual(2, (self, n) => {
2389
2389
  * @category elements
2390
2390
  * @since 2.0.0
2391
2391
  */
2392
- const reverse$1 = self => Array.from(self).reverse();
2392
+ const reverse$2 = self => Array.from(self).reverse();
2393
2393
  /**
2394
2394
  * Create a new array with elements sorted in increasing order based on the specified comparator.
2395
2395
  * If the input is a `NonEmptyReadonlyArray`, the output will also be a `NonEmptyReadonlyArray`.
@@ -2419,7 +2419,7 @@ const sort = /*#__PURE__*/dual(2, (self, O) => {
2419
2419
  * @category zipping
2420
2420
  * @since 2.0.0
2421
2421
  */
2422
- const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, make$7));
2422
+ const zip$1 = /*#__PURE__*/dual(2, (self, that) => zipWith$1(self, that, make$a));
2423
2423
  /**
2424
2424
  * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2425
2425
  * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
@@ -2436,9 +2436,9 @@ const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, make$7));
2436
2436
  * @category zipping
2437
2437
  * @since 2.0.0
2438
2438
  */
2439
- const zipWith = /*#__PURE__*/dual(3, (self, that, f) => {
2440
- const as = fromIterable$4(self);
2441
- const bs = fromIterable$4(that);
2439
+ const zipWith$1 = /*#__PURE__*/dual(3, (self, that, f) => {
2440
+ const as = fromIterable$5(self);
2441
+ const bs = fromIterable$5(that);
2442
2442
  if (isNonEmptyReadonlyArray(as) && isNonEmptyReadonlyArray(bs)) {
2443
2443
  const out = [f(headNonEmpty$1(as), headNonEmpty$1(bs))];
2444
2444
  const len = Math.min(as.length, bs.length);
@@ -2449,7 +2449,7 @@ const zipWith = /*#__PURE__*/dual(3, (self, that, f) => {
2449
2449
  }
2450
2450
  return [];
2451
2451
  });
2452
- const _equivalence$1 = /*#__PURE__*/equivalence();
2452
+ const _equivalence$2 = /*#__PURE__*/equivalence();
2453
2453
  /**
2454
2454
  * Splits an `Iterable` into two segments, with the first segment containing a maximum of `n` elements.
2455
2455
  * The value of `n` can be `0`.
@@ -2495,7 +2495,7 @@ const splitAt$1 = /*#__PURE__*/dual(2, (self, n) => {
2495
2495
  */
2496
2496
  const splitNonEmptyAt = /*#__PURE__*/dual(2, (self, n) => {
2497
2497
  const _n = Math.max(1, Math.floor(n));
2498
- return _n >= self.length ? [copy$1(self), []] : [prepend$1(self.slice(1, _n), headNonEmpty$1(self)), self.slice(_n)];
2498
+ return _n >= self.length ? [copy$1(self), []] : [prepend$2(self.slice(1, _n), headNonEmpty$1(self)), self.slice(_n)];
2499
2499
  });
2500
2500
  /**
2501
2501
  * Copies an array.
@@ -2527,12 +2527,12 @@ const copy$1 = self => self.slice();
2527
2527
  * @since 2.0.0
2528
2528
  */
2529
2529
  const unionWith = /*#__PURE__*/dual(3, (self, that, isEquivalent) => {
2530
- const a = fromIterable$4(self);
2531
- const b = fromIterable$4(that);
2530
+ const a = fromIterable$5(self);
2531
+ const b = fromIterable$5(that);
2532
2532
  if (isNonEmptyReadonlyArray(a)) {
2533
2533
  if (isNonEmptyReadonlyArray(b)) {
2534
2534
  const dedupe = dedupeWith(isEquivalent);
2535
- return dedupe(appendAll$1(a, b));
2535
+ return dedupe(appendAll$2(a, b));
2536
2536
  }
2537
2537
  return a;
2538
2538
  }
@@ -2552,31 +2552,31 @@ const unionWith = /*#__PURE__*/dual(3, (self, that, isEquivalent) => {
2552
2552
  *
2553
2553
  * @since 2.0.0
2554
2554
  */
2555
- const union$2 = /*#__PURE__*/dual(2, (self, that) => unionWith(self, that, _equivalence$1));
2555
+ const union$2 = /*#__PURE__*/dual(2, (self, that) => unionWith(self, that, _equivalence$2));
2556
2556
  /**
2557
2557
  * @category constructors
2558
2558
  * @since 2.0.0
2559
2559
  */
2560
- const empty$7 = () => [];
2560
+ const empty$d = () => [];
2561
2561
  /**
2562
2562
  * Constructs a new `NonEmptyArray<A>` from the specified value.
2563
2563
  *
2564
2564
  * @category constructors
2565
2565
  * @since 2.0.0
2566
2566
  */
2567
- const of$1 = a => [a];
2567
+ const of$2 = a => [a];
2568
2568
  /**
2569
2569
  * @category mapping
2570
2570
  * @since 2.0.0
2571
2571
  */
2572
- const map$3 = /*#__PURE__*/dual(2, (self, f) => self.map(f));
2572
+ const map$5 = /*#__PURE__*/dual(2, (self, f) => self.map(f));
2573
2573
  /**
2574
2574
  * Applies a function to each element in an array and returns a new array containing the concatenated mapped elements.
2575
2575
  *
2576
2576
  * @category sequencing
2577
2577
  * @since 2.0.0
2578
2578
  */
2579
- const flatMap$2 = /*#__PURE__*/dual(2, (self, f) => {
2579
+ const flatMap$3 = /*#__PURE__*/dual(2, (self, f) => {
2580
2580
  if (isEmptyReadonlyArray(self)) {
2581
2581
  return [];
2582
2582
  }
@@ -2606,7 +2606,7 @@ const flatMap$2 = /*#__PURE__*/dual(2, (self, f) => {
2606
2606
  * @category sequencing
2607
2607
  * @since 2.0.0
2608
2608
  */
2609
- const flatten = /*#__PURE__*/flatMap$2(identity);
2609
+ const flatten$1 = /*#__PURE__*/flatMap$3(identity);
2610
2610
  /**
2611
2611
  * Applies a function to each element of the `Iterable` and filters based on the result, keeping the transformed values where the function returns `Some`.
2612
2612
  * This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
@@ -2626,7 +2626,7 @@ const flatten = /*#__PURE__*/flatMap$2(identity);
2626
2626
  * @since 2.0.0
2627
2627
  */
2628
2628
  const filterMap$1 = /*#__PURE__*/dual(2, (self, f) => {
2629
- const as = fromIterable$4(self);
2629
+ const as = fromIterable$5(self);
2630
2630
  const out = [];
2631
2631
  for (let i = 0; i < as.length; i++) {
2632
2632
  const o = f(as[i], i);
@@ -2641,7 +2641,7 @@ const filterMap$1 = /*#__PURE__*/dual(2, (self, f) => {
2641
2641
  * @since 2.0.0
2642
2642
  */
2643
2643
  const filter$1 = /*#__PURE__*/dual(2, (self, predicate) => {
2644
- const as = fromIterable$4(self);
2644
+ const as = fromIterable$5(self);
2645
2645
  const out = [];
2646
2646
  for (let i = 0; i < as.length; i++) {
2647
2647
  if (predicate(as[i], i)) {
@@ -2665,7 +2665,7 @@ const filter$1 = /*#__PURE__*/dual(2, (self, predicate) => {
2665
2665
  * @category folding
2666
2666
  * @since 2.0.0
2667
2667
  */
2668
- const reduce$5 = /*#__PURE__*/dual(3, (self, b, f) => fromIterable$4(self).reduce((b, a, i) => f(b, a, i), b));
2668
+ const reduce$7 = /*#__PURE__*/dual(3, (self, b, f) => fromIterable$5(self).reduce((b, a, i) => f(b, a, i), b));
2669
2669
  /**
2670
2670
  * @category constructors
2671
2671
  * @since 2.0.0
@@ -2696,7 +2696,7 @@ const unfold = (b, f) => {
2696
2696
  * @category instances
2697
2697
  * @since 2.0.0
2698
2698
  */
2699
- const getEquivalence$1 = array$1;
2699
+ const getEquivalence$2 = array$1;
2700
2700
  /**
2701
2701
  * Remove duplicates from an `Iterable` using the provided `isEquivalent` function,
2702
2702
  * preserving the order of the first occurrence of each element.
@@ -2713,7 +2713,7 @@ const getEquivalence$1 = array$1;
2713
2713
  * @since 2.0.0
2714
2714
  */
2715
2715
  const dedupeWith = /*#__PURE__*/dual(2, (self, isEquivalent) => {
2716
- const input = fromIterable$4(self);
2716
+ const input = fromIterable$5(self);
2717
2717
  if (isNonEmptyReadonlyArray(input)) {
2718
2718
  const out = [headNonEmpty$1(input)];
2719
2719
  const rest = tailNonEmpty$1(input);
@@ -2749,7 +2749,7 @@ const dedupe = self => dedupeWith(self, equivalence());
2749
2749
  * @since 2.0.0
2750
2750
  * @category folding
2751
2751
  */
2752
- const join = /*#__PURE__*/dual(2, (self, sep) => fromIterable$4(self).join(sep));
2752
+ const join = /*#__PURE__*/dual(2, (self, sep) => fromIterable$5(self).join(sep));
2753
2753
 
2754
2754
  /** @internal */
2755
2755
  const TagTypeId = /*#__PURE__*/Symbol.for("effect/Context/Tag");
@@ -2785,7 +2785,7 @@ const TagProto = {
2785
2785
  return self;
2786
2786
  },
2787
2787
  context(self) {
2788
- return make$6(this, self);
2788
+ return make$9(this, self);
2789
2789
  }
2790
2790
  };
2791
2791
  const ReferenceProto = {
@@ -2825,10 +2825,10 @@ const Reference$1 = () => (id, options) => {
2825
2825
  return ReferenceClass;
2826
2826
  };
2827
2827
  /** @internal */
2828
- const TypeId$3 = /*#__PURE__*/Symbol.for("effect/Context");
2828
+ const TypeId$4 = /*#__PURE__*/Symbol.for("effect/Context");
2829
2829
  /** @internal */
2830
2830
  const ContextProto = {
2831
- [TypeId$3]: {
2831
+ [TypeId$4]: {
2832
2832
  _Services: _ => _
2833
2833
  },
2834
2834
  [symbol](that) {
@@ -2888,14 +2888,14 @@ const serviceNotFoundError = tag => {
2888
2888
  return error;
2889
2889
  };
2890
2890
  /** @internal */
2891
- const isContext$1 = u => hasProperty(u, TypeId$3);
2891
+ const isContext$1 = u => hasProperty(u, TypeId$4);
2892
2892
  /** @internal */
2893
2893
  const isReference = u => hasProperty(u, ReferenceTypeId);
2894
- const _empty$3 = /*#__PURE__*/makeContext(/*#__PURE__*/new Map());
2894
+ const _empty$6 = /*#__PURE__*/makeContext(/*#__PURE__*/new Map());
2895
2895
  /** @internal */
2896
- const empty$6 = () => _empty$3;
2896
+ const empty$c = () => _empty$6;
2897
2897
  /** @internal */
2898
- const make$6 = (tag, service) => makeContext(new Map([[tag.key, service]]));
2898
+ const make$9 = (tag, service) => makeContext(new Map([[tag.key, service]]));
2899
2899
  /** @internal */
2900
2900
  const add$3 = /*#__PURE__*/dual(3, (self, tag, service) => {
2901
2901
  const map = new Map(self.unsafeMap);
@@ -2924,11 +2924,11 @@ const unsafeGet$2 = /*#__PURE__*/dual(2, (self, tag) => {
2924
2924
  return self.unsafeMap.get(tag.key);
2925
2925
  });
2926
2926
  /** @internal */
2927
- const get$4 = unsafeGet$2;
2927
+ const get$5 = unsafeGet$2;
2928
2928
  /** @internal */
2929
2929
  const getOption$1 = /*#__PURE__*/dual(2, (self, tag) => {
2930
2930
  if (!self.unsafeMap.has(tag.key)) {
2931
- return isReference(tag) ? some$1(getDefaultValue(tag)) : none$2;
2931
+ return isReference(tag) ? some$1(getDefaultValue(tag)) : none$4;
2932
2932
  }
2933
2933
  return some$1(self.unsafeMap.get(tag.key));
2934
2934
  });
@@ -2995,7 +2995,7 @@ const isContext = isContext$1;
2995
2995
  * @since 2.0.0
2996
2996
  * @category constructors
2997
2997
  */
2998
- const empty$5 = empty$6;
2998
+ const empty$b = empty$c;
2999
2999
  /**
3000
3000
  * Creates a new `Context` with a single service associated to the tag.
3001
3001
  *
@@ -3014,7 +3014,7 @@ const empty$5 = empty$6;
3014
3014
  * @since 2.0.0
3015
3015
  * @category constructors
3016
3016
  */
3017
- const make$5 = make$6;
3017
+ const make$8 = make$9;
3018
3018
  /**
3019
3019
  * Adds a service to a given `Context`.
3020
3020
  *
@@ -3062,7 +3062,7 @@ const add$2 = add$3;
3062
3062
  * @since 2.0.0
3063
3063
  * @category getters
3064
3064
  */
3065
- const get$3 = get$4;
3065
+ const get$4 = get$5;
3066
3066
  /**
3067
3067
  * Get a service from the context that corresponds to the given tag.
3068
3068
  * This function is unsafe because if the tag is not present in the context, a runtime error will be thrown.
@@ -3219,7 +3219,7 @@ const Reference = Reference$1;
3219
3219
  /**
3220
3220
  * @since 2.0.0
3221
3221
  */
3222
- const TypeId$2 = /*#__PURE__*/Symbol.for("effect/Chunk");
3222
+ const TypeId$3 = /*#__PURE__*/Symbol.for("effect/Chunk");
3223
3223
  function copy(src, srcPos, dest, destPos, len) {
3224
3224
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
3225
3225
  dest[destPos + i - srcPos] = src[i];
@@ -3233,10 +3233,10 @@ const emptyArray = [];
3233
3233
  * @category equivalence
3234
3234
  * @since 2.0.0
3235
3235
  */
3236
- const getEquivalence = isEquivalent => make$8((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3237
- const _equivalence = /*#__PURE__*/getEquivalence(equals);
3236
+ const getEquivalence$1 = isEquivalent => make$b((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3237
+ const _equivalence$1 = /*#__PURE__*/getEquivalence$1(equals);
3238
3238
  const ChunkProto = {
3239
- [TypeId$2]: {
3239
+ [TypeId$3]: {
3240
3240
  _A: _ => _
3241
3241
  },
3242
3242
  toString() {
@@ -3252,7 +3252,7 @@ const ChunkProto = {
3252
3252
  return this.toJSON();
3253
3253
  },
3254
3254
  [symbol](that) {
3255
- return isChunk(that) && _equivalence(this, that);
3255
+ return isChunk(that) && _equivalence$1(this, that);
3256
3256
  },
3257
3257
  [symbol$1]() {
3258
3258
  return cached(this, array(toReadonlyArray(this)));
@@ -3301,24 +3301,24 @@ const makeChunk = backing => {
3301
3301
  {
3302
3302
  chunk.length = backing.array.length;
3303
3303
  chunk.depth = 0;
3304
- chunk.left = _empty$2;
3305
- chunk.right = _empty$2;
3304
+ chunk.left = _empty$5;
3305
+ chunk.right = _empty$5;
3306
3306
  break;
3307
3307
  }
3308
3308
  case "ISingleton":
3309
3309
  {
3310
3310
  chunk.length = 1;
3311
3311
  chunk.depth = 0;
3312
- chunk.left = _empty$2;
3313
- chunk.right = _empty$2;
3312
+ chunk.left = _empty$5;
3313
+ chunk.right = _empty$5;
3314
3314
  break;
3315
3315
  }
3316
3316
  case "ISlice":
3317
3317
  {
3318
3318
  chunk.length = backing.length;
3319
3319
  chunk.depth = backing.chunk.depth + 1;
3320
- chunk.left = _empty$2;
3321
- chunk.right = _empty$2;
3320
+ chunk.left = _empty$5;
3321
+ chunk.right = _empty$5;
3322
3322
  break;
3323
3323
  }
3324
3324
  }
@@ -3330,29 +3330,29 @@ const makeChunk = backing => {
3330
3330
  * @category constructors
3331
3331
  * @since 2.0.0
3332
3332
  */
3333
- const isChunk = u => hasProperty(u, TypeId$2);
3334
- const _empty$2 = /*#__PURE__*/makeChunk({
3333
+ const isChunk = u => hasProperty(u, TypeId$3);
3334
+ const _empty$5 = /*#__PURE__*/makeChunk({
3335
3335
  _tag: "IEmpty"
3336
3336
  });
3337
3337
  /**
3338
3338
  * @category constructors
3339
3339
  * @since 2.0.0
3340
3340
  */
3341
- const empty$4 = () => _empty$2;
3341
+ const empty$a = () => _empty$5;
3342
3342
  /**
3343
3343
  * Builds a `NonEmptyChunk` from an non-empty collection of elements.
3344
3344
  *
3345
3345
  * @category constructors
3346
3346
  * @since 2.0.0
3347
3347
  */
3348
- const make$4 = (...as) => unsafeFromNonEmptyArray(as);
3348
+ const make$7 = (...as) => unsafeFromNonEmptyArray(as);
3349
3349
  /**
3350
3350
  * Builds a `NonEmptyChunk` from a single element.
3351
3351
  *
3352
3352
  * @category constructors
3353
3353
  * @since 2.0.0
3354
3354
  */
3355
- const of = a => makeChunk({
3355
+ const of$1 = a => makeChunk({
3356
3356
  _tag: "ISingleton",
3357
3357
  a
3358
3358
  });
@@ -3362,7 +3362,7 @@ const of = a => makeChunk({
3362
3362
  * @category constructors
3363
3363
  * @since 2.0.0
3364
3364
  */
3365
- const fromIterable$3 = self => isChunk(self) ? self : unsafeFromArray(fromIterable$4(self));
3365
+ const fromIterable$4 = self => isChunk(self) ? self : unsafeFromArray(fromIterable$5(self));
3366
3366
  const copyToArray = (self, array, initial) => {
3367
3367
  switch (self.backing._tag) {
3368
3368
  case "IArray":
@@ -3412,8 +3412,8 @@ const toReadonlyArray_ = self => {
3412
3412
  _tag: "IArray",
3413
3413
  array: arr
3414
3414
  };
3415
- self.left = _empty$2;
3416
- self.right = _empty$2;
3415
+ self.left = _empty$5;
3416
+ self.right = _empty$5;
3417
3417
  self.depth = 0;
3418
3418
  return arr;
3419
3419
  }
@@ -3437,19 +3437,19 @@ const reverseChunk = self => {
3437
3437
  {
3438
3438
  return makeChunk({
3439
3439
  _tag: "IArray",
3440
- array: reverse$1(self.backing.array)
3440
+ array: reverse$2(self.backing.array)
3441
3441
  });
3442
3442
  }
3443
3443
  case "IConcat":
3444
3444
  {
3445
3445
  return makeChunk({
3446
3446
  _tag: "IConcat",
3447
- left: reverse(self.backing.right),
3448
- right: reverse(self.backing.left)
3447
+ left: reverse$1(self.backing.right),
3448
+ right: reverse$1(self.backing.left)
3449
3449
  });
3450
3450
  }
3451
3451
  case "ISlice":
3452
- return unsafeFromArray(reverse$1(toReadonlyArray(self)));
3452
+ return unsafeFromArray(reverse$2(toReadonlyArray(self)));
3453
3453
  }
3454
3454
  };
3455
3455
  /**
@@ -3471,21 +3471,21 @@ const reverseChunk = self => {
3471
3471
  * @since 2.0.0
3472
3472
  * @category elements
3473
3473
  */
3474
- const reverse = reverseChunk;
3474
+ const reverse$1 = reverseChunk;
3475
3475
  /**
3476
3476
  * This function provides a safe way to read a value at a particular index from a `Chunk`.
3477
3477
  *
3478
3478
  * @category elements
3479
3479
  * @since 2.0.0
3480
3480
  */
3481
- const get$2 = /*#__PURE__*/dual(2, (self, index) => index < 0 || index >= self.length ? none$1() : some(unsafeGet(self, index)));
3481
+ const get$3 = /*#__PURE__*/dual(2, (self, index) => index < 0 || index >= self.length ? none$3() : some(unsafeGet(self, index)));
3482
3482
  /**
3483
3483
  * Wraps an array into a chunk without copying, unsafe on mutable arrays
3484
3484
  *
3485
3485
  * @since 2.0.0
3486
3486
  * @category unsafe
3487
3487
  */
3488
- const unsafeFromArray = self => self.length === 0 ? empty$4() : self.length === 1 ? of(self[0]) : makeChunk({
3488
+ const unsafeFromArray = self => self.length === 0 ? empty$a() : self.length === 1 ? of$1(self[0]) : makeChunk({
3489
3489
  _tag: "IArray",
3490
3490
  array: self
3491
3491
  });
@@ -3538,14 +3538,14 @@ const unsafeGet = /*#__PURE__*/dual(2, (self, index) => {
3538
3538
  * @category concatenating
3539
3539
  * @since 2.0.0
3540
3540
  */
3541
- const append = /*#__PURE__*/dual(2, (self, a) => appendAll(self, of(a)));
3541
+ const append = /*#__PURE__*/dual(2, (self, a) => appendAll$1(self, of$1(a)));
3542
3542
  /**
3543
3543
  * Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`.
3544
3544
  *
3545
3545
  * @category concatenating
3546
3546
  * @since 2.0.0
3547
3547
  */
3548
- const prepend = /*#__PURE__*/dual(2, (self, elem) => appendAll(of(elem), self));
3548
+ const prepend$1 = /*#__PURE__*/dual(2, (self, elem) => appendAll$1(of$1(elem), self));
3549
3549
  /**
3550
3550
  * Takes the first up to `n` elements from the chunk
3551
3551
  *
@@ -3553,7 +3553,7 @@ const prepend = /*#__PURE__*/dual(2, (self, elem) => appendAll(of(elem), self));
3553
3553
  */
3554
3554
  const take = /*#__PURE__*/dual(2, (self, n) => {
3555
3555
  if (n <= 0) {
3556
- return _empty$2;
3556
+ return _empty$5;
3557
3557
  } else if (n >= self.length) {
3558
3558
  return self;
3559
3559
  } else {
@@ -3599,7 +3599,7 @@ const drop = /*#__PURE__*/dual(2, (self, n) => {
3599
3599
  if (n <= 0) {
3600
3600
  return self;
3601
3601
  } else if (n >= self.length) {
3602
- return _empty$2;
3602
+ return _empty$5;
3603
3603
  } else {
3604
3604
  switch (self.backing._tag) {
3605
3605
  case "ISlice":
@@ -3652,7 +3652,7 @@ const drop = /*#__PURE__*/dual(2, (self, n) => {
3652
3652
  * @category concatenating
3653
3653
  * @since 2.0.0
3654
3654
  */
3655
- const appendAll = /*#__PURE__*/dual(2, (self, that) => {
3655
+ const appendAll$1 = /*#__PURE__*/dual(2, (self, that) => {
3656
3656
  if (self.backing._tag === "IEmpty") {
3657
3657
  return that;
3658
3658
  }
@@ -3668,14 +3668,14 @@ const appendAll = /*#__PURE__*/dual(2, (self, that) => {
3668
3668
  });
3669
3669
  } else if (diff < -1) {
3670
3670
  if (self.left.depth >= self.right.depth) {
3671
- const nr = appendAll(self.right, that);
3671
+ const nr = appendAll$1(self.right, that);
3672
3672
  return makeChunk({
3673
3673
  _tag: "IConcat",
3674
3674
  left: self.left,
3675
3675
  right: nr
3676
3676
  });
3677
3677
  } else {
3678
- const nrr = appendAll(self.right.right, that);
3678
+ const nrr = appendAll$1(self.right.right, that);
3679
3679
  if (nrr.depth === self.depth - 3) {
3680
3680
  const nr = makeChunk({
3681
3681
  _tag: "IConcat",
@@ -3702,14 +3702,14 @@ const appendAll = /*#__PURE__*/dual(2, (self, that) => {
3702
3702
  }
3703
3703
  } else {
3704
3704
  if (that.right.depth >= that.left.depth) {
3705
- const nl = appendAll(self, that.left);
3705
+ const nl = appendAll$1(self, that.left);
3706
3706
  return makeChunk({
3707
3707
  _tag: "IConcat",
3708
3708
  left: nl,
3709
3709
  right: that.right
3710
3710
  });
3711
3711
  } else {
3712
- const nll = appendAll(self, that.left.left);
3712
+ const nll = appendAll$1(self, that.left.left);
3713
3713
  if (nll.depth === that.depth - 3) {
3714
3714
  const nl = makeChunk({
3715
3715
  _tag: "IConcat",
@@ -3756,7 +3756,7 @@ const filter = /*#__PURE__*/dual(2, (self, predicate) => unsafeFromArray(filter$
3756
3756
  * @since 2.0.0
3757
3757
  * @category elements
3758
3758
  */
3759
- const isEmpty$2 = self => self.length === 0;
3759
+ const isEmpty$3 = self => self.length === 0;
3760
3760
  /**
3761
3761
  * Determines if the chunk is not empty.
3762
3762
  *
@@ -3770,7 +3770,7 @@ const isNonEmpty = self => self.length > 0;
3770
3770
  * @since 2.0.0
3771
3771
  * @category elements
3772
3772
  */
3773
- const head = /*#__PURE__*/get$2(0);
3773
+ const head = /*#__PURE__*/get$3(0);
3774
3774
  /**
3775
3775
  * Returns the first element of this chunk.
3776
3776
  *
@@ -3805,7 +3805,7 @@ const headNonEmpty = unsafeHead;
3805
3805
  * @since 2.0.0
3806
3806
  * @category mapping
3807
3807
  */
3808
- const map$2 = /*#__PURE__*/dual(2, (self, f) => self.backing._tag === "ISingleton" ? of(f(self.backing.a, 0)) : unsafeFromArray(pipe(toReadonlyArray(self), map$3((a, i) => f(a, i)))));
3808
+ const map$4 = /*#__PURE__*/dual(2, (self, f) => self.backing._tag === "ISingleton" ? of$1(f(self.backing.a, 0)) : unsafeFromArray(pipe(toReadonlyArray(self), map$5((a, i) => f(a, i)))));
3809
3809
  /**
3810
3810
  * Returns two splits of this chunk at the specified index.
3811
3811
  *
@@ -3842,7 +3842,7 @@ const tailNonEmpty = self => drop(self, 1);
3842
3842
  * @category folding
3843
3843
  * @since 2.0.0
3844
3844
  */
3845
- const reduce$4 = reduce$5;
3845
+ const reduce$6 = reduce$7;
3846
3846
 
3847
3847
  /** @internal */
3848
3848
  const SIZE = 5;
@@ -3883,7 +3883,7 @@ function fromBitmap(bitmap, bit) {
3883
3883
  return popcount(bitmap & bit - 1);
3884
3884
  }
3885
3885
 
3886
- const make$3 = (value, previous) => ({
3886
+ const make$6 = (value, previous) => ({
3887
3887
  value,
3888
3888
  previous
3889
3889
  });
@@ -3940,7 +3940,7 @@ function arraySpliceIn(mutate, at, v, arr) {
3940
3940
  class EmptyNode {
3941
3941
  _tag = "EmptyNode";
3942
3942
  modify(edit, _shift, f, hash, key, size) {
3943
- const v = f(none$1());
3943
+ const v = f(none$3());
3944
3944
  if (isNone(v)) return new EmptyNode();
3945
3945
  ++size.value;
3946
3946
  return new LeafNode(edit, hash, key, v);
@@ -3984,7 +3984,7 @@ class LeafNode {
3984
3984
  }
3985
3985
  return new LeafNode(edit, hash, key, v);
3986
3986
  }
3987
- const v = f(none$1());
3987
+ const v = f(none$3());
3988
3988
  if (isNone(v)) return this;
3989
3989
  ++size.value;
3990
3990
  return mergeLeaves(edit, shift, this.hash, this, hash, new LeafNode(edit, hash, key, v));
@@ -4008,7 +4008,7 @@ class CollisionNode {
4008
4008
  if (list === this.children) return this;
4009
4009
  return list.length > 1 ? new CollisionNode(edit, this.hash, list) : list[0]; // collapse single element collision list
4010
4010
  }
4011
- const v = f(none$1());
4011
+ const v = f(none$3());
4012
4012
  if (isNone(v)) return this;
4013
4013
  ++size.value;
4014
4014
  return mergeLeaves(edit, shift, this.hash, this, hash, new LeafNode(edit, hash, key, v));
@@ -4028,7 +4028,7 @@ class CollisionNode {
4028
4028
  return arrayUpdate(mutate, i, new LeafNode(edit, hash, key, newValue), list);
4029
4029
  }
4030
4030
  }
4031
- const newValue = f(none$1());
4031
+ const newValue = f(none$3());
4032
4032
  if (isNone(newValue)) return list;
4033
4033
  ++size.value;
4034
4034
  return arrayUpdate(mutate, len, new LeafNode(edit, hash, key, newValue), list);
@@ -4169,7 +4169,7 @@ function mergeLeaves(edit, shift, h1, n1, h2, n2) {
4169
4169
  while (true) {
4170
4170
  const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
4171
4171
  if (typeof res === "function") {
4172
- stack = make$3(res, stack);
4172
+ stack = make$6(res, stack);
4173
4173
  currentShift = currentShift + SIZE;
4174
4174
  } else {
4175
4175
  let final = res;
@@ -4193,7 +4193,7 @@ const HashMapProto = {
4193
4193
  [symbol$1]() {
4194
4194
  let hash$1 = hash(HashMapSymbolKey);
4195
4195
  for (const item of this) {
4196
- hash$1 ^= pipe(hash(item[0]), combine$1(hash(item[1])));
4196
+ hash$1 ^= pipe(hash(item[0]), combine$5(hash(item[1])));
4197
4197
  }
4198
4198
  return cached(this, hash$1);
4199
4199
  },
@@ -4267,7 +4267,7 @@ class HashMapIterator {
4267
4267
  return new HashMapIterator(this.map, this.f);
4268
4268
  }
4269
4269
  }
4270
- const applyCont = cont => cont ? visitLazyChildren(cont[0], cont[1], cont[2], cont[3], cont[4]) : none$1();
4270
+ const applyCont = cont => cont ? visitLazyChildren(cont[0], cont[1], cont[2], cont[3], cont[4]) : none$3();
4271
4271
  const visitLazy = (node, f, cont = undefined) => {
4272
4272
  switch (node._tag) {
4273
4273
  case "LeafNode":
@@ -4302,23 +4302,23 @@ const visitLazyChildren = (len, children, i, f, cont) => {
4302
4302
  }
4303
4303
  return applyCont(cont);
4304
4304
  };
4305
- const _empty$1 = /*#__PURE__*/makeImpl$1(false, 0, /*#__PURE__*/new EmptyNode(), 0);
4305
+ const _empty$4 = /*#__PURE__*/makeImpl$1(false, 0, /*#__PURE__*/new EmptyNode(), 0);
4306
4306
  /** @internal */
4307
- const empty$3 = () => _empty$1;
4307
+ const empty$9 = () => _empty$4;
4308
4308
  /** @internal */
4309
- const fromIterable$2 = entries => {
4310
- const map = beginMutation$1(empty$3());
4309
+ const fromIterable$3 = entries => {
4310
+ const map = beginMutation$1(empty$9());
4311
4311
  for (const entry of entries) {
4312
- set$1(map, entry[0], entry[1]);
4312
+ set$2(map, entry[0], entry[1]);
4313
4313
  }
4314
4314
  return endMutation$1(map);
4315
4315
  };
4316
4316
  /** @internal */
4317
4317
  const isHashMap = u => hasProperty(u, HashMapTypeId);
4318
4318
  /** @internal */
4319
- const isEmpty$1 = self => self && isEmptyNode(self._root);
4319
+ const isEmpty$2 = self => self && isEmptyNode(self._root);
4320
4320
  /** @internal */
4321
- const get$1 = /*#__PURE__*/dual(2, (self, key) => getHash(self, key, hash(key)));
4321
+ const get$2 = /*#__PURE__*/dual(2, (self, key) => getHash(self, key, hash(key)));
4322
4322
  /** @internal */
4323
4323
  const getHash = /*#__PURE__*/dual(3, (self, key, hash) => {
4324
4324
  let node = self._root;
@@ -4327,7 +4327,7 @@ const getHash = /*#__PURE__*/dual(3, (self, key, hash) => {
4327
4327
  switch (node._tag) {
4328
4328
  case "LeafNode":
4329
4329
  {
4330
- return equals(key, node.key) ? node.value : none$1();
4330
+ return equals(key, node.key) ? node.value : none$3();
4331
4331
  }
4332
4332
  case "CollisionNode":
4333
4333
  {
@@ -4340,7 +4340,7 @@ const getHash = /*#__PURE__*/dual(3, (self, key, hash) => {
4340
4340
  }
4341
4341
  }
4342
4342
  }
4343
- return none$1();
4343
+ return none$3();
4344
4344
  }
4345
4345
  case "IndexedNode":
4346
4346
  {
@@ -4351,7 +4351,7 @@ const getHash = /*#__PURE__*/dual(3, (self, key, hash) => {
4351
4351
  shift += SIZE;
4352
4352
  break;
4353
4353
  }
4354
- return none$1();
4354
+ return none$3();
4355
4355
  }
4356
4356
  case "ArrayNode":
4357
4357
  {
@@ -4360,17 +4360,17 @@ const getHash = /*#__PURE__*/dual(3, (self, key, hash) => {
4360
4360
  shift += SIZE;
4361
4361
  break;
4362
4362
  }
4363
- return none$1();
4363
+ return none$3();
4364
4364
  }
4365
4365
  default:
4366
- return none$1();
4366
+ return none$3();
4367
4367
  }
4368
4368
  }
4369
4369
  });
4370
4370
  /** @internal */
4371
4371
  const has$2 = /*#__PURE__*/dual(2, (self, key) => isSome(getHash(self, key, hash(key))));
4372
4372
  /** @internal */
4373
- const set$1 = /*#__PURE__*/dual(3, (self, key, value) => modifyAt(self, key, () => some(value)));
4373
+ const set$2 = /*#__PURE__*/dual(3, (self, key, value) => modifyAt$1(self, key, () => some(value)));
4374
4374
  /** @internal */
4375
4375
  const setTree = /*#__PURE__*/dual(3, (self, newRoot, newSize) => {
4376
4376
  if (self._editable) {
@@ -4381,7 +4381,7 @@ const setTree = /*#__PURE__*/dual(3, (self, newRoot, newSize) => {
4381
4381
  return newRoot === self._root ? self : makeImpl$1(self._editable, self._edit, newRoot, newSize);
4382
4382
  });
4383
4383
  /** @internal */
4384
- const keys = self => new HashMapIterator(self, key => key);
4384
+ const keys$1 = self => new HashMapIterator(self, key => key);
4385
4385
  /** @internal */
4386
4386
  const size$2 = self => self._size;
4387
4387
  /** @internal */
@@ -4392,7 +4392,7 @@ const endMutation$1 = self => {
4392
4392
  return self;
4393
4393
  };
4394
4394
  /** @internal */
4395
- const modifyAt = /*#__PURE__*/dual(3, (self, key, f) => modifyHash(self, key, hash(key), f));
4395
+ const modifyAt$1 = /*#__PURE__*/dual(3, (self, key, f) => modifyHash(self, key, hash(key), f));
4396
4396
  /** @internal */
4397
4397
  const modifyHash = /*#__PURE__*/dual(4, (self, key, hash, f) => {
4398
4398
  const size = {
@@ -4402,18 +4402,18 @@ const modifyHash = /*#__PURE__*/dual(4, (self, key, hash, f) => {
4402
4402
  return pipe(self, setTree(newRoot, size.value));
4403
4403
  });
4404
4404
  /** @internal */
4405
- const remove$2 = /*#__PURE__*/dual(2, (self, key) => modifyAt(self, key, none$1));
4405
+ const remove$2 = /*#__PURE__*/dual(2, (self, key) => modifyAt$1(self, key, none$3));
4406
4406
  /**
4407
4407
  * Maps over the entries of the `HashMap` using the specified function.
4408
4408
  *
4409
4409
  * @since 2.0.0
4410
4410
  * @category mapping
4411
4411
  */
4412
- const map$1 = /*#__PURE__*/dual(2, (self, f) => reduce$3(self, empty$3(), (map, value, key) => set$1(map, key, f(value, key))));
4412
+ const map$3 = /*#__PURE__*/dual(2, (self, f) => reduce$5(self, empty$9(), (map, value, key) => set$2(map, key, f(value, key))));
4413
4413
  /** @internal */
4414
- const forEach$1 = /*#__PURE__*/dual(2, (self, f) => reduce$3(self, void 0, (_, value, key) => f(value, key)));
4414
+ const forEach$1 = /*#__PURE__*/dual(2, (self, f) => reduce$5(self, void 0, (_, value, key) => f(value, key)));
4415
4415
  /** @internal */
4416
- const reduce$3 = /*#__PURE__*/dual(3, (self, zero, f) => {
4416
+ const reduce$5 = /*#__PURE__*/dual(3, (self, zero, f) => {
4417
4417
  const root = self._root;
4418
4418
  if (root._tag === "LeafNode") {
4419
4419
  return isSome(root.value) ? f(zero, root.value.value, root.key) : zero;
@@ -4446,10 +4446,10 @@ const HashSetTypeId = /*#__PURE__*/Symbol.for(HashSetSymbolKey);
4446
4446
  const HashSetProto = {
4447
4447
  [HashSetTypeId]: HashSetTypeId,
4448
4448
  [Symbol.iterator]() {
4449
- return keys(this._keyMap);
4449
+ return keys$1(this._keyMap);
4450
4450
  },
4451
4451
  [symbol$1]() {
4452
- return cached(this, combine$1(hash(this._keyMap))(hash(HashSetSymbolKey)));
4452
+ return cached(this, combine$5(hash(this._keyMap))(hash(HashSetSymbolKey)));
4453
4453
  },
4454
4454
  [symbol](that) {
4455
4455
  if (isHashSet(that)) {
@@ -4481,20 +4481,20 @@ const makeImpl = keyMap => {
4481
4481
  };
4482
4482
  /** @internal */
4483
4483
  const isHashSet = u => hasProperty(u, HashSetTypeId);
4484
- const _empty = /*#__PURE__*/makeImpl(/*#__PURE__*/empty$3());
4484
+ const _empty$3 = /*#__PURE__*/makeImpl(/*#__PURE__*/empty$9());
4485
4485
  /** @internal */
4486
- const empty$2 = () => _empty;
4486
+ const empty$8 = () => _empty$3;
4487
4487
  /** @internal */
4488
- const fromIterable$1 = elements => {
4489
- const set = beginMutation(empty$2());
4488
+ const fromIterable$2 = elements => {
4489
+ const set = beginMutation(empty$8());
4490
4490
  for (const value of elements) {
4491
4491
  add$1(set, value);
4492
4492
  }
4493
4493
  return endMutation(set);
4494
4494
  };
4495
4495
  /** @internal */
4496
- const make$2 = (...elements) => {
4497
- const set = beginMutation(empty$2());
4496
+ const make$5 = (...elements) => {
4497
+ const set = beginMutation(empty$8());
4498
4498
  for (const value of elements) {
4499
4499
  add$1(set, value);
4500
4500
  }
@@ -4518,7 +4518,7 @@ const mutate = /*#__PURE__*/dual(2, (self, f) => {
4518
4518
  return endMutation(transient);
4519
4519
  });
4520
4520
  /** @internal */
4521
- const add$1 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (set$1(value, true)(self._keyMap), self) : makeImpl(set$1(value, true)(self._keyMap)));
4521
+ const add$1 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (set$2(value, true)(self._keyMap), self) : makeImpl(set$2(value, true)(self._keyMap)));
4522
4522
  /** @internal */
4523
4523
  const remove$1 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (remove$2(value)(self._keyMap), self) : makeImpl(remove$2(value)(self._keyMap)));
4524
4524
  /** @internal */
@@ -4528,7 +4528,7 @@ const difference$1 = /*#__PURE__*/dual(2, (self, that) => mutate(self, set => {
4528
4528
  }
4529
4529
  }));
4530
4530
  /** @internal */
4531
- const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$2(), set => {
4531
+ const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$8(), set => {
4532
4532
  forEach(self, value => add$1(set, value));
4533
4533
  for (const value of that) {
4534
4534
  add$1(set, value);
@@ -4537,7 +4537,7 @@ const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$2(), set => {
4537
4537
  /** @internal */
4538
4538
  const forEach = /*#__PURE__*/dual(2, (self, f) => forEach$1(self._keyMap, (_, k) => f(k)));
4539
4539
  /** @internal */
4540
- const reduce$2 = /*#__PURE__*/dual(3, (self, zero, f) => reduce$3(self._keyMap, zero, (z, _, a) => f(z, a)));
4540
+ const reduce$4 = /*#__PURE__*/dual(3, (self, zero, f) => reduce$5(self._keyMap, zero, (z, _, a) => f(z, a)));
4541
4541
 
4542
4542
  /**
4543
4543
  * # HashSet
@@ -4819,7 +4819,7 @@ const reduce$2 = /*#__PURE__*/dual(3, (self, zero, f) => reduce$3(self._keyMap,
4819
4819
  *
4820
4820
  * @see Other `HashSet` constructors are {@link module:HashSet.make} {@link module:HashSet.fromIterable}
4821
4821
  */
4822
- const empty$1 = empty$2;
4822
+ const empty$7 = empty$8;
4823
4823
  /**
4824
4824
  * Creates a new `HashSet` from an iterable collection of values.
4825
4825
  *
@@ -4913,7 +4913,7 @@ const empty$1 = empty$2;
4913
4913
  *
4914
4914
  * @see Other `HashSet` constructors are {@link module:HashSet.empty} {@link module:HashSet.make}
4915
4915
  */
4916
- const fromIterable = fromIterable$1;
4916
+ const fromIterable$1 = fromIterable$2;
4917
4917
  /**
4918
4918
  * Construct a new `HashSet` from a variable number of values.
4919
4919
  *
@@ -5001,7 +5001,7 @@ const fromIterable = fromIterable$1;
5001
5001
  *
5002
5002
  * @see Other `HashSet` constructors are {@link module:HashSet.fromIterable} {@link module:HashSet.empty}
5003
5003
  */
5004
- const make$1 = make$2;
5004
+ const make$4 = make$5;
5005
5005
  /**
5006
5006
  * Checks if the specified value exists in the `HashSet`.
5007
5007
  *
@@ -5202,14 +5202,14 @@ const union = union$1;
5202
5202
  * HashSet.reduce(HashSet.make(0, 1, 2), 0, sum)
5203
5203
  * ```
5204
5204
  */
5205
- const reduce$1 = reduce$2;
5205
+ const reduce$3 = reduce$4;
5206
5206
 
5207
5207
  /**
5208
5208
  * @since 2.0.0
5209
5209
  */
5210
- const TypeId$1 = /*#__PURE__*/Symbol.for("effect/MutableRef");
5210
+ const TypeId$2 = /*#__PURE__*/Symbol.for("effect/MutableRef");
5211
5211
  const MutableRefProto = {
5212
- [TypeId$1]: TypeId$1,
5212
+ [TypeId$2]: TypeId$2,
5213
5213
  toString() {
5214
5214
  return format$1(this.toJSON());
5215
5215
  },
@@ -5230,7 +5230,7 @@ const MutableRefProto = {
5230
5230
  * @since 2.0.0
5231
5231
  * @category constructors
5232
5232
  */
5233
- const make = value => {
5233
+ const make$3 = value => {
5234
5234
  const ref = Object.create(MutableRefProto);
5235
5235
  ref.current = value;
5236
5236
  return ref;
@@ -5250,12 +5250,12 @@ const compareAndSet = /*#__PURE__*/dual(3, (self, oldValue, newValue) => {
5250
5250
  * @since 2.0.0
5251
5251
  * @category general
5252
5252
  */
5253
- const get = self => self.current;
5253
+ const get$1 = self => self.current;
5254
5254
  /**
5255
5255
  * @since 2.0.0
5256
5256
  * @category general
5257
5257
  */
5258
- const set = /*#__PURE__*/dual(2, (self, value) => {
5258
+ const set$1 = /*#__PURE__*/dual(2, (self, value) => {
5259
5259
  self.current = value;
5260
5260
  return self;
5261
5261
  });
@@ -5272,7 +5272,7 @@ const OP_RUNTIME = "Runtime";
5272
5272
  const OP_COMPOSITE = "Composite";
5273
5273
  const emptyHash = /*#__PURE__*/string(`${FiberIdSymbolKey}-${OP_NONE}`);
5274
5274
  /** @internal */
5275
- class None {
5275
+ let None$1 = class None {
5276
5276
  [FiberIdTypeId] = FiberIdTypeId;
5277
5277
  _tag = OP_NONE;
5278
5278
  id = -1;
@@ -5295,7 +5295,7 @@ class None {
5295
5295
  [NodeInspectSymbol]() {
5296
5296
  return this.toJSON();
5297
5297
  }
5298
- }
5298
+ };
5299
5299
  /** @internal */
5300
5300
  class Runtime {
5301
5301
  id;
@@ -5339,7 +5339,7 @@ class Composite {
5339
5339
  }
5340
5340
  _hash;
5341
5341
  [symbol$1]() {
5342
- return pipe(string(`${FiberIdSymbolKey}-${this._tag}`), combine$1(hash(this.left)), combine$1(hash(this.right)), cached(this));
5342
+ return pipe(string(`${FiberIdSymbolKey}-${this._tag}`), combine$5(hash(this.left)), combine$5(hash(this.right)), cached(this));
5343
5343
  }
5344
5344
  [symbol](that) {
5345
5345
  return isFiberId(that) && that._tag === OP_COMPOSITE && equals(this.left, that.left) && equals(this.right, that.right);
@@ -5360,11 +5360,11 @@ class Composite {
5360
5360
  }
5361
5361
  }
5362
5362
  /** @internal */
5363
- const none = /*#__PURE__*/new None();
5363
+ const none$2 = /*#__PURE__*/new None$1();
5364
5364
  /** @internal */
5365
5365
  const isFiberId = self => hasProperty(self, FiberIdTypeId);
5366
5366
  /** @internal */
5367
- const combine = /*#__PURE__*/dual(2, (self, that) => {
5367
+ const combine$4 = /*#__PURE__*/dual(2, (self, that) => {
5368
5368
  if (self._tag === OP_NONE) {
5369
5369
  return that;
5370
5370
  }
@@ -5374,19 +5374,19 @@ const combine = /*#__PURE__*/dual(2, (self, that) => {
5374
5374
  return new Composite(self, that);
5375
5375
  });
5376
5376
  /** @internal */
5377
- const combineAll = fiberIds => {
5378
- return pipe(fiberIds, reduce$1(none, (a, b) => combine(b)(a)));
5377
+ const combineAll$1 = fiberIds => {
5378
+ return pipe(fiberIds, reduce$3(none$2, (a, b) => combine$4(b)(a)));
5379
5379
  };
5380
5380
  /** @internal */
5381
5381
  const ids = self => {
5382
5382
  switch (self._tag) {
5383
5383
  case OP_NONE:
5384
5384
  {
5385
- return empty$1();
5385
+ return empty$7();
5386
5386
  }
5387
5387
  case OP_RUNTIME:
5388
5388
  {
5389
- return make$1(self.id);
5389
+ return make$4(self.id);
5390
5390
  }
5391
5391
  case OP_COMPOSITE:
5392
5392
  {
@@ -5394,713 +5394,2802 @@ const ids = self => {
5394
5394
  }
5395
5395
  }
5396
5396
  };
5397
- const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make(0));
5397
+ const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$3(0));
5398
5398
  /** @internal */
5399
- const threadName = self => {
5399
+ const threadName$1 = self => {
5400
5400
  const identifiers = Array.from(ids(self)).map(n => `#${n}`).join(",");
5401
5401
  return identifiers;
5402
5402
  };
5403
5403
  /** @internal */
5404
- const unsafeMake = () => {
5405
- const id = get(_fiberCounter);
5406
- pipe(_fiberCounter, set(id + 1));
5404
+ const unsafeMake$1 = () => {
5405
+ const id = get$1(_fiberCounter);
5406
+ pipe(_fiberCounter, set$1(id + 1));
5407
5407
  return new Runtime(id, Date.now());
5408
5408
  };
5409
5409
 
5410
- /** @internal */
5411
- const OP_DIE = "Die";
5412
- /** @internal */
5413
- const OP_EMPTY = "Empty";
5414
- /** @internal */
5415
- const OP_FAIL = "Fail";
5416
- /** @internal */
5417
- const OP_INTERRUPT = "Interrupt";
5418
- /** @internal */
5419
- const OP_PARALLEL = "Parallel";
5420
- /** @internal */
5421
- const OP_SEQUENTIAL = "Sequential";
5410
+ /**
5411
+ * @since 2.0.0
5412
+ * @category constructors
5413
+ */
5414
+ const none$1 = none$2;
5415
+ /**
5416
+ * Combine two `FiberId`s.
5417
+ *
5418
+ * @since 2.0.0
5419
+ * @category constructors
5420
+ */
5421
+ const combine$3 = combine$4;
5422
+ /**
5423
+ * Combines a set of `FiberId`s into a single `FiberId`.
5424
+ *
5425
+ * @since 2.0.0
5426
+ * @category constructors
5427
+ */
5428
+ const combineAll = combineAll$1;
5429
+ /**
5430
+ * Creates a string representing the name of the current thread of execution
5431
+ * represented by the specified `FiberId`.
5432
+ *
5433
+ * @since 2.0.0
5434
+ * @category destructors
5435
+ */
5436
+ const threadName = threadName$1;
5437
+ /**
5438
+ * Unsafely creates a new `FiberId`.
5439
+ *
5440
+ * @since 2.0.0
5441
+ * @category unsafe
5442
+ */
5443
+ const unsafeMake = unsafeMake$1;
5422
5444
 
5423
- // -----------------------------------------------------------------------------
5424
- // Models
5425
- // -----------------------------------------------------------------------------
5426
- /** @internal */
5427
- const CauseSymbolKey = "effect/Cause";
5428
- /** @internal */
5429
- const CauseTypeId = /*#__PURE__*/Symbol.for(CauseSymbolKey);
5430
- const variance = {
5431
- /* c8 ignore next */
5432
- _E: _ => _
5433
- };
5434
- /** @internal */
5435
- const proto = {
5436
- [CauseTypeId]: variance,
5437
- [symbol$1]() {
5438
- return pipe(hash(CauseSymbolKey), combine$1(hash(flattenCause(this))), cached(this));
5445
+ /**
5446
+ * @since 2.0.0
5447
+ */
5448
+ /**
5449
+ * Creates a new `HashMap`.
5450
+ *
5451
+ * @since 2.0.0
5452
+ * @category constructors
5453
+ */
5454
+ const empty$6 = empty$9;
5455
+ /**
5456
+ * Creates a new `HashMap` from an iterable collection of key/value pairs.
5457
+ *
5458
+ * @since 2.0.0
5459
+ * @category constructors
5460
+ */
5461
+ const fromIterable = fromIterable$3;
5462
+ /**
5463
+ * Checks if the `HashMap` contains any entries.
5464
+ *
5465
+ * @since 2.0.0
5466
+ * @category elements
5467
+ */
5468
+ const isEmpty$1 = isEmpty$2;
5469
+ /**
5470
+ * Safely lookup the value for the specified key in the `HashMap` using the
5471
+ * internal hashing function.
5472
+ *
5473
+ * @since 2.0.0
5474
+ * @category elements
5475
+ */
5476
+ const get = get$2;
5477
+ /**
5478
+ * Sets the specified key to the specified value using the internal hashing
5479
+ * function.
5480
+ *
5481
+ * @since 2.0.0
5482
+ */
5483
+ const set = set$2;
5484
+ /**
5485
+ * Returns an `IterableIterator` of the keys within the `HashMap`.
5486
+ *
5487
+ * @since 2.0.0
5488
+ * @category getters
5489
+ */
5490
+ const keys = keys$1;
5491
+ /**
5492
+ * Set or remove the specified key in the `HashMap` using the specified
5493
+ * update function. The value of the specified key will be computed using the
5494
+ * provided hash.
5495
+ *
5496
+ * The update function will be invoked with the current value of the key if it
5497
+ * exists, or `None` if no such value exists.
5498
+ *
5499
+ * @since 2.0.0
5500
+ */
5501
+ const modifyAt = modifyAt$1;
5502
+ /**
5503
+ * Maps over the entries of the `HashMap` using the specified function.
5504
+ *
5505
+ * @since 2.0.0
5506
+ * @category mapping
5507
+ */
5508
+ const map$2 = map$3;
5509
+ /**
5510
+ * Reduces the specified state over the entries of the `HashMap`.
5511
+ *
5512
+ * @since 2.0.0
5513
+ * @category folding
5514
+ */
5515
+ const reduce$2 = reduce$5;
5516
+
5517
+ /**
5518
+ * A data type for immutable linked lists representing ordered collections of elements of type `A`.
5519
+ *
5520
+ * This data type is optimal for last-in-first-out (LIFO), stack-like access patterns. If you need another access pattern, for example, random access or FIFO, consider using a collection more suited to this than `List`.
5521
+ *
5522
+ * **Performance**
5523
+ *
5524
+ * - Time: `List` has `O(1)` prepend and head/tail access. Most other operations are `O(n)` on the number of elements in the list. This includes the index-based lookup of elements, `length`, `append` and `reverse`.
5525
+ * - Space: `List` implements structural sharing of the tail list. This means that many operations are either zero- or constant-memory cost.
5526
+ *
5527
+ * @since 2.0.0
5528
+ */
5529
+ /**
5530
+ * This file is ported from
5531
+ *
5532
+ * Scala (https://www.scala-lang.org)
5533
+ *
5534
+ * Copyright EPFL and Lightbend, Inc.
5535
+ *
5536
+ * Licensed under Apache License 2.0
5537
+ * (http://www.apache.org/licenses/LICENSE-2.0).
5538
+ */
5539
+ /**
5540
+ * @since 2.0.0
5541
+ * @category symbol
5542
+ */
5543
+ const TypeId$1 = /*#__PURE__*/Symbol.for("effect/List");
5544
+ /**
5545
+ * Converts the specified `List` to an `Array`.
5546
+ *
5547
+ * @category conversions
5548
+ * @since 2.0.0
5549
+ */
5550
+ const toArray = self => fromIterable$5(self);
5551
+ /**
5552
+ * @category equivalence
5553
+ * @since 2.0.0
5554
+ */
5555
+ const getEquivalence = isEquivalent => mapInput(getEquivalence$2(isEquivalent), toArray);
5556
+ const _equivalence = /*#__PURE__*/getEquivalence(equals);
5557
+ const ConsProto = {
5558
+ [TypeId$1]: TypeId$1,
5559
+ _tag: "Cons",
5560
+ toString() {
5561
+ return format$1(this.toJSON());
5562
+ },
5563
+ toJSON() {
5564
+ return {
5565
+ _id: "List",
5566
+ _tag: "Cons",
5567
+ values: toArray(this).map(toJSON)
5568
+ };
5569
+ },
5570
+ [NodeInspectSymbol]() {
5571
+ return this.toJSON();
5439
5572
  },
5440
5573
  [symbol](that) {
5441
- return isCause(that) && causeEquals(this, that);
5574
+ return isList(that) && this._tag === that._tag && _equivalence(this, that);
5442
5575
  },
5443
- pipe() {
5444
- return pipeArguments(this, arguments);
5576
+ [symbol$1]() {
5577
+ return cached(this, array(toArray(this)));
5445
5578
  },
5446
- toJSON() {
5447
- switch (this._tag) {
5448
- case "Empty":
5449
- return {
5450
- _id: "Cause",
5451
- _tag: this._tag
5452
- };
5453
- case "Die":
5454
- return {
5455
- _id: "Cause",
5456
- _tag: this._tag,
5457
- defect: toJSON(this.defect)
5458
- };
5459
- case "Interrupt":
5460
- return {
5461
- _id: "Cause",
5462
- _tag: this._tag,
5463
- fiberId: this.fiberId.toJSON()
5464
- };
5465
- case "Fail":
5579
+ [Symbol.iterator]() {
5580
+ let done = false;
5581
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
5582
+ let self = this;
5583
+ return {
5584
+ next() {
5585
+ if (done) {
5586
+ return this.return();
5587
+ }
5588
+ if (self._tag === "Nil") {
5589
+ done = true;
5590
+ return this.return();
5591
+ }
5592
+ const value = self.head;
5593
+ self = self.tail;
5466
5594
  return {
5467
- _id: "Cause",
5468
- _tag: this._tag,
5469
- failure: toJSON(this.error)
5595
+ done,
5596
+ value
5470
5597
  };
5471
- case "Sequential":
5472
- case "Parallel":
5598
+ },
5599
+ return(value) {
5600
+ if (!done) {
5601
+ done = true;
5602
+ }
5473
5603
  return {
5474
- _id: "Cause",
5475
- _tag: this._tag,
5476
- left: toJSON(this.left),
5477
- right: toJSON(this.right)
5604
+ done: true,
5605
+ value
5478
5606
  };
5479
- }
5607
+ }
5608
+ };
5480
5609
  },
5610
+ pipe() {
5611
+ return pipeArguments(this, arguments);
5612
+ }
5613
+ };
5614
+ const makeCons = (head, tail) => {
5615
+ const cons = Object.create(ConsProto);
5616
+ cons.head = head;
5617
+ cons.tail = tail;
5618
+ return cons;
5619
+ };
5620
+ const NilHash = /*#__PURE__*/string("Nil");
5621
+ const NilProto = {
5622
+ [TypeId$1]: TypeId$1,
5623
+ _tag: "Nil",
5481
5624
  toString() {
5482
- return pretty(this);
5625
+ return format$1(this.toJSON());
5626
+ },
5627
+ toJSON() {
5628
+ return {
5629
+ _id: "List",
5630
+ _tag: "Nil"
5631
+ };
5483
5632
  },
5484
5633
  [NodeInspectSymbol]() {
5485
5634
  return this.toJSON();
5635
+ },
5636
+ [symbol$1]() {
5637
+ return NilHash;
5638
+ },
5639
+ [symbol](that) {
5640
+ return isList(that) && this._tag === that._tag;
5641
+ },
5642
+ [Symbol.iterator]() {
5643
+ return {
5644
+ next() {
5645
+ return {
5646
+ done: true,
5647
+ value: undefined
5648
+ };
5649
+ }
5650
+ };
5651
+ },
5652
+ pipe() {
5653
+ return pipeArguments(this, arguments);
5486
5654
  }
5487
5655
  };
5488
- // -----------------------------------------------------------------------------
5489
- // Constructors
5490
- // -----------------------------------------------------------------------------
5491
- /** @internal */
5492
- const empty = /*#__PURE__*/(() => {
5493
- const o = /*#__PURE__*/Object.create(proto);
5494
- o._tag = OP_EMPTY;
5495
- return o;
5496
- })();
5497
- /** @internal */
5498
- const fail$1 = error => {
5499
- const o = Object.create(proto);
5500
- o._tag = OP_FAIL;
5501
- o.error = error;
5502
- return o;
5503
- };
5504
- /** @internal */
5505
- const die = defect => {
5506
- const o = Object.create(proto);
5507
- o._tag = OP_DIE;
5508
- o.defect = defect;
5509
- return o;
5510
- };
5511
- /** @internal */
5512
- const interrupt = fiberId => {
5513
- const o = Object.create(proto);
5514
- o._tag = OP_INTERRUPT;
5515
- o.fiberId = fiberId;
5516
- return o;
5517
- };
5518
- /** @internal */
5519
- const parallel = (left, right) => {
5520
- const o = Object.create(proto);
5521
- o._tag = OP_PARALLEL;
5522
- o.left = left;
5523
- o.right = right;
5524
- return o;
5525
- };
5656
+ const _Nil = /*#__PURE__*/Object.create(NilProto);
5657
+ /**
5658
+ * Returns `true` if the specified value is a `List`, `false` otherwise.
5659
+ *
5660
+ * @since 2.0.0
5661
+ * @category refinements
5662
+ */
5663
+ const isList = u => hasProperty(u, TypeId$1);
5664
+ /**
5665
+ * Returns `true` if the specified value is a `List.Nil<A>`, `false` otherwise.
5666
+ *
5667
+ * @since 2.0.0
5668
+ * @category refinements
5669
+ */
5670
+ const isNil = self => self._tag === "Nil";
5671
+ /**
5672
+ * Returns `true` if the specified value is a `List.Cons<A>`, `false` otherwise.
5673
+ *
5674
+ * @since 2.0.0
5675
+ * @category refinements
5676
+ */
5677
+ const isCons = self => self._tag === "Cons";
5678
+ /**
5679
+ * Constructs a new empty `List<A>`.
5680
+ *
5681
+ * @since 2.0.0
5682
+ * @category constructors
5683
+ */
5684
+ const nil = () => _Nil;
5685
+ /**
5686
+ * Constructs a new `List.Cons<A>` from the specified `head` and `tail` values.
5687
+ *
5688
+ * @since 2.0.0
5689
+ * @category constructors
5690
+ */
5691
+ const cons = (head, tail) => makeCons(head, tail);
5692
+ /**
5693
+ * Constructs a new empty `List<A>`.
5694
+ *
5695
+ * Alias of {@link nil}.
5696
+ *
5697
+ * @since 2.0.0
5698
+ * @category constructors
5699
+ */
5700
+ const empty$5 = nil;
5701
+ /**
5702
+ * Constructs a new `List<A>` from the specified value.
5703
+ *
5704
+ * @since 2.0.0
5705
+ * @category constructors
5706
+ */
5707
+ const of = value => makeCons(value, _Nil);
5708
+ /**
5709
+ * Concatenates two lists, combining their elements.
5710
+ * If either list is non-empty, the result is also a non-empty list.
5711
+ *
5712
+ * @example
5713
+ * ```ts
5714
+ * import * as assert from "node:assert"
5715
+ * import { List } from "effect"
5716
+ *
5717
+ * assert.deepStrictEqual(
5718
+ * List.make(1, 2).pipe(List.appendAll(List.make("a", "b")), List.toArray),
5719
+ * [1, 2, "a", "b"]
5720
+ * )
5721
+ * ```
5722
+ *
5723
+ * @category concatenating
5724
+ * @since 2.0.0
5725
+ */
5726
+ const appendAll = /*#__PURE__*/dual(2, (self, that) => prependAll(that, self));
5727
+ /**
5728
+ * Prepends the specified element to the beginning of the list.
5729
+ *
5730
+ * @category concatenating
5731
+ * @since 2.0.0
5732
+ */
5733
+ const prepend = /*#__PURE__*/dual(2, (self, element) => cons(element, self));
5734
+ /**
5735
+ * Prepends the specified prefix list to the beginning of the specified list.
5736
+ * If either list is non-empty, the result is also a non-empty list.
5737
+ *
5738
+ * @example
5739
+ * ```ts
5740
+ * import * as assert from "node:assert"
5741
+ * import { List } from "effect"
5742
+ *
5743
+ * assert.deepStrictEqual(
5744
+ * List.make(1, 2).pipe(List.prependAll(List.make("a", "b")), List.toArray),
5745
+ * ["a", "b", 1, 2]
5746
+ * )
5747
+ * ```
5748
+ *
5749
+ * @category concatenating
5750
+ * @since 2.0.0
5751
+ */
5752
+ const prependAll = /*#__PURE__*/dual(2, (self, prefix) => {
5753
+ if (isNil(self)) {
5754
+ return prefix;
5755
+ } else if (isNil(prefix)) {
5756
+ return self;
5757
+ } else {
5758
+ const result = makeCons(prefix.head, self);
5759
+ let curr = result;
5760
+ let that = prefix.tail;
5761
+ while (!isNil(that)) {
5762
+ const temp = makeCons(that.head, self);
5763
+ curr.tail = temp;
5764
+ curr = temp;
5765
+ that = that.tail;
5766
+ }
5767
+ return result;
5768
+ }
5769
+ });
5770
+ /**
5771
+ * Folds over the elements of the list using the specified function, using the
5772
+ * specified initial value.
5773
+ *
5774
+ * @since 2.0.0
5775
+ * @category folding
5776
+ */
5777
+ const reduce$1 = /*#__PURE__*/dual(3, (self, zero, f) => {
5778
+ let acc = zero;
5779
+ let these = self;
5780
+ while (!isNil(these)) {
5781
+ acc = f(acc, these.head);
5782
+ these = these.tail;
5783
+ }
5784
+ return acc;
5785
+ });
5786
+ /**
5787
+ * Returns a new list with the elements of the specified list in reverse order.
5788
+ *
5789
+ * @since 2.0.0
5790
+ * @category elements
5791
+ */
5792
+ const reverse = self => {
5793
+ let result = empty$5();
5794
+ let these = self;
5795
+ while (!isNil(these)) {
5796
+ result = prepend(result, these.head);
5797
+ these = these.tail;
5798
+ }
5799
+ return result;
5800
+ };
5801
+
5526
5802
  /** @internal */
5527
- const sequential = (left, right) => {
5528
- const o = Object.create(proto);
5529
- o._tag = OP_SEQUENTIAL;
5530
- o.left = left;
5531
- o.right = right;
5803
+ const Structural = /*#__PURE__*/function () {
5804
+ function Structural(args) {
5805
+ if (args) {
5806
+ Object.assign(this, args);
5807
+ }
5808
+ }
5809
+ Structural.prototype = StructuralPrototype;
5810
+ return Structural;
5811
+ }();
5812
+
5813
+ /** @internal */
5814
+ const ContextPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferContextPatch");
5815
+ function variance$3(a) {
5816
+ return a;
5817
+ }
5818
+ /** @internal */
5819
+ const PatchProto$2 = {
5820
+ ...Structural.prototype,
5821
+ [ContextPatchTypeId]: {
5822
+ _Value: variance$3,
5823
+ _Patch: variance$3
5824
+ }
5825
+ };
5826
+ const EmptyProto$2 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
5827
+ _tag: "Empty"
5828
+ });
5829
+ const _empty$2 = /*#__PURE__*/Object.create(EmptyProto$2);
5830
+ /**
5831
+ * @internal
5832
+ */
5833
+ const empty$4 = () => _empty$2;
5834
+ const AndThenProto$2 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
5835
+ _tag: "AndThen"
5836
+ });
5837
+ const makeAndThen$2 = (first, second) => {
5838
+ const o = Object.create(AndThenProto$2);
5839
+ o.first = first;
5840
+ o.second = second;
5841
+ return o;
5842
+ };
5843
+ const AddServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
5844
+ _tag: "AddService"
5845
+ });
5846
+ const makeAddService = (key, service) => {
5847
+ const o = Object.create(AddServiceProto);
5848
+ o.key = key;
5849
+ o.service = service;
5850
+ return o;
5851
+ };
5852
+ const RemoveServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
5853
+ _tag: "RemoveService"
5854
+ });
5855
+ const makeRemoveService = key => {
5856
+ const o = Object.create(RemoveServiceProto);
5857
+ o.key = key;
5858
+ return o;
5859
+ };
5860
+ const UpdateServiceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
5861
+ _tag: "UpdateService"
5862
+ });
5863
+ const makeUpdateService = (key, update) => {
5864
+ const o = Object.create(UpdateServiceProto);
5865
+ o.key = key;
5866
+ o.update = update;
5532
5867
  return o;
5533
5868
  };
5534
- // -----------------------------------------------------------------------------
5535
- // Refinements
5536
- // -----------------------------------------------------------------------------
5537
- /** @internal */
5538
- const isCause = u => hasProperty(u, CauseTypeId);
5539
5869
  /** @internal */
5540
- const isEmptyType = self => self._tag === OP_EMPTY;
5870
+ const diff$3 = (oldValue, newValue) => {
5871
+ const missingServices = new Map(oldValue.unsafeMap);
5872
+ let patch = empty$4();
5873
+ for (const [tag, newService] of newValue.unsafeMap.entries()) {
5874
+ if (missingServices.has(tag)) {
5875
+ const old = missingServices.get(tag);
5876
+ missingServices.delete(tag);
5877
+ if (!equals(old, newService)) {
5878
+ patch = combine$2(makeUpdateService(tag, () => newService))(patch);
5879
+ }
5880
+ } else {
5881
+ missingServices.delete(tag);
5882
+ patch = combine$2(makeAddService(tag, newService))(patch);
5883
+ }
5884
+ }
5885
+ for (const [tag] of missingServices.entries()) {
5886
+ patch = combine$2(makeRemoveService(tag))(patch);
5887
+ }
5888
+ return patch;
5889
+ };
5541
5890
  /** @internal */
5542
- const isDieType = self => self._tag === OP_DIE;
5891
+ const combine$2 = /*#__PURE__*/dual(2, (self, that) => makeAndThen$2(self, that));
5543
5892
  /** @internal */
5544
- const isEmpty = self => {
5545
- if (self._tag === OP_EMPTY) {
5546
- return true;
5893
+ const patch$3 = /*#__PURE__*/dual(2, (self, context) => {
5894
+ if (self._tag === "Empty") {
5895
+ return context;
5547
5896
  }
5548
- return reduce(self, true, (acc, cause) => {
5549
- switch (cause._tag) {
5550
- case OP_EMPTY:
5897
+ let wasServiceUpdated = false;
5898
+ let patches = of$1(self);
5899
+ const updatedContext = new Map(context.unsafeMap);
5900
+ while (isNonEmpty(patches)) {
5901
+ const head = headNonEmpty(patches);
5902
+ const tail = tailNonEmpty(patches);
5903
+ switch (head._tag) {
5904
+ case "Empty":
5551
5905
  {
5552
- return some(acc);
5906
+ patches = tail;
5907
+ break;
5553
5908
  }
5554
- case OP_DIE:
5555
- case OP_FAIL:
5556
- case OP_INTERRUPT:
5909
+ case "AddService":
5557
5910
  {
5558
- return some(false);
5911
+ updatedContext.set(head.key, head.service);
5912
+ patches = tail;
5913
+ break;
5559
5914
  }
5560
- default:
5915
+ case "AndThen":
5916
+ {
5917
+ patches = prepend$1(prepend$1(tail, head.second), head.first);
5918
+ break;
5919
+ }
5920
+ case "RemoveService":
5921
+ {
5922
+ updatedContext.delete(head.key);
5923
+ patches = tail;
5924
+ break;
5925
+ }
5926
+ case "UpdateService":
5561
5927
  {
5562
- return none$1();
5928
+ updatedContext.set(head.key, head.update(updatedContext.get(head.key)));
5929
+ wasServiceUpdated = true;
5930
+ patches = tail;
5931
+ break;
5563
5932
  }
5564
5933
  }
5565
- });
5566
- };
5567
- /** @internal */
5568
- const isInterrupted = self => isSome(interruptOption(self));
5569
- /** @internal */
5570
- const isInterruptedOnly = self => reduceWithContext(undefined, IsInterruptedOnlyCauseReducer)(self);
5571
- /** @internal */
5572
- const failures = self => reverse(reduce(self, empty$4(), (list, cause) => cause._tag === OP_FAIL ? some(pipe(list, prepend(cause.error))) : none$1()));
5573
- /** @internal */
5574
- const defects = self => reverse(reduce(self, empty$4(), (list, cause) => cause._tag === OP_DIE ? some(pipe(list, prepend(cause.defect))) : none$1()));
5575
- /** @internal */
5576
- const interruptors = self => reduce(self, empty$1(), (set, cause) => cause._tag === OP_INTERRUPT ? some(pipe(set, add(cause.fiberId))) : none$1());
5934
+ }
5935
+ if (!wasServiceUpdated) {
5936
+ return makeContext(updatedContext);
5937
+ }
5938
+ const map = new Map();
5939
+ for (const [tag] of context.unsafeMap) {
5940
+ if (updatedContext.has(tag)) {
5941
+ map.set(tag, updatedContext.get(tag));
5942
+ updatedContext.delete(tag);
5943
+ }
5944
+ }
5945
+ for (const [tag, s] of updatedContext) {
5946
+ map.set(tag, s);
5947
+ }
5948
+ return makeContext(map);
5949
+ });
5950
+
5577
5951
  /** @internal */
5578
- const failureOption = self => find(self, cause => cause._tag === OP_FAIL ? some(cause.error) : none$1());
5952
+ const HashSetPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferHashSetPatch");
5953
+ function variance$2(a) {
5954
+ return a;
5955
+ }
5579
5956
  /** @internal */
5580
- const failureOrCause = self => {
5581
- const option = failureOption(self);
5582
- switch (option._tag) {
5583
- case "None":
5584
- {
5585
- // no `E` inside this `Cause`, so it can be safely cast to `never`
5586
- return right(self);
5587
- }
5588
- case "Some":
5589
- {
5590
- return left(option.value);
5591
- }
5957
+ const PatchProto$1 = {
5958
+ ...Structural.prototype,
5959
+ [HashSetPatchTypeId]: {
5960
+ _Value: variance$2,
5961
+ _Key: variance$2,
5962
+ _Patch: variance$2
5592
5963
  }
5593
5964
  };
5594
- /** @internal */
5595
- const flipCauseOption = self => match(self, {
5596
- onEmpty: some(empty),
5597
- onFail: map$4(fail$1),
5598
- onDie: defect => some(die(defect)),
5599
- onInterrupt: fiberId => some(interrupt(fiberId)),
5600
- onSequential: mergeWith(sequential),
5601
- onParallel: mergeWith(parallel)
5965
+ const EmptyProto$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
5966
+ _tag: "Empty"
5602
5967
  });
5968
+ const _empty$1 = /*#__PURE__*/Object.create(EmptyProto$1);
5603
5969
  /** @internal */
5604
- const interruptOption = self => find(self, cause => cause._tag === OP_INTERRUPT ? some(cause.fiberId) : none$1());
5970
+ const empty$3 = () => _empty$1;
5971
+ const AndThenProto$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
5972
+ _tag: "AndThen"
5973
+ });
5605
5974
  /** @internal */
5606
- const stripFailures = self => match(self, {
5607
- onEmpty: empty,
5608
- onFail: () => empty,
5609
- onDie: die,
5610
- onInterrupt: interrupt,
5611
- onSequential: sequential,
5612
- onParallel: parallel
5975
+ const makeAndThen$1 = (first, second) => {
5976
+ const o = Object.create(AndThenProto$1);
5977
+ o.first = first;
5978
+ o.second = second;
5979
+ return o;
5980
+ };
5981
+ const AddProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
5982
+ _tag: "Add"
5613
5983
  });
5614
5984
  /** @internal */
5615
- const electFailures = self => match(self, {
5616
- onEmpty: empty,
5617
- onFail: die,
5618
- onDie: die,
5619
- onInterrupt: interrupt,
5620
- onSequential: sequential,
5621
- onParallel: parallel
5985
+ const makeAdd = value => {
5986
+ const o = Object.create(AddProto);
5987
+ o.value = value;
5988
+ return o;
5989
+ };
5990
+ const RemoveProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
5991
+ _tag: "Remove"
5622
5992
  });
5623
5993
  /** @internal */
5624
- const map = /*#__PURE__*/dual(2, (self, f) => flatMap$1(self, e => fail$1(f(e))));
5625
- // -----------------------------------------------------------------------------
5626
- // Sequencing
5627
- // -----------------------------------------------------------------------------
5994
+ const makeRemove = value => {
5995
+ const o = Object.create(RemoveProto);
5996
+ o.value = value;
5997
+ return o;
5998
+ };
5628
5999
  /** @internal */
5629
- const flatMap$1 = /*#__PURE__*/dual(2, (self, f) => match(self, {
5630
- onEmpty: empty,
5631
- onFail: error => f(error),
5632
- onDie: defect => die(defect),
5633
- onInterrupt: fiberId => interrupt(fiberId),
5634
- onSequential: (left, right) => sequential(left, right),
5635
- onParallel: (left, right) => parallel(left, right)
5636
- }));
6000
+ const diff$2 = (oldValue, newValue) => {
6001
+ const [removed, patch] = reduce$3([oldValue, empty$3()], ([set, patch], value) => {
6002
+ if (has(value)(set)) {
6003
+ return [remove(value)(set), patch];
6004
+ }
6005
+ return [set, combine$1(makeAdd(value))(patch)];
6006
+ })(newValue);
6007
+ return reduce$3(patch, (patch, value) => combine$1(makeRemove(value))(patch))(removed);
6008
+ };
5637
6009
  /** @internal */
5638
- const causeEquals = (left, right) => {
5639
- let leftStack = of(left);
5640
- let rightStack = of(right);
5641
- while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
5642
- const [leftParallel, leftSequential] = pipe(headNonEmpty(leftStack), reduce([empty$1(), empty$4()], ([parallel, sequential], cause) => {
5643
- const [par, seq] = evaluateCause(cause);
5644
- return some([pipe(parallel, union(par)), pipe(sequential, appendAll(seq))]);
5645
- }));
5646
- const [rightParallel, rightSequential] = pipe(headNonEmpty(rightStack), reduce([empty$1(), empty$4()], ([parallel, sequential], cause) => {
5647
- const [par, seq] = evaluateCause(cause);
5648
- return some([pipe(parallel, union(par)), pipe(sequential, appendAll(seq))]);
5649
- }));
5650
- if (!equals(leftParallel, rightParallel)) {
5651
- return false;
6010
+ const combine$1 = /*#__PURE__*/dual(2, (self, that) => makeAndThen$1(self, that));
6011
+ /** @internal */
6012
+ const patch$2 = /*#__PURE__*/dual(2, (self, oldValue) => {
6013
+ if (self._tag === "Empty") {
6014
+ return oldValue;
6015
+ }
6016
+ let set = oldValue;
6017
+ let patches = of$1(self);
6018
+ while (isNonEmpty(patches)) {
6019
+ const head = headNonEmpty(patches);
6020
+ const tail = tailNonEmpty(patches);
6021
+ switch (head._tag) {
6022
+ case "Empty":
6023
+ {
6024
+ patches = tail;
6025
+ break;
6026
+ }
6027
+ case "AndThen":
6028
+ {
6029
+ patches = prepend$1(head.first)(prepend$1(head.second)(tail));
6030
+ break;
6031
+ }
6032
+ case "Add":
6033
+ {
6034
+ set = add(head.value)(set);
6035
+ patches = tail;
6036
+ break;
6037
+ }
6038
+ case "Remove":
6039
+ {
6040
+ set = remove(head.value)(set);
6041
+ patches = tail;
6042
+ }
5652
6043
  }
5653
- leftStack = leftSequential;
5654
- rightStack = rightSequential;
5655
6044
  }
5656
- return true;
6045
+ return set;
6046
+ });
6047
+
6048
+ /** @internal */
6049
+ const ReadonlyArrayPatchTypeId = /*#__PURE__*/Symbol.for("effect/DifferReadonlyArrayPatch");
6050
+ function variance$1(a) {
6051
+ return a;
6052
+ }
6053
+ const PatchProto = {
6054
+ ...Structural.prototype,
6055
+ [ReadonlyArrayPatchTypeId]: {
6056
+ _Value: variance$1,
6057
+ _Patch: variance$1
6058
+ }
5657
6059
  };
5658
- // -----------------------------------------------------------------------------
5659
- // Flattening
5660
- // -----------------------------------------------------------------------------
6060
+ const EmptyProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
6061
+ _tag: "Empty"
6062
+ });
6063
+ const _empty = /*#__PURE__*/Object.create(EmptyProto);
5661
6064
  /**
5662
- * Flattens a cause to a sequence of sets of causes, where each set represents
5663
- * causes that fail in parallel and sequential sets represent causes that fail
5664
- * after each other.
5665
- *
5666
6065
  * @internal
5667
6066
  */
5668
- const flattenCause = cause => {
5669
- return flattenCauseLoop(of(cause), empty$4());
5670
- };
6067
+ const empty$2 = () => _empty;
6068
+ const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
6069
+ _tag: "AndThen"
6070
+ });
6071
+ const makeAndThen = (first, second) => {
6072
+ const o = Object.create(AndThenProto);
6073
+ o.first = first;
6074
+ o.second = second;
6075
+ return o;
6076
+ };
6077
+ const AppendProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
6078
+ _tag: "Append"
6079
+ });
6080
+ const makeAppend = values => {
6081
+ const o = Object.create(AppendProto);
6082
+ o.values = values;
6083
+ return o;
6084
+ };
6085
+ const SliceProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
6086
+ _tag: "Slice"
6087
+ });
6088
+ const makeSlice = (from, until) => {
6089
+ const o = Object.create(SliceProto);
6090
+ o.from = from;
6091
+ o.until = until;
6092
+ return o;
6093
+ };
6094
+ const UpdateProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
6095
+ _tag: "Update"
6096
+ });
6097
+ const makeUpdate = (index, patch) => {
6098
+ const o = Object.create(UpdateProto);
6099
+ o.index = index;
6100
+ o.patch = patch;
6101
+ return o;
6102
+ };
5671
6103
  /** @internal */
5672
- const flattenCauseLoop = (causes, flattened) => {
5673
- // eslint-disable-next-line no-constant-condition
5674
- while (1) {
5675
- const [parallel, sequential] = pipe(causes, reduce$5([empty$1(), empty$4()], ([parallel, sequential], cause) => {
5676
- const [par, seq] = evaluateCause(cause);
5677
- return [pipe(parallel, union(par)), pipe(sequential, appendAll(seq))];
5678
- }));
5679
- const updated = size(parallel) > 0 ? pipe(flattened, prepend(parallel)) : flattened;
5680
- if (isEmpty$2(sequential)) {
5681
- return reverse(updated);
6104
+ const diff$1 = options => {
6105
+ let i = 0;
6106
+ let patch = empty$2();
6107
+ while (i < options.oldValue.length && i < options.newValue.length) {
6108
+ const oldElement = options.oldValue[i];
6109
+ const newElement = options.newValue[i];
6110
+ const valuePatch = options.differ.diff(oldElement, newElement);
6111
+ if (!equals(valuePatch, options.differ.empty)) {
6112
+ patch = combine(patch, makeUpdate(i, valuePatch));
5682
6113
  }
5683
- causes = sequential;
5684
- flattened = updated;
6114
+ i = i + 1;
5685
6115
  }
5686
- throw new Error(getBugErrorMessage("Cause.flattenCauseLoop"));
6116
+ if (i < options.oldValue.length) {
6117
+ patch = combine(patch, makeSlice(0, i));
6118
+ }
6119
+ if (i < options.newValue.length) {
6120
+ patch = combine(patch, makeAppend(drop$1(i)(options.newValue)));
6121
+ }
6122
+ return patch;
5687
6123
  };
5688
- // -----------------------------------------------------------------------------
5689
- // Finding
5690
- // -----------------------------------------------------------------------------
5691
6124
  /** @internal */
5692
- const find = /*#__PURE__*/dual(2, (self, pf) => {
5693
- const stack = [self];
5694
- while (stack.length > 0) {
5695
- const item = stack.pop();
5696
- const option = pf(item);
5697
- switch (option._tag) {
5698
- case "None":
5699
- {
5700
- switch (item._tag) {
5701
- case OP_SEQUENTIAL:
5702
- case OP_PARALLEL:
5703
- {
5704
- stack.push(item.right);
5705
- stack.push(item.left);
5706
- break;
5707
- }
5708
- }
5709
- break;
5710
- }
5711
- case "Some":
5712
- {
5713
- return option;
5714
- }
5715
- }
6125
+ const combine = /*#__PURE__*/dual(2, (self, that) => makeAndThen(self, that));
6126
+ /** @internal */
6127
+ const patch$1 = /*#__PURE__*/dual(3, (self, oldValue, differ) => {
6128
+ if (self._tag === "Empty") {
6129
+ return oldValue;
5716
6130
  }
5717
- return none$1();
5718
- });
5719
- // -----------------------------------------------------------------------------
5720
- // Evaluation
5721
- // -----------------------------------------------------------------------------
5722
- /**
5723
- * Takes one step in evaluating a cause, returning a set of causes that fail
5724
- * in parallel and a list of causes that fail sequentially after those causes.
5725
- *
5726
- * @internal
5727
- */
5728
- const evaluateCause = self => {
5729
- let cause = self;
5730
- const stack = [];
5731
- let _parallel = empty$1();
5732
- let _sequential = empty$4();
5733
- while (cause !== undefined) {
5734
- switch (cause._tag) {
5735
- case OP_EMPTY:
5736
- {
5737
- if (stack.length === 0) {
5738
- return [_parallel, _sequential];
5739
- }
5740
- cause = stack.pop();
5741
- break;
5742
- }
5743
- case OP_FAIL:
6131
+ let readonlyArray = oldValue.slice();
6132
+ let patches = of$2(self);
6133
+ while (isNonEmptyArray(patches)) {
6134
+ const head = headNonEmpty$1(patches);
6135
+ const tail = tailNonEmpty$1(patches);
6136
+ switch (head._tag) {
6137
+ case "Empty":
5744
6138
  {
5745
- _parallel = add(_parallel, make$4(cause._tag, cause.error));
5746
- if (stack.length === 0) {
5747
- return [_parallel, _sequential];
5748
- }
5749
- cause = stack.pop();
6139
+ patches = tail;
5750
6140
  break;
5751
6141
  }
5752
- case OP_DIE:
6142
+ case "AndThen":
5753
6143
  {
5754
- _parallel = add(_parallel, make$4(cause._tag, cause.defect));
5755
- if (stack.length === 0) {
5756
- return [_parallel, _sequential];
5757
- }
5758
- cause = stack.pop();
6144
+ tail.unshift(head.first, head.second);
6145
+ patches = tail;
5759
6146
  break;
5760
6147
  }
5761
- case OP_INTERRUPT:
6148
+ case "Append":
5762
6149
  {
5763
- _parallel = add(_parallel, make$4(cause._tag, cause.fiberId));
5764
- if (stack.length === 0) {
5765
- return [_parallel, _sequential];
6150
+ for (const value of head.values) {
6151
+ readonlyArray.push(value);
5766
6152
  }
5767
- cause = stack.pop();
6153
+ patches = tail;
5768
6154
  break;
5769
6155
  }
5770
- case OP_SEQUENTIAL:
6156
+ case "Slice":
5771
6157
  {
5772
- switch (cause.left._tag) {
5773
- case OP_EMPTY:
5774
- {
5775
- cause = cause.right;
5776
- break;
5777
- }
5778
- case OP_SEQUENTIAL:
5779
- {
5780
- cause = sequential(cause.left.left, sequential(cause.left.right, cause.right));
5781
- break;
5782
- }
5783
- case OP_PARALLEL:
5784
- {
5785
- cause = parallel(sequential(cause.left.left, cause.right), sequential(cause.left.right, cause.right));
5786
- break;
5787
- }
5788
- default:
5789
- {
5790
- _sequential = prepend(_sequential, cause.right);
5791
- cause = cause.left;
5792
- break;
5793
- }
5794
- }
6158
+ readonlyArray = readonlyArray.slice(head.from, head.until);
6159
+ patches = tail;
5795
6160
  break;
5796
6161
  }
5797
- case OP_PARALLEL:
6162
+ case "Update":
5798
6163
  {
5799
- stack.push(cause.right);
5800
- cause = cause.left;
6164
+ readonlyArray[head.index] = differ.patch(head.patch, readonlyArray[head.index]);
6165
+ patches = tail;
5801
6166
  break;
5802
6167
  }
5803
6168
  }
5804
6169
  }
5805
- throw new Error(getBugErrorMessage("Cause.evaluateCauseLoop"));
6170
+ return readonlyArray;
6171
+ });
6172
+
6173
+ /** @internal */
6174
+ const DifferTypeId = /*#__PURE__*/Symbol.for("effect/Differ");
6175
+ /** @internal */
6176
+ const DifferProto = {
6177
+ [DifferTypeId]: {
6178
+ _P: identity,
6179
+ _V: identity
6180
+ },
6181
+ pipe() {
6182
+ return pipeArguments(this, arguments);
6183
+ }
5806
6184
  };
5807
6185
  /** @internal */
5808
- const IsInterruptedOnlyCauseReducer = {
5809
- emptyCase: constTrue,
5810
- failCase: constFalse,
5811
- dieCase: constFalse,
5812
- interruptCase: constTrue,
5813
- sequentialCase: (_, left, right) => left && right,
5814
- parallelCase: (_, left, right) => left && right
6186
+ const make$2 = params => {
6187
+ const differ = Object.create(DifferProto);
6188
+ differ.empty = params.empty;
6189
+ differ.diff = params.diff;
6190
+ differ.combine = params.combine;
6191
+ differ.patch = params.patch;
6192
+ return differ;
5815
6193
  };
5816
- const OP_SEQUENTIAL_CASE = "SequentialCase";
5817
- const OP_PARALLEL_CASE = "ParallelCase";
5818
6194
  /** @internal */
5819
- const match = /*#__PURE__*/dual(2, (self, {
5820
- onDie,
5821
- onEmpty,
5822
- onFail,
5823
- onInterrupt,
5824
- onParallel,
5825
- onSequential
5826
- }) => {
5827
- return reduceWithContext(self, void 0, {
5828
- emptyCase: () => onEmpty,
5829
- failCase: (_, error) => onFail(error),
5830
- dieCase: (_, defect) => onDie(defect),
5831
- interruptCase: (_, fiberId) => onInterrupt(fiberId),
5832
- sequentialCase: (_, left, right) => onSequential(left, right),
5833
- parallelCase: (_, left, right) => onParallel(left, right)
5834
- });
6195
+ const environment = () => make$2({
6196
+ empty: empty$4(),
6197
+ combine: (first, second) => combine$2(second)(first),
6198
+ diff: (oldValue, newValue) => diff$3(oldValue, newValue),
6199
+ patch: (patch, oldValue) => patch$3(oldValue)(patch)
5835
6200
  });
5836
6201
  /** @internal */
5837
- const reduce = /*#__PURE__*/dual(3, (self, zero, pf) => {
5838
- let accumulator = zero;
5839
- let cause = self;
5840
- const causes = [];
5841
- while (cause !== undefined) {
5842
- const option = pf(accumulator, cause);
5843
- accumulator = isSome(option) ? option.value : accumulator;
5844
- switch (cause._tag) {
5845
- case OP_SEQUENTIAL:
5846
- {
5847
- causes.push(cause.right);
5848
- cause = cause.left;
5849
- break;
5850
- }
5851
- case OP_PARALLEL:
5852
- {
5853
- causes.push(cause.right);
5854
- cause = cause.left;
5855
- break;
5856
- }
5857
- default:
5858
- {
5859
- cause = undefined;
5860
- break;
5861
- }
6202
+ const hashSet = () => make$2({
6203
+ empty: empty$3(),
6204
+ combine: (first, second) => combine$1(second)(first),
6205
+ diff: (oldValue, newValue) => diff$2(oldValue, newValue),
6206
+ patch: (patch, oldValue) => patch$2(oldValue)(patch)
6207
+ });
6208
+ /** @internal */
6209
+ const readonlyArray = differ => make$2({
6210
+ empty: empty$2(),
6211
+ combine: (first, second) => combine(first, second),
6212
+ diff: (oldValue, newValue) => diff$1({
6213
+ oldValue,
6214
+ newValue,
6215
+ differ
6216
+ }),
6217
+ patch: (patch, oldValue) => patch$1(patch, oldValue, differ)
6218
+ });
6219
+ /** @internal */
6220
+ const update = () => updateWith((_, a) => a);
6221
+ /** @internal */
6222
+ const updateWith = f => make$2({
6223
+ empty: identity,
6224
+ combine: (first, second) => {
6225
+ if (first === identity) {
6226
+ return second;
5862
6227
  }
5863
- if (cause === undefined && causes.length > 0) {
5864
- cause = causes.pop();
6228
+ if (second === identity) {
6229
+ return first;
5865
6230
  }
5866
- }
5867
- return accumulator;
6231
+ return a => second(first(a));
6232
+ },
6233
+ diff: (oldValue, newValue) => {
6234
+ if (equals(oldValue, newValue)) {
6235
+ return identity;
6236
+ }
6237
+ return constant(newValue);
6238
+ },
6239
+ patch: (patch, oldValue) => f(oldValue, patch(oldValue))
5868
6240
  });
6241
+
5869
6242
  /** @internal */
5870
- const reduceWithContext = /*#__PURE__*/dual(3, (self, context, reducer) => {
5871
- const input = [self];
5872
- const output = [];
5873
- while (input.length > 0) {
5874
- const cause = input.pop();
5875
- switch (cause._tag) {
5876
- case OP_EMPTY:
5877
- {
5878
- output.push(right(reducer.emptyCase(context)));
5879
- break;
5880
- }
5881
- case OP_FAIL:
5882
- {
5883
- output.push(right(reducer.failCase(context, cause.error)));
5884
- break;
5885
- }
5886
- case OP_DIE:
5887
- {
5888
- output.push(right(reducer.dieCase(context, cause.defect)));
5889
- break;
5890
- }
5891
- case OP_INTERRUPT:
5892
- {
5893
- output.push(right(reducer.interruptCase(context, cause.fiberId)));
5894
- break;
5895
- }
5896
- case OP_SEQUENTIAL:
5897
- {
5898
- input.push(cause.right);
5899
- input.push(cause.left);
5900
- output.push(left({
5901
- _tag: OP_SEQUENTIAL_CASE
5902
- }));
5903
- break;
5904
- }
5905
- case OP_PARALLEL:
5906
- {
5907
- input.push(cause.right);
5908
- input.push(cause.left);
5909
- output.push(left({
5910
- _tag: OP_PARALLEL_CASE
5911
- }));
5912
- break;
5913
- }
5914
- }
5915
- }
5916
- const accumulator = [];
5917
- while (output.length > 0) {
5918
- const either = output.pop();
5919
- switch (either._tag) {
5920
- case "Left":
5921
- {
5922
- switch (either.left._tag) {
5923
- case OP_SEQUENTIAL_CASE:
5924
- {
5925
- const left = accumulator.pop();
5926
- const right = accumulator.pop();
5927
- const value = reducer.sequentialCase(context, left, right);
5928
- accumulator.push(value);
5929
- break;
5930
- }
5931
- case OP_PARALLEL_CASE:
5932
- {
5933
- const left = accumulator.pop();
5934
- const right = accumulator.pop();
5935
- const value = reducer.parallelCase(context, left, right);
5936
- accumulator.push(value);
5937
- break;
6243
+ const BIT_MASK = 0xff;
6244
+ /** @internal */
6245
+ const BIT_SHIFT = 0x08;
6246
+ /** @internal */
6247
+ const active = patch => patch & BIT_MASK;
6248
+ /** @internal */
6249
+ const enabled = patch => patch >> BIT_SHIFT & BIT_MASK;
6250
+ /** @internal */
6251
+ const make$1 = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6252
+ /** @internal */
6253
+ const empty$1 = /*#__PURE__*/make$1(0, 0);
6254
+ /** @internal */
6255
+ const enable$2 = flag => make$1(flag, flag);
6256
+ /** @internal */
6257
+ const disable$1 = flag => make$1(flag, 0);
6258
+ /** @internal */
6259
+ const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$1(active(self) & ~flag, enabled(self)));
6260
+ /** @internal */
6261
+ const andThen = /*#__PURE__*/dual(2, (self, that) => self | that);
6262
+ /** @internal */
6263
+ const invert = n => ~n >>> 0 & BIT_MASK;
6264
+
6265
+ /** @internal */
6266
+ const None = 0;
6267
+ /** @internal */
6268
+ const Interruption = 1 << 0;
6269
+ /** @internal */
6270
+ const OpSupervision = 1 << 1;
6271
+ /** @internal */
6272
+ const RuntimeMetrics = 1 << 2;
6273
+ /** @internal */
6274
+ const WindDown = 1 << 4;
6275
+ /** @internal */
6276
+ const CooperativeYielding = 1 << 5;
6277
+ /** @internal */
6278
+ const cooperativeYielding = self => isEnabled(self, CooperativeYielding);
6279
+ /** @internal */
6280
+ const enable$1 = /*#__PURE__*/dual(2, (self, flag) => self | flag);
6281
+ /** @internal */
6282
+ const interruptible$2 = self => interruption(self) && !windDown(self);
6283
+ /** @internal */
6284
+ const interruption = self => isEnabled(self, Interruption);
6285
+ /** @internal */
6286
+ const isEnabled = /*#__PURE__*/dual(2, (self, flag) => (self & flag) !== 0);
6287
+ /** @internal */
6288
+ const make = (...flags) => flags.reduce((a, b) => a | b, 0);
6289
+ /** @internal */
6290
+ const none = /*#__PURE__*/make(None);
6291
+ /** @internal */
6292
+ const runtimeMetrics = self => isEnabled(self, RuntimeMetrics);
6293
+ const windDown = self => isEnabled(self, WindDown);
6294
+ /** @internal */
6295
+ const diff = /*#__PURE__*/dual(2, (self, that) => make$1(self ^ that, that));
6296
+ /** @internal */
6297
+ const patch = /*#__PURE__*/dual(2, (self, patch) => self & (invert(active(patch)) | enabled(patch)) | active(patch) & enabled(patch));
6298
+ /** @internal */
6299
+ const differ = /*#__PURE__*/make$2({
6300
+ empty: empty$1,
6301
+ diff: (oldValue, newValue) => diff(oldValue, newValue),
6302
+ combine: (first, second) => andThen(second)(first),
6303
+ patch: (_patch, oldValue) => patch(oldValue, _patch)
6304
+ });
6305
+
6306
+ /**
6307
+ * @since 2.0.0
6308
+ */
6309
+ /**
6310
+ * Creates a `RuntimeFlagsPatch` describing enabling the provided `RuntimeFlag`.
6311
+ *
6312
+ * @since 2.0.0
6313
+ * @category constructors
6314
+ */
6315
+ const enable = enable$2;
6316
+ /**
6317
+ * Creates a `RuntimeFlagsPatch` describing disabling the provided `RuntimeFlag`.
6318
+ *
6319
+ * @since 2.0.0
6320
+ * @category constructors
6321
+ */
6322
+ const disable = disable$1;
6323
+ /**
6324
+ * Creates a `RuntimeFlagsPatch` which describes exclusion of the specified
6325
+ * `RuntimeFlag` from the set of `RuntimeFlags`.
6326
+ *
6327
+ * @category utils
6328
+ * @since 2.0.0
6329
+ */
6330
+ const exclude = exclude$1;
6331
+
6332
+ /** @internal */
6333
+ const OP_DIE = "Die";
6334
+ /** @internal */
6335
+ const OP_EMPTY = "Empty";
6336
+ /** @internal */
6337
+ const OP_FAIL = "Fail";
6338
+ /** @internal */
6339
+ const OP_INTERRUPT = "Interrupt";
6340
+ /** @internal */
6341
+ const OP_PARALLEL = "Parallel";
6342
+ /** @internal */
6343
+ const OP_SEQUENTIAL = "Sequential";
6344
+
6345
+ // -----------------------------------------------------------------------------
6346
+ // Models
6347
+ // -----------------------------------------------------------------------------
6348
+ /** @internal */
6349
+ const CauseSymbolKey = "effect/Cause";
6350
+ /** @internal */
6351
+ const CauseTypeId = /*#__PURE__*/Symbol.for(CauseSymbolKey);
6352
+ const variance = {
6353
+ /* c8 ignore next */
6354
+ _E: _ => _
6355
+ };
6356
+ /** @internal */
6357
+ const proto = {
6358
+ [CauseTypeId]: variance,
6359
+ [symbol$1]() {
6360
+ return pipe(hash(CauseSymbolKey), combine$5(hash(flattenCause(this))), cached(this));
6361
+ },
6362
+ [symbol](that) {
6363
+ return isCause(that) && causeEquals(this, that);
6364
+ },
6365
+ pipe() {
6366
+ return pipeArguments(this, arguments);
6367
+ },
6368
+ toJSON() {
6369
+ switch (this._tag) {
6370
+ case "Empty":
6371
+ return {
6372
+ _id: "Cause",
6373
+ _tag: this._tag
6374
+ };
6375
+ case "Die":
6376
+ return {
6377
+ _id: "Cause",
6378
+ _tag: this._tag,
6379
+ defect: toJSON(this.defect)
6380
+ };
6381
+ case "Interrupt":
6382
+ return {
6383
+ _id: "Cause",
6384
+ _tag: this._tag,
6385
+ fiberId: this.fiberId.toJSON()
6386
+ };
6387
+ case "Fail":
6388
+ return {
6389
+ _id: "Cause",
6390
+ _tag: this._tag,
6391
+ failure: toJSON(this.error)
6392
+ };
6393
+ case "Sequential":
6394
+ case "Parallel":
6395
+ return {
6396
+ _id: "Cause",
6397
+ _tag: this._tag,
6398
+ left: toJSON(this.left),
6399
+ right: toJSON(this.right)
6400
+ };
6401
+ }
6402
+ },
6403
+ toString() {
6404
+ return pretty(this);
6405
+ },
6406
+ [NodeInspectSymbol]() {
6407
+ return this.toJSON();
6408
+ }
6409
+ };
6410
+ // -----------------------------------------------------------------------------
6411
+ // Constructors
6412
+ // -----------------------------------------------------------------------------
6413
+ /** @internal */
6414
+ const empty = /*#__PURE__*/(() => {
6415
+ const o = /*#__PURE__*/Object.create(proto);
6416
+ o._tag = OP_EMPTY;
6417
+ return o;
6418
+ })();
6419
+ /** @internal */
6420
+ const fail$2 = error => {
6421
+ const o = Object.create(proto);
6422
+ o._tag = OP_FAIL;
6423
+ o.error = error;
6424
+ return o;
6425
+ };
6426
+ /** @internal */
6427
+ const die$1 = defect => {
6428
+ const o = Object.create(proto);
6429
+ o._tag = OP_DIE;
6430
+ o.defect = defect;
6431
+ return o;
6432
+ };
6433
+ /** @internal */
6434
+ const interrupt$1 = fiberId => {
6435
+ const o = Object.create(proto);
6436
+ o._tag = OP_INTERRUPT;
6437
+ o.fiberId = fiberId;
6438
+ return o;
6439
+ };
6440
+ /** @internal */
6441
+ const parallel = (left, right) => {
6442
+ const o = Object.create(proto);
6443
+ o._tag = OP_PARALLEL;
6444
+ o.left = left;
6445
+ o.right = right;
6446
+ return o;
6447
+ };
6448
+ /** @internal */
6449
+ const sequential = (left, right) => {
6450
+ const o = Object.create(proto);
6451
+ o._tag = OP_SEQUENTIAL;
6452
+ o.left = left;
6453
+ o.right = right;
6454
+ return o;
6455
+ };
6456
+ // -----------------------------------------------------------------------------
6457
+ // Refinements
6458
+ // -----------------------------------------------------------------------------
6459
+ /** @internal */
6460
+ const isCause = u => hasProperty(u, CauseTypeId);
6461
+ /** @internal */
6462
+ const isEmptyType = self => self._tag === OP_EMPTY;
6463
+ /** @internal */
6464
+ const isDieType = self => self._tag === OP_DIE;
6465
+ /** @internal */
6466
+ const isEmpty = self => {
6467
+ if (self._tag === OP_EMPTY) {
6468
+ return true;
6469
+ }
6470
+ return reduce(self, true, (acc, cause) => {
6471
+ switch (cause._tag) {
6472
+ case OP_EMPTY:
6473
+ {
6474
+ return some(acc);
6475
+ }
6476
+ case OP_DIE:
6477
+ case OP_FAIL:
6478
+ case OP_INTERRUPT:
6479
+ {
6480
+ return some(false);
6481
+ }
6482
+ default:
6483
+ {
6484
+ return none$3();
6485
+ }
6486
+ }
6487
+ });
6488
+ };
6489
+ /** @internal */
6490
+ const isInterrupted = self => isSome(interruptOption(self));
6491
+ /** @internal */
6492
+ const isInterruptedOnly = self => reduceWithContext(undefined, IsInterruptedOnlyCauseReducer)(self);
6493
+ /** @internal */
6494
+ const failures = self => reverse$1(reduce(self, empty$a(), (list, cause) => cause._tag === OP_FAIL ? some(pipe(list, prepend$1(cause.error))) : none$3()));
6495
+ /** @internal */
6496
+ const defects = self => reverse$1(reduce(self, empty$a(), (list, cause) => cause._tag === OP_DIE ? some(pipe(list, prepend$1(cause.defect))) : none$3()));
6497
+ /** @internal */
6498
+ const interruptors = self => reduce(self, empty$7(), (set, cause) => cause._tag === OP_INTERRUPT ? some(pipe(set, add(cause.fiberId))) : none$3());
6499
+ /** @internal */
6500
+ const failureOption = self => find(self, cause => cause._tag === OP_FAIL ? some(cause.error) : none$3());
6501
+ /** @internal */
6502
+ const failureOrCause = self => {
6503
+ const option = failureOption(self);
6504
+ switch (option._tag) {
6505
+ case "None":
6506
+ {
6507
+ // no `E` inside this `Cause`, so it can be safely cast to `never`
6508
+ return right(self);
6509
+ }
6510
+ case "Some":
6511
+ {
6512
+ return left(option.value);
6513
+ }
6514
+ }
6515
+ };
6516
+ /** @internal */
6517
+ const flipCauseOption = self => match(self, {
6518
+ onEmpty: some(empty),
6519
+ onFail: map$6(fail$2),
6520
+ onDie: defect => some(die$1(defect)),
6521
+ onInterrupt: fiberId => some(interrupt$1(fiberId)),
6522
+ onSequential: mergeWith(sequential),
6523
+ onParallel: mergeWith(parallel)
6524
+ });
6525
+ /** @internal */
6526
+ const interruptOption = self => find(self, cause => cause._tag === OP_INTERRUPT ? some(cause.fiberId) : none$3());
6527
+ /** @internal */
6528
+ const stripFailures = self => match(self, {
6529
+ onEmpty: empty,
6530
+ onFail: () => empty,
6531
+ onDie: die$1,
6532
+ onInterrupt: interrupt$1,
6533
+ onSequential: sequential,
6534
+ onParallel: parallel
6535
+ });
6536
+ /** @internal */
6537
+ const electFailures = self => match(self, {
6538
+ onEmpty: empty,
6539
+ onFail: die$1,
6540
+ onDie: die$1,
6541
+ onInterrupt: interrupt$1,
6542
+ onSequential: sequential,
6543
+ onParallel: parallel
6544
+ });
6545
+ /** @internal */
6546
+ const map$1 = /*#__PURE__*/dual(2, (self, f) => flatMap$2(self, e => fail$2(f(e))));
6547
+ // -----------------------------------------------------------------------------
6548
+ // Sequencing
6549
+ // -----------------------------------------------------------------------------
6550
+ /** @internal */
6551
+ const flatMap$2 = /*#__PURE__*/dual(2, (self, f) => match(self, {
6552
+ onEmpty: empty,
6553
+ onFail: error => f(error),
6554
+ onDie: defect => die$1(defect),
6555
+ onInterrupt: fiberId => interrupt$1(fiberId),
6556
+ onSequential: (left, right) => sequential(left, right),
6557
+ onParallel: (left, right) => parallel(left, right)
6558
+ }));
6559
+ /** @internal */
6560
+ const causeEquals = (left, right) => {
6561
+ let leftStack = of$1(left);
6562
+ let rightStack = of$1(right);
6563
+ while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
6564
+ const [leftParallel, leftSequential] = pipe(headNonEmpty(leftStack), reduce([empty$7(), empty$a()], ([parallel, sequential], cause) => {
6565
+ const [par, seq] = evaluateCause(cause);
6566
+ return some([pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))]);
6567
+ }));
6568
+ const [rightParallel, rightSequential] = pipe(headNonEmpty(rightStack), reduce([empty$7(), empty$a()], ([parallel, sequential], cause) => {
6569
+ const [par, seq] = evaluateCause(cause);
6570
+ return some([pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))]);
6571
+ }));
6572
+ if (!equals(leftParallel, rightParallel)) {
6573
+ return false;
6574
+ }
6575
+ leftStack = leftSequential;
6576
+ rightStack = rightSequential;
6577
+ }
6578
+ return true;
6579
+ };
6580
+ // -----------------------------------------------------------------------------
6581
+ // Flattening
6582
+ // -----------------------------------------------------------------------------
6583
+ /**
6584
+ * Flattens a cause to a sequence of sets of causes, where each set represents
6585
+ * causes that fail in parallel and sequential sets represent causes that fail
6586
+ * after each other.
6587
+ *
6588
+ * @internal
6589
+ */
6590
+ const flattenCause = cause => {
6591
+ return flattenCauseLoop(of$1(cause), empty$a());
6592
+ };
6593
+ /** @internal */
6594
+ const flattenCauseLoop = (causes, flattened) => {
6595
+ // eslint-disable-next-line no-constant-condition
6596
+ while (1) {
6597
+ const [parallel, sequential] = pipe(causes, reduce$7([empty$7(), empty$a()], ([parallel, sequential], cause) => {
6598
+ const [par, seq] = evaluateCause(cause);
6599
+ return [pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))];
6600
+ }));
6601
+ const updated = size(parallel) > 0 ? pipe(flattened, prepend$1(parallel)) : flattened;
6602
+ if (isEmpty$3(sequential)) {
6603
+ return reverse$1(updated);
6604
+ }
6605
+ causes = sequential;
6606
+ flattened = updated;
6607
+ }
6608
+ throw new Error(getBugErrorMessage("Cause.flattenCauseLoop"));
6609
+ };
6610
+ // -----------------------------------------------------------------------------
6611
+ // Finding
6612
+ // -----------------------------------------------------------------------------
6613
+ /** @internal */
6614
+ const find = /*#__PURE__*/dual(2, (self, pf) => {
6615
+ const stack = [self];
6616
+ while (stack.length > 0) {
6617
+ const item = stack.pop();
6618
+ const option = pf(item);
6619
+ switch (option._tag) {
6620
+ case "None":
6621
+ {
6622
+ switch (item._tag) {
6623
+ case OP_SEQUENTIAL:
6624
+ case OP_PARALLEL:
6625
+ {
6626
+ stack.push(item.right);
6627
+ stack.push(item.left);
6628
+ break;
6629
+ }
6630
+ }
6631
+ break;
6632
+ }
6633
+ case "Some":
6634
+ {
6635
+ return option;
6636
+ }
6637
+ }
6638
+ }
6639
+ return none$3();
6640
+ });
6641
+ // -----------------------------------------------------------------------------
6642
+ // Evaluation
6643
+ // -----------------------------------------------------------------------------
6644
+ /**
6645
+ * Takes one step in evaluating a cause, returning a set of causes that fail
6646
+ * in parallel and a list of causes that fail sequentially after those causes.
6647
+ *
6648
+ * @internal
6649
+ */
6650
+ const evaluateCause = self => {
6651
+ let cause = self;
6652
+ const stack = [];
6653
+ let _parallel = empty$7();
6654
+ let _sequential = empty$a();
6655
+ while (cause !== undefined) {
6656
+ switch (cause._tag) {
6657
+ case OP_EMPTY:
6658
+ {
6659
+ if (stack.length === 0) {
6660
+ return [_parallel, _sequential];
6661
+ }
6662
+ cause = stack.pop();
6663
+ break;
6664
+ }
6665
+ case OP_FAIL:
6666
+ {
6667
+ _parallel = add(_parallel, make$7(cause._tag, cause.error));
6668
+ if (stack.length === 0) {
6669
+ return [_parallel, _sequential];
6670
+ }
6671
+ cause = stack.pop();
6672
+ break;
6673
+ }
6674
+ case OP_DIE:
6675
+ {
6676
+ _parallel = add(_parallel, make$7(cause._tag, cause.defect));
6677
+ if (stack.length === 0) {
6678
+ return [_parallel, _sequential];
6679
+ }
6680
+ cause = stack.pop();
6681
+ break;
6682
+ }
6683
+ case OP_INTERRUPT:
6684
+ {
6685
+ _parallel = add(_parallel, make$7(cause._tag, cause.fiberId));
6686
+ if (stack.length === 0) {
6687
+ return [_parallel, _sequential];
6688
+ }
6689
+ cause = stack.pop();
6690
+ break;
6691
+ }
6692
+ case OP_SEQUENTIAL:
6693
+ {
6694
+ switch (cause.left._tag) {
6695
+ case OP_EMPTY:
6696
+ {
6697
+ cause = cause.right;
6698
+ break;
6699
+ }
6700
+ case OP_SEQUENTIAL:
6701
+ {
6702
+ cause = sequential(cause.left.left, sequential(cause.left.right, cause.right));
6703
+ break;
6704
+ }
6705
+ case OP_PARALLEL:
6706
+ {
6707
+ cause = parallel(sequential(cause.left.left, cause.right), sequential(cause.left.right, cause.right));
6708
+ break;
6709
+ }
6710
+ default:
6711
+ {
6712
+ _sequential = prepend$1(_sequential, cause.right);
6713
+ cause = cause.left;
6714
+ break;
6715
+ }
6716
+ }
6717
+ break;
6718
+ }
6719
+ case OP_PARALLEL:
6720
+ {
6721
+ stack.push(cause.right);
6722
+ cause = cause.left;
6723
+ break;
6724
+ }
6725
+ }
6726
+ }
6727
+ throw new Error(getBugErrorMessage("Cause.evaluateCauseLoop"));
6728
+ };
6729
+ /** @internal */
6730
+ const IsInterruptedOnlyCauseReducer = {
6731
+ emptyCase: constTrue,
6732
+ failCase: constFalse,
6733
+ dieCase: constFalse,
6734
+ interruptCase: constTrue,
6735
+ sequentialCase: (_, left, right) => left && right,
6736
+ parallelCase: (_, left, right) => left && right
6737
+ };
6738
+ const OP_SEQUENTIAL_CASE = "SequentialCase";
6739
+ const OP_PARALLEL_CASE = "ParallelCase";
6740
+ /** @internal */
6741
+ const match = /*#__PURE__*/dual(2, (self, {
6742
+ onDie,
6743
+ onEmpty,
6744
+ onFail,
6745
+ onInterrupt,
6746
+ onParallel,
6747
+ onSequential
6748
+ }) => {
6749
+ return reduceWithContext(self, void 0, {
6750
+ emptyCase: () => onEmpty,
6751
+ failCase: (_, error) => onFail(error),
6752
+ dieCase: (_, defect) => onDie(defect),
6753
+ interruptCase: (_, fiberId) => onInterrupt(fiberId),
6754
+ sequentialCase: (_, left, right) => onSequential(left, right),
6755
+ parallelCase: (_, left, right) => onParallel(left, right)
6756
+ });
6757
+ });
6758
+ /** @internal */
6759
+ const reduce = /*#__PURE__*/dual(3, (self, zero, pf) => {
6760
+ let accumulator = zero;
6761
+ let cause = self;
6762
+ const causes = [];
6763
+ while (cause !== undefined) {
6764
+ const option = pf(accumulator, cause);
6765
+ accumulator = isSome(option) ? option.value : accumulator;
6766
+ switch (cause._tag) {
6767
+ case OP_SEQUENTIAL:
6768
+ {
6769
+ causes.push(cause.right);
6770
+ cause = cause.left;
6771
+ break;
6772
+ }
6773
+ case OP_PARALLEL:
6774
+ {
6775
+ causes.push(cause.right);
6776
+ cause = cause.left;
6777
+ break;
6778
+ }
6779
+ default:
6780
+ {
6781
+ cause = undefined;
6782
+ break;
6783
+ }
6784
+ }
6785
+ if (cause === undefined && causes.length > 0) {
6786
+ cause = causes.pop();
6787
+ }
6788
+ }
6789
+ return accumulator;
6790
+ });
6791
+ /** @internal */
6792
+ const reduceWithContext = /*#__PURE__*/dual(3, (self, context, reducer) => {
6793
+ const input = [self];
6794
+ const output = [];
6795
+ while (input.length > 0) {
6796
+ const cause = input.pop();
6797
+ switch (cause._tag) {
6798
+ case OP_EMPTY:
6799
+ {
6800
+ output.push(right(reducer.emptyCase(context)));
6801
+ break;
6802
+ }
6803
+ case OP_FAIL:
6804
+ {
6805
+ output.push(right(reducer.failCase(context, cause.error)));
6806
+ break;
6807
+ }
6808
+ case OP_DIE:
6809
+ {
6810
+ output.push(right(reducer.dieCase(context, cause.defect)));
6811
+ break;
6812
+ }
6813
+ case OP_INTERRUPT:
6814
+ {
6815
+ output.push(right(reducer.interruptCase(context, cause.fiberId)));
6816
+ break;
6817
+ }
6818
+ case OP_SEQUENTIAL:
6819
+ {
6820
+ input.push(cause.right);
6821
+ input.push(cause.left);
6822
+ output.push(left({
6823
+ _tag: OP_SEQUENTIAL_CASE
6824
+ }));
6825
+ break;
6826
+ }
6827
+ case OP_PARALLEL:
6828
+ {
6829
+ input.push(cause.right);
6830
+ input.push(cause.left);
6831
+ output.push(left({
6832
+ _tag: OP_PARALLEL_CASE
6833
+ }));
6834
+ break;
6835
+ }
6836
+ }
6837
+ }
6838
+ const accumulator = [];
6839
+ while (output.length > 0) {
6840
+ const either = output.pop();
6841
+ switch (either._tag) {
6842
+ case "Left":
6843
+ {
6844
+ switch (either.left._tag) {
6845
+ case OP_SEQUENTIAL_CASE:
6846
+ {
6847
+ const left = accumulator.pop();
6848
+ const right = accumulator.pop();
6849
+ const value = reducer.sequentialCase(context, left, right);
6850
+ accumulator.push(value);
6851
+ break;
6852
+ }
6853
+ case OP_PARALLEL_CASE:
6854
+ {
6855
+ const left = accumulator.pop();
6856
+ const right = accumulator.pop();
6857
+ const value = reducer.parallelCase(context, left, right);
6858
+ accumulator.push(value);
6859
+ break;
5938
6860
  }
5939
6861
  }
5940
6862
  break;
5941
6863
  }
5942
6864
  case "Right":
5943
6865
  {
5944
- accumulator.push(either.right);
5945
- break;
6866
+ accumulator.push(either.right);
6867
+ break;
6868
+ }
6869
+ }
6870
+ }
6871
+ if (accumulator.length === 0) {
6872
+ throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");
6873
+ }
6874
+ return accumulator.pop();
6875
+ });
6876
+ // -----------------------------------------------------------------------------
6877
+ // Pretty Printing
6878
+ // -----------------------------------------------------------------------------
6879
+ /** @internal */
6880
+ const pretty = (cause, options) => {
6881
+ if (isInterruptedOnly(cause)) {
6882
+ return "All fibers interrupted without errors.";
6883
+ }
6884
+ return prettyErrors(cause).map(function (e) {
6885
+ if (options?.renderErrorCause !== true || e.cause === undefined) {
6886
+ return e.stack;
6887
+ }
6888
+ return `${e.stack} {\n${renderErrorCause(e.cause, " ")}\n}`;
6889
+ }).join("\n");
6890
+ };
6891
+ const renderErrorCause = (cause, prefix) => {
6892
+ const lines = cause.stack.split("\n");
6893
+ let stack = `${prefix}[cause]: ${lines[0]}`;
6894
+ for (let i = 1, len = lines.length; i < len; i++) {
6895
+ stack += `\n${prefix}${lines[i]}`;
6896
+ }
6897
+ if (cause.cause) {
6898
+ stack += ` {\n${renderErrorCause(cause.cause, `${prefix} `)}\n${prefix}}`;
6899
+ }
6900
+ return stack;
6901
+ };
6902
+ /** @internal */
6903
+ const makePrettyError = originalError => {
6904
+ const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
6905
+ const prevLimit = Error.stackTraceLimit;
6906
+ Error.stackTraceLimit = 1;
6907
+ const error = new Error(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
6908
+ cause: makePrettyError(originalError.cause)
6909
+ } : undefined);
6910
+ Error.stackTraceLimit = prevLimit;
6911
+ if (error.message === "") {
6912
+ error.message = "An error has occurred";
6913
+ }
6914
+ Error.stackTraceLimit = prevLimit;
6915
+ error.name = originalError instanceof Error ? originalError.name : "Error";
6916
+ if (originalErrorIsObject) {
6917
+ if (spanSymbol in originalError) {
6918
+ error.span = originalError[spanSymbol];
6919
+ }
6920
+ Object.keys(originalError).forEach(key => {
6921
+ if (!(key in error)) {
6922
+ // @ts-expect-error
6923
+ error[key] = originalError[key];
6924
+ }
6925
+ });
6926
+ }
6927
+ error.stack = prettyErrorStack(`${error.name}: ${error.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", error.span);
6928
+ return error;
6929
+ };
6930
+ /**
6931
+ * A utility function for generating human-readable error messages from a generic error of type `unknown`.
6932
+ *
6933
+ * Rules:
6934
+ *
6935
+ * 1) If the input `u` is already a string, it's considered a message.
6936
+ * 2) If `u` is an Error instance with a message defined, it uses the message.
6937
+ * 3) If `u` has a user-defined `toString()` method, it uses that method.
6938
+ * 4) Otherwise, it uses `Inspectable.stringifyCircular` to produce a string representation and uses it as the error message,
6939
+ * with "Error" added as a prefix.
6940
+ *
6941
+ * @internal
6942
+ */
6943
+ const prettyErrorMessage = u => {
6944
+ // 1)
6945
+ if (typeof u === "string") {
6946
+ return u;
6947
+ }
6948
+ // 2)
6949
+ if (typeof u === "object" && u !== null && u instanceof Error) {
6950
+ return u.message;
6951
+ }
6952
+ // 3)
6953
+ try {
6954
+ if (hasProperty(u, "toString") && isFunction(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
6955
+ return u["toString"]();
6956
+ }
6957
+ } catch {
6958
+ // something's off, rollback to json
6959
+ }
6960
+ // 4)
6961
+ return stringifyCircular(u);
6962
+ };
6963
+ const locationRegex = /\((.*)\)/g;
6964
+ /** @internal */
6965
+ const spanToTrace = /*#__PURE__*/globalValue("effect/Tracer/spanToTrace", () => new WeakMap());
6966
+ const prettyErrorStack = (message, stack, span) => {
6967
+ const out = [message];
6968
+ const lines = stack.startsWith(message) ? stack.slice(message.length).split("\n") : stack.split("\n");
6969
+ for (let i = 1; i < lines.length; i++) {
6970
+ if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
6971
+ i++;
6972
+ continue;
6973
+ }
6974
+ if (lines[i].includes("Generator.next")) {
6975
+ break;
6976
+ }
6977
+ if (lines[i].includes("effect_internal_function")) {
6978
+ break;
6979
+ }
6980
+ out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>"));
6981
+ }
6982
+ if (span) {
6983
+ let current = span;
6984
+ let i = 0;
6985
+ while (current && current._tag === "Span" && i < 10) {
6986
+ const stackFn = spanToTrace.get(current);
6987
+ if (typeof stackFn === "function") {
6988
+ const stack = stackFn();
6989
+ if (typeof stack === "string") {
6990
+ const locationMatchAll = stack.matchAll(locationRegex);
6991
+ let match = false;
6992
+ for (const [, location] of locationMatchAll) {
6993
+ match = true;
6994
+ out.push(` at ${current.name} (${location})`);
6995
+ }
6996
+ if (!match) {
6997
+ out.push(` at ${current.name} (${stack.replace(/^at /, "")})`);
6998
+ }
6999
+ } else {
7000
+ out.push(` at ${current.name}`);
7001
+ }
7002
+ } else {
7003
+ out.push(` at ${current.name}`);
7004
+ }
7005
+ current = getOrUndefined(current.parent);
7006
+ i++;
7007
+ }
7008
+ }
7009
+ return out.join("\n");
7010
+ };
7011
+ /** @internal */
7012
+ const spanSymbol = /*#__PURE__*/Symbol.for("effect/SpanAnnotation");
7013
+ /** @internal */
7014
+ const prettyErrors = cause => reduceWithContext(cause, void 0, {
7015
+ emptyCase: () => [],
7016
+ dieCase: (_, unknownError) => {
7017
+ return [makePrettyError(unknownError)];
7018
+ },
7019
+ failCase: (_, error) => {
7020
+ return [makePrettyError(error)];
7021
+ },
7022
+ interruptCase: () => [],
7023
+ parallelCase: (_, l, r) => [...l, ...r],
7024
+ sequentialCase: (_, l, r) => [...l, ...r]
7025
+ });
7026
+
7027
+ /** @internal */
7028
+ const OP_STATE_PENDING = "Pending";
7029
+ /** @internal */
7030
+ const OP_STATE_DONE = "Done";
7031
+
7032
+ /** @internal */
7033
+ const DeferredSymbolKey = "effect/Deferred";
7034
+ /** @internal */
7035
+ const DeferredTypeId = /*#__PURE__*/Symbol.for(DeferredSymbolKey);
7036
+ /** @internal */
7037
+ const deferredVariance = {
7038
+ /* c8 ignore next */
7039
+ _E: _ => _,
7040
+ /* c8 ignore next */
7041
+ _A: _ => _
7042
+ };
7043
+ /** @internal */
7044
+ const pending = joiners => {
7045
+ return {
7046
+ _tag: OP_STATE_PENDING,
7047
+ joiners
7048
+ };
7049
+ };
7050
+ /** @internal */
7051
+ const done = effect => {
7052
+ return {
7053
+ _tag: OP_STATE_DONE,
7054
+ effect
7055
+ };
7056
+ };
7057
+
7058
+ /** @internal */
7059
+ class SingleShotGen {
7060
+ self;
7061
+ called = false;
7062
+ constructor(self) {
7063
+ this.self = self;
7064
+ }
7065
+ next(a) {
7066
+ return this.called ? {
7067
+ value: a,
7068
+ done: true
7069
+ } : (this.called = true, {
7070
+ value: this.self,
7071
+ done: false
7072
+ });
7073
+ }
7074
+ return(a) {
7075
+ return {
7076
+ value: a,
7077
+ done: true
7078
+ };
7079
+ }
7080
+ throw(e) {
7081
+ throw e;
7082
+ }
7083
+ [Symbol.iterator]() {
7084
+ return new SingleShotGen(this.self);
7085
+ }
7086
+ }
7087
+
7088
+ // -----------------------------------------------------------------------------
7089
+ // Effect
7090
+ // -----------------------------------------------------------------------------
7091
+ /**
7092
+ * @internal
7093
+ */
7094
+ const blocked = (blockedRequests, _continue) => {
7095
+ const effect = new EffectPrimitive("Blocked");
7096
+ effect.effect_instruction_i0 = blockedRequests;
7097
+ effect.effect_instruction_i1 = _continue;
7098
+ return effect;
7099
+ };
7100
+ /**
7101
+ * @internal
7102
+ */
7103
+ const runRequestBlock = blockedRequests => {
7104
+ const effect = new EffectPrimitive("RunBlocked");
7105
+ effect.effect_instruction_i0 = blockedRequests;
7106
+ return effect;
7107
+ };
7108
+ /** @internal */
7109
+ const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
7110
+ /** @internal */
7111
+ class RevertFlags {
7112
+ patch;
7113
+ op;
7114
+ _op = OP_REVERT_FLAGS;
7115
+ constructor(patch, op) {
7116
+ this.patch = patch;
7117
+ this.op = op;
7118
+ }
7119
+ }
7120
+ class EffectPrimitive {
7121
+ _op;
7122
+ effect_instruction_i0 = undefined;
7123
+ effect_instruction_i1 = undefined;
7124
+ effect_instruction_i2 = undefined;
7125
+ trace = undefined;
7126
+ [EffectTypeId] = effectVariance;
7127
+ constructor(_op) {
7128
+ this._op = _op;
7129
+ }
7130
+ [symbol](that) {
7131
+ return this === that;
7132
+ }
7133
+ [symbol$1]() {
7134
+ return cached(this, random(this));
7135
+ }
7136
+ pipe() {
7137
+ return pipeArguments(this, arguments);
7138
+ }
7139
+ toJSON() {
7140
+ return {
7141
+ _id: "Effect",
7142
+ _op: this._op,
7143
+ effect_instruction_i0: toJSON(this.effect_instruction_i0),
7144
+ effect_instruction_i1: toJSON(this.effect_instruction_i1),
7145
+ effect_instruction_i2: toJSON(this.effect_instruction_i2)
7146
+ };
7147
+ }
7148
+ toString() {
7149
+ return format$1(this.toJSON());
7150
+ }
7151
+ [NodeInspectSymbol]() {
7152
+ return this.toJSON();
7153
+ }
7154
+ [Symbol.iterator]() {
7155
+ return new SingleShotGen(new YieldWrap(this));
7156
+ }
7157
+ }
7158
+ /** @internal */
7159
+ class EffectPrimitiveFailure {
7160
+ _op;
7161
+ effect_instruction_i0 = undefined;
7162
+ effect_instruction_i1 = undefined;
7163
+ effect_instruction_i2 = undefined;
7164
+ trace = undefined;
7165
+ [EffectTypeId] = effectVariance;
7166
+ constructor(_op) {
7167
+ this._op = _op;
7168
+ // @ts-expect-error
7169
+ this._tag = _op;
7170
+ }
7171
+ [symbol](that) {
7172
+ return exitIsExit(that) && that._op === "Failure" &&
7173
+ // @ts-expect-error
7174
+ equals(this.effect_instruction_i0, that.effect_instruction_i0);
7175
+ }
7176
+ [symbol$1]() {
7177
+ return pipe(
7178
+ // @ts-expect-error
7179
+ string(this._tag),
7180
+ // @ts-expect-error
7181
+ combine$5(hash(this.effect_instruction_i0)), cached(this));
7182
+ }
7183
+ get cause() {
7184
+ return this.effect_instruction_i0;
7185
+ }
7186
+ pipe() {
7187
+ return pipeArguments(this, arguments);
7188
+ }
7189
+ toJSON() {
7190
+ return {
7191
+ _id: "Exit",
7192
+ _tag: this._op,
7193
+ cause: this.cause.toJSON()
7194
+ };
7195
+ }
7196
+ toString() {
7197
+ return format$1(this.toJSON());
7198
+ }
7199
+ [NodeInspectSymbol]() {
7200
+ return this.toJSON();
7201
+ }
7202
+ [Symbol.iterator]() {
7203
+ return new SingleShotGen(new YieldWrap(this));
7204
+ }
7205
+ }
7206
+ /** @internal */
7207
+ class EffectPrimitiveSuccess {
7208
+ _op;
7209
+ effect_instruction_i0 = undefined;
7210
+ effect_instruction_i1 = undefined;
7211
+ effect_instruction_i2 = undefined;
7212
+ trace = undefined;
7213
+ [EffectTypeId] = effectVariance;
7214
+ constructor(_op) {
7215
+ this._op = _op;
7216
+ // @ts-expect-error
7217
+ this._tag = _op;
7218
+ }
7219
+ [symbol](that) {
7220
+ return exitIsExit(that) && that._op === "Success" &&
7221
+ // @ts-expect-error
7222
+ equals(this.effect_instruction_i0, that.effect_instruction_i0);
7223
+ }
7224
+ [symbol$1]() {
7225
+ return pipe(
7226
+ // @ts-expect-error
7227
+ string(this._tag),
7228
+ // @ts-expect-error
7229
+ combine$5(hash(this.effect_instruction_i0)), cached(this));
7230
+ }
7231
+ get value() {
7232
+ return this.effect_instruction_i0;
7233
+ }
7234
+ pipe() {
7235
+ return pipeArguments(this, arguments);
7236
+ }
7237
+ toJSON() {
7238
+ return {
7239
+ _id: "Exit",
7240
+ _tag: this._op,
7241
+ value: toJSON(this.value)
7242
+ };
7243
+ }
7244
+ toString() {
7245
+ return format$1(this.toJSON());
7246
+ }
7247
+ [NodeInspectSymbol]() {
7248
+ return this.toJSON();
7249
+ }
7250
+ [Symbol.iterator]() {
7251
+ return new SingleShotGen(new YieldWrap(this));
7252
+ }
7253
+ }
7254
+ /** @internal */
7255
+ const isEffect = u => hasProperty(u, EffectTypeId);
7256
+ /* @internal */
7257
+ const withFiberRuntime = withRuntime => {
7258
+ const effect = new EffectPrimitive(OP_WITH_RUNTIME);
7259
+ effect.effect_instruction_i0 = withRuntime;
7260
+ return effect;
7261
+ };
7262
+ /* @internal */
7263
+ const acquireUseRelease = /*#__PURE__*/dual(3, (acquire, use, release) => uninterruptibleMask$1(restore => flatMap$1(acquire, a => flatMap$1(exit(suspend$1(() => restore(use(a)))), exit => {
7264
+ return suspend$1(() => release(a, exit)).pipe(matchCauseEffect$1({
7265
+ onFailure: cause => {
7266
+ switch (exit._tag) {
7267
+ case OP_FAILURE:
7268
+ return failCause$1(sequential(exit.effect_instruction_i0, cause));
7269
+ case OP_SUCCESS:
7270
+ return failCause$1(cause);
7271
+ }
7272
+ },
7273
+ onSuccess: () => exit
7274
+ }));
7275
+ }))));
7276
+ /* @internal */
7277
+ const as = /*#__PURE__*/dual(2, (self, value) => flatMap$1(self, () => succeed$1(value)));
7278
+ /* @internal */
7279
+ const asVoid = self => as(self, void 0);
7280
+ /* @internal */
7281
+ const custom = function () {
7282
+ const wrapper = new EffectPrimitive(OP_COMMIT);
7283
+ switch (arguments.length) {
7284
+ case 2:
7285
+ {
7286
+ wrapper.effect_instruction_i0 = arguments[0];
7287
+ wrapper.commit = arguments[1];
7288
+ break;
7289
+ }
7290
+ case 3:
7291
+ {
7292
+ wrapper.effect_instruction_i0 = arguments[0];
7293
+ wrapper.effect_instruction_i1 = arguments[1];
7294
+ wrapper.commit = arguments[2];
7295
+ break;
7296
+ }
7297
+ case 4:
7298
+ {
7299
+ wrapper.effect_instruction_i0 = arguments[0];
7300
+ wrapper.effect_instruction_i1 = arguments[1];
7301
+ wrapper.effect_instruction_i2 = arguments[2];
7302
+ wrapper.commit = arguments[3];
7303
+ break;
7304
+ }
7305
+ default:
7306
+ {
7307
+ throw new Error(getBugErrorMessage("you're not supposed to end up here"));
7308
+ }
7309
+ }
7310
+ return wrapper;
7311
+ };
7312
+ /* @internal */
7313
+ const unsafeAsync = (register, blockingOn = none$1) => {
7314
+ const effect = new EffectPrimitive(OP_ASYNC);
7315
+ let cancelerRef = undefined;
7316
+ effect.effect_instruction_i0 = resume => {
7317
+ cancelerRef = register(resume);
7318
+ };
7319
+ effect.effect_instruction_i1 = blockingOn;
7320
+ return onInterrupt(effect, _ => isEffect(cancelerRef) ? cancelerRef : void_$1);
7321
+ };
7322
+ /* @internal */
7323
+ const asyncInterrupt = (register, blockingOn = none$1) => suspend$1(() => unsafeAsync(register, blockingOn));
7324
+ const async_ = (resume, blockingOn = none$1) => {
7325
+ return custom(resume, function () {
7326
+ let backingResume = undefined;
7327
+ let pendingEffect = undefined;
7328
+ function proxyResume(effect) {
7329
+ if (backingResume) {
7330
+ backingResume(effect);
7331
+ } else if (pendingEffect === undefined) {
7332
+ pendingEffect = effect;
7333
+ }
7334
+ }
7335
+ const effect = new EffectPrimitive(OP_ASYNC);
7336
+ effect.effect_instruction_i0 = resume => {
7337
+ backingResume = resume;
7338
+ if (pendingEffect) {
7339
+ resume(pendingEffect);
7340
+ }
7341
+ };
7342
+ effect.effect_instruction_i1 = blockingOn;
7343
+ let cancelerRef = undefined;
7344
+ let controllerRef = undefined;
7345
+ if (this.effect_instruction_i0.length !== 1) {
7346
+ controllerRef = new AbortController();
7347
+ cancelerRef = internalCall(() => this.effect_instruction_i0(proxyResume, controllerRef.signal));
7348
+ } else {
7349
+ cancelerRef = internalCall(() => this.effect_instruction_i0(proxyResume));
7350
+ }
7351
+ return cancelerRef || controllerRef ? onInterrupt(effect, _ => {
7352
+ if (controllerRef) {
7353
+ controllerRef.abort();
7354
+ }
7355
+ return cancelerRef ?? void_$1;
7356
+ }) : effect;
7357
+ });
7358
+ };
7359
+ /* @internal */
7360
+ const catchAllCause = /*#__PURE__*/dual(2, (self, f) => {
7361
+ const effect = new EffectPrimitive(OP_ON_FAILURE);
7362
+ effect.effect_instruction_i0 = self;
7363
+ effect.effect_instruction_i1 = f;
7364
+ return effect;
7365
+ });
7366
+ /* @internal */
7367
+ const catchAll = /*#__PURE__*/dual(2, (self, f) => matchEffect(self, {
7368
+ onFailure: f,
7369
+ onSuccess: succeed$1
7370
+ }));
7371
+ const originalSymbol = /*#__PURE__*/Symbol.for("effect/OriginalAnnotation");
7372
+ /* @internal */
7373
+ const capture = (obj, span) => {
7374
+ if (isSome(span)) {
7375
+ return new Proxy(obj, {
7376
+ has(target, p) {
7377
+ return p === spanSymbol || p === originalSymbol || p in target;
7378
+ },
7379
+ get(target, p) {
7380
+ if (p === spanSymbol) {
7381
+ return span.value;
7382
+ }
7383
+ if (p === originalSymbol) {
7384
+ return obj;
7385
+ }
7386
+ // @ts-expect-error
7387
+ return target[p];
7388
+ }
7389
+ });
7390
+ }
7391
+ return obj;
7392
+ };
7393
+ /* @internal */
7394
+ const die = defect => isObject(defect) && !(spanSymbol in defect) ? withFiberRuntime(fiber => failCause$1(die$1(capture(defect, currentSpanFromFiber(fiber))))) : failCause$1(die$1(defect));
7395
+ /* @internal */
7396
+ const dieMessage = message => failCauseSync(() => die$1(new RuntimeException(message)));
7397
+ /* @internal */
7398
+ const either = self => matchEffect(self, {
7399
+ onFailure: e => succeed$1(left(e)),
7400
+ onSuccess: a => succeed$1(right(a))
7401
+ });
7402
+ /* @internal */
7403
+ const exit = self => matchCause(self, {
7404
+ onFailure: exitFailCause$1,
7405
+ onSuccess: exitSucceed$1
7406
+ });
7407
+ /* @internal */
7408
+ const fail$1 = error => isObject(error) && !(spanSymbol in error) ? withFiberRuntime(fiber => failCause$1(fail$2(capture(error, currentSpanFromFiber(fiber))))) : failCause$1(fail$2(error));
7409
+ /* @internal */
7410
+ const failSync = evaluate => flatMap$1(sync(evaluate), fail$1);
7411
+ /* @internal */
7412
+ const failCause$1 = cause => {
7413
+ const effect = new EffectPrimitiveFailure(OP_FAILURE);
7414
+ effect.effect_instruction_i0 = cause;
7415
+ return effect;
7416
+ };
7417
+ /* @internal */
7418
+ const failCauseSync = evaluate => flatMap$1(sync(evaluate), failCause$1);
7419
+ /* @internal */
7420
+ const fiberId = /*#__PURE__*/withFiberRuntime(state => succeed$1(state.id()));
7421
+ /* @internal */
7422
+ const fiberIdWith = f => withFiberRuntime(state => f(state.id()));
7423
+ /* @internal */
7424
+ const flatMap$1 = /*#__PURE__*/dual(2, (self, f) => {
7425
+ const effect = new EffectPrimitive(OP_ON_SUCCESS);
7426
+ effect.effect_instruction_i0 = self;
7427
+ effect.effect_instruction_i1 = f;
7428
+ return effect;
7429
+ });
7430
+ /* @internal */
7431
+ const step = self => {
7432
+ const effect = new EffectPrimitive("OnStep");
7433
+ effect.effect_instruction_i0 = self;
7434
+ return effect;
7435
+ };
7436
+ /* @internal */
7437
+ const flatten = self => flatMap$1(self, identity);
7438
+ /* @internal */
7439
+ const matchCause = /*#__PURE__*/dual(2, (self, options) => matchCauseEffect$1(self, {
7440
+ onFailure: cause => succeed$1(options.onFailure(cause)),
7441
+ onSuccess: a => succeed$1(options.onSuccess(a))
7442
+ }));
7443
+ /* @internal */
7444
+ const matchCauseEffect$1 = /*#__PURE__*/dual(2, (self, options) => {
7445
+ const effect = new EffectPrimitive(OP_ON_SUCCESS_AND_FAILURE);
7446
+ effect.effect_instruction_i0 = self;
7447
+ effect.effect_instruction_i1 = options.onFailure;
7448
+ effect.effect_instruction_i2 = options.onSuccess;
7449
+ return effect;
7450
+ });
7451
+ /* @internal */
7452
+ const matchEffect = /*#__PURE__*/dual(2, (self, options) => matchCauseEffect$1(self, {
7453
+ onFailure: cause => {
7454
+ const defects$1 = defects(cause);
7455
+ if (defects$1.length > 0) {
7456
+ return failCause$1(electFailures(cause));
7457
+ }
7458
+ const failures$1 = failures(cause);
7459
+ if (failures$1.length > 0) {
7460
+ return options.onFailure(unsafeHead(failures$1));
7461
+ }
7462
+ return failCause$1(cause);
7463
+ },
7464
+ onSuccess: options.onSuccess
7465
+ }));
7466
+ /* @internal */
7467
+ const forEachSequential = /*#__PURE__*/dual(2, (self, f) => suspend$1(() => {
7468
+ const arr = fromIterable$5(self);
7469
+ const ret = allocate(arr.length);
7470
+ let i = 0;
7471
+ return as(whileLoop({
7472
+ while: () => i < arr.length,
7473
+ body: () => f(arr[i], i),
7474
+ step: b => {
7475
+ ret[i++] = b;
7476
+ }
7477
+ }), ret);
7478
+ }));
7479
+ /* @internal */
7480
+ const forEachSequentialDiscard = /*#__PURE__*/dual(2, (self, f) => suspend$1(() => {
7481
+ const arr = fromIterable$5(self);
7482
+ let i = 0;
7483
+ return whileLoop({
7484
+ while: () => i < arr.length,
7485
+ body: () => f(arr[i], i),
7486
+ step: () => {
7487
+ i++;
7488
+ }
7489
+ });
7490
+ }));
7491
+ /* @internal */
7492
+ const interrupt = /*#__PURE__*/flatMap$1(fiberId, fiberId => interruptWith(fiberId));
7493
+ /* @internal */
7494
+ const interruptWith = fiberId => failCause$1(interrupt$1(fiberId));
7495
+ /* @internal */
7496
+ const interruptible$1 = self => {
7497
+ const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
7498
+ effect.effect_instruction_i0 = enable(Interruption);
7499
+ effect.effect_instruction_i1 = () => self;
7500
+ return effect;
7501
+ };
7502
+ /* @internal */
7503
+ const intoDeferred = /*#__PURE__*/dual(2, (self, deferred) => uninterruptibleMask$1(restore => flatMap$1(exit(restore(self)), exit => deferredDone(deferred, exit))));
7504
+ /* @internal */
7505
+ const map = /*#__PURE__*/dual(2, (self, f) => flatMap$1(self, a => sync(() => f(a))));
7506
+ /* @internal */
7507
+ const mapBoth = /*#__PURE__*/dual(2, (self, options) => matchEffect(self, {
7508
+ onFailure: e => failSync(() => options.onFailure(e)),
7509
+ onSuccess: a => sync(() => options.onSuccess(a))
7510
+ }));
7511
+ /* @internal */
7512
+ const mapError = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
7513
+ onFailure: cause => {
7514
+ const either = failureOrCause(cause);
7515
+ switch (either._tag) {
7516
+ case "Left":
7517
+ {
7518
+ return failSync(() => f(either.left));
7519
+ }
7520
+ case "Right":
7521
+ {
7522
+ return failCause$1(either.right);
5946
7523
  }
5947
7524
  }
7525
+ },
7526
+ onSuccess: succeed$1
7527
+ }));
7528
+ /* @internal */
7529
+ const onExit$1 = /*#__PURE__*/dual(2, (self, cleanup) => uninterruptibleMask$1(restore => matchCauseEffect$1(restore(self), {
7530
+ onFailure: cause1 => {
7531
+ const result = exitFailCause$1(cause1);
7532
+ return matchCauseEffect$1(cleanup(result), {
7533
+ onFailure: cause2 => exitFailCause$1(sequential(cause1, cause2)),
7534
+ onSuccess: () => result
7535
+ });
7536
+ },
7537
+ onSuccess: success => {
7538
+ const result = exitSucceed$1(success);
7539
+ return zipRight(cleanup(result), result);
5948
7540
  }
5949
- if (accumulator.length === 0) {
5950
- throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");
7541
+ })));
7542
+ /* @internal */
7543
+ const onInterrupt = /*#__PURE__*/dual(2, (self, cleanup) => onExit$1(self, exitMatch({
7544
+ onFailure: cause => isInterruptedOnly(cause) ? asVoid(cleanup(interruptors(cause))) : void_$1,
7545
+ onSuccess: () => void_$1
7546
+ })));
7547
+ /* @internal */
7548
+ const orDie = self => orDieWith(self, identity);
7549
+ /* @internal */
7550
+ const orDieWith = /*#__PURE__*/dual(2, (self, f) => matchEffect(self, {
7551
+ onFailure: e => die(f(e)),
7552
+ onSuccess: succeed$1
7553
+ }));
7554
+ /* @internal */
7555
+ const succeed$1 = value => {
7556
+ const effect = new EffectPrimitiveSuccess(OP_SUCCESS);
7557
+ effect.effect_instruction_i0 = value;
7558
+ return effect;
7559
+ };
7560
+ /* @internal */
7561
+ const suspend$1 = evaluate => {
7562
+ const effect = new EffectPrimitive(OP_COMMIT);
7563
+ effect.commit = evaluate;
7564
+ return effect;
7565
+ };
7566
+ /* @internal */
7567
+ const sync = thunk => {
7568
+ const effect = new EffectPrimitive(OP_SYNC);
7569
+ effect.effect_instruction_i0 = thunk;
7570
+ return effect;
7571
+ };
7572
+ /* @internal */
7573
+ const tap = /*#__PURE__*/dual(args => args.length === 3 || args.length === 2 && !(isObject(args[1]) && "onlyEffect" in args[1]), (self, f) => flatMap$1(self, a => {
7574
+ const b = typeof f === "function" ? f(a) : f;
7575
+ if (isEffect(b)) {
7576
+ return as(b, a);
7577
+ } else if (isPromiseLike(b)) {
7578
+ return unsafeAsync(resume => {
7579
+ b.then(_ => resume(succeed$1(a)), e => resume(fail$1(new UnknownException(e, "An unknown error occurred in Effect.tap"))));
7580
+ });
5951
7581
  }
5952
- return accumulator.pop();
7582
+ return succeed$1(a);
7583
+ }));
7584
+ /* @internal */
7585
+ const transplant = f => withFiberRuntime(state => {
7586
+ const scopeOverride = state.getFiberRef(currentForkScopeOverride);
7587
+ const scope = pipe(scopeOverride, getOrElse(() => state.scope()));
7588
+ return f(fiberRefLocally(currentForkScopeOverride, some(scope)));
7589
+ });
7590
+ /* @internal */
7591
+ const uninterruptible = self => {
7592
+ const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
7593
+ effect.effect_instruction_i0 = disable(Interruption);
7594
+ effect.effect_instruction_i1 = () => self;
7595
+ return effect;
7596
+ };
7597
+ /* @internal */
7598
+ const uninterruptibleMask$1 = f => custom(f, function () {
7599
+ const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
7600
+ effect.effect_instruction_i0 = disable(Interruption);
7601
+ effect.effect_instruction_i1 = oldFlags => interruption(oldFlags) ? internalCall(() => this.effect_instruction_i0(interruptible$1)) : internalCall(() => this.effect_instruction_i0(uninterruptible));
7602
+ return effect;
7603
+ });
7604
+ const void_$1 = /*#__PURE__*/succeed$1(void 0);
7605
+ /* @internal */
7606
+ const updateRuntimeFlags = patch => {
7607
+ const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
7608
+ effect.effect_instruction_i0 = patch;
7609
+ effect.effect_instruction_i1 = void 0;
7610
+ return effect;
7611
+ };
7612
+ /* @internal */
7613
+ const whenEffect = /*#__PURE__*/dual(2, (self, condition) => flatMap$1(condition, b => {
7614
+ if (b) {
7615
+ return pipe(self, map(some));
7616
+ }
7617
+ return succeed$1(none$3());
7618
+ }));
7619
+ /* @internal */
7620
+ const whileLoop = options => {
7621
+ const effect = new EffectPrimitive(OP_WHILE);
7622
+ effect.effect_instruction_i0 = options.while;
7623
+ effect.effect_instruction_i1 = options.body;
7624
+ effect.effect_instruction_i2 = options.step;
7625
+ return effect;
7626
+ };
7627
+ /* @internal */
7628
+ const fromIterator = iterator => suspend$1(() => {
7629
+ const effect = new EffectPrimitive(OP_ITERATOR);
7630
+ effect.effect_instruction_i0 = iterator();
7631
+ return effect;
7632
+ });
7633
+ /* @internal */
7634
+ const gen = function () {
7635
+ const f = arguments.length === 1 ? arguments[0] : arguments[1].bind(arguments[0]);
7636
+ return fromIterator(() => f(pipe));
7637
+ };
7638
+ /** @internal */
7639
+ const fnUntraced = (body, ...pipeables) => Object.defineProperty(pipeables.length === 0 ? function (...args) {
7640
+ return fromIterator(() => body.apply(this, args));
7641
+ } : function (...args) {
7642
+ let effect = fromIterator(() => body.apply(this, args));
7643
+ for (const x of pipeables) {
7644
+ effect = x(effect, ...args);
7645
+ }
7646
+ return effect;
7647
+ }, "length", {
7648
+ value: body.length,
7649
+ configurable: true
7650
+ });
7651
+ /* @internal */
7652
+ const yieldNow$1 = options => {
7653
+ const effect = new EffectPrimitive(OP_YIELD);
7654
+ return typeof options?.priority !== "undefined" ? withSchedulingPriority(effect, options.priority) : effect;
7655
+ };
7656
+ /* @internal */
7657
+ const zip = /*#__PURE__*/dual(2, (self, that) => flatMap$1(self, a => map(that, b => [a, b])));
7658
+ /* @internal */
7659
+ const zipLeft = /*#__PURE__*/dual(2, (self, that) => flatMap$1(self, a => as(that, a)));
7660
+ /* @internal */
7661
+ const zipRight = /*#__PURE__*/dual(2, (self, that) => flatMap$1(self, () => that));
7662
+ /* @internal */
7663
+ const zipWith = /*#__PURE__*/dual(3, (self, that, f) => flatMap$1(self, a => map(that, b => f(a, b))));
7664
+ // -----------------------------------------------------------------------------
7665
+ // Fiber
7666
+ // -----------------------------------------------------------------------------
7667
+ /* @internal */
7668
+ const interruptFiber = self => flatMap$1(fiberId, fiberId => pipe(self, interruptAsFiber(fiberId)));
7669
+ /* @internal */
7670
+ const interruptAsFiber = /*#__PURE__*/dual(2, (self, fiberId) => flatMap$1(self.interruptAsFork(fiberId), () => self.await));
7671
+ // -----------------------------------------------------------------------------
7672
+ // LogLevel
7673
+ // -----------------------------------------------------------------------------
7674
+ /** @internal */
7675
+ const logLevelAll = {
7676
+ _tag: "All",
7677
+ syslog: 0,
7678
+ label: "ALL",
7679
+ ordinal: Number.MIN_SAFE_INTEGER,
7680
+ pipe() {
7681
+ return pipeArguments(this, arguments);
7682
+ }
7683
+ };
7684
+ /** @internal */
7685
+ const logLevelFatal = {
7686
+ _tag: "Fatal",
7687
+ syslog: 2,
7688
+ label: "FATAL",
7689
+ ordinal: 50000,
7690
+ pipe() {
7691
+ return pipeArguments(this, arguments);
7692
+ }
7693
+ };
7694
+ /** @internal */
7695
+ const logLevelError = {
7696
+ _tag: "Error",
7697
+ syslog: 3,
7698
+ label: "ERROR",
7699
+ ordinal: 40000,
7700
+ pipe() {
7701
+ return pipeArguments(this, arguments);
7702
+ }
7703
+ };
7704
+ /** @internal */
7705
+ const logLevelWarning = {
7706
+ _tag: "Warning",
7707
+ syslog: 4,
7708
+ label: "WARN",
7709
+ ordinal: 30000,
7710
+ pipe() {
7711
+ return pipeArguments(this, arguments);
7712
+ }
7713
+ };
7714
+ /** @internal */
7715
+ const logLevelInfo = {
7716
+ _tag: "Info",
7717
+ syslog: 6,
7718
+ label: "INFO",
7719
+ ordinal: 20000,
7720
+ pipe() {
7721
+ return pipeArguments(this, arguments);
7722
+ }
7723
+ };
7724
+ /** @internal */
7725
+ const logLevelDebug = {
7726
+ _tag: "Debug",
7727
+ syslog: 7,
7728
+ label: "DEBUG",
7729
+ ordinal: 10000,
7730
+ pipe() {
7731
+ return pipeArguments(this, arguments);
7732
+ }
7733
+ };
7734
+ /** @internal */
7735
+ const logLevelTrace = {
7736
+ _tag: "Trace",
7737
+ syslog: 7,
7738
+ label: "TRACE",
7739
+ ordinal: 0,
7740
+ pipe() {
7741
+ return pipeArguments(this, arguments);
7742
+ }
7743
+ };
7744
+ /** @internal */
7745
+ const logLevelNone = {
7746
+ _tag: "None",
7747
+ syslog: 7,
7748
+ label: "OFF",
7749
+ ordinal: Number.MAX_SAFE_INTEGER,
7750
+ pipe() {
7751
+ return pipeArguments(this, arguments);
7752
+ }
7753
+ };
7754
+ // -----------------------------------------------------------------------------
7755
+ // FiberRef
7756
+ // -----------------------------------------------------------------------------
7757
+ /** @internal */
7758
+ const FiberRefSymbolKey = "effect/FiberRef";
7759
+ /** @internal */
7760
+ const FiberRefTypeId = /*#__PURE__*/Symbol.for(FiberRefSymbolKey);
7761
+ const fiberRefVariance = {
7762
+ /* c8 ignore next */
7763
+ _A: _ => _
7764
+ };
7765
+ /* @internal */
7766
+ const fiberRefGet = self => withFiberRuntime(fiber => exitSucceed$1(fiber.getFiberRef(self)));
7767
+ /* @internal */
7768
+ const fiberRefGetWith = /*#__PURE__*/dual(2, (self, f) => flatMap$1(fiberRefGet(self), f));
7769
+ /* @internal */
7770
+ const fiberRefSet = /*#__PURE__*/dual(2, (self, value) => fiberRefModify(self, () => [void 0, value]));
7771
+ /* @internal */
7772
+ const fiberRefModify = /*#__PURE__*/dual(2, (self, f) => withFiberRuntime(state => {
7773
+ const [b, a] = f(state.getFiberRef(self));
7774
+ state.setFiberRef(self, a);
7775
+ return succeed$1(b);
7776
+ }));
7777
+ /* @internal */
7778
+ const fiberRefLocally = /*#__PURE__*/dual(3, (use, self, value) => acquireUseRelease(zipLeft(fiberRefGet(self), fiberRefSet(self, value)), () => use, oldValue => fiberRefSet(self, oldValue)));
7779
+ /* @internal */
7780
+ const fiberRefLocallyWith = /*#__PURE__*/dual(3, (use, self, f) => fiberRefGetWith(self, a => fiberRefLocally(use, self, f(a))));
7781
+ /** @internal */
7782
+ const fiberRefUnsafeMake = (initial, options) => fiberRefUnsafeMakePatch(initial, {
7783
+ differ: update(),
7784
+ fork: options?.fork ?? identity,
7785
+ join: options?.join
7786
+ });
7787
+ /** @internal */
7788
+ const fiberRefUnsafeMakeHashSet = initial => {
7789
+ const differ = hashSet();
7790
+ return fiberRefUnsafeMakePatch(initial, {
7791
+ differ,
7792
+ fork: differ.empty
7793
+ });
7794
+ };
7795
+ /** @internal */
7796
+ const fiberRefUnsafeMakeReadonlyArray = initial => {
7797
+ const differ = readonlyArray(update());
7798
+ return fiberRefUnsafeMakePatch(initial, {
7799
+ differ,
7800
+ fork: differ.empty
7801
+ });
7802
+ };
7803
+ /** @internal */
7804
+ const fiberRefUnsafeMakeContext = initial => {
7805
+ const differ = environment();
7806
+ return fiberRefUnsafeMakePatch(initial, {
7807
+ differ,
7808
+ fork: differ.empty
7809
+ });
7810
+ };
7811
+ /** @internal */
7812
+ const fiberRefUnsafeMakePatch = (initial, options) => {
7813
+ const _fiberRef = {
7814
+ ...CommitPrototype,
7815
+ [FiberRefTypeId]: fiberRefVariance,
7816
+ initial,
7817
+ commit() {
7818
+ return fiberRefGet(this);
7819
+ },
7820
+ diff: (oldValue, newValue) => options.differ.diff(oldValue, newValue),
7821
+ combine: (first, second) => options.differ.combine(first, second),
7822
+ patch: patch => oldValue => options.differ.patch(patch, oldValue),
7823
+ fork: options.fork,
7824
+ join: options.join ?? ((_, n) => n)
7825
+ };
7826
+ return _fiberRef;
7827
+ };
7828
+ /** @internal */
7829
+ const fiberRefUnsafeMakeRuntimeFlags = initial => fiberRefUnsafeMakePatch(initial, {
7830
+ differ: differ,
7831
+ fork: differ.empty
5953
7832
  });
7833
+ /** @internal */
7834
+ const currentContext = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentContext"), () => fiberRefUnsafeMakeContext(empty$b()));
7835
+ /** @internal */
7836
+ const currentSchedulingPriority = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentSchedulingPriority"), () => fiberRefUnsafeMake(0));
7837
+ /** @internal */
7838
+ const currentMaxOpsBeforeYield = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"), () => fiberRefUnsafeMake(2048));
7839
+ /** @internal */
7840
+ const currentLogAnnotations = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogAnnotation"), () => fiberRefUnsafeMake(empty$6()));
7841
+ /** @internal */
7842
+ const currentLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogLevel"), () => fiberRefUnsafeMake(logLevelInfo));
7843
+ /** @internal */
7844
+ const currentLogSpan = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogSpan"), () => fiberRefUnsafeMake(empty$5()));
7845
+ /** @internal */
7846
+ const withSchedulingPriority = /*#__PURE__*/dual(2, (self, scheduler) => fiberRefLocally(self, currentSchedulingPriority, scheduler));
7847
+ /** @internal */
7848
+ const currentConcurrency = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentConcurrency"), () => fiberRefUnsafeMake("unbounded"));
7849
+ /**
7850
+ * @internal
7851
+ */
7852
+ const currentRequestBatching = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentRequestBatching"), () => fiberRefUnsafeMake(true));
7853
+ /** @internal */
7854
+ const currentUnhandledErrorLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"), () => fiberRefUnsafeMake(some(logLevelDebug)));
7855
+ /** @internal */
7856
+ const currentVersionMismatchErrorLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"), () => fiberRefUnsafeMake(some(logLevelWarning)));
7857
+ /** @internal */
7858
+ const currentMetricLabels = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMetricLabels"), () => fiberRefUnsafeMakeReadonlyArray(empty$d()));
7859
+ /** @internal */
7860
+ const currentForkScopeOverride = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentForkScopeOverride"), () => fiberRefUnsafeMake(none$3(), {
7861
+ fork: () => none$3(),
7862
+ join: (parent, _) => parent
7863
+ }));
7864
+ /** @internal */
7865
+ const currentInterruptedCause = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentInterruptedCause"), () => fiberRefUnsafeMake(empty, {
7866
+ fork: () => empty,
7867
+ join: (parent, _) => parent
7868
+ }));
5954
7869
  // -----------------------------------------------------------------------------
5955
- // Pretty Printing
7870
+ // Scope
5956
7871
  // -----------------------------------------------------------------------------
5957
7872
  /** @internal */
5958
- const pretty = (cause, options) => {
5959
- if (isInterruptedOnly(cause)) {
5960
- return "All fibers interrupted without errors.";
5961
- }
5962
- return prettyErrors(cause).map(function (e) {
5963
- if (options?.renderErrorCause !== true || e.cause === undefined) {
5964
- return e.stack;
7873
+ const ScopeTypeId = /*#__PURE__*/Symbol.for("effect/Scope");
7874
+ /** @internal */
7875
+ const CloseableScopeTypeId = /*#__PURE__*/Symbol.for("effect/CloseableScope");
7876
+ /* @internal */
7877
+ const scopeAddFinalizer = (self, finalizer) => self.addFinalizer(() => asVoid(finalizer));
7878
+ /* @internal */
7879
+ const scopeAddFinalizerExit = (self, finalizer) => self.addFinalizer(finalizer);
7880
+ /* @internal */
7881
+ const scopeClose = (self, exit) => self.close(exit);
7882
+ /* @internal */
7883
+ const scopeFork = (self, strategy) => self.fork(strategy);
7884
+ // -----------------------------------------------------------------------------
7885
+ // Errors
7886
+ // -----------------------------------------------------------------------------
7887
+ /** @internal */
7888
+ const YieldableError$1 = /*#__PURE__*/function () {
7889
+ class YieldableError extends globalThis.Error {
7890
+ commit() {
7891
+ return fail$1(this);
7892
+ }
7893
+ toJSON() {
7894
+ const obj = {
7895
+ ...this
7896
+ };
7897
+ if (this.message) obj.message = this.message;
7898
+ if (this.cause) obj.cause = this.cause;
7899
+ return obj;
7900
+ }
7901
+ [NodeInspectSymbol]() {
7902
+ if (this.toString !== globalThis.Error.prototype.toString) {
7903
+ return this.stack ? `${this.toString()}\n${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
7904
+ } else if ("Bun" in globalThis) {
7905
+ return pretty(fail$2(this), {
7906
+ renderErrorCause: true
7907
+ });
7908
+ }
7909
+ return this;
5965
7910
  }
5966
- return `${e.stack} {\n${renderErrorCause(e.cause, " ")}\n}`;
5967
- }).join("\n");
5968
- };
5969
- const renderErrorCause = (cause, prefix) => {
5970
- const lines = cause.stack.split("\n");
5971
- let stack = `${prefix}[cause]: ${lines[0]}`;
5972
- for (let i = 1, len = lines.length; i < len; i++) {
5973
- stack += `\n${prefix}${lines[i]}`;
5974
7911
  }
5975
- if (cause.cause) {
5976
- stack += ` {\n${renderErrorCause(cause.cause, `${prefix} `)}\n${prefix}}`;
7912
+ // @effect-diagnostics-next-line floatingEffect:off
7913
+ Object.assign(YieldableError.prototype, StructuralCommitPrototype);
7914
+ return YieldableError;
7915
+ }();
7916
+ const makeException = (proto, tag) => {
7917
+ class Base extends YieldableError$1 {
7918
+ _tag = tag;
5977
7919
  }
5978
- return stack;
7920
+ Object.assign(Base.prototype, proto);
7921
+ Base.prototype.name = tag;
7922
+ return Base;
5979
7923
  };
5980
7924
  /** @internal */
5981
- const makePrettyError = originalError => {
5982
- const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
5983
- const prevLimit = Error.stackTraceLimit;
5984
- Error.stackTraceLimit = 1;
5985
- const error = new Error(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
5986
- cause: makePrettyError(originalError.cause)
5987
- } : undefined);
5988
- Error.stackTraceLimit = prevLimit;
5989
- if (error.message === "") {
5990
- error.message = "An error has occurred";
5991
- }
5992
- Error.stackTraceLimit = prevLimit;
5993
- error.name = originalError instanceof Error ? originalError.name : "Error";
5994
- if (originalErrorIsObject) {
5995
- if (spanSymbol in originalError) {
5996
- error.span = originalError[spanSymbol];
7925
+ const RuntimeExceptionTypeId = /*#__PURE__*/Symbol.for("effect/Cause/errors/RuntimeException");
7926
+ /** @internal */
7927
+ const RuntimeException = /*#__PURE__*/makeException({
7928
+ [RuntimeExceptionTypeId]: RuntimeExceptionTypeId
7929
+ }, "RuntimeException");
7930
+ /** @internal */
7931
+ const InterruptedExceptionTypeId = /*#__PURE__*/Symbol.for("effect/Cause/errors/InterruptedException");
7932
+ /** @internal */
7933
+ const isInterruptedException = u => hasProperty(u, InterruptedExceptionTypeId);
7934
+ /** @internal */
7935
+ const NoSuchElementExceptionTypeId = /*#__PURE__*/Symbol.for("effect/Cause/errors/NoSuchElement");
7936
+ /** @internal */
7937
+ const NoSuchElementException = /*#__PURE__*/makeException({
7938
+ [NoSuchElementExceptionTypeId]: NoSuchElementExceptionTypeId
7939
+ }, "NoSuchElementException");
7940
+ /** @internal */
7941
+ const UnknownExceptionTypeId = /*#__PURE__*/Symbol.for("effect/Cause/errors/UnknownException");
7942
+ /** @internal */
7943
+ const UnknownException = /*#__PURE__*/function () {
7944
+ class UnknownException extends YieldableError$1 {
7945
+ _tag = "UnknownException";
7946
+ error;
7947
+ constructor(cause, message) {
7948
+ super(message ?? "An unknown error occurred", {
7949
+ cause
7950
+ });
7951
+ this.error = cause;
5997
7952
  }
5998
- Object.keys(originalError).forEach(key => {
5999
- if (!(key in error)) {
6000
- // @ts-expect-error
6001
- error[key] = originalError[key];
7953
+ }
7954
+ Object.assign(UnknownException.prototype, {
7955
+ [UnknownExceptionTypeId]: UnknownExceptionTypeId,
7956
+ name: "UnknownException"
7957
+ });
7958
+ return UnknownException;
7959
+ }();
7960
+ // -----------------------------------------------------------------------------
7961
+ // Exit
7962
+ // -----------------------------------------------------------------------------
7963
+ /** @internal */
7964
+ const exitIsExit = u => isEffect(u) && "_tag" in u && (u._tag === "Success" || u._tag === "Failure");
7965
+ /** @internal */
7966
+ const exitIsFailure = self => self._tag === "Failure";
7967
+ /** @internal */
7968
+ const exitIsSuccess = self => self._tag === "Success";
7969
+ /** @internal */
7970
+ const exitAs = /*#__PURE__*/dual(2, (self, value) => {
7971
+ switch (self._tag) {
7972
+ case OP_FAILURE:
7973
+ {
7974
+ return exitFailCause$1(self.effect_instruction_i0);
7975
+ }
7976
+ case OP_SUCCESS:
7977
+ {
7978
+ return exitSucceed$1(value);
6002
7979
  }
6003
- });
6004
7980
  }
6005
- error.stack = prettyErrorStack(`${error.name}: ${error.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", error.span);
6006
- return error;
7981
+ });
7982
+ /** @internal */
7983
+ const exitAsVoid = self => exitAs(self, void 0);
7984
+ /** @internal */
7985
+ const exitCollectAll = (exits, options) => exitCollectAllInternal(exits, options?.parallel ? parallel : sequential);
7986
+ /** @internal */
7987
+ const exitDie$1 = defect => exitFailCause$1(die$1(defect));
7988
+ /** @internal */
7989
+ const exitFail = error => exitFailCause$1(fail$2(error));
7990
+ /** @internal */
7991
+ const exitFailCause$1 = cause => {
7992
+ const effect = new EffectPrimitiveFailure(OP_FAILURE);
7993
+ effect.effect_instruction_i0 = cause;
7994
+ return effect;
6007
7995
  };
6008
- /**
6009
- * A utility function for generating human-readable error messages from a generic error of type `unknown`.
6010
- *
6011
- * Rules:
6012
- *
6013
- * 1) If the input `u` is already a string, it's considered a message.
6014
- * 2) If `u` is an Error instance with a message defined, it uses the message.
6015
- * 3) If `u` has a user-defined `toString()` method, it uses that method.
6016
- * 4) Otherwise, it uses `Inspectable.stringifyCircular` to produce a string representation and uses it as the error message,
6017
- * with "Error" added as a prefix.
6018
- *
6019
- * @internal
6020
- */
6021
- const prettyErrorMessage = u => {
6022
- // 1)
6023
- if (typeof u === "string") {
6024
- return u;
7996
+ /** @internal */
7997
+ const exitInterrupt$1 = fiberId => exitFailCause$1(interrupt$1(fiberId));
7998
+ /** @internal */
7999
+ const exitMap = /*#__PURE__*/dual(2, (self, f) => {
8000
+ switch (self._tag) {
8001
+ case OP_FAILURE:
8002
+ return exitFailCause$1(self.effect_instruction_i0);
8003
+ case OP_SUCCESS:
8004
+ return exitSucceed$1(f(self.effect_instruction_i0));
6025
8005
  }
6026
- // 2)
6027
- if (typeof u === "object" && u !== null && u instanceof Error) {
6028
- return u.message;
8006
+ });
8007
+ /** @internal */
8008
+ const exitMatch = /*#__PURE__*/dual(2, (self, {
8009
+ onFailure,
8010
+ onSuccess
8011
+ }) => {
8012
+ switch (self._tag) {
8013
+ case OP_FAILURE:
8014
+ return onFailure(self.effect_instruction_i0);
8015
+ case OP_SUCCESS:
8016
+ return onSuccess(self.effect_instruction_i0);
6029
8017
  }
6030
- // 3)
6031
- try {
6032
- if (hasProperty(u, "toString") && isFunction(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
6033
- return u["toString"]();
6034
- }
6035
- } catch {
6036
- // something's off, rollback to json
8018
+ });
8019
+ /** @internal */
8020
+ const exitMatchEffect = /*#__PURE__*/dual(2, (self, {
8021
+ onFailure,
8022
+ onSuccess
8023
+ }) => {
8024
+ switch (self._tag) {
8025
+ case OP_FAILURE:
8026
+ return onFailure(self.effect_instruction_i0);
8027
+ case OP_SUCCESS:
8028
+ return onSuccess(self.effect_instruction_i0);
6037
8029
  }
6038
- // 4)
6039
- return stringifyCircular(u);
8030
+ });
8031
+ /** @internal */
8032
+ const exitSucceed$1 = value => {
8033
+ const effect = new EffectPrimitiveSuccess(OP_SUCCESS);
8034
+ effect.effect_instruction_i0 = value;
8035
+ return effect;
6040
8036
  };
6041
- const locationRegex = /\((.*)\)/g;
6042
8037
  /** @internal */
6043
- const spanToTrace = /*#__PURE__*/globalValue("effect/Tracer/spanToTrace", () => new WeakMap());
6044
- const prettyErrorStack = (message, stack, span) => {
6045
- const out = [message];
6046
- const lines = stack.startsWith(message) ? stack.slice(message.length).split("\n") : stack.split("\n");
6047
- for (let i = 1; i < lines.length; i++) {
6048
- if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
6049
- i++;
6050
- continue;
6051
- }
6052
- if (lines[i].includes("Generator.next")) {
6053
- break;
6054
- }
6055
- if (lines[i].includes("effect_internal_function")) {
6056
- break;
6057
- }
6058
- out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>"));
8038
+ const exitVoid$1 = /*#__PURE__*/exitSucceed$1(void 0);
8039
+ /** @internal */
8040
+ const exitZip = /*#__PURE__*/dual(2, (self, that) => exitZipWith(self, that, {
8041
+ onSuccess: (a, a2) => [a, a2],
8042
+ onFailure: sequential
8043
+ }));
8044
+ /** @internal */
8045
+ const exitZipRight = /*#__PURE__*/dual(2, (self, that) => exitZipWith(self, that, {
8046
+ onSuccess: (_, a2) => a2,
8047
+ onFailure: sequential
8048
+ }));
8049
+ /** @internal */
8050
+ const exitZipWith = /*#__PURE__*/dual(3, (self, that, {
8051
+ onFailure,
8052
+ onSuccess
8053
+ }) => {
8054
+ switch (self._tag) {
8055
+ case OP_FAILURE:
8056
+ {
8057
+ switch (that._tag) {
8058
+ case OP_SUCCESS:
8059
+ return exitFailCause$1(self.effect_instruction_i0);
8060
+ case OP_FAILURE:
8061
+ {
8062
+ return exitFailCause$1(onFailure(self.effect_instruction_i0, that.effect_instruction_i0));
8063
+ }
8064
+ }
8065
+ }
8066
+ case OP_SUCCESS:
8067
+ {
8068
+ switch (that._tag) {
8069
+ case OP_SUCCESS:
8070
+ return exitSucceed$1(onSuccess(self.effect_instruction_i0, that.effect_instruction_i0));
8071
+ case OP_FAILURE:
8072
+ return exitFailCause$1(that.effect_instruction_i0);
8073
+ }
8074
+ }
6059
8075
  }
6060
- if (span) {
6061
- let current = span;
6062
- let i = 0;
6063
- while (current && current._tag === "Span" && i < 10) {
6064
- const stackFn = spanToTrace.get(current);
6065
- if (typeof stackFn === "function") {
6066
- const stack = stackFn();
6067
- if (typeof stack === "string") {
6068
- const locationMatchAll = stack.matchAll(locationRegex);
6069
- let match = false;
6070
- for (const [, location] of locationMatchAll) {
6071
- match = true;
6072
- out.push(` at ${current.name} (${location})`);
6073
- }
6074
- if (!match) {
6075
- out.push(` at ${current.name} (${stack.replace(/^at /, "")})`);
6076
- }
6077
- } else {
6078
- out.push(` at ${current.name}`);
8076
+ });
8077
+ const exitCollectAllInternal = (exits, combineCauses) => {
8078
+ const list = fromIterable$4(exits);
8079
+ if (!isNonEmpty(list)) {
8080
+ return none$3();
8081
+ }
8082
+ return pipe(tailNonEmpty(list), reduce$7(pipe(headNonEmpty(list), exitMap(of$1)), (accumulator, current) => pipe(accumulator, exitZipWith(current, {
8083
+ onSuccess: (list, value) => pipe(list, prepend$1(value)),
8084
+ onFailure: combineCauses
8085
+ }))), exitMap(reverse$1), exitMap(chunk => toReadonlyArray(chunk)), some);
8086
+ };
8087
+ // -----------------------------------------------------------------------------
8088
+ // Deferred
8089
+ // -----------------------------------------------------------------------------
8090
+ /** @internal */
8091
+ const deferredUnsafeMake = fiberId => {
8092
+ const _deferred = {
8093
+ ...CommitPrototype,
8094
+ [DeferredTypeId]: deferredVariance,
8095
+ state: make$3(pending([])),
8096
+ commit() {
8097
+ return deferredAwait(this);
8098
+ },
8099
+ blockingOn: fiberId
8100
+ };
8101
+ return _deferred;
8102
+ };
8103
+ /* @internal */
8104
+ const deferredMake = () => flatMap$1(fiberId, id => deferredMakeAs(id));
8105
+ /* @internal */
8106
+ const deferredMakeAs = fiberId => sync(() => deferredUnsafeMake(fiberId));
8107
+ /* @internal */
8108
+ const deferredAwait = self => asyncInterrupt(resume => {
8109
+ const state = get$1(self.state);
8110
+ switch (state._tag) {
8111
+ case OP_STATE_DONE:
8112
+ {
8113
+ return resume(state.effect);
8114
+ }
8115
+ case OP_STATE_PENDING:
8116
+ {
8117
+ // we can push here as the internal state is mutable
8118
+ state.joiners.push(resume);
8119
+ return deferredInterruptJoiner(self, resume);
8120
+ }
8121
+ }
8122
+ }, self.blockingOn);
8123
+ /* @internal */
8124
+ const deferredCompleteWith = /*#__PURE__*/dual(2, (self, effect) => sync(() => {
8125
+ const state = get$1(self.state);
8126
+ switch (state._tag) {
8127
+ case OP_STATE_DONE:
8128
+ {
8129
+ return false;
8130
+ }
8131
+ case OP_STATE_PENDING:
8132
+ {
8133
+ set$1(self.state, done(effect));
8134
+ for (let i = 0, len = state.joiners.length; i < len; i++) {
8135
+ state.joiners[i](effect);
6079
8136
  }
6080
- } else {
6081
- out.push(` at ${current.name}`);
8137
+ return true;
6082
8138
  }
6083
- current = getOrUndefined(current.parent);
6084
- i++;
8139
+ }
8140
+ }));
8141
+ /* @internal */
8142
+ const deferredDone = /*#__PURE__*/dual(2, (self, exit) => deferredCompleteWith(self, exit));
8143
+ /* @internal */
8144
+ const deferredFailCause = /*#__PURE__*/dual(2, (self, cause) => deferredCompleteWith(self, failCause$1(cause)));
8145
+ /* @internal */
8146
+ const deferredInterruptWith = /*#__PURE__*/dual(2, (self, fiberId) => deferredCompleteWith(self, interruptWith(fiberId)));
8147
+ /* @internal */
8148
+ const deferredIsDone = self => sync(() => get$1(self.state)._tag === OP_STATE_DONE);
8149
+ /* @internal */
8150
+ const deferredSucceed = /*#__PURE__*/dual(2, (self, value) => deferredCompleteWith(self, succeed$1(value)));
8151
+ /** @internal */
8152
+ const deferredUnsafeDone = (self, effect) => {
8153
+ const state = get$1(self.state);
8154
+ if (state._tag === OP_STATE_PENDING) {
8155
+ set$1(self.state, done(effect));
8156
+ for (let i = 0, len = state.joiners.length; i < len; i++) {
8157
+ state.joiners[i](effect);
6085
8158
  }
6086
8159
  }
6087
- return out.join("\n");
6088
8160
  };
6089
- /** @internal */
6090
- const spanSymbol = /*#__PURE__*/Symbol.for("effect/SpanAnnotation");
6091
- /** @internal */
6092
- const prettyErrors = cause => reduceWithContext(cause, void 0, {
6093
- emptyCase: () => [],
6094
- dieCase: (_, unknownError) => {
6095
- return [makePrettyError(unknownError)];
6096
- },
6097
- failCase: (_, error) => {
6098
- return [makePrettyError(error)];
6099
- },
6100
- interruptCase: () => [],
6101
- parallelCase: (_, l, r) => [...l, ...r],
6102
- sequentialCase: (_, l, r) => [...l, ...r]
8161
+ const deferredInterruptJoiner = (self, joiner) => sync(() => {
8162
+ const state = get$1(self.state);
8163
+ if (state._tag === OP_STATE_PENDING) {
8164
+ const index = state.joiners.indexOf(joiner);
8165
+ if (index >= 0) {
8166
+ // we can splice here as the internal state is mutable
8167
+ state.joiners.splice(index, 1);
8168
+ }
8169
+ }
6103
8170
  });
8171
+ // -----------------------------------------------------------------------------
8172
+ // Context
8173
+ // -----------------------------------------------------------------------------
8174
+ const constContext = /*#__PURE__*/withFiberRuntime(fiber => exitSucceed$1(fiber.currentContext));
8175
+ /* @internal */
8176
+ const context = () => constContext;
8177
+ /* @internal */
8178
+ const contextWithEffect = f => flatMap$1(context(), f);
8179
+ /* @internal */
8180
+ const provideContext$1 = /*#__PURE__*/dual(2, (self, context) => fiberRefLocally(currentContext, context)(self));
8181
+ /* @internal */
8182
+ const provideSomeContext = /*#__PURE__*/dual(2, (self, context) => fiberRefLocallyWith(currentContext, parent => merge(parent, context))(self));
8183
+ /* @internal */
8184
+ const mapInputContext = /*#__PURE__*/dual(2, (self, f) => contextWithEffect(context => provideContext$1(self, f(context))));
8185
+ // -----------------------------------------------------------------------------
8186
+ // Tracing
8187
+ // -----------------------------------------------------------------------------
8188
+ /** @internal */
8189
+ const currentSpanFromFiber = fiber => {
8190
+ const span = fiber.currentSpan;
8191
+ return span !== undefined && span._tag === "Span" ? some(span) : none$3();
8192
+ };
6104
8193
 
6105
8194
  /** @internal */
6106
8195
  /**
@@ -6392,7 +8481,7 @@ const MicroProto = {
6392
8481
  return pipeArguments(this, arguments);
6393
8482
  },
6394
8483
  [Symbol.iterator]() {
6395
- return new SingleShotGen(new YieldWrap(this));
8484
+ return new SingleShotGen$1(new YieldWrap(this));
6396
8485
  },
6397
8486
  toJSON() {
6398
8487
  return {
@@ -6448,7 +8537,7 @@ const makeExit = options => {
6448
8537
  return isMicroExit(that) && that._tag === options.op && equals(this[args], that[args]);
6449
8538
  },
6450
8539
  [symbol$1]() {
6451
- return cached(this, combine$1(string(options.op))(hash(this[args])));
8540
+ return cached(this, combine$5(string(options.op))(hash(this[args])));
6452
8541
  }
6453
8542
  };
6454
8543
  return function (value) {
@@ -6833,36 +8922,52 @@ const uninterruptibleMask = f => withMicroFiber(fiber => {
6833
8922
  * @category execution
6834
8923
  */
6835
8924
  const runFork = (effect, options) => {
6836
- const fiber = new MicroFiberImpl(CurrentScheduler.context(new MicroSchedulerDefault()));
8925
+ const fiber = new MicroFiberImpl(CurrentScheduler.context(options?.scheduler ?? new MicroSchedulerDefault()));
6837
8926
  fiber.evaluate(effect);
8927
+ if (options?.signal) {
8928
+ if (options.signal.aborted) {
8929
+ fiber.unsafeInterrupt();
8930
+ } else {
8931
+ const abort = () => fiber.unsafeInterrupt();
8932
+ options.signal.addEventListener("abort", abort, {
8933
+ once: true
8934
+ });
8935
+ fiber.addObserver(() => options.signal.removeEventListener("abort", abort));
8936
+ }
8937
+ }
6838
8938
  return fiber;
6839
8939
  };
6840
8940
  /**
6841
- * Execute the `Micro` effect and return a `Promise` that resolves with the
6842
- * `MicroExit` of the computation.
8941
+ * Attempt to execute the `Micro` effect synchronously and return the `MicroExit`.
8942
+ *
8943
+ * If any asynchronous effects are encountered, the function will return a
8944
+ * `CauseDie` containing the `MicroFiber`.
6843
8945
  *
6844
8946
  * @since 3.4.6
6845
8947
  * @experimental
6846
8948
  * @category execution
6847
8949
  */
6848
- const runPromiseExit = (effect, options) => new Promise((resolve, _reject) => {
6849
- const handle = runFork(effect);
6850
- handle.addObserver(resolve);
6851
- });
8950
+ const runSyncExit = effect => {
8951
+ const scheduler = new MicroSchedulerDefault();
8952
+ const fiber = runFork(effect, {
8953
+ scheduler
8954
+ });
8955
+ scheduler.flush();
8956
+ return fiber._exit ?? exitDie(fiber);
8957
+ };
6852
8958
  /**
6853
- * Execute the `Micro` effect and return a `Promise` that resolves with the
6854
- * successful value of the computation.
8959
+ * Attempt to execute the `Micro` effect synchronously and return the success
8960
+ * value.
6855
8961
  *
6856
8962
  * @since 3.4.0
6857
8963
  * @experimental
6858
8964
  * @category execution
6859
8965
  */
6860
- const runPromise = (effect, options) => runPromiseExit(effect).then(exit => {
6861
- if (exit._tag === "Failure") {
6862
- throw exit.cause;
6863
- }
8966
+ const runSync = effect => {
8967
+ const exit = runSyncExit(effect);
8968
+ if (exit._tag === "Failure") throw exit.cause;
6864
8969
  return exit.value;
6865
- });
8970
+ };
6866
8971
  const YieldableError = /*#__PURE__*/function () {
6867
8972
  class YieldableError extends globalThis.Error {}
6868
8973
  // @effect-diagnostics-next-line floatingEffect:off
@@ -6962,7 +9067,7 @@ const format = (quoteValue, whitespace) => ({
6962
9067
  const append = (label, value) => " " + format(label, value);
6963
9068
  let out = format("timestamp", date.toISOString());
6964
9069
  out += append("level", logLevel.label);
6965
- out += append("fiber", threadName(fiberId));
9070
+ out += append("fiber", threadName$1(fiberId));
6966
9071
  const messages = ensure(message);
6967
9072
  for (let i = 0; i < messages.length; i++) {
6968
9073
  out += append("message", toStringUnknown(messages[i], whitespace));
@@ -6987,4 +9092,4 @@ const stringLogger = /*#__PURE__*/makeLogger(/*#__PURE__*/format(escapeDoubleQuo
6987
9092
  const hasProcessStdout = typeof process === "object" && process !== null && typeof process.stdout === "object" && process.stdout !== null;
6988
9093
  hasProcessStdout && process.stdout.isTTY === true;
6989
9094
 
6990
- export { add as $, set$1 as A, get$1 as B, isEmpty$1 as C, modifyAt as D, map$1 as E, keys as F, fromIterable$2 as G, string as H, format$1 as I, array as J, fromIterable$4 as K, mapInput as L, toJSON as M, NodeInspectSymbol as N, getEquivalence$1 as O, equals as P, of as Q, isNonEmpty as R, StructuralPrototype as S, TaggedError as T, headNonEmpty as U, tailNonEmpty as V, prepend as W, makeContext as X, reduce$1 as Y, has as Z, remove as _, isRight as a, OP_YIELD as a$, drop$1 as a0, isNonEmptyArray as a1, of$1 as a2, headNonEmpty$1 as a3, tailNonEmpty$1 as a4, constant as a5, appendAll as a6, orElseSome as a7, map$4 as a8, append as a9, interruptors as aA, OP_UPDATE_RUNTIME_FLAGS as aB, defects as aC, electFailures as aD, failures as aE, unsafeHead as aF, interrupt as aG, get as aH, set as aI, globalValue as aJ, getOrElse as aK, OP_ASYNC as aL, fromIterable$3 as aM, toReadonlyArray as aN, reverse as aO, reduce$5 as aP, allocate as aQ, sequential as aR, isPromiseLike as aS, OP_WHILE as aT, merge as aU, StructuralCommitPrototype as aV, empty as aW, die as aX, OP_REVERT_FLAGS as aY, pretty as aZ, isSome as a_, empty$4 as aa, OP_COMMIT as ab, effectVariance as ac, random as ad, YieldWrap as ae, OP_ON_SUCCESS as af, OP_ON_FAILURE as ag, isObject as ah, spanSymbol as ai, fail$1 as aj, failureOrCause as ak, getBugErrorMessage as al, OP_SYNC as am, OP_WITH_RUNTIME as an, OP_FAILURE as ao, pipe as ap, combine$1 as aq, hash as ar, OP_ON_SUCCESS_AND_FAILURE as as, OP_SUCCESS as at, internalCall as au, some as av, none$1 as aw, make as ax, CommitPrototype as ay, isInterruptedOnly as az, getRight as b, flipCauseOption as b$, OP_ITERATOR as b0, empty$5 as b1, empty$7 as b2, parallel as b3, isEqual as b4, GenericTag as b5, constFalse as b6, join as b7, contains as b8, head$1 as b9, lastNonEmpty as bA, span as bB, isNone as bC, getOrUndefined as bD, isTagged as bE, difference as bF, empty$1 as bG, union as bH, make$1 as bI, make$5 as bJ, isIterable as bK, compareAndSet as bL, isEmpty as bM, size as bN, withRedactableContext as bO, OP_TAG as bP, unsafeGet$1 as bQ, runFork as bR, provideContext as bS, stripFailures as bT, getCurrentVersion as bU, toStringUnknown as bV, yieldWrapGet as bW, getOption as bX, makeLogger as bY, stringLogger as bZ, isInterrupted as b_, prepend$1 as ba, map$3 as bb, isLeft as bc, zip as bd, append$1 as be, flatten as bf, last as bg, unfold as bh, merge$2 as bi, sort as bj, flatMap$3 as bk, unsafeGet$3 as bl, fromIterable as bm, PCGRandom as bn, Reference as bo, add$2 as bp, isNonEmptyReadonlyArray as bq, Class as br, constVoid as bs, get$3 as bt, unsafeFromArray as bu, makeBy as bv, dedupe as bw, appendAll$1 as bx, fromNullable as by, union$2 as bz, runPromise as c, map as c0, isDieType as c1, head as c2, prettyErrors as c3, isContext as c4, mergeAll as c5, find as c6, splitAt$1 as c7, isEmpty$2 as c8, filter as c9, match$2 as ca, unsafeGet as cb, reduce$4 as cc, map$2 as cd, splitWhere as ce, filterMap as cf, dual as d, isNumber as e, isBigInt as f, getOrThrowWith as g, hasProperty as h, identity as i, isString as j, symbol$1 as k, left as l, match$1 as m, cached as n, structure as o, pipeArguments as p, none as q, right as r, symbol as s, try_ as t, combine as u, unsafeMake as v, threadName as w, combineAll as x, empty$3 as y, reduce$3 as z };
9095
+ export { exitFail as $, cons as A, reduce$2 as B, set as C, get as D, appendAll$1 as E, isEmpty$1 as F, equals as G, modifyAt as H, orElseSome as I, map$6 as J, append as K, of$1 as L, map$2 as M, NodeInspectSymbol as N, keys as O, empty$a as P, deferredMake as Q, deferredAwait as R, deferredSucceed as S, TaggedError as T, deferredFailCause as U, deferredIsDone as V, exitIsFailure as W, exitIsSuccess as X, exitMatch as Y, exitFailCause$1 as Z, exitSucceed$1 as _, isRight as a, add$2 as a$, exitZipRight as a0, exitCollectAll as a1, exitVoid$1 as a2, exitDie$1 as a3, exitMap as a4, exitZip as a5, isEqual as a6, some as a7, none$3 as a8, isSome as a9, zip as aA, map as aB, of$2 as aC, fromIterable as aD, fromIterable$5 as aE, append$1 as aF, flatten$1 as aG, empty$d as aH, last as aI, getOrElse as aJ, mapError as aK, catchAll as aL, unfold as aM, merge$2 as aN, mapBoth as aO, sort as aP, flatMap$4 as aQ, unsafeGet$3 as aR, fromIterable$1 as aS, hash as aT, PCGRandom as aU, forEachSequentialDiscard as aV, as as aW, fromIterable$4 as aX, Reference as aY, globalValue as aZ, fiberRefUnsafeMakeContext as a_, toJSON as aa, format$1 as ab, prepend$1 as ac, reverse$1 as ad, GenericTag as ae, sync as af, succeed$1 as ag, async_ as ah, constFalse as ai, void_$1 as aj, asVoid as ak, pipe as al, join as am, isCons as an, contains as ao, head$1 as ap, tailNonEmpty$1 as aq, prepend$2 as ar, map$5 as as, flatMap$1 as at, fail$1 as au, suspend$1 as av, either as aw, isLeft as ax, zip$1 as ay, forEachSequential as az, getRight as b, uninterruptibleMask$1 as b$, empty$b as b0, withFiberRuntime as b1, headNonEmpty$1 as b2, isNonEmptyReadonlyArray as b3, logLevelWarning as b4, logLevelNone as b5, logLevelTrace as b6, logLevelInfo as b7, logLevelFatal as b8, logLevelError as b9, unsafeFromArray as bA, makeBy as bB, dedupe as bC, appendAll$2 as bD, array as bE, fromNullable as bF, getEquivalence$2 as bG, union$2 as bH, allocate as bI, lastNonEmpty as bJ, span as bK, isNone as bL, getOrUndefined as bM, tap as bN, currentMetricLabels as bO, deferredUnsafeDone as bP, isTagged as bQ, make$2 as bR, reduce$3 as bS, difference as bT, empty$7 as bU, union as bV, make$4 as bW, isNonEmpty as bX, headNonEmpty as bY, tailNonEmpty as bZ, onExit$1 as b_, logLevelDebug as ba, logLevelAll as bb, make$3 as bc, Class as bd, get$1 as be, set$1 as bf, string as bg, matchEffect as bh, matchCauseEffect$1 as bi, zipRight as bj, failCause$1 as bk, constVoid as bl, contextWithEffect as bm, provideContext$1 as bn, get$4 as bo, failCauseSync as bp, yieldNow$1 as bq, combine$5 as br, fiberRefUnsafeMake as bs, currentMaxOpsBeforeYield as bt, currentSchedulingPriority as bu, fiberRefGetWith as bv, currentConcurrency as bw, none$1 as bx, zipLeft as by, flatten as bz, runSync as c, blocked as c$, transplant as c0, CloseableScopeTypeId as c1, ScopeTypeId as c2, exitAsVoid as c3, exit as c4, sequential as c5, isEffect as c6, mapInputContext as c7, merge as c8, make$8 as c9, currentLogAnnotations as cA, size as cB, withRedactableContext as cC, interruptible$2 as cD, OP_YIELD as cE, cooperativeYielding as cF, OP_ASYNC as cG, enable$1 as cH, patch as cI, die$1 as cJ, OP_ON_FAILURE as cK, OP_ON_SUCCESS as cL, OP_WHILE as cM, OP_ITERATOR as cN, OP_TAG as cO, unsafeGet$1 as cP, NoSuchElementException as cQ, unsafeAsync as cR, runFork as cS, provideContext as cT, die as cU, OP_SYNC as cV, internalCall as cW, OP_REVERT_FLAGS as cX, stripFailures as cY, OP_ON_SUCCESS_AND_FAILURE as cZ, OP_WITH_RUNTIME as c_, OP_FAILURE as ca, OP_SUCCESS as cb, combine$3 as cc, currentRequestBatching as cd, isIterable as ce, unsafeMake as cf, currentContext as cg, currentForkScopeOverride as ch, compareAndSet as ci, runtimeMetrics as cj, currentInterruptedCause as ck, deferredUnsafeMake as cl, fiberRefUnsafeMakeRuntimeFlags as cm, exclude as cn, WindDown as co, Interruption as cp, diff as cq, updateRuntimeFlags as cr, interrupt$1 as cs, fiberRefUnsafeMakePatch as ct, isEmpty as cu, whileLoop as cv, currentUnhandledErrorLogLevel as cw, isInterruptedOnly as cx, currentLogLevel as cy, currentLogSpan as cz, dual as d, acquireUseRelease as d$, runRequestBlock as d0, OP_UPDATE_RUNTIME_FLAGS as d1, RevertFlags as d2, OP_COMMIT as d3, OpSupervision as d4, EffectTypeId as d5, currentVersionMismatchErrorLogLevel as d6, getCurrentVersion as d7, empty as d8, dieMessage as d9, failureOrCause as dA, flipCauseOption as dB, map$1 as dC, isDieType as dD, interruptors as dE, head as dF, scopeClose as dG, scopeAddFinalizerExit as dH, scopeAddFinalizer as dI, asyncInterrupt as dJ, make as dK, RuntimeMetrics as dL, CooperativeYielding as dM, prettyErrors as dN, isContext as dO, provideSomeContext as dP, whenEffect as dQ, mergeAll as dR, gen as dS, zipWith as dT, fnUntraced as dU, catchAllCause as dV, find as dW, orDie as dX, failSync as dY, interrupt as dZ, matchCause as d_, toStringUnknown as da, isInterruptedException as db, fiberRefUnsafeMakeHashSet as dc, yieldWrapGet as dd, exitIsExit as de, step as df, uninterruptible as dg, getOption as dh, scopeFork as di, none as dj, makeLogger as dk, threadName as dl, pretty as dm, fiberIdWith as dn, exitMatchEffect as dp, interruptAsFiber as dq, parallel as dr, toReadonlyArray as ds, fiberRefLocally as dt, stringLogger as du, interruptible$1 as dv, isInterrupted as dw, interruptFiber as dx, exitInterrupt$1 as dy, fail$2 as dz, isNumber as e, intoDeferred as e0, splitAt$1 as e1, isEmpty$3 as e2, onInterrupt as e3, filter as e4, deferredInterruptWith as e5, fiberId as e6, match$2 as e7, combineAll as e8, unsafeGet as e9, reduce$6 as ea, map$4 as eb, splitWhere as ec, filterMap as ed, isBigInt as f, getOrThrowWith as g, hasProperty as h, identity as i, isString as j, symbol$1 as k, left as l, match$1 as m, cached as n, structure as o, pipeArguments as p, of as q, right as r, symbol as s, try_ as t, reduce$1 as u, empty$5 as v, appendAll as w, isNil as x, reverse as y, empty$6 as z };