@raphy-js/raph 1.0.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/LICENSE +202 -0
  2. package/ReadMe.md +153 -0
  3. package/dist/api/Raph.d.ts +228 -0
  4. package/dist/api/errors.d.ts +20 -0
  5. package/dist/api/public.d.ts +22 -0
  6. package/dist/api/types.d.ts +25 -0
  7. package/dist/debug/api/Raph.cjs +1 -0
  8. package/dist/debug/api/Raph.js +419 -0
  9. package/dist/debug/api/errors.cjs +1 -0
  10. package/dist/debug/api/errors.js +14 -0
  11. package/dist/debug/api/public.cjs +1 -0
  12. package/dist/debug/api/public.js +40 -0
  13. package/dist/debug/api/types.cjs +1 -0
  14. package/dist/debug/api/types.js +1 -0
  15. package/dist/debug/path/AdapterPathStore.cjs +1 -0
  16. package/dist/debug/path/AdapterPathStore.js +133 -0
  17. package/dist/debug/path/DerivedRegistry.cjs +1 -0
  18. package/dist/debug/path/DerivedRegistry.js +157 -0
  19. package/dist/debug/path/MetaController.cjs +1 -0
  20. package/dist/debug/path/MetaController.js +214 -0
  21. package/dist/debug/path/PathEventHub.cjs +1 -0
  22. package/dist/debug/path/PathEventHub.js +148 -0
  23. package/dist/debug/path/PathStore.cjs +1 -0
  24. package/dist/debug/path/PathStore.js +326 -0
  25. package/dist/debug/path/RaphDerivedHandle.cjs +1 -0
  26. package/dist/debug/path/RaphDerivedHandle.js +125 -0
  27. package/dist/debug/path/RaphKernel.cjs +1 -0
  28. package/dist/debug/path/RaphKernel.js +636 -0
  29. package/dist/debug/path/RaphMeta.cjs +1 -0
  30. package/dist/debug/path/RaphMeta.js +68 -0
  31. package/dist/debug/path/RaphMetaStore.cjs +1 -0
  32. package/dist/debug/path/RaphMetaStore.js +184 -0
  33. package/dist/debug/path/data-adapter.cjs +1 -0
  34. package/dist/debug/path/data-adapter.js +356 -0
  35. package/dist/debug/path/data-draft.cjs +1 -0
  36. package/dist/debug/path/data-draft.js +71 -0
  37. package/dist/debug/path/data-path.cjs +1 -0
  38. package/dist/debug/path/data-path.js +423 -0
  39. package/dist/debug/path/derived-collection.cjs +1 -0
  40. package/dist/debug/path/derived-collection.js +179 -0
  41. package/dist/debug/path/derived-strategies.cjs +1 -0
  42. package/dist/debug/path/derived-strategies.js +20 -0
  43. package/dist/debug/path/meta.types.cjs +1 -0
  44. package/dist/debug/path/meta.types.js +1 -0
  45. package/dist/debug/path/path-router.cjs +1 -0
  46. package/dist/debug/path/path-router.js +86 -0
  47. package/dist/debug/path/path.types.cjs +1 -0
  48. package/dist/debug/path/path.types.js +1 -0
  49. package/dist/debug/path/public.cjs +1 -0
  50. package/dist/debug/path/public.js +18 -0
  51. package/dist/debug/path/segment-key.cjs +1 -0
  52. package/dist/debug/path/segment-key.js +12 -0
  53. package/dist/debug/reactivity/engine.cjs +1 -0
  54. package/dist/debug/reactivity/engine.js +1133 -0
  55. package/dist/debug/reactivity/scope.cjs +1 -0
  56. package/dist/debug/reactivity/scope.js +274 -0
  57. package/dist/debug/reactivity/types.cjs +1 -0
  58. package/dist/debug/reactivity/types.js +1 -0
  59. package/dist/debug/reactivity/watch.cjs +1 -0
  60. package/dist/debug/reactivity/watch.js +64 -0
  61. package/dist/debug/runtime/PathHandle.cjs +1 -0
  62. package/dist/debug/runtime/PathHandle.js +139 -0
  63. package/dist/debug/runtime/RaphDebug.cjs +1 -0
  64. package/dist/debug/runtime/RaphDebug.js +15 -0
  65. package/dist/debug/runtime/RaphFrameLoop.cjs +1 -0
  66. package/dist/debug/runtime/RaphFrameLoop.js +106 -0
  67. package/dist/debug/runtime/RaphNode.cjs +1 -0
  68. package/dist/debug/runtime/RaphNode.js +143 -0
  69. package/dist/debug/runtime/RaphPhasePipeline.cjs +1 -0
  70. package/dist/debug/runtime/RaphPhasePipeline.js +526 -0
  71. package/dist/debug/runtime/RaphRuntime.cjs +1 -0
  72. package/dist/debug/runtime/RaphRuntime.js +700 -0
  73. package/dist/debug/runtime/RaphScope.cjs +1 -0
  74. package/dist/debug/runtime/RaphScope.js +64 -0
  75. package/dist/debug/runtime/RuntimeReactivity.cjs +1 -0
  76. package/dist/debug/runtime/RuntimeReactivity.js +154 -0
  77. package/dist/debug/runtime/RuntimeWatch.cjs +1 -0
  78. package/dist/debug/runtime/RuntimeWatch.js +71 -0
  79. package/dist/debug/runtime/disposal.cjs +1 -0
  80. package/dist/debug/runtime/disposal.js +9 -0
  81. package/dist/debug/runtime/errors.cjs +1 -0
  82. package/dist/debug/runtime/errors.js +12 -0
  83. package/dist/debug/runtime/parent-graph.cjs +1 -0
  84. package/dist/debug/runtime/parent-graph.js +10 -0
  85. package/dist/debug/runtime/phase.types.cjs +1 -0
  86. package/dist/debug/runtime/phase.types.js +8 -0
  87. package/dist/debug/runtime/public.cjs +1 -0
  88. package/dist/debug/runtime/public.js +18 -0
  89. package/dist/debug/runtime/runtime-reactivity.types.cjs +1 -0
  90. package/dist/debug/runtime/runtime-reactivity.types.js +1 -0
  91. package/dist/index.cjs +1 -0
  92. package/dist/index.js +40 -0
  93. package/dist/path/AdapterPathStore.d.ts +45 -0
  94. package/dist/path/DerivedRegistry.d.ts +67 -0
  95. package/dist/path/MetaController.d.ts +85 -0
  96. package/dist/path/PathEventHub.d.ts +48 -0
  97. package/dist/path/PathStore.d.ts +51 -0
  98. package/dist/path/RaphDerivedHandle.d.ts +97 -0
  99. package/dist/path/RaphKernel.d.ts +166 -0
  100. package/dist/path/RaphMeta.d.ts +45 -0
  101. package/dist/path/RaphMetaStore.d.ts +45 -0
  102. package/dist/path/data-adapter.d.ts +78 -0
  103. package/dist/path/data-draft.d.ts +4 -0
  104. package/dist/path/data-path.d.ts +97 -0
  105. package/dist/path/derived-collection.d.ts +30 -0
  106. package/dist/path/derived-strategies.d.ts +15 -0
  107. package/dist/path/meta.types.d.ts +33 -0
  108. package/dist/path/path-router.d.ts +21 -0
  109. package/dist/path/path.types.d.ts +26 -0
  110. package/dist/path/public.d.ts +14 -0
  111. package/dist/path/segment-key.d.ts +2 -0
  112. package/dist/path.cjs +1 -0
  113. package/dist/path.js +18 -0
  114. package/dist/raph.cjs +1 -0
  115. package/dist/raph.js +40 -0
  116. package/dist/reactivity/engine.d.ts +379 -0
  117. package/dist/reactivity/scope.d.ts +146 -0
  118. package/dist/reactivity/types.d.ts +150 -0
  119. package/dist/reactivity/watch.d.ts +15 -0
  120. package/dist/reactivity.cjs +1 -0
  121. package/dist/reactivity.js +14 -0
  122. package/dist/runtime/PathHandle.d.ts +72 -0
  123. package/dist/runtime/RaphDebug.d.ts +32 -0
  124. package/dist/runtime/RaphFrameLoop.d.ts +51 -0
  125. package/dist/runtime/RaphNode.d.ts +68 -0
  126. package/dist/runtime/RaphPhasePipeline.d.ts +133 -0
  127. package/dist/runtime/RaphRuntime.d.ts +285 -0
  128. package/dist/runtime/RaphScope.d.ts +50 -0
  129. package/dist/runtime/RuntimeReactivity.d.ts +40 -0
  130. package/dist/runtime/RuntimeWatch.d.ts +28 -0
  131. package/dist/runtime/disposal.d.ts +1 -0
  132. package/dist/runtime/errors.d.ts +16 -0
  133. package/dist/runtime/parent-graph.d.ts +5 -0
  134. package/dist/runtime/phase.types.d.ts +49 -0
  135. package/dist/runtime/public.d.ts +13 -0
  136. package/dist/runtime/runtime-reactivity.types.d.ts +9 -0
  137. package/dist/runtime.cjs +1 -0
  138. package/dist/runtime.js +18 -0
  139. package/package.json +109 -0
