@brytdesigns/shopify-ajax-cart-api 1.0.34 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -930,14 +930,6 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => isNone2(self) ? false
930
930
  var _equivalence = /* @__PURE__ */ equivalence();
931
931
  var contains = /* @__PURE__ */ containsWith(_equivalence);
932
932
  var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
933
- var mergeWith = (f) => (o1, o2) => {
934
- if (isNone2(o1)) {
935
- return o2;
936
- } else if (isNone2(o2)) {
937
- return o1;
938
- }
939
- return some2(f(o1.value, o2.value));
940
- };
941
933
 
942
934
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/Tuple.js
943
935
  var make3 = (...elements) => elements;
@@ -1010,8 +1002,8 @@ var isEmptyArray = (self) => self.length === 0;
1010
1002
  var isEmptyReadonlyArray = isEmptyArray;
1011
1003
  var isNonEmptyArray2 = isNonEmptyArray;
1012
1004
  var isNonEmptyReadonlyArray = isNonEmptyArray;
1013
- var isOutOfBounds = (i, as7) => i < 0 || i >= as7.length;
1014
- var clamp = (i, as7) => Math.floor(Math.min(Math.max(0, i), as7.length));
1005
+ var isOutOfBounds = (i, as6) => i < 0 || i >= as6.length;
1006
+ var clamp = (i, as6) => Math.floor(Math.min(Math.max(0, i), as6.length));
1015
1007
  var get = /* @__PURE__ */ dual(2, (self, index) => {
1016
1008
  const i = Math.floor(index);
1017
1009
  return isOutOfBounds(i, self) ? none2() : some2(self[i]);
@@ -1051,13 +1043,13 @@ var sort = /* @__PURE__ */ dual(2, (self, O) => {
1051
1043
  });
1052
1044
  var zip = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, make3));
