@but212/atom-effect 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const re = {
1
+ const ne = {
2
2
  /** One second in milliseconds */
3
3
  ONE_SECOND_MS: 1e3
4
4
  }, M = {
@@ -6,15 +6,15 @@ const re = {
6
6
  PENDING: "pending",
7
7
  RESOLVED: "resolved",
8
8
  REJECTED: "rejected"
9
- }, S = {
9
+ }, g = {
10
10
  DISPOSED: 1,
11
11
  HAS_FN_SUBS: 2,
12
12
  HAS_OBJ_SUBS: 4
13
- }, d = {
14
- ...S,
13
+ }, S = {
14
+ ...g,
15
15
  EXECUTING: 8
16
16
  }, u = {
17
- ...S,
17
+ ...g,
18
18
  DIRTY: 8,
19
19
  IDLE: 16,
20
20
  PENDING: 32,
@@ -22,16 +22,16 @@ const re = {
22
22
  REJECTED: 128,
23
23
  RECOMPUTING: 256,
24
24
  HAS_ERROR: 512
25
- }, D = {
26
- ...S,
25
+ }, b = {
26
+ ...g,
27
27
  SYNC: 8,
28
28
  NOTIFICATION_SCHEDULED: 16
29
- }, Te = {
29
+ }, De = {
30
30
  /** Maximum number of pooled objects to prevent memory bloat */
31
31
  MAX_SIZE: 1e3,
32
32
  /** Number of objects to pre-allocate for performance-critical paths */
33
33
  WARMUP_SIZE: 100
34
- }, A = {
34
+ }, T = {
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 */
@@ -57,8 +57,8 @@ const re = {
57
57
  MAX_DEPENDENCIES: 1e3,
58
58
  /** Enable infinite loop detection warnings */
59
59
  WARN_INFINITE_LOOP: !0
60
- }, b = 1073741823, oe = 20, z = 1 << oe - 1, g = typeof process < "u" && process.env && process.env.NODE_ENV !== "production", ce = Object.freeze([]);
61
- class T extends Error {
60
+ }, A = 1073741823, E = typeof process < "u" && process.env && process.env.NODE_ENV !== "production", re = Object.freeze([]);
61
+ class C 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 T 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 x extends T {
72
+ class R extends C {
73
73
  /**
74
74
  * Creates a new ComputedError
75
75
  * @param message - Error message
@@ -79,7 +79,7 @@ class x extends T {
79
79
  super(e, t, !0), this.name = "ComputedError";
80
80
  }
81
81
  }
82
- class R extends T {
82
+ class y extends C {
83
83
  /**
84
84
  * Creates a new EffectError
85
85
  * @param message - Error message
@@ -89,7 +89,7 @@ class R extends T {
89
89
  super(e, t, !1), this.name = "EffectError";
90
90
  }
91
91
  }
92
- class F extends T {
92
+ class P extends C {
93
93
  /**
94
94
  * Creates a new SchedulerError
95
95
  * @param message - Error message
@@ -107,6 +107,10 @@ const l = {
107
107
  * Error thrown when computed() receives a non-function argument.
108
108
  */
109
109
  COMPUTED_MUST_BE_FUNCTION: "Computed function must be a function",
110
+ /**
111
+ * Error thrown when subscribe() receives an invalid listener.
112
+ */
113
+ COMPUTED_SUBSCRIBER_MUST_BE_FUNCTION: "Subscriber listener must be a function or Subscriber object",
110
114
  /**
111
115
  * Error thrown when accessing a pending async computed without a default value.
112
116
  */
@@ -119,6 +123,14 @@ const l = {
119
123
  * Error thrown when an asynchronous computed computation fails.
120
124
  */
121
125
  COMPUTED_ASYNC_COMPUTATION_FAILED: "Async computed computation failed",
126
+ /**
127
+ * Error thrown when a circular dependency is detected during computation.
128
+ */
129
+ COMPUTED_CIRCULAR_DEPENDENCY: "Circular dependency detected during computation",
130
+ /**
131
+ * Error thrown when subscribing to a dependency fails.
132
+ */
133
+ COMPUTED_DEPENDENCY_SUBSCRIPTION_FAILED: "Failed to subscribe to dependency",
122
134
  // ─────────────────────────────────────────────────────────────────
123
135
  // Atom errors
124
136
  // ─────────────────────────────────────────────────────────────────
@@ -126,6 +138,10 @@ const l = {
126
138
  * Error thrown when atom.subscribe() receives an invalid listener.
127
139
  */
128
140
  ATOM_SUBSCRIBER_MUST_BE_FUNCTION: "Subscription listener must be a function or Subscriber object",
141
+ /**
142
+ * Error thrown when the atom subscriber notification process fails.
143
+ */
144
+ ATOM_SUBSCRIBER_EXECUTION_FAILED: "Error occurred while executing atom subscribers",
129
145
  /**
130
146
  * Error logged when an individual subscriber throws during notification.
131
147
  * @remarks This error is caught and logged to prevent cascading failures.
@@ -146,24 +162,48 @@ const l = {
146
162
  * Error thrown when an effect's cleanup function fails.
147
163
  */
148
164
  EFFECT_CLEANUP_FAILED: "Effect cleanup function execution failed",
165
+ /**
166
+ * Error thrown when attempting to run a disposed effect.
167
+ */
168
+ EFFECT_DISPOSED: "Cannot run a disposed effect",
169
+ // ─────────────────────────────────────────────────────────────────
170
+ // Debug warnings
171
+ // ─────────────────────────────────────────────────────────────────
172
+ /**
173
+ * Warning message for large dependency graphs.
174
+ *
175
+ * @param count - The number of dependencies detected
176
+ * @returns Formatted warning message with dependency count
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * console.warn(ERROR_MESSAGES.LARGE_DEPENDENCY_GRAPH(150));
181
+ * // Output: "Large dependency graph detected: 150 dependencies"
182
+ * ```
183
+ */
184
+ LARGE_DEPENDENCY_GRAPH: (i) => `Large dependency graph detected: ${i} dependencies`,
185
+ /**
186
+ * Warning logged when attempting to unsubscribe a non-existent listener.
187
+ */
188
+ UNSUBSCRIBE_NON_EXISTENT: "Attempted to unsubscribe a non-existent listener",
149
189
  /**
150
190
  * Error logged when the onError callback itself throws an error.
151
191
  * @remarks This prevents cascading failures from masking the original error.
152
192
  */
153
193
  CALLBACK_ERROR_IN_ERROR_HANDLER: "Error occurred during onError callback execution"
154
- }, w = /* @__PURE__ */ Symbol("debugName"), he = /* @__PURE__ */ Symbol("id"), B = /* @__PURE__ */ Symbol("type"), Q = /* @__PURE__ */ Symbol("noDefaultValue");
155
- function ue(n) {
156
- return "dependencies" in n && Array.isArray(n.dependencies);
194
+ }, w = /* @__PURE__ */ Symbol("debugName"), oe = /* @__PURE__ */ Symbol("id"), k = /* @__PURE__ */ Symbol("type"), Y = /* @__PURE__ */ Symbol("noDefaultValue");
195
+ function ce(i) {
196
+ return "dependencies" in i && Array.isArray(i.dependencies);
157
197
  }
158
- let Y = 0;
159
- function K(n, e, t) {
160
- if (n._visitedEpoch !== t) {
161
- if (n._visitedEpoch = t, n === e)
162
- throw new x("Indirect circular dependency detected");
163
- if (ue(n)) {
164
- const s = n.dependencies;
165
- for (let i = 0; i < s.length; i++) {
166
- const r = s[i];
198
+ let q = 0;
199
+ function K(i, e, t) {
200
+ if (i._visitedEpoch !== t) {
201
+ if (i._visitedEpoch = t, i === e)
202
+ throw new R("Indirect circular dependency detected");
203
+ if (ce(i)) {
204
+ const s = i.dependencies;
205
+ for (let n = 0; n < s.length; n++) {
206
+ const r = s[n];
167
207
  r && K(r, e, t);
168
208
  }
169
209
  }
@@ -173,45 +213,45 @@ const I = {
173
213
  enabled: typeof process < "u" && process.env?.NODE_ENV === "development",
174
214
  maxDependencies: G.MAX_DEPENDENCIES,
175
215
  warnInfiniteLoop: G.WARN_INFINITE_LOOP,
176
- warn(n, e) {
177
- this.enabled && n && console.warn(`[Atom Effect] ${e}`);
216
+ warn(i, e) {
217
+ this.enabled && i && console.warn(`[Atom Effect] ${e}`);
178
218
  },
179
219
  /**
180
220
  * Checks for circular dependencies.
181
221
  * Direct check runs always; indirect check only in dev mode.
182
222
  * @throws {ComputedError} When circular dependency detected
183
223
  */
184
- checkCircular(n, e) {
185
- if (n === e)
186
- throw new x("Direct circular dependency detected");
187
- this.enabled && (Y++, K(n, e, Y));
224
+ checkCircular(i, e) {
225
+ if (i === e)
226
+ throw new R("Direct circular dependency detected");
227
+ this.enabled && (q++, K(i, e, q));
188
228
  },
189
- attachDebugInfo(n, e, t) {
229
+ attachDebugInfo(i, e, t) {
190
230
  if (!this.enabled)
191
231
  return;
192
- const s = n;
193
- s[w] = `${e}_${t}`, s[he] = t, s[B] = e;
232
+ const s = i;
233
+ s[w] = `${e}_${t}`, s[oe] = t, s[k] = e;
194
234
  },
195
- getDebugName(n) {
196
- if (n != null && w in n)
197
- return n[w];
235
+ getDebugName(i) {
236
+ if (i != null && w in i)
237
+ return i[w];
198
238
  },
199
- getDebugType(n) {
200
- if (n != null && B in n)
201
- return n[B];
239
+ getDebugType(i) {
240
+ if (i != null && k in i)
241
+ return i[k];
202
242
  }
203
243
  };
204
- let _e = 1;
205
- const le = () => _e++;
244
+ let he = 1;
245
+ const ue = () => he++;
206
246
  class W {
207
247
  constructor() {
208
- this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this._modifiedAtEpoch = -1, this._visitedEpoch = -1, this.id = le() & b, this._tempUnsub = void 0;
248
+ this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this._modifiedAtEpoch = -1, this._visitedEpoch = -1, this.id = ue() & A, this._tempUnsub = void 0;
209
249
  }
210
250
  /**
211
251
  * Calculates the logical distance (shift) between current and cached version.
212
252
  */
213
253
  getShift(e) {
214
- return this.version - e & b;
254
+ return this.version - e & A;
215
255
  }
216
256
  }
217
257
  class Z extends W {
@@ -223,11 +263,11 @@ class Z extends W {
223
263
  return this._addSubscriber(
224
264
  this._fnSubs,
225
265
  e,
226
- S.HAS_FN_SUBS
266
+ g.HAS_FN_SUBS
227
267
  );
228
268
  if (e !== null && typeof e == "object" && "execute" in e)
229
- return this._addSubscriber(this._objSubs, e, S.HAS_OBJ_SUBS);
230
- throw new T(l.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
269
+ return this._addSubscriber(this._objSubs, e, g.HAS_OBJ_SUBS);
270
+ throw new C(l.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
231
271
  }
232
272
  /**
233
273
  * Gets the total number of active subscribers.
@@ -240,8 +280,11 @@ class Z extends W {
240
280
  * Uses swap-and-pop for efficient removals.
241
281
  */
242
282
  _addSubscriber(e, t, s) {
243
- if (e.indexOf(t) !== -1) return () => {
244
- };
283
+ if (e.indexOf(t) !== -1)
284
+ return E && console.warn(
285
+ "Attempted to subscribe the same listener twice. Ignoring duplicate subscription."
286
+ ), () => {
287
+ };
245
288
  e.push(t), this.flags |= s;
246
289
  let r = !1;
247
290
  return () => {
@@ -258,9 +301,9 @@ class Z extends W {
258
301
  * Notifies all subscribers of a change.
259
302
  */
260
303
  _notifySubscribers(e, t) {
261
- const s = this.flags, i = S.HAS_FN_SUBS | S.HAS_OBJ_SUBS;
262
- if (s & i) {
263
- if (s & S.HAS_FN_SUBS) {
304
+ const s = this.flags, n = g.HAS_FN_SUBS | g.HAS_OBJ_SUBS;
305
+ if (s & n) {
306
+ if (s & g.HAS_FN_SUBS) {
264
307
  const r = this._fnSubs;
265
308
  for (let o = 0, c = r.length; o < c; o++) {
266
309
  const h = r[o];
@@ -269,12 +312,12 @@ class Z extends W {
269
312
  h(e, t);
270
313
  } catch (_) {
271
314
  console.error(
272
- new T(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
315
+ new C(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
273
316
  );
274
317
  }
275
318
  }
276
319
  }
277
- if (s & S.HAS_OBJ_SUBS) {
320
+ if (s & g.HAS_OBJ_SUBS) {
278
321
  const r = this._objSubs;
279
322
  for (let o = 0, c = r.length; o < c; o++) {
280
323
  const h = r[o];
@@ -283,7 +326,7 @@ class Z extends W {
283
326
  h.execute();
284
327
  } catch (_) {
285
328
  console.error(
286
- new T(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
329
+ new C(l.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, _)
287
330
  );
288
331
  }
289
332
  }
@@ -291,24 +334,24 @@ class Z extends W {
291
334
  }
292
335
  }
293
336
  }
294
- class ae {
337
+ class _e {
295
338
  constructor() {
296
- this.acquired = 0, this.released = 0, this.rejected = new fe();
339
+ this.acquired = 0, this.released = 0, this.rejected = new le();
297
340
  }
298
341
  }
299
- class fe {
342
+ class le {
300
343
  constructor() {
301
344
  this.frozen = 0, this.tooLarge = 0, this.poolFull = 0;
302
345
  }
303
346
  }
304
- class k {
347
+ class z {
305
348
  constructor() {
306
- this.pool = [], this.maxPoolSize = 50, this.maxReusableCapacity = 256, this.stats = g ? new ae() : null;
349
+ this.pool = [], this.maxPoolSize = 50, this.maxReusableCapacity = 256, this.stats = E ? new _e() : null;
307
350
  }
308
351
  /** Acquires an array from the pool or creates a new one if the pool is empty. */
309
352
  acquire() {
310
353
  const e = this.stats;
311
- return g && e && e.acquired++, this.pool.pop() ?? [];
354
+ return E && e && e.acquired++, this.pool.pop() ?? [];
312
355
  }
313
356
  /**
314
357
  * Releases an array back to the pool.
@@ -317,31 +360,31 @@ class k {
317
360
  release(e, t) {
318
361
  if (t && e === t || Object.isFrozen(e)) {
319
362
  const c = this.stats;
320
- g && c && e !== t && c.rejected.frozen++;
363
+ E && c && e !== t && c.rejected.frozen++;
321
364
  return;
322
365
  }
323
- const s = e.length, i = this.pool, r = i.length;
366
+ const s = e.length, n = this.pool, r = n.length;
324
367
  if (s > this.maxReusableCapacity || r >= this.maxPoolSize) {
325
368
  const c = this.stats;
326
- g && c && (s > this.maxReusableCapacity ? c.rejected.tooLarge++ : c.rejected.poolFull++);
369
+ E && c && (s > this.maxReusableCapacity ? c.rejected.tooLarge++ : c.rejected.poolFull++);
327
370
  return;
328
371
  }
329
- e.length = 0, i.push(e);
372
+ e.length = 0, n.push(e);
330
373
  const o = this.stats;
331
- g && o && o.released++;
374
+ E && o && o.released++;
332
375
  }
333
376
  /** Returns current stats for the pool (dev mode only). */
334
377
  getStats() {
335
378
  const e = this.stats;
336
- if (!g || !e) return null;
337
- const { acquired: t, released: s, rejected: i } = e, r = i.frozen + i.tooLarge + i.poolFull;
379
+ if (!E || !e) return null;
380
+ const { acquired: t, released: s, rejected: n } = e, r = n.frozen + n.tooLarge + n.poolFull;
338
381
  return {
339
382
  acquired: t,
340
383
  released: s,
341
384
  rejected: {
342
- frozen: i.frozen,
343
- tooLarge: i.tooLarge,
344
- poolFull: i.poolFull
385
+ frozen: n.frozen,
386
+ tooLarge: n.tooLarge,
387
+ poolFull: n.poolFull
345
388
  },
346
389
  leaked: t - s - r,
347
390
  poolSize: this.pool.length
@@ -351,76 +394,71 @@ class k {
351
394
  reset() {
352
395
  this.pool.length = 0;
353
396
  const e = this.stats;
354
- g && e && (e.acquired = 0, e.released = 0, e.rejected.frozen = 0, e.rejected.tooLarge = 0, e.rejected.poolFull = 0);
397
+ E && e && (e.acquired = 0, e.released = 0, e.rejected.frozen = 0, e.rejected.tooLarge = 0, e.rejected.poolFull = 0);
355
398
  }
356
399
  }
357
- const f = Object.freeze([]), N = Object.freeze([]), p = Object.freeze([]), O = new k(), U = new k(), C = new k();
358
- function y(n, e, t, s) {
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) {
359
402
  if (e != null) {
360
403
  if ((typeof e == "object" || typeof e == "function") && typeof e.addDependency == "function") {
361
- e.addDependency(n);
404
+ e.addDependency(i);
362
405
  return;
363
406
  }
364
407
  if (typeof e == "function") {
365
- const i = e;
366
- t.indexOf(i) === -1 && (t.push(i), n.flags |= S.HAS_FN_SUBS);
408
+ const n = e;
409
+ t.indexOf(n) === -1 && (t.push(n), i.flags |= g.HAS_FN_SUBS);
367
410
  return;
368
411
  }
369
- typeof e == "object" && typeof e.execute == "function" && s.indexOf(e) === -1 && (s.push(e), n.flags |= S.HAS_OBJ_SUBS);
412
+ typeof e == "object" && typeof e.execute == "function" && s.indexOf(e) === -1 && (s.push(e), i.flags |= g.HAS_OBJ_SUBS);
370
413
  }
371
414
  }
372
- function q(n, e, t, s) {
373
- const i = n.length, r = e.length, o = e !== f && r > 0;
415
+ function Q(i, e, t, s) {
416
+ const n = i.length, r = e.length, o = e !== d && r > 0;
374
417
  if (o)
375
418
  for (let h = 0; h < r; h++) {
376
419
  const _ = e[h];
377
420
  _ && (_._tempUnsub = t[h]);
378
421
  }
379
422
  const c = U.acquire();
380
- c.length = i;
381
- for (let h = 0; h < i; h++) {
382
- const _ = n[h];
423
+ c.length = n;
424
+ for (let h = 0; h < n; h++) {
425
+ const _ = i[h];
383
426
  if (!_) continue;
384
- const E = _._tempUnsub;
385
- E ? (c[h] = E, _._tempUnsub = void 0) : (I.checkCircular(_, s), c[h] = _.subscribe(s));
427
+ const a = _._tempUnsub;
428
+ a ? (c[h] = a, _._tempUnsub = void 0) : (I.checkCircular(_, s), c[h] = _.subscribe(s));
386
429
  }
387
430
  if (o)
388
431
  for (let h = 0; h < r; h++) {
389
432
  const _ = e[h];
390
433
  if (_) {
391
- const E = _._tempUnsub;
392
- E && (E(), _._tempUnsub = void 0);
434
+ const a = _._tempUnsub;
435
+ a && (a(), _._tempUnsub = void 0);
393
436
  }
394
437
  }
395
- return t !== N && U.release(t), c;
438
+ return t !== O && U.release(t), c;
396
439
  }
397
- let P = 0;
440
+ let v = 0;
398
441
  function ee() {
399
- return P = P + 1 & b || 1, P;
442
+ return v = v + 1 & A || 1, v;
400
443
  }
401
- function Ee() {
402
- return P;
444
+ function ae() {
445
+ return v;
403
446
  }
404
447
  let H = 0, j = 0, L = !1;
405
448
  function J() {
406
- return L ? (g && console.warn(
449
+ return L ? (E && console.warn(
407
450
  "Warning: startFlush() called during flush - ignored to prevent infinite loop detection bypass"
408
- ), !1) : (L = !0, H = H + 1 & b, j = 0, !0);
451
+ ), !1) : (L = !0, H = H + 1 & A || 1, j = 0, !0);
409
452
  }
410
453
  function $() {
411
454
  L = !1;
412
455
  }
413
- function de() {
456
+ function fe() {
414
457
  return L ? ++j : 0;
415
458
  }
416
- class pe {
459
+ class Ee {
417
460
  constructor() {
418
- this._queueBuffers = [
419
- [[], []],
420
- // Normal [0][0], [0][1]
421
- [[], []]
422
- // Urgent [1][0], [1][1]
423
- ], this._bufferIndices = new Uint8Array(2), this._sizes = new Uint32Array(2), this._activeQueues = [this._queueBuffers[0][0], this._queueBuffers[1][0]], this._epoch = 0, this.isProcessing = !1, this.isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = A.MAX_FLUSH_ITERATIONS;
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;
424
462
  }
425
463
  /**
426
464
  * Returns the current operational phase of the scheduler.
@@ -428,57 +466,37 @@ class pe {
428
466
  get phase() {
429
467
  return this.isProcessing || this.isFlushingSync ? 2 : this.isBatching ? 1 : 0;
430
468
  }
431
- /** Current number of pending normal jobs. */
469
+ /** Current number of pending jobs. */
432
470
  get queueSize() {
433
- return this._sizes[0];
434
- }
435
- /** Current number of pending urgent jobs. */
436
- get urgentQueueSize() {
437
- return this._sizes[1];
471
+ return this._size;
438
472
  }
439
473
  /**
440
- * Schedules a task for execution with optional priority based on phase shift.
474
+ * Schedules a task for execution.
441
475
  */
442
- schedule(e, t) {
443
- if (typeof e != "function")
444
- throw new F("Scheduler callback must be a function");
445
- const s = this._epoch;
446
- if (e._nextEpoch === s) return;
447
- if (e._nextEpoch = s, this.isBatching || this.isFlushingSync) {
448
- this.batchQueue[this.batchQueueSize++] = e;
449
- return;
476
+ schedule(e) {
477
+ if (E && typeof e != "function")
478
+ throw new P("Scheduler callback must be a function");
479
+ const t = this._epoch;
480
+ if (e._nextEpoch !== t) {
481
+ if (e._nextEpoch = t, this.isBatching || this.isFlushingSync) {
482
+ this.batchQueue[this.batchQueueSize++] = e;
483
+ return;
484
+ }
485
+ this._queueBuffer[this._bufferIndex][this._size++] = e, this.isProcessing || this.flush();
450
486
  }
451
- const i = this._calculateUrgency(e, t);
452
- this._activeQueues[i][this._sizes[i]++] = e, this.isProcessing || this.flush();
453
487
  }
454
488
  /**
455
- * Calculates urgency flag using branchless bit manipulation.
456
- *
457
- * Logic:
458
- * 1. Calculate the 'shift' (rotation distance) from the cached version.
459
- * 2. Compare against PHASE_THRESHOLD (180° rotation equivalent).
460
- * 3. Use (N >>> 31) to extract the sign bit in O(1) time.
461
- *
462
- * @returns 1 if urgent (shift >= PHASE_THRESHOLD), 0 otherwise.
463
- */
464
- _calculateUrgency(e, t) {
465
- if (!t || e._cachedVersion === void 0)
466
- return 0;
467
- const s = t.getShift(e._cachedVersion);
468
- return z - 1 - s >>> 31 & 1;
469
- }
470
- /**
471
- * Schedules a microtask-based flush of the queues.
489
+ * Schedules a microtask-based flush of the queue.
472
490
  * Coalesces multiple schedule calls into a single microtask execution.
473
491
  */
474
492
  flush() {
475
- this.isProcessing || this._sizes[0] === 0 && this._sizes[1] === 0 || (this.isProcessing = !0, queueMicrotask(() => {
493
+ this.isProcessing || this._size === 0 || (this.isProcessing = !0, queueMicrotask(() => {
476
494
  try {
477
- if (this._sizes[0] === 0 && this._sizes[1] === 0) return;
495
+ if (this._size === 0) return;
478
496
  const e = J();
479
497
  this._drainQueue(), e && $();
480
498
  } finally {
481
- this.isProcessing = !1, (this._sizes[0] > 0 || this._sizes[1] > 0) && !this.isBatching && this.flush();
499
+ this.isProcessing = !1, this._size > 0 && !this.isBatching && this.flush();
482
500
  }
483
501
  }));
484
502
  }
@@ -496,49 +514,49 @@ class pe {
496
514
  }
497
515
  }
498
516
  /**
499
- * Merges jobs from the batching queue into the primary normal queue.
500
- * Increments the epoch/uses provided epoch to ensure deduplication.
517
+ * Merges jobs from the batching queue into the primary queue.
518
+ * Increments the epoch to ensure deduplication.
501
519
  */
502
520
  _mergeBatchQueue() {
503
521
  const e = this.batchQueueSize;
504
522
  if (e === 0) return;
505
- const t = ++this._epoch, s = this.batchQueue, i = this._activeQueues[0];
506
- let r = this._sizes[0];
523
+ const t = ++this._epoch, s = this.batchQueue, n = this._queueBuffer[this._bufferIndex];
524
+ let r = this._size;
507
525
  for (let o = 0; o < e; o++) {
508
526
  const c = s[o];
509
- c._nextEpoch !== t && (c._nextEpoch = t, i[r++] = c);
527
+ c._nextEpoch !== t && (c._nextEpoch = t, n[r++] = c);
510
528
  }
511
- this._sizes[0] = r, this.batchQueueSize = 0, s.length > A.BATCH_QUEUE_SHRINK_THRESHOLD && (s.length = 0);
529
+ this._size = r, this.batchQueueSize = 0, s.length > T.BATCH_QUEUE_SHRINK_THRESHOLD && (s.length = 0);
512
530
  }
513
531
  _drainQueue() {
514
532
  let e = 0;
515
533
  const t = this.maxFlushIterations;
516
- for (; this._sizes[1] > 0 || this._sizes[0] > 0; ) {
534
+ for (; this._size > 0; ) {
517
535
  if (++e > t) {
518
536
  this._handleFlushOverflow();
519
537
  return;
520
538
  }
521
- this._sizes[1] > 0 && this._processQueue(1), this._sizes[0] > 0 && this._processQueue(0), this._mergeBatchQueue();
539
+ this._processQueue(), this._mergeBatchQueue();
522
540
  }
523
541
  }
524
- _processQueue(e) {
525
- const t = this._queueBuffers[e], s = this._bufferIndices[e], i = t[s], r = this._sizes[e], o = s ^ 1;
526
- this._bufferIndices[e] = o, this._activeQueues[e] = t[o], this._sizes[e] = 0, this._epoch++, this._processJobs(i, r);
542
+ _processQueue() {
543
+ const e = this._bufferIndex, t = this._queueBuffer[e], s = this._size, n = e ^ 1;
544
+ this._bufferIndex = n, this._size = 0, this._epoch++, this._processJobs(t, s);
527
545
  }
528
546
  _handleFlushOverflow() {
529
547
  console.error(
530
- new F(
548
+ new P(
531
549
  `Maximum flush iterations (${this.maxFlushIterations}) exceeded. Possible infinite loop.`
532
550
  )
533
- ), this._sizes[0] = 0, this._activeQueues[0].length = 0, this._sizes[1] = 0, this._activeQueues[1].length = 0, this.batchQueueSize = 0;
551
+ ), this._size = 0, this._queueBuffer[this._bufferIndex].length = 0, this.batchQueueSize = 0;
534
552
  }
535
553
  _processJobs(e, t) {
536
554
  for (let s = 0; s < t; s++)
537
555
  try {
538
556
  e[s]();
539
- } catch (i) {
557
+ } catch (n) {
540
558
  console.error(
541
- new F("Error occurred during scheduler execution", i)
559
+ new P("Error occurred during scheduler execution", n)
542
560
  );
543
561
  }
544
562
  e.length = 0;
@@ -547,18 +565,22 @@ class pe {
547
565
  this.batchDepth++, this.isBatching = !0;
548
566
  }
549
567
  endBatch() {
550
- this.batchDepth = Math.max(0, this.batchDepth - 1), this.batchDepth === 0 && (this.flushSync(), this.isBatching = !1);
568
+ if (this.batchDepth === 0) {
569
+ E && console.warn("endBatch() called without matching startBatch(). Ignoring.");
570
+ return;
571
+ }
572
+ this.batchDepth--, this.batchDepth === 0 && (this.flushSync(), this.isBatching = !1);
551
573
  }
552
574
  setMaxFlushIterations(e) {
553
- if (e < A.MIN_FLUSH_ITERATIONS)
554
- throw new F(
555
- `Max flush iterations must be at least ${A.MIN_FLUSH_ITERATIONS}`
575
+ if (e < T.MIN_FLUSH_ITERATIONS)
576
+ throw new P(
577
+ `Max flush iterations must be at least ${T.MIN_FLUSH_ITERATIONS}`
556
578
  );
557
579
  this.maxFlushIterations = e;
558
580
  }
559
581
  }
560
- const v = new pe();
561
- class Se {
582
+ const F = new Ee();
583
+ class de {
562
584
  constructor() {
563
585
  this.current = null;
564
586
  }
@@ -585,28 +607,28 @@ class Se {
585
607
  return this.current;
586
608
  }
587
609
  }
588
- const a = new Se();
589
- function ge(n) {
590
- if (typeof n != "function")
591
- throw new T("Untracked callback must be a function");
592
- const e = a.current;
593
- a.current = null;
610
+ const f = new de();
611
+ function pe(i) {
612
+ if (typeof i != "function")
613
+ throw new C("Untracked callback must be a function");
614
+ const e = f.current;
615
+ f.current = null;
594
616
  try {
595
- return n();
617
+ return i();
596
618
  } finally {
597
- a.current = e;
619
+ f.current = e;
598
620
  }
599
621
  }
600
- class be extends Z {
622
+ class Se extends Z {
601
623
  constructor(e, t) {
602
- super(), this._value = e, this._pendingOldValue = void 0, this._notifyTask = void 0, this._fnSubs = [], this._objSubs = [], t && (this.flags |= D.SYNC), I.attachDebugInfo(this, "atom", this.id);
624
+ super(), this._value = e, this._pendingOldValue = void 0, this._notifyTask = void 0, this._fnSubs = [], this._objSubs = [], t && (this.flags |= b.SYNC), I.attachDebugInfo(this, "atom", this.id);
603
625
  }
604
626
  /**
605
627
  * Returns the current value and registers the atom as a dependency if in a tracking context.
606
628
  */
607
629
  get value() {
608
- const e = a.current;
609
- return e && y(this, e, this._fnSubs, this._objSubs), this._value;
630
+ const e = f.current;
631
+ return e && N(this, e, this._fnSubs, this._objSubs), this._value;
610
632
  }
611
633
  /**
612
634
  * Sets a new value and schedules notifications if the value has changed.
@@ -614,30 +636,31 @@ class be extends Z {
614
636
  set value(e) {
615
637
  const t = this._value;
616
638
  if (Object.is(t, e)) return;
617
- this._value = e, this.version = this.version + 1 & b;
618
- const s = this.flags, i = D.HAS_FN_SUBS | D.HAS_OBJ_SUBS;
619
- s & i && this._scheduleNotification(t);
639
+ this._value = e, this.version = this.version + 1 & A;
640
+ const s = this.flags, n = b.HAS_FN_SUBS | b.HAS_OBJ_SUBS;
641
+ s & n && this._scheduleNotification(t);
620
642
  }
621
643
  /**
622
644
  * Schedules or flushes notifications based on sync mode and batching state.
623
645
  */
624
646
  _scheduleNotification(e) {
625
647
  let t = this.flags;
626
- if (t & D.NOTIFICATION_SCHEDULED || (this._pendingOldValue = e, this.flags = t |= D.NOTIFICATION_SCHEDULED), t & D.SYNC && !v.isBatching) {
648
+ if (t & b.NOTIFICATION_SCHEDULED || (this._pendingOldValue = e, this.flags = t |= b.NOTIFICATION_SCHEDULED), t & b.SYNC && !F.isBatching) {
627
649
  this._flushNotifications();
628
650
  return;
629
651
  }
630
652
  let s = this._notifyTask;
631
- s || (s = this._notifyTask = () => this._flushNotifications()), v.schedule(s);
653
+ s || (s = this._notifyTask = () => this._flushNotifications()), F.schedule(s);
632
654
  }
633
655
  /**
634
656
  * Flushes scheduled notifications and resets state for the next cycle.
635
657
  */
636
658
  _flushNotifications() {
637
- if (!(this.flags & D.NOTIFICATION_SCHEDULED))
659
+ const e = this.flags;
660
+ if (!(e & b.NOTIFICATION_SCHEDULED) || e & b.DISPOSED)
638
661
  return;
639
- const e = this._pendingOldValue, t = this._value;
640
- this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(t, e);
662
+ const t = this._pendingOldValue, s = this._value;
663
+ this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(s, t);
641
664
  }
642
665
  /**
643
666
  * Returns the current value without registering it as a dependency.
@@ -649,46 +672,46 @@ class be extends Z {
649
672
  * Disposes of the atom and releases all subscribers and tasks.
650
673
  */
651
674
  dispose() {
652
- this.flags & D.DISPOSED || (this._fnSubs = [], this._objSubs = [], this.flags |= D.DISPOSED, this._value = void 0, this._pendingOldValue = void 0, this._notifyTask = void 0);
675
+ this.flags & b.DISPOSED || (this._fnSubs = [], this._objSubs = [], this.flags |= b.DISPOSED, this._value = void 0, this._pendingOldValue = void 0, this._notifyTask = void 0);
653
676
  }
654
677
  }
655
- function ye(n, e = {}) {
656
- return new be(n, e.sync ?? !1);
678
+ function Ce(i, e = {}) {
679
+ return new Se(i, e.sync ?? !1);
657
680
  }
658
- function m(n, e, t) {
659
- if (n instanceof TypeError)
660
- return new e(`Type error (${t}): ${n.message}`, n);
661
- if (n instanceof ReferenceError)
662
- return new e(`Reference error (${t}): ${n.message}`, n);
663
- if (n instanceof T)
664
- return n;
665
- const s = n instanceof Error ? n.message : String(n), i = n instanceof Error ? n : null;
666
- return new e(`Unexpected error (${t}): ${s}`, i);
681
+ function m(i, e, t) {
682
+ if (i instanceof TypeError)
683
+ return new e(`Type error (${t}): ${i.message}`, i);
684
+ if (i instanceof ReferenceError)
685
+ return new e(`Reference error (${t}): ${i.message}`, i);
686
+ if (i instanceof C)
687
+ return i;
688
+ const s = i instanceof Error ? i.message : String(i), n = i instanceof Error ? i : null;
689
+ return new e(`Unexpected error (${t}): ${s}`, n);
667
690
  }
668
- function Ie(n) {
669
- return n !== null && typeof n == "object" && "value" in n && "subscribe" in n && typeof n.subscribe == "function";
691
+ function ge(i) {
692
+ return i !== null && typeof i == "object" && "value" in i && "subscribe" in i && typeof i.subscribe == "function";
670
693
  }
671
- function Ae(n) {
672
- if (I.enabled && (n == null || typeof n == "object")) {
673
- const e = I.getDebugType(n);
694
+ function Ne(i) {
695
+ if (I.enabled && i != null && typeof i == "object") {
696
+ const e = I.getDebugType(i);
674
697
  if (e)
675
698
  return e === "computed";
676
699
  }
677
- return Ie(n) && "invalidate" in n && typeof n.invalidate == "function";
700
+ return ge(i) && "invalidate" in i && typeof i.invalidate == "function";
678
701
  }
679
- function Ne(n) {
680
- return n !== null && typeof n == "object" && "dispose" in n && "run" in n && typeof n.dispose == "function" && typeof n.run == "function";
702
+ function Re(i) {
703
+ return i !== null && typeof i == "object" && "dispose" in i && "run" in i && typeof i.dispose == "function" && typeof i.run == "function";
681
704
  }
682
- function te(n) {
683
- return n != null && typeof n.then == "function";
705
+ function te(i) {
706
+ return i != null && typeof i.then == "function";
684
707
  }
685
708
  const se = u.RESOLVED | u.PENDING | u.REJECTED, V = Array(se + 1).fill(M.IDLE);
686
709
  V[u.RESOLVED] = M.RESOLVED;
687
710
  V[u.PENDING] = M.PENDING;
688
711
  V[u.REJECTED] = M.REJECTED;
689
- class De {
712
+ class be {
690
713
  constructor(e) {
691
- this._owner = e, this._epoch = -1, this._nextDeps = f, this._nextVersions = p, this._depCount = 0;
714
+ this._owner = e, this._epoch = -1, this._nextDeps = d, this._nextVersions = p, this._depCount = 0;
692
715
  }
693
716
  execute() {
694
717
  this._owner._markDirty();
@@ -697,18 +720,18 @@ class De {
697
720
  if (e._lastSeenEpoch === this._epoch)
698
721
  return;
699
722
  e._lastSeenEpoch = this._epoch;
700
- const t = this._depCount, s = this._nextDeps, i = this._nextVersions;
701
- t < s.length ? (s[t] = e, i[t] = e.version) : (s.push(e), i.push(e.version)), this._depCount = t + 1;
723
+ const t = this._depCount, s = this._nextDeps, n = this._nextVersions;
724
+ t < s.length ? (s[t] = e, n[t] = e.version) : (s.push(e), n.push(e.version)), this._depCount = t + 1;
702
725
  }
703
726
  reset() {
704
- this._epoch = -1, this._nextDeps = f, this._nextVersions = p, this._depCount = 0;
727
+ this._epoch = -1, this._nextDeps = d, this._nextVersions = p, this._depCount = 0;
705
728
  }
706
729
  }
707
730
  class ie extends Z {
708
731
  constructor(e, t = {}) {
709
732
  if (typeof e != "function")
710
- throw new x(l.COMPUTED_MUST_BE_FUNCTION);
711
- 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 : Q, this._hasDefaultValue = this._defaultValue !== Q, this._onError = t.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._fnSubs = [], this._objSubs = [], this._dependencies = f, this._dependencyVersions = p, this._unsubscribes = N, this._cachedErrors = null, this._errorCacheEpoch = -1, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._trackable = new De(this), I.attachDebugInfo(this, "computed", this.id), I.enabled) {
733
+ throw new R(l.COMPUTED_MUST_BE_FUNCTION);
734
+ 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) {
712
735
  const s = this;
713
736
  s.subscriberCount = this.subscriberCount.bind(this), s.isDirty = () => (this.flags & u.DIRTY) !== 0, s.dependencies = this._dependencies, s.stateFlags = "";
714
737
  }
@@ -719,10 +742,13 @@ class ie extends Z {
719
742
  }
720
743
  }
721
744
  get value() {
722
- const e = a.current;
723
- e && y(this, e, this._fnSubs, this._objSubs);
745
+ const e = f.current;
746
+ e && N(this, e, this._fnSubs, this._objSubs);
724
747
  const t = this.flags;
725
- if (t & u.RECOMPUTING) return this._value;
748
+ if (t & u.RECOMPUTING) {
749
+ if (this._hasDefaultValue) return this._defaultValue;
750
+ throw new R(l.COMPUTED_CIRCULAR_DEPENDENCY);
751
+ }
726
752
  t & (u.DIRTY | u.IDLE) && this._recompute();
727
753
  const s = this.flags;
728
754
  return s & u.PENDING ? this._handlePending() : s & u.REJECTED ? this._handleRejected() : this._value;
@@ -731,15 +757,15 @@ class ie extends Z {
731
757
  return this._value;
732
758
  }
733
759
  get state() {
734
- const e = a.current;
735
- return e && y(this, e, this._fnSubs, this._objSubs), V[this.flags & se];
760
+ const e = f.current;
761
+ return e && N(this, e, this._fnSubs, this._objSubs), V[this.flags & se];
736
762
  }
737
763
  get hasError() {
738
- const e = a.current;
739
- if (e && y(this, e, this._fnSubs, this._objSubs), this.flags & (u.REJECTED | u.HAS_ERROR)) return !0;
764
+ const e = f.current;
765
+ if (e && N(this, e, this._fnSubs, this._objSubs), this.flags & (u.REJECTED | u.HAS_ERROR)) return !0;
740
766
  const s = this._dependencies;
741
- for (let i = 0, r = s.length; i < r; i++) {
742
- const o = s[i];
767
+ for (let n = 0, r = s.length; n < r; n++) {
768
+ const o = s[n];
743
769
  if (o && o.flags & u.HAS_ERROR) return !0;
744
770
  }
745
771
  return !1;
@@ -748,20 +774,20 @@ class ie extends Z {
748
774
  return !this.hasError;
749
775
  }
750
776
  get errors() {
751
- const e = a.current;
752
- if (e && y(this, e, this._fnSubs, this._objSubs), !this.hasError) return ce;
753
- const t = Ee();
777
+ const e = f.current;
778
+ if (e && N(this, e, this._fnSubs, this._objSubs), !this.hasError) return re;
779
+ const t = ae();
754
780
  if (this._errorCacheEpoch === t && this._cachedErrors !== null)
755
781
  return this._cachedErrors;
756
782
  const s = /* @__PURE__ */ new Set();
757
783
  this._error && s.add(this._error);
758
- const i = this._dependencies;
759
- for (let o = 0, c = i.length; o < c; o++) {
760
- const h = i[o];
784
+ const n = this._dependencies;
785
+ for (let o = 0, c = n.length; o < c; o++) {
786
+ const h = n[o];
761
787
  if (h && "errors" in h) {
762
788
  const _ = h.errors;
763
- for (let E = 0, ne = _.length; E < ne; E++) {
764
- const X = _[E];
789
+ for (let a = 0, B = _.length; a < B; a++) {
790
+ const X = _[a];
765
791
  X && s.add(X);
766
792
  }
767
793
  }
@@ -770,35 +796,35 @@ class ie extends Z {
770
796
  return this._cachedErrors = r, this._errorCacheEpoch = t, r;
771
797
  }
772
798
  get lastError() {
773
- const e = a.current;
774
- return e && y(this, e, this._fnSubs, this._objSubs), this._error;
799
+ const e = f.current;
800
+ return e && N(this, e, this._fnSubs, this._objSubs), this._error;
775
801
  }
776
802
  get isPending() {
777
- const e = a.current;
778
- return e && y(this, e, this._fnSubs, this._objSubs), (this.flags & u.PENDING) !== 0;
803
+ const e = f.current;
804
+ return e && N(this, e, this._fnSubs, this._objSubs), (this.flags & u.PENDING) !== 0;
779
805
  }
780
806
  get isResolved() {
781
- const e = a.current;
782
- return e && y(this, e, this._fnSubs, this._objSubs), (this.flags & u.RESOLVED) !== 0;
807
+ const e = f.current;
808
+ return e && N(this, e, this._fnSubs, this._objSubs), (this.flags & u.RESOLVED) !== 0;
783
809
  }
784
810
  invalidate() {
785
811
  this._markDirty();
786
812
  const e = this._dependencyVersions;
787
- e !== p && (C.release(e), this._dependencyVersions = p), this._errorCacheEpoch = -1, this._cachedErrors = null;
813
+ e !== p && (D.release(e), this._dependencyVersions = p), this._errorCacheEpoch = -1, this._cachedErrors = null;
788
814
  }
789
815
  dispose() {
790
816
  const e = this._unsubscribes;
791
- if (e !== N) {
792
- for (let i = 0, r = e.length; i < r; i++) {
793
- const o = e[i];
817
+ if (e !== O) {
818
+ for (let n = 0, r = e.length; n < r; n++) {
819
+ const o = e[n];
794
820
  o && o();
795
821
  }
796
- U.release(e), this._unsubscribes = N;
822
+ U.release(e), this._unsubscribes = O;
797
823
  }
798
824
  const t = this._dependencies;
799
- t !== f && (O.release(t), this._dependencies = f);
825
+ t !== d && (x.release(t), this._dependencies = d);
800
826
  const s = this._dependencyVersions;
801
- 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;
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;
802
828
  }
803
829
  _clearDirty() {
804
830
  this.flags &= -9;
@@ -827,52 +853,39 @@ class ie extends Z {
827
853
  return;
828
854
  this._setRecomputing(!0);
829
855
  const e = this._trackable, t = this._dependencies, s = this._dependencyVersions;
830
- e._epoch = ee(), e._nextDeps = O.acquire(), e._nextVersions = C.acquire(), e._depCount = 0;
831
- let i = !1;
856
+ e._epoch = ee(), e._nextDeps = x.acquire(), e._nextVersions = D.acquire(), e._depCount = 0;
857
+ let n = !1;
832
858
  try {
833
- const r = a.run(e, this._fn), o = e._nextDeps, c = e._nextVersions, h = e._depCount;
834
- o.length = h, c.length = h, this._unsubscribes = q(o, t, this._unsubscribes, this), this._dependencies = o, this._dependencyVersions = c, i = !0, te(r) ? this._handleAsyncComputation(r) : this._finalizeResolution(r);
859
+ const r = f.run(e, this._fn), o = e._nextDeps, c = e._nextVersions, h = e._depCount;
860
+ o.length = h, c.length = h, this._unsubscribes = Q(o, t, this._unsubscribes, this), this._dependencies = o, this._dependencyVersions = c, n = !0, te(r) ? this._handleAsyncComputation(r) : this._finalizeResolution(r);
835
861
  } catch (r) {
836
862
  let o = r;
837
- if (!i)
863
+ if (!n)
838
864
  try {
839
865
  const c = e._nextDeps, h = e._nextVersions, _ = e._depCount;
840
- c.length = _, h.length = _, this._unsubscribes = q(c, t, this._unsubscribes, this), this._dependencies = c, this._dependencyVersions = h, i = !0;
866
+ c.length = _, h.length = _, this._unsubscribes = Q(c, t, this._unsubscribes, this), this._dependencies = c, this._dependencyVersions = h, n = !0;
841
867
  } catch (c) {
842
868
  o = c;
843
869
  }
844
870
  this._handleComputationError(o);
845
871
  } finally {
846
- i ? (t !== f && O.release(t), s !== p && C.release(s)) : (O.release(e._nextDeps), C.release(e._nextVersions)), e.reset(), this._setRecomputing(!1);
847
- }
848
- }
849
- _getAggregateShift() {
850
- let e = 0;
851
- const t = this._dependencies, s = this._dependencyVersions;
852
- for (let i = 0, r = t.length; i < r; i++) {
853
- const o = t[i], c = s[i];
854
- o && c !== void 0 && (e = e + o.getShift(c) & b);
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);
855
873
  }
856
- return e;
857
- }
858
- isUrgent() {
859
- return this._getAggregateShift() >= z;
860
874
  }
861
875
  _handleAsyncComputation(e) {
862
876
  this._setPending(), this._clearDirty(), this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID;
863
877
  const t = this._promiseId;
864
878
  e.then((s) => {
865
879
  if (t !== this._promiseId) return;
866
- const r = this._captureVersionSnapshot() - this._asyncStartAggregateVersion & b;
867
- if (z - 1 - r >>> 31 & 1) {
880
+ if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion) {
868
881
  if (this._asyncRetryCount < this.MAX_ASYNC_RETRIES) {
869
882
  this._asyncRetryCount++, this._markDirty();
870
883
  return;
871
884
  }
872
- const c = new x(
885
+ const o = new R(
873
886
  `Async drift exceeded threshold after ${this.MAX_ASYNC_RETRIES} retries.`
874
887
  );
875
- this._handleAsyncRejection(c);
888
+ this._handleAsyncRejection(o);
876
889
  return;
877
890
  }
878
891
  this._finalizeResolution(s), this._notifySubscribers(s, void 0);
@@ -883,43 +896,46 @@ class ie extends Z {
883
896
  _captureVersionSnapshot() {
884
897
  let e = 0;
885
898
  const t = this._dependencies;
886
- for (let s = 0, i = t.length; s < i; s++) {
899
+ for (let s = 0, n = t.length; s < n; s++) {
887
900
  const r = t[s];
888
- r && (e = e + r.version & b);
901
+ if (r) {
902
+ const o = r.version;
903
+ e = ((e << 5) - e | 0) + o & A;
904
+ }
889
905
  }
890
906
  return e;
891
907
  }
892
908
  _handleAsyncRejection(e) {
893
- const t = m(e, x, l.COMPUTED_ASYNC_COMPUTATION_FAILED);
894
- this.flags & u.REJECTED || (this.version = this.version + 1 & b), this._error = t, this._setRejected(), this._clearDirty(), this._setRecomputing(!1);
909
+ const t = m(e, R, l.COMPUTED_ASYNC_COMPUTATION_FAILED);
910
+ this.flags & u.REJECTED || (this.version = this.version + 1 & A), this._error = t, this._setRejected(), this._clearDirty();
895
911
  const s = this._onError;
896
912
  if (s)
897
913
  try {
898
914
  s(t);
899
- } catch (i) {
900
- console.error(l.CALLBACK_ERROR_IN_ERROR_HANDLER, i);
915
+ } catch (n) {
916
+ console.error(l.CALLBACK_ERROR_IN_ERROR_HANDLER, n);
901
917
  }
902
918
  this._notifySubscribers(void 0, void 0);
903
919
  }
904
920
  _finalizeResolution(e) {
905
- (!(this.flags & u.RESOLVED) || !this._equal(this._value, e)) && (this.version = this.version + 1 & b), this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1), this._cachedErrors = null, this._errorCacheEpoch = -1;
921
+ (!(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;
906
922
  }
907
923
  _handleComputationError(e) {
908
- const t = m(e, x, l.COMPUTED_COMPUTATION_FAILED);
924
+ const t = m(e, R, l.COMPUTED_COMPUTATION_FAILED);
909
925
  this._error = t, this._setRejected(), this._clearDirty(), this._setRecomputing(!1);
910
926
  const s = this._onError;
911
927
  if (s)
912
928
  try {
913
929
  s(t);
914
- } catch (i) {
915
- console.error(l.CALLBACK_ERROR_IN_ERROR_HANDLER, i);
930
+ } catch (n) {
931
+ console.error(l.CALLBACK_ERROR_IN_ERROR_HANDLER, n);
916
932
  }
917
933
  throw t;
918
934
  }
919
935
  _handlePending() {
920
936
  if (this._hasDefaultValue)
921
937
  return this._defaultValue;
922
- throw new x(l.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
938
+ throw new R(l.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
923
939
  }
924
940
  _handleRejected() {
925
941
  const e = this._error;
@@ -937,91 +953,105 @@ class ie extends Z {
937
953
  }
938
954
  }
939
955
  Object.freeze(ie.prototype);
940
- function Oe(n, e = {}) {
941
- return new ie(n, e);
956
+ function Te(i, e = {}) {
957
+ return new ie(i, e);
942
958
  }
943
- class Ce extends W {
959
+ class Ie extends W {
944
960
  constructor(e, t = {}) {
945
- super(), this._cleanup = null, this._dependencies = f, this._dependencyVersions = p, this._unsubscribes = N, 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 ?? A.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? A.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = t.trackModifications ?? !1, this._executionCount = 0, this._historyPtr = 0;
946
- const s = Number.isFinite(this._maxExecutions), i = s ? Math.min(this._maxExecutions + 1, A.MAX_EXECUTIONS_PER_SECOND + 1) : 0;
947
- this._historyCapacity = i, this._history = g && s && i > 0 ? new Array(i).fill(0) : null, I.attachDebugInfo(this, "effect", this.id);
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;
963
+ this._historyCapacity = n, this._history = E && s && n > 0 ? new Array(n).fill(0) : null, this._execId = 0, I.attachDebugInfo(this, "effect", this.id);
948
964
  }
949
965
  run() {
950
- if (this.flags & d.DISPOSED)
951
- throw new R(l.EFFECT_MUST_BE_FUNCTION);
966
+ if (this.flags & S.DISPOSED)
967
+ throw new y(l.EFFECT_DISPOSED);
952
968
  this.execute(!0);
953
969
  }
954
970
  dispose() {
955
971
  const e = this.flags;
956
- if (e & d.DISPOSED) return;
957
- this.flags = e | d.DISPOSED, this._safeCleanup();
972
+ if (e & S.DISPOSED) return;
973
+ this.flags = e | S.DISPOSED, this._safeCleanup();
958
974
  const t = this._unsubscribes;
959
- if (t !== N) {
975
+ if (t !== O) {
960
976
  for (let r = 0, o = t.length; r < o; r++) {
961
977
  const c = t[r];
962
978
  c && c();
963
979
  }
964
- U.release(t), this._unsubscribes = N;
980
+ U.release(t), this._unsubscribes = O;
965
981
  }
966
982
  const s = this._dependencies;
967
- s !== f && (O.release(s), this._dependencies = f);
968
- const i = this._dependencyVersions;
969
- i !== p && (C.release(i), this._dependencyVersions = p), this._executeTask = void 0;
983
+ s !== d && (x.release(s), this._dependencies = d);
984
+ const n = this._dependencyVersions;
985
+ n !== p && (D.release(n), this._dependencyVersions = p), this._executeTask = void 0;
970
986
  }
971
987
  addDependency(e) {
972
- if (!(this.flags & d.EXECUTING)) return;
988
+ if (!(this.flags & S.EXECUTING)) return;
973
989
  const s = this._currentEpoch;
974
990
  if (e._lastSeenEpoch === s) return;
975
991
  e._lastSeenEpoch = s;
976
- const i = this._nextDeps, r = this._nextVersions, o = this._nextUnsubs;
977
- if (!i || !r || !o) return;
978
- i.push(e), r.push(e.version);
992
+ const n = this._nextDeps, r = this._nextVersions, o = this._nextUnsubs;
993
+ if (!n || !r || !o) return;
994
+ n.push(e), r.push(e.version);
979
995
  const c = e._tempUnsub;
980
996
  c ? (o.push(c), e._tempUnsub = void 0) : this._subscribeTo(e);
981
997
  }
982
998
  execute(e = !1) {
983
- if (this.flags & (d.DISPOSED | d.EXECUTING) || !e && !this._shouldExecute()) return;
999
+ if (this.flags & (S.DISPOSED | S.EXECUTING) || !e && !this._shouldExecute()) return;
984
1000
  this._checkInfiniteLoop(), this._setExecuting(!0), this._safeCleanup();
985
1001
  const s = this._prepareEffectExecutionContext();
986
- let i = !1;
1002
+ let n = !1;
987
1003
  try {
988
- const r = a.run(this, this._fn), o = s.nextDeps.length;
989
- s.nextDeps.length = o, s.nextVersions.length = o, this._dependencies = s.nextDeps, this._dependencyVersions = s.nextVersions, this._unsubscribes = s.nextUnsubs, i = !0, this._checkLoopWarnings(), te(r) ? r.then((c) => {
990
- !(this.flags & d.DISPOSED) && typeof c == "function" && (this._cleanup = c);
991
- }).catch((c) => this._handleExecutionError(c)) : this._cleanup = typeof r == "function" ? r : null;
1004
+ const r = f.run(this, this._fn), o = s.nextDeps.length;
1005
+ s.nextDeps.length = o, s.nextVersions.length = o, this._dependencies = s.nextDeps, this._dependencyVersions = s.nextVersions, this._unsubscribes = s.nextUnsubs, n = !0, this._checkLoopWarnings();
1006
+ const c = ++this._execId;
1007
+ te(r) ? r.then((h) => {
1008
+ const _ = c !== this._execId, a = this.flags & S.DISPOSED;
1009
+ if (_ || a) {
1010
+ if (typeof h == "function")
1011
+ try {
1012
+ h();
1013
+ } catch (B) {
1014
+ this._handleExecutionError(B, l.EFFECT_CLEANUP_FAILED);
1015
+ }
1016
+ return;
1017
+ }
1018
+ typeof h == "function" && (this._cleanup = h);
1019
+ }).catch((h) => {
1020
+ c === this._execId && this._handleExecutionError(h);
1021
+ }) : this._cleanup = typeof r == "function" ? r : null;
992
1022
  } catch (r) {
993
- i = !0, this._handleExecutionError(r), this._cleanup = null;
1023
+ n = !0, this._handleExecutionError(r), this._cleanup = null;
994
1024
  } finally {
995
- this._cleanupEffect(s, i), this._setExecuting(!1);
1025
+ this._cleanupEffect(s, n), this._setExecuting(!1);
996
1026
  }
997
1027
  }
998
1028
  _prepareEffectExecutionContext() {
999
- const e = this._dependencies, t = this._dependencyVersions, s = this._unsubscribes, i = O.acquire(), r = C.acquire(), o = U.acquire(), c = ee();
1000
- if (e !== f)
1029
+ const e = this._dependencies, t = this._dependencyVersions, s = this._unsubscribes, n = x.acquire(), r = D.acquire(), o = U.acquire(), c = ee();
1030
+ if (e !== d)
1001
1031
  for (let h = 0, _ = e.length; h < _; h++) {
1002
- const E = e[h];
1003
- E && (E._tempUnsub = s[h]);
1032
+ const a = e[h];
1033
+ a && (a._tempUnsub = s[h]);
1004
1034
  }
1005
- return this._nextDeps = i, this._nextVersions = r, this._nextUnsubs = o, this._currentEpoch = c, { prevDeps: e, prevVersions: t, prevUnsubs: s, nextDeps: i, nextVersions: r, nextUnsubs: o };
1035
+ return this._nextDeps = n, this._nextVersions = r, this._nextUnsubs = o, this._currentEpoch = c, { prevDeps: e, prevVersions: t, prevUnsubs: s, nextDeps: n, nextVersions: r, nextUnsubs: o };
1006
1036
  }
1007
1037
  _cleanupEffect(e, t) {
1008
1038
  this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null;
1009
1039
  const s = e.prevDeps;
1010
1040
  if (t) {
1011
- if (s !== f) {
1012
- for (let i = 0, r = s.length; i < r; i++) {
1013
- const o = s[i], c = o ? o._tempUnsub : void 0;
1041
+ if (s !== d) {
1042
+ for (let n = 0, r = s.length; n < r; n++) {
1043
+ const o = s[n], c = o ? o._tempUnsub : void 0;
1014
1044
  c && (c(), o && (o._tempUnsub = void 0));
1015
1045
  }
1016
- O.release(s);
1046
+ x.release(s);
1017
1047
  }
1018
- e.prevUnsubs !== N && U.release(e.prevUnsubs), e.prevVersions !== p && C.release(e.prevVersions);
1048
+ e.prevUnsubs !== O && U.release(e.prevUnsubs), e.prevVersions !== p && D.release(e.prevVersions);
1019
1049
  } else {
1020
- O.release(e.nextDeps), C.release(e.nextVersions);
1021
- const i = e.nextUnsubs;
1022
- for (let r = 0, o = i.length; r < o; r++)
1023
- i[r]?.();
1024
- if (U.release(i), s !== f)
1050
+ x.release(e.nextDeps), D.release(e.nextVersions);
1051
+ const n = e.nextUnsubs;
1052
+ for (let r = 0, o = n.length; r < o; r++)
1053
+ n[r]?.();
1054
+ if (U.release(n), s !== d)
1025
1055
  for (let r = 0, o = s.length; r < o; r++) {
1026
1056
  const c = s[r];
1027
1057
  c && (c._tempUnsub = void 0);
@@ -1031,35 +1061,32 @@ class Ce extends W {
1031
1061
  _subscribeTo(e) {
1032
1062
  try {
1033
1063
  const t = e.subscribe(() => {
1034
- if (this._trackModifications && this.flags & d.EXECUTING && (e._modifiedAtEpoch = this._currentEpoch), this._sync) {
1064
+ if (this._trackModifications && this.flags & S.EXECUTING && (e._modifiedAtEpoch = this._currentEpoch), this._sync) {
1035
1065
  this.execute();
1036
1066
  return;
1037
1067
  }
1038
- let i = this._executeTask;
1039
- i || (i = this._executeTask = () => this.execute()), v.schedule(i);
1068
+ let n = this._executeTask;
1069
+ n || (n = this._executeTask = () => this.execute()), F.schedule(n);
1040
1070
  }), s = this._nextUnsubs;
1041
1071
  s && s.push(t);
1042
1072
  } catch (t) {
1043
- console.error(m(t, R, l.EFFECT_EXECUTION_FAILED));
1073
+ console.error(m(t, y, l.EFFECT_EXECUTION_FAILED));
1044
1074
  const s = this._nextUnsubs;
1045
1075
  s && s.push(() => {
1046
1076
  });
1047
1077
  }
1048
1078
  }
1049
1079
  get isDisposed() {
1050
- return (this.flags & d.DISPOSED) !== 0;
1080
+ return (this.flags & S.DISPOSED) !== 0;
1051
1081
  }
1052
1082
  get executionCount() {
1053
1083
  return this._executionCount;
1054
1084
  }
1055
1085
  get isExecuting() {
1056
- return (this.flags & d.EXECUTING) !== 0;
1057
- }
1058
- _setDisposed() {
1059
- this.flags |= d.DISPOSED;
1086
+ return (this.flags & S.EXECUTING) !== 0;
1060
1087
  }
1061
1088
  _setExecuting(e) {
1062
- const t = d.EXECUTING;
1089
+ const t = S.EXECUTING;
1063
1090
  this.flags = this.flags & ~t | (e ? -1 : 0) & t;
1064
1091
  }
1065
1092
  _safeCleanup() {
@@ -1068,31 +1095,32 @@ class Ce extends W {
1068
1095
  try {
1069
1096
  e();
1070
1097
  } catch (t) {
1071
- console.error(m(t, R, l.EFFECT_CLEANUP_FAILED));
1098
+ this._handleExecutionError(t, l.EFFECT_CLEANUP_FAILED);
1072
1099
  }
1073
1100
  this._cleanup = null;
1074
1101
  }
1075
1102
  }
1076
1103
  _checkInfiniteLoop() {
1077
1104
  const e = H;
1078
- this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), de() > A.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
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++;
1079
1106
  const s = this._history;
1080
1107
  if (s) {
1081
- const i = Date.now(), r = this._historyPtr, o = this._historyCapacity;
1082
- s[r] = i;
1108
+ const n = Date.now(), r = this._historyPtr, o = this._historyCapacity;
1109
+ s[r] = n;
1083
1110
  const c = (r + 1) % o;
1084
1111
  this._historyPtr = c;
1085
1112
  const h = s[c] ?? 0;
1086
- if (h > 0 && i - h < re.ONE_SECOND_MS) {
1087
- const _ = new R(
1113
+ if (h > 0 && n - h < ne.ONE_SECOND_MS) {
1114
+ const _ = new y(
1088
1115
  `Effect executed ${o} times within 1 second. Infinite loop suspected`
1089
1116
  );
1090
- if (this.dispose(), console.error(_), this._onError && this._onError(_), g) throw _;
1117
+ if (this.dispose(), console.error(_), this._onError && this._onError(_), E) throw _;
1118
+ return;
1091
1119
  }
1092
1120
  }
1093
1121
  }
1094
1122
  _throwInfiniteLoopError(e) {
1095
- const t = new R(
1123
+ const t = new y(
1096
1124
  `Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${j}`
1097
1125
  );
1098
1126
  throw this.dispose(), console.error(t), t;
@@ -1101,13 +1129,13 @@ class Ce extends W {
1101
1129
  const e = this._dependencies;
1102
1130
  if (e.length === 0) return !0;
1103
1131
  const t = this._dependencyVersions;
1104
- for (let s = 0, i = e.length; s < i; s++) {
1132
+ for (let s = 0, n = e.length; s < n; s++) {
1105
1133
  const r = e[s];
1106
1134
  if (r) {
1107
1135
  if (r.version !== t[s]) return !0;
1108
1136
  if ("value" in r)
1109
1137
  try {
1110
- ge(() => r.value);
1138
+ pe(() => r.value);
1111
1139
  } catch {
1112
1140
  return !0;
1113
1141
  }
@@ -1115,16 +1143,21 @@ class Ce extends W {
1115
1143
  }
1116
1144
  return !1;
1117
1145
  }
1118
- _handleExecutionError(e) {
1119
- const t = m(e, R, l.EFFECT_EXECUTION_FAILED);
1120
- console.error(t);
1121
- const s = this._onError;
1122
- s && s(t);
1146
+ _handleExecutionError(e, t = l.EFFECT_EXECUTION_FAILED) {
1147
+ const s = m(e, y, t);
1148
+ console.error(s);
1149
+ const n = this._onError;
1150
+ if (n)
1151
+ try {
1152
+ n(s);
1153
+ } catch (r) {
1154
+ console.error(m(r, y, l.CALLBACK_ERROR_IN_ERROR_HANDLER));
1155
+ }
1123
1156
  }
1124
1157
  _checkLoopWarnings() {
1125
1158
  if (this._trackModifications && I.enabled) {
1126
1159
  const e = this._dependencies, t = this._currentEpoch;
1127
- for (let s = 0, i = e.length; s < i; s++) {
1160
+ for (let s = 0, n = e.length; s < n; s++) {
1128
1161
  const r = e[s];
1129
1162
  r && r._modifiedAtEpoch === t && I.warn(
1130
1163
  !0,
@@ -1134,40 +1167,40 @@ class Ce extends W {
1134
1167
  }
1135
1168
  }
1136
1169
  }
1137
- function Re(n, e = {}) {
1138
- if (typeof n != "function")
1139
- throw new R(l.EFFECT_MUST_BE_FUNCTION);
1140
- const t = new Ce(n, e);
1170
+ function Oe(i, e = {}) {
1171
+ if (typeof i != "function")
1172
+ throw new y(l.EFFECT_MUST_BE_FUNCTION);
1173
+ const t = new Ie(i, e);
1141
1174
  return t.execute(), t;
1142
1175
  }
1143
- function xe(n) {
1144
- if (typeof n != "function")
1145
- throw new T("Batch callback must be a function");
1146
- v.startBatch();
1176
+ function xe(i) {
1177
+ if (typeof i != "function")
1178
+ throw new C("Batch callback must be a function");
1179
+ F.startBatch();
1147
1180
  try {
1148
- return n();
1181
+ return i();
1149
1182
  } finally {
1150
- v.endBatch();
1183
+ F.endBatch();
1151
1184
  }
1152
1185
  }
1153
1186
  export {
1154
1187
  M as AsyncState,
1155
- T as AtomError,
1156
- x as ComputedError,
1188
+ C as AtomError,
1189
+ R as ComputedError,
1157
1190
  G as DEBUG_CONFIG,
1158
1191
  I as DEBUG_RUNTIME,
1159
- R as EffectError,
1160
- Te as POOL_CONFIG,
1161
- A as SCHEDULER_CONFIG,
1162
- F as SchedulerError,
1163
- ye as atom,
1192
+ y as EffectError,
1193
+ De as POOL_CONFIG,
1194
+ T as SCHEDULER_CONFIG,
1195
+ P as SchedulerError,
1196
+ Ce as atom,
1164
1197
  xe as batch,
1165
- Oe as computed,
1166
- Re as effect,
1167
- Ie as isAtom,
1168
- Ae as isComputed,
1169
- Ne as isEffect,
1170
- v as scheduler,
1171
- ge as untracked
1198
+ Te as computed,
1199
+ Oe as effect,
1200
+ ge as isAtom,
1201
+ Ne as isComputed,
1202
+ Re as isEffect,
1203
+ F as scheduler,
1204
+ pe as untracked
1172
1205
  };
1173
1206
  //# sourceMappingURL=index.mjs.map