affect-cli 0.0.2 → 0.0.4

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 (3) hide show
  1. package/README.md +16 -1
  2. package/dist/index.js +2166 -302
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -510,6 +510,7 @@ function compareHashed(self, that, hashOf, equivalent) {
510
510
  var entryHash = (entry) => hash(entry[0]);
511
511
  var equalEntries = (self, that) => compareBoth(self[0], that[0]) && compareBoth(self[1], that[1]);
512
512
  var isEqual = (u) => hasProperty(u, symbol2) && typeof u[symbol2] === "function";
513
+ var asEquivalence = () => equals;
513
514
 
514
515
  // node_modules/effect/dist/Redactable.js
515
516
  var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Redactable");
@@ -746,6 +747,15 @@ var BaseProto = {
746
747
  }
747
748
  };
748
749
 
750
+ class Class2 {
751
+ [NodeInspectSymbol]() {
752
+ return this.toJSON();
753
+ }
754
+ toString() {
755
+ return format(this.toJSON());
756
+ }
757
+ }
758
+
749
759
  // node_modules/effect/dist/internal/stackTraceLimit.js
750
760
  var isStackTraceLimitWritable = () => {
751
761
  const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
@@ -1250,6 +1260,35 @@ var Prototype2 = (options) => makePrimitiveProto({
1250
1260
  [evaluate]: options.evaluate
1251
1261
  });
1252
1262
 
1263
+ // node_modules/effect/dist/Equivalence.js
1264
+ var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
1265
+ var isStrictEquivalent = (x, y) => x === y;
1266
+ var strictEqual = () => isStrictEquivalent;
1267
+ function Tuple(elements) {
1268
+ return make((self, that) => {
1269
+ if (self.length !== that.length) {
1270
+ return false;
1271
+ }
1272
+ for (let i = 0;i < self.length; i++) {
1273
+ if (!elements[i](self[i], that[i])) {
1274
+ return false;
1275
+ }
1276
+ }
1277
+ return true;
1278
+ });
1279
+ }
1280
+ function Array_(item) {
1281
+ return make((self, that) => {
1282
+ if (self.length !== that.length)
1283
+ return false;
1284
+ for (let i = 0;i < self.length; i++) {
1285
+ if (!item(self[i], that[i]))
1286
+ return false;
1287
+ }
1288
+ return true;
1289
+ });
1290
+ }
1291
+
1253
1292
  // node_modules/effect/dist/internal/option.js
1254
1293
  var TypeId = "~effect/Option";
1255
1294
  var CommonProto = {
@@ -1383,11 +1422,11 @@ SuccessImpl.prototype = SuccessProto;
1383
1422
  var succeed = (success) => new SuccessImpl(success);
1384
1423
 
1385
1424
  // node_modules/effect/dist/Order.js
1386
- function make(compare) {
1425
+ function make2(compare) {
1387
1426
  return (self, that) => self === that ? 0 : compare(self, that);
1388
1427
  }
1389
- var String2 = /* @__PURE__ */ make((self, that) => self < that ? -1 : 1);
1390
- var Number2 = /* @__PURE__ */ make((self, that) => {
1428
+ var String2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
1429
+ var Number2 = /* @__PURE__ */ make2((self, that) => {
1391
1430
  if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that))
1392
1431
  return 0;
1393
1432
  if (globalThis.Number.isNaN(self))
@@ -1396,7 +1435,7 @@ var Number2 = /* @__PURE__ */ make((self, that) => {
1396
1435
  return 1;
1397
1436
  return self < that ? -1 : 1;
1398
1437
  });
1399
- var mapInput = /* @__PURE__ */ dual(2, (self, f) => make((b1, b2) => self(f(b1), f(b2))));
1438
+ var mapInput = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
1400
1439
  var isGreaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
1401
1440
 
1402
1441
  // node_modules/effect/dist/Option.js
@@ -1457,7 +1496,7 @@ var ServiceProto = {
1457
1496
  return self;
1458
1497
  },
1459
1498
  context(self) {
1460
- return make2(this, self);
1499
+ return make3(this, self);
1461
1500
  },
1462
1501
  use(f) {
1463
1502
  return withFiber((fiber) => f(get(fiber.context, this)));
@@ -1561,7 +1600,7 @@ var isContext = (u) => hasProperty(u, TypeId3);
1561
1600
  var isReference = (u) => !!u[ReferenceTypeId];
1562
1601
  var empty = () => emptyContext2;
1563
1602
  var emptyContext2 = /* @__PURE__ */ makeUnsafe(/* @__PURE__ */ new Map);
1564
- var make2 = (key, service) => makeUnsafe(new Map([[key.key, service]]));
1603
+ var make3 = (key, service) => makeUnsafe(new Map([[key.key, service]]));
1565
1604
  var add = /* @__PURE__ */ dual(3, (self, key, service) => addUnsafe(self, key.key, service));
1566
1605
  var addUnsafe = (self, key, service) => {
1567
1606
  const impl = self;
@@ -1645,6 +1684,22 @@ var normalize = (n) => n > 0 ? Math.floor(n) : 0;
1645
1684
  // node_modules/effect/dist/Result.js
1646
1685
  var succeed2 = succeed;
1647
1686
  var fail2 = fail;
1687
+ var failVoid = /* @__PURE__ */ fail2(undefined);
1688
+ var try_ = (evaluate) => {
1689
+ if (isFunction(evaluate)) {
1690
+ try {
1691
+ return succeed2(evaluate());
1692
+ } catch (e) {
1693
+ return fail2(e);
1694
+ }
1695
+ } else {
1696
+ try {
1697
+ return succeed2(evaluate.try());
1698
+ } catch (e) {
1699
+ return fail2(evaluate.catch(e));
1700
+ }
1701
+ }
1702
+ };
1648
1703
  var isFailure2 = isFailure;
1649
1704
  var isSuccess2 = isSuccess;
1650
1705
  var match2 = /* @__PURE__ */ dual(2, (self, {
@@ -1659,6 +1714,9 @@ var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onFailure) => {
1659
1714
  });
1660
1715
  var getOrThrow = /* @__PURE__ */ getOrThrowWith(identity);
1661
1716
 
1717
+ // node_modules/effect/dist/Tuple.js
1718
+ var makeEquivalence = Tuple;
1719
+
1662
1720
  // node_modules/effect/dist/Iterable.js
1663
1721
  var findFirst = /* @__PURE__ */ dual(2, (self, f) => {
1664
1722
  let i = 0;
@@ -1700,7 +1758,29 @@ var collect = /* @__PURE__ */ dual(2, (self, f) => {
1700
1758
  return out;
1701
1759
  });
1702
1760
  var toEntries = /* @__PURE__ */ collect((key, value) => [key, value]);
1761
+ var has = /* @__PURE__ */ dual(2, (self, key) => Object.hasOwn(self, key));
1762
+ var map2 = /* @__PURE__ */ dual(2, (self, f) => {
1763
+ const out = {
1764
+ ...self
1765
+ };
1766
+ for (const key of keys(self)) {
1767
+ assignProperty(out, key, f(self[key], key));
1768
+ }
1769
+ return out;
1770
+ });
1703
1771
  var keys = (self) => Object.keys(self);
1772
+ var isSubrecordBy = (equivalence) => dual(2, (self, that) => {
1773
+ for (const key of keys(self)) {
1774
+ if (!has(that, key) || !equivalence(self[key], that[key])) {
1775
+ return false;
1776
+ }
1777
+ }
1778
+ return true;
1779
+ });
1780
+ var makeEquivalence2 = (equivalence) => {
1781
+ const is = isSubrecordBy(equivalence);
1782
+ return (self, that) => is(self, that) && is(that, self);
1783
+ };
1704
1784
 
1705
1785
  // node_modules/effect/dist/Array.js
1706
1786
  var Array2 = globalThis.Array;
@@ -1750,11 +1830,42 @@ var sort = /* @__PURE__ */ dual(2, (self, O) => {
1750
1830
  out.sort(O);
1751
1831
  return out;
1752
1832
  });
1833
+ var containsWith = (isEquivalent) => dual(2, (self, a) => {
1834
+ for (const i of self) {
1835
+ if (isEquivalent(a, i)) {
1836
+ return true;
1837
+ }
1838
+ }
1839
+ return false;
1840
+ });
1841
+ var contains = /* @__PURE__ */ containsWith(/* @__PURE__ */ asEquivalence());
1753
1842
  var empty2 = () => [];
1754
1843
  var of = (a) => [a];
1755
- var map2 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
1844
+ var map3 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
1845
+ var filterMap = /* @__PURE__ */ dual(2, (self, f) => {
1846
+ const as = fromIterable(self);
1847
+ const out = [];
1848
+ for (let i = 0;i < as.length; i++) {
1849
+ const result = f(as[i], i);
1850
+ if (isSuccess2(result)) {
1851
+ out.push(result.success);
1852
+ }
1853
+ }
1854
+ return out;
1855
+ });
1856
+ var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
1857
+ const as = fromIterable(self);
1858
+ const out = [];
1859
+ for (let i = 0;i < as.length; i++) {
1860
+ if (predicate(as[i], i)) {
1861
+ out.push(as[i]);
1862
+ }
1863
+ }
1864
+ return out;
1865
+ });
1756
1866
  var reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable(self).reduce((b, a, i) => f(b, a, i), b));
1757
1867
  var some3 = /* @__PURE__ */ dual(2, (self, predicate) => self.some(predicate));
1868
+ var makeEquivalence3 = Array_;
1758
1869
  var join = /* @__PURE__ */ dual(2, (self, sep) => fromIterable(self).join(sep));
1759
1870
 
1760
1871
  // node_modules/effect/dist/Duration.js
@@ -1772,7 +1883,7 @@ var bigintNanosPerDay = /* @__PURE__ */ BigInt(86400000000000);
1772
1883
  var bigintNanosPerWeek = /* @__PURE__ */ BigInt(604800000000000);
1773
1884
  var roundTiesAwayFromZero = (input) => BigInt(Math.sign(input) * Math.round(Math.abs(input)));
1774
1885
  var roundMillisToNanos = (millis) => Number.isInteger(millis) ? BigInt(millis) * bigint1e6 : roundTiesAwayFromZero(millis * 1e6);
1775
- var fromNanosNumber = (nanos) => make3(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos);
1886
+ var fromNanosNumber = (nanos) => make4(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos);
1776
1887
  var nanosToUnit = (nanos, divisor) => {
1777
1888
  const value = Number(nanos);
1778
1889
  if (Number.isFinite(value))
@@ -1798,9 +1909,9 @@ var divideTiesAwayFromZero = (numerator, denominator) => {
1798
1909
  var fromMillisString = (input, scale) => {
1799
1910
  const millis = Number(input) * scale;
1800
1911
  if (!Number.isFinite(millis))
1801
- return make3(millis);
1912
+ return make4(millis);
1802
1913
  const nanos = parseNanos(input, BigInt(scale) * bigint1e6);
1803
- return make3(Number.isInteger(millis) && BigInt(millis) * bigint1e6 === nanos ? millis : nanos);
1914
+ return make4(Number.isInteger(millis) && BigInt(millis) * bigint1e6 === nanos ? millis : nanos);
1804
1915
  };
1805
1916
  var DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/;
1806
1917
  var fromInputUnsafe = (input) => {
@@ -1867,7 +1978,7 @@ var fromInputUnsafe = (input) => {
1867
1978
  return infinity;
1868
1979
  }
1869
1980
  const nanos = input[0] * 1e9 + input[1];
1870
- return Number.isFinite(nanos) && Number.isInteger(input[0]) && Number.isInteger(input[1]) ? make3(BigInt(input[0]) * bigint1e9 + BigInt(input[1])) : fromNanosNumber(nanos);
1981
+ return Number.isFinite(nanos) && Number.isInteger(input[0]) && Number.isInteger(input[1]) ? make4(BigInt(input[0]) * bigint1e9 + BigInt(input[1])) : fromNanosNumber(nanos);
1871
1982
  }
1872
1983
  const obj = input;
1873
1984
  let millis = 0;
@@ -1885,13 +1996,13 @@ var fromInputUnsafe = (input) => {
1885
1996
  millis += obj.milliseconds;
1886
1997
  if (!obj.microseconds && !obj.nanoseconds) {
1887
1998
  if (!Number.isFinite(millis))
1888
- return make3(millis);
1999
+ return make4(millis);
1889
2000
  const exact = sumObjectNanos(obj);
1890
- return exact === undefined || BigInt(millis) * bigint1e6 === exact ? make3(millis) : make3(exact);
2001
+ return exact === undefined || BigInt(millis) * bigint1e6 === exact ? make4(millis) : make4(exact);
1891
2002
  }
1892
2003
  const nanos = millis * 1e6 + (obj.microseconds ?? 0) * 1000 + (obj.nanoseconds ?? 0);
1893
2004
  const exact = Number.isFinite(nanos) ? sumObjectNanos(obj) : undefined;
1894
- return exact === undefined ? fromNanosNumber(nanos) : make3(exact);
2005
+ return exact === undefined ? fromNanosNumber(nanos) : make4(exact);
1895
2006
  }
1896
2007
  }
1897
2008
  return invalid(input);
@@ -1992,7 +2103,7 @@ var DurationProto = {
1992
2103
  return pipeArguments(this, arguments);
1993
2104
  }
1994
2105
  };
1995
- var make3 = (input) => {
2106
+ var make4 = (input) => {
1996
2107
  const duration = Object.create(DurationProto);
1997
2108
  if (typeof input === "number") {
1998
2109
  if (isNaN(input) || input === 0 || Object.is(input, -0)) {
@@ -2022,11 +2133,12 @@ var make3 = (input) => {
2022
2133
  };
2023
2134
  var isDuration = (u) => hasProperty(u, TypeId4);
2024
2135
  var isFinite = (self) => self.value._tag !== "Infinity" && self.value._tag !== "NegativeInfinity";
2025
- var zero = /* @__PURE__ */ make3(0);
2026
- var infinity = /* @__PURE__ */ make3(Infinity);
2027
- var negativeInfinity = /* @__PURE__ */ make3(-Infinity);
2028
- var nanos = (nanos) => make3(nanos);
2029
- var millis = (millis) => make3(millis);
2136
+ var zero = /* @__PURE__ */ make4(0);
2137
+ var infinity = /* @__PURE__ */ make4(Infinity);
2138
+ var negativeInfinity = /* @__PURE__ */ make4(-Infinity);
2139
+ var nanos = (nanos) => make4(nanos);
2140
+ var millis = (millis) => make4(millis);
2141
+ var seconds = (seconds) => make4(seconds * 1000);
2030
2142
  var toMillis = (self) => match4(fromInputUnsafe(self), {
2031
2143
  onMillis: identity,
2032
2144
  onNanos: (nanos) => nanosToUnit(nanos, 1e6),
@@ -2267,7 +2379,7 @@ class ParentSpan extends (/* @__PURE__ */ Service()(ParentSpanKey, {
2267
2379
  fiberCached: true
2268
2380
  })) {
2269
2381
  }
2270
- var make4 = (options) => options;
2382
+ var make5 = (options) => options;
2271
2383
  var DisablePropagation = /* @__PURE__ */ Reference("effect/Tracer/DisablePropagation", {
2272
2384
  defaultValue: constFalse
2273
2385
  });
@@ -2278,7 +2390,7 @@ var MinimumTraceLevel = /* @__PURE__ */ Reference("effect/Tracer/MinimumTraceLev
2278
2390
  defaultValue: () => "All"
2279
2391
  });
2280
2392
  var TracerKey = "effect/Tracer";
2281
- var nativeTracer = /* @__PURE__ */ make4({
2393
+ var nativeTracer = /* @__PURE__ */ make5({
2282
2394
  span: (options) => new NativeSpan(options)
2283
2395
  });
2284
2396
 
@@ -2388,6 +2500,27 @@ var CurrentLogSpans = /* @__PURE__ */ Reference("effect/References/CurrentLogSpa
2388
2500
  });
2389
2501
 
2390
2502
  // node_modules/effect/dist/internal/tracer.js
2503
+ var addSpanStackTrace = (options) => {
2504
+ if (options?.captureStackTrace === false) {
2505
+ return options;
2506
+ } else if (options?.captureStackTrace !== undefined && typeof options.captureStackTrace !== "boolean") {
2507
+ return options;
2508
+ }
2509
+ const limit = getStackTraceLimit();
2510
+ if (limit === 0 && options?.captureStackTrace !== true) {
2511
+ return {
2512
+ ...options,
2513
+ captureStackTrace: false
2514
+ };
2515
+ }
2516
+ setStackTraceLimit(3);
2517
+ const traceError = new Error;
2518
+ setStackTraceLimit(limit);
2519
+ return {
2520
+ ...options,
2521
+ captureStackTrace: spanCleaner(() => traceError.stack)
2522
+ };
2523
+ };
2391
2524
  var makeStackCleaner = (line) => (stack) => {
2392
2525
  let cache;
2393
2526
  return () => {
@@ -2404,6 +2537,7 @@ var makeStackCleaner = (line) => (stack) => {
2404
2537
  }
2405
2538
  };
2406
2539
  };
2540
+ var spanCleaner = /* @__PURE__ */ makeStackCleaner(3);
2407
2541
 
2408
2542
  // node_modules/effect/dist/internal/effect.js
2409
2543
  class Interrupt extends ReasonBase {
@@ -2442,6 +2576,19 @@ var hasDies = (self) => self.reasons.some(isDieReason);
2442
2576
  var causeElectDefects = (self) => hasDies(self) && hasFails(self) ? causeFromReasons(self.reasons.map((reason) => reason._tag === "Fail" && !isDone(reason.error) ? new Die(reason.error, reason.annotations) : reason)) : self;
2443
2577
  var findRecoverableError = (self) => hasDies(self) ? fail2(causeElectDefects(self)) : findError(self);
2444
2578
  var hasInterrupts = (self) => self.reasons.some(isInterruptReason);
2579
+ var causeFilterInterruptors = (self) => {
2580
+ let interruptors;
2581
+ for (let i = 0;i < self.reasons.length; i++) {
2582
+ const f = self.reasons[i];
2583
+ if (f._tag !== "Interrupt")
2584
+ continue;
2585
+ interruptors ??= new Set;
2586
+ if (f.fiberId !== undefined) {
2587
+ interruptors.add(f.fiberId);
2588
+ }
2589
+ }
2590
+ return interruptors ? succeed2(interruptors) : fail2(self);
2591
+ };
2445
2592
  var hasInterruptsOnly = (self) => self.reasons.length > 0 && self.reasons.every(isInterruptReason);
2446
2593
  var reasonAnnotations = (self) => makeUnsafe(self.annotations);
2447
2594
  var causeMap = /* @__PURE__ */ dual(2, (self, f) => {
@@ -2590,9 +2737,9 @@ var currentStackTrace = (frame) => {
2590
2737
  if (stack) {
2591
2738
  const locationMatchAll = stack.matchAll(locationRegExp);
2592
2739
  let match = false;
2593
- for (const [, location] of locationMatchAll) {
2740
+ for (const [, location2] of locationMatchAll) {
2594
2741
  match = true;
2595
- out.push(` at ${current.name} (${location})`);
2742
+ out.push(` at ${current.name} (${location2})`);
2596
2743
  }
2597
2744
  if (!match) {
2598
2745
  out.push(` at ${current.name} (${stack.replace(/^at /, "")})`);
@@ -2697,7 +2844,7 @@ class FiberImpl {
2697
2844
  }
2698
2845
  let cause = causeInterrupt(fiberId);
2699
2846
  if (this.cache.stackFrame) {
2700
- cause = causeAnnotate(cause, make2(StackTraceKey, this.cache.stackFrame));
2847
+ cause = causeAnnotate(cause, make3(StackTraceKey, this.cache.stackFrame));
2701
2848
  }
2702
2849
  if (annotations) {
2703
2850
  cause = causeAnnotate(cause, annotations);
@@ -3009,7 +3156,7 @@ var failCauseSync = (evaluate) => suspend(() => failCause(evaluate()));
3009
3156
  var die = (defect) => exitDie(defect);
3010
3157
  var failSync = (error) => suspend(() => fail3(error()));
3011
3158
  var void_ = /* @__PURE__ */ succeed3(undefined);
3012
- var try_ = (options) => {
3159
+ var try_2 = (options) => {
3013
3160
  const evaluate = typeof options === "function" ? options : options.try;
3014
3161
  const catcher = typeof options === "function" ? (cause) => new UnknownError(cause, "An error occurred in Effect.try") : options.catch;
3015
3162
  return suspend(() => {
@@ -3020,6 +3167,9 @@ var try_ = (options) => {
3020
3167
  }
3021
3168
  });
3022
3169
  };
3170
+ var promise = (evaluate) => callbackOptions(function(resume, signal) {
3171
+ evaluate(signal).then((a) => resume(succeed3(a)), (e) => resume(die(e)));
3172
+ }, evaluate.length !== 0);
3023
3173
  var tryPromise = (options) => {
3024
3174
  const f = typeof options === "function" ? options : options.try;
3025
3175
  const catcher = typeof options === "function" ? (cause) => new UnknownError(cause, "An error occurred in Effect.tryPromise") : options.catch;
@@ -3337,8 +3487,9 @@ var flatMapEager = /* @__PURE__ */ dual(2, (self, f) => {
3337
3487
  }
3338
3488
  return flatMap2(self, f);
3339
3489
  });
3340
- var map3 = /* @__PURE__ */ dual(2, (self, f) => new ContImpl(self, mapCont, f));
3341
- var mapEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map3(self, f));
3490
+ var flatten2 = (self) => flatMap2(self, identity);
3491
+ var map4 = /* @__PURE__ */ dual(2, (self, f) => new ContImpl(self, mapCont, f));
3492
+ var mapEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map4(self, f));
3342
3493
  var mapErrorEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMapError(self, f) : mapError(self, f));
3343
3494
  var catchEager = /* @__PURE__ */ dual(2, (self, f) => {
3344
3495
  if (effectIsExit(self)) {
@@ -3408,9 +3559,9 @@ var provideService = function() {
3408
3559
  return dual(3, (self, service, impl) => provideServiceImpl(self, service, impl)).apply(this, arguments);
3409
3560
  };
3410
3561
  var provideServiceImpl = (self, service, implementation) => updateContext(self, add(service, implementation));
3411
- var zipWith = /* @__PURE__ */ dual((args) => isEffect(args[1]), (self, that, f, options) => options?.concurrent ? map3(all([self, that], {
3562
+ var zipWith = /* @__PURE__ */ dual((args) => isEffect(args[1]), (self, that, f, options) => options?.concurrent ? map4(all([self, that], {
3412
3563
  concurrency: 2
3413
- }), ([a, a2]) => f(a, a2)) : flatMap2(self, (a) => map3(that, (a2) => f(a, a2))));
3564
+ }), ([a, a2]) => f(a, a2)) : flatMap2(self, (a) => map4(that, (a2) => f(a, a2))));
3414
3565
  var forever = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, options) => whileLoop({
3415
3566
  while: constTrue,
3416
3567
  body: constant(options?.disableYield ? self : flatMap2(self, (_) => yieldNow)),
@@ -3773,6 +3924,14 @@ var onExitFilter = /* @__PURE__ */ dual(3, (self, filter, f) => onExit(self, (ex
3773
3924
  return isFailure2(b) ? void_ : f(b.success, exit);
3774
3925
  }));
3775
3926
  var onError = /* @__PURE__ */ dual(2, (self, f) => onExitFilter(self, exitFilterCause, f));
3927
+ var onErrorFilter = /* @__PURE__ */ dual(3, (self, filter, f) => onExit(self, (exit) => {
3928
+ if (exit._tag !== "Failure") {
3929
+ return void_;
3930
+ }
3931
+ const result = filter(exit.cause);
3932
+ return isFailure2(result) ? void_ : f(result.success, exit.cause);
3933
+ }));
3934
+ var onInterrupt = /* @__PURE__ */ dual(2, (self, finalizer) => onErrorFilter(causeFilterInterruptors, finalizer)(self));
3776
3935
  var infiniteTTL = /* @__PURE__ */ constant(Infinity);
3777
3936
  var makeCachedUnsafe = (self, ttlMillis) => {
3778
3937
  let expiresAt = 0;
@@ -3873,7 +4032,7 @@ var all = (arg, options) => {
3873
4032
  } else if (options?.discard) {
3874
4033
  return options.mode === "result" ? forEach(Object.values(arg), result, options) : forEach(Object.values(arg), identity, options);
3875
4034
  }
3876
- return suspend(() => map3(forEach(Object.entries(arg), ([key, effect]) => map3(options?.mode === "result" ? result(effect) : effect, (value) => [key, value]), {
4035
+ return suspend(() => map4(forEach(Object.entries(arg), ([key, effect]) => map4(options?.mode === "result" ? result(effect) : effect, (value) => [key, value]), {
3877
4036
  concurrency: options?.concurrency
3878
4037
  }), Object.fromEntries));
3879
4038
  };
@@ -4144,6 +4303,25 @@ var fiberRunIn = /* @__PURE__ */ dual(2, (self, scope) => {
4144
4303
  return self;
4145
4304
  });
4146
4305
  var runFork = /* @__PURE__ */ runForkWith(/* @__PURE__ */ empty());
4306
+ var runPromiseExitWith = (context) => {
4307
+ const runFork = runForkWith(context);
4308
+ return (effect, options) => {
4309
+ const fiber = runFork(effect, options);
4310
+ return new Promise((resolve) => {
4311
+ fiber.addObserver((exit) => resolve(exit));
4312
+ });
4313
+ };
4314
+ };
4315
+ var runPromiseWith = (context) => {
4316
+ const runPromiseExit = runPromiseExitWith(context);
4317
+ return (effect, options) => runPromiseExit(effect, options).then((exit) => {
4318
+ if (exit._tag === "Failure") {
4319
+ throw causeSquash(exit.cause);
4320
+ }
4321
+ return exit.value;
4322
+ });
4323
+ };
4324
+ var runPromise = /* @__PURE__ */ runPromiseWith(/* @__PURE__ */ empty());
4147
4325
  var runSyncExitWith = (context) => {
4148
4326
  const runFork = runForkWith(context);
4149
4327
  return (effect) => {
@@ -4158,6 +4336,16 @@ var runSyncExitWith = (context) => {
4158
4336
  };
4159
4337
  };
4160
4338
  var runSyncExit = /* @__PURE__ */ runSyncExitWith(/* @__PURE__ */ empty());
4339
+ var runSyncWith = (context) => {
4340
+ const runSyncExit = runSyncExitWith(context);
4341
+ return (effect) => {
4342
+ const exit = runSyncExit(effect);
4343
+ if (exit._tag === "Failure")
4344
+ throw causeSquash(exit.cause);
4345
+ return exit.value;
4346
+ };
4347
+ };
4348
+ var runSync = /* @__PURE__ */ runSyncWith(/* @__PURE__ */ empty());
4161
4349
  var succeedTrue = /* @__PURE__ */ succeed3(true);
4162
4350
  var succeedFalse = /* @__PURE__ */ succeed3(false);
4163
4351
 
@@ -4309,6 +4497,14 @@ var makeSpanUnsafe = (fiber, name, options) => {
4309
4497
  }
4310
4498
  return span;
4311
4499
  };
4500
+ var provideSpanStackFrame = (name, stack) => {
4501
+ stack = typeof stack === "function" ? stack : constUndefined;
4502
+ return updateService(CurrentStackFrame, (parent) => ({
4503
+ name,
4504
+ stack,
4505
+ parent
4506
+ }));
4507
+ };
4312
4508
  var endSpan = (span, exit, clock, timingEnabled) => sync(() => {
4313
4509
  if (span.status._tag === "Ended")
4314
4510
  return;
@@ -4326,6 +4522,20 @@ var useSpan = (name, ...args) => {
4326
4522
  });
4327
4523
  };
4328
4524
  var provideParentSpan = /* @__PURE__ */ provideService(ParentSpan);
4525
+ var withParentSpan = function() {
4526
+ const dataFirst = isEffect(arguments[0]);
4527
+ const span = dataFirst ? arguments[1] : arguments[0];
4528
+ let options = dataFirst ? arguments[2] : arguments[1];
4529
+ let provideStackFrame = identity;
4530
+ if (span._tag === "Span") {
4531
+ options = addSpanStackTrace(options);
4532
+ provideStackFrame = provideSpanStackFrame(span.name, options?.captureStackTrace);
4533
+ }
4534
+ if (dataFirst) {
4535
+ return provideParentSpan(provideStackFrame(arguments[0]), span);
4536
+ }
4537
+ return (self) => provideParentSpan(provideStackFrame(self), span);
4538
+ };
4329
4539
  var ClockRef = /* @__PURE__ */ Reference("effect/Clock", {
4330
4540
  defaultValue: () => new ClockImpl
4331
4541
  });
@@ -4591,8 +4801,9 @@ var die2 = causeDie;
4591
4801
  var makeFailReason = (error) => new Fail(error);
4592
4802
  var makeDieReason = (defect) => new Die(defect);
4593
4803
  var hasInterruptsOnly2 = hasInterruptsOnly;
4594
- var map4 = causeMap;
4804
+ var map5 = causeMap;
4595
4805
  var squash = causeSquash;
4806
+ var hasInterrupts2 = hasInterrupts;
4596
4807
  var isDone2 = isDone;
4597
4808
  var Done2 = Done;
4598
4809
  var done2 = done;
@@ -4659,6 +4870,7 @@ var doneUnsafe = (self, effect) => {
4659
4870
 
4660
4871
  // node_modules/effect/dist/References.js
4661
4872
  var MinimumLogLevel2 = MinimumLogLevel;
4873
+ var TracerTimingEnabled2 = TracerTimingEnabled;
4662
4874
 
4663
4875
  // node_modules/effect/dist/Scope.js
4664
4876
  var Scope = scopeTag;
@@ -4762,13 +4974,13 @@ class CurrentMemoMap extends (/* @__PURE__ */ Service()("effect/Layer/CurrentMem
4762
4974
  return current ? forkMemoMapUnsafe(current) : makeMemoMapUnsafe();
4763
4975
  }
4764
4976
  }
4765
- var buildWithMemoMap = /* @__PURE__ */ dual(3, (self, memoMap, scope) => provideService(map3(suspend(() => self.build(memoMap, scope)), add(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
4977
+ var buildWithMemoMap = /* @__PURE__ */ dual(3, (self, memoMap, scope) => provideService(map4(suspend(() => self.build(memoMap, scope)), add(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
4766
4978
  var buildWithScope = /* @__PURE__ */ dual(2, (self, scope) => withFiber((fiber) => buildWithMemoMap(self, CurrentMemoMap.forkOrCreate(fiber.context), scope)));
4767
4979
  var succeed5 = function() {
4768
4980
  if (arguments.length === 1) {
4769
- return (resource) => succeedContext(make2(arguments[0], resource));
4981
+ return (resource) => succeedContext(make3(arguments[0], resource));
4770
4982
  }
4771
- return succeedContext(make2(arguments[0], arguments[1]));
4983
+ return succeedContext(make3(arguments[0], arguments[1]));
4772
4984
  };
4773
4985
  var succeedContext = (context) => fromBuildUnsafe(constant(succeed3(context)));
4774
4986
  var effect = function() {
@@ -4777,18 +4989,21 @@ var effect = function() {
4777
4989
  }
4778
4990
  return effectImpl(arguments[0], arguments[1]);
4779
4991
  };
4780
- var effectImpl = (service, effect) => effectContext(map3(effect, (value) => make2(service, value)));
4992
+ var effectImpl = (service, effect) => effectContext(map4(effect, (value) => make3(service, value)));
4781
4993
  var effectContext = (effect) => fromBuildMemo((_, scope) => provide(effect, scope));
4782
4994
  var mergeAllEffect = (layers, memoMap, scope) => {
4783
4995
  const parentScope = forkUnsafe2(scope, "parallel");
4784
4996
  return forEach(layers, (layer) => layer.build(memoMap, forkUnsafe2(parentScope, "sequential")), {
4785
4997
  concurrency: layers.length
4786
- }).pipe(map3((context) => mergeAll(...context)));
4998
+ }).pipe(map4((context) => mergeAll(...context)));
4787
4999
  };
4788
5000
  var mergeAll2 = (...layers) => fromBuildMemo((memoMap, scope) => mergeAllEffect(layers, memoMap, scope));
4789
- var provideWith = (self, that, f) => fromBuildMemo((memoMap, scope) => flatMap2(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), (context) => self.build(memoMap, scope).pipe(provideContext(context), map3((merged) => f(merged, context)))));
5001
+ var provideWith = (self, that, f) => fromBuildMemo((memoMap, scope) => flatMap2(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), (context) => self.build(memoMap, scope).pipe(provideContext(context), map4((merged) => f(merged, context)))));
4790
5002
  var provideMerge = /* @__PURE__ */ dual(2, (self, that) => provideWith(self, that, (self, that) => merge(that, self)));
4791
5003
 
5004
+ // node_modules/effect/dist/Clock.js
5005
+ var Clock = ClockRef;
5006
+
4792
5007
  // node_modules/effect/dist/Number.js
4793
5008
  var Number3 = globalThis.Number;
4794
5009
  var round = /* @__PURE__ */ dual(2, (self, precision) => {
@@ -4839,6 +5054,7 @@ var isEffect2 = isEffect;
4839
5054
  var all2 = all;
4840
5055
  var forEach2 = forEach;
4841
5056
  var whileLoop2 = whileLoop;
5057
+ var promise2 = promise;
4842
5058
  var tryPromise2 = tryPromise;
4843
5059
  var succeed6 = succeed3;
4844
5060
  var suspend2 = suspend;
@@ -4852,14 +5068,15 @@ var failSync2 = failSync;
4852
5068
  var failCause3 = failCause;
4853
5069
  var failCauseSync2 = failCauseSync;
4854
5070
  var die3 = die;
4855
- var try_2 = try_;
5071
+ var try_3 = try_2;
4856
5072
  var withFiber2 = withFiber;
4857
5073
  var fromResult2 = fromResult;
4858
5074
  var flatMap3 = flatMap2;
5075
+ var flatten3 = flatten2;
4859
5076
  var andThen2 = andThen;
4860
5077
  var tap2 = tap;
4861
5078
  var exit2 = exit;
4862
- var map5 = map3;
5079
+ var map6 = map4;
4863
5080
  var as2 = as;
4864
5081
  var asVoid2 = asVoid;
4865
5082
  var zipWith2 = zipWith;
@@ -4886,6 +5103,7 @@ var contextWith2 = contextWith;
4886
5103
  var provide3 = provide2;
4887
5104
  var provideContext2 = provideContext;
4888
5105
  var serviceOption2 = serviceOption;
5106
+ var updateContext2 = updateContext;
4889
5107
  var provideService2 = provideService;
4890
5108
  var scope2 = scope;
4891
5109
  var scoped2 = scoped;
@@ -4898,14 +5116,19 @@ var onExitPrimitive2 = onExitPrimitive;
4898
5116
  var onExit2 = onExit;
4899
5117
  var cached2 = cached;
4900
5118
  var interrupt2 = interrupt;
5119
+ var onInterrupt2 = onInterrupt;
4901
5120
  var uninterruptible2 = uninterruptible;
4902
5121
  var uninterruptibleMask2 = uninterruptibleMask;
4903
5122
  var forever2 = forever;
5123
+ var useSpan2 = useSpan;
5124
+ var withParentSpan2 = withParentSpan;
4904
5125
  var forkChild2 = forkChild;
4905
5126
  var forkIn2 = forkIn;
4906
5127
  var forkScoped2 = forkScoped;
4907
5128
  var runFork2 = runFork;
4908
5129
  var runForkWith2 = runForkWith;
5130
+ var runPromise2 = runPromise;
5131
+ var runSync2 = runSync;
4909
5132
  var runSyncExit2 = runSyncExit;
4910
5133
  var fnUntraced2 = fnUntraced;
4911
5134
  var fn2 = fn;
@@ -5106,7 +5329,7 @@ var binaryUnits = [decimalUnits[0], {
5106
5329
  }];
5107
5330
  var allUnits = [...decimalUnits, .../* @__PURE__ */ binaryUnits.slice(1)];
5108
5331
  var unitsByName = /* @__PURE__ */ new Map(/* @__PURE__ */ allUnits.flatMap((unit) => unit.names.map((name) => [name, unit])));
5109
- var make5 = (value) => value;
5332
+ var make6 = (value) => value;
5110
5333
  var invalid2 = (message) => {
5111
5334
  throw new Error(`Invalid ByteSize: ${message}`);
5112
5335
  };
@@ -5114,7 +5337,7 @@ var fromNumber = (input) => {
5114
5337
  if (!Number.isSafeInteger(input) || input < 0) {
5115
5338
  return invalid2(`expected a non-negative safe integer, received ${input}`);
5116
5339
  }
5117
- return make5(BigInt(input));
5340
+ return make6(BigInt(input));
5118
5341
  };
5119
5342
  var fromStringUnsafe = (input) => {
5120
5343
  const match = /^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(input);
@@ -5129,14 +5352,14 @@ var fromStringUnsafe = (input) => {
5129
5352
  if (numerator % scale !== bigint03) {
5130
5353
  return invalid2(`${JSON.stringify(input)} does not represent an integral number of bytes`);
5131
5354
  }
5132
- return make5(numerator / scale);
5355
+ return make6(numerator / scale);
5133
5356
  };
5134
5357
  var fromInputUnsafe2 = (input) => {
5135
5358
  switch (typeof input) {
5136
5359
  case "bigint":
5137
5360
  if (input < bigint03)
5138
5361
  return invalid2(`expected a non-negative bigint, received ${input}`);
5139
- return make5(input);
5362
+ return make6(input);
5140
5363
  case "number":
5141
5364
  return fromNumber(input);
5142
5365
  case "string":
@@ -5698,7 +5921,7 @@ var isIgnorable = (error) => isMissing(error) || error.reason._tag === "Permissi
5698
5921
  var isNotLink = (error) => isIgnorable(error) || error.reason._tag === "Unknown";
5699
5922
  var DIRECTORY_CONCURRENCY = 16;
5700
5923
  var byName = /* @__PURE__ */ mapInput(String2, (entry) => entry.name);
5701
- var make6 = (fs) => (pattern, options) => walk(fs, compile([pattern], options?.dot ?? false), options);
5924
+ var make7 = (fs) => (pattern, options) => walk(fs, compile([pattern], options?.dot ?? false), options);
5702
5925
  var walk = /* @__PURE__ */ fnUntraced2(function* (fs, compiled, options) {
5703
5926
  if (compiled.initial.size === 0) {
5704
5927
  return [];
@@ -5710,7 +5933,7 @@ var walk = /* @__PURE__ */ fnUntraced2(function* (fs, compiled, options) {
5710
5933
  const isUnlisted = (value) => value === "." || value === ".." || isRoot(value);
5711
5934
  const probe = (parent, name, named) => {
5712
5935
  const path = toFsPath(join3(parent, name));
5713
- return fs.stat(path).pipe(map5((info) => info.type), catchReason2("PlatformError", "NotFound", () => fs.readLink(path).pipe(as2("SymbolicLink"), catchIf2(isNotLink, () => succeed6(undefined)))), catchIf2(named ? isMissing : isIgnorable, () => succeed6(undefined)), map5((type) => type === undefined ? undefined : {
5936
+ return fs.stat(path).pipe(map6((info) => info.type), catchReason2("PlatformError", "NotFound", () => fs.readLink(path).pipe(as2("SymbolicLink"), catchIf2(isNotLink, () => succeed6(undefined)))), catchIf2(named ? isMissing : isIgnorable, () => succeed6(undefined)), map6((type) => type === undefined ? undefined : {
5714
5937
  name,
5715
5938
  type
5716
5939
  }));
@@ -5765,7 +5988,7 @@ var walk = /* @__PURE__ */ fnUntraced2(function* (fs, compiled, options) {
5765
5988
  return child(type === "Directory", false);
5766
5989
  }
5767
5990
  const path = toFsPath(relative);
5768
- return fs.stat(path).pipe(map5((info) => info.type === "Directory"), catchIf2(isIgnorable, () => succeed6(false)), flatMap3((isDirectory) => {
5991
+ return fs.stat(path).pipe(map6((info) => info.type === "Directory"), catchIf2(isIgnorable, () => succeed6(false)), flatMap3((isDirectory) => {
5769
5992
  const resolved = child(isDirectory, type === "SymbolicLink");
5770
5993
  if (type === "SymbolicLink" || resolved?.next === undefined || result.globstar.size === 0) {
5771
5994
  return succeed6(resolved);
@@ -5791,7 +6014,7 @@ var walk = /* @__PURE__ */ fnUntraced2(function* (fs, compiled, options) {
5791
6014
  const child = visit(entry, relative, states, excluded);
5792
6015
  if (isEffect2(child)) {
5793
6016
  const index = children.push(undefined) - 1;
5794
- pending.push(map5(child, (child) => {
6017
+ pending.push(map6(child, (child) => {
5795
6018
  children[index] = child;
5796
6019
  }));
5797
6020
  } else {
@@ -5895,7 +6118,7 @@ var MutableRefProto = {
5895
6118
  };
5896
6119
  }
5897
6120
  };
5898
- var make7 = (value) => {
6121
+ var make8 = (value) => {
5899
6122
  const ref = Object.create(MutableRefProto);
5900
6123
  ref.current = value;
5901
6124
  return ref;
@@ -5903,7 +6126,7 @@ var make7 = (value) => {
5903
6126
 
5904
6127
  // node_modules/effect/dist/MutableList.js
5905
6128
  var Empty = /* @__PURE__ */ Symbol.for("effect/MutableList/Empty");
5906
- var make8 = () => ({
6129
+ var make9 = () => ({
5907
6130
  head: undefined,
5908
6131
  tail: undefined,
5909
6132
  length: 0
@@ -6014,12 +6237,12 @@ var QueueProto = {
6014
6237
  };
6015
6238
  }
6016
6239
  };
6017
- var make9 = (options) => withFiber((fiber) => {
6240
+ var make10 = (options) => withFiber((fiber) => {
6018
6241
  const self = Object.create(QueueProto);
6019
6242
  self.dispatcher = fiber.currentDispatcher;
6020
6243
  self.capacity = options?.capacity ?? Number.POSITIVE_INFINITY;
6021
6244
  self.strategy = options?.strategy ?? "suspend";
6022
- self.messages = make8();
6245
+ self.messages = make9();
6023
6246
  self.scheduleRunning = false;
6024
6247
  self.state = {
6025
6248
  _tag: "Open",
@@ -6029,10 +6252,10 @@ var make9 = (options) => withFiber((fiber) => {
6029
6252
  };
6030
6253
  return succeed3(self);
6031
6254
  });
6032
- var bounded = (capacity) => make9({
6255
+ var bounded = (capacity) => make10({
6033
6256
  capacity
6034
6257
  });
6035
- var sliding = (capacity) => make9({
6258
+ var sliding = (capacity) => make10({
6036
6259
  capacity,
6037
6260
  strategy: "sliding"
6038
6261
  });
@@ -6302,13 +6525,13 @@ var fromTransformBracket = (f) => fromTransform(fnUntraced2(function* (upstream,
6302
6525
  return onError2(pull, onCause);
6303
6526
  }));
6304
6527
  var toTransform = (channel) => channel.transform;
6305
- var asyncQueue = (scope, f, options) => make9({
6528
+ var asyncQueue = (scope, f, options) => make10({
6306
6529
  capacity: options?.bufferSize,
6307
6530
  strategy: options?.strategy
6308
6531
  }).pipe(tap2((queue) => addFinalizer2(scope, shutdown(queue))), tap2((queue) => provide(f(queue), scope).pipe(catchCause2((cause) => failCause4(queue, cause)), forkIn2(scope, {
6309
6532
  startImmediately: true
6310
6533
  }))));
6311
- var callbackArray = (f, options) => fromTransform((_, scope) => map5(asyncQueue(scope, f, options), takeAll2));
6534
+ var callbackArray = (f, options) => fromTransform((_, scope) => map6(asyncQueue(scope, f, options), takeAll2));
6312
6535
  var suspend3 = (evaluate) => fromTransform((upstream, scope) => suspend2(() => toTransform(evaluate())(upstream, scope)));
6313
6536
  var succeed7 = (value) => fromEffect(succeed6(value));
6314
6537
  var empty3 = /* @__PURE__ */ fromPull(/* @__PURE__ */ succeed6(/* @__PURE__ */ done2()));
@@ -6323,6 +6546,35 @@ var fromEffect = (effect) => fromPull(sync2(() => {
6323
6546
  });
6324
6547
  }));
6325
6548
  var fromEffectDrain = (effect) => fromPull(flatMap3(effect, () => done2()));
6549
+ var fromReadableStream = (options) => fromTransform((_, scope) => readableStreamToPullUnsafe({
6550
+ scope,
6551
+ readable: options.evaluate(),
6552
+ onError: options.onError,
6553
+ releaseLockOnEnd: options.releaseLockOnEnd
6554
+ }));
6555
+ var readableStreamToPullUnsafe = (options) => {
6556
+ const reader = options.readable.getReader();
6557
+ const exit = options.exit ?? make8(undefined);
6558
+ const pull = suspend2(() => {
6559
+ if (exit.current)
6560
+ return exit.current;
6561
+ return matchCauseEffect2(tryPromise2({
6562
+ try: () => reader.read(),
6563
+ catch: options.onError
6564
+ }), {
6565
+ onFailure: (cause) => exit.current ?? failCause3(cause),
6566
+ onSuccess: ({
6567
+ done,
6568
+ value
6569
+ }) => {
6570
+ if (exit.current)
6571
+ return exit.current;
6572
+ return done ? done2() : succeed6(of(value));
6573
+ }
6574
+ });
6575
+ });
6576
+ return as2(addFinalizer2(options.scope, options.releaseLockOnEnd ? sync2(() => reader.releaseLock()) : promise2(() => reader.cancel().catch((error) => reader.closed.then(() => Promise.reject(error), constVoid))).pipe(ensuring2(sync2(() => reader.releaseLock())))), pull);
6577
+ };
6326
6578
  var mapDone = /* @__PURE__ */ dual(2, (self, f) => mapDoneEffect(self, (o) => succeed6(f(o))));
6327
6579
  var mapDoneEffect = /* @__PURE__ */ dual(2, (self, f) => transformPull(self, (pull) => succeed6(catchDone(pull, (done) => flatMap3(f(done), done2)))));
6328
6580
  var tapError3 = /* @__PURE__ */ dual(2, (self, f) => transformPull(self, (pull) => succeed6(tapError2(pull, (err) => isDone2(err) ? void_3 : asVoid2(f(err))))));
@@ -6444,7 +6696,7 @@ var decodeText = (encoding, options) => fromTransform((upstream, _scope) => sync
6444
6696
  const streamOptions = {
6445
6697
  stream: true
6446
6698
  };
6447
- let pull = upstream.pipe(map5(map2((bytes) => decoder.decode(bytes, streamOptions))), catchDone((leftover) => {
6699
+ let pull = upstream.pipe(map6(map3((bytes) => decoder.decode(bytes, streamOptions))), catchDone((leftover) => {
6448
6700
  pull = done2(leftover);
6449
6701
  const last = decoder.decode();
6450
6702
  return last.length > 0 ? succeed6(of(last)) : pull;
@@ -6465,6 +6717,11 @@ var unwrap = (channel) => fromTransform((upstream, scope) => {
6465
6717
  return channel.pipe(provide(scope), flatMap3((channel) => toTransform(channel)(upstream, scope)), flatMap3((pull_) => pull = pull_));
6466
6718
  }));
6467
6719
  });
6720
+ var interruptWhen = /* @__PURE__ */ dual(2, (self, effect) => merge2(self, fromPull(succeed6(flatMap3(effect, done2))), {
6721
+ haltStrategy: "either"
6722
+ }));
6723
+ var onExit3 = /* @__PURE__ */ dual(2, (self, finalizer) => fromTransformBracket((upstream, scope, forkedScope) => addFinalizerExit(forkedScope, finalizer).pipe(andThen2(toTransform(self)(upstream, scope)))));
6724
+ var ensuring3 = /* @__PURE__ */ dual(2, (self, finalizer) => onExit3(self, (_) => finalizer));
6468
6725
  var runWith = (self, f, onHalt) => suspend2(() => {
6469
6726
  const scope = makeUnsafe3();
6470
6727
  const makePull = toTransform(self)(done2(), scope);
@@ -6473,6 +6730,31 @@ var runWith = (self, f, onHalt) => suspend2(() => {
6473
6730
  var runDrain = (self) => runWith(self, (pull) => forever2(pull, {
6474
6731
  disableYield: true
6475
6732
  }));
6733
+ var runForEach = /* @__PURE__ */ dual(2, (self, f) => runWith(self, (pull) => forever2(flatMap3(pull, f), {
6734
+ disableYield: true
6735
+ })));
6736
+ var mkUint8Array = (self) => map6(runFold(self, () => ({
6737
+ bytes: 0,
6738
+ arrays: []
6739
+ }), (acc, chunk) => {
6740
+ for (let i = 0;i < chunk.length; i++) {
6741
+ acc.bytes += chunk[i].length;
6742
+ acc.arrays.push(chunk[i]);
6743
+ }
6744
+ return acc;
6745
+ }), ({
6746
+ arrays,
6747
+ bytes
6748
+ }) => {
6749
+ const result = new Uint8Array(bytes);
6750
+ let offset = 0;
6751
+ for (let i = 0;i < arrays.length; i++) {
6752
+ const array = arrays[i];
6753
+ result.set(array, offset);
6754
+ offset += array.length;
6755
+ }
6756
+ return result;
6757
+ });
6476
6758
  var runFold = /* @__PURE__ */ dual(3, (self, initial, f) => suspend2(() => {
6477
6759
  let state = initial();
6478
6760
  return runWith(self, (pull) => whileLoop2({
@@ -6538,7 +6820,7 @@ var forEach3 = (f) => forEachArray(forEach2((_) => f(_), {
6538
6820
  var forEachArray = (f) => fromTransform2((upstream) => upstream.pipe(flatMap3(f), forever2({
6539
6821
  disableYield: true
6540
6822
  }), catchDone(() => endVoid)));
6541
- var unwrap2 = (effect) => fromChannel2(unwrap(map5(effect, toChannel)));
6823
+ var unwrap2 = (effect) => fromChannel2(unwrap(map6(effect, toChannel)));
6542
6824
 
6543
6825
  // node_modules/effect/dist/internal/rcRef.js
6544
6826
  var TypeId13 = "~effect/RcRef";
@@ -6570,7 +6852,7 @@ class RcRefImpl {
6570
6852
  this.idleTimeToLive = idleTimeToLive;
6571
6853
  }
6572
6854
  }
6573
- var make10 = (options) => withFiber2((fiber) => {
6855
+ var make11 = (options) => withFiber2((fiber) => {
6574
6856
  const context = fiber.context;
6575
6857
  const scope = get(context, Scope);
6576
6858
  const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== undefined ? fromInputUnsafe(options.idleTimeToLive) : undefined);
@@ -6679,7 +6961,7 @@ var release = (self, state) => {
6679
6961
  };
6680
6962
 
6681
6963
  // node_modules/effect/dist/RcRef.js
6682
- var make11 = make10;
6964
+ var make12 = make11;
6683
6965
  var get3 = get2;
6684
6966
 
6685
6967
  // node_modules/effect/dist/Stream.js
@@ -6691,7 +6973,7 @@ var transformPull2 = (self, f) => fromChannel3(fromTransform((_, scope) => flatM
6691
6973
  var toChannel2 = (stream) => stream.channel;
6692
6974
  var callback3 = (f, options) => fromChannel3(callbackArray(f, options));
6693
6975
  var empty4 = /* @__PURE__ */ fromChannel3(empty3);
6694
- var make12 = (...values) => fromArray2(values);
6976
+ var make13 = (...values) => fromArray2(values);
6695
6977
  var suspend4 = (stream) => {
6696
6978
  const suspended = fromChannel3(suspend3(() => stream().channel));
6697
6979
  suspendedStreams.set(suspended, stream);
@@ -6700,7 +6982,8 @@ var suspend4 = (stream) => {
6700
6982
  var suspendedStreams = /* @__PURE__ */ new WeakMap;
6701
6983
  var fail9 = (error) => fromChannel3(fail8(error));
6702
6984
  var fromArray2 = (array) => isReadonlyArrayNonEmpty(array) ? fromChannel3(succeed7(array)) : empty4;
6703
- var unwrap3 = (effect) => fromChannel3(unwrap(map5(effect, toChannel2)));
6985
+ var fromReadableStream2 = (options) => fromChannel3(fromReadableStream(options));
6986
+ var unwrap3 = (effect) => fromChannel3(unwrap(map6(effect, toChannel2)));
6704
6987
  var drainFork = /* @__PURE__ */ dual(2, (self, that) => mergeEffect2(self, runDrain2(that)));
6705
6988
  var merge3 = /* @__PURE__ */ dual((args) => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel3(merge2(toChannel2(self), toChannel2(that), options)));
6706
6989
  var mergeEffect2 = /* @__PURE__ */ dual(2, (self, effect) => self.channel.pipe(mergeEffect(effect), fromChannel3));
@@ -6719,7 +7002,7 @@ var transduce = /* @__PURE__ */ dual(2, (self, sink) => transformPull2(self, (up
6719
7002
  done = fail5(error);
6720
7003
  return done2();
6721
7004
  }));
6722
- const pull = map5(suspend2(() => sink.transform(upstreamWithLeftover, scope)), ([value, leftover_]) => {
7005
+ const pull = map6(suspend2(() => sink.transform(upstreamWithLeftover, scope)), ([value, leftover_]) => {
6723
7006
  leftover = leftover_;
6724
7007
  return of(value);
6725
7008
  });
@@ -6727,7 +7010,9 @@ var transduce = /* @__PURE__ */ dual(2, (self, sink) => transformPull2(self, (up
6727
7010
  })));
6728
7011
  var decodeText2 = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, options) => self.channel.pipe(pipeTo(decodeText(options?.encoding)), fromChannel3));
6729
7012
  var splitLines2 = (self) => self.channel.pipe(pipeTo(splitLines()), fromChannel3);
6730
- var run = /* @__PURE__ */ dual(2, (self, sink) => scopedWith2((scope) => toPullScoped(self.channel, scope).pipe(flatMap3((upstream) => runSink(sink, upstream, scope)), map5(([a]) => a))));
7013
+ var interruptWhen2 = /* @__PURE__ */ dual(2, (self, effect) => fromChannel3(interruptWhen(self.channel, effect)));
7014
+ var ensuring4 = /* @__PURE__ */ dual(2, (self, finalizer) => fromChannel3(ensuring3(self.channel, finalizer)));
7015
+ var run = /* @__PURE__ */ dual(2, (self, sink) => scopedWith2((scope) => toPullScoped(self.channel, scope).pipe(flatMap3((upstream) => runSink(sink, upstream, scope)), map6(([a]) => a))));
6731
7016
  var runSink = (sink, upstream, scope) => restoreUpstreamFailure(sink.transform(upstreamFailureToDefect(upstream), scope));
6732
7017
  var runCollect = (self) => runFold(self.channel, () => [], (acc, chunk) => {
6733
7018
  for (let i = 0;i < chunk.length; i++) {
@@ -6737,16 +7022,68 @@ var runCollect = (self) => runFold(self.channel, () => [], (acc, chunk) => {
6737
7022
  });
6738
7023
  var runDrain2 = (self) => runDrain(self.channel);
6739
7024
  var mkString = (self) => runFold(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
7025
+ var mkArrayBuffer = (self) => map6(mkUint8Array(self.channel), (bytes) => bytes.buffer);
7026
+ var toReadableStreamWith = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, context, options) => {
7027
+ let currentResolve = undefined;
7028
+ let fiber = undefined;
7029
+ let cancelled = false;
7030
+ const latch = makeUnsafe4(false);
7031
+ const signal = options?.signal;
7032
+ const onAbort = () => fiber.interruptUnsafe();
7033
+ return new ReadableStream({
7034
+ start(controller) {
7035
+ fiber = runFork2(provideContext2(runForEach(transformPull(self.channel, (pull) => succeed6(latch.whenOpen(pull))), (chunk) => sync2(() => {
7036
+ latch.closeUnsafe();
7037
+ for (let i = 0;i < chunk.length; i++) {
7038
+ controller.enqueue(chunk[i]);
7039
+ }
7040
+ currentResolve();
7041
+ currentResolve = undefined;
7042
+ })), context));
7043
+ fiber.addObserver((exit) => {
7044
+ signal?.removeEventListener("abort", onAbort);
7045
+ if (cancelled)
7046
+ return;
7047
+ if (exit._tag === "Failure" && signal?.aborted !== true) {
7048
+ controller.error(squash(exit.cause));
7049
+ } else {
7050
+ controller.close();
7051
+ }
7052
+ });
7053
+ if (signal !== undefined && fiber.pollUnsafe() === undefined) {
7054
+ if (signal.aborted)
7055
+ onAbort();
7056
+ else
7057
+ signal.addEventListener("abort", onAbort, {
7058
+ once: true
7059
+ });
7060
+ }
7061
+ },
7062
+ pull() {
7063
+ return new Promise((resolve) => {
7064
+ currentResolve = resolve;
7065
+ latch.openUnsafe();
7066
+ });
7067
+ },
7068
+ cancel() {
7069
+ if (!fiber)
7070
+ return;
7071
+ cancelled = true;
7072
+ return runPromise2(asVoid2(interrupt3(fiber)));
7073
+ }
7074
+ }, options?.strategy);
7075
+ });
7076
+ var toReadableStreamEffect = /* @__PURE__ */ dual((args) => isStream(args[0]), (self, options) => map6(context2(), (context) => toReadableStreamWith(self, context, options)));
6740
7077
 
6741
7078
  // node_modules/effect/dist/FileSystem.js
6742
7079
  var TypeId15 = "~effect/FileSystem";
6743
7080
  var FileSystem = /* @__PURE__ */ Service("effect/FileSystem");
6744
- var make13 = (impl) => FileSystem.of({
7081
+ var make14 = (impl) => FileSystem.of({
6745
7082
  ...impl,
6746
7083
  [TypeId15]: TypeId15,
6747
- glob: make6(impl),
7084
+ glob: make7(impl),
6748
7085
  exists: (path) => pipe(impl.access(path), as2(true), catchTag2("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed6(false) : fail7(e))),
6749
- readFileString: (path, encoding) => flatMap3(impl.readFile(path), (_) => try_2({
7086
+ readFileString: (path, encoding) => flatMap3(impl.readFile(path), (_) => try_3({
6750
7087
  try: () => new TextDecoder(encoding).decode(_),
6751
7088
  catch: (cause) => badArgument({
6752
7089
  module: "FileSystem",
@@ -6783,8 +7120,8 @@ var make13 = (impl) => FileSystem.of({
6783
7120
  sink: (path, options) => pipe(impl.open(path, {
6784
7121
  ...options,
6785
7122
  flag: options?.flag ?? "w"
6786
- }), map5((file) => forEach3((_) => file.writeAll(_))), unwrap2),
6787
- writeFileString: (path, data, options) => flatMap3(try_2({
7123
+ }), map6((file) => forEach3((_) => file.writeAll(_))), unwrap2),
7124
+ writeFileString: (path, data, options) => flatMap3(try_3({
6788
7125
  try: () => new TextEncoder().encode(data),
6789
7126
  catch: (cause) => badArgument({
6790
7127
  module: "FileSystem",
@@ -6801,7 +7138,7 @@ class WatchBackend extends (/* @__PURE__ */ Service()("effect/FileSystem/WatchBa
6801
7138
  // node_modules/effect/dist/Path.js
6802
7139
  var TypeId16 = "~effect/Path";
6803
7140
  var Path = /* @__PURE__ */ Service("effect/Path");
6804
- var make14 = (impl) => Path.of({
7141
+ var make15 = (impl) => Path.of({
6805
7142
  ...impl,
6806
7143
  [TypeId16]: TypeId16,
6807
7144
  resolveWithin(root, input) {
@@ -6973,7 +7310,7 @@ function normalizeFilterOutput(ast, out, input, options) {
6973
7310
  if (!isReadonlyArrayNonEmpty(out)) {
6974
7311
  return;
6975
7312
  }
6976
- return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, map2(out, (entry) => makeFilterIssue(entry, input, options)), input, options);
7313
+ return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, map3(out, (entry) => makeFilterIssue(entry, input, options)), input, options);
6977
7314
  }
6978
7315
  return makeSingle(out, input, options);
6979
7316
  }
@@ -7737,7 +8074,7 @@ var wrapPropertyKeyIssue = (s, ast, key, exit) => {
7737
8074
  }
7738
8075
  const issue = getSchemaIssue(exit.cause);
7739
8076
  if (issue === undefined) {
7740
- return failCause2(map4(exit.cause, (issue) => new Composite(ast, [new Pointer([key], issue)], s.input, s.options)));
8077
+ return failCause2(map5(exit.cause, (issue) => new Composite(ast, [new Pointer([key], issue)], s.input, s.options)));
7741
8078
  }
7742
8079
  const pointer = new Pointer([key], issue);
7743
8080
  if (s.options.errors === "all") {
@@ -9078,8 +9415,8 @@ var HandleProto = {
9078
9415
  var makeHandle = (params) => Object.setPrototypeOf({
9079
9416
  ...params
9080
9417
  }, HandleProto);
9081
- var make15 = (spawn) => {
9082
- const streamString = (command, options) => spawn(command).pipe(map5((handle) => decodeText2(options?.includeStderr === true ? handle.all : drainFork(handle.stdout, handle.stderr))), unwrap3);
9418
+ var make16 = (spawn) => {
9419
+ const streamString = (command, options) => spawn(command).pipe(map6((handle) => decodeText2(options?.includeStderr === true ? handle.all : drainFork(handle.stdout, handle.stderr))), unwrap3);
9083
9420
  const streamLines = (command, options) => splitLines2(streamString(command, options));
9084
9421
  return ChildProcessSpawner.of({
9085
9422
  spawn,
@@ -9107,7 +9444,7 @@ var value = (self) => {
9107
9444
  // node_modules/effect/dist/Redacted.js
9108
9445
  var TypeId20 = "~effect/Redacted";
9109
9446
  var isRedacted = (u) => hasProperty(u, TypeId20);
9110
- var make16 = (value, options) => {
9447
+ var make17 = (value, options) => {
9111
9448
  const self = Object.create(Proto2);
9112
9449
  if (options?.label) {
9113
9450
  self.label = options.label;
@@ -9251,7 +9588,7 @@ var parseTemplate = (texts, values) => {
9251
9588
  if (word.length === 0)
9252
9589
  return;
9253
9590
  const value = word.map(unwrap4).join("");
9254
- words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make16(value) : value);
9591
+ words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make17(value) : value);
9255
9592
  word = [];
9256
9593
  plain = true;
9257
9594
  braceDepth = 0;
@@ -9357,7 +9694,7 @@ var makeStandardCommand = (command, args, options) => Object.assign(Object.creat
9357
9694
  args,
9358
9695
  options
9359
9696
  });
9360
- var make17 = function make(...args) {
9697
+ var make18 = function make(...args) {
9361
9698
  if (isTemplateString(args[0])) {
9362
9699
  const [templates, ...expressions] = args;
9363
9700
  const [command, cmdArgs] = parseTemplate2(templates, expressions);
@@ -9624,7 +9961,7 @@ var readableToPullUnsafe = (options) => {
9624
9961
  const readable = options.readable;
9625
9962
  const chunkSize = options.chunkSize ?? 4096;
9626
9963
  const closeOnDone = options.closeOnDone ?? true;
9627
- const exit = options.exit ?? make7(undefined);
9964
+ const exit = options.exit ?? make8(undefined);
9628
9965
  const latch = options.latch ?? makeUnsafe4(false);
9629
9966
  function onReadable() {
9630
9967
  latch.openUnsafe();
@@ -9728,7 +10065,7 @@ var taskkill = (childProcess, onExit = () => {}) => {
9728
10065
  windowsHide: true
9729
10066
  }, onExit);
9730
10067
  };
9731
- var make18 = /* @__PURE__ */ gen2(function* () {
10068
+ var make19 = /* @__PURE__ */ gen2(function* () {
9732
10069
  const fs = yield* FileSystem;
9733
10070
  const path = yield* Path;
9734
10071
  const resolveWorkingDirectory = fnUntraced2(function* (options) {
@@ -9855,7 +10192,7 @@ var make18 = /* @__PURE__ */ gen2(function* () {
9855
10192
  });
9856
10193
  }
9857
10194
  if (stream) {
9858
- return map5(runInputStream(stream, sink, inputFailure), () => {
10195
+ return map6(runInputStream(stream, sink, inputFailure), () => {
9859
10196
  inputSinks.set(fd, sink);
9860
10197
  });
9861
10198
  }
@@ -9993,7 +10330,7 @@ var make18 = /* @__PURE__ */ gen2(function* () {
9993
10330
  });
9994
10331
  });
9995
10332
  }
9996
- return try_2({
10333
+ return try_3({
9997
10334
  try: () => {
9998
10335
  globalThis.process.kill(-childProcess.pid, signal);
9999
10336
  },
@@ -10148,7 +10485,7 @@ var make18 = /* @__PURE__ */ gen2(function* () {
10148
10485
  getInputFd,
10149
10486
  getOutputFd
10150
10487
  } = yield* setupAdditionalFds(cmd, childProcess, resolvedAdditionalFds, inputFailure);
10151
- const isRunning = map5(isDone3(exitSignal), (done) => !done);
10488
+ const isRunning = map6(isDone3(exitSignal), (done) => !done);
10152
10489
  const exitCode = flatMap3(raceFirst2(_await(exitSignal), _await(inputFailure)), ([code, signal]) => {
10153
10490
  if (isDoneUnsafe(inputFailure)) {
10154
10491
  return _await(inputFailure);
@@ -10188,7 +10525,7 @@ var make18 = /* @__PURE__ */ gen2(function* () {
10188
10525
  const sourceStream = unwrap3(succeed6(getSourceStream(handles[handles.length - 1], options.from)));
10189
10526
  const toOption = options.to ?? "stdin";
10190
10527
  if (toOption === "stdin") {
10191
- handles.push(yield* spawnCommand(make17(command.command, command.args, {
10528
+ handles.push(yield* spawnCommand(make18(command.command, command.args, {
10192
10529
  ...command.options,
10193
10530
  stdin: {
10194
10531
  ...stdinConfig,
@@ -10208,7 +10545,7 @@ var make18 = /* @__PURE__ */ gen2(function* () {
10208
10545
  type: "input",
10209
10546
  stream: sourceStream
10210
10547
  };
10211
- handles.push(yield* spawnCommand(make17(command.command, command.args, {
10548
+ handles.push(yield* spawnCommand(make18(command.command, command.args, {
10212
10549
  ...command.options,
10213
10550
  additionalFds: {
10214
10551
  ...existingFds,
@@ -10216,7 +10553,7 @@ var make18 = /* @__PURE__ */ gen2(function* () {
10216
10553
  }
10217
10554
  })));
10218
10555
  } else {
10219
- handles.push(yield* spawnCommand(make17(command.command, command.args, {
10556
+ handles.push(yield* spawnCommand(make18(command.command, command.args, {
10220
10557
  ...command.options,
10221
10558
  stdin: {
10222
10559
  ...stdinConfig,
@@ -10255,9 +10592,9 @@ var make18 = /* @__PURE__ */ gen2(function* () {
10255
10592
  }
10256
10593
  }
10257
10594
  });
10258
- return make15(spawnCommand);
10595
+ return make16(spawnCommand);
10259
10596
  });
10260
- var layer = /* @__PURE__ */ effect(ChildProcessSpawner, make18);
10597
+ var layer = /* @__PURE__ */ effect(ChildProcessSpawner, make19);
10261
10598
  var flattenCommand = (command) => {
10262
10599
  const commands = [];
10263
10600
  const pipeOptions = [];
@@ -10307,7 +10644,7 @@ var bigintToNumber = (value, field) => {
10307
10644
  var bigintToNumberOption = (value) => flatMap(fromNullishOr(value), toNumber);
10308
10645
  var toUint64 = (value) => BigInt.asUintN(64, value);
10309
10646
  var toUint64Option = (value) => map(fromNullishOr(value), toUint64);
10310
- var positionToNumber = (position, method) => try_2({
10647
+ var positionToNumber = (position, method) => try_3({
10311
10648
  try: () => bigintToNumber(position, "position"),
10312
10649
  catch: handleBadArgument(method)
10313
10650
  });
@@ -10429,7 +10766,7 @@ var noFollowFlags = (method, flag) => suspend2(() => {
10429
10766
  var openFactory = (method) => {
10430
10767
  const nodeOpen = effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
10431
10768
  const nodeClose = effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
10432
- return (path, options) => pipe(acquireRelease2(options?.noFollow === true ? flatMap3(noFollowFlags(method, options.flag ?? "r"), (flags) => nodeOpen(path, flags, options.mode)) : nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => orDie2(nodeClose(fd))), map5((fd) => makeFile(fd, options?.flag?.startsWith("a") ?? false)));
10769
+ return (path, options) => pipe(acquireRelease2(options?.noFollow === true ? flatMap3(noFollowFlags(method, options.flag ?? "r"), (flags) => nodeOpen(path, flags, options.mode)) : nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => orDie2(nodeClose(fd))), map6((fd) => makeFile(fd, options?.flag?.startsWith("a") ?? false)));
10433
10770
  };
10434
10771
  var open2 = /* @__PURE__ */ openFactory("open");
10435
10772
  var negativePosition = (method) => badArgument({
@@ -10490,7 +10827,7 @@ var makeFile = /* @__PURE__ */ (() => {
10490
10827
  });
10491
10828
  }
10492
10829
  const position = this.position;
10493
- return map5(nodeRead(this.fd, {
10830
+ return map6(nodeRead(this.fd, {
10494
10831
  buffer,
10495
10832
  position
10496
10833
  }), (bytesRead) => {
@@ -10511,7 +10848,7 @@ var makeFile = /* @__PURE__ */ (() => {
10511
10848
  }
10512
10849
  const buffer = Buffer.allocUnsafeSlow(size);
10513
10850
  const position = explicit ?? this.position;
10514
- return map5(nodeReadAlloc(this.fd, {
10851
+ return map6(nodeReadAlloc(this.fd, {
10515
10852
  buffer,
10516
10853
  position
10517
10854
  }), (bytesRead) => {
@@ -10534,7 +10871,7 @@ var makeFile = /* @__PURE__ */ (() => {
10534
10871
  });
10535
10872
  }
10536
10873
  truncate(length) {
10537
- return map5(nodeTruncate(this.fd, length || undefined), () => {
10874
+ return map6(nodeTruncate(this.fd, length || undefined), () => {
10538
10875
  if (!this.append) {
10539
10876
  const len = BigInt(length ?? 0);
10540
10877
  if (this.position > len) {
@@ -10546,7 +10883,7 @@ var makeFile = /* @__PURE__ */ (() => {
10546
10883
  write(buffer) {
10547
10884
  return suspend2(() => {
10548
10885
  const position = this.position;
10549
- return flatMap3(this.append ? succeed6(undefined) : positionToNumber(position, "write"), (nodePosition) => map5(nodeWrite(this.fd, buffer, undefined, undefined, nodePosition), (bytesWritten) => {
10886
+ return flatMap3(this.append ? succeed6(undefined) : positionToNumber(position, "write"), (nodePosition) => map6(nodeWrite(this.fd, buffer, undefined, undefined, nodePosition), (bytesWritten) => {
10550
10887
  if (!this.append) {
10551
10888
  this.position = position + BigInt(bytesWritten);
10552
10889
  }
@@ -10608,7 +10945,7 @@ var readDirectoryEntries = (path) => tryPromise2({
10608
10945
  withFileTypes: true
10609
10946
  }),
10610
10947
  catch: (err) => handleErrnoException("FileSystem", "readDirectoryEntries")(err, [path])
10611
- }).pipe(map5((entries) => entries.map((entry) => ({
10948
+ }).pipe(map6((entries) => entries.map((entry) => ({
10612
10949
  name: entry.name,
10613
10950
  type: fileType(entry)
10614
10951
  }))));
@@ -10640,7 +10977,7 @@ var rename2 = /* @__PURE__ */ (() => {
10640
10977
  return (oldPath, newPath) => nodeRename(oldPath, newPath);
10641
10978
  })();
10642
10979
  var fileType = (stat) => stat.isFile() ? "File" : stat.isDirectory() ? "Directory" : stat.isSymbolicLink() ? "SymbolicLink" : stat.isBlockDevice() ? "BlockDevice" : stat.isCharacterDevice() ? "CharacterDevice" : stat.isFIFO() ? "FIFO" : stat.isSocket() ? "Socket" : "Unknown";
10643
- var makeFileInfo = (stat, method = "stat") => try_2({
10980
+ var makeFileInfo = (stat, method = "stat") => try_3({
10644
10981
  try: () => ({
10645
10982
  type: fileType(stat),
10646
10983
  mtime: fromNullishOr(stat.mtime),
@@ -10723,7 +11060,7 @@ var watchNode = (path, info, options) => callback3((queue) => acquireRelease2(sy
10723
11060
  });
10724
11061
  return watcher;
10725
11062
  }), (watcher) => sync2(() => watcher.close())).pipe(tap2(() => sync2(() => options?.onReady?.()))));
10726
- var watch2 = (backend, path, options) => all2([stat2(path), serviceOption2(WatchBackend)]).pipe(map5(([stat, callerBackend]) => orElse(callerBackend, () => backend).pipe(flatMap((_) => _.register(path, stat, options)), getOrElse(() => watchNode(path, stat, options)))), unwrap3);
11063
+ var watch2 = (backend, path, options) => all2([stat2(path), serviceOption2(WatchBackend)]).pipe(map6(([stat, callerBackend]) => orElse(callerBackend, () => backend).pipe(flatMap((_) => _.register(path, stat, options)), getOrElse(() => watchNode(path, stat, options)))), unwrap3);
10727
11064
  var writeFile2 = (path, data, options) => callback2((resume, signal) => {
10728
11065
  try {
10729
11066
  NFS.writeFile(path, data, {
@@ -10741,7 +11078,7 @@ var writeFile2 = (path, data, options) => callback2((resume, signal) => {
10741
11078
  resume(fail7(handleBadArgument("writeFile")(err)));
10742
11079
  }
10743
11080
  });
10744
- var makeFileSystem = /* @__PURE__ */ map5(/* @__PURE__ */ serviceOption2(WatchBackend), (backend) => make13({
11081
+ var makeFileSystem = /* @__PURE__ */ map6(/* @__PURE__ */ serviceOption2(WatchBackend), (backend) => make14({
10745
11082
  access: access2,
10746
11083
  chmod: chmod2,
10747
11084
  chown: chown2,
@@ -10780,7 +11117,7 @@ var layer3 = layer2;
10780
11117
  import * as NodePath from "path";
10781
11118
  import * as NodeUrl from "url";
10782
11119
  var fileUrlOps = (windows) => ({
10783
- fromFileUrl: (url) => try_2({
11120
+ fromFileUrl: (url) => try_3({
10784
11121
  try: () => NodeUrl.fileURLToPath(url, {
10785
11122
  windows
10786
11123
  }),
@@ -10790,7 +11127,7 @@ var fileUrlOps = (windows) => ({
10790
11127
  cause
10791
11128
  })
10792
11129
  }),
10793
- toFileUrl: (path) => try_2({
11130
+ toFileUrl: (path) => try_3({
10794
11131
  try: () => NodeUrl.pathToFileURL(path, {
10795
11132
  windows
10796
11133
  }),
@@ -10801,15 +11138,15 @@ var fileUrlOps = (windows) => ({
10801
11138
  })
10802
11139
  })
10803
11140
  });
10804
- var layerPosix = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make14({
11141
+ var layerPosix = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make15({
10805
11142
  ...NodePath.posix,
10806
11143
  .../* @__PURE__ */ fileUrlOps(false)
10807
11144
  }));
10808
- var layerWin32 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make14({
11145
+ var layerWin32 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make15({
10809
11146
  ...NodePath.win32,
10810
11147
  .../* @__PURE__ */ fileUrlOps(true)
10811
11148
  }));
10812
- var layer4 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make14({
11149
+ var layer4 = /* @__PURE__ */ succeed5(Path)(/* @__PURE__ */ make15({
10813
11150
  ...NodePath,
10814
11151
  .../* @__PURE__ */ fileUrlOps(undefined)
10815
11152
  }));
@@ -10820,7 +11157,7 @@ var layer5 = layer4;
10820
11157
  // node_modules/effect/dist/Stdio.js
10821
11158
  var TypeId22 = "~effect/Stdio";
10822
11159
  var Stdio = /* @__PURE__ */ Service(TypeId22);
10823
- var make19 = (options) => ({
11160
+ var make20 = (options) => ({
10824
11161
  [TypeId22]: TypeId22,
10825
11162
  stdinIsTerminal: succeed6(false),
10826
11163
  stdoutIsTerminal: succeed6(false),
@@ -10829,7 +11166,7 @@ var make19 = (options) => ({
10829
11166
  });
10830
11167
 
10831
11168
  // node_modules/@effect/platform-node-shared/dist/NodeStdio.js
10832
- var layer6 = /* @__PURE__ */ succeed5(Stdio, /* @__PURE__ */ make19({
11169
+ var layer6 = /* @__PURE__ */ succeed5(Stdio, /* @__PURE__ */ make20({
10833
11170
  args: /* @__PURE__ */ sync2(() => process.argv.slice(2)),
10834
11171
  stdinIsTerminal: /* @__PURE__ */ sync2(() => process.stdin.isTTY === true),
10835
11172
  stdoutIsTerminal: /* @__PURE__ */ sync2(() => process.stdout.isTTY === true),
@@ -10869,45 +11206,497 @@ var layer6 = /* @__PURE__ */ succeed5(Stdio, /* @__PURE__ */ make19({
10869
11206
  // node_modules/@effect/platform-bun/dist/BunStdio.js
10870
11207
  var layer7 = layer6;
10871
11208
 
10872
- // node_modules/effect/dist/internal/schema/interpreter.js
10873
- var flatMapTransformation = (result, current, f) => result === sameExit ? f(current) : flatMapEager2(result, f);
10874
- function compileTransformation(transformation) {
10875
- const apply = compileTransformationUnsafe(transformation);
10876
- return (result, current, options) => {
10877
- try {
10878
- return apply(result, current, options);
10879
- } catch (error) {
10880
- return die3(error);
11209
+ // node_modules/effect/dist/http/Cookies.js
11210
+ var TypeId23 = "~effect/http/Cookies";
11211
+ var CookieTypeId = "~effect/http/Cookies/Cookie";
11212
+ var Proto4 = {
11213
+ [TypeId23]: TypeId23,
11214
+ ...BaseProto,
11215
+ toJSON() {
11216
+ return {
11217
+ _id: "effect/Cookies",
11218
+ cookies: map2(this.cookies, (cookie) => cookie.toJSON())
11219
+ };
11220
+ },
11221
+ pipe() {
11222
+ return pipeArguments(this, arguments);
11223
+ }
11224
+ };
11225
+ var fromReadonlyRecord = (cookies) => {
11226
+ const self = Object.create(Proto4);
11227
+ self.cookies = cookies;
11228
+ return self;
11229
+ };
11230
+ var fromIterable2 = (cookies) => {
11231
+ const record = {};
11232
+ for (const cookie of cookies) {
11233
+ assignProperty(record, cookie.name, cookie);
11234
+ }
11235
+ return fromReadonlyRecord(record);
11236
+ };
11237
+ var fromSetCookie = (headers) => {
11238
+ const arrayHeaders = typeof headers === "string" ? [headers] : headers;
11239
+ const cookies = [];
11240
+ for (const header of arrayHeaders) {
11241
+ const cookie = parseSetCookie(header.trim());
11242
+ if (cookie) {
11243
+ cookies.push(cookie);
10881
11244
  }
10882
- };
11245
+ }
11246
+ return fromIterable2(cookies);
11247
+ };
11248
+ function parseSetCookie(header) {
11249
+ const parts = header.split(";").map((_) => _.trim()).filter((_) => _ !== "");
11250
+ if (parts.length === 0) {
11251
+ return;
11252
+ }
11253
+ const firstEqual = parts[0].indexOf("=");
11254
+ if (firstEqual === -1) {
11255
+ return;
11256
+ }
11257
+ const name = parts[0].slice(0, firstEqual).replace(cookieWhitespaceRegExp, "");
11258
+ if (!cookieNameRegExp.test(name)) {
11259
+ return;
11260
+ }
11261
+ const valueEncoded = parts[0].slice(firstEqual + 1).replace(cookieWhitespaceRegExp, "");
11262
+ const value = tryDecodeURIComponent(valueEncoded);
11263
+ if (parts.length === 1) {
11264
+ return Object.assign(Object.create(CookieProto), {
11265
+ name,
11266
+ value,
11267
+ valueEncoded
11268
+ });
11269
+ }
11270
+ const options = {};
11271
+ for (let i = 1;i < parts.length; i++) {
11272
+ const part = parts[i];
11273
+ const equalIndex = part.indexOf("=");
11274
+ const key = equalIndex === -1 ? part : part.slice(0, equalIndex).trim();
11275
+ const value = equalIndex === -1 ? undefined : part.slice(equalIndex + 1).trim();
11276
+ switch (key.toLowerCase()) {
11277
+ case "domain": {
11278
+ if (value === undefined) {
11279
+ break;
11280
+ }
11281
+ const domain = value.trim().replace(/^\./, "");
11282
+ if (domain) {
11283
+ options.domain = domain;
11284
+ }
11285
+ break;
11286
+ }
11287
+ case "expires": {
11288
+ if (value === undefined) {
11289
+ break;
11290
+ }
11291
+ const date = new Date(value);
11292
+ if (!isNaN(date.getTime())) {
11293
+ options.expires = date;
11294
+ }
11295
+ break;
11296
+ }
11297
+ case "max-age": {
11298
+ if (value === undefined || !maxAgeRegExp.test(value)) {
11299
+ break;
11300
+ }
11301
+ options.maxAge = seconds(parseInt(value, 10));
11302
+ break;
11303
+ }
11304
+ case "path": {
11305
+ if (value === undefined) {
11306
+ break;
11307
+ }
11308
+ if (value[0] === "/") {
11309
+ options.path = value;
11310
+ }
11311
+ break;
11312
+ }
11313
+ case "priority": {
11314
+ if (value === undefined) {
11315
+ break;
11316
+ }
11317
+ switch (value.toLowerCase()) {
11318
+ case "low":
11319
+ options.priority = "low";
11320
+ break;
11321
+ case "medium":
11322
+ options.priority = "medium";
11323
+ break;
11324
+ case "high":
11325
+ options.priority = "high";
11326
+ break;
11327
+ }
11328
+ break;
11329
+ }
11330
+ case "httponly": {
11331
+ options.httpOnly = true;
11332
+ break;
11333
+ }
11334
+ case "secure": {
11335
+ options.secure = true;
11336
+ break;
11337
+ }
11338
+ case "partitioned": {
11339
+ options.partitioned = true;
11340
+ break;
11341
+ }
11342
+ case "samesite": {
11343
+ if (value === undefined) {
11344
+ break;
11345
+ }
11346
+ switch (value.toLowerCase()) {
11347
+ case "lax":
11348
+ options.sameSite = "lax";
11349
+ break;
11350
+ case "strict":
11351
+ options.sameSite = "strict";
11352
+ break;
11353
+ case "none":
11354
+ options.sameSite = "none";
11355
+ break;
11356
+ }
11357
+ break;
11358
+ }
11359
+ }
11360
+ }
11361
+ return Object.assign(Object.create(CookieProto), {
11362
+ name,
11363
+ value,
11364
+ valueEncoded,
11365
+ options: Object.keys(options).length > 0 ? options : undefined
11366
+ });
10883
11367
  }
10884
- function compileTransformationUnsafe(transformation) {
10885
- if (transformation._tag === "Middleware") {
10886
- return (result, current, options) => {
10887
- const transformed = result === sameExit ? transformation.decode(succeed8(toOption(current)), options) : transformation.decode(mapEager2(result, toOption), options);
10888
- return fromOptionalEffect(transformed);
11368
+ var cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
11369
+ var cookieWhitespaceRegExp = /^[\t ]+|[\t ]+$/g;
11370
+ var maxAgeRegExp = /^-?[0-9]+$/;
11371
+ var CookieProto = {
11372
+ [CookieTypeId]: CookieTypeId,
11373
+ ...BaseProto,
11374
+ toJSON() {
11375
+ return {
11376
+ _id: "effect/Cookies/Cookie",
11377
+ name: this.name,
11378
+ value: this.value,
11379
+ options: this.options
10889
11380
  };
10890
11381
  }
10891
- const getter = transformation.decode;
10892
- switch (getter._tag) {
10893
- case "Passthrough":
10894
- return (result, current) => result === sameExit ? succeed8(current) : result;
10895
- case "Transform": {
10896
- const transform = (value) => value === missing ? missingExit : succeed8(getter.transform(value));
10897
- return (result, current) => flatMapTransformation(result, current, transform);
11382
+ };
11383
+ var tryDecodeURIComponent = (str) => {
11384
+ try {
11385
+ return decodeURIComponent(str);
11386
+ } catch (_) {
11387
+ return str;
11388
+ }
11389
+ };
11390
+
11391
+ // node_modules/effect/dist/http/Headers.js
11392
+ var TypeId24 = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
11393
+ var Proto5 = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.create(null), {
11394
+ [TypeId24]: {
11395
+ value: TypeId24
11396
+ },
11397
+ [symbolRedactable]: {
11398
+ value(context) {
11399
+ return redact2(this, get(context, CurrentRedactedNames));
10898
11400
  }
10899
- case "TransformOptional": {
10900
- const transform = (value) => fromOptionExit(getter.transform(toOption(value)));
10901
- return (result, current) => flatMapTransformation(result, current, transform);
11401
+ },
11402
+ toJSON: {
11403
+ value() {
11404
+ return redact(this);
10902
11405
  }
10903
- case "TransformEffect":
10904
- return (result, current, options) => flatMapTransformation(result, current, (value) => value === missing ? missingExit : getter.transform(value, options));
10905
- case "TransformOptionalEffect":
10906
- return (result, current, options) => flatMapTransformation(result, current, (value) => fromOptionalEffect(getter.transform(toOption(value), options)));
11406
+ },
11407
+ [symbol2]: {
11408
+ value(that) {
11409
+ return Equivalence2(this, that);
11410
+ }
11411
+ },
11412
+ [symbol]: {
11413
+ value() {
11414
+ return structure(this);
11415
+ }
11416
+ },
11417
+ toString: {
11418
+ value: BaseProto.toString
11419
+ },
11420
+ [NodeInspectSymbol]: {
11421
+ value: BaseProto[NodeInspectSymbol]
10907
11422
  }
10908
- }
11423
+ });
11424
+ var make21 = (input) => Object.assign(Object.create(Proto5), input);
11425
+ var Equivalence2 = /* @__PURE__ */ makeEquivalence2(/* @__PURE__ */ strictEqual());
11426
+ var empty5 = /* @__PURE__ */ Object.create(Proto5);
11427
+ var fromInput = (input) => {
11428
+ if (input === undefined) {
11429
+ return empty5;
11430
+ } else if (Symbol.iterator in input) {
11431
+ const out = Object.create(Proto5);
11432
+ for (const [k, v] of input) {
11433
+ out[k.toLowerCase()] = v;
11434
+ }
11435
+ return out;
11436
+ }
11437
+ const out = Object.create(Proto5);
11438
+ for (const [k, v] of Object.entries(input)) {
11439
+ if (Array.isArray(v)) {
11440
+ out[k.toLowerCase()] = v.join(", ");
11441
+ } else if (v !== undefined) {
11442
+ out[k.toLowerCase()] = v;
11443
+ }
11444
+ }
11445
+ return out;
11446
+ };
11447
+ var fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto5);
11448
+ var set2 = /* @__PURE__ */ dual(3, (self, key, value) => {
11449
+ const out = make21(self);
11450
+ out[key.toLowerCase()] = value;
11451
+ return out;
11452
+ });
11453
+ var setAll = /* @__PURE__ */ dual(2, (self, headers) => make21({
11454
+ ...self,
11455
+ ...fromInput(headers)
11456
+ }));
11457
+ var merge4 = /* @__PURE__ */ dual(2, (self, headers) => {
11458
+ const out = make21(self);
11459
+ Object.assign(out, headers);
11460
+ return out;
11461
+ });
11462
+ var remove3 = /* @__PURE__ */ dual(2, (self, key) => {
11463
+ const out = make21(self);
11464
+ delete out[key.toLowerCase()];
11465
+ return out;
11466
+ });
11467
+ var redact2 = /* @__PURE__ */ dual(2, (self, key) => {
11468
+ const out = {
11469
+ ...self
11470
+ };
11471
+ const modify = (key) => {
11472
+ if (typeof key === "string") {
11473
+ const k = key.toLowerCase();
11474
+ if (k in self) {
11475
+ out[k] = make17(self[k]);
11476
+ }
11477
+ } else {
11478
+ for (const name in self) {
11479
+ if (name.search(key) !== -1) {
11480
+ out[name] = make17(self[name]);
11481
+ }
11482
+ }
11483
+ }
11484
+ };
11485
+ if (Array.isArray(key)) {
11486
+ for (let i = 0;i < key.length; i++) {
11487
+ modify(key[i]);
11488
+ }
11489
+ } else {
11490
+ modify(key);
11491
+ }
11492
+ return out;
11493
+ });
11494
+ var isRedactedName = (name, patterns) => {
11495
+ const lowerName = name.toLowerCase();
11496
+ for (let i = 0;i < patterns.length; i++) {
11497
+ const pattern = patterns[i];
11498
+ if (typeof pattern === "string") {
11499
+ if (pattern.toLowerCase() === lowerName) {
11500
+ return true;
11501
+ }
11502
+ } else if (name.search(pattern) !== -1) {
11503
+ return true;
11504
+ }
11505
+ }
11506
+ return false;
11507
+ };
11508
+ var CurrentRedactedNames = /* @__PURE__ */ Reference("effect/Headers/CurrentRedactedNames", {
11509
+ defaultValue: () => ["authorization", "cookie", "set-cookie", "x-api-key"]
11510
+ });
11511
+
11512
+ // node_modules/effect/dist/http/internal/urlParams.js
11513
+ var unwrap6 = (value) => typeof value === "string" ? value : value2(value);
11514
+ var bodyDecoder = /* @__PURE__ */ new TextDecoder("utf-8", {
11515
+ ignoreBOM: true
11516
+ });
11517
+ var fromBody = (bytes) => new URLSearchParams(bodyDecoder.decode(bytes).replace(/^\?/, "%3F"));
11518
+
11519
+ // node_modules/effect/dist/http/UrlParams.js
11520
+ var TypeId25 = "~effect/http/UrlParams";
11521
+ var isUrlParams = (u) => hasProperty(u, TypeId25);
11522
+ var Proto6 = {
11523
+ ...PipeInspectableProto,
11524
+ [TypeId25]: TypeId25,
11525
+ [Symbol.iterator]() {
11526
+ return this.params[Symbol.iterator]();
11527
+ },
11528
+ [symbolRedactable](context) {
11529
+ return {
11530
+ _id: "UrlParams",
11531
+ params: Object.fromEntries(redact3(this, get(context, CurrentRedactedNames2)))
11532
+ };
11533
+ },
11534
+ toJSON() {
11535
+ return redact(this);
11536
+ },
11537
+ [symbol2](that) {
11538
+ return Equivalence3(this, that);
11539
+ },
11540
+ [symbol]() {
11541
+ return array(this.params.flat());
11542
+ }
11543
+ };
11544
+ var make22 = (params) => {
11545
+ const self = Object.create(Proto6);
11546
+ self.params = params;
11547
+ return self;
11548
+ };
11549
+ var fromInput2 = (input) => {
11550
+ if (isUrlParams(input)) {
11551
+ return input;
11552
+ }
11553
+ const parsed = fromInputNested(input);
11554
+ const out = [];
11555
+ for (let i = 0;i < parsed.length; i++) {
11556
+ if (Array.isArray(parsed[i][0])) {
11557
+ const [keys, value] = parsed[i];
11558
+ out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value]);
11559
+ } else {
11560
+ out.push(parsed[i]);
11561
+ }
11562
+ }
11563
+ return make22(out);
11564
+ };
11565
+ var fromInputNested = (input) => {
11566
+ const entries = typeof input[Symbol.iterator] === "function" ? fromIterable(input) : Object.entries(input);
11567
+ const out = [];
11568
+ for (const [key, value] of entries) {
11569
+ if (Array.isArray(value)) {
11570
+ for (let i = 0;i < value.length; i++) {
11571
+ if (value[i] !== undefined) {
11572
+ out.push([key, coerce(value[i])]);
11573
+ }
11574
+ }
11575
+ } else if (value !== null && typeof value === "object" && !isRedacted(value)) {
11576
+ const nested = fromInputNested(value);
11577
+ for (const [k, v] of nested) {
11578
+ out.push([[key, ...typeof k === "string" ? [k] : k], v]);
11579
+ }
11580
+ } else if (value !== undefined) {
11581
+ out.push([key, coerce(value)]);
11582
+ }
11583
+ }
11584
+ return out;
11585
+ };
11586
+ var coerce = (value) => isRedacted(value) ? value : String(value);
11587
+ var Equivalence3 = /* @__PURE__ */ make((a, b) => arrayEquivalence(a.params, b.params));
11588
+ var arrayEquivalence = /* @__PURE__ */ makeEquivalence3(/* @__PURE__ */ makeEquivalence([/* @__PURE__ */ strictEqual(), /* @__PURE__ */ asEquivalence()]));
11589
+ var empty6 = /* @__PURE__ */ make22([]);
11590
+ var setAll2 = /* @__PURE__ */ dual(2, (self, input) => {
11591
+ const params = fromInput2(input).params.slice();
11592
+ const keys = new Set;
11593
+ for (let i = 0;i < params.length; i++) {
11594
+ keys.add(params[i][0]);
11595
+ }
11596
+ for (let i = 0;i < self.params.length; i++) {
11597
+ if (keys.has(self.params[i][0]))
11598
+ continue;
11599
+ params.push(self.params[i]);
11600
+ }
11601
+ return make22(params);
11602
+ });
11603
+ var redact3 = /* @__PURE__ */ dual(2, (self, key) => {
11604
+ const patterns = Array.isArray(key) ? key : [key];
11605
+ return self.params.map(([name, value]) => [name, typeof value === "string" && isRedactedName2(name, patterns) ? make17(value) : value]);
11606
+ });
11607
+ var isRedactedName2 = isRedactedName;
11608
+ var redactUrl = (url, redactedNames = currentRedactedNames()) => {
11609
+ if (url.includes("@"))
11610
+ url = redactUserinfo(url);
11611
+ const queryStart = url.indexOf("?");
11612
+ if (queryStart === -1 || redactedNames.length === 0)
11613
+ return url;
11614
+ const hashStart = url.indexOf("#");
11615
+ if (hashStart !== -1 && hashStart < queryStart)
11616
+ return url;
11617
+ const queryEnd = hashStart === -1 ? url.length : hashStart;
11618
+ return url.slice(0, queryStart + 1) + redactQuery(url.slice(queryStart + 1, queryEnd), redactedNames) + url.slice(queryEnd);
11619
+ };
11620
+ var authorityStart = /^(?:(https?|ftp|wss?):[/\\]*|[a-z][a-z\d+.-]*:\/\/|[/\\]{2,})/i;
11621
+ var specialAuthorityEnd = /[/\\?#]/;
11622
+ var authorityEnd = /[/?#]/;
11623
+ var redactUserinfo = (url) => {
11624
+ let normalized = "";
11625
+ const offsets = [];
11626
+ for (let i = 0;i < url.length; i++) {
11627
+ const code = url.charCodeAt(i);
11628
+ if (code === 9 || code === 10 || code === 13 || normalized === "" && code <= 32)
11629
+ continue;
11630
+ normalized += url[i];
11631
+ offsets.push(i);
11632
+ }
11633
+ const authority = authorityStart.exec(normalized);
11634
+ if (authority === null)
11635
+ return url;
11636
+ const start = authority[0].length;
11637
+ const special = authority[1] !== undefined || !authority[0].includes(":");
11638
+ const rest = normalized.slice(start);
11639
+ const end = rest.search(special ? specialAuthorityEnd : authorityEnd);
11640
+ const userinfoEnd = (end === -1 ? rest : rest.slice(0, end)).lastIndexOf("@");
11641
+ return userinfoEnd === -1 ? url : url.slice(0, offsets[start]) + "REDACTED:REDACTED" + url.slice(offsets[start + userinfoEnd]);
11642
+ };
11643
+ var redactQuery = (query, redactedNames) => query.split("&").map((part) => {
11644
+ const index = part.indexOf("=");
11645
+ return index !== -1 && isRedactedName2(decodeQueryKey(part.slice(0, index)), redactedNames) ? part.slice(0, index + 1) + "REDACTED" : part;
11646
+ }).join("&");
11647
+ var decodeQueryKey = (key) => {
11648
+ if (!key.includes("%") && !key.includes("+"))
11649
+ return key;
11650
+ try {
11651
+ return decodeURIComponent(key.replace(/\+/g, " "));
11652
+ } catch {
11653
+ return key;
11654
+ }
11655
+ };
11656
+ var currentRedactedNames = () => get(globalThis[currentFiberTypeId]?.context ?? empty(), CurrentRedactedNames2);
11657
+ var CurrentRedactedNames2 = /* @__PURE__ */ Reference("effect/http/UrlParams/CurrentRedactedNames", {
11658
+ defaultValue: () => ["X-Amz-Signature", "X-Amz-Credential", "X-Amz-Security-Token", "AWSAccessKeyId", "Signature", "sig", "X-Goog-Signature"]
11659
+ });
11660
+
11661
+ // node_modules/effect/dist/internal/schema/interpreter.js
11662
+ var flatMapTransformation = (result, current, f) => result === sameExit ? f(current) : flatMapEager2(result, f);
11663
+ function compileTransformation(transformation) {
11664
+ const apply = compileTransformationUnsafe(transformation);
11665
+ return (result, current, options) => {
11666
+ try {
11667
+ return apply(result, current, options);
11668
+ } catch (error) {
11669
+ return die3(error);
11670
+ }
11671
+ };
11672
+ }
11673
+ function compileTransformationUnsafe(transformation) {
11674
+ if (transformation._tag === "Middleware") {
11675
+ return (result, current, options) => {
11676
+ const transformed = result === sameExit ? transformation.decode(succeed8(toOption(current)), options) : transformation.decode(mapEager2(result, toOption), options);
11677
+ return fromOptionalEffect(transformed);
11678
+ };
11679
+ }
11680
+ const getter = transformation.decode;
11681
+ switch (getter._tag) {
11682
+ case "Passthrough":
11683
+ return (result, current) => result === sameExit ? succeed8(current) : result;
11684
+ case "Transform": {
11685
+ const transform = (value) => value === missing ? missingExit : succeed8(getter.transform(value));
11686
+ return (result, current) => flatMapTransformation(result, current, transform);
11687
+ }
11688
+ case "TransformOptional": {
11689
+ const transform = (value) => fromOptionExit(getter.transform(toOption(value)));
11690
+ return (result, current) => flatMapTransformation(result, current, transform);
11691
+ }
11692
+ case "TransformEffect":
11693
+ return (result, current, options) => flatMapTransformation(result, current, (value) => value === missing ? missingExit : getter.transform(value, options));
11694
+ case "TransformOptionalEffect":
11695
+ return (result, current, options) => flatMapTransformation(result, current, (value) => fromOptionalEffect(getter.transform(toOption(value), options)));
11696
+ }
11697
+ }
10909
11698
  var fromOptionalEffect = (effect) => flatMapEager2(effect, fromOptionExit);
10910
- var wrapEncoding = (ast, input, options, effect) => catchCause2(effect, (cause) => failCauseSync2(() => map4(cause, (issue) => new Encoding(ast, issue, input, options))));
11699
+ var wrapEncoding = (ast, input, options, effect) => catchCause2(effect, (cause) => failCauseSync2(() => map5(cause, (issue) => new Encoding(ast, issue, input, options))));
10911
11700
  function makeConstructorParser(descriptor, compile) {
10912
11701
  const transform = compileTransformation(descriptor.link.transformation);
10913
11702
  let sourceParser;
@@ -11171,7 +11960,7 @@ function makeOption(schema) {
11171
11960
  return none2();
11172
11961
  };
11173
11962
  }
11174
- function make20(schema) {
11963
+ function make23(schema) {
11175
11964
  return makeConstructorSync(toType(schema.ast));
11176
11965
  }
11177
11966
  function is(schema) {
@@ -11261,7 +12050,7 @@ function runWithCompiler(compiler, ast) {
11261
12050
  function asExit(parser) {
11262
12051
  return (input, options) => runSyncExit2(parser(input, options));
11263
12052
  }
11264
- function runSync2(effect, message) {
12053
+ function runSync3(effect, message) {
11265
12054
  const exit = runSyncExit2(effect);
11266
12055
  if (isSuccess3(exit)) {
11267
12056
  return exit.value;
@@ -11299,7 +12088,7 @@ function constructSync(entry, input, options) {
11299
12088
  if (output !== invalid3 && output !== missing)
11300
12089
  return output;
11301
12090
  }
11302
- return runSync2(parserResult(entry.makeEffect(input, parseOptions), input), constructorDefectMessage);
12091
+ return runSync3(parserResult(entry.makeEffect(input, parseOptions), input), constructorDefectMessage);
11303
12092
  }
11304
12093
  function makeClassSync(ast, input, options, construct) {
11305
12094
  const entry = resolve3(ast);
@@ -11320,12 +12109,12 @@ var normalCompiler = (ast) => resolve3(ast).parser;
11320
12109
  var constructorCompiler = (ast) => resolve3(ast).makeEffect;
11321
12110
 
11322
12111
  // node_modules/effect/dist/internal/schema/make.js
11323
- var TypeId23 = "~effect/Schema/Schema";
12112
+ var TypeId26 = "~effect/Schema/Schema";
11324
12113
  var RebuildOptions = /* @__PURE__ */ Symbol();
11325
12114
  var SchemaProto = {
11326
- [TypeId23]: TypeId23,
12115
+ [TypeId26]: TypeId26,
11327
12116
  get make() {
11328
- const value = make20(this);
12117
+ const value = make23(this);
11329
12118
  Object.defineProperty(this, "make", {
11330
12119
  value,
11331
12120
  enumerable: true
@@ -11361,10 +12150,10 @@ var SchemaProto = {
11361
12150
  return this.rebuild(appendChecks(this.ast, checks));
11362
12151
  },
11363
12152
  rebuild(ast) {
11364
- return make21(ast, this[RebuildOptions]);
12153
+ return make24(ast, this[RebuildOptions]);
11365
12154
  }
11366
12155
  };
11367
- function make21(ast, options) {
12156
+ function make24(ast, options) {
11368
12157
  function Schema() {}
11369
12158
  const self = Object.setPrototypeOf(Schema, SchemaProto);
11370
12159
  if (options && (Object.hasOwn(options, "name") || Object.hasOwn(options, "length") || Object.hasOwn(options, "__proto__"))) {
@@ -11415,7 +12204,7 @@ function makeReorder(getPriority) {
11415
12204
  };
11416
12205
  }
11417
12206
  function toCodecStringTree(schema) {
11418
- return make21(toCodecStringTreeAST(schema.ast), {
12207
+ return make24(toCodecStringTreeAST(schema.ast), {
11419
12208
  schema
11420
12209
  });
11421
12210
  }
@@ -11435,7 +12224,7 @@ var toStringTreeReorder = /* @__PURE__ */ makeReorder((ast) => {
11435
12224
  function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
11436
12225
  switch (ast._tag) {
11437
12226
  case "Declaration": {
11438
- const typeParameters = ast.typeParameters.map((tp) => make21(recur(toEncoded(tp))));
12227
+ const typeParameters = ast.typeParameters.map((tp) => make24(recur(toEncoded(tp))));
11439
12228
  const getStringTreeLink = ast.annotations?.toCodecStringTree;
11440
12229
  if (isFunction(getStringTreeLink)) {
11441
12230
  const link = getStringTreeLink(typeParameters);
@@ -11499,10 +12288,10 @@ var lambda = (f) => f;
11499
12288
  var SchemaErrorTypeId = "~effect/Schema/SchemaError";
11500
12289
 
11501
12290
  // node_modules/effect/dist/Schema.js
11502
- var TypeId24 = TypeId23;
12291
+ var TypeId27 = TypeId26;
11503
12292
  function declareConstructor() {
11504
12293
  return (typeParameters, run, annotations) => {
11505
- return make22(new Declaration(typeParameters.map(getAST), (typeParameters) => run(typeParameters.map((ast) => make22(ast))), annotations));
12294
+ return make25(new Declaration(typeParameters.map(getAST), (typeParameters) => run(typeParameters.map((ast) => make25(ast))), annotations));
11506
12295
  };
11507
12296
  }
11508
12297
  function declare(is, annotations) {
@@ -11541,10 +12330,10 @@ function fromIssueEffect(self) {
11541
12330
  if (effectIsExit(self)) {
11542
12331
  return fromIssueExit(self);
11543
12332
  }
11544
- return catchCause2(self, (cause) => failCauseSync2(() => map4(cause, (issue) => new SchemaError(issue))));
12333
+ return catchCause2(self, (cause) => failCauseSync2(() => map5(cause, (issue) => new SchemaError(issue))));
11545
12334
  }
11546
12335
  function fromIssueExit(exit) {
11547
- return isSuccess3(exit) ? exit : failCause2(map4(exit.cause, (issue) => new SchemaError(issue)));
12336
+ return isSuccess3(exit) ? exit : failCause2(map5(exit.cause, (issue) => new SchemaError(issue)));
11548
12337
  }
11549
12338
  var is2 = is;
11550
12339
  function decodeUnknownEffect2(schema, options) {
@@ -11554,21 +12343,21 @@ function decodeUnknownEffect2(schema, options) {
11554
12343
  };
11555
12344
  }
11556
12345
  var decodeEffect2 = decodeUnknownEffect2;
11557
- var make22 = make21;
12346
+ var make25 = make24;
11558
12347
  function isSchema(u) {
11559
- return hasProperty(u, TypeId24) && u[TypeId24] === TypeId24;
12348
+ return hasProperty(u, TypeId27) && u[TypeId27] === TypeId27;
11560
12349
  }
11561
- var optionalKey2 = /* @__PURE__ */ lambda((schema) => make22(optionalKey(schema.ast), {
12350
+ var optionalKey2 = /* @__PURE__ */ lambda((schema) => make25(optionalKey(schema.ast), {
11562
12351
  schema
11563
12352
  }));
11564
12353
  var optional2 = /* @__PURE__ */ lambda((self) => {
11565
12354
  const schema = UndefinedOr(self);
11566
- return make22(optional(self.ast), {
12355
+ return make25(optional(self.ast), {
11567
12356
  schema
11568
12357
  });
11569
12358
  });
11570
12359
  function Literal2(literal) {
11571
- const out = make22(new Literal(literal), {
12360
+ const out = make25(new Literal(literal), {
11572
12361
  literal,
11573
12362
  transform(to) {
11574
12363
  return out.pipe(decodeTo2(Literal2(to), {
@@ -11579,13 +12368,13 @@ function Literal2(literal) {
11579
12368
  });
11580
12369
  return out;
11581
12370
  }
11582
- var Unknown2 = /* @__PURE__ */ make22(unknown);
11583
- var Undefined2 = /* @__PURE__ */ make22(undefined_2);
11584
- var String5 = /* @__PURE__ */ make22(string2);
11585
- var Number6 = /* @__PURE__ */ make22(number2);
11586
- var Boolean3 = /* @__PURE__ */ make22(boolean);
12371
+ var Unknown2 = /* @__PURE__ */ make25(unknown);
12372
+ var Undefined2 = /* @__PURE__ */ make25(undefined_2);
12373
+ var String5 = /* @__PURE__ */ make25(string2);
12374
+ var Number6 = /* @__PURE__ */ make25(number2);
12375
+ var Boolean3 = /* @__PURE__ */ make25(boolean);
11587
12376
  function makeStruct(ast, fields) {
11588
- return make22(ast, {
12377
+ return make25(ast, {
11589
12378
  fields,
11590
12379
  mapFields(f, options) {
11591
12380
  const fields = f(this.fields);
@@ -11597,16 +12386,16 @@ function Struct(fields) {
11597
12386
  return makeStruct(struct(fields, undefined), fields);
11598
12387
  }
11599
12388
  function Record(key, value) {
11600
- return make22(record(key.ast, value.ast), {
12389
+ return make25(record(key.ast, value.ast), {
11601
12390
  key,
11602
12391
  value
11603
12392
  });
11604
12393
  }
11605
- var ArraySchema = /* @__PURE__ */ lambda((schema) => make22(new Arrays(false, [], [schema.ast]), {
12394
+ var ArraySchema = /* @__PURE__ */ lambda((schema) => make25(new Arrays(false, [], [schema.ast]), {
11606
12395
  value: schema
11607
12396
  }));
11608
12397
  function makeUnion(ast, members) {
11609
- return make22(ast, {
12398
+ return make25(ast, {
11610
12399
  members,
11611
12400
  mapMembers(f, options) {
11612
12401
  const members = f(this.members);
@@ -11619,7 +12408,7 @@ function Union2(members, options) {
11619
12408
  }
11620
12409
  function Literals(literals) {
11621
12410
  const members = literals.map(Literal2);
11622
- return make22(union2(members, undefined, undefined), {
12411
+ return make25(union2(members, undefined, undefined), {
11623
12412
  literals,
11624
12413
  members,
11625
12414
  mapMembers(f) {
@@ -11636,7 +12425,7 @@ function Literals(literals) {
11636
12425
  var UndefinedOr = /* @__PURE__ */ lambda((self) => Union2([self, Undefined2]));
11637
12426
  function decodeTo2(to, transformation) {
11638
12427
  return (from) => {
11639
- return make22(decodeTo(from.ast, to.ast, transformation ? makeTransformation(transformation) : passthrough2()), {
12428
+ return make25(decodeTo(from.ast, to.ast, transformation ? makeTransformation(transformation) : passthrough2()), {
11640
12429
  from,
11641
12430
  to
11642
12431
  });
@@ -11649,7 +12438,7 @@ var BooleanLiterals = /* @__PURE__ */ Literals([...TrueLiterals.literals, ...Fal
11649
12438
  encode: (value) => value ? "true" : "false"
11650
12439
  })));
11651
12440
  function withConstructorDefault2(defaultValue) {
11652
- return (schema) => make22(withConstructorDefault(schema.ast, defaultValue), {
12441
+ return (schema) => make25(withConstructorDefault(schema.ast, defaultValue), {
11653
12442
  schema
11654
12443
  });
11655
12444
  }
@@ -11710,6 +12499,45 @@ function isBase64(annotations) {
11710
12499
  ...annotations
11711
12500
  });
11712
12501
  }
12502
+ function makeIsGreaterThan(options) {
12503
+ const gt = isGreaterThan(options.order);
12504
+ const formatter = options.formatter ?? format;
12505
+ return (exclusiveMinimum, annotations) => {
12506
+ return makeFilter2((input) => gt(input, exclusiveMinimum), {
12507
+ expected: `a value greater than ${formatter(exclusiveMinimum)}`,
12508
+ arbitraryConstraint: {
12509
+ order: options.order,
12510
+ minimum: exclusiveMinimum,
12511
+ exclusiveMinimum: true
12512
+ },
12513
+ ...options.annotate?.(exclusiveMinimum),
12514
+ ...annotations
12515
+ });
12516
+ };
12517
+ }
12518
+ function encodeNumberPayload(number) {
12519
+ if (!globalThis.Number.isFinite(number)) {
12520
+ throw new globalThis.RangeError(`Expected a finite number, got ${format(number)}`);
12521
+ }
12522
+ return number;
12523
+ }
12524
+ var isGreaterThan2 = /* @__PURE__ */ makeIsGreaterThan({
12525
+ order: Number2,
12526
+ annotate: (exclusiveMinimum) => ({
12527
+ representation: {
12528
+ id: "effect/schema/isGreaterThan",
12529
+ payload: {
12530
+ exclusiveMinimum: encodeNumberPayload(exclusiveMinimum)
12531
+ }
12532
+ },
12533
+ toJsonSchema: () => ({
12534
+ exclusiveMinimum
12535
+ }),
12536
+ toCode: () => ({
12537
+ runtime: `Schema.isGreaterThan(${format(exclusiveMinimum)})`
12538
+ })
12539
+ })
12540
+ });
11713
12541
  function isInt(annotations) {
11714
12542
  return makeFilter2((n) => globalThis.Number.isSafeInteger(n), {
11715
12543
  expected: "an integer",
@@ -11812,7 +12640,7 @@ var RegExp2 = /* @__PURE__ */ instanceOf(globalThis.RegExp, {
11812
12640
  source: String5,
11813
12641
  flags: String5
11814
12642
  }), transformEffect2({
11815
- decode: (e, options) => try_2({
12643
+ decode: (e, options) => try_3({
11816
12644
  try: () => new globalThis.RegExp(e.source, e.flags),
11817
12645
  catch: () => new InvalidValue({
11818
12646
  expected: "valid RegExp source and flags"
@@ -11839,6 +12667,7 @@ var URL2 = /* @__PURE__ */ instanceOf(globalThis.URL, {
11839
12667
  expected: "URL",
11840
12668
  toCodecJson: () => link3()(URLString, urlFromString)
11841
12669
  });
12670
+ var URLFromString = /* @__PURE__ */ URLString.pipe(/* @__PURE__ */ decodeTo2(URL2, urlFromString));
11842
12671
  var File = /* @__PURE__ */ instanceOf(globalThis.File, {
11843
12672
  representation: {
11844
12673
  id: "effect/schema/File",
@@ -11942,7 +12771,7 @@ function makeClass(Inherited, identifier, struct2, annotations, proto) {
11942
12771
  }
11943
12772
  });
11944
12773
  }
11945
- static [TypeId24] = TypeId24;
12774
+ static [TypeId27] = TypeId27;
11946
12775
  get [ClassTypeId]() {
11947
12776
  return ClassTypeId;
11948
12777
  }
@@ -12021,7 +12850,7 @@ function getClassSchemaFactory(from, identifier, annotations) {
12021
12850
  const ClassTypeId = getClassTypeId(identifier);
12022
12851
  const isClassValue = (input) => input instanceof self || hasProperty(input, ClassTypeId);
12023
12852
  const transformation = getClassTransformation(self);
12024
- const to = make22(new Declaration([from.ast], () => (input, ast, options) => {
12853
+ const to = make25(new Declaration([from.ast], () => (input, ast, options) => {
12025
12854
  return isClassValue(input) ? succeed6(input) : fail7(new InvalidType(ast, input, options));
12026
12855
  }, {
12027
12856
  identifier,
@@ -12060,7 +12889,7 @@ var TaggedError3 = (identifier) => {
12060
12889
  };
12061
12890
  };
12062
12891
  var toCodecStringTree2 = toCodecStringTree;
12063
- var Json2 = /* @__PURE__ */ make22(/* @__PURE__ */ annotate(Json, {
12892
+ var Json2 = /* @__PURE__ */ make25(/* @__PURE__ */ annotate(Json, {
12064
12893
  toCode: () => ({
12065
12894
  runtime: "Schema.Json",
12066
12895
  Type: "Schema.Json"
@@ -12068,7 +12897,7 @@ var Json2 = /* @__PURE__ */ make22(/* @__PURE__ */ annotate(Json, {
12068
12897
  }));
12069
12898
 
12070
12899
  // node_modules/effect/dist/Terminal.js
12071
- var TypeId25 = "~effect/Terminal";
12900
+ var TypeId28 = "~effect/Terminal";
12072
12901
  var QuitErrorTypeId = "~effect/Terminal/QuitError";
12073
12902
 
12074
12903
  class QuitError extends (/* @__PURE__ */ Error4("QuitError")({
@@ -12078,17 +12907,17 @@ class QuitError extends (/* @__PURE__ */ Error4("QuitError")({
12078
12907
  }
12079
12908
  var isQuitError = (u) => hasProperty(u, QuitErrorTypeId);
12080
12909
  var Terminal = /* @__PURE__ */ Service("effect/Terminal");
12081
- var make23 = (impl) => Terminal.of({
12910
+ var make26 = (impl) => Terminal.of({
12082
12911
  ...impl,
12083
- [TypeId25]: TypeId25
12912
+ [TypeId28]: TypeId28
12084
12913
  });
12085
12914
 
12086
12915
  // node_modules/@effect/platform-node-shared/dist/NodeTerminal.js
12087
12916
  import * as readline from "readline";
12088
- var make24 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQuit) {
12917
+ var make27 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQuit) {
12089
12918
  const stdin = process.stdin;
12090
12919
  const stdout = process.stdout;
12091
- const lines = yield* make9();
12920
+ const lines = yield* make10();
12092
12921
  let inputEnded = stdin.readableEnded;
12093
12922
  let readlineActive = false;
12094
12923
  const onStdinEnd = () => {
@@ -12099,7 +12928,7 @@ var make24 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12099
12928
  };
12100
12929
  stdin.once("end", onStdinEnd);
12101
12930
  yield* addFinalizer3(() => sync2(() => stdin.off("end", onStdinEnd)));
12102
- const rlRef = yield* make11({
12931
+ const rlRef = yield* make12({
12103
12932
  acquire: acquireRelease2(sync2(() => {
12104
12933
  const rl = readline.createInterface({
12105
12934
  input: stdin,
@@ -12138,7 +12967,7 @@ var make24 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12138
12967
  if (stdin.isTTY)
12139
12968
  stdin.setRawMode(enabled);
12140
12969
  });
12141
- const rawModeRef = yield* make11({
12970
+ const rawModeRef = yield* make12({
12142
12971
  acquire: acquireRelease2(setRawMode(true), () => setRawMode(false)),
12143
12972
  idleTimeToLive: "10 millis"
12144
12973
  });
@@ -12159,7 +12988,7 @@ var make24 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12159
12988
  return queue;
12160
12989
  });
12161
12990
  const readInput = gen2(function* () {
12162
- const queue = yield* make9();
12991
+ const queue = yield* make10();
12163
12992
  const handleKeypress = (s, k) => {
12164
12993
  const userInput = {
12165
12994
  input: fromUndefinedOr(s),
@@ -12207,7 +13036,7 @@ var make24 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12207
13036
  cause: err
12208
13037
  }))));
12209
13038
  }));
12210
- return make23({
13039
+ return make26({
12211
13040
  columns,
12212
13041
  rows,
12213
13042
  size,
@@ -12216,7 +13045,7 @@ var make24 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
12216
13045
  display
12217
13046
  });
12218
13047
  });
12219
- var layer8 = /* @__PURE__ */ effect(Terminal, /* @__PURE__ */ make24(defaultShouldQuit));
13048
+ var layer8 = /* @__PURE__ */ effect(Terminal, /* @__PURE__ */ make27(defaultShouldQuit));
12220
13049
  function defaultShouldQuit(input) {
12221
13050
  const key = input.key;
12222
13051
  return key.name === "escape" || key.ctrl && (key.name === "c" || key.name === "d");
@@ -12251,7 +13080,7 @@ function makeArray(length, value) {
12251
13080
  var ConfigProvider = /* @__PURE__ */ Reference("effect/ConfigProvider", {
12252
13081
  defaultValue: () => fromEnv()
12253
13082
  });
12254
- var Proto4 = {
13083
+ var Proto7 = {
12255
13084
  ...PipeInspectableProto,
12256
13085
  toJSON() {
12257
13086
  return {
@@ -12261,7 +13090,7 @@ var Proto4 = {
12261
13090
  };
12262
13091
  var identityPath = (path) => path;
12263
13092
  function makeProvider(load, mapInput) {
12264
- const self = Object.create(Proto4);
13093
+ const self = Object.create(Proto7);
12265
13094
  self.load = load;
12266
13095
  self.mapInput = mapInput;
12267
13096
  return self;
@@ -12269,7 +13098,7 @@ function makeProvider(load, mapInput) {
12269
13098
  function makeSource(get, transform) {
12270
13099
  return makeProvider((path) => get(transform(path)), (f) => makeSource(get, (path) => f(transform(path))));
12271
13100
  }
12272
- function make25(get) {
13101
+ function make28(get) {
12273
13102
  return makeSource(get, identityPath);
12274
13103
  }
12275
13104
  function emptyStringAsMissing(value, preserveEmptyStrings) {
@@ -12278,7 +13107,7 @@ function emptyStringAsMissing(value, preserveEmptyStrings) {
12278
13107
  function fromEnvRecord(env, options) {
12279
13108
  const preserveEmptyStrings = options?.preserveEmptyStrings === true;
12280
13109
  const trie = buildEnvTrie(env);
12281
- return make25((path) => succeed6(nodeAtEnv(trie, env, path, preserveEmptyStrings)));
13110
+ return make28((path) => succeed6(nodeAtEnv(trie, env, path, preserveEmptyStrings)));
12282
13111
  }
12283
13112
  function fromEnv(options) {
12284
13113
  const env = options?.env ?? {
@@ -12331,7 +13160,7 @@ function trieNodeAt(root, path) {
12331
13160
  }
12332
13161
 
12333
13162
  // node_modules/effect/dist/Config.js
12334
- var TypeId26 = "~effect/Config";
13163
+ var TypeId29 = "~effect/Config";
12335
13164
  class ConfigError {
12336
13165
  _tag = "ConfigError";
12337
13166
  name = "ConfigError";
@@ -12346,29 +13175,29 @@ class ConfigError {
12346
13175
  return `ConfigError(${this.message})`;
12347
13176
  }
12348
13177
  }
12349
- var Proto5 = {
13178
+ var Proto8 = {
12350
13179
  .../* @__PURE__ */ Prototype2({
12351
13180
  label: "Config",
12352
13181
  evaluate(fiber) {
12353
13182
  return this.parse(fiber.getRef(ConfigProvider));
12354
13183
  }
12355
13184
  }),
12356
- [TypeId26]: TypeId26,
13185
+ [TypeId29]: TypeId29,
12357
13186
  toJSON() {
12358
13187
  return {
12359
13188
  _id: "Config"
12360
13189
  };
12361
13190
  }
12362
13191
  };
12363
- function make26(evaluator) {
12364
- const self = Object.create(Proto5);
13192
+ function make29(evaluator) {
13193
+ const self = Object.create(Proto8);
12365
13194
  self.evaluator = evaluator;
12366
13195
  self.parse = (provider) => flatMapEager2(evaluator(provider, []), fromResult2);
12367
13196
  return self;
12368
13197
  }
12369
13198
  var evaluateAt = (self, provider, pathPrefix) => self.evaluator(provider, pathPrefix);
12370
13199
  var withDefault3 = /* @__PURE__ */ dual(2, (self, defaultValue) => {
12371
- return make26((provider, pathPrefix) => mapEager2(evaluateAt(self, provider, pathPrefix), (resolution) => isFailure2(resolution) ? succeed2(defaultValue) : resolution));
13200
+ return make29((provider, pathPrefix) => mapEager2(evaluateAt(self, provider, pathPrefix), (resolution) => isFailure2(resolution) ? succeed2(defaultValue) : resolution));
12372
13201
  });
12373
13202
  var isSourceError = (u) => isTagged(u, "SourceError");
12374
13203
  var cursorToString = () => "<configuration>";
@@ -12484,9 +13313,9 @@ var toConfigCursorAST = /* @__PURE__ */ memoize((root) => {
12484
13313
  function schema(codec, path) {
12485
13314
  const codecStringTree = toCodecStringTree2(codec);
12486
13315
  const encodedAst = toEncoded(codecStringTree.ast);
12487
- const decodeCursor = decodeUnknownEffect(make22(toConfigCursorAST(codecStringTree.ast)));
13316
+ const decodeCursor = decodeUnknownEffect(make25(toConfigCursorAST(codecStringTree.ast)));
12488
13317
  const localPath = typeof path === "string" ? [path] : path ?? [];
12489
- return make26((provider, pathPrefix) => {
13318
+ return make29((provider, pathPrefix) => {
12490
13319
  const fullPath = [...pathPrefix, ...localPath];
12491
13320
  return loadCursor(provider, fullPath).pipe(flatMapEager2((cursor) => decodeCursor(cursor).pipe(mapEager2(succeed2), catchEager2((issue) => {
12492
13321
  const error = new ConfigError(new SchemaError(fullPath.length > 0 ? new Pointer(fullPath, issue) : issue));
@@ -12512,17 +13341,17 @@ var log = (...args) => consoleWith((console) => sync(() => {
12512
13341
  // node_modules/effect/dist/Logger.js
12513
13342
  var LogToStderr2 = LogToStderr;
12514
13343
  // node_modules/effect/dist/cli/CliError.js
12515
- var TypeId27 = "~effect/cli/CliError";
12516
- var isCliError = (u) => hasProperty(u, TypeId27);
13344
+ var TypeId30 = "~effect/cli/CliError";
13345
+ var isCliError = (u) => hasProperty(u, TypeId30);
12517
13346
  var userMessage = "~effect/cli/CliError/userMessage";
12518
13347
  var getUserMessage = (error) => (userMessage in error) && typeof error[userMessage] === "string" ? error[userMessage] : undefined;
12519
13348
 
12520
- class UnrecognizedOption extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/UnrecognizedOption`)("UnrecognizedOption", {
13349
+ class UnrecognizedOption extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/UnrecognizedOption`)("UnrecognizedOption", {
12521
13350
  option: String5,
12522
13351
  command: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String5)),
12523
13352
  suggestions: /* @__PURE__ */ ArraySchema(String5)
12524
13353
  })) {
12525
- [TypeId27] = TypeId27;
13354
+ [TypeId30] = TypeId30;
12526
13355
  get message() {
12527
13356
  const suggestionText = this.suggestions.length > 0 ? `
12528
13357
 
@@ -12534,52 +13363,52 @@ class UnrecognizedOption extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/Unre
12534
13363
  }
12535
13364
  }
12536
13365
 
12537
- class DuplicateOption extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/DuplicateOption`)("DuplicateOption", {
13366
+ class DuplicateOption extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/DuplicateOption`)("DuplicateOption", {
12538
13367
  option: String5,
12539
13368
  parentCommand: String5,
12540
13369
  childCommand: String5
12541
13370
  })) {
12542
- [TypeId27] = TypeId27;
13371
+ [TypeId30] = TypeId30;
12543
13372
  get message() {
12544
13373
  return `Duplicate flag name "${this.option}" in parent command "${this.parentCommand}" and subcommand "${this.childCommand}". ` + `Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.`;
12545
13374
  }
12546
13375
  }
12547
13376
 
12548
- class MissingOption extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/MissingOption`)("MissingOption", {
13377
+ class MissingOption extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/MissingOption`)("MissingOption", {
12549
13378
  option: String5
12550
13379
  })) {
12551
- [TypeId27] = TypeId27;
13380
+ [TypeId30] = TypeId30;
12552
13381
  get message() {
12553
13382
  return `Missing required flag: --${this.option}`;
12554
13383
  }
12555
13384
  }
12556
13385
 
12557
- class MissingArgument extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/MissingArgument`)("MissingArgument", {
13386
+ class MissingArgument extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/MissingArgument`)("MissingArgument", {
12558
13387
  argument: String5
12559
13388
  })) {
12560
- [TypeId27] = TypeId27;
13389
+ [TypeId30] = TypeId30;
12561
13390
  get message() {
12562
13391
  return `Missing required argument: ${this.argument}`;
12563
13392
  }
12564
13393
  }
12565
13394
 
12566
- class UnexpectedArgument extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/UnexpectedArgument`)("UnexpectedArgument", {
13395
+ class UnexpectedArgument extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/UnexpectedArgument`)("UnexpectedArgument", {
12567
13396
  arguments: /* @__PURE__ */ ArraySchema(String5)
12568
13397
  })) {
12569
- [TypeId27] = TypeId27;
13398
+ [TypeId30] = TypeId30;
12570
13399
  get message() {
12571
13400
  const label = this.arguments.length === 1 ? "argument" : "arguments";
12572
13401
  return `Unexpected positional ${label}: ${this.arguments.map((value) => JSON.stringify(value)).join(", ")}`;
12573
13402
  }
12574
13403
  }
12575
13404
 
12576
- class InvalidValue2 extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/InvalidValue`)("InvalidValue", {
13405
+ class InvalidValue2 extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/InvalidValue`)("InvalidValue", {
12577
13406
  option: String5,
12578
13407
  value: String5,
12579
13408
  expected: String5,
12580
13409
  kind: /* @__PURE__ */ Union2([/* @__PURE__ */ Literal2("flag"), /* @__PURE__ */ Literal2("argument")])
12581
13410
  })) {
12582
- [TypeId27] = TypeId27;
13411
+ [TypeId30] = TypeId30;
12583
13412
  get message() {
12584
13413
  const expectation = this.expected.startsWith("Expected ") || this.expected.startsWith("Expected:") ? this.expected : `Expected: ${this.expected}`;
12585
13414
  if (this.kind === "argument") {
@@ -12592,12 +13421,12 @@ class InvalidValue2 extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/InvalidVa
12592
13421
  }
12593
13422
  }
12594
13423
 
12595
- class UnknownSubcommand extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/UnknownSubcommand`)("UnknownSubcommand", {
13424
+ class UnknownSubcommand extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/UnknownSubcommand`)("UnknownSubcommand", {
12596
13425
  subcommand: String5,
12597
13426
  parent: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String5)),
12598
13427
  suggestions: /* @__PURE__ */ ArraySchema(String5)
12599
13428
  })) {
12600
- [TypeId27] = TypeId27;
13429
+ [TypeId30] = TypeId30;
12601
13430
  get message() {
12602
13431
  const suggestionText = this.suggestions.length > 0 ? `
12603
13432
 
@@ -12608,17 +13437,17 @@ class UnknownSubcommand extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/Unkno
12608
13437
  }
12609
13438
  }
12610
13439
 
12611
- class ValidationError extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/ValidationError`)("ValidationError", {
13440
+ class ValidationError extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/ValidationError`)("ValidationError", {
12612
13441
  message: String5
12613
13442
  })) {
12614
- [TypeId27] = TypeId27;
13443
+ [TypeId30] = TypeId30;
12615
13444
  }
12616
13445
 
12617
- class UserError extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/UserError`)("UserError", {
13446
+ class UserError extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/UserError`)("UserError", {
12618
13447
  cause: /* @__PURE__ */ Defect(),
12619
13448
  userMessage: /* @__PURE__ */ optionalKey2(String5)
12620
13449
  })) {
12621
- [TypeId27] = TypeId27;
13450
+ [TypeId30] = TypeId30;
12622
13451
  [errorReported] = true;
12623
13452
  get message() {
12624
13453
  if (this.userMessage)
@@ -12635,11 +13464,11 @@ class UserError extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/UserError`)("
12635
13464
  }
12636
13465
  var NonShowHelpErrors = /* @__PURE__ */ Union2([UnrecognizedOption, DuplicateOption, MissingOption, MissingArgument, UnexpectedArgument, InvalidValue2, UnknownSubcommand, ValidationError, UserError]);
12637
13466
 
12638
- class ShowHelp extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/ShowHelp`)("ShowHelp", {
13467
+ class ShowHelp extends (/* @__PURE__ */ TaggedError3(`${TypeId30}/ShowHelp`)("ShowHelp", {
12639
13468
  commandPath: /* @__PURE__ */ ArraySchema(String5),
12640
13469
  errors: /* @__PURE__ */ ArraySchema(NonShowHelpErrors)
12641
13470
  })) {
12642
- [TypeId27] = TypeId27;
13471
+ [TypeId30] = TypeId30;
12643
13472
  [errorExitCode] = this.errors.length ? 1 : 0;
12644
13473
  [errorReported] = false;
12645
13474
  get message() {
@@ -12648,16 +13477,16 @@ class ShowHelp extends (/* @__PURE__ */ TaggedError3(`${TypeId27}/ShowHelp`)("Sh
12648
13477
  }
12649
13478
 
12650
13479
  // node_modules/effect/dist/cli/Primitive.js
12651
- var TypeId28 = "~effect/cli/Primitive";
12652
- var Proto6 = {
12653
- [TypeId28]: {
13480
+ var TypeId31 = "~effect/cli/Primitive";
13481
+ var Proto9 = {
13482
+ [TypeId31]: {
12654
13483
  _A: identity
12655
13484
  }
12656
13485
  };
12657
13486
  var isTrueLiteral = /* @__PURE__ */ is2(TrueLiterals);
12658
13487
  var isFalseLiteral = /* @__PURE__ */ is2(FalseLiterals);
12659
13488
  var isBoolean2 = (p) => p._tag === "Boolean";
12660
- var makePrimitive2 = (tag, parse) => Object.assign(Object.create(Proto6), {
13489
+ var makePrimitive2 = (tag, parse) => Object.assign(Object.create(Proto9), {
12661
13490
  _tag: tag,
12662
13491
  parse
12663
13492
  });
@@ -12785,7 +13614,7 @@ var eraseLines = (rows) => {
12785
13614
  };
12786
13615
 
12787
13616
  // node_modules/effect/dist/cli/Prompt.js
12788
- var TypeId29 = "~effect/cli/Prompt";
13617
+ var TypeId32 = "~effect/cli/Prompt";
12789
13618
  var defaultTheme = {
12790
13619
  prefix: "?",
12791
13620
  arrowUp: "\u2191",
@@ -12822,7 +13651,7 @@ var makeTheme = (options) => ({
12822
13651
  var Theme = /* @__PURE__ */ Reference("effect/cli/Prompt/Theme", {
12823
13652
  defaultValue: makeTheme
12824
13653
  });
12825
- var getTheme = (options) => map5(Theme, (theme) => ({
13654
+ var getTheme = (options) => map6(Theme, (theme) => ({
12826
13655
  ...theme,
12827
13656
  ...options.theme
12828
13657
  }));
@@ -12874,7 +13703,7 @@ var Custom = (initialState, ...args) => {
12874
13703
  op.events = events;
12875
13704
  return op;
12876
13705
  };
12877
- var Date4 = (options) => {
13706
+ var Date5 = (options) => {
12878
13707
  const opts = {
12879
13708
  initial: new globalThis.Date,
12880
13709
  dateMask: "YYYY-MM-DD HH:mm:ss",
@@ -12968,8 +13797,8 @@ var Int2 = (options) => {
12968
13797
  clear: handleNumberClear(opts)
12969
13798
  });
12970
13799
  };
12971
- var map8 = /* @__PURE__ */ dual(2, (self, f) => flatMap5(self, (a) => succeed9(f(a))));
12972
- var Password = (options) => basePrompt(options, "password").pipe(map8(make16));
13800
+ var map9 = /* @__PURE__ */ dual(2, (self, f) => flatMap5(self, (a) => succeed9(f(a))));
13801
+ var Password = (options) => basePrompt(options, "password").pipe(map9(make17));
12973
13802
  var run3 = /* @__PURE__ */ fnUntraced2(function* (self) {
12974
13803
  const terminal = yield* Terminal;
12975
13804
  const input = yield* cached2(terminal.readInput);
@@ -13031,7 +13860,7 @@ var proto = {
13031
13860
  return run3(this);
13032
13861
  }
13033
13862
  }),
13034
- [TypeId29]: {
13863
+ [TypeId32]: {
13035
13864
  _Output: (_) => _
13036
13865
  }
13037
13866
  };
@@ -13060,11 +13889,11 @@ var runLoop = /* @__PURE__ */ fnUntraced2(function* (loop, terminal, input) {
13060
13889
  yield* orDie2(terminal.display(clear + msg));
13061
13890
  clear = "";
13062
13891
  if (loop.events) {
13063
- const takeInput = take2(input).pipe(map5((input) => ({
13892
+ const takeInput = take2(input).pipe(map6((input) => ({
13064
13893
  _tag: "Input",
13065
13894
  input
13066
13895
  })));
13067
- const result = yield* raceFirst2(takeInput, take2(loop.events).pipe(map5((value) => ({
13896
+ const result = yield* raceFirst2(takeInput, take2(loop.events).pipe(map6((value) => ({
13068
13897
  _tag: "Event",
13069
13898
  value
13070
13899
  }))));
@@ -13104,7 +13933,7 @@ var eraseText = (text, columns) => {
13104
13933
  };
13105
13934
  var lines = (prompt, columns) => {
13106
13935
  const lines = prompt.split(NEWLINE_REGEXP);
13107
- return columns === 0 ? lines.length : pipe(map2(lines, (line) => Math.ceil(line.length / columns)), reduce(0, (left, right) => left + right));
13936
+ return columns === 0 ? lines.length : pipe(map3(lines, (line) => Math.ceil(line.length / columns)), reduce(0, (left, right) => left + right));
13108
13937
  };
13109
13938
  var clearOutputWithError = (outputText, columns, errorText) => {
13110
13939
  if (errorText !== undefined && errorText.length > 0) {
@@ -13205,7 +14034,7 @@ var renderDateError = (state, pointer, theme) => {
13205
14034
  const errorLines = state.error.value.split(NEWLINE_REGEXP);
13206
14035
  if (isReadonlyArrayNonEmpty(errorLines)) {
13207
14036
  const prefix = annotateSymbol(theme, pointer, theme.errorColor);
13208
- const lines = map2(errorLines, (str) => annotateErrorLine(theme, str));
14037
+ const lines = map3(errorLines, (str) => annotateErrorLine(theme, str));
13209
14038
  return cursorSavePosition + `
13210
14039
  ` + separateSymbol(prefix, lines.join(`
13211
14040
  `)) + cursorRestorePosition;
@@ -13648,7 +14477,7 @@ var renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, theme, opti
13648
14477
  return match3(message.split(NEWLINE_REGEXP), {
13649
14478
  onEmpty: () => renderLine(""),
13650
14479
  onNonEmpty: (promptLines) => {
13651
- const lines = options?.plain === true ? promptLines : map2(promptLines, (line) => annotate2(theme.colors, line, bold));
14480
+ const lines = options?.plain === true ? promptLines : map3(promptLines, (line) => annotate2(theme.colors, line, bold));
13652
14481
  return renderLine(lines.join(`
13653
14482
  `));
13654
14483
  }
@@ -13695,7 +14524,7 @@ var renderNumberError = (state, pointer, theme, renderOptions) => {
13695
14524
  `));
13696
14525
  }
13697
14526
  const prefix = annotateSymbol(theme, pointer, theme.errorColor);
13698
- const lines = map2(errorLines, (str) => annotateErrorLine(theme, str));
14527
+ const lines = map3(errorLines, (str) => annotateErrorLine(theme, str));
13699
14528
  return cursorSavePosition + `
13700
14529
  ` + separateSymbol(prefix, lines.join(`
13701
14530
  `)) + cursorRestorePosition;
@@ -14124,7 +14953,7 @@ var renderTextError = (nextState, pointer, theme, renderOptions) => {
14124
14953
  `));
14125
14954
  }
14126
14955
  const prefix = annotateSymbol(theme, pointer, theme.errorColor);
14127
- const lines = map2(errorLines, (str) => annotateErrorLine(theme, str));
14956
+ const lines = map3(errorLines, (str) => annotateErrorLine(theme, str));
14128
14957
  return cursorSavePosition + `
14129
14958
  ` + separateSymbol(prefix, lines.join(`
14130
14959
  `)) + cursorRestorePosition;
@@ -14473,18 +15302,18 @@ var fromProcess = () => {
14473
15302
  };
14474
15303
 
14475
15304
  // node_modules/effect/dist/cli/Param.js
14476
- var TypeId30 = "~effect/cli/Param";
15305
+ var TypeId33 = "~effect/cli/Param";
14477
15306
  var argumentKind = "argument";
14478
15307
  var flagKind = "flag";
14479
- var Proto7 = {
14480
- [TypeId30]: {
15308
+ var Proto10 = {
15309
+ [TypeId33]: {
14481
15310
  _A: identity
14482
15311
  },
14483
15312
  pipe() {
14484
15313
  return pipeArguments(this, arguments);
14485
15314
  }
14486
15315
  };
14487
- var isParam = (u) => hasProperty(u, TypeId30);
15316
+ var isParam = (u) => hasProperty(u, TypeId33);
14488
15317
  var isFlagParam = (single) => single.kind === "flag";
14489
15318
  var makeSingle2 = (params) => {
14490
15319
  const parse = (args) => params.kind === argumentKind ? parsePositional(params.name, params.primitiveType, args) : parseFlag(params.name, params.primitiveType, args);
@@ -14495,7 +15324,7 @@ var makeSingle2 = (params) => {
14495
15324
  aliases: params.aliases ?? [],
14496
15325
  hidden: params.hidden ?? false,
14497
15326
  parse
14498
- }, Proto7);
15327
+ }, Proto10);
14499
15328
  };
14500
15329
  var String9 = (kind, name) => makeSingle2({
14501
15330
  name,
@@ -14525,9 +15354,9 @@ var withDescription = /* @__PURE__ */ dual(2, (self, description) => {
14525
15354
  description: some2(description)
14526
15355
  }));
14527
15356
  });
14528
- var map9 = /* @__PURE__ */ dual(2, (self, f) => {
14529
- const parse = (args) => map5(self.parse(args), ([operands, value]) => [operands, f(value)]);
14530
- return Object.assign(Object.create(Proto7), {
15357
+ var map10 = /* @__PURE__ */ dual(2, (self, f) => {
15358
+ const parse = (args) => map6(self.parse(args), ([operands, value]) => [operands, f(value)]);
15359
+ return Object.assign(Object.create(Proto10), {
14531
15360
  _tag: "Map",
14532
15361
  kind: self.kind,
14533
15362
  param: self,
@@ -14537,7 +15366,7 @@ var map9 = /* @__PURE__ */ dual(2, (self, f) => {
14537
15366
  });
14538
15367
  var transform3 = (self, f, alternatives = []) => {
14539
15368
  const alternativeParsers = alternatives.map((alternative) => () => alternative().parse);
14540
- return Object.assign(Object.create(Proto7), {
15369
+ return Object.assign(Object.create(Proto10), {
14541
15370
  _tag: "Transform",
14542
15371
  kind: self.kind,
14543
15372
  param: self,
@@ -14546,13 +15375,13 @@ var transform3 = (self, f, alternatives = []) => {
14546
15375
  parse: f(self.parse, alternativeParsers)
14547
15376
  });
14548
15377
  };
14549
- var mapEffect2 = /* @__PURE__ */ dual(2, (self, f) => transform3(self, (parse) => (args) => flatMap3(parse(args), ([leftover, a]) => f(a).pipe(map5((b) => [leftover, b])))));
15378
+ var mapEffect2 = /* @__PURE__ */ dual(2, (self, f) => transform3(self, (parse) => (args) => flatMap3(parse(args), ([leftover, a]) => f(a).pipe(map6((b) => [leftover, b])))));
14550
15379
  var optional3 = (param) => {
14551
- const parse = (args) => param.parse(args).pipe(map5(([leftover, value]) => [leftover, some2(value)]), catchTags2({
15380
+ const parse = (args) => param.parse(args).pipe(map6(([leftover, value]) => [leftover, some2(value)]), catchTags2({
14552
15381
  MissingOption: () => succeed6([args.arguments, none2()]),
14553
15382
  MissingArgument: () => succeed6([args.arguments, none2()])
14554
15383
  }));
14555
- return Object.assign(Object.create(Proto7), {
15384
+ return Object.assign(Object.create(Proto10), {
14556
15385
  _tag: "Optional",
14557
15386
  kind: param.kind,
14558
15387
  param,
@@ -14561,7 +15390,7 @@ var optional3 = (param) => {
14561
15390
  };
14562
15391
  var withDefault4 = /* @__PURE__ */ dual(2, (self, defaultValue) => {
14563
15392
  if (!isEffect2(defaultValue)) {
14564
- return map9(optional3(self), getOrElse(() => defaultValue));
15393
+ return map10(optional3(self), getOrElse(() => defaultValue));
14565
15394
  }
14566
15395
  return mapEffect2(optional3(self), match({
14567
15396
  onNone: () => defaultValue,
@@ -14577,7 +15406,7 @@ var variadic = (self, options) => {
14577
15406
  return parseOptionVariadic(self, single, args, options);
14578
15407
  }
14579
15408
  };
14580
- return Object.assign(Object.create(Proto7), {
15409
+ return Object.assign(Object.create(Proto10), {
14581
15410
  _tag: "Variadic",
14582
15411
  kind: self.kind,
14583
15412
  param: self,
@@ -14708,7 +15537,7 @@ var matchParam = (param, patterns) => {
14708
15537
  var transformSingle = (param, f) => {
14709
15538
  return matchParam(param, {
14710
15539
  Single: (single) => f(single),
14711
- Map: (mapped) => map9(transformSingle(mapped.param, f), mapped.f),
15540
+ Map: (mapped) => map10(transformSingle(mapped.param, f), mapped.f),
14712
15541
  Transform: (mapped) => transform3(transformSingle(mapped.param, f), mapped.f, mapped.alternatives.map((alternative) => () => transformSingle(alternative(), f))),
14713
15542
  Optional: (p) => optional3(transformSingle(p.param, f)),
14714
15543
  Variadic: (p) => variadic(transformSingle(p.param, f), {
@@ -15072,9 +15901,9 @@ var reconstructTree = (tree, results) => {
15072
15901
  };
15073
15902
 
15074
15903
  // node_modules/effect/dist/cli/internal/command.js
15075
- var TypeId31 = "~effect/cli/Command";
15904
+ var TypeId34 = "~effect/cli/Command";
15076
15905
  var toImpl = (self) => self;
15077
- var Proto8 = {
15906
+ var Proto11 = {
15078
15907
  .../* @__PURE__ */ Prototype2({
15079
15908
  label: "Command",
15080
15909
  evaluate() {
@@ -15085,7 +15914,7 @@ var Proto8 = {
15085
15914
  var makeCommand = (options) => {
15086
15915
  const config = options.config;
15087
15916
  const contextConfig = options.contextConfig ?? emptyConfig;
15088
- const service = options.service ?? Service(`${TypeId31}/${options.name}`);
15917
+ const service = options.service ?? Service(`${TypeId34}/${options.name}`);
15089
15918
  const annotations = options.annotations ?? empty();
15090
15919
  const globalFlags = options.globalFlags ?? [];
15091
15920
  const subcommands = options.subcommands ?? [];
@@ -15139,7 +15968,7 @@ var makeCommand = (options) => {
15139
15968
  continue;
15140
15969
  subcommandDocs.push({
15141
15970
  group: group.group,
15142
- commands: map2(visible, (subcommand) => ({
15971
+ commands: map3(visible, (subcommand) => ({
15143
15972
  name: subcommand.name,
15144
15973
  alias: subcommand.alias,
15145
15974
  shortDescription: subcommand.shortDescription,
@@ -15164,8 +15993,8 @@ var makeCommand = (options) => {
15164
15993
  }
15165
15994
  };
15166
15995
  };
15167
- return Object.assign(Object.create(Proto8), {
15168
- [TypeId31]: TypeId31,
15996
+ return Object.assign(Object.create(Proto11), {
15997
+ [TypeId34]: TypeId34,
15169
15998
  name: options.name,
15170
15999
  examples: resolveExamples([options.name]),
15171
16000
  resolveExamples,
@@ -17344,7 +18173,7 @@ var promptSingle = (single) => {
17344
18173
  const message = renderParamMessage(single);
17345
18174
  switch (single.primitiveType._tag) {
17346
18175
  case "Boolean":
17347
- return map5(run3(Confirm({
18176
+ return map6(run3(Confirm({
17348
18177
  message,
17349
18178
  label: {
17350
18179
  confirm: "true",
@@ -17357,7 +18186,7 @@ var promptSingle = (single) => {
17357
18186
  })), (value) => commandLineArg(String(value)));
17358
18187
  case "Choice": {
17359
18188
  const choices = getChoiceKeys(single.primitiveType) ?? [];
17360
- return map5(run3(Select({
18189
+ return map6(run3(Select({
17361
18190
  message,
17362
18191
  choices: choices.map((choice) => ({
17363
18192
  title: choice,
@@ -17366,23 +18195,23 @@ var promptSingle = (single) => {
17366
18195
  })), commandLineArg);
17367
18196
  }
17368
18197
  case "Date":
17369
- return map5(run3(Date4({
18198
+ return map6(run3(Date5({
17370
18199
  message
17371
18200
  })), (date) => commandLineArg(date.toISOString()));
17372
18201
  case "Finite":
17373
- return map5(run3(Number7({
18202
+ return map6(run3(Number7({
17374
18203
  message
17375
18204
  })), (value) => commandLineArg(String(value)));
17376
18205
  case "Int":
17377
- return map5(run3(Int2({
18206
+ return map6(run3(Int2({
17378
18207
  message
17379
18208
  })), (value) => commandLineArg(String(value)));
17380
18209
  case "Redacted":
17381
- return map5(run3(Password({
18210
+ return map6(run3(Password({
17382
18211
  message
17383
18212
  })), (value) => commandLineArg(value2(value), "<redacted>"));
17384
18213
  default:
17385
- return map5(run3(String8({
18214
+ return map6(run3(String8({
17386
18215
  message
17387
18216
  })), commandLineArg);
17388
18217
  }
@@ -17443,8 +18272,8 @@ var wrapCommand = (commandLine) => {
17443
18272
  var formatShellArg = (arg) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'"'"'`)}'`;
17444
18273
 
17445
18274
  // node_modules/effect/dist/cli/Command.js
17446
- var isCommand = (u) => hasProperty(u, TypeId31);
17447
- var make27 = (name, config, handler) => {
18275
+ var isCommand = (u) => hasProperty(u, TypeId34);
18276
+ var make30 = (name, config, handler) => {
17448
18277
  const parsedConfig = parseConfig(config ?? {});
17449
18278
  return makeCommand({
17450
18279
  name,
@@ -17727,7 +18556,7 @@ var runWith2 = (command, config) => {
17727
18556
  }
17728
18557
  const services = match(logLevel, {
17729
18558
  onNone: () => empty(),
17730
- onSome: (level) => make2(MinimumLogLevel2, level)
18559
+ onSome: (level) => make3(MinimumLogLevel2, level)
17731
18560
  });
17732
18561
  yield* provideContext2(program, services);
17733
18562
  }, catchFilter2((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed2(error) : fail2(error), (error) => andThen2(showHelp(command, error, config.renderErrors !== false), fail7(error))), catchFilter2((error) => {
@@ -17744,39 +18573,912 @@ var runWith2 = (command, config) => {
17744
18573
  }) => andThen2(showUserError(error, userMessage), fail7(error))), catchFilter2((e) => isQuitError(e) ? succeed2(e) : fail2(e), (_) => interrupt2));
17745
18574
  };
17746
18575
  // package.json
17747
- var version = "0.0.2";
17748
- // src/process.ts
17749
- var run6 = fn2("Process.run")(function* run(command) {
17750
- const child = yield* command;
17751
- const output = yield* child.stdout.pipe(decodeText2(), mkString);
17752
- const code = yield* child.exitCode;
17753
- if (code !== 0) {
17754
- return yield* new UserError({
17755
- cause: `${command.command} exited with status ${code}.`
18576
+ var version = "0.0.4";
18577
+ // node_modules/effect/dist/http/HttpBody.js
18578
+ var TypeId35 = "~effect/http/HttpBody";
18579
+ var HttpBodyErrorTypeId = "~effect/http/HttpBody/HttpBodyError";
18580
+
18581
+ class HttpBodyError extends (/* @__PURE__ */ TaggedError2("HttpBodyError")) {
18582
+ [HttpBodyErrorTypeId] = HttpBodyErrorTypeId;
18583
+ }
18584
+ class Proto12 {
18585
+ [TypeId35];
18586
+ constructor() {
18587
+ this[TypeId35] = TypeId35;
18588
+ }
18589
+ [NodeInspectSymbol]() {
18590
+ return this.toJSON();
18591
+ }
18592
+ toString() {
18593
+ return format(this, {
18594
+ ignoreToString: true
17756
18595
  });
17757
18596
  }
17758
- return output;
17759
- }, scoped2);
17760
- var convex = (args, env, input) => run6(make17("bunx", ["--no-install", "convex", ...args], {
17761
- env,
17762
- extendEnv: true,
17763
- stderr: "inherit",
17764
- stdin: input === undefined ? "inherit" : make12(new TextEncoder().encode(input)),
17765
- stdout: "inherit"
18597
+ }
18598
+
18599
+ class Empty2 extends Proto12 {
18600
+ _tag = "Empty";
18601
+ toJSON() {
18602
+ return {
18603
+ _id: "effect/HttpBody",
18604
+ _tag: "Empty"
18605
+ };
18606
+ }
18607
+ }
18608
+ var empty7 = /* @__PURE__ */ new Empty2;
18609
+ class Uint8Array3 extends Proto12 {
18610
+ _tag = "Uint8Array";
18611
+ contentType;
18612
+ contentLength;
18613
+ text;
18614
+ _body;
18615
+ constructor(body, contentType, contentLength, text) {
18616
+ super();
18617
+ this._body = body;
18618
+ this.text = text;
18619
+ this.contentType = contentType;
18620
+ this.contentLength = contentLength;
18621
+ }
18622
+ get body() {
18623
+ return this._body ??= encodeText(this.text);
18624
+ }
18625
+ toJSON() {
18626
+ const toString = this.contentType.startsWith("text/") || this.contentType.endsWith("json");
18627
+ return {
18628
+ _id: "effect/HttpBody",
18629
+ _tag: "Uint8Array",
18630
+ body: toString ? new TextDecoder().decode(this.body) : `Uint8Array(${this.body.length})`,
18631
+ contentType: this.contentType,
18632
+ contentLength: this.contentLength
18633
+ };
18634
+ }
18635
+ }
18636
+ var encoder2 = /* @__PURE__ */ new TextEncoder;
18637
+ var buffer2 = globalThis.Buffer;
18638
+ var encodeText = buffer2 !== undefined ? (body) => buffer2.from(body, "utf8") : (body) => encoder2.encode(body);
18639
+ var text = (body, contentType) => {
18640
+ if (typeof body !== "string") {
18641
+ body = body === undefined ? "" : String(body);
18642
+ }
18643
+ if (buffer2 !== undefined) {
18644
+ return new Uint8Array3(undefined, contentType ?? "text/plain", buffer2.byteLength(body, "utf8"), body);
18645
+ }
18646
+ const bytes = encoder2.encode(body);
18647
+ return new Uint8Array3(bytes, contentType ?? "text/plain", bytes.length, body);
18648
+ };
18649
+ var json = (body, contentType) => try_3({
18650
+ try: () => text(JSON.stringify(body), contentType ?? "application/json"),
18651
+ catch: (cause) => new HttpBodyError({
18652
+ reason: {
18653
+ _tag: "JsonError"
18654
+ },
18655
+ cause
18656
+ })
18657
+ });
18658
+
18659
+ // node_modules/effect/dist/http/HttpClientError.js
18660
+ var TypeId36 = "~effect/http/HttpClientError";
18661
+ class HttpClientError extends (/* @__PURE__ */ TaggedError2("HttpClientError")) {
18662
+ constructor(props) {
18663
+ if ("cause" in props.reason) {
18664
+ super({
18665
+ ...props,
18666
+ cause: props.reason.cause
18667
+ });
18668
+ } else {
18669
+ super(props);
18670
+ }
18671
+ }
18672
+ [TypeId36] = TypeId36;
18673
+ get request() {
18674
+ return this.reason.request;
18675
+ }
18676
+ get response() {
18677
+ return "response" in this.reason ? this.reason.response : undefined;
18678
+ }
18679
+ get message() {
18680
+ return this.reason.message;
18681
+ }
18682
+ }
18683
+ var formatReason = (tag) => tag.endsWith("Error") ? tag.slice(0, -5) : tag;
18684
+ var formatMessage = (reason, description, info) => description ? `${reason}: ${description} (${info})` : `${reason} error (${info})`;
18685
+ var formatMethodAndUrl = (request) => `${request.method} ${redactUrl(request.url)}`;
18686
+ var reasonToJSON = (reason, json) => ({
18687
+ ...json,
18688
+ request: {
18689
+ _id: "HttpClientRequest",
18690
+ method: reason.request.method,
18691
+ url: redactUrl(reason.request.url)
18692
+ },
18693
+ ..."response" in reason ? {
18694
+ response: {
18695
+ _id: "HttpClientResponse",
18696
+ status: reason.response.status
18697
+ }
18698
+ } : undefined
18699
+ });
18700
+
18701
+ class TransportError extends (/* @__PURE__ */ TaggedError2("TransportError")) {
18702
+ get methodAndUrl() {
18703
+ return formatMethodAndUrl(this.request);
18704
+ }
18705
+ get message() {
18706
+ return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);
18707
+ }
18708
+ toJSON() {
18709
+ return reasonToJSON(this, super.toJSON());
18710
+ }
18711
+ }
18712
+
18713
+ class EncodeError extends (/* @__PURE__ */ TaggedError2("EncodeError")) {
18714
+ get methodAndUrl() {
18715
+ return formatMethodAndUrl(this.request);
18716
+ }
18717
+ get message() {
18718
+ return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);
18719
+ }
18720
+ toJSON() {
18721
+ return reasonToJSON(this, super.toJSON());
18722
+ }
18723
+ }
18724
+
18725
+ class InvalidUrlError extends (/* @__PURE__ */ TaggedError2("InvalidUrlError")) {
18726
+ get methodAndUrl() {
18727
+ return formatMethodAndUrl(this.request);
18728
+ }
18729
+ get message() {
18730
+ return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);
18731
+ }
18732
+ toJSON() {
18733
+ return reasonToJSON(this, super.toJSON());
18734
+ }
18735
+ }
18736
+
18737
+ class StatusCodeError extends (/* @__PURE__ */ TaggedError2("StatusCodeError")) {
18738
+ get methodAndUrl() {
18739
+ return formatMethodAndUrl(this.request);
18740
+ }
18741
+ get message() {
18742
+ const info = `${this.response.status} ${this.methodAndUrl}`;
18743
+ return formatMessage(formatReason(this._tag), this.description, info);
18744
+ }
18745
+ toJSON() {
18746
+ return reasonToJSON(this, super.toJSON());
18747
+ }
18748
+ }
18749
+
18750
+ class DecodeError extends (/* @__PURE__ */ TaggedError2("DecodeError")) {
18751
+ get methodAndUrl() {
18752
+ return formatMethodAndUrl(this.request);
18753
+ }
18754
+ get message() {
18755
+ const info = `${this.response.status} ${this.methodAndUrl}`;
18756
+ return formatMessage(formatReason(this._tag), this.description, info);
18757
+ }
18758
+ toJSON() {
18759
+ return reasonToJSON(this, super.toJSON());
18760
+ }
18761
+ }
18762
+
18763
+ class EmptyBodyError extends (/* @__PURE__ */ TaggedError2("EmptyBodyError")) {
18764
+ get methodAndUrl() {
18765
+ return formatMethodAndUrl(this.request);
18766
+ }
18767
+ get message() {
18768
+ const info = `${this.response.status} ${this.methodAndUrl}`;
18769
+ return formatMessage(formatReason(this._tag), this.description, info);
18770
+ }
18771
+ toJSON() {
18772
+ return reasonToJSON(this, super.toJSON());
18773
+ }
18774
+ }
18775
+
18776
+ // node_modules/effect/dist/http/HttpMethod.js
18777
+ var allShort = [["GET", "get"], ["POST", "post"], ["PUT", "put"], ["DELETE", "del"], ["PATCH", "patch"], ["HEAD", "head"], ["OPTIONS", "options"], ["TRACE", "trace"], ["QUERY", "query"]];
18778
+
18779
+ // node_modules/effect/dist/http/internal/httpBody.js
18780
+ var updateHeaders = (headers, body) => {
18781
+ if (body._tag === "Empty" || body._tag === "FormData") {
18782
+ return remove3(remove3(headers, "content-type"), "content-length");
18783
+ }
18784
+ headers = body.contentType === undefined ? remove3(headers, "content-type") : set2(headers, "content-type", body.contentType);
18785
+ return updateContentLength(headers, body);
18786
+ };
18787
+ var updateContentLength = (headers, body) => {
18788
+ const contentLength = body._tag === "Empty" || body._tag === "FormData" ? undefined : body.contentLength;
18789
+ return contentLength === undefined ? remove3(headers, "content-length") : set2(headers, "content-length", contentLength.toString());
18790
+ };
18791
+
18792
+ // node_modules/effect/dist/http/Url.js
18793
+ class UrlError extends (/* @__PURE__ */ TaggedError2("UrlError")) {
18794
+ }
18795
+ var make31 = (url, params, hash) => try_({
18796
+ try: () => {
18797
+ const urlInstance = new URL(url, baseUrl());
18798
+ for (let i = 0;i < params.params.length; i++) {
18799
+ const [key, value] = params.params[i];
18800
+ if (value !== undefined) {
18801
+ urlInstance.searchParams.append(key, unwrap6(value));
18802
+ }
18803
+ }
18804
+ if (hash !== undefined) {
18805
+ urlInstance.hash = hash;
18806
+ }
18807
+ return urlInstance;
18808
+ },
18809
+ catch: (cause) => new UrlError({
18810
+ cause
18811
+ })
18812
+ });
18813
+ var baseUrl = () => {
18814
+ if ("location" in globalThis && globalThis.location !== undefined && globalThis.location.origin !== undefined && globalThis.location.pathname !== undefined) {
18815
+ const base = location.origin + location.pathname;
18816
+ try {
18817
+ return new URL(base).href;
18818
+ } catch {
18819
+ return;
18820
+ }
18821
+ }
18822
+ return;
18823
+ };
18824
+
18825
+ // node_modules/effect/dist/http/HttpClientRequest.js
18826
+ var TypeId37 = "~effect/http/HttpClientRequest";
18827
+ var Proto13 = {
18828
+ [TypeId37]: TypeId37,
18829
+ ...BaseProto,
18830
+ toJSON() {
18831
+ return {
18832
+ _id: "HttpClientRequest",
18833
+ method: this.method,
18834
+ url: redactUrl(this.url),
18835
+ urlParams: this.urlParams,
18836
+ hash: this.hash,
18837
+ headers: redact(this.headers),
18838
+ body: this.body.toJSON()
18839
+ };
18840
+ },
18841
+ pipe() {
18842
+ return pipeArguments(this, arguments);
18843
+ }
18844
+ };
18845
+ function makeWith(method, url, urlParams, hash, headers, body) {
18846
+ const self = Object.create(Proto13);
18847
+ self.method = method;
18848
+ self.url = url;
18849
+ self.urlParams = urlParams;
18850
+ self.hash = hash;
18851
+ self.headers = headers;
18852
+ self.body = body;
18853
+ return self;
18854
+ }
18855
+ var empty8 = /* @__PURE__ */ makeWith("GET", "", empty6, /* @__PURE__ */ none2(), empty5, empty7);
18856
+ var make32 = (method) => (url, options) => modify(empty8, {
18857
+ method,
18858
+ url,
18859
+ ...options ?? undefined
18860
+ });
18861
+ var get4 = /* @__PURE__ */ make32("GET");
18862
+ var post = /* @__PURE__ */ make32("POST");
18863
+ var modify = /* @__PURE__ */ dual(2, (self, options) => {
18864
+ let result = self;
18865
+ if (options.method) {
18866
+ result = setMethod(result, options.method);
18867
+ }
18868
+ if (options.url) {
18869
+ result = setUrl(result, options.url);
18870
+ }
18871
+ if (options.headers) {
18872
+ result = setHeaders(result, options.headers);
18873
+ }
18874
+ if (options.urlParams) {
18875
+ result = setUrlParams(result, options.urlParams);
18876
+ }
18877
+ if (options.hash) {
18878
+ result = setHash(result, options.hash);
18879
+ }
18880
+ if (options.body) {
18881
+ result = setBody(result, options.body);
18882
+ }
18883
+ if (options.accept) {
18884
+ result = accept(result, options.accept);
18885
+ }
18886
+ if (options.acceptJson) {
18887
+ result = acceptJson(result);
18888
+ }
18889
+ return result;
18890
+ });
18891
+ var setMethod = /* @__PURE__ */ dual(2, (self, method) => makeWith(method, self.url, self.urlParams, self.hash, self.headers, self.body));
18892
+ var setHeader = /* @__PURE__ */ dual(3, (self, key, value) => makeWith(self.method, self.url, self.urlParams, self.hash, set2(self.headers, key, value), self.body));
18893
+ var setHeaders = /* @__PURE__ */ dual(2, (self, input) => makeWith(self.method, self.url, self.urlParams, self.hash, setAll(self.headers, input), self.body));
18894
+ var accept = /* @__PURE__ */ dual(2, (self, mediaType) => setHeader(self, "Accept", mediaType));
18895
+ var acceptJson = /* @__PURE__ */ accept("application/json");
18896
+ var setUrl = /* @__PURE__ */ dual(2, (self, url) => {
18897
+ if (typeof url === "string") {
18898
+ return makeWith(self.method, url, self.urlParams, self.hash, self.headers, self.body);
18899
+ }
18900
+ const clone = new URL(url.toString());
18901
+ const urlParams = fromInput2(clone.searchParams);
18902
+ const hash = fromNullishOr(clone.hash === "" ? undefined : clone.hash.slice(1));
18903
+ clone.search = "";
18904
+ clone.hash = "";
18905
+ return makeWith(self.method, clone.toString(), urlParams, hash, self.headers, self.body);
18906
+ });
18907
+ var setUrlParams = /* @__PURE__ */ dual(2, (self, input) => makeWith(self.method, self.url, setAll2(self.urlParams, input), self.hash, self.headers, self.body));
18908
+ var setHash = /* @__PURE__ */ dual(2, (self, hash) => makeWith(self.method, self.url, self.urlParams, some2(hash), self.headers, self.body));
18909
+ var setBody = /* @__PURE__ */ dual(2, (self, body) => {
18910
+ return makeWith(self.method, self.url, self.urlParams, self.hash, updateHeaders(self.headers, body), body);
18911
+ });
18912
+ var bodyJson = /* @__PURE__ */ dual(2, (self, body) => map6(json(body), (body) => setBody(self, body)));
18913
+ function toUrl(self) {
18914
+ const r = make31(self.url, self.urlParams, getOrUndefined(self.hash));
18915
+ if (isSuccess2(r)) {
18916
+ return some2(r.success);
18917
+ }
18918
+ return none2();
18919
+ }
18920
+
18921
+ // node_modules/effect/dist/http/HttpIncomingMessage.js
18922
+ var TypeId38 = "~effect/http/HttpIncomingMessage";
18923
+ var inspect = (self, that) => {
18924
+ return {
18925
+ ...that,
18926
+ headers: redact(self.headers),
18927
+ remoteAddress: self.remoteAddress
18928
+ };
18929
+ };
18930
+
18931
+ // node_modules/effect/dist/http/internal/webResponse.js
18932
+ var WebSourceSymbol = "~effect/http/HttpClientResponse/WebSource";
18933
+ var getWebSource = (self) => self[WebSourceSymbol]?.();
18934
+
18935
+ // node_modules/effect/dist/http/HttpClientResponse.js
18936
+ var TypeId39 = "~effect/http/HttpClientResponse";
18937
+ var fromWeb = (request, source) => new WebHttpClientResponse(request, source);
18938
+ var filterStatusOk = (self) => self.status >= 200 && self.status < 300 ? succeed6(self) : fail7(new HttpClientError({
18939
+ reason: new StatusCodeError({
18940
+ response: self,
18941
+ request: self.request,
18942
+ description: "non 2xx status code"
18943
+ })
17766
18944
  }));
17767
18945
 
17768
- // src/dotenv.ts
17769
- var dotenvx = fn2("Dotenvx.run")(function* dotenvx(args, capture) {
17770
- const path = yield* Path;
17771
- const bin = yield* path.fromFileUrl(new URL("src/cli/dotenvx.js", import.meta.resolve("@dotenvx/dotenvx/package.json")));
17772
- return yield* run6(make17("bun", [bin, ...args], {
17773
- stderr: capture ? "ignore" : "inherit",
17774
- stdin: "inherit",
17775
- stdout: capture ? "pipe" : "inherit"
17776
- }));
18946
+ class WebHttpClientResponse extends Class2 {
18947
+ [TypeId38];
18948
+ [TypeId39];
18949
+ request;
18950
+ source;
18951
+ constructor(request, source) {
18952
+ super();
18953
+ this.request = request;
18954
+ this.source = source;
18955
+ this[TypeId38] = TypeId38;
18956
+ this[TypeId39] = TypeId39;
18957
+ }
18958
+ toJSON() {
18959
+ return inspect(this, {
18960
+ _id: "HttpClientResponse",
18961
+ request: this.request.toJSON(),
18962
+ status: this.status
18963
+ });
18964
+ }
18965
+ get status() {
18966
+ return this.source.status;
18967
+ }
18968
+ get url() {
18969
+ if (this.source.url)
18970
+ return this.source.url.split("#")[0];
18971
+ const url = toUrl(this.request);
18972
+ if (isNone2(url))
18973
+ return "";
18974
+ url.value.hash = "";
18975
+ return url.value.href;
18976
+ }
18977
+ get headers() {
18978
+ return fromInput(this.source.headers);
18979
+ }
18980
+ cachedCookies;
18981
+ get cookies() {
18982
+ if (this.cachedCookies) {
18983
+ return this.cachedCookies;
18984
+ }
18985
+ return this.cachedCookies = fromSetCookie(this.source.headers.getSetCookie?.() ?? []);
18986
+ }
18987
+ get remoteAddress() {
18988
+ return none2();
18989
+ }
18990
+ [WebSourceSymbol]() {
18991
+ return this.source;
18992
+ }
18993
+ get stream() {
18994
+ return this.source.body ? fromReadableStream2({
18995
+ evaluate: () => this.source.body,
18996
+ onError: (cause) => new HttpClientError({
18997
+ reason: new DecodeError({
18998
+ request: this.request,
18999
+ response: this,
19000
+ cause
19001
+ })
19002
+ })
19003
+ }) : fail9(new HttpClientError({
19004
+ reason: new EmptyBodyError({
19005
+ request: this.request,
19006
+ response: this,
19007
+ description: "can not create stream from empty body"
19008
+ })
19009
+ }));
19010
+ }
19011
+ get json() {
19012
+ return flatMap3(this.text, (text) => try_3({
19013
+ try: () => text === "" ? null : JSON.parse(text),
19014
+ catch: (cause) => new HttpClientError({
19015
+ reason: new DecodeError({
19016
+ request: this.request,
19017
+ response: this,
19018
+ cause
19019
+ })
19020
+ })
19021
+ }));
19022
+ }
19023
+ textBody;
19024
+ get text() {
19025
+ return this.textBody ??= map6(this.arrayBuffer, (_) => new TextDecoder().decode(_));
19026
+ }
19027
+ get urlParamsBody() {
19028
+ return flatMap3(this.arrayBuffer, (bytes) => try_3({
19029
+ try: () => fromInput2(fromBody(bytes)),
19030
+ catch: (cause) => new HttpClientError({
19031
+ reason: new DecodeError({
19032
+ request: this.request,
19033
+ response: this,
19034
+ cause
19035
+ })
19036
+ })
19037
+ }));
19038
+ }
19039
+ formDataBody;
19040
+ get formData() {
19041
+ return this.formDataBody ??= tryPromise2({
19042
+ try: () => this.source.formData(),
19043
+ catch: (cause) => new HttpClientError({
19044
+ reason: new DecodeError({
19045
+ request: this.request,
19046
+ response: this,
19047
+ cause
19048
+ })
19049
+ })
19050
+ }).pipe(cached2, runSync2);
19051
+ }
19052
+ arrayBufferBody;
19053
+ get arrayBuffer() {
19054
+ if (this.arrayBufferBody) {
19055
+ return this.arrayBufferBody;
19056
+ }
19057
+ this.arrayBufferBody = tryPromise2({
19058
+ try: () => this.source.arrayBuffer(),
19059
+ catch: (cause) => new HttpClientError({
19060
+ reason: new DecodeError({
19061
+ request: this.request,
19062
+ response: this,
19063
+ cause
19064
+ })
19065
+ })
19066
+ }).pipe(cached2, runSync2);
19067
+ return this.arrayBufferBody;
19068
+ }
19069
+ get upgrade() {
19070
+ return fail7(new HttpClientError({
19071
+ reason: new StatusCodeError({
19072
+ request: this.request,
19073
+ response: this,
19074
+ description: "fetch cannot hand over the connection of an HTTP upgrade"
19075
+ })
19076
+ }));
19077
+ }
19078
+ pipe() {
19079
+ return pipeArguments(this, arguments);
19080
+ }
19081
+ }
19082
+
19083
+ // node_modules/effect/dist/http/HttpTraceContext.js
19084
+ var toHeaders = (span) => fromRecordUnsafe({
19085
+ b3: `${span.traceId}-${span.spanId}-${span.sampled ? "1" : "0"}${match(span.parent, {
19086
+ onNone: () => "",
19087
+ onSome: (parent) => `-${parent.spanId}`
19088
+ })}`,
19089
+ traceparent: `00-${span.traceId.padStart(32, "0")}-${span.spanId}-${span.sampled ? "01" : "00"}`
17777
19090
  });
17778
- var decrypt = (file) => dotenvx(["decrypt", "--stdout", "--no-armor", "--no-native", "-f", file], true);
17779
19091
 
19092
+ // node_modules/effect/dist/http/internal/tracing.js
19093
+ var defaultPorts = {
19094
+ "http:": 80,
19095
+ "https:": 443,
19096
+ "ws:": 80,
19097
+ "wss:": 443
19098
+ };
19099
+ var addUrlAttributes = (span, url, redactedNames) => {
19100
+ const query = redactUrl(url.search, redactedNames).slice(1);
19101
+ span.attribute("url.full", redactUrl(url.href, redactedNames));
19102
+ span.attribute("url.path", url.pathname);
19103
+ if (query !== "") {
19104
+ span.attribute("url.query", query);
19105
+ }
19106
+ span.attribute("url.scheme", url.protocol.slice(0, -1));
19107
+ if (url.hostname !== "") {
19108
+ span.attribute("server.address", url.hostname.startsWith("[") ? url.hostname.slice(1, -1) : url.hostname);
19109
+ const port = url.port === "" ? defaultPorts[url.protocol] : Number(url.port);
19110
+ if (port !== undefined) {
19111
+ span.attribute("server.port", port);
19112
+ }
19113
+ }
19114
+ };
19115
+ var redactedNames = (urlParams, redactedNames) => {
19116
+ const keys = urlParams.params.filter(([, value]) => typeof value !== "string").map(([key]) => key);
19117
+ return keys.length === 0 ? redactedNames : [...redactedNames, ...new URLSearchParams(keys.map((key) => [key, ""])).keys()];
19118
+ };
19119
+ var addHeaderAttributes = (span, phase, headers, filter, redactedNames) => {
19120
+ for (const name in headers) {
19121
+ if (!filter(name, phase))
19122
+ continue;
19123
+ span.attribute(`http.${phase}.header.${name}`, isRedactedName(name, redactedNames) ? "<redacted>" : headers[name]);
19124
+ }
19125
+ };
19126
+
19127
+ // node_modules/effect/dist/http/HttpClient.js
19128
+ var TypeId40 = "~effect/http/HttpClient";
19129
+ var HttpClient = /* @__PURE__ */ Service("effect/HttpClient");
19130
+ var transformResponse = /* @__PURE__ */ dual(2, (self, f) => makeWith2((request) => f(self.postprocess(request)), self.preprocess));
19131
+ var filterStatusOk2 = /* @__PURE__ */ transformResponse(/* @__PURE__ */ flatMap3(filterStatusOk));
19132
+ var makeWith2 = (postprocess, preprocess) => {
19133
+ const self = Object.create(Proto14);
19134
+ self.preprocess = preprocess;
19135
+ self.postprocess = postprocess;
19136
+ self.execute = function(request) {
19137
+ return postprocess(preprocess(request));
19138
+ };
19139
+ return self;
19140
+ };
19141
+ var Proto14 = {
19142
+ [TypeId40]: TypeId40,
19143
+ pipe() {
19144
+ return pipeArguments(this, arguments);
19145
+ },
19146
+ ...BaseProto,
19147
+ toJSON() {
19148
+ return {
19149
+ _id: "effect/HttpClient"
19150
+ };
19151
+ },
19152
+ .../* @__PURE__ */ Object.fromEntries(/* @__PURE__ */ allShort.map(([fullMethod, method]) => [method, function(url, options) {
19153
+ return this.execute(make32(fullMethod)(url, options));
19154
+ }]))
19155
+ };
19156
+ var make33 = (f) => makeWith2((effect) => flatMap3(effect, (request) => withFiber2((fiber) => {
19157
+ const scopedController = scopedRequests.get(request);
19158
+ const controller = scopedController ?? new AbortController;
19159
+ const urlResult = make31(request.url, request.urlParams, getOrUndefined(request.hash));
19160
+ if (isFailure2(urlResult)) {
19161
+ return fail7(new HttpClientError({
19162
+ reason: new InvalidUrlError({
19163
+ request,
19164
+ cause: urlResult.failure
19165
+ })
19166
+ }));
19167
+ }
19168
+ const url = urlResult.success;
19169
+ const tracerDisabled = fiber.getRef(DisablePropagation) || fiber.getRef(TracerDisabledWhen)(request);
19170
+ if (tracerDisabled) {
19171
+ const effect = f(request, url, controller.signal, fiber);
19172
+ if (scopedController)
19173
+ return map6(effect, (response) => trackResponse(response, controller, true));
19174
+ return uninterruptibleMask2((restore) => matchCauseEffect2(restore(effect), {
19175
+ onSuccess(response) {
19176
+ return succeed6(trackResponse(response, controller, false));
19177
+ },
19178
+ onFailure(cause) {
19179
+ if (hasInterrupts2(cause)) {
19180
+ controller.abort();
19181
+ }
19182
+ return failCause3(cause);
19183
+ }
19184
+ }));
19185
+ }
19186
+ return useSpan2(fiber.getRef(SpanNameGenerator)(request), {
19187
+ kind: "client"
19188
+ }, (span) => {
19189
+ span.attribute("http.request.method", request.method);
19190
+ const redactedHeaderNames = fiber.getRef(CurrentRedactedNames);
19191
+ addUrlAttributes(span, url, redactedNames(request.urlParams, fiber.getRef(CurrentRedactedNames2)));
19192
+ const headerFilter = fiber.getRef(TracerHeaderFilter);
19193
+ addHeaderAttributes(span, "request", request.headers, headerFilter, redactedHeaderNames);
19194
+ request = fiber.getRef(TracerPropagationEnabled) ? setHeaders(request, toHeaders(span)) : request;
19195
+ return uninterruptibleMask2((restore) => restore(f(request, url, controller.signal, fiber)).pipe(withParentSpan2(span, {
19196
+ captureStackTrace: false
19197
+ }), matchCauseEffect2({
19198
+ onSuccess: (response) => {
19199
+ span.attribute("http.response.status_code", response.status);
19200
+ addHeaderAttributes(span, "response", response.headers, headerFilter, redactedHeaderNames);
19201
+ if (response.status >= 400 && response.status < 600) {
19202
+ span.attribute("error.type", String(response.status));
19203
+ endSpanWithStatusError(fiber, span, request, response);
19204
+ }
19205
+ return succeed6(trackResponse(response, controller, scopedController !== undefined));
19206
+ },
19207
+ onFailure(cause) {
19208
+ if (!scopedController && hasInterrupts2(cause)) {
19209
+ controller.abort();
19210
+ }
19211
+ return failCause3(cause);
19212
+ }
19213
+ })));
19214
+ });
19215
+ })), succeed6);
19216
+ var endSpanWithStatusError = (fiber, span, request, response) => {
19217
+ const stackTraceLimit = getStackTraceLimit();
19218
+ setStackTraceLimit(0);
19219
+ let exit;
19220
+ try {
19221
+ exit = fail5(new HttpClientError({
19222
+ reason: new StatusCodeError({
19223
+ request,
19224
+ response
19225
+ })
19226
+ }));
19227
+ } finally {
19228
+ setStackTraceLimit(stackTraceLimit);
19229
+ }
19230
+ span.end(fiber.getRef(TracerTimingEnabled2) ? fiber.getRef(Clock).currentTimeNanosUnsafe() : BigInt(0), exit);
19231
+ };
19232
+ var TracerDisabledWhen = /* @__PURE__ */ Reference("effect/http/HttpClient/TracerDisabledWhen", {
19233
+ defaultValue: () => constFalse
19234
+ });
19235
+ var TracerHeaderFilter = /* @__PURE__ */ Reference("effect/http/HttpClient/TracerHeaderFilter", {
19236
+ defaultValue: () => constFalse
19237
+ });
19238
+ var TracerPropagationEnabled = /* @__PURE__ */ Reference("effect/http/HttpClient/TracerPropagationEnabled", {
19239
+ defaultValue: constTrue
19240
+ });
19241
+ var SpanNameGenerator = /* @__PURE__ */ Reference("effect/http/HttpClient/SpanNameGenerator", {
19242
+ defaultValue: () => (request) => request.method
19243
+ });
19244
+ var layerMergedContext = (effect2) => effect(HttpClient)(contextWith2((context) => map6(effect2, (client) => transformResponse(client, updateContext2((input) => merge(context, input))))));
19245
+ var responseRegistry = /* @__PURE__ */ (() => {
19246
+ if ("FinalizationRegistry" in globalThis && globalThis.FinalizationRegistry) {
19247
+ const registry = /* @__PURE__ */ new FinalizationRegistry((controller) => {
19248
+ try {
19249
+ controller.abort();
19250
+ } catch {}
19251
+ });
19252
+ return {
19253
+ register(response, controller) {
19254
+ registry.register(response, controller, response);
19255
+ },
19256
+ unregister(response) {
19257
+ registry.unregister(response);
19258
+ }
19259
+ };
19260
+ }
19261
+ const timers = /* @__PURE__ */ new WeakMap;
19262
+ return {
19263
+ register(response, controller) {
19264
+ timers.set(response, setTimeout(() => controller.abort(), 5000));
19265
+ },
19266
+ unregister(response) {
19267
+ const timer = timers.get(response);
19268
+ if (timer === undefined)
19269
+ return;
19270
+ clearTimeout(timer);
19271
+ timers.delete(response);
19272
+ }
19273
+ };
19274
+ })();
19275
+ var scopedRequests = /* @__PURE__ */ new WeakMap;
19276
+ var responseControllers = /* @__PURE__ */ new WeakMap;
19277
+ var trackResponse = (response, controller, scoped) => {
19278
+ if (!scoped) {
19279
+ responseRegistry.register(response, controller);
19280
+ response = new InterruptibleResponse(response, controller);
19281
+ }
19282
+ responseControllers.set(response, controller);
19283
+ return response;
19284
+ };
19285
+
19286
+ class InterruptibleResponse {
19287
+ original;
19288
+ controller;
19289
+ constructor(original, controller) {
19290
+ this.original = original;
19291
+ this.controller = controller;
19292
+ }
19293
+ [TypeId39] = TypeId39;
19294
+ [TypeId38] = TypeId38;
19295
+ applyInterrupt(effect) {
19296
+ return suspend2(() => {
19297
+ responseRegistry.unregister(this.original);
19298
+ return onInterrupt2(effect, () => sync2(() => {
19299
+ this.controller.abort();
19300
+ }));
19301
+ });
19302
+ }
19303
+ get request() {
19304
+ return this.original.request;
19305
+ }
19306
+ get url() {
19307
+ return this.original.url;
19308
+ }
19309
+ get status() {
19310
+ return this.original.status;
19311
+ }
19312
+ get headers() {
19313
+ return this.original.headers;
19314
+ }
19315
+ get cookies() {
19316
+ return this.original.cookies;
19317
+ }
19318
+ get remoteAddress() {
19319
+ return this.original.remoteAddress;
19320
+ }
19321
+ get formData() {
19322
+ return this.applyInterrupt(this.original.formData);
19323
+ }
19324
+ get text() {
19325
+ return this.applyInterrupt(this.original.text);
19326
+ }
19327
+ get json() {
19328
+ return this.applyInterrupt(this.original.json);
19329
+ }
19330
+ get urlParamsBody() {
19331
+ return this.applyInterrupt(this.original.urlParamsBody);
19332
+ }
19333
+ get arrayBuffer() {
19334
+ return this.applyInterrupt(this.original.arrayBuffer);
19335
+ }
19336
+ get upgrade() {
19337
+ return this.applyInterrupt(this.original.upgrade);
19338
+ }
19339
+ [WebSourceSymbol]() {
19340
+ const source = getWebSource(this.original);
19341
+ if (source !== undefined)
19342
+ responseRegistry.unregister(this.original);
19343
+ return source;
19344
+ }
19345
+ get stream() {
19346
+ return suspend4(() => {
19347
+ responseRegistry.unregister(this.original);
19348
+ return ensuring4(this.original.stream, sync2(() => {
19349
+ this.controller.abort();
19350
+ }));
19351
+ });
19352
+ }
19353
+ toJSON() {
19354
+ return this.original.toJSON();
19355
+ }
19356
+ [NodeInspectSymbol]() {
19357
+ return this.original[NodeInspectSymbol]();
19358
+ }
19359
+ pipe() {
19360
+ return pipeArguments(this, arguments);
19361
+ }
19362
+ }
19363
+
19364
+ // node_modules/effect/dist/http/FetchHttpClient.js
19365
+ var Fetch = /* @__PURE__ */ Reference("effect/http/FetchHttpClient/Fetch", {
19366
+ defaultValue: () => globalThis.fetch
19367
+ });
19368
+ var StreamBodyFallback = /* @__PURE__ */ Reference("effect/http/FetchHttpClient/StreamBodyFallback", {
19369
+ defaultValue: () => "error"
19370
+ });
19371
+
19372
+ class RequestInit extends (/* @__PURE__ */ Service()("effect/http/FetchHttpClient/RequestInit")) {
19373
+ }
19374
+ var supportsStreamBody;
19375
+ var detectStreamBodySupport = () => {
19376
+ try {
19377
+ let duplexAccessed = false;
19378
+ const body = new ReadableStream;
19379
+ const request = new Request("https://example.com", {
19380
+ method: "POST",
19381
+ body,
19382
+ get duplex() {
19383
+ duplexAccessed = true;
19384
+ return "half";
19385
+ }
19386
+ });
19387
+ return (duplexAccessed || request.body === body) && !request.headers.has("Content-Type");
19388
+ } catch {
19389
+ return false;
19390
+ }
19391
+ };
19392
+ var fetch = /* @__PURE__ */ make33((request, url, signal, fiber) => {
19393
+ if (request.headers.upgrade !== undefined) {
19394
+ return fail7(new HttpClientError({
19395
+ reason: new TransportError({
19396
+ request,
19397
+ description: "fetch cannot send an HTTP upgrade request"
19398
+ })
19399
+ }));
19400
+ }
19401
+ const fetch = fiber.getRef(Fetch);
19402
+ const options = getOrUndefined2(fiber.context, RequestInit) ?? {};
19403
+ let headers = options.headers ? merge4(fromInput(options.headers), request.headers) : request.headers;
19404
+ if (headers["content-length"]) {
19405
+ headers = remove3(headers, "content-length");
19406
+ }
19407
+ let uploadController;
19408
+ const stopUpload = sync2(() => uploadController?.abort());
19409
+ const send = (body) => map6(tryPromise2({
19410
+ try: () => fetch(url, {
19411
+ ...options,
19412
+ method: request.method,
19413
+ headers,
19414
+ body,
19415
+ duplex: typeof ReadableStream !== "undefined" && body instanceof ReadableStream ? "half" : undefined,
19416
+ signal: uploadController ? AbortSignal.any([signal, uploadController.signal]) : signal
19417
+ }),
19418
+ catch: (cause) => new HttpClientError({
19419
+ reason: new TransportError({
19420
+ request,
19421
+ cause
19422
+ })
19423
+ })
19424
+ }), (response) => {
19425
+ const original = fromWeb(request, response);
19426
+ if (!uploadController)
19427
+ return original;
19428
+ if (response.body === null)
19429
+ uploadController.abort();
19430
+ return Object.create(original, {
19431
+ ...Object.fromEntries(["arrayBuffer", "text", "json", "formData", "urlParamsBody"].map((key) => [key, {
19432
+ get: () => ensuring2(original[key], stopUpload)
19433
+ }])),
19434
+ stream: {
19435
+ get: () => ensuring4(original.stream, stopUpload)
19436
+ }
19437
+ });
19438
+ }).pipe(onError2(() => stopUpload));
19439
+ switch (request.body._tag) {
19440
+ case "Raw":
19441
+ case "Uint8Array":
19442
+ return send(request.body.body);
19443
+ case "FormData":
19444
+ return send(request.body.formData);
19445
+ case "Stream": {
19446
+ supportsStreamBody ??= detectStreamBodySupport();
19447
+ if (supportsStreamBody) {
19448
+ uploadController = new AbortController;
19449
+ const uploadSignal = AbortSignal.any([signal, uploadController.signal]);
19450
+ const stopped = callback2((resume) => {
19451
+ const onAbort = () => resume(interrupt2);
19452
+ if (uploadSignal.aborted) {
19453
+ onAbort();
19454
+ return;
19455
+ }
19456
+ uploadSignal.addEventListener("abort", onAbort, {
19457
+ once: true
19458
+ });
19459
+ return sync2(() => uploadSignal.removeEventListener("abort", onAbort));
19460
+ });
19461
+ return flatMap3(toReadableStreamEffect(interruptWhen2(request.body.stream, stopped)), send);
19462
+ }
19463
+ if (fiber.getRef(StreamBodyFallback) === "error") {
19464
+ return fail7(new HttpClientError({
19465
+ reason: new EncodeError({
19466
+ request,
19467
+ description: "Streaming request bodies are not supported in this runtime"
19468
+ })
19469
+ }));
19470
+ }
19471
+ return mkArrayBuffer(request.body.stream).pipe(mapError2((cause) => new HttpClientError({
19472
+ reason: new EncodeError({
19473
+ request,
19474
+ cause
19475
+ })
19476
+ })), flatMap3(send));
19477
+ }
19478
+ }
19479
+ return send(undefined);
19480
+ });
19481
+ var layer11 = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed6(fetch));
17780
19482
  // src/environment.ts
17781
19483
  import { getSync } from "@dotenvx/dotenvx";
17782
19484
  var Environment = Literals(["development", "preview", "production", "ci"]);
@@ -17789,7 +19491,7 @@ var options = {
17789
19491
  strict: true
17790
19492
  };
17791
19493
  var read2 = fn2("Environment.read")(function* read(file) {
17792
- return yield* try_2({
19494
+ return yield* try_3({
17793
19495
  catch: () => new UserError({
17794
19496
  cause: `Cannot load ${file}; check the file and its DOTENV_PRIVATE_KEY.`
17795
19497
  }),
@@ -17826,12 +19528,51 @@ var load = fn2("Environment.load")(function* load() {
17826
19528
  var exports = fn2("Environment.exports")(function* exports() {
17827
19529
  const { values } = yield* load();
17828
19530
  const variables = yield* decodeEffect2(ShellEnvironment, { onExcessProperty: "error" })(values).pipe(mapError2(() => new UserError({ cause: "Environment contains an invalid shell variable name." })));
17829
- const lines = yield* forEach2(toEntries(variables), ([key, value]) => fromResult2(quote(`${key}=${value}`, { format: "posix" })).pipe(map5((assignment) => `export ${assignment}`)));
19531
+ const lines = yield* forEach2(toEntries(variables), ([key, value]) => fromResult2(quote(`${key}=${value}`, { format: "posix" })).pipe(map6((assignment) => `export ${assignment}`)));
17830
19532
  return join(lines, `
17831
19533
  `);
17832
19534
  });
17833
19535
 
19536
+ // src/process.ts
19537
+ var run6 = fn2("Process.run")(function* run(command) {
19538
+ const child = yield* command;
19539
+ const output = yield* child.stdout.pipe(decodeText2(), mkString);
19540
+ const code = yield* child.exitCode;
19541
+ if (code !== 0) {
19542
+ return yield* new UserError({
19543
+ cause: `${command.command} exited with status ${code}.`
19544
+ });
19545
+ }
19546
+ return output;
19547
+ }, scoped2);
19548
+ var convex = (args, env, input) => run6(make18("bunx", ["--no-install", "convex", ...args], {
19549
+ env,
19550
+ extendEnv: true,
19551
+ stderr: "inherit",
19552
+ stdin: input === undefined ? "inherit" : make13(new TextEncoder().encode(input)),
19553
+ stdout: "inherit"
19554
+ }));
19555
+
17834
19556
  // src/deploy.ts
19557
+ var convexManagedEnvironmentNames = [
19558
+ "CONVEX_DEPLOY_KEY",
19559
+ "CONVEX_DEPLOYMENT_TOKEN",
19560
+ "CONVEX_DEPLOYMENT",
19561
+ "CONVEX_SELF_HOSTED_URL",
19562
+ "CONVEX_SELF_HOSTED_ADMIN_KEY",
19563
+ "CONVEX_URL",
19564
+ "PUBLIC_CONVEX_URL",
19565
+ "NEXT_PUBLIC_CONVEX_URL",
19566
+ "VITE_CONVEX_URL",
19567
+ "REACT_APP_CONVEX_URL",
19568
+ "EXPO_PUBLIC_CONVEX_URL",
19569
+ "CONVEX_SITE_URL",
19570
+ "PUBLIC_CONVEX_SITE_URL",
19571
+ "NEXT_PUBLIC_CONVEX_SITE_URL",
19572
+ "VITE_CONVEX_SITE_URL",
19573
+ "REACT_APP_CONVEX_SITE_URL",
19574
+ "EXPO_PUBLIC_CONVEX_SITE_URL"
19575
+ ];
17835
19576
  var deploy = fn2("Deploy.run")(function* deploy(build) {
17836
19577
  const environment = yield* load();
17837
19578
  const { target, values, file } = environment;
@@ -17845,7 +19586,8 @@ var deploy = fn2("Deploy.run")(function* deploy(build) {
17845
19586
  return yield* new UserError({ cause: "Preview deployment requires a branch name." });
17846
19587
  }
17847
19588
  const prefix = target === "preview" ? "preview:" : "prod:";
17848
- if (!(values["CONVEX_DEPLOY_KEY"] ?? "").startsWith(prefix)) {
19589
+ const deployKey = values["CONVEX_DEPLOY_KEY"] ?? "";
19590
+ if (!deployKey.startsWith(prefix)) {
17849
19591
  return yield* new UserError({
17850
19592
  cause: "Encrypted project file must contain a Convex deploy key matching VERCEL_ENV."
17851
19593
  });
@@ -17854,9 +19596,17 @@ var deploy = fn2("Deploy.run")(function* deploy(build) {
17854
19596
  if (build) {
17855
19597
  const cloud = yield* NonEmptyString2("NEXT_PUBLIC_CONVEX_URL");
17856
19598
  const site = yield* NonEmptyString2("NEXT_PUBLIC_CONVEX_SITE_URL");
17857
- const contents = yield* decrypt(file);
17858
- yield* convex(["env", "set", "--force", ...target === "preview" ? ["--preview-name", branch] : []], values, contents);
17859
- return yield* run6(make17("bun", ["run", "build"], {
19599
+ const changes = map3(filter(toEntries(values), ([name]) => !contains(name)(convexManagedEnvironmentNames)), ([name, value]) => ({ name, value }));
19600
+ if (changes.length > 0) {
19601
+ yield* gen2(function* syncEnvironmentVariables() {
19602
+ const client = yield* HttpClient;
19603
+ const request = yield* bodyJson(setHeader(post(`${cloud}/api/v1/update_environment_variables`), "Authorization", `Convex ${deployKey}`), { changes });
19604
+ yield* filterStatusOk2(client).execute(request).pipe(asVoid2);
19605
+ }).pipe(provide3(layer11), mapError2(() => new UserError({
19606
+ cause: "Could not synchronize Convex environment variables."
19607
+ })));
19608
+ }
19609
+ return yield* run6(make18("bun", ["run", "build"], {
17860
19610
  env: { ...values, NEXT_PUBLIC_CONVEX_SITE_URL: site, NEXT_PUBLIC_CONVEX_URL: cloud },
17861
19611
  extendEnv: true,
17862
19612
  stderr: "inherit",
@@ -17873,10 +19623,22 @@ var deploy = fn2("Deploy.run")(function* deploy(build) {
17873
19623
  ], values).pipe(asVoid2);
17874
19624
  });
17875
19625
 
19626
+ // src/dotenv.ts
19627
+ var dotenvx = fn2("Dotenvx.run")(function* dotenvx(args, capture) {
19628
+ const path = yield* Path;
19629
+ const bin = yield* path.fromFileUrl(new URL("src/cli/dotenvx.js", import.meta.resolve("@dotenvx/dotenvx/package.json")));
19630
+ return yield* run6(make18("bun", [bin, ...args], {
19631
+ stderr: capture ? "ignore" : "inherit",
19632
+ stdin: "inherit",
19633
+ stdout: capture ? "pipe" : "inherit"
19634
+ }));
19635
+ });
19636
+ var decrypt = (file) => dotenvx(["decrypt", "--stdout", "--no-armor", "--no-native", "-f", file], true);
19637
+
17876
19638
  // src/run.ts
17877
19639
  var run7 = fn2("Run.command")(function* run(command, args) {
17878
19640
  const { values } = yield* load();
17879
- const child = yield* make17(command, args, {
19641
+ const child = yield* make18(command, args, {
17880
19642
  env: { ...values, ...process.env },
17881
19643
  extendEnv: true,
17882
19644
  stderr: "inherit",
@@ -17938,15 +19700,117 @@ var setup = fn2("Setup.run")(function* setup() {
17938
19700
  return yield* log("Local Convex setup complete.");
17939
19701
  });
17940
19702
 
19703
+ // src/sync-dev.ts
19704
+ var failure = (cause) => new UserError({ cause });
19705
+ var reserved = /^(?:CONVEX_|DOTENV_|NEXT_PUBLIC_|PUBLIC_|VITE_|REACT_APP_|EXPO_PUBLIC_|VERCEL_|GITHUB_|NODE_|BUN_|AFFECT_|CI$|PATH$|HOME$|PWD$|SHELL$|ENV$|TMPDIR$|(?:HTTPS?|ALL|NO)_PROXY$)/u;
19706
+ var SettingName = String5.check(makeFilter2((name) => !reserved.test(name)));
19707
+ var Declaration2 = Record(String5, Struct({
19708
+ isConvexValidator: Literal2(true),
19709
+ isOptional: Literals(["required", "optional"])
19710
+ }));
19711
+ var Origin = URLFromString.check(makeFilter2((url) => url.protocol === "https:" && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === ""));
19712
+ var Profile = Struct({
19713
+ CONVEX_DEPLOY_KEY: String5.check(isPattern2(/^dev:[a-z0-9-]+\|.+$/u)),
19714
+ NEXT_PUBLIC_CONVEX_SITE_URL: Origin,
19715
+ NEXT_PUBLIC_CONVEX_URL: Origin
19716
+ });
19717
+ var Slug = String5.check(isPattern2(/^[a-z0-9][a-z0-9_-]*$/u));
19718
+ var Id = Int.check(isGreaterThan2(0));
19719
+ var Identity = Struct({ project: Slug, projectId: Id, team: Slug, teamId: Id });
19720
+ var Deployment = Struct({
19721
+ deploymentType: Literal2("dev"),
19722
+ id: Id,
19723
+ kind: Literal2("cloud"),
19724
+ projectId: Id,
19725
+ teamId: Id
19726
+ });
19727
+ var CanonicalUrls = Struct({ convexCloudUrl: Origin, convexSiteUrl: Origin });
19728
+ var Existing = Struct({
19729
+ environmentVariables: Record(String5, String5)
19730
+ });
19731
+ var request = fn2("DevelopmentEnv.request")(function* request(url, authorization, body) {
19732
+ const client = yield* HttpClient;
19733
+ const base = setHeader(body === undefined ? get4(url) : post(url), "Authorization", authorization);
19734
+ const outgoing = body === undefined ? base : yield* bodyJson(base, body);
19735
+ const response = yield* client.execute(outgoing);
19736
+ if (response.status !== 200) {
19737
+ return yield* failure("Development environment request failed.");
19738
+ }
19739
+ return response;
19740
+ }, mapError2(() => failure("Development environment request failed.")));
19741
+ var json2 = (schema, response) => response.json.pipe(flatMap3(decodeUnknownEffect2(schema)), mapError2(() => failure("Invalid development deployment metadata.")));
19742
+ var syncDev = fn2("DevelopmentEnv.sync")(function* syncDev(force) {
19743
+ const path = yield* Path;
19744
+ const fs = yield* FileSystem;
19745
+ const file = path.resolve("env", "development", ".env");
19746
+ if (!(yield* fs.exists(file))) {
19747
+ return yield* failure("Missing env/development/.env.");
19748
+ }
19749
+ yield* NonEmptyString2("DOTENV_PRIVATE_KEY").pipe(mapError2(() => failure("Set the matching development DOTENV_PRIVATE_KEY.")));
19750
+ const values = yield* read2(file);
19751
+ const profile = yield* decodeUnknownEffect2(Profile)(values).pipe(mapError2(() => failure("Development profile requires a dev-scoped key and HTTPS Convex origins.")));
19752
+ const name = profile.CONVEX_DEPLOY_KEY.split("|")[0]?.slice(4);
19753
+ if ((values["CONVEX_DEPLOYMENT"] ?? "") !== "" && values["CONVEX_DEPLOYMENT"] !== `dev:${name}`) {
19754
+ return yield* failure("CONVEX_DEPLOYMENT does not match the development key.");
19755
+ }
19756
+ const declarationModule = yield* try_3({
19757
+ catch: () => failure("Cannot load the declaration-only convex/env.config.ts."),
19758
+ try: () => decodeUnknownEffect2(Struct({ default: Declaration2 }))(import.meta.require(path.resolve("convex", "env.config.ts")))
19759
+ }).pipe(flatten3, mapError2(() => failure("Cannot load a valid declaration-only convex/env.config.ts with Convex validators.")));
19760
+ const declaration = declarationModule.default;
19761
+ yield* decodeEffect2(ArraySchema(SettingName))(keys(declaration)).pipe(mapError2(() => failure("Server declaration contains a credential, control or client-public name.")));
19762
+ const entries = toEntries(declaration);
19763
+ const missing = filter(entries, ([key, validator]) => validator.isOptional === "required" && !has(values, key));
19764
+ if (missing.length > 0) {
19765
+ return yield* failure(`Missing required server settings: ${join(map3(missing, ([key]) => key), ", ")}.`);
19766
+ }
19767
+ const selected = filterMap(entries, ([key]) => {
19768
+ const value = has(values, key) ? values[key] : undefined;
19769
+ return value === undefined ? failVoid : succeed2({ name: key, value });
19770
+ });
19771
+ const key = profile.CONVEX_DEPLOY_KEY;
19772
+ const bearer = `Bearer ${key}`;
19773
+ const lookup = { deployKey: key };
19774
+ const cloud = yield* json2(Origin, yield* request("https://api.convex.dev/api/deployment/url_for_key", bearer, lookup));
19775
+ if (cloud.origin !== profile.NEXT_PUBLIC_CONVEX_URL.origin) {
19776
+ return yield* failure("Development key and public Convex URL do not match.");
19777
+ }
19778
+ const identity = yield* json2(Identity, yield* request("https://api.convex.dev/api/deployment/team_and_project_for_key", bearer, lookup));
19779
+ const authorization = `Convex ${key}`;
19780
+ const deployment = yield* json2(Deployment, yield* request(`${cloud.origin}/api/v1/deployment_info`, authorization));
19781
+ if (deployment.teamId !== identity.teamId || deployment.projectId !== identity.projectId) {
19782
+ return yield* failure("Development deployment identity does not match the key.");
19783
+ }
19784
+ const urls = yield* json2(CanonicalUrls, yield* request(`${cloud.origin}/api/v1/get_canonical_urls`, authorization));
19785
+ if (urls.convexCloudUrl.origin !== cloud.origin || urls.convexSiteUrl.origin !== profile.NEXT_PUBLIC_CONVEX_SITE_URL.origin) {
19786
+ return yield* failure("Development canonical Convex URLs do not match the profile.");
19787
+ }
19788
+ yield* error(`Convex target: ${identity.team}/${identity.project}; development ${name} (ID ${deployment.id}).`);
19789
+ const existing = yield* json2(Existing, yield* request(`${cloud.origin}/api/v1/list_environment_variables`, authorization));
19790
+ const changed = filter(selected, (entry) => !has(existing.environmentVariables, entry.name) || existing.environmentVariables[entry.name] !== entry.value);
19791
+ const conflicts = filter(changed, (entry) => has(existing.environmentVariables, entry.name));
19792
+ if (!force && conflicts.length > 0) {
19793
+ return yield* failure(`Existing settings differ: ${join(map3(conflicts, (entry) => entry.name), ", ")}. Use --force to overwrite them.`);
19794
+ }
19795
+ if (changed.length > 0) {
19796
+ yield* request(`${cloud.origin}/api/v1/update_environment_variables`, authorization, {
19797
+ changes: changed
19798
+ });
19799
+ }
19800
+ return yield* log(`Development settings: ${changed.length - conflicts.length} added, ${conflicts.length} updated, ${selected.length - changed.length} unchanged.`);
19801
+ }, provide3(layer11), provideService2(RequestInit, { redirect: "error" }));
19802
+
17941
19803
  // src/index.ts
17942
- var program = make27("affect").pipe(withDescription3("Environment and deployment commands for Affect applications."), withSubcommands([
17943
- make27("env", {}, () => exports().pipe(flatMap3(log))).pipe(withDescription3("Print shell exports for the selected encrypted environment.")),
17944
- make27("run", {
19804
+ var program = make30("affect").pipe(withDescription3("Environment and deployment commands for Affect applications."), withSubcommands([
19805
+ make30("env", {}, () => exports().pipe(flatMap3(log))).pipe(withDescription3("Print shell exports for the selected encrypted environment."), withSubcommands([
19806
+ make30("sync-dev", { force: Boolean6("force").pipe(withDefault5(false)) }, ({ force }) => syncDev(force)).pipe(withDescription3("Sync declared server settings to the verified hosted development backend; --force overwrites conflicts. No deployment."))
19807
+ ])),
19808
+ make30("run", {
17945
19809
  command: String10("command"),
17946
19810
  params: String10("args").pipe(variadic2())
17947
19811
  }, ({ command, params }) => run7(command, params)).pipe(withDescription3("Run a command with the selected encrypted environment.")),
17948
- make27("dotenvx", { args: String10("args").pipe(variadic2()) }, ({ args }) => dotenvx(args, false)).pipe(withDescription3("Run the bundled dotenvx CLI; pass its flags after --.")),
17949
- make27("setup", {}, setup).pipe(withDescription3("Initialize or retry an anonymous local Convex backend.")),
17950
- make27("deploy", { build: Boolean6("build").pipe(withDefault5(false)) }, ({ build }) => deploy(build)).pipe(withDescription3("Deploy the selected Vercel preview or production environment."))
19812
+ make30("dotenvx", { args: String10("args").pipe(variadic2()) }, ({ args }) => dotenvx(args, false)).pipe(withDescription3("Run the bundled dotenvx CLI; pass its flags after --.")),
19813
+ make30("setup", {}, setup).pipe(withDescription3("Initialize or retry an anonymous local Convex backend.")),
19814
+ make30("deploy", { build: Boolean6("build").pipe(withDefault5(false)) }, ({ build }) => deploy(build)).pipe(withDescription3("Deploy the selected Vercel preview or production environment."))
17951
19815
  ]), run5({ version }), provide3(layer10), provideService2(LogToStderr2, true));
17952
19816
  runMain2(program);