@eslint-react/jsx 1.5.0-next.3 → 1.5.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,33 +1,1101 @@
1
1
  import { NodeType, isOneOf, is, traverseUp, isJSXTagNameExpression, getNestedReturnStatements, ESLintCommunityESLintUtils, traverseUpGuard, isStringLiteral, isMultiLine } from '@eslint-react/ast';
2
2
  import { parseSchema, ESLintSettingsSchema } from '@eslint-react/shared';
3
- import { F, O as O$1, Prd } from '@eslint-react/tools';
4
3
  import memo from 'micro-memoize';
5
4
  import { findVariable, getVariableInit } from '@eslint-react/var';
6
5
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
7
6
 
7
+ /**
8
+ * Tests if a value is a `function`.
9
+ *
10
+ * @param input - The value to test.
11
+ *
12
+ * @example
13
+ * import { isFunction } from 'effect/Predicate'
14
+ *
15
+ * assert.deepStrictEqual(isFunction(isFunction), true)
16
+ * assert.deepStrictEqual(isFunction("function"), false)
17
+ *
18
+ * @category guards
19
+ * @since 2.0.0
20
+ */
21
+ const isFunction$1 = input => typeof input === "function";
22
+ /**
23
+ * Creates a function that can be used in a data-last (aka `pipe`able) or
24
+ * data-first style.
25
+ *
26
+ * The first parameter to `dual` is either the arity of the uncurried function
27
+ * or a predicate that determines if the function is being used in a data-first
28
+ * or data-last style.
29
+ *
30
+ * Using the arity is the most common use case, but there are some cases where
31
+ * you may want to use a predicate. For example, if you have a function that
32
+ * takes an optional argument, you can use a predicate to determine if the
33
+ * function is being used in a data-first or data-last style.
34
+ *
35
+ * @param arity - Either the arity of the uncurried function or a predicate
36
+ * which determines if the function is being used in a data-first
37
+ * or data-last style.
38
+ * @param body - The definition of the uncurried function.
39
+ *
40
+ * @example
41
+ * import { dual, pipe } from "effect/Function"
42
+ *
43
+ * // Exampe using arity to determine data-first or data-last style
44
+ * const sum: {
45
+ * (that: number): (self: number) => number
46
+ * (self: number, that: number): number
47
+ * } = dual(2, (self: number, that: number): number => self + that)
48
+ *
49
+ * assert.deepStrictEqual(sum(2, 3), 5)
50
+ * assert.deepStrictEqual(pipe(2, sum(3)), 5)
51
+ *
52
+ * // Example using a predicate to determine data-first or data-last style
53
+ * const sum2: {
54
+ * (that: number): (self: number) => number
55
+ * (self: number, that: number): number
56
+ * } = dual((args) => args.length === 1, (self: number, that: number): number => self + that)
57
+ *
58
+ * assert.deepStrictEqual(sum(2, 3), 5)
59
+ * assert.deepStrictEqual(pipe(2, sum(3)), 5)
60
+ *
61
+ * @since 2.0.0
62
+ */
63
+ const dual = function (arity, body) {
64
+ if (typeof arity === "function") {
65
+ return function () {
66
+ if (arity(arguments)) {
67
+ // @ts-expect-error
68
+ return body.apply(this, arguments);
69
+ }
70
+ return self => body(self, ...arguments);
71
+ };
72
+ }
73
+ switch (arity) {
74
+ case 0:
75
+ case 1:
76
+ throw new RangeError(`Invalid arity ${arity}`);
77
+ case 2:
78
+ return function (a, b) {
79
+ if (arguments.length >= 2) {
80
+ return body(a, b);
81
+ }
82
+ return function (self) {
83
+ return body(self, a);
84
+ };
85
+ };
86
+ case 3:
87
+ return function (a, b, c) {
88
+ if (arguments.length >= 3) {
89
+ return body(a, b, c);
90
+ }
91
+ return function (self) {
92
+ return body(self, a, b);
93
+ };
94
+ };
95
+ case 4:
96
+ return function (a, b, c, d) {
97
+ if (arguments.length >= 4) {
98
+ return body(a, b, c, d);
99
+ }
100
+ return function (self) {
101
+ return body(self, a, b, c);
102
+ };
103
+ };
104
+ case 5:
105
+ return function (a, b, c, d, e) {
106
+ if (arguments.length >= 5) {
107
+ return body(a, b, c, d, e);
108
+ }
109
+ return function (self) {
110
+ return body(self, a, b, c, d);
111
+ };
112
+ };
113
+ default:
114
+ return function () {
115
+ if (arguments.length >= arity) {
116
+ // @ts-expect-error
117
+ return body.apply(this, arguments);
118
+ }
119
+ const args = arguments;
120
+ return function (self) {
121
+ return body(self, ...args);
122
+ };
123
+ };
124
+ }
125
+ };
126
+ /**
127
+ * Creates a constant value that never changes.
128
+ *
129
+ * This is useful when you want to pass a value to a higher-order function (a function that takes another function as its argument)
130
+ * and want that inner function to always use the same value, no matter how many times it is called.
131
+ *
132
+ * @param value - The constant value to be returned.
133
+ *
134
+ * @example
135
+ * import { constant } from "effect/Function"
136
+ *
137
+ * const constNull = constant(null)
138
+ *
139
+ * assert.deepStrictEqual(constNull(), null)
140
+ * assert.deepStrictEqual(constNull(), null)
141
+ *
142
+ * @since 2.0.0
143
+ */
144
+ const constant = value => () => value;
145
+ /**
146
+ * A thunk that returns always `true`.
147
+ *
148
+ * @example
149
+ * import { constTrue } from "effect/Function"
150
+ *
151
+ * assert.deepStrictEqual(constTrue(), true)
152
+ *
153
+ * @since 2.0.0
154
+ */
155
+ const constTrue = /*#__PURE__*/constant(true);
156
+ /**
157
+ * A thunk that returns always `false`.
158
+ *
159
+ * @example
160
+ * import { constFalse } from "effect/Function"
161
+ *
162
+ * assert.deepStrictEqual(constFalse(), false)
163
+ *
164
+ * @since 2.0.0
165
+ */
166
+ const constFalse = /*#__PURE__*/constant(false);
167
+ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
168
+ switch (arguments.length) {
169
+ case 1:
170
+ return a;
171
+ case 2:
172
+ return ab(a);
173
+ case 3:
174
+ return bc(ab(a));
175
+ case 4:
176
+ return cd(bc(ab(a)));
177
+ case 5:
178
+ return de(cd(bc(ab(a))));
179
+ case 6:
180
+ return ef(de(cd(bc(ab(a)))));
181
+ case 7:
182
+ return fg(ef(de(cd(bc(ab(a))))));
183
+ case 8:
184
+ return gh(fg(ef(de(cd(bc(ab(a)))))));
185
+ case 9:
186
+ return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
187
+ default:
188
+ {
189
+ let ret = arguments[0];
190
+ for (let i = 1; i < arguments.length; i++) {
191
+ ret = arguments[i](ret);
192
+ }
193
+ return ret;
194
+ }
195
+ }
196
+ }
197
+
198
+ const moduleVersion = "2.2.2";
199
+
200
+ /**
201
+ * @since 2.0.0
202
+ */
203
+ const globalStoreId = /*#__PURE__*/Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`);
204
+ if (!(globalStoreId in globalThis)) {
205
+ globalThis[globalStoreId] = /*#__PURE__*/new Map();
206
+ }
207
+ const globalStore = globalThis[globalStoreId];
208
+ /**
209
+ * @since 2.0.0
210
+ */
211
+ const globalValue = (id, compute) => {
212
+ if (!globalStore.has(id)) {
213
+ globalStore.set(id, compute());
214
+ }
215
+ return globalStore.get(id);
216
+ };
217
+
218
+ /**
219
+ * @since 2.0.0
220
+ */
221
+ /**
222
+ * Tests if a value is a `string`.
223
+ *
224
+ * @param input - The value to test.
225
+ *
226
+ * @example
227
+ * import { isString } from "effect/Predicate"
228
+ *
229
+ * assert.deepStrictEqual(isString("a"), true)
230
+ *
231
+ * assert.deepStrictEqual(isString(1), false)
232
+ *
233
+ * @category guards
234
+ * @since 2.0.0
235
+ */
236
+ const isString = input => typeof input === "string";
237
+ /**
238
+ * Tests if a value is a `function`.
239
+ *
240
+ * @param input - The value to test.
241
+ *
242
+ * @example
243
+ * import { isFunction } from "effect/Predicate"
244
+ *
245
+ * assert.deepStrictEqual(isFunction(isFunction), true)
246
+ *
247
+ * assert.deepStrictEqual(isFunction("function"), false)
248
+ *
249
+ * @category guards
250
+ * @since 2.0.0
251
+ */
252
+ const isFunction = isFunction$1;
253
+ const isRecordOrArray = input => typeof input === "object" && input !== null;
254
+ /**
255
+ * Tests if a value is an `object`.
256
+ *
257
+ * @param input - The value to test.
258
+ *
259
+ * @example
260
+ * import { isObject } from "effect/Predicate"
261
+ *
262
+ * assert.deepStrictEqual(isObject({}), true)
263
+ * assert.deepStrictEqual(isObject([]), true)
264
+ *
265
+ * assert.deepStrictEqual(isObject(null), false)
266
+ * assert.deepStrictEqual(isObject(undefined), false)
267
+ *
268
+ * @category guards
269
+ * @since 2.0.0
270
+ */
271
+ const isObject = input => isRecordOrArray(input) || isFunction(input);
272
+ /**
273
+ * Checks whether a value is an `object` containing a specified property key.
274
+ *
275
+ * @param property - The field to check within the object.
276
+ * @param self - The value to examine.
277
+ *
278
+ * @category guards
279
+ * @since 2.0.0
280
+ */
281
+ const hasProperty = /*#__PURE__*/dual(2, (self, property) => isObject(self) && property in self);
282
+ /**
283
+ * A guard that succeeds when the input is `null` or `undefined`.
284
+ *
285
+ * @param input - The value to test.
286
+ *
287
+ * @example
288
+ * import { isNullable } from "effect/Predicate"
289
+ *
290
+ * assert.deepStrictEqual(isNullable(null), true)
291
+ * assert.deepStrictEqual(isNullable(undefined), true)
292
+ *
293
+ * assert.deepStrictEqual(isNullable({}), false)
294
+ * assert.deepStrictEqual(isNullable([]), false)
295
+ *
296
+ * @category guards
297
+ * @since 2.0.0
298
+ */
299
+ const isNullable = input => input === null || input === undefined;
300
+
301
+ /**
302
+ * @since 2.0.0
303
+ */
304
+ const defaultIncHi = 0x14057b7e;
305
+ const defaultIncLo = 0xf767814f;
306
+ const MUL_HI = 0x5851f42d >>> 0;
307
+ const MUL_LO = 0x4c957f2d >>> 0;
308
+ const BIT_53 = 9007199254740992.0;
309
+ const BIT_27 = 134217728.0;
310
+ /**
311
+ * PCG is a family of simple fast space-efficient statistically good algorithms
312
+ * for random number generation. Unlike many general-purpose RNGs, they are also
313
+ * hard to predict.
314
+ *
315
+ * @category model
316
+ * @since 2.0.0
317
+ */
318
+ class PCGRandom {
319
+ _state;
320
+ constructor(seedHi, seedLo, incHi, incLo) {
321
+ if (isNullable(seedLo) && isNullable(seedHi)) {
322
+ seedLo = Math.random() * 0xffffffff >>> 0;
323
+ seedHi = 0;
324
+ } else if (isNullable(seedLo)) {
325
+ seedLo = seedHi;
326
+ seedHi = 0;
327
+ }
328
+ if (isNullable(incLo) && isNullable(incHi)) {
329
+ incLo = this._state ? this._state[3] : defaultIncLo;
330
+ incHi = this._state ? this._state[2] : defaultIncHi;
331
+ } else if (isNullable(incLo)) {
332
+ incLo = incHi;
333
+ incHi = 0;
334
+ }
335
+ this._state = new Int32Array([0, 0, incHi >>> 0, ((incLo || 0) | 1) >>> 0]);
336
+ this._next();
337
+ add64(this._state, this._state[0], this._state[1], seedHi >>> 0, seedLo >>> 0);
338
+ this._next();
339
+ return this;
340
+ }
341
+ /**
342
+ * Returns a copy of the internal state of this random number generator as a
343
+ * JavaScript Array.
344
+ *
345
+ * @category getters
346
+ * @since 2.0.0
347
+ */
348
+ getState() {
349
+ return [this._state[0], this._state[1], this._state[2], this._state[3]];
350
+ }
351
+ /**
352
+ * Restore state previously retrieved using `getState()`.
353
+ *
354
+ * @since 2.0.0
355
+ */
356
+ setState(state) {
357
+ this._state[0] = state[0];
358
+ this._state[1] = state[1];
359
+ this._state[2] = state[2];
360
+ this._state[3] = state[3] | 1;
361
+ }
362
+ /**
363
+ * Get a uniformly distributed 32 bit integer between [0, max).
364
+ *
365
+ * @category getter
366
+ * @since 2.0.0
367
+ */
368
+ integer(max) {
369
+ if (!max) {
370
+ return this._next();
371
+ }
372
+ max = max >>> 0;
373
+ if ((max & max - 1) === 0) {
374
+ return this._next() & max - 1; // fast path for power of 2
375
+ }
376
+ let num = 0;
377
+ const skew = (-max >>> 0) % max >>> 0;
378
+ for (num = this._next(); num < skew; num = this._next()) {
379
+ // this loop will rarely execute more than twice,
380
+ // and is intentionally empty
381
+ }
382
+ return num % max;
383
+ }
384
+ /**
385
+ * Get a uniformly distributed IEEE-754 double between 0.0 and 1.0, with
386
+ * 53 bits of precision (every bit of the mantissa is randomized).
387
+ *
388
+ * @category getters
389
+ * @since 2.0.0
390
+ */
391
+ number() {
392
+ const hi = (this._next() & 0x03ffffff) * 1.0;
393
+ const lo = (this._next() & 0x07ffffff) * 1.0;
394
+ return (hi * BIT_27 + lo) / BIT_53;
395
+ }
396
+ /** @internal */
397
+ _next() {
398
+ // save current state (what we'll use for this number)
399
+ const oldHi = this._state[0] >>> 0;
400
+ const oldLo = this._state[1] >>> 0;
401
+ // churn LCG.
402
+ mul64(this._state, oldHi, oldLo, MUL_HI, MUL_LO);
403
+ add64(this._state, this._state[0], this._state[1], this._state[2], this._state[3]);
404
+ // get least sig. 32 bits of ((oldstate >> 18) ^ oldstate) >> 27
405
+ let xsHi = oldHi >>> 18;
406
+ let xsLo = (oldLo >>> 18 | oldHi << 14) >>> 0;
407
+ xsHi = (xsHi ^ oldHi) >>> 0;
408
+ xsLo = (xsLo ^ oldLo) >>> 0;
409
+ const xorshifted = (xsLo >>> 27 | xsHi << 5) >>> 0;
410
+ // rotate xorshifted right a random amount, based on the most sig. 5 bits
411
+ // bits of the old state.
412
+ const rot = oldHi >>> 27;
413
+ const rot2 = (-rot >>> 0 & 31) >>> 0;
414
+ return (xorshifted >>> rot | xorshifted << rot2) >>> 0;
415
+ }
416
+ }
417
+ function mul64(out, aHi, aLo, bHi, bLo) {
418
+ let c1 = (aLo >>> 16) * (bLo & 0xffff) >>> 0;
419
+ let c0 = (aLo & 0xffff) * (bLo >>> 16) >>> 0;
420
+ let lo = (aLo & 0xffff) * (bLo & 0xffff) >>> 0;
421
+ let hi = (aLo >>> 16) * (bLo >>> 16) + ((c0 >>> 16) + (c1 >>> 16)) >>> 0;
422
+ c0 = c0 << 16 >>> 0;
423
+ lo = lo + c0 >>> 0;
424
+ if (lo >>> 0 < c0 >>> 0) {
425
+ hi = hi + 1 >>> 0;
426
+ }
427
+ c1 = c1 << 16 >>> 0;
428
+ lo = lo + c1 >>> 0;
429
+ if (lo >>> 0 < c1 >>> 0) {
430
+ hi = hi + 1 >>> 0;
431
+ }
432
+ hi = hi + Math.imul(aLo, bHi) >>> 0;
433
+ hi = hi + Math.imul(aHi, bLo) >>> 0;
434
+ out[0] = hi;
435
+ out[1] = lo;
436
+ }
437
+ // add two 64 bit numbers (given in parts), and store the result in `out`.
438
+ function add64(out, aHi, aLo, bHi, bLo) {
439
+ let hi = aHi + bHi >>> 0;
440
+ const lo = aLo + bLo >>> 0;
441
+ if (lo >>> 0 < aLo >>> 0) {
442
+ hi = hi + 1 | 0;
443
+ }
444
+ out[0] = hi;
445
+ out[1] = lo;
446
+ }
447
+
448
+ /**
449
+ * @since 2.0.0
450
+ */
451
+ /** @internal */
452
+ const randomHashCache = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/randomHashCache"), () => new WeakMap());
453
+ /** @internal */
454
+ const pcgr = /*#__PURE__*/globalValue( /*#__PURE__*/Symbol.for("effect/Hash/pcgr"), () => new PCGRandom());
455
+ /**
456
+ * @since 2.0.0
457
+ * @category symbols
458
+ */
459
+ const symbol$1 = /*#__PURE__*/Symbol.for("effect/Hash");
460
+ /**
461
+ * @since 2.0.0
462
+ * @category hashing
463
+ */
464
+ const hash = self => {
465
+ switch (typeof self) {
466
+ case "number":
467
+ return number(self);
468
+ case "bigint":
469
+ return string(self.toString(10));
470
+ case "boolean":
471
+ return string(String(self));
472
+ case "symbol":
473
+ return string(String(self));
474
+ case "string":
475
+ return string(self);
476
+ case "undefined":
477
+ return string("undefined");
478
+ case "function":
479
+ case "object":
480
+ {
481
+ if (self === null) {
482
+ return string("null");
483
+ }
484
+ if (isHash(self)) {
485
+ return self[symbol$1]();
486
+ } else {
487
+ return random(self);
488
+ }
489
+ }
490
+ default:
491
+ throw new Error(`BUG: unhandled typeof ${typeof self} - please report an issue at https://github.com/Effect-TS/effect/issues`);
492
+ }
493
+ };
494
+ /**
495
+ * @since 2.0.0
496
+ * @category hashing
497
+ */
498
+ const random = self => {
499
+ if (!randomHashCache.has(self)) {
500
+ randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)));
501
+ }
502
+ return randomHashCache.get(self);
503
+ };
504
+ /**
505
+ * @since 2.0.0
506
+ * @category hashing
507
+ */
508
+ const combine = b => self => self * 53 ^ b;
509
+ /**
510
+ * @since 2.0.0
511
+ * @category hashing
512
+ */
513
+ const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
514
+ /**
515
+ * @since 2.0.0
516
+ * @category guards
517
+ */
518
+ const isHash = u => hasProperty(u, symbol$1);
519
+ /**
520
+ * @since 2.0.0
521
+ * @category hashing
522
+ */
523
+ const number = n => {
524
+ if (n !== n || n === Infinity) {
525
+ return 0;
526
+ }
527
+ let h = n | 0;
528
+ if (h !== n) {
529
+ h ^= n * 0xffffffff;
530
+ }
531
+ while (n > 0xffffffff) {
532
+ h ^= n /= 0xffffffff;
533
+ }
534
+ return optimize(n);
535
+ };
536
+ /**
537
+ * @since 2.0.0
538
+ * @category hashing
539
+ */
540
+ const string = str => {
541
+ let h = 5381,
542
+ i = str.length;
543
+ while (i) {
544
+ h = h * 33 ^ str.charCodeAt(--i);
545
+ }
546
+ return optimize(h);
547
+ };
548
+
549
+ /**
550
+ * @since 2.0.0
551
+ * @category symbols
552
+ */
553
+ const symbol = /*#__PURE__*/Symbol.for("effect/Equal");
554
+ function equals() {
555
+ if (arguments.length === 1) {
556
+ return self => compareBoth(self, arguments[0]);
557
+ }
558
+ return compareBoth(arguments[0], arguments[1]);
559
+ }
560
+ function compareBoth(self, that) {
561
+ if (self === that) {
562
+ return true;
563
+ }
564
+ const selfType = typeof self;
565
+ if (selfType !== typeof that) {
566
+ return false;
567
+ }
568
+ if ((selfType === "object" || selfType === "function") && self !== null && that !== null) {
569
+ if (isEqual(self) && isEqual(that)) {
570
+ return hash(self) === hash(that) && self[symbol](that);
571
+ }
572
+ }
573
+ return false;
574
+ }
575
+ /**
576
+ * @since 2.0.0
577
+ * @category guards
578
+ */
579
+ const isEqual = u => hasProperty(u, symbol);
580
+
581
+ /**
582
+ * @since 2.0.0
583
+ */
584
+ /**
585
+ * @since 2.0.0
586
+ * @category symbols
587
+ */
588
+ const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
589
+ /**
590
+ * @since 2.0.0
591
+ */
592
+ const toJSON = x => {
593
+ if (hasProperty(x, "toJSON") && isFunction(x["toJSON"]) && x["toJSON"].length === 0) {
594
+ return x.toJSON();
595
+ } else if (Array.isArray(x)) {
596
+ return x.map(toJSON);
597
+ }
598
+ return x;
599
+ };
600
+ /**
601
+ * @since 2.0.0
602
+ */
603
+ const format = x => JSON.stringify(x, null, 2);
604
+
605
+ /**
606
+ * @since 2.0.0
607
+ */
608
+ /**
609
+ * @since 2.0.0
610
+ */
611
+ const pipeArguments = (self, args) => {
612
+ switch (args.length) {
613
+ case 1:
614
+ return args[0](self);
615
+ case 2:
616
+ return args[1](args[0](self));
617
+ case 3:
618
+ return args[2](args[1](args[0](self)));
619
+ case 4:
620
+ return args[3](args[2](args[1](args[0](self))));
621
+ case 5:
622
+ return args[4](args[3](args[2](args[1](args[0](self)))));
623
+ case 6:
624
+ return args[5](args[4](args[3](args[2](args[1](args[0](self))))));
625
+ case 7:
626
+ return args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))));
627
+ case 8:
628
+ return args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self))))))));
629
+ case 9:
630
+ return args[8](args[7](args[6](args[5](args[4](args[3](args[2](args[1](args[0](self)))))))));
631
+ default:
632
+ {
633
+ let ret = self;
634
+ for (let i = 0, len = args.length; i < len; i++) {
635
+ ret = args[i](ret);
636
+ }
637
+ return ret;
638
+ }
639
+ }
640
+ };
641
+
642
+ /** @internal */
643
+ const EffectTypeId = /*#__PURE__*/Symbol.for("effect/Effect");
644
+ /** @internal */
645
+ const StreamTypeId = /*#__PURE__*/Symbol.for("effect/Stream");
646
+ /** @internal */
647
+ const SinkTypeId = /*#__PURE__*/Symbol.for("effect/Sink");
648
+ /** @internal */
649
+ const ChannelTypeId = /*#__PURE__*/Symbol.for("effect/Channel");
650
+ /** @internal */
651
+ const effectVariance = {
652
+ /* c8 ignore next */
653
+ _R: _ => _,
654
+ /* c8 ignore next */
655
+ _E: _ => _,
656
+ /* c8 ignore next */
657
+ _A: _ => _,
658
+ _V: moduleVersion
659
+ };
660
+ const sinkVariance = {
661
+ /* c8 ignore next */
662
+ _R: _ => _,
663
+ /* c8 ignore next */
664
+ _E: _ => _,
665
+ /* c8 ignore next */
666
+ _In: _ => _,
667
+ /* c8 ignore next */
668
+ _L: _ => _,
669
+ /* c8 ignore next */
670
+ _Z: _ => _
671
+ };
672
+ const channelVariance = {
673
+ /* c8 ignore next */
674
+ _Env: _ => _,
675
+ /* c8 ignore next */
676
+ _InErr: _ => _,
677
+ /* c8 ignore next */
678
+ _InElem: _ => _,
679
+ /* c8 ignore next */
680
+ _InDone: _ => _,
681
+ /* c8 ignore next */
682
+ _OutErr: _ => _,
683
+ /* c8 ignore next */
684
+ _OutElem: _ => _,
685
+ /* c8 ignore next */
686
+ _OutDone: _ => _
687
+ };
688
+ /** @internal */
689
+ const EffectPrototype = {
690
+ [EffectTypeId]: effectVariance,
691
+ [StreamTypeId]: effectVariance,
692
+ [SinkTypeId]: sinkVariance,
693
+ [ChannelTypeId]: channelVariance,
694
+ [symbol](that) {
695
+ return this === that;
696
+ },
697
+ [symbol$1]() {
698
+ return random(this);
699
+ },
700
+ pipe() {
701
+ return pipeArguments(this, arguments);
702
+ }
703
+ };
704
+
705
+ /**
706
+ * @since 2.0.0
707
+ */
708
+ const TypeId = /*#__PURE__*/Symbol.for("effect/Option");
709
+ const CommonProto = {
710
+ ...EffectPrototype,
711
+ [TypeId]: {
712
+ _A: _ => _
713
+ },
714
+ [NodeInspectSymbol]() {
715
+ return this.toJSON();
716
+ },
717
+ toString() {
718
+ return format(this.toJSON());
719
+ }
720
+ };
721
+ const SomeProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
722
+ _tag: "Some",
723
+ _op: "Some",
724
+ [symbol](that) {
725
+ return isOption(that) && isSome$1(that) && equals(that.value, this.value);
726
+ },
727
+ [symbol$1]() {
728
+ return combine(hash(this._tag))(hash(this.value));
729
+ },
730
+ toJSON() {
731
+ return {
732
+ _id: "Option",
733
+ _tag: this._tag,
734
+ value: toJSON(this.value)
735
+ };
736
+ }
737
+ });
738
+ const NoneProto = /*#__PURE__*/Object.assign( /*#__PURE__*/Object.create(CommonProto), {
739
+ _tag: "None",
740
+ _op: "None",
741
+ [symbol](that) {
742
+ return isOption(that) && isNone$1(that);
743
+ },
744
+ [symbol$1]() {
745
+ return combine(hash(this._tag));
746
+ },
747
+ toJSON() {
748
+ return {
749
+ _id: "Option",
750
+ _tag: this._tag
751
+ };
752
+ }
753
+ });
754
+ /** @internal */
755
+ const isOption = input => hasProperty(input, TypeId);
756
+ /** @internal */
757
+ const isNone$1 = fa => fa._tag === "None";
758
+ /** @internal */
759
+ const isSome$1 = fa => fa._tag === "Some";
760
+ /** @internal */
761
+ const none$1 = /*#__PURE__*/Object.create(NoneProto);
762
+ /** @internal */
763
+ const some$1 = value => {
764
+ const a = Object.create(SomeProto);
765
+ a.value = value;
766
+ return a;
767
+ };
768
+
769
+ /**
770
+ * Creates a new `Option` that represents the absence of a value.
771
+ *
772
+ * @category constructors
773
+ * @since 2.0.0
774
+ */
775
+ const none = () => none$1;
776
+ /**
777
+ * Creates a new `Option` that wraps the given value.
778
+ *
779
+ * @param value - The value to wrap.
780
+ *
781
+ * @category constructors
782
+ * @since 2.0.0
783
+ */
784
+ const some = some$1;
785
+ /**
786
+ * Determine if a `Option` is a `None`.
787
+ *
788
+ * @param self - The `Option` to check.
789
+ *
790
+ * @example
791
+ * import { some, none, isNone } from 'effect/Option'
792
+ *
793
+ * assert.deepStrictEqual(isNone(some(1)), false)
794
+ * assert.deepStrictEqual(isNone(none()), true)
795
+ *
796
+ * @category guards
797
+ * @since 2.0.0
798
+ */
799
+ const isNone = isNone$1;
800
+ /**
801
+ * Determine if a `Option` is a `Some`.
802
+ *
803
+ * @param self - The `Option` to check.
804
+ *
805
+ * @example
806
+ * import { some, none, isSome } from 'effect/Option'
807
+ *
808
+ * assert.deepStrictEqual(isSome(some(1)), true)
809
+ * assert.deepStrictEqual(isSome(none()), false)
810
+ *
811
+ * @category guards
812
+ * @since 2.0.0
813
+ */
814
+ const isSome = isSome$1;
815
+ /**
816
+ * Returns the value of the `Option` if it is `Some`, otherwise returns `onNone`
817
+ *
818
+ * @param self - The `Option` to get the value of.
819
+ * @param onNone - Function that returns the default value to return if the `Option` is `None`.
820
+ *
821
+ * @example
822
+ * import { some, none, getOrElse } from 'effect/Option'
823
+ * import { pipe } from "effect/Function"
824
+ *
825
+ * assert.deepStrictEqual(pipe(some(1), getOrElse(() => 0)), 1)
826
+ * assert.deepStrictEqual(pipe(none(), getOrElse(() => 0)), 0)
827
+ *
828
+ * @category getters
829
+ * @since 2.0.0
830
+ */
831
+ const getOrElse = /*#__PURE__*/dual(2, (self, onNone) => isNone(self) ? onNone() : self.value);
832
+ /**
833
+ * Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`.
834
+ *
835
+ * @param self - The first `Option` to be checked.
836
+ * @param that - The `Option` to return if `self` is `None`.
837
+ *
838
+ * @example
839
+ * import * as O from "effect/Option"
840
+ * import { pipe } from "effect/Function"
841
+ *
842
+ * assert.deepStrictEqual(
843
+ * pipe(
844
+ * O.none(),
845
+ * O.orElse(() => O.none())
846
+ * ),
847
+ * O.none()
848
+ * )
849
+ * assert.deepStrictEqual(
850
+ * pipe(
851
+ * O.some('a'),
852
+ * O.orElse(() => O.none())
853
+ * ),
854
+ * O.some('a')
855
+ * )
856
+ * assert.deepStrictEqual(
857
+ * pipe(
858
+ * O.none(),
859
+ * O.orElse(() => O.some('b'))
860
+ * ),
861
+ * O.some('b')
862
+ * )
863
+ * assert.deepStrictEqual(
864
+ * pipe(
865
+ * O.some('a'),
866
+ * O.orElse(() => O.some('b'))
867
+ * ),
868
+ * O.some('a')
869
+ * )
870
+ *
871
+ * @category error handling
872
+ * @since 2.0.0
873
+ */
874
+ const orElse = /*#__PURE__*/dual(2, (self, that) => isNone(self) ? that() : self);
875
+ /**
876
+ * Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
877
+ * returns the value wrapped in a `Some`.
878
+ *
879
+ * @param nullableValue - The nullable value to be converted to an `Option`.
880
+ *
881
+ * @example
882
+ * import * as O from "effect/Option"
883
+ *
884
+ * assert.deepStrictEqual(O.fromNullable(undefined), O.none())
885
+ * assert.deepStrictEqual(O.fromNullable(null), O.none())
886
+ * assert.deepStrictEqual(O.fromNullable(1), O.some(1))
887
+ *
888
+ * @category conversions
889
+ * @since 2.0.0
890
+ */
891
+ const fromNullable = nullableValue => nullableValue == null ? none() : some(nullableValue);
892
+ /**
893
+ * Maps the `Some` side of an `Option` value to a new `Option` value.
894
+ *
895
+ * @param self - An `Option` to map
896
+ * @param f - The function to map over the value of the `Option`
897
+ *
898
+ * @category mapping
899
+ * @since 2.0.0
900
+ */
901
+ const map = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
902
+ /**
903
+ * Applies a function to the value of an `Option` and flattens the result, if the input is `Some`.
904
+ *
905
+ * @category sequencing
906
+ * @since 2.0.0
907
+ */
908
+ const flatMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
909
+ /**
910
+ * This is `flatMap` + `fromNullable`, useful when working with optional values.
911
+ *
912
+ * @example
913
+ * import { some, none, flatMapNullable } from 'effect/Option'
914
+ * import { pipe } from "effect/Function"
915
+ *
916
+ * interface Employee {
917
+ * company?: {
918
+ * address?: {
919
+ * street?: {
920
+ * name?: string
921
+ * }
922
+ * }
923
+ * }
924
+ * }
925
+ *
926
+ * const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
927
+ *
928
+ * assert.deepStrictEqual(
929
+ * pipe(
930
+ * some(employee1),
931
+ * flatMapNullable(employee => employee.company?.address?.street?.name),
932
+ * ),
933
+ * some('high street')
934
+ * )
935
+ *
936
+ * const employee2: Employee = { company: { address: { street: {} } } }
937
+ *
938
+ * assert.deepStrictEqual(
939
+ * pipe(
940
+ * some(employee2),
941
+ * flatMapNullable(employee => employee.company?.address?.street?.name),
942
+ * ),
943
+ * none()
944
+ * )
945
+ *
946
+ * @category sequencing
947
+ * @since 2.0.0
948
+ */
949
+ const flatMapNullable = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : fromNullable(f(self.value)));
950
+ /**
951
+ * @category combining
952
+ * @since 2.0.0
953
+ */
954
+ const product = (self, that) => isSome(self) && isSome(that) ? some([self.value, that.value]) : none();
955
+ /**
956
+ * Zips two `Option` values together using a provided function, returning a new `Option` of the result.
957
+ *
958
+ * @param self - The left-hand side of the zip operation
959
+ * @param that - The right-hand side of the zip operation
960
+ * @param f - The function used to combine the values of the two `Option`s
961
+ *
962
+ * @example
963
+ * import * as O from "effect/Option"
964
+ *
965
+ * type Complex = [real: number, imaginary: number]
966
+ *
967
+ * const complex = (real: number, imaginary: number): Complex => [real, imaginary]
968
+ *
969
+ * assert.deepStrictEqual(O.zipWith(O.none(), O.none(), complex), O.none())
970
+ * assert.deepStrictEqual(O.zipWith(O.some(1), O.none(), complex), O.none())
971
+ * assert.deepStrictEqual(O.zipWith(O.none(), O.some(1), complex), O.none())
972
+ * assert.deepStrictEqual(O.zipWith(O.some(1), O.some(2), complex), O.some([1, 2]))
973
+ *
974
+ * assert.deepStrictEqual(O.zipWith(O.some(1), complex)(O.some(2)), O.some([2, 1]))
975
+ *
976
+ * @category zipping
977
+ * @since 2.0.0
978
+ */
979
+ const zipWith = /*#__PURE__*/dual(3, (self, that, f) => map(product(self, that), ([a, b]) => f(a, b)));
980
+ /**
981
+ * Maps over the value of an `Option` and filters out `None`s.
982
+ *
983
+ * Useful when in addition to filtering you also want to change the type of the `Option`.
984
+ *
985
+ * @param self - The `Option` to map over.
986
+ * @param f - A function to apply to the value of the `Option`.
987
+ *
988
+ * @example
989
+ * import * as O from "effect/Option"
990
+ *
991
+ * const evenNumber = (n: number) => n % 2 === 0 ? O.some(n) : O.none()
992
+ *
993
+ * assert.deepStrictEqual(O.filterMap(O.none(), evenNumber), O.none())
994
+ * assert.deepStrictEqual(O.filterMap(O.some(3), evenNumber), O.none())
995
+ * assert.deepStrictEqual(O.filterMap(O.some(2), evenNumber), O.some(2))
996
+ *
997
+ * @category filtering
998
+ * @since 2.0.0
999
+ */
1000
+ const filterMap = /*#__PURE__*/dual(2, (self, f) => isNone(self) ? none() : f(self.value));
1001
+ /**
1002
+ * Filters an `Option` using a predicate. If the predicate is not satisfied or the `Option` is `None` returns `None`.
1003
+ *
1004
+ * If you need to change the type of the `Option` in addition to filtering, see `filterMap`.
1005
+ *
1006
+ * @param predicate - A predicate function to apply to the `Option` value.
1007
+ * @param fb - The `Option` to filter.
1008
+ *
1009
+ * @example
1010
+ * import * as O from "effect/Option"
1011
+ *
1012
+ * // predicate
1013
+ * const isEven = (n: number) => n % 2 === 0
1014
+ *
1015
+ * assert.deepStrictEqual(O.filter(O.none(), isEven), O.none())
1016
+ * assert.deepStrictEqual(O.filter(O.some(3), isEven), O.none())
1017
+ * assert.deepStrictEqual(O.filter(O.some(2), isEven), O.some(2))
1018
+ *
1019
+ * // refinement
1020
+ * const isNumber = (v: unknown): v is number => typeof v === "number"
1021
+ *
1022
+ * assert.deepStrictEqual(O.filter(O.none(), isNumber), O.none())
1023
+ * assert.deepStrictEqual(O.filter(O.some('hello'), isNumber), O.none())
1024
+ * assert.deepStrictEqual(O.filter(O.some(2), isNumber), O.some(2))
1025
+ *
1026
+ * @category filtering
1027
+ * @since 2.0.0
1028
+ */
1029
+ const filter = /*#__PURE__*/dual(2, (self, predicate) => filterMap(self, b => predicate(b) ? some$1(b) : none$1));
1030
+ /**
1031
+ * Transforms a `Predicate` function into a `Some` of the input value if the predicate returns `true` or `None`
1032
+ * if the predicate returns `false`.
1033
+ *
1034
+ * @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
1035
+ *
1036
+ * @example
1037
+ * import * as O from "effect/Option"
1038
+ *
1039
+ * const getOption = O.liftPredicate((n: number) => n >= 0)
1040
+ *
1041
+ * assert.deepStrictEqual(getOption(-1), O.none())
1042
+ * assert.deepStrictEqual(getOption(1), O.some(1))
1043
+ *
1044
+ * @category lifting
1045
+ * @since 2.0.0
1046
+ */
1047
+ const liftPredicate = predicate => b => predicate(b) ? some(b) : none();
1048
+ /**
1049
+ * Check if a value in an `Option` type meets a certain predicate.
1050
+ *
1051
+ * @param self - The `Option` to check.
1052
+ * @param predicate - The condition to check.
1053
+ *
1054
+ * @example
1055
+ * import { some, none, exists } from 'effect/Option'
1056
+ * import { pipe } from "effect/Function"
1057
+ *
1058
+ * const isEven = (n: number) => n % 2 === 0
1059
+ *
1060
+ * assert.deepStrictEqual(pipe(some(2), exists(isEven)), true)
1061
+ * assert.deepStrictEqual(pipe(some(1), exists(isEven)), false)
1062
+ * assert.deepStrictEqual(pipe(none(), exists(isEven)), false)
1063
+ *
1064
+ * @since 2.0.0
1065
+ */
1066
+ const exists = /*#__PURE__*/dual(2, (self, refinement) => isNone(self) ? false : refinement(self.value));
1067
+
1068
+ /**
1069
+ * Bun currently has a bug where `setTimeout` doesn't behave correctly with a 0ms delay.
1070
+ *
1071
+ * @see https://github.com/oven-sh/bun/issues/3333
1072
+ */
1073
+ /** @internal */
1074
+ typeof process === "undefined" ? false : !!process?.isBun;
1075
+
8
1076
  const RE_JSX_ANNOTATION_REGEX = /@jsx\s+(\S+)/u;
