@graphrefly/graphrefly 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/{chunk-PYEIPRSZ.js → chunk-2C4NESZE.js} +1 -1
  2. package/dist/{chunk-44QWWUA3.js → chunk-4EATTNAE.js} +1 -1
  3. package/dist/{chunk-5RTZ6DXG.js → chunk-6SVKZ7VI.js} +1 -1
  4. package/dist/chunk-B4L5X2QO.js +7 -0
  5. package/dist/{chunk-TQSTS3BY.js → chunk-C5CBVOCB.js} +1 -1
  6. package/dist/{chunk-J6TGRQUP.js → chunk-CZIQ6JCE.js} +1 -1
  7. package/dist/chunk-FJ6IEMOS.js +1 -0
  8. package/dist/{chunk-5Z3AFBN7.js → chunk-FMI4CWFL.js} +1 -1
  9. package/dist/{chunk-DBPFMCVH.js → chunk-G6Q3DUMJ.js} +1 -1
  10. package/dist/{chunk-3U7IIQB2.js → chunk-GDDPCDLG.js} +1 -1
  11. package/dist/{chunk-5CZ3KIRJ.js → chunk-GFOT6UBB.js} +1 -1
  12. package/dist/{chunk-KL7CILPL.js → chunk-K2WYIVHM.js} +1 -1
  13. package/dist/{chunk-I57VSGRB.js → chunk-K6ZFJ473.js} +1 -1
  14. package/dist/{chunk-YBA5N4XY.js → chunk-KTWBUJO5.js} +1 -1
  15. package/dist/{chunk-7LYIKMW5.js → chunk-LOQRPP4Y.js} +1 -1
  16. package/dist/{chunk-KCE6WWJE.js → chunk-MC5LZG3U.js} +1 -1
  17. package/dist/{chunk-N2GCKKKH.js → chunk-NKKUUKPD.js} +1 -1
  18. package/dist/{chunk-GWOKTENT.js → chunk-QKBCTKH7.js} +1 -1
  19. package/dist/{chunk-YOUAVGHJ.js → chunk-QP5TH523.js} +1 -1
  20. package/dist/{chunk-T6RPUERH.js → chunk-QWVQIL3T.js} +1 -1
  21. package/dist/{chunk-6G5YD37E.js → chunk-T4U24DXX.js} +1 -1
  22. package/dist/{chunk-AACJX2L7.js → chunk-TFK4P4CX.js} +1 -1
  23. package/dist/{chunk-K5ZXJPWU.js → chunk-TLS7M7H4.js} +1 -1
  24. package/dist/{chunk-AQC53OWG.js → chunk-U3COB5WU.js} +1 -1
  25. package/dist/{chunk-F36TA3ET.js → chunk-UODQF4EY.js} +1 -1
  26. package/dist/{chunk-QKUWS7CO.js → chunk-WGST56ZH.js} +1 -1
  27. package/dist/{chunk-XINLP35X.js → chunk-WSLN4JFO.js} +1 -1
  28. package/dist/{chunk-LO3LO2TO.js → chunk-XIJKEXWR.js} +1 -1
  29. package/dist/{chunk-JUJEPZOI.js → chunk-YVYSO5CW.js} +1 -1
  30. package/dist/compat/index.cjs +9 -9
  31. package/dist/compat/index.d.cts +5 -5
  32. package/dist/compat/index.d.ts +5 -5
  33. package/dist/compat/index.js +1 -1
  34. package/dist/compat/nestjs/index.cjs +11 -11
  35. package/dist/compat/nestjs/index.d.cts +3 -3
  36. package/dist/compat/nestjs/index.d.ts +3 -3
  37. package/dist/compat/nestjs/index.js +1 -1
  38. package/dist/compat/zustand/index.cjs +7 -7
  39. package/dist/compat/zustand/index.d.cts +2 -2
  40. package/dist/compat/zustand/index.d.ts +2 -2
  41. package/dist/compat/zustand/index.js +1 -1
  42. package/dist/extra/index.cjs +15 -15
  43. package/dist/extra/index.d.cts +2 -2
  44. package/dist/extra/index.d.ts +2 -2
  45. package/dist/extra/index.js +1 -1
  46. package/dist/graph/index.cjs +7 -7
  47. package/dist/graph/index.d.cts +3 -3
  48. package/dist/graph/index.d.ts +3 -3
  49. package/dist/graph/index.js +1 -1
  50. package/dist/{graph-kTltt95s.d.cts → graph-CaNXUc3c.d.cts} +26 -1
  51. package/dist/{graph-Cv-8x0ZI.d.ts → graph-YQXDndFy.d.ts} +26 -1
  52. package/dist/{index-CVhBdCMf.d.ts → index-0qOD-421.d.ts} +2 -2
  53. package/dist/{index-BC-xjOrd.d.cts → index-4IwO4mH2.d.cts} +5 -5
  54. package/dist/{index-kBUQj-rT.d.ts → index-9mbs_PIG.d.ts} +1 -1
  55. package/dist/{index-DSSsxS7B.d.ts → index-Ae6L8liv.d.ts} +2 -2
  56. package/dist/{index-BhkPzu-Z.d.cts → index-B1IcU--K.d.cts} +2 -2
  57. package/dist/{index-jA_OwwNg.d.ts → index-B46GWgk3.d.ts} +1 -1
  58. package/dist/{index-EfPb77rT.d.cts → index-B9qJmmv3.d.cts} +1 -1
  59. package/dist/{index-CI_yjtua.d.ts → index-BCq12BqB.d.ts} +1 -1
  60. package/dist/{index-2URa-V4S.d.cts → index-BECJ8M0T.d.cts} +1 -1
  61. package/dist/{index-DFe2Pk2u.d.ts → index-BOfHwQc1.d.ts} +1 -1
  62. package/dist/{index-BTJxM-wZ.d.ts → index-BhLA9feT.d.ts} +1 -1
  63. package/dist/{index-Pu1Wa7en.d.ts → index-BmLkcDlj.d.ts} +5 -5
  64. package/dist/{index-XxSeddWP.d.cts → index-BokynmA4.d.cts} +1 -1
  65. package/dist/{index-DtSVSKnd.d.ts → index-Bpzw8hx3.d.ts} +1 -1
  66. package/dist/{index-PluovH45.d.cts → index-BwtIbzSV.d.cts} +2 -2
  67. package/dist/{index-BZ1V5GzX.d.ts → index-C-pFD_FV.d.ts} +2 -2
  68. package/dist/{index-Cot94_82.d.ts → index-C0tga1_x.d.ts} +2 -2
  69. package/dist/{index-BlRVj-7Q.d.cts → index-C4N-dg5U.d.cts} +2 -2
  70. package/dist/{index-B4s70vYf.d.ts → index-CKcnuQ2c.d.ts} +2 -2
  71. package/dist/{index-HCp5ua_i.d.cts → index-CLPQyYY5.d.cts} +3 -3
  72. package/dist/{index-BuMzxRO2.d.ts → index-CRycrNfn.d.ts} +1 -1
  73. package/dist/{index-CvUrRb4m.d.cts → index-CU3z8Cel.d.cts} +2 -2
  74. package/dist/{index-CZAixNU3.d.ts → index-CUTHDZ7Q.d.ts} +3 -3
  75. package/dist/{index-DzCQt2FJ.d.cts → index-C_qi0WlF.d.cts} +1 -1
  76. package/dist/{index-BBdwz2BW.d.ts → index-CajEOoAN.d.ts} +2 -2
  77. package/dist/{index-BVNGEX7d.d.cts → index-Ci358GSC.d.cts} +2 -2
  78. package/dist/{index-DHv2M7s8.d.cts → index-CkN8CZlT.d.cts} +5 -5
  79. package/dist/{index-ZhKyR8co.d.cts → index-CrpjECS6.d.cts} +2 -2
  80. package/dist/{index-isdlyeeO.d.ts → index-CzIWlnPp.d.ts} +5 -5
  81. package/dist/{index-DxxvGTXp.d.ts → index-D0ZxFXYl.d.ts} +1 -1
  82. package/dist/{index-k67aNfqC.d.cts → index-D11pGlaI.d.cts} +2 -2
  83. package/dist/{index-DlccEIi3.d.ts → index-D1E1tqHT.d.ts} +1 -1
  84. package/dist/{index-Cjrpx2Mg.d.cts → index-D6pwWiOc.d.cts} +1 -1
  85. package/dist/{index-BsZlbHM5.d.cts → index-D6tRNEKz.d.cts} +1 -1
  86. package/dist/{index-33mF4XyU.d.cts → index-DAKm44My.d.cts} +1 -1
  87. package/dist/{index-BWH17rK_.d.cts → index-DCAuN9u5.d.cts} +1 -1
  88. package/dist/{index-CsD0fqnO.d.ts → index-DPqR3wdW.d.ts} +2 -2
  89. package/dist/{index-GaW6Welt.d.cts → index-DTYIRT_v.d.cts} +2 -2
  90. package/dist/{index-DXSLMoma.d.ts → index-DXz9uwcs.d.ts} +1 -1
  91. package/dist/{index-DmtWMP0X.d.cts → index-D_DThl_J.d.cts} +1 -1
  92. package/dist/{index-BwYGLgmI.d.ts → index-D_d1erkR.d.ts} +2 -2
  93. package/dist/{index-D9qoEOj_.d.cts → index-DbWwMWiB.d.cts} +1 -1
  94. package/dist/{index-C4ig7whw.d.cts → index-DcWbx58m.d.cts} +2 -2
  95. package/dist/{index-DzYTXMBz.d.ts → index-DfAo9WKr.d.ts} +1 -1
  96. package/dist/{index-RJIY7QVW.d.cts → index-DqtXA3yX.d.cts} +1 -1
  97. package/dist/{index-KeBhbNg3.d.ts → index-DuhOdNyg.d.ts} +1 -1
  98. package/dist/{index-DKp1CIbG.d.cts → index-e1m3ZHgc.d.cts} +1 -1
  99. package/dist/{index-DLyQC5Ww.d.ts → index-fHKHdAso.d.ts} +2 -2
  100. package/dist/index.cjs +41 -41
  101. package/dist/index.d.cts +28 -28
  102. package/dist/index.d.ts +28 -28
  103. package/dist/index.js +1 -1
  104. package/dist/patterns/ai/index.cjs +19 -19
  105. package/dist/patterns/ai/index.d.cts +6 -6
  106. package/dist/patterns/ai/index.d.ts +6 -6
  107. package/dist/patterns/ai/index.js +1 -1
  108. package/dist/patterns/audit/index.cjs +7 -7
  109. package/dist/patterns/audit/index.d.cts +3 -3
  110. package/dist/patterns/audit/index.d.ts +3 -3
  111. package/dist/patterns/audit/index.js +1 -1
  112. package/dist/patterns/cqrs/index.cjs +7 -7
  113. package/dist/patterns/cqrs/index.d.cts +2 -2
  114. package/dist/patterns/cqrs/index.d.ts +2 -2
  115. package/dist/patterns/cqrs/index.js +1 -1
  116. package/dist/patterns/demo-shell/index.cjs +8 -8
  117. package/dist/patterns/demo-shell/index.d.cts +3 -3
  118. package/dist/patterns/demo-shell/index.d.ts +3 -3
  119. package/dist/patterns/demo-shell/index.js +1 -1
  120. package/dist/patterns/domain-templates/index.cjs +7 -7
  121. package/dist/patterns/domain-templates/index.d.cts +2 -2
  122. package/dist/patterns/domain-templates/index.d.ts +2 -2
  123. package/dist/patterns/domain-templates/index.js +1 -1
  124. package/dist/patterns/graphspec/index.cjs +17 -17
  125. package/dist/patterns/graphspec/index.d.cts +2 -2
  126. package/dist/patterns/graphspec/index.d.ts +2 -2
  127. package/dist/patterns/graphspec/index.js +1 -1
  128. package/dist/patterns/guarded-execution/index.cjs +7 -7
  129. package/dist/patterns/guarded-execution/index.d.cts +4 -4
  130. package/dist/patterns/guarded-execution/index.d.ts +4 -4
  131. package/dist/patterns/guarded-execution/index.js +1 -1
  132. package/dist/patterns/harness/index.cjs +10 -10
  133. package/dist/patterns/harness/index.d.cts +6 -6
  134. package/dist/patterns/harness/index.d.ts +6 -6
  135. package/dist/patterns/harness/index.js +1 -1
  136. package/dist/patterns/job-queue/index.cjs +7 -7
  137. package/dist/patterns/job-queue/index.d.cts +2 -2
  138. package/dist/patterns/job-queue/index.d.ts +2 -2
  139. package/dist/patterns/job-queue/index.js +1 -1
  140. package/dist/patterns/lens/index.cjs +7 -7
  141. package/dist/patterns/lens/index.d.cts +3 -3
  142. package/dist/patterns/lens/index.d.ts +3 -3
  143. package/dist/patterns/lens/index.js +1 -1
  144. package/dist/patterns/memory/index.cjs +7 -7
  145. package/dist/patterns/memory/index.d.cts +2 -2
  146. package/dist/patterns/memory/index.d.ts +2 -2
  147. package/dist/patterns/memory/index.js +1 -1
  148. package/dist/patterns/messaging/index.cjs +7 -7
  149. package/dist/patterns/messaging/index.d.cts +2 -2
  150. package/dist/patterns/messaging/index.d.ts +2 -2
  151. package/dist/patterns/messaging/index.js +1 -1
  152. package/dist/patterns/orchestration/index.cjs +7 -7
  153. package/dist/patterns/orchestration/index.d.cts +2 -2
  154. package/dist/patterns/orchestration/index.d.ts +2 -2
  155. package/dist/patterns/orchestration/index.js +1 -1
  156. package/dist/patterns/process/index.cjs +1 -1
  157. package/dist/patterns/process/index.d.cts +3 -3
  158. package/dist/patterns/process/index.d.ts +3 -3
  159. package/dist/patterns/process/index.js +1 -1
  160. package/dist/patterns/reactive-layout/index.cjs +8 -8
  161. package/dist/patterns/reactive-layout/index.d.cts +3 -3
  162. package/dist/patterns/reactive-layout/index.d.ts +3 -3
  163. package/dist/patterns/reactive-layout/index.js +1 -1
  164. package/dist/patterns/reduction/index.cjs +7 -7
  165. package/dist/patterns/reduction/index.d.cts +2 -2
  166. package/dist/patterns/reduction/index.d.ts +2 -2
  167. package/dist/patterns/reduction/index.js +1 -1
  168. package/dist/patterns/refine-loop/index.cjs +8 -8
  169. package/dist/patterns/refine-loop/index.d.cts +3 -3
  170. package/dist/patterns/refine-loop/index.d.ts +3 -3
  171. package/dist/patterns/refine-loop/index.js +1 -1
  172. package/dist/patterns/resilient-pipeline/index.d.cts +3 -3
  173. package/dist/patterns/resilient-pipeline/index.d.ts +3 -3
  174. package/dist/patterns/resilient-pipeline/index.js +1 -1
  175. package/dist/patterns/surface/index.cjs +10 -10
  176. package/dist/patterns/surface/index.d.cts +3 -3
  177. package/dist/patterns/surface/index.d.ts +3 -3
  178. package/dist/patterns/surface/index.js +1 -1
  179. package/dist/{pipeline-graph-BlLBWSZ2.d.cts → pipeline-graph-BrrYGjuZ.d.cts} +1 -1
  180. package/dist/{pipeline-graph-DdBoRu37.d.ts → pipeline-graph-DX2Twdj-.d.ts} +1 -1
  181. package/dist/{reactive-layout-Btv0-efV.d.ts → reactive-layout-BDdngW56.d.ts} +1 -1
  182. package/dist/{reactive-layout-D9zqqaqK.d.cts → reactive-layout-DrGjuwyC.d.cts} +1 -1
  183. package/dist/{topology-tree-CJsT24DP.d.ts → topology-tree-BI665P0L.d.ts} +1 -1
  184. package/dist/{topology-tree-C50l9ARE.d.cts → topology-tree-BkhmMg2a.d.cts} +1 -1
  185. package/package.json +1 -1
  186. package/dist/chunk-5KPIYVCC.js +0 -7
  187. package/dist/chunk-CGA5RXO6.js +0 -1
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j}from"../../chunk-K5ZXJPWU.js";import"../../chunk-QKUWS7CO.js";import"../../chunk-LO3LO2TO.js";import"../../chunk-O32GJOUJ.js";import"../../chunk-TZQPPQEQ.js";import"../../chunk-5KPIYVCC.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-533RQFF6.js";import"../../chunk-JJTF75VS.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-MQZWA3DF.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{e as SNAPSHOT_WIRE_VERSION,a as SurfaceError,b as asSurfaceError,c as createGraph,j as deleteSnapshot,h as diffSnapshots,i as listSnapshots,g as restoreSnapshot,d as runReduction,f as saveSnapshot};
1
+ import{a,b,c,d,e,f,g,h,i,j}from"../../chunk-TLS7M7H4.js";import"../../chunk-WGST56ZH.js";import"../../chunk-XIJKEXWR.js";import"../../chunk-O32GJOUJ.js";import"../../chunk-B4L5X2QO.js";import"../../chunk-SGS4OJGS.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-533RQFF6.js";import"../../chunk-JJTF75VS.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-TZQPPQEQ.js";import"../../chunk-MQZWA3DF.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{e as SNAPSHOT_WIRE_VERSION,a as SurfaceError,b as asSurfaceError,c as createGraph,j as deleteSnapshot,h as diffSnapshots,i as listSnapshots,g as restoreSnapshot,d as runReduction,f as saveSnapshot};
@@ -1,7 +1,7 @@
1
1
  import { a as Node, c as NodeActions } from './node-fSc-hCv8.cjs';
