@pibbl/core 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 (1069) hide show
  1. package/LICENSE.txt +19 -0
  2. package/README.md +76 -0
  3. package/THIRD_PARTY_NOTICES.txt +205 -0
  4. package/dist/features/particles/index.d.ts +7 -0
  5. package/dist/features/particles/index.js +26 -0
  6. package/dist/features/particles/index.js.map +7 -0
  7. package/dist/features/particles/index.mjs +1 -0
  8. package/dist/features/particles/lib/canvas/birth-ledger.d.ts +69 -0
  9. package/dist/features/particles/lib/canvas/birth-ledger.js +752 -0
  10. package/dist/features/particles/lib/canvas/birth-ledger.js.map +7 -0
  11. package/dist/features/particles/lib/canvas/component.d.ts +14 -0
  12. package/dist/features/particles/lib/canvas/component.js +249 -0
  13. package/dist/features/particles/lib/canvas/component.js.map +7 -0
  14. package/dist/features/particles/lib/canvas/executor.d.ts +31 -0
  15. package/dist/features/particles/lib/canvas/executor.js +537 -0
  16. package/dist/features/particles/lib/canvas/executor.js.map +7 -0
  17. package/dist/features/particles/lib/canvas/primitive.d.ts +14 -0
  18. package/dist/features/particles/lib/canvas/primitive.js +50 -0
  19. package/dist/features/particles/lib/canvas/primitive.js.map +7 -0
  20. package/dist/features/particles/lib/canvas/raster-cache.d.ts +13 -0
  21. package/dist/features/particles/lib/canvas/raster-cache.js +106 -0
  22. package/dist/features/particles/lib/canvas/raster-cache.js.map +7 -0
  23. package/dist/features/particles/lib/color.d.ts +7 -0
  24. package/dist/features/particles/lib/color.js +159 -0
  25. package/dist/features/particles/lib/color.js.map +7 -0
  26. package/dist/features/particles/lib/compiler.d.ts +134 -0
  27. package/dist/features/particles/lib/compiler.js +443 -0
  28. package/dist/features/particles/lib/compiler.js.map +7 -0
  29. package/dist/features/particles/lib/curve.d.ts +19 -0
  30. package/dist/features/particles/lib/curve.js +129 -0
  31. package/dist/features/particles/lib/curve.js.map +7 -0
  32. package/dist/features/particles/lib/definition-records.d.ts +58 -0
  33. package/dist/features/particles/lib/definition-records.js +500 -0
  34. package/dist/features/particles/lib/definition-records.js.map +7 -0
  35. package/dist/features/particles/lib/definition.d.ts +18 -0
  36. package/dist/features/particles/lib/definition.js +602 -0
  37. package/dist/features/particles/lib/definition.js.map +7 -0
  38. package/dist/features/particles/lib/emission.d.ts +54 -0
  39. package/dist/features/particles/lib/emission.js +184 -0
  40. package/dist/features/particles/lib/emission.js.map +7 -0
  41. package/dist/features/particles/lib/flow/field.d.ts +81 -0
  42. package/dist/features/particles/lib/flow/field.js +585 -0
  43. package/dist/features/particles/lib/flow/field.js.map +7 -0
  44. package/dist/features/particles/lib/flow/hook.d.ts +158 -0
  45. package/dist/features/particles/lib/flow/hook.js +215 -0
  46. package/dist/features/particles/lib/flow/hook.js.map +7 -0
  47. package/dist/features/particles/lib/flow/population.d.ts +25 -0
  48. package/dist/features/particles/lib/flow/population.js +104 -0
  49. package/dist/features/particles/lib/flow/population.js.map +7 -0
  50. package/dist/features/particles/lib/particle.d.ts +113 -0
  51. package/dist/features/particles/lib/particle.js +192 -0
  52. package/dist/features/particles/lib/particle.js.map +7 -0
  53. package/dist/features/particles/lib/random.d.ts +16 -0
  54. package/dist/features/particles/lib/random.js +61 -0
  55. package/dist/features/particles/lib/random.js.map +7 -0
  56. package/dist/features/particles/lib/sample.d.ts +32 -0
  57. package/dist/features/particles/lib/sample.js +397 -0
  58. package/dist/features/particles/lib/sample.js.map +7 -0
  59. package/dist/features/particles/lib/signal-inputs.d.ts +6 -0
  60. package/dist/features/particles/lib/signal-inputs.js +41 -0
  61. package/dist/features/particles/lib/signal-inputs.js.map +7 -0
  62. package/dist/features/particles/lib/system/binding.d.ts +59 -0
  63. package/dist/features/particles/lib/system/binding.js +122 -0
  64. package/dist/features/particles/lib/system/binding.js.map +7 -0
  65. package/dist/features/particles/lib/system/controller.d.ts +58 -0
  66. package/dist/features/particles/lib/system/controller.js +1446 -0
  67. package/dist/features/particles/lib/system/controller.js.map +7 -0
  68. package/dist/features/particles/lib/system/hook.d.ts +13 -0
  69. package/dist/features/particles/lib/system/hook.js +52 -0
  70. package/dist/features/particles/lib/system/hook.js.map +7 -0
  71. package/dist/features/particles/lib/system/ownership.d.ts +26 -0
  72. package/dist/features/particles/lib/system/ownership.js +128 -0
  73. package/dist/features/particles/lib/system/ownership.js.map +7 -0
  74. package/dist/features/particles/lib/types.d.ts +983 -0
  75. package/dist/features/physics/2d-geometry.d.ts +216 -0
  76. package/dist/features/physics/2d-geometry.js +59 -0
  77. package/dist/features/physics/2d-geometry.js.map +7 -0
  78. package/dist/features/physics/2d-geometry.mjs +1 -0
  79. package/dist/features/physics/2d-testing.d.ts +80 -0
  80. package/dist/features/physics/2d-testing.js +141 -0
  81. package/dist/features/physics/2d-testing.js.map +7 -0
  82. package/dist/features/physics/2d-testing.mjs +1 -0
  83. package/dist/features/physics/2d.d.ts +165 -0
  84. package/dist/features/physics/2d.js +119 -0
  85. package/dist/features/physics/2d.js.map +7 -0
  86. package/dist/features/physics/2d.mjs +1 -0
  87. package/dist/features/physics/lib/2d/canvas/components.d.ts +46 -0
  88. package/dist/features/physics/lib/2d/canvas/components.js +212 -0
  89. package/dist/features/physics/lib/2d/canvas/components.js.map +7 -0
  90. package/dist/features/physics/lib/2d/canvas/custom.d.ts +24 -0
  91. package/dist/features/physics/lib/2d/canvas/custom.js +45 -0
  92. package/dist/features/physics/lib/2d/canvas/custom.js.map +7 -0
  93. package/dist/features/physics/lib/2d/canvas/debug.d.ts +23 -0
  94. package/dist/features/physics/lib/2d/canvas/debug.js +53 -0
  95. package/dist/features/physics/lib/2d/canvas/debug.js.map +7 -0
  96. package/dist/features/physics/lib/2d/canvas/inference.d.ts +9 -0
  97. package/dist/features/physics/lib/2d/canvas/inference.js +704 -0
  98. package/dist/features/physics/lib/2d/canvas/inference.js.map +7 -0
  99. package/dist/features/physics/lib/2d/canvas/presentation.d.ts +11 -0
  100. package/dist/features/physics/lib/2d/canvas/presentation.js +169 -0
  101. package/dist/features/physics/lib/2d/canvas/presentation.js.map +7 -0
  102. package/dist/features/physics/lib/2d/collision/analytic.d.ts +15 -0
  103. package/dist/features/physics/lib/2d/collision/analytic.js +151 -0
  104. package/dist/features/physics/lib/2d/collision/analytic.js.map +7 -0
  105. package/dist/features/physics/lib/2d/collision/casts.d.ts +37 -0
  106. package/dist/features/physics/lib/2d/collision/casts.js +631 -0
  107. package/dist/features/physics/lib/2d/collision/casts.js.map +7 -0
  108. package/dist/features/physics/lib/2d/collision/epa.d.ts +21 -0
  109. package/dist/features/physics/lib/2d/collision/epa.js +102 -0
  110. package/dist/features/physics/lib/2d/collision/epa.js.map +7 -0
  111. package/dist/features/physics/lib/2d/collision/gjk.d.ts +28 -0
  112. package/dist/features/physics/lib/2d/collision/gjk.js +233 -0
  113. package/dist/features/physics/lib/2d/collision/gjk.js.map +7 -0
  114. package/dist/features/physics/lib/2d/collision/manifold.d.ts +35 -0
  115. package/dist/features/physics/lib/2d/collision/manifold.js +238 -0
  116. package/dist/features/physics/lib/2d/collision/manifold.js.map +7 -0
  117. package/dist/features/physics/lib/2d/collision/pairs.d.ts +10 -0
  118. package/dist/features/physics/lib/2d/collision/pairs.js +285 -0
  119. package/dist/features/physics/lib/2d/collision/pairs.js.map +7 -0
  120. package/dist/features/physics/lib/2d/collision/support.d.ts +20 -0
  121. package/dist/features/physics/lib/2d/collision/support.js +155 -0
  122. package/dist/features/physics/lib/2d/collision/support.js.map +7 -0
  123. package/dist/features/physics/lib/2d/inspection-types.d.ts +159 -0
  124. package/dist/features/physics/lib/2d/math.d.ts +27 -0
  125. package/dist/features/physics/lib/2d/math.js +314 -0
  126. package/dist/features/physics/lib/2d/math.js.map +7 -0
  127. package/dist/features/physics/lib/2d/numeric-policy.d.ts +24 -0
  128. package/dist/features/physics/lib/2d/numeric-policy.js +51 -0
  129. package/dist/features/physics/lib/2d/numeric-policy.js.map +7 -0
  130. package/dist/features/physics/lib/2d/runtime/body-handle.d.ts +148 -0
  131. package/dist/features/physics/lib/2d/runtime/body-handle.js +305 -0
  132. package/dist/features/physics/lib/2d/runtime/body-handle.js.map +7 -0
  133. package/dist/features/physics/lib/2d/runtime/context.d.ts +9 -0
  134. package/dist/features/physics/lib/2d/runtime/context.js +57 -0
  135. package/dist/features/physics/lib/2d/runtime/context.js.map +7 -0
  136. package/dist/features/physics/lib/2d/runtime/controller.d.ts +106 -0
  137. package/dist/features/physics/lib/2d/runtime/controller.js +1317 -0
  138. package/dist/features/physics/lib/2d/runtime/controller.js.map +7 -0
  139. package/dist/features/physics/lib/2d/runtime/descriptors.d.ts +153 -0
  140. package/dist/features/physics/lib/2d/runtime/descriptors.js +526 -0
  141. package/dist/features/physics/lib/2d/runtime/descriptors.js.map +7 -0
  142. package/dist/features/physics/lib/2d/runtime/events.d.ts +56 -0
  143. package/dist/features/physics/lib/2d/runtime/events.js +153 -0
  144. package/dist/features/physics/lib/2d/runtime/events.js.map +7 -0
  145. package/dist/features/physics/lib/2d/runtime/obstacles.d.ts +22 -0
  146. package/dist/features/physics/lib/2d/runtime/obstacles.js +192 -0
  147. package/dist/features/physics/lib/2d/runtime/obstacles.js.map +7 -0
  148. package/dist/features/physics/lib/2d/runtime/ownership.d.ts +41 -0
  149. package/dist/features/physics/lib/2d/runtime/ownership.js +46 -0
  150. package/dist/features/physics/lib/2d/runtime/ownership.js.map +7 -0
  151. package/dist/features/physics/lib/2d/runtime/trace.d.ts +32 -0
  152. package/dist/features/physics/lib/2d/runtime/trace.js +22 -0
  153. package/dist/features/physics/lib/2d/runtime/trace.js.map +7 -0
  154. package/dist/features/physics/lib/2d/runtime/world-component.d.ts +18 -0
  155. package/dist/features/physics/lib/2d/runtime/world-component.js +41 -0
  156. package/dist/features/physics/lib/2d/runtime/world-component.js.map +7 -0
  157. package/dist/features/physics/lib/2d/runtime/world-props.d.ts +16 -0
  158. package/dist/features/physics/lib/2d/shape-records.d.ts +60 -0
  159. package/dist/features/physics/lib/2d/shape-records.js +26 -0
  160. package/dist/features/physics/lib/2d/shape-records.js.map +7 -0
  161. package/dist/features/physics/lib/2d/shapes.d.ts +191 -0
  162. package/dist/features/physics/lib/2d/shapes.js +543 -0
  163. package/dist/features/physics/lib/2d/shapes.js.map +7 -0
  164. package/dist/features/physics/lib/2d/types.d.ts +713 -0
  165. package/dist/features/physics/lib/2d/types.js +1 -0
  166. package/dist/features/physics/lib/2d/types.js.map +7 -0
  167. package/dist/features/physics/lib/2d/world/broad-phase.d.ts +77 -0
  168. package/dist/features/physics/lib/2d/world/broad-phase.js +762 -0
  169. package/dist/features/physics/lib/2d/world/broad-phase.js.map +7 -0
  170. package/dist/features/physics/lib/2d/world/ccd.d.ts +19 -0
  171. package/dist/features/physics/lib/2d/world/ccd.js +265 -0
  172. package/dist/features/physics/lib/2d/world/ccd.js.map +7 -0
  173. package/dist/features/physics/lib/2d/world/contact-cache.d.ts +81 -0
  174. package/dist/features/physics/lib/2d/world/contact-cache.js +497 -0
  175. package/dist/features/physics/lib/2d/world/contact-cache.js.map +7 -0
  176. package/dist/features/physics/lib/2d/world/integrator.d.ts +11 -0
  177. package/dist/features/physics/lib/2d/world/integrator.js +99 -0
  178. package/dist/features/physics/lib/2d/world/integrator.js.map +7 -0
  179. package/dist/features/physics/lib/2d/world/queries.d.ts +62 -0
  180. package/dist/features/physics/lib/2d/world/queries.js +424 -0
  181. package/dist/features/physics/lib/2d/world/queries.js.map +7 -0
  182. package/dist/features/physics/lib/2d/world/rapier-engine.js +7054 -0
  183. package/dist/features/physics/lib/2d/world/rapier-engine.js.map +7 -0
  184. package/dist/features/physics/lib/2d/world/rapier.d.ts +50 -0
  185. package/dist/features/physics/lib/2d/world/rapier.js +655 -0
  186. package/dist/features/physics/lib/2d/world/rapier.js.map +7 -0
  187. package/dist/features/physics/lib/2d/world/solver.d.ts +58 -0
  188. package/dist/features/physics/lib/2d/world/solver.js +660 -0
  189. package/dist/features/physics/lib/2d/world/solver.js.map +7 -0
  190. package/dist/features/physics/lib/2d/world/storage.d.ts +96 -0
  191. package/dist/features/physics/lib/2d/world/storage.js +371 -0
  192. package/dist/features/physics/lib/2d/world/storage.js.map +7 -0
  193. package/dist/features/physics/lib/2d/world/world.d.ts +265 -0
  194. package/dist/features/physics/lib/2d/world/world.js +1713 -0
  195. package/dist/features/physics/lib/2d/world/world.js.map +7 -0
  196. package/dist/features/physics/lib/shared/signal-inputs.d.ts +5 -0
  197. package/dist/features/physics/lib/shared/signal-inputs.js +20 -0
  198. package/dist/features/physics/lib/shared/signal-inputs.js.map +7 -0
  199. package/dist/features/physics/lib/shared/validation.d.ts +5 -0
  200. package/dist/features/physics/lib/shared/validation.js +48 -0
  201. package/dist/features/physics/lib/shared/validation.js.map +7 -0
  202. package/dist/features/sprites/formats/aseprite.js +23 -0
  203. package/dist/features/sprites/formats/aseprite.js.map +7 -0
  204. package/dist/features/sprites/formats/aseprite.mjs +1 -0
  205. package/dist/features/sprites/formats/texture-packer.js +14 -0
  206. package/dist/features/sprites/formats/texture-packer.js.map +7 -0
  207. package/dist/features/sprites/formats/texture-packer.mjs +1 -0
  208. package/dist/features/sprites/index.js +9 -0
  209. package/dist/features/sprites/index.js.map +7 -0
  210. package/dist/features/sprites/index.mjs +1 -0
  211. package/dist/features/sprites/loader.js +63 -0
  212. package/dist/features/sprites/loader.js.map +7 -0
  213. package/dist/features/sprites/model.js +64 -0
  214. package/dist/features/sprites/model.js.map +7 -0
  215. package/dist/features/sprites/sprite.js +31 -0
  216. package/dist/features/sprites/sprite.js.map +7 -0
  217. package/dist/features/textures/index.d.ts +22 -0
  218. package/dist/features/textures/index.js +31 -0
  219. package/dist/features/textures/index.js.map +7 -0
  220. package/dist/features/textures/index.mjs +1 -0
  221. package/dist/features/textures/lib/definitions.d.ts +117 -0
  222. package/dist/features/textures/lib/definitions.js +179 -0
  223. package/dist/features/textures/lib/definitions.js.map +7 -0
  224. package/dist/features/textures/lib/electric-boundary.d.ts +3 -0
  225. package/dist/features/textures/lib/electric-boundary.js +11 -0
  226. package/dist/features/textures/lib/electric-boundary.js.map +7 -0
  227. package/dist/features/textures/lib/electric-shared.d.ts +69 -0
  228. package/dist/features/textures/lib/electric-shared.js +43 -0
  229. package/dist/features/textures/lib/electric-shared.js.map +7 -0
  230. package/dist/features/textures/lib/electric-sources.d.ts +50 -0
  231. package/dist/features/textures/lib/electric-sources.js +43 -0
  232. package/dist/features/textures/lib/electric-sources.js.map +7 -0
  233. package/dist/features/textures/lib/lightning.d.ts +72 -0
  234. package/dist/features/textures/lib/lightning.js +139 -0
  235. package/dist/features/textures/lib/lightning.js.map +7 -0
  236. package/dist/features/textures/lib/material-field.d.ts +12 -0
  237. package/dist/features/textures/lib/material-field.js +31 -0
  238. package/dist/features/textures/lib/material-field.js.map +7 -0
  239. package/dist/features/textures/lib/palette.d.ts +45 -0
  240. package/dist/features/textures/lib/palette.js +52 -0
  241. package/dist/features/textures/lib/palette.js.map +7 -0
  242. package/dist/features/textures/lib/presentation.d.ts +54 -0
  243. package/dist/features/textures/lib/presentation.js +83 -0
  244. package/dist/features/textures/lib/presentation.js.map +7 -0
  245. package/dist/features/textures/lib/procedural-texture.d.ts +44 -0
  246. package/dist/features/textures/lib/procedural-texture.js +110 -0
  247. package/dist/features/textures/lib/procedural-texture.js.map +7 -0
  248. package/dist/features/textures/lib/rain-drops.d.ts +96 -0
  249. package/dist/features/textures/lib/rain-drops.js +322 -0
  250. package/dist/features/textures/lib/rain-drops.js.map +7 -0
  251. package/dist/features/textures/lib/reaction-diffusion.d.ts +67 -0
  252. package/dist/features/textures/lib/reaction-diffusion.js +210 -0
  253. package/dist/features/textures/lib/reaction-diffusion.js.map +7 -0
  254. package/dist/features/textures/lib/simulation.d.ts +16 -0
  255. package/dist/features/textures/lib/simulation.js +85 -0
  256. package/dist/features/textures/lib/simulation.js.map +7 -0
  257. package/dist/features/textures/lib/tendrils.d.ts +57 -0
  258. package/dist/features/textures/lib/tendrils.js +216 -0
  259. package/dist/features/textures/lib/tendrils.js.map +7 -0
  260. package/dist/features/textures/lib/wasm/cellular-bytes.d.ts +1 -0
  261. package/dist/features/textures/lib/wasm/cellular-bytes.js +5 -0
  262. package/dist/features/textures/lib/wasm/cellular-bytes.js.map +7 -0
  263. package/dist/features/textures/lib/wasm/electric.d.ts +88 -0
  264. package/dist/features/textures/lib/wasm/electric.js +299 -0
  265. package/dist/features/textures/lib/wasm/electric.js.map +7 -0
  266. package/dist/features/textures/lib/wasm/ink-bytes.d.ts +1 -0
  267. package/dist/features/textures/lib/wasm/ink-bytes.js +5 -0
  268. package/dist/features/textures/lib/wasm/ink-bytes.js.map +7 -0
  269. package/dist/features/textures/lib/wasm/lightning-bytes.d.ts +1 -0
  270. package/dist/features/textures/lib/wasm/lightning-bytes.js +5 -0
  271. package/dist/features/textures/lib/wasm/lightning-bytes.js.map +7 -0
  272. package/dist/features/textures/lib/wasm/marble-bytes.d.ts +1 -0
  273. package/dist/features/textures/lib/wasm/marble-bytes.js +5 -0
  274. package/dist/features/textures/lib/wasm/marble-bytes.js.map +7 -0
  275. package/dist/features/textures/lib/wasm/memory.d.ts +31 -0
  276. package/dist/features/textures/lib/wasm/memory.js +103 -0
  277. package/dist/features/textures/lib/wasm/memory.js.map +7 -0
  278. package/dist/features/textures/lib/wasm/paper-bytes.d.ts +1 -0
  279. package/dist/features/textures/lib/wasm/paper-bytes.js +5 -0
  280. package/dist/features/textures/lib/wasm/paper-bytes.js.map +7 -0
  281. package/dist/features/textures/lib/wasm/tendrils-bytes.d.ts +1 -0
  282. package/dist/features/textures/lib/wasm/tendrils-bytes.js +5 -0
  283. package/dist/features/textures/lib/wasm/tendrils-bytes.js.map +7 -0
  284. package/dist/features/textures/lib/wasm/water-surface-bytes.d.ts +1 -0
  285. package/dist/features/textures/lib/wasm/water-surface-bytes.js +5 -0
  286. package/dist/features/textures/lib/wasm/water-surface-bytes.js.map +7 -0
  287. package/dist/features/textures/lib/wasm/water-waves-bytes.d.ts +1 -0
  288. package/dist/features/textures/lib/wasm/water-waves-bytes.js +5 -0
  289. package/dist/features/textures/lib/wasm/water-waves-bytes.js.map +7 -0
  290. package/dist/features/textures/lib/water-surface.d.ts +92 -0
  291. package/dist/features/textures/lib/water-surface.js +378 -0
  292. package/dist/features/textures/lib/water-surface.js.map +7 -0
  293. package/dist/features/textures/lib/water-waves.d.ts +60 -0
  294. package/dist/features/textures/lib/water-waves.js +154 -0
  295. package/dist/features/textures/lib/water-waves.js.map +7 -0
  296. package/dist/features/viz/index.d.ts +28 -0
  297. package/dist/features/viz/index.js +45 -0
  298. package/dist/features/viz/index.js.map +7 -0
  299. package/dist/features/viz/index.mjs +1 -0
  300. package/dist/features/viz/lib/anchored-layout.d.ts +104 -0
  301. package/dist/features/viz/lib/anchored-layout.js +166 -0
  302. package/dist/features/viz/lib/anchored-layout.js.map +7 -0
  303. package/dist/features/viz/lib/axis.d.ts +10 -0
  304. package/dist/features/viz/lib/axis.js +116 -0
  305. package/dist/features/viz/lib/axis.js.map +7 -0
  306. package/dist/features/viz/lib/band-scale.d.ts +3 -0
  307. package/dist/features/viz/lib/band-scale.js +57 -0
  308. package/dist/features/viz/lib/band-scale.js.map +7 -0
  309. package/dist/features/viz/lib/bar-fill.d.ts +16 -0
  310. package/dist/features/viz/lib/bar-fill.js +53 -0
  311. package/dist/features/viz/lib/bar-fill.js.map +7 -0
  312. package/dist/features/viz/lib/bar-series.d.ts +150 -0
  313. package/dist/features/viz/lib/bar-series.js +152 -0
  314. package/dist/features/viz/lib/bar-series.js.map +7 -0
  315. package/dist/features/viz/lib/hover-card.d.ts +92 -0
  316. package/dist/features/viz/lib/hover-card.js +146 -0
  317. package/dist/features/viz/lib/hover-card.js.map +7 -0
  318. package/dist/features/viz/lib/hover-data.d.ts +12 -0
  319. package/dist/features/viz/lib/hover-data.js +50 -0
  320. package/dist/features/viz/lib/hover-data.js.map +7 -0
  321. package/dist/features/viz/lib/hover-placement.d.ts +46 -0
  322. package/dist/features/viz/lib/hover-placement.js +51 -0
  323. package/dist/features/viz/lib/hover-placement.js.map +7 -0
  324. package/dist/features/viz/lib/hover-queries.d.ts +60 -0
  325. package/dist/features/viz/lib/hover-queries.js +185 -0
  326. package/dist/features/viz/lib/hover-queries.js.map +7 -0
  327. package/dist/features/viz/lib/hover-types.d.ts +277 -0
  328. package/dist/features/viz/lib/layout-pie.d.ts +13 -0
  329. package/dist/features/viz/lib/layout-pie.js +159 -0
  330. package/dist/features/viz/lib/layout-pie.js.map +7 -0
  331. package/dist/features/viz/lib/line-series.d.ts +11 -0
  332. package/dist/features/viz/lib/line-series.js +89 -0
  333. package/dist/features/viz/lib/line-series.js.map +7 -0
  334. package/dist/features/viz/lib/linear-scale.d.ts +3 -0
  335. package/dist/features/viz/lib/linear-scale.js +70 -0
  336. package/dist/features/viz/lib/linear-scale.js.map +7 -0
  337. package/dist/features/viz/lib/nearest.d.ts +82 -0
  338. package/dist/features/viz/lib/nearest.js +51 -0
  339. package/dist/features/viz/lib/nearest.js.map +7 -0
  340. package/dist/features/viz/lib/paint.d.ts +2 -0
  341. package/dist/features/viz/lib/paint.js +17 -0
  342. package/dist/features/viz/lib/paint.js.map +7 -0
  343. package/dist/features/viz/lib/pie-layout.d.ts +31 -0
  344. package/dist/features/viz/lib/pie-layout.js +324 -0
  345. package/dist/features/viz/lib/pie-layout.js.map +7 -0
  346. package/dist/features/viz/lib/pie-slices.d.ts +51 -0
  347. package/dist/features/viz/lib/pie-slices.js +50 -0
  348. package/dist/features/viz/lib/pie-slices.js.map +7 -0
  349. package/dist/features/viz/lib/pie-types.d.ts +215 -0
  350. package/dist/features/viz/lib/plot-series.d.ts +13 -0
  351. package/dist/features/viz/lib/plot-series.js +53 -0
  352. package/dist/features/viz/lib/plot-series.js.map +7 -0
  353. package/dist/features/viz/lib/plot-types.d.ts +63 -0
  354. package/dist/features/viz/lib/point-data.d.ts +5 -0
  355. package/dist/features/viz/lib/point-data.js +17 -0
  356. package/dist/features/viz/lib/point-data.js.map +7 -0
  357. package/dist/features/viz/lib/point-geometry.d.ts +2 -0
  358. package/dist/features/viz/lib/point-geometry.js +24 -0
  359. package/dist/features/viz/lib/point-geometry.js.map +7 -0
  360. package/dist/features/viz/lib/point-series.d.ts +11 -0
  361. package/dist/features/viz/lib/point-series.js +118 -0
  362. package/dist/features/viz/lib/point-series.js.map +7 -0
  363. package/dist/features/viz/lib/point-types.d.ts +94 -0
  364. package/dist/features/viz/lib/scale-adjust.d.ts +11 -0
  365. package/dist/features/viz/lib/scale-adjust.js +25 -0
  366. package/dist/features/viz/lib/scale-adjust.js.map +7 -0
  367. package/dist/features/viz/lib/scale-context.d.ts +8 -0
  368. package/dist/features/viz/lib/scale-context.js +61 -0
  369. package/dist/features/viz/lib/scale-context.js.map +7 -0
  370. package/dist/features/viz/lib/scale.d.ts +11 -0
  371. package/dist/features/viz/lib/scale.js +80 -0
  372. package/dist/features/viz/lib/scale.js.map +7 -0
  373. package/dist/features/viz/lib/types.d.ts +414 -0
  374. package/dist/features/viz/lib/use-scale.d.ts +20 -0
  375. package/dist/features/viz/lib/use-scale.js +10 -0
  376. package/dist/features/viz/lib/use-scale.js.map +7 -0
  377. package/dist/filters/displacement-gpu.d.ts +38 -0
  378. package/dist/filters/displacement-gpu.js +243 -0
  379. package/dist/filters/displacement-gpu.js.map +7 -0
  380. package/dist/filters/displacement-math.d.ts +5 -0
  381. package/dist/filters/displacement-math.js +22 -0
  382. package/dist/filters/displacement-math.js.map +7 -0
  383. package/dist/filters/displacement.d.ts +13 -0
  384. package/dist/filters/displacement.js +65 -0
  385. package/dist/filters/displacement.js.map +7 -0
  386. package/dist/filters/filter-executor.d.ts +21 -0
  387. package/dist/filters/filter-executor.js +120 -0
  388. package/dist/filters/filter-executor.js.map +7 -0
  389. package/dist/filters/native-canvas-filter.d.ts +4 -0
  390. package/dist/filters/native-canvas-filter.js +105 -0
  391. package/dist/filters/native-canvas-filter.js.map +7 -0
  392. package/dist/filters/native-color.d.ts +2 -0
  393. package/dist/filters/native-color.js +200 -0
  394. package/dist/filters/native-color.js.map +7 -0
  395. package/dist/filters/native-operations.d.ts +8 -0
  396. package/dist/filters/native-operations.js +7 -0
  397. package/dist/filters/native-operations.js.map +7 -0
  398. package/dist/filters/native.d.ts +113 -0
  399. package/dist/filters/native.js +115 -0
  400. package/dist/filters/native.js.map +7 -0
  401. package/dist/filters/reflected-light.d.ts +12 -0
  402. package/dist/filters/reflected-light.js +93 -0
  403. package/dist/filters/reflected-light.js.map +7 -0
  404. package/dist/filters/reflection-gpu.d.ts +58 -0
  405. package/dist/filters/reflection-gpu.js +266 -0
  406. package/dist/filters/reflection-gpu.js.map +7 -0
  407. package/dist/filters/render-displacement-boundary.d.ts +12 -0
  408. package/dist/filters/render-displacement-boundary.js +116 -0
  409. package/dist/filters/render-displacement-boundary.js.map +7 -0
  410. package/dist/filters/render-reflection-boundary.d.ts +15 -0
  411. package/dist/filters/render-reflection-boundary.js +127 -0
  412. package/dist/filters/render-reflection-boundary.js.map +7 -0
  413. package/dist/filters.d.ts +5 -0
  414. package/dist/filters.js +29 -0
  415. package/dist/filters.js.map +7 -0
  416. package/dist/filters.mjs +1 -0
  417. package/dist/index.d.ts +111 -0
  418. package/dist/index.js +300 -0
  419. package/dist/index.js.map +7 -0
  420. package/dist/index.mjs +1 -0
  421. package/dist/internal.d.ts +160 -0
  422. package/dist/internal.js +320 -0
  423. package/dist/internal.js.map +7 -0
  424. package/dist/internal.mjs +1 -0
  425. package/dist/jsx-dev-runtime.d.ts +35 -0
  426. package/dist/jsx-dev-runtime.js +6 -0
  427. package/dist/jsx-dev-runtime.js.map +7 -0
  428. package/dist/jsx-dev-runtime.mjs +1 -0
  429. package/dist/jsx-runtime.d.ts +35 -0
  430. package/dist/jsx-runtime.js +7 -0
  431. package/dist/jsx-runtime.js.map +7 -0
  432. package/dist/jsx-runtime.mjs +1 -0
  433. package/dist/lib/animation/definition.d.ts +140 -0
  434. package/dist/lib/animation/definition.js +605 -0
  435. package/dist/lib/animation/definition.js.map +7 -0
  436. package/dist/lib/animation/easing.d.ts +55 -0
  437. package/dist/lib/animation/easing.js +112 -0
  438. package/dist/lib/animation/easing.js.map +7 -0
  439. package/dist/lib/animation/evaluate.d.ts +118 -0
  440. package/dist/lib/animation/evaluate.js +2398 -0
  441. package/dist/lib/animation/evaluate.js.map +7 -0
  442. package/dist/lib/animation/playback.d.ts +30 -0
  443. package/dist/lib/animation/playback.js +932 -0
  444. package/dist/lib/animation/playback.js.map +7 -0
  445. package/dist/lib/animation/program.d.ts +145 -0
  446. package/dist/lib/animation/program.js +741 -0
  447. package/dist/lib/animation/program.js.map +7 -0
  448. package/dist/lib/animation/spring.d.ts +30 -0
  449. package/dist/lib/animation/spring.js +324 -0
  450. package/dist/lib/animation/spring.js.map +7 -0
  451. package/dist/lib/animation/types.d.ts +418 -0
  452. package/dist/lib/animation/writer-leases.d.ts +47 -0
  453. package/dist/lib/animation/writer-leases.js +314 -0
  454. package/dist/lib/animation/writer-leases.js.map +7 -0
  455. package/dist/lib/backend/canvas-2d-backend.d.ts +4 -0
  456. package/dist/lib/backend/canvas-2d-backend.js +97 -0
  457. package/dist/lib/backend/canvas-2d-backend.js.map +7 -0
  458. package/dist/lib/backend/types.d.ts +309 -0
  459. package/dist/lib/backend/types.js +26 -0
  460. package/dist/lib/backend/types.js.map +7 -0
  461. package/dist/lib/components/arc-geometry.d.ts +4 -0
  462. package/dist/lib/components/arc-geometry.js +46 -0
  463. package/dist/lib/components/arc-geometry.js.map +7 -0
  464. package/dist/lib/components/arc.d.ts +55 -0
  465. package/dist/lib/components/arc.js +91 -0
  466. package/dist/lib/components/arc.js.map +7 -0
  467. package/dist/lib/components/circle.d.ts +49 -0
  468. package/dist/lib/components/circle.js +46 -0
  469. package/dist/lib/components/circle.js.map +7 -0
  470. package/dist/lib/components/clip.d.ts +43 -0
  471. package/dist/lib/components/clip.js +24 -0
  472. package/dist/lib/components/clip.js.map +7 -0
  473. package/dist/lib/components/ellipse.d.ts +53 -0
  474. package/dist/lib/components/ellipse.js +59 -0
  475. package/dist/lib/components/ellipse.js.map +7 -0
  476. package/dist/lib/components/g.d.ts +56 -0
  477. package/dist/lib/components/g.js +24 -0
  478. package/dist/lib/components/g.js.map +7 -0
  479. package/dist/lib/components/horizontal-line.d.ts +56 -0
  480. package/dist/lib/components/horizontal-line.js +71 -0
  481. package/dist/lib/components/horizontal-line.js.map +7 -0
  482. package/dist/lib/components/html-box.d.ts +16 -0
  483. package/dist/lib/components/html-box.js +57 -0
  484. package/dist/lib/components/html-box.js.map +7 -0
  485. package/dist/lib/components/img.d.ts +24 -0
  486. package/dist/lib/components/img.js +150 -0
  487. package/dist/lib/components/img.js.map +7 -0
  488. package/dist/lib/components/layer-node-equality.d.ts +65 -0
  489. package/dist/lib/components/layer-node-equality.js +91 -0
  490. package/dist/lib/components/layer-node-equality.js.map +7 -0
  491. package/dist/lib/components/layer.d.ts +34 -0
  492. package/dist/lib/components/layer.js +172 -0
  493. package/dist/lib/components/layer.js.map +7 -0
  494. package/dist/lib/components/line.d.ts +51 -0
  495. package/dist/lib/components/line.js +76 -0
  496. package/dist/lib/components/line.js.map +7 -0
  497. package/dist/lib/components/path.d.ts +28 -0
  498. package/dist/lib/components/path.js +47 -0
  499. package/dist/lib/components/path.js.map +7 -0
  500. package/dist/lib/components/polygon.d.ts +45 -0
  501. package/dist/lib/components/polygon.js +93 -0
  502. package/dist/lib/components/polygon.js.map +7 -0
  503. package/dist/lib/components/rect.d.ts +24 -0
  504. package/dist/lib/components/rect.js +83 -0
  505. package/dist/lib/components/rect.js.map +7 -0
  506. package/dist/lib/components/regular-polygon.d.ts +102 -0
  507. package/dist/lib/components/regular-polygon.js +112 -0
  508. package/dist/lib/components/regular-polygon.js.map +7 -0
  509. package/dist/lib/components/rounded-corner-style.d.ts +7 -0
  510. package/dist/lib/components/rounded-corner-style.js +40 -0
  511. package/dist/lib/components/rounded-corner-style.js.map +7 -0
  512. package/dist/lib/components/shape-style.d.ts +7 -0
  513. package/dist/lib/components/shape-style.js +52 -0
  514. package/dist/lib/components/shape-style.js.map +7 -0
  515. package/dist/lib/components/star.d.ts +56 -0
  516. package/dist/lib/components/star.js +98 -0
  517. package/dist/lib/components/star.js.map +7 -0
  518. package/dist/lib/components/structural-events.d.ts +10 -0
  519. package/dist/lib/components/structural-events.js +8 -0
  520. package/dist/lib/components/structural-events.js.map +7 -0
  521. package/dist/lib/components/svg-path.d.ts +23 -0
  522. package/dist/lib/components/svg-path.js +25 -0
  523. package/dist/lib/components/svg-path.js.map +7 -0
  524. package/dist/lib/components/text-layout.d.ts +31 -0
  525. package/dist/lib/components/text-layout.js +139 -0
  526. package/dist/lib/components/text-layout.js.map +7 -0
  527. package/dist/lib/components/text.d.ts +29 -0
  528. package/dist/lib/components/text.js +174 -0
  529. package/dist/lib/components/text.js.map +7 -0
  530. package/dist/lib/components/vertical-line.d.ts +57 -0
  531. package/dist/lib/components/vertical-line.js +71 -0
  532. package/dist/lib/components/vertical-line.js.map +7 -0
  533. package/dist/lib/components/wedge.d.ts +55 -0
  534. package/dist/lib/components/wedge.js +93 -0
  535. package/dist/lib/components/wedge.js.map +7 -0
  536. package/dist/lib/define-primitive.d.ts +82 -0
  537. package/dist/lib/define-primitive.js +85 -0
  538. package/dist/lib/define-primitive.js.map +7 -0
  539. package/dist/lib/development.d.ts +2 -0
  540. package/dist/lib/development.js +5 -0
  541. package/dist/lib/development.js.map +7 -0
  542. package/dist/lib/element/children.d.ts +16 -0
  543. package/dist/lib/element/children.js +333 -0
  544. package/dist/lib/element/children.js.map +7 -0
  545. package/dist/lib/element/create-element.d.ts +34 -0
  546. package/dist/lib/element/create-element.js +75 -0
  547. package/dist/lib/element/create-element.js.map +7 -0
  548. package/dist/lib/element/fragment.d.ts +15 -0
  549. package/dist/lib/element/fragment.js +11 -0
  550. package/dist/lib/element/fragment.js.map +7 -0
  551. package/dist/lib/element/jsx-runtime.d.ts +48 -0
  552. package/dist/lib/element/jsx-runtime.js +16 -0
  553. package/dist/lib/element/jsx-runtime.js.map +7 -0
  554. package/dist/lib/element/metadata.d.ts +96 -0
  555. package/dist/lib/element/metadata.js +160 -0
  556. package/dist/lib/element/metadata.js.map +7 -0
  557. package/dist/lib/element/resolve-primitive-inputs.d.ts +12 -0
  558. package/dist/lib/element/resolve-primitive-inputs.js +83 -0
  559. package/dist/lib/element/resolve-primitive-inputs.js.map +7 -0
  560. package/dist/lib/element/types.d.ts +123 -0
  561. package/dist/lib/element-enhancers.d.ts +134 -0
  562. package/dist/lib/element-enhancers.js +193 -0
  563. package/dist/lib/element-enhancers.js.map +7 -0
  564. package/dist/lib/events/adapters/clipboard.d.ts +9 -0
  565. package/dist/lib/events/adapters/clipboard.js +23 -0
  566. package/dist/lib/events/adapters/clipboard.js.map +7 -0
  567. package/dist/lib/events/adapters/drag.d.ts +12 -0
  568. package/dist/lib/events/adapters/drag.js +29 -0
  569. package/dist/lib/events/adapters/drag.js.map +7 -0
  570. package/dist/lib/events/adapters/editing.d.ts +15 -0
  571. package/dist/lib/events/adapters/editing.js +41 -0
  572. package/dist/lib/events/adapters/editing.js.map +7 -0
  573. package/dist/lib/events/adapters/keyboard-focus.d.ts +12 -0
  574. package/dist/lib/events/adapters/keyboard-focus.js +36 -0
  575. package/dist/lib/events/adapters/keyboard-focus.js.map +7 -0
  576. package/dist/lib/events/adapters/mouse.d.ts +17 -0
  577. package/dist/lib/events/adapters/mouse.js +32 -0
  578. package/dist/lib/events/adapters/mouse.js.map +7 -0
  579. package/dist/lib/events/adapters/pointer.d.ts +19 -0
  580. package/dist/lib/events/adapters/pointer.js +40 -0
  581. package/dist/lib/events/adapters/pointer.js.map +7 -0
  582. package/dist/lib/events/adapters/touch.d.ts +16 -0
  583. package/dist/lib/events/adapters/touch.js +36 -0
  584. package/dist/lib/events/adapters/touch.js.map +7 -0
  585. package/dist/lib/events/adapters/wheel.d.ts +10 -0
  586. package/dist/lib/events/adapters/wheel.js +16 -0
  587. package/dist/lib/events/adapters/wheel.js.map +7 -0
  588. package/dist/lib/events/boundary-transitions.d.ts +9 -0
  589. package/dist/lib/events/boundary-transitions.js +16 -0
  590. package/dist/lib/events/boundary-transitions.js.map +7 -0
  591. package/dist/lib/events/dispatch.d.ts +21 -0
  592. package/dist/lib/events/dispatch.js +1078 -0
  593. package/dist/lib/events/dispatch.js.map +7 -0
  594. package/dist/lib/events/event-definitions.d.ts +23 -0
  595. package/dist/lib/events/event-definitions.js +74 -0
  596. package/dist/lib/events/event-definitions.js.map +7 -0
  597. package/dist/lib/events/event-facade.d.ts +19 -0
  598. package/dist/lib/events/event-facade.js +188 -0
  599. package/dist/lib/events/event-facade.js.map +7 -0
  600. package/dist/lib/events/event-path.d.ts +3 -0
  601. package/dist/lib/events/event-path.js +43 -0
  602. package/dist/lib/events/event-path.js.map +7 -0
  603. package/dist/lib/events/hit-test.d.ts +13 -0
  604. package/dist/lib/events/hit-test.js +135 -0
  605. package/dist/lib/events/hit-test.js.map +7 -0
  606. package/dist/lib/events/native-listener-hub.d.ts +10 -0
  607. package/dist/lib/events/native-listener-hub.js +72 -0
  608. package/dist/lib/events/native-listener-hub.js.map +7 -0
  609. package/dist/lib/events/paint-entry.d.ts +66 -0
  610. package/dist/lib/events/paint-entry.js +30 -0
  611. package/dist/lib/events/paint-entry.js.map +7 -0
  612. package/dist/lib/events/pointer-capture.d.ts +23 -0
  613. package/dist/lib/events/pointer-capture.js +339 -0
  614. package/dist/lib/events/pointer-capture.js.map +7 -0
  615. package/dist/lib/events/propagation.d.ts +7 -0
  616. package/dist/lib/events/propagation.js +56 -0
  617. package/dist/lib/events/propagation.js.map +7 -0
  618. package/dist/lib/events/registrations.d.ts +120 -0
  619. package/dist/lib/events/registrations.js +397 -0
  620. package/dist/lib/events/registrations.js.map +7 -0
  621. package/dist/lib/events/resolver-input.d.ts +25 -0
  622. package/dist/lib/events/resolver-input.js +62 -0
  623. package/dist/lib/events/resolver-input.js.map +7 -0
  624. package/dist/lib/events/types.d.ts +596 -0
  625. package/dist/lib/execute-render.d.ts +9 -0
  626. package/dist/lib/execute-render.js +195 -0
  627. package/dist/lib/execute-render.js.map +7 -0
  628. package/dist/lib/filter/canvas-state.d.ts +2 -0
  629. package/dist/lib/filter/canvas-state.js +31 -0
  630. package/dist/lib/filter/canvas-state.js.map +7 -0
  631. package/dist/lib/filter/filter-region.d.ts +33 -0
  632. package/dist/lib/filter/filter-region.js +291 -0
  633. package/dist/lib/filter/filter-region.js.map +7 -0
  634. package/dist/lib/filter/filter-surface-pool.d.ts +38 -0
  635. package/dist/lib/filter/filter-surface-pool.js +252 -0
  636. package/dist/lib/filter/filter-surface-pool.js.map +7 -0
  637. package/dist/lib/filter/render-filter-boundary.d.ts +14 -0
  638. package/dist/lib/filter/render-filter-boundary.js +211 -0
  639. package/dist/lib/filter/render-filter-boundary.js.map +7 -0
  640. package/dist/lib/focus/directional-navigation.d.ts +12 -0
  641. package/dist/lib/focus/directional-navigation.js +86 -0
  642. package/dist/lib/focus/directional-navigation.js.map +7 -0
  643. package/dist/lib/focus/dom-focus-host.d.ts +13 -0
  644. package/dist/lib/focus/dom-focus-host.js +352 -0
  645. package/dist/lib/focus/dom-focus-host.js.map +7 -0
  646. package/dist/lib/focus/dom-tab-stops.d.ts +3 -0
  647. package/dist/lib/focus/dom-tab-stops.js +71 -0
  648. package/dist/lib/focus/dom-tab-stops.js.map +7 -0
  649. package/dist/lib/focus/focus-events.d.ts +4 -0
  650. package/dist/lib/focus/focus-events.js +78 -0
  651. package/dist/lib/focus/focus-events.js.map +7 -0
  652. package/dist/lib/focus/focus-manager.d.ts +121 -0
  653. package/dist/lib/focus/focus-manager.js +1131 -0
  654. package/dist/lib/focus/focus-manager.js.map +7 -0
  655. package/dist/lib/focus/geometry.d.ts +4 -0
  656. package/dist/lib/focus/geometry.js +64 -0
  657. package/dist/lib/focus/geometry.js.map +7 -0
  658. package/dist/lib/focus/html-focus-region.d.ts +27 -0
  659. package/dist/lib/focus/keyboard-defaults.d.ts +7 -0
  660. package/dist/lib/focus/keyboard-defaults.js +110 -0
  661. package/dist/lib/focus/keyboard-defaults.js.map +7 -0
  662. package/dist/lib/focus/policy-components.d.ts +45 -0
  663. package/dist/lib/focus/policy-components.js +94 -0
  664. package/dist/lib/focus/policy-components.js.map +7 -0
  665. package/dist/lib/focus/types.d.ts +37 -0
  666. package/dist/lib/focus/types.js +7 -0
  667. package/dist/lib/focus/types.js.map +7 -0
  668. package/dist/lib/geometry/circle.d.ts +22 -0
  669. package/dist/lib/geometry/circle.js +13 -0
  670. package/dist/lib/geometry/circle.js.map +7 -0
  671. package/dist/lib/geometry/circular-sweep.d.ts +54 -0
  672. package/dist/lib/geometry/circular-sweep.js +95 -0
  673. package/dist/lib/geometry/circular-sweep.js.map +7 -0
  674. package/dist/lib/geometry/ellipse.d.ts +26 -0
  675. package/dist/lib/geometry/ellipse.js +17 -0
  676. package/dist/lib/geometry/ellipse.js.map +7 -0
  677. package/dist/lib/geometry/line.d.ts +20 -0
  678. package/dist/lib/geometry/line.js +15 -0
  679. package/dist/lib/geometry/line.js.map +7 -0
  680. package/dist/lib/geometry/path-arc.d.ts +25 -0
  681. package/dist/lib/geometry/path-arc.js +57 -0
  682. package/dist/lib/geometry/path-arc.js.map +7 -0
  683. package/dist/lib/geometry/path-bend-guide.d.ts +31 -0
  684. package/dist/lib/geometry/path-bend-guide.js +282 -0
  685. package/dist/lib/geometry/path-bend-guide.js.map +7 -0
  686. package/dist/lib/geometry/path-bend-spans.d.ts +31 -0
  687. package/dist/lib/geometry/path-bend-spans.js +109 -0
  688. package/dist/lib/geometry/path-bend-spans.js.map +7 -0
  689. package/dist/lib/geometry/path-bending.d.ts +90 -0
  690. package/dist/lib/geometry/path-bending.js +202 -0
  691. package/dist/lib/geometry/path-bending.js.map +7 -0
  692. package/dist/lib/geometry/path-conversion.d.ts +19 -0
  693. package/dist/lib/geometry/path-conversion.js +114 -0
  694. package/dist/lib/geometry/path-conversion.js.map +7 -0
  695. package/dist/lib/geometry/path-geometry.d.ts +218 -0
  696. package/dist/lib/geometry/path-geometry.js +557 -0
  697. package/dist/lib/geometry/path-geometry.js.map +7 -0
  698. package/dist/lib/geometry/path-radial.d.ts +15 -0
  699. package/dist/lib/geometry/path-radial.js +107 -0
  700. package/dist/lib/geometry/path-radial.js.map +7 -0
  701. package/dist/lib/geometry/path-transforms.d.ts +233 -0
  702. package/dist/lib/geometry/path-transforms.js +478 -0
  703. package/dist/lib/geometry/path-transforms.js.map +7 -0
  704. package/dist/lib/geometry/path-utilities.d.ts +78 -0
  705. package/dist/lib/geometry/path-utilities.js +341 -0
  706. package/dist/lib/geometry/path-utilities.js.map +7 -0
  707. package/dist/lib/geometry/path-wang.d.ts +18 -0
  708. package/dist/lib/geometry/path-wang.js +136 -0
  709. package/dist/lib/geometry/path-wang.js.map +7 -0
  710. package/dist/lib/geometry/path-warp-bezier.d.ts +17 -0
  711. package/dist/lib/geometry/path-warp-bezier.js +109 -0
  712. package/dist/lib/geometry/path-warp-bezier.js.map +7 -0
  713. package/dist/lib/geometry/path-warp.d.ts +27 -0
  714. package/dist/lib/geometry/path-warp.js +165 -0
  715. package/dist/lib/geometry/path-warp.js.map +7 -0
  716. package/dist/lib/geometry/polygon.d.ts +21 -0
  717. package/dist/lib/geometry/polygon.js +12 -0
  718. package/dist/lib/geometry/polygon.js.map +7 -0
  719. package/dist/lib/geometry/rectangle.d.ts +38 -0
  720. package/dist/lib/geometry/rectangle.js +22 -0
  721. package/dist/lib/geometry/rectangle.js.map +7 -0
  722. package/dist/lib/geometry/regular-polygon.d.ts +88 -0
  723. package/dist/lib/geometry/regular-polygon.js +67 -0
  724. package/dist/lib/geometry/regular-polygon.js.map +7 -0
  725. package/dist/lib/geometry/resolve-path.d.ts +4 -0
  726. package/dist/lib/geometry/resolve-path.js +16 -0
  727. package/dist/lib/geometry/resolve-path.js.map +7 -0
  728. package/dist/lib/geometry/rounded-corners.d.ts +28 -0
  729. package/dist/lib/geometry/rounded-corners.js +118 -0
  730. package/dist/lib/geometry/rounded-corners.js.map +7 -0
  731. package/dist/lib/geometry/star.d.ts +39 -0
  732. package/dist/lib/geometry/star.js +90 -0
  733. package/dist/lib/geometry/star.js.map +7 -0
  734. package/dist/lib/geometry/svg-path.d.ts +21 -0
  735. package/dist/lib/geometry/svg-path.js +7 -0
  736. package/dist/lib/geometry/svg-path.js.map +7 -0
  737. package/dist/lib/geometry/transform-bend.d.ts +46 -0
  738. package/dist/lib/geometry/transform-bend.js +219 -0
  739. package/dist/lib/geometry/transform-bend.js.map +7 -0
  740. package/dist/lib/geometry/transform-guide.d.ts +57 -0
  741. package/dist/lib/geometry/transform-guide.js +157 -0
  742. package/dist/lib/geometry/transform-guide.js.map +7 -0
  743. package/dist/lib/geometry/transform-math.d.ts +21 -0
  744. package/dist/lib/geometry/transform-math.js +91 -0
  745. package/dist/lib/geometry/transform-math.js.map +7 -0
  746. package/dist/lib/geometry/transform-mesh.d.ts +39 -0
  747. package/dist/lib/geometry/transform-mesh.js +129 -0
  748. package/dist/lib/geometry/transform-mesh.js.map +7 -0
  749. package/dist/lib/geometry/validation.d.ts +6 -0
  750. package/dist/lib/geometry/validation.js +42 -0
  751. package/dist/lib/geometry/validation.js.map +7 -0
  752. package/dist/lib/global-state.d.ts +63 -0
  753. package/dist/lib/global-state.js +176 -0
  754. package/dist/lib/global-state.js.map +7 -0
  755. package/dist/lib/hooks/hook-slot.d.ts +30 -0
  756. package/dist/lib/hooks/hook-slot.js +66 -0
  757. package/dist/lib/hooks/hook-slot.js.map +7 -0
  758. package/dist/lib/hooks/use-animated-value.d.ts +24 -0
  759. package/dist/lib/hooks/use-animated-value.js +169 -0
  760. package/dist/lib/hooks/use-animated-value.js.map +7 -0
  761. package/dist/lib/hooks/use-canvas-context.d.ts +10 -0
  762. package/dist/lib/hooks/use-canvas-context.js +13 -0
  763. package/dist/lib/hooks/use-canvas-context.js.map +7 -0
  764. package/dist/lib/hooks/use-computed.d.ts +13 -0
  765. package/dist/lib/hooks/use-computed.js +91 -0
  766. package/dist/lib/hooks/use-computed.js.map +7 -0
  767. package/dist/lib/hooks/use-const.d.ts +10 -0
  768. package/dist/lib/hooks/use-const.js +15 -0
  769. package/dist/lib/hooks/use-const.js.map +7 -0
  770. package/dist/lib/hooks/use-cursor.d.ts +16 -0
  771. package/dist/lib/hooks/use-cursor.js +51 -0
  772. package/dist/lib/hooks/use-cursor.js.map +7 -0
  773. package/dist/lib/hooks/use-event-listener.d.ts +10 -0
  774. package/dist/lib/hooks/use-event-listener.js +24 -0
  775. package/dist/lib/hooks/use-event-listener.js.map +7 -0
  776. package/dist/lib/hooks/use-event-target.d.ts +14 -0
  777. package/dist/lib/hooks/use-event-target.js +30 -0
  778. package/dist/lib/hooks/use-event-target.js.map +7 -0
  779. package/dist/lib/hooks/use-layout-box.d.ts +9 -0
  780. package/dist/lib/hooks/use-layout-box.js +8 -0
  781. package/dist/lib/hooks/use-layout-box.js.map +7 -0
  782. package/dist/lib/hooks/use-line-path.d.ts +14 -0
  783. package/dist/lib/hooks/use-line-path.js +13 -0
  784. package/dist/lib/hooks/use-line-path.js.map +7 -0
  785. package/dist/lib/hooks/use-paint-target.d.ts +3 -0
  786. package/dist/lib/hooks/use-paint-target.js +34 -0
  787. package/dist/lib/hooks/use-paint-target.js.map +7 -0
  788. package/dist/lib/hooks/use-playback.d.ts +21 -0
  789. package/dist/lib/hooks/use-playback.js +87 -0
  790. package/dist/lib/hooks/use-playback.js.map +7 -0
  791. package/dist/lib/hooks/use-reaction.d.ts +19 -0
  792. package/dist/lib/hooks/use-reaction.js +245 -0
  793. package/dist/lib/hooks/use-reaction.js.map +7 -0
  794. package/dist/lib/hooks/use-rect-path.d.ts +20 -0
  795. package/dist/lib/hooks/use-rect-path.js +25 -0
  796. package/dist/lib/hooks/use-rect-path.js.map +7 -0
  797. package/dist/lib/hooks/use-ref.d.ts +17 -0
  798. package/dist/lib/hooks/use-ref.js +8 -0
  799. package/dist/lib/hooks/use-ref.js.map +7 -0
  800. package/dist/lib/hooks/use-region.d.ts +11 -0
  801. package/dist/lib/hooks/use-region.js +34 -0
  802. package/dist/lib/hooks/use-region.js.map +7 -0
  803. package/dist/lib/hooks/use-signal.d.ts +12 -0
  804. package/dist/lib/hooks/use-signal.js +12 -0
  805. package/dist/lib/hooks/use-signal.js.map +7 -0
  806. package/dist/lib/hooks/use-svg-path.d.ts +11 -0
  807. package/dist/lib/hooks/use-svg-path.js +13 -0
  808. package/dist/lib/hooks/use-svg-path.js.map +7 -0
  809. package/dist/lib/hooks/use-value-memo-slot.d.ts +12 -0
  810. package/dist/lib/hooks/use-value-memo-slot.js +45 -0
  811. package/dist/lib/hooks/use-value-memo-slot.js.map +7 -0
  812. package/dist/lib/hooks/use-visibility-transition.d.ts +103 -0
  813. package/dist/lib/hooks/use-visibility-transition.js +195 -0
  814. package/dist/lib/hooks/use-visibility-transition.js.map +7 -0
  815. package/dist/lib/html/html-service.d.ts +30 -0
  816. package/dist/lib/html/html-service.js +281 -0
  817. package/dist/lib/html/html-service.js.map +7 -0
  818. package/dist/lib/html/overlay-config.d.ts +3 -0
  819. package/dist/lib/html/overlay-config.js +37 -0
  820. package/dist/lib/html/overlay-config.js.map +7 -0
  821. package/dist/lib/html/portable-clips.d.ts +4 -0
  822. package/dist/lib/html/portable-clips.js +20 -0
  823. package/dist/lib/html/portable-clips.js.map +7 -0
  824. package/dist/lib/html/types.d.ts +110 -0
  825. package/dist/lib/layout/absolute.d.ts +57 -0
  826. package/dist/lib/layout/absolute.js +348 -0
  827. package/dist/lib/layout/absolute.js.map +7 -0
  828. package/dist/lib/layout/box.d.ts +19 -0
  829. package/dist/lib/layout/box.js +209 -0
  830. package/dist/lib/layout/box.js.map +7 -0
  831. package/dist/lib/layout/context.d.ts +13 -0
  832. package/dist/lib/layout/context.js +42 -0
  833. package/dist/lib/layout/context.js.map +7 -0
  834. package/dist/lib/layout/diagnostics.d.ts +15 -0
  835. package/dist/lib/layout/diagnostics.js +30 -0
  836. package/dist/lib/layout/diagnostics.js.map +7 -0
  837. package/dist/lib/layout/flex.d.ts +64 -0
  838. package/dist/lib/layout/flex.js +803 -0
  839. package/dist/lib/layout/flex.js.map +7 -0
  840. package/dist/lib/layout/flow.d.ts +53 -0
  841. package/dist/lib/layout/flow.js +400 -0
  842. package/dist/lib/layout/flow.js.map +7 -0
  843. package/dist/lib/layout/grid.d.ts +64 -0
  844. package/dist/lib/layout/grid.js +597 -0
  845. package/dist/lib/layout/grid.js.map +7 -0
  846. package/dist/lib/layout/measure.d.ts +19 -0
  847. package/dist/lib/layout/measure.js +144 -0
  848. package/dist/lib/layout/measure.js.map +7 -0
  849. package/dist/lib/layout/overlay.d.ts +42 -0
  850. package/dist/lib/layout/overlay.js +151 -0
  851. package/dist/lib/layout/overlay.js.map +7 -0
  852. package/dist/lib/layout/place-child.d.ts +12 -0
  853. package/dist/lib/layout/place-child.js +72 -0
  854. package/dist/lib/layout/place-child.js.map +7 -0
  855. package/dist/lib/layout/positioning-diagnostics.d.ts +3 -0
  856. package/dist/lib/layout/positioning-diagnostics.js +15 -0
  857. package/dist/lib/layout/positioning-diagnostics.js.map +7 -0
  858. package/dist/lib/layout/types.d.ts +78 -0
  859. package/dist/lib/manipulation/controller-types.d.ts +299 -0
  860. package/dist/lib/manipulation/controller.d.ts +57 -0
  861. package/dist/lib/manipulation/controller.js +464 -0
  862. package/dist/lib/manipulation/controller.js.map +7 -0
  863. package/dist/lib/manipulation/coordinates.d.ts +9 -0
  864. package/dist/lib/manipulation/coordinates.js +55 -0
  865. package/dist/lib/manipulation/coordinates.js.map +7 -0
  866. package/dist/lib/manipulation/degrees.d.ts +10 -0
  867. package/dist/lib/manipulation/degrees.js +9 -0
  868. package/dist/lib/manipulation/degrees.js.map +7 -0
  869. package/dist/lib/manipulation/frame.d.ts +24 -0
  870. package/dist/lib/manipulation/frame.js +101 -0
  871. package/dist/lib/manipulation/frame.js.map +7 -0
  872. package/dist/lib/manipulation/geometry.d.ts +4 -0
  873. package/dist/lib/manipulation/geometry.js +26 -0
  874. package/dist/lib/manipulation/geometry.js.map +7 -0
  875. package/dist/lib/manipulation/handles.d.ts +298 -0
  876. package/dist/lib/manipulation/handles.js +598 -0
  877. package/dist/lib/manipulation/handles.js.map +7 -0
  878. package/dist/lib/manipulation/manipulable.d.ts +65 -0
  879. package/dist/lib/manipulation/manipulable.js +47 -0
  880. package/dist/lib/manipulation/manipulable.js.map +7 -0
  881. package/dist/lib/manipulation/ownership.d.ts +15 -0
  882. package/dist/lib/manipulation/ownership.js +80 -0
  883. package/dist/lib/manipulation/ownership.js.map +7 -0
  884. package/dist/lib/manipulation/snap.d.ts +6 -0
  885. package/dist/lib/manipulation/snap.js +40 -0
  886. package/dist/lib/manipulation/snap.js.map +7 -0
  887. package/dist/lib/manipulation/solve.d.ts +2 -0
  888. package/dist/lib/manipulation/solve.js +563 -0
  889. package/dist/lib/manipulation/solve.js.map +7 -0
  890. package/dist/lib/manipulation/types.d.ts +178 -0
  891. package/dist/lib/mount-pibbl.d.ts +25 -0
  892. package/dist/lib/mount-pibbl.js +278 -0
  893. package/dist/lib/mount-pibbl.js.map +7 -0
  894. package/dist/lib/optional-services.d.ts +8 -0
  895. package/dist/lib/optional-services.js +11 -0
  896. package/dist/lib/optional-services.js.map +7 -0
  897. package/dist/lib/pibbl.d.ts +17 -0
  898. package/dist/lib/pibbl.js +21 -0
  899. package/dist/lib/pibbl.js.map +7 -0
  900. package/dist/lib/primitive-presentation.d.ts +24 -0
  901. package/dist/lib/primitive-presentation.js +102 -0
  902. package/dist/lib/primitive-presentation.js.map +7 -0
  903. package/dist/lib/render-layer/controller.d.ts +67 -0
  904. package/dist/lib/render-layer/controller.js +603 -0
  905. package/dist/lib/render-layer/controller.js.map +7 -0
  906. package/dist/lib/render-layer/define-render-layer.d.ts +17 -0
  907. package/dist/lib/render-layer/define-render-layer.js +90 -0
  908. package/dist/lib/render-layer/define-render-layer.js.map +7 -0
  909. package/dist/lib/render-layer/types.d.ts +315 -0
  910. package/dist/lib/render-target.d.ts +27 -0
  911. package/dist/lib/render-target.js +118 -0
  912. package/dist/lib/render-target.js.map +7 -0
  913. package/dist/lib/render-transaction.d.ts +10 -0
  914. package/dist/lib/render-transaction.js +46 -0
  915. package/dist/lib/render-transaction.js.map +7 -0
  916. package/dist/lib/render.d.ts +3 -0
  917. package/dist/lib/render.js +385 -0
  918. package/dist/lib/render.js.map +7 -0
  919. package/dist/lib/scheduler/realm-scheduler.d.ts +52 -0
  920. package/dist/lib/scheduler/realm-scheduler.js +964 -0
  921. package/dist/lib/scheduler/realm-scheduler.js.map +7 -0
  922. package/dist/lib/scheduler/renderer-participant.d.ts +257 -0
  923. package/dist/lib/scheduler/renderer-participant.js +216 -0
  924. package/dist/lib/scheduler/renderer-participant.js.map +7 -0
  925. package/dist/lib/scheduler/simulation-participant.d.ts +103 -0
  926. package/dist/lib/scheduler/simulation-participant.js +229 -0
  927. package/dist/lib/scheduler/simulation-participant.js.map +7 -0
  928. package/dist/lib/scheduler/testing.d.ts +56 -0
  929. package/dist/lib/scheduler/testing.js +71 -0
  930. package/dist/lib/scheduler/testing.js.map +7 -0
  931. package/dist/lib/scheduler/types.d.ts +103 -0
  932. package/dist/lib/signals/edge.d.ts +44 -0
  933. package/dist/lib/signals/edge.js +245 -0
  934. package/dist/lib/signals/edge.js.map +7 -0
  935. package/dist/lib/signals/graph.d.ts +220 -0
  936. package/dist/lib/signals/graph.js +1035 -0
  937. package/dist/lib/signals/graph.js.map +7 -0
  938. package/dist/lib/signals/input-provision.d.ts +3 -0
  939. package/dist/lib/signals/input-provision.js +67 -0
  940. package/dist/lib/signals/input-provision.js.map +7 -0
  941. package/dist/lib/signals/render-consumer.d.ts +21 -0
  942. package/dist/lib/signals/render-consumer.js +218 -0
  943. package/dist/lib/signals/render-consumer.js.map +7 -0
  944. package/dist/lib/signals/resolve-signal-value.d.ts +10 -0
  945. package/dist/lib/signals/resolve-signal-value.js +17 -0
  946. package/dist/lib/signals/resolve-signal-value.js.map +7 -0
  947. package/dist/lib/signals/types.d.ts +80 -0
  948. package/dist/lib/style/diagnostics.d.ts +83 -0
  949. package/dist/lib/style/diagnostics.js +63 -0
  950. package/dist/lib/style/diagnostics.js.map +7 -0
  951. package/dist/lib/style/empty-style.d.ts +3 -0
  952. package/dist/lib/style/empty-style.js +5 -0
  953. package/dist/lib/style/empty-style.js.map +7 -0
  954. package/dist/lib/style/filter-types.d.ts +243 -0
  955. package/dist/lib/style/filter-types.js +5 -0
  956. package/dist/lib/style/filter-types.js.map +7 -0
  957. package/dist/lib/style/filter.d.ts +7 -0
  958. package/dist/lib/style/filter.js +50 -0
  959. package/dist/lib/style/filter.js.map +7 -0
  960. package/dist/lib/style/normalize.d.ts +18 -0
  961. package/dist/lib/style/normalize.js +50 -0
  962. package/dist/lib/style/normalize.js.map +7 -0
  963. package/dist/lib/style/positioning.d.ts +32 -0
  964. package/dist/lib/style/positioning.js +81 -0
  965. package/dist/lib/style/positioning.js.map +7 -0
  966. package/dist/lib/style/resolve-built-in.d.ts +6 -0
  967. package/dist/lib/style/resolve-built-in.js +58 -0
  968. package/dist/lib/style/resolve-built-in.js.map +7 -0
  969. package/dist/lib/style/resolve-dispatch.d.ts +20 -0
  970. package/dist/lib/style/resolve-dispatch.js +167 -0
  971. package/dist/lib/style/resolve-dispatch.js.map +7 -0
  972. package/dist/lib/style/resolve-length.d.ts +16 -0
  973. package/dist/lib/style/resolve-length.js +54 -0
  974. package/dist/lib/style/resolve-length.js.map +7 -0
  975. package/dist/lib/style/responsive.d.ts +31 -0
  976. package/dist/lib/style/responsive.js +172 -0
  977. package/dist/lib/style/responsive.js.map +7 -0
  978. package/dist/lib/style/types.d.ts +338 -0
  979. package/dist/lib/surface/resolve-surface.d.ts +4 -0
  980. package/dist/lib/surface/resolve-surface.js +184 -0
  981. package/dist/lib/surface/resolve-surface.js.map +7 -0
  982. package/dist/lib/surface/root-surface.d.ts +7 -0
  983. package/dist/lib/surface/root-surface.js +171 -0
  984. package/dist/lib/surface/root-surface.js.map +7 -0
  985. package/dist/lib/surface/transform.d.ts +4 -0
  986. package/dist/lib/surface/transform.js +16 -0
  987. package/dist/lib/surface/transform.js.map +7 -0
  988. package/dist/lib/surface/types.d.ts +132 -0
  989. package/dist/lib/teardowns.d.ts +14 -0
  990. package/dist/lib/teardowns.js +50 -0
  991. package/dist/lib/teardowns.js.map +7 -0
  992. package/dist/lib/textures/texture-protocol.d.ts +124 -0
  993. package/dist/lib/textures/texture-protocol.js +40 -0
  994. package/dist/lib/textures/texture-protocol.js.map +7 -0
  995. package/dist/lib/textures/texture.d.ts +170 -0
  996. package/dist/lib/textures/texture.js +385 -0
  997. package/dist/lib/textures/texture.js.map +7 -0
  998. package/dist/lib/transitions/bifrost.d.ts +47 -0
  999. package/dist/lib/transitions/bifrost.js +91 -0
  1000. package/dist/lib/transitions/bifrost.js.map +7 -0
  1001. package/dist/lib/transitions/binding.d.ts +14 -0
  1002. package/dist/lib/transitions/binding.js +35 -0
  1003. package/dist/lib/transitions/binding.js.map +7 -0
  1004. package/dist/lib/transitions/capture.d.ts +21 -0
  1005. package/dist/lib/transitions/capture.js +91 -0
  1006. package/dist/lib/transitions/capture.js.map +7 -0
  1007. package/dist/lib/transitions/common.d.ts +130 -0
  1008. package/dist/lib/transitions/common.js +57 -0
  1009. package/dist/lib/transitions/common.js.map +7 -0
  1010. package/dist/lib/transitions/define-transition.d.ts +64 -0
  1011. package/dist/lib/transitions/define-transition.js +31 -0
  1012. package/dist/lib/transitions/define-transition.js.map +7 -0
  1013. package/dist/lib/transitions/embers-physics.d.ts +114 -0
  1014. package/dist/lib/transitions/embers-physics.js +161 -0
  1015. package/dist/lib/transitions/embers-physics.js.map +7 -0
  1016. package/dist/lib/transitions/embers.d.ts +67 -0
  1017. package/dist/lib/transitions/embers.js +196 -0
  1018. package/dist/lib/transitions/embers.js.map +7 -0
  1019. package/dist/lib/transitions/fade.d.ts +41 -0
  1020. package/dist/lib/transitions/fade.js +31 -0
  1021. package/dist/lib/transitions/fade.js.map +7 -0
  1022. package/dist/lib/transitions/hologram.d.ts +47 -0
  1023. package/dist/lib/transitions/hologram.js +94 -0
  1024. package/dist/lib/transitions/hologram.js.map +7 -0
  1025. package/dist/lib/transitions/wasm/bifrost-bytes.d.ts +1 -0
  1026. package/dist/lib/transitions/wasm/bifrost-bytes.js +5 -0
  1027. package/dist/lib/transitions/wasm/bifrost-bytes.js.map +7 -0
  1028. package/dist/lib/transitions/wasm/bifrost-kernel.d.ts +1 -0
  1029. package/dist/lib/transitions/wasm/bifrost-kernel.js +27 -0
  1030. package/dist/lib/transitions/wasm/bifrost-kernel.js.map +7 -0
  1031. package/dist/lib/transitions/wasm/embers-bytes.d.ts +1 -0
  1032. package/dist/lib/transitions/wasm/embers-bytes.js +5 -0
  1033. package/dist/lib/transitions/wasm/embers-bytes.js.map +7 -0
  1034. package/dist/lib/transitions/wasm/hologram-bytes.d.ts +1 -0
  1035. package/dist/lib/transitions/wasm/hologram-bytes.js +5 -0
  1036. package/dist/lib/transitions/wasm/hologram-bytes.js.map +7 -0
  1037. package/dist/lib/transitions/wasm/kernel.d.ts +7 -0
  1038. package/dist/lib/transitions/wasm/kernel.js +26 -0
  1039. package/dist/lib/transitions/wasm/kernel.js.map +7 -0
  1040. package/dist/lib/types.d.ts +570 -0
  1041. package/dist/lib/update.d.ts +8 -0
  1042. package/dist/lib/update.js +20 -0
  1043. package/dist/lib/update.js.map +7 -0
  1044. package/dist/lib/util/get-2d-context.d.ts +2 -0
  1045. package/dist/lib/util/get-2d-context.js +11 -0
  1046. package/dist/lib/util/get-2d-context.js.map +7 -0
  1047. package/dist/lib/util/get-mouse-coordinates.d.ts +2 -0
  1048. package/dist/lib/util/get-mouse-coordinates.js +32 -0
  1049. package/dist/lib/util/get-mouse-coordinates.js.map +7 -0
  1050. package/dist/lib/util/is-hit.d.ts +11 -0
  1051. package/dist/lib/util/is-hit.js +52 -0
  1052. package/dist/lib/util/is-hit.js.map +7 -0
  1053. package/dist/lib/util/is-transparent.d.ts +1 -0
  1054. package/dist/lib/util/is-transparent.js +8 -0
  1055. package/dist/lib/util/is-transparent.js.map +7 -0
  1056. package/dist/lib/util/pixel-grid-adjustments.d.ts +8 -0
  1057. package/dist/lib/util/pixel-grid-adjustments.js +28 -0
  1058. package/dist/lib/util/pixel-grid-adjustments.js.map +7 -0
  1059. package/dist/lib/util/push-clipping-path.d.ts +6 -0
  1060. package/dist/lib/util/push-clipping-path.js +28 -0
  1061. package/dist/lib/util/push-clipping-path.js.map +7 -0
  1062. package/dist/lib/util/wire-common-events.d.ts +2 -0
  1063. package/dist/lib/util/wire-common-events.js +15 -0
  1064. package/dist/lib/util/wire-common-events.js.map +7 -0
  1065. package/dist/types.d.ts +1 -0
  1066. package/dist/types.js +1 -0
  1067. package/dist/types.js.map +7 -0
  1068. package/dist/types.mjs +1 -0
  1069. package/package.json +149 -0
