eslint-plugin-react-hooks-extra 1.5.3 → 1.5.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,116 +1,93 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@eslint-react/core');
4
+ require('string-ts');
4
5
  var shared = require('@eslint-react/shared');
5
6
  var ast = require('@eslint-react/ast');
6
7
  var jsx = require('@eslint-react/jsx');
7
8
  var _var = require('@eslint-react/var');
8
9
 
9
- var name = "eslint-plugin-react-hooks-extra";
10
- var version = "1.5.3";
10
+ var __defProp = Object.defineProperty;
11
+ var __export = (target, all2) => {
12
+ for (var name2 in all2)
13
+ __defProp(target, name2, { get: all2[name2], enumerable: true });
14
+ };
11
15
 
12
- const createRule = shared.createRuleForPlugin("hooks-extra");
16
+ // package.json
17
+ var name = "eslint-plugin-react-hooks-extra";
18
+ var version = "1.5.4-beta.0";
19
+ var createRule = shared.createRuleForPlugin("hooks-extra");
13
20
 
14
- const RULE_NAME$3 = "ensure-custom-hooks-using-other-hooks";
15
- var ensureCustomHooksUsingOtherHooks = createRule({
16
- name: RULE_NAME$3,
17
- meta: {
18
- type: "problem",
19
- docs: {
20
- description: "enforce custom hooks using other hooks",
21
- requiresTypeChecking: false
22
- },
23
- schema: [],
24
- messages: {
25
- ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS: "Custom hooks {{name}} should use other hooks"
26
- }
21
+ // src/rules/ensure-custom-hooks-using-other-hooks.ts
22
+ var RULE_NAME = "ensure-custom-hooks-using-other-hooks";
23
+ var ensure_custom_hooks_using_other_hooks_default = createRule({
24
+ name: RULE_NAME,
25
+ meta: {
26
+ type: "problem",
27
+ docs: {
28
+ description: "enforce custom hooks using other hooks",
29
+ requiresTypeChecking: false
27
30
  },
28
- defaultOptions: [],
29
- create (context) {
30
- const { ctx, listeners } = core.useHookCollector();
31
- return {
32
- ...listeners,
33
- "Program:exit" (node) {
34
- const allHooks = ctx.getAllHooks(node);
35
- for (const { name, hookCalls, node } of allHooks.values()){
36
- if (hookCalls.length > 0) continue;
37
- context.report({
38
- data: {
39
- name: name.value
40
- },
41
- messageId: "ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS",
42
- node
43
- });
44
- }
45
- }
46
- };
31
+ schema: [],
32
+ messages: {
33
+ ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS: "Custom hooks {{name}} should use other hooks"
47
34
  }
35
+ },
36
+ defaultOptions: [],
37
+ create(context) {
38
+ const { ctx, listeners } = core.useHookCollector();
39
+ return {
40
+ ...listeners,
41
+ "Program:exit"(node) {
42
+ const allHooks = ctx.getAllHooks(node);
43
+ for (const { name: name2, hookCalls, node: node2 } of allHooks.values()) {
44
+ if (hookCalls.length > 0)
45
+ continue;
46
+ context.report({
47
+ data: {
48
+ name: name2.value
49
+ },
50
+ messageId: "ENSURE_CUSTOM_HOOKS_USING_OTHER_HOOKS",
51
+ node: node2
52
+ });
53
+ }
54
+ }
55
+ };
56
+ }
48
57
  });
49
58
 
50
- /**
51
- * Tests if a value is a `function`.
52
- *
53
- * @param input - The value to test.
54
- *
55
- * @example
56
- * import { isFunction } from 'effect/Predicate'
57
- *
58
- * assert.deepStrictEqual(isFunction(isFunction), true)
59
- * assert.deepStrictEqual(isFunction("function"), false)
60
- *
61
- * @category guards
62
- * @since 2.0.0
63
- */
64
- const isFunction$1 = input => typeof input === "function";
65
- /**
66
- * Creates a function that can be used in a data-last (aka `pipe`able) or
67
- * data-first style.
68
- *
69
- * The first parameter to `dual` is either the arity of the uncurried function
70
- * or a predicate that determines if the function is being used in a data-first
71
- * or data-last style.
72
- *
73
- * Using the arity is the most common use case, but there are some cases where
74
- * you may want to use a predicate. For example, if you have a function that
75
- * takes an optional argument, you can use a predicate to determine if the
76
- * function is being used in a data-first or data-last style.
77
- *
78
- * @param arity - Either the arity of the uncurried function or a predicate
79
- * which determines if the function is being used in a data-first
80
- * or data-last style.
81
- * @param body - The definition of the uncurried function.
82
- *
83
- * @example
84
- * import { dual, pipe } from "effect/Function"
85
- *
86
- * // Exampe using arity to determine data-first or data-last style
87
- * const sum: {
88
- * (that: number): (self: number) => number
89
- * (self: number, that: number): number
90
- * } = dual(2, (self: number, that: number): number => self + that)
91
- *
92
- * assert.deepStrictEqual(sum(2, 3), 5)
93
- * assert.deepStrictEqual(pipe(2, sum(3)), 5)
94
- *
95
- * // Example using a predicate to determine data-first or data-last style
96
- * const sum2: {
97
- * (that: number): (self: number) => number
98
- * (self: number, that: number): number
99
- * } = dual((args) => args.length === 1, (self: number, that: number): number => self + that)
100
- *
101
- * assert.deepStrictEqual(sum(2, 3), 5)
102
- * assert.deepStrictEqual(pipe(2, sum(3)), 5)
103
- *
104
- * @since 2.0.0
105
- */
106
- const dual = function (arity, body) {
59
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Function.js
60
+ var Function_exports = {};
61
+ __export(Function_exports, {
62
+ SK: () => SK,
63
+ absurd: () => absurd,
64
+ apply: () => apply,
65
+ compose: () => compose,
66
+ constFalse: () => constFalse,
67
+ constNull: () => constNull,
68
+ constTrue: () => constTrue,
69
+ constUndefined: () => constUndefined,
70
+ constVoid: () => constVoid,
71
+ constant: () => constant,
72
+ dual: () => dual,
73
+ flip: () => flip,
74
+ flow: () => flow,
75
+ hole: () => hole,
76
+ identity: () => identity,
77
+ isFunction: () => isFunction,
78
+ pipe: () => pipe,
79
+ tupled: () => tupled,
80
+ unsafeCoerce: () => unsafeCoerce,
81
+ untupled: () => untupled
82
+ });
83
+ var isFunction = (input) => typeof input === "function";
84
+ var dual = function(arity, body) {
107
85
  if (typeof arity === "function") {
108
- return function () {
86
+ return function() {
109
87
  if (arity(arguments)) {
110
- // @ts-expect-error
111
88
  return body.apply(this, arguments);
112
89
  }
113
- return self => body(self, ...arguments);
90
+ return (self) => body(self, ...arguments);
114
91
  };
115
92
  }
116
93
  switch (arity) {
@@ -118,69 +95,69 @@ const dual = function (arity, body) {
118
95
  case 1:
119
96
  throw new RangeError(`Invalid arity ${arity}`);
120
97
  case 2:
121
- return function (a, b) {
98
+ return function(a, b2) {
122
99
  if (arguments.length >= 2) {
123
- return body(a, b);
100
+ return body(a, b2);
124
101
  }
125
- return function (self) {
102
+ return function(self) {
126
103
  return body(self, a);
127
104
  };
128
105
  };
129
106
  case 3:
130
- return function (a, b, c) {
107
+ return function(a, b2, c2) {
131
108
  if (arguments.length >= 3) {
132
- return body(a, b, c);
109
+ return body(a, b2, c2);
133
110
  }
134
- return function (self) {
135
- return body(self, a, b);
111
+ return function(self) {
112
+ return body(self, a, b2);
136
113
  };
137
114
  };
138
115
  case 4:
139
- return function (a, b, c, d) {
116
+ return function(a, b2, c2, d2) {
140
117
  if (arguments.length >= 4) {
141
- return body(a, b, c, d);
118
+ return body(a, b2, c2, d2);
142
119
  }
143
- return function (self) {
144
- return body(self, a, b, c);
120
+ return function(self) {
121
+ return body(self, a, b2, c2);
145
122
  };
146
123
  };
147
124
  case 5:
148
- return function (a, b, c, d, e) {
125
+ return function(a, b2, c2, d2, e2) {
149
126
  if (arguments.length >= 5) {
150
- return body(a, b, c, d, e);
127
+ return body(a, b2, c2, d2, e2);
151
128
  }
152
- return function (self) {
153
- return body(self, a, b, c, d);
129
+ return function(self) {
130
+ return body(self, a, b2, c2, d2);
154
131
  };
155
132
  };
156
133
  default:
157
- return function () {
134
+ return function() {
158
135
  if (arguments.length >= arity) {
159
- // @ts-expect-error
160
136
  return body.apply(this, arguments);
161
137
  }
162
138
  const args = arguments;
163
- return function (self) {
139
+ return function(self) {
164
140
  return body(self, ...args);
165
141
  };
166
142
  };
167
143
  }
168
144
  };
169
- /**
170
- * Reverses the order of arguments for a curried function.
171
- *
172
- * @param f - A curried function that takes multiple arguments.
173
- *
174
- * @example
175
- * import { flip } from "effect/Function"
176
- *
177
- * const f = (a: number) => (b: string) => a - b.length
178
- *
179
- * assert.deepStrictEqual(flip(f)('aaa')(2), -1)
180
- *
181
- * @since 2.0.0
182
- */
183
- const flip = f => (...b) => (...a) => f(...a)(...b);
145
+ var apply = (a) => (self) => self(a);
146
+ var identity = (a) => a;
147
+ var unsafeCoerce = identity;
148
+ var constant = (value) => () => value;
149
+ var constTrue = /* @__PURE__ */ constant(true);
150
+ var constFalse = /* @__PURE__ */ constant(false);
151
+ var constNull = /* @__PURE__ */ constant(null);
152
+ var constUndefined = /* @__PURE__ */ constant(void 0);
153
+ var constVoid = constUndefined;
154
+ var flip = (f) => (...b2) => (...a) => f(...a)(...b2);
155
+ var compose = /* @__PURE__ */ dual(2, (ab, bc) => (a) => bc(ab(a)));
156
+ var absurd = (_) => {
157
+ throw new Error("Called `absurd` function which should be uncallable");
158
+ };
159
+ var tupled = (f) => (a) => f(...a);
160
+ var untupled = (f) => (...a) => f(a);
184
161
  function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
185
162
  switch (arguments.length) {
186
163
  case 1:
@@ -201,126 +178,183 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
201
178
  return gh(fg(ef(de(cd(bc(ab(a)))))));
202
179
  case 9:
203
180
  return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
204
- default:
205
- {
206
- let ret = arguments[0];
207
- for (let i = 1; i < arguments.length; i++) {
208
- ret = arguments[i](ret);
209
- }
210
- return ret;
181
+ default: {
182
+ let ret = arguments[0];
183
+ for (let i2 = 1; i2 < arguments.length; i2++) {
184
+ ret = arguments[i2](ret);
211
185
  }
186
+ return ret;
187
+ }
212
188
  }
213
189
  }
190
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
191
+ switch (arguments.length) {
192
+ case 1:
193
+ return ab;
194
+ case 2:
195
+ return function() {
196
+ return bc(ab.apply(this, arguments));
197
+ };
198
+ case 3:
199
+ return function() {
200
+ return cd(bc(ab.apply(this, arguments)));
201
+ };
202
+ case 4:
203
+ return function() {
204
+ return de(cd(bc(ab.apply(this, arguments))));
205
+ };
206
+ case 5:
207
+ return function() {
208
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
209
+ };
210
+ case 6:
211
+ return function() {
212
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
213
+ };
214
+ case 7:
215
+ return function() {
216
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
217
+ };
218
+ case 8:
219
+ return function() {
220
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
221
+ };
222
+ case 9:
223
+ return function() {
224
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
225
+ };
226
+ }
227
+ return;
228
+ }
229
+ var hole = /* @__PURE__ */ unsafeCoerce(absurd);
230
+ var SK = (_, b2) => b2;
214
231
 
215
- const moduleVersion = "2.3.1";
232
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/version.js
233
+ var moduleVersion = "2.3.1";
216
234
 
217
- /**
218
- * @since 2.0.0
219
- */
220
- const globalStoreId = /*#__PURE__*/Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
235
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/GlobalValue.js
236
+ var globalStoreId = /* @__PURE__ */ Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
221
237
  if (!(globalStoreId in globalThis)) {
222
- globalThis[globalStoreId] = /*#__PURE__*/new Map();
238
+ globalThis[globalStoreId] = /* @__PURE__ */ new Map();
223
239
  }
224
- const globalStore = globalThis[globalStoreId];
225
- /**
226
- * @since 2.0.0
227
- */
228
- const globalValue = (id, compute) => {
240
+ var globalStore = globalThis[globalStoreId];
241
+ var globalValue = (id, compute) => {
229
242
  if (!globalStore.has(id)) {
230
243
  globalStore.set(id, compute());
231
244
  }
232
245
  return globalStore.get(id);
233
246
  };
234
247
 
235
- /**
236
- * @since 2.0.0
237
- */
238
- /**
239
- * Tests if a value is a `function`.
240
- *
241
- * @param input - The value to test.
242
- *
243
- * @example
244
- * import { isFunction } from "effect/Predicate"
245
- *
246
- * assert.deepStrictEqual(isFunction(isFunction), true)
247
- *
248
- * assert.deepStrictEqual(isFunction("function"), false)
249
- *
250
- * @category guards
251
- * @since 2.0.0
252
- */
253
- const isFunction = isFunction$1;
254
- const isRecordOrArray = input => typeof input === "object" && input !== null;
255
- /**
256
- * Tests if a value is an `object`.
257
- *
258
- * @param input - The value to test.
259
- *
260
- * @example
261
- * import { isObject } from "effect/Predicate"
262
- *
263
- * assert.deepStrictEqual(isObject({}), true)
264
- * assert.deepStrictEqual(isObject([]), true)
265
- *
266
- * assert.deepStrictEqual(isObject(null), false)
267
- * assert.deepStrictEqual(isObject(undefined), false)
268
- *
269
- * @category guards
270
- * @since 2.0.0
271
- */
272
- const isObject = input => isRecordOrArray(input) || isFunction(input);
273
- /**
274
- * Checks whether a value is an `object` containing a specified property key.
275
- *
276
- * @param property - The field to check within the object.
277
- * @param self - The value to examine.
278
- *
279
- * @category guards
280
- * @since 2.0.0
281
- */
282
- const hasProperty = /*#__PURE__*/dual(2, (self, property) => isObject(self) && property in self);
283
- /**
284
- * A guard that succeeds when the input is `null` or `undefined`.
285
- *
286
- * @param input - The value to test.
287
- *
288
- * @example
289
- * import { isNullable } from "effect/Predicate"
290
- *
291
- * assert.deepStrictEqual(isNullable(null), true)
292
- * assert.deepStrictEqual(isNullable(undefined), true)
293
- *
294
- * assert.deepStrictEqual(isNullable({}), false)
295
- * assert.deepStrictEqual(isNullable([]), false)
296
- *
297
- * @category guards
298
- * @since 2.0.0
299
- */
300
- const isNullable = input => input === null || input === undefined;
248
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Predicate.js
249
+ var isFunction2 = isFunction;
250
+ var isRecordOrArray = (input) => typeof input === "object" && input !== null;
251
+ var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
252
+ var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
253
+ var isNullable = (input) => input === null || input === void 0;
301
254
 
302
- /**
303
- * @since 2.0.0
304
- */
305
- const defaultIncHi = 0x14057b7e;
306
- const defaultIncLo = 0xf767814f;
307
- const MUL_HI = 0x5851f42d >>> 0;
308
- const MUL_LO = 0x4c957f2d >>> 0;
309
- const BIT_53 = 9007199254740992.0;
310
- const BIT_27 = 134217728.0;
311
- /**
312
- * PCG is a family of simple fast space-efficient statistically good algorithms
313
- * for random number generation. Unlike many general-purpose RNGs, they are also
314
- * hard to predict.
315
- *
316
- * @category model
317
- * @since 2.0.0
318
- */
319
- class PCGRandom {
255
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Utils.js
256
+ var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
257
+ var GenKindImpl = class {
258
+ value;
259
+ constructor(value) {
260
+ this.value = value;
261
+ }
262
+ /**
263
+ * @since 2.0.0
264
+ */
265
+ get _F() {
266
+ return identity;
267
+ }
268
+ /**
269
+ * @since 2.0.0
270
+ */
271
+ get _R() {
272
+ return (_) => _;
273
+ }
274
+ /**
275
+ * @since 2.0.0
276
+ */
277
+ get _O() {
278
+ return (_) => _;
279
+ }
280
+ /**
281
+ * @since 2.0.0
282
+ */
283
+ get _E() {
284
+ return (_) => _;
285
+ }
286
+ /**
287
+ * @since 2.0.0
288
+ */
289
+ [GenKindTypeId] = GenKindTypeId;
290
+ /**
291
+ * @since 2.0.0
292
+ */
293
+ [Symbol.iterator]() {
294
+ return new SingleShotGen(this);
295
+ }
296
+ };
297
+ var SingleShotGen = class _SingleShotGen {
298
+ self;
299
+ called = false;
300
+ constructor(self) {
301
+ this.self = self;
302
+ }
303
+ /**
304
+ * @since 2.0.0
305
+ */
306
+ next(a) {
307
+ return this.called ? {
308
+ value: a,
309
+ done: true
310
+ } : (this.called = true, {
311
+ value: this.self,
312
+ done: false
313
+ });
314
+ }
315
+ /**
316
+ * @since 2.0.0
317
+ */
318
+ return(a) {
319
+ return {
320
+ value: a,
321
+ done: true
322
+ };
323
+ }
324
+ /**
325
+ * @since 2.0.0
326
+ */
327
+ throw(e2) {
328
+ throw e2;
329
+ }
330
+ /**
331
+ * @since 2.0.0
332
+ */
333
+ [Symbol.iterator]() {
334
+ return new _SingleShotGen(this.self);
335
+ }
336
+ };
337
+ var adapter = () => (
338
+ // @ts-expect-error
339
+ function() {
340
+ let x2 = arguments[0];
341
+ for (let i2 = 1; i2 < arguments.length; i2++) {
342
+ x2 = arguments[i2](x2);
343
+ }
344
+ return new GenKindImpl(x2);
345
+ }
346
+ );
347
+ var defaultIncHi = 335903614;
348
+ var defaultIncLo = 4150755663;
349
+ var MUL_HI = 1481765933 >>> 0;
350
+ var MUL_LO = 1284865837 >>> 0;
351
+ var BIT_53 = 9007199254740992;
352
+ var BIT_27 = 134217728;
353
+ var PCGRandom = class {
320
354
  _state;
321
355
  constructor(seedHi, seedLo, incHi, incLo) {
322
356
  if (isNullable(seedLo) && isNullable(seedHi)) {
323
- seedLo = Math.random() * 0xffffffff >>> 0;
357
+ seedLo = Math.random() * 4294967295 >>> 0;
324
358
  seedHi = 0;
325
359
  } else if (isNullable(seedLo)) {
326
360
  seedLo = seedHi;
@@ -372,13 +406,11 @@ class PCGRandom {
372
406
  }
373
407
  max = max >>> 0;
374
408
  if ((max & max - 1) === 0) {
375
- return this._next() & max - 1; // fast path for power of 2
409
+ return this._next() & max - 1;
376
410
  }
377
411
  let num = 0;
378
412
  const skew = (-max >>> 0) % max >>> 0;
379
413
  for (num = this._next(); num < skew; num = this._next()) {
380
- // this loop will rarely execute more than twice,
381
- // and is intentionally empty
382
414
  }
383
415
  return num % max;
384
416
  }
@@ -390,35 +422,30 @@ class PCGRandom {
390
422
  * @since 2.0.0
391
423
  */
392
424
  number() {
393
- const hi = (this._next() & 0x03ffffff) * 1.0;
394
- const lo = (this._next() & 0x07ffffff) * 1.0;
425
+ const hi = (this._next() & 67108863) * 1;
426
+ const lo = (this._next() & 134217727) * 1;
395
427
  return (hi * BIT_27 + lo) / BIT_53;
396
428
  }
397
429
  /** @internal */
398
430
  _next() {
399
- // save current state (what we'll use for this number)
400
431
  const oldHi = this._state[0] >>> 0;
401
432
  const oldLo = this._state[1] >>> 0;
402
- // churn LCG.
403
433
  mul64(this._state, oldHi, oldLo, MUL_HI, MUL_LO);
404
434
  add64(this._state, this._state[0], this._state[1], this._state[2], this._state[3]);
405
- // get least sig. 32 bits of ((oldstate >> 18) ^ oldstate) >> 27
406
435
  let xsHi = oldHi >>> 18;
407
436
  let xsLo = (oldLo >>> 18 | oldHi << 14) >>> 0;
408
437
  xsHi = (xsHi ^ oldHi) >>> 0;
409
438
  xsLo = (xsLo ^ oldLo) >>> 0;
410
439
  const xorshifted = (xsLo >>> 27 | xsHi << 5) >>> 0;
411
- // rotate xorshifted right a random amount, based on the most sig. 5 bits
412
- // bits of the old state.
413
440
  const rot = oldHi >>> 27;
414
441
  const rot2 = (-rot >>> 0 & 31) >>> 0;
415
442
  return (xorshifted >>> rot | xorshifted << rot2) >>> 0;
416
443
  }
417
- }
444
+ };
418
445
  function mul64(out, aHi, aLo, bHi, bLo) {
419
- let c1 = (aLo >>> 16) * (bLo & 0xffff) >>> 0;
420
- let c0 = (aLo & 0xffff) * (bLo >>> 16) >>> 0;
421
- let lo = (aLo & 0xffff) * (bLo & 0xffff) >>> 0;
446
+ let c1 = (aLo >>> 16) * (bLo & 65535) >>> 0;
447
+ let c0 = (aLo & 65535) * (bLo >>> 16) >>> 0;
448
+ let lo = (aLo & 65535) * (bLo & 65535) >>> 0;
422
449
  let hi = (aLo >>> 16) * (bLo >>> 16) + ((c0 >>> 16) + (c1 >>> 16)) >>> 0;
423
450
  c0 = c0 << 16 >>> 0;
424
451
  lo = lo + c0 >>> 0;
@@ -435,7 +462,6 @@ function mul64(out, aHi, aLo, bHi, bLo) {
435
462
  out[0] = hi;
436
463
  out[1] = lo;
437
464
  }
438
- // add two 64 bit numbers (given in parts), and store the result in `out`.
439
465
  function add64(out, aHi, aLo, bHi, bLo) {
440
466
  let hi = aHi + bHi >>> 0;
441
467
  const lo = aLo + bLo >>> 0;
@@ -446,23 +472,11 @@ function add64(out, aHi, aLo, bHi, bLo) {
446
472
  out[1] = lo;
447
473
  }
448
474
 
449
- /**
450
- * @since 2.0.0
451
- */
452
- /** @internal */
453
- const randomHashCache = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap());
454
- /** @internal */
455
- const pcgr = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
456
- /**
457
- * @since 2.0.0
458
- * @category symbols
459
- */
460
- const symbol$1 = /*#__PURE__*/Symbol.for("effect/Hash");
461
- /**
462
- * @since 2.0.0
463
- * @category hashing
464
- */
465
- const hash = self => {
475
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Hash.js
476
+ var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
477
+ var pcgr = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
478
+ var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
479
+ var hash = (self) => {
466
480
  switch (typeof self) {
467
481
  case "number":
468
482
  return number(self);
@@ -477,84 +491,55 @@ const hash = self => {
477
491
  case "undefined":
478
492
  return string("undefined");
479
493
  case "function":
480
- case "object":
481
- {
482
- if (self === null) {
483
- return string("null");
484
- }
485
- if (isHash(self)) {
486
- return self[symbol$1]();
487
- } else {
488
- return random(self);
489
- }
494
+ case "object": {
495
+ if (self === null) {
496
+ return string("null");
490
497
  }
498
+ if (isHash(self)) {
499
+ return self[symbol]();
500
+ } else {
501
+ return random(self);
502
+ }
503
+ }
491
504
  default:
492
505
  throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
493
506
  }
494
507
  };
495
- /**
496
- * @since 2.0.0
497
- * @category hashing
498
- */
499
- const random = self => {
508
+ var random = (self) => {
500
509
  if (!randomHashCache.has(self)) {
501
510
  randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
502
511
  }
503
512
  return randomHashCache.get(self);
504
513
  };
505
- /**
506
- * @since 2.0.0
507
- * @category hashing
508
- */
509
- const combine = b => self => self * 53 ^ b;
510
- /**
511
- * @since 2.0.0
512
- * @category hashing
513
- */
514
- const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
515
- /**
516
- * @since 2.0.0
517
- * @category guards
518
- */
519
- const isHash = u => hasProperty(u, symbol$1);
520
- /**
521
- * @since 2.0.0
522
- * @category hashing
523
- */
524
- const number = n => {
525
- if (n !== n || n === Infinity) {
514
+ var combine = (b2) => (self) => self * 53 ^ b2;
515
+ var optimize = (n2) => n2 & 3221225471 | n2 >>> 1 & 1073741824;
516
+ var isHash = (u2) => hasProperty(u2, symbol);
517
+ var number = (n2) => {
518
+ if (n2 !== n2 || n2 === Infinity) {
526
519
  return 0;
527
520
  }
528
- let h = n | 0;
529
- if (h !== n) {
530
- h ^= n * 0xffffffff;
521
+ let h = n2 | 0;
522
+ if (h !== n2) {
523
+ h ^= n2 * 4294967295;
531
524
  }
532
- while (n > 0xffffffff) {
533
- h ^= n /= 0xffffffff;
525
+ while (n2 > 4294967295) {
526
+ h ^= n2 /= 4294967295;
534
527
  }
535
- return optimize(n);
528
+ return optimize(n2);
536
529
  };
537
- /**
538
- * @since 2.0.0
539
- * @category hashing
540
- */
541
- const string = str => {
542
- let h = 5381,
543
- i = str.length;
544
- while (i) {
545
- h = h * 33 ^ str.charCodeAt(--i);
530
+ var string = (str) => {
531
+ let h = 5381, i2 = str.length;
532
+ while (i2) {
533
+ h = h * 33 ^ str.charCodeAt(--i2);
546
534
  }
547
535
  return optimize(h);
548
536
  };
549
537
 
550
- /**
551
- * @since 2.0.0
552
- * @category symbols
553
- */
554
- const symbol = /*#__PURE__*/Symbol.for("effect/Equal");
538
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Equal.js
539
+ var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
555
540
  function equals() {
556
541
  if (arguments.length === 1) {
557
- return self => compareBoth(self, arguments[0]);
542
+ return (self) => compareBoth(self, arguments[0]);
558
543
  }
559
544
  return compareBoth(arguments[0], arguments[1]);
560
545
  }
@@ -568,48 +553,93 @@ function compareBoth(self, that) {
568
553
  }
569
554
  if ((selfType === "object" || selfType === "function") && self !== null && that !== null) {
570
555
  if (isEqual(self) && isEqual(that)) {
571
- return hash(self) === hash(that) && self[symbol](that);
556
+ return hash(self) === hash(that) && self[symbol2](that);
572
557
  }
573
558
  }
574
559
  return false;
575
560
  }
576
- /**
577
- * @since 2.0.0
578
- * @category guards
579
- */
580
- const isEqual = u => hasProperty(u, symbol);
561
+ var isEqual = (u2) => hasProperty(u2, symbol2);
562
+ var equivalence = () => (self, that) => equals(self, that);
563
+
564
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Equivalence.js
565
+ var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
581
566
 
582
- /**
583
- * @since 2.0.0
584
- */
585
- /**
586
- * @since 2.0.0
587
- * @category symbols
588
- */
589
- const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
590
- /**
591
- * @since 2.0.0
592
- */
593
- const toJSON = x => {
594
- if (hasProperty(x, "toJSON") && isFunction(x["toJSON"]) && x["toJSON"].length === 0) {
595
- return x.toJSON();
596
- } else if (Array.isArray(x)) {
597
- return x.map(toJSON);
598
- }
599
- return x;
567
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Inspectable.js
568
+ var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
569
+ var toJSON = (x2) => {
570
+ if (hasProperty(x2, "toJSON") && isFunction2(x2["toJSON"]) && x2["toJSON"].length === 0) {
571
+ return x2.toJSON();
572
+ } else if (Array.isArray(x2)) {
573
+ return x2.map(toJSON);
574
+ }
575
+ return x2;
600
576
  };
601
- /**
602
- * @since 2.0.0
603
- */
604
- const format = x => JSON.stringify(x, null, 2);
577
+ var format = (x2) => JSON.stringify(x2, null, 2);
578
+
579
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Option.js
580
+ var Option_exports = {};
581
+ __export(Option_exports, {
582
+ Do: () => Do,
583
+ TypeId: () => TypeId3,
584
+ all: () => all,
585
+ andThen: () => andThen,
586
+ ap: () => ap,
587
+ as: () => as,
588
+ asUnit: () => asUnit,
589
+ bind: () => bind,
590
+ bindTo: () => bindTo,
591
+ composeK: () => composeK,
592
+ contains: () => contains,
593
+ containsWith: () => containsWith,
594
+ exists: () => exists,
595
+ filter: () => filter,
596
+ filterMap: () => filterMap,
597
+ firstSomeOf: () => firstSomeOf,
598
+ flatMap: () => flatMap,
599
+ flatMapNullable: () => flatMapNullable,
600
+ flatten: () => flatten,
601
+ fromIterable: () => fromIterable,
602
+ fromNullable: () => fromNullable,
603
+ gen: () => gen,
604
+ getEquivalence: () => getEquivalence,
605
+ getLeft: () => getLeft2,
606
+ getOrElse: () => getOrElse,
607
+ getOrNull: () => getOrNull,
608
+ getOrThrow: () => getOrThrow,
609
+ getOrThrowWith: () => getOrThrowWith,
610
+ getOrUndefined: () => getOrUndefined,
611
+ getOrder: () => getOrder,
612
+ getRight: () => getRight2,
613
+ isNone: () => isNone2,
614
+ isOption: () => isOption2,
615
+ isSome: () => isSome2,
616
+ let: () => let_,
617
+ lift2: () => lift2,
618
+ liftNullable: () => liftNullable,
619
+ liftPredicate: () => liftPredicate,
620
+ liftThrowable: () => liftThrowable,
621
+ map: () => map,
622
+ match: () => match,
623
+ none: () => none2,
624
+ orElse: () => orElse,
625
+ orElseEither: () => orElseEither,
626
+ orElseSome: () => orElseSome,
627
+ partitionMap: () => partitionMap,
628
+ product: () => product,
629
+ productMany: () => productMany,
630
+ reduceCompact: () => reduceCompact,
631
+ some: () => some2,
632
+ tap: () => tap,
633
+ toArray: () => toArray,
634
+ toRefinement: () => toRefinement,
635
+ unit: () => unit,
636
+ zipLeft: () => zipLeft,
637
+ zipRight: () => zipRight,
638
+ zipWith: () => zipWith
639
+ });
605
640
 
606
- /**
607
- * @since 2.0.0
608
- */
609
- /**
610
- * @since 2.0.0
611
- */
612
- const pipeArguments = (self, args) => {
641
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Pipeable.js
642
+ var pipeArguments = (self, args) => {
613
643
  switch (args.length) {
614
644
  case 1:
615
645
  return args[0](self);
@@ -629,73 +659,67 @@ const pipeArguments = (self, args) => {
629
659
  return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
630
660
  case 9:
631
661
  return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
632
- default:
633
- {
634
- let ret = self;
635
- for (let i = 0, len = args.length; i < len; i++) {
636
- ret = args[i](ret);
637
- }
638
- return ret;
662
+ default: {
663
+ let ret = self;
664
+ for (let i2 = 0, len = args.length; i2 < len; i2++) {
665
+ ret = args[i2](ret);
639
666
  }
667
+ return ret;
668
+ }
640
669
  }
641
670
  };
642
671
 
643
- /** @internal */
644
- const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
645
- /** @internal */
646
- const StreamTypeId = /*#__PURE__*/Symbol.for("effect/Stream");
647
- /** @internal */
648
- const SinkTypeId = /*#__PURE__*/Symbol.for("effect/Sink");
649
- /** @internal */
650
- const ChannelTypeId = /*#__PURE__*/Symbol.for("effect/Channel");
651
- /** @internal */
652
- const effectVariance = {
672
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/effectable.js
673
+ var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
674
+ var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
675
+ var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
676
+ var ChannelTypeId = /* @__PURE__ */ Symbol.for("effect/Channel");
677
+ var effectVariance = {
653
678
  /* c8 ignore next */
654
- _R: _ => _,
679
+ _R: (_) => _,
655
680
  /* c8 ignore next */
656
- _E: _ => _,
681
+ _E: (_) => _,
657
682
  /* c8 ignore next */
658
- _A: _ => _,
683
+ _A: (_) => _,
659
684
  _V: moduleVersion
660
685
  };
661
- const sinkVariance = {
686
+ var sinkVariance = {
662
687
  /* c8 ignore next */
663
- _A: _ => _,
688
+ _A: (_) => _,
664
689
  /* c8 ignore next */
665
- _In: _ => _,
690
+ _In: (_) => _,
666
691
  /* c8 ignore next */
667
- _L: _ => _,
692
+ _L: (_) => _,
668
693
  /* c8 ignore next */
669
- _E: _ => _,
694
+ _E: (_) => _,
670
695
  /* c8 ignore next */
671
- _R: _ => _
696
+ _R: (_) => _
672
697
  };
673
- const channelVariance = {
698
+ var channelVariance = {
674
699
  /* c8 ignore next */
675
- _Env: _ => _,
700
+ _Env: (_) => _,
676
701
  /* c8 ignore next */
677
- _InErr: _ => _,
702
+ _InErr: (_) => _,
678
703
  /* c8 ignore next */
679
- _InElem: _ => _,
704
+ _InElem: (_) => _,
680
705
  /* c8 ignore next */
681
- _InDone: _ => _,
706
+ _InDone: (_) => _,
682
707
  /* c8 ignore next */
683
- _OutErr: _ => _,
708
+ _OutErr: (_) => _,
684
709
  /* c8 ignore next */
685
- _OutElem: _ => _,
710
+ _OutElem: (_) => _,
686
711
  /* c8 ignore next */
687
- _OutDone: _ => _
712
+ _OutDone: (_) => _
688
713
  };
689
- /** @internal */
690
- const EffectPrototype = {
714
+ var EffectPrototype = {
691
715
  [EffectTypeId]: effectVariance,
692
716
  [StreamTypeId]: effectVariance,
693
717
  [SinkTypeId]: sinkVariance,
694
718
  [ChannelTypeId]: channelVariance,
695
- [symbol](that) {
719
+ [symbol2](that) {
696
720
  return this === that;
697
721
  },
698
- [symbol$1]() {
722
+ [symbol]() {
699
723
  return random(this);
700
724
  },
701
725
  pipe() {
@@ -703,14 +727,12 @@ const EffectPrototype = {
703
727
  }
704
728
  };
705
729
 
706
- /**
707
- * @since 2.0.0
708
- */
709
- const TypeId = /*#__PURE__*/Symbol.for("effect/Option");
710
- const CommonProto = {
730
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/option.js
731
+ var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
732
+ var CommonProto = {
711
733
  ...EffectPrototype,
712
734
  [TypeId]: {
713
- _A: _ => _
735
+ _A: (_) => _
714
736
  },
715
737
  [NodeInspectSymbol]() {
716
738
  return this.toJSON();
@@ -719,13 +741,13 @@ const CommonProto = {
719
741
  return format(this.toJSON());
720
742
  }
721
743
  };
722
- const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
744
+ var SomeProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
723
745
  _tag: "Some",
724
746
  _op: "Some",
725
- [symbol](that) {
747
+ [symbol2](that) {
726
748
  return isOption(that) && isSome(that) && equals(that.value, this.value);
727
749
  },
728
- [symbol$1]() {
750
+ [symbol]() {
729
751
  return combine(hash(this._tag))(hash(this.value));
730
752
  },
731
753
  toJSON() {
@@ -736,13 +758,13 @@ const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonP
736
758
  };
737
759
  }
738
760
  });
739
- const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
761
+ var NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto), {
740
762
  _tag: "None",
741
763
  _op: "None",
742
- [symbol](that) {
743
- return isOption(that) && isNone$1(that);
764
+ [symbol2](that) {
765
+ return isOption(that) && isNone(that);
744
766
  },
745
- [symbol$1]() {
767
+ [symbol]() {
746
768
  return combine(hash(this._tag));
747
769
  },
748
770
  toJSON() {
@@ -752,284 +774,577 @@ const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonP
752
774
  };
753
775
  }
754
776
  });
755
- /** @internal */
756
- const isOption = input => hasProperty(input, TypeId);
757
- /** @internal */
758
- const isNone$1 = fa => fa._tag === "None";
759
- /** @internal */
760
- const isSome = fa => fa._tag === "Some";
761
- /** @internal */
762
- const none$1 = /*#__PURE__*/Object.create(NoneProto);
763
- /** @internal */
764
- const some$1 = value => {
777
+ var isOption = (input) => hasProperty(input, TypeId);
778
+ var isNone = (fa) => fa._tag === "None";
779
+ var isSome = (fa) => fa._tag === "Some";
780
+ var none = /* @__PURE__ */ Object.create(NoneProto);
781
+ var some = (value) => {
765
782
  const a = Object.create(SomeProto);
766
783
  a.value = value;
767
784
  return a;
768
785
  };
769
786
 
770
- /**
771
- * Creates a new `Option` that represents the absence of a value.
772
- *
773
- * @category constructors
774
- * @since 2.0.0
775
- */
776
- const none = () => none$1;
777
- /**
778
- * Creates a new `Option` that wraps the given value.
779
- *
780
- * @param value - The value to wrap.
781
- *
782
- * @category constructors
783
- * @since 2.0.0
784
- */
785
- const some = some$1;
786
- /**
787
- * Determine if a `Option` is a `None`.
788
- *
789
- * @param self - The `Option` to check.
790
- *
791
- * @example
792
- * import { some, none, isNone } from 'effect/Option'
793
- *
794
- * assert.deepStrictEqual(isNone(some(1)), false)
795
- * assert.deepStrictEqual(isNone(none()), true)
796
- *
797
- * @category guards
798
- * @since 2.0.0
799
- */
800
- const isNone = isNone$1;
801
- /**
802
- * Maps the `Some` side of an `Option` value to a new `Option` value.
803
- *
804
- * @param self - An `Option` to map
805
- * @param f - The function to map over the value of the `Option`
806
- *
807
- * @category mapping
808
- * @since 2.0.0
809
- */
810
- const map = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
811
- /**
812
- * Applies a function to the value of an `Option` and flattens the result, if the input is `Some`.
813
- *
814
- * @category sequencing
815
- * @since 2.0.0
816
- */
817
- const flatMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
818
- /**
819
- * Maps over the value of an `Option` and filters out `None`s.
820
- *
821
- * Useful when in addition to filtering you also want to change the type of the `Option`.
822
- *
823
- * @param self - The `Option` to map over.
824
- * @param f - A function to apply to the value of the `Option`.
825
- *
826
- * @example
827
- * import * as O from "effect/Option"
828
- *
829
- * const evenNumber = (n: number) => n % 2 === 0 ? O.some(n) : O.none()
830
- *
831
- * assert.deepStrictEqual(O.filterMap(O.none(), evenNumber), O.none())
832
- * assert.deepStrictEqual(O.filterMap(O.some(3), evenNumber), O.none())
833
- * assert.deepStrictEqual(O.filterMap(O.some(2), evenNumber), O.some(2))
834
- *
835
- * @category filtering
836
- * @since 2.0.0
837
- */
838
- const filterMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
839
- /**
840
- * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
841
- *
842
- * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
843
- *
844
- * @param predicate - A predicate function to apply to the `Option` value.
845
- * @param fb - The `Option` to filter.
846
- *
847
- * @example
848
- * import * as O from "effect/Option"
849
- *
850
- * // predicate
851
- * const isEven = (n: number) => n % 2 === 0
852
- *
853
- * assert.deepStrictEqual(O.filter(O.none(), isEven), O.none())
854
- * assert.deepStrictEqual(O.filter(O.some(3), isEven), O.none())
855
- * assert.deepStrictEqual(O.filter(O.some(2), isEven), O.some(2))
856
- *
857
- * // refinement
858
- * const isNumber = (v: unknown): v is number => typeof v === "number"
859
- *
860
- * assert.deepStrictEqual(O.filter(O.none(), isNumber), O.none())
861
- * assert.deepStrictEqual(O.filter(O.some('hello'), isNumber), O.none())
862
- * assert.deepStrictEqual(O.filter(O.some(2), isNumber), O.some(2))
863
- *
864
- * @category filtering
865
- * @since 2.0.0
866
- */
867
- const filter = /*#__PURE__*/dual(2, (self, predicate) => filterMap(self, b => predicate(b) ? some$1(b) : none$1));
868
-
869
- /**
870
- * Bun currently has a bug where `setTimeout` doesn't behave correctly with a 0ms delay.
871
- *
872
- * @see https://github.com/oven-sh/bun/issues/3333
873
- */
874
- /** @internal */
875
- typeof process === "undefined" ? false : !!process?.isBun;
787
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/internal/either.js
788
+ var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
789
+ var CommonProto2 = {
790
+ ...EffectPrototype,
791
+ [TypeId2]: {
792
+ _A: (_) => _
793
+ },
794
+ [NodeInspectSymbol]() {
795
+ return this.toJSON();
796
+ },
797
+ toString() {
798
+ return format(this.toJSON());
799
+ }
800
+ };
801
+ var RightProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
802
+ _tag: "Right",
803
+ _op: "Right",
804
+ [symbol2](that) {
805
+ return isEither(that) && isRight(that) && equals(that.right, this.right);
806
+ },
807
+ [symbol]() {
808
+ return combine(hash(this._tag))(hash(this.right));
809
+ },
810
+ toJSON() {
811
+ return {
812
+ _id: "Either",
813
+ _tag: this._tag,
814
+ right: toJSON(this.right)
815
+ };
816
+ }
817
+ });
818
+ var LeftProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(CommonProto2), {
819
+ _tag: "Left",
820
+ _op: "Left",
821
+ [symbol2](that) {
822
+ return isEither(that) && isLeft(that) && equals(that.left, this.left);
823
+ },
824
+ [symbol]() {
825
+ return combine(hash(this._tag))(hash(this.left));
826
+ },
827
+ toJSON() {
828
+ return {
829
+ _id: "Either",
830
+ _tag: this._tag,
831
+ left: toJSON(this.left)
832
+ };
833
+ }
834
+ });
835
+ var isEither = (input) => hasProperty(input, TypeId2);
836
+ var isLeft = (ma) => ma._tag === "Left";
837
+ var isRight = (ma) => ma._tag === "Right";
838
+ var left = (left2) => {
839
+ const a = Object.create(LeftProto);
840
+ a.left = left2;
841
+ return a;
842
+ };
843
+ var right = (right2) => {
844
+ const a = Object.create(RightProto);
845
+ a.right = right2;
846
+ return a;
847
+ };
848
+ var getLeft = (self) => isRight(self) ? none : some(self.left);
849
+ var getRight = (self) => isLeft(self) ? none : some(self.right);
876
850
 
877
- var match;
878
- function n(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}function t(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return (e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return n(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return "Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var u=0;return function(){return u>=t.length?{done:!0}:{done:!1,value:t[u++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r=Symbol.for("@ts-pattern/matcher"),e=Symbol.for("@ts-pattern/isVariadic"),u="@ts-pattern/anonymous-select-key",i=function(n){return Boolean(n&&"object"==typeof n)},o=function(n){return n&&!!n[r]},c=function n(u,c,a){if(o(u)){var f=u[r]().match(c),s=f.matched,l=f.selections;return s&&l&&Object.keys(l).forEach(function(n){return a(n,l[n])}),s}if(i(u)){if(!i(c))return !1;if(Array.isArray(u)){if(!Array.isArray(c))return !1;for(var h,v=[],g=[],m=[],p=t(u.keys());!(h=p()).done;){var y=u[h.value];o(y)&&y[e]?m.push(y):m.length?g.push(y):v.push(y);}if(m.length){if(m.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(c.length<v.length+g.length)return !1;var d=c.slice(0,v.length),b=0===g.length?[]:c.slice(-g.length),w=c.slice(v.length,0===g.length?Infinity:-g.length);return v.every(function(t,r){return n(t,d[r],a)})&&g.every(function(t,r){return n(t,b[r],a)})&&(0===m.length||n(m[0],w,a))}return u.length===c.length&&u.every(function(t,r){return n(t,c[r],a)})}return Object.keys(u).every(function(t){var e,i=u[t];return (t in c||o(e=i)&&"optional"===e[r]().matcherType)&&n(i,c[t],a)})}return Object.is(c,u)},a=function n(t){var e,u,c;return i(t)?o(t)?null!=(e=null==(u=(c=t[r]()).getSelectionKeys)?void 0:u.call(c))?e:[]:Array.isArray(t)?f(t,n):f(Object.values(t),n):[]},f=function(n,t){return n.reduce(function(n,r){return n.concat(t(r))},[])};function l(n){return Object.assign(n,{optional:function(){return v(n)},and:function(t){return p(n,t)},or:function(t){return y(n,t)},select:function(t){return void 0===t?b(n):b(t,n)}})}function v(n){var t;return l(((t={})[r]=function(){return {match:function(t){var r={},e=function(n,t){r[n]=t;};return void 0===t?(a(n).forEach(function(n){return e(n,void 0)}),{matched:!0,selections:r}):{matched:c(n,t,e),selections:r}},getSelectionKeys:function(){return a(n)},matcherType:"optional"}},t))}function p(){var n,t=[].slice.call(arguments);return l(((n={})[r]=function(){return {match:function(n){var r={},e=function(n,t){r[n]=t;};return {matched:t.every(function(t){return c(t,n,e)}),selections:r}},getSelectionKeys:function(){return f(t,a)},matcherType:"and"}},n))}function y(){var n,t=[].slice.call(arguments);return l(((n={})[r]=function(){return {match:function(n){var r={},e=function(n,t){r[n]=t;};return f(t,a).forEach(function(n){return e(n,void 0)}),{matched:t.some(function(t){return c(t,n,e)}),selections:r}},getSelectionKeys:function(){return f(t,a)},matcherType:"or"}},n))}function d(n){var t;return (t={})[r]=function(){return {match:function(t){return {matched:Boolean(n(t))}}}},t}function b(){var n,t=[].slice.call(arguments),e="string"==typeof t[0]?t[0]:void 0,i=2===t.length?t[1]:"string"==typeof t[0]?void 0:t[0];return l(((n={})[r]=function(){return {match:function(n){var t,r=((t={})[null!=e?e:u]=n,t);return {matched:void 0===i||c(i,n,function(n,t){r[n]=t;}),selections:r}},getSelectionKeys:function(){return [null!=e?e:u].concat(void 0===i?[]:a(i))}}},n))}function w(n){return "number"==typeof n}function S(n){return "string"==typeof n}function j(n){return "bigint"==typeof n}l(d(function(n){return !0}));(function n(t){return Object.assign(l(t),{startsWith:function(r){return n(p(t,(e=r,d(function(n){return S(n)&&n.startsWith(e)}))));var e;},endsWith:function(r){return n(p(t,(e=r,d(function(n){return S(n)&&n.endsWith(e)}))));var e;},minLength:function(r){return n(p(t,function(n){return d(function(t){return S(t)&&t.length>=n})}(r)))},maxLength:function(r){return n(p(t,function(n){return d(function(t){return S(t)&&t.length<=n})}(r)))},includes:function(r){return n(p(t,(e=r,d(function(n){return S(n)&&n.includes(e)}))));var e;},regex:function(r){return n(p(t,(e=r,d(function(n){return S(n)&&Boolean(n.match(e))}))));var e;}})})(d(S));(function n(t){return Object.assign(l(t),{between:function(r,e){return n(p(t,function(n,t){return d(function(r){return w(r)&&n<=r&&t>=r})}(r,e)))},lt:function(r){return n(p(t,function(n){return d(function(t){return w(t)&&t<n})}(r)))},gt:function(r){return n(p(t,function(n){return d(function(t){return w(t)&&t>n})}(r)))},lte:function(r){return n(p(t,function(n){return d(function(t){return w(t)&&t<=n})}(r)))},gte:function(r){return n(p(t,function(n){return d(function(t){return w(t)&&t>=n})}(r)))},int:function(){return n(p(t,d(function(n){return w(n)&&Number.isInteger(n)})))},finite:function(){return n(p(t,d(function(n){return w(n)&&Number.isFinite(n)})))},positive:function(){return n(p(t,d(function(n){return w(n)&&n>0})))},negative:function(){return n(p(t,d(function(n){return w(n)&&n<0})))}})})(d(w));(function n(t){return Object.assign(l(t),{between:function(r,e){return n(p(t,function(n,t){return d(function(r){return j(r)&&n<=r&&t>=r})}(r,e)))},lt:function(r){return n(p(t,function(n){return d(function(t){return j(t)&&t<n})}(r)))},gt:function(r){return n(p(t,function(n){return d(function(t){return j(t)&&t>n})}(r)))},lte:function(r){return n(p(t,function(n){return d(function(t){return j(t)&&t<=n})}(r)))},gte:function(r){return n(p(t,function(n){return d(function(t){return j(t)&&t>=n})}(r)))},positive:function(){return n(p(t,d(function(n){return j(n)&&n>0})))},negative:function(){return n(p(t,d(function(n){return j(n)&&n<0})))}})})(d(j));l(d(function(n){return "boolean"==typeof n}));l(d(function(n){return "symbol"==typeof n}));l(d(function(n){return null==n}));var I={matched:!1,value:void 0},_=/*#__PURE__*/function(){function n(n,t){this.input=void 0,this.state=void 0,this.input=n,this.state=t;}var t=n.prototype;return t.with=function(){var t=this,r=[].slice.call(arguments);if(this.state.matched)return this;var e=r[r.length-1],i=[r[0]],o=void 0;3===r.length&&"function"==typeof r[1]?o=r[1]:r.length>2&&i.push.apply(i,r.slice(1,r.length-1));var a=!1,f={},s=function(n,t){a=!0,f[n]=t;},l=!i.some(function(n){return c(n,t.input,s)})||o&&!Boolean(o(this.input))?I:{matched:!0,value:e(a?u in f?f[u]:f:this.input,this.input)};return new n(this.input,l)},t.when=function(t,r){if(this.state.matched)return this;var e=Boolean(t(this.input));return new n(this.input,e?{matched:!0,value:r(this.input,this.input)}:I)},t.otherwise=function(n){return this.state.matched?this.state.value:n(this.input)},t.exhaustive=function(){if(this.state.matched)return this.state.value;var n;try{n=JSON.stringify(this.input);}catch(t){n=this.input;}throw new Error("Pattern matching error: no pattern matches value "+n)},t.run=function(){return this.exhaustive()},t.returnType=function(){return this},n}();match = function(n){return new _(n,I)};
851
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Order.js
852
+ var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
879
853
 
880
- const RULE_NAME$2 = "ensure-use-callback-has-non-empty-deps";
881
- var ensureUseCallbackHasNonEmptyDeps = createRule({
882
- name: RULE_NAME$2,
883
- meta: {
884
- type: "problem",
885
- docs: {
886
- description: "enforce 'useCallback' has non-empty dependencies array",
887
- requiresTypeChecking: false
888
- },
889
- schema: [],
890
- messages: {
891
- ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS: "useCallback should have a non-empty dependencies array"
892
- }
893
- },
894
- defaultOptions: [],
895
- create (context) {
896
- const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
897
- const pragma = jsx.getPragmaFromContext(context);
898
- return {
899
- CallExpression (node) {
900
- const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
901
- if (!core.isReactHookCall(node)) return;
902
- if (!core.isUseCallbackCall(node, context, pragma) && !alias.some(flip(core.isReactHookCallWithNameLoose)(node))) {
903
- return;
904
- }
905
- const [_, deps] = node.arguments;
906
- if (!deps) {
907
- context.report({
908
- messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
909
- node
910
- });
911
- return;
912
- }
913
- const maybeDescriptor = pipe(match(deps).with({
914
- type: ast.NodeType.ArrayExpression
915
- }, some).with({
916
- type: ast.NodeType.Identifier
917
- }, (n)=>{
918
- return pipe(_var.findVariable(n.name, initialScope), flatMap(_var.getVariableInit(0)), filter(ast.is(ast.NodeType.ArrayExpression)));
919
- }).otherwise(none), filter((x)=>x.elements.length === 0), map(()=>({
920
- node,
921
- messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS"
922
- })));
923
- map(maybeDescriptor, context.report);
924
- }
925
- };
854
+ // ../../../node_modules/.pnpm/effect@2.3.1/node_modules/effect/dist/esm/Option.js
855
+ var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Option");
856
+ var none2 = () => none;
857
+ var some2 = some;
858
+ var isOption2 = isOption;
859
+ var isNone2 = isNone;
860
+ var isSome2 = isSome;
861
+ var match = /* @__PURE__ */ dual(2, (self, {
862
+ onNone,
863
+ onSome
864
+ }) => isNone2(self) ? onNone() : onSome(self.value));
865
+ var toRefinement = (f) => (a) => isSome2(f(a));
866
+ var fromIterable = (collection) => {
867
+ for (const a of collection) {
868
+ return some2(a);
869
+ }
870
+ return none2();
871
+ };
872
+ var getRight2 = getRight;
873
+ var getLeft2 = getLeft;
874
+ var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
875
+ var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
876
+ var orElseSome = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? some2(onNone()) : self);
877
+ var orElseEither = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? map(that(), right) : map(self, left));
878
+ var firstSomeOf = (collection) => {
879
+ let out = none2();
880
+ for (out of collection) {
881
+ if (isSome2(out)) {
882
+ return out;
926
883
  }
884
+ }
885
+ return out;
886
+ };
887
+ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
888
+ var liftNullable = (f) => (...a) => fromNullable(f(...a));
889
+ var getOrNull = /* @__PURE__ */ getOrElse(constNull);
890
+ var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
891
+ var liftThrowable = (f) => (...a) => {
892
+ try {
893
+ return some2(f(...a));
894
+ } catch (e2) {
895
+ return none2();
896
+ }
897
+ };
898
+ var getOrThrowWith = /* @__PURE__ */ dual(2, (self, onNone) => {
899
+ if (isSome2(self)) {
900
+ return self.value;
901
+ }
902
+ throw onNone();
927
903
  });
928
-
929
- const RULE_NAME$1 = "ensure-use-memo-has-non-empty-deps";
930
- var ensureUseMemoHasNonEmptyDeps = createRule({
931
- name: RULE_NAME$1,
932
- meta: {
933
- type: "problem",
934
- docs: {
935
- description: "enforce 'useMemo' has non-empty dependencies array",
936
- requiresTypeChecking: false
937
- },
938
- schema: [],
939
- messages: {
940
- ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS: "useMemo should have a non-empty dependencies array"
904
+ var getOrThrow = /* @__PURE__ */ getOrThrowWith(() => new Error("getOrThrow called on a None"));
905
+ var map = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
906
+ var as = /* @__PURE__ */ dual(2, (self, b2) => map(self, () => b2));
907
+ var asUnit = /* @__PURE__ */ as(void 0);
908
+ var unit = /* @__PURE__ */ some2(void 0);
909
+ var flatMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(self.value));
910
+ var andThen = /* @__PURE__ */ dual(2, (self, f) => isFunction(f) ? flatMap(self, f) : flatMap(self, () => f));
911
+ var flatMapNullable = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : fromNullable(f(self.value)));
912
+ var flatten = /* @__PURE__ */ flatMap(identity);
913
+ var zipRight = /* @__PURE__ */ dual(2, (self, that) => flatMap(self, () => that));
914
+ var composeK = /* @__PURE__ */ dual(2, (afb, bfc) => (a) => flatMap(afb(a), bfc));
915
+ var zipLeft = /* @__PURE__ */ dual(2, (self, that) => tap(self, () => that));
916
+ var tap = /* @__PURE__ */ dual(2, (self, f) => flatMap(self, (a) => map(f(a), () => a)));
917
+ var product = (self, that) => isSome2(self) && isSome2(that) ? some2([self.value, that.value]) : none2();
918
+ var productMany = (self, collection) => {
919
+ if (isNone2(self)) {
920
+ return none2();
921
+ }
922
+ const out = [self.value];
923
+ for (const o2 of collection) {
924
+ if (isNone2(o2)) {
925
+ return none2();
926
+ }
927
+ out.push(o2.value);
928
+ }
929
+ return some2(out);
930
+ };
931
+ var all = (input) => {
932
+ if (Symbol.iterator in input) {
933
+ const out2 = [];
934
+ for (const o2 of input) {
935
+ if (isNone2(o2)) {
936
+ return none2();
937
+ }
938
+ out2.push(o2.value);
939
+ }
940
+ return some2(out2);
941
+ }
942
+ const out = {};
943
+ for (const key of Object.keys(input)) {
944
+ const o2 = input[key];
945
+ if (isNone2(o2)) {
946
+ return none2();
947
+ }
948
+ out[key] = o2.value;
949
+ }
950
+ return some2(out);
951
+ };
952
+ var zipWith = /* @__PURE__ */ dual(3, (self, that, f) => map(product(self, that), ([a, b2]) => f(a, b2)));
953
+ var ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f, a) => f(a)));
954
+ var reduceCompact = /* @__PURE__ */ dual(3, (self, b2, f) => {
955
+ let out = b2;
956
+ for (const oa of self) {
957
+ if (isSome2(oa)) {
958
+ out = f(out, oa.value);
959
+ }
960
+ }
961
+ return out;
962
+ });
963
+ var toArray = (self) => isNone2(self) ? [] : [self.value];
964
+ var partitionMap = /* @__PURE__ */ dual(2, (self, f) => {
965
+ if (isNone2(self)) {
966
+ return [none2(), none2()];
967
+ }
968
+ const e2 = f(self.value);
969
+ return isLeft(e2) ? [some2(e2.left), none2()] : [none2(), some2(e2.right)];
970
+ });
971
+ var filterMap = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : f(self.value));
972
+ var filter = /* @__PURE__ */ dual(2, (self, predicate) => filterMap(self, (b2) => predicate(b2) ? some(b2) : none));
973
+ var getEquivalence = (isEquivalent) => make((x2, y2) => x2 === y2 || (isNone2(x2) ? isNone2(y2) : isNone2(y2) ? false : isEquivalent(x2.value, y2.value)));
974
+ var getOrder = (O) => make2((self, that) => isSome2(self) ? isSome2(that) ? O(self.value, that.value) : 1 : -1);
975
+ var lift2 = (f) => dual(2, (self, that) => zipWith(self, that, f));
976
+ var liftPredicate = (predicate) => (b2) => predicate(b2) ? some2(b2) : none2();
977
+ var containsWith = (isEquivalent) => dual(2, (self, a) => isNone2(self) ? false : isEquivalent(self.value, a));
978
+ var _equivalence = /* @__PURE__ */ equivalence();
979
+ var contains = /* @__PURE__ */ containsWith(_equivalence);
980
+ var exists = /* @__PURE__ */ dual(2, (self, refinement) => isNone2(self) ? false : refinement(self.value));
981
+ var bindTo = /* @__PURE__ */ dual(2, (self, name2) => map(self, (a) => ({
982
+ [name2]: a
983
+ })));
984
+ var let_ = /* @__PURE__ */ dual(3, (self, name2, f) => map(self, (a) => Object.assign({}, a, {
985
+ [name2]: f(a)
986
+ })));
987
+ var bind = /* @__PURE__ */ dual(3, (self, name2, f) => flatMap(self, (a) => map(f(a), (b2) => Object.assign({}, a, {
988
+ [name2]: b2
989
+ }))));
990
+ var Do = /* @__PURE__ */ some2({});
991
+ var adapter2 = /* @__PURE__ */ adapter();
992
+ var gen = (f) => {
993
+ const iterator = f(adapter2);
994
+ let state = iterator.next();
995
+ if (state.done) {
996
+ return some2(state.value);
997
+ } else {
998
+ let current = state.value.value;
999
+ if (isNone2(current)) {
1000
+ return current;
1001
+ }
1002
+ while (!state.done) {
1003
+ state = iterator.next(current.value);
1004
+ if (!state.done) {
1005
+ current = state.value.value;
1006
+ if (isNone2(current)) {
1007
+ return current;
941
1008
  }
1009
+ }
1010
+ }
1011
+ return some2(state.value);
1012
+ }
1013
+ };
1014
+
1015
+ // ../../../node_modules/.pnpm/ts-pattern@5.0.6/node_modules/ts-pattern/dist/index.js
1016
+ var t = Symbol.for("@ts-pattern/matcher");
1017
+ var e = Symbol.for("@ts-pattern/isVariadic");
1018
+ var n = "@ts-pattern/anonymous-select-key";
1019
+ var r = (t2) => Boolean(t2 && "object" == typeof t2);
1020
+ var i = (e2) => e2 && !!e2[t];
1021
+ var s = (n2, o2, c2) => {
1022
+ if (i(n2)) {
1023
+ const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(o2);
1024
+ return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
1025
+ }
1026
+ if (r(n2)) {
1027
+ if (!r(o2))
1028
+ return false;
1029
+ if (Array.isArray(n2)) {
1030
+ if (!Array.isArray(o2))
1031
+ return false;
1032
+ let t2 = [], r2 = [], a = [];
1033
+ for (const s2 of n2.keys()) {
1034
+ const o3 = n2[s2];
1035
+ i(o3) && o3[e] ? a.push(o3) : a.length ? r2.push(o3) : t2.push(o3);
1036
+ }
1037
+ if (a.length) {
1038
+ if (a.length > 1)
1039
+ throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
1040
+ if (o2.length < t2.length + r2.length)
1041
+ return false;
1042
+ const e2 = o2.slice(0, t2.length), n3 = 0 === r2.length ? [] : o2.slice(-r2.length), i2 = o2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
1043
+ return t2.every((t3, n4) => s(t3, e2[n4], c2)) && r2.every((t3, e3) => s(t3, n3[e3], c2)) && (0 === a.length || s(a[0], i2, c2));
1044
+ }
1045
+ return n2.length === o2.length && n2.every((t3, e2) => s(t3, o2[e2], c2));
1046
+ }
1047
+ return Object.keys(n2).every((e2) => {
1048
+ const r2 = n2[e2];
1049
+ return (e2 in o2 || i(a = r2) && "optional" === a[t]().matcherType) && s(r2, o2[e2], c2);
1050
+ var a;
1051
+ });
1052
+ }
1053
+ return Object.is(o2, n2);
1054
+ };
1055
+ var o = (e2) => {
1056
+ var n2, s2, a;
1057
+ return r(e2) ? i(e2) ? null != (n2 = null == (s2 = (a = e2[t]()).getSelectionKeys) ? void 0 : s2.call(a)) ? n2 : [] : Array.isArray(e2) ? c(e2, o) : c(Object.values(e2), o) : [];
1058
+ };
1059
+ var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
1060
+ function u(t2) {
1061
+ return Object.assign(t2, { optional: () => l(t2), and: (e2) => m(t2, e2), or: (e2) => y(t2, e2), select: (e2) => void 0 === e2 ? p(t2) : p(e2, t2) });
1062
+ }
1063
+ function l(e2) {
1064
+ return u({ [t]: () => ({ match: (t2) => {
1065
+ let n2 = {};
1066
+ const r2 = (t3, e3) => {
1067
+ n2[t3] = e3;
1068
+ };
1069
+ return void 0 === t2 ? (o(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: s(e2, t2, r2), selections: n2 };
1070
+ }, getSelectionKeys: () => o(e2), matcherType: "optional" }) });
1071
+ }
1072
+ function m(...e2) {
1073
+ return u({ [t]: () => ({ match: (t2) => {
1074
+ let n2 = {};
1075
+ const r2 = (t3, e3) => {
1076
+ n2[t3] = e3;
1077
+ };
1078
+ return { matched: e2.every((e3) => s(e3, t2, r2)), selections: n2 };
1079
+ }, getSelectionKeys: () => c(e2, o), matcherType: "and" }) });
1080
+ }
1081
+ function y(...e2) {
1082
+ return u({ [t]: () => ({ match: (t2) => {
1083
+ let n2 = {};
1084
+ const r2 = (t3, e3) => {
1085
+ n2[t3] = e3;
1086
+ };
1087
+ return c(e2, o).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => s(e3, t2, r2)), selections: n2 };
1088
+ }, getSelectionKeys: () => c(e2, o), matcherType: "or" }) });
1089
+ }
1090
+ function d(e2) {
1091
+ return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
1092
+ }
1093
+ function p(...e2) {
1094
+ const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
1095
+ return u({ [t]: () => ({ match: (t2) => {
1096
+ let e3 = { [null != r2 ? r2 : n]: t2 };
1097
+ return { matched: void 0 === i2 || s(i2, t2, (t3, n2) => {
1098
+ e3[t3] = n2;
1099
+ }), selections: e3 };
1100
+ }, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : o(i2)) }) });
1101
+ }
1102
+ function v(t2) {
1103
+ return "number" == typeof t2;
1104
+ }
1105
+ function b(t2) {
1106
+ return "string" == typeof t2;
1107
+ }
1108
+ function w(t2) {
1109
+ return "bigint" == typeof t2;
1110
+ }
1111
+ u(d(function(t2) {
1112
+ return true;
1113
+ }));
1114
+ var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
1115
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.startsWith(n2)))));
1116
+ var n2;
1117
+ }, endsWith: (e2) => {
1118
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.endsWith(n2)))));
1119
+ var n2;
1120
+ }, minLength: (e2) => j(m(t2, ((t3) => d((e3) => b(e3) && e3.length >= t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => d((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
1121
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && t3.includes(n2)))));
1122
+ var n2;
1123
+ }, regex: (e2) => {
1124
+ return j(m(t2, (n2 = e2, d((t3) => b(t3) && Boolean(t3.match(n2))))));
1125
+ var n2;
1126
+ } });
1127
+ j(d(b));
1128
+ var K = (t2) => Object.assign(u(t2), { between: (e2, n2) => K(m(t2, ((t3, e3) => d((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => K(m(t2, ((t3) => d((e3) => v(e3) && e3 >= t3))(e2))), int: () => K(m(t2, d((t3) => v(t3) && Number.isInteger(t3)))), finite: () => K(m(t2, d((t3) => v(t3) && Number.isFinite(t3)))), positive: () => K(m(t2, d((t3) => v(t3) && t3 > 0))), negative: () => K(m(t2, d((t3) => v(t3) && t3 < 0))) });
1129
+ K(d(v));
1130
+ var x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => d((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => d((e3) => w(e3) && e3 >= t3))(e2))), positive: () => x(m(t2, d((t3) => w(t3) && t3 > 0))), negative: () => x(m(t2, d((t3) => w(t3) && t3 < 0))) });
1131
+ x(d(w));
1132
+ u(d(function(t2) {
1133
+ return "boolean" == typeof t2;
1134
+ }));
1135
+ u(d(function(t2) {
1136
+ return "symbol" == typeof t2;
1137
+ }));
1138
+ u(d(function(t2) {
1139
+ return null == t2;
1140
+ }));
1141
+ var W = { matched: false, value: void 0 };
1142
+ function N(t2) {
1143
+ return new $(t2, W);
1144
+ }
1145
+ var $ = class _$ {
1146
+ constructor(t2, e2) {
1147
+ this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
1148
+ }
1149
+ with(...t2) {
1150
+ if (this.state.matched)
1151
+ return this;
1152
+ const e2 = t2[t2.length - 1], r2 = [t2[0]];
1153
+ let i2;
1154
+ 3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
1155
+ let o2 = false, c2 = {};
1156
+ const a = (t3, e3) => {
1157
+ o2 = true, c2[t3] = e3;
1158
+ }, u2 = !r2.some((t3) => s(t3, this.input, a)) || i2 && !Boolean(i2(this.input)) ? W : { matched: true, value: e2(o2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
1159
+ return new _$(this.input, u2);
1160
+ }
1161
+ when(t2, e2) {
1162
+ if (this.state.matched)
1163
+ return this;
1164
+ const n2 = Boolean(t2(this.input));
1165
+ return new _$(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : W);
1166
+ }
1167
+ otherwise(t2) {
1168
+ return this.state.matched ? this.state.value : t2(this.input);
1169
+ }
1170
+ exhaustive() {
1171
+ if (this.state.matched)
1172
+ return this.state.value;
1173
+ let t2;
1174
+ try {
1175
+ t2 = JSON.stringify(this.input);
1176
+ } catch (e2) {
1177
+ t2 = this.input;
1178
+ }
1179
+ throw new Error(`Pattern matching error: no pattern matches value ${t2}`);
1180
+ }
1181
+ run() {
1182
+ return this.exhaustive();
1183
+ }
1184
+ returnType() {
1185
+ return this;
1186
+ }
1187
+ };
1188
+
1189
+ // src/rules/ensure-use-callback-has-non-empty-deps.ts
1190
+ var RULE_NAME2 = "ensure-use-callback-has-non-empty-deps";
1191
+ var ensure_use_callback_has_non_empty_deps_default = createRule({
1192
+ name: RULE_NAME2,
1193
+ meta: {
1194
+ type: "problem",
1195
+ docs: {
1196
+ description: "enforce 'useCallback' has non-empty dependencies array",
1197
+ requiresTypeChecking: false
942
1198
  },
943
- defaultOptions: [],
944
- create (context) {
945
- const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
946
- const pragma = jsx.getPragmaFromContext(context);
947
- return {
948
- CallExpression (node) {
949
- const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
950
- if (!core.isReactHookCall(node)) return;
951
- if (!core.isUseMemoCall(node, context, pragma) && !alias.some(flip(core.isReactHookCallWithNameLoose)(node))) return;
952
- const [_, deps] = node.arguments;
953
- if (!deps) {
954
- context.report({
955
- messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
956
- node
957
- });
958
- return;
959
- }
960
- const maybeDescriptor = pipe(match(deps).with({
961
- type: ast.NodeType.ArrayExpression
962
- }, some).with({
963
- type: ast.NodeType.Identifier
964
- }, (n)=>{
965
- return pipe(_var.findVariable(n.name, initialScope), flatMap(_var.getVariableInit(0)), filter(ast.is(ast.NodeType.ArrayExpression)));
966
- }).otherwise(none), filter((x)=>x.elements.length === 0), map(()=>({
967
- node,
968
- messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS"
969
- })));
970
- map(maybeDescriptor, context.report);
971
- }
972
- };
1199
+ schema: [],
1200
+ messages: {
1201
+ ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS: "useCallback should have a non-empty dependencies array"
973
1202
  }
1203
+ },
1204
+ defaultOptions: [],
1205
+ create(context) {
1206
+ const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useCallback ?? [];
1207
+ const pragma = jsx.getPragmaFromContext(context);
1208
+ return {
1209
+ CallExpression(node) {
1210
+ const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1211
+ if (!core.isReactHookCall(node))
1212
+ return;
1213
+ if (!core.isUseCallbackCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node))) {
1214
+ return;
1215
+ }
1216
+ const [_, deps] = node.arguments;
1217
+ if (!deps) {
1218
+ context.report({
1219
+ messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS",
1220
+ node
1221
+ });
1222
+ return;
1223
+ }
1224
+ const maybeDescriptor = Function_exports.pipe(
1225
+ N(deps).with({ type: ast.NodeType.ArrayExpression }, Option_exports.some).with({ type: ast.NodeType.Identifier }, (n2) => {
1226
+ return Function_exports.pipe(
1227
+ _var.findVariable(n2.name, initialScope),
1228
+ Option_exports.flatMap(_var.getVariableInit(0)),
1229
+ Option_exports.filter(ast.is(ast.NodeType.ArrayExpression))
1230
+ );
1231
+ }).otherwise(Option_exports.none),
1232
+ Option_exports.filter((x2) => x2.elements.length === 0),
1233
+ Option_exports.map(() => ({
1234
+ node,
1235
+ messageId: "ENSURE_USE_CALLBACK_HAS_NON_EMPTY_DEPS"
1236
+ }))
1237
+ );
1238
+ Option_exports.map(maybeDescriptor, context.report);
1239
+ }
1240
+ };
1241
+ }
974
1242
  });
975
-
976
- // Ported from https://github.com/jsx-eslint/eslint-plugin-react/pull/3579/commits/ebb739a0fe99a2ee77055870bfda9f67a2691374
977
- const RULE_NAME = "prefer-use-state-lazy-initialization";
978
- // variables should be defined here
979
- const ALLOW_LIST = Object.freeze([
980
- "Boolean",
981
- "String",
982
- "Number"
983
- ]);
984
- // rule takes inspiration from https://github.com/facebook/react/issues/26520
985
- var preferUseStateLazyInitialization = createRule({
986
- name: RULE_NAME,
987
- meta: {
988
- type: "problem",
989
- docs: {
990
- description: "disallow function calls in 'useState' that aren't wrapped in an initializer function",
991
- requiresTypeChecking: false
992
- },
993
- schema: [],
994
- messages: {
995
- PREFER_USE_STATE_LAZY_INITIALIZATION: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'"
1243
+ var RULE_NAME3 = "ensure-use-memo-has-non-empty-deps";
1244
+ var ensure_use_memo_has_non_empty_deps_default = createRule({
1245
+ name: RULE_NAME3,
1246
+ meta: {
1247
+ type: "problem",
1248
+ docs: {
1249
+ description: "enforce 'useMemo' has non-empty dependencies array",
1250
+ requiresTypeChecking: false
1251
+ },
1252
+ schema: [],
1253
+ messages: {
1254
+ ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS: "useMemo should have a non-empty dependencies array"
1255
+ }
1256
+ },
1257
+ defaultOptions: [],
1258
+ create(context) {
1259
+ const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useMemo ?? [];
1260
+ const pragma = jsx.getPragmaFromContext(context);
1261
+ return {
1262
+ CallExpression(node) {
1263
+ const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
1264
+ if (!core.isReactHookCall(node))
1265
+ return;
1266
+ if (!core.isUseMemoCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
1267
+ return;
1268
+ const [_, deps] = node.arguments;
1269
+ if (!deps) {
1270
+ context.report({
1271
+ messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS",
1272
+ node
1273
+ });
1274
+ return;
996
1275
  }
1276
+ const maybeDescriptor = Function_exports.pipe(
1277
+ N(deps).with({ type: ast.NodeType.ArrayExpression }, Option_exports.some).with({ type: ast.NodeType.Identifier }, (n2) => {
1278
+ return Function_exports.pipe(
1279
+ _var.findVariable(n2.name, initialScope),
1280
+ Option_exports.flatMap(_var.getVariableInit(0)),
1281
+ Option_exports.filter(ast.is(ast.NodeType.ArrayExpression))
1282
+ );
1283
+ }).otherwise(Option_exports.none),
1284
+ Option_exports.filter((x2) => x2.elements.length === 0),
1285
+ Option_exports.map(() => ({
1286
+ node,
1287
+ messageId: "ENSURE_USE_MEMO_HAS_NON_EMPTY_DEPS"
1288
+ }))
1289
+ );
1290
+ Option_exports.map(maybeDescriptor, context.report);
1291
+ }
1292
+ };
1293
+ }
1294
+ });
1295
+ var RULE_NAME4 = "prefer-use-state-lazy-initialization";
1296
+ var ALLOW_LIST = Object.freeze(["Boolean", "String", "Number"]);
1297
+ var prefer_use_state_lazy_initialization_default = createRule({
1298
+ name: RULE_NAME4,
1299
+ meta: {
1300
+ type: "problem",
1301
+ docs: {
1302
+ description: "disallow function calls in 'useState' that aren't wrapped in an initializer function",
1303
+ requiresTypeChecking: false
997
1304
  },
998
- defaultOptions: [],
999
- create (context) {
1000
- const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
1001
- const pragma = jsx.getPragmaFromContext(context);
1002
- return {
1003
- CallExpression (node) {
1004
- if (!core.isReactHookCall(node)) return;
1005
- if (!core.isUseStateCall(node, context, pragma) && !alias.some(flip(core.isReactHookCallWithNameLoose)(node))) return;
1006
- const [useStateInput] = node.arguments;
1007
- if (!useStateInput) return;
1008
- const nestedCallExpressions = ast.getNestedCallExpressions(useStateInput);
1009
- const hasFunctionCall = nestedCallExpressions.some((n)=>{
1010
- return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
1011
- });
1012
- if (!hasFunctionCall) return;
1013
- context.report({
1014
- node: useStateInput,
1015
- messageId: "PREFER_USE_STATE_LAZY_INITIALIZATION"
1016
- });
1017
- }
1018
- };
1305
+ schema: [],
1306
+ messages: {
1307
+ PREFER_USE_STATE_LAZY_INITIALIZATION: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'"
1019
1308
  }
1309
+ },
1310
+ defaultOptions: [],
1311
+ create(context) {
1312
+ const alias = shared.parseSchema(shared.ESLintSettingsSchema, context.settings).reactOptions?.additionalHooks?.useState ?? [];
1313
+ const pragma = jsx.getPragmaFromContext(context);
1314
+ return {
1315
+ CallExpression(node) {
1316
+ if (!core.isReactHookCall(node))
1317
+ return;
1318
+ if (!core.isUseStateCall(node, context, pragma) && !alias.some(Function_exports.flip(core.isReactHookCallWithNameLoose)(node)))
1319
+ return;
1320
+ const [useStateInput] = node.arguments;
1321
+ if (!useStateInput)
1322
+ return;
1323
+ const nestedCallExpressions = ast.getNestedCallExpressions(useStateInput);
1324
+ const hasFunctionCall = nestedCallExpressions.some((n2) => {
1325
+ return "name" in n2.callee && !ALLOW_LIST.includes(n2.callee.name);
1326
+ });
1327
+ if (!hasFunctionCall)
1328
+ return;
1329
+ context.report({
1330
+ node: useStateInput,
1331
+ messageId: "PREFER_USE_STATE_LAZY_INITIALIZATION"
1332
+ });
1333
+ }
1334
+ };
1335
+ }
1020
1336
  });
1021
1337
 
1022
- // Workaround for @typescript-eslint/utils's TS2742 error.
1023
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1024
- const meta = {
1025
- name,
1026
- version
1338
+ // src/index.ts
1339
+ var meta = {
1340
+ name,
1341
+ version
1027
1342
  };
1028
- const rules = {
1029
- "ensure-custom-hooks-using-other-hooks": ensureCustomHooksUsingOtherHooks,
1030
- "ensure-use-callback-has-non-empty-deps": ensureUseCallbackHasNonEmptyDeps,
1031
- "ensure-use-memo-has-non-empty-deps": ensureUseMemoHasNonEmptyDeps,
1032
- "prefer-use-state-lazy-initialization": preferUseStateLazyInitialization
1343
+ var rules = {
1344
+ "ensure-custom-hooks-using-other-hooks": ensure_custom_hooks_using_other_hooks_default,
1345
+ "ensure-use-callback-has-non-empty-deps": ensure_use_callback_has_non_empty_deps_default,
1346
+ "ensure-use-memo-has-non-empty-deps": ensure_use_memo_has_non_empty_deps_default,
1347
+ "prefer-use-state-lazy-initialization": prefer_use_state_lazy_initialization_default
1033
1348
  };
1034
1349
 
1035
1350
  exports.meta = meta;