@graphrefly/graphrefly 0.29.0 → 0.31.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 (298) hide show
  1. package/dist/{cascading-CcAgRacD.d.cts → cascading-BfQmSmjU.d.cts} +22 -3
  2. package/dist/{cascading-Bp99ckMJ.d.ts → cascading-D3sapjue.d.ts} +22 -3
  3. package/dist/{chunk-JYOUF6UQ.js → chunk-3JRKP4BH.js} +1 -1
  4. package/dist/{chunk-GJR3P6JG.js → chunk-3Q2WXM6X.js} +1 -1
  5. package/dist/chunk-4KAUNEKV.js +3 -0
  6. package/dist/{chunk-SLMYTGTU.js → chunk-4UUDNFYG.js} +1 -1
  7. package/dist/chunk-4VXL3UZK.js +1 -0
  8. package/dist/{chunk-AV3PIDFQ.js → chunk-4ZPO2EL5.js} +1 -1
  9. package/dist/{chunk-VWPRPPKR.js → chunk-5LJAQTSS.js} +1 -1
  10. package/dist/{chunk-W4TSQ6RJ.js → chunk-7AJKUA36.js} +1 -1
  11. package/dist/{chunk-RD52SNH2.js → chunk-7EJTWGKW.js} +1 -1
  12. package/dist/{chunk-GNCBXARM.js → chunk-7EQPXQ7H.js} +1 -1
  13. package/dist/chunk-7QMVU3IX.js +1 -0
  14. package/dist/{chunk-BA5URFYW.js → chunk-A4JT4SAD.js} +1 -1
  15. package/dist/chunk-ASDKRNOJ.js +60 -0
  16. package/dist/{chunk-Y32RJO24.js → chunk-CZVYLXFK.js} +1 -1
  17. package/dist/{chunk-567NWZ3T.js → chunk-DWIAG62L.js} +1 -1
  18. package/dist/{chunk-Y53B6NS4.js → chunk-EBQ6FXKW.js} +1 -1
  19. package/dist/chunk-FTA5TB2A.js +1 -0
  20. package/dist/{chunk-E3AXATVZ.js → chunk-GF5T7PGC.js} +1 -1
  21. package/dist/{chunk-HSIEYSDY.js → chunk-I4U3TPK2.js} +1 -1
  22. package/dist/{chunk-AMG5VBHW.js → chunk-JMGGCSIC.js} +1 -1
  23. package/dist/chunk-JXRZXP3N.js +1 -0
  24. package/dist/{chunk-5Z4HDCO6.js → chunk-K54OKWNY.js} +1 -1
  25. package/dist/{chunk-63FFOHLA.js → chunk-KN4Q5MQO.js} +1 -1
  26. package/dist/chunk-LWGLBCMU.js +1 -0
  27. package/dist/{chunk-TWMEGG45.js → chunk-N2KKISCE.js} +1 -1
  28. package/dist/{chunk-4OFIQ66T.js → chunk-OKQUPJRY.js} +1 -1
  29. package/dist/chunk-PNTBXOQ6.js +5 -0
  30. package/dist/chunk-PSQNYY72.js +7 -0
  31. package/dist/{chunk-22F4K3G7.js → chunk-PZP4MEXK.js} +1 -1
  32. package/dist/{chunk-7TDOES3L.js → chunk-Q2SY7M7K.js} +1 -1
  33. package/dist/{chunk-OL33ZI6R.js → chunk-RWGJQQLT.js} +1 -1
  34. package/dist/chunk-SGS4OJGS.js +1 -0
  35. package/dist/chunk-UMH3HSP7.js +1 -0
  36. package/dist/{chunk-BZP5T4X6.js → chunk-W6FQIFVE.js} +1 -1
  37. package/dist/{chunk-A7IAQQ63.js → chunk-WLPVGXQ6.js} +1 -1
  38. package/dist/chunk-WQ7I7JVU.js +1 -0
  39. package/dist/{chunk-LGSNR4LU.js → chunk-WYJTXYWX.js} +1 -1
  40. package/dist/{chunk-PGMUCUHG.js → chunk-X2VHDT26.js} +1 -1
  41. package/dist/{chunk-PCZ35NXD.js → chunk-XEFAMCEA.js} +1 -1
  42. package/dist/{chunk-AUY2YKCO.js → chunk-XRSHMHEG.js} +1 -1
  43. package/dist/chunk-Y26UN6J5.js +18 -0
  44. package/dist/{chunk-BKPLTBL5.js → chunk-YQJPYEAL.js} +1 -1
  45. package/dist/{chunk-UVJQ35G2.js → chunk-YZ6VYLFD.js} +1 -1
  46. package/dist/{chunk-4JJCCD5S.js → chunk-YZKGGMPT.js} +1 -1
  47. package/dist/chunk-Z3UWIJ3A.js +1 -0
  48. package/dist/{chunk-CSJE2EKV.js → chunk-ZM7C2FUM.js} +1 -1
  49. package/dist/compat/index.cjs +1 -1
  50. package/dist/compat/index.d.cts +14 -14
  51. package/dist/compat/index.d.ts +14 -14
  52. package/dist/compat/index.js +1 -1
  53. package/dist/compat/jotai/index.cjs +1 -1
  54. package/dist/compat/jotai/index.d.cts +2 -2
  55. package/dist/compat/jotai/index.d.ts +2 -2
  56. package/dist/compat/jotai/index.js +1 -1
  57. package/dist/compat/nanostores/index.cjs +1 -1
  58. package/dist/compat/nanostores/index.d.cts +2 -2
  59. package/dist/compat/nanostores/index.d.ts +2 -2
  60. package/dist/compat/nanostores/index.js +1 -1
  61. package/dist/compat/nestjs/index.cjs +5 -5
  62. package/dist/compat/nestjs/index.d.cts +6 -6
  63. package/dist/compat/nestjs/index.d.ts +6 -6
  64. package/dist/compat/nestjs/index.js +1 -1
  65. package/dist/compat/react/index.d.cts +2 -2
  66. package/dist/compat/react/index.d.ts +2 -2
  67. package/dist/compat/solid/index.d.cts +2 -2
  68. package/dist/compat/solid/index.d.ts +2 -2
  69. package/dist/compat/svelte/index.d.cts +2 -2
  70. package/dist/compat/svelte/index.d.ts +2 -2
  71. package/dist/compat/vue/index.d.cts +2 -2
  72. package/dist/compat/vue/index.d.ts +2 -2
  73. package/dist/compat/zustand/index.cjs +1 -1
  74. package/dist/compat/zustand/index.d.cts +4 -4
  75. package/dist/compat/zustand/index.d.ts +4 -4
  76. package/dist/compat/zustand/index.js +1 -1
  77. package/dist/{composite-BL-llbnE.d.ts → composite-BY9hMxN7.d.ts} +2 -2
  78. package/dist/{composite-Dze--DaA.d.cts → composite-CH0S8DFn.d.cts} +2 -2
  79. package/dist/content-addressed-storage-BUiREIuj.d.ts +124 -0
  80. package/dist/content-addressed-storage-DqIWCmZG.d.cts +124 -0
  81. package/dist/core/index.cjs +1 -1
  82. package/dist/core/index.d.cts +4 -4
  83. package/dist/core/index.d.ts +4 -4
  84. package/dist/core/index.js +1 -1
  85. package/dist/extra/browser.cjs +1 -1
  86. package/dist/extra/browser.d.cts +1 -1
  87. package/dist/extra/browser.d.ts +1 -1
  88. package/dist/extra/browser.js +1 -1
  89. package/dist/extra/index.cjs +18 -18
  90. package/dist/extra/index.d.cts +12 -11
  91. package/dist/extra/index.d.ts +12 -11
  92. package/dist/extra/index.js +1 -1
  93. package/dist/extra/node.cjs +2 -2
  94. package/dist/extra/node.d.cts +1 -1
  95. package/dist/extra/node.d.ts +1 -1
  96. package/dist/extra/node.js +1 -1
  97. package/dist/extra/operators.cjs +1 -1
  98. package/dist/extra/operators.d.cts +42 -2
  99. package/dist/extra/operators.d.ts +42 -2
  100. package/dist/extra/operators.js +1 -1
  101. package/dist/extra/reactive.cjs +1 -1
  102. package/dist/extra/reactive.d.cts +3 -3
  103. package/dist/extra/reactive.d.ts +3 -3
  104. package/dist/extra/reactive.js +1 -1
  105. package/dist/extra/sources.cjs +1 -1
  106. package/dist/extra/sources.d.cts +63 -3
  107. package/dist/extra/sources.d.ts +63 -3
  108. package/dist/extra/sources.js +1 -1
  109. package/dist/extra/storage-browser.cjs +1 -1
  110. package/dist/extra/storage-browser.d.cts +1 -1
  111. package/dist/extra/storage-browser.d.ts +1 -1
  112. package/dist/extra/storage-browser.js +1 -1
  113. package/dist/{fallback-BaTS7vVY.d.cts → fallback-Cb3GH1O7.d.cts} +6 -14
  114. package/dist/{fallback-eOm3LNxP.d.ts → fallback-DRjJ_ZM8.d.ts} +6 -14
  115. package/dist/graph/index.cjs +4 -4
  116. package/dist/graph/index.d.cts +5 -5
  117. package/dist/graph/index.d.ts +5 -5
  118. package/dist/graph/index.js +1 -1
  119. package/dist/{graph-DgohqXK-.d.cts → graph-C4Uxwv0T.d.cts} +2 -2
  120. package/dist/{graph-Qjg9gWHI.d.ts → graph-CWeI0aHd.d.ts} +2 -2
  121. package/dist/{index-DX8xS-yB.d.cts → index-9iguV3bF.d.cts} +2 -2
  122. package/dist/{index-BanNUILp.d.cts → index-B-z8WaSd.d.cts} +2 -2
  123. package/dist/{index-C66RJiX8.d.ts → index-B5iVOD7w.d.ts} +2 -2
  124. package/dist/{index-CcWOJ6F0.d.ts → index-BANwzwBV.d.ts} +3 -3
  125. package/dist/{index-CiaVoZGo.d.ts → index-BBINVimG.d.ts} +3 -3
  126. package/dist/{index-B-gqvYel.d.ts → index-BEpRsvhg.d.ts} +4 -4
  127. package/dist/{index-C8RfjffH.d.ts → index-BMe3pCom.d.cts} +3 -3
  128. package/dist/{index-gsT79Xu9.d.ts → index-BX22kvjh.d.ts} +1 -1
  129. package/dist/{index-CA1Cu7Ud.d.ts → index-BXzl1NDD.d.ts} +6 -6
  130. package/dist/{index-BqZ6vB2A.d.ts → index-Bd6oFZqO.d.ts} +230 -122
  131. package/dist/{index-kykKWwV-.d.cts → index-BpFWP7Bq.d.cts} +3 -3
  132. package/dist/{index-iKkyJosF.d.cts → index-Bs3-LC83.d.cts} +3 -3
  133. package/dist/{index-CJ45TW-h.d.ts → index-Bvi5uJxX.d.ts} +1 -1
  134. package/dist/{index-IMAHq-ia.d.ts → index-ByPnK85n.d.ts} +1 -1
  135. package/dist/{index-CABbltIu.d.cts → index-BydMDMf7.d.cts} +1 -1
  136. package/dist/{index-D5XJ2tSx.d.ts → index-C5Ghnp5B.d.ts} +3 -3
  137. package/dist/{index-BiyjsZ0m.d.ts → index-C6NBfXj-.d.ts} +3 -3
  138. package/dist/{index-D9HKAH_-.d.cts → index-C98oJsEs.d.cts} +2 -2
  139. package/dist/{index-CHEBsnYv.d.cts → index-CDK5RsV5.d.cts} +1 -1
  140. package/dist/{index-DJ5oNBc8.d.ts → index-CFW32Dy1.d.ts} +3 -3
  141. package/dist/{index-D80do5jX.d.cts → index-CIXaiYDE.d.cts} +1 -1
  142. package/dist/{index-2BVuRCI4.d.ts → index-CJymKyzT.d.ts} +86 -11
  143. package/dist/{index-H_oxVec5.d.cts → index-CRAkoq-y.d.cts} +1 -1
  144. package/dist/{index-DiZejfCI.d.cts → index-CZChc85Q.d.cts} +230 -122
  145. package/dist/{index-DDy8eeXS.d.ts → index-CcS0t-l2.d.ts} +3 -3
  146. package/dist/{index-B2PRuolf.d.cts → index-CcpEvuPl.d.cts} +2 -2
  147. package/dist/{index-DwjJGKxV.d.ts → index-CfFYyLR8.d.ts} +3 -3
  148. package/dist/{index-A65LZhoM.d.ts → index-CotRMjtJ.d.ts} +2 -2
  149. package/dist/{index-BQaEnxBf.d.ts → index-CrC7urhX.d.ts} +1 -1
  150. package/dist/{index-DuB5aO4-.d.ts → index-CvS9IuTG.d.ts} +2 -2
  151. package/dist/{index-BUi57v_p.d.ts → index-CwhcFzTA.d.ts} +4 -4
  152. package/dist/{index-BUVtw1Ay.d.cts → index-Cy7eFeIX.d.cts} +2 -2
  153. package/dist/{index-C08QPDcV.d.cts → index-D-kHVedZ.d.cts} +3 -3
  154. package/dist/{index-Ct5CWc4E.d.ts → index-D0C_USMR.d.ts} +1 -1
  155. package/dist/{index-y1RllPn4.d.cts → index-D7XxY1Ff.d.cts} +1 -1
  156. package/dist/{index-BJqt9EwW.d.ts → index-D9HrBx2J.d.ts} +2 -2
  157. package/dist/{index-DP0_O3ls.d.cts → index-D9Y_u6BG.d.cts} +3 -3
  158. package/dist/{index-DoWMs-Kk.d.cts → index-DBQUKh59.d.cts} +4 -4
  159. package/dist/{index-dig-r2tQ.d.cts → index-DD7RhHNJ.d.cts} +6 -6
  160. package/dist/{index-U1nir7MX.d.cts → index-DDo-eqQ4.d.cts} +1 -1
  161. package/dist/{index-2NvguqQA.d.ts → index-DGb1awva.d.ts} +4 -4
  162. package/dist/{index-i99Ka8s7.d.cts → index-DR3gf_DG.d.cts} +9 -9
  163. package/dist/{index-DBe_8XW5.d.cts → index-DVNLe3pS.d.cts} +3 -3
  164. package/dist/{index-DknyJ2Fu.d.cts → index-Dm3_D5Ta.d.cts} +4 -4
  165. package/dist/{index-DCeTyFlB.d.ts → index-DnrZghBB.d.ts} +2 -2
  166. package/dist/{index-Byh-xTyp.d.ts → index-Docdiu9a.d.ts} +3 -3
  167. package/dist/{index-BTSkeCZs.d.cts → index-DxMS0cHM.d.ts} +3 -3
  168. package/dist/{index-D38duMCv.d.cts → index-DylQCKEL.d.cts} +3 -3
  169. package/dist/{index-jleeotBT.d.cts → index-FBqTfL_S.d.cts} +1 -1
  170. package/dist/{index-Vg7tORgk.d.ts → index-FrYrV-Vf.d.ts} +2 -2
  171. package/dist/{index-BSfwiy5B.d.ts → index-IZ3l_vQ9.d.ts} +2 -2
  172. package/dist/{index-CX2tFJL1.d.ts → index-Ip3q9T9x.d.ts} +1 -1
  173. package/dist/{index-CI0yDnLp.d.ts → index-RQg6lTrN.d.ts} +9 -9
  174. package/dist/{index-vgcLF5TH.d.cts → index-SSGqF8mI.d.cts} +2 -2
  175. package/dist/{index-CJZKZoo4.d.cts → index-UZO988ox.d.cts} +3 -3
  176. package/dist/{index-BKjT5DiZ.d.cts → index-gJQqJTKx.d.cts} +86 -11
  177. package/dist/{index-BayHDRx6.d.cts → index-iBp74eGU.d.cts} +3 -3
  178. package/dist/{index-BuVidq3D.d.cts → index-lKuLYmHO.d.cts} +2 -2
  179. package/dist/{index-BM8BU4q6.d.ts → index-wIx1Jisk.d.ts} +1 -1
  180. package/dist/{index-B-8FCEua.d.cts → index-yIdWFo2b.d.cts} +4 -4
  181. package/dist/index.cjs +99 -121
  182. package/dist/index.d.cts +47 -46
  183. package/dist/index.d.ts +47 -46
  184. package/dist/index.js +1 -1
  185. package/dist/{meta-CckhhFRd.d.ts → meta-BMwx3ExI.d.ts} +1 -1
  186. package/dist/{meta-CX7YsOzp.d.cts → meta-COtmHLwT.d.cts} +1 -1
  187. package/dist/{node-Dd6wHSib.d.cts → node-BVV7G1bq.d.cts} +24 -0
  188. package/dist/{node-Dd6wHSib.d.ts → node-BVV7G1bq.d.ts} +24 -0
  189. package/dist/{observable-kwzpLvbi.d.cts → observable-BrUAPeH_.d.cts} +1 -1
  190. package/dist/{observable-BZJgo616.d.ts → observable-ITikPXz3.d.ts} +1 -1
  191. package/dist/patterns/ai/browser.cjs +5 -22
  192. package/dist/patterns/ai/browser.d.cts +4 -4
  193. package/dist/patterns/ai/browser.d.ts +4 -4
  194. package/dist/patterns/ai/browser.js +1 -1
  195. package/dist/patterns/ai/index.cjs +27 -44
  196. package/dist/patterns/ai/index.d.cts +17 -15
  197. package/dist/patterns/ai/index.d.ts +17 -15
  198. package/dist/patterns/ai/index.js +1 -1
  199. package/dist/patterns/ai/node.cjs +2 -2
  200. package/dist/patterns/ai/node.d.cts +5 -4
  201. package/dist/patterns/ai/node.d.ts +5 -4
  202. package/dist/patterns/ai/node.js +1 -1
  203. package/dist/patterns/audit/index.cjs +3 -3
  204. package/dist/patterns/audit/index.d.cts +5 -5
  205. package/dist/patterns/audit/index.d.ts +5 -5
  206. package/dist/patterns/audit/index.js +1 -1
  207. package/dist/patterns/cqrs/index.cjs +6 -6
  208. package/dist/patterns/cqrs/index.d.cts +4 -4
  209. package/dist/patterns/cqrs/index.d.ts +4 -4
  210. package/dist/patterns/cqrs/index.js +1 -1
  211. package/dist/patterns/demo-shell/index.cjs +1 -1
  212. package/dist/patterns/demo-shell/index.d.cts +5 -5
  213. package/dist/patterns/demo-shell/index.d.ts +5 -5
  214. package/dist/patterns/demo-shell/index.js +1 -1
  215. package/dist/patterns/domain-templates/index.cjs +4 -4
  216. package/dist/patterns/domain-templates/index.d.cts +4 -4
  217. package/dist/patterns/domain-templates/index.d.ts +4 -4
  218. package/dist/patterns/domain-templates/index.js +1 -1
  219. package/dist/patterns/graphspec/index.cjs +6 -6
  220. package/dist/patterns/graphspec/index.d.cts +5 -5
  221. package/dist/patterns/graphspec/index.d.ts +5 -5
  222. package/dist/patterns/graphspec/index.js +1 -1
  223. package/dist/patterns/guarded-execution/index.cjs +7 -7
  224. package/dist/patterns/guarded-execution/index.d.cts +6 -6
  225. package/dist/patterns/guarded-execution/index.d.ts +6 -6
  226. package/dist/patterns/guarded-execution/index.js +1 -1
  227. package/dist/patterns/harness/index.cjs +11 -11
  228. package/dist/patterns/harness/index.d.cts +9 -9
  229. package/dist/patterns/harness/index.d.ts +9 -9
  230. package/dist/patterns/harness/index.js +1 -1
  231. package/dist/patterns/job-queue/index.cjs +5 -5
  232. package/dist/patterns/job-queue/index.d.cts +4 -4
  233. package/dist/patterns/job-queue/index.d.ts +4 -4
  234. package/dist/patterns/job-queue/index.js +1 -1
  235. package/dist/patterns/lens/index.cjs +5 -5
  236. package/dist/patterns/lens/index.d.cts +6 -6
  237. package/dist/patterns/lens/index.d.ts +6 -6
  238. package/dist/patterns/lens/index.js +1 -1
  239. package/dist/patterns/memory/index.cjs +4 -4
  240. package/dist/patterns/memory/index.d.cts +4 -4
  241. package/dist/patterns/memory/index.d.ts +4 -4
  242. package/dist/patterns/memory/index.js +1 -1
  243. package/dist/patterns/messaging/index.cjs +5 -5
  244. package/dist/patterns/messaging/index.d.cts +4 -4
  245. package/dist/patterns/messaging/index.d.ts +4 -4
  246. package/dist/patterns/messaging/index.js +1 -1
  247. package/dist/patterns/orchestration/index.cjs +1 -1
  248. package/dist/patterns/orchestration/index.d.cts +5 -5
  249. package/dist/patterns/orchestration/index.d.ts +5 -5
  250. package/dist/patterns/orchestration/index.js +1 -1
  251. package/dist/patterns/reactive-layout/index.cjs +1 -1
  252. package/dist/patterns/reactive-layout/index.d.cts +5 -5
  253. package/dist/patterns/reactive-layout/index.d.ts +5 -5
  254. package/dist/patterns/reactive-layout/index.js +1 -1
  255. package/dist/patterns/reduction/index.cjs +5 -5
  256. package/dist/patterns/reduction/index.d.cts +4 -4
  257. package/dist/patterns/reduction/index.d.ts +4 -4
  258. package/dist/patterns/reduction/index.js +1 -1
  259. package/dist/patterns/refine-loop/index.cjs +8 -8
  260. package/dist/patterns/refine-loop/index.d.cts +5 -5
  261. package/dist/patterns/refine-loop/index.d.ts +5 -5
  262. package/dist/patterns/refine-loop/index.js +1 -1
  263. package/dist/patterns/resilient-pipeline/index.cjs +1 -1
  264. package/dist/patterns/resilient-pipeline/index.d.cts +6 -6
  265. package/dist/patterns/resilient-pipeline/index.d.ts +6 -6
  266. package/dist/patterns/resilient-pipeline/index.js +1 -1
  267. package/dist/patterns/surface/index.cjs +7 -7
  268. package/dist/patterns/surface/index.d.cts +6 -6
  269. package/dist/patterns/surface/index.d.ts +6 -6
  270. package/dist/patterns/surface/index.js +1 -1
  271. package/dist/{reactive-layout-PiFwVaWS.d.cts → reactive-layout-5oEn8lHM.d.cts} +2 -2
  272. package/dist/{reactive-layout-BkBwVvwm.d.ts → reactive-layout-BAr6-_o5.d.ts} +2 -2
  273. package/dist/{reactive-log-BiVoSxke.d.cts → reactive-log-5jFeNRmd.d.cts} +1 -1
  274. package/dist/{reactive-log-1QTyx10a.d.ts → reactive-log-BOJDCI5x.d.ts} +1 -1
  275. package/dist/{reactive-map-CwO_COHy.d.cts → reactive-map-CtRaCddO.d.ts} +60 -2
  276. package/dist/{reactive-map-FeuTVAJb.d.ts → reactive-map-IJIfZxoh.d.cts} +60 -2
  277. package/dist/{resilience-CBfYJW5C.d.ts → resilience-CludlzcP.d.ts} +1 -1
  278. package/dist/{resilience-XRUF267O.js → resilience-IVNDYORD.js} +1 -1
  279. package/dist/{resilience-uBz4yvYB.d.cts → resilience-Q6Bt_7y0.d.cts} +1 -1
  280. package/dist/{sugar-CY-MCfZ9.d.ts → sugar-BHbAACDG.d.ts} +1 -1
  281. package/dist/{sugar-DHttV0LX.d.cts → sugar-CqR6DJ7v.d.cts} +1 -1
  282. package/dist/{topology-tree-CVjt2gp7.d.cts → topology-tree-CVREibAc.d.cts} +1 -1
  283. package/dist/{topology-tree-one6oSKY.d.ts → topology-tree-CkjojcB6.d.ts} +1 -1
  284. package/dist/{types-O3GzJY2U.d.cts → types-BgMqbc7N.d.cts} +41 -14
  285. package/dist/{types-u64Ose53.d.ts → types-CdfO2QTt.d.ts} +41 -14
  286. package/package.json +1 -1
  287. package/dist/chunk-22SVXUPB.js +0 -64
  288. package/dist/chunk-2GQREQ6C.js +0 -1
  289. package/dist/chunk-4V4C7K56.js +0 -1
  290. package/dist/chunk-5JDE5JHE.js +0 -1
  291. package/dist/chunk-7JDLFI6N.js +0 -1
  292. package/dist/chunk-ISCENNXS.js +0 -1
  293. package/dist/chunk-KASHOCF5.js +0 -1
  294. package/dist/chunk-LVGBLZM2.js +0 -1
  295. package/dist/chunk-MGKAO4EK.js +0 -7
  296. package/dist/chunk-NSG4C6BF.js +0 -23
  297. package/dist/chunk-VGTCGNRX.js +0 -18
  298. package/dist/chunk-WM7H7WTY.js +0 -3