1053
1045
  var zipWith = /* @__PURE__ */ dual(3, (self, that, f) => {
1054
- const as7 = fromIterable(self);
1046
+ const as6 = fromIterable(self);
1055
1047
  const bs = fromIterable(that);
1056
- if (isNonEmptyReadonlyArray(as7) && isNonEmptyReadonlyArray(bs)) {
1057
- const out = [f(headNonEmpty(as7), headNonEmpty(bs))];
1058
- const len = Math.min(as7.length, bs.length);
1048
+ if (isNonEmptyReadonlyArray(as6) && isNonEmptyReadonlyArray(bs)) {
1049
+ const out = [f(headNonEmpty(as6), headNonEmpty(bs))];
1050
+ const len = Math.min(as6.length, bs.length);
1059
1051
  for (let i = 1; i < len; i++) {
1060
- out[i] = f(as7[i], bs[i]);
1052
+ out[i] = f(as6[i], bs[i]);
1061
1053
  }
1062
1054
  return out;
1063
1055
  }
@@ -1111,10 +1103,10 @@ var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => {
1111
1103
  });
1112
1104
  var flatten = /* @__PURE__ */ flatMap2(identity);
1113
1105
  var filterMap2 = /* @__PURE__ */ dual(2, (self, f) => {
1114
- const as7 = fromIterable(self);
1106
+ const as6 = fromIterable(self);
1115
1107
  const out = [];
1116
- for (let i = 0; i < as7.length; i++) {
1117
- const o = f(as7[i], i);
1108
+ for (let i = 0; i < as6.length; i++) {
1109
+ const o = f(as6[i], i);
1118
1110
  if (isSome2(o)) {
1119
1111
  out.push(o.value);
1120
1112
  }
@@ -1122,11 +1114,11 @@ var filterMap2 = /* @__PURE__ */ dual(2, (self, f) => {
1122
1114
  return out;
1123
1115
  });
1124
1116
  var filter3 = /* @__PURE__ */ dual(2, (self, predicate) => {
1125
- const as7 = fromIterable(self);
1117
+ const as6 = fromIterable(self);
1126
1118
  const out = [];
1127
- for (let i = 0; i < as7.length; i++) {
1128
- if (predicate(as7[i], i)) {
1129
- out.push(as7[i]);
1119
+ for (let i = 0; i < as6.length; i++) {
1120
+ if (predicate(as6[i], i)) {
1121
+ out.push(as6[i]);
1130
1122
  }
1131
1123
  }
1132
1124
  return out;
@@ -1212,53 +1204,53 @@ var ChunkProto = {
1212
1204
  }
1213
1205
  };
1214
1206
  var makeChunk = (backing) => {
1215
- const chunk3 = Object.create(ChunkProto);
1216
- chunk3.backing = backing;
1207
+ const chunk2 = Object.create(ChunkProto);
1208
+ chunk2.backing = backing;
1217
1209
  switch (backing._tag) {
1218
1210
  case "IEmpty": {
1219
- chunk3.length = 0;
1220
- chunk3.depth = 0;
1221
- chunk3.left = chunk3;
1222
- chunk3.right = chunk3;
1211
+ chunk2.length = 0;
1212
+ chunk2.depth = 0;
1213
+ chunk2.left = chunk2;
1214
+ chunk2.right = chunk2;
1223
1215
  break;
1224
1216
  }
1225
1217
  case "IConcat": {
1226
- chunk3.length = backing.left.length + backing.right.length;
1227
- chunk3.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
1228
- chunk3.left = backing.left;
1229
- chunk3.right = backing.right;
1218
+ chunk2.length = backing.left.length + backing.right.length;
1219
+ chunk2.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
1220
+ chunk2.left = backing.left;
1221
+ chunk2.right = backing.right;
1230
1222
  break;
1231
1223
  }
1232
1224
  case "IArray": {
1233
- chunk3.length = backing.array.length;
1234
- chunk3.depth = 0;
1235
- chunk3.left = _empty;
1236
- chunk3.right = _empty;
1225
+ chunk2.length = backing.array.length;
1226
+ chunk2.depth = 0;
1227
+ chunk2.left = _empty;
1228
+ chunk2.right = _empty;
1237
1229
  break;
1238
1230
  }
1239
1231
  case "ISingleton": {
1240
- chunk3.length = 1;
1241
- chunk3.depth = 0;
1242
- chunk3.left = _empty;
1243
- chunk3.right = _empty;
1232
+ chunk2.length = 1;
1233
+ chunk2.depth = 0;
1234
+ chunk2.left = _empty;
1235
+ chunk2.right = _empty;
1244
1236
  break;
1245
1237
  }
1246
1238
  case "ISlice": {
1247
- chunk3.length = backing.length;
1248
- chunk3.depth = backing.chunk.depth + 1;
1249
- chunk3.left = _empty;
1250
- chunk3.right = _empty;
1239
+ chunk2.length = backing.length;
1240
+ chunk2.depth = backing.chunk.depth + 1;
1241
+ chunk2.left = _empty;
1242
+ chunk2.right = _empty;
1251
1243
  break;
1252
1244
  }
1253
1245
  }
1254
- return chunk3;
1246
+ return chunk2;
1255
1247
  };
1256
1248
  var isChunk = (u) => hasProperty(u, TypeId3);
1257
1249
  var _empty = /* @__PURE__ */ makeChunk({
1258
1250
  _tag: "IEmpty"
1259
1251
  });
1260
1252
  var empty3 = () => _empty;
1261
- var make4 = (...as7) => unsafeFromNonEmptyArray(as7);
1253
+ var make4 = (...as6) => unsafeFromNonEmptyArray(as6);
1262
1254
  var of2 = (a) => makeChunk({
1263
1255
  _tag: "ISingleton",
1264
1256
  a
@@ -2285,14 +2277,6 @@ var failureOrCause = (self) => {
2285
2277
  }
2286
2278
  }
2287
2279
  };
2288
- var flipCauseOption = (self) => match3(self, {
2289
- onEmpty: some2(empty7),
2290
- onFail: map2(fail),
2291
- onDie: (defect) => some2(die(defect)),
2292
- onInterrupt: (fiberId2) => some2(interrupt(fiberId2)),
2293
- onSequential: mergeWith(sequential),
2294
- onParallel: mergeWith(parallel)
2295
- });
2296
2280
  var interruptOption = (self) => find(self, (cause2) => cause2._tag === OP_INTERRUPT ? some2(cause2.fiberId) : none2());
2297
2281
  var stripFailures = (self) => match3(self, {
2298
2282
  onEmpty: empty7,
@@ -2676,12 +2660,12 @@ var prettyErrorStack = (message, stack, span2) => {
2676
2660
  const stack2 = stackFn();
2677
2661
  if (typeof stack2 === "string") {
2678
2662
  const locationMatchAll = stack2.matchAll(locationRegex);
2679
- let match15 = false;
2663
+ let match14 = false;
2680
2664
  for (const [, location2] of locationMatchAll) {
2681
- match15 = true;
2665
+ match14 = true;
2682
2666
  out.push(` at ${current.name} (${location2})`);
2683
2667
  }
2684
- if (!match15) {
2668
+ if (!match14) {
2685
2669
  out.push(` at ${current.name} (${stack2.replace(/^at /, "")})`);
2686
2670
  }
2687
2671
  } else {
@@ -2869,12 +2853,6 @@ var unsafeGet3 = /* @__PURE__ */ dual(2, (self, tag2) => {
2869
2853
  return self.unsafeMap.get(tag2.key);
2870
2854
  });
2871
2855
  var get4 = unsafeGet3;
2872
- var getOrElse2 = /* @__PURE__ */ dual(3, (self, tag2, orElse9) => {
2873
- if (!self.unsafeMap.has(tag2.key)) {
2874
- return isReference(tag2) ? getDefaultValue(tag2) : orElse9();
2875
- }
2876
- return self.unsafeMap.get(tag2.key);
2877
- });
2878
2856
  var getOption = /* @__PURE__ */ dual(2, (self, tag2) => {
2879
2857
  if (!self.unsafeMap.has(tag2.key)) {
2880
2858
  return isReference(tag2) ? some(getDefaultValue(tag2)) : none;
@@ -2897,7 +2875,6 @@ var empty9 = empty8;
2897
2875
  var make9 = make8;
2898
2876
  var add4 = add3;
2899
2877
  var get5 = get4;
2900
- var getOrElse3 = getOrElse2;
2901
2878
  var unsafeGet4 = unsafeGet3;
2902
2879
  var getOption2 = getOption;
2903
2880
  var merge3 = merge2;
@@ -2928,9 +2905,9 @@ var decode = (input) => {
2928
2905
  }
2929
2906
  return nanos(BigInt(Math.round(input[0] * 1e9)) + BigInt(Math.round(input[1])));
2930
2907
  } else if (isString(input)) {
2931
- const match15 = DURATION_REGEX.exec(input);
2932
- if (match15) {
2933
- const [_, valueStr, unit] = match15;
2908
+ const match14 = DURATION_REGEX.exec(input);
2909
+ if (match14) {
2910
+ const [_, valueStr, unit] = match14;
2934
2911
  const value2 = Number(valueStr);
2935
2912
  switch (unit) {
2936
2913
  case "nano":
@@ -3398,27 +3375,27 @@ var ConsProto = {
3398
3375
  return cached(this, array2(toArray2(this)));
3399
3376
  },
3400
3377
  [Symbol.iterator]() {
3401
- let done8 = false;
3378
+ let done7 = false;
3402
3379
  let self = this;
3403
3380
  return {
3404
3381
  next() {
3405
- if (done8) {
3382
+ if (done7) {
3406
3383
  return this.return();
3407
3384
  }
3408
3385
  if (self._tag === "Nil") {
3409
- done8 = true;
3386
+ done7 = true;
3410
3387
  return this.return();
3411
3388
  }
3412
3389
  const value2 = self.head;
3413
3390
  self = self.tail;
3414
3391
  return {
3415
- done: done8,
3392
+ done: done7,
3416
3393
  value: value2
3417
3394
  };
3418
3395
  },
3419
3396
  return(value2) {
3420
- if (!done8) {
3421
- done8 = true;
3397
+ if (!done7) {
3398
+ done7 = true;
3422
3399
  }
3423
3400
  return {
3424
3401
  done: true,
@@ -3528,7 +3505,7 @@ var Structural = /* @__PURE__ */ function() {
3528
3505
  Structural2.prototype = StructuralPrototype;
3529
3506
  return Structural2;
3530
3507
  }();
3531
- var struct = (as7) => Object.assign(Object.create(StructuralPrototype), as7);
3508
+ var struct = (as6) => Object.assign(Object.create(StructuralPrototype), as6);
3532
3509
 
3533
3510
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/differ/contextPatch.js
3534
3511
  var ContextPatchTypeId = /* @__PURE__ */ Symbol.for("effect/DifferContextPatch");
@@ -4946,17 +4923,6 @@ var exitMap = /* @__PURE__ */ dual(2, (self, f) => {
4946
4923
  return exitSucceed(f(self.effect_instruction_i0));
4947
4924
  }
4948
4925
  });
4949
- var exitMapBoth = /* @__PURE__ */ dual(2, (self, {
4950
- onFailure,
4951
- onSuccess
4952
- }) => {
4953
- switch (self._tag) {
4954
- case OP_FAILURE:
4955
- return exitFailCause(pipe(self.effect_instruction_i0, map9(onFailure)));
4956
- case OP_SUCCESS:
4957
- return exitSucceed(onSuccess(self.effect_instruction_i0));
4958
- }
4959
- });
4960
4926
  var exitMatch = /* @__PURE__ */ dual(2, (self, {
4961
4927
  onFailure,
4962
4928
  onSuccess
@@ -5025,7 +4991,7 @@ var exitCollectAllInternal = (exits, combineCauses) => {
5025
4991
  return pipe(tailNonEmpty2(list), reduce(pipe(headNonEmpty2(list), exitMap(of2)), (accumulator, current) => pipe(accumulator, exitZipWith(current, {
5026
4992
  onSuccess: (list2, value2) => pipe(list2, prepend2(value2)),
5027
4993
  onFailure: combineCauses
5028
- }))), exitMap(reverse2), exitMap((chunk3) => toReadonlyArray(chunk3)), some2);
4994
+ }))), exitMap(reverse2), exitMap((chunk2) => toReadonlyArray(chunk2)), some2);
5029
4995
  };
5030
4996
  var deferredUnsafeMake = (fiberId2) => {
5031
4997
  const _deferred = {
@@ -5431,7 +5397,7 @@ var makeFlat = (options3) => ({
5431
5397
  enumerateChildren: options3.enumerateChildren
5432
5398
  });
5433
5399
  var fromFlat = (flat) => make20({
5434
- load: (config) => flatMap7(fromFlatLoop(flat, empty2(), config, false), (chunk3) => match2(head(chunk3), {
5400
+ load: (config) => flatMap7(fromFlatLoop(flat, empty2(), config, false), (chunk2) => match2(head(chunk2), {
5435
5401
  onNone: () => fail2(MissingData(empty2(), `Expected a single value having structure: ${config}`)),
5436
5402
  onSome: succeed
5437
5403
  })),
@@ -5602,9 +5568,9 @@ var indicesFrom = (quotedIndices) => pipe(forEachSequential(quotedIndices, parse
5602
5568
  }), either2, map11(merge));
5603
5569
  var QUOTED_INDEX_REGEX = /^(\[(\d+)\])$/;
5604
5570
  var parseQuotedIndex = (str) => {
5605
- const match15 = str.match(QUOTED_INDEX_REGEX);
5606
- if (match15 !== null) {
5607
- const matchedIndex = match15[2];
5571
+ const match14 = str.match(QUOTED_INDEX_REGEX);
5572
+ if (match14 !== null) {
5573
+ const matchedIndex = match14[2];
5608
5574
  return pipe(matchedIndex !== void 0 && matchedIndex.length > 0 ? some2(matchedIndex) : none2(), flatMap(parseInteger));
5609
5575
  }
5610
5576
  return none2();
@@ -7001,15 +6967,56 @@ var memoize = (self) => pipe(deferredMake(), flatMap7((deferred) => pipe(diffFib
7001
6967
  var negate = (self) => map11(self, (b) => !b);
7002
6968
  var once = (self) => map11(make25(true), (ref) => asVoid(whenEffect(self, getAndSet2(ref, false))));
7003
6969
  var patchFiberRefs = (patch11) => updateFiberRefs((fiberId2, fiberRefs3) => pipe(patch11, patch6(fiberId2, fiberRefs3)));
6970
+ var promise = (evaluate2) => evaluate2.length >= 1 ? async_((resolve, signal) => {
6971
+ try {
6972
+ evaluate2(signal).then((a) => resolve(exitSucceed(a)), (e) => resolve(exitDie(e)));
6973
+ } catch (e) {
6974
+ resolve(exitDie(e));
6975
+ }
6976
+ }) : async_((resolve) => {
6977
+ try {
6978
+ ;
6979
+ evaluate2().then((a) => resolve(exitSucceed(a)), (e) => resolve(exitDie(e)));
6980
+ } catch (e) {
6981
+ resolve(exitDie(e));
6982
+ }
6983
+ });
7004
6984
  var provideService = /* @__PURE__ */ dual(3, (self, tag2, service2) => contextWithEffect((env) => provideContext(self, add4(env, tag2, service2))));
7005
6985
  var provideServiceEffect = /* @__PURE__ */ dual(3, (self, tag2, effect3) => contextWithEffect((env) => flatMap7(effect3, (service2) => provideContext(self, pipe(env, add4(tag2, service2))))));
7006
6986
  var sleep3 = sleep2;
7007
6987
  var succeedNone = /* @__PURE__ */ succeed(/* @__PURE__ */ none2());
7008
- var summarized = /* @__PURE__ */ dual(3, (self, summary5, f) => flatMap7(summary5, (start3) => flatMap7(self, (value2) => map11(summary5, (end4) => [f(start3, end4), value2]))));
6988
+ var summarized = /* @__PURE__ */ dual(3, (self, summary5, f) => flatMap7(summary5, (start3) => flatMap7(self, (value2) => map11(summary5, (end3) => [f(start3, end3), value2]))));
7009
6989
  var tapErrorCause = /* @__PURE__ */ dual(2, (self, f) => matchCauseEffect(self, {
7010
6990
  onFailure: (cause2) => zipRight(f(cause2), failCause(cause2)),
7011
6991
  onSuccess: succeed
7012
6992
  }));
6993
+ var tryPromise = (arg) => {
6994
+ let evaluate2;
6995
+ let catcher = void 0;
6996
+ if (typeof arg === "function") {
6997
+ evaluate2 = arg;
6998
+ } else {
6999
+ evaluate2 = arg.try;
7000
+ catcher = arg.catch;
7001
+ }
7002
+ const fail13 = (e) => catcher ? failSync(() => catcher(e)) : fail2(new UnknownException(e, "An unknown error occurred in Effect.tryPromise"));
7003
+ if (evaluate2.length >= 1) {
7004
+ return async_((resolve, signal) => {
7005
+ try {
7006
+ evaluate2(signal).then((a) => resolve(exitSucceed(a)), (e) => resolve(fail13(e)));
7007
+ } catch (e) {
7008
+ resolve(fail13(e));
7009
+ }
7010
+ });
7011
+ }
7012
+ return async_((resolve) => {
7013
+ try {
7014
+ evaluate2().then((a) => resolve(exitSucceed(a)), (e) => resolve(fail13(e)));
7015
+ } catch (e) {
7016
+ resolve(fail13(e));
7017
+ }
7018
+ });
7019
+ };
7013
7020
  var tryMap = /* @__PURE__ */ dual(2, (self, options3) => flatMap7(self, (a) => try_({
7014
7021
  try: () => options3.try(a),
7015
7022
  catch: options3.catch
@@ -7089,7 +7096,6 @@ var die3 = exitDie;
7089
7096
  var fail3 = exitFail;
7090
7097
  var failCause4 = exitFailCause;
7091
7098
  var map13 = exitMap;
7092
- var mapBoth3 = exitMapBoth;
7093
7099
  var match9 = exitMatch;
7094
7100
  var succeed4 = exitSucceed;
7095
7101
  var void_3 = exitVoid;
@@ -9701,10 +9707,10 @@ var forEach7 = /* @__PURE__ */ dual((args2) => isIterable(args2[0]), (self, f, o
9701
9707
  return match7(options3?.concurrency, () => finalizersMaskInternal(sequential3, options3?.concurrentFinalizers)((restore) => isRequestBatchingEnabled ? forEachParN(self, 1, (a, i) => restore(f(a, i)), true) : forEachSequential(self, (a, i) => restore(f(a, i)))), () => finalizersMaskInternal(parallel3, options3?.concurrentFinalizers)((restore) => forEachParUnbounded(self, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)), (n) => finalizersMaskInternal(parallelN2(n), options3?.concurrentFinalizers)((restore) => forEachParN(self, n, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)));
9702
9708
  }));
9703
9709
  var forEachParUnbounded = (self, f, batching) => suspend(() => {
9704
- const as7 = fromIterable(self);
9705
- const array4 = new Array(as7.length);
9710
+ const as6 = fromIterable(self);
9711
+ const array4 = new Array(as6.length);
9706
9712
  const fn = (a, i) => flatMap7(f(a, i), (b) => sync(() => array4[i] = b));
9707
- return zipRight(forEachConcurrentDiscard(as7, fn, batching, false), succeed(array4));
9713
+ return zipRight(forEachConcurrentDiscard(as6, fn, batching, false), succeed(array4));
9708
9714
  });
9709
9715
  var forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterruptibleMask((restore) => transplant((graft) => withFiberRuntime((parent) => {
9710
9716
  let todos = Array.from(self).reverse();
@@ -9860,10 +9866,10 @@ var forEachConcurrentDiscard = (self, f, batching, processAll, n) => uninterrupt
9860
9866
  })));
9861
9867
  })));
9862
9868
  var forEachParN = (self, n, f, batching) => suspend(() => {
9863
- const as7 = fromIterable(self);
9864
- const array4 = new Array(as7.length);
9869
+ const as6 = fromIterable(self);
9870
+ const array4 = new Array(as6.length);
9865
9871
  const fn = (a, i) => map11(f(a, i), (b) => array4[i] = b);
9866
- return zipRight(forEachConcurrentDiscard(as7, fn, batching, false, n), succeed(array4));
9872
+ return zipRight(forEachConcurrentDiscard(as6, fn, batching, false, n), succeed(array4));
9867
9873
  });
9868
9874
  var forkDaemon = (self) => forkWithScopeOverride(self, globalScope);
9869
9875
  var unsafeFork2 = (effect3, parentFiber, parentRuntimeFlags, overrideScope = null) => {
@@ -10156,7 +10162,6 @@ var isDieType2 = isDieType;
10156
10162
  var isInterrupted3 = isInterrupted;
10157
10163
  var interruptors2 = interruptors;
10158
10164
  var failureOrCause2 = failureOrCause;
10159
- var flipCauseOption2 = flipCauseOption;
10160
10165
  var map14 = map9;
10161
10166
  var squash = causeSquash;
10162
10167
  var pretty2 = pretty;
@@ -10193,8 +10198,8 @@ var isEmpty6 = (self) => {
10193
10198
  };
10194
10199
  var intersect = /* @__PURE__ */ dual(2, (self, that) => {
10195
10200
  const start3 = Math.max(self.startMillis, that.startMillis);
10196
- const end4 = Math.min(self.endMillis, that.endMillis);
10197
- return make34(start3, end4);
10201
+ const end3 = Math.min(self.endMillis, that.endMillis);
10202
+ return make34(start3, end3);
10198
10203
  });
10199
10204
  var after = (startMilliseconds) => {
10200
10205
  return make34(startMilliseconds, Number.POSITIVE_INFINITY);
@@ -10348,6 +10353,74 @@ var Semaphore = class {
10348
10353
  };
10349
10354
  var unsafeMakeSemaphore = (permits) => new Semaphore(permits);
10350
10355
  var makeSemaphore = (permits) => sync(() => unsafeMakeSemaphore(permits));
10356
+ var Latch = class extends Class2 {
10357
+ isOpen;
10358
+ waiters = [];
10359
+ scheduled = false;
10360
+ constructor(isOpen) {
10361
+ super();
10362
+ this.isOpen = isOpen;
10363
+ }
10364
+ commit() {
10365
+ return this.await;
10366
+ }
10367
+ unsafeSchedule(fiber) {
10368
+ if (this.scheduled || this.waiters.length === 0) {
10369
+ return void_;
10370
+ }
10371
+ this.scheduled = true;
10372
+ fiber.currentScheduler.scheduleTask(this.flushWaiters, fiber.getFiberRef(currentSchedulingPriority));
10373
+ return void_;
10374
+ }
10375
+ flushWaiters = () => {
10376
+ this.scheduled = false;
10377
+ const waiters = this.waiters;
10378
+ this.waiters = [];
10379
+ for (let i = 0; i < waiters.length; i++) {
10380
+ waiters[i](exitVoid);
10381
+ }
10382
+ };
10383
+ open = /* @__PURE__ */ withFiberRuntime((fiber) => {
10384
+ if (this.isOpen) {
10385
+ return void_;
10386
+ }
10387
+ this.isOpen = true;
10388
+ return this.unsafeSchedule(fiber);
10389
+ });
10390
+ unsafeOpen() {
10391
+ if (this.isOpen) return;
10392
+ this.isOpen = true;
10393
+ this.flushWaiters();
10394
+ }
10395
+ release = /* @__PURE__ */ withFiberRuntime((fiber) => {
10396
+ if (this.isOpen) {
10397
+ return void_;
10398
+ }
10399
+ return this.unsafeSchedule(fiber);
10400
+ });
10401
+ await = /* @__PURE__ */ asyncInterrupt((resume2) => {
10402
+ if (this.isOpen) {
10403
+ return resume2(void_);
10404
+ }
10405
+ this.waiters.push(resume2);
10406
+ return sync(() => {
10407
+ const index = this.waiters.indexOf(resume2);
10408
+ if (index !== -1) {
10409
+ this.waiters.splice(index, 1);
10410
+ }
10411
+ });
10412
+ });
10413
+ unsafeClose() {
10414
+ this.isOpen = false;
10415
+ }
10416
+ close = /* @__PURE__ */ sync(() => {
10417
+ this.isOpen = false;
10418
+ });
10419
+ whenOpen = (self) => {
10420
+ return zipRight(this.await, self);
10421
+ };
10422
+ };
10423
+ var unsafeMakeLatch = (open) => new Latch(open ?? false);
10351
10424
  var forkIn = /* @__PURE__ */ dual(2, (self, scope4) => withFiberRuntime((parent, parentStatus) => {
10352
10425
  const scopeImpl = scope4;
10353
10426
  const fiber = unsafeFork2(self, parent, parentStatus.runtimeFlags, globalScope);
@@ -10652,9 +10725,9 @@ var MemoMapImpl = class {
10652
10725
  * returns it. Otherwise, obtains the layer, stores it in the memo map,
10653
10726
  * and adds a finalizer to the `Scope`.
10654
10727
  */
10655
- getOrElseMemoize(layer, scope4) {
10728
+ getOrElseMemoize(layer3, scope4) {
10656
10729
  return pipe(modifyEffect(this.ref, (map22) => {
10657
- const inMap = map22.get(layer);
10730
+ const inMap = map22.get(layer3);
10658
10731
  if (inMap !== void 0) {
10659
10732
  const [acquire, release] = inMap;
10660
10733
  const cached4 = pipe(acquire, flatMap7(([patch11, b]) => pipe(patchFiberRefs(patch11), as(b))), onExit(exitMatch({
@@ -10664,13 +10737,13 @@ var MemoMapImpl = class {
10664
10737
  return succeed([cached4, map22]);
10665
10738
  }
10666
10739
  return pipe(make24(0), flatMap7((observers) => pipe(deferredMake(), flatMap7((deferred) => pipe(make24(() => void_), map11((finalizerRef) => {
10667
- const resource = uninterruptibleMask((restore) => pipe(scopeMake(), flatMap7((innerScope) => pipe(restore(flatMap7(makeBuilder(layer, innerScope, true), (f) => diffFiberRefs(f(this)))), exit, flatMap7((exit4) => {
10740
+ const resource = uninterruptibleMask((restore) => pipe(scopeMake(), flatMap7((innerScope) => pipe(restore(flatMap7(makeBuilder(layer3, innerScope, true), (f) => diffFiberRefs(f(this)))), exit, flatMap7((exit4) => {
10668
10741
  switch (exit4._tag) {
10669
10742
  case OP_FAILURE: {
10670
10743
  return pipe(deferredFailCause(deferred, exit4.effect_instruction_i0), zipRight(scopeClose(innerScope, exit4)), zipRight(failCause(exit4.effect_instruction_i0)));
10671
10744
  }
10672
10745
  case OP_SUCCESS: {
10673
- return pipe(set4(finalizerRef, (exit5) => pipe(scopeClose(innerScope, exit5), whenEffect(modify3(observers, (n) => [n === 1, n - 1])), asVoid)), zipRight(update2(observers, (n) => n + 1)), zipRight(scopeAddFinalizerExit(scope4, (exit5) => pipe(sync(() => map22.delete(layer)), zipRight(get10(finalizerRef)), flatMap7((finalizer2) => finalizer2(exit5))))), zipRight(deferredSucceed(deferred, exit4.effect_instruction_i0)), as(exit4.effect_instruction_i0[1]));
10746
+ return pipe(set4(finalizerRef, (exit5) => pipe(scopeClose(innerScope, exit5), whenEffect(modify3(observers, (n) => [n === 1, n - 1])), asVoid)), zipRight(update2(observers, (n) => n + 1)), zipRight(scopeAddFinalizerExit(scope4, (exit5) => pipe(sync(() => map22.delete(layer3)), zipRight(get10(finalizerRef)), flatMap7((finalizer2) => finalizer2(exit5))))), zipRight(deferredSucceed(deferred, exit4.effect_instruction_i0)), as(exit4.effect_instruction_i0[1]));
10674
10747
  }
10675
10748
  }
10676
10749
  })))));
@@ -10678,7 +10751,7 @@ var MemoMapImpl = class {
10678
10751
  onFailure: () => void_,
10679
10752
  onSuccess: () => update2(observers, (n) => n + 1)
10680
10753
  }))), (exit4) => pipe(get10(finalizerRef), flatMap7((finalizer2) => finalizer2(exit4)))];
10681
- return [resource, isFresh(layer) ? map22 : map22.set(layer, memoized)];
10754
+ return [resource, isFresh(layer3) ? map22 : map22.set(layer3, memoized)];
10682
10755
  }))))));
10683
10756
  }), flatten3);
10684
10757
  }
@@ -10793,10 +10866,10 @@ var succeedContext = (context5) => {
10793
10866
  };
10794
10867
  var empty28 = /* @__PURE__ */ succeedContext(/* @__PURE__ */ empty9());
10795
10868
  var suspend3 = (evaluate2) => {
10796
- const suspend9 = Object.create(proto3);
10797
- suspend9._op_layer = OP_SUSPEND;
10798
- suspend9.evaluate = evaluate2;
10799
- return suspend9;
10869
+ const suspend8 = Object.create(proto3);
10870
+ suspend8._op_layer = OP_SUSPEND;
10871
+ suspend8.evaluate = evaluate2;
10872
+ return suspend8;
10800
10873
  };
10801
10874
  var zipWith3 = /* @__PURE__ */ dual(3, (self, that, f) => suspend3(() => {
10802
10875
  const zipWith7 = Object.create(proto3);
@@ -10806,7 +10879,7 @@ var zipWith3 = /* @__PURE__ */ dual(3, (self, that, f) => suspend3(() => {
10806
10879
  zipWith7.zipK = f;
10807
10880
  return zipWith7;
10808
10881
  }));
10809
- var provideSomeLayer = /* @__PURE__ */ dual(2, (self, layer) => scopedWith((scope4) => flatMap7(buildWithScope(layer, scope4), (context5) => provideSomeContext(self, context5))));
10882
+ var provideSomeLayer = /* @__PURE__ */ dual(2, (self, layer3) => scopedWith((scope4) => flatMap7(buildWithScope(layer3, scope4), (context5) => provideSomeContext(self, context5))));
10810
10883
  var provideSomeRuntime = /* @__PURE__ */ dual(2, (self, rt) => {
10811
10884
  const patchRefs = diff6(defaultRuntime.fiberRefs, rt.fiberRefs);
10812
10885
  const patchFlags = diff4(defaultRuntime.runtimeFlags, rt.runtimeFlags);
@@ -11092,27 +11165,27 @@ var TypeId14 = /* @__PURE__ */ Symbol.for("effect/MutableList");
11092
11165
  var MutableListProto = {
11093
11166
  [TypeId14]: TypeId14,
11094
11167
  [Symbol.iterator]() {
11095
- let done8 = false;
11168
+ let done7 = false;
11096
11169
  let head7 = this.head;
11097
11170
  return {
11098
11171
  next() {
11099
- if (done8) {
11172
+ if (done7) {
11100
11173
  return this.return();
11101
11174
  }
11102
11175
  if (head7 == null) {
11103
- done8 = true;
11176
+ done7 = true;
11104
11177
  return this.return();
11105
11178
  }
11106
11179
  const value2 = head7.value;
11107
11180
  head7 = head7.next;
11108
11181
  return {
11109
- done: done8,
11182
+ done: done7,
11110
11183
  value: value2
11111
11184
  };
11112
11185
  },
11113
11186
  return(value2) {
11114
- if (!done8) {
11115
- done8 = true;
11187
+ if (!done7) {
11188
+ done7 = true;
11116
11189
  }
11117
11190
  return {
11118
11191
  done: true,
@@ -11280,13 +11353,12 @@ var isEffect2 = isEffect;
11280
11353
  var cached3 = memoize;
11281
11354
  var all4 = all3;
11282
11355
  var forEach8 = forEach7;
11283
- var async2 = async_;
11284
11356
  var withFiberRuntime2 = withFiberRuntime;
11285
11357
  var fail7 = fail2;
11286
11358
  var failCause7 = failCause;
11287
- var die5 = die2;
11288
11359
  var dieMessage2 = dieMessage;
11289
11360
  var gen2 = gen;
11361
+ var promise2 = promise;
11290
11362
  var succeed7 = succeed;
11291
11363
  var suspend4 = suspend;
11292
11364
  var sync4 = sync;
@@ -11296,6 +11368,7 @@ var catchAllCause2 = catchAllCause;
11296
11368
  var ignore2 = ignore;
11297
11369
  var try_2 = try_;
11298
11370
  var tryMap2 = tryMap;
11371
+ var tryPromise2 = tryPromise;
11299
11372
  var interrupt5 = interrupt2;
11300
11373
  var interruptible4 = interruptible2;
11301
11374
  var onInterrupt2 = onInterrupt;
@@ -11304,7 +11377,7 @@ var uninterruptibleMask3 = uninterruptibleMask;
11304
11377
  var as4 = as;
11305
11378
  var asVoid2 = asVoid;
11306
11379
  var map17 = map11;
11307
- var mapBoth4 = mapBoth2;
11380
+ var mapBoth3 = mapBoth2;
11308
11381
  var mapError2 = mapError;
11309
11382
  var acquireRelease2 = acquireRelease;
11310
11383
  var acquireUseRelease2 = acquireUseRelease;
@@ -11333,12 +11406,12 @@ var repeat = repeat_combined;
11333
11406
  var match12 = match8;
11334
11407
  var matchCause4 = matchCause;
11335
11408
  var matchCauseEffect3 = matchCauseEffect;
11336
- var matchEffect2 = matchEffect;
11337
11409
  var logInfo2 = logInfo;
11338
11410
  var withLogSpan2 = withLogSpan;
11339
11411
  var annotateLogsScoped2 = annotateLogsScoped;
11340
11412
  var runtime3 = runtime2;
11341
11413
  var makeSemaphore2 = makeSemaphore;
11414
+ var unsafeMakeLatch2 = unsafeMakeLatch;
11342
11415
  var runFork2 = unsafeForkEffect;
11343
11416
  var runPromise = unsafeRunPromiseEffect;
11344
11417
  var runSync = unsafeRunSyncEffect;
@@ -11413,14 +11486,14 @@ var getKeysForIndexSignature = (input, parameter) => {
11413
11486
  };
11414
11487
  var ownKeys = (o) => Object.keys(o).concat(Object.getOwnPropertySymbols(o));
11415
11488
  var memoizeThunk = (f) => {
11416
- let done8 = false;
11489
+ let done7 = false;
11417
11490
  let a;
11418
11491
  return () => {
11419
- if (done8) {
11492
+ if (done7) {
11420
11493
  return a;
11421
11494
  }
11422
11495
  a = f();
11423
- done8 = true;
11496
+ done7 = true;
11424
11497
  return a;
11425
11498
  };
11426
11499
  };
@@ -12246,7 +12319,7 @@ var Union = class _Union {
12246
12319
  }
12247
12320
  };
12248
12321
  var mapMembers = (members, f) => members.map(f);
12249
- var isMembers = (as7) => as7.length > 1;
12322
+ var isMembers = (as6) => as6.length > 1;
12250
12323
  var isUnion = /* @__PURE__ */ createASTGuard("Union");
12251
12324
  var toJSONMemoMap = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Schema/AST/toJSONMemoMap"), () => /* @__PURE__ */ new WeakMap());
12252
12325
  var Suspend = class {
@@ -12606,18 +12679,18 @@ var createJSONIdentifierAnnotation = (annotated) => match2(getJSONIdentifier(ann
12606
12679
  [JSONIdentifierAnnotationId]: identifier2
12607
12680
  })
12608
12681
  });
12609
- function changeMap(as7, f) {
12682
+ function changeMap(as6, f) {
12610
12683
  let changed = false;
12611
- const out = allocate(as7.length);
12612
- for (let i = 0; i < as7.length; i++) {
12613
- const a = as7[i];
12684
+ const out = allocate(as6.length);
12685
+ for (let i = 0; i < as6.length; i++) {
12686
+ const a = as6[i];
12614
12687
  const fa = f(a);
12615
12688
  if (fa !== a) {
12616
12689
  changed = true;
12617
12690
  }
12618
12691
  out[i] = fa;
12619
12692
  }
12620
- return changed ? out : as7;
12693
+ return changed ? out : as6;
12621
12694
  }
12622
12695
  var encodedAST_ = (ast, isBound) => {
12623
12696
  switch (ast._tag) {
@@ -12860,11 +12933,11 @@ var map19 = /* @__PURE__ */ dual(2, (self, f) => {
12860
12933
  var mapError4 = /* @__PURE__ */ dual(2, (self, f) => {
12861
12934
  return isEither3(self) ? mapLeft(self, f) : mapError2(self, f);
12862
12935
  });
12863
- var mapBoth5 = /* @__PURE__ */ dual(2, (self, options3) => {
12936
+ var mapBoth4 = /* @__PURE__ */ dual(2, (self, options3) => {
12864
12937
  return isEither3(self) ? mapBoth(self, {
12865
12938
  onLeft: options3.onFailure,
12866
12939
  onRight: options3.onSuccess
12867
- }) : mapBoth4(self, options3);
12940
+ }) : mapBoth3(self, options3);
12868
12941
  });
12869
12942
  var orElse5 = /* @__PURE__ */ dual(2, (self, f) => {
12870
12943
  return isEither3(self) ? match(self, {
@@ -14561,7 +14634,7 @@ var NumberFromString = class extends (/* @__PURE__ */ parseNumber(String$.annota
14561
14634
  identifier: "NumberFromString"
14562
14635
  })) {
14563
14636
  };
14564
- var toComposite = (eff, onSuccess, ast, actual) => mapBoth5(eff, {
14637
+ var toComposite = (eff, onSuccess, ast, actual) => mapBoth4(eff, {
14565
14638
  onFailure: (e) => new Composite2(ast, actual, e),
14566
14639
  onSuccess
14567
14640
  });
@@ -15014,8 +15087,6 @@ var takeRemainderLoop = (self, min3, max5, acc) => {
15014
15087
  }));
15015
15088
  };
15016
15089
  var bounded2 = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)), flatMap7((queue) => make46(backingQueueFromMutableQueue(queue), backPressureStrategy())));
15017
- var dropping = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)), flatMap7((queue) => make46(backingQueueFromMutableQueue(queue), droppingStrategy())));
15018
- var sliding = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)), flatMap7((queue) => make46(backingQueueFromMutableQueue(queue), slidingStrategy())));
15019
15090
  var unbounded2 = () => pipe(sync(() => unbounded()), flatMap7((queue) => make46(backingQueueFromMutableQueue(queue), droppingStrategy())));
15020
15091
  var unsafeMake8 = (queue, takers, shutdownHook, shutdownFlag, strategy) => {
15021
15092
  return new QueueImpl(queue, takers, shutdownHook, shutdownFlag, strategy);
@@ -15054,7 +15125,6 @@ var take = (self) => self.take;
15054
15125
  var takeUpTo = /* @__PURE__ */ dual(2, (self, max5) => self.takeUpTo(max5));
15055
15126
  var backPressureStrategy = () => new BackPressureStrategy();
15056
15127
  var droppingStrategy = () => new DroppingStrategy();
15057
- var slidingStrategy = () => new SlidingStrategy();
15058
15128
  var BackPressureStrategy = class {
15059
15129
  [QueueStrategyTypeId] = queueStrategyVariance;
15060
15130
  putters = /* @__PURE__ */ unbounded();
@@ -15074,14 +15144,14 @@ var BackPressureStrategy = class {
15074
15144
  get shutdown() {
15075
15145
  return pipe(fiberId, flatMap7((fiberId2) => pipe(sync(() => unsafePollAll(this.putters)), flatMap7((putters) => forEachConcurrentDiscard(putters, ([_, deferred, isLastItem]) => isLastItem ? pipe(deferredInterruptWith(deferred, fiberId2), asVoid) : void_, false, false)))));
15076
15146
  }
15077
- handleSurplus(iterable, queue, takers, isShutdown3) {
15147
+ handleSurplus(iterable, queue, takers, isShutdown2) {
15078
15148
  return withFiberRuntime((state) => {
15079
15149
  const deferred = deferredUnsafeMake(state.id());
15080
15150
  return pipe(suspend(() => {
15081
15151
  this.unsafeOffer(iterable, deferred);
15082
15152
  this.unsafeOnQueueEmptySpace(queue, takers);
15083
15153
  unsafeCompleteTakers(this, queue, takers);
15084
- return get6(isShutdown3) ? interrupt2 : deferredAwait(deferred);
15154
+ return get6(isShutdown2) ? interrupt2 : deferredAwait(deferred);
15085
15155
  }), onInterrupt(() => sync(() => this.unsafeRemove(deferred))));
15086
15156
  });
15087
15157
  }
@@ -15133,43 +15203,11 @@ var DroppingStrategy = class {
15133
15203
  unsafeOnQueueEmptySpace(_queue, _takers) {
15134
15204
  }
15135
15205
  };
15136
- var SlidingStrategy = class {
15137
- [QueueStrategyTypeId] = queueStrategyVariance;
15138
- surplusSize() {
15139
- return 0;
15140
- }
15141
- get shutdown() {
15142
- return void_;
15143
- }
15144
- onCompleteTakersWithEmptyQueue() {
15145
- }
15146
- handleSurplus(iterable, queue, takers, _isShutdown) {
15147
- return sync(() => {
15148
- this.unsafeOffer(queue, iterable);
15149
- unsafeCompleteTakers(this, queue, takers);
15150
- return true;
15151
- });
15152
- }
15153
- unsafeOnQueueEmptySpace(_queue, _takers) {
15154
- }
15155
- unsafeOffer(queue, iterable) {
15156
- const iterator = iterable[Symbol.iterator]();
15157
- let next;
15158
- let offering = true;
15159
- while (!(next = iterator.next()).done && offering) {
15160
- if (queue.capacity() === 0) {
15161
- return;
15162
- }
15163
- queue.poll(EmptyMutableQueue);
15164
- offering = queue.offer(next.value);
15165
- }
15166
- }
15167
- };
15168
15206
  var unsafeCompleteDeferred = (deferred, a) => {
15169
15207
  return deferredUnsafeDone(deferred, succeed(a));
15170
15208
  };
15171
- var unsafeOfferAll = (queue, as7) => {
15172
- return pipe(queue, offerAll(as7));
15209
+ var unsafeOfferAll = (queue, as6) => {
15210
+ return pipe(queue, offerAll(as6));
15173
15211
  };
15174
15212
  var unsafePollAll = (queue) => {
15175
15213
  return pipe(queue, pollUpTo(Number.POSITIVE_INFINITY));
@@ -15204,8 +15242,6 @@ var unsafeCompleteTakers = (strategy, queue, takers) => {
15204
15242
 
15205
15243
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/Queue.js
15206
15244
  var bounded3 = bounded2;
15207
- var dropping2 = dropping;
15208
- var sliding2 = sliding;
15209
15245
  var unbounded3 = unbounded2;
15210
15246
  var size11 = size10;
15211
15247
  var shutdown2 = shutdown;
@@ -16382,9 +16418,9 @@ var stateError = (cause2) => ({
16382
16418
  _tag: OP_STATE_ERROR,
16383
16419
  cause: cause2
16384
16420
  });
16385
- var stateDone = (done8) => ({
16421
+ var stateDone = (done7) => ({
16386
16422
  _tag: OP_STATE_DONE2,
16387
- done: done8
16423
+ done: done7
16388
16424
  });
16389
16425
  var SingleProducerAsyncInputImpl = class {
16390
16426
  ref;
@@ -16461,7 +16497,7 @@ var SingleProducerAsyncInputImpl = class {
16461
16497
  }));
16462
16498
  }
16463
16499
  get take() {
16464
- return this.takeWith((cause2) => failCause4(map14(cause2, left2)), (elem) => succeed4(elem), (done8) => fail3(right2(done8)));
16500
+ return this.takeWith((cause2) => failCause4(map14(cause2, left2)), (elem) => succeed4(elem), (done7) => fail3(right2(done7)));
16465
16501
  }
16466
16502
  takeWith(onError4, onElement, onDone2) {
16467
16503
  return flatMap10(make23(), (deferred) => flatten5(modify4(this.ref, (state) => {
@@ -16497,7 +16533,6 @@ var SingleProducerAsyncInputImpl = class {
16497
16533
  var make47 = () => pipe(make23(), flatMap10((deferred) => make25(stateEmpty(deferred))), map17((ref) => new SingleProducerAsyncInputImpl(ref)));
16498
16534
 
16499
16535
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/channel.js
16500
- var as5 = /* @__PURE__ */ dual(2, (self, value2) => map20(self, () => value2));
16501
16536
  var concatMap = /* @__PURE__ */ dual(2, (self, f) => concatMapWith(self, f, () => void 0, () => void 0));
16502
16537
  var drain = (self) => {
16503
16538
  const drainer = readWithCause({
@@ -16540,7 +16575,7 @@ var mergeAllWith = ({
16540
16575
  const pull = yield* toPullIn(pipeTo(queueReader, channels), scope4);
16541
16576
  function evaluatePull(pull2) {
16542
16577
  return pull2.pipe(flatMap10(match({
16543
- onLeft: (done8) => succeed7(some2(done8)),
16578
+ onLeft: (done7) => succeed7(some2(done7)),
16544
16579
  onRight: (outElem) => as4(offer3(queue, succeed7(right2(outElem))), none2())
16545
16580
  })), repeat({
16546
16581
  until: (_) => isSome2(_)
@@ -16596,14 +16631,14 @@ var mergeAllWith = ({
16596
16631
  }));
16597
16632
  var mergeMap = /* @__PURE__ */ dual(3, (self, f, options3) => mergeAll5(options3)(mapOut(self, f)));
16598
16633
  var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
16599
- function merge8(scope4) {
16634
+ function merge9(scope4) {
16600
16635
  return gen2(function* () {
16601
16636
  const input = yield* make47();
16602
16637
  const queueReader = fromInput(input);
16603
16638
  const pullL = yield* toPullIn(pipeTo(queueReader, self), scope4);
16604
16639
  const pullR = yield* toPullIn(pipeTo(queueReader, options3.other), scope4);
16605
16640
  function handleSide(exit4, fiber, pull) {
16606
- return (done8, both2, single) => {
16641
+ return (done7, both2, single) => {
16607
16642
  function onDecision(decision) {
16608
16643
  const op = decision;
16609
16644
  if (op._tag === OP_DONE4) {
@@ -16612,15 +16647,15 @@ var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
16612
16647
  return map17(_await3(fiber), match9({
16613
16648
  onFailure: (cause2) => fromEffect4(op.f(failCause4(cause2))),
16614
16649
  onSuccess: match({
16615
- onLeft: (done9) => fromEffect4(op.f(succeed4(done9))),
16650
+ onLeft: (done8) => fromEffect4(op.f(succeed4(done8))),
16616
16651
  onRight: (elem) => zipRight4(write(elem), go2(single(op.f)))
16617
16652
  })
16618
16653
  }));
16619
16654
  }
16620
16655
  return match9(exit4, {
16621
- onFailure: (cause2) => onDecision(done8(failCause4(cause2))),
16656
+ onFailure: (cause2) => onDecision(done7(failCause4(cause2))),
16622
16657
  onSuccess: match({
16623
- onLeft: (z) => onDecision(done8(succeed4(z))),
16658
+ onLeft: (z) => onDecision(done7(succeed4(z))),
16624
16659
  onRight: (elem) => succeed7(flatMap12(write(elem), () => flatMap12(fromEffect4(forkIn2(interruptible4(pull), scope4)), (leftFiber) => go2(both2(leftFiber, fiber)))))
16625
16660
  })
16626
16661
  });
@@ -16640,7 +16675,7 @@ var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
16640
16675
  return unwrap(map17(exit3(pullR), match9({
16641
16676
  onFailure: (cause2) => fromEffect4(state.f(failCause4(cause2))),
16642
16677
  onSuccess: match({
16643
- onLeft: (done8) => fromEffect4(state.f(succeed4(done8))),
16678
+ onLeft: (done7) => fromEffect4(state.f(succeed4(done7))),
16644
16679
  onRight: (elem) => flatMap12(write(elem), () => go2(LeftDone(state.f)))
16645
16680
  })
16646
16681
  })));
@@ -16649,7 +16684,7 @@ var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
16649
16684
  return unwrap(map17(exit3(pullL), match9({
16650
16685
  onFailure: (cause2) => fromEffect4(state.f(failCause4(cause2))),
16651
16686
  onSuccess: match({
16652
- onLeft: (done8) => fromEffect4(state.f(succeed4(done8))),
16687
+ onLeft: (done7) => fromEffect4(state.f(succeed4(done7))),
16653
16688
  onRight: (elem) => flatMap12(write(elem), () => go2(RightDone(state.f)))
16654
16689
  })
16655
16690
  })));
@@ -16667,7 +16702,7 @@ var mergeWith2 = /* @__PURE__ */ dual(2, (self, options3) => {
16667
16702
  })).pipe(flatMap12(go2), embedInput(input));
16668
16703
  });
16669
16704
  }
16670
- return unwrapScopedWith(merge8);
16705
+ return unwrapScopedWith(merge9);
16671
16706
  });
16672
16707
  var pipeToOrFail = /* @__PURE__ */ dual(2, (self, that) => suspend5(() => {
16673
16708
  let channelException = void 0;
@@ -16700,7 +16735,7 @@ var interpretToPull = (channelState, exec) => {
16700
16735
  case OP_DONE3: {
16701
16736
  return match9(exec.getDone(), {
16702
16737
  onFailure: failCause7,
16703
- onSuccess: (done8) => succeed7(left2(done8))
16738
+ onSuccess: (done7) => succeed7(left2(done7))
16704
16739
  });
16705
16740
  }
16706
16741
  case OP_EMIT2: {
@@ -16718,8 +16753,8 @@ var unwrap = (channel) => flatten8(fromEffect4(channel));
16718
16753
  var unwrapScoped2 = (self) => concatAllWith(scoped3(self), (d, _) => d, (d, _) => d);
16719
16754
  var unwrapScopedWith = (f) => concatAllWith(scopedWith3(f), (d, _) => d, (d, _) => d);
16720
16755
  var writeChunk = (outs) => writeChunkWriter(0, outs.length, outs);
16721
- var writeChunkWriter = (idx, len, chunk3) => {
16722
- return idx === len ? void_5 : pipe(write(pipe(chunk3, unsafeGet2(idx))), flatMap12(() => writeChunkWriter(idx + 1, len, chunk3)));
16756
+ var writeChunkWriter = (idx, len, chunk2) => {
16757
+ return idx === len ? void_5 : pipe(write(pipe(chunk2, unsafeGet2(idx))), flatMap12(() => writeChunkWriter(idx + 1, len, chunk2)));
16723
16758
  };
16724
16759
  var zip6 = /* @__PURE__ */ dual((args2) => isChannel(args2[1]), (self, that, options3) => options3?.concurrent ? mergeWith2(self, {
16725
16760
  other: that,
@@ -16761,113 +16796,19 @@ var SinkImpl = class {
16761
16796
  return pipeArguments(this, arguments);
16762
16797
  }
16763
16798
  };
16764
- var suspend6 = (evaluate2) => new SinkImpl(suspend5(() => toChannel(evaluate2())));
16765
- var fold = (s, contFn, f) => suspend6(() => new SinkImpl(foldReader(s, contFn, f)));
16766
- var foldReader = (s, contFn, f) => {
16767
- if (!contFn(s)) {
16768
- return succeedNow(s);
16769
- }
16770
- return readWith({
16771
- onInput: (input) => {
16772
- const [nextS, leftovers] = foldChunkSplit(s, input, contFn, f, 0, input.length);
16773
- if (isNonEmpty(leftovers)) {
16774
- return pipe(write(leftovers), as5(nextS));
16775
- }
16776
- return foldReader(nextS, contFn, f);
16777
- },
16778
- onFailure: fail9,
16779
- onDone: () => succeedNow(s)
16799
+ var forEachChunk = (f) => {
16800
+ const process2 = readWithCause({
16801
+ onInput: (input) => pipe(fromEffect4(f(input)), flatMap12(() => process2)),
16802
+ onFailure: failCause8,
16803
+ onDone: () => void_5
16780
16804
  });
16781
- };
16782
- var foldChunkSplit = (s, chunk3, contFn, f, index, length3) => {
16783
- if (index === length3) {
16784
- return [s, empty3()];
16785
- }
16786
- const s1 = f(s, pipe(chunk3, unsafeGet2(index)));
16787
- if (contFn(s1)) {
16788
- return foldChunkSplit(s1, chunk3, contFn, f, index + 1, length3);
16789
- }
16790
- return [s1, pipe(chunk3, drop2(index + 1))];
16805
+ return new SinkImpl(process2);
16791
16806
  };
16792
16807
  var fromEffect6 = (effect3) => new SinkImpl(fromEffect4(effect3));
16793
16808
  var toChannel = (self) => isEffect2(self) ? toChannel(fromEffect6(self)) : self.channel;
16794
16809
 
16795
16810
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/Runtime.js
16796
- var runPromiseExit = unsafeRunPromiseExit;
16797
-
16798
- // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/stream/emit.js
16799
- var make48 = (emit) => {
16800
- const ops = {
16801
- chunk(as7) {
16802
- return this(succeed7(as7));
16803
- },
16804
- die(defect) {
16805
- return this(die5(defect));
16806
- },
16807
- dieMessage(message) {
16808
- return this(dieMessage2(message));
16809
- },
16810
- done(exit4) {
16811
- return this(suspend4(() => mapBoth3(exit4, {
16812
- onFailure: some2,
16813
- onSuccess: of2
16814
- })));
16815
- },
16816
- end() {
16817
- return this(fail7(none2()));
16818
- },
16819
- fail(e) {
16820
- return this(fail7(some2(e)));
16821
- },
16822
- fromEffect(effect3) {
16823
- return this(mapBoth4(effect3, {
16824
- onFailure: some2,
16825
- onSuccess: of2
16826
- }));
16827
- },
16828
- fromEffectChunk(effect3) {
16829
- return this(pipe(effect3, mapError2(some2)));
16830
- },
16831
- halt(cause2) {
16832
- return this(failCause7(pipe(cause2, map14(some2))));
16833
- },
16834
- single(value2) {
16835
- return this(succeed7(of2(value2)));
16836
- }
16837
- };
16838
- return Object.assign(emit, ops);
16839
- };
16840
-
16841
- // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/take.js
16842
- var TakeSymbolKey = "effect/Take";
16843
- var TakeTypeId = /* @__PURE__ */ Symbol.for(TakeSymbolKey);
16844
- var takeVariance = {
16845
- /* c8 ignore next */
16846
- _A: (_) => _,
16847
- /* c8 ignore next */
16848
- _E: (_) => _
16849
- };
16850
- var TakeImpl = class {
16851
- exit;
16852
- [TakeTypeId] = takeVariance;
16853
- constructor(exit4) {
16854
- this.exit = exit4;
16855
- }
16856
- pipe() {
16857
- return pipeArguments(this, arguments);
16858
- }
16859
- };
16860
- var chunk2 = (chunk3) => new TakeImpl(succeed4(chunk3));
16861
- var done7 = (self) => suspend4(() => self.exit);
16862
- var end3 = /* @__PURE__ */ new TakeImpl(/* @__PURE__ */ fail3(/* @__PURE__ */ none2()));
16863
- var failCause9 = (cause2) => new TakeImpl(failCause4(pipe(cause2, map14(some2))));
16864
- var fromPull = (pull) => matchCause4(pull, {
16865
- onFailure: (cause2) => match2(flipCauseOption2(cause2), {
16866
- onNone: () => end3,
16867
- onSome: failCause9
16868
- }),
16869
- onSuccess: chunk2
16870
- });
16811
+ var runFork3 = unsafeFork3;
16871
16812
 
16872
16813
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/internal/stream.js
16873
16814
  var StreamSymbolKey = "effect/Stream";
@@ -16888,49 +16829,14 @@ var StreamImpl = class {
16888
16829
  }
16889
16830
  };
16890
16831
  var isStream = (u) => hasProperty(u, StreamTypeId2) || isEffect2(u);
16891
- var queueFromBufferOptions = (bufferSize) => {
16892
- if (bufferSize === "unbounded") {
16893
- return unbounded3();
16894
- } else if (typeof bufferSize === "number" || bufferSize === void 0) {
16895
- return bounded3(bufferSize ?? 16);
16896
- }
16897
- switch (bufferSize.strategy) {
16898
- case "dropping":
16899
- return dropping2(bufferSize.bufferSize ?? 16);
16900
- case "sliding":
16901
- return sliding2(bufferSize.bufferSize ?? 16);
16902
- default:
16903
- return bounded3(bufferSize.bufferSize ?? 16);
16904
- }
16905
- };
16906
- var _async = (register, bufferSize) => acquireRelease2(queueFromBufferOptions(bufferSize), (queue) => shutdown2(queue)).pipe(flatMap10((output) => runtime3().pipe(flatMap10((runtime4) => sync4(() => {
16907
- const runPromiseExit2 = runPromiseExit(runtime4);
16908
- const canceler = register(make48((resume2) => fromPull(resume2).pipe(flatMap10((take5) => offer3(output, take5)), asVoid2, runPromiseExit2).then((exit4) => {
16909
- if (isFailure(exit4)) {
16910
- if (!isInterrupted3(exit4.cause)) {
16911
- throw squash(exit4.cause);
16912
- }
16913
- }
16914
- })));
16915
- return canceler;
16916
- })), map17((value2) => {
16917
- const loop2 = take2(output).pipe(flatMap10((take5) => done7(take5)), match12({
16918
- onFailure: (maybeError) => fromEffect4(shutdown2(output)).pipe(zipRight4(match2(maybeError, {
16919
- onNone: () => void_5,
16920
- onSome: (error) => fail9(error)
16921
- }))),
16922
- onSuccess: (chunk3) => write(chunk3).pipe(flatMap12(() => loop2))
16923
- }), unwrap);
16924
- return fromChannel2(loop2).pipe(ensuring4(value2 ?? _void));
16925
- }))), unwrapScoped3);
16926
- var ensuring4 = /* @__PURE__ */ dual(2, (self, finalizer2) => new StreamImpl(pipe(toChannel2(self), ensuring3(finalizer2))));
16927
16832
  var ensuringWith2 = /* @__PURE__ */ dual(2, (self, finalizer2) => new StreamImpl(ensuringWith(toChannel2(self), finalizer2)));
16833
+ var fail11 = (error) => fromEffectOption(fail7(some2(error)));
16928
16834
  var flatMap14 = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, f, options3) => {
16929
16835
  const bufferSize = options3?.bufferSize ?? 16;
16930
16836
  if (options3?.switch) {
16931
16837
  return matchConcurrency(options3?.concurrency, () => flatMapParSwitchBuffer(self, 1, bufferSize, f), (n) => flatMapParSwitchBuffer(self, n, bufferSize, f));
16932
16838
  }
16933
- return matchConcurrency(options3?.concurrency, () => new StreamImpl(concatMap(toChannel2(self), (as7) => pipe(as7, map5((a) => toChannel2(f(a))), reduce2(void_5, (left3, right3) => pipe(left3, zipRight4(right3)))))), (_) => new StreamImpl(pipe(toChannel2(self), concatMap(writeChunk), mergeMap((out) => toChannel2(f(out)), options3))));
16839
+ return matchConcurrency(options3?.concurrency, () => new StreamImpl(concatMap(toChannel2(self), (as6) => pipe(as6, map5((a) => toChannel2(f(a))), reduce2(void_5, (left3, right3) => pipe(left3, zipRight4(right3)))))), (_) => new StreamImpl(pipe(toChannel2(self), concatMap(writeChunk), mergeMap((out) => toChannel2(f(out)), options3))));
16934
16840
  });
16935
16841
  var matchConcurrency = (concurrency, sequential4, bounded4) => {
16936
16842
  switch (concurrency) {
@@ -16948,12 +16854,11 @@ var flatMapParSwitchBuffer = /* @__PURE__ */ dual(4, (self, n, bufferSize, f) =>
16948
16854
  bufferSize
16949
16855
  }))));
16950
16856
  var flatten10 = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, options3) => flatMap14(self, identity, options3));
16951
- var fromChannel2 = (channel) => new StreamImpl(channel);
16952
- var toChannel2 = (stream3) => {
16953
- if ("channel" in stream3) {
16954
- return stream3.channel;
16955
- } else if (isEffect2(stream3)) {
16956
- return toChannel2(fromEffect7(stream3));
16857
+ var toChannel2 = (stream2) => {
16858
+ if ("channel" in stream2) {
16859
+ return stream2.channel;
16860
+ } else if (isEffect2(stream2)) {
16861
+ return toChannel2(fromEffect7(stream2));
16957
16862
  } else {
16958
16863
  throw new TypeError(`Expected a Stream.`);
16959
16864
  }
@@ -16966,18 +16871,84 @@ var fromEffectOption = (effect3) => new StreamImpl(unwrap(match12(effect3, {
16966
16871
  }),
16967
16872
  onSuccess: (a) => write(of2(a))
16968
16873
  })));
16874
+ var fromReadableStream = (...args2) => {
16875
+ const evaluate2 = args2.length === 1 ? args2[0].evaluate : args2[0];
16876
+ const onError4 = args2.length === 1 ? args2[0].onError : args2[1];
16877
+ const releaseLockOnEnd = args2.length === 1 ? args2[0].releaseLockOnEnd === true : false;
16878
+ return unwrapScoped3(map17(acquireRelease2(sync4(() => evaluate2().getReader()), (reader) => releaseLockOnEnd ? sync4(() => reader.releaseLock()) : promise2(() => reader.cancel())), (reader) => repeatEffectOption(flatMap10(tryPromise2({
16879
+ try: () => reader.read(),
16880
+ catch: (reason) => some2(onError4(reason))
16881
+ }), ({
16882
+ done: done7,
16883
+ value: value2
16884
+ }) => done7 ? fail7(none2()) : succeed7(value2)))));
16885
+ };
16886
+ var repeatEffectChunkOption = (effect3) => unfoldChunkEffect(effect3, (effect4) => pipe(map17(effect4, (chunk2) => some2([chunk2, effect4])), catchAll2(match2({
16887
+ onNone: () => succeed7(none2()),
16888
+ onSome: fail7
16889
+ }))));
16890
+ var repeatEffectOption = (effect3) => repeatEffectChunkOption(pipe(effect3, map17(of2)));
16969
16891
  var run2 = /* @__PURE__ */ dual(2, (self, sink) => toChannel2(self).pipe(pipeToOrFail(toChannel(sink)), runDrain));
16970
- var runFold = /* @__PURE__ */ dual(3, (self, s, f) => runFoldWhile(self, s, constTrue, f));
16971
- var runFoldWhile = /* @__PURE__ */ dual(4, (self, s, cont, f) => run2(self, fold(s, cont, f)));
16892
+ var runForEachChunk = /* @__PURE__ */ dual(2, (self, f) => run2(self, forEachChunk(f)));
16972
16893
  var scoped4 = (effect3) => new StreamImpl(ensuring3(scoped3(pipe(effect3, map17(of2))), _void));
16973
- var suspend7 = (stream3) => new StreamImpl(suspend5(() => toChannel2(stream3())));
16894
+ var suspend6 = (stream2) => new StreamImpl(suspend5(() => toChannel2(stream2())));
16895
+ var toReadableStreamEffect = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, options3) => map17(runtime3(), (runtime4) => toReadableStreamRuntime(self, runtime4, options3)));
16896
+ var toReadableStreamRuntime = /* @__PURE__ */ dual((args2) => isStream(args2[0]), (self, runtime4, options3) => {
16897
+ const runFork4 = runFork3(runtime4);
16898
+ let currentResolve = void 0;
16899
+ let fiber = void 0;
16900
+ const latch = unsafeMakeLatch2(false);
16901
+ return new ReadableStream({
16902
+ start(controller) {
16903
+ fiber = runFork4(runForEachChunk(self, (chunk2) => {
16904
+ if (chunk2.length === 0) return _void;
16905
+ return latch.whenOpen(sync4(() => {
16906
+ latch.unsafeClose();
16907
+ for (const item of chunk2) {
16908
+ controller.enqueue(item);
16909
+ }
16910
+ currentResolve();
16911
+ currentResolve = void 0;
16912
+ }));
16913
+ }));
16914
+ fiber.addObserver((exit4) => {
16915
+ try {
16916
+ if (exit4._tag === "Failure") {
16917
+ controller.error(squash(exit4.cause));
16918
+ } else {
16919
+ controller.close();
16920
+ }
16921
+ } catch {
16922
+ }
16923
+ });
16924
+ },
16925
+ pull() {
16926
+ return new Promise((resolve) => {
16927
+ currentResolve = resolve;
16928
+ runSync(latch.open);
16929
+ });
16930
+ },
16931
+ cancel() {
16932
+ if (!fiber) return;
16933
+ return runPromise(asVoid2(interrupt4(fiber)));
16934
+ }
16935
+ }, options3?.strategy);
16936
+ });
16937
+ var unfoldChunkEffect = (s, f) => suspend6(() => {
16938
+ const loop2 = (s2) => unwrap(map17(f(s2), match2({
16939
+ onNone: () => void_5,
16940
+ onSome: ([chunk2, s3]) => flatMap12(write(chunk2), () => loop2(s3))
16941
+ })));
16942
+ return new StreamImpl(loop2(s));
16943
+ });
16974
16944
  var unwrapScoped3 = (effect3) => flatten10(scoped4(effect3));
16975
16945
 
16976
16946
  // ../../../node_modules/.pnpm/effect@3.17.2/node_modules/effect/dist/esm/Stream.js
16977
- var _async2 = _async;
16978
16947
  var ensuringWith3 = ensuringWith2;
16979
- var runFold2 = runFold;
16980
- var suspend8 = suspend7;
16948
+ var fail12 = fail11;
16949
+ var fromReadableStream2 = fromReadableStream;
16950
+ var suspend7 = suspend6;
16951
+ var toReadableStreamEffect2 = toReadableStreamEffect;
16981
16952
 
16982
16953
  // src/effect/schema.ts
16983
16954
  var BaseAttributeValue = Union2(
@@ -17599,7 +17570,6 @@ function parseSetCookie(header) {
17599
17570
  options: Object.keys(options3).length > 0 ? options3 : void 0
17600
17571
  }));
17601
17572
  }
17602
- var empty32 = /* @__PURE__ */ fromIterable12([]);
17603
17573
  var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
17604
17574
  var CookieProto = {
17605
17575
  [CookieTypeId]: CookieTypeId,
@@ -17629,11 +17599,11 @@ var Proto3 = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null),
17629
17599
  return redact2(this, getOrDefault2(fiberRefs3, currentRedactedNames));
17630
17600
  }
17631
17601
  });
17632
- var make50 = (input) => Object.assign(Object.create(Proto3), input);
17633
- var empty33 = /* @__PURE__ */ Object.create(Proto3);
17602
+ var make49 = (input) => Object.assign(Object.create(Proto3), input);
17603
+ var empty32 = /* @__PURE__ */ Object.create(Proto3);
17634
17604
  var fromInput2 = (input) => {
17635
17605
  if (input === void 0) {
17636
- return empty33;
17606
+ return empty32;
17637
17607
  } else if (Symbol.iterator in input) {
17638
17608
  const out2 = Object.create(Proto3);
17639
17609
  for (const [k, v] of input) {
@@ -17653,16 +17623,21 @@ var fromInput2 = (input) => {
17653
17623
  };
17654
17624
  var unsafeFromRecord = (input) => Object.setPrototypeOf(input, Proto3);
17655
17625
  var set8 = /* @__PURE__ */ dual(3, (self, key, value2) => {
17656
- const out = make50(self);
17626
+ const out = make49(self);
17657
17627
  out[key.toLowerCase()] = value2;
17658
17628
  return out;
17659
17629
  });
17660
- var setAll3 = /* @__PURE__ */ dual(2, (self, headers) => make50({
17630
+ var setAll3 = /* @__PURE__ */ dual(2, (self, headers) => make49({
17661
17631
  ...self,
17662
17632
  ...fromInput2(headers)
17663
17633
  }));
17634
+ var merge8 = /* @__PURE__ */ dual(2, (self, headers) => {
17635
+ const out = make49(self);
17636
+ Object.assign(out, headers);
17637
+ return out;
17638
+ });
17664
17639
  var remove8 = /* @__PURE__ */ dual(2, (self, key) => {
17665
- const out = make50(self);
17640
+ const out = make49(self);
17666
17641
  const modify6 = (key2) => {
17667
17642
  if (typeof key2 === "string") {
17668
17643
  const k = key2.toLowerCase();
@@ -17773,7 +17748,7 @@ var fromInputNested = (input) => {
17773
17748
  }
17774
17749
  return out;
17775
17750
  };
17776
- var empty34 = [];
17751
+ var empty33 = [];
17777
17752
  var setAll4 = /* @__PURE__ */ dual(2, (self, input) => {
17778
17753
  const toSet3 = fromInput3(input);
17779
17754
  const keys6 = toSet3.map(([k]) => k);
@@ -17869,7 +17844,7 @@ var EmptyImpl = class extends BodyBase {
17869
17844
  };
17870
17845
  }
17871
17846
  };
17872
- var empty35 = /* @__PURE__ */ new EmptyImpl();
17847
+ var empty34 = /* @__PURE__ */ new EmptyImpl();
17873
17848
  var Uint8ArrayImpl = class extends BodyBase {
17874
17849
  body;
17875
17850
  contentType;
@@ -17935,19 +17910,19 @@ function makeInternal(method, url, urlParams, hash2, headers, body) {
17935
17910
  self.body = body;
17936
17911
  return self;
17937
17912
  }
17938
- var empty36 = /* @__PURE__ */ makeInternal("GET", "", empty34, /* @__PURE__ */ none2(), empty33, empty35);
17939
- var make51 = (method) => (url, options3) => modify5(empty36, {
17913
+ var empty35 = /* @__PURE__ */ makeInternal("GET", "", empty33, /* @__PURE__ */ none2(), empty32, empty34);
17914
+ var make50 = (method) => (url, options3) => modify5(empty35, {
17940
17915
  method,
17941
17916
  url,
17942
17917
  ...options3 ?? void 0
17943
17918
  });
17944
- var get15 = /* @__PURE__ */ make51("GET");
17945
- var post = /* @__PURE__ */ make51("POST");
17946
- var put = /* @__PURE__ */ make51("PUT");
17947
- var patch9 = /* @__PURE__ */ make51("PATCH");
17948
- var del = /* @__PURE__ */ make51("DELETE");
17949
- var head5 = /* @__PURE__ */ make51("HEAD");
17950
- var options = /* @__PURE__ */ make51("OPTIONS");
17919
+ var get15 = /* @__PURE__ */ make50("GET");
17920
+ var post = /* @__PURE__ */ make50("POST");
17921
+ var put = /* @__PURE__ */ make50("PUT");
17922
+ var patch9 = /* @__PURE__ */ make50("PATCH");
17923
+ var del = /* @__PURE__ */ make50("DELETE");
17924
+ var head5 = /* @__PURE__ */ make50("HEAD");
17925
+ var options = /* @__PURE__ */ make50("OPTIONS");
17951
17926
  var modify5 = /* @__PURE__ */ dual(2, (self, options3) => {
17952
17927
  let result = self;
17953
17928
  if (options3.method) {
@@ -18014,6 +17989,114 @@ var bodyJson = /* @__PURE__ */ dual(2, (self, body) => map17(json(body), (body2)
18014
17989
 
18015
17990
  // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/internal/httpClientResponse.js
18016
17991
  var TypeId24 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClientResponse");
17992
+ var fromWeb = (request, source) => new ClientResponseImpl(request, source);
17993
+ var ClientResponseImpl = class extends Class {
17994
+ request;
17995
+ source;
17996
+ [TypeId21];
17997
+ [TypeId24];
17998
+ constructor(request, source) {
17999
+ super();
18000
+ this.request = request;
18001
+ this.source = source;
18002
+ this[TypeId21] = TypeId21;
18003
+ this[TypeId24] = TypeId24;
18004
+ }
18005
+ toJSON() {
18006
+ return inspect(this, {
18007
+ _id: "@effect/platform/HttpClientResponse",
18008
+ request: this.request.toJSON(),
18009
+ status: this.status
18010
+ });
18011
+ }
18012
+ get status() {
18013
+ return this.source.status;
18014
+ }
18015
+ get headers() {
18016
+ return fromInput2(this.source.headers);
18017
+ }
18018
+ cachedCookies;
18019
+ get cookies() {
18020
+ if (this.cachedCookies) {
18021
+ return this.cachedCookies;
18022
+ }
18023
+ return this.cachedCookies = fromSetCookie(this.source.headers.getSetCookie());
18024
+ }
18025
+ get remoteAddress() {
18026
+ return none2();
18027
+ }
18028
+ get stream() {
18029
+ return this.source.body ? fromReadableStream2(() => this.source.body, (cause2) => new ResponseError({
18030
+ request: this.request,
18031
+ response: this,
18032
+ reason: "Decode",
18033
+ cause: cause2
18034
+ })) : fail12(new ResponseError({
18035
+ request: this.request,
18036
+ response: this,
18037
+ reason: "EmptyBody",
18038
+ description: "can not create stream from empty body"
18039
+ }));
18040
+ }
18041
+ get json() {
18042
+ return tryMap2(this.text, {
18043
+ try: (text2) => text2 === "" ? null : JSON.parse(text2),
18044
+ catch: (cause2) => new ResponseError({
18045
+ request: this.request,
18046
+ response: this,
18047
+ reason: "Decode",
18048
+ cause: cause2
18049
+ })
18050
+ });
18051
+ }
18052
+ textBody;
18053
+ get text() {
18054
+ return this.textBody ??= tryPromise2({
18055
+ try: () => this.source.text(),
18056
+ catch: (cause2) => new ResponseError({
18057
+ request: this.request,
18058
+ response: this,
18059
+ reason: "Decode",
18060
+ cause: cause2
18061
+ })
18062
+ }).pipe(cached3, runSync);
18063
+ }
18064
+ get urlParamsBody() {
18065
+ return flatMap10(this.text, (_) => try_2({
18066
+ try: () => fromInput3(new URLSearchParams(_)),
18067
+ catch: (cause2) => new ResponseError({
18068
+ request: this.request,
18069
+ response: this,
18070
+ reason: "Decode",
18071
+ cause: cause2
18072
+ })
18073
+ }));
18074
+ }
18075
+ formDataBody;
18076
+ get formData() {
18077
+ return this.formDataBody ??= tryPromise2({
18078
+ try: () => this.source.formData(),
18079
+ catch: (cause2) => new ResponseError({
18080
+ request: this.request,
18081
+ response: this,
18082
+ reason: "Decode",
18083
+ cause: cause2
18084
+ })
18085
+ }).pipe(cached3, runSync);
18086
+ }
18087
+ arrayBufferBody;
18088
+ get arrayBuffer() {
18089
+ return this.arrayBufferBody ??= tryPromise2({
18090
+ try: () => this.source.arrayBuffer(),
18091
+ catch: (cause2) => new ResponseError({
18092
+ request: this.request,
18093
+ response: this,
18094
+ reason: "Decode",
18095
+ cause: cause2
18096
+ })
18097
+ }).pipe(cached3, runSync);
18098
+ }
18099
+ };
18017
18100
 
18018
18101
  // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/internal/httpClient.js
18019
18102
  var TypeId25 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClient");
@@ -18093,7 +18176,7 @@ var responseRegistry = /* @__PURE__ */ globalValue("@effect/platform/HttpClient/
18093
18176
  };
18094
18177
  });
18095
18178
  var scopedRequests = /* @__PURE__ */ globalValue("@effect/platform/HttpClient/scopedRequests", () => /* @__PURE__ */ new WeakMap());
18096
- var make52 = (f) => makeWith((effect3) => flatMap10(effect3, (request) => withFiberRuntime2((fiber) => {
18179
+ var make51 = (f) => makeWith((effect3) => flatMap10(effect3, (request) => withFiberRuntime2((fiber) => {
18097
18180
  const scopedController = scopedRequests.get(request);
18098
18181
  const controller = scopedController ?? new AbortController();
18099
18182
  const urlResult = makeUrl(request.url, request.urlParams, request.hash);
@@ -18213,7 +18296,7 @@ var InterruptibleResponse = class {
18213
18296
  return this.applyInterrupt(this.original.arrayBuffer);
18214
18297
  }
18215
18298
  get stream() {
18216
- return suspend8(() => {
18299
+ return suspend7(() => {
18217
18300
  responseRegistry.unregister(this.original);
18218
18301
  return ensuringWith3(this.original.stream, (exit4) => {
18219
18302
  if (isInterrupted2(exit4)) {
@@ -18256,11 +18339,6 @@ var layerMergedContext = (effect3) => effect(tag, flatMap10(context2(), (context
18256
18339
 
18257
18340
  // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/HttpClient.js
18258
18341
  var HttpClient = tag;
18259
- var make53 = make52;
18260
- var layerMergedContext2 = layerMergedContext;
18261
-
18262
- // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/HttpClientResponse.js
18263
- var TypeId26 = TypeId24;
18264
18342
 
18265
18343
  // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/HttpClientRequest.js
18266
18344
  var get17 = get15;
@@ -18268,443 +18346,44 @@ var post3 = post;
18268
18346
  var setUrlParams2 = setUrlParams;
18269
18347
  var bodyJson2 = bodyJson;
18270
18348
 
18271
- // ../../../node_modules/.pnpm/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/headers.js
18272
- var constMaxPairs = 100;
18273
- var constMaxSize = 16 * 1024;
18274
- var State;
18275
- (function(State2) {
18276
- State2[State2["key"] = 0] = "key";
18277
- State2[State2["whitespace"] = 1] = "whitespace";
18278
- State2[State2["value"] = 2] = "value";
18279
- })(State || (State = {}));
18280
- var constContinue = {
18281
- _tag: "Continue"
18282
- };
18283
- var constNameChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1];
18284
- var constValueChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
18285
- function make54() {
18286
- const decoder = new TextDecoder();
18287
- const state = {
18288
- state: State.key,
18289
- headers: /* @__PURE__ */ Object.create(null),
18290
- key: "",
18291
- value: void 0,
18292
- crlf: 0,
18293
- previousChunk: void 0,
18294
- pairs: 0,
18295
- size: 0
18296
- };
18297
- function reset(value2) {
18298
- state.state = State.key;
18299
- state.headers = /* @__PURE__ */ Object.create(null);
18300
- state.key = "";
18301
- state.value = void 0;
18302
- state.crlf = 0;
18303
- state.previousChunk = void 0;
18304
- state.pairs = 0;
18305
- state.size = 0;
18306
- return value2;
18307
- }
18308
- function concatUint8Array(a, b) {
18309
- const newUint8Array = new Uint8Array(a.length + b.length);
18310
- newUint8Array.set(a);
18311
- newUint8Array.set(b, a.length);
18312
- return newUint8Array;
18313
- }
18314
- function error(reason) {
18315
- return reset({
18316
- _tag: "Failure",
18317
- reason,
18318
- headers: state.headers
18319
- });
18320
- }
18321
- return function write2(chunk3, start3) {
18322
- let endOffset = 0;
18323
- let previousCursor;
18324
- if (state.previousChunk !== void 0) {
18325
- endOffset = state.previousChunk.length;
18326
- previousCursor = endOffset;
18327
- const newChunk = new Uint8Array(chunk3.length + endOffset);
18328
- newChunk.set(state.previousChunk);
18329
- newChunk.set(chunk3, endOffset);
18330
- state.previousChunk = void 0;
18331
- chunk3 = newChunk;
18332
- }
18333
- const end4 = chunk3.length;
18334
- outer: while (start3 < end4) {
18335
- if (state.state === State.key) {
18336
- let i = start3;
18337
- for (; i < end4; i++) {
18338
- if (state.size++ > constMaxSize) {
18339
- return error("HeaderTooLarge");
18340
- }
18341
- if (chunk3[i] === 58) {
18342
- state.key += decoder.decode(chunk3.subarray(start3, i)).toLowerCase();
18343
- if (state.key.length === 0) {
18344
- return error("InvalidHeaderName");
18345
- }
18346
- if (chunk3[i + 1] === 32 && chunk3[i + 2] !== 32 && chunk3[i + 2] !== 9) {
18347
- start3 = i + 2;
18348
- state.state = State.value;
18349
- state.size++;
18350
- } else if (chunk3[i + 1] !== 32 && chunk3[i + 1] !== 9) {
18351
- start3 = i + 1;
18352
- state.state = State.value;
18353
- } else {
18354
- start3 = i + 1;
18355
- state.state = State.whitespace;
18356
- }
18357
- break;
18358
- } else if (constNameChars[chunk3[i]] !== 1) {
18359
- return error("InvalidHeaderName");
18360
- }
18361
- }
18362
- if (i === end4) {
18363
- state.key += decoder.decode(chunk3.subarray(start3, end4)).toLowerCase();
18364
- return constContinue;
18365
- }
18366
- }
18367
- if (state.state === State.whitespace) {
18368
- for (; start3 < end4; start3++) {
18369
- if (state.size++ > constMaxSize) {
18370
- return error("HeaderTooLarge");
18371
- }
18372
- if (chunk3[start3] !== 32 && chunk3[start3] !== 9) {
18373
- state.state = State.value;
18374
- break;
18375
- }
18376
- }
18377
- if (start3 === end4) {
18378
- return constContinue;
18379
- }
18380
- }
18381
- if (state.state === State.value) {
18382
- let i = start3;
18383
- if (previousCursor !== void 0) {
18384
- i = previousCursor;
18385
- previousCursor = void 0;
18386
- }
18387
- for (; i < end4; i++) {
18388
- if (state.size++ > constMaxSize) {
18389
- return error("HeaderTooLarge");
18390
- }
18391
- if (chunk3[i] === 13 || state.crlf > 0) {
18392
- let byte = chunk3[i];
18393
- if (byte === 13 && state.crlf === 0) {
18394
- state.crlf = 1;
18395
- i++;
18396
- state.size++;
18397
- byte = chunk3[i];
18398
- }
18399
- if (byte === 10 && state.crlf === 1) {
18400
- state.crlf = 2;
18401
- i++;
18402
- state.size++;
18403
- byte = chunk3[i];
18404
- }
18405
- if (byte === 13 && state.crlf === 2) {
18406
- state.crlf = 3;
18407
- i++;
18408
- state.size++;
18409
- byte = chunk3[i];
18410
- }
18411
- if (byte === 10 && state.crlf === 3) {
18412
- state.crlf = 4;
18413
- i++;
18414
- state.size++;
18415
- }
18416
- if (state.crlf < 4 && i >= end4) {
18417
- state.previousChunk = chunk3.subarray(start3);
18418
- return constContinue;
18419
- } else if (state.crlf >= 2) {
18420
- state.value = state.value === void 0 ? chunk3.subarray(start3, i - state.crlf) : concatUint8Array(state.value, chunk3.subarray(start3, i - state.crlf));
18421
- const value2 = decoder.decode(state.value);
18422
- if (state.headers[state.key] === void 0) {
18423
- state.headers[state.key] = value2;
18424
- } else if (typeof state.headers[state.key] === "string") {
18425
- state.headers[state.key] = [state.headers[state.key], value2];
18426
- } else {
18427
- state.headers[state.key].push(value2);
18428
- }
18429
- start3 = i;
18430
- state.size--;
18431
- if (state.crlf !== 4 && state.pairs === constMaxPairs) {
18432
- return error("TooManyHeaders");
18433
- } else if (state.crlf === 3) {
18434
- return error("InvalidHeaderValue");
18435
- } else if (state.crlf === 4) {
18436
- return reset({
18437
- _tag: "Headers",
18438
- headers: state.headers,
18439
- endPosition: start3 - endOffset
18440
- });
18441
- }
18442
- state.pairs++;
18443
- state.key = "";
18444
- state.value = void 0;
18445
- state.crlf = 0;
18446
- state.state = State.key;
18447
- continue outer;
18448
- }
18449
- } else if (constValueChars[chunk3[i]] !== 1) {
18450
- return error("InvalidHeaderValue");
18451
- }
18452
- }
18453
- if (i === end4) {
18454
- state.value = state.value === void 0 ? chunk3.subarray(start3, end4) : concatUint8Array(state.value, chunk3.subarray(start3, end4));
18455
- return constContinue;
18456
- }
18457
- }
18458
- }
18459
- if (start3 > end4) {
18460
- state.size += end4 - start3;
18461
- }
18462
- return constContinue;
18463
- };
18464
- }
18465
-
18466
- // ../../../node_modules/.pnpm/multipasta@0.2.7/node_modules/multipasta/dist/esm/HeadersParser.js
18467
- var make55 = make54;
18468
-
18469
- // ../../../node_modules/.pnpm/@effect+platform-browser@0.70.0_@effect+platform@0.90.0_effect@3.17.2__effect@3.17.2/node_modules/@effect/platform-browser/dist/esm/internal/httpClient.js
18470
- var xhrTagKey = "@effect/platform-browser/BrowserHttpClient/XMLHttpRequest";
18471
- var xhrTag = /* @__PURE__ */ GenericTag(xhrTagKey);
18472
- var currentXHRResponseType = /* @__PURE__ */ globalValue("@effect/platform-browser/BrowserHttpClient/currentXHRResponseType", () => unsafeMake7("text"));
18473
- var makeXhr = () => new XMLHttpRequest();
18474
- var makeXMLHttpRequest = /* @__PURE__ */ make53((request, url, signal, fiber) => suspend4(() => {
18475
- const xhr = getOrElse3(fiber.getFiberRef(currentContext2), xhrTag, () => makeXhr)();
18476
- signal.addEventListener("abort", () => {
18477
- xhr.abort();
18478
- xhr.onreadystatechange = null;
18479
- }, {
18480
- once: true
18481
- });
18482
- xhr.open(request.method, url.toString(), true);
18483
- xhr.responseType = fiber.getFiberRef(currentXHRResponseType);
18484
- Object.entries(request.headers).forEach(([k, v]) => {
18485
- xhr.setRequestHeader(k, v);
18486
- });
18487
- return zipRight3(sendBody(xhr, request), async2((resume2) => {
18488
- let sent = false;
18489
- const onChange = () => {
18490
- if (!sent && xhr.readyState >= 2) {
18491
- sent = true;
18492
- resume2(succeed7(new ClientResponseImpl2(request, xhr)));
18493
- }
18494
- };
18495
- xhr.onreadystatechange = onChange;
18496
- xhr.onerror = (_event) => {
18497
- resume2(fail7(new RequestError({
18498
- request,
18499
- reason: "Transport",
18500
- cause: xhr.statusText
18501
- })));
18502
- };
18503
- onChange();
18504
- return _void;
18505
- }));
18506
- }));
18507
- var sendBody = (xhr, request) => {
18508
- const body = request.body;
18509
- switch (body._tag) {
18510
- case "Empty":
18511
- return sync4(() => xhr.send());
18349
+ // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/internal/fetchHttpClient.js
18350
+ var fetchTagKey = "@effect/platform/FetchHttpClient/Fetch";
18351
+ var requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
18352
+ var fetch = /* @__PURE__ */ make51((request, url, signal, fiber) => {
18353
+ const context5 = fiber.getFiberRef(currentContext2);
18354
+ const fetch2 = context5.unsafeMap.get(fetchTagKey) ?? globalThis.fetch;
18355
+ const options3 = context5.unsafeMap.get(requestInitTagKey) ?? {};
18356
+ const headers = options3.headers ? merge8(fromInput2(options3.headers), request.headers) : request.headers;
18357
+ const send = (body) => map17(tryPromise2({
18358
+ try: () => fetch2(url, {
18359
+ ...options3,
18360
+ method: request.method,
18361
+ headers,
18362
+ body,
18363
+ duplex: request.body._tag === "Stream" ? "half" : void 0,
18364
+ signal
18365
+ }),
18366
+ catch: (cause2) => new RequestError({
18367
+ request,
18368
+ reason: "Transport",
18369
+ cause: cause2
18370
+ })
18371
+ }), (response) => fromWeb(request, response));
18372
+ switch (request.body._tag) {
18512
18373
  case "Raw":
18513
- return sync4(() => xhr.send(body.body));
18514
18374
  case "Uint8Array":
18515
- return sync4(() => xhr.send(body.body));
18375
+ return send(request.body.body);
18516
18376
  case "FormData":
18517
- return sync4(() => xhr.send(body.formData));
18377
+ return send(request.body.formData);
18518
18378
  case "Stream":
18519
- return matchEffect2(runFold2(body.stream, new Uint8Array(0), (acc, chunk3) => {
18520
- const next = new Uint8Array(acc.length + chunk3.length);
18521
- next.set(acc, 0);
18522
- next.set(chunk3, acc.length);
18523
- return next;
18524
- }), {
18525
- onFailure: (cause2) => fail7(new RequestError({
18526
- request,
18527
- reason: "Encode",
18528
- cause: cause2
18529
- })),
18530
- onSuccess: (body2) => sync4(() => xhr.send(body2))
18531
- });
18532
- }
18533
- };
18534
- var encoder2 = /* @__PURE__ */ new TextEncoder();
18535
- var IncomingMessageImpl = class extends Class {
18536
- source;
18537
- onError;
18538
- [TypeId21];
18539
- constructor(source, onError4) {
18540
- super();
18541
- this.source = source;
18542
- this.onError = onError4;
18543
- this[TypeId21] = TypeId21;
18544
- this._rawHeaderString = source.getAllResponseHeaders();
18545
- }
18546
- _rawHeaderString;
18547
- _rawHeaders;
18548
- _headers;
18549
- get headers() {
18550
- if (this._headers) {
18551
- return this._headers;
18552
- }
18553
- if (this._rawHeaderString === "") {
18554
- return this._headers = empty33;
18555
- }
18556
- const parser = make55();
18557
- const result = parser(encoder2.encode(this._rawHeaderString + "\r\n"), 0);
18558
- this._rawHeaders = result._tag === "Headers" ? result.headers : void 0;
18559
- const parsed = result._tag === "Headers" ? fromInput2(result.headers) : empty33;
18560
- return this._headers = parsed;
18561
- }
18562
- cachedCookies;
18563
- get cookies() {
18564
- if (this.cachedCookies) {
18565
- return this.cachedCookies;
18566
- }
18567
- if (this._rawHeaders === void 0) {
18568
- return empty32;
18569
- } else if (this._rawHeaders["set-cookie"] === void 0) {
18570
- return this.cachedCookies = empty32;
18571
- }
18572
- return this.cachedCookies = fromSetCookie(this._rawHeaders["set-cookie"]);
18573
- }
18574
- get remoteAddress() {
18575
- return none2();
18379
+ return flatMap10(toReadableStreamEffect2(request.body.stream), send);
18576
18380
  }
18577
- _textEffect;
18578
- get text() {
18579
- if (this._textEffect) {
18580
- return this._textEffect;
18581
- }
18582
- return this._textEffect = async2((resume2) => {
18583
- if (this.source.readyState === 4) {
18584
- resume2(succeed7(this.source.responseText));
18585
- return;
18586
- }
18587
- const onReadyStateChange = () => {
18588
- if (this.source.readyState === 4) {
18589
- resume2(succeed7(this.source.responseText));
18590
- }
18591
- };
18592
- const onError4 = () => {
18593
- resume2(fail7(this.onError(this.source.statusText)));
18594
- };
18595
- this.source.addEventListener("readystatechange", onReadyStateChange);
18596
- this.source.addEventListener("error", onError4);
18597
- return sync4(() => {
18598
- this.source.removeEventListener("readystatechange", onReadyStateChange);
18599
- this.source.removeEventListener("error", onError4);
18600
- });
18601
- }).pipe(cached3, runSync);
18602
- }
18603
- get json() {
18604
- return tryMap2(this.text, {
18605
- try: (_) => _ === "" ? null : JSON.parse(_),
18606
- catch: this.onError
18607
- });
18608
- }
18609
- get urlParamsBody() {
18610
- return flatMap10(this.text, (_) => try_2({
18611
- try: () => fromInput3(new URLSearchParams(_)),
18612
- catch: this.onError
18613
- }));
18614
- }
18615
- get stream() {
18616
- return _async2((emit) => {
18617
- let offset = 0;
18618
- const onReadyStateChange = () => {
18619
- if (this.source.readyState === 3) {
18620
- emit.single(encoder2.encode(this.source.responseText.slice(offset)));
18621
- offset = this.source.responseText.length;
18622
- } else if (this.source.readyState === 4) {
18623
- if (offset < this.source.responseText.length) {
18624
- emit.single(encoder2.encode(this.source.responseText.slice(offset)));
18625
- }
18626
- emit.end();
18627
- }
18628
- };
18629
- const onError4 = () => {
18630
- emit.fail(this.onError(this.source.statusText));
18631
- };
18632
- this.source.addEventListener("readystatechange", onReadyStateChange);
18633
- this.source.addEventListener("error", onError4);
18634
- onReadyStateChange();
18635
- return sync4(() => {
18636
- this.source.removeEventListener("readystatechange", onReadyStateChange);
18637
- this.source.removeEventListener("error", onError4);
18638
- });
18639
- });
18640
- }
18641
- _arrayBufferEffect;
18642
- get arrayBuffer() {
18643
- if (this._arrayBufferEffect) {
18644
- return this._arrayBufferEffect;
18645
- }
18646
- return this._arrayBufferEffect = async2((resume2) => {
18647
- if (this.source.readyState === 4) {
18648
- resume2(succeed7(this.source.response));
18649
- return;
18650
- }
18651
- const onReadyStateChange = () => {
18652
- if (this.source.readyState === 4) {
18653
- resume2(succeed7(this.source.response));
18654
- }
18655
- };
18656
- const onError4 = () => {
18657
- resume2(fail7(this.onError(this.source.statusText)));
18658
- };
18659
- this.source.addEventListener("readystatechange", onReadyStateChange);
18660
- this.source.addEventListener("error", onError4);
18661
- return sync4(() => {
18662
- this.source.removeEventListener("readystatechange", onReadyStateChange);
18663
- this.source.removeEventListener("error", onError4);
18664
- });
18665
- }).pipe(map17((response) => {
18666
- if (typeof response === "string") {
18667
- const arr = encoder2.encode(response);
18668
- return arr.byteLength !== arr.buffer.byteLength ? arr.buffer.slice(arr.byteOffset, arr.byteOffset + arr.byteLength) : arr.buffer;
18669
- }
18670
- return response;
18671
- }), cached3, runSync);
18672
- }
18673
- };
18674
- var ClientResponseImpl2 = class extends IncomingMessageImpl {
18675
- request;
18676
- [TypeId26];
18677
- constructor(request, source) {
18678
- super(source, (cause2) => new ResponseError({
18679
- request,
18680
- response: this,
18681
- reason: "Decode",
18682
- cause: cause2
18683
- }));
18684
- this.request = request;
18685
- this[TypeId26] = TypeId26;
18686
- }
18687
- get status() {
18688
- return this.source.status;
18689
- }
18690
- get formData() {
18691
- return die5("Not implemented");
18692
- }
18693
- toString() {
18694
- return `ClientResponse(${this.status})`;
18695
- }
18696
- toJSON() {
18697
- return inspect(this, {
18698
- _id: "@effect/platform/HttpClientResponse",
18699
- request: this.request.toJSON(),
18700
- status: this.status
18701
- });
18702
- }
18703
- };
18704
- var layerXMLHttpRequest = /* @__PURE__ */ layerMergedContext2(/* @__PURE__ */ succeed7(makeXMLHttpRequest));
18381
+ return send(void 0);
18382
+ });
18383
+ var layer = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed7(fetch));
18705
18384
 
18706
- // ../../../node_modules/.pnpm/@effect+platform-browser@0.70.0_@effect+platform@0.90.0_effect@3.17.2__effect@3.17.2/node_modules/@effect/platform-browser/dist/esm/BrowserHttpClient.js
18707
- var layerXMLHttpRequest2 = layerXMLHttpRequest;
18385
+ // ../../../node_modules/.pnpm/@effect+platform@0.90.0_effect@3.17.2/node_modules/@effect/platform/dist/esm/FetchHttpClient.js
18386
+ var layer2 = layer;
18708
18387
 
18709
18388
  // ../ajax-client/dist/main/LoggerUtils.js
18710
18389
  var withNamespacedLogSpan = Logging_exports.makeNamespacedLogSpan(
@@ -18726,7 +18405,7 @@ var InvalidAjaxMethodError = class extends TaggedError(
18726
18405
  };
18727
18406
 
18728
18407
  // ../ajax-client/dist/main/AjaxClientResponse.js
18729
- var make56 = (data) => _case()(data);
18408
+ var make52 = (data) => _case()(data);
18730
18409
 
18731
18410
  // ../ajax-client/dist/main/index.js
18732
18411
  Struct({});
@@ -18736,7 +18415,7 @@ extend3(
18736
18415
  handle: String$
18737
18416
  })
18738
18417
  );
18739
- var Default = layerXMLHttpRequest2;
18418
+ var Default = layer2;
18740
18419
  var METHOD = {
18741
18420
  GET: "get",
18742
18421
  POST: "post"
@@ -18776,7 +18455,7 @@ var makeFactory = ({
18776
18455
  acceptJson: true,
18777
18456
  headers: {
18778
18457
  "X-SDK-Variant": "brytdesigns",
18779
- "X-SK-Variant-Source": "shopify-ajax-client",
18458
+ "X-SDK-Variant-Source": "shopify-ajax-client",
18780
18459
  ...options3?.headers || {}
18781
18460
  }
18782
18461
  }).pipe(bodyJson2(decodedInput));
@@ -18795,7 +18474,7 @@ var makeFactory = ({
18795
18474
  const response = yield* client.execute(request);
18796
18475
  if (response.status !== 200) {
18797
18476
  const data = yield* response.json;
18798
- return make56({
18477
+ return make52({
18799
18478
  error: {
18800
18479
  description: data.description,
18801
18480
  status: data.status,
@@ -18815,7 +18494,7 @@ var makeFactory = ({
18815
18494
  response,
18816
18495
  schemaBodyJson(output2)
18817
18496
  );
18818
- const clientResponse2 = make56({
18497
+ const clientResponse2 = make52({
18819
18498
  data: json22
18820
18499
  });
18821
18500
  yield* annotateLogsScoped2({
@@ -18831,7 +18510,7 @@ var makeFactory = ({
18831
18510
  response,
18832
18511
  schemaBodyJson(output)
18833
18512
  );
18834
- const clientResponse = make56({
18513
+ const clientResponse = make52({
18835
18514
  data: json2
18836
18515
  });
18837
18516
  yield* annotateLogsScoped2({
@@ -18873,46 +18552,46 @@ var makeFactory = ({
18873
18552
  );
18874
18553
 
18875
18554
  // src/effect/api/CartAdd.ts
18876
- var make57 = makeFactory({
18555
+ var make53 = makeFactory({
18877
18556
  routeName: "cart_add_url",
18878
18557
  inputSchema: CartAddInput,
18879
18558
  outputSchema: CartAddOutput
18880
18559
  });
18881
18560
 
18882
18561
  // src/effect/api/CartChange.ts
18883
- var make58 = makeFactory({
18562
+ var make54 = makeFactory({
18884
18563
  routeName: "cart_change_url",
18885
18564
  inputSchema: CartChangeInput,
18886
18565
  outputSchema: CartChangeOutput
18887
18566
  });
18888
18567
 
18889
18568
  // src/effect/api/CartClear.ts
18890
- var make59 = makeFactory({
18569
+ var make55 = makeFactory({
18891
18570
  routeName: "cart_clear_url",
18892
18571
  inputSchema: CartClearInput,
18893
18572
  outputSchema: CartOutput
18894
18573
  });
18895
18574
 
18896
18575
  // src/effect/api/CartGet.ts
18897
- var make60 = makeFactory({
18576
+ var make56 = makeFactory({
18898
18577
  routeName: "cart_url",
18899
18578
  inputSchema: CartGetInput,
18900
18579
  outputSchema: CartOutput
18901
18580
  });
18902
18581
 
18903
18582
  // src/effect/api/CartUpdate.ts
18904
- var make61 = makeFactory({
18583
+ var make57 = makeFactory({
18905
18584
  routeName: "cart_update_url",
18906
18585
  inputSchema: CartUpdateInput,
18907
18586
  outputSchema: CartUpdateOutput
18908
18587
  });
18909
18588
 
18910
18589
  // src/effect/index.ts
18911
- var add6 = make57;
18912
- var change = make58;
18913
- var clear = make59;
18914
- var get18 = make60;
18915
- var update5 = make61;
18590
+ var add6 = make53;
18591
+ var change = make54;
18592
+ var clear = make55;
18593
+ var get18 = make56;
18594
+ var update5 = make57;
18916
18595
 
18917
18596
  // src/index.ts
18918
18597
  var validateCart = (cart) => runSync(decodeUnknown2(CartOutput)(cart));
@@ -18930,7 +18609,7 @@ var createAjaxCartApi = ({ debug = false }) => {
18930
18609
  add6(input, {
18931
18610
  ...options3 || {},
18932
18611
  headers: {
18933
- "X-SK-Variant-Source": "shopify-ajax-cart-api",
18612
+ "X-SDK-Variant-Source": "shopify-ajax-cart-api",
18934
18613
  ...options3?.headers || {}
18935
18614
  }
18936
18615
  }).pipe(
@@ -18945,7 +18624,7 @@ var createAjaxCartApi = ({ debug = false }) => {
18945
18624
  change(input, {
18946
18625
  ...options3 || {},
18947
18626
  headers: {
18948
- "X-SK-Variant-Source": "shopify-ajax-cart-api",
18627
+ "X-SDK-Variant-Source": "shopify-ajax-cart-api",
18949
18628
  ...options3?.headers || {}
18950
18629
  }
18951
18630
  }).pipe(
@@ -18960,7 +18639,7 @@ var createAjaxCartApi = ({ debug = false }) => {
18960
18639
  clear(input, {
18961
18640
  ...options3 || {},
18962
18641
  headers: {
18963
- "X-SK-Variant-Source": "shopify-ajax-cart-api",
18642
+ "X-SDK-Variant-Source": "shopify-ajax-cart-api",
18964
18643
  ...options3?.headers || {}
18965
18644
  }
18966
18645
  }).pipe(
@@ -18975,7 +18654,7 @@ var createAjaxCartApi = ({ debug = false }) => {
18975
18654
  get18(input, {
18976
18655
  ...options3 || {},
18977
18656
  headers: {
18978
- "X-SK-Variant-Source": "shopify-ajax-cart-api",
18657
+ "X-SDK-Variant-Source": "shopify-ajax-cart-api",
18979
18658
  ...options3?.headers || {}
18980
18659
  }
18981
18660
  }).pipe(
@@ -18990,7 +18669,7 @@ var createAjaxCartApi = ({ debug = false }) => {
18990
18669
  update5(input, {
18991
18670
  ...options3 || {},
18992
18671
  headers: {
18993
- "X-SK-Variant-Source": "shopify-ajax-cart-api",
18672
+ "X-SDK-Variant-Source": "shopify-ajax-cart-api",
18994
18673
  ...options3?.headers || {}
18995
18674
  }
18996
18675
  }).pipe(