@graphrefly/graphrefly 0.44.0 → 0.45.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 (420) hide show
  1. package/README.md +21 -17
  2. package/dist/compat/index.cjs +20 -10
  3. package/dist/compat/index.cjs.map +1 -0
  4. package/dist/compat/index.d.cts +1 -22
  5. package/dist/compat/index.d.ts +1 -22
  6. package/dist/compat/index.js +3 -1
  7. package/dist/compat/index.js.map +1 -0
  8. package/dist/compat/jotai/index.cjs +21 -1
  9. package/dist/compat/jotai/index.cjs.map +1 -0
  10. package/dist/compat/jotai/index.d.cts +1 -2
  11. package/dist/compat/jotai/index.d.ts +1 -2
  12. package/dist/compat/jotai/index.js +3 -1
  13. package/dist/compat/jotai/index.js.map +1 -0
  14. package/dist/compat/nanostores/index.cjs +21 -1
  15. package/dist/compat/nanostores/index.cjs.map +1 -0
  16. package/dist/compat/nanostores/index.d.cts +1 -2
  17. package/dist/compat/nanostores/index.d.ts +1 -2
  18. package/dist/compat/nanostores/index.js +3 -1
  19. package/dist/compat/nanostores/index.js.map +1 -0
  20. package/dist/compat/nestjs/index.cjs +20 -10
  21. package/dist/compat/nestjs/index.cjs.map +1 -0
  22. package/dist/compat/nestjs/index.d.cts +1 -13
  23. package/dist/compat/nestjs/index.d.ts +1 -13
  24. package/dist/compat/nestjs/index.js +3 -1
  25. package/dist/compat/nestjs/index.js.map +1 -0
  26. package/dist/compat/react/index.cjs +21 -1
  27. package/dist/compat/react/index.cjs.map +1 -0
  28. package/dist/compat/react/index.d.cts +1 -2
  29. package/dist/compat/react/index.d.ts +1 -2
  30. package/dist/compat/react/index.js +3 -1
  31. package/dist/compat/react/index.js.map +1 -0
  32. package/dist/compat/solid/index.cjs +21 -1
  33. package/dist/compat/solid/index.cjs.map +1 -0
  34. package/dist/compat/solid/index.d.cts +1 -2
  35. package/dist/compat/solid/index.d.ts +1 -2
  36. package/dist/compat/solid/index.js +3 -1
  37. package/dist/compat/solid/index.js.map +1 -0
  38. package/dist/compat/svelte/index.cjs +21 -1
  39. package/dist/compat/svelte/index.cjs.map +1 -0
  40. package/dist/compat/svelte/index.d.cts +1 -2
  41. package/dist/compat/svelte/index.d.ts +1 -2
  42. package/dist/compat/svelte/index.js +3 -1
  43. package/dist/compat/svelte/index.js.map +1 -0
  44. package/dist/compat/vue/index.cjs +21 -1
  45. package/dist/compat/vue/index.cjs.map +1 -0
  46. package/dist/compat/vue/index.d.cts +1 -3
  47. package/dist/compat/vue/index.d.ts +1 -3
  48. package/dist/compat/vue/index.js +3 -1
  49. package/dist/compat/vue/index.js.map +1 -0
  50. package/dist/compat/zustand/index.cjs +21 -3
  51. package/dist/compat/zustand/index.cjs.map +1 -0
  52. package/dist/compat/zustand/index.d.cts +1 -6
  53. package/dist/compat/zustand/index.d.ts +1 -6
  54. package/dist/compat/zustand/index.js +3 -1
  55. package/dist/compat/zustand/index.js.map +1 -0
  56. package/dist/core/index.cjs +21 -1
  57. package/dist/core/index.cjs.map +1 -0
  58. package/dist/core/index.d.cts +1 -3
  59. package/dist/core/index.d.ts +1 -3
  60. package/dist/core/index.js +3 -1
  61. package/dist/core/index.js.map +1 -0
  62. package/dist/extra/browser.cjs +21 -1
  63. package/dist/extra/browser.cjs.map +1 -0
  64. package/dist/extra/browser.d.cts +1 -4
  65. package/dist/extra/browser.d.ts +1 -4
  66. package/dist/extra/browser.js +3 -1
  67. package/dist/extra/browser.js.map +1 -0
  68. package/dist/extra/index.cjs +20 -19
  69. package/dist/extra/index.cjs.map +1 -0
  70. package/dist/extra/index.d.cts +1 -17
  71. package/dist/extra/index.d.ts +1 -17
  72. package/dist/extra/index.js +3 -1
  73. package/dist/extra/index.js.map +1 -0
  74. package/dist/extra/node.cjs +21 -2
  75. package/dist/extra/node.cjs.map +1 -0
  76. package/dist/extra/node.d.cts +1 -187
  77. package/dist/extra/node.d.ts +1 -187
  78. package/dist/extra/node.js +3 -2
  79. package/dist/extra/node.js.map +1 -0
  80. package/dist/extra/operators.cjs +21 -1
  81. package/dist/extra/operators.cjs.map +1 -0
  82. package/dist/extra/operators.d.cts +1 -958
  83. package/dist/extra/operators.d.ts +1 -958
  84. package/dist/extra/operators.js +3 -1
  85. package/dist/extra/operators.js.map +1 -0
  86. package/dist/extra/reactive.cjs +21 -1
  87. package/dist/extra/reactive.cjs.map +1 -0
  88. package/dist/extra/reactive.d.cts +1 -353
  89. package/dist/extra/reactive.d.ts +1 -353
  90. package/dist/extra/reactive.js +3 -1
  91. package/dist/extra/reactive.js.map +1 -0
  92. package/dist/extra/render/index.cjs +21 -5
  93. package/dist/extra/render/index.cjs.map +1 -0
  94. package/dist/extra/render/index.d.cts +1 -183
  95. package/dist/extra/render/index.d.ts +1 -183
  96. package/dist/extra/render/index.js +3 -1
  97. package/dist/extra/render/index.js.map +1 -0
  98. package/dist/extra/sources.cjs +21 -3
  99. package/dist/extra/sources.cjs.map +1 -0
  100. package/dist/extra/sources.d.cts +1 -584
  101. package/dist/extra/sources.d.ts +1 -584
  102. package/dist/extra/sources.js +3 -1
  103. package/dist/extra/sources.js.map +1 -0
  104. package/dist/extra/storage-browser.cjs +21 -1
  105. package/dist/extra/storage-browser.cjs.map +1 -0
  106. package/dist/extra/storage-browser.d.cts +1 -37
  107. package/dist/extra/storage-browser.d.ts +1 -37
  108. package/dist/extra/storage-browser.js +3 -1
  109. package/dist/extra/storage-browser.js.map +1 -0
  110. package/dist/extra/storage-core.cjs +21 -1
  111. package/dist/extra/storage-core.cjs.map +1 -0
  112. package/dist/extra/storage-core.d.cts +1 -28
  113. package/dist/extra/storage-core.d.ts +1 -28
  114. package/dist/extra/storage-core.js +3 -1
  115. package/dist/extra/storage-core.js.map +1 -0
  116. package/dist/extra/storage-node.cjs +20 -0
  117. package/dist/extra/storage-node.cjs.map +1 -0
  118. package/dist/extra/storage-node.d.cts +1 -2
  119. package/dist/extra/storage-node.d.ts +1 -2
  120. package/dist/extra/storage-node.js +3 -0
  121. package/dist/extra/storage-node.js.map +1 -0
  122. package/dist/extra/storage-tiers-browser.cjs +21 -1
  123. package/dist/extra/storage-tiers-browser.cjs.map +1 -0
  124. package/dist/extra/storage-tiers-browser.d.cts +1 -120
  125. package/dist/extra/storage-tiers-browser.d.ts +1 -120
  126. package/dist/extra/storage-tiers-browser.js +3 -1
  127. package/dist/extra/storage-tiers-browser.js.map +1 -0
  128. package/dist/extra/storage-tiers-node.cjs +21 -1
  129. package/dist/extra/storage-tiers-node.cjs.map +1 -0
  130. package/dist/extra/storage-tiers-node.d.cts +1 -210
  131. package/dist/extra/storage-tiers-node.d.ts +1 -210
  132. package/dist/extra/storage-tiers-node.js +3 -1
  133. package/dist/extra/storage-tiers-node.js.map +1 -0
  134. package/dist/extra/storage-tiers.cjs +21 -1
  135. package/dist/extra/storage-tiers.cjs.map +1 -0
  136. package/dist/extra/storage-tiers.d.cts +1 -412
  137. package/dist/extra/storage-tiers.d.ts +1 -412
  138. package/dist/extra/storage-tiers.js +3 -1
  139. package/dist/extra/storage-tiers.js.map +1 -0
  140. package/dist/extra/storage-wal.cjs +21 -0
  141. package/dist/extra/storage-wal.cjs.map +1 -0
  142. package/dist/extra/storage-wal.d.cts +1 -0
  143. package/dist/extra/storage-wal.d.ts +1 -0
  144. package/dist/extra/storage-wal.js +3 -0
  145. package/dist/extra/storage-wal.js.map +1 -0
  146. package/dist/graph/index.cjs +21 -7
  147. package/dist/graph/index.cjs.map +1 -0
  148. package/dist/graph/index.d.cts +1 -7
  149. package/dist/graph/index.d.ts +1 -7
  150. package/dist/graph/index.js +3 -1
  151. package/dist/graph/index.js.map +1 -0
  152. package/dist/index.cjs +20 -227
  153. package/dist/index.cjs.map +1 -0
  154. package/dist/index.d.cts +45 -95
  155. package/dist/index.d.ts +45 -95
  156. package/dist/index.js +3 -1
  157. package/dist/index.js.map +1 -0
  158. package/dist/patterns/ai/browser.cjs +20 -7
  159. package/dist/patterns/ai/browser.cjs.map +1 -0
  160. package/dist/patterns/ai/browser.d.cts +1 -127
  161. package/dist/patterns/ai/browser.d.ts +1 -127
  162. package/dist/patterns/ai/browser.js +3 -3
  163. package/dist/patterns/ai/browser.js.map +1 -0
  164. package/dist/patterns/ai/index.cjs +20 -73
  165. package/dist/patterns/ai/index.cjs.map +1 -0
  166. package/dist/patterns/ai/index.d.cts +1 -20
  167. package/dist/patterns/ai/index.d.ts +1 -20
  168. package/dist/patterns/ai/index.js +3 -1
  169. package/dist/patterns/ai/index.js.map +1 -0
  170. package/dist/patterns/ai/node.cjs +21 -1
  171. package/dist/patterns/ai/node.cjs.map +1 -0
  172. package/dist/patterns/ai/node.d.cts +1 -59
  173. package/dist/patterns/ai/node.d.ts +1 -59
  174. package/dist/patterns/ai/node.js +3 -1
  175. package/dist/patterns/ai/node.js.map +1 -0
  176. package/dist/patterns/cqrs/index.cjs +21 -3
  177. package/dist/patterns/cqrs/index.cjs.map +1 -0
  178. package/dist/patterns/cqrs/index.d.cts +1 -8
  179. package/dist/patterns/cqrs/index.d.ts +1 -8
  180. package/dist/patterns/cqrs/index.js +3 -1
  181. package/dist/patterns/cqrs/index.js.map +1 -0
  182. package/dist/patterns/demo-shell/index.cjs +21 -5
  183. package/dist/patterns/demo-shell/index.cjs.map +1 -0
  184. package/dist/patterns/demo-shell/index.d.cts +1 -7
  185. package/dist/patterns/demo-shell/index.d.ts +1 -7
  186. package/dist/patterns/demo-shell/index.js +3 -1
  187. package/dist/patterns/demo-shell/index.js.map +1 -0
  188. package/dist/patterns/domain-templates/index.cjs +21 -3
  189. package/dist/patterns/domain-templates/index.cjs.map +1 -0
  190. package/dist/patterns/domain-templates/index.d.cts +1 -6
  191. package/dist/patterns/domain-templates/index.d.ts +1 -6
  192. package/dist/patterns/domain-templates/index.js +3 -1
  193. package/dist/patterns/domain-templates/index.js.map +1 -0
  194. package/dist/patterns/graphspec/index.cjs +21 -86
  195. package/dist/patterns/graphspec/index.cjs.map +1 -0
  196. package/dist/patterns/graphspec/index.d.cts +1 -8
  197. package/dist/patterns/graphspec/index.d.ts +1 -8
  198. package/dist/patterns/graphspec/index.js +3 -1
  199. package/dist/patterns/graphspec/index.js.map +1 -0
  200. package/dist/patterns/harness/index.cjs +21 -48
  201. package/dist/patterns/harness/index.cjs.map +1 -0
  202. package/dist/patterns/harness/index.d.cts +1 -13
  203. package/dist/patterns/harness/index.d.ts +1 -13
  204. package/dist/patterns/harness/index.js +3 -1
  205. package/dist/patterns/harness/index.js.map +1 -0
  206. package/dist/patterns/inspect/index.cjs +21 -3
  207. package/dist/patterns/inspect/index.cjs.map +1 -0
  208. package/dist/patterns/inspect/index.d.cts +1 -9
  209. package/dist/patterns/inspect/index.d.ts +1 -9
  210. package/dist/patterns/inspect/index.js +3 -1
  211. package/dist/patterns/inspect/index.js.map +1 -0
  212. package/dist/patterns/job-queue/index.cjs +21 -3
  213. package/dist/patterns/job-queue/index.cjs.map +1 -0
  214. package/dist/patterns/job-queue/index.d.cts +1 -9
  215. package/dist/patterns/job-queue/index.d.ts +1 -9
  216. package/dist/patterns/job-queue/index.js +3 -1
  217. package/dist/patterns/job-queue/index.js.map +1 -0
  218. package/dist/patterns/memory/index.cjs +21 -3
  219. package/dist/patterns/memory/index.cjs.map +1 -0
  220. package/dist/patterns/memory/index.d.cts +1 -8
  221. package/dist/patterns/memory/index.d.ts +1 -8
  222. package/dist/patterns/memory/index.js +3 -1
  223. package/dist/patterns/memory/index.js.map +1 -0
  224. package/dist/patterns/messaging/index.cjs +21 -3
  225. package/dist/patterns/messaging/index.cjs.map +1 -0
  226. package/dist/patterns/messaging/index.d.cts +1 -7
  227. package/dist/patterns/messaging/index.d.ts +1 -7
  228. package/dist/patterns/messaging/index.js +3 -1
  229. package/dist/patterns/messaging/index.js.map +1 -0
  230. package/dist/patterns/orchestration/index.cjs +21 -3
  231. package/dist/patterns/orchestration/index.cjs.map +1 -0
  232. package/dist/patterns/orchestration/index.d.cts +1 -8
  233. package/dist/patterns/orchestration/index.d.ts +1 -8
  234. package/dist/patterns/orchestration/index.js +3 -1
  235. package/dist/patterns/orchestration/index.js.map +1 -0
  236. package/dist/patterns/process/index.cjs +21 -3
  237. package/dist/patterns/process/index.cjs.map +1 -0
  238. package/dist/patterns/process/index.d.cts +1 -10
  239. package/dist/patterns/process/index.d.ts +1 -10
  240. package/dist/patterns/process/index.js +3 -1
  241. package/dist/patterns/process/index.js.map +1 -0
  242. package/dist/patterns/reactive-layout/index.cjs +21 -4
  243. package/dist/patterns/reactive-layout/index.cjs.map +1 -0
  244. package/dist/patterns/reactive-layout/index.d.cts +1 -7
  245. package/dist/patterns/reactive-layout/index.d.ts +1 -7
  246. package/dist/patterns/reactive-layout/index.js +3 -1
  247. package/dist/patterns/reactive-layout/index.js.map +1 -0
  248. package/dist/patterns/reduction/index.cjs +21 -3
  249. package/dist/patterns/reduction/index.cjs.map +1 -0
  250. package/dist/patterns/reduction/index.d.cts +1 -6
  251. package/dist/patterns/reduction/index.d.ts +1 -6
  252. package/dist/patterns/reduction/index.js +3 -1
  253. package/dist/patterns/reduction/index.js.map +1 -0
  254. package/dist/patterns/surface/index.cjs +21 -13
  255. package/dist/patterns/surface/index.cjs.map +1 -0
  256. package/dist/patterns/surface/index.d.cts +1 -9
  257. package/dist/patterns/surface/index.d.ts +1 -9
  258. package/dist/patterns/surface/index.js +3 -1
  259. package/dist/patterns/surface/index.js.map +1 -0
  260. package/dist/patterns/topology-view/index.cjs +21 -0
  261. package/dist/patterns/topology-view/index.cjs.map +1 -0
  262. package/dist/patterns/topology-view/index.d.cts +1 -0
  263. package/dist/patterns/topology-view/index.d.ts +1 -0
  264. package/dist/patterns/topology-view/index.js +3 -0
  265. package/dist/patterns/topology-view/index.js.map +1 -0
  266. package/dist/testing/index.cjs +21 -0
  267. package/dist/testing/index.cjs.map +1 -0
  268. package/dist/testing/index.d.cts +1 -0
  269. package/dist/testing/index.d.ts +1 -0
  270. package/dist/testing/index.js +3 -0
  271. package/dist/testing/index.js.map +1 -0
  272. package/package.json +608 -584
  273. package/dist/backoff-HPZMEZNF.js +0 -1
  274. package/dist/cascading-BglDkMdX.d.cts +0 -199
  275. package/dist/cascading-MFgxu7Yo.d.ts +0 -199
  276. package/dist/chunk-2T7U5EU6.js +0 -1
  277. package/dist/chunk-3G5U5QNE.js +0 -5
  278. package/dist/chunk-4VVTGLXJ.js +0 -1
  279. package/dist/chunk-5M4CCMMD.js +0 -45
  280. package/dist/chunk-5QDBSZBV.js +0 -1
  281. package/dist/chunk-5XJ6B66J.js +0 -1
  282. package/dist/chunk-6QZNQS5B.js +0 -1
  283. package/dist/chunk-6X7AFUJV.js +0 -9
  284. package/dist/chunk-7K6PWTDQ.js +0 -1
  285. package/dist/chunk-7LIAPXJB.js +0 -1
  286. package/dist/chunk-7WPU3UHQ.js +0 -1
  287. package/dist/chunk-A5WCQ5NO.js +0 -1
  288. package/dist/chunk-APPIWSGD.js +0 -84
  289. package/dist/chunk-BEZWM2SY.js +0 -1
  290. package/dist/chunk-C72GO4IZ.js +0 -1
  291. package/dist/chunk-CB676TKJ.js +0 -1
  292. package/dist/chunk-CE6TI2TL.js +0 -1
  293. package/dist/chunk-CE72X3WO.js +0 -1
  294. package/dist/chunk-CK2E7BTU.js +0 -1
  295. package/dist/chunk-CLVB32RD.js +0 -1
  296. package/dist/chunk-CRVT7D2P.js +0 -1
  297. package/dist/chunk-D5RFJOZ2.js +0 -1
  298. package/dist/chunk-D7GPHKFH.js +0 -1
  299. package/dist/chunk-DHRX7JX4.js +0 -2
  300. package/dist/chunk-ESMPEKEV.js +0 -1
  301. package/dist/chunk-F672GV32.js +0 -1
  302. package/dist/chunk-FZMYDOWV.js +0 -1
  303. package/dist/chunk-GHBWHMRZ.js +0 -1
  304. package/dist/chunk-GLERH466.js +0 -1
  305. package/dist/chunk-GPW2V3RE.js +0 -1
  306. package/dist/chunk-HIDYF36O.js +0 -1
  307. package/dist/chunk-HITNVN6B.js +0 -3
  308. package/dist/chunk-HY4DJBA7.js +0 -5
  309. package/dist/chunk-KZIEYVXN.js +0 -1
  310. package/dist/chunk-L6NSJVJZ.js +0 -1
  311. package/dist/chunk-N4MQX6JU.js +0 -18
  312. package/dist/chunk-N7FHEL4D.js +0 -1
  313. package/dist/chunk-NTEURFZH.js +0 -1
  314. package/dist/chunk-OIVP6KFV.js +0 -1
  315. package/dist/chunk-OPHBU3LG.js +0 -1
  316. package/dist/chunk-OYQOZP2F.js +0 -5
  317. package/dist/chunk-PTZK576G.js +0 -1
  318. package/dist/chunk-QYADASLV.js +0 -1
  319. package/dist/chunk-ST7UXLWR.js +0 -1
  320. package/dist/chunk-SVY7VUYU.js +0 -1
  321. package/dist/chunk-TK3NWWD4.js +0 -1
  322. package/dist/chunk-TSOYJ743.js +0 -1
  323. package/dist/chunk-UNGSTR4X.js +0 -61
  324. package/dist/chunk-VIMF6LGM.js +0 -1
  325. package/dist/chunk-VJLMUKOI.js +0 -1
  326. package/dist/chunk-VN6RDSK2.js +0 -1
  327. package/dist/chunk-VV4N5P64.js +0 -1
  328. package/dist/chunk-W3I423PS.js +0 -1
  329. package/dist/chunk-WJR24TAG.js +0 -1
  330. package/dist/chunk-XTGKMHSW.js +0 -1
  331. package/dist/chunk-YBB7ZGTY.js +0 -1
  332. package/dist/chunk-Z4NPUARF.js +0 -1
  333. package/dist/chunk-ZGNQRPDT.js +0 -1
  334. package/dist/chunk-ZKPSFFKU.js +0 -1
  335. package/dist/chunk-ZLV5SQSX.js +0 -1
  336. package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
  337. package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
  338. package/dist/decay-BvOWTZ00.d.ts +0 -112
  339. package/dist/decay-CFlLvXUT.d.cts +0 -112
  340. package/dist/fallback-74oxi34l.d.cts +0 -250
  341. package/dist/fallback-DUyyBTBK.d.ts +0 -250
  342. package/dist/graph-CWvEUQAq.d.cts +0 -1861
  343. package/dist/graph-D9LFnda9.d.ts +0 -1861
  344. package/dist/index-5k1T6jl0.d.cts +0 -121
  345. package/dist/index-9770hRuQ.d.cts +0 -779
  346. package/dist/index-B-_tFaqV.d.cts +0 -468
  347. package/dist/index-B17QddL1.d.cts +0 -374
  348. package/dist/index-B1F8Enjf.d.ts +0 -704
  349. package/dist/index-B5S8ULbU.d.ts +0 -515
  350. package/dist/index-B8YnZpIR.d.ts +0 -102
  351. package/dist/index-BHskSB8v.d.ts +0 -3413
  352. package/dist/index-BIYAkbAi.d.cts +0 -26
  353. package/dist/index-BQSKmbuG.d.cts +0 -127
  354. package/dist/index-BaQaY_IQ.d.cts +0 -231
  355. package/dist/index-BmZXHqkE.d.ts +0 -36
  356. package/dist/index-BoJ5JHxI.d.ts +0 -557
  357. package/dist/index-BocU7pqs.d.ts +0 -779
  358. package/dist/index-BrPrLl4e.d.cts +0 -86
  359. package/dist/index-BxNs2HB9.d.cts +0 -1858
  360. package/dist/index-Byu-OpX_.d.ts +0 -113
  361. package/dist/index-C1T3d7V-.d.cts +0 -704
  362. package/dist/index-C5ri2Axc.d.cts +0 -301
  363. package/dist/index-C5stwKcw.d.cts +0 -44
  364. package/dist/index-C9l6OEBL.d.ts +0 -26
  365. package/dist/index-CBBLl_rc.d.ts +0 -127
  366. package/dist/index-CBGUK09R.d.ts +0 -754
  367. package/dist/index-CC-AvFTy.d.cts +0 -557
  368. package/dist/index-CJF1URuX.d.ts +0 -121
  369. package/dist/index-CK29LV56.d.cts +0 -34
  370. package/dist/index-CMh5Rz1y.d.ts +0 -385
  371. package/dist/index-CPQlGA29.d.ts +0 -34
  372. package/dist/index-CR8QpwX8.d.ts +0 -2680
  373. package/dist/index-CS0LTlB8.d.cts +0 -385
  374. package/dist/index-CSOmP7xT.d.cts +0 -291
  375. package/dist/index-CYq8vAyV.d.ts +0 -291
  376. package/dist/index-CZ3r5Rxp.d.ts +0 -374
  377. package/dist/index-CasX6Pfq.d.cts +0 -358
  378. package/dist/index-CdAlHFEt.d.ts +0 -44
  379. package/dist/index-CdTelp1M.d.ts +0 -202
  380. package/dist/index-CeFiHtAg.d.ts +0 -468
  381. package/dist/index-Cj3WohTd.d.cts +0 -202
  382. package/dist/index-Climxqsu.d.cts +0 -754
  383. package/dist/index-Co7uli2l.d.cts +0 -3413
  384. package/dist/index-CviRnE4K.d.ts +0 -45
  385. package/dist/index-Cwv0KWcU.d.cts +0 -102
  386. package/dist/index-CzLVrjxn.d.ts +0 -231
  387. package/dist/index-D0aciIex.d.cts +0 -209
  388. package/dist/index-DHen9Klo.d.ts +0 -1858
  389. package/dist/index-DV_1YuVk.d.cts +0 -221
  390. package/dist/index-Dc4AYqrJ.d.cts +0 -515
  391. package/dist/index-Dgl1HpPn.d.ts +0 -86
  392. package/dist/index-DisjX8a-.d.ts +0 -221
  393. package/dist/index-UPSiS-X7.d.cts +0 -2680
  394. package/dist/index-Yq60JP3s.d.ts +0 -209
  395. package/dist/index-ZVQhLa2i.d.cts +0 -37
  396. package/dist/index-_6ODbuOu.d.cts +0 -45
  397. package/dist/index-hcDJ8PSI.d.cts +0 -36
  398. package/dist/index-nozs3fFC.d.ts +0 -301
  399. package/dist/index-p09KSrTN.d.ts +0 -358
  400. package/dist/index-sqkqlb1p.d.ts +0 -37
  401. package/dist/index-tRCxuAXF.d.cts +0 -113
  402. package/dist/node-kK3CvTrR.d.cts +0 -1347
  403. package/dist/node-kK3CvTrR.d.ts +0 -1347
  404. package/dist/observable-DWjNfLvC.d.ts +0 -36
  405. package/dist/observable-e3eiPPFy.d.cts +0 -36
  406. package/dist/pipeline-graph-CIKhynsF.d.cts +0 -142
  407. package/dist/pipeline-graph-Sgj0gCwn.d.ts +0 -142
  408. package/dist/reactive-layout-DOTs9P3X.d.ts +0 -183
  409. package/dist/reactive-layout-DgctbqZo.d.cts +0 -183
  410. package/dist/reactive-log-BKALbfal.d.ts +0 -223
  411. package/dist/reactive-log-DIGdYqQ6.d.cts +0 -223
  412. package/dist/reactive-map-CEFGp8TK.d.cts +0 -296
  413. package/dist/reactive-map-DS_SIAxv.d.ts +0 -296
  414. package/dist/resilience-6LYQJAC5.js +0 -1
  415. package/dist/sugar-DQjFmVqb.d.cts +0 -399
  416. package/dist/sugar-fhLIE7TT.d.ts +0 -399
  417. package/dist/topology-tree-Bcz27hpF.d.cts +0 -25
  418. package/dist/topology-tree-xvaD0fOX.d.ts +0 -25
  419. package/dist/types-C0_yquda.d.cts +0 -442
  420. package/dist/types-CWFysE9E.d.ts +0 -442