2
2
  import { D as DerivedFn } from './sugar-DgaGJcI6.cjs';
3
3
  import { R as ReactiveLogBundle } from './reactive-log-ScpWyqny.cjs';
4
- import { G as Graph, a as GraphOptions } from './graph-kTltt95s.cjs';
4
+ import { G as Graph, a as GraphOptions } from './graph-CaNXUc3c.cjs';
5
5
  import { B as BaseAuditRecord } from './imperative-audit-ahAE65a9.cjs';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { a as Node, c as NodeActions } from './node-fSc-hCv8.js';
2
2
  import { D as DerivedFn } from './sugar-D13E2M_z.js';
3
3
  import { R as ReactiveLogBundle } from './reactive-log-jirQsxMY.js';
4
- import { G as Graph, a as GraphOptions } from './graph-Cv-8x0ZI.js';
4
+ import { G as Graph, a as GraphOptions } from './graph-YQXDndFy.js';
5
5
  import { B as BaseAuditRecord } from './imperative-audit-ahAE65a9.js';
6
6
 
7
7
  /**
@@ -1,5 +1,5 @@
1
1
  import { a as Node } from './node-fSc-hCv8.js';
2
- import { G as Graph } from './graph-Cv-8x0ZI.js';
2
+ import { G as Graph } from './graph-YQXDndFy.js';
3
3
 
4
4
  /** Pluggable measurement backend. */
