@graphrefly/graphrefly 0.37.0 → 0.39.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 (329) hide show
  1. package/dist/budget-gate-CmmVtasH.d.ts +115 -0
  2. package/dist/budget-gate-DiP_nK0n.d.cts +115 -0
  3. package/dist/{cascading-BsJ4GbnS.d.ts → cascading-BzuxW0_w.d.cts} +2 -2
  4. package/dist/{cascading-B25wxpRa.d.cts → cascading-g2_rhhaM.d.ts} +2 -2
  5. package/dist/chunk-35JTVPOX.js +1 -0
  6. package/dist/chunk-3G5U5QNE.js +5 -0
  7. package/dist/chunk-4I45FVQS.js +1 -0
  8. package/dist/chunk-5LK7XMEV.js +1 -0
  9. package/dist/chunk-5XRI6RM3.js +1 -0
  10. package/dist/chunk-73PBQNST.js +1 -0
  11. package/dist/chunk-7JRF5YEK.js +3 -0
  12. package/dist/{chunk-YVYSO5CW.js → chunk-7NZMZJMW.js} +1 -1
  13. package/dist/chunk-7QFRK3N3.js +84 -0
  14. package/dist/{chunk-K6ZFJ473.js → chunk-7SD73DS6.js} +1 -1
  15. package/dist/{chunk-LOQRPP4Y.js → chunk-A6ZSKGUG.js} +1 -1
  16. package/dist/{chunk-KUVDFOJH.js → chunk-AU7YTQX7.js} +1 -1
  17. package/dist/chunk-C72GO4IZ.js +1 -0
  18. package/dist/{chunk-Q7EUZ6NN.js → chunk-CGDMTXSY.js} +1 -1
  19. package/dist/chunk-D27JNOLZ.js +1 -0
  20. package/dist/chunk-D47YVDR5.js +1 -0
  21. package/dist/chunk-EWF7KCDJ.js +61 -0
  22. package/dist/{chunk-PCD2MU7X.js → chunk-GEAO3TL3.js} +1 -1
  23. package/dist/chunk-GX5LSSRE.js +1 -0
  24. package/dist/{chunk-2C4NESZE.js → chunk-HAWKGIXM.js} +1 -1
  25. package/dist/chunk-HX3EGQ5Z.js +1 -0
  26. package/dist/{chunk-MQZWA3DF.js → chunk-IA7DUNGB.js} +1 -1
  27. package/dist/{chunk-MYFR67PY.js → chunk-INH6FS2G.js} +2 -2
  28. package/dist/chunk-INHC33EH.js +1 -0
  29. package/dist/chunk-IUB4NYI2.js +1 -0
  30. package/dist/{chunk-TFK4P4CX.js → chunk-JNMC2WJ6.js} +1 -1
  31. package/dist/{chunk-TLS7M7H4.js → chunk-KD4NHLMU.js} +1 -1
  32. package/dist/chunk-L6NSJVJZ.js +1 -0
  33. package/dist/chunk-L7WY6TZS.js +1 -0
  34. package/dist/chunk-LQNOXGET.js +1 -0
  35. package/dist/chunk-MC4UYY2X.js +1 -0
  36. package/dist/{chunk-U3COB5WU.js → chunk-N7UIBZCW.js} +1 -1
  37. package/dist/chunk-NQI2C36M.js +1 -0
  38. package/dist/chunk-R75BMDLA.js +1 -0
  39. package/dist/chunk-RF3QZP6D.js +1 -0
  40. package/dist/{chunk-MC5LZG3U.js → chunk-S2U57TFC.js} +1 -1
  41. package/dist/{chunk-QP5TH523.js → chunk-SC7BQDNP.js} +1 -1
  42. package/dist/{chunk-5CPPC75H.js → chunk-TFPZLQ5H.js} +1 -1
  43. package/dist/chunk-VJJLIEAL.js +1 -0
  44. package/dist/chunk-WHIZM6JV.js +1 -0
  45. package/dist/chunk-XEUANKBO.js +43 -0
  46. package/dist/chunk-XQ55HO5N.js +1 -0
  47. package/dist/chunk-ZJ7SM3G2.js +1 -0
  48. package/dist/{chunk-T4U24DXX.js → chunk-ZOX3LBRV.js} +1 -1
  49. package/dist/compat/index.cjs +9 -13
  50. package/dist/compat/index.d.cts +16 -16
  51. package/dist/compat/index.d.ts +16 -16
  52. package/dist/compat/index.js +1 -1
  53. package/dist/compat/jotai/index.d.cts +2 -2
  54. package/dist/compat/jotai/index.d.ts +2 -2
  55. package/dist/compat/nanostores/index.d.cts +2 -2
  56. package/dist/compat/nanostores/index.d.ts +2 -2
  57. package/dist/compat/nestjs/index.cjs +8 -12
  58. package/dist/compat/nestjs/index.d.cts +8 -8
  59. package/dist/compat/nestjs/index.d.ts +8 -8
  60. package/dist/compat/nestjs/index.js +1 -1
  61. package/dist/compat/react/index.d.cts +2 -2
  62. package/dist/compat/react/index.d.ts +2 -2
  63. package/dist/compat/solid/index.d.cts +2 -2
  64. package/dist/compat/solid/index.d.ts +2 -2
  65. package/dist/compat/svelte/index.d.cts +2 -2
  66. package/dist/compat/svelte/index.d.ts +2 -2
  67. package/dist/compat/vue/index.d.cts +2 -2
  68. package/dist/compat/vue/index.d.ts +2 -2
  69. package/dist/compat/zustand/index.cjs +3 -7
  70. package/dist/compat/zustand/index.d.cts +4 -4
  71. package/dist/compat/zustand/index.d.ts +4 -4
  72. package/dist/compat/zustand/index.js +1 -1
  73. package/dist/{composite-_XckYx2e.d.cts → composite-CKd0e2vz.d.cts} +10 -3
  74. package/dist/{composite-CT_mApQD.d.ts → composite-DGatA-JK.d.ts} +10 -3
  75. package/dist/core/index.cjs +1 -1
  76. package/dist/core/index.d.cts +4 -4
  77. package/dist/core/index.d.ts +4 -4
  78. package/dist/core/index.js +1 -1
  79. package/dist/extra/browser.d.cts +1 -1
  80. package/dist/extra/browser.d.ts +1 -1
  81. package/dist/extra/index.cjs +17 -21
  82. package/dist/extra/index.d.cts +11 -9
  83. package/dist/extra/index.d.ts +11 -9
  84. package/dist/extra/index.js +1 -1
  85. package/dist/extra/node.cjs +2 -2
  86. package/dist/extra/node.d.cts +108 -2
  87. package/dist/extra/node.d.ts +108 -2
  88. package/dist/extra/node.js +2 -2
  89. package/dist/extra/operators.cjs +1 -1
  90. package/dist/extra/operators.d.cts +1 -1
  91. package/dist/extra/operators.d.ts +1 -1
  92. package/dist/extra/operators.js +1 -1
  93. package/dist/extra/reactive.cjs +1 -1
  94. package/dist/extra/reactive.d.cts +3 -3
  95. package/dist/extra/reactive.d.ts +3 -3
  96. package/dist/extra/reactive.js +1 -1
  97. package/dist/extra/render/index.cjs +5 -0
  98. package/dist/extra/render/index.d.cts +183 -0
  99. package/dist/extra/render/index.d.ts +183 -0
  100. package/dist/extra/render/index.js +1 -0
  101. package/dist/extra/sources.cjs +1 -1
  102. package/dist/extra/sources.d.cts +1 -1
  103. package/dist/extra/sources.d.ts +1 -1
  104. package/dist/extra/sources.js +1 -1
  105. package/dist/extra/storage-browser.d.cts +1 -1
  106. package/dist/extra/storage-browser.d.ts +1 -1
  107. package/dist/extra/storage-tiers-browser.d.cts +76 -5
  108. package/dist/extra/storage-tiers-browser.d.ts +76 -5
  109. package/dist/extra/storage-tiers-node.d.cts +137 -13
  110. package/dist/extra/storage-tiers-node.d.ts +137 -13
  111. package/dist/extra/storage-tiers.d.cts +151 -23
  112. package/dist/extra/storage-tiers.d.ts +151 -23
  113. package/dist/{fallback-axI2cXwt.d.cts → fallback-8JYU8tlT.d.cts} +1 -1
  114. package/dist/{fallback-DuEXfA4F.d.ts → fallback-CMZl39L5.d.ts} +1 -1
  115. package/dist/graph/index.cjs +7 -7
  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-YQXDndFy.d.ts → graph-30XSgtVX.d.ts} +287 -104
  120. package/dist/{graph-CaNXUc3c.d.cts → graph-BUwMAxJI.d.cts} +287 -104
  121. package/dist/{index-CIcu6fIR.d.ts → index-2n8Eai6M.d.ts} +1 -1
  122. package/dist/{index-BmLkcDlj.d.ts → index-89FczVZ_.d.ts} +47 -71
  123. package/dist/{index-Ci358GSC.d.cts → index-8R1vzNOx.d.cts} +9 -9
  124. package/dist/{index-CDvC1m5p.d.ts → index-B2RUoIUz.d.ts} +1 -1
  125. package/dist/{index-DuhOdNyg.d.ts → index-B41Asm7D.d.ts} +10 -8
  126. package/dist/{index-CKcnuQ2c.d.ts → index-B9fmw5n2.d.ts} +4 -6
  127. package/dist/{index-0qOD-421.d.ts → index-BAlaVimV.d.ts} +9 -9
  128. package/dist/{index-Ae6L8liv.d.ts → index-BC9VybQs.d.ts} +41 -48
  129. package/dist/{index-CUTHDZ7Q.d.ts → index-BEHmxORq.d.ts} +11 -11
  130. package/dist/{index-C_qi0WlF.d.cts → index-BJ26eEjs.d.cts} +26 -19
  131. package/dist/{index-BiomL7AW.d.ts → index-BJSZxSFX.d.ts} +1 -1
  132. package/dist/{index-DCAuN9u5.d.cts → index-BKMdnYnk.d.ts} +75 -39
  133. package/dist/{index-DfAo9WKr.d.ts → index-BM9szD8n.d.cts} +14 -6
  134. package/dist/{index-CajEOoAN.d.ts → index-BUPVld1w.d.ts} +2 -2
  135. package/dist/{index-C-pFD_FV.d.ts → index-BXd6OMEy.d.ts} +3 -3
  136. package/dist/index-BhUaMYm_.d.ts +113 -0
  137. package/dist/{index-DAKm44My.d.cts → index-BndG0cpK.d.cts} +3 -3
  138. package/dist/{index-Bpzw8hx3.d.ts → index-Br3WnqEn.d.ts} +84 -9
  139. package/dist/{index-D6tRNEKz.d.cts → index-BskfDoZ_.d.ts} +14 -6
  140. package/dist/{index-9mbs_PIG.d.ts → index-C19qqa38.d.ts} +4 -4
  141. package/dist/{index-fHKHdAso.d.ts → index-C7VV_qOs.d.ts} +4 -4
  142. package/dist/{index-CLPQyYY5.d.cts → index-CIRG8Hxp.d.cts} +11 -11
  143. package/dist/{index-B3D_z0Z6.d.cts → index-CL7oilfm.d.cts} +1 -1
  144. package/dist/{index-BOfHwQc1.d.ts → index-CPhBvRJU.d.ts} +1 -1
  145. package/dist/{index-B9qJmmv3.d.cts → index-CWHtYmSh.d.cts} +1 -1
  146. package/dist/{index-D_d1erkR.d.ts → index-Cey6VTnX.d.ts} +8 -5
  147. package/dist/{resilience-BWP2c7Af.d.cts → index-CmqiJZKM.d.ts} +141 -23
  148. package/dist/{index-JYtN9uqM.d.ts → index-CoM4rzyB.d.ts} +1 -1
  149. package/dist/{index-DTYIRT_v.d.cts → index-CpLpJb6A.d.cts} +8 -5
  150. package/dist/{index-BjWZARLy.d.ts → index-Ctb7_2sG.d.ts} +1 -1
  151. package/dist/index-CusEP3Sv.d.ts +210 -0
  152. package/dist/{resilience-Bys63Cpd.d.ts → index-CwP_KAMS.d.cts} +141 -23
  153. package/dist/{index-BFuVcqL8.d.cts → index-D3ayz3hy.d.cts} +1 -1
  154. package/dist/{index-CrpjECS6.d.cts → index-DCbE8fFM.d.cts} +3 -3
  155. package/dist/{index-D_DThl_J.d.cts → index-DIHcMLr6.d.cts} +1 -1
  156. package/dist/index-DINuaZlJ.d.cts +210 -0
  157. package/dist/{index-9xhIaM-w.d.cts → index-DOBLxOti.d.cts} +1 -1
  158. package/dist/index-DQUVq1_d.d.ts +374 -0
  159. package/dist/{index-B1IcU--K.d.cts → index-DTtBpuQy.d.cts} +4 -6
  160. package/dist/{index-D_QQ_dTD.d.cts → index-DYTBbF8T.d.cts} +1 -1
  161. package/dist/{index-DqtXA3yX.d.cts → index-DlgHqQxW.d.cts} +84 -9
  162. package/dist/{index-D1E1tqHT.d.ts → index-DlrWu9Hs.d.cts} +75 -39
  163. package/dist/{index-DcWbx58m.d.cts → index-DoYc8BWK.d.cts} +41 -48
  164. package/dist/{index-D0ZxFXYl.d.ts → index-DszPlZzK.d.ts} +3 -3
  165. package/dist/{index-BECJ8M0T.d.cts → index-DyM4tFAe.d.cts} +10 -8
  166. package/dist/{index-D11pGlaI.d.cts → index-FVoPvhAu.d.cts} +4 -4
  167. package/dist/{index-BwtIbzSV.d.cts → index-H_I66pav.d.cts} +2 -2
  168. package/dist/{index-e1m3ZHgc.d.cts → index-IwFqHxCs.d.cts} +2 -2
  169. package/dist/index-K-vl_c6A.d.cts +113 -0
  170. package/dist/{index-C4N-dg5U.d.cts → index-KlZ_ZUip.d.cts} +2 -2
  171. package/dist/index-L8XI8Zql.d.cts +374 -0
  172. package/dist/{index-D8IyqHvT.d.cts → index-MxYuWOrf.d.cts} +6 -4
  173. package/dist/{index-CpZKtdMw.d.cts → index-PgwvGWa1.d.cts} +1 -1
  174. package/dist/{index-B46GWgk3.d.ts → index-PlJ3MraE.d.ts} +1 -1
  175. package/dist/{index-DPqR3wdW.d.ts → index-PqbnoScQ.d.ts} +3 -3
  176. package/dist/{index-CU3z8Cel.d.cts → index-PsVHpPwP.d.cts} +3 -3
  177. package/dist/{index-C0tga1_x.d.ts → index-WyFKER-c.d.ts} +2 -2
  178. package/dist/{index-B5UR87KG.d.ts → index-eaQuGJnv.d.ts} +6 -4
  179. package/dist/{index-CzIWlnPp.d.ts → index-iTX5IqSP.d.ts} +140 -9
  180. package/dist/{index-CRycrNfn.d.ts → index-jKLph6cu.d.ts} +2 -2
  181. package/dist/{index-BhLA9feT.d.ts → index-jr6PuSBt.d.ts} +26 -19
  182. package/dist/{index-4IwO4mH2.d.cts → index-mNwgxC21.d.cts} +140 -9
  183. package/dist/{index-CkN8CZlT.d.cts → index-pVDQcbar.d.cts} +47 -71
  184. package/dist/{index-D6pwWiOc.d.cts → index-xZYcDqFH.d.cts} +4 -4
  185. package/dist/{index-8OxXae3g.d.ts → index-yLt-aPMp.d.ts} +1 -1
  186. package/dist/{index-CqSJ25A9.d.cts → index-z8WFPVI8.d.cts} +1 -1
  187. package/dist/index.cjs +64 -60
  188. package/dist/index.d.cts +48 -47
  189. package/dist/index.d.ts +48 -47
  190. package/dist/index.js +1 -1
  191. package/dist/meta-Ct9nqQS5.d.cts +102 -0
  192. package/dist/meta-D8OyedKp.d.ts +102 -0
  193. package/dist/{node-fSc-hCv8.d.cts → node-BYInONRr.d.cts} +3 -3
  194. package/dist/{node-fSc-hCv8.d.ts → node-BYInONRr.d.ts} +3 -3
  195. package/dist/{observable-Cqty11jG.d.cts → observable-DMIlYJV1.d.cts} +1 -1
  196. package/dist/{observable-EAV_rNfM.d.ts → observable-DO8DDEzv.d.ts} +1 -1
  197. package/dist/patterns/ai/browser.cjs +5 -5
  198. package/dist/patterns/ai/browser.d.cts +4 -4
  199. package/dist/patterns/ai/browser.d.ts +4 -4
  200. package/dist/patterns/ai/browser.js +1 -1
  201. package/dist/patterns/ai/index.cjs +17 -21
  202. package/dist/patterns/ai/index.d.cts +17 -17
  203. package/dist/patterns/ai/index.d.ts +17 -17
  204. package/dist/patterns/ai/index.js +1 -1
  205. package/dist/patterns/ai/node.cjs +1 -1
  206. package/dist/patterns/ai/node.d.cts +4 -4
  207. package/dist/patterns/ai/node.d.ts +4 -4
  208. package/dist/patterns/ai/node.js +1 -1
  209. package/dist/patterns/audit/index.cjs +3 -7
  210. package/dist/patterns/audit/index.d.cts +6 -6
  211. package/dist/patterns/audit/index.d.ts +6 -6
  212. package/dist/patterns/audit/index.js +1 -1
  213. package/dist/patterns/cqrs/index.cjs +3 -7
  214. package/dist/patterns/cqrs/index.d.cts +6 -6
  215. package/dist/patterns/cqrs/index.d.ts +6 -6
  216. package/dist/patterns/cqrs/index.js +1 -1
  217. package/dist/patterns/demo-shell/index.cjs +5 -8
  218. package/dist/patterns/demo-shell/index.d.cts +5 -5
  219. package/dist/patterns/demo-shell/index.d.ts +5 -5
  220. package/dist/patterns/demo-shell/index.js +1 -1
  221. package/dist/patterns/domain-templates/index.cjs +3 -7
  222. package/dist/patterns/domain-templates/index.d.cts +4 -4
  223. package/dist/patterns/domain-templates/index.d.ts +4 -4
  224. package/dist/patterns/domain-templates/index.js +1 -1
  225. package/dist/patterns/graphspec/index.cjs +38 -38
  226. package/dist/patterns/graphspec/index.d.cts +5 -5
  227. package/dist/patterns/graphspec/index.d.ts +5 -5
  228. package/dist/patterns/graphspec/index.js +1 -1
  229. package/dist/patterns/guarded-execution/index.cjs +3 -7
  230. package/dist/patterns/guarded-execution/index.d.cts +7 -7
  231. package/dist/patterns/guarded-execution/index.d.ts +7 -7
  232. package/dist/patterns/guarded-execution/index.js +1 -1
  233. package/dist/patterns/harness/index.cjs +8 -12
  234. package/dist/patterns/harness/index.d.cts +12 -12
  235. package/dist/patterns/harness/index.d.ts +12 -12
  236. package/dist/patterns/harness/index.js +1 -1
  237. package/dist/patterns/job-queue/index.cjs +3 -7
  238. package/dist/patterns/job-queue/index.d.cts +6 -6
  239. package/dist/patterns/job-queue/index.d.ts +6 -6
  240. package/dist/patterns/job-queue/index.js +1 -1
  241. package/dist/patterns/lens/index.cjs +3 -7
  242. package/dist/patterns/lens/index.d.cts +6 -6
  243. package/dist/patterns/lens/index.d.ts +6 -6
  244. package/dist/patterns/lens/index.js +1 -1
  245. package/dist/patterns/memory/index.cjs +3 -7
  246. package/dist/patterns/memory/index.d.cts +7 -5
  247. package/dist/patterns/memory/index.d.ts +7 -5
  248. package/dist/patterns/memory/index.js +1 -1
  249. package/dist/patterns/messaging/index.cjs +3 -7
  250. package/dist/patterns/messaging/index.d.cts +5 -5
  251. package/dist/patterns/messaging/index.d.ts +5 -5
  252. package/dist/patterns/messaging/index.js +1 -1
  253. package/dist/patterns/orchestration/index.cjs +3 -7
  254. package/dist/patterns/orchestration/index.d.cts +8 -8
  255. package/dist/patterns/orchestration/index.d.ts +8 -8
  256. package/dist/patterns/orchestration/index.js +1 -1
  257. package/dist/patterns/process/index.cjs +1 -1
  258. package/dist/patterns/process/index.d.cts +7 -7
  259. package/dist/patterns/process/index.d.ts +7 -7
  260. package/dist/patterns/process/index.js +1 -1
  261. package/dist/patterns/reactive-layout/index.cjs +4 -8
  262. package/dist/patterns/reactive-layout/index.d.cts +5 -5
  263. package/dist/patterns/reactive-layout/index.d.ts +5 -5
  264. package/dist/patterns/reactive-layout/index.js +1 -1
  265. package/dist/patterns/reduction/index.cjs +3 -7
  266. package/dist/patterns/reduction/index.d.cts +4 -4
  267. package/dist/patterns/reduction/index.d.ts +4 -4
  268. package/dist/patterns/reduction/index.js +1 -1
  269. package/dist/patterns/refine-loop/index.cjs +5 -9
  270. package/dist/patterns/refine-loop/index.d.cts +6 -6
  271. package/dist/patterns/refine-loop/index.d.ts +6 -6
  272. package/dist/patterns/refine-loop/index.js +1 -1
  273. package/dist/patterns/resilient-pipeline/index.cjs +1 -1
  274. package/dist/patterns/resilient-pipeline/index.d.cts +4 -8
  275. package/dist/patterns/resilient-pipeline/index.d.ts +4 -8
  276. package/dist/patterns/resilient-pipeline/index.js +1 -1
  277. package/dist/patterns/surface/index.cjs +13 -17
  278. package/dist/patterns/surface/index.d.cts +6 -6
  279. package/dist/patterns/surface/index.d.ts +6 -6
  280. package/dist/patterns/surface/index.js +1 -1
  281. package/dist/{pipeline-graph-BrrYGjuZ.d.cts → pipeline-graph-BQPr2Lqs.d.cts} +34 -17
  282. package/dist/{pipeline-graph-DX2Twdj-.d.ts → pipeline-graph-D8vKcO_p.d.ts} +34 -17
  283. package/dist/{reactive-layout-DrGjuwyC.d.cts → reactive-layout-8CSc0tiA.d.cts} +2 -2
  284. package/dist/{reactive-layout-BDdngW56.d.ts → reactive-layout-DkTXxtSy.d.ts} +2 -2
  285. package/dist/{reactive-log-jirQsxMY.d.ts → reactive-log-BlAsPLl2.d.ts} +30 -3
  286. package/dist/{reactive-log-ScpWyqny.d.cts → reactive-log-_zeEnB9H.d.cts} +30 -3
  287. package/dist/{reactive-map-DmgeADH8.d.cts → reactive-map-B2qfD3hb.d.cts} +1 -1
  288. package/dist/{reactive-map-CHyeCf4D.d.ts → reactive-map-jFIsE6Kt.d.ts} +1 -1
  289. package/dist/resilience-HTF2LBRS.js +1 -0
  290. package/dist/{sugar-D13E2M_z.d.ts → sugar-BhfjgetH.d.ts} +1 -1
  291. package/dist/{sugar-DgaGJcI6.d.cts → sugar-DzePN5-g.d.cts} +1 -1
  292. package/dist/{topology-tree-BkhmMg2a.d.cts → topology-tree-B5Ngw3j0.d.cts} +1 -1
  293. package/dist/{topology-tree-BI665P0L.d.ts → topology-tree-BtvbgMXJ.d.ts} +1 -1
  294. package/dist/{types-BMSGPlpO.d.cts → types-1Dhoi7HM.d.cts} +1 -1
  295. package/dist/{types-CidcBDuk.d.ts → types-39jk0kaV.d.ts} +1 -1
  296. package/package.json +11 -1
  297. package/dist/chunk-4EATTNAE.js +0 -1
  298. package/dist/chunk-533RQFF6.js +0 -1
  299. package/dist/chunk-6SVKZ7VI.js +0 -1
  300. package/dist/chunk-A5HZZYRK.js +0 -1
  301. package/dist/chunk-B4L5X2QO.js +0 -7
  302. package/dist/chunk-C5CBVOCB.js +0 -1
  303. package/dist/chunk-CZIQ6JCE.js +0 -1
  304. package/dist/chunk-FJ6IEMOS.js +0 -1
  305. package/dist/chunk-FMI4CWFL.js +0 -1
  306. package/dist/chunk-G6Q3DUMJ.js +0 -1
  307. package/dist/chunk-GDDPCDLG.js +0 -1
  308. package/dist/chunk-GFOT6UBB.js +0 -1
  309. package/dist/chunk-JJTF75VS.js +0 -1
  310. package/dist/chunk-K2WYIVHM.js +0 -1
  311. package/dist/chunk-KTWBUJO5.js +0 -61
  312. package/dist/chunk-M27MVZCP.js +0 -1
  313. package/dist/chunk-NKKUUKPD.js +0 -43
  314. package/dist/chunk-O32GJOUJ.js +0 -1
  315. package/dist/chunk-QKBCTKH7.js +0 -1
  316. package/dist/chunk-QWVQIL3T.js +0 -1
  317. package/dist/chunk-UODQF4EY.js +0 -1
  318. package/dist/chunk-WGST56ZH.js +0 -80
  319. package/dist/chunk-WSLN4JFO.js +0 -1
  320. package/dist/chunk-XIJKEXWR.js +0 -1
  321. package/dist/imperative-audit-ahAE65a9.d.cts +0 -28
  322. package/dist/imperative-audit-ahAE65a9.d.ts +0 -28
  323. package/dist/index-BCq12BqB.d.ts +0 -139
  324. package/dist/index-BokynmA4.d.cts +0 -186
  325. package/dist/index-DXz9uwcs.d.ts +0 -186
  326. package/dist/index-DbWwMWiB.d.cts +0 -139
  327. package/dist/meta-BGO6C7K9.d.cts +0 -41
  328. package/dist/meta-CC6EPdpK.d.ts +0 -41
  329. package/dist/resilience-OBU472D2.js +0 -1
