@lmvz-ds/components 0.13.0 → 0.13.1

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 (43) hide show
  1. package/dist/cjs/assets-CJzJZPzV.js +26 -0
  2. package/dist/cjs/{assets-CB5ikzmP.js → icons-FIfJEo6G.js} +1251 -773
  3. package/dist/cjs/index.cjs.js +3 -3
  4. package/dist/cjs/lmvz-card.cjs.entry.js +3 -3
  5. package/dist/cjs/lmvz-icon.cjs.entry.js +3 -3
  6. package/dist/collection/components/lmvz-card/lmvz-card.js +3 -4
  7. package/dist/collection/components/lmvz-icon/icons.js +2 -2
  8. package/dist/collection/utils/assets.js +9 -6
  9. package/dist/collection/utils/http.js +2 -2
  10. package/dist/collection/utils/http.unit.js +1 -1
  11. package/dist/collection/utils/validation/svg.js +1 -1
  12. package/dist/components/index.js +1 -1
  13. package/dist/components/lmvz-card.js +1 -1
  14. package/dist/components/lmvz-header.js +1 -1
  15. package/dist/components/lmvz-icon.js +1 -1
  16. package/dist/components/p-BsS3QvWn.js +1 -0
  17. package/dist/components/p-CdYWDK7m.js +1 -0
  18. package/dist/esm/assets-BelZNJ1W.js +23 -0
  19. package/dist/esm/{assets-ozES4zSA.js → icons-CM7lsnuO.js} +1249 -708
  20. package/dist/esm/index.js +3 -2
  21. package/dist/esm/lmvz-card.entry.js +3 -3
  22. package/dist/esm/lmvz-icon.entry.js +2 -2
  23. package/dist/lmvz-components/index.esm.js +1 -1
  24. package/dist/lmvz-components/lmvz-components.esm.js +1 -1
  25. package/dist/lmvz-components/p-6e3314ab.entry.js +1 -0
  26. package/dist/lmvz-components/p-BoR31cjC.js +1 -0
  27. package/dist/lmvz-components/p-CVf2C8dL.js +1 -0
  28. package/dist/lmvz-components/p-d9dc29a1.entry.js +1 -0
  29. package/dist/manifest.json +1 -1
  30. package/dist/types/utils/assets.d.ts +1 -8
  31. package/dist/types/utils/http.d.ts +3 -3
  32. package/dist/types/utils/validation/svg.d.ts +2 -2
  33. package/hydrate/index.js +2131 -12411
  34. package/hydrate/index.mjs +2131 -12411
  35. package/package.json +4 -4
  36. package/dist/cjs/icons-DM_TTn48.js +0 -857
  37. package/dist/components/p-BBDH9X49.js +0 -1
  38. package/dist/components/p-Bs6_m7Uw.js +0 -1
  39. package/dist/esm/icons-kpJZ1u9g.js +0 -853
  40. package/dist/lmvz-components/p-4ad8c332.entry.js +0 -1
  41. package/dist/lmvz-components/p-5eee0752.entry.js +0 -1
  42. package/dist/lmvz-components/p-D9lc4ayG.js +0 -1
  43. package/dist/lmvz-components/p-iviTjlUy.js +0 -1
@@ -1,4 +1,4 @@
1
- import { a as getAssetPath } from './index-T5ljELGS.js';
1
+ import { c as createAssetUrlSafely } from './assets-BelZNJ1W.js';
2
2
 
3
3
  /**
4
4
  * Tests if a value is a `function`.
@@ -275,19 +275,19 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
275
275
  * @category constructors
276
276
  * @since 2.0.0
277
277
  */
278
- const make$n = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
278
+ const make$q = isEquivalent => (self, that) => self === that || isEquivalent(self, that);
279
279
  /**
280
280
  * @category mapping
281
281
  * @since 2.0.0
282
282
  */
283
- const mapInput$1 = /*#__PURE__*/dual(2, (self, f) => make$n((x, y) => self(f(x), f(y))));
283
+ const mapInput$1 = /*#__PURE__*/dual(2, (self, f) => make$q((x, y) => self(f(x), f(y))));
284
284
  /**
285
285
  * Creates a new `Equivalence` for an array of values based on a given `Equivalence` for the elements of the array.
286
286
  *
287
287
  * @category combinators
288
288
  * @since 2.0.0
289
289
  */