@@ -1 +1 @@
1
- "use strict";var _e=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var Je=(n,e)=>{for(var t in e)_e(n,t,{get:e[t],enumerable:!0})},Xe=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of qe(e))!Ke.call(n,r)&&r!==t&&_e(n,r,{get:()=>e[r],enumerable:!(s=Ye(e,r))||s.enumerable});return n};var Ze=n=>Xe(_e({},"__esModule",{value:!0}),n);var ut={};Je(ut,{COMPLETE:()=>A,COMPLETE_MSG:()=>me,COMPLETE_ONLY_BATCH:()=>le,DATA:()=>_,DEFAULT_ACTOR:()=>Ne,DIRTY:()=>w,DIRTY_MSG:()=>S,DIRTY_ONLY_BATCH:()=>Z,ERROR:()=>p,GraphReFlyConfig:()=>W,GuardDenied:()=>F,INVALIDATE:()=>T,INVALIDATE_MSG:()=>ye,INVALIDATE_ONLY_BATCH:()=>de,NodeImpl:()=>H,PAUSE:()=>N,RESOLVED:()=>x,RESOLVED_MSG:()=>J,RESOLVED_ONLY_BATCH:()=>ae,RESUME:()=>I,START:()=>C,START_MSG:()=>X,TEARDOWN:()=>b,TEARDOWN_MSG:()=>be,TEARDOWN_ONLY_BATCH:()=>Q,accessHintForGuard:()=>st,advanceVersion:()=>ue,autoTrackNode:()=>Be,batch:()=>Me,configure:()=>He,createVersioning:()=>te,defaultConfig:()=>G,defaultHash:()=>ee,derived:()=>Te,downWithBatch:()=>U,dynamicNode:()=>We,effect:()=>Ue,isBatching:()=>ie,isV1:()=>Re,monotonicNs:()=>ke,node:()=>L,normalizeActor:()=>Y,pipe:()=>je,policy:()=>De,policyFromRules:()=>tt,producer:()=>Pe,registerBuiltins:()=>ce,resolveDescribeFields:()=>Le,state:()=>Ve,wallClockNs:()=>oe});module.exports=Ze(ut);var Ne={type:"system",id:""};function Y(n){if(n==null)return Ne;let{type:e,id:t,...s}=n;return{type:e??"system",id:t??"",...s}}var V=0,q=!1,O=[],R=[],P=[],K=[];function ie(){return V>0||q}function Ae(){return V>0}function Ee(n){V>0?K.push(n):n()}function Me(n){V+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(V-=1,V===0)if(e){if(!q){let t=K.splice(0);for(let s of t)try{s()}catch{}O.length=0,R.length=0,P.length=0}}else Qe()}}function Qe(){let n=!q;n&&(q=!0);let e=[],t=0;try{for(;O.length>0||R.length>0||P.length>0||n&&K.length>0;){if(n&&K.length>0){let o=K.splice(0);for(let a of o)try{a()}catch(i){e.push(i)}continue}if(t+=1,t>1e3)throw O.length=0,R.length=0,P.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let r=(O.length>0?O:R.length>0?R:P).splice(0);for(let o of r)try{o()}catch(a){e.push(a)}}}finally{n&&(q=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!ie()){n(e);return}(l>=5?P:l===4?R:O).push(()=>n(e));return}let s=e.length,r=s,o=s,a=s,i=0;for(;i<s&&t(e[i][0])<3;)i++;for(r=i;i<s&&t(e[i][0])===3;)i++;for(o=i;i<s&&t(e[i][0])===4;)i++;a=i;let d=ie();if(r>0){let l=e.slice(0,r);n(l)}if(o>r){let l=e.slice(r,o);d?O.push(()=>n(l)):n(l)}if(a>o){let l=e.slice(o,a);d?R.push(()=>n(l)):n(l)}if(s>a){let l=e.slice(a,s);d?P.push(()=>n(l)):n(l)}}function ke(){return Math.trunc(performance.now()*1e6)}function oe(){return Date.now()*1e6}var C=Symbol.for("graphrefly/START"),_=Symbol.for("graphrefly/DATA"),w=Symbol.for("graphrefly/DIRTY"),x=Symbol.for("graphrefly/RESOLVED"),T=Symbol.for("graphrefly/INVALIDATE"),N=Symbol.for("graphrefly/PAUSE"),I=Symbol.for("graphrefly/RESUME"),b=Symbol.for("graphrefly/TEARDOWN"),A=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),S=Object.freeze([w]),J=Object.freeze([x]),ye=Object.freeze([T]),X=Object.freeze([C]),me=Object.freeze([A]),be=Object.freeze([b]),Z=Object.freeze([S]),ae=Object.freeze([J]),de=Object.freeze([ye]),le=Object.freeze([me]),Q=Object.freeze([be]);var W=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_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 s=this._messageTypes.get(t);return s!=null?s.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}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 ce(n){n.registerMessageType(C,{tier:0,wireCrossing:!1}),n.registerMessageType(w,{tier:1,wireCrossing:!1}),n.registerMessageType(T,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(N,{tier:2,wireCrossing:!1}),n.registerMessageType(I,{tier:2,wireCrossing:!1}),n.registerMessageType(_,{tier:3,wireCrossing:!0}),n.registerMessageType(x,{tier:3,wireCrossing:!0}),n.registerMessageType(A,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(b,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var F=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}};function Se(n){return Array.isArray(n)?[...n]:[n]}function et(n,e){return n.has(e)||n.has("*")}function De(n){let e=[];return n((r,o)=>{e.push({kind:"allow",actions:new Set(Se(r)),where:o?.where??(()=>!0)})},(r,o)=>{e.push({kind:"deny",actions:new Set(Se(r)),where:o?.where??(()=>!0)})}),(r,o)=>{let a=!1,i=!1;for(let d of e)et(d.actions,o)&&d.where(r)&&(d.kind==="deny"?a=!0:i=!0);return a?!1:i}}function tt(n){return De((e,t)=>{for(let s of n){let r=s.actorType==null?null:new Set(Array.isArray(s.actorType)?s.actorType:[s.actorType]),o=s.actorId==null?null:new Set(Array.isArray(s.actorId)?s.actorId:[s.actorId]),a=Object.entries(s.claims??{}),i=d=>{if(r!==null&&!r.has(String(d.type))||o!==null&&!o.has(String(d.id??"")))return!1;for(let[l,c]of a)if(d[l]!==c)return!1;return!0};s.effect==="deny"?t(s.action,{where:i}):e(s.action,{where:i})}})}var nt=["human","llm","wallet","system"];function st(n){let e=nt.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 rt={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)}};function Oe(n){n.registerCodec(rt)}function ve(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(ve);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=ve(n[t]);return e}return null}var it=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]),ot=new TextEncoder;function at(n){let e=ot.encode(n),t=e.length,s=t*8,r=t+9+63&-64,o=new Uint8Array(r);o.set(e),o[t]=128;let a=new DataView(o.buffer);a.setUint32(r-4,s>>>0,!1),a.setUint32(r-8,Math.floor(s/4294967296)>>>0,!1);let i=1779033703,d=3144134277,l=1013904242,c=2773480762,u=1359893119,g=2600822924,f=528734635,v=1541459225,D=new Uint32Array(64),m=(M,y)=>M>>>y|M<<32-y;for(let M=0;M<r;M+=64){for(let h=0;h<16;h++)D[h]=a.getUint32(M+h*4,!1);for(let h=16;h<64;h++){let z=D[h-15],$=D[h-2],re=m(z,7)^m(z,18)^z>>>3,ge=m($,17)^m($,19)^$>>>10;D[h]=D[h-16]+re+D[h-7]+ge>>>0}let y=i,B=d,j=l,he=c,k=u,ne=g,se=f,pe=v;for(let h=0;h<64;h++){let z=m(k,6)^m(k,11)^m(k,25),$=k&ne^~k&se,re=pe+z+$+it[h]+D[h]>>>0,ge=m(y,2)^m(y,13)^m(y,22),ze=y&B^y&j^B&j,$e=ge+ze>>>0;pe=se,se=ne,ne=k,k=he+re>>>0,he=j,j=B,B=y,y=re+$e>>>0}i=i+y>>>0,d=d+B>>>0,l=l+j>>>0,c=c+he>>>0,u=u+k>>>0,g=g+ne>>>0,f=f+se>>>0,v=v+pe>>>0}let E=M=>M.toString(16).padStart(8,"0");return E(i)+E(d)+E(l)+E(c)+E(u)+E(g)+E(f)+E(v)}function ee(n){let e=ve(n??null),t=JSON.stringify(e);return at(t).slice(0,16)}function dt(){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 te(n,e,t){let s=t?.id??dt();if(n===0)return{id:s,version:0};let o=(t?.hash??ee)(e);return{id:s,version:0,cid:o,prev:null}}function ue(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}function Re(n){return"cid"in n}var Ce=()=>{},Ie=100;function Fe(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function we(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function fe(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var lt=(n,e,t,s)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},ct=(n,e,t,s)=>{let r=n;if(r._status==="completed"||r._status==="errored")return;let o=r._cached,a=o===void 0?[X]:[X,[_,o]];r._status==="dirty"&&a.push(S),U(e,a,r._config.tierOf)},G=new W({onMessage:lt,onSubscribe:ct});ce(G);Oe(G);function He(n){if(G._isFrozen())throw new Error("configure() called after a node was created \u2014 the default GraphReFlyConfig is frozen. Call configure(...) at application startup, before any node factories run.");n(G)}var H=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,s){this._config=s.config??G,this._config.onMessage,this._optsName=s.name,this._describeKind=s.describeKind,this._equals=s.equals??Object.is,this._resubscribable=s.resubscribable??!1,this._resetOnTeardown=s.resetOnTeardown??!1,this._autoComplete=s.completeWhenDepsComplete??!0,this._autoError=s.errorWhenDepsError??!0,this._pausable=s.pausable??!0,this._guard=s.guard,this._fn=t,this._partial=s.partial??!1,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??ee;let r=s.versioning??this._config.defaultVersioning;this._versioningLevel=r,this._versioning=r!=null?te(r,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Fe);let o={};for(let[i,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),o[i]=new n([],void 0,l)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let a=this;this._actions={emit(i){a._emit([[_,i]])},down(i){a._emit(fe(i))},up(i){a._emitUp(fe(i))}},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 s=this._versioningLevel;if(s!=null&&e<=s)return;let r=t?.hash??this._hashFn;r!==this._hashFn&&(this._hashFn=r);let o=this._cached===void 0?void 0:this._cached,a=this._versioning,i=a?.id??t?.id,d=a?.version??0,l=te(e,o,{id:i,hash:r});l.version=d,this._versioning=l,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=Y(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!t&&!s)return;let r=Y(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(r,o))throw new F({actor:r,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(r,o))throw new F({actor:r,action:o,nodeName:this.name})}this._lastMutation={actor:r,timestamp_ns:oe()}}down(e,t){let s=fe(e);s.length!==0&&(this._checkGuard(t),this._emit(s))}emit(e,t){this._checkGuard(t),this._emit([[_,e]])}up(e,t){if(this._deps.length===0)return;let s=fe(e);if(s.length===0)return;this._checkGuard(t);let r=t??{internal:!0};this._validateUpTiers(s);for(let o of this._deps)o.node.up?.(s,r)}_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 s of e){let r=t(s[0]);if(r===3||r===4)throw new Error(`Node "${this.name}": tier-${r} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=Y(t);if(!this._guard(d,"observe"))throw new F({actor:d,action:"observe",nodeName:this.name})}let r=this._isTerminal&&this._resubscribable;if(r){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)we(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:r},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!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 s=0;s<e;s++){let r=s,o=this._deps[s];o.unsub=Ce,o.unsub=o.node.subscribe(a=>{if(o.unsub===null)return;let i=this._config.tierOf,d=!1;for(let l of a)i(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:r},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(s){this._deps[t].unsub=null;for(let r=0;r<t;r++){let o=this._deps[r];if(o.unsub!=null){let a=o.unsub;o.unsub=null;try{a()}catch{}we(o)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let r=0;r<this._deps.length;r++)if(this._deps[r].node===e)return r;let t=this._deps.length,s=Fe(e);if(this._deps.push(s),this._sinks==null)return t;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),s.unsub=Ce;try{s.unsub=e.subscribe(r=>{if(s.unsub===null)return;let o=this._config.tierOf,a=!1;for(let i of r)o(i[0])>=3&&(a=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(r){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,r}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(s){this._emit([[p,this._wrapFnError("cleanup threw",s)]])}else if(t!=null&&typeof t=="object"){let s=t.deactivate;if(typeof s=="function")try{s()}catch(r){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",r)]])}}for(let s of this._deps){if(s.unsub!=null){let r=s.unsub;s.unsub=null;try{r()}catch{}}we(s)}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 s=this._deps[e],r=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(o)}if(r!==C){if(r===w){this._depDirtied(s);return}if(r===T){this._depInvalidated(s),this._emit(de);return}if(r===N||r===I){this._emit([t]);return}if(r===b){this._emit(Q);return}if(r===_)this._depSettledAsData(s,t[1]);else if(r===x)this._depSettledAsResolved(s);else if(r===A)this._depSettledAsTerminal(s,!0);else if(r===p)this._depSettledAsTerminal(s,t[1]);else{this._emit([t]);return}if(!this._fn){(r===_||r===x)&&this._emit([t]),(r===A||r===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_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(ae),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(le)}_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(a){this._emit([[p,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(i){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",i)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),s=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let i=t[a];i!=null&&i.length>0&&(this._deps[a].prevData=i[i.length-1])}let r=this._deps.map(a=>a.terminal),o={prevData:s,terminalDeps:r,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:s};for(let i of this._inspectorHooks)i(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,o);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let i=a;(typeof i.beforeRun=="function"||typeof i.deactivate=="function"||typeof i.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[p,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ie?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ie} \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 s=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[S,e[0]]:e;let s=!0,r=!1,o=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(s=!1),l===3&&(r=!0),d[0]===w&&(o=!0),a=l}let i=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),i=d.map(l=>l.m)}if(r&&!o&&this._status!=="dirty"){let d=0;for(;d<i.length&&t(i[d][0])===0;)d++;return d===0?[S,...i]:[...i.slice(0,d),S,...i.slice(d)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let d=e[i];if(d[0]===p&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let i=e.filter(d=>d[0]===b||d[0]===T);if(i.length===0)return;t=i}t=this._frameBatch(t);let r=null;for(let i=0;i<t.length;i++){let d=t[i],l=d[0];if(l!==N&&l!==I){r?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===N?"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 u=d[1];if(l===N)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(u),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(u))c=!1;else if(this._pauseLocks.delete(u),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let g=this._pauseBuffer;this._pauseBuffer=[],this._emit(g)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?r?.push(d):r==null&&(r=t.slice(0,i))}if(r!=null){if(r.length===0)return;t=r}if(this._hasMeta&&t.some(i=>i[0]===b))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(Q)}catch{}let{finalMessages:o,equalsError:a}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,d=[];for(let l of o)i(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);a!=null&&this._emit([[p,a]])}_updateState(e){let t=this._config.tierOf,s,r,o=-1,a=0;for(let c of e)t(c[0])===3&&a++;let i=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===_){d=c;break}}for(let c=0;c<e.length;c++){let u=e[c],g=u[0];if(g===_){if(u.length>=2){let f=!1;if(i&&this._cached!==void 0)try{f=this._equals(this._cached,u[1])}catch(v){r=this._wrapFnError("equals threw",v),o=c;break}if(f){s==null&&(s=e.slice(0,c)),s.push(J),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(d<0||c===d)&&ue(this._versioning,u[1],this._hashFn)}this._status="settled",s?.push(u)}else if(s?.push(u),g===w)this._status="dirty";else if(g===x)this._status="resolved";else if(g===A)this._status="completed";else if(g===p)this._status="errored";else if(g===T){this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let v=f.invalidate;if(typeof v=="function")try{v()}catch{}}}else g===b&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=o>=0?s??e.slice(0,o):s??e;return r!=null?{finalMessages:l,equalsError:r}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let s of t)s(e)};_dispatchOrAccumulate(e){if(Ae()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ee(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(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);U(this._deliverToSinks,t,this._config.tierOf)}},Ge=n=>Array.isArray(n),xe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function L(n,e,t){let s=Ge(n)?n:[],r=typeof n=="function"?n:typeof e=="function"?e:void 0,o={};return Ge(n)?o=(xe(e)?e:t)??{}:xe(n)?o=n:o=(xe(e)?e:t)??{},new H(s,r,o)}function Le(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;default:return new Set(["type","deps"])}}function Ve(n,e){return L([],{...e,initial:n})}function Pe(n,e){return L((s,r,o)=>n(r,o)??void 0,{describeKind:"producer",...e})}function Te(n,e,t){return L(n,(r,o,a)=>{let i=r.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);o.emit(e(i,a))},{describeKind:"derived",...t})}function Ue(n,e,t){return L(n,(r,o,a)=>{let i=r.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);return e(i,o,a)??void 0},{describeKind:"effect",...t})}function We(n,e,t){let s=new Map;return n.forEach((r,o)=>{s.set(r,o)}),Te(n,(r,o)=>e(i=>{let d=s.get(i);if(d==null)throw new Error(`dynamicNode: untracked dep "${i.name??"<unnamed>"}"`);return r[d]},o),t)}function Be(n,e){let t,s=new Map,r=(o,a,i)=>{let d=!1,l=c=>{let u=s.get(c);if(u!==void 0){if(u<o.length){let f=o[u];return f!=null&&f.length>0?f.at(-1):i.prevData[u]}return c.cache}d=!0;let g=t._addDep(c);return s.set(c,g),c.cache};try{let c=n(l,i);d||(a.emit(c),i.store.__autoTrackLastDiscoveryError!=null&&delete i.store.__autoTrackLastDiscoveryError)}catch(c){if(!d)throw c;i.store.__autoTrackLastDiscoveryError=c}};return t=new H([],r,{describeKind:"derived",...e}),t}function je(n,...e){let t=n;for(let s of e)t=s(t);return t}0&&(module.exports={COMPLETE,COMPLETE_MSG,COMPLETE_ONLY_BATCH,DATA,DEFAULT_ACTOR,DIRTY,DIRTY_MSG,DIRTY_ONLY_BATCH,ERROR,GraphReFlyConfig,GuardDenied,INVALIDATE,INVALIDATE_MSG,INVALIDATE_ONLY_BATCH,NodeImpl,PAUSE,RESOLVED,RESOLVED_MSG,RESOLVED_ONLY_BATCH,RESUME,START,START_MSG,TEARDOWN,TEARDOWN_MSG,TEARDOWN_ONLY_BATCH,accessHintForGuard,advanceVersion,autoTrackNode,batch,configure,createVersioning,defaultConfig,defaultHash,derived,downWithBatch,dynamicNode,effect,isBatching,isV1,monotonicNs,node,normalizeActor,pipe,policy,policyFromRules,producer,registerBuiltins,resolveDescribeFields,state,wallClockNs});
1
+ "use strict";var _e=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var Je=(n,e)=>{for(var t in e)_e(n,t,{get:e[t],enumerable:!0})},Xe=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of qe(e))!Ke.call(n,r)&&r!==t&&_e(n,r,{get:()=>e[r],enumerable:!(s=Ye(e,r))||s.enumerable});return n};var Ze=n=>Xe(_e({},"__esModule",{value:!0}),n);var ut={};Je(ut,{COMPLETE:()=>A,COMPLETE_MSG:()=>me,COMPLETE_ONLY_BATCH:()=>le,DATA:()=>_,DEFAULT_ACTOR:()=>Ne,DIRTY:()=>w,DIRTY_MSG:()=>S,DIRTY_ONLY_BATCH:()=>Z,ERROR:()=>p,GraphReFlyConfig:()=>W,GuardDenied:()=>F,INVALIDATE:()=>T,INVALIDATE_MSG:()=>ye,INVALIDATE_ONLY_BATCH:()=>de,NodeImpl:()=>H,PAUSE:()=>N,RESOLVED:()=>x,RESOLVED_MSG:()=>J,RESOLVED_ONLY_BATCH:()=>ae,RESUME:()=>I,START:()=>C,START_MSG:()=>X,TEARDOWN:()=>b,TEARDOWN_MSG:()=>be,TEARDOWN_ONLY_BATCH:()=>Q,accessHintForGuard:()=>st,advanceVersion:()=>ue,autoTrackNode:()=>Be,batch:()=>Me,configure:()=>He,createVersioning:()=>te,defaultConfig:()=>G,defaultHash:()=>ee,derived:()=>Te,downWithBatch:()=>U,dynamicNode:()=>We,effect:()=>Ue,isBatching:()=>ie,isV1:()=>Re,monotonicNs:()=>ke,node:()=>L,normalizeActor:()=>Y,pipe:()=>je,policy:()=>De,policyFromRules:()=>tt,producer:()=>Pe,registerBuiltins:()=>ce,resolveDescribeFields:()=>Le,state:()=>Ve,wallClockNs:()=>oe});module.exports=Ze(ut);var Ne={type:"system",id:""};function Y(n){if(n==null)return Ne;let{type:e,id:t,...s}=n;return{type:e??"system",id:t??"",...s}}var V=0,q=!1,O=[],R=[],P=[],K=[];function ie(){return V>0||q}function Ae(){return V>0}function Ee(n){V>0?K.push(n):n()}function Me(n){V+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(V-=1,V===0)if(e){if(!q){let t=K.splice(0);for(let s of t)try{s()}catch{}O.length=0,R.length=0,P.length=0}}else Qe()}}function Qe(){let n=!q;n&&(q=!0);let e=[],t=0;try{for(;O.length>0||R.length>0||P.length>0||n&&K.length>0;){if(n&&K.length>0){let o=K.splice(0);for(let a of o)try{a()}catch(i){e.push(i)}continue}if(t+=1,t>1e3)throw O.length=0,R.length=0,P.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let r=(O.length>0?O:R.length>0?R:P).splice(0);for(let o of r)try{o()}catch(a){e.push(a)}}}finally{n&&(q=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!ie()){n(e);return}(l>=5?P:l===4?R:O).push(()=>n(e));return}let s=e.length,r=s,o=s,a=s,i=0;for(;i<s&&t(e[i][0])<3;)i++;for(r=i;i<s&&t(e[i][0])===3;)i++;for(o=i;i<s&&t(e[i][0])===4;)i++;a=i;let d=ie();if(r>0){let l=e.slice(0,r);n(l)}if(o>r){let l=e.slice(r,o);d?O.push(()=>n(l)):n(l)}if(a>o){let l=e.slice(o,a);d?R.push(()=>n(l)):n(l)}if(s>a){let l=e.slice(a,s);d?P.push(()=>n(l)):n(l)}}function ke(){return Math.trunc(performance.now()*1e6)}function oe(){return Date.now()*1e6}var C=Symbol.for("graphrefly/START"),_=Symbol.for("graphrefly/DATA"),w=Symbol.for("graphrefly/DIRTY"),x=Symbol.for("graphrefly/RESOLVED"),T=Symbol.for("graphrefly/INVALIDATE"),N=Symbol.for("graphrefly/PAUSE"),I=Symbol.for("graphrefly/RESUME"),b=Symbol.for("graphrefly/TEARDOWN"),A=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),S=Object.freeze([w]),J=Object.freeze([x]),ye=Object.freeze([T]),X=Object.freeze([C]),me=Object.freeze([A]),be=Object.freeze([b]),Z=Object.freeze([S]),ae=Object.freeze([J]),de=Object.freeze([ye]),le=Object.freeze([me]),Q=Object.freeze([be]);var W=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_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 s=this._messageTypes.get(t);return s!=null?s.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}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 ce(n){n.registerMessageType(C,{tier:0,wireCrossing:!1}),n.registerMessageType(w,{tier:1,wireCrossing:!1}),n.registerMessageType(T,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(N,{tier:2,wireCrossing:!1}),n.registerMessageType(I,{tier:2,wireCrossing:!1}),n.registerMessageType(_,{tier:3,wireCrossing:!0}),n.registerMessageType(x,{tier:3,wireCrossing:!0}),n.registerMessageType(A,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(b,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var F=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}};function Se(n){return Array.isArray(n)?[...n]:[n]}function et(n,e){return n.has(e)||n.has("*")}function De(n){let e=[];return n((r,o)=>{e.push({kind:"allow",actions:new Set(Se(r)),where:o?.where??(()=>!0)})},(r,o)=>{e.push({kind:"deny",actions:new Set(Se(r)),where:o?.where??(()=>!0)})}),(r,o)=>{let a=!1,i=!1;for(let d of e)et(d.actions,o)&&d.where(r)&&(d.kind==="deny"?a=!0:i=!0);return a?!1:i}}function tt(n){return De((e,t)=>{for(let s of n){let r=s.actorType==null?null:new Set(Array.isArray(s.actorType)?s.actorType:[s.actorType]),o=s.actorId==null?null:new Set(Array.isArray(s.actorId)?s.actorId:[s.actorId]),a=Object.entries(s.claims??{}),i=d=>{if(r!==null&&!r.has(String(d.type))||o!==null&&!o.has(String(d.id??"")))return!1;for(let[l,c]of a)if(d[l]!==c)return!1;return!0};s.effect==="deny"?t(s.action,{where:i}):e(s.action,{where:i})}})}var nt=["human","llm","wallet","system"];function st(n){let e=nt.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 rt={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)}};function Oe(n){n.registerCodec(rt)}function ve(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(ve);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=ve(n[t]);return e}return null}var it=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]),ot=new TextEncoder;function at(n){let e=ot.encode(n),t=e.length,s=t*8,r=t+9+63&-64,o=new Uint8Array(r);o.set(e),o[t]=128;let a=new DataView(o.buffer);a.setUint32(r-4,s>>>0,!1),a.setUint32(r-8,Math.floor(s/4294967296)>>>0,!1);let i=1779033703,d=3144134277,l=1013904242,c=2773480762,u=1359893119,g=2600822924,f=528734635,v=1541459225,D=new Uint32Array(64),m=(M,y)=>M>>>y|M<<32-y;for(let M=0;M<r;M+=64){for(let h=0;h<16;h++)D[h]=a.getUint32(M+h*4,!1);for(let h=16;h<64;h++){let z=D[h-15],$=D[h-2],re=m(z,7)^m(z,18)^z>>>3,ge=m($,17)^m($,19)^$>>>10;D[h]=D[h-16]+re+D[h-7]+ge>>>0}let y=i,B=d,j=l,he=c,k=u,ne=g,se=f,pe=v;for(let h=0;h<64;h++){let z=m(k,6)^m(k,11)^m(k,25),$=k&ne^~k&se,re=pe+z+$+it[h]+D[h]>>>0,ge=m(y,2)^m(y,13)^m(y,22),ze=y&B^y&j^B&j,$e=ge+ze>>>0;pe=se,se=ne,ne=k,k=he+re>>>0,he=j,j=B,B=y,y=re+$e>>>0}i=i+y>>>0,d=d+B>>>0,l=l+j>>>0,c=c+he>>>0,u=u+k>>>0,g=g+ne>>>0,f=f+se>>>0,v=v+pe>>>0}let E=M=>M.toString(16).padStart(8,"0");return E(i)+E(d)+E(l)+E(c)+E(u)+E(g)+E(f)+E(v)}function ee(n){let e=ve(n??null),t=JSON.stringify(e);return at(t).slice(0,16)}function dt(){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 te(n,e,t){let s=t?.id??dt();if(n===0)return{id:s,version:0};let o=(t?.hash??ee)(e);return{id:s,version:0,cid:o,prev:null}}function ue(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}function Re(n){return"cid"in n}var Ce=()=>{},Ie=100;function Fe(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function we(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function fe(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var lt=(n,e,t,s)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},ct=(n,e,t,s)=>{let r=n;if(r._status==="completed"||r._status==="errored")return;let o=r._cached,a=o===void 0?[X]:[X,[_,o]];r._status==="dirty"&&a.push(S),U(e,a,r._config.tierOf)},G=new W({onMessage:lt,onSubscribe:ct});ce(G);Oe(G);function He(n){if(G._isFrozen())throw new Error("configure() called after a node was created \u2014 the default GraphReFlyConfig is frozen. Call configure(...) at application startup, before any node factories run.");n(G)}var H=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,s){this._config=s.config??G,this._config.onMessage,this._optsName=s.name,this._describeKind=s.describeKind,this._equals=s.equals??Object.is,this._resubscribable=s.resubscribable??!1,this._resetOnTeardown=s.resetOnTeardown??!1,this._autoComplete=s.completeWhenDepsComplete??!0,this._autoError=s.errorWhenDepsError??!0,this._pausable=s.pausable??!0,this._guard=s.guard,this._fn=t,this._partial=s.partial??!1,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??ee;let r=s.versioning??this._config.defaultVersioning;this._versioningLevel=r,this._versioning=r!=null?te(r,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Fe);let o={};for(let[i,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),o[i]=new n([],void 0,l)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let a=this;this._actions={emit(i){a._emit([[_,i]])},down(i){a._emit(fe(i))},up(i){a._emitUp(fe(i))}},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 s=this._versioningLevel;if(s!=null&&e<=s)return;let r=t?.hash??this._hashFn;r!==this._hashFn&&(this._hashFn=r);let o=this._cached===void 0?void 0:this._cached,a=this._versioning,i=a?.id??t?.id,d=a?.version??0,l=te(e,o,{id:i,hash:r});l.version=d,this._versioning=l,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=Y(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!t&&!s)return;let r=Y(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(r,o))throw new F({actor:r,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(r,o))throw new F({actor:r,action:o,nodeName:this.name})}this._lastMutation={actor:r,timestamp_ns:oe()}}down(e,t){let s=fe(e);s.length!==0&&(this._checkGuard(t),this._emit(s))}emit(e,t){this._checkGuard(t),this._emit([[_,e]])}up(e,t){if(this._deps.length===0)return;let s=fe(e);if(s.length===0)return;this._checkGuard(t);let r=t??{internal:!0};this._validateUpTiers(s);for(let o of this._deps)o.node.up?.(s,r)}_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 s of e){let r=t(s[0]);if(r===3||r===4)throw new Error(`Node "${this.name}": tier-${r} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=Y(t);if(!this._guard(d,"observe"))throw new F({actor:d,action:"observe",nodeName:this.name})}let r=this._isTerminal&&this._resubscribable;if(r){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)we(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:r},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!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 s=0;s<e;s++){let r=s,o=this._deps[s];o.unsub=Ce,o.unsub=o.node.subscribe(a=>{if(o.unsub===null)return;let i=this._config.tierOf,d=!1;for(let l of a)i(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:r},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(s){this._deps[t].unsub=null;for(let r=0;r<t;r++){let o=this._deps[r];if(o.unsub!=null){let a=o.unsub;o.unsub=null;try{a()}catch{}we(o)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let r=0;r<this._deps.length;r++)if(this._deps[r].node===e)return r;let t=this._deps.length,s=Fe(e);if(this._deps.push(s),this._sinks==null)return t;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),s.unsub=Ce;try{s.unsub=e.subscribe(r=>{if(s.unsub===null)return;let o=this._config.tierOf,a=!1;for(let i of r)o(i[0])>=3&&(a=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(r){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,r}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(s){this._emit([[p,this._wrapFnError("cleanup threw",s)]])}else if(t!=null&&typeof t=="object"){let s=t.deactivate;if(typeof s=="function")try{s()}catch(r){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",r)]])}}for(let s of this._deps){if(s.unsub!=null){let r=s.unsub;s.unsub=null;try{r()}catch{}}we(s)}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 s=this._deps[e],r=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(o)}if(r!==C){if(r===w){this._depDirtied(s);return}if(r===T){if(this._depInvalidated(s),this._cached===void 0)return;this._emit(de);return}if(r===N||r===I){this._emit([t]);return}if(r===b){this._emit(Q);return}if(r===_)this._depSettledAsData(s,t[1]);else if(r===x)this._depSettledAsResolved(s);else if(r===A)this._depSettledAsTerminal(s,!0);else if(r===p)this._depSettledAsTerminal(s,t[1]);else{this._emit([t]);return}if(!this._fn){(r===_||r===x)&&this._emit([t]),(r===A||r===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_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(ae),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(le)}_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(a){this._emit([[p,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(i){this._emit([[p,this._wrapFnError("cleanup.beforeRun threw",i)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),s=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let i=t[a];i!=null&&i.length>0&&(this._deps[a].prevData=i[i.length-1])}let r=this._deps.map(a=>a.terminal),o={prevData:s,terminalDeps:r,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:s};for(let i of this._inspectorHooks)i(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,o);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let i=a;(typeof i.beforeRun=="function"||typeof i.deactivate=="function"||typeof i.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[p,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ie?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ie} \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 s=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[S,e[0]]:e;let s=!0,r=!1,o=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(s=!1),l===3&&(r=!0),d[0]===w&&(o=!0),a=l}let i=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),i=d.map(l=>l.m)}if(r&&!o&&this._status!=="dirty"){let d=0;for(;d<i.length&&t(i[d][0])===0;)d++;return d===0?[S,...i]:[...i.slice(0,d),S,...i.slice(d)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let d=e[i];if(d[0]===p&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let i=e.filter(d=>d[0]===b||d[0]===T);if(i.length===0)return;t=i}t=this._frameBatch(t);let r=null;for(let i=0;i<t.length;i++){let d=t[i],l=d[0];if(l!==N&&l!==I){r?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===N?"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 u=d[1];if(l===N)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(u),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(u))c=!1;else if(this._pauseLocks.delete(u),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let g=this._pauseBuffer;this._pauseBuffer=[],this._emit(g)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?r?.push(d):r==null&&(r=t.slice(0,i))}if(r!=null){if(r.length===0)return;t=r}if(this._hasMeta&&t.some(i=>i[0]===b))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(Q)}catch{}let{finalMessages:o,equalsError:a}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,d=[];for(let l of o)i(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);a!=null&&this._emit([[p,a]])}_updateState(e){let t=this._config.tierOf,s,r,o=-1,a=0;for(let c of e)t(c[0])===3&&a++;let i=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===_){d=c;break}}for(let c=0;c<e.length;c++){let u=e[c],g=u[0];if(g===_){if(u.length>=2){let f=!1;if(i&&this._cached!==void 0)try{f=this._equals(this._cached,u[1])}catch(v){r=this._wrapFnError("equals threw",v),o=c;break}if(f){s==null&&(s=e.slice(0,c)),s.push(J),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(d<0||c===d)&&ue(this._versioning,u[1],this._hashFn)}this._status="settled",s?.push(u)}else if(s?.push(u),g===w)this._status="dirty";else if(g===x)this._status="resolved";else if(g===A)this._status="completed";else if(g===p)this._status="errored";else if(g===T){this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let v=f.invalidate;if(typeof v=="function")try{v()}catch{}}}else g===b&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=o>=0?s??e.slice(0,o):s??e;return r!=null?{finalMessages:l,equalsError:r}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let s of t)s(e)};_dispatchOrAccumulate(e){if(Ae()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ee(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(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);U(this._deliverToSinks,t,this._config.tierOf)}},Ge=n=>Array.isArray(n),xe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function L(n,e,t){let s=Ge(n)?n:[],r=typeof n=="function"?n:typeof e=="function"?e:void 0,o={};return Ge(n)?o=(xe(e)?e:t)??{}:xe(n)?o=n:o=(xe(e)?e:t)??{},new H(s,r,o)}function Le(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;default:return new Set(["type","deps"])}}function Ve(n,e){return L([],{...e,initial:n})}function Pe(n,e){return L((s,r,o)=>n(r,o)??void 0,{describeKind:"producer",...e})}function Te(n,e,t){return L(n,(r,o,a)=>{let i=r.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);o.emit(e(i,a))},{describeKind:"derived",...t})}function Ue(n,e,t){return L(n,(r,o,a)=>{let i=r.map((d,l)=>d!=null&&d.length>0?d.at(-1):a.prevData[l]);return e(i,o,a)??void 0},{describeKind:"effect",...t})}function We(n,e,t){let s=new Map;return n.forEach((r,o)=>{s.set(r,o)}),Te(n,(r,o)=>e(i=>{let d=s.get(i);if(d==null)throw new Error(`dynamicNode: untracked dep "${i.name??"<unnamed>"}"`);return r[d]},o),t)}function Be(n,e){let t,s=new Map,r=(o,a,i)=>{let d=!1,l=c=>{let u=s.get(c);if(u!==void 0){if(u<o.length){let f=o[u];return f!=null&&f.length>0?f.at(-1):i.prevData[u]}return c.cache}d=!0;let g=t._addDep(c);return s.set(c,g),c.cache};try{let c=n(l,i);d||(a.emit(c),i.store.__autoTrackLastDiscoveryError!=null&&delete i.store.__autoTrackLastDiscoveryError)}catch(c){if(!d)throw c;i.store.__autoTrackLastDiscoveryError=c}};return t=new H([],r,{describeKind:"derived",...e}),t}function je(n,...e){let t=n;for(let s of e)t=s(t);return t}0&&(module.exports={COMPLETE,COMPLETE_MSG,COMPLETE_ONLY_BATCH,DATA,DEFAULT_ACTOR,DIRTY,DIRTY_MSG,DIRTY_ONLY_BATCH,ERROR,GraphReFlyConfig,GuardDenied,INVALIDATE,INVALIDATE_MSG,INVALIDATE_ONLY_BATCH,NodeImpl,PAUSE,RESOLVED,RESOLVED_MSG,RESOLVED_ONLY_BATCH,RESUME,START,START_MSG,TEARDOWN,TEARDOWN_MSG,TEARDOWN_ONLY_BATCH,accessHintForGuard,advanceVersion,autoTrackNode,batch,configure,createVersioning,defaultConfig,defaultHash,derived,downWithBatch,dynamicNode,effect,isBatching,isV1,monotonicNs,node,normalizeActor,pipe,policy,policyFromRules,producer,registerBuiltins,resolveDescribeFields,state,wallClockNs});
@@ -1,4 +1,4 @@
1
- export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, m as GlobalInspectorEvent, n as GlobalInspectorHook, o as GraphReFlyConfig, G as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, M as Message, t as MessageContext, u as MessageTypeRegistration, v as MessageTypeRegistrationInput, b as Messages, a as Node, c as NodeActions, w as NodeCtx, e as NodeDescribeKind, x as NodeFn, d as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, N as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, W as PolicyDeny, P as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as START, a0 as START_MSG, a1 as SubscribeContext, a2 as TEARDOWN, a3 as TEARDOWN_MSG, a4 as TEARDOWN_ONLY_BATCH, a5 as V0, a6 as V1, V as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from '../node-Dd6wHSib.cjs';
2
- export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-kykKWwV-.cjs';
3
- export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from '../meta-CX7YsOzp.cjs';
4
- export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-DHttV0LX.cjs';
1
+ export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, m as GlobalInspectorEvent, n as GlobalInspectorHook, o as GraphReFlyConfig, G as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, M as Message, t as MessageContext, u as MessageTypeRegistration, v as MessageTypeRegistrationInput, b as Messages, a as Node, c as NodeActions, w as NodeCtx, e as NodeDescribeKind, x as NodeFn, d as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, N as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, W as PolicyDeny, P as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as START, a0 as START_MSG, a1 as SubscribeContext, a2 as TEARDOWN, a3 as TEARDOWN_MSG, a4 as TEARDOWN_ONLY_BATCH, a5 as V0, a6 as V1, V as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from '../node-BVV7G1bq.cjs';
2
+ export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-BpFWP7Bq.cjs';
3
+ export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from '../meta-COtmHLwT.cjs';
4
+ export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-CqR6DJ7v.cjs';
@@ -1,4 +1,4 @@
1
- export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, m as GlobalInspectorEvent, n as GlobalInspectorHook, o as GraphReFlyConfig, G as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, M as Message, t as MessageContext, u as MessageTypeRegistration, v as MessageTypeRegistrationInput, b as Messages, a as Node, c as NodeActions, w as NodeCtx, e as NodeDescribeKind, x as NodeFn, d as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, N as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, W as PolicyDeny, P as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as START, a0 as START_MSG, a1 as SubscribeContext, a2 as TEARDOWN, a3 as TEARDOWN_MSG, a4 as TEARDOWN_ONLY_BATCH, a5 as V0, a6 as V1, V as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from '../node-Dd6wHSib.js';
2
- export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-CcWOJ6F0.js';
3
- export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from '../meta-CckhhFRd.js';
4
- export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-CY-MCfZ9.js';
1
+ export { A as Actor, C as COMPLETE, f as COMPLETE_MSG, g as COMPLETE_ONLY_BATCH, D as DATA, h as DEFAULT_ACTOR, i as DIRTY, j as DIRTY_MSG, k as DIRTY_ONLY_BATCH, l as DepRecord, E as ERROR, F as FnCtx, m as GlobalInspectorEvent, n as GlobalInspectorHook, o as GraphReFlyConfig, G as GuardAction, p as GuardDenied, q as GuardDeniedDetails, H as HashFn, I as INVALIDATE, r as INVALIDATE_MSG, s as INVALIDATE_ONLY_BATCH, M as Message, t as MessageContext, u as MessageTypeRegistration, v as MessageTypeRegistrationInput, b as Messages, a as Node, c as NodeActions, w as NodeCtx, e as NodeDescribeKind, x as NodeFn, d as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, N as NodeOptions, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, W as PolicyDeny, P as PolicyRuleData, X as RESOLVED, Y as RESOLVED_MSG, Z as RESOLVED_ONLY_BATCH, _ as RESUME, $ as START, a0 as START_MSG, a1 as SubscribeContext, a2 as TEARDOWN, a3 as TEARDOWN_MSG, a4 as TEARDOWN_ONLY_BATCH, a5 as V0, a6 as V1, V as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from '../node-BVV7G1bq.js';
2
+ export { b as batch, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from '../index-BANwzwBV.js';
3
+ export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from '../meta-BMwx3ExI.js';
4
+ export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from '../sugar-BHbAACDG.js';
@@ -1 +1 @@
1
- import"../chunk-Y32RJO24.js";import{a as X}from"../chunk-TWMEGG45.js";import{A as M,B as N,C as O,D as P,E as Q,F as R,G as S,H as T,I as U,J as V,K as W,i as v,j as w,k as x,m as y,n as z,o as A,p as B,q as C,r as D,s as E,t as F,u as G,v as H,w as I,x as J,y as K,z as L}from"../chunk-W4TSQ6RJ.js";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{i as COMPLETE,o as COMPLETE_MSG,t as COMPLETE_ONLY_BATCH,b as DATA,v as DEFAULT_ACTOR,c as DIRTY,k as DIRTY_MSG,q as DIRTY_ONLY_BATCH,j as ERROR,C as GraphReFlyConfig,E as GuardDenied,e as INVALIDATE,m as INVALIDATE_MSG,s as INVALIDATE_ONLY_BATCH,O as NodeImpl,f as PAUSE,d as RESOLVED,l as RESOLVED_MSG,r as RESOLVED_ONLY_BATCH,g as RESUME,a as START,n as START_MSG,h as TEARDOWN,p as TEARDOWN_MSG,u as TEARDOWN_ONLY_BATCH,H as accessHintForGuard,K as advanceVersion,V as autoTrackNode,y as batch,N as configure,J as createVersioning,M as defaultConfig,I as defaultHash,S as derived,z as downWithBatch,U as dynamicNode,T as effect,x as isBatching,L as isV1,A as monotonicNs,P as node,w as normalizeActor,W as pipe,F as policy,G as policyFromRules,R as producer,D as registerBuiltins,X as resolveDescribeFields,Q as state,B as wallClockNs};
1
+ import"../chunk-CZVYLXFK.js";import{a as X}from"../chunk-N2KKISCE.js";import{A as M,B as N,C as O,D as P,E as Q,F as R,G as S,H as T,I as U,J as V,K as W,i as v,j as w,k as x,m as y,n as z,o as A,p as B,q as C,r as D,s as E,t as F,u as G,v as H,w as I,x as J,y as K,z as L}from"../chunk-7AJKUA36.js";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{i as COMPLETE,o as COMPLETE_MSG,t as COMPLETE_ONLY_BATCH,b as DATA,v as DEFAULT_ACTOR,c as DIRTY,k as DIRTY_MSG,q as DIRTY_ONLY_BATCH,j as ERROR,C as GraphReFlyConfig,E as GuardDenied,e as INVALIDATE,m as INVALIDATE_MSG,s as INVALIDATE_ONLY_BATCH,O as NodeImpl,f as PAUSE,d as RESOLVED,l as RESOLVED_MSG,r as RESOLVED_ONLY_BATCH,g as RESUME,a as START,n as START_MSG,h as TEARDOWN,p as TEARDOWN_MSG,u as TEARDOWN_ONLY_BATCH,H as accessHintForGuard,K as advanceVersion,V as autoTrackNode,y as batch,N as configure,J as createVersioning,M as defaultConfig,I as defaultHash,S as derived,z as downWithBatch,U as dynamicNode,T as effect,x as isBatching,L as isV1,A as monotonicNs,P as node,w as normalizeActor,W as pipe,F as policy,G as policyFromRules,R as producer,D as registerBuiltins,X as resolveDescribeFields,Q as state,B as wallClockNs};
@@ -1 +1 @@
1
- "use strict";var K=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Fe=(n,e)=>{for(var t in e)K(n,t,{get:e[t],enumerable:!0})},Ge=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ce(e))!Ie.call(n,r)&&r!==t&&K(n,r,{get:()=>e[r],enumerable:!(s=Re(e,r))||s.enumerable});return n};var He=n=>Ge(K({},"__esModule",{value:!0}),n);var Ze={};Fe(Ze,{fromIDBRequest:()=>Ee,fromIDBTransaction:()=>Me,indexedDbStorage:()=>Se});module.exports=He(Ze);var G=Symbol.for("graphrefly/START"),_=Symbol.for("graphrefly/DATA"),k=Symbol.for("graphrefly/DIRTY"),E=Symbol.for("graphrefly/RESOLVED"),M=Symbol.for("graphrefly/INVALIDATE"),S=Symbol.for("graphrefly/PAUSE"),H=Symbol.for("graphrefly/RESUME"),N=Symbol.for("graphrefly/TEARDOWN"),v=Symbol.for("graphrefly/COMPLETE"),f=Symbol.for("graphrefly/ERROR"),D=Object.freeze([k]),J=Object.freeze([E]),Le=Object.freeze([M]),X=Object.freeze([G]),Ve=Object.freeze([v]),Pe=Object.freeze([N]),Z=Object.freeze([D]),le=Object.freeze([J]),ce=Object.freeze([Le]),ue=Object.freeze([Ve]),Q=Object.freeze([Pe]);var Be={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)}};function fe(n){n.registerCodec(Be)}var Ue={type:"system",id:""};function B(n){if(n==null)return Ue;let{type:e,id:t,...s}=n;return{type:e??"system",id:t??"",...s}}var ee=0,We=!1,he=[],pe=[],ge=[],je=[];function _e(){return ee>0||We}function ye(){return ee>0}function be(n){ee>0?je.push(n):n()}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!_e()){n(e);return}(l>=5?ge:l===4?pe:he).push(()=>n(e));return}let s=e.length,r=s,i=s,a=s,o=0;for(;o<s&&t(e[o][0])<3;)o++;for(r=o;o<s&&t(e[o][0])===3;)o++;for(i=o;o<s&&t(e[o][0])===4;)o++;a=o;let d=_e();if(r>0){let l=e.slice(0,r);n(l)}if(i>r){let l=e.slice(r,i);d?he.push(()=>n(l)):n(l)}if(a>i){let l=e.slice(i,a);d?pe.push(()=>n(l)):n(l)}if(s>a){let l=e.slice(a,s);d?ge.push(()=>n(l)):n(l)}}function me(){return Date.now()*1e6}var W=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_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 s=this._messageTypes.get(t);return s!=null?s.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}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 ve(n){n.registerMessageType(G,{tier:0,wireCrossing:!1}),n.registerMessageType(k,{tier:1,wireCrossing:!1}),n.registerMessageType(M,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(S,{tier:2,wireCrossing:!1}),n.registerMessageType(H,{tier:2,wireCrossing:!1}),n.registerMessageType(_,{tier:3,wireCrossing:!0}),n.registerMessageType(E,{tier:3,wireCrossing:!0}),n.registerMessageType(v,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(f,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(N,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var O=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}};function te(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(te);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=te(n[t]);return e}return null}var ze=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]),$e=new TextEncoder;function qe(n){let e=$e.encode(n),t=e.length,s=t*8,r=t+9+63&-64,i=new Uint8Array(r);i.set(e),i[t]=128;let a=new DataView(i.buffer);a.setUint32(r-4,s>>>0,!1),a.setUint32(r-8,Math.floor(s/4294967296)>>>0,!1);let o=1779033703,d=3144134277,l=1013904242,c=2773480762,u=1359893119,h=2600822924,g=528734635,y=1541459225,A=new Uint32Array(64),m=(x,b)=>x>>>b|x<<32-b;for(let x=0;x<r;x+=64){for(let p=0;p<16;p++)A[p]=a.getUint32(x+p*4,!1);for(let p=16;p<64;p++){let I=A[p-15],F=A[p-2],P=m(I,7)^m(I,18)^I>>>3,Y=m(F,17)^m(F,19)^F>>>10;A[p]=A[p-16]+P+A[p-7]+Y>>>0}let b=o,R=d,C=l,$=c,T=u,L=h,V=g,q=y;for(let p=0;p<64;p++){let I=m(T,6)^m(T,11)^m(T,25),F=T&L^~T&V,P=q+I+F+ze[p]+A[p]>>>0,Y=m(b,2)^m(b,13)^m(b,22),De=b&R^b&C^R&C,Oe=Y+De>>>0;q=V,V=L,L=T,T=$+P>>>0,$=C,C=R,R=b,b=P+Oe>>>0}o=o+b>>>0,d=d+R>>>0,l=l+C>>>0,c=c+$>>>0,u=u+T>>>0,h=h+L>>>0,g=g+V>>>0,y=y+q>>>0}let w=x=>x.toString(16).padStart(8,"0");return w(o)+w(d)+w(l)+w(c)+w(u)+w(h)+w(g)+w(y)}function ne(n){let e=te(n??null),t=JSON.stringify(e);return qe(t).slice(0,16)}function Ye(){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 se(n,e,t){let s=t?.id??Ye();if(n===0)return{id:s,version:0};let i=(t?.hash??ne)(e);return{id:s,version:0,cid:i,prev:null}}function we(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var xe=()=>{},Te=100;function Ne(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function re(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function j(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var Ke=(n,e,t,s)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},Je=(n,e,t,s)=>{let r=n;if(r._status==="completed"||r._status==="errored")return;let i=r._cached,a=i===void 0?[X]:[X,[_,i]];r._status==="dirty"&&a.push(D),U(e,a,r._config.tierOf)},ie=new W({onMessage:Ke,onSubscribe:Je});ve(ie);fe(ie);var z=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,s){this._config=s.config??ie,this._config.onMessage,this._optsName=s.name,this._describeKind=s.describeKind,this._equals=s.equals??Object.is,this._resubscribable=s.resubscribable??!1,this._resetOnTeardown=s.resetOnTeardown??!1,this._autoComplete=s.completeWhenDepsComplete??!0,this._autoError=s.errorWhenDepsError??!0,this._pausable=s.pausable??!0,this._guard=s.guard,this._fn=t,this._partial=s.partial??!1,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??ne;let r=s.versioning??this._config.defaultVersioning;this._versioningLevel=r,this._versioning=r!=null?se(r,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Ne);let i={};for(let[o,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${o}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),i[o]=new n([],void 0,l)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(o){a._emit([[_,o]])},down(o){a._emit(j(o))},up(o){a._emitUp(j(o))}},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 s=this._versioningLevel;if(s!=null&&e<=s)return;let r=t?.hash??this._hashFn;r!==this._hashFn&&(this._hashFn=r);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,o=a?.id??t?.id,d=a?.version??0,l=se(e,i,{id:o,hash:r});l.version=d,this._versioning=l,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=B(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!t&&!s)return;let r=B(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(r,i))throw new O({actor:r,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(r,i))throw new O({actor:r,action:i,nodeName:this.name})}this._lastMutation={actor:r,timestamp_ns:me()}}down(e,t){let s=j(e);s.length!==0&&(this._checkGuard(t),this._emit(s))}emit(e,t){this._checkGuard(t),this._emit([[_,e]])}up(e,t){if(this._deps.length===0)return;let s=j(e);if(s.length===0)return;this._checkGuard(t);let r=t??{internal:!0};this._validateUpTiers(s);for(let i of this._deps)i.node.up?.(s,r)}_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 s of e){let r=t(s[0]);if(r===3||r===4)throw new Error(`Node "${this.name}": tier-${r} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=B(t);if(!this._guard(d,"observe"))throw new O({actor:d,action:"observe",nodeName:this.name})}let r=this._isTerminal&&this._resubscribable;if(r){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)re(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:r},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let o=!1;return()=>{o||(o=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),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 s=0;s<e;s++){let r=s,i=this._deps[s];i.unsub=xe,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let o=this._config.tierOf,d=!1;for(let l of a)o(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:r},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(s){this._deps[t].unsub=null;for(let r=0;r<t;r++){let i=this._deps[r];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}re(i)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let r=0;r<this._deps.length;r++)if(this._deps[r].node===e)return r;let t=this._deps.length,s=Ne(e);if(this._deps.push(s),this._sinks==null)return t;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),s.unsub=xe;try{s.unsub=e.subscribe(r=>{if(s.unsub===null)return;let i=this._config.tierOf,a=!1;for(let o of r)i(o[0])>=3&&(a=!0),this._config.onMessage(this,o,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(r){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,r}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(s){this._emit([[f,this._wrapFnError("cleanup threw",s)]])}else if(t!=null&&typeof t=="object"){let s=t.deactivate;if(typeof s=="function")try{s()}catch(r){this._emit([[f,this._wrapFnError("cleanup.deactivate threw",r)]])}}for(let s of this._deps){if(s.unsub!=null){let r=s.unsub;s.unsub=null;try{r()}catch{}}re(s)}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 s=this._deps[e],r=t[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(i)}if(r!==G){if(r===k){this._depDirtied(s);return}if(r===M){this._depInvalidated(s),this._emit(ce);return}if(r===S||r===H){this._emit([t]);return}if(r===N){this._emit(Q);return}if(r===_)this._depSettledAsData(s,t[1]);else if(r===E)this._depSettledAsResolved(s);else if(r===v)this._depSettledAsTerminal(s,!0);else if(r===f)this._depSettledAsTerminal(s,t[1]);else{this._emit([t]);return}if(!this._fn){(r===_||r===E)&&this._emit([t]),(r===v||r===f)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_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(le),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([[f,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(ue)}_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(a){this._emit([[f,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(o){this._emit([[f,this._wrapFnError("cleanup.beforeRun threw",o)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),s=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let o=t[a];o!=null&&o.length>0&&(this._deps[a].prevData=o[o.length-1])}let r=this._deps.map(a=>a.terminal),i={prevData:s,terminalDeps:r,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:s};for(let o of this._inspectorHooks)o(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let o=a;(typeof o.beforeRun=="function"||typeof o.deactivate=="function"||typeof o.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[f,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Te?(this._rerunDepth=0,this._emit([[f,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Te} \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 s=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[D,e[0]]:e;let s=!0,r=!1,i=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(s=!1),l===3&&(r=!0),d[0]===k&&(i=!0),a=l}let o=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),o=d.map(l=>l.m)}if(r&&!i&&this._status!=="dirty"){let d=0;for(;d<o.length&&t(o[d][0])===0;)d++;return d===0?[D,...o]:[...o.slice(0,d),D,...o.slice(d)]}return o}_emit(e){if(e.length===0)return;for(let o=0;o<e.length;o++){let d=e[o];if(d[0]===f&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let o=e.filter(d=>d[0]===N||d[0]===M);if(o.length===0)return;t=o}t=this._frameBatch(t);let r=null;for(let o=0;o<t.length;o++){let d=t[o],l=d[0];if(l!==S&&l!==H){r?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===S?"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 u=d[1];if(l===S)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(u),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(u))c=!1;else if(this._pauseLocks.delete(u),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let h=this._pauseBuffer;this._pauseBuffer=[],this._emit(h)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?r?.push(d):r==null&&(r=t.slice(0,o))}if(r!=null){if(r.length===0)return;t=r}if(this._hasMeta&&t.some(o=>o[0]===N))for(let o of Object.keys(this.meta))try{this.meta[o]._emit(Q)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(t);if(i.length>0&&this._config.inspectorEnabled){let o=this._config.globalInspector;if(o!=null)try{o({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let o=this._config.tierOf,d=[];for(let l of i)o(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[f,a]])}_updateState(e){let t=this._config.tierOf,s,r,i=-1,a=0;for(let c of e)t(c[0])===3&&a++;let o=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===_){d=c;break}}for(let c=0;c<e.length;c++){let u=e[c],h=u[0];if(h===_){if(u.length>=2){let g=!1;if(o&&this._cached!==void 0)try{g=this._equals(this._cached,u[1])}catch(y){r=this._wrapFnError("equals threw",y),i=c;break}if(g){s==null&&(s=e.slice(0,c)),s.push(J),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(d<0||c===d)&&we(this._versioning,u[1],this._hashFn)}this._status="settled",s?.push(u)}else if(s?.push(u),h===k)this._status="dirty";else if(h===E)this._status="resolved";else if(h===v)this._status="completed";else if(h===f)this._status="errored";else if(h===M){this._cached=void 0,this._status="dirty";let g=this._cleanup;if(typeof g=="function"){this._cleanup=void 0;try{g()}catch{}}else if(g!=null&&typeof g=="object"){let y=g.invalidate;if(typeof y=="function")try{y()}catch{}}}else h===N&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=i>=0?s??e.slice(0,i):s??e;return r!=null?{finalMessages:l,equalsError:r}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let s of t)s(e)};_dispatchOrAccumulate(e){if(ye()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],be(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(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);U(this._deliverToSinks,t,this._config.tierOf)}},Ae=n=>Array.isArray(n),oe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function ke(n,e,t){let s=Ae(n)?n:[],r=typeof n=="function"?n:typeof e=="function"?e:void 0,i={};return Ae(n)?i=(oe(e)?e:t)??{}:oe(n)?i=n:i=(oe(e)?e:t)??{},new z(s,r,i)}function ae(n,e){return ke((s,r,i)=>n(r,i)??void 0,{describeKind:"producer",...e})}function Ee(n){return ae(e=>{let t=!1,s=()=>{n.onsuccess=null,n.onerror=null};return n.onsuccess=()=>{t||(t=!0,s(),e.down([[_,n.result],[v]]))},n.onerror=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB request failed")]]))},()=>{t=!0,s()}})}function Me(n){return ae(e=>{let t=!1,s=()=>{n.oncomplete=null,n.onerror=null,n.onabort=null};return n.oncomplete=()=>{t||(t=!0,s(),e.down([[_,void 0],[v]]))},n.onerror=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB transaction failed")]]))},n.onabort=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB transaction aborted")]]))},()=>{t=!0,s()}})}function Xe(n,e,t){return new Promise((s,r)=>{if(typeof indexedDB>"u"){r(new TypeError("indexedDB is not available in this environment"));return}let i=indexedDB.open(n,t);i.onupgradeneeded=()=>{let a=i.result;a.objectStoreNames.contains(e)||a.createObjectStore(e)},i.onsuccess=()=>s(i.result),i.onerror=()=>r(i.error??new Error("IndexedDB open failed"))})}function de(n,e,t,s,r){return Xe(n,e,t).then(i=>new Promise((a,o)=>{let d=i.transaction(e,s),l=d.objectStore(e),c=r(l),u,h=!1,g=!1,y=()=>{!h||!g||(i.close(),a(u))};c.onsuccess=()=>{u=c.result,h=!0,y()},c.onerror=()=>{i.close(),o(c.error??new Error("IndexedDB request failed"))},d.oncomplete=()=>{if(g=!0,!h){i.close(),o(new Error("IndexedDB transaction completed without request result"));return}y()},d.onerror=()=>{i.close(),o(d.error??new Error("IndexedDB transaction failed"))},d.onabort=()=>{i.close(),o(d.error??new Error("IndexedDB transaction aborted"))}}))}function Se(n){let{dbName:e,storeName:t}=n,s=n.version??1,r=n.key??"graphrefly_checkpoint";return{async save(i,a){await de(e,t,s,"readwrite",o=>o.put(a,r))},async load(i){let a=await de(e,t,s,"readonly",o=>o.get(r));return a==null||typeof a!="object"||Array.isArray(a)?null:a},async clear(i){await de(e,t,s,"readwrite",a=>a.delete(r))}}}0&&(module.exports={fromIDBRequest,fromIDBTransaction,indexedDbStorage});
1
+ "use strict";var K=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var Fe=(n,e)=>{for(var t in e)K(n,t,{get:e[t],enumerable:!0})},Ge=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ce(e))!Ie.call(n,r)&&r!==t&&K(n,r,{get:()=>e[r],enumerable:!(s=Re(e,r))||s.enumerable});return n};var He=n=>Ge(K({},"__esModule",{value:!0}),n);var Ze={};Fe(Ze,{fromIDBRequest:()=>Ee,fromIDBTransaction:()=>Me,indexedDbStorage:()=>Se});module.exports=He(Ze);var G=Symbol.for("graphrefly/START"),_=Symbol.for("graphrefly/DATA"),k=Symbol.for("graphrefly/DIRTY"),E=Symbol.for("graphrefly/RESOLVED"),M=Symbol.for("graphrefly/INVALIDATE"),S=Symbol.for("graphrefly/PAUSE"),H=Symbol.for("graphrefly/RESUME"),N=Symbol.for("graphrefly/TEARDOWN"),v=Symbol.for("graphrefly/COMPLETE"),f=Symbol.for("graphrefly/ERROR"),D=Object.freeze([k]),J=Object.freeze([E]),Le=Object.freeze([M]),X=Object.freeze([G]),Ve=Object.freeze([v]),Pe=Object.freeze([N]),Z=Object.freeze([D]),le=Object.freeze([J]),ce=Object.freeze([Le]),ue=Object.freeze([Ve]),Q=Object.freeze([Pe]);var Be={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)}};function fe(n){n.registerCodec(Be)}var Ue={type:"system",id:""};function B(n){if(n==null)return Ue;let{type:e,id:t,...s}=n;return{type:e??"system",id:t??"",...s}}var ee=0,We=!1,he=[],pe=[],ge=[],je=[];function _e(){return ee>0||We}function ye(){return ee>0}function be(n){ee>0?je.push(n):n()}function U(n,e,t){if(e.length===0)return;if(e.length===1){let l=t(e[0][0]);if(l<3||!_e()){n(e);return}(l>=5?ge:l===4?pe:he).push(()=>n(e));return}let s=e.length,r=s,i=s,a=s,o=0;for(;o<s&&t(e[o][0])<3;)o++;for(r=o;o<s&&t(e[o][0])===3;)o++;for(i=o;o<s&&t(e[o][0])===4;)o++;a=o;let d=_e();if(r>0){let l=e.slice(0,r);n(l)}if(i>r){let l=e.slice(r,i);d?he.push(()=>n(l)):n(l)}if(a>i){let l=e.slice(i,a);d?pe.push(()=>n(l)):n(l)}if(s>a){let l=e.slice(a,s);d?ge.push(()=>n(l)):n(l)}}function me(){return Date.now()*1e6}var W=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_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 s=this._messageTypes.get(t);return s!=null?s.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}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 ve(n){n.registerMessageType(G,{tier:0,wireCrossing:!1}),n.registerMessageType(k,{tier:1,wireCrossing:!1}),n.registerMessageType(M,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(S,{tier:2,wireCrossing:!1}),n.registerMessageType(H,{tier:2,wireCrossing:!1}),n.registerMessageType(_,{tier:3,wireCrossing:!0}),n.registerMessageType(E,{tier:3,wireCrossing:!0}),n.registerMessageType(v,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(f,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(N,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var O=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}};function te(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(te);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=te(n[t]);return e}return null}var ze=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]),$e=new TextEncoder;function qe(n){let e=$e.encode(n),t=e.length,s=t*8,r=t+9+63&-64,i=new Uint8Array(r);i.set(e),i[t]=128;let a=new DataView(i.buffer);a.setUint32(r-4,s>>>0,!1),a.setUint32(r-8,Math.floor(s/4294967296)>>>0,!1);let o=1779033703,d=3144134277,l=1013904242,c=2773480762,u=1359893119,h=2600822924,g=528734635,y=1541459225,A=new Uint32Array(64),m=(x,b)=>x>>>b|x<<32-b;for(let x=0;x<r;x+=64){for(let p=0;p<16;p++)A[p]=a.getUint32(x+p*4,!1);for(let p=16;p<64;p++){let I=A[p-15],F=A[p-2],P=m(I,7)^m(I,18)^I>>>3,Y=m(F,17)^m(F,19)^F>>>10;A[p]=A[p-16]+P+A[p-7]+Y>>>0}let b=o,R=d,C=l,$=c,T=u,L=h,V=g,q=y;for(let p=0;p<64;p++){let I=m(T,6)^m(T,11)^m(T,25),F=T&L^~T&V,P=q+I+F+ze[p]+A[p]>>>0,Y=m(b,2)^m(b,13)^m(b,22),De=b&R^b&C^R&C,Oe=Y+De>>>0;q=V,V=L,L=T,T=$+P>>>0,$=C,C=R,R=b,b=P+Oe>>>0}o=o+b>>>0,d=d+R>>>0,l=l+C>>>0,c=c+$>>>0,u=u+T>>>0,h=h+L>>>0,g=g+V>>>0,y=y+q>>>0}let w=x=>x.toString(16).padStart(8,"0");return w(o)+w(d)+w(l)+w(c)+w(u)+w(h)+w(g)+w(y)}function ne(n){let e=te(n??null),t=JSON.stringify(e);return qe(t).slice(0,16)}function Ye(){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 se(n,e,t){let s=t?.id??Ye();if(n===0)return{id:s,version:0};let i=(t?.hash??ne)(e);return{id:s,version:0,cid:i,prev:null}}function we(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var xe=()=>{},Te=100;function Ne(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function re(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function j(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}var Ke=(n,e,t,s)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},Je=(n,e,t,s)=>{let r=n;if(r._status==="completed"||r._status==="errored")return;let i=r._cached,a=i===void 0?[X]:[X,[_,i]];r._status==="dirty"&&a.push(D),U(e,a,r._config.tierOf)},ie=new W({onMessage:Ke,onSubscribe:Je});ve(ie);fe(ie);var z=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,s){this._config=s.config??ie,this._config.onMessage,this._optsName=s.name,this._describeKind=s.describeKind,this._equals=s.equals??Object.is,this._resubscribable=s.resubscribable??!1,this._resetOnTeardown=s.resetOnTeardown??!1,this._autoComplete=s.completeWhenDepsComplete??!0,this._autoError=s.errorWhenDepsError??!0,this._pausable=s.pausable??!0,this._guard=s.guard,this._fn=t,this._partial=s.partial??!1,this._cached=s.initial!==void 0?s.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=s.versioningHash??this._config.defaultHashFn??ne;let r=s.versioning??this._config.defaultVersioning;this._versioningLevel=r,this._versioning=r!=null?se(r,this._cached===void 0?void 0:this._cached,{id:s.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Ne);let i={};for(let[o,d]of Object.entries(s.meta??{})){let l={initial:d,name:`${s.name??"node"}:meta:${o}`,describeKind:"state",config:this._config};s.guard!=null&&(l.guard=s.guard),i[o]=new n([],void 0,l)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(o){a._emit([[_,o]])},down(o){a._emit(j(o))},up(o){a._emitUp(j(o))}},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 s=this._versioningLevel;if(s!=null&&e<=s)return;let r=t?.hash??this._hashFn;r!==this._hashFn&&(this._hashFn=r);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,o=a?.id??t?.id,d=a?.version??0,l=se(e,i,{id:o,hash:r});l.version=d,this._versioning=l,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=B(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let s of this._extraGuards)if(!s(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,s=e?.actor!=null;if(!t&&!s)return;let r=B(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(r,i))throw new O({actor:r,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(r,i))throw new O({actor:r,action:i,nodeName:this.name})}this._lastMutation={actor:r,timestamp_ns:me()}}down(e,t){let s=j(e);s.length!==0&&(this._checkGuard(t),this._emit(s))}emit(e,t){this._checkGuard(t),this._emit([[_,e]])}up(e,t){if(this._deps.length===0)return;let s=j(e);if(s.length===0)return;this._checkGuard(t);let r=t??{internal:!0};this._validateUpTiers(s);for(let i of this._deps)i.node.up?.(s,r)}_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 s of e){let r=t(s[0]);if(r===3||r===4)throw new Error(`Node "${this.name}": tier-${r} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let d=B(t);if(!this._guard(d,"observe"))throw new O({actor:d,action:"observe",nodeName:this.name})}let r=this._isTerminal&&this._resubscribable;if(r){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)re(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:r},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let o=!1;return()=>{o||(o=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),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 s=0;s<e;s++){let r=s,i=this._deps[s];i.unsub=xe,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let o=this._config.tierOf,d=!1;for(let l of a)o(l[0])>=3&&(d=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:r},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(s){this._deps[t].unsub=null;for(let r=0;r<t;r++){let i=this._deps[r];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}re(i)}}throw this._dirtyDepCount=0,s}}_addDep(e){for(let r=0;r<this._deps.length;r++)if(this._deps[r].node===e)return r;let t=this._deps.length,s=Ne(e);if(this._deps.push(s),this._sinks==null)return t;s.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z),s.unsub=xe;try{s.unsub=e.subscribe(r=>{if(s.unsub===null)return;let i=this._config.tierOf,a=!1;for(let o of r)i(o[0])>=3&&(a=!0),this._config.onMessage(this,o,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(r){throw s.unsub=null,this._deps.pop(),this._dirtyDepCount--,r}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(s){this._emit([[f,this._wrapFnError("cleanup threw",s)]])}else if(t!=null&&typeof t=="object"){let s=t.deactivate;if(typeof s=="function")try{s()}catch(r){this._emit([[f,this._wrapFnError("cleanup.deactivate threw",r)]])}}for(let s of this._deps){if(s.unsub!=null){let r=s.unsub;s.unsub=null;try{r()}catch{}}re(s)}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 s=this._deps[e],r=t[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(i)}if(r!==G){if(r===k){this._depDirtied(s);return}if(r===M){if(this._depInvalidated(s),this._cached===void 0)return;this._emit(ce);return}if(r===S||r===H){this._emit([t]);return}if(r===N){this._emit(Q);return}if(r===_)this._depSettledAsData(s,t[1]);else if(r===E)this._depSettledAsResolved(s);else if(r===v)this._depSettledAsTerminal(s,!0);else if(r===f)this._depSettledAsTerminal(s,t[1]);else{this._emit([t]);return}if(!this._fn){(r===_||r===E)&&this._emit([t]),(r===v||r===f)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Z))}_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(le),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([[f,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(ue)}_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(a){this._emit([[f,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(o){this._emit([[f,this._wrapFnError("cleanup.beforeRun threw",o)]]);return}}}let t=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),s=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let o=t[a];o!=null&&o.length>0&&(this._deps[a].prevData=o[o.length-1])}let r=this._deps.map(a=>a.terminal),i={prevData:s,terminalDeps:r,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:s};for(let o of this._inspectorHooks)o(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let o=a;(typeof o.beforeRun=="function"||typeof o.deactivate=="function"||typeof o.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[f,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Te?(this._rerunDepth=0,this._emit([[f,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Te} \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 s=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${s}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[D,e[0]]:e;let s=!0,r=!1,i=!1,a=-1;for(let d of e){let l=t(d[0]);l<a&&(s=!1),l===3&&(r=!0),d[0]===k&&(i=!0),a=l}let o=e;if(!s){let d=e.map((l,c)=>({m:l,i:c,tier:t(l[0])}));d.sort((l,c)=>l.tier-c.tier||l.i-c.i),o=d.map(l=>l.m)}if(r&&!i&&this._status!=="dirty"){let d=0;for(;d<o.length&&t(o[d][0])===0;)d++;return d===0?[D,...o]:[...o.slice(0,d),D,...o.slice(d)]}return o}_emit(e){if(e.length===0)return;for(let o=0;o<e.length;o++){let d=e[o];if(d[0]===f&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let o=e.filter(d=>d[0]===N||d[0]===M);if(o.length===0)return;t=o}t=this._frameBatch(t);let r=null;for(let o=0;o<t.length;o++){let d=t[o],l=d[0];if(l!==S&&l!==H){r?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${l===S?"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 u=d[1];if(l===S)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(u),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(u))c=!1;else if(this._pauseLocks.delete(u),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let h=this._pauseBuffer;this._pauseBuffer=[],this._emit(h)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?r?.push(d):r==null&&(r=t.slice(0,o))}if(r!=null){if(r.length===0)return;t=r}if(this._hasMeta&&t.some(o=>o[0]===N))for(let o of Object.keys(this.meta))try{this.meta[o]._emit(Q)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(t);if(i.length>0&&this._config.inspectorEnabled){let o=this._config.globalInspector;if(o!=null)try{o({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let o=this._config.tierOf,d=[];for(let l of i)o(l[0])===3?this._pauseBuffer.push(l):d.push(l);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[f,a]])}_updateState(e){let t=this._config.tierOf,s,r,i=-1,a=0;for(let c of e)t(c[0])===3&&a++;let o=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===_){d=c;break}}for(let c=0;c<e.length;c++){let u=e[c],h=u[0];if(h===_){if(u.length>=2){let g=!1;if(o&&this._cached!==void 0)try{g=this._equals(this._cached,u[1])}catch(y){r=this._wrapFnError("equals threw",y),i=c;break}if(g){s==null&&(s=e.slice(0,c)),s.push(J),this._status="resolved";continue}this._cached=u[1],this._versioning!=null&&(d<0||c===d)&&we(this._versioning,u[1],this._hashFn)}this._status="settled",s?.push(u)}else if(s?.push(u),h===k)this._status="dirty";else if(h===E)this._status="resolved";else if(h===v)this._status="completed";else if(h===f)this._status="errored";else if(h===M){this._cached=void 0,this._status="dirty";let g=this._cleanup;if(typeof g=="function"){this._cleanup=void 0;try{g()}catch{}}else if(g!=null&&typeof g=="object"){let y=g.invalidate;if(typeof y=="function")try{y()}catch{}}}else h===N&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=i>=0?s??e.slice(0,i):s??e;return r!=null?{finalMessages:l,equalsError:r}:{finalMessages:l}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let s of t)s(e)};_dispatchOrAccumulate(e){if(ye()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],be(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}U(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);U(this._deliverToSinks,t,this._config.tierOf)}},Ae=n=>Array.isArray(n),oe=n=>typeof n=="object"&&n!=null&&!Array.isArray(n);function ke(n,e,t){let s=Ae(n)?n:[],r=typeof n=="function"?n:typeof e=="function"?e:void 0,i={};return Ae(n)?i=(oe(e)?e:t)??{}:oe(n)?i=n:i=(oe(e)?e:t)??{},new z(s,r,i)}function ae(n,e){return ke((s,r,i)=>n(r,i)??void 0,{describeKind:"producer",...e})}function Ee(n){return ae(e=>{let t=!1,s=()=>{n.onsuccess=null,n.onerror=null};return n.onsuccess=()=>{t||(t=!0,s(),e.down([[_,n.result],[v]]))},n.onerror=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB request failed")]]))},()=>{t=!0,s()}})}function Me(n){return ae(e=>{let t=!1,s=()=>{n.oncomplete=null,n.onerror=null,n.onabort=null};return n.oncomplete=()=>{t||(t=!0,s(),e.down([[_,void 0],[v]]))},n.onerror=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB transaction failed")]]))},n.onabort=()=>{t||(t=!0,s(),e.down([[f,n.error??new Error("IndexedDB transaction aborted")]]))},()=>{t=!0,s()}})}function Xe(n,e,t){return new Promise((s,r)=>{if(typeof indexedDB>"u"){r(new TypeError("indexedDB is not available in this environment"));return}let i=indexedDB.open(n,t);i.onupgradeneeded=()=>{let a=i.result;a.objectStoreNames.contains(e)||a.createObjectStore(e)},i.onsuccess=()=>s(i.result),i.onerror=()=>r(i.error??new Error("IndexedDB open failed"))})}function de(n,e,t,s,r){return Xe(n,e,t).then(i=>new Promise((a,o)=>{let d=i.transaction(e,s),l=d.objectStore(e),c=r(l),u,h=!1,g=!1,y=()=>{!h||!g||(i.close(),a(u))};c.onsuccess=()=>{u=c.result,h=!0,y()},c.onerror=()=>{i.close(),o(c.error??new Error("IndexedDB request failed"))},d.oncomplete=()=>{if(g=!0,!h){i.close(),o(new Error("IndexedDB transaction completed without request result"));return}y()},d.onerror=()=>{i.close(),o(d.error??new Error("IndexedDB transaction failed"))},d.onabort=()=>{i.close(),o(d.error??new Error("IndexedDB transaction aborted"))}}))}function Se(n){let{dbName:e,storeName:t}=n,s=n.version??1,r=n.key??"graphrefly_checkpoint";return{async save(i,a){await de(e,t,s,"readwrite",o=>o.put(a,r))},async load(i){let a=await de(e,t,s,"readonly",o=>o.get(r));return a==null||typeof a!="object"||Array.isArray(a)?null:a},async clear(i){await de(e,t,s,"readwrite",a=>a.delete(r))}}}0&&(module.exports={fromIDBRequest,fromIDBTransaction,indexedDbStorage});
@@ -1,3 +1,3 @@
1
1
  export { IndexedDbStorageSpec, fromIDBRequest, fromIDBTransaction, indexedDbStorage } from './storage-browser.cjs';
2
- import '../node-Dd6wHSib.cjs';
2
+ import '../node-BVV7G1bq.cjs';
3
3
  import './storage-core.cjs';
@@ -1,3 +1,3 @@
1
1
  export { IndexedDbStorageSpec, fromIDBRequest, fromIDBTransaction, indexedDbStorage } from './storage-browser.js';
2
- import '../node-Dd6wHSib.js';
2
+ import '../node-BVV7G1bq.js';
3
3
  import './storage-core.js';
@@ -1 +1 @@
1
- import{a as e,b as o,c as r}from"../chunk-7TDOES3L.js";import"../chunk-W4TSQ6RJ.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{e as fromIDBRequest,o as fromIDBTransaction,r as indexedDbStorage};
1
+ import{a as e,b as o,c as r}from"../chunk-Q2SY7M7K.js";import"../chunk-7AJKUA36.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{e as fromIDBRequest,o as fromIDBTransaction,r as indexedDbStorage};