@graphrefly/graphrefly 0.44.0 → 0.46.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 (720) hide show
  1. package/README.md +22 -19
  2. package/dist/_internal-B23BagFd.d.cts +33 -0
  3. package/dist/_internal-B23BagFd.d.ts +33 -0
  4. package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
  5. package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
  6. package/dist/agents-C0Ji9ldU.d.cts +629 -0
  7. package/dist/agents-C9zexT7I.d.ts +629 -0
  8. package/dist/audit-BAXb3VOg.d.ts +246 -0
  9. package/dist/audit-C_bPfkqS.d.cts +246 -0
  10. package/dist/backoff-7KIK3WQW.js +24 -0
  11. package/dist/backoff-7KIK3WQW.js.map +1 -0
  12. package/dist/backoff-Bnb9OoPh.d.cts +6 -0
  13. package/dist/backoff-Bnb9OoPh.d.ts +6 -0
  14. package/dist/base/composition/index.cjs +811 -0
  15. package/dist/base/composition/index.cjs.map +1 -0
  16. package/dist/base/composition/index.d.cts +469 -0
  17. package/dist/base/composition/index.d.ts +469 -0
  18. package/dist/base/composition/index.js +40 -0
  19. package/dist/base/composition/index.js.map +1 -0
  20. package/dist/base/index.cjs +6336 -0
  21. package/dist/base/index.cjs.map +1 -0
  22. package/dist/base/index.d.cts +22 -0
  23. package/dist/base/index.d.ts +22 -0
  24. package/dist/base/index.js +259 -0
  25. package/dist/base/index.js.map +1 -0
  26. package/dist/base/io/index.cjs +3270 -0
  27. package/dist/base/io/index.cjs.map +1 -0
  28. package/dist/base/io/index.d.cts +2245 -0
  29. package/dist/base/io/index.d.ts +2245 -0
  30. package/dist/base/io/index.js +117 -0
  31. package/dist/base/io/index.js.map +1 -0
  32. package/dist/base/meta/index.cjs +43 -0
  33. package/dist/base/meta/index.cjs.map +1 -0
  34. package/dist/base/meta/index.d.cts +45 -0
  35. package/dist/base/meta/index.d.ts +45 -0
  36. package/dist/base/meta/index.js +13 -0
  37. package/dist/base/meta/index.js.map +1 -0
  38. package/dist/base/mutation/index.cjs +200 -0
  39. package/dist/base/mutation/index.cjs.map +1 -0
  40. package/dist/base/mutation/index.d.cts +177 -0
  41. package/dist/base/mutation/index.d.ts +177 -0
  42. package/dist/base/mutation/index.js +22 -0
  43. package/dist/base/mutation/index.js.map +1 -0
  44. package/dist/base/render/index.cjs +1120 -0
  45. package/dist/base/render/index.cjs.map +1 -0
  46. package/dist/{extra/render/index.d.ts → base/render/index.d.cts} +75 -31
  47. package/dist/{extra/render/index.d.cts → base/render/index.d.ts} +75 -31
  48. package/dist/base/render/index.js +24 -0
  49. package/dist/base/render/index.js.map +1 -0
  50. package/dist/base/sources/browser/index.cjs +172 -0
  51. package/dist/base/sources/browser/index.cjs.map +1 -0
  52. package/dist/base/sources/browser/index.d.cts +84 -0
  53. package/dist/base/sources/browser/index.d.ts +84 -0
  54. package/dist/base/sources/browser/index.js +151 -0
  55. package/dist/base/sources/browser/index.js.map +1 -0
  56. package/dist/base/sources/event/index.cjs +98 -0
  57. package/dist/base/sources/event/index.cjs.map +1 -0
  58. package/dist/base/sources/event/index.d.cts +91 -0
  59. package/dist/base/sources/event/index.d.ts +91 -0
  60. package/dist/base/sources/event/index.js +13 -0
  61. package/dist/base/sources/event/index.js.map +1 -0
  62. package/dist/base/sources/index.cjs +755 -0
  63. package/dist/base/sources/index.cjs.map +1 -0
  64. package/dist/{extra/sources.d.ts → base/sources/index.d.cts} +74 -301
  65. package/dist/{extra/sources.d.cts → base/sources/index.d.ts} +74 -301
  66. package/dist/base/sources/index.js +42 -0
  67. package/dist/base/sources/index.js.map +1 -0
  68. package/dist/base/sources/node/index.cjs +320 -0
  69. package/dist/base/sources/node/index.cjs.map +1 -0
  70. package/dist/{extra/node.d.ts → base/sources/node/index.d.cts} +35 -37
  71. package/dist/{extra/node.d.cts → base/sources/node/index.d.ts} +35 -37
  72. package/dist/base/sources/node/index.js +306 -0
  73. package/dist/base/sources/node/index.js.map +1 -0
  74. package/dist/base/utils/index.cjs +37 -0
  75. package/dist/base/utils/index.cjs.map +1 -0
  76. package/dist/base/utils/index.d.cts +37 -0
  77. package/dist/base/utils/index.d.ts +37 -0
  78. package/dist/base/utils/index.js +11 -0
  79. package/dist/base/utils/index.js.map +1 -0
  80. package/dist/base/worker/index.cjs +548 -0
  81. package/dist/base/worker/index.cjs.map +1 -0
  82. package/dist/base/worker/index.d.cts +207 -0
  83. package/dist/base/worker/index.d.ts +207 -0
  84. package/dist/base/worker/index.js +20 -0
  85. package/dist/base/worker/index.js.map +1 -0
  86. package/dist/breaker-C9skL3d8.d.ts +175 -0
  87. package/dist/breaker-ugSdq54q.d.cts +175 -0
  88. package/dist/{cascading-BglDkMdX.d.cts → cascading-CSSbKGrJ.d.ts} +3 -3
  89. package/dist/{cascading-MFgxu7Yo.d.ts → cascading-baGkiihI.d.cts} +3 -3
  90. package/dist/chunk-255UCBG4.js +58 -0
  91. package/dist/chunk-255UCBG4.js.map +1 -0
  92. package/dist/chunk-2LO3EL4W.js +1 -0
  93. package/dist/chunk-2LO3EL4W.js.map +1 -0
  94. package/dist/chunk-2OB3CEJS.js +1065 -0
  95. package/dist/chunk-2OB3CEJS.js.map +1 -0
  96. package/dist/chunk-36NMM65U.js +144 -0
  97. package/dist/chunk-36NMM65U.js.map +1 -0
  98. package/dist/chunk-3CEXCBN6.js +1 -0
  99. package/dist/chunk-3CEXCBN6.js.map +1 -0
  100. package/dist/chunk-3MUSLI6E.js +105 -0
  101. package/dist/chunk-3MUSLI6E.js.map +1 -0
  102. package/dist/chunk-3PSLNJDU.js +884 -0
  103. package/dist/chunk-3PSLNJDU.js.map +1 -0
  104. package/dist/chunk-3QZY5BI7.js +92 -0
  105. package/dist/chunk-3QZY5BI7.js.map +1 -0
  106. package/dist/chunk-42FQ27MQ.js +594 -0
  107. package/dist/chunk-42FQ27MQ.js.map +1 -0
  108. package/dist/chunk-4GYMCUDZ.js +1085 -0
  109. package/dist/chunk-4GYMCUDZ.js.map +1 -0
  110. package/dist/chunk-4S53H2KR.js +382 -0
  111. package/dist/chunk-4S53H2KR.js.map +1 -0
  112. package/dist/chunk-4XCHZRUJ.js +128 -0
  113. package/dist/chunk-4XCHZRUJ.js.map +1 -0
  114. package/dist/chunk-5THCXDWY.js +725 -0
  115. package/dist/chunk-5THCXDWY.js.map +1 -0
  116. package/dist/chunk-6XZYT4SW.js +256 -0
  117. package/dist/chunk-6XZYT4SW.js.map +1 -0
  118. package/dist/chunk-7EGRP2VX.js +76 -0
  119. package/dist/chunk-7EGRP2VX.js.map +1 -0
  120. package/dist/chunk-A7KV5UK4.js +150 -0
  121. package/dist/chunk-A7KV5UK4.js.map +1 -0
  122. package/dist/chunk-APY2SS5X.js +156 -0
  123. package/dist/chunk-APY2SS5X.js.map +1 -0
  124. package/dist/chunk-AZDQPQ3V.js +66 -0
  125. package/dist/chunk-AZDQPQ3V.js.map +1 -0
  126. package/dist/chunk-BU3SEFA5.js +90 -0
  127. package/dist/chunk-BU3SEFA5.js.map +1 -0
  128. package/dist/chunk-BXGZFGZ4.js +189 -0
  129. package/dist/chunk-BXGZFGZ4.js.map +1 -0
  130. package/dist/chunk-CGHORL6G.js +579 -0
  131. package/dist/chunk-CGHORL6G.js.map +1 -0
  132. package/dist/chunk-CXANAIZU.js +530 -0
  133. package/dist/chunk-CXANAIZU.js.map +1 -0
  134. package/dist/chunk-CZQHCKKG.js +1 -0
  135. package/dist/chunk-CZQHCKKG.js.map +1 -0
  136. package/dist/chunk-DKNHAICT.js +133 -0
  137. package/dist/chunk-DKNHAICT.js.map +1 -0
  138. package/dist/chunk-DM4OMPWK.js +584 -0
  139. package/dist/chunk-DM4OMPWK.js.map +1 -0
  140. package/dist/chunk-DMSNO6ZB.js +452 -0
  141. package/dist/chunk-DMSNO6ZB.js.map +1 -0
  142. package/dist/chunk-E5OZPDIW.js +229 -0
  143. package/dist/chunk-E5OZPDIW.js.map +1 -0
  144. package/dist/chunk-EVYY4X5A.js +509 -0
  145. package/dist/chunk-EVYY4X5A.js.map +1 -0
  146. package/dist/chunk-FDFD67UO.js +1 -0
  147. package/dist/chunk-FDFD67UO.js.map +1 -0
  148. package/dist/chunk-FMPF42Q4.js +13 -0
  149. package/dist/chunk-FMPF42Q4.js.map +1 -0
  150. package/dist/chunk-FR6RGA3B.js +1277 -0
  151. package/dist/chunk-FR6RGA3B.js.map +1 -0
  152. package/dist/chunk-FW23JYNQ.js +454 -0
  153. package/dist/chunk-FW23JYNQ.js.map +1 -0
  154. package/dist/chunk-GBCENOLN.js +1575 -0
  155. package/dist/chunk-GBCENOLN.js.map +1 -0
  156. package/dist/chunk-HL7HUJIX.js +1 -0
  157. package/dist/chunk-HL7HUJIX.js.map +1 -0
  158. package/dist/chunk-HULCUY35.js +2508 -0
  159. package/dist/chunk-HULCUY35.js.map +1 -0
  160. package/dist/chunk-IHTWQEDR.js +169 -0
  161. package/dist/chunk-IHTWQEDR.js.map +1 -0
  162. package/dist/chunk-IJRR6YAI.js +128 -0
  163. package/dist/chunk-IJRR6YAI.js.map +1 -0
  164. package/dist/chunk-JGFRAFDL.js +221 -0
  165. package/dist/chunk-JGFRAFDL.js.map +1 -0
  166. package/dist/chunk-KIIXR252.js +211 -0
  167. package/dist/chunk-KIIXR252.js.map +1 -0
  168. package/dist/chunk-KN3H5CNT.js +11 -0
  169. package/dist/chunk-KN3H5CNT.js.map +1 -0
  170. package/dist/chunk-KPG3DGLA.js +1 -0
  171. package/dist/chunk-KPG3DGLA.js.map +1 -0
  172. package/dist/chunk-KRNQ6RGQ.js +1 -0
  173. package/dist/chunk-KRNQ6RGQ.js.map +1 -0
  174. package/dist/chunk-LBAJK24K.js +1071 -0
  175. package/dist/chunk-LBAJK24K.js.map +1 -0
  176. package/dist/chunk-MLTPJMH6.js +417 -0
  177. package/dist/chunk-MLTPJMH6.js.map +1 -0
  178. package/dist/chunk-N3SZ7BMH.js +95 -0
  179. package/dist/chunk-N3SZ7BMH.js.map +1 -0
  180. package/dist/chunk-NDUD3IMO.js +540 -0
  181. package/dist/chunk-NDUD3IMO.js.map +1 -0
  182. package/dist/chunk-NY2PYHNC.js +873 -0
  183. package/dist/chunk-NY2PYHNC.js.map +1 -0
  184. package/dist/chunk-O3MT7DYI.js +225 -0
  185. package/dist/chunk-O3MT7DYI.js.map +1 -0
  186. package/dist/chunk-OCUDSN63.js +2386 -0
  187. package/dist/chunk-OCUDSN63.js.map +1 -0
  188. package/dist/chunk-OIWU3NYV.js +199 -0
  189. package/dist/chunk-OIWU3NYV.js.map +1 -0
  190. package/dist/chunk-OO5BM6CJ.js +1153 -0
  191. package/dist/chunk-OO5BM6CJ.js.map +1 -0
  192. package/dist/chunk-OQUIJT7A.js +1 -0
  193. package/dist/chunk-OQUIJT7A.js.map +1 -0
  194. package/dist/chunk-P5LBT622.js +105 -0
  195. package/dist/chunk-P5LBT622.js.map +1 -0
  196. package/dist/chunk-PKGQG5QQ.js +519 -0
  197. package/dist/chunk-PKGQG5QQ.js.map +1 -0
  198. package/dist/chunk-PKPO3JTZ.js +561 -0
  199. package/dist/chunk-PKPO3JTZ.js.map +1 -0
  200. package/dist/chunk-PL5UDIQ5.js +118 -0
  201. package/dist/chunk-PL5UDIQ5.js.map +1 -0
  202. package/dist/chunk-PZWISPIQ.js +432 -0
  203. package/dist/chunk-PZWISPIQ.js.map +1 -0
  204. package/dist/chunk-Q3EYOCZB.js +510 -0
  205. package/dist/chunk-Q3EYOCZB.js.map +1 -0
  206. package/dist/chunk-QMBYUVRL.js +15 -0
  207. package/dist/chunk-QMBYUVRL.js.map +1 -0
  208. package/dist/chunk-RAGGHLCV.js +200 -0
  209. package/dist/chunk-RAGGHLCV.js.map +1 -0
  210. package/dist/chunk-RGL53X5G.js +574 -0
  211. package/dist/chunk-RGL53X5G.js.map +1 -0
  212. package/dist/chunk-RJOG4IJU.js +1039 -0
  213. package/dist/chunk-RJOG4IJU.js.map +1 -0
  214. package/dist/chunk-SOOKUYVM.js +403 -0
  215. package/dist/chunk-SOOKUYVM.js.map +1 -0
  216. package/dist/chunk-T5BN5KG7.js +1 -0
  217. package/dist/chunk-T5BN5KG7.js.map +1 -0
  218. package/dist/chunk-TP7244Y6.js +207 -0
  219. package/dist/chunk-TP7244Y6.js.map +1 -0
  220. package/dist/chunk-TSBFTJKM.js +57 -0
  221. package/dist/chunk-TSBFTJKM.js.map +1 -0
  222. package/dist/chunk-URQ2CBBF.js +143 -0
  223. package/dist/chunk-URQ2CBBF.js.map +1 -0
  224. package/dist/chunk-W2BOPXTI.js +1 -0
  225. package/dist/chunk-W2BOPXTI.js.map +1 -0
  226. package/dist/chunk-WKSWLSCX.js +207 -0
  227. package/dist/chunk-WKSWLSCX.js.map +1 -0
  228. package/dist/chunk-Y52CS6YA.js +88 -0
  229. package/dist/chunk-Y52CS6YA.js.map +1 -0
  230. package/dist/chunk-YCBUWK77.js +92 -0
  231. package/dist/chunk-YCBUWK77.js.map +1 -0
  232. package/dist/chunk-YJ4U2D2C.js +314 -0
  233. package/dist/chunk-YJ4U2D2C.js.map +1 -0
  234. package/dist/chunk-Z4YXAUDN.js +239 -0
  235. package/dist/chunk-Z4YXAUDN.js.map +1 -0
  236. package/dist/chunk-Z6EGP5D7.js +92 -0
  237. package/dist/chunk-Z6EGP5D7.js.map +1 -0
  238. package/dist/compat/index.cjs +3100 -9
  239. package/dist/compat/index.cjs.map +1 -0
  240. package/dist/compat/index.d.cts +112 -18
  241. package/dist/compat/index.d.ts +112 -18
  242. package/dist/compat/index.js +176 -1
  243. package/dist/compat/index.js.map +1 -0
  244. package/dist/compat/jotai/index.cjs +149 -1
  245. package/dist/compat/jotai/index.cjs.map +1 -0
  246. package/dist/compat/jotai/index.d.cts +2 -2
  247. package/dist/compat/jotai/index.d.ts +2 -2
  248. package/dist/compat/jotai/index.js +8 -1
  249. package/dist/compat/jotai/index.js.map +1 -0
  250. package/dist/compat/nanostores/index.cjs +205 -1
  251. package/dist/compat/nanostores/index.cjs.map +1 -0
  252. package/dist/compat/nanostores/index.d.cts +2 -2
  253. package/dist/compat/nanostores/index.d.ts +2 -2
  254. package/dist/compat/nanostores/index.js +22 -1
  255. package/dist/compat/nanostores/index.js.map +1 -0
  256. package/dist/compat/nestjs/index.cjs +2241 -9
  257. package/dist/compat/nestjs/index.cjs.map +1 -0
  258. package/dist/compat/nestjs/index.d.cts +7 -10
  259. package/dist/compat/nestjs/index.d.ts +7 -10
  260. package/dist/compat/nestjs/index.js +78 -1
  261. package/dist/compat/nestjs/index.js.map +1 -0
  262. package/dist/compat/react/index.cjs +114 -1
  263. package/dist/compat/react/index.cjs.map +1 -0
  264. package/dist/compat/react/index.d.cts +2 -2
  265. package/dist/compat/react/index.d.ts +2 -2
  266. package/dist/compat/react/index.js +12 -1
  267. package/dist/compat/react/index.js.map +1 -0
  268. package/dist/compat/solid/index.cjs +101 -1
  269. package/dist/compat/solid/index.cjs.map +1 -0
  270. package/dist/compat/solid/index.d.cts +2 -2
  271. package/dist/compat/solid/index.d.ts +2 -2
  272. package/dist/compat/solid/index.js +12 -1
  273. package/dist/compat/solid/index.js.map +1 -0
  274. package/dist/compat/svelte/index.cjs +104 -1
  275. package/dist/compat/svelte/index.cjs.map +1 -0
  276. package/dist/compat/svelte/index.d.cts +2 -2
  277. package/dist/compat/svelte/index.d.ts +2 -2
  278. package/dist/compat/svelte/index.js +12 -1
  279. package/dist/compat/svelte/index.js.map +1 -0
  280. package/dist/compat/vue/index.cjs +119 -1
  281. package/dist/compat/vue/index.cjs.map +1 -0
  282. package/dist/compat/vue/index.d.cts +2 -2
  283. package/dist/compat/vue/index.d.ts +2 -2
  284. package/dist/compat/vue/index.js +12 -1
  285. package/dist/compat/vue/index.js.map +1 -0
  286. package/dist/compat/zustand/index.cjs +69 -3
  287. package/dist/compat/zustand/index.cjs.map +1 -0
  288. package/dist/compat/zustand/index.d.cts +2 -6
  289. package/dist/compat/zustand/index.d.ts +2 -6
  290. package/dist/compat/zustand/index.js +8 -1
  291. package/dist/compat/zustand/index.js.map +1 -0
  292. package/dist/distill-De6Rnn15.d.cts +48 -0
  293. package/dist/distill-De6Rnn15.d.ts +48 -0
  294. package/dist/external-register-CWyroXb_.d.cts +138 -0
  295. package/dist/external-register-CWyroXb_.d.ts +138 -0
  296. package/dist/{fallback-74oxi34l.d.cts → fallback-Bx46zqky.d.cts} +3 -10
  297. package/dist/{fallback-DUyyBTBK.d.ts → fallback-pIWW8A2d.d.ts} +3 -10
  298. package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
  299. package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
  300. package/dist/{index-CBGUK09R.d.ts → index-5SU_O78r.d.cts} +5 -5
  301. package/dist/{index-BmZXHqkE.d.ts → index-B6pxYJzO.d.cts} +1 -1
  302. package/dist/{index-hcDJ8PSI.d.cts → index-B6pxYJzO.d.ts} +1 -1
  303. package/dist/{index-C5stwKcw.d.cts → index-BFsng6v1.d.cts} +1 -1
  304. package/dist/{index-CdAlHFEt.d.ts → index-BFsng6v1.d.ts} +1 -1
  305. package/dist/{index-_6ODbuOu.d.cts → index-Bg-LwEt-.d.cts} +1 -1
  306. package/dist/{index-CviRnE4K.d.ts → index-Bg-LwEt-.d.ts} +1 -1
  307. package/dist/{index-CBBLl_rc.d.ts → index-Brp888t0.d.cts} +1 -1
  308. package/dist/{index-BQSKmbuG.d.cts → index-Brp888t0.d.ts} +1 -1
  309. package/dist/{index-sqkqlb1p.d.ts → index-CDfk6jHN.d.cts} +1 -1
  310. package/dist/{index-ZVQhLa2i.d.cts → index-CDfk6jHN.d.ts} +1 -1
  311. package/dist/{index-Climxqsu.d.cts → index-CEXCtYYJ.d.ts} +5 -5
  312. package/dist/index-DLAxYaN5.d.cts +169 -0
  313. package/dist/index-DLAxYaN5.d.ts +169 -0
  314. package/dist/{index-CK29LV56.d.cts → index-DeWbQzMe.d.cts} +1 -1
  315. package/dist/{index-CPQlGA29.d.ts → index-DeWbQzMe.d.ts} +1 -1
  316. package/dist/{index-BrPrLl4e.d.cts → index-dX9IzPqj.d.cts} +1 -1
  317. package/dist/{index-Dgl1HpPn.d.ts → index-dX9IzPqj.d.ts} +1 -1
  318. package/dist/index.cjs +25934 -191
  319. package/dist/index.cjs.map +1 -0
  320. package/dist/index.d.cts +58 -94
  321. package/dist/index.d.ts +58 -94
  322. package/dist/index.js +852 -1
  323. package/dist/index.js.map +1 -0
  324. package/dist/layout-types-B5aiHYgk.d.cts +72 -0
  325. package/dist/layout-types-B5aiHYgk.d.ts +72 -0
  326. package/dist/memory-composers-BryDrRBX.d.cts +529 -0
  327. package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
  328. package/dist/{observable-DWjNfLvC.d.ts → observable-BXQoW1P-.d.cts} +1 -1
  329. package/dist/{observable-e3eiPPFy.d.cts → observable-BXQoW1P-.d.ts} +1 -1
  330. package/dist/{pipeline-graph-Sgj0gCwn.d.ts → pipeline-graph-Ce47CB6Y.d.cts} +13 -10
  331. package/dist/{pipeline-graph-CIKhynsF.d.cts → pipeline-graph-DXCwY9vG.d.ts} +13 -10
  332. package/dist/presets/ai/index.cjs +4377 -0
  333. package/dist/presets/ai/index.cjs.map +1 -0
  334. package/dist/presets/ai/index.d.cts +98 -0
  335. package/dist/presets/ai/index.d.ts +98 -0
  336. package/dist/presets/ai/index.js +54 -0
  337. package/dist/presets/ai/index.js.map +1 -0
  338. package/dist/presets/harness/index.cjs +5929 -0
  339. package/dist/presets/harness/index.cjs.map +1 -0
  340. package/dist/presets/harness/index.d.cts +566 -0
  341. package/dist/presets/harness/index.d.ts +566 -0
  342. package/dist/presets/harness/index.js +71 -0
  343. package/dist/presets/harness/index.js.map +1 -0
  344. package/dist/presets/index.cjs +9782 -0
  345. package/dist/presets/index.cjs.map +1 -0
  346. package/dist/presets/index.d.cts +28 -0
  347. package/dist/presets/index.d.ts +28 -0
  348. package/dist/presets/index.js +129 -0
  349. package/dist/presets/index.js.map +1 -0
  350. package/dist/presets/inspect/index.cjs +1087 -0
  351. package/dist/presets/inspect/index.cjs.map +1 -0
  352. package/dist/presets/inspect/index.d.cts +172 -0
  353. package/dist/presets/inspect/index.d.ts +172 -0
  354. package/dist/presets/inspect/index.js +21 -0
  355. package/dist/presets/inspect/index.js.map +1 -0
  356. package/dist/presets/resilience/index.cjs +1593 -0
  357. package/dist/presets/resilience/index.cjs.map +1 -0
  358. package/dist/presets/resilience/index.d.cts +205 -0
  359. package/dist/presets/resilience/index.d.ts +205 -0
  360. package/dist/presets/resilience/index.js +18 -0
  361. package/dist/presets/resilience/index.js.map +1 -0
  362. package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
  363. package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
  364. package/dist/{reactive-layout-DOTs9P3X.d.ts → reactive-layout-fswlBUvX.d.cts} +19 -7
  365. package/dist/{reactive-layout-DgctbqZo.d.cts → reactive-layout-fswlBUvX.d.ts} +19 -7
  366. package/dist/retry-BDbRZ_gx.d.ts +125 -0
  367. package/dist/retry-DWuhjvsA.d.cts +125 -0
  368. package/dist/solutions/index.cjs +8200 -0
  369. package/dist/solutions/index.cjs.map +1 -0
  370. package/dist/solutions/index.d.cts +23 -0
  371. package/dist/solutions/index.d.ts +23 -0
  372. package/dist/solutions/index.js +55 -0
  373. package/dist/solutions/index.js.map +1 -0
  374. package/dist/spawnable-5mDY501F.d.cts +746 -0
  375. package/dist/spawnable-D3lR0oQu.d.ts +746 -0
  376. package/dist/status-U-rUI79b.d.cts +84 -0
  377. package/dist/status-U-rUI79b.d.ts +84 -0
  378. package/dist/timeout-U5O4ESK3.js +12 -0
  379. package/dist/timeout-U5O4ESK3.js.map +1 -0
  380. package/dist/{types-CWFysE9E.d.ts → types-BB5Lw-pB.d.cts} +3 -3
  381. package/dist/{types-C0_yquda.d.cts → types-BB5Lw-pB.d.ts} +3 -3
  382. package/dist/types-CJWIMJiZ.d.ts +548 -0
  383. package/dist/types-vCq7ShIm.d.cts +548 -0
  384. package/dist/utils/ai/browser.cjs +2169 -0
  385. package/dist/utils/ai/browser.cjs.map +1 -0
  386. package/dist/{patterns → utils}/ai/browser.d.cts +7 -5
  387. package/dist/{patterns → utils}/ai/browser.d.ts +7 -5
  388. package/dist/utils/ai/browser.js +255 -0
  389. package/dist/utils/ai/browser.js.map +1 -0
  390. package/dist/utils/ai/index.cjs +8468 -0
  391. package/dist/utils/ai/index.cjs.map +1 -0
  392. package/dist/{index-CR8QpwX8.d.ts → utils/ai/index.d.cts} +73 -976
  393. package/dist/{index-UPSiS-X7.d.cts → utils/ai/index.d.ts} +73 -976
  394. package/dist/utils/ai/index.js +173 -0
  395. package/dist/utils/ai/index.js.map +1 -0
  396. package/dist/utils/ai/node.cjs +648 -0
  397. package/dist/utils/ai/node.cjs.map +1 -0
  398. package/dist/{patterns → utils}/ai/node.d.cts +5 -7
  399. package/dist/{patterns → utils}/ai/node.d.ts +5 -7
  400. package/dist/utils/ai/node.js +84 -0
  401. package/dist/utils/ai/node.js.map +1 -0
  402. package/dist/utils/cqrs/index.cjs +1036 -0
  403. package/dist/utils/cqrs/index.cjs.map +1 -0
  404. package/dist/{index-CeFiHtAg.d.ts → utils/cqrs/index.d.cts} +7 -37
  405. package/dist/{index-B-_tFaqV.d.cts → utils/cqrs/index.d.ts} +7 -37
  406. package/dist/utils/cqrs/index.js +18 -0
  407. package/dist/utils/cqrs/index.js.map +1 -0
  408. package/dist/utils/demo-shell/index.cjs +865 -0
  409. package/dist/utils/demo-shell/index.cjs.map +1 -0
  410. package/dist/{index-B8YnZpIR.d.ts → utils/demo-shell/index.d.cts} +4 -16
  411. package/dist/{index-Cwv0KWcU.d.cts → utils/demo-shell/index.d.ts} +4 -16
  412. package/dist/utils/demo-shell/index.js +13 -0
  413. package/dist/utils/demo-shell/index.js.map +1 -0
  414. package/dist/utils/domain-templates/index.cjs +732 -0
  415. package/dist/utils/domain-templates/index.cjs.map +1 -0
  416. package/dist/{index-CzLVrjxn.d.ts → utils/domain-templates/index.d.cts} +3 -20
  417. package/dist/{index-BaQaY_IQ.d.cts → utils/domain-templates/index.d.ts} +3 -20
  418. package/dist/utils/domain-templates/index.js +17 -0
  419. package/dist/utils/domain-templates/index.js.map +1 -0
  420. package/dist/utils/graphspec/index.cjs +1174 -0
  421. package/dist/utils/graphspec/index.cjs.map +1 -0
  422. package/dist/{index-CMh5Rz1y.d.ts → utils/graphspec/index.d.cts} +106 -42
  423. package/dist/{index-CS0LTlB8.d.cts → utils/graphspec/index.d.ts} +106 -42
  424. package/dist/utils/graphspec/index.js +35 -0
  425. package/dist/utils/graphspec/index.js.map +1 -0
  426. package/dist/utils/harness/index.cjs +656 -0
  427. package/dist/utils/harness/index.cjs.map +1 -0
  428. package/dist/utils/harness/index.d.cts +542 -0
  429. package/dist/utils/harness/index.d.ts +542 -0
  430. package/dist/utils/harness/index.js +56 -0
  431. package/dist/utils/harness/index.js.map +1 -0
  432. package/dist/utils/index.cjs +17609 -0
  433. package/dist/utils/index.cjs.map +1 -0
  434. package/dist/utils/index.d.cts +96 -0
  435. package/dist/utils/index.d.ts +96 -0
  436. package/dist/utils/index.js +514 -0
  437. package/dist/utils/index.js.map +1 -0
  438. package/dist/utils/inspect/index.cjs +807 -0
  439. package/dist/utils/inspect/index.cjs.map +1 -0
  440. package/dist/utils/inspect/index.d.cts +123 -0
  441. package/dist/utils/inspect/index.d.ts +123 -0
  442. package/dist/utils/inspect/index.js +30 -0
  443. package/dist/utils/inspect/index.js.map +1 -0
  444. package/dist/utils/job-queue/index.cjs +717 -0
  445. package/dist/utils/job-queue/index.cjs.map +1 -0
  446. package/dist/{index-DisjX8a-.d.ts → utils/job-queue/index.d.cts} +5 -26
  447. package/dist/{index-DV_1YuVk.d.cts → utils/job-queue/index.d.ts} +5 -26
  448. package/dist/utils/job-queue/index.js +18 -0
  449. package/dist/utils/job-queue/index.js.map +1 -0
  450. package/dist/utils/memory/index.cjs +1451 -0
  451. package/dist/utils/memory/index.cjs.map +1 -0
  452. package/dist/{index-CZ3r5Rxp.d.ts → utils/memory/index.d.cts} +242 -34
  453. package/dist/{index-B17QddL1.d.cts → utils/memory/index.d.ts} +242 -34
  454. package/dist/utils/memory/index.js +19 -0
  455. package/dist/utils/memory/index.js.map +1 -0
  456. package/dist/utils/messaging/index.cjs +666 -0
  457. package/dist/utils/messaging/index.cjs.map +1 -0
  458. package/dist/utils/messaging/index.d.cts +562 -0
  459. package/dist/utils/messaging/index.d.ts +562 -0
  460. package/dist/utils/messaging/index.js +50 -0
  461. package/dist/utils/messaging/index.js.map +1 -0
  462. package/dist/utils/orchestration/index.cjs +876 -0
  463. package/dist/utils/orchestration/index.cjs.map +1 -0
  464. package/dist/utils/orchestration/index.d.cts +233 -0
  465. package/dist/utils/orchestration/index.d.ts +233 -0
  466. package/dist/utils/orchestration/index.js +19 -0
  467. package/dist/utils/orchestration/index.js.map +1 -0
  468. package/dist/utils/process/index.cjs +743 -0
  469. package/dist/utils/process/index.cjs.map +1 -0
  470. package/dist/{index-p09KSrTN.d.ts → utils/process/index.d.cts} +97 -44
  471. package/dist/{index-CasX6Pfq.d.cts → utils/process/index.d.ts} +97 -44
  472. package/dist/utils/process/index.js +14 -0
  473. package/dist/utils/process/index.js.map +1 -0
  474. package/dist/utils/reactive-layout/index.cjs +1607 -0
  475. package/dist/utils/reactive-layout/index.cjs.map +1 -0
  476. package/dist/{index-B5S8ULbU.d.ts → utils/reactive-layout/index.d.cts} +58 -81
  477. package/dist/{index-Dc4AYqrJ.d.cts → utils/reactive-layout/index.d.ts} +58 -81
  478. package/dist/utils/reactive-layout/index.js +52 -0
  479. package/dist/utils/reactive-layout/index.js.map +1 -0
  480. package/dist/utils/reduction/index.cjs +203 -0
  481. package/dist/utils/reduction/index.cjs.map +1 -0
  482. package/dist/{index-Byu-OpX_.d.ts → utils/reduction/index.d.cts} +6 -17
  483. package/dist/{index-tRCxuAXF.d.cts → utils/reduction/index.d.ts} +6 -17
  484. package/dist/utils/reduction/index.js +14 -0
  485. package/dist/utils/reduction/index.js.map +1 -0
  486. package/dist/utils/resilience/index.cjs +1617 -0
  487. package/dist/utils/resilience/index.cjs.map +1 -0
  488. package/dist/utils/resilience/index.d.cts +9 -0
  489. package/dist/utils/resilience/index.d.ts +9 -0
  490. package/dist/utils/resilience/index.js +44 -0
  491. package/dist/utils/resilience/index.js.map +1 -0
  492. package/dist/utils/surface/index.cjs +1070 -0
  493. package/dist/utils/surface/index.cjs.map +1 -0
  494. package/dist/{index-CYq8vAyV.d.ts → utils/surface/index.d.cts} +7 -58
  495. package/dist/{index-CSOmP7xT.d.cts → utils/surface/index.d.ts} +7 -58
  496. package/dist/utils/surface/index.js +30 -0
  497. package/dist/utils/surface/index.js.map +1 -0
  498. package/dist/utils/topology-view/index.cjs +620 -0
  499. package/dist/utils/topology-view/index.cjs.map +1 -0
  500. package/dist/utils/topology-view/index.d.cts +68 -0
  501. package/dist/utils/topology-view/index.d.ts +68 -0
  502. package/dist/utils/topology-view/index.js +11 -0
  503. package/dist/utils/topology-view/index.js.map +1 -0
  504. package/package.json +664 -584
  505. package/dist/backoff-HPZMEZNF.js +0 -1
  506. package/dist/chunk-2T7U5EU6.js +0 -1
  507. package/dist/chunk-3G5U5QNE.js +0 -5
  508. package/dist/chunk-4VVTGLXJ.js +0 -1
  509. package/dist/chunk-5M4CCMMD.js +0 -45
  510. package/dist/chunk-5QDBSZBV.js +0 -1
  511. package/dist/chunk-5XJ6B66J.js +0 -1
  512. package/dist/chunk-6QZNQS5B.js +0 -1
  513. package/dist/chunk-6X7AFUJV.js +0 -9
  514. package/dist/chunk-7K6PWTDQ.js +0 -1
  515. package/dist/chunk-7LIAPXJB.js +0 -1
  516. package/dist/chunk-7WPU3UHQ.js +0 -1
  517. package/dist/chunk-A5WCQ5NO.js +0 -1
  518. package/dist/chunk-APPIWSGD.js +0 -84
  519. package/dist/chunk-BEZWM2SY.js +0 -1
  520. package/dist/chunk-C72GO4IZ.js +0 -1
  521. package/dist/chunk-CB676TKJ.js +0 -1
  522. package/dist/chunk-CE6TI2TL.js +0 -1
  523. package/dist/chunk-CE72X3WO.js +0 -1
  524. package/dist/chunk-CK2E7BTU.js +0 -1
  525. package/dist/chunk-CLVB32RD.js +0 -1
  526. package/dist/chunk-CRVT7D2P.js +0 -1
  527. package/dist/chunk-D5RFJOZ2.js +0 -1
  528. package/dist/chunk-D7GPHKFH.js +0 -1
  529. package/dist/chunk-DHRX7JX4.js +0 -2
  530. package/dist/chunk-ESMPEKEV.js +0 -1
  531. package/dist/chunk-F672GV32.js +0 -1
  532. package/dist/chunk-FZMYDOWV.js +0 -1
  533. package/dist/chunk-GHBWHMRZ.js +0 -1
  534. package/dist/chunk-GLERH466.js +0 -1
  535. package/dist/chunk-GPW2V3RE.js +0 -1
  536. package/dist/chunk-HIDYF36O.js +0 -1
  537. package/dist/chunk-HITNVN6B.js +0 -3
  538. package/dist/chunk-HY4DJBA7.js +0 -5
  539. package/dist/chunk-KZIEYVXN.js +0 -1
  540. package/dist/chunk-L6NSJVJZ.js +0 -1
  541. package/dist/chunk-N4MQX6JU.js +0 -18
  542. package/dist/chunk-N7FHEL4D.js +0 -1
  543. package/dist/chunk-NTEURFZH.js +0 -1
  544. package/dist/chunk-OIVP6KFV.js +0 -1
  545. package/dist/chunk-OPHBU3LG.js +0 -1
  546. package/dist/chunk-OYQOZP2F.js +0 -5
  547. package/dist/chunk-PTZK576G.js +0 -1
  548. package/dist/chunk-QYADASLV.js +0 -1
  549. package/dist/chunk-ST7UXLWR.js +0 -1
  550. package/dist/chunk-SVY7VUYU.js +0 -1
  551. package/dist/chunk-TK3NWWD4.js +0 -1
  552. package/dist/chunk-TSOYJ743.js +0 -1
  553. package/dist/chunk-UNGSTR4X.js +0 -61
  554. package/dist/chunk-VIMF6LGM.js +0 -1
  555. package/dist/chunk-VJLMUKOI.js +0 -1
  556. package/dist/chunk-VN6RDSK2.js +0 -1
  557. package/dist/chunk-VV4N5P64.js +0 -1
  558. package/dist/chunk-W3I423PS.js +0 -1
  559. package/dist/chunk-WJR24TAG.js +0 -1
  560. package/dist/chunk-XTGKMHSW.js +0 -1
  561. package/dist/chunk-YBB7ZGTY.js +0 -1
  562. package/dist/chunk-Z4NPUARF.js +0 -1
  563. package/dist/chunk-ZGNQRPDT.js +0 -1
  564. package/dist/chunk-ZKPSFFKU.js +0 -1
  565. package/dist/chunk-ZLV5SQSX.js +0 -1
  566. package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
  567. package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
  568. package/dist/core/index.cjs +0 -1
  569. package/dist/core/index.d.cts +0 -3
  570. package/dist/core/index.d.ts +0 -3
  571. package/dist/core/index.js +0 -1
  572. package/dist/decay-BvOWTZ00.d.ts +0 -112
  573. package/dist/decay-CFlLvXUT.d.cts +0 -112
  574. package/dist/extra/browser.cjs +0 -1
  575. package/dist/extra/browser.d.cts +0 -4
  576. package/dist/extra/browser.d.ts +0 -4
  577. package/dist/extra/browser.js +0 -1
  578. package/dist/extra/index.cjs +0 -20
  579. package/dist/extra/index.d.cts +0 -17
  580. package/dist/extra/index.d.ts +0 -17
  581. package/dist/extra/index.js +0 -1
  582. package/dist/extra/node.cjs +0 -2
  583. package/dist/extra/node.js +0 -2
  584. package/dist/extra/operators.cjs +0 -1
  585. package/dist/extra/operators.d.cts +0 -958
  586. package/dist/extra/operators.d.ts +0 -958
  587. package/dist/extra/operators.js +0 -1
  588. package/dist/extra/reactive.cjs +0 -1
  589. package/dist/extra/reactive.d.cts +0 -353
  590. package/dist/extra/reactive.d.ts +0 -353
  591. package/dist/extra/reactive.js +0 -1
  592. package/dist/extra/render/index.cjs +0 -5
  593. package/dist/extra/render/index.js +0 -1
  594. package/dist/extra/sources.cjs +0 -3
  595. package/dist/extra/sources.js +0 -1
  596. package/dist/extra/storage-browser.cjs +0 -1
  597. package/dist/extra/storage-browser.d.cts +0 -37
  598. package/dist/extra/storage-browser.d.ts +0 -37
  599. package/dist/extra/storage-browser.js +0 -1
  600. package/dist/extra/storage-core.cjs +0 -1
  601. package/dist/extra/storage-core.d.cts +0 -28
  602. package/dist/extra/storage-core.d.ts +0 -28
  603. package/dist/extra/storage-core.js +0 -1
  604. package/dist/extra/storage-node.cjs +0 -1
  605. package/dist/extra/storage-node.d.cts +0 -2
  606. package/dist/extra/storage-node.d.ts +0 -2
  607. package/dist/extra/storage-node.js +0 -0
  608. package/dist/extra/storage-tiers-browser.cjs +0 -1
  609. package/dist/extra/storage-tiers-browser.d.cts +0 -120
  610. package/dist/extra/storage-tiers-browser.d.ts +0 -120
  611. package/dist/extra/storage-tiers-browser.js +0 -1
  612. package/dist/extra/storage-tiers-node.cjs +0 -1
  613. package/dist/extra/storage-tiers-node.d.cts +0 -210
  614. package/dist/extra/storage-tiers-node.d.ts +0 -210
  615. package/dist/extra/storage-tiers-node.js +0 -1
  616. package/dist/extra/storage-tiers.cjs +0 -1
  617. package/dist/extra/storage-tiers.d.cts +0 -412
  618. package/dist/extra/storage-tiers.d.ts +0 -412
  619. package/dist/extra/storage-tiers.js +0 -1
  620. package/dist/graph/index.cjs +0 -7
  621. package/dist/graph/index.d.cts +0 -7
  622. package/dist/graph/index.d.ts +0 -7
  623. package/dist/graph/index.js +0 -1
  624. package/dist/graph-CWvEUQAq.d.cts +0 -1861
  625. package/dist/graph-D9LFnda9.d.ts +0 -1861
  626. package/dist/index-5k1T6jl0.d.cts +0 -121
  627. package/dist/index-9770hRuQ.d.cts +0 -779
  628. package/dist/index-B1F8Enjf.d.ts +0 -704
  629. package/dist/index-BHskSB8v.d.ts +0 -3413
  630. package/dist/index-BIYAkbAi.d.cts +0 -26
  631. package/dist/index-BoJ5JHxI.d.ts +0 -557
  632. package/dist/index-BocU7pqs.d.ts +0 -779
  633. package/dist/index-BxNs2HB9.d.cts +0 -1858
  634. package/dist/index-C1T3d7V-.d.cts +0 -704
  635. package/dist/index-C5ri2Axc.d.cts +0 -301
  636. package/dist/index-C9l6OEBL.d.ts +0 -26
  637. package/dist/index-CC-AvFTy.d.cts +0 -557
  638. package/dist/index-CJF1URuX.d.ts +0 -121
  639. package/dist/index-CdTelp1M.d.ts +0 -202
  640. package/dist/index-Cj3WohTd.d.cts +0 -202
  641. package/dist/index-Co7uli2l.d.cts +0 -3413
  642. package/dist/index-D0aciIex.d.cts +0 -209
  643. package/dist/index-DHen9Klo.d.ts +0 -1858
  644. package/dist/index-Yq60JP3s.d.ts +0 -209
  645. package/dist/index-nozs3fFC.d.ts +0 -301
  646. package/dist/node-kK3CvTrR.d.cts +0 -1347
  647. package/dist/node-kK3CvTrR.d.ts +0 -1347
  648. package/dist/patterns/ai/browser.cjs +0 -8
  649. package/dist/patterns/ai/browser.js +0 -3
  650. package/dist/patterns/ai/index.cjs +0 -74
  651. package/dist/patterns/ai/index.d.cts +0 -20
  652. package/dist/patterns/ai/index.d.ts +0 -20
  653. package/dist/patterns/ai/index.js +0 -1
  654. package/dist/patterns/ai/node.cjs +0 -1
  655. package/dist/patterns/ai/node.js +0 -1
  656. package/dist/patterns/cqrs/index.cjs +0 -3
  657. package/dist/patterns/cqrs/index.d.cts +0 -8
  658. package/dist/patterns/cqrs/index.d.ts +0 -8
  659. package/dist/patterns/cqrs/index.js +0 -1
  660. package/dist/patterns/demo-shell/index.cjs +0 -5
  661. package/dist/patterns/demo-shell/index.d.cts +0 -7
  662. package/dist/patterns/demo-shell/index.d.ts +0 -7
  663. package/dist/patterns/demo-shell/index.js +0 -1
  664. package/dist/patterns/domain-templates/index.cjs +0 -3
  665. package/dist/patterns/domain-templates/index.d.cts +0 -6
  666. package/dist/patterns/domain-templates/index.d.ts +0 -6
  667. package/dist/patterns/domain-templates/index.js +0 -1
  668. package/dist/patterns/graphspec/index.cjs +0 -86
  669. package/dist/patterns/graphspec/index.d.cts +0 -8
  670. package/dist/patterns/graphspec/index.d.ts +0 -8
  671. package/dist/patterns/graphspec/index.js +0 -1
  672. package/dist/patterns/harness/index.cjs +0 -48
  673. package/dist/patterns/harness/index.d.cts +0 -13
  674. package/dist/patterns/harness/index.d.ts +0 -13
  675. package/dist/patterns/harness/index.js +0 -1
  676. package/dist/patterns/inspect/index.cjs +0 -3
  677. package/dist/patterns/inspect/index.d.cts +0 -9
  678. package/dist/patterns/inspect/index.d.ts +0 -9
  679. package/dist/patterns/inspect/index.js +0 -1
  680. package/dist/patterns/job-queue/index.cjs +0 -3
  681. package/dist/patterns/job-queue/index.d.cts +0 -9
  682. package/dist/patterns/job-queue/index.d.ts +0 -9
  683. package/dist/patterns/job-queue/index.js +0 -1
  684. package/dist/patterns/memory/index.cjs +0 -3
  685. package/dist/patterns/memory/index.d.cts +0 -8
  686. package/dist/patterns/memory/index.d.ts +0 -8
  687. package/dist/patterns/memory/index.js +0 -1
  688. package/dist/patterns/messaging/index.cjs +0 -3
  689. package/dist/patterns/messaging/index.d.cts +0 -7
  690. package/dist/patterns/messaging/index.d.ts +0 -7
  691. package/dist/patterns/messaging/index.js +0 -1
  692. package/dist/patterns/orchestration/index.cjs +0 -3
  693. package/dist/patterns/orchestration/index.d.cts +0 -8
  694. package/dist/patterns/orchestration/index.d.ts +0 -8
  695. package/dist/patterns/orchestration/index.js +0 -1
  696. package/dist/patterns/process/index.cjs +0 -3
  697. package/dist/patterns/process/index.d.cts +0 -10
  698. package/dist/patterns/process/index.d.ts +0 -10
  699. package/dist/patterns/process/index.js +0 -1
  700. package/dist/patterns/reactive-layout/index.cjs +0 -4
  701. package/dist/patterns/reactive-layout/index.d.cts +0 -7
  702. package/dist/patterns/reactive-layout/index.d.ts +0 -7
  703. package/dist/patterns/reactive-layout/index.js +0 -1
  704. package/dist/patterns/reduction/index.cjs +0 -3
  705. package/dist/patterns/reduction/index.d.cts +0 -6
  706. package/dist/patterns/reduction/index.d.ts +0 -6
  707. package/dist/patterns/reduction/index.js +0 -1
  708. package/dist/patterns/surface/index.cjs +0 -13
  709. package/dist/patterns/surface/index.d.cts +0 -9
  710. package/dist/patterns/surface/index.d.ts +0 -9
  711. package/dist/patterns/surface/index.js +0 -1
  712. package/dist/reactive-log-BKALbfal.d.ts +0 -223
  713. package/dist/reactive-log-DIGdYqQ6.d.cts +0 -223
  714. package/dist/reactive-map-CEFGp8TK.d.cts +0 -296
  715. package/dist/reactive-map-DS_SIAxv.d.ts +0 -296
  716. package/dist/resilience-6LYQJAC5.js +0 -1
  717. package/dist/sugar-DQjFmVqb.d.cts +0 -399
  718. package/dist/sugar-fhLIE7TT.d.ts +0 -399
  719. package/dist/topology-tree-Bcz27hpF.d.cts +0 -25
  720. package/dist/topology-tree-xvaD0fOX.d.ts +0 -25
