@graphrefly/graphrefly 0.43.0 → 0.44.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 (279) hide show
  1. package/dist/{cascading-CH-_VwG9.d.cts → cascading-BglDkMdX.d.cts} +2 -2
  2. package/dist/{cascading-OgKQZjsa.d.ts → cascading-MFgxu7Yo.d.ts} +2 -2
  3. package/dist/{chunk-KVV66NN2.js → chunk-2T7U5EU6.js} +1 -1
  4. package/dist/chunk-5M4CCMMD.js +45 -0
  5. package/dist/{chunk-I7IGYPSL.js → chunk-5XJ6B66J.js} +1 -1
  6. package/dist/{chunk-OFZG3TB3.js → chunk-6X7AFUJV.js} +1 -1
  7. package/dist/{chunk-EBW4V6JN.js → chunk-7K6PWTDQ.js} +1 -1
  8. package/dist/{chunk-D27JNOLZ.js → chunk-7LIAPXJB.js} +1 -1
  9. package/dist/{chunk-CLD3F4R5.js → chunk-7WPU3UHQ.js} +1 -1
  10. package/dist/{chunk-NNKJUORL.js → chunk-A5WCQ5NO.js} +1 -1
  11. package/dist/chunk-APPIWSGD.js +84 -0
  12. package/dist/{chunk-TZQPPQEQ.js → chunk-BEZWM2SY.js} +1 -1
  13. package/dist/{chunk-K2Q24F5T.js → chunk-CB676TKJ.js} +1 -1
  14. package/dist/{chunk-SUWT3ZON.js → chunk-CE6TI2TL.js} +1 -1
  15. package/dist/{chunk-VOPGGIL7.js → chunk-CLVB32RD.js} +1 -1
  16. package/dist/{chunk-V5A7M7RJ.js → chunk-CRVT7D2P.js} +1 -1
  17. package/dist/chunk-D7GPHKFH.js +1 -0
  18. package/dist/{chunk-OCKEEPRJ.js → chunk-DHRX7JX4.js} +1 -1
  19. package/dist/chunk-FZMYDOWV.js +1 -0
  20. package/dist/{chunk-35JTVPOX.js → chunk-GHBWHMRZ.js} +1 -1
  21. package/dist/{chunk-KGKJCHEK.js → chunk-GLERH466.js} +1 -1
  22. package/dist/{chunk-TPKQW72B.js → chunk-HIDYF36O.js} +1 -1
  23. package/dist/chunk-HITNVN6B.js +3 -0
  24. package/dist/{chunk-P6C4WHZO.js → chunk-HY4DJBA7.js} +1 -1
  25. package/dist/chunk-KZIEYVXN.js +1 -0
  26. package/dist/{chunk-O2BLLH7M.js → chunk-N4MQX6JU.js} +1 -1
  27. package/dist/{chunk-4YAN45KM.js → chunk-N7FHEL4D.js} +1 -1
  28. package/dist/chunk-NTEURFZH.js +1 -0
  29. package/dist/{chunk-OYJKFY7V.js → chunk-OIVP6KFV.js} +1 -1
  30. package/dist/{chunk-Q4U3A3L5.js → chunk-OPHBU3LG.js} +1 -1
  31. package/dist/{chunk-PT7W5FCD.js → chunk-OYQOZP2F.js} +1 -1
  32. package/dist/{chunk-6HOSXQKF.js → chunk-PTZK576G.js} +1 -1
  33. package/dist/{chunk-S3EEIPO7.js → chunk-ST7UXLWR.js} +1 -1
  34. package/dist/chunk-SVY7VUYU.js +1 -0
  35. package/dist/{chunk-QYVXF7GW.js → chunk-TK3NWWD4.js} +1 -1
  36. package/dist/chunk-UNGSTR4X.js +61 -0
  37. package/dist/{chunk-VQ4A6T2A.js → chunk-VV4N5P64.js} +1 -1
  38. package/dist/{chunk-FDQGFWLF.js → chunk-W3I423PS.js} +1 -1
  39. package/dist/{chunk-XG62INFA.js → chunk-WJR24TAG.js} +1 -1
  40. package/dist/{chunk-F3IGTWCQ.js → chunk-XTGKMHSW.js} +1 -1
  41. package/dist/{chunk-JQFH2DV6.js → chunk-YBB7ZGTY.js} +1 -1
  42. package/dist/{chunk-CUNIRONA.js → chunk-Z4NPUARF.js} +1 -1
  43. package/dist/{chunk-KRH66M4O.js → chunk-ZGNQRPDT.js} +1 -1
  44. package/dist/{chunk-JNWRYDJN.js → chunk-ZKPSFFKU.js} +1 -1
  45. package/dist/{chunk-FG4TKHMC.js → chunk-ZLV5SQSX.js} +1 -1
  46. package/dist/compat/index.cjs +5 -5
  47. package/dist/compat/index.d.cts +16 -16
  48. package/dist/compat/index.d.ts +16 -16
  49. package/dist/compat/index.js +1 -1
  50. package/dist/compat/jotai/index.cjs +1 -1
  51. package/dist/compat/jotai/index.d.cts +2 -2
  52. package/dist/compat/jotai/index.d.ts +2 -2
  53. package/dist/compat/jotai/index.js +1 -1
  54. package/dist/compat/nanostores/index.cjs +1 -1
  55. package/dist/compat/nanostores/index.d.cts +2 -2
  56. package/dist/compat/nanostores/index.d.ts +2 -2
  57. package/dist/compat/nanostores/index.js +1 -1
  58. package/dist/compat/nestjs/index.cjs +5 -5
  59. package/dist/compat/nestjs/index.d.cts +8 -8
  60. package/dist/compat/nestjs/index.d.ts +8 -8
  61. package/dist/compat/nestjs/index.js +1 -1
  62. package/dist/compat/react/index.d.cts +2 -2
  63. package/dist/compat/react/index.d.ts +2 -2
  64. package/dist/compat/solid/index.d.cts +2 -2
  65. package/dist/compat/solid/index.d.ts +2 -2
  66. package/dist/compat/svelte/index.d.cts +2 -2
  67. package/dist/compat/svelte/index.d.ts +2 -2
  68. package/dist/compat/vue/index.d.cts +2 -2
  69. package/dist/compat/vue/index.d.ts +2 -2
  70. package/dist/compat/zustand/index.cjs +3 -3
  71. package/dist/compat/zustand/index.d.cts +4 -4
  72. package/dist/compat/zustand/index.d.ts +4 -4
  73. package/dist/compat/zustand/index.js +1 -1
  74. package/dist/core/index.cjs +1 -1
  75. package/dist/core/index.d.cts +3 -4
  76. package/dist/core/index.d.ts +3 -4
  77. package/dist/core/index.js +1 -1
  78. package/dist/{decay-CdEBmDIs.d.ts → decay-BvOWTZ00.d.ts} +2 -2
  79. package/dist/{decay-2ZukgQ4o.d.cts → decay-CFlLvXUT.d.cts} +2 -2
  80. package/dist/extra/browser.cjs +1 -1
  81. package/dist/extra/browser.d.cts +1 -1
  82. package/dist/extra/browser.d.ts +1 -1
  83. package/dist/extra/browser.js +1 -1
  84. package/dist/extra/index.cjs +15 -15
  85. package/dist/extra/index.d.cts +10 -10
  86. package/dist/extra/index.d.ts +10 -10
  87. package/dist/extra/index.js +1 -1
  88. package/dist/extra/node.cjs +2 -2
  89. package/dist/extra/node.d.cts +1 -1
  90. package/dist/extra/node.d.ts +1 -1
  91. package/dist/extra/node.js +1 -1
  92. package/dist/extra/operators.cjs +1 -1
  93. package/dist/extra/operators.d.cts +9 -1
  94. package/dist/extra/operators.d.ts +9 -1
  95. package/dist/extra/operators.js +1 -1
  96. package/dist/extra/reactive.cjs +1 -1
  97. package/dist/extra/reactive.d.cts +3 -3
  98. package/dist/extra/reactive.d.ts +3 -3
  99. package/dist/extra/reactive.js +1 -1
  100. package/dist/extra/render/index.d.cts +3 -3
  101. package/dist/extra/render/index.d.ts +3 -3
  102. package/dist/extra/sources.cjs +3 -3
  103. package/dist/extra/sources.d.cts +1 -1
  104. package/dist/extra/sources.d.ts +1 -1
  105. package/dist/extra/sources.js +1 -1
  106. package/dist/extra/storage-browser.cjs +1 -1
  107. package/dist/extra/storage-browser.d.cts +1 -1
  108. package/dist/extra/storage-browser.d.ts +1 -1
  109. package/dist/extra/storage-browser.js +1 -1
  110. package/dist/{fallback-Ctlj2tMY.d.cts → fallback-74oxi34l.d.cts} +1 -1
  111. package/dist/{fallback-CqYVLL6X.d.ts → fallback-DUyyBTBK.d.ts} +1 -1
  112. package/dist/graph/index.cjs +7 -7
  113. package/dist/graph/index.d.cts +5 -5
  114. package/dist/graph/index.d.ts +5 -5
  115. package/dist/graph/index.js +1 -1
  116. package/dist/{graph-C4SHb3Ly.d.cts → graph-CWvEUQAq.d.cts} +196 -3
  117. package/dist/{graph-7VguS7a4.d.ts → graph-D9LFnda9.d.ts} +196 -3
  118. package/dist/{index-O7fucFrU.d.cts → index-5k1T6jl0.d.cts} +9 -9
  119. package/dist/{index-DyR7eU5S.d.cts → index-9770hRuQ.d.cts} +4 -4
  120. package/dist/{index-COD1kVoS.d.cts → index-B-_tFaqV.d.cts} +4 -4
  121. package/dist/{index-CLon-IWF.d.cts → index-B17QddL1.d.cts} +4 -4
  122. package/dist/{index-B-i4_g3k.d.ts → index-B1F8Enjf.d.ts} +61 -8
  123. package/dist/{index-DBevwHj_.d.ts → index-B5S8ULbU.d.ts} +3 -3
  124. package/dist/{index-Dgs8zcj7.d.ts → index-B8YnZpIR.d.ts} +2 -2
  125. package/dist/{index-DSZ3ZCHF.d.ts → index-BHskSB8v.d.ts} +28 -17
  126. package/dist/{index-CDXc9zKM.d.cts → index-BIYAkbAi.d.cts} +1 -1
  127. package/dist/{index-C9kSENB4.d.cts → index-BQSKmbuG.d.cts} +1 -1
  128. package/dist/{index-tJoTcnHh.d.cts → index-BaQaY_IQ.d.cts} +2 -2
  129. package/dist/{index-CJK1JkYy.d.ts → index-BmZXHqkE.d.ts} +1 -1
  130. package/dist/{index-K0_0eR8g.d.ts → index-BoJ5JHxI.d.ts} +3 -3
  131. package/dist/{index-JZUPJIJy.d.ts → index-BocU7pqs.d.ts} +4 -4
  132. package/dist/{index-ChOyVLKm.d.cts → index-BrPrLl4e.d.cts} +1 -1
  133. package/dist/{index-BiX1Nkgx.d.cts → index-BxNs2HB9.d.cts} +22 -8
  134. package/dist/{index-Bf7eqeSF.d.ts → index-Byu-OpX_.d.ts} +2 -2
  135. package/dist/{index-BoLv_OfD.d.cts → index-C1T3d7V-.d.cts} +61 -8
  136. package/dist/{index-BTQtTb_H.d.cts → index-C5ri2Axc.d.cts} +3 -3
  137. package/dist/{index-z96luz5O.d.cts → index-C5stwKcw.d.cts} +1 -1
  138. package/dist/{index-D4Y1cMG0.d.ts → index-C9l6OEBL.d.ts} +1 -1
  139. package/dist/{index-CCq87F7t.d.ts → index-CBBLl_rc.d.ts} +1 -1
  140. package/dist/{index-cm1GNcWE.d.ts → index-CBGUK09R.d.ts} +4 -4
  141. package/dist/{index-0rKFCVFp.d.cts → index-CC-AvFTy.d.cts} +3 -3
  142. package/dist/{index-C59mYFKp.d.ts → index-CJF1URuX.d.ts} +9 -9
  143. package/dist/{index-BJX94aud.d.cts → index-CK29LV56.d.cts} +1 -1
  144. package/dist/{index-BP8a88zx.d.ts → index-CMh5Rz1y.d.ts} +4 -4
  145. package/dist/{index-CvrqGfNS.d.ts → index-CPQlGA29.d.ts} +1 -1
  146. package/dist/{index-D-AEQVLo.d.ts → index-CR8QpwX8.d.ts} +49 -24
  147. package/dist/{index-Du7u1lSf.d.cts → index-CS0LTlB8.d.cts} +4 -4
  148. package/dist/{index-Bc41FuHp.d.cts → index-CSOmP7xT.d.cts} +2 -2
  149. package/dist/{index-BsT7F2et.d.ts → index-CYq8vAyV.d.ts} +2 -2
  150. package/dist/{index-CPT7C_f1.d.ts → index-CZ3r5Rxp.d.ts} +4 -4
  151. package/dist/{index-BojK2fwH.d.cts → index-CasX6Pfq.d.cts} +68 -9
  152. package/dist/{index-BG0BN3PB.d.ts → index-CdAlHFEt.d.ts} +1 -1
  153. package/dist/{index-wAzD9yVj.d.ts → index-CdTelp1M.d.ts} +8 -4
  154. package/dist/{index-CQG3D1cp.d.ts → index-CeFiHtAg.d.ts} +4 -4
  155. package/dist/{index-RV_yDjOX.d.cts → index-Cj3WohTd.d.cts} +8 -4
  156. package/dist/{index-BAOD98JD.d.cts → index-Climxqsu.d.cts} +4 -4
  157. package/dist/{index-O16yXPK4.d.cts → index-Co7uli2l.d.cts} +28 -17
  158. package/dist/{index-DIOoAZUX.d.ts → index-CviRnE4K.d.ts} +1 -1
  159. package/dist/{index-Dhc7a7Xo.d.cts → index-Cwv0KWcU.d.cts} +2 -2
  160. package/dist/{index-Dn-wI9g4.d.ts → index-CzLVrjxn.d.ts} +2 -2
  161. package/dist/{index-C9pjcz3l.d.cts → index-D0aciIex.d.cts} +3 -3
  162. package/dist/{index-DwigL4lY.d.ts → index-DHen9Klo.d.ts} +22 -8
  163. package/dist/{index-BwLvVVsy.d.cts → index-DV_1YuVk.d.cts} +40 -8
  164. package/dist/{index-BdGtBX-X.d.cts → index-Dc4AYqrJ.d.cts} +3 -3
  165. package/dist/{index-Dmqp7KjD.d.ts → index-Dgl1HpPn.d.ts} +1 -1
  166. package/dist/{index-CAC_rNzm.d.ts → index-DisjX8a-.d.ts} +40 -8
  167. package/dist/{index-B5iz82A3.d.cts → index-UPSiS-X7.d.cts} +49 -24
  168. package/dist/{index-CZQXo5tH.d.ts → index-Yq60JP3s.d.ts} +3 -3
  169. package/dist/{index-f5IivDUX.d.cts → index-ZVQhLa2i.d.cts} +1 -1
  170. package/dist/{index-hHcaFlJX.d.cts → index-_6ODbuOu.d.cts} +1 -1
  171. package/dist/{index-BVpm6noz.d.cts → index-hcDJ8PSI.d.cts} +1 -1
  172. package/dist/{index-DBHK8O6H.d.ts → index-nozs3fFC.d.ts} +3 -3
  173. package/dist/{index-Dh_HJ82K.d.ts → index-p09KSrTN.d.ts} +68 -9
  174. package/dist/{index-C7O6r5fV.d.ts → index-sqkqlb1p.d.ts} +1 -1
  175. package/dist/{index-CZjOhcBy.d.cts → index-tRCxuAXF.d.cts} +2 -2
  176. package/dist/index.cjs +48 -48
  177. package/dist/index.d.cts +42 -43
  178. package/dist/index.d.ts +42 -43
  179. package/dist/index.js +1 -1
  180. package/dist/{node-ClS5yC-B.d.cts → node-kK3CvTrR.d.cts} +1 -1
  181. package/dist/{node-ClS5yC-B.d.ts → node-kK3CvTrR.d.ts} +1 -1
  182. package/dist/{observable-BsBzUrcI.d.ts → observable-DWjNfLvC.d.ts} +1 -1
  183. package/dist/{observable-DLGPPtb8.d.cts → observable-e3eiPPFy.d.cts} +1 -1
  184. package/dist/patterns/ai/browser.cjs +5 -5
  185. package/dist/patterns/ai/browser.d.cts +4 -4
  186. package/dist/patterns/ai/browser.d.ts +4 -4
  187. package/dist/patterns/ai/browser.js +1 -1
  188. package/dist/patterns/ai/index.cjs +16 -16
  189. package/dist/patterns/ai/index.d.cts +16 -17
  190. package/dist/patterns/ai/index.d.ts +16 -17
  191. package/dist/patterns/ai/index.js +1 -1
  192. package/dist/patterns/ai/node.cjs +1 -1
  193. package/dist/patterns/ai/node.d.cts +4 -4
  194. package/dist/patterns/ai/node.d.ts +4 -4
  195. package/dist/patterns/ai/node.js +1 -1
  196. package/dist/patterns/cqrs/index.cjs +3 -3
  197. package/dist/patterns/cqrs/index.d.cts +6 -6
  198. package/dist/patterns/cqrs/index.d.ts +6 -6
  199. package/dist/patterns/cqrs/index.js +1 -1
  200. package/dist/patterns/demo-shell/index.cjs +5 -5
  201. package/dist/patterns/demo-shell/index.d.cts +5 -5
  202. package/dist/patterns/demo-shell/index.d.ts +5 -5
  203. package/dist/patterns/demo-shell/index.js +1 -1
  204. package/dist/patterns/domain-templates/index.cjs +3 -3
  205. package/dist/patterns/domain-templates/index.d.cts +4 -4
  206. package/dist/patterns/domain-templates/index.d.ts +4 -4
  207. package/dist/patterns/domain-templates/index.js +1 -1
  208. package/dist/patterns/graphspec/index.cjs +16 -16
  209. package/dist/patterns/graphspec/index.d.cts +5 -5
  210. package/dist/patterns/graphspec/index.d.ts +5 -5
  211. package/dist/patterns/graphspec/index.js +1 -1
  212. package/dist/patterns/harness/index.cjs +9 -9
  213. package/dist/patterns/harness/index.d.cts +10 -11
  214. package/dist/patterns/harness/index.d.ts +10 -11
  215. package/dist/patterns/harness/index.js +1 -1
  216. package/dist/patterns/inspect/index.cjs +3 -3
  217. package/dist/patterns/inspect/index.d.cts +7 -7
  218. package/dist/patterns/inspect/index.d.ts +7 -7
  219. package/dist/patterns/inspect/index.js +1 -1
  220. package/dist/patterns/job-queue/index.cjs +3 -3
  221. package/dist/patterns/job-queue/index.d.cts +6 -6
  222. package/dist/patterns/job-queue/index.d.ts +6 -6
  223. package/dist/patterns/job-queue/index.js +1 -1
  224. package/dist/patterns/memory/index.cjs +3 -3
  225. package/dist/patterns/memory/index.d.cts +6 -6
  226. package/dist/patterns/memory/index.d.ts +6 -6
  227. package/dist/patterns/memory/index.js +1 -1
  228. package/dist/patterns/messaging/index.cjs +3 -3
  229. package/dist/patterns/messaging/index.d.cts +5 -5
  230. package/dist/patterns/messaging/index.d.ts +5 -5
  231. package/dist/patterns/messaging/index.js +1 -1
  232. package/dist/patterns/orchestration/index.cjs +3 -3
  233. package/dist/patterns/orchestration/index.d.cts +6 -7
  234. package/dist/patterns/orchestration/index.d.ts +6 -7
  235. package/dist/patterns/orchestration/index.js +1 -1
  236. package/dist/patterns/process/index.cjs +3 -1
  237. package/dist/patterns/process/index.d.cts +7 -7
  238. package/dist/patterns/process/index.d.ts +7 -7
  239. package/dist/patterns/process/index.js +1 -1
  240. package/dist/patterns/reactive-layout/index.cjs +4 -4
  241. package/dist/patterns/reactive-layout/index.d.cts +5 -5
  242. package/dist/patterns/reactive-layout/index.d.ts +5 -5
  243. package/dist/patterns/reactive-layout/index.js +1 -1
  244. package/dist/patterns/reduction/index.cjs +3 -3
  245. package/dist/patterns/reduction/index.d.cts +4 -4
  246. package/dist/patterns/reduction/index.d.ts +4 -4
  247. package/dist/patterns/reduction/index.js +1 -1
  248. package/dist/patterns/surface/index.cjs +10 -10
  249. package/dist/patterns/surface/index.d.cts +6 -6
  250. package/dist/patterns/surface/index.d.ts +6 -6
  251. package/dist/patterns/surface/index.js +1 -1
  252. package/dist/{pipeline-graph-DPqKDk59.d.cts → pipeline-graph-CIKhynsF.d.cts} +11 -6
  253. package/dist/{pipeline-graph-loP57TBA.d.ts → pipeline-graph-Sgj0gCwn.d.ts} +11 -6
  254. package/dist/{reactive-layout-v7KPvxoc.d.ts → reactive-layout-DOTs9P3X.d.ts} +2 -2
  255. package/dist/{reactive-layout-Dsvob4zD.d.cts → reactive-layout-DgctbqZo.d.cts} +2 -2
  256. package/dist/{reactive-log-BezYsbA_.d.ts → reactive-log-BKALbfal.d.ts} +1 -1
  257. package/dist/{reactive-log-B00laMSQ.d.cts → reactive-log-DIGdYqQ6.d.cts} +1 -1
  258. package/dist/{reactive-map-48mnZ-nu.d.cts → reactive-map-CEFGp8TK.d.cts} +1 -1
  259. package/dist/{reactive-map-BVVPdvmi.d.ts → reactive-map-DS_SIAxv.d.ts} +1 -1
  260. package/dist/resilience-6LYQJAC5.js +1 -0
  261. package/dist/{sugar-DLwvMr3F.d.ts → sugar-DQjFmVqb.d.cts} +178 -2
  262. package/dist/{sugar-DyVGtczU.d.cts → sugar-fhLIE7TT.d.ts} +178 -2
  263. package/dist/{topology-tree-BSdfSwMi.d.cts → topology-tree-Bcz27hpF.d.cts} +1 -1
  264. package/dist/{topology-tree-BNGvuG82.d.ts → topology-tree-xvaD0fOX.d.ts} +1 -1
  265. package/dist/{types-B1jDWVsM.d.cts → types-C0_yquda.d.cts} +1 -1
  266. package/dist/{types-DkzUUs0H.d.ts → types-CWFysE9E.d.ts} +1 -1
  267. package/package.json +1 -1
  268. package/dist/chunk-3XDYJRYU.js +0 -1
  269. package/dist/chunk-4I45FVQS.js +0 -1
  270. package/dist/chunk-626TESAC.js +0 -3
  271. package/dist/chunk-INQD2KRQ.js +0 -1
  272. package/dist/chunk-LYCLF26R.js +0 -1
  273. package/dist/chunk-NON4NLIC.js +0 -45
  274. package/dist/chunk-QE4IGY7I.js +0 -61
  275. package/dist/chunk-VNC3TMVY.js +0 -1
  276. package/dist/chunk-Y4NI3X7O.js +0 -84
  277. package/dist/meta-BgVAsg9j.d.ts +0 -102
  278. package/dist/meta-vE8bxW1E.d.cts +0 -102
  279. package/dist/resilience-YIWPK4YC.js +0 -1
