@azx-pbc/axiom-runtime 0.0.0-stage → 0.0.1

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 (755) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +714 -2
  3. package/dist/cache/index.d.ts +191 -0
  4. package/dist/cache/index.d.ts.map +1 -0
  5. package/dist/cache/index.js +361 -0
  6. package/dist/cache/index.js.map +1 -0
  7. package/dist/canonical/jcs.d.ts +78 -0
  8. package/dist/canonical/jcs.d.ts.map +1 -0
  9. package/dist/canonical/jcs.js +500 -0
  10. package/dist/canonical/jcs.js.map +1 -0
  11. package/dist/canonical/restricted-json.d.ts +7 -0
  12. package/dist/canonical/restricted-json.d.ts.map +1 -0
  13. package/dist/canonical/restricted-json.js +318 -0
  14. package/dist/canonical/restricted-json.js.map +1 -0
  15. package/dist/canonical/restricted-value.d.ts +59 -0
  16. package/dist/canonical/restricted-value.d.ts.map +1 -0
  17. package/dist/canonical/restricted-value.js +156 -0
  18. package/dist/canonical/restricted-value.js.map +1 -0
  19. package/dist/canonical/restricted.d.ts +85 -0
  20. package/dist/canonical/restricted.d.ts.map +1 -0
  21. package/dist/canonical/restricted.js +163 -0
  22. package/dist/canonical/restricted.js.map +1 -0
  23. package/dist/canonical/signature.d.ts +38 -0
  24. package/dist/canonical/signature.d.ts.map +1 -0
  25. package/dist/canonical/signature.js +47 -0
  26. package/dist/canonical/signature.js.map +1 -0
  27. package/dist/eval/access/delivery.d.ts +63 -0
  28. package/dist/eval/access/delivery.d.ts.map +1 -0
  29. package/dist/eval/access/delivery.js +98 -0
  30. package/dist/eval/access/delivery.js.map +1 -0
  31. package/dist/eval/access/overlay.d.ts +72 -0
  32. package/dist/eval/access/overlay.d.ts.map +1 -0
  33. package/dist/eval/access/overlay.js +402 -0
  34. package/dist/eval/access/overlay.js.map +1 -0
  35. package/dist/eval/access/projection.d.ts +159 -0
  36. package/dist/eval/access/projection.d.ts.map +1 -0
  37. package/dist/eval/access/projection.js +211 -0
  38. package/dist/eval/access/projection.js.map +1 -0
  39. package/dist/eval/access/window.d.ts +128 -0
  40. package/dist/eval/access/window.d.ts.map +1 -0
  41. package/dist/eval/access/window.js +254 -0
  42. package/dist/eval/access/window.js.map +1 -0
  43. package/dist/eval/access/write.d.ts +113 -0
  44. package/dist/eval/access/write.d.ts.map +1 -0
  45. package/dist/eval/access/write.js +119 -0
  46. package/dist/eval/access/write.js.map +1 -0
  47. package/dist/eval/addressing.d.ts +131 -0
  48. package/dist/eval/addressing.d.ts.map +1 -0
  49. package/dist/eval/addressing.js +270 -0
  50. package/dist/eval/addressing.js.map +1 -0
  51. package/dist/eval/budget.d.ts +143 -0
  52. package/dist/eval/budget.d.ts.map +1 -0
  53. package/dist/eval/budget.js +387 -0
  54. package/dist/eval/budget.js.map +1 -0
  55. package/dist/eval/computed.d.ts +46 -0
  56. package/dist/eval/computed.d.ts.map +1 -0
  57. package/dist/eval/computed.js +89 -0
  58. package/dist/eval/computed.js.map +1 -0
  59. package/dist/eval/denials.d.ts +64 -0
  60. package/dist/eval/denials.d.ts.map +1 -0
  61. package/dist/eval/denials.js +87 -0
  62. package/dist/eval/denials.js.map +1 -0
  63. package/dist/eval/engine/cancellation.d.ts +12 -0
  64. package/dist/eval/engine/cancellation.d.ts.map +1 -0
  65. package/dist/eval/engine/cancellation.js +56 -0
  66. package/dist/eval/engine/cancellation.js.map +1 -0
  67. package/dist/eval/engine/delta.d.ts +104 -0
  68. package/dist/eval/engine/delta.d.ts.map +1 -0
  69. package/dist/eval/engine/delta.js +466 -0
  70. package/dist/eval/engine/delta.js.map +1 -0
  71. package/dist/eval/engine/deps.d.ts +136 -0
  72. package/dist/eval/engine/deps.d.ts.map +1 -0
  73. package/dist/eval/engine/deps.js +345 -0
  74. package/dist/eval/engine/deps.js.map +1 -0
  75. package/dist/eval/engine/identity.d.ts +128 -0
  76. package/dist/eval/engine/identity.d.ts.map +1 -0
  77. package/dist/eval/engine/identity.js +398 -0
  78. package/dist/eval/engine/identity.js.map +1 -0
  79. package/dist/eval/engine/index.d.ts +200 -0
  80. package/dist/eval/engine/index.d.ts.map +1 -0
  81. package/dist/eval/engine/index.js +1242 -0
  82. package/dist/eval/engine/index.js.map +1 -0
  83. package/dist/eval/engine/measurement.d.ts +23 -0
  84. package/dist/eval/engine/measurement.d.ts.map +1 -0
  85. package/dist/eval/engine/measurement.js +42 -0
  86. package/dist/eval/engine/measurement.js.map +1 -0
  87. package/dist/eval/engine/naive.d.ts +19 -0
  88. package/dist/eval/engine/naive.d.ts.map +1 -0
  89. package/dist/eval/engine/naive.js +59 -0
  90. package/dist/eval/engine/naive.js.map +1 -0
  91. package/dist/eval/engine/ops.d.ts +214 -0
  92. package/dist/eval/engine/ops.d.ts.map +1 -0
  93. package/dist/eval/engine/ops.js +1422 -0
  94. package/dist/eval/engine/ops.js.map +1 -0
  95. package/dist/eval/engine/patches.d.ts +40 -0
  96. package/dist/eval/engine/patches.d.ts.map +1 -0
  97. package/dist/eval/engine/patches.js +125 -0
  98. package/dist/eval/engine/patches.js.map +1 -0
  99. package/dist/eval/engine/ports.d.ts +71 -0
  100. package/dist/eval/engine/ports.d.ts.map +1 -0
  101. package/dist/eval/engine/ports.js +2 -0
  102. package/dist/eval/engine/ports.js.map +1 -0
  103. package/dist/eval/engine/session.d.ts +116 -0
  104. package/dist/eval/engine/session.d.ts.map +1 -0
  105. package/dist/eval/engine/session.js +653 -0
  106. package/dist/eval/engine/session.js.map +1 -0
  107. package/dist/eval/engine/snapshot.d.ts +97 -0
  108. package/dist/eval/engine/snapshot.d.ts.map +1 -0
  109. package/dist/eval/engine/snapshot.js +221 -0
  110. package/dist/eval/engine/snapshot.js.map +1 -0
  111. package/dist/eval/engine/subscriptions.d.ts +47 -0
  112. package/dist/eval/engine/subscriptions.d.ts.map +1 -0
  113. package/dist/eval/engine/subscriptions.js +103 -0
  114. package/dist/eval/engine/subscriptions.js.map +1 -0
  115. package/dist/eval/engine/trace.d.ts +77 -0
  116. package/dist/eval/engine/trace.d.ts.map +1 -0
  117. package/dist/eval/engine/trace.js +140 -0
  118. package/dist/eval/engine/trace.js.map +1 -0
  119. package/dist/eval/error-diagnostic.d.ts +26 -0
  120. package/dist/eval/error-diagnostic.d.ts.map +1 -0
  121. package/dist/eval/error-diagnostic.js +63 -0
  122. package/dist/eval/error-diagnostic.js.map +1 -0
  123. package/dist/eval/evaluate-expr.d.ts +44 -0
  124. package/dist/eval/evaluate-expr.d.ts.map +1 -0
  125. package/dist/eval/evaluate-expr.js +149 -0
  126. package/dist/eval/evaluate-expr.js.map +1 -0
  127. package/dist/eval/evaluate.d.ts +282 -0
  128. package/dist/eval/evaluate.d.ts.map +1 -0
  129. package/dist/eval/evaluate.js +391 -0
  130. package/dist/eval/evaluate.js.map +1 -0
  131. package/dist/eval/evolution/relocate.d.ts +72 -0
  132. package/dist/eval/evolution/relocate.d.ts.map +1 -0
  133. package/dist/eval/evolution/relocate.js +427 -0
  134. package/dist/eval/evolution/relocate.js.map +1 -0
  135. package/dist/eval/evolution/select.d.ts +11 -0
  136. package/dist/eval/evolution/select.d.ts.map +1 -0
  137. package/dist/eval/evolution/select.js +53 -0
  138. package/dist/eval/evolution/select.js.map +1 -0
  139. package/dist/eval/evolution/upcast.d.ts +13 -0
  140. package/dist/eval/evolution/upcast.d.ts.map +1 -0
  141. package/dist/eval/evolution/upcast.js +88 -0
  142. package/dist/eval/evolution/upcast.js.map +1 -0
  143. package/dist/eval/expr/aggregates.d.ts +75 -0
  144. package/dist/eval/expr/aggregates.d.ts.map +1 -0
  145. package/dist/eval/expr/aggregates.js +991 -0
  146. package/dist/eval/expr/aggregates.js.map +1 -0
  147. package/dist/eval/expr/arithmetic.d.ts +26 -0
  148. package/dist/eval/expr/arithmetic.d.ts.map +1 -0
  149. package/dist/eval/expr/arithmetic.js +387 -0
  150. package/dist/eval/expr/arithmetic.js.map +1 -0
  151. package/dist/eval/expr/between.d.ts +17 -0
  152. package/dist/eval/expr/between.d.ts.map +1 -0
  153. package/dist/eval/expr/between.js +46 -0
  154. package/dist/eval/expr/between.js.map +1 -0
  155. package/dist/eval/expr/binder.d.ts +96 -0
  156. package/dist/eval/expr/binder.d.ts.map +1 -0
  157. package/dist/eval/expr/binder.js +253 -0
  158. package/dist/eval/expr/binder.js.map +1 -0
  159. package/dist/eval/expr/call-dispatch.d.ts +28 -0
  160. package/dist/eval/expr/call-dispatch.d.ts.map +1 -0
  161. package/dist/eval/expr/call-dispatch.js +114 -0
  162. package/dist/eval/expr/call-dispatch.js.map +1 -0
  163. package/dist/eval/expr/collections.d.ts +20 -0
  164. package/dist/eval/expr/collections.d.ts.map +1 -0
  165. package/dist/eval/expr/collections.js +66 -0
  166. package/dist/eval/expr/collections.js.map +1 -0
  167. package/dist/eval/expr/compare.d.ts +36 -0
  168. package/dist/eval/expr/compare.d.ts.map +1 -0
  169. package/dist/eval/expr/compare.js +115 -0
  170. package/dist/eval/expr/compare.js.map +1 -0
  171. package/dist/eval/expr/datasets.d.ts +28 -0
  172. package/dist/eval/expr/datasets.d.ts.map +1 -0
  173. package/dist/eval/expr/datasets.js +304 -0
  174. package/dist/eval/expr/datasets.js.map +1 -0
  175. package/dist/eval/expr/digest.d.ts +23 -0
  176. package/dist/eval/expr/digest.d.ts.map +1 -0
  177. package/dist/eval/expr/digest.js +89 -0
  178. package/dist/eval/expr/digest.js.map +1 -0
  179. package/dist/eval/expr/domains.d.ts +19 -0
  180. package/dist/eval/expr/domains.d.ts.map +1 -0
  181. package/dist/eval/expr/domains.js +18 -0
  182. package/dist/eval/expr/domains.js.map +1 -0
  183. package/dist/eval/expr/host.d.ts +152 -0
  184. package/dist/eval/expr/host.d.ts.map +1 -0
  185. package/dist/eval/expr/host.js +36 -0
  186. package/dist/eval/expr/host.js.map +1 -0
  187. package/dist/eval/expr/lists.d.ts +24 -0
  188. package/dist/eval/expr/lists.d.ts.map +1 -0
  189. package/dist/eval/expr/lists.js +155 -0
  190. package/dist/eval/expr/lists.js.map +1 -0
  191. package/dist/eval/expr/member.d.ts +15 -0
  192. package/dist/eval/expr/member.d.ts.map +1 -0
  193. package/dist/eval/expr/member.js +32 -0
  194. package/dist/eval/expr/member.js.map +1 -0
  195. package/dist/eval/expr/money-ops.d.ts +10 -0
  196. package/dist/eval/expr/money-ops.d.ts.map +1 -0
  197. package/dist/eval/expr/money-ops.js +17 -0
  198. package/dist/eval/expr/money-ops.js.map +1 -0
  199. package/dist/eval/expr/operands.d.ts +27 -0
  200. package/dist/eval/expr/operands.d.ts.map +1 -0
  201. package/dist/eval/expr/operands.js +167 -0
  202. package/dist/eval/expr/operands.js.map +1 -0
  203. package/dist/eval/expr/presence.d.ts +27 -0
  204. package/dist/eval/expr/presence.d.ts.map +1 -0
  205. package/dist/eval/expr/presence.js +140 -0
  206. package/dist/eval/expr/presence.js.map +1 -0
  207. package/dist/eval/expr/records.d.ts +22 -0
  208. package/dist/eval/expr/records.d.ts.map +1 -0
  209. package/dist/eval/expr/records.js +101 -0
  210. package/dist/eval/expr/records.js.map +1 -0
  211. package/dist/eval/expr/rule-refs.d.ts +25 -0
  212. package/dist/eval/expr/rule-refs.d.ts.map +1 -0
  213. package/dist/eval/expr/rule-refs.js +60 -0
  214. package/dist/eval/expr/rule-refs.js.map +1 -0
  215. package/dist/eval/expr/sequences.d.ts +26 -0
  216. package/dist/eval/expr/sequences.d.ts.map +1 -0
  217. package/dist/eval/expr/sequences.js +151 -0
  218. package/dist/eval/expr/sequences.js.map +1 -0
  219. package/dist/eval/expr/value.d.ts +99 -0
  220. package/dist/eval/expr/value.d.ts.map +1 -0
  221. package/dist/eval/expr/value.js +14 -0
  222. package/dist/eval/expr/value.js.map +1 -0
  223. package/dist/eval/expression.d.ts +142 -0
  224. package/dist/eval/expression.d.ts.map +1 -0
  225. package/dist/eval/expression.js +446 -0
  226. package/dist/eval/expression.js.map +1 -0
  227. package/dist/eval/firing.d.ts +68 -0
  228. package/dist/eval/firing.d.ts.map +1 -0
  229. package/dist/eval/firing.js +222 -0
  230. package/dist/eval/firing.js.map +1 -0
  231. package/dist/eval/gate.d.ts +110 -0
  232. package/dist/eval/gate.d.ts.map +1 -0
  233. package/dist/eval/gate.js +278 -0
  234. package/dist/eval/gate.js.map +1 -0
  235. package/dist/eval/layout-visibility.d.ts +18 -0
  236. package/dist/eval/layout-visibility.d.ts.map +1 -0
  237. package/dist/eval/layout-visibility.js +61 -0
  238. package/dist/eval/layout-visibility.js.map +1 -0
  239. package/dist/eval/option-availability.d.ts +26 -0
  240. package/dist/eval/option-availability.d.ts.map +1 -0
  241. package/dist/eval/option-availability.js +580 -0
  242. package/dist/eval/option-availability.js.map +1 -0
  243. package/dist/eval/options-boundary.d.ts +15 -0
  244. package/dist/eval/options-boundary.d.ts.map +1 -0
  245. package/dist/eval/options-boundary.js +40 -0
  246. package/dist/eval/options-boundary.js.map +1 -0
  247. package/dist/eval/options.d.ts +99 -0
  248. package/dist/eval/options.d.ts.map +1 -0
  249. package/dist/eval/options.js +96 -0
  250. package/dist/eval/options.js.map +1 -0
  251. package/dist/eval/overrides.d.ts +116 -0
  252. package/dist/eval/overrides.d.ts.map +1 -0
  253. package/dist/eval/overrides.js +176 -0
  254. package/dist/eval/overrides.js.map +1 -0
  255. package/dist/eval/paths.d.ts +25 -0
  256. package/dist/eval/paths.d.ts.map +1 -0
  257. package/dist/eval/paths.js +47 -0
  258. package/dist/eval/paths.js.map +1 -0
  259. package/dist/eval/presentation-reads.d.ts +20 -0
  260. package/dist/eval/presentation-reads.d.ts.map +1 -0
  261. package/dist/eval/presentation-reads.js +2 -0
  262. package/dist/eval/presentation-reads.js.map +1 -0
  263. package/dist/eval/presentation.d.ts +122 -0
  264. package/dist/eval/presentation.d.ts.map +1 -0
  265. package/dist/eval/presentation.js +255 -0
  266. package/dist/eval/presentation.js.map +1 -0
  267. package/dist/eval/reader/context-value.d.ts +41 -0
  268. package/dist/eval/reader/context-value.d.ts.map +1 -0
  269. package/dist/eval/reader/context-value.js +129 -0
  270. package/dist/eval/reader/context-value.js.map +1 -0
  271. package/dist/eval/reader/covered.d.ts +53 -0
  272. package/dist/eval/reader/covered.d.ts.map +1 -0
  273. package/dist/eval/reader/covered.js +139 -0
  274. package/dist/eval/reader/covered.js.map +1 -0
  275. package/dist/eval/reader/declarations.d.ts +182 -0
  276. package/dist/eval/reader/declarations.d.ts.map +1 -0
  277. package/dist/eval/reader/declarations.js +153 -0
  278. package/dist/eval/reader/declarations.js.map +1 -0
  279. package/dist/eval/reader/member-access.d.ts +87 -0
  280. package/dist/eval/reader/member-access.d.ts.map +1 -0
  281. package/dist/eval/reader/member-access.js +212 -0
  282. package/dist/eval/reader/member-access.js.map +1 -0
  283. package/dist/eval/reader/memo.d.ts +34 -0
  284. package/dist/eval/reader/memo.d.ts.map +1 -0
  285. package/dist/eval/reader/memo.js +67 -0
  286. package/dist/eval/reader/memo.js.map +1 -0
  287. package/dist/eval/reader/overlay.d.ts +74 -0
  288. package/dist/eval/reader/overlay.d.ts.map +1 -0
  289. package/dist/eval/reader/overlay.js +365 -0
  290. package/dist/eval/reader/overlay.js.map +1 -0
  291. package/dist/eval/reader/questions.d.ts +37 -0
  292. package/dist/eval/reader/questions.d.ts.map +1 -0
  293. package/dist/eval/reader/questions.js +78 -0
  294. package/dist/eval/reader/questions.js.map +1 -0
  295. package/dist/eval/reader/resolve.d.ts +84 -0
  296. package/dist/eval/reader/resolve.d.ts.map +1 -0
  297. package/dist/eval/reader/resolve.js +310 -0
  298. package/dist/eval/reader/resolve.js.map +1 -0
  299. package/dist/eval/reader/value-read.d.ts +50 -0
  300. package/dist/eval/reader/value-read.d.ts.map +1 -0
  301. package/dist/eval/reader/value-read.js +133 -0
  302. package/dist/eval/reader/value-read.js.map +1 -0
  303. package/dist/eval/reader/withheld.d.ts +48 -0
  304. package/dist/eval/reader/withheld.d.ts.map +1 -0
  305. package/dist/eval/reader/withheld.js +108 -0
  306. package/dist/eval/reader/withheld.js.map +1 -0
  307. package/dist/eval/reader-paths.d.ts +24 -0
  308. package/dist/eval/reader-paths.d.ts.map +1 -0
  309. package/dist/eval/reader-paths.js +23 -0
  310. package/dist/eval/reader-paths.js.map +1 -0
  311. package/dist/eval/reader.d.ts +281 -0
  312. package/dist/eval/reader.d.ts.map +1 -0
  313. package/dist/eval/reader.js +560 -0
  314. package/dist/eval/reader.js.map +1 -0
  315. package/dist/eval/receipt.d.ts +37 -0
  316. package/dist/eval/receipt.d.ts.map +1 -0
  317. package/dist/eval/receipt.js +222 -0
  318. package/dist/eval/receipt.js.map +1 -0
  319. package/dist/eval/report/assemble.d.ts +84 -0
  320. package/dist/eval/report/assemble.d.ts.map +1 -0
  321. package/dist/eval/report/assemble.js +277 -0
  322. package/dist/eval/report/assemble.js.map +1 -0
  323. package/dist/eval/report/fold.d.ts +18 -0
  324. package/dist/eval/report/fold.d.ts.map +1 -0
  325. package/dist/eval/report/fold.js +58 -0
  326. package/dist/eval/report/fold.js.map +1 -0
  327. package/dist/eval/rule/alternatives.d.ts +23 -0
  328. package/dist/eval/rule/alternatives.d.ts.map +1 -0
  329. package/dist/eval/rule/alternatives.js +46 -0
  330. package/dist/eval/rule/alternatives.js.map +1 -0
  331. package/dist/eval/rule/behaviour.d.ts +47 -0
  332. package/dist/eval/rule/behaviour.d.ts.map +1 -0
  333. package/dist/eval/rule/behaviour.js +249 -0
  334. package/dist/eval/rule/behaviour.js.map +1 -0
  335. package/dist/eval/rule/compute.d.ts +46 -0
  336. package/dist/eval/rule/compute.d.ts.map +1 -0
  337. package/dist/eval/rule/compute.js +158 -0
  338. package/dist/eval/rule/compute.js.map +1 -0
  339. package/dist/eval/rule/create-state.d.ts +42 -0
  340. package/dist/eval/rule/create-state.d.ts.map +1 -0
  341. package/dist/eval/rule/create-state.js +134 -0
  342. package/dist/eval/rule/create-state.js.map +1 -0
  343. package/dist/eval/rule/diagnostics.d.ts +24 -0
  344. package/dist/eval/rule/diagnostics.d.ts.map +1 -0
  345. package/dist/eval/rule/diagnostics.js +45 -0
  346. package/dist/eval/rule/diagnostics.js.map +1 -0
  347. package/dist/eval/rule/execution.d.ts +24 -0
  348. package/dist/eval/rule/execution.d.ts.map +1 -0
  349. package/dist/eval/rule/execution.js +495 -0
  350. package/dist/eval/rule/execution.js.map +1 -0
  351. package/dist/eval/rule/gate.d.ts +12 -0
  352. package/dist/eval/rule/gate.d.ts.map +1 -0
  353. package/dist/eval/rule/gate.js +34 -0
  354. package/dist/eval/rule/gate.js.map +1 -0
  355. package/dist/eval/rule/item.d.ts +11 -0
  356. package/dist/eval/rule/item.d.ts.map +1 -0
  357. package/dist/eval/rule/item.js +265 -0
  358. package/dist/eval/rule/item.js.map +1 -0
  359. package/dist/eval/rule/prepare.d.ts +64 -0
  360. package/dist/eval/rule/prepare.d.ts.map +1 -0
  361. package/dist/eval/rule/prepare.js +131 -0
  362. package/dist/eval/rule/prepare.js.map +1 -0
  363. package/dist/eval/rule/result.d.ts +97 -0
  364. package/dist/eval/rule/result.d.ts.map +1 -0
  365. package/dist/eval/rule/result.js +347 -0
  366. package/dist/eval/rule/result.js.map +1 -0
  367. package/dist/eval/rule/runner.d.ts +128 -0
  368. package/dist/eval/rule/runner.d.ts.map +1 -0
  369. package/dist/eval/rule/runner.js +296 -0
  370. package/dist/eval/rule/runner.js.map +1 -0
  371. package/dist/eval/rule/screen.d.ts +32 -0
  372. package/dist/eval/rule/screen.d.ts.map +1 -0
  373. package/dist/eval/rule/screen.js +73 -0
  374. package/dist/eval/rule/screen.js.map +1 -0
  375. package/dist/eval/rule/state.d.ts +137 -0
  376. package/dist/eval/rule/state.d.ts.map +1 -0
  377. package/dist/eval/rule/state.js +2 -0
  378. package/dist/eval/rule/state.js.map +1 -0
  379. package/dist/eval/rule/steps.d.ts +44 -0
  380. package/dist/eval/rule/steps.d.ts.map +1 -0
  381. package/dist/eval/rule/steps.js +367 -0
  382. package/dist/eval/rule/steps.js.map +1 -0
  383. package/dist/eval/rule/visibility.d.ts +18 -0
  384. package/dist/eval/rule/visibility.d.ts.map +1 -0
  385. package/dist/eval/rule/visibility.js +79 -0
  386. package/dist/eval/rule/visibility.js.map +1 -0
  387. package/dist/eval/seal.d.ts +74 -0
  388. package/dist/eval/seal.d.ts.map +1 -0
  389. package/dist/eval/seal.js +154 -0
  390. package/dist/eval/seal.js.map +1 -0
  391. package/dist/eval/signature-coverage.d.ts +19 -0
  392. package/dist/eval/signature-coverage.d.ts.map +1 -0
  393. package/dist/eval/signature-coverage.js +160 -0
  394. package/dist/eval/signature-coverage.js.map +1 -0
  395. package/dist/eval/state/derive.d.ts +72 -0
  396. package/dist/eval/state/derive.d.ts.map +1 -0
  397. package/dist/eval/state/derive.js +61 -0
  398. package/dist/eval/state/derive.js.map +1 -0
  399. package/dist/eval/state/describe.d.ts +18 -0
  400. package/dist/eval/state/describe.d.ts.map +1 -0
  401. package/dist/eval/state/describe.js +19 -0
  402. package/dist/eval/state/describe.js.map +1 -0
  403. package/dist/eval/state/field-state.d.ts +471 -0
  404. package/dist/eval/state/field-state.d.ts.map +1 -0
  405. package/dist/eval/state/field-state.js +1604 -0
  406. package/dist/eval/state/field-state.js.map +1 -0
  407. package/dist/eval/state/measurement.d.ts +136 -0
  408. package/dist/eval/state/measurement.d.ts.map +1 -0
  409. package/dist/eval/state/measurement.js +209 -0
  410. package/dist/eval/state/measurement.js.map +1 -0
  411. package/dist/eval/state/options.d.ts +21 -0
  412. package/dist/eval/state/options.d.ts.map +1 -0
  413. package/dist/eval/state/options.js +3 -0
  414. package/dist/eval/state/options.js.map +1 -0
  415. package/dist/eval/state/readiness.d.ts +400 -0
  416. package/dist/eval/state/readiness.d.ts.map +1 -0
  417. package/dist/eval/state/readiness.js +1067 -0
  418. package/dist/eval/state/readiness.js.map +1 -0
  419. package/dist/eval/state/snapshot.d.ts +130 -0
  420. package/dist/eval/state/snapshot.d.ts.map +1 -0
  421. package/dist/eval/state/snapshot.js +35 -0
  422. package/dist/eval/state/snapshot.js.map +1 -0
  423. package/dist/eval/state/unavailable-options.d.ts +54 -0
  424. package/dist/eval/state/unavailable-options.d.ts.map +1 -0
  425. package/dist/eval/state/unavailable-options.js +82 -0
  426. package/dist/eval/state/unavailable-options.js.map +1 -0
  427. package/dist/eval/state/value-state.d.ts +38 -0
  428. package/dist/eval/state/value-state.d.ts.map +1 -0
  429. package/dist/eval/state/value-state.js +52 -0
  430. package/dist/eval/state/value-state.js.map +1 -0
  431. package/dist/eval/submission/admission.d.ts +50 -0
  432. package/dist/eval/submission/admission.d.ts.map +1 -0
  433. package/dist/eval/submission/admission.js +174 -0
  434. package/dist/eval/submission/admission.js.map +1 -0
  435. package/dist/eval/submission/authority.d.ts +71 -0
  436. package/dist/eval/submission/authority.d.ts.map +1 -0
  437. package/dist/eval/submission/authority.js +118 -0
  438. package/dist/eval/submission/authority.js.map +1 -0
  439. package/dist/eval/submission/datasets.d.ts +28 -0
  440. package/dist/eval/submission/datasets.d.ts.map +1 -0
  441. package/dist/eval/submission/datasets.js +109 -0
  442. package/dist/eval/submission/datasets.js.map +1 -0
  443. package/dist/eval/submission/index.d.ts +15 -0
  444. package/dist/eval/submission/index.d.ts.map +1 -0
  445. package/dist/eval/submission/index.js +13 -0
  446. package/dist/eval/submission/index.js.map +1 -0
  447. package/dist/eval/submission/refusals.d.ts +103 -0
  448. package/dist/eval/submission/refusals.d.ts.map +1 -0
  449. package/dist/eval/submission/refusals.js +15 -0
  450. package/dist/eval/submission/refusals.js.map +1 -0
  451. package/dist/eval/submission/signatures.d.ts +7 -0
  452. package/dist/eval/submission/signatures.d.ts.map +1 -0
  453. package/dist/eval/submission/signatures.js +215 -0
  454. package/dist/eval/submission/signatures.js.map +1 -0
  455. package/dist/eval/submission/writes.d.ts +51 -0
  456. package/dist/eval/submission/writes.d.ts.map +1 -0
  457. package/dist/eval/submission/writes.js +203 -0
  458. package/dist/eval/submission/writes.js.map +1 -0
  459. package/dist/eval/submission.d.ts +53 -0
  460. package/dist/eval/submission.d.ts.map +1 -0
  461. package/dist/eval/submission.js +521 -0
  462. package/dist/eval/submission.js.map +1 -0
  463. package/dist/eval/suggestions-to-engine.d.ts +18 -0
  464. package/dist/eval/suggestions-to-engine.d.ts.map +1 -0
  465. package/dist/eval/suggestions-to-engine.js +40 -0
  466. package/dist/eval/suggestions-to-engine.js.map +1 -0
  467. package/dist/eval/suggestions.d.ts +17 -0
  468. package/dist/eval/suggestions.d.ts.map +1 -0
  469. package/dist/eval/suggestions.js +314 -0
  470. package/dist/eval/suggestions.js.map +1 -0
  471. package/dist/eval/undecided.d.ts +64 -0
  472. package/dist/eval/undecided.d.ts.map +1 -0
  473. package/dist/eval/undecided.js +101 -0
  474. package/dist/eval/undecided.js.map +1 -0
  475. package/dist/eval/verdict.d.ts +66 -0
  476. package/dist/eval/verdict.d.ts.map +1 -0
  477. package/dist/eval/verdict.js +106 -0
  478. package/dist/eval/verdict.js.map +1 -0
  479. package/dist/eval/verify-signature.d.ts +78 -0
  480. package/dist/eval/verify-signature.d.ts.map +1 -0
  481. package/dist/eval/verify-signature.js +185 -0
  482. package/dist/eval/verify-signature.js.map +1 -0
  483. package/dist/eval/version-dispatch.d.ts +38 -0
  484. package/dist/eval/version-dispatch.d.ts.map +1 -0
  485. package/dist/eval/version-dispatch.js +61 -0
  486. package/dist/eval/version-dispatch.js.map +1 -0
  487. package/dist/eval/visibility.d.ts +33 -0
  488. package/dist/eval/visibility.d.ts.map +1 -0
  489. package/dist/eval/visibility.js +83 -0
  490. package/dist/eval/visibility.js.map +1 -0
  491. package/dist/evaluate.d.ts +24 -0
  492. package/dist/evaluate.d.ts.map +1 -0
  493. package/dist/evaluate.js +18 -0
  494. package/dist/evaluate.js.map +1 -0
  495. package/dist/expr/builtin-docs.d.ts +51 -0
  496. package/dist/expr/builtin-docs.d.ts.map +1 -0
  497. package/dist/expr/builtin-docs.js +874 -0
  498. package/dist/expr/builtin-docs.js.map +1 -0
  499. package/dist/expr/builtins.d.ts +50 -0
  500. package/dist/expr/builtins.d.ts.map +1 -0
  501. package/dist/expr/builtins.js +966 -0
  502. package/dist/expr/builtins.js.map +1 -0
  503. package/dist/expr/decimal-precision.d.ts +39 -0
  504. package/dist/expr/decimal-precision.d.ts.map +1 -0
  505. package/dist/expr/decimal-precision.js +62 -0
  506. package/dist/expr/decimal-precision.js.map +1 -0
  507. package/dist/expr/decimal.d.ts +172 -0
  508. package/dist/expr/decimal.d.ts.map +1 -0
  509. package/dist/expr/decimal.js +782 -0
  510. package/dist/expr/decimal.js.map +1 -0
  511. package/dist/expr/deprecations.d.ts +34 -0
  512. package/dist/expr/deprecations.d.ts.map +1 -0
  513. package/dist/expr/deprecations.js +17 -0
  514. package/dist/expr/deprecations.js.map +1 -0
  515. package/dist/expr/diagnostics.d.ts +21 -0
  516. package/dist/expr/diagnostics.d.ts.map +1 -0
  517. package/dist/expr/diagnostics.js +231 -0
  518. package/dist/expr/diagnostics.js.map +1 -0
  519. package/dist/expr/direction.d.ts +30 -0
  520. package/dist/expr/direction.d.ts.map +1 -0
  521. package/dist/expr/direction.js +77 -0
  522. package/dist/expr/direction.js.map +1 -0
  523. package/dist/expr/example-expression.d.ts +62 -0
  524. package/dist/expr/example-expression.d.ts.map +1 -0
  525. package/dist/expr/example-expression.js +670 -0
  526. package/dist/expr/example-expression.js.map +1 -0
  527. package/dist/expr/instant.d.ts +49 -0
  528. package/dist/expr/instant.d.ts.map +1 -0
  529. package/dist/expr/instant.js +111 -0
  530. package/dist/expr/instant.js.map +1 -0
  531. package/dist/expr/logic.d.ts +17 -0
  532. package/dist/expr/logic.d.ts.map +1 -0
  533. package/dist/expr/logic.js +65 -0
  534. package/dist/expr/logic.js.map +1 -0
  535. package/dist/expr/messages.d.ts +45 -0
  536. package/dist/expr/messages.d.ts.map +1 -0
  537. package/dist/expr/messages.js +280 -0
  538. package/dist/expr/messages.js.map +1 -0
  539. package/dist/expr/money.d.ts +38 -0
  540. package/dist/expr/money.d.ts.map +1 -0
  541. package/dist/expr/money.js +127 -0
  542. package/dist/expr/money.js.map +1 -0
  543. package/dist/expr/ordering.d.ts +56 -0
  544. package/dist/expr/ordering.d.ts.map +1 -0
  545. package/dist/expr/ordering.js +167 -0
  546. package/dist/expr/ordering.js.map +1 -0
  547. package/dist/expr/pattern.d.ts +44 -0
  548. package/dist/expr/pattern.d.ts.map +1 -0
  549. package/dist/expr/pattern.js +458 -0
  550. package/dist/expr/pattern.js.map +1 -0
  551. package/dist/expr/plain-date.d.ts +90 -0
  552. package/dist/expr/plain-date.d.ts.map +1 -0
  553. package/dist/expr/plain-date.js +230 -0
  554. package/dist/expr/plain-date.js.map +1 -0
  555. package/dist/expr/plural-categories.d.ts +8 -0
  556. package/dist/expr/plural-categories.d.ts.map +1 -0
  557. package/dist/expr/plural-categories.js +15 -0
  558. package/dist/expr/plural-categories.js.map +1 -0
  559. package/dist/expr/plural-keys.d.ts +39 -0
  560. package/dist/expr/plural-keys.d.ts.map +1 -0
  561. package/dist/expr/plural-keys.js +46 -0
  562. package/dist/expr/plural-keys.js.map +1 -0
  563. package/dist/expr/plural.d.ts +33 -0
  564. package/dist/expr/plural.d.ts.map +1 -0
  565. package/dist/expr/plural.js +50 -0
  566. package/dist/expr/plural.js.map +1 -0
  567. package/dist/expr/quantity.d.ts +31 -0
  568. package/dist/expr/quantity.d.ts.map +1 -0
  569. package/dist/expr/quantity.js +83 -0
  570. package/dist/expr/quantity.js.map +1 -0
  571. package/dist/expr/reduce.d.ts +50 -0
  572. package/dist/expr/reduce.d.ts.map +1 -0
  573. package/dist/expr/reduce.js +236 -0
  574. package/dist/expr/reduce.js.map +1 -0
  575. package/dist/expr/regex.d.ts +108 -0
  576. package/dist/expr/regex.d.ts.map +1 -0
  577. package/dist/expr/regex.js +1207 -0
  578. package/dist/expr/regex.js.map +1 -0
  579. package/dist/expr/select-locale.d.ts +67 -0
  580. package/dist/expr/select-locale.d.ts.map +1 -0
  581. package/dist/expr/select-locale.js +219 -0
  582. package/dist/expr/select-locale.js.map +1 -0
  583. package/dist/expr/sequences.d.ts +123 -0
  584. package/dist/expr/sequences.d.ts.map +1 -0
  585. package/dist/expr/sequences.js +234 -0
  586. package/dist/expr/sequences.js.map +1 -0
  587. package/dist/expr/strings.d.ts +50 -0
  588. package/dist/expr/strings.d.ts.map +1 -0
  589. package/dist/expr/strings.js +184 -0
  590. package/dist/expr/strings.js.map +1 -0
  591. package/dist/expr/validation.d.ts +32 -0
  592. package/dist/expr/validation.d.ts.map +1 -0
  593. package/dist/expr/validation.js +182 -0
  594. package/dist/expr/validation.js.map +1 -0
  595. package/dist/graph/freeze.d.ts +4 -0
  596. package/dist/graph/freeze.d.ts.map +1 -0
  597. package/dist/graph/freeze.js +52 -0
  598. package/dist/graph/freeze.js.map +1 -0
  599. package/dist/graph/index.d.ts +15 -0
  600. package/dist/graph/index.d.ts.map +1 -0
  601. package/dist/graph/index.js +13 -0
  602. package/dist/graph/index.js.map +1 -0
  603. package/dist/graph/inspect.d.ts +76 -0
  604. package/dist/graph/inspect.d.ts.map +1 -0
  605. package/dist/graph/inspect.js +263 -0
  606. package/dist/graph/inspect.js.map +1 -0
  607. package/dist/graph/read-walk.d.ts +101 -0
  608. package/dist/graph/read-walk.d.ts.map +1 -0
  609. package/dist/graph/read-walk.js +358 -0
  610. package/dist/graph/read-walk.js.map +1 -0
  611. package/dist/graph/record-index.d.ts +24 -0
  612. package/dist/graph/record-index.d.ts.map +1 -0
  613. package/dist/graph/record-index.js +35 -0
  614. package/dist/graph/record-index.js.map +1 -0
  615. package/dist/index.d.ts +104 -0
  616. package/dist/index.d.ts.map +1 -0
  617. package/dist/index.js +139 -0
  618. package/dist/index.js.map +1 -0
  619. package/dist/lookup/digest.d.ts +51 -0
  620. package/dist/lookup/digest.d.ts.map +1 -0
  621. package/dist/lookup/digest.js +46 -0
  622. package/dist/lookup/digest.js.map +1 -0
  623. package/dist/lookup/index.d.ts +28 -0
  624. package/dist/lookup/index.d.ts.map +1 -0
  625. package/dist/lookup/index.js +27 -0
  626. package/dist/lookup/index.js.map +1 -0
  627. package/dist/lookup/install.d.ts +48 -0
  628. package/dist/lookup/install.d.ts.map +1 -0
  629. package/dist/lookup/install.js +315 -0
  630. package/dist/lookup/install.js.map +1 -0
  631. package/dist/lookup/pass.d.ts +55 -0
  632. package/dist/lookup/pass.d.ts.map +1 -0
  633. package/dist/lookup/pass.js +212 -0
  634. package/dist/lookup/pass.js.map +1 -0
  635. package/dist/lookup/pins.d.ts +34 -0
  636. package/dist/lookup/pins.d.ts.map +1 -0
  637. package/dist/lookup/pins.js +39 -0
  638. package/dist/lookup/pins.js.map +1 -0
  639. package/dist/lookup/provenance.d.ts +23 -0
  640. package/dist/lookup/provenance.d.ts.map +1 -0
  641. package/dist/lookup/provenance.js +78 -0
  642. package/dist/lookup/provenance.js.map +1 -0
  643. package/dist/lookup/readiness.d.ts +13 -0
  644. package/dist/lookup/readiness.d.ts.map +1 -0
  645. package/dist/lookup/readiness.js +57 -0
  646. package/dist/lookup/readiness.js.map +1 -0
  647. package/dist/lookup/resolve.d.ts +24 -0
  648. package/dist/lookup/resolve.d.ts.map +1 -0
  649. package/dist/lookup/resolve.js +201 -0
  650. package/dist/lookup/resolve.js.map +1 -0
  651. package/dist/lookup/store.d.ts +41 -0
  652. package/dist/lookup/store.d.ts.map +1 -0
  653. package/dist/lookup/store.js +74 -0
  654. package/dist/lookup/store.js.map +1 -0
  655. package/dist/model/access.d.ts +200 -0
  656. package/dist/model/access.d.ts.map +1 -0
  657. package/dist/model/access.js +125 -0
  658. package/dist/model/access.js.map +1 -0
  659. package/dist/model/artifact-members.d.ts +3 -0
  660. package/dist/model/artifact-members.d.ts.map +1 -0
  661. package/dist/model/artifact-members.js +38 -0
  662. package/dist/model/artifact-members.js.map +1 -0
  663. package/dist/model/composition.d.ts +47 -0
  664. package/dist/model/composition.d.ts.map +1 -0
  665. package/dist/model/composition.js +66 -0
  666. package/dist/model/composition.js.map +1 -0
  667. package/dist/model/domain.d.ts +51 -0
  668. package/dist/model/domain.d.ts.map +1 -0
  669. package/dist/model/domain.js +75 -0
  670. package/dist/model/domain.js.map +1 -0
  671. package/dist/model/duration.d.ts +31 -0
  672. package/dist/model/duration.d.ts.map +1 -0
  673. package/dist/model/duration.js +136 -0
  674. package/dist/model/duration.js.map +1 -0
  675. package/dist/model/errors.d.ts +58 -0
  676. package/dist/model/errors.d.ts.map +1 -0
  677. package/dist/model/errors.js +81 -0
  678. package/dist/model/errors.js.map +1 -0
  679. package/dist/model/evolution.d.ts +177 -0
  680. package/dist/model/evolution.d.ts.map +1 -0
  681. package/dist/model/evolution.js +5 -0
  682. package/dist/model/evolution.js.map +1 -0
  683. package/dist/model/expr-children.d.ts +15 -0
  684. package/dist/model/expr-children.d.ts.map +1 -0
  685. package/dist/model/expr-children.js +45 -0
  686. package/dist/model/expr-children.js.map +1 -0
  687. package/dist/model/guards.d.ts +9 -0
  688. package/dist/model/guards.d.ts.map +1 -0
  689. package/dist/model/guards.js +11 -0
  690. package/dist/model/guards.js.map +1 -0
  691. package/dist/model/input.d.ts +42 -0
  692. package/dist/model/input.d.ts.map +1 -0
  693. package/dist/model/input.js +26 -0
  694. package/dist/model/input.js.map +1 -0
  695. package/dist/model/integer.d.ts +14 -0
  696. package/dist/model/integer.d.ts.map +1 -0
  697. package/dist/model/integer.js +16 -0
  698. package/dist/model/integer.js.map +1 -0
  699. package/dist/model/intrinsic.d.ts +18 -0
  700. package/dist/model/intrinsic.d.ts.map +1 -0
  701. package/dist/model/intrinsic.js +21 -0
  702. package/dist/model/intrinsic.js.map +1 -0
  703. package/dist/model/layout.d.ts +129 -0
  704. package/dist/model/layout.d.ts.map +1 -0
  705. package/dist/model/layout.js +2 -0
  706. package/dist/model/layout.js.map +1 -0
  707. package/dist/model/media.d.ts +33 -0
  708. package/dist/model/media.d.ts.map +1 -0
  709. package/dist/model/media.js +86 -0
  710. package/dist/model/media.js.map +1 -0
  711. package/dist/model/members.generated.d.ts +11 -0
  712. package/dist/model/members.generated.d.ts.map +1 -0
  713. package/dist/model/members.generated.js +71 -0
  714. package/dist/model/members.generated.js.map +1 -0
  715. package/dist/model/row-address.d.ts +27 -0
  716. package/dist/model/row-address.d.ts.map +1 -0
  717. package/dist/model/row-address.js +146 -0
  718. package/dist/model/row-address.js.map +1 -0
  719. package/dist/model/schema.d.ts +108 -0
  720. package/dist/model/schema.d.ts.map +1 -0
  721. package/dist/model/schema.js +2 -0
  722. package/dist/model/schema.js.map +1 -0
  723. package/dist/model/shape.d.ts +193 -0
  724. package/dist/model/shape.d.ts.map +1 -0
  725. package/dist/model/shape.js +2 -0
  726. package/dist/model/shape.js.map +1 -0
  727. package/dist/model/time.d.ts +61 -0
  728. package/dist/model/time.d.ts.map +1 -0
  729. package/dist/model/time.js +110 -0
  730. package/dist/model/time.js.map +1 -0
  731. package/dist/model/types.d.ts +1329 -0
  732. package/dist/model/types.d.ts.map +1 -0
  733. package/dist/model/types.js +424 -0
  734. package/dist/model/types.js.map +1 -0
  735. package/dist/model/values.d.ts +91 -0
  736. package/dist/model/values.d.ts.map +1 -0
  737. package/dist/model/values.js +195 -0
  738. package/dist/model/values.js.map +1 -0
  739. package/dist/model/wire.d.ts +356 -0
  740. package/dist/model/wire.d.ts.map +1 -0
  741. package/dist/model/wire.js +1504 -0
  742. package/dist/model/wire.js.map +1 -0
  743. package/dist/offline/index.d.ts +374 -0
  744. package/dist/offline/index.d.ts.map +1 -0
  745. package/dist/offline/index.js +422 -0
  746. package/dist/offline/index.js.map +1 -0
  747. package/dist/testing.d.ts +30 -0
  748. package/dist/testing.d.ts.map +1 -0
  749. package/dist/testing.js +42 -0
  750. package/dist/testing.js.map +1 -0
  751. package/dist/version.d.ts +30 -0
  752. package/dist/version.d.ts.map +1 -0
  753. package/dist/version.js +116 -0
  754. package/dist/version.js.map +1 -0
  755. package/package.json +98 -3
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The session's listener registry, `[ENGINE-5.1.1]`–`[ENGINE-5.1.3]`.
3
+ *
4
+ * A listener is registered against one binding key — the `fieldId` alone, or the `fieldId`
5
+ * with the row's wire-typed key — and released by the function `subscribe` returns. Release is
6
+ * idempotent, and an empty set is dropped with its key so a form that mounts and unmounts
7
+ * controls keeps no dead entry. The registry only delivers: it decides nothing about what
8
+ * changed, so the pass and the registry cannot disagree.
9
+ */
10
+ export class EngineSubscriptions {
11
+ bindings = new Map();
12
+ form = new Set();
13
+ reportListenerError;
14
+ /**
15
+ * `reportListenerError` is the host's channel for a failing listener. Without one the
16
+ * failure is not swallowed: the other listeners are still delivered to, and then the first
17
+ * failure is thrown, because a form that silently stopped updating is worse than an
18
+ * exception the host can see.
19
+ */
20
+ constructor(reportListenerError) {
21
+ this.reportListenerError = reportListenerError;
22
+ }
23
+ /** Registers `listener` for one binding key; the returned release is idempotent. */
24
+ subscribe(bindingKey, listener) {
25
+ const registered = this.bindings.get(bindingKey) ?? new Set();
26
+ this.bindings.set(bindingKey, registered);
27
+ registered.add(listener);
28
+ return () => {
29
+ const current = this.bindings.get(bindingKey);
30
+ if (current === undefined)
31
+ return;
32
+ current.delete(listener);
33
+ if (current.size === 0)
34
+ this.bindings.delete(bindingKey);
35
+ };
36
+ }
37
+ /** Registers a listener for the form channel; the returned release is idempotent. */
38
+ subscribeForm(listener) {
39
+ this.form.add(listener);
40
+ return () => {
41
+ this.form.delete(listener);
42
+ };
43
+ }
44
+ /** Whether any binding listener exists, so eviction need not index an unsubscribed form. */
45
+ hasBindings() {
46
+ return this.bindings.size > 0;
47
+ }
48
+ /** How many listeners one binding currently has, so a leak is counted rather than assumed. */
49
+ count(bindingKey) {
50
+ return this.bindings.get(bindingKey)?.size ?? 0;
51
+ }
52
+ /**
53
+ * Releases every listener of the keys a predicate selects, `[ENGINE-5.1.2]`.
54
+ *
55
+ * A subscription whose field became unreadable is evicted, not muted: its count becomes
56
+ * zero, so a host that counts subscriptions sees the revocation rather than a silent gap.
57
+ */
58
+ evict(shouldEvict) {
59
+ const evicted = [];
60
+ for (const key of [...this.bindings.keys()]) {
61
+ if (!shouldEvict(key))
62
+ continue;
63
+ evicted.push(key);
64
+ this.bindings.delete(key);
65
+ }
66
+ return evicted;
67
+ }
68
+ /**
69
+ * Notifies the selected bindings and the form channel.
70
+ *
71
+ * Every listener is collected before any runs, because a listener may release itself, or a
72
+ * sibling's subscription, while being notified. A listener that throws never stops the
73
+ * remaining delivery, so one host bug cannot mute the rest of the form: with an error channel
74
+ * every failure is reported to it, and without one the first failure is thrown after delivery,
75
+ * because a commit that silently stopped updating a control is worse than a visible error.
76
+ */
77
+ notify(bindingKeys, formChanged) {
78
+ const pending = [];
79
+ for (const key of bindingKeys) {
80
+ for (const listener of this.bindings.get(key) ?? [])
81
+ pending.push({ bindingKey: key, listener });
82
+ }
83
+ if (formChanged) {
84
+ for (const listener of this.form)
85
+ pending.push({ bindingKey: '$form', listener });
86
+ }
87
+ let firstFailure;
88
+ for (const entry of pending) {
89
+ try {
90
+ entry.listener();
91
+ }
92
+ catch (error) {
93
+ if (this.reportListenerError === undefined)
94
+ firstFailure ??= { error };
95
+ else
96
+ this.reportListenerError(error, entry.bindingKey);
97
+ }
98
+ }
99
+ if (firstFailure !== undefined)
100
+ throw firstFailure.error;
101
+ }
102
+ }
103
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/eval/engine/subscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IACb,QAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;IAC9C,IAAI,GAAG,IAAI,GAAG,EAAc,CAAC;IAC7B,mBAAmB,CAA6D;IAEjG;;;;;OAKG;IACH,YAAY,mBAAkE;QAC5E,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,CAAC;IAED,oFAAoF;IACpF,SAAS,CAAC,UAAkB,EAAE,QAAoB;QAChD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,GAAG,EAAc,CAAC;QAC1E,IAAI,CAAC,QAAQ,CAAC,GA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AC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,WAA8B,EAAE,WAAoB;QACzD,MAAM,OAAO,GAAqE,EAAE,CAAC;QACrF,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE;gBACjD,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YAChB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,IAAI;gBAAE,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,IAAI,YAAqD,CAAC;QAC1D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC;gBACH,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,IAAI,CAAC,mBAAmB,KAAK,SAAS;oBAAE,YAAY,KAAK,EAAE,KAAK,EAAE,CAAC;;oBAClE,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QACD,IAAI,YAAY,KAAK,SAAS;YAAE,MAAM,YAAY,CAAC,KAAK,CAAC;IAC3D,CAAC;CACF","sourcesContent":["/**\n * The session's listener registry, `[ENGINE-5.1.1]`–`[ENGINE-5.1.3]`.\n *\n * A listener is registered against one binding key — the `fieldId` alone, or the `fieldId`\n * with the row's wire-typed key — and released by the function `subscribe` returns. Release is\n * idempotent, and an empty set is dropped with its key so a form that mounts and unmounts\n * controls keeps no dead entry. The registry only delivers: it decides nothing about what\n * changed, so the pass and the registry cannot disagree.\n */\nexport class EngineSubscriptions {\n private readonly bindings = new Map<string, Set<() => void>>();\n private readonly form = new Set<() => void>();\n private readonly reportListenerError: ((error: unknown, bindingKey: string) => void) | undefined;\n\n /**\n * `reportListenerError` is the host's channel for a failing listener. Without one the\n * failure is not swallowed: the other listeners are still delivered to, and then the first\n * failure is thrown, because a form that silently stopped updating is worse than an\n * exception the host can see.\n */\n constructor(reportListenerError?: (error: unknown, bindingKey: string) => void) {\n this.reportListenerError = reportListenerError;\n }\n\n /** Registers `listener` for one binding key; the returned release is idempotent. */\n subscribe(bindingKey: string, listener: () => void): () => void {\n const registered = this.bindings.get(bindingKey) ?? new Set<() => void>();\n this.bindings.set(bindingKey, registered);\n registered.add(listener);\n return (): void => {\n const current = this.bindings.get(bindingKey);\n if (current === undefined) return;\n current.delete(listener);\n if (current.size === 0) this.bindings.delete(bindingKey);\n };\n }\n\n /** Registers a listener for the form channel; the returned release is idempotent. */\n subscribeForm(listener: () => void): () => void {\n this.form.add(listener);\n return (): void => {\n this.form.delete(listener);\n };\n }\n\n /** Whether any binding listener exists, so eviction need not index an unsubscribed form. */\n hasBindings(): boolean {\n return this.bindings.size > 0;\n }\n\n /** How many listeners one binding currently has, so a leak is counted rather than assumed. */\n count(bindingKey: string): number {\n return this.bindings.get(bindingKey)?.size ?? 0;\n }\n\n /**\n * Releases every listener of the keys a predicate selects, `[ENGINE-5.1.2]`.\n *\n * A subscription whose field became unreadable is evicted, not muted: its count becomes\n * zero, so a host that counts subscriptions sees the revocation rather than a silent gap.\n */\n evict(shouldEvict: (bindingKey: string) => boolean): readonly string[] {\n const evicted: string[] = [];\n for (const key of [...this.bindings.keys()]) {\n if (!shouldEvict(key)) continue;\n evicted.push(key);\n this.bindings.delete(key);\n }\n return evicted;\n }\n\n /**\n * Notifies the selected bindings and the form channel.\n *\n * Every listener is collected before any runs, because a listener may release itself, or a\n * sibling's subscription, while being notified. A listener that throws never stops the\n * remaining delivery, so one host bug cannot mute the rest of the form: with an error channel\n * every failure is reported to it, and without one the first failure is thrown after delivery,\n * because a commit that silently stopped updating a control is worse than a visible error.\n */\n notify(bindingKeys: readonly string[], formChanged: boolean): void {\n const pending: { readonly bindingKey: string; readonly listener: () => void }[] = [];\n for (const key of bindingKeys) {\n for (const listener of this.bindings.get(key) ?? [])\n pending.push({ bindingKey: key, listener });\n }\n if (formChanged) {\n for (const listener of this.form) pending.push({ bindingKey: '$form', listener });\n }\n let firstFailure: { readonly error: unknown } | undefined;\n for (const entry of pending) {\n try {\n entry.listener();\n } catch (error) {\n if (this.reportListenerError === undefined) firstFailure ??= { error };\n else this.reportListenerError(error, entry.bindingKey);\n }\n }\n if (firstFailure !== undefined) throw firstFailure.error;\n }\n}\n"]}
@@ -0,0 +1,77 @@
1
+ import type { RuleDependency } from '../../graph/index.js';
2
+ import type { CompiledSchema } from '../../model/schema.js';
3
+ import type { Diagnostic, EvaluationReport, FieldRef, LookupProvenance } from '../../model/types.js';
4
+ import type { RuleExplanation } from '../report/assemble.js';
5
+ import type { RuleContribution } from '../report/assemble.js';
6
+ import type { SessionRefusal } from './ops.js';
7
+ import type { FormFieldState } from '../state/field-state.js';
8
+ import type { EngineGraph } from './deps.js';
9
+ import type { EnginePatch } from './patches.js';
10
+ /**
11
+ * The counted facts one committed pass records, `[ENGINE-7.1.1]`.
12
+ *
13
+ * Counts are the contract: no duration or clock reading is normative. This is the seam that
14
+ * makes "only the closure was evaluated" falsifiable — a private counter would let a pass claim
15
+ * isolation it did not have.
16
+ */
17
+ export interface LastPass {
18
+ /** How many times each rule was evaluated in this pass, keyed by rule id. */
19
+ readonly ruleEvaluations: Readonly<Record<string, number>>;
20
+ /** The record fields the evaluated rules considered, in first-read order. */
21
+ readonly consideredReads: readonly FieldRef[];
22
+ /** The declared context roots the evaluated rules can read, in code-point order. */
23
+ readonly consideredContextReads: readonly string[];
24
+ readonly patches: readonly EnginePatch[];
25
+ /** The binding keys whose derived facts changed in this pass. */
26
+ readonly notified: readonly string[];
27
+ /** The queued operations this pass refused or dropped before commit. */
28
+ readonly dropped: readonly SessionRefusal[];
29
+ readonly accessVersion: number;
30
+ }
31
+ /** The trace of a session that has not run a pass yet. */
32
+ export declare const EMPTY_PASS: LastPass;
33
+ /** The audit trail behind one binding's result, `[ENGINE-7.1.3]`. */
34
+ export interface EngineFieldExplanation {
35
+ readonly fieldId: string;
36
+ readonly bindingKey: string;
37
+ readonly reportHash: string;
38
+ readonly behaviorHash: string;
39
+ /** The rules that decide the field, with the reads and lookups each resolved. */
40
+ readonly rules: readonly RuleExplanation[];
41
+ /** Every field those rules read, which is what a change to this field can reach. */
42
+ readonly reads: readonly FieldRef[];
43
+ readonly contextReads: readonly string[];
44
+ readonly dependsOnRules: readonly string[];
45
+ readonly lookups: readonly LookupProvenance[];
46
+ readonly diagnostics: readonly Diagnostic[];
47
+ /** The observable facts behind the binding, reported without a value it may not read. */
48
+ readonly witness: {
49
+ readonly visible: boolean;
50
+ readonly enabled: boolean;
51
+ readonly required: boolean;
52
+ readonly fillable: boolean;
53
+ readonly access: FormFieldState['access'];
54
+ };
55
+ }
56
+ /** The audit trail of one binding, folded from the contributions the session retained. */
57
+ export declare function explainFieldOf(graph: EngineGraph, contributions: ReadonlyMap<string, RuleContribution>, report: EvaluationReport, field: FormFieldState, rowKey: string | number | undefined): EngineFieldExplanation;
58
+ /** The closure one field's change reaches, `[ENGINE-7.1.3]`. */
59
+ export interface EngineFieldDeps {
60
+ readonly fieldId: string;
61
+ /** The rules a change to this field re-evaluates, transitively. */
62
+ readonly rules: readonly string[];
63
+ readonly reads: readonly FieldRef[];
64
+ readonly contextReads: readonly string[];
65
+ readonly dependsOnRules: readonly string[];
66
+ /** The artifact's derived rule dependencies for the rules in this closure. */
67
+ readonly ruleDeps: readonly RuleDependency[];
68
+ }
69
+ /**
70
+ * The derived closure one field's change reaches, `[ENGINE-3.1.4]`, `[ENGINE-7.1.3]`.
71
+ *
72
+ * The answer is the pass's own closure, so a caller tracing a field sees exactly the rules the
73
+ * next commit would evaluate — context reads, `rule_ok` targets and folded rule kinds
74
+ * included — rather than a second graph that could drift from it.
75
+ */
76
+ export declare function inspectFieldDepsOf(compiled: CompiledSchema, graph: EngineGraph, fieldId: string): EngineFieldDeps;
77
+ //# sourceMappingURL=trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/eval/engine/trace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC9C,oFAAoF;IACpF,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,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K,EAAE,cAAc,EACrB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAClC,sBAAsB,CAiExB;AAED,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,GACd,eAAe,CA+BjB"}
@@ -0,0 +1,140 @@
1
+ import { compareCodePoints } from '../../expr/strings.js';
2
+ import { inspectDeps } from '../../graph/index.js';
3
+ import { fieldKey } from '../access/projection.js';
4
+ import { freezeTree } from '../seal.js';
5
+ import { closureOf, NO_CHANGES } from './deps.js';
6
+ import { rowStateOf } from './snapshot.js';
7
+ /** The trace of a session that has not run a pass yet. */
8
+ export const EMPTY_PASS = freezeTree({
9
+ ruleEvaluations: {},
10
+ consideredReads: [],
11
+ consideredContextReads: [],
12
+ patches: [],
13
+ notified: [],
14
+ dropped: [],
15
+ accessVersion: 0,
16
+ });
17
+ /** The rules that read or decide one field, in `ruleId` order. */
18
+ function rulesFor(graph, fieldId) {
19
+ const ids = new Set();
20
+ for (const rule of graph.readers.get(fieldId) ?? [])
21
+ ids.add(rule.ruleId);
22
+ for (const rule of graph.deciders.get(fieldId) ?? [])
23
+ ids.add(rule.ruleId);
24
+ for (const rule of graph.writers.get(fieldId) ?? [])
25
+ ids.add(rule.ruleId);
26
+ return [...ids].sort(compareCodePoints);
27
+ }
28
+ /** The audit trail of one binding, folded from the contributions the session retained. */
29
+ export function explainFieldOf(graph, contributions, report, field, rowKey) {
30
+ const ids = rulesFor(graph, field.fieldId);
31
+ const rules = [];
32
+ for (const ruleId of ids) {
33
+ const contribution = contributions.get(ruleId);
34
+ const deps = graph.depsById.get(ruleId);
35
+ if (contribution === undefined || deps === undefined)
36
+ continue;
37
+ const results = contribution.evaluation.results;
38
+ const [first] = results;
39
+ if (first === undefined)
40
+ continue;
41
+ rules.push({
42
+ ruleId,
43
+ ruleHash: first.ruleHash,
44
+ kind: first.kind,
45
+ scope: first.scope,
46
+ // A row-scoped rule has one status per row; the binding this explanation is about asks
47
+ // about one of them, so that row's answer is the rule's answer here. When no result
48
+ // names the requested row the rule did not decide it — an unaddressable row, or a row
49
+ // removed since the contribution was cached — so the answer is `UNKNOWN`, never the
50
+ // first row's status borrowed for a row it never spoke about.
51
+ status: rowKey === undefined
52
+ ? first.status
53
+ : (results.find((result) => result.rowKey === rowKey)?.status ?? 'UNKNOWN'),
54
+ ...(rowKey === undefined ? {} : { rowKey }),
55
+ reads: deps.watchedFields.map((fieldId) => ({ fieldId })),
56
+ dependsOnRules: deps.dependency.dependsOnRules,
57
+ lookups: contribution.lookups,
58
+ diagnostics: contribution.diagnostics,
59
+ });
60
+ }
61
+ const reads = new Map();
62
+ const contextReads = new Set();
63
+ const dependsOnRules = new Set();
64
+ for (const ruleId of ids) {
65
+ const deps = graph.depsById.get(ruleId);
66
+ if (deps === undefined)
67
+ continue;
68
+ for (const fieldId of deps.watchedFields)
69
+ reads.set(fieldId, { fieldId });
70
+ for (const root of deps.watchedContextRoots)
71
+ contextReads.add(root);
72
+ for (const target of deps.ruleOkTargets)
73
+ dependsOnRules.add(target);
74
+ }
75
+ const row = rowKey === undefined ? undefined : rowStateOf(field, rowKey);
76
+ return {
77
+ fieldId: field.fieldId,
78
+ bindingKey: fieldKey(rowKey === undefined ? { fieldId: field.fieldId } : { fieldId: field.fieldId, rowKey }),
79
+ reportHash: report.reportHash,
80
+ behaviorHash: report.behaviorHash,
81
+ rules,
82
+ reads: [...reads.values()].sort((left, right) => compareCodePoints(left.fieldId, right.fieldId)),
83
+ contextReads: [...contextReads].sort(compareCodePoints),
84
+ dependsOnRules: [...dependsOnRules].sort(compareCodePoints),
85
+ lookups: rules.flatMap((rule) => rule.lookups),
86
+ diagnostics: rules.flatMap((rule) => rule.diagnostics),
87
+ witness: {
88
+ visible: field.visible,
89
+ enabled: row?.enabled ?? field.enabled,
90
+ required: row?.required ?? field.required,
91
+ fillable: row?.fillable ?? field.fillable,
92
+ access: row?.access ?? field.access,
93
+ },
94
+ };
95
+ }
96
+ /**
97
+ * The derived closure one field's change reaches, `[ENGINE-3.1.4]`, `[ENGINE-7.1.3]`.
98
+ *
99
+ * The answer is the pass's own closure, so a caller tracing a field sees exactly the rules the
100
+ * next commit would evaluate — context reads, `rule_ok` targets and folded rule kinds
101
+ * included — rather than a second graph that could drift from it.
102
+ */
103
+ export function inspectFieldDepsOf(compiled, graph, fieldId) {
104
+ const closure = closureOf(graph, {
105
+ ...NO_CHANGES,
106
+ fields: new Set([fieldId]),
107
+ });
108
+ const ids = [...closure].sort(compareCodePoints);
109
+ const reads = new Set();
110
+ const contextReads = new Set();
111
+ const dependsOnRules = new Set();
112
+ const ruleDeps = [];
113
+ const inspection = inspectDeps(compiled);
114
+ const byId = inspection.ok
115
+ ? new Map(inspection.report.rules.map((entry) => [entry.ruleId, entry]))
116
+ : undefined;
117
+ for (const ruleId of ids) {
118
+ const deps = graph.depsById.get(ruleId);
119
+ if (deps === undefined)
120
+ continue;
121
+ for (const fieldId of deps.watchedFields)
122
+ reads.add(fieldId);
123
+ for (const root of deps.watchedContextRoots)
124
+ contextReads.add(root);
125
+ for (const target of deps.ruleOkTargets)
126
+ dependsOnRules.add(target);
127
+ const dependency = byId?.get(ruleId);
128
+ if (dependency !== undefined)
129
+ ruleDeps.push(dependency);
130
+ }
131
+ return {
132
+ fieldId,
133
+ rules: ids,
134
+ reads: [...reads].map((id) => ({ fieldId: id })),
135
+ contextReads: [...contextReads].sort(compareCodePoints),
136
+ dependsOnRules: [...dependsOnRules].sort(compareCodePoints),
137
+ ruleDeps,
138
+ };
139
+ }
140
+ //# sourceMappingURL=trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/eval/engine/trace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAanD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAwB3C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAa,UAAU,CAAC;IAC7C,eAAe,EAAE,EAAE;IACnB,eAAe,EAAE,EAAE;IACnB,sBAAsB,EAAE,EAAE;IAC1B,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,CAAC;CACjB,CAAC,CAAC;AA0BH,kEAAkE;AAClE,SAAS,QAAQ,CAAC,KAAkB,EAAE,OAAe;IACnD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE;QAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1E,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE;QAAE,GAAG,CAAC,GAAG,CAAC,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;QACpE,MAAM,UAAU,GAAG,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,UAAU,KAAK,SAAS;YAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO;QACL,OAAO;QACP,KAAK,EAAE,GAAG;QACV,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAChD,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;QACvD,cAAc,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;QAC3D,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["import { compareCodePoints } from '../../expr/strings.js';\nimport { inspectDeps } from '../../graph/index.js';\nimport type { RuleDependency } from '../../graph/index.js';\nimport type { CompiledSchema } from '../../model/schema.js';\nimport type {\n Diagnostic,\n EvaluationReport,\n FieldRef,\n LookupProvenance,\n} from '../../model/types.js';\nimport type { RuleExplanation } from '../report/assemble.js';\nimport type { RuleContribution } from '../report/assemble.js';\nimport type { SessionRefusal } from './ops.js';\nimport type { FormFieldState } from '../state/field-state.js';\nimport { fieldKey } from '../access/projection.js';\nimport { freezeTree } from '../seal.js';\nimport { closureOf, NO_CHANGES } from './deps.js';\nimport type { EngineGraph } from './deps.js';\nimport type { EnginePatch } from './patches.js';\nimport { rowStateOf } from './snapshot.js';\n\n/**\n * The counted facts one committed pass records, `[ENGINE-7.1.1]`.\n *\n * Counts are the contract: no duration or clock reading is normative. This is the seam that\n * makes \"only the closure was evaluated\" falsifiable — a private counter would let a pass claim\n * isolation it did not have.\n */\nexport interface LastPass {\n /** How many times each rule was evaluated in this pass, keyed by rule id. */\n readonly ruleEvaluations: Readonly<Record<string, number>>;\n /** The record fields the evaluated rules considered, in first-read order. */\n readonly consideredReads: readonly FieldRef[];\n /** The declared context roots the evaluated rules can read, in code-point order. */\n readonly consideredContextReads: readonly string[];\n readonly patches: readonly EnginePatch[];\n /** The binding keys whose derived facts changed in this pass. */\n readonly notified: readonly string[];\n /** The queued operations this pass refused or dropped before commit. */\n readonly dropped: readonly SessionRefusal[];\n readonly accessVersion: number;\n}\n\n/** The trace of a session that has not run a pass yet. */\nexport const EMPTY_PASS: LastPass = freezeTree({\n ruleEvaluations: {},\n consideredReads: [],\n consideredContextReads: [],\n patches: [],\n notified: [],\n dropped: [],\n accessVersion: 0,\n});\n\n/** The audit trail behind one binding's result, `[ENGINE-7.1.3]`. */\nexport interface EngineFieldExplanation {\n readonly fieldId: string;\n readonly bindingKey: string;\n readonly reportHash: string;\n readonly behaviorHash: string;\n /** The rules that decide the field, with the reads and lookups each resolved. */\n readonly rules: readonly RuleExplanation[];\n /** Every field those rules read, which is what a change to this field can reach. */\n readonly reads: readonly FieldRef[];\n readonly contextReads: readonly string[];\n readonly dependsOnRules: readonly string[];\n readonly lookups: readonly LookupProvenance[];\n readonly diagnostics: readonly Diagnostic[];\n /** The observable facts behind the binding, reported without a value it may not read. */\n readonly witness: {\n readonly visible: boolean;\n readonly enabled: boolean;\n readonly required: boolean;\n readonly fillable: boolean;\n readonly access: FormFieldState['access'];\n };\n}\n\n/** The rules that read or decide one field, in `ruleId` order. */\nfunction rulesFor(graph: EngineGraph, fieldId: string): readonly string[] {\n const ids = new Set<string>();\n for (const rule of graph.readers.get(fieldId) ?? []) ids.add(rule.ruleId);\n for (const rule of graph.deciders.get(fieldId) ?? []) ids.add(rule.ruleId);\n for (const rule of graph.writers.get(fieldId) ?? []) ids.add(rule.ruleId);\n return [...ids].sort(compareCodePoints);\n}\n\n/** The audit trail of one binding, folded from the contributions the session retained. */\nexport function explainFieldOf(\n graph: EngineGraph,\n contributions: ReadonlyMap<string, RuleContribution>,\n report: EvaluationReport,\n field: FormFieldState,\n rowKey: string | number | undefined,\n): EngineFieldExplanation {\n const ids = rulesFor(graph, field.fieldId);\n const rules: RuleExplanation[] = [];\n for (const ruleId of ids) {\n const contribution = contributions.get(ruleId);\n const deps = graph.depsById.get(ruleId);\n if (contribution === undefined || deps === undefined) continue;\n const results = contribution.evaluation.results;\n const [first] = results;\n if (first === undefined) continue;\n rules.push({\n ruleId,\n ruleHash: first.ruleHash,\n kind: first.kind,\n scope: first.scope,\n // A row-scoped rule has one status per row; the binding this explanation is about asks\n // about one of them, so that row's answer is the rule's answer here. When no result\n // names the requested row the rule did not decide it — an unaddressable row, or a row\n // removed since the contribution was cached — so the answer is `UNKNOWN`, never the\n // first row's status borrowed for a row it never spoke about.\n status:\n rowKey === undefined\n ? first.status\n : (results.find((result) => result.rowKey === rowKey)?.status ?? 'UNKNOWN'),\n ...(rowKey === undefined ? {} : { rowKey }),\n reads: deps.watchedFields.map((fieldId) => ({ fieldId })),\n dependsOnRules: deps.dependency.dependsOnRules,\n lookups: contribution.lookups,\n diagnostics: contribution.diagnostics,\n });\n }\n const reads = new Map<string, FieldRef>();\n const contextReads = new Set<string>();\n const dependsOnRules = new Set<string>();\n for (const ruleId of ids) {\n const deps = graph.depsById.get(ruleId);\n if (deps === undefined) continue;\n for (const fieldId of deps.watchedFields) reads.set(fieldId, { fieldId });\n for (const root of deps.watchedContextRoots) contextReads.add(root);\n for (const target of deps.ruleOkTargets) dependsOnRules.add(target);\n }\n const row = rowKey === undefined ? undefined : rowStateOf(field, rowKey);\n return {\n fieldId: field.fieldId,\n bindingKey: fieldKey(\n rowKey === undefined ? { fieldId: field.fieldId } : { fieldId: field.fieldId, rowKey },\n ),\n reportHash: report.reportHash,\n behaviorHash: report.behaviorHash,\n rules,\n reads: [...reads.values()].sort((left, right) =>\n compareCodePoints(left.fieldId, right.fieldId),\n ),\n contextReads: [...contextReads].sort(compareCodePoints),\n dependsOnRules: [...dependsOnRules].sort(compareCodePoints),\n lookups: rules.flatMap((rule) => rule.lookups),\n diagnostics: rules.flatMap((rule) => rule.diagnostics),\n witness: {\n visible: field.visible,\n enabled: row?.enabled ?? field.enabled,\n required: row?.required ?? field.required,\n fillable: row?.fillable ?? field.fillable,\n access: row?.access ?? field.access,\n },\n };\n}\n\n/** The closure one field's change reaches, `[ENGINE-7.1.3]`. */\nexport interface EngineFieldDeps {\n readonly fieldId: string;\n /** The rules a change to this field re-evaluates, transitively. */\n readonly rules: readonly string[];\n readonly reads: readonly FieldRef[];\n readonly contextReads: readonly string[];\n readonly dependsOnRules: readonly string[];\n /** The artifact's derived rule dependencies for the rules in this closure. */\n readonly ruleDeps: readonly RuleDependency[];\n}\n\n/**\n * The derived closure one field's change reaches, `[ENGINE-3.1.4]`, `[ENGINE-7.1.3]`.\n *\n * The answer is the pass's own closure, so a caller tracing a field sees exactly the rules the\n * next commit would evaluate — context reads, `rule_ok` targets and folded rule kinds\n * included — rather than a second graph that could drift from it.\n */\nexport function inspectFieldDepsOf(\n compiled: CompiledSchema,\n graph: EngineGraph,\n fieldId: string,\n): EngineFieldDeps {\n const closure = closureOf(graph, {\n ...NO_CHANGES,\n fields: new Set([fieldId]),\n });\n const ids = [...closure].sort(compareCodePoints);\n const reads = new Set<string>();\n const contextReads = new Set<string>();\n const dependsOnRules = new Set<string>();\n const ruleDeps: RuleDependency[] = [];\n const inspection = inspectDeps(compiled);\n const byId = inspection.ok\n ? new Map(inspection.report.rules.map((entry) => [entry.ruleId, entry] as const))\n : undefined;\n for (const ruleId of ids) {\n const deps = graph.depsById.get(ruleId);\n if (deps === undefined) continue;\n for (const fieldId of deps.watchedFields) reads.add(fieldId);\n for (const root of deps.watchedContextRoots) contextReads.add(root);\n for (const target of deps.ruleOkTargets) dependsOnRules.add(target);\n const dependency = byId?.get(ruleId);\n if (dependency !== undefined) ruleDeps.push(dependency);\n }\n return {\n fieldId,\n rules: ids,\n reads: [...reads].map((id) => ({ fieldId: id })),\n contextReads: [...contextReads].sort(compareCodePoints),\n dependsOnRules: [...dependsOnRules].sort(compareCodePoints),\n ruleDeps,\n };\n}\n"]}
@@ -0,0 +1,26 @@
1
+ import type { Diagnostic } from '../model/types.js';
2
+ import type { AxiomError } from '../model/errors.js';
3
+ /** What one engine refusal was doing when it raised. */
4
+ export interface EngineErrorContext {
5
+ readonly ruleId?: string | undefined;
6
+ readonly itemId?: string | undefined;
7
+ readonly rowKey?: string | number | undefined;
8
+ /**
9
+ * The operation that raised: the rule kind (`validate`, `compute`, …) or `expression` for a
10
+ * guard door. It is never the submitted value, so it is safe in the sealed report.
11
+ */
12
+ readonly operation?: string | undefined;
13
+ }
14
+ /**
15
+ * The diagnostic one raised error stands for, as the one builder both the rule runner and the
16
+ * expression door use.
17
+ *
18
+ * The code is the error's own when it names a runtime diagnostic — flattening every refusal to
19
+ * `ENGINE_ERROR` would lose the difference between a table this device does not hold and an
20
+ * operation it could not complete — and `ENGINE_ERROR` otherwise. `params.detail` is the
21
+ * value-free cause (`AxiomError.detail`), so a report says *why* a rule could not decide instead
22
+ * of only that it could not. A budget refusal keeps its limit, dimension and operation, and adds
23
+ * the same cause.
24
+ */
25
+ export declare function diagnosticOfEngineError(error: AxiomError, context?: EngineErrorContext): Diagnostic;
26
+ //# sourceMappingURL=error-diagnostic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-diagnostic.d.ts","sourceRoot":"","sources":["../../src/eval/error-diagnostic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,UAAU,EACjB,OAAO,GAAE,kBAAuB,GAC/B,UAAU,CA8CZ"}
@@ -0,0 +1,63 @@
1
+ import { diagnosticDoc } from '../expr/diagnostics.js';
2
+ import { isRuntimeDiagnosticCode } from '../model/types.js';
3
+ import { LateBoundTypeMismatch } from '../model/errors.js';
4
+ import { budgetRefusalParams } from './budget.js';
5
+ /**
6
+ * The diagnostic one raised error stands for, as the one builder both the rule runner and the
7
+ * expression door use.
8
+ *
9
+ * The code is the error's own when it names a runtime diagnostic — flattening every refusal to
10
+ * `ENGINE_ERROR` would lose the difference between a table this device does not hold and an
11
+ * operation it could not complete — and `ENGINE_ERROR` otherwise. `params.detail` is the
12
+ * value-free cause (`AxiomError.detail`), so a report says *why* a rule could not decide instead
13
+ * of only that it could not. A budget refusal keeps its limit, dimension and operation, and adds
14
+ * the same cause.
15
+ */
16
+ export function diagnosticOfEngineError(error, context = {}) {
17
+ const addressed = {
18
+ ...(context.ruleId === undefined ? {} : { ruleId: context.ruleId }),
19
+ ...(context.itemId === undefined ? {} : { itemId: context.itemId }),
20
+ ...(context.rowKey === undefined ? {} : { rowKey: context.rowKey }),
21
+ };
22
+ const budget = budgetRefusalParams(error);
23
+ if (budget !== undefined) {
24
+ const doc = diagnosticDoc('COST_BUDGET_EXCEEDED');
25
+ return {
26
+ code: 'COST_BUDGET_EXCEEDED',
27
+ severity: doc.severity,
28
+ messageKey: doc.messageKey,
29
+ ...addressed,
30
+ params: { ...budget, detail: error.detail },
31
+ };
32
+ }
33
+ const code = isRuntimeDiagnosticCode(error.code) ? error.code : 'ENGINE_ERROR';
34
+ const doc = diagnosticDoc(code);
35
+ if (error instanceof LateBoundTypeMismatch) {
36
+ return {
37
+ code,
38
+ severity: doc.severity,
39
+ messageKey: doc.messageKey,
40
+ ...addressed,
41
+ params: {
42
+ ...(error.path === '' ? {} : { path: error.path }),
43
+ declaredDomain: error.declaredDomain,
44
+ receivedDomain: error.receivedDomain,
45
+ origin: error.origin,
46
+ detail: error.detail,
47
+ ...(context.operation === undefined ? {} : { operation: context.operation }),
48
+ },
49
+ };
50
+ }
51
+ return {
52
+ code,
53
+ severity: doc.severity,
54
+ messageKey: doc.messageKey,
55
+ ...addressed,
56
+ params: {
57
+ ...(error.path === '' ? {} : { path: error.path }),
58
+ detail: error.detail,
59
+ ...(context.operation === undefined ? {} : { operation: context.operation }),
60
+ },
61
+ };
62
+ }
63
+ //# sourceMappingURL=error-diagnostic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-diagnostic.js","sourceRoot":"","sources":["../../src/eval/error-diagnostic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAclD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAiB,EACjB,OAAO,GAAuB,EAAE;IAEhC,MAAM,SAAS,GAAG;QAChB,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QACnE,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QACnE,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;KACpE,CAAC;IAC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QACJ,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,GAAG,SAAS;QACZ,MAAM,EAAE;YACN,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;YAClD,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,GAAG,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;SAC7E;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { diagnosticDoc } from '../expr/diagnostics.js';\nimport { isRuntimeDiagnosticCode } from '../model/types.js';\nimport type { Diagnostic, DiagnosticCode } from '../model/types.js';\nimport { LateBoundTypeMismatch } from '../model/errors.js';\nimport type { AxiomError } from '../model/errors.js';\nimport { budgetRefusalParams } from './budget.js';\n\n/** What one engine refusal was doing when it raised. */\nexport interface EngineErrorContext {\n readonly ruleId?: string | undefined;\n readonly itemId?: string | undefined;\n readonly rowKey?: string | number | undefined;\n /**\n * The operation that raised: the rule kind (`validate`, `compute`, …) or `expression` for a\n * guard door. It is never the submitted value, so it is safe in the sealed report.\n */\n readonly operation?: string | undefined;\n}\n\n/**\n * The diagnostic one raised error stands for, as the one builder both the rule runner and the\n * expression door use.\n *\n * The code is the error's own when it names a runtime diagnostic — flattening every refusal to\n * `ENGINE_ERROR` would lose the difference between a table this device does not hold and an\n * operation it could not complete — and `ENGINE_ERROR` otherwise. `params.detail` is the\n * value-free cause (`AxiomError.detail`), so a report says *why* a rule could not decide instead\n * of only that it could not. A budget refusal keeps its limit, dimension and operation, and adds\n * the same cause.\n */\nexport function diagnosticOfEngineError(\n error: AxiomError,\n context: EngineErrorContext = {},\n): Diagnostic {\n const addressed = {\n ...(context.ruleId === undefined ? {} : { ruleId: context.ruleId }),\n ...(context.itemId === undefined ? {} : { itemId: context.itemId }),\n ...(context.rowKey === undefined ? {} : { rowKey: context.rowKey }),\n };\n const budget = budgetRefusalParams(error);\n if (budget !== undefined) {\n const doc = diagnosticDoc('COST_BUDGET_EXCEEDED');\n return {\n code: 'COST_BUDGET_EXCEEDED',\n severity: doc.severity,\n messageKey: doc.messageKey,\n ...addressed,\n params: { ...budget, detail: error.detail },\n };\n }\n const code: DiagnosticCode = isRuntimeDiagnosticCode(error.code) ? error.code : 'ENGINE_ERROR';\n const doc = diagnosticDoc(code);\n if (error instanceof LateBoundTypeMismatch) {\n return {\n code,\n severity: doc.severity,\n messageKey: doc.messageKey,\n ...addressed,\n params: {\n ...(error.path === '' ? {} : { path: error.path }),\n declaredDomain: error.declaredDomain,\n receivedDomain: error.receivedDomain,\n origin: error.origin,\n detail: error.detail,\n ...(context.operation === undefined ? {} : { operation: context.operation }),\n },\n };\n }\n return {\n code,\n severity: doc.severity,\n messageKey: doc.messageKey,\n ...addressed,\n params: {\n ...(error.path === '' ? {} : { path: error.path }),\n detail: error.detail,\n ...(context.operation === undefined ? {} : { operation: context.operation }),\n },\n };\n}\n"]}
@@ -0,0 +1,44 @@
1
+ import type { RuntimeValue } from '../expr/builtins.js';
2
+ import type { CompiledExpression, Diagnostic, Outcome } from '../model/types.js';
3
+ import type { EvaluationEnv, EvaluationInput } from '../model/access.js';
4
+ /**
5
+ * A standalone expression evaluation.
6
+ *
7
+ * The result is a tagged union rather than a value with a flag: a guard reads the
8
+ * `outcome` member, a caller that compiled a scalar expression reads `value`, and a
9
+ * refusal is its own variant carrying the diagnostic, so no caller can mistake a failed
10
+ * evaluation for a decided one.
11
+ */
12
+ export type ExprEvaluation = {
13
+ readonly kind: 'outcome';
14
+ readonly outcome: Outcome;
15
+ readonly value: RuntimeValue;
16
+ readonly diagnostics: readonly Diagnostic[];
17
+ } | {
18
+ readonly kind: 'value';
19
+ readonly value: RuntimeValue;
20
+ readonly diagnostics: readonly Diagnostic[];
21
+ } | {
22
+ /**
23
+ * The expression could not be decided: a construct that raised an
24
+ * engine error decides nothing, so the guard outcome is `UNKNOWN` and the diagnostic
25
+ * carries the cause instead of a plausible value. `diagnostics` keeps the trail the
26
+ * expression recorded before it raised, the cause last: a guard that resolved a stale
27
+ * table and then failed still says the table was missing.
28
+ */
29
+ readonly kind: 'failed';
30
+ readonly outcome: 'UNKNOWN';
31
+ readonly diagnostic: Diagnostic;
32
+ readonly diagnostics: readonly Diagnostic[];
33
+ };
34
+ /**
35
+ * Evaluates a compiled expression against `record ⊕ context` and the environment's
36
+ * capability flags, `spec/semantics/context-v1.md`. It is a pure function of
37
+ * its arguments: no clock, locale, randomness or mutable global is read, and the input is
38
+ * never mutated.
39
+ *
40
+ * An absent top-level value is `UNKNOWN`, the same lifting gives a missing
41
+ * reading; a boolean value carries the guard `outcome` its type promises.
42
+ */
43
+ export declare function evaluateExpr(compiled: CompiledExpression, input: EvaluationInput, env?: EvaluationEnv): ExprEvaluation;
44
+ //# sourceMappingURL=evaluate-expr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate-expr.d.ts","sourceRoot":"","sources":["../../src/eval/evaluate-expr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,OAAO,KAAK,EACV,kBAAkB,EAElB,UAAU,EAEV,OAAO,EACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAiDzE;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GACtB;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C,GACD;IACE;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C,CAAC;AAQN;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,eAAe,EACtB,GAAG,GAAE,aAAkB,GACtB,cAAc,CA+GhB"}