@@ -0,0 +1,2398 @@
1
+ import {
2
+ createSignalCommitBatch,
3
+ getSignalNode,
4
+ withSignalWriteForbidden
5
+ } from "../signals/graph.js";
6
+ import {
7
+ activateSeekableDefinition,
8
+ getDefinitionRecord,
9
+ getSeekableDefinitionBoundaryValue,
10
+ getStaticSeekableDefinitionBoundaryValue,
11
+ sampleActivatedSeekableDefinition,
12
+ snapshotAnimationActivationValue
13
+ } from "./definition.js";
14
+ import {
15
+ getExactSeekableProgramDuration,
16
+ getProgramRecord,
17
+ repeatResolvedWriterSchedules,
18
+ resolvedWriterSchedulesOverlap,
19
+ requiresProgramActivationWriterSafety
20
+ } from "./program.js";
21
+ const unknownDiscoveredValue = /* @__PURE__ */ Symbol("unknown animation discovery value");
22
+ const activationRecords = /* @__PURE__ */ new WeakMap();
23
+ const activationStepperKeys = /* @__PURE__ */ new WeakMap();
24
+ let activeStepperStates = 0;
25
+ let acquiredStepperStates = 0;
26
+ let releasedStepperStates = 0;
27
+ function animationEvaluationOwnershipSnapshot() {
28
+ return Object.freeze({
29
+ activeStepperStates,
30
+ acquiredStepperStates,
31
+ releasedStepperStates
32
+ });
33
+ }
34
+ function registerActivationStepperKeys(activation, keys) {
35
+ const snapshot = new Set(keys);
36
+ activationStepperKeys.set(activation, snapshot);
37
+ activeStepperStates += snapshot.size;
38
+ acquiredStepperStates += snapshot.size;
39
+ }
40
+ function reconcileActivationStepperKeys(activation) {
41
+ const tracked = activationStepperKeys.get(activation);
42
+ const record = activationRecords.get(activation);
43
+ if (tracked === void 0 || record === void 0) return;
44
+ const next = new Set(record.steppers.keys());
45
+ for (const key of tracked) {
46
+ if (next.has(key)) continue;
47
+ tracked.delete(key);
48
+ activeStepperStates--;
49
+ releasedStepperStates++;
50
+ }
51
+ for (const key of next) {
52
+ if (tracked.has(key)) continue;
53
+ tracked.add(key);
54
+ activeStepperStates++;
55
+ acquiredStepperStates++;
56
+ }
57
+ }
58
+ function releaseActivationStepperKeys(activation) {
59
+ const tracked = activationStepperKeys.get(activation);
60
+ if (tracked === void 0) return;
61
+ activeStepperStates -= tracked.size;
62
+ releasedStepperStates += tracked.size;
63
+ activationStepperKeys.delete(activation);
64
+ }
65
+ const baselineWriter = Object.freeze({ name: "Pibbl animation activation baseline" });
66
+ const directRepeatSelection = /* @__PURE__ */ new WeakMap();
67
+ const containsStepperDefinition = /* @__PURE__ */ new WeakMap();
68
+ const maximumZeroDurationOccurrencesPerEvaluation = 512;
69
+ class StepperCallbackError extends Error {
70
+ constructor(message, cause) {
71
+ super(message);
72
+ this.cause = cause;
73
+ this.name = "StepperCallbackError";
74
+ }
75
+ cause;
76
+ }
77
+ function stepperLabel(debugName) {
78
+ return debugName === void 0 ? "Pibbl animation stepper" : `Pibbl animation stepper "${debugName}"`;
79
+ }
80
+ function reserveZeroDurationOccurrence(state, label, path, repeatIterations) {
81
+ if (state.zeroDurationOccurrences.value >= maximumZeroDurationOccurrencesPerEvaluation) {
82
+ const repeats = repeatIterations.length === 0 ? "" : `, repeat iterations [${repeatIterations.join(", ")}]`;
83
+ throw new RangeError(
84
+ `Pibbl animation zero-duration occurrence budget of ${maximumZeroDurationOccurrencesPerEvaluation} was exhausted before ${label} at program path [${path.join(", ")}]${repeats}, frame ${state.frameId}.`
85
+ );
86
+ }
87
+ state.zeroDurationOccurrences.value++;
88
+ }
89
+ function reservePotentialZeroDurationStepperOccurrence(state, debugName, path, repeatIterations) {
90
+ reserveZeroDurationOccurrence(
91
+ state,
92
+ stepperLabel(debugName),
93
+ path,
94
+ repeatIterations
95
+ );
96
+ }
97
+ function invokeStepperCallback(debugName, callbackName, path, repeatIterations, frameId, localTime, callback) {
98
+ try {
99
+ return withSignalWriteForbidden(
100
+ `${stepperLabel(debugName)} callbacks cannot write to signals.`,
101
+ callback
102
+ );
103
+ } catch (error) {
104
+ const repeats = repeatIterations.length === 0 ? "" : `, repeat iterations [${repeatIterations.join(", ")}]`;
105
+ const detail = error instanceof Error ? `: ${error.message}` : "";
106
+ throw new StepperCallbackError(
107
+ `${stepperLabel(debugName)} ${callbackName} callback failed at program path [${path.join(", ")}]${repeats}, frame ${frameId}, local time ${localTime}${detail}`,
108
+ error
109
+ );
110
+ }
111
+ }
112
+ function validateStepperOutput(value, debugName) {
113
+ if (typeof value === "number" && !Number.isFinite(value)) {
114
+ throw new RangeError(
115
+ `${stepperLabel(debugName)} read callback produced a nonfinite value.`
116
+ );
117
+ }
118
+ return value;
119
+ }
120
+ function programContainsStepper(program) {
121
+ const cached = containsStepperDefinition.get(program);
122
+ if (cached !== void 0) return cached;
123
+ const record = getProgramRecord(program);
124
+ const contains = record.kind === "track" ? getDefinitionRecord(record.definition).kind === "stepper" : record.children.some(programContainsStepper);
125
+ containsStepperDefinition.set(program, contains);
126
+ return contains;
127
+ }
128
+ function knownProgramTerminalDuration(record) {
129
+ const exact = getExactSeekableProgramDuration(record.program);
130
+ if (exact !== void 0 && Number.isFinite(exact)) return exact;
131
+ return record.terminalDuration;
132
+ }
133
+ function validateActivationWriterSafety(program, originalValues) {
134
+ if (!requiresProgramActivationWriterSafety(program)) return;
135
+ if (!programContainsStepper(program)) {
136
+ const discoveryState = createDiscoveryState(originalValues, /* @__PURE__ */ new Map(), true);
137
+ discoverNode(program, Number.POSITIVE_INFINITY, discoveryState, [], []);
138
+ return;
139
+ }
140
+ for (const child of getProgramRecord(program).children) {
141
+ validateActivationWriterSafety(child, originalValues);
142
+ }
143
+ }
144
+ function freezePath(path) {
145
+ return Object.freeze([...path]);
146
+ }
147
+ function immutableMap(source) {
148
+ const target = new Map(source);
149
+ const proxy = new Proxy(target, {
150
+ get(map, key) {
151
+ if (key === "set" || key === "delete" || key === "clear") {
152
+ return () => {
153
+ throw new TypeError("Cannot mutate an animation activation snapshot.");
154
+ };
155
+ }
156
+ const member = Reflect.get(map, key, map);
157
+ return typeof member === "function" ? member.bind(map) : member;
158
+ },
159
+ set() {
160
+ return false;
161
+ },
162
+ defineProperty() {
163
+ return false;
164
+ },
165
+ deleteProperty() {
166
+ return false;
167
+ }
168
+ });
169
+ return Object.freeze(proxy);
170
+ }
171
+ function activationRecord(activation) {
172
+ const record = activationRecords.get(activation);
173
+ if (record === void 0) throw new TypeError("Expected a Pibbl animation program activation.");
174
+ return record;
175
+ }
176
+ function instanceKey(path, repeatIterations) {
177
+ return JSON.stringify([path, repeatIterations]);
178
+ }
179
+ function stepperFrameBudgetKey(path) {
180
+ return JSON.stringify(path);
181
+ }
182
+ function assertProgramTime(value, label) {
183
+ if (!Number.isFinite(value)) {
184
+ throw new RangeError(`Pibbl animation ${label} must be finite.`);
185
+ }
186
+ }
187
+ function assertEvaluationInput(input) {
188
+ assertProgramTime(input.time, "program time");
189
+ if (input.previousTime !== void 0) {
190
+ assertProgramTime(input.previousTime, "previous program time");
191
+ }
192
+ if (input.direction !== "forward" && input.direction !== "reverse") {
193
+ throw new TypeError("Pibbl animation traversal direction must be forward or reverse.");
194
+ }
195
+ if (!Number.isFinite(input.frameId)) {
196
+ throw new RangeError("Pibbl animation frame identity must be finite.");
197
+ }
198
+ if (typeof input.writer !== "object" || input.writer === null) {
199
+ throw new TypeError("Pibbl animation writer token must be an object.");
200
+ }
201
+ }
202
+ function seedOriginalValues(record) {
203
+ const batch = createSignalCommitBatch();
204
+ for (const [output, value] of record.originalValues) {
205
+ batch.stage(output, value, baselineWriter);
206
+ }
207
+ return batch;
208
+ }
209
+ function setDuration(state, path, repeatIterations, duration) {
210
+ if (duration !== void 0) {
211
+ state.durations.set(instanceKey(path, repeatIterations), duration);
212
+ }
213
+ }
214
+ function knownDuration(program, state, path, repeatIterations) {
215
+ const key = instanceKey(path, repeatIterations);
216
+ const resolved = state.durations.get(key);
217
+ if (resolved !== void 0) return resolved;
218
+ const record = getProgramRecord(program);
219
+ if (record.kind === "track") {
220
+ const start = state.starts.get(key);
221
+ if (start !== void 0) return start.definition.duration;
222
+ const terminal = state.terminalSteppers.get(key);
223
+ if (terminal !== void 0) return terminal.terminalTime;
224
+ }
225
+ return getExactSeekableProgramDuration(program);
226
+ }
227
+ function canDirectlySelectRepeat(program) {
228
+ const cached = directRepeatSelection.get(program);
229
+ if (cached !== void 0) return cached;
230
+ const record = getProgramRecord(program);
231
+ let direct;
232
+ if (record.kind === "track") {
233
+ const definition = getDefinitionRecord(record.definition);
234
+ direct = definition.kind === "keyframes" || definition.kind === "tween" && definition.hasFrom || definition.kind === "spring" && definition.hasFrom;
235
+ } else {
236
+ direct = record.kind === "wait" || record.kind === "marker" || record.children.every(canDirectlySelectRepeat);
237
+ }
238
+ directRepeatSelection.set(program, direct);
239
+ return direct;
240
+ }
241
+ function needsCallbackFreeDurationSeed(program) {
242
+ const record = getProgramRecord(program);
243
+ if (record.kind === "repeat" && record.direction !== "normal" && getExactSeekableProgramDuration(record.children[0]) === void 0) {
244
+ return true;
245
+ }
246
+ return record.children.some(needsCallbackFreeDurationSeed);
247
+ }
248
+ function discoveredWrites(...sources) {
249
+ const writes = /* @__PURE__ */ new Map();
250
+ for (const source of sources) {
251
+ for (const [output, value] of source) writes.set(output, value);
252
+ }
253
+ return writes;
254
+ }
255
+ function chronologicalEndWrites(children, failClosedOnUnknownTiming = false) {
256
+ const selected = /* @__PURE__ */ new Map();
257
+ for (const child of children) {
258
+ for (const [output, value] of child.endWrites) {
259
+ let end = Number.NEGATIVE_INFINITY;
260
+ for (const writerSpan of child.writers) {
261
+ if (writerSpan.output === output) {
262
+ const resolvedEnd = writerSpan.repeats.reduce(
263
+ (writerEnd, repeat) => writerEnd + (repeat.iterations - 1) * repeat.period,
264
+ writerSpan.end
265
+ );
266
+ end = Math.max(end, resolvedEnd);
267
+ }
268
+ }
269
+ const current = selected.get(output);
270
+ if (current === void 0) {
271
+ selected.set(output, {
272
+ end,
273
+ value,
274
+ timingUnknown: child.duration === void 0
275
+ });
276
+ } else if (failClosedOnUnknownTiming && (child.duration === void 0 || current.timingUnknown)) {
277
+ selected.set(output, {
278
+ end: Number.POSITIVE_INFINITY,
279
+ value: unknownDiscoveredValue,
280
+ timingUnknown: true
281
+ });
282
+ } else if (end >= current.end) {
283
+ selected.set(output, { end, value, timingUnknown: false });
284
+ }
285
+ }
286
+ }
287
+ return new Map([...selected].map(
288
+ ([output, selectedValue]) => [output, selectedValue.value]
289
+ ));
290
+ }
291
+ function applyDiscoveredWrites(values, writes) {
292
+ for (const [output, value] of writes) values.set(output, value);
293
+ }
294
+ function unknownRepeatDiscovery(program, outputs, state, path, repeatIterations) {
295
+ const duration = getExactSeekableProgramDuration(program);
296
+ const writes = new Map(outputs.map(
297
+ (output) => [output, unknownDiscoveredValue]
298
+ ));
299
+ applyDiscoveredWrites(state.values, writes);
300
+ if (duration !== void 0) {
301
+ state.durations.set(instanceKey(path, repeatIterations), duration);
302
+ }
303
+ const writerEnd = duration ?? Number.POSITIVE_INFINITY;
304
+ return {
305
+ duration,
306
+ writers: Object.freeze(outputs.map((output) => Object.freeze({
307
+ output,
308
+ start: 0,
309
+ end: writerEnd,
310
+ programPath: freezePath(path),
311
+ repeatIterations: freezePath(repeatIterations),
312
+ repeats: Object.freeze([])
313
+ }))),
314
+ startWrites: writes,
315
+ endWrites: writes
316
+ };
317
+ }
318
+ function shiftedResolvedWriters(writers, offset) {
319
+ return writers.map((writerSpan) => Object.freeze({
320
+ ...writerSpan,
321
+ start: writerSpan.start + offset,
322
+ end: writerSpan.end + offset
323
+ }));
324
+ }
325
+ function resolvedWriterLabel(writerSpan) {
326
+ const iterations = writerSpan.repeatIterations.length === 0 ? "" : ` in repeat iterations [${writerSpan.repeatIterations.join(", ")}]`;
327
+ return `[${writerSpan.programPath.join(", ")}]${iterations}`;
328
+ }
329
+ function assertResolvedWritersDisjoint(first, second, state) {
330
+ if (!state.validateWriters) return;
331
+ for (const firstWriter of first) {
332
+ for (const secondWriter of second) {
333
+ if (firstWriter.output !== secondWriter.output) continue;
334
+ const firstSchedule = {
335
+ output: firstWriter.output,
336
+ start: firstWriter.start,
337
+ end: firstWriter.end,
338
+ path: firstWriter.programPath,
339
+ repeats: firstWriter.repeats
340
+ };
341
+ const secondSchedule = {
342
+ output: secondWriter.output,
343
+ start: secondWriter.start,
344
+ end: secondWriter.end,
345
+ path: secondWriter.programPath,
346
+ repeats: secondWriter.repeats
347
+ };
348
+ if (resolvedWriterSchedulesOverlap(firstSchedule, secondSchedule)) {
349
+ const name = getSignalNode(firstWriter.output).debugName ?? "<unnamed signal>";
350
+ throw new RangeError(
351
+ `Pibbl animation activation-dependent writer schedules at paths ${resolvedWriterLabel(firstWriter)} and ${resolvedWriterLabel(secondWriter)} overlap for signal "${name}".`
352
+ );
353
+ }
354
+ }
355
+ }
356
+ }
357
+ function discoverTrack(program, state, path, repeatIterations) {
358
+ const record = getProgramRecord(program);
359
+ if (record.kind !== "track") throw new Error("Expected an animation track record.");
360
+ const key = instanceKey(path, repeatIterations);
361
+ const definitionRecord = getDefinitionRecord(record.definition);
362
+ if (definitionRecord.kind === "stepper") {
363
+ const terminal = state.terminalSteppers.get(key);
364
+ if (terminal === void 0) {
365
+ if (state.validateWriters) {
366
+ throw new RangeError(
367
+ `Pibbl animation activation-dependent writer schedule at path [${path.join(", ")}] contains a stepper whose terminal time is not discovered.`
368
+ );
369
+ }
370
+ return {
371
+ duration: void 0,
372
+ writers: Object.freeze([]),
373
+ startWrites: /* @__PURE__ */ new Map([[record.output, unknownDiscoveredValue]]),
374
+ endWrites: /* @__PURE__ */ new Map([[record.output, unknownDiscoveredValue]])
375
+ };
376
+ }
377
+ state.durations.set(key, terminal.terminalTime);
378
+ state.values.set(record.output, terminal.finalValue);
379
+ return {
380
+ duration: terminal.terminalTime,
381
+ writers: Object.freeze([Object.freeze({
382
+ output: record.output,
383
+ start: 0,
384
+ end: terminal.terminalTime,
385
+ programPath: freezePath(path),
386
+ repeatIterations: freezePath(repeatIterations),
387
+ repeats: Object.freeze([])
388
+ })]),
389
+ startWrites: /* @__PURE__ */ new Map([[record.output, terminal.activationInput]]),
390
+ endWrites: /* @__PURE__ */ new Map([[record.output, terminal.finalValue]])
391
+ };
392
+ }
393
+ let start = state.starts.get(key);
394
+ if (start === void 0) {
395
+ const initialValue = state.values.has(record.output) ? state.values.get(record.output) : unknownDiscoveredValue;
396
+ const needsCapturedInput = definitionRecord.kind === "spring" && !definitionRecord.hasFrom || definitionRecord.kind === "tween" && !definitionRecord.hasFrom;
397
+ if (state.validateInputs && needsCapturedInput && initialValue === unknownDiscoveredValue) {
398
+ const label = definitionRecord.debugName === void 0 ? "Pibbl animation definition" : `Pibbl animation definition "${definitionRecord.debugName}"`;
399
+ throw new TypeError(
400
+ `${label} activation input could not be determined callback-free at program path [${path.join(", ")}].`
401
+ );
402
+ }
403
+ if (initialValue !== unknownDiscoveredValue) {
404
+ if (state.validateInputs && definitionRecord.kind === "tween" && !definitionRecord.hasFrom && definitionRecord.interpolate === void 0 && (typeof initialValue !== "number" || typeof definitionRecord.to !== "number")) {
405
+ const label = definitionRecord.debugName === void 0 ? "Pibbl animation definition" : `Pibbl animation definition "${definitionRecord.debugName}"`;
406
+ throw new TypeError(
407
+ `${label} requires an explicit interpolator for nonnumeric values.`
408
+ );
409
+ }
410
+ const definition = activateSeekableDefinition(
411
+ record.definition,
412
+ initialValue,
413
+ state.snapshots
414
+ );
415
+ start = Object.freeze({
416
+ programPath: freezePath(path),
417
+ repeatIterations: freezePath(repeatIterations),
418
+ initialValue: definition.initialValue,
419
+ definition
420
+ });
421
+ state.starts.set(key, start);
422
+ }
423
+ }
424
+ const duration = start?.definition.duration ?? getExactSeekableProgramDuration(program);
425
+ if (duration === void 0 || duration === Number.POSITIVE_INFINITY) {
426
+ throw new TypeError(
427
+ "Stateful or value-dependent animation timing could not be discovered callback-free."
428
+ );
429
+ }
430
+ state.durations.set(key, duration);
431
+ let startValue = unknownDiscoveredValue;
432
+ let endValue = unknownDiscoveredValue;
433
+ if (start !== void 0) {
434
+ const first = getSeekableDefinitionBoundaryValue(start.definition, "start");
435
+ const last = getSeekableDefinitionBoundaryValue(start.definition, "end");
436
+ if (first.kind === "known") startValue = first.value;
437
+ if (last.kind === "known") endValue = last.value;
438
+ } else {
439
+ const first = getStaticSeekableDefinitionBoundaryValue(record.definition, "start");
440
+ const last = getStaticSeekableDefinitionBoundaryValue(record.definition, "end");
441
+ if (first.kind === "known") startValue = first.value;
442
+ if (last.kind === "known") endValue = last.value;
443
+ }
444
+ const startWrites = /* @__PURE__ */ new Map([[record.output, startValue]]);
445
+ const endWrites = /* @__PURE__ */ new Map([[record.output, endValue]]);
446
+ state.values.set(record.output, endValue);
447
+ return {
448
+ duration,
449
+ writers: Object.freeze([Object.freeze({
450
+ output: record.output,
451
+ start: 0,
452
+ end: duration,
453
+ programPath: freezePath(path),
454
+ repeatIterations: freezePath(repeatIterations),
455
+ repeats: Object.freeze([])
456
+ })]),
457
+ startWrites,
458
+ endWrites
459
+ };
460
+ }
461
+ function discoveredValuesEqual(first, second) {
462
+ if (first.size !== second.size) return false;
463
+ for (const [output, value] of first) {
464
+ if (!second.has(output) || !Object.is(value, second.get(output))) return false;
465
+ }
466
+ return true;
467
+ }
468
+ function symbolicRepeatWriters(writers, period, iterations, offset = 0) {
469
+ const schedules = repeatResolvedWriterSchedules(writers.map((writerSpan) => ({
470
+ output: writerSpan.output,
471
+ start: writerSpan.start + offset,
472
+ end: writerSpan.end + offset,
473
+ path: writerSpan.programPath,
474
+ repeats: writerSpan.repeats
475
+ })), period, iterations);
476
+ return Object.freeze(schedules.map((schedule, index) => Object.freeze({
477
+ output: schedule.output,
478
+ start: schedule.start,
479
+ end: schedule.end,
480
+ programPath: freezePath(schedule.path),
481
+ repeatIterations: writers[index].repeatIterations,
482
+ repeats: schedule.repeats
483
+ })));
484
+ }
485
+ function applyIterationEnd(state, baseline, discovered, reversed) {
486
+ const writes = reversed ? discovered.startWrites : discovered.endWrites;
487
+ state.values.clear();
488
+ for (const [output, value] of baseline) state.values.set(output, value);
489
+ applyDiscoveredWrites(state.values, writes);
490
+ return writes;
491
+ }
492
+ function discoverNode(program, requestedTime, state, path, repeatIterations) {
493
+ const record = getProgramRecord(program);
494
+ const localTime = Math.max(0, requestedTime);
495
+ if (record.kind === "track") {
496
+ return discoverTrack(program, state, path, repeatIterations);
497
+ }
498
+ if (record.kind === "wait" || record.kind === "marker") {
499
+ const duration = record.kind === "wait" && record.duration.kind === "finite" ? record.duration.milliseconds : 0;
500
+ state.durations.set(instanceKey(path, repeatIterations), duration);
501
+ return {
502
+ duration,
503
+ writers: Object.freeze([]),
504
+ startWrites: /* @__PURE__ */ new Map(),
505
+ endWrites: /* @__PURE__ */ new Map()
506
+ };
507
+ }
508
+ if (record.kind === "sequence") {
509
+ if (state.validateInputs) {
510
+ let elapsed3 = 0;
511
+ const writers3 = [];
512
+ const startWrites2 = /* @__PURE__ */ new Map();
513
+ const endWrites2 = /* @__PURE__ */ new Map();
514
+ let startBoundaryOpen2 = true;
515
+ for (let index = 0; index < record.children.length; index++) {
516
+ const discovered = discoverNode(
517
+ record.children[index],
518
+ Number.POSITIVE_INFINITY,
519
+ state,
520
+ [...path, index],
521
+ repeatIterations
522
+ );
523
+ writers3.push(...shiftedResolvedWriters(
524
+ discovered.writers,
525
+ elapsed3 ?? Number.POSITIVE_INFINITY
526
+ ));
527
+ if (startBoundaryOpen2) {
528
+ applyDiscoveredWrites(startWrites2, discovered.startWrites);
529
+ if (discovered.duration === 0) {
530
+ applyDiscoveredWrites(startWrites2, discovered.endWrites);
531
+ } else {
532
+ startBoundaryOpen2 = false;
533
+ }
534
+ }
535
+ applyDiscoveredWrites(endWrites2, discovered.endWrites);
536
+ applyDiscoveredWrites(state.values, discovered.endWrites);
537
+ elapsed3 = elapsed3 === void 0 || discovered.duration === void 0 ? void 0 : elapsed3 + discovered.duration;
538
+ }
539
+ if (elapsed3 !== void 0) {
540
+ state.durations.set(instanceKey(path, repeatIterations), elapsed3);
541
+ }
542
+ return { duration: elapsed3, writers: Object.freeze(writers3), startWrites: startWrites2, endWrites: endWrites2 };
543
+ }
544
+ let remaining2 = localTime;
545
+ let elapsed2 = 0;
546
+ const writers2 = [];
547
+ const startWrites = /* @__PURE__ */ new Map();
548
+ const endWrites = /* @__PURE__ */ new Map();
549
+ let startBoundaryOpen = true;
550
+ let stoppedAt;
551
+ for (let index = 0; index < record.children.length; index++) {
552
+ const child = record.children[index];
553
+ const discovered = discoverNode(
554
+ child,
555
+ remaining2,
556
+ state,
557
+ [...path, index],
558
+ repeatIterations
559
+ );
560
+ writers2.push(...shiftedResolvedWriters(discovered.writers, elapsed2));
561
+ if (startBoundaryOpen) {
562
+ applyDiscoveredWrites(startWrites, discovered.startWrites);
563
+ if (discovered.duration === 0) {
564
+ applyDiscoveredWrites(startWrites, discovered.endWrites);
565
+ } else {
566
+ startBoundaryOpen = false;
567
+ }
568
+ }
569
+ applyDiscoveredWrites(endWrites, discovered.endWrites);
570
+ if (discovered.duration === void 0 || remaining2 < discovered.duration) {
571
+ stoppedAt = index;
572
+ break;
573
+ }
574
+ elapsed2 += discovered.duration;
575
+ remaining2 = Math.max(0, remaining2 - discovered.duration);
576
+ }
577
+ let duration = stoppedAt === void 0 ? elapsed2 : void 0;
578
+ if (stoppedAt !== void 0) {
579
+ const activeDuration = state.durations.get(instanceKey(
580
+ [...path, stoppedAt],
581
+ repeatIterations
582
+ ));
583
+ duration = activeDuration === void 0 ? void 0 : elapsed2 + activeDuration;
584
+ for (let index = stoppedAt + 1; duration !== void 0 && index < record.children.length; index++) {
585
+ const childDuration = getExactSeekableProgramDuration(record.children[index]);
586
+ duration = childDuration === void 0 ? void 0 : duration + childDuration;
587
+ }
588
+ }
589
+ if (duration !== void 0) state.durations.set(instanceKey(path, repeatIterations), duration);
590
+ return { duration, writers: Object.freeze(writers2), startWrites, endWrites };
591
+ }
592
+ if (record.kind === "parallel") {
593
+ const baseline = new Map(state.values);
594
+ const children = [];
595
+ let duration = 0;
596
+ for (let index = 0; index < record.children.length; index++) {
597
+ const branchState = { ...state, values: new Map(baseline) };
598
+ const child = discoverNode(
599
+ record.children[index],
600
+ localTime,
601
+ branchState,
602
+ [...path, index],
603
+ repeatIterations
604
+ );
605
+ for (const previous of children) {
606
+ assertResolvedWritersDisjoint(previous.writers, child.writers, state);
607
+ }
608
+ children.push(child);
609
+ duration = duration === void 0 || child.duration === void 0 ? void 0 : Math.max(duration, child.duration);
610
+ }
611
+ const startWrites = discoveredWrites(...children.map((child) => child.startWrites));
612
+ const endWrites = chronologicalEndWrites(children, state.validateInputs);
613
+ state.values.clear();
614
+ for (const [output, value] of baseline) state.values.set(output, value);
615
+ applyDiscoveredWrites(state.values, endWrites);
616
+ if (duration !== void 0) state.durations.set(instanceKey(path, repeatIterations), duration);
617
+ return {
618
+ duration,
619
+ writers: Object.freeze(children.flatMap((child) => child.writers)),
620
+ startWrites,
621
+ endWrites
622
+ };
623
+ }
624
+ if ((state.validateWriters || state.validateInputs) && record.iterations > 1) {
625
+ const child = record.children[0];
626
+ const initialValues = new Map(state.values);
627
+ const firstReversed = record.direction === "reverse" || record.direction === "alternate-reverse";
628
+ const first = discoverNode(
629
+ child,
630
+ Number.POSITIVE_INFINITY,
631
+ state,
632
+ [...path, 0],
633
+ [...repeatIterations, 0]
634
+ );
635
+ if (first.duration === void 0 || !Number.isFinite(first.duration)) {
636
+ if (state.validateInputs && !state.validateWriters) {
637
+ return unknownRepeatDiscovery(
638
+ program,
639
+ record.outputs,
640
+ state,
641
+ path,
642
+ repeatIterations
643
+ );
644
+ }
645
+ throw new RangeError(
646
+ "Pibbl animation activation-dependent repeat writer period could not be proven finite."
647
+ );
648
+ }
649
+ const firstEndWrites = applyIterationEnd(state, initialValues, first, firstReversed);
650
+ const stableAfterFirst = discoveredValuesEqual(initialValues, state.values);
651
+ const alternating = record.direction === "alternate" || record.direction === "alternate-reverse";
652
+ if (stableAfterFirst && !alternating) {
653
+ const next = shiftedResolvedWriters(first.writers, first.duration);
654
+ assertResolvedWritersDisjoint(first.writers, next, state);
655
+ const writers3 = symbolicRepeatWriters(
656
+ first.writers,
657
+ first.duration,
658
+ record.iterations
659
+ );
660
+ const duration2 = record.iterations === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : first.duration * record.iterations;
661
+ state.durations.set(instanceKey(path, repeatIterations), duration2);
662
+ return {
663
+ duration: duration2,
664
+ writers: writers3,
665
+ startWrites: new Map(firstReversed ? first.endWrites : first.startWrites),
666
+ endWrites: new Map(firstEndWrites)
667
+ };
668
+ }
669
+ const steadyBaseline = new Map(state.values);
670
+ const secondReversed = record.direction === "reverse" || record.direction === "alternate";
671
+ const second = discoverNode(
672
+ child,
673
+ Number.POSITIVE_INFINITY,
674
+ state,
675
+ [...path, 0],
676
+ [...repeatIterations, 1]
677
+ );
678
+ if (second.duration === void 0 || !Number.isFinite(second.duration)) {
679
+ if (state.validateInputs && !state.validateWriters) {
680
+ return unknownRepeatDiscovery(
681
+ program,
682
+ record.outputs,
683
+ state,
684
+ path,
685
+ repeatIterations
686
+ );
687
+ }
688
+ throw new RangeError(
689
+ "Pibbl animation activation-dependent repeat writer period could not be proven finite."
690
+ );
691
+ }
692
+ const secondEndWrites = applyIterationEnd(
693
+ state,
694
+ steadyBaseline,
695
+ second,
696
+ secondReversed
697
+ );
698
+ const shiftedSecond = shiftedResolvedWriters(second.writers, first.duration);
699
+ assertResolvedWritersDisjoint(first.writers, shiftedSecond, state);
700
+ if (record.iterations === 2) {
701
+ const duration2 = first.duration + second.duration;
702
+ state.durations.set(instanceKey(path, repeatIterations), duration2);
703
+ return {
704
+ duration: duration2,
705
+ writers: Object.freeze([...first.writers, ...shiftedSecond]),
706
+ startWrites: new Map(firstReversed ? first.endWrites : first.startWrites),
707
+ endWrites: new Map(secondEndWrites)
708
+ };
709
+ }
710
+ if (alternating) {
711
+ if (!discoveredValuesEqual(initialValues, state.values)) {
712
+ if (state.validateInputs && !state.validateWriters) {
713
+ const pairEndValues = new Map(state.values);
714
+ const third = discoverNode(
715
+ child,
716
+ Number.POSITIVE_INFINITY,
717
+ state,
718
+ [...path, 0],
719
+ [...repeatIterations, 2]
720
+ );
721
+ if (third.duration === void 0 || !Number.isFinite(third.duration)) {
722
+ return unknownRepeatDiscovery(
723
+ program,
724
+ record.outputs,
725
+ state,
726
+ path,
727
+ repeatIterations
728
+ );
729
+ }
730
+ const thirdEndWrites = applyIterationEnd(
731
+ state,
732
+ pairEndValues,
733
+ third,
734
+ firstReversed
735
+ );
736
+ const fourthBaseline = new Map(state.values);
737
+ const fourth = discoverNode(
738
+ child,
739
+ Number.POSITIVE_INFINITY,
740
+ state,
741
+ [...path, 0],
742
+ [...repeatIterations, 3]
743
+ );
744
+ if (fourth.duration === void 0 || !Number.isFinite(fourth.duration)) {
745
+ return unknownRepeatDiscovery(
746
+ program,
747
+ record.outputs,
748
+ state,
749
+ path,
750
+ repeatIterations
751
+ );
752
+ }
753
+ const fourthEndWrites = applyIterationEnd(
754
+ state,
755
+ fourthBaseline,
756
+ fourth,
757
+ secondReversed
758
+ );
759
+ if (!discoveredValuesEqual(pairEndValues, state.values)) {
760
+ return unknownRepeatDiscovery(
761
+ program,
762
+ record.outputs,
763
+ state,
764
+ path,
765
+ repeatIterations
766
+ );
767
+ }
768
+ const firstPairDuration = first.duration + second.duration;
769
+ const steadyPairDuration = third.duration + fourth.duration;
770
+ const pairCount2 = record.iterations === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : Math.floor(record.iterations / 2);
771
+ const hasOddIteration2 = record.iterations !== Number.POSITIVE_INFINITY && record.iterations % 2 === 1;
772
+ const duration3 = record.iterations === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : firstPairDuration + (pairCount2 - 1) * steadyPairDuration + (hasOddIteration2 ? third.duration : 0);
773
+ const finalIteration = hasOddIteration2 ? third : fourth;
774
+ const finalIterationDuration = hasOddIteration2 ? third.duration : fourth.duration;
775
+ const finalEndWrites = hasOddIteration2 ? thirdEndWrites : fourthEndWrites;
776
+ if (hasOddIteration2) {
777
+ state.values.clear();
778
+ for (const [output, value] of pairEndValues) {
779
+ state.values.set(output, value);
780
+ }
781
+ applyDiscoveredWrites(state.values, thirdEndWrites);
782
+ }
783
+ state.durations.set(instanceKey(path, repeatIterations), duration3);
784
+ const finalOffset = Number.isFinite(duration3) ? duration3 - finalIterationDuration : Number.POSITIVE_INFINITY;
785
+ return {
786
+ duration: duration3,
787
+ writers: Object.freeze(shiftedResolvedWriters(
788
+ finalIteration.writers,
789
+ finalOffset
790
+ )),
791
+ startWrites: new Map(firstReversed ? first.endWrites : first.startWrites),
792
+ endWrites: new Map(finalEndWrites)
793
+ };
794
+ }
795
+ throw new RangeError(
796
+ "Pibbl animation activation-dependent alternating repeat writer schedule did not reach a bounded symbolic period."
797
+ );
798
+ }
799
+ const pairDuration = first.duration + second.duration;
800
+ assertResolvedWritersDisjoint(
801
+ second.writers,
802
+ shiftedResolvedWriters(first.writers, pairDuration - first.duration),
803
+ state
804
+ );
805
+ const pairCount = record.iterations === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : Math.floor(record.iterations / 2);
806
+ const writers3 = [
807
+ ...symbolicRepeatWriters(first.writers, pairDuration, pairCount),
808
+ ...symbolicRepeatWriters(second.writers, pairDuration, pairCount, first.duration)
809
+ ];
810
+ const hasOddIteration = record.iterations !== Number.POSITIVE_INFINITY && record.iterations % 2 === 1;
811
+ if (hasOddIteration) {
812
+ writers3.push(...shiftedResolvedWriters(first.writers, pairCount * pairDuration));
813
+ }
814
+ const duration2 = record.iterations === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : pairCount * pairDuration + (hasOddIteration ? first.duration : 0);
815
+ state.durations.set(instanceKey(path, repeatIterations), duration2);
816
+ return {
817
+ duration: duration2,
818
+ writers: Object.freeze(writers3),
819
+ startWrites: new Map(firstReversed ? first.endWrites : first.startWrites),
820
+ endWrites: new Map(hasOddIteration ? firstEndWrites : secondEndWrites)
821
+ };
822
+ }
823
+ if (!discoveredValuesEqual(steadyBaseline, state.values)) {
824
+ if (state.validateInputs && !state.validateWriters) {
825
+ return unknownRepeatDiscovery(
826
+ program,
827
+ record.outputs,
828
+ state,
829
+ path,
830
+ repeatIterations
831
+ );
832
+ }
833
+ throw new RangeError(
834
+ "Pibbl animation activation-dependent repeat writer schedule did not reach a bounded symbolic period."
835
+ );
836
+ }
837
+ assertResolvedWritersDisjoint(
838
+ second.writers,
839
+ shiftedResolvedWriters(second.writers, second.duration),
840
+ state
841
+ );
842
+ const remainingIterations = record.iterations === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : record.iterations - 1;
843
+ const writers2 = Object.freeze([
844
+ ...first.writers,
845
+ ...symbolicRepeatWriters(
846
+ second.writers,
847
+ second.duration,
848
+ remainingIterations,
849
+ first.duration
850
+ )
851
+ ]);
852
+ const duration = record.iterations === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : first.duration + second.duration * remainingIterations;
853
+ state.durations.set(instanceKey(path, repeatIterations), duration);
854
+ return {
855
+ duration,
856
+ writers: writers2,
857
+ startWrites: new Map(firstReversed ? first.endWrites : first.startWrites),
858
+ endWrites: new Map(secondEndWrites)
859
+ };
860
+ }
861
+ let remaining = localTime;
862
+ let elapsed = 0;
863
+ let firstWrites = /* @__PURE__ */ new Map();
864
+ let lastWrites = /* @__PURE__ */ new Map();
865
+ let previousWriters = Object.freeze([]);
866
+ const writers = [];
867
+ for (let iteration = 0; iteration < record.iterations; iteration++) {
868
+ const child = record.children[0];
869
+ const iterationPath = [...repeatIterations, iteration];
870
+ const reversed = record.direction === "reverse" || record.direction === "alternate-reverse" && iteration % 2 === 0 || record.direction === "alternate" && iteration % 2 === 1;
871
+ const baseline = new Map(state.values);
872
+ const discovered = discoverNode(
873
+ child,
874
+ reversed ? Number.POSITIVE_INFINITY : remaining,
875
+ state,
876
+ [...path, 0],
877
+ iterationPath
878
+ );
879
+ const duration = discovered.duration;
880
+ if (duration === void 0 || duration === Number.POSITIVE_INFINITY) {
881
+ return {
882
+ duration: void 0,
883
+ writers: Object.freeze(writers),
884
+ startWrites: firstWrites,
885
+ endWrites: lastWrites
886
+ };
887
+ }
888
+ if (duration === 0 && record.iterations === Number.POSITIVE_INFINITY) {
889
+ throw new TypeError("An infinite repeat with zero duration cannot be discovered seekably.");
890
+ }
891
+ const iterationWriters = shiftedResolvedWriters(discovered.writers, elapsed);
892
+ if (state.validateWriters) {
893
+ assertResolvedWritersDisjoint(previousWriters, iterationWriters, state);
894
+ writers.push(...iterationWriters);
895
+ previousWriters = iterationWriters;
896
+ }
897
+ const iterationStartWrites = reversed ? discovered.endWrites : discovered.startWrites;
898
+ const iterationEndWrites = reversed ? discovered.startWrites : discovered.endWrites;
899
+ if (iteration === 0) firstWrites = new Map(iterationStartWrites);
900
+ lastWrites = new Map(iterationEndWrites);
901
+ state.values.clear();
902
+ for (const [output, value] of baseline) state.values.set(output, value);
903
+ applyDiscoveredWrites(state.values, iterationEndWrites);
904
+ elapsed += duration;
905
+ if (remaining < duration) {
906
+ const exact = getExactSeekableProgramDuration(program);
907
+ if (exact !== void 0) state.durations.set(instanceKey(path, repeatIterations), exact);
908
+ return {
909
+ duration: exact,
910
+ writers: Object.freeze(writers),
911
+ startWrites: firstWrites,
912
+ endWrites: lastWrites
913
+ };
914
+ }
915
+ if (iteration + 1 === record.iterations) {
916
+ state.durations.set(instanceKey(path, repeatIterations), elapsed);
917
+ return {
918
+ duration: elapsed,
919
+ writers: Object.freeze(writers),
920
+ startWrites: firstWrites,
921
+ endWrites: lastWrites
922
+ };
923
+ }
924
+ remaining = Math.max(0, remaining - duration);
925
+ }
926
+ return {
927
+ duration: elapsed,
928
+ writers: Object.freeze(writers),
929
+ startWrites: firstWrites,
930
+ endWrites: lastWrites
931
+ };
932
+ }
933
+ function frozenStepperTerminal(path, repeatIterations, activationInput, finalValue, terminalStep, terminalTime) {
934
+ return Object.freeze({
935
+ programPath: freezePath(path),
936
+ repeatIterations: freezePath(repeatIterations),
937
+ activationInput,
938
+ finalValue,
939
+ terminalStep,
940
+ terminalTime
941
+ });
942
+ }
943
+ function frozenStepperTrace(path, repeatIterations, appliedSteps, retainedRemainderMilliseconds, clampedElapsedMilliseconds, discardedElapsedMilliseconds, terminal) {
944
+ return Object.freeze({
945
+ programPath: freezePath(path),
946
+ repeatIterations: freezePath(repeatIterations),
947
+ appliedSteps,
948
+ retainedRemainderMilliseconds,
949
+ clampedElapsedMilliseconds,
950
+ discardedElapsedMilliseconds,
951
+ terminal: terminal === void 0 ? void 0 : Object.freeze({
952
+ step: terminal.terminalStep,
953
+ time: terminal.terminalTime
954
+ })
955
+ });
956
+ }
957
+ function sampleStepperTrack(program, localTime, state, path, repeatIterations, offset) {
958
+ const trackRecord = getProgramRecord(program);
959
+ if (trackRecord.kind !== "track") throw new Error("Expected an animation track record.");
960
+ const definitionRecord = getDefinitionRecord(trackRecord.definition);
961
+ if (definitionRecord.kind !== "stepper") {
962
+ throw new Error("Expected a stateful animation definition.");
963
+ }
964
+ const key = instanceKey(path, repeatIterations);
965
+ const knownTerminal = state.terminalSteppers.get(key);
966
+ if (!state.replaySteppers && knownTerminal !== void 0 && localTime >= knownTerminal.terminalTime) {
967
+ state.batch.stage(trackRecord.output, knownTerminal.finalValue, baselineWriter);
968
+ state.writtenOutputs.add(trackRecord.output);
969
+ state.owners.set(trackRecord.output, Object.freeze({
970
+ start: offset,
971
+ end: offset + knownTerminal.terminalTime
972
+ }));
973
+ state.stepperTraces.push(frozenStepperTrace(
974
+ path,
975
+ repeatIterations,
976
+ 0,
977
+ 0,
978
+ 0,
979
+ 0,
980
+ void 0
981
+ ));
982
+ setDuration(state, path, repeatIterations, knownTerminal.terminalTime);
983
+ return Object.freeze({ duration: knownTerminal.terminalTime, atEnd: true });
984
+ }
985
+ if (!Number.isFinite(localTime)) {
986
+ throw new TypeError(
987
+ `${stepperLabel(definitionRecord.debugName)} terminal time is not discovered.`
988
+ );
989
+ }
990
+ let stepperRecord = state.steppers.get(key);
991
+ let newlyInitialized = false;
992
+ let zeroDurationReservation = false;
993
+ if (stepperRecord === void 0) {
994
+ if (definitionRecord.done !== void 0) {
995
+ reservePotentialZeroDurationStepperOccurrence(
996
+ state,
997
+ definitionRecord.debugName,
998
+ path,
999
+ repeatIterations
1000
+ );
1001
+ zeroDurationReservation = true;
1002
+ }
1003
+ const activationInput = snapshotAnimationActivationValue(
1004
+ state.batch.read(trackRecord.output),
1005
+ state.snapshots
1006
+ );
1007
+ const initialState = invokeStepperCallback(
1008
+ definitionRecord.debugName,
1009
+ "initial",
1010
+ path,
1011
+ repeatIterations,
1012
+ state.frameId,
1013
+ 0,
1014
+ () => definitionRecord.initial(activationInput)
1015
+ );
1016
+ stepperRecord = {
1017
+ programPath: freezePath(path),
1018
+ repeatIterations: freezePath(repeatIterations),
1019
+ activationInput,
1020
+ state: initialState,
1021
+ wholeSteps: 0,
1022
+ remainderMilliseconds: 0,
1023
+ appliedElapsedMilliseconds: 0,
1024
+ discardedElapsedMilliseconds: 0,
1025
+ sampledLocalTime: 0
1026
+ };
1027
+ newlyInitialized = true;
1028
+ }
1029
+ let terminal;
1030
+ if (newlyInitialized && definitionRecord.done !== void 0 && invokeStepperCallback(
1031
+ definitionRecord.debugName,
1032
+ "done",
1033
+ path,
1034
+ repeatIterations,
1035
+ state.frameId,
1036
+ stepperRecord.appliedElapsedMilliseconds,
1037
+ () => definitionRecord.done(stepperRecord.state)
1038
+ )) {
1039
+ terminal = frozenStepperTerminal(
1040
+ path,
1041
+ repeatIterations,
1042
+ stepperRecord.activationInput,
1043
+ void 0,
1044
+ stepperRecord.wholeSteps,
1045
+ stepperRecord.appliedElapsedMilliseconds
1046
+ );
1047
+ }
1048
+ if (zeroDurationReservation && terminal === void 0) {
1049
+ state.zeroDurationOccurrences.value--;
1050
+ }
1051
+ const rawContribution = Math.max(0, localTime - stepperRecord.sampledLocalTime);
1052
+ let frameBudget;
1053
+ if (!state.replaySteppers) {
1054
+ const budgetKey = stepperFrameBudgetKey(path);
1055
+ frameBudget = state.stepperFrameBudgets.get(budgetKey);
1056
+ if (frameBudget === void 0) {
1057
+ const available = Math.min(
1058
+ rawContribution,
1059
+ definitionRecord.maxElapsedMilliseconds
1060
+ );
1061
+ frameBudget = {
1062
+ remainingMilliseconds: available,
1063
+ discardedMilliseconds: rawContribution - available,
1064
+ discardedReported: false
1065
+ };
1066
+ state.stepperFrameBudgets.set(budgetKey, frameBudget);
1067
+ }
1068
+ }
1069
+ const clampedCandidate = frameBudget === void 0 ? rawContribution : Math.min(rawContribution, frameBudget.remainingMilliseconds);
1070
+ const previousRemainder = stepperRecord.remainderMilliseconds;
1071
+ const accumulator = previousRemainder + clampedCandidate;
1072
+ const availableSteps = terminal === void 0 ? Math.floor(accumulator / definitionRecord.stepMilliseconds) : 0;
1073
+ if (!Number.isSafeInteger(availableSteps)) {
1074
+ throw new RangeError(
1075
+ `${stepperLabel(definitionRecord.debugName)} whole-step count must be a safe integer at program path [${path.join(", ")}], frame ${state.frameId}, local time ${localTime}; received ${availableSteps}.`
1076
+ );
1077
+ }
1078
+ let appliedSteps = 0;
1079
+ for (; appliedSteps < availableSteps; appliedSteps++) {
1080
+ stepperRecord.state = invokeStepperCallback(
1081
+ definitionRecord.debugName,
1082
+ "step",
1083
+ path,
1084
+ repeatIterations,
1085
+ state.frameId,
1086
+ stepperRecord.appliedElapsedMilliseconds + definitionRecord.stepMilliseconds,
1087
+ () => definitionRecord.step(
1088
+ stepperRecord.state,
1089
+ definitionRecord.stepMilliseconds
1090
+ )
1091
+ );
1092
+ stepperRecord.wholeSteps++;
1093
+ stepperRecord.appliedElapsedMilliseconds = stepperRecord.wholeSteps * definitionRecord.stepMilliseconds;
1094
+ if (definitionRecord.done !== void 0 && invokeStepperCallback(
1095
+ definitionRecord.debugName,
1096
+ "done",
1097
+ path,
1098
+ repeatIterations,
1099
+ state.frameId,
1100
+ stepperRecord.appliedElapsedMilliseconds,
1101
+ () => definitionRecord.done(stepperRecord.state)
1102
+ )) {
1103
+ appliedSteps++;
1104
+ terminal = frozenStepperTerminal(
1105
+ path,
1106
+ repeatIterations,
1107
+ stepperRecord.activationInput,
1108
+ void 0,
1109
+ stepperRecord.wholeSteps,
1110
+ stepperRecord.appliedElapsedMilliseconds
1111
+ );
1112
+ break;
1113
+ }
1114
+ }
1115
+ stepperRecord.remainderMilliseconds = terminal === void 0 ? accumulator - appliedSteps * definitionRecord.stepMilliseconds : 0;
1116
+ if (Math.abs(stepperRecord.remainderMilliseconds) < Number.EPSILON) {
1117
+ stepperRecord.remainderMilliseconds = 0;
1118
+ }
1119
+ const clampedContribution = terminal === void 0 ? clampedCandidate : Math.max(0, Math.min(
1120
+ clampedCandidate,
1121
+ appliedSteps * definitionRecord.stepMilliseconds - previousRemainder
1122
+ ));
1123
+ if (frameBudget !== void 0) {
1124
+ frameBudget.remainingMilliseconds = Math.max(
1125
+ 0,
1126
+ frameBudget.remainingMilliseconds - clampedContribution
1127
+ );
1128
+ }
1129
+ const discardedGap = frameBudget !== void 0 && !frameBudget.discardedReported ? frameBudget.discardedMilliseconds : 0;
1130
+ if (frameBudget !== void 0 && !frameBudget.discardedReported) {
1131
+ frameBudget.discardedReported = true;
1132
+ }
1133
+ stepperRecord.discardedElapsedMilliseconds += discardedGap;
1134
+ stepperRecord.sampledLocalTime = localTime;
1135
+ const projected = invokeStepperCallback(
1136
+ definitionRecord.debugName,
1137
+ "read",
1138
+ path,
1139
+ repeatIterations,
1140
+ state.frameId,
1141
+ stepperRecord.appliedElapsedMilliseconds,
1142
+ () => validateStepperOutput(
1143
+ definitionRecord.read(stepperRecord.state),
1144
+ definitionRecord.debugName
1145
+ )
1146
+ );
1147
+ if (terminal !== void 0) {
1148
+ terminal = frozenStepperTerminal(
1149
+ path,
1150
+ repeatIterations,
1151
+ stepperRecord.activationInput,
1152
+ projected,
1153
+ terminal.terminalStep,
1154
+ terminal.terminalTime
1155
+ );
1156
+ state.terminalSteppers.set(key, terminal);
1157
+ state.steppers.delete(key);
1158
+ } else {
1159
+ state.steppers.set(key, stepperRecord);
1160
+ state.activeStepperKeys.add(key);
1161
+ }
1162
+ state.stepperTraces.push(frozenStepperTrace(
1163
+ path,
1164
+ repeatIterations,
1165
+ appliedSteps,
1166
+ stepperRecord.remainderMilliseconds,
1167
+ clampedContribution,
1168
+ discardedGap,
1169
+ terminal
1170
+ ));
1171
+ state.batch.stage(trackRecord.output, projected, baselineWriter);
1172
+ state.writtenOutputs.add(trackRecord.output);
1173
+ const duration = terminal?.terminalTime ?? (definitionRecord.done === void 0 ? Number.POSITIVE_INFINITY : void 0);
1174
+ state.owners.set(trackRecord.output, Object.freeze({
1175
+ start: offset,
1176
+ end: offset + (duration ?? Number.POSITIVE_INFINITY)
1177
+ }));
1178
+ setDuration(state, path, repeatIterations, duration);
1179
+ return Object.freeze({
1180
+ duration,
1181
+ atEnd: terminal !== void 0 && localTime >= terminal.terminalTime
1182
+ });
1183
+ }
1184
+ function sampleTrack(program, localTime, state, path, repeatIterations, offset) {
1185
+ const record = getProgramRecord(program);
1186
+ if (record.kind !== "track") throw new Error("Expected an animation track record.");
1187
+ if (getDefinitionRecord(record.definition).kind === "stepper") {
1188
+ return sampleStepperTrack(
1189
+ program,
1190
+ localTime,
1191
+ state,
1192
+ path,
1193
+ repeatIterations,
1194
+ offset
1195
+ );
1196
+ }
1197
+ const key = instanceKey(path, repeatIterations);
1198
+ let start = state.starts.get(key);
1199
+ if (start === void 0) {
1200
+ const initialValue = state.batch.read(record.output);
1201
+ const definition = activateSeekableDefinition(
1202
+ record.definition,
1203
+ initialValue,
1204
+ state.snapshots
1205
+ );
1206
+ start = Object.freeze({
1207
+ programPath: freezePath(path),
1208
+ repeatIterations: freezePath(repeatIterations),
1209
+ initialValue: definition.initialValue,
1210
+ definition
1211
+ });
1212
+ state.starts.set(key, start);
1213
+ }
1214
+ const duration = start.definition.duration;
1215
+ state.batch.stage(
1216
+ record.output,
1217
+ sampleActivatedSeekableDefinition(start.definition, Math.min(localTime, duration)),
1218
+ baselineWriter
1219
+ );
1220
+ state.writtenOutputs.add(record.output);
1221
+ state.owners.set(record.output, Object.freeze({
1222
+ start: offset,
1223
+ end: offset + duration
1224
+ }));
1225
+ setDuration(state, path, repeatIterations, duration);
1226
+ return Object.freeze({ duration, atEnd: localTime >= duration });
1227
+ }
1228
+ function forkSampleState(state, outputs) {
1229
+ const batch = createSignalCommitBatch();
1230
+ for (const output of outputs) {
1231
+ batch.stage(output, state.batch.read(output), baselineWriter);
1232
+ }
1233
+ return {
1234
+ activation: state.activation,
1235
+ batch,
1236
+ starts: state.starts,
1237
+ durations: state.durations,
1238
+ writtenOutputs: /* @__PURE__ */ new Set(),
1239
+ snapshots: state.snapshots,
1240
+ owners: /* @__PURE__ */ new Map(),
1241
+ steppers: state.steppers,
1242
+ terminalSteppers: state.terminalSteppers,
1243
+ repeatFrontiers: state.repeatFrontiers,
1244
+ repeatTerminals: state.repeatTerminals,
1245
+ reverseEndpoints: state.reverseEndpoints,
1246
+ stepperFrameBudgets: state.stepperFrameBudgets,
1247
+ zeroDurationOccurrences: state.zeroDurationOccurrences,
1248
+ sampledTimelineEvents: state.sampledTimelineEvents,
1249
+ nextTimelineSourceOrder: state.nextTimelineSourceOrder,
1250
+ activeStepperKeys: state.activeStepperKeys,
1251
+ activeRepeatFrontierKeys: state.activeRepeatFrontierKeys,
1252
+ activeReverseEndpointKeys: state.activeReverseEndpointKeys,
1253
+ stepperTraces: state.stepperTraces,
1254
+ frameId: state.frameId,
1255
+ replaySteppers: state.replaySteppers
1256
+ };
1257
+ }
1258
+ function ownerWins(candidate, current, time) {
1259
+ if (current === void 0) return true;
1260
+ const candidateActive = candidate.start <= time && time <= candidate.end;
1261
+ const currentActive = current.start <= time && time <= current.end;
1262
+ if (candidateActive !== currentActive) return candidateActive;
1263
+ return candidate.end >= current.end;
1264
+ }
1265
+ function queueSampledTimelineEvent(state, event) {
1266
+ const duplicate = state.sampledTimelineEvents.some(
1267
+ (existing) => existing.kind === event.kind && existing.marker === event.marker && existing.programTime === event.programTime && existing.iteration === event.iteration && existing.repeatIterations.length === event.repeatIterations.length && existing.repeatIterations.every(
1268
+ (part, index) => part === event.repeatIterations[index]
1269
+ ) && existing.programPath.length === event.programPath.length && existing.programPath.every((part, index) => part === event.programPath[index])
1270
+ );
1271
+ if (duplicate) return;
1272
+ state.sampledTimelineEvents.push(Object.freeze({
1273
+ ...event,
1274
+ programPath: freezePath(event.programPath),
1275
+ repeatIterations: freezePath(event.repeatIterations),
1276
+ sourceOrder: state.nextTimelineSourceOrder.value++
1277
+ }));
1278
+ }
1279
+ function pathHasPrefix(path, prefix) {
1280
+ return prefix.length <= path.length && prefix.every((part, index) => path[index] === part);
1281
+ }
1282
+ function belongsToOccurrence(programPath, repeatIterations, childPath, iterationPath) {
1283
+ return pathHasPrefix(programPath, childPath) && pathHasPrefix(repeatIterations, iterationPath);
1284
+ }
1285
+ function clearOccurrenceState(state, childPath, iterationPath) {
1286
+ for (const [key, start] of state.starts) {
1287
+ if (belongsToOccurrence(
1288
+ start.programPath,
1289
+ start.repeatIterations,
1290
+ childPath,
1291
+ iterationPath
1292
+ )) state.starts.delete(key);
1293
+ }
1294
+ for (const [key, stepperRecord] of state.steppers) {
1295
+ if (belongsToOccurrence(
1296
+ stepperRecord.programPath,
1297
+ stepperRecord.repeatIterations,
1298
+ childPath,
1299
+ iterationPath
1300
+ )) state.steppers.delete(key);
1301
+ }
1302
+ for (const [key, terminal] of state.terminalSteppers) {
1303
+ if (belongsToOccurrence(
1304
+ terminal.programPath,
1305
+ terminal.repeatIterations,
1306
+ childPath,
1307
+ iterationPath
1308
+ )) state.terminalSteppers.delete(key);
1309
+ }
1310
+ for (const [key, frontier] of state.repeatFrontiers) {
1311
+ if (belongsToOccurrence(
1312
+ frontier.programPath,
1313
+ frontier.repeatIterations,
1314
+ childPath,
1315
+ iterationPath
1316
+ )) state.repeatFrontiers.delete(key);
1317
+ }
1318
+ for (const [key, terminal] of state.repeatTerminals) {
1319
+ if (belongsToOccurrence(
1320
+ terminal.programPath,
1321
+ terminal.repeatIterations,
1322
+ childPath,
1323
+ iterationPath
1324
+ )) state.repeatTerminals.delete(key);
1325
+ }
1326
+ for (const [key, endpoint] of state.reverseEndpoints) {
1327
+ if (belongsToOccurrence(
1328
+ endpoint.programPath,
1329
+ endpoint.repeatIterations,
1330
+ childPath,
1331
+ iterationPath
1332
+ )) state.reverseEndpoints.delete(key);
1333
+ }
1334
+ }
1335
+ function programValues(program, batch) {
1336
+ return new Map(getProgramRecord(program).outputs.map((output) => [output, batch.read(output)]));
1337
+ }
1338
+ function stageProgramValues(program, values, state, offset, duration) {
1339
+ for (const output of getProgramRecord(program).outputs) {
1340
+ if (!values.has(output)) continue;
1341
+ state.batch.stage(output, values.get(output), baselineWriter);
1342
+ state.writtenOutputs.add(output);
1343
+ state.owners.set(output, Object.freeze({
1344
+ start: offset,
1345
+ end: offset + (duration ?? Number.POSITIVE_INFINITY)
1346
+ }));
1347
+ }
1348
+ }
1349
+ function firstStepperDebugName(program) {
1350
+ const record = getProgramRecord(program);
1351
+ if (record.kind === "track") {
1352
+ const definition = getDefinitionRecord(record.definition);
1353
+ return definition.kind === "stepper" ? definition.debugName : void 0;
1354
+ }
1355
+ for (const child of record.children) {
1356
+ if (programContainsStepper(child)) return firstStepperDebugName(child);
1357
+ }
1358
+ return void 0;
1359
+ }
1360
+ function isolatedReplayState(state, values) {
1361
+ const isolated = createSampleState(
1362
+ state.activation,
1363
+ /* @__PURE__ */ new Map(),
1364
+ /* @__PURE__ */ new Map(),
1365
+ /* @__PURE__ */ new Map(),
1366
+ /* @__PURE__ */ new Map(),
1367
+ /* @__PURE__ */ new Map(),
1368
+ /* @__PURE__ */ new Map(),
1369
+ /* @__PURE__ */ new Map(),
1370
+ state.frameId,
1371
+ true,
1372
+ state.zeroDurationOccurrences
1373
+ );
1374
+ for (const [output, value] of values) {
1375
+ isolated.batch.stage(output, value, baselineWriter);
1376
+ }
1377
+ return isolated;
1378
+ }
1379
+ function mergeReplaySample(program, replay, state, offset, duration) {
1380
+ for (const [key, value] of replay.durations) state.durations.set(key, value);
1381
+ state.stepperTraces.push(...replay.stepperTraces);
1382
+ stageProgramValues(program, programValues(program, replay.batch), state, offset, duration);
1383
+ }
1384
+ function programValuesEqual(program, first, second) {
1385
+ return getProgramRecord(program).outputs.every(
1386
+ (output) => first.has(output) && second.has(output) && Object.is(first.get(output), second.get(output))
1387
+ );
1388
+ }
1389
+ function rememberForwardEndpoint(state, endpointPath, endpointRepeatIterations, values, duration) {
1390
+ const endpointKey = instanceKey(endpointPath, endpointRepeatIterations);
1391
+ state.reverseEndpoints.set(endpointKey, Object.freeze({
1392
+ programPath: freezePath(endpointPath),
1393
+ repeatIterations: freezePath(endpointRepeatIterations),
1394
+ duration,
1395
+ inputValues: new Map(values)
1396
+ }));
1397
+ state.activeReverseEndpointKeys.add(endpointKey);
1398
+ }
1399
+ function requireReverseEndpoint(program, state, endpointPath, endpointRepeatIterations, path, repeatIterations, values) {
1400
+ const debugName = firstStepperDebugName(program);
1401
+ const repeats = repeatIterations.length === 0 ? "" : `, repeat iterations [${repeatIterations.join(", ")}]`;
1402
+ if (getProgramRecord(program).duration.kind === "infinite") {
1403
+ throw new TypeError(
1404
+ `${stepperLabel(debugName)} has no finite endpoint for reversed execution at program path [${path.join(", ")}]${repeats}.`
1405
+ );
1406
+ }
1407
+ const endpointKey = instanceKey(endpointPath, endpointRepeatIterations);
1408
+ const knownEndpoint = state.reverseEndpoints.get(endpointKey);
1409
+ if (knownEndpoint === void 0 || !programValuesEqual(program, knownEndpoint.inputValues, values)) {
1410
+ throw new TypeError(
1411
+ `${stepperLabel(debugName)} reversed occurrence requires a previously discovered finite endpoint for the exact activation input at program path [${path.join(", ")}]${repeats}.`
1412
+ );
1413
+ }
1414
+ state.activeReverseEndpointKeys.add(endpointKey);
1415
+ return knownEndpoint.duration;
1416
+ }
1417
+ function sampleReversedOccurrence(program, occurrenceTime, state, path, repeatIterations, endpointPath, endpointRepeatIterations, values, offset) {
1418
+ const duration = requireReverseEndpoint(
1419
+ program,
1420
+ state,
1421
+ endpointPath,
1422
+ endpointRepeatIterations,
1423
+ path,
1424
+ repeatIterations,
1425
+ values
1426
+ );
1427
+ const replay = isolatedReplayState(state, values);
1428
+ sampleNode(
1429
+ program,
1430
+ duration - Math.min(occurrenceTime, duration),
1431
+ replay,
1432
+ path,
1433
+ repeatIterations,
1434
+ offset
1435
+ );
1436
+ mergeReplaySample(program, replay, state, offset, duration);
1437
+ return Object.freeze({ duration, atEnd: occurrenceTime >= duration });
1438
+ }
1439
+ function reversedRepeatOccurrence(direction, iteration) {
1440
+ return direction === "reverse" || direction === "alternate-reverse" && iteration % 2 === 0 || direction === "alternate" && iteration % 2 === 1;
1441
+ }
1442
+ function sampleStatefulRepeatFrontier(program, localTime, state, path, repeatIterations, offset) {
1443
+ const record = getProgramRecord(program);
1444
+ if (record.kind !== "repeat") throw new Error("Expected an animation repeat record.");
1445
+ const child = record.children[0];
1446
+ const childPath = [...path, 0];
1447
+ const key = instanceKey(path, repeatIterations);
1448
+ if (state.reverseEndpoints.has(key)) {
1449
+ state.activeReverseEndpointKeys.add(key);
1450
+ }
1451
+ const terminal = state.repeatTerminals.get(key);
1452
+ if (terminal !== void 0 && localTime >= terminal.duration) {
1453
+ stageProgramValues(program, terminal.values, state, offset, terminal.duration);
1454
+ setDuration(state, path, repeatIterations, terminal.duration);
1455
+ return Object.freeze({ duration: terminal.duration, atEnd: true });
1456
+ }
1457
+ let frontier = state.repeatFrontiers.get(key);
1458
+ if (frontier === void 0 || localTime < frontier.elapsedMilliseconds) {
1459
+ const initialValues = programValues(program, state.batch);
1460
+ frontier = {
1461
+ programPath: freezePath(path),
1462
+ repeatIterations: freezePath(repeatIterations),
1463
+ completedIterations: 0,
1464
+ elapsedMilliseconds: 0,
1465
+ iterationInputValues: new Map(initialValues),
1466
+ values: new Map(initialValues)
1467
+ };
1468
+ state.repeatFrontiers.set(key, frontier);
1469
+ }
1470
+ stageProgramValues(program, frontier.values, state, offset, void 0);
1471
+ let remaining = Math.max(0, localTime - frontier.elapsedMilliseconds);
1472
+ for (let iteration = frontier.completedIterations; iteration < record.iterations; iteration++) {
1473
+ const iterationPath = [...repeatIterations, iteration];
1474
+ const reversed = reversedRepeatOccurrence(record.direction, iteration);
1475
+ const sampled = reversed ? sampleReversedOccurrence(
1476
+ child,
1477
+ remaining,
1478
+ state,
1479
+ childPath,
1480
+ iterationPath,
1481
+ path,
1482
+ repeatIterations,
1483
+ frontier.iterationInputValues,
1484
+ offset + frontier.elapsedMilliseconds
1485
+ ) : sampleNode(
1486
+ child,
1487
+ remaining,
1488
+ state,
1489
+ childPath,
1490
+ iterationPath,
1491
+ offset + frontier.elapsedMilliseconds
1492
+ );
1493
+ if (sampled.duration === void 0) {
1494
+ frontier.values = programValues(program, state.batch);
1495
+ state.activeRepeatFrontierKeys.add(key);
1496
+ return Object.freeze({ duration: void 0, atEnd: false });
1497
+ }
1498
+ if (sampled.duration === 0 && record.iterations === Number.POSITIVE_INFINITY) {
1499
+ throw new TypeError("An infinite repeat with zero duration cannot be evaluated seekably.");
1500
+ }
1501
+ if (!sampled.atEnd) {
1502
+ frontier.values = programValues(program, state.batch);
1503
+ state.activeRepeatFrontierKeys.add(key);
1504
+ return Object.freeze({
1505
+ duration: getExactSeekableProgramDuration(program),
1506
+ atEnd: false
1507
+ });
1508
+ }
1509
+ frontier.values = programValues(program, state.batch);
1510
+ if (!reversed) {
1511
+ rememberForwardEndpoint(
1512
+ state,
1513
+ path,
1514
+ repeatIterations,
1515
+ frontier.iterationInputValues,
1516
+ sampled.duration
1517
+ );
1518
+ }
1519
+ if (programContainsStepper(child)) {
1520
+ clearOccurrenceState(state, childPath, iterationPath);
1521
+ }
1522
+ frontier.completedIterations = iteration + 1;
1523
+ frontier.elapsedMilliseconds += sampled.duration;
1524
+ if (frontier.completedIterations < record.iterations) {
1525
+ queueSampledTimelineEvent(state, {
1526
+ kind: "iteration",
1527
+ programTime: offset + frontier.elapsedMilliseconds,
1528
+ programPath: path,
1529
+ repeatIterations,
1530
+ iteration: frontier.completedIterations
1531
+ });
1532
+ }
1533
+ if (frontier.completedIterations === record.iterations) {
1534
+ const repeatTerminal = Object.freeze({
1535
+ programPath: freezePath(path),
1536
+ repeatIterations: freezePath(repeatIterations),
1537
+ duration: frontier.elapsedMilliseconds,
1538
+ values: new Map(frontier.values)
1539
+ });
1540
+ state.repeatFrontiers.delete(key);
1541
+ state.repeatTerminals.set(key, repeatTerminal);
1542
+ setDuration(state, path, repeatIterations, repeatTerminal.duration);
1543
+ return Object.freeze({ duration: repeatTerminal.duration, atEnd: true });
1544
+ }
1545
+ remaining = Math.max(0, remaining - sampled.duration);
1546
+ frontier.iterationInputValues = new Map(frontier.values);
1547
+ stageProgramValues(
1548
+ program,
1549
+ frontier.values,
1550
+ state,
1551
+ offset + frontier.elapsedMilliseconds,
1552
+ void 0
1553
+ );
1554
+ }
1555
+ throw new Error("Pibbl animation repeat frontier exceeded its declared iterations.");
1556
+ }
1557
+ function sampleNode(program, requestedTime, state, path, repeatIterations, offset = 0) {
1558
+ const record = getProgramRecord(program);
1559
+ const localTime = Math.max(0, requestedTime);
1560
+ if (record.kind === "track") {
1561
+ return sampleTrack(program, localTime, state, path, repeatIterations, offset);
1562
+ }
1563
+ if (record.kind === "wait") {
1564
+ const duration = record.duration.kind === "finite" ? record.duration.milliseconds : 0;
1565
+ setDuration(state, path, repeatIterations, duration);
1566
+ return Object.freeze({ duration, atEnd: localTime >= duration });
1567
+ }
1568
+ if (record.kind === "marker") {
1569
+ queueSampledTimelineEvent(state, {
1570
+ kind: "marker",
1571
+ marker: record.name,
1572
+ programTime: offset,
1573
+ programPath: path,
1574
+ repeatIterations,
1575
+ iteration: repeatIterations.at(-1) ?? 0
1576
+ });
1577
+ setDuration(state, path, repeatIterations, 0);
1578
+ return Object.freeze({ duration: 0, atEnd: true });
1579
+ }
1580
+ if (record.kind === "sequence") {
1581
+ let remaining2 = localTime;
1582
+ let elapsed2 = 0;
1583
+ for (let index = 0; index < record.children.length; index++) {
1584
+ const child = record.children[index];
1585
+ const childPath = [...path, index];
1586
+ const sampled = sampleNode(
1587
+ child,
1588
+ remaining2,
1589
+ state,
1590
+ childPath,
1591
+ repeatIterations,
1592
+ offset + elapsed2
1593
+ );
1594
+ if (!sampled.atEnd || sampled.duration === void 0) {
1595
+ let resolvedDuration = sampled.duration === void 0 ? void 0 : elapsed2 + sampled.duration;
1596
+ for (let later = index + 1; resolvedDuration !== void 0 && later < record.children.length; later++) {
1597
+ const laterDuration = getExactSeekableProgramDuration(record.children[later]);
1598
+ resolvedDuration = laterDuration === void 0 ? void 0 : resolvedDuration + laterDuration;
1599
+ }
1600
+ setDuration(state, path, repeatIterations, resolvedDuration);
1601
+ return Object.freeze({ duration: resolvedDuration, atEnd: false });
1602
+ }
1603
+ elapsed2 += sampled.duration;
1604
+ remaining2 = Math.max(0, remaining2 - sampled.duration);
1605
+ }
1606
+ setDuration(state, path, repeatIterations, elapsed2);
1607
+ return Object.freeze({ duration: elapsed2, atEnd: true });
1608
+ }
1609
+ if (record.kind === "parallel") {
1610
+ let duration = 0;
1611
+ let durationKnown = true;
1612
+ let atEnd = true;
1613
+ const selected = /* @__PURE__ */ new Map();
1614
+ for (let index = 0; index < record.children.length; index++) {
1615
+ const child = record.children[index];
1616
+ const branchState = forkSampleState(state, getProgramRecord(child).outputs);
1617
+ const sampled = sampleNode(
1618
+ child,
1619
+ localTime,
1620
+ branchState,
1621
+ [...path, index],
1622
+ repeatIterations,
1623
+ offset
1624
+ );
1625
+ if (sampled.duration === void 0) durationKnown = false;
1626
+ else duration = Math.max(duration, sampled.duration);
1627
+ if (!sampled.atEnd) atEnd = false;
1628
+ for (const output of branchState.writtenOutputs) {
1629
+ const owner = branchState.owners.get(output);
1630
+ if (ownerWins(owner, selected.get(output)?.owner, offset + localTime)) {
1631
+ selected.set(output, { owner, value: branchState.batch.read(output) });
1632
+ }
1633
+ }
1634
+ }
1635
+ for (const [output, candidate] of selected) {
1636
+ state.batch.stage(output, candidate.value, baselineWriter);
1637
+ state.writtenOutputs.add(output);
1638
+ state.owners.set(output, candidate.owner);
1639
+ }
1640
+ const resolvedDuration = durationKnown ? duration : void 0;
1641
+ setDuration(state, path, repeatIterations, resolvedDuration);
1642
+ return Object.freeze({ duration: resolvedDuration, atEnd });
1643
+ }
1644
+ const directChild = record.children[0];
1645
+ if (programContainsStepper(directChild) && !state.replaySteppers) {
1646
+ return sampleStatefulRepeatFrontier(
1647
+ program,
1648
+ localTime,
1649
+ state,
1650
+ path,
1651
+ repeatIterations,
1652
+ offset
1653
+ );
1654
+ }
1655
+ const directChildDuration = getExactSeekableProgramDuration(directChild);
1656
+ if (directChildDuration !== void 0 && Number.isFinite(directChildDuration) && (directChildDuration > 0 || record.iterations !== Number.POSITIVE_INFINITY) && canDirectlySelectRepeat(directChild)) {
1657
+ const totalDuration = directChildDuration === 0 ? 0 : record.iterations === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : directChildDuration * record.iterations;
1658
+ const atEnd = localTime >= totalDuration;
1659
+ if (directChildDuration === 0 && getProgramRecord(directChild).outputs.length === 0) {
1660
+ setDuration(state, path, repeatIterations, totalDuration);
1661
+ return Object.freeze({ duration: totalDuration, atEnd });
1662
+ }
1663
+ const iteration = atEnd ? Math.max(0, record.iterations - 1) : Math.floor(localTime / directChildDuration);
1664
+ const iterationStart = iteration * directChildDuration;
1665
+ const iterationTime = atEnd ? directChildDuration : localTime - iterationStart;
1666
+ const reversed = record.direction === "reverse" || record.direction === "alternate-reverse" && iteration % 2 === 0 || record.direction === "alternate" && iteration % 2 === 1;
1667
+ sampleNode(
1668
+ directChild,
1669
+ reversed ? directChildDuration - iterationTime : iterationTime,
1670
+ state,
1671
+ [...path, 0],
1672
+ [...repeatIterations, iteration],
1673
+ offset + iterationStart
1674
+ );
1675
+ setDuration(state, path, repeatIterations, totalDuration);
1676
+ return Object.freeze({ duration: totalDuration, atEnd });
1677
+ }
1678
+ if (localTime === Number.POSITIVE_INFINITY && record.iterations === Number.POSITIVE_INFINITY) {
1679
+ throw new TypeError("An infinite repeat cannot be resolved to a seekable terminal state.");
1680
+ }
1681
+ let remaining = localTime;
1682
+ let elapsed = 0;
1683
+ for (let iteration = 0; iteration < record.iterations; iteration++) {
1684
+ const child = record.children[0];
1685
+ const childPath = [...path, 0];
1686
+ const iterationPath = [...repeatIterations, iteration];
1687
+ const reversed = reversedRepeatOccurrence(record.direction, iteration);
1688
+ const inputValues = programValues(child, state.batch);
1689
+ let duration;
1690
+ if (reversed && programContainsStepper(child)) {
1691
+ const sampled = sampleReversedOccurrence(
1692
+ child,
1693
+ remaining,
1694
+ state,
1695
+ childPath,
1696
+ iterationPath,
1697
+ path,
1698
+ repeatIterations,
1699
+ inputValues,
1700
+ offset + elapsed
1701
+ );
1702
+ duration = sampled.duration;
1703
+ } else if (reversed) {
1704
+ const exactDuration = knownDuration(child, state, childPath, iterationPath);
1705
+ if (exactDuration === void 0) {
1706
+ const terminal = sampleNode(
1707
+ child,
1708
+ Number.POSITIVE_INFINITY,
1709
+ state,
1710
+ childPath,
1711
+ iterationPath,
1712
+ offset + elapsed
1713
+ );
1714
+ if (!terminal.atEnd || terminal.duration === void 0 || terminal.duration === Number.POSITIVE_INFINITY) {
1715
+ throw new TypeError("A reversed repeat child must have a finite seekable duration.");
1716
+ }
1717
+ duration = terminal.duration;
1718
+ } else {
1719
+ if (exactDuration === Number.POSITIVE_INFINITY) {
1720
+ throw new TypeError("A reversed repeat child must have a finite seekable duration.");
1721
+ }
1722
+ duration = exactDuration;
1723
+ }
1724
+ sampleNode(
1725
+ child,
1726
+ duration - Math.min(remaining, duration),
1727
+ state,
1728
+ childPath,
1729
+ iterationPath,
1730
+ offset + elapsed
1731
+ );
1732
+ } else {
1733
+ const sampled = sampleNode(
1734
+ child,
1735
+ remaining,
1736
+ state,
1737
+ childPath,
1738
+ iterationPath,
1739
+ offset + elapsed
1740
+ );
1741
+ if (sampled.duration === void 0) {
1742
+ return Object.freeze({ duration: void 0, atEnd: false });
1743
+ }
1744
+ duration = sampled.duration;
1745
+ }
1746
+ if (duration === 0 && record.iterations === Number.POSITIVE_INFINITY) {
1747
+ throw new TypeError("An infinite repeat with zero duration cannot be evaluated seekably.");
1748
+ }
1749
+ const iterationComplete = remaining >= duration;
1750
+ elapsed += duration;
1751
+ if (!iterationComplete) {
1752
+ const exact = getExactSeekableProgramDuration(program);
1753
+ setDuration(state, path, repeatIterations, exact);
1754
+ return Object.freeze({ duration: exact, atEnd: false });
1755
+ }
1756
+ if (programContainsStepper(child)) {
1757
+ if (!reversed) {
1758
+ rememberForwardEndpoint(
1759
+ state,
1760
+ path,
1761
+ repeatIterations,
1762
+ inputValues,
1763
+ duration
1764
+ );
1765
+ }
1766
+ clearOccurrenceState(state, childPath, iterationPath);
1767
+ }
1768
+ if (iteration + 1 < record.iterations) {
1769
+ queueSampledTimelineEvent(state, {
1770
+ kind: "iteration",
1771
+ programTime: offset + elapsed,
1772
+ programPath: path,
1773
+ repeatIterations,
1774
+ iteration: iteration + 1
1775
+ });
1776
+ }
1777
+ if (iteration + 1 === record.iterations) {
1778
+ setDuration(state, path, repeatIterations, elapsed);
1779
+ return Object.freeze({ duration: elapsed, atEnd: true });
1780
+ }
1781
+ remaining = Math.max(0, remaining - duration);
1782
+ }
1783
+ setDuration(state, path, repeatIterations, elapsed);
1784
+ return Object.freeze({ duration: elapsed, atEnd: true });
1785
+ }
1786
+ function durationForTimeline(program, state, path, repeatIterations) {
1787
+ return knownDuration(program, state, path, repeatIterations);
1788
+ }
1789
+ function transformedTime(transform, localTime) {
1790
+ const result = transform.origin + transform.scale * localTime;
1791
+ return Object.is(result, -0) ? 0 : result;
1792
+ }
1793
+ function collectTimeline(program, requestedTime, state, path, repeatIterations, transform, events, nextSourceOrder, windowStart, windowEnd) {
1794
+ const record = getProgramRecord(program);
1795
+ const localTime = Math.max(0, requestedTime);
1796
+ if (record.kind === "track" || record.kind === "wait") return;
1797
+ if (record.kind === "marker") {
1798
+ events.push(Object.freeze({
1799
+ kind: "marker",
1800
+ marker: record.name,
1801
+ programTime: transformedTime(transform, 0),
1802
+ programPath: freezePath(path),
1803
+ repeatIterations: freezePath(repeatIterations),
1804
+ iteration: repeatIterations.at(-1) ?? 0,
1805
+ sourceOrder: nextSourceOrder.value++
1806
+ }));
1807
+ return;
1808
+ }
1809
+ if (record.kind === "sequence") {
1810
+ let remaining2 = localTime;
1811
+ let offset2 = 0;
1812
+ for (let index = 0; index < record.children.length; index++) {
1813
+ const child = record.children[index];
1814
+ const childPath = [...path, index];
1815
+ const duration = durationForTimeline(child, state, childPath, repeatIterations);
1816
+ if (duration === void 0) return;
1817
+ collectTimeline(
1818
+ child,
1819
+ Math.min(remaining2, duration),
1820
+ state,
1821
+ childPath,
1822
+ repeatIterations,
1823
+ Object.freeze({
1824
+ origin: transformedTime(transform, offset2),
1825
+ scale: transform.scale
1826
+ }),
1827
+ events,
1828
+ nextSourceOrder,
1829
+ windowStart,
1830
+ windowEnd
1831
+ );
1832
+ if (remaining2 < duration) return;
1833
+ remaining2 = Math.max(0, remaining2 - duration);
1834
+ offset2 += duration;
1835
+ }
1836
+ return;
1837
+ }
1838
+ if (record.kind === "parallel") {
1839
+ for (let index = 0; index < record.children.length; index++) {
1840
+ const child = record.children[index];
1841
+ const childPath = [...path, index];
1842
+ const duration = durationForTimeline(child, state, childPath, repeatIterations);
1843
+ if (duration === void 0) continue;
1844
+ collectTimeline(
1845
+ child,
1846
+ Math.min(localTime, duration),
1847
+ state,
1848
+ childPath,
1849
+ repeatIterations,
1850
+ transform,
1851
+ events,
1852
+ nextSourceOrder,
1853
+ windowStart,
1854
+ windowEnd
1855
+ );
1856
+ }
1857
+ return;
1858
+ }
1859
+ const fixedDuration = getExactSeekableProgramDuration(record.children[0]);
1860
+ let firstIteration = 0;
1861
+ let lastIteration = record.iterations - 1;
1862
+ let offset = 0;
1863
+ if (fixedDuration !== void 0 && Number.isFinite(fixedDuration) && fixedDuration > 0) {
1864
+ const firstLocal = (windowStart - transform.origin) * transform.scale;
1865
+ const lastLocal = (windowEnd - transform.origin) * transform.scale;
1866
+ const lower = Math.max(0, Math.min(firstLocal, lastLocal));
1867
+ const upper = Math.min(localTime, Math.max(firstLocal, lastLocal));
1868
+ if (upper < lower) return;
1869
+ firstIteration = Math.max(0, Math.ceil(lower / fixedDuration) - 1);
1870
+ lastIteration = Math.min(lastIteration, Math.floor(upper / fixedDuration));
1871
+ offset = firstIteration * fixedDuration;
1872
+ }
1873
+ let remaining = Math.max(0, localTime - offset);
1874
+ for (let iteration = firstIteration; iteration <= lastIteration; iteration++) {
1875
+ const child = record.children[0];
1876
+ const childPath = [...path, 0];
1877
+ const iterationPath = [...repeatIterations, iteration];
1878
+ const duration = durationForTimeline(child, state, childPath, iterationPath);
1879
+ if (duration === void 0 || duration === Number.POSITIVE_INFINITY) return;
1880
+ if (duration === 0 && !programContainsStepper(child)) {
1881
+ const childRecord = getProgramRecord(child);
1882
+ const label = childRecord.kind === "marker" ? `marker "${childRecord.name}"` : `${childRecord.kind} program`;
1883
+ reserveZeroDurationOccurrence(state, label, childPath, iterationPath);
1884
+ }
1885
+ const reversed = record.direction === "reverse" || record.direction === "alternate-reverse" && iteration % 2 === 0 || record.direction === "alternate" && iteration % 2 === 1;
1886
+ const childTransform = reversed ? Object.freeze({
1887
+ origin: transformedTime(transform, offset + duration),
1888
+ scale: transform.scale === 1 ? -1 : 1
1889
+ }) : Object.freeze({
1890
+ origin: transformedTime(transform, offset),
1891
+ scale: transform.scale
1892
+ });
1893
+ collectTimeline(
1894
+ child,
1895
+ reversed ? duration : Math.min(remaining, duration),
1896
+ state,
1897
+ childPath,
1898
+ iterationPath,
1899
+ childTransform,
1900
+ events,
1901
+ nextSourceOrder,
1902
+ windowStart,
1903
+ windowEnd
1904
+ );
1905
+ if (remaining < duration) return;
1906
+ remaining = Math.max(0, remaining - duration);
1907
+ offset += duration;
1908
+ if (iteration + 1 < record.iterations) {
1909
+ events.push(Object.freeze({
1910
+ kind: "iteration",
1911
+ programTime: transformedTime(transform, offset),
1912
+ programPath: freezePath(path),
1913
+ repeatIterations: freezePath(repeatIterations),
1914
+ iteration: iteration + 1,
1915
+ sourceOrder: nextSourceOrder.value++
1916
+ }));
1917
+ }
1918
+ }
1919
+ }
1920
+ function createSampleState(record, starts, durations = /* @__PURE__ */ new Map(), steppers = new Map(record.steppers), terminalSteppers = new Map(record.terminalSteppers), repeatFrontiers = new Map(record.repeatFrontiers), repeatTerminals = new Map(record.repeatTerminals), reverseEndpoints = new Map(record.reverseEndpoints), frameId = 0, replaySteppers = false, zeroDurationOccurrences = { value: 0 }) {
1921
+ return {
1922
+ activation: record,
1923
+ batch: seedOriginalValues(record),
1924
+ starts,
1925
+ durations,
1926
+ writtenOutputs: /* @__PURE__ */ new Set(),
1927
+ snapshots: /* @__PURE__ */ new WeakMap(),
1928
+ owners: /* @__PURE__ */ new Map(),
1929
+ steppers,
1930
+ terminalSteppers,
1931
+ repeatFrontiers,
1932
+ repeatTerminals,
1933
+ reverseEndpoints,
1934
+ stepperFrameBudgets: /* @__PURE__ */ new Map(),
1935
+ zeroDurationOccurrences,
1936
+ sampledTimelineEvents: [],
1937
+ nextTimelineSourceOrder: { value: 0 },
1938
+ activeStepperKeys: /* @__PURE__ */ new Set(),
1939
+ activeRepeatFrontierKeys: /* @__PURE__ */ new Set(),
1940
+ activeReverseEndpointKeys: /* @__PURE__ */ new Set(),
1941
+ stepperTraces: [],
1942
+ frameId,
1943
+ replaySteppers
1944
+ };
1945
+ }
1946
+ function cloneRepeatFrontiers(source) {
1947
+ return new Map([...source].map(([key, frontier]) => [key, {
1948
+ programPath: frontier.programPath,
1949
+ repeatIterations: frontier.repeatIterations,
1950
+ completedIterations: frontier.completedIterations,
1951
+ elapsedMilliseconds: frontier.elapsedMilliseconds,
1952
+ iterationInputValues: new Map(frontier.iterationInputValues),
1953
+ values: new Map(frontier.values)
1954
+ }]));
1955
+ }
1956
+ function cloneStepperRecords(source) {
1957
+ return new Map([...source].map(([key, stepperRecord]) => [key, {
1958
+ ...stepperRecord,
1959
+ // A stepper's opaque state belongs to its callbacks. Pibbl can transact its
1960
+ // own mutable counters, but cannot clone arbitrary class/closure state
1961
+ // without changing user-observable identity or semantics.
1962
+ state: stepperRecord.state
1963
+ }]));
1964
+ }
1965
+ function cloneRepeatTerminals(source) {
1966
+ return new Map([...source].map(([key, terminal]) => [key, Object.freeze({
1967
+ ...terminal,
1968
+ values: new Map(terminal.values)
1969
+ })]));
1970
+ }
1971
+ function cloneReverseEndpoints(source) {
1972
+ return new Map([...source].map(([key, endpoint]) => [key, Object.freeze({
1973
+ ...endpoint,
1974
+ inputValues: new Map(endpoint.inputValues)
1975
+ })]));
1976
+ }
1977
+ function cloneProgramActivationRecord(source) {
1978
+ return {
1979
+ program: source.program,
1980
+ registration: source.registration,
1981
+ originalValues: source.originalValues,
1982
+ starts: new Map(source.starts),
1983
+ steppers: cloneStepperRecords(source.steppers),
1984
+ terminalSteppers: new Map(source.terminalSteppers),
1985
+ repeatFrontiers: cloneRepeatFrontiers(source.repeatFrontiers),
1986
+ repeatTerminals: cloneRepeatTerminals(source.repeatTerminals),
1987
+ reverseEndpoints: cloneReverseEndpoints(source.reverseEndpoints),
1988
+ terminalDuration: source.terminalDuration
1989
+ };
1990
+ }
1991
+ function createDiscoveryState(originalValues, starts, validateWriters, terminalSteppers = /* @__PURE__ */ new Map(), validateInputs = false) {
1992
+ return {
1993
+ values: new Map(originalValues),
1994
+ starts,
1995
+ durations: /* @__PURE__ */ new Map(),
1996
+ snapshots: /* @__PURE__ */ new WeakMap(),
1997
+ validateWriters,
1998
+ validateInputs,
1999
+ terminalSteppers
2000
+ };
2001
+ }
2002
+ function crossedMilestones(record, input, horizon, state, sampledEvents) {
2003
+ if (input.previousTime === input.time) return Object.freeze([]);
2004
+ const timeline = [...sampledEvents];
2005
+ collectTimeline(
2006
+ record.program,
2007
+ horizon,
2008
+ state,
2009
+ [],
2010
+ [],
2011
+ Object.freeze({ origin: 0, scale: 1 }),
2012
+ timeline,
2013
+ { value: state.nextTimelineSourceOrder.value },
2014
+ Math.min(input.previousTime ?? 0, input.time),
2015
+ Math.max(input.previousTime ?? 0, input.time)
2016
+ );
2017
+ const crossed = [];
2018
+ const seen = /* @__PURE__ */ new Set();
2019
+ for (const event of timeline) {
2020
+ const isCrossed = input.previousTime === void 0 ? event.programTime >= 0 && event.programTime <= input.time : input.direction === "forward" ? event.programTime > input.previousTime && event.programTime <= input.time : event.programTime >= input.time && event.programTime < input.previousTime;
2021
+ if (!isCrossed) continue;
2022
+ const key = JSON.stringify([
2023
+ event.kind,
2024
+ event.marker,
2025
+ event.programTime,
2026
+ event.iteration,
2027
+ event.repeatIterations,
2028
+ event.programPath
2029
+ ]);
2030
+ if (seen.has(key)) continue;
2031
+ seen.add(key);
2032
+ crossed.push(event);
2033
+ }
2034
+ crossed.sort((first, second) => {
2035
+ const timeOrder = input.direction === "forward" ? first.programTime - second.programTime : second.programTime - first.programTime;
2036
+ return timeOrder === 0 ? first.sourceOrder - second.sourceOrder : timeOrder;
2037
+ });
2038
+ return Object.freeze(crossed.map((event) => Object.freeze(event.kind === "marker" ? {
2039
+ kind: "marker",
2040
+ marker: event.marker,
2041
+ programTime: event.programTime,
2042
+ frameId: input.frameId,
2043
+ registration: record.registration,
2044
+ programPath: freezePath(event.programPath),
2045
+ iteration: event.iteration
2046
+ } : {
2047
+ kind: "iteration",
2048
+ programTime: event.programTime,
2049
+ frameId: input.frameId,
2050
+ registration: record.registration,
2051
+ programPath: freezePath(event.programPath),
2052
+ iteration: event.iteration
2053
+ })));
2054
+ }
2055
+ function evaluate(activation, input, rebuildStarts) {
2056
+ assertEvaluationInput(input);
2057
+ const record = activationRecord(activation);
2058
+ const time = Math.max(0, input.time);
2059
+ const previousTime = input.previousTime === void 0 ? void 0 : Math.max(0, input.previousTime);
2060
+ if (rebuildStarts && input.direction === "reverse" && previousTime === void 0 && knownProgramTerminalDuration(record) === void 0) {
2061
+ throw new TypeError(
2062
+ "Pibbl animation stateful terminal time is not discovered; reverse-from-idle is unavailable."
2063
+ );
2064
+ }
2065
+ const normalizedInput = { ...input, time, previousTime };
2066
+ const horizon = Math.max(time, previousTime ?? time);
2067
+ const replaySteppers = rebuildStarts || input.direction === "reverse" || previousTime !== void 0 && time < previousTime;
2068
+ const destinationStarts = rebuildStarts ? /* @__PURE__ */ new Map() : new Map(record.starts);
2069
+ const destinationSteppers = replaySteppers ? /* @__PURE__ */ new Map() : new Map(record.steppers);
2070
+ const destinationTerminals = new Map(record.terminalSteppers);
2071
+ const destinationRepeatFrontiers = replaySteppers ? /* @__PURE__ */ new Map() : cloneRepeatFrontiers(record.repeatFrontiers);
2072
+ const destinationRepeatTerminals = replaySteppers ? /* @__PURE__ */ new Map() : new Map(record.repeatTerminals);
2073
+ const destinationReverseEndpoints = replaySteppers ? /* @__PURE__ */ new Map() : new Map(record.reverseEndpoints);
2074
+ const zeroDurationOccurrences = { value: 0 };
2075
+ let seededDurations = /* @__PURE__ */ new Map();
2076
+ if (needsCallbackFreeDurationSeed(record.program)) {
2077
+ const seedState = createDiscoveryState(
2078
+ record.originalValues,
2079
+ new Map(destinationStarts),
2080
+ false,
2081
+ destinationTerminals
2082
+ );
2083
+ discoverNode(record.program, time, seedState, [], []);
2084
+ seededDurations = seedState.durations;
2085
+ }
2086
+ const destinationState = createSampleState(
2087
+ record,
2088
+ destinationStarts,
2089
+ seededDurations,
2090
+ destinationSteppers,
2091
+ destinationTerminals,
2092
+ destinationRepeatFrontiers,
2093
+ destinationRepeatTerminals,
2094
+ destinationReverseEndpoints,
2095
+ input.frameId,
2096
+ replaySteppers,
2097
+ zeroDurationOccurrences
2098
+ );
2099
+ try {
2100
+ const destinationResult = sampleNode(record.program, time, destinationState, [], []);
2101
+ const exactDuration = getExactSeekableProgramDuration(record.program);
2102
+ let discoveredDuration = exactDuration;
2103
+ let milestoneState = destinationState;
2104
+ let milestoneEvents = destinationState.sampledTimelineEvents;
2105
+ const needsReverseHorizonReplay = input.direction === "reverse" && horizon > time && programContainsStepper(record.program);
2106
+ if (needsReverseHorizonReplay) {
2107
+ const horizonState = createSampleState(
2108
+ record,
2109
+ /* @__PURE__ */ new Map(),
2110
+ /* @__PURE__ */ new Map(),
2111
+ /* @__PURE__ */ new Map(),
2112
+ /* @__PURE__ */ new Map(),
2113
+ /* @__PURE__ */ new Map(),
2114
+ /* @__PURE__ */ new Map(),
2115
+ new Map(record.reverseEndpoints),
2116
+ input.frameId,
2117
+ true,
2118
+ zeroDurationOccurrences
2119
+ );
2120
+ sampleNode(record.program, horizon, horizonState, [], []);
2121
+ milestoneState = horizonState;
2122
+ milestoneEvents = horizonState.sampledTimelineEvents;
2123
+ }
2124
+ if (exactDuration === void 0) {
2125
+ const discoveryState = createDiscoveryState(
2126
+ record.originalValues,
2127
+ new Map(destinationState.starts),
2128
+ false,
2129
+ destinationState.terminalSteppers
2130
+ );
2131
+ const discoveryResult = discoverNode(
2132
+ record.program,
2133
+ horizon,
2134
+ discoveryState,
2135
+ [],
2136
+ []
2137
+ );
2138
+ discoveredDuration = discoveryResult.duration;
2139
+ if (!needsReverseHorizonReplay) {
2140
+ milestoneState = createSampleState(
2141
+ record,
2142
+ discoveryState.starts,
2143
+ discoveryState.durations,
2144
+ /* @__PURE__ */ new Map(),
2145
+ destinationState.terminalSteppers,
2146
+ /* @__PURE__ */ new Map(),
2147
+ /* @__PURE__ */ new Map(),
2148
+ /* @__PURE__ */ new Map(),
2149
+ 0,
2150
+ false,
2151
+ zeroDurationOccurrences
2152
+ );
2153
+ }
2154
+ }
2155
+ const milestones = crossedMilestones(
2156
+ record,
2157
+ normalizedInput,
2158
+ horizon,
2159
+ milestoneState,
2160
+ milestoneEvents
2161
+ );
2162
+ for (const key of destinationState.steppers.keys()) {
2163
+ if (!destinationState.activeStepperKeys.has(key)) {
2164
+ destinationState.steppers.delete(key);
2165
+ }
2166
+ }
2167
+ for (const key of destinationState.repeatFrontiers.keys()) {
2168
+ if (!destinationState.activeRepeatFrontierKeys.has(key)) {
2169
+ destinationState.repeatFrontiers.delete(key);
2170
+ }
2171
+ }
2172
+ for (const key of destinationState.reverseEndpoints.keys()) {
2173
+ if (!destinationState.activeReverseEndpointKeys.has(key)) {
2174
+ destinationState.reverseEndpoints.delete(key);
2175
+ }
2176
+ }
2177
+ if (destinationResult.atEnd) {
2178
+ destinationState.steppers.clear();
2179
+ destinationState.terminalSteppers.clear();
2180
+ destinationState.repeatFrontiers.clear();
2181
+ destinationState.repeatTerminals.clear();
2182
+ destinationState.reverseEndpoints.clear();
2183
+ }
2184
+ record.starts = destinationState.starts;
2185
+ record.steppers = destinationState.steppers;
2186
+ record.terminalSteppers = destinationState.terminalSteppers;
2187
+ record.repeatFrontiers = destinationState.repeatFrontiers;
2188
+ record.repeatTerminals = destinationState.repeatTerminals;
2189
+ record.reverseEndpoints = destinationState.reverseEndpoints;
2190
+ for (const output of getProgramRecord(record.program).outputs) {
2191
+ if (destinationState.writtenOutputs.has(output)) {
2192
+ input.batch.stage(output, destinationState.batch.read(output), input.writer);
2193
+ }
2194
+ }
2195
+ const atStart = time === 0;
2196
+ const atEnd = destinationResult.atEnd;
2197
+ const duration = discoveredDuration ?? destinationResult.duration;
2198
+ if (duration !== void 0 && Number.isFinite(duration)) {
2199
+ record.terminalDuration = duration;
2200
+ }
2201
+ return Object.freeze({
2202
+ batch: input.batch,
2203
+ milestones,
2204
+ steppers: Object.freeze([...destinationState.stepperTraces]),
2205
+ terminal: Object.freeze({
2206
+ duration,
2207
+ atStart,
2208
+ atEnd,
2209
+ reached: input.direction === "forward" ? atEnd : atStart
2210
+ })
2211
+ });
2212
+ } catch (error) {
2213
+ if (programContainsStepper(record.program)) {
2214
+ record.steppers.clear();
2215
+ record.terminalSteppers.clear();
2216
+ record.repeatFrontiers.clear();
2217
+ record.repeatTerminals.clear();
2218
+ record.reverseEndpoints.clear();
2219
+ record.terminalDuration = void 0;
2220
+ }
2221
+ throw error;
2222
+ }
2223
+ }
2224
+ function activateProgram(program, registration) {
2225
+ if (typeof registration !== "object" || registration === null) {
2226
+ throw new TypeError("Pibbl animation registration identity must be an object.");
2227
+ }
2228
+ const originalValues = captureProgramOriginalValues(program, false);
2229
+ const activation = Object.freeze({});
2230
+ activationRecords.set(activation, {
2231
+ program,
2232
+ registration,
2233
+ originalValues,
2234
+ starts: /* @__PURE__ */ new Map(),
2235
+ steppers: /* @__PURE__ */ new Map(),
2236
+ terminalSteppers: /* @__PURE__ */ new Map(),
2237
+ repeatFrontiers: /* @__PURE__ */ new Map(),
2238
+ repeatTerminals: /* @__PURE__ */ new Map(),
2239
+ reverseEndpoints: /* @__PURE__ */ new Map(),
2240
+ terminalDuration: void 0
2241
+ });
2242
+ registerActivationStepperKeys(activation, []);
2243
+ return activation;
2244
+ }
2245
+ function forkProgramActivation(activation) {
2246
+ const fork = Object.freeze({});
2247
+ const record = cloneProgramActivationRecord(activationRecord(activation));
2248
+ activationRecords.set(fork, record);
2249
+ registerActivationStepperKeys(fork, record.steppers.keys());
2250
+ return fork;
2251
+ }
2252
+ function adoptProgramActivationFork(activation, fork) {
2253
+ const target = activationRecord(activation);
2254
+ const source = activationRecord(fork);
2255
+ if (source.program !== target.program || source.registration !== target.registration || source.originalValues !== target.originalValues) {
2256
+ throw new TypeError("Pibbl animation activation fork does not belong to this activation.");
2257
+ }
2258
+ reconcileActivationStepperKeys(activation);
2259
+ reconcileActivationStepperKeys(fork);
2260
+ releaseActivationStepperKeys(activation);
2261
+ const forkKeys = activationStepperKeys.get(fork) ?? /* @__PURE__ */ new Set();
2262
+ activationStepperKeys.delete(fork);
2263
+ activationStepperKeys.set(activation, forkKeys);
2264
+ target.starts = source.starts;
2265
+ target.steppers = source.steppers;
2266
+ target.terminalSteppers = source.terminalSteppers;
2267
+ target.repeatFrontiers = source.repeatFrontiers;
2268
+ target.repeatTerminals = source.repeatTerminals;
2269
+ target.reverseEndpoints = source.reverseEndpoints;
2270
+ target.terminalDuration = source.terminalDuration;
2271
+ activationRecords.delete(fork);
2272
+ }
2273
+ function captureProgramOriginalValues(program, validateInputs) {
2274
+ const programRecord = getProgramRecord(program);
2275
+ const snapshots = /* @__PURE__ */ new WeakMap();
2276
+ const originalValues = /* @__PURE__ */ new Map();
2277
+ for (const output of programRecord.outputs) {
2278
+ originalValues.set(
2279
+ output,
2280
+ snapshotAnimationActivationValue(getSignalNode(output).value, snapshots)
2281
+ );
2282
+ }
2283
+ if (validateInputs) validateCapturedDefinitionInputs(program, originalValues);
2284
+ validateActivationWriterSafety(program, originalValues);
2285
+ return immutableMap(originalValues);
2286
+ }
2287
+ function validateCapturedDefinitionInputs(program, originalValues) {
2288
+ if (!requiresCapturedDefinitionInput(program)) return;
2289
+ const state = createDiscoveryState(
2290
+ originalValues,
2291
+ /* @__PURE__ */ new Map(),
2292
+ false,
2293
+ /* @__PURE__ */ new Map(),
2294
+ true
2295
+ );
2296
+ discoverNode(program, Number.POSITIVE_INFINITY, state, [], []);
2297
+ }
2298
+ function requiresCapturedDefinitionInput(program) {
2299
+ const record = getProgramRecord(program);
2300
+ if (record.kind === "track") {
2301
+ const definition = getDefinitionRecord(record.definition);
2302
+ return definition.kind === "spring" && !definition.hasFrom || definition.kind === "tween" && !definition.hasFrom;
2303
+ }
2304
+ return record.children.some(requiresCapturedDefinitionInput);
2305
+ }
2306
+ function preflightProgramActivation(program) {
2307
+ captureProgramOriginalValues(program, true);
2308
+ }
2309
+ function evaluateProgram(activation, input) {
2310
+ try {
2311
+ return evaluate(activation, input, false);
2312
+ } finally {
2313
+ reconcileActivationStepperKeys(activation);
2314
+ }
2315
+ }
2316
+ function seekProgram(activation, input) {
2317
+ try {
2318
+ return evaluate(activation, input, true);
2319
+ } finally {
2320
+ reconcileActivationStepperKeys(activation);
2321
+ }
2322
+ }
2323
+ function finishProgram(activation, input) {
2324
+ const record = activationRecord(activation);
2325
+ const duration = knownProgramTerminalDuration(record);
2326
+ if (duration === void 0) {
2327
+ throw new TypeError(
2328
+ "Pibbl animation stateful terminal time is not discovered; finish is unavailable."
2329
+ );
2330
+ }
2331
+ try {
2332
+ return evaluate(activation, {
2333
+ ...input,
2334
+ time: duration,
2335
+ direction: "forward"
2336
+ }, true);
2337
+ } finally {
2338
+ reconcileActivationStepperKeys(activation);
2339
+ }
2340
+ }
2341
+ function releaseProgramActivation(activation) {
2342
+ const record = activationRecord(activation);
2343
+ reconcileActivationStepperKeys(activation);
2344
+ releaseActivationStepperKeys(activation);
2345
+ record.starts.clear();
2346
+ record.steppers.clear();
2347
+ record.terminalSteppers.clear();
2348
+ record.repeatFrontiers.clear();
2349
+ record.repeatTerminals.clear();
2350
+ record.reverseEndpoints.clear();
2351
+ activationRecords.delete(activation);
2352
+ }
2353
+ function getProgramActivationRecord(activation) {
2354
+ const record = activationRecord(activation);
2355
+ return Object.freeze({
2356
+ program: record.program,
2357
+ registration: record.registration,
2358
+ originalValues: record.originalValues,
2359
+ trackStarts: Object.freeze([...record.starts.values()].map((start) => Object.freeze({
2360
+ programPath: freezePath(start.programPath),
2361
+ repeatIterations: freezePath(start.repeatIterations),
2362
+ initialValue: start.initialValue,
2363
+ duration: start.definition.duration
2364
+ }))),
2365
+ activeSteppers: Object.freeze([...record.steppers.values()].map(
2366
+ (stepperRecord) => Object.freeze({
2367
+ programPath: freezePath(stepperRecord.programPath),
2368
+ repeatIterations: freezePath(stepperRecord.repeatIterations),
2369
+ wholeSteps: stepperRecord.wholeSteps,
2370
+ retainedRemainderMilliseconds: stepperRecord.remainderMilliseconds,
2371
+ appliedElapsedMilliseconds: stepperRecord.appliedElapsedMilliseconds,
2372
+ discardedElapsedMilliseconds: stepperRecord.discardedElapsedMilliseconds
2373
+ })
2374
+ )),
2375
+ terminalSteppers: Object.freeze([...record.terminalSteppers.values()].map(
2376
+ (terminal) => Object.freeze({
2377
+ programPath: freezePath(terminal.programPath),
2378
+ repeatIterations: freezePath(terminal.repeatIterations),
2379
+ terminalStep: terminal.terminalStep,
2380
+ terminalTime: terminal.terminalTime
2381
+ })
2382
+ )),
2383
+ terminalDuration: record.terminalDuration
2384
+ });
2385
+ }
2386
+ export {
2387
+ activateProgram,
2388
+ adoptProgramActivationFork,
2389
+ animationEvaluationOwnershipSnapshot,
2390
+ evaluateProgram,
2391
+ finishProgram,
2392
+ forkProgramActivation,
2393
+ getProgramActivationRecord,
2394
+ preflightProgramActivation,
2395
+ releaseProgramActivation,
2396
+ seekProgram
2397
+ };
2398
+ //# sourceMappingURL=evaluate.js.map