@@ -1,4 +0,0 @@
1
- "use strict";var Qe=Object.defineProperty;var Pn=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var Fn=Object.prototype.hasOwnProperty;var F=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ln=(t,e)=>{for(var n in e)Qe(t,n,{get:e[n],enumerable:!0})},$n=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of In(e))!Fn.call(t,s)&&s!==n&&Qe(t,s,{get:()=>e[s],enumerable:!(r=Pn(e,s))||r.enumerable});return t};var Bn=t=>$n(Qe({},"__esModule",{value:!0}),t);function jn(t){return t>=768&&t<=879||t>=1155&&t<=1161||t>=1425&&t<=1469||t>=1552&&t<=1562||t>=1611&&t<=1631||t>=1648&&t===1648||t>=1750&&t<=1756||t>=1759&&t<=1764||t>=1767&&t<=1768||t>=1770&&t<=1773||t>=1840&&t<=1866||t>=1958&&t<=1968||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2641||t>=2672&&t<=2673||t>=2677&&t===2677||t>=3633&&t===3633||t>=3636&&t<=3642||t>=3655&&t<=3662||t>=3761&&t===3761||t>=3764&&t<=3772||t>=3784&&t<=3790||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65024&&t<=65039||t>=65056&&t<=65071||t===8205?0:t>=4352&&t<=4447||t>=8986&&t<=8987||t>=9001&&t<=9002||t>=9193&&t<=9203||t>=9208&&t<=9210||t>=9725&&t<=9726||t>=9748&&t<=9749||t>=9800&&t<=9811||t===9855||t===9875||t===9889||t>=9898&&t<=9899||t>=9917&&t<=9918||t>=9924&&t<=9925||t===9934||t===9940||t===9962||t>=9970&&t<=9971||t===9973||t===9978||t===9981||t===9986||t===9989||t>=9992&&t<=9997||t===9999||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t>=10548&&t<=10549||t>=11013&&t<=11015||t>=11035&&t<=11036||t===11088||t===11093||t>=11904&&t<=12350||t>=12352&&t<=12447||t>=12448&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12784&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=19968&&t<=40959||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65131||t>=65281&&t<=65376||t>=65504&&t<=65510||t>=126980&&t===126980||t===127183||t>=127344&&t<=127345||t===127358||t===127359||t===127374||t>=127377&&t<=127386||t>=127456&&t<=127487||t>=127488&&t<=127490||t===127514||t===127535||t>=127538&&t<=127546||t>=127568&&t<=127569||t>=127744&&t<=129535||t>=129536&&t<=129791||t>=129792&&t<=130047||t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}function Pt(t){let e=0;for(let n of t)e+=jn(n.codePointAt(0));return e}var It=F(()=>{"use strict"});function j(){return Math.trunc(performance.now()*1e6)}function Re(){return Date.now()*1e6}var ue=F(()=>{"use strict"});function Lt(t,e){let n=new TextEncoder().encode(t.name);if(n.length===0||n.length>255)throw new Error(`encodeEnvelope: codec name "${t.name}" encodes to ${n.length} bytes (must be 1\u2013255)`);let r=t.version;if(!Number.isInteger(r)||r<0||r>65535)throw new Error(`encodeEnvelope: codec.version ${r} out of u16 range (expected integer 0\u201365535)`);let s=2+n.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=at,o[i++]=n.length,o.set(n,i),i+=n.length,o[i++]=r>>>8&255,o[i++]=r&255,o.set(e,i),o}function $t(t,e){if(t.length<Ft)throw new Error(`decodeEnvelope: bytes too short (${t.length} < ${Ft})`);let n=0,r=t[n++];if(r!==at)throw new Error(`decodeEnvelope: unsupported envelope version ${r} (expected ${at})`);let s=t[n++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(n+s+2>t.length)throw new Error(`decodeEnvelope: envelope truncated (need ${n+s+2} bytes, have ${t.length})`);let o=new TextDecoder().decode(t.subarray(n,n+s));n+=s;let i=(t[n]<<8|t[n+1])>>>0;n+=2;let a=t.subarray(n),u=e.lookupCodec(o);if(u==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:u,codecVersion:i,payload:a}}function Bt(t){t.registerCodec(Hn)}var Hn,at,Ft,ut=F(()=>{"use strict";Hn={name:"json",version:1,contentType:"application/json",encode(t){let e=JSON.stringify(t);return new TextEncoder().encode(e)},decode(t,e){let n=new TextDecoder().decode(t);return JSON.parse(n)}},at=1,Ft=4});function Me(t){if(t==null)return pe;let{type:e,id:n,...r}=t;return{type:e??"system",id:n??"",...r}}var pe,lt=F(()=>{"use strict";pe={type:"system",id:""}});function De(){return ge>0||Oe}function jt(){return ge>0}function be(t){ge>0?Se.push(t):t()}function dt(t){ge+=1;let e=!1;try{t()}catch(n){throw e=!0,n}finally{if(ge-=1,ge===0)if(e){if(!Oe){let n=Se.splice(0);for(let r of n)try{r()}catch{}le.length=0,de.length=0,me.length=0}}else Vn()}}function Vn(){let t=!Oe;t&&(Oe=!0);let e=[],n=0;try{for(;le.length>0||de.length>0||me.length>0||t&&Se.length>0;){if(t&&Se.length>0){let o=Se.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(n+=1,n>1e3)throw le.length=0,de.length=0,me.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(le.length>0?le:de.length>0?de:me).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{t&&(Oe=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function ye(t,e,n){if(e.length===0)return;if(e.length===1){let l=n(e[0][0]);if(l<3||!De()){t(e);return}(l>=5?me:l===4?de:le).push(()=>t(e));return}let r=e.length,s=r,o=r,i=r,a=0;for(;a<r&&n(e[a][0])<3;)a++;for(s=a;a<r&&n(e[a][0])===3;)a++;for(o=a;a<r&&n(e[a][0])===4;)a++;i=a;let u=De();if(s>0){let l=e.slice(0,s);t(l)}if(o>s){let l=e.slice(s,o);u?le.push(()=>t(l)):t(l)}if(i>o){let l=e.slice(o,i);u?de.push(()=>t(l)):t(l)}if(r>i){let l=e.slice(i,r);u?me.push(()=>t(l)):t(l)}}var ge,Oe,le,de,me,Se,Ge=F(()=>{"use strict";ge=0,Oe=!1,le=[],de=[],me=[],Se=[]});var ve,L,Y,J,X,te,se,H,V,R,xe,ct,Wn,ft,zn,Un,ht,Ht,Vt,Wt,pt,we=F(()=>{"use strict";ve=Symbol.for("graphrefly/START"),L=Symbol.for("graphrefly/DATA"),Y=Symbol.for("graphrefly/DIRTY"),J=Symbol.for("graphrefly/RESOLVED"),X=Symbol.for("graphrefly/INVALIDATE"),te=Symbol.for("graphrefly/PAUSE"),se=Symbol.for("graphrefly/RESUME"),H=Symbol.for("graphrefly/TEARDOWN"),V=Symbol.for("graphrefly/COMPLETE"),R=Symbol.for("graphrefly/ERROR"),xe=Object.freeze([Y]),ct=Object.freeze([J]),Wn=Object.freeze([X]),ft=Object.freeze([ve]),zn=Object.freeze([V]),Un=Object.freeze([H]),ht=Object.freeze([xe]),Ht=Object.freeze([ct]),Vt=Object.freeze([Wn]),Wt=Object.freeze([zn]),pt=Object.freeze([Un])});function zt(t){t.registerMessageType(ve,{tier:0,wireCrossing:!1}),t.registerMessageType(Y,{tier:1,wireCrossing:!1}),t.registerMessageType(X,{tier:1,wireCrossing:!1,metaPassthrough:!1}),t.registerMessageType(te,{tier:2,wireCrossing:!1}),t.registerMessageType(se,{tier:2,wireCrossing:!1}),t.registerMessageType(L,{tier:3,wireCrossing:!0}),t.registerMessageType(J,{tier:3,wireCrossing:!0}),t.registerMessageType(V,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(R,{tier:4,wireCrossing:!0,metaPassthrough:!1}),t.registerMessageType(H,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var Pe,Ut=F(()=>{"use strict";we();Pe=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 gt(t){let e=Kn.filter(n=>t({type:n,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(n=>n==="human"||n==="llm"||n==="system")?"both":e.length===1?e[0]:e.join("+")}var q,Kn,Ie=F(()=>{"use strict";q=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}},Kn=["human","llm","wallet","system"]});function mt(t){if(t===void 0)return null;if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError(`Cannot hash non-finite number: ${t}`);if(Number.isInteger(t)&&!Number.isSafeInteger(t))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${t}. Cross-language cid parity is not guaranteed for unsafe integers.`);return t}if(typeof t=="string"||typeof t=="boolean"||t===null)return t;if(Array.isArray(t))return t.map(mt);if(typeof t=="object"&&t!==null){let e={};for(let n of Object.keys(t).sort())e[n]=mt(t[n]);return e}return null}function Jn(t){let e=Yn.encode(t),n=e.length,r=n*8,s=n+9+63&-64,o=new Uint8Array(s);o.set(e),o[n]=128;let i=new DataView(o.buffer);i.setUint32(s-4,r>>>0,!1),i.setUint32(s-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,u=3144134277,l=1013904242,d=2773480762,h=1359893119,y=2600822924,g=528734635,c=1541459225,b=new Uint32Array(64),f=(m,v)=>m>>>v|m<<32-v;for(let m=0;m<s;m+=64){for(let N=0;N<16;N++)b[N]=i.getUint32(m+N*4,!1);for(let N=16;N<64;N++){let C=b[N-15],D=b[N-2],M=f(C,7)^f(C,18)^C>>>3,he=f(D,17)^f(D,19)^D>>>10;b[N]=b[N-16]+M+b[N-7]+he>>>0}let v=a,w=u,p=l,_=d,k=h,T=y,O=g,E=c;for(let N=0;N<64;N++){let C=f(k,6)^f(k,11)^f(k,25),D=k&T^~k&O,M=E+C+D+qn[N]+b[N]>>>0,he=f(v,2)^f(v,13)^f(v,22),qe=v&w^v&p^w&p,Ce=he+qe>>>0;E=O,O=T,T=k,k=_+M>>>0,_=p,p=w,w=v,v=M+Ce>>>0}a=a+v>>>0,u=u+w>>>0,l=l+p>>>0,d=d+_>>>0,h=h+k>>>0,y=y+T>>>0,g=g+O>>>0,c=c+E>>>0}let x=m=>m.toString(16).padStart(8,"0");return x(a)+x(u)+x(l)+x(d)+x(h)+x(y)+x(g)+x(c)}function bt(t){let e=mt(t??null),n=JSON.stringify(e);return Jn(n).slice(0,16)}function Xn(){let t=globalThis.crypto;if(t?.randomUUID)return t.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 yt(t,e,n){let r=n?.id??Xn();if(t===0)return{id:r,version:0};let o=(n?.hash??bt)(e);return{id:r,version:0,cid:o,prev:null}}function Kt(t,e,n){t.version+=1,"cid"in t&&(t.prev=t.cid,t.cid=n(e))}var qn,Yn,qt=F(()=>{"use strict";qn=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]),Yn=new TextEncoder});function Xt(t){return{node:t,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function vt(t){t.prevData=void 0,t.dirty=!1,t.involvedThisWave=!1,t.dataBatch.length=0,t.terminal=void 0}function Fe(t){return t.length===0?t:typeof t[0]=="symbol"?[t]:t}function Z(t,e,n){let r=Zt(t)?t:[],s=typeof t=="function"?t:typeof e=="function"?e:void 0,o={};return Zt(t)?o=(xt(e)?e:n)??{}:xt(t)?o=t:o=(xt(e)?e:n)??{},new $(r,s,o)}var Yt,Jt,Zn,Qn,oe,$,Zt,xt,ne=F(()=>{"use strict";ut();lt();Ge();ue();Ut();Ie();we();qt();Yt=()=>{},Jt=100;Zn=(t,e,n,r)=>{n.direction==="down-in"&&t._onDepMessage(n.depIndex,e)},Qn=(t,e,n,r)=>{let s=t;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[ft]:[ft,[L,o]];s._status==="dirty"&&i.push(xe),ye(e,i,s._config.tierOf)},oe=new Pe({onMessage:Zn,onSubscribe:Qn});zt(oe);Bt(oe);$=class t{_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??oe,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??bt;let s=r.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?yt(s,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Xt);let o={};for(let[a,u]of Object.entries(r.meta??{})){let l={initial:u,name:`${r.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};r.guard!=null&&(l.guard=r.guard),r.resubscribable===!0&&(l.resubscribable=!0),o[a]=new t([],void 0,l)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[L,a]])},down(a){i._emit(Fe(a))},up(a){i._emitUp(Fe(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,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 s=n?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??n?.id,u=i?.version??0,l=yt(e,o,{id:a,hash:s});l.version=u,this._versioning=l,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=Me(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 s=Me(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new q({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new q({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:Re()}}down(e,n){let r=Fe(e);r.length!==0&&(this._checkGuard(n),this._emit(r))}emit(e,n){this._checkGuard(n),this._emit([[L,e]])}up(e,n){if(this._deps.length===0)return;let r=Fe(e);if(r.length===0)return;this._checkGuard(n);let s=n??{internal:!0};this._validateUpTiers(r);for(let o of this._deps)o.node.up?.(r,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let r of e){let s=n(r[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let u=Me(n);if(!this._guard(u,"observe"))throw new q({actor:u,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)vt(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[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 s=r,o=this._deps[r];o.unsub=Yt,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,u=!1;for(let l of i)a(l[0])>=3&&(u=!0),this._config.onMessage(this,l,{direction:"down-in",depIndex:s},this._actions);u&&this._maybeRunFnOnSettlement()}),n++}}catch(r){this._deps[n].unsub=null;for(let s=0;s<n;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}vt(o)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let n=this._deps.length,r=Xt(e);if(this._deps.push(r),this._sinks==null)return n;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ht),r.unsub=Yt;try{r.unsub=e.subscribe(s=>{if(r.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:n},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(r){this._emit([[R,this._wrapFnError("cleanup threw",r)]])}else if(n!=null&&typeof n=="object"){let r=n.deactivate;if(typeof r=="function")try{r()}catch(s){this._emit([[R,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let r of this._deps){if(r.unsub!=null){let s=r.unsub;r.unsub=null;try{s()}catch{}}vt(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],s=n[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:n};for(let i of this._inspectorHooks)i(o)}if(s!==ve){if(s===Y){this._depDirtied(r);return}if(s===X){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(Vt);return}if(s===te||s===se){this._emit([n]);return}if(s===H){this._emit(pt);return}if(s===L)this._depSettledAsData(r,n[1]);else if(s===J)this._depSettledAsResolved(r);else if(s===V)this._depSettledAsTerminal(r,!0);else if(s===R)this._depSettledAsTerminal(r,n[1]);else{this._emit([n]);return}if(!this._fn){(s===L||s===J)&&this._emit([n]),(s===V||s===R)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ht))}_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(Ht),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([[R,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Wt)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(i){this._emit([[R,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[R,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let n=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),r=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=n[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let s=this._deps.map(i=>i.terminal),o={prevData:r,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:n,prevData:r};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(n,this._actions,o);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[R,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Jt?(this._rerunDepth=0,this._emit([[R,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Jt} \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"?[xe,e[0]]:e;let r=!0,s=!1,o=!1,i=-1;for(let u of e){let l=n(u[0]);l<i&&(r=!1),l===3&&(s=!0),u[0]===Y&&(o=!0),i=l}let a=e;if(!r){let u=e.map((l,d)=>({m:l,i:d,tier:n(l[0])}));u.sort((l,d)=>l.tier-d.tier||l.i-d.i),a=u.map(l=>l.m)}if(s&&!o&&this._status!=="dirty"){let u=0;for(;u<a.length&&n(a[u][0])===0;)u++;return u===0?[xe,...a]:[...a.slice(0,u),xe,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===R&&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 a=e.filter(u=>u[0]===H||u[0]===X);if(a.length===0)return;n=a}n=this._frameBatch(n);let s=null;for(let a=0;a<n.length;a++){let u=n[a],l=u[0];if(l!==te&&l!==se){s?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${l===te?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let d=!0;if(this._pausable!==!1){let h=u[1];if(l===te)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(h),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(h))d=!1;else if(this._pauseLocks.delete(h),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let y=this._pauseBuffer;this._pauseBuffer=[],this._emit(y)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}d?s?.push(u):s==null&&(s=n.slice(0,a))}if(s!=null){if(s.length===0)return;n=s}if(this._hasMeta&&n.some(a=>a[0]===H))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(pt)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(n);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let l of o)a(l[0])===3?this._pauseBuffer.push(l):u.push(l);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[R,i]])}_updateState(e){let n=this._config.tierOf,r,s,o=-1,i=0;for(let d of e)n(d[0])===3&&i++;let a=i<=1,u=-1;if(this._versioning!=null&&i>1){for(let d=e.length-1;d>=0;d--)if(e[d][0]===L){u=d;break}}for(let d=0;d<e.length;d++){let h=e[d],y=h[0];if(y===L){if(h.length>=2){let g=!1;if(a&&this._cached!==void 0)try{g=this._equals(this._cached,h[1])}catch(c){s=this._wrapFnError("equals threw",c),o=d;break}if(g){r==null&&(r=e.slice(0,d)),r.push(ct),this._status="resolved";continue}this._cached=h[1],this._versioning!=null&&(u<0||d===u)&&Kt(this._versioning,h[1],this._hashFn)}this._status="settled",r?.push(h)}else if(r?.push(h),y===Y)this._status="dirty";else if(y===J)this._status="resolved";else if(y===V){this._status="completed";{let g=this._config.rigorRecorder;if(g!=null)try{g.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(y===R){this._status="errored";{let g=this._config.rigorRecorder;if(g!=null)try{g.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(y===X){if(this._cached!==void 0){let c=this._config.rigorRecorder;if(c!=null)try{c.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let g=this._cleanup;if(typeof g=="function"){this._cleanup=void 0;try{g()}catch{}}else if(g!=null&&typeof g=="object"){let c=g.invalidate;if(typeof c=="function")try{c()}catch{}}}else y===H&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let l=o>=0?r??e.slice(0,o):r??e;return s!=null?{finalMessages:l,equalsError:s}:{finalMessages:l}}_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(jt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],be(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}ye(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);ye(this._deliverToSinks,n,this._config.tierOf)}},Zt=t=>Array.isArray(t),xt=t=>typeof t=="object"&&t!=null&&!Array.isArray(t)});function I(t,e){return Z([],{...e,initial:t})}function ce(t,e){return Z((r,s,o)=>t(s,o)??void 0,{describeKind:"producer",...e})}function z(t,e,n){return Z(t,(s,o,i)=>{let a=s.map((u,l)=>u!=null&&u.length>0?u.at(-1):i.prevData[l]);o.emit(e(a,i))},{describeKind:"derived",...n})}function Qt(t,e,n){return Z(t,(s,o,i)=>{let a=s.map((u,l)=>u!=null&&u.length>0?u.at(-1):i.prevData[l]);return e(a,o,i)??void 0},{describeKind:"effect",...n})}var _e=F(()=>{"use strict";ne()});function wt(t,e){if(e!=null&&e.length>0)return new Set(e);switch(t){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function er(t){return t._describeKind!=null?t._describeKind:t._deps.length>0?"derived":t._fn!=null?"producer":"state"}function tr(t){let e={};for(let[n,r]of Object.entries(t.meta))try{e[n]=r.cache}catch{}return e}function _t(t,e,n){let r=e==null,s=!r&&e!=null?[...e].filter(d=>d.startsWith("meta.")).map(d=>d.slice(5)):null,o=r||e.has("meta")||s!=null&&s.length>0,i="state",a=[];t instanceof $&&(i=er(t),a=t._deps.map(d=>d.node.name??""));let u={type:i,deps:a};(r||e.has("status"))&&(u.status=t.status);let l=t instanceof $?t._guard:void 0;if(o){let d={...tr(t)};if(l!=null&&d.access===void 0&&(d.access=gt(l)),s!=null&&s.length>0&&!e.has("meta")){let h={};for(let y of s)y in d&&(h[y]=d[y]);u.meta=h}else u.meta=d}if(t.name!=null&&(u.name=t.name),(r||e.has("value"))&&(!n||i==="state")){t.status==="sentinel"&&(u.sentinel=!0);try{u.value=t.cache}catch{}}if((r||e.has("v"))&&t.v!=null){let d={id:t.v.id,version:t.v.version};"cid"in t.v&&(d.cid=t.v.cid,d.prev=t.v.prev),u.v=d}return(r||e.has("guard"))&&l!=null&&(u.guard=gt(l)),(r||e.has("lastMutation"))&&t.lastMutation!=null&&(u.lastMutation=t.lastMutation),u}var en=F(()=>{"use strict";Ie();ne()});function kt(t,e){if(Object.is(t,e))return!0;if(t==null||e==null||typeof t!="object"||typeof e!="object")return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!kt(t[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;let s=new Set(r);for(let o of n)if(!s.has(o)||!kt(t[o],e[o]))return!1;return!0}function tn(t,e){return`${t}\0${e}`}function Tt(t,e){let n=[],r=new Set(t.subgraphs),s=new Set(e.subgraphs),o=[];for(let f of s)r.has(f)||o.push(f);o.sort();for(let f of o)n.push({type:"subgraph-mounted",path:f});let i=new Set(Object.keys(t.nodes)),a=new Set(Object.keys(e.nodes)),u=[];for(let f of a)i.has(f)||u.push(f);u.sort();for(let f of u)n.push({type:"node-added",path:f,node:{...e.nodes[f]}});let l=[];for(let f of a){if(!i.has(f))continue;let x=t.nodes[f]?.meta,m=e.nodes[f]?.meta;x==null&&m==null||kt(x??{},m??{})||l.push(f)}l.sort();for(let f of l)n.push({type:"node-meta-changed",path:f,prevMeta:t.nodes[f]?.meta??{},nextMeta:e.nodes[f]?.meta??{}});let d=new Map;for(let f of t.edges)d.set(tn(f.from,f.to),f);let h=new Map;for(let f of e.edges)h.set(tn(f.from,f.to),f);let y=[];for(let[f,x]of h)d.has(f)||y.push(x);y.sort((f,x)=>f.from<x.from?-1:f.from>x.from?1:f.to<x.to?-1:f.to>x.to?1:0);for(let f of y)n.push({type:"edge-added",from:f.from,to:f.to});let g=[];for(let[f,x]of d)h.has(f)||g.push(x);g.sort((f,x)=>f.from<x.from?-1:f.from>x.from?1:f.to<x.to?-1:f.to>x.to?1:0);for(let f of g)n.push({type:"edge-removed",from:f.from,to:f.to});let c=[];for(let f of i)a.has(f)||c.push(f);c.sort();for(let f of c)n.push({type:"node-removed",path:f});let b=[];for(let f of r)s.has(f)||b.push(f);b.sort();for(let f of b)n.push({type:"subgraph-unmounted",path:f});return{events:n,flushedAt_ns:j()}}var nn=F(()=>{"use strict";ue()});function Nt(t){return{describeKind:"producer",...t}}function rn(t,e){return ce(n=>{let r=!1;try{for(let s of t){if(r)return;n.emit(s)}r||n.down([[V]])}catch(s){r||n.down([[R,s]])}return()=>{r=!0}},Nt(e))}function nr(t){return t!=null&&typeof t.then=="function"}function rr(t,e){let{signal:n,...r}=e??{};return ce(s=>{let o=!1,i=()=>{o||(o=!0,s.down([[R,n.reason]]))};if(n?.aborted){i();return}return n?.addEventListener("abort",i,{once:!0}),Promise.resolve(t).then(a=>{o||(o=!0,n?.removeEventListener("abort",i),s.emit(a),s.down([[V]]))},a=>{o||(o=!0,n?.removeEventListener("abort",i),s.down([[R,a]]))}),()=>{o=!0,n?.removeEventListener("abort",i)}},Nt(r))}function sr(t,e){let{signal:n,...r}=e??{};return ce(s=>{let o=new AbortController,i=()=>o.abort(n?.reason);n?.aborted?o.abort(n.reason):n?.addEventListener("abort",i,{once:!0});let a=n??o.signal,u=!1,l=t[Symbol.asyncIterator](),d=()=>{u||a.aborted||Promise.resolve(l.next()).then(h=>{if(!(u||a.aborted)){if(h.done){s.down([[V]]);return}s.emit(h.value),d()}},h=>{!u&&!a.aborted&&s.down([[R,h]])})};return d(),()=>{u=!0,n?.removeEventListener("abort",i),o.abort(),Promise.resolve(l.return?.()).catch(()=>{})}},Nt(r))}function or(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"}function sn(t,e){if(or(t))return t;if(nr(t))return rr(t,e);if(t!=null){let n=t;if(typeof n[Symbol.asyncIterator]=="function")return sr(t,e);if(typeof n[Symbol.iterator]=="function")return rn(t,e)}return ir(t)}function ir(...t){return rn(t,void 0)}function Le(t){return t.subscribe(()=>{})}var on=F(()=>{"use strict";we();_e()});var an=F(()=>{"use strict";on()});var $e,un=F(()=>{"use strict";$e=class{_timer;_gen=0;start(e,n){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&n()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Ee,ln=F(()=>{"use strict";Ee=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let n=(this.head+this._size)%this.capacity;this.buf[n]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let n=e<0?this._size+e:e;if(!(n<0||n>=this._size))return this.buf[(this.head+n)%this.capacity]}toArray(){let e=new Array(this._size);for(let n=0;n<this._size;n++)e[n]=this.buf[(this.head+n)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function dn(t,e,n,r={}){let s=e in t.nodes,o=n in t.nodes;if(!s)return Be(e,n,"no-such-from");if(!o)return Be(e,n,"no-such-to");let i=r.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===n){if(r.findCycle===!0){let l=ar(t,e,r);if(l!=null)return l}let u=je(e,t.nodes[e],0,r);return He(e,n,[u])}if(i===0)return Be(e,n,"no-path");let a=cn(t,e,n,i);return a.found?He(e,n,fn(t,a.pathOrder,r)):Be(e,n,a.truncated?"max-depth-exceeded":"no-path")}function cn(t,e,n,r){let s=new Map,o=[{path:n,depth:0}],i=new Set([n]),a=0,u=!1;for(;a<o.length;){let h=o[a++];if(h.path===e)break;if(r!=null&&h.depth>=r){let b=t.nodes[h.path];b?.deps&&b.deps.length>0&&(u=!0);continue}let y=t.nodes[h.path];if(y==null)continue;let g=y.deps??[],c=new Map;for(let b=0;b<g.length;b++){let f=g[b];if(!f)continue;let x=c.get(f);x==null&&(x=[],c.set(f,x)),x.push(b)}for(let[b,f]of c)i.has(b)||(i.add(b),s.set(b,{from:h.path,depIndices:f}),o.push({path:b,depth:h.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:u};let l=[{path:e}],d=e;for(;d!==n;){let h=s.get(d);if(h==null)return{found:!1,pathOrder:[],truncated:!1};l[l.length-1].depIndices=h.depIndices,l.push({path:h.from}),d=h.from}return{found:!0,pathOrder:l,truncated:!1}}function ar(t,e,n){let r=t.nodes[e];if(r==null)return null;let s=r.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=je(e,r,0,n);a.dep_index=o[0];let u=je(e,r,1,n);return He(e,e,[a,u])}let i=null;for(let a=0;a<s.length;a++){let u=s[a];if(!u||u===e)continue;let l=cn(t,u,e,n.maxDepth);l.found&&(i==null||l.pathOrder.length<i.pathOrder.length)&&(i=l,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...l.pathOrder],truncated:!1})}return i==null?null:He(e,e,fn(t,i.pathOrder,n))}function fn(t,e,n){return e.map((r,s)=>{let o=t.nodes[r.path],i=je(r.path,o,s,n);return r.depIndices!=null&&r.depIndices.length>0&&(i.dep_index=r.depIndices[0],r.depIndices.length>1&&(i.dep_indices=[...r.depIndices])),i})}function je(t,e,n,r){let s={path:t,type:e.type,hop:n};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=r.annotations?.get(t)??e.annotation;o!=null&&(s.annotation=o);let i=r.lastMutations?.get(t)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function He(t,e,n){return hn(t,e,!0,"ok",n)}function Be(t,e,n){return hn(t,e,!1,n,[])}function hn(t,e,n,r,s){let o=ur(t,e,n,r,s);return{from:t,to:e,found:n,reason:r,steps:s,text:o,toJSON(){return{from:t,to:e,found:n,reason:r,steps:s}}}}function ur(t,e,n,r,s){if(!n)switch(r){case"no-such-from":return`explainPath: no node named "${t}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${t}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${t}" to "${e}"`}let o=[`Causal path: ${t} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let u=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(u),"value"in i&&o.push(` value: ${lr(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let l=i.lastMutation.actor;o.push(` actor: ${l.type}${l.id?`:${l.id}`:""}`)}}return o.join(`
2
- `)}function lr(t){if(t===void 0)return"<sentinel>";if(t===null)return"null";if(typeof t=="string")return JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);try{let e=JSON.stringify(t);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(t)}}var pn=F(()=>{"use strict"});function gn(t){let e=new WeakSet,n=new WeakSet,r=[t],s=0;for(;r.length>0;){let o=r.pop();s+=cr(o,e,n,r)}return s}function cr(t,e,n,r){if(t==null)return 0;switch(typeof t){case"number":return B.number;case"boolean":return B.boolean;case"string":return B.string+t.length*2;case"bigint":return B.bigint+fr(t);case"symbol":return B.symbol;case"function":return e.has(t)?0:(e.add(t),B.function);case"undefined":return 0}let o=t;if(e.has(o))return 0;e.add(o);let i=o[dr];if(typeof i=="function")try{let l=i.call(o);if(typeof l=="number"&&Number.isFinite(l))return l}catch{}if(o instanceof Date)return B.date;if(o instanceof RegExp)return B.regexp+o.source.length*2;if(o instanceof Error){let l=o.message?o.message.length*2:0,d=o.stack?o.stack.length*2:0;return B.error+l+d}if(typeof URL<"u"&&o instanceof URL)return B.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return B.promise;if(o instanceof WeakMap)return B.weakmap;if(o instanceof WeakSet)return B.weakset;if(o instanceof Map){let l=B.map;for(let[d,h]of o)l+=B.mapEntry,r.push(d),r.push(h);return l}if(o instanceof Set){let l=B.set;for(let d of o)l+=B.setEntry,r.push(d);return l}if(Array.isArray(o)){let l=B.array+o.length*8;for(let d of o)r.push(d);return l}if(o instanceof ArrayBuffer)return n.has(o)?0:(n.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let l=o;return n.has(l.buffer)?48:(n.add(l.buffer),l.buffer.byteLength+48)}let a=B.object,u=Object.keys(o);for(let l of u){a+=B.string+l.length*2;try{r.push(o[l])}catch{}}return a}function fr(t){let e=t<0n?-t:t;if(e===0n)return 0;let n=e.toString(2).length;return Math.ceil(n/32)*8}var B,dr,mn=F(()=>{"use strict";B={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},dr=Symbol.for("sizeof")});function bn(t,e){let n=e?.topN??10,r=t.describe({detail:"standard"}),s=[],o=t._collectObserveTargets;typeof o=="function"&&o.call(t,"",s);let i=new Map;for(let[y,g]of s)i.set(y,g);let a=[];for(let[y,g]of Object.entries(r.nodes)){let c=i.get(y),b=c instanceof $?c:null,f=b?gn(b.cache):0,x=b?b._sinkCount:0,m=g.deps?.length??0,v=g.type==="effect"&&x===0,w=x===0?g.type==="effect"?"orphan-effect":g.type==="derived"?"idle-derived":g.type==="producer"?"idle-producer":null:null;a.push({path:y,type:g.type,status:g.status??"unknown",valueSizeBytes:f,subscriberCount:x,depCount:m,isOrphanEffect:v,orphanKind:w})}let u=a.reduce((y,g)=>y+g.valueSizeBytes,0),l=(y,g)=>[...a].sort(g??((c,b)=>b[y]-c[y])).slice(0,n),d=a.filter(y=>y.orphanKind!=null),h=a.filter(y=>y.isOrphanEffect);return{nodeCount:a.length,edgeCount:r.edges.length,subgraphCount:r.subgraphs.length,nodes:a,totalValueSizeBytes:u,hotspots:{byValueSize:l("valueSizeBytes"),bySubscriberCount:l("subscriberCount"),byDepCount:l("depCount")},orphans:d,orphanEffects:h}}var yn=F(()=>{"use strict";ne();mn()});function Ve(t,e){let n=Math.max(16,t.size*4),r=0;for(;t.size>0;){if(r++>=n){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${n}); ${t.size} disposer(s) discarded`),t.clear();return}let s=t.values().next();if(s.done)return;let o=s.value;t.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function Tn(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"&&typeof t.down=="function"}function hr(t){if(t!=null)return Tn(t)?t.cache:t}function fe(t){return t!=null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function"&&typeof t.down=="function"}function ie(t){return fe(t)?t.cache??"":t}function vn(t){return fe(t)?t.cache??0:t}function xn(t){return fe(t)?t.cache??!1:t}function pr(t){let e=[];for(let n of Object.keys(t).sort()){let r=t[n].v;r!=null&&e.push(`${n} ${r.id} ${r.version}`)}return e.join(`
3
- `)}function wn(t){if(t.version!==ke)throw new Error(`unsupported snapshot version ${String(t.version)} (expected ${ke})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in t))throw new Error(`snapshot missing required key "${e}"`);if(typeof t.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof t.nodes!="object"||t.nodes===null||Array.isArray(t.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(t.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(t.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function gr(t,e){let n=new WeakMap,r=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=n.get(s);if(i==null&&(i=new WeakSet,n.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,u=o.constructor;if(a!==u)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let y=o;if(s.length!==y.length)return!1;for(let g=0;g<s.length;g++)if(!r(s[g],y[g]))return!1;return!0}if(s instanceof Map){let y=o;if(s.size!==y.size)return!1;for(let[g,c]of s)if(!y.has(g)||!r(c,y.get(g)))return!1;return!0}if(s instanceof Set){let y=o;if(s.size!==y.size)return!1;for(let g of s){let c=!1;for(let b of y)if(r(g,b)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(s)){let y=s,g=o;if(y.length!==g.length)return!1;for(let c=0;c<y.length;c++)if(y[c]!==g[c])return!1;return!0}let l=Object.keys(s),d=Object.keys(o);if(l.length!==d.length)return!1;let h=new Set(d);for(let y of l)if(!h.has(y)||!r(s[y],o[y]))return!1;return!0};return r(t,e)}function mr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function We(t){let e="^";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="*"){e+=".*";continue}if(r==="?"){e+=".";continue}if(r==="["){let s=t.indexOf("]",n+1);if(s<=n+1){e+="\\[";continue}let o=t.slice(n+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,n=s;continue}e+=mr(r)}return e+="$",new RegExp(e)}function Ot(t){if(typeof t=="string")return JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean"||t==null)return String(t);try{return JSON.stringify(t)}catch{return"[unserializable]"}}function vr(t){return t==="none"?yr:t==="ansi"||t==null?br:{data:t.data??"",dirty:t.dirty??"",resolved:t.resolved??"",invalidate:t.invalidate??"",pause:t.pause??"",resume:t.resume??"",complete:t.complete??"",error:t.error??"",teardown:t.teardown??"",derived:t.derived??"",path:t.path??"",reset:t.reset??""}}function _n(t){if(t==null)return{};let e=t.detail;return e==="full"?{...t,structured:t.structured??!0,timeline:t.timeline??!0,causal:t.causal??!0,derived:t.derived??!0}:e==="minimal"?{...t,structured:t.structured??!0}:t.format==="stage-log"?{...t,structured:t.structured??!0,timeline:t.timeline??!0}:t}function xr(t,e,n){for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);if(s<32||s===127)throw new Error(`Graph "${e}": ${n} "${t}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${r})`)}}function St(t,e,n){if(t==="")throw new Error(`Graph "${e}": ${n} name must be non-empty`);if(t.includes(P))throw new Error(`Graph "${e}": ${n} "${t}" must not contain '${P}' (path separator)`);if(t===Q)throw new Error(`Graph "${e}": ${n} name "${Q}" is reserved for meta companion paths`);xr(t,e,n)}function wr(t,e){if(t==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let n=t.split(P);for(let r of n)if(r==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return n}function _r(t,e){let n=!1;for(let s of t)if(!e.isMetaPassthrough(s[0])){n=!0;break}return n?t.filter(s=>e.isMetaPassthrough(s[0])):t}function Nn(t){for(let e of t._mounts.values())Nn(e);for(let e of t._nodes.values())try{e.down([[H]],{internal:!0})}catch{}}function kr(t,e){let n=re.diff(t,e),r={};for(let s of n.nodesAdded){let o=e.nodes[s];o!=null&&(r[s]=o)}return{...n,nodesAddedFull:r}}function kn(t,e,n,r={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return r.withDetail?s:[];if(!r.both&&n!=="upstream"&&n!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=r.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return r.withDetail?s:[];let i=new Map,a=new Map,u=new Map,l=new Map,d=new Set;for(let[v,w]of Object.entries(t.nodes)){if(!v)continue;d.add(v);let p=w.deps??[];i.set(v,p);for(let _ of p)_&&(d.add(_),a.has(_)||a.set(_,new Set),a.get(_).add(v))}for(let v of t.edges){if(v==null||typeof v!="object")continue;let w=typeof v.from=="string"?v.from:"",p=typeof v.to=="string"?v.to:"";!w||!p||(d.add(w),d.add(p),l.has(w)||l.set(w,new Set),l.get(w).add(p),u.has(p)||u.set(p,new Set),u.get(p).add(w))}if(!d.has(e))return r.withDetail?s:[];let h=r.both===!0,y=v=>{if(h){let k=i.get(v)??[],T=u.get(v),O=a.get(v),E=l.get(v),N=[...k];return T&&N.push(...T),O&&N.push(...O),E&&N.push(...E),N}if(n==="upstream"){let k=i.get(v)??[],T=u.get(v);return T?[...k,...T]:k}let w=a.get(v),p=l.get(v),_=w?[...w]:[];return p&&_.push(...p),_},g=new Set([e]),c=new Map,b=[{path:e,depth:0}],f=0,x=!1;for(;f<b.length;){let v=b[f++];if(o!=null&&v.depth>=o){y(v.path).length>0&&(x=!0);continue}for(let w of y(v.path))!w||g.has(w)||(g.add(w),c.set(w,v.depth+1),b.push({path:w,depth:v.depth+1}))}let m=[...c.keys()].sort((v,w)=>v<w?-1:v>w?1:0);return r.withDetail?{paths:m,depths:c,truncated:x}:m}function Tr(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],s=e[n];if(r.path!==s.path||r.type!==s.type||r.status!==s.status||r.hop!==s.hop||r.dep_index!==s.dep_index||r.annotation!==s.annotation||r.value!==s.value||r.lastMutation!==s.lastMutation)return!1;let o=r.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var P,Q,ke,br,yr,re,ze=F(()=>{"use strict";lt();Ge();ue();Ie();we();en();ne();_e();nn();an();un();ln();ut();pn();yn();P="::",Q="__meta__",ke=1;br={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},yr={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};re=class t{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,n){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(P))throw new Error(`Graph name must not contain '${P}' (got "${e}")`);if(e===Q)throw new Error(`Graph name "${Q}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...n??{}}),this.config=n?.config??oe,this._traceRing=new Ee(n?.traceCapacity??1e3),n?.versioning!=null&&this.setVersioning(n.versioning),typeof n?.factory=="string"&&(this._factory=n.factory,n.factoryArgs!==void 0&&(this._factoryArgs=n.factoryArgs))}tagFactory(e,n){return this._factory=e,this._factoryArgs=n,this}ancestors(e=!0){let n=[],r=e?this:this._parent;for(;r!=null;)n.push(r),r=r._parent;return n}get topology(){return this._topology==null&&(this._topology=ce(e=>{let n=r=>{e.emit(r)};return this._topologyEmitters.add(n),()=>{this._topologyEmitters.delete(n)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let n of this._topologyEmitters)n(e)}nameOf(e){return this._nodeToName.get(e)}add(e,n){let r=e.name,s=n?.name??r;if(s==null||s==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let o=s,i=n?.annotation;if(St(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:j()})),e}setVersioning(e){if(e!=null)for(let n of this._nodes.values())n instanceof $&&n._applyVersioning(e)}remove(e){St(e,this.name,"remove");let n=this._mounts.get(e);if(n){let o={kind:"mount",nodes:[],mounts:[]},i=[];n._collectObserveTargets("",i);for(let[a,u]of i)a.includes(`${P}${Q}${P}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...n._collectSubgraphs(`${e}${P}`)),this._mounts.delete(e),n._parent=void 0,Nn(n),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let r=this._nodes.get(e);if(!r)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(r),r.down([[H]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let n=typeof e=="function"?e:(()=>{let o=We(e);return i=>o.test(i)})(),r={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>n(o));for(let o of s){let i=this.remove(o);r.nodes.push(...i.nodes),r.mounts.push(...i.mounts)}return r.nodes.sort(),r.mounts.sort(),r}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),n=this._nodes,r=0;return{[Symbol.iterator](){return this},next(){if(r>=e.length)return{value:void 0,done:!0};let s=e[r++];return{value:[s,n.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(P))return this.resolve(e);let n=this._nodes.get(e);if(!n)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return n}get(e){return this.node(e).cache}set(e,n,r){let s=r?.internal===!0;this.node(e).down([[L,n]],{actor:r?.actor,internal:s,delivery:"write"})}setAll(e,n){let r=Symbol.iterator in e?e:Object.entries(e);dt(()=>{for(let[s,o]of r)this.set(s,o,n)})}invalidate(e,n){let r=n?.internal===!0;this.node(e).down([[X]],{actor:n?.actor,internal:r,delivery:"write"})}error(e,n,r){let s=r?.internal===!0;this.node(e).down([[R,n]],{actor:r?.actor,internal:s,delivery:"write"})}complete(e,n){let r=n?.internal===!0;this.node(e).down([[V]],{actor:n?.actor,internal:r,delivery:"write"})}_registerSelfPruningKeepalive(e){let n,r,s=()=>{n?.(),n=void 0,r?.(),r=void 0};n=e.subscribe(o=>{for(let i of o){let a=i[0];if(a===H||a===V||a===R){s();return}}}),r=this.addDisposer(s)}_wireSignalToRemove(e,n){if(n==null)return;let r=()=>{try{this.remove(e)}catch{}};if(n.aborted){r();return}n.addEventListener("abort",r,{once:!0}),this.addDisposer(()=>n.removeEventListener("abort",r))}derived(e,n,r,s){let o=n.map(g=>this.resolve(g)),{keepAlive:i,annotation:a,equals:u,initial:l,meta:d,signal:h}=s??{},y=z(o,r,{name:e,...u!=null?{equals:u}:{},...l!==void 0?{initial:l}:{},...d!=null?{meta:d}:{}});return this.add(y,{name:e,...a!=null?{annotation:a}:{}}),i===!0&&this._registerSelfPruningKeepalive(y),this._wireSignalToRemove(e,h),y}effect(e,n,r,s){let o=n.map(d=>this.resolve(d)),{annotation:i,meta:a,signal:u}=s??{},l=Qt(o,r,{name:e,...a!=null?{meta:a}:{}});return this.add(l,{name:e,...i!=null?{annotation:i}:{}}),this._wireSignalToRemove(e,u),l}produce(e,n,r){if(n===void 0)throw new Error(`Graph "${this.name}".produce("${e}", \u2026): source must not be \`undefined\` \u2014 undefined is the global SENTINEL (spec \xA71.1). Pass \`null\` for nullary DATA, or a Promise/AsyncIterable/Iterable for async sources.`);if(n!==null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function")throw new Error(`Graph "${this.name}".produce("${e}", \u2026): Node sources are rejected. For Node\u2192Node, use graph.derived(name, [path], ([v]) => v, { keepAlive: true }) \u2014 fromAny passes Nodes through verbatim and silently drops opts.`);let{annotation:s,meta:o,equals:i,signal:a}=r??{},u=sn(n,{name:e,...o!=null?{meta:o}:{},...i!=null?{equals:i}:{},...a!=null?{signal:a}:{}});return this.add(u,{name:e,...s!=null?{annotation:s}:{}}),this._wireSignalToRemove(e,a),u}batch(e){dt(e)}edges(e){let n=e?.recursive===!0,r=new Map;if(!n){for(let[u,l]of this._nodes)r.set(l,u);let a=[];for(let[u,l]of this._nodes)if(l instanceof $)for(let d of l._deps){let h=r.get(d.node);h!=null&&a.push([h,u])}return a.sort((u,l)=>u[0]<l[0]?-1:u[0]>l[0]?1:u[1]<l[1]?-1:u[1]>l[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,u]of s)o.set(u,a);let i=[];for(let[a,u]of s)if(u instanceof $)for(let l of u._deps){let d=o.get(l.node);d!=null&&i.push([d,a])}return i.sort((a,u)=>a[0]<u[0]?-1:a[0]>u[0]?1:a[1]<u[1]?-1:a[1]>u[1]?1:0),i}mount(e,n){if(n===void 0){let s=new t(e);return this.mount(e,s)}if(typeof n=="function"){let s=new t(e);return n(s),this.mount(e,s)}let r=n;if(St(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(r===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(r._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${r._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===r)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,r),r._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),r}resolve(e){let n=wr(e,this.name);return this._resolveFromSegments(n)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let n=e;if(n[0]===this.name&&(n=n.slice(1),n.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let r=n[0],s=n.slice(1);if(s.length===0){let a=this._nodes.get(r);if(a)return a;throw this._mounts.has(r)?new Error(`Graph "${this.name}": path ends at subgraph "${r}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${r}"`)}let o=this._nodes.get(r);if(o&&s.length>0&&s[0]===Q)return this._resolveMetaChainFromNode(o,s,n.join(P));let i=this._mounts.get(r);if(!i)throw this._nodes.has(r)?new Error(`Graph "${this.name}": "${r}" is a node; trailing path "${s.join(P)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${r}"`);return i.resolve(s.join(P))}_resolveMetaChainFromNode(e,n,r){let s=e,o=0,i=[...n];for(;o<i.length;){if(i[o]!==Q)throw new Error(`Graph "${this.name}": expected ${Q} segment in meta path "${r}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${Q} in "${r}"`);let a=i[o+1],u=s.meta[a];if(!u)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${r}"`);s=u,o+=2}return s}signal(e,n){if(n?.internal!==!0){for(let s of e)if(this.config.messageTier(s[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let r=[];if(this._signalDeliver(e,n??{},new Set,r),r.length>0)throw r[0]}_signalDeliver(e,n,r,s){for(let u of this._mounts.values())u._signalDeliver(e,n,r,s);let i=n.internal===!0?{internal:!0}:{actor:n.actor,delivery:"signal"},a=_r(e,this.config);for(let u of[...this._nodes.keys()].sort()){let l=this._nodes.get(u);if(!r.has(l)){r.add(l);try{l.down(e,i)}catch(d){if(d instanceof q)throw d;s.push(d)}a.length!==0&&this._signalMetaSubtree(l,a,r,i,s)}}}_signalMetaSubtree(e,n,r,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!r.has(a)){r.add(a);try{a.down(n,s)}catch(u){if(u instanceof q)throw u;o.push(u)}this._signalMetaSubtree(a,n,r,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let n=hr(e?.actor),r=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=wt(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let u=new Map;for(let[w,p]of a)u.set(p,w);let l=[];{let w=a.map(([,k])=>k),p=new Set(u.values()),_=0;for(;w.length>0;){let k=w.shift();if(k instanceof $)for(let T of k._deps){let O=T.node;if(u.has(O))continue;let E=O.name??"",N=E;if(!N||p.has(N))if(E){let C=2;for(;p.has(`${E}#${C}`);)C++;N=`${E}#${C}`}else for(N=`__internal__/${_++}`;p.has(N);)N=`__internal__/${_++}`;u.set(O,N),p.add(N),l.push([N,O]),w.push(O)}}}let d=[...a,...l],h={};for(let[w,p]of d){if(n!=null&&!p.allowsObserve(n))continue;let _=_t(p,i,o),k=p instanceof $?p._deps.map(N=>u.get(N.node)??N.node.name??""):[],{name:T,...O}=_,E={...O,deps:k};if(!o){let N=this._annotations.get(w);N!=null&&(E.annotation=N)}if(r!=null)if(typeof r=="function"){let N=r;if(!(N.length>=2?N(w,E):N(E)))continue}else{let N=!0;for(let[C,D]of Object.entries(r)){let M=C==="deps_includes"?"depsIncludes":C==="meta_has"?"metaHas":C;if(M==="depsIncludes"){if(!E.deps.includes(String(D))){N=!1;break}continue}if(M==="metaHas"){if(!Object.hasOwn(E.meta??{},String(D))){N=!1;break}continue}if(E[M]!==D){N=!1;break}}if(!N)continue}h[w]=E}let y=new Set(Object.keys(h)),g=[];for(let[w,p]of d)if(p instanceof $)for(let _ of p._deps){let k=u.get(_.node);k!=null&&g.push([k,w])}g.sort((w,p)=>w[0]<p[0]?-1:w[0]>p[0]?1:w[1]<p[1]?-1:w[1]>p[1]?1:0);let c=g.map(([w,p])=>({from:w,to:p}));(n!=null||r!=null)&&(c=c.filter(w=>y.has(w.from)&&y.has(w.to)));let b=this._collectSubgraphs(""),f=n!=null||r!=null?b.filter(w=>{let p=`${w}${P}`;return[...y].some(_=>_===w||_.startsWith(p))}):b,x=this,m=e;return{name:this.name,nodes:h,edges:c,subgraphs:f,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(w){let p={...m};return Array.isArray(w)?(p.fields=w,p.detail=void 0):(p.detail=w,p.fields=void 0),x.describe(p)}}}_collectSubgraphs(e){let n=[];for(let r of[...this._mounts.keys()].sort()){let s=e===""?r:`${e}${r}`;n.push(s),n.push(...this._mounts.get(r)._collectSubgraphs(`${s}${P}`))}return n}resourceProfile(e){return bn(this,e)}reachable(e,n,r={}){return r.withDetail===!0?kn(this.describe(),e,n,{...r,withDetail:!0}):kn(this.describe(),e,n,r)}explain(e,n,r){return r?.reactive===!0?this._explainReactive(e,n,r):this._explainStatic(ie(e),ie(n),{...r?.maxDepth!==void 0?{maxDepth:vn(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:xn(r.findCycle)}:{}})}_explainStatic(e,n,r){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,u]of Object.entries(s.nodes))u.lastMutation!=null&&i.set(a,u.lastMutation);return dn(s,e,n,{...r?.maxDepth!=null?{maxDepth:r.maxDepth}:{},...r?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let n={...e,reactive:!1},r=e.reactiveName??"describe",s=0,o=I(s,{name:`${r}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,l=()=>{a||u||(a=!0,be(()=>{a=!1,!u&&(s+=1,o.emit(s))}))},d=i.onEvent(m=>{let v=m.type;v!=="data"&&v!=="error"&&v!=="complete"&&v!=="teardown"||l()}),h=[],y=new WeakSet,g=m=>{if(y.has(m)||u)return;y.add(m);let v=m.topology.subscribe(w=>{for(let p of w){if(p[0]!==L)continue;let _=p[1];if(l(),_.kind==="added"&&_.nodeKind==="mount"){let k=m._mounts.get(_.name);k!=null&&g(k)}}});h.push(v);for(let w of m._mounts.keys()){let p=m._mounts.get(w);p!=null&&g(p)}};g(this);let c,b=e.actor;Tn(b)&&(c=b.subscribe(m=>{let v=!1,w=!1;for(let p of m){let _=p[0];_===L?v=!0:(_===V||_===R||_===H)&&(w=!0)}v&&l(),w&&(c?.(),c=void 0,l())}));let f;try{f=z([o],()=>this.describe(n),{name:r,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(m,v)=>m===v})}catch(m){d(),c?.();for(let v of h)v();throw i.dispose(),m}let x=Le(f);return{node:f,dispose(){u=!0,d(),c?.();for(let m of h)m();h.length=0,i.dispose(),x()}}}_describeReactiveDiff(e){let n={...e,reactive:!1},r=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(n),i=Tt(s,o),a=I(i,{name:r,meta:{domain:"audit",kind:"describe-diff"},equals:(y,g)=>y===g}),u=this._describeReactive({...e,reactiveName:void 0}),l=!1,d=u.node.subscribe(y=>{if(!l)for(let g of y){if(g[0]!==L)continue;let c=g[1],b=Tt(o,c);o=c,b.events.length!==0&&a.emit(b)}}),h=Le(a);return{node:a,dispose(){l=!0,d(),u.dispose(),a.down([[H,"describe-diff disposed"]]),h()}}}_explainReactive(e,n,r){let s=0,o=I(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,l=()=>{a||u||(a=!0,be(()=>{a=!1,!u&&(s+=1,o.emit(s))}))},d=i.onEvent(m=>{let v=m.type;v!=="data"&&v!=="error"&&v!=="complete"&&v!=="teardown"||l()}),h=[];e!=null&&fe(e)&&h.push(e),n!=null&&fe(n)&&h.push(n),r?.maxDepth!=null&&fe(r.maxDepth)&&h.push(r.maxDepth),r?.findCycle!=null&&fe(r.findCycle)&&h.push(r.findCycle);let y=()=>{for(let m of h)if(m.cache===void 0)return!1;return!0},g=()=>{let m=ie(e),v=ie(n);return{from:m,to:v,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:m,to:v,found:!1,reason:"pending",steps:[]})}},c;try{c=z([o],()=>{if(!y())return g();let m=ie(e),v=ie(n),w={...r?.maxDepth!==void 0?{maxDepth:vn(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:xn(r.findCycle)}:{}};return this._explainStatic(m,v,w)},{name:r?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:ie(e),to:ie(n)},equals:(m,v)=>m.found===v.found&&m.reason===v.reason&&m.steps.length===v.steps.length&&Tr(m.steps,v.steps)})}catch(m){throw d(),i.dispose(),m}let b=Le(c),f=[],x=m=>{let v;return v=m.subscribe(w=>{let p=!1,_=!1;for(let k of w){let T=k[0];T===L?p=!0:(T===V||T===R||T===H)&&(_=!0)}(p||_)&&l(),_&&v&&(v(),v=void 0)}),()=>{v&&(v(),v=void 0)}};for(let m of h)f.push(x(m));return{node:c,dispose(){u=!0,d();for(let m of f)m?.();f.length=0,i.dispose(),b()}}}_pathsMatching(e){let n=We(e),r=[];return this._collectObserveTargets("",r),r.map(([s])=>s).filter(s=>n.test(s))}_collectObserveTargets(e,n){for(let r of[...this._mounts.keys()].sort()){let s=e===""?r:`${e}${P}${r}`;this._mounts.get(r)._collectObserveTargets(s,n)}for(let r of[...this._nodes.keys()].sort()){let s=this._nodes.get(r),o=e===""?r:`${e}${P}${r}`;n.push([o,s]),this._appendMetaObserveTargets(o,s,n)}}_appendMetaObserveTargets(e,n,r){for(let s of Object.keys(n.meta).sort()){let o=n.meta[s],i=`${e}${P}${Q}${P}${s}`;r.push([i,o]),this._appendMetaObserveTargets(i,o,r)}}observe(e,n){let r=typeof e=="string",o=_n(r?n:e);if(o.reactive===!0)return this._observeReactive(r?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(r){let d=e,h=this.resolve(d);if(a!=null&&!h.allowsObserve(a))throw new q({actor:a,action:"observe",nodeName:d});return i?this._buildStructuredObserver([[d,h]],o,"one"):{subscribe(y){return h.subscribe(y)},up(y){try{h.up?.(y)}catch(g){if(g instanceof q)return;throw g}}}}let u=[];this._collectObserveTargets("",u),u.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);let l=a==null?u:u.filter(([,d])=>d.allowsObserve(a));return i?this._buildStructuredObserver(l,o,"all"):{subscribe:d=>{let h=l.map(([y,g])=>g.subscribe(c=>{d(y,c)}));return()=>{for(let y of h)y()}},up:(d,h)=>{try{this.resolve(d).up?.(h)}catch(y){if(y instanceof q)return;throw y}}}}_observeReactive(e,n){let r=n.tiers,s=r!=null?new Set(r):null,o=n.reactiveName??"observe";return ce(i=>{let a=[],u=!1,l=!1,d=()=>{if(a.length===0||l)return;let b={events:a.slice(),flushedAt_ns:j()};a.length=0,i.emit(b)},h={...n,reactive:!1,structured:!0,timeline:!0},y=e!=null?this.observe(e,h):this.observe(h),g=b=>{l||(a.push(b),!u&&(u=!0,be(()=>{u=!1,d()})))};for(let b of y.events)g(b);let c=y.onEvent(g);return()=>{l=!0,c(),y.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,n,r){let s=r==="one"?e[0]?.[0]:void 0,o=i=>{if(r==="one"&&s!=null){let d=this.resolve(s);return this._buildStructuredObserver([[s,d]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);let u=i.actor,l=u==null?a:a.filter(([,d])=>d.allowsObserve(u));return this._buildStructuredObserver(l,i,"all")};return this._createObserveResult(e,n,o)}_createObserveResult(e,n,r){let s=n.timeline===!0,o=n.causal===!0,i=n.derived===!0,a=n.detail==="minimal",u=this.config.inspectorEnabled,l=(o||i)&&u,d=n.maxEvents,h=d!=null&&d>0?new Ee(d):null,y=[],g=new Set,c=n.tiers!=null?new Set(n.tiers):null,b={},f=new Set,x=0,m=0,v=0,w=0,p=0,_=0,k=!1,T=!1,O=0,E=new Map,N=new Map,C=new Map,D=S=>{if(!(c!=null&&!c.has(S.type))){h?h.push(S):y.push(S);for(let G of g)G(S)}},M=S=>c==null||c.has(S),he=()=>s?{timestamp_ns:j(),in_batch:De(),batch_id:O}:{},qe=(S,G)=>{if(!(!l||!(S instanceof $)))return S._setInspectorHook(U=>{if(U.kind==="dep_message")E.set(S,U.depIndex);else if(U.kind==="run"){let Ne=U.batchData.map((A,W)=>A!=null&&A.length>0?A.at(-1):U.prevData[W]);N.set(S,Ne);let K=U.batchData.map(A=>A!=null?[...A]:void 0);C.set(S,K),i&&D({type:"derived",path:G,dep_values:Ne,dep_batches:K,...he()})}})},Ce=S=>{let G=E.get(S),U=N.get(S);if(!o||U==null)return{};let K=(G!=null&&G>=0&&S instanceof $?S._deps[G]:void 0)?.node,A=K?.v,W=C.get(S);return{trigger_dep_index:G,trigger_dep_name:K?.name,...A!=null?{trigger_version:{id:A.id,version:A.version}}:{},dep_values:[...U],...W!=null?{dep_batches:W}:{}}},Mt=[],Dt=[];for(let[S,G]of e){let U=qe(G,S);U&&Mt.push(U),Dt.push(G.subscribe(Ne=>{O++;for(let K of Ne){let A=K[0],W=he();if(A===L){b[S]=K[1];let Ze=G instanceof $?G.lastMutation?.actor??pe:pe;D({type:"data",path:S,data:K[1],actor:Ze,...W,...Ce(G)})}else if(a)A===Y?M("dirty")&&x++:A===J?M("resolved")&&m++:A===X?M("invalidate")&&v++:A===te?M("pause")&&w++:A===se?M("resume")&&p++:A===H?M("teardown")&&_++:A===V&&!f.has(S)?M("complete")&&(k=!0):A===R&&M("error")&&(T=!0,f.add(S));else if(A===Y)M("dirty")&&x++,D({type:"dirty",path:S,...W});else if(A===J)M("resolved")&&m++,D({type:"resolved",path:S,...W,...Ce(G)});else if(A===X)M("invalidate")&&v++,D({type:"invalidate",path:S,...W});else if(A===te)M("pause")&&w++,D({type:"pause",path:S,lockId:K[1],...W});else if(A===se)M("resume")&&p++,D({type:"resume",path:S,lockId:K[1],...W});else if(A===V)M("complete")&&!f.has(S)&&(k=!0),D({type:"complete",path:S,...W});else if(A===R){M("error")&&(T=!0,f.add(S));let Ze=G instanceof $?G.lastMutation?.actor??pe:pe;D({type:"error",path:S,data:K[1],actor:Ze,...W})}else A===H&&(M("teardown")&&_++,D({type:"teardown",path:S,...W}))}}))}let Ye=!1,Je=()=>{if(!Ye){Ye=!0;for(let S of Dt)S();for(let S of Mt)S();for(let S of Ae)S({value:void 0,done:!0});Ae.length=0}},Xe=[],Ae=[];g.add(S=>{let G=Ae.shift();G?G({value:S,done:!1}):Xe.push(S)});let Gt={get values(){return b},get dirtyCount(){return x},get resolvedCount(){return m},get invalidateCount(){return v},get pauseCount(){return w},get resumeCount(){return p},get teardownCount(){return _},get events(){return h?h.toArray():[...y]},get anyCompletedCleanly(){return k},get anyErrored(){return T},get completedWithoutErrors(){return k&&!T},onEvent(S){return g.add(S),()=>g.delete(S)},dispose:Je,expand(S){Je();let G={...n};return typeof S=="string"?G.detail=S:Object.assign(G,S),r(_n(G))},[Symbol.asyncIterator](){return{next(){return Xe.length>0?Promise.resolve({value:Xe.shift(),done:!1}):Ye?Promise.resolve({value:void 0,done:!0}):new Promise(S=>Ae.push(S))},return(){return Je(),Promise.resolve({value:void 0,done:!0})}}}};return n.format!=null&&this._attachFormatLogger(Gt,n),Gt}_attachFormatLogger(e,n){let r=n.format;if(r==null)return;let s=n.logger??(c=>console.log(c)),o=n.includeTypes?new Set(n.includeTypes):null,i=n.excludeTypes?new Set(n.excludeTypes):null,a=o==null&&i==null?()=>!0:c=>(o==null||o.has(c))&&(i==null||!i.has(c)),u=vr(n.theme),l=r==="stage-log"?j():0,d=c=>c==null?"":n.stageLabels?.[c]??c,h=(c,b)=>c.length>b?`${c.slice(0,b-1)}\u2026`:c,y=c=>c.type==="data"||c.type==="error"?h(Ot(c.data),120):"",g=c=>{if(r==="stage-log"){let k=(j()-l)/1e9,T=d(c.path).padEnd(9);if(c.type==="data"){let O=y(c);return`[${k.toFixed(3)}s] ${T} \u2190${O?` ${O}`:""}`}if(c.type==="error"){let O=y(c);return`[${k.toFixed(3)}s] ${T} \u2717${O?` ${O}`:""}`}return c.type==="complete"?`[${k.toFixed(3)}s] ${T} \u25A0 complete`:`[${k.toFixed(3)}s] ${T} ${c.type}`}if(r==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let b=u[c.type]??"",f=c.path?`${u.path}${c.path}${u.reset} `:"",x=c.type==="data"||c.type==="error",m=c.type==="pause"||c.type==="resume",v=x?` ${Ot(c.data)}`:m?` ${Ot(c.lockId)}`:"",w=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,p=w?.trigger_dep_name!=null?` <- ${w.trigger_dep_name}`:w?.trigger_dep_index!=null?` <- #${w.trigger_dep_index}`:"",_=c.in_batch?" [batch]":"";return`${f}${b}${c.type.toUpperCase()}${u.reset}${v}${p}${_}`};e.onEvent(c=>{a(c.type)&&s(g(c),c)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){Ve(this._disposers,this.name),this.signal([[H]],{internal:!0}),Ve(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){Ve(this._disposers,this.name),Ve(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:n,...r}=this.describe({detail:"full"}),s={};for(let a of Object.keys(r.nodes).sort()){let{lastMutation:u,guard:l,...d}=r.nodes[a];s[a]=d}let o=[...r.subgraphs].sort(),i={...r,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return Lt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,n){let r=n?.config??oe,{codec:s,codecVersion:o,payload:i}=$t(e,r);return s.decode(i,o)}restore(e,n){if(wn(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let r=n?.only==null?null:(Array.isArray(n.only)?n.only:[n.only]).map(o=>We(o)),s=n?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(r!==null&&!r.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&n?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let u=this.tryResolve(o)?.v;if(u!=null&&u.id===i.v.id&&u.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){n?.onError?.(o,a)}}}}}static fromSnapshot(e,n){wn(e);let r=typeof n=="function"?n:n?.build,s=typeof n=="function"?void 0:n?.factories,o=new t(e.name);if(r)return r(o),o.restore(e),o;for(let g of[...e.subgraphs].sort((c,b)=>{let f=c.split(P).length,x=b.split(P).length;return f!==x?f-x:c<b?-1:c>b?1:0})){let c=g.split(P),b=o;for(let f of c)b._mounts.has(f)||b.mount(f,new t(f)),b=b._mounts.get(f)}let i=s?Object.entries(s).map(([g,c])=>({re:We(g),factory:c})):[],a=g=>{for(let c of i)if(c.re.test(g))return c.factory},u=g=>{let c=g.split(P),b=c.pop();if(b==null||b.length===0)throw new Error(`invalid snapshot path "${g}"`);let f=o;for(let x of c){let m=f._mounts.get(x);if(!m)throw new Error(`unknown mount "${x}" in path "${g}"`);f=m}return[f,b]},l=Object.entries(e.nodes).filter(([g])=>!g.includes(`${P}${Q}${P}`)).sort((g,c)=>g[0]<c[0]?-1:g[0]>c[0]?1:0),d=new Map(l),h=new Map,y=!0;for(;d.size>0&&y;){y=!1;for(let[g,c]of[...d.entries()]){let b=c?.deps??[];if(!b.every(p=>h.has(p)))continue;let[f,x]=u(g),m={...c?.meta??{}},v=a(g),w;if(c?.type==="state")w=I(c.value,{meta:m});else{if(v==null)continue;w=v(x,{path:g,type:c.type,value:c.value,meta:m,deps:b,resolvedDeps:b.map(p=>h.get(p))})}f.add(w,{name:x}),h.set(g,w),d.delete(g),y=!0}}if(d.size>0){let g=[...d.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${g}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,n={}){let r=e.map(l=>({tier:l,debounceMs:Math.max(0,l.debounceMs??0),compactEvery:Math.max(1,l.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));n.autoRestore===!0&&this._cascadeRestore(e,n.onError);let s=(l,d)=>{if(l.disposed)return;let h=pr(d.nodes);if(l.lastSnapshot!=null&&h!==""&&h===l.lastFingerprint)return;let y=l.seq+1,g=Re(),f=l.lastSnapshot==null||y%l.compactEvery===0?{name:this.name,mode:"full",snapshot:d,seq:y,timestamp_ns:g,format_version:ke}:{name:this.name,mode:"diff",diff:kr(l.lastSnapshot,d),seq:y,timestamp_ns:g,format_version:ke};if(l.tier.filter&&!l.tier.filter(f))return;let x;try{x=l.tier.save(f)}catch(m){n.onError?.(m,l.tier);return}if(x&&typeof x.then=="function"){let w=(l.savePending??Promise.resolve()).then(()=>x,()=>x).then(()=>{l.disposed||(l.seq=y,l.lastSnapshot=d,l.lastFingerprint=h)},p=>{n.onError?.(p,l.tier)});l.savePending=w.finally(()=>{l.savePending===w&&(l.savePending=void 0)})}else l.seq=y,l.lastSnapshot=d,l.lastFingerprint=h},o=(l,d)=>{try{s(l,d)}catch(h){n.onError?.(h,l.tier)}},i=(l,d)=>{if(!d.some(c=>{let b=this.config.messageTier(c[0]);return b>=3&&b<5}))return;if(n.filter){let c=this.tryResolve(l);if(c==null)return;let b=_t(c,wt("standard"));if(!n.filter(l,b))return}let y,g=()=>(y==null&&(y=this.snapshot()),y);for(let c of r)c.disposed||(c.debounceMs===0?o(c,g()):(c.timer==null&&(c.timer=new $e),c.timer.start(c.debounceMs,()=>{c.disposed||o(c,this.snapshot())})))},a;if(n.paths!=null){let d=(typeof n.paths=="string"?this._pathsMatching(n.paths):n.paths).map(h=>{let y=this.tryResolve(h);return y==null?()=>{}:y.subscribe(g=>i(h,g))});a=()=>{for(let h of d)h()}}else a=this.observe().subscribe((l,d)=>i(l,d));let u=()=>{a();for(let l of r)l.disposed=!0,l.timer?.cancel();this._storageDisposers.delete(u)};return this._storageDisposers.add(u),{dispose:u}}async _cascadeRestore(e,n){for(let r of e){let s;try{s=await r.load?.()}catch(i){n?.(i,r);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===ke&&o.nodes!=null)return this.restore(o),!0}catch(i){n?.(i,r)}}return!1}static async fromStorage(e,n,r){for(let s of n){let o;try{o=await s.load?.()}catch(u){r?.onError?.(u,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===ke&&i.nodes!=null?i:void 0;if(a!=null)try{return t.fromSnapshot(a,r)}catch(u){r?.onError?.(u,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${n.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,n,r){if(e!=null&&n!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,n),this.config.inspectorEnabled){let s={path:e,annotation:n,timestamp_ns:j(),...r?.actor!=null?{actor:r.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let n=this._traceRing.toArray().filter(s=>!e(s)),r=this._traceRing.size-n.length;this._traceRing.clear();for(let s of n)this._traceRing.push(s);return r}static diff(e,n){let r=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(n.nodes)),o=[...s].filter(m=>!r.has(m)).sort(),i=[...r].filter(m=>!s.has(m)).sort(),a=[],u=[];for(let m of r){if(!s.has(m))continue;let v=e.nodes[m],w=n.nodes[m],p=v.v,_=w.v;p!=null&&_!=null&&p.id===_.id&&p.version!==_.version&&u.push({path:m,id:p.id,from:p.version,to:_.version});let k=p!=null&&_!=null&&p.id===_.id&&p.version===_.version;for(let T of["type","status","sentinel"]){let O=v[T],E=w[T];O!==E&&a.push({path:m,field:T,from:O,to:E})}if(!k)for(let T of["value","meta"]){let O=v[T],E=w[T];gr(O,E)||a.push({path:m,field:T,from:O,to:E})}}let l=m=>`${m.from} ${m.to}`,d=new Set(e.edges.map(l)),h=new Set(n.edges.map(l)),y=n.edges.filter(m=>!d.has(l(m))),g=e.edges.filter(m=>!h.has(l(m))),c=new Set(e.subgraphs),b=new Set(n.subgraphs),f=[...b].filter(m=>!c.has(m)).sort(),x=[...c].filter(m=>!b.has(m)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:u,edgesAdded:y,edgesRemoved:g,subgraphsAdded:f,subgraphsRemoved:x}}}});var Pr={};Ln(Pr,{CanvasMeasureAdapter:()=>rt,CliMeasureAdapter:()=>et,ImageSizeAdapter:()=>it,NodeCanvasMeasureAdapter:()=>st,PrecomputedAdapter:()=>nt,SvgBoundsAdapter:()=>ot,analyzeAndMeasure:()=>Te,carveTextLineSlots:()=>Rt,circleIntervalForBand:()=>Mn,computeBlockFlow:()=>An,computeCharPositions:()=>Ke,computeFlowLines:()=>Gn,computeLineBreaks:()=>Ue,computeTotalHeight:()=>Rn,layoutNextLine:()=>At,measureBlock:()=>En,measureBlocks:()=>Cn,reactiveBlockLayout:()=>Mr,reactiveFlowLayout:()=>Gr,reactiveLayout:()=>Rr,rectIntervalForBand:()=>Dn});module.exports=Bn(Pr);It();var et=class{cellPx;constructor(e){this.cellPx=e?.cellPx??8}measureSegment(e,n){return{width:Pt(e)*this.cellPx}}},tt=class extends Error{name="KeyError"},nt=class{metrics;fallback;constructor(e){this.metrics=e.metrics;let n=e.fallback??"per-char";if(n!=="per-char"&&n!=="error")throw new Error(`fallback must be 'per-char' or 'error', got ${JSON.stringify(e.fallback)}`);this.fallback=n}measureSegment(e,n){let r=this.metrics[n];if(r){let o=r[e];if(o!==void 0)return{width:o}}if(this.fallback==="error")throw new tt(`PrecomputedAdapter: no metrics for segment ${JSON.stringify(e)} in font ${JSON.stringify(n)}`);let s=0;if(r)for(let o of e){let i=r[o];i!==void 0&&(s+=i)}return{width:s}}},rt=class{ctx=null;currentFont="";emojiCorrection;constructor(e){this.emojiCorrection=e?.emojiCorrection??1}getContext(){if(!this.ctx){if(typeof OffscreenCanvas>"u")throw new Error("CanvasMeasureAdapter requires a browser environment with OffscreenCanvas support. Use CliMeasureAdapter or NodeCanvasMeasureAdapter for Node.js.");let n=new OffscreenCanvas(0,0).getContext("2d");if(!n)throw new Error("CanvasMeasureAdapter: failed to get 2d context");this.ctx=n}return this.ctx}measureSegment(e,n){let r=this.getContext();n!==this.currentFont&&(r.font=n,this.currentFont=n);let s=r.measureText(e).width;return this.emojiCorrection!==1&&new RegExp("\\p{Emoji_Presentation}","u").test(e)&&(s*=this.emojiCorrection),{width:s}}clearCache(){this.currentFont=""}},st=class{ctx=null;currentFont="";canvasModule;constructor(e){this.canvasModule=e}getContext(){if(!this.ctx){let n=this.canvasModule.createCanvas(0,0).getContext("2d");if(!n)throw new Error("NodeCanvasMeasureAdapter: failed to get 2d context");this.ctx=n}return this.ctx}measureSegment(e,n){let r=this.getContext();return n!==this.currentFont&&(r.font=n,this.currentFont=n),{width:r.measureText(e).width}}clearCache(){this.currentFont=""}},ot=class{measureSvg(e){let n=e.match(/viewBox\s*=\s*["']([^"']+)["']/);if(n){let o=n[1].trim().split(/[\s,]+/);if(o.length>=4){let i=Number.parseFloat(o[2]),a=Number.parseFloat(o[3]);if(Number.isFinite(i)&&Number.isFinite(a)&&i>0&&a>0)return{width:i,height:a};throw new Error("SvgBoundsAdapter: viewBox width/height are missing, non-finite, or not positive")}}let r=e.match(/<svg[^>]*\bwidth\s*=\s*["']?([\d.]+)/),s=e.match(/<svg[^>]*\bheight\s*=\s*["']?([\d.]+)/);if(r&&s){let o=Number.parseFloat(r[1]),i=Number.parseFloat(s[1]);if(Number.isFinite(o)&&Number.isFinite(i)&&o>0&&i>0)return{width:o,height:i};throw new Error("SvgBoundsAdapter: svg width/height attributes are non-finite or not positive")}throw new Error("SvgBoundsAdapter: cannot determine dimensions \u2014 SVG has no viewBox or width/height attributes")}},it=class{sizes;constructor(e){this.sizes=new Map(Object.entries(e))}measureImage(e){let n=this.sizes.get(e);if(!n)throw new Error(`ImageSizeAdapter: no dimensions registered for ${JSON.stringify(e)}`);return{width:n.width,height:n.height}}};ue();ne();_e();ze();Ge();we();ne();function ee(t,e){t!=null&&ye(n=>t.down(n),[[L,e]],oe.tierOf)}ue();ne();_e();ze();function Nr(t){for(let e of t){let n=e.codePointAt(0);if(n>=19968&&n<=40959||n>=13312&&n<=19903||n>=12288&&n<=12351||n>=12352&&n<=12447||n>=12448&&n<=12543||n>=44032&&n<=55215||n>=65280&&n<=65519)return!0}return!1}var On=new Set(["\uFF0C","\uFF0E","\uFF01","\uFF1A","\uFF1B","\uFF1F","\u3001","\u3002","\u30FB","\uFF09","\u3015","\u3009","\u300B","\u300D","\u300F","\u3011"]),Or=new Set([".",",","!","?",":",";",")","]","}","%",'"',"\u201D","\u2019","\xBB","\u203A","\u2026"]);function Sr(t){return t.replace(/[\t\n\r\f ]+/g," ").replace(/^ | $/g,"")}function Er(t){let e=new Intl.Segmenter(void 0,{granularity:"word"}),n=[];for(let r of e.segment(t)){let s=r.segment,o=r.isWordLike??!1,i=[],a=[],u=[],l="",d=null;for(let h of s){let y;h===" "?y="space":h==="\u200B"?y="zero-width-break":h==="\xAD"?y="soft-hyphen":h===`
4
- `?y="hard-break":y="text",d!==null&&y===d?l+=h:(d!==null&&(i.push(l),a.push(d==="text"&&o),u.push(d)),l=h,d=y)}d!==null&&(i.push(l),a.push(d==="text"&&o),u.push(d)),n.push({texts:i,isWordLike:a,kinds:u})}return n}function Te(t,e,n,r,s){let o=Sr(t);if(o.length===0)return[];let i=Er(o),a=new Intl.Segmenter(void 0,{granularity:"grapheme"}),u=[],l=[],d=[];for(let x of i)for(let m=0;m<x.texts.length;m++)u.push(x.texts[m]),l.push(x.kinds[m]),d.push(x.isWordLike[m]);let h=[],y=[],g=[];for(let x=0;x<u.length;x++){let m=u[x],v=l[x],w=d[x];if(v==="text"&&!w&&h.length>0&&y[y.length-1]==="text"&&m.length===1&&(Or.has(m)||On.has(m))){h[h.length-1]+=m;continue}if(m==="-"&&h.length>0&&y[y.length-1]==="text"&&g[g.length-1]){h[h.length-1]+=m;continue}h.push(m),y.push(v),g.push(w)}let c=r.get(e);c||(c=new Map,r.set(e,c));function b(x){let m=c.get(x);if(m===void 0){s&&(s.misses+=1);let v=n.measureSegment(x,e).width;m=Number.isFinite(v)&&v>=0?v:0,c.set(x,m)}else s&&(s.hits+=1);return m}let f=[];for(let x=0;x<h.length;x++){let m=h[x],v=y[x];if(v!=="text"){f.push({text:m,width:v==="space"?b(" ")*m.length:0,kind:v,graphemeWidths:null});continue}if(Nr(m)){let _="";for(let k of a.segment(m)){let T=k.segment;if(_.length>0&&On.has(T)){_+=T;continue}if(_.length>0){let O=b(_);f.push({text:_,width:O,kind:"text",graphemeWidths:null})}_=T}if(_.length>0){let k=b(_);f.push({text:_,width:k,kind:"text",graphemeWidths:null})}continue}let w=b(m),p=null;if(g[x]&&m.length>1){let _=[];for(let k of a.segment(m))_.push(b(k.segment));_.length>1&&(p=_)}f.push({text:m,width:w,kind:"text",graphemeWidths:p})}return f}function Ue(t,e,n,r,s){if(t.length===0)return{lines:[],lineCount:0};let o=[],i=0,a=!1,u=0,l=0,d=0,h=0,y=-1,g=0,c=s.get(r);c||(c=new Map,s.set(r,c));let b=c.get("-");b===void 0&&(b=n.measureSegment("-",r).width,c.set("-",b));function f(p=d,_=h,k=i){let T="";for(let O=u;O<p;O++){let E=t[O];if(!(E.kind==="soft-hyphen"||E.kind==="hard-break"))if(O===u&&l>0&&E.graphemeWidths){let C=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(E.text)].map(D=>D.segment);T+=C.slice(l).join("")}else T+=E.text}if(_>0&&p<t.length){let O=t[p],N=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(O.text)].map(D=>D.segment),C=u===p?l:0;T+=N.slice(C,_).join("")}p>0&&t[p-1]?.kind==="soft-hyphen"&&!(u===p&&l>0)&&(T+="-"),o.push({text:T,width:k,startSegment:u,startGrapheme:l,endSegment:p,endGrapheme:_}),i=0,a=!1,y=-1,g=0}function x(p){return p==="space"||p==="zero-width-break"||p==="soft-hyphen"}function m(p,_,k){a=!0,u=p,l=_,d=p+1,h=0,i=k}function v(p,_,k){a=!0,u=p,l=_,d=p,h=_+1,i=k}for(let p=0;p<t.length;p++){let _=t[p];if(_.kind==="hard-break"){a?f():o.push({text:"",width:0,startSegment:p,startGrapheme:0,endSegment:p,endGrapheme:0}),u=p+1,l=0;continue}let k=_.width;if(!a){k>e&&_.graphemeWidths?w(p,0,_.graphemeWidths):m(p,0,k),x(_.kind)&&(y=p+1,g=_.kind==="space"?i-k:i);continue}let T=i+k;if(T>e+.005){if(x(_.kind)){i+=k,d=p+1,h=0,f(p+1,0,_.kind==="space"?i-k:i);continue}if(y>=0){f(y,0,g),p--;continue}if(k>e&&_.graphemeWidths){f(),w(p,0,_.graphemeWidths);continue}f(),p--;continue}i=T,d=p+1,h=0,x(_.kind)&&(y=p+1,g=_.kind==="space"?i-k:i)}return a&&f(),{lines:o,lineCount:o.length};function w(p,_,k){for(let T=_;T<k.length;T++){let O=k[T];if(!a){v(p,T,O);continue}i+O>e+.005?(f(),v(p,T,O)):(i+=O,d=p,h=T+1)}a&&d===p&&h===k.length&&(d=p+1,h=0)}}function Et(t){return t==="space"||t==="zero-width-break"||t==="soft-hyphen"}var Ct=null;function Cr(){return Ct===null&&(Ct=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Ct}function Sn(t,e,n){if(e===0&&n<0)return t.text;let r=[...Cr().segment(t.text)].map(o=>o.segment),s=n<0?r.length:n;return r.slice(e,s).join("")}function ae(t,e,n,r,s,o){let i="";for(let a=e;a<r;a++){let u=t[a];u.kind==="soft-hyphen"||u.kind==="hard-break"||(a===e&&n>0?i+=Sn(u,n,-1):i+=u.text)}if(s>0&&r<t.length){let a=t[r];i+=Sn(a,e===r?n:0,s)}return o&&(i+="-"),i}function Ar(t){if(!t?.adapter||!t.font)return 0;let e=t.cache;if(e){let n=e.get(t.font);n||(n=new Map,e.set(t.font,n));let r=n.get("-");return r===void 0&&(r=t.adapter.measureSegment("-",t.font).width,n.set("-",r)),r}return t.adapter.measureSegment("-",t.font).width}function At(t,e,n,r){let s=e.segmentIndex,o=e.graphemeIndex;if(s>=t.length)return null;if(o===0){for(;s<t.length;){let p=t[s];if(p.kind==="hard-break")return{text:"",width:0,start:{segmentIndex:e.segmentIndex,graphemeIndex:0},end:{segmentIndex:s+1,graphemeIndex:0}};if(p.kind==="space"||p.kind==="zero-width-break"||p.kind==="soft-hyphen"){s+=1;continue}break}if(s>=t.length)return null}let i=Ar(r),a=s,u=s===e.segmentIndex?o:0,l=0,d=a,h=0,y=!1,g=-1,c=0,b=0,f=!1,x=(p,_,k,T)=>{g=p,c=_,b=k,f=T==="soft-hyphen"},m=(p,_,k)=>{for(let T=_;T<k.length;T++){let O=k[T];if(!y){l=O,d=p,h=T+1,y=!0;continue}if(l+O>n+.005)return!0;l+=O,d=p,h=T+1}return d===p&&h===k.length&&(d=p+1,h=0),!1};if(u>0&&a<t.length){let p=t[a];if(p.graphemeWidths){if(m(a,u,p.graphemeWidths))return{text:ae(t,a,u,d,h,!1),width:l,start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:d,graphemeIndex:h}};s=d}}for(;s<t.length;){let p=t[s];if(p.kind==="hard-break"){if(y){let T=d>0&&t[d-1]?.kind==="soft-hyphen";return{text:ae(t,a,u,d,h,T),width:l+(T?i:0),start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:d,graphemeIndex:h}}}return{text:"",width:0,start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:s+1,graphemeIndex:0}}}let _=p.width;if(!y){if(_>n&&p.graphemeWidths){if(m(s,0,p.graphemeWidths))return{text:ae(t,a,u,d,h,!1),width:l,start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:d,graphemeIndex:h}};s=d;continue}l=_,d=s+1,h=0,y=!0,Et(p.kind)&&x(s+1,0,p.kind==="space"?l-_:l,p.kind),s+=1;continue}let k=l+_;if(k>n+.005){if(Et(p.kind)){d=s+1,h=0;let O=p.kind==="soft-hyphen",E=p.kind==="space"?l:l+(O?i:0);return{text:ae(t,a,u,d,h,O),width:E,start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:d,graphemeIndex:h}}}return g>=0?{text:ae(t,a,u,g,c,f),width:b+(f?i:0),start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:g,graphemeIndex:c}}:_>n&&p.graphemeWidths?{text:ae(t,a,u,d,h,!1),width:l,start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:d,graphemeIndex:h}}:{text:ae(t,a,u,d,h,!1),width:l,start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:d,graphemeIndex:h}}}l=k,d=s+1,h=0,Et(p.kind)&&x(s+1,0,p.kind==="space"?l-_:l,p.kind),s+=1}if(!y)return null;let v=d>0&&t[d-1]?.kind==="soft-hyphen";return{text:ae(t,a,u,d,h,v),width:l+(v?i:0),start:{segmentIndex:a,graphemeIndex:u},end:{segmentIndex:d,graphemeIndex:h}}}function Rt(t,e,n=0){let r=[t];for(let s=0;s<e.length;s++){let o=e[s],i=[];for(let a=0;a<r.length;a++){let u=r[a];if(o.right<=u.left||o.left>=u.right){i.push(u);continue}o.left>u.left&&i.push({left:u.left,right:o.left}),o.right<u.right&&i.push({left:o.right,right:u.right})}r=i}return n>0?r.filter(s=>s.right-s.left>=n):r}function Ke(t,e,n){let r=[],s=new Intl.Segmenter(void 0,{granularity:"grapheme"});for(let o=0;o<t.lines.length;o++){let i=t.lines[o],a=o*n,u=0;for(let l=i.startSegment;l<e.length;l++){let d=e[l];if(d.kind==="soft-hyphen"||d.kind==="hard-break"){if(l>=i.endSegment&&i.endGrapheme===0)break;continue}let h=[...s.segment(d.text)].map(c=>c.segment);if(h.length===0)continue;let y=l===i.startSegment?i.startGrapheme:0,g;if(l<i.endSegment)g=h.length;else if(l===i.endSegment&&i.endGrapheme>0)g=i.endGrapheme;else break;for(let c=y;c<g;c++){let b=d.graphemeWidths?d.graphemeWidths[c]:d.width/h.length;r.push({x:u,y:a,width:b,height:n,line:o}),u+=b}}}return r}function Rr(t){let{adapter:e,name:n="reactive-layout"}=t,r=new re(n),s=new Map,o=I(t.text??"",{name:"text"}),i=I(t.font??"16px sans-serif",{name:"font"}),a=I(t.lineHeight??20,{name:"line-height"}),u=I(Math.max(0,t.maxWidth??800),{name:"max-width"});function l(c,b){if(c===null||b===null)return c===b;if(c.length!==b.length)return!1;for(let f=0;f<c.length;f++)if(c[f]!==b[f])return!1;return!0}let d=Z([o,i],(c,b,f)=>{let x=c[0],m=x!=null&&x.length>0?x.at(-1):f.prevData[0],v=c[1],w=v!=null&&v.length>0?v.at(-1):f.prevData[1],p=j(),_={hits:0,misses:0},k=Te(m,w,e,s,_),T=j()-p,O=_.hits+_.misses,E=O===0?1:_.hits/O,N=d.meta;N&&(ee(N["cache-hit-rate"],E),ee(N["segment-count"],k.length),ee(N["layout-time-ns"],T)),b.emit(k);let C=()=>{s.clear(),e.clearCache?.()};return{deactivate:C,invalidate:C}},{name:"segments",describeKind:"derived",meta:{"cache-hit-rate":0,"segment-count":0,"layout-time-ns":0},equals:(c,b)=>{let f=c,x=b;if(f==null||x==null)return f===x;if(f.length!==x.length)return!1;for(let m=0;m<f.length;m++){let v=f[m],w=x[m];if(v.text!==w.text||v.width!==w.width||v.kind!==w.kind||!l(v.graphemeWidths??null,w.graphemeWidths??null))return!1}return!0}}),h=z([d,u,i],([c,b,f])=>Ue(c,b,e,f,s),{name:"line-breaks",equals:(c,b)=>{let f=c,x=b;if(f==null||x==null)return f===x;if(f.lineCount!==x.lineCount)return!1;for(let m=0;m<f.lines.length;m++){let v=f.lines[m],w=x.lines[m];if(v.text!==w.text||v.width!==w.width||v.startSegment!==w.startSegment||v.startGrapheme!==w.startGrapheme||v.endSegment!==w.endSegment||v.endGrapheme!==w.endGrapheme)return!1}return!0}}),y=z([h,a],([c,b])=>c.lineCount*b,{name:"height"}),g=z([h,d,a],([c,b,f])=>Ke(c,b,f),{name:"char-positions",equals:(c,b)=>{let f=c,x=b;if(f==null||x==null)return f===x;if(f.length!==x.length)return!1;for(let m=0;m<f.length;m++)if(f[m].x!==x[m].x||f[m].y!==x[m].y||f[m].width!==x[m].width)return!1;return!0}});return r.add(o,{name:"text"}),r.add(i,{name:"font"}),r.add(a,{name:"line-height"}),r.add(u,{name:"max-width"}),r.add(d,{name:"segments"}),r.add(h,{name:"line-breaks"}),r.add(y,{name:"height"}),r.add(g,{name:"char-positions"}),{graph:r,setText:c=>r.set("text",c),setFont:c=>r.set("font",c),setLineHeight:c=>r.set("line-height",c),setMaxWidth:c=>r.set("max-width",Math.max(0,c)),segments:d,lineBreaks:h,height:y,charPositions:g}}function En(t,e,n,r,s,o,i){switch(t.type){case"text":{let a=t.font??s,u=t.lineHeight??o,l=Te(t.text,a,n.text,r),d=Ue(l,e,n.text,a,r),h=Ke(d,l,u),y=d.lineCount*u,g=0;for(let c of d.lines)c.width>g&&(g=c.width);return{index:i,type:"text",width:Math.min(g,e),height:y,textSegments:l,textLineBreaks:d,textCharPositions:h}}case"image":{let a,u;if(t.naturalWidth!=null&&t.naturalHeight!=null)a=t.naturalWidth,u=t.naturalHeight;else if(n.image){let l=n.image.measureImage(t.src);a=l.width,u=l.height}else throw new Error(`Image block at index ${i} has no naturalWidth/naturalHeight and no ImageMeasurer adapter`);return a>e&&(u=u*e/a,a=e),{index:i,type:"image",width:a,height:u}}case"svg":{let a,u;if(t.viewBox)a=t.viewBox.width,u=t.viewBox.height;else if(n.svg){let l=n.svg.measureSvg(t.content);a=l.width,u=l.height}else throw new Error(`SVG block at index ${i} has no viewBox and no SvgMeasurer adapter`);return a>e&&(u=u*e/a,a=e),{index:i,type:"svg",width:a,height:u}}}}function Cn(t,e,n,r,s,o){return t.map((i,a)=>En(i,e,n,r,s,o,a))}function An(t,e){let n=[],r=0;for(let s=0;s<t.length;s++){let o=t[s];n.push({...o,x:0,y:r}),r+=o.height+(s<t.length-1?e:0)}return n}function Rn(t){if(t.length===0)return 0;let e=t[t.length-1];return e.y+e.height}function Mr(t){let{adapters:e,name:n="reactive-block-layout",defaultFont:r="16px sans-serif",defaultLineHeight:s=20}=t,o=new re(n),i=new Map,a=I(t.blocks??[],{name:"blocks"}),u=I(Math.max(0,t.maxWidth??800),{name:"max-width"}),l=I(t.gap??0,{name:"gap"}),d=Z([a,u],(g,c,b)=>{let f=g[0]!=null&&g[0].length>0?g[0].at(-1):b.prevData[0],x=g[1]!=null&&g[1].length>0?g[1].at(-1):b.prevData[1],m=j(),v=Cn(f,x,e,i,r,s),w=j()-m,p=d.meta;p&&(ee(p["block-count"],v.length),ee(p["layout-time-ns"],w)),c.emit(v);let _=()=>{i.clear(),e.text.clearCache?.()};return{deactivate:_,invalidate:_}},{name:"measured-blocks",describeKind:"derived",meta:{"block-count":0,"layout-time-ns":0},equals:(g,c)=>{let b=g,f=c;if(b==null||f==null)return b===f;if(b.length!==f.length)return!1;for(let x=0;x<b.length;x++){let m=b[x],v=f[x];if(m.type!==v.type||m.width!==v.width||m.height!==v.height||m.index!==v.index)return!1}return!0}}),h=z([d,l],([g,c])=>An(g,c),{name:"block-flow",equals:(g,c)=>{let b=g,f=c;if(b==null||f==null)return b===f;if(b.length!==f.length)return!1;for(let x=0;x<b.length;x++){let m=b[x],v=f[x];if(m.x!==v.x||m.y!==v.y||m.width!==v.width||m.height!==v.height)return!1}return!0}}),y=z([h],([g])=>Rn(g),{name:"total-height"});return o.add(a,{name:"blocks"}),o.add(u,{name:"max-width"}),o.add(l,{name:"gap"}),o.add(d,{name:"measured-blocks"}),o.add(h,{name:"block-flow"}),o.add(y,{name:"total-height"}),{graph:o,setBlocks:g=>o.set("blocks",g),setMaxWidth:g=>o.set("max-width",Math.max(0,g)),setGap:g=>o.set("gap",g),measuredBlocks:d,blockFlow:h,totalHeight:y}}ue();ne();_e();ze();function Mn(t,e,n){let r=t.hPad??0,s=t.vPad??0,o=e-s,i=n+s;if(o>=t.cy+t.r||i<=t.cy-t.r)return null;let a=t.cy>=o&&t.cy<=i?0:t.cy<o?o-t.cy:t.cy-i;if(a>=t.r)return null;let u=Math.sqrt(t.r*t.r-a*a);return{left:t.cx-u-r,right:t.cx+u+r}}function Dn(t,e,n){let r=t.hPad??0,s=t.vPad??0;return n<=t.y-s||e>=t.y+t.h+s?null:{left:t.x-r,right:t.x+t.w+r}}function Dr(t,e,n){return t.kind==="circle"?Mn(t,e,n):Dn(t,e,n)}function Gn(t,e,n,r,s,o,i){let a=i?.paragraphSpacing??s,u=[],l={segmentIndex:0,graphemeIndex:0};if(t.length===0||n.count<=0||s<=0)return{lines:u,cursor:l};let d=e.paddingX??0,h=e.paddingY??0,y=Math.max(0,e.width-d*2),g=Math.max(0,e.height-h*2),c=n.gap*Math.max(0,n.count-1),b=Math.max(0,(y-c)/n.count);if(b<=0)return{lines:u,cursor:l};e:for(let f=0;f<n.count;f++){let x=d+f*(b+n.gap),m=x+b,v=h;for(;v+s<=h+g;){let w=v+s,p=[];for(let T=0;T<r.length;T++){let O=Dr(r[T],v,w);O!==null&&p.push(O)}let _=Rt({left:x,right:m},p,o);if(_.length===0){v+=s;continue}let k=!1;for(let T=0;T<_.length;T++){let O=_[T],E=O.right-O.left,N=At(t,l,E);if(N===null)return{lines:u,cursor:l};if(N.text.length===0&&N.width===0){l=N.end,k=!0;break}u.push({x:O.left,y:v,width:N.width,slotWidth:E,text:N.text,columnIndex:f,flushToRight:O.right<m-.5}),l=N.end}if(k){v+=a;continue}if(v+=s,l.segmentIndex>=t.length)break e}if(l.segmentIndex>=t.length)break}return{lines:u,cursor:l}}function Gr(t){let{adapter:e,name:n="reactive-flow-layout",minSlotWidth:r=20}=t,s=new re(n),o=new Map,i=I(t.text??"",{name:"text"}),a=I(t.font??"16px sans-serif",{name:"font"}),u=I(t.lineHeight??20,{name:"line-height"}),l=I(t.container??{width:800,height:600,paddingX:0,paddingY:0},{name:"container"}),d=I(t.columns??{count:1,gap:0},{name:"columns"}),h=I(t.obstacles??[],{name:"obstacles"}),y=I(t.paragraphSpacing??null,{name:"paragraph-spacing"}),g=Z([i,a],(b,f,x)=>{let m=b[0],v=m!=null&&m.length>0?m.at(-1):x.prevData[0],w=b[1],p=w!=null&&w.length>0?w.at(-1):x.prevData[1],_=Te(v,p,e,o);f.emit(_);let k=()=>{o.clear(),e.clearCache?.()};return{deactivate:k,invalidate:k}},{name:"segments",describeKind:"derived"}),c=z([g,l,d,h,u,y],([b,f,x,m,v,w])=>{let p=b,_=j(),k=w??v,{lines:T,cursor:O}=Gn(p,f,x,m,v,r,{paragraphSpacing:k}),E=j()-_,N=Math.max(0,p.length-O.segmentIndex),C=c.meta;return C&&(ee(C["line-count"],T.length),ee(C["layout-time-ns"],E),ee(C["overflow-segments"],N)),T},{name:"flow-lines",meta:{"line-count":0,"layout-time-ns":0,"overflow-segments":0},equals:(b,f)=>{let x=b,m=f;if(x.length!==m.length)return!1;for(let v=0;v<x.length;v++){let w=x[v],p=m[v];if(w.x!==p.x||w.y!==p.y||w.width!==p.width||w.slotWidth!==p.slotWidth||w.text!==p.text||w.columnIndex!==p.columnIndex||w.flushToRight!==p.flushToRight)return!1}return!0}});return s.add(i,{name:"text"}),s.add(a,{name:"font"}),s.add(u,{name:"line-height"}),s.add(l,{name:"container"}),s.add(d,{name:"columns"}),s.add(h,{name:"obstacles"}),s.add(y,{name:"paragraph-spacing"}),s.add(g,{name:"segments"}),s.add(c,{name:"flow-lines"}),{graph:s,setText:b=>s.set("text",b),setFont:b=>s.set("font",b),setLineHeight:b=>s.set("line-height",b),setContainer:b=>s.set("container",b),setColumns:b=>s.set("columns",b),setObstacles:b=>s.set("obstacles",b),setParagraphSpacing:b=>s.set("paragraph-spacing",b),segments:g,flowLines:c}}0&&(module.exports={CanvasMeasureAdapter,CliMeasureAdapter,ImageSizeAdapter,NodeCanvasMeasureAdapter,PrecomputedAdapter,SvgBoundsAdapter,analyzeAndMeasure,carveTextLineSlots,circleIntervalForBand,computeBlockFlow,computeCharPositions,computeFlowLines,computeLineBreaks,computeTotalHeight,layoutNextLine,measureBlock,measureBlocks,reactiveBlockLayout,reactiveFlowLayout,reactiveLayout,rectIntervalForBand});
@@ -1,7 +0,0 @@
1
- export { B as BlockAdapters, C as CanvasMeasureAdapter, a as CanvasMeasureAdapterOptions, b as CanvasModule, c as CircleObstacle, d as CliMeasureAdapter, e as CliMeasureAdapterOptions, f as ComputeFlowLinesOptions, g as ContentBlock, F as FlowColumns, h as FlowContainer, j as FlowLinesResult, I as ImageMeasurer, k as ImageSizeAdapter, M as MeasuredBlock, N as NodeCanvasMeasureAdapter, O as Obstacle, P as PositionedBlock, l as PositionedLine, m as PrecomputedAdapter, n as PrecomputedAdapterOptions, R as ReactiveBlockLayoutBundle, o as ReactiveBlockLayoutOptions, p as ReactiveFlowLayoutBundle, q as ReactiveFlowLayoutOptions, r as RectObstacle, S as SvgBoundsAdapter, s as SvgMeasurer, t as circleIntervalForBand, u as computeBlockFlow, v as computeFlowLines, w as computeTotalHeight, x as measureBlock, y as measureBlocks, z as reactiveBlockLayout, A as reactiveFlowLayout, D as rectIntervalForBand } from '../../index-Dc4AYqrJ.cjs';
2
- export { C as CharPosition, I as Interval, a as LayoutCursor, b as LayoutLine, c as LayoutNextLineContext, d as LayoutNextLineResult, L as LineBreaksResult, M as MeasurementAdapter, P as PreparedSegment, R as ReactiveLayoutBundle, e as ReactiveLayoutOptions, S as SegmentBreakKind, f as SegmentMeasureStats, g as analyzeAndMeasure, h as carveTextLineSlots, i as computeCharPositions, j as computeLineBreaks, l as layoutNextLine, r as reactiveLayout } from '../../reactive-layout-DgctbqZo.cjs';
3
- import '../../node-kK3CvTrR.cjs';
4
- import '../../graph-CWvEUQAq.cjs';
5
- import '../../sugar-DQjFmVqb.cjs';
6
- import '../../extra/storage-core.cjs';
7
- import '../../extra/storage-tiers.cjs';
@@ -1,7 +0,0 @@
1
- export { B as BlockAdapters, C as CanvasMeasureAdapter, a as CanvasMeasureAdapterOptions, b as CanvasModule, c as CircleObstacle, d as CliMeasureAdapter, e as CliMeasureAdapterOptions, f as ComputeFlowLinesOptions, g as ContentBlock, F as FlowColumns, h as FlowContainer, j as FlowLinesResult, I as ImageMeasurer, k as ImageSizeAdapter, M as MeasuredBlock, N as NodeCanvasMeasureAdapter, O as Obstacle, P as PositionedBlock, l as PositionedLine, m as PrecomputedAdapter, n as PrecomputedAdapterOptions, R as ReactiveBlockLayoutBundle, o as ReactiveBlockLayoutOptions, p as ReactiveFlowLayoutBundle, q as ReactiveFlowLayoutOptions, r as RectObstacle, S as SvgBoundsAdapter, s as SvgMeasurer, t as circleIntervalForBand, u as computeBlockFlow, v as computeFlowLines, w as computeTotalHeight, x as measureBlock, y as measureBlocks, z as reactiveBlockLayout, A as reactiveFlowLayout, D as rectIntervalForBand } from '../../index-B5S8ULbU.js';
2
- export { C as CharPosition, I as Interval, a as LayoutCursor, b as LayoutLine, c as LayoutNextLineContext, d as LayoutNextLineResult, L as LineBreaksResult, M as MeasurementAdapter, P as PreparedSegment, R as ReactiveLayoutBundle, e as ReactiveLayoutOptions, S as SegmentBreakKind, f as SegmentMeasureStats, g as analyzeAndMeasure, h as carveTextLineSlots, i as computeCharPositions, j as computeLineBreaks, l as layoutNextLine, r as reactiveLayout } from '../../reactive-layout-DOTs9P3X.js';
3
- import '../../node-kK3CvTrR.js';
4
- import '../../graph-D9LFnda9.js';
5
- import '../../sugar-fhLIE7TT.js';
6
- import '../../extra/storage-core.js';
7
- import '../../extra/storage-tiers.js';
@@ -1 +0,0 @@
1
- import{a as g,b as h,c as i,d as j,e as k,f as l,g as m,h as n,i as o,j as p,k as q,l as r,m as s,n as t,o as u}from"../../chunk-TK3NWWD4.js";import{a,b,c,d,e,f}from"../../chunk-DHRX7JX4.js";import"../../chunk-7LIAPXJB.js";import"../../chunk-C72GO4IZ.js";import"../../chunk-HITNVN6B.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-GHBWHMRZ.js";import"../../chunk-CRVT7D2P.js";import"../../chunk-NTEURFZH.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{i as CanvasMeasureAdapter,g as CliMeasureAdapter,l as ImageSizeAdapter,j as NodeCanvasMeasureAdapter,h as PrecomputedAdapter,k as SvgBoundsAdapter,a as analyzeAndMeasure,d as carveTextLineSlots,r as circleIntervalForBand,o as computeBlockFlow,e as computeCharPositions,t as computeFlowLines,b as computeLineBreaks,p as computeTotalHeight,c as layoutNextLine,m as measureBlock,n as measureBlocks,q as reactiveBlockLayout,u as reactiveFlowLayout,f as reactiveLayout,s as rectIntervalForBand};
@@ -1,3 +0,0 @@
1
- "use strict";var Ye=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var wn=Object.getOwnPropertyNames;var Tn=Object.prototype.hasOwnProperty;var I=(n,e)=>()=>(n&&(e=n(n=0)),e);var _n=(n,e)=>{for(var t in e)Ye(n,t,{get:e[t],enumerable:!0})},Nn=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of wn(e))!Tn.call(n,s)&&s!==t&&Ye(n,s,{get:()=>e[s],enumerable:!(r=vn(e,s))||r.enumerable});return n};var On=n=>Nn(Ye({},"__esModule",{value:!0}),n);function Ae(){return le>0||Te}function Nt(){return le>0}function pe(n){le>0?_e.push(n):n()}function Ne(n){le+=1;let e=!1;try{n()}catch(t){throw e=!0,t}finally{if(le-=1,le===0)if(e){if(!Te){let t=_e.splice(0);for(let r of t)try{r()}catch{}re.length=0,se.length=0,fe.length=0}}else xn()}}function xn(){let n=!Te;n&&(Te=!0);let e=[],t=0;try{for(;re.length>0||se.length>0||fe.length>0||n&&_e.length>0;){if(n&&_e.length>0){let o=_e.splice(0);for(let i of o)try{i()}catch(a){e.push(a)}continue}if(t+=1,t>1e3)throw re.length=0,se.length=0,fe.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let s=(re.length>0?re:se.length>0?se:fe).splice(0);for(let o of s)try{o()}catch(i){e.push(i)}}}finally{n&&(Te=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function Se(n,e,t){if(e.length===0)return;if(e.length===1){let d=t(e[0][0]);if(d<3||!Ae()){n(e);return}(d>=5?fe:d===4?se:re).push(()=>n(e));return}let r=e.length,s=r,o=r,i=r,a=0;for(;a<r&&t(e[a][0])<3;)a++;for(s=a;a<r&&t(e[a][0])===3;)a++;for(o=a;a<r&&t(e[a][0])===4;)a++;i=a;let u=Ae();if(s>0){let d=e.slice(0,s);n(d)}if(o>s){let d=e.slice(s,o);u?re.push(()=>n(d)):n(d)}if(i>o){let d=e.slice(o,i);u?se.push(()=>n(d)):n(d)}if(r>i){let d=e.slice(i,r);u?fe.push(()=>n(d)):n(d)}}var le,Te,re,se,fe,_e,De=I(()=>{"use strict";le=0,Te=!1,re=[],se=[],fe=[],_e=[]});var oe,M,U,W,K,J,Q,V,G,E,he,Je,kn,Xe,En,Rn,Ze,Ot,xt,kt,Qe,ee=I(()=>{"use strict";oe=Symbol.for("graphrefly/START"),M=Symbol.for("graphrefly/DATA"),U=Symbol.for("graphrefly/DIRTY"),W=Symbol.for("graphrefly/RESOLVED"),K=Symbol.for("graphrefly/INVALIDATE"),J=Symbol.for("graphrefly/PAUSE"),Q=Symbol.for("graphrefly/RESUME"),V=Symbol.for("graphrefly/TEARDOWN"),G=Symbol.for("graphrefly/COMPLETE"),E=Symbol.for("graphrefly/ERROR"),he=Object.freeze([U]),Je=Object.freeze([W]),kn=Object.freeze([K]),Xe=Object.freeze([oe]),En=Object.freeze([G]),Rn=Object.freeze([V]),Ze=Object.freeze([he]),Ot=Object.freeze([Je]),xt=Object.freeze([kn]),kt=Object.freeze([En]),Qe=Object.freeze([Rn])});function Rt(n,e){let t=new TextEncoder().encode(n.name);if(t.length===0||t.length>255)throw new Error(`encodeEnvelope: codec name "${n.name}" encodes to ${t.length} bytes (must be 1\u2013255)`);let r=n.version;if(!Number.isInteger(r)||r<0||r>65535)throw new Error(`encodeEnvelope: codec.version ${r} out of u16 range (expected integer 0\u201365535)`);let s=2+t.length+2+e.length;if(s>4294967295)throw new Error(`encodeEnvelope: total envelope size ${s} exceeds 2^32-1 bytes (payload ${e.length} bytes)`);let o=new Uint8Array(s),i=0;return o[i++]=et,o[i++]=t.length,o.set(t,i),i+=t.length,o[i++]=r>>>8&255,o[i++]=r&255,o.set(e,i),o}function At(n,e){if(n.length<Et)throw new Error(`decodeEnvelope: bytes too short (${n.length} < ${Et})`);let t=0,r=n[t++];if(r!==et)throw new Error(`decodeEnvelope: unsupported envelope version ${r} (expected ${et})`);let s=n[t++];if(s===0)throw new Error("decodeEnvelope: name_len must be >= 1");if(t+s+2>n.length)throw new Error(`decodeEnvelope: envelope truncated (need ${t+s+2} bytes, have ${n.length})`);let o=new TextDecoder().decode(n.subarray(t,t+s));t+=s;let i=(n[t]<<8|n[t+1])>>>0;t+=2;let a=n.subarray(t),u=e.lookupCodec(o);if(u==null)throw new Error(`decodeEnvelope: codec "${o}" not registered (envelope codec_v=${i})`);return{codec:u,codecVersion:i,payload:a}}function St(n){n.registerCodec(An)}var An,et,Et,tt=I(()=>{"use strict";An={name:"json",version:1,contentType:"application/json",encode(n){let e=JSON.stringify(n);return new TextEncoder().encode(e)},decode(n,e){let t=new TextDecoder().decode(n);return JSON.parse(t)}},et=1,Et=4});function Ce(n){if(n==null)return ge;let{type:e,id:t,...r}=n;return{type:e??"system",id:t??"",...r}}var ge,nt=I(()=>{"use strict";ge={type:"system",id:""}});function Z(){return Math.trunc(performance.now()*1e6)}function Me(){return Date.now()*1e6}var Ge=I(()=>{"use strict"});function Dt(n){n.registerMessageType(oe,{tier:0,wireCrossing:!1}),n.registerMessageType(U,{tier:1,wireCrossing:!1}),n.registerMessageType(K,{tier:1,wireCrossing:!1,metaPassthrough:!1}),n.registerMessageType(J,{tier:2,wireCrossing:!1}),n.registerMessageType(Q,{tier:2,wireCrossing:!1}),n.registerMessageType(M,{tier:3,wireCrossing:!0}),n.registerMessageType(W,{tier:3,wireCrossing:!0}),n.registerMessageType(G,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(E,{tier:4,wireCrossing:!0,metaPassthrough:!1}),n.registerMessageType(V,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var Pe,Ct=I(()=>{"use strict";ee();Pe=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=t=>{let r=this._messageTypes.get(t);return r!=null?r.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,t){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:t.tier,wireCrossing:t.wireCrossing??t.tier>=3,metaPassthrough:t.metaPassthrough??!0}),this}messageTier(e){let t=this._messageTypes.get(e);return t!=null?t.tier:1}isWireCrossing(e){let t=this._messageTypes.get(e);return t!=null?t.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let t=this._messageTypes.get(e);return t!=null?t.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});function Mt(n){return Array.isArray(n)?[...n]:[n]}function Sn(n,e){return n.has(e)||n.has("*")}function Gt(n){let e=[];return n((s,o)=>{e.push({kind:"allow",actions:new Set(Mt(s)),where:o?.where??(()=>!0)})},(s,o)=>{e.push({kind:"deny",actions:new Set(Mt(s)),where:o?.where??(()=>!0)})}),(s,o)=>{let i=!1,a=!1;for(let u of e)Sn(u.actions,o)&&u.where(s)&&(u.kind==="deny"?i=!0:a=!0);return i?!1:a}}function rt(n){let e=Dn.filter(t=>n({type:t,id:""},"write"));return e.length===0?"restricted":e.includes("human")&&e.includes("llm")&&e.every(t=>t==="human"||t==="llm"||t==="system")?"both":e.length===1?e[0]:e.join("+")}var q,Dn,Oe=I(()=>{"use strict";q=class extends Error{actor;action;nodeName;constructor(e,t){super(t??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}};Dn=["human","llm","wallet","system"]});function st(n){if(n===void 0)return null;if(typeof n=="number"){if(!Number.isFinite(n))throw new TypeError(`Cannot hash non-finite number: ${n}`);if(Number.isInteger(n)&&!Number.isSafeInteger(n))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${n}. Cross-language cid parity is not guaranteed for unsafe integers.`);return n}if(typeof n=="string"||typeof n=="boolean"||n===null)return n;if(Array.isArray(n))return n.map(st);if(typeof n=="object"&&n!==null){let e={};for(let t of Object.keys(n).sort())e[t]=st(n[t]);return e}return null}function Gn(n){let e=Mn.encode(n),t=e.length,r=t*8,s=t+9+63&-64,o=new Uint8Array(s);o.set(e),o[t]=128;let i=new DataView(o.buffer);i.setUint32(s-4,r>>>0,!1),i.setUint32(s-8,Math.floor(r/4294967296)>>>0,!1);let a=1779033703,u=3144134277,d=1013904242,l=2773480762,p=1359893119,h=2600822924,f=528734635,c=1541459225,m=new Uint32Array(64),g=(y,b)=>y>>>b|y<<32-b;for(let y=0;y<s;y+=64){for(let N=0;N<16;N++)m[N]=i.getUint32(y+N*4,!1);for(let N=16;N<64;N++){let j=m[N-15],$=m[N-2],D=g(j,7)^g(j,18)^j>>>3,ce=g($,17)^g($,19)^$>>>10;m[N]=m[N-16]+D+m[N-7]+ce>>>0}let b=a,v=u,w=d,O=l,x=p,k=h,R=f,A=c;for(let N=0;N<64;N++){let j=g(x,6)^g(x,11)^g(x,25),$=x&k^~x&R,D=A+j+$+Cn[N]+m[N]>>>0,ce=g(b,2)^g(b,13)^g(b,22),He=b&v^b&w^v&w,Ee=ce+He>>>0;A=R,R=k,k=x,x=O+D>>>0,O=w,w=v,v=b,b=D+Ee>>>0}a=a+b>>>0,u=u+v>>>0,d=d+w>>>0,l=l+O>>>0,p=p+x>>>0,h=h+k>>>0,f=f+R>>>0,c=c+A>>>0}let T=y=>y.toString(16).padStart(8,"0");return T(a)+T(u)+T(d)+T(l)+T(p)+T(h)+T(f)+T(c)}function ot(n){let e=st(n??null),t=JSON.stringify(e);return Gn(t).slice(0,16)}function Pn(){let n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),t=e()+e()+e()+e();return`${t.slice(0,8)}-${t.slice(8,12)}-4${t.slice(13,16)}-${(parseInt(t.slice(16,17),16)&3|8).toString(16)}${t.slice(17,20)}-${t.slice(20,32)}`}function it(n,e,t){let r=t?.id??Pn();if(n===0)return{id:r,version:0};let o=(t?.hash??ot)(e);return{id:r,version:0,cid:o,prev:null}}function Pt(n,e,t){n.version+=1,"cid"in n&&(n.prev=n.cid,n.cid=t(e))}var Cn,Mn,It=I(()=>{"use strict";Cn=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 Lt(n){return{node:n,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function at(n){n.prevData=void 0,n.dirty=!1,n.involvedThisWave=!1,n.dataBatch.length=0,n.terminal=void 0}function Ie(n){return n.length===0?n:typeof n[0]=="symbol"?[n]:n}function ie(n,e,t){let r=Vt(n)?n:[],s=typeof n=="function"?n:typeof e=="function"?e:void 0,o={};return Vt(n)?o=(ut(e)?e:t)??{}:ut(n)?o=n:o=(ut(e)?e:t)??{},new F(r,s,o)}var $t,Ft,In,$n,me,F,Vt,ut,be=I(()=>{"use strict";tt();nt();De();Ge();Ct();Oe();ee();It();$t=()=>{},Ft=100;In=(n,e,t,r)=>{t.direction==="down-in"&&n._onDepMessage(t.depIndex,e)},$n=(n,e,t,r)=>{let s=n;if(s._status==="completed"||s._status==="errored")return;let o=s._cached,i=o===void 0?[Xe]:[Xe,[M,o]];s._status==="dirty"&&i.push(he),Se(e,i,s._config.tierOf)},me=new Pe({onMessage:In,onSubscribe:$n});Dt(me);St(me);F=class n{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,t,r){this._config=r.config??me,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??ot;let s=r.versioning??this._config.defaultVersioning;this._versioningLevel=s,this._versioning=s!=null?it(s,this._cached===void 0?void 0:this._cached,{id:r.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(Lt);let o={};for(let[a,u]of Object.entries(r.meta??{})){let d={initial:u,name:`${r.name??"node"}:meta:${a}`,describeKind:"state",config:this._config};r.guard!=null&&(d.guard=r.guard),r.resubscribable===!0&&(d.resubscribable=!0),o[a]=new n([],void 0,d)}Object.freeze(o),this.meta=o,this._hasMeta=Object.keys(o).length>0;let i=this;this._actions={emit(a){i._emit([[M,a]])},down(a){i._emit(Ie(a))},up(a){i._emitUp(Ie(a))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,t){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let r=this._versioningLevel;if(r!=null&&e<=r)return;let s=t?.hash??this._hashFn;s!==this._hashFn&&(this._hashFn=s);let o=this._cached===void 0?void 0:this._cached,i=this._versioning,a=i?.id??t?.id,u=i?.version??0,d=it(e,o,{id:a,hash:s});d.version=u,this._versioning=d,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let t=Ce(e);if(this._guard!=null&&!this._guard(t,"observe"))return!1;if(this._extraGuards!=null){for(let r of this._extraGuards)if(!r(t,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let t=this._guard!=null||this._extraGuards!=null,r=e?.actor!=null;if(!t&&!r)return;let s=Ce(e?.actor),o=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(s,o))throw new q({actor:s,action:o,nodeName:this.name});if(this._extraGuards!=null){for(let i of this._extraGuards)if(!i(s,o))throw new q({actor:s,action:o,nodeName:this.name})}this._lastMutation={actor:s,timestamp_ns:Me()}}down(e,t){let r=Ie(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=Ie(e);if(r.length===0)return;this._checkGuard(t);let s=t??{internal:!0};this._validateUpTiers(r);for(let o of this._deps)o.node.up?.(r,s)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let t of this._deps)t.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let t=this._config.tierOf;for(let r of e){let s=t(r[0]);if(s===3||s===4)throw new Error(`Node "${this.name}": tier-${s} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,t){if(t!=null&&this._guard!=null){let u=Ce(t);if(!this._guard(u,"observe"))throw new q({actor:u,action:"observe",nodeName:this.name})}let s=this._isTerminal&&this._resubscribable;if(s){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let u of this._deps)at(u);if(this._partial===!1){for(let u of this._deps)if(u.prevData!==void 0||u.dataBatch.length!==0||u.terminal!==void 0||u.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let o;try{o=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:s},this._actions)}catch(u){throw this._sinkCount-=1,u}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let i=this._isTerminal;if(this._sinkCount===1&&!i)try{this._activate()}catch(u){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof o=="function")try{o()}catch{}throw u}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let a=!1;return()=>{a||(a=!0,this._sinkCount-=1,this._removeSink(e),typeof o=="function"&&o(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[t]=this._sinks;this._sinks=t}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,t=0;try{for(let r=0;r<e;r++){let s=r,o=this._deps[r];o.unsub=$t,o.unsub=o.node.subscribe(i=>{if(o.unsub===null)return;let a=this._config.tierOf,u=!1;for(let d of i)a(d[0])>=3&&(u=!0),this._config.onMessage(this,d,{direction:"down-in",depIndex:s},this._actions);u&&this._maybeRunFnOnSettlement()}),t++}}catch(r){this._deps[t].unsub=null;for(let s=0;s<t;s++){let o=this._deps[s];if(o.unsub!=null){let i=o.unsub;o.unsub=null;try{i()}catch{}at(o)}}throw this._dirtyDepCount=0,r}}_addDep(e){for(let s=0;s<this._deps.length;s++)if(this._deps[s].node===e)return s;let t=this._deps.length,r=Lt(e);if(this._deps.push(r),this._sinks==null)return t;r.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ze),r.unsub=$t;try{r.unsub=e.subscribe(s=>{if(r.unsub===null)return;let o=this._config.tierOf,i=!1;for(let a of s)o(a[0])>=3&&(i=!0),this._config.onMessage(this,a,{direction:"down-in",depIndex:t},this._actions);i&&this._maybeRunFnOnSettlement()})}catch(s){throw r.unsub=null,this._deps.pop(),this._dirtyDepCount--,s}return t}_deactivate(e=!1){let t=this._cleanup;if(this._cleanup=void 0,typeof t=="function")try{t()}catch(r){this._emit([[E,this._wrapFnError("cleanup threw",r)]])}else if(t!=null&&typeof t=="object"){let r=t.deactivate;if(typeof r=="function")try{r()}catch(s){this._emit([[E,this._wrapFnError("cleanup.deactivate threw",s)]])}}for(let r of this._deps){if(r.unsub!=null){let s=r.unsub;r.unsub=null;try{s()}catch{}}at(r)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,t){let r=this._deps[e],s=t[0];if(this._inspectorHooks!=null){let o={kind:"dep_message",depIndex:e,message:t};for(let i of this._inspectorHooks)i(o)}if(s!==oe){if(s===U){this._depDirtied(r);return}if(s===K){if(this._depInvalidated(r),this._cached===void 0)return;this._emit(xt);return}if(s===J||s===Q){this._emit([t]);return}if(s===V){this._emit(Qe);return}if(s===M)this._depSettledAsData(r,t[1]);else if(s===W)this._depSettledAsResolved(r);else if(s===G)this._depSettledAsTerminal(r,!0);else if(s===E)this._depSettledAsTerminal(r,t[1]);else{this._emit([t]);return}if(!this._fn){(s===M||s===W)&&this._emit([t]),(s===G||s===E)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(Ze))}_depSettledAsData(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(t),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,t){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=t,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let t=this._deps[e];if(t.dataBatch.length===0&&t.prevData===void 0&&t.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(Ot),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(t=>t.terminal!==void 0&&t.terminal!==!0);if(e!=null){this._autoError&&this._emit([[E,e.terminal]]);return}this._autoComplete&&this._deps.every(t=>t.terminal!==void 0)&&this._emit(kt)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(i){this._emit([[E,this._wrapFnError("cleanup threw",i)]]);return}}else if(e!=null&&typeof e=="object"){let i=e.beforeRun;if(typeof i=="function"){e.beforeRun=void 0;try{i()}catch(a){this._emit([[E,this._wrapFnError("cleanup.beforeRun threw",a)]]);return}}}let t=this._deps.map(i=>i.involvedThisWave?i.dataBatch.length>0?[...i.dataBatch]:[]:void 0),r=this._deps.map(i=>i.prevData);for(let i=0;i<this._deps.length;i++){let a=t[i];a!=null&&a.length>0&&(this._deps[i].prevData=a[a.length-1])}let s=this._deps.map(i=>i.terminal),o={prevData:r,terminalDeps:s,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let i={kind:"run",batchData:t,prevData:r};for(let a of this._inspectorHooks)a(i)}this._isExecutingFn=!0;try{let i=this._fn(t,this._actions,o);if(typeof i=="function")this._cleanup=i;else if(i!=null&&typeof i=="object"){let a=i;(typeof a.beforeRun=="function"||typeof a.deactivate=="function"||typeof a.invalidate=="function")&&(this._cleanup=i)}}catch(i){this._emit([[E,this._wrapFnError("fn threw",i)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>Ft?(this._rerunDepth=0,this._emit([[E,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${Ft} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,t){let 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"?[he,e[0]]:e;let r=!0,s=!1,o=!1,i=-1;for(let u of e){let d=t(u[0]);d<i&&(r=!1),d===3&&(s=!0),u[0]===U&&(o=!0),i=d}let a=e;if(!r){let u=e.map((d,l)=>({m:d,i:l,tier:t(d[0])}));u.sort((d,l)=>d.tier-l.tier||d.i-l.i),a=u.map(d=>d.m)}if(s&&!o&&this._status!=="dirty"){let u=0;for(;u<a.length&&t(a[u][0])===0;)u++;return u===0?[he,...a]:[...a.slice(0,u),he,...a.slice(u)]}return a}_emit(e){if(e.length===0)return;for(let a=0;a<e.length;a++){let u=e[a];if(u[0]===E&&u[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let t=e;if(this._isTerminal&&!this._resubscribable){let a=e.filter(u=>u[0]===V||u[0]===K);if(a.length===0)return;t=a}t=this._frameBatch(t);let s=null;for(let a=0;a<t.length;a++){let u=t[a],d=u[0];if(d!==J&&d!==Q){s?.push(u);continue}if(u.length<2)throw new Error(`Node "${this.name}": [[${d===J?"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 p=u[1];if(d===J)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))l=!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())}}l?s?.push(u):s==null&&(s=t.slice(0,a))}if(s!=null){if(s.length===0)return;t=s}if(this._hasMeta&&t.some(a=>a[0]===V))for(let a of Object.keys(this.meta))try{this.meta[a]._emit(Qe)}catch{}let{finalMessages:o,equalsError:i}=this._updateState(t);if(o.length>0&&this._config.inspectorEnabled){let a=this._config.globalInspector;if(a!=null)try{a({kind:"emit",node:this,messages:o})}catch{}}if(o.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let a=this._config.tierOf,u=[];for(let d of o)a(d[0])===3?this._pauseBuffer.push(d):u.push(d);u.length>0&&this._dispatchOrAccumulate(u)}else this._dispatchOrAccumulate(o);i!=null&&this._emit([[E,i]])}_updateState(e){let t=this._config.tierOf,r,s,o=-1,i=0;for(let l of e)t(l[0])===3&&i++;let a=i<=1,u=-1;if(this._versioning!=null&&i>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 p=e[l],h=p[0];if(h===M){if(p.length>=2){let f=!1;if(a&&this._cached!==void 0)try{f=this._equals(this._cached,p[1])}catch(c){s=this._wrapFnError("equals threw",c),o=l;break}if(f){r==null&&(r=e.slice(0,l)),r.push(Je),this._status="resolved";continue}this._cached=p[1],this._versioning!=null&&(u<0||l===u)&&Pt(this._versioning,p[1],this._hashFn)}this._status="settled",r?.push(p)}else if(r?.push(p),h===U)this._status="dirty";else if(h===W)this._status="resolved";else if(h===G){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===E){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===K){if(this._cached!==void 0){let c=this._config.rigorRecorder;if(c!=null)try{c.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let c=f.invalidate;if(typeof c=="function")try{c()}catch{}}}else h===V&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let d=o>=0?r??e.slice(0,o):r??e;return s!=null?{finalMessages:d,equalsError:s}:{finalMessages:d}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let t=[...this._sinks];for(let r of t)r(e)};_dispatchOrAccumulate(e){if(Nt()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],pe(()=>this._flushBatchPending()));for(let t of e)this._batchPendingMessages.push(t);return}Se(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);Se(this._deliverToSinks,t,this._config.tierOf)}},Vt=n=>Array.isArray(n),ut=n=>typeof n=="object"&&n!=null&&!Array.isArray(n)});function te(n,e){return ie([],{...e,initial:n})}function X(n,e){return ie((r,s,o)=>n(s,o)??void 0,{describeKind:"producer",...e})}function ae(n,e,t){return ie(n,(s,o,i)=>{let a=s.map((u,d)=>u!=null&&u.length>0?u.at(-1):i.prevData[d]);o.emit(e(a,i))},{describeKind:"derived",...t})}function $e(n,e,t){return ie(n,(s,o,i)=>{let a=s.map((u,d)=>u!=null&&u.length>0?u.at(-1):i.prevData[d]);return e(a,o,i)??void 0},{describeKind:"effect",...t})}var xe=I(()=>{"use strict";be()});function dt(n,e){if(e!=null&&e.length>0)return new Set(e);switch(n){case"standard":return new Set(["type","status","value","deps","meta","v"]);case"full":return null;case"spec":return new Set(["type","deps","meta","value"]);default:return new Set(["type","deps"])}}function Fn(n){return n._describeKind!=null?n._describeKind:n._deps.length>0?"derived":n._fn!=null?"producer":"state"}function ct(n,e){let t={factory:n};return e!==void 0&&(t.factoryArgs=e),t}function Ln(n){let e={};for(let[t,r]of Object.entries(n.meta))try{e[t]=r.cache}catch{}return e}function lt(n,e,t){let r=e==null,s=!r&&e!=null?[...e].filter(l=>l.startsWith("meta.")).map(l=>l.slice(5)):null,o=r||e.has("meta")||s!=null&&s.length>0,i="state",a=[];n instanceof F&&(i=Fn(n),a=n._deps.map(l=>l.node.name??""));let u={type:i,deps:a};(r||e.has("status"))&&(u.status=n.status);let d=n instanceof F?n._guard:void 0;if(o){let l={...Ln(n)};if(d!=null&&l.access===void 0&&(l.access=rt(d)),s!=null&&s.length>0&&!e.has("meta")){let p={};for(let h of s)h in l&&(p[h]=l[h]);u.meta=p}else u.meta=l}if(n.name!=null&&(u.name=n.name),(r||e.has("value"))&&(!t||i==="state")){n.status==="sentinel"&&(u.sentinel=!0);try{u.value=n.cache}catch{}}if((r||e.has("v"))&&n.v!=null){let l={id:n.v.id,version:n.v.version};"cid"in n.v&&(l.cid=n.v.cid,l.prev=n.v.prev),u.v=l}return(r||e.has("guard"))&&d!=null&&(u.guard=rt(d)),(r||e.has("lastMutation"))&&n.lastMutation!=null&&(u.lastMutation=n.lastMutation),u}var ft=I(()=>{"use strict";Oe();be()});function pt(n){return{describeKind:"producer",...n}}function jt(n,e){return X(t=>{let r=!1;try{for(let s of n){if(r)return;t.emit(s)}r||t.down([[G]])}catch(s){r||t.down([[E,s]])}return()=>{r=!0}},pt(e))}function Vn(n){return n!=null&&typeof n.then=="function"}function jn(n,e){let{signal:t,...r}=e??{};return X(s=>{let o=!1,i=()=>{o||(o=!0,s.down([[E,t.reason]]))};if(t?.aborted){i();return}return t?.addEventListener("abort",i,{once:!0}),Promise.resolve(n).then(a=>{o||(o=!0,t?.removeEventListener("abort",i),s.emit(a),s.down([[G]]))},a=>{o||(o=!0,t?.removeEventListener("abort",i),s.down([[E,a]]))}),()=>{o=!0,t?.removeEventListener("abort",i)}},pt(r))}function Bn(n,e){let{signal:t,...r}=e??{};return X(s=>{let o=new AbortController,i=()=>o.abort(t?.reason);t?.aborted?o.abort(t.reason):t?.addEventListener("abort",i,{once:!0});let a=t??o.signal,u=!1,d=n[Symbol.asyncIterator](),l=()=>{u||a.aborted||Promise.resolve(d.next()).then(p=>{if(!(u||a.aborted)){if(p.done){s.down([[G]]);return}s.emit(p.value),l()}},p=>{!u&&!a.aborted&&s.down([[E,p]])})};return l(),()=>{u=!0,t?.removeEventListener("abort",i),o.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},pt(r))}function Un(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"}function Bt(n,e){if(Un(n))return n;if(Vn(n))return jn(n,e);if(n!=null){let t=n;if(typeof t[Symbol.asyncIterator]=="function")return Bn(n,e);if(typeof t[Symbol.iterator]=="function")return jt(n,e)}return Hn(n)}function Hn(...n){return jt(n,void 0)}function ue(n){return n.subscribe(()=>{})}var Ut=I(()=>{"use strict";ee();xe()});var ht=I(()=>{"use strict";Ut()});function Ht(n){return{describeKind:"derived",...n}}function zt(...n){return n.length===0?X(e=>{e.down([[G]])},{...Ht(),meta:{...ct("merge")}}):X(e=>{let t=n.length,r=0,s=[];for(let o of n){let i=o.subscribe(a=>{for(let u of a)u[0]===M?e.emit(u[1]):u[0]===G?(r+=1,r>=t&&e.down([[G]])):u[0]===E&&e.down([u])});s.push(i)}return()=>{for(let o of s)o()}},{...Ht(),meta:{...ct("merge")}})}var Wt=I(()=>{"use strict";ee();ft();xe()});var qt=I(()=>{"use strict";Wt()});function gt(n,e){if(Object.is(n,e))return!0;if(n==null||e==null||typeof n!="object"||typeof e!="object")return!1;if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let o=0;o<n.length;o++)if(!gt(n[o],e[o]))return!1;return!0}if(Array.isArray(e))return!1;let t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;let s=new Set(r);for(let o of t)if(!s.has(o)||!gt(n[o],e[o]))return!1;return!0}function Kt(n,e){return`${n}\0${e}`}function mt(n,e){let t=[],r=new Set(n.subgraphs),s=new Set(e.subgraphs),o=[];for(let g of s)r.has(g)||o.push(g);o.sort();for(let g of o)t.push({type:"subgraph-mounted",path:g});let i=new Set(Object.keys(n.nodes)),a=new Set(Object.keys(e.nodes)),u=[];for(let g of a)i.has(g)||u.push(g);u.sort();for(let g of u)t.push({type:"node-added",path:g,node:{...e.nodes[g]}});let d=[];for(let g of a){if(!i.has(g))continue;let T=n.nodes[g]?.meta,y=e.nodes[g]?.meta;T==null&&y==null||gt(T??{},y??{})||d.push(g)}d.sort();for(let g of d)t.push({type:"node-meta-changed",path:g,prevMeta:n.nodes[g]?.meta??{},nextMeta:e.nodes[g]?.meta??{}});let l=new Map;for(let g of n.edges)l.set(Kt(g.from,g.to),g);let p=new Map;for(let g of e.edges)p.set(Kt(g.from,g.to),g);let h=[];for(let[g,T]of p)l.has(g)||h.push(T);h.sort((g,T)=>g.from<T.from?-1:g.from>T.from?1:g.to<T.to?-1:g.to>T.to?1:0);for(let g of h)t.push({type:"edge-added",from:g.from,to:g.to});let f=[];for(let[g,T]of l)p.has(g)||f.push(T);f.sort((g,T)=>g.from<T.from?-1:g.from>T.from?1:g.to<T.to?-1:g.to>T.to?1:0);for(let g of f)t.push({type:"edge-removed",from:g.from,to:g.to});let c=[];for(let g of i)a.has(g)||c.push(g);c.sort();for(let g of c)t.push({type:"node-removed",path:g});let m=[];for(let g of r)s.has(g)||m.push(g);m.sort();for(let g of m)t.push({type:"subgraph-unmounted",path:g});return{events:t,flushedAt_ns:Z()}}var Yt=I(()=>{"use strict";Ge()});var Fe,Jt=I(()=>{"use strict";Fe=class{_timer;_gen=0;start(e,t){this.cancel(),this._gen+=1;let r=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,r===this._gen&&t()},e)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var ke,Xt=I(()=>{"use strict";ke=class{constructor(e){this.capacity=e;if(!Number.isInteger(e)||e<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${e})`);this.buf=new Array(e)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(e){let t=(this.head+this._size)%this.capacity;this.buf[t]=e,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,e}at(e){if(this._size===0)return;let t=e<0?this._size+e:e;if(!(t<0||t>=this._size))return this.buf[(this.head+t)%this.capacity]}toArray(){let e=new Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[(this.head+t)%this.capacity];return e}clear(){for(let e=0;e<this._size;e++)this.buf[(this.head+e)%this.capacity]=void 0;this.head=0,this._size=0}}});function Zt(n,e,t,r={}){let s=e in n.nodes,o=t in n.nodes;if(!s)return Le(e,t,"no-such-from");if(!o)return Le(e,t,"no-such-to");let i=r.maxDepth;if(i!=null&&(!Number.isInteger(i)||i<0))throw new Error("explainPath: maxDepth must be an integer >= 0");if(e===t){if(r.findCycle===!0){let d=zn(n,e,r);if(d!=null)return d}let u=Ve(e,n.nodes[e],0,r);return je(e,t,[u])}if(i===0)return Le(e,t,"no-path");let a=Qt(n,e,t,i);return a.found?je(e,t,en(n,a.pathOrder,r)):Le(e,t,a.truncated?"max-depth-exceeded":"no-path")}function Qt(n,e,t,r){let s=new Map,o=[{path:t,depth:0}],i=new Set([t]),a=0,u=!1;for(;a<o.length;){let p=o[a++];if(p.path===e)break;if(r!=null&&p.depth>=r){let m=n.nodes[p.path];m?.deps&&m.deps.length>0&&(u=!0);continue}let h=n.nodes[p.path];if(h==null)continue;let f=h.deps??[],c=new Map;for(let m=0;m<f.length;m++){let g=f[m];if(!g)continue;let T=c.get(g);T==null&&(T=[],c.set(g,T)),T.push(m)}for(let[m,g]of c)i.has(m)||(i.add(m),s.set(m,{from:p.path,depIndices:g}),o.push({path:m,depth:p.depth+1}))}if(!s.has(e))return{found:!1,pathOrder:[],truncated:u};let d=[{path:e}],l=e;for(;l!==t;){let p=s.get(l);if(p==null)return{found:!1,pathOrder:[],truncated:!1};d[d.length-1].depIndices=p.depIndices,d.push({path:p.from}),l=p.from}return{found:!0,pathOrder:d,truncated:!1}}function zn(n,e,t){let r=n.nodes[e];if(r==null)return null;let s=r.deps??[],o=[];for(let a=0;a<s.length;a++)s[a]===e&&o.push(a);if(o.length>0){let a=Ve(e,r,0,t);a.dep_index=o[0];let u=Ve(e,r,1,t);return je(e,e,[a,u])}let i=null;for(let a=0;a<s.length;a++){let u=s[a];if(!u||u===e)continue;let d=Qt(n,u,e,t.maxDepth);d.found&&(i==null||d.pathOrder.length<i.pathOrder.length)&&(i=d,i={found:!0,pathOrder:[{path:e,depIndices:[a]},...d.pathOrder],truncated:!1})}return i==null?null:je(e,e,en(n,i.pathOrder,t))}function en(n,e,t){return e.map((r,s)=>{let o=n.nodes[r.path],i=Ve(r.path,o,s,t);return r.depIndices!=null&&r.depIndices.length>0&&(i.dep_index=r.depIndices[0],r.depIndices.length>1&&(i.dep_indices=[...r.depIndices])),i})}function Ve(n,e,t,r){let s={path:n,type:e.type,hop:t};e.status!==void 0&&(s.status=e.status),"value"in e&&(s.value=e.value),e.v!=null&&(s.v=e.v);let o=r.annotations?.get(n)??e.annotation;o!=null&&(s.annotation=o);let i=r.lastMutations?.get(n)??e.lastMutation;return i!=null&&(s.lastMutation=i),s}function je(n,e,t){return tn(n,e,!0,"ok",t)}function Le(n,e,t){return tn(n,e,!1,t,[])}function tn(n,e,t,r,s){let o=Wn(n,e,t,r,s);return{from:n,to:e,found:t,reason:r,steps:s,text:o,toJSON(){return{from:n,to:e,found:t,reason:r,steps:s}}}}function Wn(n,e,t,r,s){if(!t)switch(r){case"no-such-from":return`explainPath: no node named "${n}"`;case"no-such-to":return`explainPath: no node named "${e}"`;case"max-depth-exceeded":return`explainPath: no path from "${n}" to "${e}" within maxDepth`;default:return`explainPath: no path from "${n}" to "${e}"`}let o=[`Causal path: ${n} \u2192 ${e} (${s.length} step(s))`];for(let i of s){let u=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(o.push(u),"value"in i&&o.push(` value: ${qn(i.value)}`),i.annotation!=null&&o.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let d=i.lastMutation.actor;o.push(` actor: ${d.type}${d.id?`:${d.id}`:""}`)}}return o.join(`
2
- `)}function qn(n){if(n===void 0)return"<sentinel>";if(n===null)return"null";if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return String(n);try{let e=JSON.stringify(n);return e.length>80?`${e.slice(0,77)}...`:e}catch{return String(n)}}var nn=I(()=>{"use strict"});function rn(n){let e=new WeakSet,t=new WeakSet,r=[n],s=0;for(;r.length>0;){let o=r.pop();s+=Yn(o,e,t,r)}return s}function Yn(n,e,t,r){if(n==null)return 0;switch(typeof n){case"number":return L.number;case"boolean":return L.boolean;case"string":return L.string+n.length*2;case"bigint":return L.bigint+Jn(n);case"symbol":return L.symbol;case"function":return e.has(n)?0:(e.add(n),L.function);case"undefined":return 0}let o=n;if(e.has(o))return 0;e.add(o);let i=o[Kn];if(typeof i=="function")try{let d=i.call(o);if(typeof d=="number"&&Number.isFinite(d))return d}catch{}if(o instanceof Date)return L.date;if(o instanceof RegExp)return L.regexp+o.source.length*2;if(o instanceof Error){let d=o.message?o.message.length*2:0,l=o.stack?o.stack.length*2:0;return L.error+d+l}if(typeof URL<"u"&&o instanceof URL)return L.url+o.href.length*2;if(typeof Promise<"u"&&o instanceof Promise)return L.promise;if(o instanceof WeakMap)return L.weakmap;if(o instanceof WeakSet)return L.weakset;if(o instanceof Map){let d=L.map;for(let[l,p]of o)d+=L.mapEntry,r.push(l),r.push(p);return d}if(o instanceof Set){let d=L.set;for(let l of o)d+=L.setEntry,r.push(l);return d}if(Array.isArray(o)){let d=L.array+o.length*8;for(let l of o)r.push(l);return d}if(o instanceof ArrayBuffer)return t.has(o)?0:(t.add(o),o.byteLength);if(ArrayBuffer.isView(o)){let d=o;return t.has(d.buffer)?48:(t.add(d.buffer),d.buffer.byteLength+48)}let a=L.object,u=Object.keys(o);for(let d of u){a+=L.string+d.length*2;try{r.push(o[d])}catch{}}return a}function Jn(n){let e=n<0n?-n:n;if(e===0n)return 0;let t=e.toString(2).length;return Math.ceil(t/32)*8}var L,Kn,sn=I(()=>{"use strict";L={object:56,array:64,string:40,number:8,boolean:4,null:0,undefined:0,symbol:40,bigint:16,function:120,map:72,set:72,mapEntry:40,setEntry:24,date:24,regexp:48,error:64,url:80,promise:48,weakmap:40,weakset:40},Kn=Symbol.for("sizeof")});function on(n,e){let t=e?.topN??10,r=n.describe({detail:"standard"}),s=[],o=n._collectObserveTargets;typeof o=="function"&&o.call(n,"",s);let i=new Map;for(let[h,f]of s)i.set(h,f);let a=[];for(let[h,f]of Object.entries(r.nodes)){let c=i.get(h),m=c instanceof F?c:null,g=m?rn(m.cache):0,T=m?m._sinkCount:0,y=f.deps?.length??0,b=f.type==="effect"&&T===0,v=T===0?f.type==="effect"?"orphan-effect":f.type==="derived"?"idle-derived":f.type==="producer"?"idle-producer":null:null;a.push({path:h,type:f.type,status:f.status??"unknown",valueSizeBytes:g,subscriberCount:T,depCount:y,isOrphanEffect:b,orphanKind:v})}let u=a.reduce((h,f)=>h+f.valueSizeBytes,0),d=(h,f)=>[...a].sort(f??((c,m)=>m[h]-c[h])).slice(0,t),l=a.filter(h=>h.orphanKind!=null),p=a.filter(h=>h.isOrphanEffect);return{nodeCount:a.length,edgeCount:r.edges.length,subgraphCount:r.subgraphs.length,nodes:a,totalValueSizeBytes:u,hotspots:{byValueSize:d("valueSizeBytes"),bySubscriberCount:d("subscriberCount"),byDepCount:d("depCount")},orphans:l,orphanEffects:p}}var an=I(()=>{"use strict";be();sn()});function Be(n,e){let t=Math.max(16,n.size*4),r=0;for(;n.size>0;){if(r++>=t){console.error(`[Graph "${e}".destroy] disposer drain exceeded cap (${t}); ${n.size} disposer(s) discarded`),n.clear();return}let s=n.values().next();if(s.done)return;let o=s.value;n.delete(o);try{o()}catch(i){console.error(`[Graph "${e}".destroy] disposer threw:`,i)}}}function pn(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"&&typeof n.down=="function"}function Xn(n){if(n!=null)return pn(n)?n.cache:n}function de(n){return n!=null&&typeof n=="object"&&"cache"in n&&typeof n.subscribe=="function"&&typeof n.down=="function"}function ne(n){return de(n)?n.cache??"":n}function un(n){return de(n)?n.cache??0:n}function dn(n){return de(n)?n.cache??!1:n}function Zn(n){let e=[];for(let t of Object.keys(n).sort()){let r=n[t].v;r!=null&&e.push(`${t} ${r.id} ${r.version}`)}return e.join(`
3
- `)}function cn(n){if(n.version!==ye)throw new Error(`unsupported snapshot version ${String(n.version)} (expected ${ye})`);for(let e of["name","nodes","edges","subgraphs"])if(!(e in n))throw new Error(`snapshot missing required key "${e}"`);if(typeof n.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof n.nodes!="object"||n.nodes===null||Array.isArray(n.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(n.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(n.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function Qn(n,e){let t=new WeakMap,r=(s,o)=>{if(Object.is(s,o))return!0;if(s==null||o==null||typeof s!="object"||typeof o!="object")return!1;let i=t.get(s);if(i==null&&(i=new WeakSet,t.set(s,i)),i.has(o))return!0;i.add(o);let a=s.constructor,u=o.constructor;if(a!==u)return!1;if(s instanceof Date)return s.getTime()===o.getTime();if(s instanceof RegExp)return s.source===o.source&&s.flags===o.flags;if(Array.isArray(s)){let h=o;if(s.length!==h.length)return!1;for(let f=0;f<s.length;f++)if(!r(s[f],h[f]))return!1;return!0}if(s instanceof Map){let h=o;if(s.size!==h.size)return!1;for(let[f,c]of s)if(!h.has(f)||!r(c,h.get(f)))return!1;return!0}if(s instanceof Set){let h=o;if(s.size!==h.size)return!1;for(let f of s){let c=!1;for(let m of h)if(r(f,m)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(s)){let h=s,f=o;if(h.length!==f.length)return!1;for(let c=0;c<h.length;c++)if(h[c]!==f[c])return!1;return!0}let d=Object.keys(s),l=Object.keys(o);if(d.length!==l.length)return!1;let p=new Set(l);for(let h of d)if(!p.has(h)||!r(s[h],o[h]))return!1;return!0};return r(n,e)}function er(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ue(n){let e="^";for(let t=0;t<n.length;t+=1){let r=n[t];if(r==="*"){e+=".*";continue}if(r==="?"){e+=".";continue}if(r==="["){let s=n.indexOf("]",t+1);if(s<=t+1){e+="\\[";continue}let o=n.slice(t+1,s);o.startsWith("!")&&(o=`^${o.slice(1)}`),o=o.replace(/\\/g,"\\\\"),e+=`[${o}]`,t=s;continue}e+=er(r)}return e+="$",new RegExp(e)}function bt(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 rr(n){return n==="none"?nr:n==="ansi"||n==null?tr:{data:n.data??"",dirty:n.dirty??"",resolved:n.resolved??"",invalidate:n.invalidate??"",pause:n.pause??"",resume:n.resume??"",complete:n.complete??"",error:n.error??"",teardown:n.teardown??"",derived:n.derived??"",path:n.path??"",reset:n.reset??""}}function ln(n){if(n==null)return{};let e=n.detail;return e==="full"?{...n,structured:n.structured??!0,timeline:n.timeline??!0,causal:n.causal??!0,derived:n.derived??!0}:e==="minimal"?{...n,structured:n.structured??!0}:n.format==="stage-log"?{...n,structured:n.structured??!0,timeline:n.timeline??!0}:n}function sr(n,e,t){for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);if(s<32||s===127)throw new Error(`Graph "${e}": ${t} "${n}" must not contain control character (U+${s.toString(16).padStart(4,"0").toUpperCase()} at index ${r})`)}}function yt(n,e,t){if(n==="")throw new Error(`Graph "${e}": ${t} name must be non-empty`);if(n.includes(P))throw new Error(`Graph "${e}": ${t} "${n}" must not contain '${P}' (path separator)`);if(n===Y)throw new Error(`Graph "${e}": ${t} name "${Y}" is reserved for meta companion paths`);sr(n,e,t)}function or(n,e){if(n==="")throw new Error(`Graph "${e}": resolve path must be non-empty`);let t=n.split(P);for(let r of t)if(r==="")throw new Error(`Graph "${e}": resolve path has empty segment`);return t}function ir(n,e){let t=!1;for(let s of n)if(!e.isMetaPassthrough(s[0])){t=!0;break}return t?n.filter(s=>e.isMetaPassthrough(s[0])):n}function hn(n){for(let e of n._mounts.values())hn(e);for(let e of n._nodes.values())try{e.down([[V]],{internal:!0})}catch{}}function ar(n,e){let t=ve.diff(n,e),r={};for(let s of t.nodesAdded){let o=e.nodes[s];o!=null&&(r[s]=o)}return{...t,nodesAddedFull:r}}function fn(n,e,t,r={}){let s={paths:[],depths:new Map,truncated:!1};if(!e)return r.withDetail?s:[];if(!r.both&&t!=="upstream"&&t!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let o=r.maxDepth;if(o!=null&&(!Number.isInteger(o)||o<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(o===0)return r.withDetail?s:[];let i=new Map,a=new Map,u=new Map,d=new Map,l=new Set;for(let[b,v]of Object.entries(n.nodes)){if(!b)continue;l.add(b);let w=v.deps??[];i.set(b,w);for(let O of w)O&&(l.add(O),a.has(O)||a.set(O,new Set),a.get(O).add(b))}for(let b of n.edges){if(b==null||typeof b!="object")continue;let v=typeof b.from=="string"?b.from:"",w=typeof b.to=="string"?b.to:"";!v||!w||(l.add(v),l.add(w),d.has(v)||d.set(v,new Set),d.get(v).add(w),u.has(w)||u.set(w,new Set),u.get(w).add(v))}if(!l.has(e))return r.withDetail?s:[];let p=r.both===!0,h=b=>{if(p){let x=i.get(b)??[],k=u.get(b),R=a.get(b),A=d.get(b),N=[...x];return k&&N.push(...k),R&&N.push(...R),A&&N.push(...A),N}if(t==="upstream"){let x=i.get(b)??[],k=u.get(b);return k?[...x,...k]:x}let v=a.get(b),w=d.get(b),O=v?[...v]:[];return w&&O.push(...w),O},f=new Set([e]),c=new Map,m=[{path:e,depth:0}],g=0,T=!1;for(;g<m.length;){let b=m[g++];if(o!=null&&b.depth>=o){h(b.path).length>0&&(T=!0);continue}for(let v of h(b.path))!v||f.has(v)||(f.add(v),c.set(v,b.depth+1),m.push({path:v,depth:b.depth+1}))}let y=[...c.keys()].sort((b,v)=>b<v?-1:b>v?1:0);return r.withDetail?{paths:y,depths:c,truncated:T}:y}function ur(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],s=e[t];if(r.path!==s.path||r.type!==s.type||r.status!==s.status||r.hop!==s.hop||r.dep_index!==s.dep_index||r.annotation!==s.annotation||r.value!==s.value||r.lastMutation!==s.lastMutation)return!1;let o=r.v,i=s.v;if(o!==i&&(o==null||i==null||o.id!==i.id||o.version!==i.version))return!1}return!0}var P,Y,ye,tr,nr,ve,gn=I(()=>{"use strict";nt();De();Ge();Oe();ee();ft();be();xe();Yt();ht();Jt();Xt();tt();nn();an();P="::",Y="__meta__",ye=1;tr={data:"\x1B[32m",dirty:"\x1B[33m",resolved:"\x1B[36m",invalidate:"\x1B[93m",pause:"\x1B[90m",resume:"\x1B[96m",complete:"\x1B[34m",error:"\x1B[31m",teardown:"\x1B[91m",derived:"\x1B[35m",path:"\x1B[90m",reset:"\x1B[0m"},nr={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};ve=class n{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_destroyed=!1;_topology;_topologyEmitters=new Set;_factory;_factoryArgs;constructor(e,t){if(e==="")throw new Error("Graph name must be non-empty");if(e.includes(P))throw new Error(`Graph name must not contain '${P}' (got "${e}")`);if(e===Y)throw new Error(`Graph name "${Y}" is reserved for meta companion paths`);this.name=e,this.opts=Object.freeze({...t??{}}),this.config=t?.config??me,this._traceRing=new ke(t?.traceCapacity??1e3),t?.versioning!=null&&this.setVersioning(t.versioning),typeof t?.factory=="string"&&(this._factory=t.factory,t.factoryArgs!==void 0&&(this._factoryArgs=t.factoryArgs))}tagFactory(e,t){return this._factory=e,this._factoryArgs=t,this}ancestors(e=!0){let t=[],r=e?this:this._parent;for(;r!=null;)t.push(r),r=r._parent;return t}get topology(){return this._topology==null&&(this._topology=X(e=>{let t=r=>{e.emit(r)};return this._topologyEmitters.add(t),()=>{this._topologyEmitters.delete(t)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(e){if(!(this._topology==null||this._topologyEmitters.size===0))for(let t of this._topologyEmitters)t(e)}nameOf(e){return this._nodeToName.get(e)}add(e,t){let r=e.name,s=t?.name??r;if(s==null||s==="")throw new Error(`Graph "${this.name}": graph.add requires a non-empty name \u2014 pass via opts.name or set it on the node (e.g. state(0, { name: "x" }))`);let o=s,i=t?.annotation;if(yt(o,this.name,"add"),this._mounts.has(o))throw new Error(`Graph "${this.name}": name "${o}" is already a mount point`);if(this._nodes.has(o))throw new Error(`Graph "${this.name}": node "${o}" already exists`);let a=this._nodeToName.get(e);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(o,e),this._nodeToName.set(e,o),this._emitTopology({kind:"added",name:o,nodeKind:"node"}),i!=null&&(this._annotations.set(o,i),this.config.inspectorEnabled&&this._traceRing.push({path:o,annotation:i,timestamp_ns:Z()})),e}setVersioning(e){if(e!=null)for(let t of this._nodes.values())t instanceof F&&t._applyVersioning(e)}remove(e){yt(e,this.name,"remove");let t=this._mounts.get(e);if(t){let o={kind:"mount",nodes:[],mounts:[]},i=[];t._collectObserveTargets("",i);for(let[a,u]of i)a.includes(`${P}${Y}${P}`)||o.nodes.push(a);return o.nodes.sort(),o.mounts.push(e),o.mounts.push(...t._collectSubgraphs(`${e}${P}`)),this._mounts.delete(e),t._parent=void 0,hn(t),this._emitTopology({kind:"removed",name:e,nodeKind:"mount",audit:o}),o}let r=this._nodes.get(e);if(!r)throw new Error(`Graph "${this.name}": unknown node or mount "${e}"`);this._nodes.delete(e),this._nodeToName.delete(r),r.down([[V]],{internal:!0});let s={kind:"node",nodes:[e],mounts:[]};return this._emitTopology({kind:"removed",name:e,nodeKind:"node",audit:s}),s}removeAll(e){let t=typeof e=="function"?e:(()=>{let o=Ue(e);return i=>o.test(i)})(),r={kind:"mount",nodes:[],mounts:[]},s=[...this._nodes.keys(),...this._mounts.keys()].filter(o=>t(o));for(let o of s){let i=this.remove(o);r.nodes.push(...i.nodes),r.mounts.push(...i.mounts)}return r.nodes.sort(),r.mounts.sort(),r}[Symbol.iterator](){let e=[...this._nodes.keys()].sort(),t=this._nodes,r=0;return{[Symbol.iterator](){return this},next(){if(r>=e.length)return{value:void 0,done:!0};let s=e[r++];return{value:[s,t.get(s)],done:!1}}}}node(e){if(e==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(e.includes(P))return this.resolve(e);let t=this._nodes.get(e);if(!t)throw new Error(`Graph "${this.name}": unknown node "${e}"`);return t}get(e){return this.node(e).cache}set(e,t,r){let s=r?.internal===!0;this.node(e).down([[M,t]],{actor:r?.actor,internal:s,delivery:"write"})}setAll(e,t){let r=Symbol.iterator in e?e:Object.entries(e);Ne(()=>{for(let[s,o]of r)this.set(s,o,t)})}invalidate(e,t){let r=t?.internal===!0;this.node(e).down([[K]],{actor:t?.actor,internal:r,delivery:"write"})}error(e,t,r){let s=r?.internal===!0;this.node(e).down([[E,t]],{actor:r?.actor,internal:s,delivery:"write"})}complete(e,t){let r=t?.internal===!0;this.node(e).down([[G]],{actor:t?.actor,internal:r,delivery:"write"})}_registerSelfPruningKeepalive(e){let t,r,s=()=>{t?.(),t=void 0,r?.(),r=void 0};t=e.subscribe(o=>{for(let i of o){let a=i[0];if(a===V||a===G||a===E){s();return}}}),r=this.addDisposer(s)}_wireSignalToRemove(e,t){if(t==null)return;let r=()=>{try{this.remove(e)}catch{}};if(t.aborted){r();return}t.addEventListener("abort",r,{once:!0}),this.addDisposer(()=>t.removeEventListener("abort",r))}derived(e,t,r,s){let o=t.map(f=>this.resolve(f)),{keepAlive:i,annotation:a,equals:u,initial:d,meta:l,signal:p}=s??{},h=ae(o,r,{name:e,...u!=null?{equals:u}:{},...d!==void 0?{initial:d}:{},...l!=null?{meta:l}:{}});return this.add(h,{name:e,...a!=null?{annotation:a}:{}}),i===!0&&this._registerSelfPruningKeepalive(h),this._wireSignalToRemove(e,p),h}effect(e,t,r,s){let o=t.map(l=>this.resolve(l)),{annotation:i,meta:a,signal:u}=s??{},d=$e(o,r,{name:e,...a!=null?{meta:a}:{}});return this.add(d,{name:e,...i!=null?{annotation:i}:{}}),this._wireSignalToRemove(e,u),d}produce(e,t,r){if(t===void 0)throw new Error(`Graph "${this.name}".produce("${e}", \u2026): source must not be \`undefined\` \u2014 undefined is the global SENTINEL (spec \xA71.1). Pass \`null\` for nullary DATA, or a Promise/AsyncIterable/Iterable for async sources.`);if(t!==null&&typeof t=="object"&&"cache"in t&&typeof t.subscribe=="function")throw new Error(`Graph "${this.name}".produce("${e}", \u2026): Node sources are rejected. For Node\u2192Node, use graph.derived(name, [path], ([v]) => v, { keepAlive: true }) \u2014 fromAny passes Nodes through verbatim and silently drops opts.`);let{annotation:s,meta:o,equals:i,signal:a}=r??{},u=Bt(t,{name:e,...o!=null?{meta:o}:{},...i!=null?{equals:i}:{},...a!=null?{signal:a}:{}});return this.add(u,{name:e,...s!=null?{annotation:s}:{}}),this._wireSignalToRemove(e,a),u}batch(e){Ne(e)}edges(e){let t=e?.recursive===!0,r=new Map;if(!t){for(let[u,d]of this._nodes)r.set(d,u);let a=[];for(let[u,d]of this._nodes)if(d instanceof F)for(let l of d._deps){let p=r.get(l.node);p!=null&&a.push([p,u])}return a.sort((u,d)=>u[0]<d[0]?-1:u[0]>d[0]?1:u[1]<d[1]?-1:u[1]>d[1]?1:0),a}let s=[];this._collectObserveTargets("",s);let o=new Map;for(let[a,u]of s)o.set(u,a);let i=[];for(let[a,u]of s)if(u instanceof F)for(let d of u._deps){let l=o.get(d.node);l!=null&&i.push([l,a])}return i.sort((a,u)=>a[0]<u[0]?-1:a[0]>u[0]?1:a[1]<u[1]?-1:a[1]>u[1]?1:0),i}mount(e,t){if(t===void 0){let s=new n(e);return this.mount(e,s)}if(typeof t=="function"){let s=new n(e);return t(s),this.mount(e,s)}let r=t;if(yt(e,this.name,"mount"),this._nodes.has(e))throw new Error(`Graph "${this.name}": cannot mount at "${e}" \u2014 node with that name exists`);if(this._mounts.has(e))throw new Error(`Graph "${this.name}": mount "${e}" already exists`);if(r===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(r._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${r._parent.name}"`);for(let s=this;s!=null;s=s._parent)if(s===r)throw new Error(`Graph "${this.name}": mount("${e}", \u2026) would create a mount cycle`);return this._mounts.set(e,r),r._parent=this,this._emitTopology({kind:"added",name:e,nodeKind:"mount"}),r}resolve(e){let t=or(e,this.name);return this._resolveFromSegments(t)}tryResolve(e){try{return this.resolve(e)}catch{return}}_resolveFromSegments(e){let t=e;if(t[0]===this.name&&(t=t.slice(1),t.length===0))throw new Error(`Graph "${this.name}": resolve path ends at graph name only`);let r=t[0],s=t.slice(1);if(s.length===0){let a=this._nodes.get(r);if(a)return a;throw this._mounts.has(r)?new Error(`Graph "${this.name}": path ends at subgraph "${r}" \u2014 not a node (GRAPHREFLY-SPEC \xA73.5)`):new Error(`Graph "${this.name}": unknown name "${r}"`)}let o=this._nodes.get(r);if(o&&s.length>0&&s[0]===Y)return this._resolveMetaChainFromNode(o,s,t.join(P));let i=this._mounts.get(r);if(!i)throw this._nodes.has(r)?new Error(`Graph "${this.name}": "${r}" is a node; trailing path "${s.join(P)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${r}"`);return i.resolve(s.join(P))}_resolveMetaChainFromNode(e,t,r){let s=e,o=0,i=[...t];for(;o<i.length;){if(i[o]!==Y)throw new Error(`Graph "${this.name}": expected ${Y} segment in meta path "${r}"`);if(o+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${Y} in "${r}"`);let a=i[o+1],u=s.meta[a];if(!u)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${r}"`);s=u,o+=2}return s}signal(e,t){if(t?.internal!==!0){for(let s of e)if(this.config.messageTier(s[0])===3)throw new Error(`Graph "${this.name}": Graph.signal() rejects tier-3 messages (DATA / RESOLVED). Broadcast is for control-plane tiers (START / DIRTY / INVALIDATE / PAUSE / RESUME / COMPLETE / ERROR / TEARDOWN). For per-node value writes, use Graph.set or graph.node(name).down(...).`)}let r=[];if(this._signalDeliver(e,t??{},new Set,r),r.length>0)throw r[0]}_signalDeliver(e,t,r,s){for(let u of this._mounts.values())u._signalDeliver(e,t,r,s);let i=t.internal===!0?{internal:!0}:{actor:t.actor,delivery:"signal"},a=ir(e,this.config);for(let u of[...this._nodes.keys()].sort()){let d=this._nodes.get(u);if(!r.has(d)){r.add(d);try{d.down(e,i)}catch(l){if(l instanceof q)throw l;s.push(l)}a.length!==0&&this._signalMetaSubtree(d,a,r,i,s)}}}_signalMetaSubtree(e,t,r,s,o){for(let i of Object.keys(e.meta).sort()){let a=e.meta[i];if(!r.has(a)){r.add(a);try{a.down(t,s)}catch(u){if(u instanceof q)throw u;o.push(u)}this._signalMetaSubtree(a,t,r,s,o)}}}describe(e){if(e?.reactive==="diff")return this._describeReactiveDiff(e);if(e?.reactive===!0)return this._describeReactive(e);let t=Xn(e?.actor),r=e?.filter;if(e?.detail!=null&&e?.fields!=null)throw new TypeError("Graph.describe(): pass either `detail` or `fields`, not both. `detail: 'spec'` is the canonical spec projection; use `fields` only when you need a custom subset.");let s=dt(e?.detail,e?.fields),o=e?.detail==="spec",i=s,a=[];this._collectObserveTargets("",a);let u=new Map;for(let[v,w]of a)u.set(w,v);let d=[];{let v=a.map(([,x])=>x),w=new Set(u.values()),O=0;for(;v.length>0;){let x=v.shift();if(x instanceof F)for(let k of x._deps){let R=k.node;if(u.has(R))continue;let A=R.name??"",N=A;if(!N||w.has(N))if(A){let j=2;for(;w.has(`${A}#${j}`);)j++;N=`${A}#${j}`}else for(N=`__internal__/${O++}`;w.has(N);)N=`__internal__/${O++}`;u.set(R,N),w.add(N),d.push([N,R]),v.push(R)}}}let l=[...a,...d],p={};for(let[v,w]of l){if(t!=null&&!w.allowsObserve(t))continue;let O=lt(w,i,o),x=w instanceof F?w._deps.map(N=>u.get(N.node)??N.node.name??""):[],{name:k,...R}=O,A={...R,deps:x};if(!o){let N=this._annotations.get(v);N!=null&&(A.annotation=N)}if(r!=null)if(typeof r=="function"){let N=r;if(!(N.length>=2?N(v,A):N(A)))continue}else{let N=!0;for(let[j,$]of Object.entries(r)){let D=j==="deps_includes"?"depsIncludes":j==="meta_has"?"metaHas":j;if(D==="depsIncludes"){if(!A.deps.includes(String($))){N=!1;break}continue}if(D==="metaHas"){if(!Object.hasOwn(A.meta??{},String($))){N=!1;break}continue}if(A[D]!==$){N=!1;break}}if(!N)continue}p[v]=A}let h=new Set(Object.keys(p)),f=[];for(let[v,w]of l)if(w instanceof F)for(let O of w._deps){let x=u.get(O.node);x!=null&&f.push([x,v])}f.sort((v,w)=>v[0]<w[0]?-1:v[0]>w[0]?1:v[1]<w[1]?-1:v[1]>w[1]?1:0);let c=f.map(([v,w])=>({from:v,to:w}));(t!=null||r!=null)&&(c=c.filter(v=>h.has(v.from)&&h.has(v.to)));let m=this._collectSubgraphs(""),g=t!=null||r!=null?m.filter(v=>{let w=`${v}${P}`;return[...h].some(O=>O===v||O.startsWith(w))}):m,T=this,y=e;return{name:this.name,nodes:p,edges:c,subgraphs:g,...this._factory!==void 0?{factory:this._factory}:{},...this._factoryArgs!==void 0?{factoryArgs:this._factoryArgs}:{},expand(v){let w={...y};return Array.isArray(v)?(w.fields=v,w.detail=void 0):(w.detail=v,w.fields=void 0),T.describe(w)}}}_collectSubgraphs(e){let t=[];for(let r of[...this._mounts.keys()].sort()){let s=e===""?r:`${e}${r}`;t.push(s),t.push(...this._mounts.get(r)._collectSubgraphs(`${s}${P}`))}return t}resourceProfile(e){return on(this,e)}reachable(e,t,r={}){return r.withDetail===!0?fn(this.describe(),e,t,{...r,withDetail:!0}):fn(this.describe(),e,t,r)}explain(e,t,r){return r?.reactive===!0?this._explainReactive(e,t,r):this._explainStatic(ne(e),ne(t),{...r?.maxDepth!==void 0?{maxDepth:un(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:dn(r.findCycle)}:{}})}_explainStatic(e,t,r){let s=this.describe({detail:"full"}),o=new Map(this._annotations),i=new Map;for(let[a,u]of Object.entries(s.nodes))u.lastMutation!=null&&i.set(a,u.lastMutation);return Zt(s,e,t,{...r?.maxDepth!=null?{maxDepth:r.maxDepth}:{},...r?.findCycle===!0?{findCycle:!0}:{},annotations:o,lastMutations:i})}_describeReactive(e){let t={...e,reactive:!1},r=e.reactiveName??"describe",s=0,o=te(s,{name:`${r}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,d=()=>{a||u||(a=!0,pe(()=>{a=!1,!u&&(s+=1,o.emit(s))}))},l=i.onEvent(y=>{let b=y.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||d()}),p=[],h=new WeakSet,f=y=>{if(h.has(y)||u)return;h.add(y);let b=y.topology.subscribe(v=>{for(let w of v){if(w[0]!==M)continue;let O=w[1];if(d(),O.kind==="added"&&O.nodeKind==="mount"){let x=y._mounts.get(O.name);x!=null&&f(x)}}});p.push(b);for(let v of y._mounts.keys()){let w=y._mounts.get(v);w!=null&&f(w)}};f(this);let c,m=e.actor;pn(m)&&(c=m.subscribe(y=>{let b=!1,v=!1;for(let w of y){let O=w[0];O===M?b=!0:(O===G||O===E||O===V)&&(v=!0)}b&&d(),v&&(c?.(),c=void 0,d())}));let g;try{g=ae([o],()=>this.describe(t),{name:r,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(y,b)=>y===b})}catch(y){l(),c?.();for(let b of p)b();throw i.dispose(),y}let T=ue(g);return{node:g,dispose(){u=!0,l(),c?.();for(let y of p)y();p.length=0,i.dispose(),T()}}}_describeReactiveDiff(e){let t={...e,reactive:!1},r=e.reactiveName??"describe-diff",s={name:this.name,nodes:{},edges:[],subgraphs:[]},o=this.describe(t),i=mt(s,o),a=te(i,{name:r,meta:{domain:"audit",kind:"describe-diff"},equals:(h,f)=>h===f}),u=this._describeReactive({...e,reactiveName:void 0}),d=!1,l=u.node.subscribe(h=>{if(!d)for(let f of h){if(f[0]!==M)continue;let c=f[1],m=mt(o,c);o=c,m.events.length!==0&&a.emit(m)}}),p=ue(a);return{node:a,dispose(){d=!0,l(),u.dispose(),a.down([[V,"describe-diff disposed"]]),p()}}}_explainReactive(e,t,r){let s=0,o=te(s,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,u=!1,d=()=>{a||u||(a=!0,pe(()=>{a=!1,!u&&(s+=1,o.emit(s))}))},l=i.onEvent(y=>{let b=y.type;b!=="data"&&b!=="error"&&b!=="complete"&&b!=="teardown"||d()}),p=[];e!=null&&de(e)&&p.push(e),t!=null&&de(t)&&p.push(t),r?.maxDepth!=null&&de(r.maxDepth)&&p.push(r.maxDepth),r?.findCycle!=null&&de(r.findCycle)&&p.push(r.findCycle);let h=()=>{for(let y of p)if(y.cache===void 0)return!1;return!0},f=()=>{let y=ne(e),b=ne(t);return{from:y,to:b,found:!1,reason:"pending",steps:[],text:"(awaiting reactive args)",toJSON:()=>({from:y,to:b,found:!1,reason:"pending",steps:[]})}},c;try{c=ae([o],()=>{if(!h())return f();let y=ne(e),b=ne(t),v={...r?.maxDepth!==void 0?{maxDepth:un(r.maxDepth)}:{},...r?.findCycle!==void 0?{findCycle:dn(r.findCycle)}:{}};return this._explainStatic(y,b,v)},{name:r?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:ne(e),to:ne(t)},equals:(y,b)=>y.found===b.found&&y.reason===b.reason&&y.steps.length===b.steps.length&&ur(y.steps,b.steps)})}catch(y){throw l(),i.dispose(),y}let m=ue(c),g=[],T=y=>{let b;return b=y.subscribe(v=>{let w=!1,O=!1;for(let x of v){let k=x[0];k===M?w=!0:(k===G||k===E||k===V)&&(O=!0)}(w||O)&&d(),O&&b&&(b(),b=void 0)}),()=>{b&&(b(),b=void 0)}};for(let y of p)g.push(T(y));return{node:c,dispose(){u=!0,l();for(let y of g)y?.();g.length=0,i.dispose(),m()}}}_pathsMatching(e){let t=Ue(e),r=[];return this._collectObserveTargets("",r),r.map(([s])=>s).filter(s=>t.test(s))}_collectObserveTargets(e,t){for(let r of[...this._mounts.keys()].sort()){let s=e===""?r:`${e}${P}${r}`;this._mounts.get(r)._collectObserveTargets(s,t)}for(let r of[...this._nodes.keys()].sort()){let s=this._nodes.get(r),o=e===""?r:`${e}${P}${r}`;t.push([o,s]),this._appendMetaObserveTargets(o,s,t)}}_appendMetaObserveTargets(e,t,r){for(let s of Object.keys(t.meta).sort()){let o=t.meta[s],i=`${e}${P}${Y}${P}${s}`;r.push([i,o]),this._appendMetaObserveTargets(i,o,r)}}observe(e,t){let r=typeof e=="string",o=ln(r?t:e);if(o.reactive===!0)return this._observeReactive(r?e:void 0,o);let i=o.structured===!0||o.timeline===!0||o.causal===!0||o.derived===!0||o.detail==="minimal"||o.detail==="full"||o.format!=null,a=o.actor;if(r){let l=e,p=this.resolve(l);if(a!=null&&!p.allowsObserve(a))throw new q({actor:a,action:"observe",nodeName:l});return i?this._buildStructuredObserver([[l,p]],o,"one"):{subscribe(h){return p.subscribe(h)},up(h){try{p.up?.(h)}catch(f){if(f instanceof q)return;throw f}}}}let u=[];this._collectObserveTargets("",u),u.sort((l,p)=>l[0]<p[0]?-1:l[0]>p[0]?1:0);let d=a==null?u:u.filter(([,l])=>l.allowsObserve(a));return i?this._buildStructuredObserver(d,o,"all"):{subscribe:l=>{let p=d.map(([h,f])=>f.subscribe(c=>{l(h,c)}));return()=>{for(let h of p)h()}},up:(l,p)=>{try{this.resolve(l).up?.(p)}catch(h){if(h instanceof q)return;throw h}}}}_observeReactive(e,t){let r=t.tiers,s=r!=null?new Set(r):null,o=t.reactiveName??"observe";return X(i=>{let a=[],u=!1,d=!1,l=()=>{if(a.length===0||d)return;let m={events:a.slice(),flushedAt_ns:Z()};a.length=0,i.emit(m)},p={...t,reactive:!1,structured:!0,timeline:!0},h=e!=null?this.observe(e,p):this.observe(p),f=m=>{d||(a.push(m),!u&&(u=!0,pe(()=>{u=!1,l()})))};for(let m of h.events)f(m);let c=h.onEvent(f);return()=>{d=!0,c(),h.dispose()}},{name:o,meta:{domain:"audit",kind:"observe-reactive"}})}_buildStructuredObserver(e,t,r){let s=r==="one"?e[0]?.[0]:void 0,o=i=>{if(r==="one"&&s!=null){let l=this.resolve(s);return this._buildStructuredObserver([[s,l]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((l,p)=>l[0]<p[0]?-1:l[0]>p[0]?1:0);let u=i.actor,d=u==null?a:a.filter(([,l])=>l.allowsObserve(u));return this._buildStructuredObserver(d,i,"all")};return this._createObserveResult(e,t,o)}_createObserveResult(e,t,r){let s=t.timeline===!0,o=t.causal===!0,i=t.derived===!0,a=t.detail==="minimal",u=this.config.inspectorEnabled,d=(o||i)&&u,l=t.maxEvents,p=l!=null&&l>0?new ke(l):null,h=[],f=new Set,c=t.tiers!=null?new Set(t.tiers):null,m={},g=new Set,T=0,y=0,b=0,v=0,w=0,O=0,x=!1,k=!1,R=0,A=new Map,N=new Map,j=new Map,$=_=>{if(!(c!=null&&!c.has(_.type))){p?p.push(_):h.push(_);for(let C of f)C(_)}},D=_=>c==null||c.has(_),ce=()=>s?{timestamp_ns:Z(),in_batch:Ae(),batch_id:R}:{},He=(_,C)=>{if(!(!d||!(_ instanceof F)))return _._setInspectorHook(H=>{if(H.kind==="dep_message")A.set(_,H.depIndex);else if(H.kind==="run"){let we=H.batchData.map((S,B)=>S!=null&&S.length>0?S.at(-1):H.prevData[B]);N.set(_,we);let z=H.batchData.map(S=>S!=null?[...S]:void 0);j.set(_,z),i&&$({type:"derived",path:C,dep_values:we,dep_batches:z,...ce()})}})},Ee=_=>{let C=A.get(_),H=N.get(_);if(!o||H==null)return{};let z=(C!=null&&C>=0&&_ instanceof F?_._deps[C]:void 0)?.node,S=z?.v,B=j.get(_);return{trigger_dep_index:C,trigger_dep_name:z?.name,...S!=null?{trigger_version:{id:S.id,version:S.version}}:{},dep_values:[...H],...B!=null?{dep_batches:B}:{}}},wt=[],Tt=[];for(let[_,C]of e){let H=He(C,_);H&&wt.push(H),Tt.push(C.subscribe(we=>{R++;for(let z of we){let S=z[0],B=ce();if(S===M){m[_]=z[1];let Ke=C instanceof F?C.lastMutation?.actor??ge:ge;$({type:"data",path:_,data:z[1],actor:Ke,...B,...Ee(C)})}else if(a)S===U?D("dirty")&&T++:S===W?D("resolved")&&y++:S===K?D("invalidate")&&b++:S===J?D("pause")&&v++:S===Q?D("resume")&&w++:S===V?D("teardown")&&O++:S===G&&!g.has(_)?D("complete")&&(x=!0):S===E&&D("error")&&(k=!0,g.add(_));else if(S===U)D("dirty")&&T++,$({type:"dirty",path:_,...B});else if(S===W)D("resolved")&&y++,$({type:"resolved",path:_,...B,...Ee(C)});else if(S===K)D("invalidate")&&b++,$({type:"invalidate",path:_,...B});else if(S===J)D("pause")&&v++,$({type:"pause",path:_,lockId:z[1],...B});else if(S===Q)D("resume")&&w++,$({type:"resume",path:_,lockId:z[1],...B});else if(S===G)D("complete")&&!g.has(_)&&(x=!0),$({type:"complete",path:_,...B});else if(S===E){D("error")&&(k=!0,g.add(_));let Ke=C instanceof F?C.lastMutation?.actor??ge:ge;$({type:"error",path:_,data:z[1],actor:Ke,...B})}else S===V&&(D("teardown")&&O++,$({type:"teardown",path:_,...B}))}}))}let ze=!1,We=()=>{if(!ze){ze=!0;for(let _ of Tt)_();for(let _ of wt)_();for(let _ of Re)_({value:void 0,done:!0});Re.length=0}},qe=[],Re=[];f.add(_=>{let C=Re.shift();C?C({value:_,done:!1}):qe.push(_)});let _t={get values(){return m},get dirtyCount(){return T},get resolvedCount(){return y},get invalidateCount(){return b},get pauseCount(){return v},get resumeCount(){return w},get teardownCount(){return O},get events(){return p?p.toArray():[...h]},get anyCompletedCleanly(){return x},get anyErrored(){return k},get completedWithoutErrors(){return x&&!k},onEvent(_){return f.add(_),()=>f.delete(_)},dispose:We,expand(_){We();let C={...t};return typeof _=="string"?C.detail=_:Object.assign(C,_),r(ln(C))},[Symbol.asyncIterator](){return{next(){return qe.length>0?Promise.resolve({value:qe.shift(),done:!1}):ze?Promise.resolve({value:void 0,done:!0}):new Promise(_=>Re.push(_))},return(){return We(),Promise.resolve({value:void 0,done:!0})}}}};return t.format!=null&&this._attachFormatLogger(_t,t),_t}_attachFormatLogger(e,t){let r=t.format;if(r==null)return;let s=t.logger??(c=>console.log(c)),o=t.includeTypes?new Set(t.includeTypes):null,i=t.excludeTypes?new Set(t.excludeTypes):null,a=o==null&&i==null?()=>!0:c=>(o==null||o.has(c))&&(i==null||!i.has(c)),u=rr(t.theme),d=r==="stage-log"?Z():0,l=c=>c==null?"":t.stageLabels?.[c]??c,p=(c,m)=>c.length>m?`${c.slice(0,m-1)}\u2026`:c,h=c=>c.type==="data"||c.type==="error"?p(bt(c.data),120):"",f=c=>{if(r==="stage-log"){let x=(Z()-d)/1e9,k=l(c.path).padEnd(9);if(c.type==="data"){let R=h(c);return`[${x.toFixed(3)}s] ${k} \u2190${R?` ${R}`:""}`}if(c.type==="error"){let R=h(c);return`[${x.toFixed(3)}s] ${k} \u2717${R?` ${R}`:""}`}return c.type==="complete"?`[${x.toFixed(3)}s] ${k} \u25A0 complete`:`[${x.toFixed(3)}s] ${k} ${c.type}`}if(r==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let m=u[c.type]??"",g=c.path?`${u.path}${c.path}${u.reset} `:"",T=c.type==="data"||c.type==="error",y=c.type==="pause"||c.type==="resume",b=T?` ${bt(c.data)}`:y?` ${bt(c.lockId)}`:"",v=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,w=v?.trigger_dep_name!=null?` <- ${v.trigger_dep_name}`:v?.trigger_dep_index!=null?` <- #${v.trigger_dep_index}`:"",O=c.in_batch?" [batch]":"";return`${g}${m}${c.type.toUpperCase()}${u.reset}${b}${w}${O}`};e.onEvent(c=>{a(c.type)&&s(f(c),c)})}addDisposer(e){return this._disposers.add(e),()=>{this._disposers.delete(e)}}destroy(){Be(this._disposers,this.name),this.signal([[V]],{internal:!0}),Be(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}get destroyed(){return this._destroyed}_destroyClearOnly(){Be(this._disposers,this.name),Be(this._storageDisposers,this.name);for(let e of[...this._mounts.values()])e._parent=void 0,e._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0,this._destroyed=!0}snapshot(e){let{expand:t,...r}=this.describe({detail:"full"}),s={};for(let a of Object.keys(r.nodes).sort()){let{lastMutation:u,guard:d,...l}=r.nodes[a];s[a]=l}let o=[...r.subgraphs].sort(),i={...r,version:1,nodes:s,subgraphs:o};if(e?.format==null)return i;if(e.format==="json-string")return JSON.stringify(i);if(e.format==="bytes"){if(e.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(e.codec);if(a==null)throw new Error(`snapshot: codec "${e.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return Rt(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(e.format)}"`)}static decode(e,t){let r=t?.config??me,{codec:s,codecVersion:o,payload:i}=At(e,r);return s.decode(i,o)}restore(e,t){if(cn(e),e.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${e.name}" does not match this graph`);let r=t?.only==null?null:(Array.isArray(t.only)?t.only:[t.only]).map(o=>Ue(o)),s=t?.includeProducers===!0;for(let o of Object.keys(e.nodes).sort()){if(r!==null&&!r.some(a=>a.test(o)))continue;let i=e.nodes[o];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&t?.onError?.(o,new Error(`restore: slice.value is undefined for "${o}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!s)){if(i.v!=null){let u=this.tryResolve(o)?.v;if(u!=null&&u.id===i.v.id&&u.version===i.v.version)continue}try{this.set(o,i.value)}catch(a){t?.onError?.(o,a)}}}}}static fromSnapshot(e,t){cn(e);let r=typeof t=="function"?t:t?.build,s=typeof t=="function"?void 0:t?.factories,o=new n(e.name);if(r)return r(o),o.restore(e),o;for(let f of[...e.subgraphs].sort((c,m)=>{let g=c.split(P).length,T=m.split(P).length;return g!==T?g-T:c<m?-1:c>m?1:0})){let c=f.split(P),m=o;for(let g of c)m._mounts.has(g)||m.mount(g,new n(g)),m=m._mounts.get(g)}let i=s?Object.entries(s).map(([f,c])=>({re:Ue(f),factory:c})):[],a=f=>{for(let c of i)if(c.re.test(f))return c.factory},u=f=>{let c=f.split(P),m=c.pop();if(m==null||m.length===0)throw new Error(`invalid snapshot path "${f}"`);let g=o;for(let T of c){let y=g._mounts.get(T);if(!y)throw new Error(`unknown mount "${T}" in path "${f}"`);g=y}return[g,m]},d=Object.entries(e.nodes).filter(([f])=>!f.includes(`${P}${Y}${P}`)).sort((f,c)=>f[0]<c[0]?-1:f[0]>c[0]?1:0),l=new Map(d),p=new Map,h=!0;for(;l.size>0&&h;){h=!1;for(let[f,c]of[...l.entries()]){let m=c?.deps??[];if(!m.every(w=>p.has(w)))continue;let[g,T]=u(f),y={...c?.meta??{}},b=a(f),v;if(c?.type==="state")v=te(c.value,{meta:y});else{if(b==null)continue;v=b(T,{path:f,type:c.type,value:c.value,meta:y,deps:m,resolvedDeps:m.map(w=>p.get(w))})}g.add(v,{name:T}),p.set(f,v),l.delete(f),h=!0}}if(l.size>0){let f=[...l.keys()].sort().join(", ");throw new Error(`Graph.fromSnapshot could not reconstruct nodes without build callback: ${f}. Pass matching factories via fromSnapshot(data, { factories: { pattern: factoryFn } }).`)}return o.restore(e),o}toJSON(){return this.snapshot()}attachSnapshotStorage(e,t={}){let r=e.map(d=>({tier:d,debounceMs:Math.max(0,d.debounceMs??0),compactEvery:Math.max(1,d.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));t.autoRestore===!0&&this._cascadeRestore(e,t.onError);let s=(d,l)=>{if(d.disposed)return;let p=Zn(l.nodes);if(d.lastSnapshot!=null&&p!==""&&p===d.lastFingerprint)return;let h=d.seq+1,f=Me(),g=d.lastSnapshot==null||h%d.compactEvery===0?{name:this.name,mode:"full",snapshot:l,seq:h,timestamp_ns:f,format_version:ye}:{name:this.name,mode:"diff",diff:ar(d.lastSnapshot,l),seq:h,timestamp_ns:f,format_version:ye};if(d.tier.filter&&!d.tier.filter(g))return;let T;try{T=d.tier.save(g)}catch(y){t.onError?.(y,d.tier);return}if(T&&typeof T.then=="function"){let v=(d.savePending??Promise.resolve()).then(()=>T,()=>T).then(()=>{d.disposed||(d.seq=h,d.lastSnapshot=l,d.lastFingerprint=p)},w=>{t.onError?.(w,d.tier)});d.savePending=v.finally(()=>{d.savePending===v&&(d.savePending=void 0)})}else d.seq=h,d.lastSnapshot=l,d.lastFingerprint=p},o=(d,l)=>{try{s(d,l)}catch(p){t.onError?.(p,d.tier)}},i=(d,l)=>{if(!l.some(c=>{let m=this.config.messageTier(c[0]);return m>=3&&m<5}))return;if(t.filter){let c=this.tryResolve(d);if(c==null)return;let m=lt(c,dt("standard"));if(!t.filter(d,m))return}let h,f=()=>(h==null&&(h=this.snapshot()),h);for(let c of r)c.disposed||(c.debounceMs===0?o(c,f()):(c.timer==null&&(c.timer=new Fe),c.timer.start(c.debounceMs,()=>{c.disposed||o(c,this.snapshot())})))},a;if(t.paths!=null){let l=(typeof t.paths=="string"?this._pathsMatching(t.paths):t.paths).map(p=>{let h=this.tryResolve(p);return h==null?()=>{}:h.subscribe(f=>i(p,f))});a=()=>{for(let p of l)p()}}else a=this.observe().subscribe((d,l)=>i(d,l));let u=()=>{a();for(let d of r)d.disposed=!0,d.timer?.cancel();this._storageDisposers.delete(u)};return this._storageDisposers.add(u),{dispose:u}}async _cascadeRestore(e,t){for(let r of e){let s;try{s=await r.load?.()}catch(i){t?.(i,r);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let o=s;try{if(o.mode==="full"&&o.snapshot!=null)return this.restore(o.snapshot),!0;if(o.version===ye&&o.nodes!=null)return this.restore(o),!0}catch(i){t?.(i,r)}}return!1}static async fromStorage(e,t,r){for(let s of t){let o;try{o=await s.load?.()}catch(u){r?.onError?.(u,s);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let i=o,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===ye&&i.nodes!=null?i:void 0;if(a!=null)try{return n.fromSnapshot(a,r)}catch(u){r?.onError?.(u,s)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${e}" across ${t.length} tier(s)`)}_annotations=new Map;_traceRing;trace(e,t,r){if(e!=null&&t!=null){if(this.tryResolve(e)==null)return;if(this._annotations.set(e,t),this.config.inspectorEnabled){let s={path:e,annotation:t,timestamp_ns:Z(),...r?.actor!=null?{actor:r.actor}:{}};this._traceRing.push(s)}return}return e!=null?this.config.inspectorEnabled?this._annotations.get(e):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(e){return this._annotations.get(e)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(e){let t=this._traceRing.toArray().filter(s=>!e(s)),r=this._traceRing.size-t.length;this._traceRing.clear();for(let s of t)this._traceRing.push(s);return r}static diff(e,t){let r=new Set(Object.keys(e.nodes)),s=new Set(Object.keys(t.nodes)),o=[...s].filter(y=>!r.has(y)).sort(),i=[...r].filter(y=>!s.has(y)).sort(),a=[],u=[];for(let y of r){if(!s.has(y))continue;let b=e.nodes[y],v=t.nodes[y],w=b.v,O=v.v;w!=null&&O!=null&&w.id===O.id&&w.version!==O.version&&u.push({path:y,id:w.id,from:w.version,to:O.version});let x=w!=null&&O!=null&&w.id===O.id&&w.version===O.version;for(let k of["type","status","sentinel"]){let R=b[k],A=v[k];R!==A&&a.push({path:y,field:k,from:R,to:A})}if(!x)for(let k of["value","meta"]){let R=b[k],A=v[k];Qn(R,A)||a.push({path:y,field:k,from:R,to:A})}}let d=y=>`${y.from} ${y.to}`,l=new Set(e.edges.map(d)),p=new Set(t.edges.map(d)),h=t.edges.filter(y=>!l.has(d(y))),f=e.edges.filter(y=>!p.has(d(y))),c=new Set(e.subgraphs),m=new Set(t.subgraphs),g=[...m].filter(y=>!c.has(y)).sort(),T=[...c].filter(y=>!m.has(y)).sort();return{nodesAdded:o,nodesRemoved:i,nodesChanged:a,versionChanges:u,edgesAdded:h,edgesRemoved:f,subgraphsAdded:g,subgraphsRemoved:T}}}});function mn(n,e,t){return{[n]:!0,[`${n}_type`]:e,...t??{}}}var bn=I(()=>{"use strict"});var fr={};_n(fr,{feedback:()=>cr,funnel:()=>dr,scorer:()=>lr});module.exports=On(fr);De();ee();be();xe();qt();gn();bn();Oe();ee();function yn(n,e){let t=n.cache??0;return t>=e?!1:(n.down([[U],[M,t+1]]),!0)}var _s=Gt((n,e)=>{n("observe"),n("signal"),e("write")});ht();function vt(n,e){return mn("reduction",n,e)}function dr(n,e,t,r){if(e.length===0)throw new RangeError("funnel requires at least one source");if(t.length===0)throw new RangeError("funnel requires at least one stage");let s=new ve(n,r),o=e.length===1?e[0]:zt(...e);s.add(o,{name:"merged"});let i="merged";for(let a=0;a<t.length;a++){let u=t[a],d=new ve(u.name);u.build(d);try{d.resolve("input")}catch{throw new Error(`funnel stage "${u.name}" must define an "input" node`)}try{d.resolve("output")}catch{throw new Error(`funnel stage "${u.name}" must define an "output" node`)}s.mount(u.name,d);let l=s.resolve(i),p=`${u.name}::input`,h=s.resolve(p),f=`__bridge_${i}\u2192${u.name}_input`,c=$e([l],([m])=>{h.emit(m)},{name:f});s.add(c,{name:f}),s.addDisposer(ue(c)),i=`${u.name}::output`}return s}function cr(n,e,t,r){let s=r?.maxIterations??10,o=`__feedback_${e}`,i=te(0,{meta:vt("feedback_counter",{maxIterations:s,feedbackFrom:e,feedbackTo:t})});n.add(i,{name:o});let a=n.resolve(e),u=n.resolve(t),d=`__feedback_effect_${e}`,l=ie([],(p,h)=>{let f=a.subscribe(c=>{for(let m of c){let g=m[0];if(g===M){let T=m[1];if(T==null)return;Ne(()=>{yn(i,s)&&u.emit(T)})}else if(g===G||g===E){let T=g===E&&m.length>1?[E,m[1]]:[g];i.down([T])}}});return()=>f()},{name:d,describeKind:"effect",meta:{...vt("feedback_effect",{feedbackFrom:e,feedbackTo:t}),_internal:!0}});return n.add(l,{name:d}),n.addDisposer(ue(l)),n}function lr(n,e,t){if(n.length===0)throw new RangeError("scorer requires at least one source");if(n.length!==e.length)throw new RangeError("scorer requires the same number of sources and weights");let r=[...n,...e],s=n.length,o=t?.scoreFns;return ae(r,i=>{let a=i.slice(0,s),u=i.slice(s),d=[],l=0;for(let p=0;p<s;p++){let h=a[p]??0,f=u[p]??0,m=(o?.[p]?o[p](h):h)*f;d.push(m),l+=m}return{value:a,score:l,breakdown:d}},{...t?{equals:t.equals,resubscribable:t.resubscribable,resetOnTeardown:t.resetOnTeardown}:{},describeKind:"derived",meta:vt("scorer",t?.meta)})}0&&(module.exports={feedback,funnel,scorer});
@@ -1,6 +0,0 @@
1
- import '../../node-kK3CvTrR.cjs';
2
- import '../../graph-CWvEUQAq.cjs';
3
- export { F as FeedbackOptions, a as FunnelOptions, b as FunnelStage, S as ScoredItem, c as ScorerOptions, d as StepRef, f as feedback, e as funnel, s as scorer } from '../../index-tRCxuAXF.cjs';
4
- import '../../sugar-DQjFmVqb.cjs';
5
- import '../../extra/storage-core.cjs';
6
- import '../../extra/storage-tiers.cjs';
@@ -1,6 +0,0 @@
1
- import '../../node-kK3CvTrR.js';
2
- import '../../graph-D9LFnda9.js';
3
- export { F as FeedbackOptions, a as FunnelOptions, b as FunnelStage, S as ScoredItem, c as ScorerOptions, d as StepRef, f as feedback, e as funnel, s as scorer } from '../../index-Byu-OpX_.js';
4
- import '../../sugar-fhLIE7TT.js';
5
- import '../../extra/storage-core.js';
6
- import '../../extra/storage-tiers.js';
@@ -1 +0,0 @@
1
- import{a,b,c}from"../../chunk-Z4NPUARF.js";import"../../chunk-W3I423PS.js";import"../../chunk-L6NSJVJZ.js";import"../../chunk-HITNVN6B.js";import"../../chunk-ESMPEKEV.js";import"../../chunk-CLVB32RD.js";import"../../chunk-4VVTGLXJ.js";import"../../chunk-GHBWHMRZ.js";import"../../chunk-YBB7ZGTY.js";import"../../chunk-CRVT7D2P.js";import"../../chunk-NTEURFZH.js";import"../../chunk-CK2E7BTU.js";import"../../chunk-QYADASLV.js";export{b as feedback,a as funnel,c as scorer};