9
1077
  // Does not check for reserved keywords or unicode characters
10
1078
  const RE_JS_IDENTIFIER_REGEX = /^[$A-Z_a-z][\w$]*$/u;
11
1079
  function getFragmentFromContext(context) {
12
1080
  const settings = parseSchema(ESLintSettingsSchema, context.settings);
13
- const fragment = settings.eslintReact?.jsx?.fragment;
14
- if (Prd.isString(fragment) && RE_JS_IDENTIFIER_REGEX.test(fragment)) return fragment;
1081
+ const fragment = settings.reactOptions?.jsxPragmaFrag;
1082
+ if (isString(fragment) && RE_JS_IDENTIFIER_REGEX.test(fragment)) return fragment;
15
1083
  return "Fragment";
16
1084
  }
17
1085
  const getPragmaFromContext = memo((context)=>{
18
1086
  const settings = parseSchema(ESLintSettingsSchema, context.settings);
19
- const pragma = settings.eslintReact?.jsx?.pragma;
1087
+ const pragma = settings.reactOptions?.jsxPragma;
20
1088
  const { sourceCode } = context;
21
1089
  const pragmaNode = sourceCode.getAllComments().find((node)=>RE_JSX_ANNOTATION_REGEX.test(node.value));
22
- return F.pipe(O$1.orElse(O$1.fromNullable(pragma), ()=>F.pipe(O$1.fromNullable(pragmaNode), O$1.map(({ value })=>RE_JSX_ANNOTATION_REGEX.exec(value)), O$1.flatMapNullable((matches)=>matches?.[1]?.split(".")[0]))), O$1.flatMap(O$1.liftPredicate((x)=>RE_JS_IDENTIFIER_REGEX.test(x))), O$1.getOrElse(F.constant("React")));
1090
+ return pipe(orElse(fromNullable(pragma), ()=>pipe(fromNullable(pragmaNode), map(({ value })=>RE_JSX_ANNOTATION_REGEX.exec(value)), flatMapNullable((matches)=>matches?.[1]?.split(".")[0]))), flatMap(liftPredicate((x)=>RE_JS_IDENTIFIER_REGEX.test(x))), getOrElse(constant("React")));
23
1091
  });