5
5
  interface MeasurementAdapter {
@@ -1,5 +1,5 @@
1
1
  import { a as Node } from './node-fSc-hCv8.cjs';
2
- import { G as Graph } from './graph-kTltt95s.cjs';
2
+ import { G as Graph } from './graph-CaNXUc3c.cjs';
3
3
 
4
4
  /** Pluggable measurement backend. */
5
5
  interface MeasurementAdapter {
@@ -1,4 +1,4 @@
1
- import { G as Graph, T as TopologyEvent } from './graph-Cv-8x0ZI.js';
1
+ import { G as Graph, T as TopologyEvent } from './graph-YQXDndFy.js';
2
2
 
3
3
  /**
4
4
  * Subscribe to structural changes across `graph` and every transitively
@@ -1,4 +1,4 @@
1
- import { G as Graph, T as TopologyEvent } from './graph-kTltt95s.cjs';
1
+ import { G as Graph, T as TopologyEvent } from './graph-CaNXUc3c.cjs';
2
2
 
3
3
  /**
4
4
  * Subscribe to structural changes across `graph` and every transitively
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphrefly/graphrefly",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319",
5
5
  "description": "Reactive harness layer for agent workflows. Describe automations in plain language, trace every decision, enforce policies, persist checkpoints. Zero dependencies.",
6
6
  "repository": {
@@ -1,7 +0,0 @@
1
- import{a as Se}from"./chunk-SGS4OJGS.js";import{a as Le}from"./chunk-ESMPEKEV.js";import{a as re,b as _e}from"./chunk-533RQFF6.js";import{C as Ee}from"./chunk-MQZWA3DF.js";import{A as we,C as L,E as ne,F as Me,G as Oe,e as $e,f as Te,i as Y,k as Ne,l as xe,m as Ae,o as K,p as Pe,s as W}from"./chunk-LYCLF26R.js";import{b as Q,c as me,d as be,e as Z,f as ye,g as ve,h as z,i as ee,j as te}from"./chunk-CK2E7BTU.js";function Ie(e,t,r,n={}){let o=t in e.nodes,s=r in e.nodes;if(!o)return se(t,r,"no-such-from");if(!s)return se(t,r,"no-such-to");let i=n.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(t===r){if(n.findCycle===!0){let u=lt(e,t,n);if(u!=null)return u}let l=oe(t,e.nodes[t],0,n);return ie(t,r,[l])}if(i===0)return se(t,r,"no-path");let a=je(e,t,r,i);return a.found?ie(t,r,Be(e,a.pathOrder,n)):se(t,r,a.truncated?"max-depth-exceeded":"no-path")}function je(e,t,r,n){let o=new Map,s=[{path:r,depth:0}],i=new Set([r]),a=0,l=!1;for(;a<s.length;){let h=s[a++];if(h.path===t)break;if(n!=null&&h.depth>=n){let g=e.nodes[h.path];g?.deps&&g.deps.length>0&&(l=!0);continue}let p=e.nodes[h.path];if(p==null)continue;let f=p.deps??[],c=new Map;for(let g=0;g<f.length;g++){let b=f[g];if(!b)continue;let v=c.get(b);v==null&&(v=[],c.set(b,v)),v.push(g)}for(let[g,b]of c)i.has(g)||(i.add(g),o.set(g,{from:h.path,depIndices:b}),s.push({path:g,depth:h.depth+1}))}if(!o.has(t))return{found:!1,pathOrder:[],truncated:l};let u=[{path:t}],d=t;for(;d!==r;){let h=o.get(d);if(h==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=h.depIndices,u.push({path:h.from}),d=h.from}return{found:!0,pathOrder:u,truncated:!1}}function lt(e,t,r){let n=e.nodes[t];if(n==null)return null;let o=n.deps??[],s=[];for(let a=0;a<o.length;a++)o[a]===t&&s.push(a);if(s.length>0){let a=oe(t,n,0,r);a.dep_index=s[0];let l=oe(t,n,1,r);return ie(t,t,[a,l])}let i=null;for(let a=0;a<o.length;a++){let l=o[a];if(!l||l===t)continue;let u=je(e,l,t,r.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:t,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:ie(t,t,Be(e,i.pathOrder,r))}function Be(e,t,r){return t.map((n,o)=>{let s=e.nodes[n.path],i=oe(n.path,s,o,r);return n.depIndices!=null&&n.depIndices.length>0&&(i.dep_index=n.depIndices[0],n.depIndices.length>1&&(i.dep_indices=[...n.depIndices])),i})}function oe(e,t,r,n){let o={path:e,type:t.type,hop:r};t.status!==void 0&&(o.status=t.status),"value"in t&&(o.value=t.value),t.v!=null&&(o.v=t.v);let s=n.annotations?.get(e)??t.annotation;s!=null&&(o.annotation=s);let i=n.lastMutations?.get(e)??t.lastMutation;return i!=null&&(o.lastMutation=i),o}function ie(e,t,r){return Fe(e,t,!0,"ok",r)}function se(e,t,r){return Fe(e,t,!1,r,[])}function Fe(e,t,r,n,o){let s=ct(e,t,r,n,o);return{from:e,to:t,found:r,reason:n,steps:o,text:s,toJSON(){return{from:e,to:t,found:r,reason:n,steps:o}}}}function ct(e,t,r,n,o){if(!r)switch(n){case"no-such-from":return`explainPath: no node named "${e}"`;case"no-such-to":return`explainPath: no node named "${t}"`;case"max-depth-exceeded":return`explainPath: no path from "${e}" to "${t}" within maxDepth`;default:return`explainPath: no path from "${e}" to "${t}"`}let s=[`Causal path: ${e} \u2192 ${t} (${o.length} step(s))`];for(let i of o){let l=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(s.push(l),"value"in i&&s.push(` value: ${dt(i.value)}`),i.annotation!=null&&s.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;s.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return s.join(`
2
- `)}function dt(e){if(e===void 0)return"<sentinel>";if(e===null)return"null";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{let t=JSON.stringify(e);return t.length>80?`${t.slice(0,77)}...`:t}catch{return String(e)}}var A={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},ft=Symbol.for("sizeof");function He(e){let t=new WeakSet,r=new WeakSet,n=[e],o=0;for(;n.length>0;){let s=n.pop();o+=pt(s,t,r,n)}return o}function pt(e,t,r,n){if(e==null)return 0;switch(typeof e){case"number":return A.number;case"boolean":return A.boolean;case"string":return A.string+e.length*2;case"bigint":return A.bigint+ht(e);case"symbol":return A.symbol;case"function":return t.has(e)?0:(t.add(e),A.function);case"undefined":return 0}let s=e;if(t.has(s))return 0;t.add(s);let i=s[ft];if(typeof i=="function")try{let u=i.call(s);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(s instanceof Date)return A.date;if(s instanceof RegExp)return A.regexp+s.source.length*2;if(s instanceof Error){let u=s.message?s.message.length*2:0,d=s.stack?s.stack.length*2:0;return A.error+u+d}if(typeof URL<"u"&&s instanceof URL)return A.url+s.href.length*2;if(typeof Promise<"u"&&s instanceof Promise)return A.promise;if(s instanceof WeakMap)return A.weakmap;if(s instanceof WeakSet)return A.weakset;if(s instanceof Map){let u=A.map;for(let[d,h]of s)u+=A.mapEntry,n.push(d),n.push(h);return u}if(s instanceof Set){let u=A.set;for(let d of s)u+=A.setEntry,n.push(d);return u}if(Array.isArray(s)){let u=A.array+s.length*8;for(let d of s)n.push(d);return u}if(s instanceof ArrayBuffer)return r.has(s)?0:(r.add(s),s.byteLength);if(ArrayBuffer.isView(s)){let u=s;return r.has(u.buffer)?48:(r.add(u.buffer),u.buffer.byteLength+48)}let a=A.object,l=Object.keys(s);for(let u of l){a+=A.string+u.length*2;try{n.push(s[u])}catch{}}return a}function ht(e){let t=e<0n?-e:e;if(t===0n)return 0;let r=t.toString(2).length;return Math.ceil(r/32)*8}function Ve(e,t){let r=t?.topN??10,n=e.describe({detail:"standard"}),o=[],s=e._collectObserveTargets;typeof s=="function"&&s.call(e,"",o);let i=new Map;for(let[p,f]of o)i.set(p,f);let a=[];for(let[p,f]of Object.entries(n.nodes)){let c=i.get(p),g=c instanceof L?c:null,b=g?He(g.cache):0,v=g?g._sinkCount:0,w=f.deps?.length??0,m=f.type==="effect"&&v===0,y=v===0?f.type==="effect"?"orphan-effect":f.type==="derived"?"idle-derived":f.type==="producer"?"idle-producer":null:null;a.push({path:p,type:f.type,status:f.status??"unknown",valueSizeBytes:b,subscriberCount:v,depCount:w,isOrphanEffect:m,orphanKind:y})}let l=a.reduce((p,f)=>p+f.valueSizeBytes,0),u=(p,f)=>[...a].sort(f??((c,g)=>g[p]-c[p])).slice(0,r),d=a.filter(p=>p.orphanKind!=null),h=a.filter(p=>p.isOrphanEffect);return{nodeCount:a.length,edgeCount:n.edges.length,subgraphCount:n.subgraphs.length,nodes:a,totalValueSizeBytes:l,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:d,orphanEffects:h}}function Re(e){return e>=768&&e<=879||e>=1155&&e<=1161||e>=1425&&e<=1469||e>=1552&&e<=1562||e>=1611&&e<=1631||e>=1648&&e===1648||e>=1750&&e<=1756||e>=1759&&e<=1764||e>=1767&&e<=1768||e>=1770&&e<=1773||e>=1840&&e<=1866||e>=1958&&e<=1968||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2641||e>=2672&&e<=2673||e>=2677&&e===2677||e>=3633&&e===3633||e>=3636&&e<=3642||e>=3655&&e<=3662||e>=3761&&e===3761||e>=3764&&e<=3772||e>=3784&&e<=3790||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65024&&e<=65039||e>=65056&&e<=65071||e===8205?0:e>=4352&&e<=4447||e>=8986&&e<=8987||e>=9001&&e<=9002||e>=9193&&e<=9203||e>=9208&&e<=9210||e>=9725&&e<=9726||e>=9748&&e<=9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e>=9898&&e<=9899||e>=9917&&e<=9918||e>=9924&&e<=9925||e===9934||e===9940||e===9962||e>=9970&&e<=9971||e===9973||e===9978||e===9981||e===9986||e===9989||e>=9992&&e<=9997||e===9999||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e>=10548&&e<=10549||e>=11013&&e<=11015||e>=11035&&e<=11036||e===11088||e===11093||e>=11904&&e<=12350||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=40959||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=126980&&e===126980||e===127183||e>=127344&&e<=127345||e===127358||e===127359||e===127374||e>=127377&&e<=127386||e>=127456&&e<=127487||e>=127488&&e<=127490||e===127514||e===127535||e>=127538&&e<=127546||e>=127568&&e<=127569||e>=127744&&e<=129535||e>=129536&&e<=129791||e>=129792&&e<=130047||e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}function ae(e){let t=0;for(let r of e)t+=Re(r.codePointAt(0));return t}function ze(e,t){if(t<=0)return"";let r=0,n="";for(let o of e){let s=Re(o.codePointAt(0));if(r+s>t){if(t<=1)return"\u2026";for(;r+1>t&&n.length>0;){let i=[...n].pop();n=n.slice(0,-i.length),r-=Re(i.codePointAt(0))}return`${n}\u2026`}n+=o,r+=s}return n}var gt={horizontal:"\u2500",vertical:"\u2502",cornerTL:"\u250C",cornerTR:"\u2510",cornerBL:"\u2514",cornerBR:"\u2518",tDown:"\u252C",tUp:"\u2534",tRight:"\u251C",tLeft:"\u2524",cross:"\u253C",arrowRight:"\u25B6",arrowDown:"\u25BC",arrowLeft:"\u25C0",arrowUp:"\u25B2",boxTL:"\u250C",boxTR:"\u2510",boxBL:"\u2514",boxBR:"\u2518",boxH:"\u2500",boxV:"\u2502"},mt={horizontal:"-",vertical:"|",cornerTL:"+",cornerTR:"+",cornerBL:"+",cornerBR:"+",tDown:"+",tUp:"+",tRight:"+",tLeft:"+",cross:"+",arrowRight:">",arrowDown:"v",arrowLeft:"<",arrowUp:"^",boxTL:"+",boxTR:"+",boxBL:"+",boxBR:"+",boxH:"-",boxV:"|"};function Ue(e,t){let r=t.charset==="ascii"?mt:gt,n=e.width,o=e.height,s=Array.from({length:o},()=>Array.from({length:n},()=>" ")),i=Array.from({length:o},()=>Array.from({length:n},()=>"empty"));for(let a of e.edges)yt(s,i,r,a);for(let a of e.boxes)bt(s,i,r,a,t.labelOf(a.id));return s.map(a=>Ot(a.join(""))).join(`
3
- `)}function bt(e,t,r,n,o){let{x:s,y:i,w:a,h:l}=n;if(a<2||l<2){l>0&&Ke(e,t,s,i,a,o);return}V(e,t,s,i,r.boxTL);for(let d=s+1;d<s+a-1;d+=1)V(e,t,d,i,r.boxH);V(e,t,s+a-1,i,r.boxTR);for(let d=i+1;d<i+l-1;d+=1){V(e,t,s,d,r.boxV);for(let h=s+1;h<s+a-1;h+=1)Je(e,t,h,d," ","empty");V(e,t,s+a-1,d,r.boxV)}V(e,t,s,i+l-1,r.boxBL);for(let d=s+1;d<s+a-1;d+=1)V(e,t,d,i+l-1,r.boxH);V(e,t,s+a-1,i+l-1,r.boxBR);let u=i+Math.floor(l/2);Ke(e,t,s+1,u,a-2,o)}function V(e,t,r,n,o){Je(e,t,r,n,o,o===" "?"empty":o==="\u2500"||o==="-"?"boxH":o==="\u2502"||o==="|"?"boxV":"boxCorner")}function Je(e,t,r,n,o,s){if(n<0||n>=e.length)return;let i=e[n];r<0||r>=i.length||(i[r]=o,t[n][r]=s)}function Ke(e,t,r,n,o,s){if(n<0||n>=e.length)return;let i=r,a=o;for(let l of s){let u=ae(l);if(u!==0){if(a<u)break;i>=0&&i<e[n].length&&(e[n][i]=l,t[n][i]="label",u===2&&i+1<e[n].length&&(e[n][i+1]="",t[n][i+1]="label")),i+=u,a-=u}}for(;a>0;)i>=0&&i<e[n].length&&(e[n][i]=" ",t[n][i]="empty"),i+=1,a-=1}function yt(e,t,r,n){let o=n.points;if(o.length<2)return;for(let l=0;l+1<o.length;l+=1)vt(e,t,r,o[l],o[l+1]);for(let l=1;l+1<o.length;l+=1){let u=o[l-1],d=o[l],h=o[l+1],p=xt(u,d,h,r);p&&qe(e,t,d.x,d.y,p,"edgeCorner")}let s=o[o.length-1],i=o[o.length-2],a=wt(i,s,r);a&&qe(e,t,s.x,s.y,a,"arrow")}function vt(e,t,r,n,o){if(!(n.x===o.x&&n.y===o.y)){if(n.y===o.y){let s=n.y,i=Math.min(n.x,o.x),a=Math.max(n.x,o.x);for(let l=i;l<=a;l+=1)We(e,t,l,s,r,"h")}else if(n.x===o.x){let s=n.x,i=Math.min(n.y,o.y),a=Math.max(n.y,o.y);for(let l=i;l<=a;l+=1)We(e,t,s,l,r,"v")}}}function We(e,t,r,n,o,s){if(n<0||n>=e.length)return;let i=e[n];if(r<0||r>=i.length)return;let a=t[n][r];if(!(a==="boxH"||a==="boxV"||a==="boxCorner"||a==="label")){if(a==="empty"){i[r]=s==="h"?o.horizontal:o.vertical,t[n][r]=s==="h"?"edgeH":"edgeV";return}if(a==="edgeH"&&s==="v"){i[r]=o.cross,t[n][r]="edgeCorner";return}if(a==="edgeV"&&s==="h"){i[r]=o.cross,t[n][r]="edgeCorner";return}}}function qe(e,t,r,n,o,s){if(n<0||n>=e.length)return;let i=e[n];if(r<0||r>=i.length)return;let a=t[n][r];a==="boxH"||a==="boxV"||a==="boxCorner"||a==="label"||(i[r]=o,t[n][r]=s)}function xt(e,t,r,n){let o=e.y===t.y,s=t.y===r.y;if(o===s)return;if(o){let l=e.x<t.x,u=r.y>t.y;return l&&u?n.cornerTR:l&&!u?n.cornerBR:!l&&u?n.cornerTL:n.cornerBL}let i=e.y<t.y,a=r.x>t.x;return i&&a?n.cornerBL:i&&!a?n.cornerBR:!i&&a?n.cornerTL:n.cornerTR}function wt(e,t,r){if(t.x>e.x)return r.arrowRight;if(t.x<e.x)return r.arrowLeft;if(t.y>e.y)return r.arrowDown;if(t.y<e.y)return r.arrowUp}function Ot(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===32;)t-=1;return e.slice(0,t)}function Qe(e){let t=Et(e);_t(t),St(t),Rt(t),Gt(t,e);let r=kt(t,e),{width:n,height:o}=Tt(t),s=[];for(let i of t.layers)for(let a of i)a.isVirtual||s.push({id:a.id,layer:a.layer,order:a.order,x:a.x,y:a.y,w:a.w,h:a.h});return{boxes:s,edges:r,width:n,height:o}}function Et(e){let t=new Map;for(let o of e.nodes)t.set(o,{id:o,isVirtual:!1,layer:-1,order:0,x:0,y:0,w:e.widthCells(o),h:e.heightCells(o),in:[],out:[]});let r=[],n=0;for(let o of e.edges){if(o.from===o.to)continue;let s=t.get(o.from),i=t.get(o.to);if(!s||!i)continue;let a={chainId:n++,chainFrom:o.from,chainTo:o.to,fromId:o.from,toId:o.to,hopIndex:0,chainLen:1};s.out.push(a),i.in.push(a),r.push(a)}return{nodes:t,layers:[],hops:r}}function _t(e){let t=new Map;for(let s of e.nodes.values())t.set(s.id,s.in.length);let r=[];for(let s of e.nodes.values())(t.get(s.id)??0)===0&&(s.layer=0,r.push(s));let n=new Set,o=0;for(;o<r.length;){let s=r[o++];if(!n.has(s.id)){n.add(s.id);for(let i of s.out){let a=e.nodes.get(i.toId);a.layer=Math.max(a.layer,s.layer+1);let l=(t.get(a.id)??0)-1;t.set(a.id,l),l<=0&&r.push(a)}}}for(let s of e.nodes.values())s.layer<0&&(s.layer=0)}function St(e){let t=Math.max(0,...Array.from(e.nodes.values(),s=>s.layer)),r=Array.from({length:t+1},()=>[]);for(let s of e.nodes.values())r[s.layer].push(s);let n=[],o=0;for(let s of e.hops){let i=e.nodes.get(s.fromId),a=e.nodes.get(s.toId),l=a.layer-i.layer;if(l<=0){i.out=i.out.filter(h=>h!==s),a.in=a.in.filter(h=>h!==s);continue}if(l===1){s.hopIndex=0,s.chainLen=1,n.push(s);continue}i.out=i.out.filter(h=>h!==s),a.in=a.in.filter(h=>h!==s);let u=i;for(let h=1;h<l;h+=1){let p=`__virt_${o++}__`,f={id:p,isVirtual:!0,layer:i.layer+h,order:0,x:0,y:0,w:0,h:1,in:[],out:[]};e.nodes.set(p,f),r[f.layer].push(f);let c={chainId:s.chainId,chainFrom:s.chainFrom,chainTo:s.chainTo,fromId:u.id,toId:p,hopIndex:h-1,chainLen:l};u.out.push(c),f.in.push(c),n.push(c),u=f}let d={chainId:s.chainId,chainFrom:s.chainFrom,chainTo:s.chainTo,fromId:u.id,toId:a.id,hopIndex:l-1,chainLen:l};u.out.push(d),a.in.push(d),n.push(d)}for(let s of r)for(let i=0;i<s.length;i+=1)s[i].order=i;e.layers=r,e.hops=n}function Rt(e){for(let r=0;r<4;r+=1){for(let n=1;n<e.layers.length;n+=1)Ye(e,e.layers[n],"in"),ue(e.layers[n]);for(let n=e.layers.length-2;n>=0;n-=1)Ye(e,e.layers[n],"out"),ue(e.layers[n])}for(let r=0;r<2;r+=1){let n=!1;for(let o=1;o<e.layers.length;o+=1){let s=e.layers[o];for(let i=0;i+1<s.length;i+=1){let a=Xe(e,s[i],s[i+1],"in");[s[i],s[i+1]]=[s[i+1],s[i]],ue(s),Xe(e,s[i],s[i+1],"in")<a?n=!0:([s[i],s[i+1]]=[s[i+1],s[i]],ue(s))}}if(!n)break}}function Ye(e,t,r){let n=new Map;for(let o of t){let s=r==="in"?o.in:o.out;if(s.length===0){n.set(o.id,o.order);continue}let i=0,a=0;for(let l of s){let u=e.nodes.get(r==="in"?l.fromId:l.toId);u&&(i+=u.order,a+=1)}n.set(o.id,a===0?o.order:i/a)}t.sort((o,s)=>{let i=n.get(o.id),a=n.get(s.id);return i!==a?i-a:o.order-s.order})}function ue(e){for(let t=0;t<e.length;t+=1)e[t].order=t}function Xe(e,t,r,n){let o=n==="in"?t.in:t.out,s=n==="in"?r.in:r.out,i=0;for(let a of o)for(let l of s){let u=e.nodes.get(n==="in"?a.fromId:a.toId)?.order??0,d=e.nodes.get(n==="in"?l.fromId:l.toId)?.order??0;(t.order<r.order&&u>d||t.order>r.order&&u<d)&&(i+=1)}return i}function Gt(e,t){t.direction==="LR"?Dt(e,t):Ct(e,t)}function Dt(e,t){let r=[],n=0;for(let o=0;o<e.layers.length;o+=1){r.push(n);let s=0;for(let i of e.layers[o])s=Math.max(s,i.w);n+=s+t.layerGap}for(let o=0;o<e.layers.length;o+=1)for(let s of e.layers[o])s.x=r[o];for(let o of e.layers){let s=0;for(let i of o)i.y=s,s+=i.h+t.nodeGap}Ze(e,t,"y")}function Ct(e,t){let r=[],n=0;for(let o=0;o<e.layers.length;o+=1){r.push(n);let s=0;for(let i of e.layers[o])s=Math.max(s,i.h);n+=s+t.layerGap}for(let o=0;o<e.layers.length;o+=1)for(let s of e.layers[o])s.y=r[o];for(let o of e.layers){let s=0;for(let i of o)i.x=s,s+=i.w+t.nodeGap}Ze(e,t,"x")}function Ze(e,t,r){let n=s=>r==="y"?s.h:s.w,o=t.nodeGap;for(let s=0;s<2;s+=1){let i=s===0?e.layers.slice(1):e.layers.slice(0,-1).reverse();for(let a of i){let l=new Map;for(let d of a){let h=s===0?d.in:d.out;if(h.length===0)continue;let p=[];for(let c of h){let g=e.nodes.get(s===0?c.fromId:c.toId);if(!g)continue;let b=r==="y"?g.y:g.x;p.push(b+Math.floor(n(g)/2))}if(p.length===0)continue;p.sort((c,g)=>c-g);let f=p[Math.floor(p.length/2)];l.set(d.id,f-Math.floor(n(d)/2))}let u=0;for(let d of a){let h=l.get(d.id),p=r==="y"?d.y:d.x,c=Math.max(h??p,u);r==="y"?d.y=c:d.x=c,u=c+n(d)+o}}}}function kt(e,t){let r=new Map;for(let u of e.hops){let d=r.get(u.chainId);d?d.push(u):r.set(u.chainId,[u])}for(let u of r.values())u.sort((d,h)=>d.hopIndex-h.hopIndex);let n=t.direction==="LR",o=u=>n?u.x:u.y,s=u=>n?u.w:u.h,i=u=>n?u.y+Math.floor(u.h/2):u.x+Math.floor(u.w/2),a=new Map;for(let u=0;u+1<e.layers.length;u+=1){let d=e.layers[u],h=e.layers[u+1],p=0;for(let _ of d)p=Math.max(p,o(_)+s(_));let f=Number.POSITIVE_INFINITY;for(let _ of h)f=Math.min(f,o(_));let c=Number.isFinite(f)?f-1:p,g=Math.max(1,c-p+1),b=[];for(let _ of d)for(let R of _.out)b.push(R);b.sort((_,R)=>{let k=i(e.nodes.get(_.fromId)),$=i(e.nodes.get(R.fromId));if(k!==$)return k-$;let D=i(e.nodes.get(_.toId)),G=i(e.nodes.get(R.toId));return D-G});let v=[],w=new Map;for(let _ of b){let R=i(e.nodes.get(_.fromId)),k=i(e.nodes.get(_.toId)),$=Math.min(R,k),D=Math.max(R,k),G=-1;for(let P=0;P<v.length;P+=1){let F=v[P],H=!0;for(let U of F)if(U.lo<=D&&$<=U.hi){H=!1;break}if(H){F.push({lo:$,hi:D}),G=P;break}}G<0&&(v.push([{lo:$,hi:D}]),G=v.length-1),w.set(_,G)}let m=v.length,y=g>=Math.max(3,m+2),S=y?p+1:p,x=y?c-1:c,O=Math.max(1,x-S+1);for(let _ of b){let R=w.get(_),k;if(m<=1)k=S+Math.floor(O/2);else{let $=(O-1)/(m-1);k=S+Math.floor(R*$)}a.set(_,Math.max(p,Math.min(c,k)))}}let l=[];for(let[,u]of r){let d=[];for(let p=0;p<u.length;p+=1){let f=u[p],c=e.nodes.get(f.fromId),g=e.nodes.get(f.toId),b=a.get(f),v=c.isVirtual?o(c):o(c)+s(c),w=g.isVirtual?o(g):o(g)-1,m=i(c),y=i(g);p===0&&le(d,n,v,m),m!==y&&(le(d,n,b,m),le(d,n,b,y)),le(d,n,w,y)}let h=u[0];l.push({from:h.chainFrom,to:h.chainTo,points:$t(d)})}return l}function le(e,t,r,n){e.push(t?{x:r,y:n}:{x:n,y:r})}function $t(e){let t=[];for(let r of e){let n=t[t.length-1];(!n||n.x!==r.x||n.y!==r.y)&&t.push(r)}return t}function Tt(e){let t=0,r=0;for(let n of e.layers)for(let o of n)t=Math.max(t,o.x+o.w),r=Math.max(r,o.y+o.h);return{width:t,height:r}}var Nt=24,At=4,Pt=1,Mt=3;function et(e,t){let r=Lt(t.direction),n=Math.max(3,t.maxLabelWidth??Nt),o=t.asciiCharset??"unicode",s=Object.keys(e.nodes).sort(),i=new Set(s),a=e.edges.filter(f=>i.has(f.from)&&i.has(f.to)),l=new Map,u=new Map;for(let f of s){let c=ze(f,n);l.set(f,c),u.set(f,ae(c)+4)}let d=Qe({nodes:s,edges:a,widthCells:f=>u.get(f)??3,heightCells:()=>Mt,layerGap:At,nodeGap:Pt,direction:r}),h=Ue(d,{charset:o,labelOf:f=>l.get(f)??f}),p=t.logger;return p&&p(h),h}function Lt(e){if(e===void 0||e==="LR")return"LR";if(e==="TD")return"TD";throw new Error(`ascii describe supports direction "LR" or "TD" only; got ${String(e)}`)}var N="::",B="__meta__",q=1;function tt(e,t){let r=Math.max(16,e.size*4),n=0;for(;e.size>0;){if(n++>=r){console.error(`[Graph "${t}".destroy] disposer drain exceeded cap (${r}); ${e.size} disposer(s) discarded`),e.clear();return}let o=e.values().next();if(o.done)return;let s=o.value;e.delete(s);try{s()}catch(i){console.error(`[Graph "${t}".destroy] disposer threw:`,i)}}}function It(e){let t=[];for(let r of Object.keys(e).sort()){let n=e[r].v;n!=null&&t.push(`${r} ${n.id} ${n.version}`)}return t.join(`
4
- `)}function nt(e){if(e.version!==q)throw new Error(`unsupported snapshot version ${String(e.version)} (expected ${q})`);for(let t of["name","nodes","edges","subgraphs"])if(!(t in e))throw new Error(`snapshot missing required key "${t}"`);if(typeof e.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof e.nodes!="object"||e.nodes===null||Array.isArray(e.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(e.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(e.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function jt(e,t){let r=new WeakMap,n=(o,s)=>{if(Object.is(o,s))return!0;if(o==null||s==null||typeof o!="object"||typeof s!="object")return!1;let i=r.get(o);if(i==null&&(i=new WeakSet,r.set(o,i)),i.has(s))return!0;i.add(s);let a=o.constructor,l=s.constructor;if(a!==l)return!1;if(o instanceof Date)return o.getTime()===s.getTime();if(o instanceof RegExp)return o.source===s.source&&o.flags===s.flags;if(Array.isArray(o)){let p=s;if(o.length!==p.length)return!1;for(let f=0;f<o.length;f++)if(!n(o[f],p[f]))return!1;return!0}if(o instanceof Map){let p=s;if(o.size!==p.size)return!1;for(let[f,c]of o)if(!p.has(f)||!n(c,p.get(f)))return!1;return!0}if(o instanceof Set){let p=s;if(o.size!==p.size)return!1;for(let f of o){let c=!1;for(let g of p)if(n(f,g)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(o)){let p=o,f=s;if(p.length!==f.length)return!1;for(let c=0;c<p.length;c++)if(p[c]!==f[c])return!1;return!0}let u=Object.keys(o),d=Object.keys(s);if(u.length!==d.length)return!1;let h=new Set(d);for(let p of u)if(!h.has(p)||!n(o[p],s[p]))return!1;return!0};return n(e,t)}function De(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(De);let t=e,r=Object.keys(t).sort(),n={};for(let o of r)n[o]=De(t[o]);return n}function Bt(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function Ft(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function Ht(e){return e==="TD"?"down":e==="BT"?"up":e==="RL"?"left":"right"}function ot(e){let t=new Set,r=[];function n(o,s){let i=`${o}\0${s}`;t.has(i)||(t.add(i),r.push([o,s]))}for(let[o,s]of Object.entries(e.nodes)){let i=s.deps;if(i)for(let a of i)n(a,o)}for(let o of e.edges)n(o.from,o.to);return r}function it(e){if(e===void 0)return"LR";if(e==="TD"||e==="LR"||e==="BT"||e==="RL")return e;throw new Error(`invalid diagram direction ${String(e)}; expected one of: TD, LR, BT, RL`)}function Vt(e,t){let r=t.includeEdges??!0,n=t.includeSubgraphs??!0,{expand:o,...s}=e,i={...s,edges:r?e.edges:[],subgraphs:n?e.subgraphs:[]},a=JSON.stringify(De(i),null,t.indent??2);return t.logger?.(a),a}function zt(e,t){let r=t.includeEdges??!0,n=t.includeSubgraphs??!0,o=[];o.push(`Graph ${e.name}`),o.push("Nodes:");for(let i of Object.keys(e.nodes).sort()){let a=e.nodes[i];o.push(`- ${i} (${a.type}/${a.status}): ${de(a.value)}`)}if(r){o.push("Edges:");for(let i of e.edges)o.push(`- ${i.from} -> ${i.to}`)}if(n){o.push("Subgraphs:");for(let i of e.subgraphs)o.push(`- ${i}`)}let s=o.join(`
5
- `);return t.logger?.(s),s}function at(e,t){let r=it(t.direction),n=Object.keys(e.nodes).sort(),o=new Map;for(let i=0;i<n.length;i+=1)o.set(n[i],`n${i}`);let s=[`flowchart ${r}`];for(let i of n){let a=o.get(i);s.push(` ${a}["${Bt(i)}"]`)}for(let[i,a]of ot(e)){let l=o.get(i),u=o.get(a);!l||!u||s.push(` ${l} --> ${u}`)}return s.join(`
6
- `)}function Kt(e,t){let r=at(e,t);return Wt(r)}function Wt(e,t){let r=t?.theme??"default",n=t?.autoSync??!0,s=JSON.stringify({code:e,mermaid:{theme:r},autoSync:n}),i=new TextEncoder().encode(s),a="";for(let u=0;u<i.length;u++)a+=String.fromCharCode(i[u]);return`https://mermaid.live/edit#base64:${globalThis.btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}function qt(e,t){let r=it(t.direction),n=Object.keys(e.nodes).sort(),o=new Map;for(let i=0;i<n.length;i+=1)o.set(n[i],`n${i}`);let s=[`direction: ${Ht(r)}`];for(let i of n){let a=o.get(i);s.push(`${a}: "${Ft(i)}"`)}for(let[i,a]of ot(e)){let l=o.get(i),u=o.get(a);!l||!u||s.push(`${l} -> ${u}`)}return s.join(`
7
- `)}function Ut(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e){let t="^";for(let r=0;r<e.length;r+=1){let n=e[r];if(n==="*"){t+=".*";continue}if(n==="?"){t+=".";continue}if(n==="["){let o=e.indexOf("]",r+1);if(o<=r+1){t+="\\[";continue}let s=e.slice(r+1,o);s.startsWith("!")&&(s=`^${s.slice(1)}`),s=s.replace(/\\/g,"\\\\"),t+=`[${s}]`,r=o;continue}t+=Ut(n)}return t+="$",new RegExp(t)}var Jt={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},Yt={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};function de(e){if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean"||e==null)return String(e);try{return JSON.stringify(e)}catch{return"[unserializable]"}}function Xt(e){return e==="none"?Yt:e==="ansi"||e==null?Jt:{data:e.data??"",dirty:e.dirty??"",resolved:e.resolved??"",invalidate:e.invalidate??"",pause:e.pause??"",resume:e.resume??"",complete:e.complete??"",error:e.error??"",teardown:e.teardown??"",derived:e.derived??"",path:e.path??"",reset:e.reset??""}}function rt(e){if(e==null)return{};let t=e.detail;return t==="full"?{...e,structured:e.structured??!0,timeline:e.timeline??!0,causal:e.causal??!0,derived:e.derived??!0}:t==="minimal"?{...e,structured:e.structured??!0}:e.format==="stage-log"?{...e,structured:e.structured??!0,timeline:e.timeline??!0}:e}function Qt(e,t,r){for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o<32||o===127)throw new Error(`Graph "${t}": ${r} "${e}" must not contain control character (U+${o.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function Ge(e,t,r){if(e==="")throw new Error(`Graph "${t}": ${r} name must be non-empty`);if(e.includes(N))throw new Error(`Graph "${t}": ${r} "${e}" must not contain '${N}' (path separator)`);if(e===B)throw new Error(`Graph "${t}": ${r} name "${B}" is reserved for meta companion paths`);Qt(e,t,r)}function Zt(e,t){if(e==="")throw new Error(`Graph "${t}": resolve path must be non-empty`);let r=e.split(N);for(let n of r)if(n==="")throw new Error(`Graph "${t}": resolve path has empty segment`);return r}function en(e,t){let r=!1;for(let o of e)if(!t.isMetaPassthrough(o[0])){r=!0;break}return r?e.filter(o=>t.isMetaPassthrough(o[0])):e}function ut(e){for(let t of e._mounts.values())ut(t);for(let t of e._nodes.values())try{t.down([[z]],{internal:!0})}catch{}}var Ce=class e{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;constructor(t,r){if(t==="")throw new Error("Graph name must be non-empty");if(t.includes(N))throw new Error(`Graph name must not contain '${N}' (got "${t}")`);if(t===B)throw new Error(`Graph name "${B}" is reserved for meta companion paths`);this.name=t,this.opts=Object.freeze({...r??{}}),this.config=r?.config??we,this._traceRing=new Se(r?.traceCapacity??1e3),r?.versioning!=null&&this.setVersioning(r.versioning)}ancestors(t=!0){let r=[],n=t?this:this._parent;for(;n!=null;)r.push(n),n=n._parent;return r}get topology(){return this._topology==null&&(this._topology=Me(t=>{let r=n=>{t.emit(n)};return this._topologyEmitters.add(r),()=>{this._topologyEmitters.delete(r)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(t){if(!(this._topology==null||this._topologyEmitters.size===0))for(let r of this._topologyEmitters)r(t)}nameOf(t){return this._nodeToName.get(t)}add(t,r){let n=t.name,o=r?.name??n;if(o==null||o==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let s=o,i=r?.annotation;if(Ge(s,this.name,"add"),this._mounts.has(s))throw new Error(`Graph "${this.name}": name "${s}" is already a mount point`);if(this._nodes.has(s))throw new Error(`Graph "${this.name}": node "${s}" already exists`);let a=this._nodeToName.get(t);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(s,t),this._nodeToName.set(t,s),this._emitTopology({kind:"added",name:s,nodeKind:"node"}),i!=null&&(this._annotations.set(s,i),this.config.inspectorEnabled&&this._traceRing.push({path:s,annotation:i,timestamp_ns:K()})),t}setVersioning(t){if(t!=null)for(let r of this._nodes.values())r instanceof L&&r._applyVersioning(t)}remove(t){Ge(t,this.name,"remove");let r=this._mounts.get(t);if(r){let s={kind:"mount",nodes:[],mounts:[]},i=[];r._collectObserveTargets("",i);for(let[a,l]of i)a.includes(`${N}${B}${N}`)||s.nodes.push(a);return s.nodes.sort(),s.mounts.push(t),s.mounts.push(...r._collectSubgraphs(`${t}${N}`)),this._mounts.delete(t),r._parent=void 0,ut(r),this._emitTopology({kind:"removed",name:t,nodeKind:"mount",audit:s}),s}let n=this._nodes.get(t);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${t}"`);this._nodes.delete(t),this._nodeToName.delete(n),n.down([[z]],{internal:!0});let o={kind:"node",nodes:[t],mounts:[]};return this._emitTopology({kind:"removed",name:t,nodeKind:"node",audit:o}),o}removeAll(t){let r=typeof t=="function"?t:(()=>{let s=ce(t);return i=>s.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},o=[...this._nodes.keys(),...this._mounts.keys()].filter(s=>r(s));for(let s of o){let i=this.remove(s);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let t=[...this._nodes.keys()].sort(),r=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=t.length)return{value:void 0,done:!0};let o=t[n++];return{value:[o,r.get(o)],done:!1}}}}node(t){if(t==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(t.includes(N))return this.resolve(t);let r=this._nodes.get(t);if(!r)throw new Error(`Graph "${this.name}": unknown node "${t}"`);return r}get(t){return this.node(t).cache}set(t,r,n){let o=n?.internal===!0;this.node(t).down([[Q,r]],{actor:n?.actor,internal:o,delivery:"write"})}setAll(t,r){let n=Symbol.iterator in t?t:Object.entries(t);Ae(()=>{for(let[o,s]of n)this.set(o,s,r)})}invalidate(t,r){let n=r?.internal===!0;this.node(t).down([[Z]],{actor:r?.actor,internal:n,delivery:"write"})}error(t,r,n){let o=n?.internal===!0;this.node(t).down([[te,r]],{actor:n?.actor,internal:o,delivery:"write"})}complete(t,r){let n=r?.internal===!0;this.node(t).down([[ee]],{actor:r?.actor,internal:n,delivery:"write"})}edges(t){let r=t?.recursive===!0,n=new Map;if(!r){for(let[l,u]of this._nodes)n.set(u,l);let a=[];for(let[l,u]of this._nodes)if(u instanceof L)for(let d of u._deps){let h=n.get(d.node);h!=null&&a.push([h,l])}return a.sort((l,u)=>l[0]<u[0]?-1:l[0]>u[0]?1:l[1]<u[1]?-1:l[1]>u[1]?1:0),a}let o=[];this._collectObserveTargets("",o);let s=new Map;for(let[a,l]of o)s.set(l,a);let i=[];for(let[a,l]of o)if(l instanceof L)for(let u of l._deps){let d=s.get(u.node);d!=null&&i.push([d,a])}return i.sort((a,l)=>a[0]<l[0]?-1:a[0]>l[0]?1:a[1]<l[1]?-1:a[1]>l[1]?1:0),i}mount(t,r){if(r===void 0){let o=new e(t);return this.mount(t,o)}if(typeof r=="function"){let o=new e(t);return r(o),this.mount(t,o)}let n=r;if(Ge(t,this.name,"mount"),this._nodes.has(t))throw new Error(`Graph "${this.name}": cannot mount at "${t}" \u2014 node with that name exists`);if(this._mounts.has(t))throw new Error(`Graph "${this.name}": mount "${t}" already exists`);if(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let o=this;o!=null;o=o._parent)if(o===n)throw new Error(`Graph "${this.name}": mount("${t}", \u2026) would create a mount cycle`);return this._mounts.set(t,n),n._parent=this,this._emitTopology({kind:"added",name:t,nodeKind:"mount"}),n}resolve(t){let r=Zt(t,this.name);return this._resolveFromSegments(r)}tryResolve(t){try{return this.resolve(t)}catch{return}}_resolveFromSegments(t){let r=t;if(r[0]===this.name&&(r=r.slice(1),r.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=r[0],o=r.slice(1);if(o.length===0){let a=this._nodes.get(n);if(a)return a;throw this._mounts.has(n)?new Error(`Graph "${this.name}": path ends at subgraph "${n}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${n}"`)}let s=this._nodes.get(n);if(s&&o.length>0&&o[0]===B)return this._resolveMetaChainFromNode(s,o,r.join(N));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${o.join(N)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(o.join(N))}_resolveMetaChainFromNode(t,r,n){let o=t,s=0,i=[...r];for(;s<i.length;){if(i[s]!==B)throw new Error(`Graph "${this.name}": expected ${B} segment in meta path "${n}"`);if(s+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${B} in "${n}"`);let a=i[s+1],l=o.meta[a];if(!l)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);o=l,s+=2}return o}signal(t,r){if(r?.internal!==!0){for(let o of t)if(this.config.messageTier(o[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let n=[];if(this._signalDeliver(t,r??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(t,r,n,o){for(let l of this._mounts.values())l._signalDeliver(t,r,n,o);let i=r.internal===!0?{internal:!0}:{actor:r.actor,delivery:"signal"},a=en(t,this.config);for(let l of[...this._nodes.keys()].sort()){let u=this._nodes.get(l);if(!n.has(u)){n.add(u);try{u.down(t,i)}catch(d){if(d instanceof W)throw d;o.push(d)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,o)}}}_signalMetaSubtree(t,r,n,o,s){for(let i of Object.keys(t.meta).sort()){let a=t.meta[i];if(!n.has(a)){n.add(a);try{a.down(r,o)}catch(l){if(l instanceof W)throw l;s.push(l)}this._signalMetaSubtree(a,r,n,o,s)}}}describe(t){if(t?.reactive===!0)return this._describeReactive(t);let r=t?.actor,n=t?.filter,o=re(t?.detail,t?.fields),s=t?.format==="spec",i=s?re("minimal"):o,a=[];this._collectObserveTargets("",a);let l=new Map;for(let[x,O]of a)l.set(O,x);let u=[];{let x=a.map(([,R])=>R),O=new Set(l.values()),_=0;for(;x.length>0;){let R=x.shift();if(R instanceof L)for(let k of R._deps){let $=k.node;if(l.has($))continue;let D=$.name??"",G=D;if(!G||O.has(G))if(D){let P=2;for(;O.has(`${D}#${P}`);)P++;G=`${D}#${P}`}else for(G=`__internal__/${_++}`;O.has(G);)G=`__internal__/${_++}`;l.set($,G),O.add(G),u.push([G,$]),x.push($)}}}let d=[...a,...u],h={};for(let[x,O]of d){if(r!=null&&!O.allowsObserve(r))continue;let _=_e(O,i),R=O instanceof L?O._deps.map(G=>l.get(G.node)??G.node.name??""):[],{name:k,...$}=_,D={...$,deps:R};if(!s){let G=this._annotations.get(x);G!=null&&(D.annotation=G)}if(n!=null)if(typeof n=="function"){let G=n;if(!(G.length>=2?G(x,D):G(D)))continue}else{let G=!0;for(let[P,F]of Object.entries(n)){let H=P==="deps_includes"?"depsIncludes":P==="meta_has"?"metaHas":P;if(H==="depsIncludes"){if(!D.deps.includes(String(F))){G=!1;break}continue}if(H==="metaHas"){if(!Object.hasOwn(D.meta??{},String(F))){G=!1;break}continue}if(D[H]!==F){G=!1;break}}if(!G)continue}h[x]=D}let p=new Set(Object.keys(h)),f=[];for(let[x,O]of d)if(O instanceof L)for(let _ of O._deps){let R=l.get(_.node);R!=null&&f.push([R,x])}f.sort((x,O)=>x[0]<O[0]?-1:x[0]>O[0]?1:x[1]<O[1]?-1:x[1]>O[1]?1:0);let c=f.map(([x,O])=>({from:x,to:O}));(r!=null||n!=null)&&(c=c.filter(x=>p.has(x.from)&&p.has(x.to)));let g=this._collectSubgraphs(""),b=r!=null||n!=null?g.filter(x=>{let O=`${x}${N}`;return[...p].some(_=>_===x||_.startsWith(O))}):g,v=this,w=t,m={name:this.name,nodes:h,edges:c,subgraphs:b,expand(x){let O={...w,format:void 0};return Array.isArray(x)?(O.fields=x,O.detail=void 0):(O.detail=x,O.fields=void 0),v.describe(O)}},y=t??{},S=y.format;return S==="json"?Vt(m,y):S==="pretty"?zt(m,y):S==="mermaid"?at(m,y):S==="mermaid-url"?Kt(m,y):S==="d2"?qt(m,y):S==="ascii"?et(m,y):m}_collectSubgraphs(t){let r=[];for(let n of[...this._mounts.keys()].sort()){let o=t===""?n:`${t}${n}`;r.push(o),r.push(...this._mounts.get(n)._collectSubgraphs(`${o}${N}`))}return r}resourceProfile(t){return Ve(this,t)}reachable(t,r,n={}){return n.withDetail===!0?st(this.describe(),t,r,{...n,withDetail:!0}):st(this.describe(),t,r,n)}explain(t,r,n){return n?.reactive===!0?this._explainReactive(t,r,n):this._explainStatic(t,r,n)}_explainStatic(t,r,n){let o=this.describe({detail:"full"}),s=new Map(this._annotations),i=new Map;for(let[a,l]of Object.entries(o.nodes))l.lastMutation!=null&&i.set(a,l.lastMutation);return Ie(o,t,r,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:s,lastMutations:i})}_describeReactive(t){let r={...t,reactive:!1},n=t.reactiveName??"describe",o=0,s=ne(o,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,l=!1,u=()=>{a||l||(a=!0,xe(()=>{a=!1,!l&&(o+=1,s.emit(o))}))},d=i.onEvent(b=>{let v=b.type;v!=="data"&&v!=="error"&&v!=="complete"&&v!=="teardown"||u()}),h=[],p=new WeakSet,f=b=>{if(p.has(b)||l)return;p.add(b);let v=b.topology.subscribe(w=>{for(let m of w){if(m[0]!==Q)continue;let y=m[1];if(u(),y.kind==="added"&&y.nodeKind==="mount"){let S=b._mounts.get(y.name);S!=null&&f(S)}}});h.push(v);for(let w of b._mounts.keys()){let m=b._mounts.get(w);m!=null&&f(m)}};f(this);let c;try{c=Oe([s],()=>this.describe(r),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(b,v)=>b===v})}catch(b){d();for(let v of h)v();throw i.dispose(),b}let g=Ee(c);return{node:c,dispose(){l=!0,d();for(let b of h)b();h.length=0,i.dispose(),g()}}}_explainReactive(t,r,n){let o=0,s=ne(o,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,l=!1,u=i.onEvent(f=>{let c=f.type;c!=="data"&&c!=="error"&&c!=="complete"&&c!=="teardown"||a||l||(a=!0,xe(()=>{a=!1,!l&&(o+=1,s.emit(o))}))}),d={...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{}},h;try{h=Oe([s],()=>this._explainStatic(t,r,d),{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:t,to:r},equals:(f,c)=>f.found===c.found&&f.reason===c.reason&&f.steps.length===c.steps.length&&nn(f.steps,c.steps)})}catch(f){throw u(),i.dispose(),f}let p=Ee(h);return{node:h,dispose(){l=!0,u(),i.dispose(),p()}}}_pathsMatching(t){let r=ce(t),n=[];return this._collectObserveTargets("",n),n.map(([o])=>o).filter(o=>r.test(o))}_collectObserveTargets(t,r){for(let n of[...this._mounts.keys()].sort()){let o=t===""?n:`${t}${N}${n}`;this._mounts.get(n)._collectObserveTargets(o,r)}for(let n of[...this._nodes.keys()].sort()){let o=this._nodes.get(n),s=t===""?n:`${t}${N}${n}`;r.push([s,o]),this._appendMetaObserveTargets(s,o,r)}}_appendMetaObserveTargets(t,r,n){for(let o of Object.keys(r.meta).sort()){let s=r.meta[o],i=`${t}${N}${B}${N}${o}`;n.push([i,s]),this._appendMetaObserveTargets(i,s,n)}}observe(t,r){let n=typeof t=="string",s=rt(n?r:t),i=s.structured===!0||s.timeline===!0||s.causal===!0||s.derived===!0||s.detail==="minimal"||s.detail==="full"||s.format!=null,a=s.actor;if(n){let d=t,h=this.resolve(d);if(a!=null&&!h.allowsObserve(a))throw new W({actor:a,action:"observe",nodeName:d});return i?this._buildStructuredObserver([[d,h]],s,"one"):{subscribe(p){return h.subscribe(p)},up(p){try{h.up?.(p)}catch(f){if(f instanceof W)return;throw f}}}}let l=[];this._collectObserveTargets("",l),l.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);let u=a==null?l:l.filter(([,d])=>d.allowsObserve(a));return i?this._buildStructuredObserver(u,s,"all"):{subscribe:d=>{let h=u.map(([p,f])=>f.subscribe(c=>{d(p,c)}));return()=>{for(let p of h)p()}},up:(d,h)=>{try{this.resolve(d).up?.(h)}catch(p){if(p instanceof W)return;throw p}}}}_buildStructuredObserver(t,r,n){let o=n==="one"?t[0]?.[0]:void 0,s=i=>{if(n==="one"&&o!=null){let d=this.resolve(o);return this._buildStructuredObserver([[o,d]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);let l=i.actor,u=l==null?a:a.filter(([,d])=>d.allowsObserve(l));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(t,r,s)}_createObserveResult(t,r,n){let o=r.timeline===!0,s=r.causal===!0,i=r.derived===!0,a=r.detail==="minimal",l=this.config.inspectorEnabled,u=(s||i)&&l,d=r.maxEvents,h=d!=null&&d>0?new Se(d):null,p=[],f=new Set,c={},g=new Set,b=0,v=0,w=0,m=0,y=0,S=0,x=!1,O=!1,_=0,R=new Map,k=new Map,$=new Map,D=E=>{h?h.push(E):p.push(E);for(let T of f)T(E)},G=()=>o?{timestamp_ns:K(),in_batch:Ne(),batch_id:_}:{},P=(E,T)=>{if(!(!u||!(E instanceof L)))return E._setInspectorHook(I=>{if(I.kind==="dep_message")R.set(E,I.depIndex);else if(I.kind==="run"){let J=I.batchData.map((C,M)=>C!=null&&C.length>0?C.at(-1):I.prevData[M]);k.set(E,J);let j=I.batchData.map(C=>C!=null?[...C]:void 0);$.set(E,j),i&&D({type:"derived",path:T,dep_values:J,dep_batches:j,...G()})}})},F=E=>{let T=R.get(E),I=k.get(E);if(!s||I==null)return{};let j=(T!=null&&T>=0&&E instanceof L?E._deps[T]:void 0)?.node,C=j?.v,M=$.get(E);return{trigger_dep_index:T,trigger_dep_name:j?.name,...C!=null?{trigger_version:{id:C.id,version:C.version}}:{},dep_values:[...I],...M!=null?{dep_batches:M}:{}}},H=[],U=[];for(let[E,T]of t){let I=P(T,E);I&&H.push(I),U.push(T.subscribe(J=>{_++;for(let j of J){let C=j[0],M=G();if(C===Q){c[E]=j[1];let ge=T instanceof L?T.lastMutation?.actor??Y:Y;D({type:"data",path:E,data:j[1],actor:ge,...M,...F(T)})}else if(a)C===me?b++:C===be?v++:C===Z?w++:C===ye?m++:C===ve?y++:C===z?S++:C===ee&&!g.has(E)?x=!0:C===te&&(O=!0,g.add(E));else if(C===me)b++,D({type:"dirty",path:E,...M});else if(C===be)v++,D({type:"resolved",path:E,...M,...F(T)});else if(C===Z)w++,D({type:"invalidate",path:E,...M});else if(C===ye)m++,D({type:"pause",path:E,lockId:j[1],...M});else if(C===ve)y++,D({type:"resume",path:E,lockId:j[1],...M});else if(C===ee)g.has(E)||(x=!0),D({type:"complete",path:E,...M});else if(C===te){O=!0,g.add(E);let ge=T instanceof L?T.lastMutation?.actor??Y:Y;D({type:"error",path:E,data:j[1],actor:ge,...M})}else C===z&&(S++,D({type:"teardown",path:E,...M}))}}))}let fe=!1,pe=()=>{if(!fe){fe=!0;for(let E of U)E();for(let E of H)E();for(let E of X)E({value:void 0,done:!0});X.length=0}},he=[],X=[];f.add(E=>{let T=X.shift();T?T({value:E,done:!1}):he.push(E)});let ke={get values(){return c},get dirtyCount(){return b},get resolvedCount(){return v},get invalidateCount(){return w},get pauseCount(){return m},get resumeCount(){return y},get teardownCount(){return S},get events(){return h?h.toArray():[...p]},get anyCompletedCleanly(){return x},get anyErrored(){return O},get completedWithoutErrors(){return x&&!O},onEvent(E){return f.add(E),()=>f.delete(E)},dispose:pe,expand(E){pe();let T={...r};return typeof E=="string"?T.detail=E:Object.assign(T,E),n(rt(T))},[Symbol.asyncIterator](){return{next(){return he.length>0?Promise.resolve({value:he.shift(),done:!1}):fe?Promise.resolve({value:void 0,done:!0}):new Promise(E=>X.push(E))},return(){return pe(),Promise.resolve({value:void 0,done:!0})}}}};return r.format!=null&&this._attachFormatLogger(ke,r),ke}_attachFormatLogger(t,r){let n=r.format;if(n==null)return;let o=r.logger??(c=>console.log(c)),s=r.includeTypes?new Set(r.includeTypes):null,i=r.excludeTypes?new Set(r.excludeTypes):null,a=s==null&&i==null?()=>!0:c=>(s==null||s.has(c))&&(i==null||!i.has(c)),l=Xt(r.theme),u=n==="stage-log"?K():0,d=c=>c==null?"":r.stageLabels?.[c]??c,h=(c,g)=>c.length>g?`${c.slice(0,g-1)}\u2026`:c,p=c=>c.type==="data"||c.type==="error"?h(de(c.data),120):"",f=c=>{if(n==="stage-log"){let O=(K()-u)/1e9,_=d(c.path).padEnd(9);if(c.type==="data"){let R=p(c);return`[${O.toFixed(3)}s] ${_} \u2190${R?` ${R}`:""}`}if(c.type==="error"){let R=p(c);return`[${O.toFixed(3)}s] ${_} \u2717${R?` ${R}`:""}`}return c.type==="complete"?`[${O.toFixed(3)}s] ${_} \u25A0 complete`:`[${O.toFixed(3)}s] ${_} ${c.type}`}if(n==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let g=l[c.type]??"",b=c.path?`${l.path}${c.path}${l.reset} `:"",v=c.type==="data"||c.type==="error",w=c.type==="pause"||c.type==="resume",m=v?` ${de(c.data)}`:w?` ${de(c.lockId)}`:"",y=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,S=y?.trigger_dep_name!=null?` <- ${y.trigger_dep_name}`:y?.trigger_dep_index!=null?` <- #${y.trigger_dep_index}`:"",x=c.in_batch?" [batch]":"";return`${b}${g}${c.type.toUpperCase()}${l.reset}${m}${S}${x}`};t.onEvent(c=>{a(c.type)&&o(f(c),c)})}addDisposer(t){return this._disposers.add(t),()=>{this._disposers.delete(t)}}destroy(){tt(this._disposers,this.name),this.signal([[z]],{internal:!0}),tt(this._storageDisposers,this.name);for(let t of[...this._mounts.values()])t._parent=void 0,t._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let t of[...this._mounts.values()])t._parent=void 0,t._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(t){let{expand:r,...n}=this.describe({detail:"full"}),o={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:l,guard:u,...d}=n.nodes[a];o[a]=d}let s=[...n.subgraphs].sort(),i={...n,version:1,nodes:o,subgraphs:s};if(t?.format==null)return i;if(t.format==="json-string")return JSON.stringify(i);if(t.format==="bytes"){if(t.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(t.codec);if(a==null)throw new Error(`snapshot: codec "${t.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return $e(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(t.format)}"`)}static decode(t,r){let n=r?.config??we,{codec:o,codecVersion:s,payload:i}=Te(t,n);return o.decode(i,s)}restore(t,r){if(nt(t),t.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${t.name}" does not match this graph`);let n=r?.only==null?null:(Array.isArray(r.only)?r.only:[r.only]).map(s=>ce(s)),o=r?.includeProducers===!0;for(let s of Object.keys(t.nodes).sort()){if(n!==null&&!n.some(a=>a.test(s)))continue;let i=t.nodes[s];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&r?.onError?.(s,new Error(`restore: slice.value is undefined for "${s}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!o)){if(i.v!=null){let l=this.tryResolve(s)?.v;if(l!=null&&l.id===i.v.id&&l.version===i.v.version)continue}try{this.set(s,i.value)}catch(a){r?.onError?.(s,a)}}}}}static fromSnapshot(t,r){nt(t);let n=typeof r=="function"?r:r?.build,o=typeof r=="function"?void 0:r?.factories,s=new e(t.name);if(n)return n(s),s.restore(t),s;for(let f of[...t.subgraphs].sort((c,g)=>{let b=c.split(N).length,v=g.split(N).length;return b!==v?b-v:c<g?-1:c>g?1:0})){let c=f.split(N),g=s;for(let b of c)g._mounts.has(b)||g.mount(b,new e(b)),g=g._mounts.get(b)}let i=o?Object.entries(o).map(([f,c])=>({re:ce(f),factory:c})):[],a=f=>{for(let c of i)if(c.re.test(f))return c.factory},l=f=>{let c=f.split(N),g=c.pop();if(g==null||g.length===0)throw new Error(`invalid snapshot path "${f}"`);let b=s;for(let v of c){let w=b._mounts.get(v);if(!w)throw new Error(`unknown mount "${v}" in path "${f}"`);b=w}return[b,g]},u=Object.entries(t.nodes).filter(([f])=>!f.includes(`${N}${B}${N}`)).sort((f,c)=>f[0]<c[0]?-1:f[0]>c[0]?1:0),d=new Map(u),h=new Map,p=!0;for(;d.size>0&&p;){p=!1;for(let[f,c]of[...d.entries()]){let g=c?.deps??[];if(!g.every(S=>h.has(S)))continue;let[b,v]=l(f),w={...c?.meta??{}},m=a(f),y;if(c?.type==="state")y=ne(c.value,{meta:w});else{if(m==null)continue;y=m(v,{path:f,type:c.type,value:c.value,meta:w,deps:g,resolvedDeps:g.map(S=>h.get(S))})}b.add(y,{name:v}),h.set(f,y),d.delete(f),p=!0}}if(d.size>0){let f=[...d.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${f}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return s.restore(t),s}toJSON(){return this.snapshot()}attachSnapshotStorage(t,r={}){let n=t.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));r.autoRestore===!0&&this._cascadeRestore(t,r.onError);let o=(u,d)=>{if(u.disposed)return;let h=It(d.nodes);if(u.lastSnapshot!=null&&h!==""&&h===u.lastFingerprint)return;let p=u.seq+1,f=Pe(),b=u.lastSnapshot==null||p%u.compactEvery===0?{name:this.name,mode:"full",snapshot:d,seq:p,timestamp_ns:f,format_version:q}:{name:this.name,mode:"diff",diff:tn(u.lastSnapshot,d),seq:p,timestamp_ns:f,format_version:q};if(u.tier.filter&&!u.tier.filter(b))return;let v;try{v=u.tier.save(b)}catch(w){r.onError?.(w,u.tier);return}if(v&&typeof v.then=="function"){let y=(u.savePending??Promise.resolve()).then(()=>v,()=>v).then(()=>{u.disposed||(u.seq=p,u.lastSnapshot=d,u.lastFingerprint=h)},S=>{r.onError?.(S,u.tier)});u.savePending=y.finally(()=>{u.savePending===y&&(u.savePending=void 0)})}else u.seq=p,u.lastSnapshot=d,u.lastFingerprint=h},s=(u,d)=>{try{o(u,d)}catch(h){r.onError?.(h,u.tier)}},i=(u,d)=>{if(!d.some(c=>{let g=this.config.messageTier(c[0]);return g>=3&&g<5}))return;if(r.filter){let c=this.tryResolve(u);if(c==null)return;let g=_e(c,re("standard"));if(!r.filter(u,g))return}let p,f=()=>(p==null&&(p=this.snapshot()),p);for(let c of n)c.disposed||(c.debounceMs===0?s(c,f()):(c.timer==null&&(c.timer=new Le),c.timer.start(c.debounceMs,()=>{c.disposed||s(c,this.snapshot())})))},a;if(r.paths!=null){let d=(typeof r.paths=="string"?this._pathsMatching(r.paths):r.paths).map(h=>{let p=this.tryResolve(h);return p==null?()=>{}:p.subscribe(f=>i(h,f))});a=()=>{for(let h of d)h()}}else a=this.observe().subscribe((u,d)=>i(u,d));let l=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(l)};return this._storageDisposers.add(l),{dispose:l}}async _cascadeRestore(t,r){for(let n of t){let o;try{o=await n.load?.()}catch(i){r?.(i,n);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let s=o;try{if(s.mode==="full"&&s.snapshot!=null)return this.restore(s.snapshot),!0;if(s.version===q&&s.nodes!=null)return this.restore(s),!0}catch(i){r?.(i,n)}}return!1}static async fromStorage(t,r,n){for(let o of r){let s;try{s=await o.load?.()}catch(l){n?.onError?.(l,o);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let i=s,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===q&&i.nodes!=null?i:void 0;if(a!=null)try{return e.fromSnapshot(a,n)}catch(l){n?.onError?.(l,o)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${t}" across ${r.length} tier(s)`)}_annotations=new Map;_traceRing;trace(t,r,n){if(t!=null&&r!=null){if(this.tryResolve(t)==null)return;if(this._annotations.set(t,r),this.config.inspectorEnabled){let o={path:t,annotation:r,timestamp_ns:K(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(o)}return}return t!=null?this.config.inspectorEnabled?this._annotations.get(t):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(t){return this._annotations.get(t)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(t){let r=this._traceRing.toArray().filter(o=>!t(o)),n=this._traceRing.size-r.length;this._traceRing.clear();for(let o of r)this._traceRing.push(o);return n}static diff(t,r){let n=new Set(Object.keys(t.nodes)),o=new Set(Object.keys(r.nodes)),s=[...o].filter(w=>!n.has(w)).sort(),i=[...n].filter(w=>!o.has(w)).sort(),a=[],l=[];for(let w of n){if(!o.has(w))continue;let m=t.nodes[w],y=r.nodes[w],S=m.v,x=y.v;S!=null&&x!=null&&S.id===x.id&&S.version!==x.version&&l.push({path:w,id:S.id,from:S.version,to:x.version});let O=S!=null&&x!=null&&S.id===x.id&&S.version===x.version;for(let _ of["type","status","sentinel"]){let R=m[_],k=y[_];R!==k&&a.push({path:w,field:_,from:R,to:k})}if(!O)for(let _ of["value","meta"]){let R=m[_],k=y[_];jt(R,k)||a.push({path:w,field:_,from:R,to:k})}}let u=w=>`${w.from} ${w.to}`,d=new Set(t.edges.map(u)),h=new Set(r.edges.map(u)),p=r.edges.filter(w=>!d.has(u(w))),f=t.edges.filter(w=>!h.has(u(w))),c=new Set(t.subgraphs),g=new Set(r.subgraphs),b=[...g].filter(w=>!c.has(w)).sort(),v=[...c].filter(w=>!g.has(w)).sort();return{nodesAdded:s,nodesRemoved:i,nodesChanged:a,versionChanges:l,edgesAdded:p,edgesRemoved:f,subgraphsAdded:b,subgraphsRemoved:v}}};function tn(e,t){let r=Ce.diff(e,t),n={};for(let o of r.nodesAdded){let s=t.nodes[o];s!=null&&(n[o]=s)}return{...r,nodesAddedFull:n}}function st(e,t,r,n={}){let o={paths:[],depths:new Map,truncated:!1};if(!t)return n.withDetail?o:[];if(!n.both&&r!=="upstream"&&r!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let s=n.maxDepth;if(s!=null&&(!Number.isInteger(s)||s<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(s===0)return n.withDetail?o:[];let i=new Map,a=new Map,l=new Map,u=new Map,d=new Set;for(let[m,y]of Object.entries(e.nodes)){if(!m)continue;d.add(m);let S=y.deps??[];i.set(m,S);for(let x of S)x&&(d.add(x),a.has(x)||a.set(x,new Set),a.get(x).add(m))}for(let m of e.edges){if(m==null||typeof m!="object")continue;let y=typeof m.from=="string"?m.from:"",S=typeof m.to=="string"?m.to:"";!y||!S||(d.add(y),d.add(S),u.has(y)||u.set(y,new Set),u.get(y).add(S),l.has(S)||l.set(S,new Set),l.get(S).add(y))}if(!d.has(t))return n.withDetail?o:[];let h=n.both===!0,p=m=>{if(h){let O=i.get(m)??[],_=l.get(m),R=a.get(m),k=u.get(m),$=[...O];return _&&$.push(..._),R&&$.push(...R),k&&$.push(...k),$}if(r==="upstream"){let O=i.get(m)??[],_=l.get(m);return _?[...O,..._]:O}let y=a.get(m),S=u.get(m),x=y?[...y]:[];return S&&x.push(...S),x},f=new Set([t]),c=new Map,g=[{path:t,depth:0}],b=0,v=!1;for(;b<g.length;){let m=g[b++];if(s!=null&&m.depth>=s){p(m.path).length>0&&(v=!0);continue}for(let y of p(m.path))!y||f.has(y)||(f.add(y),c.set(y,m.depth+1),g.push({path:y,depth:m.depth+1}))}let w=[...c.keys()].sort((m,y)=>m<y?-1:m>y?1:0);return n.withDetail?{paths:w,depths:c,truncated:v}:w}function nn(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],o=t[r];if(n.path!==o.path||n.type!==o.type||n.status!==o.status||n.hop!==o.hop||n.dep_index!==o.dep_index||n.annotation!==o.annotation||n.value!==o.value||n.lastMutation!==o.lastMutation)return!1;let s=n.v,i=o.v;if(s!==i&&(s==null||i==null||s.id!==i.id||s.version!==i.version))return!1}return!0}export{ae as a,Ie as b,A as c,ft as d,He as e,Ve as f,B as g,q as h,Wt as i,Ce as j,tn as k,st as l};
@@ -1 +0,0 @@
1
- import{b as A}from"./chunk-KUVDFOJH.js";import{j as h}from"./chunk-5KPIYVCC.js";import{E as p,m as b,p as y,t as T}from"./chunk-LYCLF26R.js";import{b as f,c as R}from"./chunk-CK2E7BTU.js";var L=T((e,r)=>{e("observe"),e("signal"),r("write")});function V(e){let r=A([],{name:e.name,maxSize:e.retainedLimit??1024,guard:e.guard??L,...e.versioning!=null?{versioning:e.versioning}:{}});return r.withLatest(),e.graph&&e.graph.add(r.entries,{name:e.name}),r}function x(e){if(e===null||typeof e!="object"||Object.isFrozen(e))return e;for(let r of Object.keys(e))x(e[r]);return Object.freeze(e)}function k(e){let n=(e.cache??0)+1;return e.down([[R],[f,n]]),n}function z(e,r){let n=r.freeze??!0;return function(...d){let o=n?d.map(x):d,s=y(),i,u,c=!1,m;try{b(()=>{r.seq&&(m=k(r.seq));try{if(i=e(...o),r.onSuccess){let t=r.onSuccess(o,i,{t_ns:s,seq:m});if(t!==void 0){let g=r.handlerVersion!=null?{...t,handlerVersion:r.handlerVersion}:t;r.audit.append(g)}}}catch(t){throw u=t,c=!0,t}})}catch(t){if(c&&r.onFailure){let g=u instanceof Error?u.name:typeof u,l=r.onFailure(o,u,{t_ns:s,seq:m,errorType:g});if(l!==void 0){let w=r.handlerVersion!=null?{...l,handlerVersion:r.handlerVersion}:l;r.audit.append(w)}}throw c?u:t}return i}}function S(e,r,n=0){let a=p(n,{name:r,describeKind:"state"});return e.add(a,{name:r}),a}function q(e,r,n,a=0){let d={},o=new h(r);for(let s of n){let i=p(a,{name:s,describeKind:"state"});o.add(i,{name:s}),d[s]=i}return e.mount(r,o),d}export{V as a,z as b,S as c,q as d};