@raphy-js/raph 1.0.0-dev.18 → 1.0.1-dev.20

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.
@@ -1,10 +1,10 @@
1
1
  var P = Object.defineProperty;
2
2
  var B = (c, e, t) => e in c ? P(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
3
- var D = (c, e, t) => B(c, typeof e != "symbol" ? e + "" : e, t);
3
+ var b = (c, e, t) => B(c, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { reactiveObject as G } from "./reactive-object.js";
5
5
  import { appendScopeChild as z, ScopeNode as M, throwScopeErrors as F, detachScopeChild as K } from "./scope.js";
6
6
  import { watchWithReactivity as Y } from "./watch.js";
7
- const w = 1, d = 2, C = 4, S = 8, T = 16, y = 32, x = 64, W = 128, m = 256, v = 512, E = w | d, R = 16, X = 2;
7
+ const w = 1, p = 2, C = 4, D = 8, T = 16, y = 32, x = 64, W = 128, m = 256, v = 512, E = w | p, R = 16, X = 2;
8
8
  function N(c) {
9
9
  c.dependencyLookupDebt === void 0 && c.dependencyIndex === void 0 || (c.dependencyIndex = void 0, c.dependencyLookupDebt = void 0, c.dependencyLookupSearches = void 0);
10
10
  }
@@ -20,7 +20,7 @@ function q(c, e) {
20
20
  c.dependencyIndex = s, c.dependencyLookupDebt = void 0, c.dependencyLookupSearches = void 0;
21
21
  }
22
22
  function j(c, e, t) {
23
- var l;
23
+ var a;
24
24
  const i = c.firstSub;
25
25
  if (i === null)
26
26
  return;
@@ -31,17 +31,17 @@ function j(c, e, t) {
31
31
  if (s.sub === e)
32
32
  return c.subSearchCursor = s.nextSub ?? i, s;
33
33
  if (t) {
34
- const r = (l = e.dependencyIndex) == null ? void 0 : l.get(c);
34
+ const r = (a = e.dependencyIndex) == null ? void 0 : a.get(c);
35
35
  if (r !== void 0)
36
36
  return c.subSearchCursor = r.nextSub ?? i, r;
37
37
  if (e.dependencyIndex !== void 0)
38
38
  return;
39
39
  }
40
- let a = s.nextSub ?? i;
41
- for (; a !== s; ) {
42
- if (++n, a.sub === e)
43
- return c.subSearchCursor = a.nextSub ?? i, t && q(e, n), a;
44
- a = a.nextSub ?? i;
40
+ let l = s.nextSub ?? i;
41
+ for (; l !== s; ) {
42
+ if (++n, l.sub === e)
43
+ return c.subSearchCursor = l.nextSub ?? i, t && q(e, n), l;
44
+ l = l.nextSub ?? i;
45
45
  }
46
46
  t && q(e, n);
47
47
  }
@@ -54,41 +54,41 @@ class U {
54
54
  */
55
55
  constructor(e = {}) {
56
56
  // Opt-in стратегия длинного slow path; не добавляет policy field каждой ноде.
57
- D(this, "adaptiveDependencyIndex");
57
+ b(this, "adaptiveDependencyIndex");
58
58
  // Потребитель текущего синхронного чтения; null отключает отслеживание.
59
- D(this, "activeSub", null);
59
+ b(this, "activeSub", null);
60
60
  // Глубина вложенных синхронных границ группировки.
61
- D(this, "batchDepth", 0);
61
+ b(this, "batchDepth", 0);
62
62
  // Индекс следующего элемента внутренней очереди эффектов.
63
- D(this, "effectReadIndex", 0);
63
+ b(this, "effectReadIndex", 0);
64
64
  // Позиция добавления элемента в текущем проходе очереди.
65
- D(this, "effectWriteIndex", 0);
65
+ b(this, "effectWriteIndex", 0);
66
66
  // Граница активного префикса переиспользуемого стека invalidation.
67
- D(this, "invalidationDepth", 0);
67
+ b(this, "invalidationDepth", 0);
68
68
  // Граница активного префикса стека проверки зависимостей.
69
- D(this, "dependencyDepth", 0);
69
+ b(this, "dependencyDepth", 0);
70
70
  // Защита внутренней очереди от вложенного повторного прохода.
71
- D(this, "flushingEffects", !1);
71
+ b(this, "flushingEffects", !1);
72
72
  // Переиспользуемый буфер очереди; прочитанная ячейка сразу освобождает ссылку.
73
- D(this, "effectQueue", new Array(16).fill(void 0));
73
+ b(this, "effectQueue", new Array(16).fill(void 0));
74
74
  // Переиспользуемый стек распространения invalidation; исходный способ выделения сохранён.
75
- D(this, "invalidationStack", new Array(512).fill(null));
75
+ b(this, "invalidationStack", new Array(512).fill(null));
76
76
  // Переиспользуемый стек проверки зависимостей с защитой активного вложенного префикса.
77
- D(this, "dependencyStack", []);
77
+ b(this, "dependencyStack", []);
78
78
  // Общие адаптеры receiver для handles этого экземпляра.
79
79
  // Создаются один раз, чтобы computed не хранил дополнительную ссылку на движок
80
80
  // и не выделял отдельные get/peek closures на каждый источник.
81
- D(this, "handleReaders", this.createHandleReaders());
81
+ b(this, "handleReaders", this.createHandleReaders());
82
82
  // Выбранная внешняя политика; у синхронного экземпляра отсутствует.
83
- D(this, "effectScheduler");
83
+ b(this, "effectScheduler");
84
84
  // Прямой обработчик очереди, выбранный один раз при создании экземпляра.
85
- D(this, "flushEffects");
85
+ b(this, "flushEffects");
86
86
  /**
87
87
  * Синхронная регистрация эффекта для Runtime и watch независимо от внешней политики.
88
88
  * Это связанная ссылка на реализацию effect(), а не делегирующая функция.
89
89
  * @internal
90
90
  */
91
- D(this, "_effectImmediate");
91
+ b(this, "_effectImmediate");
92
92
  this.adaptiveDependencyIndex = e.adaptiveDependencyIndex ?? !1, this.effectScheduler = e.effectScheduler, this._effectImmediate = this.effect.bind(this), this.signal = this.signal.bind(this), this.computed = this.computed.bind(this), this.reactive = this.reactive.bind(this), this.watch = this.watch.bind(this), this.batch = this.batch.bind(this), this.untracked = this.untracked.bind(this), this.scope = this.scope.bind(this), this._signalAccess = this._signalAccess.bind(this), this._computedAccess = this._computedAccess.bind(this), this._ownedSignal = this._ownedSignal.bind(this), this._ownedComputed = this._ownedComputed.bind(this), this._isTracking = this._isTracking.bind(this), this._isFlushingEffects = this._isFlushingEffects.bind(this), this._startBatch = this._startBatch.bind(this), this._endBatch = this._endBatch.bind(this), this.effect = this.effectScheduler === void 0 ? this._effectImmediate : this.createScheduledEffect.bind(this), this.flushEffects = this.effectScheduler === void 0 ? this.flushSyncEffects : this.flushExternalEffects;
93
93
  }
94
94
  // ---------------------------------------------
@@ -102,21 +102,21 @@ class U {
102
102
  signal(e) {
103
103
  let t = e, i;
104
104
  const s = () => {
105
- const a = i;
106
- if (a !== void 0)
107
- return this.readSignalValue(a);
108
- const l = this.activeSub;
109
- return l === null || (i = this.materializeSignal(
105
+ const l = i;
106
+ if (l !== void 0)
107
+ return this.readSignalValue(l);
108
+ const a = this.activeSub;
109
+ return a === null || (i = this.materializeSignal(
110
110
  t,
111
- l
111
+ a
112
112
  )), t;
113
- }, n = (a) => {
114
- const l = i;
115
- if (l !== void 0) {
116
- this.writeSignalValue(l, a);
113
+ }, n = (l) => {
114
+ const a = i;
115
+ if (a !== void 0) {
116
+ this.writeSignalValue(a, l);
117
117
  return;
118
118
  }
119
- t !== a && (t = a);
119
+ t !== l && (t = l);
120
120
  };
121
121
  return {
122
122
  get: s,
@@ -147,7 +147,7 @@ class U {
147
147
  * @param onStop Однократная окончательная очистка, независимая от повторных запусков.
148
148
  */
149
149
  effect(e, t) {
150
- const i = this.allocateGraphRecord(void 0, e, d | w | y);
150
+ const i = this.allocateGraphRecord(void 0, e, p | w | y);
151
151
  t !== void 0 && (i.onStop = t);
152
152
  const s = this.activeSub;
153
153
  s !== null && s.flags & y && z(s, i);
@@ -156,8 +156,8 @@ class U {
156
156
  } catch (n) {
157
157
  try {
158
158
  this.disposeEffect(i);
159
- } catch (a) {
160
- throw new AggregateError([n, a], "Effect registration and cleanup failed.");
159
+ } catch (l) {
160
+ throw new AggregateError([n, l], "Effect registration and cleanup failed.");
161
161
  }
162
162
  throw n;
163
163
  }
@@ -290,43 +290,43 @@ class U {
290
290
  * @param onStop Однократная окончательная очистка.
291
291
  */
292
292
  createScheduledEffect(e, t) {
293
- const i = this.allocateGraphRecord(void 0, e, d | w | y);
293
+ const i = this.allocateGraphRecord(void 0, e, p | w | y);
294
294
  let s = !1;
295
295
  t !== void 0 && (i.onStop = t);
296
296
  const n = this.activeSub;
297
297
  n !== null && n.flags & y && z(n, i);
298
- const a = () => {
298
+ const l = () => {
299
299
  if (!(!(i.flags & x) || i.evaluate === void 0)) {
300
300
  i.flags &= ~x, s = !0;
301
301
  try {
302
302
  this.executeEffect(i);
303
- } catch (l) {
303
+ } catch (a) {
304
304
  if (!this.batchDepth && this.effectReadIndex !== this.effectWriteIndex)
305
305
  try {
306
306
  this.flushEffects();
307
307
  } catch (r) {
308
308
  throw new AggregateError(
309
- [l, r],
309
+ [a, r],
310
310
  "Effect execution and queue processing failed."
311
311
  );
312
312
  }
313
- throw l;
313
+ throw a;
314
314
  }
315
315
  !this.batchDepth && this.effectReadIndex !== this.effectWriteIndex && this.flushEffects();
316
316
  }
317
317
  };
318
318
  try {
319
- const l = this.effectScheduler.bind(a);
320
- l.cancelPending = () => i.evaluate === void 0 || !s ? !1 : (this.settleCancelledDependencies(i), i.flags &= ~(x | E | C), !this.batchDepth && this.effectReadIndex !== this.effectWriteIndex && this.flushEffects(), !0), l.rearmPending = () => {
321
- i.evaluate !== void 0 && (i.flags |= d | x, l.schedule());
322
- }, i.effectTask = l, this.requestEffectTask(i);
323
- } catch (l) {
319
+ const a = this.effectScheduler.bind(l);
320
+ a.cancelPending = () => i.evaluate === void 0 || !s ? !1 : (this.settleCancelledDependencies(i), i.flags &= ~(x | E | C), !this.batchDepth && this.effectReadIndex !== this.effectWriteIndex && this.flushEffects(), !0), a.rearmPending = () => {
321
+ i.evaluate !== void 0 && (i.flags |= p | x, a.schedule());
322
+ }, i.effectTask = a, this.requestEffectTask(i);
323
+ } catch (a) {
324
324
  try {
325
325
  this.disposeEffect(i);
326
326
  } catch (r) {
327
- throw new AggregateError([l, r], "Effect registration and cleanup failed.");
327
+ throw new AggregateError([a, r], "Effect registration and cleanup failed.");
328
328
  }
329
- throw l;
329
+ throw a;
330
330
  }
331
331
  return !this.batchDepth && this.effectReadIndex !== this.effectWriteIndex && this.flushEffects(), () => this.disposeEffect(i);
332
332
  }
@@ -337,7 +337,7 @@ class U {
337
337
  readSignalValue(e) {
338
338
  const t = this.activeSub;
339
339
  let i = null;
340
- return t !== null && (i = this.trackDependency(e, t)), e.flags & d && this.commitSignalValue(e, i), e.cachedValue;
340
+ return t !== null && (i = this.trackDependency(e, t)), e.flags & p && this.commitSignalValue(e, i), e.cachedValue;
341
341
  }
342
342
  /**
343
343
  * Записывает новое значение или откладывает его фиксацию до чтения в batch.
@@ -345,19 +345,19 @@ class U {
345
345
  * Без batch и внешней политики очередь эффектов завершается до возврата из set().
346
346
  */
347
347
  writeSignalValue(e, t) {
348
- if (e.flags & d || this.batchDepth) {
349
- const s = !!(e.flags & d);
350
- if ((e.flags & d ? e.pendingValue : e.cachedValue) === t)
348
+ if (e.flags & p || this.batchDepth) {
349
+ const s = !!(e.flags & p);
350
+ if ((e.flags & p ? e.pendingValue : e.cachedValue) === t)
351
351
  return;
352
352
  if (e.pendingValue = t, e.cachedValue === t)
353
- e.flags &= ~d, e.pendingAuthor = void 0;
353
+ e.flags &= ~p, e.pendingAuthor = void 0;
354
354
  else {
355
- e.flags |= d;
356
- const l = this.activeSub !== null && this.activeSub.flags & S ? this.activeSub : null;
357
- s ? e.pendingAuthor !== l && (e.pendingAuthor = null) : e.pendingAuthor = l;
355
+ e.flags |= p;
356
+ const a = this.activeSub !== null && this.activeSub.flags & D ? this.activeSub : null;
357
+ s ? e.pendingAuthor !== a && (e.pendingAuthor = null) : e.pendingAuthor = a;
358
358
  }
359
- const a = e.firstSub;
360
- a != null && (!s || this.activeSub !== null && this.activeSub.flags & S || e.flags & v) && this.propagateInvalidation(a, !0);
359
+ const l = e.firstSub;
360
+ l != null && (!s || this.activeSub !== null && this.activeSub.flags & D || e.flags & v) && this.propagateInvalidation(l, !0);
361
361
  return;
362
362
  }
363
363
  if (e.cachedValue === t)
@@ -377,8 +377,8 @@ class U {
377
377
  return s;
378
378
  const n = this.activeSub;
379
379
  if (n !== null) {
380
- const a = n.tailDep;
381
- n.flags & W ? (a === null || a.dep !== e) && this.appendInitialDependency(e, n) : this.trackDependency(e, n);
380
+ const l = n.tailDep;
381
+ n.flags & W ? (l === null || l.dep !== e) && this.appendInitialDependency(e, n) : this.trackDependency(e, n);
382
382
  }
383
383
  return s;
384
384
  }
@@ -389,12 +389,12 @@ class U {
389
389
  */
390
390
  evaluateFirstValue(e) {
391
391
  const t = e.flags & v, i = e.evaluate;
392
- e.flags = t | S | W;
392
+ e.flags = t | D | W;
393
393
  const s = this.activeSub;
394
394
  this.activeSub = e;
395
395
  try {
396
396
  const n = i();
397
- return e.evaluate !== i ? (e.cachedValue = void 0, e.flags = 0, n) : (e.cachedValue = n, e.flags = t | (e.flags & C ? d : 0), n);
397
+ return e.evaluate !== i ? (e.cachedValue = void 0, e.flags = 0, n) : (e.cachedValue = n, e.flags = t | (e.flags & C ? p : 0), n);
398
398
  } catch (n) {
399
399
  throw e.evaluate !== i ? (e.cachedValue = void 0, e.flags = 0, n) : (e.flags = t | m, s !== null && this.trackDependency(e, s), n);
400
400
  } finally {
@@ -407,7 +407,7 @@ class U {
407
407
  */
408
408
  refreshComputedValue(e, t, i = null) {
409
409
  try {
410
- if (t & (d | C | m))
410
+ if (t & (p | C | m))
411
411
  return this.recomputeValue(e, i) || (e.flags &= ~E), e.cachedValue;
412
412
  const s = e.firstDep;
413
413
  return (s === null || !this.refreshDependencies(e, s) || !this.recomputeValue(e, i)) && (e.flags &= ~E), e.cachedValue;
@@ -422,7 +422,7 @@ class U {
422
422
  */
423
423
  commitSignalValue(e, t) {
424
424
  const i = e.cachedValue;
425
- e.cachedValue = e.pendingValue, e.flags &= ~d;
425
+ e.cachedValue = e.pendingValue, e.flags &= ~p;
426
426
  const s = e.pendingAuthor;
427
427
  return e.pendingAuthor = void 0, i === e.cachedValue ? !1 : (e.firstSub !== null && this.confirmSubUpdates(e.firstSub, t, s ?? null), !0);
428
428
  }
@@ -454,21 +454,21 @@ class U {
454
454
  return r;
455
455
  return s !== null ? (t.tailDep = this.reuseDepLink(s, e), s) : t.tailDep = this.insertDependency(e, t, i);
456
456
  }
457
- let n = 0, a = s;
458
- for (; a !== null && n < R; ) {
459
- const r = a;
457
+ let n = 0, l = s;
458
+ for (; l !== null && n < R; ) {
459
+ const r = l;
460
460
  if (r.dep === e)
461
461
  return this.reorderDependency(t, r, i), t.tailDep = r, r;
462
- a = r.nextDep, ++n;
462
+ l = r.nextDep, ++n;
463
463
  }
464
- let l = i;
465
- for (; l !== null && n < R; ) {
466
- const r = l;
464
+ let a = i;
465
+ for (; a !== null && n < R; ) {
466
+ const r = a;
467
467
  if (r.dep === e)
468
468
  return r;
469
- l = r.prevDep, ++n;
469
+ a = r.prevDep, ++n;
470
470
  }
471
- if (a !== null || l !== null) {
471
+ if (l !== null || a !== null) {
472
472
  const r = j(e, t, this.adaptiveDependencyIndex);
473
473
  if (r !== void 0)
474
474
  return this.reorderDependency(t, r, i), t.tailDep = r, r;
@@ -481,7 +481,7 @@ class U {
481
481
  * Связь одновременно включается в список потребителей производителя.
482
482
  */
483
483
  appendInitialDependency(e, t) {
484
- var a;
484
+ var l;
485
485
  const i = t.tailDep, s = e.lastSub, n = {
486
486
  dep: e,
487
487
  sub: t,
@@ -490,14 +490,14 @@ class U {
490
490
  prevDep: i,
491
491
  nextDep: null
492
492
  };
493
- return s === null ? e.firstSub = n : s.nextSub = n, e.lastSub = n, i === null ? t.firstDep = n : i.nextDep = n, t.tailDep = n, ++t.depCount, (a = t.dependencyIndex) == null || a.set(e, n), e.flags & v && this.attachDependencyCleanup(n), n;
493
+ return s === null ? e.firstSub = n : s.nextSub = n, e.lastSub = n, i === null ? t.firstDep = n : i.nextDep = n, t.tailDep = n, ++t.depCount, (l = t.dependencyIndex) == null || l.set(e, n), e.flags & v && this.attachDependencyCleanup(n), n;
494
494
  }
495
495
  /**
496
496
  * Вставляет связь после заданного курсора зависимостей потребителя.
497
497
  * Сохраняет ещё не прочитанный хвост списка и увеличивает dependencyCount.
498
498
  */
499
499
  insertDependency(e, t, i) {
500
- var l;
500
+ var a;
501
501
  const s = e.lastSub, n = {
502
502
  dep: e,
503
503
  sub: t,
@@ -507,8 +507,8 @@ class U {
507
507
  nextDep: null
508
508
  };
509
509
  s === null ? e.firstSub = n : s.nextSub = n, e.lastSub = n;
510
- const a = i === null ? t.firstDep : i.nextDep;
511
- return n.nextDep = a, a !== null && (a.prevDep = n), i === null ? t.firstDep = n : i.nextDep = n, ++t.depCount, (l = t.dependencyIndex) == null || l.set(e, n), e.flags & v && this.attachDependencyCleanup(n), n;
510
+ const l = i === null ? t.firstDep : i.nextDep;
511
+ return n.nextDep = l, l !== null && (l.prevDep = n), i === null ? t.firstDep = n : i.nextDep = n, ++t.depCount, (a = t.dependencyIndex) == null || a.set(e, n), e.flags & v && this.attachDependencyCleanup(n), n;
512
512
  }
513
513
  /**
514
514
  * Переназначает существующую связь другому производителю.
@@ -529,8 +529,8 @@ class U {
529
529
  return;
530
530
  const s = t.prevDep, n = t.nextDep;
531
531
  s === null ? e.firstDep = n : s.nextDep = n, n !== null && (n.prevDep = s);
532
- const a = i === null ? e.firstDep : i.nextDep;
533
- t.prevDep = i, t.nextDep = a, a !== null && (a.prevDep = t), i === null ? e.firstDep = t : i.nextDep = t;
532
+ const l = i === null ? e.firstDep : i.nextDep;
533
+ t.prevDep = i, t.nextDep = l, l !== null && (l.prevDep = t), i === null ? e.firstDep = t : i.nextDep = t;
534
534
  }
535
535
  /**
536
536
  * Удаляет непрочитанный хвост зависимостей завершившегося запуска.
@@ -563,11 +563,11 @@ class U {
563
563
  }
564
564
  /** Connects Runtime ownership metadata only for edges whose producer opted in. */
565
565
  attachDependencyCleanup(e) {
566
- var n, a;
566
+ var n, l;
567
567
  const t = e.dep.sourceHooks, i = t == null ? void 0 : t.onDependency;
568
568
  if (i === void 0)
569
569
  return;
570
- const s = ((n = e.sub.sourceHooks) == null ? void 0 : n.dependencyOwner) ?? ((a = e.sub.effectTask) == null ? void 0 : a.dependencyOwner);
570
+ const s = ((n = e.sub.sourceHooks) == null ? void 0 : n.dependencyOwner) ?? ((l = e.sub.effectTask) == null ? void 0 : l.dependencyOwner);
571
571
  s !== void 0 && (e.dependencyCleanup = i(s));
572
572
  }
573
573
  /**
@@ -581,8 +581,8 @@ class U {
581
581
  for (; i != null; ) {
582
582
  const s = i.nextSub, n = i.sub;
583
583
  this.detachDependencyLink(i), this.detachSubLink(i);
584
- const a = n.flags;
585
- (a & (E | S)) === w && (n.flags = a & ~w | d, a & y && this.enqueueEffect(n, e)), i = s;
584
+ const l = n.flags;
585
+ (l & (E | D)) === w && (n.flags = l & ~w | p, l & y && this.enqueueEffect(n, e)), i = s;
586
586
  }
587
587
  e.firstSub = e.lastSub = null, e.subSearchCursor = void 0;
588
588
  return;
@@ -618,42 +618,42 @@ class U {
618
618
  * не выполняет. Непосредственное и потенциальное изменения отмечает разными флагами.
619
619
  */
620
620
  propagateInvalidation(e, t = !1) {
621
- var n, a, l, r, h, b, u, o, I, _, A, O, Q;
621
+ var n, l, a, r, h, g, u, o, I, _, A, O, Q;
622
622
  const i = this.invalidationDepth;
623
623
  let s = i;
624
- for (let p = e; p !== null; p = p.nextSub) {
625
- const f = p.sub, g = f.flags;
624
+ for (let d = e; d !== null; d = d.nextSub) {
625
+ const f = d.sub, S = f.flags;
626
626
  let k = 0;
627
- if (g & (E | S) ? g & S && (k = this.invalidateReadDependency(p, f, g)) : (k = g & ~C | (t ? w : d), f.flags = k), k === 0) {
628
- if (g & y && g & x) {
629
- const L = p.dep.flags & v ? p.dep.sourceHooks.token : void 0;
630
- L !== void 0 && ((a = (n = f.effectTask) == null ? void 0 : n.notify) == null || a.call(n, L));
631
- } else f.flags & v && ((r = (l = f.sourceHooks).onInvalidate) == null || r.call(l, f.firstSub !== null), f.firstSub !== null && (this.invalidationStack[s++] = f.firstSub));
627
+ if (S & (E | D) ? S & D ? k = this.invalidateReadDependency(d, f, S) : !t && !(S & p) && (f.flags = S & ~w | p) : (k = S & ~C | (t ? w : p), f.flags = k), k === 0) {
628
+ if (S & y && S & x) {
629
+ const L = d.dep.flags & v ? d.dep.sourceHooks.token : void 0;
630
+ L !== void 0 && ((l = (n = f.effectTask) == null ? void 0 : n.notify) == null || l.call(n, L));
631
+ } else f.flags & v && ((r = (a = f.sourceHooks).onInvalidate) == null || r.call(a, f.firstSub !== null), f.firstSub !== null && (this.invalidationStack[s++] = f.firstSub));
632
632
  continue;
633
633
  }
634
- k & y ? (!(k & S) || ((h = f.effectTask) == null ? void 0 : h.allowScheduleDuringRun) === !0) && this.enqueueEffect(f, p.dep) : (!(g & E) && f.flags & v && ((u = (b = f.sourceHooks).onInvalidate) == null || u.call(b, f.firstSub !== null)), f.firstSub !== null && (this.invalidationStack[s++] = f.firstSub));
634
+ k & y ? (!(k & D) || ((h = f.effectTask) == null ? void 0 : h.allowScheduleDuringRun) === !0) && this.enqueueEffect(f, d.dep) : (!(S & E) && f.flags & v && ((u = (g = f.sourceHooks).onInvalidate) == null || u.call(g, f.firstSub !== null)), f.firstSub !== null && (this.invalidationStack[s++] = f.firstSub));
635
635
  }
636
636
  for (; s !== i; ) {
637
- let p = this.invalidationStack[--s];
637
+ let d = this.invalidationStack[--s];
638
638
  do {
639
- const f = p.sub, g = f.flags;
639
+ const f = d.sub, S = f.flags;
640
640
  let k = 0;
641
- if (g & (E | S) ? g & S && (k = this.invalidateReadDependency(p, f, g)) : (k = g & ~C | w, f.flags = k), k === 0) {
642
- if (g & y && g & x) {
643
- const L = p.dep.flags & v ? p.dep.sourceHooks.token : void 0;
641
+ if (S & (E | D) ? S & D && (k = this.invalidateReadDependency(d, f, S)) : (k = S & ~C | w, f.flags = k), k === 0) {
642
+ if (S & y && S & x) {
643
+ const L = d.dep.flags & v ? d.dep.sourceHooks.token : void 0;
644
644
  L !== void 0 && ((I = (o = f.effectTask) == null ? void 0 : o.notify) == null || I.call(o, L));
645
645
  } else if (f.flags & v && ((A = (_ = f.sourceHooks).onInvalidate) == null || A.call(_, f.firstSub !== null), f.firstSub !== null)) {
646
- p.nextSub !== null && (this.invalidationStack[s++] = p.nextSub), p = f.firstSub;
646
+ d.nextSub !== null && (this.invalidationStack[s++] = d.nextSub), d = f.firstSub;
647
647
  continue;
648
648
  }
649
649
  } else if (k & y)
650
- this.enqueueEffect(f, p.dep);
651
- else if (!(g & E) && f.flags & v && ((Q = (O = f.sourceHooks).onInvalidate) == null || Q.call(O, f.firstSub !== null)), f.firstSub !== null) {
652
- p.nextSub !== null && (this.invalidationStack[s++] = p.nextSub), p = f.firstSub;
650
+ this.enqueueEffect(f, d.dep);
651
+ else if (!(S & E) && f.flags & v && ((Q = (O = f.sourceHooks).onInvalidate) == null || Q.call(O, f.firstSub !== null)), f.firstSub !== null) {
652
+ d.nextSub !== null && (this.invalidationStack[s++] = d.nextSub), d = f.firstSub;
653
653
  continue;
654
654
  }
655
- p = p.nextSub;
656
- } while (p !== null);
655
+ d = d.nextSub;
656
+ } while (d !== null);
657
657
  }
658
658
  this.invalidationDepth = i;
659
659
  }
@@ -667,8 +667,8 @@ class U {
667
667
  if (s === null)
668
668
  return 0;
669
669
  if (e !== s) {
670
- for (let a = e.prevDep; a !== null; a = a.prevDep)
671
- if (a === s)
670
+ for (let l = e.prevDep; l !== null; l = l.prevDep)
671
+ if (l === s)
672
672
  return 0;
673
673
  }
674
674
  const n = i | C | w;
@@ -681,11 +681,11 @@ class U {
681
681
  */
682
682
  confirmSubUpdates(e, t, i = null) {
683
683
  var s, n;
684
- for (let a = e; a !== null; a = a.nextSub) {
685
- if (a === t || a.sub === i)
684
+ for (let l = e; l !== null; l = l.nextSub) {
685
+ if (l === t || l.sub === i)
686
686
  continue;
687
- const l = a.sub, r = l.flags;
688
- r & d || (l.flags = r & ~w | d, r & y ? this.enqueueEffect(l, a.dep) : r & E || l.flags & v && ((n = (s = l.sourceHooks).onInvalidate) == null || n.call(s, l.firstSub !== null)));
687
+ const a = l.sub, r = a.flags;
688
+ r & p || (a.flags = r & ~w | p, r & y ? this.enqueueEffect(a, l.dep) : r & E || a.flags & v && ((n = (s = a.sourceHooks).onInvalidate) == null || n.call(s, a.firstSub !== null)));
689
689
  }
690
690
  }
691
691
  /**
@@ -698,13 +698,13 @@ class U {
698
698
  recomputeValue(e, t = null) {
699
699
  const i = e.evaluate;
700
700
  e.tailDep = null;
701
- const s = e.flags & ~C | S;
701
+ const s = e.flags & ~C | D;
702
702
  e.flags = s;
703
703
  const n = this.activeSub;
704
704
  this.activeSub = e;
705
- let a;
705
+ let l;
706
706
  try {
707
- a = i();
707
+ l = i();
708
708
  } catch (u) {
709
709
  throw e.evaluate !== i ? (e.cachedValue = void 0, e.flags = 0, u) : (this.restoreComputedFailure(e, t), u);
710
710
  } finally {
@@ -712,10 +712,10 @@ class U {
712
712
  }
713
713
  if (e.evaluate !== i)
714
714
  return e.cachedValue = void 0, e.flags = 0, !1;
715
- const l = e.flags & C, r = s & -268, h = e.tailDep;
715
+ const a = e.flags & C, r = s & -268, h = e.tailDep;
716
716
  (h === null ? e.firstDep : h.nextDep) !== null && this.pruneUnreadDependencies(e);
717
- const b = e.cachedValue;
718
- return e.cachedValue = a, e.flags = s & v | (l ? d : r), b === a ? !1 : (e.firstSub !== null && this.confirmSubUpdates(e.firstSub, t), !0);
717
+ const g = e.cachedValue;
718
+ return e.cachedValue = l, e.flags = s & v | (a ? p : r), g === l ? !1 : (e.firstSub !== null && this.confirmSubUpdates(e.firstSub, t), !0);
719
719
  }
720
720
  /**
721
721
  * Восстанавливает связи и состояния после неудачного getter.
@@ -746,7 +746,7 @@ class U {
746
746
  settleCancelledDependencies(e) {
747
747
  for (let t = e.firstDep; t !== null; t = t.nextDep) {
748
748
  const i = t.dep, s = i.flags;
749
- s & (T | E | m) && (i.evaluate === void 0 ? s & d && this.commitSignalValue(i, t) : this.refreshComputedValue(i, s, t));
749
+ s & (T | E | m) && (i.evaluate === void 0 ? s & p && this.commitSignalValue(i, t) : this.refreshComputedValue(i, s, t));
750
750
  }
751
751
  }
752
752
  /**
@@ -758,18 +758,18 @@ class U {
758
758
  const i = this.dependencyDepth;
759
759
  let s = i, n = !1;
760
760
  e: for (; ; ) {
761
- if (e.flags & d)
761
+ if (e.flags & p)
762
762
  n = !0;
763
763
  else {
764
- const a = t.dep, l = a.flags;
765
- if (l & (d | m))
766
- this.dependencyDepth = s, n = a.evaluate === void 0 ? this.commitSignalValue(a, t) : this.recomputeValue(a, t);
767
- else if (l & w) {
768
- if (a.firstDep !== null) {
769
- this.dependencyStack[s++] = t, e = a, t = a.firstDep;
764
+ const l = t.dep, a = l.flags;
765
+ if (a & (p | m))
766
+ this.dependencyDepth = s, n = l.evaluate === void 0 ? this.commitSignalValue(l, t) : this.recomputeValue(l, t);
767
+ else if (a & w) {
768
+ if (l.firstDep !== null) {
769
+ this.dependencyStack[s++] = t, e = l, t = l.firstDep;
770
770
  continue e;
771
771
  }
772
- this.dependencyDepth = s, n = this.recomputeValue(a, t);
772
+ this.dependencyDepth = s, n = this.recomputeValue(l, t);
773
773
  } else
774
774
  n = !1;
775
775
  }
@@ -780,10 +780,10 @@ class U {
780
780
  if (n) {
781
781
  for (; s !== i; ) {
782
782
  this.dependencyDepth = --s;
783
- const a = this.dependencyStack[s];
784
- if (n = this.recomputeValue(e, a), e = a.sub, !n) {
785
- if (a.nextDep !== null) {
786
- t = a.nextDep;
783
+ const l = this.dependencyStack[s];
784
+ if (n = this.recomputeValue(e, l), e = l.sub, !n) {
785
+ if (l.nextDep !== null) {
786
+ t = l.nextDep;
787
787
  continue e;
788
788
  }
789
789
  break;
@@ -794,9 +794,9 @@ class U {
794
794
  }
795
795
  for (; s !== i; ) {
796
796
  this.dependencyDepth = --s;
797
- const a = this.dependencyStack[s];
798
- if (e.flags &= ~w, e = a.sub, a.nextDep !== null) {
799
- t = a.nextDep;
797
+ const l = this.dependencyStack[s];
798
+ if (e.flags &= ~w, e = l.sub, l.nextDep !== null) {
799
+ t = l.nextDep;
800
800
  continue e;
801
801
  }
802
802
  }
@@ -822,15 +822,15 @@ class U {
822
822
  const t = e.flags;
823
823
  if (!(t & E))
824
824
  return;
825
- if (!(t & (d | C))) {
825
+ if (!(t & (p | C))) {
826
826
  const h = e.firstDep;
827
827
  try {
828
828
  if (h === null || !this.refreshDependencies(e, h)) {
829
829
  e.flags &= ~E;
830
830
  return;
831
831
  }
832
- } catch (b) {
833
- throw e.flags &= -80, b;
832
+ } catch (g) {
833
+ throw e.flags &= -80, g;
834
834
  }
835
835
  }
836
836
  const i = e.evaluate;
@@ -862,27 +862,27 @@ class U {
862
862
  }
863
863
  if (e.evaluate === void 0)
864
864
  return;
865
- e.tailDep = null, e.flags = e.flags & ~C | S;
866
- const a = this.activeSub;
865
+ e.tailDep = null, e.flags = e.flags & ~C | D;
866
+ const l = this.activeSub;
867
867
  this.activeSub = e;
868
- let l;
868
+ let a;
869
869
  try {
870
- l = i();
870
+ a = i();
871
871
  } catch (h) {
872
- this.activeSub = a, e.flags &= ~S, this.failEffectRun(e, h, s);
872
+ this.activeSub = l, e.flags &= ~D, this.failEffectRun(e, h, s);
873
873
  } finally {
874
- this.activeSub = a, e.flags &= ~S;
874
+ this.activeSub = l, e.flags &= ~D;
875
875
  }
876
876
  const r = e.tailDep;
877
- if ((r === null ? e.firstDep : r.nextDep) !== null && this.pruneUnreadDependencies(e), typeof l == "function")
877
+ if ((r === null ? e.firstDep : r.nextDep) !== null && this.pruneUnreadDependencies(e), typeof a == "function")
878
878
  if (e.evaluate === void 0)
879
879
  try {
880
- this.untracked(l);
880
+ this.untracked(a);
881
881
  } catch (h) {
882
882
  s ?? (s = []), s.push(h);
883
883
  }
884
884
  else
885
- e.cachedValue = l;
885
+ e.cachedValue = a;
886
886
  e.flags & x ? e.flags = e.flags & -7 | w : e.flags &= -8;
887
887
  }
888
888
  /**
@@ -906,7 +906,7 @@ class U {
906
906
  * Путь не проверяет наличие внешней задачи у каждого узла.
907
907
  */
908
908
  flushSyncEffects() {
909
- if (!(this.flushingEffects || this.activeSub !== null && (this.activeSub.flags & (y | S)) === (y | S))) {
909
+ if (!(this.flushingEffects || this.activeSub !== null && (this.activeSub.flags & (y | D)) === (y | D))) {
910
910
  this.flushingEffects = !0;
911
911
  try {
912
912
  for (; this.effectReadIndex !== this.effectWriteIndex; ) {
@@ -926,7 +926,7 @@ class U {
926
926
  * Ошибка одного элемента не оставляет необработанные записи со старым SCHEDULED.
927
927
  */
928
928
  flushExternalEffects() {
929
- if (!(this.flushingEffects || this.activeSub !== null && (this.activeSub.flags & (y | S)) === (y | S))) {
929
+ if (!(this.flushingEffects || this.activeSub !== null && (this.activeSub.flags & (y | D)) === (y | D))) {
930
930
  this.flushingEffects = !0;
931
931
  try {
932
932
  for (; this.effectReadIndex !== this.effectWriteIndex; ) {
@@ -953,10 +953,10 @@ class U {
953
953
  const s = this.effectReadIndex++, n = this.effectQueue[s];
954
954
  this.effectQueue[s] = void 0;
955
955
  try {
956
- const a = t ? n.effectTask : void 0;
957
- a !== void 0 && n.evaluate !== void 0 ? this.scheduleEffectTask(n, a) : (n.flags &= ~x, this.executeEffect(n));
958
- } catch (a) {
959
- i.push(a);
956
+ const l = t ? n.effectTask : void 0;
957
+ l !== void 0 && n.evaluate !== void 0 ? this.scheduleEffectTask(n, l) : (n.flags &= ~x, this.executeEffect(n));
958
+ } catch (l) {
959
+ i.push(l);
960
960
  }
961
961
  }
962
962
  throw i.length === 1 ? e : new AggregateError(i, "Effect queue processing failed.");
@@ -992,35 +992,35 @@ class U {
992
992
  e.evaluate = void 0, e.flags = 0, e.cachedValue = void 0, e.effectTask = void 0, i !== void 0 && (e.onStop = void 0), K(e);
993
993
  let n = e.firstDep;
994
994
  for (; n !== null; ) {
995
- const l = n.nextDep;
996
- this.detachSubLink(n), n = l;
995
+ const a = n.nextDep;
996
+ this.detachSubLink(n), n = a;
997
997
  }
998
998
  e.firstDep = e.tailDep = null, e.depCount = 0, N(e);
999
- let a;
999
+ let l;
1000
1000
  if (t !== void 0)
1001
1001
  try {
1002
1002
  t.dispose();
1003
- } catch (l) {
1004
- a = [l];
1003
+ } catch (a) {
1004
+ l = [a];
1005
1005
  }
1006
1006
  try {
1007
1007
  this.disposeNestedEffects(e);
1008
- } catch (l) {
1009
- a ?? (a = []), a.push(l);
1008
+ } catch (a) {
1009
+ l ?? (l = []), l.push(a);
1010
1010
  }
1011
1011
  if (s !== void 0)
1012
1012
  try {
1013
1013
  this.untracked(s);
1014
- } catch (l) {
1015
- a ?? (a = []), a.push(l);
1014
+ } catch (a) {
1015
+ l ?? (l = []), l.push(a);
1016
1016
  }
1017
1017
  if (i !== void 0)
1018
1018
  try {
1019
1019
  this.untracked(i);
1020
- } catch (l) {
1021
- a ?? (a = []), a.push(l);
1020
+ } catch (a) {
1021
+ l ?? (l = []), l.push(a);
1022
1022
  }
1023
- this.invalidationStack.length = this.invalidationDepth, this.dependencyStack.length = this.dependencyDepth, a !== void 0 && F(a, "Effect disposal failed.");
1023
+ this.invalidationStack.length = this.invalidationDepth, this.dependencyStack.length = this.dependencyDepth, l !== void 0 && F(l, "Effect disposal failed.");
1024
1024
  }
1025
1025
  /**
1026
1026
  * Останавливает все вложенные эффекты в обратном порядке регистрации.
@@ -1105,15 +1105,15 @@ class U {
1105
1105
  _signalAccess(e) {
1106
1106
  const t = this;
1107
1107
  let i = e, s;
1108
- function n(a) {
1108
+ function n(l) {
1109
1109
  if (arguments.length !== 0) {
1110
1110
  const h = s;
1111
- h !== void 0 ? t.writeSignalValue(h, a) : i !== a && (i = a);
1111
+ h !== void 0 ? t.writeSignalValue(h, l) : i !== l && (i = l);
1112
1112
  return;
1113
1113
  }
1114
- const l = s;
1115
- if (l !== void 0)
1116
- return t.readSignalValue(l);
1114
+ const a = s;
1115
+ if (a !== void 0)
1116
+ return t.readSignalValue(a);
1117
1117
  const r = t.activeSub;
1118
1118
  return r === null || (s = t.materializeSignal(i, r)), i;
1119
1119
  }
@@ -1143,8 +1143,8 @@ class U {
1143
1143
  */
1144
1144
  _ownedSignal(e, t) {
1145
1145
  const i = this;
1146
- let s = e, n, a = !1;
1147
- const l = () => {
1146
+ let s = e, n, l = !1;
1147
+ const a = () => {
1148
1148
  const u = n;
1149
1149
  if (u !== void 0)
1150
1150
  return this.readSignalValue(u);
@@ -1164,14 +1164,14 @@ class U {
1164
1164
  var I, _;
1165
1165
  const o = n;
1166
1166
  if (o !== void 0) {
1167
- const A = o.flags & d ? o.pendingValue : o.cachedValue;
1167
+ const A = o.flags & p ? o.pendingValue : o.cachedValue;
1168
1168
  A !== u && ((I = t.onChange) == null || I.call(t, A, u, o.firstSub !== null)), this.writeSignalValue(o, u);
1169
1169
  return;
1170
1170
  }
1171
1171
  s !== u && ((_ = t.onChange) == null || _.call(t, s, u, !1), s = u);
1172
- }, b = {
1172
+ }, g = {
1173
1173
  source: {
1174
- get: l,
1174
+ get: a,
1175
1175
  peek: this.handleReaders.peek,
1176
1176
  set: r
1177
1177
  },
@@ -1180,9 +1180,9 @@ class U {
1180
1180
  */
1181
1181
  dispose() {
1182
1182
  var o;
1183
- if (a)
1183
+ if (l)
1184
1184
  return !0;
1185
- a = !0, s = void 0;
1185
+ l = !0, s = void 0;
1186
1186
  let u;
1187
1187
  try {
1188
1188
  (o = t == null ? void 0 : t.onDispose) == null || o.call(t, (n == null ? void 0 : n.firstSub) != null);
@@ -1204,7 +1204,7 @@ class U {
1204
1204
  return !0;
1205
1205
  }
1206
1206
  };
1207
- return t !== void 0 && (b.hasSubscribers = () => (n == null ? void 0 : n.firstSub) != null), b;
1207
+ return t !== void 0 && (g.hasSubscribers = () => (n == null ? void 0 : n.firstSub) != null), g;
1208
1208
  }
1209
1209
  /**
1210
1210
  * Создаёт ленивый computed с финализатором исходящих и входящих связей.
@@ -1214,7 +1214,7 @@ class U {
1214
1214
  _ownedComputed(e, t) {
1215
1215
  const i = this, s = this.createComputedHandle(e, t);
1216
1216
  let n = !1;
1217
- const a = {
1217
+ const l = {
1218
1218
  source: s,
1219
1219
  /**
1220
1220
  * Отсоединяет принадлежащий источник и освобождает его ссылки.
@@ -1225,31 +1225,31 @@ class U {
1225
1225
  if (n)
1226
1226
  return !0;
1227
1227
  n = !0, i.activeSub === s && (i.activeSub = null);
1228
- const l = [];
1228
+ const a = [];
1229
1229
  try {
1230
1230
  (h = t == null ? void 0 : t.onDispose) == null || h.call(t, s.firstSub != null);
1231
- } catch (b) {
1232
- l.push(b);
1231
+ } catch (g) {
1232
+ a.push(g);
1233
1233
  }
1234
1234
  if (s.flags !== void 0)
1235
1235
  try {
1236
1236
  i.releaseSourceSubs(s);
1237
- } catch (b) {
1238
- l.push(b);
1237
+ } catch (g) {
1238
+ a.push(g);
1239
1239
  }
1240
1240
  let r = s.firstDep;
1241
1241
  for (; r != null; ) {
1242
- const b = r.nextDep;
1243
- i.detachSubLink(r), r = b;
1242
+ const g = r.nextDep;
1243
+ i.detachSubLink(r), r = g;
1244
1244
  }
1245
- if (s.firstDep = s.tailDep = null, s.depCount = 0, N(s), s.evaluate = void 0, s.cachedValue = void 0, s.flags = 0, l.length === 1)
1246
- throw l[0];
1247
- if (l.length > 1)
1248
- throw new AggregateError(l, "Owned computed disposal failed.");
1245
+ if (s.firstDep = s.tailDep = null, s.depCount = 0, N(s), s.evaluate = void 0, s.cachedValue = void 0, s.flags = 0, a.length === 1)
1246
+ throw a[0];
1247
+ if (a.length > 1)
1248
+ throw new AggregateError(a, "Owned computed disposal failed.");
1249
1249
  return !0;
1250
1250
  }
1251
1251
  };
1252
- return t !== void 0 && (a.hasSubscribers = () => s.firstSub != null), a;
1252
+ return t !== void 0 && (l.hasSubscribers = () => s.firstSub != null), l;
1253
1253
  }
1254
1254
  /**
1255
1255
  * Открывает вложенную синхронную границу группировки.
@@ -1290,16 +1290,16 @@ const te = (c) => V().signal(c), ie = (c) => V().reactive(c);
1290
1290
  function se(c) {
1291
1291
  return V().computed(c);
1292
1292
  }
1293
- const ne = (c, e) => V().effect(c, e), ae = (c, e, t) => V().watch(c, e, t), le = (c) => V().batch(c), re = (c) => V().untracked(c), ce = () => V().scope();
1293
+ const ne = (c, e) => V().effect(c, e), le = (c, e, t) => V().watch(c, e, t), ae = (c) => V().batch(c), re = (c) => V().untracked(c), ce = () => V().scope();
1294
1294
  export {
1295
1295
  U as RaphReactivity,
1296
1296
  M as ScopeNode,
1297
- le as batch,
1297
+ ae as batch,
1298
1298
  se as computed,
1299
1299
  ne as effect,
1300
1300
  ie as reactive,
1301
1301
  ce as scope,
1302
1302
  te as signal,
1303
1303
  re as untracked,
1304
- ae as watch
1304
+ le as watch
1305
1305
  };