@but212/atom-effect 0.15.1 → 0.15.3

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
@@ -31,7 +31,7 @@ const ne = {
31
31
  MAX_SIZE: 1e3,
32
32
  /** Number of objects to pre-allocate for performance-critical paths */
33
33
  WARMUP_SIZE: 100
34
- }, T = {
34
+ }, R = {
35
35
  /** Maximum effect executions per second to detect infinite loops (Legacy/Fallback) */
36
36
  MAX_EXECUTIONS_PER_SECOND: 1e3,
37
37
  /** Threshold for cleaning up old execution timestamps */
@@ -58,7 +58,7 @@ const ne = {
58
58
  /** Enable infinite loop detection warnings */
59
59
  WARN_INFINITE_LOOP: !0
60
60
  }, A = 1073741823, E = typeof process < "u" && process.env && process.env.NODE_ENV !== "production", re = Object.freeze([]);
61
- class C extends Error {
61
+ class N extends Error {
62
62
  /**
63
63
  * Creates a new AtomError
64
64
  * @param message - Error message describing what went wrong
@@ -69,7 +69,7 @@ class C extends Error {
69
69
  super(e), this.name = "AtomError", this.cause = t, this.recoverable = s, this.timestamp = /* @__PURE__ */ new Date();
70
70
  }
71
71
  }
72
- class R extends C {
72
+ class D extends N {
73
73
  /**
74
74
  * Creates a new ComputedError
75
75
  * @param message - Error message
@@ -79,7 +79,7 @@ class R extends C {
79
79
  super(e, t, !0), this.name = "ComputedError";
80
80
  }
81
81
  }
82
- class y extends C {
82
+ class y extends N {
83
83
  /**
84
84
  * Creates a new EffectError
85
85
  * @param message - Error message
@@ -89,7 +89,7 @@ class y extends C {
89
89
  super(e, t, !1), this.name = "EffectError";
90
90
  }
91
91
  }
92
- class P extends C {
92
+ class P extends N {
93
93
  /**
94
94
  * Creates a new SchedulerError
95
95
  * @param message - Error message
@@ -131,6 +131,10 @@ const l = {
131
131
  * Error thrown when subscribing to a dependency fails.
132
132
  */
133
133
  COMPUTED_DEPENDENCY_SUBSCRIPTION_FAILED: "Failed to subscribe to dependency",
134
+ /**
135
+ * Error thrown when accessing a disposed computed value.
136
+ */
137
+ COMPUTED_DISPOSED: "Cannot access a disposed computed",
134
138
  // ─────────────────────────────────────────────────────────────────
135
139
  // Atom errors
136
140
  // ─────────────────────────────────────────────────────────────────
@@ -199,7 +203,7 @@ let q = 0;
199
203
  function K(i, e, t) {
200
204
  if (i._visitedEpoch !== t) {
201
205
  if (i._visitedEpoch = t, i === e)
202
- throw new R("Indirect circular dependency detected");
206
+ throw new D("Indirect circular dependency detected");
203
207
  if (ce(i)) {
204
208
  const s = i.dependencies;
205
209
  for (let n = 0; n < s.length; n++) {
@@ -223,7 +227,7 @@ const I = {
223
227
  */
224
228
  checkCircular(i, e) {
225
229
  if (i === e)
226
- throw new R("Direct circular dependency detected");
230
+ throw new D("Direct circular dependency detected");
227
231
  this.enabled && (q++, K(i, e, q));
228
232
  },
229
233
  attachDebugInfo(i, e, t) {
@@ -267,7 +271,7 @@ class Z extends W {
267
271
  );
268
272
  if (e !== null && typeof e == "object" && "execute" in e)
269
273
  return this._addSubscriber(this._objSubs, e, g.HAS_OBJ_SUBS);
270
- throw new C(l.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
274
+ throw new N(l.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
271
275
  }
272
276
  /**
273
277
  * Gets the total number of active subscribers.
@@ -312,7 +316,7 @@ class Z extends W {
312
316
  h(e, t);
313
317
  } catch (_) {
314
318
  console.error(
315
- new C(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
319
+ new N(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
316
320
  );
317
321
  }
318
322
  }
@@ -326,7 +330,7 @@ class Z extends W {
326
330
  h.execute();
327
331
  } catch (_) {
328
332
  console.error(
329
- new C(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
333
+ new N(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
330
334
  );
331
335
  }
332
336
  }
@@ -397,8 +401,8 @@ class z {
397
401
  E && e && (e.acquired = 0, e.released = 0, e.rejected.frozen = 0, e.rejected.tooLarge = 0, e.rejected.poolFull = 0);
398
402
  }
399
403
  }
400
- const d = Object.freeze([]), O = Object.freeze([]), p = Object.freeze([]), x = new z(), U = new z(), D = new z();
401
- function N(i, e, t, s) {
404
+ const d = Object.freeze([]), O = Object.freeze([]), p = Object.freeze([]), x = new z(), U = new z(), C = new z();
405
+ function T(i, e, t, s) {
402
406
  if (e != null) {
403
407
  if ((typeof e == "object" || typeof e == "function") && typeof e.addDependency == "function") {
404
408
  e.addDependency(i);
@@ -458,18 +462,24 @@ function fe() {
458
462
  }
459
463
  class Ee {
460
464
  constructor() {
461
- this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this.isProcessing = !1, this.isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = T.MAX_FLUSH_ITERATIONS;
465
+ this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this.isProcessing = !1, this._isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = R.MAX_FLUSH_ITERATIONS;
462
466
  }
463
467
  /**
464
468
  * Returns the current operational phase of the scheduler.
465
469
  */
466
470
  get phase() {
467
- return this.isProcessing || this.isFlushingSync ? 2 : this.isBatching ? 1 : 0;
471
+ return this.isProcessing || this.isFlushingSync ? 2 : this._isBatching ? 1 : 0;
468
472
  }
469
473
  /** Current number of pending jobs. */
470
474
  get queueSize() {
471
475
  return this._size;
472
476
  }
477
+ /**
478
+ * Returns whether the scheduler is currently batching updates.
479
+ */
480
+ get isBatching() {
481
+ return this._isBatching;
482
+ }
473
483
  /**
474
484
  * Schedules a task for execution.
475
485
  */
@@ -478,7 +488,7 @@ class Ee {
478
488
  throw new P("Scheduler callback must be a function");
479
489
  const t = this._epoch;
480
490
  if (e._nextEpoch !== t) {
481
- if (e._nextEpoch = t, this.isBatching || this.isFlushingSync) {
491
+ if (e._nextEpoch = t, this._isBatching || this.isFlushingSync) {
482
492
  this.batchQueue[this.batchQueueSize++] = e;
483
493
  return;
484
494
  }
@@ -496,7 +506,7 @@ class Ee {
496
506
  const e = J();
497
507
  this._drainQueue(), e && $();
498
508
  } finally {
499
- this.isProcessing = !1, this._size > 0 && !this.isBatching && this.flush();
509
+ this.isProcessing = !1, this._size > 0 && !this._isBatching && this.flush();
500
510
  }
501
511
  }));
502
512
  }
@@ -526,7 +536,7 @@ class Ee {
526
536
  const c = s[o];
527
537
  c._nextEpoch !== t && (c._nextEpoch = t, n[r++] = c);
528
538
  }
529
- this._size = r, this.batchQueueSize = 0, s.length > T.BATCH_QUEUE_SHRINK_THRESHOLD && (s.length = 0);
539
+ this._size = r, this.batchQueueSize = 0, s.length > R.BATCH_QUEUE_SHRINK_THRESHOLD && (s.length = 0);
530
540
  }
531
541
  _drainQueue() {
532
542
  let e = 0;
@@ -562,19 +572,19 @@ class Ee {
562
572
  e.length = 0;
563
573
  }
564
574
  startBatch() {
565
- this.batchDepth++, this.isBatching = !0;
575
+ this.batchDepth++, this._isBatching = !0;
566
576
  }
567
577
  endBatch() {
568
578
  if (this.batchDepth === 0) {
569
579
  E && console.warn("endBatch() called without matching startBatch(). Ignoring.");
570
580
  return;
571
581
  }
572
- this.batchDepth--, this.batchDepth === 0 && (this.flushSync(), this.isBatching = !1);
582
+ this.batchDepth--, this.batchDepth === 0 && (this.flushSync(), this._isBatching = !1);
573
583
  }
574
584
  setMaxFlushIterations(e) {
575
- if (e < T.MIN_FLUSH_ITERATIONS)
585
+ if (e < R.MIN_FLUSH_ITERATIONS)
576
586
  throw new P(
577
- `Max flush iterations must be at least ${T.MIN_FLUSH_ITERATIONS}`
587
+ `Max flush iterations must be at least ${R.MIN_FLUSH_ITERATIONS}`
578
588
  );
579
589
  this.maxFlushIterations = e;
580
590
  }
@@ -610,7 +620,7 @@ class de {
610
620
  const f = new de();
611
621
  function pe(i) {
612
622
  if (typeof i != "function")
613
- throw new C("Untracked callback must be a function");
623
+ throw new N("Untracked callback must be a function");
614
624
  const e = f.current;
615
625
  f.current = null;
616
626
  try {
@@ -628,7 +638,7 @@ class Se extends Z {
628
638
  */
629
639
  get value() {
630
640
  const e = f.current;
631
- return e && N(this, e, this._fnSubs, this._objSubs), this._value;
641
+ return e && T(this, e, this._fnSubs, this._objSubs), this._value;
632
642
  }
633
643
  /**
634
644
  * Sets a new value and schedules notifications if the value has changed.
@@ -683,7 +693,7 @@ function m(i, e, t) {
683
693
  return new e(`Type error (${t}): ${i.message}`, i);
684
694
  if (i instanceof ReferenceError)
685
695
  return new e(`Reference error (${t}): ${i.message}`, i);
686
- if (i instanceof C)
696
+ if (i instanceof N)
687
697
  return i;
688
698
  const s = i instanceof Error ? i.message : String(i), n = i instanceof Error ? i : null;
689
699
  return new e(`Unexpected error (${t}): ${s}`, n);
@@ -699,16 +709,16 @@ function Ne(i) {
699
709
  }
700
710
  return ge(i) && "invalidate" in i && typeof i.invalidate == "function";
701
711
  }
702
- function Re(i) {
712
+ function Te(i) {
703
713
  return i !== null && typeof i == "object" && "dispose" in i && "run" in i && typeof i.dispose == "function" && typeof i.run == "function";
704
714
  }
705
715
  function te(i) {
706
716
  return i != null && typeof i.then == "function";
707
717
  }
708
- const se = u.RESOLVED | u.PENDING | u.REJECTED, V = Array(se + 1).fill(M.IDLE);
709
- V[u.RESOLVED] = M.RESOLVED;
710
- V[u.PENDING] = M.PENDING;
711
- V[u.REJECTED] = M.REJECTED;
718
+ const se = u.RESOLVED | u.PENDING | u.REJECTED, B = Array(se + 1).fill(M.IDLE);
719
+ B[u.RESOLVED] = M.RESOLVED;
720
+ B[u.PENDING] = M.PENDING;
721
+ B[u.REJECTED] = M.REJECTED;
712
722
  class be {
713
723
  constructor(e) {
714
724
  this._owner = e, this._epoch = -1, this._nextDeps = d, this._nextVersions = p, this._depCount = 0;
@@ -730,7 +740,7 @@ class be {
730
740
  class ie extends Z {
731
741
  constructor(e, t = {}) {
732
742
  if (typeof e != "function")
733
- throw new R(l.COMPUTED_MUST_BE_FUNCTION);
743
+ throw new D(l.COMPUTED_MUST_BE_FUNCTION);
734
744
  if (super(), this.MAX_ASYNC_RETRIES = 3, this._value = void 0, this.flags = u.DIRTY | u.IDLE, this._error = null, this._promiseId = 0, this._equal = t.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in t ? t.defaultValue : Y, this._hasDefaultValue = this._defaultValue !== Y, this._onError = t.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._fnSubs = [], this._objSubs = [], this._dependencies = d, this._dependencyVersions = p, this._unsubscribes = O, this._cachedErrors = null, this._errorCacheEpoch = -1, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._trackable = new be(this), I.attachDebugInfo(this, "computed", this.id), I.enabled) {
735
745
  const s = this;
736
746
  s.subscriberCount = this.subscriberCount.bind(this), s.isDirty = () => (this.flags & u.DIRTY) !== 0, s.dependencies = this._dependencies, s.stateFlags = "";
@@ -743,11 +753,13 @@ class ie extends Z {
743
753
  }
744
754
  get value() {
745
755
  const e = f.current;
746
- e && N(this, e, this._fnSubs, this._objSubs);
756
+ e && T(this, e, this._fnSubs, this._objSubs);
747
757
  const t = this.flags;
758
+ if (t & u.DISPOSED)
759
+ throw new D(l.COMPUTED_DISPOSED);
748
760
  if (t & u.RECOMPUTING) {
749
761
  if (this._hasDefaultValue) return this._defaultValue;
750
- throw new R(l.COMPUTED_CIRCULAR_DEPENDENCY);
762
+ throw new D(l.COMPUTED_CIRCULAR_DEPENDENCY);
751
763
  }
752
764
  t & (u.DIRTY | u.IDLE) && this._recompute();
753
765
  const s = this.flags;
@@ -758,11 +770,11 @@ class ie extends Z {
758
770
  }
759
771
  get state() {
760
772
  const e = f.current;
761
- return e && N(this, e, this._fnSubs, this._objSubs), V[this.flags & se];
773
+ return e && T(this, e, this._fnSubs, this._objSubs), B[this.flags & se];
762
774
  }
763
775
  get hasError() {
764
776
  const e = f.current;
765
- if (e && N(this, e, this._fnSubs, this._objSubs), this.flags & (u.REJECTED | u.HAS_ERROR)) return !0;
777
+ if (e && T(this, e, this._fnSubs, this._objSubs), this.flags & (u.REJECTED | u.HAS_ERROR)) return !0;
766
778
  const s = this._dependencies;
767
779
  for (let n = 0, r = s.length; n < r; n++) {
768
780
  const o = s[n];
@@ -775,7 +787,7 @@ class ie extends Z {
775
787
  }
776
788
  get errors() {
777
789
  const e = f.current;
778
- if (e && N(this, e, this._fnSubs, this._objSubs), !this.hasError) return re;
790
+ if (e && T(this, e, this._fnSubs, this._objSubs), !this.hasError) return re;
779
791
  const t = ae();
780
792
  if (this._errorCacheEpoch === t && this._cachedErrors !== null)
781
793
  return this._cachedErrors;
@@ -786,7 +798,7 @@ class ie extends Z {
786
798
  const h = n[o];
787
799
  if (h && "errors" in h) {
788
800
  const _ = h.errors;
789
- for (let a = 0, B = _.length; a < B; a++) {
801
+ for (let a = 0, V = _.length; a < V; a++) {
790
802
  const X = _[a];
791
803
  X && s.add(X);
792
804
  }
@@ -797,20 +809,20 @@ class ie extends Z {
797
809
  }
798
810
  get lastError() {
799
811
  const e = f.current;
800
- return e && N(this, e, this._fnSubs, this._objSubs), this._error;
812
+ return e && T(this, e, this._fnSubs, this._objSubs), this._error;
801
813
  }
802
814
  get isPending() {
803
815
  const e = f.current;
804
- return e && N(this, e, this._fnSubs, this._objSubs), (this.flags & u.PENDING) !== 0;
816
+ return e && T(this, e, this._fnSubs, this._objSubs), (this.flags & u.PENDING) !== 0;
805
817
  }
806
818
  get isResolved() {
807
819
  const e = f.current;
808
- return e && N(this, e, this._fnSubs, this._objSubs), (this.flags & u.RESOLVED) !== 0;
820
+ return e && T(this, e, this._fnSubs, this._objSubs), (this.flags & u.RESOLVED) !== 0;
809
821
  }
810
822
  invalidate() {
811
823
  this._markDirty();
812
824
  const e = this._dependencyVersions;
813
- e !== p && (D.release(e), this._dependencyVersions = p), this._errorCacheEpoch = -1, this._cachedErrors = null;
825
+ e !== p && (C.release(e), this._dependencyVersions = p), this._errorCacheEpoch = -1, this._cachedErrors = null;
814
826
  }
815
827
  dispose() {
816
828
  const e = this._unsubscribes;
@@ -824,7 +836,7 @@ class ie extends Z {
824
836
  const t = this._dependencies;
825
837
  t !== d && (x.release(t), this._dependencies = d);
826
838
  const s = this._dependencyVersions;
827
- s !== p && (D.release(s), this._dependencyVersions = p), this._fnSubs = [], this._objSubs = [], this.flags = u.DISPOSED | u.DIRTY | u.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID, this._cachedErrors = null, this._errorCacheEpoch = -1;
839
+ s !== p && (C.release(s), this._dependencyVersions = p), this._fnSubs = [], this._objSubs = [], this.flags = u.DISPOSED | u.DIRTY | u.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID, this._cachedErrors = null, this._errorCacheEpoch = -1;
828
840
  }
829
841
  _clearDirty() {
830
842
  this.flags &= -9;
@@ -853,7 +865,7 @@ class ie extends Z {
853
865
  return;
854
866
  this._setRecomputing(!0);
855
867
  const e = this._trackable, t = this._dependencies, s = this._dependencyVersions;
856
- e._epoch = ee(), e._nextDeps = x.acquire(), e._nextVersions = D.acquire(), e._depCount = 0;
868
+ e._epoch = ee(), e._nextDeps = x.acquire(), e._nextVersions = C.acquire(), e._depCount = 0;
857
869
  let n = !1;
858
870
  try {
859
871
  const r = f.run(e, this._fn), o = e._nextDeps, c = e._nextVersions, h = e._depCount;
@@ -869,7 +881,7 @@ class ie extends Z {
869
881
  }
870
882
  this._handleComputationError(o);
871
883
  } finally {
872
- n ? (t !== d && x.release(t), s !== p && D.release(s)) : (x.release(e._nextDeps), D.release(e._nextVersions)), e.reset(), this._setRecomputing(!1);
884
+ n ? (t !== d && x.release(t), s !== p && C.release(s)) : (x.release(e._nextDeps), C.release(e._nextVersions)), e.reset(), this._setRecomputing(!1);
873
885
  }
874
886
  }
875
887
  _handleAsyncComputation(e) {
@@ -882,7 +894,7 @@ class ie extends Z {
882
894
  this._asyncRetryCount++, this._markDirty();
883
895
  return;
884
896
  }
885
- const o = new R(
897
+ const o = new D(
886
898
  `Async drift exceeded threshold after ${this.MAX_ASYNC_RETRIES} retries.`
887
899
  );
888
900
  this._handleAsyncRejection(o);
@@ -906,7 +918,7 @@ class ie extends Z {
906
918
  return e;
907
919
  }
908
920
  _handleAsyncRejection(e) {
909
- const t = m(e, R, l.COMPUTED_ASYNC_COMPUTATION_FAILED);
921
+ const t = m(e, D, l.COMPUTED_ASYNC_COMPUTATION_FAILED);
910
922
  this.flags & u.REJECTED || (this.version = this.version + 1 & A), this._error = t, this._setRejected(), this._clearDirty();
911
923
  const s = this._onError;
912
924
  if (s)
@@ -921,7 +933,7 @@ class ie extends Z {
921
933
  (!(this.flags & u.RESOLVED) || !this._equal(this._value, e)) && (this.version = this.version + 1 & A), this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1), this._cachedErrors = null, this._errorCacheEpoch = -1;
922
934
  }
923
935
  _handleComputationError(e) {
924
- const t = m(e, R, l.COMPUTED_COMPUTATION_FAILED);
936
+ const t = m(e, D, l.COMPUTED_COMPUTATION_FAILED);
925
937
  this._error = t, this._setRejected(), this._clearDirty(), this._setRecomputing(!1);
926
938
  const s = this._onError;
927
939
  if (s)
@@ -935,7 +947,7 @@ class ie extends Z {
935
947
  _handlePending() {
936
948
  if (this._hasDefaultValue)
937
949
  return this._defaultValue;
938
- throw new R(l.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
950
+ throw new D(l.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
939
951
  }
940
952
  _handleRejected() {
941
953
  const e = this._error;
@@ -953,13 +965,13 @@ class ie extends Z {
953
965
  }
954
966
  }
955
967
  Object.freeze(ie.prototype);
956
- function Te(i, e = {}) {
968
+ function Re(i, e = {}) {
957
969
  return new ie(i, e);
958
970
  }
959
971
  class Ie extends W {
960
972
  constructor(e, t = {}) {
961
- super(), this._cleanup = null, this._dependencies = d, this._dependencyVersions = p, this._unsubscribes = O, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._executeTask = void 0, this._onError = t.onError ?? null, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? T.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? T.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = t.trackModifications ?? !1, this._executionCount = 0, this._historyPtr = 0;
962
- const s = Number.isFinite(this._maxExecutions), n = s ? Math.min(this._maxExecutions + 1, T.MAX_EXECUTIONS_PER_SECOND + 1) : 0;
973
+ super(), this._cleanup = null, this._dependencies = d, this._dependencyVersions = p, this._unsubscribes = O, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._executeTask = void 0, this._onError = t.onError ?? null, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? R.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? R.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = t.trackModifications ?? !1, this._executionCount = 0, this._historyPtr = 0;
974
+ const s = Number.isFinite(this._maxExecutions), n = s ? Math.min(this._maxExecutions + 1, R.MAX_EXECUTIONS_PER_SECOND + 1) : 0;
963
975
  this._historyCapacity = n, this._history = E && s && n > 0 ? new Array(n).fill(0) : null, this._execId = 0, I.attachDebugInfo(this, "effect", this.id);
964
976
  }
965
977
  run() {
@@ -982,7 +994,7 @@ class Ie extends W {
982
994
  const s = this._dependencies;
983
995
  s !== d && (x.release(s), this._dependencies = d);
984
996
  const n = this._dependencyVersions;
985
- n !== p && (D.release(n), this._dependencyVersions = p), this._executeTask = void 0;
997
+ n !== p && (C.release(n), this._dependencyVersions = p), this._executeTask = void 0;
986
998
  }
987
999
  addDependency(e) {
988
1000
  if (!(this.flags & S.EXECUTING)) return;
@@ -1010,8 +1022,8 @@ class Ie extends W {
1010
1022
  if (typeof h == "function")
1011
1023
  try {
1012
1024
  h();
1013
- } catch (B) {
1014
- this._handleExecutionError(B, l.EFFECT_CLEANUP_FAILED);
1025
+ } catch (V) {
1026
+ this._handleExecutionError(V, l.EFFECT_CLEANUP_FAILED);
1015
1027
  }
1016
1028
  return;
1017
1029
  }
@@ -1026,7 +1038,7 @@ class Ie extends W {
1026
1038
  }
1027
1039
  }
1028
1040
  _prepareEffectExecutionContext() {
1029
- const e = this._dependencies, t = this._dependencyVersions, s = this._unsubscribes, n = x.acquire(), r = D.acquire(), o = U.acquire(), c = ee();
1041
+ const e = this._dependencies, t = this._dependencyVersions, s = this._unsubscribes, n = x.acquire(), r = C.acquire(), o = U.acquire(), c = ee();
1030
1042
  if (e !== d)
1031
1043
  for (let h = 0, _ = e.length; h < _; h++) {
1032
1044
  const a = e[h];
@@ -1045,9 +1057,9 @@ class Ie extends W {
1045
1057
  }
1046
1058
  x.release(s);
1047
1059
  }
1048
- e.prevUnsubs !== O && U.release(e.prevUnsubs), e.prevVersions !== p && D.release(e.prevVersions);
1060
+ e.prevUnsubs !== O && U.release(e.prevUnsubs), e.prevVersions !== p && C.release(e.prevVersions);
1049
1061
  } else {
1050
- x.release(e.nextDeps), D.release(e.nextVersions);
1062
+ x.release(e.nextDeps), C.release(e.nextVersions);
1051
1063
  const n = e.nextUnsubs;
1052
1064
  for (let r = 0, o = n.length; r < o; r++)
1053
1065
  n[r]?.();
@@ -1102,7 +1114,7 @@ class Ie extends W {
1102
1114
  }
1103
1115
  _checkInfiniteLoop() {
1104
1116
  const e = H;
1105
- this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), fe() > T.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
1117
+ this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), fe() > R.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
1106
1118
  const s = this._history;
1107
1119
  if (s) {
1108
1120
  const n = Date.now(), r = this._historyPtr, o = this._historyCapacity;
@@ -1175,7 +1187,7 @@ function Oe(i, e = {}) {
1175
1187
  }
1176
1188
  function xe(i) {
1177
1189
  if (typeof i != "function")
1178
- throw new C("Batch callback must be a function");
1190
+ throw new N("Batch callback must be a function");
1179
1191
  F.startBatch();
1180
1192
  try {
1181
1193
  return i();
@@ -1185,21 +1197,21 @@ function xe(i) {
1185
1197
  }
1186
1198
  export {
1187
1199
  M as AsyncState,
1188
- C as AtomError,
1189
- R as ComputedError,
1200
+ N as AtomError,
1201
+ D as ComputedError,
1190
1202
  G as DEBUG_CONFIG,
1191
1203
  I as DEBUG_RUNTIME,
1192
1204
  y as EffectError,
1193
1205
  De as POOL_CONFIG,
1194
- T as SCHEDULER_CONFIG,
1206
+ R as SCHEDULER_CONFIG,
1195
1207
  P as SchedulerError,
1196
1208
  Ce as atom,
1197
1209
  xe as batch,
1198
- Te as computed,
1210
+ Re as computed,
1199
1211
  Oe as effect,
1200
1212
  ge as isAtom,
1201
1213
  Ne as isComputed,
1202
- Re as isEffect,
1214
+ Te as isEffect,
1203
1215
  F as scheduler,
1204
1216
  pe as untracked
1205
1217
  };