290
- const array$1 = item => make$n((self, that) => {
290
+ const array$1 = item => make$q((self, that) => {
291
291
  if (self.length !== that.length) {
292
292
  return false;
293
293
  }
@@ -1325,10 +1325,10 @@ const Base$1 = /*#__PURE__*/function () {
1325
1325
  /**
1326
1326
  * @since 2.0.0
1327
1327
  */
1328
- const TypeId$9 = /*#__PURE__*/Symbol.for("effect/Option");
1328
+ const TypeId$b = /*#__PURE__*/Symbol.for("effect/Option");
1329
1329
  const CommonProto$1 = {
1330
1330
  ...EffectPrototype$1,
1331
- [TypeId$9]: {
1331
+ [TypeId$b]: {
1332
1332
  _A: _ => _
1333
1333
  },
1334
1334
  [NodeInspectSymbol]() {
@@ -1373,7 +1373,7 @@ const NoneProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonPr
1373
1373
  }
1374
1374
  });
1375
1375
  /** @internal */
1376
- const isOption = input => hasProperty(input, TypeId$9);
1376
+ const isOption = input => hasProperty(input, TypeId$b);
1377
1377
  /** @internal */
1378
1378
  const isNone$1 = fa => fa._tag === "None";
1379
1379
  /** @internal */
@@ -1393,10 +1393,10 @@ const some$1 = value => {
1393
1393
  /**
1394
1394
  * @internal
1395
1395
  */
1396
- const TypeId$8 = /*#__PURE__*/Symbol.for("effect/Either");
1396
+ const TypeId$a = /*#__PURE__*/Symbol.for("effect/Either");
1397
1397
  const CommonProto = {
1398
1398
  ...EffectPrototype$1,
1399
- [TypeId$8]: {
1399
+ [TypeId$a]: {
1400
1400
  _R: _ => _
1401
1401
  },
1402
1402
  [NodeInspectSymbol]() {
@@ -1441,7 +1441,7 @@ const LeftProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(CommonPr
1441
1441
  }
1442
1442
  });
1443
1443
  /** @internal */
1444
- const isEither = input => hasProperty(input, TypeId$8);
1444
+ const isEither = input => hasProperty(input, TypeId$a);
1445
1445
  /** @internal */
1446
1446
  const isLeft$1 = ma => ma._tag === "Left";
1447
1447
  /** @internal */
@@ -1567,7 +1567,7 @@ const merge$3 = /*#__PURE__*/match$4({
1567
1567
  * @category getters
1568
1568
  * @since 2.0.0
1569
1569
  */
1570
- const getOrThrowWith$1 = /*#__PURE__*/dual(2, (self, onLeft) => {
1570
+ const getOrThrowWith = /*#__PURE__*/dual(2, (self, onLeft) => {
1571
1571
  if (isRight(self)) {
1572
1572
  return self.right;
1573
1573
  }
@@ -1602,17 +1602,17 @@ const isNonEmptyArray$1 = self => self.length > 0;
1602
1602
  * @category constructors
1603
1603
  * @since 2.0.0
1604
1604
  */
1605
- const make$m = compare => (self, that) => self === that ? 0 : compare(self, that);
1605
+ const make$p = compare => (self, that) => self === that ? 0 : compare(self, that);
1606
1606
  /**
1607
1607
  * @category instances
1608
1608
  * @since 2.0.0
1609
1609
  */
1610
- const number = /*#__PURE__*/make$m((self, that) => self < that ? -1 : 1);
1610
+ const number = /*#__PURE__*/make$p((self, that) => self < that ? -1 : 1);
1611
1611
  /**
1612
1612
  * @category mapping
1613
1613
  * @since 2.0.0
1614
1614
  */
1615
- const mapInput = /*#__PURE__*/dual(2, (self, f) => make$m((b1, b2) => self(f(b1), f(b2))));
1615
+ const mapInput = /*#__PURE__*/dual(2, (self, f) => make$p((b1, b2) => self(f(b1), f(b2))));
1616
1616
  /**
1617
1617
  * Test whether one value is _strictly greater than_ another.
1618
1618
  *
@@ -1904,67 +1904,6 @@ const fromNullable = nullableValue => nullableValue == null ? none$4() : some(nu
1904
1904
  * @since 2.0.0
1905
1905
  */
1906
1906
  const getOrUndefined = /*#__PURE__*/getOrElse(constUndefined);
1907
- /**
1908
- * Extracts the value of an `Option` or throws an error if the `Option` is
1909
- * `None`, using a custom error factory.
1910
- *
1911
- * **Details**
1912
- *
1913
- * This function allows you to extract the value of an `Option` when it is
1914
- * `Some`. If the `Option` is `None`, it throws an error generated by the
1915
- * provided `onNone` function. This utility is particularly useful when you need
1916
- * a fail-fast behavior for empty `Option` values and want to provide a custom
1917
- * error message or object.
1918
- *
1919
- * @example
1920
- * ```ts
1921
- * import * as assert from "node:assert"
1922
- * import { Option } from "effect"
1923
- *
1924
- * assert.deepStrictEqual(
1925
- * Option.getOrThrowWith(Option.some(1), () => new Error('Unexpected None')),
1926
- * 1
1927
- * )
1928
- * assert.throws(() => Option.getOrThrowWith(Option.none(), () => new Error('Unexpected None')))
1929
- * ```
1930
- *
1931
- * @see {@link getOrThrow} for a version that throws a default error.
1932
- *
1933
- * @category Conversions
1934
- * @since 2.0.0
1935
- */
1936
- const getOrThrowWith = /*#__PURE__*/dual(2, (self, onNone) => {
1937
- if (isSome(self)) {
1938
- return self.value;
1939
- }
1940
- throw onNone();
1941
- });
1942
- /**
1943
- * Extracts the value of an `Option` or throws a default error if the `Option`
1944
- * is `None`.
1945
- *
1946
- * **Details**
1947
- *
1948
- * This function extracts the value from an `Option` if it is `Some`. If the
1949
- * `Option` is `None`, it throws a default error. It is useful for fail-fast
1950
- * scenarios where the absence of a value is treated as an exceptional case and
1951
- * a default error is sufficient.
1952
- *
1953
- * @example
1954
- * ```ts
1955
- * import * as assert from "node:assert"
1956
- * import { Option } from "effect"
1957
- *
1958
- * assert.deepStrictEqual(Option.getOrThrow(Option.some(1)), 1)
1959
- * assert.throws(() => Option.getOrThrow(Option.none()))
1960
- * ```
1961
- *
1962
- * @see {@link getOrThrowWith} for a version that allows you to provide a custom error.
1963
- *
1964
- * @category Conversions
1965
- * @since 2.0.0
1966
- */
1967
- const getOrThrow = /*#__PURE__*/getOrThrowWith(() => new Error("getOrThrow called on a None"));
1968
1907
  /**
1969
1908
  * Transforms the value inside a `Some` to a new value using the provided
1970
1909
  * function, while leaving `None` unchanged.
@@ -2121,20 +2060,6 @@ const _equivalence$3 = /*#__PURE__*/equivalence();
2121
2060
  * @since 2.0.0
2122
2061
  */
2123
2062
  const contains = /*#__PURE__*/containsWith(_equivalence$3);
2124
- /**
2125
- * Merges two optional values, applying a function if both exist.
2126
- * Unlike {@link zipWith}, this function returns `None` only if both inputs are `None`.
2127
- *
2128
- * @internal
2129
- */
2130
- const mergeWith = f => (o1, o2) => {
2131
- if (isNone(o1)) {
2132
- return o2;
2133
- } else if (isNone(o2)) {
2134
- return o1;
2135
- }
2136
- return some(f(o1.value, o2.value));
2137
- };
2138
2063
 
2139
2064
  /**
2140
2065
  * This module provides utility functions for working with tuples in TypeScript.
@@ -2155,7 +2080,7 @@ const mergeWith = f => (o1, o2) => {
2155
2080
  * @category constructors
2156
2081
  * @since 2.0.0
2157
2082
  */
2158
- const make$l = (...elements) => elements;
2083
+ const make$o = (...elements) => elements;
2159
2084
 
2160
2085
  /**
2161
2086
  * This module provides utility functions for working with arrays in TypeScript.
@@ -2269,7 +2194,7 @@ const prepend$2 = /*#__PURE__*/dual(2, (self, head) => [head, ...self]);
2269
2194
  * @category concatenating
2270
2195
  * @since 2.0.0
2271
2196
  */
2272
- const append$1 = /*#__PURE__*/dual(2, (self, last) => [...self, last]);
2197
+ const append$2 = /*#__PURE__*/dual(2, (self, last) => [...self, last]);
2273
2198
  /**
2274
2199
  * Concatenates two arrays (or iterables), combining their elements.
2275
2200
  * If either array is non-empty, the result is also a non-empty array.
@@ -2519,7 +2444,7 @@ const sort = /*#__PURE__*/dual(2, (self, O) => {
2519
2444
  * @category zipping
2520
2445
  * @since 2.0.0
2521
2446
  */
2522
- const zip$1 = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, make$l));
2447
+ const zip$1 = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, make$o));
2523
2448
  /**
2524
2449
  * Apply a function to pairs of elements at the same index in two `Iterable`s, collecting the results in a new `Array`. If one
2525
2450
  * input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
@@ -2657,7 +2582,7 @@ const union$2 = /*#__PURE__*/dual(2, (self, that) => unionWith(self, that, _equi
2657
2582
  * @category constructors
2658
2583
  * @since 2.0.0
2659
2584
  */
2660
- const empty$j = () => [];
2585
+ const empty$k = () => [];
2661
2586
  /**
2662
2587
  * Constructs a new `NonEmptyArray<A>` from the specified value.
2663
2588
  *
@@ -2931,6 +2856,54 @@ const Order$1 = number;
2931
2856
  */
2932
2857
  const escape = string => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
2933
2858
 
2859
+ /**
2860
+ * This module provides types and utility functions to create and work with branded types,
2861
+ * which are TypeScript types with an added type tag to prevent accidental usage of a value in the wrong context.
2862
+ *
2863
+ * The `refined` and `nominal` functions are both used to create branded types in TypeScript.
2864
+ * The main difference between them is that `refined` allows for validation of the data, while `nominal` does not.
2865
+ *
2866
+ * The `nominal` function is used to create a new branded type that has the same underlying type as the input, but with a different name.
2867
+ * This is useful when you want to distinguish between two values of the same type that have different meanings.
2868
+ * The `nominal` function does not perform any validation of the input data.
2869
+ *
2870
+ * On the other hand, the `refined` function is used to create a new branded type that has the same underlying type as the input,
2871
+ * but with a different name, and it also allows for validation of the input data.
2872
+ * The `refined` function takes a predicate that is used to validate the input data.
2873
+ * If the input data fails the validation, a `BrandErrors` is returned, which provides information about the specific validation failure.
2874
+ *
2875
+ * @since 2.0.0
2876
+ */
2877
+ /**
2878
+ * @since 2.0.0
2879
+ * @category symbols
2880
+ */
2881
+ const RefinedConstructorsTypeId = /*#__PURE__*/Symbol.for("effect/Brand/Refined");
2882
+ /**
2883
+ * Returns a `BrandErrors` that contains a single `RefinementError`.
2884
+ *
2885
+ * @since 2.0.0
2886
+ * @category constructors
2887
+ */
2888
+ const error = (message, meta) => [{
2889
+ message,
2890
+ meta
2891
+ }];
2892
+ function refined(...args) {
2893
+ const either = args.length === 2 ? unbranded => args[0](unbranded) ? right(unbranded) : left(args[1](unbranded)) : unbranded => {
2894
+ return match$3(args[0](unbranded), {
2895
+ onNone: () => right(unbranded),
2896
+ onSome: left
2897
+ });
2898
+ };
2899
+ return Object.assign(unbranded => getOrThrowWith(either(unbranded), identity), {
2900
+ [RefinedConstructorsTypeId]: RefinedConstructorsTypeId,
2901
+ option: args => getRight(either(args)),
2902
+ either,
2903
+ is: args => isRight(either(args))
2904
+ });
2905
+ }
2906
+
2934
2907
  /** @internal */
2935
2908
  const TagTypeId = /*#__PURE__*/Symbol.for("effect/Context/Tag");
2936
2909
  /** @internal */
@@ -2965,7 +2938,7 @@ const TagProto = {
2965
2938
  return self;
2966
2939
  },
2967
2940
  context(self) {
2968
- return make$k(this, self);
2941
+ return make$n(this, self);
2969
2942
  }
2970
2943
  };
2971
2944
  const ReferenceProto = {
@@ -3005,10 +2978,10 @@ const Reference$1 = () => (id, options) => {
3005
2978
  return ReferenceClass;
3006
2979
  };
3007
2980
  /** @internal */
3008
- const TypeId$7 = /*#__PURE__*/Symbol.for("effect/Context");
2981
+ const TypeId$9 = /*#__PURE__*/Symbol.for("effect/Context");
3009
2982
  /** @internal */
3010
2983
  const ContextProto = {
3011
- [TypeId$7]: {
2984
+ [TypeId$9]: {
3012
2985
  _Services: _ => _
3013
2986
  },
3014
2987
  [symbol](that) {
@@ -3068,14 +3041,14 @@ const serviceNotFoundError = tag => {
3068
3041
  return error;
3069
3042
  };
3070
3043
  /** @internal */
3071
- const isContext = u => hasProperty(u, TypeId$7);
3044
+ const isContext = u => hasProperty(u, TypeId$9);
3072
3045
  /** @internal */
3073
3046
  const isReference = u => hasProperty(u, ReferenceTypeId);
3074
3047
  const _empty$6 = /*#__PURE__*/makeContext(/*#__PURE__*/new Map());
3075
3048
  /** @internal */
3076
- const empty$i = () => _empty$6;
3049
+ const empty$j = () => _empty$6;
3077
3050
  /** @internal */
3078
- const make$k = (tag, service) => makeContext(new Map([[tag.key, service]]));
3051
+ const make$n = (tag, service) => makeContext(new Map([[tag.key, service]]));
3079
3052
  /** @internal */
3080
3053
  const add$3 = /*#__PURE__*/dual(3, (self, tag, service) => {
3081
3054
  const map = new Map(self.unsafeMap);
@@ -3150,7 +3123,7 @@ const GenericTag = makeGenericTag;
3150
3123
  * @since 2.0.0
3151
3124
  * @category constructors
3152
3125
  */
3153
- const empty$h = empty$i;
3126
+ const empty$i = empty$j;
3154
3127
  /**
3155
3128
  * Creates a new `Context` with a single service associated to the tag.
3156
3129
  *
@@ -3169,7 +3142,7 @@ const empty$h = empty$i;
3169
3142
  * @since 2.0.0
3170
3143
  * @category constructors
3171
3144
  */
3172
- const make$j = make$k;
3145
+ const make$m = make$n;
3173
3146
  /**
3174
3147
  * Adds a service to a given `Context`.
3175
3148
  *
@@ -3348,7 +3321,7 @@ const Reference = Reference$1;
3348
3321
  /**
3349
3322
  * @since 2.0.0
3350
3323
  */
3351
- const TypeId$6 = /*#__PURE__*/Symbol.for("effect/Chunk");
3324
+ const TypeId$8 = /*#__PURE__*/Symbol.for("effect/Chunk");
3352
3325
  function copy(src, srcPos, dest, destPos, len) {
3353
3326
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
3354
3327
  dest[destPos + i - srcPos] = src[i];
@@ -3362,10 +3335,10 @@ const emptyArray = [];
3362
3335
  * @category equivalence
3363
3336
  * @since 2.0.0
3364
3337
  */
3365
- const getEquivalence$1 = isEquivalent => make$n((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3338
+ const getEquivalence$1 = isEquivalent => make$q((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet(that, i))));
3366
3339
  const _equivalence$1 = /*#__PURE__*/getEquivalence$1(equals$1);
3367
3340
  const ChunkProto = {
3368
- [TypeId$6]: {
3341
+ [TypeId$8]: {
3369
3342
  _A: _ => _
3370
3343
  },
3371
3344
  toString() {
@@ -3459,7 +3432,7 @@ const makeChunk = backing => {
3459
3432
  * @category constructors
3460
3433
  * @since 2.0.0
3461
3434
  */
3462
- const isChunk = u => hasProperty(u, TypeId$6);
3435
+ const isChunk = u => hasProperty(u, TypeId$8);
3463
3436
  const _empty$5 = /*#__PURE__*/makeChunk({
3464
3437
  _tag: "IEmpty"
3465
3438
  });
@@ -3467,14 +3440,14 @@ const _empty$5 = /*#__PURE__*/makeChunk({
3467
3440
  * @category constructors
3468
3441
  * @since 2.0.0
3469
3442
  */
3470
- const empty$g = () => _empty$5;
3443
+ const empty$h = () => _empty$5;
3471
3444
  /**
3472
3445
  * Builds a `NonEmptyChunk` from an non-empty collection of elements.
3473
3446
  *
3474
3447
  * @category constructors
3475
3448
  * @since 2.0.0
3476
3449
  */
3477
- const make$i = (...as) => unsafeFromNonEmptyArray(as);
3450
+ const make$l = (...as) => unsafeFromNonEmptyArray(as);
3478
3451
  /**
3479
3452
  * Builds a `NonEmptyChunk` from a single element.
3480
3453
  *
@@ -3607,7 +3580,7 @@ const reverse$1 = reverseChunk;
3607
3580
  * @since 2.0.0
3608
3581
  * @category unsafe
3609
3582
  */
3610
- const unsafeFromArray = self => self.length === 0 ? empty$g() : self.length === 1 ? of$1(self[0]) : makeChunk({
3583
+ const unsafeFromArray = self => self.length === 0 ? empty$h() : self.length === 1 ? of$1(self[0]) : makeChunk({
3611
3584
  _tag: "IArray",
3612
3585
  array: self
3613
3586
  });
@@ -3660,7 +3633,7 @@ const unsafeGet = /*#__PURE__*/dual(2, (self, index) => {
3660
3633
  * @category concatenating
3661
3634
  * @since 2.0.0
3662
3635
  */
3663
- const append = /*#__PURE__*/dual(2, (self, a) => appendAll$1(self, of$1(a)));
3636
+ const append$1 = /*#__PURE__*/dual(2, (self, a) => appendAll$1(self, of$1(a)));
3664
3637
  /**
3665
3638
  * Prepend an element to the front of a `Chunk`, creating a new `NonEmptyChunk`.
3666
3639
  *
@@ -3820,7 +3793,7 @@ const appendAll$1 = /*#__PURE__*/dual(2, (self, that) => {
3820
3793
  * @since 2.0.0
3821
3794
  * @category elements
3822
3795
  */
3823
- const isEmpty$3 = self => self.length === 0;
3796
+ const isEmpty$4 = self => self.length === 0;
3824
3797
  /**
3825
3798
  * Determines if the chunk is not empty.
3826
3799
  *
@@ -3855,7 +3828,7 @@ const tailNonEmpty = self => drop(self, 1);
3855
3828
  /**
3856
3829
  * @since 2.0.0
3857
3830
  */
3858
- const TypeId$5 = /*#__PURE__*/Symbol.for("effect/Duration");
3831
+ const TypeId$7 = /*#__PURE__*/Symbol.for("effect/Duration");
3859
3832
  const bigint0$1 = /*#__PURE__*/BigInt(0);
3860
3833
  const bigint24 = /*#__PURE__*/BigInt(24);
3861
3834
  const bigint60 = /*#__PURE__*/BigInt(60);
@@ -3924,7 +3897,7 @@ const infinityValue = {
3924
3897
  _tag: "Infinity"
3925
3898
  };
3926
3899
  const DurationProto = {
3927
- [TypeId$5]: TypeId$5,
3900
+ [TypeId$7]: TypeId$7,
3928
3901
  [symbol$1]() {
3929
3902
  return cached(this, structure(this.value));
3930
3903
  },
@@ -3962,7 +3935,7 @@ const DurationProto = {
3962
3935
  return pipeArguments(this, arguments);
3963
3936
  }
3964
3937
  };
3965
- const make$h = input => {
3938
+ const make$k = input => {
3966
3939
  const duration = Object.create(DurationProto);
3967
3940
  if (isNumber(input)) {
3968
3941
  if (isNaN(input) || input <= 0) {
@@ -3994,7 +3967,7 @@ const make$h = input => {
3994
3967
  * @since 2.0.0
3995
3968
  * @category guards
3996
3969
  */
3997
- const isDuration = u => hasProperty(u, TypeId$5);
3970
+ const isDuration = u => hasProperty(u, TypeId$7);
3998
3971
  /**
3999
3972
  * @since 3.5.0
4000
3973
  * @category guards
@@ -4019,52 +3992,52 @@ const isZero = self => {
4019
3992
  * @since 2.0.0
4020
3993
  * @category constructors
4021
3994
  */
4022
- const zero = /*#__PURE__*/make$h(0);
3995
+ const zero = /*#__PURE__*/make$k(0);
4023
3996
  /**
4024
3997
  * @since 2.0.0
4025
3998
  * @category constructors
4026
3999
  */
4027
- const infinity = /*#__PURE__*/make$h(Infinity);
4000
+ const infinity = /*#__PURE__*/make$k(Infinity);
4028
4001
  /**
4029
4002
  * @since 2.0.0
4030
4003
  * @category constructors
4031
4004
  */
4032
- const nanos = nanos => make$h(nanos);
4005
+ const nanos = nanos => make$k(nanos);
4033
4006
  /**
4034
4007
  * @since 2.0.0
4035
4008
  * @category constructors
4036
4009
  */
4037
- const micros = micros => make$h(micros * bigint1e3);
4010
+ const micros = micros => make$k(micros * bigint1e3);
4038
4011
  /**
4039
4012
  * @since 2.0.0
4040
4013
  * @category constructors
4041
4014
  */
4042
- const millis = millis => make$h(millis);
4015
+ const millis = millis => make$k(millis);
4043
4016
  /**
4044
4017
  * @since 2.0.0
4045
4018
  * @category constructors
4046
4019
  */
4047
- const seconds = seconds => make$h(seconds * 1000);
4020
+ const seconds = seconds => make$k(seconds * 1000);
4048
4021
  /**
4049
4022
  * @since 2.0.0
4050
4023
  * @category constructors
4051
4024
  */
4052
- const minutes = minutes => make$h(minutes * 60_000);
4025
+ const minutes = minutes => make$k(minutes * 60_000);
4053
4026
  /**
4054
4027
  * @since 2.0.0
4055
4028
  * @category constructors
4056
4029
  */
4057
- const hours = hours => make$h(hours * 3_600_000);
4030
+ const hours = hours => make$k(hours * 3_600_000);
4058
4031
  /**
4059
4032
  * @since 2.0.0
4060
4033
  * @category constructors
4061
4034
  */
4062
- const days = days => make$h(days * 86_400_000);
4035
+ const days = days => make$k(days * 86_400_000);
4063
4036
  /**
4064
4037
  * @since 2.0.0
4065
4038
  * @category constructors
4066
4039
  */
4067
- const weeks = weeks => make$h(weeks * 604_800_000);
4040
+ const weeks = weeks => make$k(weeks * 604_800_000);
4068
4041
  /**
4069
4042
  * @since 2.0.0
4070
4043
  * @category getters
@@ -4283,7 +4256,7 @@ function fromBitmap(bitmap, bit) {
4283
4256
  return popcount(bitmap & bit - 1);
4284
4257
  }
4285
4258
 
4286
- const make$g = (value, previous) => ({
4259
+ const make$j = (value, previous) => ({
4287
4260
  value,
4288
4261
  previous
4289
4262
  });
@@ -4569,7 +4542,7 @@ function mergeLeaves(edit, shift, h1, n1, h2, n2) {
4569
4542
  while (true) {
4570
4543
  const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
4571
4544
  if (typeof res === "function") {
4572
- stack = make$g(res, stack);
4545
+ stack = make$j(res, stack);
4573
4546
  currentShift = currentShift + SIZE;
4574
4547
  } else {
4575
4548
  let final = res;
@@ -4704,10 +4677,10 @@ const visitLazyChildren = (len, children, i, f, cont) => {
4704
4677
  };
4705
4678
  const _empty$4 = /*#__PURE__*/makeImpl$1(false, 0, /*#__PURE__*/new EmptyNode(), 0);
4706
4679
  /** @internal */
4707
- const empty$f = () => _empty$4;
4680
+ const empty$g = () => _empty$4;
4708
4681
  /** @internal */
4709
4682
  const fromIterable$4 = entries => {
4710
- const map = beginMutation$1(empty$f());
4683
+ const map = beginMutation$1(empty$g());
4711
4684
  for (const entry of entries) {
4712
4685
  set$3(map, entry[0], entry[1]);
4713
4686
  }
@@ -4716,7 +4689,7 @@ const fromIterable$4 = entries => {
4716
4689
  /** @internal */
4717
4690
  const isHashMap = u => hasProperty(u, HashMapTypeId);
4718
4691
  /** @internal */
4719
- const isEmpty$2 = self => self && isEmptyNode(self._root);
4692
+ const isEmpty$3 = self => self && isEmptyNode(self._root);
4720
4693
  /** @internal */
4721
4694
  const get$4 = /*#__PURE__*/dual(2, (self, key) => getHash(self, key, hash(key)));
4722
4695
  /** @internal */
@@ -4802,14 +4775,14 @@ const modifyHash = /*#__PURE__*/dual(4, (self, key, hash, f) => {
4802
4775
  return pipe(self, setTree(newRoot, size.value));
4803
4776
  });
4804
4777
  /** @internal */
4805
- const remove$3 = /*#__PURE__*/dual(2, (self, key) => modifyAt$1(self, key, none$4));
4778
+ const remove$4 = /*#__PURE__*/dual(2, (self, key) => modifyAt$1(self, key, none$4));
4806
4779
  /**
4807
4780
  * Maps over the entries of the `HashMap` using the specified function.
4808
4781
  *
4809
4782
  * @since 2.0.0
4810
4783
  * @category mapping
4811
4784
  */
4812
- const map$2 = /*#__PURE__*/dual(2, (self, f) => reduce$5(self, empty$f(), (map, value, key) => set$3(map, key, f(value, key))));
4785
+ const map$2 = /*#__PURE__*/dual(2, (self, f) => reduce$5(self, empty$g(), (map, value, key) => set$3(map, key, f(value, key))));
4813
4786
  /** @internal */
4814
4787
  const forEach$2 = /*#__PURE__*/dual(2, (self, f) => reduce$5(self, void 0, (_, value, key) => f(value, key)));
4815
4788
  /** @internal */
@@ -4881,20 +4854,20 @@ const makeImpl = keyMap => {
4881
4854
  };
4882
4855
  /** @internal */
4883
4856
  const isHashSet = u => hasProperty(u, HashSetTypeId);
4884
- const _empty$3 = /*#__PURE__*/makeImpl(/*#__PURE__*/empty$f());
4857
+ const _empty$3 = /*#__PURE__*/makeImpl(/*#__PURE__*/empty$g());
4885
4858
  /** @internal */
4886
- const empty$e = () => _empty$3;
4859
+ const empty$f = () => _empty$3;
4887
4860
  /** @internal */
4888
4861
  const fromIterable$3 = elements => {
4889
- const set = beginMutation(empty$e());
4862
+ const set = beginMutation(empty$f());
4890
4863
  for (const value of elements) {
4891
4864
  add$1(set, value);
4892
4865
  }
4893
4866
  return endMutation(set);
4894
4867
  };
4895
4868
  /** @internal */
4896
- const make$f = (...elements) => {
4897
- const set = beginMutation(empty$e());
4869
+ const make$i = (...elements) => {
4870
+ const set = beginMutation(empty$f());
4898
4871
  for (const value of elements) {
4899
4872
  add$1(set, value);
4900
4873
  }
@@ -4920,15 +4893,15 @@ const mutate = /*#__PURE__*/dual(2, (self, f) => {
4920
4893
  /** @internal */
4921
4894
  const add$1 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (set$3(value, true)(self._keyMap), self) : makeImpl(set$3(value, true)(self._keyMap)));
4922
4895
  /** @internal */
4923
- const remove$2 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (remove$3(value)(self._keyMap), self) : makeImpl(remove$3(value)(self._keyMap)));
4896
+ const remove$3 = /*#__PURE__*/dual(2, (self, value) => self._keyMap._editable ? (remove$4(value)(self._keyMap), self) : makeImpl(remove$4(value)(self._keyMap)));
4924
4897
  /** @internal */
4925
4898
  const difference$1 = /*#__PURE__*/dual(2, (self, that) => mutate(self, set => {
4926
4899
  for (const value of that) {
4927
- remove$2(set, value);
4900
+ remove$3(set, value);
4928
4901
  }
4929
4902
  }));
4930
4903
  /** @internal */
4931
- const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$e(), set => {
4904
+ const union$1 = /*#__PURE__*/dual(2, (self, that) => mutate(empty$f(), set => {
4932
4905
  forEach$1(self, value => add$1(set, value));
4933
4906
  for (const value of that) {
4934
4907
  add$1(set, value);
@@ -5219,7 +5192,7 @@ const reduce$4 = /*#__PURE__*/dual(3, (self, zero, f) => reduce$5(self._keyMap,
5219
5192
  *
5220
5193
  * @see Other `HashSet` constructors are {@link module:HashSet.make} {@link module:HashSet.fromIterable}
5221
5194
  */
5222
- const empty$d = empty$e;
5195
+ const empty$e = empty$f;
5223
5196
  /**
5224
5197
  * Creates a new `HashSet` from an iterable collection of values.
5225
5198
  *
@@ -5401,7 +5374,7 @@ const fromIterable$2 = fromIterable$3;
5401
5374
  *
5402
5375
  * @see Other `HashSet` constructors are {@link module:HashSet.fromIterable} {@link module:HashSet.empty}
5403
5376
  */
5404
- const make$e = make$f;
5377
+ const make$h = make$i;
5405
5378
  /**
5406
5379
  * Checks if the specified value exists in the `HashSet`.
5407
5380
  *
@@ -5513,7 +5486,7 @@ const add = add$1;
5513
5486
  *
5514
5487
  * @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
5515
5488
  */
5516
- const remove$1 = remove$2;
5489
+ const remove$2 = remove$3;
5517
5490
  /**
5518
5491
  * Computes the set difference `(A - B)` between this `HashSet` and the
5519
5492
  * specified `Iterable<A>`.
@@ -5607,9 +5580,9 @@ const reduce$3 = reduce$4;
5607
5580
  /**
5608
5581
  * @since 2.0.0
5609
5582
  */
5610
- const TypeId$4 = /*#__PURE__*/Symbol.for("effect/MutableRef");
5583
+ const TypeId$6 = /*#__PURE__*/Symbol.for("effect/MutableRef");
5611
5584
  const MutableRefProto = {
5612
- [TypeId$4]: TypeId$4,
5585
+ [TypeId$6]: TypeId$6,
5613
5586
  toString() {
5614
5587
  return format$2(this.toJSON());
5615
5588
  },
@@ -5630,7 +5603,7 @@ const MutableRefProto = {
5630
5603
  * @since 2.0.0
5631
5604
  * @category constructors
5632
5605
  */
5633
- const make$d = value => {
5606
+ const make$g = value => {
5634
5607
  const ref = Object.create(MutableRefProto);
5635
5608
  ref.current = value;
5636
5609
  return ref;
@@ -5736,11 +5709,11 @@ const ids = self => {
5736
5709
  switch (self._tag) {
5737
5710
  case OP_NONE:
5738
5711
  {
5739
- return empty$d();
5712
+ return empty$e();
5740
5713
  }
5741
5714
  case OP_RUNTIME:
5742
5715
  {
5743
- return make$e(self.id);
5716
+ return make$h(self.id);
5744
5717
  }
5745
5718
  case OP_COMPOSITE:
5746
5719
  {
@@ -5748,14 +5721,14 @@ const ids = self => {
5748
5721
  }
5749
5722
  }
5750
5723
  };
5751
- const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$d(0));
5724
+ const _fiberCounter = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Fiber/Id/_fiberCounter"), () => make$g(0));
5752
5725
  /** @internal */
5753
5726
  const threadName$1 = self => {
5754
5727
  const identifiers = Array.from(ids(self)).map(n => `#${n}`).join(",");
5755
5728
  return identifiers;
5756
5729
  };
5757
5730
  /** @internal */
5758
- const unsafeMake$4 = () => {
5731
+ const unsafeMake$5 = () => {
5759
5732
  const id = get$3(_fiberCounter);
5760
5733
  pipe(_fiberCounter, set$2(id + 1));
5761
5734
  return new Runtime(id, Date.now());
@@ -5780,7 +5753,7 @@ const threadName = threadName$1;
5780
5753
  * @since 2.0.0
5781
5754
  * @category unsafe
5782
5755
  */
5783
- const unsafeMake$3 = unsafeMake$4;
5756
+ const unsafeMake$4 = unsafeMake$5;
5784
5757
 
5785
5758
  /**
5786
5759
  * @since 2.0.0
@@ -5791,7 +5764,7 @@ const unsafeMake$3 = unsafeMake$4;
5791
5764
  * @since 2.0.0
5792
5765
  * @category constructors
5793
5766
  */
5794
- const empty$c = empty$f;
5767
+ const empty$d = empty$g;
5795
5768
  /**
5796
5769
  * Creates a new `HashMap` from an iterable collection of key/value pairs.
5797
5770
  *
@@ -5805,7 +5778,7 @@ const fromIterable$1 = fromIterable$4;
5805
5778
  * @since 2.0.0
5806
5779
  * @category elements
5807
5780
  */
5808
- const isEmpty$1 = isEmpty$2;
5781
+ const isEmpty$2 = isEmpty$3;
5809
5782
  /**
5810
5783
  * Safely lookup the value for the specified key in the `HashMap` using the
5811
5784
  * internal hashing function.
@@ -5880,7 +5853,7 @@ const reduce$2 = reduce$5;
5880
5853
  * @since 2.0.0
5881
5854
  * @category symbol
5882
5855
  */
5883
- const TypeId$3 = /*#__PURE__*/Symbol.for("effect/List");
5856
+ const TypeId$5 = /*#__PURE__*/Symbol.for("effect/List");
5884
5857
  /**
5885
5858
  * Converts the specified `List` to an `Array`.
5886
5859
  *
@@ -5895,7 +5868,7 @@ const toArray = self => fromIterable$6(self);
5895
5868
  const getEquivalence = isEquivalent => mapInput$1(getEquivalence$2(isEquivalent), toArray);
5896
5869
  const _equivalence = /*#__PURE__*/getEquivalence(equals$1);
5897
5870
  const ConsProto = {
5898
- [TypeId$3]: TypeId$3,
5871
+ [TypeId$5]: TypeId$5,
5899
5872
  _tag: "Cons",
5900
5873
  toString() {
5901
5874
  return format$2(this.toJSON());
@@ -5959,7 +5932,7 @@ const makeCons = (head, tail) => {
5959
5932
  };
5960
5933
  const NilHash = /*#__PURE__*/string("Nil");
5961
5934
  const NilProto = {
5962
- [TypeId$3]: TypeId$3,
5935
+ [TypeId$5]: TypeId$5,
5963
5936
  _tag: "Nil",
5964
5937
  toString() {
5965
5938
  return format$2(this.toJSON());
@@ -6000,7 +5973,7 @@ const _Nil = /*#__PURE__*/Object.create(NilProto);
6000
5973
  * @since 2.0.0
6001
5974
  * @category refinements
6002
5975
  */
6003
- const isList = u => hasProperty(u, TypeId$3);
5976
+ const isList = u => hasProperty(u, TypeId$5);
6004
5977
  /**
6005
5978
  * Returns `true` if the specified value is a `List.Nil<A>`, `false` otherwise.
6006
5979
  *
@@ -6037,7 +6010,7 @@ const cons = (head, tail) => makeCons(head, tail);
6037
6010
  * @since 2.0.0
6038
6011
  * @category constructors
6039
6012
  */
6040
- const empty$b = nil;
6013
+ const empty$c = nil;
6041
6014
  /**
6042
6015
  * Constructs a new `List<A>` from the specified value.
6043
6016
  *
@@ -6130,7 +6103,7 @@ const reduce$1 = /*#__PURE__*/dual(3, (self, zero, f) => {
6130
6103
  * @category elements
6131
6104
  */
6132
6105
  const reverse = self => {
6133
- let result = empty$b();
6106
+ let result = empty$c();
6134
6107
  let these = self;
6135
6108
  while (!isNil(these)) {
6136
6109
  result = prepend(result, these.head);
@@ -6172,7 +6145,7 @@ const _empty$2 = /*#__PURE__*/Object.create(EmptyProto$2);
6172
6145
  /**
6173
6146
  * @internal
6174
6147
  */
6175
- const empty$a = () => _empty$2;
6148
+ const empty$b = () => _empty$2;
6176
6149
  const AndThenProto$2 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$2), {
6177
6150
  _tag: "AndThen"
6178
6151
  });
@@ -6211,7 +6184,7 @@ const makeUpdateService = (key, update) => {
6211
6184
  /** @internal */
6212
6185
  const diff$6 = (oldValue, newValue) => {
6213
6186
  const missingServices = new Map(oldValue.unsafeMap);
6214
- let patch = empty$a();
6187
+ let patch = empty$b();
6215
6188
  for (const [tag, newService] of newValue.unsafeMap.entries()) {
6216
6189
  if (missingServices.has(tag)) {
6217
6190
  const old = missingServices.get(tag);
@@ -6309,7 +6282,7 @@ const EmptyProto$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(Patch
6309
6282
  });
6310
6283
  const _empty$1 = /*#__PURE__*/Object.create(EmptyProto$1);
6311
6284
  /** @internal */
6312
- const empty$9 = () => _empty$1;
6285
+ const empty$a = () => _empty$1;
6313
6286
  const AndThenProto$1 = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto$1), {
6314
6287
  _tag: "AndThen"
6315
6288
  });
@@ -6340,9 +6313,9 @@ const makeRemove = value => {
6340
6313
  };
6341
6314
  /** @internal */
6342
6315
  const diff$5 = (oldValue, newValue) => {
6343
- const [removed, patch] = reduce$3([oldValue, empty$9()], ([set, patch], value) => {
6316
+ const [removed, patch] = reduce$3([oldValue, empty$a()], ([set, patch], value) => {
6344
6317
  if (has$1(value)(set)) {
6345
- return [remove$1(value)(set), patch];
6318
+ return [remove$2(value)(set), patch];
6346
6319
  }
6347
6320
  return [set, combine$3(makeAdd(value))(patch)];
6348
6321
  })(newValue);
@@ -6379,7 +6352,7 @@ const patch$6 = /*#__PURE__*/dual(2, (self, oldValue) => {
6379
6352
  }
6380
6353
  case "Remove":
6381
6354
  {
6382
- set = remove$1(head.value)(set);
6355
+ set = remove$2(head.value)(set);
6383
6356
  patches = tail;
6384
6357
  }
6385
6358
  }
@@ -6406,7 +6379,7 @@ const _empty = /*#__PURE__*/Object.create(EmptyProto);
6406
6379
  /**
6407
6380
  * @internal
6408
6381
  */
6409
- const empty$8 = () => _empty;
6382
+ const empty$9 = () => _empty;
6410
6383
  const AndThenProto = /*#__PURE__*/Object.assign(/*#__PURE__*/Object.create(PatchProto), {
6411
6384
  _tag: "AndThen"
6412
6385
  });
@@ -6445,7 +6418,7 @@ const makeUpdate = (index, patch) => {
6445
6418
  /** @internal */
6446
6419
  const diff$4 = options => {
6447
6420
  let i = 0;
6448
- let patch = empty$8();
6421
+ let patch = empty$9();
6449
6422
  while (i < options.oldValue.length && i < options.newValue.length) {
6450
6423
  const oldElement = options.oldValue[i];
6451
6424
  const newElement = options.newValue[i];
@@ -6525,7 +6498,7 @@ const DifferProto = {
6525
6498
  }
6526
6499
  };
6527
6500
  /** @internal */
6528
- const make$c = params => {
6501
+ const make$f = params => {
6529
6502
  const differ = Object.create(DifferProto);
6530
6503
  differ.empty = params.empty;
6531
6504
  differ.diff = params.diff;
@@ -6534,22 +6507,22 @@ const make$c = params => {
6534
6507
  return differ;
6535
6508
  };
6536
6509
  /** @internal */
6537
- const environment = () => make$c({
6538
- empty: empty$a(),
6510
+ const environment = () => make$f({
6511
+ empty: empty$b(),
6539
6512
  combine: (first, second) => combine$4(second)(first),
6540
6513
  diff: (oldValue, newValue) => diff$6(oldValue, newValue),
6541
6514
  patch: (patch, oldValue) => patch$7(oldValue)(patch)
6542
6515
  });
6543
6516
  /** @internal */
6544
- const hashSet = () => make$c({
6545
- empty: empty$9(),
6517
+ const hashSet = () => make$f({
6518
+ empty: empty$a(),
6546
6519
  combine: (first, second) => combine$3(second)(first),
6547
6520
  diff: (oldValue, newValue) => diff$5(oldValue, newValue),
6548
6521
  patch: (patch, oldValue) => patch$6(oldValue)(patch)
6549
6522
  });
6550
6523
  /** @internal */
6551
- const readonlyArray = differ => make$c({
6552
- empty: empty$8(),
6524
+ const readonlyArray = differ => make$f({
6525
+ empty: empty$9(),
6553
6526
  combine: (first, second) => combine$2(first, second),
6554
6527
  diff: (oldValue, newValue) => diff$4({
6555
6528
  oldValue,
@@ -6561,7 +6534,7 @@ const readonlyArray = differ => make$c({
6561
6534
  /** @internal */
6562
6535
  const update$1 = () => updateWith((_, a) => a);
6563
6536
  /** @internal */
6564
- const updateWith = f => make$c({
6537
+ const updateWith = f => make$f({
6565
6538
  empty: identity,
6566
6539
  combine: (first, second) => {
6567
6540
  if (first === identity) {
@@ -6590,15 +6563,15 @@ const active = patch => patch & BIT_MASK;
6590
6563
  /** @internal */
6591
6564
  const enabled = patch => patch >> BIT_SHIFT & BIT_MASK;
6592
6565
  /** @internal */
6593
- const make$b = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6566
+ const make$e = (active, enabled) => (active & BIT_MASK) + ((enabled & active & BIT_MASK) << BIT_SHIFT);
6594
6567
  /** @internal */
6595
- const empty$7 = /*#__PURE__*/make$b(0, 0);
6568
+ const empty$8 = /*#__PURE__*/make$e(0, 0);
6596
6569
  /** @internal */
6597
- const enable$2 = flag => make$b(flag, flag);
6570
+ const enable$2 = flag => make$e(flag, flag);
6598
6571
  /** @internal */
6599
- const disable$1 = flag => make$b(flag, 0);
6572
+ const disable$1 = flag => make$e(flag, 0);
6600
6573
  /** @internal */
6601
- const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$b(active(self) & ~flag, enabled(self)));
6574
+ const exclude$1 = /*#__PURE__*/dual(2, (self, flag) => make$e(active(self) & ~flag, enabled(self)));
6602
6575
  /** @internal */
6603
6576
  const andThen = /*#__PURE__*/dual(2, (self, that) => self | that);
6604
6577
  /** @internal */
@@ -6627,19 +6600,19 @@ const interruption = self => isEnabled(self, Interruption);
6627
6600
  /** @internal */
6628
6601
  const isEnabled = /*#__PURE__*/dual(2, (self, flag) => (self & flag) !== 0);
6629
6602
  /** @internal */
6630
- const make$a = (...flags) => flags.reduce((a, b) => a | b, 0);
6603
+ const make$d = (...flags) => flags.reduce((a, b) => a | b, 0);
6631
6604
  /** @internal */
6632
- const none$1 = /*#__PURE__*/make$a(None$1);
6605
+ const none$1 = /*#__PURE__*/make$d(None$1);
6633
6606
  /** @internal */
6634
6607
  const runtimeMetrics = self => isEnabled(self, RuntimeMetrics);
6635
6608
  const windDown = self => isEnabled(self, WindDown);
6636
6609
  /** @internal */
6637
- const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$b(self ^ that, that));
6610
+ const diff$3 = /*#__PURE__*/dual(2, (self, that) => make$e(self ^ that, that));
6638
6611
  /** @internal */
6639
6612
  const patch$4 = /*#__PURE__*/dual(2, (self, patch) => self & (invert(active(patch)) | enabled(patch)) | active(patch) & enabled(patch));
6640
6613
  /** @internal */
6641
- const differ$1 = /*#__PURE__*/make$c({
6642
- empty: empty$7,
6614
+ const differ$1 = /*#__PURE__*/make$f({
6615
+ empty: empty$8,
6643
6616
  diff: (oldValue, newValue) => diff$3(oldValue, newValue),
6644
6617
  combine: (first, second) => andThen(second)(first),
6645
6618
  patch: (_patch, oldValue) => patch$4(oldValue, _patch)
@@ -6701,10 +6674,10 @@ const seq = (self, that) => ({
6701
6674
  */
6702
6675
  const flatten$1 = self => {
6703
6676
  let current = of(self);
6704
- let updated = empty$b();
6677
+ let updated = empty$c();
6705
6678
  // eslint-disable-next-line no-constant-condition
6706
6679
  while (1) {
6707
- const [parallel, sequential] = reduce$1(current, [parallelCollectionEmpty(), empty$b()], ([parallel, sequential], blockedRequest) => {
6680
+ const [parallel, sequential] = reduce$1(current, [parallelCollectionEmpty(), empty$c()], ([parallel, sequential], blockedRequest) => {
6708
6681
  const [par, seq] = step$1(blockedRequest);
6709
6682
  return [parallelCollectionCombine(parallel, par), appendAll(sequential, seq)];
6710
6683
  });
@@ -6725,8 +6698,8 @@ const flatten$1 = self => {
6725
6698
  const step$1 = requests => {
6726
6699
  let current = requests;
6727
6700
  let parallel = parallelCollectionEmpty();
6728
- let stack = empty$b();
6729
- let sequential = empty$b();
6701
+ let stack = empty$c();
6702
+ let sequential = empty$c();
6730
6703
  // eslint-disable-next-line no-constant-condition
6731
6704
  while (1) {
6732
6705
  switch (current._tag) {
@@ -6826,16 +6799,16 @@ class ParallelImpl {
6826
6799
  }
6827
6800
  }
6828
6801
  /** @internal */
6829
- const parallelCollectionEmpty = () => new ParallelImpl(empty$c());
6802
+ const parallelCollectionEmpty = () => new ParallelImpl(empty$d());
6830
6803
  /** @internal */
6831
- const parallelCollectionAdd = (self, blockedRequest) => new ParallelImpl(modifyAt(self.map, blockedRequest.dataSource, _ => orElseSome(map$4(_, append(blockedRequest.blockedRequest)), () => of$1(blockedRequest.blockedRequest))));
6804
+ const parallelCollectionAdd = (self, blockedRequest) => new ParallelImpl(modifyAt(self.map, blockedRequest.dataSource, _ => orElseSome(map$4(_, append$1(blockedRequest.blockedRequest)), () => of$1(blockedRequest.blockedRequest))));
6832
6805
  /** @internal */
6833
6806
  const parallelCollectionCombine = (self, that) => new ParallelImpl(reduce$2(self.map, that.map, (map, value, key) => set$1(map, key, match$3(get$2(map, key), {
6834
6807
  onNone: () => value,
6835
6808
  onSome: other => appendAll$1(value, other)
6836
6809
  }))));
6837
6810
  /** @internal */
6838
- const parallelCollectionIsEmpty = self => isEmpty$1(self.map);
6811
+ const parallelCollectionIsEmpty = self => isEmpty$2(self.map);
6839
6812
  /** @internal */
6840
6813
  const parallelCollectionKeys = self => Array.from(keys(self.map));
6841
6814
  /** @internal */
@@ -6862,7 +6835,7 @@ class SequentialImpl {
6862
6835
  const sequentialCollectionMake = map => new SequentialImpl(map);
6863
6836
  /** @internal */
6864
6837
  const sequentialCollectionCombine = (self, that) => new SequentialImpl(reduce$2(that.map, self.map, (map, value, key) => set$1(map, key, match$3(get$2(map, key), {
6865
- onNone: () => empty$g(),
6838
+ onNone: () => empty$h(),
6866
6839
  onSome: a => appendAll$1(a, value)
6867
6840
  }))));
6868
6841
  /** @internal */
@@ -6952,13 +6925,13 @@ const proto$1 = {
6952
6925
  // Constructors
6953
6926
  // -----------------------------------------------------------------------------
6954
6927
  /** @internal */
6955
- const empty$6 = /*#__PURE__*/(() => {
6928
+ const empty$7 = /*#__PURE__*/(() => {
6956
6929
  const o = /*#__PURE__*/Object.create(proto$1);
6957
6930
  o._tag = OP_EMPTY$2;
6958
6931
  return o;
6959
6932
  })();
6960
6933
  /** @internal */
6961
- const fail$1 = error => {
6934
+ const fail$2 = error => {
6962
6935
  const o = Object.create(proto$1);
6963
6936
  o._tag = OP_FAIL$1;
6964
6937
  o.error = error;
@@ -6972,7 +6945,7 @@ const die$1 = defect => {
6972
6945
  return o;
6973
6946
  };
6974
6947
  /** @internal */
6975
- const interrupt = fiberId => {
6948
+ const interrupt$1 = fiberId => {
6976
6949
  const o = Object.create(proto$1);
6977
6950
  o._tag = OP_INTERRUPT;
6978
6951
  o.fiberId = fiberId;
@@ -7002,7 +6975,7 @@ const isCause = u => hasProperty(u, CauseTypeId);
7002
6975
  /** @internal */
7003
6976
  const isEmptyType = self => self._tag === OP_EMPTY$2;
7004
6977
  /** @internal */
7005
- const isEmpty = self => {
6978
+ const isEmpty$1 = self => {
7006
6979
  if (self._tag === OP_EMPTY$2) {
7007
6980
  return true;
7008
6981
  }
@@ -7030,11 +7003,11 @@ const isInterrupted = self => isSome(interruptOption(self));
7030
7003
  /** @internal */
7031
7004
  const isInterruptedOnly = self => reduceWithContext(undefined, IsInterruptedOnlyCauseReducer)(self);
7032
7005
  /** @internal */
7033
- const failures = self => reverse$1(reduce(self, empty$g(), (list, cause) => cause._tag === OP_FAIL$1 ? some(pipe(list, prepend$1(cause.error))) : none$4()));
7006
+ const failures = self => reverse$1(reduce(self, empty$h(), (list, cause) => cause._tag === OP_FAIL$1 ? some(pipe(list, prepend$1(cause.error))) : none$4()));
7034
7007
  /** @internal */
7035
- const defects = self => reverse$1(reduce(self, empty$g(), (list, cause) => cause._tag === OP_DIE ? some(pipe(list, prepend$1(cause.defect))) : none$4()));
7008
+ const defects = self => reverse$1(reduce(self, empty$h(), (list, cause) => cause._tag === OP_DIE ? some(pipe(list, prepend$1(cause.defect))) : none$4()));
7036
7009
  /** @internal */
7037
- const interruptors = self => reduce(self, empty$d(), (set, cause) => cause._tag === OP_INTERRUPT ? some(pipe(set, add(cause.fiberId))) : none$4());
7010
+ const interruptors = self => reduce(self, empty$e(), (set, cause) => cause._tag === OP_INTERRUPT ? some(pipe(set, add(cause.fiberId))) : none$4());
7038
7011
  /** @internal */
7039
7012
  const failureOption = self => find(self, cause => cause._tag === OP_FAIL$1 ? some(cause.error) : none$4());
7040
7013
  /** @internal */
@@ -7055,29 +7028,20 @@ const failureOrCause = self => {
7055
7028
  /** @internal */
7056
7029
  const interruptOption = self => find(self, cause => cause._tag === OP_INTERRUPT ? some(cause.fiberId) : none$4());
7057
7030
  /** @internal */
7058
- const keepDefectsAndElectFailures = self => match$1(self, {
7059
- onEmpty: none$4(),
7060
- onFail: failure => some(die$1(failure)),
7061
- onDie: defect => some(die$1(defect)),
7062
- onInterrupt: () => none$4(),
7063
- onSequential: mergeWith(sequential$2),
7064
- onParallel: mergeWith(parallel$2)
7065
- });
7066
- /** @internal */
7067
7031
  const stripFailures = self => match$1(self, {
7068
- onEmpty: empty$6,
7069
- onFail: () => empty$6,
7032
+ onEmpty: empty$7,
7033
+ onFail: () => empty$7,
7070
7034
  onDie: die$1,
7071
- onInterrupt: interrupt,
7035
+ onInterrupt: interrupt$1,
7072
7036
  onSequential: sequential$2,
7073
7037
  onParallel: parallel$2
7074
7038
  });
7075
7039
  /** @internal */
7076
7040
  const electFailures = self => match$1(self, {
7077
- onEmpty: empty$6,
7041
+ onEmpty: empty$7,
7078
7042
  onFail: die$1,
7079
7043
  onDie: die$1,
7080
- onInterrupt: interrupt,
7044
+ onInterrupt: interrupt$1,
7081
7045
  onSequential: sequential$2,
7082
7046
  onParallel: parallel$2
7083
7047
  });
@@ -7086,11 +7050,11 @@ const causeEquals = (left, right) => {
7086
7050
  let leftStack = of$1(left);
7087
7051
  let rightStack = of$1(right);
7088
7052
  while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
7089
- const [leftParallel, leftSequential] = pipe(headNonEmpty(leftStack), reduce([empty$d(), empty$g()], ([parallel, sequential], cause) => {
7053
+ const [leftParallel, leftSequential] = pipe(headNonEmpty(leftStack), reduce([empty$e(), empty$h()], ([parallel, sequential], cause) => {
7090
7054
  const [par, seq] = evaluateCause(cause);
7091
7055
  return some([pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))]);
7092
7056
  }));
7093
- const [rightParallel, rightSequential] = pipe(headNonEmpty(rightStack), reduce([empty$d(), empty$g()], ([parallel, sequential], cause) => {
7057
+ const [rightParallel, rightSequential] = pipe(headNonEmpty(rightStack), reduce([empty$e(), empty$h()], ([parallel, sequential], cause) => {
7094
7058
  const [par, seq] = evaluateCause(cause);
7095
7059
  return some([pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))]);
7096
7060
  }));
@@ -7113,18 +7077,18 @@ const causeEquals = (left, right) => {
7113
7077
  * @internal
7114
7078
  */
7115
7079
  const flattenCause = cause => {
7116
- return flattenCauseLoop(of$1(cause), empty$g());
7080
+ return flattenCauseLoop(of$1(cause), empty$h());
7117
7081
  };
7118
7082
  /** @internal */
7119
7083
  const flattenCauseLoop = (causes, flattened) => {
7120
7084
  // eslint-disable-next-line no-constant-condition
7121
7085
  while (1) {
7122
- const [parallel, sequential] = pipe(causes, reduce$6([empty$d(), empty$g()], ([parallel, sequential], cause) => {
7086
+ const [parallel, sequential] = pipe(causes, reduce$6([empty$e(), empty$h()], ([parallel, sequential], cause) => {
7123
7087
  const [par, seq] = evaluateCause(cause);
7124
7088
  return [pipe(parallel, union(par)), pipe(sequential, appendAll$1(seq))];
7125
7089
  }));
7126
7090
  const updated = size$1(parallel) > 0 ? pipe(flattened, prepend$1(parallel)) : flattened;
7127
- if (isEmpty$3(sequential)) {
7091
+ if (isEmpty$4(sequential)) {
7128
7092
  return reverse$1(updated);
7129
7093
  }
7130
7094
  causes = sequential;
@@ -7175,8 +7139,8 @@ const find = /*#__PURE__*/dual(2, (self, pf) => {
7175
7139
  const evaluateCause = self => {
7176
7140
  let cause = self;
7177
7141
  const stack = [];
7178
- let _parallel = empty$d();
7179
- let _sequential = empty$g();
7142
+ let _parallel = empty$e();
7143
+ let _sequential = empty$h();
7180
7144
  while (cause !== undefined) {
7181
7145
  switch (cause._tag) {
7182
7146
  case OP_EMPTY$2:
@@ -7189,7 +7153,7 @@ const evaluateCause = self => {
7189
7153
  }
7190
7154
  case OP_FAIL$1:
7191
7155
  {
7192
- _parallel = add(_parallel, make$i(cause._tag, cause.error));
7156
+ _parallel = add(_parallel, make$l(cause._tag, cause.error));
7193
7157
  if (stack.length === 0) {
7194
7158
  return [_parallel, _sequential];
7195
7159
  }
@@ -7198,7 +7162,7 @@ const evaluateCause = self => {
7198
7162
  }
7199
7163
  case OP_DIE:
7200
7164
  {
7201
- _parallel = add(_parallel, make$i(cause._tag, cause.defect));
7165
+ _parallel = add(_parallel, make$l(cause._tag, cause.defect));
7202
7166
  if (stack.length === 0) {
7203
7167
  return [_parallel, _sequential];
7204
7168
  }
@@ -7207,7 +7171,7 @@ const evaluateCause = self => {
7207
7171
  }
7208
7172
  case OP_INTERRUPT:
7209
7173
  {
7210
- _parallel = add(_parallel, make$i(cause._tag, cause.fiberId));
7174
+ _parallel = add(_parallel, make$l(cause._tag, cause.fiberId));
7211
7175
  if (stack.length === 0) {
7212
7176
  return [_parallel, _sequential];
7213
7177
  }
@@ -7567,14 +7531,14 @@ const deferredVariance = {
7567
7531
  _A: _ => _
7568
7532
  };
7569
7533
  /** @internal */
7570
- const pending = joiners => {
7534
+ const pending$1 = joiners => {
7571
7535
  return {
7572
7536
  _tag: OP_STATE_PENDING,
7573
7537
  joiners
7574
7538
  };
7575
7539
  };
7576
7540
  /** @internal */
7577
- const done$2 = effect => {
7541
+ const done$3 = effect => {
7578
7542
  return {
7579
7543
  _tag: OP_STATE_DONE,
7580
7544
  effect
@@ -7786,8 +7750,8 @@ const withFiberRuntime = withRuntime => {
7786
7750
  return effect;
7787
7751
  };
7788
7752
  /* @internal */
7789
- const acquireUseRelease = /*#__PURE__*/dual(3, (acquire, use, release) => uninterruptibleMask$1(restore => flatMap$1(acquire, a => flatMap$1(exit(suspend(() => restore(use(a)))), exit => {
7790
- return suspend(() => release(a, exit)).pipe(matchCauseEffect$1({
7753
+ const acquireUseRelease = /*#__PURE__*/dual(3, (acquire, use, release) => uninterruptibleMask$1(restore => flatMap$1(acquire, a => flatMap$1(exit(suspend$1(() => restore(use(a)))), exit => {
7754
+ return suspend$1(() => release(a, exit)).pipe(matchCauseEffect$1({
7791
7755
  onFailure: cause => {
7792
7756
  switch (exit._tag) {
7793
7757
  case OP_FAILURE:
@@ -7800,7 +7764,7 @@ const acquireUseRelease = /*#__PURE__*/dual(3, (acquire, use, release) => uninte
7800
7764
  }));
7801
7765
  }))));
7802
7766
  /* @internal */
7803
- const as = /*#__PURE__*/dual(2, (self, value) => flatMap$1(self, () => succeed$2(value)));
7767
+ const as = /*#__PURE__*/dual(2, (self, value) => flatMap$1(self, () => succeed$3(value)));
7804
7768
  /* @internal */
7805
7769
  const asVoid = self => as(self, void 0);
7806
7770
  /* @internal */
@@ -7846,7 +7810,7 @@ const unsafeAsync = (register, blockingOn = none$2) => {
7846
7810
  return onInterrupt(effect, _ => isEffect(cancelerRef) ? cancelerRef : void_$1);
7847
7811
  };
7848
7812
  /* @internal */
7849
- const asyncInterrupt = (register, blockingOn = none$2) => suspend(() => unsafeAsync(register, blockingOn));
7813
+ const asyncInterrupt = (register, blockingOn = none$2) => suspend$1(() => unsafeAsync(register, blockingOn));
7850
7814
  const async_ = (resume, blockingOn = none$2) => {
7851
7815
  return custom(resume, function () {
7852
7816
  let backingResume = undefined;
@@ -7885,7 +7849,7 @@ const async_ = (resume, blockingOn = none$2) => {
7885
7849
  /* @internal */
7886
7850
  const catchAll$1 = /*#__PURE__*/dual(2, (self, f) => matchEffect(self, {
7887
7851
  onFailure: f,
7888
- onSuccess: succeed$2
7852
+ onSuccess: succeed$3
7889
7853
  }));
7890
7854
  const originalSymbol = /*#__PURE__*/Symbol.for("effect/OriginalAnnotation");
7891
7855
  /* @internal */
@@ -7915,8 +7879,8 @@ const die = defect => isObject(defect) && !(spanSymbol in defect) ? withFiberRun
7915
7879
  const dieMessage = message => failCauseSync(() => die$1(new RuntimeException(message)));
7916
7880
  /* @internal */
7917
7881
  const either = self => matchEffect(self, {
7918
- onFailure: e => succeed$2(left(e)),
7919
- onSuccess: a => succeed$2(right(a))
7882
+ onFailure: e => succeed$3(left(e)),
7883
+ onSuccess: a => succeed$3(right(a))
7920
7884
  });
7921
7885
  /* @internal */
7922
7886
  const exit = self => matchCause(self, {
@@ -7924,9 +7888,9 @@ const exit = self => matchCause(self, {
7924
7888
  onSuccess: exitSucceed$1
7925
7889
  });
7926
7890
  /* @internal */
7927
- const fail = error => isObject(error) && !(spanSymbol in error) ? withFiberRuntime(fiber => failCause$1(fail$1(capture(error, currentSpanFromFiber(fiber))))) : failCause$1(fail$1(error));
7891
+ const fail$1 = error => isObject(error) && !(spanSymbol in error) ? withFiberRuntime(fiber => failCause$1(fail$2(capture(error, currentSpanFromFiber(fiber))))) : failCause$1(fail$2(error));
7928
7892
  /* @internal */
7929
- const failSync = evaluate => flatMap$1(sync(evaluate), fail);
7893
+ const failSync = evaluate => flatMap$1(sync(evaluate), fail$1);
7930
7894
  /* @internal */
7931
7895
  const failCause$1 = cause => {
7932
7896
  const effect = new EffectPrimitiveFailure(OP_FAILURE);
@@ -7936,7 +7900,7 @@ const failCause$1 = cause => {
7936
7900
  /* @internal */
7937
7901
  const failCauseSync = evaluate => flatMap$1(sync(evaluate), failCause$1);
7938
7902
  /* @internal */
7939
- const fiberId = /*#__PURE__*/withFiberRuntime(state => succeed$2(state.id()));
7903
+ const fiberId = /*#__PURE__*/withFiberRuntime(state => succeed$3(state.id()));
7940
7904
  /* @internal */
7941
7905
  const fiberIdWith = f => withFiberRuntime(state => f(state.id()));
7942
7906
  /* @internal */
@@ -7956,8 +7920,8 @@ const step = self => {
7956
7920
  const flatten = self => flatMap$1(self, identity);
7957
7921
  /* @internal */
7958
7922
  const matchCause = /*#__PURE__*/dual(2, (self, options) => matchCauseEffect$1(self, {
7959
- onFailure: cause => succeed$2(options.onFailure(cause)),
7960
- onSuccess: a => succeed$2(options.onSuccess(a))
7923
+ onFailure: cause => succeed$3(options.onFailure(cause)),
7924
+ onSuccess: a => succeed$3(options.onSuccess(a))
7961
7925
  }));
7962
7926
  /* @internal */
7963
7927
  const matchCauseEffect$1 = /*#__PURE__*/dual(2, (self, options) => {
@@ -7983,7 +7947,7 @@ const matchEffect = /*#__PURE__*/dual(2, (self, options) => matchCauseEffect$1(s
7983
7947
  onSuccess: options.onSuccess
7984
7948
  }));
7985
7949
  /* @internal */
7986
- const forEachSequential = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
7950
+ const forEachSequential = /*#__PURE__*/dual(2, (self, f) => suspend$1(() => {
7987
7951
  const arr = fromIterable$6(self);
7988
7952
  const ret = allocate(arr.length);
7989
7953
  let i = 0;
@@ -7996,7 +7960,7 @@ const forEachSequential = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
7996
7960
  }), ret);
7997
7961
  }));
7998
7962
  /* @internal */
7999
- const forEachSequentialDiscard = /*#__PURE__*/dual(2, (self, f) => suspend(() => {
7963
+ const forEachSequentialDiscard = /*#__PURE__*/dual(2, (self, f) => suspend$1(() => {
8000
7964
  const arr = fromIterable$6(self);
8001
7965
  let i = 0;
8002
7966
  return whileLoop({
@@ -8008,7 +7972,7 @@ const forEachSequentialDiscard = /*#__PURE__*/dual(2, (self, f) => suspend(() =>
8008
7972
  });
8009
7973
  }));
8010
7974
  /* @internal */
8011
- const interruptWith = fiberId => failCause$1(interrupt(fiberId));
7975
+ const interruptWith = fiberId => failCause$1(interrupt$1(fiberId));
8012
7976
  /* @internal */
8013
7977
  const interruptible$1 = self => {
8014
7978
  const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
@@ -8038,7 +8002,7 @@ const mapError = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
8038
8002
  }
8039
8003
  }
8040
8004
  },
8041
- onSuccess: succeed$2
8005
+ onSuccess: succeed$3
8042
8006
  }));
8043
8007
  /* @internal */
8044
8008
  const onExit$1 = /*#__PURE__*/dual(2, (self, cleanup) => uninterruptibleMask$1(restore => matchCauseEffect$1(restore(self), {
@@ -8060,15 +8024,13 @@ const onInterrupt = /*#__PURE__*/dual(2, (self, cleanup) => onExit$1(self, exitM
8060
8024
  onSuccess: () => void_$1
8061
8025
  })));
8062
8026
  /* @internal */
8063
- const orElse = /*#__PURE__*/dual(2, (self, that) => attemptOrElse(self, that, succeed$2));
8064
- /* @internal */
8065
- const succeed$2 = value => {
8027
+ const succeed$3 = value => {
8066
8028
  const effect = new EffectPrimitiveSuccess(OP_SUCCESS);
8067
8029
  effect.effect_instruction_i0 = value;
8068
8030
  return effect;
8069
8031
  };
8070
8032
  /* @internal */
8071
- const suspend = evaluate => {
8033
+ const suspend$1 = evaluate => {
8072
8034
  const effect = new EffectPrimitive(OP_COMMIT);
8073
8035
  effect.commit = evaluate;
8074
8036
  return effect;
@@ -8086,10 +8048,10 @@ const tap = /*#__PURE__*/dual(args => args.length === 3 || args.length === 2 &&
8086
8048
  return as(b, a);
8087
8049
  } else if (isPromiseLike(b)) {
8088
8050
  return unsafeAsync(resume => {
8089
- b.then(_ => resume(succeed$2(a)), e => resume(fail(new UnknownException(e, "An unknown error occurred in Effect.tap"))));
8051
+ b.then(_ => resume(succeed$3(a)), e => resume(fail$1(new UnknownException(e, "An unknown error occurred in Effect.tap"))));
8090
8052
  });
8091
8053
  }
8092
- return succeed$2(a);
8054
+ return succeed$3(a);
8093
8055
  }));
8094
8056
  /* @internal */
8095
8057
  const transplant = f => withFiberRuntime(state => {
@@ -8098,17 +8060,6 @@ const transplant = f => withFiberRuntime(state => {
8098
8060
  return f(fiberRefLocally(currentForkScopeOverride, some(scope)));
8099
8061
  });
8100
8062
  /* @internal */
8101
- const attemptOrElse = /*#__PURE__*/dual(3, (self, that, onSuccess) => matchCauseEffect$1(self, {
8102
- onFailure: cause => {
8103
- const defects$1 = defects(cause);
8104
- if (defects$1.length > 0) {
8105
- return failCause$1(getOrThrow(keepDefectsAndElectFailures(cause)));
8106
- }
8107
- return that();
8108
- },
8109
- onSuccess
8110
- }));
8111
- /* @internal */
8112
8063
  const uninterruptible = self => {
8113
8064
  const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
8114
8065
  effect.effect_instruction_i0 = disable(Interruption);
@@ -8122,7 +8073,7 @@ const uninterruptibleMask$1 = f => custom(f, function () {
8122
8073
  effect.effect_instruction_i1 = oldFlags => interruption(oldFlags) ? internalCall(() => this.effect_instruction_i0(interruptible$1)) : internalCall(() => this.effect_instruction_i0(uninterruptible));
8123
8074
  return effect;
8124
8075
  });
8125
- const void_$1 = /*#__PURE__*/succeed$2(void 0);
8076
+ const void_$1 = /*#__PURE__*/succeed$3(void 0);
8126
8077
  /* @internal */
8127
8078
  const updateRuntimeFlags = patch => {
8128
8079
  const effect = new EffectPrimitive(OP_UPDATE_RUNTIME_FLAGS);
@@ -8139,15 +8090,15 @@ const whileLoop = options => {
8139
8090
  return effect;
8140
8091
  };
8141
8092
  /* @internal */
8142
- const fromIterator = iterator => suspend(() => {
8093
+ const fromIterator$1 = iterator => suspend$1(() => {
8143
8094
  const effect = new EffectPrimitive(OP_ITERATOR);
8144
8095
  effect.effect_instruction_i0 = iterator();
8145
8096
  return effect;
8146
8097
  });
8147
8098
  /* @internal */
8148
- const gen$1 = function () {
8099
+ const gen$2 = function () {
8149
8100
  const f = arguments.length === 1 ? arguments[0] : arguments[1].bind(arguments[0]);
8150
- return fromIterator(() => f(pipe));
8101
+ return fromIterator$1(() => f(pipe));
8151
8102
  };
8152
8103
  /* @internal */
8153
8104
  const yieldNow$2 = options => {
@@ -8271,7 +8222,7 @@ const fiberRefSet = /*#__PURE__*/dual(2, (self, value) => fiberRefModify(self, (
8271
8222
  const fiberRefModify = /*#__PURE__*/dual(2, (self, f) => withFiberRuntime(state => {
8272
8223
  const [b, a] = f(state.getFiberRef(self));
8273
8224
  state.setFiberRef(self, a);
8274
- return succeed$2(b);
8225
+ return succeed$3(b);
8275
8226
  }));
8276
8227
  /* @internal */
8277
8228
  const fiberRefLocally = /*#__PURE__*/dual(3, (use, self, value) => acquireUseRelease(zipLeft(fiberRefGet(self), fiberRefSet(self, value)), () => use, oldValue => fiberRefSet(self, oldValue)));
@@ -8328,17 +8279,17 @@ const fiberRefUnsafeMakeRuntimeFlags = initial => fiberRefUnsafeMakePatch(initia
8328
8279
  fork: differ$1.empty
8329
8280
  });
8330
8281
  /** @internal */
8331
- const currentContext = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentContext"), () => fiberRefUnsafeMakeContext(empty$h()));
8282
+ const currentContext = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentContext"), () => fiberRefUnsafeMakeContext(empty$i()));
8332
8283
  /** @internal */
8333
8284
  const currentSchedulingPriority = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentSchedulingPriority"), () => fiberRefUnsafeMake(0));
8334
8285
  /** @internal */
8335
8286
  const currentMaxOpsBeforeYield = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"), () => fiberRefUnsafeMake(2048));
8336
8287
  /** @internal */
8337
- const currentLogAnnotations = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogAnnotation"), () => fiberRefUnsafeMake(empty$c()));
8288
+ const currentLogAnnotations = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogAnnotation"), () => fiberRefUnsafeMake(empty$d()));
8338
8289
  /** @internal */
8339
8290
  const currentLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogLevel"), () => fiberRefUnsafeMake(logLevelInfo));
8340
8291
  /** @internal */
8341
- const currentLogSpan = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogSpan"), () => fiberRefUnsafeMake(empty$b()));
8292
+ const currentLogSpan = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLogSpan"), () => fiberRefUnsafeMake(empty$c()));
8342
8293
  /** @internal */
8343
8294
  const withSchedulingPriority = /*#__PURE__*/dual(2, (self, scheduler) => fiberRefLocally(self, currentSchedulingPriority, scheduler));
8344
8295
  /** @internal */
@@ -8352,15 +8303,15 @@ const currentUnhandledErrorLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symb
8352
8303
  /** @internal */
8353
8304
  const currentVersionMismatchErrorLogLevel = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"), () => fiberRefUnsafeMake(some(logLevelWarning)));
8354
8305
  /** @internal */
8355
- const currentMetricLabels = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMetricLabels"), () => fiberRefUnsafeMakeReadonlyArray(empty$j()));
8306
+ const currentMetricLabels = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentMetricLabels"), () => fiberRefUnsafeMakeReadonlyArray(empty$k()));
8356
8307
  /** @internal */
8357
8308
  const currentForkScopeOverride = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentForkScopeOverride"), () => fiberRefUnsafeMake(none$4(), {
8358
8309
  fork: () => none$4(),
8359
8310
  join: (parent, _) => parent
8360
8311
  }));
8361
8312
  /** @internal */
8362
- const currentInterruptedCause = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentInterruptedCause"), () => fiberRefUnsafeMake(empty$6, {
8363
- fork: () => empty$6,
8313
+ const currentInterruptedCause = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentInterruptedCause"), () => fiberRefUnsafeMake(empty$7, {
8314
+ fork: () => empty$7,
8364
8315
  join: (parent, _) => parent
8365
8316
  }));
8366
8317
  /* @internal */
@@ -8376,7 +8327,7 @@ const scopeFork = (self, strategy) => self.fork(strategy);
8376
8327
  const YieldableError = /*#__PURE__*/function () {
8377
8328
  class YieldableError extends globalThis.Error {
8378
8329
  commit() {
8379
- return fail(this);
8330
+ return fail$1(this);
8380
8331
  }
8381
8332
  toJSON() {
8382
8333
  const obj = {
@@ -8390,7 +8341,7 @@ const YieldableError = /*#__PURE__*/function () {
8390
8341
  if (this.toString !== globalThis.Error.prototype.toString) {
8391
8342
  return this.stack ? `${this.toString()}\n${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
8392
8343
  } else if ("Bun" in globalThis) {
8393
- return pretty(fail$1(this), {
8344
+ return pretty(fail$2(this), {
8394
8345
  renderErrorCause: true
8395
8346
  });
8396
8347
  }
@@ -8453,9 +8404,7 @@ const exitIsExit = u => isEffect(u) && "_tag" in u && (u._tag === "Success" || u
8453
8404
  /** @internal */
8454
8405
  const exitCollectAll = (exits, options) => exitCollectAllInternal(exits, options?.parallel ? parallel$2 : sequential$2);
8455
8406
  /** @internal */
8456
- const exitDie$1 = defect => exitFailCause$1(die$1(defect));
8457
- /** @internal */
8458
- const exitFail = error => exitFailCause$1(fail$1(error));
8407
+ const exitFail = error => exitFailCause$1(fail$2(error));
8459
8408
  /** @internal */
8460
8409
  const exitFailCause$1 = cause => {
8461
8410
  const effect = new EffectPrimitiveFailure(OP_FAILURE);
@@ -8463,7 +8412,7 @@ const exitFailCause$1 = cause => {
8463
8412
  return effect;
8464
8413
  };
8465
8414
  /** @internal */
8466
- const exitInterrupt$1 = fiberId => exitFailCause$1(interrupt(fiberId));
8415
+ const exitInterrupt$1 = fiberId => exitFailCause$1(interrupt$1(fiberId));
8467
8416
  /** @internal */
8468
8417
  const exitMap = /*#__PURE__*/dual(2, (self, f) => {
8469
8418
  switch (self._tag) {
@@ -8539,7 +8488,7 @@ const deferredUnsafeMake = fiberId => {
8539
8488
  const _deferred = {
8540
8489
  ...CommitPrototype,
8541
8490
  [DeferredTypeId]: deferredVariance,
8542
- state: make$d(pending([])),
8491
+ state: make$g(pending$1([])),
8543
8492
  commit() {
8544
8493
  return deferredAwait(this);
8545
8494
  },
@@ -8573,7 +8522,7 @@ const deferredCompleteWith = /*#__PURE__*/dual(2, (self, effect) => sync(() => {
8573
8522
  }
8574
8523
  case OP_STATE_PENDING:
8575
8524
  {
8576
- set$2(self.state, done$2(effect));
8525
+ set$2(self.state, done$3(effect));
8577
8526
  for (let i = 0, len = state.joiners.length; i < len; i++) {
8578
8527
  state.joiners[i](effect);
8579
8528
  }
@@ -8589,7 +8538,7 @@ const deferredInterrupt = self => flatMap$1(fiberId, fiberId => deferredComplete
8589
8538
  const deferredUnsafeDone = (self, effect) => {
8590
8539
  const state = get$3(self.state);
8591
8540
  if (state._tag === OP_STATE_PENDING) {
8592
- set$2(self.state, done$2(effect));
8541
+ set$2(self.state, done$3(effect));
8593
8542
  for (let i = 0, len = state.joiners.length; i < len; i++) {
8594
8543
  state.joiners[i](effect);
8595
8544
  }
@@ -8626,9 +8575,43 @@ const currentSpanFromFiber = fiber => {
8626
8575
  return span !== undefined && span._tag === "Span" ? some(span) : none$4();
8627
8576
  };
8628
8577
 
8629
- const TypeId$2 = /*#__PURE__*/Symbol.for("effect/MutableHashMap");
8578
+ const _await = deferredAwait;
8579
+ /**
8580
+ * Exits the `Deferred` with the specified `Exit` value, which will be
8581
+ * propagated to all fibers waiting on the value of the `Deferred`.
8582
+ *
8583
+ * @since 2.0.0
8584
+ * @category utils
8585
+ */
8586
+ const done$2 = deferredDone;
8587
+ /**
8588
+ * Completes the `Deferred` with interruption. This will interrupt all fibers
8589
+ * waiting on the value of the `Deferred` with the `FiberId` of the fiber
8590
+ * calling this method.
8591
+ *
8592
+ * @since 2.0.0
8593
+ * @category utils
8594
+ */
8595
+ const interrupt = deferredInterrupt;
8596
+ /**
8597
+ * Unsafely creates a new `Deferred` from the specified `FiberId`.
8598
+ *
8599
+ * @since 2.0.0
8600
+ * @category unsafe
8601
+ */
8602
+ const unsafeMake$3 = deferredUnsafeMake;
8603
+
8604
+ /**
8605
+ * Constructs a new `Exit.Success` containing the specified value of type `A`.
8606
+ *
8607
+ * @since 2.0.0
8608
+ * @category constructors
8609
+ */
8610
+ const succeed$2 = exitSucceed$1;
8611
+
8612
+ const TypeId$4 = /*#__PURE__*/Symbol.for("effect/MutableHashMap");
8630
8613
  const MutableHashMapProto = {
8631
- [TypeId$2]: TypeId$2,
8614
+ [TypeId$4]: TypeId$4,
8632
8615
  [Symbol.iterator]() {
8633
8616
  return new MutableHashMapIterator(this);
8634
8617
  },
@@ -8697,7 +8680,7 @@ class BucketIterator {
8697
8680
  * @since 2.0.0
8698
8681
  * @category constructors
8699
8682
  */
8700
- const empty$5 = () => {
8683
+ const empty$6 = () => {
8701
8684
  const self = Object.create(MutableHashMapProto);
8702
8685
  self.referential = new Map();
8703
8686
  self.buckets = new Map();
@@ -8769,7 +8752,7 @@ const removeFromBucket = (self, bucket, key) => {
8769
8752
  /**
8770
8753
  * @since 2.0.0
8771
8754
  */
8772
- const remove = /*#__PURE__*/dual(2, (self, key) => {
8755
+ const remove$1 = /*#__PURE__*/dual(2, (self, key) => {
8773
8756
  if (isEqual(key) === false) {
8774
8757
  self.referential.delete(key);
8775
8758
  return self;
@@ -8793,6 +8776,224 @@ const size = self => {
8793
8776
  return self.referential.size + self.bucketsSize;
8794
8777
  };
8795
8778
 
8779
+ /**
8780
+ * @since 2.0.0
8781
+ */
8782
+ const TypeId$3 = /*#__PURE__*/Symbol.for("effect/MutableList");
8783
+ const MutableListProto = {
8784
+ [TypeId$3]: TypeId$3,
8785
+ [Symbol.iterator]() {
8786
+ let done = false;
8787
+ let head = this.head;
8788
+ return {
8789
+ next() {
8790
+ if (done) {
8791
+ return this.return();
8792
+ }
8793
+ if (head == null) {
8794
+ done = true;
8795
+ return this.return();
8796
+ }
8797
+ const value = head.value;
8798
+ head = head.next;
8799
+ return {
8800
+ done,
8801
+ value
8802
+ };
8803
+ },
8804
+ return(value) {
8805
+ if (!done) {
8806
+ done = true;
8807
+ }
8808
+ return {
8809
+ done: true,
8810
+ value
8811
+ };
8812
+ }
8813
+ };
8814
+ },
8815
+ toString() {
8816
+ return format$2(this.toJSON());
8817
+ },
8818
+ toJSON() {
8819
+ return {
8820
+ _id: "MutableList",
8821
+ values: Array.from(this).map(toJSON)
8822
+ };
8823
+ },
8824
+ [NodeInspectSymbol]() {
8825
+ return this.toJSON();
8826
+ },
8827
+ pipe() {
8828
+ return pipeArguments(this, arguments);
8829
+ }
8830
+ };
8831
+ /** @internal */
8832
+ const makeNode = value => ({
8833
+ value,
8834
+ removed: false,
8835
+ prev: undefined,
8836
+ next: undefined
8837
+ });
8838
+ /**
8839
+ * Creates an empty `MutableList`.
8840
+ *
8841
+ * @since 2.0.0
8842
+ * @category constructors
8843
+ */
8844
+ const empty$5 = () => {
8845
+ const list = Object.create(MutableListProto);
8846
+ list.head = undefined;
8847
+ list.tail = undefined;
8848
+ list._length = 0;
8849
+ return list;
8850
+ };
8851
+ /**
8852
+ * Returns `true` if the list contains zero elements, `false`, otherwise.
8853
+ *
8854
+ * @since 2.0.0
8855
+ * @category getters
8856
+ */
8857
+ const isEmpty = self => length(self) === 0;
8858
+ /**
8859
+ * Returns the length of the list.
8860
+ *
8861
+ * @since 2.0.0
8862
+ * @category getters
8863
+ */
8864
+ const length = self => self._length;
8865
+ /**
8866
+ * Appends the specified element to the end of the `MutableList`.
8867
+ *
8868
+ * @category concatenating
8869
+ * @since 2.0.0
8870
+ */
8871
+ const append = /*#__PURE__*/dual(2, (self, value) => {
8872
+ const node = makeNode(value);
8873
+ if (self.head === undefined) {
8874
+ self.head = node;
8875
+ }
8876
+ if (self.tail === undefined) {
8877
+ self.tail = node;
8878
+ } else {
8879
+ self.tail.next = node;
8880
+ node.prev = self.tail;
8881
+ self.tail = node;
8882
+ }
8883
+ self._length += 1;
8884
+ return self;
8885
+ });
8886
+ /**
8887
+ * Removes the first value from the list and returns it, if it exists.
8888
+ *
8889
+ * @since 0.0.1
8890
+ */
8891
+ const shift = self => {
8892
+ const head = self.head;
8893
+ if (head !== undefined) {
8894
+ remove(self, head);
8895
+ return head.value;
8896
+ }
8897
+ return undefined;
8898
+ };
8899
+ const remove = (self, node) => {
8900
+ if (node.removed) {
8901
+ return;
8902
+ }
8903
+ node.removed = true;
8904
+ if (node.prev !== undefined && node.next !== undefined) {
8905
+ node.prev.next = node.next;
8906
+ node.next.prev = node.prev;
8907
+ } else if (node.prev !== undefined) {
8908
+ self.tail = node.prev;
8909
+ node.prev.next = undefined;
8910
+ } else if (node.next !== undefined) {
8911
+ self.head = node.next;
8912
+ node.next.prev = undefined;
8913
+ } else {
8914
+ self.tail = undefined;
8915
+ self.head = undefined;
8916
+ }
8917
+ if (self._length > 0) {
8918
+ self._length -= 1;
8919
+ }
8920
+ };
8921
+
8922
+ /**
8923
+ * @since 2.0.0
8924
+ */
8925
+ const TypeId$2 = /*#__PURE__*/Symbol.for("effect/MutableQueue");
8926
+ /**
8927
+ * @since 2.0.0
8928
+ * @category symbol
8929
+ */
8930
+ const EmptyMutableQueue = /*#__PURE__*/Symbol.for("effect/mutable/MutableQueue/Empty");
8931
+ const MutableQueueProto = {
8932
+ [TypeId$2]: TypeId$2,
8933
+ [Symbol.iterator]() {
8934
+ return Array.from(this.queue)[Symbol.iterator]();
8935
+ },
8936
+ toString() {
8937
+ return format$2(this.toJSON());
8938
+ },
8939
+ toJSON() {
8940
+ return {
8941
+ _id: "MutableQueue",
8942
+ values: Array.from(this).map(toJSON)
8943
+ };
8944
+ },
8945
+ [NodeInspectSymbol]() {
8946
+ return this.toJSON();
8947
+ },
8948
+ pipe() {
8949
+ return pipeArguments(this, arguments);
8950
+ }
8951
+ };
8952
+ const make$c = capacity => {
8953
+ const queue = Object.create(MutableQueueProto);
8954
+ queue.queue = empty$5();
8955
+ queue.capacity = capacity;
8956
+ return queue;
8957
+ };
8958
+ /**
8959
+ * Creates a new unbounded `MutableQueue`.
8960
+ *
8961
+ * @since 2.0.0
8962
+ * @category constructors
8963
+ */
8964
+ const unbounded = () => make$c(undefined);
8965
+ /**
8966
+ * Offers an element to the queue.
8967
+ *
8968
+ * Returns whether the enqueue was successful or not.
8969
+ *
8970
+ * @since 2.0.0
8971
+ */
8972
+ const offer = /*#__PURE__*/dual(2, (self, value) => {
8973
+ const queueLength = length(self.queue);
8974
+ if (self.capacity !== undefined && queueLength === self.capacity) {
8975
+ return false;
8976
+ }
8977
+ append(value)(self.queue);
8978
+ return true;
8979
+ });
8980
+ /**
8981
+ * Dequeues an element from the queue.
8982
+ *
8983
+ * Returns either an element from the queue, or the `def` param.
8984
+ *
8985
+ * **Note**: if there is no meaningful default for your type, you can always
8986
+ * use `poll(MutableQueue.EmptyMutableQueue)`.
8987
+ *
8988
+ * @since 2.0.0
8989
+ */
8990
+ const poll = /*#__PURE__*/dual(2, (self, def) => {
8991
+ if (isEmpty(self.queue)) {
8992
+ return def;
8993
+ }
8994
+ return shift(self.queue);
8995
+ });
8996
+
8796
8997
  /** @internal */
8797
8998
  const ClockSymbolKey = "effect/Clock";
8798
8999
  /** @internal */
@@ -8854,7 +9055,7 @@ class ClockImpl {
8854
9055
  currentTimeMillis = /*#__PURE__*/sync(() => this.unsafeCurrentTimeMillis());
8855
9056
  currentTimeNanos = /*#__PURE__*/sync(() => this.unsafeCurrentTimeNanos());
8856
9057
  scheduler() {
8857
- return succeed$2(globalClockScheduler);
9058
+ return succeed$3(globalClockScheduler);
8858
9059
  }
8859
9060
  sleep(duration) {
8860
9061
  return async_(resume => {
@@ -8864,7 +9065,7 @@ class ClockImpl {
8864
9065
  }
8865
9066
  }
8866
9067
  /** @internal */
8867
- const make$9 = () => new ClockImpl();
9068
+ const make$b = () => new ClockImpl();
8868
9069
 
8869
9070
  /** @internal */
8870
9071
  const OP_AND = "And";
@@ -9111,7 +9312,7 @@ const FlatConfigProviderSymbolKey = "effect/ConfigProviderFlat";
9111
9312
  /** @internal */
9112
9313
  const FlatConfigProviderTypeId = /*#__PURE__*/Symbol.for(FlatConfigProviderSymbolKey);
9113
9314
  /** @internal */
9114
- const make$8 = options => ({
9315
+ const make$a = options => ({
9115
9316
  [ConfigProviderTypeId]: ConfigProviderTypeId,
9116
9317
  pipe() {
9117
9318
  return pipeArguments(this, arguments);
@@ -9126,10 +9327,10 @@ const makeFlat = options => ({
9126
9327
  enumerateChildren: options.enumerateChildren
9127
9328
  });
9128
9329
  /** @internal */
9129
- const fromFlat = flat => make$8({
9130
- load: config => flatMap$1(fromFlatLoop(flat, empty$j(), config, false), chunk => match$3(head(chunk), {
9131
- onNone: () => fail(MissingData(empty$j(), `Expected a single value having structure: ${config}`)),
9132
- onSome: succeed$2
9330
+ const fromFlat = flat => make$a({
9331
+ load: config => flatMap$1(fromFlatLoop(flat, empty$k(), config, false), chunk => match$3(head(chunk), {
9332
+ onNone: () => fail$1(MissingData(empty$k(), `Expected a single value having structure: ${config}`)),
9333
+ onSome: succeed$3
9133
9334
  })),
9134
9335
  flattened: flat
9135
9336
  });
@@ -9197,57 +9398,57 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9197
9398
  switch (op._tag) {
9198
9399
  case OP_CONSTANT:
9199
9400
  {
9200
- return succeed$2(of$2(op.value));
9401
+ return succeed$3(of$2(op.value));
9201
9402
  }
9202
9403
  case OP_DESCRIBED:
9203
9404
  {
9204
- return suspend(() => fromFlatLoop(flat, prefix, op.config, split));
9405
+ return suspend$1(() => fromFlatLoop(flat, prefix, op.config, split));
9205
9406
  }
9206
9407
  case OP_FAIL:
9207
9408
  {
9208
- return fail(MissingData(prefix, op.message));
9409
+ return fail$1(MissingData(prefix, op.message));
9209
9410
  }
9210
9411
  case OP_FALLBACK:
9211
9412
  {
9212
- return pipe(suspend(() => fromFlatLoop(flat, prefix, op.first, split)), catchAll$1(error1 => {
9413
+ return pipe(suspend$1(() => fromFlatLoop(flat, prefix, op.first, split)), catchAll$1(error1 => {
9213
9414
  if (op.condition(error1)) {
9214
- return pipe(fromFlatLoop(flat, prefix, op.second, split), catchAll$1(error2 => fail(Or(error1, error2))));
9415
+ return pipe(fromFlatLoop(flat, prefix, op.second, split), catchAll$1(error2 => fail$1(Or(error1, error2))));
9215
9416
  }
9216
- return fail(error1);
9417
+ return fail$1(error1);
9217
9418
  }));
9218
9419
  }
9219
9420
  case OP_LAZY:
9220
9421
  {
9221
- return suspend(() => fromFlatLoop(flat, prefix, op.config(), split));
9422
+ return suspend$1(() => fromFlatLoop(flat, prefix, op.config(), split));
9222
9423
  }
9223
9424
  case OP_MAP_OR_FAIL:
9224
9425
  {
9225
- return suspend(() => pipe(fromFlatLoop(flat, prefix, op.original, split), flatMap$1(forEachSequential(a => pipe(op.mapOrFail(a), mapError(prefixed(appendConfigPath(prefix, op.original))))))));
9426
+ return suspend$1(() => pipe(fromFlatLoop(flat, prefix, op.original, split), flatMap$1(forEachSequential(a => pipe(op.mapOrFail(a), mapError(prefixed(appendConfigPath(prefix, op.original))))))));
9226
9427
  }
9227
9428
  case OP_NESTED:
9228
9429
  {
9229
- return suspend(() => fromFlatLoop(flat, concat(prefix, of$2(op.name)), op.config, split));
9430
+ return suspend$1(() => fromFlatLoop(flat, concat(prefix, of$2(op.name)), op.config, split));
9230
9431
  }
9231
9432
  case OP_PRIMITIVE:
9232
9433
  {
9233
9434
  return pipe(patch$3(prefix, flat.patch), flatMap$1(prefix => pipe(flat.load(prefix, op, split), flatMap$1(values => {
9234
9435
  if (values.length === 0) {
9235
9436
  const name = pipe(last(prefix), getOrElse(() => "<n/a>"));
9236
- return fail(MissingData([], `Expected ${op.description} with name ${name}`));
9437
+ return fail$1(MissingData([], `Expected ${op.description} with name ${name}`));
9237
9438
  }
9238
- return succeed$2(values);
9439
+ return succeed$3(values);
9239
9440
  }))));
9240
9441
  }
9241
9442
  case OP_SEQUENCE:
9242
9443
  {
9243
9444
  return pipe(patch$3(prefix, flat.patch), flatMap$1(patchedPrefix => pipe(flat.enumerateChildren(patchedPrefix), flatMap$1(indicesFrom), flatMap$1(indices => {
9244
9445
  if (indices.length === 0) {
9245
- return suspend(() => map(fromFlatLoop(flat, prefix, op.config, true), of$2));
9446
+ return suspend$1(() => map(fromFlatLoop(flat, prefix, op.config, true), of$2));
9246
9447
  }
9247
- return pipe(forEachSequential(indices, index => fromFlatLoop(flat, append$1(prefix, `[${index}]`), op.config, true)), map(chunkChunk => {
9448
+ return pipe(forEachSequential(indices, index => fromFlatLoop(flat, append$2(prefix, `[${index}]`), op.config, true)), map(chunkChunk => {
9248
9449
  const flattened = flatten$2(chunkChunk);
9249
9450
  if (flattened.length === 0) {
9250
- return of$2(empty$j());
9451
+ return of$2(empty$k());
9251
9452
  }
9252
9453
  return of$2(flattened);
9253
9454
  }));
@@ -9255,10 +9456,10 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9255
9456
  }
9256
9457
  case OP_HASHMAP:
9257
9458
  {
9258
- return suspend(() => pipe(patch$3(prefix, flat.patch), flatMap$1(prefix => pipe(flat.enumerateChildren(prefix), flatMap$1(keys => {
9459
+ return suspend$1(() => pipe(patch$3(prefix, flat.patch), flatMap$1(prefix => pipe(flat.enumerateChildren(prefix), flatMap$1(keys => {
9259
9460
  return pipe(keys, forEachSequential(key => fromFlatLoop(flat, concat(prefix, of$2(key)), op.valueConfig, split)), map(matrix => {
9260
9461
  if (matrix.length === 0) {
9261
- return of$2(empty$c());
9462
+ return of$2(empty$d());
9262
9463
  }
9263
9464
  return pipe(transpose(matrix), map$3(values => fromIterable$1(zip$1(fromIterable$6(keys), values))));
9264
9465
  }));
@@ -9266,15 +9467,15 @@ const fromFlatLoop = (flat, prefix, config, split) => {
9266
9467
  }
9267
9468
  case OP_ZIP_WITH:
9268
9469
  {
9269
- return suspend(() => pipe(fromFlatLoop(flat, prefix, op.left, split), either, flatMap$1(left => pipe(fromFlatLoop(flat, prefix, op.right, split), either, flatMap$1(right$1 => {
9470
+ return suspend$1(() => pipe(fromFlatLoop(flat, prefix, op.left, split), either, flatMap$1(left => pipe(fromFlatLoop(flat, prefix, op.right, split), either, flatMap$1(right$1 => {
9270
9471
  if (isLeft(left) && isLeft(right$1)) {
9271
- return fail(And(left.left, right$1.left));
9472
+ return fail$1(And(left.left, right$1.left));
9272
9473
  }
9273
9474
  if (isLeft(left) && isRight(right$1)) {
9274
- return fail(left.left);
9475
+ return fail$1(left.left);
9275
9476
  }
9276
9477
  if (isRight(left) && isLeft(right$1)) {
9277
- return fail(right$1.left);
9478
+ return fail$1(right$1.left);
9278
9479
  }
9279
9480
  if (isRight(left) && isRight(right$1)) {
9280
9481
  const path = pipe(prefix, join$1("."));
@@ -9305,7 +9506,7 @@ const transpose = array => {
9305
9506
  return Object.keys(array[0]).map(column => array.map(row => row[column]));
9306
9507
  };
9307
9508
  const indicesFrom = quotedIndices => pipe(forEachSequential(quotedIndices, parseQuotedIndex), mapBoth({
9308
- onFailure: () => empty$j(),
9509
+ onFailure: () => empty$k(),
9309
9510
  onSuccess: sort(Order$1)
9310
9511
  }), either, map(merge$3));
9311
9512
  const QUOTED_INDEX_REGEX = /^(\[(\d+)\])$/;
@@ -9447,7 +9648,7 @@ class RandomImpl {
9447
9648
  }
9448
9649
  }
9449
9650
  const shuffleWith = (elements, nextIntBounded) => {
9450
- return suspend(() => pipe(sync(() => Array.from(elements)), flatMap$1(buffer => {
9651
+ return suspend$1(() => pipe(sync(() => Array.from(elements)), flatMap$1(buffer => {
9451
9652
  const numbers = [];
9452
9653
  for (let i = buffer.length; i >= 2; i = i - 1) {
9453
9654
  numbers.push(i);
@@ -9461,7 +9662,7 @@ const swap = (buffer, index1, index2) => {
9461
9662
  buffer[index2] = tmp;
9462
9663
  return buffer;
9463
9664
  };
9464
- const make$7 = seed => new RandomImpl(hash(seed));
9665
+ const make$9 = seed => new RandomImpl(hash(seed));
9465
9666
 
9466
9667
  /**
9467
9668
  * @since 2.0.0
@@ -9469,7 +9670,7 @@ const make$7 = seed => new RandomImpl(hash(seed));
9469
9670
  /** @internal */
9470
9671
  const TracerTypeId = /*#__PURE__*/Symbol.for("effect/Tracer");
9471
9672
  /** @internal */
9472
- const make$6 = options => ({
9673
+ const make$8 = options => ({
9473
9674
  [TracerTypeId]: TracerTypeId,
9474
9675
  ...options
9475
9676
  });
@@ -9538,13 +9739,13 @@ class NativeSpan {
9538
9739
  }
9539
9740
  }
9540
9741
  /** @internal */
9541
- const nativeTracer = /*#__PURE__*/make$6({
9742
+ const nativeTracer = /*#__PURE__*/make$8({
9542
9743
  span: (name, parent, context, links, startTime, kind) => new NativeSpan(name, parent, context, links, startTime, kind),
9543
9744
  context: f => f()
9544
9745
  });
9545
9746
 
9546
9747
  /** @internal */
9547
- const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$h(), /*#__PURE__*/add$2(clockTag, /*#__PURE__*/make$9()), /*#__PURE__*/add$2(consoleTag, defaultConsole), /*#__PURE__*/add$2(randomTag, /*#__PURE__*/make$7(/*#__PURE__*/Math.random())), /*#__PURE__*/add$2(configProviderTag, /*#__PURE__*/fromEnv()), /*#__PURE__*/add$2(tracerTag, nativeTracer));
9748
+ const liveServices = /*#__PURE__*/pipe(/*#__PURE__*/empty$i(), /*#__PURE__*/add$2(clockTag, /*#__PURE__*/make$b()), /*#__PURE__*/add$2(consoleTag, defaultConsole), /*#__PURE__*/add$2(randomTag, /*#__PURE__*/make$9(/*#__PURE__*/Math.random())), /*#__PURE__*/add$2(configProviderTag, /*#__PURE__*/fromEnv()), /*#__PURE__*/add$2(tracerTag, nativeTracer));
9548
9749
  /**
9549
9750
  * The `FiberRef` holding the default `Effect` services.
9550
9751
  *
@@ -9993,30 +10194,12 @@ class MetricLabelImpl {
9993
10194
  }
9994
10195
  }
9995
10196
  /** @internal */
9996
- const make$5 = (key, value) => {
10197
+ const make$7 = (key, value) => {
9997
10198
  return new MetricLabelImpl(key, value);
9998
10199
  };
9999
10200
  /** @internal */
10000
10201
  const isMetricLabel = u => hasProperty(u, MetricLabelTypeId);
10001
10202
 
10002
- /* @internal */
10003
- const try_$1 = arg => {
10004
- let evaluate;
10005
- let onFailure = undefined;
10006
- if (typeof arg === "function") {
10007
- evaluate = arg;
10008
- } else {
10009
- evaluate = arg.try;
10010
- onFailure = arg.catch;
10011
- }
10012
- return suspend(() => {
10013
- try {
10014
- return succeed$2(internalCall(evaluate));
10015
- } catch (error) {
10016
- return fail(onFailure ? internalCall(() => onFailure(error)) : new UnknownException(error, "An unknown error occurred in Effect.try"));
10017
- }
10018
- });
10019
- };
10020
10203
  /* @internal */
10021
10204
  const clockWith = clockWith$1;
10022
10205
  /** @internal */
@@ -10036,7 +10219,7 @@ const logWithLevel = level => (...message) => {
10036
10219
  }
10037
10220
  }
10038
10221
  if (cause === undefined) {
10039
- cause = empty$6;
10222
+ cause = empty$7;
10040
10223
  }
10041
10224
  return withFiberRuntime(fiberState => {
10042
10225
  fiberState.log(message, cause, levelOption);
@@ -10048,8 +10231,6 @@ const logWarning$1 = /*#__PURE__*/logWithLevel(Warning);
10048
10231
  /** @internal */
10049
10232
  const logError$1 = /*#__PURE__*/logWithLevel(Error$2);
10050
10233
  /* @internal */
10051
- const orElseSucceed$1 = /*#__PURE__*/dual(2, (self, evaluate) => orElse(self, () => sync(evaluate)));
10052
- /* @internal */
10053
10234
  const tapError$1 = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
10054
10235
  onFailure: cause => {
10055
10236
  const either = failureOrCause(cause);
@@ -10060,38 +10241,10 @@ const tapError$1 = /*#__PURE__*/dual(2, (self, f) => matchCauseEffect$1(self, {
10060
10241
  return failCause$1(cause);
10061
10242
  }
10062
10243
  },
10063
- onSuccess: succeed$2
10244
+ onSuccess: succeed$3
10064
10245
  }));
10065
10246
  /* @internal */
10066
- const tryPromise$1 = arg => {
10067
- let evaluate;
10068
- let catcher = undefined;
10069
- if (typeof arg === "function") {
10070
- evaluate = arg;
10071
- } else {
10072
- evaluate = arg.try;
10073
- catcher = arg.catch;
10074
- }
10075
- const fail$1 = e => catcher ? failSync(() => catcher(e)) : fail(new UnknownException(e, "An unknown error occurred in Effect.tryPromise"));
10076
- if (evaluate.length >= 1) {
10077
- return async_((resolve, signal) => {
10078
- try {
10079
- evaluate(signal).then(a => resolve(succeed$2(a)), e => resolve(fail$1(e)));
10080
- } catch (e) {
10081
- resolve(fail$1(e));
10082
- }
10083
- });
10084
- }
10085
- return async_(resolve => {
10086
- try {
10087
- evaluate().then(a => resolve(succeed$2(a)), e => resolve(fail$1(e)));
10088
- } catch (e) {
10089
- resolve(fail$1(e));
10090
- }
10091
- });
10092
- };
10093
- /* @internal */
10094
- const when = /*#__PURE__*/dual(2, (self, condition) => suspend(() => condition() ? map(self, some) : succeed$2(none$4())));
10247
+ const when = /*#__PURE__*/dual(2, (self, condition) => suspend$1(() => condition() ? map(self, some) : succeed$3(none$4())));
10095
10248
 
10096
10249
  /** @internal */
10097
10250
  const OP_SEQUENTIAL = "Sequential";
@@ -10308,6 +10461,19 @@ class MicroCauseImpl extends globalThis.Error {
10308
10461
  return this.stack;
10309
10462
  }
10310
10463
  }
10464
+ class Fail extends MicroCauseImpl {
10465
+ error;
10466
+ constructor(error, traces = []) {
10467
+ super("Fail", error, traces);
10468
+ this.error = error;
10469
+ }
10470
+ }
10471
+ /**
10472
+ * @since 3.4.6
10473
+ * @experimental
10474
+ * @category MicroCause
10475
+ */
10476
+ const causeFail = (error, traces = []) => new Fail(error, traces);
10311
10477
  class Die extends MicroCauseImpl {
10312
10478
  defect;
10313
10479
  constructor(defect, traces = []) {
@@ -10592,6 +10758,30 @@ const failCause = /*#__PURE__*/makeExit({
10592
10758
  return cont ? cont[failureCont](this[args], fiber) : fiber.yieldWith(this);
10593
10759
  }
10594
10760
  });
10761
+ /**
10762
+ * Creates a `Micro` effect that fails with the given error.
10763
+ *
10764
+ * This results in a `Fail` variant of the `MicroCause` type, where the error is
10765
+ * tracked at the type level.
10766
+ *
10767
+ * @since 3.4.0
10768
+ * @experimental
10769
+ * @category constructors
10770
+ */
10771
+ const fail = error => failCause(causeFail(error));
10772
+ /**
10773
+ * Lazily creates a `Micro` effect from the given side-effect.
10774
+ *
10775
+ * @since 3.4.0
10776
+ * @experimental
10777
+ * @category constructors
10778
+ */
10779
+ const suspend = /*#__PURE__*/makePrimitive({
10780
+ op: "Suspend",
10781
+ eval(_fiber) {
10782
+ return this[args]();
10783
+ }
10784
+ });
10595
10785
  /**
10596
10786
  * Pause the execution of the current `Micro` effect, and resume it on the next
10597
10787
  * scheduler tick.
@@ -10623,6 +10813,38 @@ const yieldNowWith = /*#__PURE__*/makePrimitive({
10623
10813
  */
10624
10814
  const yieldNow$1 = /*#__PURE__*/yieldNowWith(0);
10625
10815
  const void_ = /*#__PURE__*/succeed$1(void 0);
10816
+ const try_ = options => suspend(() => {
10817
+ try {
10818
+ return succeed$1(options.try());
10819
+ } catch (err) {
10820
+ return fail(options.catch(err));
10821
+ }
10822
+ });
10823
+ /**
10824
+ * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and
10825
+ * converted into a specific error type.
10826
+ *
10827
+ * @example
10828
+ * ```ts
10829
+ * import { Micro } from "effect"
10830
+ *
10831
+ * Micro.tryPromise({
10832
+ * try: () => Promise.resolve("success"),
10833
+ * catch: (cause) => new Error("caught", { cause })
10834
+ * })
10835
+ * ```
10836
+ *
10837
+ * @since 3.4.0
10838
+ * @experimental
10839
+ * @category constructors
10840
+ */
10841
+ const tryPromise = options => asyncOptions(function (resume, signal) {
10842
+ try {
10843
+ options.try(signal).then(a => resume(succeed$1(a)), e => resume(fail(options.catch(e))));
10844
+ } catch (err) {
10845
+ resume(fail(options.catch(err)));
10846
+ }
10847
+ }, options.try.length !== 0);
10626
10848
  /**
10627
10849
  * Create a `Micro` effect using the current `MicroFiber`.
10628
10850
  *
@@ -10636,6 +10858,69 @@ const withMicroFiber = /*#__PURE__*/makePrimitive({
10636
10858
  return this[args](fiber);
10637
10859
  }
10638
10860
  });
10861
+ const asyncOptions = /*#__PURE__*/makePrimitive({
10862
+ op: "Async",
10863
+ single: false,
10864
+ eval(fiber) {
10865
+ const register = this[args][0];
10866
+ let resumed = false;
10867
+ let yielded = false;
10868
+ const controller = this[args][1] ? new AbortController() : undefined;
10869
+ const onCancel = register(effect => {
10870
+ if (resumed) return;
10871
+ resumed = true;
10872
+ if (yielded) {
10873
+ fiber.evaluate(effect);
10874
+ } else {
10875
+ yielded = effect;
10876
+ }
10877
+ }, controller?.signal);
10878
+ if (yielded !== false) return yielded;
10879
+ yielded = true;
10880
+ fiber._yielded = () => {
10881
+ resumed = true;
10882
+ };
10883
+ if (controller === undefined && onCancel === undefined) {
10884
+ return Yield;
10885
+ }
10886
+ fiber._stack.push(asyncFinalizer(() => {
10887
+ resumed = true;
10888
+ controller?.abort();
10889
+ return onCancel ?? exitVoid;
10890
+ }));
10891
+ return Yield;
10892
+ }
10893
+ });
10894
+ const asyncFinalizer = /*#__PURE__*/makePrimitive({
10895
+ op: "AsyncFinalizer",
10896
+ ensure(fiber) {
10897
+ if (fiber.interruptible) {
10898
+ fiber.interruptible = false;
10899
+ fiber._stack.push(setInterruptible(true));
10900
+ }
10901
+ },
10902
+ contE(cause, _fiber) {
10903
+ return causeIsInterrupt(cause) ? flatMap(this[args](), () => failCause(cause)) : failCause(cause);
10904
+ }
10905
+ });
10906
+ /**
10907
+ * @since 3.4.0
10908
+ * @experimental
10909
+ * @category constructors
10910
+ */
10911
+ const gen$1 = (...args) => suspend(() => fromIterator(args.length === 1 ? args[0]() : args[1].call(args[0])));
10912
+ const fromIterator = /*#__PURE__*/makePrimitive({
10913
+ op: "Iterator",
10914
+ contA(value, fiber) {
10915
+ const state = this[args].next(value);
10916
+ if (state.done) return succeed$1(state.value);
10917
+ fiber._stack.push(this);
10918
+ return yieldWrapGet(state.value);
10919
+ },
10920
+ eval(fiber) {
10921
+ return this[successCont](undefined, fiber);
10922
+ }
10923
+ });
10639
10924
  /**
10640
10925
  * Map the success value of this `Micro` effect to another `Micro` effect, then
10641
10926
  * flatten the result.
@@ -11011,51 +11296,6 @@ class MixedScheduler {
11011
11296
  * @category schedulers
11012
11297
  */
11013
11298
  const defaultScheduler = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Scheduler/defaultScheduler"), () => new MixedScheduler(2048));
11014
- /**
11015
- * @since 2.0.0
11016
- * @category constructors
11017
- */
11018
- class SyncScheduler {
11019
- /**
11020
- * @since 2.0.0
11021
- */
11022
- tasks = /*#__PURE__*/new PriorityBuckets();
11023
- /**
11024
- * @since 2.0.0
11025
- */
11026
- deferred = false;
11027
- /**
11028
- * @since 2.0.0
11029
- */
11030
- scheduleTask(task, priority) {
11031
- if (this.deferred) {
11032
- defaultScheduler.scheduleTask(task, priority);
11033
- } else {
11034
- this.tasks.scheduleTask(task, priority);
11035
- }
11036
- }
11037
- /**
11038
- * @since 2.0.0
11039
- */
11040
- shouldYield(fiber) {
11041
- return fiber.currentOpCount > fiber.getFiberRef(currentMaxOpsBeforeYield) ? fiber.getFiberRef(currentSchedulingPriority) : false;
11042
- }
11043
- /**
11044
- * @since 2.0.0
11045
- */
11046
- flush() {
11047
- while (this.tasks.buckets.length > 0) {
11048
- const tasks = this.tasks.buckets;
11049
- this.tasks.buckets = [];
11050
- for (const [_, toRun] of tasks) {
11051
- for (let i = 0; i < toRun.length; i++) {
11052
- toRun[i]();
11053
- }
11054
- }
11055
- }
11056
- this.deferred = true;
11057
- }
11058
- }
11059
11299
  /** @internal */
11060
11300
  const currentScheduler = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentScheduler"), () => fiberRefUnsafeMake(defaultScheduler));
11061
11301
 
@@ -11584,7 +11824,7 @@ const metricHookVariance = {
11584
11824
  _Out: _ => _
11585
11825
  };
11586
11826
  /** @internal */
11587
- const make$4 = options => ({
11827
+ const make$6 = options => ({
11588
11828
  [MetricHookTypeId]: metricHookVariance,
11589
11829
  pipe() {
11590
11830
  return pipeArguments(this, arguments);
@@ -11601,7 +11841,7 @@ const counter$1 = key => {
11601
11841
  sum = sum + value;
11602
11842
  }
11603
11843
  };
11604
- return make$4({
11844
+ return make$6({
11605
11845
  get: () => counter$2(sum),
11606
11846
  update,
11607
11847
  modify: update
@@ -11617,7 +11857,7 @@ const frequency = key => {
11617
11857
  const slotCount = values.get(word) ?? 0;
11618
11858
  values.set(word, slotCount + 1);
11619
11859
  };
11620
- return make$4({
11860
+ return make$6({
11621
11861
  get: () => frequency$1(values),
11622
11862
  update,
11623
11863
  modify: update
@@ -11626,7 +11866,7 @@ const frequency = key => {
11626
11866
  /** @internal */
11627
11867
  const gauge = (_key, startAt) => {
11628
11868
  let value = startAt;
11629
- return make$4({
11869
+ return make$6({
11630
11870
  get: () => gauge$1(value),
11631
11871
  update: v => {
11632
11872
  value = v;
@@ -11696,7 +11936,7 @@ const histogram$1 = key => {
11696
11936
  }
11697
11937
  return builder;
11698
11938
  };
11699
- return make$4({
11939
+ return make$6({
11700
11940
  get: () => histogram$2({
11701
11941
  buckets: getBuckets(),
11702
11942
  count,
@@ -11763,7 +12003,7 @@ const summary = key => {
11763
12003
  count = count + 1;
11764
12004
  sum = sum + value;
11765
12005
  };
11766
- return make$4({
12006
+ return make$6({
11767
12007
  get: () => summary$1({
11768
12008
  error,
11769
12009
  quantiles: snapshot(Date.now()),
@@ -11781,7 +12021,7 @@ const calculateQuantiles = (error, sortedQuantiles, sortedSamples) => {
11781
12021
  // The number of samples examined
11782
12022
  const sampleCount = sortedSamples.length;
11783
12023
  if (!isNonEmptyReadonlyArray(sortedQuantiles)) {
11784
- return empty$j();
12024
+ return empty$k();
11785
12025
  }
11786
12026
  const head = sortedQuantiles[0];
11787
12027
  const tail = sortedQuantiles.slice(1);
@@ -11942,7 +12182,7 @@ const MetricRegistryTypeId = /*#__PURE__*/Symbol.for(MetricRegistrySymbolKey);
11942
12182
  /** @internal */
11943
12183
  class MetricRegistryImpl {
11944
12184
  [MetricRegistryTypeId] = MetricRegistryTypeId;
11945
- map = /*#__PURE__*/empty$5();
12185
+ map = /*#__PURE__*/empty$6();
11946
12186
  snapshot() {
11947
12187
  const result = [];
11948
12188
  for (const [key, hook] of this.map) {
@@ -12030,7 +12270,7 @@ class MetricRegistryImpl {
12030
12270
  }
12031
12271
  }
12032
12272
  /** @internal */
12033
- const make$3 = () => {
12273
+ const make$5 = () => {
12034
12274
  return new MetricRegistryImpl();
12035
12275
  };
12036
12276
 
@@ -12047,9 +12287,9 @@ const metricVariance = {
12047
12287
  _Out: _ => _
12048
12288
  };
12049
12289
  /** @internal */
12050
- const globalMetricRegistry = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Metric/globalMetricRegistry"), () => make$3());
12290
+ const globalMetricRegistry = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Metric/globalMetricRegistry"), () => make$5());
12051
12291
  /** @internal */
12052
- const make$2 = function (keyType, unsafeUpdate, unsafeValue, unsafeModify) {
12292
+ const make$4 = function (keyType, unsafeUpdate, unsafeValue, unsafeModify) {
12053
12293
  const metric = Object.assign(effect => tap(effect, a => update(metric, a)), {
12054
12294
  [MetricTypeId]: metricVariance,
12055
12295
  keyType,
@@ -12088,21 +12328,21 @@ const fromMetricKey = key => {
12088
12328
  hookCache.set(extraTags, hook);
12089
12329
  return hook;
12090
12330
  };
12091
- return make$2(key.keyType, (input, extraTags) => hook(extraTags).update(input), extraTags => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
12331
+ return make$4(key.keyType, (input, extraTags) => hook(extraTags).update(input), extraTags => hook(extraTags).get(), (input, extraTags) => hook(extraTags).modify(input));
12092
12332
  };
12093
12333
  /** @internal */
12094
12334
  const histogram = (name, boundaries, description) => fromMetricKey(histogram$3(name, boundaries, description));
12095
12335
  /** @internal */
12096
- const tagged = /*#__PURE__*/dual(3, (self, key, value) => taggedWithLabels(self, [make$5(key, value)]));
12336
+ const tagged = /*#__PURE__*/dual(3, (self, key, value) => taggedWithLabels(self, [make$7(key, value)]));
12097
12337
  /** @internal */
12098
12338
  const taggedWithLabels = /*#__PURE__*/dual(2, (self, extraTags) => {
12099
- return make$2(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union$2(extraTags, extraTags1)), extraTags1 => self.unsafeValue(union$2(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union$2(extraTags, extraTags1)));
12339
+ return make$4(self.keyType, (input, extraTags1) => self.unsafeUpdate(input, union$2(extraTags, extraTags1)), extraTags1 => self.unsafeValue(union$2(extraTags, extraTags1)), (input, extraTags1) => self.unsafeModify(input, union$2(extraTags, extraTags1)));
12100
12340
  });
12101
12341
  /* @internal */
12102
12342
  const update = /*#__PURE__*/dual(2, (self, input) => fiberRefGetWith(currentMetricLabels, tags => sync(() => self.unsafeUpdate(input, tags))));
12103
12343
 
12104
12344
  /** @internal */
12105
- const complete = /*#__PURE__*/dual(2, (self, result) => fiberRefGetWith(currentRequestMap, map => sync(() => {
12345
+ const complete$1 = /*#__PURE__*/dual(2, (self, result) => fiberRefGetWith(currentRequestMap, map => sync(() => {
12106
12346
  if (map.has(self)) {
12107
12347
  const entry = map.get(self);
12108
12348
  if (!entry.state.completed) {
@@ -12245,7 +12485,7 @@ const none = /*#__PURE__*/globalValue("effect/Supervisor/none", () => fromEffect
12245
12485
  * @since 2.0.0
12246
12486
  * @category constructors
12247
12487
  */
12248
- const make$1 = make$c;
12488
+ const make$3 = make$f;
12249
12489
 
12250
12490
  /** @internal */
12251
12491
  const OP_EMPTY = "Empty";
@@ -12332,12 +12572,12 @@ const removeSupervisor = (self, that) => {
12332
12572
  /** @internal */
12333
12573
  const toSet = self => {
12334
12574
  if (equals$1(self, none)) {
12335
- return empty$d();
12575
+ return empty$e();
12336
12576
  } else {
12337
12577
  if (isZip(self)) {
12338
12578
  return pipe(toSet(self.left), union(toSet(self.right)));
12339
12579
  } else {
12340
- return make$e(self);
12580
+ return make$h(self);
12341
12581
  }
12342
12582
  }
12343
12583
  };
@@ -12359,7 +12599,7 @@ const diff = (oldValue, newValue) => {
12359
12599
  return combine(added, removed);
12360
12600
  };
12361
12601
  /** @internal */
12362
- const differ = /*#__PURE__*/make$1({
12602
+ const differ = /*#__PURE__*/make$3({
12363
12603
  empty,
12364
12604
  patch,
12365
12605
  combine,
@@ -12599,7 +12839,7 @@ class FiberRuntime extends Class {
12599
12839
  * without locks or immutable data.
12600
12840
  */
12601
12841
  ask(f) {
12602
- return suspend(() => {
12842
+ return suspend$1(() => {
12603
12843
  const deferred = deferredUnsafeMake(this._fiberId);
12604
12844
  this.tell(stateful((fiber, status) => {
12605
12845
  deferredUnsafeDone(deferred, sync(() => f(fiber, status)));
@@ -12619,7 +12859,7 @@ class FiberRuntime extends Class {
12619
12859
  }
12620
12860
  get await() {
12621
12861
  return async_(resume => {
12622
- const cb = exit => resume(succeed$2(exit));
12862
+ const cb = exit => resume(succeed$3(exit));
12623
12863
  this.tell(stateful((fiber, _) => {
12624
12864
  if (fiber._exitValue !== null) {
12625
12865
  cb(this._exitValue);
@@ -12665,13 +12905,13 @@ class FiberRuntime extends Class {
12665
12905
  * In the background, interrupts the fiber as if interrupted from the specified fiber.
12666
12906
  */
12667
12907
  interruptAsFork(fiberId) {
12668
- return sync(() => this.tell(interruptSignal(interrupt(fiberId))));
12908
+ return sync(() => this.tell(interruptSignal(interrupt$1(fiberId))));
12669
12909
  }
12670
12910
  /**
12671
12911
  * In the background, interrupts the fiber as if interrupted from the specified fiber.
12672
12912
  */
12673
12913
  unsafeInterruptAsFork(fiberId) {
12674
- this.tell(interruptSignal(interrupt(fiberId)));
12914
+ this.tell(interruptSignal(interrupt$1(fiberId)));
12675
12915
  }
12676
12916
  /**
12677
12917
  * Adds an observer to the list of observers.
@@ -12865,7 +13105,7 @@ class FiberRuntime extends Class {
12865
13105
  * log annotations and log level) may not be up-to-date.
12866
13106
  */
12867
13107
  isInterrupted() {
12868
- return !isEmpty(this.getFiberRef(currentInterruptedCause));
13108
+ return !isEmpty$1(this.getFiberRef(currentInterruptedCause));
12869
13109
  }
12870
13110
  /**
12871
13111
  * Adds an interruptor to the set of interruptors that are interrupting this
@@ -12899,7 +13139,7 @@ class FiberRuntime extends Class {
12899
13139
  }
12900
13140
  let told = false;
12901
13141
  for (const child of this._children) {
12902
- child.tell(interruptSignal(interrupt(this.id())));
13142
+ child.tell(interruptSignal(interrupt$1(this.id())));
12903
13143
  told = true;
12904
13144
  }
12905
13145
  return told;
@@ -13210,10 +13450,10 @@ class FiberRuntime extends Class {
13210
13450
  return sync(() => unsafeGet$1(this.currentContext, op));
13211
13451
  }
13212
13452
  ["Left"](op) {
13213
- return fail(op.left);
13453
+ return fail$1(op.left);
13214
13454
  }
13215
13455
  ["None"](_) {
13216
- return fail(new NoSuchElementException());
13456
+ return fail$1(new NoSuchElementException());
13217
13457
  }
13218
13458
  ["Right"](op) {
13219
13459
  return exitSucceed$1(op.right);
@@ -13232,11 +13472,11 @@ class FiberRuntime extends Class {
13232
13472
  switch (exit.cause._tag) {
13233
13473
  case "Interrupt":
13234
13474
  {
13235
- return resume(exitFailCause$1(interrupt(none$2)));
13475
+ return resume(exitFailCause$1(interrupt$1(none$2)));
13236
13476
  }
13237
13477
  case "Fail":
13238
13478
  {
13239
- return resume(fail(exit.cause.error));
13479
+ return resume(fail$1(exit.cause.error));
13240
13480
  }
13241
13481
  case "Die":
13242
13482
  {
@@ -13455,7 +13695,7 @@ class FiberRuntime extends Class {
13455
13695
  const level = this.getFiberRef(currentVersionMismatchErrorLogLevel);
13456
13696
  if (level._tag === "Some") {
13457
13697
  const effectVersion = cur[EffectTypeId]._V;
13458
- this.log(`Executing an Effect versioned ${effectVersion} with a Runtime of version ${getCurrentVersion()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`, empty$6, level);
13698
+ this.log(`Executing an Effect versioned ${effectVersion} with a Runtime of version ${getCurrentVersion()}, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`, empty$7, level);
13459
13699
  }
13460
13700
  }
13461
13701
  // @ts-expect-error
@@ -13473,7 +13713,7 @@ class FiberRuntime extends Class {
13473
13713
  if (cur !== YieldedOp && !hasProperty(cur, "_op") || !(cur._op in this)) {
13474
13714
  cur = dieMessage(`Not a valid effect: ${toStringUnknown(cur)}`);
13475
13715
  } else if (isInterruptedException(e)) {
13476
- cur = exitFailCause$1(sequential$2(die$1(e), interrupt(none$2)));
13716
+ cur = exitFailCause$1(sequential$2(die$1(e), interrupt$1(none$2)));
13477
13717
  } else {
13478
13718
  cur = die(e);
13479
13719
  }
@@ -13522,7 +13762,7 @@ const tracerLogger = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/Lo
13522
13762
  span.value.event(toStringUnknown(Array.isArray(message) && message.length === 1 ? message[0] : message), clockService.unsafeCurrentTimeNanos(), attributes);
13523
13763
  }));
13524
13764
  /** @internal */
13525
- const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$e(defaultLogger, tracerLogger)));
13765
+ const currentLoggers = /*#__PURE__*/globalValue(/*#__PURE__*/Symbol.for("effect/FiberRef/currentLoggers"), () => fiberRefUnsafeMakeHashSet(make$h(defaultLogger, tracerLogger)));
13526
13766
  // === all
13527
13767
  const allResolveInput = input => {
13528
13768
  if (Array.isArray(input) || isIterable(input)) {
@@ -13564,11 +13804,11 @@ const allValidate = (effects, reconcile, options) => {
13564
13804
  }
13565
13805
  }
13566
13806
  if (errored) {
13567
- return reconcile._tag === "Some" ? fail(reconcile.value(errors)) : fail(errors);
13807
+ return reconcile._tag === "Some" ? fail$1(reconcile.value(errors)) : fail$1(errors);
13568
13808
  } else if (options?.discard) {
13569
13809
  return void_$1;
13570
13810
  }
13571
- return reconcile._tag === "Some" ? succeed$2(reconcile.value(successes)) : succeed$2(successes);
13811
+ return reconcile._tag === "Some" ? succeed$3(reconcile.value(successes)) : succeed$3(successes);
13572
13812
  });
13573
13813
  };
13574
13814
  const allEither = (effects, reconcile, options) => {
@@ -13609,11 +13849,11 @@ const forEach = /*#__PURE__*/dual(args => isIterable(args[0]), (self, f, options
13609
13849
  return match(options?.concurrency, () => finalizersMaskInternal(sequential, options?.concurrentFinalizers)(restore => isRequestBatchingEnabled ? forEachParN(self, 1, (a, i) => restore(f(a, i)), true) : forEachSequential(self, (a, i) => restore(f(a, i)))), () => finalizersMaskInternal(parallel, options?.concurrentFinalizers)(restore => forEachParUnbounded(self, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)), n => finalizersMaskInternal(parallelN(n), options?.concurrentFinalizers)(restore => forEachParN(self, n, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)));
13610
13850
  }));
13611
13851
  /* @internal */
13612
- const forEachParUnbounded = (self, f, batching) => suspend(() => {
13852
+ const forEachParUnbounded = (self, f, batching) => suspend$1(() => {
13613
13853
  const as = fromIterable$6(self);
13614
13854
  const array = new Array(as.length);
13615
13855
  const fn = (a, i) => flatMap$1(f(a, i), b => sync(() => array[i] = b));
13616
- return zipRight(forEachConcurrentDiscard(as, fn, batching, false), succeed$2(array));
13856
+ return zipRight(forEachConcurrentDiscard(as, fn, batching, false), succeed$3(array));
13617
13857
  });
13618
13858
  /** @internal */
13619
13859
  const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterruptibleMask$1(restore => transplant(graft => withFiberRuntime(parent => {
@@ -13696,7 +13936,7 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
13696
13936
  return returnNextElement();
13697
13937
  }
13698
13938
  }
13699
- return succeed$2(res);
13939
+ return succeed$3(res);
13700
13940
  };
13701
13941
  const todo = flatMap$1(stepOrExit(restore(f(a, index))), onRes);
13702
13942
  const fiber = runFiber(todo);
@@ -13718,13 +13958,13 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
13718
13958
  fibers.delete(fiber);
13719
13959
  pushResult(exit, index);
13720
13960
  if (results.length === target) {
13721
- resume(succeed$2(getOrElse(exitCollectAll(collectExits(), {
13961
+ resume(succeed$3(getOrElse(exitCollectAll(collectExits(), {
13722
13962
  parallel: true
13723
13963
  }), () => exitVoid$1)));
13724
13964
  } else if (residual.length + results.length === target) {
13725
13965
  const exits = collectExits();
13726
13966
  const requests = residual.map(blocked => blocked.effect_instruction_i0).reduce(par);
13727
- resume(succeed$2(blocked(requests, forEachConcurrentDiscard([getOrElse(exitCollectAll(exits, {
13967
+ resume(succeed$3(blocked(requests, forEachConcurrentDiscard([getOrElse(exitCollectAll(exits, {
13728
13968
  parallel: true
13729
13969
  }), () => exitVoid$1), ...residual.map(blocked => blocked.effect_instruction_i1)], i => i, batching, true, n))));
13730
13970
  } else {
@@ -13770,11 +14010,11 @@ const forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterru
13770
14010
  })));
13771
14011
  })));
13772
14012
  /* @internal */
13773
- const forEachParN = (self, n, f, batching) => suspend(() => {
14013
+ const forEachParN = (self, n, f, batching) => suspend$1(() => {
13774
14014
  const as = fromIterable$6(self);
13775
14015
  const array = new Array(as.length);
13776
14016
  const fn = (a, i) => map(f(a, i), b => array[i] = b);
13777
- return zipRight(forEachConcurrentDiscard(as, fn, batching, false, n), succeed$2(array));
14017
+ return zipRight(forEachConcurrentDiscard(as, fn, batching, false, n), succeed$3(array));
13778
14018
  });
13779
14019
  /* @internal */
13780
14020
  const forkDaemon = self => forkWithScopeOverride(self, globalScope);
@@ -13791,7 +14031,7 @@ const unsafeForkUnstarted = (effect, parentFiber, parentRuntimeFlags, overrideSc
13791
14031
  };
13792
14032
  /** @internal */
13793
14033
  const unsafeMakeChildFiber = (effect, parentFiber, parentRuntimeFlags, overrideScope = null) => {
13794
- const childId = unsafeMake$3();
14034
+ const childId = unsafeMake$4();
13795
14035
  const parentFiberRefs = parentFiber.getFiberRefs();
13796
14036
  const childFiberRefs = forkAs(parentFiberRefs, childId);
13797
14037
  const childFiber = new FiberRuntime(childId, childFiberRefs, parentRuntimeFlags);
@@ -13804,7 +14044,7 @@ const unsafeMakeChildFiber = (effect, parentFiber, parentRuntimeFlags, overrideS
13804
14044
  return childFiber;
13805
14045
  };
13806
14046
  /* @internal */
13807
- const forkWithScopeOverride = (self, scopeOverride) => withFiberRuntime((parentFiber, parentStatus) => succeed$2(unsafeFork$1(self, parentFiber, parentStatus.runtimeFlags, scopeOverride)));
14047
+ const forkWithScopeOverride = (self, scopeOverride) => withFiberRuntime((parentFiber, parentStatus) => succeed$3(unsafeFork$1(self, parentFiber, parentStatus.runtimeFlags, scopeOverride)));
13808
14048
  /* @internal */
13809
14049
  const parallelFinalizers = self => contextWithEffect(context => match$3(getOption(context, scopeTag), {
13810
14050
  onNone: () => self,
@@ -13866,7 +14106,7 @@ const scopeTag = /*#__PURE__*/GenericTag("effect/Scope");
13866
14106
  /* @internal */
13867
14107
  const scopeExtend = /*#__PURE__*/dual(2, (effect, scope) => mapInputContext(effect,
13868
14108
  // @ts-expect-error
13869
- merge$1(make$j(scopeTag, scope))));
14109
+ merge$1(make$m(scopeTag, scope))));
13870
14110
  // circular with Supervisor
13871
14111
  /** @internal */
13872
14112
  const fiberRefUnsafeMakeSupervisor = initial => fiberRefUnsafeMakePatch(initial, {
@@ -13913,16 +14153,485 @@ const invokeWithInterrupt = (self, entries, onInterrupt) => fiberIdWith(id => fl
13913
14153
  return sync(() => {
13914
14154
  cleanup.forEach(f => f());
13915
14155
  });
13916
- })), () => suspend(() => {
14156
+ })), () => suspend$1(() => {
13917
14157
  const residual = entries.flatMap(entry => {
13918
14158
  if (!entry.state.completed) {
13919
14159
  return [entry];
13920
14160
  }
13921
14161
  return [];
13922
14162
  });
13923
- return forEachSequentialDiscard(residual, entry => complete(entry.request, exitInterrupt$1(id)));
14163
+ return forEachSequentialDiscard(residual, entry => complete$1(entry.request, exitInterrupt$1(id)));
13924
14164
  })));
13925
14165
 
14166
+ /** @internal */
14167
+ const complete = (key, exit, entryStats, timeToLiveMillis) => struct({
14168
+ _tag: "Complete",
14169
+ key,
14170
+ exit,
14171
+ entryStats,
14172
+ timeToLiveMillis
14173
+ });
14174
+ /** @internal */
14175
+ const pending = (key, deferred) => struct({
14176
+ _tag: "Pending",
14177
+ key,
14178
+ deferred
14179
+ });
14180
+ /** @internal */
14181
+ const refreshing = (deferred, complete) => struct({
14182
+ _tag: "Refreshing",
14183
+ deferred,
14184
+ complete
14185
+ });
14186
+ /** @internal */
14187
+ const MapKeyTypeId = /*#__PURE__*/Symbol.for("effect/Cache/MapKey");
14188
+ class MapKeyImpl {
14189
+ current;
14190
+ [MapKeyTypeId] = MapKeyTypeId;
14191
+ previous = undefined;
14192
+ next = undefined;
14193
+ constructor(current) {
14194
+ this.current = current;
14195
+ }
14196
+ [symbol$1]() {
14197
+ return pipe(hash(this.current), combine$5(hash(this.previous)), combine$5(hash(this.next)), cached(this));
14198
+ }
14199
+ [symbol](that) {
14200
+ if (this === that) {
14201
+ return true;
14202
+ }
14203
+ return isMapKey(that) && equals$1(this.current, that.current) && equals$1(this.previous, that.previous) && equals$1(this.next, that.next);
14204
+ }
14205
+ }
14206
+ /** @internal */
14207
+ const makeMapKey = current => new MapKeyImpl(current);
14208
+ /** @internal */
14209
+ const isMapKey = u => hasProperty(u, MapKeyTypeId);
14210
+ class KeySetImpl {
14211
+ head = undefined;
14212
+ tail = undefined;
14213
+ add(key) {
14214
+ if (key !== this.tail) {
14215
+ if (this.tail === undefined) {
14216
+ this.head = key;
14217
+ this.tail = key;
14218
+ } else {
14219
+ const previous = key.previous;
14220
+ const next = key.next;
14221
+ if (next !== undefined) {
14222
+ key.next = undefined;
14223
+ if (previous !== undefined) {
14224
+ previous.next = next;
14225
+ next.previous = previous;
14226
+ } else {
14227
+ this.head = next;
14228
+ this.head.previous = undefined;
14229
+ }
14230
+ }
14231
+ this.tail.next = key;
14232
+ key.previous = this.tail;
14233
+ this.tail = key;
14234
+ }
14235
+ }
14236
+ }
14237
+ remove() {
14238
+ const key = this.head;
14239
+ if (key !== undefined) {
14240
+ const next = key.next;
14241
+ if (next !== undefined) {
14242
+ key.next = undefined;
14243
+ this.head = next;
14244
+ this.head.previous = undefined;
14245
+ } else {
14246
+ this.head = undefined;
14247
+ this.tail = undefined;
14248
+ }
14249
+ }
14250
+ return key;
14251
+ }
14252
+ }
14253
+ /** @internal */
14254
+ const makeKeySet = () => new KeySetImpl();
14255
+ /**
14256
+ * Constructs a new `CacheState` from the specified values.
14257
+ *
14258
+ * @internal
14259
+ */
14260
+ const makeCacheState = (map, keys, accesses, updating, hits, misses) => ({
14261
+ map,
14262
+ keys,
14263
+ accesses,
14264
+ updating,
14265
+ hits,
14266
+ misses
14267
+ });
14268
+ /**
14269
+ * Constructs an initial cache state.
14270
+ *
14271
+ * @internal
14272
+ */
14273
+ const initialCacheState = () => makeCacheState(empty$6(), makeKeySet(), unbounded(), make$g(false), 0, 0);
14274
+ /** @internal */
14275
+ const CacheSymbolKey = "effect/Cache";
14276
+ /** @internal */
14277
+ const CacheTypeId = /*#__PURE__*/Symbol.for(CacheSymbolKey);
14278
+ const cacheVariance = {
14279
+ /* c8 ignore next */
14280
+ _Key: _ => _,
14281
+ /* c8 ignore next */
14282
+ _Error: _ => _,
14283
+ /* c8 ignore next */
14284
+ _Value: _ => _
14285
+ };
14286
+ /** @internal */
14287
+ const ConsumerCacheSymbolKey = "effect/ConsumerCache";
14288
+ /** @internal */
14289
+ const ConsumerCacheTypeId = /*#__PURE__*/Symbol.for(ConsumerCacheSymbolKey);
14290
+ const consumerCacheVariance = {
14291
+ /* c8 ignore next */
14292
+ _Key: _ => _,
14293
+ /* c8 ignore next */
14294
+ _Error: _ => _,
14295
+ /* c8 ignore next */
14296
+ _Value: _ => _
14297
+ };
14298
+ /** @internal */
14299
+ const makeCacheStats = options => options;
14300
+ /** @internal */
14301
+ const makeEntryStats = loadedMillis => ({
14302
+ loadedMillis
14303
+ });
14304
+ class CacheImpl {
14305
+ capacity;
14306
+ context;
14307
+ fiberId;
14308
+ lookup;
14309
+ timeToLive;
14310
+ [CacheTypeId] = cacheVariance;
14311
+ [ConsumerCacheTypeId] = consumerCacheVariance;
14312
+ cacheState;
14313
+ constructor(capacity, context, fiberId, lookup, timeToLive) {
14314
+ this.capacity = capacity;
14315
+ this.context = context;
14316
+ this.fiberId = fiberId;
14317
+ this.lookup = lookup;
14318
+ this.timeToLive = timeToLive;
14319
+ this.cacheState = initialCacheState();
14320
+ }
14321
+ get(key) {
14322
+ return map(this.getEither(key), merge$3);
14323
+ }
14324
+ get cacheStats() {
14325
+ return sync(() => makeCacheStats({
14326
+ hits: this.cacheState.hits,
14327
+ misses: this.cacheState.misses,
14328
+ size: size(this.cacheState.map)
14329
+ }));
14330
+ }
14331
+ getOption(key) {
14332
+ return suspend$1(() => match$3(get$1(this.cacheState.map, key), {
14333
+ onNone: () => {
14334
+ const mapKey = makeMapKey(key);
14335
+ this.trackAccess(mapKey);
14336
+ this.trackMiss();
14337
+ return succeed$3(none$4());
14338
+ },
14339
+ onSome: value => this.resolveMapValue(value)
14340
+ }));
14341
+ }
14342
+ getOptionComplete(key) {
14343
+ return suspend$1(() => match$3(get$1(this.cacheState.map, key), {
14344
+ onNone: () => {
14345
+ const mapKey = makeMapKey(key);
14346
+ this.trackAccess(mapKey);
14347
+ this.trackMiss();
14348
+ return succeed$3(none$4());
14349
+ },
14350
+ onSome: value => this.resolveMapValue(value, true)
14351
+ }));
14352
+ }
14353
+ contains(key) {
14354
+ return sync(() => has(this.cacheState.map, key));
14355
+ }
14356
+ entryStats(key) {
14357
+ return sync(() => {
14358
+ const option = get$1(this.cacheState.map, key);
14359
+ if (isSome(option)) {
14360
+ switch (option.value._tag) {
14361
+ case "Complete":
14362
+ {
14363
+ const loaded = option.value.entryStats.loadedMillis;
14364
+ return some(makeEntryStats(loaded));
14365
+ }
14366
+ case "Pending":
14367
+ {
14368
+ return none$4();
14369
+ }
14370
+ case "Refreshing":
14371
+ {
14372
+ const loaded = option.value.complete.entryStats.loadedMillis;
14373
+ return some(makeEntryStats(loaded));
14374
+ }
14375
+ }
14376
+ }
14377
+ return none$4();
14378
+ });
14379
+ }
14380
+ getEither(key) {
14381
+ return suspend$1(() => {
14382
+ const k = key;
14383
+ let mapKey = undefined;
14384
+ let deferred = undefined;
14385
+ let value = getOrUndefined(get$1(this.cacheState.map, k));
14386
+ if (value === undefined) {
14387
+ deferred = unsafeMake$3(this.fiberId);
14388
+ mapKey = makeMapKey(k);
14389
+ if (has(this.cacheState.map, k)) {
14390
+ value = getOrUndefined(get$1(this.cacheState.map, k));
14391
+ } else {
14392
+ set(this.cacheState.map, k, pending(mapKey, deferred));
14393
+ }
14394
+ }
14395
+ if (value === undefined) {
14396
+ this.trackAccess(mapKey);
14397
+ this.trackMiss();
14398
+ return map(this.lookupValueOf(key, deferred), right);
14399
+ } else {
14400
+ return flatMap$1(this.resolveMapValue(value), match$3({
14401
+ onNone: () => this.getEither(key),
14402
+ onSome: value => succeed$3(left(value))
14403
+ }));
14404
+ }
14405
+ });
14406
+ }
14407
+ invalidate(key) {
14408
+ return sync(() => {
14409
+ remove$1(this.cacheState.map, key);
14410
+ });
14411
+ }
14412
+ invalidateWhen(key, when) {
14413
+ return sync(() => {
14414
+ const value = get$1(this.cacheState.map, key);
14415
+ if (isSome(value) && value.value._tag === "Complete") {
14416
+ if (value.value.exit._tag === "Success") {
14417
+ if (when(value.value.exit.value)) {
14418
+ remove$1(this.cacheState.map, key);
14419
+ }
14420
+ }
14421
+ }
14422
+ });
14423
+ }
14424
+ get invalidateAll() {
14425
+ return sync(() => {
14426
+ this.cacheState.map = empty$6();
14427
+ });
14428
+ }
14429
+ refresh(key) {
14430
+ return clockWith(clock => suspend$1(() => {
14431
+ const k = key;
14432
+ const deferred = unsafeMake$3(this.fiberId);
14433
+ let value = getOrUndefined(get$1(this.cacheState.map, k));
14434
+ if (value === undefined) {
14435
+ if (has(this.cacheState.map, k)) {
14436
+ value = getOrUndefined(get$1(this.cacheState.map, k));
14437
+ } else {
14438
+ set(this.cacheState.map, k, pending(makeMapKey(k), deferred));
14439
+ }
14440
+ }
14441
+ if (value === undefined) {
14442
+ return asVoid(this.lookupValueOf(key, deferred));
14443
+ } else {
14444
+ switch (value._tag) {
14445
+ case "Complete":
14446
+ {
14447
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
14448
+ const found = getOrUndefined(get$1(this.cacheState.map, k));
14449
+ if (equals$1(found, value)) {
14450
+ remove$1(this.cacheState.map, k);
14451
+ }
14452
+ return asVoid(this.get(key));
14453
+ }
14454
+ // Only trigger the lookup if we're still the current value, `completedResult`
14455
+ return pipe(this.lookupValueOf(key, deferred), when(() => {
14456
+ const current = getOrUndefined(get$1(this.cacheState.map, k));
14457
+ if (equals$1(current, value)) {
14458
+ const mapValue = refreshing(deferred, value);
14459
+ set(this.cacheState.map, k, mapValue);
14460
+ return true;
14461
+ }
14462
+ return false;
14463
+ }), asVoid);
14464
+ }
14465
+ case "Pending":
14466
+ {
14467
+ return _await(value.deferred);
14468
+ }
14469
+ case "Refreshing":
14470
+ {
14471
+ return _await(value.deferred);
14472
+ }
14473
+ }
14474
+ }
14475
+ }));
14476
+ }
14477
+ set(key, value) {
14478
+ return clockWith(clock => sync(() => {
14479
+ const now = clock.unsafeCurrentTimeMillis();
14480
+ const k = key;
14481
+ const lookupResult = succeed$2(value);
14482
+ const mapValue = complete(makeMapKey(k), lookupResult, makeEntryStats(now), now + toMillis(decode(this.timeToLive(lookupResult))));
14483
+ set(this.cacheState.map, k, mapValue);
14484
+ }));
14485
+ }
14486
+ get size() {
14487
+ return sync(() => {
14488
+ return size(this.cacheState.map);
14489
+ });
14490
+ }
14491
+ get values() {
14492
+ return sync(() => {
14493
+ const values = [];
14494
+ for (const entry of this.cacheState.map) {
14495
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
14496
+ values.push(entry[1].exit.value);
14497
+ }
14498
+ }
14499
+ return values;
14500
+ });
14501
+ }
14502
+ get entries() {
14503
+ return sync(() => {
14504
+ const values = [];
14505
+ for (const entry of this.cacheState.map) {
14506
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
14507
+ values.push([entry[0], entry[1].exit.value]);
14508
+ }
14509
+ }
14510
+ return values;
14511
+ });
14512
+ }
14513
+ get keys() {
14514
+ return sync(() => {
14515
+ const keys = [];
14516
+ for (const entry of this.cacheState.map) {
14517
+ if (entry[1]._tag === "Complete" && entry[1].exit._tag === "Success") {
14518
+ keys.push(entry[0]);
14519
+ }
14520
+ }
14521
+ return keys;
14522
+ });
14523
+ }
14524
+ resolveMapValue(value, ignorePending = false) {
14525
+ return clockWith(clock => {
14526
+ switch (value._tag) {
14527
+ case "Complete":
14528
+ {
14529
+ this.trackAccess(value.key);
14530
+ if (this.hasExpired(clock, value.timeToLiveMillis)) {
14531
+ remove$1(this.cacheState.map, value.key.current);
14532
+ return succeed$3(none$4());
14533
+ }
14534
+ this.trackHit();
14535
+ return map(value.exit, some);
14536
+ }
14537
+ case "Pending":
14538
+ {
14539
+ this.trackAccess(value.key);
14540
+ this.trackHit();
14541
+ if (ignorePending) {
14542
+ return succeed$3(none$4());
14543
+ }
14544
+ return map(_await(value.deferred), some);
14545
+ }
14546
+ case "Refreshing":
14547
+ {
14548
+ this.trackAccess(value.complete.key);
14549
+ this.trackHit();
14550
+ if (this.hasExpired(clock, value.complete.timeToLiveMillis)) {
14551
+ if (ignorePending) {
14552
+ return succeed$3(none$4());
14553
+ }
14554
+ return map(_await(value.deferred), some);
14555
+ }
14556
+ return map(value.complete.exit, some);
14557
+ }
14558
+ }
14559
+ });
14560
+ }
14561
+ trackHit() {
14562
+ this.cacheState.hits = this.cacheState.hits + 1;
14563
+ }
14564
+ trackMiss() {
14565
+ this.cacheState.misses = this.cacheState.misses + 1;
14566
+ }
14567
+ trackAccess(key) {
14568
+ offer(this.cacheState.accesses, key);
14569
+ if (compareAndSet(this.cacheState.updating, false, true)) {
14570
+ let loop = true;
14571
+ while (loop) {
14572
+ const key = poll(this.cacheState.accesses, EmptyMutableQueue);
14573
+ if (key === EmptyMutableQueue) {
14574
+ loop = false;
14575
+ } else {
14576
+ this.cacheState.keys.add(key);
14577
+ }
14578
+ }
14579
+ let size$1 = size(this.cacheState.map);
14580
+ loop = size$1 > this.capacity;
14581
+ while (loop) {
14582
+ const key = this.cacheState.keys.remove();
14583
+ if (key !== undefined) {
14584
+ if (has(this.cacheState.map, key.current)) {
14585
+ remove$1(this.cacheState.map, key.current);
14586
+ size$1 = size$1 - 1;
14587
+ loop = size$1 > this.capacity;
14588
+ }
14589
+ } else {
14590
+ loop = false;
14591
+ }
14592
+ }
14593
+ set$2(this.cacheState.updating, false);
14594
+ }
14595
+ }
14596
+ hasExpired(clock, timeToLiveMillis) {
14597
+ return clock.unsafeCurrentTimeMillis() > timeToLiveMillis;
14598
+ }
14599
+ lookupValueOf(input, deferred) {
14600
+ return clockWith(clock => suspend$1(() => {
14601
+ const key = input;
14602
+ return pipe(this.lookup(input), provideContext$1(this.context), exit, flatMap$1(exit => {
14603
+ const now = clock.unsafeCurrentTimeMillis();
14604
+ const stats = makeEntryStats(now);
14605
+ const value = complete(makeMapKey(key), exit, stats, now + toMillis(decode(this.timeToLive(exit))));
14606
+ set(this.cacheState.map, key, value);
14607
+ return zipRight(done$2(deferred, exit), exit);
14608
+ }), onInterrupt(() => zipRight(interrupt(deferred), sync(() => {
14609
+ remove$1(this.cacheState.map, key);
14610
+ }))));
14611
+ }));
14612
+ }
14613
+ }
14614
+ /** @internal */
14615
+ const make$2 = options => {
14616
+ const timeToLive = decode(options.timeToLive);
14617
+ return makeWith({
14618
+ capacity: options.capacity,
14619
+ lookup: options.lookup,
14620
+ timeToLive: () => timeToLive
14621
+ });
14622
+ };
14623
+ /** @internal */
14624
+ const makeWith = options => map(all([context(), fiberId]), ([context, fiberId]) => new CacheImpl(options.capacity, context, fiberId, options.lookup, exit => decode(options.timeToLive(exit))));
14625
+
14626
+ /**
14627
+ * Constructs a new cache with the specified capacity, time to live, and
14628
+ * lookup function.
14629
+ *
14630
+ * @since 2.0.0
14631
+ * @category constructors
14632
+ */
14633
+ const make$1 = make$2;
14634
+
13926
14635
  /**
13927
14636
  * @since 2.0.0
13928
14637
  */
@@ -13952,7 +14661,7 @@ const makeDual = f => function () {
13952
14661
  };
13953
14662
  /** @internal */
13954
14663
  const unsafeFork = /*#__PURE__*/makeDual((runtime, self, options) => {
13955
- const fiberId = unsafeMake$3();
14664
+ const fiberId = unsafeMake$4();
13956
14665
  const fiberRefUpdates = [[currentContext, [[fiberId, runtime.context]]]];
13957
14666
  if (options?.scheduler) {
13958
14667
  fiberRefUpdates.push([currentScheduler, [[fiberId, options.scheduler]]]);
@@ -13985,31 +14694,6 @@ const unsafeFork = /*#__PURE__*/makeDual((runtime, self, options) => {
13985
14694
  return fiberRuntime;
13986
14695
  });
13987
14696
  /** @internal */
13988
- const unsafeRunSync = /*#__PURE__*/makeDual((runtime, effect) => {
13989
- const result = unsafeRunSyncExit(runtime)(effect);
13990
- if (result._tag === "Failure") {
13991
- throw fiberFailure(result.effect_instruction_i0);
13992
- }
13993
- return result.effect_instruction_i0;
13994
- });
13995
- class AsyncFiberExceptionImpl extends Error {
13996
- fiber;
13997
- _tag = "AsyncFiberException";
13998
- constructor(fiber) {
13999
- super(`Fiber #${fiber.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`);
14000
- this.fiber = fiber;
14001
- this.name = this._tag;
14002
- this.stack = this.message;
14003
- }
14004
- }
14005
- const asyncFiberException = fiber => {
14006
- const limit = Error.stackTraceLimit;
14007
- Error.stackTraceLimit = 0;
14008
- const error = new AsyncFiberExceptionImpl(fiber);
14009
- Error.stackTraceLimit = limit;
14010
- return error;
14011
- };
14012
- /** @internal */
14013
14697
  const FiberFailureId = /*#__PURE__*/Symbol.for("effect/Runtime/FiberFailure");
14014
14698
  /** @internal */
14015
14699
  const FiberFailureCauseId = /*#__PURE__*/Symbol.for("effect/Runtime/FiberFailure/Cause");
@@ -14078,23 +14762,6 @@ const fastPath = effect => {
14078
14762
  }
14079
14763
  };
14080
14764
  /** @internal */
14081
- const unsafeRunSyncExit = /*#__PURE__*/makeDual((runtime, effect) => {
14082
- const op = fastPath(effect);
14083
- if (op) {
14084
- return op;
14085
- }
14086
- const scheduler = new SyncScheduler();
14087
- const fiberRuntime = unsafeFork(runtime)(effect, {
14088
- scheduler
14089
- });
14090
- scheduler.flush();
14091
- const result = fiberRuntime.unsafePoll();
14092
- if (result) {
14093
- return result;
14094
- }
14095
- return exitDie$1(capture(asyncFiberException(fiberRuntime), currentSpanFromFiber(fiberRuntime)));
14096
- });
14097
- /** @internal */
14098
14765
  const unsafeRunPromise = /*#__PURE__*/makeDual((runtime, effect, options) => unsafeRunPromiseExit(runtime, effect, options).then(result => {
14099
14766
  switch (result._tag) {
14100
14767
  case OP_SUCCESS:
@@ -14146,17 +14813,15 @@ class RuntimeImpl {
14146
14813
  /** @internal */
14147
14814
  const make = options => new RuntimeImpl(options.context, options.runtimeFlags, options.fiberRefs);
14148
14815
  /** @internal */
14149
- const defaultRuntimeFlags = /*#__PURE__*/make$a(Interruption, CooperativeYielding, RuntimeMetrics);
14816
+ const defaultRuntimeFlags = /*#__PURE__*/make$d(Interruption, CooperativeYielding, RuntimeMetrics);
14150
14817
  /** @internal */
14151
14818
  const defaultRuntime = /*#__PURE__*/make({
14152
- context: /*#__PURE__*/empty$h(),
14819
+ context: /*#__PURE__*/empty$i(),
14153
14820
  runtimeFlags: defaultRuntimeFlags,
14154
14821
  fiberRefs: /*#__PURE__*/empty$2()
14155
14822
  });
14156
14823
  /** @internal */
14157
14824
  const unsafeRunPromiseEffect = /*#__PURE__*/unsafeRunPromise(defaultRuntime);
14158
- /** @internal */
14159
- const unsafeRunSyncEffect = /*#__PURE__*/unsafeRunSync(defaultRuntime);
14160
14825
 
14161
14826
  /**
14162
14827
  * Provides a constructor for a Case Class.
@@ -14254,7 +14919,7 @@ const TaggedError = tag => {
14254
14919
  * @since 2.0.0
14255
14920
  * @category Creating Effects
14256
14921
  */
14257
- const gen = gen$1;
14922
+ const gen = gen$2;
14258
14923
  /**
14259
14924
  * Creates an `Effect` that always succeeds with a given value.
14260
14925
  *
@@ -14280,7 +14945,7 @@ const gen = gen$1;
14280
14945
  * @since 2.0.0
14281
14946
  * @category Creating Effects
14282
14947
  */
14283
- const succeed = succeed$2;
14948
+ const succeed = succeed$3;
14284
14949
  /**
14285
14950
  * Handles all errors in an effect by providing a fallback effect.
14286
14951
  *
@@ -14337,72 +15002,6 @@ const succeed = succeed$2;
14337
15002
  * @category Error handling
14338
15003
  */
14339
15004
  const catchAll = catchAll$1;
14340
- const try_ = try_$1;
14341
- /**
14342
- * Creates an `Effect` that represents an asynchronous computation that might
14343
- * fail.
14344
- *
14345
- * **When to Use**
14346
- *
14347
- * In situations where you need to perform asynchronous operations that might
14348
- * fail, such as fetching data from an API, you can use the `tryPromise`
14349
- * constructor. This constructor is designed to handle operations that could
14350
- * throw exceptions by capturing those exceptions and transforming them into
14351
- * manageable errors.
14352
- *
14353
- * **Error Handling**
14354
- *
14355
- * There are two ways to handle errors with `tryPromise`:
14356
- *
14357
- * 1. If you don't provide a `catch` function, the error is caught and the
14358
- * effect fails with an `UnknownException`.
14359
- * 2. If you provide a `catch` function, the error is caught and the `catch`
14360
- * function maps it to an error of type `E`.
14361
- *
14362
- * **Interruptions**
14363
- *
14364
- * An optional `AbortSignal` can be provided to allow for interruption of the
14365
- * wrapped `Promise` API.
14366
- *
14367
- * **Example** (Fetching a TODO Item)
14368
- *
14369
- * ```ts
14370
- * import { Effect } from "effect"
14371
- *
14372
- * const getTodo = (id: number) =>
14373
- * // Will catch any errors and propagate them as UnknownException
14374
- * Effect.tryPromise(() =>
14375
- * fetch(`https://jsonplaceholder.typicode.com/todos/${id}`)
14376
- * )
14377
- *
14378
- * // ┌─── Effect<Response, UnknownException, never>
14379
- * // ▼
14380
- * const program = getTodo(1)
14381
- * ```
14382
- *
14383
- * **Example** (Custom Error Handling)
14384
- *
14385
- * ```ts
14386
- * import { Effect } from "effect"
14387
- *
14388
- * const getTodo = (id: number) =>
14389
- * Effect.tryPromise({
14390
- * try: () => fetch(`https://jsonplaceholder.typicode.com/todos/${id}`),
14391
- * // remap the error
14392
- * catch: (unknown) => new Error(`something went wrong ${unknown}`)
14393
- * })
14394
- *
14395
- * // ┌─── Effect<Response, Error, never>
14396
- * // ▼
14397
- * const program = getTodo(1)
14398
- * ```
14399
- *
14400
- * @see {@link promise} if the effectful computation is asynchronous and does not throw errors.
14401
- *
14402
- * @since 2.0.0
14403
- * @category Creating Effects
14404
- */
14405
- const tryPromise = tryPromise$1;
14406
15005
  /**
14407
15006
  * Execute a side effect on failure without modifying the original effect.
14408
15007
  *
@@ -14467,51 +15066,6 @@ const logWarning = logWarning$1;
14467
15066
  * @category Logging
14468
15067
  */
14469
15068
  const logError = logError$1;
14470
- /**
14471
- * Ensures the effect always succeeds by replacing failures with a default
14472
- * success value.
14473
- *
14474
- * **Details**
14475
- *
14476
- * This function transforms an effect that may fail into one that cannot fail by
14477
- * replacing any failure with a provided success value. If the original effect
14478
- * fails, the failure is "swallowed," and the specified success value is
14479
- * returned instead. If the original effect succeeds, its value remains
14480
- * unchanged.
14481
- *
14482
- * **When to Use**
14483
- *
14484
- * This is especially useful for providing default values in case of failure,
14485
- * ensuring that an effect always completes successfully. By using this
14486
- * function, you can avoid the need for complex error handling and guarantee a
14487
- * fallback result.
14488
- *
14489
- * **Example**
14490
- *
14491
- * ```ts
14492
- * import { Effect } from "effect"
14493
- *
14494
- * const validate = (age: number): Effect.Effect<number, string> => {
14495
- * if (age < 0) {
14496
- * return Effect.fail("NegativeAgeError")
14497
- * } else if (age < 18) {
14498
- * return Effect.fail("IllegalAgeError")
14499
- * } else {
14500
- * return Effect.succeed(age)
14501
- * }
14502
- * }
14503
- *
14504
- * const program = Effect.orElseSucceed(validate(-1), () => 18)
14505
- *
14506
- * console.log(Effect.runSyncExit(program))
14507
- * // Output:
14508
- * // { _id: 'Exit', _tag: 'Success', value: 18 }
14509
- * ```
14510
- *
14511
- * @since 2.0.0
14512
- * @category Fallback
14513
- */
14514
- const orElseSucceed = orElseSucceed$1;
14515
15069
  /**
14516
15070
  * Executes an effect and returns the result as a `Promise`.
14517
15071
  *
@@ -14557,99 +15111,86 @@ const orElseSucceed = orElseSucceed$1;
14557
15111
  * @category Running Effects
14558
15112
  */
14559
15113
  const runPromise = unsafeRunPromiseEffect;
14560
- /**
14561
- * Executes an effect synchronously, running it immediately and returning the
14562
- * result.
14563
- *
14564
- * **Details**
14565
- *
14566
- * This function evaluates the provided effect synchronously, returning its
14567
- * result directly. It is ideal for effects that do not fail or include
14568
- * asynchronous operations. If the effect does fail or involves async tasks, it
14569
- * will throw an error. Execution stops at the point of failure or asynchronous
14570
- * operation, making it unsuitable for effects that require asynchronous
14571
- * handling.
14572
- *
14573
- * **Important**: Attempting to run effects that involve asynchronous operations
14574
- * or failures will result in exceptions being thrown, so use this function with
14575
- * care for purely synchronous and error-free effects.
14576
- *
14577
- * **When to Use**
14578
- *
14579
- * Use this function when:
14580
- * - You are sure that the effect will not fail or involve asynchronous
14581
- * operations.
14582
- * - You need a direct, synchronous result from the effect.
14583
- * - You are working within a context where asynchronous effects are not
14584
- * allowed.
14585
- *
14586
- * Avoid using this function for effects that can fail or require asynchronous
14587
- * handling. For such cases, consider using {@link runPromise} or
14588
- * {@link runSyncExit}.
14589
- *
14590
- * **Example** (Synchronous Logging)
14591
- *
14592
- * ```ts
14593
- * import { Effect } from "effect"
14594
- *
14595
- * const program = Effect.sync(() => {
14596
- * console.log("Hello, World!")
14597
- * return 1
14598
- * })
14599
- *
14600
- * const result = Effect.runSync(program)
14601
- * // Output: Hello, World!
14602
- *
14603
- * console.log(result)
14604
- * // Output: 1
14605
- * ```
14606
- *
14607
- * **Example** (Incorrect Usage with Failing or Async Effects)
14608
- *
14609
- * ```ts
14610
- * import { Effect } from "effect"
14611
- *
14612
- * try {
14613
- * // Attempt to run an effect that fails
14614
- * Effect.runSync(Effect.fail("my error"))
14615
- * } catch (e) {
14616
- * console.error(e)
14617
- * }
14618
- * // Output:
14619
- * // (FiberFailure) Error: my error
14620
- *
14621
- * try {
14622
- * // Attempt to run an effect that involves async work
14623
- * Effect.runSync(Effect.promise(() => Promise.resolve(1)))
14624
- * } catch (e) {
14625
- * console.error(e)
14626
- * }
14627
- * // Output:
14628
- * // (FiberFailure) AsyncFiberException: Fiber #0 cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work
14629
- * ```
14630
- *
14631
- * @see {@link runSyncExit} for a version that returns an `Exit` type instead of
14632
- * throwing an error.
14633
- *
14634
- * @since 2.0.0
14635
- * @category Running Effects
14636
- */
14637
- const runSync = unsafeRunSyncEffect;
14638
15114
 
14639
- function getLocationBase() {
14640
- return import.meta?.url ?? window?.location?.origin ?? '';
15115
+ class FetchError extends TaggedError('FetchError') {
15116
+ }
15117
+ class NotFoundError extends TaggedError('NotFoundError') {
15118
+ }
15119
+ const httpClient = (input, init) => gen$1(function* () {
15120
+ const response = yield* tryPromise({
15121
+ try: () => fetch(input, init),
15122
+ catch: error => new FetchError({ cause: error }),
15123
+ });
15124
+ if (response.status === 404) {
15125
+ return yield* fail(new NotFoundError({ url: response.url }));
15126
+ }
15127
+ return response;
15128
+ });
15129
+ class ResponseTextError extends TaggedError('ResponseTextError') {
15130
+ constructor(error) {
15131
+ super(new Error(`Failed to read response text`, { cause: error }));
15132
+ }
14641
15133
  }
15134
+ const responseAsText = (res) => tryPromise({
15135
+ try: () => res.text(),
15136
+ catch: error => new ResponseTextError(error),
15137
+ });
14642
15138
 
14643
- class URLCreationError extends TaggedError('URLCreationError') {
15139
+ const SVGString = refined(isValidSVG, () => error('SVG data is malformed'));
15140
+ class BrandValidationError extends TaggedError('BrandValidationError') {
15141
+ constructor(error, type) {
15142
+ super(new Error(`Brand validation failed for type ${type}.`, { cause: error }));
15143
+ }
14644
15144
  }
14645
- const relativeAssetsPath = '../../assets';
14646
- const syncCreateAssetUrlSafely = (file, pathFromAssetRoot) => {
14647
- const relativeAssetPath = joinPath(relativeAssetsPath, pathFromAssetRoot, file);
14648
- return try_(() => getAssetPath(relativeAssetPath)).pipe(tapError(() => logWarning(`Failed to create URL for asset "${file}" in path "${pathFromAssetRoot}".
14649
- Please provide an absolute URL in your app's 'setAssetPath(...)' configuration! Falling back to a relative URL, which may work in some environments but is not guaranteed to be correct.`)), orElseSucceed(() => new URL(relativeAssetPath, getLocationBase())));
14650
- };
14651
- function joinPath(...parts) {
14652
- return parts.filter(Boolean).join('/').replace('//', '/').replace('/./', '/');
15145
+ const createValidSVGString = (svg) => try_({
15146
+ try: () => SVGString(svg),
15147
+ catch: error => new BrandValidationError(error, 'SVGString'),
15148
+ });
15149
+ function isValidSVG(svg) {
15150
+ if (typeof svg !== 'string') {
15151
+ return false;
15152
+ }
15153
+ try {
15154
+ const parser = new DOMParser();
15155
+ const doc = parser.parseFromString(svg, 'image/svg+xml');
15156
+ return doc.documentElement.nodeName === 'svg';
15157
+ }
15158
+ catch {
15159
+ return false;
15160
+ }
15161
+ }
15162
+
15163
+ const emptyDefaultSvg = () => SVGString(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>`);
15164
+ const createIconCache = () => make$1({
15165
+ capacity: 200,
15166
+ timeToLive: infinity,
15167
+ lookup: (key) => gen(function* () {
15168
+ const name = key;
15169
+ const assetPath = createAssetUrlSafely(`${name}.svg`, 'icons');
15170
+ const res = yield* httpClient(assetPath);
15171
+ const responseString = yield* responseAsText(res);
15172
+ return yield* createValidSVGString(responseString);
15173
+ }),
15174
+ });
15175
+ let cacheInstance = null;
15176
+ function fetchIconSvg(name) {
15177
+ const key = name;
15178
+ return gen(function* () {
15179
+ if (!cacheInstance) {
15180
+ cacheInstance = yield* createIconCache();
15181
+ }
15182
+ return yield* cacheInstance.get(key);
15183
+ });
15184
+ }
15185
+ function clearIconCache() {
15186
+ return gen(function* () {
15187
+ if (cacheInstance) {
15188
+ yield* cacheInstance.invalidateAll;
15189
+ }
15190
+ else {
15191
+ logWarning('Attempted to clear icon cache before it was initialized');
15192
+ }
15193
+ });
14653
15194
  }
14654
15195
 
14655
- export { hasProperty as $, merge$3 as A, sync as B, size as C, suspend as D, get$1 as E, succeed$2 as F, none$4 as G, has as H, isSome as I, some as J, getOrUndefined as K, set as L, struct as M, NodeInspectSymbol as N, flatMap$1 as O, remove as P, empty$5 as Q, clockWith as R, compareAndSet as S, set$2 as T, make$d as U, symbol$1 as V, pipe as W, cached as X, combine$5 as Y, hash as Z, symbol as _, runSync as a, equals$1 as a0, asVoid as a1, when as a2, toMillis as a3, onInterrupt as a4, zipRight as a5, exit as a6, provideContext$1 as a7, context as a8, fiberId as a9, TaggedError as aa, gen as ab, tryPromise as ac, try_ as ad, infinity as ae, logWarning as af, succeed as b, catchAll as c, right as d, left as e, isRight as f, getOrThrowWith$1 as g, getRight as h, identity as i, deferredUnsafeMake as j, deferredAwait as k, logError as l, match$3 as m, deferredInterrupt as n, deferredDone as o, exitSucceed$1 as p, dual as q, runPromise as r, syncCreateAssetUrlSafely as s, tapError as t, pipeArguments as u, toJSON as v, format$2 as w, decode as x, map as y, all as z };
15196
+ export { catchAll as a, clearIconCache as c, emptyDefaultSvg as e, fetchIconSvg as f, logError as l, runPromise as r, succeed as s, tapError as t };