24
1092
 
25
1093
  const t=Symbol.for("@ts-pattern/matcher"),e=Symbol.for("@ts-pattern/isVariadic"),n="@ts-pattern/anonymous-select-key",r=t=>Boolean(t&&"object"==typeof t),i=e=>e&&!!e[t],s=(n,o,c)=>{if(i(n)){const e=n[t](),{matched:r,selections:i}=e.match(o);return r&&i&&Object.keys(i).forEach(t=>c(t,i[t])),r}if(r(n)){if(!r(o))return !1;if(Array.isArray(n)){if(!Array.isArray(o))return !1;let t=[],r=[],a=[];for(const s of n.keys()){const o=n[s];i(o)&&o[e]?a.push(o):a.length?r.push(o):t.push(o);}if(a.length){if(a.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(o.length<t.length+r.length)return !1;const e=o.slice(0,t.length),n=0===r.length?[]:o.slice(-r.length),i=o.slice(t.length,0===r.length?Infinity:-r.length);return t.every((t,n)=>s(t,e[n],c))&&r.every((t,e)=>s(t,n[e],c))&&(0===a.length||s(a[0],i,c))}return n.length===o.length&&n.every((t,e)=>s(t,o[e],c))}return Object.keys(n).every(e=>{const r=n[e];return (e in o||i(a=r)&&"optional"===a[t]().matcherType)&&s(r,o[e],c);var a;})}return Object.is(o,n)},o=e=>{var n,s,a;return r(e)?i(e)?null!=(n=null==(s=(a=e[t]()).getSelectionKeys)?void 0:s.call(a))?n:[]:Array.isArray(e)?c(e,o):c(Object.values(e),o):[]},c=(t,e)=>t.reduce((t,n)=>t.concat(e(n)),[]);function a(...t){if(1===t.length){const[e]=t;return t=>s(e,t,()=>{})}if(2===t.length){const[e,n]=t;return s(e,n,()=>{})}throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`)}function u(t){return Object.assign(t,{optional:()=>l(t),and:e=>m(t,e),or:e=>y(t,e),select:e=>void 0===e?p(t):p(e,t)})}function h(t){return Object.assign((t=>Object.assign(t,{*[Symbol.iterator](){yield Object.assign(t,{[e]:!0});}}))(t),{optional:()=>h(l(t)),select:e=>h(void 0===e?p(t):p(e,t))})}function l(e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e;};return void 0===t?(o(e).forEach(t=>r(t,void 0)),{matched:!0,selections:n}):{matched:s(e,t,r),selections:n}},getSelectionKeys:()=>o(e),matcherType:"optional"})})}const f=(t,e)=>{for(const n of t)if(!e(n))return !1;return !0},g=(t,e)=>{for(const[n,r]of t.entries())if(!e(r,n))return !1;return !0};function m(...e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e;};return {matched:e.every(e=>s(e,t,r)),selections:n}},getSelectionKeys:()=>c(e,o),matcherType:"and"})})}function y(...e){return u({[t]:()=>({match:t=>{let n={};const r=(t,e)=>{n[t]=e;};return c(e,o).forEach(t=>r(t,void 0)),{matched:e.some(e=>s(e,t,r)),selections:n}},getSelectionKeys:()=>c(e,o),matcherType:"or"})})}function d(e){return {[t]:()=>({match:t=>({matched:Boolean(e(t))})})}}function p(...e){const r="string"==typeof e[0]?e[0]:void 0,i=2===e.length?e[1]:"string"==typeof e[0]?void 0:e[0];return u({[t]:()=>({match:t=>{let e={[null!=r?r:n]:t};return {matched:void 0===i||s(i,t,(t,n)=>{e[t]=n;}),selections:e}},getSelectionKeys:()=>[null!=r?r:n].concat(void 0===i?[]:o(i))})})}function v(t){return "number"==typeof t}function b(t){return "string"==typeof t}function w(t){return "bigint"==typeof t}const S=u(d(function(t){return !0})),O=S,j=t=>Object.assign(u(t),{startsWith:e=>{return j(m(t,(n=e,d(t=>b(t)&&t.startsWith(n)))));var n;},endsWith:e=>{return j(m(t,(n=e,d(t=>b(t)&&t.endsWith(n)))));var n;},minLength:e=>j(m(t,(t=>d(e=>b(e)&&e.length>=t))(e))),maxLength:e=>j(m(t,(t=>d(e=>b(e)&&e.length<=t))(e))),includes:e=>{return j(m(t,(n=e,d(t=>b(t)&&t.includes(n)))));var n;},regex:e=>{return j(m(t,(n=e,d(t=>b(t)&&Boolean(t.match(n))))));var n;}}),E=j(d(b)),K=t=>Object.assign(u(t),{between:(e,n)=>K(m(t,((t,e)=>d(n=>v(n)&&t<=n&&e>=n))(e,n))),lt:e=>K(m(t,(t=>d(e=>v(e)&&e<t))(e))),gt:e=>K(m(t,(t=>d(e=>v(e)&&e>t))(e))),lte:e=>K(m(t,(t=>d(e=>v(e)&&e<=t))(e))),gte:e=>K(m(t,(t=>d(e=>v(e)&&e>=t))(e))),int:()=>K(m(t,d(t=>v(t)&&Number.isInteger(t)))),finite:()=>K(m(t,d(t=>v(t)&&Number.isFinite(t)))),positive:()=>K(m(t,d(t=>v(t)&&t>0))),negative:()=>K(m(t,d(t=>v(t)&&t<0)))}),A=K(d(v)),x=t=>Object.assign(u(t),{between:(e,n)=>x(m(t,((t,e)=>d(n=>w(n)&&t<=n&&e>=n))(e,n))),lt:e=>x(m(t,(t=>d(e=>w(e)&&e<t))(e))),gt:e=>x(m(t,(t=>d(e=>w(e)&&e>t))(e))),lte:e=>x(m(t,(t=>d(e=>w(e)&&e<=t))(e))),gte:e=>x(m(t,(t=>d(e=>w(e)&&e>=t))(e))),positive:()=>x(m(t,d(t=>w(t)&&t>0))),negative:()=>x(m(t,d(t=>w(t)&&t<0)))}),P=x(d(w)),T=u(d(function(t){return "boolean"==typeof t})),k=u(d(function(t){return "symbol"==typeof t})),B=u(d(function(t){return null==t}));var _={__proto__:null,matcher:t,optional:l,array:function(...e){return h({[t]:()=>({match:t=>{if(!Array.isArray(t))return {matched:!1};if(0===e.length)return {matched:!0};const n=e[0];let r={};if(0===t.length)return o(n).forEach(t=>{r[t]=[];}),{matched:!0,selections:r};const i=(t,e)=>{r[t]=(r[t]||[]).concat([e]);};return {matched:t.every(t=>s(n,t,i)),selections:r}},getSelectionKeys:()=>0===e.length?[]:o(e[0])})})},set:function(...e){return u({[t]:()=>({match:t=>{if(!(t instanceof Set))return {matched:!1};let n={};if(0===t.size)return {matched:!0,selections:n};if(0===e.length)return {matched:!0};const r=(t,e)=>{n[t]=(n[t]||[]).concat([e]);},i=e[0];return {matched:f(t,t=>s(i,t,r)),selections:n}},getSelectionKeys:()=>0===e.length?[]:o(e[0])})})},map:function(...e){return u({[t]:()=>({match:t=>{if(!(t instanceof Map))return {matched:!1};let n={};if(0===t.size)return {matched:!0,selections:n};const r=(t,e)=>{n[t]=(n[t]||[]).concat([e]);};if(0===e.length)return {matched:!0};var i;if(1===e.length)throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null==(i=e[0])?void 0:i.toString()}`);const[o,c]=e;return {matched:g(t,(t,e)=>{const n=s(o,e,r),i=s(c,t,r);return n&&i}),selections:n}},getSelectionKeys:()=>0===e.length?[]:[...o(e[0]),...o(e[1])]})})},intersection:m,union:y,not:function(e){return u({[t]:()=>({match:t=>({matched:!s(e,t,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:d,select:p,any:S,_:O,string:E,number:A,bigint:P,boolean:T,symbol:k,nullish:B,instanceOf:function(t){return u(d(function(t){return e=>e instanceof t}(t)))},shape:function(t){return u(d(a(t)))}};const W={matched:!1,value:void 0};function N(t){return new $(t,W)}class ${constructor(t,e){this.input=void 0,this.state=void 0,this.input=t,this.state=e;}with(...t){if(this.state.matched)return this;const e=t[t.length-1],r=[t[0]];let i;3===t.length&&"function"==typeof t[1]?i=t[1]:t.length>2&&r.push(...t.slice(1,t.length-1));let o=!1,c={};const a=(t,e)=>{o=!0,c[t]=e;},u=!r.some(t=>s(t,this.input,a))||i&&!Boolean(i(this.input))?W:{matched:!0,value:e(o?n in c?c[n]:c:this.input,this.input)};return new $(this.input,u)}when(t,e){if(this.state.matched)return this;const n=Boolean(t(this.input));return new $(this.input,n?{matched:!0,value:e(this.input,this.input)}:W)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;let t;try{t=JSON.stringify(this.input);}catch(e){t=this.input;}throw new Error(`Pattern matching error: no pattern matches value ${t}`)}run(){return this.exhaustive()}returnType(){return this}}
26
1094
 
27
1095
  function isInitializedFromPragma(variableName, context, initialScope, pragma = getPragmaFromContext(context)) {
28
1096
  const maybeVariable = findVariable(variableName, initialScope);
29
- const maybeLatestDef = O$1.flatMapNullable(maybeVariable, (variable)=>variable.defs.at(-1));
30
- if (O$1.isNone(maybeLatestDef)) return false;
1097
+ const maybeLatestDef = flatMapNullable(maybeVariable, (variable)=>variable.defs.at(-1));
1098
+ if (isNone(maybeLatestDef)) return false;
31
1099
  const latestDef = maybeLatestDef.value;
32
1100
  const { node, parent } = latestDef;
33
1101
  if (node.type === NodeType.VariableDeclarator && node.init) {
@@ -52,7 +1120,7 @@ function isInitializedFromPragma(variableName, context, initialScope, pragma = g
52
1120
  type: NodeType.Identifier,
53
1121
  name: "require"
54
1122
  }
55
- }, (exp)=>O$1.some(exp)).with({
1123
+ }, (exp)=>some(exp)).with({
56
1124
  type: NodeType.MemberExpression,
57
1125
  object: {
58
1126
  type: NodeType.CallExpression,
@@ -61,8 +1129,8 @@ function isInitializedFromPragma(variableName, context, initialScope, pragma = g
61
1129
  name: "require"
62
1130
  }
63
1131
  }
64
- }, ({ object })=>O$1.some(object)).otherwise(O$1.none);
65
- if (O$1.isNone(maybeRequireExpression)) return false;
1132
+ }, ({ object })=>some(object)).otherwise(none);
1133
+ if (isNone(maybeRequireExpression)) return false;
66
1134
  const requireExpression = maybeRequireExpression.value;
67
1135
  const [firstArg] = requireExpression.arguments;
68
1136
  if (firstArg?.type !== NodeType.Literal) return false;
@@ -186,10 +1254,10 @@ function resolveMemberExpressions(object, property) {
186
1254
  * @param context The rule context
187
1255
  * @returns `true` if the node is inside createElement's props
188
1256
  */ function isInsideCreateElementProps(node, context) {
189
- return F.pipe(traverseUp(node, (n)=>is(NodeType.CallExpression)(n) && isCreateElementCall(n, context)), O$1.filter(is(NodeType.CallExpression)), O$1.flatMapNullable((c)=>c.arguments.at(1)), O$1.filter(is(NodeType.ObjectExpression)), O$1.zipWith(traverseUp(node, is(NodeType.ObjectExpression)), (a, b)=>a === b), O$1.getOrElse(F.constFalse));
1257
+ return pipe(traverseUp(node, (n)=>is(NodeType.CallExpression)(n) && isCreateElementCall(n, context)), filter(is(NodeType.CallExpression)), flatMapNullable((c)=>c.arguments.at(1)), filter(is(NodeType.ObjectExpression)), zipWith(traverseUp(node, is(NodeType.ObjectExpression)), (a, b)=>a === b), getOrElse(constFalse));
190
1258
  }
191
1259
  function isChildrenOfCreateElement(node, context) {
192
- return F.pipe(O$1.fromNullable(node.parent), O$1.filter(is(NodeType.CallExpression)), O$1.filter((n)=>isCreateElementCall(n, context)), O$1.exists((n)=>n.arguments.slice(2).some((arg)=>arg === node)));
1260
+ return pipe(fromNullable(node.parent), filter(is(NodeType.CallExpression)), filter((n)=>isCreateElementCall(n, context)), exists((n)=>n.arguments.slice(2).some((arg)=>arg === node)));
193
1261
  }
194
1262
  /**
195
1263
  * Check if a `JSXElement` or `JSXFragment` has children
@@ -197,7 +1265,7 @@ function isChildrenOfCreateElement(node, context) {
197
1265
  * @param predicate A predicate to filter the children
198
1266
  * @returns `true` if the node has children
199
1267
  */ function hasChildren(node, predicate) {
200
- if (Prd.isFunction(predicate)) return node.children.some(predicate);
1268
+ if (isFunction(predicate)) return node.children.some(predicate);
201
1269
  return node.children.length > 0;
202
1270
  }
203
1271
  /**
@@ -281,16 +1349,16 @@ const isFragment = (node, pragma, fragment)=>{
281
1349
  if (!node) return false;
282
1350
  return N(node).with({
283
1351
  type: NodeType.JSXElement
284
- }, F.constTrue).with({
1352
+ }, constTrue).with({
285
1353
  type: NodeType.JSXFragment
286
- }, F.constTrue).with({
1354
+ }, constTrue).with({
287
1355
  type: NodeType.JSXMemberExpression
288
- }, F.constTrue).with({
1356
+ }, constTrue).with({
289
1357
  type: NodeType.JSXNamespacedName
290
- }, F.constTrue).with({
1358
+ }, constTrue).with({
291
1359
  type: NodeType.Literal
292
1360
  }, (node)=>{
293
- return N(node.value).with(null, ()=>!(hint & JSXValueHint.SkipNullLiteral)).with(_.boolean, ()=>!(hint & JSXValueHint.SkipBooleanLiteral)).with(_.string, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with(_.number, ()=>!(hint & JSXValueHint.SkipNumberLiteral)).otherwise(F.constFalse);
1361
+ return N(node.value).with(null, ()=>!(hint & JSXValueHint.SkipNullLiteral)).with(_.boolean, ()=>!(hint & JSXValueHint.SkipBooleanLiteral)).with(_.string, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with(_.number, ()=>!(hint & JSXValueHint.SkipNumberLiteral)).otherwise(constFalse);
294
1362
  }).with({
295
1363
  type: NodeType.TemplateLiteral
296
1364
  }, ()=>!(hint & JSXValueHint.SkipStringLiteral)).with({
@@ -339,8 +1407,8 @@ const isFragment = (node, pragma, fragment)=>{
339
1407
  if (isJSXTagNameExpression(node)) return true;
340
1408
  const initialScope = context.sourceCode.getScope?.(node) ?? context.getScope();
341
1409
  const maybeVariable = findVariable(name, initialScope);
342
- return F.pipe(maybeVariable, O$1.flatMap(getVariableInit(0)), O$1.exists((n)=>isJSXValue(n, context, hint)));
343
- }).otherwise(F.constFalse);
1410
+ return pipe(maybeVariable, flatMap(getVariableInit(0)), exists((n)=>isJSXValue(n, context, hint)));
1411
+ }).otherwise(constFalse);
344
1412
  }
345
1413
 
346
1414
  /**
@@ -377,13 +1445,13 @@ function getProp(props, propName, context, initialScope) {
377
1445
  const initialScope = context.sourceCode.getScope?.(attribute) ?? context.getScope();
378
1446
  if (attribute.type === NodeType.JSXAttribute && "value" in attribute) {
379
1447
  const { value } = attribute;
380
- if (value === null) return O$1.none();
381
- if (value.type === NodeType.Literal) return O$1.some(getStaticValue(value, initialScope));
382
- if (value.type === NodeType.JSXExpressionContainer) return O$1.some(getStaticValue(value.expression, initialScope));
383
- return O$1.none();
1448
+ if (value === null) return none();
1449
+ if (value.type === NodeType.Literal) return some(getStaticValue(value, initialScope));
1450
+ if (value.type === NodeType.JSXExpressionContainer) return some(getStaticValue(value.expression, initialScope));
1451
+ return none();
384
1452
  }
385
1453
  const { argument } = attribute;
386
- return O$1.some(getStaticValue(argument, initialScope));
1454
+ return some(getStaticValue(argument, initialScope));
387
1455
  }
388
1456
  /**
389
1457
  * @param properties The properties to search in
@@ -397,32 +1465,32 @@ function getProp(props, propName, context, initialScope) {
397
1465
  * @param propName The name of the property to search for
398
1466
  * @returns The property if found
399
1467
  */ return (propName)=>{
400
- return O$1.fromNullable(properties.find((prop)=>{
1468
+ return fromNullable(properties.find((prop)=>{
401
1469
  return N(prop).when(is(NodeType.Property), (prop)=>{
402
1470
  return "name" in prop.key && prop.key.name === propName;
403
1471
  }).when(is(NodeType.SpreadElement), (prop)=>{
404
1472
  return N(prop.argument).when(is(NodeType.Identifier), (argument)=>{
405
1473
  const { name } = argument;
406
- const maybeInit = O$1.flatMap(findVariable(name, initialScope), getVariableInit(0));
407
- if (O$1.isNone(maybeInit)) return false;
1474
+ const maybeInit = flatMap(findVariable(name, initialScope), getVariableInit(0));
1475
+ if (isNone(maybeInit)) return false;
408
1476
  const init = maybeInit.value;
409
1477
  if (init.type !== NodeType.ObjectExpression) return false;
410
1478
  if (seenProps.includes(name)) return false;
411
- return O$1.isSome(findPropInProperties(init.properties, context, initialScope, [
1479
+ return isSome(findPropInProperties(init.properties, context, initialScope, [
412
1480
  ...seenProps,
413
1481
  name
414
1482
  ])(propName));
415
1483
  }).when(is(NodeType.ObjectExpression), (argument)=>{
416
- return O$1.isSome(findPropInProperties(argument.properties, context, initialScope, seenProps)(propName));
1484
+ return isSome(findPropInProperties(argument.properties, context, initialScope, seenProps)(propName));
417
1485
  }).when(is(NodeType.MemberExpression), ()=>{
418
1486
  // Not implemented
419
1487
  }).when(is(NodeType.CallExpression), ()=>{
420
1488
  // Not implemented
421
- }).otherwise(F.constFalse);
1489
+ }).otherwise(constFalse);
422
1490
  }).when(is(NodeType.RestElement), ()=>{
423
1491
  // Not implemented
424
1492
  return false;
425
- }).otherwise(F.constFalse);
1493
+ }).otherwise(constFalse);
426
1494
  }));
427
1495
  };
428
1496
  }
@@ -437,27 +1505,27 @@ function getProp(props, propName, context, initialScope) {
437
1505
  * @param propName The name of the property to search for
438
1506
  * @returns The property if found
439
1507
  */ return (propName)=>{
440
- return O$1.fromNullable(attributes.find((attr)=>{
1508
+ return fromNullable(attributes.find((attr)=>{
441
1509
  return N(attr).when(is(NodeType.JSXAttribute), (attr)=>getPropName(attr) === propName).when(is(NodeType.JSXSpreadAttribute), (attr)=>{
442
1510
  return N(attr.argument).with({
443
1511
  type: NodeType.Identifier
444
1512
  }, (argument)=>{
445
1513
  const { name } = argument;
446
- const maybeInit = O$1.flatMap(findVariable(name, initialScope), getVariableInit(0));
447
- if (O$1.isNone(maybeInit)) return false;
1514
+ const maybeInit = flatMap(findVariable(name, initialScope), getVariableInit(0));
1515
+ if (isNone(maybeInit)) return false;
448
1516
  const init = maybeInit.value;
449
1517
  if (!("properties" in init)) return false;
450
- return O$1.isSome(findPropInProperties(init.properties, context, initialScope)(propName));
1518
+ return isSome(findPropInProperties(init.properties, context, initialScope)(propName));
451
1519
  }).when(is(NodeType.ObjectExpression), (argument)=>{
452
- return O$1.isSome(findPropInProperties(argument.properties, context, initialScope)(propName));
1520
+ return isSome(findPropInProperties(argument.properties, context, initialScope)(propName));
453
1521
  }).when(is(NodeType.MemberExpression), ()=>{
454
1522
  // Not implemented
455
1523
  return false;
456
1524
  }).when(is(NodeType.CallExpression), ()=>{
457
1525
  // Not implemented
458
1526
  return false;
459
- }).otherwise(F.constFalse);
460
- }).otherwise(F.constFalse);
1527
+ }).otherwise(constFalse);
1528
+ }).otherwise(constFalse);
461
1529
  }));
462
1530
  };
463
1531
  }
@@ -470,7 +1538,7 @@ function getProp(props, propName, context, initialScope) {
470
1538
  * @param initialScope
471
1539
  * @returns `true` if the given prop name is present in the given properties
472
1540
  */ function hasProp(attributes, propName, context, initialScope) {
473
- return O$1.isSome(findPropInAttributes(attributes, context, initialScope)(propName));
1541
+ return isSome(findPropInAttributes(attributes, context, initialScope)(propName));
474
1542
  }
475
1543
  /**
476
1544
  * Check if any of the given prop names are present in the given attributes
@@ -498,7 +1566,7 @@ function getProp(props, propName, context, initialScope) {
498
1566
  * @param node The AST node to start traversing from
499
1567
  * @param predicate The predicate to check each node
500
1568
  * @returns prop node if found
501
- */ function traverseUpProp(node, predicate = F.constTrue) {
1569
+ */ function traverseUpProp(node, predicate = constTrue) {
502
1570
  const guard = (node)=>{
503
1571
  return node.type === NodeType.JSXAttribute && predicate(node);
504
1572
  };
@@ -511,7 +1579,7 @@ function getProp(props, propName, context, initialScope) {
511
1579
  * @returns `true` if the node is inside a prop's value
512
1580
  */ function isInsidePropValue(node) {
513
1581
  if (isStringLiteral(node)) return node.parent.type === NodeType.JSXAttribute;
514
- return O$1.isSome(traverseUpProp(node, (n)=>n.value?.type === NodeType.JSXExpressionContainer));
1582
+ return isSome(traverseUpProp(node, (n)=>n.value?.type === NodeType.JSXExpressionContainer));
515
1583
  }
516
1584
 
517
1585
  /**
@@ -527,7 +1595,7 @@ function getProp(props, propName, context, initialScope) {
527
1595
  * @param node The AST node to check
528
1596
  * @returns boolean `true` if the node is whitespace
529
1597
  */ function isWhiteSpace(node) {
530
- return Prd.isString(node.value) && node.value.trim() === "";
1598
+ return isString(node.value) && node.value.trim() === "";
531
1599
  }
532
1600
  /**
533
1601
  * Check if a Literal or JSXText node is a line break