@but212/atom-effect-jquery 0.9.0 → 0.9.2

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
@@ -58,8 +58,8 @@ class k extends Error {
58
58
  * @param cause - Original error that caused this error
59
59
  * @param recoverable - Whether the operation can be retried
60
60
  */
61
- constructor(e, s = null, i = !0) {
62
- super(e), this.name = "AtomError", this.cause = s, this.recoverable = i, this.timestamp = /* @__PURE__ */ new Date();
61
+ constructor(e, s = null, n = !0) {
62
+ super(e), this.name = "AtomError", this.cause = s, this.recoverable = n, this.timestamp = /* @__PURE__ */ new Date();
63
63
  }
64
64
  }
65
65
  class X extends k {
@@ -154,9 +154,9 @@ function Ce(t, e, s) {
154
154
  if (t._visitedEpoch = s, t === e)
155
155
  throw new X("Indirect circular dependency detected");
156
156
  if (qe(t)) {
157
- const i = t.dependencies;
158
- for (let n = 0; n < i.length; n++) {
159
- const r = i[n];
157
+ const n = t.dependencies;
158
+ for (let i = 0; i < n.length; i++) {
159
+ const r = n[i];
160
160
  r && Ce(r, e, s);
161
161
  }
162
162
  }
@@ -182,8 +182,8 @@ const w = {
182
182
  attachDebugInfo(t, e, s) {
183
183
  if (!this.enabled)
184
184
  return;
185
- const i = t;
186
- i[he] = `${e}_${s}`, i[Be] = s, i[ae] = e;
185
+ const n = t;
186
+ n[he] = `${e}_${s}`, n[Be] = s, n[ae] = e;
187
187
  },
188
188
  getDebugName(t) {
189
189
  if (t != null && he in t)
@@ -233,11 +233,11 @@ class Ne extends ve {
233
233
  */
234
234
  _notifySubscribers(e, s) {
235
235
  this._functionSubscribers.forEachSafe(
236
- (i) => i(e, s),
237
- (i) => console.error(new k(y.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, i))
236
+ (n) => n(e, s),
237
+ (n) => console.error(new k(y.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, n))
238
238
  ), this._objectSubscribers.forEachSafe(
239
- (i) => i.execute(),
240
- (i) => console.error(new k(y.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, i))
239
+ (n) => n.execute(),
240
+ (n) => console.error(new k(y.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, n))
241
241
  );
242
242
  }
243
243
  }
@@ -248,17 +248,17 @@ function xe() {
248
248
  function Ge() {
249
249
  return te;
250
250
  }
251
- let ie = 0, fe = 0, ne = !1;
251
+ let ne = 0, fe = 0, ie = !1;
252
252
  function ye() {
253
- return ne ? (T && console.warn(
253
+ return ie ? (T && console.warn(
254
254
  "Warning: startFlush() called during flush - ignored to prevent infinite loop detection bypass"
255
- ), !1) : (ne = !0, ie = ie + 1 & B, fe = 0, !0);
255
+ ), !1) : (ie = !0, ne = ne + 1 & B, fe = 0, !0);
256
256
  }
257
257
  function Se() {
258
- ne = !1;
258
+ ie = !1;
259
259
  }
260
260
  function Qe() {
261
- return ne ? ++fe : 0;
261
+ return ie ? ++fe : 0;
262
262
  }
263
263
  class He {
264
264
  constructor() {
@@ -279,13 +279,15 @@ class He {
279
279
  e._nextEpoch !== this._epoch && (e._nextEpoch = this._epoch, this.isBatching || this.isFlushingSync ? this.batchQueue[this.batchQueueSize++] = e : (this.queue[this.queueSize++] = e, this.isProcessing || this.flush()));
280
280
  }
281
281
  flush() {
282
- if (this.isProcessing || this.queueSize === 0) return;
283
- this.isProcessing = !0;
284
- const e = this.queue, s = this.queueSize;
285
- this.queue = this.queue === this.queueA ? this.queueB : this.queueA, this.queueSize = 0, this._epoch++, queueMicrotask(() => {
286
- const i = ye();
287
- this._processJobs(e, s), this.isProcessing = !1, i && Se(), this.queueSize > 0 && !this.isBatching && this.flush();
288
- });
282
+ this.isProcessing || this.queueSize === 0 || (this.isProcessing = !0, queueMicrotask(() => {
283
+ try {
284
+ if (this.queueSize === 0) return;
285
+ const e = ye();
286
+ this._drainQueue(), e && Se();
287
+ } finally {
288
+ this.isProcessing = !1, this.queueSize > 0 && !this.isBatching && this.flush();
289
+ }
290
+ }));
289
291
  }
290
292
  flushSync() {
291
293
  this.isFlushingSync = !0;
@@ -327,12 +329,12 @@ class He {
327
329
  ), this.queueSize = 0, this.queue.length = 0, this.batchQueueSize = 0;
328
330
  }
329
331
  _processJobs(e, s) {
330
- for (let i = 0; i < s; i++)
332
+ for (let n = 0; n < s; n++)
331
333
  try {
332
- e[i]?.();
333
- } catch (n) {
334
+ e[n]?.();
335
+ } catch (i) {
334
336
  console.error(
335
- new ee("Error occurred during scheduler execution", n)
337
+ new ee("Error occurred during scheduler execution", i)
336
338
  );
337
339
  }
338
340
  e.length = 0;
@@ -419,8 +421,8 @@ class re {
419
421
  const s = this.subscribers.indexOf(e);
420
422
  if (s === -1)
421
423
  return !1;
422
- const i = this.subscribers.length - 1;
423
- return s !== i && (this.subscribers[s] = this.subscribers[i]), this.subscribers.pop(), !0;
424
+ const n = this.subscribers.length - 1;
425
+ return s !== n && (this.subscribers[s] = this.subscribers[n]), this.subscribers.pop(), !0;
424
426
  }
425
427
  has(e) {
426
428
  return this.subscribers ? this.subscribers.indexOf(e) !== -1 : !1;
@@ -433,11 +435,11 @@ class re {
433
435
  /** Iterates with error handling to prevent one failure from breaking the chain */
434
436
  forEachSafe(e, s) {
435
437
  if (this.subscribers)
436
- for (let i = 0; i < this.subscribers.length; i++)
438
+ for (let n = 0; n < this.subscribers.length; n++)
437
439
  try {
438
- e(this.subscribers[i], i);
439
- } catch (n) {
440
- s ? s(n) : console.error("[SubscriberManager] Error in subscriber callback:", n);
440
+ e(this.subscribers[n], n);
441
+ } catch (i) {
442
+ s ? s(i) : console.error("[SubscriberManager] Error in subscriber callback:", i);
441
443
  }
442
444
  }
443
445
  get size() {
@@ -491,12 +493,12 @@ class de {
491
493
  /** Returns current stats for the pool (dev mode only). */
492
494
  getStats() {
493
495
  if (!T || !this.stats) return null;
494
- const { acquired: e, released: s, rejected: i } = this.stats, n = i.frozen + i.tooLarge + i.poolFull;
496
+ const { acquired: e, released: s, rejected: n } = this.stats, i = n.frozen + n.tooLarge + n.poolFull;
495
497
  return {
496
498
  acquired: e,
497
499
  released: s,
498
- rejected: i,
499
- leaked: e - s - n,
500
+ rejected: n,
501
+ leaked: e - s - i,
500
502
  poolSize: this.pool.length
501
503
  };
502
504
  }
@@ -532,7 +534,7 @@ function Ke(t) {
532
534
  function We(t) {
533
535
  return Je(t) && typeof t.execute == "function";
534
536
  }
535
- function Ue(t, e, s, i) {
537
+ function Ue(t, e, s, n) {
536
538
  if (e) {
537
539
  if (Ye(e)) {
538
540
  e.addDependency(t);
@@ -542,27 +544,27 @@ function Ue(t, e, s, i) {
542
544
  s.add(e);
543
545
  return;
544
546
  }
545
- We(e) && i.add(e);
547
+ We(e) && n.add(e);
546
548
  }
547
549
  }
548
- function Ze(t, e, s, i) {
550
+ function Ze(t, e, s, n) {
549
551
  if (e !== S && s !== O)
550
552
  for (let r = 0; r < e.length; r++) {
551
553
  const o = e[r];
552
554
  o && (o._tempUnsub = s[r]);
553
555
  }
554
- const n = j.acquire();
555
- n.length = t.length;
556
+ const i = j.acquire();
557
+ i.length = t.length;
556
558
  for (let r = 0; r < t.length; r++) {
557
559
  const o = t[r];
558
- o && (o._tempUnsub ? (n[r] = o._tempUnsub, o._tempUnsub = void 0) : (w.checkCircular(o, i), n[r] = o.subscribe(i)));
560
+ o && (o._tempUnsub ? (i[r] = o._tempUnsub, o._tempUnsub = void 0) : (w.checkCircular(o, n), i[r] = o.subscribe(n)));
559
561
  }
560
562
  if (e !== S)
561
563
  for (let r = 0; r < e.length; r++) {
562
564
  const o = e[r];
563
565
  o?._tempUnsub && (o._tempUnsub(), o._tempUnsub = void 0);
564
566
  }
565
- return s !== O && j.release(s), n;
567
+ return s !== O && j.release(s), i;
566
568
  }
567
569
  class et extends Ne {
568
570
  constructor(e, s) {
@@ -626,8 +628,8 @@ function H(t, e, s) {
626
628
  return new e(`Reference error (${s}): ${t.message}`, t);
627
629
  if (t instanceof k)
628
630
  return t;
629
- const i = t instanceof Error ? t.message : String(t), n = t instanceof Error ? t : null;
630
- return new e(`Unexpected error (${s}): ${i}`, n);
631
+ const n = t instanceof Error ? t.message : String(t), i = t instanceof Error ? t : null;
632
+ return new e(`Unexpected error (${s}): ${n}`, i);
631
633
  }
632
634
  const Oe = d.RESOLVED | d.PENDING | d.REJECTED, ce = Array(Oe + 1).fill(oe.IDLE);
633
635
  ce[d.RESOLVED] = oe.RESOLVED;
@@ -639,18 +641,18 @@ class Ae extends Ne {
639
641
  throw new X(y.COMPUTED_MUST_BE_FUNCTION);
640
642
  if (super(), this._cachedErrors = null, this._errorCacheEpoch = -1, this._value = void 0, this.flags = d.DIRTY | d.IDLE, this._error = null, this._promiseId = 0, this._equal = s.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in s ? s.defaultValue : ge, this._hasDefaultValue = this._defaultValue !== ge, this._onError = s.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._functionSubscribersStore = new re(), this._objectSubscribersStore = new re(), this._dependencies = S, this._dependencyVersions = D, this._unsubscribes = O, this._notifyJob = () => {
641
643
  this._functionSubscribersStore.forEachSafe(
642
- (i) => i(),
643
- (i) => console.error(i)
644
+ (n) => n(),
645
+ (n) => console.error(n)
644
646
  ), this._objectSubscribersStore.forEachSafe(
645
- (i) => i.execute(),
646
- (i) => console.error(i)
647
+ (n) => n.execute(),
648
+ (n) => console.error(n)
647
649
  );
648
650
  }, this._trackable = Object.assign(() => this._markDirty(), {
649
- addDependency: (i) => {
651
+ addDependency: (n) => {
650
652
  }
651
653
  }), w.attachDebugInfo(this, "computed", this.id), w.enabled) {
652
- const i = this;
653
- i.subscriberCount = () => this._functionSubscribersStore.size + this._objectSubscribersStore.size, i.isDirty = () => this._isDirty(), i.dependencies = this._dependencies, i.stateFlags = this._getFlagsAsString();
654
+ const n = this;
655
+ n.subscriberCount = () => this._functionSubscribersStore.size + this._objectSubscribersStore.size, n.isDirty = () => this._isDirty(), n.dependencies = this._dependencies, n.stateFlags = this._getFlagsAsString();
654
656
  }
655
657
  if (s.lazy === !1)
656
658
  try {
@@ -694,10 +696,10 @@ class Ae extends Ne {
694
696
  return this._cachedErrors;
695
697
  const s = /* @__PURE__ */ new Set();
696
698
  this._error && s.add(this._error);
697
- for (let i = 0; i < this._dependencies.length; i++) {
698
- const n = this._dependencies[i];
699
- if (n && "errors" in n) {
700
- const r = n.errors;
699
+ for (let n = 0; n < this._dependencies.length; n++) {
700
+ const i = this._dependencies[n];
701
+ if (i && "errors" in i) {
702
+ const r = i.errors;
701
703
  for (let o = 0; o < r.length; o++) {
702
704
  const c = r[o];
703
705
  c && s.add(c);
@@ -785,29 +787,29 @@ class Ae extends Ne {
785
787
  const e = this._prepareComputationContext();
786
788
  let s = !1;
787
789
  try {
788
- const i = q.run(this._trackable, this._fn);
789
- this._commitDependencies(e), s = !0, Re(i) ? this._handleAsyncComputation(i) : this._handleSyncResult(i);
790
- } catch (i) {
790
+ const n = q.run(this._trackable, this._fn);
791
+ this._commitDependencies(e), s = !0, Re(n) ? this._handleAsyncComputation(n) : this._handleSyncResult(n);
792
+ } catch (n) {
791
793
  if (!s)
792
794
  try {
793
795
  this._commitDependencies(e), s = !0;
794
- } catch (n) {
795
- this._handleComputationError(n);
796
+ } catch (i) {
797
+ this._handleComputationError(i);
796
798
  }
797
- this._handleComputationError(i);
799
+ this._handleComputationError(n);
798
800
  } finally {
799
801
  this._cleanupContext(e, s), this._setRecomputing(!1);
800
802
  }
801
803
  }
802
804
  _prepareComputationContext() {
803
- const e = this._dependencies, s = this._dependencyVersions, i = M.acquire(), n = A.acquire(), r = xe(), o = { depCount: 0 }, c = (_) => {
804
- _._lastSeenEpoch !== r && (_._lastSeenEpoch = r, o.depCount < i.length ? (i[o.depCount] = _, n[o.depCount] = _.version) : (i.push(_), n.push(_.version)), o.depCount++);
805
+ const e = this._dependencies, s = this._dependencyVersions, n = M.acquire(), i = A.acquire(), r = xe(), o = { depCount: 0 }, c = (_) => {
806
+ _._lastSeenEpoch !== r && (_._lastSeenEpoch = r, o.depCount < n.length ? (n[o.depCount] = _, i[o.depCount] = _.version) : (n.push(_), i.push(_.version)), o.depCount++);
805
807
  }, f = this._trackable.addDependency;
806
- return this._trackable.addDependency = c, { prevDeps: e, prevVersions: s, nextDeps: i, nextVersions: n, originalAdd: f, state: o };
808
+ return this._trackable.addDependency = c, { prevDeps: e, prevVersions: s, nextDeps: n, nextVersions: i, originalAdd: f, state: o };
807
809
  }
808
810
  _commitDependencies(e) {
809
- const { nextDeps: s, nextVersions: i, state: n, prevDeps: r } = e;
810
- s.length = n.depCount, i.length = n.depCount, this._unsubscribes = Ze(s, r, this._unsubscribes, this), this._dependencies = s, this._dependencyVersions = i;
811
+ const { nextDeps: s, nextVersions: n, state: i, prevDeps: r } = e;
812
+ s.length = i.depCount, n.length = i.depCount, this._unsubscribes = Ze(s, r, this._unsubscribes, this), this._dependencies = s, this._dependencyVersions = n;
811
813
  }
812
814
  _cleanupContext(e, s) {
813
815
  this._trackable.addDependency = e.originalAdd, s ? (e.prevDeps !== S && M.release(e.prevDeps), e.prevVersions !== D && A.release(e.prevVersions)) : (M.release(e.nextDeps), A.release(e.nextVersions));
@@ -819,10 +821,10 @@ class Ae extends Ne {
819
821
  _handleAsyncComputation(e) {
820
822
  this._setPending(), this._clearDirty(), this._notifyJob(), this._promiseId = this._promiseId >= this.MAX_PROMISE_ID ? 1 : this._promiseId + 1;
821
823
  const s = this._promiseId;
822
- e.then((i) => {
823
- s === this._promiseId && this._handleAsyncResolution(i);
824
- }).catch((i) => {
825
- s === this._promiseId && this._handleAsyncRejection(i);
824
+ e.then((n) => {
825
+ s === this._promiseId && this._handleAsyncResolution(n);
826
+ }).catch((n) => {
827
+ s === this._promiseId && this._handleAsyncRejection(n);
826
828
  });
827
829
  }
828
830
  _handleAsyncResolution(e) {
@@ -830,12 +832,12 @@ class Ae extends Ne {
830
832
  this.version = this.version + Number(s) & B, this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1), this._cachedErrors = null, this._errorCacheEpoch = -1, this._notifyJob();
831
833
  }
832
834
  _handleAsyncRejection(e) {
833
- const s = H(e, X, y.COMPUTED_ASYNC_COMPUTATION_FAILED), i = !this._isRejected();
834
- if (this.version = this.version + Number(i) & B, this._error = s, this._setRejected(), this._clearDirty(), this._setRecomputing(!1), this._onError)
835
+ const s = H(e, X, y.COMPUTED_ASYNC_COMPUTATION_FAILED), n = !this._isRejected();
836
+ if (this.version = this.version + Number(n) & B, this._error = s, this._setRejected(), this._clearDirty(), this._setRecomputing(!1), this._onError)
835
837
  try {
836
838
  this._onError(s);
837
- } catch (n) {
838
- console.error(y.CALLBACK_ERROR_IN_ERROR_HANDLER, n);
839
+ } catch (i) {
840
+ console.error(y.CALLBACK_ERROR_IN_ERROR_HANDLER, i);
839
841
  }
840
842
  this._notifyJob();
841
843
  }
@@ -844,8 +846,8 @@ class Ae extends Ne {
844
846
  if (this._error = s, this._setRejected(), this._clearDirty(), this._setRecomputing(!1), this._onError)
845
847
  try {
846
848
  this._onError(s);
847
- } catch (i) {
848
- console.error(y.CALLBACK_ERROR_IN_ERROR_HANDLER, i);
849
+ } catch (n) {
850
+ console.error(y.CALLBACK_ERROR_IN_ERROR_HANDLER, n);
849
851
  }
850
852
  throw s;
851
853
  }
@@ -879,7 +881,7 @@ Object.freeze(Ae.prototype);
879
881
  function st(t, e = {}) {
880
882
  return new Ae(t, e);
881
883
  }
882
- class it extends ve {
884
+ class nt extends ve {
883
885
  /**
884
886
  * Creates a new EffectImpl instance.
885
887
  * @param fn - The effect function to run.
@@ -893,28 +895,28 @@ class it extends ve {
893
895
  }, this.dispose = () => {
894
896
  if (!this.isDisposed) {
895
897
  if (this._setDisposed(), this._safeCleanup(), this._unsubscribes !== O) {
896
- for (let n = 0; n < this._unsubscribes.length; n++) {
897
- const r = this._unsubscribes[n];
898
+ for (let i = 0; i < this._unsubscribes.length; i++) {
899
+ const r = this._unsubscribes[i];
898
900
  r && r();
899
901
  }
900
902
  j.release(this._unsubscribes), this._unsubscribes = O;
901
903
  }
902
904
  this._dependencies !== S && (M.release(this._dependencies), this._dependencies = S), this._dependencyVersions !== D && (A.release(this._dependencyVersions), this._dependencyVersions = D);
903
905
  }
904
- }, this.addDependency = (n) => {
906
+ }, this.addDependency = (i) => {
905
907
  if (this.isExecuting && this._nextDeps && this._nextUnsubs && this._nextVersions) {
906
908
  const r = this._currentEpoch;
907
- if (n._lastSeenEpoch === r) return;
908
- n._lastSeenEpoch = r, this._nextDeps.push(n), this._nextVersions.push(n.version), n._tempUnsub ? (this._nextUnsubs.push(n._tempUnsub), n._tempUnsub = void 0) : this._subscribeTo(n);
909
+ if (i._lastSeenEpoch === r) return;
910
+ i._lastSeenEpoch = r, this._nextDeps.push(i), this._nextVersions.push(i.version), i._tempUnsub ? (this._nextUnsubs.push(i._tempUnsub), i._tempUnsub = void 0) : this._subscribeTo(i);
909
911
  }
910
912
  }, this.execute = () => {
911
913
  if (this.isDisposed || this.isExecuting || !this._shouldExecute()) return;
912
914
  this._checkInfiniteLoop(), this._setExecuting(!0), this._safeCleanup();
913
- const n = this._prepareEffectContext();
915
+ const i = this._prepareEffectContext();
914
916
  let r = !1;
915
917
  try {
916
918
  const o = q.run(this, this._fn);
917
- this._commitEffect(n), r = !0, this._checkLoopWarnings(), Re(o) ? o.then((c) => {
919
+ this._commitEffect(i), r = !0, this._checkLoopWarnings(), Re(o) ? o.then((c) => {
918
920
  !this.isDisposed && typeof c == "function" && (this._cleanup = c);
919
921
  }).catch((c) => {
920
922
  this._handleExecutionError(c);
@@ -922,24 +924,24 @@ class it extends ve {
922
924
  } catch (o) {
923
925
  r = !0, this._handleExecutionError(o), this._cleanup = null;
924
926
  } finally {
925
- this._cleanupEffect(n, r), this._setExecuting(!1);
927
+ this._cleanupEffect(i, r), this._setExecuting(!1);
926
928
  }
927
929
  }, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = s.sync ?? !1, this._maxExecutions = s.maxExecutionsPerSecond ?? L.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = s.maxExecutionsPerFlush ?? L.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = s.trackModifications ?? !1, this._cleanup = null, this._dependencies = S, this._dependencyVersions = D, this._unsubscribes = O, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._onError = s.onError ?? null, this._historyPtr = 0;
928
- const i = Number.isFinite(this._maxExecutions);
929
- this._historyCapacity = i ? Math.min(this._maxExecutions + 1, L.MAX_EXECUTIONS_PER_SECOND + 1) : 0, this._history = T && i && this._historyCapacity > 0 ? new Array(this._historyCapacity).fill(0) : null, this._executionCount = 0, w.attachDebugInfo(this, "effect", this.id);
930
+ const n = Number.isFinite(this._maxExecutions);
931
+ this._historyCapacity = n ? Math.min(this._maxExecutions + 1, L.MAX_EXECUTIONS_PER_SECOND + 1) : 0, this._history = T && n && this._historyCapacity > 0 ? new Array(this._historyCapacity).fill(0) : null, this._executionCount = 0, w.attachDebugInfo(this, "effect", this.id);
930
932
  }
931
933
  /**
932
934
  * Prepares the execution context by acquiring pools and setting up epoch.
933
935
  * @returns The prepared EffectContext.
934
936
  */
935
937
  _prepareEffectContext() {
936
- const e = this._dependencies, s = this._dependencyVersions, i = this._unsubscribes, n = M.acquire(), r = A.acquire(), o = j.acquire(), c = xe();
937
- if (e !== S && i !== O)
938
+ const e = this._dependencies, s = this._dependencyVersions, n = this._unsubscribes, i = M.acquire(), r = A.acquire(), o = j.acquire(), c = xe();
939
+ if (e !== S && n !== O)
938
940
  for (let f = 0; f < e.length; f++) {
939
941
  const _ = e[f];
940
- _ && (_._tempUnsub = i[f]);
942
+ _ && (_._tempUnsub = n[f]);
941
943
  }
942
- return this._nextDeps = n, this._nextVersions = r, this._nextUnsubs = o, this._currentEpoch = c, { prevDeps: e, prevVersions: s, prevUnsubs: i, nextDeps: n, nextVersions: r, nextUnsubs: o };
944
+ return this._nextDeps = i, this._nextVersions = r, this._nextUnsubs = o, this._currentEpoch = c, { prevDeps: e, prevVersions: s, prevUnsubs: n, nextDeps: i, nextVersions: r, nextUnsubs: o };
943
945
  }
944
946
  /**
945
947
  * Commits the tracked dependencies as the current active dependencies.
@@ -957,21 +959,21 @@ class it extends ve {
957
959
  _cleanupEffect(e, s) {
958
960
  if (this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, s) {
959
961
  if (e.prevDeps !== S) {
960
- for (let i = 0; i < e.prevDeps.length; i++) {
961
- const n = e.prevDeps[i];
962
- n?._tempUnsub && (n._tempUnsub(), n._tempUnsub = void 0);
962
+ for (let n = 0; n < e.prevDeps.length; n++) {
963
+ const i = e.prevDeps[n];
964
+ i?._tempUnsub && (i._tempUnsub(), i._tempUnsub = void 0);
963
965
  }
964
966
  M.release(e.prevDeps);
965
967
  }
966
968
  e.prevUnsubs !== O && j.release(e.prevUnsubs), e.prevVersions !== D && A.release(e.prevVersions);
967
969
  } else {
968
970
  M.release(e.nextDeps), A.release(e.nextVersions);
969
- for (let i = 0; i < e.nextUnsubs.length; i++)
970
- e.nextUnsubs[i]?.();
971
+ for (let n = 0; n < e.nextUnsubs.length; n++)
972
+ e.nextUnsubs[n]?.();
971
973
  if (j.release(e.nextUnsubs), e.prevDeps !== S)
972
- for (let i = 0; i < e.prevDeps.length; i++) {
973
- const n = e.prevDeps[i];
974
- n && (n._tempUnsub = void 0);
974
+ for (let n = 0; n < e.prevDeps.length; n++) {
975
+ const i = e.prevDeps[n];
976
+ i && (i._tempUnsub = void 0);
975
977
  }
976
978
  }
977
979
  }
@@ -1033,13 +1035,13 @@ class it extends ve {
1033
1035
  * @throws {EffectError} If an infinite loop is detected.
1034
1036
  */
1035
1037
  _checkInfiniteLoop() {
1036
- if (this._lastFlushEpoch !== ie && (this._lastFlushEpoch = ie, this._executionsInEpoch = 0), this._executionsInEpoch++, this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), Qe() > L.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history && this._maxExecutions > 0) {
1037
- const e = Date.now(), s = this._historyPtr, i = this._historyCapacity;
1038
+ if (this._lastFlushEpoch !== ne && (this._lastFlushEpoch = ne, this._executionsInEpoch = 0), this._executionsInEpoch++, this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), Qe() > L.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history && this._maxExecutions > 0) {
1039
+ const e = Date.now(), s = this._historyPtr, n = this._historyCapacity;
1038
1040
  this._history[s] = e;
1039
- const n = (s + 1) % i, r = this._history[n] ?? 0;
1040
- if (this._historyPtr = n, r > 0 && e - r < Le.ONE_SECOND_MS) {
1041
+ const i = (s + 1) % n, r = this._history[i] ?? 0;
1042
+ if (this._historyPtr = i, r > 0 && e - r < Le.ONE_SECOND_MS) {
1041
1043
  const o = new V(
1042
- `Effect executed ${i} times within 1 second. Infinite loop suspected`
1044
+ `Effect executed ${n} times within 1 second. Infinite loop suspected`
1043
1045
  );
1044
1046
  if (this.dispose(), console.error(o), this._onError && this._onError(o), T)
1045
1047
  throw o;
@@ -1090,10 +1092,10 @@ class it extends ve {
1090
1092
  if (this._trackModifications && w.enabled) {
1091
1093
  const e = this._dependencies;
1092
1094
  for (let s = 0; s < e.length; s++) {
1093
- const i = e[s];
1094
- i && i._modifiedAtEpoch === this._currentEpoch && w.warn(
1095
+ const n = e[s];
1096
+ n && n._modifiedAtEpoch === this._currentEpoch && w.warn(
1095
1097
  !0,
1096
- `Effect is reading a dependency (${w.getDebugName(i) || "unknown"}) that it just modified. Infinite loop may occur`
1098
+ `Effect is reading a dependency (${w.getDebugName(n) || "unknown"}) that it just modified. Infinite loop may occur`
1097
1099
  );
1098
1100
  }
1099
1101
  }
@@ -1102,7 +1104,7 @@ class it extends ve {
1102
1104
  function I(t, e = {}) {
1103
1105
  if (typeof t != "function")
1104
1106
  throw new V(y.EFFECT_MUST_BE_FUNCTION);
1105
- const s = new it(t, e);
1107
+ const s = new nt(t, e);
1106
1108
  return s.execute(), s;
1107
1109
  }
1108
1110
  function b(t) {
@@ -1121,7 +1123,7 @@ function ue(t) {
1121
1123
  }
1122
1124
  return e.tagName.toLowerCase();
1123
1125
  }
1124
- function nt() {
1126
+ function it() {
1125
1127
  if (typeof window < "u") {
1126
1128
  const t = window.__ATOM_DEBUG__;
1127
1129
  if (typeof t == "boolean")
@@ -1134,7 +1136,7 @@ function nt() {
1134
1136
  }
1135
1137
  return !1;
1136
1138
  }
1137
- let P = nt();
1139
+ let P = it();
1138
1140
  const h = {
1139
1141
  get enabled() {
1140
1142
  return P;
@@ -1153,8 +1155,8 @@ const h = {
1153
1155
  */
1154
1156
  domUpdated(t, e, s) {
1155
1157
  if (!P) return;
1156
- const i = ue(t);
1157
- console.log(`[atom-effect-jquery] DOM updated: ${i}.${e} =`, s), rt(t);
1158
+ const n = ue(t);
1159
+ console.log(`[atom-effect-jquery] DOM updated: ${n}.${e} =`, s), rt(t);
1158
1160
  },
1159
1161
  cleanup(t) {
1160
1162
  P && console.log(`[atom-effect-jquery] Cleanup: ${t}`);
@@ -1166,8 +1168,8 @@ const h = {
1166
1168
  function rt(t) {
1167
1169
  const e = t[0];
1168
1170
  if (!e || !document.contains(e)) return;
1169
- const s = "atom_debug_timer", i = "atom_debug_cleanup_timer", n = "atom_debug_org_style";
1170
- clearTimeout(t.data(s)), clearTimeout(t.data(i)), t.data(n) || t.data(n, {
1171
+ const s = "atom_debug_timer", n = "atom_debug_cleanup_timer", i = "atom_debug_org_style";
1172
+ clearTimeout(t.data(s)), clearTimeout(t.data(n)), t.data(i) || t.data(i, {
1171
1173
  outline: t.css("outline"),
1172
1174
  outlineOffset: t.css("outline-offset"),
1173
1175
  transition: t.css("transition")
@@ -1178,16 +1180,16 @@ function rt(t) {
1178
1180
  // Remove transition for instant feedback on update
1179
1181
  });
1180
1182
  const r = setTimeout(() => {
1181
- const o = t.data(n);
1183
+ const o = t.data(i);
1182
1184
  t.css("transition", "outline 0.5s ease-out"), requestAnimationFrame(() => {
1183
1185
  t.css({
1184
1186
  outline: o?.outline || "",
1185
1187
  "outline-offset": o?.outlineOffset || ""
1186
1188
  });
1187
1189
  const c = setTimeout(() => {
1188
- t.css("transition", o?.transition || ""), t.removeData(s), t.removeData(i), t.removeData(n);
1190
+ t.css("transition", o?.transition || ""), t.removeData(s), t.removeData(n), t.removeData(i);
1189
1191
  }, 500);
1190
- t.data(i, c);
1192
+ t.data(n, c);
1191
1193
  });
1192
1194
  }, 100);
1193
1195
  t.data(s, r);
@@ -1224,8 +1226,8 @@ function ke() {
1224
1226
  }
1225
1227
  function Fe(t, e, s = {}) {
1226
1228
  const {
1227
- debounce: i,
1228
- event: n = "input",
1229
+ debounce: n,
1230
+ event: i = "input",
1229
1231
  parse: r = (p) => p,
1230
1232
  format: o = (p) => String(p ?? "")
1231
1233
  } = s, c = ke(), f = () => {
@@ -1247,9 +1249,9 @@ function Fe(t, e, s = {}) {
1247
1249
  e.value = r(t.val());
1248
1250
  }), c.phase = "idle");
1249
1251
  }, v = () => {
1250
- c.phase === "idle" && (i ? (c.timeoutId && clearTimeout(c.timeoutId), c.timeoutId = window.setTimeout(F, i)) : F());
1252
+ c.phase === "idle" && (n ? (c.timeoutId && clearTimeout(c.timeoutId), c.timeoutId = window.setTimeout(F, n)) : F());
1251
1253
  };
1252
- return t.on(n, v), t.on("change", v), { effect: () => {
1254
+ return t.on(i, v), t.on("change", v), { effect: () => {
1253
1255
  const p = o(e.value), $ = t.val();
1254
1256
  if ($ !== p) {
1255
1257
  if (c.hasFocus && r($) === e.value)
@@ -1257,7 +1259,7 @@ function Fe(t, e, s = {}) {
1257
1259
  c.phase = "syncing-to-dom", t.val(p), h.domUpdated(t, "val", p), c.phase = "idle";
1258
1260
  }
1259
1261
  }, cleanup: () => {
1260
- t.off(n, v), t.off("change", v), t.off("compositionstart", f), t.off("compositionend", _), t.off("focus", C), t.off("blur", m), c.timeoutId && clearTimeout(c.timeoutId);
1262
+ t.off(i, v), t.off("change", v), t.off("compositionstart", f), t.off("compositionend", _), t.off("focus", C), t.off("blur", m), c.timeoutId && clearTimeout(c.timeoutId);
1261
1263
  } };
1262
1264
  }
1263
1265
  class ut {
@@ -1282,15 +1284,15 @@ class ut {
1282
1284
  * Registers an Effect to be disposed later.
1283
1285
  */
1284
1286
  trackEffect(e, s) {
1285
- const i = this.effects.get(e) || [];
1286
- i.push(s), this.effects.set(e, i), this.boundElements.add(e);
1287
+ const n = this.effects.get(e) || [];
1288
+ n.push(s), this.effects.set(e, n), this.boundElements.add(e);
1287
1289
  }
1288
1290
  /**
1289
1291
  * Registers a custom cleanup function (e.g., event listener removal).
1290
1292
  */
1291
1293
  trackCleanup(e, s) {
1292
- const i = this.cleanups.get(e) || [];
1293
- i.push(s), this.cleanups.set(e, i), this.boundElements.add(e);
1294
+ const n = this.cleanups.get(e) || [];
1295
+ n.push(s), this.cleanups.set(e, n), this.boundElements.add(e);
1294
1296
  }
1295
1297
  /**
1296
1298
  * Checks if an element has bindings (Fast check).
@@ -1307,17 +1309,17 @@ class ut {
1307
1309
  if (!this.boundElements.has(e)) return;
1308
1310
  h.cleanup(ue(e));
1309
1311
  const s = this.effects.get(e);
1310
- s && (this.effects.delete(e), s.forEach((n) => {
1312
+ s && (this.effects.delete(e), s.forEach((i) => {
1311
1313
  try {
1312
- n.dispose();
1314
+ i.dispose();
1313
1315
  } catch (r) {
1314
1316
  h.warn("Effect dispose error:", r);
1315
1317
  }
1316
1318
  }));
1317
- const i = this.cleanups.get(e);
1318
- i && (this.cleanups.delete(e), i.forEach((n) => {
1319
+ const n = this.cleanups.get(e);
1320
+ n && (this.cleanups.delete(e), n.forEach((i) => {
1319
1321
  try {
1320
- n();
1322
+ i();
1321
1323
  } catch (r) {
1322
1324
  h.warn("Cleanup error:", r);
1323
1325
  }
@@ -1328,8 +1330,8 @@ class ut {
1328
1330
  * - Essential for deep removal (empty(), remove(), etc.).
1329
1331
  */
1330
1332
  cleanupTree(e) {
1331
- e.querySelectorAll("*").forEach((i) => {
1332
- this.boundElements.has(i) && this.cleanup(i);
1333
+ e.querySelectorAll("*").forEach((n) => {
1334
+ this.boundElements.has(n) && this.cleanup(n);
1333
1335
  }), this.cleanup(e);
1334
1336
  }
1335
1337
  }
@@ -1338,8 +1340,8 @@ let J = null;
1338
1340
  function ht(t = document.body) {
1339
1341
  J || (J = new MutationObserver((e) => {
1340
1342
  for (const s of e)
1341
- s.removedNodes.forEach((i) => {
1342
- l.isKept(i) || i.isConnected || i.nodeType === 1 && l.cleanupTree(i);
1343
+ s.removedNodes.forEach((n) => {
1344
+ l.isKept(n) || n.isConnected || n.nodeType === 1 && l.cleanupTree(n);
1343
1345
  });
1344
1346
  }), J.observe(t, { childList: !0, subtree: !0 }));
1345
1347
  }
@@ -1350,14 +1352,14 @@ u.fn.atomText = function(t, e) {
1350
1352
  return this.each(function() {
1351
1353
  const s = u(this);
1352
1354
  if (b(t)) {
1353
- const i = I(() => {
1354
- const n = E(t), r = e ? e(n) : String(n ?? "");
1355
+ const n = I(() => {
1356
+ const i = E(t), r = e ? e(i) : String(i ?? "");
1355
1357
  s.text(r), h.domUpdated(s, "text", r);
1356
1358
  });
1357
- l.trackEffect(this, i);
1359
+ l.trackEffect(this, n);
1358
1360
  } else {
1359
- const i = e ? e(t) : String(t ?? "");
1360
- s.text(i);
1361
+ const n = e ? e(t) : String(t ?? "");
1362
+ s.text(n);
1361
1363
  }
1362
1364
  });
1363
1365
  };
@@ -1366,8 +1368,8 @@ u.fn.atomHtml = function(t) {
1366
1368
  const e = u(this);
1367
1369
  if (b(t)) {
1368
1370
  const s = I(() => {
1369
- const i = String(E(t) ?? "");
1370
- e.html(i), h.domUpdated(e, "html", i);
1371
+ const n = String(E(t) ?? "");
1372
+ e.html(n), h.domUpdated(e, "html", n);
1371
1373
  });
1372
1374
  l.trackEffect(this, s);
1373
1375
  } else
@@ -1378,49 +1380,49 @@ u.fn.atomClass = function(t, e) {
1378
1380
  return this.each(function() {
1379
1381
  const s = u(this);
1380
1382
  if (b(e)) {
1381
- const i = I(() => {
1382
- const n = !!E(e);
1383
- s.toggleClass(t, n), h.domUpdated(s, `class.${t}`, n);
1383
+ const n = I(() => {
1384
+ const i = !!E(e);
1385
+ s.toggleClass(t, i), h.domUpdated(s, `class.${t}`, i);
1384
1386
  });
1385
- l.trackEffect(this, i);
1387
+ l.trackEffect(this, n);
1386
1388
  } else
1387
1389
  s.toggleClass(t, !!e);
1388
1390
  });
1389
1391
  };
1390
1392
  u.fn.atomCss = function(t, e, s) {
1391
1393
  return this.each(function() {
1392
- const i = u(this);
1394
+ const n = u(this);
1393
1395
  if (b(e)) {
1394
- const n = I(() => {
1396
+ const i = I(() => {
1395
1397
  const r = E(e), o = s ? `${r}${s}` : r;
1396
- i.css(t, o), h.domUpdated(i, `css.${t}`, o);
1398
+ n.css(t, o), h.domUpdated(n, `css.${t}`, o);
1397
1399
  });
1398
- l.trackEffect(this, n);
1400
+ l.trackEffect(this, i);
1399
1401
  } else
1400
- i.css(t, s ? `${e}${s}` : e);
1402
+ n.css(t, s ? `${e}${s}` : e);
1401
1403
  });
1402
1404
  };
1403
1405
  u.fn.atomAttr = function(t, e) {
1404
1406
  return this.each(function() {
1405
- const s = u(this), i = (n) => {
1406
- n == null || n === !1 ? s.removeAttr(t) : n === !0 ? s.attr(t, t) : s.attr(t, String(n)), h.domUpdated(s, `attr.${t}`, n);
1407
+ const s = u(this), n = (i) => {
1408
+ i == null || i === !1 ? s.removeAttr(t) : i === !0 ? s.attr(t, t) : s.attr(t, String(i)), h.domUpdated(s, `attr.${t}`, i);
1407
1409
  };
1408
1410
  if (b(e)) {
1409
- const n = I(() => i(E(e)));
1410
- l.trackEffect(this, n);
1411
+ const i = I(() => n(E(e)));
1412
+ l.trackEffect(this, i);
1411
1413
  } else
1412
- i(e);
1414
+ n(e);
1413
1415
  });
1414
1416
  };
1415
1417
  u.fn.atomProp = function(t, e) {
1416
1418
  return this.each(function() {
1417
1419
  const s = u(this);
1418
1420
  if (b(e)) {
1419
- const i = I(() => {
1420
- const n = E(e);
1421
- s.prop(t, n), h.domUpdated(s, `prop.${t}`, n);
1421
+ const n = I(() => {
1422
+ const i = E(e);
1423
+ s.prop(t, i), h.domUpdated(s, `prop.${t}`, i);
1422
1424
  });
1423
- l.trackEffect(this, i);
1425
+ l.trackEffect(this, n);
1424
1426
  } else
1425
1427
  s.prop(t, e);
1426
1428
  });
@@ -1430,8 +1432,8 @@ u.fn.atomShow = function(t) {
1430
1432
  const e = u(this);
1431
1433
  if (b(t)) {
1432
1434
  const s = I(() => {
1433
- const i = !!E(t);
1434
- e.toggle(i), h.domUpdated(e, "show", i);
1435
+ const n = !!E(t);
1436
+ e.toggle(n), h.domUpdated(e, "show", n);
1435
1437
  });
1436
1438
  l.trackEffect(this, s);
1437
1439
  } else
@@ -1443,8 +1445,8 @@ u.fn.atomHide = function(t) {
1443
1445
  const e = u(this);
1444
1446
  if (b(t)) {
1445
1447
  const s = I(() => {
1446
- const i = !E(t);
1447
- e.toggle(i), h.domUpdated(e, "hide", !i);
1448
+ const n = !E(t);
1449
+ e.toggle(n), h.domUpdated(e, "hide", !n);
1448
1450
  });
1449
1451
  l.trackEffect(this, s);
1450
1452
  } else
@@ -1453,32 +1455,32 @@ u.fn.atomHide = function(t) {
1453
1455
  };
1454
1456
  u.fn.atomVal = function(t, e = {}) {
1455
1457
  return this.each(function() {
1456
- const { effect: s, cleanup: i } = Fe(u(this), t, e), n = I(s);
1457
- l.trackEffect(this, n), l.trackCleanup(this, i);
1458
+ const { effect: s, cleanup: n } = Fe(u(this), t, e), i = I(s);
1459
+ l.trackEffect(this, i), l.trackCleanup(this, n);
1458
1460
  });
1459
1461
  };
1460
1462
  u.fn.atomChecked = function(t) {
1461
1463
  return this.each(function() {
1462
1464
  const e = u(this);
1463
1465
  let s = !1;
1464
- const i = () => {
1466
+ const n = () => {
1465
1467
  s || z(() => {
1466
1468
  t.value = e.prop("checked");
1467
1469
  });
1468
1470
  };
1469
- e.on("change", i), l.trackCleanup(this, () => e.off("change", i));
1470
- const n = I(() => {
1471
+ e.on("change", n), l.trackCleanup(this, () => e.off("change", n));
1472
+ const i = I(() => {
1471
1473
  s = !0, e.prop("checked", t.value), h.domUpdated(e, "checked", t.value), s = !1;
1472
1474
  });
1473
- l.trackEffect(this, n);
1475
+ l.trackEffect(this, i);
1474
1476
  });
1475
1477
  };
1476
1478
  u.fn.atomOn = function(t, e) {
1477
1479
  return this.each(function() {
1478
- const s = u(this), i = function(n) {
1479
- z(() => e.call(this, n));
1480
+ const s = u(this), n = function(i) {
1481
+ z(() => e.call(this, i));
1480
1482
  };
1481
- s.on(t, i), l.trackCleanup(this, () => s.off(t, i));
1483
+ s.on(t, n), l.trackCleanup(this, () => s.off(t, n));
1482
1484
  });
1483
1485
  };
1484
1486
  u.fn.atomUnbind = function() {
@@ -1499,39 +1501,39 @@ function lt(t, e) {
1499
1501
  }) : t.$el.html(String(e ?? ""));
1500
1502
  }
1501
1503
  function ft(t, e) {
1502
- for (const [s, i] of Object.entries(e))
1503
- b(i) ? t.effects.push(() => {
1504
- const n = !!E(i);
1505
- t.$el.toggleClass(s, n), h.domUpdated(t.$el, `class.${s}`, n);
1506
- }) : t.$el.toggleClass(s, !!i);
1504
+ for (const [s, n] of Object.entries(e))
1505
+ b(n) ? t.effects.push(() => {
1506
+ const i = !!E(n);
1507
+ t.$el.toggleClass(s, i), h.domUpdated(t.$el, `class.${s}`, i);
1508
+ }) : t.$el.toggleClass(s, !!n);
1507
1509
  }
1508
1510
  function dt(t, e) {
1509
- for (const [s, i] of Object.entries(e))
1510
- if (Array.isArray(i)) {
1511
- const [n, r] = i;
1512
- b(n) ? t.effects.push(() => {
1513
- const o = `${E(n)}${r}`;
1511
+ for (const [s, n] of Object.entries(e))
1512
+ if (Array.isArray(n)) {
1513
+ const [i, r] = n;
1514
+ b(i) ? t.effects.push(() => {
1515
+ const o = `${E(i)}${r}`;
1514
1516
  t.$el.css(s, o), h.domUpdated(t.$el, `css.${s}`, o);
1515
- }) : t.$el.css(s, `${n}${r}`);
1516
- } else b(i) ? t.effects.push(() => {
1517
- const n = E(i);
1518
- t.$el.css(s, n), h.domUpdated(t.$el, `css.${s}`, n);
1519
- }) : t.$el.css(s, i);
1517
+ }) : t.$el.css(s, `${i}${r}`);
1518
+ } else b(n) ? t.effects.push(() => {
1519
+ const i = E(n);
1520
+ t.$el.css(s, i), h.domUpdated(t.$el, `css.${s}`, i);
1521
+ }) : t.$el.css(s, n);
1520
1522
  }
1521
1523
  function _t(t, e) {
1522
- for (const [s, i] of Object.entries(e)) {
1523
- const n = (r) => {
1524
+ for (const [s, n] of Object.entries(e)) {
1525
+ const i = (r) => {
1524
1526
  r == null || r === !1 ? t.$el.removeAttr(s) : r === !0 ? t.$el.attr(s, s) : t.$el.attr(s, String(r)), h.domUpdated(t.$el, `attr.${s}`, r);
1525
1527
  };
1526
- b(i) ? t.effects.push(() => n(E(i))) : n(i);
1528
+ b(n) ? t.effects.push(() => i(E(n))) : i(n);
1527
1529
  }
1528
1530
  }
1529
1531
  function pt(t, e) {
1530
- for (const [s, i] of Object.entries(e))
1531
- b(i) ? t.effects.push(() => {
1532
- const n = E(i);
1533
- t.$el.prop(s, n), h.domUpdated(t.$el, `prop.${s}`, n);
1534
- }) : t.$el.prop(s, i);
1532
+ for (const [s, n] of Object.entries(e))
1533
+ b(n) ? t.effects.push(() => {
1534
+ const i = E(n);
1535
+ t.$el.prop(s, i), h.domUpdated(t.$el, `prop.${s}`, i);
1536
+ }) : t.$el.prop(s, n);
1535
1537
  }
1536
1538
  function bt(t, e) {
1537
1539
  b(e) ? t.effects.push(() => {
@@ -1546,37 +1548,37 @@ function Et(t, e) {
1546
1548
  }) : t.$el.toggle(!e);
1547
1549
  }
1548
1550
  function gt(t, e) {
1549
- const s = Array.isArray(e) ? e[0] : e, i = Array.isArray(e) ? e[1] : {}, { effect: n, cleanup: r } = Fe(t.$el, s, i);
1550
- t.effects.push(n), t.trackCleanup(r);
1551
+ const s = Array.isArray(e) ? e[0] : e, n = Array.isArray(e) ? e[1] : {}, { effect: i, cleanup: r } = Fe(t.$el, s, n);
1552
+ t.effects.push(i), t.trackCleanup(r);
1551
1553
  }
1552
1554
  function mt(t, e) {
1553
- const s = ke(), i = () => {
1555
+ const s = ke(), n = () => {
1554
1556
  s.phase === "idle" && z(() => {
1555
1557
  e.value = t.$el.prop("checked");
1556
1558
  });
1557
1559
  };
1558
- t.$el.on("change", i), t.trackCleanup(() => t.$el.off("change", i)), t.effects.push(() => {
1560
+ t.$el.on("change", n), t.trackCleanup(() => t.$el.off("change", n)), t.effects.push(() => {
1559
1561
  s.phase = "syncing-to-dom", t.$el.prop("checked", e.value), h.domUpdated(t.$el, "checked", e.value), s.phase = "idle";
1560
1562
  });
1561
1563
  }
1562
1564
  function yt(t, e) {
1563
- for (const [s, i] of Object.entries(e)) {
1564
- const n = function(r) {
1565
- z(() => i.call(this, r));
1565
+ for (const [s, n] of Object.entries(e)) {
1566
+ const i = function(r) {
1567
+ z(() => n.call(this, r));
1566
1568
  };
1567
- t.$el.on(s, n), t.trackCleanup(() => t.$el.off(s, n));
1569
+ t.$el.on(s, i), t.trackCleanup(() => t.$el.off(s, i));
1568
1570
  }
1569
1571
  }
1570
1572
  u.fn.atomBind = function(t) {
1571
1573
  return this.each(function() {
1572
- const e = u(this), s = [], i = {
1574
+ const e = u(this), s = [], n = {
1573
1575
  $el: e,
1574
1576
  el: this,
1575
1577
  effects: s,
1576
- trackCleanup: (n) => l.trackCleanup(this, n)
1578
+ trackCleanup: (i) => l.trackCleanup(this, i)
1577
1579
  };
1578
- t.text !== void 0 && at(i, t.text), t.html !== void 0 && lt(i, t.html), t.class && ft(i, t.class), t.css && dt(i, t.css), t.attr && _t(i, t.attr), t.prop && pt(i, t.prop), t.show !== void 0 && bt(i, t.show), t.hide !== void 0 && Et(i, t.hide), t.val !== void 0 && gt(i, t.val), t.checked !== void 0 && mt(i, t.checked), t.on && yt(i, t.on), s.forEach((n) => {
1579
- const r = I(n);
1580
+ t.text !== void 0 && at(n, t.text), t.html !== void 0 && lt(n, t.html), t.class && ft(n, t.class), t.css && dt(n, t.css), t.attr && _t(n, t.attr), t.prop && pt(n, t.prop), t.show !== void 0 && bt(n, t.show), t.hide !== void 0 && Et(n, t.hide), t.val !== void 0 && gt(n, t.val), t.checked !== void 0 && mt(n, t.checked), t.on && yt(n, t.on), s.forEach((i) => {
1581
+ const r = I(i);
1580
1582
  l.trackEffect(this, r);
1581
1583
  });
1582
1584
  });
@@ -1584,19 +1586,19 @@ u.fn.atomBind = function(t) {
1584
1586
  function St(t) {
1585
1587
  if (t.length === 0) return [];
1586
1588
  const e = t.slice(), s = [0];
1587
- let i, n, r, o;
1589
+ let n, i, r, o;
1588
1590
  const c = t.length;
1589
- for (i = 0; i < c; i++) {
1590
- const C = t[i];
1591
+ for (n = 0; n < c; n++) {
1592
+ const C = t[n];
1591
1593
  if (C !== -1) {
1592
1594
  const m = s[s.length - 1];
1593
1595
  if (t[m] < C) {
1594
- e[i] = m, s.push(i);
1596
+ e[n] = m, s.push(n);
1595
1597
  continue;
1596
1598
  }
1597
- for (n = 0, r = s.length - 1; n < r; )
1598
- o = (n + r) / 2 | 0, t[s[o]] < C ? n = o + 1 : r = o;
1599
- C < t[s[n]] && (n > 0 && (e[i] = s[n - 1]), s[n] = i);
1599
+ for (i = 0, r = s.length - 1; i < r; )
1600
+ o = (i + r) / 2 | 0, t[s[o]] < C ? i = o + 1 : r = o;
1601
+ C < t[s[i]] && (i > 0 && (e[n] = s[i - 1]), s[i] = n);
1600
1602
  }
1601
1603
  }
1602
1604
  let f = s.length, _ = s[f - 1];
@@ -1606,7 +1608,7 @@ function St(t) {
1606
1608
  }
1607
1609
  u.fn.atomList = function(t, e) {
1608
1610
  return this.each(function() {
1609
- const s = u(this), i = ue(this), { key: n, render: r, bind: o, onAdd: c, onRemove: f, empty: _ } = e, C = typeof n == "function" ? n : (p) => p[n], m = /* @__PURE__ */ new Map();
1611
+ const s = u(this), n = ue(this), { key: i, render: r, bind: o, onAdd: c, onRemove: f, empty: _ } = e, C = typeof i == "function" ? i : (p) => p[i], m = /* @__PURE__ */ new Map();
1610
1612
  let F = [], v = null;
1611
1613
  const K = /* @__PURE__ */ new Set(), _e = I(() => {
1612
1614
  const p = t.value, $ = [], pe = /* @__PURE__ */ new Set();
@@ -1614,7 +1616,7 @@ u.fn.atomList = function(t, e) {
1614
1616
  const g = p[a], x = C(g, a);
1615
1617
  $.push(x), pe.add(x);
1616
1618
  }
1617
- if (h.log("list", `${i} updating with ${p.length} items`), p.length === 0 && _) {
1619
+ if (h.log("list", `${n} updating with ${p.length} items`), p.length === 0 && _) {
1618
1620
  v || (v = u(_), s.append(v));
1619
1621
  for (const [, a] of m) {
1620
1622
  a.$el.remove();
@@ -1630,7 +1632,7 @@ u.fn.atomList = function(t, e) {
1630
1632
  const x = () => {
1631
1633
  g.$el.remove();
1632
1634
  const W = g.$el[0];
1633
- W && l.cleanup(W), K.delete(a), h.log("list", `${i} removed item:`, a);
1635
+ W && l.cleanup(W), K.delete(a), h.log("list", `${n} removed item:`, a);
1634
1636
  };
1635
1637
  m.delete(a), K.add(a), f ? Promise.resolve(f(g.$el)).then(x) : x();
1636
1638
  }
@@ -1655,7 +1657,7 @@ u.fn.atomList = function(t, e) {
1655
1657
  R = U;
1656
1658
  } else {
1657
1659
  const N = r(x, a), U = N instanceof Element ? u(N) : u(N);
1658
- m.set(g, { $el: U, item: x }), R ? U.insertBefore(R) : U.appendTo(s), o && o(U, x, a), c && c(U), h.log("list", `${i} added item:`, g);
1660
+ m.set(g, { $el: U, item: x }), R ? U.insertBefore(R) : U.appendTo(s), o && o(U, x, a), c && c(U), h.log("list", `${n} added item:`, g);
1659
1661
  const G = U[0];
1660
1662
  G && (R = G);
1661
1663
  }
@@ -1670,8 +1672,8 @@ u.fn.atomList = function(t, e) {
1670
1672
  const se = /* @__PURE__ */ new WeakMap();
1671
1673
  u.fn.atomMount = function(t, e = {}) {
1672
1674
  return this.each(function() {
1673
- const s = u(this), i = ue(this), n = se.get(this);
1674
- n && (h.log("mount", `${i} unmounting existing component`), n()), h.log("mount", `${i} mounting component`);
1675
+ const s = u(this), n = ue(this), i = se.get(this);
1676
+ i && (h.log("mount", `${n} unmounting existing component`), i()), h.log("mount", `${n} mounting component`);
1675
1677
  let r;
1676
1678
  try {
1677
1679
  r = t(s, e);
@@ -1682,7 +1684,7 @@ u.fn.atomMount = function(t, e = {}) {
1682
1684
  let o = !1;
1683
1685
  const c = () => {
1684
1686
  if (!o) {
1685
- if (o = !0, h.log("mount", `${i} full cleanup`), typeof r == "function")
1687
+ if (o = !0, h.log("mount", `${n} full cleanup`), typeof r == "function")
1686
1688
  try {
1687
1689
  r();
1688
1690
  } catch {
@@ -1703,7 +1705,7 @@ let Ie = !1;
1703
1705
  function Me() {
1704
1706
  if (Ie) return;
1705
1707
  Ie = !0;
1706
- const t = u.fn.on, e = u.fn.off, s = u.fn.remove, i = u.fn.empty, n = u.fn.detach;
1708
+ const t = u.fn.on, e = u.fn.off, s = u.fn.remove, n = u.fn.empty, i = u.fn.detach;
1707
1709
  u.fn.remove = function(r) {
1708
1710
  return (r ? this.filter(r) : this).each(function() {
1709
1711
  l.cleanupTree(this);
@@ -1711,11 +1713,11 @@ function Me() {
1711
1713
  }, u.fn.empty = function() {
1712
1714
  return this.each(function() {
1713
1715
  this.querySelectorAll("*").forEach((o) => l.cleanup(o));
1714
- }), i.call(this);
1716
+ }), n.call(this);
1715
1717
  }, u.fn.detach = function(r) {
1716
1718
  return (r ? this.filter(r) : this).each(function() {
1717
1719
  l.keep(this);
1718
- }), n.call(this, r);
1720
+ }), i.call(this, r);
1719
1721
  }, u.fn.on = function(...r) {
1720
1722
  let o = -1;
1721
1723
  for (let c = r.length - 1; c >= 0; c--)