react-state-custom 1.0.6 → 1.0.7

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.es.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var Ne = Object.defineProperty;
2
2
  var Ae = (e, t, r) => t in e ? Ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var Q = (e, t, r) => Ae(e, typeof t != "symbol" ? t + "" : t, r);
4
- import ke, { useMemo as z, useEffect as L, useState as U, useCallback as Me, Fragment as Ie } from "react";
5
- function $e(e) {
4
+ import ke, { useMemo as z, useEffect as L, useState as U, useCallback as Me, Fragment as $e } from "react";
5
+ function Ie(e) {
6
6
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
7
  }
8
8
  var Z = { exports: {} }, be;
@@ -20,14 +20,14 @@ function xe() {
20
20
  function u(s) {
21
21
  console && console.warn && console.warn(s);
22
22
  }
23
- var c = Number.isNaN || function(a) {
23
+ var f = Number.isNaN || function(a) {
24
24
  return a !== a;
25
25
  };
26
26
  function n() {
27
27
  n.init.call(this);
28
28
  }
29
29
  Z.exports = n, Z.exports.once = N, n.EventEmitter = n, n.prototype._events = void 0, n.prototype._eventsCount = 0, n.prototype._maxListeners = void 0;
30
- var f = 10;
30
+ var c = 10;
31
31
  function h(s) {
32
32
  if (typeof s != "function")
33
33
  throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof s);
@@ -35,17 +35,17 @@ function xe() {
35
35
  Object.defineProperty(n, "defaultMaxListeners", {
36
36
  enumerable: !0,
37
37
  get: function() {
38
- return f;
38
+ return c;
39
39
  },
40
40
  set: function(s) {
41
- if (typeof s != "number" || s < 0 || c(s))
41
+ if (typeof s != "number" || s < 0 || f(s))
42
42
  throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + s + ".");
43
- f = s;
43
+ c = s;
44
44
  }
45
45
  }), n.init = function() {
46
46
  (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
47
47
  }, n.prototype.setMaxListeners = function(a) {
48
- if (typeof a != "number" || a < 0 || c(a))
48
+ if (typeof a != "number" || a < 0 || f(a))
49
49
  throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + a + ".");
50
50
  return this._maxListeners = a, this;
51
51
  };
@@ -78,7 +78,7 @@ function xe() {
78
78
  t(H[l], this, o);
79
79
  return !0;
80
80
  };
81
- function m(s, a, o, l) {
81
+ function v(s, a, o, l) {
82
82
  var d, _, b;
83
83
  if (h(o), _ = s._events, _ === void 0 ? (_ = s._events = /* @__PURE__ */ Object.create(null), s._eventsCount = 0) : (_.newListener !== void 0 && (s.emit(
84
84
  "newListener",
@@ -94,9 +94,9 @@ function xe() {
94
94
  return s;
95
95
  }
96
96
  n.prototype.addListener = function(a, o) {
97
- return m(this, a, o, !1);
97
+ return v(this, a, o, !1);
98
98
  }, n.prototype.on = n.prototype.addListener, n.prototype.prependListener = function(a, o) {
99
- return m(this, a, o, !0);
99
+ return v(this, a, o, !0);
100
100
  };
101
101
  function g() {
102
102
  if (!this.fired)
@@ -199,13 +199,13 @@ function xe() {
199
199
  function _() {
200
200
  typeof s.removeListener == "function" && s.removeListener("error", d), o([].slice.call(arguments));
201
201
  }
202
- F(s, a, _, { once: !0 }), a !== "error" && x(s, d, { once: !0 });
202
+ D(s, a, _, { once: !0 }), a !== "error" && x(s, d, { once: !0 });
203
203
  });
204
204
  }
205
205
  function x(s, a, o) {
206
- typeof s.on == "function" && F(s, "error", a, o);
206
+ typeof s.on == "function" && D(s, "error", a, o);
207
207
  }
208
- function F(s, a, o, l) {
208
+ function D(s, a, o, l) {
209
209
  if (typeof s.on == "function")
210
210
  l.once ? s.once(a, o) : s.on(a, o);
211
211
  else if (typeof s.addEventListener == "function")
@@ -217,8 +217,8 @@ function xe() {
217
217
  }
218
218
  return Z.exports;
219
219
  }
220
- var Fe = xe();
221
- const De = /* @__PURE__ */ $e(Fe);
220
+ var De = xe();
221
+ const Fe = /* @__PURE__ */ Ie(De);
222
222
  var We = typeof global == "object" && global && global.Object === Object && global, ze = typeof self == "object" && self && self.Object === Object && self, re = We || ze || Function("return this")(), te = re.Symbol, Re = Object.prototype, Ye = Re.hasOwnProperty, Ge = Re.toString, q = te ? te.toStringTag : void 0;
223
223
  function Ue(e) {
224
224
  var t = Ye.call(e, q), r = e[q];
@@ -227,8 +227,8 @@ function Ue(e) {
227
227
  var u = !0;
228
228
  } catch {
229
229
  }
230
- var c = Ge.call(e);
231
- return u && (t ? e[q] = r : delete e[q]), c;
230
+ var f = Ge.call(e);
231
+ return u && (t ? e[q] = r : delete e[q]), f;
232
232
  }
233
233
  var Ve = Object.prototype, He = Ve.toString;
234
234
  function qe(e) {
@@ -344,23 +344,23 @@ function Mt(e) {
344
344
  var t = this.__data__;
345
345
  return K ? t[e] !== void 0 : kt.call(t, e);
346
346
  }
347
- var It = "__lodash_hash_undefined__";
348
- function $t(e, t) {
347
+ var $t = "__lodash_hash_undefined__";
348
+ function It(e, t) {
349
349
  var r = this.__data__;
350
- return this.size += this.has(e) ? 0 : 1, r[e] = K && t === void 0 ? It : t, this;
350
+ return this.size += this.has(e) ? 0 : 1, r[e] = K && t === void 0 ? $t : t, this;
351
351
  }
352
- function I(e) {
352
+ function $(e) {
353
353
  var t = -1, r = e == null ? 0 : e.length;
354
354
  for (this.clear(); ++t < r; ) {
355
355
  var u = e[t];
356
356
  this.set(u[0], u[1]);
357
357
  }
358
358
  }
359
- I.prototype.clear = St;
360
- I.prototype.delete = jt;
361
- I.prototype.get = Nt;
362
- I.prototype.has = Mt;
363
- I.prototype.set = $t;
359
+ $.prototype.clear = St;
360
+ $.prototype.delete = jt;
361
+ $.prototype.get = Nt;
362
+ $.prototype.has = Mt;
363
+ $.prototype.set = It;
364
364
  function xt() {
365
365
  this.__data__ = [], this.size = 0;
366
366
  }
@@ -370,13 +370,13 @@ function ne(e, t) {
370
370
  return r;
371
371
  return -1;
372
372
  }
373
- var Ft = Array.prototype, Dt = Ft.splice;
373
+ var Dt = Array.prototype, Ft = Dt.splice;
374
374
  function Wt(e) {
375
375
  var t = this.__data__, r = ne(t, e);
376
376
  if (r < 0)
377
377
  return !1;
378
378
  var u = t.length - 1;
379
- return r == u ? t.pop() : Dt.call(t, r, 1), --this.size, !0;
379
+ return r == u ? t.pop() : Ft.call(t, r, 1), --this.size, !0;
380
380
  }
381
381
  function zt(e) {
382
382
  var t = this.__data__, r = ne(t, e);
@@ -404,9 +404,9 @@ V.prototype.set = Gt;
404
404
  var Ut = je(re, "Map");
405
405
  function Vt() {
406
406
  this.size = 0, this.__data__ = {
407
- hash: new I(),
407
+ hash: new $(),
408
408
  map: new (Ut || V)(),
409
- string: new I()
409
+ string: new $()
410
410
  };
411
411
  }
412
412
  function Ht(e) {
@@ -431,53 +431,53 @@ function Kt(e, t) {
431
431
  var r = oe(this, e), u = r.size;
432
432
  return r.set(e, t), this.size += r.size == u ? 0 : 1, this;
433
433
  }
434
- function $(e) {
434
+ function I(e) {
435
435
  var t = -1, r = e == null ? 0 : e.length;
436
436
  for (this.clear(); ++t < r; ) {
437
437
  var u = e[t];
438
438
  this.set(u[0], u[1]);
439
439
  }
440
440
  }
441
- $.prototype.clear = Vt;
442
- $.prototype.delete = qt;
443
- $.prototype.get = Jt;
444
- $.prototype.has = Xt;
445
- $.prototype.set = Kt;
441
+ I.prototype.clear = Vt;
442
+ I.prototype.delete = qt;
443
+ I.prototype.get = Jt;
444
+ I.prototype.has = Xt;
445
+ I.prototype.set = Kt;
446
446
  var Bt = "Expected a function";
447
447
  function fe(e, t) {
448
448
  if (typeof e != "function" || t != null && typeof t != "function")
449
449
  throw new TypeError(Bt);
450
450
  var r = function() {
451
- var u = arguments, c = t ? t.apply(this, u) : u[0], n = r.cache;
452
- if (n.has(c))
453
- return n.get(c);
454
- var f = e.apply(this, u);
455
- return r.cache = n.set(c, f) || n, f;
451
+ var u = arguments, f = t ? t.apply(this, u) : u[0], n = r.cache;
452
+ if (n.has(f))
453
+ return n.get(f);
454
+ var c = e.apply(this, u);
455
+ return r.cache = n.set(f, c) || n, c;
456
456
  };
457
- return r.cache = new (fe.Cache || $)(), r;
457
+ return r.cache = new (fe.Cache || I)(), r;
458
458
  }
459
- fe.Cache = $;
459
+ fe.Cache = I;
460
460
  var le = function() {
461
461
  return re.Date.now();
462
462
  }, Qt = "Expected a function", Zt = Math.max, er = Math.min;
463
463
  function ae(e, t, r) {
464
- var u, c, n, f, h, p, m = 0, g = !1, y = !1, T = !0;
464
+ var u, f, n, c, h, p, v = 0, g = !1, y = !1, T = !0;
465
465
  if (typeof e != "function")
466
466
  throw new TypeError(Qt);
467
467
  t = Ee(t) || 0, G(r) && (g = !!r.leading, y = "maxWait" in r, n = y ? Zt(Ee(r.maxWait) || 0, t) : n, T = "trailing" in r ? !!r.trailing : T);
468
468
  function C(o) {
469
- var l = u, d = c;
470
- return u = c = void 0, m = o, f = e.apply(d, l), f;
469
+ var l = u, d = f;
470
+ return u = f = void 0, v = o, c = e.apply(d, l), c;
471
471
  }
472
472
  function M(o) {
473
- return m = o, h = setTimeout(N, t), g ? C(o) : f;
473
+ return v = o, h = setTimeout(N, t), g ? C(o) : c;
474
474
  }
475
475
  function E(o) {
476
- var l = o - p, d = o - m, _ = t - l;
476
+ var l = o - p, d = o - v, _ = t - l;
477
477
  return y ? er(_, n - d) : _;
478
478
  }
479
479
  function O(o) {
480
- var l = o - p, d = o - m;
480
+ var l = o - p, d = o - v;
481
481
  return p === void 0 || l >= t || l < 0 || y && d >= n;
482
482
  }
483
483
  function N() {
@@ -487,35 +487,35 @@ function ae(e, t, r) {
487
487
  h = setTimeout(N, E(o));
488
488
  }
489
489
  function x(o) {
490
- return h = void 0, T && u ? C(o) : (u = c = void 0, f);
490
+ return h = void 0, T && u ? C(o) : (u = f = void 0, c);
491
491
  }
492
- function F() {
493
- h !== void 0 && clearTimeout(h), m = 0, u = p = c = h = void 0;
492
+ function D() {
493
+ h !== void 0 && clearTimeout(h), v = 0, u = p = f = h = void 0;
494
494
  }
495
495
  function s() {
496
- return h === void 0 ? f : x(le());
496
+ return h === void 0 ? c : x(le());
497
497
  }
498
498
  function a() {
499
499
  var o = le(), l = O(o);
500
- if (u = arguments, c = this, p = o, l) {
500
+ if (u = arguments, f = this, p = o, l) {
501
501
  if (h === void 0)
502
502
  return M(p);
503
503
  if (y)
504
504
  return clearTimeout(h), h = setTimeout(N, t), C(p);
505
505
  }
506
- return h === void 0 && (h = setTimeout(N, t)), f;
506
+ return h === void 0 && (h = setTimeout(N, t)), c;
507
507
  }
508
- return a.cancel = F, a.flush = s, a;
508
+ return a.cancel = D, a.flush = s, a;
509
509
  }
510
510
  var tr = "Expected a function";
511
511
  function rr(e, t, r) {
512
- var u = !0, c = !0;
512
+ var u = !0, f = !0;
513
513
  if (typeof e != "function")
514
514
  throw new TypeError(tr);
515
- return G(r) && (u = "leading" in r ? !!r.leading : u, c = "trailing" in r ? !!r.trailing : c), ae(e, t, {
515
+ return G(r) && (u = "leading" in r ? !!r.leading : u, f = "trailing" in r ? !!r.trailing : f), ae(e, t, {
516
516
  leading: u,
517
517
  maxWait: t,
518
- trailing: c
518
+ trailing: f
519
519
  });
520
520
  }
521
521
  class nr {
@@ -524,7 +524,7 @@ class nr {
524
524
  * @param name - The name of the context (for debugging).
525
525
  */
526
526
  constructor(t) {
527
- Q(this, "event", new De.EventEmitter());
527
+ Q(this, "event", new Fe.EventEmitter());
528
528
  /**
529
529
  * The current data held by the context.
530
530
  */
@@ -550,8 +550,8 @@ class nr {
550
550
  * @returns Unsubscribe function.
551
551
  */
552
552
  subscribe(t, r) {
553
- const u = ({ value: c }) => {
554
- r(c);
553
+ const u = ({ value: f }) => {
554
+ r(f);
555
555
  };
556
556
  return this.event.addListener(String(t), u), console.log("listenerCount:", String(t), this.event.listenerCount(String(t))), t in this.data && r(this.data[t]), () => (this.event.removeListener(String(t), u), void 0);
557
557
  }
@@ -572,32 +572,32 @@ const or = fe((e) => new nr(e)), Y = (e = "noname") => z(() => or(e), [e]), Ce =
572
572
  e && e.data[t] != r && e.publish(t, r);
573
573
  }, [t, r, e]), Ce(e, t);
574
574
  }, ar = (e, t, r = 0) => {
575
- const [{ value: u }, c] = U(() => {
575
+ const [{ value: u }, f] = U(() => {
576
576
  var n;
577
577
  return { value: (n = e == null ? void 0 : e.data) == null ? void 0 : n[t] };
578
578
  });
579
579
  return L(() => {
580
580
  if (e) {
581
- let n = r == 0 ? (h) => c({ value: h }) : ae((h) => c({ value: h }), r), f = e.subscribe(t, n);
582
- return u != e.data[t] && c({ value: e.data[t] }), () => {
583
- f();
581
+ let n = r == 0 ? (h) => f({ value: h }) : ae((h) => f({ value: h }), r), c = e.subscribe(t, n);
582
+ return u != e.data[t] && f({ value: e.data[t] }), () => {
583
+ c();
584
584
  };
585
585
  }
586
586
  }, [t, e]), e == null ? void 0 : e.data[t];
587
587
  }, pr = (e, t, r) => {
588
- const [, u] = U(0), c = z(
588
+ const [, u] = U(0), f = z(
589
589
  () => r(e == null ? void 0 : e.data[t]),
590
590
  [r, e == null ? void 0 : e.data[t]]
591
591
  );
592
592
  return L(() => {
593
593
  if (e) {
594
- let n = c, f = () => {
594
+ let n = f, c = () => {
595
595
  let p = r(e.data[t]);
596
- p != n && (n = p, u((m) => m + 1));
597
- }, h = e.subscribe(t, f);
598
- return f(), () => h();
596
+ p != n && (n = p, u((v) => v + 1));
597
+ }, h = e.subscribe(t, c);
598
+ return c(), () => h();
599
599
  }
600
- }, [t, e]), c;
600
+ }, [t, e]), f;
601
601
  }, Le = (e, ...t) => {
602
602
  L(() => {
603
603
  if (e)
@@ -605,47 +605,47 @@ const or = fe((e) => new nr(e)), Y = (e = "noname") => z(() => or(e), [e]), Ce =
605
605
  e.data[r] != u && e.publish(r, u);
606
606
  }, [e, ...t.flat()]), Ce(e, ...t.map((r) => r[0]));
607
607
  }, vr = (e, ...t) => {
608
- const [, r] = U(0), u = t.map((c) => {
608
+ const [, r] = U(0), u = t.map((f) => {
609
609
  var n;
610
- return (n = e == null ? void 0 : e.data) == null ? void 0 : n[c];
610
+ return (n = e == null ? void 0 : e.data) == null ? void 0 : n[f];
611
611
  });
612
612
  return L(() => {
613
613
  if (e) {
614
- let c = u;
614
+ let f = u;
615
615
  const n = ae(() => {
616
- let p = t.map((m) => {
616
+ let p = t.map((v) => {
617
617
  var g;
618
- return (g = e == null ? void 0 : e.data) == null ? void 0 : g[m];
618
+ return (g = e == null ? void 0 : e.data) == null ? void 0 : g[v];
619
619
  });
620
- t.some((m, g) => c[g] != p[g]) && (c = p, r((m) => m + 1));
620
+ t.some((v, g) => f[g] != p[g]) && (f = p, r((v) => v + 1));
621
621
  }, 1);
622
- let f = t.map((p) => e.subscribe(p, n)), h = setTimeout(n, 1);
622
+ let c = t.map((p) => e.subscribe(p, n)), h = setTimeout(n, 1);
623
623
  return () => {
624
- clearTimeout(h), n.cancel(), f.forEach((p) => p());
624
+ clearTimeout(h), n.cancel(), c.forEach((p) => p());
625
625
  };
626
626
  }
627
- }, [e, ...t]), Object.fromEntries(t.map((c, n) => [c, u[n]]));
627
+ }, [e, ...t]), Object.fromEntries(t.map((f, n) => [f, u[n]]));
628
628
  }, mr = (e, t = 100, ...r) => {
629
- const [, u] = U(0), c = r.map((n) => {
630
- var f;
631
- return (f = e == null ? void 0 : e.data) == null ? void 0 : f[n];
629
+ const [, u] = U(0), f = r.map((n) => {
630
+ var c;
631
+ return (c = e == null ? void 0 : e.data) == null ? void 0 : c[n];
632
632
  });
633
633
  return L(() => {
634
634
  if (e) {
635
- let n = c;
636
- const f = rr(() => {
637
- let m = r.map((g) => {
635
+ let n = f;
636
+ const c = rr(() => {
637
+ let v = r.map((g) => {
638
638
  var y;
639
639
  return (y = e == null ? void 0 : e.data) == null ? void 0 : y[g];
640
640
  });
641
- r.some((g, y) => n[y] != m[y]) && (n = m, u((g) => g + 1));
641
+ r.some((g, y) => n[y] != v[y]) && (n = v, u((g) => g + 1));
642
642
  }, t);
643
- let h = r.map((m) => e.subscribe(m, f)), p = setTimeout(f, 1);
643
+ let h = r.map((v) => e.subscribe(v, c)), p = setTimeout(c, 1);
644
644
  return () => {
645
- clearTimeout(p), f.cancel(), h.forEach((m) => m());
645
+ clearTimeout(p), c.cancel(), h.forEach((v) => v());
646
646
  };
647
647
  }
648
- }, [e, ...r]), c;
648
+ }, [e, ...r]), f;
649
649
  };
650
650
  var ee = { exports: {} }, J = {};
651
651
  /**
@@ -662,18 +662,18 @@ function ir() {
662
662
  if (we) return J;
663
663
  we = 1;
664
664
  var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
665
- function r(u, c, n) {
666
- var f = null;
667
- if (n !== void 0 && (f = "" + n), c.key !== void 0 && (f = "" + c.key), "key" in c) {
665
+ function r(u, f, n) {
666
+ var c = null;
667
+ if (n !== void 0 && (c = "" + n), f.key !== void 0 && (c = "" + f.key), "key" in f) {
668
668
  n = {};
669
- for (var h in c)
670
- h !== "key" && (n[h] = c[h]);
671
- } else n = c;
672
- return c = n.ref, {
669
+ for (var h in f)
670
+ h !== "key" && (n[h] = f[h]);
671
+ } else n = f;
672
+ return f = n.ref, {
673
673
  $$typeof: e,
674
674
  type: u,
675
- key: f,
676
- ref: c !== void 0 ? c : null,
675
+ key: c,
676
+ ref: f !== void 0 ? f : null,
677
677
  props: n
678
678
  };
679
679
  }
@@ -717,19 +717,19 @@ function sr() {
717
717
  ), i.$$typeof) {
718
718
  case M:
719
719
  return "Portal";
720
- case F:
720
+ case D:
721
721
  return (i.displayName || "Context") + ".Provider";
722
722
  case x:
723
723
  return (i._context.displayName || "Context") + ".Consumer";
724
724
  case s:
725
- var v = i.render;
726
- return i = i.displayName, i || (i = v.displayName || v.name || "", i = i !== "" ? "ForwardRef(" + i + ")" : "ForwardRef"), i;
725
+ var m = i.render;
726
+ return i = i.displayName, i || (i = m.displayName || m.name || "", i = i !== "" ? "ForwardRef(" + i + ")" : "ForwardRef"), i;
727
727
  case l:
728
- return v = i.displayName || null, v !== null ? v : e(i.type) || "Memo";
728
+ return m = i.displayName || null, m !== null ? m : e(i.type) || "Memo";
729
729
  case d:
730
- v = i._payload, i = i._init;
730
+ m = i._payload, i = i._init;
731
731
  try {
732
- return e(i(v));
732
+ return e(i(m));
733
733
  } catch {
734
734
  }
735
735
  }
@@ -741,15 +741,15 @@ function sr() {
741
741
  function r(i) {
742
742
  try {
743
743
  t(i);
744
- var v = !1;
744
+ var m = !1;
745
745
  } catch {
746
- v = !0;
746
+ m = !0;
747
747
  }
748
- if (v) {
749
- v = console;
750
- var w = v.error, R = typeof Symbol == "function" && Symbol.toStringTag && i[Symbol.toStringTag] || i.constructor.name || "Object";
748
+ if (m) {
749
+ m = console;
750
+ var w = m.error, R = typeof Symbol == "function" && Symbol.toStringTag && i[Symbol.toStringTag] || i.constructor.name || "Object";
751
751
  return w.call(
752
- v,
752
+ m,
753
753
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
754
754
  R
755
755
  ), t(i);
@@ -760,31 +760,31 @@ function sr() {
760
760
  if (typeof i == "object" && i !== null && i.$$typeof === d)
761
761
  return "<...>";
762
762
  try {
763
- var v = e(i);
764
- return v ? "<" + v + ">" : "<...>";
763
+ var m = e(i);
764
+ return m ? "<" + m + ">" : "<...>";
765
765
  } catch {
766
766
  return "<...>";
767
767
  }
768
768
  }
769
- function c() {
769
+ function f() {
770
770
  var i = j.A;
771
771
  return i === null ? null : i.getOwner();
772
772
  }
773
773
  function n() {
774
774
  return Error("react-stack-top-frame");
775
775
  }
776
- function f(i) {
776
+ function c(i) {
777
777
  if (A.call(i, "key")) {
778
- var v = Object.getOwnPropertyDescriptor(i, "key").get;
779
- if (v && v.isReactWarning) return !1;
778
+ var m = Object.getOwnPropertyDescriptor(i, "key").get;
779
+ if (m && m.isReactWarning) return !1;
780
780
  }
781
781
  return i.key !== void 0;
782
782
  }
783
- function h(i, v) {
783
+ function h(i, m) {
784
784
  function w() {
785
785
  de || (de = !0, console.error(
786
786
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
787
- v
787
+ m
788
788
  ));
789
789
  }
790
790
  w.isReactWarning = !0, Object.defineProperty(i, "key", {
@@ -798,11 +798,11 @@ function sr() {
798
798
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
799
799
  )), i = this.props.ref, i !== void 0 ? i : null;
800
800
  }
801
- function m(i, v, w, R, k, P, ie, se) {
801
+ function v(i, m, w, R, k, P, ie, se) {
802
802
  return w = P.ref, i = {
803
803
  $$typeof: C,
804
804
  type: i,
805
- key: v,
805
+ key: m,
806
806
  props: P,
807
807
  _owner: k
808
808
  }, (w !== void 0 ? w : null) !== null ? Object.defineProperty(i, "ref", {
@@ -830,8 +830,8 @@ function sr() {
830
830
  value: se
831
831
  }), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
832
832
  }
833
- function g(i, v, w, R, k, P, ie, se) {
834
- var S = v.children;
833
+ function g(i, m, w, R, k, P, ie, se) {
834
+ var S = m.children;
835
835
  if (S !== void 0)
836
836
  if (R)
837
837
  if (B(S)) {
@@ -843,12 +843,12 @@ function sr() {
843
843
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
844
844
  );
845
845
  else y(S);
846
- if (A.call(v, "key")) {
846
+ if (A.call(m, "key")) {
847
847
  S = e(i);
848
- var D = Object.keys(v).filter(function(Pe) {
848
+ var F = Object.keys(m).filter(function(Pe) {
849
849
  return Pe !== "key";
850
850
  });
851
- R = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", me[S + R] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
851
+ R = 0 < F.length ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}", me[S + R] || (F = 0 < F.length ? "{" + F.join(": ..., ") + ": ...}" : "{}", console.error(
852
852
  `A props object containing a "key" prop is being spread into JSX:
853
853
  let props = %s;
854
854
  <%s {...props} />
@@ -857,24 +857,24 @@ React keys must be passed directly to JSX without using spread:
857
857
  <%s key={someKey} {...props} />`,
858
858
  R,
859
859
  S,
860
- D,
860
+ F,
861
861
  S
862
862
  ), me[S + R] = !0);
863
863
  }
864
- if (S = null, w !== void 0 && (r(w), S = "" + w), f(v) && (r(v.key), S = "" + v.key), "key" in v) {
864
+ if (S = null, w !== void 0 && (r(w), S = "" + w), c(m) && (r(m.key), S = "" + m.key), "key" in m) {
865
865
  w = {};
866
- for (var ue in v)
867
- ue !== "key" && (w[ue] = v[ue]);
868
- } else w = v;
866
+ for (var ue in m)
867
+ ue !== "key" && (w[ue] = m[ue]);
868
+ } else w = m;
869
869
  return S && h(
870
870
  w,
871
871
  typeof i == "function" ? i.displayName || i.name || "Unknown" : i
872
- ), m(
872
+ ), v(
873
873
  i,
874
874
  S,
875
875
  P,
876
876
  k,
877
- c(),
877
+ f(),
878
878
  w,
879
879
  ie,
880
880
  se
@@ -883,7 +883,7 @@ React keys must be passed directly to JSX without using spread:
883
883
  function y(i) {
884
884
  typeof i == "object" && i !== null && i.$$typeof === C && i._store && (i._store.validated = 1);
885
885
  }
886
- var T = ke, C = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), F = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), a = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), b = Symbol.for("react.client.reference"), j = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, B = Array.isArray, H = console.createTask ? console.createTask : function() {
886
+ var T = ke, C = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), D = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), a = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), b = Symbol.for("react.client.reference"), j = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, B = Array.isArray, H = console.createTask ? console.createTask : function() {
887
887
  return null;
888
888
  };
889
889
  T = {
@@ -895,11 +895,11 @@ React keys must be passed directly to JSX without using spread:
895
895
  T,
896
896
  n
897
897
  )(), ve = H(u(n)), me = {};
898
- X.Fragment = E, X.jsx = function(i, v, w, R, k) {
898
+ X.Fragment = E, X.jsx = function(i, m, w, R, k) {
899
899
  var P = 1e4 > j.recentlyCreatedOwnerStacks++;
900
900
  return g(
901
901
  i,
902
- v,
902
+ m,
903
903
  w,
904
904
  !1,
905
905
  R,
@@ -907,11 +907,11 @@ React keys must be passed directly to JSX without using spread:
907
907
  P ? Error("react-stack-top-frame") : pe,
908
908
  P ? H(u(i)) : ve
909
909
  );
910
- }, X.jsxs = function(i, v, w, R, k) {
910
+ }, X.jsxs = function(i, m, w, R, k) {
911
911
  var P = 1e4 > j.recentlyCreatedOwnerStacks++;
912
912
  return g(
913
913
  i,
914
- v,
914
+ m,
915
915
  w,
916
916
  !0,
917
917
  R,
@@ -928,47 +928,48 @@ function ur() {
928
928
  }
929
929
  var W = ur();
930
930
  const br = (e, t) => {
931
- const r = (c) => [
931
+ const r = (n) => [
932
932
  e,
933
- ...Object.entries(c ?? {}).sort((n, f) => n[0].localeCompare(f[0])).flat()
933
+ ...Object.entries(n ?? {}).sort((c, h) => c[0].localeCompare(h[0])).flat()
934
934
  ].join("-");
935
935
  let u = /* @__PURE__ */ new Set();
936
- return {
936
+ const f = (n) => {
937
+ const c = r(n), h = Y(c), p = t(n), v = z(() => new Error().stack, []);
938
+ return Le(
939
+ h,
940
+ ...Object.entries(p)
941
+ ), L(() => {
942
+ if (u.has(c)) {
943
+ const g = new Error("RootContext " + c + " are mounted more than once");
944
+ throw g.stack = v, g;
945
+ }
946
+ return u.add(c), () => {
947
+ u.delete(c);
948
+ };
949
+ }), /* @__PURE__ */ W.jsx(W.Fragment, {});
950
+ };
951
+ return f.displayName = `State[${(t == null ? void 0 : t.name) ?? "??"}]`, {
937
952
  resolveCtxName: r,
938
- Root: (c) => {
939
- const n = r(c), f = Y(n), h = t(c), p = z(() => new Error().stack, []);
940
- return Le(
941
- f,
942
- ...Object.entries(h)
943
- ), L(() => {
944
- if (u.has(n)) {
945
- const m = new Error("RootContext " + n + " are mounted more than once");
946
- throw m.stack = p, m;
947
- }
948
- return u.add(n), () => {
949
- u.delete(n);
950
- };
951
- }), /* @__PURE__ */ W.jsx(W.Fragment, {});
952
- },
953
- useCtxStateStrict: (c) => {
954
- const n = r(c), f = z(() => new Error().stack, []);
953
+ Root: f,
954
+ useCtxStateStrict: (n) => {
955
+ const c = r(n), h = z(() => new Error().stack, []);
955
956
  return L(() => {
956
- if (!u.has(n)) {
957
- const h = new Error("RootContext [" + n + "] is not mounted");
958
- throw h.stack = f, h;
957
+ if (!u.has(c)) {
958
+ const p = new Error("RootContext [" + c + "] is not mounted");
959
+ throw p.stack = h, p;
959
960
  }
960
- }, [n]), Y(n);
961
+ }, [c]), Y(c);
961
962
  },
962
- useCtxState: (c) => {
963
- const n = r(c), f = z(() => new Error().stack, []);
963
+ useCtxState: (n) => {
964
+ const c = r(n), h = z(() => new Error().stack, []);
964
965
  return L(() => {
965
- if (!u.has(n)) {
966
- const h = new Error("RootContext [" + n + "] is not mounted");
967
- h.stack = f;
968
- let p = setTimeout(() => console.error(h), 1e3);
969
- return () => clearTimeout(p);
966
+ if (!u.has(c)) {
967
+ const p = new Error("RootContext [" + c + "] is not mounted");
968
+ p.stack = h;
969
+ let v = setTimeout(() => console.error(p), 1e3);
970
+ return () => clearTimeout(v);
970
971
  }
971
- }, [u.has(n)]), Y(n);
972
+ }, [u.has(c)]), Y(c);
972
973
  }
973
974
  };
974
975
  }, cr = /* @__PURE__ */ function() {
@@ -979,15 +980,15 @@ const br = (e, t) => {
979
980
  };
980
981
  }(), lr = (e) => [
981
982
  ...Object.entries(e ?? {}).sort((t, r) => t[0].localeCompare(r[0])).flat()
982
- ].join("-"), gr = ({ Wrapper: e = Ie }) => {
983
- const t = Y("auto-ctx"), [r, u] = U({}), c = Me(
984
- (n, f) => {
985
- const h = cr(n), p = lr(f);
983
+ ].join("-"), gr = ({ Wrapper: e = $e }) => {
984
+ const t = Y("auto-ctx"), [r, u] = U({}), f = Me(
985
+ (n, c) => {
986
+ const h = cr(n), p = lr(c);
986
987
  return u(({
987
988
  [h]: {
988
- Component: m = n,
989
+ Component: v = n,
989
990
  subState: {
990
- [p]: g = { params: f, counter: 0 },
991
+ [p]: g = { params: c, counter: 0 },
991
992
  ...y
992
993
  } = {}
993
994
  } = {},
@@ -995,7 +996,7 @@ const br = (e, t) => {
995
996
  }) => ({
996
997
  ...T,
997
998
  [h]: {
998
- Component: m,
999
+ Component: v,
999
1000
  subState: {
1000
1001
  ...y,
1001
1002
  [p]: {
@@ -1006,9 +1007,9 @@ const br = (e, t) => {
1006
1007
  }
1007
1008
  })), () => u(({
1008
1009
  [h]: {
1009
- Component: m = n,
1010
+ Component: v = n,
1010
1011
  subState: {
1011
- [p]: g = { params: f, counter: 0 },
1012
+ [p]: g = { params: c, counter: 0 },
1012
1013
  ...y
1013
1014
  } = {}
1014
1015
  } = {},
@@ -1016,7 +1017,7 @@ const br = (e, t) => {
1016
1017
  }) => ({
1017
1018
  ...T,
1018
1019
  [h]: {
1019
- Component: m,
1020
+ Component: v,
1020
1021
  subState: {
1021
1022
  ...y,
1022
1023
  ...g.counter > 1 ? {
@@ -1033,51 +1034,51 @@ const br = (e, t) => {
1033
1034
  );
1034
1035
  return Le(
1035
1036
  t,
1036
- ["subscribe", c],
1037
+ ["subscribe", f],
1037
1038
  ["state", r]
1038
1039
  ), /* @__PURE__ */ W.jsx(W.Fragment, { children: Object.entries(r).flatMap(
1039
- ([n, { Component: f, subState: h }]) => Object.entries(h).map(([p, { counter: m, params: g }]) => ({ key: n + p, Component: f, params: g, counter: m })).filter((p) => p.counter > 0).map(({ key: p, params: m, Component: g }) => /* @__PURE__ */ W.jsx(e, { children: /* @__PURE__ */ W.jsx(g, { ...m }) }, p))
1040
+ ([n, { Component: c, subState: h }]) => Object.entries(h).map(([p, { counter: v, params: g }]) => ({ key: n + p, Component: c, params: g, counter: v })).filter((p) => p.counter > 0).map(({ key: p, params: v, Component: g }) => /* @__PURE__ */ W.jsx(e, { children: /* @__PURE__ */ W.jsx(g, { ...v }) }, p))
1040
1041
  ) });
1041
1042
  }, _r = ({ Root: e, useCtxState: t, useCtxStateStrict: r, resolveCtxName: u }) => ({
1042
- useCtxState: (c) => {
1043
- const n = u(c), f = ar(Y("auto-ctx"), "subscribe");
1044
- return L(() => f == null ? void 0 : f(e, c), [f, n]), Y(n);
1043
+ useCtxState: (f) => {
1044
+ const n = u(f), c = ar(Y("auto-ctx"), "subscribe");
1045
+ return L(() => c == null ? void 0 : c(e, f), [c, n]), Y(n);
1045
1046
  }
1046
1047
  }), Er = (e) => {
1047
- const [, t] = U(0), { proxy: r, finalGetter: u, openGetter: c, clean: n } = z(
1048
+ const [, t] = U(0), { proxy: r, finalGetter: u, openGetter: f, clean: n } = z(
1048
1049
  () => {
1049
- const f = /* @__PURE__ */ new Set(), h = {}, p = /* @__PURE__ */ new Map(), m = new Proxy(
1050
+ const c = /* @__PURE__ */ new Set(), h = {}, p = /* @__PURE__ */ new Map(), v = new Proxy(
1050
1051
  e == null ? void 0 : e.data,
1051
1052
  {
1052
1053
  get(E, O) {
1053
1054
  if (g)
1054
- return f.add(O), h[O] = E[O];
1055
+ return c.add(O), h[O] = E[O];
1055
1056
  throw new Error("now allow here");
1056
1057
  }
1057
1058
  }
1058
1059
  );
1059
1060
  let g = !0, y = ae(() => {
1060
- [...f.values()].some((E) => {
1061
+ [...c.values()].some((E) => {
1061
1062
  var O;
1062
1063
  return h[E] != ((O = e == null ? void 0 : e.data) == null ? void 0 : O[E]);
1063
1064
  }) && t((E) => E + 1);
1064
1065
  }, 0), T = () => {
1065
- g = !0, f.clear();
1066
+ g = !0, c.clear();
1066
1067
  }, C = () => {
1067
- g = !1, [...f.values()].filter((E) => !p.has(E)).forEach((E) => {
1068
+ g = !1, [...c.values()].filter((E) => !p.has(E)).forEach((E) => {
1068
1069
  p.set(E, e == null ? void 0 : e.subscribe(E, y));
1069
- }), [...p.keys()].filter((E) => !f.has(E)).forEach((E) => {
1070
+ }), [...p.keys()].filter((E) => !c.has(E)).forEach((E) => {
1070
1071
  let O = p.get(E);
1071
1072
  O == null || O(), p.delete(E);
1072
1073
  });
1073
1074
  };
1074
- return { proxy: m, finalGetter: C, openGetter: T, clean: () => {
1075
+ return { proxy: v, finalGetter: C, openGetter: T, clean: () => {
1075
1076
  T(), C(), t((E) => E + 1);
1076
1077
  } };
1077
1078
  },
1078
1079
  [e]
1079
1080
  );
1080
- return c(), setTimeout(u, 0), L(
1081
+ return f(), setTimeout(u, 0), L(
1081
1082
  () => () => n(),
1082
1083
  [n]
1083
1084
  ), r;
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(T,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],v):(T=typeof globalThis<"u"?globalThis:T||self,v(T.RState={},T.React))})(this,function(T,v){"use strict";var pn=Object.defineProperty;var vn=(T,v,W)=>v in T?pn(T,v,{enumerable:!0,configurable:!0,writable:!0,value:W}):T[v]=W;var ae=(T,v,W)=>vn(T,typeof v!="symbol"?v+"":v,W);function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={exports:{}},he;function Me(){if(he)return Z.exports;he=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(a,o,f){return Function.prototype.apply.call(a,o,f)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:n=function(a){return Object.getOwnPropertyNames(a)};function u(i){console&&console.warn&&console.warn(i)}var c=Number.isNaN||function(a){return a!==a};function r(){r.init.call(this)}Z.exports=r,Z.exports.once=A,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var l=10;function h(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(i){if(typeof i!="number"||i<0||c(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");l=i}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(a){if(typeof a!="number"||a<0||c(a))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+a+".");return this._maxListeners=a,this};function p(i){return i._maxListeners===void 0?r.defaultMaxListeners:i._maxListeners}r.prototype.getMaxListeners=function(){return p(this)},r.prototype.emit=function(a){for(var o=[],f=1;f<arguments.length;f++)o.push(arguments[f]);var d=a==="error",E=this._events;if(E!==void 0)d=d&&E.error===void 0;else if(!d)return!1;if(d){var g;if(o.length>0&&(g=o[0]),g instanceof Error)throw g;var L=new Error("Unhandled error."+(g?" ("+g.message+")":""));throw L.context=g,L}var M=E[a];if(M===void 0)return!1;if(typeof M=="function")t(M,this,o);else for(var oe=M.length,Q=x(M,oe),f=0;f<oe;++f)t(Q[f],this,o);return!0};function b(i,a,o,f){var d,E,g;if(h(o),E=i._events,E===void 0?(E=i._events=Object.create(null),i._eventsCount=0):(E.newListener!==void 0&&(i.emit("newListener",a,o.listener?o.listener:o),E=i._events),g=E[a]),g===void 0)g=E[a]=o,++i._eventsCount;else if(typeof g=="function"?g=E[a]=f?[o,g]:[g,o]:f?g.unshift(o):g.push(o),d=p(i),d>0&&g.length>d&&!g.warned){g.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+g.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=i,L.type=a,L.count=g.length,u(L)}return i}r.prototype.addListener=function(a,o){return b(this,a,o,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(a,o){return b(this,a,o,!0)};function _(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(i,a,o){var f={fired:!1,wrapFn:void 0,target:i,type:a,listener:o},d=_.bind(f);return d.listener=o,f.wrapFn=d,d}r.prototype.once=function(a,o){return h(o),this.on(a,S(this,a,o)),this},r.prototype.prependOnceListener=function(a,o){return h(o),this.prependListener(a,S(this,a,o)),this},r.prototype.removeListener=function(a,o){var f,d,E,g,L;if(h(o),d=this._events,d===void 0)return this;if(f=d[a],f===void 0)return this;if(f===o||f.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete d[a],d.removeListener&&this.emit("removeListener",a,f.listener||o));else if(typeof f!="function"){for(E=-1,g=f.length-1;g>=0;g--)if(f[g]===o||f[g].listener===o){L=f[g].listener,E=g;break}if(E<0)return this;E===0?f.shift():y(f,E),f.length===1&&(d[a]=f[0]),d.removeListener!==void 0&&this.emit("removeListener",a,L||o)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(a){var o,f,d;if(f=this._events,f===void 0)return this;if(f.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):f[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete f[a]),this;if(arguments.length===0){var E=Object.keys(f),g;for(d=0;d<E.length;++d)g=E[d],g!=="removeListener"&&this.removeAllListeners(g);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=f[a],typeof o=="function")this.removeListener(a,o);else if(o!==void 0)for(d=o.length-1;d>=0;d--)this.removeListener(a,o[d]);return this};function O(i,a,o){var f=i._events;if(f===void 0)return[];var d=f[a];return d===void 0?[]:typeof d=="function"?o?[d.listener||d]:[d]:o?R(d):x(d,d.length)}r.prototype.listeners=function(a){return O(this,a,!0)},r.prototype.rawListeners=function(a){return O(this,a,!1)},r.listenerCount=function(i,a){return typeof i.listenerCount=="function"?i.listenerCount(a):P.call(i,a)},r.prototype.listenerCount=P;function P(i){var a=this._events;if(a!==void 0){var o=a[i];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function x(i,a){for(var o=new Array(a),f=0;f<a;++f)o[f]=i[f];return o}function y(i,a){for(;a+1<i.length;a++)i[a]=i[a+1];i.pop()}function R(i){for(var a=new Array(i.length),o=0;o<a.length;++o)a[o]=i[o].listener||i[o];return a}function A(i,a){return new Promise(function(o,f){function d(g){i.removeListener(a,E),f(g)}function E(){typeof i.removeListener=="function"&&i.removeListener("error",d),o([].slice.call(arguments))}V(i,a,E,{once:!0}),a!=="error"&&U(i,d,{once:!0})})}function U(i,a,o){typeof i.on=="function"&&V(i,"error",a,o)}function V(i,a,o,f){if(typeof i.on=="function")f.once?i.once(a,o):i.on(a,o);else if(typeof i.addEventListener=="function")i.addEventListener(a,function d(E){f.once&&i.removeEventListener(a,d),o(E)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}return Z.exports}var ke=Me();const De=W(ke);var Ie=typeof global=="object"&&global&&global.Object===Object&&global,Fe=typeof self=="object"&&self&&self.Object===Object&&self,$=Ie||Fe||Function("return this")(),q=$.Symbol,pe=Object.prototype,xe=pe.hasOwnProperty,We=pe.toString,J=q?q.toStringTag:void 0;function ze(e){var t=xe.call(e,J),n=e[J];try{e[J]=void 0;var u=!0}catch{}var c=We.call(e);return u&&(t?e[J]=n:delete e[J]),c}var Ye=Object.prototype,Ge=Ye.toString;function Ue(e){return Ge.call(e)}var Ve="[object Null]",He="[object Undefined]",ve=q?q.toStringTag:void 0;function me(e){return e==null?e===void 0?He:Ve:ve&&ve in Object(e)?ze(e):Ue(e)}function Je(e){return e!=null&&typeof e=="object"}var Xe="[object Symbol]";function Ke(e){return typeof e=="symbol"||Je(e)&&me(e)==Xe}var Be=/\s/;function Qe(e){for(var t=e.length;t--&&Be.test(e.charAt(t)););return t}var Ze=/^\s+/;function $e(e){return e&&e.slice(0,Qe(e)+1).replace(Ze,"")}function z(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var be=NaN,qe=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,tt=/^0o[0-7]+$/i,nt=parseInt;function ge(e){if(typeof e=="number")return e;if(Ke(e))return be;if(z(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=z(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$e(e);var n=et.test(e);return n||tt.test(e)?nt(e.slice(2),n?2:8):qe.test(e)?be:+e}var rt="[object AsyncFunction]",ot="[object Function]",at="[object GeneratorFunction]",st="[object Proxy]";function it(e){if(!z(e))return!1;var t=me(e);return t==ot||t==at||t==rt||t==st}var se=$["__core-js_shared__"],_e=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ut(e){return!!_e&&_e in e}var ct=Function.prototype,ft=ct.toString;function lt(e){if(e!=null){try{return ft.call(e)}catch{}try{return e+""}catch{}}return""}var dt=/[\\^$.*+?()[\]{}|]/g,ht=/^\[object .+?Constructor\]$/,pt=Function.prototype,vt=Object.prototype,mt=pt.toString,bt=vt.hasOwnProperty,gt=RegExp("^"+mt.call(bt).replace(dt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _t(e){if(!z(e)||ut(e))return!1;var t=it(e)?gt:ht;return t.test(lt(e))}function Et(e,t){return e==null?void 0:e[t]}function Ee(e,t){var n=Et(e,t);return _t(n)?n:void 0}function yt(e,t){return e===t||e!==e&&t!==t}var X=Ee(Object,"create");function Tt(){this.__data__=X?X(null):{},this.size=0}function St(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wt="__lodash_hash_undefined__",Ot=Object.prototype,Rt=Ot.hasOwnProperty;function Ct(e){var t=this.__data__;if(X){var n=t[e];return n===wt?void 0:n}return Rt.call(t,e)?t[e]:void 0}var jt=Object.prototype,Lt=jt.hasOwnProperty;function Pt(e){var t=this.__data__;return X?t[e]!==void 0:Lt.call(t,e)}var Nt="__lodash_hash_undefined__";function At(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=X&&t===void 0?Nt:t,this}function D(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}D.prototype.clear=Tt,D.prototype.delete=St,D.prototype.get=Ct,D.prototype.has=Pt,D.prototype.set=At;function Mt(){this.__data__=[],this.size=0}function ee(e,t){for(var n=e.length;n--;)if(yt(e[n][0],t))return n;return-1}var kt=Array.prototype,Dt=kt.splice;function It(e){var t=this.__data__,n=ee(t,e);if(n<0)return!1;var u=t.length-1;return n==u?t.pop():Dt.call(t,n,1),--this.size,!0}function Ft(e){var t=this.__data__,n=ee(t,e);return n<0?void 0:t[n][1]}function xt(e){return ee(this.__data__,e)>-1}function Wt(e,t){var n=this.__data__,u=ee(n,e);return u<0?(++this.size,n.push([e,t])):n[u][1]=t,this}function Y(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}Y.prototype.clear=Mt,Y.prototype.delete=It,Y.prototype.get=Ft,Y.prototype.has=xt,Y.prototype.set=Wt;var zt=Ee($,"Map");function Yt(){this.size=0,this.__data__={hash:new D,map:new(zt||Y),string:new D}}function Gt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function te(e,t){var n=e.__data__;return Gt(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ut(e){var t=te(this,e).delete(e);return this.size-=t?1:0,t}function Vt(e){return te(this,e).get(e)}function Ht(e){return te(this,e).has(e)}function Jt(e,t){var n=te(this,e),u=n.size;return n.set(e,t),this.size+=n.size==u?0:1,this}function I(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}I.prototype.clear=Yt,I.prototype.delete=Ut,I.prototype.get=Vt,I.prototype.has=Ht,I.prototype.set=Jt;var Xt="Expected a function";function ie(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Xt);var n=function(){var u=arguments,c=t?t.apply(this,u):u[0],r=n.cache;if(r.has(c))return r.get(c);var l=e.apply(this,u);return n.cache=r.set(c,l)||r,l};return n.cache=new(ie.Cache||I),n}ie.Cache=I;var ue=function(){return $.Date.now()},Kt="Expected a function",Bt=Math.max,Qt=Math.min;function ne(e,t,n){var u,c,r,l,h,p,b=0,_=!1,S=!1,O=!0;if(typeof e!="function")throw new TypeError(Kt);t=ge(t)||0,z(n)&&(_=!!n.leading,S="maxWait"in n,r=S?Bt(ge(n.maxWait)||0,t):r,O="trailing"in n?!!n.trailing:O);function P(o){var f=u,d=c;return u=c=void 0,b=o,l=e.apply(d,f),l}function x(o){return b=o,h=setTimeout(A,t),_?P(o):l}function y(o){var f=o-p,d=o-b,E=t-f;return S?Qt(E,r-d):E}function R(o){var f=o-p,d=o-b;return p===void 0||f>=t||f<0||S&&d>=r}function A(){var o=ue();if(R(o))return U(o);h=setTimeout(A,y(o))}function U(o){return h=void 0,O&&u?P(o):(u=c=void 0,l)}function V(){h!==void 0&&clearTimeout(h),b=0,u=p=c=h=void 0}function i(){return h===void 0?l:U(ue())}function a(){var o=ue(),f=R(o);if(u=arguments,c=this,p=o,f){if(h===void 0)return x(p);if(S)return clearTimeout(h),h=setTimeout(A,t),P(p)}return h===void 0&&(h=setTimeout(A,t)),l}return a.cancel=V,a.flush=i,a}var Zt="Expected a function";function $t(e,t,n){var u=!0,c=!0;if(typeof e!="function")throw new TypeError(Zt);return z(n)&&(u="leading"in n?!!n.leading:u,c="trailing"in n?!!n.trailing:c),ne(e,t,{leading:u,maxWait:t,trailing:c})}class ye{constructor(t){ae(this,"event",new De.EventEmitter);ae(this,"data",{});ae(this,"registry",new Set);this.name=t,console.log("[CONTEXT] %s",t),this.event.setMaxListeners(100)}publish(t,n){n!=this.data[t]&&(this.data[t]=n,this.event.emit(String(t),{value:n}))}subscribe(t,n){const u=({value:c})=>{n(c)};return this.event.addListener(String(t),u),console.log("listenerCount:",String(t),this.event.listenerCount(String(t))),t in this.data&&n(this.data[t]),()=>(this.event.removeListener(String(t),u),void 0)}}const Te=ie(e=>new ye(e)),F=(e="noname")=>v.useMemo(()=>Te(e),[e]),Se=(e,...t)=>{const n=new Error("[ctx] useRegistryChecker failed "+JSON.stringify({names:t,ctx:(e==null?void 0:e.name)??"undefined"}));v.useEffect(()=>{if(e)return t.some(u=>e.registry.has(u))&&console.error(n),t.forEach(u=>e.registry.add(u)),()=>{t.forEach(u=>e.registry.delete(u))}},[e,t.length])},qt=(e,t,n)=>{v.useEffect(()=>{e&&e.data[t]!=n&&e.publish(t,n)},[t,n,e]),Se(e,t)},we=(e,t,n=0)=>{const[{value:u},c]=v.useState(()=>{var r;return{value:(r=e==null?void 0:e.data)==null?void 0:r[t]}});return v.useEffect(()=>{if(e){let r=n==0?h=>c({value:h}):ne(h=>c({value:h}),n),l=e.subscribe(t,r);return u!=e.data[t]&&c({value:e.data[t]}),()=>{l()}}},[t,e]),e==null?void 0:e.data[t]},en=(e,t,n)=>{const[,u]=v.useState(0),c=v.useMemo(()=>n(e==null?void 0:e.data[t]),[n,e==null?void 0:e.data[t]]);return v.useEffect(()=>{if(e){let r=c,l=()=>{let p=n(e.data[t]);p!=r&&(r=p,u(b=>b+1))},h=e.subscribe(t,l);return l(),()=>h()}},[t,e]),c},ce=(e,...t)=>{v.useEffect(()=>{if(e)for(let[n,u]of t)e.data[n]!=u&&e.publish(n,u)},[e,...t.flat()]),Se(e,...t.map(n=>n[0]))},tn=(e,...t)=>{const[,n]=v.useState(0),u=t.map(c=>{var r;return(r=e==null?void 0:e.data)==null?void 0:r[c]});return v.useEffect(()=>{if(e){let c=u;const r=ne(()=>{let p=t.map(b=>{var _;return(_=e==null?void 0:e.data)==null?void 0:_[b]});t.some((b,_)=>c[_]!=p[_])&&(c=p,n(b=>b+1))},1);let l=t.map(p=>e.subscribe(p,r)),h=setTimeout(r,1);return()=>{clearTimeout(h),r.cancel(),l.forEach(p=>p())}}},[e,...t]),Object.fromEntries(t.map((c,r)=>[c,u[r]]))},nn=(e,t=100,...n)=>{const[,u]=v.useState(0),c=n.map(r=>{var l;return(l=e==null?void 0:e.data)==null?void 0:l[r]});return v.useEffect(()=>{if(e){let r=c;const l=$t(()=>{let b=n.map(_=>{var S;return(S=e==null?void 0:e.data)==null?void 0:S[_]});n.some((_,S)=>r[S]!=b[S])&&(r=b,u(_=>_+1))},t);let h=n.map(b=>e.subscribe(b,l)),p=setTimeout(l,1);return()=>{clearTimeout(p),l.cancel(),h.forEach(b=>b())}}},[e,...n]),c};var re={exports:{}},K={};/**
1
+ (function(S,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],v):(S=typeof globalThis<"u"?globalThis:S||self,v(S.RState={},S.React))})(this,function(S,v){"use strict";var pn=Object.defineProperty;var vn=(S,v,W)=>v in S?pn(S,v,{enumerable:!0,configurable:!0,writable:!0,value:W}):S[v]=W;var ae=(S,v,W)=>vn(S,typeof v!="symbol"?v+"":v,W);function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={exports:{}},he;function Me(){if(he)return Z.exports;he=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(a,o,f){return Function.prototype.apply.call(a,o,f)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:n=function(a){return Object.getOwnPropertyNames(a)};function u(i){console&&console.warn&&console.warn(i)}var l=Number.isNaN||function(a){return a!==a};function r(){r.init.call(this)}Z.exports=r,Z.exports.once=A,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var c=10;function h(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(i){if(typeof i!="number"||i<0||l(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");c=i}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(a){if(typeof a!="number"||a<0||l(a))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+a+".");return this._maxListeners=a,this};function p(i){return i._maxListeners===void 0?r.defaultMaxListeners:i._maxListeners}r.prototype.getMaxListeners=function(){return p(this)},r.prototype.emit=function(a){for(var o=[],f=1;f<arguments.length;f++)o.push(arguments[f]);var d=a==="error",E=this._events;if(E!==void 0)d=d&&E.error===void 0;else if(!d)return!1;if(d){var g;if(o.length>0&&(g=o[0]),g instanceof Error)throw g;var L=new Error("Unhandled error."+(g?" ("+g.message+")":""));throw L.context=g,L}var M=E[a];if(M===void 0)return!1;if(typeof M=="function")t(M,this,o);else for(var oe=M.length,Q=F(M,oe),f=0;f<oe;++f)t(Q[f],this,o);return!0};function m(i,a,o,f){var d,E,g;if(h(o),E=i._events,E===void 0?(E=i._events=Object.create(null),i._eventsCount=0):(E.newListener!==void 0&&(i.emit("newListener",a,o.listener?o.listener:o),E=i._events),g=E[a]),g===void 0)g=E[a]=o,++i._eventsCount;else if(typeof g=="function"?g=E[a]=f?[o,g]:[g,o]:f?g.unshift(o):g.push(o),d=p(i),d>0&&g.length>d&&!g.warned){g.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+g.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=i,L.type=a,L.count=g.length,u(L)}return i}r.prototype.addListener=function(a,o){return m(this,a,o,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(a,o){return m(this,a,o,!0)};function _(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function T(i,a,o){var f={fired:!1,wrapFn:void 0,target:i,type:a,listener:o},d=_.bind(f);return d.listener=o,f.wrapFn=d,d}r.prototype.once=function(a,o){return h(o),this.on(a,T(this,a,o)),this},r.prototype.prependOnceListener=function(a,o){return h(o),this.prependListener(a,T(this,a,o)),this},r.prototype.removeListener=function(a,o){var f,d,E,g,L;if(h(o),d=this._events,d===void 0)return this;if(f=d[a],f===void 0)return this;if(f===o||f.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete d[a],d.removeListener&&this.emit("removeListener",a,f.listener||o));else if(typeof f!="function"){for(E=-1,g=f.length-1;g>=0;g--)if(f[g]===o||f[g].listener===o){L=f[g].listener,E=g;break}if(E<0)return this;E===0?f.shift():y(f,E),f.length===1&&(d[a]=f[0]),d.removeListener!==void 0&&this.emit("removeListener",a,L||o)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(a){var o,f,d;if(f=this._events,f===void 0)return this;if(f.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):f[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete f[a]),this;if(arguments.length===0){var E=Object.keys(f),g;for(d=0;d<E.length;++d)g=E[d],g!=="removeListener"&&this.removeAllListeners(g);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=f[a],typeof o=="function")this.removeListener(a,o);else if(o!==void 0)for(d=o.length-1;d>=0;d--)this.removeListener(a,o[d]);return this};function O(i,a,o){var f=i._events;if(f===void 0)return[];var d=f[a];return d===void 0?[]:typeof d=="function"?o?[d.listener||d]:[d]:o?R(d):F(d,d.length)}r.prototype.listeners=function(a){return O(this,a,!0)},r.prototype.rawListeners=function(a){return O(this,a,!1)},r.listenerCount=function(i,a){return typeof i.listenerCount=="function"?i.listenerCount(a):P.call(i,a)},r.prototype.listenerCount=P;function P(i){var a=this._events;if(a!==void 0){var o=a[i];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function F(i,a){for(var o=new Array(a),f=0;f<a;++f)o[f]=i[f];return o}function y(i,a){for(;a+1<i.length;a++)i[a]=i[a+1];i.pop()}function R(i){for(var a=new Array(i.length),o=0;o<a.length;++o)a[o]=i[o].listener||i[o];return a}function A(i,a){return new Promise(function(o,f){function d(g){i.removeListener(a,E),f(g)}function E(){typeof i.removeListener=="function"&&i.removeListener("error",d),o([].slice.call(arguments))}V(i,a,E,{once:!0}),a!=="error"&&U(i,d,{once:!0})})}function U(i,a,o){typeof i.on=="function"&&V(i,"error",a,o)}function V(i,a,o,f){if(typeof i.on=="function")f.once?i.once(a,o):i.on(a,o);else if(typeof i.addEventListener=="function")i.addEventListener(a,function d(E){f.once&&i.removeEventListener(a,d),o(E)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}return Z.exports}var ke=Me();const De=W(ke);var Ie=typeof global=="object"&&global&&global.Object===Object&&global,xe=typeof self=="object"&&self&&self.Object===Object&&self,$=Ie||xe||Function("return this")(),q=$.Symbol,pe=Object.prototype,Fe=pe.hasOwnProperty,We=pe.toString,J=q?q.toStringTag:void 0;function ze(e){var t=Fe.call(e,J),n=e[J];try{e[J]=void 0;var u=!0}catch{}var l=We.call(e);return u&&(t?e[J]=n:delete e[J]),l}var Ye=Object.prototype,Ge=Ye.toString;function Ue(e){return Ge.call(e)}var Ve="[object Null]",He="[object Undefined]",ve=q?q.toStringTag:void 0;function me(e){return e==null?e===void 0?He:Ve:ve&&ve in Object(e)?ze(e):Ue(e)}function Je(e){return e!=null&&typeof e=="object"}var Xe="[object Symbol]";function Ke(e){return typeof e=="symbol"||Je(e)&&me(e)==Xe}var Be=/\s/;function Qe(e){for(var t=e.length;t--&&Be.test(e.charAt(t)););return t}var Ze=/^\s+/;function $e(e){return e&&e.slice(0,Qe(e)+1).replace(Ze,"")}function z(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var be=NaN,qe=/^[-+]0x[0-9a-f]+$/i,et=/^0b[01]+$/i,tt=/^0o[0-7]+$/i,nt=parseInt;function ge(e){if(typeof e=="number")return e;if(Ke(e))return be;if(z(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=z(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$e(e);var n=et.test(e);return n||tt.test(e)?nt(e.slice(2),n?2:8):qe.test(e)?be:+e}var rt="[object AsyncFunction]",ot="[object Function]",at="[object GeneratorFunction]",st="[object Proxy]";function it(e){if(!z(e))return!1;var t=me(e);return t==ot||t==at||t==rt||t==st}var se=$["__core-js_shared__"],_e=function(){var e=/[^.]+$/.exec(se&&se.keys&&se.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ut(e){return!!_e&&_e in e}var ct=Function.prototype,ft=ct.toString;function lt(e){if(e!=null){try{return ft.call(e)}catch{}try{return e+""}catch{}}return""}var dt=/[\\^$.*+?()[\]{}|]/g,ht=/^\[object .+?Constructor\]$/,pt=Function.prototype,vt=Object.prototype,mt=pt.toString,bt=vt.hasOwnProperty,gt=RegExp("^"+mt.call(bt).replace(dt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _t(e){if(!z(e)||ut(e))return!1;var t=it(e)?gt:ht;return t.test(lt(e))}function Et(e,t){return e==null?void 0:e[t]}function Ee(e,t){var n=Et(e,t);return _t(n)?n:void 0}function yt(e,t){return e===t||e!==e&&t!==t}var X=Ee(Object,"create");function St(){this.__data__=X?X(null):{},this.size=0}function Tt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wt="__lodash_hash_undefined__",Ot=Object.prototype,Rt=Ot.hasOwnProperty;function Ct(e){var t=this.__data__;if(X){var n=t[e];return n===wt?void 0:n}return Rt.call(t,e)?t[e]:void 0}var jt=Object.prototype,Lt=jt.hasOwnProperty;function Pt(e){var t=this.__data__;return X?t[e]!==void 0:Lt.call(t,e)}var Nt="__lodash_hash_undefined__";function At(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=X&&t===void 0?Nt:t,this}function D(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}D.prototype.clear=St,D.prototype.delete=Tt,D.prototype.get=Ct,D.prototype.has=Pt,D.prototype.set=At;function Mt(){this.__data__=[],this.size=0}function ee(e,t){for(var n=e.length;n--;)if(yt(e[n][0],t))return n;return-1}var kt=Array.prototype,Dt=kt.splice;function It(e){var t=this.__data__,n=ee(t,e);if(n<0)return!1;var u=t.length-1;return n==u?t.pop():Dt.call(t,n,1),--this.size,!0}function xt(e){var t=this.__data__,n=ee(t,e);return n<0?void 0:t[n][1]}function Ft(e){return ee(this.__data__,e)>-1}function Wt(e,t){var n=this.__data__,u=ee(n,e);return u<0?(++this.size,n.push([e,t])):n[u][1]=t,this}function Y(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}Y.prototype.clear=Mt,Y.prototype.delete=It,Y.prototype.get=xt,Y.prototype.has=Ft,Y.prototype.set=Wt;var zt=Ee($,"Map");function Yt(){this.size=0,this.__data__={hash:new D,map:new(zt||Y),string:new D}}function Gt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function te(e,t){var n=e.__data__;return Gt(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ut(e){var t=te(this,e).delete(e);return this.size-=t?1:0,t}function Vt(e){return te(this,e).get(e)}function Ht(e){return te(this,e).has(e)}function Jt(e,t){var n=te(this,e),u=n.size;return n.set(e,t),this.size+=n.size==u?0:1,this}function I(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var u=e[t];this.set(u[0],u[1])}}I.prototype.clear=Yt,I.prototype.delete=Ut,I.prototype.get=Vt,I.prototype.has=Ht,I.prototype.set=Jt;var Xt="Expected a function";function ie(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Xt);var n=function(){var u=arguments,l=t?t.apply(this,u):u[0],r=n.cache;if(r.has(l))return r.get(l);var c=e.apply(this,u);return n.cache=r.set(l,c)||r,c};return n.cache=new(ie.Cache||I),n}ie.Cache=I;var ue=function(){return $.Date.now()},Kt="Expected a function",Bt=Math.max,Qt=Math.min;function ne(e,t,n){var u,l,r,c,h,p,m=0,_=!1,T=!1,O=!0;if(typeof e!="function")throw new TypeError(Kt);t=ge(t)||0,z(n)&&(_=!!n.leading,T="maxWait"in n,r=T?Bt(ge(n.maxWait)||0,t):r,O="trailing"in n?!!n.trailing:O);function P(o){var f=u,d=l;return u=l=void 0,m=o,c=e.apply(d,f),c}function F(o){return m=o,h=setTimeout(A,t),_?P(o):c}function y(o){var f=o-p,d=o-m,E=t-f;return T?Qt(E,r-d):E}function R(o){var f=o-p,d=o-m;return p===void 0||f>=t||f<0||T&&d>=r}function A(){var o=ue();if(R(o))return U(o);h=setTimeout(A,y(o))}function U(o){return h=void 0,O&&u?P(o):(u=l=void 0,c)}function V(){h!==void 0&&clearTimeout(h),m=0,u=p=l=h=void 0}function i(){return h===void 0?c:U(ue())}function a(){var o=ue(),f=R(o);if(u=arguments,l=this,p=o,f){if(h===void 0)return F(p);if(T)return clearTimeout(h),h=setTimeout(A,t),P(p)}return h===void 0&&(h=setTimeout(A,t)),c}return a.cancel=V,a.flush=i,a}var Zt="Expected a function";function $t(e,t,n){var u=!0,l=!0;if(typeof e!="function")throw new TypeError(Zt);return z(n)&&(u="leading"in n?!!n.leading:u,l="trailing"in n?!!n.trailing:l),ne(e,t,{leading:u,maxWait:t,trailing:l})}class ye{constructor(t){ae(this,"event",new De.EventEmitter);ae(this,"data",{});ae(this,"registry",new Set);this.name=t,console.log("[CONTEXT] %s",t),this.event.setMaxListeners(100)}publish(t,n){n!=this.data[t]&&(this.data[t]=n,this.event.emit(String(t),{value:n}))}subscribe(t,n){const u=({value:l})=>{n(l)};return this.event.addListener(String(t),u),console.log("listenerCount:",String(t),this.event.listenerCount(String(t))),t in this.data&&n(this.data[t]),()=>(this.event.removeListener(String(t),u),void 0)}}const Se=ie(e=>new ye(e)),x=(e="noname")=>v.useMemo(()=>Se(e),[e]),Te=(e,...t)=>{const n=new Error("[ctx] useRegistryChecker failed "+JSON.stringify({names:t,ctx:(e==null?void 0:e.name)??"undefined"}));v.useEffect(()=>{if(e)return t.some(u=>e.registry.has(u))&&console.error(n),t.forEach(u=>e.registry.add(u)),()=>{t.forEach(u=>e.registry.delete(u))}},[e,t.length])},qt=(e,t,n)=>{v.useEffect(()=>{e&&e.data[t]!=n&&e.publish(t,n)},[t,n,e]),Te(e,t)},we=(e,t,n=0)=>{const[{value:u},l]=v.useState(()=>{var r;return{value:(r=e==null?void 0:e.data)==null?void 0:r[t]}});return v.useEffect(()=>{if(e){let r=n==0?h=>l({value:h}):ne(h=>l({value:h}),n),c=e.subscribe(t,r);return u!=e.data[t]&&l({value:e.data[t]}),()=>{c()}}},[t,e]),e==null?void 0:e.data[t]},en=(e,t,n)=>{const[,u]=v.useState(0),l=v.useMemo(()=>n(e==null?void 0:e.data[t]),[n,e==null?void 0:e.data[t]]);return v.useEffect(()=>{if(e){let r=l,c=()=>{let p=n(e.data[t]);p!=r&&(r=p,u(m=>m+1))},h=e.subscribe(t,c);return c(),()=>h()}},[t,e]),l},ce=(e,...t)=>{v.useEffect(()=>{if(e)for(let[n,u]of t)e.data[n]!=u&&e.publish(n,u)},[e,...t.flat()]),Te(e,...t.map(n=>n[0]))},tn=(e,...t)=>{const[,n]=v.useState(0),u=t.map(l=>{var r;return(r=e==null?void 0:e.data)==null?void 0:r[l]});return v.useEffect(()=>{if(e){let l=u;const r=ne(()=>{let p=t.map(m=>{var _;return(_=e==null?void 0:e.data)==null?void 0:_[m]});t.some((m,_)=>l[_]!=p[_])&&(l=p,n(m=>m+1))},1);let c=t.map(p=>e.subscribe(p,r)),h=setTimeout(r,1);return()=>{clearTimeout(h),r.cancel(),c.forEach(p=>p())}}},[e,...t]),Object.fromEntries(t.map((l,r)=>[l,u[r]]))},nn=(e,t=100,...n)=>{const[,u]=v.useState(0),l=n.map(r=>{var c;return(c=e==null?void 0:e.data)==null?void 0:c[r]});return v.useEffect(()=>{if(e){let r=l;const c=$t(()=>{let m=n.map(_=>{var T;return(T=e==null?void 0:e.data)==null?void 0:T[_]});n.some((_,T)=>r[T]!=m[T])&&(r=m,u(_=>_+1))},t);let h=n.map(m=>e.subscribe(m,c)),p=setTimeout(c,1);return()=>{clearTimeout(p),c.cancel(),h.forEach(m=>m())}}},[e,...n]),l};var re={exports:{}},K={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Oe;function rn(){if(Oe)return K;Oe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(u,c,r){var l=null;if(r!==void 0&&(l=""+r),c.key!==void 0&&(l=""+c.key),"key"in c){r={};for(var h in c)h!=="key"&&(r[h]=c[h])}else r=c;return c=r.ref,{$$typeof:e,type:u,key:l,ref:c!==void 0?c:null,props:r}}return K.Fragment=t,K.jsx=n,K.jsxs=n,K}var B={};/**
9
+ */var Oe;function rn(){if(Oe)return K;Oe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(u,l,r){var c=null;if(r!==void 0&&(c=""+r),l.key!==void 0&&(c=""+l.key),"key"in l){r={};for(var h in l)h!=="key"&&(r[h]=l[h])}else r=l;return l=r.ref,{$$typeof:e,type:u,key:c,ref:l!==void 0?l:null,props:r}}return K.Fragment=t,K.jsx=n,K.jsxs=n,K}var B={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Re;function on(){return Re||(Re=1,process.env.NODE_ENV!=="production"&&function(){function e(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===g?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case y:return"Fragment";case A:return"Profiler";case R:return"StrictMode";case a:return"Suspense";case o:return"SuspenseList";case E:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case x:return"Portal";case V:return(s.displayName||"Context")+".Provider";case U:return(s._context.displayName||"Context")+".Consumer";case i:var m=s.render;return s=s.displayName,s||(s=m.displayName||m.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case f:return m=s.displayName||null,m!==null?m:e(s.type)||"Memo";case d:m=s._payload,s=s._init;try{return e(s(m))}catch{}}return null}function t(s){return""+s}function n(s){try{t(s);var m=!1}catch{m=!0}if(m){m=console;var w=m.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return w.call(m,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),t(s)}}function u(s){if(s===y)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===d)return"<...>";try{var m=e(s);return m?"<"+m+">":"<...>"}catch{return"<...>"}}function c(){var s=L.A;return s===null?null:s.getOwner()}function r(){return Error("react-stack-top-frame")}function l(s){if(M.call(s,"key")){var m=Object.getOwnPropertyDescriptor(s,"key").get;if(m&&m.isReactWarning)return!1}return s.key!==void 0}function h(s,m){function w(){je||(je=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",m))}w.isReactWarning=!0,Object.defineProperty(s,"key",{get:w,configurable:!0})}function p(){var s=e(this.type);return Le[s]||(Le[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function b(s,m,w,C,k,N,fe,le){return w=N.ref,s={$$typeof:P,type:s,key:m,props:N,_owner:k},(w!==void 0?w:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:p}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function _(s,m,w,C,k,N,fe,le){var j=m.children;if(j!==void 0)if(C)if(oe(j)){for(C=0;C<j.length;C++)S(j[C]);Object.freeze&&Object.freeze(j)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else S(j);if(M.call(m,"key")){j=e(s);var H=Object.keys(m).filter(function(hn){return hn!=="key"});C=0<H.length?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}",Ae[j+C]||(H=0<H.length?"{"+H.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Re;function on(){return Re||(Re=1,process.env.NODE_ENV!=="production"&&function(){function e(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===g?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case y:return"Fragment";case A:return"Profiler";case R:return"StrictMode";case a:return"Suspense";case o:return"SuspenseList";case E:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case F:return"Portal";case V:return(s.displayName||"Context")+".Provider";case U:return(s._context.displayName||"Context")+".Consumer";case i:var b=s.render;return s=s.displayName,s||(s=b.displayName||b.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case f:return b=s.displayName||null,b!==null?b:e(s.type)||"Memo";case d:b=s._payload,s=s._init;try{return e(s(b))}catch{}}return null}function t(s){return""+s}function n(s){try{t(s);var b=!1}catch{b=!0}if(b){b=console;var w=b.error,C=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return w.call(b,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",C),t(s)}}function u(s){if(s===y)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===d)return"<...>";try{var b=e(s);return b?"<"+b+">":"<...>"}catch{return"<...>"}}function l(){var s=L.A;return s===null?null:s.getOwner()}function r(){return Error("react-stack-top-frame")}function c(s){if(M.call(s,"key")){var b=Object.getOwnPropertyDescriptor(s,"key").get;if(b&&b.isReactWarning)return!1}return s.key!==void 0}function h(s,b){function w(){je||(je=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",b))}w.isReactWarning=!0,Object.defineProperty(s,"key",{get:w,configurable:!0})}function p(){var s=e(this.type);return Le[s]||(Le[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function m(s,b,w,C,k,N,fe,le){return w=N.ref,s={$$typeof:P,type:s,key:b,props:N,_owner:k},(w!==void 0?w:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:p}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function _(s,b,w,C,k,N,fe,le){var j=b.children;if(j!==void 0)if(C)if(oe(j)){for(C=0;C<j.length;C++)T(j[C]);Object.freeze&&Object.freeze(j)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else T(j);if(M.call(b,"key")){j=e(s);var H=Object.keys(b).filter(function(hn){return hn!=="key"});C=0<H.length?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}",Ae[j+C]||(H=0<H.length?"{"+H.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,C,j,H,j),Ae[j+C]=!0)}if(j=null,w!==void 0&&(n(w),j=""+w),l(m)&&(n(m.key),j=""+m.key),"key"in m){w={};for(var de in m)de!=="key"&&(w[de]=m[de])}else w=m;return j&&h(w,typeof s=="function"?s.displayName||s.name||"Unknown":s),b(s,j,N,k,c(),w,fe,le)}function S(s){typeof s=="object"&&s!==null&&s.$$typeof===P&&s._store&&(s._store.validated=1)}var O=v,P=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),V=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),o=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),g=Symbol.for("react.client.reference"),L=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,oe=Array.isArray,Q=console.createTask?console.createTask:function(){return null};O={"react-stack-bottom-frame":function(s){return s()}};var je,Le={},Pe=O["react-stack-bottom-frame"].bind(O,r)(),Ne=Q(u(r)),Ae={};B.Fragment=y,B.jsx=function(s,m,w,C,k){var N=1e4>L.recentlyCreatedOwnerStacks++;return _(s,m,w,!1,C,k,N?Error("react-stack-top-frame"):Pe,N?Q(u(s)):Ne)},B.jsxs=function(s,m,w,C,k){var N=1e4>L.recentlyCreatedOwnerStacks++;return _(s,m,w,!0,C,k,N?Error("react-stack-top-frame"):Pe,N?Q(u(s)):Ne)}}()),B}var Ce;function an(){return Ce||(Ce=1,process.env.NODE_ENV==="production"?re.exports=rn():re.exports=on()),re.exports}var G=an();const sn=(e,t)=>{const n=c=>[e,...Object.entries(c??{}).sort((r,l)=>r[0].localeCompare(l[0])).flat()].join("-");let u=new Set;return{resolveCtxName:n,Root:c=>{const r=n(c),l=F(r),h=t(c),p=v.useMemo(()=>new Error().stack,[]);return ce(l,...Object.entries(h)),v.useEffect(()=>{if(u.has(r)){const b=new Error("RootContext "+r+" are mounted more than once");throw b.stack=p,b}return u.add(r),()=>{u.delete(r)}}),G.jsx(G.Fragment,{})},useCtxStateStrict:c=>{const r=n(c),l=v.useMemo(()=>new Error().stack,[]);return v.useEffect(()=>{if(!u.has(r)){const h=new Error("RootContext ["+r+"] is not mounted");throw h.stack=l,h}},[r]),F(r)},useCtxState:c=>{const r=n(c),l=v.useMemo(()=>new Error().stack,[]);return v.useEffect(()=>{if(!u.has(r)){const h=new Error("RootContext ["+r+"] is not mounted");h.stack=l;let p=setTimeout(()=>console.error(h),1e3);return()=>clearTimeout(p)}},[u.has(r)]),F(r)}}},un=function(){const e=new WeakMap;return t=>{let n=e.get(t);return n||e.set(t,n=((t==null?void 0:t.name)??"")+Math.random().toString()),n}}(),cn=e=>[...Object.entries(e??{}).sort((t,n)=>t[0].localeCompare(n[0])).flat()].join("-"),fn=({Wrapper:e=v.Fragment})=>{const t=F("auto-ctx"),[n,u]=v.useState({}),c=v.useCallback((r,l)=>{const h=un(r),p=cn(l);return u(({[h]:{Component:b=r,subState:{[p]:_={params:l,counter:0},...S}={}}={},...O})=>({...O,[h]:{Component:b,subState:{...S,[p]:{..._,counter:_.counter+1}}}})),()=>u(({[h]:{Component:b=r,subState:{[p]:_={params:l,counter:0},...S}={}}={},...O})=>({...O,[h]:{Component:b,subState:{...S,..._.counter>1?{[p]:{..._,counter:_.counter-1}}:{}}}}))},[]);return ce(t,["subscribe",c],["state",n]),G.jsx(G.Fragment,{children:Object.entries(n).flatMap(([r,{Component:l,subState:h}])=>Object.entries(h).map(([p,{counter:b,params:_}])=>({key:r+p,Component:l,params:_,counter:b})).filter(p=>p.counter>0).map(({key:p,params:b,Component:_})=>G.jsx(e,{children:G.jsx(_,{...b})},p)))})},ln=({Root:e,useCtxState:t,useCtxStateStrict:n,resolveCtxName:u})=>({useCtxState:c=>{const r=u(c),l=we(F("auto-ctx"),"subscribe");return v.useEffect(()=>l==null?void 0:l(e,c),[l,r]),F(r)}}),dn=e=>{const[,t]=v.useState(0),{proxy:n,finalGetter:u,openGetter:c,clean:r}=v.useMemo(()=>{const l=new Set,h={},p=new Map,b=new Proxy(e==null?void 0:e.data,{get(y,R){if(_)return l.add(R),h[R]=y[R];throw new Error("now allow here")}});let _=!0,S=ne(()=>{[...l.values()].some(y=>{var R;return h[y]!=((R=e==null?void 0:e.data)==null?void 0:R[y])})&&t(y=>y+1)},0),O=()=>{_=!0,l.clear()},P=()=>{_=!1,[...l.values()].filter(y=>!p.has(y)).forEach(y=>{p.set(y,e==null?void 0:e.subscribe(y,S))}),[...p.keys()].filter(y=>!l.has(y)).forEach(y=>{let R=p.get(y);R==null||R(),p.delete(y)})};return{proxy:b,finalGetter:P,openGetter:O,clean:()=>{O(),P(),t(y=>y+1)}}},[e]);return c(),setTimeout(u,0),v.useEffect(()=>()=>r(),[r]),n};T.AutoRootCtx=fn,T.Context=ye,T.createAutoCtx=ln,T.createRootCtx=sn,T.getContext=Te,T.useDataContext=F,T.useDataSource=qt,T.useDataSourceMultiple=ce,T.useDataSubscribe=we,T.useDataSubscribeMultiple=tn,T.useDataSubscribeMultipleWithDebounce=nn,T.useDataSubscribeWithTransform=en,T.useQuickSubscribe=dn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
22
+ <%s key={someKey} {...props} />`,C,j,H,j),Ae[j+C]=!0)}if(j=null,w!==void 0&&(n(w),j=""+w),c(b)&&(n(b.key),j=""+b.key),"key"in b){w={};for(var de in b)de!=="key"&&(w[de]=b[de])}else w=b;return j&&h(w,typeof s=="function"?s.displayName||s.name||"Unknown":s),m(s,j,N,k,l(),w,fe,le)}function T(s){typeof s=="object"&&s!==null&&s.$$typeof===P&&s._store&&(s._store.validated=1)}var O=v,P=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),V=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),o=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),g=Symbol.for("react.client.reference"),L=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,oe=Array.isArray,Q=console.createTask?console.createTask:function(){return null};O={"react-stack-bottom-frame":function(s){return s()}};var je,Le={},Pe=O["react-stack-bottom-frame"].bind(O,r)(),Ne=Q(u(r)),Ae={};B.Fragment=y,B.jsx=function(s,b,w,C,k){var N=1e4>L.recentlyCreatedOwnerStacks++;return _(s,b,w,!1,C,k,N?Error("react-stack-top-frame"):Pe,N?Q(u(s)):Ne)},B.jsxs=function(s,b,w,C,k){var N=1e4>L.recentlyCreatedOwnerStacks++;return _(s,b,w,!0,C,k,N?Error("react-stack-top-frame"):Pe,N?Q(u(s)):Ne)}}()),B}var Ce;function an(){return Ce||(Ce=1,process.env.NODE_ENV==="production"?re.exports=rn():re.exports=on()),re.exports}var G=an();const sn=(e,t)=>{const n=r=>[e,...Object.entries(r??{}).sort((c,h)=>c[0].localeCompare(h[0])).flat()].join("-");let u=new Set;const l=r=>{const c=n(r),h=x(c),p=t(r),m=v.useMemo(()=>new Error().stack,[]);return ce(h,...Object.entries(p)),v.useEffect(()=>{if(u.has(c)){const _=new Error("RootContext "+c+" are mounted more than once");throw _.stack=m,_}return u.add(c),()=>{u.delete(c)}}),G.jsx(G.Fragment,{})};return l.displayName=`State[${(t==null?void 0:t.name)??"??"}]`,{resolveCtxName:n,Root:l,useCtxStateStrict:r=>{const c=n(r),h=v.useMemo(()=>new Error().stack,[]);return v.useEffect(()=>{if(!u.has(c)){const p=new Error("RootContext ["+c+"] is not mounted");throw p.stack=h,p}},[c]),x(c)},useCtxState:r=>{const c=n(r),h=v.useMemo(()=>new Error().stack,[]);return v.useEffect(()=>{if(!u.has(c)){const p=new Error("RootContext ["+c+"] is not mounted");p.stack=h;let m=setTimeout(()=>console.error(p),1e3);return()=>clearTimeout(m)}},[u.has(c)]),x(c)}}},un=function(){const e=new WeakMap;return t=>{let n=e.get(t);return n||e.set(t,n=((t==null?void 0:t.name)??"")+Math.random().toString()),n}}(),cn=e=>[...Object.entries(e??{}).sort((t,n)=>t[0].localeCompare(n[0])).flat()].join("-"),fn=({Wrapper:e=v.Fragment})=>{const t=x("auto-ctx"),[n,u]=v.useState({}),l=v.useCallback((r,c)=>{const h=un(r),p=cn(c);return u(({[h]:{Component:m=r,subState:{[p]:_={params:c,counter:0},...T}={}}={},...O})=>({...O,[h]:{Component:m,subState:{...T,[p]:{..._,counter:_.counter+1}}}})),()=>u(({[h]:{Component:m=r,subState:{[p]:_={params:c,counter:0},...T}={}}={},...O})=>({...O,[h]:{Component:m,subState:{...T,..._.counter>1?{[p]:{..._,counter:_.counter-1}}:{}}}}))},[]);return ce(t,["subscribe",l],["state",n]),G.jsx(G.Fragment,{children:Object.entries(n).flatMap(([r,{Component:c,subState:h}])=>Object.entries(h).map(([p,{counter:m,params:_}])=>({key:r+p,Component:c,params:_,counter:m})).filter(p=>p.counter>0).map(({key:p,params:m,Component:_})=>G.jsx(e,{children:G.jsx(_,{...m})},p)))})},ln=({Root:e,useCtxState:t,useCtxStateStrict:n,resolveCtxName:u})=>({useCtxState:l=>{const r=u(l),c=we(x("auto-ctx"),"subscribe");return v.useEffect(()=>c==null?void 0:c(e,l),[c,r]),x(r)}}),dn=e=>{const[,t]=v.useState(0),{proxy:n,finalGetter:u,openGetter:l,clean:r}=v.useMemo(()=>{const c=new Set,h={},p=new Map,m=new Proxy(e==null?void 0:e.data,{get(y,R){if(_)return c.add(R),h[R]=y[R];throw new Error("now allow here")}});let _=!0,T=ne(()=>{[...c.values()].some(y=>{var R;return h[y]!=((R=e==null?void 0:e.data)==null?void 0:R[y])})&&t(y=>y+1)},0),O=()=>{_=!0,c.clear()},P=()=>{_=!1,[...c.values()].filter(y=>!p.has(y)).forEach(y=>{p.set(y,e==null?void 0:e.subscribe(y,T))}),[...p.keys()].filter(y=>!c.has(y)).forEach(y=>{let R=p.get(y);R==null||R(),p.delete(y)})};return{proxy:m,finalGetter:P,openGetter:O,clean:()=>{O(),P(),t(y=>y+1)}}},[e]);return l(),setTimeout(u,0),v.useEffect(()=>()=>r(),[r]),n};S.AutoRootCtx=fn,S.Context=ye,S.createAutoCtx=ln,S.createRootCtx=sn,S.getContext=Se,S.useDataContext=x,S.useDataSource=qt,S.useDataSourceMultiple=ce,S.useDataSubscribe=we,S.useDataSubscribeMultiple=tn,S.useDataSubscribeMultipleWithDebounce=nn,S.useDataSubscribeWithTransform=en,S.useQuickSubscribe=dn,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
@@ -1,7 +1,7 @@
1
1
  import { Context } from './ctx';
2
2
  export declare const createRootCtx: <U extends object, V extends object>(name: string, useFn: (e: U) => V) => {
3
3
  resolveCtxName: (e: U) => string;
4
- Root: (e: U) => import("react/jsx-runtime").JSX.Element;
4
+ Root: import('react').FC<U>;
5
5
  useCtxStateStrict: (e: U) => Context<V>;
6
6
  useCtxState: (e: U) => Context<V>;
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-state-custom",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "A React library built with Vite and TypeScript",
5
5
  "type": "module",
6
6
  "main": "dist/index.umd.js",
@@ -15,31 +15,36 @@ export const createRootCtx = <U extends object, V extends object>(name: string,
15
15
 
16
16
  let ctxMountedCheck = new Set<string>()
17
17
 
18
- return {
19
- resolveCtxName,
20
- Root: (e: U) => {
21
- const ctxName = resolveCtxName(e)
22
- const ctx = useDataContext<V>(ctxName)
23
- const state = useFn(e)
24
- const stack = useMemo(() => new Error().stack, [])
25
18
 
26
- useDataSourceMultiple(
27
- ctx,
28
- ...Object.entries(state) as any
29
- )
19
+ const RootState: React.FC<U> = (e: U) => {
20
+ const ctxName = resolveCtxName(e)
21
+ const ctx = useDataContext<V>(ctxName)
22
+ const state = useFn(e)
23
+ const stack = useMemo(() => new Error().stack, [])
30
24
 
31
- useEffect(() => {
32
- if (ctxMountedCheck.has(ctxName)) {
33
- const err = new Error("RootContext " + ctxName + " are mounted more than once")
34
- err.stack = stack;
35
- throw err
36
- }
37
- ctxMountedCheck.add(ctxName)
38
- return () => { ctxMountedCheck.delete(ctxName) };
39
- })
25
+ useDataSourceMultiple(
26
+ ctx,
27
+ ...Object.entries(state) as any
28
+ )
40
29
 
41
- return <></>
42
- },
30
+ useEffect(() => {
31
+ if (ctxMountedCheck.has(ctxName)) {
32
+ const err = new Error("RootContext " + ctxName + " are mounted more than once")
33
+ err.stack = stack;
34
+ throw err
35
+ }
36
+ ctxMountedCheck.add(ctxName)
37
+ return () => { ctxMountedCheck.delete(ctxName) };
38
+ })
39
+
40
+ return <></>
41
+ }
42
+
43
+ RootState.displayName = `State[${useFn?.name??'??'}]`
44
+
45
+ return {
46
+ resolveCtxName,
47
+ Root: RootState,
43
48
  useCtxStateStrict: (e: U): Context<V> => {
44
49
  const ctxName = resolveCtxName(e)
45
50