@@ -0,0 +1 @@
1
+ "use strict";var q=Object.defineProperty;var P=(h,e,t)=>e in h?q(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t;var a=(h,e,t)=>P(h,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./errors.cjs"),T=require("./parent-graph.cjs"),E=require("./PathHandle.cjs"),d=require("./phase.types.cjs"),m=require("./RaphNode.cjs"),k=require("../path/data-path.cjs"),W=require("../path/RaphKernel.cjs"),L=require("../path/RaphMeta.cjs"),x=require("../reactivity/watch.cjs"),S=require("./disposal.cjs"),y=require("./RaphDebug.cjs"),O=require("./RaphFrameLoop.cjs"),M=require("./RaphPhasePipeline.cjs"),b=require("./RaphScope.cjs"),H=require("./RuntimeReactivity.cjs"),v=require("./RuntimeWatch.cjs"),R=class R{constructor(e={}){a(this,"configuration");a(this,"rootScope");a(this,"root");a(this,"_reactivity");a(this,"_signalLifecycle");a(this,"_pathHandles");a(this,"_meta");a(this,"_phases");a(this,"_frameLoop");a(this,"_frameRevision");a(this,"_frameRevisionValue",!1);a(this,"_debug");a(this,"_parentGraph");a(this,"_owners",new Set);a(this,"_transactionDepth",0);a(this,"_mutationDepth",0);a(this,"_kernelTransactionDepth",0);a(this,"_actionDepth",0);a(this,"_executionRequested",!1);a(this,"_disposed",!1);a(this,"_disposedListeners",new Set);const t=e.id??`runtime-${R._runtimeCounter++}`,s=e.enforceActions??!1,r=e.scheduler??d.RaphSchedulerType.Sync;if(!F(r))throw new Error(`[Raph] Unsupported scheduler "${String(r)}".`);const i=e.kernel??new W.RaphKernel({id:`${t}-kernel`});this.configuration=Object.freeze({id:t,kernel:i,enforceActions:s,scheduler:r});const o=`[Raph] Runtime "${t}" is disposed.`;this._signalLifecycle={owner:this,runWrite:n=>this._runWrite(n),...s?{assertWriteAllowed:()=>this._assertWriteAllowed()}:{},throwDisposed:()=>{throw new w.RaphDisposedError(o)},throwCrossRuntime:n=>this._throwCrossRuntime(n)},this._reactivity=new H.RuntimeReactivity(this._signalLifecycle),i._attachRuntime(this),this.rootScope=new b.RaphScope(`${t}:root-scope`,this),this.root=new m.RaphNode(null,{id:`${t}:root`},this)}_getReactivity(){return this._reactivity}get id(){return this.configuration.id}get kernel(){return this.configuration.kernel}get meta(){return this._assertAlive(),this._meta??(this._meta=new L.RaphMeta(this.kernel,{assertReadable:()=>this._assertAlive(),assertWritable:()=>this._assertWriteAllowed(),runWrite:(e,t)=>this._runWrite(e,t),watch:(e,t,s)=>this._own(this._watchMeta(e,t,s),this.rootScope)}))}get disposed(){return this._disposed}get graph(){return this._parentGraph??(this._parentGraph=T.parentGraph())}get loopEnabled(){var e;return((e=this._frameLoop)==null?void 0:e.running)??!1}get frame(){var e;return((e=this._phases)==null?void 0:e.frame)??{now:0,delta:0,elapsed:0,frame:0}}get phases(){var e;return((e=this._phases)==null?void 0:e.phases)??[]}getDerivedSnapshot(){return this.kernel.getDerivedSnapshot()}get debug(){return this._debug??(this._debug=Object.freeze({snapshot:()=>this._createDebugSnapshot(),getTree:()=>y.createOwnerSnapshot(this.root)}))}signal(e,t=this.rootScope){return this._assertOwnerRuntime(t),this._reactivity.signalForOwner(e,t)}computed(e,t=this.rootScope){this._assertOwnerRuntime(t);const s=typeof e=="function"?e:e.get,r=this._reactivity.computedForOwner(()=>this._runTracked(s),t);return typeof e=="function"?r:this._attachWritableComputed(r,e.set,t)}effect(e,t,s={},r=this.rootScope){const i=typeof e=="string"?t:e,o=typeof e=="string"?r:t??this.rootScope;if(this._assertOwnerRuntime(o),typeof e=="string"){const n=e.trim(),c=this._execution;c.requirePhase(n);const p=s.priority??0,_=s.initial??"scheduled";if(!Number.isFinite(p))throw new TypeError("[Raph] Effect priority must be finite.");if(_!=="scheduled"&&_!=="sync")throw new TypeError(`[Raph] Unsupported effect initial mode "${String(_)}".`);_==="sync"&&c.lockConfiguration();const l=c.phaseMode(n)==="always"?this._frameRevision??(this._frameRevision=this._reactivity.signal(!1)):void 0,g=this._reactivity.withEffectBinding(u=>c.bindEffect(n,p,u,o instanceof m.RaphNode?o:void 0),_,()=>this._reactivity.effect(()=>(l==null||l.get(),this._runTracked(i))));return this._own(g,o)}return this._own(this._reactivity._effectImmediate(()=>this._runTracked(i)),o)}watch(e,t,s={},r=this.rootScope){return this._assertOwnerRuntime(r),$(e)?this._own(this._watchPath(e,t),r):this._own(x.watchWithReactivity(this._reactivity._effectImmediate,this._reactivity.untracked,e,t,s,i=>this._runTracked(i)),r)}path(e,t={}){this._assertAlive();const s=k.parseDataPath(e,t),r=this._pathHandles??(this._pathHandles=new Map),i=r.get(s.canonical);if(i!==void 0)return i;const o=new E.PathHandle(this.kernel,s,t,n=>this._releasePathHandle(n),this._reactivity,()=>this._assertAlive(),()=>this._assertTrackedRead(),this.configuration.enforceActions?()=>this._assertWriteAllowed():void 0,n=>this._runWrite(n));return r.set(s.canonical,o),o}get(e,t){this._assertTrackedRead();const s=e??"";return this._reactivity._isTracking()?this.path(s,t)._getTracked():this.kernel.get(s,t)}peek(e,t){return this._assertAlive(),this.kernel.peek(e??"",t)}has(e,t){return this._assertAlive(),this.kernel.has(e,t)}set(e,t,s){this._assertWriteAllowed(),this._runWrite(()=>this.kernel.set(e,t,s))}merge(e,t,s){this._assertWriteAllowed(),this._runWrite(()=>this.kernel.merge(e,t,s))}delete(e,t){this._assertWriteAllowed(),this._runWrite(()=>this.kernel.delete(e,t))}transaction(e){this._assertAlive(),this._transactionDepth++;try{return this._reactivity.batch(()=>this.kernel.transaction(e))}finally{this._transactionDepth--,this._requestExecution()}}action(e,t,s=this.rootScope){if(this._assertOwnerRuntime(s),!e.trim())throw new Error("[Raph] Action name must not be empty.");return(...r)=>(s._assertAlive(),this.runInAction(e,()=>t(...r)))}runInAction(e,t){this._assertAlive(),this._actionDepth++;try{return this.transaction(()=>this._runUntracked(t))}finally{this._actionDepth--}}untracked(e){return this._assertAlive(),this._reactivity.untrackedWithOwner(e)}scope(e){return this._assertAlive(),new b.RaphScope(e,this)}node(e,t){this._assertAlive();const s=e.parent??this.root,r=new m.RaphNode(s,e,this);try{return r._setApi(t(r)),r}catch(i){try{r.dispose()}catch(o){throw new AggregateError([i,o],`[Raph] Node "${r.id}" setup and cleanup failed.`)}throw i}}getNode(e){this._assertAlive();const t=[this.root];for(;t.length!==0;){const s=t.pop();if(s.id===e)return s;t.push(...s.children)}}definePhases(e){this._execution.definePhases(e)}addPhase(e){this._execution.addPhase(e)}clearPhases(){var e;this._assertAlive(),(e=this._phases)==null||e.clearPhases()}observeData(e,t,s){return this._assertOwnerRuntime(e),this._own(this._execution.observeData(e,t,s),e)}track(e,t,s={}){return this._assertOwnerRuntime(e),this._own(this._execution.track(e,t,s),e)}invalidateNode(e,t){this._assertOwnerRuntime(e),this._execution.invalidate(e,t)}flush(){var e;this._assertAlive(),this._executionRequested=!1,(e=this._phases)==null||e.flush()}acquireLoop(e){return this._assertAlive(),this._clock.acquire(e)}startLoop(){this._assertAlive(),this._clock.start()}stopLoop(){var e;(e=this._frameLoop)==null||e.stop()}derive(e){this._assertAlive();const t=e.compute,s=this.kernel.derive({...e,compute:r=>this._runUntracked(()=>t(r))});return this._own(()=>s.dispose(),this.rootScope),s}dispose(){var i,o;if(this._disposed)return;this._disposed=!0,this._executionRequested=!1,this._signalLifecycle.owner=void 0;const e=[],t=[...this._owners];try{(i=this._frameLoop)==null||i.dispose()}catch(n){e.push(n)}this._frameLoop=void 0;try{(o=this._phases)==null||o.dispose()}catch(n){e.push(n)}this._phases=void 0;try{this.root.dispose()}catch(n){e.push(n)}for(const n of t.reverse())if(!(n===this.root||n===this.rootScope||n.disposed))try{n.dispose()}catch(c){e.push(c)}try{this.rootScope.dispose()}catch(n){e.push(n)}this._owners.clear(),this._meta=void 0,this._frameRevision=void 0;const s=this._pathHandles;if(this._pathHandles=void 0,s!==void 0){for(const n of s.values())try{n.dispose()}catch(c){e.push(c)}s.clear()}try{this.kernel._detachRuntime(this)}catch(n){e.push(n)}const r=[...this._disposedListeners];this._disposedListeners.clear();for(const n of r)try{n()}catch(c){e.push(c)}S.throwDisposalErrors(e,`[Raph] Runtime "${this.id}" disposal failed.`)}_onDisposed(e){return this._disposed?(e(),()=>{}):(this._disposedListeners.add(e),()=>{this._disposedListeners.delete(e)})}_watchPath(e,t){const s=new v.RuntimeWatch(i=>this._runUntracked(i)),r=this.kernel.watch(e,i=>{s.deliver(()=>t(i))});return()=>s.stop(r)}_createDebugSnapshot(){var s,r,i;const e=((s=this._frameLoop)==null?void 0:s._debugState())??{running:!1,manual:!1,leases:0},t=[...this._owners].filter(o=>o!==this.rootScope&&!(o instanceof m.RaphNode)).map(y.createOwnerSnapshot);return Object.freeze({id:this.id,disposed:this._disposed,pending:!this._disposed&&(this._executionRequested||(((r=this._phases)==null?void 0:r._debugPending())??!1)),transactionDepth:this._transactionDepth,kernelTransactionDepth:this._kernelTransactionDepth,owners:this._owners.size,pathHandles:((i=this._pathHandles)==null?void 0:i.size)??0,rootScope:y.createOwnerSnapshot(this.rootScope),scopes:Object.freeze(t),root:y.createOwnerSnapshot(this.root),frameLoop:Object.freeze(e)})}_watchMeta(e,t,s){if(s.phase!==void 0)return this._watchMetaInPhase(e,t,s);if(s.priority!==void 0)throw new TypeError("[RaphMeta] watch priority requires a phase.");const r=new v.RuntimeWatch(o=>this._runUntracked(o)),i=this.kernel._watchMeta(e,o=>{r.deliver(()=>t(o))},s);return()=>r.stop(i)}_watchMetaInPhase(e,t,s){const r=s.phase.trim(),i=this._execution;i.requirePhase(r);const o=s.priority??0;if(!Number.isFinite(o))throw new TypeError("[RaphMeta] watch priority must be finite.");const n=i.retainPhase(r),c=new v.RuntimeWatch(u=>this._runUntracked(u));let p=[],_;const l=()=>{_=void 0;const u=p;p=[],c.deliver(()=>t({events:u}))};let g;try{g=this.kernel._watchMeta(e,({events:u})=>{c.stopped||(p.push(...u),_===void 0&&(_=i.queueEffect(r,o,l,!1)))},s,u=>{!c.stopped&&u&&_!==void 0&&i.request()})}catch(u){throw n(),u}return()=>{if(c.stopped)return;const u=[];try{c.stop(g)}catch(f){u.push(f)}try{_==null||_()}catch(f){u.push(f)}try{n()}catch(f){u.push(f)}_=void 0,p=[],S.throwDisposalErrors(u,"[RaphMeta] Phase watch disposal failed.")}}_releasePathHandle(e){const t=this._pathHandles;(t==null?void 0:t.get(e.path))===e&&(t.delete(e.path),t.size===0&&(this._pathHandles=void 0))}get _execution(){return this._assertAlive(),this._phases??(this._phases=new M.RaphPhasePipeline(this.kernel,this.root,this.configuration.scheduler,e=>this._runUntracked(e),()=>{const e=this._mutationDepth!==0||this._transactionDepth!==0||this._kernelTransactionDepth!==0||this._reactivity._isFlushingEffects();return e&&this.configuration.scheduler===d.RaphSchedulerType.Sync&&(this._executionRequested=!0),e}))}get _clock(){return this._frameLoop??(this._frameLoop=new O.RaphFrameLoop(()=>this._tickFrameLoop()))}_tickFrameLoop(){var e;this._disposed||(this._frameRevision!==void 0&&(this._frameRevisionValue=!this._frameRevisionValue,this._frameRevision.set(this._frameRevisionValue)),(e=this._phases)==null||e.requestAlwaysPhases(),this._requestExecution())}_attachWritableComputed(e,t,s){let r=t;this._own(()=>{r=void 0},s);const i=e;return i.set=o=>{s._assertAlive(),this._assertWriteAllowed(),r(o)},i}_own(e,t){try{return t._adoptResource(e)}catch(s){try{e()}catch(r){throw new AggregateError([s,r],"[Raph] Resource registration and cleanup failed.")}throw s}}_registerOwner(e){this._assertAlive(),this._owners.add(e)}_unregisterOwner(e){this._owners.delete(e)}_assertOwnerRuntime(e){if(this._assertAlive(),e.runtime!==this)throw new w.RaphCrossRuntimeError("[Raph] Owner belongs to another runtime.");e._assertAlive()}_runTracked(e){return this._reactivity.runWithOwner(this._signalLifecycle,e)}_runUntracked(e){return this._reactivity.untrackedWithOwner(e)}_runWrite(e,t=!0){t&&this.configuration.scheduler===d.RaphSchedulerType.Sync&&(this._executionRequested=!0),this._mutationDepth++;try{return e()}finally{this._mutationDepth--,this._requestExecution()}}_requestExecution(){var e;this.configuration.scheduler!==d.RaphSchedulerType.Sync||this._mutationDepth!==0||this._transactionDepth!==0||this._kernelTransactionDepth!==0||this._reactivity._isFlushingEffects()||this._executionRequested&&(this._executionRequested=!1,(e=this._phases)==null||e.flush())}_beginKernelTransaction(){this._disposed||this._kernelTransactionDepth++}_endKernelTransaction(){this._kernelTransactionDepth!==0&&(this._kernelTransactionDepth--,this._disposed||this._requestExecution())}_assertTrackedRead(){this._assertAlive();const e=this._reactivity.getActiveOwner();e!==void 0&&e!==this&&this._throwCrossRuntime(e)}_assertWriteAllowed(){if(this._assertAlive(),this.configuration.enforceActions&&this._actionDepth===0&&this._transactionDepth===0)throw new w.RaphActionError("[Raph] Writes are allowed only inside action() or transaction().")}_throwCrossRuntime(e){throw new w.RaphCrossRuntimeError(`[Raph] Runtime "${this.id}" cannot be tracked by runtime "${e.id}".`)}_throwDisposed(){throw new w.RaphDisposedError(`[Raph] Runtime "${this.id}" is disposed.`)}_assertAlive(){this._disposed&&this._throwDisposed()}};a(R,"_runtimeCounter",0);let A=R;function $(h){return typeof h=="string"||h instanceof k.DataPath||D(h)?!0:Array.isArray(h)&&h.every(e=>typeof e=="string"||e instanceof k.DataPath||D(e))}function D(h){return typeof h=="object"&&h!==null&&"segs"in h&&h.segs!==void 0&&Array.isArray(h.segs)}function F(h){return h===d.RaphSchedulerType.Sync||h===d.RaphSchedulerType.Microtask||h===d.RaphSchedulerType.AnimationFrame}exports.RaphRuntime=A;