@@ -1,3 +1,21 @@
1
- "use strict";var et=Object.defineProperty;var xn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var On=Object.prototype.hasOwnProperty;var j=(n,e)=>()=>(n&&(e=n(n=0)),e);var kn=(n,e)=>{for(var t in e)et(n,t,{get:e[t],enumerable:!0})},Sn=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Nn(e))!On.call(n,s)&&s!==t&&et(n,s,{get:()=>e[s],enumerable:!(r=xn(e,s))||r.enumerable});return n};var En=n=>Sn(et({},"__esModule",{value:!0}),n);function de(){return Math.trunc(performance.now()*1e6)}function ne(){return Date.now()*1e6}var we=j(()=>{"use strict"});var Te,$,q,J,re,ie,le,U,z,G,xe,tt,Rn,nt,An,Dn,rt,Nt,Ot,kt,st,fe=j(()=>{"use strict";Te=Symbol.for("graphrefly/START"),$=Symbol.for("graphrefly/DATA"),q=Symbol.for("graphrefly/DIRTY"),J=Symbol.for("graphrefly/RESOLVED"),re=Symbol.for("graphrefly/INVALIDATE"),ie=Symbol.for("graphrefly/PAUSE"),le=Symbol.for("graphrefly/RESUME"),U=Symbol.for("graphrefly/TEARDOWN"),z=Symbol.for("graphrefly/COMPLETE"),G=Symbol.for("graphrefly/ERROR"),xe=Object.freeze([q]),tt=Object.freeze([J]),Rn=Object.freeze([re]),nt=Object.freeze([Te]),An=Object.freeze([z]),Dn=Object.freeze([U]),rt=Object.freeze([xe]),Nt=Object.freeze([tt]),Ot=Object.freeze([Rn]),kt=Object.freeze([An]),st=Object.freeze([Dn])});function Ie(){return Ne>0||Ce}function St(){return Ne>0}function ke(n){Ne>0?Me.push(n):n()}function be(n){Ne+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(Ne-=1,Ne===0)if(e){if(!Ce){let t=Me.splice(0);for(let r of t)try{r()}catch{}ge.length=0,me.length=0,Oe.length=0}}else Cn()}}function Cn(){let n=!Ce;n&&(Ce=!0);let e=[],t=0;try{for(;ge.length>0||me.length>0||Oe.length>0||n&&Me.length>0;){if(n&&Me.length>0){let o=Me.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw ge.length=0,me.length=0,Oe.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(ge.length>0?ge:me.length>0?me:Oe).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{n&&(Ce=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Ve(n,e,t){if(e.length===0)return;if(e.length===1){let d=t(e[0][0]);if(d<3||!Ie()){n(e);return}(d>=5?Oe:d===4?me:ge).push(()=>n(e));return}let r=e.length,s=r,o=r,i=r,a=0;for(;a<r&&t(e[a][0])<3;)a++;for(s=a;a<r&&t(e[a][0])===3;)a++;for(o=a;a<r&&t(e[a][0])===4;)a++;i=a;let u=Ie();if(s>0){let d=e.slice(0,s);n(d)}if(o>s){let d=e.slice(s,o);u?ge.push(()=>n(d)):n(d)}if(i>o){let d=e.slice(o,i);u?me.push(()=>n(d)):n(d)}if(r>i){let d=e.slice(i,r);u?Oe.push(()=>n(d)):n(d)}}var Ne,Ce,ge,me,Oe,Me,Ge=j(()=>{"use strict";Ne=0,Ce=!1,ge=[],me=[],Oe=[],Me=[]});function Et(n){return Array.isArray(n)?[...n]:[n]}function Mn(n,e){return n.has(e)||n.has("*")}function Rt(n){let e=[];return n((s,o)=>{e.push({kind:"allow",actions:new Set(Et(s)),where:o?.where??(()=>!0)})},(s,o)=>{e.push({kind:"deny",actions:new Set(Et(s)),where:o?.where??(()=>!0)})}),(s,o)=>{let i=!1,a=!1;for(let u of e)Mn(u.actions,o)&&u.where(s)&&(u.kind==="deny"?i=!0:a=!0);return i?!1:a}}function ot(n){let e=Gn.filter(t=>n({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 ee,Gn,Pe=j(()=>{"use strict";ee=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 Dt(n,e){let t=new TextEncoder().encode(n.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${n.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let r=n.version;if(!Number.isInteger(r)||r<0||r>65535)throw new Error(`encodeEnvelope: codec.version ${r} 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++]=it,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=r>>>8&255,o[i++]=r&255,o.set(e,i),o}function Ct(n,e){if(n.length<At)throw new Error(`decodeEnvelope: bytes too short (${n.length} < ${At})`);let t=0,r=n[t++];if(r!==it)throw new Error(`decodeEnvelope: unsupported envelope version ${r} (expected ${it})`);let s=n[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>n.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${n.length})`);let o=new TextDecoder().decode(n.subarray(t,t+s));t+=s;let i=(n[t]<<8|n[t+1])>>>0;t+=2;let a=n.subarray(t),u=e.lookupCodec(o);if(u==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:u,codecVersion:i,payload:a}}function Mt(n){n.registerCodec(Pn)}var Pn,it,At,at=j(()=>{"use strict";Pn={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}},it=1,At=4});function ze(n){if(n==null)return Se;let{type:e,id:t,...r}=n;return{type:e??"system",id:t??"",...r}}var Se,ut=j(()=>{"use strict";Se={type:"system",id:""}});function Gt(n){n.registerMessageType(Te,{tier:0,wireCrossing:!1}),n.registerMessageType(q,{tier:1,wireCrossing:!1}),n.registerMessageType(re,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(ie,{tier:2,wireCrossing:!1}),n.registerMessageType(le,{tier:2,wireCrossing:!1}),n.registerMessageType($,{tier:3,wireCrossing:!0}),n.registerMessageType(J,{tier:3,wireCrossing:!0}),n.registerMessageType(z,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(G,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(U,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var je,Pt=j(()=>{"use strict";fe();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 r=this._messageTypes.get(t);return r!=null?r.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(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(dt);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=dt(n[t]);return e}return null}function Ln(n){let e=Fn.encode(n),t=e.length,r=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,r>>>0,!1),i.setUint32(s-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,c=2773480762,f=1359893119,p=2600822924,h=528734635,l=1541459225,w=new Uint32Array(64),m=(v,y)=>v>>>y|v<<32-y;for(let v=0;v<s;v+=64){for(let O=0;O<16;O++)w[O]=i.getUint32(v+O*4,!1);for(let O=16;O<64;O++){let C=w[O-15],M=w[O-2],g=m(C,7)^m(C,18)^C>>>3,E=m(M,17)^m(M,19)^M>>>10;w[O]=w[O-16]+g+w[O-7]+E>>>0}let y=a,_=u,T=d,k=c,b=f,x=p,R=h,A=l;for(let O=0;O<64;O++){let C=m(b,6)^m(b,11)^m(b,25),M=b&x^~b&R,g=A+C+M+$n[O]+w[O]>>>0,E=m(y,2)^m(y,13)^m(y,22),D=y&_^y&T^_&T,I=E+D>>>0;A=R,R=x,x=b,b=k+g>>>0,k=T,T=_,_=y,y=g+I>>>0}a=a+y>>>0,u=u+_>>>0,d=d+T>>>0,c=c+k>>>0,f=f+b>>>0,p=p+x>>>0,h=h+R>>>0,l=l+A>>>0}let N=v=>v.toString(16).padStart(8,"0");return N(a)+N(u)+N(d)+N(c)+N(f)+N(p)+N(h)+N(l)}function ct(n){let e=dt(n??null),t=JSON.stringify(e);return Ln(t).slice(0,16)}function In(){let n=globalThis.crypto;if(n?.randomUUID)return n.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 lt(n,e,t){let r=t?.id??In();if(n===0)return{id:r,version:0};let o=(t?.hash??ct)(e);return{id:r,version:0,cid:o,prev:null}}function $t(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var $n,Fn,Ft=j(()=>{"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]),Fn=new TextEncoder});function Vt(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function ft(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function Be(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}function ye(n,e,t){let r=zt(n)?n:[],s=typeof n=="function"?n:typeof e=="function"?e:void 0,o={};return zt(n)?o=(pt(e)?e:t)??{}:pt(n)?o=n:o=(pt(e)?e:t)??{},new B(r,s,o)}var Lt,It,Vn,zn,Ee,B,zt,pt,Re=j(()=>{"use strict";at();ut();Ge();we();Pt();Pe();fe();Ft();Lt=()=>{},It=100;Vn=(n,e,t,r)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},zn=(n,e,t,r)=>{let s=n;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[nt]:[nt,[$,o]];s._status==="dirty"&&i.push(xe),Ve(e,i,s._config.tierOf)},Ee=new je({onMessage:Vn,onSubscribe:zn});Gt(Ee);Mt(Ee);B=class n{_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,r){this._config=r.config??Ee,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=t,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??ct;let s=r.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?lt(s,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Vt);let o={};for(let[a,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),r.resubscribable===!0&&(d.resubscribable=!0),o[a]=new n([],void 0,d)}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 r=this._versioningLevel;if(r!=null&&e<=r)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,u=i?.version??0,d=lt(e,o,{id:a,hash:s});d.version=u,this._versioning=d,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 r of this._extraGuards)if(!r(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!t&&!r)return;let s=ze(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new ee({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new ee({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:ne()}}down(e,t){let r=Be(e);r.length!==0&&(this._checkGuard(t),this._emit(r))}emit(e,t){this._checkGuard(t),this._emit([[$,e]])}up(e,t){if(this._deps.length===0)return;let r=Be(e);if(r.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(r);for(let o of this._deps)o.node.up?.(r,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 r of e){let s=t(r[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 u=ze(t);if(!this._guard(u,"observe"))throw new ee({actor:u,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 u of this._deps)ft(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.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(u){throw this._sinkCount-=1,u}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(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw u}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 r=0;r<e;r++){let s=r,o=this._deps[r];o.unsub=Lt,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of i)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:s},this._actions);u&&this._maybeRunFnOnSettlement()}),t++}}catch(r){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{}ft(o)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,r=Vt(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(rt),r.unsub=Lt;try{r.unsub=e.subscribe(s=>{if(r.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 r.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(r){this._emit([[G,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(s){this._emit([[G,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let r of this._deps){if(r.unsub!=null){let s=r.unsub;r.unsub=null;try{s()}catch{}}ft(r)}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 r=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!==Te){if(s===q){this._depDirtied(r);return}if(s===re){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Ot);return}if(s===ie||s===le){this._emit([t]);return}if(s===U){this._emit(st);return}if(s===$)this._depSettledAsData(r,t[1]);else if(s===J)this._depSettledAsResolved(r);else if(s===z)this._depSettledAsTerminal(r,!0);else if(s===G)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(s===$||s===J)&&this._emit([t]),(s===z||s===G)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(rt))}_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([[G,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(kt)}_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([[G,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([[G,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),r=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:r,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:r};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([[G,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>It?(this._rerunDepth=0,this._emit([[G,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${It} \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 r=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[xe,e[0]]:e;let r=!0,s=!1,o=!1,i=-1;for(let u of e){let d=t(u[0]);d<i&&(r=!1),d===3&&(s=!0),u[0]===q&&(o=!0),i=d}let a=e;if(!r){let u=e.map((d,c)=>({m:d,i:c,tier:t(d[0])}));u.sort((d,c)=>d.tier-c.tier||d.i-c.i),a=u.map(d=>d.m)}if(s&&!o&&this._status!=="dirty"){let u=0;for(;u<a.length&&t(a[u][0])===0;)u++;return u===0?[xe,...a]:[...a.slice(0,u),xe,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===G&&u[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(u=>u[0]===U||u[0]===re);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let u=t[a],d=u[0];if(d!==ie&&d!==le){s?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===ie?"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 f=u[1];if(d===ie)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(f),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(f))c=!1;else if(this._pauseLocks.delete(f),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())}}c?s?.push(u):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]===U))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(st)}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,u=[];for(let d of o)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[G,i]])}_updateState(e){let t=this._config.tierOf,r,s,o=-1,i=0;for(let c of e)t(c[0])===3&&i++;let a=i<=1,u=-1;if(this._versioning!=null&&i>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===$){u=c;break}}for(let c=0;c<e.length;c++){let f=e[c],p=f[0];if(p===$){if(f.length>=2){let h=!1;if(a&&this._cached!==void 0)try{h=this._equals(this._cached,f[1])}catch(l){s=this._wrapFnError("equals threw",l),o=c;break}if(h){r==null&&(r=e.slice(0,c)),r.push(tt),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(u<0||c===u)&&$t(this._versioning,f[1],this._hashFn)}this._status="settled",r?.push(f)}else if(r?.push(f),p===q)this._status="dirty";else if(p===J)this._status="resolved";else if(p===z){this._status="completed";{let h=this._config.rigorRecorder;if(h!=null)try{h.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===G){this._status="errored";{let h=this._config.rigorRecorder;if(h!=null)try{h.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(p===re){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 h=this._cleanup;if(typeof h=="function"){this._cleanup=void 0;try{h()}catch{}}else if(h!=null&&typeof h=="object"){let l=h.invalidate;if(typeof l=="function")try{l()}catch{}}}else p===U&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=o>=0?r??e.slice(0,o):r??e;return s!=null?{finalMessages:d,equalsError:s}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let r of t)r(e)};_dispatchOrAccumulate(e){if(St()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],ke(()=>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)}},zt=n=>Array.isArray(n),pt=n=>typeof n=="object"&&n!=null&&!Array.isArray(n)});function ae(n,e){return ye([],{...e,initial:n})}function pe(n,e){return ye((r,s,o)=>n(s,o)??void 0,{describeKind:"producer",...e})}function ce(n,e,t){return ye(n,(s,o,i)=>{let a=s.map((u,d)=>u!=null&&u.length>0?u.at(-1):i.prevData[d]);o.emit(e(a,i))},{describeKind:"derived",...t})}function jt(n,e,t){return ye(n,(s,o,i)=>{let a=s.map((u,d)=>u!=null&&u.length>0?u.at(-1):i.prevData[d]);return e(a,o,i)??void 0},{describeKind:"effect",...t})}var $e=j(()=>{"use strict";Re()});function ht(n,e){if(e!=null&&e.length>0)return new Set(e);switch(n){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(n){return n._describeKind!=null?n._describeKind:n._deps.length>0?"derived":n._fn!=null?"producer":"state"}function Bn(n){let e={};for(let[t,r]of Object.entries(n.meta))try{e[t]=r.cache}catch{}return e}function gt(n,e,t){let r=e==null,s=!r&&e!=null?[...e].filter(c=>c.startsWith("meta.")).map(c=>c.slice(5)):null,o=r||e.has("meta")||s!=null&&s.length>0,i="state",a=[];n instanceof B&&(i=jn(n),a=n._deps.map(c=>c.node.name??""));let u={type:i,deps:a};(r||e.has("status"))&&(u.status=n.status);let d=n instanceof B?n._guard:void 0;if(o){let c={...Bn(n)};if(d!=null&&c.access===void 0&&(c.access=ot(d)),s!=null&&s.length>0&&!e.has("meta")){let f={};for(let p of s)p in c&&(f[p]=c[p]);u.meta=f}else u.meta=c}if(n.name!=null&&(u.name=n.name),(r||e.has("value"))&&(!t||i==="state")){n.status==="sentinel"&&(u.sentinel=!0);try{u.value=n.cache}catch{}}if((r||e.has("v"))&&n.v!=null){let c={id:n.v.id,version:n.v.version};"cid"in n.v&&(c.cid=n.v.cid,c.prev=n.v.prev),u.v=c}return(r||e.has("guard"))&&d!=null&&(u.guard=ot(d)),(r||e.has("lastMutation"))&&n.lastMutation!=null&&(u.lastMutation=n.lastMutation),u}var Bt=j(()=>{"use strict";Pe();Re()});function mt(n,e){if(Object.is(n,e))return!0;if(n==null||e==null||typeof n!="object"||typeof e!="object")return!1;if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let o=0;o<n.length;o++)if(!mt(n[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;let s=new Set(r);for(let o of t)if(!s.has(o)||!mt(n[o],e[o]))return!1;return!0}function Ht(n,e){return`${n}\0${e}`}function bt(n,e){let t=[],r=new Set(n.subgraphs),s=new Set(e.subgraphs),o=[];for(let m of s)r.has(m)||o.push(m);o.sort();for(let m of o)t.push({type:"subgraph-mounted",path:m});let i=new Set(Object.keys(n.nodes)),a=new Set(Object.keys(e.nodes)),u=[];for(let m of a)i.has(m)||u.push(m);u.sort();for(let m of u)t.push({type:"node-added",path:m,node:{...e.nodes[m]}});let d=[];for(let m of a){if(!i.has(m))continue;let N=n.nodes[m]?.meta,v=e.nodes[m]?.meta;N==null&&v==null||mt(N??{},v??{})||d.push(m)}d.sort();for(let m of d)t.push({type:"node-meta-changed",path:m,prevMeta:n.nodes[m]?.meta??{},nextMeta:e.nodes[m]?.meta??{}});let c=new Map;for(let m of n.edges)c.set(Ht(m.from,m.to),m);let f=new Map;for(let m of e.edges)f.set(Ht(m.from,m.to),m);let p=[];for(let[m,N]of f)c.has(m)||p.push(N);p.sort((m,N)=>m.from<N.from?-1:m.from>N.from?1:m.to<N.to?-1:m.to>N.to?1:0);for(let m of p)t.push({type:"edge-added",from:m.from,to:m.to});let h=[];for(let[m,N]of c)f.has(m)||h.push(N);h.sort((m,N)=>m.from<N.from?-1:m.from>N.from?1:m.to<N.to?-1:m.to>N.to?1:0);for(let m of h)t.push({type:"edge-removed",from:m.from,to:m.to});let l=[];for(let m of i)a.has(m)||l.push(m);l.sort();for(let m of l)t.push({type:"node-removed",path:m});let w=[];for(let m of r)s.has(m)||w.push(m);w.sort();for(let m of w)t.push({type:"subgraph-unmounted",path:m});return{events:t,flushedAt_ns:de()}}var Wt=j(()=>{"use strict";we()});function He(n){return{describeKind:"producer",...n}}function Ut(n,e){let{signal:t,period:r,...s}=e??{};return pe(o=>{let i=!1,a=0,u,d,c=()=>{i=!0,u!==void 0&&clearTimeout(u),d!==void 0&&clearInterval(d),t?.removeEventListener("abort",p)},f=()=>{i||(r!=null?(o.emit(a++),d=setInterval(()=>{i||o.emit(a++)},r)):(i=!0,t?.removeEventListener("abort",p),o.emit(a++),o.down([[z]])))},p=()=>{i||(c(),o.down([[G,t.reason]]))};if(t?.aborted){p();return}return u=setTimeout(f,n),t?.addEventListener("abort",p,{once:!0}),c},He(s))}function qt(n,e){return pe(t=>{let r=!1;try{for(let s of n){if(r)return;t.emit(s)}r||t.down([[z]])}catch(s){r||t.down([[G,s]])}return()=>{r=!0}},He(e))}function Hn(n){return n!=null&&typeof n.then=="function"}function Wn(n,e){let{signal:t,...r}=e??{};return pe(s=>{let o=!1,i=()=>{o||(o=!0,s.down([[G,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(n).then(a=>{o||(o=!0,t?.removeEventListener("abort",i),s.emit(a),s.down([[z]]))},a=>{o||(o=!0,t?.removeEventListener("abort",i),s.down([[G,a]]))}),()=>{o=!0,t?.removeEventListener("abort",i)}},He(r))}function Un(n,e){let{signal:t,...r}=e??{};return pe(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,u=!1,d=n[Symbol.asyncIterator](),c=()=>{u||a.aborted||Promise.resolve(d.next()).then(f=>{if(!(u||a.aborted)){if(f.done){s.down([[z]]);return}s.emit(f.value),c()}},f=>{!u&&!a.aborted&&s.down([[G,f]])})};return c(),()=>{u=!0,t?.removeEventListener("abort",i),o.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},He(r))}function qn(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"}function We(n,e){if(qn(n))return n;if(Hn(n))return Wn(n,e);if(n!=null){let t=n;if(typeof t[Symbol.asyncIterator]=="function")return Un(n,e);if(typeof t[Symbol.iterator]=="function")return qt(n,e)}return Kn(n)}function Kn(...n){return qt(n,void 0)}function Ue(n){return n.subscribe(()=>{})}var Kt=j(()=>{"use strict";fe();$e()});var yt=j(()=>{"use strict";Kt()});var qe,Yt=j(()=>{"use strict";qe=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===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,Jt=j(()=>{"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 Xt(n,e,t,r={}){let s=e in n.nodes,o=t in n.nodes;if(!s)return Ke(e,t,"no-such-from");if(!o)return Ke(e,t,"no-such-to");let i=r.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(r.findCycle===!0){let d=Yn(n,e,r);if(d!=null)return d}let u=Ye(e,n.nodes[e],0,r);return Je(e,t,[u])}if(i===0)return Ke(e,t,"no-path");let a=Zt(n,e,t,i);return a.found?Je(e,t,Qt(n,a.pathOrder,r)):Ke(e,t,a.truncated?"max-depth-exceeded":"no-path")}function Zt(n,e,t,r){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,u=!1;for(;a<o.length;){let f=o[a++];if(f.path===e)break;if(r!=null&&f.depth>=r){let w=n.nodes[f.path];w?.deps&&w.deps.length>0&&(u=!0);continue}let p=n.nodes[f.path];if(p==null)continue;let h=p.deps??[],l=new Map;for(let w=0;w<h.length;w++){let m=h[w];if(!m)continue;let N=l.get(m);N==null&&(N=[],l.set(m,N)),N.push(w)}for(let[w,m]of l)i.has(w)||(i.add(w),s.set(w,{from:f.path,depIndices:m}),o.push({path:w,depth:f.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:u};let d=[{path:e}],c=e;for(;c!==t;){let f=s.get(c);if(f==null)return{found:!1,pathOrder:[],truncated:!1};d[d.length-1].depIndices=f.depIndices,d.push({path:f.from}),c=f.from}return{found:!0,pathOrder:d,truncated:!1}}function Yn(n,e,t){let r=n.nodes[e];if(r==null)return null;let s=r.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=Ye(e,r,0,t);a.dep_index=o[0];let u=Ye(e,r,1,t);return Je(e,e,[a,u])}let i=null;for(let a=0;a<s.length;a++){let u=s[a];if(!u||u===e)continue;let d=Zt(n,u,e,t.maxDepth);d.found&&(i==null||d.pathOrder.length<i.pathOrder.length)&&(i=d,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...d.pathOrder],truncated:!1})}return i==null?null:Je(e,e,Qt(n,i.pathOrder,t))}function Qt(n,e,t){return e.map((r,s)=>{let o=n.nodes[r.path],i=Ye(r.path,o,s,t);return r.depIndices!=null&&r.depIndices.length>0&&(i.dep_index=r.depIndices[0],r.depIndices.length>1&&(i.dep_indices=[...r.depIndices])),i})}function Ye(n,e,t,r){let s={path:n,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=r.annotations?.get(n)??e.annotation;o!=null&&(s.annotation=o);let i=r.lastMutations?.get(n)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function Je(n,e,t){return en(n,e,!0,"ok",t)}function Ke(n,e,t){return en(n,e,!1,t,[])}function en(n,e,t,r,s){let o=Jn(n,e,t,r,s);return{from:n,to:e,found:t,reason:r,steps:s,text:o,toJSON(){return{from:n,to:e,found:t,reason:r,steps:s}}}}function Jn(n,e,t,r,s){if(!t)switch(r){case"no-such-from":return`explainPath: no node named "${n}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${n}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${n}" to "${e}"`}let o=[`Causal path: ${n} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let u=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(u),"value"in i&&o.push(` value: ${Xn(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let d=i.lastMutation.actor;o.push(` actor: ${d.type}${d.id?`:${d.id}`:""}`)}}return o.join(`
2
- `)}function Xn(n){if(n===void 0)return"<sentinel>";if(n===null)return"null";if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return String(n);try{let e=JSON.stringify(n);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(n)}}var tn=j(()=>{"use strict"});function nn(n){let e=new WeakSet,t=new WeakSet,r=[n],s=0;for(;r.length>0;){let o=r.pop();s+=Qn(o,e,t,r)}return s}function Qn(n,e,t,r){if(n==null)return 0;switch(typeof n){case"number":return H.number;case"boolean":return H.boolean;case"string":return H.string+n.length*2;case"bigint":return H.bigint+er(n);case"symbol":return H.symbol;case"function":return e.has(n)?0:(e.add(n),H.function);case"undefined":return 0}let o=n;if(e.has(o))return 0;e.add(o);let i=o[Zn];if(typeof i=="function")try{let d=i.call(o);if(typeof d=="number"&&Number.isFinite(d))return d}catch{}if(o instanceof Date)return H.date;if(o instanceof RegExp)return H.regexp+o.source.length*2;if(o instanceof Error){let d=o.message?o.message.length*2:0,c=o.stack?o.stack.length*2:0;return H.error+d+c}if(typeof URL<"u"&&o instanceof URL)return H.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return H.promise;if(o instanceof WeakMap)return H.weakmap;if(o instanceof WeakSet)return H.weakset;if(o instanceof Map){let d=H.map;for(let[c,f]of o)d+=H.mapEntry,r.push(c),r.push(f);return d}if(o instanceof Set){let d=H.set;for(let c of o)d+=H.setEntry,r.push(c);return d}if(Array.isArray(o)){let d=H.array+o.length*8;for(let c of o)r.push(c);return d}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let d=o;return t.has(d.buffer)?48:(t.add(d.buffer),d.buffer.byteLength+48)}let a=H.object,u=Object.keys(o);for(let d of u){a+=H.string+d.length*2;try{r.push(o[d])}catch{}}return a}function er(n){let e=n<0n?-n:n;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var H,Zn,rn=j(()=>{"use strict";H={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},Zn=Symbol.for("sizeof")});function sn(n,e){let t=e?.topN??10,r=n.describe({detail:"standard"}),s=[],o=n._collectObserveTargets;typeof o=="function"&&o.call(n,"",s);let i=new Map;for(let[p,h]of s)i.set(p,h);let a=[];for(let[p,h]of Object.entries(r.nodes)){let l=i.get(p),w=l instanceof B?l:null,m=w?nn(w.cache):0,N=w?w._sinkCount:0,v=h.deps?.length??0,y=h.type==="effect"&&N===0,_=N===0?h.type==="effect"?"orphan-effect":h.type==="derived"?"idle-derived":h.type==="producer"?"idle-producer":null:null;a.push({path:p,type:h.type,status:h.status??"unknown",valueSizeBytes:m,subscriberCount:N,depCount:v,isOrphanEffect:y,orphanKind:_})}let u=a.reduce((p,h)=>p+h.valueSizeBytes,0),d=(p,h)=>[...a].sort(h??((l,w)=>w[p]-l[p])).slice(0,t),c=a.filter(p=>p.orphanKind!=null),f=a.filter(p=>p.isOrphanEffect);return{nodeCount:a.length,edgeCount:r.edges.length,subgraphCount:r.subgraphs.length,nodes:a,totalValueSizeBytes:u,hotspots:{byValueSize:d("valueSizeBytes"),bySubscriberCount:d("subscriberCount"),byDepCount:d("depCount")},orphans:c,orphanEffects:f}}var on=j(()=>{"use strict";Re();rn()});function Xe(n,e){let t=Math.max(16,n.size*4),r=0;for(;n.size>0;){if(r++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${n.size} disposer(s) discarded`),n.clear();return}let s=n.values().next();if(s.done)return;let o=s.value;n.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function ln(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"&&typeof n.down=="function"}function tr(n){if(n!=null)return ln(n)?n.cache:n}function _e(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"&&typeof n.down=="function"}function he(n){return _e(n)?n.cache??"":n}function an(n){return _e(n)?n.cache??0:n}function un(n){return _e(n)?n.cache??!1:n}function nr(n){let e=[];for(let t of Object.keys(n).sort()){let r=n[t].v;r!=null&&e.push(`${t} ${r.id} ${r.version}`)}return e.join(`
3
- `)}function dn(n){if(n.version!==ve)throw new Error(`unsupported snapshot version ${String(n.version)} (expected ${ve})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in n))throw new Error(`snapshot missing required key "${e}"`);if(typeof n.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof n.nodes!="object"||n.nodes===null||Array.isArray(n.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(n.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(n.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function rr(n,e){let t=new WeakMap,r=(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,u=o.constructor;if(a!==u)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 h=0;h<s.length;h++)if(!r(s[h],p[h]))return!1;return!0}if(s instanceof Map){let p=o;if(s.size!==p.size)return!1;for(let[h,l]of s)if(!p.has(h)||!r(l,p.get(h)))return!1;return!0}if(s instanceof Set){let p=o;if(s.size!==p.size)return!1;for(let h of s){let l=!1;for(let w of p)if(r(h,w)){l=!0;break}if(!l)return!1}return!0}if(ArrayBuffer.isView(s)){let p=s,h=o;if(p.length!==h.length)return!1;for(let l=0;l<p.length;l++)if(p[l]!==h[l])return!1;return!0}let d=Object.keys(s),c=Object.keys(o);if(d.length!==c.length)return!1;let f=new Set(c);for(let p of d)if(!f.has(p)||!r(s[p],o[p]))return!1;return!0};return r(n,e)}function sr(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(n){let e="^";for(let t=0;t<n.length;t+=1){let r=n[t];if(r==="*"){e+=".*";continue}if(r==="?"){e+=".";continue}if(r==="["){let s=n.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=n.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=sr(r)}return e+="$",new RegExp(e)}function vt(n){if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean"||n==null)return String(n);try{return JSON.stringify(n)}catch{return"[unserializable]"}}function ar(n){return n==="none"?ir:n==="ansi"||n==null?or:{data:n.data??"",dirty:n.dirty??"",resolved:n.resolved??"",invalidate:n.invalidate??"",pause:n.pause??"",resume:n.resume??"",complete:n.complete??"",error:n.error??"",teardown:n.teardown??"",derived:n.derived??"",path:n.path??"",reset:n.reset??""}}function cn(n){if(n==null)return{};let e=n.detail;return e==="full"?{...n,structured:n.structured??!0,timeline:n.timeline??!0,causal:n.causal??!0,derived:n.derived??!0}:e==="minimal"?{...n,structured:n.structured??!0}:n.format==="stage-log"?{...n,structured:n.structured??!0,timeline:n.timeline??!0}:n}function ur(n,e,t){for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${n}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${r})`)}}function _t(n,e,t){if(n==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(n.includes(L))throw new Error(`Graph "${e}": ${t} "${n}" must not contain '${L}' (path separator)`);if(n===te)throw new Error(`Graph "${e}": ${t} name "${te}" is reserved for meta companion paths`);ur(n,e,t)}function dr(n,e){if(n==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=n.split(L);for(let r of t)if(r==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function cr(n,e){let t=!1;for(let s of n)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?n.filter(s=>e.isMetaPassthrough(s[0])):n}function fn(n){for(let e of n._mounts.values())fn(e);for(let e of n._nodes.values())try{e.down([[U]],{internal:!0})}catch{}}function pn(n,e){let t=Ae.diff(n,e),r={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(r[s]=o)}return{...t,nodesAddedFull:r}}function wt(n,e,t,r={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return r.withDetail?s:[];if(!r.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=r.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return r.withDetail?s:[];let i=new Map,a=new Map,u=new Map,d=new Map,c=new Set;for(let[y,_]of Object.entries(n.nodes)){if(!y)continue;c.add(y);let T=_.deps??[];i.set(y,T);for(let k of T)k&&(c.add(k),a.has(k)||a.set(k,new Set),a.get(k).add(y))}for(let y of n.edges){if(y==null||typeof y!="object")continue;let _=typeof y.from=="string"?y.from:"",T=typeof y.to=="string"?y.to:"";!_||!T||(c.add(_),c.add(T),d.has(_)||d.set(_,new Set),d.get(_).add(T),u.has(T)||u.set(T,new Set),u.get(T).add(_))}if(!c.has(e))return r.withDetail?s:[];let f=r.both===!0,p=y=>{if(f){let b=i.get(y)??[],x=u.get(y),R=a.get(y),A=d.get(y),O=[...b];return x&&O.push(...x),R&&O.push(...R),A&&O.push(...A),O}if(t==="upstream"){let b=i.get(y)??[],x=u.get(y);return x?[...b,...x]:b}let _=a.get(y),T=d.get(y),k=_?[..._]:[];return T&&k.push(...T),k},h=new Set([e]),l=new Map,w=[{path:e,depth:0}],m=0,N=!1;for(;m<w.length;){let y=w[m++];if(o!=null&&y.depth>=o){p(y.path).length>0&&(N=!0);continue}for(let _ of p(y.path))!_||h.has(_)||(h.add(_),l.set(_,y.depth+1),w.push({path:_,depth:y.depth+1}))}let v=[...l.keys()].sort((y,_)=>y<_?-1:y>_?1:0);return r.withDetail?{paths:v,depths:l,truncated:N}:v}function lr(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],s=e[t];if(r.path!==s.path||r.type!==s.type||r.status!==s.status||r.hop!==s.hop||r.dep_index!==s.dep_index||r.annotation!==s.annotation||r.value!==s.value||r.lastMutation!==s.lastMutation)return!1;let o=r.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,te,ve,or,ir,Ae,hn=j(()=>{"use strict";ut();Ge();we();Pe();fe();Bt();Re();$e();Wt();yt();Yt();Jt();at();tn();on();L="::",te="__meta__",ve=1;or={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"},ir={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};Ae=class n{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===te)throw new Error(`Graph name "${te}" 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=[],r=e?this:this._parent;for(;r!=null;)t.push(r),r=r._parent;return t}get topology(){return this._topology==null&&(this._topology=pe(e=>{let t=r=>{e.emit(r)};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 r=e.name,s=t?.name??r;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(_t(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 B&&t._applyVersioning(e)}remove(e){_t(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,u]of i)a.includes(`${L}${te}${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,fn(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let r=this._nodes.get(e);if(!r)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(r),r.down([[U]],{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)})(),r={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);r.nodes.push(...i.nodes),r.mounts.push(...i.mounts)}return r.nodes.sort(),r.mounts.sort(),r}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,r=0;return{[Symbol.iterator](){return this},next(){if(r>=e.length)return{value:void 0,done:!0};let s=e[r++];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,r){let s=r?.internal===!0;this.node(e).down([[$,t]],{actor:r?.actor,internal:s,delivery:"write"})}setAll(e,t){let r=Symbol.iterator in e?e:Object.entries(e);be(()=>{for(let[s,o]of r)this.set(s,o,t)})}invalidate(e,t){let r=t?.internal===!0;this.node(e).down([[re]],{actor:t?.actor,internal:r,delivery:"write"})}error(e,t,r){let s=r?.internal===!0;this.node(e).down([[G,t]],{actor:r?.actor,internal:s,delivery:"write"})}complete(e,t){let r=t?.internal===!0;this.node(e).down([[z]],{actor:t?.actor,internal:r,delivery:"write"})}_registerSelfPruningKeepalive(e){let t,r,s=()=>{t?.(),t=void 0,r?.(),r=void 0};t=e.subscribe(o=>{for(let i of o){let a=i[0];if(a===U||a===z||a===G){s();return}}}),r=this.addDisposer(s)}_wireSignalToRemove(e,t){if(t==null)return;let r=()=>{try{this.remove(e)}catch{}};if(t.aborted){r();return}t.addEventListener("abort",r,{once:!0}),this.addDisposer(()=>t.removeEventListener("abort",r))}derived(e,t,r,s){let o=t.map(h=>this.resolve(h)),{keepAlive:i,annotation:a,equals:u,initial:d,meta:c,signal:f}=s??{},p=ce(o,r,{name:e,...u!=null?{equals:u}:{},...d!==void 0?{initial:d}:{},...c!=null?{meta:c}:{}});return this.add(p,{name:e,...a!=null?{annotation:a}:{}}),i===!0&&this._registerSelfPruningKeepalive(p),this._wireSignalToRemove(e,f),p}effect(e,t,r,s){let o=t.map(c=>this.resolve(c)),{annotation:i,meta:a,signal:u}=s??{},d=jt(o,r,{name:e,...a!=null?{meta:a}:{}});return this.add(d,{name:e,...i!=null?{annotation:i}:{}}),this._wireSignalToRemove(e,u),d}produce(e,t,r){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}=r??{},u=We(t,{name:e,...o!=null?{meta:o}:{},...i!=null?{equals:i}:{},...a!=null?{signal:a}:{}});return this.add(u,{name:e,...s!=null?{annotation:s}:{}}),this._wireSignalToRemove(e,a),u}batch(e){be(e)}edges(e){let t=e?.recursive===!0,r=new Map;if(!t){for(let[u,d]of this._nodes)r.set(d,u);let a=[];for(let[u,d]of this._nodes)if(d instanceof B)for(let c of d._deps){let f=r.get(c.node);f!=null&&a.push([f,u])}return a.sort((u,d)=>u[0]<d[0]?-1:u[0]>d[0]?1:u[1]<d[1]?-1:u[1]>d[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,u]of s)o.set(u,a);let i=[];for(let[a,u]of s)if(u instanceof B)for(let d of u._deps){let c=o.get(d.node);c!=null&&i.push([c,a])}return i.sort((a,u)=>a[0]<u[0]?-1:a[0]>u[0]?1:a[1]<u[1]?-1:a[1]>u[1]?1:0),i}mount(e,t){if(t===void 0){let s=new n(e);return this.mount(e,s)}if(typeof t=="function"){let s=new n(e);return t(s),this.mount(e,s)}let r=t;if(_t(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(r===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(r._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${r._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===r)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,r),r._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),r}resolve(e){let t=dr(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 r=t[0],s=t.slice(1);if(s.length===0){let a=this._nodes.get(r);if(a)return a;throw this._mounts.has(r)?new Error(`Graph "${this.name}": path ends at subgraph "${r}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${r}"`)}let o=this._nodes.get(r);if(o&&s.length>0&&s[0]===te)return this._resolveMetaChainFromNode(o,s,t.join(L));let i=this._mounts.get(r);if(!i)throw this._nodes.has(r)?new Error(`Graph "${this.name}": "${r}" is a node; trailing path "${s.join(L)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${r}"`);return i.resolve(s.join(L))}_resolveMetaChainFromNode(e,t,r){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==te)throw new Error(`Graph "${this.name}": expected ${te} segment in meta path "${r}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${te} in "${r}"`);let a=i[o+1],u=s.meta[a];if(!u)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${r}"`);s=u,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 r=[];if(this._signalDeliver(e,t??{},new Set,r),r.length>0)throw r[0]}_signalDeliver(e,t,r,s){for(let u of this._mounts.values())u._signalDeliver(e,t,r,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=cr(e,this.config);for(let u of[...this._nodes.keys()].sort()){let d=this._nodes.get(u);if(!r.has(d)){r.add(d);try{d.down(e,i)}catch(c){if(c instanceof ee)throw c;s.push(c)}a.length!==0&&this._signalMetaSubtree(d,a,r,i,s)}}}_signalMetaSubtree(e,t,r,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!r.has(a)){r.add(a);try{a.down(t,s)}catch(u){if(u instanceof ee)throw u;o.push(u)}this._signalMetaSubtree(a,t,r,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=tr(e?.actor),r=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 u=new Map;for(let[_,T]of a)u.set(T,_);let d=[];{let _=a.map(([,b])=>b),T=new Set(u.values()),k=0;for(;_.length>0;){let b=_.shift();if(b instanceof B)for(let x of b._deps){let R=x.node;if(u.has(R))continue;let A=R.name??"",O=A;if(!O||T.has(O))if(A){let C=2;for(;T.has(`${A}#${C}`);)C++;O=`${A}#${C}`}else for(O=`__internal__/${k++}`;T.has(O);)O=`__internal__/${k++}`;u.set(R,O),T.add(O),d.push([O,R]),_.push(R)}}}let c=[...a,...d],f={};for(let[_,T]of c){if(t!=null&&!T.allowsObserve(t))continue;let k=gt(T,i,o),b=T instanceof B?T._deps.map(O=>u.get(O.node)??O.node.name??""):[],{name:x,...R}=k,A={...R,deps:b};if(!o){let O=this._annotations.get(_);O!=null&&(A.annotation=O)}if(r!=null)if(typeof r=="function"){let O=r;if(!(O.length>=2?O(_,A):O(A)))continue}else{let O=!0;for(let[C,M]of Object.entries(r)){let g=C==="deps_includes"?"depsIncludes":C==="meta_has"?"metaHas":C;if(g==="depsIncludes"){if(!A.deps.includes(String(M))){O=!1;break}continue}if(g==="metaHas"){if(!Object.hasOwn(A.meta??{},String(M))){O=!1;break}continue}if(A[g]!==M){O=!1;break}}if(!O)continue}f[_]=A}let p=new Set(Object.keys(f)),h=[];for(let[_,T]of c)if(T instanceof B)for(let k of T._deps){let b=u.get(k.node);b!=null&&h.push([b,_])}h.sort((_,T)=>_[0]<T[0]?-1:_[0]>T[0]?1:_[1]<T[1]?-1:_[1]>T[1]?1:0);let l=h.map(([_,T])=>({from:_,to:T}));(t!=null||r!=null)&&(l=l.filter(_=>p.has(_.from)&&p.has(_.to)));let w=this._collectSubgraphs(""),m=t!=null||r!=null?w.filter(_=>{let T=`${_}${L}`;return[...p].some(k=>k===_||k.startsWith(T))}):w,N=this,v=e;return{name:this.name,nodes:f,edges:l,subgraphs:m,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(_){let T={...v};return Array.isArray(_)?(T.fields=_,T.detail=void 0):(T.detail=_,T.fields=void 0),N.describe(T)}}}_collectSubgraphs(e){let t=[];for(let r of[...this._mounts.keys()].sort()){let s=e===""?r:`${e}${r}`;t.push(s),t.push(...this._mounts.get(r)._collectSubgraphs(`${s}${L}`))}return t}resourceProfile(e){return sn(this,e)}reachable(e,t,r={}){return r.withDetail===!0?wt(this.describe(),e,t,{...r,withDetail:!0}):wt(this.describe(),e,t,r)}explain(e,t,r){return r?.reactive===!0?this._explainReactive(e,t,r):this._explainStatic(he(e),he(t),{...r?.maxDepth!==void 0?{maxDepth:an(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:un(r.findCycle)}:{}})}_explainStatic(e,t,r){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,u]of Object.entries(s.nodes))u.lastMutation!=null&&i.set(a,u.lastMutation);return Xt(s,e,t,{...r?.maxDepth!=null?{maxDepth:r.maxDepth}:{},...r?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},r=e.reactiveName??"describe",s=0,o=ae(s,{name:`${r}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,d=()=>{a||u||(a=!0,ke(()=>{a=!1,!u&&(s+=1,o.emit(s))}))},c=i.onEvent(v=>{let y=v.type;y!=="data"&&y!=="error"&&y!=="complete"&&y!=="teardown"||d()}),f=[],p=new WeakSet,h=v=>{if(p.has(v)||u)return;p.add(v);let y=v.topology.subscribe(_=>{for(let T of _){if(T[0]!==$)continue;let k=T[1];if(d(),k.kind==="added"&&k.nodeKind==="mount"){let b=v._mounts.get(k.name);b!=null&&h(b)}}});f.push(y);for(let _ of v._mounts.keys()){let T=v._mounts.get(_);T!=null&&h(T)}};h(this);let l,w=e.actor;ln(w)&&(l=w.subscribe(v=>{let y=!1,_=!1;for(let T of v){let k=T[0];k===$?y=!0:(k===z||k===G||k===U)&&(_=!0)}y&&d(),_&&(l?.(),l=void 0,d())}));let m;try{m=ce([o],()=>this.describe(t),{name:r,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(v,y)=>v===y})}catch(v){c(),l?.();for(let y of f)y();throw i.dispose(),v}let N=Ue(m);return{node:m,dispose(){u=!0,c(),l?.();for(let v of f)v();f.length=0,i.dispose(),N()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},r=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=bt(s,o),a=ae(i,{name:r,meta:{domain:"audit",kind:"describe-diff"},equals:(p,h)=>p===h}),u=this._describeReactive({...e,reactiveName:void 0}),d=!1,c=u.node.subscribe(p=>{if(!d)for(let h of p){if(h[0]!==$)continue;let l=h[1],w=bt(o,l);o=l,w.events.length!==0&&a.emit(w)}}),f=Ue(a);return{node:a,dispose(){d=!0,c(),u.dispose(),a.down([[U,"describe-diff disposed"]]),f()}}}_explainReactive(e,t,r){let s=0,o=ae(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,d=()=>{a||u||(a=!0,ke(()=>{a=!1,!u&&(s+=1,o.emit(s))}))},c=i.onEvent(v=>{let y=v.type;y!=="data"&&y!=="error"&&y!=="complete"&&y!=="teardown"||d()}),f=[];e!=null&&_e(e)&&f.push(e),t!=null&&_e(t)&&f.push(t),r?.maxDepth!=null&&_e(r.maxDepth)&&f.push(r.maxDepth),r?.findCycle!=null&&_e(r.findCycle)&&f.push(r.findCycle);let p=()=>{for(let v of f)if(v.cache===void 0)return!1;return!0},h=()=>{let v=he(e),y=he(t);return{from:v,to:y,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:v,to:y,found:!1,reason:"pending",steps:[]})}},l;try{l=ce([o],()=>{if(!p())return h();let v=he(e),y=he(t),_={...r?.maxDepth!==void 0?{maxDepth:an(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:un(r.findCycle)}:{}};return this._explainStatic(v,y,_)},{name:r?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:he(e),to:he(t)},equals:(v,y)=>v.found===y.found&&v.reason===y.reason&&v.steps.length===y.steps.length&&lr(v.steps,y.steps)})}catch(v){throw c(),i.dispose(),v}let w=Ue(l),m=[],N=v=>{let y;return y=v.subscribe(_=>{let T=!1,k=!1;for(let b of _){let x=b[0];x===$?T=!0:(x===z||x===G||x===U)&&(k=!0)}(T||k)&&d(),k&&y&&(y(),y=void 0)}),()=>{y&&(y(),y=void 0)}};for(let v of f)m.push(N(v));return{node:l,dispose(){u=!0,c();for(let v of m)v?.();m.length=0,i.dispose(),w()}}}_pathsMatching(e){let t=Ze(e),r=[];return this._collectObserveTargets("",r),r.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let r of[...this._mounts.keys()].sort()){let s=e===""?r:`${e}${L}${r}`;this._mounts.get(r)._collectObserveTargets(s,t)}for(let r of[...this._nodes.keys()].sort()){let s=this._nodes.get(r),o=e===""?r:`${e}${L}${r}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,r){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${L}${te}${L}${s}`;r.push([i,o]),this._appendMetaObserveTargets(i,o,r)}}observe(e,t){let r=typeof e=="string",o=cn(r?t:e);if(o.reactive===!0)return this._observeReactive(r?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(r){let c=e,f=this.resolve(c);if(a!=null&&!f.allowsObserve(a))throw new ee({actor:a,action:"observe",nodeName:c});return i?this._buildStructuredObserver([[c,f]],o,"one"):{subscribe(p){return f.subscribe(p)},up(p){try{f.up?.(p)}catch(h){if(h instanceof ee)return;throw h}}}}let u=[];this._collectObserveTargets("",u),u.sort((c,f)=>c[0]<f[0]?-1:c[0]>f[0]?1:0);let d=a==null?u:u.filter(([,c])=>c.allowsObserve(a));return i?this._buildStructuredObserver(d,o,"all"):{subscribe:c=>{let f=d.map(([p,h])=>h.subscribe(l=>{c(p,l)}));return()=>{for(let p of f)p()}},up:(c,f)=>{try{this.resolve(c).up?.(f)}catch(p){if(p instanceof ee)return;throw p}}}}_observeReactive(e,t){let r=t.tiers,s=r!=null?new Set(r):null,o=t.reactiveName??"observe";return pe(i=>{let a=[],u=!1,d=!1,c=()=>{if(a.length===0||d)return;let w={events:a.slice(),flushedAt_ns:de()};a.length=0,i.emit(w)},f={...t,reactive:!1,structured:!0,timeline:!0},p=e!=null?this.observe(e,f):this.observe(f),h=w=>{d||(a.push(w),!u&&(u=!0,ke(()=>{u=!1,c()})))};for(let w of p.events)h(w);let l=p.onEvent(h);return()=>{d=!0,l(),p.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,r){let s=r==="one"?e[0]?.[0]:void 0,o=i=>{if(r==="one"&&s!=null){let c=this.resolve(s);return this._buildStructuredObserver([[s,c]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((c,f)=>c[0]<f[0]?-1:c[0]>f[0]?1:0);let u=i.actor,d=u==null?a:a.filter(([,c])=>c.allowsObserve(u));return this._buildStructuredObserver(d,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,r){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",u=this.config.inspectorEnabled,d=(o||i)&&u,c=t.maxEvents,f=c!=null&&c>0?new Fe(c):null,p=[],h=new Set,l=t.tiers!=null?new Set(t.tiers):null,w={},m=new Set,N=0,v=0,y=0,_=0,T=0,k=0,b=!1,x=!1,R=0,A=new Map,O=new Map,C=new Map,M=S=>{if(!(l!=null&&!l.has(S.type))){f?f.push(S):p.push(S);for(let F of h)F(S)}},g=S=>l==null||l.has(S),E=()=>s?{timestamp_ns:de(),in_batch:Ie(),batch_id:R}:{},D=(S,F)=>{if(!(!d||!(S instanceof B)))return S._setInspectorHook(Z=>{if(Z.kind==="dep_message")A.set(S,Z.depIndex);else if(Z.kind==="run"){let De=Z.batchData.map((P,K)=>P!=null&&P.length>0?P.at(-1):Z.prevData[K]);O.set(S,De);let Q=Z.batchData.map(P=>P!=null?[...P]:void 0);C.set(S,Q),i&&M({type:"derived",path:F,dep_values:De,dep_batches:Q,...E()})}})},I=S=>{let F=A.get(S),Z=O.get(S);if(!o||Z==null)return{};let Q=(F!=null&&F>=0&&S instanceof B?S._deps[F]:void 0)?.node,P=Q?.v,K=C.get(S);return{trigger_dep_index:F,trigger_dep_name:Q?.name,...P!=null?{trigger_version:{id:P.id,version:P.version}}:{},dep_values:[...Z],...K!=null?{dep_batches:K}:{}}},V=[],W=[];for(let[S,F]of e){let Z=D(F,S);Z&&V.push(Z),W.push(F.subscribe(De=>{R++;for(let Q of De){let P=Q[0],K=E();if(P===$){w[S]=Q[1];let Qe=F instanceof B?F.lastMutation?.actor??Se:Se;M({type:"data",path:S,data:Q[1],actor:Qe,...K,...I(F)})}else if(a)P===q?g("dirty")&&N++:P===J?g("resolved")&&v++:P===re?g("invalidate")&&y++:P===ie?g("pause")&&_++:P===le?g("resume")&&T++:P===U?g("teardown")&&k++:P===z&&!m.has(S)?g("complete")&&(b=!0):P===G&&g("error")&&(x=!0,m.add(S));else if(P===q)g("dirty")&&N++,M({type:"dirty",path:S,...K});else if(P===J)g("resolved")&&v++,M({type:"resolved",path:S,...K,...I(F)});else if(P===re)g("invalidate")&&y++,M({type:"invalidate",path:S,...K});else if(P===ie)g("pause")&&_++,M({type:"pause",path:S,lockId:Q[1],...K});else if(P===le)g("resume")&&T++,M({type:"resume",path:S,lockId:Q[1],...K});else if(P===z)g("complete")&&!m.has(S)&&(b=!0),M({type:"complete",path:S,...K});else if(P===G){g("error")&&(x=!0,m.add(S));let Qe=F instanceof B?F.lastMutation?.actor??Se:Se;M({type:"error",path:S,data:Q[1],actor:Qe,...K})}else P===U&&(g("teardown")&&k++,M({type:"teardown",path:S,...K}))}}))}let Y=!1,X=()=>{if(!Y){Y=!0;for(let S of W)S();for(let S of V)S();for(let S of se)S({value:void 0,done:!0});se.length=0}},ue=[],se=[];h.add(S=>{let F=se.shift();F?F({value:S,done:!1}):ue.push(S)});let oe={get values(){return w},get dirtyCount(){return N},get resolvedCount(){return v},get invalidateCount(){return y},get pauseCount(){return _},get resumeCount(){return T},get teardownCount(){return k},get events(){return f?f.toArray():[...p]},get anyCompletedCleanly(){return b},get anyErrored(){return x},get completedWithoutErrors(){return b&&!x},onEvent(S){return h.add(S),()=>h.delete(S)},dispose:X,expand(S){X();let F={...t};return typeof S=="string"?F.detail=S:Object.assign(F,S),r(cn(F))},[Symbol.asyncIterator](){return{next(){return ue.length>0?Promise.resolve({value:ue.shift(),done:!1}):Y?Promise.resolve({value:void 0,done:!0}):new Promise(S=>se.push(S))},return(){return X(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(oe,t),oe}_attachFormatLogger(e,t){let r=t.format;if(r==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)),u=ar(t.theme),d=r==="stage-log"?de():0,c=l=>l==null?"":t.stageLabels?.[l]??l,f=(l,w)=>l.length>w?`${l.slice(0,w-1)}\u2026`:l,p=l=>l.type==="data"||l.type==="error"?f(vt(l.data),120):"",h=l=>{if(r==="stage-log"){let b=(de()-d)/1e9,x=c(l.path).padEnd(9);if(l.type==="data"){let R=p(l);return`[${b.toFixed(3)}s] ${x} \u2190${R?` ${R}`:""}`}if(l.type==="error"){let R=p(l);return`[${b.toFixed(3)}s] ${x} \u2717${R?` ${R}`:""}`}return l.type==="complete"?`[${b.toFixed(3)}s] ${x} \u25A0 complete`:`[${b.toFixed(3)}s] ${x} ${l.type}`}if(r==="json")try{return JSON.stringify(l)}catch{return JSON.stringify({type:l.type,path:l.path,data:"[unserializable]"})}let w=u[l.type]??"",m=l.path?`${u.path}${l.path}${u.reset} `:"",N=l.type==="data"||l.type==="error",v=l.type==="pause"||l.type==="resume",y=N?` ${vt(l.data)}`:v?` ${vt(l.lockId)}`:"",_=l.type==="data"||l.type==="resolved"||l.type==="derived"?l:void 0,T=_?.trigger_dep_name!=null?` <- ${_.trigger_dep_name}`:_?.trigger_dep_index!=null?` <- #${_.trigger_dep_index}`:"",k=l.in_batch?" [batch]":"";return`${m}${w}${l.type.toUpperCase()}${u.reset}${y}${T}${k}`};e.onEvent(l=>{a(l.type)&&s(h(l),l)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){Xe(this._disposers,this.name),this.signal([[U]],{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,...r}=this.describe({detail:"full"}),s={};for(let a of Object.keys(r.nodes).sort()){let{lastMutation:u,guard:d,...c}=r.nodes[a];s[a]=c}let o=[...r.subgraphs].sort(),i={...r,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 Dt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let r=t?.config??Ee,{codec:s,codecVersion:o,payload:i}=Ct(e,r);return s.decode(i,o)}restore(e,t){if(dn(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let r=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(r!==null&&!r.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 u=this.tryResolve(o)?.v;if(u!=null&&u.id===i.v.id&&u.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){dn(e);let r=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new n(e.name);if(r)return r(o),o.restore(e),o;for(let h of[...e.subgraphs].sort((l,w)=>{let m=l.split(L).length,N=w.split(L).length;return m!==N?m-N:l<w?-1:l>w?1:0})){let l=h.split(L),w=o;for(let m of l)w._mounts.has(m)||w.mount(m,new n(m)),w=w._mounts.get(m)}let i=s?Object.entries(s).map(([h,l])=>({re:Ze(h),factory:l})):[],a=h=>{for(let l of i)if(l.re.test(h))return l.factory},u=h=>{let l=h.split(L),w=l.pop();if(w==null||w.length===0)throw new Error(`invalid snapshot path "${h}"`);let m=o;for(let N of l){let v=m._mounts.get(N);if(!v)throw new Error(`unknown mount "${N}" in path "${h}"`);m=v}return[m,w]},d=Object.entries(e.nodes).filter(([h])=>!h.includes(`${L}${te}${L}`)).sort((h,l)=>h[0]<l[0]?-1:h[0]>l[0]?1:0),c=new Map(d),f=new Map,p=!0;for(;c.size>0&&p;){p=!1;for(let[h,l]of[...c.entries()]){let w=l?.deps??[];if(!w.every(T=>f.has(T)))continue;let[m,N]=u(h),v={...l?.meta??{}},y=a(h),_;if(l?.type==="state")_=ae(l.value,{meta:v});else{if(y==null)continue;_=y(N,{path:h,type:l.type,value:l.value,meta:v,deps:w,resolvedDeps:w.map(T=>f.get(T))})}m.add(_,{name:N}),f.set(h,_),c.delete(h),p=!0}}if(c.size>0){let h=[...c.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${h}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let r=e.map(d=>({tier:d,debounceMs:Math.max(0,d.debounceMs??0),compactEvery:Math.max(1,d.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=(d,c)=>{if(d.disposed)return;let f=nr(c.nodes);if(d.lastSnapshot!=null&&f!==""&&f===d.lastFingerprint)return;let p=d.seq+1,h=ne(),m=d.lastSnapshot==null||p%d.compactEvery===0?{name:this.name,mode:"full",snapshot:c,seq:p,timestamp_ns:h,format_version:ve}:{name:this.name,mode:"diff",diff:pn(d.lastSnapshot,c),seq:p,timestamp_ns:h,format_version:ve};if(d.tier.filter&&!d.tier.filter(m))return;let N;try{N=d.tier.save(m)}catch(v){t.onError?.(v,d.tier);return}if(N&&typeof N.then=="function"){let _=(d.savePending??Promise.resolve()).then(()=>N,()=>N).then(()=>{d.disposed||(d.seq=p,d.lastSnapshot=c,d.lastFingerprint=f)},T=>{t.onError?.(T,d.tier)});d.savePending=_.finally(()=>{d.savePending===_&&(d.savePending=void 0)})}else d.seq=p,d.lastSnapshot=c,d.lastFingerprint=f},o=(d,c)=>{try{s(d,c)}catch(f){t.onError?.(f,d.tier)}},i=(d,c)=>{if(!c.some(l=>{let w=this.config.messageTier(l[0]);return w>=3&&w<5}))return;if(t.filter){let l=this.tryResolve(d);if(l==null)return;let w=gt(l,ht("standard"));if(!t.filter(d,w))return}let p,h=()=>(p==null&&(p=this.snapshot()),p);for(let l of r)l.disposed||(l.debounceMs===0?o(l,h()):(l.timer==null&&(l.timer=new qe),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(f=>{let p=this.tryResolve(f);return p==null?()=>{}:p.subscribe(h=>i(f,h))});a=()=>{for(let f of c)f()}}else a=this.observe().subscribe((d,c)=>i(d,c));let u=()=>{a();for(let d of r)d.disposed=!0,d.timer?.cancel();this._storageDisposers.delete(u)};return this._storageDisposers.add(u),{dispose:u}}async _cascadeRestore(e,t){for(let r of e){let s;try{s=await r.load?.()}catch(i){t?.(i,r);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===ve&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,r)}}return!1}static async fromStorage(e,t,r){for(let s of t){let o;try{o=await s.load?.()}catch(u){r?.onError?.(u,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===ve&&i.nodes!=null?i:void 0;if(a!=null)try{return n.fromSnapshot(a,r)}catch(u){r?.onError?.(u,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,r){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(),...r?.actor!=null?{actor:r.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)),r=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return r}static diff(e,t){let r=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(v=>!r.has(v)).sort(),i=[...r].filter(v=>!s.has(v)).sort(),a=[],u=[];for(let v of r){if(!s.has(v))continue;let y=e.nodes[v],_=t.nodes[v],T=y.v,k=_.v;T!=null&&k!=null&&T.id===k.id&&T.version!==k.version&&u.push({path:v,id:T.id,from:T.version,to:k.version});let b=T!=null&&k!=null&&T.id===k.id&&T.version===k.version;for(let x of["type","status","sentinel"]){let R=y[x],A=_[x];R!==A&&a.push({path:v,field:x,from:R,to:A})}if(!b)for(let x of["value","meta"]){let R=y[x],A=_[x];rr(R,A)||a.push({path:v,field:x,from:R,to:A})}}let d=v=>`${v.from} ${v.to}`,c=new Set(e.edges.map(d)),f=new Set(t.edges.map(d)),p=t.edges.filter(v=>!c.has(d(v))),h=e.edges.filter(v=>!f.has(d(v))),l=new Set(e.subgraphs),w=new Set(t.subgraphs),m=[...w].filter(v=>!l.has(v)).sort(),N=[...l].filter(v=>!w.has(v)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:u,edgesAdded:p,edgesRemoved:h,subgraphsAdded:m,subgraphsRemoved:N}}}});var wn=j(()=>{"use strict";hn()});var vr={};kn(vr,{processInstanceKeyOf:()=>gr,processManager:()=>yr,processStateKeyOf:()=>mr});module.exports=En(vr);we();fe();Ge();we();Pe();fe();$e();Ge();fe();Re();$e();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 r=Math.min(e.length,t),s=e.length-r;for(let o=0;o<r;o++)this._buf[o]=e[s+o];this._size=r}}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 r=t;r<e.length;r++)this._rawAppend(e[r]);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 r=0;r<t;r++)this._buf[(this._head+r)%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 r=t===void 0?this._size:Math.min(Math.max(t,0),this._size),s=Math.min(e,this._size);if(s>=r)return[];let o=r-s;if(this._maxSize===void 0)return this._buf.slice(s,r);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 r=Math.min(e.length,t),s=e.length-r;for(let o=0;o<r;o++)this._buf[o]=e[s+o];this._size=r}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 Le(n){return n.subscribe(()=>{})}var fr=64;function gn(n,e={}){let{name:t,maxSize:r,versioning:s,guard:o,backend:i}=e,a=i??new Tt(n,r),u=ae(a.toArray(),{name:t,describeKind:"state",equals:(b,x)=>b===x,...s!=null?{versioning:s}:{},...o!=null?{guard:o}:{}});function d(){let b=a.toArray();be(()=>{u.down([[q]],{internal:!0}),u.down([[$,b]],{internal:!0})})}let c=new Map,f=new Map,p=new Map;function h(b,x){return`${b}:${x===void 0?"END":x}`}function l(b){if(b.size<fr)return;let x=b.keys().next();if(x.done)return;let R=b.get(x.value);R!==void 0&&R.dispose(),b.delete(x.value)}function w(b){let x=a.version;try{return b()}finally{a.version!==x&&d()}}function m(b){if(!Number.isInteger(b)||b<0)throw new RangeError(`tail: n must be a non-negative integer (got ${b})`);let x=c.get(b);if(x!==void 0)return c.delete(b),c.set(b,x),x.node;l(c);let R=ce([u],([O])=>{let C=O;return b===0||C.length===0?[]:C.slice(Math.max(0,C.length-b))},{initial:a.tail(b),describeKind:"derived"}),A=Le(R);return c.set(b,{node:R,dispose:A}),R}function N(b,x){if(!Number.isInteger(b)||b<0)throw new RangeError(`slice: start must be a non-negative integer (got ${b})`);if(x!==void 0&&(!Number.isInteger(x)||x<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${x})`);let R=h(b,x),A=f.get(R);if(A!==void 0)return f.delete(R),f.set(R,A),A.node;l(f);let O=ce([u],([M])=>{let g=M;return x===void 0?g.slice(b):g.slice(b,x)},{initial:a.slice(b,x),describeKind:"derived"}),C=Le(O);return f.set(R,{node:O,dispose:C}),O}function v(b){let x=p.get(b);if(x!==void 0)return x.node;let R=ce([u,b],([O,C])=>{let M=O,g=Math.max(0,Math.trunc(C??0));return M.slice(g)},{initial:[],describeKind:"derived"}),A=Le(R);return p.set(b,{node:R,dispose:A}),R}let y,_;function T(){y===void 0&&(y=ye([u],(b,x,R)=>{let A=b[0],C=A!=null&&A.length>0?A.at(-1):R.prevData[0];if(C==null||C.length===0){x.down([[J]]);return}x.emit(C[C.length-1])},{name:t!=null?`${t}::lastValue`:"lastValue",describeKind:"derived",initial:a.size===0?void 0:a.at(a.size-1)}),_=ce([u],([b])=>b.length>0,{name:t!=null?`${t}::hasLatest`:"hasLatest",describeKind:"derived",initial:a.size>0}),Le(y),Le(_))}let k={entries:u,get size(){return a.size},at(b){return a.at(b)},append(b){w(()=>a.append(b))},appendMany(b){b.length!==0&&w(()=>a.appendMany(b))},clear(){w(()=>a.clear())},trimHead(b){w(()=>a.trimHead(b))},withLatest(){return T(),u},get lastValue(){return T(),y},get hasLatest(){return T(),_},view(b){switch(b.kind){case"tail":return m(b.n);case"slice":return N(b.start,b.stop);case"fromCursor":return v(b.cursor)}},attach(b){let x=b.subscribe(R=>{for(let A of R)A[0]===$&&k.append(A[1])});return()=>x()},attachStorage(b){if(b.length===0)return()=>{};let x=new Map;for(let A of b)x.set(A,a.size);(async()=>{for(let A of b)if(typeof A.loadEntries=="function")try{let O=await Promise.resolve(A.loadEntries());O.entries.length>0&&a.size===0&&(a.restore(O.entries),x.set(A,O.entries.length),d());break}catch{}})();let R=u.subscribe(A=>{for(let O of A){if(O[0]!==$)continue;let C=O[1];for(let M of b){let g=x.get(M)??0;if(C.length<g){try{let D=M.appendEntries(C);D instanceof Promise&&D.catch(()=>{})}catch{}x.set(M,C.length);continue}if(C.length===g)continue;let E=C.slice(g);x.set(M,C.length);try{let D=M.appendEntries(E);D instanceof Promise&&D.catch(()=>{})}catch{}}}});return()=>R()},disposeAllViews(){for(let b of c.values())b.dispose();c.clear();for(let b of f.values())b.dispose();f.clear();for(let b of p.values())b.dispose();p.clear()},dispose(){for(let b of c.values())b.dispose();c.clear();for(let b of f.values())b.dispose();f.clear();for(let b of p.values())b.dispose();p.clear()}};return k}var pr=Rt((n,e)=>{n("observe"),n("signal"),e("write")});function yn(n){let e=gn([],{name:n.name,maxSize:n.retainedLimit??1024,guard:n.guard??pr,...n.versioning!=null?{versioning:n.versioning}:{}});return e.withLatest(),n.graph&&n.graph.add(e.entries,{name:n.name}),e}function vn(n){if(n===null||typeof n!="object"||Object.isFrozen(n))return n;for(let e of Object.keys(n))vn(n[e]);return Object.freeze(n)}var mn=new WeakSet;function hr(n){let e=n.cache,t=typeof e=="number"&&Number.isFinite(e);!t&&e!==void 0&&!mn.has(n)&&(mn.add(n),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 n.down([[q],[$,s]]),s}function bn(n,e,t,r,s,o){let i=e(t,r,s);if(i===void 0)return;let a=o!=null?{...i,handlerVersion:o}:i;n.append(a)}function xt(n,e){let t=e.freeze??!0;return function(...s){let o=t?s.map(vn):s,i=ne(),a,u,d=!1,c;try{be(()=>{e.seq&&(c=hr(e.seq));try{a=n(...o),e.audit&&e.onSuccess&&bn(e.audit,e.onSuccess,o,a,{t_ns:i,seq:c},e.handlerVersion)}catch(f){throw u=f,d=!0,f}})}catch(f){if(d&&e.audit&&e.onFailure){let p=u instanceof Error?u.name:typeof u;bn(e.audit,e.onFailure,o,u,{t_ns:i,seq:c,errorType:p},e.handlerVersion)}throw d?u:f}return a}}function _n(n,e,t=0){let r=ae(t,{name:e,describeKind:"state"});return n.add(r,{name:e}),r}yt();wn();var gr=n=>n.correlationId,mr=n=>n.correlationId;function Tn(n){if(n==null)return Promise.resolve(void 0);let e=We(n);return new Promise((t,r)=>{let s=!1,o,i=()=>{o&&o()};o=e.subscribe(a=>{if(!s)for(let u of a){if(u[0]===$){s=!0,Promise.resolve().then(i),t(u[1]);return}if(u[0]===G){s=!0,Promise.resolve().then(i),r(u[1]);return}if(u[0]===z){s=!0,Promise.resolve().then(i),t(void 0);return}}})})}async function br(n,e,t,r,s){let o;for(let i=0;i<=r;i++){if(i>0){let a=s[Math.min(i-1,s.length-1)]??0;a>0&&await new Promise(u=>setTimeout(u,a))}try{return await Tn(n(e,t))}catch(a){o=a}}return{outcome:"failure",error:o}}function yr(n,e,t){let r=t.retryMax??0,s=t.backoffMs??[0],o=1024,i=new Map,a=new Set,u=new Map,d=`__processManagers__/${e}`,c=new Ae(e);try{n.mount(d,c)}catch(g){let E=g instanceof Error?g.message:String(g);throw new Error(`processManager: name "${e}" is already in use on this CQRS graph (mount path "${d}" collides). Call .dispose() on the prior manager OR pick a different name before re-creating. (${E})`)}let f=yn({name:"instances",retainedLimit:o,graph:c}),p=_n(c,"seq",0),h=xt(()=>{},{audit:f,seq:p,freeze:!0,...t.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{},onSuccess:([g,E,D,I],V,{t_ns:W,seq:Y})=>({correlationId:g,state:E,status:D,startedAt:u.get(g)??W,updatedAt:W,t_ns:W,seq:Y??0,...I!==void 0?{reason:I}:{}})}),l=t.persistence?.stateStorage??[],w=(g,E)=>{if(l.length===0)return;let D=i.get(g);if(D===void 0)return;let I={correlationId:g,state:D,status:E,startedAt:u.get(g)??ne(),updatedAt:ne(),...t.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{}};for(let V of l)try{let W=V.save(g,I);W!=null&&typeof W.then=="function"&&W.catch(()=>{})}catch{}},m=g=>{if(l.length!==0){for(let E of l)if(E.delete)try{let D=E.delete(g);D!=null&&typeof D.then=="function"&&D.catch(()=>{})}catch{}}},N=`_process_${e}_started`;n.event(N),t.persistence?.eventStorage&&n.attachEventStorage(t.persistence.eventStorage);async function v(g,E,D,I){if(a.delete(g),i.delete(g),u.delete(g),t.compensate)try{await Tn(t.compensate(E,D)),h(g,E,"compensated",I),m(g)}catch{h(g,E,"errored",void 0),m(g)}else h(g,E,"errored",void 0),m(g)}async function y(g,E){if(a.has(g)){if(E.outcome==="failure"){let D=i.get(g)??t.initial;await v(g,D,E.error);return}if(E.outcome==="success"){if(i.set(g,E.state),E.emit)for(let D of E.emit)try{n._appendEvent(D.type,D.payload,{correlationId:g,aggregateId:g})}catch{}if(h(g,E.state,"running",void 0),w(g,"running"),t.isTerminal?.(E.state)){a.delete(g),i.delete(g),u.delete(g),h(g,E.state,"terminated",void 0),m(g);return}if(E.schedule){let{afterMs:D,eventType:I}=E.schedule,V,W=Ut(D),Y=X=>{for(let ue of X)if(ue[0]===$){if(V?V():queueMicrotask(()=>V?.()),!a.has(g))return;let se=i.get(g);if(se===void 0)return;let oe=t.steps[I];if(!oe)return;let S={type:I,payload:null,timestampNs:ne(),seq:Number.NaN,correlationId:g,aggregateId:g};T(g,oe,se,S)}};V=W.subscribe(Y)}return}if(E.outcome==="terminate"){if(i.set(g,E.state),E.emit)for(let D of E.emit)try{n._appendEvent(D.type,D.payload,{correlationId:g,aggregateId:g})}catch{}a.delete(g),i.delete(g),u.delete(g),h(g,E.state,"terminated",void 0),m(g)}}}let _=new Map;function T(g,E,D,I){let W=(_.get(g)??Promise.resolve()).then(async()=>{let Y=i.get(g);if(Y===void 0||!a.has(g))return;let X;try{X=await br(E,Y,I,r,s)}catch(ue){await v(g,i.get(g)??t.initial,ue);return}await y(g,X)});_.set(g,W),W.finally(()=>{_.get(g)===W&&_.delete(g)})}let k=!1,b=[];for(let g of t.watching){let E=n.event(g),D=0;D=(E.cache??[]).length;let V=E.subscribe(W=>{for(let Y of W){if(Y[0]!==$)continue;let X=Y[1];if(X.length<=D)continue;let ue=X.slice(D);D=X.length;for(let se of ue){let oe=se.correlationId;if(oe===void 0||!a.has(oe))continue;let S=t.steps[g];if(!S)continue;let F=i.get(oe);F!==void 0&&T(oe,S,F,se)}}});b.push(V)}let x=xt((g,E)=>{n._appendEvent(N,E??null,{correlationId:g,aggregateId:g}),u.set(g,ne()),i.set(g,t.initial),a.add(g)},{audit:f,seq:p,freeze:!0,...t.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{},onSuccess:([g],E,{t_ns:D,seq:I})=>({correlationId:g,state:t.initial,status:"running",startedAt:u.get(g)??D,updatedAt:D,t_ns:D,seq:I??0})});function R(g,E){k||a.has(g)||(x(g,E),w(g,"running"))}function A(g,E){if(k||!a.has(g))return;let D=i.get(g)??t.initial;v(g,D,new Error(`cancelled: ${E??"no reason given"}`),E)}function O(g){return i.get(g)}async function C(){if(k)return 0;let g=l[0];if(g==null||g.list==null||g.load==null)return 0;let E=await g.list(),D=0;for(let I of E){let V=await g.load(I);V!=null&&V.status==="running"&&(i.set(V.correlationId,V.state),a.add(V.correlationId),u.set(V.correlationId,V.startedAt),D+=1)}return D}function M(){if(!k){k=!0;for(let g of b)try{g()}catch{}b.length=0;try{n.remove(d)}catch{}}}return{instances:f,audit:f,start:R,cancel:A,getState:O,restore:C,dispose:M}}0&&(module.exports={processInstanceKeyOf,processManager,processStateKeyOf});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+
17
+ // src/patterns/process/index.ts
18
+ var process_exports = {};
19
+ module.exports = __toCommonJS(process_exports);
20
+ __reExport(process_exports, require("@graphrefly/pure-ts/patterns/process"), module.exports);
21
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/patterns/process/index.ts"],"sourcesContent":["// Phase 13.9.A shim — re-export from pure-TS sibling until\n// @graphrefly/native (napi binding) and per-milestone swap-overs land.\nexport * from \"@graphrefly/pure-ts/patterns/process\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,4BAAc,iDAFd;","names":[]}
@@ -1,10 +1 @@
1
- import '../../index-D0aciIex.cjs';
2
- import '../../reactive-log-DIGdYqQ6.cjs';
3
- import '../../extra/sources.cjs';
4
- import '../../extra/storage-tiers.cjs';
5
- import '../../index-B-_tFaqV.cjs';
6
- export { P as ProcessCompensate, a as ProcessInstance, b as ProcessManagerOpts, c as ProcessManagerResult, d as ProcessSchedule, e as ProcessStateSnapshot, f as ProcessStep, g as ProcessStepResult, p as processInstanceKeyOf, h as processManager, j as processStateKeyOf } from '../../index-CasX6Pfq.cjs';
7
- import '../../node-kK3CvTrR.cjs';
8
- import '../../graph-CWvEUQAq.cjs';
9
- import '../../sugar-DQjFmVqb.cjs';
10
- import '../../extra/storage-core.cjs';
1
+ export * from '@graphrefly/pure-ts/patterns/process';
@@ -1,10 +1 @@
1
- import '../../index-Yq60JP3s.js';
2
- import '../../reactive-log-BKALbfal.js';
3
- import '../../extra/sources.js';
4
- import '../../extra/storage-tiers.js';
5
- import '../../index-CeFiHtAg.js';
6
- export { P as ProcessCompensate, a as ProcessInstance, b as ProcessManagerOpts, c as ProcessManagerResult, d as ProcessSchedule, e as ProcessStateSnapshot, f as ProcessStep, g as ProcessStepResult, p as processInstanceKeyOf, h as processManager, j as processStateKeyOf } from '../../index-p09KSrTN.js';
7
- import '../../node-kK3CvTrR.js';
8
- import '../../graph-D9LFnda9.js';
9
- import '../../sugar-fhLIE7TT.js';
10
- import '../../extra/storage-core.js';
1
+ export * from '@graphrefly/pure-ts/patterns/process';
@@ -1 +1,3 @@
1
- import{a,b,c}from"../../chunk-SVY7VUYU.js";import"../../chunk-W3I423PS.js";import"../../chunk-2T7U5EU6.js";import"../../chunk-3G5U5QNE.js";import"../../chunk-C72GO4IZ.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{a as processInstanceKeyOf,c as processManager,b as processStateKeyOf};
1
+ // src/patterns/process/index.ts
2
+ export * from "@graphrefly/pure-ts/patterns/process";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/patterns/process/index.ts"],"sourcesContent":["// Phase 13.9.A shim — re-export from pure-TS sibling until\n// @graphrefly/native (napi binding) and per-milestone swap-overs land.\nexport * from \"@graphrefly/pure-ts/patterns/process\";\n"],"mappings":";AAEA,cAAc;","names":[]}