@graphrefly/graphrefly 0.28.0 → 0.29.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 (284) hide show
  1. package/dist/{cascading-D9WG1-9L.d.ts → cascading-Bp99ckMJ.d.ts} +1 -1
  2. package/dist/{cascading-B-5zmAUv.d.cts → cascading-CcAgRacD.d.cts} +1 -1
  3. package/dist/{chunk-XAUNPIMX.js → chunk-22F4K3G7.js} +1 -1
  4. package/dist/chunk-22SVXUPB.js +64 -0
  5. package/dist/{chunk-OAWLCNJJ.js → chunk-2GQREQ6C.js} +1 -1
  6. package/dist/chunk-4JJCCD5S.js +2 -0
  7. package/dist/{chunk-GHJJR5P4.js → chunk-4OFIQ66T.js} +1 -1
  8. package/dist/chunk-4V4C7K56.js +1 -0
  9. package/dist/{chunk-PIOGHC63.js → chunk-567NWZ3T.js} +1 -1
  10. package/dist/chunk-5JDE5JHE.js +1 -0
  11. package/dist/{chunk-ETWTCCJI.js → chunk-5Z4HDCO6.js} +1 -1
  12. package/dist/{chunk-WQ2BN6X6.js → chunk-63FFOHLA.js} +1 -1
  13. package/dist/{chunk-CRXTH3SH.js → chunk-7JDLFI6N.js} +1 -1
  14. package/dist/{chunk-DQA3UIQ2.js → chunk-7TDOES3L.js} +1 -1
  15. package/dist/{chunk-CWLN3X3N.js → chunk-A7IAQQ63.js} +1 -1
  16. package/dist/{chunk-ERLIRFPA.js → chunk-AMG5VBHW.js} +1 -1
  17. package/dist/{chunk-D7A7DBE4.js → chunk-AUY2YKCO.js} +1 -1
  18. package/dist/{chunk-FNYWM6JC.js → chunk-AV3PIDFQ.js} +1 -1
  19. package/dist/{chunk-UMBIDLJ4.js → chunk-BA5URFYW.js} +1 -1
  20. package/dist/chunk-BKPLTBL5.js +1 -0
  21. package/dist/{chunk-UPXUCFMX.js → chunk-BZP5T4X6.js} +1 -1
  22. package/dist/{chunk-S35VARIR.js → chunk-CSJE2EKV.js} +1 -1
  23. package/dist/{chunk-76A3HVQE.js → chunk-E3AXATVZ.js} +1 -1
  24. package/dist/{chunk-LQ3Y5NJS.js → chunk-GJR3P6JG.js} +1 -1
  25. package/dist/{chunk-2FOAM3OR.js → chunk-GNCBXARM.js} +1 -1
  26. package/dist/{chunk-OBKQQA5I.js → chunk-HSIEYSDY.js} +1 -1
  27. package/dist/{chunk-K2GNMCQT.js → chunk-ISCENNXS.js} +1 -1
  28. package/dist/{chunk-OYHGKYQM.js → chunk-JYOUF6UQ.js} +1 -1
  29. package/dist/{chunk-2PMCKKRK.js → chunk-KASHOCF5.js} +1 -1
  30. package/dist/{chunk-MIQTDPY4.js → chunk-LGSNR4LU.js} +1 -1
  31. package/dist/{chunk-UPHHLMHE.js → chunk-LVGBLZM2.js} +1 -1
  32. package/dist/chunk-MGKAO4EK.js +7 -0
  33. package/dist/{chunk-ZV2DXV5A.js → chunk-NSG4C6BF.js} +1 -1
  34. package/dist/{chunk-4GKB4OUJ.js → chunk-OL33ZI6R.js} +1 -1
  35. package/dist/{chunk-3R5HFPX7.js → chunk-PCZ35NXD.js} +1 -1
  36. package/dist/chunk-PGMUCUHG.js +43 -0
  37. package/dist/{chunk-U3AICJKU.js → chunk-RD52SNH2.js} +1 -1
  38. package/dist/{chunk-VTPVOGHH.js → chunk-SLMYTGTU.js} +1 -1
  39. package/dist/{chunk-VPYBOXVT.js → chunk-TWMEGG45.js} +1 -1
  40. package/dist/{chunk-Y2EMPB3I.js → chunk-UVJQ35G2.js} +1 -1
  41. package/dist/{chunk-UWJE5FQA.js → chunk-VGTCGNRX.js} +11 -11
  42. package/dist/{chunk-SC3U7ETD.js → chunk-VWPRPPKR.js} +1 -1
  43. package/dist/chunk-W4TSQ6RJ.js +1 -0
  44. package/dist/{chunk-LBTDSCCO.js → chunk-WM7H7WTY.js} +1 -1
  45. package/dist/{chunk-MTTAAPCK.js → chunk-Y32RJO24.js} +1 -1
  46. package/dist/{chunk-DBGGMN3D.js → chunk-Y53B6NS4.js} +1 -1
  47. package/dist/compat/index.cjs +13 -12
  48. package/dist/compat/index.d.cts +14 -14
  49. package/dist/compat/index.d.ts +14 -14
  50. package/dist/compat/index.js +1 -1
  51. package/dist/compat/jotai/index.cjs +1 -1
  52. package/dist/compat/jotai/index.d.cts +2 -2
  53. package/dist/compat/jotai/index.d.ts +2 -2
  54. package/dist/compat/jotai/index.js +1 -1
  55. package/dist/compat/nanostores/index.cjs +1 -1
  56. package/dist/compat/nanostores/index.d.cts +2 -2
  57. package/dist/compat/nanostores/index.d.ts +2 -2
  58. package/dist/compat/nanostores/index.js +1 -1
  59. package/dist/compat/nestjs/index.cjs +13 -12
  60. package/dist/compat/nestjs/index.d.cts +6 -6
  61. package/dist/compat/nestjs/index.d.ts +6 -6
  62. package/dist/compat/nestjs/index.js +1 -1
  63. package/dist/compat/react/index.d.cts +2 -2
  64. package/dist/compat/react/index.d.ts +2 -2
  65. package/dist/compat/solid/index.d.cts +2 -2
  66. package/dist/compat/solid/index.d.ts +2 -2
  67. package/dist/compat/svelte/index.d.cts +2 -2
  68. package/dist/compat/svelte/index.d.ts +2 -2
  69. package/dist/compat/vue/index.d.cts +2 -2
  70. package/dist/compat/vue/index.d.ts +2 -2
  71. package/dist/compat/zustand/index.cjs +7 -6
  72. package/dist/compat/zustand/index.d.cts +4 -4
  73. package/dist/compat/zustand/index.d.ts +4 -4
  74. package/dist/compat/zustand/index.js +1 -1
  75. package/dist/{composite-BhbKHbOS.d.ts → composite-BL-llbnE.d.ts} +2 -2
  76. package/dist/{composite-B-xqw4Kk.d.cts → composite-Dze--DaA.d.cts} +2 -2
  77. package/dist/core/index.cjs +1 -1
  78. package/dist/core/index.d.cts +4 -4
  79. package/dist/core/index.d.ts +4 -4
  80. package/dist/core/index.js +1 -1
  81. package/dist/extra/browser.cjs +1 -1
  82. package/dist/extra/browser.d.cts +1 -1
  83. package/dist/extra/browser.d.ts +1 -1
  84. package/dist/extra/browser.js +1 -1
  85. package/dist/extra/index.cjs +20 -19
  86. package/dist/extra/index.d.cts +9 -9
  87. package/dist/extra/index.d.ts +9 -9
  88. package/dist/extra/index.js +1 -1
  89. package/dist/extra/node.cjs +3 -3
  90. package/dist/extra/node.d.cts +1 -1
  91. package/dist/extra/node.d.ts +1 -1
  92. package/dist/extra/node.js +1 -1
  93. package/dist/extra/operators.cjs +1 -1
  94. package/dist/extra/operators.d.cts +1 -1
  95. package/dist/extra/operators.d.ts +1 -1
  96. package/dist/extra/operators.js +1 -1
  97. package/dist/extra/reactive.cjs +1 -1
  98. package/dist/extra/reactive.d.cts +3 -3
  99. package/dist/extra/reactive.d.ts +3 -3
  100. package/dist/extra/reactive.js +1 -1
  101. package/dist/extra/sources.cjs +1 -1
  102. package/dist/extra/sources.d.cts +1 -1
  103. package/dist/extra/sources.d.ts +1 -1
  104. package/dist/extra/sources.js +1 -1
  105. package/dist/extra/storage-browser.cjs +1 -1
  106. package/dist/extra/storage-browser.d.cts +1 -1
  107. package/dist/extra/storage-browser.d.ts +1 -1
  108. package/dist/extra/storage-browser.js +1 -1
  109. package/dist/graph/index.cjs +7 -6
  110. package/dist/graph/index.d.cts +5 -5
  111. package/dist/graph/index.d.ts +5 -5
  112. package/dist/graph/index.js +1 -1
  113. package/dist/{graph-D48Qw9Cg.d.cts → graph-DgohqXK-.d.cts} +22 -6
  114. package/dist/{graph-BZGRXwOm.d.ts → graph-Qjg9gWHI.d.ts} +22 -6
  115. package/dist/{index-ZftwfxJM.d.ts → index-2BVuRCI4.d.ts} +7 -7
  116. package/dist/{index-m-yHof5p.d.ts → index-2NvguqQA.d.ts} +4 -4
  117. package/dist/{index-DpHe5e0Q.d.ts → index-A65LZhoM.d.ts} +2 -2
  118. package/dist/{index-cByzxQIC.d.cts → index-B-8FCEua.d.cts} +4 -4
  119. package/dist/{index-8FSVk4Uf.d.ts → index-B-gqvYel.d.ts} +4 -4
  120. package/dist/{index-vscRDkjW.d.cts → index-B2PRuolf.d.cts} +2 -2
  121. package/dist/{index-DAlweici.d.ts → index-BJqt9EwW.d.ts} +2 -2
  122. package/dist/{index-DUqMOlKZ.d.cts → index-BKjT5DiZ.d.cts} +7 -7
  123. package/dist/{index-CMn8S8Hw.d.ts → index-BM8BU4q6.d.ts} +1 -1
  124. package/dist/{index-B1AmmSlb.d.ts → index-BQaEnxBf.d.ts} +1 -1
  125. package/dist/{index-sm373fsH.d.ts → index-BSfwiy5B.d.ts} +2 -2
  126. package/dist/{index-9oDeHH2u.d.cts → index-BTSkeCZs.d.cts} +2 -2
  127. package/dist/{index-rHJSKsU8.d.cts → index-BUVtw1Ay.d.cts} +2 -2
  128. package/dist/{index-BgyGlizc.d.ts → index-BUi57v_p.d.ts} +4 -4
  129. package/dist/{index-DyxjtScX.d.cts → index-BanNUILp.d.cts} +2 -2
  130. package/dist/{index-C73n7lo-.d.cts → index-BayHDRx6.d.cts} +3 -3
  131. package/dist/{index-umtoWT8K.d.ts → index-BiyjsZ0m.d.ts} +6 -5
  132. package/dist/{index-BHvIquRZ.d.ts → index-BqZ6vB2A.d.ts} +592 -492
  133. package/dist/{index-tbf2gKHd.d.cts → index-BuVidq3D.d.cts} +3 -3
  134. package/dist/{index-DaLJvH8Z.d.ts → index-Byh-xTyp.d.ts} +3 -3
  135. package/dist/{index-rX8HBM5h.d.cts → index-C08QPDcV.d.cts} +2 -2
  136. package/dist/{index-CzobVSMr.d.ts → index-C66RJiX8.d.ts} +2 -2
  137. package/dist/{index-CpgYhnrG.d.ts → index-C8RfjffH.d.ts} +2 -2
  138. package/dist/{index-Btib9rsU.d.ts → index-CA1Cu7Ud.d.ts} +275 -9
  139. package/dist/{index-CRO83MmV.d.cts → index-CABbltIu.d.cts} +1 -1
  140. package/dist/{index-B2pwesl9.d.cts → index-CHEBsnYv.d.cts} +1 -1
  141. package/dist/{index-CloUk1kY.d.ts → index-CI0yDnLp.d.ts} +9 -9
  142. package/dist/{index-DiOXyAwt.d.ts → index-CJ45TW-h.d.ts} +1 -1
  143. package/dist/{index-rnwQly8X.d.cts → index-CJZKZoo4.d.cts} +6 -5
  144. package/dist/{index-BwM9BEkt.d.ts → index-CX2tFJL1.d.ts} +1 -1
  145. package/dist/{index-D-YB-Vl3.d.ts → index-CcWOJ6F0.d.ts} +3 -3
  146. package/dist/{index-HDpJe9hX.d.ts → index-CiaVoZGo.d.ts} +3 -3
  147. package/dist/{index-BVHOrDwO.d.ts → index-Ct5CWc4E.d.ts} +1 -1
  148. package/dist/{index-BpIFjILY.d.cts → index-D38duMCv.d.cts} +4 -4
  149. package/dist/{index-ROpQmGjE.d.ts → index-D5XJ2tSx.d.ts} +3 -3
  150. package/dist/{index-Cyojz0AE.d.cts → index-D80do5jX.d.cts} +1 -1
  151. package/dist/{index-pXrDMpRO.d.cts → index-D9HKAH_-.d.cts} +2 -2
  152. package/dist/{index-dtN7YA2x.d.cts → index-DBe_8XW5.d.cts} +3 -3
  153. package/dist/{index-DP4ZTkdw.d.ts → index-DCeTyFlB.d.ts} +3 -3
  154. package/dist/{index-DfyOkTvs.d.ts → index-DDy8eeXS.d.ts} +2 -2
  155. package/dist/{index-Czq6ynh8.d.ts → index-DJ5oNBc8.d.ts} +3 -3
  156. package/dist/{index-fM6y00vT.d.cts → index-DP0_O3ls.d.cts} +3 -3
  157. package/dist/{index-u15meRxL.d.cts → index-DX8xS-yB.d.cts} +2 -2
  158. package/dist/{index-DEwTb_fm.d.cts → index-DiZejfCI.d.cts} +592 -492
  159. package/dist/{index-CHEswufn.d.cts → index-DknyJ2Fu.d.cts} +4 -4
  160. package/dist/{index-DcXZBF5a.d.cts → index-DoWMs-Kk.d.cts} +4 -4
  161. package/dist/{index-B0c4cmIO.d.ts → index-DuB5aO4-.d.ts} +2 -2
  162. package/dist/{index-BpA5c4G9.d.ts → index-DwjJGKxV.d.ts} +4 -4
  163. package/dist/{index-Oi8d8w4R.d.cts → index-H_oxVec5.d.cts} +1 -1
  164. package/dist/{index-Bqachn9_.d.ts → index-IMAHq-ia.d.ts} +1 -1
  165. package/dist/{index-D_NwnRYS.d.cts → index-U1nir7MX.d.cts} +1 -1
  166. package/dist/{index-DraikLjn.d.ts → index-Vg7tORgk.d.ts} +2 -2
  167. package/dist/{index-RukJ4DLS.d.cts → index-dig-r2tQ.d.cts} +275 -9
  168. package/dist/{index-BWJV63ti.d.ts → index-gsT79Xu9.d.ts} +1 -1
  169. package/dist/{index-DxsnAMWD.d.cts → index-i99Ka8s7.d.cts} +9 -9
  170. package/dist/{index-BxJ86YZZ.d.cts → index-iKkyJosF.d.cts} +3 -3
  171. package/dist/{index-B_agccPe.d.cts → index-jleeotBT.d.cts} +1 -1
  172. package/dist/{index-O6TgGUBV.d.cts → index-kykKWwV-.d.cts} +3 -3
  173. package/dist/{index-CEXXwWVH.d.cts → index-vgcLF5TH.d.cts} +2 -2
  174. package/dist/{index-DL-rYJrx.d.cts → index-y1RllPn4.d.cts} +1 -1
  175. package/dist/index.cjs +53 -52
  176. package/dist/index.d.cts +42 -42
  177. package/dist/index.d.ts +42 -42
  178. package/dist/index.js +1 -1
  179. package/dist/{meta-Cgj6zeji.d.cts → meta-CX7YsOzp.d.cts} +1 -1
  180. package/dist/{meta-CwesDrMD.d.ts → meta-CckhhFRd.d.ts} +1 -1
  181. package/dist/{node-Cc1TniY8.d.ts → node-Dd6wHSib.d.cts} +35 -2
  182. package/dist/{node-Cc1TniY8.d.cts → node-Dd6wHSib.d.ts} +35 -2
  183. package/dist/{observable-Ct-gJ9jI.d.ts → observable-BZJgo616.d.ts} +1 -1
  184. package/dist/{observable-glXQoGj2.d.cts → observable-kwzpLvbi.d.cts} +1 -1
  185. package/dist/patterns/ai/browser.d.cts +3 -3
  186. package/dist/patterns/ai/browser.d.ts +3 -3
  187. package/dist/patterns/ai/browser.js +1 -1
  188. package/dist/patterns/ai/index.cjs +25 -24
  189. package/dist/patterns/ai/index.d.cts +15 -15
  190. package/dist/patterns/ai/index.d.ts +15 -15
  191. package/dist/patterns/ai/index.js +1 -1
  192. package/dist/patterns/ai/node.d.cts +1 -1
  193. package/dist/patterns/ai/node.d.ts +1 -1
  194. package/dist/patterns/ai/node.js +1 -1
  195. package/dist/patterns/audit/index.cjs +7 -6
  196. package/dist/patterns/audit/index.d.cts +5 -5
  197. package/dist/patterns/audit/index.d.ts +5 -5
  198. package/dist/patterns/audit/index.js +1 -1
  199. package/dist/patterns/cqrs/index.cjs +7 -6
  200. package/dist/patterns/cqrs/index.d.cts +4 -4
  201. package/dist/patterns/cqrs/index.d.ts +4 -4
  202. package/dist/patterns/cqrs/index.js +1 -1
  203. package/dist/patterns/demo-shell/index.cjs +8 -7
  204. package/dist/patterns/demo-shell/index.d.cts +5 -5
  205. package/dist/patterns/demo-shell/index.d.ts +5 -5
  206. package/dist/patterns/demo-shell/index.js +1 -1
  207. package/dist/patterns/domain-templates/index.cjs +7 -6
  208. package/dist/patterns/domain-templates/index.d.cts +4 -4
  209. package/dist/patterns/domain-templates/index.d.ts +4 -4
  210. package/dist/patterns/domain-templates/index.js +1 -1
  211. package/dist/patterns/graphspec/index.cjs +26 -25
  212. package/dist/patterns/graphspec/index.d.cts +4 -4
  213. package/dist/patterns/graphspec/index.d.ts +4 -4
  214. package/dist/patterns/graphspec/index.js +1 -1
  215. package/dist/patterns/guarded-execution/index.cjs +7 -6
  216. package/dist/patterns/guarded-execution/index.d.cts +6 -6
  217. package/dist/patterns/guarded-execution/index.d.ts +6 -6
  218. package/dist/patterns/guarded-execution/index.js +1 -1
  219. package/dist/patterns/harness/index.cjs +11 -10
  220. package/dist/patterns/harness/index.d.cts +10 -7
  221. package/dist/patterns/harness/index.d.ts +10 -7
  222. package/dist/patterns/harness/index.js +1 -1
  223. package/dist/patterns/job-queue/index.cjs +7 -6
  224. package/dist/patterns/job-queue/index.d.cts +4 -4
  225. package/dist/patterns/job-queue/index.d.ts +4 -4
  226. package/dist/patterns/job-queue/index.js +1 -1
  227. package/dist/patterns/lens/index.cjs +7 -6
  228. package/dist/patterns/lens/index.d.cts +6 -6
  229. package/dist/patterns/lens/index.d.ts +6 -6
  230. package/dist/patterns/lens/index.js +1 -1
  231. package/dist/patterns/memory/index.cjs +7 -6
  232. package/dist/patterns/memory/index.d.cts +4 -4
  233. package/dist/patterns/memory/index.d.ts +4 -4
  234. package/dist/patterns/memory/index.js +1 -1
  235. package/dist/patterns/messaging/index.cjs +7 -6
  236. package/dist/patterns/messaging/index.d.cts +4 -4
  237. package/dist/patterns/messaging/index.d.ts +4 -4
  238. package/dist/patterns/messaging/index.js +1 -1
  239. package/dist/patterns/orchestration/index.cjs +7 -6
  240. package/dist/patterns/orchestration/index.d.cts +5 -5
  241. package/dist/patterns/orchestration/index.d.ts +5 -5
  242. package/dist/patterns/orchestration/index.js +1 -1
  243. package/dist/patterns/reactive-layout/index.cjs +8 -7
  244. package/dist/patterns/reactive-layout/index.d.cts +5 -5
  245. package/dist/patterns/reactive-layout/index.d.ts +5 -5
  246. package/dist/patterns/reactive-layout/index.js +1 -1
  247. package/dist/patterns/reduction/index.cjs +7 -6
  248. package/dist/patterns/reduction/index.d.cts +4 -4
  249. package/dist/patterns/reduction/index.d.ts +4 -4
  250. package/dist/patterns/reduction/index.js +1 -1
  251. package/dist/patterns/refine-loop/index.cjs +9 -8
  252. package/dist/patterns/refine-loop/index.d.cts +5 -5
  253. package/dist/patterns/refine-loop/index.d.ts +5 -5
  254. package/dist/patterns/refine-loop/index.js +1 -1
  255. package/dist/patterns/resilient-pipeline/index.cjs +1 -1
  256. package/dist/patterns/resilient-pipeline/index.d.cts +6 -6
  257. package/dist/patterns/resilient-pipeline/index.d.ts +6 -6
  258. package/dist/patterns/resilient-pipeline/index.js +1 -1
  259. package/dist/patterns/surface/index.cjs +14 -13
  260. package/dist/patterns/surface/index.d.cts +5 -5
  261. package/dist/patterns/surface/index.d.ts +5 -5
  262. package/dist/patterns/surface/index.js +1 -1
  263. package/dist/{reactive-layout-D8u4wuUR.d.ts → reactive-layout-BkBwVvwm.d.ts} +2 -2
  264. package/dist/{reactive-layout-CpYb5qLP.d.cts → reactive-layout-PiFwVaWS.d.cts} +2 -2
  265. package/dist/{reactive-log-YuH9VYN8.d.ts → reactive-log-1QTyx10a.d.ts} +1 -1
  266. package/dist/{reactive-log-DPzuUDj5.d.cts → reactive-log-BiVoSxke.d.cts} +1 -1
  267. package/dist/{reactive-map-DUeRmb9d.d.cts → reactive-map-CwO_COHy.d.cts} +1 -1
  268. package/dist/{reactive-map-CdbNoSgP.d.ts → reactive-map-FeuTVAJb.d.ts} +1 -1
  269. package/dist/{resilience-CGRzhnD3.d.ts → resilience-CBfYJW5C.d.ts} +1 -1
  270. package/dist/{resilience-QAHKANT5.js → resilience-XRUF267O.js} +1 -1
  271. package/dist/{resilience-Ba5-b4WD.d.cts → resilience-uBz4yvYB.d.cts} +1 -1
  272. package/dist/{sugar-BV0htudb.d.cts → sugar-CY-MCfZ9.d.ts} +10 -12
  273. package/dist/{sugar-Dtyrq2_q.d.ts → sugar-DHttV0LX.d.cts} +10 -12
  274. package/dist/{topology-tree-DROUdq5B.d.cts → topology-tree-CVjt2gp7.d.cts} +1 -1
  275. package/dist/{topology-tree-CYHOwQZ_.d.ts → topology-tree-one6oSKY.d.ts} +1 -1
  276. package/package.json +1 -1
  277. package/dist/chunk-6V3SEX2I.js +0 -1
  278. package/dist/chunk-7H6LGFUG.js +0 -64
  279. package/dist/chunk-CKCSDI7T.js +0 -6
  280. package/dist/chunk-QWAPKG3O.js +0 -2
  281. package/dist/chunk-RHESUC3V.js +0 -43
  282. package/dist/chunk-V6YQICXZ.js +0 -1
  283. package/dist/chunk-Z4HDAS2Q.js +0 -1
  284. package/dist/chunk-ZB5EHBIO.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as O,b as H,c as j,d as E,e as W,f as ne}from"./chunk-4JJCCD5S.js";import{a as N}from"./chunk-5Z4HDCO6.js";import{b as X,k as T}from"./chunk-MGKAO4EK.js";import{D as I,E as y,G as L,o as S}from"./chunk-W4TSQ6RJ.js";import{b as te}from"./chunk-QYADASLV.js";var ie={};te(ie,{CanvasMeasureAdapter:()=>$,CliMeasureAdapter:()=>D,ImageSizeAdapter:()=>J,NodeCanvasMeasureAdapter:()=>q,PrecomputedAdapter:()=>V,SvgBoundsAdapter:()=>z,analyzeAndMeasure:()=>O,carveTextLineSlots:()=>E,circleIntervalForBand:()=>Q,computeBlockFlow:()=>_,computeCharPositions:()=>W,computeFlowLines:()=>ee,computeLineBreaks:()=>H,computeTotalHeight:()=>U,layoutNextLine:()=>j,measureBlock:()=>Y,measureBlocks:()=>K,reactiveBlockLayout:()=>re,reactiveFlowLayout:()=>se,reactiveLayout:()=>ne,rectIntervalForBand:()=>Z});var D=class{cellPx;constructor(t){this.cellPx=t?.cellPx??8}measureSegment(t,n){return{width:X(t)*this.cellPx}}},G=class extends Error{name="KeyError"},V=class{metrics;fallback;constructor(t){this.metrics=t.metrics;let n=t.fallback??"per-char";if(n!=="per-char"&&n!=="error")throw new Error(`fallback must be 'per-char' or 'error', got ${JSON.stringify(t.fallback)}`);this.fallback=n}measureSegment(t,n){let i=this.metrics[n];if(i){let o=i[t];if(o!==void 0)return{width:o}}if(this.fallback==="error")throw new G(`PrecomputedAdapter: no metrics for segment ${JSON.stringify(t)} in font ${JSON.stringify(n)}`);let r=0;if(i)for(let o of t){let l=i[o];l!==void 0&&(r+=l)}return{width:r}}},$=class{ctx=null;currentFont="";emojiCorrection;constructor(t){this.emojiCorrection=t?.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(t,n){let i=this.getContext();n!==this.currentFont&&(i.font=n,this.currentFont=n);let r=i.measureText(t).width;return this.emojiCorrection!==1&&new RegExp("\\p{Emoji_Presentation}","u").test(t)&&(r*=this.emojiCorrection),{width:r}}clearCache(){this.currentFont=""}},q=class{ctx=null;currentFont="";canvasModule;constructor(t){this.canvasModule=t}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(t,n){let i=this.getContext();return n!==this.currentFont&&(i.font=n,this.currentFont=n),{width:i.measureText(t).width}}clearCache(){this.currentFont=""}},z=class{measureSvg(t){let n=t.match(/viewBox\s*=\s*["']([^"']+)["']/);if(n){let o=n[1].trim().split(/[\s,]+/);if(o.length>=4){let l=Number.parseFloat(o[2]),a=Number.parseFloat(o[3]);if(Number.isFinite(l)&&Number.isFinite(a)&&l>0&&a>0)return{width:l,height:a};throw new Error("SvgBoundsAdapter: viewBox width/height are missing, non-finite, or not positive")}}let i=t.match(/<svg[^>]*\bwidth\s*=\s*["']?([\d.]+)/),r=t.match(/<svg[^>]*\bheight\s*=\s*["']?([\d.]+)/);if(i&&r){let o=Number.parseFloat(i[1]),l=Number.parseFloat(r[1]);if(Number.isFinite(o)&&Number.isFinite(l)&&o>0&&l>0)return{width:o,height:l};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")}},J=class{sizes;constructor(t){this.sizes=new Map(Object.entries(t))}measureImage(t){let n=this.sizes.get(t);if(!n)throw new Error(`ImageSizeAdapter: no dimensions registered for ${JSON.stringify(t)}`);return{width:n.width,height:n.height}}};function Y(e,t,n,i,r,o,l){switch(e.type){case"text":{let a=e.font??r,m=e.lineHeight??o,d=O(e.text,a,n.text,i),w=H(d,t,n.text,a,i),v=W(w,d,m),B=w.lineCount*m,c=0;for(let x of w.lines)x.width>c&&(c=x.width);return{index:l,type:"text",width:Math.min(c,t),height:B,textSegments:d,textLineBreaks:w,textCharPositions:v}}case"image":{let a,m;if(e.naturalWidth!=null&&e.naturalHeight!=null)a=e.naturalWidth,m=e.naturalHeight;else if(n.image){let d=n.image.measureImage(e.src);a=d.width,m=d.height}else throw new Error(`Image block at index ${l} has no naturalWidth/naturalHeight and no ImageMeasurer adapter`);return a>t&&(m=m*t/a,a=t),{index:l,type:"image",width:a,height:m}}case"svg":{let a,m;if(e.viewBox)a=e.viewBox.width,m=e.viewBox.height;else if(n.svg){let d=n.svg.measureSvg(e.content);a=d.width,m=d.height}else throw new Error(`SVG block at index ${l} has no viewBox and no SvgMeasurer adapter`);return a>t&&(m=m*t/a,a=t),{index:l,type:"svg",width:a,height:m}}}}function K(e,t,n,i,r,o){return e.map((l,a)=>Y(l,t,n,i,r,o,a))}function _(e,t){let n=[],i=0;for(let r=0;r<e.length;r++){let o=e[r];n.push({...o,x:0,y:i}),i+=o.height+(r<e.length-1?t:0)}return n}function U(e){if(e.length===0)return 0;let t=e[e.length-1];return t.y+t.height}function re(e){let{adapters:t,name:n="reactive-block-layout",defaultFont:i="16px sans-serif",defaultLineHeight:r=20}=e,o=new T(n),l=new Map,a=y(e.blocks??[],{name:"blocks"}),m=y(Math.max(0,e.maxWidth??800),{name:"max-width"}),d=y(e.gap??0,{name:"gap"}),w=I([a,m],(c,x,s)=>{let p=c[0]!=null&&c[0].length>0?c[0].at(-1):s.prevData[0],h=c[1]!=null&&c[1].length>0?c[1].at(-1):s.prevData[1],g=S(),u=K(p,h,t,l,i,r),f=S()-g,b=w.meta;b&&(N(b["block-count"],u.length),N(b["layout-time-ns"],f)),x.emit(u);let C=()=>{l.clear(),t.text.clearCache?.()};return{deactivate:C,invalidate:C}},{name:"measured-blocks",describeKind:"derived",meta:{"block-count":0,"layout-time-ns":0},equals:(c,x)=>{let s=c,p=x;if(s==null||p==null)return s===p;if(s.length!==p.length)return!1;for(let h=0;h<s.length;h++){let g=s[h],u=p[h];if(g.type!==u.type||g.width!==u.width||g.height!==u.height||g.index!==u.index)return!1}return!0}}),v=L([w,d],([c,x])=>_(c,x),{name:"block-flow",equals:(c,x)=>{let s=c,p=x;if(s==null||p==null)return s===p;if(s.length!==p.length)return!1;for(let h=0;h<s.length;h++){let g=s[h],u=p[h];if(g.x!==u.x||g.y!==u.y||g.width!==u.width||g.height!==u.height)return!1}return!0}}),B=L([v],([c])=>U(c),{name:"total-height"});return o.add(a,{name:"blocks"}),o.add(m,{name:"max-width"}),o.add(d,{name:"gap"}),o.add(w,{name:"measured-blocks"}),o.add(v,{name:"block-flow"}),o.add(B,{name:"total-height"}),{graph:o,setBlocks:c=>o.set("blocks",c),setMaxWidth:c=>o.set("max-width",Math.max(0,c)),setGap:c=>o.set("gap",c),measuredBlocks:w,blockFlow:v,totalHeight:B}}function Q(e,t,n){let i=e.hPad??0,r=e.vPad??0,o=t-r,l=n+r;if(o>=e.cy+e.r||l<=e.cy-e.r)return null;let a=e.cy>=o&&e.cy<=l?0:e.cy<o?o-e.cy:e.cy-l;if(a>=e.r)return null;let m=Math.sqrt(e.r*e.r-a*a);return{left:e.cx-m-i,right:e.cx+m+i}}function Z(e,t,n){let i=e.hPad??0,r=e.vPad??0;return n<=e.y-r||t>=e.y+e.h+r?null:{left:e.x-i,right:e.x+e.w+i}}function oe(e,t,n){return e.kind==="circle"?Q(e,t,n):Z(e,t,n)}function ee(e,t,n,i,r,o,l){let a=l?.paragraphSpacing??r,m=[],d={segmentIndex:0,graphemeIndex:0};if(e.length===0||n.count<=0||r<=0)return{lines:m,cursor:d};let w=t.paddingX??0,v=t.paddingY??0,B=Math.max(0,t.width-w*2),c=Math.max(0,t.height-v*2),x=n.gap*Math.max(0,n.count-1),s=Math.max(0,(B-x)/n.count);if(s<=0)return{lines:m,cursor:d};e:for(let p=0;p<n.count;p++){let h=w+p*(s+n.gap),g=h+s,u=v;for(;u+r<=v+c;){let f=u+r,b=[];for(let k=0;k<i.length;k++){let M=oe(i[k],u,f);M!==null&&b.push(M)}let C=E({left:h,right:g},b,o);if(C.length===0){u+=r;continue}let P=!1;for(let k=0;k<C.length;k++){let M=C[k],R=M.right-M.left,F=j(e,d,R);if(F===null)return{lines:m,cursor:d};if(F.text.length===0&&F.width===0){d=F.end,P=!0;break}m.push({x:M.left,y:u,width:F.width,slotWidth:R,text:F.text,columnIndex:p,flushToRight:M.right<g-.5}),d=F.end}if(P){u+=a;continue}if(u+=r,d.segmentIndex>=e.length)break e}if(d.segmentIndex>=e.length)break}return{lines:m,cursor:d}}function se(e){let{adapter:t,name:n="reactive-flow-layout",minSlotWidth:i=20}=e,r=new T(n),o=new Map,l=y(e.text??"",{name:"text"}),a=y(e.font??"16px sans-serif",{name:"font"}),m=y(e.lineHeight??20,{name:"line-height"}),d=y(e.container??{width:800,height:600,paddingX:0,paddingY:0},{name:"container"}),w=y(e.columns??{count:1,gap:0},{name:"columns"}),v=y(e.obstacles??[],{name:"obstacles"}),B=y(e.paragraphSpacing??null,{name:"paragraph-spacing"}),c=I([l,a],(s,p,h)=>{let g=s[0],u=g!=null&&g.length>0?g.at(-1):h.prevData[0],f=s[1],b=f!=null&&f.length>0?f.at(-1):h.prevData[1],C=O(u,b,t,o);p.emit(C);let P=()=>{o.clear(),t.clearCache?.()};return{deactivate:P,invalidate:P}},{name:"segments",describeKind:"derived"}),x=L([c,d,w,v,m,B],([s,p,h,g,u,f])=>{let b=s,C=S(),P=f??u,{lines:k,cursor:M}=ee(b,p,h,g,u,i,{paragraphSpacing:P}),R=S()-C,F=Math.max(0,b.length-M.segmentIndex),A=x.meta;return A&&(N(A["line-count"],k.length),N(A["layout-time-ns"],R),N(A["overflow-segments"],F)),k},{name:"flow-lines",meta:{"line-count":0,"layout-time-ns":0,"overflow-segments":0},equals:(s,p)=>{let h=s,g=p;if(h.length!==g.length)return!1;for(let u=0;u<h.length;u++){let f=h[u],b=g[u];if(f.x!==b.x||f.y!==b.y||f.width!==b.width||f.slotWidth!==b.slotWidth||f.text!==b.text||f.columnIndex!==b.columnIndex||f.flushToRight!==b.flushToRight)return!1}return!0}});return r.add(l,{name:"text"}),r.add(a,{name:"font"}),r.add(m,{name:"line-height"}),r.add(d,{name:"container"}),r.add(w,{name:"columns"}),r.add(v,{name:"obstacles"}),r.add(B,{name:"paragraph-spacing"}),r.add(c,{name:"segments"}),r.add(x,{name:"flow-lines"}),{graph:r,setText:s=>r.set("text",s),setFont:s=>r.set("font",s),setLineHeight:s=>r.set("line-height",s),setContainer:s=>r.set("container",s),setColumns:s=>r.set("columns",s),setObstacles:s=>r.set("obstacles",s),setParagraphSpacing:s=>r.set("paragraph-spacing",s),segments:c,flowLines:x}}export{D as a,V as b,$ as c,q as d,z as e,J as f,Y as g,K as h,_ as i,U as j,re as k,Q as l,Z as m,ee as n,se as o,ie as p};
@@ -1 +1 @@
1
- import{E as p,I as A,m as l}from"./chunk-ZB5EHBIO.js";import{b as c,j as N}from"./chunk-CK2E7BTU.js";import{b as x}from"./chunk-QYADASLV.js";var B={};x(B,{action:()=>M,atom:()=>S,computed:()=>k,getValue:()=>_,map:()=>R,onMount:()=>w,onStart:()=>v,onStop:()=>g});var T=new WeakMap,f=new WeakMap;function d(e,t){let o=t.get(e);if(o)for(let n of o)n()}function m(e,t={}){let o=0;return{...t,get:()=>b(e),subscribe:a=>{o===0&&d(e,T),o++;let r=e.subscribe(s=>{for(let[i,u]of s)i===c&&a(u)});return()=>{r(),o--,o===0&&d(e,f)}},listen:a=>{o===0&&d(e,T),o++;let r=!0,s=e.subscribe(i=>{for(let[u,C]of i)if(u===c){if(r){r=!1;continue}a(C)}});return()=>{s(),o--,o===0&&d(e,f)}},_node:e}}function y(e){let t=e.cache,o;if(e.subscribe(a=>{for(let[r,s]of a)r===c&&(t=s),r===N&&(o=s)})(),o)throw o;return t}function b(e){return e.status==="sentinel"?y(e):e.cache}function S(e){let t=p(e,{resubscribable:!0,resetOnTeardown:!0});return m(t,{set:o=>t.emit(o)})}function k(e,t){let o=Array.isArray(e)?e:[e],n=o.map(r=>r._node),a=A(n,r=>{let s=o.map(i=>{let u=i._node;return u.status==="sentinel"&&y(u),r(u)});return t(...s)},{resubscribable:!0,resetOnTeardown:!0,equals:Object.is});return m(a)}function R(e){let t=p(e,{resubscribable:!0,resetOnTeardown:!0,equals:()=>!1});return m(t,{set:o=>t.emit(o),setKey:(o,n)=>{let a=b(t);t.emit({...a,[o]:n})}})}function _(e){return e.get()}function v(e,t){let o=e._node,n=T.get(o);n||(n=new Set,T.set(o,n)),n.add(t)}function g(e,t){let o=e._node,n=f.get(o);n||(n=new Set,f.set(o,n)),n.add(t)}function w(e,t){v(e,()=>{let o=t();typeof o=="function"&&g(e,o)})}function M(e,t,o){return(...n)=>{let a;return l(()=>{a=o(...n)}),a}}export{S as a,k as b,R as c,_ as d,v as e,g as f,w as g,M as h,B as i};
1
+ import{E as p,I as A,m as l}from"./chunk-W4TSQ6RJ.js";import{b as c,j as N}from"./chunk-CK2E7BTU.js";import{b as x}from"./chunk-QYADASLV.js";var B={};x(B,{action:()=>M,atom:()=>S,computed:()=>k,getValue:()=>_,map:()=>R,onMount:()=>w,onStart:()=>v,onStop:()=>g});var T=new WeakMap,f=new WeakMap;function d(e,t){let o=t.get(e);if(o)for(let n of o)n()}function m(e,t={}){let o=0;return{...t,get:()=>b(e),subscribe:a=>{o===0&&d(e,T),o++;let r=e.subscribe(s=>{for(let[i,u]of s)i===c&&a(u)});return()=>{r(),o--,o===0&&d(e,f)}},listen:a=>{o===0&&d(e,T),o++;let r=!0,s=e.subscribe(i=>{for(let[u,C]of i)if(u===c){if(r){r=!1;continue}a(C)}});return()=>{s(),o--,o===0&&d(e,f)}},_node:e}}function y(e){let t=e.cache,o;if(e.subscribe(a=>{for(let[r,s]of a)r===c&&(t=s),r===N&&(o=s)})(),o)throw o;return t}function b(e){return e.status==="sentinel"?y(e):e.cache}function S(e){let t=p(e,{resubscribable:!0,resetOnTeardown:!0});return m(t,{set:o=>t.emit(o)})}function k(e,t){let o=Array.isArray(e)?e:[e],n=o.map(r=>r._node),a=A(n,r=>{let s=o.map(i=>{let u=i._node;return u.status==="sentinel"&&y(u),r(u)});return t(...s)},{resubscribable:!0,resetOnTeardown:!0,equals:Object.is});return m(a)}function R(e){let t=p(e,{resubscribable:!0,resetOnTeardown:!0,equals:()=>!1});return m(t,{set:o=>t.emit(o),setKey:(o,n)=>{let a=b(t);t.emit({...a,[o]:n})}})}function _(e){return e.get()}function v(e,t){let o=e._node,n=T.get(o);n||(n=new Set,T.set(o,n)),n.add(t)}function g(e,t){let o=e._node,n=f.get(o);n||(n=new Set,f.set(o,n)),n.add(t)}function w(e,t){v(e,()=>{let o=t();typeof o=="function"&&g(e,o)})}function M(e,t,o){return(...n)=>{let a;return l(()=>{a=o(...n)}),a}}export{S as a,k as b,R as c,_ as d,v as e,g as f,w as g,M as h,B as i};
@@ -1 +1 @@
1
- import{c as f}from"./chunk-ERLIRFPA.js";import{a as l,d as o,e as d,h as s,i as m,k as b,l as c}from"./chunk-4GKB4OUJ.js";import{a as r,b as u}from"./chunk-4VVTGLXJ.js";import{b as y}from"./chunk-QYADASLV.js";var R={};y(R,{NS_PER_MS:()=>r,NS_PER_SEC:()=>u,resilientPipeline:()=>O});function O(p,e={}){let t=p;e.rateLimit!=null&&(t=s(t,e.rateLimit)),e.budget!=null&&e.budget.length>0&&(t=f(t,e.budget));let n;if(e.breaker!=null){let k=o(e.breaker),S=e.breakerOnOpen??"skip",a=d(k,{onOpen:S})(t);t=a.node,n=a.breakerState}if(e.timeoutMs!=null){if(e.timeoutMs<=0)throw new RangeError("timeoutMs must be > 0");if(e.timeoutMs>9e6)throw new RangeError("timeoutMs must be <= 9_000_000 (\u22482.5h) to stay within safe ns arithmetic");t=c(t,e.timeoutMs*1e6)}e.retry!=null&&(t=l(t,e.retry)),e.fallback!==void 0&&(t=b(t,e.fallback));let i=m(t,{initialStatus:e.initialStatus??"pending"});return{node:i.node,status:i.status,error:i.error,breakerState:n}}export{O as a,R as b};
1
+ import{c as f}from"./chunk-AMG5VBHW.js";import{a as l,d as o,e as d,h as s,i as m,k as b,l as c}from"./chunk-OL33ZI6R.js";import{a as r,b as u}from"./chunk-4VVTGLXJ.js";import{b as y}from"./chunk-QYADASLV.js";var R={};y(R,{NS_PER_MS:()=>r,NS_PER_SEC:()=>u,resilientPipeline:()=>O});function O(p,e={}){let t=p;e.rateLimit!=null&&(t=s(t,e.rateLimit)),e.budget!=null&&e.budget.length>0&&(t=f(t,e.budget));let n;if(e.breaker!=null){let k=o(e.breaker),S=e.breakerOnOpen??"skip",a=d(k,{onOpen:S})(t);t=a.node,n=a.breakerState}if(e.timeoutMs!=null){if(e.timeoutMs<=0)throw new RangeError("timeoutMs must be > 0");if(e.timeoutMs>9e6)throw new RangeError("timeoutMs must be <= 9_000_000 (\u22482.5h) to stay within safe ns arithmetic");t=c(t,e.timeoutMs*1e6)}e.retry!=null&&(t=l(t,e.retry)),e.fallback!==void 0&&(t=b(t,e.fallback));let i=m(t,{initialStatus:e.initialStatus??"pending"});return{node:i.node,status:i.status,error:i.error,breakerState:n}}export{O as a,R as b};
@@ -1,4 +1,4 @@
1
- import{c as ce}from"./chunk-6V3SEX2I.js";import{a as se,b as P}from"./chunk-5QDBSZBV.js";import{j as L}from"./chunk-CKCSDI7T.js";import{f as ae,h as ie}from"./chunk-2PMCKKRK.js";import{i as ne,j as U}from"./chunk-ZB5EHBIO.js";import{b,h as _,i as T,j as W}from"./chunk-CK2E7BTU.js";import{b as Oe,c as re,d as te,e as oe}from"./chunk-QYADASLV.js";var ke={};Oe(ke,{ACTOR_KEY:()=>F,COMMAND_HANDLERS:()=>A,CQRS_EVENT_HANDLERS:()=>S,CRON_HANDLERS:()=>D,CommandHandler:()=>me,EVENT_HANDLERS:()=>G,EventHandler:()=>ve,GRAPHREFLY_REQUEST_GRAPH:()=>R,GRAPHREFLY_ROOT_GRAPH:()=>v,GraphCron:()=>fe,GraphInterval:()=>he,GraphReflyEventExplorer:()=>x,GraphReflyGuard:()=>Re,GraphReflyGuardImpl:()=>I,GraphReflyModule:()=>Q,INTERVAL_HANDLERS:()=>O,InjectCqrsGraph:()=>de,InjectGraph:()=>ue,InjectNode:()=>pe,ObserveGateway:()=>B,OnGraphEvent:()=>le,QUERY_HANDLERS:()=>H,QueryHandler:()=>ye,SAGA_HANDLERS:()=>N,SagaHandler:()=>ge,fromHeader:()=>Ee,fromJwtPayload:()=>V,getActor:()=>we,getGraphToken:()=>m,getNodeToken:()=>y,observeSSE:()=>Me,observeSubscription:()=>Ce,toObservable:()=>se});import{Inject as j}from"@nestjs/common";var v=Symbol.for("graphrefly:root-graph");var R=Symbol.for("graphrefly:request-graph");function m(s){return Symbol.for(`graphrefly:graph:${s}`)}function y(s){return Symbol.for(`graphrefly:node:${s}`)}var G=new Map,O=new Map,D=new Map,A=new Map,S=new Map,H=new Map,N=new Map;function ue(s){return s==="request"?j(R):j(s?m(s):v)}function de(s){return j(m(s))}function pe(s){return j(y(s))}function le(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=G.get(o)??[];n.push({nodeName:s,methodKey:t}),G.set(o,n)})}}function he(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=O.get(o)??[];n.push({ms:s,methodKey:t}),O.set(o,n)})}}function fe(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=D.get(o)??[];n.push({expr:s,methodKey:t}),D.set(o,n)})}}function me(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=A.get(n)??[];a.push({cqrsName:s,commandName:e,methodKey:o}),A.set(n,a)})}}function ve(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=S.get(n)??[];a.push({cqrsName:s,eventName:e,methodKey:o}),S.set(n,a)})}}function ye(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=H.get(n)??[];a.push({cqrsName:s,projectionName:e,methodKey:o}),H.set(n,a)})}}function ge(s,e,r){return(t,o)=>{let n=o.name;o.addInitializer(function(){let a=this.constructor,c=N.get(a)??[];c.push({cqrsName:s,eventNames:r,sagaName:e,methodKey:n}),N.set(a,c)})}}var be=0,x=class{constructor(e,r){this.graph=e;this.moduleRef=r}disposers=[];scheduleNodeNames=[];onModuleInit(){this.wireEvents(),this.wireIntervals(),this.wireCrons(),this.wireCqrsCommands(),this.wireCqrsEvents(),this.wireCqrsQueries(),this.wireCqrsSagas()}onModuleDestroy(){for(let e of this.disposers)e();this.disposers.length=0;for(let e of this.scheduleNodeNames)try{this.graph.remove(e)}catch{}this.scheduleNodeNames.length=0}wireEvents(){for(let[e,r]of G){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireEventHandler(t,o)}}wireEventHandler(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),a=this.observeNode(r.nodeName).subscribe(c=>{for(let l of c)l[0]===b&&o(l[1])});this.disposers.push(a)}wireIntervals(){for(let[e,r]of O){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireIntervalHandler(t,e,o)}}wireIntervalHandler(e,r,t){let o=e[t.methodKey];if(typeof o!="function")return;let n=o.bind(e),c=`__schedule__.${r.name??"anonymous"}.${String(t.methodKey)}.${be++}`,l=ae(t.ms,{period:t.ms,name:c});this.graph.add(l),this.scheduleNodeNames.push(c);let p=this.observeNode(c).subscribe(u=>{for(let d of u)d[0]===b&&n(d[1])});this.disposers.push(p)}wireCrons(){for(let[e,r]of D){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCronHandler(t,e,o)}}wireCronHandler(e,r,t){let o=e[t.methodKey];if(typeof o!="function")return;let n=o.bind(e),c=`__schedule__.${r.name??"anonymous"}.${String(t.methodKey)}.${be++}`,l=ie(t.expr,{name:c});this.graph.add(l),this.scheduleNodeNames.push(c);let p=this.observeNode(c).subscribe(u=>{for(let d of u)d[0]===b&&n(d[1])});this.disposers.push(p)}wireCqrsCommands(){for(let[e,r]of A){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsCommand(t,o)}}wireCqrsCommand(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);n&&n.command(r.commandName,o)}wireCqrsEvents(){for(let[e,r]of S){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsEventHandler(t,o)}}wireCqrsEventHandler(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);if(!n)return;n.event(r.eventName);let c=n.resolve(r.eventName).cache,l=c&&c.length>0?c[c.length-1].seq:0,p=this.observeNodeOn(n,r.eventName).subscribe(u=>{for(let d of u)if(d[0]===b){let g=d[1];for(let i of g)i.seq>l&&(o(i),l=i.seq)}});this.disposers.push(p)}wireCqrsQueries(){for(let[e,r]of H){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsQuery(t,o)}}wireCqrsQuery(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);if(!n)return;let c=this.observeNodeOn(n,r.projectionName).subscribe(l=>{for(let f of l)f[0]===b&&o(f[1])});this.disposers.push(c)}wireCqrsSagas(){for(let[e,r]of N){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsSaga(t,o)}}wireCqrsSaga(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);n&&n.saga(r.sagaName,r.eventNames,o)}observeNode(e){return this.graph.observe(e)}observeNodeOn(e,r){return e.observe(r)}resolveCqrsGraph(e){try{return this.moduleRef.get(m(e),{strict:!1})}catch{return console.warn(`[GraphReFly] CqrsGraph "${e}" not found in DI \u2014 did you import GraphReflyModule.forCqrs({ name: "${e}" })?`),null}}resolveInstance(e){try{return this.moduleRef.get(e,{strict:!1})}catch{return null}}};function Me(s,e,r){let{actor:t,serialize:o=De,keepAliveMs:n,signal:a}=r??{},c=new TextEncoder,l,f=r?.highWaterMark!=null,p,u,d=[],g=!1;return new ReadableStream({start(i){let h,w=()=>{},M=()=>{if(!g){g=!0,h!==void 0&&clearInterval(h),a?.removeEventListener("abort",K),w(),p?.dispose(),u?.(),u=void 0;for(let k of d)i.enqueue(k.frame);d.length=0,i.close()}};l=M;let K=()=>M(),ee=s.observe(e,{actor:t});f&&(p=P(k=>ee.up(k),{highWaterMark:r.highWaterMark,lowWaterMark:r.lowWaterMark??Math.floor(r.highWaterMark/2)})),w=ee.subscribe(k=>{for(let $ of k){if(g)return;let q=$[0];if(q===b){let C=c.encode(Y("data",o($[1])));f?(d.push({frame:C,counted:!0}),p.onEnqueue(),u?.(),u=void 0):i.enqueue(C)}else if(q===W){let C=c.encode(Y("error",o($[1])));f?(d.push({frame:C,counted:!1}),u?.(),u=void 0):i.enqueue(C),M();return}else if(q===T||q===_){if(q===T){let C=c.encode(Y("complete"));f?(d.push({frame:C,counted:!1}),u?.(),u=void 0):i.enqueue(C)}M();return}}}),n!==void 0&&n>0&&(h=setInterval(()=>{g||(f?(d.push({frame:c.encode(`: keepalive
1
+ import{c as ce}from"./chunk-4V4C7K56.js";import{a as se,b as P}from"./chunk-5QDBSZBV.js";import{k as L}from"./chunk-MGKAO4EK.js";import{f as ae,h as ie}from"./chunk-KASHOCF5.js";import{i as ne,j as U}from"./chunk-W4TSQ6RJ.js";import{b,h as _,i as T,j as W}from"./chunk-CK2E7BTU.js";import{b as Oe,c as re,d as te,e as oe}from"./chunk-QYADASLV.js";var ke={};Oe(ke,{ACTOR_KEY:()=>F,COMMAND_HANDLERS:()=>A,CQRS_EVENT_HANDLERS:()=>S,CRON_HANDLERS:()=>D,CommandHandler:()=>me,EVENT_HANDLERS:()=>G,EventHandler:()=>ve,GRAPHREFLY_REQUEST_GRAPH:()=>R,GRAPHREFLY_ROOT_GRAPH:()=>v,GraphCron:()=>fe,GraphInterval:()=>he,GraphReflyEventExplorer:()=>x,GraphReflyGuard:()=>Re,GraphReflyGuardImpl:()=>I,GraphReflyModule:()=>Q,INTERVAL_HANDLERS:()=>O,InjectCqrsGraph:()=>de,InjectGraph:()=>ue,InjectNode:()=>pe,ObserveGateway:()=>B,OnGraphEvent:()=>le,QUERY_HANDLERS:()=>H,QueryHandler:()=>ye,SAGA_HANDLERS:()=>N,SagaHandler:()=>ge,fromHeader:()=>Ee,fromJwtPayload:()=>V,getActor:()=>we,getGraphToken:()=>m,getNodeToken:()=>y,observeSSE:()=>Me,observeSubscription:()=>Ce,toObservable:()=>se});import{Inject as j}from"@nestjs/common";var v=Symbol.for("graphrefly:root-graph");var R=Symbol.for("graphrefly:request-graph");function m(s){return Symbol.for(`graphrefly:graph:${s}`)}function y(s){return Symbol.for(`graphrefly:node:${s}`)}var G=new Map,O=new Map,D=new Map,A=new Map,S=new Map,H=new Map,N=new Map;function ue(s){return s==="request"?j(R):j(s?m(s):v)}function de(s){return j(m(s))}function pe(s){return j(y(s))}function le(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=G.get(o)??[];n.push({nodeName:s,methodKey:t}),G.set(o,n)})}}function he(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=O.get(o)??[];n.push({ms:s,methodKey:t}),O.set(o,n)})}}function fe(s){return(e,r)=>{let t=r.name;r.addInitializer(function(){let o=this.constructor,n=D.get(o)??[];n.push({expr:s,methodKey:t}),D.set(o,n)})}}function me(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=A.get(n)??[];a.push({cqrsName:s,commandName:e,methodKey:o}),A.set(n,a)})}}function ve(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=S.get(n)??[];a.push({cqrsName:s,eventName:e,methodKey:o}),S.set(n,a)})}}function ye(s,e){return(r,t)=>{let o=t.name;t.addInitializer(function(){let n=this.constructor,a=H.get(n)??[];a.push({cqrsName:s,projectionName:e,methodKey:o}),H.set(n,a)})}}function ge(s,e,r){return(t,o)=>{let n=o.name;o.addInitializer(function(){let a=this.constructor,c=N.get(a)??[];c.push({cqrsName:s,eventNames:r,sagaName:e,methodKey:n}),N.set(a,c)})}}var be=0,x=class{constructor(e,r){this.graph=e;this.moduleRef=r}disposers=[];scheduleNodeNames=[];onModuleInit(){this.wireEvents(),this.wireIntervals(),this.wireCrons(),this.wireCqrsCommands(),this.wireCqrsEvents(),this.wireCqrsQueries(),this.wireCqrsSagas()}onModuleDestroy(){for(let e of this.disposers)e();this.disposers.length=0;for(let e of this.scheduleNodeNames)try{this.graph.remove(e)}catch{}this.scheduleNodeNames.length=0}wireEvents(){for(let[e,r]of G){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireEventHandler(t,o)}}wireEventHandler(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),a=this.observeNode(r.nodeName).subscribe(c=>{for(let l of c)l[0]===b&&o(l[1])});this.disposers.push(a)}wireIntervals(){for(let[e,r]of O){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireIntervalHandler(t,e,o)}}wireIntervalHandler(e,r,t){let o=e[t.methodKey];if(typeof o!="function")return;let n=o.bind(e),c=`__schedule__.${r.name??"anonymous"}.${String(t.methodKey)}.${be++}`,l=ae(t.ms,{period:t.ms,name:c});this.graph.add(l),this.scheduleNodeNames.push(c);let p=this.observeNode(c).subscribe(u=>{for(let d of u)d[0]===b&&n(d[1])});this.disposers.push(p)}wireCrons(){for(let[e,r]of D){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCronHandler(t,e,o)}}wireCronHandler(e,r,t){let o=e[t.methodKey];if(typeof o!="function")return;let n=o.bind(e),c=`__schedule__.${r.name??"anonymous"}.${String(t.methodKey)}.${be++}`,l=ie(t.expr,{name:c});this.graph.add(l),this.scheduleNodeNames.push(c);let p=this.observeNode(c).subscribe(u=>{for(let d of u)d[0]===b&&n(d[1])});this.disposers.push(p)}wireCqrsCommands(){for(let[e,r]of A){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsCommand(t,o)}}wireCqrsCommand(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);n&&n.command(r.commandName,o)}wireCqrsEvents(){for(let[e,r]of S){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsEventHandler(t,o)}}wireCqrsEventHandler(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);if(!n)return;n.event(r.eventName);let c=n.resolve(r.eventName).cache,l=c&&c.length>0?c[c.length-1].seq:0,p=this.observeNodeOn(n,r.eventName).subscribe(u=>{for(let d of u)if(d[0]===b){let g=d[1];for(let i of g)i.seq>l&&(o(i),l=i.seq)}});this.disposers.push(p)}wireCqrsQueries(){for(let[e,r]of H){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsQuery(t,o)}}wireCqrsQuery(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);if(!n)return;let c=this.observeNodeOn(n,r.projectionName).subscribe(l=>{for(let f of l)f[0]===b&&o(f[1])});this.disposers.push(c)}wireCqrsSagas(){for(let[e,r]of N){let t=this.resolveInstance(e);if(t)for(let o of r)this.wireCqrsSaga(t,o)}}wireCqrsSaga(e,r){let t=e[r.methodKey];if(typeof t!="function")return;let o=t.bind(e),n=this.resolveCqrsGraph(r.cqrsName);n&&n.saga(r.sagaName,r.eventNames,o)}observeNode(e){return this.graph.observe(e)}observeNodeOn(e,r){return e.observe(r)}resolveCqrsGraph(e){try{return this.moduleRef.get(m(e),{strict:!1})}catch{return console.warn(`[GraphReFly] CqrsGraph "${e}" not found in DI \u2014 did you import GraphReflyModule.forCqrs({ name: "${e}" })?`),null}}resolveInstance(e){try{return this.moduleRef.get(e,{strict:!1})}catch{return null}}};function Me(s,e,r){let{actor:t,serialize:o=De,keepAliveMs:n,signal:a}=r??{},c=new TextEncoder,l,f=r?.highWaterMark!=null,p,u,d=[],g=!1;return new ReadableStream({start(i){let h,w=()=>{},M=()=>{if(!g){g=!0,h!==void 0&&clearInterval(h),a?.removeEventListener("abort",K),w(),p?.dispose(),u?.(),u=void 0;for(let k of d)i.enqueue(k.frame);d.length=0,i.close()}};l=M;let K=()=>M(),ee=s.observe(e,{actor:t});f&&(p=P(k=>ee.up(k),{highWaterMark:r.highWaterMark,lowWaterMark:r.lowWaterMark??Math.floor(r.highWaterMark/2)})),w=ee.subscribe(k=>{for(let $ of k){if(g)return;let q=$[0];if(q===b){let C=c.encode(Y("data",o($[1])));f?(d.push({frame:C,counted:!0}),p.onEnqueue(),u?.(),u=void 0):i.enqueue(C)}else if(q===W){let C=c.encode(Y("error",o($[1])));f?(d.push({frame:C,counted:!1}),u?.(),u=void 0):i.enqueue(C),M();return}else if(q===T||q===_){if(q===T){let C=c.encode(Y("complete"));f?(d.push({frame:C,counted:!1}),u?.(),u=void 0):i.enqueue(C)}M();return}}}),n!==void 0&&n>0&&(h=setInterval(()=>{g||(f?(d.push({frame:c.encode(`: keepalive
2
2
 
3
3
  `),counted:!1}),u?.(),u=void 0):i.enqueue(c.encode(`: keepalive
4
4
 
@@ -1 +1 @@
1
- import{j as _}from"./chunk-CKCSDI7T.js";import{D as g,E as k}from"./chunk-ZB5EHBIO.js";import{b as R,c as T,d,h as A,i as O,j as D}from"./chunk-CK2E7BTU.js";function L(c,y,l,a){let s=new _(c,a);s.add(y,{name:"source"});let n=k(l,{meta:{kind:"stratify_rules"}});s.add(n,{name:"rules"});for(let f of l)E(s,y,n,f);return s}function E(c,y,l,a){let s=`branch/${a.name}`,n=Symbol("noValue"),f=!1,m=!1,p=!1,N=n,r=!1,h=l.cache??[];function v(o){if(p){p=!1;let t=N;if(N=n,t!==n){let i=h.find(u=>u.name===a.name),e=!1;try{e=i?.classify(t)??!1}catch{e=!1}e?(r=!1,o.emit(t)):r&&(r=!1,o.down([[T],[d]]))}else r?(r=!1,o.down([[T],[d]])):o.down([[d]])}}let S=g([],(o,t)=>{let i=y.subscribe(u=>{for(let b of u)w(b,0,t)}),e=l.subscribe(u=>{for(let b of u)w(b,1,t)});return()=>{i(),e()}},{describeKind:"derived",meta:{kind:"stratify_branch",branch:a.name},completeWhenDepsComplete:!1});function w(o,t,i){let e=o[0];return e===T?(t===0?(f=!0,r=!0):m=!0,!0):e===R||e===d?(t===0?(f=!1,p=!0,N=e===R?o[1]:n):(e===R&&(h=o[1]),m=!1),f||m||v(i),!0):e===O||e===D||e===A?(f=!1,m=!1,p=!1,N=n,r=!1,t===0&&i.down([o]),!0):t===1}if(c.add(S,{name:s}),a.ops){let o=a.ops(S),t=`branch/${a.name}/out`;c.add(o,{name:t})}}export{L as a};
1
+ import{k as _}from"./chunk-MGKAO4EK.js";import{D as g,E as k}from"./chunk-W4TSQ6RJ.js";import{b as R,c as T,d,h as A,i as O,j as D}from"./chunk-CK2E7BTU.js";function L(c,y,l,a){let s=new _(c,a);s.add(y,{name:"source"});let n=k(l,{meta:{kind:"stratify_rules"}});s.add(n,{name:"rules"});for(let f of l)E(s,y,n,f);return s}function E(c,y,l,a){let s=`branch/${a.name}`,n=Symbol("noValue"),f=!1,m=!1,p=!1,N=n,r=!1,h=l.cache??[];function v(o){if(p){p=!1;let t=N;if(N=n,t!==n){let i=h.find(u=>u.name===a.name),e=!1;try{e=i?.classify(t)??!1}catch{e=!1}e?(r=!1,o.emit(t)):r&&(r=!1,o.down([[T],[d]]))}else r?(r=!1,o.down([[T],[d]])):o.down([[d]])}}let S=g([],(o,t)=>{let i=y.subscribe(u=>{for(let b of u)w(b,0,t)}),e=l.subscribe(u=>{for(let b of u)w(b,1,t)});return()=>{i(),e()}},{describeKind:"derived",meta:{kind:"stratify_branch",branch:a.name},completeWhenDepsComplete:!1});function w(o,t,i){let e=o[0];return e===T?(t===0?(f=!0,r=!0):m=!0,!0):e===R||e===d?(t===0?(f=!1,p=!0,N=e===R?o[1]:n):(e===R&&(h=o[1]),m=!1),f||m||v(i),!0):e===O||e===D||e===A?(f=!1,m=!1,p=!1,N=n,r=!1,t===0&&i.down([o]),!0):t===1}if(c.add(S,{name:s}),a.ops){let o=a.ops(S),t=`branch/${a.name}/out`;c.add(o,{name:t})}}export{L as a};
@@ -1 +1 @@
1
- import{b as x,c as D,d as $,e as S,f as A,g as R,h as T,i as F,j as y,k as P,l as V}from"./chunk-CKCSDI7T.js";import{a as m,b as g,c as k,d as v,e as O,f as G,g as E,h as C}from"./chunk-ZB5EHBIO.js";import{b as u}from"./chunk-CK2E7BTU.js";import{b as _}from"./chunk-QYADASLV.js";var j={};_(j,{ENVELOPE_VERSION:()=>v,GRAPH_META_SEGMENT:()=>R,Graph:()=>y,JsonCodec:()=>m,SIZEOF_OVERHEAD:()=>D,SIZEOF_SYMBOL:()=>$,SNAPSHOT_VERSION:()=>T,createDagCborCodec:()=>g,createDagCborZstdCodec:()=>k,decodeEnvelope:()=>G,diffForWAL:()=>P,encodeEnvelope:()=>O,explainPath:()=>x,graphProfile:()=>A,mermaidLiveUrl:()=>F,reachable:()=>V,registerBuiltinCodecs:()=>E,replayWAL:()=>C,sizeof:()=>S,validateGraphObservability:()=>L,watchTopologyTree:()=>N});function N(p,s){let o=new Map,c=(n,a)=>{if(o.has(n))return;let d={off:()=>{},prefix:a};o.set(n,d);let f=n.topology.subscribe(l=>{for(let r of l){if(r[0]!==u)continue;let e=r[1];if(s(e,n,a),e.kind==="added"&&e.nodeKind==="mount"){let t=n._mounts.get(e.name);if(t instanceof y){let i=`${a}${e.name}::`;c(t,i)}}else if(e.kind==="removed"&&e.nodeKind==="mount"){let t=`${a}${e.name}::`;for(let[i,h]of Array.from(o.entries()))i!==p&&h.prefix.startsWith(t)&&(h.off(),o.delete(i))}}});d.off=f;for(let[l,r]of n._mounts)if(r instanceof y){let e=`${a}${l}::`;c(r,e)}};return c(p,""),()=>{for(let n of o.values())n.off();o.clear()}}function L(p,s={}){let o=[],c=s.requireFound??!0;if(s.skipDescribe!==!0)try{let r=p.describe(),e=new Set(Object.keys(r.nodes)),t=[];for(let[i,h]of Object.entries(r.nodes))for(let b of h.deps)b!==""&&!e.has(b)&&t.push(`${i} \u2192 ${b}`);for(let i of r.edges)e.has(i.from)||t.push(`edge.from: ${i.from}`),e.has(i.to)||t.push(`edge.to: ${i.to}`);t.length>0?o.push({kind:"describe",ok:!1,reason:`describe() has ${t.length} dangling pointer(s); nodes \u2289 deps`,danglingDeps:t}):o.push({kind:"describe",ok:!0,nodeCount:e.size,edgeCount:r.edges.length})}catch(r){o.push({kind:"describe",ok:!1,reason:`describe() threw: ${r instanceof Error?r.message:String(r)}`})}for(let r of s.formats??[])try{let e=p.describe({format:r});typeof e!="string"||e.length===0?o.push({kind:"describe-format",ok:!1,format:r,reason:`describe({ format: "${r}" }) returned empty or non-string output`}):o.push({kind:"describe-format",ok:!0,format:r,length:e.length})}catch(e){o.push({kind:"describe-format",ok:!1,format:r,reason:e instanceof Error?e.message:String(e)})}for(let r of s.paths??[])try{p.resolve(r),o.push({kind:"observe",ok:!0,path:r})}catch(e){o.push({kind:"observe",ok:!1,path:r,reason:e instanceof Error?e.message:String(e)})}for(let[r,e]of s.pairs??[])try{let t=p.explain(r,e);c&&t.found===!1?o.push({kind:"explain",ok:!1,from:r,to:e,reason:`explain(${r} \u2192 ${e}) found no path${t.reason?`: ${t.reason}`:""}`}):o.push({kind:"explain",ok:!0,from:r,to:e,found:t.found,steps:t.steps.length})}catch(t){o.push({kind:"explain",ok:!1,from:r,to:e,reason:t instanceof Error?t.message:String(t)})}let n=o.filter(r=>!r.ok),a=n.length===0,d=s.paths?.length??0,f=s.pairs?.length??0,l=s.formats?.length??0;return{ok:a,checks:o,failures:n,summary(){let r=[s.skipDescribe===!0?null:"describe",l>0?`${l} format${l===1?"":"s"}`:null,d>0?`${d} observe path${d===1?"":"s"}`:null,f>0?`${f} explain pair${f===1?"":"s"}`:null].filter(t=>t!=null),e=r.length>0?r.join(", "):"describe-only";return a?`validateGraphObservability: OK (${e})`:`validateGraphObservability: ${n.length} failure(s) across ${e}`}}}export{N as a,L as b,j as c};
1
+ import{c as x,d as D,e as $,f as S,g as A,h as R,i as T,j as F,k as y,l as P,m as V}from"./chunk-MGKAO4EK.js";import{a as m,b as g,c as k,d as v,e as O,f as G,g as E,h as C}from"./chunk-W4TSQ6RJ.js";import{b as u}from"./chunk-CK2E7BTU.js";import{b as _}from"./chunk-QYADASLV.js";var j={};_(j,{ENVELOPE_VERSION:()=>v,GRAPH_META_SEGMENT:()=>R,Graph:()=>y,JsonCodec:()=>m,SIZEOF_OVERHEAD:()=>D,SIZEOF_SYMBOL:()=>$,SNAPSHOT_VERSION:()=>T,createDagCborCodec:()=>g,createDagCborZstdCodec:()=>k,decodeEnvelope:()=>G,diffForWAL:()=>P,encodeEnvelope:()=>O,explainPath:()=>x,graphProfile:()=>A,mermaidLiveUrl:()=>F,reachable:()=>V,registerBuiltinCodecs:()=>E,replayWAL:()=>C,sizeof:()=>S,validateGraphObservability:()=>L,watchTopologyTree:()=>N});function N(p,n){let o=new Map,d=(s,a)=>{if(o.has(s))return;let c={off:()=>{},prefix:a};o.set(s,c);let f=s.topology.subscribe(l=>{for(let r of l){if(r[0]!==u)continue;let e=r[1];if(n(e,s,a),e.kind==="added"&&e.nodeKind==="mount"){let t=s._mounts.get(e.name);if(t instanceof y){let i=`${a}${e.name}::`;d(t,i)}}else if(e.kind==="removed"&&e.nodeKind==="mount"){let t=`${a}${e.name}::`;for(let[i,h]of Array.from(o.entries()))i!==p&&h.prefix.startsWith(t)&&(h.off(),o.delete(i))}}});c.off=f;for(let[l,r]of s._mounts)if(r instanceof y){let e=`${a}${l}::`;d(r,e)}};return d(p,""),()=>{for(let s of o.values())s.off();o.clear()}}function L(p,n={}){let o=[],d=n.requireFound??!0;if(n.skipDescribe!==!0)try{let r=p.describe(),e=new Set(Object.keys(r.nodes)),t=[];for(let[i,h]of Object.entries(r.nodes))for(let b of h.deps)b!==""&&!e.has(b)&&t.push(`${i} \u2192 ${b}`);for(let i of r.edges)e.has(i.from)||t.push(`edge.from: ${i.from}`),e.has(i.to)||t.push(`edge.to: ${i.to}`);t.length>0?o.push({kind:"describe",ok:!1,reason:`describe() has ${t.length} dangling pointer(s); nodes \u2289 deps`,danglingDeps:t}):o.push({kind:"describe",ok:!0,nodeCount:e.size,edgeCount:r.edges.length})}catch(r){o.push({kind:"describe",ok:!1,reason:`describe() threw: ${r instanceof Error?r.message:String(r)}`})}for(let r of n.formats??[])try{let e=p.describe({format:r});typeof e!="string"||e.length===0?o.push({kind:"describe-format",ok:!1,format:r,reason:`describe({ format: "${r}" }) returned empty or non-string output`}):o.push({kind:"describe-format",ok:!0,format:r,length:e.length})}catch(e){o.push({kind:"describe-format",ok:!1,format:r,reason:e instanceof Error?e.message:String(e)})}for(let r of n.paths??[])try{p.resolve(r),o.push({kind:"observe",ok:!0,path:r})}catch(e){o.push({kind:"observe",ok:!1,path:r,reason:e instanceof Error?e.message:String(e)})}for(let[r,e]of n.pairs??[])try{let t=p.explain(r,e);d&&t.found===!1?o.push({kind:"explain",ok:!1,from:r,to:e,reason:`explain(${r} \u2192 ${e}) found no path${t.reason?`: ${t.reason}`:""}`}):o.push({kind:"explain",ok:!0,from:r,to:e,found:t.found,steps:t.steps.length})}catch(t){o.push({kind:"explain",ok:!1,from:r,to:e,reason:t instanceof Error?t.message:String(t)})}let s=o.filter(r=>!r.ok),a=s.length===0,c=n.paths?.length??0,f=n.pairs?.length??0,l=n.formats?.length??0;return{ok:a,checks:o,failures:s,summary(){let r=[n.skipDescribe===!0?null:"describe",l>0?`${l} format${l===1?"":"s"}`:null,c>0?`${c} observe path${c===1?"":"s"}`:null,f>0?`${f} explain pair${f===1?"":"s"}`:null].filter(t=>t!=null),e=r.length>0?r.join(", "):"describe-only";return a?`validateGraphObservability: OK (${e})`:`validateGraphObservability: ${s.length} failure(s) across ${e}`}}}export{N as a,L as b,j as c};
@@ -1 +1 @@
1
- import{d as S}from"./chunk-VJLMUKOI.js";import{d as O}from"./chunk-VIMF6LGM.js";import{d as k}from"./chunk-6QZNQS5B.js";import{d as A}from"./chunk-GPW2V3RE.js";import{b as N}from"./chunk-FNYWM6JC.js";import{b as v}from"./chunk-UMBIDLJ4.js";import{i as y}from"./chunk-UPXUCFMX.js";import{G as x}from"./chunk-76A3HVQE.js";import{E as b,J as g,m as _}from"./chunk-ZB5EHBIO.js";import{b as a,c as p,i as h,j as m}from"./chunk-CK2E7BTU.js";import{b as f}from"./chunk-QYADASLV.js";var j={};f(j,{jotai:()=>v,nanostores:()=>y,nestjs:()=>x,react:()=>S,signals:()=>T,solid:()=>O,svelte:()=>k,vue:()=>A,zustand:()=>N});var T={};f(T,{Signal:()=>q});var s=[];function i(n){let e=n.cache;return n.subscribe(o=>{for(let[d,r]of o)d===a&&(e=r)})(),e}var u=class{_node;_equals;constructor(e,t){this._equals=t?.equals??Object.is,this._node=b(e,{...t,resubscribable:!0,resetOnTeardown:!0})}get(){let e=s[s.length-1];return e?(this._node.status==="sentinel"&&i(this._node),e(this._node)):this._node.status==="sentinel"?i(this._node):this._node.cache}set(e){this._equals(this.get(),e)||_(()=>{this._node.down([[p],[a,e]])})}},l=class{_node;constructor(e,t){this._node=g(o=>{s.push(o);try{return e()}finally{s.pop()}},{...t,describeKind:"derived",resubscribable:!0,resetOnTeardown:!0})}get(){let e=s[s.length-1];return e?(this._node.status==="sentinel"&&i(this._node),e(this._node)):this._node.status==="sentinel"?i(this._node):this._node.cache}},q={State:u,Computed:l,sub:(n,e)=>{let t=typeof e=="function"?{data:e,error:void 0,complete:void 0}:e,o=!0;return n._node.subscribe(d=>{for(let[r,c]of d){if(r===a){if(o){o=!1;continue}t.data?.(c)}r===m&&t.error?.(c),r===h&&t.complete?.()}})}};export{T as a,j as b};
1
+ import{d as S}from"./chunk-VJLMUKOI.js";import{d as O}from"./chunk-VIMF6LGM.js";import{d as k}from"./chunk-6QZNQS5B.js";import{d as A}from"./chunk-GPW2V3RE.js";import{b as N}from"./chunk-AV3PIDFQ.js";import{b as v}from"./chunk-BA5URFYW.js";import{i as y}from"./chunk-BZP5T4X6.js";import{G as x}from"./chunk-E3AXATVZ.js";import{E as b,J as g,m as _}from"./chunk-W4TSQ6RJ.js";import{b as a,c as p,i as h,j as m}from"./chunk-CK2E7BTU.js";import{b as f}from"./chunk-QYADASLV.js";var j={};f(j,{jotai:()=>v,nanostores:()=>y,nestjs:()=>x,react:()=>S,signals:()=>T,solid:()=>O,svelte:()=>k,vue:()=>A,zustand:()=>N});var T={};f(T,{Signal:()=>q});var s=[];function i(n){let e=n.cache;return n.subscribe(o=>{for(let[d,r]of o)d===a&&(e=r)})(),e}var u=class{_node;_equals;constructor(e,t){this._equals=t?.equals??Object.is,this._node=b(e,{...t,resubscribable:!0,resetOnTeardown:!0})}get(){let e=s[s.length-1];return e?(this._node.status==="sentinel"&&i(this._node),e(this._node)):this._node.status==="sentinel"?i(this._node):this._node.cache}set(e){this._equals(this.get(),e)||_(()=>{this._node.down([[p],[a,e]])})}},l=class{_node;constructor(e,t){this._node=g(o=>{s.push(o);try{return e()}finally{s.pop()}},{...t,describeKind:"derived",resubscribable:!0,resetOnTeardown:!0})}get(){let e=s[s.length-1];return e?(this._node.status==="sentinel"&&i(this._node),e(this._node)):this._node.status==="sentinel"?i(this._node):this._node.cache}},q={State:u,Computed:l,sub:(n,e)=>{let t=typeof e=="function"?{data:e,error:void 0,complete:void 0}:e,o=!0;return n._node.subscribe(d=>{for(let[r,c]of d){if(r===a){if(o){o=!1;continue}t.data?.(c)}r===m&&t.error?.(c),r===h&&t.complete?.()}})}};export{T as a,j as b};
@@ -1 +1 @@
1
- import{m as b,w as g}from"./chunk-2PMCKKRK.js";import{i as p,j as T}from"./chunk-CK2E7BTU.js";function K(l,y={}){let u=y.keyFn??(n=>String(n)),t=new Map;return n=>{let r=u(n),a=t.get(r);if(a)return a;let e=l(n),i;e!=null&&typeof e.then=="function"?i=Promise.resolve(e):e!=null&&typeof e=="object"&&"subscribe"in e&&"cache"in e?i=g(e):e!=null&&typeof e=="object"&&Symbol.asyncIterator in e?i=(async()=>{let o=e[Symbol.asyncIterator]();try{let{value:m,done:f}=await o.next();if(f)throw new Error("singleFromAny: factory returned empty async iterable");return m}finally{await o.return?.()}})():e!=null&&typeof e=="object"&&Symbol.iterator in e?i=(async()=>{let o=e[Symbol.iterator]();try{let{value:m,done:f}=o.next();if(f)throw new Error("singleFromAny: factory returned empty iterable");return m}finally{o.return?.()}})():i=Promise.resolve(e);let s,c=()=>{t.get(r)===s&&t.delete(r)};return s=i.then(o=>(c(),o),o=>{throw c(),o}),t.set(r,s),s}}function k(l,y={}){let u=y.keyFn??(n=>String(n)),t=new Map;return n=>{let r=u(n),a=t.get(r);if(a)return a;let e=b(l(n));t.set(r,e);let i=e.subscribe(s=>{for(let c of s)if(c[0]===T||c[0]===p){t.get(r)===e&&t.delete(r),i();return}});return e}}export{K as a,k as b};
1
+ import{m as b,w as g}from"./chunk-KASHOCF5.js";import{i as p,j as T}from"./chunk-CK2E7BTU.js";function K(l,y={}){let u=y.keyFn??(n=>String(n)),t=new Map;return n=>{let r=u(n),a=t.get(r);if(a)return a;let e=l(n),i;e!=null&&typeof e.then=="function"?i=Promise.resolve(e):e!=null&&typeof e=="object"&&"subscribe"in e&&"cache"in e?i=g(e):e!=null&&typeof e=="object"&&Symbol.asyncIterator in e?i=(async()=>{let o=e[Symbol.asyncIterator]();try{let{value:m,done:f}=await o.next();if(f)throw new Error("singleFromAny: factory returned empty async iterable");return m}finally{await o.return?.()}})():e!=null&&typeof e=="object"&&Symbol.iterator in e?i=(async()=>{let o=e[Symbol.iterator]();try{let{value:m,done:f}=o.next();if(f)throw new Error("singleFromAny: factory returned empty iterable");return m}finally{o.return?.()}})():i=Promise.resolve(e);let s,c=()=>{t.get(r)===s&&t.delete(r)};return s=i.then(o=>(c(),o),o=>{throw c(),o}),t.set(r,s),s}}function k(l,y={}){let u=y.keyFn??(n=>String(n)),t=new Map;return n=>{let r=u(n),a=t.get(r);if(a)return a;let e=b(l(n));t.set(r,e);let i=e.subscribe(s=>{for(let c of s)if(c[0]===T||c[0]===p){t.get(r)===e&&t.delete(r),i();return}});return e}}export{K as a,k as b};
@@ -1 +1 @@
1
- import{d as n}from"./chunk-Y2EMPB3I.js";import{j as a}from"./chunk-CKCSDI7T.js";import{b as c}from"./chunk-QYADASLV.js";var s={};c(s,{GuardedExecutionGraph:()=>o,guardedExecution:()=>p});var o=class extends a{enforcer;violations;_target;_defaultActor;constructor(r,e){super(e.name??`${r.name}_guarded`,e.graph),this._target=r,this._defaultActor=e.actor;let t={mode:e.mode??"enforce",name:"enforcer"};e.violationsLimit!=null&&(t.violationsLimit=e.violationsLimit),this.enforcer=n(r,e.policies,t),this.violations=this.enforcer.violations,this.mount("enforcer",this.enforcer)}scopedDescribe(r){let e=r?.actor??this._defaultActor,t={...r,...e!=null?{actor:e}:{}};return this._target.describe(t)}get target(){return this._target}};function p(i,r){return new o(i,r)}export{o as a,p as b,s as c};
1
+ import{d as n}from"./chunk-UVJQ35G2.js";import{k as a}from"./chunk-MGKAO4EK.js";import{b as c}from"./chunk-QYADASLV.js";var s={};c(s,{GuardedExecutionGraph:()=>o,guardedExecution:()=>p});var o=class extends a{enforcer;violations;_target;_defaultActor;constructor(r,e){super(e.name??`${r.name}_guarded`,e.graph),this._target=r,this._defaultActor=e.actor;let t={mode:e.mode??"enforce",name:"enforcer"};e.violationsLimit!=null&&(t.violationsLimit=e.violationsLimit),this.enforcer=n(r,e.policies,t),this.violations=this.enforcer.violations,this.mount("enforcer",this.enforcer)}scopedDescribe(r){let e=r?.actor??this._defaultActor,t={...r,...e!=null?{actor:e}:{}};return this._target.describe(t)}get target(){return this._target}};function p(i,r){return new o(i,r)}export{o as a,p as b,s as c};
@@ -1 +1 @@
1
- import{D as N,E as C,F as p,p as A}from"./chunk-ZB5EHBIO.js";import{b as h,c as S,d as x,i as T,j as b}from"./chunk-CK2E7BTU.js";function y(e,n,t){let s=new Set;for(let i of e.split(",")){let[r,o]=i.split("/"),u=o?Number.parseInt(o,10):1;if(Number.isNaN(u)||u<1)throw new Error(`Invalid cron step: ${i}`);let a,d;if(r==="*")a=n,d=t;else if(r.includes("-")){let[f,c]=r.split("-");a=Number.parseInt(f,10),d=Number.parseInt(c,10)}else a=Number.parseInt(r,10),d=a;if(Number.isNaN(a)||Number.isNaN(d))throw new Error(`Invalid cron field: ${e}`);if(a<n||d>t)throw new Error(`Cron field out of range: ${e} (${n}-${t})`);if(a>d)throw new Error(`Invalid cron range: ${a}-${d} in ${e}`);for(let f=a;f<=d;f+=u)s.add(f)}return s}function I(e){let n=e.trim().split(/\s+/);if(n.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${n.length}`);return{minutes:y(n[0],0,59),hours:y(n[1],0,23),daysOfMonth:y(n[2],1,31),months:y(n[3],1,12),daysOfWeek:y(n[4],0,6)}}function L(e,n){return e.minutes.has(n.getMinutes())&&e.hours.has(n.getHours())&&e.daysOfMonth.has(n.getDate())&&e.months.has(n.getMonth()+1)&&e.daysOfWeek.has(n.getDay())}function m(e){return{describeKind:"producer",...e}}function $(e){return/[\\^$+?.()|[\]{}]/.test(e)?`\\${e}`:e}function J(e){let n="^";for(let t=0;t<e.length;t+=1){let s=e[t];if(s==="*"){e[t+1]==="*"?(n+=".*",t+=1):n+="[^/]*";continue}n+=$(s)}return n+="$",new RegExp(n)}function Q(e,n){for(let t of n)if(t.test(e))return!0;return!1}function _(e,n){let t=N([e],(i,r)=>{let o=i[0];if(o==null||o.length===0){r.down([[x]]);return}for(let u of o)r.emit(u)},{describeKind:"derived",initial:e.cache}),s=t.subscribe.bind(t);return t.subscribe=(i,r)=>(n(i),s(i,r)),t}function X(e,n){let{signal:t,period:s,...i}=n??{};return p(r=>{let o=!1,u=0,a,d,f=()=>{o=!0,a!==void 0&&clearTimeout(a),d!==void 0&&clearInterval(d),t?.removeEventListener("abort",l)},c=()=>{o||(s!=null?(r.emit(u++),d=setInterval(()=>{o||r.emit(u++)},s)):(o=!0,t?.removeEventListener("abort",l),r.emit(u++),r.down([[T]])))},l=()=>{o||(f(),r.down([[b,t.reason]]))};if(t?.aborted){l();return}return a=setTimeout(c,e),t?.addEventListener("abort",l,{once:!0}),f},m(i))}function Z(e){let{signal:n,...t}=e??{};return p(s=>{let i=!1,r,o,u=!1,a=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,f=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,c=typeof document<"u"?document:void 0,l=()=>{r!==void 0&&f&&f(r),o!==void 0&&clearTimeout(o),r=void 0,o=void 0},v=()=>{i=!0,l(),u&&(n?.removeEventListener("abort",w),u=!1),a&&c&&(c.removeEventListener("visibilitychange",k),a=!1)},w=()=>{i||(v(),s.down([[b,n.reason]]))},O=F=>{i||(s.emit(F),g())},g=()=>{i||(d&&(!c||c.visibilityState!=="hidden")?r=d(O):o=setTimeout(()=>O(performance.now()),16))},k=()=>{i||(l(),g())};return n?.aborted?(w(),v):(n?.addEventListener("abort",w,{once:!0}),u=n!==void 0,c&&d&&(c.addEventListener("visibilitychange",k),a=!0),g(),v)},m(t))}function ee(e,n){let t=I(e),{tickMs:s,output:i,...r}=n??{},o=s??6e4,u=i==="date";return p(a=>{let d=-1,f=()=>{let l=new Date,v=l.getFullYear()*1e8+(l.getMonth()+1)*1e6+l.getDate()*1e4+l.getHours()*100+l.getMinutes();v!==d&&L(t,l)&&(d=v,a.emit(u?l:A()))};f();let c=setInterval(f,o);return()=>clearInterval(c)},{...m(r),name:r.name??`cron:${e}`})}function ne(e,n,t){let{capture:s,passive:i,once:r,...o}=t??{};return p(u=>{let a=f=>{u.emit(f)},d={capture:s,passive:i,once:r};return e.addEventListener(n,a,d),()=>e.removeEventListener(n,a,d)},m(o))}function M(e,n){return p(t=>{let s=!1;try{for(let i of e){if(s)return;t.emit(i)}s||t.down([[T]])}catch(i){s||t.down([[b,i]])}return()=>{s=!0}},m(n))}function K(e){return e!=null&&typeof e.then=="function"}function W(e,n){let{signal:t,...s}=n??{};return p(i=>{let r=!1,o=()=>{r||(r=!0,i.down([[b,t.reason]]))};if(t?.aborted){o();return}return t?.addEventListener("abort",o,{once:!0}),Promise.resolve(e).then(u=>{r||(r=!0,t?.removeEventListener("abort",o),i.emit(u),i.down([[T]]))},u=>{r||(r=!0,t?.removeEventListener("abort",o),i.down([[b,u]]))}),()=>{r=!0,t?.removeEventListener("abort",o)}},m(s))}function q(e,n){let{signal:t,...s}=n??{};return p(i=>{let r=new AbortController,o=()=>r.abort(t?.reason);t?.aborted?r.abort(t.reason):t?.addEventListener("abort",o,{once:!0});let u=t??r.signal,a=!1,d=e[Symbol.asyncIterator](),f=()=>{a||u.aborted||Promise.resolve(d.next()).then(c=>{if(!(a||u.aborted)){if(c.done){i.down([[T]]);return}i.emit(c.value),f()}},c=>{!a&&!u.aborted&&i.down([[b,c]])})};return f(),()=>{a=!0,t?.removeEventListener("abort",o),r.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},m(s))}function H(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function te(e,n){if(H(e))return e;if(K(e))return W(e,n);if(e!=null){let t=e;if(typeof t[Symbol.asyncIterator]=="function")return q(e,n);if(typeof t[Symbol.iterator]=="function")return M(e,n)}return V(e)}function V(...e){return M(e,void 0)}function re(e){return p(n=>{n.down([[T]])},m(e))}function oe(e){return p(()=>{},m(e))}function ie(e,n){return p(t=>{t.down([[b,e]])},m(n))}function se(e,n,t){return N([e],(i,r)=>{let o=i[0];if(o!=null&&o.length>0)for(let u of o)n(u)},{describeKind:"effect",...t}).subscribe(()=>{})}function ue(e,n){return N([e],(t,s,i)=>{i.store.buf||(i.store.buf=[]);let r=i.store.buf,o=t[0];if(o!=null&&o.length>0)for(let u of o)r.push(u);if(i.terminalDeps[0]===!0){s.emit([...r]),s.down([[T]]);return}(o==null||o.length===0)&&s.down([[x]])},{describeKind:"derived",completeWhenDepsComplete:!1,...n})}function ae(e,n){return p(t=>e.subscribe(s=>{t.down(s)}),{...m(n),initial:e.cache})}function D(e,n,t){if(n<1)throw new RangeError("replay expects bufferSize >= 1");let s=[],i=p(r=>e.subscribe(o=>{for(let u of o)u[0]===h&&(s.push(u[1]),s.length>n&&s.shift());r.down(o)}),{...m(t),initial:e.cache});return _(i,r=>{for(let o of s)r([[h,o]])})}function de(e,n){return D(e,1,n)}function fe(e){return new Promise((n,t)=>{let s=!1,i=!1,r;r=e.subscribe(o=>{for(let u of o){if(s)return;if(u[0]===h){s=!0,n(u[1]),r?(r(),r=void 0):i=!0;return}if(u[0]===b){s=!0,t(u[1]),r?(r(),r=void 0):i=!0;return}if(u[0]===T){s=!0,t(new Error("completed without DATA")),r?(r(),r=void 0):i=!0;return}}}),i&&(r?.(),r=void 0)})}function P(e,n){return new Promise((t,s)=>{let i=!1,r=!1,o;o=e.subscribe(u=>{for(let a of u){if(i)return;if(a[0]===h){let d=a[1];if(n(d)){i=!0,t(d),o?(o(),o=void 0):r=!0;return}}if(a[0]===b){i=!0,s(a[1]),o?(o(),o=void 0):r=!0;return}if(a[0]===T){i=!0,s(new Error("completed without matching value")),o?(o(),o=void 0):r=!0;return}}}),r&&(o?.(),o=void 0)})}var E,R;async function ce(e,n){let t=n?.predicate??(i=>i!=null);if(n?.timeoutMs==null||n.timeoutMs<=0)return await P(e,t);if(E===void 0){let[i,r]=await Promise.all([import("./resilience-QAHKANT5.js"),import("./backoff-HPZMEZNF.js")]);E=i.timeout,R=r.NS_PER_MS}let s=E(e,n.timeoutMs*R);return await P(s,t)}var le=D;function pe(e){return e.subscribe(()=>{})}function me(e){let n=C(0);return{node:n,increment(){let t=n.cache??0;return t>=e?!1:(n.down([[S],[h,t+1]]),!0)},get(){return n.cache??0},atCap(){return(n.cache??0)>=e}}}export{I as a,L as b,$ as c,J as d,Q as e,X as f,Z as g,ee as h,ne as i,M as j,W as k,q as l,te as m,V as n,re as o,oe as p,ie as q,se as r,ue as s,ae as t,D as u,de as v,fe as w,P as x,ce as y,le as z,pe as A,me as B};
1
+ import{D as N,E as C,F as p,p as A}from"./chunk-W4TSQ6RJ.js";import{b as h,c as S,d as x,i as T,j as b}from"./chunk-CK2E7BTU.js";function y(e,n,t){let s=new Set;for(let i of e.split(",")){let[r,o]=i.split("/"),u=o?Number.parseInt(o,10):1;if(Number.isNaN(u)||u<1)throw new Error(`Invalid cron step: ${i}`);let a,d;if(r==="*")a=n,d=t;else if(r.includes("-")){let[f,c]=r.split("-");a=Number.parseInt(f,10),d=Number.parseInt(c,10)}else a=Number.parseInt(r,10),d=a;if(Number.isNaN(a)||Number.isNaN(d))throw new Error(`Invalid cron field: ${e}`);if(a<n||d>t)throw new Error(`Cron field out of range: ${e} (${n}-${t})`);if(a>d)throw new Error(`Invalid cron range: ${a}-${d} in ${e}`);for(let f=a;f<=d;f+=u)s.add(f)}return s}function I(e){let n=e.trim().split(/\s+/);if(n.length!==5)throw new Error(`Invalid cron: expected 5 fields, got ${n.length}`);return{minutes:y(n[0],0,59),hours:y(n[1],0,23),daysOfMonth:y(n[2],1,31),months:y(n[3],1,12),daysOfWeek:y(n[4],0,6)}}function L(e,n){return e.minutes.has(n.getMinutes())&&e.hours.has(n.getHours())&&e.daysOfMonth.has(n.getDate())&&e.months.has(n.getMonth()+1)&&e.daysOfWeek.has(n.getDay())}function m(e){return{describeKind:"producer",...e}}function $(e){return/[\\^$+?.()|[\]{}]/.test(e)?`\\${e}`:e}function J(e){let n="^";for(let t=0;t<e.length;t+=1){let s=e[t];if(s==="*"){e[t+1]==="*"?(n+=".*",t+=1):n+="[^/]*";continue}n+=$(s)}return n+="$",new RegExp(n)}function Q(e,n){for(let t of n)if(t.test(e))return!0;return!1}function _(e,n){let t=N([e],(i,r)=>{let o=i[0];if(o==null||o.length===0){r.down([[x]]);return}for(let u of o)r.emit(u)},{describeKind:"derived",initial:e.cache}),s=t.subscribe.bind(t);return t.subscribe=(i,r)=>(n(i),s(i,r)),t}function X(e,n){let{signal:t,period:s,...i}=n??{};return p(r=>{let o=!1,u=0,a,d,f=()=>{o=!0,a!==void 0&&clearTimeout(a),d!==void 0&&clearInterval(d),t?.removeEventListener("abort",l)},c=()=>{o||(s!=null?(r.emit(u++),d=setInterval(()=>{o||r.emit(u++)},s)):(o=!0,t?.removeEventListener("abort",l),r.emit(u++),r.down([[T]])))},l=()=>{o||(f(),r.down([[b,t.reason]]))};if(t?.aborted){l();return}return a=setTimeout(c,e),t?.addEventListener("abort",l,{once:!0}),f},m(i))}function Z(e){let{signal:n,...t}=e??{};return p(s=>{let i=!1,r,o,u=!1,a=!1,d=typeof requestAnimationFrame=="function"?requestAnimationFrame:void 0,f=typeof cancelAnimationFrame=="function"?cancelAnimationFrame:void 0,c=typeof document<"u"?document:void 0,l=()=>{r!==void 0&&f&&f(r),o!==void 0&&clearTimeout(o),r=void 0,o=void 0},v=()=>{i=!0,l(),u&&(n?.removeEventListener("abort",w),u=!1),a&&c&&(c.removeEventListener("visibilitychange",k),a=!1)},w=()=>{i||(v(),s.down([[b,n.reason]]))},O=F=>{i||(s.emit(F),g())},g=()=>{i||(d&&(!c||c.visibilityState!=="hidden")?r=d(O):o=setTimeout(()=>O(performance.now()),16))},k=()=>{i||(l(),g())};return n?.aborted?(w(),v):(n?.addEventListener("abort",w,{once:!0}),u=n!==void 0,c&&d&&(c.addEventListener("visibilitychange",k),a=!0),g(),v)},m(t))}function ee(e,n){let t=I(e),{tickMs:s,output:i,...r}=n??{},o=s??6e4,u=i==="date";return p(a=>{let d=-1,f=()=>{let l=new Date,v=l.getFullYear()*1e8+(l.getMonth()+1)*1e6+l.getDate()*1e4+l.getHours()*100+l.getMinutes();v!==d&&L(t,l)&&(d=v,a.emit(u?l:A()))};f();let c=setInterval(f,o);return()=>clearInterval(c)},{...m(r),name:r.name??`cron:${e}`})}function ne(e,n,t){let{capture:s,passive:i,once:r,...o}=t??{};return p(u=>{let a=f=>{u.emit(f)},d={capture:s,passive:i,once:r};return e.addEventListener(n,a,d),()=>e.removeEventListener(n,a,d)},m(o))}function M(e,n){return p(t=>{let s=!1;try{for(let i of e){if(s)return;t.emit(i)}s||t.down([[T]])}catch(i){s||t.down([[b,i]])}return()=>{s=!0}},m(n))}function K(e){return e!=null&&typeof e.then=="function"}function W(e,n){let{signal:t,...s}=n??{};return p(i=>{let r=!1,o=()=>{r||(r=!0,i.down([[b,t.reason]]))};if(t?.aborted){o();return}return t?.addEventListener("abort",o,{once:!0}),Promise.resolve(e).then(u=>{r||(r=!0,t?.removeEventListener("abort",o),i.emit(u),i.down([[T]]))},u=>{r||(r=!0,t?.removeEventListener("abort",o),i.down([[b,u]]))}),()=>{r=!0,t?.removeEventListener("abort",o)}},m(s))}function q(e,n){let{signal:t,...s}=n??{};return p(i=>{let r=new AbortController,o=()=>r.abort(t?.reason);t?.aborted?r.abort(t.reason):t?.addEventListener("abort",o,{once:!0});let u=t??r.signal,a=!1,d=e[Symbol.asyncIterator](),f=()=>{a||u.aborted||Promise.resolve(d.next()).then(c=>{if(!(a||u.aborted)){if(c.done){i.down([[T]]);return}i.emit(c.value),f()}},c=>{!a&&!u.aborted&&i.down([[b,c]])})};return f(),()=>{a=!0,t?.removeEventListener("abort",o),r.abort(),Promise.resolve(d.return?.()).catch(()=>{})}},m(s))}function H(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function te(e,n){if(H(e))return e;if(K(e))return W(e,n);if(e!=null){let t=e;if(typeof t[Symbol.asyncIterator]=="function")return q(e,n);if(typeof t[Symbol.iterator]=="function")return M(e,n)}return V(e)}function V(...e){return M(e,void 0)}function re(e){return p(n=>{n.down([[T]])},m(e))}function oe(e){return p(()=>{},m(e))}function ie(e,n){return p(t=>{t.down([[b,e]])},m(n))}function se(e,n,t){return N([e],(i,r)=>{let o=i[0];if(o!=null&&o.length>0)for(let u of o)n(u)},{describeKind:"effect",...t}).subscribe(()=>{})}function ue(e,n){return N([e],(t,s,i)=>{i.store.buf||(i.store.buf=[]);let r=i.store.buf,o=t[0];if(o!=null&&o.length>0)for(let u of o)r.push(u);if(i.terminalDeps[0]===!0){s.emit([...r]),s.down([[T]]);return}(o==null||o.length===0)&&s.down([[x]])},{describeKind:"derived",completeWhenDepsComplete:!1,...n})}function ae(e,n){return p(t=>e.subscribe(s=>{t.down(s)}),{...m(n),initial:e.cache})}function D(e,n,t){if(n<1)throw new RangeError("replay expects bufferSize >= 1");let s=[],i=p(r=>e.subscribe(o=>{for(let u of o)u[0]===h&&(s.push(u[1]),s.length>n&&s.shift());r.down(o)}),{...m(t),initial:e.cache});return _(i,r=>{for(let o of s)r([[h,o]])})}function de(e,n){return D(e,1,n)}function fe(e){return new Promise((n,t)=>{let s=!1,i=!1,r;r=e.subscribe(o=>{for(let u of o){if(s)return;if(u[0]===h){s=!0,n(u[1]),r?(r(),r=void 0):i=!0;return}if(u[0]===b){s=!0,t(u[1]),r?(r(),r=void 0):i=!0;return}if(u[0]===T){s=!0,t(new Error("completed without DATA")),r?(r(),r=void 0):i=!0;return}}}),i&&(r?.(),r=void 0)})}function P(e,n){return new Promise((t,s)=>{let i=!1,r=!1,o;o=e.subscribe(u=>{for(let a of u){if(i)return;if(a[0]===h){let d=a[1];if(n(d)){i=!0,t(d),o?(o(),o=void 0):r=!0;return}}if(a[0]===b){i=!0,s(a[1]),o?(o(),o=void 0):r=!0;return}if(a[0]===T){i=!0,s(new Error("completed without matching value")),o?(o(),o=void 0):r=!0;return}}}),r&&(o?.(),o=void 0)})}var E,R;async function ce(e,n){let t=n?.predicate??(i=>i!=null);if(n?.timeoutMs==null||n.timeoutMs<=0)return await P(e,t);if(E===void 0){let[i,r]=await Promise.all([import("./resilience-XRUF267O.js"),import("./backoff-HPZMEZNF.js")]);E=i.timeout,R=r.NS_PER_MS}let s=E(e,n.timeoutMs*R);return await P(s,t)}var le=D;function pe(e){return e.subscribe(()=>{})}function me(e){let n=C(0);return{node:n,increment(){let t=n.cache??0;return t>=e?!1:(n.down([[S],[h,t+1]]),!0)},get(){return n.cache??0},atCap(){return(n.cache??0)>=e}}}export{I as a,L as b,$ as c,J as d,Q as e,X as f,Z as g,ee as h,ne as i,M as j,W as k,q as l,te as m,V as n,re as o,oe as p,ie as q,se as r,ue as s,ae as t,D as u,de as v,fe as w,P as x,ce as y,le as z,pe as A,me as B};
@@ -1,4 +1,4 @@
1
- import{f as F,g as j,h as A}from"./chunk-3R5HFPX7.js";import{h as b,j as x}from"./chunk-CKCSDI7T.js";import{p as _}from"./chunk-ZB5EHBIO.js";import{b as $,d as T,i as v,j as N}from"./chunk-CK2E7BTU.js";import{b as K}from"./chunk-QYADASLV.js";var Y={};K(Y,{SNAPSHOT_WIRE_VERSION:()=>k,SurfaceError:()=>o,asSurfaceError:()=>D,createGraph:()=>R,deleteSnapshot:()=>H,diffSnapshots:()=>W,listSnapshots:()=>L,restoreSnapshot:()=>V,runReduction:()=>M,saveSnapshot:()=>U});var o=class extends Error{code;details;constructor(t,r,n){super(r),this.name="SurfaceError",this.code=t,n!==void 0&&(this.details=n)}toJSON(){let t={code:this.code,message:this.message};if(this.details!==void 0){let r=q(this.details);r!==void 0&&(t.details=r)}return t}};function q(e){try{return JSON.parse(JSON.stringify(e))}catch{return}}function D(e,t="internal-error"){if(e instanceof o)return e;let r=e instanceof Error?e.message:String(e);return new o(t,r)}function R(e,t){let r=j(e);if(!r.valid)throw new o("invalid-spec",`GraphSpec validation failed:
1
+ import{f as F,g as j,h as A}from"./chunk-PCZ35NXD.js";import{i as b,k as x}from"./chunk-MGKAO4EK.js";import{p as _}from"./chunk-W4TSQ6RJ.js";import{b as $,d as T,i as v,j as N}from"./chunk-CK2E7BTU.js";import{b as K}from"./chunk-QYADASLV.js";var Y={};K(Y,{SNAPSHOT_WIRE_VERSION:()=>k,SurfaceError:()=>o,asSurfaceError:()=>D,createGraph:()=>R,deleteSnapshot:()=>H,diffSnapshots:()=>W,listSnapshots:()=>L,restoreSnapshot:()=>V,runReduction:()=>M,saveSnapshot:()=>U});var o=class extends Error{code;details;constructor(t,r,n){super(r),this.name="SurfaceError",this.code=t,n!==void 0&&(this.details=n)}toJSON(){let t={code:this.code,message:this.message};if(this.details!==void 0){let r=q(this.details);r!==void 0&&(t.details=r)}return t}};function q(e){try{return JSON.parse(JSON.stringify(e))}catch{return}}function D(e,t="internal-error"){if(e instanceof o)return e;let r=e instanceof Error?e.message:String(e);return new o(t,r)}function R(e,t){let r=j(e);if(!r.valid)throw new o("invalid-spec",`GraphSpec validation failed:
2
2
  ${r.errors.join(`
3
3
  `)}`,{errors:r.errors});let n=t?.catalog??{},s=F(e,n);if(!s.valid)throw new o("catalog-error",`Catalog validation failed:
4
4
  ${s.errors.join(`
@@ -1 +1 @@
1
- import{r as A,v}from"./chunk-Z4HDAS2Q.js";import{b as I}from"./chunk-OAWLCNJJ.js";import{m as p,r as y}from"./chunk-2PMCKKRK.js";import{E as R,G as w,m as h}from"./chunk-ZB5EHBIO.js";import{b}from"./chunk-CK2E7BTU.js";function z(t){return typeof t=="object"&&t!==null&&"cache"in t&&typeof t.subscribe=="function"}function F(t,a,e){let r=p(t),i=r.v!=null,g=R(e?.initialVerified??null,{...i?{meta:{sourceVersion:null}}:{}}),x=e?.trigger!==void 0&&e.trigger!==null,s=null;if(x&&e?.autoVerify?s=A(p(e.trigger),r):x?s=p(e.trigger):e?.autoVerify&&(s=r),s!==null){let d;if(s===r)d=v(r,c=>a(c));else{let c=r.cache;r.subscribe(f=>{for(let M of f)M[0]===b&&(c=M[1])}),d=v(s,()=>a(c))}y(d,c=>{h(()=>{if(g.down([[b,c]]),i){let f=r.v;f!=null&&g.meta.sourceVersion.down([[b,{id:f.id,version:f.version}]])}})})}return{node:r,verified:g,trigger:s}}function E(t){t.subscribe(()=>{})}function k(t){return t instanceof Map?t:new Map}function B(t,a){if(!Array.isArray(a.upsert))throw new TypeError("distill extraction requires upsert: Array<{ key, value }>");h(()=>{for(let{key:e,value:r}of a.upsert)t.set(e,r);for(let e of a.remove??[])t.delete(e)})}function G(t,a,e){let r=p(t),i=I(e.mapOptions??{}),g=e.budget??2e3,s=e.context!==void 0&&e.context!==null?p(e.context):R(null),d=k(i.entries.cache);i.entries.subscribe(o=>{for(let u of o)u[0]===b&&(d=k(u[1]))});let c=v(r,o=>a(o,d));if(y(c,o=>{B(i,o)}),e.evict){let o=new Map,u=w([i.entries],([l])=>{let m=[],N=k(l);for(let n of o.keys())N.has(n)||(o.get(n)(),o.delete(n));for(let[n,T]of N){let V=e.evict(n,T);if(z(V)){if(!o.has(n)){let S=y(V,D=>{D===!0&&i.has(n)&&i.delete(n)});o.set(n,S)}continue}if(typeof V=="boolean"){V&&m.push(n);continue}throw new TypeError("distill evict() must return boolean or Node<boolean>")}return m});y(u,l=>{for(let m of l)i.delete(m)})}let f=e.consolidateTrigger!==void 0&&e.consolidateTrigger!==null;if(e.consolidate&&f){let o=p(e.consolidateTrigger),u=v(o,()=>e.consolidate(d));y(u,l=>{B(i,l)})}let M=w([i.entries,s],([o,u])=>{let l=[...k(o).entries()].map(([n,T])=>({key:n,value:T,score:e.score(T,u),cost:e.cost(T)}));l.sort((n,T)=>T.score-n.score);let m=[],N=g;for(let n of l)n.cost<=N&&(m.push({key:n.key,value:n.value,score:n.score}),N-=n.cost);return m}),O=w([i.entries],([o])=>k(o).size);return E(M),E(O),{store:i,compact:M,size:O}}export{F as a,G as b};
1
+ import{r as A,v}from"./chunk-5JDE5JHE.js";import{m as p,r as y}from"./chunk-KASHOCF5.js";import{b as I}from"./chunk-2GQREQ6C.js";import{E as R,G as w,m as h}from"./chunk-W4TSQ6RJ.js";import{b}from"./chunk-CK2E7BTU.js";function z(t){return typeof t=="object"&&t!==null&&"cache"in t&&typeof t.subscribe=="function"}function F(t,a,e){let r=p(t),i=r.v!=null,g=R(e?.initialVerified??null,{...i?{meta:{sourceVersion:null}}:{}}),x=e?.trigger!==void 0&&e.trigger!==null,s=null;if(x&&e?.autoVerify?s=A(p(e.trigger),r):x?s=p(e.trigger):e?.autoVerify&&(s=r),s!==null){let d;if(s===r)d=v(r,c=>a(c));else{let c=r.cache;r.subscribe(f=>{for(let M of f)M[0]===b&&(c=M[1])}),d=v(s,()=>a(c))}y(d,c=>{h(()=>{if(g.down([[b,c]]),i){let f=r.v;f!=null&&g.meta.sourceVersion.down([[b,{id:f.id,version:f.version}]])}})})}return{node:r,verified:g,trigger:s}}function E(t){t.subscribe(()=>{})}function k(t){return t instanceof Map?t:new Map}function B(t,a){if(!Array.isArray(a.upsert))throw new TypeError("distill extraction requires upsert: Array<{ key, value }>");h(()=>{for(let{key:e,value:r}of a.upsert)t.set(e,r);for(let e of a.remove??[])t.delete(e)})}function G(t,a,e){let r=p(t),i=I(e.mapOptions??{}),g=e.budget??2e3,s=e.context!==void 0&&e.context!==null?p(e.context):R(null),d=k(i.entries.cache);i.entries.subscribe(o=>{for(let u of o)u[0]===b&&(d=k(u[1]))});let c=v(r,o=>a(o,d));if(y(c,o=>{B(i,o)}),e.evict){let o=new Map,u=w([i.entries],([l])=>{let m=[],N=k(l);for(let n of o.keys())N.has(n)||(o.get(n)(),o.delete(n));for(let[n,T]of N){let V=e.evict(n,T);if(z(V)){if(!o.has(n)){let S=y(V,D=>{D===!0&&i.has(n)&&i.delete(n)});o.set(n,S)}continue}if(typeof V=="boolean"){V&&m.push(n);continue}throw new TypeError("distill evict() must return boolean or Node<boolean>")}return m});y(u,l=>{for(let m of l)i.delete(m)})}let f=e.consolidateTrigger!==void 0&&e.consolidateTrigger!==null;if(e.consolidate&&f){let o=p(e.consolidateTrigger),u=v(o,()=>e.consolidate(d));y(u,l=>{B(i,l)})}let M=w([i.entries,s],([o,u])=>{let l=[...k(o).entries()].map(([n,T])=>({key:n,value:T,score:e.score(T,u),cost:e.cost(T)}));l.sort((n,T)=>T.score-n.score);let m=[],N=g;for(let n of l)n.cost<=N&&(m.push({key:n.key,value:n.value,score:n.score}),N-=n.cost);return m}),O=w([i.entries],([o])=>k(o).size);return E(M),E(O),{store:i,compact:M,size:O}}export{F as a,G as b};
@@ -0,0 +1,7 @@
1
+ import{a as Le}from"./chunk-ESMPEKEV.js";import{a as se,b as Se}from"./chunk-TWMEGG45.js";import{A as Ee}from"./chunk-KASHOCF5.js";import{A as Oe,C as L,E as re,F as Me,G as _e,e as $e,f as Te,i as Y,k as Ne,l as we,m as Ae,o as K,p as Pe,s as W}from"./chunk-W4TSQ6RJ.js";import{b as Z,c as be,d as ye,e as ee,f as ve,g as xe,h as V,i as te,j as ne}from"./chunk-CK2E7BTU.js";function Ie(e,t,n,r={}){let o=t in e.nodes,s=n in e.nodes;if(!o)return oe(t,n,"no-such-from");if(!s)return oe(t,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(t===n){if(r.findCycle===!0){let u=lt(e,t,r);if(u!=null)return u}let l=ie(t,e.nodes[t],0,r);return ae(t,n,[l])}if(i===0)return oe(t,n,"no-path");let a=je(e,t,n,i);return a.found?ae(t,n,Be(e,a.pathOrder,r)):oe(t,n,a.truncated?"max-depth-exceeded":"no-path")}function je(e,t,n,r){let o=new Map,s=[{path:n,depth:0}],i=new Set([n]),a=0,l=!1;for(;a<s.length;){let h=s[a++];if(h.path===t)break;if(r!=null&&h.depth>=r){let g=e.nodes[h.path];g?.deps&&g.deps.length>0&&(l=!0);continue}let p=e.nodes[h.path];if(p==null)continue;let f=p.deps??[],c=new Map;for(let g=0;g<f.length;g++){let b=f[g];if(!b)continue;let v=c.get(b);v==null&&(v=[],c.set(b,v)),v.push(g)}for(let[g,b]of c)i.has(g)||(i.add(g),o.set(g,{from:h.path,depIndices:b}),s.push({path:g,depth:h.depth+1}))}if(!o.has(t))return{found:!1,pathOrder:[],truncated:l};let u=[{path:t}],d=t;for(;d!==n;){let h=o.get(d);if(h==null)return{found:!1,pathOrder:[],truncated:!1};u[u.length-1].depIndices=h.depIndices,u.push({path:h.from}),d=h.from}return{found:!0,pathOrder:u,truncated:!1}}function lt(e,t,n){let r=e.nodes[t];if(r==null)return null;let o=r.deps??[],s=[];for(let a=0;a<o.length;a++)o[a]===t&&s.push(a);if(s.length>0){let a=ie(t,r,0,n);a.dep_index=s[0];let l=ie(t,r,1,n);return ae(t,t,[a,l])}let i=null;for(let a=0;a<o.length;a++){let l=o[a];if(!l||l===t)continue;let u=je(e,l,t,n.maxDepth);u.found&&(i==null||u.pathOrder.length<i.pathOrder.length)&&(i=u,i={found:!0,pathOrder:[{path:t,depIndices:[a]},...u.pathOrder],truncated:!1})}return i==null?null:ae(t,t,Be(e,i.pathOrder,n))}function Be(e,t,n){return t.map((r,o)=>{let s=e.nodes[r.path],i=ie(r.path,s,o,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 ie(e,t,n,r){let o={path:e,type:t.type,hop:n};t.status!==void 0&&(o.status=t.status),"value"in t&&(o.value=t.value),t.v!=null&&(o.v=t.v);let s=r.annotations?.get(e)??t.annotation;s!=null&&(o.annotation=s);let i=r.lastMutations?.get(e)??t.lastMutation;return i!=null&&(o.lastMutation=i),o}function ae(e,t,n){return Fe(e,t,!0,"ok",n)}function oe(e,t,n){return Fe(e,t,!1,n,[])}function Fe(e,t,n,r,o){let s=ct(e,t,n,r,o);return{from:e,to:t,found:n,reason:r,steps:o,text:s,toJSON(){return{from:e,to:t,found:n,reason:r,steps:o}}}}function ct(e,t,n,r,o){if(!n)switch(r){case"no-such-from":return`explainPath: no node named "${e}"`;case"no-such-to":return`explainPath: no node named "${t}"`;case"max-depth-exceeded":return`explainPath: no path from "${e}" to "${t}" within maxDepth`;default:return`explainPath: no path from "${e}" to "${t}"`}let s=[`Causal path: ${e} \u2192 ${t} (${o.length} step(s))`];for(let i of o){let l=` ${i.hop===0?"\xB7":"\u2193"} ${i.path} (${i.type}${i.status?`/${i.status}`:""})`;if(s.push(l),"value"in i&&s.push(` value: ${dt(i.value)}`),i.annotation!=null&&s.push(` annotation: ${i.annotation}`),i.lastMutation!=null){let u=i.lastMutation.actor;s.push(` actor: ${u.type}${u.id?`:${u.id}`:""}`)}}return s.join(`
2
+ `)}function dt(e){if(e===void 0)return"<sentinel>";if(e===null)return"null";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{let t=JSON.stringify(e);return t.length>80?`${t.slice(0,77)}...`:t}catch{return String(e)}}var A={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},ft=Symbol.for("sizeof");function ze(e){let t=new WeakSet,n=new WeakSet,r=[e],o=0;for(;r.length>0;){let s=r.pop();o+=pt(s,t,n,r)}return o}function pt(e,t,n,r){if(e==null)return 0;switch(typeof e){case"number":return A.number;case"boolean":return A.boolean;case"string":return A.string+e.length*2;case"bigint":return A.bigint+ht(e);case"symbol":return A.symbol;case"function":return t.has(e)?0:(t.add(e),A.function);case"undefined":return 0}let s=e;if(t.has(s))return 0;t.add(s);let i=s[ft];if(typeof i=="function")try{let u=i.call(s);if(typeof u=="number"&&Number.isFinite(u))return u}catch{}if(s instanceof Date)return A.date;if(s instanceof RegExp)return A.regexp+s.source.length*2;if(s instanceof Error){let u=s.message?s.message.length*2:0,d=s.stack?s.stack.length*2:0;return A.error+u+d}if(typeof URL<"u"&&s instanceof URL)return A.url+s.href.length*2;if(typeof Promise<"u"&&s instanceof Promise)return A.promise;if(s instanceof WeakMap)return A.weakmap;if(s instanceof WeakSet)return A.weakset;if(s instanceof Map){let u=A.map;for(let[d,h]of s)u+=A.mapEntry,r.push(d),r.push(h);return u}if(s instanceof Set){let u=A.set;for(let d of s)u+=A.setEntry,r.push(d);return u}if(Array.isArray(s)){let u=A.array+s.length*8;for(let d of s)r.push(d);return u}if(s instanceof ArrayBuffer)return n.has(s)?0:(n.add(s),s.byteLength);if(ArrayBuffer.isView(s)){let u=s;return n.has(u.buffer)?48:(n.add(u.buffer),u.buffer.byteLength+48)}let a=A.object,l=Object.keys(s);for(let u of l){a+=A.string+u.length*2;try{r.push(s[u])}catch{}}return a}function ht(e){let t=e<0n?-e:e;if(t===0n)return 0;let n=t.toString(2).length;return Math.ceil(n/32)*8}function He(e,t){let n=t?.topN??10,r=e.describe({detail:"standard"}),o=[],s=e._collectObserveTargets;typeof s=="function"&&s.call(e,"",o);let i=new Map;for(let[p,f]of o)i.set(p,f);let a=[];for(let[p,f]of Object.entries(r.nodes)){let c=i.get(p),g=c instanceof L?c:null,b=g?ze(g.cache):0,v=g?g._sinkCount:0,w=f.deps?.length??0,m=f.type==="effect"&&v===0,y=v===0?f.type==="effect"?"orphan-effect":f.type==="derived"?"idle-derived":f.type==="producer"?"idle-producer":null:null;a.push({path:p,type:f.type,status:f.status??"unknown",valueSizeBytes:b,subscriberCount:v,depCount:w,isOrphanEffect:m,orphanKind:y})}let l=a.reduce((p,f)=>p+f.valueSizeBytes,0),u=(p,f)=>[...a].sort(f??((c,g)=>g[p]-c[p])).slice(0,n),d=a.filter(p=>p.orphanKind!=null),h=a.filter(p=>p.isOrphanEffect);return{nodeCount:a.length,edgeCount:r.edges.length,subgraphCount:r.subgraphs.length,nodes:a,totalValueSizeBytes:l,hotspots:{byValueSize:u("valueSizeBytes"),bySubscriberCount:u("subscriberCount"),byDepCount:u("depCount")},orphans:d,orphanEffects:h}}var X=class{constructor(t){this.capacity=t;if(!Number.isInteger(t)||t<=0)throw new Error(`RingBuffer capacity must be a positive integer (got ${t})`);this.buf=new Array(t)}buf;head=0;_size=0;get size(){return this._size}get maxSize(){return this.capacity}push(t){let n=(this.head+this._size)%this.capacity;this.buf[n]=t,this._size<this.capacity?this._size++:this.head=(this.head+1)%this.capacity}shift(){if(this._size===0)return;let t=this.buf[this.head];return this.buf[this.head]=void 0,this.head=(this.head+1)%this.capacity,this._size--,t}at(t){if(this._size===0)return;let n=t<0?this._size+t:t;if(!(n<0||n>=this._size))return this.buf[(this.head+n)%this.capacity]}toArray(){let t=new Array(this._size);for(let n=0;n<this._size;n++)t[n]=this.buf[(this.head+n)%this.capacity];return t}clear(){for(let t=0;t<this._size;t++)this.buf[(this.head+t)%this.capacity]=void 0;this.head=0,this._size=0}};function Re(e){return e>=768&&e<=879||e>=1155&&e<=1161||e>=1425&&e<=1469||e>=1552&&e<=1562||e>=1611&&e<=1631||e>=1648&&e===1648||e>=1750&&e<=1756||e>=1759&&e<=1764||e>=1767&&e<=1768||e>=1770&&e<=1773||e>=1840&&e<=1866||e>=1958&&e<=1968||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2641||e>=2672&&e<=2673||e>=2677&&e===2677||e>=3633&&e===3633||e>=3636&&e<=3642||e>=3655&&e<=3662||e>=3761&&e===3761||e>=3764&&e<=3772||e>=3784&&e<=3790||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65024&&e<=65039||e>=65056&&e<=65071||e===8205?0:e>=4352&&e<=4447||e>=8986&&e<=8987||e>=9001&&e<=9002||e>=9193&&e<=9203||e>=9208&&e<=9210||e>=9725&&e<=9726||e>=9748&&e<=9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e>=9898&&e<=9899||e>=9917&&e<=9918||e>=9924&&e<=9925||e===9934||e===9940||e===9962||e>=9970&&e<=9971||e===9973||e===9978||e===9981||e===9986||e===9989||e>=9992&&e<=9997||e===9999||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e>=10548&&e<=10549||e>=11013&&e<=11015||e>=11035&&e<=11036||e===11088||e===11093||e>=11904&&e<=12350||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=40959||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=126980&&e===126980||e===127183||e>=127344&&e<=127345||e===127358||e===127359||e===127374||e>=127377&&e<=127386||e>=127456&&e<=127487||e>=127488&&e<=127490||e===127514||e===127535||e>=127538&&e<=127546||e>=127568&&e<=127569||e>=127744&&e<=129535||e>=129536&&e<=129791||e>=129792&&e<=130047||e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}function ue(e){let t=0;for(let n of e)t+=Re(n.codePointAt(0));return t}function Ve(e,t){if(t<=0)return"";let n=0,r="";for(let o of e){let s=Re(o.codePointAt(0));if(n+s>t){if(t<=1)return"\u2026";for(;n+1>t&&r.length>0;){let i=[...r].pop();r=r.slice(0,-i.length),n-=Re(i.codePointAt(0))}return`${r}\u2026`}r+=o,n+=s}return r}var gt={horizontal:"\u2500",vertical:"\u2502",cornerTL:"\u250C",cornerTR:"\u2510",cornerBL:"\u2514",cornerBR:"\u2518",tDown:"\u252C",tUp:"\u2534",tRight:"\u251C",tLeft:"\u2524",cross:"\u253C",arrowRight:"\u25B6",arrowDown:"\u25BC",arrowLeft:"\u25C0",arrowUp:"\u25B2",boxTL:"\u250C",boxTR:"\u2510",boxBL:"\u2514",boxBR:"\u2518",boxH:"\u2500",boxV:"\u2502"},mt={horizontal:"-",vertical:"|",cornerTL:"+",cornerTR:"+",cornerBL:"+",cornerBR:"+",tDown:"+",tUp:"+",tRight:"+",tLeft:"+",cross:"+",arrowRight:">",arrowDown:"v",arrowLeft:"<",arrowUp:"^",boxTL:"+",boxTR:"+",boxBL:"+",boxBR:"+",boxH:"-",boxV:"|"};function Ue(e,t){let n=t.charset==="ascii"?mt:gt,r=e.width,o=e.height,s=Array.from({length:o},()=>Array.from({length:r},()=>" ")),i=Array.from({length:o},()=>Array.from({length:r},()=>"empty"));for(let a of e.edges)yt(s,i,n,a);for(let a of e.boxes)bt(s,i,n,a,t.labelOf(a.id));return s.map(a=>Ot(a.join(""))).join(`
3
+ `)}function bt(e,t,n,r,o){let{x:s,y:i,w:a,h:l}=r;if(a<2||l<2){l>0&&Ke(e,t,s,i,a,o);return}H(e,t,s,i,n.boxTL);for(let d=s+1;d<s+a-1;d+=1)H(e,t,d,i,n.boxH);H(e,t,s+a-1,i,n.boxTR);for(let d=i+1;d<i+l-1;d+=1){H(e,t,s,d,n.boxV);for(let h=s+1;h<s+a-1;h+=1)Je(e,t,h,d," ","empty");H(e,t,s+a-1,d,n.boxV)}H(e,t,s,i+l-1,n.boxBL);for(let d=s+1;d<s+a-1;d+=1)H(e,t,d,i+l-1,n.boxH);H(e,t,s+a-1,i+l-1,n.boxBR);let u=i+Math.floor(l/2);Ke(e,t,s+1,u,a-2,o)}function H(e,t,n,r,o){Je(e,t,n,r,o,o===" "?"empty":o==="\u2500"||o==="-"?"boxH":o==="\u2502"||o==="|"?"boxV":"boxCorner")}function Je(e,t,n,r,o,s){if(r<0||r>=e.length)return;let i=e[r];n<0||n>=i.length||(i[n]=o,t[r][n]=s)}function Ke(e,t,n,r,o,s){if(r<0||r>=e.length)return;let i=n,a=o;for(let l of s){let u=ue(l);if(u!==0){if(a<u)break;i>=0&&i<e[r].length&&(e[r][i]=l,t[r][i]="label",u===2&&i+1<e[r].length&&(e[r][i+1]="",t[r][i+1]="label")),i+=u,a-=u}}for(;a>0;)i>=0&&i<e[r].length&&(e[r][i]=" ",t[r][i]="empty"),i+=1,a-=1}function yt(e,t,n,r){let o=r.points;if(o.length<2)return;for(let l=0;l+1<o.length;l+=1)vt(e,t,n,o[l],o[l+1]);for(let l=1;l+1<o.length;l+=1){let u=o[l-1],d=o[l],h=o[l+1],p=xt(u,d,h,n);p&&qe(e,t,d.x,d.y,p,"edgeCorner")}let s=o[o.length-1],i=o[o.length-2],a=wt(i,s,n);a&&qe(e,t,s.x,s.y,a,"arrow")}function vt(e,t,n,r,o){if(!(r.x===o.x&&r.y===o.y)){if(r.y===o.y){let s=r.y,i=Math.min(r.x,o.x),a=Math.max(r.x,o.x);for(let l=i;l<=a;l+=1)We(e,t,l,s,n,"h")}else if(r.x===o.x){let s=r.x,i=Math.min(r.y,o.y),a=Math.max(r.y,o.y);for(let l=i;l<=a;l+=1)We(e,t,s,l,n,"v")}}}function We(e,t,n,r,o,s){if(r<0||r>=e.length)return;let i=e[r];if(n<0||n>=i.length)return;let a=t[r][n];if(!(a==="boxH"||a==="boxV"||a==="boxCorner"||a==="label")){if(a==="empty"){i[n]=s==="h"?o.horizontal:o.vertical,t[r][n]=s==="h"?"edgeH":"edgeV";return}if(a==="edgeH"&&s==="v"){i[n]=o.cross,t[r][n]="edgeCorner";return}if(a==="edgeV"&&s==="h"){i[n]=o.cross,t[r][n]="edgeCorner";return}}}function qe(e,t,n,r,o,s){if(r<0||r>=e.length)return;let i=e[r];if(n<0||n>=i.length)return;let a=t[r][n];a==="boxH"||a==="boxV"||a==="boxCorner"||a==="label"||(i[n]=o,t[r][n]=s)}function xt(e,t,n,r){let o=e.y===t.y,s=t.y===n.y;if(o===s)return;if(o){let l=e.x<t.x,u=n.y>t.y;return l&&u?r.cornerTR:l&&!u?r.cornerBR:!l&&u?r.cornerTL:r.cornerBL}let i=e.y<t.y,a=n.x>t.x;return i&&a?r.cornerBL:i&&!a?r.cornerBR:!i&&a?r.cornerTL:r.cornerTR}function wt(e,t,n){if(t.x>e.x)return n.arrowRight;if(t.x<e.x)return n.arrowLeft;if(t.y>e.y)return n.arrowDown;if(t.y<e.y)return n.arrowUp}function Ot(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===32;)t-=1;return e.slice(0,t)}function Qe(e){let t=_t(e);Et(t),St(t),Rt(t),Dt(t,e);let n=kt(t,e),{width:r,height:o}=Tt(t),s=[];for(let i of t.layers)for(let a of i)a.isVirtual||s.push({id:a.id,layer:a.layer,order:a.order,x:a.x,y:a.y,w:a.w,h:a.h});return{boxes:s,edges:n,width:r,height:o}}function _t(e){let t=new Map;for(let o of e.nodes)t.set(o,{id:o,isVirtual:!1,layer:-1,order:0,x:0,y:0,w:e.widthCells(o),h:e.heightCells(o),in:[],out:[]});let n=[],r=0;for(let o of e.edges){if(o.from===o.to)continue;let s=t.get(o.from),i=t.get(o.to);if(!s||!i)continue;let a={chainId:r++,chainFrom:o.from,chainTo:o.to,fromId:o.from,toId:o.to,hopIndex:0,chainLen:1};s.out.push(a),i.in.push(a),n.push(a)}return{nodes:t,layers:[],hops:n}}function Et(e){let t=new Map;for(let s of e.nodes.values())t.set(s.id,s.in.length);let n=[];for(let s of e.nodes.values())(t.get(s.id)??0)===0&&(s.layer=0,n.push(s));let r=new Set,o=0;for(;o<n.length;){let s=n[o++];if(!r.has(s.id)){r.add(s.id);for(let i of s.out){let a=e.nodes.get(i.toId);a.layer=Math.max(a.layer,s.layer+1);let l=(t.get(a.id)??0)-1;t.set(a.id,l),l<=0&&n.push(a)}}}for(let s of e.nodes.values())s.layer<0&&(s.layer=0)}function St(e){let t=Math.max(0,...Array.from(e.nodes.values(),s=>s.layer)),n=Array.from({length:t+1},()=>[]);for(let s of e.nodes.values())n[s.layer].push(s);let r=[],o=0;for(let s of e.hops){let i=e.nodes.get(s.fromId),a=e.nodes.get(s.toId),l=a.layer-i.layer;if(l<=0){i.out=i.out.filter(h=>h!==s),a.in=a.in.filter(h=>h!==s);continue}if(l===1){s.hopIndex=0,s.chainLen=1,r.push(s);continue}i.out=i.out.filter(h=>h!==s),a.in=a.in.filter(h=>h!==s);let u=i;for(let h=1;h<l;h+=1){let p=`__virt_${o++}__`,f={id:p,isVirtual:!0,layer:i.layer+h,order:0,x:0,y:0,w:0,h:1,in:[],out:[]};e.nodes.set(p,f),n[f.layer].push(f);let c={chainId:s.chainId,chainFrom:s.chainFrom,chainTo:s.chainTo,fromId:u.id,toId:p,hopIndex:h-1,chainLen:l};u.out.push(c),f.in.push(c),r.push(c),u=f}let d={chainId:s.chainId,chainFrom:s.chainFrom,chainTo:s.chainTo,fromId:u.id,toId:a.id,hopIndex:l-1,chainLen:l};u.out.push(d),a.in.push(d),r.push(d)}for(let s of n)for(let i=0;i<s.length;i+=1)s[i].order=i;e.layers=n,e.hops=r}function Rt(e){for(let n=0;n<4;n+=1){for(let r=1;r<e.layers.length;r+=1)Ye(e,e.layers[r],"in"),le(e.layers[r]);for(let r=e.layers.length-2;r>=0;r-=1)Ye(e,e.layers[r],"out"),le(e.layers[r])}for(let n=0;n<2;n+=1){let r=!1;for(let o=1;o<e.layers.length;o+=1){let s=e.layers[o];for(let i=0;i+1<s.length;i+=1){let a=Xe(e,s[i],s[i+1],"in");[s[i],s[i+1]]=[s[i+1],s[i]],le(s),Xe(e,s[i],s[i+1],"in")<a?r=!0:([s[i],s[i+1]]=[s[i+1],s[i]],le(s))}}if(!r)break}}function Ye(e,t,n){let r=new Map;for(let o of t){let s=n==="in"?o.in:o.out;if(s.length===0){r.set(o.id,o.order);continue}let i=0,a=0;for(let l of s){let u=e.nodes.get(n==="in"?l.fromId:l.toId);u&&(i+=u.order,a+=1)}r.set(o.id,a===0?o.order:i/a)}t.sort((o,s)=>{let i=r.get(o.id),a=r.get(s.id);return i!==a?i-a:o.order-s.order})}function le(e){for(let t=0;t<e.length;t+=1)e[t].order=t}function Xe(e,t,n,r){let o=r==="in"?t.in:t.out,s=r==="in"?n.in:n.out,i=0;for(let a of o)for(let l of s){let u=e.nodes.get(r==="in"?a.fromId:a.toId)?.order??0,d=e.nodes.get(r==="in"?l.fromId:l.toId)?.order??0;(t.order<n.order&&u>d||t.order>n.order&&u<d)&&(i+=1)}return i}function Dt(e,t){t.direction==="LR"?Gt(e,t):Ct(e,t)}function Gt(e,t){let n=[],r=0;for(let o=0;o<e.layers.length;o+=1){n.push(r);let s=0;for(let i of e.layers[o])s=Math.max(s,i.w);r+=s+t.layerGap}for(let o=0;o<e.layers.length;o+=1)for(let s of e.layers[o])s.x=n[o];for(let o of e.layers){let s=0;for(let i of o)i.y=s,s+=i.h+t.nodeGap}Ze(e,t,"y")}function Ct(e,t){let n=[],r=0;for(let o=0;o<e.layers.length;o+=1){n.push(r);let s=0;for(let i of e.layers[o])s=Math.max(s,i.h);r+=s+t.layerGap}for(let o=0;o<e.layers.length;o+=1)for(let s of e.layers[o])s.y=n[o];for(let o of e.layers){let s=0;for(let i of o)i.x=s,s+=i.w+t.nodeGap}Ze(e,t,"x")}function Ze(e,t,n){let r=s=>n==="y"?s.h:s.w,o=t.nodeGap;for(let s=0;s<2;s+=1){let i=s===0?e.layers.slice(1):e.layers.slice(0,-1).reverse();for(let a of i){let l=new Map;for(let d of a){let h=s===0?d.in:d.out;if(h.length===0)continue;let p=[];for(let c of h){let g=e.nodes.get(s===0?c.fromId:c.toId);if(!g)continue;let b=n==="y"?g.y:g.x;p.push(b+Math.floor(r(g)/2))}if(p.length===0)continue;p.sort((c,g)=>c-g);let f=p[Math.floor(p.length/2)];l.set(d.id,f-Math.floor(r(d)/2))}let u=0;for(let d of a){let h=l.get(d.id),p=n==="y"?d.y:d.x,c=Math.max(h??p,u);n==="y"?d.y=c:d.x=c,u=c+r(d)+o}}}}function kt(e,t){let n=new Map;for(let u of e.hops){let d=n.get(u.chainId);d?d.push(u):n.set(u.chainId,[u])}for(let u of n.values())u.sort((d,h)=>d.hopIndex-h.hopIndex);let r=t.direction==="LR",o=u=>r?u.x:u.y,s=u=>r?u.w:u.h,i=u=>r?u.y+Math.floor(u.h/2):u.x+Math.floor(u.w/2),a=new Map;for(let u=0;u+1<e.layers.length;u+=1){let d=e.layers[u],h=e.layers[u+1],p=0;for(let E of d)p=Math.max(p,o(E)+s(E));let f=Number.POSITIVE_INFINITY;for(let E of h)f=Math.min(f,o(E));let c=Number.isFinite(f)?f-1:p,g=Math.max(1,c-p+1),b=[];for(let E of d)for(let R of E.out)b.push(R);b.sort((E,R)=>{let k=i(e.nodes.get(E.fromId)),$=i(e.nodes.get(R.fromId));if(k!==$)return k-$;let G=i(e.nodes.get(E.toId)),D=i(e.nodes.get(R.toId));return G-D});let v=[],w=new Map;for(let E of b){let R=i(e.nodes.get(E.fromId)),k=i(e.nodes.get(E.toId)),$=Math.min(R,k),G=Math.max(R,k),D=-1;for(let P=0;P<v.length;P+=1){let F=v[P],z=!0;for(let U of F)if(U.lo<=G&&$<=U.hi){z=!1;break}if(z){F.push({lo:$,hi:G}),D=P;break}}D<0&&(v.push([{lo:$,hi:G}]),D=v.length-1),w.set(E,D)}let m=v.length,y=g>=Math.max(3,m+2),S=y?p+1:p,x=y?c-1:c,O=Math.max(1,x-S+1);for(let E of b){let R=w.get(E),k;if(m<=1)k=S+Math.floor(O/2);else{let $=(O-1)/(m-1);k=S+Math.floor(R*$)}a.set(E,Math.max(p,Math.min(c,k)))}}let l=[];for(let[,u]of n){let d=[];for(let p=0;p<u.length;p+=1){let f=u[p],c=e.nodes.get(f.fromId),g=e.nodes.get(f.toId),b=a.get(f),v=c.isVirtual?o(c):o(c)+s(c),w=g.isVirtual?o(g):o(g)-1,m=i(c),y=i(g);p===0&&ce(d,r,v,m),m!==y&&(ce(d,r,b,m),ce(d,r,b,y)),ce(d,r,w,y)}let h=u[0];l.push({from:h.chainFrom,to:h.chainTo,points:$t(d)})}return l}function ce(e,t,n,r){e.push(t?{x:n,y:r}:{x:r,y:n})}function $t(e){let t=[];for(let n of e){let r=t[t.length-1];(!r||r.x!==n.x||r.y!==n.y)&&t.push(n)}return t}function Tt(e){let t=0,n=0;for(let r of e.layers)for(let o of r)t=Math.max(t,o.x+o.w),n=Math.max(n,o.y+o.h);return{width:t,height:n}}var Nt=24,At=4,Pt=1,Mt=3;function et(e,t){let n=Lt(t.direction),r=Math.max(3,t.maxLabelWidth??Nt),o=t.asciiCharset??"unicode",s=Object.keys(e.nodes).sort(),i=new Set(s),a=e.edges.filter(f=>i.has(f.from)&&i.has(f.to)),l=new Map,u=new Map;for(let f of s){let c=Ve(f,r);l.set(f,c),u.set(f,ue(c)+4)}let d=Qe({nodes:s,edges:a,widthCells:f=>u.get(f)??3,heightCells:()=>Mt,layerGap:At,nodeGap:Pt,direction:n}),h=Ue(d,{charset:o,labelOf:f=>l.get(f)??f}),p=t.logger;return p&&p(h),h}function Lt(e){if(e===void 0||e==="LR")return"LR";if(e==="TD")return"TD";throw new Error(`ascii describe supports direction "LR" or "TD" only; got ${String(e)}`)}var N="::",B="__meta__",q=1;function tt(e,t){let n=Math.max(16,e.size*4),r=0;for(;e.size>0;){if(r++>=n){console.error(`[Graph "${t}".destroy] disposer drain exceeded cap (${n}); ${e.size} disposer(s) discarded`),e.clear();return}let o=e.values().next();if(o.done)return;let s=o.value;e.delete(s);try{s()}catch(i){console.error(`[Graph "${t}".destroy] disposer threw:`,i)}}}function It(e){let t=[];for(let n of Object.keys(e).sort()){let r=e[n].v;r!=null&&t.push(`${n} ${r.id} ${r.version}`)}return t.join(`
4
+ `)}function nt(e){if(e.version!==q)throw new Error(`unsupported snapshot version ${String(e.version)} (expected ${q})`);for(let t of["name","nodes","edges","subgraphs"])if(!(t in e))throw new Error(`snapshot missing required key "${t}"`);if(typeof e.name!="string")throw new TypeError("snapshot 'name' must be a string");if(typeof e.nodes!="object"||e.nodes===null||Array.isArray(e.nodes))throw new TypeError("snapshot 'nodes' must be an object");if(!Array.isArray(e.edges))throw new TypeError("snapshot 'edges' must be an array");if(!Array.isArray(e.subgraphs))throw new TypeError("snapshot 'subgraphs' must be an array")}function jt(e,t){let n=new WeakMap,r=(o,s)=>{if(Object.is(o,s))return!0;if(o==null||s==null||typeof o!="object"||typeof s!="object")return!1;let i=n.get(o);if(i==null&&(i=new WeakSet,n.set(o,i)),i.has(s))return!0;i.add(s);let a=o.constructor,l=s.constructor;if(a!==l)return!1;if(o instanceof Date)return o.getTime()===s.getTime();if(o instanceof RegExp)return o.source===s.source&&o.flags===s.flags;if(Array.isArray(o)){let p=s;if(o.length!==p.length)return!1;for(let f=0;f<o.length;f++)if(!r(o[f],p[f]))return!1;return!0}if(o instanceof Map){let p=s;if(o.size!==p.size)return!1;for(let[f,c]of o)if(!p.has(f)||!r(c,p.get(f)))return!1;return!0}if(o instanceof Set){let p=s;if(o.size!==p.size)return!1;for(let f of o){let c=!1;for(let g of p)if(r(f,g)){c=!0;break}if(!c)return!1}return!0}if(ArrayBuffer.isView(o)){let p=o,f=s;if(p.length!==f.length)return!1;for(let c=0;c<p.length;c++)if(p[c]!==f[c])return!1;return!0}let u=Object.keys(o),d=Object.keys(s);if(u.length!==d.length)return!1;let h=new Set(d);for(let p of u)if(!h.has(p)||!r(o[p],s[p]))return!1;return!0};return r(e,t)}function Ge(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ge);let t=e,n=Object.keys(t).sort(),r={};for(let o of n)r[o]=Ge(t[o]);return r}function Bt(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function Ft(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function zt(e){return e==="TD"?"down":e==="BT"?"up":e==="RL"?"left":"right"}function ot(e){let t=new Set,n=[];function r(o,s){let i=`${o}\0${s}`;t.has(i)||(t.add(i),n.push([o,s]))}for(let[o,s]of Object.entries(e.nodes)){let i=s.deps;if(i)for(let a of i)r(a,o)}for(let o of e.edges)r(o.from,o.to);return n}function it(e){if(e===void 0)return"LR";if(e==="TD"||e==="LR"||e==="BT"||e==="RL")return e;throw new Error(`invalid diagram direction ${String(e)}; expected one of: TD, LR, BT, RL`)}function Ht(e,t){let n=t.includeEdges??!0,r=t.includeSubgraphs??!0,{expand:o,...s}=e,i={...s,edges:n?e.edges:[],subgraphs:r?e.subgraphs:[]},a=JSON.stringify(Ge(i),null,t.indent??2);return t.logger?.(a),a}function Vt(e,t){let n=t.includeEdges??!0,r=t.includeSubgraphs??!0,o=[];o.push(`Graph ${e.name}`),o.push("Nodes:");for(let i of Object.keys(e.nodes).sort()){let a=e.nodes[i];o.push(`- ${i} (${a.type}/${a.status}): ${fe(a.value)}`)}if(n){o.push("Edges:");for(let i of e.edges)o.push(`- ${i.from} -> ${i.to}`)}if(r){o.push("Subgraphs:");for(let i of e.subgraphs)o.push(`- ${i}`)}let s=o.join(`
5
+ `);return t.logger?.(s),s}function at(e,t){let n=it(t.direction),r=Object.keys(e.nodes).sort(),o=new Map;for(let i=0;i<r.length;i+=1)o.set(r[i],`n${i}`);let s=[`flowchart ${n}`];for(let i of r){let a=o.get(i);s.push(` ${a}["${Bt(i)}"]`)}for(let[i,a]of ot(e)){let l=o.get(i),u=o.get(a);!l||!u||s.push(` ${l} --> ${u}`)}return s.join(`
6
+ `)}function Kt(e,t){let n=at(e,t);return Wt(n)}function Wt(e,t){let n=t?.theme??"default",r=t?.autoSync??!0,s=JSON.stringify({code:e,mermaid:{theme:n},autoSync:r}),i=new TextEncoder().encode(s),a="";for(let u=0;u<i.length;u++)a+=String.fromCharCode(i[u]);return`https://mermaid.live/edit#base64:${globalThis.btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}function qt(e,t){let n=it(t.direction),r=Object.keys(e.nodes).sort(),o=new Map;for(let i=0;i<r.length;i+=1)o.set(r[i],`n${i}`);let s=[`direction: ${zt(n)}`];for(let i of r){let a=o.get(i);s.push(`${a}: "${Ft(i)}"`)}for(let[i,a]of ot(e)){let l=o.get(i),u=o.get(a);!l||!u||s.push(`${l} -> ${u}`)}return s.join(`
7
+ `)}function Ut(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function de(e){let t="^";for(let n=0;n<e.length;n+=1){let r=e[n];if(r==="*"){t+=".*";continue}if(r==="?"){t+=".";continue}if(r==="["){let o=e.indexOf("]",n+1);if(o<=n+1){t+="\\[";continue}let s=e.slice(n+1,o);s.startsWith("!")&&(s=`^${s.slice(1)}`),s=s.replace(/\\/g,"\\\\"),t+=`[${s}]`,n=o;continue}t+=Ut(r)}return t+="$",new RegExp(t)}var Jt={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"},Yt={data:"",dirty:"",resolved:"",invalidate:"",pause:"",resume:"",complete:"",error:"",teardown:"",derived:"",path:"",reset:""};function fe(e){if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean"||e==null)return String(e);try{return JSON.stringify(e)}catch{return"[unserializable]"}}function Xt(e){return e==="none"?Yt:e==="ansi"||e==null?Jt:{data:e.data??"",dirty:e.dirty??"",resolved:e.resolved??"",invalidate:e.invalidate??"",pause:e.pause??"",resume:e.resume??"",complete:e.complete??"",error:e.error??"",teardown:e.teardown??"",derived:e.derived??"",path:e.path??"",reset:e.reset??""}}function rt(e){if(e==null)return{};let t=e.detail;return t==="full"?{...e,structured:e.structured??!0,timeline:e.timeline??!0,causal:e.causal??!0,derived:e.derived??!0}:t==="minimal"?{...e,structured:e.structured??!0}:e.format==="stage-log"?{...e,structured:e.structured??!0,timeline:e.timeline??!0}:e}function Qt(e,t,n){for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o<32||o===127)throw new Error(`Graph "${t}": ${n} "${e}" must not contain control character (U+${o.toString(16).padStart(4,"0").toUpperCase()} at index ${r})`)}}function De(e,t,n){if(e==="")throw new Error(`Graph "${t}": ${n} name must be non-empty`);if(e.includes(N))throw new Error(`Graph "${t}": ${n} "${e}" must not contain '${N}' (path separator)`);if(e===B)throw new Error(`Graph "${t}": ${n} name "${B}" is reserved for meta companion paths`);Qt(e,t,n)}function Zt(e,t){if(e==="")throw new Error(`Graph "${t}": resolve path must be non-empty`);let n=e.split(N);for(let r of n)if(r==="")throw new Error(`Graph "${t}": resolve path has empty segment`);return n}function en(e,t){let n=!1;for(let o of e)if(!t.isMetaPassthrough(o[0])){n=!0;break}return n?e.filter(o=>t.isMetaPassthrough(o[0])):e}function ut(e){for(let t of e._mounts.values())ut(t);for(let t of e._nodes.values())try{t.down([[V]],{internal:!0})}catch{}}var Ce=class e{name;opts;config;_nodes=new Map;_nodeToName=new WeakMap;_mounts=new Map;_parent=void 0;_storageDisposers=new Set;_disposers=new Set;_topology;_topologyEmitters=new Set;constructor(t,n){if(t==="")throw new Error("Graph name must be non-empty");if(t.includes(N))throw new Error(`Graph name must not contain '${N}' (got "${t}")`);if(t===B)throw new Error(`Graph name "${B}" is reserved for meta companion paths`);this.name=t,this.opts=Object.freeze({...n??{}}),this.config=n?.config??Oe,this._traceRing=new X(n?.traceCapacity??1e3),n?.versioning!=null&&this.setVersioning(n.versioning)}ancestors(t=!0){let n=[],r=t?this:this._parent;for(;r!=null;)n.push(r),r=r._parent;return n}get topology(){return this._topology==null&&(this._topology=Me(t=>{let n=r=>{t.emit(r)};return this._topologyEmitters.add(n),()=>{this._topologyEmitters.delete(n)}},{name:`${this.name}_topology`})),this._topology}_emitTopology(t){if(!(this._topology==null||this._topologyEmitters.size===0))for(let n of this._topologyEmitters)n(t)}add(t,n){let r=t.name,o=n?.name??r;if(o==null||o==="")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 s=o,i=n?.annotation;if(De(s,this.name,"add"),this._mounts.has(s))throw new Error(`Graph "${this.name}": name "${s}" is already a mount point`);if(this._nodes.has(s))throw new Error(`Graph "${this.name}": node "${s}" already exists`);let a=this._nodeToName.get(t);if(a!==void 0)throw new Error(`Graph "${this.name}": node instance already registered as "${a}"`);return this._nodes.set(s,t),this._nodeToName.set(t,s),this._emitTopology({kind:"added",name:s,nodeKind:"node"}),i!=null&&(this._annotations.set(s,i),this.config.inspectorEnabled&&this._traceRing.push({path:s,annotation:i,timestamp_ns:K()})),t}setVersioning(t){if(t!=null)for(let n of this._nodes.values())n instanceof L&&n._applyVersioning(t)}remove(t){De(t,this.name,"remove");let n=this._mounts.get(t);if(n){let s={kind:"mount",nodes:[],mounts:[]},i=[];n._collectObserveTargets("",i);for(let[a,l]of i)a.includes(`${N}${B}${N}`)||s.nodes.push(a);return s.nodes.sort(),s.mounts.push(t),s.mounts.push(...n._collectSubgraphs(`${t}${N}`)),this._mounts.delete(t),n._parent=void 0,ut(n),this._emitTopology({kind:"removed",name:t,nodeKind:"mount",audit:s}),s}let r=this._nodes.get(t);if(!r)throw new Error(`Graph "${this.name}": unknown node or mount "${t}"`);this._nodes.delete(t),this._nodeToName.delete(r),r.down([[V]],{internal:!0});let o={kind:"node",nodes:[t],mounts:[]};return this._emitTopology({kind:"removed",name:t,nodeKind:"node",audit:o}),o}removeAll(t){let n=typeof t=="function"?t:(()=>{let s=de(t);return i=>s.test(i)})(),r={kind:"mount",nodes:[],mounts:[]},o=[...this._nodes.keys(),...this._mounts.keys()].filter(s=>n(s));for(let s of o){let i=this.remove(s);r.nodes.push(...i.nodes),r.mounts.push(...i.mounts)}return r.nodes.sort(),r.mounts.sort(),r}[Symbol.iterator](){let t=[...this._nodes.keys()].sort(),n=this._nodes,r=0;return{[Symbol.iterator](){return this},next(){if(r>=t.length)return{value:void 0,done:!0};let o=t[r++];return{value:[o,n.get(o)],done:!1}}}}node(t){if(t==="")throw new Error(`Graph "${this.name}": node name must be non-empty`);if(t.includes(N))return this.resolve(t);let n=this._nodes.get(t);if(!n)throw new Error(`Graph "${this.name}": unknown node "${t}"`);return n}get(t){return this.node(t).cache}set(t,n,r){let o=r?.internal===!0;this.node(t).down([[Z,n]],{actor:r?.actor,internal:o,delivery:"write"})}setAll(t,n){let r=Symbol.iterator in t?t:Object.entries(t);Ae(()=>{for(let[o,s]of r)this.set(o,s,n)})}invalidate(t,n){let r=n?.internal===!0;this.node(t).down([[ee]],{actor:n?.actor,internal:r,delivery:"write"})}error(t,n,r){let o=r?.internal===!0;this.node(t).down([[ne,n]],{actor:r?.actor,internal:o,delivery:"write"})}complete(t,n){let r=n?.internal===!0;this.node(t).down([[te]],{actor:n?.actor,internal:r,delivery:"write"})}edges(t){let n=t?.recursive===!0,r=new Map;if(!n){for(let[l,u]of this._nodes)r.set(u,l);let a=[];for(let[l,u]of this._nodes)if(u instanceof L)for(let d of u._deps){let h=r.get(d.node);h!=null&&a.push([h,l])}return a.sort((l,u)=>l[0]<u[0]?-1:l[0]>u[0]?1:l[1]<u[1]?-1:l[1]>u[1]?1:0),a}let o=[];this._collectObserveTargets("",o);let s=new Map;for(let[a,l]of o)s.set(l,a);let i=[];for(let[a,l]of o)if(l instanceof L)for(let u of l._deps){let d=s.get(u.node);d!=null&&i.push([d,a])}return i.sort((a,l)=>a[0]<l[0]?-1:a[0]>l[0]?1:a[1]<l[1]?-1:a[1]>l[1]?1:0),i}mount(t,n){if(De(t,this.name,"mount"),this._nodes.has(t))throw new Error(`Graph "${this.name}": cannot mount at "${t}" \u2014 node with that name exists`);if(this._mounts.has(t))throw new Error(`Graph "${this.name}": mount "${t}" already exists`);if(n===this)throw new Error(`Graph "${this.name}": cannot mount a graph into itself`);if(n._parent!=null)throw new Error(`Graph "${this.name}": this child graph is already mounted on "${n._parent.name}"`);for(let r=this;r!=null;r=r._parent)if(r===n)throw new Error(`Graph "${this.name}": mount("${t}", \u2026) would create a mount cycle`);return this._mounts.set(t,n),n._parent=this,this._emitTopology({kind:"added",name:t,nodeKind:"mount"}),n}resolve(t){let n=Zt(t,this.name);return this._resolveFromSegments(n)}tryResolve(t){try{return this.resolve(t)}catch{return}}_resolveFromSegments(t){let n=t;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],o=n.slice(1);if(o.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 s=this._nodes.get(r);if(s&&o.length>0&&o[0]===B)return this._resolveMetaChainFromNode(s,o,n.join(N));let i=this._mounts.get(r);if(!i)throw this._nodes.has(r)?new Error(`Graph "${this.name}": "${r}" is a node; trailing path "${o.join(N)}" is invalid`):new Error(`Graph "${this.name}": unknown mount or node "${r}"`);return i.resolve(o.join(N))}_resolveMetaChainFromNode(t,n,r){let o=t,s=0,i=[...n];for(;s<i.length;){if(i[s]!==B)throw new Error(`Graph "${this.name}": expected ${B} segment in meta path "${r}"`);if(s+1>=i.length)throw new Error(`Graph "${this.name}": meta path requires a key after ${B} in "${r}"`);let a=i[s+1],l=o.meta[a];if(!l)throw new Error(`Graph "${this.name}": unknown meta "${a}" in path "${r}"`);o=l,s+=2}return o}signal(t,n){if(n?.internal!==!0){for(let o of t)if(this.config.messageTier(o[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(t,n??{},new Set,r),r.length>0)throw r[0]}_signalDeliver(t,n,r,o){for(let l of this._mounts.values())l._signalDeliver(t,n,r,o);let i=n.internal===!0?{internal:!0}:{actor:n.actor,delivery:"signal"},a=en(t,this.config);for(let l of[...this._nodes.keys()].sort()){let u=this._nodes.get(l);if(!r.has(u)){r.add(u);try{u.down(t,i)}catch(d){if(d instanceof W)throw d;o.push(d)}a.length!==0&&this._signalMetaSubtree(u,a,r,i,o)}}}_signalMetaSubtree(t,n,r,o,s){for(let i of Object.keys(t.meta).sort()){let a=t.meta[i];if(!r.has(a)){r.add(a);try{a.down(n,o)}catch(l){if(l instanceof W)throw l;s.push(l)}this._signalMetaSubtree(a,n,r,o,s)}}}describe(t){if(t?.reactive===!0)return this._describeReactive(t);let n=t?.actor,r=t?.filter,o=se(t?.detail,t?.fields),s=t?.format==="spec",i=s?se("minimal"):o,a=[];this._collectObserveTargets("",a);let l=new Map;for(let[x,O]of a)l.set(O,x);let u=[];{let x=a.map(([,R])=>R),O=new Set(l.values()),E=0;for(;x.length>0;){let R=x.shift();if(R instanceof L)for(let k of R._deps){let $=k.node;if(l.has($))continue;let G=$.name??"",D=G;if(!D||O.has(D))if(G){let P=2;for(;O.has(`${G}#${P}`);)P++;D=`${G}#${P}`}else for(D=`__internal__/${E++}`;O.has(D);)D=`__internal__/${E++}`;l.set($,D),O.add(D),u.push([D,$]),x.push($)}}}let d=[...a,...u],h={};for(let[x,O]of d){if(n!=null&&!O.allowsObserve(n))continue;let E=Se(O,i),R=O instanceof L?O._deps.map(D=>l.get(D.node)??D.node.name??""):[],{name:k,...$}=E,G={...$,deps:R};if(!s){let D=this._annotations.get(x);D!=null&&(G.annotation=D)}if(r!=null)if(typeof r=="function"){let D=r;if(!(D.length>=2?D(x,G):D(G)))continue}else{let D=!0;for(let[P,F]of Object.entries(r)){let z=P==="deps_includes"?"depsIncludes":P==="meta_has"?"metaHas":P;if(z==="depsIncludes"){if(!G.deps.includes(String(F))){D=!1;break}continue}if(z==="metaHas"){if(!Object.hasOwn(G.meta??{},String(F))){D=!1;break}continue}if(G[z]!==F){D=!1;break}}if(!D)continue}h[x]=G}let p=new Set(Object.keys(h)),f=[];for(let[x,O]of d)if(O instanceof L)for(let E of O._deps){let R=l.get(E.node);R!=null&&f.push([R,x])}f.sort((x,O)=>x[0]<O[0]?-1:x[0]>O[0]?1:x[1]<O[1]?-1:x[1]>O[1]?1:0);let c=f.map(([x,O])=>({from:x,to:O}));(n!=null||r!=null)&&(c=c.filter(x=>p.has(x.from)&&p.has(x.to)));let g=this._collectSubgraphs(""),b=n!=null||r!=null?g.filter(x=>{let O=`${x}${N}`;return[...p].some(E=>E===x||E.startsWith(O))}):g,v=this,w=t,m={name:this.name,nodes:h,edges:c,subgraphs:b,expand(x){let O={...w,format:void 0};return Array.isArray(x)?(O.fields=x,O.detail=void 0):(O.detail=x,O.fields=void 0),v.describe(O)}},y=t??{},S=y.format;return S==="json"?Ht(m,y):S==="pretty"?Vt(m,y):S==="mermaid"?at(m,y):S==="mermaid-url"?Kt(m,y):S==="d2"?qt(m,y):S==="ascii"?et(m,y):m}_collectSubgraphs(t){let n=[];for(let r of[...this._mounts.keys()].sort()){let o=t===""?r:`${t}${r}`;n.push(o),n.push(...this._mounts.get(r)._collectSubgraphs(`${o}${N}`))}return n}resourceProfile(t){return He(this,t)}reachable(t,n,r={}){return r.withDetail===!0?st(this.describe(),t,n,{...r,withDetail:!0}):st(this.describe(),t,n,r)}explain(t,n,r){return r?.reactive===!0?this._explainReactive(t,n,r):this._explainStatic(t,n,r)}_explainStatic(t,n,r){let o=this.describe({detail:"full"}),s=new Map(this._annotations),i=new Map;for(let[a,l]of Object.entries(o.nodes))l.lastMutation!=null&&i.set(a,l.lastMutation);return Ie(o,t,n,{...r?.maxDepth!=null?{maxDepth:r.maxDepth}:{},...r?.findCycle===!0?{findCycle:!0}:{},annotations:s,lastMutations:i})}_describeReactive(t){let n={...t,reactive:!1},r=t.reactiveName??"describe",o=0,s=re(o,{name:`${r}_version`}),i=this.observe({timeline:!0,structured:!0}),a=!1,l=!1,u=()=>{a||l||(a=!0,we(()=>{a=!1,!l&&(o+=1,s.emit(o))}))},d=i.onEvent(b=>{let v=b.type;v!=="data"&&v!=="error"&&v!=="complete"&&v!=="teardown"||u()}),h=[],p=new WeakSet,f=b=>{if(p.has(b)||l)return;p.add(b);let v=b.topology.subscribe(w=>{for(let m of w){if(m[0]!==Z)continue;let y=m[1];if(u(),y.kind==="added"&&y.nodeKind==="mount"){let S=b._mounts.get(y.name);S!=null&&f(S)}}});h.push(v);for(let w of b._mounts.keys()){let m=b._mounts.get(w);m!=null&&f(m)}};f(this);let c;try{c=_e([s],()=>this.describe(n),{name:r,describeKind:"derived",meta:{domain:"audit",kind:"describe"},equals:(b,v)=>b===v})}catch(b){d();for(let v of h)v();throw i.dispose(),b}let g=Ee(c);return{node:c,dispose(){l=!0,d();for(let b of h)b();h.length=0,i.dispose(),g()}}}_explainReactive(t,n,r){let o=0,s=re(o,{name:"explain_version"}),i=this.observe({timeline:!0,structured:!0}),a=!1,l=!1,u=i.onEvent(f=>{let c=f.type;c!=="data"&&c!=="error"&&c!=="complete"&&c!=="teardown"||a||l||(a=!0,we(()=>{a=!1,!l&&(o+=1,s.emit(o))}))}),d={...r?.maxDepth!=null?{maxDepth:r.maxDepth}:{},...r?.findCycle===!0?{findCycle:!0}:{}},h;try{h=_e([s],()=>this._explainStatic(t,n,d),{name:r?.name??"explain",describeKind:"derived",meta:{domain:"audit",kind:"explain_path",from:t,to:n},equals:(f,c)=>f.found===c.found&&f.reason===c.reason&&f.steps.length===c.steps.length&&nn(f.steps,c.steps)})}catch(f){throw u(),i.dispose(),f}let p=Ee(h);return{node:h,dispose(){l=!0,u(),i.dispose(),p()}}}_pathsMatching(t){let n=de(t),r=[];return this._collectObserveTargets("",r),r.map(([o])=>o).filter(o=>n.test(o))}_collectObserveTargets(t,n){for(let r of[...this._mounts.keys()].sort()){let o=t===""?r:`${t}${N}${r}`;this._mounts.get(r)._collectObserveTargets(o,n)}for(let r of[...this._nodes.keys()].sort()){let o=this._nodes.get(r),s=t===""?r:`${t}${N}${r}`;n.push([s,o]),this._appendMetaObserveTargets(s,o,n)}}_appendMetaObserveTargets(t,n,r){for(let o of Object.keys(n.meta).sort()){let s=n.meta[o],i=`${t}${N}${B}${N}${o}`;r.push([i,s]),this._appendMetaObserveTargets(i,s,r)}}observe(t,n){let r=typeof t=="string",s=rt(r?n:t),i=s.structured===!0||s.timeline===!0||s.causal===!0||s.derived===!0||s.detail==="minimal"||s.detail==="full"||s.format!=null,a=s.actor;if(r){let d=t,h=this.resolve(d);if(a!=null&&!h.allowsObserve(a))throw new W({actor:a,action:"observe",nodeName:d});return i?this._buildStructuredObserver([[d,h]],s,"one"):{subscribe(p){return h.subscribe(p)},up(p){try{h.up?.(p)}catch(f){if(f instanceof W)return;throw f}}}}let l=[];this._collectObserveTargets("",l),l.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);let u=a==null?l:l.filter(([,d])=>d.allowsObserve(a));return i?this._buildStructuredObserver(u,s,"all"):{subscribe:d=>{let h=u.map(([p,f])=>f.subscribe(c=>{d(p,c)}));return()=>{for(let p of h)p()}},up:(d,h)=>{try{this.resolve(d).up?.(h)}catch(p){if(p instanceof W)return;throw p}}}}_buildStructuredObserver(t,n,r){let o=r==="one"?t[0]?.[0]:void 0,s=i=>{if(r==="one"&&o!=null){let d=this.resolve(o);return this._buildStructuredObserver([[o,d]],i,"one")}let a=[];this._collectObserveTargets("",a),a.sort((d,h)=>d[0]<h[0]?-1:d[0]>h[0]?1:0);let l=i.actor,u=l==null?a:a.filter(([,d])=>d.allowsObserve(l));return this._buildStructuredObserver(u,i,"all")};return this._createObserveResult(t,n,s)}_createObserveResult(t,n,r){let o=n.timeline===!0,s=n.causal===!0,i=n.derived===!0,a=n.detail==="minimal",l=this.config.inspectorEnabled,u=(s||i)&&l,d=n.maxEvents,h=d!=null&&d>0?new X(d):null,p=[],f=new Set,c={},g=new Set,b=0,v=0,w=0,m=0,y=0,S=0,x=!1,O=!1,E=0,R=new Map,k=new Map,$=new Map,G=_=>{h?h.push(_):p.push(_);for(let T of f)T(_)},D=()=>o?{timestamp_ns:K(),in_batch:Ne(),batch_id:E}:{},P=(_,T)=>{if(!(!u||!(_ instanceof L)))return _._setInspectorHook(I=>{if(I.kind==="dep_message")R.set(_,I.depIndex);else if(I.kind==="run"){let J=I.batchData.map((C,M)=>C!=null&&C.length>0?C.at(-1):I.prevData[M]);k.set(_,J);let j=I.batchData.map(C=>C!=null?[...C]:void 0);$.set(_,j),i&&G({type:"derived",path:T,dep_values:J,dep_batches:j,...D()})}})},F=_=>{let T=R.get(_),I=k.get(_);if(!s||I==null)return{};let j=(T!=null&&T>=0&&_ instanceof L?_._deps[T]:void 0)?.node,C=j?.v,M=$.get(_);return{trigger_dep_index:T,trigger_dep_name:j?.name,...C!=null?{trigger_version:{id:C.id,version:C.version}}:{},dep_values:[...I],...M!=null?{dep_batches:M}:{}}},z=[],U=[];for(let[_,T]of t){let I=P(T,_);I&&z.push(I),U.push(T.subscribe(J=>{E++;for(let j of J){let C=j[0],M=D();if(C===Z){c[_]=j[1];let me=T instanceof L?T.lastMutation?.actor??Y:Y;G({type:"data",path:_,data:j[1],actor:me,...M,...F(T)})}else if(a)C===be?b++:C===ye?v++:C===ee?w++:C===ve?m++:C===xe?y++:C===V?S++:C===te&&!g.has(_)?x=!0:C===ne&&(O=!0,g.add(_));else if(C===be)b++,G({type:"dirty",path:_,...M});else if(C===ye)v++,G({type:"resolved",path:_,...M,...F(T)});else if(C===ee)w++,G({type:"invalidate",path:_,...M});else if(C===ve)m++,G({type:"pause",path:_,lockId:j[1],...M});else if(C===xe)y++,G({type:"resume",path:_,lockId:j[1],...M});else if(C===te)g.has(_)||(x=!0),G({type:"complete",path:_,...M});else if(C===ne){O=!0,g.add(_);let me=T instanceof L?T.lastMutation?.actor??Y:Y;G({type:"error",path:_,data:j[1],actor:me,...M})}else C===V&&(S++,G({type:"teardown",path:_,...M}))}}))}let pe=!1,he=()=>{if(!pe){pe=!0;for(let _ of U)_();for(let _ of z)_();for(let _ of Q)_({value:void 0,done:!0});Q.length=0}},ge=[],Q=[];f.add(_=>{let T=Q.shift();T?T({value:_,done:!1}):ge.push(_)});let ke={get values(){return c},get dirtyCount(){return b},get resolvedCount(){return v},get invalidateCount(){return w},get pauseCount(){return m},get resumeCount(){return y},get teardownCount(){return S},get events(){return h?h.toArray():[...p]},get anyCompletedCleanly(){return x},get anyErrored(){return O},get completedWithoutErrors(){return x&&!O},onEvent(_){return f.add(_),()=>f.delete(_)},dispose:he,expand(_){he();let T={...n};return typeof _=="string"?T.detail=_:Object.assign(T,_),r(rt(T))},[Symbol.asyncIterator](){return{next(){return ge.length>0?Promise.resolve({value:ge.shift(),done:!1}):pe?Promise.resolve({value:void 0,done:!0}):new Promise(_=>Q.push(_))},return(){return he(),Promise.resolve({value:void 0,done:!0})}}}};return n.format!=null&&this._attachFormatLogger(ke,n),ke}_attachFormatLogger(t,n){let r=n.format;if(r==null)return;let o=n.logger??(c=>console.log(c)),s=n.includeTypes?new Set(n.includeTypes):null,i=n.excludeTypes?new Set(n.excludeTypes):null,a=s==null&&i==null?()=>!0:c=>(s==null||s.has(c))&&(i==null||!i.has(c)),l=Xt(n.theme),u=r==="stage-log"?K():0,d=c=>c==null?"":n.stageLabels?.[c]??c,h=(c,g)=>c.length>g?`${c.slice(0,g-1)}\u2026`:c,p=c=>c.type==="data"||c.type==="error"?h(fe(c.data),120):"",f=c=>{if(r==="stage-log"){let O=(K()-u)/1e9,E=d(c.path).padEnd(9);if(c.type==="data"){let R=p(c);return`[${O.toFixed(3)}s] ${E} \u2190${R?` ${R}`:""}`}if(c.type==="error"){let R=p(c);return`[${O.toFixed(3)}s] ${E} \u2717${R?` ${R}`:""}`}return c.type==="complete"?`[${O.toFixed(3)}s] ${E} \u25A0 complete`:`[${O.toFixed(3)}s] ${E} ${c.type}`}if(r==="json")try{return JSON.stringify(c)}catch{return JSON.stringify({type:c.type,path:c.path,data:"[unserializable]"})}let g=l[c.type]??"",b=c.path?`${l.path}${c.path}${l.reset} `:"",v=c.type==="data"||c.type==="error",w=c.type==="pause"||c.type==="resume",m=v?` ${fe(c.data)}`:w?` ${fe(c.lockId)}`:"",y=c.type==="data"||c.type==="resolved"||c.type==="derived"?c:void 0,S=y?.trigger_dep_name!=null?` <- ${y.trigger_dep_name}`:y?.trigger_dep_index!=null?` <- #${y.trigger_dep_index}`:"",x=c.in_batch?" [batch]":"";return`${b}${g}${c.type.toUpperCase()}${l.reset}${m}${S}${x}`};t.onEvent(c=>{a(c.type)&&o(f(c),c)})}addDisposer(t){return this._disposers.add(t),()=>{this._disposers.delete(t)}}destroy(){tt(this._disposers,this.name),this.signal([[V]],{internal:!0}),tt(this._storageDisposers,this.name);for(let t of[...this._mounts.values()])t._parent=void 0,t._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0}_destroyClearOnly(){for(let t of[...this._mounts.values()])t._parent=void 0,t._destroyClearOnly();this._mounts.clear(),this._nodes.clear(),this._parent=void 0}snapshot(t){let{expand:n,...r}=this.describe({detail:"full"}),o={};for(let a of Object.keys(r.nodes).sort()){let{lastMutation:l,guard:u,...d}=r.nodes[a];o[a]=d}let s=[...r.subgraphs].sort(),i={...r,version:1,nodes:o,subgraphs:s};if(t?.format==null)return i;if(t.format==="json-string")return JSON.stringify(i);if(t.format==="bytes"){if(t.codec==null)throw new Error("snapshot({format: 'bytes'}) requires a `codec` name");let a=this.config.lookupCodec(t.codec);if(a==null)throw new Error(`snapshot: codec "${t.codec}" is not registered on this graph's config. Call config.registerCodec(...) before creating nodes.`);return $e(a,a.encode(i))}throw new Error(`snapshot: unknown format "${String(t.format)}"`)}static decode(t,n){let r=n?.config??Oe,{codec:o,codecVersion:s,payload:i}=Te(t,r);return o.decode(i,s)}restore(t,n){if(nt(t),t.name!==this.name)throw new Error(`Graph "${this.name}": restore snapshot name "${t.name}" does not match this graph`);let r=n?.only==null?null:(Array.isArray(n.only)?n.only:[n.only]).map(s=>de(s)),o=n?.includeProducers===!0;for(let s of Object.keys(t.nodes).sort()){if(r!==null&&!r.some(a=>a.test(s)))continue;let i=t.nodes[s];if(i!==void 0){if(!("value"in i)||i.value===void 0){"value"in i&&i.value===void 0&&n?.onError?.(s,new Error(`restore: slice.value is undefined for "${s}" (undefined is the global SENTINEL; not valid DATA)`));continue}if(!(i.type==="derived"||i.type==="effect")&&!(i.type==="producer"&&!o)){if(i.v!=null){let l=this.tryResolve(s)?.v;if(l!=null&&l.id===i.v.id&&l.version===i.v.version)continue}try{this.set(s,i.value)}catch(a){n?.onError?.(s,a)}}}}}static fromSnapshot(t,n){nt(t);let r=typeof n=="function"?n:n?.build,o=typeof n=="function"?void 0:n?.factories,s=new e(t.name);if(r)return r(s),s.restore(t),s;for(let f of[...t.subgraphs].sort((c,g)=>{let b=c.split(N).length,v=g.split(N).length;return b!==v?b-v:c<g?-1:c>g?1:0})){let c=f.split(N),g=s;for(let b of c)g._mounts.has(b)||g.mount(b,new e(b)),g=g._mounts.get(b)}let i=o?Object.entries(o).map(([f,c])=>({re:de(f),factory:c})):[],a=f=>{for(let c of i)if(c.re.test(f))return c.factory},l=f=>{let c=f.split(N),g=c.pop();if(g==null||g.length===0)throw new Error(`invalid snapshot path "${f}"`);let b=s;for(let v of c){let w=b._mounts.get(v);if(!w)throw new Error(`unknown mount "${v}" in path "${f}"`);b=w}return[b,g]},u=Object.entries(t.nodes).filter(([f])=>!f.includes(`${N}${B}${N}`)).sort((f,c)=>f[0]<c[0]?-1:f[0]>c[0]?1:0),d=new Map(u),h=new Map,p=!0;for(;d.size>0&&p;){p=!1;for(let[f,c]of[...d.entries()]){let g=c?.deps??[];if(!g.every(S=>h.has(S)))continue;let[b,v]=l(f),w={...c?.meta??{}},m=a(f),y;if(c?.type==="state")y=re(c.value,{meta:w});else{if(m==null)continue;y=m(v,{path:f,type:c.type,value:c.value,meta:w,deps:g,resolvedDeps:g.map(S=>h.get(S))})}b.add(y,{name:v}),h.set(f,y),d.delete(f),p=!0}}if(d.size>0){let f=[...d.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 s.restore(t),s}toJSON(){return this.snapshot()}attachStorage(t,n={}){let r=t.map(u=>({tier:u,debounceMs:Math.max(0,u.debounceMs??0),compactEvery:Math.max(1,u.compactEvery??10),timer:void 0,seq:0,lastSnapshot:void 0,lastFingerprint:"",disposed:!1,savePending:void 0}));n.autoRestore===!0&&this._cascadeRestore(t,n.onError);let o=(u,d)=>{if(u.disposed)return;let h=It(d.nodes);if(u.lastSnapshot!=null&&h!==""&&h===u.lastFingerprint)return;let p=u.seq+1,f=Pe(),b=u.lastSnapshot==null||p%u.compactEvery===0?{mode:"full",snapshot:d,seq:p,timestamp_ns:f,format_version:q}:{mode:"diff",diff:tn(u.lastSnapshot,d),seq:p,timestamp_ns:f,format_version:q};if(u.tier.filter&&!u.tier.filter(this.name,b))return;let v;try{v=u.tier.save(this.name,b)}catch(w){n.onError?.(w,u.tier);return}if(v&&typeof v.then=="function"){let y=(u.savePending??Promise.resolve()).then(()=>v,()=>v).then(()=>{u.disposed||(u.seq=p,u.lastSnapshot=d,u.lastFingerprint=h)},S=>{n.onError?.(S,u.tier)});u.savePending=y.finally(()=>{u.savePending===y&&(u.savePending=void 0)})}else u.seq=p,u.lastSnapshot=d,u.lastFingerprint=h},s=(u,d)=>{try{o(u,d)}catch(h){n.onError?.(h,u.tier)}},i=(u,d)=>{if(!d.some(c=>{let g=this.config.messageTier(c[0]);return g>=3&&g<5}))return;if(n.filter){let c=this.tryResolve(u);if(c==null)return;let g=Se(c,se("standard"));if(!n.filter(u,g))return}let p,f=()=>(p==null&&(p=this.snapshot()),p);for(let c of r)c.disposed||(c.debounceMs===0?s(c,f()):(c.timer==null&&(c.timer=new Le),c.timer.start(c.debounceMs,()=>{c.disposed||s(c,this.snapshot())})))},a;if(n.paths!=null){let d=(typeof n.paths=="string"?this._pathsMatching(n.paths):n.paths).map(h=>{let p=this.tryResolve(h);return p==null?()=>{}:p.subscribe(f=>i(h,f))});a=()=>{for(let h of d)h()}}else a=this.observe().subscribe((u,d)=>i(u,d));let l=()=>{a();for(let u of r)u.disposed=!0,u.timer?.cancel();this._storageDisposers.delete(l)};return this._storageDisposers.add(l),{dispose:l}}async _cascadeRestore(t,n){for(let r of t){let o;try{o=await r.load(this.name)}catch(i){n?.(i,r);continue}if(o==null||typeof o!="object"||Array.isArray(o))continue;let s=o;try{if(s.mode==="full"&&s.snapshot!=null)return this.restore(s.snapshot),!0;if(s.version===q&&s.nodes!=null)return this.restore(s),!0}catch(i){n?.(i,r)}}return!1}static async fromStorage(t,n,r){for(let o of n){let s;try{s=await o.load(t)}catch(l){r?.onError?.(l,o);continue}if(s==null||typeof s!="object"||Array.isArray(s))continue;let i=s,a=i.mode==="full"&&i.snapshot!=null?i.snapshot:i.version===q&&i.nodes!=null?i:void 0;if(a!=null)try{return e.fromSnapshot(a,r)}catch(l){r?.onError?.(l,o)}}throw new Error(`Graph.fromStorage: no tier held a restorable record for "${t}" across ${n.length} tier(s)`)}_annotations=new Map;_traceRing;trace(t,n,r){if(t!=null&&n!=null){if(this.tryResolve(t)==null)return;if(this._annotations.set(t,n),this.config.inspectorEnabled){let o={path:t,annotation:n,timestamp_ns:K(),...r?.actor!=null?{actor:r.actor}:{}};this._traceRing.push(o)}return}return t!=null?this.config.inspectorEnabled?this._annotations.get(t):void 0:this.config.inspectorEnabled?this._traceRing.toArray():[]}annotation(t){return this._annotations.get(t)}clearTrace(){this._annotations.clear(),this._traceRing.clear()}pruneTrace(t){let n=this._traceRing.toArray().filter(o=>!t(o)),r=this._traceRing.size-n.length;this._traceRing.clear();for(let o of n)this._traceRing.push(o);return r}static diff(t,n){let r=new Set(Object.keys(t.nodes)),o=new Set(Object.keys(n.nodes)),s=[...o].filter(w=>!r.has(w)).sort(),i=[...r].filter(w=>!o.has(w)).sort(),a=[],l=[];for(let w of r){if(!o.has(w))continue;let m=t.nodes[w],y=n.nodes[w],S=m.v,x=y.v;S!=null&&x!=null&&S.id===x.id&&S.version!==x.version&&l.push({path:w,id:S.id,from:S.version,to:x.version});let O=S!=null&&x!=null&&S.id===x.id&&S.version===x.version;for(let E of["type","status","sentinel"]){let R=m[E],k=y[E];R!==k&&a.push({path:w,field:E,from:R,to:k})}if(!O)for(let E of["value","meta"]){let R=m[E],k=y[E];jt(R,k)||a.push({path:w,field:E,from:R,to:k})}}let u=w=>`${w.from} ${w.to}`,d=new Set(t.edges.map(u)),h=new Set(n.edges.map(u)),p=n.edges.filter(w=>!d.has(u(w))),f=t.edges.filter(w=>!h.has(u(w))),c=new Set(t.subgraphs),g=new Set(n.subgraphs),b=[...g].filter(w=>!c.has(w)).sort(),v=[...c].filter(w=>!g.has(w)).sort();return{nodesAdded:s,nodesRemoved:i,nodesChanged:a,versionChanges:l,edgesAdded:p,edgesRemoved:f,subgraphsAdded:b,subgraphsRemoved:v}}};function tn(e,t){let n=Ce.diff(e,t),r={};for(let o of n.nodesAdded){let s=t.nodes[o];s!=null&&(r[o]=s)}return{...n,nodesAddedFull:r}}function st(e,t,n,r={}){let o={paths:[],depths:new Map,truncated:!1};if(!t)return r.withDetail?o:[];if(!r.both&&n!=="upstream"&&n!=="downstream")throw new Error('reachable: direction must be "upstream" or "downstream"');let s=r.maxDepth;if(s!=null&&(!Number.isInteger(s)||s<0))throw new Error("reachable: maxDepth must be an integer >= 0");if(s===0)return r.withDetail?o:[];let i=new Map,a=new Map,l=new Map,u=new Map,d=new Set;for(let[m,y]of Object.entries(e.nodes)){if(!m)continue;d.add(m);let S=y.deps??[];i.set(m,S);for(let x of S)x&&(d.add(x),a.has(x)||a.set(x,new Set),a.get(x).add(m))}for(let m of e.edges){if(m==null||typeof m!="object")continue;let y=typeof m.from=="string"?m.from:"",S=typeof m.to=="string"?m.to:"";!y||!S||(d.add(y),d.add(S),u.has(y)||u.set(y,new Set),u.get(y).add(S),l.has(S)||l.set(S,new Set),l.get(S).add(y))}if(!d.has(t))return r.withDetail?o:[];let h=r.both===!0,p=m=>{if(h){let O=i.get(m)??[],E=l.get(m),R=a.get(m),k=u.get(m),$=[...O];return E&&$.push(...E),R&&$.push(...R),k&&$.push(...k),$}if(n==="upstream"){let O=i.get(m)??[],E=l.get(m);return E?[...O,...E]:O}let y=a.get(m),S=u.get(m),x=y?[...y]:[];return S&&x.push(...S),x},f=new Set([t]),c=new Map,g=[{path:t,depth:0}],b=0,v=!1;for(;b<g.length;){let m=g[b++];if(s!=null&&m.depth>=s){p(m.path).length>0&&(v=!0);continue}for(let y of p(m.path))!y||f.has(y)||(f.add(y),c.set(y,m.depth+1),g.push({path:y,depth:m.depth+1}))}let w=[...c.keys()].sort((m,y)=>m<y?-1:m>y?1:0);return r.withDetail?{paths:w,depths:c,truncated:v}:w}function nn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(r.path!==o.path||r.type!==o.type||r.status!==o.status||r.hop!==o.hop||r.dep_index!==o.dep_index||r.annotation!==o.annotation||r.value!==o.value||r.lastMutation!==o.lastMutation)return!1;let s=r.v,i=o.v;if(s!==i&&(s==null||i==null||s.id!==i.id||s.version!==i.version))return!1}return!0}export{X as a,ue as b,Ie as c,A as d,ft as e,ze as f,He as g,B as h,q as i,Wt as j,Ce as k,tn as l,st as m};
@@ -1,4 +1,4 @@
1
- import{a as v,f as M}from"./chunk-CRXTH3SH.js";import{d as S}from"./chunk-4GKB4OUJ.js";import{o as h}from"./chunk-ZB5EHBIO.js";function O(e={}){return e.sdk?Q(e):z(e)}function _(e,t,o,n){let r=t?.model??o;if(!r)throw new Error("anthropicAdapter: model must be set via options.model or invokeOpts.model");let{system:s,chat:a}=W(e,t?.systemPrompt),i={model:r,messages:a.map(Y),max_tokens:t?.maxTokens??4096};return s&&(i.system=s),t?.temperature!=null&&(i.temperature=t.temperature),t?.tools&&t.tools.length>0&&(i.tools=t.tools.map(V)),t?.maxReasoningTokens!=null&&(i.thinking={type:"enabled",budget_tokens:t.maxReasoningTokens}),t?.cacheHint,n&&(i.stream=!0),t?.providerExtras&&Object.assign(i,t.providerExtras),i}function W(e,t){let o=[];t&&o.push(t);let n=[];for(let r of e)r.role==="system"?o.push(r.content):n.push(r);return{system:o.length>0?o.join(`
1
+ import{a as v,f as M}from"./chunk-7JDLFI6N.js";import{d as S}from"./chunk-OL33ZI6R.js";import{o as h}from"./chunk-W4TSQ6RJ.js";function O(e={}){return e.sdk?Q(e):z(e)}function _(e,t,o,n){let r=t?.model??o;if(!r)throw new Error("anthropicAdapter: model must be set via options.model or invokeOpts.model");let{system:s,chat:a}=W(e,t?.systemPrompt),i={model:r,messages:a.map(Y),max_tokens:t?.maxTokens??4096};return s&&(i.system=s),t?.temperature!=null&&(i.temperature=t.temperature),t?.tools&&t.tools.length>0&&(i.tools=t.tools.map(V)),t?.maxReasoningTokens!=null&&(i.thinking={type:"enabled",budget_tokens:t.maxReasoningTokens}),t?.cacheHint,n&&(i.stream=!0),t?.providerExtras&&Object.assign(i,t.providerExtras),i}function W(e,t){let o=[];t&&o.push(t);let n=[];for(let r of e)r.role==="system"?o.push(r.content):n.push(r);return{system:o.length>0?o.join(`
2
2
 
3
3
  `):void 0,chat:n}}function Y(e){if(e.role==="tool")return{role:"user",content:[{type:"tool_result",tool_use_id:e.toolCallId,content:e.content}]};if(e.role==="assistant"&&e.toolCalls&&e.toolCalls.length>0){let t=[];e.content&&t.push({type:"text",text:e.content});for(let o of e.toolCalls)t.push({type:"tool_use",id:o.id,name:o.name,input:o.arguments});return{role:"assistant",content:t}}return{role:e.role,content:e.content}}function V(e){return{name:e.name,description:e.description,input_schema:e.parameters}}function A(e,t){if(!e)return{...t};let o={...e};return t.input_tokens!=null&&(o.input_tokens=t.input_tokens),t.output_tokens!=null&&(o.output_tokens=t.output_tokens),t.cache_read_input_tokens!=null&&(o.cache_read_input_tokens=t.cache_read_input_tokens),t.cache_creation_input_tokens!=null&&(o.cache_creation_input_tokens=t.cache_creation_input_tokens),t.cache_creation&&(o.cache_creation={...e.cache_creation??{},...t.cache_creation}),t.server_tool_use&&(o.server_tool_use={...e.server_tool_use??{},...t.server_tool_use}),o}function w(e){let t={input:{regular:e?.input_tokens??0},output:{regular:e?.output_tokens??0},raw:e};return e?.cache_read_input_tokens&&(t.input.cacheRead=e.cache_read_input_tokens),e?.cache_creation?(e.cache_creation.ephemeral_5m_input_tokens&&(t.input.cacheWrite5m=e.cache_creation.ephemeral_5m_input_tokens),e.cache_creation.ephemeral_1h_input_tokens&&(t.input.cacheWrite1h=e.cache_creation.ephemeral_1h_input_tokens)):e?.cache_creation_input_tokens&&(t.input.cacheWrite5m=e.cache_creation_input_tokens),e?.server_tool_use?.web_search_requests&&(t.auxiliary={webSearchRequests:e.server_tool_use.web_search_requests}),t}function P(e,t){let o=[],n=[];for(let r of e.content)if(r.type==="text"&&typeof r.text=="string")o.push(r.text);else if(r.type==="tool_use"){let s=r;n.push({id:s.id,name:s.name,arguments:s.input??{}})}return{content:o.join(""),toolCalls:n.length>0?n:void 0,usage:w(e.usage),finishReason:e.stop_reason,latencyMs:t,model:e.model,provider:"anthropic"}}function z(e){let t=e.apiKey??globalThis.process?.env?.ANTHROPIC_API_KEY,o=e.baseURL??"https://api.anthropic.com",n=e.anthropicVersion??"2023-06-01",r=e.fetchImpl??fetch,s=()=>{if(!t)throw new Error("anthropicAdapter: apiKey required for invoke/stream (or provide opts.sdk)");return{"x-api-key":t,"anthropic-version":n,"content-type":"application/json",...e.headers??{}}};return{provider:"anthropic",model:e.model,async invoke(a,i){let c=_(a,i,e.model,!1),u=h(),d=await r(`${o}/v1/messages`,{method:"POST",headers:s(),body:JSON.stringify(c),signal:i?.signal});if(!d.ok)throw await T(d);let l=await d.json(),p=Math.max(0,(h()-u)/1e6);return P(l,p)},async*stream(a,i){let c=_(a,i,e.model,!0),u=await r(`${o}/v1/messages`,{method:"POST",headers:{...s(),accept:"text/event-stream"},body:JSON.stringify(c),signal:i?.signal});if(!u.ok)throw await T(u);if(!u.body)throw new Error("anthropicAdapter: streaming response has no body");let d,l,p=new Map;for await(let f of X(u.body)){let k=f.data;if(!k)continue;let y;try{y=JSON.parse(k)}catch{continue}switch(y.type){case"message_start":{d=A(d,y.message.usage);break}case"content_block_start":{let g=y,m=g.content_block;m.type==="tool_use"&&(p.set(g.index,{id:String(m.id??""),name:String(m.name??""),argBuf:""}),yield{type:"tool-call-delta",delta:{id:String(m.id??""),name:String(m.name??"")}});break}case"content_block_delta":{let g=y,m=g.delta;if(m.type==="text_delta"&&typeof m.text=="string")yield{type:"token",delta:m.text};else if(m.type==="input_json_delta"&&typeof m.partial_json=="string"){let E=p.get(g.index);E&&(E.argBuf+=m.partial_json),yield{type:"tool-call-delta",delta:{argumentsDelta:m.partial_json}}}else m.type==="thinking_delta"&&typeof m.thinking=="string"&&(yield{type:"thinking",delta:m.thinking});break}case"message_delta":{let g=y;g.delta.stop_reason&&(l=g.delta.stop_reason),g.delta.usage&&(d=A(d,g.delta.usage));break}case"message_stop":break}}d&&(yield{type:"usage",usage:w(d)}),yield{type:"finish",reason:l??"stop"}}}}function Q(e){let t=e.sdk;if(!t)throw new Error("sdkBackedAnthropic: sdk instance required");return{provider:"anthropic",model:e.model,async invoke(o,n){let r=_(o,n,e.model,!1),s=h(),a=await t.messages.create(r,{signal:n?.signal}),i=Math.max(0,(h()-s)/1e6);return P(a,i)},async*stream(o,n){if(!t.messages.stream)throw new Error("sdkBackedAnthropic: SDK instance does not expose .messages.stream");let r=_(o,n,e.model,!0),s,a;for await(let i of t.messages.stream(r,{signal:n?.signal}))switch(i.type){case"message_start":s=A(s,i.message.usage);break;case"content_block_delta":{let c=i.delta;c?.type==="text_delta"&&typeof c.text=="string"?yield{type:"token",delta:c.text}:c?.type==="input_json_delta"&&typeof c.partial_json=="string"?yield{type:"tool-call-delta",delta:{argumentsDelta:c.partial_json}}:c?.type==="thinking_delta"&&typeof c.thinking=="string"&&(yield{type:"thinking",delta:c.thinking});break}case"message_delta":{let c=i;c.delta.stop_reason&&(a=c.delta.stop_reason),c.delta.usage&&(s=A(s,c.delta.usage));break}}s&&(yield{type:"usage",usage:w(s)}),yield{type:"finish",reason:a??"stop"}}}}async function*X(e){let t=e.getReader(),o=new TextDecoder,n="";try{for(;;){let{done:r,value:s}=await t.read();if(r){n.length>0&&(yield I(n));return}n+=o.decode(s,{stream:!0});let a=U(n);for(;a!==null;){let i=n.slice(0,a.index);n=n.slice(a.index+a.length);let c=I(i);(c.data||c.event)&&(yield c),a=U(n)}}}finally{t.releaseLock()}}function I(e){let t={},o=[];for(let n of e.split(`
4
4
  `)){let r=n.endsWith("\r")?n.slice(0,-1):n;if(!r||r.startsWith(":"))continue;let s=r.indexOf(":"),a=s===-1?r:r.slice(0,s),i=s===-1?"":r.slice(s+1).replace(/^ /,"");a==="data"?o.push(i):a==="event"?t.event=i:a==="id"&&(t.id=i)}return o.length>0&&(t.data=o.join(`
@@ -1 +1 @@
1
- import{a as E}from"./chunk-ESMPEKEV.js";import{a as B,b as R,i as _}from"./chunk-4VVTGLXJ.js";import{m as I}from"./chunk-2PMCKKRK.js";import{D as P,F as g,m as L,o as O}from"./chunk-ZB5EHBIO.js";import{b,c as k,d as y,h as C,i as h,j as T}from"./chunk-CK2E7BTU.js";function S(e){return{describeKind:"derived",...e}}function V(e){return e<0?0:e}function M(e){return e[1]}function W(e){if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("backoff strategy must return a finite number");return e<0?0:e}function Z(e,s){let r=s?.count,n=s?.backoff,l=r!==void 0?r:n===void 0?0:2147483647;if(l<0)throw new RangeError("retry count must be >= 0");let u=n===void 0?null:typeof n=="string"?_(n):n;return g(t=>{let o=0,c=!1,i=null,f,a=new E;function w(){f?.(),f=void 0}function N(p){if(c)return;if(o>=l){w(),t.down([[T,p]]);return}let m=u===null?0:u(o,p,i);if(m==null){w(),t.down([[T,p]]);return}let d;try{d=W(m)}catch{w(),t.down([[T,p]]);return}i=d,o+=1,w();let v=d>0?d/1e6:1;a.start(v,()=>{c||x()})}function x(){a.cancel(),w(),f=e.subscribe(p=>{if(!c)for(let m of p){let d=m[0];if(d===k)t.down([[k]]);else if(d===b)o=0,i=null,t.emit(m[1]);else if(d===y)t.down([[y]]);else if(d===h)w(),t.down([[h]]);else if(d===T){N(M(m));return}else t.down([m])}})}return x(),()=>{c=!0,a.cancel(),w()}},{...S(),initial:e.cache})}function ee(e,s){let r=s?.count,n=s?.backoff,l=r!==void 0?r:n===void 0?0:2147483647;if(l<0)throw new RangeError("retry count must be >= 0");let u=n===void 0?null:typeof n=="string"?_(n):n;return g(t=>{let o=0,c=!1,i=null,f,a=new E;function w(){f?.(),f=void 0}function N(p){if(c)return;if(o>=l){w(),t.down([[T,p]]);return}let m=u===null?0:u(o,p,i);if(m==null){w(),t.down([[T,p]]);return}let d;try{d=W(m)}catch{w(),t.down([[T,p]]);return}i=d,o+=1,w();let v=d>0?d/1e6:1;a.start(v,()=>{c||x()})}function x(){a.cancel(),w();let p;try{p=e()}catch(m){N(m);return}f=p.subscribe(m=>{if(!c)for(let d of m){let v=d[0];if(v===k)t.down([[k]]);else if(v===b)o=0,i=null,t.emit(d[1]);else if(v===y)t.down([[y]]);else if(v===h)w(),t.down([[h]]);else if(v===T){N(M(d));return}else t.down([d])}})}return x(),()=>{c=!0,a.cancel(),w()}},{...S(),initial:s?.initial})}var A=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};function te(e){let s=Math.max(1,e?.failureThreshold??5),r=V(e?.cooldownNs??30*1e9),n=e?.cooldown??null,l=Math.max(1,e?.halfOpenMax??1),u=e?.now??O,t="closed",o=0,c=0,i=0,f=r,a=0;function w(){if(!n)return r;let p=n(c);return p!==null?p:r}function N(){t="open",f=w(),i=u(),a=0}return{canExecute(){return t==="closed"?!0:t==="open"?u()-i>=f?(t="half-open",a=1,!0):!1:a<l?(a++,!0):!1},recordSuccess(){t==="half-open"?(t="closed",o=0,c=0):t==="closed"&&(o=0)},recordFailure(p){if(t==="half-open"){c++,N();return}t==="closed"&&(o++,o>=s&&N())},get state(){return t},get failureCount(){return o},reset(){t="closed",o=0,c=0,a=0}}}function ne(e,s){let r=s?.onOpen??"skip";return n=>{let l=P([],(u,t)=>{function o(){l.meta.breakerState.down([[b,e.state]])}let c=n.subscribe(i=>{for(let f of i){let a=f[0];a===k?t.down([[k]]):a===b?e.canExecute()?(o(),t.emit(f[1])):(o(),r==="error"?t.down([[T,new A]]):t.down([[y]])):a===y?t.down([[y]]):a===h?(e.recordSuccess(),o(),t.down([[h]])):a===T?(e.recordFailure(M(f)),o(),t.down([f])):t.down([f])}});return o(),c},{...S(),meta:{breakerState:e.state},completeWhenDepsComplete:!1,initial:n.cache});return{node:l,breakerState:l.meta.breakerState}}}function U(e,s){if(e<=0)throw new RangeError("capacity must be > 0");if(s<0)throw new RangeError("refillPerSecond must be >= 0");let r=e,n=O();function l(u){if(s>0){let t=u-n;r=Math.min(e,r+t/1e9*s)}n=u}return{available(){return l(O()),r},tryConsume(u=1){if(u<=0)return!0;let t=O();return l(t),r>=u?(r-=u,!0):!1},putBack(u=1){u<=0||(l(O()),r=Math.min(e,r+u))}}}var D=class extends Error{name="RateLimiterOverflowError";constructor(s){super(`rateLimiter buffer overflow (maxBuffer=${s})`)}};function re(e,s){let{maxEvents:r,windowNs:n}=s;if(r<=0)throw new RangeError("maxEvents must be > 0");if(n<=0)throw new RangeError("windowNs must be > 0");let l=s.maxBuffer;if(l!==void 0&&l<1)throw new RangeError("maxBuffer must be >= 1");let u=s.onOverflow??"drop-newest",t=r*1e9/n;return g(o=>{let c=U(r,t),i=[],f=new E,a=!1,w=1e9/t;function N(){for(;i.length>0;)if(c.tryConsume(1))o.emit(i.shift());else{f.start(Math.max(1,w/1e6),N);return}}let x=e.subscribe(p=>{for(let m of p){if(a)return;let d=m[0];if(d===k)o.down([[k]]);else if(d===b){if(l!==void 0&&i.length>=l){if(u!=="drop-newest")if(u==="drop-oldest")i.shift(),i.push(m[1]);else{a=!0,f.cancel(),i.length=0,o.down([[T,new D(l)]]);return}}else i.push(m[1]);N()}else if(d===y)o.down([[y]]);else if(d===h)a=!0,f.cancel(),i.length=0,o.down([[h]]);else if(d===T)a=!0,f.cancel(),i.length=0,o.down([m]);else if(d===C){a=!0,f.cancel(),i.length=0,o.down([m]);return}else o.down([m])}});return()=>{a=!0,f.cancel(),x()}},{...S(),initial:e.cache})}function oe(e,s){let r=s?.initialStatus??"pending",n=P([],(l,u)=>{let t=r;return n.meta.status.down([[b,r]]),n.meta.error.down([[b,null]]),e.subscribe(c=>{for(let i of c){let f=i[0];if(f===k)u.down([[k]]);else if(f===b)t==="errored"?L(()=>{n.meta.error.down([[b,null]]),n.meta.status.down([[b,"active"]])}):n.meta.status.down([[b,"active"]]),t="active",u.emit(i[1]);else if(f===y)u.down([[y]]);else if(f===h)n.meta.status.down([[b,"completed"]]),t="completed",u.down([[h]]);else if(f===T){let a=M(i);L(()=>{n.meta.error.down([[b,a]]),n.meta.status.down([[b,"errored"]])}),t="errored",u.down([i])}else u.down([i])}})},{...S(),meta:{status:r,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:e.cache});return{node:n,status:n.meta.status,error:n.meta.error}}var F=class extends Error{name="TimeoutError";constructor(s){super(`Timed out after ${s/1e6}ms`)}};function j(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function K(e){return e!=null&&typeof e.then=="function"}function $(e){return e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function"}function ie(e,s){return g(r=>{let n,l;function u(){l?.(),l=void 0,j(s)||K(s)||$(s)?n=I(s).subscribe(o=>{r.down(o)}):(r.emit(s),r.down([[h]]))}return l=e.subscribe(t=>{for(let o of t){let c=o[0];if(c===k)r.down([[k]]);else if(c===b)r.emit(o[1]);else if(c===y)r.down([[y]]);else if(c===h)r.down([[h]]);else if(c===T){u();return}else if(c===C){n?.(),r.down([o]);return}else r.down([o])}}),()=>{l?.(),n?.()}},{...S(),initial:e.cache})}function se(e,s){if(s<=0)throw new RangeError("timeoutNs must be > 0");return g(r=>{let n=!1,l=new E;function u(){let o=s/1e6;l.start(o,()=>{n||(n=!0,t(),r.down([[T,new F(s)]]))})}let t=e.subscribe(o=>{for(let c of o){if(n)return;let i=c[0];if(i===k)r.down([[k]]);else if(i===b)u(),r.emit(c[1]);else if(i===y)r.down([[y]]);else if(i===h){l.cancel(),n=!0,r.down([[h]]);return}else if(i===T){l.cancel(),n=!0,r.down([c]);return}else if(i===C){l.cancel(),n=!0,r.down([c]);return}else r.down([c])}});return u(),()=>{n=!0,l.cancel(),t()}},{...S(),initial:e.cache})}export{Z as a,ee as b,A as c,te as d,ne as e,U as f,D as g,re as h,oe as i,F as j,ie as k,se as l};
1
+ import{a as E}from"./chunk-ESMPEKEV.js";import{a as B,b as R,i as _}from"./chunk-4VVTGLXJ.js";import{m as I}from"./chunk-KASHOCF5.js";import{D as P,F as g,m as L,o as O}from"./chunk-W4TSQ6RJ.js";import{b,c as k,d as y,h as C,i as h,j as T}from"./chunk-CK2E7BTU.js";function S(e){return{describeKind:"derived",...e}}function V(e){return e<0?0:e}function M(e){return e[1]}function W(e){if(typeof e!="number"||!Number.isFinite(e))throw new TypeError("backoff strategy must return a finite number");return e<0?0:e}function Z(e,s){let r=s?.count,n=s?.backoff,l=r!==void 0?r:n===void 0?0:2147483647;if(l<0)throw new RangeError("retry count must be >= 0");let u=n===void 0?null:typeof n=="string"?_(n):n;return g(t=>{let o=0,c=!1,i=null,f,a=new E;function w(){f?.(),f=void 0}function N(p){if(c)return;if(o>=l){w(),t.down([[T,p]]);return}let m=u===null?0:u(o,p,i);if(m==null){w(),t.down([[T,p]]);return}let d;try{d=W(m)}catch{w(),t.down([[T,p]]);return}i=d,o+=1,w();let v=d>0?d/1e6:1;a.start(v,()=>{c||x()})}function x(){a.cancel(),w(),f=e.subscribe(p=>{if(!c)for(let m of p){let d=m[0];if(d===k)t.down([[k]]);else if(d===b)o=0,i=null,t.emit(m[1]);else if(d===y)t.down([[y]]);else if(d===h)w(),t.down([[h]]);else if(d===T){N(M(m));return}else t.down([m])}})}return x(),()=>{c=!0,a.cancel(),w()}},{...S(),initial:e.cache})}function ee(e,s){let r=s?.count,n=s?.backoff,l=r!==void 0?r:n===void 0?0:2147483647;if(l<0)throw new RangeError("retry count must be >= 0");let u=n===void 0?null:typeof n=="string"?_(n):n;return g(t=>{let o=0,c=!1,i=null,f,a=new E;function w(){f?.(),f=void 0}function N(p){if(c)return;if(o>=l){w(),t.down([[T,p]]);return}let m=u===null?0:u(o,p,i);if(m==null){w(),t.down([[T,p]]);return}let d;try{d=W(m)}catch{w(),t.down([[T,p]]);return}i=d,o+=1,w();let v=d>0?d/1e6:1;a.start(v,()=>{c||x()})}function x(){a.cancel(),w();let p;try{p=e()}catch(m){N(m);return}f=p.subscribe(m=>{if(!c)for(let d of m){let v=d[0];if(v===k)t.down([[k]]);else if(v===b)o=0,i=null,t.emit(d[1]);else if(v===y)t.down([[y]]);else if(v===h)w(),t.down([[h]]);else if(v===T){N(M(d));return}else t.down([d])}})}return x(),()=>{c=!0,a.cancel(),w()}},{...S(),initial:s?.initial})}var A=class extends Error{name="CircuitOpenError";constructor(){super("Circuit breaker is open")}};function te(e){let s=Math.max(1,e?.failureThreshold??5),r=V(e?.cooldownNs??30*1e9),n=e?.cooldown??null,l=Math.max(1,e?.halfOpenMax??1),u=e?.now??O,t="closed",o=0,c=0,i=0,f=r,a=0;function w(){if(!n)return r;let p=n(c);return p!==null?p:r}function N(){t="open",f=w(),i=u(),a=0}return{canExecute(){return t==="closed"?!0:t==="open"?u()-i>=f?(t="half-open",a=1,!0):!1:a<l?(a++,!0):!1},recordSuccess(){t==="half-open"?(t="closed",o=0,c=0):t==="closed"&&(o=0)},recordFailure(p){if(t==="half-open"){c++,N();return}t==="closed"&&(o++,o>=s&&N())},get state(){return t},get failureCount(){return o},reset(){t="closed",o=0,c=0,a=0}}}function ne(e,s){let r=s?.onOpen??"skip";return n=>{let l=P([],(u,t)=>{function o(){l.meta.breakerState.down([[b,e.state]])}let c=n.subscribe(i=>{for(let f of i){let a=f[0];a===k?t.down([[k]]):a===b?e.canExecute()?(o(),t.emit(f[1])):(o(),r==="error"?t.down([[T,new A]]):t.down([[y]])):a===y?t.down([[y]]):a===h?(e.recordSuccess(),o(),t.down([[h]])):a===T?(e.recordFailure(M(f)),o(),t.down([f])):t.down([f])}});return o(),c},{...S(),meta:{breakerState:e.state},completeWhenDepsComplete:!1,initial:n.cache});return{node:l,breakerState:l.meta.breakerState}}}function U(e,s){if(e<=0)throw new RangeError("capacity must be > 0");if(s<0)throw new RangeError("refillPerSecond must be >= 0");let r=e,n=O();function l(u){if(s>0){let t=u-n;r=Math.min(e,r+t/1e9*s)}n=u}return{available(){return l(O()),r},tryConsume(u=1){if(u<=0)return!0;let t=O();return l(t),r>=u?(r-=u,!0):!1},putBack(u=1){u<=0||(l(O()),r=Math.min(e,r+u))}}}var D=class extends Error{name="RateLimiterOverflowError";constructor(s){super(`rateLimiter buffer overflow (maxBuffer=${s})`)}};function re(e,s){let{maxEvents:r,windowNs:n}=s;if(r<=0)throw new RangeError("maxEvents must be > 0");if(n<=0)throw new RangeError("windowNs must be > 0");let l=s.maxBuffer;if(l!==void 0&&l<1)throw new RangeError("maxBuffer must be >= 1");let u=s.onOverflow??"drop-newest",t=r*1e9/n;return g(o=>{let c=U(r,t),i=[],f=new E,a=!1,w=1e9/t;function N(){for(;i.length>0;)if(c.tryConsume(1))o.emit(i.shift());else{f.start(Math.max(1,w/1e6),N);return}}let x=e.subscribe(p=>{for(let m of p){if(a)return;let d=m[0];if(d===k)o.down([[k]]);else if(d===b){if(l!==void 0&&i.length>=l){if(u!=="drop-newest")if(u==="drop-oldest")i.shift(),i.push(m[1]);else{a=!0,f.cancel(),i.length=0,o.down([[T,new D(l)]]);return}}else i.push(m[1]);N()}else if(d===y)o.down([[y]]);else if(d===h)a=!0,f.cancel(),i.length=0,o.down([[h]]);else if(d===T)a=!0,f.cancel(),i.length=0,o.down([m]);else if(d===C){a=!0,f.cancel(),i.length=0,o.down([m]);return}else o.down([m])}});return()=>{a=!0,f.cancel(),x()}},{...S(),initial:e.cache})}function oe(e,s){let r=s?.initialStatus??"pending",n=P([],(l,u)=>{let t=r;return n.meta.status.down([[b,r]]),n.meta.error.down([[b,null]]),e.subscribe(c=>{for(let i of c){let f=i[0];if(f===k)u.down([[k]]);else if(f===b)t==="errored"?L(()=>{n.meta.error.down([[b,null]]),n.meta.status.down([[b,"active"]])}):n.meta.status.down([[b,"active"]]),t="active",u.emit(i[1]);else if(f===y)u.down([[y]]);else if(f===h)n.meta.status.down([[b,"completed"]]),t="completed",u.down([[h]]);else if(f===T){let a=M(i);L(()=>{n.meta.error.down([[b,a]]),n.meta.status.down([[b,"errored"]])}),t="errored",u.down([i])}else u.down([i])}})},{...S(),meta:{status:r,error:null},completeWhenDepsComplete:!1,resubscribable:!0,initial:e.cache});return{node:n,status:n.meta.status,error:n.meta.error}}var F=class extends Error{name="TimeoutError";constructor(s){super(`Timed out after ${s/1e6}ms`)}};function j(e){return e!=null&&typeof e=="object"&&"cache"in e&&typeof e.subscribe=="function"}function K(e){return e!=null&&typeof e.then=="function"}function $(e){return e!=null&&typeof e=="object"&&typeof e[Symbol.asyncIterator]=="function"}function ie(e,s){return g(r=>{let n,l;function u(){l?.(),l=void 0,j(s)||K(s)||$(s)?n=I(s).subscribe(o=>{r.down(o)}):(r.emit(s),r.down([[h]]))}return l=e.subscribe(t=>{for(let o of t){let c=o[0];if(c===k)r.down([[k]]);else if(c===b)r.emit(o[1]);else if(c===y)r.down([[y]]);else if(c===h)r.down([[h]]);else if(c===T){u();return}else if(c===C){n?.(),r.down([o]);return}else r.down([o])}}),()=>{l?.(),n?.()}},{...S(),initial:e.cache})}function se(e,s){if(s<=0)throw new RangeError("timeoutNs must be > 0");return g(r=>{let n=!1,l=new E;function u(){let o=s/1e6;l.start(o,()=>{n||(n=!0,t(),r.down([[T,new F(s)]]))})}let t=e.subscribe(o=>{for(let c of o){if(n)return;let i=c[0];if(i===k)r.down([[k]]);else if(i===b)u(),r.emit(c[1]);else if(i===y)r.down([[y]]);else if(i===h){l.cancel(),n=!0,r.down([[h]]);return}else if(i===T){l.cancel(),n=!0,r.down([c]);return}else if(i===C){l.cancel(),n=!0,r.down([c]);return}else r.down([c])}});return u(),()=>{n=!0,l.cancel(),t()}},{...S(),initial:e.cache})}export{Z as a,ee as b,A as c,te as d,ne as e,U as f,D as g,re as h,oe as i,F as j,ie as k,se as l};
@@ -1,4 +1,4 @@
1
- import{b as q}from"./chunk-ERLIRFPA.js";import{g as W,j as D}from"./chunk-CKCSDI7T.js";import{E as M,F as A,G as L,H as T}from"./chunk-ZB5EHBIO.js";import{b as Q}from"./chunk-QYADASLV.js";var ie={};Q(ie,{compileSpec:()=>ne,decompileGraph:()=>se,extractFnFactory:()=>z,extractSourceFactory:()=>U,generateCatalogPrompt:()=>V,isRichFnEntry:()=>_,isRichSourceEntry:()=>J,llmCompose:()=>ae,llmRefine:()=>H,specDiff:()=>re,validateSpec:()=>E,validateSpecAgainstCatalog:()=>I});function _(a){return typeof a=="object"&&a!==null&&"factory"in a}function J(a){return typeof a=="object"&&a!==null&&"factory"in a}function z(a){return _(a)?a.factory:a}function U(a){return J(a)?a.factory:a}function V(a){let o=[];if(a.fns){let n=new Map;for(let[p,i]of Object.entries(a.fns)){let l=_(i)?i.tags?.[0]??"Other":"Other";n.has(l)||n.set(l,[]),n.get(l).push(X(p,i))}for(let[p,i]of n)o.push(`${p}:
1
+ import{b as q}from"./chunk-AMG5VBHW.js";import{h as W,k as D}from"./chunk-MGKAO4EK.js";import{E as M,F as A,G as L,H as T}from"./chunk-W4TSQ6RJ.js";import{b as Q}from"./chunk-QYADASLV.js";var ie={};Q(ie,{compileSpec:()=>ne,decompileGraph:()=>se,extractFnFactory:()=>z,extractSourceFactory:()=>U,generateCatalogPrompt:()=>V,isRichFnEntry:()=>_,isRichSourceEntry:()=>J,llmCompose:()=>ae,llmRefine:()=>H,specDiff:()=>re,validateSpec:()=>E,validateSpecAgainstCatalog:()=>I});function _(a){return typeof a=="object"&&a!==null&&"factory"in a}function J(a){return typeof a=="object"&&a!==null&&"factory"in a}function z(a){return _(a)?a.factory:a}function U(a){return J(a)?a.factory:a}function V(a){let o=[];if(a.fns){let n=new Map;for(let[p,i]of Object.entries(a.fns)){let l=_(i)?i.tags?.[0]??"Other":"Other";n.has(l)||n.set(l,[]),n.get(l).push(X(p,i))}for(let[p,i]of n)o.push(`${p}:
2
2
  ${i.join(`
3
3
  `)}`)}if(a.sources){let n=[];for(let[p,i]of Object.entries(a.sources))n.push(Z(p,i));n.length>0&&o.push(`Sources:
4
4
  ${n.join(`
@@ -0,0 +1,43 @@
1
+ import{a as me}from"./chunk-WM7H7WTY.js";import{u as Q}from"./chunk-22SVXUPB.js";import{a as pe}from"./chunk-4OFIQ66T.js";import{e as fe}from"./chunk-VWPRPPKR.js";import{a as M}from"./chunk-Y53B6NS4.js";import{b as J,d as K}from"./chunk-5Z4HDCO6.js";import{g as le,k as Y}from"./chunk-MGKAO4EK.js";import{b as A,q as G,r as ce,v as $}from"./chunk-5JDE5JHE.js";import{m as ue}from"./chunk-KASHOCF5.js";import{b as de}from"./chunk-2GQREQ6C.js";import{D as ie,E as b,G as k,H as C,o as L}from"./chunk-W4TSQ6RJ.js";import{b as Ie}from"./chunk-QYADASLV.js";var Ye={};Ie(Ye,{DEFAULT_DECAY_RATE:()=>X,DEFAULT_QUEUE_CONFIGS:()=>Z,DEFAULT_SEVERITY_WEIGHTS:()=>z,HarnessGraph:()=>U,QUEUE_NAMES:()=>N,affectedTaskFilter:()=>Oe,beforeAfterCompare:()=>we,codeChangeBridge:()=>Ce,createIntakeBridge:()=>be,defaultErrorClassifier:()=>W,defaultLlmExecutor:()=>ge,defaultLlmVerifier:()=>ye,evalIntakeBridge:()=>Ne,evalSource:()=>Se,evalVerifier:()=>Le,harnessLoop:()=>Fe,harnessProfile:()=>De,harnessTrace:()=>Be,notifyEffect:()=>_e,priorityScore:()=>Ge,refineExecutor:()=>Qe,strategyKey:()=>P,strategyModel:()=>ee});function be(t,e,r,n){return C([t],([a])=>{if(a==null)return;let d=r(a);for(let i of d)e.publish(i)},{name:n?.name??"intake-bridge"})}function Ne(t,e,r){let n=r?.defaultSeverity??"medium";return C([t],([a])=>{if(a==null)return;let d=Array.isArray(a)?a:[a];for(let i of d)for(let o of i.tasks)if(!(o.valid&&o.judge_scores?.every(s=>s.pass))){if(!o.valid&&(!o.judge_scores||o.judge_scores.length===0)){e.publish({source:"eval",summary:`Task ${o.task_id} invalid (model: ${i.model})`,evidence:`Run ${i.run_id}: task produced invalid output`,affectsAreas:["graphspec"],affectsEvalTasks:[o.task_id],severity:n});continue}if(o.judge_scores)for(let s of o.judge_scores)s.pass||e.publish({source:"eval",summary:`${o.task_id}: ${s.claim} (model: ${i.model})`,evidence:s.reasoning,affectsAreas:["graphspec"],affectsEvalTasks:[o.task_id],severity:n})}},{name:r?.name??"eval-intake-bridge"})}function Se(t,e){return $(t,()=>ue(e()))}function we(t,e){return k([t,e],([r,n])=>{let a=r,d=n,i=new Map(a.tasks.map(c=>[c.task_id,c])),o=new Map(d.tasks.map(c=>[c.task_id,c])),s=new Set([...i.keys(),...o.keys()]),u=[],f=[],l=[];for(let c of s){let m=i.get(c),I=o.get(c),g=m?.valid??!1,E=I?.valid??!1,T=m?.judge_scores?m.judge_scores.filter(j=>j.pass).length:void 0,h=I?.judge_scores?I.judge_scores.filter(j=>j.pass).length:void 0,S=T!==void 0&&h!==void 0?h-T:void 0;u.push({taskId:c,before:g,after:E,scoreDiff:S}),g&&!E&&f.push(c),!g&&E&&l.push(c)}return{newFailures:f,resolved:l,taskDeltas:u,overallImproved:l.length>f.length}},{name:"eval-delta"})}function Oe(t,e){let r=e==null?null:Array.isArray(e)?b(e):e,n=[t];return r&&n.push(r),k(n,a=>{let d=a[0],i=r?new Set(a[1]):null,o=new Set;for(let s of d)for(let u of s.affectsEvalTasks??[])(i==null||i.has(u))&&o.add(u);return[...o].sort()},{name:"affected-task-filter"})}function Ce(t,e,r,n){let a=n?.defaultSeverity??"high";function d(o){let s=[];for(let u of o.lintErrors??[])s.push({source:"code-change",summary:`Lint: ${u.rule} in ${u.file}:${u.line}`,evidence:u.message,affectsAreas:[u.file],severity:a});for(let u of o.testFailures??[])s.push({source:"test",summary:`Test failure: ${u.testId}`,evidence:u.message,affectsAreas:[u.file],affectsEvalTasks:[u.testId],severity:a});return s}let i=r??d;return C([t],([o])=>{if(o!=null)for(let s of i(o))e.publish(s)},{name:n?.name??"code-change-bridge"})}function _e(t,e,r){return C([t.latest],([n])=>{n!=null&&e(n)},{name:r?.name??"notify-effect"})}function Ae(t){if(t.length===0)return Number.NEGATIVE_INFINITY;let e=0;for(let r of t)e+=r.score;return e/t.length}function $e(t){let{passCount:e,total:r,meanScore:n,threshold:a,missingArtifact:d}=t,i=Number.isFinite(n)?n.toFixed(3):String(n),o=!d&&r>0&&n>=a,s=d?["EXECUTE stage did not emit an artifact; cannot verify reactively"]:o?[`${e}/${r} eval tasks passed; mean score ${i} \u2265 ${a}`]:r===0?["No eval tasks were selected for this item \u2014 cannot verify"]:[`${e}/${r} eval tasks passed; mean score ${i} < threshold ${a}`];return o?{verified:!0,findings:s}:{verified:!1,findings:s,errorClass:"structural"}}function Ve(t){return t.artifact}function Le(t){let e=t.name??"eval-verifier",r=t.threshold??.5,n=t.toOutput??$e,a=t.extractArtifact??Ve;return d=>{let i=A(d,s=>s!=null&&s[0]!=null&&s[1]!=null),o=$(i,([s,u])=>{let f=a(s,u);if(f==null)return b(n({scores:[],meanScore:Number.NEGATIVE_INFINITY,passCount:0,total:0,threshold:r,missingArtifact:!0}));let l=b([f],{name:`${e}/candidates`}),c=b(t.datasetFor(u),{name:`${e}/dataset`}),m=t.evaluator(l,c);return k([m],([I])=>{let g=I;if(g==null)return null;let E=Ae(g),T=g.filter(h=>h.score>=r).length;return n({scores:g,meanScore:E,passCount:T,total:g.length,threshold:r})},{name:`${e}/output`})},{name:e});return A(o,s=>s!=null)}}var N=["auto-fix","needs-decision","investigation","backlog"];function P(t,e){return`${t}\u2192${e}`}function W(t){let e=t.detail.toLowerCase();return e.includes("parse")||e.includes("json")||e.includes("config")||e.includes("validation")||e.includes("syntax")?"self-correctable":"structural"}var z={critical:100,high:70,medium:40,low:10},X=Math.LN2/(168*3600),Z={"auto-fix":{gated:!1},"needs-decision":{gated:!0},investigation:{gated:!0},backlog:{gated:!1,startOpen:!1}};function ee(){let t=de({name:"strategy-entries"}),e=k([t.entries],([i])=>{let o=i;return new Map(o)},{name:"strategy-model",equals:(i,o)=>{let s=i,u=o;if(s.size!==u.size)return!1;for(let[f,l]of s){let c=u.get(f);if(!c||l.attempts!==c.attempts||l.successes!==c.successes)return!1}return!0}});function r(i,o,s){let u=P(i,o),f=t.get(u),l=(f?.attempts??0)+1,c=(f?.successes??0)+(s?1:0);t.set(u,{rootCause:i,intervention:o,attempts:l,successes:c,successRate:c/l})}function n(i,o){return t.get(P(i,o))}let a=e.subscribe(()=>{});function d(){a()}return{node:e,record:r,lookup:n,dispose:d}}function Ge(t,e,r,n,a){let d={...z,...a?.severityWeights},i=a?.decayRate??X,o=a?.effectivenessThreshold??.7,s=a?.effectivenessBoost??15,u=[t,e,r];return n&&u.push(n),k(u,f=>{let l=f[0],c=f[1],m=f[2],I=n?f[3]:0,g=d[l.severity??"medium"],E=(L()-m)/1e9,T=pe(g,E,i,0),h=P(l.rootCause,l.intervention),S=c.get(h);return S&&S.successRate>=o&&(T+=s),T+=I*20,T},{name:"priority-score"})}var Me=`You are a triage classifier for a reactive collaboration harness.
2
+
3
+ Given an intake item, classify it and output JSON:
4
+ {
5
+ "rootCause": "composition" | "missing-fn" | "bad-docs" | "schema-gap" | "regression" | "unknown",
6
+ "intervention": "template" | "catalog-fn" | "docs" | "wrapper" | "schema-change" | "investigate",
7
+ "route": "auto-fix" | "needs-decision" | "investigation" | "backlog",
8
+ "priority": <number 0-100>,
9
+ "triageReasoning": "<one sentence>"
10
+ }
11
+
12
+ Strategy model (past effectiveness):
13
+ {{strategy}}
14
+
15
+ Intake item:
16
+ {{item}}`,Pe=`You are an implementation agent.
17
+
18
+ Given a triaged issue with root cause and intervention type, produce a fix.
19
+
20
+ Issue:
21
+ {{item}}
22
+
23
+ Output JSON:
24
+ {
25
+ "outcome": "success" | "failure" | "partial",
26
+ "detail": "<description of what was done or what failed>"
27
+ }`,je=`You are a QA reviewer.
28
+
29
+ Given an execution result, verify whether the fix is correct.
30
+
31
+ Execution:
32
+ {{execution}}
33
+
34
+ Original issue:
35
+ {{item}}
36
+
37
+ Output JSON:
38
+ {
39
+ "verified": true/false,
40
+ "findings": ["<finding1>", ...],
41
+ "errorClass": "self-correctable" | "structural" // only if verified=false
42
+ }`;function ge(t,e){let r=e??(n=>Pe.replace("{{item}}",JSON.stringify(n)));return n=>Q(t,[n],r,{name:"execute",format:"json",retries:1})}function ye(t,e){let r=e??(n=>{let[a,d]=n;return je.replace("{{execution}}",JSON.stringify(a)).replace("{{item}}",JSON.stringify(d))});return n=>Q(t,[n],r,{name:"verify",format:"json",retries:1})}var U=class extends Y{intake;queues;gates;strategy;verifyResults;totalRetries;totalReingestions;constructor(e,r,n,a,d,i,o,s){super(e),this.intake=r,this.queues=n,this.gates=a,this.strategy=d,this.verifyResults=i,this.totalRetries=o,this.totalReingestions=s}};function Fe(t,e){let r=e.adapter,n=e.maxRetries??2,a=e.retainedLimit??1e3,d=e.errorClassifier??W,i=new Map;for(let p of N)i.set(p,{...Z[p],...e.queues?.[p]});let o=new M("intake",{retainedLimit:a}),s=ee(),u=G(o.latest,s.node),f=Q(r,[u],e.triagePrompt??(p=>{let[x,R]=p;return x?Me.replace("{{strategy}}",JSON.stringify(Array.from(R.entries()))).replace("{{item}}",JSON.stringify(x)):""}),{name:"triage",format:"json",retries:1}),l=new Map;for(let p of N)l.set(p,new M(`queue/${p}`,{retainedLimit:a}));let c=G(f,u),I=C([c],([p])=>{if(p==null)return;let[x,R]=p;if(!x?.route)return;let _=R?.[0],w={...x,..._},D=l.get(w.route);D&&D.publish(w)}).subscribe(()=>{}),g=new Y("gates"),E=new Map;for(let p of N){let x=i.get(p),R=l.get(p);if(x.gated){g.add(R.latest,{name:`${p}/source`});let _=fe(g,`${p}/gate`,`${p}/source`,{maxPending:x.maxPending,startOpen:x.startOpen});E.set(p,_)}}let T=new M("retry-input",{retainedLimit:a}),h=[];for(let p of N)i.get(p).gated&&E.has(p)?h.push(E.get(p).node):h.push(l.get(p).latest);h.push(T.latest);let S=ce(...h),te=(e.executor??ge(r,e.executePrompt))(S),re=G(te,S),F=new M("verify-results",{retainedLimit:a}),ne=(e.verifier??ye(r,e.verifyPrompt))(re),xe=G(ne,re),oe=e.maxReingestions??1,Ee=Math.min(e.maxTotalRetries??n*10,100),Te=Math.min(e.maxTotalReingestions??oe*10,100),se=b(0),ae=b(0),he=ie([xe],(p,x)=>{let R=p[0];if(R==null||R.length===0)return;let _=R[R.length-1];if(_==null)return;let[w,D]=_,[B,y]=D??[null,null];if(!w||!y)return;let Re={item:y,outcome:B?.outcome??"failure",detail:B?.detail??"unknown",artifact:B?.artifact},O={item:y,execution:Re,verified:w.verified,findings:w.findings??[],errorClass:w.errorClass};if(O.verified){s.record(y.rootCause,y.intervention,!0),F.publish(O);return}let ke=O.errorClass??d({item:y,outcome:"failure",detail:O.findings.join("; ")}),q=y._retries??0;if(ke==="self-correctable"&&q<n&&J(se,Ee)){let V=K(y),H={...y,_retries:q+1,summary:`[RETRY ${q+1}/${n}] ${V} \u2014 Previous attempt failed: ${O.findings.join("; ")}`,relatedTo:[V]};T.publish(H)}else{s.record(y.rootCause,y.intervention,!1),F.publish(O);let V=K(y),H=y._reingestions??0;H<oe&&J(ae,Te)&&o.publish({source:"eval",summary:`Verification failed for: ${V}`,evidence:O.findings.join(`
43
+ `),affectsAreas:y.affectsAreas,affectsEvalTasks:y.affectsEvalTasks,severity:"high",relatedTo:[V],_reingestions:H+1})}}).subscribe(()=>{}),v=new U(t,o,l,E,s,F,se,ae);v.addDisposer(I),v.addDisposer(he),v.addDisposer(s.dispose),v.add(f,{name:"triage"}),v.add(te,{name:"execute"}),v.add(ne,{name:"verify"}),v.add(s.node,{name:"strategy"}),v.mount("intake",o);for(let[p,x]of l)v.mount(`queue/${p}`,x);return v.mount("gates",g),v.mount("retry-input",T),v.mount("verify-results",F),v}function De(t,e){let r=le(t,e),n={};for(let[a,d]of t.queues)n[a]=d.retained().length;return{...r,queueDepths:n,strategyEntries:t.strategy.node.cache?.size??0,totalRetries:t.totalRetries.cache??0,totalReingestions:t.totalReingestions.cache??0}}function He(t){let{best:e,score:r,status:n}=t,a=Number.isFinite(r)?r.toFixed(3):String(r);return n==="converged"?{outcome:"success",detail:`refineLoop converged at score ${a}`,artifact:e}:n==="budget"?{outcome:"partial",detail:`refineLoop hit budget at score ${a}`,artifact:e}:{outcome:"failure",detail:`refineLoop errored (status=${n})`,artifact:e}}function Qe(t){let e=t.name??"refine-executor",r=t.toOutput??He;return n=>{let a=A(n,i=>i!=null),d=$(a,i=>{let o=me(t.seedFrom(i),t.evaluator,t.strategy,{...t.refine,dataset:t.datasetFor(i),name:`${e}/inner`});return k([o.status,o.best,o.score],([s,u,f])=>{let l=s;return l!=="converged"&&l!=="budget"&&l!=="errored"?null:r({best:u,score:f,status:l})},{name:`${e}/output`})},{name:e});return A(d,i=>i!=null)}}function Ue(t){let e={"intake::latest":"INTAKE",triage:"TRIAGE",execute:"EXECUTE","verify-results::latest":"VERIFY",strategy:"STRATEGY"};for(let r of N)e[`queue/${r}::latest`]="QUEUE";for(let[r]of t.gates)e[`gates::${r}/gate`]="GATE";return e}function Be(t,e){let r=e?.logger===null?null:e?.logger??console.log,n=e?.detail??"summary",a=L(),d=[],i=[],o=Ue(t);function s(){return(L()-a)/1e9}function u(f,l,c){let m={elapsed:s(),stage:f,type:l};n!=="summary"&&(m.summary=qe(c)),n==="full"&&(m.data=c),i.push(m)}for(let[f,l]of Object.entries(o))try{let c=t.observe(f,{format:"stage-log",stageLabels:o,logger:r?m=>r(m):()=>{},includeTypes:["data","error","complete"]});c.onEvent(m=>{m.type==="data"?u(l,"data",m.data):m.type==="error"?u(l,"error",m.data):m.type==="complete"&&u(l,"complete",void 0)}),d.push(c)}catch(c){let m=c instanceof Error?c.message:String(c);u(l,"error",`observe-unavailable: ${f} \u2014 ${m}`),r&&r(`[${s().toFixed(3)}s] ${l.padEnd(9)} \u2717 observe-unavailable: ${m}`)}return{get events(){return i},dispose(){for(let f of d)f.dispose();d.length=0}}}function qe(t){if(t==null)return"null";if(typeof t=="string")return ve(t,80);if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);try{let e=JSON.stringify(t);return ve(e,120)}catch{return String(t)}}function ve(t,e){return t.length>e?`${t.slice(0,e-1)}\u2026`:t}export{be as a,Ne as b,Se as c,we as d,Oe as e,Ce as f,_e as g,Le as h,N as i,P as j,W as k,z as l,X as m,Z as n,ee as o,Ge as p,ge as q,ye as r,U as s,Fe as t,De as u,Qe as v,Be as w,Ye as x};
@@ -1 +1 @@
1
- import{a as H,b as T}from"./chunk-QWAPKG3O.js";import{j as q}from"./chunk-CKCSDI7T.js";import{a as O,b as j}from"./chunk-VPYBOXVT.js";import{E as d,G as o,H as x,m as A}from"./chunk-ZB5EHBIO.js";import{b as ae}from"./chunk-QYADASLV.js";var ie={};ae(ie,{demoShell:()=>re});function w(h){return Math.max(0,Math.min(1,h))}function re(h){let B=w(h?.mainRatio??.65),E=w(h?.sideSplit??.5),J=Math.max(0,h?.viewportWidth??1280),k=h?.nodeRegistry??new Map,p=h?.adapter??null,S=h?.layoutFont??"14px monospace",u=h?.onHighlight,t=new q("demo-shell"),F=d(B,{name:"pane/main-ratio"}),D=d(E,{name:"pane/side-split"}),g=d(null,{name:"pane/fullscreen"}),G=d(J,{name:"viewport/width"});t.add(F,{name:"pane/main-ratio"}),t.add(D,{name:"pane/side-split"}),t.add(g,{name:"pane/fullscreen"}),t.add(G,{name:"viewport/width"});let L=o([F,G,g],([e,a,n])=>{let l=e,r=a,i=n;return i==="main"?r:i==="graph"||i==="code"?0:Math.round(r*l)},{name:"pane/main-width"}),R=o([L,G,g],([e,a,n])=>{let l=n,r=a;return l==="main"?0:l==="graph"||l==="code"?r:r-e},{name:"pane/side-width"}),C=o([D,g],([e,a])=>{let n=a;return n==="graph"?1:n==="code"||n==="main"?0:w(e)},{name:"pane/graph-height-ratio"}),K=o([C,g],([e,a])=>{let n=a;return n==="code"?1:n==="graph"||n==="main"?0:1-e},{name:"pane/code-height-ratio"});t.add(L,{name:"pane/main-width"}),t.add(R,{name:"pane/side-width"}),t.add(C,{name:"pane/graph-height-ratio"}),t.add(K,{name:"pane/code-height-ratio"});let b=d(null,{name:"demo/graph-ref"}),m=d(0,{name:"demo/graph-tick"});t.add(b,{name:"demo/graph-ref"}),t.add(m,{name:"demo/graph-tick"});let Q=o([b,m],([e,a])=>{let n=e;return n?n.describe({format:"mermaid"}):""},{name:"graph/mermaid"}),z=o([b,m],([e,a])=>{let n=e;if(!n)return null;let{expand:l,...r}=n.describe({detail:"standard"});return r},{name:"graph/describe"});t.add(Q,{name:"graph/mermaid"}),t.add(z,{name:"graph/describe"});let M=d(null,{name:"hover/target"});t.add(M,{name:"hover/target"});let P=o([M],([e])=>{let a=e;if(!a)return null;let n=k.get(a.id);return n?n.codeLine:null},{name:"highlight/code-scroll"}),W=o([M],([e])=>{let a=e;if(!a)return null;let n=k.get(a.id);return n?n.visualSelector:null},{name:"highlight/visual"}),N=o([M],([e])=>{let a=e;return a?a.id:null},{name:"highlight/graph"});if(t.add(P,{name:"highlight/code-scroll"}),t.add(W,{name:"highlight/visual"}),t.add(N,{name:"highlight/graph"}),u?.codeScroll){let e=u.codeScroll,a=x([P],([n])=>{e(n)});t.add(a,{name:"highlight/apply-code-scroll"})}if(u?.visual){let e=u.visual,a=x([W],([n])=>{e(n)});t.add(a,{name:"highlight/apply-visual"})}if(u?.graph){let e=u.graph,a=x([N],([n])=>{e(n)});t.add(a,{name:"highlight/apply-graph"})}let _=d(null,{name:"inspect/selected-node"});t.add(_,{name:"inspect/selected-node"});let U=O("standard"),X=o([_,b,m],([e,a,n])=>{let l=a,r=e;if(!l||!r)return null;try{let i=l.resolve(r),s=j(i,U);return{path:r,...s,value:i.cache}}catch{return null}},{name:"inspect/node-detail"}),Y=o([b,m],([e,a])=>{let n=e;return n?n.trace():[]},{name:"inspect/trace-log"});t.add(X,{name:"inspect/node-detail"}),t.add(Y,{name:"inspect/trace-log"});let I=d(!1,{name:"meta/debug"});t.add(I,{name:"meta/debug"});let Z=o([I,m],([e,a])=>e?t.describe({format:"mermaid"}):"",{name:"meta/shell-mermaid"});t.add(Z,{name:"meta/shell-mermaid"});let V=d("",{name:"layout/code-text"});if(t.add(V,{name:"layout/code-text"}),p){let e=new Map,a=o([z],([r])=>{let i=r;if(!i)return new Map;let s=new Map;for(let[c]of Object.entries(i.nodes)){let f=H(c,S,p,e),v=T(f,1/0,p,S,e),y=v.lines.reduce((te,ne)=>Math.max(te,ne.width),0),ee=v.lineCount*20;s.set(c,{width:y,height:ee})}return s},{name:"layout/graph-labels",equals:(r,i)=>{if(r===i)return!0;let s=r,c=i;if(s.size!==c.size)return!1;for(let[f,v]of s){let y=c.get(f);if(!y||y.width!==v.width||y.height!==v.height)return!1}return!0}}),n=o([V,R],([r,i])=>{let s=r;if(!s)return{lineCount:0,lines:[]};let c=H(s,S,p,e),f=i-40;return T(c,Math.max(100,f),p,S,e)},{name:"layout/code-lines"}),l=o([a],([r])=>{let i=r;if(i.size===0)return 200;let s=0;for(let{width:c}of i.values())c>s&&(s=c);return Math.max(200,Math.round(s+80))},{name:"layout/side-width-hint"});t.add(a,{name:"layout/graph-labels"}),t.add(n,{name:"layout/code-lines"}),t.add(l,{name:"layout/side-width-hint"})}let $=0;return{graph:t,setMainRatio(e){t.set("pane/main-ratio",w(e))},setSideSplit(e){t.set("pane/side-split",w(e))},setFullscreen(e){t.set("pane/fullscreen",e)},setViewportWidth(e){t.set("viewport/width",Math.max(0,e))},setHoverTarget(e){t.set("hover/target",e)},setDemoGraph(e){t.set("demo/graph-ref",e)},bumpGraphTick(){t.set("demo/graph-tick",++$)},selectNode(e){t.set("inspect/selected-node",e)},setMetaDebug(e){t.set("meta/debug",e)},setCodeText(e){t.set("layout/code-text",e)},batch(e){A(e)},destroy(){t.destroy()}}}export{re as a,ie as b};
1
+ import{a as H,b as T}from"./chunk-4JJCCD5S.js";import{k as q}from"./chunk-MGKAO4EK.js";import{a as O,b as j}from"./chunk-TWMEGG45.js";import{E as d,G as o,H as x,m as A}from"./chunk-W4TSQ6RJ.js";import{b as ae}from"./chunk-QYADASLV.js";var ie={};ae(ie,{demoShell:()=>re});function w(h){return Math.max(0,Math.min(1,h))}function re(h){let B=w(h?.mainRatio??.65),E=w(h?.sideSplit??.5),J=Math.max(0,h?.viewportWidth??1280),k=h?.nodeRegistry??new Map,p=h?.adapter??null,S=h?.layoutFont??"14px monospace",u=h?.onHighlight,t=new q("demo-shell"),F=d(B,{name:"pane/main-ratio"}),D=d(E,{name:"pane/side-split"}),g=d(null,{name:"pane/fullscreen"}),G=d(J,{name:"viewport/width"});t.add(F,{name:"pane/main-ratio"}),t.add(D,{name:"pane/side-split"}),t.add(g,{name:"pane/fullscreen"}),t.add(G,{name:"viewport/width"});let L=o([F,G,g],([e,a,n])=>{let l=e,r=a,i=n;return i==="main"?r:i==="graph"||i==="code"?0:Math.round(r*l)},{name:"pane/main-width"}),R=o([L,G,g],([e,a,n])=>{let l=n,r=a;return l==="main"?0:l==="graph"||l==="code"?r:r-e},{name:"pane/side-width"}),C=o([D,g],([e,a])=>{let n=a;return n==="graph"?1:n==="code"||n==="main"?0:w(e)},{name:"pane/graph-height-ratio"}),K=o([C,g],([e,a])=>{let n=a;return n==="code"?1:n==="graph"||n==="main"?0:1-e},{name:"pane/code-height-ratio"});t.add(L,{name:"pane/main-width"}),t.add(R,{name:"pane/side-width"}),t.add(C,{name:"pane/graph-height-ratio"}),t.add(K,{name:"pane/code-height-ratio"});let b=d(null,{name:"demo/graph-ref"}),m=d(0,{name:"demo/graph-tick"});t.add(b,{name:"demo/graph-ref"}),t.add(m,{name:"demo/graph-tick"});let Q=o([b,m],([e,a])=>{let n=e;return n?n.describe({format:"mermaid"}):""},{name:"graph/mermaid"}),z=o([b,m],([e,a])=>{let n=e;if(!n)return null;let{expand:l,...r}=n.describe({detail:"standard"});return r},{name:"graph/describe"});t.add(Q,{name:"graph/mermaid"}),t.add(z,{name:"graph/describe"});let M=d(null,{name:"hover/target"});t.add(M,{name:"hover/target"});let P=o([M],([e])=>{let a=e;if(!a)return null;let n=k.get(a.id);return n?n.codeLine:null},{name:"highlight/code-scroll"}),W=o([M],([e])=>{let a=e;if(!a)return null;let n=k.get(a.id);return n?n.visualSelector:null},{name:"highlight/visual"}),N=o([M],([e])=>{let a=e;return a?a.id:null},{name:"highlight/graph"});if(t.add(P,{name:"highlight/code-scroll"}),t.add(W,{name:"highlight/visual"}),t.add(N,{name:"highlight/graph"}),u?.codeScroll){let e=u.codeScroll,a=x([P],([n])=>{e(n)});t.add(a,{name:"highlight/apply-code-scroll"})}if(u?.visual){let e=u.visual,a=x([W],([n])=>{e(n)});t.add(a,{name:"highlight/apply-visual"})}if(u?.graph){let e=u.graph,a=x([N],([n])=>{e(n)});t.add(a,{name:"highlight/apply-graph"})}let _=d(null,{name:"inspect/selected-node"});t.add(_,{name:"inspect/selected-node"});let U=O("standard"),X=o([_,b,m],([e,a,n])=>{let l=a,r=e;if(!l||!r)return null;try{let i=l.resolve(r),s=j(i,U);return{path:r,...s,value:i.cache}}catch{return null}},{name:"inspect/node-detail"}),Y=o([b,m],([e,a])=>{let n=e;return n?n.trace():[]},{name:"inspect/trace-log"});t.add(X,{name:"inspect/node-detail"}),t.add(Y,{name:"inspect/trace-log"});let I=d(!1,{name:"meta/debug"});t.add(I,{name:"meta/debug"});let Z=o([I,m],([e,a])=>e?t.describe({format:"mermaid"}):"",{name:"meta/shell-mermaid"});t.add(Z,{name:"meta/shell-mermaid"});let V=d("",{name:"layout/code-text"});if(t.add(V,{name:"layout/code-text"}),p){let e=new Map,a=o([z],([r])=>{let i=r;if(!i)return new Map;let s=new Map;for(let[c]of Object.entries(i.nodes)){let f=H(c,S,p,e),v=T(f,1/0,p,S,e),y=v.lines.reduce((te,ne)=>Math.max(te,ne.width),0),ee=v.lineCount*20;s.set(c,{width:y,height:ee})}return s},{name:"layout/graph-labels",equals:(r,i)=>{if(r===i)return!0;let s=r,c=i;if(s.size!==c.size)return!1;for(let[f,v]of s){let y=c.get(f);if(!y||y.width!==v.width||y.height!==v.height)return!1}return!0}}),n=o([V,R],([r,i])=>{let s=r;if(!s)return{lineCount:0,lines:[]};let c=H(s,S,p,e),f=i-40;return T(c,Math.max(100,f),p,S,e)},{name:"layout/code-lines"}),l=o([a],([r])=>{let i=r;if(i.size===0)return 200;let s=0;for(let{width:c}of i.values())c>s&&(s=c);return Math.max(200,Math.round(s+80))},{name:"layout/side-width-hint"});t.add(a,{name:"layout/graph-labels"}),t.add(n,{name:"layout/code-lines"}),t.add(l,{name:"layout/side-width-hint"})}let $=0;return{graph:t,setMainRatio(e){t.set("pane/main-ratio",w(e))},setSideSplit(e){t.set("pane/side-split",w(e))},setFullscreen(e){t.set("pane/fullscreen",e)},setViewportWidth(e){t.set("viewport/width",Math.max(0,e))},setHoverTarget(e){t.set("hover/target",e)},setDemoGraph(e){t.set("demo/graph-ref",e)},bumpGraphTick(){t.set("demo/graph-tick",++$)},selectNode(e){t.set("inspect/selected-node",e)},setMetaDebug(e){t.set("meta/debug",e)},setCodeText(e){t.set("layout/code-text",e)},batch(e){A(e)},destroy(){t.destroy()}}}export{re as a,ie as b};
@@ -1 +1 @@
1
- import{E as b,m as h}from"./chunk-ZB5EHBIO.js";import{b as p,c as l}from"./chunk-CK2E7BTU.js";var u=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._buf.length+e;if(!(n<0||n>=this._buf.length))return this._buf[n]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._buf.length;this._buf.length=n+e.length;for(let i=0;i<e.length;i++)this._buf[n+i]=e[i];this._version+=1}insert(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,n),this._version+=1}insertMany(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);n.length!==0&&(this._buf.splice(e,0,...n),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let n=e>=0?e:this._buf.length+e;if(n<0||n>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[i]=this._buf.splice(n,1);return this._version+=1,i}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function y(d,e={}){let{name:n,versioning:i,backend:f}=e,t=f??new u(d),a=b(t.toArray(),{name:n,describeKind:"state",equals:(r,o)=>r===o,...i!=null?{versioning:i}:{}});function v(){let r=t.toArray();h(()=>{a.down([[l]]),a.down([[p,r]])})}function s(r){let o=t.version;try{return r()}finally{t.version!==o&&v()}}return{items:a,get size(){return t.size},at(r){return t.at(r)},append(r){s(()=>t.append(r))},appendMany(r){s(()=>t.appendMany(r))},insert(r,o){s(()=>t.insert(r,o))},insertMany(r,o){s(()=>t.insertMany(r,o))},pop(r=-1){return s(()=>t.pop(r))},clear(){s(()=>t.clear())},dispose(){}}}export{u as a,y as b};
1
+ import{E as b,m as h}from"./chunk-W4TSQ6RJ.js";import{b as p,c as l}from"./chunk-CK2E7BTU.js";var u=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._buf.length+e;if(!(n<0||n>=this._buf.length))return this._buf[n]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._buf.length;this._buf.length=n+e.length;for(let i=0;i<e.length;i++)this._buf[n+i]=e[i];this._version+=1}insert(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,n),this._version+=1}insertMany(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);n.length!==0&&(this._buf.splice(e,0,...n),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let n=e>=0?e:this._buf.length+e;if(n<0||n>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[i]=this._buf.splice(n,1);return this._version+=1,i}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function y(d,e={}){let{name:n,versioning:i,backend:f}=e,t=f??new u(d),a=b(t.toArray(),{name:n,describeKind:"state",equals:(r,o)=>r===o,...i!=null?{versioning:i}:{}});function v(){let r=t.toArray();h(()=>{a.down([[l]]),a.down([[p,r]])})}function s(r){let o=t.version;try{return r()}finally{t.version!==o&&v()}}return{items:a,get size(){return t.size},at(r){return t.at(r)},append(r){s(()=>t.append(r))},appendMany(r){s(()=>t.appendMany(r))},insert(r,o){s(()=>t.insert(r,o))},insertMany(r,o){s(()=>t.insertMany(r,o))},pop(r=-1){return s(()=>t.pop(r))},clear(){s(()=>t.clear())},dispose(){}}}export{u as a,y as b};
@@ -1 +1 @@
1
- import{C as l,v as o}from"./chunk-ZB5EHBIO.js";function h(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;default:return new Set(["type","deps"])}}function m(t){return t._describeKind!=null?t._describeKind:t._deps.length>0?"derived":t._fn!=null?"producer":"state"}function g(t){let e={};for(let[r,a]of Object.entries(t.meta))try{e[r]=a.cache}catch{}return e}function y(t,e){let r=e==null,a=!r&&e!=null?[...e].filter(n=>n.startsWith("meta.")).map(n=>n.slice(5)):null,d=r||e.has("meta")||a!=null&&a.length>0,c="state",p=[];t instanceof l&&(c=m(t),p=t._deps.map(n=>n.node.name??""));let s={type:c,deps:p};(r||e.has("status"))&&(s.status=t.status);let i=t instanceof l?t._guard:void 0;if(d){let n={...g(t)};if(i!=null&&n.access===void 0&&(n.access=o(i)),a!=null&&a.length>0&&!e.has("meta")){let f={};for(let u of a)u in n&&(f[u]=n[u]);s.meta=f}else s.meta=n}if(t.name!=null&&(s.name=t.name),r||e.has("value")){t.status==="sentinel"&&(s.sentinel=!0);try{s.value=t.cache}catch{}}if((r||e.has("v"))&&t.v!=null){let n={id:t.v.id,version:t.v.version};"cid"in t.v&&(n.cid=t.v.cid,n.prev=t.v.prev),s.v=n}return(r||e.has("guard"))&&i!=null&&(s.guard=o(i)),(r||e.has("lastMutation"))&&t.lastMutation!=null&&(s.lastMutation=t.lastMutation),s}export{h as a,y as b};
1
+ import{C as l,v as o}from"./chunk-W4TSQ6RJ.js";function h(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;default:return new Set(["type","deps"])}}function m(t){return t._describeKind!=null?t._describeKind:t._deps.length>0?"derived":t._fn!=null?"producer":"state"}function g(t){let e={};for(let[r,a]of Object.entries(t.meta))try{e[r]=a.cache}catch{}return e}function y(t,e){let r=e==null,a=!r&&e!=null?[...e].filter(n=>n.startsWith("meta.")).map(n=>n.slice(5)):null,d=r||e.has("meta")||a!=null&&a.length>0,c="state",p=[];t instanceof l&&(c=m(t),p=t._deps.map(n=>n.node.name??""));let s={type:c,deps:p};(r||e.has("status"))&&(s.status=t.status);let i=t instanceof l?t._guard:void 0;if(d){let n={...g(t)};if(i!=null&&n.access===void 0&&(n.access=o(i)),a!=null&&a.length>0&&!e.has("meta")){let f={};for(let u of a)u in n&&(f[u]=n[u]);s.meta=f}else s.meta=n}if(t.name!=null&&(s.name=t.name),r||e.has("value")){t.status==="sentinel"&&(s.sentinel=!0);try{s.value=t.cache}catch{}}if((r||e.has("v"))&&t.v!=null){let n={id:t.v.id,version:t.v.version};"cid"in t.v&&(n.cid=t.v.cid,n.prev=t.v.prev),s.v=n}return(r||e.has("guard"))&&i!=null&&(s.guard=o(i)),(r||e.has("lastMutation"))&&t.lastMutation!=null&&(s.lastMutation=t.lastMutation),s}export{h as a,y as b};