@effect/language-service 0.10.0 → 0.10.2

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 (4) hide show
  1. package/README.md +23 -7
  2. package/index.js +331 -2011
  3. package/index.js.map +1 -1
  4. package/package.json +1 -1
package/index.js CHANGED
@@ -70,8 +70,6 @@ var dual = function(arity, body) {
70
70
  };
71
71
  var identity = (a) => a;
72
72
  var constant = (value) => () => value;
73
- var constTrue = /* @__PURE__ */ constant(true);
74
- var constFalse = /* @__PURE__ */ constant(false);
75
73
  var constNull = /* @__PURE__ */ constant(null);
76
74
  var constUndefined = /* @__PURE__ */ constant(void 0);
77
75
  function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
@@ -161,13 +159,13 @@ var array = (item) => make((self, that) => {
161
159
  });
162
160
 
163
161
  // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/doNotation.js
164
- var let_ = (map8) => dual(3, (self, name, f) => map8(self, (a) => Object.assign({}, a, {
162
+ var let_ = (map4) => dual(3, (self, name, f) => map4(self, (a) => Object.assign({}, a, {
165
163
  [name]: f(a)
166
164
  })));
167
- var bindTo = (map8) => dual(2, (self, name) => map8(self, (a) => ({
165
+ var bindTo = (map4) => dual(2, (self, name) => map4(self, (a) => ({
168
166
  [name]: a
169
167
  })));
170
- var bind = (map8, flatMap6) => dual(3, (self, name, f) => flatMap6(self, (a) => map8(f(a), (b) => Object.assign({}, a, {
168
+ var bind = (map4, flatMap4) => dual(3, (self, name, f) => flatMap4(self, (a) => map4(f(a), (b) => Object.assign({}, a, {
171
169
  [name]: b
172
170
  }))));
173
171
 
@@ -194,7 +192,6 @@ var isFunction2 = isFunction;
194
192
  var isRecordOrArray = (input) => typeof input === "object" && input !== null;
195
193
  var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
196
194
  var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
197
- var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
198
195
 
199
196
  // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/errors.js
200
197
  var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
@@ -385,21 +382,14 @@ var string = (str) => {
385
382
  }
386
383
  return optimize(h);
387
384
  };
388
- var structureKeys = (o, keys2) => {
385
+ var structureKeys = (o, keys) => {
389
386
  let h = 12289;
390
- for (let i = 0; i < keys2.length; i++) {
391
- h ^= pipe(string(keys2[i]), combine(hash(o[keys2[i]])));
387
+ for (let i = 0; i < keys.length; i++) {
388
+ h ^= pipe(string(keys[i]), combine(hash(o[keys[i]])));
392
389
  }
393
390
  return optimize(h);
394
391
  };
395
392
  var structure = (o) => structureKeys(o, Object.keys(o));
396
- var array2 = (arr) => {
397
- let h = 6151;
398
- for (let i = 0; i < arr.length; i++) {
399
- h = pipe(h, combine(hash(arr[i])));
400
- }
401
- return optimize(h);
402
- };
403
393
  var cached = function() {
404
394
  if (arguments.length === 1) {
405
395
  const self2 = arguments[0];
@@ -515,12 +505,6 @@ var Class = class {
515
505
  return format(this.toJSON());
516
506
  }
517
507
  };
518
- var stringifyCircular = (obj, whitespace) => {
519
- let cache = [];
520
- const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null ? cache.includes(value) ? void 0 : cache.push(value) && (redactableState.fiberRefs !== void 0 && isRedactable(value) ? value[symbolRedactable](redactableState.fiberRefs) : value) : value, whitespace);
521
- cache = void 0;
522
- return retVal;
523
- };
524
508
  var symbolRedactable = /* @__PURE__ */ Symbol.for("effect/Inspectable/Redactable");
525
509
  var isRedactable = (u) => typeof u === "object" && u !== null && symbolRedactable in u;
526
510
  var redactableState = /* @__PURE__ */ globalValue("effect/Inspectable/redactableState", () => ({
@@ -568,8 +552,6 @@ var pipeArguments = (self, args) => {
568
552
 
569
553
  // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/opCodes/effect.js
570
554
  var OP_COMMIT = "Commit";
571
- var OP_FAILURE = "Failure";
572
- var OP_WITH_RUNTIME = "WithRuntime";
573
555
 
574
556
  // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/effectable.js
575
557
  var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
@@ -846,1836 +828,161 @@ var andThen = /* @__PURE__ */ dual(2, (self, f) => flatMap(self, (a) => {
846
828
  var zipWith = /* @__PURE__ */ dual(3, (self, that, f) => flatMap(self, (r) => map(that, (r2) => f(r, r2))));
847
829
  var ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f, a) => f(a)));
848
830
  var all = (input) => {
849
- if (Symbol.iterator in input) {
850
- const out2 = [];
851
- for (const e of input) {
852
- if (isLeft2(e)) {
853
- return e;
854
- }
855
- out2.push(e.right);
856
- }
857
- return right2(out2);
858
- }
859
- const out = {};
860
- for (const key of Object.keys(input)) {
861
- const e = input[key];
862
- if (isLeft2(e)) {
863
- return e;
864
- }
865
- out[key] = e.right;
866
- }
867
- return right2(out);
868
- };
869
- var flip = (self) => isLeft2(self) ? right2(self.left) : left2(self.right);
870
- var adapter2 = /* @__PURE__ */ adapter();
871
- var gen = (...args) => {
872
- const f = args.length === 1 ? args[0] : args[1].bind(args[0]);
873
- const iterator = f(adapter2);
874
- let state = iterator.next();
875
- if (state.done) {
876
- return right2(state.value);
877
- } else {
878
- let current = state.value;
879
- if (isGenKind(current)) {
880
- current = current.value;
881
- } else {
882
- current = yieldWrapGet(current);
883
- }
884
- if (isLeft2(current)) {
885
- return current;
886
- }
887
- while (!state.done) {
888
- state = iterator.next(current.right);
889
- if (!state.done) {
890
- current = state.value;
891
- if (isGenKind(current)) {
892
- current = current.value;
893
- } else {
894
- current = yieldWrapGet(current);
895
- }
896
- if (isLeft2(current)) {
897
- return current;
898
- }
899
- }
900
- }
901
- return right2(state.value);
902
- }
903
- };
904
- var Do = /* @__PURE__ */ right2({});
905
- var bind2 = /* @__PURE__ */ bind(map, flatMap);
906
- var bindTo2 = /* @__PURE__ */ bindTo(map);
907
- var let_2 = /* @__PURE__ */ let_(map);
908
-
909
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/array.js
910
- var isNonEmptyArray = (self) => self.length > 0;
911
-
912
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Order.js
913
- var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
914
-
915
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Option.js
916
- var none2 = () => none;
917
- var some2 = some;
918
- var isNone2 = isNone;
919
- var isSome2 = isSome;
920
- var match2 = /* @__PURE__ */ dual(2, (self, {
921
- onNone,
922
- onSome
923
- }) => isNone2(self) ? onNone() : onSome(self.value));
924
- var getOrElse2 = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
925
- var orElse2 = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
926
- var fromNullable2 = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
927
- var getOrUndefined2 = /* @__PURE__ */ getOrElse2(constUndefined);
928
-
929
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Array.js
930
- var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
931
- var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
932
- var isArray = Array.isArray;
933
- var isEmptyArray = (self) => self.length === 0;
934
- var isEmptyReadonlyArray = isEmptyArray;
935
- var isNonEmptyReadonlyArray = isNonEmptyArray;
936
- var isOutOfBound = (i, as) => i < 0 || i >= as.length;
937
- var get = /* @__PURE__ */ dual(2, (self, index) => {
938
- const i = Math.floor(index);
939
- return isOutOfBound(i, self) ? none2() : some2(self[i]);
940
- });
941
- var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
942
- const i = Math.floor(index);
943
- if (isOutOfBound(i, self)) {
944
- throw new Error(`Index ${i} out of bounds`);
945
- }
946
- return self[i];
947
- });
948
- var head = /* @__PURE__ */ get(0);
949
- var headNonEmpty = /* @__PURE__ */ unsafeGet(0);
950
- var tailNonEmpty = (self) => self.slice(1);
951
- var reverse = (self) => Array.from(self).reverse();
952
- var sort = /* @__PURE__ */ dual(2, (self, O) => {
953
- const out = Array.from(self);
954
- out.sort(O);
955
- return out;
956
- });
957
- var empty = () => [];
958
- var map2 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
959
- var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => {
960
- if (isEmptyReadonlyArray(self)) {
961
- return [];
962
- }
963
- const out = [];
964
- for (let i = 0; i < self.length; i++) {
965
- const inner = f(self[i], i);
966
- for (let j = 0; j < inner.length; j++) {
967
- out.push(inner[j]);
968
- }
969
- }
970
- return out;
971
- });
972
- var flatten = /* @__PURE__ */ flatMap2(identity);
973
- var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
974
- const as = fromIterable(self);
975
- const out = [];
976
- for (let i = 0; i < as.length; i++) {
977
- if (predicate(as[i], i)) {
978
- out.push(as[i]);
979
- }
980
- }
981
- return out;
982
- });
983
- var reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable(self).reduce((b2, a, i) => f(b2, a, i), b));
984
- var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
985
- const input = fromIterable(self);
986
- if (isNonEmptyReadonlyArray(input)) {
987
- const out = [headNonEmpty(input)];
988
- const rest = tailNonEmpty(input);
989
- for (const r of rest) {
990
- if (out.every((a) => !isEquivalent(r, a))) {
991
- out.push(r);
992
- }
993
- }
994
- return out;
995
- }
996
- return [];
997
- });
998
-
999
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Chunk.js
1000
- var TypeId4 = /* @__PURE__ */ Symbol.for("effect/Chunk");
1001
- function copy(src, srcPos, dest, destPos, len) {
1002
- for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
1003
- dest[destPos + i - srcPos] = src[i];
1004
- }
1005
- return dest;
1006
- }
1007
- var emptyArray = [];
1008
- var getEquivalence2 = (isEquivalent) => make((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet2(that, i))));
1009
- var _equivalence = /* @__PURE__ */ getEquivalence2(equals);
1010
- var ChunkProto = {
1011
- [TypeId4]: {
1012
- _A: (_) => _
1013
- },
1014
- toString() {
1015
- return format(this.toJSON());
1016
- },
1017
- toJSON() {
1018
- return {
1019
- _id: "Chunk",
1020
- values: toReadonlyArray(this).map(toJSON)
1021
- };
1022
- },
1023
- [NodeInspectSymbol]() {
1024
- return this.toJSON();
1025
- },
1026
- [symbol2](that) {
1027
- return isChunk(that) && _equivalence(this, that);
1028
- },
1029
- [symbol]() {
1030
- return cached(this, array2(toReadonlyArray(this)));
1031
- },
1032
- [Symbol.iterator]() {
1033
- switch (this.backing._tag) {
1034
- case "IArray": {
1035
- return this.backing.array[Symbol.iterator]();
1036
- }
1037
- case "IEmpty": {
1038
- return emptyArray[Symbol.iterator]();
1039
- }
1040
- default: {
1041
- return toReadonlyArray(this)[Symbol.iterator]();
1042
- }
1043
- }
1044
- },
1045
- pipe() {
1046
- return pipeArguments(this, arguments);
1047
- }
1048
- };
1049
- var makeChunk = (backing) => {
1050
- const chunk = Object.create(ChunkProto);
1051
- chunk.backing = backing;
1052
- switch (backing._tag) {
1053
- case "IEmpty": {
1054
- chunk.length = 0;
1055
- chunk.depth = 0;
1056
- chunk.left = chunk;
1057
- chunk.right = chunk;
1058
- break;
1059
- }
1060
- case "IConcat": {
1061
- chunk.length = backing.left.length + backing.right.length;
1062
- chunk.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
1063
- chunk.left = backing.left;
1064
- chunk.right = backing.right;
1065
- break;
1066
- }
1067
- case "IArray": {
1068
- chunk.length = backing.array.length;
1069
- chunk.depth = 0;
1070
- chunk.left = _empty;
1071
- chunk.right = _empty;
1072
- break;
1073
- }
1074
- case "ISingleton": {
1075
- chunk.length = 1;
1076
- chunk.depth = 0;
1077
- chunk.left = _empty;
1078
- chunk.right = _empty;
1079
- break;
1080
- }
1081
- case "ISlice": {
1082
- chunk.length = backing.length;
1083
- chunk.depth = backing.chunk.depth + 1;
1084
- chunk.left = _empty;
1085
- chunk.right = _empty;
1086
- break;
1087
- }
1088
- }
1089
- return chunk;
1090
- };
1091
- var isChunk = (u) => hasProperty(u, TypeId4);
1092
- var _empty = /* @__PURE__ */ makeChunk({
1093
- _tag: "IEmpty"
1094
- });
1095
- var empty2 = () => _empty;
1096
- var make3 = (...as) => as.length === 1 ? of(as[0]) : unsafeFromNonEmptyArray(as);
1097
- var of = (a) => makeChunk({
1098
- _tag: "ISingleton",
1099
- a
1100
- });
1101
- var fromIterable2 = (self) => isChunk(self) ? self : makeChunk({
1102
- _tag: "IArray",
1103
- array: fromIterable(self)
1104
- });
1105
- var copyToArray = (self, array3, initial) => {
1106
- switch (self.backing._tag) {
1107
- case "IArray": {
1108
- copy(self.backing.array, 0, array3, initial, self.length);
1109
- break;
1110
- }
1111
- case "IConcat": {
1112
- copyToArray(self.left, array3, initial);
1113
- copyToArray(self.right, array3, initial + self.left.length);
1114
- break;
1115
- }
1116
- case "ISingleton": {
1117
- array3[initial] = self.backing.a;
1118
- break;
1119
- }
1120
- case "ISlice": {
1121
- let i = 0;
1122
- let j = initial;
1123
- while (i < self.length) {
1124
- array3[j] = unsafeGet2(self, i);
1125
- i += 1;
1126
- j += 1;
1127
- }
1128
- break;
1129
- }
1130
- }
1131
- };
1132
- var toReadonlyArray_ = (self) => {
1133
- switch (self.backing._tag) {
1134
- case "IEmpty": {
1135
- return emptyArray;
1136
- }
1137
- case "IArray": {
1138
- return self.backing.array;
1139
- }
1140
- default: {
1141
- const arr = new Array(self.length);
1142
- copyToArray(self, arr, 0);
1143
- self.backing = {
1144
- _tag: "IArray",
1145
- array: arr
1146
- };
1147
- self.left = _empty;
1148
- self.right = _empty;
1149
- self.depth = 0;
1150
- return arr;
1151
- }
1152
- }
1153
- };
1154
- var toReadonlyArray = toReadonlyArray_;
1155
- var reverseChunk = (self) => {
1156
- switch (self.backing._tag) {
1157
- case "IEmpty":
1158
- case "ISingleton":
1159
- return self;
1160
- case "IArray": {
1161
- return makeChunk({
1162
- _tag: "IArray",
1163
- array: reverse(self.backing.array)
1164
- });
1165
- }
1166
- case "IConcat": {
1167
- return makeChunk({
1168
- _tag: "IConcat",
1169
- left: reverse2(self.backing.right),
1170
- right: reverse2(self.backing.left)
1171
- });
1172
- }
1173
- case "ISlice":
1174
- return unsafeFromArray(reverse(toReadonlyArray(self)));
1175
- }
1176
- };
1177
- var reverse2 = reverseChunk;
1178
- var unsafeFromArray = (self) => makeChunk({
1179
- _tag: "IArray",
1180
- array: self
1181
- });
1182
- var unsafeFromNonEmptyArray = (self) => unsafeFromArray(self);
1183
- var unsafeGet2 = /* @__PURE__ */ dual(2, (self, index) => {
1184
- switch (self.backing._tag) {
1185
- case "IEmpty": {
1186
- throw new Error(`Index out of bounds`);
1187
- }
1188
- case "ISingleton": {
1189
- if (index !== 0) {
1190
- throw new Error(`Index out of bounds`);
1191
- }
1192
- return self.backing.a;
1193
- }
1194
- case "IArray": {
1195
- if (index >= self.length || index < 0) {
1196
- throw new Error(`Index out of bounds`);
1197
- }
1198
- return self.backing.array[index];
1199
- }
1200
- case "IConcat": {
1201
- return index < self.left.length ? unsafeGet2(self.left, index) : unsafeGet2(self.right, index - self.left.length);
1202
- }
1203
- case "ISlice": {
1204
- return unsafeGet2(self.backing.chunk, index + self.backing.offset);
1205
- }
1206
- }
1207
- });
1208
- var prepend = /* @__PURE__ */ dual(2, (self, elem) => appendAll(of(elem), self));
1209
- var appendAll = /* @__PURE__ */ dual(2, (self, that) => {
1210
- if (self.backing._tag === "IEmpty") {
1211
- return that;
1212
- }
1213
- if (that.backing._tag === "IEmpty") {
1214
- return self;
1215
- }
1216
- const diff = that.depth - self.depth;
1217
- if (Math.abs(diff) <= 1) {
1218
- return makeChunk({
1219
- _tag: "IConcat",
1220
- left: self,
1221
- right: that
1222
- });
1223
- } else if (diff < -1) {
1224
- if (self.left.depth >= self.right.depth) {
1225
- const nr = appendAll(self.right, that);
1226
- return makeChunk({
1227
- _tag: "IConcat",
1228
- left: self.left,
1229
- right: nr
1230
- });
1231
- } else {
1232
- const nrr = appendAll(self.right.right, that);
1233
- if (nrr.depth === self.depth - 3) {
1234
- const nr = makeChunk({
1235
- _tag: "IConcat",
1236
- left: self.right.left,
1237
- right: nrr
1238
- });
1239
- return makeChunk({
1240
- _tag: "IConcat",
1241
- left: self.left,
1242
- right: nr
1243
- });
1244
- } else {
1245
- const nl = makeChunk({
1246
- _tag: "IConcat",
1247
- left: self.left,
1248
- right: self.right.left
1249
- });
1250
- return makeChunk({
1251
- _tag: "IConcat",
1252
- left: nl,
1253
- right: nrr
1254
- });
1255
- }
1256
- }
1257
- } else {
1258
- if (that.right.depth >= that.left.depth) {
1259
- const nl = appendAll(self, that.left);
1260
- return makeChunk({
1261
- _tag: "IConcat",
1262
- left: nl,
1263
- right: that.right
1264
- });
1265
- } else {
1266
- const nll = appendAll(self, that.left.left);
1267
- if (nll.depth === that.depth - 3) {
1268
- const nl = makeChunk({
1269
- _tag: "IConcat",
1270
- left: nll,
1271
- right: that.left.right
1272
- });
1273
- return makeChunk({
1274
- _tag: "IConcat",
1275
- left: nl,
1276
- right: that.right
1277
- });
1278
- } else {
1279
- const nr = makeChunk({
1280
- _tag: "IConcat",
1281
- left: that.left.right,
1282
- right: that.right
1283
- });
1284
- return makeChunk({
1285
- _tag: "IConcat",
1286
- left: nll,
1287
- right: nr
1288
- });
1289
- }
1290
- }
1291
- }
1292
- });
1293
- var isEmpty = (self) => self.length === 0;
1294
- var isNonEmpty = (self) => self.length > 0;
1295
- var unsafeHead = (self) => unsafeGet2(self, 0);
1296
- var headNonEmpty2 = unsafeHead;
1297
-
1298
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap/config.js
1299
- var SIZE = 5;
1300
- var BUCKET_SIZE = /* @__PURE__ */ Math.pow(2, SIZE);
1301
- var MASK = BUCKET_SIZE - 1;
1302
- var MAX_INDEX_NODE = BUCKET_SIZE / 2;
1303
- var MIN_ARRAY_NODE = BUCKET_SIZE / 4;
1304
-
1305
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap/bitwise.js
1306
- function popcount(x) {
1307
- x -= x >> 1 & 1431655765;
1308
- x = (x & 858993459) + (x >> 2 & 858993459);
1309
- x = x + (x >> 4) & 252645135;
1310
- x += x >> 8;
1311
- x += x >> 16;
1312
- return x & 127;
1313
- }
1314
- function hashFragment(shift, h) {
1315
- return h >>> shift & MASK;
1316
- }
1317
- function toBitmap(x) {
1318
- return 1 << x;
1319
- }
1320
- function fromBitmap(bitmap, bit) {
1321
- return popcount(bitmap & bit - 1);
1322
- }
1323
-
1324
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/stack.js
1325
- var make4 = (value, previous) => ({
1326
- value,
1327
- previous
1328
- });
1329
-
1330
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap/array.js
1331
- function arrayUpdate(mutate2, at, v, arr) {
1332
- let out = arr;
1333
- if (!mutate2) {
1334
- const len = arr.length;
1335
- out = new Array(len);
1336
- for (let i = 0; i < len; ++i) out[i] = arr[i];
1337
- }
1338
- out[at] = v;
1339
- return out;
1340
- }
1341
- function arraySpliceOut(mutate2, at, arr) {
1342
- const newLen = arr.length - 1;
1343
- let i = 0;
1344
- let g = 0;
1345
- let out = arr;
1346
- if (mutate2) {
1347
- i = g = at;
1348
- } else {
1349
- out = new Array(newLen);
1350
- while (i < at) out[g++] = arr[i++];
1351
- }
1352
- ;
1353
- ++i;
1354
- while (i <= newLen) out[g++] = arr[i++];
1355
- if (mutate2) {
1356
- out.length = newLen;
1357
- }
1358
- return out;
1359
- }
1360
- function arraySpliceIn(mutate2, at, v, arr) {
1361
- const len = arr.length;
1362
- if (mutate2) {
1363
- let i2 = len;
1364
- while (i2 >= at) arr[i2--] = arr[i2];
1365
- arr[at] = v;
1366
- return arr;
1367
- }
1368
- let i = 0, g = 0;
1369
- const out = new Array(len + 1);
1370
- while (i < at) out[g++] = arr[i++];
1371
- out[at] = v;
1372
- while (i < len) out[++g] = arr[i++];
1373
- return out;
1374
- }
1375
-
1376
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap/node.js
1377
- var EmptyNode = class _EmptyNode {
1378
- _tag = "EmptyNode";
1379
- modify(edit, _shift, f, hash2, key, size4) {
1380
- const v = f(none2());
1381
- if (isNone2(v)) return new _EmptyNode();
1382
- ++size4.value;
1383
- return new LeafNode(edit, hash2, key, v);
1384
- }
1385
- };
1386
- function isEmptyNode(a) {
1387
- return isTagged(a, "EmptyNode");
1388
- }
1389
- function isLeafNode(node) {
1390
- return isEmptyNode(node) || node._tag === "LeafNode" || node._tag === "CollisionNode";
1391
- }
1392
- function canEditNode(node, edit) {
1393
- return isEmptyNode(node) ? false : edit === node.edit;
1394
- }
1395
- var LeafNode = class _LeafNode {
1396
- edit;
1397
- hash;
1398
- key;
1399
- value;
1400
- _tag = "LeafNode";
1401
- constructor(edit, hash2, key, value) {
1402
- this.edit = edit;
1403
- this.hash = hash2;
1404
- this.key = key;
1405
- this.value = value;
1406
- }
1407
- modify(edit, shift, f, hash2, key, size4) {
1408
- if (equals(key, this.key)) {
1409
- const v2 = f(this.value);
1410
- if (v2 === this.value) return this;
1411
- else if (isNone2(v2)) {
1412
- ;
1413
- --size4.value;
1414
- return new EmptyNode();
1415
- }
1416
- if (canEditNode(this, edit)) {
1417
- this.value = v2;
1418
- return this;
1419
- }
1420
- return new _LeafNode(edit, hash2, key, v2);
1421
- }
1422
- const v = f(none2());
1423
- if (isNone2(v)) return this;
1424
- ++size4.value;
1425
- return mergeLeaves(edit, shift, this.hash, this, hash2, new _LeafNode(edit, hash2, key, v));
1426
- }
1427
- };
1428
- var CollisionNode = class _CollisionNode {
1429
- edit;
1430
- hash;
1431
- children;
1432
- _tag = "CollisionNode";
1433
- constructor(edit, hash2, children) {
1434
- this.edit = edit;
1435
- this.hash = hash2;
1436
- this.children = children;
1437
- }
1438
- modify(edit, shift, f, hash2, key, size4) {
1439
- if (hash2 === this.hash) {
1440
- const canEdit = canEditNode(this, edit);
1441
- const list = this.updateCollisionList(canEdit, edit, this.hash, this.children, f, key, size4);
1442
- if (list === this.children) return this;
1443
- return list.length > 1 ? new _CollisionNode(edit, this.hash, list) : list[0];
1444
- }
1445
- const v = f(none2());
1446
- if (isNone2(v)) return this;
1447
- ++size4.value;
1448
- return mergeLeaves(edit, shift, this.hash, this, hash2, new LeafNode(edit, hash2, key, v));
1449
- }
1450
- updateCollisionList(mutate2, edit, hash2, list, f, key, size4) {
1451
- const len = list.length;
1452
- for (let i = 0; i < len; ++i) {
1453
- const child = list[i];
1454
- if ("key" in child && equals(key, child.key)) {
1455
- const value = child.value;
1456
- const newValue2 = f(value);
1457
- if (newValue2 === value) return list;
1458
- if (isNone2(newValue2)) {
1459
- ;
1460
- --size4.value;
1461
- return arraySpliceOut(mutate2, i, list);
1462
- }
1463
- return arrayUpdate(mutate2, i, new LeafNode(edit, hash2, key, newValue2), list);
1464
- }
1465
- }
1466
- const newValue = f(none2());
1467
- if (isNone2(newValue)) return list;
1468
- ++size4.value;
1469
- return arrayUpdate(mutate2, len, new LeafNode(edit, hash2, key, newValue), list);
1470
- }
1471
- };
1472
- var IndexedNode = class _IndexedNode {
1473
- edit;
1474
- mask;
1475
- children;
1476
- _tag = "IndexedNode";
1477
- constructor(edit, mask, children) {
1478
- this.edit = edit;
1479
- this.mask = mask;
1480
- this.children = children;
1481
- }
1482
- modify(edit, shift, f, hash2, key, size4) {
1483
- const mask = this.mask;
1484
- const children = this.children;
1485
- const frag = hashFragment(shift, hash2);
1486
- const bit = toBitmap(frag);
1487
- const indx = fromBitmap(mask, bit);
1488
- const exists = mask & bit;
1489
- const canEdit = canEditNode(this, edit);
1490
- if (!exists) {
1491
- const _newChild = new EmptyNode().modify(edit, shift + SIZE, f, hash2, key, size4);
1492
- if (!_newChild) return this;
1493
- return children.length >= MAX_INDEX_NODE ? expand(edit, frag, _newChild, mask, children) : new _IndexedNode(edit, mask | bit, arraySpliceIn(canEdit, indx, _newChild, children));
1494
- }
1495
- const current = children[indx];
1496
- const child = current.modify(edit, shift + SIZE, f, hash2, key, size4);
1497
- if (current === child) return this;
1498
- let bitmap = mask;
1499
- let newChildren;
1500
- if (isEmptyNode(child)) {
1501
- bitmap &= ~bit;
1502
- if (!bitmap) return new EmptyNode();
1503
- if (children.length <= 2 && isLeafNode(children[indx ^ 1])) {
1504
- return children[indx ^ 1];
1505
- }
1506
- newChildren = arraySpliceOut(canEdit, indx, children);
1507
- } else {
1508
- newChildren = arrayUpdate(canEdit, indx, child, children);
1509
- }
1510
- if (canEdit) {
1511
- this.mask = bitmap;
1512
- this.children = newChildren;
1513
- return this;
1514
- }
1515
- return new _IndexedNode(edit, bitmap, newChildren);
1516
- }
1517
- };
1518
- var ArrayNode = class _ArrayNode {
1519
- edit;
1520
- size;
1521
- children;
1522
- _tag = "ArrayNode";
1523
- constructor(edit, size4, children) {
1524
- this.edit = edit;
1525
- this.size = size4;
1526
- this.children = children;
1527
- }
1528
- modify(edit, shift, f, hash2, key, size4) {
1529
- let count = this.size;
1530
- const children = this.children;
1531
- const frag = hashFragment(shift, hash2);
1532
- const child = children[frag];
1533
- const newChild = (child || new EmptyNode()).modify(edit, shift + SIZE, f, hash2, key, size4);
1534
- if (child === newChild) return this;
1535
- const canEdit = canEditNode(this, edit);
1536
- let newChildren;
1537
- if (isEmptyNode(child) && !isEmptyNode(newChild)) {
1538
- ;
1539
- ++count;
1540
- newChildren = arrayUpdate(canEdit, frag, newChild, children);
1541
- } else if (!isEmptyNode(child) && isEmptyNode(newChild)) {
1542
- ;
1543
- --count;
1544
- if (count <= MIN_ARRAY_NODE) {
1545
- return pack(edit, count, frag, children);
1546
- }
1547
- newChildren = arrayUpdate(canEdit, frag, new EmptyNode(), children);
1548
- } else {
1549
- newChildren = arrayUpdate(canEdit, frag, newChild, children);
1550
- }
1551
- if (canEdit) {
1552
- this.size = count;
1553
- this.children = newChildren;
1554
- return this;
1555
- }
1556
- return new _ArrayNode(edit, count, newChildren);
1557
- }
1558
- };
1559
- function pack(edit, count, removed, elements) {
1560
- const children = new Array(count - 1);
1561
- let g = 0;
1562
- let bitmap = 0;
1563
- for (let i = 0, len = elements.length; i < len; ++i) {
1564
- if (i !== removed) {
1565
- const elem = elements[i];
1566
- if (elem && !isEmptyNode(elem)) {
1567
- children[g++] = elem;
1568
- bitmap |= 1 << i;
1569
- }
1570
- }
1571
- }
1572
- return new IndexedNode(edit, bitmap, children);
1573
- }
1574
- function expand(edit, frag, child, bitmap, subNodes) {
1575
- const arr = [];
1576
- let bit = bitmap;
1577
- let count = 0;
1578
- for (let i = 0; bit; ++i) {
1579
- if (bit & 1) arr[i] = subNodes[count++];
1580
- bit >>>= 1;
1581
- }
1582
- arr[frag] = child;
1583
- return new ArrayNode(edit, count + 1, arr);
1584
- }
1585
- function mergeLeavesInner(edit, shift, h1, n1, h2, n2) {
1586
- if (h1 === h2) return new CollisionNode(edit, h1, [n2, n1]);
1587
- const subH1 = hashFragment(shift, h1);
1588
- const subH2 = hashFragment(shift, h2);
1589
- if (subH1 === subH2) {
1590
- return (child) => new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), [child]);
1591
- } else {
1592
- const children = subH1 < subH2 ? [n1, n2] : [n2, n1];
1593
- return new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), children);
1594
- }
1595
- }
1596
- function mergeLeaves(edit, shift, h1, n1, h2, n2) {
1597
- let stack = void 0;
1598
- let currentShift = shift;
1599
- while (true) {
1600
- const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
1601
- if (typeof res === "function") {
1602
- stack = make4(res, stack);
1603
- currentShift = currentShift + SIZE;
1604
- } else {
1605
- let final = res;
1606
- while (stack != null) {
1607
- final = stack.value(final);
1608
- stack = stack.previous;
1609
- }
1610
- return final;
1611
- }
1612
- }
1613
- }
1614
-
1615
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap.js
1616
- var HashMapSymbolKey = "effect/HashMap";
1617
- var HashMapTypeId = /* @__PURE__ */ Symbol.for(HashMapSymbolKey);
1618
- var HashMapProto = {
1619
- [HashMapTypeId]: HashMapTypeId,
1620
- [Symbol.iterator]() {
1621
- return new HashMapIterator(this, (k, v) => [k, v]);
1622
- },
1623
- [symbol]() {
1624
- let hash2 = hash(HashMapSymbolKey);
1625
- for (const item of this) {
1626
- hash2 ^= pipe(hash(item[0]), combine(hash(item[1])));
1627
- }
1628
- return cached(this, hash2);
1629
- },
1630
- [symbol2](that) {
1631
- if (isHashMap(that)) {
1632
- if (that._size !== this._size) {
1633
- return false;
1634
- }
1635
- for (const item of this) {
1636
- const elem = pipe(that, getHash(item[0], hash(item[0])));
1637
- if (isNone2(elem)) {
1638
- return false;
1639
- } else {
1640
- if (!equals(item[1], elem.value)) {
1641
- return false;
1642
- }
1643
- }
1644
- }
1645
- return true;
1646
- }
1647
- return false;
1648
- },
1649
- toString() {
1650
- return format(this.toJSON());
1651
- },
1652
- toJSON() {
1653
- return {
1654
- _id: "HashMap",
1655
- values: Array.from(this).map(toJSON)
1656
- };
1657
- },
1658
- [NodeInspectSymbol]() {
1659
- return this.toJSON();
1660
- },
1661
- pipe() {
1662
- return pipeArguments(this, arguments);
1663
- }
1664
- };
1665
- var makeImpl = (editable, edit, root, size4) => {
1666
- const map8 = Object.create(HashMapProto);
1667
- map8._editable = editable;
1668
- map8._edit = edit;
1669
- map8._root = root;
1670
- map8._size = size4;
1671
- return map8;
1672
- };
1673
- var HashMapIterator = class _HashMapIterator {
1674
- map;
1675
- f;
1676
- v;
1677
- constructor(map8, f) {
1678
- this.map = map8;
1679
- this.f = f;
1680
- this.v = visitLazy(this.map._root, this.f, void 0);
1681
- }
1682
- next() {
1683
- if (isNone2(this.v)) {
1684
- return {
1685
- done: true,
1686
- value: void 0
1687
- };
1688
- }
1689
- const v0 = this.v.value;
1690
- this.v = applyCont(v0.cont);
1691
- return {
1692
- done: false,
1693
- value: v0.value
1694
- };
1695
- }
1696
- [Symbol.iterator]() {
1697
- return new _HashMapIterator(this.map, this.f);
1698
- }
1699
- };
1700
- var applyCont = (cont) => cont ? visitLazyChildren(cont[0], cont[1], cont[2], cont[3], cont[4]) : none2();
1701
- var visitLazy = (node, f, cont = void 0) => {
1702
- switch (node._tag) {
1703
- case "LeafNode": {
1704
- if (isSome2(node.value)) {
1705
- return some2({
1706
- value: f(node.key, node.value.value),
1707
- cont
1708
- });
1709
- }
1710
- return applyCont(cont);
1711
- }
1712
- case "CollisionNode":
1713
- case "ArrayNode":
1714
- case "IndexedNode": {
1715
- const children = node.children;
1716
- return visitLazyChildren(children.length, children, 0, f, cont);
1717
- }
1718
- default: {
1719
- return applyCont(cont);
1720
- }
1721
- }
1722
- };
1723
- var visitLazyChildren = (len, children, i, f, cont) => {
1724
- while (i < len) {
1725
- const child = children[i++];
1726
- if (child && !isEmptyNode(child)) {
1727
- return visitLazy(child, f, [len, children, i, f, cont]);
1728
- }
1729
- }
1730
- return applyCont(cont);
1731
- };
1732
- var _empty2 = /* @__PURE__ */ makeImpl(false, 0, /* @__PURE__ */ new EmptyNode(), 0);
1733
- var empty3 = () => _empty2;
1734
- var isHashMap = (u) => hasProperty(u, HashMapTypeId);
1735
- var getHash = /* @__PURE__ */ dual(3, (self, key, hash2) => {
1736
- let node = self._root;
1737
- let shift = 0;
1738
- while (true) {
1739
- switch (node._tag) {
1740
- case "LeafNode": {
1741
- return equals(key, node.key) ? node.value : none2();
1742
- }
1743
- case "CollisionNode": {
1744
- if (hash2 === node.hash) {
1745
- const children = node.children;
1746
- for (let i = 0, len = children.length; i < len; ++i) {
1747
- const child = children[i];
1748
- if ("key" in child && equals(key, child.key)) {
1749
- return child.value;
1750
- }
1751
- }
1752
- }
1753
- return none2();
1754
- }
1755
- case "IndexedNode": {
1756
- const frag = hashFragment(shift, hash2);
1757
- const bit = toBitmap(frag);
1758
- if (node.mask & bit) {
1759
- node = node.children[fromBitmap(node.mask, bit)];
1760
- shift += SIZE;
1761
- break;
1762
- }
1763
- return none2();
1764
- }
1765
- case "ArrayNode": {
1766
- node = node.children[hashFragment(shift, hash2)];
1767
- if (node) {
1768
- shift += SIZE;
1769
- break;
1770
- }
1771
- return none2();
1772
- }
1773
- default:
1774
- return none2();
1775
- }
1776
- }
1777
- });
1778
- var set = /* @__PURE__ */ dual(3, (self, key, value) => modifyAt(self, key, () => some2(value)));
1779
- var setTree = /* @__PURE__ */ dual(3, (self, newRoot, newSize) => {
1780
- if (self._editable) {
1781
- ;
1782
- self._root = newRoot;
1783
- self._size = newSize;
1784
- return self;
1785
- }
1786
- return newRoot === self._root ? self : makeImpl(self._editable, self._edit, newRoot, newSize);
1787
- });
1788
- var keys = (self) => new HashMapIterator(self, (key) => key);
1789
- var size = (self) => self._size;
1790
- var beginMutation = (self) => makeImpl(true, self._edit + 1, self._root, self._size);
1791
- var modifyAt = /* @__PURE__ */ dual(3, (self, key, f) => modifyHash(self, key, hash(key), f));
1792
- var modifyHash = /* @__PURE__ */ dual(4, (self, key, hash2, f) => {
1793
- const size4 = {
1794
- value: self._size
1795
- };
1796
- const newRoot = self._root.modify(self._editable ? self._edit : NaN, 0, f, hash2, key, size4);
1797
- return pipe(self, setTree(newRoot, size4.value));
1798
- });
1799
- var forEach = /* @__PURE__ */ dual(2, (self, f) => reduce2(self, void 0, (_, value, key) => f(value, key)));
1800
- var reduce2 = /* @__PURE__ */ dual(3, (self, zero, f) => {
1801
- const root = self._root;
1802
- if (root._tag === "LeafNode") {
1803
- return isSome2(root.value) ? f(zero, root.value.value, root.key) : zero;
1804
- }
1805
- if (root._tag === "EmptyNode") {
1806
- return zero;
1807
- }
1808
- const toVisit = [root.children];
1809
- let children;
1810
- while (children = toVisit.pop()) {
1811
- for (let i = 0, len = children.length; i < len; ) {
1812
- const child = children[i++];
1813
- if (child && !isEmptyNode(child)) {
1814
- if (child._tag === "LeafNode") {
1815
- if (isSome2(child.value)) {
1816
- zero = f(zero, child.value.value, child.key);
1817
- }
1818
- } else {
1819
- toVisit.push(child.children);
1820
- }
1821
- }
1822
- }
1823
- }
1824
- return zero;
1825
- });
1826
-
1827
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashSet.js
1828
- var HashSetSymbolKey = "effect/HashSet";
1829
- var HashSetTypeId = /* @__PURE__ */ Symbol.for(HashSetSymbolKey);
1830
- var HashSetProto = {
1831
- [HashSetTypeId]: HashSetTypeId,
1832
- [Symbol.iterator]() {
1833
- return keys(this._keyMap);
1834
- },
1835
- [symbol]() {
1836
- return cached(this, combine(hash(this._keyMap))(hash(HashSetSymbolKey)));
1837
- },
1838
- [symbol2](that) {
1839
- if (isHashSet(that)) {
1840
- return size(this._keyMap) === size(that._keyMap) && equals(this._keyMap, that._keyMap);
1841
- }
1842
- return false;
1843
- },
1844
- toString() {
1845
- return format(this.toJSON());
1846
- },
1847
- toJSON() {
1848
- return {
1849
- _id: "HashSet",
1850
- values: Array.from(this).map(toJSON)
1851
- };
1852
- },
1853
- [NodeInspectSymbol]() {
1854
- return this.toJSON();
1855
- },
1856
- pipe() {
1857
- return pipeArguments(this, arguments);
1858
- }
1859
- };
1860
- var makeImpl2 = (keyMap) => {
1861
- const set2 = Object.create(HashSetProto);
1862
- set2._keyMap = keyMap;
1863
- return set2;
1864
- };
1865
- var isHashSet = (u) => hasProperty(u, HashSetTypeId);
1866
- var _empty3 = /* @__PURE__ */ makeImpl2(/* @__PURE__ */ empty3());
1867
- var empty4 = () => _empty3;
1868
- var size2 = (self) => size(self._keyMap);
1869
- var beginMutation2 = (self) => makeImpl2(beginMutation(self._keyMap));
1870
- var endMutation = (self) => {
1871
- ;
1872
- self._keyMap._editable = false;
1873
- return self;
1874
- };
1875
- var mutate = /* @__PURE__ */ dual(2, (self, f) => {
1876
- const transient = beginMutation2(self);
1877
- f(transient);
1878
- return endMutation(transient);
1879
- });
1880
- var add = /* @__PURE__ */ dual(2, (self, value) => self._keyMap._editable ? (set(value, true)(self._keyMap), self) : makeImpl2(set(value, true)(self._keyMap)));
1881
- var union2 = /* @__PURE__ */ dual(2, (self, that) => mutate(empty4(), (set2) => {
1882
- forEach2(self, (value) => add(set2, value));
1883
- for (const value of that) {
1884
- add(set2, value);
1885
- }
1886
- }));
1887
- var forEach2 = /* @__PURE__ */ dual(2, (self, f) => forEach(self._keyMap, (_, k) => f(k)));
1888
-
1889
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/HashSet.js
1890
- var empty5 = empty4;
1891
- var size3 = size2;
1892
- var add2 = add;
1893
- var union3 = union2;
1894
-
1895
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/opCodes/cause.js
1896
- var OP_DIE = "Die";
1897
- var OP_EMPTY = "Empty";
1898
- var OP_FAIL = "Fail";
1899
- var OP_INTERRUPT = "Interrupt";
1900
- var OP_PARALLEL = "Parallel";
1901
- var OP_SEQUENTIAL = "Sequential";
1902
-
1903
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/cause.js
1904
- var CauseSymbolKey = "effect/Cause";
1905
- var CauseTypeId = /* @__PURE__ */ Symbol.for(CauseSymbolKey);
1906
- var variance = {
1907
- /* c8 ignore next */
1908
- _E: (_) => _
1909
- };
1910
- var proto = {
1911
- [CauseTypeId]: variance,
1912
- [symbol]() {
1913
- return pipe(hash(CauseSymbolKey), combine(hash(flattenCause(this))), cached(this));
1914
- },
1915
- [symbol2](that) {
1916
- return isCause(that) && causeEquals(this, that);
1917
- },
1918
- pipe() {
1919
- return pipeArguments(this, arguments);
1920
- },
1921
- toJSON() {
1922
- switch (this._tag) {
1923
- case "Empty":
1924
- return {
1925
- _id: "Cause",
1926
- _tag: this._tag
1927
- };
1928
- case "Die":
1929
- return {
1930
- _id: "Cause",
1931
- _tag: this._tag,
1932
- defect: toJSON(this.defect)
1933
- };
1934
- case "Interrupt":
1935
- return {
1936
- _id: "Cause",
1937
- _tag: this._tag,
1938
- fiberId: this.fiberId.toJSON()
1939
- };
1940
- case "Fail":
1941
- return {
1942
- _id: "Cause",
1943
- _tag: this._tag,
1944
- failure: toJSON(this.error)
1945
- };
1946
- case "Sequential":
1947
- case "Parallel":
1948
- return {
1949
- _id: "Cause",
1950
- _tag: this._tag,
1951
- left: toJSON(this.left),
1952
- right: toJSON(this.right)
1953
- };
1954
- }
1955
- },
1956
- toString() {
1957
- return pretty(this);
1958
- },
1959
- [NodeInspectSymbol]() {
1960
- return this.toJSON();
1961
- }
1962
- };
1963
- var fail = (error) => {
1964
- const o = Object.create(proto);
1965
- o._tag = OP_FAIL;
1966
- o.error = error;
1967
- return o;
1968
- };
1969
- var parallel = (left3, right3) => {
1970
- const o = Object.create(proto);
1971
- o._tag = OP_PARALLEL;
1972
- o.left = left3;
1973
- o.right = right3;
1974
- return o;
1975
- };
1976
- var sequential = (left3, right3) => {
1977
- const o = Object.create(proto);
1978
- o._tag = OP_SEQUENTIAL;
1979
- o.left = left3;
1980
- o.right = right3;
1981
- return o;
1982
- };
1983
- var isCause = (u) => hasProperty(u, CauseTypeId);
1984
- var isInterruptedOnly = (self) => reduceWithContext(void 0, IsInterruptedOnlyCauseReducer)(self);
1985
- var causeEquals = (left3, right3) => {
1986
- let leftStack = of(left3);
1987
- let rightStack = of(right3);
1988
- while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
1989
- const [leftParallel, leftSequential] = pipe(headNonEmpty2(leftStack), reduce4([empty5(), empty2()], ([parallel2, sequential2], cause) => {
1990
- const [par, seq] = evaluateCause(cause);
1991
- return some2([pipe(parallel2, union3(par)), pipe(sequential2, appendAll(seq))]);
1992
- }));
1993
- const [rightParallel, rightSequential] = pipe(headNonEmpty2(rightStack), reduce4([empty5(), empty2()], ([parallel2, sequential2], cause) => {
1994
- const [par, seq] = evaluateCause(cause);
1995
- return some2([pipe(parallel2, union3(par)), pipe(sequential2, appendAll(seq))]);
1996
- }));
1997
- if (!equals(leftParallel, rightParallel)) {
1998
- return false;
1999
- }
2000
- leftStack = leftSequential;
2001
- rightStack = rightSequential;
2002
- }
2003
- return true;
2004
- };
2005
- var flattenCause = (cause) => {
2006
- return flattenCauseLoop(of(cause), empty2());
2007
- };
2008
- var flattenCauseLoop = (causes, flattened) => {
2009
- while (1) {
2010
- const [parallel2, sequential2] = pipe(causes, reduce([empty5(), empty2()], ([parallel3, sequential3], cause) => {
2011
- const [par, seq] = evaluateCause(cause);
2012
- return [pipe(parallel3, union3(par)), pipe(sequential3, appendAll(seq))];
2013
- }));
2014
- const updated = size3(parallel2) > 0 ? pipe(flattened, prepend(parallel2)) : flattened;
2015
- if (isEmpty(sequential2)) {
2016
- return reverse2(updated);
2017
- }
2018
- causes = sequential2;
2019
- flattened = updated;
2020
- }
2021
- throw new Error(getBugErrorMessage("Cause.flattenCauseLoop"));
2022
- };
2023
- var evaluateCause = (self) => {
2024
- let cause = self;
2025
- const stack = [];
2026
- let _parallel = empty5();
2027
- let _sequential = empty2();
2028
- while (cause !== void 0) {
2029
- switch (cause._tag) {
2030
- case OP_EMPTY: {
2031
- if (stack.length === 0) {
2032
- return [_parallel, _sequential];
2033
- }
2034
- cause = stack.pop();
2035
- break;
2036
- }
2037
- case OP_FAIL: {
2038
- _parallel = add2(_parallel, make3(cause._tag, cause.error));
2039
- if (stack.length === 0) {
2040
- return [_parallel, _sequential];
2041
- }
2042
- cause = stack.pop();
2043
- break;
2044
- }
2045
- case OP_DIE: {
2046
- _parallel = add2(_parallel, make3(cause._tag, cause.defect));
2047
- if (stack.length === 0) {
2048
- return [_parallel, _sequential];
2049
- }
2050
- cause = stack.pop();
2051
- break;
2052
- }
2053
- case OP_INTERRUPT: {
2054
- _parallel = add2(_parallel, make3(cause._tag, cause.fiberId));
2055
- if (stack.length === 0) {
2056
- return [_parallel, _sequential];
2057
- }
2058
- cause = stack.pop();
2059
- break;
2060
- }
2061
- case OP_SEQUENTIAL: {
2062
- switch (cause.left._tag) {
2063
- case OP_EMPTY: {
2064
- cause = cause.right;
2065
- break;
2066
- }
2067
- case OP_SEQUENTIAL: {
2068
- cause = sequential(cause.left.left, sequential(cause.left.right, cause.right));
2069
- break;
2070
- }
2071
- case OP_PARALLEL: {
2072
- cause = parallel(sequential(cause.left.left, cause.right), sequential(cause.left.right, cause.right));
2073
- break;
2074
- }
2075
- default: {
2076
- _sequential = prepend(_sequential, cause.right);
2077
- cause = cause.left;
2078
- break;
2079
- }
2080
- }
2081
- break;
2082
- }
2083
- case OP_PARALLEL: {
2084
- stack.push(cause.right);
2085
- cause = cause.left;
2086
- break;
2087
- }
2088
- }
2089
- }
2090
- throw new Error(getBugErrorMessage("Cause.evaluateCauseLoop"));
2091
- };
2092
- var IsInterruptedOnlyCauseReducer = {
2093
- emptyCase: constTrue,
2094
- failCase: constFalse,
2095
- dieCase: constFalse,
2096
- interruptCase: constTrue,
2097
- sequentialCase: (_, left3, right3) => left3 && right3,
2098
- parallelCase: (_, left3, right3) => left3 && right3
2099
- };
2100
- var OP_SEQUENTIAL_CASE = "SequentialCase";
2101
- var OP_PARALLEL_CASE = "ParallelCase";
2102
- var reduce4 = /* @__PURE__ */ dual(3, (self, zero, pf) => {
2103
- let accumulator = zero;
2104
- let cause = self;
2105
- const causes = [];
2106
- while (cause !== void 0) {
2107
- const option2 = pf(accumulator, cause);
2108
- accumulator = isSome2(option2) ? option2.value : accumulator;
2109
- switch (cause._tag) {
2110
- case OP_SEQUENTIAL: {
2111
- causes.push(cause.right);
2112
- cause = cause.left;
2113
- break;
2114
- }
2115
- case OP_PARALLEL: {
2116
- causes.push(cause.right);
2117
- cause = cause.left;
2118
- break;
2119
- }
2120
- default: {
2121
- cause = void 0;
2122
- break;
2123
- }
2124
- }
2125
- if (cause === void 0 && causes.length > 0) {
2126
- cause = causes.pop();
2127
- }
2128
- }
2129
- return accumulator;
2130
- });
2131
- var reduceWithContext = /* @__PURE__ */ dual(3, (self, context, reducer) => {
2132
- const input = [self];
2133
- const output = [];
2134
- while (input.length > 0) {
2135
- const cause = input.pop();
2136
- switch (cause._tag) {
2137
- case OP_EMPTY: {
2138
- output.push(right2(reducer.emptyCase(context)));
2139
- break;
2140
- }
2141
- case OP_FAIL: {
2142
- output.push(right2(reducer.failCase(context, cause.error)));
2143
- break;
2144
- }
2145
- case OP_DIE: {
2146
- output.push(right2(reducer.dieCase(context, cause.defect)));
2147
- break;
2148
- }
2149
- case OP_INTERRUPT: {
2150
- output.push(right2(reducer.interruptCase(context, cause.fiberId)));
2151
- break;
2152
- }
2153
- case OP_SEQUENTIAL: {
2154
- input.push(cause.right);
2155
- input.push(cause.left);
2156
- output.push(left2({
2157
- _tag: OP_SEQUENTIAL_CASE
2158
- }));
2159
- break;
2160
- }
2161
- case OP_PARALLEL: {
2162
- input.push(cause.right);
2163
- input.push(cause.left);
2164
- output.push(left2({
2165
- _tag: OP_PARALLEL_CASE
2166
- }));
2167
- break;
2168
- }
2169
- }
2170
- }
2171
- const accumulator = [];
2172
- while (output.length > 0) {
2173
- const either = output.pop();
2174
- switch (either._tag) {
2175
- case "Left": {
2176
- switch (either.left._tag) {
2177
- case OP_SEQUENTIAL_CASE: {
2178
- const left3 = accumulator.pop();
2179
- const right3 = accumulator.pop();
2180
- const value = reducer.sequentialCase(context, left3, right3);
2181
- accumulator.push(value);
2182
- break;
2183
- }
2184
- case OP_PARALLEL_CASE: {
2185
- const left3 = accumulator.pop();
2186
- const right3 = accumulator.pop();
2187
- const value = reducer.parallelCase(context, left3, right3);
2188
- accumulator.push(value);
2189
- break;
2190
- }
2191
- }
2192
- break;
2193
- }
2194
- case "Right": {
2195
- accumulator.push(either.right);
2196
- break;
2197
- }
2198
- }
2199
- }
2200
- if (accumulator.length === 0) {
2201
- throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");
2202
- }
2203
- return accumulator.pop();
2204
- });
2205
- var pretty = (cause, options) => {
2206
- if (isInterruptedOnly(cause)) {
2207
- return "All fibers interrupted without errors.";
2208
- }
2209
- return prettyErrors(cause).map(function(e) {
2210
- if (options?.renderErrorCause !== true || e.cause === void 0) {
2211
- return e.stack;
2212
- }
2213
- return `${e.stack} {
2214
- ${renderErrorCause(e.cause, " ")}
2215
- }`;
2216
- }).join("\n");
2217
- };
2218
- var renderErrorCause = (cause, prefix) => {
2219
- const lines = cause.stack.split("\n");
2220
- let stack = `${prefix}[cause]: ${lines[0]}`;
2221
- for (let i = 1, len = lines.length; i < len; i++) {
2222
- stack += `
2223
- ${prefix}${lines[i]}`;
2224
- }
2225
- if (cause.cause) {
2226
- stack += ` {
2227
- ${renderErrorCause(cause.cause, `${prefix} `)}
2228
- ${prefix}}`;
2229
- }
2230
- return stack;
2231
- };
2232
- var PrettyError = class _PrettyError extends globalThis.Error {
2233
- span = void 0;
2234
- constructor(originalError) {
2235
- const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
2236
- const prevLimit = Error.stackTraceLimit;
2237
- Error.stackTraceLimit = 1;
2238
- super(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
2239
- cause: new _PrettyError(originalError.cause)
2240
- } : void 0);
2241
- if (this.message === "") {
2242
- this.message = "An error has occurred";
2243
- }
2244
- Error.stackTraceLimit = prevLimit;
2245
- this.name = originalError instanceof Error ? originalError.name : "Error";
2246
- if (originalErrorIsObject) {
2247
- if (spanSymbol in originalError) {
2248
- this.span = originalError[spanSymbol];
2249
- }
2250
- Object.keys(originalError).forEach((key) => {
2251
- if (!(key in this)) {
2252
- this[key] = originalError[key];
2253
- }
2254
- });
2255
- }
2256
- this.stack = prettyErrorStack(`${this.name}: ${this.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", this.span);
2257
- }
2258
- };
2259
- var prettyErrorMessage = (u) => {
2260
- if (typeof u === "string") {
2261
- return u;
2262
- }
2263
- if (typeof u === "object" && u !== null && u instanceof Error) {
2264
- return u.message;
2265
- }
2266
- try {
2267
- if (hasProperty(u, "toString") && isFunction2(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
2268
- return u["toString"]();
2269
- }
2270
- } catch {
2271
- }
2272
- return stringifyCircular(u);
2273
- };
2274
- var locationRegex = /\((.*)\)/g;
2275
- var spanToTrace = /* @__PURE__ */ globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
2276
- var prettyErrorStack = (message, stack, span) => {
2277
- const out = [message];
2278
- const lines = stack.startsWith(message) ? stack.slice(message.length).split("\n") : stack.split("\n");
2279
- for (let i = 1; i < lines.length; i++) {
2280
- if (lines[i].includes("Generator.next")) {
2281
- break;
2282
- }
2283
- if (lines[i].includes("effect_internal_function")) {
2284
- out.pop();
2285
- break;
2286
- }
2287
- out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>"));
2288
- }
2289
- if (span) {
2290
- let current = span;
2291
- let i = 0;
2292
- while (current && current._tag === "Span" && i < 10) {
2293
- const stackFn = spanToTrace.get(current);
2294
- if (typeof stackFn === "function") {
2295
- const stack2 = stackFn();
2296
- if (typeof stack2 === "string") {
2297
- const locationMatchAll = stack2.matchAll(locationRegex);
2298
- let match3 = false;
2299
- for (const [, location] of locationMatchAll) {
2300
- match3 = true;
2301
- out.push(` at ${current.name} (${location})`);
2302
- }
2303
- if (!match3) {
2304
- out.push(` at ${current.name} (${stack2.replace(/^at /, "")})`);
2305
- }
2306
- } else {
2307
- out.push(` at ${current.name}`);
2308
- }
2309
- } else {
2310
- out.push(` at ${current.name}`);
2311
- }
2312
- current = getOrUndefined2(current.parent);
2313
- i++;
2314
- }
2315
- }
2316
- return out.join("\n");
2317
- };
2318
- var spanSymbol = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
2319
- var prettyErrors = (cause) => reduceWithContext(cause, void 0, {
2320
- emptyCase: () => [],
2321
- dieCase: (_, unknownError) => {
2322
- return [new PrettyError(unknownError)];
2323
- },
2324
- failCase: (_, error) => {
2325
- return [new PrettyError(error)];
2326
- },
2327
- interruptCase: () => [],
2328
- parallelCase: (_, l, r) => [...l, ...r],
2329
- sequentialCase: (_, l, r) => [...l, ...r]
2330
- });
2331
-
2332
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/singleShotGen.js
2333
- var SingleShotGen2 = class _SingleShotGen {
2334
- self;
2335
- called = false;
2336
- constructor(self) {
2337
- this.self = self;
2338
- }
2339
- next(a) {
2340
- return this.called ? {
2341
- value: a,
2342
- done: true
2343
- } : (this.called = true, {
2344
- value: this.self,
2345
- done: false
2346
- });
2347
- }
2348
- return(a) {
2349
- return {
2350
- value: a,
2351
- done: true
2352
- };
2353
- }
2354
- throw(e) {
2355
- throw e;
2356
- }
2357
- [Symbol.iterator]() {
2358
- return new _SingleShotGen(this.self);
2359
- }
2360
- };
2361
-
2362
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/core.js
2363
- var EffectTypeId2 = /* @__PURE__ */ Symbol.for("effect/Effect");
2364
- var EffectPrimitive = class {
2365
- _op;
2366
- effect_instruction_i0 = void 0;
2367
- effect_instruction_i1 = void 0;
2368
- effect_instruction_i2 = void 0;
2369
- trace = void 0;
2370
- [EffectTypeId2] = effectVariance;
2371
- constructor(_op) {
2372
- this._op = _op;
2373
- }
2374
- [symbol2](that) {
2375
- return this === that;
2376
- }
2377
- [symbol]() {
2378
- return cached(this, random(this));
2379
- }
2380
- pipe() {
2381
- return pipeArguments(this, arguments);
2382
- }
2383
- toJSON() {
2384
- return {
2385
- _id: "Effect",
2386
- _op: this._op,
2387
- effect_instruction_i0: toJSON(this.effect_instruction_i0),
2388
- effect_instruction_i1: toJSON(this.effect_instruction_i1),
2389
- effect_instruction_i2: toJSON(this.effect_instruction_i2)
2390
- };
2391
- }
2392
- toString() {
2393
- return format(this.toJSON());
2394
- }
2395
- [NodeInspectSymbol]() {
2396
- return this.toJSON();
2397
- }
2398
- [Symbol.iterator]() {
2399
- return new SingleShotGen2(new YieldWrap(this));
2400
- }
2401
- };
2402
- var EffectPrimitiveFailure = class {
2403
- _op;
2404
- effect_instruction_i0 = void 0;
2405
- effect_instruction_i1 = void 0;
2406
- effect_instruction_i2 = void 0;
2407
- trace = void 0;
2408
- [EffectTypeId2] = effectVariance;
2409
- constructor(_op) {
2410
- this._op = _op;
2411
- this._tag = _op;
2412
- }
2413
- [symbol2](that) {
2414
- return exitIsExit(that) && that._op === "Failure" && // @ts-expect-error
2415
- equals(this.effect_instruction_i0, that.effect_instruction_i0);
2416
- }
2417
- [symbol]() {
2418
- return pipe(
2419
- // @ts-expect-error
2420
- string(this._tag),
2421
- // @ts-expect-error
2422
- combine(hash(this.effect_instruction_i0)),
2423
- cached(this)
2424
- );
2425
- }
2426
- get cause() {
2427
- return this.effect_instruction_i0;
2428
- }
2429
- pipe() {
2430
- return pipeArguments(this, arguments);
2431
- }
2432
- toJSON() {
2433
- return {
2434
- _id: "Exit",
2435
- _tag: this._op,
2436
- cause: this.cause.toJSON()
2437
- };
2438
- }
2439
- toString() {
2440
- return format(this.toJSON());
2441
- }
2442
- [NodeInspectSymbol]() {
2443
- return this.toJSON();
2444
- }
2445
- [Symbol.iterator]() {
2446
- return new SingleShotGen2(new YieldWrap(this));
2447
- }
2448
- };
2449
- var EffectPrimitiveSuccess = class {
2450
- _op;
2451
- effect_instruction_i0 = void 0;
2452
- effect_instruction_i1 = void 0;
2453
- effect_instruction_i2 = void 0;
2454
- trace = void 0;
2455
- [EffectTypeId2] = effectVariance;
2456
- constructor(_op) {
2457
- this._op = _op;
2458
- this._tag = _op;
2459
- }
2460
- [symbol2](that) {
2461
- return exitIsExit(that) && that._op === "Success" && // @ts-expect-error
2462
- equals(this.effect_instruction_i0, that.effect_instruction_i0);
2463
- }
2464
- [symbol]() {
2465
- return pipe(
2466
- // @ts-expect-error
2467
- string(this._tag),
2468
- // @ts-expect-error
2469
- combine(hash(this.effect_instruction_i0)),
2470
- cached(this)
2471
- );
2472
- }
2473
- get value() {
2474
- return this.effect_instruction_i0;
2475
- }
2476
- pipe() {
2477
- return pipeArguments(this, arguments);
2478
- }
2479
- toJSON() {
2480
- return {
2481
- _id: "Exit",
2482
- _tag: this._op,
2483
- value: toJSON(this.value)
2484
- };
2485
- }
2486
- toString() {
2487
- return format(this.toJSON());
2488
- }
2489
- [NodeInspectSymbol]() {
2490
- return this.toJSON();
2491
- }
2492
- [Symbol.iterator]() {
2493
- return new SingleShotGen2(new YieldWrap(this));
2494
- }
2495
- };
2496
- var isEffect = (u) => hasProperty(u, EffectTypeId2);
2497
- var withFiberRuntime = (withRuntime) => {
2498
- const effect = new EffectPrimitive(OP_WITH_RUNTIME);
2499
- effect.effect_instruction_i0 = withRuntime;
2500
- return effect;
2501
- };
2502
- var spanSymbol2 = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
2503
- var originalSymbol = /* @__PURE__ */ Symbol.for("effect/OriginalAnnotation");
2504
- var capture = (obj, span) => {
2505
- if (isSome2(span)) {
2506
- return new Proxy(obj, {
2507
- has(target, p) {
2508
- return p === spanSymbol2 || p === originalSymbol || p in target;
2509
- },
2510
- get(target, p) {
2511
- if (p === spanSymbol2) {
2512
- return span.value;
2513
- }
2514
- if (p === originalSymbol) {
2515
- return obj;
2516
- }
2517
- return target[p];
2518
- }
2519
- });
2520
- }
2521
- return obj;
2522
- };
2523
- var fail2 = (error) => isObject(error) && !(spanSymbol2 in error) ? withFiberRuntime((fiber) => failCause(fail(capture(error, currentSpanFromFiber(fiber))))) : failCause(fail(error));
2524
- var failCause = (cause) => {
2525
- const effect = new EffectPrimitiveFailure(OP_FAILURE);
2526
- effect.effect_instruction_i0 = cause;
2527
- return effect;
2528
- };
2529
- var logLevelAll = {
2530
- _tag: "All",
2531
- syslog: 0,
2532
- label: "ALL",
2533
- ordinal: Number.MIN_SAFE_INTEGER,
2534
- pipe() {
2535
- return pipeArguments(this, arguments);
2536
- }
2537
- };
2538
- var logLevelNone = {
2539
- _tag: "None",
2540
- syslog: 7,
2541
- label: "OFF",
2542
- ordinal: Number.MAX_SAFE_INTEGER,
2543
- pipe() {
2544
- return pipeArguments(this, arguments);
2545
- }
2546
- };
2547
- var RequestResolverSymbolKey = "effect/RequestResolver";
2548
- var RequestResolverTypeId = /* @__PURE__ */ Symbol.for(RequestResolverSymbolKey);
2549
- var requestResolverVariance = {
2550
- /* c8 ignore next */
2551
- _A: (_) => _,
2552
- /* c8 ignore next */
2553
- _R: (_) => _
2554
- };
2555
- var RequestResolverImpl = class _RequestResolverImpl {
2556
- runAll;
2557
- target;
2558
- [RequestResolverTypeId] = requestResolverVariance;
2559
- constructor(runAll, target) {
2560
- this.runAll = runAll;
2561
- this.target = target;
2562
- }
2563
- [symbol]() {
2564
- return cached(this, this.target ? hash(this.target) : random(this));
2565
- }
2566
- [symbol2](that) {
2567
- return this.target ? isRequestResolver(that) && equals(this.target, that.target) : this === that;
2568
- }
2569
- identified(...ids) {
2570
- return new _RequestResolverImpl(this.runAll, fromIterable2(ids));
831
+ if (Symbol.iterator in input) {
832
+ const out2 = [];
833
+ for (const e of input) {
834
+ if (isLeft2(e)) {
835
+ return e;
836
+ }
837
+ out2.push(e.right);
838
+ }
839
+ return right2(out2);
2571
840
  }
2572
- pipe() {
2573
- return pipeArguments(this, arguments);
841
+ const out = {};
842
+ for (const key of Object.keys(input)) {
843
+ const e = input[key];
844
+ if (isLeft2(e)) {
845
+ return e;
846
+ }
847
+ out[key] = e.right;
2574
848
  }
849
+ return right2(out);
2575
850
  };
2576
- var isRequestResolver = (u) => hasProperty(u, RequestResolverTypeId);
2577
- var YieldableError = /* @__PURE__ */ function() {
2578
- class YieldableError2 extends globalThis.Error {
2579
- commit() {
2580
- return fail2(this);
851
+ var flip = (self) => isLeft2(self) ? right2(self.left) : left2(self.right);
852
+ var adapter2 = /* @__PURE__ */ adapter();
853
+ var gen = (...args) => {
854
+ const f = args.length === 1 ? args[0] : args[1].bind(args[0]);
855
+ const iterator = f(adapter2);
856
+ let state = iterator.next();
857
+ if (state.done) {
858
+ return right2(state.value);
859
+ } else {
860
+ let current = state.value;
861
+ if (isGenKind(current)) {
862
+ current = current.value;
863
+ } else {
864
+ current = yieldWrapGet(current);
2581
865
  }
2582
- toJSON() {
2583
- return {
2584
- ...this
2585
- };
866
+ if (isLeft2(current)) {
867
+ return current;
2586
868
  }
2587
- [NodeInspectSymbol]() {
2588
- if (this.toString !== globalThis.Error.prototype.toString) {
2589
- return this.stack ? `${this.toString()}
2590
- ${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
2591
- } else if ("Bun" in globalThis) {
2592
- return pretty(fail(this), {
2593
- renderErrorCause: true
2594
- });
869
+ while (!state.done) {
870
+ state = iterator.next(current.right);
871
+ if (!state.done) {
872
+ current = state.value;
873
+ if (isGenKind(current)) {
874
+ current = current.value;
875
+ } else {
876
+ current = yieldWrapGet(current);
877
+ }
878
+ if (isLeft2(current)) {
879
+ return current;
880
+ }
2595
881
  }
2596
- return this;
2597
882
  }
883
+ return right2(state.value);
2598
884
  }
2599
- Object.assign(YieldableError2.prototype, StructuralCommitPrototype);
2600
- return YieldableError2;
2601
- }();
2602
- var makeException = (proto2, tag) => {
2603
- class Base extends YieldableError {
2604
- _tag = tag;
2605
- }
2606
- Object.assign(Base.prototype, proto2);
2607
- Base.prototype.name = tag;
2608
- return Base;
2609
- };
2610
- var RuntimeExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/RuntimeException");
2611
- var RuntimeException = /* @__PURE__ */ makeException({
2612
- [RuntimeExceptionTypeId]: RuntimeExceptionTypeId
2613
- }, "RuntimeException");
2614
- var InterruptedExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/InterruptedException");
2615
- var InterruptedException = /* @__PURE__ */ makeException({
2616
- [InterruptedExceptionTypeId]: InterruptedExceptionTypeId
2617
- }, "InterruptedException");
2618
- var IllegalArgumentExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/IllegalArgument");
2619
- var IllegalArgumentException = /* @__PURE__ */ makeException({
2620
- [IllegalArgumentExceptionTypeId]: IllegalArgumentExceptionTypeId
2621
- }, "IllegalArgumentException");
2622
- var NoSuchElementExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/NoSuchElement");
2623
- var NoSuchElementException = /* @__PURE__ */ makeException({
2624
- [NoSuchElementExceptionTypeId]: NoSuchElementExceptionTypeId
2625
- }, "NoSuchElementException");
2626
- var InvalidPubSubCapacityExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException");
2627
- var InvalidPubSubCapacityException = /* @__PURE__ */ makeException({
2628
- [InvalidPubSubCapacityExceptionTypeId]: InvalidPubSubCapacityExceptionTypeId
2629
- }, "InvalidPubSubCapacityException");
2630
- var ExceededCapacityExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/ExceededCapacityException");
2631
- var ExceededCapacityException = /* @__PURE__ */ makeException({
2632
- [ExceededCapacityExceptionTypeId]: ExceededCapacityExceptionTypeId
2633
- }, "ExceededCapacityException");
2634
- var TimeoutExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/Timeout");
2635
- var TimeoutException = /* @__PURE__ */ makeException({
2636
- [TimeoutExceptionTypeId]: TimeoutExceptionTypeId
2637
- }, "TimeoutException");
2638
- var exitIsExit = (u) => isEffect(u) && "_tag" in u && (u._tag === "Success" || u._tag === "Failure");
2639
- var currentSpanFromFiber = (fiber) => {
2640
- const span = fiber.currentSpan;
2641
- return span !== void 0 && span._tag === "Span" ? some2(span) : none2();
2642
885
  };
886
+ var Do = /* @__PURE__ */ right2({});
887
+ var bind2 = /* @__PURE__ */ bind(map, flatMap);
888
+ var bindTo2 = /* @__PURE__ */ bindTo(map);
889
+ var let_2 = /* @__PURE__ */ let_(map);
2643
890
 
2644
- // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Data.js
2645
- var Error2 = /* @__PURE__ */ function() {
2646
- const plainArgsSymbol = /* @__PURE__ */ Symbol.for("effect/Data/Error/plainArgs");
2647
- return class Base extends YieldableError {
2648
- constructor(args) {
2649
- super(args?.message, args?.cause ? {
2650
- cause: args.cause
2651
- } : void 0);
2652
- if (args) {
2653
- Object.assign(this, args);
2654
- Object.defineProperty(this, plainArgsSymbol, {
2655
- value: args,
2656
- enumerable: false
2657
- });
2658
- }
891
+ // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/array.js
892
+ var isNonEmptyArray = (self) => self.length > 0;
893
+
894
+ // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Order.js
895
+ var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
896
+
897
+ // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Option.js
898
+ var none2 = () => none;
899
+ var some2 = some;
900
+ var isNone2 = isNone;
901
+ var isSome2 = isSome;
902
+ var match2 = /* @__PURE__ */ dual(2, (self, {
903
+ onNone,
904
+ onSome
905
+ }) => isNone2(self) ? onNone() : onSome(self.value));
906
+ var getOrElse2 = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
907
+ var orElse2 = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
908
+ var fromNullable2 = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
909
+ var getOrUndefined2 = /* @__PURE__ */ getOrElse2(constUndefined);
910
+
911
+ // node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Array.js
912
+ var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
913
+ var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
914
+ var isArray = Array.isArray;
915
+ var isEmptyArray = (self) => self.length === 0;
916
+ var isEmptyReadonlyArray = isEmptyArray;
917
+ var isNonEmptyReadonlyArray = isNonEmptyArray;
918
+ var isOutOfBound = (i, as) => i < 0 || i >= as.length;
919
+ var get = /* @__PURE__ */ dual(2, (self, index) => {
920
+ const i = Math.floor(index);
921
+ return isOutOfBound(i, self) ? none2() : some2(self[i]);
922
+ });
923
+ var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
924
+ const i = Math.floor(index);
925
+ if (isOutOfBound(i, self)) {
926
+ throw new Error(`Index ${i} out of bounds`);
927
+ }
928
+ return self[i];
929
+ });
930
+ var head = /* @__PURE__ */ get(0);
931
+ var headNonEmpty = /* @__PURE__ */ unsafeGet(0);
932
+ var tailNonEmpty = (self) => self.slice(1);
933
+ var sort = /* @__PURE__ */ dual(2, (self, O) => {
934
+ const out = Array.from(self);
935
+ out.sort(O);
936
+ return out;
937
+ });
938
+ var empty = () => [];
939
+ var map2 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
940
+ var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => {
941
+ if (isEmptyReadonlyArray(self)) {
942
+ return [];
943
+ }
944
+ const out = [];
945
+ for (let i = 0; i < self.length; i++) {
946
+ const inner = f(self[i], i);
947
+ for (let j = 0; j < inner.length; j++) {
948
+ out.push(inner[j]);
2659
949
  }
2660
- toJSON() {
2661
- return {
2662
- ...this[plainArgsSymbol],
2663
- ...this
2664
- };
950
+ }
951
+ return out;
952
+ });
953
+ var flatten = /* @__PURE__ */ flatMap2(identity);
954
+ var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
955
+ const as = fromIterable(self);
956
+ const out = [];
957
+ for (let i = 0; i < as.length; i++) {
958
+ if (predicate(as[i], i)) {
959
+ out.push(as[i]);
2665
960
  }
2666
- };
2667
- }();
2668
- var TaggedError = (tag) => {
2669
- class Base extends Error2 {
2670
- _tag = tag;
2671
961
  }
2672
- ;
2673
- Base.prototype.name = tag;
2674
- return Base;
2675
- };
962
+ return out;
963
+ });
964
+ var reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable(self).reduce((b2, a, i) => f(b2, a, i), b));
965
+ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
966
+ const input = fromIterable(self);
967
+ if (isNonEmptyReadonlyArray(input)) {
968
+ const out = [headNonEmpty(input)];
969
+ const rest = tailNonEmpty(input);
970
+ for (const r of rest) {
971
+ if (out.every((a) => !isEquivalent(r, a))) {
972
+ out.push(r);
973
+ }
974
+ }
975
+ return out;
976
+ }
977
+ return [];
978
+ });
2676
979
 