@@ -1,3 +1,3 @@
1
- "use strict";var Qe=Object.defineProperty;var kn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var xn=Object.prototype.hasOwnProperty;var V=(r,e)=>()=>(r&&(e=r(r=0)),e);var On=(r,e)=>{for(var t in e)Qe(r,t,{get:e[t],enumerable:!0})},Rn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Nn(e))!xn.call(r,s)&&s!==t&&Qe(r,s,{get:()=>e[s],enumerable:!(n=kn(e,s))||n.enumerable});return r};var En=r=>Rn(Qe({},"__esModule",{value:!0}),r);function Le(){return ve>0||De}function kt(){return ve>0}function we(r){ve>0?Ce.push(r):r()}function ae(r){ve+=1;let e=!1;try{r()}catch(t){throw e=!0,t}finally{if(ve-=1,ve===0)if(e){if(!De){let t=Ce.splice(0);for(let n of t)try{n()}catch{}pe.length=0,he.length=0,_e.length=0}}else Sn()}}function Sn(){let r=!De;r&&(De=!0);let e=[],t=0;try{for(;pe.length>0||he.length>0||_e.length>0||r&&Ce.length>0;){if(r&&Ce.length>0){let o=Ce.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw pe.length=0,he.length=0,_e.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(pe.length>0?pe:he.length>0?he:_e).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{r&&(De=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Ve(r,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!Le()){r(e);return}(u>=5?_e:u===4?he:pe).push(()=>r(e));return}let n=e.length,s=n,o=n,i=n,a=0;for(;a<n&&t(e[a][0])<3;)a++;for(s=a;a<n&&t(e[a][0])===3;)a++;for(o=a;a<n&&t(e[a][0])===4;)a++;i=a;let d=Le();if(s>0){let u=e.slice(0,s);r(u)}if(o>s){let u=e.slice(s,o);d?pe.push(()=>r(u)):r(u)}if(i>o){let u=e.slice(o,i);d?he.push(()=>r(u)):r(u)}if(n>i){let u=e.slice(i,n);d?_e.push(()=>r(u)):r(u)}}var ve,De,pe,he,_e,Ce,Te=V(()=>{"use strict";ve=0,De=!1,pe=[],he=[],_e=[],Ce=[]});function de(){return Math.trunc(performance.now()*1e6)}function ce(){return Date.now()*1e6}var ke=V(()=>{"use strict"});var Me,$,q,U,te,ie,le,B,H,I,Ne,et,An,tt,Dn,Cn,nt,Nt,xt,Ot,rt,ge=V(()=>{"use strict";Me=Symbol.for("graphrefly/START"),$=Symbol.for("graphrefly/DATA"),q=Symbol.for("graphrefly/DIRTY"),U=Symbol.for("graphrefly/RESOLVED"),te=Symbol.for("graphrefly/INVALIDATE"),ie=Symbol.for("graphrefly/PAUSE"),le=Symbol.for("graphrefly/RESUME"),B=Symbol.for("graphrefly/TEARDOWN"),H=Symbol.for("graphrefly/COMPLETE"),I=Symbol.for("graphrefly/ERROR"),Ne=Object.freeze([q]),et=Object.freeze([U]),An=Object.freeze([te]),tt=Object.freeze([Me]),Dn=Object.freeze([H]),Cn=Object.freeze([B]),nt=Object.freeze([Ne]),Nt=Object.freeze([et]),xt=Object.freeze([An]),Ot=Object.freeze([Dn]),rt=Object.freeze([Cn])});function Rt(r){return Array.isArray(r)?[...r]:[r]}function Mn(r,e){return r.has(e)||r.has("*")}function Et(r){let e=[];return r((s,o)=>{e.push({kind:"allow",actions:new Set(Rt(s)),where:o?.where??(()=>!0)})},(s,o)=>{e.push({kind:"deny",actions:new Set(Rt(s)),where:o?.where??(()=>!0)})}),(s,o)=>{let i=!1,a=!1;for(let d of e)Mn(d.actions,o)&&d.where(s)&&(d.kind==="deny"?i=!0:a=!0);return i?!1:a}}function st(r){let e=Gn.filter(t=>r({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var Q,Gn,Ge=V(()=>{"use strict";Q=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};Gn=["human","llm","wallet","system"]});function At(r,e){let t=new TextEncoder().encode(r.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${r.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let n=r.version;if(!Number.isInteger(n)||n<0||n>65535)throw new Error(`encodeEnvelope: codec.version ${n} out of u16 range (expected integer 0\u201365535)`);let s=2+t.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=ot,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=n>>>8&255,o[i++]=n&255,o.set(e,i),o}function Dt(r,e){if(r.length<St)throw new Error(`decodeEnvelope: bytes too short (${r.length} < ${St})`);let t=0,n=r[t++];if(n!==ot)throw new Error(`decodeEnvelope: unsupported envelope version ${n} (expected ${ot})`);let s=r[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>r.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${r.length})`);let o=new TextDecoder().decode(r.subarray(t,t+s));t+=s;let i=(r[t]<<8|r[t+1])>>>0;t+=2;let a=r.subarray(t),d=e.lookupCodec(o);if(d==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:d,codecVersion:i,payload:a}}function Ct(r){r.registerCodec(Pn)}var Pn,ot,St,it=V(()=>{"use strict";Pn={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let t=new TextDecoder().decode(r);return JSON.parse(t)}},ot=1,St=4});function ze(r){if(r==null)return xe;let{type:e,id:t,...n}=r;return{type:e??"system",id:t??"",...n}}var xe,at=V(()=>{"use strict";xe={type:"system",id:""}});function Mt(r){r.registerMessageType(Me,{tier:0,wireCrossing:!1}),r.registerMessageType(q,{tier:1,wireCrossing:!1}),r.registerMessageType(te,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(ie,{tier:2,wireCrossing:!1}),r.registerMessageType(le,{tier:2,wireCrossing:!1}),r.registerMessageType($,{tier:3,wireCrossing:!0}),r.registerMessageType(U,{tier:3,wireCrossing:!0}),r.registerMessageType(H,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(I,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(B,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var je,Gt=V(()=>{"use strict";ge();je=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let n=this._messageTypes.get(t);return n!=null?n.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function dt(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(dt);if(typeof r=="object"&&r!==null){let e={};for(let t of Object.keys(r).sort())e[t]=dt(r[t]);return e}return null}function Fn(r){let e=In.encode(r),t=e.length,n=t*8,s=t+9+63&-64,o=new Uint8Array(s);o.set(e),o[t]=128;let i=new DataView(o.buffer);i.setUint32(s-4,n>>>0,!1),i.setUint32(s-8,Math.floor(n/4294967296)>>>0,!1);let a=1779033703,d=3144134277,u=1013904242,l=2773480762,h=1359893119,p=2600822924,f=528734635,c=1541459225,v=new Uint32Array(64),g=(y,b)=>y>>>b|y<<32-b;for(let y=0;y<s;y+=64){for(let N=0;N<16;N++)v[N]=i.getUint32(y+N*4,!1);for(let N=16;N<64;N++){let S=v[N-15],G=v[N-2],M=g(S,7)^g(S,18)^S>>>3,se=g(G,17)^g(G,19)^G>>>10;v[N]=v[N-16]+M+v[N-7]+se>>>0}let b=a,_=d,w=u,x=l,m=h,T=p,O=f,E=c;for(let N=0;N<64;N++){let S=g(m,6)^g(m,11)^g(m,25),G=m&T^~m&O,M=E+S+G+$n[N]+v[N]>>>0,se=g(b,2)^g(b,13)^g(b,22),ee=b&_^b&w^_&w,ye=se+ee>>>0;E=O,O=T,T=m,m=x+M>>>0,x=w,w=_,_=b,b=M+ye>>>0}a=a+b>>>0,d=d+_>>>0,u=u+w>>>0,l=l+x>>>0,h=h+m>>>0,p=p+T>>>0,f=f+O>>>0,c=c+E>>>0}let k=y=>y.toString(16).padStart(8,"0");return k(a)+k(d)+k(u)+k(l)+k(h)+k(p)+k(f)+k(c)}function ut(r){let e=dt(r??null),t=JSON.stringify(e);return Fn(t).slice(0,16)}function Ln(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function ct(r,e,t){let n=t?.id??Ln();if(r===0)return{id:n,version:0};let o=(t?.hash??ut)(e);return{id:n,version:0,cid:o,prev:null}}function Pt(r,e,t){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=t(e))}var $n,In,$t=V(()=>{"use strict";$n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),In=new TextEncoder});function Lt(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function lt(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function Be(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function ue(r,e,t){let n=Vt(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return Vt(r)?o=(ft(e)?e:t)??{}:ft(r)?o=r:o=(ft(e)?e:t)??{},new z(n,s,o)}var It,Ft,Vn,zn,Oe,z,Vt,ft,me=V(()=>{"use strict";it();at();Te();ke();Gt();Ge();ge();$t();It=()=>{},Ft=100;Vn=(r,e,t,n)=>{t.direction==="down-in"&&r._onDepMessage(t.depIndex,e)},zn=(r,e,t,n)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[tt]:[tt,[$,o]];s._status==="dirty"&&i.push(Ne),Ve(e,i,s._config.tierOf)},Oe=new je({onMessage:Vn,onSubscribe:zn});Mt(Oe);Ct(Oe);z=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,n){this._config=n.config??Oe,this._config.onMessage,this._optsName=n.name,this._describeKind=n.describeKind,this._equals=n.equals??Object.is,this._resubscribable=n.resubscribable??!1,this._resetOnTeardown=n.resetOnTeardown??!1,this._autoComplete=n.completeWhenDepsComplete??!0,this._autoError=n.errorWhenDepsError??!0,this._pausable=n.pausable??!0,this._guard=n.guard,this._fn=t,this._partial=n.partial??!1,this._cached=n.initial!==void 0?n.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=n.versioningHash??this._config.defaultHashFn??ut;let s=n.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?ct(s,this._cached===void 0?void 0:this._cached,{id:n.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Lt);let o={};for(let[a,d]of Object.entries(n.meta??{})){let u={initial:d,name:`${n.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};n.guard!=null&&(u.guard=n.guard),o[a]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[$,a]])},down(a){i._emit(Be(a))},up(a){i._emitUp(Be(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let n=this._versioningLevel;if(n!=null&&e<=n)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,d=i?.version??0,u=ct(e,o,{id:a,hash:s});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=ze(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let n of this._extraGuards)if(!n(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,n=e?.actor!=null;if(!t&&!n)return;let s=ze(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new Q({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new Q({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:ce()}}down(e,t){let n=Be(e);n.length!==0&&(this._checkGuard(t),this._emit(n))}emit(e,t){this._checkGuard(t),this._emit([[$,e]])}up(e,t){if(this._deps.length===0)return;let n=Be(e);if(n.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(n);for(let o of this._deps)o.node.up?.(n,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let n of e){let s=t(n[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=ze(t);if(!this._guard(d,"observe"))throw new Q({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)lt(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let n=0;n<e;n++){let s=n,o=this._deps[n];o.unsub=It,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,d=!1;for(let u of i)a(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(n){this._deps[t].unsub=null;for(let s=0;s<t;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}lt(o)}}throw this._dirtyDepCount=0,n}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,n=Lt(e);if(this._deps.push(n),this._sinks==null)return t;n.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(nt),n.unsub=It;try{n.unsub=e.subscribe(s=>{if(n.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw n.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(n){this._emit([[I,this._wrapFnError("cleanup threw",n)]])}else if(t!=null&&typeof t=="object"){let n=t.deactivate;if(typeof n=="function")try{n()}catch(s){this._emit([[I,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let n of this._deps){if(n.unsub!=null){let s=n.unsub;n.unsub=null;try{s()}catch{}}lt(n)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let n=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(o)}if(s!==Me){if(s===q){this._depDirtied(n);return}if(s===te){if(this._depInvalidated(n),this._cached===void 0)return;this._emit(xt);return}if(s===ie||s===le){this._emit([t]);return}if(s===B){this._emit(rt);return}if(s===$)this._depSettledAsData(n,t[1]);else if(s===U)this._depSettledAsResolved(n);else if(s===H)this._depSettledAsTerminal(n,!0);else if(s===I)this._depSettledAsTerminal(n,t[1]);else{this._emit([t]);return}if(!this._fn){(s===$||s===U)&&this._emit([t]),(s===H||s===I)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(nt))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Nt),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[I,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(Ot)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(i){this._emit([[I,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[I,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),n=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let s=this._deps.map(i=>i.terminal),o={prevData:n,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:n};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,o);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[I,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ft?(this._rerunDepth=0,this._emit([[I,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ft} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let n=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${n}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[Ne,e[0]]:e;let n=!0,s=!1,o=!1,i=-1;for(let d of e){let u=t(d[0]);u<i&&(n=!1),u===3&&(s=!0),d[0]===q&&(o=!0),i=u}let a=e;if(!n){let d=e.map((u,l)=>({m:u,i:l,tier:t(u[0])}));d.sort((u,l)=>u.tier-l.tier||u.i-l.i),a=d.map(u=>u.m)}if(s&&!o&&this._status!=="dirty"){let d=0;for(;d<a.length&&t(a[d][0])===0;)d++;return d===0?[Ne,...a]:[...a.slice(0,d),Ne,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let d=e[a];if(d[0]===I&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(d=>d[0]===B||d[0]===te);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let d=t[a],u=d[0];if(u!==ie&&u!==le){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===ie?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let h=d[1];if(u===ie)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(h),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(h))l=!1;else if(this._pauseLocks.delete(h),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let p=this._pauseBuffer;this._pauseBuffer=[],this._emit(p)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?s?.push(d):s==null&&(s=t.slice(0,a))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(a=>a[0]===B))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(rt)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let u of o)a(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[I,i]])}_updateState(e){let t=this._config.tierOf,n,s,o=-1,i=0;for(let l of e)t(l[0])===3&&i++;let a=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===$){d=l;break}}for(let l=0;l<e.length;l++){let h=e[l],p=h[0];if(p===$){if(h.length>=2){let f=!1;if(a&&this._cached!==void 0)try{f=this._equals(this._cached,h[1])}catch(c){s=this._wrapFnError("equals threw",c),o=l;break}if(f){n==null&&(n=e.slice(0,l)),n.push(et),this._status="resolved";continue}this._cached=h[1],this._versioning!=null&&(d<0||l===d)&&Pt(this._versioning,h[1],this._hashFn)}this._status="settled",n?.push(h)}else if(n?.push(h),p===q)this._status="dirty";else if(p===U)this._status="resolved";else if(p===H){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===I){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===te){if(this._cached!==void 0){let c=this._config.rigorRecorder;if(c!=null)try{c.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let c=f.invalidate;if(typeof c=="function")try{c()}catch{}}}else p===B&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?n??e.slice(0,o):n??e;return s!=null?{finalMessages:u,equalsError:s}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let n of t)n(e)};_dispatchOrAccumulate(e){if(kt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],we(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}Ve(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);Ve(this._deliverToSinks,t,this._config.tierOf)}},Vt=r=>Array.isArray(r),ft=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function ht(r,e){if(e!=null&&e.length>0)return new Set(e);switch(r){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function jn(r){return r._describeKind!=null?r._describeKind:r._deps.length>0?"derived":r._fn!=null?"producer":"state"}function zt(r){let e=new WeakSet,t={};for(let[n,s]of jt(r))t[n]=pt(s,e);return t}function pt(r,e){if(r==null)return r;let t=typeof r;if(t==="boolean"||t==="number"||t==="string")return r;if(t==="function")return"<function>";if(Array.isArray(r))return e.has(r)?"<cycle>":(e.add(r),r.map(n=>pt(n,e)));if(t==="object"){let n=r;if(e.has(n))return"<cycle>";e.add(n);try{if(typeof n.subscribe=="function"&&"cache"in n)return"<Node>"}catch{return"<unserializable>"}let s={};for(let[o,i]of jt(n))s[o]=pt(i,e);return s}return"<unserializable>"}function jt(r){let e=[],t;try{t=Object.keys(r)}catch{return e}for(let n of t)try{e.push([n,r[n]])}catch{e.push([n,"<unserializable>"])}return e}function Bn(r){let e={};for(let[t,n]of Object.entries(r.meta))try{e[t]=n.cache}catch{}return e}function gt(r,e,t){let n=e==null,s=!n&&e!=null?[...e].filter(l=>l.startsWith("meta.")).map(l=>l.slice(5)):null,o=n||e.has("meta")||s!=null&&s.length>0,i="state",a=[];r instanceof z&&(i=jn(r),a=r._deps.map(l=>l.node.name??""));let d={type:i,deps:a};(n||e.has("status"))&&(d.status=r.status);let u=r instanceof z?r._guard:void 0;if(o){let l={...Bn(r)};if(u!=null&&l.access===void 0&&(l.access=st(u)),s!=null&&s.length>0&&!e.has("meta")){let h={};for(let p of s)p in l&&(h[p]=l[p]);d.meta=h}else d.meta=l}if(r.name!=null&&(d.name=r.name),(n||e.has("value"))&&(!t||i==="state")){r.status==="sentinel"&&(d.sentinel=!0);try{d.value=r.cache}catch{}}if((n||e.has("v"))&&r.v!=null){let l={id:r.v.id,version:r.v.version};"cid"in r.v&&(l.cid=r.v.cid,l.prev=r.v.prev),d.v=l}return(n||e.has("guard"))&&u!=null&&(d.guard=st(u)),(n||e.has("lastMutation"))&&r.lastMutation!=null&&(d.lastMutation=r.lastMutation),d}var mt=V(()=>{"use strict";Ge();me()});function ne(r,e){return ue([],{...e,initial:r})}function bt(r,e){return ue((n,s,o)=>r(s,o)??void 0,{describeKind:"producer",...e})}function J(r,e,t){return ue(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);o.emit(e(a,i))},{describeKind:"derived",...t})}var He=V(()=>{"use strict";me()});function Bt(r,e,t){return{[r]:!0,[`${r}_type`]:e,...t??{}}}var Ht=V(()=>{"use strict"});function yt(r,e){if(Object.is(r,e))return!0;if(r==null||e==null||typeof r!="object"||typeof e!="object")return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!yt(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;let s=new Set(n);for(let o of t)if(!s.has(o)||!yt(r[o],e[o]))return!1;return!0}function Wt(r,e){return`${r}\0${e}`}function vt(r,e){let t=[],n=new Set(r.subgraphs),s=new Set(e.subgraphs),o=[];for(let g of s)n.has(g)||o.push(g);o.sort();for(let g of o)t.push({type:"subgraph-mounted",path:g});let i=new Set(Object.keys(r.nodes)),a=new Set(Object.keys(e.nodes)),d=[];for(let g of a)i.has(g)||d.push(g);d.sort();for(let g of d)t.push({type:"node-added",path:g,node:{...e.nodes[g]}});let u=[];for(let g of a){if(!i.has(g))continue;let k=r.nodes[g]?.meta,y=e.nodes[g]?.meta;k==null&&y==null||yt(k??{},y??{})||u.push(g)}u.sort();for(let g of u)t.push({type:"node-meta-changed",path:g,prevMeta:r.nodes[g]?.meta??{},nextMeta:e.nodes[g]?.meta??{}});let l=new Map;for(let g of r.edges)l.set(Wt(g.from,g.to),g);let h=new Map;for(let g of e.edges)h.set(Wt(g.from,g.to),g);let p=[];for(let[g,k]of h)l.has(g)||p.push(k);p.sort((g,k)=>g.from<k.from?-1:g.from>k.from?1:g.to<k.to?-1:g.to>k.to?1:0);for(let g of p)t.push({type:"edge-added",from:g.from,to:g.to});let f=[];for(let[g,k]of l)h.has(g)||f.push(k);f.sort((g,k)=>g.from<k.from?-1:g.from>k.from?1:g.to<k.to?-1:g.to>k.to?1:0);for(let g of f)t.push({type:"edge-removed",from:g.from,to:g.to});let c=[];for(let g of i)a.has(g)||c.push(g);c.sort();for(let g of c)t.push({type:"node-removed",path:g});let v=[];for(let g of n)s.has(g)||v.push(g);v.sort();for(let g of v)t.push({type:"subgraph-unmounted",path:g});return{events:t,flushedAt_ns:de()}}var Ut=V(()=>{"use strict";ke()});function We(r){return r.subscribe(()=>{})}var Kt=V(()=>{"use strict"});var qt=V(()=>{"use strict";Kt()});var Ue,Yt=V(()=>{"use strict";Ue=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Pe,Jt=V(()=>{"use strict";Pe=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function Xt(r,e,t,n={}){let s=e in r.nodes,o=t in r.nodes;if(!s)return Ke(e,t,"no-such-from");if(!o)return Ke(e,t,"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(e===t){if(n.findCycle===!0){let u=Hn(r,e,n);if(u!=null)return u}let d=qe(e,r.nodes[e],0,n);return Ye(e,t,[d])}if(i===0)return Ke(e,t,"no-path");let a=Zt(r,e,t,i);return a.found?Ye(e,t,Qt(r,a.pathOrder,n)):Ke(e,t,a.truncated?"max-depth-exceeded":"no-path")}function Zt(r,e,t,n){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,d=!1;for(;a<o.length;){let h=o[a++];if(h.path===e)break;if(n!=null&&h.depth>=n){let v=r.nodes[h.path];v?.deps&&v.deps.length>0&&(d=!0);continue}let p=r.nodes[h.path];if(p==null)continue;let f=p.deps??[],c=new Map;for(let v=0;v<f.length;v++){let g=f[v];if(!g)continue;let k=c.get(g);k==null&&(k=[],c.set(g,k)),k.push(v)}for(let[v,g]of c)i.has(v)||(i.add(v),s.set(v,{from:h.path,depIndices:g}),o.push({path:v,depth:h.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:d};let u=[{path:e}],l=e;for(;l!==t;){let h=s.get(l);if(h==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=h.depIndices,u.push({path:h.from}),l=h.from}return{found:!0,pathOrder:u,truncated:!1}}function Hn(r,e,t){let n=r.nodes[e];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=qe(e,n,0,t);a.dep_index=o[0];let d=qe(e,n,1,t);return Ye(e,e,[a,d])}let i=null;for(let a=0;a<s.length;a++){let d=s[a];if(!d||d===e)continue;let u=Zt(r,d,e,t.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:Ye(e,e,Qt(r,i.pathOrder,t))}function Qt(r,e,t){return e.map((n,s)=>{let o=r.nodes[n.path],i=qe(n.path,o,s,t);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 qe(r,e,t,n){let s={path:r,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=n.annotations?.get(r)??e.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(r)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function Ye(r,e,t){return en(r,e,!0,"ok",t)}function Ke(r,e,t){return en(r,e,!1,t,[])}function en(r,e,t,n,s){let o=Wn(r,e,t,n,s);return{from:r,to:e,found:t,reason:n,steps:s,text:o,toJSON(){return{from:r,to:e,found:t,reason:n,steps:s}}}}function Wn(r,e,t,n,s){if(!t)switch(n){case"no-such-from":return`explainPath: no node named "${r}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${r}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${r}" to "${e}"`}let o=[`Causal path: ${r} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let d=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(d),"value"in i&&o.push(` value: ${Un(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;o.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return o.join(`
2
- `)}function Un(r){if(r===void 0)return"<sentinel>";if(r===null)return"null";if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||typeof r=="bigint")return String(r);try{let e=JSON.stringify(r);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(r)}}var tn=V(()=>{"use strict"});function nn(r){let e=new WeakSet,t=new WeakSet,n=[r],s=0;for(;n.length>0;){let o=n.pop();s+=qn(o,e,t,n)}return s}function qn(r,e,t,n){if(r==null)return 0;switch(typeof r){case"number":return j.number;case"boolean":return j.boolean;case"string":return j.string+r.length*2;case"bigint":return j.bigint+Yn(r);case"symbol":return j.symbol;case"function":return e.has(r)?0:(e.add(r),j.function);case"undefined":return 0}let o=r;if(e.has(o))return 0;e.add(o);let i=o[Kn];if(typeof i=="function")try{let u=i.call(o);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(o instanceof Date)return j.date;if(o instanceof RegExp)return j.regexp+o.source.length*2;if(o instanceof Error){let u=o.message?o.message.length*2:0,l=o.stack?o.stack.length*2:0;return j.error+u+l}if(typeof URL<"u"&&o instanceof URL)return j.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return j.promise;if(o instanceof WeakMap)return j.weakmap;if(o instanceof WeakSet)return j.weakset;if(o instanceof Map){let u=j.map;for(let[l,h]of o)u+=j.mapEntry,n.push(l),n.push(h);return u}if(o instanceof Set){let u=j.set;for(let l of o)u+=j.setEntry,n.push(l);return u}if(Array.isArray(o)){let u=j.array+o.length*8;for(let l of o)n.push(l);return u}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let u=o;return t.has(u.buffer)?48:(t.add(u.buffer),u.buffer.byteLength+48)}let a=j.object,d=Object.keys(o);for(let u of d){a+=j.string+u.length*2;try{n.push(o[u])}catch{}}return a}function Yn(r){let e=r<0n?-r:r;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var j,Kn,rn=V(()=>{"use strict";j={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},Kn=Symbol.for("sizeof")});function sn(r,e){let t=e?.topN??10,n=r.describe({detail:"standard"}),s=[],o=r._collectObserveTargets;typeof o=="function"&&o.call(r,"",s);let i=new Map;for(let[p,f]of s)i.set(p,f);let a=[];for(let[p,f]of Object.entries(n.nodes)){let c=i.get(p),v=c instanceof z?c:null,g=v?nn(v.cache):0,k=v?v._sinkCount:0,y=f.deps?.length??0,b=f.type==="effect"&&k===0,_=k===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:g,subscriberCount:k,depCount:y,isOrphanEffect:b,orphanKind:_})}let d=a.reduce((p,f)=>p+f.valueSizeBytes,0),u=(p,f)=>[...a].sort(f??((c,v)=>v[p]-c[p])).slice(0,t),l=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:d,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:l,orphanEffects:h}}var on=V(()=>{"use strict";me();rn()});function an(r,e){let t=Math.max(16,r.size*4),n=0;for(;r.size>0;){if(n++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${r.size} disposer(s) discarded`),r.clear();return}let s=r.values().next();if(s.done)return;let o=s.value;r.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function pn(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function Jn(r){if(r!=null)return pn(r)?r.cache:r}function be(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function fe(r){return be(r)?r.cache??"":r}function dn(r){return be(r)?r.cache??0:r}function un(r){return be(r)?r.cache??!1:r}function Xn(r){let e=[];for(let t of Object.keys(r).sort()){let n=r[t].v;n!=null&&e.push(`${t} ${n.id} ${n.version}`)}return e.join(`
3
- `)}function cn(r){if(r.version!==Re)throw new Error(`unsupported snapshot version ${String(r.version)} (expected ${Re})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in r))throw new Error(`snapshot missing required key "${e}"`);if(typeof r.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof r.nodes!="object"||r.nodes===null||Array.isArray(r.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(r.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(r.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function Zn(r,e){let t=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,d=o.constructor;if(a!==d)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let p=o;if(s.length!==p.length)return!1;for(let f=0;f<s.length;f++)if(!n(s[f],p[f]))return!1;return!0}if(s instanceof Map){let p=o;if(s.size!==p.size)return!1;for(let[f,c]of s)if(!p.has(f)||!n(c,p.get(f)))return!1;return!0}if(s instanceof Set){let p=o;if(s.size!==p.size)return!1;for(let f of s){let c=!1;for(let v of p)if(n(f,v)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(s)){let p=s,f=o;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(s),l=Object.keys(o);if(u.length!==l.length)return!1;let h=new Set(l);for(let p of u)if(!h.has(p)||!n(s[p],o[p]))return!1;return!0};return n(r,e)}function Qn(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Je(r){let e="^";for(let t=0;t<r.length;t+=1){let n=r[t];if(n==="*"){e+=".*";continue}if(n==="?"){e+=".";continue}if(n==="["){let s=r.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=r.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=Qn(n)}return e+="$",new RegExp(e)}function _t(r){if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||r==null)return String(r);try{return JSON.stringify(r)}catch{return"[unserializable]"}}function nr(r){return r==="none"?tr:r==="ansi"||r==null?er:{data:r.data??"",dirty:r.dirty??"",resolved:r.resolved??"",invalidate:r.invalidate??"",pause:r.pause??"",resume:r.resume??"",complete:r.complete??"",error:r.error??"",teardown:r.teardown??"",derived:r.derived??"",path:r.path??"",reset:r.reset??""}}function ln(r){if(r==null)return{};let e=r.detail;return e==="full"?{...r,structured:r.structured??!0,timeline:r.timeline??!0,causal:r.causal??!0,derived:r.derived??!0}:e==="minimal"?{...r,structured:r.structured??!0}:r.format==="stage-log"?{...r,structured:r.structured??!0,timeline:r.timeline??!0}:r}function rr(r,e,t){for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${r}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function wt(r,e,t){if(r==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(r.includes(L))throw new Error(`Graph "${e}": ${t} "${r}" must not contain '${L}' (path separator)`);if(r===re)throw new Error(`Graph "${e}": ${t} name "${re}" is reserved for meta companion paths`);rr(r,e,t)}function sr(r,e){if(r==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=r.split(L);for(let n of t)if(n==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function or(r,e){let t=!1;for(let s of r)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?r.filter(s=>e.isMetaPassthrough(s[0])):r}function hn(r){for(let e of r._mounts.values())hn(e);for(let e of r._nodes.values())try{e.down([[B]],{internal:!0})}catch{}}function ir(r,e){let t=Ee.diff(r,e),n={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(n[s]=o)}return{...t,nodesAddedFull:n}}function fn(r,e,t,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return n.withDetail?s:[];if(!n.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,d=new Map,u=new Map,l=new Set;for(let[b,_]of Object.entries(r.nodes)){if(!b)continue;l.add(b);let w=_.deps??[];i.set(b,w);for(let x of w)x&&(l.add(x),a.has(x)||a.set(x,new Set),a.get(x).add(b))}for(let b of r.edges){if(b==null||typeof b!="object")continue;let _=typeof b.from=="string"?b.from:"",w=typeof b.to=="string"?b.to:"";!_||!w||(l.add(_),l.add(w),u.has(_)||u.set(_,new Set),u.get(_).add(w),d.has(w)||d.set(w,new Set),d.get(w).add(_))}if(!l.has(e))return n.withDetail?s:[];let h=n.both===!0,p=b=>{if(h){let m=i.get(b)??[],T=d.get(b),O=a.get(b),E=u.get(b),N=[...m];return T&&N.push(...T),O&&N.push(...O),E&&N.push(...E),N}if(t==="upstream"){let m=i.get(b)??[],T=d.get(b);return T?[...m,...T]:m}let _=a.get(b),w=u.get(b),x=_?[..._]:[];return w&&x.push(...w),x},f=new Set([e]),c=new Map,v=[{path:e,depth:0}],g=0,k=!1;for(;g<v.length;){let b=v[g++];if(o!=null&&b.depth>=o){p(b.path).length>0&&(k=!0);continue}for(let _ of p(b.path))!_||f.has(_)||(f.add(_),c.set(_,b.depth+1),v.push({path:_,depth:b.depth+1}))}let y=[...c.keys()].sort((b,_)=>b<_?-1:b>_?1:0);return n.withDetail?{paths:y,depths:c,truncated:k}:y}function ar(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var L,re,Re,er,tr,Ee,gn=V(()=>{"use strict";at();Te();ke();Ge();ge();mt();me();He();Ut();qt();Yt();Jt();it();tn();on();L="::",re="__meta__",Re=1;er={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"},tr={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};Ee=class r{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;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(L))throw new Error(`Graph name must not contain '${L}' (got "${e}")`);if(e===re)throw new Error(`Graph name "${re}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??Oe,this._traceRing=new Pe(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],n=e?this:this._parent;for(;n!=null;)t.push(n),n=n._parent;return t}get topology(){return this._topology==null&&(this._topology=bt(e=>{let t=n=>{e.emit(n)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let n=e.name,s=t?.name??n;if(s==null||s==="")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 o=s,i=t?.annotation;if(wt(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:de()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof z&&t._applyVersioning(e)}remove(e){wt(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,d]of i)a.includes(`${L}${re}${L}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${L}`)),this._mounts.delete(e),t._parent=void 0,hn(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(n),n.down([[B]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=Je(e);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=e.length)return{value:void 0,done:!0};let s=e[n++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(L))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,n){let s=n?.internal===!0;this.node(e).down([[$,t]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(e,t){let n=Symbol.iterator in e?e:Object.entries(e);ae(()=>{for(let[s,o]of n)this.set(s,o,t)})}invalidate(e,t){let n=t?.internal===!0;this.node(e).down([[te]],{actor:t?.actor,internal:n,delivery:"write"})}error(e,t,n){let s=n?.internal===!0;this.node(e).down([[I,t]],{actor:n?.actor,internal:s,delivery:"write"})}complete(e,t){let n=t?.internal===!0;this.node(e).down([[H]],{actor:t?.actor,internal:n,delivery:"write"})}edges(e){let t=e?.recursive===!0,n=new Map;if(!t){for(let[d,u]of this._nodes)n.set(u,d);let a=[];for(let[d,u]of this._nodes)if(u instanceof z)for(let l of u._deps){let h=n.get(l.node);h!=null&&a.push([h,d])}return a.sort((d,u)=>d[0]<u[0]?-1:d[0]>u[0]?1:d[1]<u[1]?-1:d[1]>u[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,d]of s)o.set(d,a);let i=[];for(let[a,d]of s)if(d instanceof z)for(let u of d._deps){let l=o.get(u.node);l!=null&&i.push([l,a])}return i.sort((a,d)=>a[0]<d[0]?-1:a[0]>d[0]?1:a[1]<d[1]?-1:a[1]>d[1]?1:0),i}mount(e,t){if(t===void 0){let s=new r(e);return this.mount(e,s)}if(typeof t=="function"){let s=new r(e);return t(s),this.mount(e,s)}let n=t;if(wt(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" 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 s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,n),n._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),n}resolve(e){let t=sr(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=t[0],s=t.slice(1);if(s.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 o=this._nodes.get(n);if(o&&s.length>0&&s[0]===re)return this._resolveMetaChainFromNode(o,s,t.join(L));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(L)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(L))}_resolveMetaChainFromNode(e,t,n){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==re)throw new Error(`Graph "${this.name}": expected ${re} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${re} in "${n}"`);let a=i[o+1],d=s.meta[a];if(!d)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=d,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[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(e,t??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(e,t,n,s){for(let d of this._mounts.values())d._signalDeliver(e,t,n,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=or(e,this.config);for(let d of[...this._nodes.keys()].sort()){let u=this._nodes.get(d);if(!n.has(u)){n.add(u);try{u.down(e,i)}catch(l){if(l instanceof Q)throw l;s.push(l)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,s)}}}_signalMetaSubtree(e,t,n,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!n.has(a)){n.add(a);try{a.down(t,s)}catch(d){if(d instanceof Q)throw d;o.push(d)}this._signalMetaSubtree(a,t,n,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=Jn(e?.actor),n=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=ht(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let d=new Map;for(let[_,w]of a)d.set(w,_);let u=[];{let _=a.map(([,m])=>m),w=new Set(d.values()),x=0;for(;_.length>0;){let m=_.shift();if(m instanceof z)for(let T of m._deps){let O=T.node;if(d.has(O))continue;let E=O.name??"",N=E;if(!N||w.has(N))if(E){let S=2;for(;w.has(`${E}#${S}`);)S++;N=`${E}#${S}`}else for(N=`__internal__/${x++}`;w.has(N);)N=`__internal__/${x++}`;d.set(O,N),w.add(N),u.push([N,O]),_.push(O)}}}let l=[...a,...u],h={};for(let[_,w]of l){if(t!=null&&!w.allowsObserve(t))continue;let x=gt(w,i,o),m=w instanceof z?w._deps.map(N=>d.get(N.node)??N.node.name??""):[],{name:T,...O}=x,E={...O,deps:m};if(!o){let N=this._annotations.get(_);N!=null&&(E.annotation=N)}if(n!=null)if(typeof n=="function"){let N=n;if(!(N.length>=2?N(_,E):N(E)))continue}else{let N=!0;for(let[S,G]of Object.entries(n)){let M=S==="deps_includes"?"depsIncludes":S==="meta_has"?"metaHas":S;if(M==="depsIncludes"){if(!E.deps.includes(String(G))){N=!1;break}continue}if(M==="metaHas"){if(!Object.hasOwn(E.meta??{},String(G))){N=!1;break}continue}if(E[M]!==G){N=!1;break}}if(!N)continue}h[_]=E}let p=new Set(Object.keys(h)),f=[];for(let[_,w]of l)if(w instanceof z)for(let x of w._deps){let m=d.get(x.node);m!=null&&f.push([m,_])}f.sort((_,w)=>_[0]<w[0]?-1:_[0]>w[0]?1:_[1]<w[1]?-1:_[1]>w[1]?1:0);let c=f.map(([_,w])=>({from:_,to:w}));(t!=null||n!=null)&&(c=c.filter(_=>p.has(_.from)&&p.has(_.to)));let v=this._collectSubgraphs(""),g=t!=null||n!=null?v.filter(_=>{let w=`${_}${L}`;return[...p].some(x=>x===_||x.startsWith(w))}):v,k=this,y=e;return{name:this.name,nodes:h,edges:c,subgraphs:g,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(_){let w={...y};return Array.isArray(_)?(w.fields=_,w.detail=void 0):(w.detail=_,w.fields=void 0),k.describe(w)}}}_collectSubgraphs(e){let t=[];for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${n}`;t.push(s),t.push(...this._mounts.get(n)._collectSubgraphs(`${s}${L}`))}return t}resourceProfile(e){return sn(this,e)}reachable(e,t,n={}){return n.withDetail===!0?fn(this.describe(),e,t,{...n,withDetail:!0}):fn(this.describe(),e,t,n)}explain(e,t,n){return n?.reactive===!0?this._explainReactive(e,t,n):this._explainStatic(fe(e),fe(t),{...n?.maxDepth!==void 0?{maxDepth:dn(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:un(n.findCycle)}:{}})}_explainStatic(e,t,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,d]of Object.entries(s.nodes))d.lastMutation!=null&&i.set(a,d.lastMutation);return Xt(s,e,t,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},n=e.reactiveName??"describe",s=0,o=ne(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,we(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(y=>{let b=y.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),h=[],p=new WeakSet,f=y=>{if(p.has(y)||d)return;p.add(y);let b=y.topology.subscribe(_=>{for(let w of _){if(w[0]!==$)continue;let x=w[1];if(u(),x.kind==="added"&&x.nodeKind==="mount"){let m=y._mounts.get(x.name);m!=null&&f(m)}}});h.push(b);for(let _ of y._mounts.keys()){let w=y._mounts.get(_);w!=null&&f(w)}};f(this);let c,v=e.actor;pn(v)&&(c=v.subscribe(y=>{let b=!1,_=!1;for(let w of y){let x=w[0];x===$?b=!0:(x===H||x===I||x===B)&&(_=!0)}b&&u(),_&&(c?.(),c=void 0,u())}));let g;try{g=J([o],()=>this.describe(t),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(y,b)=>y===b})}catch(y){l(),c?.();for(let b of h)b();throw i.dispose(),y}let k=We(g);return{node:g,dispose(){d=!0,l(),c?.();for(let y of h)y();h.length=0,i.dispose(),k()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},n=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=vt(s,o),a=ne(i,{name:n,meta:{domain:"audit",kind:"describe-diff"},equals:(p,f)=>p===f}),d=this._describeReactive({...e,reactiveName:void 0}),u=!1,l=d.node.subscribe(p=>{if(!u)for(let f of p){if(f[0]!==$)continue;let c=f[1],v=vt(o,c);o=c,v.events.length!==0&&a.emit(v)}}),h=We(a);return{node:a,dispose(){u=!0,l(),d.dispose(),a.down([[B,"describe-diff disposed"]]),h()}}}_explainReactive(e,t,n){let s=0,o=ne(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,we(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},l=i.onEvent(y=>{let b=y.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),h=[];e!=null&&be(e)&&h.push(e),t!=null&&be(t)&&h.push(t),n?.maxDepth!=null&&be(n.maxDepth)&&h.push(n.maxDepth),n?.findCycle!=null&&be(n.findCycle)&&h.push(n.findCycle);let p=()=>{for(let y of h)if(y.cache===void 0)return!1;return!0},f=()=>{let y=fe(e),b=fe(t);return{from:y,to:b,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:y,to:b,found:!1,reason:"pending",steps:[]})}},c;try{c=J([o],()=>{if(!p())return f();let y=fe(e),b=fe(t),_={...n?.maxDepth!==void 0?{maxDepth:dn(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:un(n.findCycle)}:{}};return this._explainStatic(y,b,_)},{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:fe(e),to:fe(t)},equals:(y,b)=>y.found===b.found&&y.reason===b.reason&&y.steps.length===b.steps.length&&ar(y.steps,b.steps)})}catch(y){throw l(),i.dispose(),y}let v=We(c),g=[],k=y=>{let b;return b=y.subscribe(_=>{let w=!1,x=!1;for(let m of _){let T=m[0];T===$?w=!0:(T===H||T===I||T===B)&&(x=!0)}(w||x)&&u(),x&&b&&(b(),b=void 0)}),()=>{b&&(b(),b=void 0)}};for(let y of h)g.push(k(y));return{node:c,dispose(){d=!0,l();for(let y of g)y?.();g.length=0,i.dispose(),v()}}}_pathsMatching(e){let t=Je(e),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${L}${n}`;this._mounts.get(n)._collectObserveTargets(s,t)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=e===""?n:`${e}${L}${n}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,n){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${L}${re}${L}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(e,t){let n=typeof e=="string",o=ln(n?t:e);if(o.reactive===!0)return this._observeReactive(n?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let l=e,h=this.resolve(l);if(a!=null&&!h.allowsObserve(a))throw new Q({actor:a,action:"observe",nodeName:l});return i?this._buildStructuredObserver([[l,h]],o,"one"):{subscribe(p){return h.subscribe(p)},up(p){try{h.up?.(p)}catch(f){if(f instanceof Q)return;throw f}}}}let d=[];this._collectObserveTargets("",d),d.sort((l,h)=>l[0]<h[0]?-1:l[0]>h[0]?1:0);let u=a==null?d:d.filter(([,l])=>l.allowsObserve(a));return i?this._buildStructuredObserver(u,o,"all"):{subscribe:l=>{let h=u.map(([p,f])=>f.subscribe(c=>{l(p,c)}));return()=>{for(let p of h)p()}},up:(l,h)=>{try{this.resolve(l).up?.(h)}catch(p){if(p instanceof Q)return;throw p}}}}_observeReactive(e,t){let n=t.tiers,s=n!=null?new Set(n):null,o=t.reactiveName??"observe";return bt(i=>{let a=[],d=!1,u=!1,l=()=>{if(a.length===0||u)return;let v={events:a.slice(),flushedAt_ns:de()};a.length=0,i.emit(v)},h={...t,reactive:!1,structured:!0,timeline:!0},p=e!=null?this.observe(e,h):this.observe(h),f=v=>{u||(a.push(v),!d&&(d=!0,we(()=>{d=!1,l()})))};for(let v of p.events)f(v);let c=p.onEvent(f);return()=>{u=!0,c(),p.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,n){let s=n==="one"?e[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let l=this.resolve(s);return this._buildStructuredObserver([[s,l]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((l,h)=>l[0]<h[0]?-1:l[0]>h[0]?1:0);let d=i.actor,u=d==null?a:a.filter(([,l])=>l.allowsObserve(d));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,n){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",d=this.config.inspectorEnabled,u=(o||i)&&d,l=t.maxEvents,h=l!=null&&l>0?new Pe(l):null,p=[],f=new Set,c=t.tiers!=null?new Set(t.tiers):null,v={},g=new Set,k=0,y=0,b=0,_=0,w=0,x=0,m=!1,T=!1,O=0,E=new Map,N=new Map,S=new Map,G=R=>{if(!(c!=null&&!c.has(R.type))){h?h.push(R):p.push(R);for(let F of f)F(R)}},M=R=>c==null||c.has(R),se=()=>s?{timestamp_ns:de(),in_batch:Le(),batch_id:O}:{},ee=(R,F)=>{if(!(!u||!(R instanceof z)))return R._setInspectorHook(X=>{if(X.kind==="dep_message")E.set(R,X.depIndex);else if(X.kind==="run"){let Ae=X.batchData.map((P,K)=>P!=null&&P.length>0?P.at(-1):X.prevData[K]);N.set(R,Ae);let Z=X.batchData.map(P=>P!=null?[...P]:void 0);S.set(R,Z),i&&G({type:"derived",path:F,dep_values:Ae,dep_batches:Z,...se()})}})},ye=R=>{let F=E.get(R),X=N.get(R);if(!o||X==null)return{};let Z=(F!=null&&F>=0&&R instanceof z?R._deps[F]:void 0)?.node,P=Z?.v,K=S.get(R);return{trigger_dep_index:F,trigger_dep_name:Z?.name,...P!=null?{trigger_version:{id:P.id,version:P.version}}:{},dep_values:[...X],...K!=null?{dep_batches:K}:{}}},Xe=[],D=[];for(let[R,F]of e){let X=ee(F,R);X&&Xe.push(X),D.push(F.subscribe(Ae=>{O++;for(let Z of Ae){let P=Z[0],K=se();if(P===$){v[R]=Z[1];let Ze=F instanceof z?F.lastMutation?.actor??xe:xe;G({type:"data",path:R,data:Z[1],actor:Ze,...K,...ye(F)})}else if(a)P===q?M("dirty")&&k++:P===U?M("resolved")&&y++:P===te?M("invalidate")&&b++:P===ie?M("pause")&&_++:P===le?M("resume")&&w++:P===B?M("teardown")&&x++:P===H&&!g.has(R)?M("complete")&&(m=!0):P===I&&M("error")&&(T=!0,g.add(R));else if(P===q)M("dirty")&&k++,G({type:"dirty",path:R,...K});else if(P===U)M("resolved")&&y++,G({type:"resolved",path:R,...K,...ye(F)});else if(P===te)M("invalidate")&&b++,G({type:"invalidate",path:R,...K});else if(P===ie)M("pause")&&_++,G({type:"pause",path:R,lockId:Z[1],...K});else if(P===le)M("resume")&&w++,G({type:"resume",path:R,lockId:Z[1],...K});else if(P===H)M("complete")&&!g.has(R)&&(m=!0),G({type:"complete",path:R,...K});else if(P===I){M("error")&&(T=!0,g.add(R));let Ze=F instanceof z?F.lastMutation?.actor??xe:xe;G({type:"error",path:R,data:Z[1],actor:Ze,...K})}else P===B&&(M("teardown")&&x++,G({type:"teardown",path:R,...K}))}}))}let C=!1,A=()=>{if(!C){C=!0;for(let R of D)R();for(let R of Xe)R();for(let R of W)R({value:void 0,done:!0});W.length=0}},Y=[],W=[];f.add(R=>{let F=W.shift();F?F({value:R,done:!1}):Y.push(R)});let oe={get values(){return v},get dirtyCount(){return k},get resolvedCount(){return y},get invalidateCount(){return b},get pauseCount(){return _},get resumeCount(){return w},get teardownCount(){return x},get events(){return h?h.toArray():[...p]},get anyCompletedCleanly(){return m},get anyErrored(){return T},get completedWithoutErrors(){return m&&!T},onEvent(R){return f.add(R),()=>f.delete(R)},dispose:A,expand(R){A();let F={...t};return typeof R=="string"?F.detail=R:Object.assign(F,R),n(ln(F))},[Symbol.asyncIterator](){return{next(){return Y.length>0?Promise.resolve({value:Y.shift(),done:!1}):C?Promise.resolve({value:void 0,done:!0}):new Promise(R=>W.push(R))},return(){return A(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(oe,t),oe}_attachFormatLogger(e,t){let n=t.format;if(n==null)return;let s=t.logger??(c=>console.log(c)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:c=>(o==null||o.has(c))&&(i==null||!i.has(c)),d=nr(t.theme),u=n==="stage-log"?de():0,l=c=>c==null?"":t.stageLabels?.[c]??c,h=(c,v)=>c.length>v?`${c.slice(0,v-1)}\u2026`:c,p=c=>c.type==="data"||c.type==="error"?h(_t(c.data),120):"",f=c=>{if(n==="stage-log"){let m=(de()-u)/1e9,T=l(c.path).padEnd(9);if(c.type==="data"){let O=p(c);return`[${m.toFixed(3)}s] ${T} \u2190${O?` ${O}`:""}`}if(c.type==="error"){let O=p(c);return`[${m.toFixed(3)}s] ${T} \u2717${O?` ${O}`:""}`}return c.type==="complete"?`[${m.toFixed(3)}s] ${T} \u25A0 complete`:`[${m.toFixed(3)}s] ${T} ${c.type}`}if(n==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let v=d[c.type]??"",g=c.path?`${d.path}${c.path}${d.reset} `:"",k=c.type==="data"||c.type==="error",y=c.type==="pause"||c.type==="resume",b=k?` ${_t(c.data)}`:y?` ${_t(c.lockId)}`:"",_=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,w=_?.trigger_dep_name!=null?` <- ${_.trigger_dep_name}`:_?.trigger_dep_index!=null?` <- #${_.trigger_dep_index}`:"",x=c.in_batch?" [batch]":"";return`${g}${v}${c.type.toUpperCase()}${d.reset}${b}${w}${x}`};e.onEvent(c=>{a(c.type)&&s(f(c),c)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){an(this._disposers,this.name),this.signal([[B]],{internal:!0}),an(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:d,guard:u,...l}=n.nodes[a];s[a]=l}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return At(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let n=t?.config??Oe,{codec:s,codecVersion:o,payload:i}=Dt(e,n);return s.decode(i,o)}restore(e,t){if(cn(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let n=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>Je(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let d=this.tryResolve(o)?.v;if(d!=null&&d.id===i.v.id&&d.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){cn(e);let n=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new r(e.name);if(n)return n(o),o.restore(e),o;for(let f of[...e.subgraphs].sort((c,v)=>{let g=c.split(L).length,k=v.split(L).length;return g!==k?g-k:c<v?-1:c>v?1:0})){let c=f.split(L),v=o;for(let g of c)v._mounts.has(g)||v.mount(g,new r(g)),v=v._mounts.get(g)}let i=s?Object.entries(s).map(([f,c])=>({re:Je(f),factory:c})):[],a=f=>{for(let c of i)if(c.re.test(f))return c.factory},d=f=>{let c=f.split(L),v=c.pop();if(v==null||v.length===0)throw new Error(`invalid snapshot path "${f}"`);let g=o;for(let k of c){let y=g._mounts.get(k);if(!y)throw new Error(`unknown mount "${k}" in path "${f}"`);g=y}return[g,v]},u=Object.entries(e.nodes).filter(([f])=>!f.includes(`${L}${re}${L}`)).sort((f,c)=>f[0]<c[0]?-1:f[0]>c[0]?1:0),l=new Map(u),h=new Map,p=!0;for(;l.size>0&&p;){p=!1;for(let[f,c]of[...l.entries()]){let v=c?.deps??[];if(!v.every(w=>h.has(w)))continue;let[g,k]=d(f),y={...c?.meta??{}},b=a(f),_;if(c?.type==="state")_=ne(c.value,{meta:y});else{if(b==null)continue;_=b(k,{path:f,type:c.type,value:c.value,meta:y,deps:v,resolvedDeps:v.map(w=>h.get(w))})}g.add(_,{name:k}),h.set(f,_),l.delete(f),p=!0}}if(l.size>0){let f=[...l.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 o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let n=e.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}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(u,l)=>{if(u.disposed)return;let h=Xn(l.nodes);if(u.lastSnapshot!=null&&h!==""&&h===u.lastFingerprint)return;let p=u.seq+1,f=ce(),g=u.lastSnapshot==null||p%u.compactEvery===0?{name:this.name,mode:"full",snapshot:l,seq:p,timestamp_ns:f,format_version:Re}:{name:this.name,mode:"diff",diff:ir(u.lastSnapshot,l),seq:p,timestamp_ns:f,format_version:Re};if(u.tier.filter&&!u.tier.filter(g))return;let k;try{k=u.tier.save(g)}catch(y){t.onError?.(y,u.tier);return}if(k&&typeof k.then=="function"){let _=(u.savePending??Promise.resolve()).then(()=>k,()=>k).then(()=>{u.disposed||(u.seq=p,u.lastSnapshot=l,u.lastFingerprint=h)},w=>{t.onError?.(w,u.tier)});u.savePending=_.finally(()=>{u.savePending===_&&(u.savePending=void 0)})}else u.seq=p,u.lastSnapshot=l,u.lastFingerprint=h},o=(u,l)=>{try{s(u,l)}catch(h){t.onError?.(h,u.tier)}},i=(u,l)=>{if(!l.some(c=>{let v=this.config.messageTier(c[0]);return v>=3&&v<5}))return;if(t.filter){let c=this.tryResolve(u);if(c==null)return;let v=gt(c,ht("standard"));if(!t.filter(u,v))return}let p,f=()=>(p==null&&(p=this.snapshot()),p);for(let c of n)c.disposed||(c.debounceMs===0?o(c,f()):(c.timer==null&&(c.timer=new Ue),c.timer.start(c.debounceMs,()=>{c.disposed||o(c,this.snapshot())})))},a;if(t.paths!=null){let l=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(h=>{let p=this.tryResolve(h);return p==null?()=>{}:p.subscribe(f=>i(h,f))});a=()=>{for(let h of l)h()}}else a=this.observe().subscribe((u,l)=>i(u,l));let d=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(d)};return this._storageDisposers.add(d),{dispose:d}}async _cascadeRestore(e,t){for(let n of e){let s;try{s=await n.load?.()}catch(i){t?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===Re&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,n)}}return!1}static async fromStorage(e,t,n){for(let s of t){let o;try{o=await s.load?.()}catch(d){n?.onError?.(d,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===Re&&i.nodes!=null?i:void 0;if(a!=null)try{return r.fromSnapshot(a,n)}catch(d){n?.onError?.(d,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,n){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:de(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(s=>!e(s)),n=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return n}static diff(e,t){let n=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(y=>!n.has(y)).sort(),i=[...n].filter(y=>!s.has(y)).sort(),a=[],d=[];for(let y of n){if(!s.has(y))continue;let b=e.nodes[y],_=t.nodes[y],w=b.v,x=_.v;w!=null&&x!=null&&w.id===x.id&&w.version!==x.version&&d.push({path:y,id:w.id,from:w.version,to:x.version});let m=w!=null&&x!=null&&w.id===x.id&&w.version===x.version;for(let T of["type","status","sentinel"]){let O=b[T],E=_[T];O!==E&&a.push({path:y,field:T,from:O,to:E})}if(!m)for(let T of["value","meta"]){let O=b[T],E=_[T];Zn(O,E)||a.push({path:y,field:T,from:O,to:E})}}let u=y=>`${y.from} ${y.to}`,l=new Set(e.edges.map(u)),h=new Set(t.edges.map(u)),p=t.edges.filter(y=>!l.has(u(y))),f=e.edges.filter(y=>!h.has(u(y))),c=new Set(e.subgraphs),v=new Set(t.subgraphs),g=[...v].filter(y=>!c.has(y)).sort(),k=[...c].filter(y=>!v.has(y)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:d,edgesAdded:p,edgesRemoved:f,subgraphsAdded:g,subgraphsRemoved:k}}}});var lr={};On(lr,{PipelineGraph:()=>Fe,decisionKeyOf:()=>wn,pipelineGraph:()=>Tn});module.exports=En(lr);Te();ke();ge();mt();me();He();Ht();Te();ke();Ge();ge();Te();ge();me();He();var Tt=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,t){if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=t,t!==void 0){if(this._buf=new Array(t),e&&e.length>0){let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._size+e;if(!(t<0||t>=this._size))return this._maxSize!==void 0?this._buf[(this._head+t)%this._maxSize]:this._buf[t]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let n=t;n<e.length;n++)this._rawAppend(e[n]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let t=0;t<e;t++)this._buf[(this._head+t)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let t=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,t);else{for(let n=0;n<t;n++)this._buf[(this._head+n)%this._maxSize]=void 0;this._head=(this._head+t)%this._maxSize}return this._size-=t,this._version+=1,t}slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let n=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=n)return[];let o=n-s;if(this._maxSize===void 0)return this._buf.slice(s,n);let i=new Array(o);for(let a=0;a<o;a++)i[a]=this._buf[(this._head+s+a)%this._maxSize];return i}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let t=Math.min(e,this._size);return this.slice(this._size-t,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this._buf[(this._head+t)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let t=0;t<e.length;t++)this._buf.push(e[t]);this._size=this._buf.length}else{let t=this._maxSize;for(let o=0;o<t;o++)this._buf[o]=void 0;this._head=0;let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function $e(r){return r.subscribe(()=>{})}var dr=64;function mn(r,e={}){let{name:t,maxSize:n,versioning:s,guard:o,backend:i}=e,a=i??new Tt(r,n),d=ne(a.toArray(),{name:t,describeKind:"state",equals:(m,T)=>m===T,...s!=null?{versioning:s}:{},...o!=null?{guard:o}:{}});function u(){let m=a.toArray();ae(()=>{d.down([[q]],{internal:!0}),d.down([[$,m]],{internal:!0})})}let l=new Map,h=new Map,p=new Map;function f(m,T){return`${m}:${T===void 0?"END":T}`}function c(m){if(m.size<dr)return;let T=m.keys().next();if(T.done)return;let O=m.get(T.value);O!==void 0&&O.dispose(),m.delete(T.value)}function v(m){let T=a.version;try{return m()}finally{a.version!==T&&u()}}function g(m){if(!Number.isInteger(m)||m<0)throw new RangeError(`tail: n must be a non-negative integer (got ${m})`);let T=l.get(m);if(T!==void 0)return l.delete(m),l.set(m,T),T.node;c(l);let O=J([d],([N])=>{let S=N;return m===0||S.length===0?[]:S.slice(Math.max(0,S.length-m))},{initial:a.tail(m),describeKind:"derived"}),E=$e(O);return l.set(m,{node:O,dispose:E}),O}function k(m,T){if(!Number.isInteger(m)||m<0)throw new RangeError(`slice: start must be a non-negative integer (got ${m})`);if(T!==void 0&&(!Number.isInteger(T)||T<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${T})`);let O=f(m,T),E=h.get(O);if(E!==void 0)return h.delete(O),h.set(O,E),E.node;c(h);let N=J([d],([G])=>{let M=G;return T===void 0?M.slice(m):M.slice(m,T)},{initial:a.slice(m,T),describeKind:"derived"}),S=$e(N);return h.set(O,{node:N,dispose:S}),N}function y(m){let T=p.get(m);if(T!==void 0)return T.node;let O=J([d,m],([N,S])=>{let G=N,M=Math.max(0,Math.trunc(S??0));return G.slice(M)},{initial:[],describeKind:"derived"}),E=$e(O);return p.set(m,{node:O,dispose:E}),O}let b,_;function w(){b===void 0&&(b=ue([d],(m,T,O)=>{let E=m[0],S=E!=null&&E.length>0?E.at(-1):O.prevData[0];if(S==null||S.length===0){T.down([[U]]);return}T.emit(S[S.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:a.size===0?void 0:a.at(a.size-1)}),_=J([d],([m])=>m.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:a.size>0}),$e(b),$e(_))}let x={entries:d,get size(){return a.size},at(m){return a.at(m)},append(m){v(()=>a.append(m))},appendMany(m){m.length!==0&&v(()=>a.appendMany(m))},clear(){v(()=>a.clear())},trimHead(m){v(()=>a.trimHead(m))},withLatest(){return w(),d},get lastValue(){return w(),b},get hasLatest(){return w(),_},view(m){switch(m.kind){case"tail":return g(m.n);case"slice":return k(m.start,m.stop);case"fromCursor":return y(m.cursor)}},attach(m){let T=m.subscribe(O=>{for(let E of O)E[0]===$&&x.append(E[1])});return()=>T()},attachStorage(m){if(m.length===0)return()=>{};let T=new Map;for(let E of m)T.set(E,a.size);(async()=>{for(let E of m)if(typeof E.loadEntries=="function")try{let N=await Promise.resolve(E.loadEntries());N.entries.length>0&&a.size===0&&(a.restore(N.entries),T.set(E,N.entries.length),u());break}catch{}})();let O=d.subscribe(E=>{for(let N of E){if(N[0]!==$)continue;let S=N[1];for(let G of m){let M=T.get(G)??0;if(S.length<M){try{let ee=G.appendEntries(S);ee instanceof Promise&&ee.catch(()=>{})}catch{}T.set(G,S.length);continue}if(S.length===M)continue;let se=S.slice(M);T.set(G,S.length);try{let ee=G.appendEntries(se);ee instanceof Promise&&ee.catch(()=>{})}catch{}}}});return()=>O()},disposeAllViews(){for(let m of l.values())m.dispose();l.clear();for(let m of h.values())m.dispose();h.clear();for(let m of p.values())m.dispose();p.clear()},dispose(){for(let m of l.values())m.dispose();l.clear();for(let m of h.values())m.dispose();h.clear();for(let m of p.values())m.dispose();p.clear()}};return x}var ur=Et((r,e)=>{r("observe"),r("signal"),e("write")});function vn(r){let e=mn([],{name:r.name,maxSize:r.retainedLimit??1024,guard:r.guard??ur,...r.versioning!=null?{versioning:r.versioning}:{}});return e.withLatest(),r.graph&&r.graph.add(e.entries,{name:r.name}),e}function _n(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))_n(r[e]);return Object.freeze(r)}var bn=new WeakSet;function cr(r){let e=r.cache,t=typeof e=="number"&&Number.isFinite(e);!t&&e!==void 0&&!bn.has(r)&&(bn.add(r),console.warn(`bumpCursor: cursor cache held a non-numeric value (${String(e)}); resetting to 0. Causes include: a snapshot codec round-tripping the cursor as a string / null / NaN, OR a malformed initial seed (e.g. state<number>(NaN)). Audit consumers may see colliding seq values after this point.`));let s=(t?e:0)+1;return r.down([[q],[$,s]]),s}function yn(r,e,t,n,s,o){let i=e(t,n,s);if(i===void 0)return;let a=o!=null?{...i,handlerVersion:o}:i;r.append(a)}function Se(r,e){let t=e.freeze??!0;return function(...s){let o=t?s.map(_n):s,i=ce(),a,d,u=!1,l;try{ae(()=>{e.seq&&(l=cr(e.seq));try{a=r(...o),e.audit&&e.onSuccess&&yn(e.audit,e.onSuccess,o,a,{t_ns:i,seq:l},e.handlerVersion)}catch(h){throw d=h,u=!0,h}})}catch(h){if(u&&e.audit&&e.onFailure){let p=d instanceof Error?d.name:typeof d;yn(e.audit,e.onFailure,o,d,{t_ns:i,seq:l,errorType:p},e.handlerVersion)}throw u?d:h}return a}}gn();function Ie(r,e){return Bt("orchestration",r,e)}var wn=r=>r.action,Fe=class extends Ee{constructor(e,t){super(e,t)}task(e,t,n={}){let s=(n.deps??[]).map(i=>this._resolveStep(i)),o=J(s,t,{name:e,describeKind:"derived",meta:Ie("task",n.meta)});return this.add(o,{name:e}),o}classify(e,t,n,s={}){let o=this._resolveStep(t),i=J([o],([a])=>{try{return{tag:n(a),value:a}}catch(d){return{tag:"error",value:a,error:d}}},{name:e,describeKind:"derived",meta:Ie("classify",s.meta)});return this.add(i,{name:e}),i}combine(e,t,n={}){let s=Object.keys(t),o=s.map(a=>this._resolveStep(t[a])),i=J(o,a=>{let d={};for(let u=0;u<s.length;u++)d[s[u]]=a[u];return d},{name:e,describeKind:"derived",meta:Ie("combine",n.meta)});return this.add(i,{name:e}),i}approvalGate(e,t,n={}){let s=n.maxPending??1e3;if(s<1&&s!==Number.POSITIVE_INFINITY)throw new RangeError("approvalGate: maxPending must be >= 1");let o=n.startOpen??!1;typeof t!="string"&&this.nameOf(t)===void 0&&this.add(t,{name:`${e}/source`});let i=this._resolveStep(t),a=new Ee(`${e}_state`),d=ne([],{name:"pending",equals:()=>!1}),u=ne(o,{name:"isOpen"}),l=J([d],([D])=>D.length,{name:"count"}),h=ne(0,{name:"droppedCount"}),p=vn({name:"decisions",retainedLimit:1024,graph:a});a.add(d,{name:"pending"}),a.add(u,{name:"isOpen"}),a.add(l,{name:"count"}),a.add(h,{name:"droppedCount"}),this.mount(`${e}_state`,a);let f=[],c=!1,v=!1,g=o,k=u.subscribe(D=>{for(let C of D)C[0]===$&&(g=C[1])});this.addDisposer(k);function y(){d.emit([...f])}function b(D,C,A){p.append({action:D,t_ns:ce(),...C!==void 0?{items:C,count:C.length}:{},...A!==void 0?{unflushed:A}:{},...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}function _(D){if(f.push(D),f.length>s){let C=f.shift();h.emit(h.cache+1),b("drop",[C])}y()}function w(D){let C=f.splice(0,D);return y(),C}let x=ue([i],(D,C,A)=>{let Y=A.terminalDeps[0];if(Y!==void 0){c=!0;let oe=f.length;f=[],y(),b("teardown",void 0,oe),C.down(Y===!0?[[H]]:[[I,Y]]);return}let W=D[0];if(W==null||W.length===0){C.down([[U]]);return}for(let oe of W)g?C.emit(oe):(_(oe),C.down([[U]]))},{name:e,describeKind:"derived",meta:Ie("approval_gate",n.meta)});if(this.add(x,{name:e}),n.approver!=null){n.approver.cache&&(u.emit(!0),g=!0,n.onceOnly&&(v=!0));let C=n.approver.subscribe(A=>{for(let Y of A){if(Y[0]!==$)continue;let W=!!Y[1];if(W&&!g){if(n.onceOnly){if(v)continue;v=!0}ae(()=>{u.emit(!0);let oe=w(f.length);b("open",oe);for(let R of oe){if(c)break;x.emit(R)}})}else if(!W&&g){if(n.onceOnly&&v)continue;ae(()=>{u.emit(!1),b("close")})}}});this.addDisposer(C)}let m=D=>{if(c)throw new Error(`approvalGate: ${D}() called after the gate was torn down`)},T=(D=1)=>{m("approve");let C=w(D);for(let A of C){if(c)break;x.emit(A)}},O=(D=1)=>{m("reject"),w(D)},E=(D,C=1)=>{m("modify");let A=[...f],Y=w(C);for(let W=0;W<Y.length&&!c;W++)x.emit(D(Y[W],W,A))},N=()=>{m("open"),u.emit(!0);let D=w(f.length);for(let C of D){if(c)break;x.emit(C)}},S=()=>{m("close"),!(n.onceOnly&&v)&&u.emit(!1)},G=Se(T,{audit:p,freeze:!1,onSuccess:(D,C,A)=>({action:"approve",count:D[0]??1,t_ns:A.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,A)=>({action:"drop",t_ns:A.t_ns,errorType:A.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),M=Se(O,{audit:p,freeze:!1,onSuccess:(D,C,A)=>({action:"reject",count:D[0]??1,t_ns:A.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,A)=>({action:"drop",t_ns:A.t_ns,errorType:A.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),se=Se(E,{audit:p,freeze:!1,onSuccess:(D,C,A)=>({action:"modify",count:D[1]??1,t_ns:A.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,A)=>({action:"drop",t_ns:A.t_ns,errorType:A.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),ee=Se(N,{audit:p,freeze:!1,onSuccess:(D,C,A)=>({action:"open",t_ns:A.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,A)=>({action:"drop",t_ns:A.t_ns,errorType:A.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),ye=Se(S,{audit:p,freeze:!1,onSuccess:(D,C,A)=>({action:"close",t_ns:A.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,A)=>({action:"drop",t_ns:A.t_ns,errorType:A.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})});return this.addDisposer(l.subscribe(()=>{})),{node:x,pending:d,count:l,isOpen:u,droppedCount:h,decisions:p,audit:p,approve:G,reject:M,modify:se,open:ee,close:ye}}approval(e,t,n,s={}){return this.approvalGate(e,t,{...s,approver:n,maxPending:1})}catch(e,t,n,s={}){let o=this._resolveStep(t),i=s.on??"errored",a=ue([o],(d,u,l)=>{let h=l.terminalDeps[0];if(h!==void 0){let f=h===!0?{kind:"completed"}:{kind:"errored",error:h};if(i==="terminal"||i===f.kind){u.emit(n(f,u));return}u.down(f.kind==="completed"?[[H]]:[[I,f.error]]);return}let p=d[0];if(p==null||p.length===0){u.down([[U]]);return}for(let f of p)u.emit(f)},{name:e,describeKind:"derived",completeWhenDepsComplete:s.completeWhenDepsComplete??!(i==="completed"||i==="terminal"),errorWhenDepsError:!(i==="errored"||i==="terminal"),meta:Ie("catch",s.meta)});return this.add(a,{name:e}),a}_resolveStep(e){if(typeof e=="string")return this.resolve(e);if(this.nameOf(e)===void 0)throw new Error(`PipelineGraph "${this.name}": Node dep is not registered. Pass a string path or call graph.add(node) first.`);return e}};function Tn(r,e){let t=new Fe(r,e),{factory:n,factoryArgs:s,...o}=e??{};return t.tagFactory("pipelineGraph",zt(o)),t}0&&(module.exports={PipelineGraph,decisionKeyOf,pipelineGraph});
1
+ "use strict";var tt=Object.defineProperty;var Rn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var An=Object.prototype.hasOwnProperty;var z=(r,e)=>()=>(r&&(e=r(r=0)),e);var Sn=(r,e)=>{for(var t in e)tt(r,t,{get:e[t],enumerable:!0})},Dn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of En(e))!An.call(r,s)&&s!==t&&tt(r,s,{get:()=>e[s],enumerable:!(n=Rn(e,s))||n.enumerable});return r};var Cn=r=>Dn(tt({},"__esModule",{value:!0}),r);function ze(){return _e>0||Me}function xt(){return _e>0}function Te(r){_e>0?Ge.push(r):r()}function ie(r){_e+=1;let e=!1;try{r()}catch(t){throw e=!0,t}finally{if(_e-=1,_e===0)if(e){if(!Me){let t=Ge.splice(0);for(let n of t)try{n()}catch{}he.length=0,ge.length=0,we.length=0}}else Mn()}}function Mn(){let r=!Me;r&&(Me=!0);let e=[],t=0;try{for(;he.length>0||ge.length>0||we.length>0||r&&Ge.length>0;){if(r&&Ge.length>0){let o=Ge.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw he.length=0,ge.length=0,we.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(he.length>0?he:ge.length>0?ge:we).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{r&&(Me=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function je(r,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!ze()){r(e);return}(u>=5?we:u===4?ge:he).push(()=>r(e));return}let n=e.length,s=n,o=n,i=n,a=0;for(;a<n&&t(e[a][0])<3;)a++;for(s=a;a<n&&t(e[a][0])===3;)a++;for(o=a;a<n&&t(e[a][0])===4;)a++;i=a;let d=ze();if(s>0){let u=e.slice(0,s);r(u)}if(o>s){let u=e.slice(s,o);d?he.push(()=>r(u)):r(u)}if(i>o){let u=e.slice(o,i);d?ge.push(()=>r(u)):r(u)}if(n>i){let u=e.slice(i,n);d?we.push(()=>r(u)):r(u)}}var _e,Me,he,ge,we,Ge,Ne=z(()=>{"use strict";_e=0,Me=!1,he=[],ge=[],we=[],Ge=[]});function ue(){return Math.trunc(performance.now()*1e6)}function ce(){return Date.now()*1e6}var ke=z(()=>{"use strict"});var xe,F,K,W,ne,ae,le,H,V,P,Oe,nt,Gn,rt,Pn,$n,st,Ot,Rt,Et,ot,fe=z(()=>{"use strict";xe=Symbol.for("graphrefly/START"),F=Symbol.for("graphrefly/DATA"),K=Symbol.for("graphrefly/DIRTY"),W=Symbol.for("graphrefly/RESOLVED"),ne=Symbol.for("graphrefly/INVALIDATE"),ae=Symbol.for("graphrefly/PAUSE"),le=Symbol.for("graphrefly/RESUME"),H=Symbol.for("graphrefly/TEARDOWN"),V=Symbol.for("graphrefly/COMPLETE"),P=Symbol.for("graphrefly/ERROR"),Oe=Object.freeze([K]),nt=Object.freeze([W]),Gn=Object.freeze([ne]),rt=Object.freeze([xe]),Pn=Object.freeze([V]),$n=Object.freeze([H]),st=Object.freeze([Oe]),Ot=Object.freeze([nt]),Rt=Object.freeze([Gn]),Et=Object.freeze([Pn]),ot=Object.freeze([$n])});function At(r){return Array.isArray(r)?[...r]:[r]}function Fn(r,e){return r.has(e)||r.has("*")}function St(r){let e=[];return r((s,o)=>{e.push({kind:"allow",actions:new Set(At(s)),where:o?.where??(()=>!0)})},(s,o)=>{e.push({kind:"deny",actions:new Set(At(s)),where:o?.where??(()=>!0)})}),(s,o)=>{let i=!1,a=!1;for(let d of e)Fn(d.actions,o)&&d.where(s)&&(d.kind==="deny"?i=!0:a=!0);return i?!1:a}}function it(r){let e=In.filter(t=>r({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var Q,In,Pe=z(()=>{"use strict";Q=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};In=["human","llm","wallet","system"]});function Ct(r,e){let t=new TextEncoder().encode(r.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${r.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let n=r.version;if(!Number.isInteger(n)||n<0||n>65535)throw new Error(`encodeEnvelope: codec.version ${n} out of u16 range (expected integer 0\u201365535)`);let s=2+t.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=at,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=n>>>8&255,o[i++]=n&255,o.set(e,i),o}function Mt(r,e){if(r.length<Dt)throw new Error(`decodeEnvelope: bytes too short (${r.length} < ${Dt})`);let t=0,n=r[t++];if(n!==at)throw new Error(`decodeEnvelope: unsupported envelope version ${n} (expected ${at})`);let s=r[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>r.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${r.length})`);let o=new TextDecoder().decode(r.subarray(t,t+s));t+=s;let i=(r[t]<<8|r[t+1])>>>0;t+=2;let a=r.subarray(t),d=e.lookupCodec(o);if(d==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:d,codecVersion:i,payload:a}}function Gt(r){r.registerCodec(Ln)}var Ln,at,Dt,dt=z(()=>{"use strict";Ln={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let t=new TextDecoder().decode(r);return JSON.parse(t)}},at=1,Dt=4});function Be(r){if(r==null)return Re;let{type:e,id:t,...n}=r;return{type:e??"system",id:t??"",...n}}var Re,ut=z(()=>{"use strict";Re={type:"system",id:""}});function Pt(r){r.registerMessageType(xe,{tier:0,wireCrossing:!1}),r.registerMessageType(K,{tier:1,wireCrossing:!1}),r.registerMessageType(ne,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(ae,{tier:2,wireCrossing:!1}),r.registerMessageType(le,{tier:2,wireCrossing:!1}),r.registerMessageType(F,{tier:3,wireCrossing:!0}),r.registerMessageType(W,{tier:3,wireCrossing:!0}),r.registerMessageType(V,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(P,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(H,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var He,$t=z(()=>{"use strict";fe();He=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let n=this._messageTypes.get(t);return n!=null?n.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function ct(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(ct);if(typeof r=="object"&&r!==null){let e={};for(let t of Object.keys(r).sort())e[t]=ct(r[t]);return e}return null}function jn(r){let e=zn.encode(r),t=e.length,n=t*8,s=t+9+63&-64,o=new Uint8Array(s);o.set(e),o[t]=128;let i=new DataView(o.buffer);i.setUint32(s-4,n>>>0,!1),i.setUint32(s-8,Math.floor(n/4294967296)>>>0,!1);let a=1779033703,d=3144134277,u=1013904242,c=2773480762,h=1359893119,f=2600822924,p=528734635,l=1541459225,v=new Uint32Array(64),g=(y,b)=>y>>>b|y<<32-b;for(let y=0;y<s;y+=64){for(let k=0;k<16;k++)v[k]=i.getUint32(y+k*4,!1);for(let k=16;k<64;k++){let A=v[k-15],G=v[k-2],M=g(A,7)^g(A,18)^A>>>3,se=g(G,17)^g(G,19)^G>>>10;v[k]=v[k-16]+M+v[k-7]+se>>>0}let b=a,_=d,w=u,x=c,m=h,T=f,O=p,E=l;for(let k=0;k<64;k++){let A=g(m,6)^g(m,11)^g(m,25),G=m&T^~m&O,M=E+A+G+Vn[k]+v[k]>>>0,se=g(b,2)^g(b,13)^g(b,22),te=b&_^b&w^_&w,ve=se+te>>>0;E=O,O=T,T=m,m=x+M>>>0,x=w,w=_,_=b,b=M+ve>>>0}a=a+b>>>0,d=d+_>>>0,u=u+w>>>0,c=c+x>>>0,h=h+m>>>0,f=f+T>>>0,p=p+O>>>0,l=l+E>>>0}let N=y=>y.toString(16).padStart(8,"0");return N(a)+N(d)+N(u)+N(c)+N(h)+N(f)+N(p)+N(l)}function lt(r){let e=ct(r??null),t=JSON.stringify(e);return jn(t).slice(0,16)}function Bn(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function ft(r,e,t){let n=t?.id??Bn();if(r===0)return{id:n,version:0};let o=(t?.hash??lt)(e);return{id:n,version:0,cid:o,prev:null}}function Ft(r,e,t){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=t(e))}var Vn,zn,It=z(()=>{"use strict";Vn=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),zn=new TextEncoder});function zt(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function pt(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function We(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function de(r,e,t){let n=jt(r)?r:[],s=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return jt(r)?o=(ht(e)?e:t)??{}:ht(r)?o=r:o=(ht(e)?e:t)??{},new j(n,s,o)}var Lt,Vt,Hn,Wn,Ee,j,jt,ht,me=z(()=>{"use strict";dt();ut();Ne();ke();$t();Pe();fe();It();Lt=()=>{},Vt=100;Hn=(r,e,t,n)=>{t.direction==="down-in"&&r._onDepMessage(t.depIndex,e)},Wn=(r,e,t,n)=>{let s=r;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[rt]:[rt,[F,o]];s._status==="dirty"&&i.push(Oe),je(e,i,s._config.tierOf)},Ee=new He({onMessage:Hn,onSubscribe:Wn});Pt(Ee);Gt(Ee);j=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,n){this._config=n.config??Ee,this._config.onMessage,this._optsName=n.name,this._describeKind=n.describeKind,this._equals=n.equals??Object.is,this._resubscribable=n.resubscribable??!1,this._resetOnTeardown=n.resetOnTeardown??!1,this._autoComplete=n.completeWhenDepsComplete??!0,this._autoError=n.errorWhenDepsError??!0,this._pausable=n.pausable??!0,this._guard=n.guard,this._fn=t,this._partial=n.partial??!1,this._cached=n.initial!==void 0?n.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=n.versioningHash??this._config.defaultHashFn??lt;let s=n.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?ft(s,this._cached===void 0?void 0:this._cached,{id:n.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(zt);let o={};for(let[a,d]of Object.entries(n.meta??{})){let u={initial:d,name:`${n.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};n.guard!=null&&(u.guard=n.guard),n.resubscribable===!0&&(u.resubscribable=!0),o[a]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[F,a]])},down(a){i._emit(We(a))},up(a){i._emitUp(We(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let n=this._versioningLevel;if(n!=null&&e<=n)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,d=i?.version??0,u=ft(e,o,{id:a,hash:s});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=Be(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let n of this._extraGuards)if(!n(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,n=e?.actor!=null;if(!t&&!n)return;let s=Be(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new Q({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new Q({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:ce()}}down(e,t){let n=We(e);n.length!==0&&(this._checkGuard(t),this._emit(n))}emit(e,t){this._checkGuard(t),this._emit([[F,e]])}up(e,t){if(this._deps.length===0)return;let n=We(e);if(n.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(n);for(let o of this._deps)o.node.up?.(n,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let n of e){let s=t(n[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=Be(t);if(!this._guard(d,"observe"))throw new Q({actor:d,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)pt(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let n=0;n<e;n++){let s=n,o=this._deps[n];o.unsub=Lt,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,d=!1;for(let u of i)a(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:s},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(n){this._deps[t].unsub=null;for(let s=0;s<t;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}pt(o)}}throw this._dirtyDepCount=0,n}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,n=zt(e);if(this._deps.push(n),this._sinks==null)return t;n.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(st),n.unsub=Lt;try{n.unsub=e.subscribe(s=>{if(n.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw n.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(n){this._emit([[P,this._wrapFnError("cleanup threw",n)]])}else if(t!=null&&typeof t=="object"){let n=t.deactivate;if(typeof n=="function")try{n()}catch(s){this._emit([[P,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let n of this._deps){if(n.unsub!=null){let s=n.unsub;n.unsub=null;try{s()}catch{}}pt(n)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let n=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(o)}if(s!==xe){if(s===K){this._depDirtied(n);return}if(s===ne){if(this._depInvalidated(n),this._cached===void 0)return;this._emit(Rt);return}if(s===ae||s===le){this._emit([t]);return}if(s===H){this._emit(ot);return}if(s===F)this._depSettledAsData(n,t[1]);else if(s===W)this._depSettledAsResolved(n);else if(s===V)this._depSettledAsTerminal(n,!0);else if(s===P)this._depSettledAsTerminal(n,t[1]);else{this._emit([t]);return}if(!this._fn){(s===F||s===W)&&this._emit([t]),(s===V||s===P)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(st))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Ot),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[P,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(Et)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(i){this._emit([[P,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[P,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),n=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let s=this._deps.map(i=>i.terminal),o={prevData:n,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:n};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,o);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[P,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Vt?(this._rerunDepth=0,this._emit([[P,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Vt} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let n=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${n}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[Oe,e[0]]:e;let n=!0,s=!1,o=!1,i=-1;for(let d of e){let u=t(d[0]);u<i&&(n=!1),u===3&&(s=!0),d[0]===K&&(o=!0),i=u}let a=e;if(!n){let d=e.map((u,c)=>({m:u,i:c,tier:t(u[0])}));d.sort((u,c)=>u.tier-c.tier||u.i-c.i),a=d.map(u=>u.m)}if(s&&!o&&this._status!=="dirty"){let d=0;for(;d<a.length&&t(a[d][0])===0;)d++;return d===0?[Oe,...a]:[...a.slice(0,d),Oe,...a.slice(d)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let d=e[a];if(d[0]===P&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(d=>d[0]===H||d[0]===ne);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let d=t[a],u=d[0];if(u!==ae&&u!==le){s?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===ae?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let h=d[1];if(u===ae)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(h),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(h))c=!1;else if(this._pauseLocks.delete(h),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let f=this._pauseBuffer;this._pauseBuffer=[],this._emit(f)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?s?.push(d):s==null&&(s=t.slice(0,a))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(a=>a[0]===H))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(ot)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,d=[];for(let u of o)a(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[P,i]])}_updateState(e){let t=this._config.tierOf,n,s,o=-1,i=0;for(let c of e)t(c[0])===3&&i++;let a=i<=1,d=-1;if(this._versioning!=null&&i>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===F){d=c;break}}for(let c=0;c<e.length;c++){let h=e[c],f=h[0];if(f===F){if(h.length>=2){let p=!1;if(a&&this._cached!==void 0)try{p=this._equals(this._cached,h[1])}catch(l){s=this._wrapFnError("equals threw",l),o=c;break}if(p){n==null&&(n=e.slice(0,c)),n.push(nt),this._status="resolved";continue}this._cached=h[1],this._versioning!=null&&(d<0||c===d)&&Ft(this._versioning,h[1],this._hashFn)}this._status="settled",n?.push(h)}else if(n?.push(h),f===K)this._status="dirty";else if(f===W)this._status="resolved";else if(f===V){this._status="completed";{let p=this._config.rigorRecorder;if(p!=null)try{p.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===P){this._status="errored";{let p=this._config.rigorRecorder;if(p!=null)try{p.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(f===ne){if(this._cached!==void 0){let l=this._config.rigorRecorder;if(l!=null)try{l.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let p=this._cleanup;if(typeof p=="function"){this._cleanup=void 0;try{p()}catch{}}else if(p!=null&&typeof p=="object"){let l=p.invalidate;if(typeof l=="function")try{l()}catch{}}}else f===H&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?n??e.slice(0,o):n??e;return s!=null?{finalMessages:u,equalsError:s}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let n of t)n(e)};_dispatchOrAccumulate(e){if(xt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Te(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}je(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let t=this._frameBatch(e);je(this._deliverToSinks,t,this._config.tierOf)}},jt=r=>Array.isArray(r),ht=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function mt(r,e){if(e!=null&&e.length>0)return new Set(e);switch(r){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function Un(r){return r._describeKind!=null?r._describeKind:r._deps.length>0?"derived":r._fn!=null?"producer":"state"}function Bt(r){let e=new WeakSet,t={};for(let[n,s]of Ht(r))t[n]=gt(s,e);return t}function gt(r,e){if(r==null)return r;let t=typeof r;if(t==="boolean"||t==="number"||t==="string")return r;if(t==="function")return"<function>";if(Array.isArray(r))return e.has(r)?"<cycle>":(e.add(r),r.map(n=>gt(n,e)));if(t==="object"){let n=r;if(e.has(n))return"<cycle>";e.add(n);try{if(typeof n.subscribe=="function"&&"cache"in n)return"<Node>"}catch{return"<unserializable>"}let s={};for(let[o,i]of Ht(n))s[o]=gt(i,e);return s}return"<unserializable>"}function Ht(r){let e=[],t;try{t=Object.keys(r)}catch{return e}for(let n of t)try{e.push([n,r[n]])}catch{e.push([n,"<unserializable>"])}return e}function Kn(r){let e={};for(let[t,n]of Object.entries(r.meta))try{e[t]=n.cache}catch{}return e}function bt(r,e,t){let n=e==null,s=!n&&e!=null?[...e].filter(c=>c.startsWith("meta.")).map(c=>c.slice(5)):null,o=n||e.has("meta")||s!=null&&s.length>0,i="state",a=[];r instanceof j&&(i=Un(r),a=r._deps.map(c=>c.node.name??""));let d={type:i,deps:a};(n||e.has("status"))&&(d.status=r.status);let u=r instanceof j?r._guard:void 0;if(o){let c={...Kn(r)};if(u!=null&&c.access===void 0&&(c.access=it(u)),s!=null&&s.length>0&&!e.has("meta")){let h={};for(let f of s)f in c&&(h[f]=c[f]);d.meta=h}else d.meta=c}if(r.name!=null&&(d.name=r.name),(n||e.has("value"))&&(!t||i==="state")){r.status==="sentinel"&&(d.sentinel=!0);try{d.value=r.cache}catch{}}if((n||e.has("v"))&&r.v!=null){let c={id:r.v.id,version:r.v.version};"cid"in r.v&&(c.cid=r.v.cid,c.prev=r.v.prev),d.v=c}return(n||e.has("guard"))&&u!=null&&(d.guard=it(u)),(n||e.has("lastMutation"))&&r.lastMutation!=null&&(d.lastMutation=r.lastMutation),d}var yt=z(()=>{"use strict";Pe();me()});function ee(r,e){return de([],{...e,initial:r})}function be(r,e){return de((n,s,o)=>r(s,o)??void 0,{describeKind:"producer",...e})}function Y(r,e,t){return de(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);o.emit(e(a,i))},{describeKind:"derived",...t})}function Wt(r,e,t){return de(r,(s,o,i)=>{let a=s.map((d,u)=>d!=null&&d.length>0?d.at(-1):i.prevData[u]);return e(a,o,i)??void 0},{describeKind:"effect",...t})}var $e=z(()=>{"use strict";me()});function Ut(r,e,t){return{[r]:!0,[`${r}_type`]:e,...t??{}}}var Kt=z(()=>{"use strict"});function vt(r,e){if(Object.is(r,e))return!0;if(r==null||e==null||typeof r!="object"||typeof e!="object")return!1;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let o=0;o<r.length;o++)if(!vt(r[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(r),n=Object.keys(e);if(t.length!==n.length)return!1;let s=new Set(n);for(let o of t)if(!s.has(o)||!vt(r[o],e[o]))return!1;return!0}function qt(r,e){return`${r}\0${e}`}function _t(r,e){let t=[],n=new Set(r.subgraphs),s=new Set(e.subgraphs),o=[];for(let g of s)n.has(g)||o.push(g);o.sort();for(let g of o)t.push({type:"subgraph-mounted",path:g});let i=new Set(Object.keys(r.nodes)),a=new Set(Object.keys(e.nodes)),d=[];for(let g of a)i.has(g)||d.push(g);d.sort();for(let g of d)t.push({type:"node-added",path:g,node:{...e.nodes[g]}});let u=[];for(let g of a){if(!i.has(g))continue;let N=r.nodes[g]?.meta,y=e.nodes[g]?.meta;N==null&&y==null||vt(N??{},y??{})||u.push(g)}u.sort();for(let g of u)t.push({type:"node-meta-changed",path:g,prevMeta:r.nodes[g]?.meta??{},nextMeta:e.nodes[g]?.meta??{}});let c=new Map;for(let g of r.edges)c.set(qt(g.from,g.to),g);let h=new Map;for(let g of e.edges)h.set(qt(g.from,g.to),g);let f=[];for(let[g,N]of h)c.has(g)||f.push(N);f.sort((g,N)=>g.from<N.from?-1:g.from>N.from?1:g.to<N.to?-1:g.to>N.to?1:0);for(let g of f)t.push({type:"edge-added",from:g.from,to:g.to});let p=[];for(let[g,N]of c)h.has(g)||p.push(N);p.sort((g,N)=>g.from<N.from?-1:g.from>N.from?1:g.to<N.to?-1:g.to>N.to?1:0);for(let g of p)t.push({type:"edge-removed",from:g.from,to:g.to});let l=[];for(let g of i)a.has(g)||l.push(g);l.sort();for(let g of l)t.push({type:"node-removed",path:g});let v=[];for(let g of n)s.has(g)||v.push(g);v.sort();for(let g of v)t.push({type:"subgraph-unmounted",path:g});return{events:t,flushedAt_ns:ue()}}var Yt=z(()=>{"use strict";ke()});function wt(r){return{describeKind:"producer",...r}}function Jt(r,e){return be(t=>{let n=!1;try{for(let s of r){if(n)return;t.emit(s)}n||t.down([[V]])}catch(s){n||t.down([[P,s]])}return()=>{n=!0}},wt(e))}function qn(r){return r!=null&&typeof r.then=="function"}function Yn(r,e){let{signal:t,...n}=e??{};return be(s=>{let o=!1,i=()=>{o||(o=!0,s.down([[P,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(r).then(a=>{o||(o=!0,t?.removeEventListener("abort",i),s.emit(a),s.down([[V]]))},a=>{o||(o=!0,t?.removeEventListener("abort",i),s.down([[P,a]]))}),()=>{o=!0,t?.removeEventListener("abort",i)}},wt(n))}function Jn(r,e){let{signal:t,...n}=e??{};return be(s=>{let o=new AbortController,i=()=>o.abort(t?.reason);t?.aborted?o.abort(t.reason):t?.addEventListener("abort",i,{once:!0});let a=t??o.signal,d=!1,u=r[Symbol.asyncIterator](),c=()=>{d||a.aborted||Promise.resolve(u.next()).then(h=>{if(!(d||a.aborted)){if(h.done){s.down([[V]]);return}s.emit(h.value),c()}},h=>{!d&&!a.aborted&&s.down([[P,h]])})};return c(),()=>{d=!0,t?.removeEventListener("abort",i),o.abort(),Promise.resolve(u.return?.()).catch(()=>{})}},wt(n))}function Xn(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"}function Xt(r,e){if(Xn(r))return r;if(qn(r))return Yn(r,e);if(r!=null){let t=r;if(typeof t[Symbol.asyncIterator]=="function")return Jn(r,e);if(typeof t[Symbol.iterator]=="function")return Jt(r,e)}return Zn(r)}function Zn(...r){return Jt(r,void 0)}function Ue(r){return r.subscribe(()=>{})}var Zt=z(()=>{"use strict";fe();$e()});var Qt=z(()=>{"use strict";Zt()});var Ke,en=z(()=>{"use strict";Ke=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Fe,tn=z(()=>{"use strict";Fe=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function nn(r,e,t,n={}){let s=e in r.nodes,o=t in r.nodes;if(!s)return qe(e,t,"no-such-from");if(!o)return qe(e,t,"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(e===t){if(n.findCycle===!0){let u=Qn(r,e,n);if(u!=null)return u}let d=Ye(e,r.nodes[e],0,n);return Je(e,t,[d])}if(i===0)return qe(e,t,"no-path");let a=rn(r,e,t,i);return a.found?Je(e,t,sn(r,a.pathOrder,n)):qe(e,t,a.truncated?"max-depth-exceeded":"no-path")}function rn(r,e,t,n){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,d=!1;for(;a<o.length;){let h=o[a++];if(h.path===e)break;if(n!=null&&h.depth>=n){let v=r.nodes[h.path];v?.deps&&v.deps.length>0&&(d=!0);continue}let f=r.nodes[h.path];if(f==null)continue;let p=f.deps??[],l=new Map;for(let v=0;v<p.length;v++){let g=p[v];if(!g)continue;let N=l.get(g);N==null&&(N=[],l.set(g,N)),N.push(v)}for(let[v,g]of l)i.has(v)||(i.add(v),s.set(v,{from:h.path,depIndices:g}),o.push({path:v,depth:h.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:d};let u=[{path:e}],c=e;for(;c!==t;){let h=s.get(c);if(h==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=h.depIndices,u.push({path:h.from}),c=h.from}return{found:!0,pathOrder:u,truncated:!1}}function Qn(r,e,t){let n=r.nodes[e];if(n==null)return null;let s=n.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=Ye(e,n,0,t);a.dep_index=o[0];let d=Ye(e,n,1,t);return Je(e,e,[a,d])}let i=null;for(let a=0;a<s.length;a++){let d=s[a];if(!d||d===e)continue;let u=rn(r,d,e,t.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:Je(e,e,sn(r,i.pathOrder,t))}function sn(r,e,t){return e.map((n,s)=>{let o=r.nodes[n.path],i=Ye(n.path,o,s,t);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 Ye(r,e,t,n){let s={path:r,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=n.annotations?.get(r)??e.annotation;o!=null&&(s.annotation=o);let i=n.lastMutations?.get(r)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function Je(r,e,t){return on(r,e,!0,"ok",t)}function qe(r,e,t){return on(r,e,!1,t,[])}function on(r,e,t,n,s){let o=er(r,e,t,n,s);return{from:r,to:e,found:t,reason:n,steps:s,text:o,toJSON(){return{from:r,to:e,found:t,reason:n,steps:s}}}}function er(r,e,t,n,s){if(!t)switch(n){case"no-such-from":return`explainPath: no node named "${r}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${r}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${r}" to "${e}"`}let o=[`Causal path: ${r} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let d=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(d),"value"in i&&o.push(` value: ${tr(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;o.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return o.join(`
2
+ `)}function tr(r){if(r===void 0)return"<sentinel>";if(r===null)return"null";if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||typeof r=="bigint")return String(r);try{let e=JSON.stringify(r);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(r)}}var an=z(()=>{"use strict"});function dn(r){let e=new WeakSet,t=new WeakSet,n=[r],s=0;for(;n.length>0;){let o=n.pop();s+=rr(o,e,t,n)}return s}function rr(r,e,t,n){if(r==null)return 0;switch(typeof r){case"number":return B.number;case"boolean":return B.boolean;case"string":return B.string+r.length*2;case"bigint":return B.bigint+sr(r);case"symbol":return B.symbol;case"function":return e.has(r)?0:(e.add(r),B.function);case"undefined":return 0}let o=r;if(e.has(o))return 0;e.add(o);let i=o[nr];if(typeof i=="function")try{let u=i.call(o);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(o instanceof Date)return B.date;if(o instanceof RegExp)return B.regexp+o.source.length*2;if(o instanceof Error){let u=o.message?o.message.length*2:0,c=o.stack?o.stack.length*2:0;return B.error+u+c}if(typeof URL<"u"&&o instanceof URL)return B.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return B.promise;if(o instanceof WeakMap)return B.weakmap;if(o instanceof WeakSet)return B.weakset;if(o instanceof Map){let u=B.map;for(let[c,h]of o)u+=B.mapEntry,n.push(c),n.push(h);return u}if(o instanceof Set){let u=B.set;for(let c of o)u+=B.setEntry,n.push(c);return u}if(Array.isArray(o)){let u=B.array+o.length*8;for(let c of o)n.push(c);return u}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let u=o;return t.has(u.buffer)?48:(t.add(u.buffer),u.buffer.byteLength+48)}let a=B.object,d=Object.keys(o);for(let u of d){a+=B.string+u.length*2;try{n.push(o[u])}catch{}}return a}function sr(r){let e=r<0n?-r:r;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var B,nr,un=z(()=>{"use strict";B={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},nr=Symbol.for("sizeof")});function cn(r,e){let t=e?.topN??10,n=r.describe({detail:"standard"}),s=[],o=r._collectObserveTargets;typeof o=="function"&&o.call(r,"",s);let i=new Map;for(let[f,p]of s)i.set(f,p);let a=[];for(let[f,p]of Object.entries(n.nodes)){let l=i.get(f),v=l instanceof j?l:null,g=v?dn(v.cache):0,N=v?v._sinkCount:0,y=p.deps?.length??0,b=p.type==="effect"&&N===0,_=N===0?p.type==="effect"?"orphan-effect":p.type==="derived"?"idle-derived":p.type==="producer"?"idle-producer":null:null;a.push({path:f,type:p.type,status:p.status??"unknown",valueSizeBytes:g,subscriberCount:N,depCount:y,isOrphanEffect:b,orphanKind:_})}let d=a.reduce((f,p)=>f+p.valueSizeBytes,0),u=(f,p)=>[...a].sort(p??((l,v)=>v[f]-l[f])).slice(0,t),c=a.filter(f=>f.orphanKind!=null),h=a.filter(f=>f.isOrphanEffect);return{nodeCount:a.length,edgeCount:n.edges.length,subgraphCount:n.subgraphs.length,nodes:a,totalValueSizeBytes:d,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:c,orphanEffects:h}}var ln=z(()=>{"use strict";me();un()});function Xe(r,e){let t=Math.max(16,r.size*4),n=0;for(;r.size>0;){if(n++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${r.size} disposer(s) discarded`),r.clear();return}let s=r.values().next();if(s.done)return;let o=s.value;r.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function bn(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function or(r){if(r!=null)return bn(r)?r.cache:r}function ye(r){return r!=null&&typeof r=="object"&&"cache"in r&&typeof r.subscribe=="function"&&typeof r.down=="function"}function pe(r){return ye(r)?r.cache??"":r}function fn(r){return ye(r)?r.cache??0:r}function pn(r){return ye(r)?r.cache??!1:r}function ir(r){let e=[];for(let t of Object.keys(r).sort()){let n=r[t].v;n!=null&&e.push(`${t} ${n.id} ${n.version}`)}return e.join(`
3
+ `)}function hn(r){if(r.version!==Ae)throw new Error(`unsupported snapshot version ${String(r.version)} (expected ${Ae})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in r))throw new Error(`snapshot missing required key "${e}"`);if(typeof r.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof r.nodes!="object"||r.nodes===null||Array.isArray(r.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(r.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(r.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function ar(r,e){let t=new WeakMap,n=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,d=o.constructor;if(a!==d)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let f=o;if(s.length!==f.length)return!1;for(let p=0;p<s.length;p++)if(!n(s[p],f[p]))return!1;return!0}if(s instanceof Map){let f=o;if(s.size!==f.size)return!1;for(let[p,l]of s)if(!f.has(p)||!n(l,f.get(p)))return!1;return!0}if(s instanceof Set){let f=o;if(s.size!==f.size)return!1;for(let p of s){let l=!1;for(let v of f)if(n(p,v)){l=!0;break}if(!l)return!1}return!0}if(ArrayBuffer.isView(s)){let f=s,p=o;if(f.length!==p.length)return!1;for(let l=0;l<f.length;l++)if(f[l]!==p[l])return!1;return!0}let u=Object.keys(s),c=Object.keys(o);if(u.length!==c.length)return!1;let h=new Set(c);for(let f of u)if(!h.has(f)||!n(s[f],o[f]))return!1;return!0};return n(r,e)}function dr(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(r){let e="^";for(let t=0;t<r.length;t+=1){let n=r[t];if(n==="*"){e+=".*";continue}if(n==="?"){e+=".";continue}if(n==="["){let s=r.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=r.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=dr(n)}return e+="$",new RegExp(e)}function Tt(r){if(typeof r=="string")return JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean"||r==null)return String(r);try{return JSON.stringify(r)}catch{return"[unserializable]"}}function lr(r){return r==="none"?cr:r==="ansi"||r==null?ur:{data:r.data??"",dirty:r.dirty??"",resolved:r.resolved??"",invalidate:r.invalidate??"",pause:r.pause??"",resume:r.resume??"",complete:r.complete??"",error:r.error??"",teardown:r.teardown??"",derived:r.derived??"",path:r.path??"",reset:r.reset??""}}function gn(r){if(r==null)return{};let e=r.detail;return e==="full"?{...r,structured:r.structured??!0,timeline:r.timeline??!0,causal:r.causal??!0,derived:r.derived??!0}:e==="minimal"?{...r,structured:r.structured??!0}:r.format==="stage-log"?{...r,structured:r.structured??!0,timeline:r.timeline??!0}:r}function fr(r,e,t){for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${r}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${n})`)}}function Nt(r,e,t){if(r==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(r.includes(L))throw new Error(`Graph "${e}": ${t} "${r}" must not contain '${L}' (path separator)`);if(r===re)throw new Error(`Graph "${e}": ${t} name "${re}" is reserved for meta companion paths`);fr(r,e,t)}function pr(r,e){if(r==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=r.split(L);for(let n of t)if(n==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function hr(r,e){let t=!1;for(let s of r)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?r.filter(s=>e.isMetaPassthrough(s[0])):r}function yn(r){for(let e of r._mounts.values())yn(e);for(let e of r._nodes.values())try{e.down([[H]],{internal:!0})}catch{}}function gr(r,e){let t=Se.diff(r,e),n={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(n[s]=o)}return{...t,nodesAddedFull:n}}function mn(r,e,t,n={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return n.withDetail?s:[];if(!n.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=n.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return n.withDetail?s:[];let i=new Map,a=new Map,d=new Map,u=new Map,c=new Set;for(let[b,_]of Object.entries(r.nodes)){if(!b)continue;c.add(b);let w=_.deps??[];i.set(b,w);for(let x of w)x&&(c.add(x),a.has(x)||a.set(x,new Set),a.get(x).add(b))}for(let b of r.edges){if(b==null||typeof b!="object")continue;let _=typeof b.from=="string"?b.from:"",w=typeof b.to=="string"?b.to:"";!_||!w||(c.add(_),c.add(w),u.has(_)||u.set(_,new Set),u.get(_).add(w),d.has(w)||d.set(w,new Set),d.get(w).add(_))}if(!c.has(e))return n.withDetail?s:[];let h=n.both===!0,f=b=>{if(h){let m=i.get(b)??[],T=d.get(b),O=a.get(b),E=u.get(b),k=[...m];return T&&k.push(...T),O&&k.push(...O),E&&k.push(...E),k}if(t==="upstream"){let m=i.get(b)??[],T=d.get(b);return T?[...m,...T]:m}let _=a.get(b),w=u.get(b),x=_?[..._]:[];return w&&x.push(...w),x},p=new Set([e]),l=new Map,v=[{path:e,depth:0}],g=0,N=!1;for(;g<v.length;){let b=v[g++];if(o!=null&&b.depth>=o){f(b.path).length>0&&(N=!0);continue}for(let _ of f(b.path))!_||p.has(_)||(p.add(_),l.set(_,b.depth+1),v.push({path:_,depth:b.depth+1}))}let y=[...l.keys()].sort((b,_)=>b<_?-1:b>_?1:0);return n.withDetail?{paths:y,depths:l,truncated:N}:y}function mr(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],s=e[t];if(n.path!==s.path||n.type!==s.type||n.status!==s.status||n.hop!==s.hop||n.dep_index!==s.dep_index||n.annotation!==s.annotation||n.value!==s.value||n.lastMutation!==s.lastMutation)return!1;let o=n.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var L,re,Ae,ur,cr,Se,vn=z(()=>{"use strict";ut();Ne();ke();Pe();fe();yt();me();$e();Yt();Qt();en();tn();dt();an();ln();L="::",re="__meta__",Ae=1;ur={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"},cr={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};Se=class r{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;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(L))throw new Error(`Graph name must not contain '${L}' (got "${e}")`);if(e===re)throw new Error(`Graph name "${re}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??Ee,this._traceRing=new Fe(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],n=e?this:this._parent;for(;n!=null;)t.push(n),n=n._parent;return t}get topology(){return this._topology==null&&(this._topology=be(e=>{let t=n=>{e.emit(n)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let n=e.name,s=t?.name??n;if(s==null||s==="")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 o=s,i=t?.annotation;if(Nt(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:ue()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof j&&t._applyVersioning(e)}remove(e){Nt(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,d]of i)a.includes(`${L}${re}${L}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${L}`)),this._mounts.delete(e),t._parent=void 0,yn(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(n),n.down([[H]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=Ze(e);return i=>o.test(i)})(),n={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);n.nodes.push(...i.nodes),n.mounts.push(...i.mounts)}return n.nodes.sort(),n.mounts.sort(),n}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,n=0;return{[Symbol.iterator](){return this},next(){if(n>=e.length)return{value:void 0,done:!0};let s=e[n++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(L))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,n){let s=n?.internal===!0;this.node(e).down([[F,t]],{actor:n?.actor,internal:s,delivery:"write"})}setAll(e,t){let n=Symbol.iterator in e?e:Object.entries(e);ie(()=>{for(let[s,o]of n)this.set(s,o,t)})}invalidate(e,t){let n=t?.internal===!0;this.node(e).down([[ne]],{actor:t?.actor,internal:n,delivery:"write"})}error(e,t,n){let s=n?.internal===!0;this.node(e).down([[P,t]],{actor:n?.actor,internal:s,delivery:"write"})}complete(e,t){let n=t?.internal===!0;this.node(e).down([[V]],{actor:t?.actor,internal:n,delivery:"write"})}_registerSelfPruningKeepalive(e){let t,n,s=()=>{t?.(),t=void 0,n?.(),n=void 0};t=e.subscribe(o=>{for(let i of o){let a=i[0];if(a===H||a===V||a===P){s();return}}}),n=this.addDisposer(s)}_wireSignalToRemove(e,t){if(t==null)return;let n=()=>{try{this.remove(e)}catch{}};if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0}),this.addDisposer(()=>t.removeEventListener("abort",n))}derived(e,t,n,s){let o=t.map(p=>this.resolve(p)),{keepAlive:i,annotation:a,equals:d,initial:u,meta:c,signal:h}=s??{},f=Y(o,n,{name:e,...d!=null?{equals:d}:{},...u!==void 0?{initial:u}:{},...c!=null?{meta:c}:{}});return this.add(f,{name:e,...a!=null?{annotation:a}:{}}),i===!0&&this._registerSelfPruningKeepalive(f),this._wireSignalToRemove(e,h),f}effect(e,t,n,s){let o=t.map(c=>this.resolve(c)),{annotation:i,meta:a,signal:d}=s??{},u=Wt(o,n,{name:e,...a!=null?{meta:a}:{}});return this.add(u,{name:e,...i!=null?{annotation:i}:{}}),this._wireSignalToRemove(e,d),u}produce(e,t,n){if(t===void 0)throw new Error(`Graph "${this.name}".produce("${e}", \u2026): source must not be \`undefined\` \u2014 undefined is the global SENTINEL (spec \xA71.1). Pass \`null\` for nullary DATA, or a Promise/AsyncIterable/Iterable for async sources.`);if(t!==null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function")throw new Error(`Graph "${this.name}".produce("${e}", \u2026): Node sources are rejected. For Node\u2192Node, use graph.derived(name, [path], ([v]) => v, { keepAlive: true }) \u2014 fromAny passes Nodes through verbatim and silently drops opts.`);let{annotation:s,meta:o,equals:i,signal:a}=n??{},d=Xt(t,{name:e,...o!=null?{meta:o}:{},...i!=null?{equals:i}:{},...a!=null?{signal:a}:{}});return this.add(d,{name:e,...s!=null?{annotation:s}:{}}),this._wireSignalToRemove(e,a),d}batch(e){ie(e)}edges(e){let t=e?.recursive===!0,n=new Map;if(!t){for(let[d,u]of this._nodes)n.set(u,d);let a=[];for(let[d,u]of this._nodes)if(u instanceof j)for(let c of u._deps){let h=n.get(c.node);h!=null&&a.push([h,d])}return a.sort((d,u)=>d[0]<u[0]?-1:d[0]>u[0]?1:d[1]<u[1]?-1:d[1]>u[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,d]of s)o.set(d,a);let i=[];for(let[a,d]of s)if(d instanceof j)for(let u of d._deps){let c=o.get(u.node);c!=null&&i.push([c,a])}return i.sort((a,d)=>a[0]<d[0]?-1:a[0]>d[0]?1:a[1]<d[1]?-1:a[1]>d[1]?1:0),i}mount(e,t){if(t===void 0){let s=new r(e);return this.mount(e,s)}if(typeof t=="function"){let s=new r(e);return t(s),this.mount(e,s)}let n=t;if(Nt(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" 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 s=this;s!=null;s=s._parent)if(s===n)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,n),n._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),n}resolve(e){let t=pr(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let n=t[0],s=t.slice(1);if(s.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 o=this._nodes.get(n);if(o&&s.length>0&&s[0]===re)return this._resolveMetaChainFromNode(o,s,t.join(L));let i=this._mounts.get(n);if(!i)throw this._nodes.has(n)?new Error(`Graph "${this.name}": "${n}" is a node; trailing path "${s.join(L)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${n}"`);return i.resolve(s.join(L))}_resolveMetaChainFromNode(e,t,n){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==re)throw new Error(`Graph "${this.name}": expected ${re} segment in meta path "${n}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${re} in "${n}"`);let a=i[o+1],d=s.meta[a];if(!d)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${n}"`);s=d,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[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(e,t??{},new Set,n),n.length>0)throw n[0]}_signalDeliver(e,t,n,s){for(let d of this._mounts.values())d._signalDeliver(e,t,n,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=hr(e,this.config);for(let d of[...this._nodes.keys()].sort()){let u=this._nodes.get(d);if(!n.has(u)){n.add(u);try{u.down(e,i)}catch(c){if(c instanceof Q)throw c;s.push(c)}a.length!==0&&this._signalMetaSubtree(u,a,n,i,s)}}}_signalMetaSubtree(e,t,n,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!n.has(a)){n.add(a);try{a.down(t,s)}catch(d){if(d instanceof Q)throw d;o.push(d)}this._signalMetaSubtree(a,t,n,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=or(e?.actor),n=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=mt(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let d=new Map;for(let[_,w]of a)d.set(w,_);let u=[];{let _=a.map(([,m])=>m),w=new Set(d.values()),x=0;for(;_.length>0;){let m=_.shift();if(m instanceof j)for(let T of m._deps){let O=T.node;if(d.has(O))continue;let E=O.name??"",k=E;if(!k||w.has(k))if(E){let A=2;for(;w.has(`${E}#${A}`);)A++;k=`${E}#${A}`}else for(k=`__internal__/${x++}`;w.has(k);)k=`__internal__/${x++}`;d.set(O,k),w.add(k),u.push([k,O]),_.push(O)}}}let c=[...a,...u],h={};for(let[_,w]of c){if(t!=null&&!w.allowsObserve(t))continue;let x=bt(w,i,o),m=w instanceof j?w._deps.map(k=>d.get(k.node)??k.node.name??""):[],{name:T,...O}=x,E={...O,deps:m};if(!o){let k=this._annotations.get(_);k!=null&&(E.annotation=k)}if(n!=null)if(typeof n=="function"){let k=n;if(!(k.length>=2?k(_,E):k(E)))continue}else{let k=!0;for(let[A,G]of Object.entries(n)){let M=A==="deps_includes"?"depsIncludes":A==="meta_has"?"metaHas":A;if(M==="depsIncludes"){if(!E.deps.includes(String(G))){k=!1;break}continue}if(M==="metaHas"){if(!Object.hasOwn(E.meta??{},String(G))){k=!1;break}continue}if(E[M]!==G){k=!1;break}}if(!k)continue}h[_]=E}let f=new Set(Object.keys(h)),p=[];for(let[_,w]of c)if(w instanceof j)for(let x of w._deps){let m=d.get(x.node);m!=null&&p.push([m,_])}p.sort((_,w)=>_[0]<w[0]?-1:_[0]>w[0]?1:_[1]<w[1]?-1:_[1]>w[1]?1:0);let l=p.map(([_,w])=>({from:_,to:w}));(t!=null||n!=null)&&(l=l.filter(_=>f.has(_.from)&&f.has(_.to)));let v=this._collectSubgraphs(""),g=t!=null||n!=null?v.filter(_=>{let w=`${_}${L}`;return[...f].some(x=>x===_||x.startsWith(w))}):v,N=this,y=e;return{name:this.name,nodes:h,edges:l,subgraphs:g,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(_){let w={...y};return Array.isArray(_)?(w.fields=_,w.detail=void 0):(w.detail=_,w.fields=void 0),N.describe(w)}}}_collectSubgraphs(e){let t=[];for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${n}`;t.push(s),t.push(...this._mounts.get(n)._collectSubgraphs(`${s}${L}`))}return t}resourceProfile(e){return cn(this,e)}reachable(e,t,n={}){return n.withDetail===!0?mn(this.describe(),e,t,{...n,withDetail:!0}):mn(this.describe(),e,t,n)}explain(e,t,n){return n?.reactive===!0?this._explainReactive(e,t,n):this._explainStatic(pe(e),pe(t),{...n?.maxDepth!==void 0?{maxDepth:fn(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:pn(n.findCycle)}:{}})}_explainStatic(e,t,n){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,d]of Object.entries(s.nodes))d.lastMutation!=null&&i.set(a,d.lastMutation);return nn(s,e,t,{...n?.maxDepth!=null?{maxDepth:n.maxDepth}:{},...n?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},n=e.reactiveName??"describe",s=0,o=ee(s,{name:`${n}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,Te(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},c=i.onEvent(y=>{let b=y.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),h=[],f=new WeakSet,p=y=>{if(f.has(y)||d)return;f.add(y);let b=y.topology.subscribe(_=>{for(let w of _){if(w[0]!==F)continue;let x=w[1];if(u(),x.kind==="added"&&x.nodeKind==="mount"){let m=y._mounts.get(x.name);m!=null&&p(m)}}});h.push(b);for(let _ of y._mounts.keys()){let w=y._mounts.get(_);w!=null&&p(w)}};p(this);let l,v=e.actor;bn(v)&&(l=v.subscribe(y=>{let b=!1,_=!1;for(let w of y){let x=w[0];x===F?b=!0:(x===V||x===P||x===H)&&(_=!0)}b&&u(),_&&(l?.(),l=void 0,u())}));let g;try{g=Y([o],()=>this.describe(t),{name:n,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(y,b)=>y===b})}catch(y){c(),l?.();for(let b of h)b();throw i.dispose(),y}let N=Ue(g);return{node:g,dispose(){d=!0,c(),l?.();for(let y of h)y();h.length=0,i.dispose(),N()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},n=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=_t(s,o),a=ee(i,{name:n,meta:{domain:"audit",kind:"describe-diff"},equals:(f,p)=>f===p}),d=this._describeReactive({...e,reactiveName:void 0}),u=!1,c=d.node.subscribe(f=>{if(!u)for(let p of f){if(p[0]!==F)continue;let l=p[1],v=_t(o,l);o=l,v.events.length!==0&&a.emit(v)}}),h=Ue(a);return{node:a,dispose(){u=!0,c(),d.dispose(),a.down([[H,"describe-diff disposed"]]),h()}}}_explainReactive(e,t,n){let s=0,o=ee(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,d=!1,u=()=>{a||d||(a=!0,Te(()=>{a=!1,!d&&(s+=1,o.emit(s))}))},c=i.onEvent(y=>{let b=y.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||u()}),h=[];e!=null&&ye(e)&&h.push(e),t!=null&&ye(t)&&h.push(t),n?.maxDepth!=null&&ye(n.maxDepth)&&h.push(n.maxDepth),n?.findCycle!=null&&ye(n.findCycle)&&h.push(n.findCycle);let f=()=>{for(let y of h)if(y.cache===void 0)return!1;return!0},p=()=>{let y=pe(e),b=pe(t);return{from:y,to:b,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:y,to:b,found:!1,reason:"pending",steps:[]})}},l;try{l=Y([o],()=>{if(!f())return p();let y=pe(e),b=pe(t),_={...n?.maxDepth!==void 0?{maxDepth:fn(n.maxDepth)}:{},...n?.findCycle!==void 0?{findCycle:pn(n.findCycle)}:{}};return this._explainStatic(y,b,_)},{name:n?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:pe(e),to:pe(t)},equals:(y,b)=>y.found===b.found&&y.reason===b.reason&&y.steps.length===b.steps.length&&mr(y.steps,b.steps)})}catch(y){throw c(),i.dispose(),y}let v=Ue(l),g=[],N=y=>{let b;return b=y.subscribe(_=>{let w=!1,x=!1;for(let m of _){let T=m[0];T===F?w=!0:(T===V||T===P||T===H)&&(x=!0)}(w||x)&&u(),x&&b&&(b(),b=void 0)}),()=>{b&&(b(),b=void 0)}};for(let y of h)g.push(N(y));return{node:l,dispose(){d=!0,c();for(let y of g)y?.();g.length=0,i.dispose(),v()}}}_pathsMatching(e){let t=Ze(e),n=[];return this._collectObserveTargets("",n),n.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let n of[...this._mounts.keys()].sort()){let s=e===""?n:`${e}${L}${n}`;this._mounts.get(n)._collectObserveTargets(s,t)}for(let n of[...this._nodes.keys()].sort()){let s=this._nodes.get(n),o=e===""?n:`${e}${L}${n}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,n){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${L}${re}${L}${s}`;n.push([i,o]),this._appendMetaObserveTargets(i,o,n)}}observe(e,t){let n=typeof e=="string",o=gn(n?t:e);if(o.reactive===!0)return this._observeReactive(n?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(n){let c=e,h=this.resolve(c);if(a!=null&&!h.allowsObserve(a))throw new Q({actor:a,action:"observe",nodeName:c});return i?this._buildStructuredObserver([[c,h]],o,"one"):{subscribe(f){return h.subscribe(f)},up(f){try{h.up?.(f)}catch(p){if(p instanceof Q)return;throw p}}}}let d=[];this._collectObserveTargets("",d),d.sort((c,h)=>c[0]<h[0]?-1:c[0]>h[0]?1:0);let u=a==null?d:d.filter(([,c])=>c.allowsObserve(a));return i?this._buildStructuredObserver(u,o,"all"):{subscribe:c=>{let h=u.map(([f,p])=>p.subscribe(l=>{c(f,l)}));return()=>{for(let f of h)f()}},up:(c,h)=>{try{this.resolve(c).up?.(h)}catch(f){if(f instanceof Q)return;throw f}}}}_observeReactive(e,t){let n=t.tiers,s=n!=null?new Set(n):null,o=t.reactiveName??"observe";return be(i=>{let a=[],d=!1,u=!1,c=()=>{if(a.length===0||u)return;let v={events:a.slice(),flushedAt_ns:ue()};a.length=0,i.emit(v)},h={...t,reactive:!1,structured:!0,timeline:!0},f=e!=null?this.observe(e,h):this.observe(h),p=v=>{u||(a.push(v),!d&&(d=!0,Te(()=>{d=!1,c()})))};for(let v of f.events)p(v);let l=f.onEvent(p);return()=>{u=!0,l(),f.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,n){let s=n==="one"?e[0]?.[0]:void 0,o=i=>{if(n==="one"&&s!=null){let c=this.resolve(s);return this._buildStructuredObserver([[s,c]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((c,h)=>c[0]<h[0]?-1:c[0]>h[0]?1:0);let d=i.actor,u=d==null?a:a.filter(([,c])=>c.allowsObserve(d));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,n){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",d=this.config.inspectorEnabled,u=(o||i)&&d,c=t.maxEvents,h=c!=null&&c>0?new Fe(c):null,f=[],p=new Set,l=t.tiers!=null?new Set(t.tiers):null,v={},g=new Set,N=0,y=0,b=0,_=0,w=0,x=0,m=!1,T=!1,O=0,E=new Map,k=new Map,A=new Map,G=R=>{if(!(l!=null&&!l.has(R.type))){h?h.push(R):f.push(R);for(let I of p)I(R)}},M=R=>l==null||l.has(R),se=()=>s?{timestamp_ns:ue(),in_batch:ze(),batch_id:O}:{},te=(R,I)=>{if(!(!u||!(R instanceof j)))return R._setInspectorHook(X=>{if(X.kind==="dep_message")E.set(R,X.depIndex);else if(X.kind==="run"){let Ce=X.batchData.map(($,q)=>$!=null&&$.length>0?$.at(-1):X.prevData[q]);k.set(R,Ce);let Z=X.batchData.map($=>$!=null?[...$]:void 0);A.set(R,Z),i&&G({type:"derived",path:I,dep_values:Ce,dep_batches:Z,...se()})}})},ve=R=>{let I=E.get(R),X=k.get(R);if(!o||X==null)return{};let Z=(I!=null&&I>=0&&R instanceof j?R._deps[I]:void 0)?.node,$=Z?.v,q=A.get(R);return{trigger_dep_index:I,trigger_dep_name:Z?.name,...$!=null?{trigger_version:{id:$.id,version:$.version}}:{},dep_values:[...X],...q!=null?{dep_batches:q}:{}}},Qe=[],D=[];for(let[R,I]of e){let X=te(I,R);X&&Qe.push(X),D.push(I.subscribe(Ce=>{O++;for(let Z of Ce){let $=Z[0],q=se();if($===F){v[R]=Z[1];let et=I instanceof j?I.lastMutation?.actor??Re:Re;G({type:"data",path:R,data:Z[1],actor:et,...q,...ve(I)})}else if(a)$===K?M("dirty")&&N++:$===W?M("resolved")&&y++:$===ne?M("invalidate")&&b++:$===ae?M("pause")&&_++:$===le?M("resume")&&w++:$===H?M("teardown")&&x++:$===V&&!g.has(R)?M("complete")&&(m=!0):$===P&&M("error")&&(T=!0,g.add(R));else if($===K)M("dirty")&&N++,G({type:"dirty",path:R,...q});else if($===W)M("resolved")&&y++,G({type:"resolved",path:R,...q,...ve(I)});else if($===ne)M("invalidate")&&b++,G({type:"invalidate",path:R,...q});else if($===ae)M("pause")&&_++,G({type:"pause",path:R,lockId:Z[1],...q});else if($===le)M("resume")&&w++,G({type:"resume",path:R,lockId:Z[1],...q});else if($===V)M("complete")&&!g.has(R)&&(m=!0),G({type:"complete",path:R,...q});else if($===P){M("error")&&(T=!0,g.add(R));let et=I instanceof j?I.lastMutation?.actor??Re:Re;G({type:"error",path:R,data:Z[1],actor:et,...q})}else $===H&&(M("teardown")&&x++,G({type:"teardown",path:R,...q}))}}))}let C=!1,S=()=>{if(!C){C=!0;for(let R of D)R();for(let R of Qe)R();for(let R of U)R({value:void 0,done:!0});U.length=0}},J=[],U=[];p.add(R=>{let I=U.shift();I?I({value:R,done:!1}):J.push(R)});let oe={get values(){return v},get dirtyCount(){return N},get resolvedCount(){return y},get invalidateCount(){return b},get pauseCount(){return _},get resumeCount(){return w},get teardownCount(){return x},get events(){return h?h.toArray():[...f]},get anyCompletedCleanly(){return m},get anyErrored(){return T},get completedWithoutErrors(){return m&&!T},onEvent(R){return p.add(R),()=>p.delete(R)},dispose:S,expand(R){S();let I={...t};return typeof R=="string"?I.detail=R:Object.assign(I,R),n(gn(I))},[Symbol.asyncIterator](){return{next(){return J.length>0?Promise.resolve({value:J.shift(),done:!1}):C?Promise.resolve({value:void 0,done:!0}):new Promise(R=>U.push(R))},return(){return S(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(oe,t),oe}_attachFormatLogger(e,t){let n=t.format;if(n==null)return;let s=t.logger??(l=>console.log(l)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:l=>(o==null||o.has(l))&&(i==null||!i.has(l)),d=lr(t.theme),u=n==="stage-log"?ue():0,c=l=>l==null?"":t.stageLabels?.[l]??l,h=(l,v)=>l.length>v?`${l.slice(0,v-1)}\u2026`:l,f=l=>l.type==="data"||l.type==="error"?h(Tt(l.data),120):"",p=l=>{if(n==="stage-log"){let m=(ue()-u)/1e9,T=c(l.path).padEnd(9);if(l.type==="data"){let O=f(l);return`[${m.toFixed(3)}s] ${T} \u2190${O?` ${O}`:""}`}if(l.type==="error"){let O=f(l);return`[${m.toFixed(3)}s] ${T} \u2717${O?` ${O}`:""}`}return l.type==="complete"?`[${m.toFixed(3)}s] ${T} \u25A0 complete`:`[${m.toFixed(3)}s] ${T} ${l.type}`}if(n==="json")try{return JSON.stringify(l)}catch{return JSON.stringify({type:l.type,path:l.path,data:"[unserializable]"})}let v=d[l.type]??"",g=l.path?`${d.path}${l.path}${d.reset} `:"",N=l.type==="data"||l.type==="error",y=l.type==="pause"||l.type==="resume",b=N?` ${Tt(l.data)}`:y?` ${Tt(l.lockId)}`:"",_=l.type==="data"||l.type==="resolved"||l.type==="derived"?l:void 0,w=_?.trigger_dep_name!=null?` <- ${_.trigger_dep_name}`:_?.trigger_dep_index!=null?` <- #${_.trigger_dep_index}`:"",x=l.in_batch?" [batch]":"";return`${g}${v}${l.type.toUpperCase()}${d.reset}${b}${w}${x}`};e.onEvent(l=>{a(l.type)&&s(p(l),l)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){Xe(this._disposers,this.name),this.signal([[H]],{internal:!0}),Xe(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){Xe(this._disposers,this.name),Xe(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...n}=this.describe({detail:"full"}),s={};for(let a of Object.keys(n.nodes).sort()){let{lastMutation:d,guard:u,...c}=n.nodes[a];s[a]=c}let o=[...n.subgraphs].sort(),i={...n,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return Ct(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let n=t?.config??Ee,{codec:s,codecVersion:o,payload:i}=Mt(e,n);return s.decode(i,o)}restore(e,t){if(hn(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let n=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>Ze(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(n!==null&&!n.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let d=this.tryResolve(o)?.v;if(d!=null&&d.id===i.v.id&&d.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){hn(e);let n=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new r(e.name);if(n)return n(o),o.restore(e),o;for(let p of[...e.subgraphs].sort((l,v)=>{let g=l.split(L).length,N=v.split(L).length;return g!==N?g-N:l<v?-1:l>v?1:0})){let l=p.split(L),v=o;for(let g of l)v._mounts.has(g)||v.mount(g,new r(g)),v=v._mounts.get(g)}let i=s?Object.entries(s).map(([p,l])=>({re:Ze(p),factory:l})):[],a=p=>{for(let l of i)if(l.re.test(p))return l.factory},d=p=>{let l=p.split(L),v=l.pop();if(v==null||v.length===0)throw new Error(`invalid snapshot path "${p}"`);let g=o;for(let N of l){let y=g._mounts.get(N);if(!y)throw new Error(`unknown mount "${N}" in path "${p}"`);g=y}return[g,v]},u=Object.entries(e.nodes).filter(([p])=>!p.includes(`${L}${re}${L}`)).sort((p,l)=>p[0]<l[0]?-1:p[0]>l[0]?1:0),c=new Map(u),h=new Map,f=!0;for(;c.size>0&&f;){f=!1;for(let[p,l]of[...c.entries()]){let v=l?.deps??[];if(!v.every(w=>h.has(w)))continue;let[g,N]=d(p),y={...l?.meta??{}},b=a(p),_;if(l?.type==="state")_=ee(l.value,{meta:y});else{if(b==null)continue;_=b(N,{path:p,type:l.type,value:l.value,meta:y,deps:v,resolvedDeps:v.map(w=>h.get(w))})}g.add(_,{name:N}),h.set(p,_),c.delete(p),f=!0}}if(c.size>0){let p=[...c.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${p}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let n=e.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}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(u,c)=>{if(u.disposed)return;let h=ir(c.nodes);if(u.lastSnapshot!=null&&h!==""&&h===u.lastFingerprint)return;let f=u.seq+1,p=ce(),g=u.lastSnapshot==null||f%u.compactEvery===0?{name:this.name,mode:"full",snapshot:c,seq:f,timestamp_ns:p,format_version:Ae}:{name:this.name,mode:"diff",diff:gr(u.lastSnapshot,c),seq:f,timestamp_ns:p,format_version:Ae};if(u.tier.filter&&!u.tier.filter(g))return;let N;try{N=u.tier.save(g)}catch(y){t.onError?.(y,u.tier);return}if(N&&typeof N.then=="function"){let _=(u.savePending??Promise.resolve()).then(()=>N,()=>N).then(()=>{u.disposed||(u.seq=f,u.lastSnapshot=c,u.lastFingerprint=h)},w=>{t.onError?.(w,u.tier)});u.savePending=_.finally(()=>{u.savePending===_&&(u.savePending=void 0)})}else u.seq=f,u.lastSnapshot=c,u.lastFingerprint=h},o=(u,c)=>{try{s(u,c)}catch(h){t.onError?.(h,u.tier)}},i=(u,c)=>{if(!c.some(l=>{let v=this.config.messageTier(l[0]);return v>=3&&v<5}))return;if(t.filter){let l=this.tryResolve(u);if(l==null)return;let v=bt(l,mt("standard"));if(!t.filter(u,v))return}let f,p=()=>(f==null&&(f=this.snapshot()),f);for(let l of n)l.disposed||(l.debounceMs===0?o(l,p()):(l.timer==null&&(l.timer=new Ke),l.timer.start(l.debounceMs,()=>{l.disposed||o(l,this.snapshot())})))},a;if(t.paths!=null){let c=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(h=>{let f=this.tryResolve(h);return f==null?()=>{}:f.subscribe(p=>i(h,p))});a=()=>{for(let h of c)h()}}else a=this.observe().subscribe((u,c)=>i(u,c));let d=()=>{a();for(let u of n)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(d)};return this._storageDisposers.add(d),{dispose:d}}async _cascadeRestore(e,t){for(let n of e){let s;try{s=await n.load?.()}catch(i){t?.(i,n);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===Ae&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,n)}}return!1}static async fromStorage(e,t,n){for(let s of t){let o;try{o=await s.load?.()}catch(d){n?.onError?.(d,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===Ae&&i.nodes!=null?i:void 0;if(a!=null)try{return r.fromSnapshot(a,n)}catch(d){n?.onError?.(d,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,n){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:ue(),...n?.actor!=null?{actor:n.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(s=>!e(s)),n=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return n}static diff(e,t){let n=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(y=>!n.has(y)).sort(),i=[...n].filter(y=>!s.has(y)).sort(),a=[],d=[];for(let y of n){if(!s.has(y))continue;let b=e.nodes[y],_=t.nodes[y],w=b.v,x=_.v;w!=null&&x!=null&&w.id===x.id&&w.version!==x.version&&d.push({path:y,id:w.id,from:w.version,to:x.version});let m=w!=null&&x!=null&&w.id===x.id&&w.version===x.version;for(let T of["type","status","sentinel"]){let O=b[T],E=_[T];O!==E&&a.push({path:y,field:T,from:O,to:E})}if(!m)for(let T of["value","meta"]){let O=b[T],E=_[T];ar(O,E)||a.push({path:y,field:T,from:O,to:E})}}let u=y=>`${y.from} ${y.to}`,c=new Set(e.edges.map(u)),h=new Set(t.edges.map(u)),f=t.edges.filter(y=>!c.has(u(y))),p=e.edges.filter(y=>!h.has(u(y))),l=new Set(e.subgraphs),v=new Set(t.subgraphs),g=[...v].filter(y=>!l.has(y)).sort(),N=[...l].filter(y=>!v.has(y)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:d,edgesAdded:f,edgesRemoved:p,subgraphsAdded:g,subgraphsRemoved:N}}}});var _r={};Sn(_r,{PipelineGraph:()=>Ve,decisionKeyOf:()=>xn,pipelineGraph:()=>On});module.exports=Cn(_r);Ne();ke();fe();yt();me();$e();Kt();Ne();ke();Pe();fe();Ne();fe();me();$e();var kt=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,t){if(t!==void 0&&t<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=t,t!==void 0){if(this._buf=new Array(t),e&&e.length>0){let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let t=e>=0?e:this._size+e;if(!(t<0||t>=this._size))return this._maxSize!==void 0?this._buf[(this._head+t)%this._maxSize]:this._buf[t]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let t=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let n=t;n<e.length;n++)this._rawAppend(e[n]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let t=0;t<e;t++)this._buf[(this._head+t)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let t=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,t);else{for(let n=0;n<t;n++)this._buf[(this._head+n)%this._maxSize]=void 0;this._head=(this._head+t)%this._maxSize}return this._size-=t,this._version+=1,t}slice(e,t){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(t!==void 0&&(!Number.isInteger(t)||t<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${t})`);let n=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=n)return[];let o=n-s;if(this._maxSize===void 0)return this._buf.slice(s,n);let i=new Array(o);for(let a=0;a<o;a++)i[a]=this._buf[(this._head+s+a)%this._maxSize];return i}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let t=Math.min(e,this._size);return this.slice(this._size-t,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this._buf[(this._head+t)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let t=0;t<e.length;t++)this._buf.push(e[t]);this._size=this._buf.length}else{let t=this._maxSize;for(let o=0;o<t;o++)this._buf[o]=void 0;this._head=0;let n=Math.min(e.length,t),s=e.length-n;for(let o=0;o<n;o++)this._buf[o]=e[s+o];this._size=n}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function Ie(r){return r.subscribe(()=>{})}var br=64;function _n(r,e={}){let{name:t,maxSize:n,versioning:s,guard:o,backend:i}=e,a=i??new kt(r,n),d=ee(a.toArray(),{name:t,describeKind:"state",equals:(m,T)=>m===T,...s!=null?{versioning:s}:{},...o!=null?{guard:o}:{}});function u(){let m=a.toArray();ie(()=>{d.down([[K]],{internal:!0}),d.down([[F,m]],{internal:!0})})}let c=new Map,h=new Map,f=new Map;function p(m,T){return`${m}:${T===void 0?"END":T}`}function l(m){if(m.size<br)return;let T=m.keys().next();if(T.done)return;let O=m.get(T.value);O!==void 0&&O.dispose(),m.delete(T.value)}function v(m){let T=a.version;try{return m()}finally{a.version!==T&&u()}}function g(m){if(!Number.isInteger(m)||m<0)throw new RangeError(`tail: n must be a non-negative integer (got ${m})`);let T=c.get(m);if(T!==void 0)return c.delete(m),c.set(m,T),T.node;l(c);let O=Y([d],([k])=>{let A=k;return m===0||A.length===0?[]:A.slice(Math.max(0,A.length-m))},{initial:a.tail(m),describeKind:"derived"}),E=Ie(O);return c.set(m,{node:O,dispose:E}),O}function N(m,T){if(!Number.isInteger(m)||m<0)throw new RangeError(`slice: start must be a non-negative integer (got ${m})`);if(T!==void 0&&(!Number.isInteger(T)||T<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${T})`);let O=p(m,T),E=h.get(O);if(E!==void 0)return h.delete(O),h.set(O,E),E.node;l(h);let k=Y([d],([G])=>{let M=G;return T===void 0?M.slice(m):M.slice(m,T)},{initial:a.slice(m,T),describeKind:"derived"}),A=Ie(k);return h.set(O,{node:k,dispose:A}),k}function y(m){let T=f.get(m);if(T!==void 0)return T.node;let O=Y([d,m],([k,A])=>{let G=k,M=Math.max(0,Math.trunc(A??0));return G.slice(M)},{initial:[],describeKind:"derived"}),E=Ie(O);return f.set(m,{node:O,dispose:E}),O}let b,_;function w(){b===void 0&&(b=de([d],(m,T,O)=>{let E=m[0],A=E!=null&&E.length>0?E.at(-1):O.prevData[0];if(A==null||A.length===0){T.down([[W]]);return}T.emit(A[A.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:a.size===0?void 0:a.at(a.size-1)}),_=Y([d],([m])=>m.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:a.size>0}),Ie(b),Ie(_))}let x={entries:d,get size(){return a.size},at(m){return a.at(m)},append(m){v(()=>a.append(m))},appendMany(m){m.length!==0&&v(()=>a.appendMany(m))},clear(){v(()=>a.clear())},trimHead(m){v(()=>a.trimHead(m))},withLatest(){return w(),d},get lastValue(){return w(),b},get hasLatest(){return w(),_},view(m){switch(m.kind){case"tail":return g(m.n);case"slice":return N(m.start,m.stop);case"fromCursor":return y(m.cursor)}},attach(m){let T=m.subscribe(O=>{for(let E of O)E[0]===F&&x.append(E[1])});return()=>T()},attachStorage(m){if(m.length===0)return()=>{};let T=new Map;for(let E of m)T.set(E,a.size);(async()=>{for(let E of m)if(typeof E.loadEntries=="function")try{let k=await Promise.resolve(E.loadEntries());k.entries.length>0&&a.size===0&&(a.restore(k.entries),T.set(E,k.entries.length),u());break}catch{}})();let O=d.subscribe(E=>{for(let k of E){if(k[0]!==F)continue;let A=k[1];for(let G of m){let M=T.get(G)??0;if(A.length<M){try{let te=G.appendEntries(A);te instanceof Promise&&te.catch(()=>{})}catch{}T.set(G,A.length);continue}if(A.length===M)continue;let se=A.slice(M);T.set(G,A.length);try{let te=G.appendEntries(se);te instanceof Promise&&te.catch(()=>{})}catch{}}}});return()=>O()},disposeAllViews(){for(let m of c.values())m.dispose();c.clear();for(let m of h.values())m.dispose();h.clear();for(let m of f.values())m.dispose();f.clear()},dispose(){for(let m of c.values())m.dispose();c.clear();for(let m of h.values())m.dispose();h.clear();for(let m of f.values())m.dispose();f.clear()}};return x}var yr=St((r,e)=>{r("observe"),r("signal"),e("write")});function Nn(r){let e=_n([],{name:r.name,maxSize:r.retainedLimit??1024,guard:r.guard??yr,...r.versioning!=null?{versioning:r.versioning}:{}});return e.withLatest(),r.graph&&r.graph.add(e.entries,{name:r.name}),e}function kn(r){if(r===null||typeof r!="object"||Object.isFrozen(r))return r;for(let e of Object.keys(r))kn(r[e]);return Object.freeze(r)}var wn=new WeakSet;function vr(r){let e=r.cache,t=typeof e=="number"&&Number.isFinite(e);!t&&e!==void 0&&!wn.has(r)&&(wn.add(r),console.warn(`bumpCursor: cursor cache held a non-numeric value (${String(e)}); resetting to 0. Causes include: a snapshot codec round-tripping the cursor as a string / null / NaN, OR a malformed initial seed (e.g. state<number>(NaN)). Audit consumers may see colliding seq values after this point.`));let s=(t?e:0)+1;return r.down([[K],[F,s]]),s}function Tn(r,e,t,n,s,o){let i=e(t,n,s);if(i===void 0)return;let a=o!=null?{...i,handlerVersion:o}:i;r.append(a)}function De(r,e){let t=e.freeze??!0;return function(...s){let o=t?s.map(kn):s,i=ce(),a,d,u=!1,c;try{ie(()=>{e.seq&&(c=vr(e.seq));try{a=r(...o),e.audit&&e.onSuccess&&Tn(e.audit,e.onSuccess,o,a,{t_ns:i,seq:c},e.handlerVersion)}catch(h){throw d=h,u=!0,h}})}catch(h){if(u&&e.audit&&e.onFailure){let f=d instanceof Error?d.name:typeof d;Tn(e.audit,e.onFailure,o,d,{t_ns:i,seq:c,errorType:f},e.handlerVersion)}throw u?d:h}return a}}vn();function Le(r,e){return Ut("orchestration",r,e)}var xn=r=>r.action,Ve=class extends Se{constructor(e,t){super(e,t)}task(e,t,n={}){let s=(n.deps??[]).map(i=>this._resolveStep(i)),o=Y(s,t,{name:e,describeKind:"derived",meta:Le("task",n.meta)});return this.add(o,{name:e}),o}classify(e,t,n,s={}){let o=this._resolveStep(t),i=Y([o],([a])=>{try{return{tag:n(a),value:a}}catch(d){return{tag:"error",value:a,error:d}}},{name:e,describeKind:"derived",meta:Le("classify",s.meta)});return this.add(i,{name:e}),i}combine(e,t,n={}){let s=Object.keys(t),o=s.map(a=>this._resolveStep(t[a])),i=Y(o,a=>{let d={};for(let u=0;u<s.length;u++)d[s[u]]=a[u];return d},{name:e,describeKind:"derived",meta:Le("combine",n.meta)});return this.add(i,{name:e}),i}approvalGate(e,t,n={}){let s=n.maxPending??1e3;if(s<1&&s!==Number.POSITIVE_INFINITY)throw new RangeError("approvalGate: maxPending must be >= 1");let o=n.startOpen??!1;typeof t!="string"&&this.nameOf(t)===void 0&&this.add(t,{name:`${e}/source`});let i=this._resolveStep(t),a=new Se(`${e}_state`),d=ee([],{name:"pending",equals:()=>!1}),u=ee(o,{name:"isOpen"}),c=Y([d],([D])=>D.length,{name:"count"}),h=ee(0,{name:"droppedCount"}),f=Nn({name:"decisions",retainedLimit:1024,graph:a});a.add(d,{name:"pending"}),a.add(u,{name:"isOpen"}),a.add(c,{name:"count"}),a.add(h,{name:"droppedCount"}),this.mount(`${e}_state`,a);let p=[],l=!1,v=!1,g=o,N=u.subscribe(D=>{for(let C of D)C[0]===F&&(g=C[1])});this.addDisposer(N);function y(){d.emit([...p])}function b(D,C,S){f.append({action:D,t_ns:ce(),...C!==void 0?{items:C,count:C.length}:{},...S!==void 0?{unflushed:S}:{},...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}function _(D){if(p.push(D),p.length>s){let C=p.shift();h.emit(h.cache+1),b("drop",[C])}y()}function w(D){let C=p.splice(0,D);return y(),C}let x=de([i],(D,C,S)=>{let J=S.terminalDeps[0];if(J!==void 0){l=!0;let oe=p.length;p=[],y(),b("teardown",void 0,oe),C.down(J===!0?[[V]]:[[P,J]]);return}let U=D[0];if(U==null||U.length===0){C.down([[W]]);return}for(let oe of U)g?C.emit(oe):(_(oe),C.down([[W]]))},{name:e,describeKind:"derived",meta:Le("approval_gate",n.meta)});if(this.add(x,{name:e}),n.approver!=null){n.approver.cache&&(u.emit(!0),g=!0,n.onceOnly&&(v=!0));let C=n.approver.subscribe(S=>{for(let J of S){if(J[0]!==F)continue;let U=!!J[1];if(U&&!g){if(n.onceOnly){if(v)continue;v=!0}ie(()=>{u.emit(!0);let oe=w(p.length);b("open",oe);for(let R of oe){if(l)break;x.emit(R)}})}else if(!U&&g){if(n.onceOnly&&v)continue;ie(()=>{u.emit(!1),b("close")})}}});this.addDisposer(C)}let m=D=>{if(l)throw new Error(`approvalGate: ${D}() called after the gate was torn down`)},T=(D=1)=>{m("approve");let C=w(D);for(let S of C){if(l)break;x.emit(S)}},O=(D=1)=>{m("reject"),w(D)},E=(D,C=1)=>{m("modify");let S=[...p],J=w(C);for(let U=0;U<J.length&&!l;U++)x.emit(D(J[U],U,S))},k=()=>{m("open"),u.emit(!0);let D=w(p.length);for(let C of D){if(l)break;x.emit(C)}},A=()=>{m("close"),!(n.onceOnly&&v)&&u.emit(!1)},G=De(T,{audit:f,freeze:!1,onSuccess:(D,C,S)=>({action:"approve",count:D[0]??1,t_ns:S.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,S)=>({action:"drop",t_ns:S.t_ns,errorType:S.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),M=De(O,{audit:f,freeze:!1,onSuccess:(D,C,S)=>({action:"reject",count:D[0]??1,t_ns:S.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,S)=>({action:"drop",t_ns:S.t_ns,errorType:S.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),se=De(E,{audit:f,freeze:!1,onSuccess:(D,C,S)=>({action:"modify",count:D[1]??1,t_ns:S.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,S)=>({action:"drop",t_ns:S.t_ns,errorType:S.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),te=De(k,{audit:f,freeze:!1,onSuccess:(D,C,S)=>({action:"open",t_ns:S.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,S)=>({action:"drop",t_ns:S.t_ns,errorType:S.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})}),ve=De(A,{audit:f,freeze:!1,onSuccess:(D,C,S)=>({action:"close",t_ns:S.t_ns,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}}),onFailure:(D,C,S)=>({action:"drop",t_ns:S.t_ns,errorType:S.errorType,...n.handlerVersion!=null?{handlerVersion:n.handlerVersion}:{}})});return this.addDisposer(c.subscribe(()=>{})),{output:x,pending:d,count:c,isOpen:u,droppedCount:h,decisions:f,audit:f,approve:G,reject:M,modify:se,open:te,close:ve}}approval(e,t,n,s={}){return this.approvalGate(e,t,{...s,approver:n,maxPending:1})}catch(e,t,n,s={}){let o=this._resolveStep(t),i=s.on??"errored",a=de([o],(d,u,c)=>{let h=c.terminalDeps[0];if(h!==void 0){let p=h===!0?{kind:"completed"}:{kind:"errored",error:h};if(i==="terminal"||i===p.kind){u.emit(n(p,u));return}u.down(p.kind==="completed"?[[V]]:[[P,p.error]]);return}let f=d[0];if(f==null||f.length===0){u.down([[W]]);return}for(let p of f)u.emit(p)},{name:e,describeKind:"derived",completeWhenDepsComplete:s.completeWhenDepsComplete??!(i==="completed"||i==="terminal"),errorWhenDepsError:!(i==="errored"||i==="terminal"),meta:Le("catch",s.meta)});return this.add(a,{name:e}),a}_resolveStep(e){if(typeof e=="string")return this.resolve(e);if(this.nameOf(e)===void 0)throw new Error(`PipelineGraph "${this.name}": Node dep is not registered. Pass a string path or call graph.add(node) first.`);return e}};function On(r,e){let t=new Ve(r,e),{factory:n,factoryArgs:s,...o}=e??{};return t.tagFactory("pipelineGraph",Bt(o)),t}0&&(module.exports={PipelineGraph,decisionKeyOf,pipelineGraph});
@@ -1,9 +1,8 @@
1
- export { C as CatchOptions, a as ClassifyResult, D as Decision, b as DecisionAction, G as GateController, c as GateOptions, P as PipelineGraph, S as StepRef, T as TerminalCause, d as decisionKeyOf, p as pipelineGraph } from '../../pipeline-graph-DPqKDk59.cjs';
2
- import '../../node-ClS5yC-B.cjs';
3
- import '../../sugar-DyVGtczU.cjs';
4
- import '../../index-C9pjcz3l.cjs';
5
- import '../../graph-C4SHb3Ly.cjs';
6
- import '../../meta-vE8bxW1E.cjs';
1
+ export { C as CatchOptions, a as ClassifyResult, D as Decision, b as DecisionAction, G as GateController, c as GateOptions, P as PipelineGraph, S as StepRef, T as TerminalCause, d as decisionKeyOf, p as pipelineGraph } from '../../pipeline-graph-CIKhynsF.cjs';
2
+ import '../../node-kK3CvTrR.cjs';
3
+ import '../../sugar-DQjFmVqb.cjs';
4
+ import '../../index-D0aciIex.cjs';
5
+ import '../../graph-CWvEUQAq.cjs';
7
6
  import '../../extra/storage-core.cjs';
8
7
  import '../../extra/storage-tiers.cjs';
9
- import '../../reactive-log-B00laMSQ.cjs';
8
+ import '../../reactive-log-DIGdYqQ6.cjs';
@@ -1,9 +1,8 @@
1
- export { C as CatchOptions, a as ClassifyResult, D as Decision, b as DecisionAction, G as GateController, c as GateOptions, P as PipelineGraph, S as StepRef, T as TerminalCause, d as decisionKeyOf, p as pipelineGraph } from '../../pipeline-graph-loP57TBA.js';
2
- import '../../node-ClS5yC-B.js';
3
- import '../../sugar-DLwvMr3F.js';
4
- import '../../index-CZQXo5tH.js';
5
- import '../../graph-7VguS7a4.js';
6
- import '../../meta-BgVAsg9j.js';
1
+ export { C as CatchOptions, a as ClassifyResult, D as Decision, b as DecisionAction, G as GateController, c as GateOptions, P as PipelineGraph, S as StepRef, T as TerminalCause, d as decisionKeyOf, p as pipelineGraph } from '../../pipeline-graph-Sgj0gCwn.js';
2
+ import '../../node-kK3CvTrR.js';
3
+ import '../../sugar-fhLIE7TT.js';
4
+ import '../../index-Yq60JP3s.js';
5
+ import '../../graph-D9LFnda9.js';
7
6
  import '../../extra/storage-core.js';
8
7
  import '../../extra/storage-tiers.js';
9
- import '../../reactive-log-BezYsbA_.js';
8
+ import '../../reactive-log-BKALbfal.js';
@@ -1 +1 @@
1
- import{a,b,c}from"../../chunk-JNWRYDJN.js";import"../../chunk-FDQGFWLF.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-626TESAC.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-35JTVPOX.js";import"../../chunk-JQFH2DV6.js";import"../../chunk-V5A7M7RJ.js";import"../../chunk-LYCLF26R.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{b as PipelineGraph,a as decisionKeyOf,c as pipelineGraph};
1
+ import{a,b,c}from"../../chunk-ZKPSFFKU.js";import"../../chunk-W3I423PS.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-HITNVN6B.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-GHBWHMRZ.js";import"../../chunk-YBB7ZGTY.js";import"../../chunk-CRVT7D2P.js";import"../../chunk-NTEURFZH.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{b as PipelineGraph,a as decisionKeyOf,c as pipelineGraph};