@raphy-js/raph 1.0.1-dev.25 → 1.0.1-dev.54

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.
Files changed (127) hide show
  1. package/README.md +100 -0
  2. package/dist/api/Raph.d.ts +15 -15
  3. package/dist/api/RaphFacadeSession.d.ts +4 -4
  4. package/dist/api/RaphReactivityInstance.d.ts +4 -4
  5. package/dist/api/types.d.ts +11 -11
  6. package/dist/compact.cjs +1 -0
  7. package/dist/compact.js +4 -0
  8. package/dist/debug/reactivity/engine-core.cjs +1 -0
  9. package/dist/debug/reactivity/engine-core.js +1760 -0
  10. package/dist/debug/reactivity/engine.cjs +1 -1
  11. package/dist/debug/reactivity/engine.js +25 -1689
  12. package/dist/debug/reactivity/reactive-object.cjs +1 -1
  13. package/dist/debug/reactivity/reactive-object.js +604 -167
  14. package/dist/debug/runtime/RaphCompactExecutionRuntime.cjs +1 -0
  15. package/dist/debug/runtime/RaphCompactExecutionRuntime.js +9 -0
  16. package/dist/debug/runtime/RaphExecutionRuntime.cjs +1 -0
  17. package/dist/debug/runtime/RaphExecutionRuntime.js +11 -0
  18. package/dist/debug/runtime/RaphRuntime.cjs +1 -1
  19. package/dist/debug/runtime/RaphRuntime.js +115 -1176
  20. package/dist/debug/runtime/RaphRuntimeBase.cjs +1 -0
  21. package/dist/debug/runtime/RaphRuntimeBase.js +941 -0
  22. package/dist/debug/runtime/diagnostics/RaphDebug.cjs +1 -1
  23. package/dist/debug/runtime/diagnostics/RaphDebug.js +72 -66
  24. package/dist/debug/runtime/ownership/RaphNode.cjs +1 -1
  25. package/dist/debug/runtime/ownership/RaphNode.js +11 -0
  26. package/dist/debug/runtime/ownership/RaphScope.cjs +1 -1
  27. package/dist/debug/runtime/ownership/RaphScope.js +12 -12
  28. package/dist/debug/runtime/phases/RaphPhasePipeline.cjs +1 -1
  29. package/dist/debug/runtime/phases/RaphPhasePipeline.js +361 -242
  30. package/dist/debug/runtime/phases/RaphPhaseTaskRecord.cjs +1 -1
  31. package/dist/debug/runtime/phases/RaphPhaseTaskRecord.js +23 -22
  32. package/dist/debug/runtime/reactivity/RaphSelector.cjs +1 -1
  33. package/dist/debug/runtime/reactivity/RaphSelector.js +111 -90
  34. package/dist/debug/runtime/reactivity/RuntimeObjectSupport.cjs +1 -0
  35. package/dist/debug/runtime/reactivity/RuntimeObjectSupport.js +11 -0
  36. package/dist/debug/runtime/reactivity/RuntimeReactivity.cjs +1 -1
  37. package/dist/debug/runtime/reactivity/RuntimeReactivity.js +118 -103
  38. package/dist/debug/runtime/reactivity/RuntimeSelectorSupport.cjs +1 -0
  39. package/dist/debug/runtime/reactivity/RuntimeSelectorSupport.js +12 -0
  40. package/dist/entrypoints/compact.d.ts +2 -0
  41. package/dist/entrypoints/execution.d.ts +2 -0
  42. package/dist/entrypoints/machine-testing.d.ts +2 -2
  43. package/dist/entrypoints/machine.d.ts +5 -5
  44. package/dist/entrypoints/observable.d.ts +4 -0
  45. package/dist/entrypoints/path.d.ts +14 -14
  46. package/dist/entrypoints/reactivity.d.ts +1 -1
  47. package/dist/entrypoints/runtime.d.ts +19 -18
  48. package/dist/execution.cjs +1 -0
  49. package/dist/execution.js +4 -0
  50. package/dist/index.cjs +1 -1
  51. package/dist/index.js +23 -21
  52. package/dist/machine/compiler.d.ts +1 -1
  53. package/dist/machine/core.d.ts +2 -2
  54. package/dist/machine/persistence.d.ts +1 -1
  55. package/dist/machine/runtime.d.ts +3 -3
  56. package/dist/machine/testing.d.ts +1 -1
  57. package/dist/machine/types.d.ts +3 -3
  58. package/dist/main.d.ts +19 -19
  59. package/dist/observable/buffer.d.ts +6 -0
  60. package/dist/observable/class-admin.d.ts +63 -0
  61. package/dist/observable/class-plan.d.ts +46 -0
  62. package/dist/observable/classes.d.ts +10 -0
  63. package/dist/observable/context.d.ts +73 -0
  64. package/dist/observable/native.d.ts +2 -0
  65. package/dist/observable/observable.d.ts +13 -0
  66. package/dist/observable/types.d.ts +60 -0
  67. package/dist/observable.cjs +1 -0
  68. package/dist/observable.js +1187 -0
  69. package/dist/path/DataPath.d.ts +2 -2
  70. package/dist/path/PathRouter.d.ts +1 -1
  71. package/dist/path/RaphKernel.d.ts +6 -6
  72. package/dist/path/data-path.types.d.ts +1 -1
  73. package/dist/path/data-path.utils.d.ts +2 -2
  74. package/dist/path/derived/DerivedRegistry.d.ts +3 -3
  75. package/dist/path/derived/RaphDerivedHandle.d.ts +3 -3
  76. package/dist/path/derived/derived-collection.types.d.ts +1 -1
  77. package/dist/path/derived/derived-collection.utils.d.ts +3 -3
  78. package/dist/path/derived/derived-strategy.utils.d.ts +1 -1
  79. package/dist/path/meta/MetaController.d.ts +5 -5
  80. package/dist/path/meta/RaphMeta.d.ts +3 -3
  81. package/dist/path/meta/RaphMetaStore.d.ts +1 -1
  82. package/dist/path/meta/meta.types.d.ts +2 -2
  83. package/dist/path/path.types.d.ts +2 -2
  84. package/dist/path/pathSegmentKey.d.ts +1 -1
  85. package/dist/path/storage/AdapterPathStore.d.ts +2 -2
  86. package/dist/path/storage/DefaultDataAdapter.d.ts +2 -2
  87. package/dist/path/storage/PathEventHub.d.ts +1 -1
  88. package/dist/path/storage/PathStore.d.ts +2 -2
  89. package/dist/path/storage/data-adapter.types.d.ts +1 -1
  90. package/dist/raph.cjs +1 -1
  91. package/dist/raph.js +23 -21
  92. package/dist/reactivity/engine-core.d.ts +600 -0
  93. package/dist/reactivity/engine.d.ts +6 -550
  94. package/dist/reactivity/reactive-object.d.ts +143 -2
  95. package/dist/reactivity/scope.d.ts +7 -6
  96. package/dist/reactivity/types.d.ts +9 -12
  97. package/dist/reactivity/watch.d.ts +1 -1
  98. package/dist/runtime/RaphCompactExecutionRuntime.d.ts +7 -0
  99. package/dist/runtime/RaphExecutionRuntime.d.ts +6 -0
  100. package/dist/runtime/RaphRuntime.d.ts +19 -403
  101. package/dist/runtime/RaphRuntimeBase.d.ts +194 -0
  102. package/dist/runtime/diagnostics/RaphDebug.d.ts +8 -5
  103. package/dist/runtime/errors.d.ts +1 -1
  104. package/dist/runtime/ownership/RaphEffectScope.d.ts +13 -12
  105. package/dist/runtime/ownership/RaphNode.d.ts +28 -21
  106. package/dist/runtime/ownership/RaphScope.d.ts +32 -19
  107. package/dist/runtime/ownership/parent-graph.types.d.ts +1 -1
  108. package/dist/runtime/ownership/parentGraph.d.ts +2 -2
  109. package/dist/runtime/phases/RaphFrameLoop.d.ts +1 -1
  110. package/dist/runtime/phases/RaphPhasePipeline.d.ts +80 -29
  111. package/dist/runtime/phases/RaphPhaseTaskRecord.d.ts +21 -21
  112. package/dist/runtime/phases/RaphPhaseWatch.d.ts +3 -3
  113. package/dist/runtime/phases/orderPhaseTasks.d.ts +4 -2
  114. package/dist/runtime/phases/phase.types.d.ts +36 -35
  115. package/dist/runtime/reactivity/PathHandle.d.ts +5 -5
  116. package/dist/runtime/reactivity/RaphMetaSource.d.ts +7 -7
  117. package/dist/runtime/reactivity/RaphSelector.d.ts +27 -6
  118. package/dist/runtime/reactivity/RaphWorkGraph.d.ts +40 -39
  119. package/dist/runtime/reactivity/RuntimeObjectSupport.d.ts +9 -0
  120. package/dist/runtime/reactivity/RuntimeReactivity.d.ts +27 -19
  121. package/dist/runtime/reactivity/RuntimeSelectorSupport.d.ts +10 -0
  122. package/dist/runtime/reactivity/RuntimeWatch.d.ts +1 -1
  123. package/dist/runtime/reactivity/disposal-sweep.utils.d.ts +1 -1
  124. package/dist/runtime/reactivity/runtime-reactivity.types.d.ts +3 -3
  125. package/dist/runtime.cjs +1 -1
  126. package/dist/runtime.js +13 -11
  127. package/package.json +22 -62
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=Object.freeze([]),c=Object.freeze({now:0,delta:0,elapsed:0,frame:0}),o=1,_=2,E=4,p=8,d=16,T=32,l=64,A=128,u=256,f=1536,R=0,D=512,v=1024,K=1536,C=2048,O=0,U=1,P=2;class S{constructor(e){this._record=e,Object.freeze(this)}get phase(){return this._record.phaseState.name}get consumerOwner(){return this._record.consumerOwner}get effect(){return this._record.effect}get causes(){return this._record.causes}get frame(){return this._record.frame}get priority(){return this._record.priority}get sequence(){return this._record.sequence}run(){const e=this._record;e.phaseState.pipeline._runDelivery(e)}defer(){const e=this._record;e.phaseState.pipeline._deferDelivery(e)}cancel(){const e=this._record;e.phaseState.pipeline._cancelDelivery(e)}}class a{constructor(){this.extraCauses=void 0,this.deliveryFirstCause=void 0,this.deliveryFirstCauseKey=void 0,this.deliveryExtraCauses=void 0,this.deliveryCauses=void 0,this.deferCount=0}}a._shapeAnchor=new a;class y{constructor(e,t,s,i){this.state=o,this.sequence=0,this.phaseState=e,this.priority=t,this.consumerOwner=s,this.effect=i,this.node=void 0,this.watch=void 0,this.group=void 0,this.scopeParent=void 0,this.scopePrevious=void 0,this.scopeNext=void 0,this.firstCause=void 0,this.firstCauseKey=void 0,this.frame=c,this.facade=void 0,this.detail=void 0}get phase(){return this.phaseState.name}get dependencyOwner(){return this.consumerOwner}get allowScheduleDuringRun(){return!0}get active(){return(this.state&o)!==0}get causes(){const e=this.detail;if(e!==void 0){const r=e.deliveryCauses;if(r!==void 0)return r}let t,s;if(this.state&u?(t=this.firstCause,e!==void 0&&(s=e.extraCauses)):e!==void 0&&(t=e.deliveryFirstCause,s=e.deliveryExtraCauses),t===void 0)return h;const i=[Object.freeze(t)];if(s!==void 0)for(const r of s.values())i.push(Object.freeze(r));return this.detailed().deliveryCauses=Object.freeze(i)}get task(){let e=this.facade;return e===void 0&&(this.state&d&&(this.frame=this.phaseState.pipeline.frame),this.facade=e=new S(this)),e}detailed(){return this.detail??=new a}notify(e){this.phaseState.pipeline._notifyTask(this,e)}schedule(){this.phaseState.pipeline._queue(this,!0)}enqueue(e,t=e.source,s=!0){const i=this.phaseState.pipeline;i._appendCause(this,e,t),i._queue(this,s)}start(e,t="scheduled"){this.consumerOwner.runtime._startGroupSlot(this,e,t)}_start(e,t,s){this.consumerOwner.runtime._startGroupSlot(this,e,t,s)}pause(){this.phaseState.pipeline._pauseTask(this)}resume(){this.phaseState.pipeline._resumeTask(this)}dispose(){this.phaseState.pipeline._disposeBinding(this)}}exports.EMPTY_CAUSES=h;exports.EMPTY_FRAME=c;exports.GROUP_CONTEXT=O;exports.GROUP_CURSOR=U;exports.GROUP_NODES=P;exports.RaphPhaseTaskDetail=a;exports.RaphPhaseTaskHandle=S;exports.RaphPhaseTaskRecord=y;exports.TASK_ACTIVE=o;exports.TASK_CANCEL=K;exports.TASK_CAUSES_DELIVERED=u;exports.TASK_DEFER=v;exports.TASK_DEFERRED=p;exports.TASK_DISCARD_ACKNOWLEDGED=T;exports.TASK_EXECUTED=A;exports.TASK_IN_DELIVERY=d;exports.TASK_PAUSED=_;exports.TASK_PENDING=E;exports.TASK_REQUESTED=l;exports.TASK_RESOLUTION=f;exports.TASK_RUN=D;exports.TASK_TASKLESS=C;exports.TASK_UNRESOLVED=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=Object.freeze([]),d=Object.freeze({now:0,delta:0,elapsed:0,frame:0}),o=1,E=2,p=4,T=8,u=16,l=32,A=64,f=128,S=256,R=1536,D=0,v=512,K=1024,C=1536,O=2048,h=4096,P=0,U=1,m=2;class _{constructor(e){this._record=e,Object.freeze(this)}get phase(){return this._record.phaseState.name}get consumerOwner(){return this._record.consumerOwner}get effect(){return this._record.effect}get causes(){return this._record.causes}get frame(){const e=this._record;return e.state&h||(e.frame=e.phaseState.pipeline._exposeFrame(e.frame),e.state|=h),e.frame}get priority(){return this._record.priority}get sequence(){return this._record.sequence}run(){const e=this._record;e.phaseState.pipeline._runDelivery(e)}defer(){const e=this._record;e.phaseState.pipeline._deferDelivery(e)}cancel(){const e=this._record;e.phaseState.pipeline._cancelDelivery(e)}}class a{constructor(){this.extraCauses=void 0,this.deliveryFirstCause=void 0,this.deliveryFirstCauseKey=void 0,this.deliveryExtraCauses=void 0,this.deliveryCauses=void 0,this.deferCount=0}}a._shapeAnchor=new a;class y{constructor(e,t,s,i){this.state=o,this.sequence=0,this.phaseState=e,this.priority=t,this.consumerOwner=s,this.effect=i,this.node=void 0,this.watch=void 0,this.group=void 0,this.scopeParent=void 0,this.scopePrevious=void 0,this.scopeNext=void 0,this.firstCause=void 0,this.firstCauseKey=void 0,this.frame=d,this.facade=void 0,this.detail=void 0}get phase(){return this.phaseState.name}get dependencyOwner(){return this.consumerOwner}get allowScheduleDuringRun(){return!0}get active(){return(this.state&o)!==0}get causes(){const e=this.detail;if(e!==void 0){const r=e.deliveryCauses;if(r!==void 0)return r}let t,s;if(this.state&S?(t=this.firstCause,e!==void 0&&(s=e.extraCauses)):e!==void 0&&(t=e.deliveryFirstCause,s=e.deliveryExtraCauses),t===void 0)return c;const i=[Object.freeze(t)];if(s!==void 0)for(const r of s.values())i.push(Object.freeze(r));return this.detailed().deliveryCauses=Object.freeze(i)}get task(){let e=this.facade;return e===void 0&&(this.state&u&&(this.frame=this.phaseState.pipeline._frameForDelivery()),this.facade=e=new _(this)),e}detailed(){return this.detail??=new a}notify(e){this.phaseState.pipeline._notifyTask(this,e)}schedule(){this.phaseState.pipeline._queue(this,!0)}enqueue(e,t=e.source,s=!0){const i=this.phaseState.pipeline;i._appendCause(this,e,t),i._queue(this,s)}start(e,t="scheduled"){this.consumerOwner.runtime._startGroupSlot(this,e,t)}_start(e,t,s){this.consumerOwner.runtime._startGroupSlot(this,e,t,s)}pause(){this.phaseState.pipeline._pauseTask(this)}resume(){this.phaseState.pipeline._resumeTask(this)}dispose(){this.phaseState.pipeline._disposeBinding(this)}}exports.EMPTY_CAUSES=c;exports.EMPTY_FRAME=d;exports.GROUP_CONTEXT=P;exports.GROUP_CURSOR=U;exports.GROUP_NODES=m;exports.RaphPhaseTaskDetail=a;exports.RaphPhaseTaskHandle=_;exports.RaphPhaseTaskRecord=y;exports.TASK_ACTIVE=o;exports.TASK_CANCEL=C;exports.TASK_CAUSES_DELIVERED=S;exports.TASK_DEFER=K;exports.TASK_DEFERRED=T;exports.TASK_DISCARD_ACKNOWLEDGED=l;exports.TASK_EXECUTED=f;exports.TASK_IN_DELIVERY=u;exports.TASK_PAUSED=E;exports.TASK_PENDING=p;exports.TASK_REQUESTED=A;exports.TASK_RESOLUTION=R;exports.TASK_RUN=v;exports.TASK_TASKLESS=O;exports.TASK_UNRESOLVED=D;
@@ -1,5 +1,5 @@
1
- const h = Object.freeze([]), c = Object.freeze({ now: 0, delta: 0, elapsed: 0, frame: 0 }), n = 1, l = 2, _ = 4, S = 8, u = 16, f = 32, v = 64, E = 128, d = 256, T = 1536, A = 0, C = 512, O = 1024, D = 1536, R = 2048, y = 0, K = 1, m = 2;
2
- class p {
1
+ const h = Object.freeze([]), d = Object.freeze({ now: 0, delta: 0, elapsed: 0, frame: 0 }), n = 1, l = 2, S = 4, f = 8, u = 16, E = 32, v = 64, T = 128, p = 256, A = 1536, C = 0, O = 512, D = 1024, R = 1536, m = 2048, c = 4096, y = 0, K = 1, g = 2;
2
+ class _ {
3
3
  constructor(e) {
4
4
  this._record = e, Object.freeze(this);
5
5
  }
@@ -16,7 +16,8 @@ class p {
16
16
  return this._record.causes;
17
17
  }
18
18
  get frame() {
19
- return this._record.frame;
19
+ const e = this._record;
20
+ return e.state & c || (e.frame = e.phaseState.pipeline._exposeFrame(e.frame), e.state |= c), e.frame;
20
21
  }
21
22
  get priority() {
22
23
  return this._record.priority;
@@ -43,9 +44,9 @@ class a {
43
44
  }
44
45
  }
45
46
  a._shapeAnchor = new a();
46
- class g {
47
+ class w {
47
48
  constructor(e, t, s, i) {
48
- this.state = n, this.sequence = 0, this.phaseState = e, this.priority = t, this.consumerOwner = s, this.effect = i, this.node = void 0, this.watch = void 0, this.group = void 0, this.scopeParent = void 0, this.scopePrevious = void 0, this.scopeNext = void 0, this.firstCause = void 0, this.firstCauseKey = void 0, this.frame = c, this.facade = void 0, this.detail = void 0;
49
+ this.state = n, this.sequence = 0, this.phaseState = e, this.priority = t, this.consumerOwner = s, this.effect = i, this.node = void 0, this.watch = void 0, this.group = void 0, this.scopeParent = void 0, this.scopePrevious = void 0, this.scopeNext = void 0, this.firstCause = void 0, this.firstCauseKey = void 0, this.frame = d, this.facade = void 0, this.detail = void 0;
49
50
  }
50
51
  get phase() {
51
52
  return this.phaseState.name;
@@ -82,7 +83,7 @@ class g {
82
83
  return r;
83
84
  }
84
85
  let t, s;
85
- if (this.state & d ? (t = this.firstCause, e !== void 0 && (s = e.extraCauses)) : e !== void 0 && (t = e.deliveryFirstCause, s = e.deliveryExtraCauses), t === void 0)
86
+ if (this.state & p ? (t = this.firstCause, e !== void 0 && (s = e.extraCauses)) : e !== void 0 && (t = e.deliveryFirstCause, s = e.deliveryExtraCauses), t === void 0)
86
87
  return h;
87
88
  const i = [Object.freeze(t)];
88
89
  if (s !== void 0)
@@ -100,7 +101,7 @@ class g {
100
101
  */
101
102
  get task() {
102
103
  let e = this.facade;
103
- return e === void 0 && (this.state & u && (this.frame = this.phaseState.pipeline.frame), this.facade = e = new p(this)), e;
104
+ return e === void 0 && (this.state & u && (this.frame = this.phaseState.pipeline._frameForDelivery()), this.facade = e = new _(this)), e;
104
105
  }
105
106
  /** Возвращает редкое состояние записи и создаёт его при первом обращении. */
106
107
  detailed() {
@@ -151,26 +152,26 @@ class g {
151
152
  }
152
153
  export {
153
154
  h as EMPTY_CAUSES,
154
- c as EMPTY_FRAME,
155
+ d as EMPTY_FRAME,
155
156
  y as GROUP_CONTEXT,
156
157
  K as GROUP_CURSOR,
157
- m as GROUP_NODES,
158
+ g as GROUP_NODES,
158
159
  a as RaphPhaseTaskDetail,
159
- p as RaphPhaseTaskHandle,
160
- g as RaphPhaseTaskRecord,
160
+ _ as RaphPhaseTaskHandle,
161
+ w as RaphPhaseTaskRecord,
161
162
  n as TASK_ACTIVE,
162
- D as TASK_CANCEL,
163
- d as TASK_CAUSES_DELIVERED,
164
- O as TASK_DEFER,
165
- S as TASK_DEFERRED,
166
- f as TASK_DISCARD_ACKNOWLEDGED,
167
- E as TASK_EXECUTED,
163
+ R as TASK_CANCEL,
164
+ p as TASK_CAUSES_DELIVERED,
165
+ D as TASK_DEFER,
166
+ f as TASK_DEFERRED,
167
+ E as TASK_DISCARD_ACKNOWLEDGED,
168
+ T as TASK_EXECUTED,
168
169
  u as TASK_IN_DELIVERY,
169
170
  l as TASK_PAUSED,
170
- _ as TASK_PENDING,
171
+ S as TASK_PENDING,
171
172
  v as TASK_REQUESTED,
172
- T as TASK_RESOLUTION,
173
- C as TASK_RUN,
174
- R as TASK_TASKLESS,
175
- A as TASK_UNRESOLVED
173
+ A as TASK_RESOLUTION,
174
+ O as TASK_RUN,
175
+ m as TASK_TASKLESS,
176
+ C as TASK_UNRESOLVED
176
177
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=32,a=32;class f{constructor(e,s,t,r){this.select=u(this),this._previousSource=void 0,this._trackedKey=void 0,this._owner=e,this._reactivity=s,this._source=t,this._equals=r,this._dense=[],this._denseBase=0,this._denseCount=0,this._triggers=void 0,this._scanning=!1,this._objectHooks=l(this,t),this._growthLimit=1,this._sweptAt=0,this._sweepStride=0,this._disposed=!1,this._tapSlot=-1,this._sweepSlot=-1,this._sweepDue=0,t._addWriteTap(this)}get[Symbol.toStringTag](){return"RaphSelector"}toJSON(){return{owner:this._owner.id,triggers:this._size(),disposed:this._disposed}}get _tapOwner(){return this._owner}_debugTriggerCount(){return this._size()}_test(e){const s=this._owner,t=this._reactivity;t._assertTrackedRead(s),s._assertAlive(),this._track(e,t);const r=this._source.peek(),i=this._equals;return i!==void 0?i(e,r):e===r||typeof e=="number"&&typeof r=="number"&&Object.is(e,r)}_observesWrites(){return this._size()!==0}_afterSourceWrite(e,s){if(this._size()===0)return;const t=this._reactivity,r=this._equals;if(r===void 0){if(Object.is(e,s))return;this._wakePair(e,s,t);return}let i;const n=this._scanning;this._scanning=!0;const o=this._dense;for(let _=0;_<o.length;_++){const d=o[_];if(d!==void 0){if(!t._signalNodeHasSubscribers(d)){o[_]=void 0,this._denseCount--;continue}i=this._wakeChanged(this._denseBase+_,d,e,s,r,i)}}const h=this._triggers;if(h!==void 0)for(const[_,d]of h){if(!t._signalNodeHasSubscribers(d)){h.delete(_);continue}i=this._wakeChanged(_,d,e,s,r,i)}if(this._scanning=n,this._settleDense(),i!==void 0)throw i.length===1?i[0]:new AggregateError(i,"[Raph] Selector notification failed.")}_afterOwnerDisposals(e){const s=this._size(),t=this._sweepStride,r=this._sweptAt+(t>s?t:s);if(e<r)return r;this._sweep(e);const i=this._size();if(i===0)return this._sweepStride=0,this._growthLimit=1,0;if(i!==s)return this._sweepStride=0,e+i;const n=(t>i?t:i)*2;return this._sweepStride=n,e+n}_edgeDetached(e){if(this._disposed)return;const s=this._triggers,t=s.get(e);t!==void 0&&this._reactivity._hasSingleSubscriber(t)&&s.delete(e)}_findConsumerOwner(e,s){const t=this._reactivity,r=this._dense;for(let n=0;n<r.length;n++){const o=r[n];if(o===void 0)continue;const h=t._findSubscriberOwner(o,e,s);if(h!==void 0)return h}const i=this._triggers;if(i!==void 0)for(const n of i.values()){const o=t._findSubscriberOwner(n,e,s);if(o!==void 0)return o}}_finalizeSource(){if(this._disposed)return!0;this._disposed=!0,this._equals=void 0,this._source._removeWriteTap(this),this._sweepSlot!==-1&&this._owner.runtime._removeDisposalSweeper(this);const e=this._reactivity;let s;const t=this._dense;for(let i=0;i<t.length;i++){const n=t[i];if(n!==void 0)try{e._releaseSignalNode(n)}catch(o){(s??=[]).push(o)}}t.length=0,this._denseCount=0;const r=this._triggers;if(r!==void 0){for(const i of r.values())try{e._releaseSignalNode(i)}catch(n){(s??=[]).push(n)}r.clear()}if(s!==void 0)throw s.length===1?s[0]:new AggregateError(s,"[Raph] Selector disposal failed.");return!0}_sweep(e=this._owner.runtime._ownerDisposalCount()){this._sweptAt=e;const s=this._size();if(s===0)return;const t=this._dense,r=this._triggers,i=this._reactivity,n=i._countObserved(t,r);if(n===s){t.length!==this._denseCount&&this._settleDense();return}if(n===0){t.length=0,this._denseCount=0,r!==void 0&&r.clear();return}this._denseCount=i._dropUnobserved(t,r),this._settleDense()}_size(){const e=this._triggers;return e===void 0?this._denseCount:this._denseCount+e.size}_track(e,s){if(typeof e=="number"){const n=this._dense,o=n.length;if(o===0){if(Number.isInteger(e)){this._trackDense(e,0,s);return}}else{const h=this._denseBase,_=e-h;if(_>=0&&_<=o&&_===(_|0)&&h+_===e){const d=_<o?n[_]:void 0;d!==void 0?s._readSignalNode(d):this._trackDense(e,_,s);return}}}const t=this._triggers,r=t===void 0?void 0:t.get(e);if(typeof e=="object"?e!==null:typeof e=="function"){this._trackObject(e,r,s);return}if(r!==void 0){s._readSignalNode(r);return}const i=s._trackCounterNode(this._source);i!==void 0&&(t===void 0?this._triggers=new Map().set(e,i):t.set(e,i),this._size()>=this._growthLimit&&this._grow())}_trackDense(e,s,t){const r=this._triggers;if(r!==void 0&&r.size!==0){const o=r.get(e);if(o!==void 0){t._readSignalNode(o);return}}const i=t._trackCounterNode(this._source);if(i===void 0)return;const n=this._dense;s===n.length?(s===0&&(this._denseBase=e+0),n.push(i)):n[s]=i,this._denseCount++,this._size()>=this._growthLimit&&this._grow()}_trackObject(e,s,t){if(this._trackedKey=e,s!==void 0)t._readSignalNode(s);else{const r=t._trackCounterNode(this._objectHooks);if(r!==void 0){const i=this._triggers;i===void 0?this._triggers=new Map().set(e,r):i.set(e,r),this._size()>=this._growthLimit&&this._grow()}}this._trackedKey=void 0}_grow(){const e=this._owner.runtime,s=e._ownerDisposalCount();this._sweep(s);const t=this._size();this._growthLimit=t*2>g?t*2:g,this._sweepSlot===-1&&(this._sweepStride=0,e._addDisposalSweeper(this,s+t))}_wakePair(e,s,t){let r=!1,i;const n=this._find(e);if(n!==void 0)try{this._bump(e,n,t)}catch(h){r=!0,i=h}const o=this._find(s);if(o!==void 0)try{this._bump(s,o,t)}catch(h){throw r?new AggregateError([i,h],"[Raph] Selector notification failed."):h}if(r)throw i}_bump(e,s,t){t._bumpSignalNode(s)||this._forget(e)}_wakeChanged(e,s,t,r,i,n){let o=!0;try{o=i(e,t)!==i(e,r)}catch(h){(n??=[]).push(h)}if(o)try{this._bump(e,s,this._reactivity)}catch(h){(n??=[]).push(h)}return n}_find(e){if(typeof e=="number"){const t=this._dense,r=this._denseBase,i=e-r;if(i>=0&&i<t.length&&i===(i|0)&&r+i===e)return t[i]}const s=this._triggers;return s===void 0?void 0:s.get(e)}_forget(e){if(typeof e=="number"){const t=this._dense,r=this._denseBase,i=e-r;if(i>=0&&i<t.length&&i===(i|0)&&r+i===e){if(t[i]!==void 0){t[i]=void 0;const n=--this._denseCount;(n===0||t.length>(n*2+a)*2)&&this._settleDense()}return}}const s=this._triggers;s!==void 0&&s.delete(e)}_settleDense(){if(this._scanning)return;const e=this._dense,s=this._denseCount;if(s===0){e.length=0;return}let t=e.length,r=0;for(;r<t&&e[r]===void 0;)r++;for(;t>r&&e[t-1]===void 0;)t--;if(t-r>s*2+a){const i=this._denseBase,n=this._triggers??=new Map;for(let o=r;o<t;o++){const h=e[o];h!==void 0&&n.set(i+o,h)}e.length=0,this._denseCount=0;return}r!==0&&(e.copyWithin(0,r,t),this._denseBase+=r),e.length=t-r}}function u(c){return e=>c._test(e)}function l(c,e){return{token:e,onDependency:()=>{const s=c._trackedKey;return()=>{c._edgeDetached(s)}}}}exports.RuntimeSelector=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=32,g=32;class f{constructor(e,s,t,i){this.select=l(this),this._previousSource=void 0,this._trackedKey=void 0,this._owner=e,this._reactivity=s,this._source=t,this._equals=i,this._dense=[],this._denseBase=0,this._denseCount=0,this._triggers=void 0,this._scanning=!1,this._objectHooks=p(this,t),this._growthLimit=1,this._sweptAt=0,this._sweepStride=0,this._disposed=!1,this._tapSlot=-1,this._sweepSlot=-1,this._sweepDue=0,t._addWriteTap(this)}get[Symbol.toStringTag](){return"RaphSelector"}toJSON(){return{owner:this._owner.id,triggers:this._size(),disposed:this._disposed}}get _tapOwner(){return this._owner}_debugTriggerCount(){return this._size()}_test(e){const s=this._owner,t=this._reactivity;t._assertTrackedRead(s),s._assertAlive(),this._track(e,t);const i=this._source.peek(),r=this._equals;return r!==void 0?r(e,i):e===i||typeof e=="number"&&typeof i=="number"&&Object.is(e,i)}_observesWrites(){return this._size()!==0}_inspect(){if(this._equals!==void 0)return;const e=this._owner,s=this._source;return{read:()=>s.get(),test:t=>{e._assertAlive();const i=s.peek();return t===i||typeof t=="number"&&typeof i=="number"&&Object.is(t,i)}}}_afterSourceWrite(e,s){if(this._size()===0)return;const t=this._reactivity,i=this._equals;if(i===void 0){if(Object.is(e,s))return;this._wakePair(e,s,t);return}let r;const n=this._scanning;this._scanning=!0;const o=this._dense;for(let _=0;_<o.length;_++){const d=o[_];if(d!==void 0){if(!t._signalNodeHasSubscribers(d)){o[_]=void 0,this._denseCount--;continue}r=this._wakeChanged(this._denseBase+_,d,e,s,i,r)}}const h=this._triggers;if(h!==void 0)for(const[_,d]of h){if(!t._signalNodeHasSubscribers(d)){h.delete(_);continue}r=this._wakeChanged(_,d,e,s,i,r)}if(this._scanning=n,this._settleDense(),r!==void 0)throw r.length===1?r[0]:new AggregateError(r,"[Raph] Selector notification failed.")}_afterOwnerDisposals(e){const s=this._size(),t=this._sweepStride,i=this._sweptAt+(t>s?t:s);if(e<i)return i;this._sweep(e);const r=this._size();if(r===0)return this._sweepStride=0,this._growthLimit=1,0;if(r!==s)return this._sweepStride=0,e+r;const n=(t>r?t:r)*2;return this._sweepStride=n,e+n}_edgeDetached(e){if(this._disposed)return;const s=this._triggers,t=s.get(e);t!==void 0&&this._reactivity._hasSingleSubscriber(t)&&s.delete(e)}_findConsumerOwner(e,s){const t=this._reactivity,i=this._dense;for(let n=0;n<i.length;n++){const o=i[n];if(o===void 0)continue;const h=t._findSubscriberOwner(o,e,s);if(h!==void 0)return h}const r=this._triggers;if(r!==void 0)for(const n of r.values()){const o=t._findSubscriberOwner(n,e,s);if(o!==void 0)return o}}_finalizeSource(){if(this._disposed)return!0;this._disposed=!0,this._equals=void 0,this._source._removeWriteTap(this),this._sweepSlot!==-1&&this._owner.runtime._removeDisposalSweeper(this);const e=this._reactivity;let s;const t=this._dense;for(let r=0;r<t.length;r++){const n=t[r];if(n!==void 0)try{e._releaseSignalNode(n)}catch(o){(s??=[]).push(o)}}t.length=0,this._denseCount=0;const i=this._triggers;if(i!==void 0){for(const r of i.values())try{e._releaseSignalNode(r)}catch(n){(s??=[]).push(n)}i.clear()}if(s!==void 0)throw s.length===1?s[0]:new AggregateError(s,"[Raph] Selector disposal failed.");return!0}_sweep(e=this._owner.runtime._ownerDisposalCount()){this._sweptAt=e;const s=this._size();if(s===0)return;const t=this._dense,i=this._triggers,r=this._reactivity,n=r._countObserved(t,i);if(n===s){t.length!==this._denseCount&&this._settleDense();return}if(n===0){t.length=0,this._denseCount=0,i!==void 0&&i.clear();return}this._denseCount=r._dropUnobserved(t,i),this._settleDense()}_size(){const e=this._triggers;return e===void 0?this._denseCount:this._denseCount+e.size}_track(e,s){if(typeof e=="number"){const n=this._dense,o=n.length;if(o===0){if(Number.isInteger(e)){this._trackDense(e,0,s);return}}else{const h=this._denseBase,_=e-h;if(_>=0&&_<=o&&_===(_|0)&&h+_===e){const d=_<o?n[_]:void 0;d!==void 0?s._readSignalNode(d):this._trackDense(e,_,s);return}}}const t=this._triggers,i=t===void 0?void 0:t.get(e);if(typeof e=="object"?e!==null:typeof e=="function"){this._trackObject(e,i,s);return}if(i!==void 0){s._readSignalNode(i);return}const r=s._trackCounterNode(this._source);r!==void 0&&(t===void 0?this._triggers=new Map().set(e,r):t.set(e,r),this._size()>=this._growthLimit&&this._grow())}_trackDense(e,s,t){const i=this._triggers;if(i!==void 0&&i.size!==0){const o=i.get(e);if(o!==void 0){t._readSignalNode(o);return}}const r=t._trackCounterNode(this._source);if(r===void 0)return;const n=this._dense;s===n.length?(s===0&&(this._denseBase=e+0),n.push(r)):n[s]=r,this._denseCount++,this._size()>=this._growthLimit&&this._grow()}_trackObject(e,s,t){if(this._trackedKey=e,s!==void 0)t._readSignalNode(s);else{const i=t._trackCounterNode(this._objectHooks);if(i!==void 0){const r=this._triggers;r===void 0?this._triggers=new Map().set(e,i):r.set(e,i),this._size()>=this._growthLimit&&this._grow()}}this._trackedKey=void 0}_grow(){const e=this._owner.runtime,s=e._ownerDisposalCount();this._sweep(s);const t=this._size();this._growthLimit=t*2>u?t*2:u,this._sweepSlot===-1&&(this._sweepStride=0,e._addDisposalSweeper(this,s+t))}_wakePair(e,s,t){let i=!1,r;const n=this._find(e);if(n!==void 0)try{this._bump(e,n,t)}catch(h){i=!0,r=h}const o=this._find(s);if(o!==void 0)try{this._bump(s,o,t)}catch(h){throw i?new AggregateError([r,h],"[Raph] Selector notification failed."):h}if(i)throw r}_bump(e,s,t){t._bumpSignalNode(s)||this._forget(e)}_wakeChanged(e,s,t,i,r,n){let o=!0;try{o=r(e,t)!==r(e,i)}catch(h){(n??=[]).push(h)}if(o)try{this._bump(e,s,this._reactivity)}catch(h){(n??=[]).push(h)}return n}_find(e){if(typeof e=="number"){const t=this._dense,i=this._denseBase,r=e-i;if(r>=0&&r<t.length&&r===(r|0)&&i+r===e)return t[r]}const s=this._triggers;return s===void 0?void 0:s.get(e)}_forget(e){if(typeof e=="number"){const t=this._dense,i=this._denseBase,r=e-i;if(r>=0&&r<t.length&&r===(r|0)&&i+r===e){if(t[r]!==void 0){t[r]=void 0;const n=--this._denseCount;(n===0||t.length>(n*2+g)*2)&&this._settleDense()}return}}const s=this._triggers;s!==void 0&&s.delete(e)}_settleDense(){if(this._scanning)return;const e=this._dense,s=this._denseCount;if(s===0){e.length=0;return}let t=e.length,i=0;for(;i<t&&e[i]===void 0;)i++;for(;t>i&&e[t-1]===void 0;)t--;if(t-i>s*2+g){const r=this._denseBase,n=this._triggers??=new Map;for(let o=i;o<t;o++){const h=e[o];h!==void 0&&n.set(r+o,h)}e.length=0,this._denseCount=0;return}i!==0&&(e.copyWithin(0,i,t),this._denseBase+=i),e.length=t-i}}function l(c){const e=s=>c._test(s);return a.set(e,c),e}const a=new WeakMap;function w(c){if(typeof c=="function")return a.get(c)?._inspect()}function p(c,e){return{token:e,onDependency:()=>{const s=c._trackedKey;return()=>{c._edgeDetached(s)}}}}exports.RuntimeSelector=f;exports.inspectSelector=w;
@@ -3,8 +3,8 @@ class f {
3
3
  * Создаёт selector и подключает его к записям source. Регистрацию у
4
4
  * владельца и проверку аргументов выполняет вызывающий код.
5
5
  */
6
- constructor(e, s, t, r) {
7
- this.select = g(this), this._previousSource = void 0, this._trackedKey = void 0, this._owner = e, this._reactivity = s, this._source = t, this._equals = r, this._dense = [], this._denseBase = 0, this._denseCount = 0, this._triggers = void 0, this._scanning = !1, this._objectHooks = a(this, t), this._growthLimit = 1, this._sweptAt = 0, this._sweepStride = 0, this._disposed = !1, this._tapSlot = -1, this._sweepSlot = -1, this._sweepDue = 0, t._addWriteTap(this);
6
+ constructor(e, s, t, i) {
7
+ this.select = u(this), this._previousSource = void 0, this._trackedKey = void 0, this._owner = e, this._reactivity = s, this._source = t, this._equals = i, this._dense = [], this._denseBase = 0, this._denseCount = 0, this._triggers = void 0, this._scanning = !1, this._objectHooks = a(this, t), this._growthLimit = 1, this._sweptAt = 0, this._sweepStride = 0, this._disposed = !1, this._tapSlot = -1, this._sweepSlot = -1, this._sweepDue = 0, t._addWriteTap(this);
8
8
  }
9
9
  /**
10
10
  * Тег Object.prototype.toString: инструменты, которые обходят только plain
@@ -52,8 +52,8 @@ class f {
52
52
  _test(e) {
53
53
  const s = this._owner, t = this._reactivity;
54
54
  t._assertTrackedRead(s), s._assertAlive(), this._track(e, t);
55
- const r = this._source.peek(), i = this._equals;
56
- return i !== void 0 ? i(e, r) : e === r || typeof e == "number" && typeof r == "number" && Object.is(e, r);
55
+ const i = this._source.peek(), r = this._equals;
56
+ return r !== void 0 ? r(e, i) : e === i || typeof e == "number" && typeof i == "number" && Object.is(e, i);
57
57
  }
58
58
  /**
59
59
  * Сообщает, что запись в source может разбудить потребителей selector.
@@ -62,6 +62,20 @@ class f {
62
62
  _observesWrites() {
63
63
  return this._size() !== 0;
64
64
  }
65
+ /** @internal См. `inspectSelector`. */
66
+ _inspect() {
67
+ if (this._equals !== void 0)
68
+ return;
69
+ const e = this._owner, s = this._source;
70
+ return {
71
+ read: () => s.get(),
72
+ test: (t) => {
73
+ e._assertAlive();
74
+ const i = s.peek();
75
+ return t === i || typeof t == "number" && typeof i == "number" && Object.is(t, i);
76
+ }
77
+ };
78
+ }
65
79
  /**
66
80
  * Будит потребителей ключей, чей ответ изменила запись в source. Вызывается
67
81
  * signal-ом после того, как новое значение стало видимым, внутри его границы
@@ -71,45 +85,45 @@ class f {
71
85
  _afterSourceWrite(e, s) {
72
86
  if (this._size() === 0)
73
87
  return;
74
- const t = this._reactivity, r = this._equals;
75
- if (r === void 0) {
88
+ const t = this._reactivity, i = this._equals;
89
+ if (i === void 0) {
76
90
  if (Object.is(e, s))
77
91
  return;
78
92
  this._wakePair(e, s, t);
79
93
  return;
80
94
  }
81
- let i;
95
+ let r;
82
96
  const n = this._scanning;
83
97
  this._scanning = !0;
84
98
  const o = this._dense;
85
99
  for (let _ = 0; _ < o.length; _++) {
86
- const d = o[_];
87
- if (d !== void 0) {
88
- if (!t._signalNodeHasSubscribers(d)) {
100
+ const c = o[_];
101
+ if (c !== void 0) {
102
+ if (!t._signalNodeHasSubscribers(c)) {
89
103
  o[_] = void 0, this._denseCount--;
90
104
  continue;
91
105
  }
92
- i = this._wakeChanged(
106
+ r = this._wakeChanged(
93
107
  this._denseBase + _,
94
- d,
108
+ c,
95
109
  e,
96
110
  s,
97
- r,
98
- i
111
+ i,
112
+ r
99
113
  );
100
114
  }
101
115
  }
102
116
  const h = this._triggers;
103
117
  if (h !== void 0)
104
- for (const [_, d] of h) {
105
- if (!t._signalNodeHasSubscribers(d)) {
118
+ for (const [_, c] of h) {
119
+ if (!t._signalNodeHasSubscribers(c)) {
106
120
  h.delete(_);
107
121
  continue;
108
122
  }
109
- i = this._wakeChanged(_, d, e, s, r, i);
123
+ r = this._wakeChanged(_, c, e, s, i, r);
110
124
  }
111
- if (this._scanning = n, this._settleDense(), i !== void 0)
112
- throw i.length === 1 ? i[0] : new AggregateError(i, "[Raph] Selector notification failed.");
125
+ if (this._scanning = n, this._settleDense(), r !== void 0)
126
+ throw r.length === 1 ? r[0] : new AggregateError(r, "[Raph] Selector notification failed.");
113
127
  }
114
128
  /**
115
129
  * Убирает triggers без потребителей, когда Runtime после прошлой уборки
@@ -125,16 +139,16 @@ class f {
125
139
  * @internal
126
140
  */
127
141
  _afterOwnerDisposals(e) {
128
- const s = this._size(), t = this._sweepStride, r = this._sweptAt + (t > s ? t : s);
129
- if (e < r)
130
- return r;
142
+ const s = this._size(), t = this._sweepStride, i = this._sweptAt + (t > s ? t : s);
143
+ if (e < i)
144
+ return i;
131
145
  this._sweep(e);
132
- const i = this._size();
133
- if (i === 0)
146
+ const r = this._size();
147
+ if (r === 0)
134
148
  return this._sweepStride = 0, this._growthLimit = 1, 0;
135
- if (i !== s)
136
- return this._sweepStride = 0, e + i;
137
- const n = (t > i ? t : i) * 2;
149
+ if (r !== s)
150
+ return this._sweepStride = 0, e + r;
151
+ const n = (t > r ? t : r) * 2;
138
152
  return this._sweepStride = n, e + n;
139
153
  }
140
154
  /**
@@ -159,18 +173,18 @@ class f {
159
173
  * @internal
160
174
  */
161
175
  _findConsumerOwner(e, s) {
162
- const t = this._reactivity, r = this._dense;
163
- for (let n = 0; n < r.length; n++) {
164
- const o = r[n];
176
+ const t = this._reactivity, i = this._dense;
177
+ for (let n = 0; n < i.length; n++) {
178
+ const o = i[n];
165
179
  if (o === void 0)
166
180
  continue;
167
181
  const h = t._findSubscriberOwner(o, e, s);
168
182
  if (h !== void 0)
169
183
  return h;
170
184
  }
171
- const i = this._triggers;
172
- if (i !== void 0)
173
- for (const n of i.values()) {
185
+ const r = this._triggers;
186
+ if (r !== void 0)
187
+ for (const n of r.values()) {
174
188
  const o = t._findSubscriberOwner(n, e, s);
175
189
  if (o !== void 0)
176
190
  return o;
@@ -190,8 +204,8 @@ class f {
190
204
  const e = this._reactivity;
191
205
  let s;
192
206
  const t = this._dense;
193
- for (let i = 0; i < t.length; i++) {
194
- const n = t[i];
207
+ for (let r = 0; r < t.length; r++) {
208
+ const n = t[r];
195
209
  if (n !== void 0)
196
210
  try {
197
211
  e._releaseSignalNode(n);
@@ -200,15 +214,15 @@ class f {
200
214
  }
201
215
  }
202
216
  t.length = 0, this._denseCount = 0;
203
- const r = this._triggers;
204
- if (r !== void 0) {
205
- for (const i of r.values())
217
+ const i = this._triggers;
218
+ if (i !== void 0) {
219
+ for (const r of i.values())
206
220
  try {
207
- e._releaseSignalNode(i);
221
+ e._releaseSignalNode(r);
208
222
  } catch (n) {
209
223
  (s ??= []).push(n);
210
224
  }
211
- r.clear();
225
+ i.clear();
212
226
  }
213
227
  if (s !== void 0)
214
228
  throw s.length === 1 ? s[0] : new AggregateError(s, "[Raph] Selector disposal failed.");
@@ -225,16 +239,16 @@ class f {
225
239
  const s = this._size();
226
240
  if (s === 0)
227
241
  return;
228
- const t = this._dense, r = this._triggers, i = this._reactivity, n = i._countObserved(t, r);
242
+ const t = this._dense, i = this._triggers, r = this._reactivity, n = r._countObserved(t, i);
229
243
  if (n === s) {
230
244
  t.length !== this._denseCount && this._settleDense();
231
245
  return;
232
246
  }
233
247
  if (n === 0) {
234
- t.length = 0, this._denseCount = 0, r !== void 0 && r.clear();
248
+ t.length = 0, this._denseCount = 0, i !== void 0 && i.clear();
235
249
  return;
236
250
  }
237
- this._denseCount = i._dropUnobserved(t, r), this._settleDense();
251
+ this._denseCount = r._dropUnobserved(t, i), this._settleDense();
238
252
  }
239
253
  /**
240
254
  * Число ключей в обеих частях индекса: с потребителями и ещё не убранных.
@@ -258,23 +272,23 @@ class f {
258
272
  } else {
259
273
  const h = this._denseBase, _ = e - h;
260
274
  if (_ >= 0 && _ <= o && _ === (_ | 0) && h + _ === e) {
261
- const d = _ < o ? n[_] : void 0;
262
- d !== void 0 ? s._readSignalNode(d) : this._trackDense(e, _, s);
275
+ const c = _ < o ? n[_] : void 0;
276
+ c !== void 0 ? s._readSignalNode(c) : this._trackDense(e, _, s);
263
277
  return;
264
278
  }
265
279
  }
266
280
  }
267
- const t = this._triggers, r = t === void 0 ? void 0 : t.get(e);
281
+ const t = this._triggers, i = t === void 0 ? void 0 : t.get(e);
268
282
  if (typeof e == "object" ? e !== null : typeof e == "function") {
269
- this._trackObject(e, r, s);
283
+ this._trackObject(e, i, s);
270
284
  return;
271
285
  }
272
- if (r !== void 0) {
273
- s._readSignalNode(r);
286
+ if (i !== void 0) {
287
+ s._readSignalNode(i);
274
288
  return;
275
289
  }
276
- const i = s._trackCounterNode(this._source);
277
- i !== void 0 && (t === void 0 ? this._triggers = (/* @__PURE__ */ new Map()).set(e, i) : t.set(e, i), this._size() >= this._growthLimit && this._grow());
290
+ const r = s._trackCounterNode(this._source);
291
+ r !== void 0 && (t === void 0 ? this._triggers = (/* @__PURE__ */ new Map()).set(e, r) : t.set(e, r), this._size() >= this._growthLimit && this._grow());
278
292
  }
279
293
  /**
280
294
  * Создаёт trigger целого ключа на месте `offset` ряда: в конце ряда либо на
@@ -282,19 +296,19 @@ class f {
282
296
  * создаёт, и пустой ряд остаётся пустым.
283
297
  */
284
298
  _trackDense(e, s, t) {
285
- const r = this._triggers;
286
- if (r !== void 0 && r.size !== 0) {
287
- const o = r.get(e);
299
+ const i = this._triggers;
300
+ if (i !== void 0 && i.size !== 0) {
301
+ const o = i.get(e);
288
302
  if (o !== void 0) {
289
303
  t._readSignalNode(o);
290
304
  return;
291
305
  }
292
306
  }
293
- const i = t._trackCounterNode(this._source);
294
- if (i === void 0)
307
+ const r = t._trackCounterNode(this._source);
308
+ if (r === void 0)
295
309
  return;
296
310
  const n = this._dense;
297
- s === n.length ? (s === 0 && (this._denseBase = e + 0), n.push(i)) : n[s] = i, this._denseCount++, this._size() >= this._growthLimit && this._grow();
311
+ s === n.length ? (s === 0 && (this._denseBase = e + 0), n.push(r)) : n[s] = r, this._denseCount++, this._size() >= this._growthLimit && this._grow();
298
312
  }
299
313
  /**
300
314
  * Подписывает активного потребителя на trigger ключа-объекта: связь с ним
@@ -304,10 +318,10 @@ class f {
304
318
  if (this._trackedKey = e, s !== void 0)
305
319
  t._readSignalNode(s);
306
320
  else {
307
- const r = t._trackCounterNode(this._objectHooks);
308
- if (r !== void 0) {
309
- const i = this._triggers;
310
- i === void 0 ? this._triggers = (/* @__PURE__ */ new Map()).set(e, r) : i.set(e, r), this._size() >= this._growthLimit && this._grow();
321
+ const i = t._trackCounterNode(this._objectHooks);
322
+ if (i !== void 0) {
323
+ const r = this._triggers;
324
+ r === void 0 ? this._triggers = (/* @__PURE__ */ new Map()).set(e, i) : r.set(e, i), this._size() >= this._growthLimit && this._grow();
311
325
  }
312
326
  }
313
327
  this._trackedKey = void 0;
@@ -330,23 +344,23 @@ class f {
330
344
  * значения ищется после пробуждения прежнего, которое могло изменить индекс.
331
345
  */
332
346
  _wakePair(e, s, t) {
333
- let r = !1, i;
347
+ let i = !1, r;
334
348
  const n = this._find(e);
335
349
  if (n !== void 0)
336
350
  try {
337
351
  this._bump(e, n, t);
338
352
  } catch (h) {
339
- r = !0, i = h;
353
+ i = !0, r = h;
340
354
  }
341
355
  const o = this._find(s);
342
356
  if (o !== void 0)
343
357
  try {
344
358
  this._bump(s, o, t);
345
359
  } catch (h) {
346
- throw r ? new AggregateError([i, h], "[Raph] Selector notification failed.") : h;
360
+ throw i ? new AggregateError([r, h], "[Raph] Selector notification failed.") : h;
347
361
  }
348
- if (r)
349
- throw i;
362
+ if (i)
363
+ throw r;
350
364
  }
351
365
  /**
352
366
  * Сдвигает счётчик trigger: его потребители получают invalidation. Trigger
@@ -388,10 +402,10 @@ class f {
388
402
  * вычислить, считается изменившимся: потребитель встретит то же исключение
389
403
  * в собственном чтении. Сбои копятся в `errors`; возвращается их список.
390
404
  */
391
- _wakeChanged(e, s, t, r, i, n) {
405
+ _wakeChanged(e, s, t, i, r, n) {
392
406
  let o = !0;
393
407
  try {
394
- o = i(e, t) !== i(e, r);
408
+ o = r(e, t) !== r(e, i);
395
409
  } catch (h) {
396
410
  (n ??= []).push(h);
397
411
  }
@@ -410,9 +424,9 @@ class f {
410
424
  */
411
425
  _find(e) {
412
426
  if (typeof e == "number") {
413
- const t = this._dense, r = this._denseBase, i = e - r;
414
- if (i >= 0 && i < t.length && i === (i | 0) && r + i === e)
415
- return t[i];
427
+ const t = this._dense, i = this._denseBase, r = e - i;
428
+ if (r >= 0 && r < t.length && r === (r | 0) && i + r === e)
429
+ return t[r];
416
430
  }
417
431
  const s = this._triggers;
418
432
  return s === void 0 ? void 0 : s.get(e);
@@ -430,10 +444,10 @@ class f {
430
444
  */
431
445
  _forget(e) {
432
446
  if (typeof e == "number") {
433
- const t = this._dense, r = this._denseBase, i = e - r;
434
- if (i >= 0 && i < t.length && i === (i | 0) && r + i === e) {
435
- if (t[i] !== void 0) {
436
- t[i] = void 0;
447
+ const t = this._dense, i = this._denseBase, r = e - i;
448
+ if (r >= 0 && r < t.length && r === (r | 0) && i + r === e) {
449
+ if (t[r] !== void 0) {
450
+ t[r] = void 0;
437
451
  const n = --this._denseCount;
438
452
  (n === 0 || t.length > (n * 2 + 32) * 2) && this._settleDense();
439
453
  }
@@ -467,37 +481,44 @@ class f {
467
481
  e.length = 0;
468
482
  return;
469
483
  }
470
- let t = e.length, r = 0;
471
- for (; r < t && e[r] === void 0; )
472
- r++;
473
- for (; t > r && e[t - 1] === void 0; )
484
+ let t = e.length, i = 0;
485
+ for (; i < t && e[i] === void 0; )
486
+ i++;
487
+ for (; t > i && e[t - 1] === void 0; )
474
488
  t--;
475
- if (t - r > s * 2 + 32) {
476
- const i = this._denseBase, n = this._triggers ??= /* @__PURE__ */ new Map();
477
- for (let o = r; o < t; o++) {
489
+ if (t - i > s * 2 + 32) {
490
+ const r = this._denseBase, n = this._triggers ??= /* @__PURE__ */ new Map();
491
+ for (let o = i; o < t; o++) {
478
492
  const h = e[o];
479
- h !== void 0 && n.set(i + o, h);
493
+ h !== void 0 && n.set(r + o, h);
480
494
  }
481
495
  e.length = 0, this._denseCount = 0;
482
496
  return;
483
497
  }
484
- r !== 0 && (e.copyWithin(0, r, t), this._denseBase += r), e.length = t - r;
498
+ i !== 0 && (e.copyWithin(0, i, t), this._denseBase += i), e.length = t - i;
485
499
  }
486
500
  }
487
- function g(c) {
488
- return (e) => c._test(e);
501
+ function u(d) {
502
+ const e = (s) => d._test(s);
503
+ return g.set(e, d), e;
504
+ }
505
+ const g = /* @__PURE__ */ new WeakMap();
506
+ function l(d) {
507
+ if (typeof d == "function")
508
+ return g.get(d)?._inspect();
489
509
  }
490
- function a(c, e) {
510
+ function a(d, e) {
491
511
  return {
492
512
  token: e,
493
513
  onDependency: () => {
494
- const s = c._trackedKey;
514
+ const s = d._trackedKey;
495
515
  return () => {
496
- c._edgeDetached(s);
516
+ d._edgeDetached(s);
497
517
  };
498
518
  }
499
519
  };
500
520
  }
501
521
  export {
502
- f as RuntimeSelector
522
+ f as RuntimeSelector,
523
+ l as inspectSelector
503
524
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../reactivity/reactive-object.cjs"),r=Object.freeze({configure:e.configureReactiveObjectPolicy,dispose:e.disposeReactiveObjectContext,reactive(t,c){return e.reactiveObject(t,c,()=>t._createReactivePropertySourceBridge())}});exports.RUNTIME_OBJECT_SUPPORT=r;
@@ -0,0 +1,11 @@
1
+ import { disposeReactiveObjectContext as c, configureReactiveObjectPolicy as r, reactiveObject as o } from "../../reactivity/reactive-object.js";
2
+ const a = /* @__PURE__ */ Object.freeze({
3
+ configure: r,
4
+ dispose: c,
5
+ reactive(e, t) {
6
+ return o(e, t, () => e._createReactivePropertySourceBridge());
7
+ }
8
+ });
9
+ export {
10
+ a as RUNTIME_OBJECT_SUPPORT
11
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../../reactivity/engine.cjs"),O=require("../errors.cjs"),R=require("../phases/RaphPhaseTaskRecord.cjs"),S=require("./RaphSelector.cjs"),T=require("./RaphWorkGraph.cjs");let a,u;function A(n){return{schedule:n,dispose:g}}let v=0;function E(n){n.firstSub!==null&&++v}function N(n,e,t){n.firstSub===null&&t.delete(e)}const _=Object.freeze({}),m=Object.freeze({schedule:g,dispose:g}),b=64;class C{constructor(e){this.items=[e],this.shared=!1}detach(){const e=this.items.slice();return this.items=e,this.shared=!1,e}}class f extends T.RaphProducer{constructor(e,t,r,i){super(e,t,r),this._value=i,this._node=void 0,this._previousSource=void 0,this._writeTaps=void 0,this.source=this}get token(){return this}get dependencyOwner(){return this.owner}toJSON(){let e=0;for(let t=this._previousSource;t!==void 0&&e<b;t=t._previousSource)++e;return{kind:this.kind,owner:this.owner.id,index:e,revision:this.revision,disposed:this.disposed}}get(){const e=this.owner,t=e.runtime._getReactivity();w(t,e),e._assertAlive();const r=this._node;if(r!==void 0)return t._readSignalNode(r);const i=this._value,s=t._trackSignalNode(i,this);return s!==void 0&&(this._node=s,this._value=void 0),i}peek(){const e=this.owner,t=e.runtime._getReactivity();h(t._lifecycle),e._assertAlive();const r=this._node;return r===void 0?this._value:t._peekSignalNode(r)}set(e){const t=this.owner,r=t.runtime,i=r._getReactivity()._lifecycle,s=i.assertWriteAllowed;s===void 0?(h(i),t._assertAlive()):(t._assertAlive(),s()),r._enterWrite();try{this._write(e)}catch(o){throw r._failWrite(o)}r._exitWrite()}_writeInBoundary(e){const t=this.owner;h(t.runtime._getReactivity()._lifecycle),t._assertAlive(),this._write(e)}_addWriteTap(e){const t=this._writeTaps;if(t===void 0){e._tapSlot=0,this._writeTaps=new C(e);return}const r=t.shared?t.detach():t.items;e._tapSlot=r.length,r.push(e)}_removeWriteTap(e){const t=this._writeTaps;if(t===void 0)return;const r=e._tapSlot;if(r<0||t.items[r]!==e)return;if(e._tapSlot=-1,t.items.length===1){this._writeTaps=void 0;return}const i=t.shared?t.detach():t.items,s=i.pop();s!==e&&(i[r]=s,s._tapSlot=r)}onChange(e,t,r){this.owner.runtime._getWorkGraph()._notifyValueWrite(this,e,t,r)}onDispose(e){this.owner.runtime._getWorkGraph()._disposeProducer(this,e)}_findConsumerOwner(e,t){const r=this._writeTaps;if(r!==void 0){const s=r.items;for(let o=0;o<s.length;o++){const c=s[o]._tapOwner;if(e(c,t))return c}}const i=this._node;return i===void 0?void 0:this.owner.runtime._getReactivity()._findSubscriberOwner(i,e,t)}_finalizeSource(){if(this.disposed)return!0;this._value=void 0,this._writeTaps=void 0;const e=this._node,t=this.owner.runtime._getReactivity();let r;try{this.onDispose(e!==void 0&&t._signalNodeHasSubscribers(e))}catch(i){(r??=[]).push(i)}if(e!==void 0){this._node=void 0;try{t._releaseSignalNode(e)}catch(i){(r??=[]).push(i)}}if(r!==void 0)throw r.length===1?r[0]:new AggregateError(r,"Owned signal disposal failed.");return!0}_write(e){const t=this._writeTaps;if(t!==void 0){this._writeTapped(e,t);return}const r=this._node;if(r!==void 0){const s=this.owner.runtime,o=s._getReactivity(),c=o._visibleSignalValue(r);c!==e&&s._getWorkGraph()._notifyValueWrite(this,c,e,r.firstSub!==null),o._writeSignalNode(r,e);return}const i=this._value;i!==e&&(this.owner.runtime._getWorkGraph()._notifyValueWrite(this,i,e,!1),this._value=e)}_writeTapped(e,t){const r=this._node,i=this.owner.runtime._getReactivity(),s=r===void 0?this._value:i._visibleSignalValue(r);if(s===e)return;const o=t.items;t.shared=!0;let c=r!==void 0&&i._signalNodeHasSubscribers(r);for(let d=0;!c&&d<o.length;d++)c=o[d]._observesWrites();this.onChange(s,e,c);let l;if(r===void 0)this._value=e;else try{i._writeSignalNode(r,e)}catch(d){l=[d]}for(let d=0;d<o.length;d++)try{o[d]._afterSourceWrite(s,e)}catch(y){(l??=[]).push(y)}if(l!==void 0)throw l.length===1?l[0]:new AggregateError(l,"[Raph] Signal write and its observers failed.")}}class p extends k.RaphReactivity{constructor(e,t={}){super({...t.adaptiveDependencyIndex===void 0?{}:{adaptiveDependencyIndex:t.adaptiveDependencyIndex},effectScheduler:{bind:A}}),this._lifecycle=e,this._phaseBody=()=>{const r=this._activeEffectTask(),i=r.consumerOwner,s=a,o=u;a=e,u=i;let c;try{const l=r.effect;c=l(r.state&R.TASK_TASKLESS?r.group:r.task)}finally{a=s,u=o}return typeof c=="function"?I(this,c):c},p._releasedShapeAnchor??=W(this)}untrackedWithOwner(e){const t=a,r=u;a=void 0,u=void 0;try{return this.untracked(e)}finally{a=t,u=r}}_applyUntrackedWithOwner(e,t){const r=a,i=u;a=void 0,u=void 0;try{return this._isTracking()?this.untracked(()=>e(...t)):e(...t)}finally{a=r,u=i}}_runTaskEffectUntracked(e){const t=a,r=u;a=void 0,u=void 0;try{this._finishTaskEffectRun(e)}finally{a=t,u=r}}getActiveOwner(){return a===void 0?void 0:a.owner}getActiveConsumerOwner(){return u}hasActiveContext(){return a!==void 0||this._isTracking()}runWithOwner(e,t,r){const i=a,s=u;a=e,u=e===void 0?void 0:t;try{return r()}finally{a=i,u=s}}_findSignalConsumerOwner(e,t,r){for(let i=e._lastOwnedSource();i!==void 0;i=i._previousSource){if(!(i instanceof f)&&!(i instanceof S.RuntimeSelector))continue;const s=i._findConsumerOwner(t,r);if(s!==void 0)return s}}_assertTrackedRead(e){w(this,e)}_hasSingleSubscriber(e){const t=e.firstSub;return t!==null&&t===e.lastSub}_countObserved(e,t){let r=0;for(let i=0;i<e.length;i++){const s=e[i];s!==void 0&&s.firstSub!==null&&++r}return t!==void 0&&t.size!==0&&(v=0,t.forEach(E),r+=v),r}_dropUnobserved(e,t){let r=0;for(let i=0;i<e.length;i++){const s=e[i];s!==void 0&&(s.firstSub===null?e[i]=void 0:++r)}return t!==void 0&&t.size!==0&&t.forEach(N),r}selectorForOwner(e,t,r){if(!(e instanceof f))throw new TypeError("[Raph] selector() source must be a writable Runtime signal.");const i=r?.equals;if(i!==void 0&&typeof i!="function")throw new TypeError("[Raph] selector() equals must be a function.");const s=e.owner;if(s.runtime!==t.runtime)throw new O.RaphCrossRuntimeError("[Raph] selector() source belongs to another runtime.");s._assertAlive(),this._lifecycle.assertDependencyAllowed(s,t);const o=new S.RuntimeSelector(t,this,e,i);try{t._adoptSourceEntry(o)}catch(c){throw o._finalizeSource(),c}return o}signalForOwner(e,t,r="producer",i=!0){const s=new f(t,r,i,e);return t._adoptSourceEntry(s),s}computedForOwner(e,t,r){const i=this._lifecycle,s=t._adoptSource(this._ownedComputed(e,r));return{get:()=>{w(this,t),t._assertAlive();const o=s.get();return t._assertAlive(),o},peek(){h(i),t._assertAlive();const o=s.peek();return t._assertAlive(),o}}}}p._releasedShapeAnchor=void 0;function W(n){let e,t;const r=n._allocateTaskEffect(()=>{e=n._trackSignalNode(void 0,_),t=n._trackSignalNode(void 0,_)},m);n._requestTaskEffect(r,!1),n._beginTaskEffectRun(r),n._finishTaskEffectRun(r);const i=e.firstSub;n._disposeTaskEffect(r),n.batch(()=>n._writeSignalNode(t,0)),n._releaseSignalNode(e),n._releaseSignalNode(t);let s,o;const c=n._allocateTaskEffect(()=>{s=n._trackCounterNode(_),o=n._trackCounterNode(_)},m);return n._requestTaskEffect(c,!1),n._beginTaskEffectRun(c),n._finishTaskEffectRun(c),n.batch(()=>{n._bumpSignalNode(o)}),n._disposeTaskEffect(c),n._releaseSignalNode(s),n._releaseSignalNode(o),{source:e,written:t,edge:i,consumer:r,counter:s,bumped:o}}function I(n,e){return()=>n.untrackedWithOwner(e)}function h(n){n.owner===void 0&&n.throwDisposed()}function w(n,e){const t=n._lifecycle;h(t);const r=a;if(r!==void 0){r!==t&&t.throwCrossRuntime(r.owner);const s=u;s!==void 0&&s!==e&&t.assertDependencyAllowed(e,s);return}const i=n._activeSubscriberOwner();i!==void 0&&t.assertDependencyAllowed(e,i)}function g(){}exports.RuntimeReactivity=p;exports.RuntimeSignal=f;exports.SIGNAL_INDEX_LIMIT=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../../reactivity/engine-core.cjs"),k=require("../errors.cjs"),O=require("../phases/RaphPhaseTaskRecord.cjs"),R=require("./RaphWorkGraph.cjs");let c,a;function T(n){return{schedule:n,dispose:g}}let v=0;function A(n){n.firstSub!==null&&++v}function E(n,e,t){n.firstSub===null&&t.delete(e)}const h=Object.freeze({}),S=Object.freeze({schedule:g,dispose:g}),m=64;class N{constructor(e){this.items=[e],this.shared=!1}detach(){const e=this.items.slice();return this.items=e,this.shared=!1,e}}class _ extends R.RaphProducer{constructor(e,t,r,s){super(e,t,r),this._value=s,this._node=void 0,this._previousSource=void 0,this._writeTaps=void 0,this.source=this}get token(){return this}get dependencyOwner(){return this.owner}toJSON(){let e=0;for(let t=this._previousSource;t!==void 0&&e<m;t=t._previousSource)++e;return{kind:this.kind,owner:this.owner.id,index:e,revision:this.revision,disposed:this.disposed}}get(){const e=this.owner,t=e.runtime._getReactivity();w(t,e),(e._disposed||e._disposing)&&e._assertAlive();const r=this._node;if(r!==void 0)return t._readSignalNode(r);const s=this._value,i=t._trackSignalNode(s,this);return i!==void 0&&(this._node=i,this._value=void 0),s}peek(){const e=this.owner,t=e.runtime._getReactivity();f(t._lifecycle),e._assertAlive();const r=this._node;return r===void 0?this._value:t._peekSignalNode(r)}set(e){const t=this.owner,r=t.runtime,s=r._getReactivity()._lifecycle,i=s.assertWriteAllowed;i===void 0?(f(s),t._assertAlive()):(t._assertAlive(),i()),r._enterWrite();try{this._write(e)}catch(o){throw r._failWrite(o)}r._exitWrite()}_writeInBoundary(e){const t=this.owner;f(t.runtime._getReactivity()._lifecycle),t._assertAlive(),this._write(e)}_addWriteTap(e){const t=this._writeTaps;if(t===void 0){e._tapSlot=0,this._writeTaps=new N(e);return}const r=t.shared?t.detach():t.items;e._tapSlot=r.length,r.push(e)}_removeWriteTap(e){const t=this._writeTaps;if(t===void 0)return;const r=e._tapSlot;if(r<0||t.items[r]!==e)return;if(e._tapSlot=-1,t.items.length===1){this._writeTaps=void 0;return}const s=t.shared?t.detach():t.items,i=s.pop();i!==e&&(s[r]=i,i._tapSlot=r)}onChange(e,t,r){this.owner.runtime._getWorkGraph()._notifyValueWrite(this,e,t,r)}onDispose(e){this.owner.runtime._getWorkGraph()._disposeProducer(this,e)}_findConsumerOwner(e,t){const r=this._writeTaps;if(r!==void 0){const i=r.items;for(let o=0;o<i.length;o++){const u=i[o]._tapOwner;if(e(u,t))return u}}const s=this._node;return s===void 0?void 0:this.owner.runtime._getReactivity()._findSubscriberOwner(s,e,t)}_finalizeSource(){if(this.disposed)return!0;this._value=void 0,this._writeTaps=void 0;const e=this._node,t=this.owner.runtime._getReactivity();let r;try{this.onDispose(e!==void 0&&t._signalNodeHasSubscribers(e))}catch(s){(r??=[]).push(s)}if(e!==void 0){this._node=void 0;try{t._releaseSignalNode(e)}catch(s){(r??=[]).push(s)}}if(r!==void 0)throw r.length===1?r[0]:new AggregateError(r,"Owned signal disposal failed.");return!0}_write(e){const t=this._writeTaps;if(t!==void 0){this._writeTapped(e,t);return}const r=this._node;if(r!==void 0){const i=this.owner.runtime,o=i._getReactivity(),u=o._visibleSignalValue(r);u!==e&&i._getWorkGraph()._notifyValueWrite(this,u,e,r.firstSub!==null),o._writeSignalNode(r,e);return}const s=this._value;s!==e&&(this.owner.runtime._getWorkGraph()._notifyValueWrite(this,s,e,!1),this._value=e)}_writeTapped(e,t){const r=this._node,s=this.owner.runtime._getReactivity(),i=r===void 0?this._value:s._visibleSignalValue(r);if(i===e)return;const o=t.items;t.shared=!0;let u=r!==void 0&&s._signalNodeHasSubscribers(r);for(let l=0;!u&&l<o.length;l++)u=o[l]._observesWrites();this.onChange(i,e,u);let d;if(r===void 0)this._value=e;else try{s._writeSignalNode(r,e)}catch(l){d=[l]}for(let l=0;l<o.length;l++)try{o[l]._afterSourceWrite(i,e)}catch(y){(d??=[]).push(y)}if(d!==void 0)throw d.length===1?d[0]:new AggregateError(d,"[Raph] Signal write and its observers failed.")}}class p extends b.ReactivityEngine{constructor(e,t={},r){super({...t.adaptiveDependencyIndex===void 0?{}:{adaptiveDependencyIndex:t.adaptiveDependencyIndex},effectScheduler:{bind:T}}),this._lifecycle=e,this._selectors=r,this._phaseBody=()=>{const s=this._activeEffectTask(),i=s.consumerOwner,o=c,u=a;c=e,a=i;let d;try{const l=s.effect;d=l(s.state&O.TASK_TASKLESS?s.group:s.task)}finally{c=o,a=u}return typeof d=="function"?W(this,d):d},p._releasedShapeAnchor??=C(this)}untrackedWithOwner(e){const t=c,r=a;c=void 0,a=void 0;try{return this.untracked(e)}finally{c=t,a=r}}_probeReadsWithOwner(e){const t=c,r=a;c=void 0,a=void 0;try{return this._probeReads(e)}finally{c=t,a=r}}_applyUntrackedWithOwner(e,t,r){const s=c,i=a;c=void 0,a=void 0;try{return this._isTracking()?this.untracked(()=>Reflect.apply(e,r,t)):Reflect.apply(e,r,t)}finally{c=s,a=i}}_runTaskEffectUntracked(e){const t=c,r=a;c=void 0,a=void 0;try{this._finishTaskEffectRun(e)}finally{c=t,a=r}}getActiveOwner(){return c===void 0?void 0:c.owner}getActiveConsumerOwner(){return a}hasActiveContext(){return c!==void 0||this._isTracking()}runWithOwner(e,t,r){const s=c,i=a;c=e,a=e===void 0?void 0:t;try{return r()}finally{c=s,a=i}}_findSignalConsumerOwner(e,t,r){for(let s=e._lastOwnedSource();s!==void 0;s=s._previousSource){if(!(s instanceof _)&&!this._selectors?.is(s))continue;const i=s._findConsumerOwner(t,r);if(i!==void 0)return i}}_assertTrackedRead(e){w(this,e)}_hasSingleSubscriber(e){const t=e.firstSub;return t!==null&&t===e.lastSub}_countObserved(e,t){let r=0;for(let s=0;s<e.length;s++){const i=e[s];i!==void 0&&i.firstSub!==null&&++r}return t!==void 0&&t.size!==0&&(v=0,t.forEach(A),r+=v),r}_dropUnobserved(e,t){let r=0;for(let s=0;s<e.length;s++){const i=e[s];i!==void 0&&(i.firstSub===null?e[s]=void 0:++r)}return t!==void 0&&t.size!==0&&t.forEach(E),r}selectorForOwner(e,t,r){if(this._selectors===void 0)throw new TypeError("[Raph] Selectors require the full execution profile.");if(!(e instanceof _))throw new TypeError("[Raph] selector() source must be a writable Runtime signal.");const s=r?.equals;if(s!==void 0&&typeof s!="function")throw new TypeError("[Raph] selector() equals must be a function.");const i=e.owner;if(i.runtime!==t.runtime)throw new k.RaphCrossRuntimeError("[Raph] selector() source belongs to another runtime.");i._assertAlive(),this._lifecycle.assertDependencyAllowed(i,t);const o=this._selectors.create(t,this,e,s);try{t._adoptSourceEntry(o)}catch(u){throw o._finalizeSource(),u}return o}signalForOwner(e,t,r="producer",s=!0){const i=new _(t,r,s,e);return t._adoptSourceEntry(i),i}computedForOwner(e,t,r){const s=this._lifecycle,i=t._adoptSource(this._ownedComputed(e,r));return{get:()=>{w(this,t),t._assertAlive();const o=i.get();return t._assertAlive(),o},peek(){f(s),t._assertAlive();const o=i.peek();return t._assertAlive(),o}}}}p._releasedShapeAnchor=void 0;function C(n){let e,t;const r=n._allocateTaskEffect(()=>{e=n._trackSignalNode(void 0,h),t=n._trackSignalNode(void 0,h)},S);n._requestTaskEffect(r,!1),n._beginTaskEffectRun(r),n._finishTaskEffectRun(r);const s=e.firstSub;n._disposeTaskEffect(r),n.batch(()=>n._writeSignalNode(t,0)),n._releaseSignalNode(e),n._releaseSignalNode(t);let i,o;const u=n._allocateTaskEffect(()=>{i=n._trackCounterNode(h),o=n._trackCounterNode(h)},S);return n._requestTaskEffect(u,!1),n._beginTaskEffectRun(u),n._finishTaskEffectRun(u),n.batch(()=>{n._bumpSignalNode(o)}),n._disposeTaskEffect(u),n._releaseSignalNode(i),n._releaseSignalNode(o),{source:e,written:t,edge:s,consumer:r,counter:i,bumped:o}}function W(n,e){return()=>n.untrackedWithOwner(e)}function f(n){n.owner===void 0&&n.throwDisposed()}function w(n,e){const t=n._lifecycle;t.owner===void 0&&t.throwDisposed();const r=c;if(r!==void 0){r!==t&&t.throwCrossRuntime(r.owner);const i=a;i!==void 0&&i!==e&&t.assertDependencyAllowed(e,i);return}const s=n._activeSubscriberOwner();s!==void 0&&t.assertDependencyAllowed(e,s)}function g(){}exports.RuntimeReactivity=p;exports.RuntimeSignal=_;exports.SIGNAL_INDEX_LIMIT=m;