@@ -1,2 +1,2 @@
1
- import{a as C,b as j,c as z,d as D,e as L,f as $,g as Q,h as I}from"../chunk-VN6RDSK2.js";import"../chunk-D5RFJOZ2.js";import"../chunk-CE72X3WO.js";import{x as M}from"../chunk-JJTF75VS.js";import"../chunk-4VVTGLXJ.js";import{d as m,e as s,f as _}from"../chunk-MQZWA3DF.js";import{F as T,p as O}from"../chunk-LYCLF26R.js";import{b as N,j as k}from"../chunk-CK2E7BTU.js";import{a as B}from"../chunk-QYADASLV.js";function J(c,w){let{pollMs:y=5e3,include:b,exclude:F,maxConsecutiveErrors:S=1}=w??{},x=b?.map(m)??[],E=F?.map(m)??[],{execFileSync:u}=B("child_process"),p=a=>u("git",a,{cwd:c,encoding:"utf-8"}).trim(),i,t=0;return M(_(0,{period:y}),()=>T(a=>{try{let e=p(["rev-parse","HEAD"]);if(!e)return t=0,()=>{};if(i===void 0)return i=e,t=0,()=>{};if(e===i)return t=0,()=>{};let r=p(["diff","--name-only",`${i}..${e}`]).split(`
2
- `).filter(Boolean);x.length>0&&(r=r.filter(l=>s(l,x))),E.length>0&&(r=r.filter(l=>!s(l,E)));let d=p(["log","-1","--format=%s",e]),v=p(["log","-1","--format=%an",e]);a.emit({hook:"post-commit",commit:e,files:r,message:d,author:v,timestamp_ns:O()}),i=e,t=0}catch(e){t+=1,t>=S&&a.down([[k,e]])}return()=>{}}))}import{existsSync as U,watch as V}from"fs";import{resolve as P}from"path";function X(c){return{describeKind:"producer",...c}}function de(c,w){let y=Array.isArray(c)?c:[c];if(y.length===0)throw new RangeError("fromFSWatch expects at least one path");let{recursive:b=!0,debounce:F=100,include:S,exclude:x,...E}=w??{},u=S?.map(m)??[],p=(x??["**/node_modules/**","**/.git/**","**/dist/**"]).map(m);return T(i=>{let t=new Map,a=[],e=!1,r=!1,d=0,v=()=>{for(let o of a.splice(0))o.close()},l=o=>{r||(r=!0,e=!0,n!==void 0&&clearTimeout(n),n=void 0,t.clear(),v(),i.down([[k,o]]))},n,W=o=>{if(n=void 0,e||r||t.size===0)return;let f=[];for(let g of t.values())f.push([N,g]);t.clear(),!(e||r||o!==d)&&i.down(f)};try{for(let o of y){let f=V(o,{recursive:b},(g,G)=>{if(e||r||G==null)return;let A=String(G).replaceAll("\\","/"),h=P(o,String(G)).replaceAll("\\","/"),q=P(o).replaceAll("\\","/"),R=A.startsWith("./")?A.slice(2):A;if(!(u.length===0||s(h,u)||s(R,u))||s(h,p)||s(R,p))return;let H="change";if(g==="rename")try{H=U(h)?"create":"delete"}catch{H="rename"}t.set(h,{type:H,path:h,root:q,relative_path:R,timestamp_ns:O()}),n!==void 0&&clearTimeout(n);let K=d;n=setTimeout(()=>W(K),F)});f.on("error",g=>l(g)),a.push(f)}}catch(o){l(o)}return()=>{e=!0,d+=1,n!==void 0&&clearTimeout(n),n=void 0,v(),t.clear()}},X(E))}export{D as fileAppendLog,C as fileBackend,Q as fileKv,z as fileSnapshot,de as fromFSWatch,J as fromGitHook,$ as sqliteAppendLog,j as sqliteBackend,I as sqliteKv,L as sqliteSnapshot};
1
+ import{a as K,b as j,c as I,d as D,e as z,f as $,g as Q,h as U}from"../chunk-VN6RDSK2.js";import"../chunk-D5RFJOZ2.js";import"../chunk-CE72X3WO.js";import{x as P}from"../chunk-L7WY6TZS.js";import"../chunk-4VVTGLXJ.js";import"../chunk-35JTVPOX.js";import{d as E,e as g,f as L}from"../chunk-IA7DUNGB.js";import{F as v,p as F}from"../chunk-LYCLF26R.js";import{b as y,i as B,j as x}from"../chunk-CK2E7BTU.js";import{a as q}from"../chunk-QYADASLV.js";function V(a,h){let{pollMs:o=5e3,include:c,exclude:e,maxConsecutiveErrors:t=1}=h??{},u=c?.map(E)??[],n=e?.map(E)??[],{execFileSync:d}=q("child_process"),r=S=>d("git",S,{cwd:a,encoding:"utf-8"}).trim(),l,i=0;return P(L(0,{period:o}),()=>v(S=>{try{let s=r(["rev-parse","HEAD"]);if(!s)return i=0,()=>{};if(l===void 0)return l=s,i=0,()=>{};if(s===l)return i=0,()=>{};let p=r(["diff","--name-only",`${l}..${s}`]).split(`
2
+ `).filter(Boolean);u.length>0&&(p=p.filter(w=>g(w,u))),n.length>0&&(p=p.filter(w=>!g(w,n)));let k=r(["log","-1","--format=%s",s]),T=r(["log","-1","--format=%an",s]);S.emit({hook:"post-commit",commit:s,files:p,message:k,author:T,timestamp_ns:F()}),l=s,i=0}catch(s){i+=1,i>=t&&S.down([[x,s]])}return()=>{}}))}import{existsSync as X,watch as Y}from"fs";import{resolve as _}from"path";function Z(a){return{describeKind:"producer",...a}}function Se(a,h){let o=Array.isArray(a)?a:[a];if(o.length===0)throw new RangeError("fromFSWatch expects at least one path");let{recursive:c=!0,debounce:e=100,include:t,exclude:u,...n}=h??{},d=t?.map(E)??[],r=(u??["**/node_modules/**","**/.git/**","**/dist/**"]).map(E);return v(l=>{let i=new Map,S=[],s=!1,p=!1,k=0,T=()=>{for(let f of S.splice(0))f.close()},w=f=>{p||(p=!0,s=!0,m!==void 0&&clearTimeout(m),m=void 0,i.clear(),T(),l.down([[x,f]]))},m,H=f=>{if(m=void 0,s||p||i.size===0)return;let O=[];for(let b of i.values())O.push([y,b]);i.clear(),!(s||p||f!==k)&&l.down(O)};try{for(let f of o){let O=Y(f,{recursive:c},(b,N)=>{if(s||p||N==null)return;let M=String(N).replaceAll("\\","/"),A=_(f,String(N)).replaceAll("\\","/"),J=_(f).replaceAll("\\","/"),R=M.startsWith("./")?M.slice(2):M;if(!(d.length===0||g(A,d)||g(R,d))||g(A,r)||g(R,r))return;let G="change";if(b==="rename")try{G=X(A)?"create":"delete"}catch{G="rename"}i.set(A,{type:G,path:A,root:J,relative_path:R,timestamp_ns:F()}),m!==void 0&&clearTimeout(m);let W=k;m=setTimeout(()=>H(W),e)});O.on("error",b=>w(b)),S.push(O)}}catch(f){w(f)}return()=>{s=!0,k+=1,m!==void 0&&clearTimeout(m),m=void 0,T(),i.clear()}},Z(n))}import{spawn as C}from"child_process";function ee(a,h,o){return v(c=>{let e=C(a,h,{cwd:o?.cwd,env:o?.env,shell:o?.shell,signal:o?.signal,stdio:o?.stdio??"pipe"}),t=!0,u=null;return e.stdout?.on("data",n=>{t&&c.down([[y,{kind:"stdout",chunk:n}]])}),e.stderr?.on("data",n=>{t&&c.down([[y,{kind:"stderr",chunk:n}]])}),e.on("error",n=>{t&&(t=!1,c.down([[x,n]]))}),e.on("exit",(n,d)=>{u==null&&(u={code:n,signal:d})}),e.on("close",()=>{if(!t)return;t=!1;let n=u??{code:null,signal:null};c.down([[y,{kind:"exit",code:n.code,signal:n.signal}],[B]])}),()=>{if(t){t=!1,e.stdout?.removeAllListeners(),e.stderr?.removeAllListeners(),e.removeAllListeners("error"),e.removeAllListeners("exit"),e.removeAllListeners("close");try{e.kill("SIGTERM")}catch{}}}},{name:"from_spawn"})}function te(a,h,o){return v(c=>{let e=C(a,h,{cwd:o?.cwd,env:o?.env,shell:o?.shell,signal:o?.signal,stdio:o?.stdio??"pipe"}),t=!0,u=[],n=[],d=null;return e.stdout?.on("data",r=>{t&&u.push(r)}),e.stderr?.on("data",r=>{t&&n.push(r)}),e.on("error",r=>{t&&(t=!1,c.down([[x,r]]))}),e.on("exit",(r,l)=>{d==null&&(d={code:r,signal:l})}),e.on("close",()=>{if(!t)return;t=!1;let r=d??{code:null,signal:null},l=Buffer.concat(u).toString("utf8"),i=Buffer.concat(n).toString("utf8");c.down([[y,{stdout:l,stderr:i,exitCode:r.code,signal:r.signal}],[B]])}),()=>{if(t){t=!1,e.stdout?.removeAllListeners(),e.stderr?.removeAllListeners(),e.removeAllListeners("error"),e.removeAllListeners("exit"),e.removeAllListeners("close");try{e.kill("SIGTERM")}catch{}}}},{name:"run_process"})}export{D as fileAppendLog,K as fileBackend,Q as fileKv,I as fileSnapshot,Se as fromFSWatch,V as fromGitHook,ee as fromSpawn,te as runProcess,$ as sqliteAppendLog,j as sqliteBackend,U as sqliteKv,z as sqliteSnapshot};
@@ -1 +1 @@
1
- "use strict";var oe=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var on=Object.getOwnPropertyNames;var sn=Object.prototype.hasOwnProperty;var A=(o,e)=>()=>(o&&(e=o(o=0)),e);var an=(o,e)=>{for(var t in e)oe(o,t,{get:e[t],enumerable:!0})},dn=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of on(e))!sn.call(o,n)&&n!==t&&oe(o,n,{get:()=>e[n],enumerable:!(r=rn(e,n))||r.enumerable});return o};var un=o=>dn(oe({},"__esModule",{value:!0}),o);function q(){return Math.trunc(performance.now()*1e6)}function ye(){return Date.now()*1e6}var se=A(()=>{"use strict"});var D,m,R,g,I,F,H,C,c,p,L,ie,ln,ae,cn,fn,de,ve,we,Ne,ue,W=A(()=>{"use strict";D=Symbol.for("graphrefly/START"),m=Symbol.for("graphrefly/DATA"),R=Symbol.for("graphrefly/DIRTY"),g=Symbol.for("graphrefly/RESOLVED"),I=Symbol.for("graphrefly/INVALIDATE"),F=Symbol.for("graphrefly/PAUSE"),H=Symbol.for("graphrefly/RESUME"),C=Symbol.for("graphrefly/TEARDOWN"),c=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),L=Object.freeze([R]),ie=Object.freeze([g]),ln=Object.freeze([I]),ae=Object.freeze([D]),cn=Object.freeze([c]),fn=Object.freeze([C]),de=Object.freeze([L]),ve=Object.freeze([ie]),we=Object.freeze([ln]),Ne=Object.freeze([cn]),ue=Object.freeze([fn])});function xe(o){o.registerCodec(pn)}var pn,Ee=A(()=>{"use strict";pn={name:"json",version:1,contentType:"application/json",encode(o){let e=JSON.stringify(o);return new TextEncoder().encode(e)},decode(o,e){let t=new TextDecoder().decode(o);return JSON.parse(t)}}});function K(o){if(o==null)return hn;let{type:e,id:t,...r}=o;return{type:e??"system",id:t??"",...r}}var hn,ke=A(()=>{"use strict";hn={type:"system",id:""}});function Me(){return le>0||mn}function Se(){return le>0}function De(o){le>0?gn.push(o):o()}function Y(o,e,t){if(e.length===0)return;if(e.length===1){let u=t(e[0][0]);if(u<3||!Me()){o(e);return}(u>=5?Re:u===4?Ae:Oe).push(()=>o(e));return}let r=e.length,n=r,s=r,a=r,i=0;for(;i<r&&t(e[i][0])<3;)i++;for(n=i;i<r&&t(e[i][0])===3;)i++;for(s=i;i<r&&t(e[i][0])===4;)i++;a=i;let d=Me();if(n>0){let u=e.slice(0,n);o(u)}if(s>n){let u=e.slice(n,s);d?Oe.push(()=>o(u)):o(u)}if(a>s){let u=e.slice(s,a);d?Ae.push(()=>o(u)):o(u)}if(r>a){let u=e.slice(a,r);d?Re.push(()=>o(u)):o(u)}}var le,mn,Oe,Ae,Re,gn,Ce=A(()=>{"use strict";le=0,mn=!1,Oe=[],Ae=[],Re=[],gn=[]});function Ie(o){o.registerMessageType(D,{tier:0,wireCrossing:!1}),o.registerMessageType(R,{tier:1,wireCrossing:!1}),o.registerMessageType(I,{tier:1,wireCrossing:!1,metaPassthrough:!1}),o.registerMessageType(F,{tier:2,wireCrossing:!1}),o.registerMessageType(H,{tier:2,wireCrossing:!1}),o.registerMessageType(m,{tier:3,wireCrossing:!0}),o.registerMessageType(g,{tier:3,wireCrossing:!0}),o.registerMessageType(c,{tier:4,wireCrossing:!0,metaPassthrough:!1}),o.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),o.registerMessageType(C,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var J,Fe=A(()=>{"use strict";W();J=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let r=this._messageTypes.get(t);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var G,Le=A(()=>{"use strict";G=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 ce(o){if(o===void 0)return null;if(typeof o=="number"){if(!Number.isFinite(o))throw new TypeError(`Cannot hash non-finite number: ${o}`);if(Number.isInteger(o)&&!Number.isSafeInteger(o))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${o}. Cross-language cid parity is not guaranteed for unsafe integers.`);return o}if(typeof o=="string"||typeof o=="boolean"||o===null)return o;if(Array.isArray(o))return o.map(ce);if(typeof o=="object"&&o!==null){let e={};for(let t of Object.keys(o).sort())e[t]=ce(o[t]);return e}return null}function _n(o){let e=Tn.encode(o),t=e.length,r=t*8,n=t+9+63&-64,s=new Uint8Array(n);s.set(e),s[t]=128;let a=new DataView(s.buffer);a.setUint32(n-4,r>>>0,!1),a.setUint32(n-8,Math.floor(r/4294967296)>>>0,!1);let i=1779033703,d=3144134277,u=1013904242,l=2773480762,f=1359893119,_=2600822924,T=528734635,w=1541459225,k=new Uint32Array(64),v=(O,x)=>O>>>x|O<<32-x;for(let O=0;O<n;O+=64){for(let E=0;E<16;E++)k[E]=a.getUint32(O+E*4,!1);for(let E=16;E<64;E++){let V=k[E-15],U=k[E-2],z=v(V,7)^v(V,18)^V>>>3,re=v(U,17)^v(U,19)^U>>>10;k[E]=k[E-16]+z+k[E-7]+re>>>0}let x=i,M=d,P=u,ne=l,S=f,j=_,$=T,te=w;for(let E=0;E<64;E++){let V=v(S,6)^v(S,11)^v(S,25),U=S&j^~S&$,z=te+V+U+bn[E]+k[E]>>>0,re=v(x,2)^v(x,13)^v(x,22),nn=x&M^x&P^M&P,tn=re+nn>>>0;te=$,$=j,j=S,S=ne+z>>>0,ne=P,P=M,M=x,x=z+tn>>>0}i=i+x>>>0,d=d+M>>>0,u=u+P>>>0,l=l+ne>>>0,f=f+S>>>0,_=_+j>>>0,T=T+$>>>0,w=w+te>>>0}let N=O=>O.toString(16).padStart(8,"0");return N(i)+N(d)+N(u)+N(l)+N(f)+N(_)+N(T)+N(w)}function fe(o){let e=ce(o??null),t=JSON.stringify(e);return _n(t).slice(0,16)}function yn(){let o=globalThis.crypto;if(o?.randomUUID)return o.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 pe(o,e,t){let r=t?.id??yn();if(o===0)return{id:r,version:0};let s=(t?.hash??fe)(e);return{id:r,version:0,cid:s,prev:null}}function Ge(o,e,t){o.version+=1,"cid"in o&&(o.prev=o.cid,o.cid=t(e))}var bn,Tn,Pe=A(()=>{"use strict";bn=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]),Tn=new TextEncoder});function He(o){return{node:o,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function he(o){o.prevData=void 0,o.dirty=!1,o.involvedThisWave=!1,o.dataBatch.length=0,o.terminal=void 0}function X(o){return o.length===0?o:typeof o[0]=="symbol"?[o]:o}function y(o,e,t){let r=We(o)?o:[],n=typeof o=="function"?o:typeof e=="function"?e:void 0,s={};return We(o)?s=(me(e)?e:t)??{}:me(o)?s=o:s=(me(e)?e:t)??{},new Z(r,n,s)}var Ve,Ue,vn,wn,ge,Z,We,me,be=A(()=>{"use strict";Ee();ke();Ce();se();Fe();Le();W();Pe();Ve=()=>{},Ue=100;vn=(o,e,t,r)=>{t.direction==="down-in"&&o._onDepMessage(t.depIndex,e)},wn=(o,e,t,r)=>{let n=o;if(n._status==="completed"||n._status==="errored")return;let s=n._cached,a=s===void 0?[ae]:[ae,[m,s]];n._status==="dirty"&&a.push(L),Y(e,a,n._config.tierOf)},ge=new J({onMessage:vn,onSubscribe:wn});Ie(ge);xe(ge);Z=class o{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,r){this._config=r.config??ge,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=t,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&t==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??fe;let n=r.versioning??this._config.defaultVersioning;this._versioningLevel=n,this._versioning=n!=null?pe(n,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(He);let s={};for(let[i,d]of Object.entries(r.meta??{})){let u={initial:d,name:`${r.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};r.guard!=null&&(u.guard=r.guard),s[i]=new o([],void 0,u)}Object.freeze(s),this.meta=s,this._hasMeta=Object.keys(s).length>0;let a=this;this._actions={emit(i){a._emit([[m,i]])},down(i){a._emit(X(i))},up(i){a._emitUp(X(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 r=this._versioningLevel;if(r!=null&&e<=r)return;let n=t?.hash??this._hashFn;n!==this._hashFn&&(this._hashFn=n);let s=this._cached===void 0?void 0:this._cached,a=this._versioning,i=a?.id??t?.id,d=a?.version??0,u=pe(e,s,{id:i,hash:n});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=K(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!t&&!r)return;let n=K(e?.actor),s=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(n,s))throw new G({actor:n,action:s,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(n,s))throw new G({actor:n,action:s,nodeName:this.name})}this._lastMutation={actor:n,timestamp_ns:ye()}}down(e,t){let r=X(e);r.length!==0&&(this._checkGuard(t),this._emit(r))}emit(e,t){this._checkGuard(t),this._emit([[m,e]])}up(e,t){if(this._deps.length===0)return;let r=X(e);if(r.length===0)return;this._checkGuard(t);let n=t??{internal:!0};this._validateUpTiers(r);for(let s of this._deps)s.node.up?.(r,n)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let r of e){let n=t(r[0]);if(n===3||n===4)throw new Error(`Node "${this.name}": tier-${n} 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=K(t);if(!this._guard(d,"observe"))throw new G({actor:d,action:"observe",nodeName:this.name})}let n=this._isTerminal&&this._resubscribable;if(n){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)he(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 s;try{s=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:n},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 s=="function")try{s()}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 s=="function"&&s(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let r=0;r<e;r++){let n=r,s=this._deps[r];s.unsub=Ve,s.unsub=s.node.subscribe(a=>{if(s.unsub===null)return;let i=this._config.tierOf,d=!1;for(let u of a)i(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:n},this._actions);d&&this._maybeRunFnOnSettlement()}),t++}}catch(r){this._deps[t].unsub=null;for(let n=0;n<t;n++){let s=this._deps[n];if(s.unsub!=null){let a=s.unsub;s.unsub=null;try{a()}catch{}he(s)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let n=0;n<this._deps.length;n++)if(this._deps[n].node===e)return n;let t=this._deps.length,r=He(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(de),r.unsub=Ve;try{r.unsub=e.subscribe(n=>{if(r.unsub===null)return;let s=this._config.tierOf,a=!1;for(let i of n)s(i[0])>=3&&(a=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:t},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(n){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,n}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(r){this._emit([[p,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(n){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",n)]])}}for(let r of this._deps){if(r.unsub!=null){let n=r.unsub;r.unsub=null;try{n()}catch{}}he(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let r=this._deps[e],n=t[0];if(this._inspectorHooks!=null){let s={kind:"dep_message",depIndex:e,message:t};for(let a of this._inspectorHooks)a(s)}if(n!==D){if(n===R){this._depDirtied(r);return}if(n===I){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(we);return}if(n===F||n===H){this._emit([t]);return}if(n===C){this._emit(ue);return}if(n===m)this._depSettledAsData(r,t[1]);else if(n===g)this._depSettledAsResolved(r);else if(n===c)this._depSettledAsTerminal(r,!0);else if(n===p)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(n===m||n===g)&&this._emit([t]),(n===c||n===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(de))}_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(ve),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(Ne)}_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),r=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 n=this._deps.map(a=>a.terminal),s={prevData:r,terminalDeps:n,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:t,prevData:r};for(let i of this._inspectorHooks)i(a)}this._isExecutingFn=!0;try{let a=this._fn(t,this._actions,s);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>Ue?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ue} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let r=t instanceof Error?t.message:String(t);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:t})}_frameBatch(e){let t=this._config.tierOf;if(e.length===1)return t(e[0][0])===3&&this._status!=="dirty"?[L,e[0]]:e;let r=!0,n=!1,s=!1,a=-1;for(let d of e){let u=t(d[0]);u<a&&(r=!1),u===3&&(n=!0),d[0]===R&&(s=!0),a=u}let i=e;if(!r){let d=e.map((u,l)=>({m:u,i:l,tier:t(u[0])}));d.sort((u,l)=>u.tier-l.tier||u.i-l.i),i=d.map(u=>u.m)}if(n&&!s&&this._status!=="dirty"){let d=0;for(;d<i.length&&t(i[d][0])===0;)d++;return d===0?[L,...i]:[...i.slice(0,d),L,...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]===C||d[0]===I);if(i.length===0)return;t=i}t=this._frameBatch(t);let n=null;for(let i=0;i<t.length;i++){let d=t[i],u=d[0];if(u!==F&&u!==H){n?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===F?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let f=d[1];if(u===F)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(f),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(f))l=!1;else if(this._pauseLocks.delete(f),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let _=this._pauseBuffer;this._pauseBuffer=[],this._emit(_)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?n?.push(d):n==null&&(n=t.slice(0,i))}if(n!=null){if(n.length===0)return;t=n}if(this._hasMeta&&t.some(i=>i[0]===C))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(ue)}catch{}let{finalMessages:s,equalsError:a}=this._updateState(t);if(s.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:s})}catch{}}if(s.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,d=[];for(let u of s)i(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(s);a!=null&&this._emit([[p,a]])}_updateState(e){let t=this._config.tierOf,r,n,s=-1,a=0;for(let l of e)t(l[0])===3&&a++;let i=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===m){d=l;break}}for(let l=0;l<e.length;l++){let f=e[l],_=f[0];if(_===m){if(f.length>=2){let T=!1;if(i&&this._cached!==void 0)try{T=this._equals(this._cached,f[1])}catch(w){n=this._wrapFnError("equals threw",w),s=l;break}if(T){r==null&&(r=e.slice(0,l)),r.push(ie),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(d<0||l===d)&&Ge(this._versioning,f[1],this._hashFn)}this._status="settled",r?.push(f)}else if(r?.push(f),_===R)this._status="dirty";else if(_===g)this._status="resolved";else if(_===c){this._status="completed";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===p){this._status="errored";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===I){if(this._cached!==void 0){let w=this._config.rigorRecorder;if(w!=null)try{w.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let T=this._cleanup;if(typeof T=="function"){this._cleanup=void 0;try{T()}catch{}}else if(T!=null&&typeof T=="object"){let w=T.invalidate;if(typeof w=="function")try{w()}catch{}}}else _===C&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=s>=0?r??e.slice(0,s):r??e;return n!=null?{finalMessages:u,equalsError:n}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let r of t)r(e)};_dispatchOrAccumulate(e){if(Se()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],De(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}Y(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);Y(this._deliverToSinks,t,this._config.tierOf)}},We=o=>Array.isArray(o),me=o=>typeof o=="object"&&o!=null&&!Array.isArray(o)});function b(o,e){return y((r,n,s)=>o(n,s)??void 0,{describeKind:"producer",...e})}function Be(o,e,t){return y(o,(n,s,a)=>{let i=n.map((d,u)=>d!=null&&d.length>0?d.at(-1):a.prevData[u]);s.emit(e(i,a))},{describeKind:"derived",...t})}var Te=A(()=>{"use strict";be()});function _e(o){return{describeKind:"producer",...o}}function je(o,e){return b(t=>{let r=!1;try{for(let n of o){if(r)return;t.emit(n)}r||t.down([[c]])}catch(n){r||t.down([[p,n]])}return()=>{r=!0}},_e(e))}function Nn(o){return o!=null&&typeof o.then=="function"}function xn(o,e){let{signal:t,...r}=e??{};return b(n=>{let s=!1,a=()=>{s||(s=!0,n.down([[p,t.reason]]))};if(t?.aborted){a();return}return t?.addEventListener("abort",a,{once:!0}),Promise.resolve(o).then(i=>{s||(s=!0,t?.removeEventListener("abort",a),n.emit(i),n.down([[c]]))},i=>{s||(s=!0,t?.removeEventListener("abort",a),n.down([[p,i]]))}),()=>{s=!0,t?.removeEventListener("abort",a)}},_e(r))}function En(o,e){let{signal:t,...r}=e??{};return b(n=>{let s=new AbortController,a=()=>s.abort(t?.reason);t?.aborted?s.abort(t.reason):t?.addEventListener("abort",a,{once:!0});let i=t??s.signal,d=!1,u=o[Symbol.asyncIterator](),l=()=>{d||i.aborted||Promise.resolve(u.next()).then(f=>{if(!(d||i.aborted)){if(f.done){n.down([[c]]);return}n.emit(f.value),l()}},f=>{!d&&!i.aborted&&n.down([[p,f]])})};return l(),()=>{d=!0,t?.removeEventListener("abort",a),s.abort(),Promise.resolve(u.return?.()).catch(()=>{})}},_e(r))}function kn(o){return o!=null&&typeof o=="object"&&"cache"in o&&typeof o.subscribe=="function"}function B(o,e){if(kn(o))return o;if(Nn(o))return xn(o,e);if(o!=null){let t=o;if(typeof t[Symbol.asyncIterator]=="function")return En(o,e);if(typeof t[Symbol.iterator]=="function")return je(o,e)}return On(o)}function On(...o){return je(o,void 0)}var $e=A(()=>{"use strict";W();Te()});var mt={};an(mt,{audit:()=>Qn,buffer:()=>nt,bufferCount:()=>tt,bufferTime:()=>ot,catchError:()=>ht,combine:()=>Je,combineLatest:()=>ct,concat:()=>$n,concatMap:()=>Yn,debounce:()=>Ze,debounceTime:()=>ft,delay:()=>Xn,distinctUntilChanged:()=>Un,elementAt:()=>Gn,exhaustMap:()=>Kn,filter:()=>qe,find:()=>Ln,first:()=>In,flatMap:()=>Jn,interval:()=>at,last:()=>Fn,map:()=>Rn,merge:()=>Bn,mergeMap:()=>Xe,onFirstData:()=>Ye,pairwise:()=>Hn,pausable:()=>ut,race:()=>zn,reduce:()=>Sn,repeat:()=>dt,rescue:()=>en,sample:()=>Zn,scan:()=>Mn,skip:()=>Ke,switchMap:()=>qn,take:()=>Q,takeUntil:()=>Cn,takeWhile:()=>Dn,tap:()=>Pn,tapFirst:()=>Vn,throttle:()=>Qe,throttleTime:()=>pt,timeout:()=>et,valve:()=>lt,window:()=>it,windowCount:()=>rt,windowTime:()=>st,withLatestFrom:()=>Wn,zip:()=>jn});module.exports=un(mt);se();W();be();Te();$e();function h(o){return{describeKind:"derived",...o}}function ze(o){return{describeKind:"derived",partial:!0,...o}}function Rn(o,e,t){return y([o],(r,n)=>{let s=r[0];if(s==null||s.length===0){n.down([[g]]);return}for(let a of s)n.emit(e(a))},h(t))}function qe(o,e,t){return y([o],(r,n)=>{let s=r[0];if(s==null||s.length===0){n.down([[g]]);return}let a=!1;for(let i of s)e(i)&&(n.emit(i),a=!0);a||n.down([[g]])},h(t))}function Mn(o,e,t,r){return y([o],(n,s,a)=>{"acc"in a.store||(a.store.acc=t);let i=n[0];if(i==null||i.length===0){s.down([[g]]);return}for(let d of i)a.store.acc=e(a.store.acc,d),s.emit(a.store.acc)},{...h(r),initial:t,resetOnTeardown:!0})}function Sn(o,e,t,r){return y([o],(n,s,a)=>{if("acc"in a.store||(a.store.acc=t),a.terminalDeps[0]===!0){s.emit(a.store.acc),s.down([[c]]);return}let i=n[0];if(i==null||i.length===0){s.down([[g]]);return}for(let d of i)a.store.acc=e(a.store.acc,d)},{...h(r),completeWhenDepsComplete:!1})}function Q(o,e,t){return e<=0?y([o],(r,n,s)=>{s.store.completed||(s.store.completed=!0,n.down([[c]]))},{...h(t),completeWhenDepsComplete:!1}):y([o],(r,n,s)=>{if("taken"in s.store||(s.store.taken=0),s.store.done){n.down([[g]]);return}if(s.terminalDeps[0]===!0){s.store.done=!0,n.down([[c]]);return}let a=r[0];if(a==null||a.length===0){n.down([[g]]);return}for(let i of a)if(s.store.taken++,n.emit(i),s.store.taken>=e){s.store.done=!0,n.down([[c]]);return}},{...h(t),completeWhenDepsComplete:!1})}function Ke(o,e,t){return y([o],(r,n,s)=>{"skipped"in s.store||(s.store.skipped=0);let a=r[0];if(a==null||a.length===0){n.down([[g]]);return}let i=!1;for(let d of a)s.store.skipped++,s.store.skipped<=e||(n.emit(d),i=!0);i||n.down([[g]])},h(t))}function Dn(o,e,t){return y([o],(r,n,s)=>{if(s.store.done){n.down([[g]]);return}let a=r[0];if(a==null||a.length===0){n.down([[g]]);return}for(let i of a){if(!e(i)){s.store.done=!0,n.down([[c]]);return}n.emit(i)}},{...h(t),completeWhenDepsComplete:!1})}function Cn(o,e,t){let r=t?.predicate??(a=>a[0]===m),{predicate:n,...s}=t??{};return b(a=>{let i=!1,d=o.subscribe(l=>{if(!i)for(let f of l){if(i)return;f[0]===m?a.emit(f[1]):(f[0]===c||f[0]===p)&&(i=!0,a.down([f]))}}),u=e.subscribe(l=>{if(!i)for(let f of l){if(i)return;if(r(f)){i=!0,a.down([[c]]);return}}});return()=>{d(),u()}},h(s))}function In(o,e){return Q(o,1,e)}function Fn(o,e){let{defaultValue:t,...r}=e??{},n=e!=null&&Object.hasOwn(e,"defaultValue");return y([o],(s,a,i)=>{if(i.terminalDeps[0]===!0){i.store.has?a.emit(i.store.latest):n&&a.emit(t),a.down([[c]]);return}let d=s[0];if(d==null||d.length===0){a.down([[g]]);return}i.store.latest=d.at(-1),i.store.has=!0},{...h(r),completeWhenDepsComplete:!1})}function Ln(o,e,t){return Q(qe(o,e,t),1,t)}function Gn(o,e,t){return Q(Ke(o,e,t),1,t)}function Pn(o,e,t){if(typeof e=="function")return y([o],(n,s)=>{let a=n[0];if(a==null||a.length===0){s.down([[g]]);return}for(let i of a)e(i),s.emit(i)},h(t));let r=e;return y([o],(n,s,a)=>{if(a.terminalDeps[0]!==void 0){a.terminalDeps[0]===!0?(r.complete?.(),s.down([[c]])):(r.error?.(a.terminalDeps[0]),s.down([[p,a.terminalDeps[0]]]));return}let i=n[0];if(i==null||i.length===0){s.down([[g]]);return}for(let d of i)r.data?.(d),s.emit(d)},{...h(t),completeWhenDepsComplete:!1})}function Ye(o,e,t){let r=t?.where??(s=>s!=null),n=!1;return y([o],(s,a)=>{let i=s[0];if(i==null||i.length===0){a.down([[g]]);return}for(let d of i)!n&&r(d)&&(n=!0,e(d)),a.emit(d)},h(t))}var Vn=Ye;function Un(o,e=Object.is,t){return y([o],(r,n,s)=>{let a=r[0];if(a==null||a.length===0){n.down([[g]]);return}let i=!1;for(let d of a)s.store.hasPrev&&e(s.store.prev,d)||(s.store.prev=d,s.store.hasPrev=!0,n.emit(d),i=!0);i||n.down([[g]])},h(t))}function Hn(o,e){return y([o],(t,r,n)=>{let s=t[0];if(s==null||s.length===0){r.down([[g]]);return}let a=!1;for(let i of s)if(!n.store.hasPrev)n.store.prev=i,n.store.hasPrev=!0;else{let d=[n.store.prev,i];n.store.prev=i,r.emit(d),a=!0}a||r.down([[g]])},h(e))}function Je(...o){let e=[...o];return Be(e,t=>t,{...h(),equals:(t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!Object.is(t[n],r[n]))return!1;return!0}})}function Wn(o,e,t){return y([o,e],(r,n,s)=>{let a=r[0],i=r[1],d=i!=null&&i.length>0?i.at(-1):s.prevData[1];if(a!=null&&a.length>0){if(!(i!=null&&i.length>0)&&s.prevData[1]===void 0){n.down([[g]]);return}for(let u of a)n.emit([u,d])}else n.down([[g]])},ze(t))}function Bn(...o){return o.length===0?b(e=>{e.down([[c]])},h()):b(e=>{let t=o.length,r=0,n=[];for(let s of o){let a=s.subscribe(i=>{for(let d of i)d[0]===m?e.emit(d[1]):d[0]===c?(r+=1,r>=t&&e.down([[c]])):d[0]===p&&e.down([d])});n.push(a)}return()=>{for(let s of n)s()}},h())}function jn(...o){let e=o.length;return e===0?b(t=>{t.emit([]),t.down([[c]])},h()):b(t=>{let r=Array.from({length:e},()=>[]),n=e;function s(){for(;r.every(i=>i.length>0);){let i=r.map(d=>d.shift());t.emit(i)}}let a=[];for(let i=0;i<e;i++){let d=i,u=o[i].subscribe(l=>{for(let f of l)f[0]===m?(r[d].push(f[1]),s()):f[0]===c?(n-=1,(n===0||r[d].length===0)&&t.down([[c]])):f[0]===p&&t.down([f])});a.push(u)}return()=>{for(let i of a)i()}},h())}function $n(o,e,t){return b(r=>{let n=0,s=[],a,i;return i=e.subscribe(d=>{for(let u of d)n===0?u[0]===m?s.push(u[1]):u[0]===p&&r.down([u]):u[0]===m?r.emit(u[1]):(u[0]===c||u[0]===p)&&r.down([u])}),a=o.subscribe(d=>{for(let u of d)if(n===0)if(u[0]===m)r.emit(u[1]);else if(u[0]===c){n=1;for(let l of s)r.emit(l);s.length=0}else u[0]===p&&r.down([u])}),()=>{a?.(),i?.()}},h(t))}function zn(...o){return o.length===0?b(e=>{e.down([[c]])},h()):o.length===1?y([o[0]],(e,t)=>{let r=e[0];if(r==null||r.length===0){t.down([[g]]);return}for(let n of r)t.emit(n)},h()):b(e=>{let t=null,r=[];for(let n=0;n<o.length;n++){let s=n,a=o[n].subscribe(i=>{for(let d of i){if(t!==null&&s!==t)return;d[0]===m?(t===null&&(t=s),e.emit(d[1])):(d[0]===c||d[0]===p)&&(t===null||s===t)&&e.down([d])}});r.push(a)}return()=>{for(let n of r)n()}},h())}function ee(o,e,t){let r,n=!1,s=()=>{n||(n=!0,t())};return r=o.subscribe(a=>{let i=!1,d=!1;for(let u of a)u[0]!==D&&(u[0]===m?e.emit(u[1]):u[0]===c?i=!0:u[0]===p?(d=!0,e.down([u])):(u[0]===R||u[0]===g)&&e.down([u]));d?(r?.(),r=void 0,s()):i&&s()}),()=>{r?.(),r=void 0}}function qn(o,e,t){let r,n=!1;function s(){r?.(),r=void 0}return y([o],(a,i,d)=>{if(d.terminalDeps[0]!=null&&d.terminalDeps[0]!==!0){s();return}if(d.terminalDeps[0]===!0){n=!0,r||i.down([[c]]);return}let u=a[0];if(!(u==null||u.length===0))return s(),r=ee(B(e(u[u.length-1])),i,()=>{s(),n&&i.down([[c]])}),{deactivate:()=>{s(),n=!1}}},{...h(t),completeWhenDepsComplete:!1})}function Kn(o,e,t){let r,n=!1;function s(){r?.(),r=void 0}return y([o],(a,i,d)=>{if(d.terminalDeps[0]!=null&&d.terminalDeps[0]!==!0){s();return}if(d.terminalDeps[0]===!0){n=!0,r||i.down([[c]]);return}let u=a[0];if(!(u==null||u.length===0))return r===void 0?r=ee(B(e(u[0])),i,()=>{s(),n&&i.down([[c]])}):i.down([[g]]),{deactivate:()=>{s(),n=!1}}},{...h(t),completeWhenDepsComplete:!1})}function Yn(o,e,t){let{maxBuffer:r,...n}=t??{},s=[],a,i=!1,d;function u(){a?.(),a=void 0}function l(){if(!d||a!==void 0)return;if(s.length===0){i&&d.down([[c]]);return}let _=s.shift();a=ee(B(e(_)),d,()=>{u(),l()})}function f(_){r&&r>0&&s.length>=r&&s.shift(),s.push(_),l()}return y([o],(_,T,w)=>{if(d=T,w.terminalDeps[0]!=null&&w.terminalDeps[0]!==!0){u(),s.length=0;return}if(w.terminalDeps[0]===!0){i=!0,l();return}let k=_[0];if(!(k==null||k.length===0)){for(let v of k)f(v);return{deactivate:()=>{u(),s.length=0,i=!1}}}},{...h(n),completeWhenDepsComplete:!1})}function Xe(o,e,t){let{concurrent:r,...n}=t??{},s=r!=null&&r>0?r:Number.POSITIVE_INFINITY,a=0,i=!1,d=new Set,u=[],l;function f(){i&&a===0&&u.length===0&&l&&l.down([[c]])}function _(v){if(!l)return;a++;let N;N=ee(B(e(v)),l,()=>{N&&d.delete(N),a--,T(),f()}),d.add(N)}function T(){for(;u.length>0&&a<s;)_(u.shift())}function w(v){a<s?_(v):u.push(v)}function k(){for(let v of d)v();d.clear(),a=0,u.length=0}return y([o],(v,N,O)=>{if(l=N,O.terminalDeps[0]!=null&&O.terminalDeps[0]!==!0){k();return}if(O.terminalDeps[0]===!0){i=!0,f();return}let x=v[0];if(!(x==null||x.length===0)){for(let M of x)w(M);return{deactivate:()=>{k(),i=!1}}}},{...h(n),completeWhenDepsComplete:!1})}var Jn=Xe;function Xn(o,e,t){return b(r=>{let n=new Set;function s(){for(let i of n)clearTimeout(i);n.clear()}let a=o.subscribe(i=>{for(let d of i)if(d[0]===m){let u=setTimeout(()=>{n.delete(u),r.emit(d[1])},e);n.add(u)}else if(d[0]===c){let u=setTimeout(()=>{n.delete(u),r.down([[c]])},e);n.add(u)}else d[0]===p&&(s(),r.down([d]))});return()=>{a(),s()}},h(t))}function Ze(o,e,t){return b(r=>{let n,s;function a(){n!==void 0&&(clearTimeout(n),n=void 0)}let i=o.subscribe(d=>{for(let u of d)u[0]===m?(a(),s=u[1],n=setTimeout(()=>{n=void 0,r.emit(s)},e)):u[0]===c?(n!==void 0&&(a(),r.emit(s)),r.down([[c]])):u[0]===p&&(a(),r.down([u]))});return()=>{i(),a()}},h(t))}function Qe(o,e,t){let{leading:r,trailing:n,...s}=t??{},a=r!==!1,i=n===!0,d=e*1e6;return b(u=>{let l,f=-1/0,_,T=!1;function w(){l!==void 0&&(clearTimeout(l),l=void 0)}let k=o.subscribe(v=>{for(let N of v)if(N[0]===m){let O=N[1],x=q();if(a&&x-f>=d)f=x,u.emit(O),w(),i&&(l=setTimeout(()=>{l=void 0,T&&(f=q(),u.emit(_),T=!1)},e));else if(i&&(_=O,T=!0,l===void 0)){let M=(x-f)/1e6;l=setTimeout(()=>{l=void 0,T&&(f=q(),u.emit(_),T=!1)},Math.max(0,e-M))}}else(N[0]===c||N[0]===p)&&(w(),u.down([N]))});return()=>{k(),w()}},h(s))}function Zn(o,e,t){return b(r=>{let n,s=!1,a=!1,i=o.subscribe(u=>{if(!s)for(let l of u){if(s)return;l[0]===m?n={v:l[1]}:l[0]===p?(s=!0,r.down([l])):l[0]===c&&(a=!0,n=void 0)}}),d=e.subscribe(u=>{if(!s)for(let l of u){if(s)return;l[0]===m?n!==void 0&&!a&&r.emit(n.v):l[0]===p?(s=!0,r.down([l])):l[0]===c&&(s=!0,r.down([[c]]))}});return()=>{i(),d()}},h(t))}function Qn(o,e,t){return b(r=>{let n,s,a=!1;function i(){n!==void 0&&(clearTimeout(n),n=void 0)}let d=o.subscribe(u=>{for(let l of u)l[0]===m?(s=l[1],a=!0,i(),n=setTimeout(()=>{n=void 0,a&&(a=!1,r.emit(s))},e)):(l[0]===c||l[0]===p)&&(i(),r.down([l]))});return()=>{d(),i()}},h(t))}function et(o,e,t){let{with:r,...n}=t??{},s=r??new Error("timeout");return b(a=>{let i;function d(){clearTimeout(i),i=setTimeout(()=>{i=void 0,a.down([[p,s]])},e)}d();let u=o.subscribe(l=>{for(let f of l)f[0]===m?(d(),a.emit(f[1])):(f[0]===c||f[0]===p)&&(clearTimeout(i),a.down([f]))});return()=>{u(),clearTimeout(i)}},h(n))}function nt(o,e,t){return b(r=>{let n=[],s=o.subscribe(i=>{for(let d of i)d[0]===m?n.push(d[1]):d[0]===c?(n.length>0&&r.emit([...n]),n.length=0,r.down([[c]])):d[0]===p&&r.down([d])}),a=e.subscribe(i=>{for(let d of i)d[0]===m?n.length>0&&(r.emit([...n]),n.length=0):d[0]===c?r.down([[c]]):d[0]===p&&r.down([d])});return()=>{s(),a(),n.length=0}},h(t))}function tt(o,e,t){if(e<=0)throw new RangeError("bufferCount expects count > 0");return b(r=>{let n=[],s=o.subscribe(a=>{for(let i of a)i[0]===m?(n.push(i[1]),n.length>=e&&r.emit(n.splice(0,n.length))):i[0]===c?(n.length>0&&r.emit([...n]),n.length=0,r.down([[c]])):i[0]===p&&r.down([i])});return()=>{s(),n.length=0}},h(t))}function rt(o,e,t){if(e<=0)throw new RangeError("windowCount expects count > 0");return b(r=>{let n,s=0;function a(){let d=b(u=>(n=u.down.bind(u),()=>{n=void 0}),h());s=0,r.emit(d)}let i=o.subscribe(d=>{for(let u of d)u[0]===m?(n||a(),n?.([[m,u[1]]]),s+=1,s>=e&&(n?.([[c]]),n=void 0)):u[0]===c?(n?.([[c]]),n=void 0,r.down([[c]])):u[0]===p&&(n?.([u]),n=void 0,r.down([u]))});return()=>{i(),n?.([[c]]),n=void 0}},h(t))}function ot(o,e,t){return b(r=>{let n=[],s=setInterval(()=>{n.length>0&&(r.emit([...n]),n.length=0)},e),a=o.subscribe(i=>{for(let d of i)d[0]===m?n.push(d[1]):d[0]===c?(clearInterval(s),n.length>0&&r.emit([...n]),n.length=0,r.down([[c]])):d[0]===p&&(clearInterval(s),r.down([d]))});return()=>{a(),clearInterval(s),n.length=0}},h(t))}function st(o,e,t){return b(r=>{let n;function s(){n?.([[c]]),n=void 0}function a(){let u=b(l=>(n=l.down.bind(l),()=>{n=void 0}),h());r.emit(u)}a();let i=setInterval(()=>{s(),a()},e),d=o.subscribe(u=>{for(let l of u)l[0]===m?n?.([[m,l[1]]]):l[0]===c?(clearInterval(i),s(),r.down([[c]])):l[0]===p&&(clearInterval(i),n?.([l]),s(),r.down([l]))});return()=>{d(),clearInterval(i),s()}},h(t))}function it(o,e,t){return b(r=>{let n;function s(){n?.([[c]]),n=void 0}function a(){let u=b(l=>(n=l.down.bind(l),()=>{n=void 0}),h());r.emit(u)}let i=o.subscribe(u=>{for(let l of u)l[0]===m?(n||a(),n?.([[m,l[1]]])):l[0]===c?(s(),r.down([[c]])):l[0]===p&&(n?.([l]),n=void 0,r.down([l]))}),d=e.subscribe(u=>{for(let l of u)l[0]===m&&(s(),a())});return()=>{i(),d(),s()}},h(t))}function at(o,e){return b((t,r)=>{"n"in r.store||(r.store.n=0);let n=setInterval(()=>{t.emit(r.store.n),r.store.n=r.store.n+1},o);return()=>clearInterval(n)},h(e))}function dt(o,e,t){if(e<=0)throw new RangeError("repeat expects count > 0");return b(r=>{let n=e,s,a=()=>{s?.(),s=o.subscribe(i=>{let d=!1,u=[];for(let l of i)l[0]===c?d=!0:u.push(l);u.length>0&&r.down(u),d&&(s?.(),s=void 0,n-=1,n>0?a():r.down([[c]]))})};return a(),()=>{s?.()}},h(t))}function ut(o,e){return y([o],(t,r)=>{let n=t[0];if(n==null||n.length===0){r.down([[g]]);return}for(let s of n)r.emit(s)},h(e))}function en(o,e,t){return b(r=>{let n=o.subscribe(s=>{for(let a of s)if(a[0]===m)r.emit(a[1]);else if(a[0]===p)try{r.emit(e(a[1]))}catch(i){r.down([[p,i]])}else a[0]===c&&r.down([[c]])});return()=>{n()}},h(t))}function lt(o,e,t){return y([o,e],(r,n,s)=>{let a=r[1];if(!(a!=null&&a.length>0?a.at(-1):s.prevData[1])){n.down([[g]]);return}let d=r[0];if(d!=null&&d.length>0){for(let u of d)n.emit(u);return}if(a!=null&&a.length>0&&s.prevData[0]!==void 0){n.emit(s.prevData[0]);return}n.down([[g]])},ze(t))}var ct=Je,ft=Ze,pt=Qe,ht=en;0&&(module.exports={audit,buffer,bufferCount,bufferTime,catchError,combine,combineLatest,concat,concatMap,debounce,debounceTime,delay,distinctUntilChanged,elementAt,exhaustMap,filter,find,first,flatMap,interval,last,map,merge,mergeMap,onFirstData,pairwise,pausable,race,reduce,repeat,rescue,sample,scan,skip,switchMap,take,takeUntil,takeWhile,tap,tapFirst,throttle,throttleTime,timeout,valve,window,windowCount,windowTime,withLatestFrom,zip});
1
+ "use strict";var se=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var R=(o,e)=>()=>(o&&(e=o(o=0)),e);var dt=(o,e)=>{for(var n in e)se(o,n,{get:e[n],enumerable:!0})},lt=(o,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of at(e))!ut.call(o,t)&&t!==n&&se(o,t,{get:()=>e[t],enumerable:!(r=it(e,t))||r.enumerable});return o};var ct=o=>lt(se({},"__esModule",{value:!0}),o);function q(){return Math.trunc(performance.now()*1e6)}function ve(){return Date.now()*1e6}var ie=R(()=>{"use strict"});var C,m,M,g,F,L,W,I,c,p,G,ae,ft,ue,pt,ht,de,we,Ne,xe,le,B=R(()=>{"use strict";C=Symbol.for("graphrefly/START"),m=Symbol.for("graphrefly/DATA"),M=Symbol.for("graphrefly/DIRTY"),g=Symbol.for("graphrefly/RESOLVED"),F=Symbol.for("graphrefly/INVALIDATE"),L=Symbol.for("graphrefly/PAUSE"),W=Symbol.for("graphrefly/RESUME"),I=Symbol.for("graphrefly/TEARDOWN"),c=Symbol.for("graphrefly/COMPLETE"),p=Symbol.for("graphrefly/ERROR"),G=Object.freeze([M]),ae=Object.freeze([g]),ft=Object.freeze([F]),ue=Object.freeze([C]),pt=Object.freeze([c]),ht=Object.freeze([I]),de=Object.freeze([G]),we=Object.freeze([ae]),Ne=Object.freeze([ft]),xe=Object.freeze([pt]),le=Object.freeze([ht])});var P,ke=R(()=>{"use strict";P=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`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 Ee(o){o.registerCodec(mt)}var mt,Oe=R(()=>{"use strict";mt={name:"json",version:1,contentType:"application/json",encode(o){let e=JSON.stringify(o);return new TextEncoder().encode(e)},decode(o,e){let n=new TextDecoder().decode(o);return JSON.parse(n)}}});function Y(o){if(o==null)return gt;let{type:e,id:n,...r}=o;return{type:e??"system",id:n??"",...r}}var gt,Ae=R(()=>{"use strict";gt={type:"system",id:""}});function Se(){return ce>0||bt}function Ce(){return ce>0}function Ie(o){ce>0?Tt.push(o):o()}function J(o,e,n){if(e.length===0)return;if(e.length===1){let d=n(e[0][0]);if(d<3||!Se()){o(e);return}(d>=5?De:d===4?Me:Re).push(()=>o(e));return}let r=e.length,t=r,s=r,a=r,i=0;for(;i<r&&n(e[i][0])<3;)i++;for(t=i;i<r&&n(e[i][0])===3;)i++;for(s=i;i<r&&n(e[i][0])===4;)i++;a=i;let u=Se();if(t>0){let d=e.slice(0,t);o(d)}if(s>t){let d=e.slice(t,s);u?Re.push(()=>o(d)):o(d)}if(a>s){let d=e.slice(s,a);u?Me.push(()=>o(d)):o(d)}if(r>a){let d=e.slice(a,r);u?De.push(()=>o(d)):o(d)}}var ce,bt,Re,Me,De,Tt,Fe=R(()=>{"use strict";ce=0,bt=!1,Re=[],Me=[],De=[],Tt=[]});function Le(o){o.registerMessageType(C,{tier:0,wireCrossing:!1}),o.registerMessageType(M,{tier:1,wireCrossing:!1}),o.registerMessageType(F,{tier:1,wireCrossing:!1,metaPassthrough:!1}),o.registerMessageType(L,{tier:2,wireCrossing:!1}),o.registerMessageType(W,{tier:2,wireCrossing:!1}),o.registerMessageType(m,{tier:3,wireCrossing:!0}),o.registerMessageType(g,{tier:3,wireCrossing:!0}),o.registerMessageType(c,{tier:4,wireCrossing:!0,metaPassthrough:!1}),o.registerMessageType(p,{tier:4,wireCrossing:!0,metaPassthrough:!1}),o.registerMessageType(I,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var X,Ge=R(()=>{"use strict";B();X=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let r=this._messageTypes.get(n);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.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 fe(o){if(o===void 0)return null;if(typeof o=="number"){if(!Number.isFinite(o))throw new TypeError(`Cannot hash non-finite number: ${o}`);if(Number.isInteger(o)&&!Number.isSafeInteger(o))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${o}. Cross-language cid parity is not guaranteed for unsafe integers.`);return o}if(typeof o=="string"||typeof o=="boolean"||o===null)return o;if(Array.isArray(o))return o.map(fe);if(typeof o=="object"&&o!==null){let e={};for(let n of Object.keys(o).sort())e[n]=fe(o[n]);return e}return null}function vt(o){let e=yt.encode(o),n=e.length,r=n*8,t=n+9+63&-64,s=new Uint8Array(t);s.set(e),s[n]=128;let a=new DataView(s.buffer);a.setUint32(t-4,r>>>0,!1),a.setUint32(t-8,Math.floor(r/4294967296)>>>0,!1);let i=1779033703,u=3144134277,d=1013904242,l=2773480762,f=1359893119,_=2600822924,T=528734635,w=1541459225,O=new Uint32Array(64),v=(A,x)=>A>>>x|A<<32-x;for(let A=0;A<t;A+=64){for(let k=0;k<16;k++)O[k]=a.getUint32(A+k*4,!1);for(let k=16;k<64;k++){let U=O[k-15],H=O[k-2],K=v(U,7)^v(U,18)^U>>>3,oe=v(H,17)^v(H,19)^H>>>10;O[k]=O[k-16]+K+O[k-7]+oe>>>0}let x=i,D=u,V=d,ne=l,S=f,z=_,$=T,re=w;for(let k=0;k<64;k++){let U=v(S,6)^v(S,11)^v(S,25),H=S&z^~S&$,K=re+U+H+_t[k]+O[k]>>>0,oe=v(x,2)^v(x,13)^v(x,22),ot=x&D^x&V^D&V,st=oe+ot>>>0;re=$,$=z,z=S,S=ne+K>>>0,ne=V,V=D,D=x,x=K+st>>>0}i=i+x>>>0,u=u+D>>>0,d=d+V>>>0,l=l+ne>>>0,f=f+S>>>0,_=_+z>>>0,T=T+$>>>0,w=w+re>>>0}let N=A=>A.toString(16).padStart(8,"0");return N(i)+N(u)+N(d)+N(l)+N(f)+N(_)+N(T)+N(w)}function pe(o){let e=fe(o??null),n=JSON.stringify(e);return vt(n).slice(0,16)}function wt(){let o=globalThis.crypto;if(o?.randomUUID)return o.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function he(o,e,n){let r=n?.id??wt();if(o===0)return{id:r,version:0};let s=(n?.hash??pe)(e);return{id:r,version:0,cid:s,prev:null}}function Pe(o,e,n){o.version+=1,"cid"in o&&(o.prev=o.cid,o.cid=n(e))}var _t,yt,Ve=R(()=>{"use strict";_t=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]),yt=new TextEncoder});function We(o){return{node:o,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function me(o){o.prevData=void 0,o.dirty=!1,o.involvedThisWave=!1,o.dataBatch.length=0,o.terminal=void 0}function Z(o){return o.length===0?o:typeof o[0]=="symbol"?[o]:o}function y(o,e,n){let r=Be(o)?o:[],t=typeof o=="function"?o:typeof e=="function"?e:void 0,s={};return Be(o)?s=(ge(e)?e:n)??{}:ge(o)?s=o:s=(ge(e)?e:n)??{},new Q(r,t,s)}var Ue,He,Nt,xt,be,Q,Be,ge,Te=R(()=>{"use strict";Oe();Ae();Fe();ie();Ge();ke();B();Ve();Ue=()=>{},He=100;Nt=(o,e,n,r)=>{n.direction==="down-in"&&o._onDepMessage(n.depIndex,e)},xt=(o,e,n,r)=>{let t=o;if(t._status==="completed"||t._status==="errored")return;let s=t._cached,a=s===void 0?[ue]:[ue,[m,s]];t._status==="dirty"&&a.push(G),J(e,a,t._config.tierOf)},be=new X({onMessage:Nt,onSubscribe:xt});Le(be);Ee(be);Q=class o{_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,n,r){this._config=r.config??be,this._config.onMessage,this._optsName=r.name,this._describeKind=r.describeKind,this._equals=r.equals??Object.is,this._resubscribable=r.resubscribable??!1,this._resetOnTeardown=r.resetOnTeardown??!1,this._autoComplete=r.completeWhenDepsComplete??!0,this._autoError=r.errorWhenDepsError??!0,this._pausable=r.pausable??!0,this._guard=r.guard,this._fn=n,this._partial=r.partial??!1,this._cached=r.initial!==void 0?r.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=r.versioningHash??this._config.defaultHashFn??pe;let t=r.versioning??this._config.defaultVersioning;this._versioningLevel=t,this._versioning=t!=null?he(t,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(We);let s={};for(let[i,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${i}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),s[i]=new o([],void 0,d)}Object.freeze(s),this.meta=s,this._hasMeta=Object.keys(s).length>0;let a=this;this._actions={emit(i){a._emit([[m,i]])},down(i){a._emit(Z(i))},up(i){a._emitUp(Z(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,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let t=n?.hash??this._hashFn;t!==this._hashFn&&(this._hashFn=t);let s=this._cached===void 0?void 0:this._cached,a=this._versioning,i=a?.id??n?.id,u=a?.version??0,d=he(e,s,{id:i,hash:t});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=Y(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!n&&!r)return;let t=Y(e?.actor),s=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(t,s))throw new P({actor:t,action:s,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(t,s))throw new P({actor:t,action:s,nodeName:this.name})}this._lastMutation={actor:t,timestamp_ns:ve()}}down(e,n){let r=Z(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[m,e]])}up(e,n){if(this._deps.length===0)return;let r=Z(e);if(r.length===0)return;this._checkGuard(n);let t=n??{internal:!0};this._validateUpTiers(r);for(let s of this._deps)s.node.up?.(r,t)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let r of e){let t=n(r[0]);if(t===3||t===4)throw new Error(`Node "${this.name}": tier-${t} 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,n){if(n!=null&&this._guard!=null){let u=Y(n);if(!this._guard(u,"observe"))throw new P({actor:u,action:"observe",nodeName:this.name})}let t=this._isTerminal&&this._resubscribable;if(t){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)me(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let s;try{s=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:t},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof s=="function")try{s()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let i=!1;return()=>{i||(i=!0,this._sinkCount-=1,this._removeSink(e),typeof s=="function"&&s(),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[n]=this._sinks;this._sinks=n}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,n=0;try{for(let r=0;r<e;r++){let t=r,s=this._deps[r];s.unsub=Ue,s.unsub=s.node.subscribe(a=>{if(s.unsub===null)return;let i=this._config.tierOf,u=!1;for(let d of a)i(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:t},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let t=0;t<n;t++){let s=this._deps[t];if(s.unsub!=null){let a=s.unsub;s.unsub=null;try{a()}catch{}me(s)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let t=0;t<this._deps.length;t++)if(this._deps[t].node===e)return t;let n=this._deps.length,r=We(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(de),r.unsub=Ue;try{r.unsub=e.subscribe(t=>{if(r.unsub===null)return;let s=this._config.tierOf,a=!1;for(let i of t)s(i[0])>=3&&(a=!0),this._config.onMessage(this,i,{direction:"down-in",depIndex:n},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(t){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,t}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(r){this._emit([[p,this._wrapFnError("cleanup threw",r)]])}else if(n!=null&&typeof n=="object"){let r=n.deactivate;if(typeof r=="function")try{r()}catch(t){this._emit([[p,this._wrapFnError("cleanup.deactivate threw",t)]])}}for(let r of this._deps){if(r.unsub!=null){let t=r.unsub;r.unsub=null;try{t()}catch{}}me(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let r=this._deps[e],t=n[0];if(this._inspectorHooks!=null){let s={kind:"dep_message",depIndex:e,message:n};for(let a of this._inspectorHooks)a(s)}if(t!==C){if(t===M){this._depDirtied(r);return}if(t===F){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Ne);return}if(t===L||t===W){this._emit([n]);return}if(t===I){this._emit(le);return}if(t===m)this._depSettledAsData(r,n[1]);else if(t===g)this._depSettledAsResolved(r);else if(t===c)this._depSettledAsTerminal(r,!0);else if(t===p)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(t===m||t===g)&&this._emit([n]),(t===c||t===p)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(de))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,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 n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(we),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[p,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(xe)}_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 n=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),r=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let i=n[a];i!=null&&i.length>0&&(this._deps[a].prevData=i[i.length-1])}let t=this._deps.map(a=>a.terminal),s={prevData:r,terminalDeps:t,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:n,prevData:r};for(let i of this._inspectorHooks)i(a)}this._isExecutingFn=!0;try{let a=this._fn(n,this._actions,s);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>He?(this._rerunDepth=0,this._emit([[p,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${He} \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,n){let r=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${r}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[G,e[0]]:e;let r=!0,t=!1,s=!1,a=-1;for(let u of e){let d=n(u[0]);d<a&&(r=!1),d===3&&(t=!0),u[0]===M&&(s=!0),a=d}let i=e;if(!r){let u=e.map((d,l)=>({m:d,i:l,tier:n(d[0])}));u.sort((d,l)=>d.tier-l.tier||d.i-l.i),i=u.map(d=>d.m)}if(t&&!s&&this._status!=="dirty"){let u=0;for(;u<i.length&&n(i[u][0])===0;)u++;return u===0?[G,...i]:[...i.slice(0,u),G,...i.slice(u)]}return i}_emit(e){if(e.length===0)return;for(let i=0;i<e.length;i++){let u=e[i];if(u[0]===p&&u[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let i=e.filter(u=>u[0]===I||u[0]===F);if(i.length===0)return;n=i}n=this._frameBatch(n);let t=null;for(let i=0;i<n.length;i++){let u=n[i],d=u[0];if(d!==L&&d!==W){t?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===L?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let l=!0;if(this._pausable!==!1){let f=u[1];if(d===L)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(f),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(f))l=!1;else if(this._pauseLocks.delete(f),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let _=this._pauseBuffer;this._pauseBuffer=[],this._emit(_)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}l?t?.push(u):t==null&&(t=n.slice(0,i))}if(t!=null){if(t.length===0)return;n=t}if(this._hasMeta&&n.some(i=>i[0]===I))for(let i of Object.keys(this.meta))try{this.meta[i]._emit(le)}catch{}let{finalMessages:s,equalsError:a}=this._updateState(n);if(s.length>0&&this._config.inspectorEnabled){let i=this._config.globalInspector;if(i!=null)try{i({kind:"emit",node:this,messages:s})}catch{}}if(s.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let i=this._config.tierOf,u=[];for(let d of s)i(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(s);a!=null&&this._emit([[p,a]])}_updateState(e){let n=this._config.tierOf,r,t,s=-1,a=0;for(let l of e)n(l[0])===3&&a++;let i=a<=1,u=-1;if(this._versioning!=null&&a>1){for(let l=e.length-1;l>=0;l--)if(e[l][0]===m){u=l;break}}for(let l=0;l<e.length;l++){let f=e[l],_=f[0];if(_===m){if(f.length>=2){let T=!1;if(i&&this._cached!==void 0)try{T=this._equals(this._cached,f[1])}catch(w){t=this._wrapFnError("equals threw",w),s=l;break}if(T){r==null&&(r=e.slice(0,l)),r.push(ae),this._status="resolved";continue}this._cached=f[1],this._versioning!=null&&(u<0||l===u)&&Pe(this._versioning,f[1],this._hashFn)}this._status="settled",r?.push(f)}else if(r?.push(f),_===M)this._status="dirty";else if(_===g)this._status="resolved";else if(_===c){this._status="completed";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===p){this._status="errored";{let T=this._config.rigorRecorder;if(T!=null)try{T.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(_===F){if(this._cached!==void 0){let w=this._config.rigorRecorder;if(w!=null)try{w.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let T=this._cleanup;if(typeof T=="function"){this._cleanup=void 0;try{T()}catch{}}else if(T!=null&&typeof T=="object"){let w=T.invalidate;if(typeof w=="function")try{w()}catch{}}}else _===I&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=s>=0?r??e.slice(0,s):r??e;return t!=null?{finalMessages:d,equalsError:t}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let r of n)r(e)};_dispatchOrAccumulate(e){if(Ce()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ie(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}J(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);J(this._deliverToSinks,n,this._config.tierOf)}},Be=o=>Array.isArray(o),ge=o=>typeof o=="object"&&o!=null&&!Array.isArray(o)});function E(o,e){let n={factory:o};return e!==void 0&&(n.factoryArgs=e),n}var je=R(()=>{"use strict"});function b(o,e){return y((r,t,s)=>o(t,s)??void 0,{describeKind:"producer",...e})}function ze(o,e,n){return y(o,(t,s,a)=>{let i=t.map((u,d)=>u!=null&&u.length>0?u.at(-1):a.prevData[d]);s.emit(e(i,a))},{describeKind:"derived",...n})}var _e=R(()=>{"use strict";Te()});function ye(o){return{describeKind:"producer",...o}}function $e(o,e){return b(n=>{let r=!1;try{for(let t of o){if(r)return;n.emit(t)}r||n.down([[c]])}catch(t){r||n.down([[p,t]])}return()=>{r=!0}},ye(e))}function kt(o){return o!=null&&typeof o.then=="function"}function Et(o,e){let{signal:n,...r}=e??{};return b(t=>{let s=!1,a=()=>{s||(s=!0,t.down([[p,n.reason]]))};if(n?.aborted){a();return}return n?.addEventListener("abort",a,{once:!0}),Promise.resolve(o).then(i=>{s||(s=!0,n?.removeEventListener("abort",a),t.emit(i),t.down([[c]]))},i=>{s||(s=!0,n?.removeEventListener("abort",a),t.down([[p,i]]))}),()=>{s=!0,n?.removeEventListener("abort",a)}},ye(r))}function Ot(o,e){let{signal:n,...r}=e??{};return b(t=>{let s=new AbortController,a=()=>s.abort(n?.reason);n?.aborted?s.abort(n.reason):n?.addEventListener("abort",a,{once:!0});let i=n??s.signal,u=!1,d=o[Symbol.asyncIterator](),l=()=>{u||i.aborted||Promise.resolve(d.next()).then(f=>{if(!(u||i.aborted)){if(f.done){t.down([[c]]);return}t.emit(f.value),l()}},f=>{!u&&!i.aborted&&t.down([[p,f]])})};return l(),()=>{u=!0,n?.removeEventListener("abort",a),s.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},ye(r))}function At(o){return o!=null&&typeof o=="object"&&"cache"in o&&typeof o.subscribe=="function"}function j(o,e){if(At(o))return o;if(kt(o))return Et(o,e);if(o!=null){let n=o;if(typeof n[Symbol.asyncIterator]=="function")return Ot(o,e);if(typeof n[Symbol.iterator]=="function")return $e(o,e)}return Rt(o)}function Rt(...o){return $e(o,void 0)}var Ke=R(()=>{"use strict";B();_e()});var qe=R(()=>{"use strict";Ke()});var Tn={};dt(Tn,{audit:()=>tn,buffer:()=>rn,bufferCount:()=>on,bufferTime:()=>an,catchError:()=>bn,combine:()=>Qe,combineLatest:()=>hn,concat:()=>Kt,concatMap:()=>Xt,debounce:()=>tt,debounceTime:()=>mn,delay:()=>Qt,distinctUntilChanged:()=>Wt,elementAt:()=>Vt,exhaustMap:()=>Jt,filter:()=>Je,find:()=>Pt,first:()=>Lt,flatMap:()=>Zt,interval:()=>ln,last:()=>Gt,map:()=>Dt,merge:()=>zt,mergeMap:()=>et,onFirstData:()=>Ze,pairwise:()=>Bt,pausable:()=>fn,race:()=>qt,reduce:()=>Ct,repeat:()=>cn,rescue:()=>rt,sample:()=>en,scan:()=>St,skip:()=>Xe,switchMap:()=>Yt,take:()=>ee,takeUntil:()=>Ft,takeWhile:()=>It,tap:()=>Ut,tapFirst:()=>Ht,throttle:()=>nt,throttleTime:()=>gn,timeout:()=>nn,valve:()=>pn,window:()=>dn,windowCount:()=>sn,windowTime:()=>un,withLatestFrom:()=>jt,zip:()=>$t});module.exports=ct(Tn);ie();B();je();Te();_e();qe();function h(o){return{describeKind:"derived",...o}}function Ye(o){return{describeKind:"derived",partial:!0,...o}}function Dt(o,e,n){return y([o],(r,t)=>{let s=r[0];if(s==null||s.length===0){t.down([[g]]);return}for(let a of s)t.emit(e(a))},{...h(n),meta:{...E("map"),...n?.meta??{}}})}function Je(o,e,n){return y([o],(r,t)=>{let s=r[0];if(s==null||s.length===0){t.down([[g]]);return}let a=!1;for(let i of s)e(i)&&(t.emit(i),a=!0);a||t.down([[g]])},{...h(n),meta:{...E("filter"),...n?.meta??{}}})}function St(o,e,n,r){return y([o],(t,s,a)=>{"acc"in a.store||(a.store.acc=n);let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)a.store.acc=e(a.store.acc,u),s.emit(a.store.acc)},{...h(r),initial:n,resetOnTeardown:!0,meta:{...E("scan",{initial:n}),...r?.meta??{}}})}function Ct(o,e,n,r){return y([o],(t,s,a)=>{if("acc"in a.store||(a.store.acc=n),a.terminalDeps[0]===!0){s.emit(a.store.acc),s.down([[c]]);return}let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)a.store.acc=e(a.store.acc,u)},{...h(r),completeWhenDepsComplete:!1,meta:{...E("reduce",{initial:n}),...r?.meta??{}}})}function ee(o,e,n){return e<=0?y([o],(r,t,s)=>{s.store.completed||(s.store.completed=!0,t.down([[c]]))},{...h(n),completeWhenDepsComplete:!1,meta:{...E("take",{count:e}),...n?.meta??{}}}):y([o],(r,t,s)=>{if("taken"in s.store||(s.store.taken=0),s.store.done){t.down([[g]]);return}if(s.terminalDeps[0]===!0){s.store.done=!0,t.down([[c]]);return}let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}for(let i of a)if(s.store.taken++,t.emit(i),s.store.taken>=e){s.store.done=!0,t.down([[c]]);return}},{...h(n),completeWhenDepsComplete:!1,meta:{...E("take",{count:e}),...n?.meta??{}}})}function Xe(o,e,n){return y([o],(r,t,s)=>{"skipped"in s.store||(s.store.skipped=0);let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}let i=!1;for(let u of a)s.store.skipped++,s.store.skipped<=e||(t.emit(u),i=!0);i||t.down([[g]])},h(n))}function It(o,e,n){return y([o],(r,t,s)=>{if(s.store.done){t.down([[g]]);return}let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}for(let i of a){if(!e(i)){s.store.done=!0,t.down([[c]]);return}t.emit(i)}},{...h(n),completeWhenDepsComplete:!1})}function Ft(o,e,n){let r=n?.predicate??(a=>a[0]===m),{predicate:t,...s}=n??{};return b(a=>{let i=!1,u=o.subscribe(l=>{if(!i)for(let f of l){if(i)return;f[0]===m?a.emit(f[1]):(f[0]===c||f[0]===p)&&(i=!0,a.down([f]))}}),d=e.subscribe(l=>{if(!i)for(let f of l){if(i)return;if(r(f)){i=!0,a.down([[c]]);return}}});return()=>{u(),d()}},h(s))}function Lt(o,e){return ee(o,1,e)}function Gt(o,e){let{defaultValue:n,...r}=e??{},t=e!=null&&Object.hasOwn(e,"defaultValue");return y([o],(s,a,i)=>{if(i.terminalDeps[0]===!0){i.store.has?a.emit(i.store.latest):t&&a.emit(n),a.down([[c]]);return}let u=s[0];if(u==null||u.length===0){a.down([[g]]);return}i.store.latest=u.at(-1),i.store.has=!0},{...h(r),completeWhenDepsComplete:!1})}function Pt(o,e,n){return ee(Je(o,e,n),1,n)}function Vt(o,e,n){return ee(Xe(o,e,n),1,n)}function Ut(o,e,n){if(typeof e=="function")return y([o],(t,s)=>{let a=t[0];if(a==null||a.length===0){s.down([[g]]);return}for(let i of a)e(i),s.emit(i)},{...h(n),meta:{...E("tap"),...n?.meta??{}}});let r=e;return y([o],(t,s,a)=>{if(a.terminalDeps[0]!==void 0){a.terminalDeps[0]===!0?(r.complete?.(),s.down([[c]])):(r.error?.(a.terminalDeps[0]),s.down([[p,a.terminalDeps[0]]]));return}let i=t[0];if(i==null||i.length===0){s.down([[g]]);return}for(let u of i)r.data?.(u),s.emit(u)},{...h(n),completeWhenDepsComplete:!1,meta:{...E("tap"),...n?.meta??{}}})}function Ze(o,e,n){let r=n?.where??(s=>s!=null),t=!1;return y([o],(s,a)=>{let i=s[0];if(i==null||i.length===0){a.down([[g]]);return}for(let u of i)!t&&r(u)&&(t=!0,e(u)),a.emit(u)},h(n))}var Ht=Ze;function Wt(o,e=Object.is,n){return y([o],(r,t,s)=>{let a=r[0];if(a==null||a.length===0){t.down([[g]]);return}let i=!1;for(let u of a)s.store.hasPrev&&e(s.store.prev,u)||(s.store.prev=u,s.store.hasPrev=!0,t.emit(u),i=!0);i||t.down([[g]])},{...h(n),meta:{...E("distinctUntilChanged"),...n?.meta??{}}})}function Bt(o,e){return y([o],(n,r,t)=>{let s=n[0];if(s==null||s.length===0){r.down([[g]]);return}let a=!1;for(let i of s)if(!t.store.hasPrev)t.store.prev=i,t.store.hasPrev=!0;else{let u=[t.store.prev,i];t.store.prev=i,r.emit(u),a=!0}a||r.down([[g]])},h(e))}function Qe(...o){let e=[...o];return ze(e,n=>n,{...h(),equals:(n,r)=>{if(n.length!==r.length)return!1;for(let t=0;t<n.length;t++)if(!Object.is(n[t],r[t]))return!1;return!0}})}function jt(o,e,n){return y([o,e],(r,t,s)=>{let a=r[0],i=r[1],u=i!=null&&i.length>0?i.at(-1):s.prevData[1];if(a!=null&&a.length>0){if(!(i!=null&&i.length>0)&&s.prevData[1]===void 0){t.down([[g]]);return}for(let d of a)t.emit([d,u])}else t.down([[g]])},{...Ye(n),meta:{...E("withLatestFrom"),...n?.meta??{}}})}function zt(...o){return o.length===0?b(e=>{e.down([[c]])},{...h(),meta:{...E("merge")}}):b(e=>{let n=o.length,r=0,t=[];for(let s of o){let a=s.subscribe(i=>{for(let u of i)u[0]===m?e.emit(u[1]):u[0]===c?(r+=1,r>=n&&e.down([[c]])):u[0]===p&&e.down([u])});t.push(a)}return()=>{for(let s of t)s()}},{...h(),meta:{...E("merge")}})}function $t(...o){let e=o.length;return e===0?b(n=>{n.emit([]),n.down([[c]])},h()):b(n=>{let r=Array.from({length:e},()=>[]),t=e;function s(){for(;r.every(i=>i.length>0);){let i=r.map(u=>u.shift());n.emit(i)}}let a=[];for(let i=0;i<e;i++){let u=i,d=o[i].subscribe(l=>{for(let f of l)f[0]===m?(r[u].push(f[1]),s()):f[0]===c?(t-=1,(t===0||r[u].length===0)&&n.down([[c]])):f[0]===p&&n.down([f])});a.push(d)}return()=>{for(let i of a)i()}},h())}function Kt(o,e,n){return b(r=>{let t=0,s=[],a,i;return i=e.subscribe(u=>{for(let d of u)t===0?d[0]===m?s.push(d[1]):d[0]===p&&r.down([d]):d[0]===m?r.emit(d[1]):(d[0]===c||d[0]===p)&&r.down([d])}),a=o.subscribe(u=>{for(let d of u)if(t===0)if(d[0]===m)r.emit(d[1]);else if(d[0]===c){t=1;for(let l of s)r.emit(l);s.length=0}else d[0]===p&&r.down([d])}),()=>{a?.(),i?.()}},h(n))}function qt(...o){return o.length===0?b(e=>{e.down([[c]])},h()):o.length===1?y([o[0]],(e,n)=>{let r=e[0];if(r==null||r.length===0){n.down([[g]]);return}for(let t of r)n.emit(t)},h()):b(e=>{let n=null,r=[];for(let t=0;t<o.length;t++){let s=t,a=o[t].subscribe(i=>{for(let u of i){if(n!==null&&s!==n)return;u[0]===m?(n===null&&(n=s),e.emit(u[1])):(u[0]===c||u[0]===p)&&(n===null||s===n)&&e.down([u])}});r.push(a)}return()=>{for(let t of r)t()}},h())}function te(o,e,n){let r,t=!1,s=()=>{t||(t=!0,n())};return r=o.subscribe(a=>{let i=!1,u=!1;for(let d of a)d[0]!==C&&(d[0]===m?e.emit(d[1]):d[0]===c?i=!0:d[0]===p?(u=!0,e.down([d])):(d[0]===M||d[0]===g)&&e.down([d]));u?(r?.(),r=void 0,s()):i&&s()}),()=>{r?.(),r=void 0}}function Yt(o,e,n){let r,t=!1;function s(){r?.(),r=void 0}return y([o],(a,i,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){s();return}if(u.terminalDeps[0]===!0){t=!0,r||i.down([[c]]);return}let d=a[0];if(!(d==null||d.length===0))return s(),r=te(j(e(d[d.length-1])),i,()=>{s(),t&&i.down([[c]])}),{deactivate:()=>{s(),t=!1}}},{...h(n),completeWhenDepsComplete:!1,meta:{...E("switchMap"),...n?.meta??{}}})}function Jt(o,e,n){let r,t=!1;function s(){r?.(),r=void 0}return y([o],(a,i,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){s();return}if(u.terminalDeps[0]===!0){t=!0,r||i.down([[c]]);return}let d=a[0];if(!(d==null||d.length===0))return r===void 0?r=te(j(e(d[0])),i,()=>{s(),t&&i.down([[c]])}):i.down([[g]]),{deactivate:()=>{s(),t=!1}}},{...h(n),completeWhenDepsComplete:!1})}function Xt(o,e,n){let{maxBuffer:r,...t}=n??{},s=[],a,i=!1,u;function d(){a?.(),a=void 0}function l(){if(!u||a!==void 0)return;if(s.length===0){i&&u.down([[c]]);return}let _=s.shift();a=te(j(e(_)),u,()=>{d(),l()})}function f(_){r&&r>0&&s.length>=r&&s.shift(),s.push(_),l()}return y([o],(_,T,w)=>{if(u=T,w.terminalDeps[0]!=null&&w.terminalDeps[0]!==!0){d(),s.length=0;return}if(w.terminalDeps[0]===!0){i=!0,l();return}let O=_[0];if(!(O==null||O.length===0)){for(let v of O)f(v);return{deactivate:()=>{d(),s.length=0,i=!1}}}},{...h(t),completeWhenDepsComplete:!1})}function et(o,e,n){let{concurrent:r,...t}=n??{},s=r!=null&&r>0?r:Number.POSITIVE_INFINITY,a=0,i=!1,u=new Set,d=[],l;function f(){i&&a===0&&d.length===0&&l&&l.down([[c]])}function _(v){if(!l)return;a++;let N;N=te(j(e(v)),l,()=>{N&&u.delete(N),a--,T(),f()}),u.add(N)}function T(){for(;d.length>0&&a<s;)_(d.shift())}function w(v){a<s?_(v):d.push(v)}function O(){for(let v of u)v();u.clear(),a=0,d.length=0}return y([o],(v,N,A)=>{if(l=N,A.terminalDeps[0]!=null&&A.terminalDeps[0]!==!0){O();return}if(A.terminalDeps[0]===!0){i=!0,f();return}let x=v[0];if(!(x==null||x.length===0)){for(let D of x)w(D);return{deactivate:()=>{O(),i=!1}}}},{...h(t),completeWhenDepsComplete:!1})}var Zt=et;function Qt(o,e,n){return b(r=>{let t=new Set;function s(){for(let i of t)clearTimeout(i);t.clear()}let a=o.subscribe(i=>{for(let u of i)if(u[0]===m){let d=setTimeout(()=>{t.delete(d),r.emit(u[1])},e);t.add(d)}else if(u[0]===c){let d=setTimeout(()=>{t.delete(d),r.down([[c]])},e);t.add(d)}else u[0]===p&&(s(),r.down([u]))});return()=>{a(),s()}},h(n))}function tt(o,e,n){return b(r=>{let t,s;function a(){t!==void 0&&(clearTimeout(t),t=void 0)}let i=o.subscribe(u=>{for(let d of u)d[0]===m?(a(),s=d[1],t=setTimeout(()=>{t=void 0,r.emit(s)},e)):d[0]===c?(t!==void 0&&(a(),r.emit(s)),r.down([[c]])):d[0]===p&&(a(),r.down([d]))});return()=>{i(),a()}},{...h(n),meta:{...E("debounce",{ms:e}),...n?.meta??{}}})}function nt(o,e,n){let{leading:r,trailing:t,...s}=n??{},a=r!==!1,i=t===!0,u=e*1e6;return b(d=>{let l,f=-1/0,_,T=!1;function w(){l!==void 0&&(clearTimeout(l),l=void 0)}let O=o.subscribe(v=>{for(let N of v)if(N[0]===m){let A=N[1],x=q();if(a&&x-f>=u)f=x,d.emit(A),w(),i&&(l=setTimeout(()=>{l=void 0,T&&(f=q(),d.emit(_),T=!1)},e));else if(i&&(_=A,T=!0,l===void 0)){let D=(x-f)/1e6;l=setTimeout(()=>{l=void 0,T&&(f=q(),d.emit(_),T=!1)},Math.max(0,e-D))}}else(N[0]===c||N[0]===p)&&(w(),d.down([N]))});return()=>{O(),w()}},{...h(s),meta:{...E("throttle",{ms:e,leading:a,trailing:i}),...s.meta??{}}})}function en(o,e,n){return b(r=>{let t,s=!1,a=!1,i=o.subscribe(d=>{if(!s)for(let l of d){if(s)return;l[0]===m?t={v:l[1]}:l[0]===p?(s=!0,r.down([l])):l[0]===c&&(a=!0,t=void 0)}}),u=e.subscribe(d=>{if(!s)for(let l of d){if(s)return;l[0]===m?t!==void 0&&!a&&r.emit(t.v):l[0]===p?(s=!0,r.down([l])):l[0]===c&&(s=!0,r.down([[c]]))}});return()=>{i(),u()}},h(n))}function tn(o,e,n){return b(r=>{let t,s,a=!1;function i(){t!==void 0&&(clearTimeout(t),t=void 0)}let u=o.subscribe(d=>{for(let l of d)l[0]===m?(s=l[1],a=!0,i(),t=setTimeout(()=>{t=void 0,a&&(a=!1,r.emit(s))},e)):(l[0]===c||l[0]===p)&&(i(),r.down([l]))});return()=>{u(),i()}},h(n))}function nn(o,e,n){let{with:r,...t}=n??{},s=r??new Error("timeout");return b(a=>{let i;function u(){clearTimeout(i),i=setTimeout(()=>{i=void 0,a.down([[p,s]])},e)}u();let d=o.subscribe(l=>{for(let f of l)f[0]===m?(u(),a.emit(f[1])):(f[0]===c||f[0]===p)&&(clearTimeout(i),a.down([f]))});return()=>{d(),clearTimeout(i)}},h(t))}function rn(o,e,n){return b(r=>{let t=[],s=o.subscribe(i=>{for(let u of i)u[0]===m?t.push(u[1]):u[0]===c?(t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):u[0]===p&&r.down([u])}),a=e.subscribe(i=>{for(let u of i)u[0]===m?t.length>0&&(r.emit([...t]),t.length=0):u[0]===c?r.down([[c]]):u[0]===p&&r.down([u])});return()=>{s(),a(),t.length=0}},h(n))}function on(o,e,n){if(e<=0)throw new RangeError("bufferCount expects count > 0");return b(r=>{let t=[],s=o.subscribe(a=>{for(let i of a)i[0]===m?(t.push(i[1]),t.length>=e&&r.emit(t.splice(0,t.length))):i[0]===c?(t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):i[0]===p&&r.down([i])});return()=>{s(),t.length=0}},h(n))}function sn(o,e,n){if(e<=0)throw new RangeError("windowCount expects count > 0");return b(r=>{let t,s=0;function a(){let u=b(d=>(t=d.down.bind(d),()=>{t=void 0}),h());s=0,r.emit(u)}let i=o.subscribe(u=>{for(let d of u)d[0]===m?(t||a(),t?.([[m,d[1]]]),s+=1,s>=e&&(t?.([[c]]),t=void 0)):d[0]===c?(t?.([[c]]),t=void 0,r.down([[c]])):d[0]===p&&(t?.([d]),t=void 0,r.down([d]))});return()=>{i(),t?.([[c]]),t=void 0}},h(n))}function an(o,e,n){return b(r=>{let t=[],s=setInterval(()=>{t.length>0&&(r.emit([...t]),t.length=0)},e),a=o.subscribe(i=>{for(let u of i)u[0]===m?t.push(u[1]):u[0]===c?(clearInterval(s),t.length>0&&r.emit([...t]),t.length=0,r.down([[c]])):u[0]===p&&(clearInterval(s),r.down([u]))});return()=>{a(),clearInterval(s),t.length=0}},{...h(n),meta:{...E("bufferTime",{ms:e}),...n?.meta??{}}})}function un(o,e,n){return b(r=>{let t;function s(){t?.([[c]]),t=void 0}function a(){let d=b(l=>(t=l.down.bind(l),()=>{t=void 0}),h());r.emit(d)}a();let i=setInterval(()=>{s(),a()},e),u=o.subscribe(d=>{for(let l of d)l[0]===m?t?.([[m,l[1]]]):l[0]===c?(clearInterval(i),s(),r.down([[c]])):l[0]===p&&(clearInterval(i),t?.([l]),s(),r.down([l]))});return()=>{u(),clearInterval(i),s()}},h(n))}function dn(o,e,n){return b(r=>{let t;function s(){t?.([[c]]),t=void 0}function a(){let d=b(l=>(t=l.down.bind(l),()=>{t=void 0}),h());r.emit(d)}let i=o.subscribe(d=>{for(let l of d)l[0]===m?(t||a(),t?.([[m,l[1]]])):l[0]===c?(s(),r.down([[c]])):l[0]===p&&(t?.([l]),t=void 0,r.down([l]))}),u=e.subscribe(d=>{for(let l of d)l[0]===m&&(s(),a())});return()=>{i(),u(),s()}},h(n))}function ln(o,e){return b((n,r)=>{"n"in r.store||(r.store.n=0);let t=setInterval(()=>{n.emit(r.store.n),r.store.n=r.store.n+1},o);return()=>clearInterval(t)},h(e))}function cn(o,e,n){if(e<=0)throw new RangeError("repeat expects count > 0");return b(r=>{let t=e,s,a=()=>{s?.(),s=o.subscribe(i=>{let u=!1,d=[];for(let l of i)l[0]===c?u=!0:d.push(l);d.length>0&&r.down(d),u&&(s?.(),s=void 0,t-=1,t>0?a():r.down([[c]]))})};return a(),()=>{s?.()}},h(n))}function fn(o,e){return y([o],(n,r)=>{let t=n[0];if(t==null||t.length===0){r.down([[g]]);return}for(let s of t)r.emit(s)},h(e))}function rt(o,e,n){return b(r=>{let t=o.subscribe(s=>{for(let a of s)if(a[0]===m)r.emit(a[1]);else if(a[0]===p)try{r.emit(e(a[1]))}catch(i){r.down([[p,i]])}else a[0]===c&&r.down([[c]])});return()=>{t()}},h(n))}function pn(o,e,n){return y([o,e],(r,t,s)=>{let a=r[1];if(!(a!=null&&a.length>0?a.at(-1):s.prevData[1])){t.down([[g]]);return}let u=r[0];if(u!=null&&u.length>0){for(let d of u)t.emit(d);return}if(a!=null&&a.length>0&&s.prevData[0]!==void 0){t.emit(s.prevData[0]);return}t.down([[g]])},Ye(n))}var hn=Qe,mn=tt,gn=nt,bn=rt;0&&(module.exports={audit,buffer,bufferCount,bufferTime,catchError,combine,combineLatest,concat,concatMap,debounce,debounceTime,delay,distinctUntilChanged,elementAt,exhaustMap,filter,find,first,flatMap,interval,last,map,merge,mergeMap,onFirstData,pairwise,pausable,race,reduce,repeat,rescue,sample,scan,skip,switchMap,take,takeUntil,takeWhile,tap,tapFirst,throttle,throttleTime,timeout,valve,window,windowCount,windowTime,withLatestFrom,zip});
@@ -1,4 +1,4 @@
1
- import { N as NodeOptions, a as Node, M as Message } from '../node-fSc-hCv8.cjs';
1
+ import { a as NodeOptions, N as Node, t as Message } from '../node-BYInONRr.cjs';
2
2
  import { NodeInput } from './sources.cjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { N as NodeOptions, a as Node, M as Message } from '../node-fSc-hCv8.js';
1
+ import { a as NodeOptions, N as Node, t as Message } from '../node-BYInONRr.js';
2
2
  import { NodeInput } from './sources.js';
3
3
 
4
4
  /**
@@ -1 +1 @@
1
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-JJTF75VS.js";import"../chunk-4VVTGLXJ.js";import"../chunk-MQZWA3DF.js";import"../chunk-LYCLF26R.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{G as audit,I as buffer,J as bufferCount,L as bufferTime,W as catchError,r as combine,T as combineLatest,v as concat,z as concatMap,D as debounce,U as debounceTime,C as delay,p as distinctUntilChanged,l as elementAt,y as exhaustMap,b as filter,k as find,i as first,B as flatMap,O as interval,j as last,a as map,t as merge,A as mergeMap,n as onFirstData,q as pairwise,Q as pausable,w as race,d as reduce,P as repeat,R as rescue,F as sample,c as scan,f as skip,x as switchMap,e as take,h as takeUntil,g as takeWhile,m as tap,o as tapFirst,E as throttle,V as throttleTime,H as timeout,S as valve,N as window,K as windowCount,M as windowTime,s as withLatestFrom,u as zip};
1
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-L7WY6TZS.js";import"../chunk-4VVTGLXJ.js";import"../chunk-35JTVPOX.js";import"../chunk-IA7DUNGB.js";import"../chunk-LYCLF26R.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{G as audit,I as buffer,J as bufferCount,L as bufferTime,W as catchError,r as combine,T as combineLatest,v as concat,z as concatMap,D as debounce,U as debounceTime,C as delay,p as distinctUntilChanged,l as elementAt,y as exhaustMap,b as filter,k as find,i as first,B as flatMap,O as interval,j as last,a as map,t as merge,A as mergeMap,n as onFirstData,q as pairwise,Q as pausable,w as race,d as reduce,P as repeat,R as rescue,F as sample,c as scan,f as skip,x as switchMap,e as take,h as takeUntil,g as takeWhile,m as tap,o as tapFirst,E as throttle,V as throttleTime,H as timeout,S as valve,N as window,K as windowCount,M as windowTime,s as withLatestFrom,u as zip};
@@ -1 +1 @@
1
- "use strict";var ge=Object.defineProperty;var nn=Object.getOwnPropertyDescriptor;var tn=Object.getOwnPropertyNames;var rn=Object.prototype.hasOwnProperty;var O=(r,e)=>()=>(r&&(e=r(r=0)),e);var on=(r,e)=>{for(var n in e)ge(r,n,{get:e[n],enumerable:!0})},sn=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of tn(e))!rn.call(r,i)&&i!==n&&ge(r,i,{get:()=>e[i],enumerable:!(t=nn(e,i))||t.enumerable});return r};var an=r=>sn(ge({},"__esModule",{value:!0}),r);function Oe(){return j>0||ee}function Ve(){return j>0}function Ce(r){j>0?ne.push(r):r()}function K(r){j+=1;let e=!1;try{r()}catch(n){throw e=!0,n}finally{if(j-=1,j===0)if(e){if(!ee){let n=ne.splice(0);for(let t of n)try{t()}catch{}P.length=0,G.length=0,q.length=0}}else dn()}}function dn(){let r=!ee;r&&(ee=!0);let e=[],n=0;try{for(;P.length>0||G.length>0||q.length>0||r&&ne.length>0;){if(r&&ne.length>0){let o=ne.splice(0);for(let a of o)try{a()}catch(s){e.push(s)}continue}if(n+=1,n>1e3)throw P.length=0,G.length=0,q.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let i=(P.length>0?P:G.length>0?G:q).splice(0);for(let o of i)try{o()}catch(a){e.push(a)}}}finally{r&&(ee=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function de(r,e,n){if(e.length===0)return;if(e.length===1){let u=n(e[0][0]);if(u<3||!Oe()){r(e);return}(u>=5?q:u===4?G:P).push(()=>r(e));return}let t=e.length,i=t,o=t,a=t,s=0;for(;s<t&&n(e[s][0])<3;)s++;for(i=s;s<t&&n(e[s][0])===3;)s++;for(o=s;s<t&&n(e[s][0])===4;)s++;a=s;let d=Oe();if(i>0){let u=e.slice(0,i);r(u)}if(o>i){let u=e.slice(i,o);d?P.push(()=>r(u)):r(u)}if(a>o){let u=e.slice(o,a);d?G.push(()=>r(u)):r(u)}if(t>a){let u=e.slice(a,t);d?q.push(()=>r(u)):r(u)}}var j,ee,P,G,q,ne,Y=O(()=>{"use strict";j=0,ee=!1,P=[],G=[],q=[],ne=[]});var te,k,R,I,H,B,re,z,D,N,J,ye,un,_e,ln,cn,ve,Ie,De,Le,Te,U=O(()=>{"use strict";te=Symbol.for("graphrefly/START"),k=Symbol.for("graphrefly/DATA"),R=Symbol.for("graphrefly/DIRTY"),I=Symbol.for("graphrefly/RESOLVED"),H=Symbol.for("graphrefly/INVALIDATE"),B=Symbol.for("graphrefly/PAUSE"),re=Symbol.for("graphrefly/RESUME"),z=Symbol.for("graphrefly/TEARDOWN"),D=Symbol.for("graphrefly/COMPLETE"),N=Symbol.for("graphrefly/ERROR"),J=Object.freeze([R]),ye=Object.freeze([I]),un=Object.freeze([H]),_e=Object.freeze([te]),ln=Object.freeze([D]),cn=Object.freeze([z]),ve=Object.freeze([J]),Ie=Object.freeze([ye]),De=Object.freeze([un]),Le=Object.freeze([ln]),Te=Object.freeze([cn])});function Ke(r){r.registerCodec(fn)}var fn,ze=O(()=>{"use strict";fn={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let n=new TextDecoder().decode(r);return JSON.parse(n)}}});function ue(r){if(r==null)return hn;let{type:e,id:n,...t}=r;return{type:e??"system",id:n??"",...t}}var hn,Fe=O(()=>{"use strict";hn={type:"system",id:""}});function ie(){return Math.trunc(performance.now()*1e6)}function Pe(){return Date.now()*1e6}var we=O(()=>{"use strict"});function Ge(r){r.registerMessageType(te,{tier:0,wireCrossing:!1}),r.registerMessageType(R,{tier:1,wireCrossing:!1}),r.registerMessageType(H,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(B,{tier:2,wireCrossing:!1}),r.registerMessageType(re,{tier:2,wireCrossing:!1}),r.registerMessageType(k,{tier:3,wireCrossing:!0}),r.registerMessageType(I,{tier:3,wireCrossing:!0}),r.registerMessageType(D,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(N,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(z,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var le,He=O(()=>{"use strict";U();le=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let t=this._messageTypes.get(n);return t!=null?t.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.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.")}}});var X,Be=O(()=>{"use strict";X=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`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 xe(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(xe);if(typeof r=="object"&&r!==null){let e={};for(let n of Object.keys(r).sort())e[n]=xe(r[n]);return e}return null}function bn(r){let e=mn.encode(r),n=e.length,t=n*8,i=n+9+63&-64,o=new Uint8Array(i);o.set(e),o[n]=128;let a=new DataView(o.buffer);a.setUint32(i-4,t>>>0,!1),a.setUint32(i-8,Math.floor(t/4294967296)>>>0,!1);let s=1779033703,d=3144134277,u=1013904242,c=2773480762,p=1359893119,h=2600822924,f=528734635,m=1541459225,y=new Uint32Array(64),w=(E,M)=>E>>>M|E<<32-M;for(let E=0;E<i;E+=64){for(let g=0;g<16;g++)y[g]=a.getUint32(E+g*4,!1);for(let g=16;g<64;g++){let x=y[g-15],A=y[g-2],S=w(x,7)^w(x,18)^x>>>3,Q=w(A,17)^w(A,19)^A>>>10;y[g]=y[g-16]+S+y[g-7]+Q>>>0}let M=s,V=d,C=u,W=c,l=p,b=h,v=f,T=m;for(let g=0;g<64;g++){let x=w(l,6)^w(l,11)^w(l,25),A=l&b^~l&v,S=T+x+A+pn[g]+y[g]>>>0,Q=w(M,2)^w(M,13)^w(M,22),F=M&V^M&C^V&C,en=Q+F>>>0;T=v,v=b,b=l,l=W+S>>>0,W=C,C=V,V=M,M=S+en>>>0}s=s+M>>>0,d=d+V>>>0,u=u+C>>>0,c=c+W>>>0,p=p+l>>>0,h=h+b>>>0,f=f+v>>>0,m=m+T>>>0}let _=E=>E.toString(16).padStart(8,"0");return _(s)+_(d)+_(u)+_(c)+_(p)+_(h)+_(f)+_(m)}function ke(r){let e=xe(r??null),n=JSON.stringify(e);return bn(n).slice(0,16)}function gn(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function Ne(r,e,n){let t=n?.id??gn();if(r===0)return{id:t,version:0};let o=(n?.hash??ke)(e);return{id:t,version:0,cid:o,prev:null}}function Ue(r,e,n){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=n(e))}var pn,mn,$e=O(()=>{"use strict";pn=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]),mn=new TextEncoder});function qe(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Me(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function ce(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function oe(r,e,n){let t=Ye(r)?r:[],i=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return Ye(r)?o=(Ee(e)?e:n)??{}:Ee(r)?o=r:o=(Ee(e)?e:n)??{},new fe(t,i,o)}var We,je,yn,_n,Ae,fe,Ye,Ee,Re=O(()=>{"use strict";ze();Fe();Y();we();He();Be();U();$e();We=()=>{},je=100;yn=(r,e,n,t)=>{n.direction==="down-in"&&r._onDepMessage(n.depIndex,e)},_n=(r,e,n,t)=>{let i=r;if(i._status==="completed"||i._status==="errored")return;let o=i._cached,a=o===void 0?[_e]:[_e,[k,o]];i._status==="dirty"&&a.push(J),de(e,a,i._config.tierOf)},Ae=new le({onMessage:yn,onSubscribe:_n});Ge(Ae);Ke(Ae);fe=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,t){this._config=t.config??Ae,this._config.onMessage,this._optsName=t.name,this._describeKind=t.describeKind,this._equals=t.equals??Object.is,this._resubscribable=t.resubscribable??!1,this._resetOnTeardown=t.resetOnTeardown??!1,this._autoComplete=t.completeWhenDepsComplete??!0,this._autoError=t.errorWhenDepsError??!0,this._pausable=t.pausable??!0,this._guard=t.guard,this._fn=n,this._partial=t.partial??!1,this._cached=t.initial!==void 0?t.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=t.versioningHash??this._config.defaultHashFn??ke;let i=t.versioning??this._config.defaultVersioning;this._versioningLevel=i,this._versioning=i!=null?Ne(i,this._cached===void 0?void 0:this._cached,{id:t.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(qe);let o={};for(let[s,d]of Object.entries(t.meta??{})){let u={initial:d,name:`${t.name??"node"}:meta:${s}`,describeKind:"state",config:this._config};t.guard!=null&&(u.guard=t.guard),o[s]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let a=this;this._actions={emit(s){a._emit([[k,s]])},down(s){a._emit(ce(s))},up(s){a._emitUp(ce(s))}},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,n){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 t=this._versioningLevel;if(t!=null&&e<=t)return;let i=n?.hash??this._hashFn;i!==this._hashFn&&(this._hashFn=i);let o=this._cached===void 0?void 0:this._cached,a=this._versioning,s=a?.id??n?.id,d=a?.version??0,u=Ne(e,o,{id:s,hash:i});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=ue(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let t of this._extraGuards)if(!t(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,t=e?.actor!=null;if(!n&&!t)return;let i=ue(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(i,o))throw new X({actor:i,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(i,o))throw new X({actor:i,action:o,nodeName:this.name})}this._lastMutation={actor:i,timestamp_ns:Pe()}}down(e,n){let t=ce(e);t.length!==0&&(this._checkGuard(n),this._emit(t))}emit(e,n){this._checkGuard(n),this._emit([[k,e]])}up(e,n){if(this._deps.length===0)return;let t=ce(e);if(t.length===0)return;this._checkGuard(n);let i=n??{internal:!0};this._validateUpTiers(t);for(let o of this._deps)o.node.up?.(t,i)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let t of e){let i=n(t[0]);if(i===3||i===4)throw new Error(`Node "${this.name}": tier-${i} 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,n){if(n!=null&&this._guard!=null){let d=ue(n);if(!this._guard(d,"observe"))throw new X({actor:d,action:"observe",nodeName:this.name})}let i=this._isTerminal&&this._resubscribable;if(i){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)Me(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:i},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 s=!1;return()=>{s||(s=!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[n]=this._sinks;this._sinks=n}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,n=0;try{for(let t=0;t<e;t++){let i=t,o=this._deps[t];o.unsub=We,o.unsub=o.node.subscribe(a=>{if(o.unsub===null)return;let s=this._config.tierOf,d=!1;for(let u of a)s(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:i},this._actions);d&&this._maybeRunFnOnSettlement()}),n++}}catch(t){this._deps[n].unsub=null;for(let i=0;i<n;i++){let o=this._deps[i];if(o.unsub!=null){let a=o.unsub;o.unsub=null;try{a()}catch{}Me(o)}}throw this._dirtyDepCount=0,t}}_addDep(e){for(let i=0;i<this._deps.length;i++)if(this._deps[i].node===e)return i;let n=this._deps.length,t=qe(e);if(this._deps.push(t),this._sinks==null)return n;t.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve),t.unsub=We;try{t.unsub=e.subscribe(i=>{if(t.unsub===null)return;let o=this._config.tierOf,a=!1;for(let s of i)o(s[0])>=3&&(a=!0),this._config.onMessage(this,s,{direction:"down-in",depIndex:n},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(i){throw t.unsub=null,this._deps.pop(),this._dirtyDepCount--,i}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(t){this._emit([[N,this._wrapFnError("cleanup threw",t)]])}else if(n!=null&&typeof n=="object"){let t=n.deactivate;if(typeof t=="function")try{t()}catch(i){this._emit([[N,this._wrapFnError("cleanup.deactivate threw",i)]])}}for(let t of this._deps){if(t.unsub!=null){let i=t.unsub;t.unsub=null;try{i()}catch{}}Me(t)}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,n){let t=this._deps[e],i=n[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:n};for(let a of this._inspectorHooks)a(o)}if(i!==te){if(i===R){this._depDirtied(t);return}if(i===H){if(this._depInvalidated(t),this._cached===void 0)return;this._emit(De);return}if(i===B||i===re){this._emit([n]);return}if(i===z){this._emit(Te);return}if(i===k)this._depSettledAsData(t,n[1]);else if(i===I)this._depSettledAsResolved(t);else if(i===D)this._depSettledAsTerminal(t,!0);else if(i===N)this._depSettledAsTerminal(t,n[1]);else{this._emit([n]);return}if(!this._fn){(i===k||i===I)&&this._emit([n]),(i===D||i===N)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,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 n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Ie),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[N,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.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([[N,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(s){this._emit([[N,this._wrapFnError("cleanup.beforeRun threw",s)]]);return}}}let n=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),t=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let s=n[a];s!=null&&s.length>0&&(this._deps[a].prevData=s[s.length-1])}let i=this._deps.map(a=>a.terminal),o={prevData:t,terminalDeps:i,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:n,prevData:t};for(let s of this._inspectorHooks)s(a)}this._isExecutingFn=!0;try{let a=this._fn(n,this._actions,o);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let s=a;(typeof s.beforeRun=="function"||typeof s.deactivate=="function"||typeof s.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[N,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>je?(this._rerunDepth=0,this._emit([[N,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${je} \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,n){let t=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${t}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[J,e[0]]:e;let t=!0,i=!1,o=!1,a=-1;for(let d of e){let u=n(d[0]);u<a&&(t=!1),u===3&&(i=!0),d[0]===R&&(o=!0),a=u}let s=e;if(!t){let d=e.map((u,c)=>({m:u,i:c,tier:n(u[0])}));d.sort((u,c)=>u.tier-c.tier||u.i-c.i),s=d.map(u=>u.m)}if(i&&!o&&this._status!=="dirty"){let d=0;for(;d<s.length&&n(s[d][0])===0;)d++;return d===0?[J,...s]:[...s.slice(0,d),J,...s.slice(d)]}return s}_emit(e){if(e.length===0)return;for(let s=0;s<e.length;s++){let d=e[s];if(d[0]===N&&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 n=e;if(this._isTerminal&&!this._resubscribable){let s=e.filter(d=>d[0]===z||d[0]===H);if(s.length===0)return;n=s}n=this._frameBatch(n);let i=null;for(let s=0;s<n.length;s++){let d=n[s],u=d[0];if(u!==B&&u!==re){i?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===B?"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 p=d[1];if(u===B)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(p),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(p))c=!1;else if(this._pauseLocks.delete(p),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?i?.push(d):i==null&&(i=n.slice(0,s))}if(i!=null){if(i.length===0)return;n=i}if(this._hasMeta&&n.some(s=>s[0]===z))for(let s of Object.keys(this.meta))try{this.meta[s]._emit(Te)}catch{}let{finalMessages:o,equalsError:a}=this._updateState(n);if(o.length>0&&this._config.inspectorEnabled){let s=this._config.globalInspector;if(s!=null)try{s({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let s=this._config.tierOf,d=[];for(let u of o)s(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);a!=null&&this._emit([[N,a]])}_updateState(e){let n=this._config.tierOf,t,i,o=-1,a=0;for(let c of e)n(c[0])===3&&a++;let s=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===k){d=c;break}}for(let c=0;c<e.length;c++){let p=e[c],h=p[0];if(h===k){if(p.length>=2){let f=!1;if(s&&this._cached!==void 0)try{f=this._equals(this._cached,p[1])}catch(m){i=this._wrapFnError("equals threw",m),o=c;break}if(f){t==null&&(t=e.slice(0,c)),t.push(ye),this._status="resolved";continue}this._cached=p[1],this._versioning!=null&&(d<0||c===d)&&Ue(this._versioning,p[1],this._hashFn)}this._status="settled",t?.push(p)}else if(t?.push(p),h===R)this._status="dirty";else if(h===I)this._status="resolved";else if(h===D){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===N){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===H){if(this._cached!==void 0){let m=this._config.rigorRecorder;if(m!=null)try{m.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let m=f.invalidate;if(typeof m=="function")try{m()}catch{}}}else h===z&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?t??e.slice(0,o):t??e;return i!=null?{finalMessages:u,equalsError:i}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let t of n)t(e)};_dispatchOrAccumulate(e){if(Ve()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ce(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}de(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);de(this._deliverToSinks,n,this._config.tierOf)}},Ye=r=>Array.isArray(r),Ee=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function L(r,e){return oe([],{...e,initial:r})}function $(r,e,n){return oe(r,(i,o,a)=>{let s=i.map((d,u)=>d!=null&&d.length>0?d.at(-1):a.prevData[u]);o.emit(e(s,a))},{describeKind:"derived",...n})}var se=O(()=>{"use strict";Re()});function Ze(r){return r.subscribe(()=>{})}var Qe=O(()=>{"use strict"});var An={};on(An,{NativeIndexBackend:()=>he,NativeListBackend:()=>pe,NativeLogBackend:()=>me,NativeMapBackend:()=>be,mergeReactiveLogs:()=>Mn,reactiveIndex:()=>wn,reactiveList:()=>xn,reactiveLog:()=>Nn,reactiveMap:()=>En});module.exports=an(An);Y();U();se();function Je(r,e){if(r===e)return 0;let n=typeof r;if(n===typeof e&&(n==="number"||n==="string"||n==="boolean"||n==="bigint")){let i=r,o=e;return i<o?-1:i>o?1:0}return String(r).localeCompare(String(e))}function vn(r,e){let n=Je(r[0],e[0]);return n!==0?n:Je(r[1],e[1])}function Xe(r){return[r.secondary,r.primary]}function Z(r,e){let n=Xe(e),t=0,i=r.length;for(;t<i;){let o=t+i>>1;vn(n,Xe(r[o]))>0?t=o+1:i=o}return t}var he=class{_version=0;_buf=[];_byPrimary=new Map;get version(){return this._version}get size(){return this._buf.length}has(e){return this._byPrimary.has(e)}get(e){return this._byPrimary.get(e)?.value}upsert(e,n,t,i){let o=this._byPrimary.get(e),a={primary:e,secondary:n,value:t};if(o!==void 0&&i?.equals?.(o,a))return!1;if(o!==void 0){let d=Z(this._buf,o);this._buf.splice(d,1)}let s=Z(this._buf,a);return this._buf.splice(s,0,a),this._byPrimary.set(e,a),this._version+=1,o===void 0}upsertMany(e,n){let t=0;try{for(let i of e){let o=this._byPrimary.get(i.primary),a={primary:i.primary,secondary:i.secondary,value:i.value};if(o!==void 0&&n?.equals?.(o,a))continue;if(o!==void 0){let d=Z(this._buf,o);this._buf.splice(d,1)}let s=Z(this._buf,a);this._buf.splice(s,0,a),this._byPrimary.set(i.primary,a),t+=1}}finally{t>0&&(this._version+=1)}return t}delete(e){let n=this._byPrimary.get(e);if(n===void 0)return!1;let t=Z(this._buf,n);return this._buf.splice(t,1),this._byPrimary.delete(e),this._version+=1,!0}deleteMany(e){let n=0;try{for(let t of e){let i=this._byPrimary.get(t);if(i===void 0)continue;let o=Z(this._buf,i);this._buf.splice(o,1),this._byPrimary.delete(t),n+=1}}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._byPrimary.clear(),this._version+=1,e)}toArray(){return[...this._buf]}toPrimaryMap(){let e=new Map;for(let n of this._buf)e.set(n.primary,n.value);return e}};function Tn(r){return r.subscribe(()=>{})}function wn(r={}){let{name:e,versioning:n,equals:t,backend:i}=r,o=i??new he;function a(f){return f?.equals!==void 0||t===void 0?f:{...f,equals:t}}let s=L([],{name:e,describeKind:"state",equals:(f,m)=>f===m,...n!=null?{versioning:n}:{}}),d=$([s],([f])=>{let m=f,y=new Map;for(let w of m)y.set(w.primary,w.value);return y},{initial:o.toPrimaryMap(),describeKind:"derived"}),u=Tn(d),c=!1;function p(){let f=o.toArray();K(()=>{s.down([[R]]),s.down([[k,f]])})}function h(f){let m=o.version;try{return f()}finally{o.version!==m&&p()}}return{ordered:s,byPrimary:d,has(f){return o.has(f)},get(f){return o.get(f)},get size(){return o.size},upsert(f,m,y,w){return h(()=>o.upsert(f,m,y,a(w)))},upsertMany(f,m){let y=[...f];y.length!==0&&h(()=>o.upsertMany(y,a(m)))},delete(f){h(()=>o.delete(f))},deleteMany(f){let m=[...f];m.length!==0&&h(()=>o.deleteMany(m))},clear(){h(()=>o.clear())},dispose(){c||(c=!0,u())}}}Y();U();se();var pe=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._buf.length+e;if(!(n<0||n>=this._buf.length))return this._buf[n]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._buf.length;this._buf.length=n+e.length;for(let t=0;t<e.length;t++)this._buf[n+t]=e[t];this._version+=1}insert(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,n),this._version+=1}insertMany(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);n.length!==0&&(this._buf.splice(e,0,...n),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let n=e>=0?e:this._buf.length+e;if(n<0||n>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[t]=this._buf.splice(n,1);return this._version+=1,t}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function xn(r,e={}){let{name:n,versioning:t,backend:i}=e,o=i??new pe(r),a=L(o.toArray(),{name:n,describeKind:"state",equals:(u,c)=>u===c,...t!=null?{versioning:t}:{}});function s(){let u=o.toArray();K(()=>{a.down([[R]]),a.down([[k,u]])})}function d(u){let c=o.version;try{return u()}finally{o.version!==c&&s()}}return{items:a,get size(){return o.size},at(u){return o.at(u)},append(u){d(()=>o.append(u))},appendMany(u){d(()=>o.appendMany(u))},insert(u,c){d(()=>o.insert(u,c))},insertMany(u,c){d(()=>o.insertMany(u,c))},pop(u=-1){return d(()=>o.pop(u))},clear(){d(()=>o.clear())},dispose(){}}}Y();U();Re();se();Qe();var me=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,n){if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=n,n!==void 0){if(this._buf=new Array(n),e&&e.length>0){let t=Math.min(e.length,n),i=e.length-t;for(let o=0;o<t;o++)this._buf[o]=e[i+o];this._size=t}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._size+e;if(!(n<0||n>=this._size))return this._maxSize!==void 0?this._buf[(this._head+n)%this._maxSize]:this._buf[n]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let t=n;t<e.length;t++)this._rawAppend(e[t]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let n=0;n<e;n++)this._buf[(this._head+n)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let n=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,n);else{for(let t=0;t<n;t++)this._buf[(this._head+t)%this._maxSize]=void 0;this._head=(this._head+n)%this._maxSize}return this._size-=n,this._version+=1,n}slice(e,n){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(n!==void 0&&(!Number.isInteger(n)||n<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${n})`);let t=n===void 0?this._size:Math.min(Math.max(n,0),this._size),i=Math.min(e,this._size);if(i>=t)return[];let o=t-i;if(this._maxSize===void 0)return this._buf.slice(i,t);let a=new Array(o);for(let s=0;s<o;s++)a[s]=this._buf[(this._head+i+s)%this._maxSize];return a}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let n=Math.min(e,this._size);return this.slice(this._size-n,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let n=0;n<this._size;n++)e[n]=this._buf[(this._head+n)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let n=0;n<e.length;n++)this._buf.push(e[n]);this._size=this._buf.length}else{let n=this._maxSize;for(let o=0;o<n;o++)this._buf[o]=void 0;this._head=0;let t=Math.min(e.length,n),i=e.length-t;for(let o=0;o<t;o++)this._buf[o]=e[i+o];this._size=t}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function ae(r){return r.subscribe(()=>{})}var kn=64;function Nn(r,e={}){let{name:n,maxSize:t,versioning:i,guard:o,backend:a}=e,s=a??new me(r,t),d=L(s.toArray(),{name:n,describeKind:"state",equals:(l,b)=>l===b,...i!=null?{versioning:i}:{},...o!=null?{guard:o}:{}});function u(){let l=s.toArray();K(()=>{d.down([[R]],{internal:!0}),d.down([[k,l]],{internal:!0})})}let c=new Map,p=new Map,h=new Map;function f(l,b){return`${l}:${b===void 0?"END":b}`}function m(l){if(l.size<kn)return;let b=l.keys().next();if(b.done)return;let v=l.get(b.value);v!==void 0&&v.dispose(),l.delete(b.value)}function y(l){let b=s.version;try{return l()}finally{s.version!==b&&u()}}function w(l){if(!Number.isInteger(l)||l<0)throw new RangeError(`tail: n must be a non-negative integer (got ${l})`);let b=c.get(l);if(b!==void 0)return c.delete(l),c.set(l,b),b.node;m(c);let v=$([d],([g])=>{let x=g;return l===0||x.length===0?[]:x.slice(Math.max(0,x.length-l))},{initial:s.tail(l),describeKind:"derived"}),T=ae(v);return c.set(l,{node:v,dispose:T}),v}function _(l,b){if(!Number.isInteger(l)||l<0)throw new RangeError(`slice: start must be a non-negative integer (got ${l})`);if(b!==void 0&&(!Number.isInteger(b)||b<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${b})`);let v=f(l,b),T=p.get(v);if(T!==void 0)return p.delete(v),p.set(v,T),T.node;m(p);let g=$([d],([A])=>{let S=A;return b===void 0?S.slice(l):S.slice(l,b)},{initial:s.slice(l,b),describeKind:"derived"}),x=ae(g);return p.set(v,{node:g,dispose:x}),g}function E(l){let b=h.get(l);if(b!==void 0)return b.node;let v=$([d,l],([g,x])=>{let A=g,S=Math.max(0,Math.trunc(x??0));return A.slice(S)},{initial:[],describeKind:"derived"}),T=ae(v);return h.set(l,{node:v,dispose:T}),v}let M,V;function C(){M===void 0&&(M=oe([d],(l,b,v)=>{let T=l[0],x=T!=null&&T.length>0?T.at(-1):v.prevData[0];if(x==null||x.length===0){b.down([[I]]);return}b.emit(x[x.length-1])},{name:n!=null?`${n}::lastValue`:"lastValue",describeKind:"derived",initial:s.size===0?void 0:s.at(s.size-1)}),V=$([d],([l])=>l.length>0,{name:n!=null?`${n}::hasLatest`:"hasLatest",describeKind:"derived",initial:s.size>0}),ae(M),ae(V))}let W={entries:d,get size(){return s.size},at(l){return s.at(l)},append(l){y(()=>s.append(l))},appendMany(l){l.length!==0&&y(()=>s.appendMany(l))},clear(){y(()=>s.clear())},trimHead(l){y(()=>s.trimHead(l))},withLatest(){return C(),d},get lastValue(){return C(),M},get hasLatest(){return C(),V},view(l){switch(l.kind){case"tail":return w(l.n);case"slice":return _(l.start,l.stop);case"fromCursor":return E(l.cursor)}},attach(l){let b=l.subscribe(v=>{for(let T of v)T[0]===k&&W.append(T[1])});return()=>b()},attachStorage(l){if(l.length===0)return()=>{};let b=new Map;for(let T of l)b.set(T,s.size);(async()=>{for(let T of l)if(typeof T.loadEntries=="function")try{let g=await Promise.resolve(T.loadEntries());g.entries.length>0&&s.size===0&&(s.restore(g.entries),b.set(T,g.entries.length),u());break}catch{}})();let v=d.subscribe(T=>{for(let g of T){if(g[0]!==k)continue;let x=g[1];for(let A of l){let S=b.get(A)??0;if(x.length<S){try{let F=A.appendEntries(x);F instanceof Promise&&F.catch(()=>{})}catch{}b.set(A,x.length);continue}if(x.length===S)continue;let Q=x.slice(S);b.set(A,x.length);try{let F=A.appendEntries(Q);F instanceof Promise&&F.catch(()=>{})}catch{}}}});return()=>v()},disposeAllViews(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()},dispose(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()}};return W}var Se=new WeakMap;function Mn(r){let e=Se.get(r);if(e)return e;let n=r.map(c=>c.cache??[]),t=n.flat(),i=L(t,{name:"mergeReactiveLogs",describeKind:"state",equals:(c,p)=>c===p}),o=r.map((c,p)=>[...n[p]??[]]),a=[];for(let c=0;c<r.length;c++){let p=c,h=r[p].subscribe(f=>{for(let m of f)if(m[0]===k)o[p]=[...m[1]],i.emit(o.flat());else if(m[0]===D){o[p]=[];let y=a[p];y!==void 0&&(a[p]=void 0,y())}else m[0]===N&&i.down([[N,m[1]]])});a.push(h)}let s=Ze(i),d=!1,u={node:i,dispose(){if(!d){d=!0;for(let c of a)c?.();a.length=0,s(),Se.delete(r)}}};return Se.set(r,u),u}Y();we();U();se();var be=class{_version=0;_store=new Map;_maxSize;_defaultTtl;constructor(e={}){let{maxSize:n,defaultTtl:t}=e;if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(t!==void 0&&t<=0)throw new RangeError("defaultTtl must be positive");this._maxSize=n,this._defaultTtl=t}get version(){return this._version}get size(){return this._store.size}has(e){let n=this._store.get(e);return n===void 0?!1:this._isExpired(n)?(this._store.delete(e),this._version+=1,!1):(this._touchLru(e,n),!0)}get(e){let n=this._store.get(e);if(n!==void 0){if(this._isExpired(n)){this._store.delete(e),this._version+=1;return}return this._touchLru(e,n),n.value}}set(e,n,t){let i=this._resolveExpiresAt(t);this._store.has(e)&&this._store.delete(e),this._store.set(e,{value:n,expiresAt:i}),this._evictLruWhileOver(),this._version+=1}setMany(e,n){let t=this._resolveExpiresAt(n),i=0;try{for(let[o,a]of e)this._store.has(o)&&this._store.delete(o),this._store.set(o,{value:a,expiresAt:t}),i+=1}finally{i>0&&(this._evictLruWhileOver(),this._version+=1)}}delete(e){let n=this._store.delete(e);return n&&(this._version+=1),n}deleteMany(e){let n=0;try{for(let t of e)this._store.delete(t)&&(n+=1)}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._store.size;return e===0?0:(this._store.clear(),this._version+=1,e)}pruneExpired(){let e=ie(),n=0;for(let[t,i]of this._store)this._isExpired(i,e)&&(this._store.delete(t),n+=1);return n>0&&(this._version+=1),n}toMap(){let e=ie(),n=new Map;for(let[t,i]of this._store)this._isExpired(i,e)||n.set(t,i.value);return n}_resolveExpiresAt(e){let n=e??this._defaultTtl;if(n!==void 0){if(!Number.isFinite(n)||n<=0)throw new RangeError(`MapBackend: ttl must be a positive finite number (got ${n})`);return ie()+n*1e9}}_isExpired(e,n){return e.expiresAt===void 0?!1:(n??ie())>=e.expiresAt}_touchLru(e,n){this._store.delete(e),this._store.set(e,n)}_evictLruWhileOver(){if(this._maxSize!==void 0)for(;this._store.size>this._maxSize;){let e=this._store.keys().next().value;if(e===void 0)break;this._store.delete(e)}}};function En(r={}){let{name:e,maxSize:n,defaultTtl:t,versioning:i,backend:o,retention:a}=r;if(a&&n!==void 0)throw new RangeError("reactiveMap: `maxSize` (LRU) and `retention` (score-based) are mutually exclusive. Pick one eviction policy.");if(a&&a.archiveThreshold===void 0&&a.maxSize===void 0)throw new RangeError("reactiveMap: `retention` requires at least one of `archiveThreshold` or `maxSize` to trigger archival.");let s=o??new be({maxSize:n,defaultTtl:t}),d=L(s.toMap(),{name:e,describeKind:"state",equals:(h,f)=>h===f,...i!=null?{versioning:i}:{}});function u(){let h=s.toMap();K(()=>{d.down([[R]]),d.down([[k,h]])})}function c(){if(!a)return;let h=s.toMap(),f=a.archiveThreshold,m=a.maxSize,y=[];for(let[_,E]of h)y.push({key:_,value:E,score:a.score(_,E)});y.sort((_,E)=>_.score-E.score);let w=new Set;if(f!==void 0)for(let _ of y)if(_.score<f)w.add(_.key);else break;if(m!==void 0&&y.length-w.size>m)for(let _ of y){if(y.length-w.size<=m)break;w.has(_.key)||w.add(_.key)}if(w.size!==0)for(let _ of y)w.has(_.key)&&(a.onArchive?.(_.key,_.value,_.score),s.delete(_.key))}function p(h,f="mutation"){let m=s.version;try{return h()}finally{s.version!==m&&(f==="mutation"&&c(),u())}}return{entries:d,has(h){return p(()=>s.has(h),"read")},get(h){return p(()=>s.get(h),"read")},set(h,f,m){p(()=>s.set(h,f,m?.ttl))},setMany(h,f){p(()=>s.setMany(h,f?.ttl))},delete(h){p(()=>s.delete(h))},deleteMany(h){p(()=>s.deleteMany(h))},clear(){p(()=>s.clear())},pruneExpired(){p(()=>s.pruneExpired())},get size(){return s.size},dispose(){}}}0&&(module.exports={NativeIndexBackend,NativeListBackend,NativeLogBackend,NativeMapBackend,mergeReactiveLogs,reactiveIndex,reactiveList,reactiveLog,reactiveMap});
1
+ "use strict";var ge=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var O=(r,e)=>()=>(r&&(e=r(r=0)),e);var sn=(r,e)=>{for(var n in e)ge(r,n,{get:e[n],enumerable:!0})},an=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rn(e))!on.call(r,i)&&i!==n&&ge(r,i,{get:()=>e[i],enumerable:!(t=tn(e,i))||t.enumerable});return r};var dn=r=>an(ge({},"__esModule",{value:!0}),r);function Oe(){return j>0||ee}function Ve(){return j>0}function Ce(r){j>0?ne.push(r):r()}function K(r){j+=1;let e=!1;try{r()}catch(n){throw e=!0,n}finally{if(j-=1,j===0)if(e){if(!ee){let n=ne.splice(0);for(let t of n)try{t()}catch{}P.length=0,G.length=0,q.length=0}}else un()}}function un(){let r=!ee;r&&(ee=!0);let e=[],n=0;try{for(;P.length>0||G.length>0||q.length>0||r&&ne.length>0;){if(r&&ne.length>0){let o=ne.splice(0);for(let a of o)try{a()}catch(s){e.push(s)}continue}if(n+=1,n>1e3)throw P.length=0,G.length=0,q.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let i=(P.length>0?P:G.length>0?G:q).splice(0);for(let o of i)try{o()}catch(a){e.push(a)}}}finally{r&&(ee=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function de(r,e,n){if(e.length===0)return;if(e.length===1){let u=n(e[0][0]);if(u<3||!Oe()){r(e);return}(u>=5?q:u===4?G:P).push(()=>r(e));return}let t=e.length,i=t,o=t,a=t,s=0;for(;s<t&&n(e[s][0])<3;)s++;for(i=s;s<t&&n(e[s][0])===3;)s++;for(o=s;s<t&&n(e[s][0])===4;)s++;a=s;let d=Oe();if(i>0){let u=e.slice(0,i);r(u)}if(o>i){let u=e.slice(i,o);d?P.push(()=>r(u)):r(u)}if(a>o){let u=e.slice(o,a);d?G.push(()=>r(u)):r(u)}if(t>a){let u=e.slice(a,t);d?q.push(()=>r(u)):r(u)}}var j,ee,P,G,q,ne,Y=O(()=>{"use strict";j=0,ee=!1,P=[],G=[],q=[],ne=[]});var te,k,R,I,H,B,re,z,D,N,J,ye,ln,_e,cn,fn,ve,Ie,De,Le,Te,U=O(()=>{"use strict";te=Symbol.for("graphrefly/START"),k=Symbol.for("graphrefly/DATA"),R=Symbol.for("graphrefly/DIRTY"),I=Symbol.for("graphrefly/RESOLVED"),H=Symbol.for("graphrefly/INVALIDATE"),B=Symbol.for("graphrefly/PAUSE"),re=Symbol.for("graphrefly/RESUME"),z=Symbol.for("graphrefly/TEARDOWN"),D=Symbol.for("graphrefly/COMPLETE"),N=Symbol.for("graphrefly/ERROR"),J=Object.freeze([R]),ye=Object.freeze([I]),ln=Object.freeze([H]),_e=Object.freeze([te]),cn=Object.freeze([D]),fn=Object.freeze([z]),ve=Object.freeze([J]),Ie=Object.freeze([ye]),De=Object.freeze([ln]),Le=Object.freeze([cn]),Te=Object.freeze([fn])});function Ke(r){r.registerCodec(hn)}var hn,ze=O(()=>{"use strict";hn={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let n=new TextDecoder().decode(r);return JSON.parse(n)}}});function ue(r){if(r==null)return pn;let{type:e,id:n,...t}=r;return{type:e??"system",id:n??"",...t}}var pn,Fe=O(()=>{"use strict";pn={type:"system",id:""}});function ie(){return Math.trunc(performance.now()*1e6)}function Pe(){return Date.now()*1e6}var we=O(()=>{"use strict"});function Ge(r){r.registerMessageType(te,{tier:0,wireCrossing:!1}),r.registerMessageType(R,{tier:1,wireCrossing:!1}),r.registerMessageType(H,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(B,{tier:2,wireCrossing:!1}),r.registerMessageType(re,{tier:2,wireCrossing:!1}),r.registerMessageType(k,{tier:3,wireCrossing:!0}),r.registerMessageType(I,{tier:3,wireCrossing:!0}),r.registerMessageType(D,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(N,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(z,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var le,He=O(()=>{"use strict";U();le=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let t=this._messageTypes.get(n);return t!=null?t.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.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.")}}});var X,Be=O(()=>{"use strict";X=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`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 xe(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(xe);if(typeof r=="object"&&r!==null){let e={};for(let n of Object.keys(r).sort())e[n]=xe(r[n]);return e}return null}function gn(r){let e=bn.encode(r),n=e.length,t=n*8,i=n+9+63&-64,o=new Uint8Array(i);o.set(e),o[n]=128;let a=new DataView(o.buffer);a.setUint32(i-4,t>>>0,!1),a.setUint32(i-8,Math.floor(t/4294967296)>>>0,!1);let s=1779033703,d=3144134277,u=1013904242,c=2773480762,p=1359893119,h=2600822924,f=528734635,m=1541459225,y=new Uint32Array(64),w=(E,M)=>E>>>M|E<<32-M;for(let E=0;E<i;E+=64){for(let g=0;g<16;g++)y[g]=a.getUint32(E+g*4,!1);for(let g=16;g<64;g++){let x=y[g-15],A=y[g-2],S=w(x,7)^w(x,18)^x>>>3,Q=w(A,17)^w(A,19)^A>>>10;y[g]=y[g-16]+S+y[g-7]+Q>>>0}let M=s,V=d,C=u,W=c,l=p,b=h,v=f,T=m;for(let g=0;g<64;g++){let x=w(l,6)^w(l,11)^w(l,25),A=l&b^~l&v,S=T+x+A+mn[g]+y[g]>>>0,Q=w(M,2)^w(M,13)^w(M,22),F=M&V^M&C^V&C,nn=Q+F>>>0;T=v,v=b,b=l,l=W+S>>>0,W=C,C=V,V=M,M=S+nn>>>0}s=s+M>>>0,d=d+V>>>0,u=u+C>>>0,c=c+W>>>0,p=p+l>>>0,h=h+b>>>0,f=f+v>>>0,m=m+T>>>0}let _=E=>E.toString(16).padStart(8,"0");return _(s)+_(d)+_(u)+_(c)+_(p)+_(h)+_(f)+_(m)}function ke(r){let e=xe(r??null),n=JSON.stringify(e);return gn(n).slice(0,16)}function yn(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function Ne(r,e,n){let t=n?.id??yn();if(r===0)return{id:t,version:0};let o=(n?.hash??ke)(e);return{id:t,version:0,cid:o,prev:null}}function Ue(r,e,n){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=n(e))}var mn,bn,$e=O(()=>{"use strict";mn=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]),bn=new TextEncoder});function qe(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Me(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function ce(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function oe(r,e,n){let t=Ye(r)?r:[],i=typeof r=="function"?r:typeof e=="function"?e:void 0,o={};return Ye(r)?o=(Ee(e)?e:n)??{}:Ee(r)?o=r:o=(Ee(e)?e:n)??{},new fe(t,i,o)}var We,je,_n,vn,Ae,fe,Ye,Ee,Re=O(()=>{"use strict";ze();Fe();Y();we();He();Be();U();$e();We=()=>{},je=100;_n=(r,e,n,t)=>{n.direction==="down-in"&&r._onDepMessage(n.depIndex,e)},vn=(r,e,n,t)=>{let i=r;if(i._status==="completed"||i._status==="errored")return;let o=i._cached,a=o===void 0?[_e]:[_e,[k,o]];i._status==="dirty"&&a.push(J),de(e,a,i._config.tierOf)},Ae=new le({onMessage:_n,onSubscribe:vn});Ge(Ae);Ke(Ae);fe=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,t){this._config=t.config??Ae,this._config.onMessage,this._optsName=t.name,this._describeKind=t.describeKind,this._equals=t.equals??Object.is,this._resubscribable=t.resubscribable??!1,this._resetOnTeardown=t.resetOnTeardown??!1,this._autoComplete=t.completeWhenDepsComplete??!0,this._autoError=t.errorWhenDepsError??!0,this._pausable=t.pausable??!0,this._guard=t.guard,this._fn=n,this._partial=t.partial??!1,this._cached=t.initial!==void 0?t.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=t.versioningHash??this._config.defaultHashFn??ke;let i=t.versioning??this._config.defaultVersioning;this._versioningLevel=i,this._versioning=i!=null?Ne(i,this._cached===void 0?void 0:this._cached,{id:t.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(qe);let o={};for(let[s,d]of Object.entries(t.meta??{})){let u={initial:d,name:`${t.name??"node"}:meta:${s}`,describeKind:"state",config:this._config};t.guard!=null&&(u.guard=t.guard),o[s]=new r([],void 0,u)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let a=this;this._actions={emit(s){a._emit([[k,s]])},down(s){a._emit(ce(s))},up(s){a._emitUp(ce(s))}},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,n){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 t=this._versioningLevel;if(t!=null&&e<=t)return;let i=n?.hash??this._hashFn;i!==this._hashFn&&(this._hashFn=i);let o=this._cached===void 0?void 0:this._cached,a=this._versioning,s=a?.id??n?.id,d=a?.version??0,u=Ne(e,o,{id:s,hash:i});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=ue(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let t of this._extraGuards)if(!t(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,t=e?.actor!=null;if(!n&&!t)return;let i=ue(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(i,o))throw new X({actor:i,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(i,o))throw new X({actor:i,action:o,nodeName:this.name})}this._lastMutation={actor:i,timestamp_ns:Pe()}}down(e,n){let t=ce(e);t.length!==0&&(this._checkGuard(n),this._emit(t))}emit(e,n){this._checkGuard(n),this._emit([[k,e]])}up(e,n){if(this._deps.length===0)return;let t=ce(e);if(t.length===0)return;this._checkGuard(n);let i=n??{internal:!0};this._validateUpTiers(t);for(let o of this._deps)o.node.up?.(t,i)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let t of e){let i=n(t[0]);if(i===3||i===4)throw new Error(`Node "${this.name}": tier-${i} 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,n){if(n!=null&&this._guard!=null){let d=ue(n);if(!this._guard(d,"observe"))throw new X({actor:d,action:"observe",nodeName:this.name})}let i=this._isTerminal&&this._resubscribable;if(i){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)Me(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:i},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 s=!1;return()=>{s||(s=!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[n]=this._sinks;this._sinks=n}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,n=0;try{for(let t=0;t<e;t++){let i=t,o=this._deps[t];o.unsub=We,o.unsub=o.node.subscribe(a=>{if(o.unsub===null)return;let s=this._config.tierOf,d=!1;for(let u of a)s(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:i},this._actions);d&&this._maybeRunFnOnSettlement()}),n++}}catch(t){this._deps[n].unsub=null;for(let i=0;i<n;i++){let o=this._deps[i];if(o.unsub!=null){let a=o.unsub;o.unsub=null;try{a()}catch{}Me(o)}}throw this._dirtyDepCount=0,t}}_addDep(e){for(let i=0;i<this._deps.length;i++)if(this._deps[i].node===e)return i;let n=this._deps.length,t=qe(e);if(this._deps.push(t),this._sinks==null)return n;t.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve),t.unsub=We;try{t.unsub=e.subscribe(i=>{if(t.unsub===null)return;let o=this._config.tierOf,a=!1;for(let s of i)o(s[0])>=3&&(a=!0),this._config.onMessage(this,s,{direction:"down-in",depIndex:n},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(i){throw t.unsub=null,this._deps.pop(),this._dirtyDepCount--,i}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(t){this._emit([[N,this._wrapFnError("cleanup threw",t)]])}else if(n!=null&&typeof n=="object"){let t=n.deactivate;if(typeof t=="function")try{t()}catch(i){this._emit([[N,this._wrapFnError("cleanup.deactivate threw",i)]])}}for(let t of this._deps){if(t.unsub!=null){let i=t.unsub;t.unsub=null;try{i()}catch{}}Me(t)}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,n){let t=this._deps[e],i=n[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:n};for(let a of this._inspectorHooks)a(o)}if(i!==te){if(i===R){this._depDirtied(t);return}if(i===H){if(this._depInvalidated(t),this._cached===void 0)return;this._emit(De);return}if(i===B||i===re){this._emit([n]);return}if(i===z){this._emit(Te);return}if(i===k)this._depSettledAsData(t,n[1]);else if(i===I)this._depSettledAsResolved(t);else if(i===D)this._depSettledAsTerminal(t,!0);else if(i===N)this._depSettledAsTerminal(t,n[1]);else{this._emit([n]);return}if(!this._fn){(i===k||i===I)&&this._emit([n]),(i===D||i===N)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,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 n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Ie),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[N,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.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([[N,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(s){this._emit([[N,this._wrapFnError("cleanup.beforeRun threw",s)]]);return}}}let n=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),t=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let s=n[a];s!=null&&s.length>0&&(this._deps[a].prevData=s[s.length-1])}let i=this._deps.map(a=>a.terminal),o={prevData:t,terminalDeps:i,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:n,prevData:t};for(let s of this._inspectorHooks)s(a)}this._isExecutingFn=!0;try{let a=this._fn(n,this._actions,o);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let s=a;(typeof s.beforeRun=="function"||typeof s.deactivate=="function"||typeof s.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[N,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>je?(this._rerunDepth=0,this._emit([[N,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${je} \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,n){let t=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${t}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[J,e[0]]:e;let t=!0,i=!1,o=!1,a=-1;for(let d of e){let u=n(d[0]);u<a&&(t=!1),u===3&&(i=!0),d[0]===R&&(o=!0),a=u}let s=e;if(!t){let d=e.map((u,c)=>({m:u,i:c,tier:n(u[0])}));d.sort((u,c)=>u.tier-c.tier||u.i-c.i),s=d.map(u=>u.m)}if(i&&!o&&this._status!=="dirty"){let d=0;for(;d<s.length&&n(s[d][0])===0;)d++;return d===0?[J,...s]:[...s.slice(0,d),J,...s.slice(d)]}return s}_emit(e){if(e.length===0)return;for(let s=0;s<e.length;s++){let d=e[s];if(d[0]===N&&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 n=e;if(this._isTerminal&&!this._resubscribable){let s=e.filter(d=>d[0]===z||d[0]===H);if(s.length===0)return;n=s}n=this._frameBatch(n);let i=null;for(let s=0;s<n.length;s++){let d=n[s],u=d[0];if(u!==B&&u!==re){i?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===B?"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 p=d[1];if(u===B)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(p),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(p))c=!1;else if(this._pauseLocks.delete(p),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?i?.push(d):i==null&&(i=n.slice(0,s))}if(i!=null){if(i.length===0)return;n=i}if(this._hasMeta&&n.some(s=>s[0]===z))for(let s of Object.keys(this.meta))try{this.meta[s]._emit(Te)}catch{}let{finalMessages:o,equalsError:a}=this._updateState(n);if(o.length>0&&this._config.inspectorEnabled){let s=this._config.globalInspector;if(s!=null)try{s({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let s=this._config.tierOf,d=[];for(let u of o)s(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(o);a!=null&&this._emit([[N,a]])}_updateState(e){let n=this._config.tierOf,t,i,o=-1,a=0;for(let c of e)n(c[0])===3&&a++;let s=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===k){d=c;break}}for(let c=0;c<e.length;c++){let p=e[c],h=p[0];if(h===k){if(p.length>=2){let f=!1;if(s&&this._cached!==void 0)try{f=this._equals(this._cached,p[1])}catch(m){i=this._wrapFnError("equals threw",m),o=c;break}if(f){t==null&&(t=e.slice(0,c)),t.push(ye),this._status="resolved";continue}this._cached=p[1],this._versioning!=null&&(d<0||c===d)&&Ue(this._versioning,p[1],this._hashFn)}this._status="settled",t?.push(p)}else if(t?.push(p),h===R)this._status="dirty";else if(h===I)this._status="resolved";else if(h===D){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===N){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===H){if(this._cached!==void 0){let m=this._config.rigorRecorder;if(m!=null)try{m.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let m=f.invalidate;if(typeof m=="function")try{m()}catch{}}}else h===z&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=o>=0?t??e.slice(0,o):t??e;return i!=null?{finalMessages:u,equalsError:i}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let t of n)t(e)};_dispatchOrAccumulate(e){if(Ve()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ce(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}de(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);de(this._deliverToSinks,n,this._config.tierOf)}},Ye=r=>Array.isArray(r),Ee=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function L(r,e){return oe([],{...e,initial:r})}function $(r,e,n){return oe(r,(i,o,a)=>{let s=i.map((d,u)=>d!=null&&d.length>0?d.at(-1):a.prevData[u]);o.emit(e(s,a))},{describeKind:"derived",...n})}var se=O(()=>{"use strict";Re()});function Ze(r){return r.subscribe(()=>{})}var Qe=O(()=>{"use strict"});var en=O(()=>{"use strict";Qe()});var Rn={};sn(Rn,{NativeIndexBackend:()=>he,NativeListBackend:()=>pe,NativeLogBackend:()=>me,NativeMapBackend:()=>be,mergeReactiveLogs:()=>En,reactiveIndex:()=>xn,reactiveList:()=>kn,reactiveLog:()=>Mn,reactiveMap:()=>An});module.exports=dn(Rn);Y();U();se();function Je(r,e){if(r===e)return 0;let n=typeof r;if(n===typeof e&&(n==="number"||n==="string"||n==="boolean"||n==="bigint")){let i=r,o=e;return i<o?-1:i>o?1:0}return String(r).localeCompare(String(e))}function Tn(r,e){let n=Je(r[0],e[0]);return n!==0?n:Je(r[1],e[1])}function Xe(r){return[r.secondary,r.primary]}function Z(r,e){let n=Xe(e),t=0,i=r.length;for(;t<i;){let o=t+i>>1;Tn(n,Xe(r[o]))>0?t=o+1:i=o}return t}var he=class{_version=0;_buf=[];_byPrimary=new Map;get version(){return this._version}get size(){return this._buf.length}has(e){return this._byPrimary.has(e)}get(e){return this._byPrimary.get(e)?.value}upsert(e,n,t,i){let o=this._byPrimary.get(e),a={primary:e,secondary:n,value:t};if(o!==void 0&&i?.equals?.(o,a))return!1;if(o!==void 0){let d=Z(this._buf,o);this._buf.splice(d,1)}let s=Z(this._buf,a);return this._buf.splice(s,0,a),this._byPrimary.set(e,a),this._version+=1,o===void 0}upsertMany(e,n){let t=0;try{for(let i of e){let o=this._byPrimary.get(i.primary),a={primary:i.primary,secondary:i.secondary,value:i.value};if(o!==void 0&&n?.equals?.(o,a))continue;if(o!==void 0){let d=Z(this._buf,o);this._buf.splice(d,1)}let s=Z(this._buf,a);this._buf.splice(s,0,a),this._byPrimary.set(i.primary,a),t+=1}}finally{t>0&&(this._version+=1)}return t}delete(e){let n=this._byPrimary.get(e);if(n===void 0)return!1;let t=Z(this._buf,n);return this._buf.splice(t,1),this._byPrimary.delete(e),this._version+=1,!0}deleteMany(e){let n=0;try{for(let t of e){let i=this._byPrimary.get(t);if(i===void 0)continue;let o=Z(this._buf,i);this._buf.splice(o,1),this._byPrimary.delete(t),n+=1}}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._byPrimary.clear(),this._version+=1,e)}toArray(){return[...this._buf]}toPrimaryMap(){let e=new Map;for(let n of this._buf)e.set(n.primary,n.value);return e}};function wn(r){return r.subscribe(()=>{})}function xn(r={}){let{name:e,versioning:n,equals:t,backend:i}=r,o=i??new he;function a(f){return f?.equals!==void 0||t===void 0?f:{...f,equals:t}}let s=L([],{name:e,describeKind:"state",equals:(f,m)=>f===m,...n!=null?{versioning:n}:{}}),d=$([s],([f])=>{let m=f,y=new Map;for(let w of m)y.set(w.primary,w.value);return y},{initial:o.toPrimaryMap(),describeKind:"derived"}),u=wn(d),c=!1;function p(){let f=o.toArray();K(()=>{s.down([[R]]),s.down([[k,f]])})}function h(f){let m=o.version;try{return f()}finally{o.version!==m&&p()}}return{ordered:s,byPrimary:d,has(f){return o.has(f)},get(f){return o.get(f)},get size(){return o.size},upsert(f,m,y,w){return h(()=>o.upsert(f,m,y,a(w)))},upsertMany(f,m){let y=[...f];y.length!==0&&h(()=>o.upsertMany(y,a(m)))},delete(f){h(()=>o.delete(f))},deleteMany(f){let m=[...f];m.length!==0&&h(()=>o.deleteMany(m))},clear(){h(()=>o.clear())},dispose(){c||(c=!0,u())}}}Y();U();se();var pe=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._buf.length+e;if(!(n<0||n>=this._buf.length))return this._buf[n]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._buf.length;this._buf.length=n+e.length;for(let t=0;t<e.length;t++)this._buf[n+t]=e[t];this._version+=1}insert(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,n),this._version+=1}insertMany(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);n.length!==0&&(this._buf.splice(e,0,...n),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let n=e>=0?e:this._buf.length+e;if(n<0||n>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[t]=this._buf.splice(n,1);return this._version+=1,t}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function kn(r,e={}){let{name:n,versioning:t,backend:i}=e,o=i??new pe(r),a=L(o.toArray(),{name:n,describeKind:"state",equals:(u,c)=>u===c,...t!=null?{versioning:t}:{}});function s(){let u=o.toArray();K(()=>{a.down([[R]]),a.down([[k,u]])})}function d(u){let c=o.version;try{return u()}finally{o.version!==c&&s()}}return{items:a,get size(){return o.size},at(u){return o.at(u)},append(u){d(()=>o.append(u))},appendMany(u){d(()=>o.appendMany(u))},insert(u,c){d(()=>o.insert(u,c))},insertMany(u,c){d(()=>o.insertMany(u,c))},pop(u=-1){return d(()=>o.pop(u))},clear(){d(()=>o.clear())},dispose(){}}}Y();U();Re();se();en();var me=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,n){if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=n,n!==void 0){if(this._buf=new Array(n),e&&e.length>0){let t=Math.min(e.length,n),i=e.length-t;for(let o=0;o<t;o++)this._buf[o]=e[i+o];this._size=t}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._size+e;if(!(n<0||n>=this._size))return this._maxSize!==void 0?this._buf[(this._head+n)%this._maxSize]:this._buf[n]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let t=n;t<e.length;t++)this._rawAppend(e[t]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let n=0;n<e;n++)this._buf[(this._head+n)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let n=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,n);else{for(let t=0;t<n;t++)this._buf[(this._head+t)%this._maxSize]=void 0;this._head=(this._head+n)%this._maxSize}return this._size-=n,this._version+=1,n}slice(e,n){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(n!==void 0&&(!Number.isInteger(n)||n<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${n})`);let t=n===void 0?this._size:Math.min(Math.max(n,0),this._size),i=Math.min(e,this._size);if(i>=t)return[];let o=t-i;if(this._maxSize===void 0)return this._buf.slice(i,t);let a=new Array(o);for(let s=0;s<o;s++)a[s]=this._buf[(this._head+i+s)%this._maxSize];return a}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let n=Math.min(e,this._size);return this.slice(this._size-n,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let n=0;n<this._size;n++)e[n]=this._buf[(this._head+n)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let n=0;n<e.length;n++)this._buf.push(e[n]);this._size=this._buf.length}else{let n=this._maxSize;for(let o=0;o<n;o++)this._buf[o]=void 0;this._head=0;let t=Math.min(e.length,n),i=e.length-t;for(let o=0;o<t;o++)this._buf[o]=e[i+o];this._size=t}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function ae(r){return r.subscribe(()=>{})}var Nn=64;function Mn(r,e={}){let{name:n,maxSize:t,versioning:i,guard:o,backend:a}=e,s=a??new me(r,t),d=L(s.toArray(),{name:n,describeKind:"state",equals:(l,b)=>l===b,...i!=null?{versioning:i}:{},...o!=null?{guard:o}:{}});function u(){let l=s.toArray();K(()=>{d.down([[R]],{internal:!0}),d.down([[k,l]],{internal:!0})})}let c=new Map,p=new Map,h=new Map;function f(l,b){return`${l}:${b===void 0?"END":b}`}function m(l){if(l.size<Nn)return;let b=l.keys().next();if(b.done)return;let v=l.get(b.value);v!==void 0&&v.dispose(),l.delete(b.value)}function y(l){let b=s.version;try{return l()}finally{s.version!==b&&u()}}function w(l){if(!Number.isInteger(l)||l<0)throw new RangeError(`tail: n must be a non-negative integer (got ${l})`);let b=c.get(l);if(b!==void 0)return c.delete(l),c.set(l,b),b.node;m(c);let v=$([d],([g])=>{let x=g;return l===0||x.length===0?[]:x.slice(Math.max(0,x.length-l))},{initial:s.tail(l),describeKind:"derived"}),T=ae(v);return c.set(l,{node:v,dispose:T}),v}function _(l,b){if(!Number.isInteger(l)||l<0)throw new RangeError(`slice: start must be a non-negative integer (got ${l})`);if(b!==void 0&&(!Number.isInteger(b)||b<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${b})`);let v=f(l,b),T=p.get(v);if(T!==void 0)return p.delete(v),p.set(v,T),T.node;m(p);let g=$([d],([A])=>{let S=A;return b===void 0?S.slice(l):S.slice(l,b)},{initial:s.slice(l,b),describeKind:"derived"}),x=ae(g);return p.set(v,{node:g,dispose:x}),g}function E(l){let b=h.get(l);if(b!==void 0)return b.node;let v=$([d,l],([g,x])=>{let A=g,S=Math.max(0,Math.trunc(x??0));return A.slice(S)},{initial:[],describeKind:"derived"}),T=ae(v);return h.set(l,{node:v,dispose:T}),v}let M,V;function C(){M===void 0&&(M=oe([d],(l,b,v)=>{let T=l[0],x=T!=null&&T.length>0?T.at(-1):v.prevData[0];if(x==null||x.length===0){b.down([[I]]);return}b.emit(x[x.length-1])},{name:n!=null?`${n}::lastValue`:"lastValue",describeKind:"derived",initial:s.size===0?void 0:s.at(s.size-1)}),V=$([d],([l])=>l.length>0,{name:n!=null?`${n}::hasLatest`:"hasLatest",describeKind:"derived",initial:s.size>0}),ae(M),ae(V))}let W={entries:d,get size(){return s.size},at(l){return s.at(l)},append(l){y(()=>s.append(l))},appendMany(l){l.length!==0&&y(()=>s.appendMany(l))},clear(){y(()=>s.clear())},trimHead(l){y(()=>s.trimHead(l))},withLatest(){return C(),d},get lastValue(){return C(),M},get hasLatest(){return C(),V},view(l){switch(l.kind){case"tail":return w(l.n);case"slice":return _(l.start,l.stop);case"fromCursor":return E(l.cursor)}},attach(l){let b=l.subscribe(v=>{for(let T of v)T[0]===k&&W.append(T[1])});return()=>b()},attachStorage(l){if(l.length===0)return()=>{};let b=new Map;for(let T of l)b.set(T,s.size);(async()=>{for(let T of l)if(typeof T.loadEntries=="function")try{let g=await Promise.resolve(T.loadEntries());g.entries.length>0&&s.size===0&&(s.restore(g.entries),b.set(T,g.entries.length),u());break}catch{}})();let v=d.subscribe(T=>{for(let g of T){if(g[0]!==k)continue;let x=g[1];for(let A of l){let S=b.get(A)??0;if(x.length<S){try{let F=A.appendEntries(x);F instanceof Promise&&F.catch(()=>{})}catch{}b.set(A,x.length);continue}if(x.length===S)continue;let Q=x.slice(S);b.set(A,x.length);try{let F=A.appendEntries(Q);F instanceof Promise&&F.catch(()=>{})}catch{}}}});return()=>v()},disposeAllViews(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()},dispose(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()}};return W}var Se=new WeakMap;function En(r){let e=Se.get(r);if(e)return e;let n=r.map(c=>c.cache??[]),t=n.flat(),i=L(t,{name:"mergeReactiveLogs",describeKind:"state",equals:(c,p)=>c===p}),o=r.map((c,p)=>[...n[p]??[]]),a=[];for(let c=0;c<r.length;c++){let p=c,h=r[p].subscribe(f=>{for(let m of f)if(m[0]===k)o[p]=[...m[1]],i.emit(o.flat());else if(m[0]===D){o[p]=[];let y=a[p];y!==void 0&&(a[p]=void 0,y())}else m[0]===N&&i.down([[N,m[1]]])});a.push(h)}let s=Ze(i),d=!1,u={node:i,dispose(){if(!d){d=!0;for(let c of a)c?.();a.length=0,s(),Se.delete(r)}}};return Se.set(r,u),u}Y();we();U();se();var be=class{_version=0;_store=new Map;_maxSize;_defaultTtl;constructor(e={}){let{maxSize:n,defaultTtl:t}=e;if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(t!==void 0&&t<=0)throw new RangeError("defaultTtl must be positive");this._maxSize=n,this._defaultTtl=t}get version(){return this._version}get size(){return this._store.size}has(e){let n=this._store.get(e);return n===void 0?!1:this._isExpired(n)?(this._store.delete(e),this._version+=1,!1):(this._touchLru(e,n),!0)}get(e){let n=this._store.get(e);if(n!==void 0){if(this._isExpired(n)){this._store.delete(e),this._version+=1;return}return this._touchLru(e,n),n.value}}set(e,n,t){let i=this._resolveExpiresAt(t);this._store.has(e)&&this._store.delete(e),this._store.set(e,{value:n,expiresAt:i}),this._evictLruWhileOver(),this._version+=1}setMany(e,n){let t=this._resolveExpiresAt(n),i=0;try{for(let[o,a]of e)this._store.has(o)&&this._store.delete(o),this._store.set(o,{value:a,expiresAt:t}),i+=1}finally{i>0&&(this._evictLruWhileOver(),this._version+=1)}}delete(e){let n=this._store.delete(e);return n&&(this._version+=1),n}deleteMany(e){let n=0;try{for(let t of e)this._store.delete(t)&&(n+=1)}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._store.size;return e===0?0:(this._store.clear(),this._version+=1,e)}pruneExpired(){let e=ie(),n=0;for(let[t,i]of this._store)this._isExpired(i,e)&&(this._store.delete(t),n+=1);return n>0&&(this._version+=1),n}toMap(){let e=ie(),n=new Map;for(let[t,i]of this._store)this._isExpired(i,e)||n.set(t,i.value);return n}_resolveExpiresAt(e){let n=e??this._defaultTtl;if(n!==void 0){if(!Number.isFinite(n)||n<=0)throw new RangeError(`MapBackend: ttl must be a positive finite number (got ${n})`);return ie()+n*1e9}}_isExpired(e,n){return e.expiresAt===void 0?!1:(n??ie())>=e.expiresAt}_touchLru(e,n){this._store.delete(e),this._store.set(e,n)}_evictLruWhileOver(){if(this._maxSize!==void 0)for(;this._store.size>this._maxSize;){let e=this._store.keys().next().value;if(e===void 0)break;this._store.delete(e)}}};function An(r={}){let{name:e,maxSize:n,defaultTtl:t,versioning:i,backend:o,retention:a}=r;if(a&&n!==void 0)throw new RangeError("reactiveMap: `maxSize` (LRU) and `retention` (score-based) are mutually exclusive. Pick one eviction policy.");if(a&&a.archiveThreshold===void 0&&a.maxSize===void 0)throw new RangeError("reactiveMap: `retention` requires at least one of `archiveThreshold` or `maxSize` to trigger archival.");let s=o??new be({maxSize:n,defaultTtl:t}),d=L(s.toMap(),{name:e,describeKind:"state",equals:(h,f)=>h===f,...i!=null?{versioning:i}:{}});function u(){let h=s.toMap();K(()=>{d.down([[R]]),d.down([[k,h]])})}function c(){if(!a)return;let h=s.toMap(),f=a.archiveThreshold,m=a.maxSize,y=[];for(let[_,E]of h)y.push({key:_,value:E,score:a.score(_,E)});y.sort((_,E)=>_.score-E.score);let w=new Set;if(f!==void 0)for(let _ of y)if(_.score<f)w.add(_.key);else break;if(m!==void 0&&y.length-w.size>m)for(let _ of y){if(y.length-w.size<=m)break;w.has(_.key)||w.add(_.key)}if(w.size!==0)for(let _ of y)w.has(_.key)&&(a.onArchive?.(_.key,_.value,_.score),s.delete(_.key))}function p(h,f="mutation"){let m=s.version;try{return h()}finally{s.version!==m&&(f==="mutation"&&c(),u())}}return{entries:d,has(h){return p(()=>s.has(h),"read")},get(h){return p(()=>s.get(h),"read")},set(h,f,m){p(()=>s.set(h,f,m?.ttl))},setMany(h,f){p(()=>s.setMany(h,f?.ttl))},delete(h){p(()=>s.delete(h))},deleteMany(h){p(()=>s.deleteMany(h))},clear(){p(()=>s.clear())},pruneExpired(){p(()=>s.pruneExpired())},get size(){return s.size},dispose(){}}}0&&(module.exports={NativeIndexBackend,NativeListBackend,NativeLogBackend,NativeMapBackend,mergeReactiveLogs,reactiveIndex,reactiveList,reactiveLog,reactiveMap});
@@ -1,6 +1,6 @@
1
- import { a as Node, V as VersioningLevel } from '../node-fSc-hCv8.cjs';
2
- export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, R as ReactiveLogBundle, a as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-ScpWyqny.cjs';
3
- export { M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, R as ReactiveMapBundle, a as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-DmgeADH8.cjs';
1
+ import { N as Node, V as VersioningLevel } from '../node-BYInONRr.cjs';
2
+ export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, a as ReactiveLogBundle, R as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-_zeEnB9H.cjs';
3
+ export { M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, R as ReactiveMapBundle, a as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-B2qfD3hb.cjs';
4
4
  import './storage-tiers.cjs';
5
5
 
6
6
  type IndexRow<K, V = unknown> = {
@@ -1,6 +1,6 @@
1
- import { a as Node, V as VersioningLevel } from '../node-fSc-hCv8.js';
2
- export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, R as ReactiveLogBundle, a as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-jirQsxMY.js';
3
- export { M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, R as ReactiveMapBundle, a as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-CHyeCf4D.js';
1
+ import { N as Node, V as VersioningLevel } from '../node-BYInONRr.js';
2
+ export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, a as ReactiveLogBundle, R as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-BlAsPLl2.js';
3
+ export { M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, R as ReactiveMapBundle, a as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-jFIsE6Kt.js';
4
4
  import './storage-tiers.js';
5
5
 
6
6
  type IndexRow<K, V = unknown> = {
@@ -1 +1 @@
1
- import{a as p,b as t}from"../chunk-NNKJUORL.js";import{a as x,b as a}from"../chunk-KGKJCHEK.js";import{a as f,b as m}from"../chunk-TZQPPQEQ.js";import{a as o,b as r,c as e}from"../chunk-KUVDFOJH.js";import"../chunk-MQZWA3DF.js";import"../chunk-LYCLF26R.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{p as NativeIndexBackend,x as NativeListBackend,o as NativeLogBackend,f as NativeMapBackend,e as mergeReactiveLogs,t as reactiveIndex,a as reactiveList,r as reactiveLog,m as reactiveMap};
1
+ import{a as p,b as t}from"../chunk-NNKJUORL.js";import{a as x,b as a}from"../chunk-KGKJCHEK.js";import{a as f,b as m}from"../chunk-TZQPPQEQ.js";import{a as o,b as r,c as e}from"../chunk-AU7YTQX7.js";import"../chunk-IA7DUNGB.js";import"../chunk-LYCLF26R.js";import"../chunk-CK2E7BTU.js";import"../chunk-QYADASLV.js";export{p as NativeIndexBackend,x as NativeListBackend,o as NativeLogBackend,f as NativeMapBackend,e as mergeReactiveLogs,t as reactiveIndex,a as reactiveList,r as reactiveLog,m as reactiveMap};
@@ -0,0 +1,5 @@
1
+ "use strict";var $=Object.defineProperty;var xn=Object.getOwnPropertyDescriptor;var cn=Object.getOwnPropertyNames;var pn=Object.prototype.hasOwnProperty;var hn=(n,e)=>{for(var s in e)$(n,s,{get:e[s],enumerable:!0})},gn=(n,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of cn(e))!pn.call(n,r)&&r!==s&&$(n,r,{get:()=>e[r],enumerable:!(i=xn(e,r))||i.enumerable});return n};var yn=n=>gn($({},"__esModule",{value:!0}),n);var Vn={};hn(Vn,{mermaidLiveUrl:()=>N,toAscii:()=>nn,toD2:()=>sn,toJson:()=>an,toMermaid:()=>B,toMermaidUrl:()=>fn,toPretty:()=>ln});module.exports=yn(Vn);function j(n){return n>=768&&n<=879||n>=1155&&n<=1161||n>=1425&&n<=1469||n>=1552&&n<=1562||n>=1611&&n<=1631||n>=1648&&n===1648||n>=1750&&n<=1756||n>=1759&&n<=1764||n>=1767&&n<=1768||n>=1770&&n<=1773||n>=1840&&n<=1866||n>=1958&&n<=1968||n>=2304&&n<=2307||n>=2362&&n<=2383||n>=2385&&n<=2391||n>=2402&&n<=2403||n>=2433&&n<=2435||n>=2492&&n<=2509||n>=2561&&n<=2563||n>=2620&&n<=2641||n>=2672&&n<=2673||n>=2677&&n===2677||n>=3633&&n===3633||n>=3636&&n<=3642||n>=3655&&n<=3662||n>=3761&&n===3761||n>=3764&&n<=3772||n>=3784&&n<=3790||n>=7616&&n<=7679||n>=8400&&n<=8447||n>=65024&&n<=65039||n>=65056&&n<=65071||n===8205?0:n>=4352&&n<=4447||n>=8986&&n<=8987||n>=9001&&n<=9002||n>=9193&&n<=9203||n>=9208&&n<=9210||n>=9725&&n<=9726||n>=9748&&n<=9749||n>=9800&&n<=9811||n===9855||n===9875||n===9889||n>=9898&&n<=9899||n>=9917&&n<=9918||n>=9924&&n<=9925||n===9934||n===9940||n===9962||n>=9970&&n<=9971||n===9973||n===9978||n===9981||n===9986||n===9989||n>=9992&&n<=9997||n===9999||n>=10067&&n<=10069||n===10071||n>=10133&&n<=10135||n===10160||n===10175||n>=10548&&n<=10549||n>=11013&&n<=11015||n>=11035&&n<=11036||n===11088||n===11093||n>=11904&&n<=12350||n>=12352&&n<=12447||n>=12448&&n<=12543||n>=12549&&n<=12591||n>=12593&&n<=12686||n>=12688&&n<=12771||n>=12784&&n<=12830||n>=12832&&n<=12871||n>=12880&&n<=19903||n>=19968&&n<=40959||n>=43360&&n<=43388||n>=44032&&n<=55203||n>=63744&&n<=64255||n>=65040&&n<=65049||n>=65072&&n<=65131||n>=65281&&n<=65376||n>=65504&&n<=65510||n>=126980&&n===126980||n===127183||n>=127344&&n<=127345||n===127358||n===127359||n===127374||n>=127377&&n<=127386||n>=127456&&n<=127487||n>=127488&&n<=127490||n===127514||n===127535||n>=127538&&n<=127546||n>=127568&&n<=127569||n>=127744&&n<=129535||n>=129536&&n<=129791||n>=129792&&n<=130047||n>=131072&&n<=196605||n>=196608&&n<=262141?2:1}function S(n){let e=0;for(let s of n)e+=j(s.codePointAt(0));return e}function K(n,e){if(e<=0)return"";let s=0,i="";for(let r of n){let t=j(r.codePointAt(0));if(s+t>e){if(e<=1)return"\u2026";for(;s+1>e&&i.length>0;){let o=[...i].pop();i=i.slice(0,-o.length),s-=j(o.codePointAt(0))}return`${i}\u2026`}i+=r,s+=t}return i}var mn={horizontal:"\u2500",vertical:"\u2502",cornerTL:"\u250C",cornerTR:"\u2510",cornerBL:"\u2514",cornerBR:"\u2518",tDown:"\u252C",tUp:"\u2534",tRight:"\u251C",tLeft:"\u2524",cross:"\u253C",arrowRight:"\u25B6",arrowDown:"\u25BC",arrowLeft:"\u25C0",arrowUp:"\u25B2",boxTL:"\u250C",boxTR:"\u2510",boxBL:"\u2514",boxBR:"\u2518",boxH:"\u2500",boxV:"\u2502"},dn={horizontal:"-",vertical:"|",cornerTL:"+",cornerTR:"+",cornerBL:"+",cornerBR:"+",tDown:"+",tUp:"+",tRight:"+",tLeft:"+",cross:"+",arrowRight:">",arrowDown:"v",arrowLeft:"<",arrowUp:"^",boxTL:"+",boxTR:"+",boxBL:"+",boxBR:"+",boxH:"-",boxV:"|"};function W(n,e){let s=e.charset==="ascii"?dn:mn,i=n.width,r=n.height,t=Array.from({length:r},()=>Array.from({length:i},()=>" ")),o=Array.from({length:r},()=>Array.from({length:i},()=>"empty"));for(let a of n.edges)Ln(t,o,s,a);for(let a of n.boxes)bn(t,o,s,a,e.labelOf(a.id));return t.map(a=>Tn(a.join(""))).join(`
2
+ `)}function bn(n,e,s,i,r){let{x:t,y:o,w:a,h:l}=i;if(a<2||l<2){l>0&&F(n,e,t,o,a,r);return}w(n,e,t,o,s.boxTL);for(let u=t+1;u<t+a-1;u+=1)w(n,e,u,o,s.boxH);w(n,e,t+a-1,o,s.boxTR);for(let u=o+1;u<o+l-1;u+=1){w(n,e,t,u,s.boxV);for(let c=t+1;c<t+a-1;c+=1)Y(n,e,c,u," ","empty");w(n,e,t+a-1,u,s.boxV)}w(n,e,t,o+l-1,s.boxBL);for(let u=t+1;u<t+a-1;u+=1)w(n,e,u,o+l-1,s.boxH);w(n,e,t+a-1,o+l-1,s.boxBR);let f=o+Math.floor(l/2);F(n,e,t+1,f,a-2,r)}function w(n,e,s,i,r){Y(n,e,s,i,r,r===" "?"empty":r==="\u2500"||r==="-"?"boxH":r==="\u2502"||r==="|"?"boxV":"boxCorner")}function Y(n,e,s,i,r,t){if(i<0||i>=n.length)return;let o=n[i];s<0||s>=o.length||(o[s]=r,e[i][s]=t)}function F(n,e,s,i,r,t){if(i<0||i>=n.length)return;let o=s,a=r;for(let l of t){let f=S(l);if(f!==0){if(a<f)break;o>=0&&o<n[i].length&&(n[i][o]=l,e[i][o]="label",f===2&&o+1<n[i].length&&(n[i][o+1]="",e[i][o+1]="label")),o+=f,a-=f}}for(;a>0;)o>=0&&o<n[i].length&&(n[i][o]=" ",e[i][o]="empty"),o+=1,a-=1}function Ln(n,e,s,i){let r=i.points;if(r.length<2)return;for(let l=0;l+1<r.length;l+=1)wn(n,e,s,r[l],r[l+1]);for(let l=1;l+1<r.length;l+=1){let f=r[l-1],u=r[l],c=r[l+1],x=Dn(f,u,c,s);x&&J(n,e,u.x,u.y,x,"edgeCorner")}let t=r[r.length-1],o=r[r.length-2],a=In(o,t,s);a&&J(n,e,t.x,t.y,a,"arrow")}function wn(n,e,s,i,r){if(!(i.x===r.x&&i.y===r.y)){if(i.y===r.y){let t=i.y,o=Math.min(i.x,r.x),a=Math.max(i.x,r.x);for(let l=o;l<=a;l+=1)k(n,e,l,t,s,"h")}else if(i.x===r.x){let t=i.x,o=Math.min(i.y,r.y),a=Math.max(i.y,r.y);for(let l=o;l<=a;l+=1)k(n,e,t,l,s,"v")}}}function k(n,e,s,i,r,t){if(i<0||i>=n.length)return;let o=n[i];if(s<0||s>=o.length)return;let a=e[i][s];if(!(a==="boxH"||a==="boxV"||a==="boxCorner"||a==="label")){if(a==="empty"){o[s]=t==="h"?r.horizontal:r.vertical,e[i][s]=t==="h"?"edgeH":"edgeV";return}if(a==="edgeH"&&t==="v"){o[s]=r.cross,e[i][s]="edgeCorner";return}if(a==="edgeV"&&t==="h"){o[s]=r.cross,e[i][s]="edgeCorner";return}}}function J(n,e,s,i,r,t){if(i<0||i>=n.length)return;let o=n[i];if(s<0||s>=o.length)return;let a=e[i][s];a==="boxH"||a==="boxV"||a==="boxCorner"||a==="label"||(o[s]=r,e[i][s]=t)}function Dn(n,e,s,i){let r=n.y===e.y,t=e.y===s.y;if(r===t)return;if(r){let l=n.x<e.x,f=s.y>e.y;return l&&f?i.cornerTR:l&&!f?i.cornerBR:!l&&f?i.cornerTL:i.cornerBL}let o=n.y<e.y,a=s.x>e.x;return o&&a?i.cornerBL:o&&!a?i.cornerBR:!o&&a?i.cornerTL:i.cornerTR}function In(n,e,s){if(e.x>n.x)return s.arrowRight;if(e.x<n.x)return s.arrowLeft;if(e.y>n.y)return s.arrowDown;if(e.y<n.y)return s.arrowUp}function Tn(n){let e=n.length;for(;e>0&&n.charCodeAt(e-1)===32;)e-=1;return n.slice(0,e)}function Q(n){let e=Mn(n);On(e),Cn(e),Rn(e),Sn(e,n);let s=En(e,n),{width:i,height:r}=Pn(e),t=[];for(let o of e.layers)for(let a of o)a.isVirtual||t.push({id:a.id,layer:a.layer,order:a.order,x:a.x,y:a.y,w:a.w,h:a.h});return{boxes:t,edges:s,width:i,height:r}}function Mn(n){let e=new Map;for(let r of n.nodes)e.set(r,{id:r,isVirtual:!1,layer:-1,order:0,x:0,y:0,w:n.widthCells(r),h:n.heightCells(r),in:[],out:[]});let s=[],i=0;for(let r of n.edges){if(r.from===r.to)continue;let t=e.get(r.from),o=e.get(r.to);if(!t||!o)continue;let a={chainId:i++,chainFrom:r.from,chainTo:r.to,fromId:r.from,toId:r.to,hopIndex:0,chainLen:1};t.out.push(a),o.in.push(a),s.push(a)}return{nodes:e,layers:[],hops:s}}function On(n){let e=new Map;for(let t of n.nodes.values())e.set(t.id,t.in.length);let s=[];for(let t of n.nodes.values())(e.get(t.id)??0)===0&&(t.layer=0,s.push(t));let i=new Set,r=0;for(;r<s.length;){let t=s[r++];if(!i.has(t.id)){i.add(t.id);for(let o of t.out){let a=n.nodes.get(o.toId);a.layer=Math.max(a.layer,t.layer+1);let l=(e.get(a.id)??0)-1;e.set(a.id,l),l<=0&&s.push(a)}}}for(let t of n.nodes.values())t.layer<0&&(t.layer=0)}function Cn(n){let e=Math.max(0,...Array.from(n.nodes.values(),t=>t.layer)),s=Array.from({length:e+1},()=>[]);for(let t of n.nodes.values())s[t.layer].push(t);let i=[],r=0;for(let t of n.hops){let o=n.nodes.get(t.fromId),a=n.nodes.get(t.toId),l=a.layer-o.layer;if(l<=0){o.out=o.out.filter(c=>c!==t),a.in=a.in.filter(c=>c!==t);continue}if(l===1){t.hopIndex=0,t.chainLen=1,i.push(t);continue}o.out=o.out.filter(c=>c!==t),a.in=a.in.filter(c=>c!==t);let f=o;for(let c=1;c<l;c+=1){let x=`__virt_${r++}__`,h={id:x,isVirtual:!0,layer:o.layer+c,order:0,x:0,y:0,w:0,h:1,in:[],out:[]};n.nodes.set(x,h),s[h.layer].push(h);let p={chainId:t.chainId,chainFrom:t.chainFrom,chainTo:t.chainTo,fromId:f.id,toId:x,hopIndex:c-1,chainLen:l};f.out.push(p),h.in.push(p),i.push(p),f=h}let u={chainId:t.chainId,chainFrom:t.chainFrom,chainTo:t.chainTo,fromId:f.id,toId:a.id,hopIndex:l-1,chainLen:l};f.out.push(u),a.in.push(u),i.push(u)}for(let t of s)for(let o=0;o<t.length;o+=1)t[o].order=o;n.layers=s,n.hops=i}function Rn(n){for(let s=0;s<4;s+=1){for(let i=1;i<n.layers.length;i+=1)X(n,n.layers[i],"in"),G(n.layers[i]);for(let i=n.layers.length-2;i>=0;i-=1)X(n,n.layers[i],"out"),G(n.layers[i])}for(let s=0;s<2;s+=1){let i=!1;for(let r=1;r<n.layers.length;r+=1){let t=n.layers[r];for(let o=0;o+1<t.length;o+=1){let a=q(n,t[o],t[o+1],"in");[t[o],t[o+1]]=[t[o+1],t[o]],G(t),q(n,t[o],t[o+1],"in")<a?i=!0:([t[o],t[o+1]]=[t[o+1],t[o]],G(t))}}if(!i)break}}function X(n,e,s){let i=new Map;for(let r of e){let t=s==="in"?r.in:r.out;if(t.length===0){i.set(r.id,r.order);continue}let o=0,a=0;for(let l of t){let f=n.nodes.get(s==="in"?l.fromId:l.toId);f&&(o+=f.order,a+=1)}i.set(r.id,a===0?r.order:o/a)}e.sort((r,t)=>{let o=i.get(r.id),a=i.get(t.id);return o!==a?o-a:r.order-t.order})}function G(n){for(let e=0;e<n.length;e+=1)n[e].order=e}function q(n,e,s,i){let r=i==="in"?e.in:e.out,t=i==="in"?s.in:s.out,o=0;for(let a of r)for(let l of t){let f=n.nodes.get(i==="in"?a.fromId:a.toId)?.order??0,u=n.nodes.get(i==="in"?l.fromId:l.toId)?.order??0;(e.order<s.order&&f>u||e.order>s.order&&f<u)&&(o+=1)}return o}function Sn(n,e){e.direction==="LR"?Gn(n,e):vn(n,e)}function Gn(n,e){let s=[],i=0;for(let r=0;r<n.layers.length;r+=1){s.push(i);let t=0;for(let o of n.layers[r])t=Math.max(t,o.w);i+=t+e.layerGap}for(let r=0;r<n.layers.length;r+=1)for(let t of n.layers[r])t.x=s[r];for(let r of n.layers){let t=0;for(let o of r)o.y=t,t+=o.h+e.nodeGap}Z(n,e,"y")}function vn(n,e){let s=[],i=0;for(let r=0;r<n.layers.length;r+=1){s.push(i);let t=0;for(let o of n.layers[r])t=Math.max(t,o.h);i+=t+e.layerGap}for(let r=0;r<n.layers.length;r+=1)for(let t of n.layers[r])t.y=s[r];for(let r of n.layers){let t=0;for(let o of r)o.x=t,t+=o.w+e.nodeGap}Z(n,e,"x")}function Z(n,e,s){let i=t=>s==="y"?t.h:t.w,r=e.nodeGap;for(let t=0;t<2;t+=1){let o=t===0?n.layers.slice(1):n.layers.slice(0,-1).reverse();for(let a of o){let l=new Map;for(let u of a){let c=t===0?u.in:u.out;if(c.length===0)continue;let x=[];for(let p of c){let y=n.nodes.get(t===0?p.fromId:p.toId);if(!y)continue;let m=s==="y"?y.y:y.x;x.push(m+Math.floor(i(y)/2))}if(x.length===0)continue;x.sort((p,y)=>p-y);let h=x[Math.floor(x.length/2)];l.set(u.id,h-Math.floor(i(u)/2))}let f=0;for(let u of a){let c=l.get(u.id),x=s==="y"?u.y:u.x,p=Math.max(c??x,f);s==="y"?u.y=p:u.x=p,f=p+i(u)+r}}}}function En(n,e){let s=new Map;for(let f of n.hops){let u=s.get(f.chainId);u?u.push(f):s.set(f.chainId,[f])}for(let f of s.values())f.sort((u,c)=>u.hopIndex-c.hopIndex);let i=e.direction==="LR",r=f=>i?f.x:f.y,t=f=>i?f.w:f.h,o=f=>i?f.y+Math.floor(f.h/2):f.x+Math.floor(f.w/2),a=new Map;for(let f=0;f+1<n.layers.length;f+=1){let u=n.layers[f],c=n.layers[f+1],x=0;for(let g of u)x=Math.max(x,r(g)+t(g));let h=Number.POSITIVE_INFINITY;for(let g of c)h=Math.min(h,r(g));let p=Number.isFinite(h)?h-1:x,y=Math.max(1,p-x+1),m=[];for(let g of u)for(let d of g.out)m.push(d);m.sort((g,d)=>{let b=o(n.nodes.get(g.fromId)),L=o(n.nodes.get(d.fromId));if(b!==L)return b-L;let O=o(n.nodes.get(g.toId)),M=o(n.nodes.get(d.toId));return O-M});let D=[],C=new Map;for(let g of m){let d=o(n.nodes.get(g.fromId)),b=o(n.nodes.get(g.toId)),L=Math.min(d,b),O=Math.max(d,b),M=-1;for(let R=0;R<D.length;R+=1){let _=D[R],U=!0;for(let z of _)if(z.lo<=O&&L<=z.hi){U=!1;break}if(U){_.push({lo:L,hi:O}),M=R;break}}M<0&&(D.push([{lo:L,hi:O}]),M=D.length-1),C.set(g,M)}let I=D.length,T=y>=Math.max(3,I+2),H=T?x+1:x,un=T?p-1:p,V=Math.max(1,un-H+1);for(let g of m){let d=C.get(g),b;if(I<=1)b=H+Math.floor(V/2);else{let L=(V-1)/(I-1);b=H+Math.floor(d*L)}a.set(g,Math.max(x,Math.min(p,b)))}}let l=[];for(let[,f]of s){let u=[];for(let x=0;x<f.length;x+=1){let h=f[x],p=n.nodes.get(h.fromId),y=n.nodes.get(h.toId),m=a.get(h),D=p.isVirtual?r(p):r(p)+t(p),C=y.isVirtual?r(y):r(y)-1,I=o(p),T=o(y);x===0&&v(u,i,D,I),I!==T&&(v(u,i,m,I),v(u,i,m,T)),v(u,i,C,T)}let c=f[0];l.push({from:c.chainFrom,to:c.chainTo,points:An(u)})}return l}function v(n,e,s,i){n.push(e?{x:s,y:i}:{x:i,y:s})}function An(n){let e=[];for(let s of n){let i=e[e.length-1];(!i||i.x!==s.x||i.y!==s.y)&&e.push(s)}return e}function Pn(n){let e=0,s=0;for(let i of n.layers)for(let r of i)e=Math.max(e,r.x+r.w),s=Math.max(s,r.y+r.h);return{width:e,height:s}}var Bn=24,Hn=4,$n=1,jn=3;function nn(n,e){let s=Nn(e?.direction),i=Math.max(3,e?.maxLabelWidth??Bn),r=e?.asciiCharset??"unicode",t=Object.keys(n.nodes).sort(),o=new Set(t),a=n.edges.filter(x=>o.has(x.from)&&o.has(x.to)),l=new Map,f=new Map;for(let x of t){let h=K(x,i);l.set(x,h),f.set(x,S(h)+4)}let u=Q({nodes:t,edges:a,widthCells:x=>f.get(x)??3,heightCells:()=>jn,layerGap:Hn,nodeGap:$n,direction:s}),c=W(u,{charset:r,labelOf:x=>l.get(x)??x});return e?.logger?.(c),c}function Nn(n){if(n===void 0||n==="LR")return"LR";if(n==="TD")return"TD";throw new Error(`ascii describe supports direction "LR" or "TD" only; got ${String(n)}`)}function E(n){if(n===null||typeof n!="object")return n;if(Array.isArray(n))return n.map(E);let e=n,s=Object.keys(e).sort(),i={};for(let r of s)i[r]=E(e[r]);return i}function tn(n){return n.replaceAll("\\","\\\\").replaceAll('"','\\"')}function rn(n){return n.replaceAll("\\","\\\\").replaceAll('"','\\"')}function en(n){return n==="TD"?"down":n==="BT"?"up":n==="RL"?"left":"right"}function A(n){let e=new Set,s=[];function i(r,t){let o=`${r}\0${t}`;e.has(o)||(e.add(o),s.push([r,t]))}for(let[r,t]of Object.entries(n.nodes)){let o=t.deps;if(o)for(let a of o)i(a,r)}for(let r of n.edges)i(r.from,r.to);return s}function P(n){if(n===void 0)return"LR";if(n==="TD"||n==="LR"||n==="BT"||n==="RL")return n;throw new Error(`invalid diagram direction ${String(n)}; expected one of: TD, LR, BT, RL`)}function on(n){if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean"||n==null)return String(n);try{return JSON.stringify(n)}catch{return"[unserializable]"}}function sn(n,e){let s=P(e?.direction),i=Object.keys(n.nodes).sort(),r=new Map;for(let o=0;o<i.length;o+=1)r.set(i[o],`n${o}`);let t=[`direction: ${en(s)}`];for(let o of i){let a=r.get(o);t.push(`${a}: "${rn(o)}"`)}for(let[o,a]of A(n)){let l=r.get(o),f=r.get(a);!l||!f||t.push(`${l} -> ${f}`)}return t.join(`
3
+ `)}function an(n,e){let s=e?.includeEdges??!0,i=e?.includeSubgraphs??!0,{expand:r,...t}=n,o={...t,edges:s?n.edges:[],subgraphs:i?n.subgraphs:[]},a=JSON.stringify(E(o),null,e?.indent??2);return e?.logger?.(a),a}function B(n,e){let s=P(e?.direction),i=Object.keys(n.nodes).sort(),r=new Map;for(let o=0;o<i.length;o+=1)r.set(i[o],`n${o}`);let t=[`flowchart ${s}`];for(let o of i){let a=r.get(o);t.push(` ${a}["${tn(o)}"]`)}for(let[o,a]of A(n)){let l=r.get(o),f=r.get(a);!l||!f||t.push(` ${l} --> ${f}`)}return t.join(`
4
+ `)}function N(n,e){let s=e?.theme??"default",i=e?.autoSync??!0,t=JSON.stringify({code:n,mermaid:{theme:s},autoSync:i}),o=new TextEncoder().encode(t),a="";for(let f=0;f<o.length;f++)a+=String.fromCharCode(o[f]);return`https://mermaid.live/edit#base64:${globalThis.btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}function fn(n,e){let s=B(n,e);return N(s,e)}function ln(n,e){let s=e?.includeEdges??!0,i=e?.includeSubgraphs??!0,r=[];r.push(`Graph ${n.name}`),r.push("Nodes:");for(let o of Object.keys(n.nodes).sort()){let a=n.nodes[o];r.push(`- ${o} (${a.type}/${a.status}): ${on(a.value)}`)}if(s){r.push("Edges:");for(let o of n.edges)r.push(`- ${o.from} -> ${o.to}`)}if(i){r.push("Subgraphs:");for(let o of n.subgraphs)r.push(`- ${o}`)}let t=r.join(`
5
+ `);return e?.logger?.(t),t}0&&(module.exports={mermaidLiveUrl,toAscii,toD2,toJson,toMermaid,toMermaidUrl,toPretty});