@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.6

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 (904) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +48 -0
  4. package/README.md +93 -72
  5. package/dist/assets/asset-index.js.map +1 -1
  6. package/dist/assets/catalog.d.ts +9 -0
  7. package/dist/assets/catalog.d.ts.map +1 -1
  8. package/dist/assets/catalog.js +11 -0
  9. package/dist/assets/catalog.js.map +1 -1
  10. package/dist/assets/errors.d.ts.map +1 -1
  11. package/dist/assets/errors.js +8 -3
  12. package/dist/assets/errors.js.map +1 -1
  13. package/dist/assets/index.js.map +1 -1
  14. package/dist/assets/manager.d.ts +26 -1
  15. package/dist/assets/manager.d.ts.map +1 -1
  16. package/dist/assets/manager.js +79 -4
  17. package/dist/assets/manager.js.map +1 -1
  18. package/dist/assets/manifest.js.map +1 -1
  19. package/dist/assets/record.js.map +1 -1
  20. package/dist/assets/scope.d.ts +3 -3
  21. package/dist/assets/scope.d.ts.map +1 -1
  22. package/dist/assets/scope.js.map +1 -1
  23. package/dist/attributes/audio/filters/chain.d.ts +1 -1
  24. package/dist/attributes/audio/filters/chain.js.map +1 -1
  25. package/dist/attributes/audio/filters/curve.d.ts +8 -8
  26. package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
  27. package/dist/attributes/audio/filters/curve.js +20 -19
  28. package/dist/attributes/audio/filters/curve.js.map +1 -1
  29. package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
  30. package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
  31. package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
  32. package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
  33. package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
  34. package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
  35. package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
  36. package/dist/attributes/audio/filters/index.d.ts +1 -1
  37. package/dist/attributes/audio/filters/index.d.ts.map +1 -1
  38. package/dist/attributes/audio/filters/index.js +1 -1
  39. package/dist/attributes/audio/filters/index.js.map +1 -1
  40. package/dist/attributes/audio/filters/registry.js.map +1 -1
  41. package/dist/attributes/audio/filters/union.js.map +1 -1
  42. package/dist/attributes/audio/request.d.ts +17 -2
  43. package/dist/attributes/audio/request.d.ts.map +1 -1
  44. package/dist/attributes/audio/request.js.map +1 -1
  45. package/dist/attributes/audio/schedule.d.ts +4 -2
  46. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  47. package/dist/attributes/audio/schedule.js +15 -8
  48. package/dist/attributes/audio/schedule.js.map +1 -1
  49. package/dist/attributes/audio/sound.d.ts +4 -2
  50. package/dist/attributes/audio/sound.d.ts.map +1 -1
  51. package/dist/attributes/audio/sound.js +8 -4
  52. package/dist/attributes/audio/sound.js.map +1 -1
  53. package/dist/attributes/index.js.map +1 -1
  54. package/dist/attributes/layout/alignment.js +1 -1
  55. package/dist/attributes/layout/alignment.js.map +1 -1
  56. package/dist/attributes/layout/index.js.map +1 -1
  57. package/dist/attributes/layout/insets.js.map +1 -1
  58. package/dist/attributes/layout/matrix2d.js.map +1 -1
  59. package/dist/attributes/layout/size.js.map +1 -1
  60. package/dist/attributes/layout/transform3d.js.map +1 -1
  61. package/dist/attributes/layout/vector2.js.map +1 -1
  62. package/dist/attributes/layout/world-transform.js.map +1 -1
  63. package/dist/attributes/mask/boolean.js.map +1 -1
  64. package/dist/attributes/mask/mask.js.map +1 -1
  65. package/dist/attributes/properties/decorator.d.ts +3 -1
  66. package/dist/attributes/properties/decorator.d.ts.map +1 -1
  67. package/dist/attributes/properties/decorator.js.map +1 -1
  68. package/dist/attributes/properties/inputs.js.map +1 -1
  69. package/dist/attributes/properties/typed.d.ts +9 -2
  70. package/dist/attributes/properties/typed.d.ts.map +1 -1
  71. package/dist/attributes/properties/typed.js +15 -1
  72. package/dist/attributes/properties/typed.js.map +1 -1
  73. package/dist/attributes/render3d/orbit.d.ts +8 -8
  74. package/dist/attributes/render3d/orbit.js +7 -7
  75. package/dist/attributes/render3d/orbit.js.map +1 -1
  76. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  77. package/dist/attributes/shape/corners/corner-style.js.map +1 -1
  78. package/dist/attributes/shape/corners/corners.js.map +1 -1
  79. package/dist/attributes/shape/corners/index.js.map +1 -1
  80. package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
  81. package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
  82. package/dist/attributes/shape/effects/backdrop.js.map +1 -1
  83. package/dist/attributes/shape/effects/chain.d.ts +28 -120
  84. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  85. package/dist/attributes/shape/effects/chain.js +16 -88
  86. package/dist/attributes/shape/effects/chain.js.map +1 -1
  87. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  88. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  90. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  92. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  94. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
  96. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  97. package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
  98. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  99. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  100. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  101. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  102. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  103. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  104. package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
  105. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  106. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  108. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  110. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  112. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
  114. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  116. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  118. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  120. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  122. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  124. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  126. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/shader.js +15 -8
  128. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  130. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  132. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  134. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  136. package/dist/attributes/shape/effects/index.d.ts +2 -6
  137. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  138. package/dist/attributes/shape/effects/index.js.map +1 -1
  139. package/dist/attributes/shape/effects/registry.d.ts +23 -6
  140. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  141. package/dist/attributes/shape/effects/registry.js +44 -10
  142. package/dist/attributes/shape/effects/registry.js.map +1 -1
  143. package/dist/attributes/shape/effects/union.d.ts +2 -6
  144. package/dist/attributes/shape/effects/union.d.ts.map +1 -1
  145. package/dist/attributes/shape/effects/union.js.map +1 -1
  146. package/dist/attributes/shape/fill/blend.js.map +1 -1
  147. package/dist/attributes/shape/fill/chain.js.map +1 -1
  148. package/dist/attributes/shape/fill/coerce.js.map +1 -1
  149. package/dist/attributes/shape/fill/color/constants.js.map +1 -1
  150. package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
  151. package/dist/attributes/shape/fill/color/parser.js +81 -44
  152. package/dist/attributes/shape/fill/color/parser.js.map +1 -1
  153. package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
  154. package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
  155. package/dist/attributes/shape/fill/gradient-stops.js +65 -0
  156. package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
  157. package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
  158. package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
  159. package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
  160. package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
  161. package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
  162. package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
  163. package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
  164. package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
  165. package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
  166. package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
  167. package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
  168. package/dist/attributes/shape/fill/implementations/image.js +5 -4
  169. package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
  170. package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
  171. package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
  172. package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
  173. package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
  174. package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
  175. package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
  176. package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
  177. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  178. package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
  179. package/dist/attributes/shape/fill/implementations/video.js +1 -1
  180. package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
  181. package/dist/attributes/shape/fill/index.js.map +1 -1
  182. package/dist/attributes/shape/fill/lerp.js.map +1 -1
  183. package/dist/attributes/shape/fill/media-preset.js.map +1 -1
  184. package/dist/attributes/shape/fill/registry.js.map +1 -1
  185. package/dist/attributes/shape/fill/union.js.map +1 -1
  186. package/dist/attributes/shape/filters/chain.d.ts +4 -10
  187. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  188. package/dist/attributes/shape/filters/chain.js +1 -13
  189. package/dist/attributes/shape/filters/chain.js.map +1 -1
  190. package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
  191. package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
  192. package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
  193. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  194. package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
  195. package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
  196. package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
  197. package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
  198. package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
  199. package/dist/attributes/shape/filters/index.d.ts +1 -1
  200. package/dist/attributes/shape/filters/index.js.map +1 -1
  201. package/dist/attributes/shape/filters/registry.d.ts +2 -2
  202. package/dist/attributes/shape/filters/registry.js +3 -3
  203. package/dist/attributes/shape/filters/registry.js.map +1 -1
  204. package/dist/attributes/shape/filters/union.d.ts +6 -7
  205. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  206. package/dist/attributes/shape/filters/union.js.map +1 -1
  207. package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
  208. package/dist/attributes/shape/path/anchors.js +12 -5
  209. package/dist/attributes/shape/path/anchors.js.map +1 -1
  210. package/dist/attributes/shape/path/bezier.js.map +1 -1
  211. package/dist/attributes/shape/path/index.js.map +1 -1
  212. package/dist/attributes/shape/path/measure.js.map +1 -1
  213. package/dist/attributes/shape/path/morph.d.ts.map +1 -1
  214. package/dist/attributes/shape/path/morph.js +16 -4
  215. package/dist/attributes/shape/path/morph.js.map +1 -1
  216. package/dist/attributes/shape/path/ops.js.map +1 -1
  217. package/dist/attributes/shape/path/types.js.map +1 -1
  218. package/dist/attributes/shape/path/walk.js.map +1 -1
  219. package/dist/attributes/shape/shaders/index.js.map +1 -1
  220. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  221. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  222. package/dist/attributes/shape/shadow/index.js.map +1 -1
  223. package/dist/attributes/shape/shadow/shadow.js.map +1 -1
  224. package/dist/attributes/shape/stroke/index.d.ts +2 -2
  225. package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
  226. package/dist/attributes/shape/stroke/index.js +1 -1
  227. package/dist/attributes/shape/stroke/index.js.map +1 -1
  228. package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
  229. package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
  230. package/dist/attributes/shape/stroke/stroke.js +22 -2
  231. package/dist/attributes/shape/stroke/stroke.js.map +1 -1
  232. package/dist/attributes/shared/operators.js.map +1 -1
  233. package/dist/attributes/text/index.js.map +1 -1
  234. package/dist/attributes/text/ops.d.ts +6 -0
  235. package/dist/attributes/text/ops.d.ts.map +1 -1
  236. package/dist/attributes/text/ops.js +1 -0
  237. package/dist/attributes/text/ops.js.map +1 -1
  238. package/dist/attributes/text/types.js.map +1 -1
  239. package/dist/browser/chunks/chunk-2RIYH36X.js +3 -0
  240. package/dist/browser/chunks/chunk-2RIYH36X.js.map +7 -0
  241. package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
  242. package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
  243. package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
  244. package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
  245. package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
  246. package/dist/browser/chunks/chunk-EJDPYDQI.js.map +7 -0
  247. package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
  248. package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
  249. package/dist/browser/chunks/chunk-XAWE4EAK.js +2 -0
  250. package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
  251. package/dist/browser/component.js +1 -1
  252. package/dist/browser/component.js.map +4 -4
  253. package/dist/browser/experimental.js +2 -0
  254. package/dist/browser/experimental.js.map +7 -0
  255. package/dist/browser/index.js +1 -1
  256. package/dist/browser/index.js.map +4 -4
  257. package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
  258. package/dist/browser/jsx-jsx-runtime.js +1 -1
  259. package/dist/browser/manifest.json +4 -2
  260. package/dist/browser/sdk.js +1 -1
  261. package/dist/component/api.d.ts +508 -0
  262. package/dist/component/api.d.ts.map +1 -0
  263. package/dist/component/api.js +4 -0
  264. package/dist/component/api.js.map +1 -0
  265. package/dist/component/builtins/audio.d.ts +26 -0
  266. package/dist/component/builtins/audio.d.ts.map +1 -0
  267. package/dist/component/builtins/audio.js +41 -0
  268. package/dist/component/builtins/audio.js.map +1 -0
  269. package/dist/component/builtins/canvas3d.d.ts +98 -0
  270. package/dist/component/builtins/canvas3d.d.ts.map +1 -0
  271. package/dist/component/builtins/canvas3d.js +21 -0
  272. package/dist/component/builtins/canvas3d.js.map +1 -0
  273. package/dist/component/builtins/composite.d.ts +56 -0
  274. package/dist/component/builtins/composite.d.ts.map +1 -0
  275. package/dist/component/builtins/composite.js +25 -0
  276. package/dist/component/builtins/composite.js.map +1 -0
  277. package/dist/component/builtins/geometry.d.ts +505 -0
  278. package/dist/component/builtins/geometry.d.ts.map +1 -0
  279. package/dist/component/builtins/geometry.js +107 -0
  280. package/dist/component/builtins/geometry.js.map +1 -0
  281. package/dist/component/builtins/layout.d.ts +88 -0
  282. package/dist/component/builtins/layout.d.ts.map +1 -0
  283. package/dist/component/builtins/layout.js +84 -0
  284. package/dist/component/builtins/layout.js.map +1 -0
  285. package/dist/component/builtins/media.d.ts +95 -0
  286. package/dist/component/builtins/media.d.ts.map +1 -0
  287. package/dist/component/builtins/media.js +149 -0
  288. package/dist/component/builtins/media.js.map +1 -0
  289. package/dist/component/builtins/providers.d.ts +23 -0
  290. package/dist/component/builtins/providers.d.ts.map +1 -0
  291. package/dist/component/builtins/providers.js +30 -0
  292. package/dist/component/builtins/providers.js.map +1 -0
  293. package/dist/component/builtins/text.d.ts +193 -0
  294. package/dist/component/builtins/text.d.ts.map +1 -0
  295. package/dist/component/builtins/text.js +113 -0
  296. package/dist/component/builtins/text.js.map +1 -0
  297. package/dist/component/builtins/three.d.ts +1085 -0
  298. package/dist/component/builtins/three.d.ts.map +1 -0
  299. package/dist/component/builtins/three.js +265 -0
  300. package/dist/component/builtins/three.js.map +1 -0
  301. package/dist/component/clip-of.d.ts +5 -0
  302. package/dist/component/clip-of.d.ts.map +1 -0
  303. package/dist/component/clip-of.js +33 -0
  304. package/dist/component/clip-of.js.map +1 -0
  305. package/dist/component/commands-for.d.ts +19 -0
  306. package/dist/component/commands-for.d.ts.map +1 -0
  307. package/dist/component/commands-for.js +5 -0
  308. package/dist/component/commands-for.js.map +1 -0
  309. package/dist/component/component-audio.d.ts +9 -0
  310. package/dist/component/component-audio.d.ts.map +1 -0
  311. package/dist/component/component-audio.js +18 -0
  312. package/dist/component/component-audio.js.map +1 -0
  313. package/dist/component/component2d.d.ts +9 -0
  314. package/dist/component/component2d.d.ts.map +1 -0
  315. package/dist/component/component2d.js +239 -0
  316. package/dist/component/component2d.js.map +1 -0
  317. package/dist/component/component3d.d.ts +9 -0
  318. package/dist/component/component3d.d.ts.map +1 -0
  319. package/dist/component/component3d.js +99 -0
  320. package/dist/component/component3d.js.map +1 -0
  321. package/dist/component/factory.d.ts +63 -0
  322. package/dist/component/factory.d.ts.map +1 -0
  323. package/dist/component/factory.js +313 -0
  324. package/dist/component/factory.js.map +1 -0
  325. package/dist/component/modules/aim.d.ts +30 -0
  326. package/dist/component/modules/aim.d.ts.map +1 -0
  327. package/dist/component/modules/aim.js +39 -0
  328. package/dist/component/modules/aim.js.map +1 -0
  329. package/dist/component/modules/corners.d.ts +13 -0
  330. package/dist/component/modules/corners.d.ts.map +1 -0
  331. package/dist/component/modules/corners.js +12 -0
  332. package/dist/component/modules/corners.js.map +1 -0
  333. package/dist/component/modules/flow.d.ts +26 -0
  334. package/dist/component/modules/flow.d.ts.map +1 -0
  335. package/dist/component/modules/flow.js +55 -0
  336. package/dist/component/modules/flow.js.map +1 -0
  337. package/dist/component/modules/material.d.ts +40 -0
  338. package/dist/component/modules/material.d.ts.map +1 -0
  339. package/dist/component/modules/material.js +75 -0
  340. package/dist/component/modules/material.js.map +1 -0
  341. package/dist/component/modules/paint.d.ts +71 -0
  342. package/dist/component/modules/paint.d.ts.map +1 -0
  343. package/dist/component/modules/paint.js +106 -0
  344. package/dist/component/modules/paint.js.map +1 -0
  345. package/dist/component/modules/shapes.d.ts +31 -0
  346. package/dist/component/modules/shapes.d.ts.map +1 -0
  347. package/dist/component/modules/shapes.js +43 -0
  348. package/dist/component/modules/shapes.js.map +1 -0
  349. package/dist/component/modules/text-layout.d.ts +26 -0
  350. package/dist/component/modules/text-layout.d.ts.map +1 -0
  351. package/dist/component/modules/text-layout.js +57 -0
  352. package/dist/component/modules/text-layout.js.map +1 -0
  353. package/dist/component/modules/text-style.d.ts +48 -0
  354. package/dist/component/modules/text-style.d.ts.map +1 -0
  355. package/dist/component/modules/text-style.js +63 -0
  356. package/dist/component/modules/text-style.js.map +1 -0
  357. package/dist/component/modules/three-entries.d.ts +23 -0
  358. package/dist/component/modules/three-entries.d.ts.map +1 -0
  359. package/dist/component/modules/three-entries.js +41 -0
  360. package/dist/component/modules/three-entries.js.map +1 -0
  361. package/dist/component/modules/view3d.d.ts +55 -0
  362. package/dist/component/modules/view3d.d.ts.map +1 -0
  363. package/dist/component/modules/view3d.js +160 -0
  364. package/dist/component/modules/view3d.js.map +1 -0
  365. package/dist/component/timeline.d.ts +22 -0
  366. package/dist/component/timeline.d.ts.map +1 -0
  367. package/dist/component/timeline.js +128 -0
  368. package/dist/component/timeline.js.map +1 -0
  369. package/dist/component/type-def.d.ts +26 -0
  370. package/dist/component/type-def.d.ts.map +1 -0
  371. package/dist/component/type-def.js +16 -0
  372. package/dist/component/type-def.js.map +1 -0
  373. package/dist/component/types.d.ts +91 -0
  374. package/dist/component/types.d.ts.map +1 -0
  375. package/dist/component/types.js +88 -0
  376. package/dist/component/types.js.map +1 -0
  377. package/dist/component/views.d.ts +121 -0
  378. package/dist/component/views.d.ts.map +1 -0
  379. package/dist/component/views.js +413 -0
  380. package/dist/component/views.js.map +1 -0
  381. package/dist/component.d.ts +4 -5
  382. package/dist/component.d.ts.map +1 -1
  383. package/dist/component.js +3 -5
  384. package/dist/component.js.map +1 -1
  385. package/dist/document/audio.d.ts +10 -2
  386. package/dist/document/audio.d.ts.map +1 -1
  387. package/dist/document/audio.js +45 -4
  388. package/dist/document/audio.js.map +1 -1
  389. package/dist/document/builtins.d.ts.map +1 -1
  390. package/dist/document/builtins.js +15 -39
  391. package/dist/document/builtins.js.map +1 -1
  392. package/dist/document/command-traits.d.ts +1 -1
  393. package/dist/document/command-traits.js +16 -1
  394. package/dist/document/command-traits.js.map +1 -1
  395. package/dist/document/deny-globals.js.map +1 -1
  396. package/dist/document/diff.d.ts.map +1 -1
  397. package/dist/document/diff.js +3 -3
  398. package/dist/document/diff.js.map +1 -1
  399. package/dist/document/doc-index.d.ts +2 -2
  400. package/dist/document/doc-index.d.ts.map +1 -1
  401. package/dist/document/doc-index.js +3 -3
  402. package/dist/document/doc-index.js.map +1 -1
  403. package/dist/document/expression/compile.d.ts.map +1 -1
  404. package/dist/document/expression/compile.js +8 -5
  405. package/dist/document/expression/compile.js.map +1 -1
  406. package/dist/document/expression/index.js.map +1 -1
  407. package/dist/document/expression/ops.js +1 -1
  408. package/dist/document/expression/ops.js.map +1 -1
  409. package/dist/document/expression/parse.d.ts.map +1 -1
  410. package/dist/document/expression/parse.js +15 -6
  411. package/dist/document/expression/parse.js.map +1 -1
  412. package/dist/document/expression/refs.d.ts +1 -1
  413. package/dist/document/expression/refs.js +1 -1
  414. package/dist/document/expression/refs.js.map +1 -1
  415. package/dist/document/expression/types.js.map +1 -1
  416. package/dist/document/expression/walk.d.ts.map +1 -1
  417. package/dist/document/expression/walk.js +2 -1
  418. package/dist/document/expression/walk.js.map +1 -1
  419. package/dist/document/index.d.ts +2 -0
  420. package/dist/document/index.d.ts.map +1 -1
  421. package/dist/document/index.js +2 -0
  422. package/dist/document/index.js.map +1 -1
  423. package/dist/document/node-decorator.js.map +1 -1
  424. package/dist/document/node-descriptor.d.ts +25 -0
  425. package/dist/document/node-descriptor.d.ts.map +1 -1
  426. package/dist/document/node-descriptor.js.map +1 -1
  427. package/dist/document/placement.d.ts +70 -0
  428. package/dist/document/placement.d.ts.map +1 -0
  429. package/dist/document/placement.js +83 -0
  430. package/dist/document/placement.js.map +1 -0
  431. package/dist/document/project.d.ts +2 -2
  432. package/dist/document/project.d.ts.map +1 -1
  433. package/dist/document/project.js.map +1 -1
  434. package/dist/document/registry.d.ts +23 -11
  435. package/dist/document/registry.d.ts.map +1 -1
  436. package/dist/document/registry.js +46 -19
  437. package/dist/document/registry.js.map +1 -1
  438. package/dist/document/settled-index.d.ts +49 -0
  439. package/dist/document/settled-index.d.ts.map +1 -0
  440. package/dist/document/settled-index.js +247 -0
  441. package/dist/document/settled-index.js.map +1 -0
  442. package/dist/document/timeline-patch.js.map +1 -1
  443. package/dist/document/timeline.d.ts +100 -19
  444. package/dist/document/timeline.d.ts.map +1 -1
  445. package/dist/document/timeline.js +290 -42
  446. package/dist/document/timeline.js.map +1 -1
  447. package/dist/document/types.d.ts +12 -12
  448. package/dist/document/types.d.ts.map +1 -1
  449. package/dist/document/types.js +2 -2
  450. package/dist/document/types.js.map +1 -1
  451. package/dist/document/validate.d.ts +2 -2
  452. package/dist/document/validate.d.ts.map +1 -1
  453. package/dist/document/validate.js +37 -31
  454. package/dist/document/validate.js.map +1 -1
  455. package/dist/document/withdraw.d.ts +28 -0
  456. package/dist/document/withdraw.d.ts.map +1 -0
  457. package/dist/document/withdraw.js +61 -0
  458. package/dist/document/withdraw.js.map +1 -0
  459. package/dist/experimental.d.ts +22 -0
  460. package/dist/experimental.d.ts.map +1 -0
  461. package/dist/experimental.js +20 -0
  462. package/dist/experimental.js.map +1 -0
  463. package/dist/index.d.ts +10 -0
  464. package/dist/index.d.ts.map +1 -1
  465. package/dist/index.js +10 -0
  466. package/dist/index.js.map +1 -1
  467. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  468. package/dist/jsx/jsx-runtime.d.ts +9 -1
  469. package/dist/jsx/jsx-runtime.d.ts.map +1 -1
  470. package/dist/jsx/jsx-runtime.js +13 -3
  471. package/dist/jsx/jsx-runtime.js.map +1 -1
  472. package/dist/layout/bounds.d.ts +0 -1
  473. package/dist/layout/bounds.d.ts.map +1 -1
  474. package/dist/layout/bounds.js.map +1 -1
  475. package/dist/layout/constraints.js.map +1 -1
  476. package/dist/layout/flex.d.ts +4 -2
  477. package/dist/layout/flex.d.ts.map +1 -1
  478. package/dist/layout/flex.js +27 -11
  479. package/dist/layout/flex.js.map +1 -1
  480. package/dist/layout/freeform.js.map +1 -1
  481. package/dist/layout/grid.js.map +1 -1
  482. package/dist/layout/index.js.map +1 -1
  483. package/dist/layout/item.js.map +1 -1
  484. package/dist/layout/ops.d.ts +6 -0
  485. package/dist/layout/ops.d.ts.map +1 -1
  486. package/dist/layout/ops.js +6 -0
  487. package/dist/layout/ops.js.map +1 -1
  488. package/dist/layout/types.js.map +1 -1
  489. package/dist/nodes/2d/node-lifecycle.js.map +1 -1
  490. package/dist/nodes/2d/node-motion.js.map +1 -1
  491. package/dist/nodes/2d/node-render.d.ts +3 -3
  492. package/dist/nodes/2d/node-render.d.ts.map +1 -1
  493. package/dist/nodes/2d/node-render.js.map +1 -1
  494. package/dist/nodes/2d/node-transform.js.map +1 -1
  495. package/dist/nodes/2d/node2d.d.ts +115 -3
  496. package/dist/nodes/2d/node2d.d.ts.map +1 -1
  497. package/dist/nodes/2d/node2d.js +180 -28
  498. package/dist/nodes/2d/node2d.js.map +1 -1
  499. package/dist/nodes/2d/paint-node.d.ts +27 -0
  500. package/dist/nodes/2d/paint-node.d.ts.map +1 -1
  501. package/dist/nodes/2d/paint-node.js +42 -0
  502. package/dist/nodes/2d/paint-node.js.map +1 -1
  503. package/dist/nodes/audio/audio-bus.js.map +1 -1
  504. package/dist/nodes/audio/index.d.ts +2 -2
  505. package/dist/nodes/audio/index.d.ts.map +1 -1
  506. package/dist/nodes/audio/index.js +0 -2
  507. package/dist/nodes/audio/index.js.map +1 -1
  508. package/dist/nodes/audio/node-audio.js.map +1 -1
  509. package/dist/nodes/audio/sound-node.d.ts +4 -3
  510. package/dist/nodes/audio/sound-node.d.ts.map +1 -1
  511. package/dist/nodes/audio/sound-node.js +4 -1
  512. package/dist/nodes/audio/sound-node.js.map +1 -1
  513. package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
  514. package/dist/nodes/geometry/bounds-shape-node.js +2 -2
  515. package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
  516. package/dist/nodes/geometry/box-path-node.d.ts +3 -3
  517. package/dist/nodes/geometry/box-path-node.js +2 -2
  518. package/dist/nodes/geometry/box-path-node.js.map +1 -1
  519. package/dist/nodes/geometry/ellipse-node.js.map +1 -1
  520. package/dist/nodes/geometry/group-bounds.d.ts +2 -2
  521. package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
  522. package/dist/nodes/geometry/group-bounds.js +1 -2
  523. package/dist/nodes/geometry/group-bounds.js.map +1 -1
  524. package/dist/nodes/geometry/path-node.d.ts.map +1 -1
  525. package/dist/nodes/geometry/path-node.js +6 -0
  526. package/dist/nodes/geometry/path-node.js.map +1 -1
  527. package/dist/nodes/geometry/polygon-node.js.map +1 -1
  528. package/dist/nodes/geometry/polygram-node.js.map +1 -1
  529. package/dist/nodes/geometry/rect-node.js.map +1 -1
  530. package/dist/nodes/geometry/shape-node.js.map +1 -1
  531. package/dist/nodes/geometry/shape-outline.d.ts +2 -2
  532. package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
  533. package/dist/nodes/geometry/shape-outline.js +2 -13
  534. package/dist/nodes/geometry/shape-outline.js.map +1 -1
  535. package/dist/nodes/index.d.ts +40 -33
  536. package/dist/nodes/index.d.ts.map +1 -1
  537. package/dist/nodes/index.js +17 -36
  538. package/dist/nodes/index.js.map +1 -1
  539. package/dist/nodes/layout/camera-node.d.ts +9 -0
  540. package/dist/nodes/layout/camera-node.d.ts.map +1 -1
  541. package/dist/nodes/layout/camera-node.js +38 -3
  542. package/dist/nodes/layout/camera-node.js.map +1 -1
  543. package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
  544. package/dist/nodes/layout/orbit-camera-node.js +1 -1
  545. package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
  546. package/dist/nodes/layout/rotated-box.js.map +1 -1
  547. package/dist/nodes/media/video-node.d.ts.map +1 -1
  548. package/dist/nodes/media/video-node.js +2 -0
  549. package/dist/nodes/media/video-node.js.map +1 -1
  550. package/dist/nodes/node/declare-paints.js.map +1 -1
  551. package/dist/nodes/node/node-editor-state.js.map +1 -1
  552. package/dist/nodes/node/node-reactive.js.map +1 -1
  553. package/dist/nodes/node/node-time.d.ts +3 -3
  554. package/dist/nodes/node/node-time.d.ts.map +1 -1
  555. package/dist/nodes/node/node-time.js +1 -1
  556. package/dist/nodes/node/node-time.js.map +1 -1
  557. package/dist/nodes/node/node-walk.js.map +1 -1
  558. package/dist/nodes/node/node.d.ts +12 -4
  559. package/dist/nodes/node/node.d.ts.map +1 -1
  560. package/dist/nodes/node/node.js +67 -27
  561. package/dist/nodes/node/node.js.map +1 -1
  562. package/dist/nodes/node/text-defaults.d.ts +10 -12
  563. package/dist/nodes/node/text-defaults.d.ts.map +1 -1
  564. package/dist/nodes/node/text-defaults.js +10 -12
  565. package/dist/nodes/node/text-defaults.js.map +1 -1
  566. package/dist/nodes/{scene → root}/canvas2d-node.d.ts +4 -3
  567. package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
  568. package/dist/nodes/{scene → root}/canvas2d-node.js +5 -2
  569. package/dist/nodes/root/canvas2d-node.js.map +1 -0
  570. package/dist/nodes/root/provider-node.d.ts.map +1 -0
  571. package/dist/nodes/root/provider-node.js.map +1 -0
  572. package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
  573. package/dist/nodes/root/theme-provider-node.js.map +1 -0
  574. package/dist/nodes/text/default-text-style-node.d.ts +5 -2
  575. package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
  576. package/dist/nodes/text/default-text-style-node.js +10 -4
  577. package/dist/nodes/text/default-text-style-node.js.map +1 -1
  578. package/dist/nodes/text/number-format.d.ts +1 -1
  579. package/dist/nodes/text/number-format.js +1 -1
  580. package/dist/nodes/text/number-format.js.map +1 -1
  581. package/dist/nodes/text/number-node.js.map +1 -1
  582. package/dist/nodes/text/number-pattern.js.map +1 -1
  583. package/dist/nodes/text/richtext-node.d.ts +0 -5
  584. package/dist/nodes/text/richtext-node.d.ts.map +1 -1
  585. package/dist/nodes/text/richtext-node.js +6 -72
  586. package/dist/nodes/text/richtext-node.js.map +1 -1
  587. package/dist/nodes/text/text-base.d.ts +5 -22
  588. package/dist/nodes/text/text-base.d.ts.map +1 -1
  589. package/dist/nodes/text/text-base.js +13 -364
  590. package/dist/nodes/text/text-base.js.map +1 -1
  591. package/dist/nodes/text/text-layout.d.ts +87 -0
  592. package/dist/nodes/text/text-layout.d.ts.map +1 -0
  593. package/dist/nodes/text/text-layout.js +368 -0
  594. package/dist/nodes/text/text-layout.js.map +1 -0
  595. package/dist/nodes/text/text-node.js.map +1 -1
  596. package/dist/nodes/text/text-selection.js.map +1 -1
  597. package/dist/nodes/three/camera-nodes.d.ts +21 -3
  598. package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
  599. package/dist/nodes/three/camera-nodes.js +42 -1
  600. package/dist/nodes/three/camera-nodes.js.map +1 -1
  601. package/dist/nodes/three/canvas3d-node.d.ts +32 -7
  602. package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
  603. package/dist/nodes/three/canvas3d-node.js +50 -2
  604. package/dist/nodes/three/canvas3d-node.js.map +1 -1
  605. package/dist/nodes/three/drawable-nodes.d.ts +25 -11
  606. package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
  607. package/dist/nodes/three/drawable-nodes.js +43 -13
  608. package/dist/nodes/three/drawable-nodes.js.map +1 -1
  609. package/dist/nodes/three/environment-nodes.d.ts +9 -3
  610. package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
  611. package/dist/nodes/three/environment-nodes.js.map +1 -1
  612. package/dist/nodes/three/geometry-nodes.d.ts +2 -2
  613. package/dist/nodes/three/geometry-nodes.js +2 -2
  614. package/dist/nodes/three/geometry-nodes.js.map +1 -1
  615. package/dist/nodes/three/grid-geometry3d.js.map +1 -1
  616. package/dist/nodes/three/group3d.js.map +1 -1
  617. package/dist/nodes/three/light-nodes.d.ts.map +1 -1
  618. package/dist/nodes/three/light-nodes.js +3 -3
  619. package/dist/nodes/three/light-nodes.js.map +1 -1
  620. package/dist/nodes/three/mesh3d.js.map +1 -1
  621. package/dist/nodes/three/node3d.d.ts +48 -0
  622. package/dist/nodes/three/node3d.d.ts.map +1 -1
  623. package/dist/nodes/three/node3d.js +53 -3
  624. package/dist/nodes/three/node3d.js.map +1 -1
  625. package/dist/platform/audio-sink.d.ts +2 -2
  626. package/dist/platform/audio-sink.d.ts.map +1 -1
  627. package/dist/platform/audio-sink.js.map +1 -1
  628. package/dist/platform/exporter.d.ts +13 -8
  629. package/dist/platform/exporter.d.ts.map +1 -1
  630. package/dist/platform/exporter.js.map +1 -1
  631. package/dist/platform/index.d.ts +1 -1
  632. package/dist/platform/index.d.ts.map +1 -1
  633. package/dist/platform/index.js.map +1 -1
  634. package/dist/platform/stepped-clock.js.map +1 -1
  635. package/dist/platform/storage-adapter.d.ts +12 -6
  636. package/dist/platform/storage-adapter.d.ts.map +1 -1
  637. package/dist/platform/storage-adapter.js +4 -0
  638. package/dist/platform/storage-adapter.js.map +1 -1
  639. package/dist/platform/ticker.d.ts +6 -0
  640. package/dist/platform/ticker.d.ts.map +1 -1
  641. package/dist/platform/ticker.js +6 -0
  642. package/dist/platform/ticker.js.map +1 -1
  643. package/dist/project/config.js.map +1 -1
  644. package/dist/project/index.js.map +1 -1
  645. package/dist/project/tree.d.ts +3 -3
  646. package/dist/project/tree.d.ts.map +1 -1
  647. package/dist/project/tree.js.map +1 -1
  648. package/dist/props/host.js.map +1 -1
  649. package/dist/props/index.js.map +1 -1
  650. package/dist/props/observer.js.map +1 -1
  651. package/dist/props/slot.js.map +1 -1
  652. package/dist/renamed-scene-names.d.ts +17 -0
  653. package/dist/renamed-scene-names.d.ts.map +1 -0
  654. package/dist/renamed-scene-names.js +9 -0
  655. package/dist/renamed-scene-names.js.map +1 -0
  656. package/dist/render/canvas-render-context2d.d.ts +2 -2
  657. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  658. package/dist/render/canvas-render-context2d.js.map +1 -1
  659. package/dist/render/clip-contains.js.map +1 -1
  660. package/dist/render/clip.js.map +1 -1
  661. package/dist/render/descriptors/ellipse.js.map +1 -1
  662. package/dist/render/descriptors/latex.js.map +1 -1
  663. package/dist/render/descriptors/line.js.map +1 -1
  664. package/dist/render/descriptors/path-builder.js.map +1 -1
  665. package/dist/render/descriptors/path.js.map +1 -1
  666. package/dist/render/descriptors/polygon.js.map +1 -1
  667. package/dist/render/descriptors/polygram.js.map +1 -1
  668. package/dist/render/descriptors/rect.js.map +1 -1
  669. package/dist/render/descriptors/richtext.js.map +1 -1
  670. package/dist/render/descriptors/shape.d.ts +12 -0
  671. package/dist/render/descriptors/shape.d.ts.map +1 -1
  672. package/dist/render/descriptors/shape.js.map +1 -1
  673. package/dist/render/descriptors/text.d.ts +2 -2
  674. package/dist/render/descriptors/text.js +2 -2
  675. package/dist/render/descriptors/text.js.map +1 -1
  676. package/dist/render/descriptors/transform.d.ts +2 -2
  677. package/dist/render/descriptors/transform.d.ts.map +1 -1
  678. package/dist/render/descriptors/transform.js.map +1 -1
  679. package/dist/render/graphics2d.d.ts +3 -3
  680. package/dist/render/graphics2d.d.ts.map +1 -1
  681. package/dist/render/graphics2d.js +1 -1
  682. package/dist/render/graphics2d.js.map +1 -1
  683. package/dist/render/index.js.map +1 -1
  684. package/dist/render/measure-context.js.map +1 -1
  685. package/dist/render/null-render-context.js.map +1 -1
  686. package/dist/render/render-context2d.d.ts +2 -2
  687. package/dist/render/render-context2d.d.ts.map +1 -1
  688. package/dist/render/render-context2d.js.map +1 -1
  689. package/dist/render/surface.js.map +1 -1
  690. package/dist/render/text-defaults.js.map +1 -1
  691. package/dist/render/text-layout.js.map +1 -1
  692. package/dist/render3d/bounds3d.d.ts.map +1 -1
  693. package/dist/render3d/bounds3d.js +4 -2
  694. package/dist/render3d/bounds3d.js.map +1 -1
  695. package/dist/render3d/builders.js.map +1 -1
  696. package/dist/render3d/camera.d.ts +6 -0
  697. package/dist/render3d/camera.d.ts.map +1 -1
  698. package/dist/render3d/camera.js +5 -3
  699. package/dist/render3d/camera.js.map +1 -1
  700. package/dist/render3d/fill3d.d.ts +2 -9
  701. package/dist/render3d/fill3d.d.ts.map +1 -1
  702. package/dist/render3d/fill3d.js +2 -13
  703. package/dist/render3d/fill3d.js.map +1 -1
  704. package/dist/render3d/geometry.d.ts +8 -1
  705. package/dist/render3d/geometry.d.ts.map +1 -1
  706. package/dist/render3d/geometry.js.map +1 -1
  707. package/dist/render3d/graphics3d.d.ts +8 -4
  708. package/dist/render3d/graphics3d.d.ts.map +1 -1
  709. package/dist/render3d/graphics3d.js +18 -10
  710. package/dist/render3d/graphics3d.js.map +1 -1
  711. package/dist/render3d/index.d.ts +1 -1
  712. package/dist/render3d/index.js +1 -1
  713. package/dist/render3d/index.js.map +1 -1
  714. package/dist/render3d/inert.d.ts +14 -0
  715. package/dist/render3d/inert.d.ts.map +1 -0
  716. package/dist/render3d/inert.js +62 -0
  717. package/dist/render3d/inert.js.map +1 -0
  718. package/dist/render3d/light.js.map +1 -1
  719. package/dist/render3d/material.d.ts +10 -5
  720. package/dist/render3d/material.d.ts.map +1 -1
  721. package/dist/render3d/material.js.map +1 -1
  722. package/dist/render3d/matrix4.js.map +1 -1
  723. package/dist/render3d/render-context3d.js.map +1 -1
  724. package/dist/render3d/resources.js.map +1 -1
  725. package/dist/render3d/rounded-box.js.map +1 -1
  726. package/dist/render3d/scene-settings.d.ts +23 -4
  727. package/dist/render3d/scene-settings.d.ts.map +1 -1
  728. package/dist/render3d/scene-settings.js.map +1 -1
  729. package/dist/render3d/scene3d.d.ts +11 -0
  730. package/dist/render3d/scene3d.d.ts.map +1 -1
  731. package/dist/render3d/scene3d.js +39 -6
  732. package/dist/render3d/scene3d.js.map +1 -1
  733. package/dist/render3d/segments.js.map +1 -1
  734. package/dist/render3d/texture.d.ts +9 -0
  735. package/dist/render3d/texture.d.ts.map +1 -1
  736. package/dist/render3d/texture.js +13 -0
  737. package/dist/render3d/texture.js.map +1 -1
  738. package/dist/render3d/tracking.js.map +1 -1
  739. package/dist/render3d/transform.d.ts +1 -1
  740. package/dist/render3d/transform.js.map +1 -1
  741. package/dist/render3d/vector3.d.ts +18 -1
  742. package/dist/render3d/vector3.d.ts.map +1 -1
  743. package/dist/render3d/vector3.js +27 -0
  744. package/dist/render3d/vector3.js.map +1 -1
  745. package/dist/render3d/walk.d.ts +1 -1
  746. package/dist/render3d/walk.d.ts.map +1 -1
  747. package/dist/render3d/walk.js +5 -1
  748. package/dist/render3d/walk.js.map +1 -1
  749. package/dist/runtime/asset-refine.js.map +1 -1
  750. package/dist/runtime/asset-timeline.js.map +1 -1
  751. package/dist/runtime/asset-update.js.map +1 -1
  752. package/dist/runtime/audio-index.js.map +1 -1
  753. package/dist/runtime/builtin-context.js.map +1 -1
  754. package/dist/runtime/clip-instance.d.ts +9 -4
  755. package/dist/runtime/clip-instance.d.ts.map +1 -1
  756. package/dist/runtime/clip-instance.js +27 -9
  757. package/dist/runtime/clip-instance.js.map +1 -1
  758. package/dist/runtime/clip-store.d.ts +18 -0
  759. package/dist/runtime/clip-store.d.ts.map +1 -1
  760. package/dist/runtime/clip-store.js +97 -0
  761. package/dist/runtime/clip-store.js.map +1 -1
  762. package/dist/runtime/engine.d.ts +5 -0
  763. package/dist/runtime/engine.d.ts.map +1 -1
  764. package/dist/runtime/engine.js +2 -0
  765. package/dist/runtime/engine.js.map +1 -1
  766. package/dist/runtime/frame-time.d.ts +31 -0
  767. package/dist/runtime/frame-time.d.ts.map +1 -0
  768. package/dist/runtime/frame-time.js +29 -0
  769. package/dist/runtime/frame-time.js.map +1 -0
  770. package/dist/runtime/index.d.ts +1 -0
  771. package/dist/runtime/index.d.ts.map +1 -1
  772. package/dist/runtime/index.js +1 -0
  773. package/dist/runtime/index.js.map +1 -1
  774. package/dist/runtime/node-picking.d.ts +44 -3
  775. package/dist/runtime/node-picking.d.ts.map +1 -1
  776. package/dist/runtime/node-picking.js +124 -10
  777. package/dist/runtime/node-picking.js.map +1 -1
  778. package/dist/runtime/node-picking3d.d.ts +13 -5
  779. package/dist/runtime/node-picking3d.d.ts.map +1 -1
  780. package/dist/runtime/node-picking3d.js +10 -2
  781. package/dist/runtime/node-picking3d.js.map +1 -1
  782. package/dist/runtime/placement.d.ts.map +1 -1
  783. package/dist/runtime/placement.js +4 -5
  784. package/dist/runtime/placement.js.map +1 -1
  785. package/dist/runtime/playback-controller.d.ts +31 -2
  786. package/dist/runtime/playback-controller.d.ts.map +1 -1
  787. package/dist/runtime/playback-controller.js +63 -6
  788. package/dist/runtime/playback-controller.js.map +1 -1
  789. package/dist/runtime/playback.js.map +1 -1
  790. package/dist/runtime/precompisition.js.map +1 -1
  791. package/dist/runtime/project-assets.js.map +1 -1
  792. package/dist/runtime/session.d.ts +9 -7
  793. package/dist/runtime/session.d.ts.map +1 -1
  794. package/dist/runtime/session.js +12 -4
  795. package/dist/runtime/session.js.map +1 -1
  796. package/dist/runtime/settle.js.map +1 -1
  797. package/dist/runtime/state-evaluator.d.ts +1 -1
  798. package/dist/runtime/state-evaluator.d.ts.map +1 -1
  799. package/dist/runtime/state-evaluator.js +4 -3
  800. package/dist/runtime/state-evaluator.js.map +1 -1
  801. package/dist/runtime/text-geometry.d.ts.map +1 -1
  802. package/dist/runtime/text-geometry.js +7 -3
  803. package/dist/runtime/text-geometry.js.map +1 -1
  804. package/dist/sdk/index.d.ts +50 -25
  805. package/dist/sdk/index.d.ts.map +1 -1
  806. package/dist/sdk/index.js +52 -42
  807. package/dist/sdk/index.js.map +1 -1
  808. package/dist/tween/command-decorator.d.ts +2 -0
  809. package/dist/tween/command-decorator.d.ts.map +1 -1
  810. package/dist/tween/command-decorator.js.map +1 -1
  811. package/dist/tween/command.d.ts +12 -0
  812. package/dist/tween/command.d.ts.map +1 -1
  813. package/dist/tween/command.js +14 -0
  814. package/dist/tween/command.js.map +1 -1
  815. package/dist/tween/ease/constants.d.ts.map +1 -1
  816. package/dist/tween/ease/constants.js +8 -5
  817. package/dist/tween/ease/constants.js.map +1 -1
  818. package/dist/tween/ease/curve.d.ts.map +1 -1
  819. package/dist/tween/ease/curve.js +4 -3
  820. package/dist/tween/ease/curve.js.map +1 -1
  821. package/dist/tween/ease/describe.d.ts +15 -0
  822. package/dist/tween/ease/describe.d.ts.map +1 -0
  823. package/dist/tween/ease/describe.js +37 -0
  824. package/dist/tween/ease/describe.js.map +1 -0
  825. package/dist/tween/ease/type.js.map +1 -1
  826. package/dist/tween/index.js.map +1 -1
  827. package/dist/tween/inert.js.map +1 -1
  828. package/dist/tween/lerp.js.map +1 -1
  829. package/dist/tween/loop.js.map +1 -1
  830. package/dist/tween/prepare.d.ts +3 -3
  831. package/dist/tween/prepare.js +3 -3
  832. package/dist/tween/prepare.js.map +1 -1
  833. package/dist/tween/seekable.d.ts +1 -1
  834. package/dist/tween/seekable.js.map +1 -1
  835. package/dist/tween/stepper.js.map +1 -1
  836. package/dist/tween/to-command.js.map +1 -1
  837. package/dist/util/clamp.js.map +1 -1
  838. package/dist/util/context.js.map +1 -1
  839. package/dist/util/csv.js.map +1 -1
  840. package/dist/util/generateList.js.map +1 -1
  841. package/dist/util/index.js.map +1 -1
  842. package/dist/util/metrics.d.ts +1 -1
  843. package/dist/util/metrics.js +1 -1
  844. package/dist/util/metrics.js.map +1 -1
  845. package/dist/util/random.js.map +1 -1
  846. package/dist/util/reference.js.map +1 -1
  847. package/dist/util/scheduler.js.map +1 -1
  848. package/package.json +7 -1
  849. package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
  850. package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
  851. package/dist/attributes/shape/effects/implementations/displace.js +0 -30
  852. package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
  853. package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
  854. package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
  855. package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
  856. package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
  857. package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
  858. package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
  859. package/dist/attributes/shape/effects/implementations/texture.js +0 -25
  860. package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
  861. package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
  862. package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
  863. package/dist/attributes/shape/effects/implementations/trails.js +0 -22
  864. package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
  865. package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
  866. package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
  867. package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
  868. package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
  869. package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
  870. package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
  871. package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
  872. package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
  873. package/dist/nodes/geometry/dot-grid-node.js +0 -142
  874. package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
  875. package/dist/nodes/geometry/grid-lines.d.ts +0 -101
  876. package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
  877. package/dist/nodes/geometry/grid-lines.js +0 -128
  878. package/dist/nodes/geometry/grid-lines.js.map +0 -1
  879. package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
  880. package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
  881. package/dist/nodes/geometry/grid-pattern-node.js +0 -172
  882. package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
  883. package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
  884. package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
  885. package/dist/nodes/geometry/line-grid-node.js +0 -127
  886. package/dist/nodes/geometry/line-grid-node.js.map +0 -1
  887. package/dist/nodes/geometry/line-node.d.ts +0 -58
  888. package/dist/nodes/geometry/line-node.d.ts.map +0 -1
  889. package/dist/nodes/geometry/line-node.js +0 -123
  890. package/dist/nodes/geometry/line-node.js.map +0 -1
  891. package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
  892. package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
  893. package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
  894. package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
  895. package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
  896. package/dist/nodes/scene/canvas2d-node.js.map +0 -1
  897. package/dist/nodes/scene/provider-node.d.ts.map +0 -1
  898. package/dist/nodes/scene/provider-node.js.map +0 -1
  899. package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
  900. package/dist/nodes/scene/theme-provider-node.js.map +0 -1
  901. /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
  902. /package/dist/nodes/{scene → root}/provider-node.js +0 -0
  903. /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
  904. /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
@@ -1,18 +0,0 @@
1
- import{A as bc,E as kc,I as Mc,J as de,K as qe,P as Ac,T as Oc,a as m,b as mc,c as P,d as Vi,e as Ki,f as Hi,g as Y,l as kt,m as yc,n as ce,o as gc,p as xc,t as _c,u as jt,v as wc,w as Po,x as kn,y as vc,z as Sc}from"./chunk-KJXGRHOL.js";function Ec(e){return{topLeft:e,topRight:e,bottomLeft:e,bottomRight:e}}function Em(e,t){return{topLeft:e.top??t.topLeft,topRight:e.top??t.topRight,bottomLeft:e.bottom??t.bottomLeft,bottomRight:e.bottom??t.bottomRight}}function Cm(e,t){return{topLeft:e.left??t.topLeft,topRight:e.right??t.topRight,bottomLeft:e.left??t.bottomLeft,bottomRight:e.right??t.bottomRight}}function Mn(e,t,r,n){if(n(e))return Ec(e);let o=r??Ec(t),s=e;if("topLeft"in s||"topRight"in s||"bottomLeft"in s||"bottomRight"in s){let i=e;return{topLeft:i.topLeft??o.topLeft,topRight:i.topRight??o.topRight,bottomLeft:i.bottomLeft??o.bottomLeft,bottomRight:i.bottomRight??o.bottomRight}}return"top"in s||"bottom"in s?Em(e,o):"left"in s||"right"in s?Cm(e,o):{...o}}function An(e,t,r,n){return{topLeft:n(e.topLeft,t.topLeft,r),topRight:n(e.topRight,t.topRight,r),bottomLeft:n(e.bottomLeft,t.bottomLeft,r),bottomRight:n(e.bottomRight,t.bottomRight,r)}}function On(e,t=Object.is){return t(e.topLeft,e.topRight)&&t(e.topLeft,e.bottomLeft)&&t(e.topLeft,e.bottomRight)}var gr={resolve:(e,t)=>Mn(e,0,t,r=>typeof r=="number"),lerp:(e,t,r)=>An(e,t,r,m),isUniformInput:e=>typeof e=="number",isUniform:e=>On(e),isZero:e=>e.topLeft===0&&e.topRight===0&&e.bottomLeft===0&&e.bottomRight===0};var To={resolve:(e,t)=>Mn(e,"rounded",t,r=>r==="rounded"||r==="angled"),lerp:(e,t,r)=>An(e,t,r,(n,o)=>r<.5?n:o),isUniformInput:e=>e==="rounded"||e==="angled",isUniform:e=>On(e)},xr=(e,t,r)=>r<.5?e:t;function Lr(e){switch(e){case"x":return{x:1,y:0};case"y":return{x:0,y:1};case"both":return{x:1,y:1};default:return{x:e.x,y:e.y}}}function Ce(e,t){let r=Lr(e),n=Lr(t);return r.x===n.x&&r.y===n.y}function U(e){return Array.isArray(e)?e:Y(e)}function _t(e,t){if(e===t)return!0;let r=U(e),n=U(t);return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}var Cc=["mode","clip"];function T(e,t){let r={...e};if(!t)return r;for(let n of Cc){let o=t[n];o!==void 0&&(r[n]=o)}return r}function N(e,t){return e===void 0?{}:typeof e=="number"?{[t]:e}:e}function En(e){switch(e){case"behind":return-1;case"centered":return 0;case"ahead":return 1;default:return Math.max(-1,Math.min(1,e))}}var Pc={lerp:(e,t,r)=>({type:"motionBlur",length:m(e.length,t.length,r),alignment:m(En(e.alignment),En(t.alignment),r),samples:m(e.samples,t.samples,r),strength:m(e.strength,t.strength,r),axis:P(Lr(e.axis),Lr(t.axis),r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.length===t.length&&En(e.alignment)===En(t.alignment)&&e.samples===t.samples&&e.strength===t.strength&&Ce(e.axis,t.axis)&&e.mode===t.mode};function nt(e,t,r){return[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r,e[2]+(t[2]-e[2])*r,e[3]+(t[3]-e[3])*r]}var Ro={resolve:Tc,lerp:nt,hex(e){let[t,r,n,o]=Tc(e),s=Do(o);return`#${Do(t)}${Do(r)}${Do(n)}${s==="ff"?"":s}`}};function Tc(e){return Array.isArray(e)?e:Y(e)}function Do(e){return Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,"0")}var Dc={standard:" .:-=+*#%@",blocks:" \u2591\u2592\u2593\u2588",braille:" \u2804\u28C0\u28C4\u28E4\u28F6\u28F7\u28FF",binary:"01",hex:"0123456789ABCDEF"};function Pm(e){return Dc[e]??e}var Rc={lerp:(e,t,r)=>({type:"ascii",size:m(e.size,t.size,r),charset:r<.5?e.charset:t.charset,fontFamily:r<.5?e.fontFamily:t.fontFamily,ink:nt(U(e.ink),U(t.ink),r),background:nt(U(e.background),U(t.background),r),colored:r<.5?e.colored:t.colored,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.size===t.size&&e.charset===t.charset&&e.fontFamily===t.fontFamily&&_t(e.ink,t.ink)&&_t(e.background,t.background)&&e.colored===t.colored&&e.mode===t.mode,surface:"shader"};var Fo=new Set;function qr(e,t){let r=`${e}\0${t}`;Fo.has(r)||(Fo.size>512&&Fo.clear(),Fo.add(r),console.warn(`[SkSL] ${t}`))}function Tm(e,t){if(typeof t=="number")return Number.isFinite(t)?t:(qr("normalize",`uniform "${e}" is ${t}; ignoring it.`),null);if(!Array.isArray(t))return qr("normalize",`uniform "${e}" is not a number or number array; ignoring it.`),null;let r=t.flat(1/0),n=[];for(let o of r){if(typeof o!="number"||!Number.isFinite(o))return qr("normalize",`uniform "${e}" contains a non-finite entry; ignoring it.`),null;n.push(o)}return n}function Kt(e){if(!e)return{};let t=Array.isArray(e)?e.map(n=>[n.name,n.value]):Object.entries(e),r={};for(let[n,o]of t.sort(([s],[i])=>s<i?-1:s>i?1:0)){let s=Tm(n,o);s!==null&&(r[n]=s)}return r}function Ic(e,t,r){if(typeof e=="number"&&typeof t=="number")return m(e,t,r);if(Array.isArray(e)&&Array.isArray(t)){let n=Math.max(e.length,t.length);return Array.from({length:n},(o,s)=>m(e[s]??0,t[s]??0,r))}return r<.5?e:t}function zc(e,t){return typeof e=="number"&&typeof t=="number"?e===t:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((r,n)=>r===t[n]):!1}function Cn(e,t,r){let n={};for(let o of[...Object.keys(e),...Object.keys(t)].sort()){if(o in n)continue;let s=e[o],i=t[o];s===void 0?n[o]=i:i===void 0?n[o]=s:n[o]=Ic(s,i,r)}return n}function Pn(e,t){let r=Object.keys(e);return r.length!==Object.keys(t).length?!1:r.every(n=>{let o=t[n];return o!==void 0&&zc(e[n],o)})}function Dm(e){let t=[],r=e.getUniformCount();for(let n=0;n<r;n++){let o=e.getUniform(n);t.push({name:e.getUniformName(n),slot:o.slot,length:Math.max(1,o.columns*o.rows),isInteger:!!o.isInteger})}return t}function Rm(e,t,r,n,o){let s=new Float32Array(Math.max(0,t)),i=new Int32Array(s.buffer);for(let a of e){let l=a.name in r?r[a.name]:n[a.name];if(l===void 0){qr(o,`uniform "${a.name}" is declared but was not supplied; it will read as 0.`);continue}let c=typeof l=="number"?[l]:l;c.length!==a.length&&qr(o,`uniform "${a.name}" expects ${a.length} float(s) but got ${c.length}; the rest will read as 0.`);let d=Math.min(c.length,a.length);for(let u=0;u<d;u++){let f=a.slot+u;if(f<0||f>=s.length)break;a.isInteger?i[f]=Math.round(c[u]):s[f]=c[u]}}for(let a of Object.keys(r))e.some(l=>l.name===a)||qr(o,`uniform "${a}" was supplied but the shader declares no such uniform.`);return s}function Fm(e,t){let r=t.right-t.left,n=t.bottom-t.top;switch(e){case"centered":return[n,0,t.left+r/2,0,n,t.top+n/2,0,0,1];case"normalized":return[r,0,t.left,0,n,t.top,0,0,1];default:return[1,0,0,0,1,0,0,0,1]}}var Fc=/\buniform\s+(shader|colorFilter|blender)\s+([A-Za-z_]\w*)\s*;/g;function Im(e){let t=e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/[^\n]*/g," "),r=[];Fc.lastIndex=0;let n;for(;(n=Fc.exec(t))!==null;)r.push({kind:n[1],name:n[2]});return r}var Nc={lerp:(e,t,r)=>({type:"blur",radius:m(e.radius,t.radius,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.radius===t.radius&&e.mode===t.mode};var $c={lerp:(e,t,r)=>({type:"directionalBlur",radius:m(e.radius,t.radius,r),angle:m(e.angle,t.angle,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.radius===t.radius&&e.angle===t.angle&&e.mode===t.mode};var jc={lerp:(e,t,r)=>({type:"grayscale",amount:m(e.amount,t.amount,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&e.mode===t.mode};var Bc={lerp:(e,t,r)=>({type:"pixelate",blocks:P(e.blocks,t.blocks,r),sharpColors:r<.5?e.sharpColors:t.sharpColors,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.blocks.x===t.blocks.x&&e.blocks.y===t.blocks.y&&e.sharpColors===t.sharpColors&&e.mode===t.mode};var Lc={lerp:(e,t,r)=>({type:"bulge",strength:m(e.strength,t.strength,r),center:P(e.center,t.center,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.strength===t.strength&&e.center.x===t.center.x&&e.center.y===t.center.y&&e.mode===t.mode,surface:"shader"};var qc={lerp:(e,t,r)=>({type:"magnify",center:P(e.center,t.center,r),scale:m(e.scale,t.scale,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.center.x===t.center.x&&e.center.y===t.center.y&&e.scale===t.scale&&e.mode===t.mode,surface:"shader"};var Wc={lerp:(e,t,r)=>({type:"bloom",threshold:m(e.threshold,t.threshold,r),radius:m(e.radius,t.radius,r),intensity:m(e.intensity,t.intensity,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.threshold===t.threshold&&e.radius===t.radius&&e.intensity===t.intensity&&e.mode===t.mode};var Gc={lerp:(e,t,r)=>({type:"vintage",amount:m(e.amount,t.amount,r),warmth:m(e.warmth,t.warmth,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&e.warmth===t.warmth&&e.mode===t.mode};var Yc={lerp:(e,t,r)=>({type:"chromaticAberration",amount:m(e.amount,t.amount,r),angle:m(e.angle,t.angle,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&e.angle===t.angle&&e.mode===t.mode};var Vc={lerp:(e,t,r)=>({type:"invert",channel:r<.5?e.channel:t.channel,strength:m(e.strength,t.strength,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.channel===t.channel&&e.strength===t.strength&&e.mode===t.mode};var Kc={lerp:(e,t,r)=>({type:"scatter",strength:m(e.strength,t.strength,r),axis:r<.5?e.axis:t.axis,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.strength===t.strength&&Ce(e.axis,t.axis)&&e.mode===t.mode,surface:"shader"};var Hc={lerp:(e,t,r)=>({type:"posterize",levels:m(e.levels,t.levels,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.levels===t.levels&&e.mode===t.mode,surface:"shader"};var Uc={resolve:e=>{let t=e;if(!(e.type!=="shader"||t.shader!==void 0))return e;let{shader:n,...o}=t;return{...o,type:"shader",source:e.source??n??""}},lerp:(e,t,r)=>({type:"shader",source:e.source,...e.shaderId!==void 0?{shaderId:e.shaderId}:{},mode:e.mode,blendMode:e.blendMode,uniforms:Cn(Kt(e.uniforms),Kt(t.uniforms),r)}),equals:(e,t)=>e.source===t.source&&e.mode===t.mode&&e.blendMode===t.blendMode&&Pn(Kt(e.uniforms),Kt(t.uniforms)),surface:e=>e.mode==="backdrop"?"shader":"filter"};var Xc={lerp:(e,t,r)=>({type:"outline",width:m(e.width,t.width,r),color:nt(U(e.color),U(t.color),r),position:r<.5?e.position:t.position,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.width===t.width&&_t(e.color,t.color)&&e.position===t.position&&e.mode===t.mode,surface:"shader"};var Zc={lerp:(e,t,r)=>({type:"dropShadow",offsetX:m(e.offsetX,t.offsetX,r),offsetY:m(e.offsetY,t.offsetY,r),blur:m(e.blur,t.blur,r),spread:m(e.spread,t.spread,r),color:nt(U(e.color),U(t.color),r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.offsetX===t.offsetX&&e.offsetY===t.offsetY&&e.blur===t.blur&&e.spread===t.spread&&_t(e.color,t.color)&&e.mode===t.mode,surface:"shader"};var Jc={lerp:(e,t,r)=>({type:"vignette",amount:m(e.amount,t.amount,r),radius:m(e.radius,t.radius,r),softness:m(e.softness,t.softness,r),color:nt(U(e.color),U(t.color),r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&e.radius===t.radius&&e.softness===t.softness&&_t(e.color,t.color)&&e.mode===t.mode,surface:"shader"};var Qc={lerp:(e,t,r)=>({type:"grain",amount:m(e.amount,t.amount,r),size:m(e.size,t.size,r),seed:m(e.seed,t.seed,r),animated:r<.5?e.animated:t.animated,colored:r<.5?e.colored:t.colored,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&e.size===t.size&&e.seed===t.seed&&e.animated===t.animated&&e.colored===t.colored&&e.mode===t.mode,surface:"shader"};var td={lerp:(e,t,r)=>({type:"sharpen",amount:m(e.amount,t.amount,r),radius:m(e.radius,t.radius,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&e.radius===t.radius&&e.mode===t.mode,surface:"shader"};var ed={lerp:(e,t,r)=>({type:"edges",strength:m(e.strength,t.strength,r),kernel:r<.5?e.kernel:t.kernel,colored:r<.5?e.colored:t.colored,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.strength===t.strength&&e.kernel===t.kernel&&e.colored===t.colored&&e.mode===t.mode,surface:"shader"};var rd={lerp:(e,t,r)=>({type:"threshold",level:m(e.level,t.level,r),smoothness:m(e.smoothness,t.smoothness,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.level===t.level&&e.smoothness===t.smoothness&&e.mode===t.mode,surface:"shader"};var nd={lerp:(e,t,r)=>({type:"radialBlur",amount:m(e.amount,t.amount,r),style:r<.5?e.style:t.style,center:P(e.center,t.center,r),samples:r<.5?e.samples:t.samples,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&e.style===t.style&&e.center.x===t.center.x&&e.center.y===t.center.y&&e.samples===t.samples&&e.mode===t.mode,surface:"shader"};var od={lerp:(e,t,r)=>({type:"halftone",size:m(e.size,t.size,r),angle:m(e.angle,t.angle,r),shape:r<.5?e.shape:t.shape,separation:r<.5?e.separation:t.separation,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.size===t.size&&e.angle===t.angle&&e.shape===t.shape&&e.separation===t.separation&&e.mode===t.mode,surface:"shader"};var sd={lerp:(e,t,r)=>({type:"dither",levels:m(e.levels,t.levels,r),matrix:r<.5?e.matrix:t.matrix,scale:m(e.scale,t.scale,r),monochrome:r<.5?e.monochrome:t.monochrome,noise:r<.5?e.noise:t.noise,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.levels===t.levels&&e.matrix===t.matrix&&e.scale===t.scale&&e.monochrome===t.monochrome&&e.noise===t.noise&&e.mode===t.mode,surface:"shader"};var id={lerp:(e,t,r)=>({type:"duotone",amount:m(e.amount,t.amount,r),shadows:nt(U(e.shadows),U(t.shadows),r),highlights:nt(U(e.highlights),U(t.highlights),r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&_t(e.shadows,t.shadows)&&_t(e.highlights,t.highlights)&&e.mode===t.mode};var ad={lerp:(e,t,r)=>({type:"curves",channel:r<.5?e.channel:t.channel,points:e.points.map(([n,o],s)=>{let[i,a]=t.points[s]??[n,o];return[m(n,i,r),m(o,a,r)]}),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.channel===t.channel&&e.mode===t.mode&&e.points.length===t.points.length&&e.points.every(([r,n],o)=>r===t.points[o]?.[0]&&n===t.points[o]?.[1]),surface:"shader"};var ld={lerp:(e,t,r)=>({type:"colorAdjustment",brightness:m(e.brightness??0,t.brightness??0,r),contrast:m(e.contrast??1,t.contrast??1,r),saturation:m(e.saturation??1,t.saturation??1,r),hue:m(e.hue??0,t.hue??0,r),vibrance:m(e.vibrance??0,t.vibrance??0,r),shadows:m(e.shadows??0,t.shadows??0,r),highlights:m(e.highlights??0,t.highlights??0,r),temperature:m(e.temperature??0,t.temperature??0,r),tint:m(e.tint??0,t.tint??0,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.brightness===t.brightness&&e.contrast===t.contrast&&e.saturation===t.saturation&&e.hue===t.hue&&e.vibrance===t.vibrance&&e.shadows===t.shadows&&e.highlights===t.highlights&&e.temperature===t.temperature&&e.tint===t.tint&&e.mode===t.mode};var Ui=(e,t)=>e.x===t.x&&e.y===t.y,cd={lerp:(e,t,r)=>({type:"rgbShift",red:P(e.red,t.red,r),green:P(e.green,t.green,r),blue:P(e.blue,t.blue,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>Ui(e.red,t.red)&&Ui(e.green,t.green)&&Ui(e.blue,t.blue)&&e.mode===t.mode,surface:"shader"};var dd={lerp:(e,t,r)=>({type:"scanlines",spacing:m(e.spacing,t.spacing,r),thickness:m(e.thickness,t.thickness,r),darkness:m(e.darkness,t.darkness,r),offset:m(e.offset,t.offset,r),angle:m(e.angle,t.angle,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.spacing===t.spacing&&e.thickness===t.thickness&&e.darkness===t.darkness&&e.offset===t.offset&&e.angle===t.angle&&e.mode===t.mode,surface:"shader"};var ud={lerp:(e,t,r)=>({type:"blockDisplace",amount:m(e.amount,t.amount,r),size:m(e.size,t.size,r),density:m(e.density,t.density,r),seed:m(e.seed,t.seed,r),axis:r<.5?e.axis:t.axis,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amount===t.amount&&e.size===t.size&&e.density===t.density&&e.seed===t.seed&&Ce(e.axis,t.axis)&&e.mode===t.mode,surface:"shader"};var fd={lerp:(e,t,r)=>({type:"bitCrush",bits:m(e.bits,t.bits,r),palette:r<.5?e.palette:t.palette,amount:m(e.amount,t.amount,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.bits===t.bits&&e.palette===t.palette&&e.amount===t.amount&&e.mode===t.mode,surface:"shader"};var pd={lerp:(e,t,r)=>({type:"streak",intensity:m(e.intensity,t.intensity,r),threshold:m(e.threshold,t.threshold,r),length:m(e.length,t.length,r),angle:m(e.angle,t.angle,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.intensity===t.intensity&&e.threshold===t.threshold&&e.length===t.length&&e.angle===t.angle&&e.mode===t.mode};function zm(e,t,r){return e.colors.length!==t.colors.length?r<.5?e:t:{colors:e.colors.map((n,o)=>nt(U(n),U(t.colors[o]),r)),stops:e.stops.map((n,o)=>m(n,t.stops[o]??n,r))}}function Nm(e,t){return e.colors.length!==t.colors.length||e.stops.length!==t.stops.length?!1:e.colors.every((r,n)=>_t(r,t.colors[n]))&&e.stops.every((r,n)=>r===t.stops[n])}var hd={lerp:(e,t,r)=>({type:"glow",threshold:m(e.threshold,t.threshold,r),radius:m(e.radius,t.radius,r),spread:m(e.spread,t.spread,r),intensity:m(e.intensity,t.intensity,r),cycles:m(e.cycles,t.cycles,r),phase:m(e.phase,t.phase,r),color:nt(U(e.color),U(t.color),r),...zm(e,t,r),channel:r<.5?e.channel:t.channel,axis:r<.5?e.axis:t.axis,original:r<.5?e.original:t.original,blend:r<.5?e.blend:t.blend,tint:r<.5?e.tint:t.tint,loopStyle:r<.5?e.loopStyle:t.loopStyle,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.channel===t.channel&&e.threshold===t.threshold&&e.radius===t.radius&&e.spread===t.spread&&e.intensity===t.intensity&&Ce(e.axis,t.axis)&&e.original===t.original&&e.blend===t.blend&&e.tint===t.tint&&_t(e.color,t.color)&&Nm(e,t)&&e.loopStyle===t.loopStyle&&e.cycles===t.cycles&&e.phase===t.phase&&e.mode===t.mode,surface:"shader"};var md={lerp:(e,t,r)=>({type:"godRays",intensity:m(e.intensity,t.intensity,r),threshold:m(e.threshold,t.threshold,r),length:m(e.length,t.length,r),center:P(e.center,t.center,r),decay:m(e.decay,t.decay,r),samples:r<.5?e.samples:t.samples,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.intensity===t.intensity&&e.threshold===t.threshold&&e.length===t.length&&e.center.x===t.center.x&&e.center.y===t.center.y&&e.decay===t.decay&&e.samples===t.samples&&e.mode===t.mode,surface:"shader"};var yd={lerp:(e,t,r)=>({type:"oilPaint",radius:m(e.radius,t.radius,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.radius===t.radius&&e.mode===t.mode,surface:"shader"};var gd={lerp:(e,t,r)=>({type:"texture",src:r<.5?e.src:t.src,blend:r<.5?e.blend:t.blend,amount:m(e.amount,t.amount,r),scale:m(e.scale,t.scale,r),angle:m(e.angle,t.angle,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.src===t.src&&e.amount===t.amount&&e.blend===t.blend&&e.scale===t.scale&&e.angle===t.angle&&e.mode===t.mode,surface:"shader",declare:(e,t)=>t.image(e.src)};var xd={lerp:(e,t,r)=>({type:"displace",src:r<.5?e.src:t.src,channel:r<.5?e.channel:t.channel,amount:P(e.amount,t.amount,r),midpoint:m(e.midpoint,t.midpoint,r),scale:m(e.scale,t.scale,r),angle:m(e.angle,t.angle,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.src===t.src&&e.amount.x===t.amount.x&&e.amount.y===t.amount.y&&e.channel===t.channel&&e.midpoint===t.midpoint&&e.scale===t.scale&&e.angle===t.angle&&e.mode===t.mode,surface:"shader",declare:(e,t)=>t.image(e.src)};var _d={lerp:(e,t,r)=>({type:"wave",amplitude:P(e.amplitude,t.amplitude,r),wavelength:m(e.wavelength,t.wavelength,r),phase:m(e.phase,t.phase,r),shape:r<.5?e.shape:t.shape,angle:m(e.angle,t.angle,r),center:P(e.center,t.center,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.amplitude.x===t.amplitude.x&&e.amplitude.y===t.amplitude.y&&e.wavelength===t.wavelength&&e.phase===t.phase&&e.shape===t.shape&&e.angle===t.angle&&e.center.x===t.center.x&&e.center.y===t.center.y&&e.mode===t.mode,surface:"shader"};var wd={lerp:(e,t,r)=>({type:"twirl",angle:m(e.angle,t.angle,r),radius:m(e.radius,t.radius,r),center:P(e.center,t.center,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.angle===t.angle&&e.radius===t.radius&&e.center.x===t.center.x&&e.center.y===t.center.y&&e.mode===t.mode,surface:"shader"};var vd={lerp:(e,t,r)=>({type:"progressiveBlur",radius:m(e.radius,t.radius,r),startRadius:m(e.startRadius,t.startRadius,r),shape:r<.5?e.shape:t.shape,start:m(e.start,t.start,r),end:m(e.end,t.end,r),angle:m(e.angle,t.angle,r),center:P(e.center,t.center,r),samples:r<.5?e.samples:t.samples,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.radius===t.radius&&e.startRadius===t.startRadius&&e.shape===t.shape&&e.start===t.start&&e.end===t.end&&e.angle===t.angle&&e.center.x===t.center.x&&e.center.y===t.center.y&&e.samples===t.samples&&e.mode===t.mode,surface:"shader"};var Sd={lerp:(e,t,r)=>({type:"kaleidoscope",segments:r<.5?e.segments:t.segments,angle:m(e.angle,t.angle,r),center:P(e.center,t.center,r),offset:m(e.offset,t.offset,r),amount:m(e.amount,t.amount,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.segments===t.segments&&e.angle===t.angle&&e.center.x===t.center.x&&e.center.y===t.center.y&&e.offset===t.offset&&e.amount===t.amount&&e.mode===t.mode,surface:"shader"};var bd={lerp:(e,t,r)=>({type:"trails",echoes:Math.round(m(e.echoes,t.echoes,r)),delay:m(e.delay,t.delay,r),decay:m(e.decay,t.decay,r),blend:r<.5?e.blend:t.blend,mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.echoes===t.echoes&&e.delay===t.delay&&e.decay===t.decay&&e.blend===t.blend&&e.mode===t.mode,surface:"shader"};var kd={lerp:(e,t,r)=>({type:"glass",lightAngle:m(e.lightAngle,t.lightAngle,r),lightIntensity:m(e.lightIntensity,t.lightIntensity,r),refraction:m(e.refraction,t.refraction,r),depth:m(e.depth,t.depth,r),dispersion:m(e.dispersion,t.dispersion,r),frost:m(e.frost,t.frost,r),splay:m(e.splay,t.splay,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.lightAngle===t.lightAngle&&e.lightIntensity===t.lightIntensity&&e.refraction===t.refraction&&e.depth===t.depth&&e.dispersion===t.dispersion&&e.frost===t.frost&&e.splay===t.splay&&e.mode===t.mode,surface:"shader"};var Md={lerp:(e,t,r)=>({type:"lut",table:r<.5?e.table:t.table,size:r<.5?e.size:t.size,amount:m(e.amount,t.amount,r),mode:r<.5?e.mode:t.mode}),equals:(e,t)=>e.table===t.table&&e.size===t.size&&e.amount===t.amount&&e.mode===t.mode,surface:"shader"};var Ad=new Map([["blur",Nc],["directionalBlur",$c],["grayscale",jc],["pixelate",Bc],["bulge",Lc],["magnify",qc],["bloom",Wc],["vintage",Gc],["chromaticAberration",Yc],["invert",Vc],["scatter",Kc],["posterize",Hc],["motionBlur",Pc],["shader",Uc],["outline",Xc],["dropShadow",Zc],["vignette",Jc],["grain",Qc],["sharpen",td],["edges",ed],["threshold",rd],["radialBlur",nd],["halftone",od],["dither",sd],["duotone",id],["curves",ad],["colorAdjustment",ld],["rgbShift",cd],["scanlines",dd],["blockDisplace",ud],["bitCrush",fd],["ascii",Rc],["streak",pd],["glow",hd],["godRays",md],["oilPaint",yd],["texture",gd],["displace",xd],["wave",_d],["twirl",wd],["progressiveBlur",vd],["kaleidoscope",Sd],["trails",bd],["glass",kd],["lut",Md]]),$m=new Map([["sksl","shader"]]);function Tn(e){let t=Ad.get(e);if(t)return t;let r=$m.get(e);return r?Ad.get(r):void 0}function Io(e){let t=Tn(e.type);return t?.resolve?t.resolve(e):e}function Od(e){return Tn(e)!==void 0}function Dn(e){let t=Tn(e.type)?.surface;return t===void 0?"filter":typeof t=="function"?t(e):t}function zo(e,t){Tn(e.type)?.declare?.(e,t)}function Rn(e,t,r){if(e.type!==t.type)return r<.5?e:t;let n=Tn(e.type);return n?n.lerp(e,t,r):r<.5?e:t}var jm=["x","y","z","w"],Bm=["r","g","b","a"];function jo(e,t){let r={...e.uniforms??{}};for(let[n,o]of Object.entries(e.properties)){let s=t&&n in t?t[n]:o.default,i=Lm(o,s,n,e.name);if(i)for(let[a,l]of Object.entries(o.inputs)){let c=i[a];if(c===void 0){$o(`shader "${e.name}" property "${n}" has no "${a}" to write to "${l}".`);continue}r[l]=c}}if(t)for(let n of Object.keys(t))n in e.properties||$o(`shader "${e.name}" has no property "${n}"; the override is ignored.`);return r}function Lm(e,t,r,n){let o=qm(e,t,r,n);if(o===void 0)return;let s=Object.keys(e.inputs);if(s.length===1&&s[0]==="value")return{value:o};let i=typeof o=="number"?[o]:o,a={value:o};for(let[l,c]of jm.entries())i[l]!==void 0&&(a[c]=i[l]);for(let[l,c]of Bm.entries())i[l]!==void 0&&(a[c]=i[l]);return a}function qm(e,t,r,n){switch(e.kind){case"number":case"slider":case"angle":case"hue":return Wm(t,r,n);case"boolean":return t?1:0;case"color":return Gm(t,r,n);case"vector":case"point":return Ed(t,r,n);default:return typeof t=="number"||Array.isArray(t)?t:void 0}}function Wm(e,t,r){if(typeof e=="number"&&Number.isFinite(e))return e;$o(`shader "${r}" property "${t}" expects a number, got ${JSON.stringify(e)}.`)}function Gm(e,t,r){if(typeof e=="string"){let[n,o,s,i]=Y(e);return[n,o,s,i]}return Ed(e,t,r)}function Ed(e,t,r){if(Array.isArray(e)&&e.every(n=>typeof n=="number"&&Number.isFinite(n)))return e;if(typeof e=="object"&&e!==null){let n=e;if(typeof n.x=="number"&&typeof n.y=="number")return[n.x,n.y]}$o(`shader "${r}" property "${t}" expects numbers, got ${JSON.stringify(e)}.`)}var No=new Set;function $o(e){No.has(e)||(No.size>256&&No.clear(),No.add(e),console.warn(`[shader] ${e}`))}var We={x:.5,y:.5},Ym=["white","#ffa640"],Vm=[0,1],Km={x:0,y:0},Hm=e=>typeof e=="number"?{x:e,y:e}:e,Um=e=>typeof e=="number"?{x:e,y:e}:e,Xm=e=>typeof e=="number"?{x:0,y:e}:e,F=class e{list;constructor(t=[]){this.list=t}append(t){return new e([...this.list,t])}blur(t){let r=N(t,"radius");return this.append(T({type:"blur",radius:r.radius??0},r))}directionalBlur(t){let r=N(t,"radius");return this.append(T({type:"directionalBlur",radius:r.radius??0,angle:r.angle??0},r))}pixelate(t){let r=N(t,"blocks");return this.append(T({type:"pixelate",blocks:Hm(r.blocks??1),sharpColors:r.sharpColors??!0},r))}grayscale(t){let r=N(t,"amount");return this.append(T({type:"grayscale",amount:r.amount??0},r))}bulge(t){let r=N(t,"strength");return this.append(T({type:"bulge",strength:r.strength??0,center:r.center??We},r))}magnify(t){let r=N(t,"scale");return this.append(T({type:"magnify",scale:r.scale??2,center:r.center??We},{mode:r.mode??"backdrop"}))}bloom(t){let r=N(t,"intensity");return this.append(T({type:"bloom",threshold:r.threshold??.7,radius:r.radius??12,intensity:r.intensity??1},r))}vintage(t){let r=N(t,"amount");return this.append(T({type:"vintage",amount:r.amount??1,warmth:r.warmth??.2},r))}chromaticAberration(t){let r=N(t,"amount");return this.append(T({type:"chromaticAberration",amount:r.amount??4,angle:r.angle??0},r))}invert(t){let r=N(t,"strength");return this.append(T({type:"invert",channel:r.channel??"rgba",strength:r.strength??1},r))}scatter(t){let r=N(t,"strength");return this.append(T({type:"scatter",strength:r.strength??10,axis:r.axis??"both"},r))}posterize(t){let r=N(t,"levels");return this.append(T({type:"posterize",levels:r.levels??4},r))}motionBlur(t){let r=N(t,"length");return this.append(T({type:"motionBlur",length:r.length??50,alignment:r.alignment??"centered",samples:r.samples??16,strength:r.strength??1,axis:r.axis??"both"},r))}outline(t){let r=N(t,"width");return this.append(T({type:"outline",width:r.width??4,color:r.color??"black",position:r.position??"outside"},r))}dropShadow(t){let r=N(t,"blur");return this.append(T({type:"dropShadow",offsetX:r.offsetX??0,offsetY:r.offsetY??-8,blur:r.blur??16,spread:r.spread??0,color:r.color??"black"},r))}vignette(t){let r=N(t,"amount");return this.append(T({type:"vignette",amount:r.amount??.5,radius:r.radius??.75,softness:r.softness??.5,color:r.color??"black"},r))}lut(t){return this.append(T({type:"lut",table:t.table,size:t.size,amount:t.amount??1},t))}grain(t){let r=N(t,"amount");return this.append(T({type:"grain",amount:r.amount??.25,size:r.size??1,seed:r.seed??0,animated:r.animated??!1,colored:r.colored??!1},r))}sharpen(t){let r=N(t,"amount");return this.append(T({type:"sharpen",amount:r.amount??1,radius:r.radius??1},r))}edges(t){let r=N(t,"strength");return this.append(T({type:"edges",strength:r.strength??1,kernel:r.kernel??"sobel",colored:r.colored??!1},r))}threshold(t){let r=N(t,"level");return this.append(T({type:"threshold",level:r.level??.5,smoothness:r.smoothness??.05},r))}radialBlur(t){let r=N(t,"amount");return this.append(T({type:"radialBlur",amount:r.amount??.5,style:r.style??"zoom",center:r.center??We,samples:r.samples??16},r))}halftone(t){let r=N(t,"size");return this.append(T({type:"halftone",size:r.size??8,angle:r.angle??45,shape:r.shape??"dot",separation:r.separation??"mono"},r))}dither(t){let r=N(t,"levels");return this.append(T({type:"dither",levels:r.levels??2,matrix:r.matrix??4,scale:r.scale??1,monochrome:r.monochrome??!1,noise:r.noise??"bayer"},r))}duotone(t){let r=N(t,"amount");return this.append(T({type:"duotone",amount:r.amount??1,shadows:r.shadows??"black",highlights:r.highlights??"white"},r))}curves(t){return this.append(T({type:"curves",points:t.points,channel:t.channel??"rgb"},t))}colorAdjustment(t){let{mode:r,...n}=t;return this.append(T({type:"colorAdjustment",...n},{mode:r}))}rgbShift(t){let r=N(t,"amount"),n=r.amount??4;return this.append(T({type:"rgbShift",red:r.red??{x:n,y:0},green:r.green??Km,blue:r.blue??{x:-n,y:0}},r))}scanlines(t){let r=N(t,"darkness");return this.append(T({type:"scanlines",spacing:r.spacing??4,thickness:r.thickness??.5,darkness:r.darkness??.5,offset:r.offset??0,angle:r.angle??0},r))}blockDisplace(t){let r=N(t,"amount");return this.append(T({type:"blockDisplace",amount:r.amount??20,size:r.size??16,density:r.density??.3,seed:r.seed??0,axis:r.axis??"x"},r))}bitCrush(t){let r=N(t,"bits");return this.append(T({type:"bitCrush",bits:r.bits??3,palette:r.palette??"none",amount:r.amount??1},r))}ascii(t){let r=N(t,"size");return this.append(T({type:"ascii",size:r.size??12,charset:r.charset??"standard",fontFamily:r.fontFamily??"monospace",ink:r.ink??"white",background:r.background??"black",colored:r.colored??!1},r))}texture(t){return this.append(T({type:"texture",src:t.src,amount:t.amount??1,blend:t.blend??"multiply",scale:t.scale??1,angle:t.angle??0},t))}oilPaint(t){let r=N(t,"radius");return this.append(T({type:"oilPaint",radius:r.radius??3},r))}streak(t){let r=N(t,"intensity");return this.append(T({type:"streak",intensity:r.intensity??1,threshold:r.threshold??.7,length:r.length??120,angle:r.angle??0},r))}glow(t){let r=N(t,"intensity");return this.append(T({type:"glow",channel:r.channel??"luminance",threshold:r.threshold??.5,radius:r.radius??25,spread:r.spread??0,intensity:r.intensity??1,axis:r.axis??"both",original:r.original??"behind",blend:r.blend??"screen",tint:r.tint??"none",color:r.color??"white",colors:r.colors??[...Ym],stops:r.stops??[...Vm],loopStyle:r.loopStyle??"mirror",cycles:r.cycles??1,phase:r.phase??0},r))}godRays(t){let r=N(t,"intensity");return this.append(T({type:"godRays",intensity:r.intensity??1,threshold:r.threshold??.6,length:r.length??.6,center:r.center??We,decay:r.decay??.96,samples:r.samples??32},r))}shader(t){let r=typeof t.source=="string"?void 0:t.source;if(r&&r.scope!=="effect")throw new Error(`Effects.shader was given a "${r.scope}" shader ("${r.name}"). A fill shader has no backdrop to sample and is bound to a shape's box; use Fills.shader.`);let n=t.mode??(r?.backdrop?"backdrop":"foreground"),o=r?r.source:t.source,s=r?{...jo(r,t.values),...Kt(t.uniforms??{})}:t.uniforms??{},i={type:"shader",source:o,uniforms:s,...r?.id!==void 0?{shaderId:r.id}:{}},a=n==="foreground"?{...i,blendMode:t.blendMode??"screen"}:i;return this.append(T(a,{mode:n}))}sksl(t){let{shader:r,...n}=t;return this.shader({...n,source:r})}displace(t){let r=t;return this.append(T({type:"displace",src:r.src,amount:Um(r.amount??20),channel:r.channel??"rg",midpoint:r.midpoint??.5,scale:r.scale??1,angle:r.angle??0},r))}wave(t){let r=N(t,"amplitude");return this.append(T({type:"wave",amplitude:Xm(r.amplitude??20),wavelength:r.wavelength??120,phase:r.phase??0,shape:r.shape??"linear",angle:r.angle??0,center:r.center??We},r))}twirl(t){let r=N(t,"angle");return this.append(T({type:"twirl",angle:r.angle??180,radius:r.radius??1,center:r.center??We},r))}progressiveBlur(t){let r=N(t,"radius");return this.append(T({type:"progressiveBlur",radius:r.radius??24,startRadius:r.startRadius??0,shape:r.shape??"linear",start:r.start??0,end:r.end??1,angle:r.angle??90,center:r.center??We,samples:r.samples??20},r))}kaleidoscope(t){let r=N(t,"segments");return this.append(T({type:"kaleidoscope",segments:Math.round(r.segments??6),angle:r.angle??0,center:r.center??We,offset:r.offset??0,amount:r.amount??1},r))}trails(t){let r=N(t,"echoes");return this.append(T({type:"trails",echoes:Math.round(r.echoes??6),delay:r.delay??1/24,decay:r.decay??.72,blend:r.blend??"screen"},r))}glass(t){let r=N(t,"refraction");return this.append(T({type:"glass",lightAngle:r.lightAngle??0,lightIntensity:r.lightIntensity??100,refraction:r.refraction??100,depth:r.depth??100,dispersion:r.dispersion??100,frost:r.frost??100,splay:r.splay??100},{mode:r.mode??"backdrop"}))}*[Symbol.iterator](){yield*this.list}toJSON(){return this.list}},Zm=new F;function Xi(e){if(e===void 0)return[];if(e instanceof F)return Cd(e.list);if(Array.isArray(e)){let t=[];for(let r of e)r instanceof F?t.push(...Cd(r.list)):Array.isArray(r)?t.push(...Xi(r)):t.push(Io(r));return t}return[Io(e)]}function Cd(e){let t;for(let r=0;r<e.length;r++){let n=Io(e[r]);!t&&n!==e[r]&&(t=e.slice(0,r)),t?.push(n)}return t??e}var Wr={resolve:e=>Xi(e),lerp:(e,t,r)=>{if(e===t)return e;let n=Math.max(e.length,t.length),o=[];for(let s=0;s<n;s++){let i=e[s],a=t[s];i&&a?o.push(Rn(i,a,r)):i?o.push(i):a&&o.push(a)}return o}};var Pd=e=>e.mode==="backdrop",Td=[],Zi=e=>e.length===0?Td:e.filter(Pd);function Ji(e){return e.length===0?Td:e.filter(t=>t.mode!=="backdrop"&&Dn(t)==="shader")}var Qi=["multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","normal"],Jm=[...Qi,"pass-through"],Qm=Object.fromEntries(Qi.map((e,t)=>[e,t]));function ty(e){return Qm[e]}function Bt(e,t={}){let r={...e};return t.opacity!==void 0&&(r.opacity=t.opacity),t.blend!==void 0&&(r.blend=t.blend),t.space!==void 0&&(r.space=t.space),r}var Gr=class e{list;constructor(t=[]){this.list=t}color(t,r){return new e([...this.list,Bt({type:"solid",color:t},r)])}image(t,r){let{fit:n,crop:o,zoom:s,anchor:i,matrix:a,preset:l,filters:c,...d}=r??{};return new e([...this.list,Bt({type:"image",src:t,fit:n,crop:o,zoom:s,anchor:i,matrix:a,preset:l,filters:c},d)])}video(t,r){let{fit:n,crop:o,zoom:s,anchor:i,matrix:a,preset:l,filters:c,timestamp:d,playing:u,trimStart:f,trimEnd:h,playStart:y,speed:w,loop:g,duration:x,..._}=r??{};return new e([...this.list,Bt({type:"video",src:t,fit:n,crop:o,zoom:s,anchor:i,matrix:a,preset:l,filters:c,timestamp:d,playing:u??!0,trimStart:f,trimEnd:h,playStart:y,speed:w,loop:g,duration:x},_)])}linearGradient(t,r){let{stops:n,start:o,end:s,...i}=r??{};return new e([...this.list,Bt({type:"linear-gradient",colors:t,stops:n,start:o,end:s},i)])}radialGradient(t,r){let{stops:n,center:o,radius:s,...i}=r??{};return new e([...this.list,Bt({type:"radial-gradient",colors:t,stops:n,center:o,radius:s},i)])}conicGradient(t,r){let{stops:n,center:o,startAngle:s,...i}=r??{};return new e([...this.list,Bt({type:"conic-gradient",colors:t,stops:n,center:o,startAngle:s},i)])}noise(t){let{size:r,density:n,color:o,seed:s,...i}=t??{};return new e([...this.list,Bt({type:"noise",size:r,density:n,color:o,seed:s},i)])}fractalNoise(t){let{basis:r,octaves:n,frequency:o,lacunarity:s,gain:i,seed:a,offset:l,angle:c,colors:d,stops:u,contrast:f,...h}=t??{};return new e([...this.list,Bt({type:"fractalNoise",basis:r,octaves:n,frequency:o,lacunarity:s,gain:i,seed:a,offset:l,angle:c,colors:d,stops:u,contrast:f},h)])}shader(t,r){let n=typeof t=="string"?void 0:t;if(n&&n.scope!=="fill")throw new Error(`Fills.shader was given a "${n.scope}" shader ("${n.name}"). An effect shader samples a backdrop a fill does not have; use Effects.shader.`);let{uniforms:o,coords:s,textures:i,values:a,...l}=r??{},c=n?{...jo(n,a),...Kt(o??{})}:o;return new e([...this.list,Bt({type:"shader",source:typeof t=="string"?t:t.source,uniforms:c,coords:s??n?.coords,textures:i,...n?.id!==void 0?{shaderId:n.id}:{}},l)])}stripe(t){let{gap:r,strokeWidth:n,angle:o,color:s,...i}=t??{};return new e([...this.list,Bt({type:"stripe",gap:r,strokeWidth:n,angle:o,color:s},i)])}dotGrid(t){let{radius:r,spacing:n,offset:o,color:s,...i}=t??{};return new e([...this.list,Bt({type:"dotGrid",radius:r,spacing:n,offset:o,color:s},i)])}grid(t){let{divisions:r,subdivisions:n,offset:o,strokeWidth:s,subdivisionWidth:i,color:a,...l}=t??{};return new e([...this.list,Bt({type:"grid",divisions:r,subdivisions:n,offset:o,strokeWidth:s,subdivisionWidth:i,color:a},l)])}canvas3D(t,r){let{maxPixelRatio:n,antialias:o,...s}=r??{};return new e([...this.list,Bt({type:"canvas3D",scene:t,maxPixelRatio:n,antialias:o},s)])}*[Symbol.iterator](){yield*this.list}toJSON(){return this.list}},ta=new Gr;function Yr(e){if(e==null)return[];if(e instanceof Gr)return e.list;if(Array.isArray(e)){let t=[];for(let r of e)r instanceof Gr?t.push(...r.list):Array.isArray(r)?t.push(...Yr(r)):t.push(r);return t}return[e]}var ey=4,ry=1,ny=1,Dd=.5,Rd={resolve:e=>{let t=e.color??[0,0,0,1],r=e.strokeWidth??ny;return{type:"grid",divisions:e.divisions??ey,subdivisions:e.subdivisions??ry,offset:e.offset??{x:0,y:0},strokeWidth:r,subdivisionWidth:e.subdivisionWidth??r*Dd,color:Array.isArray(t)?t:Y(t),opacity:e.opacity,blend:e.blend}},lerp:(e,t,r)=>({divisions:m(e.divisions,t.divisions,r),subdivisions:m(e.subdivisions,t.subdivisions,r),offset:{x:m(e.offset.x,t.offset.x,r),y:m(e.offset.y,t.offset.y,r)},strokeWidth:m(e.strokeWidth,t.strokeWidth,r),subdivisionWidth:m(e.subdivisionWidth,t.subdivisionWidth,r),color:[m(e.color[0],t.color[0],r),m(e.color[1],t.color[1],r),m(e.color[2],t.color[2],r),m(e.color[3],t.color[3],r)],opacity:m(e.opacity??1,t.opacity??1,r)}),equals:(e,t)=>e.divisions===t.divisions&&e.subdivisions===t.subdivisions&&e.offset.x===t.offset.x&&e.offset.y===t.offset.y&&e.strokeWidth===t.strokeWidth&&e.subdivisionWidth===t.subdivisionWidth&&e.color[0]===t.color[0]&&e.color[1]===t.color[1]&&e.color[2]===t.color[2]&&e.color[3]===t.color[3]};var Fd={lerp:(e,t,r)=>({type:"exposure",amount:m(e.amount,t.amount,r)}),equals:(e,t)=>e.amount===t.amount};var Id={lerp:(e,t,r)=>({type:"blur",radius:m(e.radius,t.radius,r)}),equals:(e,t)=>e.radius===t.radius};var zd={lerp:(e,t,r)=>({type:"grayscale",amount:m(e.amount,t.amount,r)}),equals:(e,t)=>e.amount===t.amount};var Nd={lerp:(e,t,r)=>({type:"alpha",amount:m(e.amount,t.amount,r)}),equals:(e,t)=>e.amount===t.amount};var $d={lerp:(e,t,r)=>({type:"colorMatrix",matrix:e.matrix.map((n,o)=>m(n,t.matrix[o]??n,r))}),equals:(e,t)=>e.matrix.length===t.matrix.length&&e.matrix.every((r,n)=>r===t.matrix[n])};var jd={lerp:(e,t,r)=>({type:"curves",channel:r<.5?e.channel:t.channel,points:e.points.map(([n,o],s)=>{let[i,a]=t.points[s]??[n,o];return[m(n,i,r),m(o,a,r)]})}),equals:(e,t)=>e.channel===t.channel&&e.points.length===t.points.length&&e.points.every(([r,n],o)=>r===t.points[o]?.[0]&&n===t.points[o]?.[1])};var Bd={lerp:(e,t,r)=>({type:"colorAdjustment",brightness:m(e.brightness??0,t.brightness??0,r),contrast:m(e.contrast??1,t.contrast??1,r),saturation:m(e.saturation??1,t.saturation??1,r),hue:m(e.hue??0,t.hue??0,r),vibrance:m(e.vibrance??0,t.vibrance??0,r),shadows:m(e.shadows??0,t.shadows??0,r),highlights:m(e.highlights??0,t.highlights??0,r),temperature:m(e.temperature??0,t.temperature??0,r),tint:m(e.tint??0,t.tint??0,r),vignette:m(e.vignette??0,t.vignette??0,r)}),equals:(e,t)=>e.brightness===t.brightness&&e.contrast===t.contrast&&e.saturation===t.saturation&&e.hue===t.hue&&e.vibrance===t.vibrance&&e.shadows===t.shadows&&e.highlights===t.highlights&&e.temperature===t.temperature&&e.tint===t.tint&&e.vignette===t.vignette};var Ld={lerp:(e,t,r)=>({type:"posterizeTime",fps:m(e.fps,t.fps,r)}),equals:(e,t)=>e.fps===t.fps};var qd={lerp:(e,t,r)=>({type:"echo",echoes:Math.round(m(e.echoes,t.echoes,r)),delay:m(e.delay,t.delay,r),decay:m(e.decay??.5,t.decay??.5,r),blend:r<.5?e.blend:t.blend}),equals:(e,t)=>e.echoes===t.echoes&&e.delay===t.delay&&(e.decay??.5)===(t.decay??.5)&&e.blend===t.blend};var Bo=new Map([["exposure",Fd],["blur",Id],["grayscale",zd],["alpha",Nd],["colorMatrix",$d],["curves",jd],["colorAdjustment",Bd],["posterizeTime",Ld],["echo",qd]]),oy=new Set(["posterizeTime","echo"]);function sy(e){return!oy.has(e)}function iy(e){return Bo.has(e)||Od(e)}function Wd(e,t,r){if(e.type!==t.type)return r<.5?e:t;let n=Bo.get(e.type);return n?n.lerp(e,t,r):Rn(e,t,r)}function Gd(e,t){Bo.has(e.type)||zo(e,t)}function ay(e){return Bo.has(e.type)?"filter":Dn({...e,mode:"foreground"})}function Fn(e,t,r){let n=Math.max(e.length,t.length),o=[];for(let s=0;s<n;s++){let i=e[s],a=t[s];i&&a?o.push(Wd(i,a,r)):i?o.push(i):a&&o.push(a)}return o}function In(e,t){return typeof e=="number"?{[t]:e}:e}function B(e){return e.list[0]}var Vr=class{list;constructor(t=[]){this.list=t}append(t){let r=this.constructor;return new r([...this.list,t])}blur(t){let{radius:r}=In(t,"radius");return this.append({type:"blur",radius:r})}grayscale(t){let{amount:r}=In(t,"amount");return this.append({type:"grayscale",amount:r})}alpha(t){let{amount:r}=In(t,"amount");return this.append({type:"alpha",amount:r})}exposure(t){let{amount:r}=In(t,"amount");return this.append({type:"exposure",amount:r})}colorAdjustment(t){return this.append({type:"colorAdjustment",...t})}colorMatrix(t){let r=Array.isArray(t)?t:t.matrix;return this.append({type:"colorMatrix",matrix:r})}curves(t){return this.append({type:"curves",points:t.points,channel:t.channel})}directionalBlur(t){return this.append(B(new F().directionalBlur(t)))}radialBlur(t){return this.append(B(new F().radialBlur(t)))}progressiveBlur(t){return this.append(B(new F().progressiveBlur(t)))}bloom(t){return this.append(B(new F().bloom(t)))}streak(t){return this.append(B(new F().streak(t)))}godRays(t){return this.append(B(new F().godRays(t)))}sharpen(t){return this.append(B(new F().sharpen(t)))}invert(t){return this.append(B(new F().invert(t)))}vintage(t){return this.append(B(new F().vintage(t)))}duotone(t){return this.append(B(new F().duotone(t)))}posterize(t){return this.append(B(new F().posterize(t)))}threshold(t){return this.append(B(new F().threshold(t)))}bitCrush(t){return this.append(B(new F().bitCrush(t)))}dither(t){return this.append(B(new F().dither(t)))}halftone(t){return this.append(B(new F().halftone(t)))}grain(t){return this.append(B(new F().grain(t)))}lut(t){return this.append(B(new F().lut(t)))}scanlines(t){return this.append(B(new F().scanlines(t)))}pixelate(t){return this.append(B(new F().pixelate(t)))}oilPaint(t){return this.append(B(new F().oilPaint(t)))}ascii(t){return this.append(B(new F().ascii(t)))}edges(t){return this.append(B(new F().edges(t)))}vignette(t){return this.append(B(new F().vignette(t)))}texture(t){return this.append(B(new F().texture(t)))}chromaticAberration(t){return this.append(B(new F().chromaticAberration(t)))}rgbShift(t){return this.append(B(new F().rgbShift(t)))}scatter(t){return this.append(B(new F().scatter(t)))}blockDisplace(t){return this.append(B(new F().blockDisplace(t)))}bulge(t){return this.append(B(new F().bulge(t)))}twirl(t){return this.append(B(new F().twirl(t)))}wave(t){return this.append(B(new F().wave(t)))}kaleidoscope(t){return this.append(B(new F().kaleidoscope(t)))}displace(t){return this.append(B(new F().displace(t)))}shader(t){return this.append(B(new F().shader(t)))}sksl(t){return this.append(B(new F().sksl(t)))}*[Symbol.iterator](){yield*this.list}toJSON(){return this.list}},Lo=class extends Vr{posterizeTime(t){let{fps:r}=In(t,"fps");return this.append({type:"posterizeTime",fps:r})}echo(t){return this.append({type:"echo",...t})}},Yd=new Vr,Vd=new Lo,ly=Yd,cy=Vd;function zn(e){return e===void 0?[]:e instanceof Vr?e.list:Array.isArray(e)?e:[e]}var na={topLeft:{x:-1,y:1},topCenter:{x:0,y:1},topRight:{x:1,y:1},centerLeft:{x:-1,y:0},center:{x:0,y:0},centerRight:{x:1,y:0},bottomLeft:{x:-1,y:-1},bottomCenter:{x:0,y:-1},bottomRight:{x:1,y:-1}},ea=Object.keys(na);function ra(e){if(typeof e=="string"){let t=na[e];if(!t)throw new Error(`Unknown alignment value: '${e}'`);return{...t}}return{x:e.x,y:e.y}}var J={resolve:ra,lerp:P,keys:ea,isKey(e){return typeof e=="string"&&Object.hasOwn(na,e)},validateProps(e){let t=ea.filter(r=>e[r]!==void 0);if(t.length>1)throw new Error(`Cannot set multiple alignment props at once: ${t.join(", ")}`);if(t.length===1&&e.pivot!==void 0)throw new Error(`Cannot set both alignment prop '${t[0]}' and 'pivot' at the same time`)},findKey(e){return ea.find(t=>e[t]!==void 0)},resolveTargetOnce(e,t,r){let n=ra(e);return{pivot:n,x:r.x-n.x*(t.width/2),y:r.y-n.y*(t.height/2)}},bindTarget(e,t,r){let n=ra(e);return{pivot:n,x:()=>t().x-n.x*(r().width/2),y:()=>t().y-n.y*(r().height/2)}}};var Tt={resolve:(e,t)=>typeof e=="number"?{left:e,right:e,top:e,bottom:e}:{left:e.left??e.horizontal??t?.left??0,right:e.right??e.horizontal??t?.right??0,top:e.top??e.vertical??t?.top??0,bottom:e.bottom??e.vertical??t?.bottom??0},lerp:(e,t,r)=>({left:m(e.left,t.left,r),right:m(e.right,t.right,r),top:m(e.top,t.top,r),bottom:m(e.bottom,t.bottom,r)}),insetBounds:(e,t,r)=>({width:Math.max(0,e-r.left-r.right),height:Math.max(0,t-r.top-r.bottom),x:(r.left-r.right)/2,y:(r.top-r.bottom)/2}),outsetSize:(e,t,r)=>({width:e+r.left+r.right,height:t+r.top+r.bottom})};function qo(e,t){let r=e?.adjustments??t,n=zn(r);if(n.length!==0)return{adjustments:n,intensity:Math.min(1,Math.max(0,e?.intensity??1))}}function Wo(e,t,r){if(!e&&!t)return;let n=e??{adjustments:t.adjustments,intensity:0},o=t??{adjustments:e.adjustments,intensity:0};return{adjustments:Fn(n.adjustments,o.adjustments,r),intensity:m(n.intensity,o.intensity,r)}}function Go(e,t){for(let r of e?.adjustments??[])Gd(r,t)}var Kd={left:0,right:0,top:0,bottom:0},Hd={x:0,y:0};function oa(e){return{crop:e.crop===void 0?void 0:Tt.resolve(e.crop),anchor:e.anchor===void 0?void 0:J.resolve(e.anchor)}}function sa(e,t,r){return{matrix:e.matrix??t.matrix,crop:e.crop||t.crop?Tt.lerp(e.crop??Kd,t.crop??Kd,r):void 0,zoom:m(e.zoom??1,t.zoom??1,r),anchor:P(e.anchor??Hd,t.anchor??Hd,r)}}var Ud={resolve:({crop:e,anchor:t,preset:r,filters:n,...o})=>({...o,...oa({crop:e,anchor:t}),preset:qo(r,n)}),lerp:(e,t,r)=>({src:r<.5?e.src:t.src,fit:e.fit??t.fit,...sa(e,t,r),opacity:(e.opacity??1)+((t.opacity??1)-(e.opacity??1))*r,preset:Wo(e.preset,t.preset,r)}),equals:(e,t)=>e.src===t.src,declare:(e,t)=>{t.image(e.src),Go(e.preset,t)}};function dy(e,t,r){let n=e.trimStart??0;return py(e,n,uy(e,t,r,n))}function uy(e,t,r,n){if(e.timestamp!=null)return e.timestamp;if(!e.playing)return n;let o=Math.max(0,t-(e.playStart??0))*(e.speed??1);return ia(o,n,fy(e,r),e.loop,e.duration)}function fy(e,t){let r=t!==void 0&&Number.isFinite(t)&&t>0;return e.trimEnd??(r?t:1/0)}function ia(e,t,r,n,o){let s=o??(r!==1/0?r-t:void 0),i=s!==void 0&&s>0?s:void 0;if((n??"none")!=="none"&&i!==void 0){let l=e%i;if(n==="reverse"){let c=Math.floor(e/i)%2===0;return t+(c?l:i-l)}return t+l}let a=t+e;return r!==1/0?Math.min(a,r):a}function py(e,t,r){let n=e.preset?.adjustments.find(s=>s.type==="posterizeTime");if(!n||n.fps<=0)return r;let o=1/n.fps;return t+Math.floor((r-t)/o)*o}var Xd={resolve:({crop:e,anchor:t,preset:r,filters:n,...o})=>({...o,...oa({crop:e,anchor:t}),preset:qo(r,n),playing:o.playing??!0}),lerp:(e,t,r)=>({src:r<.5?e.src:t.src,fit:e.fit??t.fit,...sa(e,t,r),loop:r<.5?e.loop:t.loop,duration:r<.5?e.duration:t.duration,trimStart:r<.5?e.trimStart:t.trimStart,trimEnd:r<.5?e.trimEnd:t.trimEnd,playStart:r<.5?e.playStart:t.playStart,playing:r<.5?e.playing:t.playing,opacity:(e.opacity??1)+((t.opacity??1)-(e.opacity??1))*r,timestamp:e.timestamp==null&&t.timestamp==null?void 0:m(e.timestamp??0,t.timestamp??0,r),speed:m(e.speed??1,t.speed??1,r),preset:Wo(e.preset,t.preset,r)}),equals:(e,t)=>e.src===t.src,declare:(e,t)=>{t.video(e.src,{start:e.trimStart??0,end:e.trimEnd}),Go(e.preset,t)}};var Ht=class{_cmds=[];_x=0;_y=0;_startX=0;_startY=0;_open=!1;moveTo(t,r){return this._cmds.push({type:"M",x:t,y:r}),this._startX=t,this._startY=r,this._at(t,r)}lineTo(t,r){return this._cmds.push({type:"L",x:t,y:r}),this._at(t,r)}bezierCurveTo(t,r,n,o,s,i){return this._cmds.push({type:"C",x1:t,y1:r,x2:n,y2:o,x:s,y:i}),this._at(s,i)}quadraticCurveTo(t,r,n,o){return this._cmds.push({type:"Q",x1:t,y1:r,x:n,y:o}),this._at(n,o)}arcTo(t,r,n,o,s,i,a){return this._cmds.push({type:"A",rx:t,ry:r,rotation:n,largeArc:o,sweep:s,x:i,y:a}),this._at(i,a)}arc(t){let{cx:r,cy:n,rx:o,ry:s,from:i,sweep:a}=Zd(t),l=aa(r,n,o,s,i);return this._open?(l.x!==this._x||l.y!==this._y)&&this.lineTo(l.x,l.y):this.moveTo(l.x,l.y),this._sweep(r,n,o,s,i,a)}ellipse(t){let{cx:r,cy:n,rx:o,ry:s,from:i,sweep:a}=Zd(t),l=aa(r,n,o,s,i);return this.moveTo(l.x,l.y),this._sweep(r,n,o,s,i,a),this.close()}close(){return this._cmds.push({type:"Z"}),this._at(this._startX,this._startY)}toCommands(){return[...this._cmds]}toPathState(t={}){return{...t,data:this._cmds}}_at(t,r){return this._x=t,this._y=r,this._open=!0,this}_sweep(t,r,n,o,s,i){if(i===0)return this;let a=Math.ceil(Math.abs(i)/90),l=i/a,c=i>0?1:0;for(let d=1;d<=a;d++){let u=aa(t,r,n,o,s+l*d);this.arcTo(n,o,0,0,c,u.x,u.y)}return this}};function Zd(e){return{cx:e.x??0,cy:e.y??0,rx:e.width/2,ry:(e.height??e.width)/2,from:e.startAngle??0,sweep:e.sweep??360}}function aa(e,t,r,n,o){let s=o*Math.PI/180;return{x:e+r*Math.cos(s),y:t+n*Math.sin(s)}}var hy=new Set(["rect","ellipse","path","line","polygon","polygram","text","richText"]),D=class e{_ops=[];_opacity=1;_rotation=0;_scale=1;_transformCenter;rect(t){return this._ops.push({kind:"rect",state:t}),this}ellipse(t){return this._ops.push({kind:"ellipse",state:t}),this}path(t){let r=t instanceof Ht?t.toPathState():t;return this._ops.push({kind:"path",state:r}),this}line(t){return this._ops.push({kind:"line",state:t}),this}polygon(t){return this._ops.push({kind:"polygon",state:t}),this}polygram(t){return this._ops.push({kind:"polygram",state:t}),this}text(t){return this._ops.push({kind:"text",state:t}),this}richText(t){return this._ops.push({kind:"richText",state:t}),this}fill(t){return this._ops.push({kind:"fill",fills:t}),this}stroke(t){return this._ops.push({kind:"stroke",strokes:t}),this}shadow(t){return this._ops.push({kind:"shadow",shadows:t}),this}cut(){return this._ops.push({kind:"cut"}),this}mask(t){return this._ops.push({kind:"mask",options:t}),this}applyMask(){return this._ops.push({kind:"applyMask"}),this}endMask(){return this._ops.push({kind:"endMask"}),this}opacity(t){return this._opacity=t,this}effects(t){return this._ops.push({kind:"effects",effects:Wr.resolve(t)}),this}rotation(t,r){return this._rotation=t,r!==void 0&&(this._transformCenter=r),this}scale(t,r){return this._scale=t,r!==void 0&&(this._transformCenter=r),this}ops(){return this._ops}groupOpacity(){return this._opacity}needsGroupLayer(){return this._opacity<1}groupTransform(){return this._rotation===0&&this._scale===1?null:{rotation:this._rotation,scale:this._scale,center:this._transformCenter}}isPaintOnly(){return!this._ops.some(t=>hy.has(t.kind))}_withOps(t){let r=new e;return r._ops=t,r._opacity=this._opacity,r._rotation=this._rotation,r._scale=this._scale,r._transformCenter=this._transformCenter,r}};var Vo=512;function Ko(e,t={}){if(e==null)return{};if(typeof e=="string")return la(e)?{map:e}:{color:e};if(Array.isArray(e))return e.every(r=>typeof r=="number")?{color:e}:{map:Jd(e,t)};if(typeof e=="object"){if(gy(e))return{map:my(e,t)};if(yy(e))return{map:e};if(ru(e))return{color:e.color}}return{map:Jd(e,t)}}function my(e,t){return{source:e,width:t.width??Vo,height:t.height??Vo}}function Jd(e,t){let r=t.width??Vo,n=t.height??Vo;return{source:new D().rect({width:r,height:n}).fill(e),width:r,height:n,static:!0,identity:`fill:${Yo(e)}:${r}x${n}`}}function la(e){return e.startsWith("/")||e.startsWith(".")||/\.(png|jpe?g|webp|avif|svg|ktx2?|hdr|exr|mp4|webm|mov)$/i.test(e)}function yy(e){return"src"in e||"data"in e||"source"in e&&"width"in e}function gy(e){let t=e;return typeof t.cameraDescriptor=="function"?!1:typeof t.ops=="function"?!0:typeof t.id=="string"&&typeof t.attach=="function"}function ru(e){let t=e;return t.type!=="solid"||t.color===void 0?!1:t.opacity===void 0&&t.blend===void 0&&t.space===void 0}function Ho(e,t,r){let n=Qd(e),o=Qd(t);return n!==null&&o!==null?nt(tu(n),tu(o),r):r<1?e:t}function Qd(e){return e==null?null:typeof e=="string"?la(e)?null:e:Array.isArray(e)?e.every(t=>typeof t=="number")?e:null:typeof e=="object"&&ru(e)?e.color:null}function tu(e){return Array.isArray(e)?e:Y(e)}var eu=new WeakMap,xy=0;function Yo(e){if(e===null||typeof e!="object")return String(e);if(Array.isArray(e))return`[${e.map(Yo).join(",")}]`;let t=e.list;if(Array.isArray(t))return Yo(t);let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null){let o=eu.get(e);return o===void 0&&(o=`@${xy++}`,eu.set(e,o)),o}let n=e;return`{${Object.keys(n).sort().map(o=>`${o}:${Yo(n[o])}`).join(",")}}`}var ca=new Set(["mesh","light","instances","points","line","sprite","model"]),nu=["position","rotation","quaternion","scale","lookAt","visible","shadow","renderOrder"],ou=["opacity","roughness","metalness","emission","emissionStrength","normalMap","roughnessMap","metalnessMap","aoMap","alphaMap","envMapIntensity","wireframe","shading","faces","vertexColors","blend"],_y=[...ou,"fill","material","unlit"];function Uo(e){let t=e,r;for(let n of nu)t[n]!==void 0&&((r??={})[n]=t[n]);return r}function Kr(e){if(e.material!==void 0)return e.material;let t={type:e.unlit?"basic":"standard"},r=Ko(e.fill);r.color!==void 0&&(t.color=r.color),r.map!==void 0&&(t.map=r.map);for(let n of ou){let o=e[n];o!==void 0&&(t[n]=o)}return t}function wy(e,t){let r=e,n={type:t};for(let o in r)_y.includes(o)||nu.includes(o)||r[o]!==void 0&&(n[o]=r[o]);return n}var Dt=class{_ops=[];mesh(t,r,n){return this._ops.push({kind:"mesh",geometry:t,material:r??{type:"standard"},transform:n}),this}sugar(t,r){let n=r??{};return this.mesh(wy(n,t),Kr(n),Uo(n))}box(t){return this.sugar("box",t)}sphere(t){return this.sugar("sphere",t)}plane(t){return this.sugar("plane",t)}cylinder(t){return this.sugar("cylinder",t)}cone(t){return this.sugar("cone",t)}torus(t){return this.sugar("torus",t)}torusKnot(t){return this.sugar("torusKnot",t)}circle(t){return this.sugar("circle",t)}ring(t){return this.sugar("ring",t)}capsule(t){return this.sugar("capsule",t)}polyhedron(t){return this.sugar("polyhedron",t)}extrude(t){return this.sugar("extrude",t)}lathe(t){return this.sugar("lathe",t)}tube(t){return this.sugar("tube",t)}instances(t,r,n,o){return this._ops.push({kind:"instances",geometry:t,material:r,instances:n,colors:o?.colors,transform:o?.transform}),this}points(t,r,n){return this._ops.push({kind:"points",geometry:t,material:r??{type:"points"},transform:n}),this}line(t){let{points:r,geometry:n,material:o,closed:s,segments:i,stroke:a,opacity:l}=t;if(!r&&!n)throw new Error("Graphics3D.line() needs either `points` or `geometry`.");let c=o??{type:a?.dash!==void 0?"lineDashed":"lineBasic",...a?.fill!==void 0?{color:a.fill}:{},...a?.weight!==void 0?{width:a.weight}:{},...a?.dash!==void 0?{dashSize:a.dash[0],gapSize:a.dash[1]??a.dash[0]}:{},...l!==void 0?{opacity:l}:{}};return this._ops.push({kind:"line",geometry:n??{type:"buffer",position:vy(r)},material:c,mode:i?"segments":s?"loop":"strip",transform:Uo(t)}),this}sprite(t){let{fill:r,material:n,opacity:o}=t,s=Ko(r),i=n??{type:"sprite",...s.map!==void 0?{map:s.map}:{},...s.color!==void 0?{color:s.color}:{},...o!==void 0?{opacity:o}:{}};return this._ops.push({kind:"sprite",material:i,transform:Uo(t)}),this}model(t){let{src:r,animation:n,override:o}=t;return this._ops.push({kind:"model",src:r,animation:n===void 0?void 0:Array.isArray(n)?n:[n],override:o,transform:Uo(t)}),this}ops(){return this._ops}isEmpty(){return this._ops.length===0}};function vy(e){let t=[];for(let r of e)if(typeof r=="number")t.push(r,r,r);else if(Array.isArray(r))t.push(r[0]??0,r[1]??0,r[2]??0);else{let n=r;t.push(n.x??0,n.y??0,n.z??0)}return t}var Nn=class{};function $n(e){return e===void 0||e===!1?null:e===!0?{enabled:!0}:{enabled:!0,...e}}var Lt=class extends Nn{_ops=[];_camera=null;_fog=null;_environment=null;_shadows=null;_tone=null;_post=[];_depth=0;begin(t){this._ops.push({kind:"push",transform:{...t.transform,key:t.id}}),this._depth++}end(){this._ops.push({kind:"pop"}),this._depth--}draw(t){let r=t.ops();for(let n=0;n<r.length;n++)this._ops.push(r[n]);return this}light(t,r){return this._ops.push({kind:"light",light:t,transform:r}),this}camera(t){return this._camera=t,this._ops.push({kind:"camera",camera:t}),this}perspective(t){return this.camera({type:"perspective",...t})}orthographic(t){return this.camera({type:"orthographic",...t})}fog(t){return t===null?this._fog=null:typeof t=="object"&&!Array.isArray(t)?this._fog=t:this._fog={color:t},this}environment(t){return this._environment=t,this}shadows(t){return this._shadows=$n(t??!0),this}tone(t){return this._tone=t,this}post(t){return Array.isArray(t)?this._post.push(...t):this._post.push(t),this}ops(){return this._ops}cameraDescriptor(){return this._camera}fogDescriptor(){return this._fog}environmentDescriptor(){return this._environment}shadowSettings(){return this._shadows}toneSettings(){return this._tone}postEffects(){return this._post}isEmpty(){return!this._ops.some(t=>ca.has(t.kind))}assertBalanced(){if(this._depth!==0){let t=this._depth>0?"unclosed begin()":"extra end()";throw new Error(`Scene3D has ${Math.abs(this._depth)} ${t}.`)}}};function jn(e){return typeof e.ops=="function"?{kind:"graphics",graphics:e}:{kind:"node",node:e}}function su(e){return typeof e!="string"&&"data"in e}function Hr(e){return typeof e!="string"&&"source"in e}function Sy(e){return typeof e=="string"?{src:e}:e}function da(e){return typeof e=="string"?e:su(e)||Hr(e)?null:e.src}function ua(e,t){return`three:${e}:${t}`}function by(e){if(!e.startsWith("three:"))return null;let t=e.slice(6),r=t.indexOf(":");return r<=0?null:{kind:t.slice(0,r),src:t.slice(r+1)}}var fa=null,iu=null;function ky(e){fa=e}function My(e){iu=e}function pa(){return fa?.()}function ha(){return iu}function Ay(){return fa!==null}var au=["map","alphaMap","aoMap","normalMap","displacementMap","envMap","lightMap","emissionMap","roughnessMap","metalnessMap","specularMap","gradientMap","matcap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","transmissionMap","thicknessMap"];function lu(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:"src"in e||"data"in e||"source"in e}function Bn(e,t){let r=o=>{if(o)for(let s in o){let i=o[s];(typeof i=="string"||lu(i))&&t(i)}},n=o=>{if(o===void 0)return;let s=Array.isArray(o)?o:[o];for(let i of s){let a=i;for(let l of au)a[l]!==void 0&&t(a[l]);r(a.uniforms)}};for(let o of e.ops())switch(o.kind){case"mesh":case"points":case"line":case"instances":n(o.material);break;case"sprite":n(o.material);break;case"model":if(o.override)for(let s in o.override)n(o.override[s]);break}if(e instanceof Lt)for(let o of e.postEffects())r(o.uniforms)}var Oy=new Set(["linear-gradient","radial-gradient","conic-gradient"]);function Xo(e){return Oy.has(e)}function ma(e,t){let r=e.type==="solid"||Xo(e.type),n=t.type==="solid"||Xo(t.type);return!r||!n?!1:Xo(e.type)||Xo(t.type)}function Ey(e){return Array.from({length:e},(t,r)=>r/Math.max(1,e-1))}function cu(e,t,r,n,o,s){let i=Math.max(2,s),a=Array.from({length:i},()=>[...e]),l=Ey(i),c={colors:a,stops:l,opacity:t,blend:r,space:n};switch(o){case"linear-gradient":return{type:"linear-gradient",...c,start:{x:-1,y:1},end:{x:1,y:-1}};case"radial-gradient":return{type:"radial-gradient",...c,center:{x:0,y:0},radius:100};case"conic-gradient":return{type:"conic-gradient",...c,center:{x:0,y:0},startAngle:0}}}function Cy(e,t){if(e.type===t)return e;let r={colors:e.colors,stops:e.stops,opacity:e.opacity,blend:e.blend,space:e.space};switch(t){case"linear-gradient":return{type:"linear-gradient",...r,start:{x:-1,y:1},end:{x:1,y:-1}};case"radial-gradient":return{type:"radial-gradient",...r,center:{x:0,y:0},radius:100};case"conic-gradient":return{type:"conic-gradient",...r,center:{x:0,y:0},startAngle:0}}}function du(e,t){let r=e.type==="solid",n=t.type==="solid";if(r&&!n){let i=t;return[cu(e.color,e.opacity,e.blend,e.space,i.type,i.colors.length),i]}if(n&&!r){let i=e,a=cu(t.color,t.opacity,t.blend,t.space,i.type,i.colors.length);return[i,a]}let o=e,s=t;return[Cy(o,s.type),s]}var uu={resolve:e=>({type:"solid",color:Array.isArray(e.color)?e.color:Y(e.color),opacity:e.opacity,blend:e.blend}),lerp:(e,t,r)=>({color:[m(e.color[0],t.color[0],r),m(e.color[1],t.color[1],r),m(e.color[2],t.color[2],r),m(e.color[3],t.color[3],r)],opacity:(e.opacity??1)+((t.opacity??1)-(e.opacity??1))*r}),equals:(e,t)=>e.color===t.color};function Py(e){return Array.isArray(e)?e:Y(e)}var fu={resolve:e=>({type:"linear-gradient",colors:e.colors.map(Py),stops:e.stops??e.colors.map((t,r)=>r/Math.max(1,e.colors.length-1)),start:e.start??{x:-1,y:1},end:e.end??{x:1,y:-1},opacity:e.opacity,blend:e.blend}),lerp:(e,t,r)=>({colors:e.colors.map((n,o)=>{let s=t.colors[o]??n;return[m(n[0],s[0],r),m(n[1],s[1],r),m(n[2],s[2],r),m(n[3],s[3],r)]}),stops:e.stops.map((n,o)=>m(n,t.stops[o]??n,r)),start:P(e.start,t.start,r),end:P(e.end,t.end,r),opacity:(e.opacity??1)+((t.opacity??1)-(e.opacity??1))*r}),equals:(e,t)=>e.start.x===t.start.x&&e.start.y===t.start.y&&e.end.x===t.end.x&&e.end.y===t.end.y&&e.colors.length===t.colors.length&&e.colors.every((r,n)=>r===t.colors[n])};function Ty(e){return Array.isArray(e)?e:Y(e)}var pu={resolve:e=>({type:"radial-gradient",colors:e.colors.map(Ty),stops:e.stops??e.colors.map((t,r)=>r/Math.max(1,e.colors.length-1)),center:e.center??{x:0,y:0},radius:e.radius??100,opacity:e.opacity,blend:e.blend}),lerp:(e,t,r)=>({colors:e.colors.map((n,o)=>{let s=t.colors[o]??n;return[m(n[0],s[0],r),m(n[1],s[1],r),m(n[2],s[2],r),m(n[3],s[3],r)]}),stops:e.stops.map((n,o)=>m(n,t.stops[o]??n,r)),center:P(e.center,t.center,r),radius:m(e.radius,t.radius,r),opacity:m(e.opacity??1,t.opacity??1,r)}),equals:(e,t)=>e.center.x===t.center.x&&e.center.y===t.center.y&&e.radius===t.radius&&e.colors.length===t.colors.length&&e.colors.every((r,n)=>r===t.colors[n])};function Dy(e){return Array.isArray(e)?e:Y(e)}var hu={resolve:e=>({type:"conic-gradient",colors:e.colors.map(Dy),stops:e.stops??e.colors.map((t,r)=>r/Math.max(1,e.colors.length-1)),center:e.center??{x:0,y:0},startAngle:e.startAngle,opacity:e.opacity,blend:e.blend}),lerp:(e,t,r)=>({colors:e.colors.map((n,o)=>{let s=t.colors[o]??n;return[m(n[0],s[0],r),m(n[1],s[1],r),m(n[2],s[2],r),m(n[3],s[3],r)]}),stops:e.stops.map((n,o)=>m(n,t.stops[o]??n,r)),center:P(e.center,t.center,r),startAngle:m(e.startAngle??0,t.startAngle??0,r),opacity:m(e.opacity??1,t.opacity??1,r)}),equals:(e,t)=>e.center.x===t.center.x&&e.center.y===t.center.y&&(e.startAngle??0)===(t.startAngle??0)&&e.colors.length===t.colors.length&&e.colors.every((r,n)=>r===t.colors[n])};var mu={resolve:e=>{let t=e.color??[0,0,0,1];return{type:"noise",size:e.size??{x:1,y:1},density:e.density??1,color:Array.isArray(t)?t:Y(t),seed:e.seed??0,opacity:e.opacity,blend:e.blend}},lerp:(e,t,r)=>({size:{x:m(e.size.x,t.size.x,r),y:m(e.size.y,t.size.y,r)},density:m(e.density,t.density,r),seed:m(e.seed,t.seed,r),color:[m(e.color[0],t.color[0],r),m(e.color[1],t.color[1],r),m(e.color[2],t.color[2],r),m(e.color[3],t.color[3],r)],opacity:m(e.opacity??1,t.opacity??1,r)}),equals:(e,t)=>e.size.x===t.size.x&&e.size.y===t.size.y&&e.density===t.density&&e.seed===t.seed&&e.color[0]===t.color[0]&&e.color[1]===t.color[1]&&e.color[2]===t.color[2]&&e.color[3]===t.color[3]};function Ry(e){return Array.isArray(e)?e:Y(e)}var Fy=[0,0,0,1],Iy=[1,1,1,1],zy=e=>e===void 0?{x:3,y:3}:typeof e=="number"?{x:e,y:e}:e,yu={resolve:e=>{let t=e.colors?.length?e.colors.map(Ry):[Fy,Iy];return{type:"fractalNoise",basis:e.basis??"simplex",octaves:Math.max(1,Math.min(8,Math.round(e.octaves??4))),frequency:zy(e.frequency),lacunarity:e.lacunarity??2,gain:e.gain??.5,seed:e.seed??0,offset:e.offset??{x:0,y:0},angle:e.angle??0,colors:t,stops:e.stops??t.map((r,n)=>n/Math.max(1,t.length-1)),contrast:e.contrast??1,opacity:e.opacity,blend:e.blend}},lerp:(e,t,r)=>({basis:r<.5?e.basis:t.basis,octaves:r<.5?e.octaves:t.octaves,frequency:P(e.frequency,t.frequency,r),lacunarity:m(e.lacunarity,t.lacunarity,r),gain:m(e.gain,t.gain,r),seed:m(e.seed,t.seed,r),offset:P(e.offset,t.offset,r),angle:m(e.angle,t.angle,r),colors:e.colors.map((n,o)=>{let s=t.colors[o]??n;return[m(n[0],s[0],r),m(n[1],s[1],r),m(n[2],s[2],r),m(n[3],s[3],r)]}),stops:e.stops.map((n,o)=>m(n,t.stops[o]??n,r)),contrast:m(e.contrast,t.contrast,r),opacity:m(e.opacity??1,t.opacity??1,r)}),equals:(e,t)=>e.basis===t.basis&&e.octaves===t.octaves&&e.frequency.x===t.frequency.x&&e.frequency.y===t.frequency.y&&e.lacunarity===t.lacunarity&&e.gain===t.gain&&e.seed===t.seed&&e.offset.x===t.offset.x&&e.offset.y===t.offset.y&&e.angle===t.angle&&e.contrast===t.contrast&&e.colors.length===t.colors.length&&e.colors.every((r,n)=>{let o=t.colors[n];return o!=null&&r[0]===o[0]&&r[1]===o[1]&&r[2]===o[2]&&r[3]===o[3]})&&e.stops.length===t.stops.length&&e.stops.every((r,n)=>r===t.stops[n])};var gu={resolve:e=>({type:"stripe",gap:e.gap,strokeWidth:e.strokeWidth,angle:e.angle,color:e.color!=null?Array.isArray(e.color)?e.color:Y(e.color):void 0,opacity:e.opacity,blend:e.blend}),lerp:(e,t,r)=>({gap:m(e.gap??8,t.gap??8,r),strokeWidth:m(e.strokeWidth??1,t.strokeWidth??1,r),angle:m(e.angle??-45,t.angle??-45,r),color:e.color&&t.color?[m(e.color[0],t.color[0],r),m(e.color[1],t.color[1],r),m(e.color[2],t.color[2],r),m(e.color[3],t.color[3],r)]:e.color??t.color,opacity:m(e.opacity??1,t.opacity??1,r)}),equals:(e,t)=>e.gap===t.gap&&e.strokeWidth===t.strokeWidth&&e.angle===t.angle&&e.color?.[0]===t.color?.[0]&&e.color?.[1]===t.color?.[1]&&e.color?.[2]===t.color?.[2]&&e.color?.[3]===t.color?.[3]};var Ny=2,$y=16,xu={resolve:e=>{let t=e.color??[0,0,0,1];return{type:"dotGrid",radius:e.radius??Ny,spacing:e.spacing??$y,offset:e.offset??{x:0,y:0},color:Array.isArray(t)?t:Y(t),opacity:e.opacity,blend:e.blend}},lerp:(e,t,r)=>({radius:m(e.radius,t.radius,r),spacing:m(e.spacing,t.spacing,r),offset:{x:m(e.offset.x,t.offset.x,r),y:m(e.offset.y,t.offset.y,r)},color:[m(e.color[0],t.color[0],r),m(e.color[1],t.color[1],r),m(e.color[2],t.color[2],r),m(e.color[3],t.color[3],r)],opacity:m(e.opacity??1,t.opacity??1,r)}),equals:(e,t)=>e.radius===t.radius&&e.spacing===t.spacing&&e.offset.x===t.offset.x&&e.offset.y===t.offset.y&&e.color[0]===t.color[0]&&e.color[1]===t.color[1]&&e.color[2]===t.color[2]&&e.color[3]===t.color[3]};var _u=4;function jy(e){if(!e?.length)return;let t=[];for(let r of e)if(!(!r?.name||!r?.src)){if(t.length>=_u){console.warn(`[SkSL] A shader fill declares more than ${_u} textures; the rest are ignored.`);break}t.push({name:r.name,src:r.src})}return t.length?t:void 0}function By(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((r,n)=>r.name===t[n].name&&r.src===t[n].src)}var wu={resolve:e=>({type:"shader",source:e.source??"",...e.shaderId!==void 0?{shaderId:e.shaderId}:{},uniforms:Kt(e.uniforms),coords:e.coords??"normalized",textures:jy(e.textures),opacity:e.opacity,blend:e.blend}),lerp:(e,t,r)=>({source:r<.5?e.source:t.source,uniforms:Cn(e.uniforms,t.uniforms,r),coords:r<.5?e.coords:t.coords,textures:r<.5?e.textures:t.textures,opacity:(e.opacity??1)+((t.opacity??1)-(e.opacity??1))*r}),equals:(e,t)=>e.source===t.source&&e.coords===t.coords&&Pn(e.uniforms,t.uniforms)&&By(e.textures,t.textures),declare:(e,t)=>{for(let r of e.textures??[])t.image(r.src)}};function Ur(e,t){Bn(e,n=>{if(Hr(n)){let s=jn(n.source);s.kind==="node"&&t.subtree(s.node);return}let o=da(n);o!==null&&t.image(o)});let r=n=>{n!==void 0&&(n.type==="modelGeometry"?Zo("gltf",n.src,t):(n.type==="edges"||n.type==="wireframe")&&r(n.source))};for(let n of e.ops())switch(n.kind){case"mesh":case"points":case"line":case"instances":r(n.geometry);break;case"model":Zo("gltf",n.src,t);break}e instanceof Lt&&ya(e.environmentDescriptor(),t)}function ya(e,t){if(e!==null){e.src!==void 0&&Zo(Su(e.src),e.src,t);for(let r of e.faces??[])Zo(Su(r),r,t)}}var vu=new WeakMap;function Zo(e,t,r){let n=ha();if(!n)return;let o=ua(e,t),s=vu.get(n);s||vu.set(n,s=new Map);let i=s.get(o);i||s.set(o,i=()=>n(e,t)),r.loader(o,i)}function Su(e){return e.toLowerCase().endsWith(".exr")?"exr":"hdr"}var bu={resolve:e=>({...e}),lerp:(e,t,r)=>({scene:r<.5?e.scene:t.scene,maxPixelRatio:e.maxPixelRatio??t.maxPixelRatio,antialias:e.antialias??t.antialias,opacity:(e.opacity??1)+((t.opacity??1)-(e.opacity??1))*r}),equals:(e,t)=>e.scene===t.scene,declare:(e,t)=>{Ur(e.scene,t)}};var Mu=new Map([["solid",uu],["linear-gradient",fu],["radial-gradient",pu],["conic-gradient",hu],["noise",mu],["fractalNoise",yu],["stripe",gu],["dotGrid",xu],["grid",Rd],["shader",wu],["image",Ud],["video",Xd],["canvas3D",bu]]);function ga(e){let t=Mu.get(e);if(!t)throw new Error(`Fill "${e}" is not registered`);return t}function Ge(e){if(typeof e=="string")return Ge({type:"solid",color:e});if(e instanceof Lt)return Ge({type:"canvas3D",scene:e});let t=ga(e.type).resolve(e),r=e.space;return r!==void 0?{...t,space:r}:t}var Au=Ge({type:"image",src:""});function Ou(e,t){return e.type===t.type?e.blend===t.blend:ma(e,t)}function Jo(e,t,r){let n=Math.min(1,Math.max(0,r));if(e.type!==t.type){if(!ma(e,t))throw new Error(`No registered lerp for fills of type "${e.type}" and "${t.type}"`);let[o,s]=du(e,t);return{...o,...ga(o.type).lerp(o,s,n)}}if(e.blend!==t.blend)throw new Error(`No registered lerp for fills of type "${e.type}" and "${t.type}"`);return{...e,...ga(e.type).lerp(e,t,n)}}function ku(e,t){return{...e,opacity:(e.opacity??1)*Math.max(0,t)}}function xa(e,t){Mu.get(e.type)?.declare?.(e,t)}var W={resolve:e=>Yr(e).map(Ge),lerp:(e,t,r)=>{if(e===t)return e;if(!e.length&&!t.length)return[];let n=Math.min(1,Math.max(0,r)),o=Math.max(e.length,t.length),s=[];for(let i=0;i<o;i++){let a=e[i],l=t[i];a&&l?Ou(a,l)?s.push(Jo(a,l,n)):(n<1&&s.push(ku(a,1-n)),n>0&&s.push(ku(l,n))):a?s.push(Jo(a,{...a,opacity:0},n)):l&&s.push(Jo({...l,opacity:0},l,n))}return s}};function Eu(e,t){return{blur:e.blur??t?.blur??0,offset:e.offset??t?.offset,fill:e.fill!=null?W.resolve(e.fill):t?.fill??W.resolve("transparent"),inner:e.inner??t?.inner??!1,spread:e.spread??t?.spread??0}}function Ly(e,t,r){return{blur:e.blur+(t.blur-e.blur)*r,offset:P(e.offset??{x:0,y:0},t.offset??{x:0,y:0},r),fill:W.lerp(e.fill,t.fill,r),inner:r<1?e.inner:t.inner,spread:e.spread+(t.spread-e.spread)*r}}var ue={resolve:(e,t)=>e==null?[]:(Array.isArray(e)?e:[e]).map((n,o)=>Eu(n,t?.[o])),lerp:(e,t,r)=>{if(e===t)return e;let n=Math.max(e.length,t.length),o=[];for(let s=0;s<n;s++){let i=e[s],a=t[s];if(!i){o.push(a);continue}if(!a){o.push(i);continue}o.push(Ly(i,a,r))}return o}};function Cu(e,t){if(e==null)return t;if(typeof e=="number")return Math.max(-1,Math.min(1,e));switch(e){case"inside":return-1;case"center":return 0;case"outside":return 1}return t}function Qo(e,t){if(e==null)return t;switch(e){case"butt":case"round":case"square":return e}return t}function Pu(e,t){if(e==null)return t;switch(e){case"miter":case"round":case"bevel":return e}return t}function Tu(e,t){let r;if(e.dash!=null){let o=Array.isArray(e.dash)?e.dash:[e.dash];r=o.length===1?[o[0],o[0]]:o}else r=t?.dash;let n=Qo(e.cap,t?.cap??"butt");return{weight:e.weight??t?.weight??1,fill:e.fill!=null?W.resolve(e.fill):t?.fill??W.resolve("transparent"),dash:r,dashOffset:e.dashOffset??t?.dashOffset??0,align:Cu(e.align,t?.align??-1),cap:n,startCap:e.startCap!=null?Qo(e.startCap,n):t?.startCap,endCap:e.endCap!=null?Qo(e.endCap,n):t?.endCap,join:Pu(e.join,t?.join??"miter"),miterLimit:e.miterLimit??t?.miterLimit??4}}function qy(e,t,r){let n=e||[],o=t||[];if(n.length===0&&o.length===0)return e;let s=Math.max(n.length,o.length),i=new Array(s);for(let a=0;a<s;a++){let l=n[a]??0,c=o[a]??0;i[a]=l+(c-l)*r}return i}function Wy(e,t,r){return{weight:e.weight+(t.weight-e.weight)*r,fill:W.lerp(e.fill,t.fill,r),dash:qy(e.dash,t.dash,r),dashOffset:e.dashOffset+(t.dashOffset-e.dashOffset)*r,align:e.align+(t.align-e.align)*r,cap:r<.5?e.cap:t.cap,startCap:r<.5?e.startCap:t.startCap,endCap:r<.5?e.endCap:t.endCap,join:r<.5?e.join:t.join,miterLimit:e.miterLimit+(t.miterLimit-e.miterLimit)*r}}var at={resolve:(e,t)=>e==null?[]:(Array.isArray(e)?e:[e]).map((n,o)=>Tu(n,t?.[o])),lerp:(e,t,r)=>{if(e===t)return e;let n=Math.max(e.length,t.length),o=[];for(let s=0;s<n;s++){let i=e[s],a=t[s];if(!i){o.push(a);continue}if(!a){o.push(i);continue}o.push(Wy(i,a,r))}return o}};var Du="quad",_a=Math.PI,wa=e=>e===void 0?{type:Du}:typeof e=="string"?{type:e}:{...e,type:e.type??Du},ts={sine:e=>1-Math.cos(e*_a/2),quad:e=>e*e,cubic:e=>e*e*e,quart:e=>e*e*e*e,quint:e=>e*e*e*e*e,expo:e=>e===0?0:Math.pow(2,10*(e-1)),circ:e=>1-Math.sqrt(1-e*e),back:(e,t)=>{let r=t.overshoot??1.70158;return e*e*((r+1)*e-r)},elastic:(e,t)=>{if(e===0||e===1)return e;let r=t.amplitude??1,n=t.period??.3,o=n/(2*_a)*Math.asin(1/r);return-(r*Math.pow(2,10*(e-1))*Math.sin((e-1-o)*2*_a/n))},bounce:e=>1-(r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375)(1-e)},es=()=>e=>ce(e),Ru=e=>{let t=wa(e);return r=>ts[t.type](ce(r),t)},Fu=e=>{let t=wa(e);return r=>1-ts[t.type](1-ce(r),t)},Iu=e=>{let t=wa(e),r=t.type==="back"?{...t,overshoot:(t.overshoot??1.70158)*1.525}:t.type==="elastic"?{...t,period:t.period??.45}:t;return n=>(n=ce(n),n<.5?ts[r.type](2*n,r)/2:1-ts[r.type](2*(1-n),r)/2)};var va=es(),Ye=class e{segments;constructor(t=[]){this.segments=t}ramp(t,r,n,o){return new e([...this.segments,{from:t,to:r,duration:n,ease:o?.ease}])}hold(t){return new e([...this.segments,{duration:t}])}fadeIn(t,r){return new e([...this.segments,{from:0,to:1,duration:t,ease:r?.ease}])}fadeOut(t,r){return new e([...this.segments,{to:0,duration:t,ease:r?.ease}])}resolve(t,r){let n=this.segments;if(n.length===0)return[];let o=Number.isFinite(t)&&t>0?t:0,s=0,i=0;for(let f of n)f.duration===void 0?i++:s+=Math.max(0,f.duration);i>1,s>o;let a=Math.max(0,o-s),l=i>0?n.findIndex(f=>f.duration===void 0):a>0?n.length-1:-1,c=[],d=0,u=r;for(let f=0;f<n.length;f++){let h=n[f];if(i===0&&f===l&&a>0){let b=Math.min(d,o),k=Math.min(d+a,o);c.push({startTime:b,endTime:k,from:u,to:u,ease:va,isLinear:!0}),d+=a}let y;h.duration===void 0?y=f===l?a:0:y=Math.max(0,h.duration);let w=h.from??u,g=h.to??w,x=Math.min(d,o),_=Math.min(d+y,o),S=h.ease??va;c.push({startTime:x,endTime:_,from:w,to:g,ease:S,isLinear:S===va}),d+=y,u=g}return c}sampleAt(t,r,n){let o=this.resolve(r,n);if(o.length===0)return n;if(t<=o[0].startTime)return o[0].from;for(let s of o)if(t>=s.startTime&&t<=s.endTime){let i=s.endTime-s.startTime,a=i>0?(t-s.startTime)/i:1;return m(s.from,s.to,s.ease(a))}return o[o.length-1].to}staticValue(t){return this.segments[0]?.from??t}};function Gy(e,t,r,n){return new Ye().ramp(e,t,r,n)}function Yy(e){return new Ye().hold(e)}function Vy(e,t){return new Ye().fadeIn(e,t)}function Ky(e,t){return new Ye().fadeOut(e,t)}function Ve(e){return e instanceof Ye}function Sa(e,t=0){return Ve(e)?e.staticValue(t):e}function Ut(e){return e===void 0?"_":Ve(e)?"c["+e.segments.map(t=>`${t.from??"_"},${t.to??"_"},${t.duration??"_"},${t.ease?.name??"lin"}`).join(";")+"]":String(e)}function lt(e,t,r){return typeof e=="number"&&typeof t=="number"?m(e,t,r):r<.5?e:t}var ba={resolve:e=>e,lerp:lt};function ft(e,t){return e===t?!0:typeof e=="number"&&typeof t=="number"?e===t:!1}var zu=.001;function ka(e,t,r=t,n=zu){let o=Math.min(r,t);if(o<=0)return 0;let s=0;for(let i=0;i<o;i+=n){let a=Math.min(n,o-i),l=Math.max(1e-6,e.sampleAt(i+a/2,t,1));s+=a/l}return s}function Hy(e,t,r,n=zu){if(r<=0)return 0;let o=0,s=0;for(;s<t;){let i=Math.min(n,t-s),a=Math.max(1e-6,e.sampleAt(s+i/2,t,1)),l=i/a;if(o+l>=r){let c=l>0?(r-o)/l:0;return s+i*c}o+=l,s+=i}return t}function Xr(e,t){return typeof e=="number"||Ve(e)?{[t]:e}:e}var Ln=class e{list;constructor(t=[]){this.list=t}append(t){return new e([...this.list,t])}gain(t){let{value:r}=Xr(t,"value");return this.append({type:"gain",value:r})}volume(t){return this.gain(t)}highpass(t){let{frequency:r,q:n}=Xr(t,"frequency");return this.append({type:"highpass",frequency:r,q:n})}lowpass(t){let{frequency:r,q:n}=Xr(t,"frequency");return this.append({type:"lowpass",frequency:r,q:n})}tremolo(t){let{rate:r,depth:n}=Xr(t,"rate");return this.append({type:"tremolo",rate:r,depth:n??.5})}speed(t){let{value:r}=Xr(t,"value");return this.append({type:"speed",value:r})}echo(t){let{delay:r,feedback:n,mix:o}=Xr(t,"delay");return this.append({type:"echo",delay:r,feedback:n??.4,mix:o})}*[Symbol.iterator](){yield*this.list}toJSON(){return this.list}},Zr=new Ln;function fe(e){return e===void 0?[]:e instanceof Ln?e.list:Array.isArray(e)?e:[e]}function Ma(e){let t=1;for(let r of e)r.type==="speed"&&!Ve(r.value)&&r.value>0&&(t*=r.value);return t}function rs(e,t){let r=Ma(e);for(let n of e)if(n.type==="speed"&&Ve(n.value))return ka(n.value,t)/r;return t/r}function Nu(e,t,r,n){let o=e.at??0,s=e.until??1/0,i=e.trimStart??0,a=e.trimEnd??1/0,l=e.loop??!1,c=fe(e.filters),d=t.getMediaDuration(e.src),u={id:`${r}|${e.src}|${o}|${n}`,src:e.src,startAt:o,endAt:1/0,trimStart:i,volume:e.volume??1,loop:l,ownerId:r};if(c.length>0&&(u.filters=c),e.bus&&(u.bus=e.bus),l&&Number.isFinite(s))u.endAt=s;else if(Number.isFinite(a))u.endAt=Math.min(s,o+rs(c,Math.max(0,a-i)));else if(l)u.open=!0;else{let f=rs(c,Math.max(0,d-i));Number.isFinite(s)?u.endAt=Math.min(s,o+f):(u.open=!0,u.mediaDuration=f)}return u}var Aa=class{src;volume;loop;trimStart;trimEnd;filters;constructor(t){this.src=t.src,this.volume=t.volume??1,this.loop=t.loop??!1,this.trimStart=t.trimStart??0,this.trimEnd=t.trimEnd??t.duration??1/0,this.filters=fe(t.filters)}effectiveSpeed(){return Ma(this.filters)}sceneDurationFor(t){return rs(this.filters,t)}get clipDuration(){return this.trimEnd!==1/0?this.sceneDurationFor(this.trimEnd-this.trimStart):void 0}};function qn(e){return!e||e.length===0?"":e.map(t=>{switch(t.type){case"gain":case"speed":return`${t.type}:${Ut(t.value)}`;case"highpass":case"lowpass":return`${t.type}:${Ut(t.frequency)}:${Ut(t.q)}`;case"tremolo":return`tremolo:${Ut(t.rate)}:${Ut(t.depth)}`;case"echo":return`echo:${Ut(t.delay)}:${Ut(t.feedback)}:${Ut(t.mix)}`}}).join("|")}function Oa(e){return`${e.id}:${Ut(e.volume)}:${Ut(e.pan)}:${e.mute?1:0}:${qn(e.filters)}:${e.startAt}:${e.endAt}`}var $u={lerp:(e,t,r)=>({type:"gain",value:lt(e.value,t.value,r)}),equals:(e,t)=>ft(e.value,t.value)};var ju={lerp:(e,t,r)=>({type:"highpass",frequency:lt(e.frequency,t.frequency,r),q:lt(e.q??1,t.q??1,r)}),equals:(e,t)=>ft(e.frequency,t.frequency)&&ft(e.q??1,t.q??1)};var Bu={lerp:(e,t,r)=>({type:"lowpass",frequency:lt(e.frequency,t.frequency,r),q:lt(e.q??1,t.q??1,r)}),equals:(e,t)=>ft(e.frequency,t.frequency)&&ft(e.q??1,t.q??1)};var Lu={lerp:(e,t,r)=>({type:"tremolo",rate:lt(e.rate,t.rate,r),depth:lt(e.depth,t.depth,r)}),equals:(e,t)=>ft(e.rate,t.rate)&&ft(e.depth,t.depth)};var qu={lerp:(e,t,r)=>({type:"speed",value:lt(e.value,t.value,r)}),equals:(e,t)=>ft(e.value,t.value)};var Wu={lerp:(e,t,r)=>({type:"echo",delay:lt(e.delay,t.delay,r),feedback:lt(e.feedback,t.feedback,r),mix:lt(e.mix??.5,t.mix??.5,r)}),equals:(e,t)=>ft(e.delay,t.delay)&&ft(e.feedback,t.feedback)&&ft(e.mix??.5,t.mix??.5)};var Xy={gain:$u,highpass:ju,lowpass:Bu,tremolo:Lu,speed:qu,echo:Wu},ns=class e{static registry=new Map(Object.entries(Xy));static register(t,r){if(this.registry.has(t))throw new Error(`Audio filter "${t}" is already registered`);this.registry.set(t,r)}static get(t){return this.registry.get(t)}static has(t){return this.registry.has(t)}static lerp(t,r,n){if(t.type!==r.type)return n<.5?t:r;let o=this.registry.get(t.type);return o?o.lerp(t,r,n):n<.5?t:r}static lerpArray(t,r,n){let o=Math.max(t.length,r.length),s=[];for(let i=0;i<o;i++){let a=t[i],l=r[i];a&&l?s.push(e.lerp(a,l,n)):a?s.push(a):l&&s.push(l)}return s}},os={resolve:fe,lerp:ns.lerpArray};function _r(e){return(e.g??0)!==0||(e.h??0)!==0||(e.i??1)!==1}var ss=1e-6;function Zy(e){return e>ss||e<-ss?e:e<0?-ss:ss}function Ea(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function Wn(e,t){return{a:1,b:0,c:0,d:1,e,f:t}}function gt(e,t){return _r(e)||_r(t)?Jy(e,t):{a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,e:e.a*t.e+e.c*t.f+e.e,f:e.b*t.e+e.d*t.f+e.f}}function Jy(e,t){let r=e.g??0,n=e.h??0,o=e.i??1,s=t.g??0,i=t.h??0,a=t.i??1;return{a:e.a*t.a+e.c*t.b+e.e*s,c:e.a*t.c+e.c*t.d+e.e*i,e:e.a*t.e+e.c*t.f+e.e*a,b:e.b*t.a+e.d*t.b+e.f*s,d:e.b*t.c+e.d*t.d+e.f*i,f:e.b*t.e+e.d*t.f+e.f*a,g:r*t.a+n*t.b+o*s,h:r*t.c+n*t.d+o*i,i:r*t.e+n*t.f+o*a}}function Mt(e,t){let r=e.a*t.x+e.c*t.y+e.e,n=e.b*t.x+e.d*t.y+e.f;if(!_r(e))return{x:r,y:n};let o=Zy((e.g??0)*t.x+(e.h??0)*t.y+(e.i??1));return{x:r/o,y:n/o}}function pe(e){if(_r(e))return Qy(e);let t=e.a*e.d-e.b*e.c;if(t===0||!Number.isFinite(t))return null;let r=1/t;return{a:e.d*r,b:-e.b*r,c:-e.c*r,d:e.a*r,e:(e.c*e.f-e.d*e.e)*r,f:(e.b*e.e-e.a*e.f)*r}}function Qy(e){let{a:t,b:r,c:n,d:o,e:s,f:i}=e,a=e.g??0,l=e.h??0,c=e.i??1,d=o*c-i*l,u=i*a-r*c,f=r*l-o*a,h=t*d+n*u+s*f;if(h===0||!Number.isFinite(h))return null;let y=1/h;return{a:d*y,c:(s*l-n*c)*y,e:(n*i-s*o)*y,b:u*y,d:(t*c-s*a)*y,f:(s*r-t*i)*y,g:f*y,h:(n*a-t*l)*y,i:(t*o-n*r)*y}}function Ca(e,t,r,n,o){let s=-o*Math.PI/180,i=Math.cos(s),a=Math.sin(s),l=n*i,c=n*a,d=n*-a,u=n*i,f=-r.x,h=r.y;return{a:l,b:c,c:d,d:u,e:e+l*f+d*h,f:t+c*f+u*h}}function Gu(e,t,r,n,o,s){let i=r*Math.PI/180,a=Math.cos(i),l=Math.sin(i),c=n*a,d=n*l,u=n*-l,f=n*a;return{a:c,b:d,c:u,d:f,e:e+o-(c*o+u*s),f:t+s-(d*o+f*s)}}var wr={rotationX:0,rotationY:0,rotationZ:0,depth:0,perspective:0,flipHorizontal:!1,flipVertical:!1};function is(e){return e.rotationX!==0||e.rotationY!==0||e.rotationZ!==0||e.flipHorizontal||e.flipVertical||e.perspective!==0&&e.depth!==0}function Pa(e,t){let r=Math.PI/180;return Math.cos(e*r)*Math.cos(t*r)<0}function Ta(e,t,r,n,o,s,i){if(!is(i))return Gu(e,t,r,n,o,s);let a=Math.PI/180,l=Math.cos(i.rotationX*a),c=Math.sin(i.rotationX*a),d=Math.cos(i.rotationY*a),u=Math.sin(i.rotationY*a),f=(r+i.rotationZ)*a,h=Math.cos(f),y=Math.sin(f),w=d*h*n,g=-d*y*n,x=(c*u*h+l*y)*n,_=(l*h-c*u*y)*n,S=(c*y-l*u*h)*n,b=(l*u*y+c*h)*n,k=i.perspective!==0?1/i.perspective:0,M=-S*k,R=-b*k,et=1-(i.depth-(S*o+b*s))*k,V=e+o,Ct=t+s,Yt=i.flipHorizontal?-1:1,Br=i.flipVertical?-1:1;return{a:(w+V*M)*Yt,c:(g+V*R)*Br,e:-(w*o+g*s)+V*et,b:(x+Ct*M)*Yt,d:(_+Ct*R)*Br,f:-(x*o+_*s)+Ct*et,g:M*Yt,h:R*Br,i:et}}function Jr(e,t,r){let n={x:m(e.x,t.x,r),y:m(e.y,t.y,r)};return(e.z!==void 0||t.z!==void 0)&&(n.z=m(e.z??0,t.z??0,r)),n}function vr(e,t){let r=new Array(12);for(let n=0;n<3;n++){let o=e[n*4],s=e[n*4+1],i=e[n*4+2],a=e[n*4+3];r[n*4]=o*t[0]+s*t[4]+i*t[8],r[n*4+1]=o*t[1]+s*t[5]+i*t[9],r[n*4+2]=o*t[2]+s*t[6]+i*t[10],r[n*4+3]=o*t[3]+s*t[7]+i*t[11]+a}return r}function cs(e,t,r,n,o,s,i){let a=Math.PI/180,l=Math.cos(i.rotationX*a),c=Math.sin(i.rotationX*a),d=Math.cos(i.rotationY*a),u=Math.sin(i.rotationY*a),f=(r+i.rotationZ)*a,h=Math.cos(f),y=Math.sin(f),w=d*h*n,g=-d*y*n,x=u*n,_=(c*u*h+l*y)*n,S=(l*h-c*u*y)*n,b=-c*d*n,k=(c*y-l*u*h)*n,M=(l*u*y+c*h)*n,R=l*d*n,et=i.flipHorizontal?-1:1,V=i.flipVertical?-1:1;return[w*et,g*V,x,e+o-(w*o+g*s),_*et,S*V,b,t+s-(_*o+S*s),k*et,M*V,R,i.depth-(k*o+M*s)]}function as(e){let t=Math.PI/180,r=Math.sin(e.orbit*t),n=Math.cos(e.orbit*t),o=Math.sin(e.elevation*t),s=Math.cos(e.elevation*t),i=n,a=0,l=-r,c=r*o,d=s,u=n*o,f=r*s,h=-o,y=n*s,w=e.lookAt.x,g=-e.lookAt.y,x=e.lookAt.z??0;return[i,a,l,-(i*w+a*g+l*x),c,d,u,-(c*w+d*g+u*x),f,h,y,-(f*w+h*g+y*x)+e.dolly]}function Yn(e,t){let r=e.perspective>0?1/e.perspective:0,n=-t[8]*r,o=-t[9]*r,s=1-t[11]*r,i=-e.heading*Math.PI/180,a=e.zoom,l=a*Math.cos(i),c=-a*Math.sin(i),d=a*Math.sin(i),u=a*Math.cos(i),f=e.viewportX,h=e.viewportY,y={a:l*t[0]+c*t[4]+f*n,c:l*t[1]+c*t[5]+f*o,e:l*t[3]+c*t[7]+f*s,b:d*t[0]+u*t[4]+h*n,d:d*t[1]+u*t[5]+h*o,f:d*t[3]+u*t[7]+h*s};return r!==0&&(y.g=n,y.h=o,y.i=s),y}function Ra(e,t){let r=t.width/2,n=t.height/2,o=[t.x-r,t.x+r,t.x+r,t.x-r],s=[t.y-n,t.y-n,t.y+n,t.y+n],i=new Array(12);for(let l=0;l<4;l++){let c=o[l],d=s[l];i[l*3]=e[0]*c+e[1]*d+e[3],i[l*3+1]=e[4]*c+e[5]*d+e[7],i[l*3+2]=e[8]*c+e[9]*d+e[11]}let a=Math.hypot(e[2],e[6],e[10])||1;return{corners:i,cx:e[0]*t.x+e[1]*t.y+e[3],cy:e[4]*t.x+e[5]*t.y+e[7],cz:e[8]*t.x+e[9]*t.y+e[11],nx:e[2]/a,ny:e[6]/a,nz:e[10]/a}}var Fa=.01,Yu=.001;function ls(e,t){if(e.perspective>0){let r=-t.cx,n=-t.cy,o=e.perspective-t.cz,s=t.nx*r+t.ny*n+t.nz*o;return{side:s,edgeOn:Math.abs(s)<=Yu*Math.hypot(r,n,o)}}return{side:t.nz,edgeOn:Math.abs(t.nz)<=Yu}}function Hu(e,t){if(e.perspective<=0)return"all";let r=0;for(let n=0;n<4;n++)1-t.corners[n*3+2]/e.perspective>Fa&&r++;return r===4?"all":r===0?"none":"some"}function Uu(e,t,r){let n=e.g??0,o=e.h??0,s=e.i??1,i=t.width/2+r,a=t.height/2+r,l=[{x:t.x-i,y:t.y-a},{x:t.x+i,y:t.y-a},{x:t.x+i,y:t.y+a},{x:t.x-i,y:t.y+a}],c=u=>n*u.x+o*u.y+s-Fa,d=[];for(let u=0;u<l.length;u++){let f=l[u],h=l[(u+1)%l.length],y=c(f),w=c(h);if(y>=0&&d.push(f),y>=0!=w>=0){let g=y/(y-w);d.push({x:f.x+(h.x-f.x)*g,y:f.y+(h.y-f.y)*g})}}return d.length>=3?d:null}var Da=.01;function Vu(e,t,r){let n=0,o=0;for(let i=0;i<4;i++){let a=e.nx*(t.corners[i*3]-e.cx)+e.ny*(t.corners[i*3+1]-e.cy)+e.nz*(t.corners[i*3+2]-e.cz);a>Da?n++:a<-Da&&o++}if(n===0&&o===0)return 0;let s=r>0?1:-1;return o===0?s:n===0?-s:0}function Gn(e,t){return e.perspective>0?t.cx*t.cx+t.cy*t.cy+(e.perspective-t.cz)**2:-t.cz}function tg(e,t,r){let n=ls(e,t);if(!n.edgeOn){let a=Vu(t,r,n.side);if(a!==0)return a>0?-1:1;if(eg(t,r))return 0}let o=ls(e,r);if(!o.edgeOn){let a=Vu(r,t,o.side);if(a!==0)return a>0?1:-1}let s=Gn(e,t),i=Gn(e,r);return s===i?0:s>i?-1:1}function eg(e,t){for(let r=0;r<4;r++){let n=e.nx*(t.corners[r*3]-e.cx)+e.ny*(t.corners[r*3+1]-e.cy)+e.nz*(t.corners[r*3+2]-e.cz);if(Math.abs(n)>Da)return!1}return!0}function Ku(e){return{...e,viewportX:0,viewportY:0}}var rg={lerpLookAt:Jr,project(e,t){let r=Ku(e),n=as(r),o=t.x,s=-t.y,i=t.z??0,a=n[0]*o+n[1]*s+n[2]*i+n[3],l=n[4]*o+n[5]*s+n[6]*i+n[7],c=n[8]*o+n[9]*s+n[10]*i+n[11],d=r.perspective>0?1-c/r.perspective:1;if(d<=Fa)return null;let u=-r.heading*Math.PI/180,f=r.zoom*a/d,h=r.zoom*l/d;return{x:Math.cos(u)*f-Math.sin(u)*h,y:-(Math.sin(u)*f+Math.cos(u)*h)}},focusVector(e,t){let r=Ku(e),n=-r.heading*Math.PI/180,o=r.zoom||1,s=t.x,i=-t.y,a=(Math.cos(n)*s+Math.sin(n)*i)/o,l=(-Math.sin(n)*s+Math.cos(n)*i)/o,c=r.perspective>0?1-r.dolly/r.perspective:1,d=as(r),u=a*c,f=l*c;return{x:u*d[0]+f*d[4],y:-(u*d[1]+f*d[5]),z:u*d[2]+f*d[6]}}},ng=96;function Xu(e,t){let r=t.length;if(r>ng)return t.map((a,l)=>l).sort((a,l)=>Gn(e,t[l])-Gn(e,t[a])||a-l);let n=Array.from({length:r},()=>[]),o=new Array(r).fill(0);for(let a=0;a<r;a++)for(let l=a+1;l<r;l++){let c=tg(e,t[a],t[l]);c<0?(n[a].push(l),o[l]++):c>0&&(n[l].push(a),o[a]++)}let s=[],i=new Array(r).fill(!1);for(;s.length<r;){let a=-1;for(let l=0;l<r;l++)if(!i[l]&&o[l]===0){a=l;break}if(a===-1){let l=-1/0;for(let c=0;c<r;c++){if(i[c])continue;let d=Gn(e,t[c]);d>l&&(l=d,a=c)}}i[a]=!0,s.push(a);for(let l of n[a])o[l]--}return s}var ds={resolve:e=>e,lerp:(e,t,r)=>({width:m(e.width,t.width,r),height:m(e.height,t.height,r)}),expand:e=>{e.size!==void 0&&(e.width===void 0&&(e.width=e.size),e.height===void 0&&(e.height=e.size))}},ct={resolve:e=>e,lerp:(e,t,r)=>typeof e=="number"&&typeof t=="number"?m(e,t,r):r===1?t:e,resolveLayout:(e,t,r)=>typeof e=="number"?e:e==="fill"?t:e==="hug"?r:t,isAuto:e=>typeof e!="number"};var us=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","lineHeight","textAlign","fill","stroke","shadow"],fs=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","lineHeight","textAlign"],Ke=Object.freeze({}),ot={resolve:e=>e,lerp:og,preset:sg,mergeStyle:Zu,resolveStyle:ig,lerpStyle:ag,styleProps:lg,flatten:cg,applyCase:ug};function og(e,t,r){if(r<=0)return e;if(r>=1)return t;let n=0,o=Math.min(e.length,t.length);for(;n<o&&e.charCodeAt(n)===t.charCodeAt(n);)n++;let s=0,i=Math.min(e.length-n,t.length-n);for(;s<i&&e.charCodeAt(e.length-1-s)===t.charCodeAt(t.length-1-s);)s++;let a=e.length-n-s,l=t.length-n-s,c=a+l;if(c===0)return t;let d=e.substring(0,n),u=e.substring(e.length-s),f=a/c;if(r<f){let w=f===0?1:r/f,g=Math.round(a*(1-w));return d+e.substring(n,n+g)+u}let h=f===1?1:(r-f)/(1-f),y=Math.round(l*h);return d+t.substring(n,n+y)+u}function sg(e){return Hi(e)??Ke}function Zu(e,t){let r=null;for(let n of us){let o=t?.[n];o!==void 0&&((r??={...e})[n]=o)}return r??e}function ig(e,t){let r=e??{};return{fontFamily:r.fontFamily??t.fontFamily,fontSize:r.fontSize??t.fontSize,fontWeight:r.fontWeight??t.fontWeight,fontStyle:r.fontStyle??t.fontStyle,letterSpacing:r.letterSpacing??t.letterSpacing,lineHeight:r.lineHeight??t.lineHeight,textAlign:r.textAlign??t.textAlign,fill:W.resolve(r.fill??t.fill??[]),stroke:at.resolve(r.stroke??t.stroke??[]),shadow:ue.resolve(r.shadow??t.shadow??[])}}function ag(e,t,r){return{fontFamily:r<.5?e.fontFamily:t.fontFamily,fontSize:fg(e.fontSize,t.fontSize,r),fontWeight:Ia(e.fontWeight,t.fontWeight,r),fontStyle:r<.5?e.fontStyle:t.fontStyle,letterSpacing:Ia(e.letterSpacing,t.letterSpacing,r),lineHeight:Ia(e.lineHeight,t.lineHeight,r),textAlign:r<.5?e.textAlign:t.textAlign,fill:W.lerp(e.fill,t.fill,r),stroke:at.lerp(e.stroke,t.stroke,r),shadow:ue.lerp(e.shadow,t.shadow,r)}}function lg(e){return Zu({},e)}function cg(e,t){let r=[],n=(o,s)=>{let i={fontFamily:o.fontFamily??s.fontFamily,fontSize:o.fontSize??s.fontSize,fontWeight:o.fontWeight??s.fontWeight,fontStyle:o.fontStyle??s.fontStyle,letterSpacing:o.letterSpacing??s.letterSpacing,fill:o.fill!=null?W.resolve(o.fill):s.fill,stroke:o.stroke!=null?at.resolve(o.stroke):s.stroke};o.text&&r.push({text:o.text,...i});for(let a of o.children??[])n(a,i)};for(let o of e)n(o,t);return r}var dg=/[\p{L}\p{N}'\u2019]/u;function ug(e,t){if(t!=="upper"&&t!=="lower"&&t!=="title")return e;let r="",n="";for(let o of e){let s=t==="upper"||t==="title"&&!dg.test(n),i=t==="lower"?o.toLowerCase():s?o.toUpperCase():o;r+=i.length===o.length?i:o,n=o}return r}function fg(e,t,r){return typeof e=="number"&&typeof t=="number"?m(e,t,r):r<.5?e:t}function Ia(e,t,r){return e==null||t==null?r<.5?e:t:m(e,t,r)}var ps=Symbol("propertyMeta");function Vn(e){return za(e,ps)}function za(e,t){let r=[],n=Object.getPrototypeOf(e);for(;n&&n!==Object.prototype;)r.unshift(n),n=Object.getPrototypeOf(n);let o=[],s=new Map;for(let i of r)if(Object.prototype.hasOwnProperty.call(i,t))for(let a of i[t]){let l=s.get(a.key);l===void 0?(s.set(a.key,o.length),o.push(a)):o[l]=a}return o}function p(e){return function(t,r){let n=r,{default:o,mapper:s,tween:i,...a}=e??{},l={key:n,default:o,options:s!=null||i!=null?{mapper:s,tween:i}:void 0,...Object.keys(a).length>0?{editor:a}:{}};Object.prototype.hasOwnProperty.call(t,ps)||(t[ps]=[]);let c=t[ps];c.some(d=>d.key===n)||c.push(l)}}function he(e,t,r){if(e.measure){let n=e.measure(t,r);return{width:n.width??0,height:n.height??0}}return{width:Ju(e.width,t.maxWidth),height:Ju(e.height,t.maxHeight)}}function Ju(e,t){return typeof e=="number"?e:e==="fill"?t??0:0}function tf(e,t,r,n,o){let s=t?"width":"height",i=t?"height":"width",a=(t?n.hugWidth:n.hugHeight)===!0,l=(t?n.hugHeight:n.hugWidth)===!0,c={maxWidth:n.width,maxHeight:n.height},d=e.length,u=new Array(d),f=e.map(k=>hg(k.gapScale)),h=r==="auto"?0:r*Math.max(0,f.reduce((k,M)=>k+M,0)-1),y=0,w=0;for(let k=0;k<d;k++)e[k][s]==="fill"||l&&e[k][i]==="fill"||(u[k]=he(e[k],c,o),y+=u[k][s],u[k][i]>w&&(w=u[k][i]));let g=l?w:n[i];if(l)for(let k=0;k<d;k++){if(e[k][s]==="fill"||e[k][i]!=="fill")continue;let M=he(e[k],c,o);u[k]=nf(M,g,t),y+=M[s]}let x=Math.max(0,n[s]-h-y),_=0;for(let k of e)k[s]==="fill"&&(_+=Qu(k.flex));for(let k=0;k<d;k++){let M=e[k];if(M[s]!=="fill")continue;let R,et;a?(et=he(M,t?{maxWidth:1/0,maxHeight:n.height}:{maxWidth:n.width,maxHeight:1/0},o),R=Number.isFinite(et[s])?et[s]:0):(R=_>0?x*Qu(M.flex)/_:0,et=he(M,t?{maxWidth:R,maxHeight:n.height}:{maxWidth:n.width,maxHeight:R},o));let V=M[i]==="fill"?g:et[i];u[k]=t?{width:R,height:V}:{width:V,height:R}}let S=h,b=0;for(let k of u)S+=k[s],k[i]>b&&(b=k[i]);return{sizes:u,lines:d>0?[{start:0,end:d,cross:b}]:[],gapScales:f,hug:t?{width:S,height:b}:{width:b,height:S}}}function ef(e,t,r,n,o,s){let i=t?"width":"height",a=t?"height":"width",c=(t?o.hugWidth:o.hugHeight)===!0?1/0:o[i],d=r==="auto"?0:r,u={maxWidth:o.width,maxHeight:o.height},f=e.map(x=>he(x,u,s)),h=[],y=0,w=0,g=0;for(;g<f.length;){let x=g+1,_=f[g][i];for(;x<f.length&&_+d+f[x][i]<=c;)_+=d+f[x][i],x++;let S=0;for(let b=g;b<x;b++)e[b][a]!=="fill"&&f[b][a]>S&&(S=f[b][a]);for(let b=g;b<x;b++)e[b][a]==="fill"&&(f[b]=nf(f[b],S,t));h.push({start:g,end:x,cross:S}),_>y&&(y=_),w+=S,g=x}return w+=n*Math.max(0,h.length-1),{sizes:f,lines:h,gapScales:f.map(()=>1),hug:t?{width:y,height:w}:{width:w,height:y}}}function rf(e,t,r,n,o,s,i,a){let l=n?"width":"height",c=n?"height":"width",d=n?(1+i.x)/2:(1-i.y)/2,u=n?(1-i.y)/2:(1+i.x)/2,f=s*Math.max(0,t.length-1);for(let w of t)f+=w.cross;let h=u*(a[c]-f),y=new Array(e.length);for(let w of t){let g=w.end-w.start,x=0,_=0;for(let M=w.start;M<w.end;M++)x+=e[M][l],_+=r[M];let S,b=0;if(o==="auto"){let M=g>1?Math.max(0,a[l]-x)/(g-1):0;S=()=>M,x+=M*(g-1)}else{let M=R=>R<w.end?r[R]:1;S=R=>o*(r[R]+M(R+1))/2,x+=o*Math.max(0,_-1),b=o*(1-r[w.start])/2}let k=d*(a[l]-x)-b;for(let M=w.start;M<w.end;M++){let R=e[M],et=h+u*(w.cross-R[c]);y[M]=pg(n?k:et,n?et:k,R,a),k+=R[l]+S(M)}h+=w.cross+s}return y}function pg(e,t,r,n){return{x:e+r.width/2-n.width/2,y:n.height/2-t-r.height/2,width:r.width,height:r.height}}function nf(e,t,r){return r?{width:e.width,height:t}:{width:t,height:e.height}}function Qu(e){return e==null?1:Number.isFinite(e)&&e>=0?e:1}function hg(e){return e==null?1:Number.isFinite(e)?yc(e,0,1):1}function of(e,t,r){let n={maxWidth:t.width,maxHeight:t.height},o=[],s={width:0,height:0};for(let i of e){let a=he(i,n,r);o.push(a),a.width>s.width&&(s.width=a.width),a.height>s.height&&(s.height=a.height)}return{sizes:o,hug:s}}function sf(e,t,r){return e.map(n=>({x:r.x*Math.max(0,t.width-n.width)/2,y:r.y*Math.max(0,t.height-n.height)/2,width:n.width,height:n.height}))}function af(e,t,r,n,o,s){let i=Math.max(1,Math.round(t)),a=Math.max(0,(o.width-r*(i-1))/i),l=mg(e,i),c=l.reduce((_,S)=>Math.max(_,S.row+S.rowSpan),0),d=o.hugHeight!==!0&&c>0,u=d?Math.max(0,(o.height-n*(c-1))/c):0,f=new Array(c).fill(u),h=e.map((_,S)=>{let b=l[S],k=Na(a,b.colSpan,r),M=d?{maxWidth:k,maxHeight:Na(u,b.rowSpan,n)}:{maxWidth:k},R=he(_,M,s);return d||yg(f,b.row,b.rowSpan,R.height,n),R}),y=[],w=0;for(let _ of f)y.push(w),w+=_+n;let g=l.map(_=>({x:_.col*(a+r),y:y[_.row]??0,width:Na(a,_.colSpan,r),height:cf(f,_.row,_.rowSpan,n)})),x=f.reduce((_,S)=>_+S,0)+n*Math.max(0,c-1);return{sizes:h,cells:g,hug:{width:o.width,height:x}}}function lf(e,t){return e.map(r=>({x:r.x+r.width/2-t.width/2,y:t.height/2-r.y-r.height/2,width:Math.min(r.width,t.width),height:Math.min(r.height,t.height)}))}function mg(e,t){let r=[],n=[],o=(l,c,d,u)=>{for(let f=0;f<u;f++)for(let h=0;h<d;h++)if(n[l+f]?.[c+h])return!1;return!0},s=(l,c,d,u)=>{for(let f=0;f<u;f++){n[l+f]??=[];for(let h=0;h<d;h++)n[l+f][c+h]=!0}},i=0,a=0;for(let l of e){let c=Math.min(l.colSpan??1,t),d=l.rowSpan??1;if(l.column!==void 0&&l.row!==void 0){s(l.row-1,l.column-1,c,d),r.push({col:l.column-1,row:l.row-1,colSpan:c,rowSpan:d});continue}for(;a+c>t&&(i++,a=0),!o(i,a,c,d);)a++;s(i,a,c,d),r.push({col:a,row:i,colSpan:c,rowSpan:d}),a+=c}return r}function yg(e,t,r,n,o){if(r===1){n>e[t]&&(e[t]=n);return}let s=n-cf(e,t,r,o);s>0&&(e[t]+=s)}function Na(e,t,r){return e*t+r*(t-1)}function cf(e,t,r,n){let o=n*(r-1);for(let s=t;s<t+r;s++)o+=e[s]??0;return o}var gg={x:0,y:0};function xg(e,t,r,n){let o=Tt.insetBounds(r.width,r.height,Tt.resolve(e.padding??0));return hf(pf(e,t,o,n),e,o).map(i=>({x:i.x+o.x,y:i.y-o.y,width:i.width,height:i.height}))}function pf(e,t,r,n){let o=e.flow??"freeform";if(typeof o=="string")return $a(o,e,t,r,n);let s=$a(o.from,e,t,r,n),i=$a(o.to,e,t,r,n);return{...i,hug:Mg(s.hug,i.hug,o.t),from:s,t:o.t}}function hf(e,t,r){let n=df(e,t,r),o=e.from;if(!o)return n;let s=df(o,t,r),i=e.t??1;return n.map((a,l)=>({x:m(s[l].x,a.x,i),y:m(s[l].y,a.y,i),width:m(s[l].width,a.width,i),height:m(s[l].height,a.height,i)}))}function _g(e,t){let{space:r,hug:n}=e;return uf(t.width,r.width,r.hugWidth,n.width)&&uf(t.height,r.height,r.hugHeight,n.height)}function wg(e,t,r){let n=hs(e.width,t.maxWidth),o=hs(e.height,t.maxHeight),s=Tt.insetBounds(n,o,r);return{width:s.width,height:s.height,hugWidth:e.width==="hug",hugHeight:e.height==="hug"}}function vg(e,t,r,n){let o=Tt.outsetSize(n.width,n.height,r);return{width:e.width==="hug"?o.width:hs(e.width,t.maxWidth),height:e.height==="hug"?o.height:hs(e.height,t.maxHeight)}}function Sg(e,t){if(e.mode!=="horizontal"&&e.mode!=="vertical"||(e.mode==="horizontal"?t.width:t.height)>0)return null;let r=e.sizes.filter(n=>n.width>0||n.height>0).length;return r===0?null:`is laying out ${r} sized child${r===1?"":"ren"} in a run of length 0 (${t.width}\xD7${t.height}, ${e.mode}). They will be positioned from its centre rather than its leading edge.`}function bg(e,t,r){let n=typeof e=="string"?e:e.to,o=typeof t=="string"?t:t.to;return r>=1||n===o?o:{from:n,to:o,t:r}}function $a(e,t,r,n,o){if(e==="freeform")return{mode:e,items:r,space:n,...of(r,n,o)};if(e==="grid"){let a=af(r,t.columns??1,mf(t),ja(t),n,o);return{mode:e,items:r,space:n,...a}}let s=e==="horizontal",i=t.wrap?ef(r,s,t.gap??0,ja(t),n,o):tf(r,s,t.gap??0,n,o);return{mode:e,items:r,space:n,...i}}function df(e,t,r){if(e.mode==="grid")return lf(e.cells??[],r);let n=kg(t);return e.mode==="freeform"?sf(e.sizes,r,n):rf(e.sizes,e.lines??[],e.gapScales??[],e.mode==="horizontal",t.gap??0,ja(t),n,r)}function kg(e){let t=e.align;return t===void 0?gg:typeof t=="string"?J.resolve(t):t}function mf(e){let t=e.gap??0;return t==="auto"?0:t}function ja(e){return e.crossGap??mf(e)}function hs(e,t){let r=t??0;return e==="hug"?r:ct.resolveLayout(e,r,0)}function Mg(e,t,r){return{width:m(e.width,t.width,r),height:m(e.height,t.height,r)}}function uf(e,t,r,n){return ff(e,t)||r===!0&&ff(e,n)}function ff(e,t){return e===t?!0:!Number.isFinite(e)||!Number.isFinite(t)?!1:Math.abs(e-t)<=1e-6*Math.max(1,Math.abs(e),Math.abs(t))}var Xt={resolve:e=>e,lerp:bg,arrange:xg,measure:pf,place:hf,reusable:_g,contentBox:wg,size:vg,collapsedRun:Sg};var Ag={x:0,y:0,z:0};function pt(e){if(e===void 0)return{...Ag};if(typeof e=="number")return{x:e,y:e,z:e};if(Array.isArray(e))return{x:e[0]??0,y:e[1]??0,z:e[2]??0};let t=e;return{x:t.x??0,y:t.y??0,z:t.z??0}}function ms(e,t,r){return{x:m(e.x,t.x,r),y:m(e.y,t.y,r),z:m(e.z,t.z,r)}}var ys={resolve:e=>pt(e),lerp:ms};function yf(e,t,r){return{x:m(e.x,t.x,r),y:m(e.y,t.y,r),z:m(e.z,t.z,r),order:r<.5?e.order:t.order}}var gs={resolve:e=>{let t=pt(e),r=e?.order;return r?{...t,order:r}:t},lerp:yf},gf={x:0,y:0,z:0,w:1};function xf(e,t,r){let{x:n,y:o,z:s,w:i}=t,a=e.x*n+e.y*o+e.z*s+e.w*i;if(a<0&&(n=-n,o=-o,s=-s,i=-i,a=-a),a>.9995)return _f({x:m(e.x,n,r),y:m(e.y,o,r),z:m(e.z,s,r),w:m(e.w,i,r)});let l=Math.acos(a),c=Math.sin(l),d=Math.sin((1-r)*l)/c,u=Math.sin(r*l)/c;return{x:e.x*d+n*u,y:e.y*d+o*u,z:e.z*d+s*u,w:e.w*d+i*u}}function _f(e){let t=Math.hypot(e.x,e.y,e.z,e.w);return t===0?{...gf}:{x:e.x/t,y:e.y/t,z:e.z/t,w:e.w/t}}function Ba(e){let t=Math.PI/360,r=Math.cos(e.x*t),n=Math.sin(e.x*t),o=Math.cos(e.y*t),s=Math.sin(e.y*t),i=Math.cos(e.z*t),a=Math.sin(e.z*t);switch(e.order??"XYZ"){case"YXZ":return{x:n*o*i+r*s*a,y:r*s*i-n*o*a,z:r*o*a-n*s*i,w:r*o*i+n*s*a};case"ZXY":return{x:n*o*i-r*s*a,y:r*s*i+n*o*a,z:r*o*a+n*s*i,w:r*o*i-n*s*a};case"ZYX":return{x:n*o*i-r*s*a,y:r*s*i+n*o*a,z:r*o*a-n*s*i,w:r*o*i+n*s*a};case"YZX":return{x:n*o*i+r*s*a,y:r*s*i+n*o*a,z:r*o*a-n*s*i,w:r*o*i-n*s*a};case"XZY":return{x:n*o*i-r*s*a,y:r*s*i-n*o*a,z:r*o*a+n*s*i,w:r*o*i+n*s*a};default:return{x:n*o*i+r*s*a,y:r*s*i-n*o*a,z:r*o*a+n*s*i,w:r*o*i-n*s*a}}}var La={resolve:e=>e,lerp:xf};function dt(e,t,r,n){return o=>p({default:o&&"default"in o?o.default:e(),mapper:o?.mapper??t,tween:o?.tween??r,...o?.kind??n?{kind:o?.kind??n}:{}})}var He=dt(()=>[],W.resolve,W.lerp,"fills"),Sr=dt(()=>[],at.resolve,at.lerp,"strokes"),qa=dt(()=>[],ue.resolve,ue.lerp,"shadows"),Wa=dt(()=>[],Wr.resolve,Wr.lerp,"effects"),qt=dt(()=>"black",Ro.resolve,Ro.lerp,"color"),Kn=dt(()=>0,gr.resolve,gr.lerp,"cornerRadius"),Hn=dt(()=>"rounded",To.resolve,To.lerp,"cornerStyle"),Un=dt(()=>"",void 0,kt.lerp,"path"),Xn=dt(()=>0,Tt.resolve,Tt.lerp,"insets"),Pe=dt(()=>"center",J.resolve,J.lerp,"alignment"),xs=dt(()=>"freeform",void 0,Xt.lerp),Og=dt(()=>({x:0,y:0}),void 0,Vi.lerp,"vector2"),Eg=dt(()=>"fill",void 0,ct.lerp,"size"),Ga=dt(()=>"",void 0,ot.lerp,"text"),LO=dt(()=>({x:0,y:0,z:0}),ys.resolve,ys.lerp,"vector3"),qO=dt(()=>({x:0,y:0,z:0}),gs.resolve,gs.lerp,"euler3"),wf=dt(()=>({x:0,y:0,z:0,w:1}),void 0,La.lerp,"quaternion"),Ya=dt(()=>0,void 0,ba.lerp,"audioParam"),vf=dt(()=>[],os.resolve,os.lerp,"audioFilters");var Cg=new Set(["number","slider","angle","hue","boolean","color","vector","point"]);function GO(e){return Cg.has(e.kind)}var Sf=64,bf=64e3;function kf(e){if(typeof e!="object"||e===null)throw new Error("A shader pack must be an object.");let t=e,r=t.scope;if(r!=="fill"&&r!=="effect")throw new Error(`A shader pack needs scope "fill" or "effect", got ${JSON.stringify(r)}. The two are written against different contracts \u2014 a fill has no backdrop to sample and an effect has no shape box to map coordinates onto.`);let n=typeof t.source=="string"?t.source.trim():"";if(n==="")throw new Error(`Shader pack "${String(t.name??"?")}" has no source.`);if(n.length>bf)throw new Error(`Shader pack "${String(t.name??"?")}" source is ${n.length} characters, over the ${bf} ceiling.`);let o={...typeof t.$kind=="string"?{$kind:t.$kind}:{},...typeof t.id=="string"?{id:t.id}:{},name:typeof t.name=="string"&&t.name!==""?t.name:"Shader",...typeof t.description=="string"?{description:t.description}:{},source:n,...ws(t.uniforms)?{uniforms:t.uniforms}:{},properties:Pg(t.properties,String(t.name??"?"))};if(r==="fill"){let s=t.coords;return{...o,scope:"fill",...s==="normalized"||s==="centered"||s==="local"?{coords:s}:{}}}return{...o,scope:"effect",...t.backdrop===!0?{backdrop:!0}:{}}}function Pg(e,t){if(!ws(e))return{};let r={},n=new Map;for(let[o,s]of Object.entries(e)){if(Object.keys(r).length>=Sf){Zn(`shader "${t}" declares more than ${Sf} properties; the rest are ignored.`);break}if(!ws(s)||typeof s.kind!="string"){Zn(`shader "${t}" property "${o}" has no kind; ignored.`);continue}let i=s.inputs;if(!ws(i)||Object.keys(i).length===0){Zn(`shader "${t}" property "${o}" names no uniform in "inputs"; ignored.`);continue}let a=!1;for(let l of Object.values(i)){if(typeof l!="string"){Zn(`shader "${t}" property "${o}" has a non-string uniform name; ignored.`),a=!0;break}let c=n.get(l);if(c!==void 0){Zn(`shader "${t}" properties "${c}" and "${o}" both write uniform "${l}"; "${o}" ignored.`),a=!0;break}n.set(l,o)}a||(r[o]=s)}return r}function ws(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var _s=new Set;function Zn(e){_s.has(e)||(_s.size>256&&_s.clear(),_s.add(e),console.warn(`[shader] ${e}`))}var q=null;function Jn(e){let t=q;return q=e,t}var Wt=class{_host;_name;_value;_fn=null;_running=!1;constructor(t,r=null,n=""){this._host=r,this._name=n,this._value=t}get(){if(q!==null&&q.read(this),!this._fn||this._running)return this._value;this._running=!0;try{return this._value=this._fn()}finally{this._running=!1}}set(t){q!==null&&q.write(this),this._fn=null,this._value=t}bind(t){q!==null&&q.write(this),this._fn=t}unbind(){this._fn&&(q!==null&&q.write(this),this._value=this.get(),this._fn=null)}isBound(){return this._fn!==null}snapshot(){return this._fn?{value:this.get(),fn:this._fn}:{value:this._value}}restoreFrom(t){t.fn?this.bind(t.fn):this.set(t.value)}dispose(){this._fn=null,this._value=void 0}};var Va=class{target;props;duration;easing;atPrepared=null;constructor(t,r,n,o){this.target=t,this.props=r,this.duration=n,this.easing=o}at(t){return this.atPrepared||(this.atPrepared=this.prepare()),this.atPrepared.seek(ce(t)*this.duration),{}}_stepper(){return this.prepare()}prepare(){return this.target._prepareStep(this.props,this.duration,this.easing)}};function vs(e,t,r,n){return new Va(e,t,r,n)}function mE(e,t){let r=Object.keys(t).filter(s=>t[s]!==void 0),n=new Array(r.length),o=new Array(r.length);for(let s=0;s<r.length;s++)n[s]=e[r[s]],o[s]=t[r[s]];return s=>{for(let i=0;i<r.length;i++)e[r[i]]=n[i]+(o[i]-n[i])*s}}function Mf(e,t,r){return n=>{for(let o=0;o<e.length;o++)e[o].set(t[o]+(r[o]-t[o])*n)}}function Qn(e,t){return{id:Symbol(t??"context"),defaultValue:e,name:t}}var br=class e{entries;constructor(t){this.entries=t}static EMPTY=new e(new Map);with(t,r){let n=new Map(this.entries);return n.set(t.id,r),new e(n)}get(t){return this.entries.has(t.id)?this.entries.get(t.id):t.defaultValue}};function xE(e,t){return e.__cells?.slots.get(t)}function Ss(e){return e.__cells??={slots:new Map}}var bs=Symbol("commandMeta");function Af(e){return za(e,bs)}function I(e){return function(t,r){let n=r,o=e?.key??n;Object.prototype.hasOwnProperty.call(t,bs)||(t[bs]=[]);let s=t[bs];s.some(i=>i.key===o)||s.push({key:o,method:n,...e?.name?{name:e.name}:{},...e?.args?{args:e.args}:{}})}}var Ue="layoutBounds",ks="var:",Xe="presence:",Te="structure";function De(e,t){let r=Jn(e);try{return t()}finally{Jn(r)}}function Ms(e){let t=Jn(null);try{return e()}finally{Jn(t)}}function to(e){return e._host?`${e._host.id}.${e._name}`:e._name}function Of(e,t){return{duration:t,at:()=>({}),_stepper:()=>Ka(t)}}function Ka(e){let t=0;return{seek:r=>{t=r},advance:r=>(t+=r,t>=e)}}function Tg(e,t,r){let n=new Wt(void 0,e,t),o=Ss(e);o.slots.set(t,n),r?.tween&&(o.tweens??=new Map).set(t,r.tween),r?.mapper&&(o.mappers??=new Map).set(t,r.mapper),Object.defineProperty(e,t,{get:()=>n.get(),set:s=>e._writeProp(t,s),enumerable:!0,configurable:!0})}function Ef(e,t,r,n){e.__cells?.slots.get(t)?n&&(n.tween&&(Ss(e).tweens??=new Map).set(t,n.tween),n.mapper&&(Ss(e).mappers??=new Map).set(t,n.mapper)):Tg(e,t,n),e._writeProp(t,r)}function Cf(e){let t={};if(e.__cells)for(let r of e.__cells.slots.keys())t[r]=e[r];return t}function As(e){let t=new Map,r=e.__cells?.slots;if(!r)return t;for(let[n,o]of r)t.set(n,o.snapshot());return t}function Pf(e){e.__cells&&e._stateStack.push(As(e))}function Tf(e){return e._stateStack.pop()}function kr(e,t){let r=e.__cells?.slots;if(r)for(let[n,o]of t)r.get(n)?.restoreFrom(o)}function Df(e,t,r,n){let o=null;return jt(r,s=>{if(!o){let i={};if(t)for(let[a,l]of t)i[a]=l.value;o=e._prepareStep(i,r)}o.seek(s*r),t&&s>=1&&kr(e,t)},n)}function Rf(){return{total:0,creation:0,elapsed:0,started:!1}}function Ff(e,t){e.started||(e.creation=t,e.started=!0),e.total=t,e.elapsed=t-e.creation}var Ha=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Dg={"2d":"2D nodes go in the 2D tree, or inside a <Canvas3D> as a HUD over its scene.","3d":"Put 3D nodes inside a <Canvas3D>, which is the one node that holds both.",audio:"Put audio nodes under an <AudioBus>, or directly on the scene root."},ht=class e{constructor(t){this._props=t;let r=t;this.key=r?.key,this.id=r?.id??crypto.randomUUID()}key;_hidden=!1;_locked=!1;get hidden(){return this._hidden}get locked(){return this._locked}_setEditorState(t,r){this._hidden=t,this._locked=r}initProps(t){t?.ref&&t.ref(this);for(let r of Vn(this)){let n=t?t[r.key]:void 0,o=n!==void 0?n:r.default;this.applyProp(r.key,o,r.options)}}adoptChildrenProp(t){if(t&&t.children){let n=(Array.isArray(t.children)?t.children:[t.children]).flat(1/0).filter(o=>o instanceof e);n.length>0&&this._addChildren(n)}}acceptsChild(t){return t.dimension===this.dimension}assertAcceptsChild(t){if(!this.acceptsChild(t))throw new TypeError(`${this.className} (${this.dimension}) cannot hold ${t.className} (${t.dimension}). ${Dg[t.dimension]}`)}_assets=null;_parent=null;_mounted=!1;get mounted(){return this._mounted}get parent(){return q!==null&&q.read(this._structureSlot()),this._parent}get assets(){if(!this._assets)throw new Error("Assets not bound \u2014 this node is not attached to a scene. See Node.attach().");return this._assets}_context=br.EMPTY;_contextBound=!1;_props;useContext(t){return this._context.get(t)}id;__cells;_children=[];static flattenChildrenProp(t){let r=t?t.children:void 0;return r?(Array.isArray(r)?r:[r]).flat(1/0).filter(o=>o instanceof e):[]}applyProp(t,r,n){Ef(this,t,r,n)}_writeProp(t,r){if(r===void 0)return;let n=this.__cells?.slots.get(t);if(!n)return;let o=this.__cells?.mappers?.get(t);if(typeof r=="function"){let s=r;n.bind(o?()=>o(s(),n.get()):s)}else n.set(o?o(r,n.get()):r)}get properties(){return Cf(this)}get className(){return this.constructor.name}set(t){let r=this.__cells?.slots;if(r)for(let n in t){let o=t[n];o!==void 0&&r.has(n)&&this._writeProp(n,o)}}to(t){return vs(this,t.data??{},t.duration,t.easing)}command(t,r=1,n){return this._mounted?_c(this,t,r,n):Of(this,r)}_prepareStep(t,r,n){if(!this._mounted)return Ka(r);let o=[],s=[],i=[],a=[],l=[];for(let y of Object.keys(t)){let w=this.__cells?.slots.get(y);if(!w)continue;let g=t[y],x=this.__cells?.mappers?.get(y),_=x?x(g,this[y]):g,S=this.__cells?.tweens?.get(y);if(S){let b=this[y];a.push(k=>{w.set(S(b,_,k))})}else if(typeof _=="number")if(x){let b=this[y];a.push(k=>{this[y]=b+(_-b)*k})}else o.push(w),s.push(this[y]),i.push(_);else typeof _=="string"&&l.push([y,_])}let c=Mf(o,s,i),d=a.length>0,u=l.length>0,f=y=>{let w=n?n(y):y;if(c(w),d)for(let g of a)g(w);if(u&&y>=1)for(let[g,x]of l)this[g]=x},h=0;return{seek:y=>{h=y,f(r>0?Math.min(y/r,1):1)},advance:y=>(h+=y,h<r?(f(h/r),!1):(f(1),!0))}}_stateStack=[];save(){Pf(this)}restore(t){let r=Tf(this),n=t?.duration;if(n===void 0||n<=0){r&&kr(this,r);return}return Df(this,r,n,t?.easing)}_time=Rf();tick(){}get time(){return q!==null&&q.clock?.(this),this._time}_advanceOwnTime(t){Ff(this._time,t),this.tick(),this._sample()}_sample(){}_primeMotion(t){}attach(t){let r=!this._mounted;this._mounted=!0,this._assets!==t.assets&&(this._assets=t.assets);let n=this.provideContext(t.context);if((!this._contextBound||this._context!==n)&&(this._context=n,this._contextBound=!0),r&&this.resolveContext(n),this._advanceOwnTime(t.time),this._children.length===0)return;let s=n===t.context?t:{...t,context:n};for(let i of this._children)i.attach(s)}detach(){if(this._mounted){this._mounted=!1;for(let t of this._children)t.detach()}}_currentScope(){return this._assets&&this._contextBound?{assets:this._assets,context:this._context,time:this._time.total}:null}_attachChild(t){if(!this._mounted)return;let r=this._currentScope();r&&t.attach(r)}resolveContext(t){}provideContext(t){return t}attachDetached(t){let r=this._currentScope();r&&t.attach(r)}declareAssets(t){}declareAudio(t){}get children(){return q!==null&&q.read(this._structureSlot()),this._children}get _allChildren(){return q!==null&&q.read(this._structureSlot()),this._children}add(t){if(t instanceof e){this._addChild(t);return}let r=e.flattenChildrenProp({children:t});r.length>0&&this._addChildren(r)}remove(t){if(t instanceof e){this._removeChild(t);return}for(let r of e.flattenChildrenProp({children:t}))this._removeChild(r)}clear(){for(let t of this._children)q!==null&&this._structureChanged(t),t._parent=null,t.detach();this._children.length=0}addChildAt(t){let{child:r,index:n}=t.data;this.assertAcceptsChild(r),this._insertChildAt(r,n)}_insertChildAt(t,r){q!==null&&this._structureChanged(t),this._children.splice(r,0,t),t._parent=this,this._attachChild(t)}_structureSlot(){return this._structure??=new Wt(null,this,Te)}_structureChanged(t){q.write(this._structureSlot()),t&&q.write(t._structureSlot())}_structure=null;_addChild(t){this.assertAcceptsChild(t),q!==null&&this._structureChanged(t),this._children.push(t),t._parent=this,this._attachChild(t)}_addChildren(t){for(let r of t)this.assertAcceptsChild(r);if(q!==null)for(let r of t)this._structureChanged(r);this._children.push(...t);for(let r of t)r._parent=this;for(let r of t)this._attachChild(r)}_removeChild(t){let r=this._children.indexOf(t);if(r<0)return;q!==null&&this._structureChanged(t);let[n]=this._children.splice(r,1);n&&(n._parent=null,n.detach())}dispose(){if(this.__cells)for(let t of this.__cells.slots.values())t.dispose();this.__cells=void 0,this._assets=null,this._mounted=!1,this._context=br.EMPTY,this._contextBound=!1}};Ha([I()],ht.prototype,"to",null);Ha([I()],ht.prototype,"restore",null);Ha([I({args:["child","index"]})],ht.prototype,"addChildAt",null);var Qr=class extends Error{assetType;src;nodeId;constructor(t,r,n){super(`${t} asset "${r}" is not loaded. `+(n??`Declare it from the node's declareAssets() (e.g. assets.${t==="font"?"font":"image"}(...)), so the asset timeline loads it before this frame draws.`)),this.name="AssetNotLoadedError",this.assetType=t,this.src=r}};var K=class{_ops=[];rect(t){return this._ops.push({kind:"rect",state:t}),this}ellipse(t){return this._ops.push({kind:"ellipse",state:t}),this}path(t){let r=t instanceof Ht?t.toPathState():t;return this._ops.push({kind:"path",state:r}),this}line(t){return this._ops.push({kind:"line",state:t}),this}polygon(t){return this._ops.push({kind:"polygon",state:t}),this}polygram(t){return this._ops.push({kind:"polygram",state:t}),this}cut(){return this._ops.push({kind:"cut"}),this}ops(){return this._ops}isEmpty(){return!this._ops.some(t=>t.kind!=="cut")}};function If(e,t,r,n,o,s){e.prevPos?(e.prevPos.x=t,e.prevPos.y=r):e.prevPos={x:t,y:r},e.prevTime=s,e.prevRotation=n,e.prevScale=o}function zf(){return{prevPos:null,prevTime:0,prevRotation:0,prevScale:1}}function Nf(e,t,r,n,o,s,i){let a=i-t.prevTime,l=t.prevPos;if(l&&a>0&&a<=.2){let c=(r-l.x)/a,d=(n-l.y)/a;e.dt=a,e.velocity.x=c,e.velocity.y=d,e.speed=Math.hypot(c,d),e.direction=Math.atan2(d,c)*180/Math.PI,e.angularVelocity=(o-t.prevRotation)/a,e.scaleVelocity=(s-t.prevScale)/a}else e.dt=0,e.velocity.x=0,e.velocity.y=0,e.speed=0,e.direction=0,e.angularVelocity=0,e.scaleVelocity=0;l?(l.x=r,l.y=n):t.prevPos={x:r,y:n},t.prevTime=i,t.prevRotation=o,t.prevScale=s}function Rg(e,t){let r=e.lastMeasure,n=r?.measurer;if(!n)return null;let o=r?.constraints??{maxWidth:e.measuredWidth||Number.MAX_SAFE_INTEGER,maxHeight:e.measuredHeight||Number.MAX_SAFE_INTEGER},s=t.measure(o,n);return{width:s.width??0,height:s.height??0}}var Os=.7;function $f(e,t,r,n,o){let s=null,i=!1,a=!1,l,c,d=()=>{let u=t.opacity;l=t.width,c=t.height,i=typeof l=="number",a=typeof c=="number";let f=i&&a?null:Rg(e,t),h=i||f!==null,y=a||f!==null,w=i?l:f?.width??0,g=a?c:f?.height??0;t.set({opacity:0,gapScale:0,...h?{width:0}:{},...y?{height:0}:{}}),e.addChildAt({data:{child:t,index:r}});let x={};h&&(x.width=w),y&&(x.height=g);let _=n*Os,S=n-_;return Po(t,kn(t,t.to({data:x,duration:_,easing:o}),t.to({data:{gapScale:1},duration:_,easing:o})),t.to({data:{opacity:u},duration:S,easing:o}))};return jt(n,u=>{if(s||(s=d()),s.at(u),u>=1){let f={};i||(f.width=l),a||(f.height=c),(!i||!a)&&t.set(f)}})}function jf(e,t,r,n){let o=null,s=null,i=!1,a=()=>{if(i=!0,t<0||t>=e.children.length)return;o=e.children[t];let l=o.measuredWidth,c=o.measuredHeight;o.set({width:l,height:c});let d=r*(1-Os),u=r-d;s=Po(o,o.to({data:{opacity:0},duration:d,easing:n}),kn(o,o.to({data:{width:0,height:0},duration:u,easing:n}),o.to({data:{gapScale:0},duration:u,easing:n})))};return jt(r,l=>{if(i||a(),!s||!o)return;let c=l>=1;!c&&o.parent!==e&&e.addChildAt({data:{child:o,index:Math.min(t,e.children.length)}}),s.at(l),c&&(e.remove(o),o.set({gapScale:1}))})}function Bf(e,t,r,n){let o=r/2,s=null,i=null,a=()=>{let l=e.opacity;i=e.parent;let c=e.measuredWidth,d=e.measuredHeight;e.set({width:c,height:d});let u=o*(1-Os),f=o-u,h=o*Os,y=o-h;return Po(e,e.to({data:{opacity:0},duration:u,easing:n}),kn(e,e.to({data:{width:0,height:0},duration:f,easing:n}),e.to({data:{gapScale:0},duration:f,easing:n})),kn(e,e.to({data:{width:c,height:d},duration:h,easing:n}),e.to({data:{gapScale:1},duration:h,easing:n})),e.to({data:{opacity:l},duration:y,easing:n}))};return jt(r,l=>{s||(s=a());let d=l*r>=o;d&&e.parent!==t?(i&&i.remove(e),t.add(e)):!d&&e.parent!==i&&(t.remove(e),i&&i.add(e)),s.at(l)})}var Fg=[["rotationX","rotationX"],["rotationY","rotationY"],["rotationZ","rotationZ"],["depth","depth"],["perspective","perspective"],["backfaceVisible","backfaceVisible"],["flipHorizontal","flipHorizontal"],["flipVertical","flipVertical"],["origin","transformOrigin"]];function Es(e){let t=e.transform3D;if(t==null||typeof t!="object")return;let r=t;for(let[n,o]of Fg){let s=r[n];s!==void 0&&e[o]===void 0&&(e[o]=s)}}function Lf(e,t,r,n,o){if(r===0)return{x:e+n,y:t+o};let s=r*Math.PI/180,i=Math.cos(s),a=Math.sin(s);return{x:e+i*n+a*o,y:t-a*n+i*o}}function tn(e,t,r,n,o,s,i,a=wr){let l=o.x*(s/2),c=-o.y*(i/2);return Ta(e,t,r,n,l,c,a)}function en(e,t,r){let n=(o,s)=>{let i=Mt(e,{x:o,y:-s});return{x:i.x,y:-i.y}};return{center:n(0,0),topLeft:n(-t,r),topRight:n(t,r),bottomLeft:n(-t,-r),bottomRight:n(t,-r),topCenter:n(0,r),bottomCenter:n(0,-r),centerLeft:n(-t,0),centerRight:n(t,0)}}var Cs=Ea();function Ze(e,t){let r=as(t);return{root:e,camera:t,view:r,screen:Yn(t,r),pushed:Cs,local:Cs,flat:!0,plane:Ra(r,{x:0,y:0,width:0,height:0}),paints:!1,facesAway:!1,nearCut:null}}function rn(e,t){let r=t._spaceMatrix(),n=vr(e.view,r),o=e.camera,s=Yn(o,n),i=Ig(t),a=Ra(n,i),{side:l,edgeOn:c}=ls(o,a),d=Hu(o,a),u=Cs,f=!c&&d!=="none";if(f)if(e.pushed===Cs)u=s;else{let h=pe(e.pushed);h?u=gt(h,s):f=!1}return{root:e.root,camera:o,view:n,screen:s,pushed:f?s:e.pushed,local:u,flat:r[2]===0&&r[6]===0&&r[8]===0&&r[9]===0&&r[11]===0,plane:a,paints:f,facesAway:!c&&l<0,nearCut:f&&d==="some"?Ng(s,i):null}}function eo(e){let t=[];for(let r=e.parent;r;r=r.parent){let n=r._spaceCamera();if(n){let o=Ze(r,n);for(let s=t.length-1;s>=0;s--)o=rn(o,t[s]);return rn(o,e)}if(!r._rendersChildrenInSpace())return null;t.push(r)}return null}function Ua(e){let t=e._spaceCamera();return t?Ze(e,t):e._rendersChildrenInSpace()?eo(e):null}function Ps(e){return e.length<2||e.every(t=>t.flat)?e.map((t,r)=>r):Xu(e[0].camera,e.map(t=>t.plane))}function Ig(e){let t=e._localBounds();return{x:t.x,y:-t.y,width:t.width,height:t.height}}var zg=128;function Ng(e,t){let r=Uu(e,t,Math.max(t.width,t.height)/2+zg);if(!r)return null;let n=new Ht().moveTo(r[0].x,-r[0].y);for(let s=1;s<r.length;s++)n.lineTo(r[s].x,-r[s].y);let o=Math.max(...r.map(s=>Math.max(Math.abs(s.x),Math.abs(s.y))));return new K().path(n.close().toPathState({centerBounds:[-o,-o,o,o]}))}function qf(e,t,r,n){if(!e)return{};let o=t.x+r,s=t.y-n;return{parent:{left:-e.width/2-o,top:-e.height/2-s,right:e.width/2-o,bottom:e.height/2-s}}}function Wf(e,t,r,n,o){let s=Zi(t);s.length!==0&&(!r||r.isEmpty()||(e.beginClip(r),e.beginEffects(s,"backdrop",n,o),e.endEffects(),e.endClip()))}function Gf(e,t,r,n,o,s){let i=Ji(t),a=i.length>0;a&&e.beginEffects(i,"foreground",n,o);let l=r!=null&&!r.isEmpty();l&&e.beginClip(r),s(),l&&e.endClip(),a&&e.endEffects()}var G=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},$g={},Xa={x:0,y:0},Ts={rotationX:0,rotationY:0,rotationZ:0,depth:0,perspective:0,flipHorizontal:!1,flipVertical:!1};function Yf(e){return Ts.rotationX=e.rotationX,Ts.rotationY=e.rotationY,Ts.depth=e.depth,Ts}var jg=Object.freeze({}),Bg={width:0,height:0},A=class e extends ht{get dimension(){return"2d"}get parent2D(){let t=this._parent;return t instanceof e?t:null}get parent(){return q!==null&&q.read(this._structureSlot()),this.parent2D}get children(){q!==null&&q.read(this._structureSlot());let t=this._children;for(let r=0;r<t.length;r++)if(!(t[r]instanceof e))return t.filter(n=>n instanceof e);return t}constructor(t){if(super(t),t&&(ds.expand(t),Es(t)),this.initProps(t),t&&t.flex!==void 0?(t.width===void 0&&this.applyProp("width","fill",{tween:ct.lerp}),t.height===void 0&&this.applyProp("height","fill",{tween:ct.lerp})):this.applyDefaultSize(t),t){J.validateProps(t);let r=J.findKey(t);if(r){let n=t[r],o=typeof n=="function"?n:()=>n,{pivot:s,x:i,y:a}=J.bindTarget(r,o,()=>this._layoutBounds.get());this._writeProp("pivot",s),this._writeProp("x",i),this._writeProp("y",a)}}this.adoptChildrenProp(t)}set(t){let r=t.size;t.transform3D!==void 0&&(t={...t},Es(t)),super.set(t),r!==void 0&&(t.width===void 0&&this._writeProp("width",r),t.height===void 0&&this._writeProp("height",r))}_prepareStep(t,r,n){ds.expand(t),Es(t);let o=t.pivot;o!==void 0&&delete t.pivot,J.validateProps(t);let s=J.findKey(t);if(s){let i=t[s],{pivot:a,x:l,y:c}=J.resolveTargetOnce(s,this._layoutBounds.get(),i);this._writeProp("transformOrigin",o!==void 0?J.resolve(o):a),t.x=l,t.y=c}else o!==void 0&&this._writeProp("transformOrigin",J.resolve(o));return super._prepareStep(t,r,n)}declareAssets(t){t.effects(this.effects)}_sample(){this._sampleMotion()}_primeMotion(t){let r=this.layoutBounds;If(this._motionHistory,(r?.x??0)+this.x,(r?.y??0)-this.y,this.rotation,this.scale,t)}_layoutBounds=new Wt({x:0,y:0,width:0,height:0},this,Ue);lastMeasure;get constraints(){return this.lastMeasure?.constraints??{}}get layoutBounds(){return this._layoutBounds.get()}static flowChildrenProp(t){return e.flattenChildrenProp(t).filter(r=>r instanceof e)}static hasFillChild(t,r){return t.some(n=>(r==="width"?n.width:n.height)==="fill")}applyDefaultSize(t){let n=e.flowChildrenProp(t).length>0?"hug":"fill";(!t||t.width===void 0)&&this.applyProp("width",n,{tween:ct.lerp}),(!t||t.height===void 0)&&this.applyProp("height",n,{tween:ct.lerp})}moveTo(t){let{path:r,target:n,targetAnchor:o,...s}=t.data??{},i=s.x!==void 0||s.y!==void 0,a=typeof n=="string"&&n!=="";if(a&&i)throw new Error("moveTo takes a `target` or an `x`/`y` destination, not both \u2014 the target's anchor is where the move ends.");let l=a?this._pointOnNode(n,o):null;if(r==null)return this.to({data:{...s,...l},duration:t.duration,easing:t.easing});if(i)throw new Error("moveTo takes a `path` or an `x`/`y` destination, not both \u2014 the path's own end is where the move ends.");let c=kt.sampler(r instanceof Ht?r.toCommands():r),{length:d}=c,u=c.frameAt(0),f=c.frameAt(d),h=l&&u&&f?kt.endFit(u,f,l):null,y=s.pivot;return this.command(w=>{let g=c.frameAt(d*w);if(!g)return{};let x=h?h(g):g,_={x:x.x,y:x.y};return y!==void 0&&(_.transformOrigin=y),_},t.duration,t.easing)}fadeTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}rotateTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}scaleTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}get measuredWidth(){return this.layoutBounds.width}get measuredHeight(){return this.layoutBounds.height}_rotateOffset(t,r){return Lf(this.x,this.y,this.rotation,t,r)}get center(){return{x:this.x,y:this.y}}get topLeft(){let t=this.layoutBounds;return this._rotateOffset(-t.width/2,t.height/2)}get topRight(){let t=this.layoutBounds;return this._rotateOffset(t.width/2,t.height/2)}get bottomLeft(){let t=this.layoutBounds;return this._rotateOffset(-t.width/2,-t.height/2)}get bottomRight(){let t=this.layoutBounds;return this._rotateOffset(t.width/2,-t.height/2)}get topCenter(){let t=this.layoutBounds;return this._rotateOffset(0,t.height/2)}get bottomCenter(){let t=this.layoutBounds;return this._rotateOffset(0,-t.height/2)}get centerLeft(){let t=this.layoutBounds;return this._rotateOffset(-t.width/2,0)}get centerRight(){let t=this.layoutBounds;return this._rotateOffset(t.width/2,0)}_localMatrix(){let t=this.layoutBounds,r=this._slotMatrix();if(r)return gt(r,tn(this.x,-this.y,this.rotation,this.scale,this._transformOrigin(),t?.width??0,t?.height??0));let n=(t?.x??0)+this.x,o=(t?.y??0)-this.y;return tn(n,o,this.rotation,this.scale,this._transformOrigin(),t?.width??0,t?.height??0)}_placement(){return this.parent2D?._placementOf(this)??null}_placementOf(t){return null}_slotMatrix(t=!1){let r=this._placement();if(!r)return null;let n=this.layoutBounds;return tn(n?.x??0,n?.y??0,r.rotation,r.scale,Xa,0,0,t?Yf(r):void 0)}_slotAffine(){let t=this._placement();if(!t)return null;let r=this.layoutBounds;return cs(r?.x??0,r?.y??0,t.rotation,t.scale,0,0,Yf(t))}_transformOrigin(){return this.transformOrigin??this.pivot}_projectionScratch={rotationX:0,rotationY:0,rotationZ:0,depth:0,perspective:0,flipHorizontal:!1,flipVertical:!1};_projection(){let t=this._projectionScratch;return t.rotationX=this.rotationX,t.rotationY=this.rotationY,t.rotationZ=this.rotationZ,t.depth=this.depth,t.perspective=this.perspective,t.flipHorizontal=this.flipHorizontal,t.flipVertical=this.flipVertical,t}_spaceMatrix(){let t=this.layoutBounds,r=t?.width??0,n=t?.height??0,o=this._transformOrigin(),s=this._slotAffine();return s?vr(s,cs(this.x,-this.y,this.rotation,this.scale,o.x*(r/2),-o.y*(n/2),this._projection())):cs((t?.x??0)+this.x,(t?.y??0)-this.y,this.rotation,this.scale,o.x*(r/2),-o.y*(n/2),this._projection())}worldMatrix(){let t=this._localMatrix(),r=this.parent2D;return r?gt(r.worldMatrix(),t):t}get global(){let t=this.layoutBounds,r=en(this.worldMatrix(),(t?.width??0)/2,(t?.height??0)/2),n=0,o=1,s=1;for(let i=this;i;i=i.parent2D){let a=i._placement();n+=i.rotation+(a?.rotation??0),o*=i.scale*(a?.scale??1),s*=i.opacity*(a?.opacity??1)}return{x:r.center.x,y:r.center.y,...r,rotation:n,scale:o,opacity:s}}_pointOnNode(t,r){let n=this;for(;n.parent;)n=n.parent;let o=Vf(n,t);if(!o)return null;let s=J.resolve(r??"center"),i=o.layoutBounds,a=Mt(o.worldMatrix(),{x:s.x*((i?.width??0)/2),y:-s.y*((i?.height??0)/2)}),l=this.parent2D,c=l?pe(l.worldMatrix()):null;if(l&&!c)return null;let d=c?Mt(c,a):a,u=this.layoutBounds;return{x:d.x-(u?.x??0),y:(u?.y??0)-d.y}}resolveSizeInput(t,r,n){return ct.resolveLayout(t,r,n)}addChildAt(t){let{child:r,index:n}=t.data;if(this.assertAcceptsChild(r),t.duration===void 0){this._insertChildAt(r,n);return}return $f(this,r,n,t.duration,t.easing)}removeChildAt(t){let r=t.data.index;if(t.duration===void 0){if(r<0||r>=this._children.length)return null;q!==null&&this._structureChanged(this._children[r]);let[n]=this._children.splice(r,1);return n&&(n._parent=null),n??null}return jf(this,r,t.duration,t.easing)}_transformScratch={x:0,y:0,width:0,height:0,scale:1,rotation:0,opacity:1,blend:"pass-through",effects:[],pivot:{x:0,y:0}};_motionHistory=zf();_renderState={id:this.id,rects:{},elapsed:0,dt:0,velocity:{x:0,y:0},direction:0,speed:0,angularVelocity:0,scaleVelocity:0};_sampleMotion(){let t=this.layoutBounds,r=(t?.x??0)+this.x,n=(t?.y??0)-this.y;Nf(this._renderState,this._motionHistory,r,n,this.rotation,this.scale,this._time.total)}applyTransform(t){let r=this.layoutBounds,n=this._transformScratch;n.x=(r?.x??0)+this.x,n.y=(r?.y??0)-this.y,n.width=r?.width??0,n.height=r?.height??0,n.scale=this.scale,n.rotation=this.rotation,n.opacity=this.opacity,n.blend=this.blend,n.effects=this.effects,n.pivot=this._transformOrigin();let o=this._placement()?.opacity;o!==void 0&&(n.opacity*=o);let s=this._spaceFrame,i=s?null:this._slotMatrix(!0);if(s)n.matrix=s.local;else if(i)n.matrix=gt(i,tn(this.x,-this.y,n.rotation,n.scale,n.pivot,n.width,n.height,this._projection()));else{let a=this._projection();n.matrix=is(a)?tn(n.x,n.y,n.rotation,n.scale,n.pivot,n.width,n.height,a):void 0}t.transform(n)}renderSelf(t){}renderOverlay(t){}renderStroke(t){}clipSelf(){return null}_cameraScope(){return null}_spaceCamera(){return null}_rendersChildrenInSpace(){return!0}_spaceFrame=null;_confinesChildren(){if(this._cameraScope()!==null)return!0;if(!this.clip)return!1;let t=this.clipSelf();return t!==null&&!t.isEmpty()}hitTestSelf(t,r){let n=this._localBounds();return Math.abs(t.x-n.x)<=n.width/2+r&&Math.abs(t.y-n.y)<=n.height/2+r}_localBounds(){return{x:0,y:0,width:this.measuredWidth,height:this.measuredHeight}}_hitTestSelf(t,r){return this.hitTestSelf(t,r)}clipPathSelf(){return null}applyClip(t){let r=this.clipSelf();return!r||r.isEmpty()?!1:(t.beginClip(r),!0)}applyBackdropEffects(t){let r=this.effects;r.length!==0&&Wf(t,r,this.clipSelf(),this.layoutBounds?.width??0,this.layoutBounds?.height??0)}renderContentWithEffects(t,r){this.applyBackdropEffects(t),Gf(t,this.effects,this.clipPathSelf(),this.layoutBounds?.width??0,this.layoutBounds?.height??0,r)}renderChildren(t){let r=this._spaceCamera();if(r){this._renderInSpace(t,Ze(this,r));return}let n=this._spaceFrame;if(n){this._renderInSpace(t,n);return}for(let o of this._children)o instanceof e&&o.render(t)}_renderInSpace(t,r){let n=[];for(let i of this._children)i instanceof e&&n.push(i);let o=n.map(i=>rn(r,i)),s=t.drawsVisibleOnly?Ps(o):o.map((i,a)=>a);for(let i of s){let a=n[i];a._spaceFrame=o[i];try{a.render(t)}finally{a._spaceFrame=null}}}_paintInFront(t,r,n){if(!r){n();return}t.beginClip(r);try{n()}finally{t.endClip()}}beforeRender(t){}renderState(t){let r=this._renderState;return r.rects=t.readsSpaceRects?this._spaceRects():$g,r.elapsed=this._time.elapsed,r}_spaceRects(){return qf(this.parent2D?.layoutBounds,this.layoutBounds,this.x,this.y)}afterRender(t){}render(t){if(!this.mounted||t.drawsVisibleOnly&&this.opacity*(this._placement()?.opacity??1)<=0||t.drawsVisibleOnly&&this.hidden)return;let r=this._spaceFrame;if(!(t.drawsVisibleOnly&&!this.backfaceVisible&&this._facesAway(r))&&!(t.drawsVisibleOnly&&r&&!r.paints&&!this._rendersChildrenInSpace()))try{t.begin(this.renderState(t));try{this.beforeRender(t),this.renderContent(t),this.afterRender(t)}finally{t.end()}}catch(n){throw n instanceof Qr&&(n.nodeId??=this.id),n}}renderContent(t){this.applyTransform(t);let r=this._spaceFrame;if(r&&!r.paints){this.renderChildren(t);return}let n=r?.nearCut??null;this.renderContentWithEffects(t,()=>{this._paintInFront(t,n,()=>this.renderSelf(t));let o=this.clip&&this.applyClip(t);this.renderChildren(t),o&&t.endClip(),this._paintInFront(t,n,()=>{this.renderOverlay(t),this.renderStroke(t)})})}_facesAway(t){if(t)return t.facesAway;let r=this._projection();return Pa(r.rotationX,r.rotationY)}_flowMeasure=null;_flowWarned=!1;setLayoutBounds(t){let r=this._layoutBounds.get();r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height||this._layoutBounds.set(t)}flowChildren(){let t=this._children,r=0;for(;r<t.length;r++){let n=t[r];if(!(n instanceof e)||n.hidden)break}return r===t.length?t:t.filter(n=>n instanceof e&&!n.hidden)}effectivePadding(){return this.padding}flowArrangement(){return jg}layout(t,r){this.setLayoutBounds(t),this.layoutChildren(t,r)}layoutChildren(t,r){let n=this._flowMeasure;this._flowMeasure=null;let o=this.flowChildren();if(o.length===0)return;let s=Tt.insetBounds(t.width,t.height,this.effectivePadding()),i=this.flowArrangement(),a=n&&Xt.reusable(n,s)?n:Xt.measure(i,o,{width:s.width,height:s.height,hugWidth:this.width==="hug",hugHeight:this.height==="hug"},r),l=Xt.place(a,i,s);for(let d=0;d<l.length;d++){let u=l[d];a.items[d].layout({x:s.x+u.x,y:s.y-u.y,width:u.width,height:u.height},r)}if(this._flowWarned)return;let c=Xt.collapsedRun(a,t);c!==null&&(this._flowWarned=!0,console.warn(`[motion-script] "${this.className}" ${c}`))}measure(t,r){this.lastMeasure={constraints:t,measurer:r};let n=this.effectivePadding(),o=this.flowChildren();if(o.length===0)return this._flowMeasure=null,Xt.size(this,t,n,Bg);let s=Xt.contentBox(this,t,n),i=Xt.measure(this.flowArrangement(),o,s,r);return this._flowMeasure=i,Xt.size(this,t,n,i.hug)}reparent(t){let r=t.data.newParent;if(t.duration===void 0){let n=this.parent;n&&n.remove(this),r.add(this);return}return Bf(this,r,t.duration,t.easing)}};G([p({default:0})],A.prototype,"x",void 0);G([p({default:0})],A.prototype,"y",void 0);G([p({default:"fill",tween:ct.lerp})],A.prototype,"width",void 0);G([p({default:"fill",tween:ct.lerp})],A.prototype,"height",void 0);G([p({default:1})],A.prototype,"scale",void 0);G([p({default:0})],A.prototype,"rotation",void 0);G([p({default:1})],A.prototype,"opacity",void 0);G([p({default:"pass-through"})],A.prototype,"blend",void 0);G([Wa()],A.prototype,"effects",void 0);G([Xn()],A.prototype,"padding",void 0);G([Pe()],A.prototype,"pivot",void 0);G([p({default:!1})],A.prototype,"flipHorizontal",void 0);G([p({default:!1})],A.prototype,"flipVertical",void 0);G([p({default:0})],A.prototype,"rotationX",void 0);G([p({default:0})],A.prototype,"rotationY",void 0);G([p({default:0})],A.prototype,"rotationZ",void 0);G([p({default:0})],A.prototype,"depth",void 0);G([p({default:0,tween:mc})],A.prototype,"perspective",void 0);G([p({default:!0})],A.prototype,"backfaceVisible",void 0);G([p({default:void 0,mapper:e=>e==null?void 0:J.resolve(e),tween:(e,t,r)=>J.lerp(e??t??Xa,t??Xa,r)})],A.prototype,"transformOrigin",void 0);G([p({default:!1})],A.prototype,"clip",void 0);G([p({default:1})],A.prototype,"flex",void 0);G([p({default:1})],A.prototype,"gapScale",void 0);G([p({default:void 0})],A.prototype,"column",void 0);G([p({default:void 0})],A.prototype,"row",void 0);G([p({default:1})],A.prototype,"colSpan",void 0);G([p({default:1})],A.prototype,"rowSpan",void 0);G([I({args:["x","y",{key:"path",kind:"path"},{key:"target",kind:"nodeRef"},{key:"targetAnchor",kind:"alignment"}]})],A.prototype,"moveTo",null);G([I({args:["opacity"]})],A.prototype,"fadeTo",null);G([I({args:["rotation"]})],A.prototype,"rotateTo",null);G([I({args:["scale"]})],A.prototype,"scaleTo",null);G([I({args:["index"]})],A.prototype,"removeChildAt",null);G([I({args:["newParent"]})],A.prototype,"reparent",null);function Vf(e,t){if(e.id===t)return e instanceof A?e:null;for(let r of e._allChildren){let n=Vf(r,t);if(n)return n}return null}function wt(e){return J.resolve(e??{x:0,y:0})}var Ds=["center","topLeft","topRight","bottomLeft","bottomRight","topCenter","bottomCenter","centerLeft","centerRight"];function Lg(e){let t=Ds.filter(r=>e[r]!==void 0);if(t.length>1)throw new Error(`Cannot set multiple shape alignment props at once: ${t.join(", ")}`);if(t.length===1){let r=["pivot","x","y"].find(n=>e[n]!==void 0);if(r)throw new Error(`Cannot set both shape alignment prop '${t[0]}' and '${r}' at the same time`)}}function Zt(e){let t={...e};for(let r of Ds)delete t[r];return t}function Jt(e,t,r){Lg(e);let n=Ds.find(o=>e[o]!==void 0);if(n){let o=e[n],s=J.resolve(n);return{x:o.x-s.x*(t/2),y:o.y-s.y*(r/2),pivot:s}}return{x:e.x??0,y:e.y??0,pivot:e.pivot??{x:0,y:0}}}function CC(e,t,r){if(Ds.find(i=>e[i]!==void 0)||e.pivot===void 0)return e;let o=J.resolve(e.pivot);if(o.x===0&&o.y===0)return e;let s={x:e.x??0,y:e.y??0};return{...e,x:s.x-o.x*(t/2),y:s.y-o.y*(r/2),pivot:o}}function Kf(e){let t=e.width??0,r=e.height??0,{x:n,y:o,pivot:s}=Jt(e,t,r);return{...Zt(e),opacity:e.opacity??1,rotation:e.rotation??0,scale:e.scale??1,x:n,y:o,start:e.start??0,end:e.end??1,pivot:wt(s),width:t,height:r,cornerRadius:e.cornerRadius??0,cornerStyle:e.cornerStyle??"rounded"}}function Hf(e){let t=e.width??0,r=e.height??0,{x:n,y:o,pivot:s}=Jt(e,t,r);return{...Zt(e),opacity:e.opacity??1,rotation:e.rotation??0,scale:e.scale??1,x:n,y:o,start:e.start??0,end:e.end??1,pivot:wt(s),width:t,height:r,ratio:e.ratio??0,sweep:e.sweep??360,startAngle:e.startAngle??0}}function Uf(e){let t=e.width??0,r=e.height??0,{x:n,y:o,pivot:s}=Jt(e,t,r);return{...Zt(e),opacity:e.opacity??1,rotation:e.rotation??0,scale:e.scale??1,x:n,y:o,start:e.start??0,end:e.end??1,pivot:wt(s),width:t,height:r,sides:e.sides??5,cornerRadius:e.cornerRadius??0,cornerStyle:e.cornerStyle??"rounded"}}function Xf(e){let t=e.width??0,r=e.height??0,{x:n,y:o,pivot:s}=Jt(e,t,r);return{...Zt(e),opacity:e.opacity??1,rotation:e.rotation??0,scale:e.scale??1,x:n,y:o,start:e.start??0,end:e.end??1,pivot:wt(s),width:t,height:r,sides:e.sides??5,ratio:e.ratio??.5,cornerRadius:e.cornerRadius??0,cornerStyle:e.cornerStyle??"rounded"}}function Zf(e){return{opacity:e.opacity??1,rotation:e.rotation??0,scale:e.scale??1,x:e.x??0,y:e.y??0,start:e.start??0,end:e.end??1,width:e.width??0,height:e.height??0,pivot:wt(e.pivot),points:e.points??[],radius:e.radius??0,closed:e.closed??!1}}var Rs=1e-9;function Ja(e,t,r=0){return ep(e.ops(),t,r)}function ep(e,t,r=0){let n=!1,o=null,s=()=>{o&&Jf(o,t,r)&&(n=!0),o=null};for(let i of e){if(i.kind==="cut"){o&&Jf(o,t,r)&&(n=!1),o=null;continue}s(),o=i}return s(),n}function Jf(e,t,r){switch(e.kind){case"rect":{let n=Kf(e.state),o=ro(t,n,n.width,n.height);return o!==null&&Qf(o,n.width,n.height,gr.resolve(n.cornerRadius),r)}case"ellipse":{let n=Hf(e.state),o=ro(t,n,n.width,n.height);return o!==null&&qg(o,n.width,n.height,n.ratio,n.sweep,n.startAngle,r)}case"polygon":{let n=Uf(e.state),o=ro(t,n,n.width,n.height);return o!==null&&Za(o,rp(n.width,n.height,n.sides),!0,r)}case"polygram":{let n=Xf(e.state),o=ro(t,n,n.width,n.height);return o!==null&&Za(o,np(n.width,n.height,n.sides,n.ratio),!0,r)}case"line":{let n=Zf(e.state),o=ro(t,n,n.width,n.height);return o===null||n.points.length===0?!1:n.points.length>=3&&Za(o,n.points,!0,r)?!0:no(o,n.points,n.closed,r)}case"path":{let n=e.state,o={x:t.x-(n.x??0),y:t.y-(n.y??0)};return Qf(o,n.width??0,n.height??0,gr.resolve(0),r)}}}function ro(e,t,r,n){if(t.scale===0)return null;let o=t.pivot,s=o.x*(r/2),i=o.y*(n/2),a=e.x-(t.x+s),l=e.y-(t.y+i),c=t.rotation*Math.PI/180,d=Math.cos(c),u=Math.sin(c),f=(d*a-u*l)/t.scale,h=(u*a+d*l)/t.scale;return{x:f+s,y:h+i}}function Qf(e,t,r,n,o){let s=t/2+o,i=r/2+o;if(Math.abs(e.x)>s||Math.abs(e.y)>i)return!1;let a=Math.min(t,r)/2,l=Math.min(a,e.x<=0?e.y>=0?n.topLeft:n.bottomLeft:e.y>=0?n.topRight:n.bottomRight);if(l<=0)return!0;let c=Math.sign(e.x||1),d=Math.sign(e.y||1),u=e.x-c*(t/2-l),f=e.y-d*(r/2-l);return Math.sign(u||1)!==c||Math.sign(f||1)!==d?!0:u*u+f*f<=(l+o)*(l+o)}function qg(e,t,r,n,o,s,i){let a=t/2,l=r/2;if(a<=0||l<=0)return!1;let c=Math.max(0,Math.min(1,n)),d=Math.abs(o)>=360;return tp(e,a+i,l+i)>1||c>0&&tp(e,Math.max(Rs,a*c-i),Math.max(Rs,l*c-i))<1?!1:d?!0:Wg(Math.atan2(e.y/l,e.x/a)*(180/Math.PI),s,o,e,i)}function tp(e,t,r){return Math.hypot(e.x/t,e.y/r)}function Wg(e,t,r,n,o){let s=r>=0?t:t+r,i=Math.abs(r),a=Math.hypot(n.x,n.y);if(a<=o)return!0;let l=o>0?o/Math.max(a,Rs)*(180/Math.PI):0,c=(e-s)%360;return c<0&&(c+=360),c<=i+l||c>=360-l}function rp(e,t,r){let n=Math.max(3,Math.round(r)),o=e/2,s=t/2,i=2*Math.PI/n,a=[];for(let l=0;l<n;l++){let c=Math.PI/2-l*i;a.push({x:o*Math.cos(c),y:s*Math.sin(c)})}return a}function np(e,t,r,n){let o=Math.max(3,Math.round(r)),s=Math.max(0,Math.min(1,n)),i=e/2,a=t/2,l=Math.PI/o,c=[];for(let d=0;d<o*2;d++){let u=Math.PI/2-d*l,f=d%2===0?1:s;c.push({x:i*f*Math.cos(u),y:a*f*Math.sin(u)})}return c}function Za(e,t,r,n){return t.length>=3&&Fs(e,t)?!0:n>0&&no(e,t,r,n)}function Fs(e,t){if(t.length<3)return!1;let r=!1;for(let n=0,o=t.length-1;n<t.length;o=n++){let s=t[n],i=t[o];s.y>e.y!=i.y>e.y&&e.x<(i.x-s.x)*(e.y-s.y)/(i.y-s.y)+s.x&&(r=!r)}return r}function no(e,t,r,n){if(t.length===0)return!1;if(t.length===1)return Math.hypot(e.x-t[0].x,e.y-t[0].y)<=n;let o=r?t.length:t.length-1;for(let s=0;s<o;s++)if(op(e,t[s],t[(s+1)%t.length])<=n)return!0;return!1}function op(e,t,r){let n=r.x-t.x,o=r.y-t.y,s=n*n+o*o;if(s<=Rs)return Math.hypot(e.x-t.x,e.y-t.y);let i=((e.x-t.x)*n+(e.y-t.y)*o)/s;return i=i<0?0:i>1?1:i,Math.hypot(e.x-(t.x+i*n),e.y-(t.y+i*o))}var Je=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},vt=class extends A{shapeGraphics(){return null}renderSelf(t){let r=this.shapeGraphics();r&&t.draw(r.shadow(this.shadow).fill(this.fill))}renderStroke(t){let r=this.stroke;if(r.length===0)return;let n=this.shapeGraphics();n&&t.draw(this.castsShadowFromStroke()?n.shadow(this.shadow).stroke(r):n.stroke(r))}castsShadowFromStroke(){return this.shadow.length===0?!1:!this.fill.some(n=>(n.opacity??1)>0)}declareAssets(t){super.declareAssets(t),t.fill(this.fill);for(let r of this.stroke)t.fill(r.fill);for(let r of this.shadow)t.fill(r.fill)}hitTestSelf(t,r){let n=this.clipSelf();return!n||n.isEmpty()?super.hitTestSelf(t,r):Ja(n,t,r)}fillTo(t){let r=this.fill,n=W.resolve(t.data),o=t.lerp??W.lerp;return this.command(s=>({fill:o(r,n,s)}),t.duration,t.easing)}strokeTo(t){let r=this.stroke,n=at.resolve(t.data,r),o=t.lerp??at.lerp;return this.command(s=>({stroke:o(r,n,s)}),t.duration,t.easing)}shadowTo(t){let r=this.shadow,n=ue.resolve(t.data,r),o=t.lerp??ue.lerp;return this.command(s=>({shadow:o(r,n,s)}),t.duration,t.easing)}};Je([He()],vt.prototype,"fill",void 0);Je([Sr()],vt.prototype,"stroke",void 0);Je([qa()],vt.prototype,"shadow",void 0);Je([p({default:0})],vt.prototype,"start",void 0);Je([p({default:1})],vt.prototype,"end",void 0);Je([I()],vt.prototype,"fillTo",null);Je([I()],vt.prototype,"strokeTo",null);Je([I()],vt.prototype,"shadowTo",null);function Re(e,t){return e===""?String(t):`${e}.${t}`}function Qa(e,t){e.declareAssets(t)}function tl(e,t){if(!e.mounted)return;Qa(e,t);let r=e._allChildren;for(let n=0;n<r.length;n++)tl(r[n],t)}function sp(e,t){e.attachDetached(t)}function Is(e){e._sample();for(let t of e.children)Is(t)}function zs(e,t){e._primeMotion(t);for(let r of e.children)zs(r,t)}function el(e,t){let r=n=>{let o=n.key!==void 0?t?.[n.key]:void 0;n._setEditorState(o?.hidden===!0,o?.locked===!0);for(let s of n._allChildren)r(s)};r(e)}var Ns=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},At=class e extends ht{get dimension(){return"audio"}constructor(t){super(t),this.initProps(t),this.adoptChildrenProp(t)}get childrenAudio(){return this._allChildren.filter(t=>t instanceof e)}get _busId(){let t=this._props?.id;return`bus:${typeof t=="string"?t:lp(this)}`}_prepareStep(t,r,n){for(let o of Gg)if(o in t)throw new TypeError(`${this.className}: "${o}" cannot be tweened \u2014 an audio level is scheduled once, not written per frame, so a tween on it would render flat. Automate it with a curve instead: ${o}: fadeOut(1), or filters: AudioFilters.gain(ramp(1, 0, 1)).`);return super._prepareStep(t,r,n)}};Ns([Ya({default:1})],At.prototype,"volume",void 0);Ns([Ya({default:0})],At.prototype,"pan",void 0);Ns([p({default:!1})],At.prototype,"mute",void 0);Ns([vf()],At.prototype,"filters",void 0);var Gg=["volume","pan"];function $s(e,t){let r=[],n=e.parent;for(;n instanceof At;)r.push(ap(n,t)),n=n.parent;return r.length>0?r:void 0}function rl(e,t){return[ap(e,t),...$s(e,t)??[]]}function nl(e,t){let r=e;for(;r.parent;)r=r.parent;return ip(r,t)}function ip(e,t){if(e instanceof At&&e.id===t)return e;for(let r of e._allChildren){let n=ip(r,t);if(n)return n}return null}function ap(e,t){let r=e.filters,n=t._spanOf(e);return{id:e._busId,volume:e.volume,pan:e.pan,mute:e.mute,...r.length>0?{filters:r}:{},startAt:n.start,endAt:n.end}}function lp(e){let t=[],r=e;for(;r;){let n=r.parent;if(!n)break;t.push(String(n._allChildren.indexOf(r))),r=n}return t.reverse().join(".")}var rt=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},H=class extends A{constructor(t){super(t)}zoomTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}panTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}orbitTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}dollyTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}headingTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}fillTo(t){let r=this.fill,n=W.resolve(t.data),o=t.lerp??W.lerp;return this.command(s=>({fill:o(r,n,s)}),t.duration,t.easing)}overlayTo(t){let r=this.overlay,n=W.resolve(t.data),o=t.lerp??W.lerp;return this.command(s=>({overlay:o(r,n,s)}),t.duration,t.easing)}flowArrangement(){return this}shapeGraphics(){return new D().rect({width:this.layoutBounds.width,height:this.layoutBounds.height})}renderSelf(t){let r=this.fill;r.length!==0&&t.draw(this.shapeGraphics().fill(r))}renderOverlay(t){let r=this.overlay;r.length!==0&&t.draw(this.shapeGraphics().fill(r))}acceptsChild(t){return t.dimension==="2d"||t.dimension==="audio"}get childrenAudio(){return this._allChildren.filter(t=>t instanceof At)}declareAssets(t){super.declareAssets(t),t.fill(this.fill),t.fill(this.overlay)}clipSelf(){return new K().rect({width:this.layoutBounds.width,height:this.layoutBounds.height})}_cameraScope(){return this.space3D||this.zoom===1&&this.heading===0&&this.lookAt.x===0&&this.lookAt.y===0?null:{lookAt:this.lookAt,zoom:this.zoom,heading:this.heading}}_spaceCamera(){if(!this.space3D)return null;let t=this.layoutBounds;return{perspective:this.perspective,orbit:this.orbit,elevation:this.elevation,dolly:this.dolly,lookAt:this.lookAt,zoom:this.zoom,heading:this.heading,viewportX:t?.x??0,viewportY:-(t?.y??0)}}_projection(){return this.space3D?wr:super._projection()}renderChildren(t){let r=this._spaceCamera();if(r){this._renderInSpace(t,Ze(this,r));return}if(this.zoom===1&&this.heading===0&&this.lookAt.x===0&&this.lookAt.y===0){super.renderChildren(t);return}let n=this.layoutBounds,o=n?.width??0,s=n?.height??0,i=n?.x??0,a=n?.y??0;t.beginCamera({x:i,y:-a,width:o,height:s},this.lookAt,this.zoom,this.heading);for(let l of this._children)l instanceof A&&l.render(t);t.endCamera()}};rt([He()],H.prototype,"fill",void 0);rt([He()],H.prototype,"overlay",void 0);rt([xs()],H.prototype,"flow",void 0);rt([p({default:0})],H.prototype,"gap",void 0);rt([p({default:!1})],H.prototype,"wrap",void 0);rt([p({default:void 0})],H.prototype,"crossGap",void 0);rt([p({default:1})],H.prototype,"columns",void 0);rt([Pe()],H.prototype,"align",void 0);rt([p({default:1})],H.prototype,"zoom",void 0);rt([p({default:{x:0,y:0},tween:Jr})],H.prototype,"lookAt",void 0);rt([p({default:0})],H.prototype,"heading",void 0);rt([p({default:!1})],H.prototype,"space3D",void 0);rt([p({default:0})],H.prototype,"orbit",void 0);rt([p({default:0})],H.prototype,"elevation",void 0);rt([p({default:0})],H.prototype,"dolly",void 0);rt([I({args:[{key:"zoom",kind:"number",min:.01,step:.1,unit:"\xD7"}]})],H.prototype,"zoomTo",null);rt([I({args:[{key:"lookAt",kind:"vector2",properties:{x:{kind:"number"},y:{kind:"number"},z:{kind:"number"}}}]})],H.prototype,"panTo",null);rt([I({args:[{key:"orbit",kind:"number",step:1,unit:"\xB0"},{key:"elevation",kind:"number",step:1,unit:"\xB0"}]})],H.prototype,"orbitTo",null);rt([I({args:[{key:"dolly",kind:"number",step:10}]})],H.prototype,"dollyTo",null);rt([I({args:[{key:"heading",kind:"number",step:1,unit:"\xB0"}]})],H.prototype,"headingTo",null);rt([I()],H.prototype,"fillTo",null);rt([I()],H.prototype,"overlayTo",null);var Qe=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},j=class extends vt{overlayTo(t){let r=this.overlay,n=W.resolve(t.data),o=t.lerp??W.lerp;return this.command(s=>({overlay:o(r,n,s)}),t.duration,t.easing)}renderOverlay(t){let r=this.overlay;if(r.length===0)return;let n=this.shapeGraphics();n&&t.draw(n.fill(r))}declareAssets(t){super.declareAssets(t),t.fill(this.overlay)}applyDefaultSize(t){let r=A.flowChildrenProp(t),n=r.length>0,o=t?.flow??"freeform",s=o==="horizontal"||o==="freeform"||o==="grid",i=o==="vertical"||o==="freeform",a=n&&s&&A.hasFillChild(r,"width")?"fill":n?"hug":"fill",l=n&&i&&A.hasFillChild(r,"height")?"fill":n?"hug":"fill";(!t||t.width===void 0)&&this.applyProp("width",a,{tween:ct.lerp}),(!t||t.height===void 0)&&this.applyProp("height",l,{tween:ct.lerp})}flowArrangement(){return this}effectivePadding(){let t=0,r=this.padding,n=this.stroke;if(!n||!(Symbol.iterator in Object(n)))return r;for(let o of n){let s=o.weight*(1-o.align)/2;s>t&&(t=s)}return t===0?r:{left:r.left+t,right:r.right+t,top:r.top+t,bottom:r.bottom+t}}};Qe([He()],j.prototype,"overlay",void 0);Qe([xs()],j.prototype,"flow",void 0);Qe([p({default:0})],j.prototype,"gap",void 0);Qe([p({default:!1})],j.prototype,"wrap",void 0);Qe([p({default:void 0})],j.prototype,"crossGap",void 0);Qe([p({default:1})],j.prototype,"columns",void 0);Qe([Pe()],j.prototype,"align",void 0);Qe([I()],j.prototype,"overlayTo",null);var tr=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Rt=class extends j{constructor(t){super(t)}zoomTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}panTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}headingTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}shapeGraphics(){return new D().rect({width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end})}clipSelf(){return new K().rect({width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle})}_cameraScope(){return{lookAt:this.lookAt,zoom:this.zoom,heading:this.heading}}_rendersChildrenInSpace(){return!1}renderChildren(t){let r=this.layoutBounds,n=r?.width??0,o=r?.height??0,s=r?.x??0,i=r?.y??0;t.beginCamera({x:s,y:-i,width:n,height:o},this.lookAt,this.zoom,this.heading);for(let a of this._children)a instanceof A&&a.render(t);t.endCamera()}};tr([p({default:1})],Rt.prototype,"zoom",void 0);tr([p({default:{x:0,y:0},tween:P})],Rt.prototype,"lookAt",void 0);tr([p({default:0})],Rt.prototype,"heading",void 0);tr([Kn()],Rt.prototype,"cornerRadius",void 0);tr([Hn()],Rt.prototype,"cornerStyle",void 0);tr([I({args:[{key:"zoom",kind:"number",min:.01,step:.1,unit:"\xD7"}]})],Rt.prototype,"zoomTo",null);tr([I({args:[{key:"lookAt",kind:"vector2",properties:{x:{kind:"number"},y:{kind:"number"}}}]})],Rt.prototype,"panTo",null);tr([I({args:[{key:"heading",kind:"number",step:1,unit:"\xB0"}]})],Rt.prototype,"headingTo",null);var Qt=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Yg=1e3,St=class extends A{constructor(t){super(t),t?.perspective===void 0&&t?.transform3D===void 0&&this._writeProp("perspective",Yg)}orbitTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}dollyTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}zoomTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}panTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}headingTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}applyDefaultSize(t){(!t||t.width===void 0)&&this.applyProp("width","hug",{tween:ct.lerp}),(!t||t.height===void 0)&&this.applyProp("height","hug",{tween:ct.lerp})}_spaceCamera(){return{perspective:this.perspective,orbit:this.orbit+this.orbitSpeed*this._time.total,elevation:this.elevation,dolly:this.dolly,lookAt:this.lookAt,zoom:this.zoom,heading:this.heading,viewportX:0,viewportY:0}}_projection(){return wr}};Qt([p({default:{x:0,y:0},tween:Jr})],St.prototype,"lookAt",void 0);Qt([p({default:1})],St.prototype,"zoom",void 0);Qt([p({default:0})],St.prototype,"heading",void 0);Qt([p({default:0})],St.prototype,"orbit",void 0);Qt([p({default:0})],St.prototype,"elevation",void 0);Qt([p({default:0})],St.prototype,"dolly",void 0);Qt([p({default:0})],St.prototype,"orbitSpeed",void 0);Qt([I({args:[{key:"orbit",kind:"number",step:1,unit:"\xB0"},{key:"elevation",kind:"number",step:1,unit:"\xB0"}]})],St.prototype,"orbitTo",null);Qt([I({args:[{key:"dolly",kind:"number",step:10}]})],St.prototype,"dollyTo",null);Qt([I({args:[{key:"zoom",kind:"number",min:.01,step:.1,unit:"\xD7"}]})],St.prototype,"zoomTo",null);Qt([I({args:[{key:"lookAt",kind:"vector2",properties:{x:{kind:"number"},y:{kind:"number"},z:{kind:"number"}}}]})],St.prototype,"panTo",null);Qt([I({args:[{key:"heading",kind:"number",step:1,unit:"\xB0"}]})],St.prototype,"headingTo",null);function ol(e){let t=e._localBounds(),r=e._localMatrix(),n=t.x===0&&t.y===0?r:gt(r,Wn(t.x,-t.y)),o=en(n,t.width/2,t.height/2);return[o.topLeft,o.topRight,o.bottomRight,o.bottomLeft]}function sl(e){if(e.length===0)return null;let t=1/0,r=1/0,n=-1/0,o=-1/0;for(let s of e)s.x<t&&(t=s.x),s.x>n&&(n=s.x),s.y<r&&(r=s.y),s.y>o&&(o=s.y);return{minX:t,minY:r,maxX:n,maxY:o}}function il(e){return{x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2,width:e.maxX-e.minX,height:e.maxY-e.minY}}function js(e,t){let r=e.children;if(r.length===0)return null;if(t==="first"){let o=sl(ol(r[0]));return o?il(o):null}if(t==="union"){let o=sl(r.flatMap(ol));return o?il(o):null}let n=null;for(let o of r){let s=sl(ol(o));if(!s||(n=n?{minX:Math.max(n.minX,s.minX),minY:Math.max(n.minY,s.minY),maxX:Math.min(n.maxX,s.maxX),maxY:Math.min(n.maxY,s.maxY)}:s,n.minX>n.maxX||n.minY>n.maxY))return null}return n?il(n):null}var Bs=class extends j{constructor(t){super(t),this.applyProp("op",t.op??"union")}renderSelf(t){}_localBounds(){return js(this,Vg(this.op))??super._localBounds()}_rendersChildrenInSpace(){return!1}renderContent(t){this.applyTransform(t),this.renderContentWithEffects(t,()=>{t.beginBoolean(this.op);for(let n of this._children)n instanceof A&&n.render(t);t.endBoolean(),t.draw(new D().shadow(this.shadow).fill(this.fill));let r=this.overlay;r.length>0&&t.draw(new D().fill(r)),t.draw(new D().stroke(this.stroke))})}};function Vg(e){return e==="subtract"?"first":e==="intersect"?"intersect":"union"}var Ls=class extends A{constructor(t){super(t),this.applyProp("mode",t.mode??"alpha"),this.applyProp("inverted",t.inverted??!1)}_localBounds(){return js(this,"first")??super._localBounds()}_rendersChildrenInSpace(){return!1}renderContent(t){this.applyTransform(t),this._children.length!==0&&this.renderContentWithEffects(t,()=>{let[r,...n]=this.children;if(n.length===0){r.render(t);return}t.beginMask({mode:this.mode,inverted:this.inverted}),r.render(t),t.applyMask();for(let o of n)o.render(t);t.endMask()})}};var cp=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},nn=class extends A{constructor(t){super(t)}resolveContext(){return this.context}resolveValue(){return this.value}provideContext(t){let r=this.resolveContext();if(!r)return t;let n=this.resolveValue();return t.with(r,n!==void 0?n:r.defaultValue)}};cp([p({default:void 0})],nn.prototype,"context",void 0);cp([p({default:void 0})],nn.prototype,"value",void 0);var qs=Qn({},"text-style"),al=Qn({},"theme"),ll=Qn({},"data"),dp=Qn(void 0,"seed");var cl=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Mr=class extends A{constructor(t){super(t)}provideContext(t){let r=t;return this.theme&&(r=r.with(al,{...t.get(al),...this.theme})),this.data&&(r=r.with(ll,{...t.get(ll),...this.data})),this.seed!==void 0&&(r=r.with(dp,this.seed)),r}};cl([p({default:void 0})],Mr.prototype,"theme",void 0);cl([p({default:void 0})],Mr.prototype,"data",void 0);cl([p({default:void 0})],Mr.prototype,"seed",void 0);var me=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Ft=class extends A{constructor(t){super(t)}provideContext(t){let r=t.get(qs),n=ot.mergeStyle(r,this._props);return n===r?t:t.with(qs,n)}renderContent(t){t.pushTextStyle(this.currentStyle());try{super.renderContent(t)}finally{t.popTextStyle()}}currentStyle(){return ot.mergeStyle(Ke,this)}};me([p({default:void 0})],Ft.prototype,"fontFamily",void 0);me([p({default:void 0})],Ft.prototype,"fontSize",void 0);me([p({default:void 0})],Ft.prototype,"fontWeight",void 0);me([p({default:void 0})],Ft.prototype,"fontStyle",void 0);me([p({default:void 0})],Ft.prototype,"letterSpacing",void 0);me([p({default:void 0})],Ft.prototype,"lineHeight",void 0);me([p({default:void 0})],Ft.prototype,"textAlign",void 0);me([p({default:void 0})],Ft.prototype,"fill",void 0);me([p({default:void 0})],Ft.prototype,"stroke",void 0);me([p({default:void 0})],Ft.prototype,"shadow",void 0);function Ws(e,t){let r=t?.variant,n=ot.mergeStyle(ot.mergeStyle(ot.preset("default"),e.useContext(qs)),r?ot.preset(r):void 0),o=e;for(let s of us){if(t?.[s]!==void 0)continue;let i=n[s];i!==void 0&&(o[s]=i)}}var up=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},ye=class extends j{constructor(t){super(t)}shapeGraphics(){return new D().rect({width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end})}clipSelf(){return new K().rect({width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle})}};up([Kn()],ye.prototype,"cornerRadius",void 0);up([Hn()],ye.prototype,"cornerStyle",void 0);var dl=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Ar=class extends j{constructor(t){super(t)}shapeGraphics(){return new D().ellipse({width:this.layoutBounds.width,height:this.layoutBounds.height,startAngle:this.startAngle,sweep:this.sweep,ratio:this.ratio,start:this.start,end:this.end})}clipSelf(){return new K().ellipse({width:this.layoutBounds.width,height:this.layoutBounds.height,startAngle:this.startAngle,sweep:this.sweep,ratio:this.ratio})}};dl([p({default:0})],Ar.prototype,"startAngle",void 0);dl([p({default:360})],Ar.prototype,"sweep",void 0);dl([p({default:0})],Ar.prototype,"ratio",void 0);var ul=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Or=class extends j{constructor(t){super(t)}shapeGraphics(){return new D().line({points:this.points,radius:this.radius,closed:this.closed,start:this.start,end:this.end})}_localBounds(){let t=fp(this.stroke)/2;return Kg(this.points,t)??super._localBounds()}hitTestSelf(t,r){let n=this.points;if(n.length===0)return!1;let o=r+fp(this.stroke)/2;return n.length===1?Math.hypot(t.x-n[0].x,t.y-n[0].y)<=o:this.closed&&n.length>=3&&Fs(t,n)?!0:no(t,n,this.closed,o)}};ul([p({default:[]})],Or.prototype,"points",void 0);ul([p({default:0})],Or.prototype,"radius",void 0);ul([p({default:!1})],Or.prototype,"closed",void 0);function Kg(e,t){if(e.length===0)return null;let r=1/0,n=-1/0,o=1/0,s=-1/0;for(let i of e)i.x<r&&(r=i.x),i.x>n&&(n=i.x),i.y<o&&(o=i.y),i.y>s&&(s=i.y);return{x:(r+n)/2,y:(o+s)/2,width:n-r+t*2,height:s-o+t*2}}function fp(e){let t=0;for(let r of e)r.weight>t&&(t=r.weight);return t}var Hg=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},fl=class extends j{constructor(t){super(t)}applyDefaultSize(t){this.applyProp("width",t?.width??"hug"),this.applyProp("height",t?.height??"hug")}measure(t,r){let n=this.width,o=this.height;if(n!=="hug"&&o!=="hug")return super.measure(t,r);let s=kt.size(this.data),i=this.padding,a=typeof n=="number"?n:n==="hug"?s.width+i.left+i.right:t.maxWidth??0,l=typeof o=="number"?o:o==="hug"?s.height+i.top+i.bottom:t.maxHeight??0;return{width:a,height:l}}shapeGraphics(){return new D().path({data:this.data,start:this.start,end:this.end})}};Hg([Un()],fl.prototype,"data",void 0);var pl=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Er=class extends j{constructor(t){super(t)}shapeGraphics(){return new D().polygon({width:this.layoutBounds.width,height:this.layoutBounds.height,sides:this.sides,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end})}clipSelf(){return new K().polygon({width:this.layoutBounds.width,height:this.layoutBounds.height,sides:this.sides,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle})}};pl([p({default:5})],Er.prototype,"sides",void 0);pl([p({default:0})],Er.prototype,"cornerRadius",void 0);pl([p({default:"rounded",tween:xr})],Er.prototype,"cornerStyle",void 0);var Gs=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},er=class extends j{constructor(t){super(t)}shapeGraphics(){return new D().polygram({width:this.layoutBounds.width,height:this.layoutBounds.height,sides:this.sides,ratio:this.ratio,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end})}clipSelf(){return new K().polygram({width:this.layoutBounds.width,height:this.layoutBounds.height,sides:this.sides,ratio:this.ratio,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle})}};Gs([p({default:5})],er.prototype,"sides",void 0);Gs([p({default:.5})],er.prototype,"ratio",void 0);Gs([p({default:0})],er.prototype,"cornerRadius",void 0);Gs([p({default:"rounded",tween:xr})],er.prototype,"cornerStyle",void 0);var Vs=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},ge=class extends j{outlineOptions(){return{width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle}}outline(){return kt.anchorCommands(bc(this.kind(),this.outlineOptions()),t=>({x:t.x,y:-t.y}))}centerBounds(){let t=this.layoutBounds.width/2,r=this.layoutBounds.height/2;return[-t,-r,t,r]}shapeGraphics(){return new D().path({data:this.outline(),centerBounds:this.centerBounds(),start:this.start,end:this.end})}clipSelf(){return new K().rect({x:0,y:0,width:this.layoutBounds.width,height:this.layoutBounds.height})}};Vs([p({default:0})],ge.prototype,"cornerRadius",void 0);Vs([p({default:"rounded",tween:xr})],ge.prototype,"cornerStyle",void 0);var pp=class extends ge{constructor(t){super(t)}kind(){return"triangle"}},hp=class extends ge{constructor(t){super(t)}kind(){return"rightTriangle"}},mp=class extends ge{constructor(t){super(t)}kind(){return"pentagon"}},yp=class extends ge{constructor(t){super(t)}kind(){return"hexagon"}},gp=class extends ge{constructor(t){super(t)}kind(){return"octagon"}},Ys=class extends ge{constructor(t){super(t)}kind(){return"star"}outlineOptions(){return{...super.outlineOptions(),sides:Math.max(3,Math.round(this.points)),ratio:this.ratio}}};Vs([p({default:Sc})],Ys.prototype,"points",void 0);Vs([p({default:vc})],Ys.prototype,"ratio",void 0);var Ug=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},oo=class extends j{constructor(t){super(t)}toLocal(){let t=this.layoutBounds.width,r=this.layoutBounds.height;return n=>({x:n.x*t,y:-n.y*r})}outline(){return kt.anchorCommands(kt.anchors(this.data),this.toLocal())}centerBounds(){let t=this.layoutBounds.width/2,r=this.layoutBounds.height/2;return[-t,-r,t,r]}shapeGraphics(){return new D().path({data:this.outline(),centerBounds:this.centerBounds(),start:this.start,end:this.end})}clipSelf(){return new K().rect({x:0,y:0,width:this.layoutBounds.width,height:this.layoutBounds.height})}};Ug([Un()],oo.prototype,"data",void 0);function hl(e,t,r,n,o=0){let s=[],i=[],a=[],l=[],c=Ks(t.min-n,t.step,t.offset,o,Math.floor),d=Ks(t.max+n,t.step,t.offset,o,Math.ceil),u=Ks(e.min-n,e.step,e.offset,o,Math.floor),f=Ks(e.max+n,e.step,e.offset,o,Math.ceil);return Hs(e.min,e.max,e.step,e.offset,r,n,(h,y)=>{(y?s:i).push(h)}),Hs(t.min,t.max,t.step,t.offset,r,n,(h,y)=>{(y?a:l).push(h)}),{top:c,bottom:d,left:u,right:f,verticalMajor:s,verticalMinor:i,horizontalMajor:a,horizontalMinor:l}}function xp(e,t,r,n){let o=hl(e,t,r,n),s=[],i=[];for(let a of o.verticalMajor)s.push({type:"M",x:a,y:o.top},{type:"L",x:a,y:o.bottom});for(let a of o.verticalMinor)i.push({type:"M",x:a,y:o.top},{type:"L",x:a,y:o.bottom});for(let a of o.horizontalMajor)s.push({type:"M",x:o.left,y:a},{type:"L",x:o.right,y:a});for(let a of o.horizontalMinor)i.push({type:"M",x:o.left,y:a},{type:"L",x:o.right,y:a});return{major:s,minor:i}}function Ks(e,t,r,n,o){return n>0?o(e/n)*n:t<=0?e:o((e-r)/t)*t+r}function Hs(e,t,r,n,o,s,i){if(r<=0)return;let a=r*1e-6,l=Math.ceil((e-s-n-a)/r),c=Math.floor((t+s-n+a)/r);for(let d=l;d<=c;d++){let u=d*r+n,f=(d%o+o)%o===0;i(u,f)}}function on(e){let t=0;for(let r of e)r.weight>t&&(t=r.weight);return t}function sn(e){return e.map(t=>t.align===0?t:{...t,align:0})}function Us(e,t){return at.resolve(e.map(r=>({...r,fill:r.fill.map(n=>({...n,opacity:(n.opacity??1)*t}))})))}var Xs=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},rr=class extends j{get subStroke(){}set subStroke(t){}declareAssets(t){super.declareAssets(t);for(let r of this.subStroke)t.fill(r.fill)}constructor(t){super(t),t.subStroke===void 0&&t.stroke!==void 0&&this.subdivisions>1&&this.set({subStroke:Us(this.stroke,.5)})}renderSelf(t){let r=this.layoutBounds.width,n=this.layoutBounds.height,o=[-r/2,-n/2,r/2,n/2];t.draw(new D().rect({width:r,height:n,start:this.start,end:this.end}).shadow(this.shadow).fill(this.fill));let s=Math.max(1,Math.floor(this.divisions)),i=Math.max(1,Math.floor(this.subdivisions)),a=sn(this.stroke),l=sn(this.subStroke),c=Math.max(on(a),on(l))/2,{major:d,minor:u}=this.gridPaths(r,n,s,i,c);t.beginClip(new K().rect({width:r,height:n})),i>1&&l.length>0&&u.length>0&&t.draw(new D().path({data:u,centerBounds:o}).stroke(l)),d.length>0&&t.draw(new D().path({data:d,centerBounds:o}).stroke(a)),t.endClip()}clipSelf(){return new K().rect({width:this.layoutBounds.width,height:this.layoutBounds.height})}gridPaths(t,r,n,o,s){let i=n*o,a=Math.max(0,t-2*s),l=Math.max(0,r-2*s),c=t/2-s,d=r/2-s;return xp({min:-c,max:c,step:a/i,offset:this.offset.x},{min:-d,max:d,step:l/i,offset:this.offset.y},o,s)}};Xs([p({default:4})],rr.prototype,"divisions",void 0);Xs([p({default:1})],rr.prototype,"subdivisions",void 0);Xs([Sr()],rr.prototype,"subStroke",null);Xs([p({default:{x:0,y:0},tween:P})],rr.prototype,"offset",void 0);var so=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s};function _p(e,t,r,n,o,s){let i=[];return Hs(e,t,r,n,o,s,(a,l)=>{i.push({pos:a,isMajor:l})}),i}var Cr=class extends j{shapeGraphics(){let t=this.layoutBounds,r=t?.width??0,n=t?.height??0;if(r<=0||n<=0)return null;let o=Math.max(1,Math.floor(this.divisions)),s=Math.max(1,Math.floor(this.subdivisions)),i=Math.max(0,this.radius),a=i*Math.max(0,this.subScale);if(i<=0&&a<=0)return null;let l=o*s,c=Math.max(0,r/2-i),d=Math.max(0,n/2-i),u=_p(-c,c,c*2/l,this.offset.x,s,i),f=_p(-d,d,d*2/l,this.offset.y,s,i),h=new D,y=!1;for(let w of u)for(let g of f){let x=w.isMajor&&g.isMajor?i:a;x<=0||(h.ellipse({x:w.pos,y:g.pos,width:x*2,height:x*2}),y=!0)}return y?h:null}clipSelf(){let t=this.layoutBounds;return new K().rect({width:t?.width??0,height:t?.height??0})}};so([p({default:4})],Cr.prototype,"divisions",void 0);so([p({default:1})],Cr.prototype,"subdivisions",void 0);so([p({default:3})],Cr.prototype,"radius",void 0);so([p({default:.5})],Cr.prototype,"subScale",void 0);so([p({default:{x:0,y:0},tween:P})],Cr.prototype,"offset",void 0);var Zs=class extends j{renderSelf(t){let r=this.visibleBounds();t.beginClip(new K().rect({x:r.x,y:r.y,width:r.width,height:r.height})),this.renderPattern(t,r),t.endClip()}visibleBounds(){let t=this.findCamera();if(!t){let u=this.layoutBounds?.width??0,f=this.layoutBounds?.height??0;return{x:0,y:0,width:u,height:f}}let r=t.measuredWidth,n=t.measuredHeight,o=t.zoom||1,s=t.heading,i=r/2/o,a=n/2/o,l=i,c=a;if(s!==0){let u=s*Math.PI/180,f=Math.abs(Math.cos(u)),h=Math.abs(Math.sin(u));l=i*f+a*h,c=i*h+a*f}let d=t.lookAt;return{x:d.x,y:d.y,width:l*2,height:c*2}}findCamera(){for(let t=this.parent;t;t=t.parent)if(t instanceof Rt)return t;return null}};var Js=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},nr=class extends Zs{get subStroke(){}set subStroke(t){}declareAssets(t){super.declareAssets(t);for(let r of this.subStroke)t.fill(r.fill)}constructor(t){super(t),t.subStroke===void 0&&t.stroke!==void 0&&this.subdivisions>1&&this.set({subStroke:Us(this.stroke,.5)})}renderPattern(t,r){let n=r.width/2,o=r.height/2,s=r.x-n,i=r.x+n,a=r.y-o,l=r.y+o;t.draw(new D().rect({x:r.x,y:r.y,width:r.width,height:r.height,start:this.start,end:this.end}).shadow(this.shadow).fill(this.fill));let c=Math.max(1,Math.floor(this.subdivisions)),d=this.cellSize,u=Math.max(.001,typeof d=="number"?d:d.x),f=Math.max(.001,typeof d=="number"?d:d.y),h=u/c,y=f/c,w=sn(this.stroke),g=sn(this.subStroke),x=Math.max(on(w),on(g))/2,_={min:s,max:i,step:h,offset:this.offset.x},S={min:a,max:l,step:y,offset:this.offset.y};c>1&&g.length>0&&this.drawGroup(t,_,S,c,x,g,!1),w.length>0&&this.drawGroup(t,_,S,c,x,w,!0)}drawGroup(t,r,n,o,s,i,a){let l=Xg(i),c=hl(r,n,o,s,l),d=a?c.verticalMajor:c.verticalMinor,u=a?c.horizontalMajor:c.horizontalMinor,f=[-1,-1,1,1];if(l<=0){let h=[];for(let y of d)h.push({type:"M",x:y,y:c.top},{type:"L",x:y,y:c.bottom});for(let y of u)h.push({type:"M",x:c.left,y},{type:"L",x:c.right,y});h.length>0&&t.draw(new D().path({data:h,centerBounds:f}).stroke(i));return}for(let h of d){let y=[{type:"M",x:h,y:c.top},{type:"L",x:h,y:c.bottom}];t.draw(new D().path({data:y,centerBounds:f}).stroke(wp(i,c.top)))}for(let h of u){let y=[{type:"M",x:c.left,y:h},{type:"L",x:c.right,y:h}];t.draw(new D().path({data:y,centerBounds:f}).stroke(wp(i,c.left)))}}};Js([p({default:100,tween:Zg})],nr.prototype,"cellSize",void 0);Js([p({default:1})],nr.prototype,"subdivisions",void 0);Js([Sr()],nr.prototype,"subStroke",null);Js([p({default:{x:0,y:0},tween:P})],nr.prototype,"offset",void 0);function Xg(e){let t=0;for(let r of e)if(r.dash&&r.dash.length>0){let n=r.dash.reduce((o,s)=>o+s,0);n>t&&(t=n)}return t}function wp(e,t){return e.map(r=>r.dash&&r.dash.length>0?{...r,dashOffset:(r.dashOffset??0)-t}:r)}function Zg(e,t,r){return typeof e=="number"&&typeof t=="number"?m(e,t,r):P(typeof e=="number"?{x:e,y:e}:e,typeof t=="number"?{x:t,y:t}:t,r)}var Jg=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Qs=100,vp=new Set(["fontFamily","fontStyle"]),te=class{node;ranges;overrides;constructor(t,r){this.node=t,this.ranges=Qg(r,t.text.length),this.overrides={opacity:1,x:0,y:0,scale:1,rotation:0,fontFamily:t.fontFamily,fontSize:typeof t.fontSize=="number"?t.fontSize:Qs,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,fill:null,stroke:null},t._registerSelection(this)}get isIdentity(){let t=this.overrides,r=typeof this.node.fontSize=="number"?this.node.fontSize:Qs;return t.opacity===1&&t.x===0&&t.y===0&&t.scale===1&&t.rotation===0&&t.fontFamily===this.node.fontFamily&&t.fontSize===r&&t.fontStyle===this.node.fontStyle&&t.fontWeight===this.node.fontWeight&&t.letterSpacing===this.node.letterSpacing&&t.fill===null&&t.stroke===null}set(t){let r=this.overrides;for(let n of Object.keys(t)){let o=t[n];o!==void 0&&(n==="fill"?r.fill=W.resolve(o):n==="stroke"?r.stroke=at.resolve(o):(vp.has(n)||typeof o=="number")&&(r[n]=o))}return this}to(t){return vs(this,t.data??{},t.duration,t.easing)}_prepareStep(t,r,n){let o=this.overrides,s=[],i=[];for(let c of Object.keys(t)){let d=t[c];if(d!==void 0){if(c==="fill"){let u=o.fill??this.node.fill,f=W.resolve(d);i.push(h=>{o.fill=W.lerp(u,f,h)})}else if(c==="stroke"){let u=o.stroke??this.node.stroke,f=at.resolve(d);i.push(h=>{o.stroke=at.lerp(u,f,h)})}else if(vp.has(c)){let u=d,f=o[c];i.push(h=>{o[c]=h>=1?u:f})}else if(typeof d=="number"){let u=c;s.push({key:u,from:o[u],to:d})}}}let a=c=>{let d=n?n(c):c;for(let u of s)o[u.key]=u.from+(u.to-u.from)*d;for(let u of i)u(d)},l=0;return{seek:c=>a(r>0?Math.min(c/r,1):1),advance:c=>(l+=c,l<r?(a(l/r),!1):(a(1),!0))}}};Jg([I()],te.prototype,"to",null);function Qg(e,t){let r=e.map(o=>({start:Math.max(0,Math.min(o.start,t)),end:Math.max(0,Math.min(o.end,t))})).filter(o=>o.end>o.start).sort((o,s)=>o.start-s.start),n=[];for(let o of r){let s=n[n.length-1];s&&o.start<=s.end?s.end=Math.max(s.end,o.end):n.push({...o})}return n}var ee=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},mt=class extends vt{get wrapsText(){return!1}get glyphPath(){return null}styledRuns(){return[]}styleRuns(){return[]}resolveContext(t){Ws(this,this._props)}applyDefaultSize(t){let r=t?.fontSize==="autofit";this.applyProp("height",t?.height??(r?"fill":"hug")),this.applyProp("width",t?.width??(r?"fill":"hug"))}measure(t,r){let n=this.glyphPath;if(n!=null){let{width:x,height:_}=kt.size(n),S=this.width,b=this.height;return{width:typeof S=="number"?S:S==="hug"?x:t.maxWidth??x,height:typeof b=="number"?b:b==="hug"?_:t.maxHeight??_}}let o=this.fontSize==="autofit"?16:this.fontSize,s=this._casedText().split(`
2
- `),i=this.buildSegments(),a=i===null?null:tx(i,{fontFamily:this.fontFamily,fontSize:o,fontStyle:this.fontStyle,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing}),l=o*this.lineHeight,c=Math.max(...a?a.map(x=>x.runs.reduce((_,S)=>_+r.measureText(S.text,S.fontSize,S.fontFamily,S.fontWeight,S.letterSpacing,S.fontStyle).width,0)):s.map(x=>r.measureText(x,o,this.fontFamily,this.fontWeight,this.letterSpacing,this.fontStyle).width)),d=this.width,u=this.height,f=typeof d=="number"?d:d==="hug"?c:t.maxWidth??0,h=this.wrapsText&&f>0,y=a===null?null:h?ex(a,f,r):a.map(x=>Math.max(...x.runs.map(_=>_.fontSize))),w=y?y.reduce((x,_)=>x+_*this.lineHeight,0):(h?s.reduce((x,_)=>x+rx(_,f,o,this.fontFamily,this.fontWeight,r,this.letterSpacing,this.fontStyle),0):s.length)*l;return{width:f,height:typeof u=="number"?u:w}}buildSegments(){if(this.glyphPath!=null)return null;let t=this.styledRuns().filter(u=>u.ranges.length>0&&!u.isIdentity),r=this.styleRuns().filter(u=>u.end>u.start),n=this._casedText();if(n.length===0)return null;let o=this.start>0||this.end<1;if(t.length===0&&r.length===0&&!o)return null;let s=Math.round(this.start*n.length),i=Math.round(this.end*n.length),a=typeof this.fontSize=="number"?this.fontSize:Qs,l=new Set([0,n.length]);for(let u of r)l.add(u.start),l.add(u.end);for(let u of t)for(let f of u.ranges)l.add(f.start),l.add(f.end);o&&(l.add(s),l.add(i));let c=[...l].filter(u=>u>=0&&u<=n.length).sort((u,f)=>u-f),d=[];for(let u=0;u<c.length-1;u++){let f=c[u],h=c[u+1];if(h<=f)continue;let y={text:n.slice(f,h),fontFamily:this.fontFamily,fontSize:a,fontStyle:this.fontStyle,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,textDecoration:this.textDecoration,opacity:1,x:0,y:0,scale:1,rotation:0,fill:this.fill,stroke:this.stroke};for(let w of r)f<w.start||h>w.end||(w.fontFamily!==void 0&&(y.fontFamily=w.fontFamily),w.fontSize!==void 0&&(y.fontSize=w.fontSize),w.fontStyle!==void 0&&(y.fontStyle=w.fontStyle),w.fontWeight!==void 0&&(y.fontWeight=w.fontWeight),w.letterSpacing!==void 0&&(y.letterSpacing=w.letterSpacing),w.textDecoration!==void 0&&(y.textDecoration=w.textDecoration),w.fill!==void 0&&(y.fill=w.fill),w.stroke!==void 0&&(y.stroke=w.stroke));for(let w of t){if(!w.ranges.some(x=>f>=x.start&&h<=x.end))continue;let g=w.overrides;y.opacity*=g.opacity,y.x=g.x,y.y=g.y,y.scale=g.scale,y.rotation=g.rotation,g.fontFamily!==this.fontFamily&&(y.fontFamily=g.fontFamily),g.fontSize!==a&&(y.fontSize=g.fontSize),g.fontStyle!==this.fontStyle&&(y.fontStyle=g.fontStyle),g.fontWeight!==this.fontWeight&&(y.fontWeight=g.fontWeight),g.letterSpacing!==this.letterSpacing&&(y.letterSpacing=g.letterSpacing),g.fill!==null&&(y.fill=g.fill),g.stroke!==null&&(y.stroke=g.stroke)}o&&!(f>=s&&h<=i)&&(y.opacity=0),d.push(y)}return d}declareAssets(t){super.declareAssets(t),this.fontFamily&&t.font(this.fontFamily,this.fontWeight);for(let r of this.buildSegments()??[]){let n=r.fontFamily??this.fontFamily;n&&t.font(n,r.fontWeight),t.fill(r.fill??[]);for(let o of r.stroke??[])t.fill(o.fill)}}_textState(){return{text:this._casedText(),fontSize:this.fontSize,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontStyle:this.fontStyle,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,textAlign:this.textAlign,verticalAlign:this.verticalAlign,textDecoration:this.textDecoration,wrap:this.wrapsText,minFontSize:this.minFontSize,width:this.layoutBounds?.width??0,height:this.layoutBounds?.height??0,segments:this.buildSegments()??void 0,path:this.glyphPath}}textOpGraphics(){let t=this._textState();return{g:new D().text(t),segments:t.segments!=null}}renderSelf(t){let{g:r,segments:n}=this.textOpGraphics();r.shadow(this.shadow),n||r.fill(this.fill),t.draw(r)}renderStroke(t){let r=this.stroke;if(r.length===0)return;let{g:n,segments:o}=this.textOpGraphics();o||t.draw(n.stroke(r))}_casedText(){return ot.applyCase(this.displayText(),this.textCase)}};ee([p()],mt.prototype,"fontFamily",void 0);ee([p({default:48})],mt.prototype,"fontSize",void 0);ee([p({default:400})],mt.prototype,"fontWeight",void 0);ee([p({default:"normal"})],mt.prototype,"fontStyle",void 0);ee([p({default:0})],mt.prototype,"letterSpacing",void 0);ee([p({default:1.2})],mt.prototype,"lineHeight",void 0);ee([p({default:"center"})],mt.prototype,"textAlign",void 0);ee([p({default:"center",kind:"enum",options:["top","center","bottom"]})],mt.prototype,"verticalAlign",void 0);ee([p({default:"none",kind:"enum",options:["none","underline","line-through"]})],mt.prototype,"textDecoration",void 0);ee([p({default:"none",kind:"enum",options:["none","upper","lower","title"]})],mt.prototype,"textCase",void 0);ee([p({default:12})],mt.prototype,"minFontSize",void 0);ee([p({default:void 0})],mt.prototype,"variant",void 0);function tx(e,t){let r=[{runs:[]}];for(let n of e){let o={fontFamily:n.fontFamily??t.fontFamily,fontSize:n.fontSize??t.fontSize,fontStyle:n.fontStyle??t.fontStyle,fontWeight:n.fontWeight,letterSpacing:n.letterSpacing},s=n.text.split(`
3
- `);for(let i=0;i<s.length;i++)i>0&&r.push({runs:[]}),r[r.length-1].runs.push({text:s[i],...o})}for(let n of r)n.runs.length===0&&n.runs.push({...t,text:""});return r}function ex(e,t,r){let n=[];for(let o of e){let s=[];for(let l of o.runs)for(let c of l.text.split(/(\s+)/)){if(c.length===0)continue;let d=/^\s+$/.test(c),u=r.measureText(c,l.fontSize,l.fontFamily,l.fontWeight,l.letterSpacing,l.fontStyle).width,f=s[s.length-1];f&&!f.space&&!d?(f.width+=u,f.size=Math.max(f.size,l.fontSize)):s.push({width:u,size:l.fontSize,space:d})}if(s.length===0){n.push(Math.max(...o.runs.map(l=>l.fontSize)));continue}let i=s[0].width,a=s[0].size;for(let l of s.slice(1))i+l.width<=t?(i+=l.width,a=Math.max(a,l.size)):(n.push(a),i=l.space?0:l.width,a=l.space?0:l.size);n.push(a>0?a:Math.max(...o.runs.map(l=>l.fontSize)))}return n}function rx(e,t,r,n,o,s,i=0,a="normal"){if(e.length===0||s.measureText(e,r,n,o,i,a).width<=t)return 1;let l=e.split(/(\s+)/).filter(u=>u.length>0),c=1,d=0;for(let u of l){let f=s.measureText(u,r,n,o,i,a).width;d===0?d=f:d+f<=t?d+=f:(c++,d=/^\s+$/.test(u)?0:f)}return c}var Fe=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Gt=class extends vt{constructor(t){super(t)}resolveContext(t){Ws(this,this._props)}applyDefaultSize(t){this.applyProp("height",t?.height??"hug"),this.applyProp("width",t?.width??"hug")}runs(){return ot.flatten(this.spans,{fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontStyle:this.fontStyle,letterSpacing:this.letterSpacing,fill:this.fill,stroke:this.stroke})}declareAssets(t){super.declareAssets(t);for(let r of this.runs()){r.fontFamily&&t.font(r.fontFamily,r.fontWeight),t.fill(r.fill);for(let n of r.stroke)t.fill(n.fill)}}measure(t,r){let n=this.runs(),o=0,s=0,i=0,a=0,l=()=>{o>i&&(i=o),a+=s,o=0,s=0};for(let h of n){let y=h.fontSize*this.lineHeight,w=h.text.split(`
4
- `);for(let g=0;g<w.length;g++)g>0&&l(),o+=r.measureText(w[g],h.fontSize,h.fontFamily,h.fontWeight,h.letterSpacing,h.fontStyle).width,y>s&&(s=y)}l(),a===0&&(a=this.fontSize*this.lineHeight);let c=this.width,d=this.height,u=typeof c=="number"?c:c==="hug"?i:t.maxWidth??0,f=typeof d=="number"?d:d==="hug"?a:t.maxHeight??0;return{width:u,height:f}}renderSelf(t){t.draw(new D().richText({spans:this.runs(),lineHeight:this.lineHeight,textAlign:this.textAlign,width:this.layoutBounds?.width??0,height:this.layoutBounds?.height??0}))}};Fe([p({default:[],mapper:e=>e==null?[]:Array.isArray(e)?e:[e]})],Gt.prototype,"spans",void 0);Fe([p()],Gt.prototype,"fontFamily",void 0);Fe([p({default:48})],Gt.prototype,"fontSize",void 0);Fe([p({default:400})],Gt.prototype,"fontWeight",void 0);Fe([p({default:"normal"})],Gt.prototype,"fontStyle",void 0);Fe([p({default:0})],Gt.prototype,"letterSpacing",void 0);Fe([p({default:1.2})],Gt.prototype,"lineHeight",void 0);Fe([p({default:"center"})],Gt.prototype,"textAlign",void 0);Fe([p({default:void 0})],Gt.prototype,"variant",void 0);var an=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s};function nx(e){return e==null?null:e instanceof Ht?e.toCommands():e}function ox(e){return Array.isArray(e)?e.map(({fill:t,stroke:r,...n})=>({...n,...t===void 0?{}:{fill:W.resolve(t)},...r===void 0?{}:{stroke:at.resolve(r)}})):[]}var re=class extends mt{constructor(t){super(t)}displayText(){return this.text}get wrapsText(){return this.wrap}get glyphPath(){return this.path}styledRuns(){return this._selections}styleRuns(){return this.runs}applyDefaultSize(t){let r=t?.fontSize==="autofit";this.applyProp("height",t?.height??(r?"fill":"hug")),this.applyProp("width",t?.width??(r||t?.wrap?"fill":"hug"))}append(t){let r=t.data.text;return this.to({data:{text:this.text+r},duration:t.duration,easing:t.easing})}prepend(t){let r=t.data.text;return this.to({data:{text:r+this.text},duration:t.duration,easing:t.easing})}_selections=[];_registerSelection(t){this._selections.push(t)}find(t,r){let n=this.text,o=[];if(t.length>0){let a=0,l;for(;(l=n.indexOf(t,a))!==-1;)o.push({start:l,end:l+t.length}),a=l+t.length}let s=r?.index??0,i=o[s]?[o[s]]:[];return new te(this,i)}match(t){let r=t.flags.includes("g")?t.flags:t.flags+"g",n=new RegExp(t.source,r),o=[],s;for(;(s=n.exec(this.text))!==null;){if(s[0].length===0){n.lastIndex++;continue}o.push({start:s.index,end:s.index+s[0].length})}return new te(this,o)}line(t){let r=this.text.split(`
5
- `),n=0;for(let o=0;o<r.length;o++){let s=r[o].length;if(o===t)return new te(this,[{start:n,end:n+s}]);n+=s+1}return new te(this,[])}words(){return new te(this,this._wordRanges())}word(t){let r=this._wordRanges()[t];return new te(this,r?[r]:[])}slice(t,r){return new te(this,[{start:t,end:r}])}filter(t){let r=[],n=-1;for(let o=0;o<this.text.length;o++)t(this.text[o],o)?n===-1&&(n=o):n!==-1&&(r.push({start:n,end:o}),n=-1);return n!==-1&&r.push({start:n,end:this.text.length}),new te(this,r)}_wordRanges(){let t=[],r=/\S+/g,n;for(;(n=r.exec(this.text))!==null;)t.push({start:n.index,end:n.index+n[0].length});return t}};an([Ga()],re.prototype,"text",void 0);an([p({default:!1})],re.prototype,"wrap",void 0);an([p({default:null,mapper:nx})],re.prototype,"path",void 0);an([p({default:[],mapper:ox,animatable:!1})],re.prototype,"runs",void 0);an([I({args:[{key:"text",kind:"text",default:"",multiline:!0}]})],re.prototype,"append",null);an([I({args:[{key:"text",kind:"text",default:"",multiline:!0}]})],re.prototype,"prepend",null);var Pr=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},oe=class extends mt{constructor(t){super(t)}displayText(){return this.formatted()}formatted(){return kc(this.value,Mc(this))}countTo(t){return this.to({data:t.data,duration:t.duration,easing:t.easing})}};Pr([p({default:0})],oe.prototype,"value",void 0);Pr([p({default:"number"})],oe.prototype,"format",void 0);Pr([p({default:""})],oe.prototype,"customPattern",void 0);Pr([p({default:0})],oe.prototype,"fractionDigits",void 0);Pr([p({default:!0})],oe.prototype,"grouped",void 0);Pr([p({default:"$"})],oe.prototype,"currencySymbol",void 0);Pr([I({args:[{key:"value",kind:"number"}]})],oe.prototype,"countTo",null);var sx=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},io=class extends A{constructor(t){super(t),this._writeProp("rotation",()=>this.angle)}measure(t,r){this.lastMeasure={constraints:t,measurer:r};let n=this.angle*(Math.PI/180),o=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),i=Math.abs(this.angle%180)===90,a={maxWidth:t.maxWidth!==void 0&&t.maxHeight!==void 0?t.maxWidth*o+t.maxHeight*s:i?t.maxHeight:t.maxWidth,maxHeight:t.maxWidth!==void 0&&t.maxHeight!==void 0?t.maxWidth*s+t.maxHeight*o:i?t.maxWidth:t.maxHeight},l=0,c=0;for(let f of this.flowChildren()){let h=f.measure(a,r);(h.width??0)>l&&(l=h.width??0),(h.height??0)>c&&(c=h.height??0)}let d=l*o+c*s,u=l*s+c*o;return{width:this.resolveSizeInput(this.width,t.maxWidth??0,d),height:this.resolveSizeInput(this.height,t.maxHeight??0,u)}}layoutChildren(t,r){let n=this.angle*(Math.PI/180),o=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),i={x:t.x,y:t.y,width:t.width*o+t.height*s,height:t.width*s+t.height*o};super.layoutChildren(i,r)}};sx([p({default:-90})],io.prototype,"angle",void 0);var ut=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Q=class extends ye{_video=null;_videoKey="";constructor(t){super(t)}playedAt(t){let r=this.segments;if(!r||r.length===0)return null;let n=0;for(let o of r){if(t<=o.at)break;let s=o.speed??this.speed??1;n+=Math.min(t-o.at,o.duration)*s}return n}scheduledTimestamp(){let t=this.playedAt(this.time.elapsed);if(t===null)return;let r=this.trimStart??0,n=this.segments[0],o=n?n.from-r:0;return ia(t+o,r,this.trimEnd??1/0,this.loop,this.duration)}videoKey(){let t=this.crop,r=this.anchor;return[this.src??"",this.fit??"",this.zoom,this.playing?1:0,t.left,t.right,t.top,t.bottom,r.x,r.y,this.timestamp??"",this.trimStart??"",this.trimEnd??"",this.speed??"",this.loop??"",this.duration??"",this.scheduledTimestamp()??""].join("|")}syncVideo(){if(!this.src){this._video=null,this._videoKey="";return}let t=this.videoKey();if(t===this._videoKey&&this._video)return;this._videoKey=t;let r={type:"video",src:this.src,fit:this.fit,crop:this.crop,zoom:this.zoom,anchor:this.anchor,matrix:this.matrix,filters:this.filters,playing:this.playing,timestamp:this.timestamp??this.scheduledTimestamp(),trimStart:this.trimStart,trimEnd:this.trimEnd,speed:this.speed,loop:this.loop,duration:this.duration};this._video=Ge(r)}declareAssets(t){super.declareAssets(t),this.src&&t.fill(Ge({type:"video",src:this.src,filters:this.filters,trimStart:this.trimStart,trimEnd:this.trimEnd}))}declareAudio(t){let r=this.src;if(!r||this.muted)return;let n=this._busPath(t);if(this.segments.length>0){let s=this.trimEnd??t.catalog.getMediaDuration(r);for(let i of this.segments){let a=i.speed??this.speed??1,l=i.from,c=Math.min(s,l+i.duration*a);c>l&&t.clip({src:r,at:t.span.start+i.at,volume:i.volume??this.volume,trimStart:l,trimEnd:c,filters:this._soundFilters(a),bus:n})}return}if(!this.playing)return;let o=(this.loop??"none")!=="none";t.clip({src:r,volume:this.volume,loop:o,trimStart:this.trimStart,trimEnd:this.trimEnd??(o?void 0:t.catalog.getMediaDuration(r)),filters:this._soundFilters(this.speed??1),bus:n})}_soundFilters(t){let r=[];return t!==1&&r.push(...fe(Zr.speed(t))),r.push(...this.audioFilters),r}_busPath(t){if(!this.bus)return;let r=nl(this,this.bus);return r?rl(r,t):void 0}rectState(){return{width:this.layoutBounds.width,height:this.layoutBounds.height,cornerRadius:this.cornerRadius,cornerStyle:this.cornerStyle,start:this.start,end:this.end}}shapeGraphics(){return new D().rect(this.rectState())}renderOverlay(t){let r=this.overlay;if(r.length===0)return;let n=(this.syncVideo(),this._video);n&&t.draw(new D().mask().rect(this.rectState()).fill([n]).applyMask().rect(this.rectState()).fill(r).endMask())}renderSelf(t){this.syncVideo();let r=[this._video??Au];r.push(...this.fill),t.draw(this.shapeGraphics().shadow(this.shadow).fill(r))}dispose(){this._video=null,this._videoKey="",super.dispose()}};ut([p()],Q.prototype,"src",void 0);ut([p()],Q.prototype,"fit",void 0);ut([Xn()],Q.prototype,"crop",void 0);ut([p({default:1})],Q.prototype,"zoom",void 0);ut([Pe()],Q.prototype,"anchor",void 0);ut([p()],Q.prototype,"matrix",void 0);ut([p({default:[],tween:Fn,mapper:zn})],Q.prototype,"filters",void 0);ut([p({default:!0})],Q.prototype,"playing",void 0);ut([p()],Q.prototype,"timestamp",void 0);ut([p()],Q.prototype,"trimStart",void 0);ut([p()],Q.prototype,"trimEnd",void 0);ut([p()],Q.prototype,"speed",void 0);ut([p()],Q.prototype,"loop",void 0);ut([p()],Q.prototype,"duration",void 0);ut([p({default:1})],Q.prototype,"volume",void 0);ut([p({default:!1})],Q.prototype,"muted",void 0);ut([p({default:[],mapper:fe})],Q.prototype,"audioFilters",void 0);ut([p({default:void 0})],Q.prototype,"bus",void 0);ut([p({default:[]})],Q.prototype,"segments",void 0);var ix=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},ln=class extends At{};ix([p({default:!1})],ln.prototype,"solo",void 0);var ao=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},xe=class extends At{declareAudio(t){this.src&&t.clip({src:this.src,trimStart:this.trimStart,trimEnd:this.trimEnd,loop:this.loop,filters:this._filterChain(),bus:$s(this,t)})}acceptsChild(t){return!1}_filterChain(){let r=[...this.filters],n=this.volume;return(Sa(n,1)!==1||typeof n!="number")&&r.push(...Zr.gain(n)),this.speed!==1&&r.push(...Zr.speed(this.speed)),r}};ao([p()],xe.prototype,"src",void 0);ao([p({default:0})],xe.prototype,"trimStart",void 0);ao([p({default:void 0})],xe.prototype,"trimEnd",void 0);ao([p({default:!1})],xe.prototype,"loop",void 0);ao([p({default:1})],xe.prototype,"speed",void 0);var Ot=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Sp={position:["x","y","z"],rotation:["rotationX","rotationY","rotationZ"],scale:["scaleX","scaleY","scaleZ"]},$=class e extends ht{get dimension(){return"3d"}constructor(t){super(t),this.initProps(ml(t)),this.adoptChildrenProp(t)}get position(){return{x:this.x,y:this.y,z:this.z}}set position(t){this.set({position:t})}get rotation(){return{x:this.rotationX,y:this.rotationY,z:this.rotationZ,order:this.rotationOrder}}set rotation(t){this.set({rotation:t})}get scale(){return{x:this.scaleX,y:this.scaleY,z:this.scaleZ}}set scale(t){this.set({scale:t})}set(t){super.set(ml(t))}_prepareStep(t,r,n){return super._prepareStep(ml(t),r,n)}transform3D(){let t=this.quaternion,r=t.x===0&&t.y===0&&t.z===0&&t.w===1;return{position:this.position,rotation:this.rotation,quaternion:r?void 0:t,scale:this.scale,lookAt:this.lookAt,visible:this.visible,shadow:this.shadow,renderOrder:this.renderOrder}}groupTransform(){return this.transform3D()}renderSelf(t){}render(t){if(this.hidden){t.begin({id:this.id,transform:{...this.groupTransform(),visible:!1}}),t.end();return}t.begin({id:this.id,transform:this.groupTransform()}),this.renderSelf(t);for(let r of this._children)r instanceof e&&r.render(t);t.end()}declareAssets(t){if(this.renderSelf===e.prototype.renderSelf)return;let r=new Lt;this.renderSelf(r),Ur(r,t)}};Ot([p({default:0})],$.prototype,"x",void 0);Ot([p({default:0})],$.prototype,"y",void 0);Ot([p({default:0})],$.prototype,"z",void 0);Ot([p({default:0})],$.prototype,"rotationX",void 0);Ot([p({default:0})],$.prototype,"rotationY",void 0);Ot([p({default:0})],$.prototype,"rotationZ",void 0);Ot([p({default:"XYZ"})],$.prototype,"rotationOrder",void 0);Ot([wf()],$.prototype,"quaternion",void 0);Ot([p({default:1})],$.prototype,"scaleX",void 0);Ot([p({default:1})],$.prototype,"scaleY",void 0);Ot([p({default:1})],$.prototype,"scaleZ",void 0);Ot([p({default:void 0})],$.prototype,"lookAt",void 0);Ot([p({default:!0})],$.prototype,"visible",void 0);Ot([p({default:!0})],$.prototype,"shadow",void 0);Ot([p({default:0})],$.prototype,"renderOrder",void 0);function ml(e){if(!e)return e;let t;for(let r in Sp){let n=e[r];if(n===void 0)continue;t??={...e},delete t[r];let o=Sp[r];if(typeof n=="function"){let i=n;for(let a=0;a<3;a++){let l=o[a];t[l]===void 0&&(t[l]=()=>bp(pt(i()),a))}continue}let s=pt(n);for(let i=0;i<3;i++){let a=o[i];t[a]===void 0&&(t[a]=bp(s,i))}if(r==="rotation"){let i=n.order;i!==void 0&&t.rotationOrder===void 0&&(t.rotationOrder=i)}}return t??e}function bp(e,t){return t===0?e.x:t===1?e.y:e.z}var ti=class extends ${};var st=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},ax=["opacity","roughness","metalness","emission","emissionStrength","normalMap","roughnessMap","metalnessMap","aoMap","alphaMap","envMapIntensity","wireframe","shading","faces","vertexColors","blend"],z=class extends ${buildGeometry(){return this.geometry}materialShorthand(){let t={},r=this.material;r!==void 0&&(t.material=r),this.fill!==void 0&&(t.fill=this.fill);for(let n of ax){let o=this[n];o!==void 0&&(t[n]=o)}return this.unlit&&(t.unlit=!0),t}buildGraphics3D(){let t=new Dt,r=this.buildGeometry();return r&&t.mesh(r,Kr(this.materialShorthand())),t}renderSelf(t){t.draw(this.buildGraphics3D())}};st([p({default:void 0})],z.prototype,"geometry",void 0);st([p({default:void 0})],z.prototype,"material",void 0);st([p({default:"white",tween:Ho})],z.prototype,"fill",void 0);st([p({default:void 0})],z.prototype,"opacity",void 0);st([p({default:void 0})],z.prototype,"roughness",void 0);st([p({default:void 0})],z.prototype,"metalness",void 0);st([qt({default:void 0})],z.prototype,"emission",void 0);st([p({default:void 0})],z.prototype,"emissionStrength",void 0);st([p({default:void 0})],z.prototype,"normalMap",void 0);st([p({default:void 0})],z.prototype,"roughnessMap",void 0);st([p({default:void 0})],z.prototype,"metalnessMap",void 0);st([p({default:void 0})],z.prototype,"aoMap",void 0);st([p({default:void 0})],z.prototype,"alphaMap",void 0);st([p({default:void 0})],z.prototype,"envMapIntensity",void 0);st([p({default:void 0})],z.prototype,"wireframe",void 0);st([p({default:void 0})],z.prototype,"shading",void 0);st([p({default:void 0})],z.prototype,"faces",void 0);st([p({default:void 0})],z.prototype,"vertexColors",void 0);st([p({default:void 0})],z.prototype,"blend",void 0);st([p({default:!1})],z.prototype,"unlit",void 0);var O=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s};function It(e,t,r){let n={type:e};for(let o of r){let s=t[o];s!==void 0&&(n[o]=s)}return n}var Fr=["startAngle","sweep"],lx=["width","height","depth","cornerRadius","segments"],Ie=class extends z{buildGeometry(){return It("box",this,lx)}};O([p({default:void 0})],Ie.prototype,"width",void 0);O([p({default:void 0})],Ie.prototype,"height",void 0);O([p({default:void 0})],Ie.prototype,"depth",void 0);O([p({default:void 0})],Ie.prototype,"cornerRadius",void 0);O([p({default:void 0})],Ie.prototype,"segments",void 0);var cx=["radius","segments","startLatitude","latitudeSweep",...Fr],_e=class extends z{buildGeometry(){return It("sphere",this,cx)}};O([p({default:void 0})],_e.prototype,"radius",void 0);O([p({default:void 0})],_e.prototype,"segments",void 0);O([p({default:void 0})],_e.prototype,"startAngle",void 0);O([p({default:void 0})],_e.prototype,"sweep",void 0);O([p({default:void 0})],_e.prototype,"startLatitude",void 0);O([p({default:void 0})],_e.prototype,"latitudeSweep",void 0);var dx=["width","height","segments"],Tr=class extends z{buildGeometry(){return It("plane",this,dx)}};O([p({default:void 0})],Tr.prototype,"width",void 0);O([p({default:void 0})],Tr.prototype,"height",void 0);O([p({default:void 0})],Tr.prototype,"segments",void 0);var ux=["radius","height","segments","capped",...Fr],we=class extends z{buildGeometry(){return It("cylinder",this,ux)}};O([p({default:void 0})],we.prototype,"radius",void 0);O([p({default:void 0})],we.prototype,"height",void 0);O([p({default:void 0})],we.prototype,"segments",void 0);O([p({default:void 0})],we.prototype,"capped",void 0);O([p({default:void 0})],we.prototype,"startAngle",void 0);O([p({default:void 0})],we.prototype,"sweep",void 0);var fx=["radius","height","segments","capped",...Fr],ve=class extends z{buildGeometry(){return It("cone",this,fx)}};O([p({default:void 0})],ve.prototype,"radius",void 0);O([p({default:void 0})],ve.prototype,"height",void 0);O([p({default:void 0})],ve.prototype,"segments",void 0);O([p({default:void 0})],ve.prototype,"capped",void 0);O([p({default:void 0})],ve.prototype,"startAngle",void 0);O([p({default:void 0})],ve.prototype,"sweep",void 0);var px=["radius","thickness","segments",...Fr],ze=class extends z{buildGeometry(){return It("torus",this,px)}};O([p({default:void 0})],ze.prototype,"radius",void 0);O([p({default:void 0})],ze.prototype,"thickness",void 0);O([p({default:void 0})],ze.prototype,"segments",void 0);O([p({default:void 0})],ze.prototype,"startAngle",void 0);O([p({default:void 0})],ze.prototype,"sweep",void 0);var hx=["radius","thickness","segments","windings"],or=class extends z{buildGeometry(){return It("torusKnot",this,hx)}};O([p({default:void 0})],or.prototype,"radius",void 0);O([p({default:void 0})],or.prototype,"thickness",void 0);O([p({default:void 0})],or.prototype,"segments",void 0);O([p({default:void 0})],or.prototype,"windings",void 0);var mx=["radius","segments",...Fr],sr=class extends z{buildGeometry(){return It("circle",this,mx)}};O([p({default:void 0})],sr.prototype,"radius",void 0);O([p({default:void 0})],sr.prototype,"segments",void 0);O([p({default:void 0})],sr.prototype,"startAngle",void 0);O([p({default:void 0})],sr.prototype,"sweep",void 0);var yx=["radius","innerRadius","segments",...Fr],Ne=class extends z{buildGeometry(){return It("ring",this,yx)}};O([p({default:void 0})],Ne.prototype,"radius",void 0);O([p({default:void 0})],Ne.prototype,"innerRadius",void 0);O([p({default:void 0})],Ne.prototype,"segments",void 0);O([p({default:void 0})],Ne.prototype,"startAngle",void 0);O([p({default:void 0})],Ne.prototype,"sweep",void 0);var gx=["radius","height","segments"],Dr=class extends z{buildGeometry(){return It("capsule",this,gx)}};O([p({default:void 0})],Dr.prototype,"radius",void 0);O([p({default:void 0})],Dr.prototype,"height",void 0);O([p({default:void 0})],Dr.prototype,"segments",void 0);var xx=["shape","radius","segments"],Rr=class extends z{buildGeometry(){return It("polyhedron",this,xx)}};O([p({default:"icosahedron"})],Rr.prototype,"shape",void 0);O([p({default:void 0})],Rr.prototype,"radius",void 0);O([p({default:void 0})],Rr.prototype,"segments",void 0);var _x=["path","depth","segments","bevel"],ir=class extends z{buildGeometry(){return It("extrude",this,_x)}};O([p({default:void 0})],ir.prototype,"path",void 0);O([p({default:void 0})],ir.prototype,"depth",void 0);O([p({default:void 0})],ir.prototype,"segments",void 0);O([p({default:void 0})],ir.prototype,"bevel",void 0);var wx=["points","segments",...Fr],ar=class extends z{buildGeometry(){return It("lathe",this,wx)}};O([p({default:void 0})],ar.prototype,"points",void 0);O([p({default:void 0})],ar.prototype,"segments",void 0);O([p({default:void 0})],ar.prototype,"startAngle",void 0);O([p({default:void 0})],ar.prototype,"sweep",void 0);var vx=["points","radius","segments","closed"],lr=class extends z{buildGeometry(){return It("tube",this,vx)}};O([p({default:void 0})],lr.prototype,"points",void 0);O([p({default:void 0})],lr.prototype,"radius",void 0);O([p({default:void 0})],lr.prototype,"segments",void 0);O([p({default:void 0})],lr.prototype,"closed",void 0);var xt=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},cn=class extends z{buildGraphics3D(){let t=new Dt,r=this.buildGeometry(),n=this.instances;return!r||!n?.length||t.instances(r,this.resolvedMaterial(),n,{colors:this.colors}),t}resolvedMaterial(){let t=Kr(this.materialShorthand());return Array.isArray(t)?t[0]:t}};xt([p({default:void 0})],cn.prototype,"instances",void 0);xt([p({default:void 0})],cn.prototype,"colors",void 0);var ei=class extends z{buildGraphics3D(){let t=new Dt,r=this.buildGeometry();return r&&t.points(r,this.material),t}},se=class extends ${buildGraphics3D(){let t=new Dt,r=this.geometry,n=this.points;return!r&&!n?.length||t.line({points:r?void 0:n,geometry:r,closed:this.closed,segments:this.segments,stroke:this.stroke,opacity:this.opacity,material:this.material}),t}renderSelf(t){t.draw(this.buildGraphics3D())}};xt([p({default:void 0})],se.prototype,"points",void 0);xt([p({default:void 0})],se.prototype,"geometry",void 0);xt([p({default:!1})],se.prototype,"closed",void 0);xt([p({default:!1})],se.prototype,"segments",void 0);xt([p({default:void 0})],se.prototype,"stroke",void 0);xt([p({default:void 0})],se.prototype,"opacity",void 0);xt([p({default:void 0})],se.prototype,"material",void 0);var Ir=class extends ${buildGraphics3D(){return new Dt().sprite({fill:this.fill,opacity:this.opacity,material:this.material})}renderSelf(t){t.draw(this.buildGraphics3D())}};xt([p({default:void 0,tween:Ho})],Ir.prototype,"fill",void 0);xt([p({default:void 0})],Ir.prototype,"opacity",void 0);xt([p({default:void 0})],Ir.prototype,"material",void 0);var cr=class extends ${buildGraphics3D(){let t=new Dt;return this.src&&t.model({src:this.src,animation:this.animation,override:this.override}),t}renderSelf(t){t.draw(this.buildGraphics3D())}};xt([p({default:void 0})],cr.prototype,"src",void 0);xt([p({default:void 0})],cr.prototype,"animation",void 0);xt([p({default:void 0})],cr.prototype,"override",void 0);var ri=class extends cr{constructor(t){super(t)}buildGraphics3D(){let t=new Dt;return this.src?(t.model({src:this.src,animation:{clip:bx(this.clip),time:this.clipTime},override:this.override}),t):Sx(t)}};xt([p({default:""})],ri.prototype,"clip",void 0);xt([p({default:0})],ri.prototype,"clipTime",void 0);function Sx(e){return e.box({width:1,height:1,depth:1,material:{type:"basic",color:"#6b7280",wireframe:!0,transparent:!0,opacity:.7}})}function bx(e){let t=e.trim();if(t==="")return;let r=Number(t);return Number.isInteger(r)&&r>=0?r:t}var tt=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s};function fn(e,t,r){let n={type:e};for(let o of r){let s=t[o];s!==void 0&&(n[o]=s)}return n}var dn=class extends ${declareAssets(){}renderSelf(t){t.light(this.buildLight())}},lo=class extends dn{constructor(t){super(t),t?.shadow===void 0&&this.applyProp("shadow",!1)}},kx=["color","intensity"],un=class extends dn{buildLight(){return fn("ambient",this,kx)}};tt([qt({default:void 0})],un.prototype,"color",void 0);tt([p({default:void 0})],un.prototype,"intensity",void 0);var Mx=["sky","ground","intensity"],zr=class extends dn{buildLight(){return fn("hemisphere",this,Mx)}};tt([qt({default:void 0})],zr.prototype,"sky",void 0);tt([qt({default:void 0})],zr.prototype,"ground",void 0);tt([p({default:void 0})],zr.prototype,"intensity",void 0);var Ax=["color","intensity","target","shadow"],Nr=class extends lo{buildLight(){return fn("directional",this,Ax)}};tt([qt({default:void 0})],Nr.prototype,"color",void 0);tt([p({default:void 0})],Nr.prototype,"intensity",void 0);tt([p({default:void 0})],Nr.prototype,"target",void 0);var Ox=["color","intensity","distance","decay","shadow"],dr=class extends lo{buildLight(){return fn("point",this,Ox)}};tt([qt({default:void 0})],dr.prototype,"color",void 0);tt([p({default:void 0})],dr.prototype,"intensity",void 0);tt([p({default:void 0})],dr.prototype,"distance",void 0);tt([p({default:void 0})],dr.prototype,"decay",void 0);var Ex=["color","intensity","distance","angle","penumbra","decay","target","shadow"],ie=class extends lo{buildLight(){return fn("spot",this,Ex)}};tt([qt({default:void 0})],ie.prototype,"color",void 0);tt([p({default:void 0})],ie.prototype,"intensity",void 0);tt([p({default:void 0})],ie.prototype,"distance",void 0);tt([p({default:void 0})],ie.prototype,"angle",void 0);tt([p({default:void 0})],ie.prototype,"penumbra",void 0);tt([p({default:void 0})],ie.prototype,"decay",void 0);tt([p({default:void 0})],ie.prototype,"target",void 0);var Cx=["color","intensity","width","height"],ur=class extends dn{buildLight(){return fn("area",this,Cx)}};tt([qt({default:void 0})],ur.prototype,"color",void 0);tt([p({default:void 0})],ur.prototype,"intensity",void 0);tt([p({default:void 0})],ur.prototype,"width",void 0);tt([p({default:void 0})],ur.prototype,"height",void 0);var Se=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Px=["target","orbit","elevation","distance","fov","frustumHeight","near","far","zoom"],zt=class extends ${groupTransform(){return{}}buildCamera(){let t={type:this.type};for(let r of Px){let n=this[r];n!==void 0&&(t[r]=n)}return t}declareAssets(){}renderSelf(t){t.camera({...this.transform3D(),...this.buildCamera()})}};Se([p({default:"perspective"})],zt.prototype,"type",void 0);Se([p({default:void 0})],zt.prototype,"target",void 0);Se([p({default:void 0})],zt.prototype,"orbit",void 0);Se([p({default:void 0})],zt.prototype,"elevation",void 0);Se([p({default:void 0})],zt.prototype,"distance",void 0);Se([p({default:void 0})],zt.prototype,"fov",void 0);Se([p({default:void 0})],zt.prototype,"frustumHeight",void 0);Se([p({default:void 0})],zt.prototype,"near",void 0);Se([p({default:void 0})],zt.prototype,"far",void 0);Se([p({default:void 0})],zt.prototype,"zoom",void 0);var ke=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},fr=class extends ${renderSelf(t){let r={};this.color!==void 0&&(r.color=this.color),this.density!==void 0?r.density=this.density:(this.near!==void 0&&(r.near=this.near),this.far!==void 0&&(r.far=this.far)),t.fog(r)}declareAssets(t){}};ke([qt({default:void 0})],fr.prototype,"color",void 0);ke([p({default:void 0})],fr.prototype,"near",void 0);ke([p({default:void 0})],fr.prototype,"far",void 0);ke([p({default:void 0})],fr.prototype,"density",void 0);var be=class extends ${buildEnvironment(){let t={},r=!1;return this.src!==void 0&&(t.src=this.src,r=!0),this.faces!==void 0&&(t.faces=this.faces,r=!0),this.preset!==void 0&&(t.preset=this.preset,r=!0),r?(this.intensity!==void 0&&(t.intensity=this.intensity),this.background!==void 0&&(t.background=this.background),this.blur!==void 0&&(t.blur=this.blur),(this.rotationX||this.rotationY||this.rotationZ)&&(t.rotation=[this.rotationX,this.rotationY,this.rotationZ]),t):null}declareAssets(t){ya({src:this.src,faces:this.faces},t)}renderSelf(t){t.environment(this.buildEnvironment())}};ke([p({default:void 0})],be.prototype,"src",void 0);ke([p({default:void 0})],be.prototype,"faces",void 0);ke([p({default:void 0})],be.prototype,"preset",void 0);ke([p({default:void 0})],be.prototype,"intensity",void 0);ke([p({default:void 0})],be.prototype,"background",void 0);ke([p({default:void 0})],be.prototype,"blur",void 0);function Ap(e){let{size:t,divisions:r,majorEvery:n,showAxes:o,fade:s}=e,i=t/2,a=t/r,l=co(e.minorColor),c=co(e.majorColor),d=co(e.axisXColor),u=co(e.axisZColor),f=co(e.fadeTo),h=[],y=[],w=(g,x,_,S,b)=>{h.push(g,0,x,_,0,S),Mp(y,b,f,kp(g,x,i,s)),Mp(y,b,f,kp(_,S,i,s))};for(let g=0;g<=r;g++){let x=-i+g*a,_=Math.abs(g-r/2);if(Math.abs(x)<a/2&&o)continue;let b=Number.isInteger(_)&&_%n===0?c:l;w(x,-i,x,i,b),w(-i,x,i,x,b)}return o&&(w(-i,0,i,0,d),w(0,-i,0,i,u)),{type:"buffer",position:new Float32Array(h),color:new Float32Array(y),computeNormals:!1,staticData:!0}}function kp(e,t,r,n){if(n<=0)return 0;let o=Math.hypot(e,t)/r,s=1-n;if(o<=s)return 0;let i=Math.min(1,(o-s)/Math.max(n,1e-6));return i*i}function Mp(e,t,r,n){e.push(t[0]+(r[0]-t[0])*n,t[1]+(r[1]-t[1])*n,t[2]+(r[2]-t[2])*n)}function co(e){let[t,r,n]=de(e);return[yl(t),yl(r),yl(n)]}function yl(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}var X=function(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Tx=async()=>{await pa()},L=class e extends ye{gridCache=null;fadeColor(){let t=this.fill;if(Array.isArray(t))for(let r of t){let n=r;if(n?.type!=="solid")continue;let o=n.color;if(typeof o=="string"||Array.isArray(o)&&(o[3]??1)>0)return o}return this.gridFadeColor}gridDescriptor(){let t={size:this.gridSize,divisions:Math.max(1,Math.round(this.gridDivisions)),majorEvery:Math.max(1,Math.round(this.gridMajorEvery)),minorColor:this.gridColor,majorColor:this.gridMajorColor,axisXColor:this.axisXColor,axisZColor:this.axisZColor,showAxes:this.showAxes,fadeTo:this.fadeColor(),fade:this.gridFade},r=JSON.stringify(t);return this.gridCache?.key!==r&&(this.gridCache={key:r,geometry:Ap(t)}),this.gridCache.geometry}constructor(t){super(t??{})}acceptsChild(t){return!0}get children3D(){return this._allChildren.filter(t=>t instanceof $)}applyDefaultSize(t){(!t||t.width===void 0)&&this.applyProp("width","fill"),(!t||t.height===void 0)&&this.applyProp("height","fill")}buildScene3D(){let t=new Lt,r=$n(this.shadows);r&&t.shadows(r),(this.tone!==void 0||this.exposure!==void 0)&&t.tone({mapping:this.tone,exposure:this.exposure}),this.post!==void 0&&t.post(this.post);for(let o of this._children)o instanceof $&&o.render(t);let n=t.fogDescriptor();if(n&&n.color===void 0){let o=Dx(this.fill);o!==void 0&&t.fog({...n,color:o})}return this.showGrid&&t.draw(new Dt().line({geometry:this.gridDescriptor(),segments:!0,material:{type:"lineBasic",vertexColors:!0,toneMapped:!1}})),t.cameraDescriptor()===null&&t.perspective({fov:this.fov,orbit:Ac(this.orbit),elevation:this.elevation,distance:this.zoom}),t.ops().some(o=>o.kind==="light")||t.light({type:"ambient",intensity:this.ambientIntensity,color:this.ambientColor}).light({type:"directional",intensity:this.keyIntensity,color:this.keyColor},{position:[4,6,3]}).light({type:"directional",intensity:this.keyIntensity*.35,color:this.keyColor},{position:[-5,-2,-4]}),t}_scene3D(){return this.buildScene3D()}declareAssets(t){if(super.declareAssets(t),t.loader("three:runtime",Tx),this.buildScene3D===e.prototype.buildScene3D)return;let r=this.buildScene3D();r.isEmpty()||Ur(r,t)}bindSurfaceSources(t){Bn(t,r=>{if(!Hr(r))return;let n=jn(r.source);n.kind==="node"&&this.attachDetached(n.node)})}renderSelf(t){let r=this.buildScene3D(),n=r.isEmpty()?null:r;n&&(n.assertBalanced(),this.bindSurfaceSources(n));let o=n?[...Yr(this.fill),...ta.canvas3D(n,{maxPixelRatio:this.maxPixelRatio,antialias:this.antialias})]:this.fill;t.draw(this.shapeGraphics().shadow(this.shadow).fill(o))}};X([p({default:35})],L.prototype,"orbit",void 0);X([p({default:20})],L.prototype,"elevation",void 0);X([p({default:12})],L.prototype,"zoom",void 0);X([p({default:45})],L.prototype,"fov",void 0);X([p({default:.45})],L.prototype,"ambientIntensity",void 0);X([p({default:"#ffffff",mapper:de,tween:qe})],L.prototype,"ambientColor",void 0);X([p({default:2.4})],L.prototype,"keyIntensity",void 0);X([p({default:"#ffffff",mapper:de,tween:qe})],L.prototype,"keyColor",void 0);X([p({default:!1})],L.prototype,"showGrid",void 0);X([p({default:40})],L.prototype,"gridSize",void 0);X([p({default:40})],L.prototype,"gridDivisions",void 0);X([p({default:5})],L.prototype,"gridMajorEvery",void 0);X([p({default:"#26292f",mapper:de,tween:qe})],L.prototype,"gridColor",void 0);X([p({default:"#363a42",mapper:de,tween:qe})],L.prototype,"gridMajorColor",void 0);X([p({default:!1})],L.prototype,"showAxes",void 0);X([p({default:"#c8404f",mapper:de,tween:qe})],L.prototype,"axisXColor",void 0);X([p({default:"#2f6fd0",mapper:de,tween:qe})],L.prototype,"axisZColor",void 0);X([p({default:.55})],L.prototype,"gridFade",void 0);X([p({default:"#0b0d12",mapper:de,tween:qe})],L.prototype,"gridFadeColor",void 0);X([p({default:2})],L.prototype,"maxPixelRatio",void 0);X([p({default:!0})],L.prototype,"antialias",void 0);X([p({default:!1})],L.prototype,"shadows",void 0);X([p({default:void 0})],L.prototype,"tone",void 0);X([p({default:void 0})],L.prototype,"exposure",void 0);X([p({default:void 0})],L.prototype,"post",void 0);function Dx(e){if(e){for(let t of e)if(t&&t.type==="solid")return t.color}}function ni(e){return e.kind==="still"}function RI(e){return e.kind==="composition"}function pr(e){return e.kind==="audio"}function Rx(e){return e.kind!=="still"}var E="";function Nt(e){let t=e;return{start:t.startAt??0,end:t.endAt??1/0}}function FI(e,t){return oi(new Map(e.map(r=>[r.id,r])),t)}function Op(e){let t=new Map(e.map(s=>[s.id,s])),r=new Map,n=[],o=new Set;for(let s of t.values()){if(r.has(s.id))continue;n.length=0,o.clear();let i,a=s;for(;a;){let l=r.get(a.id);if(l){i=l;break}if(o.has(a.id)){for(let c of n)r.set(c.id,oi(t,c.id));n.length=0;break}n.push(a),o.add(a.id),a=a.parentId===null?void 0:t.get(a.parentId)}for(let l=n.length-1;l>=0;l--){let c=Nt(n[l]);i&&(c.start=Math.max(c.start,i.start),c.end=Math.min(c.end,i.end)),r.set(n[l].id,c),i=c}}return r}function oi(e,t){let r=e.get(t);if(!r)return;let n=Nt(r),o=new Set;for(;r.parentId!==null&&!o.has(r.id);){o.add(r.id);let s=e.get(r.parentId);if(!s)break;let i=Nt(s);n.start=Math.max(n.start,i.start),n.end=Math.min(n.end,i.end),r=s}return n}function II(e){let{startAt:t,endAt:r,...n}=e;return n}function Fx(e){let t=e.duration??0;return t<=0||!e.loop||e.loop.count===null?t:t*gc(e.loop)}function Me(e){if(!Rx(e))return 0;if(e.duration!==void 0)return e.duration;let t=0;for(let r of e.commands)t=Math.max(t,r.at+Fx(r));for(let r of e.nodes)r.startAt!==void 0&&(t=Math.max(t,r.startAt)),r.endAt!==void 0&&Number.isFinite(r.endAt)&&(t=Math.max(t,r.endAt));return t}function Ix(e){return typeof e=="object"&&e!==null&&e.kind==="project"}function Ep(e,t={}){return Ix(e)?e:{kind:"project",name:t.name??"Untitled",fps:t.fps,viewport:t.viewport,theme:e.theme,tracks:[{id:"clip",clip:e,duration:Me(e)}]}}var it=class extends Error{source;position;path;constructor(t,r,n=-1,o){let s=n>=0?` (at character ${n+1} of "${r}")`:` (in "${r}")`;super(`${t}${s}${o?` at ${o}`:""}`),this.name="ExpressionError",this.source=r,this.position=n,this.path=o}};var $r=Math.PI/180,gl={abs:{arity:[1,1],apply:e=>Math.abs(e[0])},sign:{arity:[1,1],apply:e=>Math.sign(e[0])},sqrt:{arity:[1,1],apply:e=>Math.sqrt(e[0])},floor:{arity:[1,1],apply:e=>Math.floor(e[0])},ceil:{arity:[1,1],apply:e=>Math.ceil(e[0])},round:{arity:[1,2],apply:e=>e.length>1&&e[1]!==0?Math.round(e[0]/e[1])*e[1]:Math.round(e[0])},min:{arity:[1,1/0],apply:e=>Math.min(...e)},max:{arity:[1,1/0],apply:e=>Math.max(...e)},clamp:{arity:[3,3],apply:e=>Math.min(Math.max(e[0],e[1]),e[2])},mod:{arity:[2,2],apply:e=>(e[0]%e[1]+e[1])%e[1]},pow:{arity:[2,2],apply:e=>e[0]**e[1]},log:{arity:[1,2],apply:e=>e.length>1?Math.log(e[0])/Math.log(e[1]):Math.log(e[0])},exp:{arity:[1,1],apply:e=>Math.exp(e[0])},mix:{arity:[3,3],apply:e=>e[0]+(e[1]-e[0])*e[2]},smoothstep:{arity:[3,3],apply:e=>{let t=Math.min(Math.max((e[2]-e[0])/(e[1]-e[0]||1),0),1);return t*t*(3-2*t)}},step:{arity:[2,2],apply:e=>e[1]<e[0]?0:1},sin:{arity:[1,1],apply:e=>Math.sin(e[0]*$r)},cos:{arity:[1,1],apply:e=>Math.cos(e[0]*$r)},tan:{arity:[1,1],apply:e=>Math.tan(e[0]*$r)},asin:{arity:[1,1],apply:e=>Math.asin(e[0])/$r},acos:{arity:[1,1],apply:e=>Math.acos(e[0])/$r},atan:{arity:[1,1],apply:e=>Math.atan(e[0])/$r},atan2:{arity:[2,2],apply:e=>Math.atan2(e[0],e[1])/$r},hypot:{arity:[2,1/0],apply:e=>Math.hypot(...e)}},Cp={pi:Math.PI,tau:Math.PI*2,e:Math.E},hn={functions:gl,constants:Cp,refs:"bracket",unknownName:e=>`unknown name "${e}" \u2014 a variable is referenced as "[${e}]"; bare names are the constants ${uo(Cp).join(", ")}`};function uo(e){return Object.keys(e).sort()}var zx=new Set(["+","-","*","/","%","^"]);function pn(e){return e!==void 0&&e>="0"&&e<="9"}function Nx(e,t){let r=[],n=0;for(;n<e.length;){let o=e[n];if(o===" "||o===" "||o===`
6
- `||o==="\r"){n++;continue}if(pn(o)||o==="."&&pn(e[n+1])){let s=n;for(;pn(e[n]);)n++;if(e[n]===".")for(n++;pn(e[n]);)n++;if(e[n]==="e"||e[n]==="E"){let i=n;if(n++,(e[n]==="+"||e[n]==="-")&&n++,pn(e[n]))for(;pn(e[n]);)n++;else n=i}if(e[n]===".")throw new it('unexpected character "."',e,n);r.push({kind:"number",text:"",value:Number(e.slice(s,n)),pos:s});continue}if(o==="["&&t.refs==="bracket"){let s=n,i=e.indexOf("]",n+1);if(i===-1)throw new it("unclosed `[` \u2014 a variable reference is written `[id]`",e,s);let a=e.slice(n+1,i).trim();if(a.length===0)throw new it("empty variable reference `[]`",e,s);if(a.includes("["))throw new it("variable references cannot nest",e,s);r.push({kind:"ref",text:a,value:0,pos:s}),n=i+1;continue}if(/[A-Za-z_]/.test(o)){let s=n;for(;n<e.length&&/[A-Za-z0-9_]/.test(e[n]);)n++;r.push({kind:"ident",text:e.slice(s,n),value:0,pos:s});continue}if(zx.has(o)){r.push({kind:"op",text:o,value:0,pos:n++});continue}if(o==="("||o===")"||o===","){r.push({kind:o,text:o,value:0,pos:n++});continue}throw new it(`unexpected character "${o}"`,e,n)}return r.push({kind:"end",text:"",value:0,pos:e.length}),r}function si(e,t=hn){if(e.trim().length===0)throw new it("empty expression",e);let r=Nx(e,t),n=[],o=0,s=()=>r[o],i=()=>r[o++],a=x=>(n.includes(x)||n.push(x),{kind:"ref",name:x}),l=x=>x.kind==="number"||x.kind==="ref"||x.kind==="ident"||x.kind==="(";function c(){let x=d();for(;;){let _=s();if(_.kind==="op"&&(_.text==="+"||_.text==="-")){i(),x={kind:"binary",op:_.text,left:x,right:d()};continue}return x}}function d(){let x=u();for(;;){let _=s();if(_.kind==="op"&&(_.text==="*"||_.text==="/"||_.text==="%")){i(),x={kind:"binary",op:_.text,left:x,right:u()};continue}if(l(_)){x={kind:"binary",op:"*",left:x,right:u()};continue}return x}}function u(){let x=s();if(x.kind==="op"&&(x.text==="-"||x.text==="+")){i();let _=u();return x.text==="-"?{kind:"unary",op:"-",operand:_}:_}return f()}function f(){let x=y(),_=s();return _.kind==="op"&&_.text==="^"?(i(),{kind:"binary",op:"^",left:x,right:u()}):x}function h(x,_){let S=t.functions[x];if(!S)throw new it(`unknown function "${x}" \u2014 available: ${uo(t.functions).join(", ")}`,e,_);let b=[];if(s().kind!==")")for(;b.push(c()),s().kind===",";)i();let k=i();if(k.kind!==")")throw new it(`expected \`)\` closing ${x}(`,e,k.pos);let[M,R]=S.arity;if(b.length<M||b.length>R){let et=R===1/0?`at least ${M}`:M===R?`${M}`:`${M}\u2013${R}`;throw new it(`${x}() takes ${et} argument${R===1?"":"s"}, got ${b.length}`,e,_)}return{kind:"call",name:x,args:b}}function y(){let x=i();switch(x.kind){case"number":return{kind:"const",value:x.value};case"ref":return a(x.text);case"(":{let _=c(),S=i();if(S.kind!==")")throw new it("expected `)`",e,S.pos);return _}case"ident":{if(s().kind==="(")return i(),h(x.text,x.pos);let _=t.constants[x.text];if(_!==void 0)return{kind:"const",value:_};if(t.refs==="bare")return a(x.text);throw new it(t.unknownName(x.text),e,x.pos)}default:throw new it(x.kind==="end"?"expression ends early":`unexpected "${x.text}"`,e,x.pos)}}let w=c(),g=s();if(g.kind!=="end")throw new it(`unexpected "${g.text}"`,e,g.pos);return{source:e,root:w,refs:n,passthrough:w.kind==="ref"}}function $x(e){return typeof e=="number"?e:typeof e=="boolean"?e?1:0:typeof e=="string"?Number(e):NaN}function ii(e,t,r){let n=s=>{let i=t(s);if(!i)throw new it(`"${s}" resolves to nothing in this document \u2014 a reference names a variable (declared with a "variable" command), a constant (a \`constants\` row), or another node's prop as "[key.prop]" (\`key\` on that node's row)`,e.source,-1,r);return i};if(e.passthrough)return n(e.root.name);let o=s=>{switch(s.kind){case"const":{let{value:i}=s;return()=>i}case"ref":{let i=n(s.name);return()=>$x(i())}case"unary":{let i=o(s.operand);return()=>-i()}case"binary":{let i=o(s.left),a=o(s.right);switch(s.op){case"+":return()=>i()+a();case"-":return()=>i()-a();case"*":return()=>i()*a();case"/":return()=>i()/a();case"%":return()=>i()%a();case"^":return()=>i()**a()}break}case"call":{let{apply:i}=gl[s.name],a=s.args.map(o);return()=>i(a.map(l=>l()))}}throw new it("unsupported expression node",e.source,-1,r)};return o(e.root)}function mn(e){return typeof e=="string"&&e.length>1&&e[0]==="="&&e[1]!=="="}function xl(e){return e.startsWith("==")?e.slice(1):e}var hr=e=>({dynamic:!1,value:e});function fo(e,t,r){if(typeof e=="string")return r(e,t);if(Array.isArray(e)){let n=e.map((s,i)=>fo(s,`${t}[${i}]`,r));if(n.some(s=>s.dynamic))return{dynamic:!0,read:()=>n.map(s=>s.dynamic?s.read():s.value)};let o=n.map(s=>s.value);return hr(o.every((s,i)=>s===e[i])?e:o)}if(Bx(e)){let n=Object.keys(e),o=n.map(i=>fo(e[i],`${t}.${i}`,r));if(o.some(i=>i.dynamic))return{dynamic:!0,read:()=>{let i={};return n.forEach((a,l)=>{let c=o[l];i[a]=c.dynamic?c.read():c.value}),i}};if(!o.some((i,a)=>i.value!==e[n[a]]))return hr(e);let s={};return n.forEach((i,a)=>{s[i]=o[a].value}),hr(s)}return hr(e)}function _l(e,t,r="props"){return fo(e,r,(n,o)=>mn(n)?{dynamic:!0,read:ii(si(n.slice(1)),t,o)}:hr(xl(n)))}function Pp(e,t,r="props"){let n={},o={},s=!1;for(let i of Object.keys(e??{})){let a=_l(e[i],t,`${r}.${i}`);a.dynamic?(o[i]=a.read,s=!0):n[i]=a.value}return{literal:n,bindings:o,hasBindings:s}}function Tp(e,t){let r=[];return fo(e,t,(n,o)=>(mn(n)&&r.push({path:o,source:n}),hr(n))),r}var jx=/\[([^[\]]+)\]/g;function Dp(e,t){return fo(e,"",n=>mn(n)?hr(n.replace(jx,(o,s)=>{let i=t(s);return i===void 0?o:`[${i}]`})):hr(n)).value}function Bx(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Rp(e,t=hn){return si(mn(e)?e.slice(1):e,t)}var yt={isSource:mn,unescape:xl,parse:Rp,tryParse:(e,t)=>{try{return{expression:Rp(e,t)}}catch(r){return{error:r instanceof Error?r.message:String(r)}}},compile:ii,bind:_l,bindProps:Pp,collect:Tp,renameRefs:Dp,functions:()=>uo(hn.functions),constants:()=>uo(hn.constants),dialect:hn};var Fp=(e,t,r)=>Math.min(r,Math.max(t,e));function Lx(e){let t=[];for(let r=0;r<e.length-1;r++){let n=e[r],o=e[r+1],s=e[r-1]??n,i=e[r+2]??o,a=n.out?{x:n.x+n.out.x,y:n.y+n.out.y}:{x:n.x+(o.x-s.x)/6,y:n.y+(o.y-s.y)/6},l=o.in?{x:o.x+o.in.x,y:o.y+o.in.y}:{x:o.x-(i.x-n.x)/6,y:o.y-(i.y-n.y)/6};t.push({p0:{x:n.x,y:n.y},c1:{x:Fp(a.x,n.x,o.x),y:a.y},c2:{x:Fp(l.x,n.x,o.x),y:l.y},p3:{x:o.x,y:o.y}})}return t}function Ip(e,t,r,n,o){let s=1-o;return s*s*s*e+3*s*s*o*t+3*s*o*o*r+o*o*o*n}function qx(e,t){let r=0,n=1;for(let o=0;o<30;o++){let s=(r+n)/2;Ip(e.p0.x,e.c1.x,e.c2.x,e.p3.x,s)<t?r=s:n=s}return(r+n)/2}function ai(e){return Array.isArray(e)&&e.length>=2&&e.every(Wx)}function Wx(e){if(typeof e!="object"||e===null)return!1;let{x:t,y:r}=e;return typeof t=="number"&&Number.isFinite(t)&&typeof r=="number"&&Number.isFinite(r)}function zp(e){let t=Lx(e);return t.length===0?r=>r:r=>{if(r<=0)return t[0].p0.y;let n=t[t.length-1];if(r>=1)return n.p3.y;let o=n;for(let i of t)if(r<=i.p3.x){o=i;break}let s=qx(o,r);return Ip(o.p0.y,o.c1.y,o.c2.y,o.p3.y,s)}}var Np=new Set(["linear","in","out","inOut","custom"]),$p=new Set(["normal","reverse","alternate"]);function ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $e(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function Gx(e,t,r){if(e===void 0)return;if(!ne(e)){r.push({path:t,message:"easing must be an object with a `kind`."});return}let{kind:n,args:o}=e;if(typeof n!="string"||!Np.has(n)){r.push({path:`${t}.kind`,message:`easing kind must be one of ${[...Np].join(", ")} (got ${JSON.stringify(n)}).`});return}n==="custom"&&o!==void 0&&typeof o!="string"&&!ai(o)&&r.push({path:`${t}.args`,message:"a custom easing's args must be its curve \u2014 two or more `{ x, y }` points \u2014 or a registered ease's key."})}function Yx(e,t,r){if(e===void 0)return;if(!ne(e)){r.push({path:t,message:"loop must be an object with a `count`."});return}let{direction:n,count:o}=e;o!==null&&(typeof o!="number"||!Number.isInteger(o)||o<0)&&r.push({path:`${t}.count`,message:"loop count must be a whole number of repeats >= 0, or null to repeat for the rest of the clip."}),n!==void 0&&!$p.has(n)&&r.push({path:`${t}.direction`,message:`loop direction must be one of ${[...$p].join(", ")} (got ${JSON.stringify(n)}).`})}function Vx(e,t,r){if(!ne(e))return r.push({path:t,message:"node must be an object."}),!1;let n=!0,{id:o,type:s,parentId:i,layerOrder:a,props:l,key:c}=e;return typeof o!="string"&&(r.push({path:`${t}.id`,message:"id must be a string."}),n=!1),(typeof s!="string"||s.length===0)&&(r.push({path:`${t}.type`,message:"type must be a non-empty string."}),n=!1),i!==null&&typeof i!="string"&&(r.push({path:`${t}.parentId`,message:"parentId must be a node id or null."}),n=!1),(typeof a!="number"||!Number.isFinite(a))&&(r.push({path:`${t}.layerOrder`,message:"layerOrder must be a finite number."}),n=!1),ne(l)||(r.push({path:`${t}.props`,message:"props must be an object (`{}` when nothing is set)."}),n=!1),c!==void 0&&(typeof c!="string"||c.length===0?(r.push({path:`${t}.key`,message:"key must be a non-empty string when present."}),n=!1):(c.includes("]")||c.includes("."))&&(r.push({path:`${t}.key`,message:`node key "${c}" cannot contain "]" or "." \u2014 it is referenced as "[${c}.prop]".`}),n=!1)),n}function Bp(e,t){let r=new Map;for(let n of e){let o=n.spec.key;if(typeof o!="string"||o.length===0)continue;let s=r.get(o);if(s){t.push({path:`${n.path}.key`,message:`duplicate node key "${o}" (also declared at ${s.path}).`});continue}r.set(o,n)}return r}function Kx(e,t,r,n){e.id===""&&(e.type!==r||e.parentId!==null)&&n.push({path:t,message:`the node with id "" is this document's root and must be \`{ type: "${r}", parentId: null }\`.`})}function Hx(e,t,r){if(!ne(e))return r.push({path:t,message:"command must be an object."}),!1;let n=!0,{id:o,type:s,targetId:i,at:a,duration:l,args:c}=e;return(typeof o!="string"||o.length===0)&&(r.push({path:`${t}.id`,message:"id must be a non-empty string."}),n=!1),(typeof s!="string"||s.length===0)&&(r.push({path:`${t}.type`,message:"type must be a non-empty string."}),n=!1),i!==null&&typeof i!="string"&&(r.push({path:`${t}.targetId`,message:"targetId must be a node id, or null for the scene root."}),n=!1),$e(a)||(r.push({path:`${t}.at`,message:"at must be a finite number of seconds >= 0."}),n=!1),l!==void 0&&!$e(l)&&(r.push({path:`${t}.duration`,message:"duration must be a finite number of seconds >= 0."}),n=!1),ne(c)||(r.push({path:`${t}.args`,message:"args must be an object (`{}` when there are none)."}),n=!1),Gx(e.easing,`${t}.easing`,r),Yx(e.loop,`${t}.loop`,r),n}function Ux(e,t,r){if(!ne(e))return r.push({path:t,message:"variable must be an object."}),!1;let n=!0,{id:o,name:s,value:i,lerp:a}=e;return typeof o!="string"||o.length===0?(r.push({path:`${t}.id`,message:"id must be a non-empty string."}),n=!1):o.includes("]")&&(r.push({path:`${t}.id`,message:`variable id "${o}" cannot contain "]" \u2014 it is referenced as "[${o}]".`}),n=!1),s!==void 0&&typeof s!="string"&&(r.push({path:`${t}.name`,message:"name must be a string when present."}),n=!1),"value"in e?yt.isSource(i)&&(r.push({path:`${t}.value`,message:"a variable holds a value, not an expression \u2014 only a node prop can be bound."}),n=!1):(r.push({path:`${t}.value`,message:"value is required \u2014 a variable is what it holds before anything changes it."}),n=!1),a!==void 0&&typeof a!="string"&&(r.push({path:`${t}.lerp`,message:"lerp must be a registered lerp key when present."}),n=!1),n}function Lp(e,t){if(e===void 0)return[];if(!Array.isArray(e))return t.push({path:"variables",message:"variables must be an array."}),[];let r=[];return e.forEach((n,o)=>{let s=`variables[${o}]`;Ux(n,s,t)&&r.push({spec:n,path:s})}),r}function qp(e,t){let r=new Map;for(let n of e){let o=r.get(n.spec.id);if(o){t.push({path:`${n.path}.id`,message:`duplicate variable id "${n.spec.id}" (also declared at ${o.path}).`});continue}r.set(n.spec.id,n)}return r}function Wp(e){let t=e.indexOf(".");return t<0?void 0:{key:e.slice(0,t),prop:e.slice(t+1)}}function wl(e,t,r,n,o){for(let s of yt.collect(e,t)){let i=yt.tryParse(s.source);if("error"in i){o.push({path:s.path,message:i.error});continue}for(let a of i.expression.refs){let l=Wp(a);if(!l){if(r.has(a))continue;o.push({path:s.path,message:n.has(a)?`expression references "[${a}]", which is a node key \u2014 a node is not a value, so name the prop too: "[${a}.x]".`:`expression references "[${a}]", which this document does not declare. Declared: ${[...r].map(c=>`[${c}]`).join(", ")||"none"}.`});continue}if(l.key.length===0||l.prop.length===0||l.prop.includes(".")){o.push({path:s.path,message:`expression references "[${a}]", which is not a node reference \u2014 one is "[key.prop]".`});continue}n.has(l.key)||o.push({path:s.path,message:`expression references "[${a}]", but no node in this document is keyed "${l.key}". Keyed: ${[...n].join(", ")||"none"}.`})}}}function vl(e,t,r,n){if(ne(t))for(let o of Object.keys(t)){let s=[];for(let i of yt.collect(t[o],`${r}.${o}`)){let a=yt.tryParse(i.source);if(!("error"in a))for(let l of a.expression.refs)Wp(l)&&s.push(l)}s.length>0&&n.push({id:`${e}.${o}`,path:`${r}.${o}`,reads:s})}}function Gp(e,t){let r=new Map(e.map(a=>[a.id,a])),n=new Set,o=[],s=new Set,i=a=>{let l=r.get(a);if(!l||n.has(a))return;let c=o.indexOf(a);if(c>=0){if(!s.has(a)){let d=[...o.slice(c),a];for(let u of d)s.add(u);t.push({path:l.path,message:`expression cycle ${d.join(" \u2192 ")} \u2014 a prop cannot read a prop that reads it back.`})}return}o.push(a);for(let d of l.reads)i(d);o.pop(),n.add(a)};for(let a of e)i(a.id)}function Xx(e,t,r){let n=new Map;e.forEach((s,i)=>{if(n.has(s.id)){r.push({path:`${t}[${i}].id`,message:`duplicate node id "${s.id}".`});return}n.set(s.id,i)});for(let s=0;s<e.length;s++){let i=e[s].parentId;i!==null&&!n.has(i)&&r.push({path:`${t}[${s}].parentId`,message:`parentId "${i}" is not a node in this document.`})}let o=new Set;for(let s of e){if(o.has(s.id))continue;let i=new Set,a=s;for(;a;){if(i.has(a.id)){r.push({path:`${t}[${n.get(a.id)}].parentId`,message:`node "${a.id}" is its own ancestor \u2014 parent chain forms a cycle.`});break}if(i.add(a.id),o.has(a.id))break;let l=a.parentId;a=l===null?void 0:e[n.get(l)??-1]}for(let l of i)o.add(l)}}function Yp(e,t,r){for(let n of e){let o=t.get(n.id);o&&r.push({path:`${o.path}.id`,message:`"${n.id}" is already a node id \u2014 nodes and variables share one id space.`})}}function Vp(e,t){e.constants!==void 0&&t.push({path:"constants",message:"constants were merged into `variables` \u2014 move each row there and drop its `kind`."})}function Kp(e,t,r){if(!Array.isArray(e))return r.push({path:"nodes",message:"nodes must be an array."}),[];let n=[];return e.forEach((o,s)=>{let i=`nodes[${s}]`;Vx(o,i,r)&&(n.push({spec:o,path:i}),Kx(o,i,t,r))}),Xx(n.map(o=>o.spec),"nodes",r),n}function Zx(e,t,r){let{startAt:n,endAt:o}=e;n!==void 0&&!$e(n)&&r.push({path:`${t}.startAt`,message:"startAt must be a finite number of seconds >= 0."}),o!==void 0&&!$e(o)&&r.push({path:`${t}.endAt`,message:"endAt must be a finite number of seconds >= 0."}),$e(o)&&o<=($e(n)?n:0)&&r.push({path:`${t}.endAt`,message:`endAt (${o}s) must be after startAt (${n??0}s).`}),e.id===""&&(n!==void 0||o!==void 0)&&r.push({path:t,message:"the root is present for the whole clip \u2014 it cannot carry startAt or endAt."})}function Jx(e,t){Vp(e,t),e.commands!==void 0&&t.push({path:"commands",message:"a still has no timeline, so no commands \u2014 make it a composition to animate it."});let r=qp(Lp(e.variables,t),t),n=Kp(e.nodes,"canvas2d",t);for(let c of n){let{startAt:d,endAt:u}=c.spec;(d!==void 0||u!==void 0)&&t.push({path:c.path,message:"a still has no timeline \u2014 drop startAt/endAt, or make it a composition."})}let o=n.map(c=>c.spec);Yp(o,r,t);let s=Bp(n,t),i=new Set(r.keys()),a=new Set(s.keys()),l=[];for(let c of n)wl(c.spec.props,`${c.path}.props`,i,a,t),c.spec.key&&vl(c.spec.key,c.spec.props,`${c.path}.props`,l);Gp(l,t)}function Qx(e,t){Hp(e,"canvas2d",t)}function t0(e,t){Hp(e,"audioBus",t)}var e0={add:"a node is a row in `nodes` \u2014 its `startAt` is when it enters.",variable:"a variable is declared in `variables`."};function Hp(e,t,r){if(Vp(e,r),!Array.isArray(e.commands)){r.push({path:"commands",message:"commands must be an array."});return}e.duration!==void 0&&!$e(e.duration)&&r.push({path:"duration",message:"duration must be a finite number of seconds >= 0."});let n=qp(Lp(e.variables,r),r),o=Kp(e.nodes,t,r);for(let h of o)Zx(h.spec,h.path,r);let s=o.map(h=>h.spec);Yp(s,n,r);let i=Bp(o,r),a=[],l=new Set;e.commands.forEach((h,y)=>{if(!Hx(h,`commands[${y}]`,r))return;if(l.has(h.id)){r.push({path:`commands[${y}].id`,message:`duplicate command id "${h.id}".`});return}let w=e0[h.type];if(w){r.push({path:`commands[${y}].type`,message:`there is no "${h.type}" command \u2014 ${w}`});return}l.add(h.id),a.push(h)});let c=new Map(s.map(h=>[h.id,h]));a.forEach((h,y)=>{if(h.targetId===null||n.has(h.targetId))return;let w=oi(c,h.targetId);w===void 0?r.push({path:`commands[${y}].targetId`,message:`targetId "${h.targetId}" is not a node or variable in this document.`}):h.at<w.start&&r.push({path:`commands[${y}].at`,message:`command runs at ${h.at}s but its target "${h.targetId}" is not present until ${w.start}s.`})});let d=new Set(n.keys()),u=new Set(i.keys());for(let h of o)wl(h.spec.props,`${h.path}.props`,d,u,r);a.forEach((h,y)=>wl(h.args,`commands[${y}].args`,d,u,r));let f=[];for(let h of o)h.spec.key&&vl(h.spec.key,h.spec.props,`${h.path}.props`,f);a.forEach((h,y)=>{if(h.type!=="set"||h.targetId===null)return;let w=c.get(h.targetId)?.key;w&&vl(w,h.args,`commands[${y}].args`,f)}),Gp(f,r)}function Sl(e){let t=[];if(!ne(e))return{valid:!1,issues:[{path:"",message:"document must be an object."}]};let r=e.kind;return r==="still"?Jx(e,t):r==="composition"?Qx(e,t):r==="audio"?t0(e,t):t.push({path:"kind",message:`kind must be "still", "composition" or "audio" (got ${JSON.stringify(r)}).`}),{valid:t.length===0,issues:t}}function r0(e){let t=[];if(!ne(e))return{valid:!1,issues:[{path:"",message:"document must be an object."}]};let r=e;if(r.kind!=="project"&&t.push({path:"kind",message:`kind must be "project" (got ${JSON.stringify(r.kind)}).`}),(typeof r.name!="string"||r.name.length===0)&&t.push({path:"name",message:"name must be a non-empty string."}),r.fps!==void 0&&(typeof r.fps!="number"||!(r.fps>0))&&t.push({path:"fps",message:"fps must be a positive number when present."}),!Array.isArray(r.tracks))return t.push({path:"tracks",message:"tracks must be an array."}),{valid:!1,issues:t};let n=new Set;return r.tracks.forEach((o,s)=>{let i=`tracks[${s}]`;if(!ne(o)){t.push({path:i,message:"track must be an object."});return}let a=o;if(typeof a.id!="string"||a.id.length===0?t.push({path:`${i}.id`,message:"id must be a non-empty string."}):n.has(a.id)?t.push({path:`${i}.id`,message:`duplicate track id "${a.id}".`}):n.add(a.id),a.name!==void 0&&typeof a.name!="string"&&t.push({path:`${i}.name`,message:"name must be a string when present."}),a.startAt!==void 0&&!$e(a.startAt)&&t.push({path:`${i}.startAt`,message:"startAt must be a finite number of seconds >= 0."}),$e(a.duration)||t.push({path:`${i}.duration`,message:"duration is required, and must be a finite number of seconds >= 0."}),a.clip===void 0){t.push({path:`${i}.clip`,message:"clip is required \u2014 a track places a clip document inline."});return}for(let l of n0(a.clip))t.push({path:`${i}.clip${l.path?`.${l.path}`:""}`,message:l.message})}),{valid:t.length===0,issues:t}}var jp=new WeakMap;function n0(e){if(!ne(e))return Sl(e).issues;let t=jp.get(e);return t||(t=Sl(e).issues,jp.set(e,t)),t}function Up(e){let{valid:t,issues:r}=r0(e);if(!t){let n=r.map(o=>` ${o.path||"<root>"}: ${o.message}`).join(`
7
- `);throw new Error(`Invalid project document:
8
- ${n}`)}}function s3(e){let{valid:t,issues:r}=Sl(e);if(!t){let n=r.map(o=>` ${o.path||"<root>"}: ${o.message}`).join(`
9
- `);throw new Error(`Invalid scene document:
10
- ${n}`)}return e}var bl=Symbol("nodeMeta");function a3(e){return function(t){let r=typeof e=="string"?{key:e}:e;return t.prototype[bl]=r,t}}function kl(e){let t=e.prototype;if(!(!t||!Object.prototype.hasOwnProperty.call(t,bl)))return t[bl]}var o0={canvas2d:H,provider:nn,"theme-provider":Mr,"default-text-style":Ft,rect:ye,ellipse:Ar,line:Or,path:oo,polygon:Er,polygram:er,"line-grid":rr,"grid-pattern":nr,boolean:Bs,mask:Ls,camera:Rt,orbitCamera:St,"rotated-box":io,text:re,richtext:Gt,number:oe,video:Q,audioBus:ln,sound:xe,canvas3d:L,group3d:ti,mesh3d:z,box3d:Ie,sphere3d:_e,plane3d:Tr,circle3d:sr,cylinder3d:we,cone3d:ve,capsule3d:Dr,torus3d:ze,"torus-knot3d":or,tube3d:lr,lathe3d:ar,extrude3d:ir,ring3d:Ne,polyhedron3d:Rr,points3d:ei,line3d:se,sprite3d:Ir,instances3d:cn,model3d:cr,camera3d:zt,"ambient-light3d":un,"directional-light3d":Nr,"point-light3d":dr,"spot-light3d":ie,"hemisphere-light3d":zr,"area-light3d":ur,fog3d:fr,environment3d:be};function li(e,t){return(r,n,o,s)=>{let i=r[e];if(typeof i!="function")throw new Error(`Command "${e}" is not available on ${r.constructor.name}.`);return i.call(r,{data:n[t],duration:o,easing:s})}}var s0={number:m,vector2:P,vector3:ms,color:((e,t,r)=>{let[n,o,s,i]=nt(Y(String(e)),Y(String(t)),r),a=l=>Math.round(Math.min(Math.max(l,0),1)*255);return`rgba(${a(n)}, ${a(o)}, ${a(s)}, ${Number(i.toFixed(4))})`}),step:((e,t,r)=>r>=1?t:e)};function Xp(e){for(let[t,r]of Object.entries(o0))e.addNode(t,r);for(let[t,r]of Object.entries(s0))e.addLerp(t,r);e.addCommand("to",(t,r,n,o)=>t.to({data:{...r},duration:n,easing:o})),e.addCommand("set",(t,r)=>{let n=r;return jt(0,()=>{t.set(n)})},{binds:!0}),e.addCommand("fillTo",li("fillTo","fill"),{args:[{key:"fill",kind:"fills"}]}),e.addCommand("overlayTo",li("overlayTo","overlay"),{args:[{key:"overlay",kind:"fills"}]}),e.addCommand("strokeTo",li("strokeTo","stroke"),{args:[{key:"stroke",kind:"strokes"}]}),e.addCommand("shadowTo",li("shadowTo","shadow"),{args:[{key:"shadow",kind:"shadows"}]}),e.addVariableCommand("variableTo",(t,r,n,o)=>{let s=r.value,i=r.lerp,a=typeof i=="string"?e.lerp(i):void 0;if(i!==void 0&&!a)throw new Error(`A "lerp" param must name a registered lerp (variable "${t.id}"), got ${JSON.stringify(i)}. Registered: ${e.lerpKeys().join(", ")}.`);let l=a??t.lerp,c,d=!1;return jt(n,u=>{d||(c=t.get(),d=!0),t.set(l(c,s,u))},o)}),e.addVariableCommand("variableSet",(t,r)=>jt(0,()=>{t.set(r.value)})),e.addCommand("save",t=>jt(0,()=>{t.save()}))}var Ml=["globalThis","window","self","top","parent","frames","Function","importScripts","document","navigator","location","history","screen","customElements","fetch","XMLHttpRequest","WebSocket","EventSource","Request","Response","Headers","localStorage","sessionStorage","indexedDB","caches","cookieStore","crypto","Worker","SharedWorker","ServiceWorker","MessageChannel","BroadcastChannel","postMessage","alert","confirm","prompt","open","print","Notification"],i0=new Set(["eval","arguments"]),Zp=Ml.filter(e=>i0.has(e));if(Zp.length>0)throw new Error(`DENIED_GLOBALS cannot contain ${Zp.join(", ")}: strict mode forbids binding those names, so no dynamic node would link at all. See the note in this file.`);var Jp=["@motionscript/sdk","motionscript","motion-script"],ci=class e{static MAX_SHADERS=512;constructor(t={}){if(this._dynamicNodes=t.dynamicNodes,t.builtins!==!1&&Xp(this),Array.isArray(t.nodes))for(let r of t.nodes)this.addNode(r);else for(let[r,n]of Object.entries(t.nodes??{}))this.addNode(r,n);for(let[r,n]of Object.entries(t.lerps??{}))this.addLerp(r,n);for(let[r,n]of Object.entries(t.eases??{}))this.addEase(r,n);for(let[r,n]of Object.entries(t.shaders??{}))this.addShader(r,n)}addNode(t,r,n){let o=typeof r=="function",s=o?r:t,i=o?n:r,a=o?t:kl(s);if(a===void 0)throw new Error(`${s.name||"The class"} carries no @node(...) declaration, so it has no document key. Decorate it, or register it explicitly: addNode("myKey", TheClass).`);let l=typeof a=="string"?{key:a}:a,c=l.key,d=this._nodes.get(c);if(d){if(d.ctor===s)return this;if(!i?.replace)throw new Error(`Node type "${c}" is already registered to a different class (${d.ctor.name} vs ${s.name}). Keys must be unique \u2014 a document naming this type would otherwise resolve differently depending on registration order.`)}let u=new Map;for(let f of Af(Object.create(s.prototype)))u.set(f.key,{method:f.method,args:this._describeArgs(f.args)});return this._nodes.set(c,{key:c,ctor:s,commands:u,descriptor:{...l,dimension:this._describeDimension(s),properties:this._describeProperties(s)}}),this}async addNodeFromSource(t,r){if(!this._dynamicNodes)throw new Error("addNodeFromSource needs `dynamicNodes: { sdk, compile }` on the Registry constructor.");let n=await this._dynamicNodes.compile(t),o=this._evalNodeModule(n);return this.addNode(o,r),o}node(t){return this._nodes.get(t)}hasNode(t){return this._nodes.has(t)}nodeKeys(){return[...this._nodes.keys()].sort()}describe(t){return this._nodes.get(t)?.descriptor}instantiate(t,r){let n=this._nodes.get(t.type);if(!n)throw new Error(`Unknown node type "${t.type}" (node ${t.id}). This registry knows: ${this.nodeKeys().join(", ")||"nothing"}.`);return new n.ctor({...r??t.props,id:t.id,...t.key!==void 0&&{key:t.key}})}addCommand(t,r,n){return this._claimed(t,r)?this:(this._commands.set(t,{key:t,scope:"node",factory:r,...n?.args?{args:this._describeArgs(n.args)}:{},binds:n?.binds}),this)}addVariableCommand(t,r){return this._claimed(t,r)?this:(this._commands.set(t,{key:t,scope:"variable",factory:r}),this)}command(t){return this._commands.get(t)}nodeCommand(t,r){let n=this._nodes.get(t)?.commands.get(r);if(n)return(o,s,i,a)=>{let l=o[n.method];if(typeof l!="function")throw new Error(`Command "${r}" needs a "${n.method}" method on ${o.constructor.name}, which has none.`);let c={};for(let d of n.args)c[d.key]=s[d.key];return l.call(o,{data:c,duration:i,easing:a})}}commandKeys(t){return[...t===void 0?this._commands.keys():this._nodes.get(t)?.commands.keys()??[]].sort()}addLerp(t,r){let n=this._lerps.get(t);if(n&&n!==r)throw new Error(`Variable lerp "${t}" is already registered to a different function. Keys must be unique.`);return this._lerps.set(t,r),this}lerp(t){return this._lerps.get(t)}lerpKeys(){return[...this._lerps.keys()].sort()}requireLerp(t,r,n){let o=t??(typeof r=="number"?"number":"step"),s=this._lerps.get(o);if(!s)throw new Error(`Unknown variable lerp "${o}" (${n}). Registered: ${this.lerpKeys().join(", ")||"none"}.`);return s}addEase(t,r){let n=this._eases.get(t);if(n&&n!==r)throw new Error(`Ease "${t}" is already registered to a different function. Keys must be unique.`);return this._eases.set(t,r),this}ease(t){return this._eases.get(t)}easeKeys(){return[...this._eases.keys()].sort()}addShader(t,r,n){let o=kf(r),s=this._shaders.get(t);if(s){if(s.scope===o.scope&&s.source===o.source&&s.name===o.name)return s;if(!n?.replace)throw new Error(`Shader "${t}" is already registered to a different pack ("${s.name}" vs "${o.name}"). Keys must be unique \u2014 a document naming this shader would otherwise resolve differently depending on registration order.`)}else if(this._shaders.size>=e.MAX_SHADERS)throw new Error(`Cannot register shader "${t}": the ${e.MAX_SHADERS}-shader ceiling is reached.`);return this._shaders.set(t,o),o}shader(t){return this._shaders.get(t)}fillShader(t){let r=this._shaders.get(t);return r?.scope==="fill"?r:void 0}effectShader(t){let r=this._shaders.get(t);return r?.scope==="effect"?r:void 0}shaderKeys(){return[...this._shaders.keys()].sort()}_nodes=new Map;_commands=new Map;_lerps=new Map;_eases=new Map;_shaders=new Map;_dynamicNodes;_evalNodeModule(t){let{sdk:r,jsxRuntime:n,modules:o}=this._dynamicNodes,s=c=>{if(Jp.includes(c))return r;if(n&&Jp.some(u=>c===`${u}/jsx-runtime`))return n;if(o&&Object.hasOwn(o,c))return o[c];let d=["@motionscript/sdk",...n?["@motionscript/sdk/jsx-runtime"]:[],...Object.keys(o??{})];throw new Error(`"${c}" isn't available to a custom node. It can require ${d.map(u=>`"${u}"`).join(", ")}; a host supplies more through \`dynamicNodes.modules\`.`)},i={exports:{}};new Function("exports","require","module",...Ml,`"use strict";
11
- return function () {
12
- ${t}
13
- };`)(i.exports,s,i)();let l=i.exports.default;if(typeof l!="function"||kl(l)===void 0)throw new Error("This script must `export default` a class decorated with @node(...).");return l}_claimed(t,r){let n=this._commands.get(t);if(!n)return!1;if(n.factory===r)return!0;throw new Error(`Command type "${t}" is already registered to a different factory. Keys must be unique.`)}_describeProperties(t){let r={};for(let n of Vn(Object.create(t.prototype))){let o=n.editor??{};r[n.key]={...o,kind:o.kind??this._inferKind(n.default),...n.default!==void 0?{default:n.default}:{}}}return r}_describeDimension(t){let r=Object.create(t.prototype).dimension;return typeof r=="string"?r:void 0}_inferKind(t){switch(typeof t){case"number":return"number";case"string":return"text";case"boolean":return"boolean";case"object":return t===null?"unknown":Array.isArray(t)&&t.every(r=>typeof r=="number")?"vector":"object";default:return"unknown"}}_describeArgs(t){return(t??[]).map(r=>typeof r=="string"?{key:r,kind:"unknown"}:{kind:"unknown",...r})}};var di="@bus";function a0(){return{id:di,type:"audioBus",parentId:null,layerOrder:0,props:{}}}function l0(){return{id:"",type:"canvas2d",parentId:null,layerOrder:0,props:{}}}function yn(e){let t=[l0()];e.nodes.some(Qp)||t.push(a0());for(let r of e.nodes)t.push(c0(r));return{kind:"composition",duration:e.duration,variables:e.variables,nodes:t,commands:e.commands.map(d0)}}function Qp(e){return e.id===""&&e.type==="audioBus"}function c0(e){return Qp(e)?{...e,id:di,parentId:null}:e.parentId===null||e.parentId===""?{...e,parentId:di}:e}function d0(e){return e.targetId===null||e.targetId===""?{...e,targetId:di}:e}var nh=["center","topLeft","topRight","bottomLeft","bottomRight","topCenter","bottomCenter","centerLeft","centerRight"];function Ol(e,t,r){let n=u0.has(t.type),o=e.command(t.type);if(o?.scope==="variable"){let f=f0.has(t.type);return{scope:"variable",known:f,lifecycle:n,readsLayout:!f,writesLayout:!1}}let s=r??(t.targetId===null?sh:void 0),i=s?e.node(s.type):void 0;if(!s||!i)return null;let a;if(o){if(a=ih[t.type],a&&typeof fi(i.ctor,a[0])!="function")return null}else{let f=i.commands.get(t.type);if(!f)return null;a=f.method===t.type?ah[t.type]:void 0}let l=!n&&a!==void 0&&_0(i.ctor,a);if(!l)return{scope:"node",known:l,lifecycle:n,readsLayout:!0,writesLayout:!0};let c=t.args??{},d=s.props??{},u=g0(t.type,c);return{scope:"node",known:l,lifecycle:n,readsLayout:y0(t.type,c,d,u),writesLayout:u===void 0||u.some(f=>!Cl(e,s.type,f))}}function oh(e,t,r){let n=e.command(t.type),o=r??(t.targetId===null?sh:void 0),s=n?n.scope==="node"?n.args:void 0:o?e.node(o.type)?.commands.get(t.type)?.args:void 0,i=[];for(let a of s??[]){let l=t.args?.[a.key];a.kind==="nodeRef"&&typeof l=="string"&&l!==""&&i.push(l)}return i}function pi(e,t){let r=e.node(t)?.ctor;return r!==void 0&&fi(r,"provideContext")!==fi(ht,"provideContext")}function El(e){for(let t of yt.collect(e,"")){let r=yt.tryParse(t.source);if("error"in r||r.expression.refs.some(n=>n.includes(".")))return!0}return!1}function Cl(e,t,r){let n=e.node(t);return!n||!lh().ctors.has(n.ctor)?!1:n.descriptor.dimension==="audio"?!0:p0.has(r)}var u0=new Set(["removeChildAt","addChildAt","reparent"]),f0=new Set(["variableTo","variableSet"]),p0=new Set(["x","y","rotation","scale","opacity","fill","stroke","shadow","overlay","effects","blend","transformOrigin","zoom","lookAt","heading"]),sh={id:E,type:"canvas2d",parentId:null,layerOrder:0,props:{}},ae=["to","_prepareStep","_writeProp"],ui=["command","set","_writeProp"],ih={to:ae,set:["set","_writeProp"],save:["save"],fillTo:["fillTo",...ui],overlayTo:["overlayTo",...ui],strokeTo:["strokeTo",...ui],shadowTo:["shadowTo",...ui]},ah={...ih,restore:["restore","_prepareStep","_writeProp"],fadeTo:["fadeTo",...ae],rotateTo:["rotateTo",...ae],scaleTo:["scaleTo",...ae],moveTo:["moveTo",...ae,"command","set"],zoomTo:["zoomTo",...ae],panTo:["panTo",...ae],headingTo:["headingTo",...ae],countTo:["countTo",...ae],append:["append",...ae],prepend:["prepend",...ae]},h0={fadeTo:["opacity"],rotateTo:["rotation"],scaleTo:["scale"],moveTo:["x","y"],zoomTo:["zoom"],panTo:["lookAt"],headingTo:["heading"],fillTo:["fill"],overlayTo:["overlay"],strokeTo:["stroke"],shadowTo:["shadow"]},m0=new Set(Object.keys(ah).filter(e=>e!=="set"&&e!=="save"));function y0(e,t,r,n){if(th(t)||e==="moveTo"&&typeof t.target=="string"&&t.target!=="")return!0;let o=th(r),s=x0(r);return e==="save"||e==="restore"?o||s.size>0:m0.has(e)?(e==="append"||e==="prepend"?["text"]:e==="countTo"?["value"]:n??[]).some(a=>s.has(a)||o&&(a==="x"||a==="y")):!1}function g0(e,t){let r=h0[e];if(r)return r;if(e!=="to"&&e!=="set")return;let n=[];for(let o of Object.keys(t))o==="size"?n.push("width","height"):e==="to"&&o==="pivot"?n.push("transformOrigin"):e==="to"&&nh.includes(o)?n.push("x","y","transformOrigin"):n.push(o);return n}function th(e){return nh.some(t=>e[t]!==void 0)}var eh=new WeakMap;function x0(e){let t=eh.get(e);if(!t){let r=new Set;for(let n of Object.keys(e))El(e[n])&&r.add(n);eh.set(e,t=r)}return t}function fi(e,t){return e.prototype[t]}var rh=new WeakMap;function _0(e,t){let r=rh.get(e);r||rh.set(e,r=new Map);let n=r.get(t);return n===void 0&&(n=t.every(o=>{let s=fi(e,o);return s===void 0||w0(o).has(s)}),r.set(t,n)),n}var Al=null;function lh(){if(!Al){let e=new ci;Al={ctors:new Set(e.nodeKeys().map(t=>e.node(t).ctor)),methods:new Map}}return Al}function w0(e){let t=lh(),r=t.methods.get(e);if(!r){let n=new Set;for(let o of t.ctors)for(let s=o.prototype;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){let i=Object.getOwnPropertyDescriptor(s,e);i&&typeof i.value=="function"&&n.add(i.value)}t.methods.set(e,r=n)}return r}function Et(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return e!==e&&t!==t;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(!Et(e[s],t[s]))return!1;return!0}if(Array.isArray(t))return!1;let r=e,n=t,o=0;for(let s of Object.keys(r)){let i=r[s];if(i!==void 0&&(o++,!Et(i,n[s])))return!1}for(let s of Object.keys(n))n[s]!==void 0&&o--;return o===0}function v0(){return{identical:!0,kindChanged:!1,themeChanged:!1,rootChanged:!1,duration:!1,nodes:{added:new Set,removed:new Set,changed:new Set,respec:new Set,moved:new Set,span:new Set,reorderedParents:new Set},commands:{added:new Set,removed:new Set,changed:new Set,reorderedAts:new Set},variables:{added:new Set,removed:new Set,changed:new Set},remappedKeys:new Set}}function hi(e,t){let r=v0();if(e===t)return r;if(e.kind!==t.kind)return r.kindChanged=!0,r.identical=!1,r;let n=ch(e),o=ch(t);r.themeChanged=!Et(e.theme,t.theme),r.duration=Me(n)!==Me(o),e.nodes!==t.nodes&&S0(n.nodes,o.nodes,r),e.variables!==t.variables&&M0(n.variables??[],o.variables??[],r);let s=n.kind==="composition"?n.commands:[],i=o.kind==="composition"?o.commands:[];return e.commands!==t.commands&&k0(s,i,r),r.identical=!r.themeChanged&&!r.rootChanged&&!r.duration&&r.remappedKeys.size===0&&Pl(r.nodes)&&r.nodes.reorderedParents.size===0&&Pl(r.commands)&&r.commands.reorderedAts.size===0&&Pl(r.variables),r}function ch(e){return pr(e)?yn(e):e}function Pl(e){return e.added.size===0&&e.removed.size===0&&e.changed.size===0}var dh={id:E,type:"canvas2d",parentId:null,layerOrder:0,props:{}};function S0(e,t,r){let n=gn(e),o=gn(t),s=r.nodes,i=n.get(E)??dh,a=o.get(E)??dh;r.rootChanged=i!==a&&!b0(i,a);for(let[u,f]of n){if(u===E)continue;let h=o.get(u);if(!h){s.removed.add(u);continue}if(f===h)continue;let y=!1;(f.type!==h.type||f.key!==h.key||!Et(f.props,h.props))&&(s.respec.add(u),y=!0),f.parentId!==h.parentId&&(s.moved.add(u),y=!0),hh(f,h)||(s.span.add(u),y=!0),(y||f.layerOrder!==h.layerOrder)&&s.changed.add(u)}for(let u of o.keys())u!==E&&!n.has(u)&&s.added.add(u);let l=uh(e);for(let[u,f]of uh(t)){let h=l.get(u);h!==void 0&&h!==f&&r.remappedKeys.add(u)}let c=fh(e),d=fh(t);for(let[u,f]of c){let h=d.get(u);h&&!mh(f,h)&&s.reorderedParents.add(u)}}function b0(e,t){return e.type===t.type&&e.key===t.key&&e.parentId===t.parentId&&e.layerOrder===t.layerOrder&&Et(e.props,t.props)&&hh(e,t)}function hh(e,t){let r=Nt(e),n=Nt(t);return r.start===n.start&&r.end===n.end}function k0(e,t,r){let n=gn(e),o=gn(t),s=r.commands;for(let[l,c]of n){let d=o.get(l);if(!d){s.removed.add(l);continue}c!==d&&(c.type!==d.type||c.targetId!==d.targetId||c.at!==d.at||(c.duration??0)!==(d.duration??0)||!Et(c.easing,d.easing)||!Et(c.loop,d.loop)||!Et(c.args,d.args))&&s.changed.add(l)}for(let l of o.keys())n.has(l)||s.added.add(l);let i=ph(e),a=ph(t);for(let[l,c]of i){let d=a.get(l);d&&!mh(c,d)&&s.reorderedAts.add(l)}}function M0(e,t,r){let n=gn(e),o=gn(t),s=r.variables;for(let[i,a]of n){let l=o.get(i);if(!l){s.removed.add(i);continue}a!==l&&(a.lerp!==l.lerp||!Et(a.value,l.value))&&s.changed.add(i)}for(let i of o.keys())n.has(i)||s.added.add(i)}function gn(e){let t=new Map;for(let r of e)t.set(r.id,r);return t}function uh(e){let t=new Map;for(let r of e)r.key&&t.set(r.key,r.id);return t}function fh(e){let t=new Map;e.forEach((n,o)=>{if(n.id===E)return;let s=n.parentId??E,i=t.get(s);i||t.set(s,i=[]),i.push({id:n.id,order:n.layerOrder,index:o})});let r=new Map;for(let[n,o]of t)o.sort((s,i)=>s.order-i.order||s.index-i.index),r.set(n,o.map(s=>s.id));return r}function ph(e){let t=new Map;for(let r of e){let n=t.get(r.at);n||t.set(r.at,n=[]),n.push(r.id)}return t}function mh(e,t){let r=new Set(t),n=new Set(e),o=e.filter(i=>r.has(i)),s=t.filter(i=>n.has(i));if(o.length!==s.length)return!1;for(let i=0;i<o.length;i++)if(o[i]!==s[i])return!1;return!0}function A0(e){let t=e.indexOf(".");return t<0?void 0:{key:e.slice(0,t),prop:e.slice(t+1)}}function Tl(e,t=""){let r=[],n=[],o=0,s=new Set;for(let i of yt.collect(e,t)){let a=yt.tryParse(i.source);if("error"in a){o++;continue}for(let l of a.expression.refs){if(s.has(l))continue;s.add(l);let c=A0(l);c?n.push([c.key,c.prop]):r.push(l)}}return{vars:r,keys:n,unparsable:o}}function Rl(e){return new Dl(pr(e)?yn(e):e)}var O0=Object.freeze({vars:[],keys:[],unparsable:0}),E0=new Map,yh=[];function mi(e,t){return e!==void 0&&t>=e.start&&t<e.end}var Dl=class{doc;nodes=new Map;nodeCount;variables=new Map;commands=new Map;ordered;byTarget=new Map;keyed=new Map;dependents={byVar:new Map,byKey:new Map};duration;issues={duplicateIds:!1,duplicateKeys:!1,unresolvedParent:!1,cycle:!1,invalidRoot:!1,unparsable:!1,unresolvedRefs:!1};constructor(t){this.doc=t,this.duration=Me(t);let r=t.kind==="composition"?t.commands:[];this._indexNodes(t.nodes),this.nodeCount=this.nodes.size-1;for(let n of t.variables??[])(this.variables.has(n.id)||this.nodes.has(n.id))&&(this.issues.duplicateIds=!0),this.variables.set(n.id,n);this.ordered=r.map((n,o)=>({spec:n,index:o})).sort((n,o)=>n.spec.at-o.spec.at||n.index-o.index).map(n=>n.spec);for(let n of this.ordered){this.commands.has(n.id)&&(this.issues.duplicateIds=!0),this.commands.set(n.id,n);let o=this.targetOf(n),s=this.byTarget.get(o);s||this.byTarget.set(o,s=[]),s.push(n.id);let i=this._byAt.get(n.at);i||this._byAt.set(n.at,i=[]),i.push(n)}this._ats=[...this._byAt.keys()],this._indexRefs(r)}children(t){return this._children.get(t)??yh}descendants(t){let r=[],n=new Set([t]),o=[...this.children(t)].reverse();for(;o.length>0;){let s=o.pop();if(n.has(s))continue;n.add(s),r.push(s);let i=this.children(s);for(let a=i.length-1;a>=0;a--)o.push(i[a])}return r}ownSpan(t){let r=this.nodes.get(t);return r?Nt(r):void 0}effSpan(t){let r=this._eff.get(t);if(r)return r;if(!this.nodes.has(t))return;let n=[],o=new Set,s={start:0,end:1/0},i=this.nodes.get(t);for(;i;){let a=this._eff.get(i.id);if(a){s=a;break}if(o.has(i.id)||(o.add(i.id),n.push(i),i.id===E||i.parentId===null))break;i=this.nodes.get(i.parentId)}for(let a=n.length-1;a>=0;a--){let l=Nt(n[a]);s={start:Math.max(s.start,l.start),end:Math.min(s.end,l.end)},this._eff.set(n[a].id,s)}return this._eff.get(t)}targetOf(t){return t.targetId??E}commandsAt(t){return this._byAt.get(t)??yh}bindings(t){return this._bindings.get(t)??E0}refs(t){return this._refs.get(t)??O0}initialKey(t){return mi(this.ownSpan(t),0)?mi(this.effSpan(t),0)?"mounted":"unmounted":"absent"}captureKey(t){let r=this.captureTime(t);return r===void 0?"none":mi(this.effSpan(t),r)?"arrival-mounted":"arrival-unmounted"}captureTime(t){let r=this.ownSpan(t);if(!r||mi(r,0))return;let n=0,o=this._ats.length;for(;n<o;){let i=n+o>>1;this._ats[i]<r.start?n=i+1:o=i}let s=this._ats[n];return s!==void 0&&s<r.end?s:void 0}_children=new Map;_eff=new Map;_byAt=new Map;_ats=[];_bindings=new Map;_refs=new Map;_indexNodes(t){let r=new Map;t.forEach((o,s)=>{if(this.nodes.has(o.id)&&(this.issues.duplicateIds=!0),this.nodes.set(o.id,o),o.key&&(this.keyed.has(o.key)&&(this.issues.duplicateKeys=!0),this.keyed.set(o.key,o.id)),o.id===E){(o.type!=="canvas2d"||o.parentId!==null)&&(this.issues.invalidRoot=!0);return}let i=o.parentId??E,a=r.get(i);a||r.set(i,a=[]),a.push({id:o.id,order:o.layerOrder,index:s})}),this.nodes.has(E)||this.nodes.set(E,{id:E,type:"canvas2d",parentId:null,layerOrder:0,props:{}});for(let[o,s]of r)s.sort((i,a)=>i.order-a.order||i.index-a.index),this._children.set(o,s.map(i=>i.id));let n=new Set([E]);for(let o of this.nodes.values()){o.parentId!==null&&!this.nodes.has(o.parentId)&&(this.issues.unresolvedParent=!0);let s=new Set,i=o;for(;i&&!n.has(i.id);){if(s.has(i.id)){this.issues.cycle=!0;break}s.add(i.id),i=i.parentId===null?void 0:this.nodes.get(i.parentId)}for(let a of s)n.add(a)}}_indexRefs(t){for(let r of this.nodes.values())this._bind(r.id,r.props);for(let r of t){if(r.type==="set"){let n=this.targetOf(r);if(this.nodes.has(n)){this._bind(n,r.args);continue}}Tl(r.args).unparsable>0&&(this.issues.unparsable=!0)}for(let[r,n]of this._bindings){let o=new Set,s=new Map,i=0;for(let a of n.values()){for(let l of a.vars)o.add(l);for(let l of a.keys)s.set(`${l[0]}.${l[1]}`,l);i+=a.unparsable}this._refs.set(r,{vars:[...o],keys:[...s.values()],unparsable:i});for(let a of o){this.variables.has(a)||(this.issues.unresolvedRefs=!0);let l=this.dependents.byVar.get(a);l||this.dependents.byVar.set(a,l=new Set),l.add(r)}for(let[a]of s.values()){this.keyed.has(a)||(this.issues.unresolvedRefs=!0);let l=this.dependents.byKey.get(a);l||this.dependents.byKey.set(a,l=new Set),l.add(r)}}}_bind(t,r){if(r)for(let n of Object.keys(r)){let o=Tl(r[n]);if(o.unparsable>0&&(this.issues.unparsable=!0),o.vars.length===0&&o.keys.length===0)continue;let s=this._bindings.get(t);s||this._bindings.set(t,s=new Map);let i=s.get(n);if(!i){s.set(n,o);continue}let a=new Set([...i.vars,...o.vars]),l=new Map([...i.keys,...o.keys].map(c=>[`${c[0]}.${c[1]}`,c]));s.set(n,{vars:[...a],keys:[...l.values()],unparsable:i.unparsable+o.unparsable})}}};var C0=16;function bh(e,t,r,n,o={}){if(r.kindChanged||r.themeChanged||gh(e)||gh(t))return null;let s=e.nodes.get(E),i=t.nodes.get(E);if(r.rootChanged&&!P0(s,i)||t.issues.unparsable||t.issues.unresolvedRefs||r.remappedKeys.size>0)return null;let a=xh(e,n),l=a&&xh(t,n);if(!a||!l)return null;let{added:c,removed:d,respec:u,moved:f,span:h,reorderedParents:y}=r.nodes,w=v=>(t.byTarget.get(v)?.length??0)>0,g=(v,C,Z,Pt)=>v.byTarget.get(Z)?.some(bt=>Pt(C.get(bt)))??!1,x=v=>g(e,a,v,C=>!C.known)||g(t,l,v,C=>!C.known),_=(v,C)=>{let Z=v.nodes.get(C)?.type;return Z===void 0||n.dimensionOf?.(Z)!=="audio"},S=v=>_(e,v)||_(t,v),b=[];for(let v of t.nodes.keys())v!==E&&e.nodes.has(v)&&b.push(v);let k=new Set,M=v=>{let C=e.nodes.get(v)?.type,Z=t.nodes.get(v)?.type;return C!==void 0&&n.isContextProvider(C)||Z!==void 0&&n.isContextProvider(Z)},R=v=>{if(!k.has(v)&&(k.add(v),M(v)))for(let C of t.descendants(v))k.add(C)};for(let v of u)R(v);for(let v of f)if(R(v),vh(e,v,n)||vh(t,v,n))for(let C of t.descendants(v))k.add(C);for(let v of[...c,...d])if(M(v))for(let C of t.descendants(v))k.add(C);let et=!1;for(let v of b){let C=n.ctorOf(v);C!==void 0&&n.registeredCtor(t.nodes.get(v).type)!==C&&(R(v),S(v)&&(et=!0)),w(v)&&e.initialKey(v)!==t.initialKey(v)&&R(v)}let V=new Set,Ct=new Set,Yt=v=>{t.variables.has(v)?Ct.add(v):t.nodes.has(v)&&V.add(v)};for(let v of r.commands.added)Yt(t.targetOf(t.commands.get(v)));for(let v of r.commands.removed)Yt(e.targetOf(e.commands.get(v)));for(let v of r.commands.changed)Yt(e.targetOf(e.commands.get(v))),Yt(t.targetOf(t.commands.get(v)));for(let v of new Set([...e.byTarget.keys(),...t.byTarget.keys()]))R0(e.byTarget.get(v),t.byTarget.get(v))||Yt(v);for(let v of r.commands.reorderedAts){for(let C of e.commandsAt(v))Yt(e.targetOf(C));for(let C of t.commandsAt(v))Yt(t.targetOf(C))}if(r.duration)for(let v of t.commands.values())v.loop?.count===null&&Yt(t.targetOf(v));for(let v of r.variables.added)Ct.add(v);for(let v of r.variables.changed)Ct.add(v);let Br=new Set;for(let v of b)D0(e.effSpan(v),t.effSpan(v))?w(v)&&(e.captureKey(v)!==t.captureKey(v)||e.captureTime(v)!==t.captureTime(v))&&V.add(v):(Br.add(v),w(v)&&V.add(v));let le=y.size>0||et||[...c].some(v=>_(t,v))||[...d].some(v=>_(e,v))||[...f].some(S)||[...h].some(S)||[...u].some(v=>S(v)&&Sh(e.nodes.get(v),t.nodes.get(v),n))||r.rootChanged&&Sh(s,i,n),Vt=new Set([...c,...d,...Br]);r.rootChanged&&Vt.add(E);let Am=[..._h(e,n),..._h(t,n)],pc=(v,C)=>{let Z=t.nodes.get(v)?.type;if(Z===void 0||n.dimensionOf?.(Z)==="audio")return!1;for(let[Pt,bt]of t.bindings(v))if(C(bt)&&!n.isLayoutNeutralProp(Z,Pt))return!0;return!1},hc=-1;for(;hc!==V.size+Ct.size+k.size+Vt.size+(le?1:0);){hc=V.size+Ct.size+k.size+Vt.size+(le?1:0);for(let v of k)w(v)&&V.add(v);for(let v of k)Vt.add(v);for(let v of V)Vt.add(v);for(let v of Ct)for(let C of t.dependents.byVar.get(v)??[])Vt.add(C),!le&&pc(C,Z=>Z.vars.includes(v))&&(le=!0);for(let v of Vt)for(let C of T0(e,t,v))for(let Z of t.dependents.byKey.get(C)??[])Vt.add(Z),!le&&pc(Z,Pt=>Pt.keys.some(([bt])=>bt===C))&&(le=!0);for(let{reader:v,ref:C}of Am)(wh(e,C,Vt)||wh(t,C,Vt))&&Vt.add(v);for(let v of Vt)t.nodes.has(v)&&w(v)&&V.add(v);for(let v of V)v!==E&&x(v)&&R(v);if(!le){for(let v of[...V,...Ct])if(g(e,a,v,C=>C.writesLayout)||g(t,l,v,C=>C.writesLayout)){le=!0;break}}if(le)for(let v of t.byTarget.keys())t.nodes.has(v)&&g(t,l,v,C=>C.readsLayout)&&V.add(v)}if(V.has(E)&&x(E))return null;let Om=Math.max((o.rebuildFraction??.5)*t.nodeCount,o.minRebuildNodes??C0);if(k.size>Om)return null;let bn;if([...V,...Ct].some(v=>g(t,l,v,C=>C.readsLayout||!C.known)))bn="all";else{bn=new Set;let v=[],C=new Set;for(let Z of V){let Pt=t.refs(Z);Pt.vars.length===0&&Pt.keys.length===0||(t.byTarget.get(Z)??[]).some(bt=>t.commands.get(bt).type!=="set")&&(C.add(Z),v.push(Z))}for(;v.length>0;){let Z=t.refs(v.pop());for(let Pt of Z.vars)!Ct.has(Pt)&&w(Pt)&&bn.add(Pt);for(let[Pt]of Z.keys){let bt=t.keyed.get(Pt);bt!==void 0&&(!V.has(bt)&&w(bt)&&bn.add(bt),C.has(bt)||(C.add(bt),v.push(bt)))}}}let Gi=new Set([...d,...k]);for(let v of y)for(let C of t.children(v))e.nodes.has(C)&&Gi.add(C);for(let v of k)for(let C of t.children(v))Gi.add(C);let Yi=[];for(let v of new Set([...V,...k,...c])){if(!w(v))continue;let C=t.captureTime(v);C!==void 0&&Yi.push({at:C,id:v})}return Yi.sort((v,C)=>v.at-C.at),{prev:e,next:t,diff:r,added:c,removed:d,reinstantiate:k,detach:Gi,dirtyNodes:V,dirtyVariables:Ct,replay:bn,captures:Yi,layoutChanged:le}}function gh(e){let{duplicateIds:t,duplicateKeys:r,unresolvedParent:n,cycle:o,invalidRoot:s}=e.issues;return t||r||n||o||s}function xh(e,t){let r=new Map;for(let n of e.ordered){let o=e.targetOf(n),s=e.nodes.get(o),i=t.traits(n,s);if(!i||i.lifecycle||(i.scope==="variable"?!e.variables.has(o):!s))return null;r.set(n.id,i)}return r}function _h(e,t){if(!t.nodeRefs)return[];let r=[];for(let n of e.ordered){let o=e.targetOf(n);for(let s of t.nodeRefs(n,e.nodes.get(o)))r.push({reader:o,ref:s})}return r}function wh(e,t,r){let n=new Set,o=t;for(;o!==void 0&&!n.has(o);){if(r.has(o))return!0;n.add(o);let s=e.nodes.get(o);if(!s||o===E)return!1;o=s.parentId??E}return!1}function vh(e,t,r){let n=new Set([t]),o=e.nodes.get(t);for(;o&&o.id!==E;){let s=o.parentId??E;if(n.has(s))return!1;if(n.add(s),o=e.nodes.get(s),o&&r.isContextProvider(o.type))return!0}return!1}function P0(e,t){let r=Nt(e),n=Nt(t);return e.type===t.type&&e.key===t.key&&e.parentId===t.parentId&&e.layerOrder===t.layerOrder&&r.start===n.start&&r.end===n.end}function Sh(e,t,r){if(e.type!==t.type||e.key!==t.key)return!0;for(let n of new Set([...Object.keys(e.props),...Object.keys(t.props)]))if(!Et(e.props[n],t.props[n])&&!r.isLayoutNeutralProp(t.type,n))return!0;return!1}function T0(e,t,r){let n=[],o=e.nodes.get(r)?.key,s=t.nodes.get(r)?.key;return o&&n.push(o),s&&s!==o&&n.push(s),n}function D0(e,t){return e?.start===t?.start&&e?.end===t?.end}function R0(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function F0(e,t){if(e)switch(e.kind){case"linear":return es();case"in":return Ru(e.args);case"out":return Fu(e.args);case"inOut":return Iu(e.args);case"custom":{let r=e.args;if(ai(r))return zp(r);if(typeof r!="string")throw new Error(`A "custom" ease needs a curve or its Registry.addEase key in \`args\` (got ${JSON.stringify(e.args)}).`);let n=t.ease(r);if(!n)throw new Error(`No ease registered under "${r}". Registered: ${t.easeKeys().join(", ")||"none"}.`);return n}}}function I0(e){return e.map((t,r)=>({spec:t,index:r})).sort((t,r)=>t.spec.at-r.spec.at||t.index-r.index).map(t=>t.spec)}function z0(){return{id:E,type:"canvas2d",parentId:null,layerOrder:0,props:{}}}function kh(e){let t=[],r;for(let n of e){if(n.id===E&&n.type==="canvas2d"){r=n;continue}t.push(n)}return{root:r??z0(),rest:t}}function Mh(e){let t=new Map;for(let r of e.nodes)t.set(r.id,Nt(r));return t.delete(E),t}var gi=class{canvas;constructor(t,r,n){this.canvas=n,this._doc=t,this._registry=r;let{root:o,rest:s}=kh(t.nodes);this._rootSpec=o,this._specs=s,this._varSpecs=t.variables??[],this._keyed=new Map([o,...s].filter(i=>!!i.key).map(i=>[i.key,i.id])),this._spans=Mh(t),this._duration=Me(t)}get duration(){return this._duration}build(){this._buildVariables(),this._pristineRoot=As(this.canvas),this._applyRootProps();for(let t of this._specs)this._live.set(t.id,{spec:t,node:this._instantiate(t),initial:jr,initialStackDepth:0,baseline:jr,baseStackDepth:0,presence:new Wt(!1,null,Xe+t.id)});this._baseChildCount.set(E,this.canvas._allChildren.length);for(let[t,r]of this._live)this._baseChildCount.set(t,r.node._allChildren.length);this.syncPresence(0),this._root={spec:this._rootSpec,node:this.canvas,initial:jr,initialStackDepth:0,baseline:jr,baseStackDepth:0,presence:new Wt(!0,null,Xe+E)};for(let t of this._live.values())yi(t);yi(this._root),this._baselined=new Set(this._present)}compile(t=()=>{}){this._compileCommands(t),this._restoreBaselines(),this.syncPresence(0)&&t()}variableValue(t){return this._vars.get(t)?.cell.get()}variables(){return this._varSpecs}placedCommands(){return this._placed}evaluateAt(t,r){if(r){Ms(()=>this._restoreBaselines()),this._evaluateObserved(t,r);return}this._restoreBaselines();for(let n of this._placed){if(t<n.start)continue;let o=n.duration>0?(t-n.start)/n.duration:1;n.command.at(ce(o))}}syncPresence(t){let r=this._presenceIndex().crossed(t);if(r.length===0)return!1;let n=[],o=[];for(let i of r){let a=xi(i,t);a!==this._present.has(i.id)&&(a?n:o).push(i)}if(this._arrived=n,n.length===0&&o.length===0)return!1;o.sort(Eh);for(let i of o){this._present.delete(i.id),i.siblings.add(i.slot,-1);let a=this._live.get(i.id);a&&(a.presence.set(!1),this._parentNodeOf(a.spec)?.remove(a.node))}n.sort(Eh);let s=new Map;for(let i of n){let a=s.get(i.siblings);a?a.push(i):s.set(i.siblings,[i])}for(let[i,a]of s){a.sort((d,u)=>d.slot-u.slot);let l=i.parentId===E?this.canvas:this._live.get(i.parentId)?.node,c=this._baseChildCount.get(i.parentId)??0;for(let d of a){this._present.add(d.id);let u=c+i.before(d.slot);i.add(d.slot,1);let f=this._live.get(d.id);f&&(f.presence.set(!0),l?.addChildAt({data:{child:f.node,index:u}}))}}return!0}liveNode(t){return t===E?this.canvas:this._live.get(t)?.node}presenceSlot(t){return t===E?this._root?.presence:this._live.get(t)?.presence}variableSlot(t){return this._vars.get(t)?.cell}planUpdate(t){let r=this._docIndex??=Rl(this._doc);return bh(r,Rl(t),hi(this._doc,t),this._patchEnvironment())}applyUpdate(t,r,n){if(!this._root)throw new Error("SceneTimeline.applyUpdate needs a built timeline.");if(t.prev!==this._docIndex)throw new Error("This patch was planned against a different version of the document.");this._restoreBaselines(),this.syncPresence(0),this._updateVariables(t),this._keyed.clear();for(let[d,u]of t.next.keyed)this._keyed.set(d,u);let o=this._updateStructure(t);for(let d of o)yi(d),this._present.has(d.spec.id)&&this._baselined.add(d.spec.id);if(t.diff.rootChanged){let d=this.canvas;kr(d,this._pristineRoot),d._stateStack.length=0,this._applyRootProps(),yi(this._root)}for(let d of t.dirtyNodes){let u=d===E?this._root:this._live.get(d);u&&!o.has(u)&&N0(u)}n();let s=new Map;for(let d of this._placed)s.set(d.spec.id,d);let i=this._walkPatch(t,s,r),a=d=>t.dirtyNodes.has(d)||t.dirtyVariables.has(d),l=[],c=new Set;if(this._animated=[],this._animatedVars=[],!ni(this._doc))for(let d of t.next.ordered){let u=i.get(d.id);if(!u&&!a(t.next.targetOf(d))){let f=s.get(d.id);f&&(u=f.spec===d?f:{...f,spec:d})}u&&(l.push(u),this._touch(u,c))}this._placed=l,this._restoreBaselines(),this.syncPresence(0)&&r()}_doc;_registry;_rootSpec;_specs;_varSpecs;_spans;_duration;_docIndex=null;_pristineRoot=jr;_live=new Map;_vars=new Map;_keyed;_placed=[];_root=null;_animated=[];_animatedVars=[];_baseChildCount=new Map;_present=new Set;_baselined=new Set;_presence=null;_arrived=[];_resolveVariable=t=>{let r=t.indexOf(".");if(r>0){let n=this._keyed.get(t.slice(0,r));if(n===void 0)return;let o=t.slice(r+1);return()=>this._nodeById(n)?.[o]}return this._vars.get(t)?.read};_nodeById(t){if(t===E)return this.canvas;let r=this._live.get(t);if(r)return q!==null&&this._readPresence(r),r.node.mounted?r.node:void 0}_readPresence(t){let r=t;for(let n=0;r&&n<=this._live.size;n++)r.presence.get(),r=r.spec.parentId===null?void 0:this._live.get(r.spec.parentId)}_applyRootProps(){let{literal:t,bindings:r}=yt.bindProps(this._rootSpec.props,this._resolveVariable);this.canvas.set({...t,...r})}_instantiate(t){let{literal:r,bindings:n,hasBindings:o}=yt.bindProps(t.props,this._resolveVariable),s=this._registry.instantiate(t,r);return o&&s.set(n),s}_buildVariables(){for(let t of this._varSpecs){if(this._vars.has(t.id))throw new Error(`Duplicate variable id "${t.id}". Ids must be unique \u2014 an expression writing "[${t.id}]" would otherwise name whichever declaration was read last.`);this._vars.set(t.id,this._liveVariable(t))}}_liveVariable(t){let r=new Wt(t.value,null,ks+t.id);return{spec:t,cell:r,read:()=>r.get(),target:this._variableTarget(t,r),baseline:t.value}}_variableTarget(t,r){let n=this._registry.requireLerp(t.lerp,t.value,`variable "${t.id}"`);return{id:t.id,get:()=>r.get(),set:o=>r.set(o),lerp:n}}_restoreBaselines(){for(let t of this._animatedVars)t.cell.set(t.baseline);for(let t of this._animated){let r=t.node;kr(r,t.baseline),r._stateStack.length>t.baseStackDepth&&(r._stateStack.length=t.baseStackDepth)}}_compileCommands(t){if(ni(this._doc))return;let r=new Set,n=I0(this._doc.commands),o=this._refBound(n),s=this._settleWindows(n,i=>this._readsLayout(n[i],o));for(let i=0;i<n.length;i++){let a=n[i];if(this.syncPresence(a.at)){for(let c of this._arrived){if(this._baselined.has(c.id))continue;let d=this._live.get(c.id);d&&Il(d),this._baselined.add(c.id)}s[i]&&t()}let l=this._buildPlaced(a);l&&(this._placed.push(l),this._touch(l,r))}}_buildPlaced(t){let r=this._registry.command(t.type);if(!r){let h=this._targetOf(t)?.entry.spec.type,y=h?this._registry.nodeCommand(h,t.type):void 0;if(!y)throw new Error(`Node type "${h??"?"}" has no command "${t.type}" (command ${t.id}). It publishes: ${h?this._registry.commandKeys(h).join(", ")||"none":"\u2014"}.`+(Ah[t.type]?` ${Ah[t.type]}`:""));r={key:t.type,scope:"node",factory:y}}let n=t.duration??0,o=F0(t.easing,this._registry),s=new Fl,i=xc(t.loop)?t.loop:void 0,a=f=>f&&i?wc(f,i,this._unlimitedFill(t.at)):f;if(r.scope==="variable"){let f=t.targetId===null?void 0:this._vars.get(t.targetId);if(!f)throw new Error(`Command ${t.id} ("${t.type}") targets variable "${t.targetId}", which this document does not declare.`);this._assertNoExpressions(t);let{factory:h}=r,y=De(s,()=>Oh(()=>a(h(f.target,t.args,n,o))));return{spec:t,start:t.at,duration:i?y.duration:n,command:y,writes:s.writes,readsLayout:s.readsLayout,owner:f}}let l=this._targetOf(t);if(!l)return null;let c=r.binds?this._bindArgs(t.args):(this._assertNoExpressions(t),t.args),{factory:d}=r,u=De(s,()=>Oh(()=>a(d(l.node,c,n,o))));return{spec:t,start:t.at,duration:i?u.duration:n,command:u,writes:s.writes,readsLayout:s.readsLayout,owner:l.entry}}_unlimitedFill(t){return Math.max(0,this._duration-t)}_touch(t,r){this._touchOwner(t.owner,r);for(let n of t.writes){let o=n._host;if(o===null)continue;let s=o.id===E?this._root:this._live.get(o.id);s&&this._touchOwner(s,r)}}_touchOwner(t,r){r.has(t)||(r.add(t),"cell"in t?this._animatedVars.push(t):this._animated.push(t))}_bindArgs(t){let{literal:r,bindings:n}=yt.bindProps(t,this._resolveVariable,"args");return{...r,...n}}_assertNoExpressions(t){let r=yt.collect(t.args,"args");if(r.length===0)return;let{path:n,source:o}=r[0];throw new Error(`Command ${t.id} ("${t.type}") carries an expression at ${n}: ${JSON.stringify(o)}. Expressions bind a prop to a variable; they are not tween destinations. Bind the prop where the node is authored (or with a "set" command) and animate the variable with "variableTo" instead.`)}_targetOf(t){if(t.targetId===null)return this._root?{id:E,node:this._root.node,entry:this._root}:null;let r=this._live.get(t.targetId);return r?{id:t.targetId,node:r.node,entry:r}:null}_evaluateObserved(t,r){let n=0;De({read:()=>{},write:s=>r(n,s)},()=>{for(;n<this._placed.length;n++){let s=this._placed[n];if(t<s.start)continue;let i=s.duration>0?(t-s.start)/s.duration:1;s.command.at(ce(i))}})}_settleWindows(t,r){let n=this._presenceIndex(),o=new Uint8Array(t.length),s=-1,i=n.time;for(let a=0;a<t.length;a++){let{at:l}=t[a];n.differs(i,l)&&(s=a),i=l,!(s<0||o[s])&&r(a)&&(o[s]=1)}return o}_readsLayout(t,r){let n=t.targetId??E,o=t.targetId===null?this._rootSpec:this._live.get(t.targetId)?.spec,s=Ol(this._registry,t,o);return s===null||s.readsLayout||r.has(n)}_refBound(t){let r=new Set;for(let n of t){let o=this._registry.command(n.type);o?.scope==="node"&&o.binds&&El(n.args)&&r.add(n.targetId??E)}return r}_presenceIndex(){return this._presence??=new _i(this._specs,this._spans)}_parentNodeOf(t){return t.parentId===null?this.canvas:this._live.get(t.parentId)?.node}_patchEnvironment(){let t=this._registry;return{traits:(r,n)=>Ol(t,r,n),nodeRefs:(r,n)=>oh(t,r,n),isContextProvider:r=>pi(t,r),isLayoutNeutralProp:(r,n)=>Cl(t,r,n),ctorOf:r=>this._live.get(r)?.node.constructor,registeredCtor:r=>t.node(r)?.ctor,dimensionOf:r=>t.node(r)?.descriptor.dimension}}_updateVariables(t){let{added:r,removed:n,changed:o}=t.diff.variables;for(let s of n)this._vars.delete(s);for(let s of r)this._vars.set(s,this._liveVariable(t.next.variables.get(s)));for(let s of o){let i=t.next.variables.get(s),a=this._vars.get(s);if(!a){this._vars.set(s,this._liveVariable(i));continue}a.baseline=i.value,a.target=this._variableTarget(i,a.cell)}for(let s of t.next.variables.values()){let i=this._vars.get(s.id);i&&(i.spec=s)}for(let s of t.dirtyVariables){let i=this._vars.get(s);i&&i.cell.set(i.baseline)}}_updateStructure(t){let{next:r}=t;for(let l of t.detach){let c=this._live.get(l);c&&(c.node.parent?.remove(c.node),c.presence.set(!1),this._present.delete(l))}let n=l=>this._live.get(l.id)?.node===l;for(let l of t.removed){let c=this._live.get(l);c&&(zl(c.node,n),this._live.delete(l),this._baseChildCount.delete(l),this._baselined.delete(l))}for(let l of t.reinstantiate){let c=this._live.get(l);c&&zl(c.node,n)}let{root:o,rest:s}=kh(r.doc.nodes),i=new Set;for(let l of s){let c=this._live.get(l.id);if(c&&!t.reinstantiate.has(l.id)){c.spec=l;continue}let d=this._instantiate(l);c?(c.spec=l,c.node=d,this._baselined.delete(l.id)):(c={spec:l,node:d,initial:jr,initialStackDepth:0,baseline:jr,baseStackDepth:0,presence:new Wt(!1,null,Xe+l.id)},this._live.set(l.id,c)),this._baseChildCount.set(l.id,d._allChildren.length),i.add(c)}this._doc=r.doc,this._docIndex=r,this._rootSpec=o,this._root.spec=o,this._specs=s,this._varSpecs=r.doc.variables??[],this._spans=Mh(r.doc),this._duration=Me(r.doc);let a=this._presence=new _i(this._specs,this._spans);for(let l of[...this._present]){let c=a.row(l);if(c&&xi(c,0)){c.siblings.add(c.slot,1);continue}this._present.delete(l);let d=this._live.get(l);d&&(d.presence.set(!1),d.node.parent?.remove(d.node))}return this.syncPresence(0),i}_walkPatch(t,r,n){let o=new Map;if(ni(this._doc))return o;let{next:s}=t,i=y=>t.dirtyNodes.has(y)||t.dirtyVariables.has(y),a=this._refBound(s.ordered),l=t.replay;l!=="all"&&[...a].some(i)&&(l="all");let c=[],{captures:d}=t,u=0;for(let y of s.ordered){for(;u<d.length&&d[u].at<=y.at;)c.push({at:d[u].at,capture:d[u++].id});let w=s.targetOf(y);(l==="all"||i(w)||l.has(w))&&c.push({at:y.at,spec:y})}for(;u<d.length;u++)c.push({at:d[u].at,capture:d[u].id});let f=this._settleWindows(c,y=>{let w=c[y].spec;return w!==void 0&&i(s.targetOf(w))&&this._readsLayout(w,a)}),h=!1;for(let y=0;y<c.length;y++){let w=c[y];if(f[y]&&(h=!0),this.syncPresence(w.at),w.capture!==void 0){let S=this._live.get(w.capture);S&&Il(S),this._baselined.add(w.capture);continue}h&&(n(),h=!1);let g=w.spec,x=r.get(g.id);if(x&&!i(s.targetOf(g))){x.command.at(1);continue}let _=this._buildPlaced(g);_&&o.set(g.id,_)}return o}},Ah={add:"A node is a row in `nodes`, entering at its `startAt`.",remove:"A node leaves at its `endAt`.",variable:"A variable is declared in `variables`."},jr=new Map,Fl=class{writes=new Set;readsLayout=!1;read(t){t._name===Ue&&(this.readsLayout=!0)}write(t){this.writes.add(t)}};function Oh(e){let t=e();return t?(t.at(1),t):jt(0,()=>{e()})}function Il(e){let t=e.node;e.baseline=As(t),e.baseStackDepth=t._stateStack.length}function yi(e){Il(e),e.initial=e.baseline,e.initialStackDepth=e.baseStackDepth}function N0(e){let t=e.node;kr(t,e.initial),t._stateStack.length>e.initialStackDepth&&(t._stateStack.length=e.initialStackDepth),e.baseline=e.initial,e.baseStackDepth=e.initialStackDepth}function zl(e,t){for(let r of e._allChildren)t(r)||zl(r,t);e.dispose()}function xi(e,t){return t>=e.start&&t<e.end}function Eh(e,t){return e.order-t.order}var Nl=class{parentId;constructor(t,r){this.parentId=t,this._tree=new Int32Array(r+1)}add(t,r){for(let n=t+1;n<this._tree.length;n+=n&-n)this._tree[n]+=r}before(t){let r=0;for(let n=t;n>0;n-=n&-n)r+=this._tree[n];return r}_tree},_i=class{time=-1/0;constructor(t,r){let n=new Map;t.forEach((o,s)=>{if(!r.has(o.id))return;let i=o.parentId??E,a=n.get(i);a?a.push({spec:o,order:s}):n.set(i,[{spec:o,order:s}])});for(let[o,s]of n){s.sort((a,l)=>a.spec.layerOrder-l.spec.layerOrder);let i=new Nl(o,s.length);s.forEach(({spec:a,order:l},c)=>{let{start:d,end:u}=r.get(a.id),f={id:a.id,start:d,end:u,order:l,slot:c,siblings:i,pass:0};this._rows.set(a.id,f),this._events.push({time:d,row:f}),Number.isFinite(u)&&this._events.push({time:u,row:f})})}this._events.sort((o,s)=>o.time-s.time)}crossed(t){this.time=t;let r=this._upperBound(t);if(r===this._cursor)return $0;let n=Math.min(r,this._cursor),o=Math.max(r,this._cursor);this._cursor=r;let s=++this._pass,i=[];for(let a=n;a<o;a++){let{row:l}=this._events[a];l.pass!==s&&(l.pass=s,i.push(l))}return i}differs(t,r){let n=this._upperBound(Math.min(t,r)),o=this._upperBound(Math.max(t,r));for(let s=n;s<o;s++){let{row:i}=this._events[s];if(xi(i,t)!==xi(i,r))return!0}return!1}row(t){return this._rows.get(t)}_events=[];_rows=new Map;_cursor=0;_pass=0;_upperBound(t){let r=0,n=this._events.length;for(;r<n;){let o=r+n>>>1;this._events[o].time<=t?r=o+1:n=o}return r}},$0=[];function zz(e){return e.x===0&&e.y===0&&e.scale===1&&e.rotation===0}function j0(e){let t=e.fontFamily;if(typeof t=="string"&&t!=="")return t;let r=Oc();if(r!=="")return r;let n=e.text?` drawing "${e.text.slice(0,32)}"`:"";throw new Error(`Text${n} has no fontFamily. Set one on the text itself, on an enclosing <DefaultTextStyle>, or as the theme's \`default\` typography preset \u2014 there is no fallback face.`)}function Nz(e){let t=e.width??0,r=e.height??0,{x:n,y:o,pivot:s}=Jt(e,t,r);return{...Zt(e),opacity:e.opacity??1,rotation:e.rotation??0,scale:e.scale??1,x:n,y:o,start:e.start??0,end:e.end??1,pivot:wt(s),text:e.text??"",fontSize:e.fontSize??48,fontFamily:j0(e),fontWeight:e.fontWeight??400,fontStyle:e.fontStyle??"normal",letterSpacing:e.letterSpacing??0,lineHeight:e.lineHeight??0,textAlign:e.textAlign??"center",verticalAlign:e.verticalAlign??"center",textDecoration:e.textDecoration??"none",wrap:e.wrap??!1,minFontSize:e.minFontSize??12,width:e.width??0,height:e.height??0,segments:e.segments,path:e.path??null}}function Bz(e){let t=e.width??0,r=e.height??0,{x:n,y:o,pivot:s}=Jt(e,t,r);return{...Zt(e),opacity:e.opacity??1,rotation:e.rotation??0,scale:e.scale??1,x:n,y:o,start:e.start??0,end:e.end??1,pivot:wt(s),spans:e.spans??[],lineHeight:e.lineHeight??1.2,textAlign:e.textAlign??"center",width:t,height:r}}function qz(e){return{x:e.x??0,y:e.y??0,width:e.width??0,height:e.height??0,opacity:e.opacity??1,blend:e.blend??"pass-through",rotation:e.rotation??0,scale:e.scale??1,effects:e.effects??[],pivot:e.pivot??{x:0,y:0},matrix:e.matrix}}function Yz(e){return typeof e=="string"?e:e.map(t=>{switch(t.type){case"M":case"m":return`${t.type} ${t.x} ${t.y}`;case"L":case"l":return`${t.type} ${t.x} ${t.y}`;case"T":case"t":return`${t.type} ${t.x} ${t.y}`;case"H":case"h":return`${t.type} ${t.x}`;case"V":case"v":return`${t.type} ${t.y}`;case"C":case"c":return`${t.type} ${t.x1} ${t.y1} ${t.x2} ${t.y2} ${t.x} ${t.y}`;case"S":case"s":return`${t.type} ${t.x2} ${t.y2} ${t.x} ${t.y}`;case"Q":case"q":return`${t.type} ${t.x1} ${t.y1} ${t.x} ${t.y}`;case"A":case"a":return`${t.type} ${t.rx} ${t.ry} ${t.rotation} ${t.largeArc} ${t.sweep} ${t.x} ${t.y}`;case"Z":case"z":return t.type}}).join(" ")}function Vz(e){return{opacity:e.opacity??1,rotation:e.rotation??0,scale:e.scale??1,x:e.x??0,y:e.y??0,start:e.start??0,end:e.end??1,width:e.width??0,height:e.height??0,pivot:wt(e.pivot),data:e.data??"",centerBounds:e.centerBounds}}var B0=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing"],L0=["lineHeight","textAlign"];function Ph(e,t){let r=Ch(t)?t:Ke,n=e.ops(),o=null;for(let s=0;s<n.length;s++){let i=n[s];if(i.kind!=="text"&&i.kind!=="richText")continue;let a=q0(i.state.variant,r);if(!Ch(a))continue;let l=i.kind==="text"?W0(i,a):G0(i,a);l&&(o||(o=n.slice()),o[s]=l)}return o?e._withOps(o):e}function q0(e,t){return ot.mergeStyle(t,e?ot.preset(e):void 0)}function Ch(e){for(let t of fs)if(e[t]!==void 0)return!0;return!1}function W0(e,t){let r=$l(e.state,t,fs);return r?{kind:"text",state:r}:null}function G0(e,t){let r=$l(e.state,t,L0),n=Y0(e.state.spans,t);return n&&(r={...r??e.state,spans:n}),r?{kind:"richText",state:r}:null}function Y0(e,t){if(!e||e.length===0)return null;let r=t.fontSize==="autofit"?{...t,fontSize:void 0}:t,n=null;for(let o=0;o<e.length;o++){let s=$l(e[o],r,B0);s&&((n??=e.slice())[o]=s)}return n}function $l(e,t,r){let n=e,o=null;for(let s of r){if(n[s]!==void 0)continue;let i=t[s];i!==void 0&&((o??={...n})[s]=i)}return o}var po=class{textStyleStack=[];pushTextStyle(t){this.textStyleStack.push(t===null?Ke:ot.mergeStyle(this.defaultTextStyle,t))}popTextStyle(){this.textStyleStack.pop()}get defaultTextStyle(){return this.textStyleStack[this.textStyleStack.length-1]??ot.preset("default")}draw(t){this.drawGraphics(Ph(t,this.defaultTextStyle))}layoutTextBlock(t){return null}currentNodeStack=[];currentNodeId(){if(this.currentNodeStack.length===0)throw new Error("No current node in context");return this.currentNodeStack[this.currentNodeStack.length-1]}_disposed=!1;isDisposed(){return this._disposed}dispose(){this._disposed=!0}beginEffects(t,r,n,o){}endEffects(){}rasterize(t,r,n,o){return null}renderStateStack=[];readsSpaceRects=!0;drawsVisibleOnly=!0;begin(t){this.currentNodeStack.push(t.id),this.renderStateStack.push(t)}end(){this.currentNodeStack.pop(),this.renderStateStack.pop()}currentSpaceRects(){return this.renderStateStack[this.renderStateStack.length-1]?.rects??{}}currentRenderState(){return this.renderStateStack[this.renderStateStack.length-1]}_resetScopes(){this.textStyleStack.length=0,this.currentNodeStack.length=0,this.renderStateStack.length=0}};function jl(e){let t=e.lines[e.lines.length-1];return t?t.end+1:1}function Th(e){return typeof e?.layoutTextBlock=="function"?e:null}var V0={width:0,height:0},Bl=class extends po{readsSpaceRects=!1;drawGraphics(t){}measureText(){return V0}unmount(){}execute(t){t()}screenshot(){}rasterize(t,r,n){return n(),null}transform(t){return this}beginBoolean(t){}endBoolean(){}beginMask(t){}applyMask(){}endMask(){}beginClip(t){}endClip(){}beginCamera(t,r,n,o){}endCamera(){}};var K0={box:e=>({type:"box",...e}),sphere:e=>({type:"sphere",...e}),plane:e=>({type:"plane",...e}),cylinder:e=>({type:"cylinder",...e}),cone:e=>({type:"cone",...e}),torus:e=>({type:"torus",...e}),torusKnot:e=>({type:"torusKnot",...e}),circle:e=>({type:"circle",...e}),ring:e=>({type:"ring",...e}),capsule:e=>({type:"capsule",...e}),tetrahedron:e=>({type:"polyhedron",shape:"tetrahedron",...e}),octahedron:e=>({type:"polyhedron",shape:"octahedron",...e}),icosahedron:e=>({type:"polyhedron",shape:"icosahedron",...e}),dodecahedron:e=>({type:"polyhedron",shape:"dodecahedron",...e}),extrude:e=>({type:"extrude",...e}),lathe:e=>({type:"lathe",...e}),tube:e=>({type:"tube",...e}),buffer:e=>({type:"buffer",...e}),parametric:e=>({type:"parametric",...e}),edges:(e,t)=>({type:"edges",source:e,...t}),wireframe:e=>({type:"wireframe",source:e}),model:(e,t)=>({type:"modelGeometry",src:e,...t})},H0={basic:e=>({type:"basic",...e}),standard:e=>({type:"standard",...e}),physical:e=>({type:"physical",...e}),phong:e=>({type:"phong",...e}),lambert:e=>({type:"lambert",...e}),toon:e=>({type:"toon",...e}),normal:e=>({type:"normal",...e}),depth:e=>({type:"depth",...e}),matcap:e=>({type:"matcap",...e}),points:e=>({type:"points",...e}),lineBasic:e=>({type:"lineBasic",...e}),lineDashed:e=>({type:"lineDashed",...e}),sprite:e=>({type:"sprite",...e}),shadow:e=>({type:"shadow",...e}),shader:e=>({type:"shader",...e})},U0={image:(e,t)=>({src:e,...t}),data:(e,t,r,n)=>({data:e,width:t,height:r,...n}),surface:(e,t)=>({width:512,height:512,...t,source:e})};function X0(e,t){return e===void 0?t.map(Ll):typeof e=="number"?t.map(()=>Ll(e)):t.map((r,n)=>Ll(e[n]??r))}function Ll(e){return Math.max(1,Math.floor(e))}function Z0(e,t){return t<=0?3:Math.max(3,Math.min(16,Math.round(e/t*40)))}function J0(e){let t=[e.width/2,e.height/2,e.depth/2],r=Math.max(t[0],t[1],t[2]),n=Math.max(0,Math.min(e.radius,t[0],t[1],t[2])),o=[Math.max(0,t[0]-n),Math.max(0,t[1]-n),Math.max(0,t[2]-n)],s=Z0(n,r),i=[],a=[],l=[],c=[];for(let d of Q0(t,o,n,e.segments,s))t_(d,t,i,a,l,c);return{type:"buffer",position:new Float32Array(i),normal:new Float32Array(a),uv:new Float32Array(l),index:new Uint32Array(c),staticData:!0}}function*Q0(e,t,r,n,o){let s=[0,1,2],i=[-1,1];for(let a of s){let l=(a+1)%3,c=(a+2)%3;for(let d of i){let u=r_(a,d);yield{uSteps:n[l],vSteps:n[c],normal:()=>u,position:(f,h)=>{let y=[0,0,0];return y[a]=d*e[a],y[l]=ql(-t[l],t[l],f),y[c]=ql(-t[c],t[c],h),y}}}}if(!(r<=0)){for(let a of s){let l=(a+1)%3,c=(a+2)%3;for(let d of i)for(let u of i)yield{uSteps:o,vSteps:n[a],normal:f=>{let h=f*Math.PI/2,y=[0,0,0];return y[l]=d*Math.cos(h),y[c]=u*Math.sin(h),y},position:(f,h)=>{let y=f*Math.PI/2,w=[0,0,0];return w[l]=d*(t[l]+r*Math.cos(y)),w[c]=u*(t[c]+r*Math.sin(y)),w[a]=ql(-t[a],t[a],h),w}}}for(let a of i)for(let l of i)for(let c of i){let d=[a*t[0],l*t[1],c*t[2]],u=(f,h)=>{let y=f*Math.PI/2,w=h*Math.PI/2;return[a*Math.sin(y)*Math.cos(w),l*Math.cos(y),c*Math.sin(y)*Math.sin(w)]};yield{uSteps:o,vSteps:o,normal:u,position:(f,h)=>{let y=u(f,h);return[d[0]+r*y[0],d[1]+r*y[1],d[2]+r*y[2]]}}}}}function t_(e,t,r,n,o,s){let i=r.length/3,a=e.uSteps+1,l=e.vSteps+1;for(let c=0;c<l;c++)for(let d=0;d<a;d++){let u=e.uSteps===0?0:d/e.uSteps,f=e.vSteps===0?0:c/e.vSteps,h=e.position(u,f),y=e.normal(u,f);r.push(h[0],h[1],h[2]),n.push(y[0],y[1],y[2]);let[w,g]=e_(h,y,t);o.push(w,g)}for(let c=0;c<e.vSteps;c++)for(let d=0;d<e.uSteps;d++){let u=i+c*a+d,f=u+1,h=u+a,y=h+1;Dh(r,n,s,u,h,f),Dh(r,n,s,f,h,y)}}function Dh(e,t,r,n,o,s){let i=e[n*3],a=e[n*3+1],l=e[n*3+2],c=e[o*3],d=e[o*3+1],u=e[o*3+2],f=e[s*3],h=e[s*3+1],y=e[s*3+2],w=c-i,g=d-a,x=u-l,_=f-i,S=h-a,b=y-l,k=g*b-x*S,M=x*_-w*b,R=w*S-g*_;if(k*k+M*M+R*R<1e-20)return;k*t[n*3]+M*t[n*3+1]+R*t[n*3+2]>=0?r.push(n,o,s):r.push(n,s,o)}function e_(e,t,r){let n=Math.abs(t[0]),o=Math.abs(t[1]),s=Math.abs(t[2]),i=n>=o&&n>=s?0:o>=s?1:2,a=(i+1)%3,l=(i+2)%3;return[r[a]===0?.5:.5+e[a]/(2*r[a]),r[l]===0?.5:.5+e[l]/(2*r[l])]}function r_(e,t){let r=[0,0,0];return r[e]=t,r}function ql(e,t,r){return e+(t-e)*r}function Rh(e){return e===void 0||e===!0?!0:e===!1?!1:e==="cast"||typeof e=="object"}function n_(e){return e===void 0||e===!0?!0:e===!1?!1:e==="receive"||typeof e=="object"}function o_(e){return Rh(e)?typeof e=="object"?e:{}:null}function Gl(e){return e===void 0?[1,1]:typeof e=="number"?[e,e]:[e[0]??1,e[1]??e[0]??1]}function s_(e){if(e===void 0)return null;let t=typeof e=="number"?{size:e}:e,r=t.size??.1;return{size:r,thickness:t.thickness??r*2,offset:t.offset??0,segments:t.segments??3}}function i_(e){let t=e.segments,[r,n]=typeof t=="number"?[t,t]:[t[0]??1,t[1]??t[0]??1],o=Math.max(1,Math.floor(r))+1,s=Math.max(1,Math.floor(n))+1,i=new Float32Array(o*s*3),a=new Float32Array(o*s*2),l=e.color?new Float32Array(o*s*3):void 0,c={x:0,y:0,z:0};for(let f=0;f<s;f++){let h=f/(s-1);for(let y=0;y<o;y++){let w=y/(o-1),g=f*o+y,x=e.vertex(w,h);if(Array.isArray(x))c.x=x[0],c.y=x[1],c.z=x[2];else{let _=x;c.x=_.x,c.y=_.y,c.z=_.z}if(i[g*3]=c.x,i[g*3+1]=c.y,i[g*3+2]=c.z,a[g*2]=w,a[g*2+1]=h,l&&e.color){let _=a_(e.color(w,h,c));l[g*3]=_[0],l[g*3+1]=_[1],l[g*3+2]=_[2]}}}let d=new Uint32Array((o-1)*(s-1)*6),u=0;for(let f=0;f<s-1;f++)for(let h=0;h<o-1;h++){let y=f*o+h,w=y+1,g=y+o,x=g+1;d[u++]=y,d[u++]=g,d[u++]=w,d[u++]=w,d[u++]=g,d[u++]=x}return{type:"buffer",position:i,uv:a,color:l,index:d,computeNormals:e.computeNormals,params:e.params}}function a_(e){let[t,r,n]=typeof e=="string"?Y(e):e;return[Wl(t),Wl(r),Wl(n)]}function Wl(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function wi(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Ae(e,t){let r=new Array(16);for(let n=0;n<4;n++){let o=t[n*4],s=t[n*4+1],i=t[n*4+2],a=t[n*4+3];r[n*4]=e[0]*o+e[4]*s+e[8]*i+e[12]*a,r[n*4+1]=e[1]*o+e[5]*s+e[9]*i+e[13]*a,r[n*4+2]=e[2]*o+e[6]*s+e[10]*i+e[14]*a,r[n*4+3]=e[3]*o+e[7]*s+e[11]*i+e[15]*a}return r}function vi(e){let[t,r,n,o,s,i,a,l,c,d,u,f,h,y,w,g]=e,x=d*w*l-y*u*l+y*a*f-i*w*f-d*a*g+i*u*g,_=h*u*l-c*w*l-h*a*f+s*w*f+c*a*g-s*u*g,S=c*y*l-h*d*l+h*i*f-s*y*f-c*i*g+s*d*g,b=h*d*a-c*y*a-h*i*u+s*y*u+c*i*w-s*d*w,k=t*x+r*_+n*S+o*b;if(k===0)return null;let M=1/k;return[x*M,(y*u*o-d*w*o-y*n*f+r*w*f+d*n*g-r*u*g)*M,(i*w*o-y*a*o+y*n*l-r*w*l-i*n*g+r*a*g)*M,(d*a*o-i*u*o-d*n*l+r*u*l+i*n*f-r*a*f)*M,_*M,(c*w*o-h*u*o+h*n*f-t*w*f-c*n*g+t*u*g)*M,(h*a*o-s*w*o-h*n*l+t*w*l+s*n*g-t*a*g)*M,(s*u*o-c*a*o+c*n*l-t*u*l-s*n*f+t*a*f)*M,S*M,(h*d*o-c*y*o-h*r*f+t*y*f+c*r*g-t*d*g)*M,(s*y*o-h*i*o+h*r*l-t*y*l-s*r*g+t*i*g)*M,(c*i*o-s*d*o-c*r*l+t*d*l+s*r*f-t*i*f)*M,b*M,(c*y*n-h*d*n+h*r*u-t*y*u-c*r*w+t*d*w)*M,(h*i*n-s*y*n-h*r*a+t*y*a+s*r*w-t*i*w)*M,(s*d*n-c*i*n+c*r*a-t*d*a-s*r*u+t*i*u)*M]}function Oe(e,t){let{x:r,y:n,z:o}=t;return{x:e[0]*r+e[4]*n+e[8]*o+e[12],y:e[1]*r+e[5]*n+e[9]*o+e[13],z:e[2]*r+e[6]*n+e[10]*o+e[14],w:e[3]*r+e[7]*n+e[11]*o+e[15]}}function Fh(e,t,r){let{x:n,y:o,z:s,w:i}=t,a=n+n,l=o+o,c=s+s,d=n*a,u=n*l,f=n*c,h=o*l,y=o*c,w=s*c,g=i*a,x=i*l,_=i*c;return[(1-(h+w))*r.x,(u+_)*r.x,(f-x)*r.x,0,(u-_)*r.y,(1-(d+w))*r.y,(y+g)*r.y,0,(f+x)*r.z,(y-g)*r.z,(1-(d+h))*r.z,0,e.x,e.y,e.z,1]}function ho(e,t,r=l_){let n=e.x-t.x,o=e.y-t.y,s=e.z-t.z,i=Math.hypot(n,o,s);i===0&&(s=1,i=1),n/=i,o/=i,s/=i;let a=r.y*s-r.z*o,l=r.z*n-r.x*s,c=r.x*o-r.y*n,d=Math.hypot(a,l,c);d===0&&(Math.abs(r.z)===1?n+=1e-4:s+=1e-4,i=Math.hypot(n,o,s),n/=i,o/=i,s/=i,a=r.y*s-r.z*o,l=r.z*n-r.x*s,c=r.x*o-r.y*n,d=Math.hypot(a,l,c)),a/=d,l/=d,c/=d;let u=o*c-s*l,f=s*a-n*c,h=n*l-o*a;return[a,l,c,0,u,f,h,0,n,o,s,0,0,0,0,1]}var l_={x:0,y:1,z:0};function mo(e,t){if(!e)return wi();let r=pt(e.position),n=pt(e.scale===void 0?1:e.scale);if(e.lookAt!==void 0){let s=pt(e.lookAt),i=t?Oe(t,r):{...r,w:1},a={x:i.x,y:i.y,z:i.z},l=ho(s,a);if(t){let c=vi(Ih(t));c&&(l=Ae(c,l))}return Ae(Ae(yo(r),l),d_(n))}let o=e.quaternion??Ba(c_(e.rotation));return Fh(r,o,n)}function c_(e){return{...pt(e),order:e?.order}}function yo(e){return[1,0,0,0,0,1,0,0,0,0,1,0,e.x,e.y,e.z,1]}function d_(e){return[e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1]}function Ih(e){let t=Math.hypot(e[0],e[1],e[2])||1,r=Math.hypot(e[4],e[5],e[6])||1,n=Math.hypot(e[8],e[9],e[10])||1;return[e[0]/t,e[1]/t,e[2]/t,0,e[4]/r,e[5]/r,e[6]/r,0,e[8]/n,e[9]/n,e[10]/n,0,0,0,0,1]}function Si(e,t,r,n,o){let s=r*Math.tan(e*Math.PI/360)/o,i=2*s,a=t*i,l=-.5*a;return u_(l,l+a,s,s-i,r,n)}function u_(e,t,r,n,o,s){let i=2*o/(t-e),a=2*o/(r-n),l=(t+e)/(t-e),c=(r+n)/(r-n),d=-(s+o)/(s-o),u=-2*s*o/(s-o);return[i,0,0,0,0,a,0,0,l,c,d,-1,0,0,u,0]}function Yl(e,t,r,n,o,s,i){let a=(t-e)/(2*i),l=(r-n)/(2*i),c=(t+e)/2,d=(r+n)/2,u=c-a,f=c+a,h=d+l,y=d-l,w=1/(f-u),g=1/(h-y),x=1/(s-o);return[2*w,0,0,0,0,2*g,0,0,0,0,-2*x,0,-(f+u)*w,-(h+y)*g,-(s+o)*x,1]}function $t(e,t,r){return{min:{x:-e,y:-t,z:-r},max:{x:e,y:t,z:r}}}function go(e,t){return e?t?{min:{x:Math.min(e.min.x,t.min.x),y:Math.min(e.min.y,t.min.y),z:Math.min(e.min.z,t.min.z)},max:{x:Math.max(e.max.x,t.max.x),y:Math.max(e.max.y,t.max.y),z:Math.max(e.max.z,t.max.z)}}:e:t}function bi(e){let{min:t,max:r}=e;return[{x:t.x,y:t.y,z:t.z},{x:r.x,y:t.y,z:t.z},{x:t.x,y:r.y,z:t.z},{x:r.x,y:r.y,z:t.z},{x:t.x,y:t.y,z:r.z},{x:r.x,y:t.y,z:r.z},{x:t.x,y:r.y,z:r.z},{x:r.x,y:r.y,z:r.z}]}function xn(e,t){let r=1/0,n=1/0,o=1/0,s=-1/0,i=-1/0,a=-1/0;for(let l of bi(e)){let c=Oe(t,l);c.x<r&&(r=c.x),c.y<n&&(n=c.y),c.z<o&&(o=c.z),c.x>s&&(s=c.x),c.y>i&&(i=c.y),c.z>a&&(a=c.z)}return{min:{x:r,y:n,z:o},max:{x:s,y:i,z:a}}}function ki(e){if(!e)return null;switch(e.type){case"box":return $t((e.width??1)/2,(e.height??1)/2,(e.depth??1)/2);case"sphere":return $t(e.radius??1,e.radius??1,e.radius??1);case"plane":return $t((e.width??1)/2,(e.height??1)/2,0);case"cylinder":{let[t,r]=Gl(e.radius),n=Math.max(t,r);return $t(n,(e.height??1)/2,n)}case"cone":{let t=e.radius??1;return $t(t,(e.height??1)/2,t)}case"torus":{let t=e.radius??1,r=e.thickness??.4;return $t(t+r,t+r,r)}case"torusKnot":{let t=e.radius??1,r=e.thickness??.4;return $t(t*1.5+r,t*1.5+r,t*.5+r)}case"circle":return $t(e.radius??1,e.radius??1,0);case"ring":{let t=e.radius??1;return $t(t,t,0)}case"capsule":{let t=e.radius??1;return $t(t,(e.height??1)/2+t,t)}case"polyhedron":{let t=e.radius??1;return $t(t,t,t)}case"lathe":{let t=0,r=1/0,n=-1/0;for(let o of e.points){let s=pt(o);t=Math.max(t,Math.abs(s.x)),r=Math.min(r,s.y),n=Math.max(n,s.y)}return Number.isFinite(r)?{min:{x:-t,y:r,z:-t},max:{x:t,y:n,z:t}}:null}case"tube":{let t=e.points.map(n=>pt(n)),r=f_(t);return r?h_(r,e.radius??1):null}case"buffer":return p_(e.position);case"edges":case"wireframe":return ki(e.source);default:return null}}function f_(e){if(e.length===0)return null;let t=1/0,r=1/0,n=1/0,o=-1/0,s=-1/0,i=-1/0;for(let a of e)a.x<t&&(t=a.x),a.y<r&&(r=a.y),a.z<n&&(n=a.z),a.x>o&&(o=a.x),a.y>s&&(s=a.y),a.z>i&&(i=a.z);return{min:{x:t,y:r,z:n},max:{x:o,y:s,z:i}}}function p_(e){if(e.length<3)return null;let t=1/0,r=1/0,n=1/0,o=-1/0,s=-1/0,i=-1/0;for(let a=0;a+2<e.length;a+=3){let l=e[a],c=e[a+1],d=e[a+2];l<t&&(t=l),c<r&&(r=c),d<n&&(n=d),l>o&&(o=l),c>s&&(s=c),d>i&&(i=d)}return{min:{x:t,y:r,z:n},max:{x:o,y:s,z:i}}}function h_(e,t){return{min:{x:e.min.x-t,y:e.min.y-t,z:e.min.z-t},max:{x:e.max.x+t,y:e.max.y+t,z:e.max.z+t}}}var m_=["color","opacity","visible","emission","emissionStrength","roughness","metalness","shininess","specular","reflectivity","clearcoat","clearcoatRoughness","transmission","thickness","ior","sheen","sheenColor","sheenRoughness","iridescence","iridescenceIOR","specularIntensity","specularColor","anisotropy","anisotropyRotation","attenuationColor","attenuationDistance","aoMapIntensity","lightMapIntensity","envMapIntensity","normalScale","displacementScale","displacementBias","size","width","dashSize","gapSize","scale","rotation","depthWrite","depthTest","polygonOffsetFactor","polygonOffsetUnits"],y_=["transparent","alphaTest","faces","wireframe","blend","vertexColors","toneMapped","shading","dithering","polygonOffset","raw","extends","defines"];function zh(e){return e.orbit!==void 0||e.elevation!==void 0||e.distance!==void 0}function Vl(e){let t=pt(e.target??0);if(!zh(e)){let i=e.lookAt??e.target;return{position:pt(e.position??0),lookAt:i===void 0?void 0:pt(i)}}let r=e.distance??10,n=(e.orbit??0)*Math.PI/180,o=g_(e.elevation??0,-89.9,89.9)*Math.PI/180,s=Math.cos(o)*r;return{position:{x:t.x+Math.sin(n)*s,y:t.y+Math.sin(o)*r,z:t.z+Math.cos(n)*s},lookAt:t}}function g_(e,t,r){return e<t?t:e>r?r:e}var Mi=class{precomp;storageAdapter;audioDevice;lastAudioRequestKey="";lastAudioSrcs=new Set;audioFetching=new Map;loaderDisposers=new Map;loaderInFlight=new Map;constructor(t,r,n){this.precomp=t,this.storageAdapter=r,this.audioDevice=n}setPrecomp(t){this.precomp=t,this.lastAudioRequestKey=null,this.lastAudioSrcs=null}async loadAt(t){let r=[];for(let[n,o]of this.precomp.assets){if(o.record.type==="loader"){let s=this.syncLoader(n,o,t);s&&r.push(s);continue}o.cacheAt<=t&&o.record.endFrame>=t&&r.push(this.storageAdapter.loadAsset(n,o.record))}await Promise.all(r),this.audioDevice.schedulesAudio&&this.syncAudio(t)}isReady(t){return this.loaderDisposers.has(t)||this.storageAdapter.isLoaded(t)}async loadRecords(t){await Promise.all(t.map(r=>r.type==="loader"?this.runLoader(r.src,r.load):this.storageAdapter.loadAsset(r.src,r)))}prefetch(t){for(let[r,n]of this.precomp.assets){if(n.record.type==="loader"){this.syncLoader(r,n,t)?.catch(o=>{console.error(`[AssetManager] loader failed for ${r}:`,o)});continue}n.cacheAt<=t&&n.record.endFrame>=t&&this.storageAdapter.loadAsset(r,n.record).catch(o=>{console.error(`[AssetManager] prefetch failed for ${r}:`,o)})}}syncLoader(t,r,n){if(r.record.type!=="loader")return;let o=r.discardAt??1/0;if(!(r.cacheAt<=n&&n<=o)){let i=this.loaderDisposers.get(t);i&&(this.loaderDisposers.delete(t),i());return}return this.runLoader(t,r.record.load)}runLoader(t,r){if(this.loaderDisposers.has(t))return;let n=this.loaderInFlight.get(t);if(n)return n;let o=r().then(s=>{this.loaderDisposers.set(t,s??x_)}).finally(()=>{this.loaderInFlight.delete(t)});return this.loaderInFlight.set(t,o),o}dispose(){for(let t of this.loaderDisposers.values())t();this.loaderDisposers.clear(),this.loaderInFlight.clear()}syncAudio(t){let r=t/this.precomp.fps,n=[],o=new Set,s=new Set,i=(l,c)=>{let d=c+l.startAt,u=c+l.endAt;if(u<r||d>r+10)return;let f=__(l,c);s.has(f)||(s.add(f),n.push({...l,id:f,startAt:d,endAt:u,...l.bus&&{bus:l.bus.map(h=>({...h,startAt:c+h.startAt,endAt:c+h.endAt}))}}),o.add(l.src))};for(let l of this.precomp.tracks){let c=l.startFrame/this.precomp.fps;for(let d of l.audioRequests)i(d,c)}for(let l of o)if(!this.audioDevice.has(l)&&!this.audioFetching.has(l)){let c=this.storageAdapter.fetchAudioData(l).then(d=>this.audioDevice.append(l,d)).finally(()=>this.audioFetching.delete(l));this.audioFetching.set(l,c)}let a=v_(n);a!==this.lastAudioRequestKey&&(this.audioDevice.schedule(n),this.lastAudioRequestKey=a),(this.lastAudioSrcs===null||!S_(this.lastAudioSrcs,o))&&(this.audioDevice.retain(o),this.lastAudioSrcs=o)}},x_=()=>{};function __(e,t){return`${e.src}|${t+e.startAt}|${t+e.endAt}|${e.trimStart}|${e.loop?1:0}|${e.volume}|${qn(e.filters)}|${w_(e.bus)}`}function w_(e){return!e||e.length===0?"":e.map(Oa).join(">")}function v_(e){return e.length===0?"":e.map(t=>t.id).sort().join(`
14
- `)}function S_(e,t){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}function Nh(e){switch(e.type){case"image":case"video":return e.src;case"font":return e.family;case"loader":return e.key}}function b_(e){return typeof e=="number"?Number.isFinite(e)?e:400:typeof e=="string"&&parseInt(e,10)||400}var Ai=class{catalog;constructor(t,r={}){this.catalog=t,this._options=r}get declarations(){return this._decls}image(t){!t||this._decls.has(t)||(this.catalog.getImageMeta(t),this._decls.set(t,{type:"image",src:t}))}video(t,r){!t||this._decls.has(t)||(this.catalog.getVideoMeta(t),this._decls.set(t,{type:"video",src:t,trimStart:r?.start??0,trimEnd:r?.end??this.catalog.getVideoDuration(t)}))}font(t,r){!t||this._decls.has(t)||this._decls.set(t,{type:"font",family:t,weight:b_(r)})}loader(t,r,n){let o=n?.gate??"render",s=this._decls.get(t);if(s===void 0){this._decls.set(t,{type:"loader",key:t,load:r,gate:o});return}s.type==="loader"&&(s.load,o==="layout"&&s.gate!=="layout"&&this._decls.set(t,{...s,gate:o}))}fill(t){if(t){if(!Array.isArray(t)){xa(t,this);return}for(let r of t)xa(r,this)}}effects(t){if(t)for(let r of t)zo(r,this)}subtree(t){this._subtrees??=new Set,!this._subtrees.has(t)&&(this._subtrees.add(t),this._options.bindSubtree?.(t),this._options.onSubtree?this._options.onSubtree(t,this):tl(t,this))}_options;_decls=new Map;_subtrees};function Be(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function k_(){let e=globalThis.scheduler;return typeof e?.yield=="function"?e.yield.bind(e):void 0}var je=null,Kl=[];function M_(){return typeof MessageChannel!="function"?null:(je||(je=new MessageChannel,je.port1.onmessage=()=>Kl.shift()?.(),je.port1.unref?.(),je.port2.unref?.()),new Promise(e=>{Kl.push(e),je.port2.postMessage(null)}))}function Oi(){let e=k_();return e?e():M_()??new Promise(t=>setTimeout(t,0))}function u2(){je?.port1.close(),je?.port2.close(),je=null,Kl.length=0}function _n(e,t){return typeof e!="number"||!Number.isFinite(e)?1:Math.max(1,Math.ceil(e*t))}function xo(e,t){return e.map((r,n)=>{let o=Math.max(0,Math.round((r.startAt??0)*t));return{id:r.id,index:n,startFrame:o,endFrame:o+_n(r.duration,t)-1}})}function $h(e){let t=0;for(let r of e)t=Math.max(t,r.endFrame+1);return t}function mr(e,t){return e.filter(r=>t>=r.startFrame&&t<=r.endFrame)}function Ee(e,t,r){return Math.min(e*(1/t),r)}function wn(e,t,r){let n=r-1,o=a=>Ee(a,t,1/0),s=Math.min(n+1,Math.max(0,Math.ceil(e.start*t)));for(;s>0&&o(s-1)>=e.start;)s--;for(;s<=n&&o(s)<e.start;)s++;let i=n;if(e.end!==1/0){for(i=Math.max(-1,Math.min(n,Math.ceil(e.end*t)));i>=0&&o(i)>=e.end;)i--;for(;i<n&&o(i+1)<e.end;)i++}return s<=i?{startFrame:s,endFrame:i}:null}var Ei=class{_scope;canvas;constructor(t,r,n){this._scope=n,this._clip=t,this._duration=r,this._doc=jh(t);let{width:o,height:s}=n.viewport;this.canvas=new H({id:E,width:o,height:s,flow:"freeform"}),this._timeline=new gi(this._doc,n.registry,this.canvas),this._indexRows()}get duration(){return this._duration}get clip(){return this._clip}build(t=this._scope.measurer){this.attach(0),this._timeline.build(),this.sample(),this.layout(t),this._timeline.compile(()=>{this.sample(),this.layout(t)}),this.layout(t)}update(t,r){if(t===this._clip)return this._duration=r,!0;let n=this.planUpdate(t);return n?(this.applyUpdate(n,t,r),!0):!1}planUpdate(t){return this._timeline.planUpdate(jh(t))}applyUpdate(t,r,n,o=this._scope.measurer){this.attach(0);let s=()=>{this.sample(),this.layout(o)};this._timeline.applyUpdate(t,s,s),this.layout(o),this._clip=r,this._doc=t.next.doc,this._duration=n,this._indexRows()}placedCommands(){return this._timeline.placedCommands()}evaluateAt(t,r){this._timeline.syncPresence(t),this._timeline.evaluateAt(t,r)}attach(t,r){this.canvas.attach({assets:this._scope.assets,context:br.EMPTY,time:t}),el(this.canvas,r)}layout(t=this._scope.measurer){let{width:r,height:n}=this._scope.viewport;this.canvas.layout({x:0,y:0,width:r,height:n},t)}render(t){this.canvas.render(t)}sample(){Is(this.canvas)}primeMotion(t){zs(this.canvas,t)}node(t){return this._timeline.liveNode(t)}rowSpans(){return[...this._rows.values()].map(t=>t.span)}rowSpan(t){return this._rows.get(t)?.span}ownerKeyOf(t){let r="";for(let n=t;;){if(n===this.canvas||this._timeline.liveNode(n.id)===n){let i=n===this.canvas?E:n.id;return r===""?i:`${i}/${r}`}let o=n.parent;if(!o)return;let s=o._allChildren.indexOf(n);r=r===""?String(s):`${s}.${r}`,n=o}}spanOf(t){for(let r=t;r;r=r.parent){if(r===this.canvas)return{start:0,end:this.duration};let n=this._rowSpan(r);if(n)return{...n}}}forEachOwner(t){let r=(n,o,s,i,a)=>{if(!n.mounted)return;let l=n===this.canvas?void 0:this._rowSpan(n);l&&(o=n.id,s="",i=l),t(n,s===""?o:`${o}/${s}`,i,a);let c=n._allChildren;for(let d=0;d<c.length;d++)r(c[d],o,s===""?String(d):`${s}.${d}`,i,Re(a,d))};r(this.canvas,E,"",{start:0,end:this.duration},"")}dispose(){for(let t of this.canvas.children)t.dispose();this.canvas.dispose()}_clip;_doc;_duration;_timeline;_rows=new Map;_indexRows(){this._rows.clear();let t=Op(this._doc.nodes);for(let r of this._doc.nodes)r.id!==E&&this._rows.set(r.id,{parentId:r.parentId,span:t.get(r.id)})}_rowSpan(t){let r=this._rows.get(t.id);if(!r)return;let n=t.parent;return(r.parentId===null||r.parentId===E?n===this.canvas:n!==null&&n.id===r.parentId)?r.span:void 0}};function jh(e){return pr(e)?yn(e):e}var A_=new Set,_o=class{constructor(t){this._frameCount=Math.max(0,t)}setOwner(t,r){let n=new Set,o=this._owners.get(t);o&&this._unlink(t,o,n);let s={declared:new Map,learned:new Map};for(let i of r)i.endFrame>=i.startFrame&&O_(s.declared,{...i});return s.declared.size>0?(this._owners.set(t,s),this._link(t,s,n)):this._owners.delete(t),this._refresh(n)}removeOwner(t){let r=this._owners.get(t);if(!r)return{keys:new Set};let n=new Set;return this._unlink(t,r,n),this._owners.delete(t),this._refresh(n)}learn(t,r,n){let o=Nh(r),s=this._owners.get(t);s||(s={declared:new Map,learned:new Map},this._owners.set(t,s));let i=s.learned.get(o)??[],a=i.findIndex(c=>n>=c.startFrame-1&&n<=c.endFrame+1);if(a<0)i.push({key:o,decl:r,startFrame:n,endFrame:n});else{let c=i[a];i[a]={...c,startFrame:Math.min(c.startFrame,n),endFrame:Math.max(c.endFrame,n)}}s.learned.set(o,i);let l=this._byKey.get(o);return l||this._byKey.set(o,l=new Set),l.add(t),this._refresh(new Set([o]))}setFrameCount(t){let r=Math.max(0,t);return r===this._frameCount?{keys:new Set}:(this._frameCount=r,this._refresh(new Set(this._byKey.keys())))}owners(t){return this._byKey.get(t)??A_}segmentsOf(t){let r=this._owners.get(t);if(!r)return[];let n=[];for(let o of r.declared.values())n.push(...o);for(let o of r.learned.values())n.push(...o);return n}declaredSegmentsOf(t){let r=this._owners.get(t);if(!r)return[];let n=[];for(let o of r.declared.values())n.push(...o);return n}ownerKeys(){return this._owners.keys()}records(){return this._records}layoutGates(){if(this._layoutGates===null){let t=[];for(let r of this._entries.values())r.layout&&t.push(r.record);this._layoutGates=t}return this._layoutGates}_frameCount;_owners=new Map;_byKey=new Map;_entries=new Map;_records=new Map;_layoutGates=null;_link(t,r,n){for(let o of r.declared.keys()){let s=this._byKey.get(o);s||this._byKey.set(o,s=new Set),s.add(t),n.add(o)}}_unlink(t,r,n){for(let o of[r.declared,r.learned])for(let s of o.keys()){let i=this._byKey.get(s);i&&(i.delete(t),i.size===0&&this._byKey.delete(s)),n.add(s)}}_refresh(t){let r=new Set;for(let n of t){let o=this._entries.get(n),s=this._compute(n);if(s===void 0){if(o===void 0)continue;this._entries.delete(n),this._records.delete(n)}else{if(o!==void 0&&o.layout===s.layout&&C_(o.record,s.record))continue;this._entries.set(n,s),this._records.set(n,s.record)}r.add(n)}return r.size>0&&(this._layoutGates=null),{keys:r}}_compute(t){let r=this._byKey.get(t);if(!r)return;let n=this._frameCount-1,o,s=1/0,i=-1/0,a=!1,l=c=>{if(c)for(let d of c){let u=Math.max(0,d.startFrame),f=Math.min(n,d.endFrame);f<u||(u<s&&(s=u,o=d),f>i&&(i=f),d.decl.type==="loader"&&d.decl.gate==="layout"&&(a=!0))}};for(let c of r){let d=this._owners.get(c);d&&(l(d.declared.get(t)),l(d.learned.get(t)))}if(o!==void 0)return{record:E_(o.decl,s,i),layout:o.decl.type==="font"||a}}};function O_(e,t){let r=e.get(t.key);r?r.push(t):e.set(t.key,[t])}function E_(e,t,r){switch(e.type){case"image":return{type:"image",startFrame:t,endFrame:r,src:e.src};case"video":return{type:"video",startFrame:t,endFrame:r,src:e.src,trimStart:e.trimStart,trimEnd:e.trimEnd};case"font":return{type:"font",startFrame:t,endFrame:r,fontWeight:e.weight,fontFamily:e.family,src:e.family};case"loader":return{type:"loader",src:e.key,startFrame:t,endFrame:r,load:e.load}}}function C_(e,t){if(e.type!==t.type||e.src!==t.src||e.startFrame!==t.startFrame||e.endFrame!==t.endFrame)return!1;switch(e.type){case"video":{let r=t;return e.trimStart===r.trimStart&&e.trimEnd===r.trimEnd}case"font":return e.fontWeight===t.fontWeight;case"loader":return e.load===t.load;default:return!0}}function*Ul(e,t){let r=new Hl(e,t);for(;r.step();)yield;return r.result()}var Bh=3,Hl=class{_instance;_options;constructor(t,r){this._instance=t,this._options=r,this._last=r.frameCount-1;let{owners:n,below:o}=r,s=n!==void 0||o!==void 0;if(!(this._last<0||s&&(n?.size??0)+(o?.size??0)===0)){if(s){this._start=1/0;for(let i of[...n?.values()??[],...o?.values()??[]])this._start=Math.min(this._start,Math.max(0,i))}if(!(this._start>this._last)){this._walked=this._start-1,this._placed=t.placedCommands().map(i=>({id:i.spec.id,...this._activeFrames(i.start,i.duration),writes:new Set(i.writes)}));for(let i=0;i<this._placed.length;i++)for(let a of this._placed[i].writes)this._addWriter(a,i);this._enqueue(this._start);for(let i of this._structureSpans()){let a=wn(i,r.fps,r.frameCount);a&&(this._structureFrame(a.startFrame),this._structureFrame(a.endFrame+1))}for(let i of this._placed)[...i.writes].some(Ci)&&this._forEachDueFrame(i,this._start,a=>this._structureFrame(a))}}}step(){let t=z_(this._heap);return t===void 0?!1:(this._queued.delete(t),this._frame=t,this._dueTaken=!1,this._evaluate(t),this._declareDue(t),this._heap.length>0)}result(){let t=new Map,r=new Map;for(let n of this._owners.values()){let o=n.present?[...n.intervals,[n.arrivedAt,1/0]]:n.intervals;t.set(n.key,{ownerKey:n.key,nodeId:n.node.id,segments:n.error?[]:R_(n.history,o),deps:n.allDeps,...n.error&&{error:n.error}});for(let s of n.allDeps){let i=r.get(s);i||r.set(s,i=new Set),i.add(n.key)}}for(let n of this._options.owners?.keys()??[])t.has(n)||t.set(n,{ownerKey:n,nodeId:void 0,segments:[],deps:new Set});return{owners:t,readers:r}}_last;_start=0;_walked=-1;_placed=[];_writers=new Map;_heap=[];_queued=new Set;_due=new Map;_structureFrames=new Set;_owners=new Map;_readers=new Map;_pseudo=new Set;_rewound=new Set;_frame=-1;_dueTaken=!1;_dev=F_();_presenceObserver={read:()=>{},write:t=>{Ci(t)&&this._pseudo.add(t)}};_structureSpans(){let{owners:t,below:r}=this._options;if(t===void 0&&r===void 0)return this._instance.rowSpans();let n=new Set(r?.keys());for(let s of t?.keys()??[]){let i=s.indexOf("/");n.add(i<0?s:s.slice(0,i))}let o=[];for(let s of n){let i=this._instance.rowSpan(s);i&&o.push(i)}return o}_activeFrames(t,r){let{fps:n}=this._options,o=t+Math.max(0,r),s=Math.max(0,Math.ceil(t*n));for(;s>0&&Ee(s-1,n,1/0)>=t;)s--;for(;Ee(s,n,1/0)<t;)s++;let i=Math.max(-1,Math.floor(o*n));for(;Ee(i+1,n,1/0)<=o;)i++;for(;i>=0&&Ee(i,n,1/0)>o;)i--;return{from:s,to:i}}_evaluate(t){this._options.onPhase?.("evaluate");let r=Ee(t,this._options.fps,this._instance.duration);if(t>this._walked&&(t===this._start||this._structureFrames.has(t))&&this._instance.attach(r),this._pseudo.clear(),De(this._presenceObserver,()=>this._instance.evaluateAt(r,(n,o)=>{Ci(o)&&this._pseudo.add(o),this._commandWrote(n,o)})),!(t<=this._walked)){(t===this._start||this._pseudo.size>0)&&this._reconcile(t);for(let n of this._pseudo)for(let o of this._readers.get(n)??[])o.stale=!0,this._queueOwner(o,t);this._walked=t}}_reconcile(t){let r=new Set;this._instance.forEachOwner((n,o,s)=>{let i=this._limitOf(o);if(i===void 0)return;let a=this._owners.get(o);a||(a={key:o,node:n,span:s,from:i,present:!1,arrivedAt:-1,arrived:!1,intervals:[],history:[],deps:null,values:[],stale:!0,allDeps:new Set,scheduled:new Set,rounds:0},this._owners.set(o,a)),r.add(a),a.node!==n&&(a.node=n,a.stale=!0,a.present&&this._queueOwner(a,Math.max(t,a.from))),!a.present&&(a.present=!0,a.arrivedAt=Math.max(t,a.from),a.stale=!0,this._queueOwner(a,a.arrivedAt),a.arrived||(a.arrived=!0,this._options.onArrive?.(n,o,s,t)))});for(let n of this._owners.values())!n.present||r.has(n)||(t-1>=n.arrivedAt&&n.intervals.push([n.arrivedAt,t-1]),n.present=!1)}_limitOf(t){let{owners:r,below:n}=this._options;if(r===void 0&&n===void 0)return this._start;let o=r?.get(t);if(n)for(let s=t.indexOf("/");s>=0;s=t.indexOf("/",s+1)){let i=n.get(t.slice(0,s));i!==void 0&&(o===void 0||i<o)&&(o=i)}return o}_declareDue(t){this._dueTaken=!0;let r=this._due.get(t);if(this._due.delete(t),this._options.declare!==!1){for(let n of r??[])n.error||this._rewound.has(n)||!P_(n,t)||!n.stale&&T_(n)||this._declare(n,t);for(let n of this._rewound)this._queueOwner(n,t);this._rewound.clear()}}_declare(t,r){this._options.onPhase?.("declare");let n=t.node,o=new Set,s=[],i,a=!1,l=!1,c=this._options.bindSubtree??(h=>sp(n,h)),d=new Ai(this._options.catalog,{bindSubtree:h=>Ms(()=>c(h))});try{De({read:h=>{o.add(h),i=h,h._name===Ue&&(a=!0)},write:h=>{s.push(h)},clock:()=>{l=!0}},()=>Qa(n,d))}catch(h){let y=h instanceof Error?h:new Error(String(h));t.error={message:y.message,stack:y.stack,...i&&{prop:to(i)}};return}if(this._dev){let h=n.constructor.name;if(s.length>0){let y=[...new Set(s.map(to))].join(", ");wo(`${h}:write:${y}`,`[assets] ${h} wrote ${y} while declaring its assets. A declaration is re-run only when something it read changes, so a write there is a frame-order dependency.`)}a&&wo(`${h}:layout`,`[assets] ${h}.declareAssets read layoutBounds. Declarations run without layout; decode size follows the draw, so declare the asset without a size.`),l&&wo(`${h}:clock`,`[assets] ${h}.declareAssets read time. Declarations are re-run only when a prop they read changes, so anything following the clock is missed between those frames.`)}t.stale=!1,t.deps=[...o],t.values=t.deps.map(h=>h.get());for(let h of o){if(t.allDeps.has(h))continue;t.allDeps.add(h);let y=this._readers.get(h);y||this._readers.set(h,y=new Set),y.add(t)}let u=d.declarations,f=t.history[t.history.length-1];(!f||f.frame<t.arrivedAt||!D_(f.decls,u))&&t.history.push({frame:r,decls:u}),this._scheduleWriters(t,r+1)}_scheduleWriters(t,r){for(let n of t.deps??[]){let o=this._writers.get(n);if(o)for(let s of o)t.scheduled.has(s)||(t.scheduled.add(s),this._forEachDueFrame(this._placed[s],r,i=>this._queueOwner(t,i)))}}_forEachDueFrame(t,r,n){let o=Math.max(r,t.from),s=Math.min(this._last,t.to);for(let a=o;a<=s;a++)n(a);let i=Math.max(t.to+1,t.from);i>=r&&i<=this._last&&n(i)}_commandWrote(t,r){let n=this._placed[t];if(!(!n||n.writes.has(r))){n.writes.add(r),this._addWriter(r,t),this._dev&&wo(`command:${n.id}:${to(r)}`,`[assets] Command ${n.id} wrote ${to(r)} at frame ${this._frame}, which compile did not record it writing. Owners reading it are re-declared over the command's span.`);for(let o of this._readers.get(r)??[])this._requeue(o,Math.max(n.from,o.from),n.id)}}_requeue(t,r,n){if(!t.error){if(r>this._frame){this._scheduleWriters(t,r);return}if(r===this._frame){this._queueOwner(t,r);return}if(t.rounds>=Bh){this._dev&&wo(`requeue:${t.key}`,`[assets] ${t.key} was re-queued ${Bh} times (last by command ${n}); its asset windows may be incomplete.`);return}t.rounds++,t.history=t.history.filter(o=>o.frame<r),t.stale=!0,t.scheduled.clear(),this._queueOwner(t,r);for(let[o]of t.intervals)o>r&&this._queueOwner(t,o);if(t.present&&t.arrivedAt>r&&this._queueOwner(t,t.arrivedAt),t.deps?.some(Ci))for(let o of this._structureFrames)o>=r&&o<=this._walked&&this._queueOwner(t,o);this._rewound.add(t)}}_addWriter(t,r){let n=this._writers.get(t);n?n.push(r):this._writers.set(t,[r])}_structureFrame(t){t<=this._start||t>this._last||(this._structureFrames.add(t),this._enqueue(t))}_queueOwner(t,r){if(r>this._last)return;let n=this._due.get(r);n||this._due.set(r,n=new Set),n.add(t),this._enqueue(r)}_enqueue(t){this._queued.has(t)||t===this._frame&&!this._dueTaken||(this._queued.add(t),I_(this._heap,t))}};function Ci(e){return e._name===Te||e._name.startsWith(Xe)}function P_(e,t){if(e.present&&t>=e.arrivedAt)return!0;for(let[r,n]of e.intervals)if(t>=r&&t<=n)return!0;return!1}function T_(e){let t=e.deps;if(t===null)return!1;for(let r=0;r<t.length;r++)if(!Object.is(t[r].get(),e.values[r]))return!1;return!0}function D_(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let o=t.get(r);if(!o||!qh(n,o))return!1}return!0}function qh(e,t){switch(e.type){case"image":return t.type==="image"&&e.src===t.src;case"video":return t.type==="video"&&e.src===t.src&&e.trimStart===t.trimStart&&e.trimEnd===t.trimEnd;case"font":return t.type==="font"&&e.family===t.family;case"loader":return t.type==="loader"&&e.key===t.key&&e.load===t.load&&e.gate===t.gate}}function R_(e,t){let r=[];for(let[n,o]of t){let s=new Map;for(let i of e)if(!(i.frame<n||i.frame>o)){for(let[a,l]of s){let c=i.decls.get(a);c&&qh(l.decl,c)||(r.push({...l,endFrame:i.frame-1}),s.delete(a))}for(let[a,l]of i.decls)s.has(a)||s.set(a,{key:a,decl:l,startFrame:i.frame,endFrame:o})}for(let i of s.values())r.push({...i,endFrame:o})}return r}function F_(){return!1}var Lh=new Set;function wo(e,t){Lh.has(e)||(Lh.add(e),console.warn(t))}function I_(e,t){let r=e.length;for(e.push(t);r>0;){let n=r-1>>1;if(e[n]<=t)break;e[r]=e[n],r=n}e[r]=t}function z_(e){if(e.length===0)return;let t=e[0],r=e.pop();if(e.length===0)return t;let n=0;for(;;){let o=2*n+1;if(o>=e.length)break;let s=o+1,i=s<e.length&&e[s]<e[o]?s:o;if(e[i]>=r)break;e[n]=e[i],n=i}return e[n]=r,t}var Jl="",Di="",Ri="";function Ti(e,t){return e+Jl+t}function Wh(e){return Di+e}function Gh(e){if(!(e.startsWith(Di)||e.startsWith(Ri)))return e.slice(0,e.lastIndexOf(Jl))}function Zl(e){return e.startsWith(Di)||e.startsWith(Ri)?e.slice(1):e.slice(e.lastIndexOf(Jl)+1)}var Sn=class{_instance;constructor(t){this._instance=t}idOf(t){let r=t._host;if(r===null)return Di+t._name;let n=this._keys.get(r);return n===void 0&&(n=r instanceof ht?this._instance.ownerKeyOf(r)??null:null,this._keys.set(r,n)),n===null?Ri+t._name:Ti(n,t._name)}idsOf(t){let r=[];for(let n of t)r.push(this.idOf(n));return r}_keys=new Map};function Pi(e){let t=[];for(let r=e.indexOf("/");r>=0;r=e.indexOf("/",r+1))t.push(e.slice(0,r));return t}function vo(e,t,r){let n=e.get(t);n||e.set(t,n=new Set),n.add(r)}function So(e,t,r){let n=e.get(t);return!n||(n.delete(r),n.size>0)?!1:(e.delete(t),!0)}var vn=new Set,bo=class{set(t,r){this.remove(t);let n=new Set(r);this._deps.set(t,n);for(let o of Pi(t))vo(this._ownersBelow,o,t);for(let o of n)this._readers.has(o)||this._index(o),vo(this._readers,o,t)}remove(t){let r=this._deps.get(t);if(r){this._deps.delete(t);for(let n of Pi(t))So(this._ownersBelow,n,t);for(let n of r)So(this._readers,n,t)&&this._unindex(n)}}has(t){return this._deps.has(t)}depsOf(t){return this._deps.get(t)??vn}readersOf(t){return this._readers.get(t)??vn}ownersBelow(t){return this._ownersBelow.get(t)??vn}slotsHostedBy(t){return this._byHost.get(t)??vn}*slotsHostedBelow(t){for(let r of this._hostsBelow.get(t)??vn)yield*this.slotsHostedBy(r)}slotsNamed(t){return this._byName.get(t)??vn}_deps=new Map;_readers=new Map;_ownersBelow=new Map;_byHost=new Map;_hostsBelow=new Map;_byName=new Map;_index(t){vo(this._byName,Zl(t),t);let r=Gh(t);if(r!==void 0){vo(this._byHost,r,t);for(let n of Pi(r))vo(this._hostsBelow,n,r)}}_unindex(t){So(this._byName,Zl(t),t);let r=Gh(t);if(r!==void 0&&So(this._byHost,r,t))for(let n of Pi(r))So(this._hostsBelow,n,r)}};function Yh(e){let{patch:t,deps:r,fps:n}=e,{prev:o,next:s,diff:i}=t,a={owners:new Map,below:new Map,removed:new Set,arrivalOwners:new Set,arrivalBelow:new Set},l=(g,x,_)=>{let S=g.get(x);(S===void 0||_<S)&&g.set(x,_)},c=(g,x,_)=>{l(a.owners,g,x),_&&a.arrivalOwners.add(g)},d=(g,x,_)=>{for(let S of r.readersOf(g))c(S,x,_)},u=(g,x)=>{!e.buildsChildren(g)&&r.ownersBelow(g).size===0||(l(a.below,g,x),a.arrivalBelow.add(g))},f=(g,x)=>{let _=g.effSpan(x);return _?Xl(_.start,n):1/0},h=(g,x)=>{d(Wh(Xe+g),x,!0),d(Ti(g,Te),x,!0);for(let _ of[o,s]){let S=_.nodes.get(g);S&&d(Ti(S.parentId??E,Te),x,!0)}},y=(g,x,_)=>{for(let S of r.slotsHostedBy(g)){let b=Zl(S);(_===null||_.has(b)||b===Te)&&d(S,x,!0)}for(let S of r.slotsHostedBelow(g))d(S,x,!0)};for(let[g,x]of e.before){if(e.after.has(g))continue;let _=Xl(x.start,n);for(let S of x.writes)d(S,_,!1)}for(let[g,x]of e.after){if(e.before.has(g))continue;let _=Xl(x.start,n);for(let S of x.writes)d(S,_,!1)}for(let g of i.variables.changed)d(Wh(ks+g),0,!0);if(t.layoutChanged)for(let g of r.slotsNamed(Ue))d(g,0,!0);for(let g of i.nodes.reorderedParents)d(Ti(g,Te),0,!0);for(let g of i.nodes.removed){let x=f(o,g);a.removed.add(g),h(g,x),y(g,x,null)}for(let g of i.nodes.added){let x=f(s,g);x!==1/0&&(c(g,x,!0),u(g,x),h(g,x))}for(let g of s.nodes.keys()){if(g===E||!o.nodes.has(g))continue;let x=o.effSpan(g),_=s.effSpan(g);if(x?.start===_?.start&&x?.end===_?.end)continue;let S=Math.min(f(o,g),f(s,g));S!==1/0&&(c(g,S,!0),u(g,S),h(g,S))}let w=new Set([...t.reinstantiate,...i.nodes.added,...i.nodes.removed]);for(let g of t.reinstantiate){let x=N_(g,e,w);y(g,0,x),u(g,0);for(let _ of[g,...r.ownersBelow(g)])for(let S of r.depsOf(_))if(S.startsWith(Ri)){c(_,0,!0);break}i.nodes.moved.has(g)&&h(g,0)}if(i.rootChanged){let g=e.propsOf(E);y(E,0,g?Vh(o.nodes.get(E),s.nodes.get(E),g):null)}return a}function N_(e,t,r){let{prev:n,next:o,diff:s}=t.patch,i=n.nodes.get(e),a=o.nodes.get(e);if(!i||!a||!s.nodes.respec.has(e)||s.nodes.moved.has(e)||i.type!==a.type||i.key!==a.key)return null;for(let c of[n,o])if($_(c,e,r,t))return null;let l=t.propsOf(e);return l?Vh(i,a,l):null}function Vh(e,t,r){let n=new Set;for(let o of new Set([...Object.keys(e.props),...Object.keys(t.props)]))if(!Et(e.props[o],t.props[o])){if(!r.has(o))return null;n.add(o)}return n}function $_(e,t,r,n){let o=new Set([t]),s=e.nodes.get(t)?.parentId??null;for(;s!==null&&s!==E&&!o.has(s);){o.add(s);let i=e.nodes.get(s);if(!i)return!1;if(r.has(s)&&n.isContextProvider(i.type))return!0;s=i.parentId}return!1}function Xl(e,t){if(!(e>0))return 0;if(!Number.isFinite(e))return 1/0;let r=Math.max(0,Math.ceil(e*t));for(;r>0&&Ee(r-1,t,1/0)>=e;)r--;for(;Ee(r,t,1/0)<e;)r++;return r}var ko=class{setOwner(t,r){if(r.length===0)return this.removeOwner(t);let n=this._owners.get(t);return n&&Uh(n,r)?!1:(this._owners.set(t,r),!0)}removeOwner(t){return this._owners.delete(t)}requests(){let t=[];for(let r of this._owners.values())t.push(...r);return t}_owners=new Map};function Kh(e){return e.declareAudio!==ht.prototype.declareAudio}function Hh(e,t,r,n,o){let s=[];return e.declareAudio({catalog:r,span:{start:t.start,end:t.end},clip(i){let a={...i,at:i.at??t.start,until:i.until??t.end};s.push(Nu(a,r,n,s.length))},_spanOf(i){let a=o(i);if(!a)throw new Error(`${i.className} is not in the tree declaring "${n}"'s audio, so it has no span.`);return{start:a.start,end:a.end}}}),s}function Uh(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n of r)if(!Uh(e[n],t[n]))return!1;return!0}var Ao=8,yr=class{_scope;constructor(t,r,n={}){this._scope=r,this._options=n,this._refine=n.assets!==!1?"assets":n.audio!==!1?"audio":"none",this._project=t;for(let o of t.tracks)this._entries.set(o.id,this._fresh(o));this._spans=xo(t.tracks,r.fps)}get project(){return this._project}get tracks(){return this._project.tracks}get spans(){return this._spans}get version(){return this._version}get profile(){return this._options.profile}setProject(t){let r={deltas:new Map,rebuilt:[]};if(this._disposed||t===this._project)return r;let n=!Et(this._project.theme,t.theme);this._project=t;let o=this._entries;this._entries=new Map;for(let a of t.tracks){let l=o.get(a.id),c=l&&!n?this._reconcile(l,a,r):this._fresh(a);l&&c!==l&&r.rebuilt.push(a.id),this._entries.set(a.id,c)}let s=r.rebuilt.length>0||o.size!==this._entries.size;for(let[a,l]of o)this._entries.get(a)!==l&&(this._discard(l),s=!0);let i=xo(t.tracks,this._scope.fps);return(s||!W_(i,this._spans))&&this._version++,this._spans=i,r}ensureBuilt(t){let r=this._entries.get(t);return!r||r.running||this._disposed?null:(r.steps&&this._drain(r),!r.instance&&!r.failure&&(this._start(r,!0,this._refine!=="none"&&!r.discovered),this._drain(r)),r.instance)}discover(t){let r=this._entries.get(t);if(!(!r||r.running||this._disposed)){if(this._refine==="none"){this.ensureBuilt(t);return}r.discovered||(r.steps||this._start(r,!r.instance,!0),this._drain(r))}}async runAsync(t={}){let{budgetMs:r=Ao,isCancelled:n,onProgress:o}=t;if(this._refine!=="none")for(;;){if(this._disposed||n?.())return;let s=this._nextUndiscovered();if(!s)return;s.steps||this._start(s,!s.instance,!0);let i=Be()+r,a=this._step(s);for(;!a;){if(Be()>=i){if(s.profile?.suspend(),await Oi(),this._disposed||n?.())return;if(s.discarded||!s.steps)break;s.profile?.resume(),i=Be()+r}a=this._step(s)}!s.discarded&&s.discovered&&o?.()}}instanceOf(t){let r=this._entries.get(t);return r&&!r.steps?r.instance:null}generationOf(t){return this._entries.get(t)?.generation??-1}failed(t){return!!this._entries.get(t)?.failure}isDiscovered(t){return!!this._entries.get(t)?.discovered}trackAssets(t){return this._entries.get(t)?.discovered??void 0}errorsOf(t){let r=this._entries.get(t);return r?.discovered?r.errors:[]}ownersOf(t,r){return this._entries.get(t)?.index.owners(r)??new Set}layoutGates(t){let r=this._entries.get(t);return r?.discovered?r.index.layoutGates():[]}learn(t,r,n,o){let s=this._entries.get(t);return!s?.discovered||s.index.learn(r,n,o).keys.size===0?!1:this._refresh(s)}settleGates(t){let r=this._options.isReady;if(!r)return!1;let n=!1;for(let o of t){let s=this._entries.get(o);if(!s||s.unready.size===0||!s.instance||s.steps||s.running)continue;let i=s.discovered?new Set(s.index.layoutGates().map(l=>l.src)):null,a=!1;for(let l of[...s.unready])i&&!i.has(l)?s.unready.delete(l):r(l)&&(a=!0);a&&(this._rebuildInstance(s),n=!0)}return n}rebuild(t){let r=this._entries.get(t);!r||r.running||r.steps||(r.instance?.dispose(),r.instance=null,r.unready.clear(),r.generation++,r.failure&&(r.failure=null,r.discovered=null,this._version++))}release(t){let r=this._entries.get(t);!r||!r.instance||r.running||r.steps||!r.discovered||(r.instance.dispose(),r.instance=null,r.generation++)}trim(t,r){for(let n=0;n<this._spans.length;n++){let o=this._spans[n];o.endFrame>=t-r&&o.startFrame<=t+r||this.release(o.id)}}dispose(){this._disposed=!0;for(let t of this._entries.values())this._discard(t)}_options;_refine;_project;_entries=new Map;_spans;_version=0;_disposed=!1;_fresh(t){let r=_n(t.duration,this._scope.fps);return{track:t,frameCount:r,instance:null,steps:null,running:!1,discarded:!1,profile:void 0,discovered:null,errors:[],index:new _o(r),audio:new ko,deps:new bo,assetDeps:new Map,audioDeps:new Map,ownerErrors:new Map,audioErrors:new Map,failure:null,refineError:null,generation:0,writes:new WeakMap,unready:new Set}}_reconcile(t,r,n){let o=_n(r.duration,this._scope.fps);if(t.track.clip===r.clip)return this._resize(t,r,o);if(t.steps||t.failure)return this._fresh(r);if(!t.instance)return t.discovered&&hi(t.track.clip,r.clip).identical?this._resize(t,r,o):this._fresh(r);let s=t.instance,i;try{i=s.planUpdate(r.clip)}catch{i=null}if(!i)return this._fresh(r);if(i.diff.identical)return this._resize(t,r,o);let a=t.discovered!==null&&this._refine!=="none",l=a?this._placedWrites(t):void 0;try{this._compile(t,u=>s.applyUpdate(i,r.clip,r.duration,u))}catch{return this._fresh(r)}if(t.generation++,t.track=r,!a)return t.frameCount=o,t;if(o>t.frameCount)return this._undiscover(t,o),t;let c=Yh({patch:i,deps:t.deps,before:l,after:this._placedWrites(t),fps:this._scope.fps,propsOf:u=>{let f=s.node(u);return f?new Set(f.__cells?.slots.keys()??[]):void 0},buildsChildren:u=>{let f=s.node(u);return!!f&&f._allChildren.some(h=>s.node(h.id)!==h)},isContextProvider:u=>pi(this._scope.registry,u)}),d=this._applyDirty(t,c,o);if(o!==t.frameCount){t.frameCount=o;for(let u of t.index.setFrameCount(o).keys)d.add(u)}return this._refresh(t)&&n.deltas.set(r.id,d),t}_resize(t,r,n){let o=t.track.duration;return t.track=r,r.duration===o?t:t.steps?this._fresh(r):(t.instance?.update(t.instance.clip,r.duration),this._refine==="none"||!t.discovered?t.frameCount=n:n>t.frameCount?this._undiscover(t,n):n!==t.frameCount&&(t.frameCount=n,t.index.setFrameCount(n),this._refresh(t)),t)}_undiscover(t,r){t.frameCount=r,t.discovered=null,this._version++}_discard(t){t.discarded=!0,!t.running&&(t.steps?.return(void 0),t.steps=null,t.instance?.dispose(),t.instance=null)}_nextUndiscovered(){let t,r=1/0;for(let n of this._spans){let o=this._entries.get(n.id);!o||o.discovered||o.running||(!t||n.startFrame<r)&&(t=o,r=n.startFrame)}return t}_start(t,r,n){let o=this._project.tracks.findIndex(s=>s.id===t.track.id);t.profile=n?this._options.profile?.track(o,t.track.id):void 0,t.steps=this._steps(t,r,n)}_drain(t){for(;t.steps&&!this._step(t););}_step(t){let r=t.steps;if(!r)return!0;t.running=!0;let n;try{n=r.next()}finally{t.running=!1}return t.generation++,t.discarded||this._disposed?(n.done||r.return(void 0),t.steps=null,t.instance?.dispose(),t.instance=null,!0):n.done?(t.steps=null,!0):!1}*_steps(t,r,n){let o=t.profile,{fps:s,assets:i}=this._scope;if(r){o?.enter("build"),t.unready.clear();try{let u=new Ei(t.track.clip,t.track.duration,this._scope);t.instance=u,this._compile(t,f=>u.build(f))}catch(u){t.instance?.dispose(),t.instance=null,t.failure=Ql(t.track.id,u),n&&(this._resetAssets(t),this._refresh(t,!0),o?.done(t.frameCount));return}if(!n)return;yield}let a=t.instance,l=t.frameCount;this._resetAssets(t);let c=new Map;try{let u=yield*Ul(a,{fps:s,frameCount:l,catalog:i,declare:this._refine==="assets",onPhase:f=>o?.enter(f),onArrive:(f,h,y)=>{o?.enter("audio"),this._declareAudio(t,f,h,y,c)}});this._commit(t,u,c)}catch(u){t.refineError=Ql(t.track.id,u)}let d=this._options.isReady;if(d)for(let u of t.index.layoutGates())u.type==="loader"&&!d(u.src)&&t.unready.add(u.src);this._refresh(t,!0),o?.done(l),this._options.keepInstances===!1&&(a.dispose(),t.instance=null)}_resetAssets(t){t.index=new _o(t.frameCount),t.audio=new ko,t.deps=new bo,t.assetDeps.clear(),t.audioDeps.clear(),t.ownerErrors.clear(),t.audioErrors.clear(),t.refineError=null}_commit(t,r,n){let o=new Sn(t.instance);for(let s of r.owners.values()){let i=s.ownerKey;s.error?t.ownerErrors.set(i,this._ownerError(t,s)):t.index.setOwner(i,s.segments),t.assetDeps.set(i,o.idsOf(s.deps))}for(let[s,i]of n)t.audioDeps.set(s,o.idsOf(i));for(let s of new Set([...t.assetDeps.keys(),...t.audioDeps.keys()]))this._link(t,s)}_applyDirty(t,r,n){let o=new Set,s=_=>{for(let S of _.keys)o.add(S)};for(let _ of r.removed)for(let S of[_,...t.deps.ownersBelow(_)])this._drop(t,S,s);if(r.owners.size===0&&r.below.size===0)return o;let i=t.instance,{fps:a,assets:l}=this._scope,c=new Set,d=new Map,u=Ul(i,{fps:a,frameCount:n,catalog:l,owners:r.owners,below:r.below,declare:this._refine==="assets",onArrive:(_,S,b,k)=>{c.add(S),k===wn(b,a,n)?.startFrame&&this._declareAudio(t,_,S,b,d)}}),f=u.next();for(;!f.done;)f=u.next();t.generation++;let h=f.value,y=_=>{let S=r.owners.get(_);for(let b=_.indexOf("/");b>=0;b=_.indexOf("/",b+1)){let k=r.below.get(_.slice(0,b));k!==void 0&&(S===void 0||k<S)&&(S=k)}return S??0},w=_=>{if(r.arrivalOwners.has(_))return!0;for(let S=_.indexOf("/");S>=0;S=_.indexOf("/",S+1))if(r.arrivalBelow.has(_.slice(0,S)))return!0;return!1},g=new Set(h.owners.keys());for(let _ of r.below.keys())for(let S of t.deps.ownersBelow(_))g.add(S);let x=new Sn(i);for(let _ of g){let S=y(_),b=h.owners.get(_);if(!b&&S===0){this._drop(t,_,s);continue}let k=S>0?j_(t.index.declaredSegmentsOf(_),S):[];if(b?.error?t.ownerErrors.set(_,this._ownerError(t,b)):t.ownerErrors.delete(_),s(t.index.setOwner(_,b&&!b.error?[...k,...b.segments]:k)),b){let M=x.idsOf(b.deps);t.assetDeps.set(_,S>0?[...new Set([...t.assetDeps.get(_)??[],...M])]:M)}w(_)&&!c.has(_)&&(t.audio.removeOwner(_),t.audioDeps.delete(_),t.audioErrors.delete(_)),this._link(t,_)}for(let[_,S]of d)t.audioDeps.set(_,x.idsOf(S)),this._link(t,_);return o}_drop(t,r,n){n(t.index.removeOwner(r)),t.audio.removeOwner(r),t.assetDeps.delete(r),t.audioDeps.delete(r),t.ownerErrors.delete(r),t.audioErrors.delete(r),t.deps.remove(r)}_link(t,r){let n=t.assetDeps.get(r),o=t.audioDeps.get(r);n===void 0&&o===void 0?t.deps.remove(r):t.deps.set(r,[...n??[],...o??[]])}_declareAudio(t,r,n,o,s){let i=[];if(s.set(n,i),!Kh(r)){t.audio.removeOwner(n),t.audioErrors.delete(n);return}try{let a=De({read:l=>{i.push(l)},write:()=>{}},()=>Hh(r,o,this._scope.assets,n,l=>t.instance.spanOf(l)));t.audio.setOwner(n,a),t.audioErrors.delete(n)}catch(a){t.audio.removeOwner(n),t.audioErrors.set(n,{...Ql(t.track.id,a),nodeId:r.id})}}_ownerError(t,r){let n=r.error;return{trackId:t.track.id,message:n.message,...n.stack!==void 0&&{stack:n.stack},...r.nodeId!==void 0&&{nodeId:r.nodeId},...n.prop!==void 0&&{prop:n.prop}}}_refresh(t,r=!1){let n=t.discovered,{fps:o}=this._scope,s=n&&q_(n.assetRecords,t.index.records())?n.assetRecords:new Map(t.index.records()),i=B_(t.audio.requests(),t.frameCount/o),a=t.index.layoutGates().map(c=>c.src),l=[...t.audioErrors.values(),...t.ownerErrors.values(),...t.failure?[t.failure]:[],...t.refineError?[t.refineError]:[]];return!r&&n&&s===n.assetRecords&&n.frameCount===t.frameCount&&Mo(n.audioRequests,i)&&Mo(n.layoutGates,a)&&Mo(t.errors,l)?!1:(t.discovered={id:t.track.id,discovered:!0,frameCount:t.frameCount,startFrame:0,audioRequests:i,assetRecords:s,layoutGates:a},t.errors=l,this._version++,!0)}_placedWrites(t){let r=t.instance,n=new Map,o;for(let s of r.placedCommands()){let i=t.writes.get(s.writes);i||(o??=new Sn(r),i={start:s.start,writes:o.idsOf(s.writes)},t.writes.set(s.writes,i)),n.set(s.writes,i)}return n}_compile(t,r){let n=this._options.isReady,o=this._scope.measurer;if(!n){r(o);return}let s=new Set;r({measureText(i,a,l,c,d,u){return s.add(l),o.measureText(i,a,l,c,d,u)}});for(let i of s)n(i)||t.unready.add(i)}_rebuildInstance(t){t.instance?.dispose(),t.instance=null,t.generation++,this._start(t,!0,!1),this._drain(t),t.failure&&t.discovered&&this._refresh(t)}};function Ql(e,t){let r=t instanceof Error?t:new Error(String(t));return{trackId:e,message:r.message,stack:r.stack}}function j_(e,t){let r=[];for(let n of e)n.startFrame>=t||r.push(n.endFrame>=t?{...n,endFrame:t-1}:n);return r}function B_(e,t){let r=[];for(let n of e){let o=n.bus&&L_(n.bus,t),s=o===n.bus?{...n}:{...n,bus:o};if(n.open){r.push(s);continue}if(n.startAt>=t)continue;let i=Math.min(n.endAt,t);i<=n.startAt||r.push(i===n.endAt?s:{...s,endAt:i})}return r}function L_(e,t){return e.every(r=>r.endAt<=t)?e:e.map(r=>r.endAt<=t?r:{...r,endAt:t})}function q_(e,t){if(e.size!==t.size)return!1;for(let[r,n]of e){let o=t.get(r);if(!o||!Mo(n,o))return!1}return!0}function W_(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].id!==t[r].id||e[r].startFrame!==t[r].startFrame||e[r].endFrame!==t[r].endFrame)return!1;return!0}function Mo(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n of r)if(!Mo(e[n],t[n]))return!1;return!0}var Fi=class{_scope;constructor(t,r,n){this._scope=r,this._owned=n===void 0,this._store=n??new yr(t,r,{assets:!1,audio:!1}),this._slots=this._slotsFor(t.tracks,new Map),this._currentTrackId=tc(this._slots)?.track.id??null}get currentFrame(){return this._currentFrame}get currentTrackId(){return this._currentTrackId}get currentCanvas(){return this.currentInstance?.canvas??null}get currentInstance(){let t=this._slotOf(this._currentTrackId);return t?.instance&&t.instance===this._store.instanceOf(t.track.id)?t.instance:null}get activeTrackIds(){return this._active.map(t=>t.track.id)}stateAt(t){if(this._disposed)return;let r=Math.max(0,Math.floor(t)),n=this._slotsToDraw(r);if(!this._stale&&r===this._currentFrame&&G_(n,this._active)&&n.every(s=>this._settled(s)))return;this._active=n;let o=tc([...n].reverse());o&&(this._currentTrackId=o.track.id);for(let s of n)s.instance=this._store.ensureBuilt(s.track.id);for(let s of n)s.instance&&(this._evaluate(s,r-s.span.startFrame),s.generation=this._store.generationOf(s.track.id));this._currentFrame=r,this._stale=!1}layout(t=this._scope.measurer){for(let r of this._active)this._live(r)?.layout(t)}render(t){for(let r of this._active)this._live(r)?.render(t)}invalidate(){this._stale=!0}rebuild(t=this._currentTrackId){t!==null&&(this._store.rebuild(t),this._stale=!0)}setProject(t){if(this._disposed)return;this._store.setProject(t);let r=new Map(this._slots.map(o=>[o.track.id,o]));this._slots=this._slotsFor(t.tracks,r);let n=new Set(this._slots);for(let o of this._editorStates.keys())this._slotOf(o)||this._editorStates.delete(o);this._active=this._active.filter(o=>n.has(o)),this._slotOf(this._currentTrackId)||(this._currentTrackId=tc(this._slots)?.track.id??null),this._stale=!0}setEditorStates(t,r){r?this._editorStates.set(t,r):this._editorStates.delete(t),this._stale=!0}dispose(){this._disposed=!0,this._active=[];for(let t of this._slots)t.instance=null;this._owned&&this._store.dispose()}_store;_owned;_slots;_active=[];_currentFrame=0;_currentTrackId;_stale=!1;_disposed=!1;_editorStates=new Map;_slotsFor(t,r){let n=xo(t,this._scope.fps);return t.map((o,s)=>{let i=r.get(o.id);return i?(i.track=o,i.span=n[s],i):{track:o,span:n[s],instance:null,generation:-1}})}_slotOf(t){return t===null?void 0:this._slots.find(r=>r.track.id===t)}_settled(t){let r=t.track.id;return t.instance?t.instance===this._store.instanceOf(r)&&t.generation===this._store.generationOf(r):this._store.failed(r)}_live(t){return t.instance&&t.instance===this._store.instanceOf(t.track.id)?t.instance:null}_slotsToDraw(t){let r=this._slots.map(o=>o.span),n=mr(r,t);if(n.length===0){let o=Math.max(-1,...r.map(s=>s.endFrame));t>o&&o>=0&&(n=mr(r,o))}return n.map(o=>this._slots[o.index])}_evaluate(t,r){let n=t.instance,o=1/this._scope.fps,s=Math.min(r*o,t.track.duration);n.attach(s,this._editorStates.get(t.track.id));let i=Math.max(0,s-o);n.evaluateAt(i),n.layout(),n.primeMotion(i),n.evaluateAt(s),n.layout(),n.sample()}};function tc(e){return e.find(t=>!pr(t.track.clip))}function G_(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var ec=4;async function Xh(e,t,r){for(let n=0;n<4;n++){if(!r())return"superseded";if(e(),!await t.warmPendingDecodes())return"settled";if(!r())return"superseded"}return"exhausted"}var Ii=class{_fps;_catalog;constructor(t,r){this._fps=t,this._catalog=r}update(t){let r=new Set,n=new Set;for(let s of t){n.add(s.id);let i=this._tracks.get(s.id);if(i&&i.records===s.records&&i.startFrame===s.startFrame)continue;let a=!i||i.startFrame!==s.startFrame;for(let[l,c]of s.records){let d=i?.records.get(l);(a||!d||!Qh(d,c))&&r.add(l),this._holders(l).add(s.id)}if(i)for(let l of i.records.keys())s.records.has(l)||(r.add(l),this._release(l,s.id));this._tracks.set(s.id,{id:s.id,startFrame:s.startFrame,records:s.records})}for(let[s,i]of this._tracks)if(!n.has(s)){this._tracks.delete(s);for(let a of i.records.keys())r.add(a),this._release(a,s)}let o;for(let s of r){let i=this._entryOf(s),a=this._map.get(s);if(i===void 0){if(a===void 0)continue;o??=new Map(this._map),o.delete(s)}else(a===void 0||!Z_(a,i))&&(o??=new Map(this._map),o.set(s,i))}return o&&(this._map=o),this._map}_tracks=new Map;_byKey=new Map;_map=new Map;_holders(t){let r=this._byKey.get(t);return r||this._byKey.set(t,r=new Set),r}_release(t,r){let n=this._byKey.get(t);n&&(n.delete(r),n.size===0&&this._byKey.delete(t))}_entryOf(t){let r=this._byKey.get(t);if(!r)return;let n;for(let o of r){let s=this._tracks.get(o),i=s.records.get(t);i&&(n=V_(n,Y_(i,s.startFrame)))}return n&&X_(n,this._fps,this._catalog)}};function Y_(e,t){return t===0?e:{...e,startFrame:e.startFrame+t,endFrame:e.endFrame+t}}function V_(e,t){return e?{...e,startFrame:Math.min(e.startFrame,t.startFrame),endFrame:Math.max(e.endFrame,t.endFrame)}:t}function Zh(e,t){let r;try{r=e.type==="image"?t.getImageMeta(e.src):t.getVideoMeta(e.src)}catch{return 0}return!(r.width>0)&&!(r.height>0)?0:U_(r.width,r.height)}var K_=2,H_=2,nc=120,rc=30;function U_(e,t){return e*t*4/(1024*1024)}function Jh(e){return Math.min(nc,Math.max(H_,Math.round(e*K_)))}function X_(e,t,r){switch(e.type){case"image":{let n=Jh(Zh(e,r));return{record:e,cacheAt:Math.max(0,e.startFrame-n),discardAt:e.endFrame+rc}}case"video":{let n=Math.min(nc,Jh(Zh(e,r))*2+Math.round(t));return{record:e,cacheAt:Math.max(0,e.startFrame-n),discardAt:e.endFrame+rc}}case"font":return{record:e,cacheAt:0,discardAt:null};case"loader":return{record:e,cacheAt:Math.max(0,e.startFrame-nc),discardAt:e.endFrame+rc};default:return}}function Z_(e,t){return e.cacheAt===t.cacheAt&&e.discardAt===t.discardAt&&Qh(e.record,t.record)}function Qh(e,t){if(e===t)return!0;if(e.type!==t.type||e.src!==t.src||e.startFrame!==t.startFrame||e.endFrame!==t.endFrame)return!1;switch(e.type){case"video":{let r=t;return e.trimStart===r.trimStart&&e.trimEnd===r.trimEnd}case"font":{let r=t;return e.fontWeight===r.fontWeight&&e.fontFamily===r.fontFamily}case"loader":return e.load===t.load;default:return!0}}var J_=["build","declare","evaluate","audio"];function i$(){let e=[];return{timings:e,track(t,r){let n=Object.fromEntries(J_.map(l=>[l,0])),o=null,s=Be(),i=0,a=()=>{let l=Be()-s;o&&(n[o]+=l),i+=l};return{enter(l){a(),o=l,s=Be()},suspend(){a(),o=null},resume(){s=Be()},done(l){a(),o=null,e[t]={trackId:r,trackIndex:t,frameCount:l,totalMs:i,phases:n}}}}}}var zi=class{_scope;constructor(t,r,n={}){this._scope=r,this._owned=n.store===void 0,this._store=n.store??new yr(t,r,{profile:n.profile,assets:n.assets,keepInstances:!1}),this._assets=new Ii(r.fps,r.assets)}get store(){return this._store}get discoveredCount(){let t=0;for(let r of this._store.tracks)this._store.isDiscovered(r.id)&&t++;return t}result(){return this._assemble()}ensureCovering(t){for(let r of mr(this._store.spans,t))this._store.discover(r.id);return this._assemble()}run(){for(let t of this._store.tracks)this._store.discover(t.id);return this._assemble()}async runAsync(t={}){let{budgetMs:r=Ao,isCancelled:n,onProgress:o}=t;return await this._store.runAsync({budgetMs:r,isCancelled:n,onProgress:o&&(()=>o(this._assemble()))}),this._assemble()}setProject(t){return this._store.setProject(t),this._assemble()}learn(t,r,n,o){return this._store.learn(t,r,n,o),this._assemble()}dispose(){this._owned&&this._store.dispose()}_store;_owned;_assets;_result=null;_version=-1;_assemble(){let t=this._store;if(this._result&&this._version===t.version)return this._result;let{fps:r}=this._scope,n=t.spans,o=$h(n),s=o/r,i=[],a=[],l=!0,c=n.map(f=>{let h=t.trackAssets(f.id);return h||(l=!1),a.push(...t.errorsOf(f.id)),h??Q_(f.id,f.endFrame-f.startFrame+1)}),d=this._assets.update(c.map((f,h)=>({id:f.id,startFrame:n[h].startFrame,records:f.assetRecords})));for(let f=0;f<c.length;f++)i.push(tw({...c[f],startFrame:n[f].startFrame},r,s));let u=t.profile;return this._version=t.version,this._result={fps:r,tracks:i,totalFrames:o,totalDuration:s,assets:d,buildErrors:a,complete:l,timings:u?.timings?.slice()}}};function Q_(e,t){return{id:e,discovered:!1,frameCount:t,startFrame:0,audioRequests:[],assetRecords:new Map,layoutGates:[]}}function tw(e,t,r){if(!e.audioRequests.some(s=>s.open))return e;let n=e.startFrame/t,o=e.audioRequests.map(s=>{if(!s.open)return s;let i=n+s.startAt,a=s.loop?r:Math.min(i+(s.mediaDuration??0),r);return{...s,endAt:Math.max(s.startAt,a-n)}});return{...e,audioRequests:o}}function ic(e,t,r){let n=lc(e);if(!n)return[];let o=[];for(let s of ac(e,r)){let i=n.boxes.get(s.node.id);if(!i)continue;let a=am(i,n);a&&o.push({box:lm(s.node,s.path,a.rect,t),depth:a.depth})}return o.sort((s,i)=>i.depth-s.depth),o.map(s=>s.box)}var ew={x:0,y:0,z:0};function nm(e,t,r,n,o,s){let i=lc(e);if(!i)return null;let a=ac(e,r).find(u=>u.path===n);if(!a)return null;let l=i.matrices.get(a.node.id),c=i.parentMatrices.get(a.node.id);if(!l||!c)return null;let d=(u,f)=>f.map(h=>tm(u,h,i,t));return{origin:tm(l,ew,i,t),parentPoints:d(c,o),localPoints:d(l,s)}}function tm(e,t,r,n){let o=Oe(e,t),s=Oe(r.clip,{x:o.x,y:o.y,z:o.z});if(s.w<=Oo)return null;let i=s.x/s.w,a=s.y/s.w,l=r.centerX+i*(r.width/2),c=r.centerY+a*(r.height/2),d=Mt(n.matrix,{x:l,y:-c});return{x:d.x,y:-d.y}}function om(e,t,r,n,o){let s=lc(e);if(!s)return null;let i=pe(t.matrix);if(!i)return null;let a=Mt(i,{x:r.x,y:-r.y}),l={x:a.x,y:-a.y},c=null,d=-1/0;for(let u of ac(e,o)){let f=s.boxes.get(u.node.id);if(!f)continue;let h=am(f,s);h&&lw(h.rect,l,n)&&(h.depth<=d||(d=h.depth,c={node:u.node,path:u.path,rect:h.rect}))}return c?lm(c.node,c.path,c.rect,t):null}function ac(e,t){let r=[];return sm(e._allChildren,t,r),r}function sm(e,t,r){for(let n=0;n<e.length;n++){let o=e[n];if(!(o instanceof $))continue;let s=Re(t,n);r.push({node:o,path:s}),sm(o._allChildren,s,r)}}function lc(e){let t=e._localBounds();if(!(t.width>0)||!(t.height>0))return null;let r=e._scene3D(),n=rw(r);if(n.boxes.size===0)return null;let o=vi(n.camera);if(!o)return null;let s=t.width/t.height;return{boxes:n.boxes,matrices:n.matrices,parentMatrices:n.parentMatrices,clip:Ae(iw(n.descriptor,s),o),view:o,width:t.width,height:t.height,centerX:t.x,centerY:t.y}}function rw(e){let t=new Map,r=new Map,n=new Map,s=[{key:void 0,matrix:wi(),visible:!0,box:null}],i=null,a=null,l=()=>s[s.length-1];for(let c of e.ops()){let d=l();switch(c.kind){case"push":{let u=im(d.matrix,c.transform);c.transform?.key!==void 0&&(r.set(c.transform.key,u),n.set(c.transform.key,d.matrix)),s.push({key:c.transform?.key,matrix:u,visible:d.visible&&c.transform?.visible!==!1,box:null});break}case"pop":{if(s.length===1)break;let u=s.pop();if(!u.visible||!u.box)break;u.key!==void 0&&t.set(u.key,u.box);let f=l();f.box=go(f.box,u.box);break}case"camera":{a=c.camera,i=ow(c.camera,d.matrix);break}case"light":break;default:{if(!d.visible)break;let u=nw(c,d.matrix);u&&(d.box=go(d.box,u));break}}}return{boxes:t,matrices:r,parentMatrices:n,camera:i??sw,descriptor:a}}function im(e,t){return Ae(e,mo(t,e))}function nw(e,t){if(e.kind==="model"||!("transform"in e))return null;let r=im(t,e.transform);if(e.kind==="sprite")return xn($t(.5,.5,0),r);if(!("geometry"in e))return null;let n=ki(e.geometry);if(!n)return null;if(e.kind==="instances"){let o=null;for(let s of e.instances)o=go(o,xn(n,mo(s,null)));return o?xn(o,r):null}return xn(n,r)}function ow(e,t){let r=Vl(e);if(r.lookAt===void 0)return Ae(t,mo({...e,position:r.position},t));let n=Oe(t,r.position),o={x:n.x,y:n.y,z:n.z};return Ae(yo(o),ho(o,r.lookAt))}var sw=Ae(yo({x:0,y:0,z:5}),ho({x:0,y:0,z:5},{x:0,y:0,z:0})),em=50,oc=.1,sc=1e3;function iw(e,t){if(e===null)return Si(em,t,oc,sc,1);if(e.type==="perspective")return Si(e.fov??em,t,e.near??oc,e.far??sc,e.zoom??1);let r=(e.frustumHeight??10)/2;return Yl(-r*t,r*t,r,-r,e.near??oc,e.far??sc,e.zoom??1)}var aw=[[0,1],[2,3],[4,5],[6,7],[0,2],[1,3],[4,6],[5,7],[0,4],[1,5],[2,6],[3,7]],Oo=1e-4,rm=8;function am(e,t){let n=bi(e).map(x=>Oe(t.clip,x)),o=1/0,s=1/0,i=-1/0,a=-1/0,l=!1,c=(x,_,S)=>{let b=x/S,k=_/S;b<o&&(o=b),k<s&&(s=k),b>i&&(i=b),k>a&&(a=k),l=!0};for(let[x,_]of aw){let S=n[x],b=n[_],k=S.w>Oo,M=b.w>Oo;if(!k&&!M||(k&&c(S.x,S.y,S.w),M&&c(b.x,b.y,b.w),k===M))continue;let R=(Oo-S.w)/(b.w-S.w);c(S.x+(b.x-S.x)*R,S.y+(b.y-S.y)*R,Oo)}if(!l)return null;let d=t.width/2,u=t.height/2,f=d*rm,h=u*rm,y={minX:Ni(t.centerX+o*d,t.centerX-f,t.centerX+f),maxX:Ni(t.centerX+i*d,t.centerX-f,t.centerX+f),minY:Ni(t.centerY+s*u,t.centerY-h,t.centerY+h),maxY:Ni(t.centerY+a*u,t.centerY-h,t.centerY+h)},w={x:(e.min.x+e.max.x)/2,y:(e.min.y+e.max.y)/2,z:(e.min.z+e.max.z)/2},g=Oe(t.view,w);return{rect:y,depth:g.z}}function Ni(e,t,r){return e<t?t:e>r?r:e}function lw(e,t,r){return t.x>=e.minX-r&&t.x<=e.maxX+r&&t.y>=e.minY-r&&t.y<=e.maxY+r}function lm(e,t,r,n){let o=(s,i)=>{let a=Mt(n.matrix,{x:s,y:-i});return{x:a.x,y:-a.y}};return{id:e.id,path:t,type:e.className,topLeft:o(r.minX,r.maxY),topRight:o(r.maxX,r.maxY),bottomRight:o(r.maxX,r.minY),bottomLeft:o(r.minX,r.minY),center:o((r.minX+r.maxX)/2,(r.minY+r.maxY)/2),width:r.maxX-r.minX,height:r.maxY-r.minY,rotation:n.box.rotation,scale:n.box.scale,opacity:n.box.opacity,locked:e.locked}}function Le(e){let t=eo(e);if(t)return gt(Le(t.root),t.screen);let r=e.parent;return r?gt(cc(r),e._localMatrix()):e._localMatrix()}function cc(e){let t=Le(e),r=e._spaceCamera();if(r)return gt(t,Ze(e,r).screen);let n=e._cameraScope();if(!n)return t;let o=e.layoutBounds;return gt(t,Ca(o.x,-o.y,n.lookAt,n.zoom,n.heading))}function cm(e,t,r){if(t==="")return null;let n=dc(e,t),o=n instanceof A?n.parent:null;if(!(n instanceof A)||!o)return null;let s=cw(n,o),i=pe(s);if(!i)return null;let a=Mt(i,{x:r.x,y:-r.y});return dm(s,a)?null:{x:a.x,y:-a.y}}function cw(e,t){let r=eo(e)?Ua(t):null;if(!r){let i=e._slotMatrix();return i?gt(cc(t),i):cc(t)}let n=e._slotAffine(),o=n?vr(r.view,n):r.view,s=vr(o,[1,0,0,0,0,1,0,0,0,0,1,e.depth]);return gt(Le(r.root),Yn(r.camera,s))}function dm(e,t){return _r(e)&&(e.g??0)*t.x+(e.h??0)*t.y+(e.i??1)<=0}function dw(e){let t=0,r=1,n=1;for(let o=e;o;o=o.parent){let s=o._placement();t+=o.rotation+(s?.rotation??0),r*=o.scale*(s?.scale??1),n*=o.opacity*(s?.opacity??1);let i=o!==e?o._cameraScope():null;i&&(t-=i.heading,r*=i.zoom)}return{rotation:t,scale:r,opacity:n}}function Eo(e,t){let r=e._localBounds(),n=r.x===0&&r.y===0?Le(e):gt(Le(e),Wn(r.x,-r.y)),o=en(n,r.width/2,r.height/2),s=dw(e);return{id:e.id,path:t,type:e.className,topLeft:o.topLeft,topRight:o.topRight,bottomRight:o.bottomRight,bottomLeft:o.bottomLeft,center:o.center,width:r.width,height:r.height,rotation:s.rotation,scale:s.scale,opacity:s.opacity,locked:e.locked}}function um(e,t){if(t==="")return Eo(e,t);let r=e,n=null,o=t.split(".");for(let i=0;i<o.length;i++){r instanceof L&&(n={node:r,path:fm(o,i)});let a=r._allChildren[Number(o[i])];if(!a)return null;r=a}if(r instanceof A)return Eo(r,t);if(!n)return null;let s=$i(n.node,n.path);return ic(n.node,s,n.path).find(i=>i.path===t)??null}function dc(e,t){if(t==="")return e;let r=e;for(let n of t.split(".")){let o=r._allChildren[Number(n)];if(!o)return null;r=o}return r}function fm(e,t){return e.slice(0,t).join(".")}function pm(e,t,r,n){if(t==="")return null;let o=e,s=null,i=t.split(".");for(let l=0;l<i.length;l++){o instanceof L&&(s={node:o,path:fm(i,l)});let c=o._allChildren[Number(i[l])];if(!c)return null;o=c}if(o instanceof A||!s)return null;let a=$i(s.node,s.path);return nm(s.node,a,s.path,t,r,n)}function hm(e,t,r=0){return mm(e,"",t,r,!0)}function mm(e,t,r,n,o){if(e.opacity===0||e.hidden)return null;let s=ym(e,o);if(s==="none")return null;let i=s==="all"&&uw(e,r,n);if(!i&&s==="all"&&e._confinesChildren())return null;let a=xm(e),l=gm(e,a);for(let c=l.length-1;c>=0;c--){let d=l[c],u=a[d];if(u===null)continue;let f=mm(u,Re(t,d),r,n,!1);if(f)return f}if(e instanceof L&&i){let c=om(e,$i(e,t),r,n,t);if(c)return c}return o||e.locked?null:i?Eo(e,t):null}function uc(e,t,r,n){if(e.opacity===0||e.hidden)return;let o=ym(e,n);if(o==="none")return;if(!n&&o==="all"&&r.push(Eo(e,t)),e instanceof L)for(let i of ic(e,$i(e,t),t))r.push(i);let s=xm(e);for(let i of gm(e,s)){let a=s[i];a!==null&&uc(a,Re(t,i),r,!1)}}function ym(e,t){if(t)return"all";let r=eo(e);return r?!e.backfaceVisible&&r.facesAway?"none":r.paints?"all":e._rendersChildrenInSpace()?"children":"none":"all"}function gm(e,t){let r=t.map((i,a)=>a),n=Ua(e);if(!n)return r;let o=r.filter(i=>t[i]!==null),s=o.map(i=>rn(n,t[i]));return Ps(s).map(i=>o[i])}function xm(e){return e instanceof L?e._allChildren.map(t=>t instanceof A?t:null):e.children}function $i(e,t){return{box:Eo(e,t),matrix:Le(e)}}function uw(e,t,r){let n=Le(e),o=pe(n);if(!o)return!1;let s=Mt(o,{x:t.x,y:-t.y});return dm(n,s)?!1:e._hitTestSelf({x:s.x,y:-s.y},r)}function _m(e,t,r){if(!(e instanceof re))return null;let n=r.layoutTextBlock(e._textState());if(!n)return null;let o=Le(e),s=(l,c)=>{let d=Mt(o,{x:l,y:c});return{x:d.x,y:-d.y}},i=new Array(jl(n)),a=[];for(let l of n.lines){a.push({start:l.start,end:l.end});for(let c=0;c<l.carets.length;c++){let d=l.carets[c];i[l.start+c]={offset:l.start+c,top:s(d,l.top),bottom:s(d,l.bottom)}}}return{path:t,text:e.text,carets:i,lines:a}}function E$(e,t){let r=0,n=1/0;for(let o of e.carets){let s=fw(t,o.top,o.bottom);s<n&&(n=s,r=o.offset)}return r}function C$(e,t,r){let n=Math.max(0,Math.min(t,r)),o=Math.min(e.carets.length-1,Math.max(t,r)),s=[];for(let i of e.lines){let a=Math.max(n,i.start),l=Math.min(o,i.end);if(a>=l)continue;let c=e.carets[a],d=e.carets[l];s.push({topLeft:c.top,topRight:d.top,bottomRight:d.bottom,bottomLeft:c.bottom})}return s}function fw(e,t,r){let n=r.x-t.x,o=r.y-t.y,s=n*n+o*o,i=s===0?0:Math.max(0,Math.min(1,((e.x-t.x)*n+(e.y-t.y)*o)/s));return Math.hypot(e.x-(t.x+i*n),e.y-(t.y+i*o))}var ji=class{renderContext;measurer;storageAdapter;masterClock;stateEvaluator;assetManager;audioDevice;assetCatalog;onFramePainted;disposed=!1;precompRunning=!1;hasPainted=!1;seekGeneration=0;precompBudgetMs;onPrecompProgress;fps;viewport;precomper;store;overrides=new Map;precomp;get spans(){return this.precomp.tracks.map((t,r)=>({id:t.id,index:r,startFrame:t.startFrame,endFrame:t.startFrame+t.frameCount-1}))}get totalFrames(){return this.precomp.totalFrames}get totalDuration(){return this.precomp.totalDuration}get currentTrackId(){return this.stateEvaluator.currentTrackId}get buildErrors(){return this.renderErrors.length===0?this.precomp.buildErrors:[...this.precomp.buildErrors,...this.renderErrors]}renderErrors=[];onRenderError;captureRenderError(t,r){let n=t instanceof Error?t:new Error(String(t));r!==void 0&&this.recoverMissingAsset(n,r)||this.renderErrors.some(o=>o.message===n.message)||(this.renderErrors.push({trackId:this.stateEvaluator.currentTrackId??"",message:n.message,stack:n.stack}),this.onRenderError?.(this.buildErrors))}learnMissingAsset(t,r){let n=mw(t,this.assetCatalog);if(n)for(let o of[...this.stateEvaluator.activeTrackIds].reverse()){let s=this.store.instanceOf(o),i=this.precomp.tracks.find(c=>c.id===o);if(!s||!i)continue;let a;if(t.nodeId!==void 0&&s.forEachOwner((c,d)=>{a===void 0&&c.id===t.nodeId&&(a=d)}),a??=this.store.ownersOf(o,t.src).values().next().value,a===void 0)continue;let l=this.precomper.learn(o,a,n,Math.floor(r)-i.startFrame);l!==this.precomp&&this.adoptPrecomp(l);return}}rescuedAssets=new Set;recoverMissingAsset(t,r){if(!(t instanceof Qr)||t.assetType==="audio")return!1;let n=`${t.assetType}:${t.src}`;if(this.rescuedAssets.has(n))return!1;this.rescuedAssets.add(n),this.learnMissingAsset(t,r);let o=this.recordFor(t.assetType,t.src,r);return o?(this.storageAdapter.loadAsset(t.src,o).then(()=>{this.disposed||(this.renderAt(this.stateEvaluator.currentFrame),this.settleTrailing())}).catch(s=>{this.disposed||this.captureRenderError(new Error(`${t.message}
15
-
16
- Loading it directly also failed: ${String(s)}`))}),!0):!1}recordFor(t,r,n){try{return t==="font"?{type:"font",src:r,startFrame:n,endFrame:n,fontFamily:r,fontWeight:400}:t==="image"?(this.assetCatalog.getImageMeta(r),{type:"image",src:r,startFrame:n,endFrame:n}):(this.assetCatalog.getVideoMeta(r),{type:"video",src:r,startFrame:n,endFrame:n,trimStart:0,trimEnd:this.assetCatalog.getVideoDuration(r)})}catch{return null}}clearRenderErrors(){this.rescuedAssets.clear(),this.renderErrors.length!==0&&(this.renderErrors.length=0,this.onRenderError?.(this.buildErrors))}constructor(t){let{project:r}=t;if(r.fps===void 0||r.viewport===void 0)throw new Error("PlaybackController takes a project whose fps and viewport are resolved \u2014 see Session.");this.renderContext=t.renderContext,this.measurer=t.measurer,this.masterClock=t.masterClock,this.storageAdapter=t.storageAdapter,this.audioDevice=t.audioDevice,this.fps=r.fps,this.viewport=r.viewport,this.precompBudgetMs=t.precompBudgetMs??Ao,this.onPrecompProgress=t.onPrecompProgress,this.assetCatalog=t.assets;let n={registry:t.registry,viewport:this.viewport,fps:this.fps,assets:t.assets,measurer:this.measurer};this.store=new yr(r,n,{profile:t.precompProfile,isReady:o=>this.assetManager?.isReady(o)??!1}),this.precomper=new zi(r,n,{store:this.store}),this.precomp=this.precomper.ensureCovering(0),this.stateEvaluator=new Fi(r,n,this.store),this.assetManager=new Mi(this.precomp,this.storageAdapter,this.audioDevice),this.masterClock.setDuration(this.totalDuration),this.masterClock.onPlay((o,s,i)=>{this.audioDevice.play(o,s,i),this.storageAdapter.setPlaying(!0)}),this.masterClock.onPause(()=>{this.audioDevice.stop(),this.storageAdapter.setPlaying(!1)}),this.masterClock.onTick(async o=>{let s=++this.seekGeneration,i=this.fps*o;i>=this.totalFrames&&this.masterClock.pause(),this.discoverThrough(i),await this.loadFrame(i),this.isCurrent(s)&&(this.audioDevice.syncTo(o),this.renderAt(i),this.assetManager.prefetch(i),this.trimAround(i))}),this.startBackgroundPrecomp()}startBackgroundPrecomp(){this.precompRunning||this.disposed||this.precomp.complete||(this.precompRunning=!0,(async()=>{try{for(await Oi();!this.disposed&&!this.precomp.complete;){let t=await this.precomper.runAsync({budgetMs:this.precompBudgetMs,isCancelled:()=>this.disposed,onProgress:r=>this.adoptPrecomp(r)});if(this.disposed)return;this.precomp.complete||this.adoptPrecomp(t)}}finally{this.precompRunning=!1}})())}adoptPrecomp(t){this.disposed||(this.precomp=t,this.assetManager.setPrecomp(t),this.masterClock.setDuration(this.totalDuration),this.onPrecompProgress?.(t))}discoverThrough(t){let r=this.precomper.ensureCovering(Math.floor(t));r!==this.precomp&&this.adoptPrecomp(r)}async loadFrame(t){let r=[];for(let n of mr(this.store.spans,Math.floor(t)))for(let o of this.store.layoutGates(n.id))this.assetManager.isReady(o.src)||r.push(o);if(r.length===0){await this.assetManager.loadAt(t);return}await Promise.all([this.assetManager.loadAt(t),this.assetManager.loadRecords(r)])}trimAround(t){Math.abs(t-this.lastTrimFrame)<this.fps||(this.lastTrimFrame=t,this.store.trim(Math.floor(t),Math.ceil(pw*this.fps)))}lastTrimFrame=0;get isPlaying(){return this.masterClock.isPlaying}get currentTime(){return this.masterClock.currentTime}get currentFrame(){return this.masterClock.currentTime*this.fps}onTime(t){this.masterClock.onTime(t)}onPlay(t){this.masterClock.onPlay(()=>t())}onPause(t){this.masterClock.onPause(t)}isCurrent(t){return!this.disposed&&t===this.seekGeneration}renderAt(t){if(!this.disposed){this.hasPainted=!0,this.renders++;try{this.store.settleGates(mr(this.store.spans,Math.floor(t)).map(r=>r.id)),this.stateEvaluator.stateAt(t),this.applyOverrides(),this.stateEvaluator.layout(this.measurer),this.renderContext.execute(()=>{this.stateEvaluator.render(this.renderContext)})}catch(r){this.captureRenderError(r,t)}this.announcePaint(t)}}announcePaint(t){if(this.onFramePainted)try{this.onFramePainted(Math.floor(t))}catch(r){console.error("[PlaybackController] onFramePainted listener threw:",r)}}async seek(t){if(this.disposed)return;let r=++this.seekGeneration;this.paintInFlight=r;try{let n=Math.max(0,Math.min(t,this.totalFrames));if(this.masterClock.pause(),this.discoverThrough(n),this.masterClock.seek(n/this.fps),await this.loadFrame(n),!this.isCurrent(r)||await this.settle(()=>this.renderAt(n),r)==="superseded")return;this.assetManager.prefetch(n),this.trimAround(n)}finally{this.paintLanded(r)}}setProject(t){if(this.disposed)return;let r=++this.seekGeneration;this.precomper.setProject(t),this.stateEvaluator.setProject(t),this.discoverThrough(this.currentFrame),this.clearRenderErrors(),this.masterClock.setDuration(this.totalDuration);let n=Math.min(this.currentFrame,Math.max(0,this.totalFrames-1));this.pendingSwap=r,this.paintInFlight=r,this.lastReplacePaint=this.loadAndRepaint(n,r),this.startBackgroundPrecomp()}whenReplaced(){return this.lastReplacePaint}lastReplacePaint=Promise.resolve();pendingSwap=0;async loadAndRepaint(t,r){try{try{await this.loadFrame(t)}catch(n){console.error("[PlaybackController] swap asset load failed:",n);return}await this.settle(()=>this.renderAt(t),r)}finally{this.pendingSwap===r&&(this.pendingSwap=0),this.paintLanded(r)}}seekWhilePlaying(t){++this.seekGeneration;let r=Math.max(0,Math.min(t,this.totalFrames));this.masterClock.seek(r/this.fps)}async screenshot(){let t=this.stateEvaluator.currentFrame,r=++this.seekGeneration;this.paintInFlight=r;try{return await this.loadFrame(t),!this.isCurrent(r)||await this.settle(()=>this.renderAt(t),r,!0)==="superseded"?void 0:this.renderContext.screenshot()}finally{this.paintLanded(r)}}async settle(t,r,n=!1){let o=n?hw(this.storageAdapter):this.storageAdapter,s=await Xh(t,o,()=>this.isCurrent(r));return s==="exhausted"&&console.warn(`[PlaybackController] frame ${this.stateEvaluator.currentFrame} still had decodes pending after ${4} passes`),s}paintInFlight=0;renders=0;repaintOwedSince=null;paintLanded(t){if(!(this.paintInFlight!==t||this.disposed)){if(this.paintInFlight=0,this.repaintOwedSince!==null){let r=this.renders===this.repaintOwedSince;this.repaintOwedSince=null,r&&!this.isPlaying&&this.renderAt(this.stateEvaluator.currentFrame)}this.settleTrailing()}}getTreeState(){let t=this.stateEvaluator.currentInstance;if(!t)return null;let r=this.precomp.tracks.find(l=>l.id===this.stateEvaluator.currentTrackId),n=r?.startFrame??0,o=r?.frameCount??_n(t.duration,this.fps),s=new Map,i=new Map;t.forEachOwner((l,c,d,u)=>{i.set(c,u);let f=wn(d,this.fps,o);f&&s.set(u,{startFrame:n+f.startFrame,endFrame:n+f.endFrame})});let a=yw(r?.audioRequests??[],i);return vm(t.canvas,"",s,a)}getNodeState(t){let r=this.stateEvaluator.currentCanvas;if(!r)return null;let n=Sm(r,t);return n?{id:n.id,type:n.className,properties:n.properties}:null}getNodeBox(t){let r=this.stateEvaluator.currentCanvas;return r?um(r,t):null}getNodePropsAt(t){let r=this.stateEvaluator.currentCanvas;if(!r)return null;let n=dc(r,t);return n?n.properties:null}getNodeBoxes(){let t=this.stateEvaluator.currentCanvas;if(!t)return[];let r=[];return uc(t,"",r,!0),r}projectNode3D(t,r,n){let o=this.stateEvaluator.currentCanvas;return o?pm(o,t,r,n):null}parentPlanePoint(t,r){let n=this.stateEvaluator.currentCanvas;return n?cm(n,t,r):null}getTextLayout(t){let r=this.stateEvaluator.currentCanvas;if(!r)return null;let n=wm(r,t);return n instanceof A?this.textLayoutOf(n,t):null}textLayoutOf(t,r){let n=Th(this.measurer);return n?_m(t,r,n):null}pickNode(t,r=0){let n=this.stateEvaluator.currentCanvas;return n?hm(n,t,r):null}setNodeOverride(t,r){let n=this.overrides.get(t);this.overrides.set(t,n?{...n,...r}:{...r}),this.applyOverrides()}clearNodeOverrides(t){(t===void 0?this.overrides.size>0&&(this.overrides.clear(),!0):this.overrides.delete(t))&&(this.stateEvaluator.rebuild(),this.repaint())}setEditorStates(t,r){this.stateEvaluator.setEditorStates(t,r),this.repaint()}repaint(){this.hasPainted&&(this.pendingSwap!==0&&this.isCurrent(this.pendingSwap)||(this.renderAt(this.stateEvaluator.currentFrame),this.settleTrailing()))}settleTrailing(){this.trailingSettle||this.disposed||this.isPlaying||!this.hasBackgroundDecodes()||this.repaintBehindDecodes().catch(t=>{console.error("[PlaybackController] background decode failed:",t)})}trailingSettle=!1;hasBackgroundDecodes(){return this.storageAdapter.hasPendingDecodes()||this.storageAdapter.hasPendingUpgrades()}async repaintBehindDecodes(){this.trailingSettle=!0;try{for(let t=0;t<4&&this.hasBackgroundDecodes();t++){let[r,n]=await Promise.all([this.storageAdapter.warmPendingDecodes(),this.storageAdapter.warmPendingUpgrades()]);if(!(r||n)||this.disposed||this.isPlaying)return;if(this.paintInFlight!==0){this.repaintOwedSince=this.renders;return}this.renderAt(this.stateEvaluator.currentFrame)}}finally{this.trailingSettle=!1}}applyOverrides(){if(this.overrides.size===0)return;let t=this.stateEvaluator.currentCanvas;if(t)for(let[r,n]of this.overrides)wm(t,r)?.set(n)}play(t=1,r=!1){if(this.currentFrame>=this.totalFrames){this.seek(0).then(()=>this.masterClock.play(t,r)).catch(()=>{});return}this.masterClock.play(t,r)}pause(){this.masterClock.pause()}setMuted(t){this.audioDevice.setMuted(t)}dispose(){this.disposed=!0,this.masterClock.dispose(),this.audioDevice.dispose(),this.stateEvaluator.dispose(),this.store.dispose(),this.assetManager.dispose()}},pw=30;function hw(e){return{async warmPendingDecodes(){let[t,r]=await Promise.all([e.warmPendingDecodes(),e.warmPendingUpgrades()]);return t||r}}}function mw(e,t){switch(e.assetType){case"image":return{type:"image",src:e.src};case"font":return{type:"font",family:e.src,weight:400};case"video":try{return{type:"video",src:e.src,trimStart:0,trimEnd:t.getVideoDuration(e.src)}}catch{return}default:return}}function G$(e){return e.children.length>0}function vm(e,t,r,n){let o={id:e.id,path:t,type:e.className,children:e._allChildren.map((a,l)=>vm(a,Re(t,l),r,n))},s=n.get(t);s&&s.length>0&&(o.waveform=s);let i=r.get(t);return i&&(o.startFrame=i.startFrame,o.endFrame=i.endFrame),o}function yw(e,t){let r=new Map;for(let n of e){let o=n.ownerId!==void 0?t.get(n.ownerId):"";if(o===void 0)continue;let s={src:n.src,startTime:n.startAt,endTime:Number.isFinite(n.endAt)?n.endAt:null},i=r.get(o);i?i.push(s):r.set(o,[s])}return r}function wm(e,t){if(t==="")return e;let r=e;for(let n of t.split(".")){let o=r._allChildren[Number(n)];if(!o)return null;r=o}return r}function Sm(e,t){if(e.id===t)return e;for(let r of e._allChildren){let n=Sm(r,t);if(n)return n}return null}var Co=class{manifest;constructor(t){this.manifest=t}normalizeKey(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}getImageMeta(t){let r=this.manifest.image[this.normalizeKey(t)];if(!r)throw new Error(`Image asset not found: "${t}". Check the file exists in your public folder and the src matches its filename.`);return r}getVideoMeta(t){let r=this.manifest.video[this.normalizeKey(t)];if(!r)throw new Error(`Video asset not found: "${t}". Check the file exists in your public folder and the src matches its filename.`);return r}getAudioMeta(t){let r=this.manifest.audio[this.normalizeKey(t)];if(!r)throw new Error(`No audio metadata for src: ${t}`);return r}getFontMeta(t){let r=this.manifest.font[t];if(!r)throw new Error(`No font metadata for key: ${t}`);return r}getFontFamilyMetas(t){return Object.values(this.manifest.font).filter(r=>r.fontFamily===t)}getVideoDuration(t){return this.getVideoMeta(t).duration}getAudioDuration(t){return this.getAudioMeta(t).duration}getMediaDuration(t){let r=this.normalizeKey(t),n=this.manifest.audio[r];if(n)return n.duration;let o=this.manifest.video[r];if(o)return o.duration;throw new Error(`Audio asset not found: "${t}". Check the file exists in your public folder and the src matches its filename.`)}getImageSize(t){let{width:r,height:n}=this.getImageMeta(t);return{width:r,height:n}}};var Bi=class{controller;constructor(t){this.controller=t}get isPlaying(){return this.controller.isPlaying}get frame(){return this.controller.currentFrame}play(t=1,r=!1){this.controller.play(t,r)}pause(){this.controller.pause()}seekFrame(t){this.controller.seekWhilePlaying(t)}setMuted(t){this.controller.setMuted(t)}onTime(t){this.controller.onTime(t)}onPlay(t){this.controller.onPlay(t)}onPause(t){this.controller.onPause(t)}};var Li=class{_isPlaying=!1;_currentTime=0;_duration=0;get isPlaying(){return this._isPlaying}get currentTime(){return this._currentTime}get duration(){return this._duration}setDuration(t){this._duration=t}setCurrentTime(t,r=!0){if(this._currentTime!==t&&(this._currentTime=t,!!r))for(let n of this.timeCallbacks)n(t)}setPlaying(t){this._isPlaying=t}play(t,r){this._isPlaying=!0;for(let n of this.playCallbacks)n(this._currentTime,t,r)}async tick(){await Promise.all(this.tickCallbacks.map(t=>t(this._currentTime)))}pause(){this._isPlaying=!1;for(let t of this.pauseCallbacks)t()}tickCallbacks=[];playCallbacks=[];pauseCallbacks=[];timeCallbacks=[];dispose(){this.tickCallbacks.length=0,this.playCallbacks.length=0,this.pauseCallbacks.length=0,this.timeCallbacks.length=0}onTick(t){this.tickCallbacks.push(t)}onPlay(t){this.playCallbacks.push(t)}onPause(t){this.pauseCallbacks.push(t)}onTime(t){this.timeCallbacks.push(t)}};var qi=class extends Li{seek(t){this.setCurrentTime(t)}};var bm=class{engine;viewport;fps;constructor(t,r){this.engine=t,this._project=km(r.document,r,t),this.viewport=this._project.viewport,this.fps=this._project.fps,this._catalog=new Co(t.manifest),this._unsubscribe=t._onManifestChange(a=>{this._catalog=new Co(a),this._storage.setCatalog(this._catalog)});let n={catalog:this._catalog,viewport:this.viewport,fps:this.fps};this._storage=t.platform.createStorageAdapter(n),this._renderContext=t.platform.createRenderContext(this._storage);let o=t.platform.createMeasureContext(this._storage),s=t.platform.createAudioSink(),i=t.platform.createTicker(this.fps,s);this.applyGlobals(),r.target!==void 0&&this._renderContext.mount(r.target),this._controller=new ji({project:this._project,registry:t._registry,renderContext:this._renderContext,measurer:o,storageAdapter:this._storage,masterClock:i??new qi,audioDevice:s,assets:this._catalog,onPrecompProgress:r.onPrecompProgress}),this._playback=i===null?null:new Bi(this._controller)}get document(){return this._project}get playback(){return this._playback}get controller(){return this._controller}get surface(){return this._renderContext}get duration(){return this._controller.totalDuration}get totalFrames(){return this._controller.totalFrames}async seek(t){await this.seekFrame(Math.round(t*this.fps))}async seekFrame(t){this.applyGlobals(),await this._controller.seek(t)}replace(t){let r=km(t,{},this);if(r.fps!==this.fps||r.viewport.width!==this.viewport.width||r.viewport.height!==this.viewport.height)throw new Error(`Cannot replace a ${this.viewport.width}\xD7${this.viewport.height} @ ${this.fps}fps document with a ${r.viewport.width}\xD7${r.viewport.height} @ ${r.fps}fps one \u2014 open a new session.`);this._project=r,this.applyGlobals(),this._controller.setProject(r)}image(t={}){return this.applyGlobals(),this.engine.exporter.exportStill({...t,frame:t.frame??{kind:"last"},project:this._project,registry:this.engine._registry,manifest:t.manifest??this.engine.manifest})}export(t={}){return this.applyGlobals(),this.engine.exporter.exportVideo({...t,project:this._project,registry:this.engine._registry,manifest:t.manifest??this.engine.manifest})}dispose(){this._unsubscribe(),this._controller.dispose(),this._renderContext.dispose()}applyGlobals(){Ki(this._project.theme)}_project;_catalog;_storage;_renderContext;_controller;_playback;_unsubscribe};function km(e,t,r){let n=Ep(e),o={...n,viewport:t.viewport??n.viewport??r.viewport,fps:t.fps??n.fps??r.fps};return Up(o),o}function sj(e,t={}){let r=t.delimiter??",",n=_w(e,r);if(n.length===0)return[];let o=n[0].map(c=>c.trim()),i=n.slice(1).map(c=>{let d={};return o.forEach((u,f)=>{d[u]=c[f]??""}),d}),a=gw(o,i,t.numeric),l=xw(o,i,a,t.boolean);return a.length===0&&l.length===0?i:i.map(c=>{let d={...c};for(let u of a){let f=c[u];f!==""&&(d[u]=Number(f))}for(let u of l){let f=c[u];f!==""&&(d[u]=f==="true")}return d})}function ij(e,t){throw new Error(`parseData("${e}") must be called with a static string literal so the @motionscript/vite-plugin macro can inline it at build time. If you're seeing this error at runtime, either the plugin isn't installed/registered, or this call's argument isn't a plain string literal.`)}function gw(e,t,r){return r===!1?[]:Array.isArray(r)?r:e.filter(n=>{let o=!1;for(let s of t){let i=s[n];if(i!==""){if(!Number.isFinite(Number(i)))return!1;o=!0}}return o})}function xw(e,t,r,n){if(n===!1)return[];if(Array.isArray(n))return n;let o=new Set(r);return e.filter(s=>{if(o.has(s))return!1;let i=!1;for(let a of t){let l=a[s];if(l!==""){if(l!=="true"&&l!=="false")return!1;i=!0}}return i})}function _w(e,t){let r=[],n=[],o="",s=!1,i=!1,a=()=>{n.push(o),o=""},l=()=>{a(),r.push(n),n=[],i=!1};for(let c=0;c<e.length;c++){let d=e[c];if(s){d==='"'?e[c+1]==='"'?(o+='"',c++):s=!1:o+=d;continue}if(d==='"'){s=!0,i=!0;continue}if(d===t){i=!0,a();continue}if(d!=="\r"){if(d===`
17
- `){(i||o)&&l();continue}o+=d,i=!0}}return(i||o)&&l(),r}var lj=(e,t)=>{let r=new Array(e);for(let n=0;n<e;n++)r[n]=t(n);return r};function dj(){let e=null;function t(r){if(r!==void 0)e=r;else{if(e===null)throw new Error("Reference not assigned yet");return e}}return t}var Wi=class{state=0;constructor(t){this.setSeed(t)}setSeed(t){this.state=typeof t=="string"?t.split("").reduce((r,n)=>(r=(r<<5)-r+n.charCodeAt(0),r&r),0):t}next(){this.state|=0,this.state=this.state+1831565813|0;var t=Math.imul(this.state^this.state>>>15,1|this.state);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}},Mm=4294967296,fc=class e{_seed;numericSeed;gen;spareGauss=null;constructor(t){this.gen=new Wi(t),this.adopt(t)}get seed(){return this._seed}set seed(t){this.adopt(t)}static toNumeric(t){return typeof t=="string"?t.split("").reduce((r,n)=>(r<<5)-r+n.charCodeAt(0),0):t}adopt(t){this._seed=t,this.numericSeed=e.toNumeric(t),this.gen.setSeed(t),this.spareGauss=null}nextFloat(t=0,r=1){return this.gen.next()*(r-t)+t}nextInt(t=0,r=Mm){return Math.floor(this.gen.next()*(r-t))+t}floatArray(t,r=0,n=1){let o=new Array(t);for(let s=0;s<t;s++)o[s]=this.nextFloat(r,n);return o}intArray(t,r=0,n=Mm){let o=new Array(t);for(let s=0;s<t;s++)o[s]=this.nextInt(r,n);return o}gauss(t=0,r=1){if(this.spareGauss!==null){let a=this.spareGauss;return this.spareGauss=null,t+r*a}let n,o,s;do n=this.gen.next()*2-1,o=this.gen.next()*2-1,s=n*n+o*o;while(s>=1||s===0);let i=Math.sqrt(-2*Math.log(s)/s);return this.spareGauss=o*i,t+r*(n*i)}noise(t,r=1){let n=t*r,o=Math.floor(n),s=n-o,i=s*s*(3-2*s),a=this.latticeValue(o),l=this.latticeValue(o+1);return a+(l-a)*i}reset(t=this._seed){this.adopt(t)}latticeValue(t){let r=Math.sin(t+this.numericSeed)*1e4;return r-Math.floor(r)}};export{Mn as a,An as b,On as c,gr as d,To as e,xr as f,Lr as g,Ce as h,U as i,_t as j,Cc as k,T as l,En as m,nt as n,Ro as o,Dc as p,Pm as q,Kt as r,Ic as s,zc as t,Cn as u,Pn as v,Dm as w,Rm as x,Fm as y,Im as z,Dn as A,Rn as B,jo as C,F as D,Zm as E,Xi as F,Wr as G,Pd as H,Zi as I,Ji as J,Qi as K,Jm as L,ty as M,Gr as N,ta as O,Yr as P,Dd as Q,sy as R,iy as S,Wd as T,ay as U,Fn as V,Vr as W,Lo as X,Yd as Y,Vd as Z,ly as _,cy as $,zn as aa,J as ba,Tt as ca,dy as da,Ht as ea,D as fa,Ko as ga,la as ha,ca as ia,Kr as ja,Dt as ka,Nn as la,$n as ma,Lt as na,jn as oa,su as pa,Hr as qa,Sy as ra,da as sa,ua as ta,by as ua,ky as va,My as wa,pa as xa,ha as ya,Ay as za,au as Aa,lu as Ba,Bn as Ca,Ge as Da,Ou as Ea,Jo as Fa,W as Ga,Eu as Ha,ue as Ia,Cu as Ja,Qo as Ka,Pu as La,Tu as Ma,at as Na,Du as Oa,es as Pa,Ru as Qa,Fu as Ra,Iu as Sa,Ye as Ta,Gy as Ua,Yy as Va,Vy as Wa,Ky as Xa,Ve as Ya,Sa as Za,lt as _a,ba as $a,ft as ab,ka as bb,Hy as cb,Ln as db,Zr as eb,fe as fb,Aa as gb,qn as hb,Oa as ib,ns as jb,os as kb,_r as lb,Ea as mb,Wn as nb,gt as ob,Mt as pb,pe as qb,Ca as rb,Gu as sb,wr as tb,is as ub,Pa as vb,Ta as wb,Jr as xb,rg as yb,ds as zb,ct as Ab,us as Bb,fs as Cb,Ke as Db,ot as Eb,Vn as Fb,p as Gb,Xt as Hb,pt as Ib,ms as Jb,ys as Kb,yf as Lb,gs as Mb,gf as Nb,xf as Ob,_f as Pb,Ba as Qb,La as Rb,He as Sb,Sr as Tb,qa as Ub,Wa as Vb,qt as Wb,Kn as Xb,Hn as Yb,Un as Zb,Xn as _b,Pe as $b,Og as ac,Eg as bc,Ga as cc,GO as dc,Sf as ec,bf as fc,kf as gc,Wt as hc,vs as ic,mE as jc,Mf as kc,Qn as lc,br as mc,xE as nc,bs as oc,Af as pc,I as qc,ht as rc,Qr as sc,K as tc,A as uc,wt as vc,Ds as wc,Lg as xc,Zt as yc,Jt as zc,CC as Ac,Kf as Bc,Hf as Cc,Uf as Dc,Xf as Ec,Zf as Fc,Ja as Gc,ep as Hc,rp as Ic,np as Jc,Fs as Kc,no as Lc,op as Mc,vt as Nc,Re as Oc,Is as Pc,zs as Qc,el as Rc,At as Sc,$s as Tc,rl as Uc,nl as Vc,lp as Wc,H as Xc,j as Yc,Rt as Zc,St as _c,Bs as $c,Ls as ad,nn as bd,qs as cd,al as dd,ll as ed,dp as fd,Mr as gd,Ft as hd,Ws as id,ye as jd,Ar as kd,Or as ld,fl as md,Er as nd,er as od,ge as pd,pp as qd,hp as rd,mp as sd,yp as td,gp as ud,Ys as vd,oo as wd,rr as xd,Cr as yd,Zs as zd,nr as Ad,Qs as Bd,te as Cd,Qg as Dd,mt as Ed,Gt as Fd,re as Gd,oe as Hd,io as Id,Q as Jd,ln as Kd,xe as Ld,$ as Md,ti as Nd,z as Od,Ie as Pd,_e as Qd,Tr as Rd,we as Sd,ve as Td,ze as Ud,or as Vd,sr as Wd,Ne as Xd,Dr as Yd,Rr as Zd,ir as _d,ar as $d,lr as ae,cn as be,ei as ce,se as de,Ir as ee,cr as fe,ri as ge,un as he,zr as ie,Nr as je,dr as ke,ie as le,ur as me,zt as ne,fr as oe,be as pe,L as qe,ni as re,RI as se,pr as te,Rx as ue,E as ve,Nt as we,FI as xe,Op as ye,oi as ze,II as Ae,Fx as Be,Me as Ce,Ix as De,Ep as Ee,it as Fe,yt as Ge,Lx as He,qx as Ie,ai as Je,zp as Ke,Sl as Le,r0 as Me,Up as Ne,s3 as Oe,bl as Pe,a3 as Qe,kl as Re,ci as Se,di as Te,yn as Ue,gi as Ve,zz as We,j0 as Xe,Nz as Ye,Bz as Ze,qz as _e,Yz as $e,Vz as af,po as bf,jl as cf,Bl as df,K0 as ef,H0 as ff,U0 as gf,X0 as hf,J0 as if,Rh as jf,n_ as kf,o_ as lf,Gl as mf,s_ as nf,i_ as of,wi as pf,Ae as qf,vi as rf,Oe as sf,Fh as tf,ho as uf,mo as vf,yo as wf,Ih as xf,Si as yf,Yl as zf,$t as Af,go as Bf,bi as Cf,xn as Df,ki as Ef,m_ as Ff,y_ as Gf,zh as Hf,Vl as If,Mi as Jf,Ai as Kf,Be as Lf,Oi as Mf,u2 as Nf,_n as Of,xo as Pf,$h as Qf,mr as Rf,Ee as Sf,wn as Tf,Ei as Uf,Ao as Vf,yr as Wf,Fi as Xf,ec as Yf,Xh as Zf,i$ as _f,zi as $f,ic as ag,nm as bg,om as cg,Le as dg,cm as eg,Eo as fg,um as gg,dc as hg,pm as ig,hm as jg,uc as kg,_m as lg,E$ as mg,C$ as ng,ji as og,G$ as pg,Co as qg,Bi as rg,Li as sg,qi as tg,bm as ug,km as vg,sj as wg,ij as xg,lj as yg,dj as zg,Wi as Ag,fc as Bg};
18
- //# sourceMappingURL=chunk-TGDX2SS2.js.map