2677
980
  // src/core/Nano.ts
2678
- var NanoDefectException = class extends TaggedError("NanoDefectException") {
981
+ var NanoDefectException = class {
982
+ constructor(message) {
983
+ this.message = message;
984
+ }
985
+ _tag = "@effect/language-service/NanoDefectException";
2679
986
  };
2680
987
  var NanoTag = class {
2681
988
  constructor(key) {
@@ -2712,23 +1019,23 @@ var run = (fa) => {
2712
1019
  case "Left":
2713
1020
  return left2(result.left);
2714
1021
  case "Defect":
2715
- return left2(new NanoDefectException({ message: result.defect }));
1022
+ return left2(new NanoDefectException(result.defect));
2716
1023
  case "Right":
2717
1024
  return right2(result.right);
2718
1025
  }
2719
1026
  } catch (e) {
2720
- return left2(new NanoDefectException({ message: e }));
1027
+ return left2(new NanoDefectException(e));
2721
1028
  }
2722
1029
  };
2723
1030
  var succeed = (value) => new Nano(() => ({ _tag: "Right", right: value }));
2724
- var fail3 = (value) => new Nano(() => ({ _tag: "Left", left: value }));
1031
+ var fail = (value) => new Nano(() => ({ _tag: "Left", left: value }));
2725
1032
  var sync = (value) => new Nano(() => ({ _tag: "Right", right: value() }));
2726
- var flatMap5 = dual(2, (fa, f) => new Nano((ctx) => {
1033
+ var flatMap3 = dual(2, (fa, f) => new Nano((ctx) => {
2727
1034
  const result = fa.run(ctx);
2728
1035
  if (result._tag !== "Right") return result;
2729
1036
  return f(result.right).run(ctx);
2730
1037
  }));
2731
- var map7 = dual(2, (fa, f) => new Nano((ctx) => {
1038
+ var map3 = dual(2, (fa, f) => new Nano((ctx) => {
2732
1039
  const result = fa.run(ctx);
2733
1040
  if (result._tag !== "Right") return result;
2734
1041
  return { _tag: "Right", right: f(result.right) };
@@ -2809,7 +1116,8 @@ var getAncestorNodesInRange = fn("AST.getAncestorNodesInRange")(function* (sourc
2809
1116
  if (isNone2(nodeAtPosition)) return empty();
2810
1117
  return yield* collectSelfAndAncestorNodesInRange(nodeAtPosition.value, textRange);
2811
1118
  });
2812
- var NodeNotFoundError = class extends TaggedError("@effect/language-service/NodeNotFoundError") {
1119
+ var NodeNotFoundError = class {
1120
+ _tag = "@effect/language-service/NodeNotFoundError";
2813
1121
  };
2814
1122
  var findNodeAtPosition = fn("AST.findNodeAtPosition")(function* (sourceFile, position) {
2815
1123
  const ts = yield* service(TypeScriptApi);
@@ -2820,19 +1128,19 @@ var findNodeAtPosition = fn("AST.findNodeAtPosition")(function* (sourceFile, pos
2820
1128
  return void 0;
2821
1129
  }
2822
1130
  const result = find(sourceFile);
2823
- if (!result) return yield* fail3(new NodeNotFoundError());
1131
+ if (!result) return yield* fail(new NodeNotFoundError());
2824
1132
  return result;
2825
1133
  });
2826
1134
  var getCommentAtPosition = fn("TypeScriptApi.getCommentAtPosition")(function* (sourceFile, pos) {
2827
1135
  const ts = yield* service(TypeScriptApi);
2828
1136
  const token = yield* findNodeAtPosition(sourceFile, pos);
2829
1137
  if (token === void 0 || token.kind === ts.SyntaxKind.JsxText || pos >= token.end - (ts.tokenToString(token.kind) || "").length) {
2830
- return yield* fail3(new NodeNotFoundError());
1138
+ return yield* fail(new NodeNotFoundError());
2831
1139
  }
2832
1140
  const startPos = token.pos === 0 ? (ts.getShebang(sourceFile.text) || "").length : token.pos;
2833
- if (startPos === 0) return yield* fail3(new NodeNotFoundError());
1141
+ if (startPos === 0) return yield* fail(new NodeNotFoundError());
2834
1142
  const result = ts.forEachTrailingCommentRange(sourceFile.text, startPos, isCommentInRange, pos) || ts.forEachLeadingCommentRange(sourceFile.text, startPos, isCommentInRange, pos);
2835
- if (!result) return yield* fail3(new NodeNotFoundError());
1143
+ if (!result) return yield* fail(new NodeNotFoundError());
2836
1144
  return result;
2837
1145
  });
2838
1146
  function isCommentInRange(pos, end, kind, _nl, at) {
@@ -2946,7 +1254,8 @@ var removeReturnTypeAnnotation = fn("AST.removeReturnTypeAnnotation")(function*
2946
1254
  changes.deleteRange(sourceFile, { pos: endNode.end, end: declaration.type.end });
2947
1255
  }
2948
1256
  });
2949
- var ImportModuleIdentifierNotFoundError = class extends TaggedError("@effect/language-service/ImportModuleIdentifierNotFoundError") {
1257
+ var ImportModuleIdentifierNotFoundError = class {
1258
+ _tag = "@effect/language-service/ImportModuleIdentifierNotFoundError";
2950
1259
  };
2951
1260
  var findImportedModuleIdentifier = fn("AST.findImportedModuleIdentifier")(
2952
1261
  function* (sourceFile, test) {
@@ -2972,7 +1281,7 @@ var findImportedModuleIdentifier = fn("AST.findImportedModuleIdentifier")(
2972
1281
  }
2973
1282
  }
2974
1283
  }
2975
- return yield* fail3(new ImportModuleIdentifierNotFoundError());
1284
+ return yield* fail(new ImportModuleIdentifierNotFoundError());
2976
1285
  }
2977
1286
  );
2978
1287
  function findImportedModuleIdentifierByPackageAndNameOrBarrel(sourceFile, packageName, moduleName) {
@@ -3098,7 +1407,8 @@ var parseDataForExtendsClassCompletion = fn(
3098
1407
  });
3099
1408
 
3100
1409
  // src/core/LSP.ts
3101
- var RefactorNotApplicableError = class extends TaggedError("RefactorNotApplicableError") {
1410
+ var RefactorNotApplicableError = class {
1411
+ _tag = "@effect/language-service/RefactorNotApplicableError";
3102
1412
  };
3103
1413
  function createRefactor(definition) {
3104
1414
  return definition;
@@ -3110,13 +1420,12 @@ function createCompletion(definition) {
3110
1420
  return definition;
3111
1421
  }
3112
1422
  var PluginOptions = Tag("PluginOptions");
3113
- var SourceFileNotFoundError = class extends TaggedError("SourceFileNotFoundError") {
3114
- };
3115
- var getSemanticDiagnostics = fn("LSP.getSemanticDiagnostics")(function* (diagnostics2, sourceFile) {
1423
+ var getSemanticDiagnosticsWithCodeFixes = fn("LSP.getSemanticDiagnostics")(function* (rules, sourceFile) {
3116
1424
  const effectDiagnostics = [];
1425
+ const effectCodeFixes = [];
3117
1426
  const executor = yield* createDiagnosticExecutor(sourceFile);
3118
- for (const diagnostic of diagnostics2) {
3119
- const result = yield* option(executor.execute(diagnostic));
1427
+ for (const rule of rules) {
1428
+ const result = yield* option(executor.execute(rule));
3120
1429
  if (isSome2(result)) {
3121
1430
  effectDiagnostics.push(
3122
1431
  ...pipe(
@@ -3127,35 +1436,34 @@ var getSemanticDiagnostics = fn("LSP.getSemanticDiagnostics")(function* (diagnos
3127
1436
  length: _.node.getEnd() - _.node.getStart(sourceFile),
3128
1437
  messageText: _.messageText,
3129
1438
  category: _.category,
3130
- code: diagnostic.code,
1439
+ code: rule.code,
3131
1440
  source: "effect"
3132
1441
  }))
3133
1442
  )
3134
1443
  );
3135
- }
3136
- }
3137
- return effectDiagnostics;
3138
- });
3139
- var getCodeFixesAtPosition = fn("LSP.getCodeFixesAtPosition")(function* (diagnostics2, sourceFile, start, end, errorCodes) {
3140
- const runnableDiagnostics = diagnostics2.filter((_) => errorCodes.indexOf(_.code) > -1);
3141
- const applicableFixes = [];
3142
- const executor = yield* createDiagnosticExecutor(sourceFile);
3143
- for (const diagnostic of runnableDiagnostics) {
3144
- const result = yield* option(executor.execute(diagnostic));
3145
- if (isSome2(result)) {
3146
- applicableFixes.push(
1444
+ effectCodeFixes.push(
3147
1445
  ...pipe(
3148
1446
  result.value,
3149
- filter(
3150
- (_) => _.node.getStart(sourceFile) === start && _.node.getEnd() === end
1447
+ map2(
1448
+ (_) => map2(
1449
+ _.fixes,
1450
+ (fix) => ({
1451
+ ...fix,
1452
+ code: rule.code,
1453
+ start: _.node.getStart(sourceFile),
1454
+ end: _.node.getEnd()
1455
+ })
1456
+ )
3151
1457
  ),
3152
- map2((_) => _.fixes),
3153
1458
  flatten
3154
1459
  )
3155
1460
  );
3156
1461
  }
3157
1462
  }
3158
- return applicableFixes;
1463
+ return {
1464
+ diagnostics: effectDiagnostics,
1465
+ codeFixes: effectCodeFixes
1466
+ };
3159
1467
  });
3160
1468
  var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refactors2, sourceFile, positionOrRange) {
3161
1469
  const textRange = typeof positionOrRange === "number" ? { pos: positionOrRange, end: positionOrRange } : positionOrRange;
@@ -3179,7 +1487,7 @@ var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refacto
3179
1487
  var getEditsForRefactor = fn("LSP.getEditsForRefactor")(function* (refactors2, sourceFile, positionOrRange, refactorName) {
3180
1488
  const refactor = refactors2.find((refactor2) => refactor2.name === refactorName);
3181
1489
  if (!refactor) {
3182
- return yield* fail3(new RefactorNotApplicableError());
1490
+ return yield* fail(new RefactorNotApplicableError());
3183
1491
  }
3184
1492
  const textRange = typeof positionOrRange === "number" ? { pos: positionOrRange, end: positionOrRange } : positionOrRange;
3185
1493
  return yield* refactor.apply(sourceFile, textRange);
@@ -3249,7 +1557,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
3249
1557
  const fixByDisableEntireFile = {
3250
1558
  fixName: rule.name + "_skipFile",
3251
1559
  description: "Disable " + rule.name + " for this file",
3252
- apply: flatMap5(
1560
+ apply: flatMap3(
3253
1561
  service(ChangeTracker),
3254
1562
  (changeTracker) => sync(
3255
1563
  () => changeTracker.insertText(
@@ -3467,7 +1775,11 @@ var getMissingTypeEntriesInTargetType = fn(
3467
1775
  return result;
3468
1776
  }
3469
1777
  );
3470
- var CannotFindAncestorConvertibleDeclarationError = class extends TaggedError("CannotFindAncestorConvertibleDeclarationError") {
1778
+ var CannotFindAncestorConvertibleDeclarationError = class {
1779
+ constructor(node) {
1780
+ this.node = node;
1781
+ }
1782
+ _tag = "@effect/language-service/CannotFindAncestorConvertibleDeclarationError";
3471
1783
  };
3472
1784
  var getAncestorConvertibleDeclaration = fn(
3473
1785
  "TypeCheckerApi.getAncestorConvertibleDeclaration"
@@ -3480,17 +1792,25 @@ var getAncestorConvertibleDeclaration = fn(
3480
1792
  }
3481
1793
  current = current.parent;
3482
1794
  }
3483
- return yield* fail3(new CannotFindAncestorConvertibleDeclarationError({ node }));
1795
+ return yield* fail(new CannotFindAncestorConvertibleDeclarationError(node));
3484
1796
  });
3485
- var CannotInferReturnTypeFromEmptyBody = class extends TaggedError("CannotInferReturnTypeFromEmptyBody") {
1797
+ var CannotInferReturnTypeFromEmptyBody = class {
1798
+ constructor(declaration) {
1799
+ this.declaration = declaration;
1800
+ }
1801
+ _tag = "@effect/language-service/CannotInferReturnTypeFromEmptyBody";
3486
1802
  };
3487
- var CannotInferReturnType = class extends TaggedError("CannotInferReturnType") {
1803
+ var CannotInferReturnType = class {
1804
+ constructor(declaration) {
1805
+ this.declaration = declaration;
1806
+ }
1807
+ _tag = "@effect/language-service/CannotInferReturnType";
3488
1808
  };
3489
1809
  var getInferredReturnType = fn("TypeCheckerApi.getInferredReturnType")(function* (declaration) {
3490
1810
  const typeChecker = yield* service(TypeCheckerApi);
3491
1811
  if (!declaration.body) {
3492
- return yield* fail3(
3493
- new CannotInferReturnTypeFromEmptyBody({ declaration })
1812
+ return yield* fail(
1813
+ new CannotInferReturnTypeFromEmptyBody(declaration)
3494
1814
  );
3495
1815
  }
3496
1816
  let returnType;
@@ -3514,8 +1834,8 @@ var getInferredReturnType = fn("TypeCheckerApi.getInferredReturnType")(function*
3514
1834
  }
3515
1835
  }
3516
1836
  if (!returnType) {
3517
- return yield* fail3(
3518
- new CannotInferReturnType({ declaration })
1837
+ return yield* fail(
1838
+ new CannotInferReturnType(declaration)
3519
1839
  );
3520
1840
  }
3521
1841
  return returnType;
@@ -3607,10 +1927,16 @@ var expectedAndRealType = fn("TypeCheckerApi.expectedAndRealType")(function* (so
3607
1927
  });
3608
1928
 
3609
1929
  // src/utils/TypeParser.ts
3610
- var TypeParserIssue = class extends TaggedError("@effect/language-service/TypeParserIssue") {
1930
+ var TypeParserIssue = class {
1931
+ constructor(type, node, message) {
1932
+ this.type = type;
1933
+ this.node = node;
1934
+ this.message = message;
1935
+ }
1936
+ _tag = "@effect/language-service/TypeParserIssue";
3611
1937
  };
3612
1938
  function typeParserIssue(message, type, node) {
3613
- return fail3(new TypeParserIssue({ type, message, node }));
1939
+ return fail(new TypeParserIssue(type, node, message));
3614
1940
  }
3615
1941
  function covariantTypeArgument(type) {
3616
1942
  const signatures = type.getCallSignatures();
@@ -4007,41 +2333,38 @@ var missingStarInYieldEffectGen = createDiagnostic({
4007
2333
  code: 4,
4008
2334
  apply: fn("missingStarInYieldEffectGen.apply")(function* (sourceFile) {
4009
2335
  const ts = yield* service(TypeScriptApi);
4010
- const typeChecker = yield* service(TypeCheckerApi);
4011
2336
  const effectDiagnostics = [];
4012
2337
  const brokenGenerators = /* @__PURE__ */ new Set();
4013
2338
  const brokenYields = /* @__PURE__ */ new Set();
4014
2339
  const nodeToVisit = [];
4015
- const appendNodeToVisit = (functionStarNode) => (node) => {
4016
- nodeToVisit.push([node, functionStarNode]);
2340
+ const appendNodeToVisit = (node) => {
2341
+ nodeToVisit.push(node);
4017
2342
  return void 0;
4018
2343
  };
4019
- ts.forEachChild(sourceFile, appendNodeToVisit(void 0));
2344
+ ts.forEachChild(sourceFile, appendNodeToVisit);
4020
2345
  while (nodeToVisit.length > 0) {
4021
- const [node, functionStarNode] = nodeToVisit.shift();
4022
- if (functionStarNode && ts.isYieldExpression(node) && node.expression && node.asteriskToken === void 0) {
4023
- const type = typeChecker.getTypeAtLocation(node.expression);
4024
- const effect = yield* option(effectType(type, node.expression));
4025
- if (isSome2(effect)) {
4026
- brokenGenerators.add(functionStarNode);
4027
- brokenYields.add(node);
4028
- }
4029
- }
4030
- const effectGenLike = yield* pipe(
4031
- effectGen(node),
4032
- orElse3(() => effectFnUntracedGen(node)),
4033
- orElse3(() => effectFnGen(node)),
4034
- option
4035
- );
4036
- if (isSome2(effectGenLike)) {
4037
- ts.forEachChild(
4038
- effectGenLike.value.body,
4039
- appendNodeToVisit(effectGenLike.value.functionStar)
2346
+ const node = nodeToVisit.shift();
2347
+ ts.forEachChild(node, appendNodeToVisit);
2348
+ if (ts.isYieldExpression(node) && node.expression && node.asteriskToken === void 0) {
2349
+ const functionStarNode = ts.findAncestor(
2350
+ node,
2351
+ (_) => (ts.isFunctionExpression(_) || ts.isMethodDeclaration(_)) && _.asteriskToken !== void 0
4040
2352
  );
4041
- } else if ((ts.isFunctionExpression(node) || ts.isMethodDeclaration(node)) && node.asteriskToken !== void 0) {
4042
- ts.forEachChild(node, appendNodeToVisit(void 0));
4043
- } else {
4044
- ts.forEachChild(node, appendNodeToVisit(functionStarNode));
2353
+ if (functionStarNode && functionStarNode.parent) {
2354
+ const effectGenNode = functionStarNode.parent;
2355
+ const effectGenLike = yield* pipe(
2356
+ effectGen(effectGenNode),
2357
+ orElse3(() => effectFnUntracedGen(effectGenNode)),
2358
+ orElse3(() => effectFnGen(effectGenNode)),
2359
+ option
2360
+ );
2361
+ if (isSome2(effectGenLike)) {
2362
+ if (effectGenLike.value.functionStar) {
2363
+ brokenGenerators.add(effectGenLike.value.functionStar);
2364
+ }
2365
+ brokenYields.add(node);
2366
+ }
2367
+ }
4045
2368
  }
4046
2369
  }
4047
2370
  brokenGenerators.forEach(
@@ -4096,18 +2419,28 @@ var unnecessaryEffectGen = createDiagnostic({
4096
2419
  while (nodeToVisit.length > 0) {
4097
2420
  const node = nodeToVisit.shift();
4098
2421
  ts.forEachChild(node, appendNodeToVisit);
4099
- const maybeUnnecessaryGen = yield* pipe(
4100
- effectGen(node),
4101
- flatMap5(({ body }) => returnYieldEffectBlock(body)),
4102
- option
2422
+ const maybeUnnecessaryYield = yield* option(
2423
+ returnYieldEffectBlock(node)
4103
2424
  );
4104
- if (isSome2(maybeUnnecessaryGen)) {
4105
- unnecessaryGenerators.set(node, maybeUnnecessaryGen.value);
2425
+ if (isSome2(maybeUnnecessaryYield)) {
2426
+ const functionStarNode = ts.findAncestor(
2427
+ node,
2428
+ (_) => (ts.isFunctionExpression(_) || ts.isMethodDeclaration(_)) && _.asteriskToken !== void 0
2429
+ );
2430
+ if (functionStarNode && functionStarNode.parent) {
2431
+ const effectGenNode = functionStarNode.parent;
2432
+ const maybeUnnecessaryGen = yield* option(
2433
+ effectGen(effectGenNode)
2434
+ );
2435
+ if (isSome2(maybeUnnecessaryGen)) {
2436
+ unnecessaryGenerators.set(maybeUnnecessaryGen.value.node, maybeUnnecessaryYield.value);
2437
+ }
2438
+ }
4106
2439
  }
4107
2440
  }
4108
2441
  unnecessaryGenerators.forEach(
4109
- (body, node) => effectDiagnostics.push({
4110
- node,
2442
+ (yieldedResult, effectGenCall) => effectDiagnostics.push({
2443
+ node: effectGenCall,
4111
2444
  category: ts.DiagnosticCategory.Suggestion,
4112
2445
  messageText: `This Effect.gen is useless here because it only contains a single return statement.`,
4113
2446
  fixes: [{
@@ -4117,7 +2450,7 @@ var unnecessaryEffectGen = createDiagnostic({
4117
2450
  const textChanges = yield* service(
4118
2451
  ChangeTracker
4119
2452
  );
4120
- textChanges.replaceNode(sourceFile, node, body);
2453
+ textChanges.replaceNode(sourceFile, effectGenCall, yieldedResult);
4121
2454
  })
4122
2455
  }]
4123
2456
  })
@@ -4216,7 +2549,7 @@ var asyncAwaitToGen = createRefactor({
4216
2549
  ),
4217
2550
  head
4218
2551
  );
4219
- if (isNone2(maybeNode)) return yield* fail3(new RefactorNotApplicableError());
2552
+ if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
4220
2553
  const node = maybeNode.value;
4221
2554
  return {
4222
2555
  kind: "refactor.rewrite.effect.asyncAwaitToGen",
@@ -4231,7 +2564,7 @@ var asyncAwaitToGen = createRefactor({
4231
2564
  (node2) => pipe(
4232
2565
  importedEffectModule(node2),
4233
2566
  option,
4234
- map7(isSome2)
2567
+ map3(isSome2)
4235
2568
  )
4236
2569
  )
4237
2570
  ),
@@ -4288,7 +2621,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
4288
2621
  ),
4289
2622
  head
4290
2623
  );
4291
- if (isNone2(maybeNode)) return yield* fail3(new RefactorNotApplicableError());
2624
+ if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
4292
2625
  const node = maybeNode.value;
4293
2626
  return {
4294
2627
  kind: "refactor.rewrite.effect.asyncAwaitToGenTryPromise",
@@ -4303,7 +2636,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
4303
2636
  (node2) => pipe(
4304
2637
  importedEffectModule(node2),
4305
2638
  option,
4306
- map7(isSome2)
2639
+ map3(isSome2)
4307
2640
  )
4308
2641
  )
4309
2642
  ),
@@ -4401,7 +2734,7 @@ var effectGenToFn = createRefactor({
4401
2734
  }
4402
2735
  break;
4403
2736
  }
4404
- return yield* fail3(new RefactorNotApplicableError());
2737
+ return yield* fail(new RefactorNotApplicableError());
4405
2738
  });
4406
2739
  }
4407
2740
  const maybeNode = yield* pipe(
@@ -4410,7 +2743,7 @@ var effectGenToFn = createRefactor({
4410
2743
  firstSuccessOf,
4411
2744
  option
4412
2745
  );
4413
- if (isNone2(maybeNode)) return yield* fail3(new RefactorNotApplicableError());
2746
+ if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
4414
2747
  const { effectModule, generatorFunction, nodeToReplace, pipeArgs } = maybeNode.value;
4415
2748
  return {
4416
2749
  kind: "refactor.rewrite.effect.effectGenToFn",
@@ -4467,7 +2800,7 @@ var functionToArrow = createRefactor({
4467
2800
  filter((_) => !!_.name && isNodeInRange(textRange)(_.name)),
4468
2801
  head
4469
2802
  );
4470
- if (isNone2(maybeNode)) return yield* fail3(new RefactorNotApplicableError());
2803
+ if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
4471
2804
  const node = maybeNode.value;
4472
2805
  return {
4473
2806
  kind: "refactor.rewrite.effect.functionToArrow",
@@ -4580,7 +2913,7 @@ var pipeableToDatafirst = createRefactor({
4580
2913
  map2((_) => _.value),
4581
2914
  head
4582
2915
  );
4583
- if (isNone2(maybeNode)) return yield* fail3(new RefactorNotApplicableError());
2916
+ if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
4584
2917
  const [node, newNode] = maybeNode.value;
4585
2918
  return {
4586
2919
  kind: "refactor.rewrite.effect.pipeableToDatafirst",
@@ -4601,7 +2934,7 @@ var removeUnnecessaryEffectGen = createRefactor({
4601
2934
  for (const nodeToReplace of yield* getAncestorNodesInRange(sourceFile, textRange)) {
4602
2935
  const maybeNode = yield* pipe(
4603
2936
  effectGen(nodeToReplace),
4604
- flatMap5(({ body }) => returnYieldEffectBlock(body)),
2937
+ flatMap3(({ body }) => returnYieldEffectBlock(body)),
4605
2938
  option
4606
2939
  );
4607
2940
  if (isNone2(maybeNode)) continue;
@@ -4615,7 +2948,7 @@ var removeUnnecessaryEffectGen = createRefactor({
4615
2948
  })
4616
2949
  };
4617
2950
  }
4618
- return yield* fail3(new RefactorNotApplicableError());
2951
+ return yield* fail(new RefactorNotApplicableError());
4619
2952
  })
4620
2953
  });
4621
2954
 
@@ -4634,7 +2967,7 @@ var toggleLazyConst = createRefactor({
4634
2967
  ),
4635
2968
  head
4636
2969
  );
4637
- if (isNone2(maybeNode)) return yield* fail3(new RefactorNotApplicableError());
2970
+ if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
4638
2971
  const node = maybeNode.value;
4639
2972
  return {
4640
2973
  kind: "refactor.rewrite.effect.toggleLazyConst",
@@ -4673,7 +3006,7 @@ var toggleReturnTypeAnnotation = createRefactor({
4673
3006
  ),
4674
3007
  head
4675
3008
  );
4676
- if (isNone2(maybeNode)) return yield* fail3(new RefactorNotApplicableError());
3009
+ if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
4677
3010
  const node = maybeNode.value;
4678
3011
  if (node.type) {
4679
3012
  return {
@@ -4686,13 +3019,13 @@ var toggleReturnTypeAnnotation = createRefactor({
4686
3019
  };
4687
3020
  }
4688
3021
  const returnType = yield* option(getInferredReturnType(node));
4689
- if (isNone2(returnType)) return yield* fail3(new RefactorNotApplicableError());
3022
+ if (isNone2(returnType)) return yield* fail(new RefactorNotApplicableError());
4690
3023
  const returnTypeNode = typeChecker.typeToTypeNode(
4691
3024
  returnType.value,
4692
3025
  node,
4693
3026
  ts.NodeBuilderFlags.NoTruncation
4694
3027
  );
4695
- if (!returnTypeNode) return yield* fail3(new RefactorNotApplicableError());
3028
+ if (!returnTypeNode) return yield* fail(new RefactorNotApplicableError());
4696
3029
  return {
4697
3030
  kind: "refactor.rewrite.effect.toggleReturnTypeAnnotation",
4698
3031
  description: "Toggle return type annotation",
@@ -4725,7 +3058,7 @@ var toggleTypeAnnotation = createRefactor({
4725
3058
  filter((node2) => !!node2.initializer),
4726
3059
  head
4727
3060
  );
4728
- if (isNone2(maybeNode)) return yield* fail3(new RefactorNotApplicableError());
3061
+ if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
4729
3062
  const node = maybeNode.value;
4730
3063
  return {
4731
3064
  kind: "refactor.rewrite.effect.toggleTypeAnnotation",
@@ -4776,7 +3109,7 @@ var wrapWithPipe = createRefactor({
4776
3109
  description: "Wrap with pipe",
4777
3110
  apply: (sourceFile, textRange) => gen2(function* () {
4778
3111
  if (textRange.end - textRange.pos === 0) {
4779
- return yield* fail3(new RefactorNotApplicableError());
3112
+ return yield* fail(new RefactorNotApplicableError());
4780
3113
  }
4781
3114
  return {
4782
3115
  kind: "refactor.rewrite.effect.wrapWithPipe",
@@ -4813,10 +3146,6 @@ var init = (modules) => {
4813
3146
  quickinfo: info.config && "quickinfo" in info.config && typeof info.config.quickinfo === "boolean" ? info.config.quickinfo : true,
4814
3147
  completions: info.config && "completions" in info.config && typeof info.config.completions === "boolean" ? info.config.completions : true
4815
3148
  };
4816
- const proxy = /* @__PURE__ */ Object.create(null);
4817
- for (const k of Object.keys(languageService)) {
4818
- proxy[k] = (...args) => languageService[k].apply(languageService, args);
4819
- }
4820
3149
  const diagnosticsErrorCodes = diagnostics.map((diagnostic) => diagnostic.code);
4821
3150
  try {
4822
3151
  ;
@@ -4826,81 +3155,20 @@ var init = (modules) => {
4826
3155
  });
4827
3156
  } catch (_) {
4828
3157
  }
4829
- proxy.getSupportedCodeFixes = (...args) => languageService.getSupportedCodeFixes(...args).concat(
4830
- diagnosticsErrorCodes.map((_) => "" + _)
4831
- );
4832
- proxy.getCodeFixesAtPosition = (fileName, start, end, errorCodes, formatOptions, preferences, ...args) => {
4833
- const applicableCodeFixes = languageService.getCodeFixesAtPosition(
4834
- fileName,
4835
- start,
4836
- end,
4837
- errorCodes,
4838
- formatOptions,
4839
- preferences,
4840
- ...args
4841
- );
4842
- const program = languageService.getProgram();
4843
- if (program) {
4844
- const sourceFile = program.getSourceFile(fileName);
4845
- if (sourceFile) {
4846
- return pipe(
4847
- gen2(function* () {
4848
- const effectCodeFixes = [];
4849
- const applicableFixes = yield* getCodeFixesAtPosition(
4850
- diagnostics,
4851
- sourceFile,
4852
- start,
4853
- end,
4854
- errorCodes
4855
- );
4856
- const formatContext = modules.typescript.formatting.getFormatContext(
4857
- formatOptions,
4858
- info.languageServiceHost
4859
- );
4860
- for (const applicableFix of applicableFixes) {
4861
- const changes = modules.typescript.textChanges.ChangeTracker.with(
4862
- {
4863
- formatContext,
4864
- host: info.languageServiceHost,
4865
- preferences: preferences || {}
4866
- },
4867
- (changeTracker) => pipe(
4868
- applicableFix.apply,
4869
- provideService(ChangeTracker, changeTracker),
4870
- run
4871
- )
4872
- );
4873
- effectCodeFixes.push({
4874
- fixName: applicableFix.fixName,
4875
- description: applicableFix.description,
4876
- changes
4877
- });
4878
- }
4879
- return effectCodeFixes;
4880
- }),
4881
- provideService(TypeCheckerApi, program.getTypeChecker()),
4882
- provideService(
4883
- TypeCheckerApiCache,
4884
- makeTypeCheckerApiCache()
4885
- ),
4886
- provideService(TypeScriptApi, modules.typescript),
4887
- provideService(PluginOptions, pluginOptions),
4888
- run,
4889
- Either_exports.map((effectCodeFixes) => applicableCodeFixes.concat(effectCodeFixes)),
4890
- Either_exports.getOrElse(() => applicableCodeFixes)
4891
- );
4892
- }
4893
- }
4894
- return applicableCodeFixes;
4895
- };
3158
+ const proxy = /* @__PURE__ */ Object.create(null);
3159
+ for (const k of Object.keys(languageService)) {
3160
+ proxy[k] = (...args) => languageService[k].apply(languageService, args);
3161
+ }
3162
+ const effectCodeFixesForFile = /* @__PURE__ */ new Map();
4896
3163
  proxy.getSemanticDiagnostics = (fileName, ...args) => {
4897
3164
  const applicableDiagnostics = languageService.getSemanticDiagnostics(fileName, ...args);
4898
3165
  const program = languageService.getProgram();
4899
3166
  if (pluginOptions.diagnostics && program) {
3167
+ effectCodeFixesForFile.delete(fileName);
4900
3168
  const sourceFile = program.getSourceFile(fileName);
4901
3169
  if (sourceFile) {
4902
3170
  return pipe(
4903
- getSemanticDiagnostics(diagnostics, sourceFile),
3171
+ getSemanticDiagnosticsWithCodeFixes(diagnostics, sourceFile),
4904
3172
  provideService(TypeCheckerApi, program.getTypeChecker()),
4905
3173
  provideService(
4906
3174
  TypeCheckerApiCache,
@@ -4909,13 +3177,65 @@ var init = (modules) => {
4909
3177
  provideService(TypeScriptApi, modules.typescript),
4910
3178
  provideService(PluginOptions, pluginOptions),
4911
3179
  run,
4912
- Either_exports.map((effectDiagnostics) => effectDiagnostics.concat(applicableDiagnostics)),
3180
+ Either_exports.map(({ codeFixes, diagnostics: diagnostics2 }) => {
3181
+ effectCodeFixesForFile.set(fileName, codeFixes);
3182
+ return diagnostics2.concat(applicableDiagnostics);
3183
+ }),
4913
3184
  Either_exports.getOrElse(() => applicableDiagnostics)
4914
3185
  );
4915
3186
  }
4916
3187
  }
4917
3188
  return applicableDiagnostics;
4918
3189
  };
3190
+ proxy.getSupportedCodeFixes = (...args) => languageService.getSupportedCodeFixes(...args).concat(
3191
+ diagnosticsErrorCodes.map((_) => "" + _)
3192
+ );
3193
+ proxy.getCodeFixesAtPosition = (fileName, start, end, errorCodes, formatOptions, preferences, ...args) => {
3194
+ const applicableCodeFixes = languageService.getCodeFixesAtPosition(
3195
+ fileName,
3196
+ start,
3197
+ end,
3198
+ errorCodes,
3199
+ formatOptions,
3200
+ preferences,
3201
+ ...args
3202
+ );
3203
+ return pipe(
3204
+ sync(() => {
3205
+ const effectCodeFixes = [];
3206
+ const applicableFixes = (effectCodeFixesForFile.get(fileName) || []).filter(
3207
+ (_) => _.start === start && _.end === end && errorCodes.indexOf(_.code) > -1
3208
+ );
3209
+ const formatContext = modules.typescript.formatting.getFormatContext(
3210
+ formatOptions,
3211
+ info.languageServiceHost
3212
+ );
3213
+ for (const applicableFix of applicableFixes) {
3214
+ const changes = modules.typescript.textChanges.ChangeTracker.with(
3215
+ {
3216
+ formatContext,
3217
+ host: info.languageServiceHost,
3218
+ preferences: preferences || {}
3219
+ },
3220
+ (changeTracker) => pipe(
3221
+ applicableFix.apply,
3222
+ provideService(ChangeTracker, changeTracker),
3223
+ run
3224
+ )
3225
+ );
3226
+ effectCodeFixes.push({
3227
+ fixName: applicableFix.fixName,
3228
+ description: applicableFix.description,
3229
+ changes
3230
+ });
3231
+ }
3232
+ return effectCodeFixes;
3233
+ }),
3234
+ run,
3235
+ Either_exports.map((effectCodeFixes) => applicableCodeFixes.concat(effectCodeFixes)),
3236
+ Either_exports.getOrElse(() => applicableCodeFixes)
3237
+ );
3238
+ };
4919
3239
  proxy.getApplicableRefactors = (...args) => {
4920
3240
  const applicableRefactors = languageService.getApplicableRefactors(...args);
4921
3241
  const [fileName, positionOrRange] = args;