@codexo/exojs 2.1.1 → 2.1.2

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 (349) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -0
  3. package/dist/esm/audio/AbstractMedia.d.ts +3 -3
  4. package/dist/esm/audio/AbstractMedia.js +7 -2
  5. package/dist/esm/audio/AbstractMedia.js.map +1 -1
  6. package/dist/esm/audio/AudioAnalyser.d.ts +1 -1
  7. package/dist/esm/audio/AudioAnalyser.js +13 -3
  8. package/dist/esm/audio/AudioAnalyser.js.map +1 -1
  9. package/dist/esm/audio/Media.d.ts +1 -1
  10. package/dist/esm/audio/Music.d.ts +2 -2
  11. package/dist/esm/audio/Music.js +2 -1
  12. package/dist/esm/audio/Music.js.map +1 -1
  13. package/dist/esm/audio/Sound.d.ts +2 -2
  14. package/dist/esm/audio/Sound.js +10 -9
  15. package/dist/esm/audio/Sound.js.map +1 -1
  16. package/dist/esm/audio/audio-context.d.ts +1 -1
  17. package/dist/esm/core/Application.d.ts +5 -5
  18. package/dist/esm/core/Application.js +15 -7
  19. package/dist/esm/core/Application.js.map +1 -1
  20. package/dist/esm/core/Bounds.d.ts +2 -2
  21. package/dist/esm/core/Bounds.js +6 -8
  22. package/dist/esm/core/Bounds.js.map +1 -1
  23. package/dist/esm/core/Clock.js +3 -2
  24. package/dist/esm/core/Clock.js.map +1 -1
  25. package/dist/esm/core/Color.d.ts +1 -1
  26. package/dist/esm/core/Color.js +148 -144
  27. package/dist/esm/core/Color.js.map +1 -1
  28. package/dist/esm/core/Quadtree.d.ts +2 -2
  29. package/dist/esm/core/Quadtree.js +6 -4
  30. package/dist/esm/core/Quadtree.js.map +1 -1
  31. package/dist/esm/core/Scene.d.ts +5 -5
  32. package/dist/esm/core/Scene.js +5 -6
  33. package/dist/esm/core/Scene.js.map +1 -1
  34. package/dist/esm/core/SceneManager.js +42 -41
  35. package/dist/esm/core/SceneManager.js.map +1 -1
  36. package/dist/esm/core/SceneNode.d.ts +11 -11
  37. package/dist/esm/core/SceneNode.js +22 -24
  38. package/dist/esm/core/SceneNode.js.map +1 -1
  39. package/dist/esm/core/Signal.js +6 -4
  40. package/dist/esm/core/Signal.js.map +1 -1
  41. package/dist/esm/core/Time.d.ts +1 -1
  42. package/dist/esm/core/Time.js +10 -9
  43. package/dist/esm/core/Time.js.map +1 -1
  44. package/dist/esm/core/Timer.d.ts +1 -1
  45. package/dist/esm/core/Timer.js +1 -0
  46. package/dist/esm/core/Timer.js.map +1 -1
  47. package/dist/esm/core/types.d.ts +1 -1
  48. package/dist/esm/core/utils.d.ts +3 -3
  49. package/dist/esm/index.js +3 -2
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/input/ArcadeStickGamepadMapping.js +1 -1
  52. package/dist/esm/input/ArcadeStickGamepadMapping.js.map +1 -1
  53. package/dist/esm/input/GameCubeGamepadMapping.js +1 -4
  54. package/dist/esm/input/GameCubeGamepadMapping.js.map +1 -1
  55. package/dist/esm/input/Gamepad.d.ts +1 -1
  56. package/dist/esm/input/Gamepad.js +19 -15
  57. package/dist/esm/input/Gamepad.js.map +1 -1
  58. package/dist/esm/input/GamepadChannels.js +2 -0
  59. package/dist/esm/input/GamepadChannels.js.map +1 -1
  60. package/dist/esm/input/GamepadControl.js +5 -0
  61. package/dist/esm/input/GamepadControl.js.map +1 -1
  62. package/dist/esm/input/GamepadMapping.js +2 -0
  63. package/dist/esm/input/GamepadMapping.js.map +1 -1
  64. package/dist/esm/input/GamepadPromptLayouts.js +19 -19
  65. package/dist/esm/input/GamepadPromptLayouts.js.map +1 -1
  66. package/dist/esm/input/GenericDualAnalogGamepadMapping.js +1 -1
  67. package/dist/esm/input/GenericDualAnalogGamepadMapping.js.map +1 -1
  68. package/dist/esm/input/Input.d.ts +2 -2
  69. package/dist/esm/input/Input.js +8 -7
  70. package/dist/esm/input/Input.js.map +1 -1
  71. package/dist/esm/input/InputManager.d.ts +3 -3
  72. package/dist/esm/input/InputManager.js +43 -39
  73. package/dist/esm/input/InputManager.js.map +1 -1
  74. package/dist/esm/input/JoyConLeftGamepadMapping.js +1 -4
  75. package/dist/esm/input/JoyConLeftGamepadMapping.js.map +1 -1
  76. package/dist/esm/input/JoyConRightGamepadMapping.js +1 -4
  77. package/dist/esm/input/JoyConRightGamepadMapping.js.map +1 -1
  78. package/dist/esm/input/PlayStationGamepadMapping.js +1 -4
  79. package/dist/esm/input/PlayStationGamepadMapping.js.map +1 -1
  80. package/dist/esm/input/Pointer.d.ts +3 -3
  81. package/dist/esm/input/Pointer.js +12 -3
  82. package/dist/esm/input/Pointer.js.map +1 -1
  83. package/dist/esm/input/SteamControllerGamepadMapping.js +1 -4
  84. package/dist/esm/input/SteamControllerGamepadMapping.js.map +1 -1
  85. package/dist/esm/input/SwitchProGamepadMapping.js +1 -4
  86. package/dist/esm/input/SwitchProGamepadMapping.js.map +1 -1
  87. package/dist/esm/input/XboxGamepadMapping.js +1 -4
  88. package/dist/esm/input/XboxGamepadMapping.js.map +1 -1
  89. package/dist/esm/input/types.js +7 -1
  90. package/dist/esm/input/types.js.map +1 -1
  91. package/dist/esm/math/AbstractVector.d.ts +1 -1
  92. package/dist/esm/math/Circle.d.ts +6 -6
  93. package/dist/esm/math/Circle.js +17 -14
  94. package/dist/esm/math/Circle.js.map +1 -1
  95. package/dist/esm/math/Collision.d.ts +2 -2
  96. package/dist/esm/math/Collision.js +13 -0
  97. package/dist/esm/math/Collision.js.map +1 -0
  98. package/dist/esm/math/Ellipse.d.ts +6 -6
  99. package/dist/esm/math/Ellipse.js +11 -8
  100. package/dist/esm/math/Ellipse.js.map +1 -1
  101. package/dist/esm/math/Flags.d.ts +1 -1
  102. package/dist/esm/math/Flags.js +1 -1
  103. package/dist/esm/math/Flags.js.map +1 -1
  104. package/dist/esm/math/Interval.d.ts +1 -1
  105. package/dist/esm/math/Interval.js +3 -1
  106. package/dist/esm/math/Interval.js.map +1 -1
  107. package/dist/esm/math/Line.d.ts +6 -6
  108. package/dist/esm/math/Line.js +11 -8
  109. package/dist/esm/math/Line.js.map +1 -1
  110. package/dist/esm/math/Matrix.d.ts +1 -1
  111. package/dist/esm/math/Matrix.js +11 -2
  112. package/dist/esm/math/Matrix.js.map +1 -1
  113. package/dist/esm/math/ObservableSize.js +1 -0
  114. package/dist/esm/math/ObservableSize.js.map +1 -1
  115. package/dist/esm/math/ObservableVector.d.ts +1 -1
  116. package/dist/esm/math/ObservableVector.js +3 -0
  117. package/dist/esm/math/ObservableVector.js.map +1 -1
  118. package/dist/esm/math/PolarVector.d.ts +1 -1
  119. package/dist/esm/math/PolarVector.js +2 -0
  120. package/dist/esm/math/PolarVector.js.map +1 -1
  121. package/dist/esm/math/Polygon.d.ts +6 -6
  122. package/dist/esm/math/Polygon.js +17 -15
  123. package/dist/esm/math/Polygon.js.map +1 -1
  124. package/dist/esm/math/PolygonLike.d.ts +1 -1
  125. package/dist/esm/math/Random.js +4 -4
  126. package/dist/esm/math/Random.js.map +1 -1
  127. package/dist/esm/math/Rectangle.d.ts +7 -7
  128. package/dist/esm/math/Rectangle.js +17 -14
  129. package/dist/esm/math/Rectangle.js.map +1 -1
  130. package/dist/esm/math/Segment.d.ts +2 -2
  131. package/dist/esm/math/Segment.js +2 -0
  132. package/dist/esm/math/Segment.js.map +1 -1
  133. package/dist/esm/math/ShapeLike.d.ts +2 -2
  134. package/dist/esm/math/Size.d.ts +1 -1
  135. package/dist/esm/math/Size.js +3 -1
  136. package/dist/esm/math/Size.js.map +1 -1
  137. package/dist/esm/math/Transformable.js +9 -11
  138. package/dist/esm/math/Transformable.js.map +1 -1
  139. package/dist/esm/math/Vector.d.ts +5 -5
  140. package/dist/esm/math/Vector.js +13 -10
  141. package/dist/esm/math/Vector.js.map +1 -1
  142. package/dist/esm/math/collision-detection.d.ts +7 -7
  143. package/dist/esm/math/collision-detection.js +9 -9
  144. package/dist/esm/math/collision-detection.js.map +1 -1
  145. package/dist/esm/math/collision-primitives.d.ts +2 -2
  146. package/dist/esm/math/collision-primitives.js +4 -4
  147. package/dist/esm/math/collision-primitives.js.map +1 -1
  148. package/dist/esm/math/geometry.d.ts +1 -1
  149. package/dist/esm/math/utils.d.ts +1 -1
  150. package/dist/esm/math/utils.js +17 -11
  151. package/dist/esm/math/utils.js.map +1 -1
  152. package/dist/esm/particles/Particle.d.ts +4 -4
  153. package/dist/esm/particles/Particle.js +9 -11
  154. package/dist/esm/particles/Particle.js.map +1 -1
  155. package/dist/esm/particles/ParticleProperties.d.ts +3 -3
  156. package/dist/esm/particles/ParticleSystem.d.ts +6 -6
  157. package/dist/esm/particles/ParticleSystem.js +10 -9
  158. package/dist/esm/particles/ParticleSystem.js.map +1 -1
  159. package/dist/esm/particles/affectors/ColorAffector.d.ts +4 -4
  160. package/dist/esm/particles/affectors/ColorAffector.js +2 -0
  161. package/dist/esm/particles/affectors/ColorAffector.js.map +1 -1
  162. package/dist/esm/particles/affectors/ForceAffector.d.ts +4 -4
  163. package/dist/esm/particles/affectors/ForceAffector.js +1 -0
  164. package/dist/esm/particles/affectors/ForceAffector.js.map +1 -1
  165. package/dist/esm/particles/affectors/ParticleAffector.d.ts +2 -2
  166. package/dist/esm/particles/affectors/ScaleAffector.d.ts +4 -4
  167. package/dist/esm/particles/affectors/ScaleAffector.js +1 -0
  168. package/dist/esm/particles/affectors/ScaleAffector.js.map +1 -1
  169. package/dist/esm/particles/affectors/TorqueAffector.d.ts +3 -3
  170. package/dist/esm/particles/affectors/TorqueAffector.js +1 -0
  171. package/dist/esm/particles/affectors/TorqueAffector.js.map +1 -1
  172. package/dist/esm/particles/emitters/ParticleEmitter.d.ts +2 -2
  173. package/dist/esm/particles/emitters/ParticleOptions.d.ts +4 -4
  174. package/dist/esm/particles/emitters/ParticleOptions.js +9 -0
  175. package/dist/esm/particles/emitters/ParticleOptions.js.map +1 -1
  176. package/dist/esm/particles/emitters/UniversalEmitter.d.ts +4 -4
  177. package/dist/esm/particles/emitters/UniversalEmitter.js +3 -1
  178. package/dist/esm/particles/emitters/UniversalEmitter.js.map +1 -1
  179. package/dist/esm/physics/RapierPhysicsWorld.d.ts +4 -4
  180. package/dist/esm/physics/RapierPhysicsWorld.js +19 -8
  181. package/dist/esm/physics/RapierPhysicsWorld.js.map +1 -1
  182. package/dist/esm/rendering/CallbackRenderPass.js +1 -0
  183. package/dist/esm/rendering/CallbackRenderPass.js.map +1 -1
  184. package/dist/esm/rendering/Container.d.ts +1 -1
  185. package/dist/esm/rendering/Container.js +4 -7
  186. package/dist/esm/rendering/Container.js.map +1 -1
  187. package/dist/esm/rendering/Drawable.d.ts +2 -2
  188. package/dist/esm/rendering/Drawable.js +2 -5
  189. package/dist/esm/rendering/Drawable.js.map +1 -1
  190. package/dist/esm/rendering/RenderNode.d.ts +6 -6
  191. package/dist/esm/rendering/RenderNode.js +9 -12
  192. package/dist/esm/rendering/RenderNode.js.map +1 -1
  193. package/dist/esm/rendering/RenderTarget.d.ts +3 -3
  194. package/dist/esm/rendering/RenderTarget.js +7 -3
  195. package/dist/esm/rendering/RenderTarget.js.map +1 -1
  196. package/dist/esm/rendering/RenderTargetPass.d.ts +1 -1
  197. package/dist/esm/rendering/RenderTargetPass.js +4 -0
  198. package/dist/esm/rendering/RenderTargetPass.js.map +1 -1
  199. package/dist/esm/rendering/RendererRegistry.js +2 -4
  200. package/dist/esm/rendering/RendererRegistry.js.map +1 -1
  201. package/dist/esm/rendering/SceneRenderRuntime.d.ts +2 -2
  202. package/dist/esm/rendering/View.d.ts +4 -4
  203. package/dist/esm/rendering/View.js +28 -24
  204. package/dist/esm/rendering/View.js.map +1 -1
  205. package/dist/esm/rendering/filters/BlurFilter.d.ts +2 -2
  206. package/dist/esm/rendering/filters/BlurFilter.js +4 -4
  207. package/dist/esm/rendering/filters/BlurFilter.js.map +1 -1
  208. package/dist/esm/rendering/filters/ColorFilter.d.ts +3 -3
  209. package/dist/esm/rendering/filters/ColorFilter.js +2 -1
  210. package/dist/esm/rendering/filters/ColorFilter.js.map +1 -1
  211. package/dist/esm/rendering/filters/Filter.d.ts +2 -2
  212. package/dist/esm/rendering/primitives/DrawableShape.d.ts +4 -4
  213. package/dist/esm/rendering/primitives/DrawableShape.js +3 -0
  214. package/dist/esm/rendering/primitives/DrawableShape.js.map +1 -1
  215. package/dist/esm/rendering/primitives/Geometry.js +3 -0
  216. package/dist/esm/rendering/primitives/Geometry.js.map +1 -1
  217. package/dist/esm/rendering/primitives/Graphics.d.ts +4 -4
  218. package/dist/esm/rendering/primitives/Graphics.js +4 -7
  219. package/dist/esm/rendering/primitives/Graphics.js.map +1 -1
  220. package/dist/esm/rendering/shader/Shader.js +5 -3
  221. package/dist/esm/rendering/shader/Shader.js.map +1 -1
  222. package/dist/esm/rendering/shader/ShaderAttribute.js +5 -1
  223. package/dist/esm/rendering/shader/ShaderAttribute.js.map +1 -1
  224. package/dist/esm/rendering/shader/ShaderUniform.d.ts +1 -1
  225. package/dist/esm/rendering/shader/ShaderUniform.js +6 -1
  226. package/dist/esm/rendering/shader/ShaderUniform.js.map +1 -1
  227. package/dist/esm/rendering/sprite/AnimatedSprite.d.ts +5 -5
  228. package/dist/esm/rendering/sprite/AnimatedSprite.js +8 -8
  229. package/dist/esm/rendering/sprite/AnimatedSprite.js.map +1 -1
  230. package/dist/esm/rendering/sprite/Sprite.d.ts +6 -6
  231. package/dist/esm/rendering/sprite/Sprite.js +4 -4
  232. package/dist/esm/rendering/sprite/Sprite.js.map +1 -1
  233. package/dist/esm/rendering/sprite/Spritesheet.d.ts +1 -1
  234. package/dist/esm/rendering/sprite/Spritesheet.js +4 -3
  235. package/dist/esm/rendering/sprite/Spritesheet.js.map +1 -1
  236. package/dist/esm/rendering/text/Text.d.ts +2 -2
  237. package/dist/esm/rendering/text/Text.js +5 -1
  238. package/dist/esm/rendering/text/Text.js.map +1 -1
  239. package/dist/esm/rendering/text/TextStyle.js +14 -1
  240. package/dist/esm/rendering/text/TextStyle.js.map +1 -1
  241. package/dist/esm/rendering/texture/RenderTexture.d.ts +3 -3
  242. package/dist/esm/rendering/texture/RenderTexture.js +14 -9
  243. package/dist/esm/rendering/texture/RenderTexture.js.map +1 -1
  244. package/dist/esm/rendering/texture/Sampler.d.ts +1 -1
  245. package/dist/esm/rendering/texture/Sampler.js +7 -0
  246. package/dist/esm/rendering/texture/Sampler.js.map +1 -1
  247. package/dist/esm/rendering/texture/Texture.d.ts +3 -3
  248. package/dist/esm/rendering/texture/Texture.js +19 -17
  249. package/dist/esm/rendering/texture/Texture.js.map +1 -1
  250. package/dist/esm/rendering/video/Video.d.ts +3 -3
  251. package/dist/esm/rendering/video/Video.js +15 -10
  252. package/dist/esm/rendering/video/Video.js.map +1 -1
  253. package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.d.ts +1 -1
  254. package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.js +16 -9
  255. package/dist/esm/rendering/webgl2/AbstractWebGl2BatchedRenderer.js.map +1 -1
  256. package/dist/esm/rendering/webgl2/AbstractWebGl2Renderer.js +2 -4
  257. package/dist/esm/rendering/webgl2/AbstractWebGl2Renderer.js.map +1 -1
  258. package/dist/esm/rendering/webgl2/WebGl2ParticleRenderer.d.ts +1 -1
  259. package/dist/esm/rendering/webgl2/WebGl2PrimitiveRenderer.js +11 -5
  260. package/dist/esm/rendering/webgl2/WebGl2PrimitiveRenderer.js.map +1 -1
  261. package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.d.ts +2 -2
  262. package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.js +5 -3
  263. package/dist/esm/rendering/webgl2/WebGl2RenderBuffer.js.map +1 -1
  264. package/dist/esm/rendering/webgl2/WebGl2RenderManager.d.ts +4 -4
  265. package/dist/esm/rendering/webgl2/WebGl2RenderManager.js +28 -20
  266. package/dist/esm/rendering/webgl2/WebGl2RenderManager.js.map +1 -1
  267. package/dist/esm/rendering/webgl2/WebGl2RendererRuntime.d.ts +1 -1
  268. package/dist/esm/rendering/webgl2/WebGl2ShaderBlock.js +9 -1
  269. package/dist/esm/rendering/webgl2/WebGl2ShaderBlock.js.map +1 -1
  270. package/dist/esm/rendering/webgl2/WebGl2VertexArrayObject.d.ts +1 -1
  271. package/dist/esm/rendering/webgl2/WebGl2VertexArrayObject.js +5 -4
  272. package/dist/esm/rendering/webgl2/WebGl2VertexArrayObject.js.map +1 -1
  273. package/dist/esm/rendering/webgpu/AbstractWebGpuRenderer.js +2 -4
  274. package/dist/esm/rendering/webgpu/AbstractWebGpuRenderer.js.map +1 -1
  275. package/dist/esm/rendering/webgpu/WebGpuBlendState.d.ts +1 -1
  276. package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.d.ts +3 -3
  277. package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.js +19 -22
  278. package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.js.map +1 -1
  279. package/dist/esm/rendering/webgpu/WebGpuPrimitiveRenderer.d.ts +3 -3
  280. package/dist/esm/rendering/webgpu/WebGpuPrimitiveRenderer.js +18 -21
  281. package/dist/esm/rendering/webgpu/WebGpuPrimitiveRenderer.js.map +1 -1
  282. package/dist/esm/rendering/webgpu/WebGpuRenderManager.d.ts +4 -4
  283. package/dist/esm/rendering/webgpu/WebGpuRenderManager.js +29 -26
  284. package/dist/esm/rendering/webgpu/WebGpuRenderManager.js.map +1 -1
  285. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.d.ts +3 -3
  286. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.js +133 -136
  287. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.js.map +1 -1
  288. package/dist/esm/resources/AbstractAssetFactory.js +1 -3
  289. package/dist/esm/resources/AbstractAssetFactory.js.map +1 -1
  290. package/dist/esm/resources/AssetManifest.js +2 -0
  291. package/dist/esm/resources/AssetManifest.js.map +1 -1
  292. package/dist/esm/resources/FactoryRegistry.js +1 -3
  293. package/dist/esm/resources/FactoryRegistry.js.map +1 -1
  294. package/dist/esm/resources/IndexedDbDatabase.d.ts +1 -1
  295. package/dist/esm/resources/IndexedDbDatabase.js +7 -3
  296. package/dist/esm/resources/IndexedDbDatabase.js.map +1 -1
  297. package/dist/esm/resources/IndexedDbStore.js +1 -0
  298. package/dist/esm/resources/IndexedDbStore.js.map +1 -1
  299. package/dist/esm/resources/Loader.d.ts +1 -1
  300. package/dist/esm/resources/Loader.js +21 -17
  301. package/dist/esm/resources/Loader.js.map +1 -1
  302. package/dist/esm/resources/factories/BinaryFactory.d.ts +1 -1
  303. package/dist/esm/resources/factories/BinaryFactory.js +1 -4
  304. package/dist/esm/resources/factories/BinaryFactory.js.map +1 -1
  305. package/dist/esm/resources/factories/FontFactory.d.ts +1 -1
  306. package/dist/esm/resources/factories/FontFactory.js +2 -5
  307. package/dist/esm/resources/factories/FontFactory.js.map +1 -1
  308. package/dist/esm/resources/factories/ImageFactory.d.ts +1 -1
  309. package/dist/esm/resources/factories/ImageFactory.js +1 -4
  310. package/dist/esm/resources/factories/ImageFactory.js.map +1 -1
  311. package/dist/esm/resources/factories/JsonFactory.d.ts +1 -1
  312. package/dist/esm/resources/factories/JsonFactory.js +1 -4
  313. package/dist/esm/resources/factories/JsonFactory.js.map +1 -1
  314. package/dist/esm/resources/factories/MusicFactory.d.ts +3 -3
  315. package/dist/esm/resources/factories/MusicFactory.js +2 -5
  316. package/dist/esm/resources/factories/MusicFactory.js.map +1 -1
  317. package/dist/esm/resources/factories/SoundFactory.d.ts +3 -3
  318. package/dist/esm/resources/factories/SoundFactory.js +1 -4
  319. package/dist/esm/resources/factories/SoundFactory.js.map +1 -1
  320. package/dist/esm/resources/factories/SvgFactory.d.ts +1 -1
  321. package/dist/esm/resources/factories/SvgFactory.js +1 -4
  322. package/dist/esm/resources/factories/SvgFactory.js.map +1 -1
  323. package/dist/esm/resources/factories/TextFactory.d.ts +1 -1
  324. package/dist/esm/resources/factories/TextFactory.js +1 -4
  325. package/dist/esm/resources/factories/TextFactory.js.map +1 -1
  326. package/dist/esm/resources/factories/TextureFactory.d.ts +3 -3
  327. package/dist/esm/resources/factories/TextureFactory.js +1 -4
  328. package/dist/esm/resources/factories/TextureFactory.js.map +1 -1
  329. package/dist/esm/resources/factories/VideoFactory.d.ts +4 -4
  330. package/dist/esm/resources/factories/VideoFactory.js +2 -5
  331. package/dist/esm/resources/factories/VideoFactory.js.map +1 -1
  332. package/dist/esm/resources/factories/VttFactory.d.ts +1 -1
  333. package/dist/esm/resources/factories/VttFactory.js +1 -4
  334. package/dist/esm/resources/factories/VttFactory.js.map +1 -1
  335. package/dist/esm/resources/factories/WasmFactory.d.ts +1 -1
  336. package/dist/esm/resources/factories/WasmFactory.js +1 -4
  337. package/dist/esm/resources/factories/WasmFactory.js.map +1 -1
  338. package/dist/esm/resources/utils.js +5 -5
  339. package/dist/esm/resources/utils.js.map +1 -1
  340. package/dist/exo.esm.js +1737 -1641
  341. package/dist/exo.esm.js.map +1 -1
  342. package/dist/exo.esm.min.js +1 -1
  343. package/dist/exo.esm.min.js.map +1 -1
  344. package/dist/exo.global.js +1737 -1641
  345. package/dist/exo.global.js.map +1 -1
  346. package/dist/exo.global.min.js +1 -1
  347. package/dist/exo.global.min.js.map +1 -1
  348. package/package.json +96 -98
  349. package/dist/exo.d.ts +0 -4755
package/dist/exo.esm.js CHANGED
@@ -1,5 +1,7 @@
1
1
  let temp$9 = null;
2
2
  class Size {
3
+ _width;
4
+ _height;
3
5
  constructor(width = 0, height = 0) {
4
6
  this._width = width;
5
7
  this._height = height;
@@ -56,6 +58,7 @@ class Size {
56
58
  destroy() {
57
59
  // todo - check if destroy is needed
58
60
  }
61
+ static zero = new Size(0, 0);
59
62
  static get temp() {
60
63
  if (temp$9 === null) {
61
64
  temp$9 = new Size();
@@ -63,15 +66,14 @@ class Size {
63
66
  return temp$9;
64
67
  }
65
68
  }
66
- Size.zero = new Size(0, 0);
67
69
 
68
70
  const limit = (2 ** 32) - 1;
69
71
  class Random {
72
+ _state = new Uint32Array(624);
73
+ _iteration = 0;
74
+ _seed = 0;
75
+ _value = 0;
70
76
  constructor(seed = Date.now()) {
71
- this._state = new Uint32Array(624);
72
- this._iteration = 0;
73
- this._seed = 0;
74
- this._value = 0;
75
77
  this.setSeed(seed);
76
78
  this._twist();
77
79
  }
@@ -137,6 +139,7 @@ class Random {
137
139
 
138
140
  let temp$8 = null;
139
141
  class Time {
142
+ _milliseconds;
140
143
  constructor(time = 0, factor = Time.milliseconds) {
141
144
  this._milliseconds = time * factor;
142
145
  }
@@ -222,6 +225,15 @@ class Time {
222
225
  destroy() {
223
226
  // todo - check if destroy is needed
224
227
  }
228
+ static milliseconds = 1;
229
+ static seconds = 1000;
230
+ static minutes = 60000;
231
+ static hours = 3600000;
232
+ static zero = new Time(0);
233
+ static oneMillisecond = new Time(1);
234
+ static oneSecond = new Time(1, Time.seconds);
235
+ static oneMinute = new Time(1, Time.minutes);
236
+ static oneHour = new Time(1, Time.hours);
225
237
  static get temp() {
226
238
  if (temp$8 === null) {
227
239
  temp$8 = new Time();
@@ -229,15 +241,6 @@ class Time {
229
241
  return temp$8;
230
242
  }
231
243
  }
232
- Time.milliseconds = 1;
233
- Time.seconds = 1000;
234
- Time.minutes = 60000;
235
- Time.hours = 3600000;
236
- Time.zero = new Time(0);
237
- Time.oneMillisecond = new Time(1);
238
- Time.oneSecond = new Time(1, Time.seconds);
239
- Time.oneMinute = new Time(1, Time.minutes);
240
- Time.oneHour = new Time(1, Time.hours);
241
244
 
242
245
  const codecNotSupportedPattern = /^no$/;
243
246
  let internalAudioElement = null;
@@ -370,9 +373,10 @@ const canvasSourceToDataUrl = (source) => {
370
373
  };
371
374
 
372
375
  class Clock {
376
+ _startTime;
377
+ _elapsedTime = new Time(0);
378
+ _running = false;
373
379
  constructor(startTime = Time.zero, autoStart = false) {
374
- this._elapsedTime = new Time(0);
375
- this._running = false;
376
380
  this._startTime = startTime.clone();
377
381
  if (autoStart) {
378
382
  this.start();
@@ -432,9 +436,7 @@ class Clock {
432
436
  }
433
437
 
434
438
  class Signal {
435
- constructor() {
436
- this._bindings = new Array();
437
- }
439
+ _bindings = new Array();
438
440
  get bindings() {
439
441
  return this._bindings;
440
442
  }
@@ -475,7 +477,11 @@ class Signal {
475
477
  }
476
478
  dispatch(...params) {
477
479
  if (this._bindings.length) {
478
- for (const binding of this._bindings) {
480
+ // Snapshot bindings because handlers may mutate the array mid-dispatch
481
+ // (notably `once()` wrappers that remove themselves), which would otherwise
482
+ // cause the iterator to skip the binding shifted into the vacated slot.
483
+ const bindings = this._bindings.slice();
484
+ for (const binding of bindings) {
479
485
  if (binding.handler.call(binding.context, ...params) === false) {
480
486
  break;
481
487
  }
@@ -491,6 +497,12 @@ class Signal {
491
497
  const tau = Math.PI * 2;
492
498
  const radiansPerDegree = Math.PI / 180;
493
499
  const degreesPerRadian = 180 / Math.PI;
500
+ var VoronoiRegion;
501
+ (function (VoronoiRegion) {
502
+ VoronoiRegion[VoronoiRegion["left"] = -1] = "left";
503
+ VoronoiRegion[VoronoiRegion["middle"] = 0] = "middle";
504
+ VoronoiRegion[VoronoiRegion["right"] = 1] = "right";
505
+ })(VoronoiRegion || (VoronoiRegion = {}));
494
506
  const trimRotation = (degrees) => {
495
507
  const rotation = degrees % 360;
496
508
  return rotation < 0 ? rotation + 360 : rotation;
@@ -498,7 +510,7 @@ const trimRotation = (degrees) => {
498
510
  const degreesToRadians = (degree) => degree * radiansPerDegree;
499
511
  const radiansToDegrees = (radian) => radian * degreesPerRadian;
500
512
  const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
501
- const sign = (value) => (value && (value < 0 ? -1 : 1));
513
+ const sign$1 = (value) => (value && (value < 0 ? -1 : 1));
502
514
  const lerp = (startValue, endValue, ratio) => (((1 - ratio) * startValue) + (ratio * endValue));
503
515
  const isPowerOfTwo = (value) => ((value !== 0) && ((value & (value - 1)) === 0));
504
516
  const inRange = (value, min, max) => (value >= Math.min(min, max) && value <= Math.max(min, max));
@@ -509,13 +521,13 @@ const getDistance = (x1, y1, x2, y2) => {
509
521
  };
510
522
  const bezierCurveTo = (fromX, fromY, cpX1, cpY1, cpX2, cpY2, toX, toY, path = [], len = 20) => {
511
523
  path.push(fromX, fromY);
512
- for (let i = 1, j = 0, dt1 = 0, dt2 = 0, dt3 = 0, t2 = 0, t3 = 0; i <= len; i++) {
513
- j = i / len;
514
- dt1 = (1 - j);
515
- dt2 = dt1 * dt1;
516
- dt3 = dt2 * dt1;
517
- t2 = j * j;
518
- t3 = t2 * j;
524
+ for (let i = 1; i <= len; i++) {
525
+ const j = i / len;
526
+ const dt1 = (1 - j);
527
+ const dt2 = dt1 * dt1;
528
+ const dt3 = dt2 * dt1;
529
+ const t2 = j * j;
530
+ const t3 = t2 * j;
519
531
  path.push((dt3 * fromX) + (3 * dt2 * j * cpX1) + (3 * dt1 * t2 * cpX2) + (t3 * toX), (dt3 * fromY) + (3 * dt2 * j * cpY1) + (3 * dt1 * t2 * cpY2) + (t3 * toY));
520
532
  }
521
533
  return path;
@@ -530,20 +542,24 @@ const quadraticCurveTo = (fromX, fromY, cpX, cpY, toX, toY, path = [], len = 20)
530
542
  const getVoronoiRegion$1 = (line, point) => {
531
543
  const product = point.dot(line.x, line.y);
532
544
  if (product < 0) {
533
- return -1 /* VoronoiRegion.left */;
545
+ return VoronoiRegion.left;
534
546
  }
535
547
  else if (product > line.lengthSq) {
536
- return 1 /* VoronoiRegion.right */;
548
+ return VoronoiRegion.right;
537
549
  }
538
550
  else {
539
- return 0 /* VoronoiRegion.middle */;
551
+ return VoronoiRegion.middle;
540
552
  }
541
553
  };
542
554
 
543
555
  class Color {
556
+ _r;
557
+ _g;
558
+ _b;
559
+ _a;
560
+ _rgba = null;
561
+ _array = null;
544
562
  constructor(r = 0, g = 0, b = 0, a = 1) {
545
- this._rgba = null;
546
- this._array = null;
547
563
  this._r = r & 255;
548
564
  this._g = g & 255;
549
565
  this._b = b & 255;
@@ -653,149 +669,149 @@ class Color {
653
669
  this._array = null;
654
670
  }
655
671
  }
672
+ static aliceBlue = new Color(240, 248, 255, 1);
673
+ static antiqueWhite = new Color(250, 235, 215, 1);
674
+ static aqua = new Color(0, 255, 255, 1);
675
+ static aquamarine = new Color(127, 255, 212, 1);
676
+ static azure = new Color(240, 255, 255, 1);
677
+ static beige = new Color(245, 245, 220, 1);
678
+ static bisque = new Color(255, 228, 196, 1);
679
+ static black = new Color(0, 0, 0, 1);
680
+ static blanchedAlmond = new Color(255, 235, 205, 1);
681
+ static blue = new Color(0, 0, 255, 1);
682
+ static blueViolet = new Color(138, 43, 226, 1);
683
+ static brown = new Color(165, 42, 42, 1);
684
+ static burlyWood = new Color(222, 184, 135, 1);
685
+ static cadetBlue = new Color(95, 158, 160, 1);
686
+ static chartreuse = new Color(127, 255, 0, 1);
687
+ static chocolate = new Color(210, 105, 30, 1);
688
+ static coral = new Color(255, 127, 80, 1);
689
+ static cornflowerBlue = new Color(100, 149, 237, 1);
690
+ static cornsilk = new Color(255, 248, 220, 1);
691
+ static crimson = new Color(220, 20, 60, 1);
692
+ static cyan = new Color(0, 255, 255, 1);
693
+ static darkBlue = new Color(0, 0, 139, 1);
694
+ static darkCyan = new Color(0, 139, 139, 1);
695
+ static darkGoldenrod = new Color(184, 134, 11, 1);
696
+ static darkGray = new Color(169, 169, 169, 1);
697
+ static darkGreen = new Color(0, 100, 0, 1);
698
+ static darkKhaki = new Color(189, 183, 107, 1);
699
+ static darkMagenta = new Color(139, 0, 139, 1);
700
+ static darkOliveGreen = new Color(85, 107, 47, 1);
701
+ static darkOrange = new Color(255, 140, 0, 1);
702
+ static darkOrchid = new Color(153, 50, 204, 1);
703
+ static darkRed = new Color(139, 0, 0, 1);
704
+ static darkSalmon = new Color(233, 150, 122, 1);
705
+ static darkSeaGreen = new Color(143, 188, 139, 1);
706
+ static darkSlateBlue = new Color(72, 61, 139, 1);
707
+ static darkSlateGray = new Color(47, 79, 79, 1);
708
+ static darkTurquoise = new Color(0, 206, 209, 1);
709
+ static darkViolet = new Color(148, 0, 211, 1);
710
+ static deepPink = new Color(255, 20, 147, 1);
711
+ static deepSkyBlue = new Color(0, 191, 255, 1);
712
+ static dimGray = new Color(105, 105, 105, 1);
713
+ static dodgerBlue = new Color(30, 144, 255, 1);
714
+ static firebrick = new Color(178, 34, 34, 1);
715
+ static floralWhite = new Color(255, 250, 240, 1);
716
+ static forestGreen = new Color(34, 139, 34, 1);
717
+ static fuchsia = new Color(255, 0, 255, 1);
718
+ static gainsboro = new Color(220, 220, 220, 1);
719
+ static ghostWhite = new Color(248, 248, 255, 1);
720
+ static gold = new Color(255, 215, 0, 1);
721
+ static goldenrod = new Color(218, 165, 32, 1);
722
+ static gray = new Color(128, 128, 128, 1);
723
+ static green = new Color(0, 128, 0, 1);
724
+ static greenYellow = new Color(173, 255, 47, 1);
725
+ static honeydew = new Color(240, 255, 240, 1);
726
+ static hotPink = new Color(255, 105, 180, 1);
727
+ static indianRed = new Color(205, 92, 92, 1);
728
+ static indigo = new Color(75, 0, 130, 1);
729
+ static ivory = new Color(255, 255, 240, 1);
730
+ static khaki = new Color(240, 230, 140, 1);
731
+ static lavender = new Color(230, 230, 250, 1);
732
+ static lavenderBlush = new Color(255, 240, 245, 1);
733
+ static lawnGreen = new Color(124, 252, 0, 1);
734
+ static lemonChiffon = new Color(255, 250, 205, 1);
735
+ static lightBlue = new Color(173, 216, 230, 1);
736
+ static lightCoral = new Color(240, 128, 128, 1);
737
+ static lightCyan = new Color(224, 255, 255, 1);
738
+ static lightGoldenrodYellow = new Color(250, 250, 210, 1);
739
+ static lightGray = new Color(211, 211, 211, 1);
740
+ static lightGreen = new Color(144, 238, 144, 1);
741
+ static lightPink = new Color(255, 182, 193, 1);
742
+ static lightSalmon = new Color(255, 160, 122, 1);
743
+ static lightSeaGreen = new Color(32, 178, 170, 1);
744
+ static lightSkyBlue = new Color(135, 206, 250, 1);
745
+ static lightSlateGray = new Color(119, 136, 153, 1);
746
+ static lightSteelBlue = new Color(176, 196, 222, 1);
747
+ static lightYellow = new Color(255, 255, 224, 1);
748
+ static lime = new Color(0, 255, 0, 1);
749
+ static limeGreen = new Color(50, 205, 50, 1);
750
+ static linen = new Color(250, 240, 230, 1);
751
+ static magenta = new Color(255, 0, 255, 1);
752
+ static maroon = new Color(128, 0, 0, 1);
753
+ static mediumAquamarine = new Color(102, 205, 170, 1);
754
+ static mediumBlue = new Color(0, 0, 205, 1);
755
+ static mediumOrchid = new Color(186, 85, 211, 1);
756
+ static mediumPurple = new Color(147, 112, 219, 1);
757
+ static mediumSeaGreen = new Color(60, 179, 113, 1);
758
+ static mediumSlateBlue = new Color(123, 104, 238, 1);
759
+ static mediumSpringGreen = new Color(0, 250, 154, 1);
760
+ static mediumTurquoise = new Color(72, 209, 204, 1);
761
+ static mediumVioletRed = new Color(199, 21, 133, 1);
762
+ static midnightBlue = new Color(25, 25, 112, 1);
763
+ static mintCream = new Color(245, 255, 250, 1);
764
+ static mistyRose = new Color(255, 228, 225, 1);
765
+ static moccasin = new Color(255, 228, 181, 1);
766
+ static navajoWhite = new Color(255, 222, 173, 1);
767
+ static navy = new Color(0, 0, 128, 1);
768
+ static oldLace = new Color(253, 245, 230, 1);
769
+ static olive = new Color(128, 128, 0, 1);
770
+ static oliveDrab = new Color(107, 142, 35, 1);
771
+ static orange = new Color(255, 165, 0, 1);
772
+ static orangeRed = new Color(255, 69, 0, 1);
773
+ static orchid = new Color(218, 112, 214, 1);
774
+ static paleGoldenrod = new Color(238, 232, 170, 1);
775
+ static paleGreen = new Color(152, 251, 152, 1);
776
+ static paleTurquoise = new Color(175, 238, 238, 1);
777
+ static paleVioletRed = new Color(219, 112, 147, 1);
778
+ static papayaWhip = new Color(255, 239, 213, 1);
779
+ static peachPuff = new Color(255, 218, 185, 1);
780
+ static peru = new Color(205, 133, 63, 1);
781
+ static pink = new Color(255, 192, 203, 1);
782
+ static plum = new Color(221, 160, 221, 1);
783
+ static powderBlue = new Color(176, 224, 230, 1);
784
+ static purple = new Color(128, 0, 128, 1);
785
+ static red = new Color(255, 0, 0, 1);
786
+ static rosyBrown = new Color(188, 143, 143, 1);
787
+ static royalBlue = new Color(65, 105, 225, 1);
788
+ static saddleBrown = new Color(139, 69, 19, 1);
789
+ static salmon = new Color(250, 128, 114, 1);
790
+ static sandyBrown = new Color(244, 164, 96, 1);
791
+ static seaGreen = new Color(46, 139, 87, 1);
792
+ static seaShell = new Color(255, 245, 238, 1);
793
+ static sienna = new Color(160, 82, 45, 1);
794
+ static silver = new Color(192, 192, 192, 1);
795
+ static skyBlue = new Color(135, 206, 235, 1);
796
+ static slateBlue = new Color(106, 90, 205, 1);
797
+ static slateGray = new Color(112, 128, 144, 1);
798
+ static snow = new Color(255, 250, 250, 1);
799
+ static springGreen = new Color(0, 255, 127, 1);
800
+ static steelBlue = new Color(70, 130, 180, 1);
801
+ static tan = new Color(210, 180, 140, 1);
802
+ static teal = new Color(0, 128, 128, 1);
803
+ static thistle = new Color(216, 191, 216, 1);
804
+ static tomato = new Color(255, 99, 71, 1);
805
+ static transparentBlack = new Color(0, 0, 0, 0);
806
+ static transparentWhite = new Color(255, 255, 255, 0);
807
+ static turquoise = new Color(64, 224, 208, 1);
808
+ static violet = new Color(238, 130, 238, 1);
809
+ static wheat = new Color(245, 222, 179, 1);
810
+ static white = new Color(255, 255, 255, 1);
811
+ static whiteSmoke = new Color(245, 245, 245, 1);
812
+ static yellow = new Color(255, 255, 0, 1);
813
+ static yellowGreen = new Color(154, 205, 50, 1);
656
814
  }
657
- Color.aliceBlue = new Color(240, 248, 255, 1);
658
- Color.antiqueWhite = new Color(250, 235, 215, 1);
659
- Color.aqua = new Color(0, 255, 255, 1);
660
- Color.aquamarine = new Color(127, 255, 212, 1);
661
- Color.azure = new Color(240, 255, 255, 1);
662
- Color.beige = new Color(245, 245, 220, 1);
663
- Color.bisque = new Color(255, 228, 196, 1);
664
- Color.black = new Color(0, 0, 0, 1);
665
- Color.blanchedAlmond = new Color(255, 235, 205, 1);
666
- Color.blue = new Color(0, 0, 255, 1);
667
- Color.blueViolet = new Color(138, 43, 226, 1);
668
- Color.brown = new Color(165, 42, 42, 1);
669
- Color.burlyWood = new Color(222, 184, 135, 1);
670
- Color.cadetBlue = new Color(95, 158, 160, 1);
671
- Color.chartreuse = new Color(127, 255, 0, 1);
672
- Color.chocolate = new Color(210, 105, 30, 1);
673
- Color.coral = new Color(255, 127, 80, 1);
674
- Color.cornflowerBlue = new Color(100, 149, 237, 1);
675
- Color.cornsilk = new Color(255, 248, 220, 1);
676
- Color.crimson = new Color(220, 20, 60, 1);
677
- Color.cyan = new Color(0, 255, 255, 1);
678
- Color.darkBlue = new Color(0, 0, 139, 1);
679
- Color.darkCyan = new Color(0, 139, 139, 1);
680
- Color.darkGoldenrod = new Color(184, 134, 11, 1);
681
- Color.darkGray = new Color(169, 169, 169, 1);
682
- Color.darkGreen = new Color(0, 100, 0, 1);
683
- Color.darkKhaki = new Color(189, 183, 107, 1);
684
- Color.darkMagenta = new Color(139, 0, 139, 1);
685
- Color.darkOliveGreen = new Color(85, 107, 47, 1);
686
- Color.darkOrange = new Color(255, 140, 0, 1);
687
- Color.darkOrchid = new Color(153, 50, 204, 1);
688
- Color.darkRed = new Color(139, 0, 0, 1);
689
- Color.darkSalmon = new Color(233, 150, 122, 1);
690
- Color.darkSeaGreen = new Color(143, 188, 139, 1);
691
- Color.darkSlateBlue = new Color(72, 61, 139, 1);
692
- Color.darkSlateGray = new Color(47, 79, 79, 1);
693
- Color.darkTurquoise = new Color(0, 206, 209, 1);
694
- Color.darkViolet = new Color(148, 0, 211, 1);
695
- Color.deepPink = new Color(255, 20, 147, 1);
696
- Color.deepSkyBlue = new Color(0, 191, 255, 1);
697
- Color.dimGray = new Color(105, 105, 105, 1);
698
- Color.dodgerBlue = new Color(30, 144, 255, 1);
699
- Color.firebrick = new Color(178, 34, 34, 1);
700
- Color.floralWhite = new Color(255, 250, 240, 1);
701
- Color.forestGreen = new Color(34, 139, 34, 1);
702
- Color.fuchsia = new Color(255, 0, 255, 1);
703
- Color.gainsboro = new Color(220, 220, 220, 1);
704
- Color.ghostWhite = new Color(248, 248, 255, 1);
705
- Color.gold = new Color(255, 215, 0, 1);
706
- Color.goldenrod = new Color(218, 165, 32, 1);
707
- Color.gray = new Color(128, 128, 128, 1);
708
- Color.green = new Color(0, 128, 0, 1);
709
- Color.greenYellow = new Color(173, 255, 47, 1);
710
- Color.honeydew = new Color(240, 255, 240, 1);
711
- Color.hotPink = new Color(255, 105, 180, 1);
712
- Color.indianRed = new Color(205, 92, 92, 1);
713
- Color.indigo = new Color(75, 0, 130, 1);
714
- Color.ivory = new Color(255, 255, 240, 1);
715
- Color.khaki = new Color(240, 230, 140, 1);
716
- Color.lavender = new Color(230, 230, 250, 1);
717
- Color.lavenderBlush = new Color(255, 240, 245, 1);
718
- Color.lawnGreen = new Color(124, 252, 0, 1);
719
- Color.lemonChiffon = new Color(255, 250, 205, 1);
720
- Color.lightBlue = new Color(173, 216, 230, 1);
721
- Color.lightCoral = new Color(240, 128, 128, 1);
722
- Color.lightCyan = new Color(224, 255, 255, 1);
723
- Color.lightGoldenrodYellow = new Color(250, 250, 210, 1);
724
- Color.lightGray = new Color(211, 211, 211, 1);
725
- Color.lightGreen = new Color(144, 238, 144, 1);
726
- Color.lightPink = new Color(255, 182, 193, 1);
727
- Color.lightSalmon = new Color(255, 160, 122, 1);
728
- Color.lightSeaGreen = new Color(32, 178, 170, 1);
729
- Color.lightSkyBlue = new Color(135, 206, 250, 1);
730
- Color.lightSlateGray = new Color(119, 136, 153, 1);
731
- Color.lightSteelBlue = new Color(176, 196, 222, 1);
732
- Color.lightYellow = new Color(255, 255, 224, 1);
733
- Color.lime = new Color(0, 255, 0, 1);
734
- Color.limeGreen = new Color(50, 205, 50, 1);
735
- Color.linen = new Color(250, 240, 230, 1);
736
- Color.magenta = new Color(255, 0, 255, 1);
737
- Color.maroon = new Color(128, 0, 0, 1);
738
- Color.mediumAquamarine = new Color(102, 205, 170, 1);
739
- Color.mediumBlue = new Color(0, 0, 205, 1);
740
- Color.mediumOrchid = new Color(186, 85, 211, 1);
741
- Color.mediumPurple = new Color(147, 112, 219, 1);
742
- Color.mediumSeaGreen = new Color(60, 179, 113, 1);
743
- Color.mediumSlateBlue = new Color(123, 104, 238, 1);
744
- Color.mediumSpringGreen = new Color(0, 250, 154, 1);
745
- Color.mediumTurquoise = new Color(72, 209, 204, 1);
746
- Color.mediumVioletRed = new Color(199, 21, 133, 1);
747
- Color.midnightBlue = new Color(25, 25, 112, 1);
748
- Color.mintCream = new Color(245, 255, 250, 1);
749
- Color.mistyRose = new Color(255, 228, 225, 1);
750
- Color.moccasin = new Color(255, 228, 181, 1);
751
- Color.navajoWhite = new Color(255, 222, 173, 1);
752
- Color.navy = new Color(0, 0, 128, 1);
753
- Color.oldLace = new Color(253, 245, 230, 1);
754
- Color.olive = new Color(128, 128, 0, 1);
755
- Color.oliveDrab = new Color(107, 142, 35, 1);
756
- Color.orange = new Color(255, 165, 0, 1);
757
- Color.orangeRed = new Color(255, 69, 0, 1);
758
- Color.orchid = new Color(218, 112, 214, 1);
759
- Color.paleGoldenrod = new Color(238, 232, 170, 1);
760
- Color.paleGreen = new Color(152, 251, 152, 1);
761
- Color.paleTurquoise = new Color(175, 238, 238, 1);
762
- Color.paleVioletRed = new Color(219, 112, 147, 1);
763
- Color.papayaWhip = new Color(255, 239, 213, 1);
764
- Color.peachPuff = new Color(255, 218, 185, 1);
765
- Color.peru = new Color(205, 133, 63, 1);
766
- Color.pink = new Color(255, 192, 203, 1);
767
- Color.plum = new Color(221, 160, 221, 1);
768
- Color.powderBlue = new Color(176, 224, 230, 1);
769
- Color.purple = new Color(128, 0, 128, 1);
770
- Color.red = new Color(255, 0, 0, 1);
771
- Color.rosyBrown = new Color(188, 143, 143, 1);
772
- Color.royalBlue = new Color(65, 105, 225, 1);
773
- Color.saddleBrown = new Color(139, 69, 19, 1);
774
- Color.salmon = new Color(250, 128, 114, 1);
775
- Color.sandyBrown = new Color(244, 164, 96, 1);
776
- Color.seaGreen = new Color(46, 139, 87, 1);
777
- Color.seaShell = new Color(255, 245, 238, 1);
778
- Color.sienna = new Color(160, 82, 45, 1);
779
- Color.silver = new Color(192, 192, 192, 1);
780
- Color.skyBlue = new Color(135, 206, 235, 1);
781
- Color.slateBlue = new Color(106, 90, 205, 1);
782
- Color.slateGray = new Color(112, 128, 144, 1);
783
- Color.snow = new Color(255, 250, 250, 1);
784
- Color.springGreen = new Color(0, 255, 127, 1);
785
- Color.steelBlue = new Color(70, 130, 180, 1);
786
- Color.tan = new Color(210, 180, 140, 1);
787
- Color.teal = new Color(0, 128, 128, 1);
788
- Color.thistle = new Color(216, 191, 216, 1);
789
- Color.tomato = new Color(255, 99, 71, 1);
790
- Color.transparentBlack = new Color(0, 0, 0, 0);
791
- Color.transparentWhite = new Color(255, 255, 255, 0);
792
- Color.turquoise = new Color(64, 224, 208, 1);
793
- Color.violet = new Color(238, 130, 238, 1);
794
- Color.wheat = new Color(245, 222, 179, 1);
795
- Color.white = new Color(255, 255, 255, 1);
796
- Color.whiteSmoke = new Color(245, 245, 245, 1);
797
- Color.yellow = new Color(255, 255, 0, 1);
798
- Color.yellowGreen = new Color(154, 205, 50, 1);
799
815
 
800
816
  var BlendModes;
801
817
  (function (BlendModes) {
@@ -977,6 +993,9 @@ class AbstractVector {
977
993
  }
978
994
 
979
995
  class ObservableVector extends AbstractVector {
996
+ _x;
997
+ _y;
998
+ _callback;
980
999
  constructor(callback, x = 0, y = 0) {
981
1000
  super();
982
1001
  this._x = x;
@@ -1050,8 +1069,17 @@ let temp$7 = null;
1050
1069
  * | e | f | z |
1051
1070
  */
1052
1071
  class Matrix {
1072
+ a;
1073
+ b;
1074
+ x;
1075
+ c;
1076
+ d;
1077
+ y;
1078
+ e;
1079
+ f;
1080
+ z;
1081
+ _array = null;
1053
1082
  constructor(a = 1, b = 0, x = 0, c = 0, d = 1, y = 0, e = 0, f = 0, z = 1) {
1054
- this._array = null;
1055
1083
  this.a = a;
1056
1084
  this.b = b;
1057
1085
  this.x = x;
@@ -1155,6 +1183,7 @@ class Matrix {
1155
1183
  this._array = null;
1156
1184
  }
1157
1185
  }
1186
+ static identity = new Matrix(1, 0, 0, 0, 1, 0, 0, 0, 1);
1158
1187
  static get temp() {
1159
1188
  if (temp$7 === null) {
1160
1189
  temp$7 = new Matrix();
@@ -1162,14 +1191,13 @@ class Matrix {
1162
1191
  return temp$7;
1163
1192
  }
1164
1193
  }
1165
- Matrix.identity = new Matrix(1, 0, 0, 0, 1, 0, 0, 0, 1);
1166
1194
 
1167
1195
  class Flags {
1196
+ _value = 0;
1168
1197
  get value() {
1169
1198
  return this._value;
1170
1199
  }
1171
1200
  constructor(...flags) {
1172
- this._value = 0;
1173
1201
  if (flags.length) {
1174
1202
  this.push(...flags);
1175
1203
  }
@@ -1214,16 +1242,14 @@ var TransformableFlags;
1214
1242
  TransformableFlags[TransformableFlags["TransformInverse"] = 16] = "TransformInverse";
1215
1243
  })(TransformableFlags || (TransformableFlags = {}));
1216
1244
  class Transformable {
1217
- constructor() {
1218
- this.flags = new Flags(TransformableFlags.Transform);
1219
- this._transform = new Matrix();
1220
- this._position = new ObservableVector(this._setPositionDirty.bind(this), 0, 0);
1221
- this._scale = new ObservableVector(this._setScalingDirty.bind(this), 1, 1);
1222
- this._origin = new ObservableVector(this._setOriginDirty.bind(this), 0, 0);
1223
- this._rotation = 0;
1224
- this._sin = 0;
1225
- this._cos = 1;
1226
- }
1245
+ flags = new Flags(TransformableFlags.Transform);
1246
+ _transform = new Matrix();
1247
+ _position = new ObservableVector(this._setPositionDirty.bind(this), 0, 0);
1248
+ _scale = new ObservableVector(this._setScalingDirty.bind(this), 1, 1);
1249
+ _origin = new ObservableVector(this._setOriginDirty.bind(this), 0, 0);
1250
+ _rotation = 0;
1251
+ _sin = 0;
1252
+ _cos = 1;
1227
1253
  get position() {
1228
1254
  return this._position;
1229
1255
  }
@@ -1340,6 +1366,8 @@ class Transformable {
1340
1366
 
1341
1367
  let temp$6 = null;
1342
1368
  class Interval {
1369
+ min;
1370
+ max;
1343
1371
  constructor(min = 0, max = min) {
1344
1372
  this.min = min;
1345
1373
  this.max = max;
@@ -1370,6 +1398,7 @@ class Interval {
1370
1398
  destroy() {
1371
1399
  // todo - check if destroy is needed
1372
1400
  }
1401
+ static zero = new Interval(0, 0);
1373
1402
  static get temp() {
1374
1403
  if (temp$6 === null) {
1375
1404
  temp$6 = new Interval();
@@ -1377,7 +1406,17 @@ class Interval {
1377
1406
  return temp$6;
1378
1407
  }
1379
1408
  }
1380
- Interval.zero = new Interval(0, 0);
1409
+
1410
+ var CollisionType;
1411
+ (function (CollisionType) {
1412
+ CollisionType[CollisionType["Point"] = 0] = "Point";
1413
+ CollisionType[CollisionType["Line"] = 1] = "Line";
1414
+ CollisionType[CollisionType["Rectangle"] = 2] = "Rectangle";
1415
+ CollisionType[CollisionType["Circle"] = 3] = "Circle";
1416
+ CollisionType[CollisionType["Ellipse"] = 4] = "Ellipse";
1417
+ CollisionType[CollisionType["Polygon"] = 5] = "Polygon";
1418
+ CollisionType[CollisionType["SceneNode"] = 6] = "SceneNode";
1419
+ })(CollisionType || (CollisionType = {}));
1381
1420
 
1382
1421
  const epsilon = 1e-10;
1383
1422
  const getCurveSegments = (radiusA, radiusB = radiusA) => (Math.max(16, Math.ceil(Math.sqrt(Math.max(radiusA, radiusB)) * 8)));
@@ -1531,12 +1570,12 @@ const getVoronoiRegion = (lineX, lineY, pointX, pointY) => {
1531
1570
  const product = getDotProduct(pointX, pointY, lineX, lineY);
1532
1571
  const lengthSq = getVectorLengthSquared(lineX, lineY);
1533
1572
  if (product < 0) {
1534
- return -1 /* VoronoiRegion.left */;
1573
+ return VoronoiRegion.left;
1535
1574
  }
1536
1575
  if (product > lengthSq) {
1537
- return 1 /* VoronoiRegion.right */;
1576
+ return VoronoiRegion.right;
1538
1577
  }
1539
- return 0 /* VoronoiRegion.middle */;
1578
+ return VoronoiRegion.middle;
1540
1579
  };
1541
1580
 
1542
1581
  /**
@@ -1651,18 +1690,18 @@ const intersectionRectPoly = (rectangle, polygon) => intersectionSat(rectangle,
1651
1690
  const intersectionCircleCircle = ({ x: x1, y: y1, radius: r1 }, { x: x2, y: y2, radius: r2 }) => (getDistance(x1, y1, x2, y2) <= (r1 + r2));
1652
1691
  const intersectionCircleEllipse = (circle, ellipse) => (polygonsIntersect(buildCirclePoints(circle), buildEllipsePoints(ellipse)));
1653
1692
  const shouldExcludeLeftVoronoi = (circleX, circleY, prevPoint, prevEdge, pointX, pointY, radius, edgeX, edgeY) => {
1654
- if (getVoronoiRegion(edgeX, edgeY, pointX, pointY) !== -1 /* VoronoiRegion.left */) {
1693
+ if (getVoronoiRegion(edgeX, edgeY, pointX, pointY) !== VoronoiRegion.left) {
1655
1694
  return false;
1656
1695
  }
1657
1696
  const region = getVoronoiRegion(prevEdge.x, prevEdge.y, circleX - prevPoint.x, circleY - prevPoint.y);
1658
- return region === 1 /* VoronoiRegion.right */ && getVectorLength(pointX, pointY) > radius;
1697
+ return region === VoronoiRegion.right && getVectorLength(pointX, pointY) > radius;
1659
1698
  };
1660
1699
  const shouldExcludeRightVoronoi = (circleX, circleY, nextPoint, nextEdge, pointX, pointY, radius, edgeX, edgeY) => {
1661
- if (getVoronoiRegion(edgeX, edgeY, pointX, pointY) !== 1 /* VoronoiRegion.right */) {
1700
+ if (getVoronoiRegion(edgeX, edgeY, pointX, pointY) !== VoronoiRegion.right) {
1662
1701
  return false;
1663
1702
  }
1664
1703
  const region = getVoronoiRegion(nextEdge.x, nextEdge.y, circleX - nextPoint.x, circleY - nextPoint.y);
1665
- return region === -1 /* VoronoiRegion.left */ && getVectorLength(pointX, pointY) > radius;
1704
+ return region === VoronoiRegion.left && getVectorLength(pointX, pointY) > radius;
1666
1705
  };
1667
1706
  const shouldExcludeMiddleVoronoi = (pointX, pointY, radius, edgeX, edgeY) => {
1668
1707
  const normalX = edgeY;
@@ -1786,13 +1825,13 @@ const getCollisionPolygonCircle = (polygon, circle, swap = false) => {
1786
1825
  if (pointDistanceA > radius) {
1787
1826
  containsA = false;
1788
1827
  }
1789
- if (region === -1 /* VoronoiRegion.left */) {
1828
+ if (region === VoronoiRegion.left) {
1790
1829
  const prev = points[i === 0 ? len - 1 : i - 1];
1791
1830
  const edgeBx = pointA.x - prev.x;
1792
1831
  const edgeBy = pointA.y - prev.y;
1793
1832
  const positionBx = x - prev.x;
1794
1833
  const positionBy = y - prev.y;
1795
- if (getVoronoiRegion(edgeBx, edgeBy, positionBx, positionBy) === 1 /* VoronoiRegion.right */) {
1834
+ if (getVoronoiRegion(edgeBx, edgeBy, positionBx, positionBy) === VoronoiRegion.right) {
1796
1835
  if (pointDistanceA > radius) {
1797
1836
  projection.destroy();
1798
1837
  return null;
@@ -1805,14 +1844,14 @@ const getCollisionPolygonCircle = (polygon, circle, swap = false) => {
1805
1844
  containsB = false;
1806
1845
  }
1807
1846
  }
1808
- else if (region === 1 /* VoronoiRegion.right */) {
1847
+ else if (region === VoronoiRegion.right) {
1809
1848
  const next = points[(i + 2) % len];
1810
1849
  const edgeBx = next.x - pointB.x;
1811
1850
  const edgeBy = next.y - pointB.y;
1812
1851
  const positionBx = x - pointB.x;
1813
1852
  const positionBy = y - pointB.y;
1814
1853
  const pointDistanceB = getVectorLength(positionBx, positionBy);
1815
- if (getVoronoiRegion(edgeBx, edgeBy, positionBx, positionBy) === -1 /* VoronoiRegion.left */) {
1854
+ if (getVoronoiRegion(edgeBx, edgeBy, positionBx, positionBy) === VoronoiRegion.left) {
1816
1855
  if (pointDistanceB > radius) {
1817
1856
  projection.destroy();
1818
1857
  return null;
@@ -1931,10 +1970,12 @@ let temp$5 = null;
1931
1970
  const noop = () => { };
1932
1971
  const tempPoint = new ObservableVector(noop);
1933
1972
  class Rectangle {
1973
+ collisionType = CollisionType.Rectangle;
1974
+ _position;
1975
+ _size;
1976
+ _normals = null;
1977
+ _normalsDirty = false;
1934
1978
  constructor(x = 0, y = x, width = 0, height = width) {
1935
- this.collisionType = 2 /* CollisionType.Rectangle */;
1936
- this._normals = null;
1937
- this._normalsDirty = false;
1938
1979
  this._position = new ObservableVector(() => {
1939
1980
  this._normalsDirty = true;
1940
1981
  }, x, y);
@@ -2075,28 +2116,28 @@ class Rectangle {
2075
2116
  }
2076
2117
  intersectsWith(target) {
2077
2118
  switch (target.collisionType) {
2078
- case 6 /* CollisionType.SceneNode */:
2119
+ case CollisionType.SceneNode:
2079
2120
  return target.isAlignedBox
2080
2121
  ? intersectionRectRect(this, target.getBounds())
2081
2122
  : intersectionSat(this, target);
2082
- case 2 /* CollisionType.Rectangle */: return intersectionRectRect(this, target);
2083
- case 5 /* CollisionType.Polygon */: return intersectionRectPoly(this, target);
2084
- case 3 /* CollisionType.Circle */: return intersectionRectCircle(this, target);
2085
- case 4 /* CollisionType.Ellipse */: return intersectionRectEllipse(this, target);
2086
- case 1 /* CollisionType.Line */: return intersectionLineRect(target, this);
2087
- case 0 /* CollisionType.Point */: return intersectionPointRect(target, this);
2123
+ case CollisionType.Rectangle: return intersectionRectRect(this, target);
2124
+ case CollisionType.Polygon: return intersectionRectPoly(this, target);
2125
+ case CollisionType.Circle: return intersectionRectCircle(this, target);
2126
+ case CollisionType.Ellipse: return intersectionRectEllipse(this, target);
2127
+ case CollisionType.Line: return intersectionLineRect(target, this);
2128
+ case CollisionType.Point: return intersectionPointRect(target, this);
2088
2129
  default: return false;
2089
2130
  }
2090
2131
  }
2091
2132
  collidesWith(target) {
2092
2133
  switch (target.collisionType) {
2093
- case 6 /* CollisionType.SceneNode */:
2134
+ case CollisionType.SceneNode:
2094
2135
  return target.isAlignedBox
2095
2136
  ? getCollisionRectangleRectangle(this, target.getBounds())
2096
2137
  : getCollisionSat(this, target);
2097
- case 2 /* CollisionType.Rectangle */: return getCollisionRectangleRectangle(this, target);
2098
- case 5 /* CollisionType.Polygon */: return getCollisionSat(this, target);
2099
- case 3 /* CollisionType.Circle */: return getCollisionCircleRectangle(target, this, true);
2138
+ case CollisionType.Rectangle: return getCollisionRectangleRectangle(this, target);
2139
+ case CollisionType.Polygon: return getCollisionSat(this, target);
2140
+ case CollisionType.Circle: return getCollisionCircleRectangle(target, this, true);
2100
2141
  // case CollisionType.Ellipse: return intersectionRectEllipse(this, target as Ellipse);
2101
2142
  // case CollisionType.Line: return intersectionLineRect(target as Line, this);
2102
2143
  // case CollisionType.Point: return intersectionPointRect(target as Vector, this);
@@ -2125,14 +2166,12 @@ class Rectangle {
2125
2166
  }
2126
2167
 
2127
2168
  class Bounds {
2128
- constructor() {
2129
- this._minX = Infinity;
2130
- this._minY = Infinity;
2131
- this._maxX = -Infinity;
2132
- this._maxY = -Infinity;
2133
- this._dirty = true;
2134
- this._rect = new Rectangle();
2135
- }
2169
+ _minX = Infinity;
2170
+ _minY = Infinity;
2171
+ _maxX = -Infinity;
2172
+ _maxY = -Infinity;
2173
+ _dirty = true;
2174
+ _rect = new Rectangle();
2136
2175
  get minX() {
2137
2176
  return this._minX;
2138
2177
  }
@@ -2182,19 +2221,16 @@ class Bounds {
2182
2221
  }
2183
2222
 
2184
2223
  class SceneNode extends Transformable {
2185
- constructor() {
2186
- super(...arguments);
2187
- this.collisionType = 6 /* CollisionType.SceneNode */;
2188
- this._bounds = new Bounds();
2189
- this._visible = true;
2190
- this._globalTransform = new Matrix();
2191
- this._localBounds = new Rectangle();
2192
- this._anchor = new ObservableVector(this._updateOrigin.bind(this), 0, 0);
2193
- this._parentNode = null;
2194
- this._zIndex = 0;
2195
- this._childOrder = 0;
2196
- this._cullable = true;
2197
- }
2224
+ collisionType = CollisionType.SceneNode;
2225
+ _bounds = new Bounds();
2226
+ _visible = true;
2227
+ _globalTransform = new Matrix();
2228
+ _localBounds = new Rectangle();
2229
+ _anchor = new ObservableVector(this._updateOrigin.bind(this), 0, 0);
2230
+ _parentNode = null;
2231
+ _zIndex = 0;
2232
+ _childOrder = 0;
2233
+ _cullable = true;
2198
2234
  get anchor() {
2199
2235
  return this._anchor;
2200
2236
  }
@@ -2299,13 +2335,13 @@ class SceneNode extends Transformable {
2299
2335
  return this.getBounds().intersectsWith(target);
2300
2336
  }
2301
2337
  switch (target.collisionType) {
2302
- case 6 /* CollisionType.SceneNode */: return intersectionSat(this, target);
2303
- case 2 /* CollisionType.Rectangle */: return intersectionSat(this, target);
2304
- case 5 /* CollisionType.Polygon */: return intersectionSat(this, target);
2305
- case 3 /* CollisionType.Circle */: return intersectionRectCircle(this.getBounds(), target);
2306
- case 4 /* CollisionType.Ellipse */: return intersectionRectEllipse(this.getBounds(), target);
2307
- case 1 /* CollisionType.Line */: return intersectionLineRect(target, this.getBounds());
2308
- case 0 /* CollisionType.Point */: return intersectionPointRect(target, this.getBounds());
2338
+ case CollisionType.SceneNode: return intersectionSat(this, target);
2339
+ case CollisionType.Rectangle: return intersectionSat(this, target);
2340
+ case CollisionType.Polygon: return intersectionSat(this, target);
2341
+ case CollisionType.Circle: return intersectionRectCircle(this.getBounds(), target);
2342
+ case CollisionType.Ellipse: return intersectionRectEllipse(this.getBounds(), target);
2343
+ case CollisionType.Line: return intersectionLineRect(target, this.getBounds());
2344
+ case CollisionType.Point: return intersectionPointRect(target, this.getBounds());
2309
2345
  default: return false;
2310
2346
  }
2311
2347
  }
@@ -2314,10 +2350,10 @@ class SceneNode extends Transformable {
2314
2350
  return this.getBounds().collidesWith(target);
2315
2351
  }
2316
2352
  switch (target.collisionType) {
2317
- case 6 /* CollisionType.SceneNode */: return getCollisionSat(this, target);
2318
- case 2 /* CollisionType.Rectangle */: return getCollisionSat(this, target);
2319
- case 5 /* CollisionType.Polygon */: return getCollisionSat(this, target);
2320
- case 3 /* CollisionType.Circle */: return getCollisionSat(this, target);
2353
+ case CollisionType.SceneNode: return getCollisionSat(this, target);
2354
+ case CollisionType.Rectangle: return getCollisionSat(this, target);
2355
+ case CollisionType.Polygon: return getCollisionSat(this, target);
2356
+ case CollisionType.Circle: return getCollisionSat(this, target);
2321
2357
  default: return null;
2322
2358
  }
2323
2359
  }
@@ -2348,6 +2384,7 @@ class SceneNode extends Transformable {
2348
2384
  }
2349
2385
 
2350
2386
  class ObservableSize extends Size {
2387
+ _callback;
2351
2388
  constructor(callback, width = 0, height = 0) {
2352
2389
  super(width, height);
2353
2390
  this._callback = callback;
@@ -2412,30 +2449,34 @@ var ViewFlags;
2412
2449
  ViewFlags[ViewFlags["VertexTint"] = 128] = "VertexTint";
2413
2450
  })(ViewFlags || (ViewFlags = {}));
2414
2451
  class View {
2452
+ _center;
2453
+ _size;
2454
+ _viewport = new Rectangle(0, 0, 1, 1);
2455
+ _transform = new Matrix();
2456
+ _inverseTransform = new Matrix();
2457
+ _bounds = new Bounds();
2458
+ _flags = new Flags();
2459
+ _rotation = 0;
2460
+ _sin = 0;
2461
+ _cos = 1;
2462
+ _zoomLevel = 1;
2463
+ _zoomBaseWidth;
2464
+ _zoomBaseHeight;
2465
+ _followTarget = null;
2466
+ _followLerp = 1;
2467
+ _followOffsetX = 0;
2468
+ _followOffsetY = 0;
2469
+ _boundsConstraint = null;
2470
+ _shakeIntensity = 0;
2471
+ _shakeDurationMs = 0;
2472
+ _shakeElapsedMs = 0;
2473
+ _shakeFrequency = 16;
2474
+ _shakeDecay = true;
2475
+ _shakePhase = 0;
2476
+ _shakeOffsetX = 0;
2477
+ _shakeOffsetY = 0;
2478
+ _updateId = 0;
2415
2479
  constructor(centerX, centerY, width, height) {
2416
- this._viewport = new Rectangle(0, 0, 1, 1);
2417
- this._transform = new Matrix();
2418
- this._inverseTransform = new Matrix();
2419
- this._bounds = new Bounds();
2420
- this._flags = new Flags();
2421
- this._rotation = 0;
2422
- this._sin = 0;
2423
- this._cos = 1;
2424
- this._zoomLevel = 1;
2425
- this._followTarget = null;
2426
- this._followLerp = 1;
2427
- this._followOffsetX = 0;
2428
- this._followOffsetY = 0;
2429
- this._boundsConstraint = null;
2430
- this._shakeIntensity = 0;
2431
- this._shakeDurationMs = 0;
2432
- this._shakeElapsedMs = 0;
2433
- this._shakeFrequency = 16;
2434
- this._shakeDecay = true;
2435
- this._shakePhase = 0;
2436
- this._shakeOffsetX = 0;
2437
- this._shakeOffsetY = 0;
2438
- this._updateId = 0;
2439
2480
  this._center = new ObservableVector(this._setPositionDirty.bind(this), centerX, centerY);
2440
2481
  this._size = new ObservableSize(this._setScalingDirty.bind(this), width, height);
2441
2482
  this._zoomBaseWidth = width;
@@ -2750,9 +2791,11 @@ class View {
2750
2791
 
2751
2792
  let temp$4 = null;
2752
2793
  class Vector extends AbstractVector {
2794
+ collisionType = CollisionType.Point;
2795
+ x;
2796
+ y;
2753
2797
  constructor(x = 0, y = 0) {
2754
2798
  super();
2755
- this.collisionType = 0 /* CollisionType.Point */;
2756
2799
  this.x = x;
2757
2800
  this.y = y;
2758
2801
  }
@@ -2766,13 +2809,13 @@ class Vector extends AbstractVector {
2766
2809
  }
2767
2810
  intersectsWith(target) {
2768
2811
  switch (target.collisionType) {
2769
- case 6 /* CollisionType.SceneNode */: return intersectionPointRect(this, target.getBounds());
2770
- case 2 /* CollisionType.Rectangle */: return intersectionPointRect(this, target);
2771
- case 5 /* CollisionType.Polygon */: return intersectionPointPoly(this, target);
2772
- case 3 /* CollisionType.Circle */: return intersectionPointCircle(this, target);
2773
- case 4 /* CollisionType.Ellipse */: return intersectionPointEllipse(this, target);
2774
- case 1 /* CollisionType.Line */: return intersectionPointLine(this, target);
2775
- case 0 /* CollisionType.Point */: return intersectionPointPoint(this, target);
2812
+ case CollisionType.SceneNode: return intersectionPointRect(this, target.getBounds());
2813
+ case CollisionType.Rectangle: return intersectionPointRect(this, target);
2814
+ case CollisionType.Polygon: return intersectionPointPoly(this, target);
2815
+ case CollisionType.Circle: return intersectionPointCircle(this, target);
2816
+ case CollisionType.Ellipse: return intersectionPointEllipse(this, target);
2817
+ case CollisionType.Line: return intersectionPointLine(this, target);
2818
+ case CollisionType.Point: return intersectionPointPoint(this, target);
2776
2819
  default: return false;
2777
2820
  }
2778
2821
  }
@@ -2802,6 +2845,8 @@ class Vector extends AbstractVector {
2802
2845
  }
2803
2846
  return temp$4;
2804
2847
  }
2848
+ static zero = new Vector(0, 0);
2849
+ static one = new Vector(1, 1);
2805
2850
  static add(v1, v2) {
2806
2851
  return new Vector(v1.x + v2.x, v1.y + v2.y);
2807
2852
  }
@@ -2815,14 +2860,16 @@ class Vector extends AbstractVector {
2815
2860
  return new Vector(v1.x / v2.x, v1.y / v2.y);
2816
2861
  }
2817
2862
  }
2818
- Vector.zero = new Vector(0, 0);
2819
- Vector.one = new Vector(1, 1);
2820
2863
 
2821
2864
  class RenderTarget {
2865
+ _root;
2866
+ _destroyListeners = new Set();
2867
+ _version = 0;
2868
+ _size;
2869
+ _viewport = new Rectangle();
2870
+ _defaultView;
2871
+ _view;
2822
2872
  constructor(width, height, root = false) {
2823
- this._destroyListeners = new Set();
2824
- this._version = 0;
2825
- this._viewport = new Rectangle();
2826
2873
  this._size = new Size(width, height);
2827
2874
  this._root = root;
2828
2875
  this._defaultView = new View(width / 2, height / 2, width, height);
@@ -2917,10 +2964,22 @@ class RenderTarget {
2917
2964
  }
2918
2965
 
2919
2966
  class RenderTexture extends RenderTarget {
2967
+ static defaultSamplerOptions = {
2968
+ scaleMode: ScaleModes.Linear,
2969
+ wrapMode: WrapModes.ClampToEdge,
2970
+ premultiplyAlpha: true,
2971
+ generateMipMap: false,
2972
+ flipY: true,
2973
+ };
2974
+ _source = null;
2975
+ _textureVersion = 0;
2976
+ _scaleMode;
2977
+ _wrapMode;
2978
+ _premultiplyAlpha;
2979
+ _generateMipMap;
2980
+ _flipY;
2920
2981
  constructor(width, height, options) {
2921
2982
  super(width, height, false);
2922
- this._source = null;
2923
- this._textureVersion = 0;
2924
2983
  const { scaleMode, wrapMode, premultiplyAlpha, generateMipMap, flipY } = { ...RenderTexture.defaultSamplerOptions, ...options };
2925
2984
  this._scaleMode = scaleMode;
2926
2985
  this._wrapMode = wrapMode;
@@ -3020,15 +3079,12 @@ class RenderTexture extends RenderTarget {
3020
3079
  this._textureVersion++;
3021
3080
  }
3022
3081
  }
3023
- RenderTexture.defaultSamplerOptions = {
3024
- scaleMode: ScaleModes.Linear,
3025
- wrapMode: WrapModes.ClampToEdge,
3026
- premultiplyAlpha: true,
3027
- generateMipMap: false,
3028
- flipY: true,
3029
- };
3030
3082
 
3031
3083
  class RenderTargetPass {
3084
+ _callback;
3085
+ _target;
3086
+ _view;
3087
+ _clearColor;
3032
3088
  constructor(callback, options = {}) {
3033
3089
  this._callback = callback;
3034
3090
  this._target = options.target ?? null;
@@ -3055,17 +3111,15 @@ class RenderTargetPass {
3055
3111
 
3056
3112
  const isDestroyableFilter = (filter) => ('destroy' in filter && typeof filter.destroy === 'function');
3057
3113
  class RenderNode extends SceneNode {
3058
- constructor() {
3059
- super(...arguments);
3060
- this._filters = [];
3061
- this._cacheBounds = new Rectangle();
3062
- this._cacheSprite = null;
3063
- this._captureView = null;
3064
- this._mask = null;
3065
- this._cacheAsBitmap = false;
3066
- this._cacheDirty = true;
3067
- this._cacheTexture = null;
3068
- }
3114
+ static _spriteFactory = null;
3115
+ _filters = [];
3116
+ _cacheBounds = new Rectangle();
3117
+ _cacheSprite = null;
3118
+ _captureView = null;
3119
+ _mask = null;
3120
+ _cacheAsBitmap = false;
3121
+ _cacheDirty = true;
3122
+ _cacheTexture = null;
3069
3123
  get filters() {
3070
3124
  return this._filters;
3071
3125
  }
@@ -3279,14 +3333,10 @@ class RenderNode extends SceneNode {
3279
3333
  return this._cacheSprite;
3280
3334
  }
3281
3335
  }
3282
- RenderNode._spriteFactory = null;
3283
3336
 
3284
3337
  class Drawable extends RenderNode {
3285
- constructor() {
3286
- super(...arguments);
3287
- this._tint = Color.white.clone();
3288
- this._blendMode = BlendModes.Normal;
3289
- }
3338
+ _tint = Color.white.clone();
3339
+ _blendMode = BlendModes.Normal;
3290
3340
  get tint() {
3291
3341
  return this._tint;
3292
3342
  }
@@ -3333,6 +3383,9 @@ class Drawable extends RenderNode {
3333
3383
  }
3334
3384
 
3335
3385
  class DrawableShape extends Drawable {
3386
+ geometry;
3387
+ drawMode;
3388
+ color;
3336
3389
  constructor(geometry, color, drawMode = RenderingPrimitives.Triangles) {
3337
3390
  super();
3338
3391
  this.geometry = geometry;
@@ -3346,6 +3399,9 @@ class DrawableShape extends Drawable {
3346
3399
  }
3347
3400
 
3348
3401
  class Geometry {
3402
+ vertices;
3403
+ indices;
3404
+ points;
3349
3405
  constructor({ vertices = [], indices = [], points = [], } = {}) {
3350
3406
  this.vertices = new Float32Array(vertices);
3351
3407
  this.indices = new Uint16Array(indices);
@@ -3371,47 +3427,15 @@ const createOverlayGeometry = () => new Geometry({
3371
3427
  });
3372
3428
  const defaultFadeTransitionDuration = 220;
3373
3429
  class SceneManager {
3430
+ _app;
3431
+ _stack = [];
3432
+ _transitionOverlay = new TransitionOverlayShape(createOverlayGeometry(), Color.black, RenderingPrimitives.TriangleStrip);
3433
+ _transition = null;
3434
+ onChangeScene = new Signal();
3435
+ onStartScene = new Signal();
3436
+ onUpdateScene = new Signal();
3437
+ onStopScene = new Signal();
3374
3438
  constructor(app) {
3375
- this._stack = [];
3376
- this._transitionOverlay = new TransitionOverlayShape(createOverlayGeometry(), Color.black, RenderingPrimitives.TriangleStrip);
3377
- this._transition = null;
3378
- this.onChangeScene = new Signal();
3379
- this.onStartScene = new Signal();
3380
- this.onUpdateScene = new Signal();
3381
- this.onStopScene = new Signal();
3382
- this._handleKeyDown = (channel) => {
3383
- this._dispatchInput({ type: 'keyDown', channel });
3384
- };
3385
- this._handleKeyUp = (channel) => {
3386
- this._dispatchInput({ type: 'keyUp', channel });
3387
- };
3388
- this._handlePointerEnter = (pointer) => {
3389
- this._dispatchInput({ type: 'pointerEnter', pointer });
3390
- };
3391
- this._handlePointerLeave = (pointer) => {
3392
- this._dispatchInput({ type: 'pointerLeave', pointer });
3393
- };
3394
- this._handlePointerDown = (pointer) => {
3395
- this._dispatchInput({ type: 'pointerDown', pointer });
3396
- };
3397
- this._handlePointerMove = (pointer) => {
3398
- this._dispatchInput({ type: 'pointerMove', pointer });
3399
- };
3400
- this._handlePointerUp = (pointer) => {
3401
- this._dispatchInput({ type: 'pointerUp', pointer });
3402
- };
3403
- this._handlePointerTap = (pointer) => {
3404
- this._dispatchInput({ type: 'pointerTap', pointer });
3405
- };
3406
- this._handlePointerSwipe = (pointer) => {
3407
- this._dispatchInput({ type: 'pointerSwipe', pointer });
3408
- };
3409
- this._handlePointerCancel = (pointer) => {
3410
- this._dispatchInput({ type: 'pointerCancel', pointer });
3411
- };
3412
- this._handleMouseWheel = (wheel) => {
3413
- this._dispatchInput({ type: 'mouseWheel', wheel });
3414
- };
3415
3439
  this._app = app;
3416
3440
  this._subscribeInputRouting();
3417
3441
  }
@@ -3526,7 +3550,7 @@ class SceneManager {
3526
3550
  if (cleanupError) {
3527
3551
  const initMessage = error instanceof Error ? error.message : String(error);
3528
3552
  const cleanupMessage = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
3529
- throw new Error(`Failed to initialize scene: ${initMessage}. Cleanup also failed: ${cleanupMessage}.`);
3553
+ throw new Error(`Failed to initialize scene: ${initMessage}. Cleanup also failed: ${cleanupMessage}.`, { cause: error });
3530
3554
  }
3531
3555
  throw error;
3532
3556
  }
@@ -3636,6 +3660,39 @@ class SceneManager {
3636
3660
  }
3637
3661
  }
3638
3662
  }
3663
+ _handleKeyDown = (channel) => {
3664
+ this._dispatchInput({ type: 'keyDown', channel });
3665
+ };
3666
+ _handleKeyUp = (channel) => {
3667
+ this._dispatchInput({ type: 'keyUp', channel });
3668
+ };
3669
+ _handlePointerEnter = (pointer) => {
3670
+ this._dispatchInput({ type: 'pointerEnter', pointer });
3671
+ };
3672
+ _handlePointerLeave = (pointer) => {
3673
+ this._dispatchInput({ type: 'pointerLeave', pointer });
3674
+ };
3675
+ _handlePointerDown = (pointer) => {
3676
+ this._dispatchInput({ type: 'pointerDown', pointer });
3677
+ };
3678
+ _handlePointerMove = (pointer) => {
3679
+ this._dispatchInput({ type: 'pointerMove', pointer });
3680
+ };
3681
+ _handlePointerUp = (pointer) => {
3682
+ this._dispatchInput({ type: 'pointerUp', pointer });
3683
+ };
3684
+ _handlePointerTap = (pointer) => {
3685
+ this._dispatchInput({ type: 'pointerTap', pointer });
3686
+ };
3687
+ _handlePointerSwipe = (pointer) => {
3688
+ this._dispatchInput({ type: 'pointerSwipe', pointer });
3689
+ };
3690
+ _handlePointerCancel = (pointer) => {
3691
+ this._dispatchInput({ type: 'pointerCancel', pointer });
3692
+ };
3693
+ _handleMouseWheel = (wheel) => {
3694
+ this._dispatchInput({ type: 'mouseWheel', wheel });
3695
+ };
3639
3696
  async _runWithTransition(action, transition) {
3640
3697
  if (!transition || transition.type !== 'fade') {
3641
3698
  await action();
@@ -4902,11 +4959,12 @@ const WebGLDebugUtils = function() {
4902
4959
  }();
4903
4960
 
4904
4961
  class WebGl2VertexArrayObject {
4962
+ _attributes = [];
4963
+ _indexBuffer = null;
4964
+ _drawMode;
4965
+ _runtime = null;
4966
+ _version = 0;
4905
4967
  constructor(drawMode = RenderingPrimitives.Triangles) {
4906
- this._attributes = [];
4907
- this._indexBuffer = null;
4908
- this._runtime = null;
4909
- this._version = 0;
4910
4968
  this._drawMode = drawMode;
4911
4969
  }
4912
4970
  get attributes() {
@@ -4984,10 +5042,8 @@ var RenderBackendType;
4984
5042
  * - flush(): submit any batched draw calls to the GPU
4985
5043
  */
4986
5044
  class AbstractWebGl2Renderer {
4987
- constructor() {
4988
- this.backendType = RenderBackendType.WebGl2;
4989
- this._runtime = null;
4990
- }
5045
+ backendType = RenderBackendType.WebGl2;
5046
+ _runtime = null;
4991
5047
  connect(runtime) {
4992
5048
  if (this._runtime !== null) {
4993
5049
  return;
@@ -5027,10 +5083,12 @@ class AbstractWebGl2Renderer {
5027
5083
  }
5028
5084
 
5029
5085
  class Shader {
5086
+ attributes = new Map();
5087
+ uniforms = new Map();
5088
+ _vertexSource;
5089
+ _fragmentSource;
5090
+ _runtime = null;
5030
5091
  constructor(vertexSource, fragmentSource) {
5031
- this.attributes = new Map();
5032
- this.uniforms = new Map();
5033
- this._runtime = null;
5034
5092
  this._vertexSource = vertexSource;
5035
5093
  this._fragmentSource = fragmentSource;
5036
5094
  }
@@ -5141,8 +5199,12 @@ const webGl2PrimitiveTypeNames = {
5141
5199
  };
5142
5200
 
5143
5201
  class ShaderAttribute {
5202
+ index;
5203
+ name;
5204
+ type;
5205
+ size;
5206
+ location = -1;
5144
5207
  constructor(index, name, type) {
5145
- this.location = -1;
5146
5208
  this.index = index;
5147
5209
  this.name = name;
5148
5210
  this.type = type;
@@ -5154,8 +5216,13 @@ class ShaderAttribute {
5154
5216
  }
5155
5217
 
5156
5218
  class ShaderUniform {
5219
+ index;
5220
+ type;
5221
+ size;
5222
+ name;
5223
+ _value;
5224
+ _dirty = true;
5157
5225
  constructor(index, type, size, name, data) {
5158
- this._dirty = true;
5159
5226
  this.name = name.replace(/\[.*?]/, '');
5160
5227
  this.index = index;
5161
5228
  this.type = type;
@@ -5185,8 +5252,16 @@ class ShaderUniform {
5185
5252
  }
5186
5253
 
5187
5254
  class WebGl2ShaderBlock {
5255
+ index;
5256
+ name;
5257
+ binding;
5258
+ dataSize;
5259
+ _context;
5260
+ _program;
5261
+ _blockData;
5262
+ _uniformBuffer;
5263
+ _uniforms = new Map();
5188
5264
  constructor(gl, program, index) {
5189
- this._uniforms = new Map();
5190
5265
  this._context = gl;
5191
5266
  this._program = program;
5192
5267
  this.index = index;
@@ -5388,10 +5463,12 @@ function extractUniformBlocks(gl, program, uniformBlocks) {
5388
5463
  }
5389
5464
 
5390
5465
  class WebGl2RenderBuffer {
5466
+ _type;
5467
+ _usage;
5468
+ _runtime = null;
5469
+ _data = emptyArrayBuffer;
5470
+ _version = 0;
5391
5471
  constructor(type, data, usage) {
5392
- this._runtime = null;
5393
- this._data = emptyArrayBuffer;
5394
- this._version = 0;
5395
5472
  this._type = type;
5396
5473
  this._usage = usage;
5397
5474
  if (data) {
@@ -5473,17 +5550,24 @@ const determineFontHeight = (font) => {
5473
5550
  };
5474
5551
 
5475
5552
  class AbstractWebGl2BatchedRenderer extends AbstractWebGl2Renderer {
5553
+ attributeCount;
5554
+ batchSize;
5555
+ indexData;
5556
+ vertexData;
5557
+ float32View;
5558
+ uint32View;
5559
+ shader;
5560
+ batchIndex = 0;
5561
+ currentTexture = null;
5562
+ currentBlendMode = null;
5563
+ currentView = null;
5564
+ currentViewId = -1;
5565
+ vao = null;
5566
+ indexBuffer = null;
5567
+ vertexBuffer = null;
5568
+ connection = null;
5476
5569
  constructor(batchSize, attributeCount, vertexSource, fragmentSource) {
5477
5570
  super();
5478
- this.batchIndex = 0;
5479
- this.currentTexture = null;
5480
- this.currentBlendMode = null;
5481
- this.currentView = null;
5482
- this.currentViewId = -1;
5483
- this.vao = null;
5484
- this.indexBuffer = null;
5485
- this.vertexBuffer = null;
5486
- this.connection = null;
5487
5571
  this.batchSize = batchSize;
5488
5572
  this.attributeCount = attributeCount;
5489
5573
  this.vertexData = new ArrayBuffer(batchSize * attributeCount * 4);
@@ -5825,13 +5909,19 @@ const minBatchVertexSize = 4;
5825
5909
  const vertexStrideBytes$2 = 12;
5826
5910
  const vertexStrideWords = vertexStrideBytes$2 / 4;
5827
5911
  class WebGl2PrimitiveRenderer extends AbstractWebGl2Renderer {
5912
+ _vertexCapacity;
5913
+ _indexCapacity;
5914
+ _vertexData;
5915
+ _indexData;
5916
+ _float32View;
5917
+ _uint32View;
5918
+ _shader = new Shader(vertexSource, fragmentSource);
5919
+ _connection = null;
5920
+ _currentBlendMode = null;
5921
+ _currentView = null;
5922
+ _viewId = -1;
5828
5923
  constructor(batchSize) {
5829
5924
  super();
5830
- this._shader = new Shader(vertexSource, fragmentSource);
5831
- this._connection = null;
5832
- this._currentBlendMode = null;
5833
- this._currentView = null;
5834
- this._viewId = -1;
5835
5925
  this._vertexCapacity = Math.max(minBatchVertexSize, batchSize);
5836
5926
  this._indexCapacity = Math.max(6, this._vertexCapacity * 3);
5837
5927
  this._vertexData = new ArrayBuffer(this._vertexCapacity * vertexStrideBytes$2);
@@ -6035,12 +6125,12 @@ var SpriteFlags;
6035
6125
  SpriteFlags[SpriteFlags["VertexTint"] = 128] = "VertexTint";
6036
6126
  })(SpriteFlags || (SpriteFlags = {}));
6037
6127
  class Sprite extends Drawable {
6128
+ _texture = null;
6129
+ _textureFrame = new Rectangle();
6130
+ _vertices = new Float32Array(8);
6131
+ _texCoords = new Uint32Array(4);
6038
6132
  constructor(texture) {
6039
6133
  super();
6040
- this._texture = null;
6041
- this._textureFrame = new Rectangle();
6042
- this._vertices = new Float32Array(8);
6043
- this._texCoords = new Uint32Array(4);
6044
6134
  if (texture !== null) {
6045
6135
  this.setTexture(texture);
6046
6136
  }
@@ -6183,17 +6273,15 @@ class Sprite extends Drawable {
6183
6273
  RenderNode.setInternalSpriteFactory(() => new Sprite(null));
6184
6274
 
6185
6275
  class Particle {
6186
- constructor() {
6187
- this._totalLifetime = Time.oneSecond.clone();
6188
- this._elapsedLifetime = Time.zero.clone();
6189
- this._position = Vector.zero.clone();
6190
- this._velocity = Vector.zero.clone();
6191
- this._scale = Vector.one.clone();
6192
- this._rotation = 0;
6193
- this._rotationSpeed = 0;
6194
- this._textureIndex = 0;
6195
- this._tint = Color.white.clone();
6196
- }
6276
+ _totalLifetime = Time.oneSecond.clone();
6277
+ _elapsedLifetime = Time.zero.clone();
6278
+ _position = Vector.zero.clone();
6279
+ _velocity = Vector.zero.clone();
6280
+ _scale = Vector.one.clone();
6281
+ _rotation = 0;
6282
+ _rotationSpeed = 0;
6283
+ _textureIndex = 0;
6284
+ _tint = Color.white.clone();
6197
6285
  get totalLifetime() {
6198
6286
  return this._totalLifetime;
6199
6287
  }
@@ -6284,17 +6372,18 @@ class Particle {
6284
6372
  }
6285
6373
 
6286
6374
  class ParticleSystem extends Drawable {
6375
+ _emitters = [];
6376
+ _affectors = [];
6377
+ _particles = [];
6378
+ _graveyard = [];
6379
+ _texture;
6380
+ _textureFrame = new Rectangle();
6381
+ _vertices = new Float32Array(4);
6382
+ _texCoords = new Uint32Array(4);
6383
+ _updateTexCoords = true;
6384
+ _updateVertices = true;
6287
6385
  constructor(texture) {
6288
6386
  super();
6289
- this._emitters = [];
6290
- this._affectors = [];
6291
- this._particles = [];
6292
- this._graveyard = [];
6293
- this._textureFrame = new Rectangle();
6294
- this._vertices = new Float32Array(4);
6295
- this._texCoords = new Uint32Array(4);
6296
- this._updateTexCoords = true;
6297
- this._updateVertices = true;
6298
6387
  this._texture = texture;
6299
6388
  this.resetTextureFrame();
6300
6389
  }
@@ -6463,6 +6552,16 @@ class ParticleSystem extends Drawable {
6463
6552
  }
6464
6553
 
6465
6554
  class Texture {
6555
+ static _black = null;
6556
+ static _white = null;
6557
+ static defaultSamplerOptions = {
6558
+ scaleMode: ScaleModes.Linear,
6559
+ wrapMode: WrapModes.ClampToEdge,
6560
+ premultiplyAlpha: true,
6561
+ generateMipMap: true,
6562
+ flipY: false,
6563
+ };
6564
+ static empty = new Texture(null);
6466
6565
  static get black() {
6467
6566
  if (Texture._black === null) {
6468
6567
  Texture._black = new Texture(createCanvas({ fillStyle: '#000' }));
@@ -6475,14 +6574,16 @@ class Texture {
6475
6574
  }
6476
6575
  return Texture._white;
6477
6576
  }
6577
+ _version = 0;
6578
+ _source = null;
6579
+ _size = new Size(0, 0);
6580
+ _destroyListeners = new Set();
6581
+ _scaleMode;
6582
+ _wrapMode;
6583
+ _premultiplyAlpha = false;
6584
+ _generateMipMap = false;
6585
+ _flipY = false;
6478
6586
  constructor(source = null, options) {
6479
- this._version = 0;
6480
- this._source = null;
6481
- this._size = new Size(0, 0);
6482
- this._destroyListeners = new Set();
6483
- this._premultiplyAlpha = false;
6484
- this._generateMipMap = false;
6485
- this._flipY = false;
6486
6587
  const { scaleMode, wrapMode, premultiplyAlpha, generateMipMap, flipY } = { ...Texture.defaultSamplerOptions, ...options };
6487
6588
  this._scaleMode = scaleMode;
6488
6589
  this._wrapMode = wrapMode;
@@ -6614,16 +6715,6 @@ class Texture {
6614
6715
  this._version++;
6615
6716
  }
6616
6717
  }
6617
- Texture._black = null;
6618
- Texture._white = null;
6619
- Texture.defaultSamplerOptions = {
6620
- scaleMode: ScaleModes.Linear,
6621
- wrapMode: WrapModes.ClampToEdge,
6622
- premultiplyAlpha: true,
6623
- generateMipMap: true,
6624
- flipY: false,
6625
- };
6626
- Texture.empty = new Texture(null);
6627
6718
 
6628
6719
  /**
6629
6720
  * Instance-based renderer registry.
@@ -6639,10 +6730,8 @@ Texture.empty = new Texture(null);
6639
6730
  * custom renderer registration.
6640
6731
  */
6641
6732
  class RendererRegistry {
6642
- constructor() {
6643
- this._renderers = new Map();
6644
- this._runtime = null;
6645
- }
6733
+ _renderers = new Map();
6734
+ _runtime = null;
6646
6735
  /**
6647
6736
  * Register a renderer for a specific drawable type.
6648
6737
  *
@@ -6751,27 +6840,35 @@ const logAndValidate = (functionName, args) => {
6751
6840
  validateNoneOfTheArgsAreUndefined(functionName, args);
6752
6841
  };
6753
6842
  class WebGl2RenderManager {
6843
+ backendType = RenderBackendType.WebGl2;
6844
+ rendererRegistry = new RendererRegistry();
6845
+ _context;
6846
+ _rootRenderTarget;
6847
+ _onContextLostHandler;
6848
+ _onContextRestoredHandler;
6849
+ _textureStates = new Map();
6850
+ _renderTargetStates = new Map();
6851
+ _textureDestroyHandlers = new Map();
6852
+ _renderTargetDestroyHandlers = new Map();
6853
+ _temporaryRenderTextures = [];
6854
+ _maskStack = [];
6855
+ _maskPixelStack = [];
6856
+ _maskPointA = new Vector();
6857
+ _maskPointB = new Vector();
6858
+ _canvas;
6859
+ _contextLost;
6860
+ _renderTarget;
6861
+ _renderer = null;
6862
+ _shader = null;
6863
+ _blendMode = null;
6864
+ _texture = null;
6865
+ _textureUnit = 0;
6866
+ _vao = null;
6867
+ _clearColor = new Color();
6868
+ _cursor;
6869
+ _boundFramebuffer = null;
6870
+ _stats = createRenderStats();
6754
6871
  constructor(app) {
6755
- this.backendType = RenderBackendType.WebGl2;
6756
- this.rendererRegistry = new RendererRegistry();
6757
- this._textureStates = new Map();
6758
- this._renderTargetStates = new Map();
6759
- this._textureDestroyHandlers = new Map();
6760
- this._renderTargetDestroyHandlers = new Map();
6761
- this._temporaryRenderTextures = [];
6762
- this._maskStack = [];
6763
- this._maskPixelStack = [];
6764
- this._maskPointA = new Vector();
6765
- this._maskPointB = new Vector();
6766
- this._renderer = null;
6767
- this._shader = null;
6768
- this._blendMode = null;
6769
- this._texture = null;
6770
- this._textureUnit = 0;
6771
- this._vao = null;
6772
- this._clearColor = new Color();
6773
- this._boundFramebuffer = null;
6774
- this._stats = createRenderStats();
6775
6872
  const { width, height, clearColor, webglAttributes, debug, spriteRendererBatchSize, particleRendererBatchSize, primitiveRendererBatchSize, } = app.options;
6776
6873
  this._canvas = app.canvas;
6777
6874
  const gl = this._createContext(webglAttributes);
@@ -7319,10 +7416,8 @@ class WebGl2RenderManager {
7319
7416
  * - flush(): encode and submit command buffers for all collected draw calls
7320
7417
  */
7321
7418
  class AbstractWebGpuRenderer {
7322
- constructor() {
7323
- this.backendType = RenderBackendType.WebGpu;
7324
- this._runtime = null;
7325
- }
7419
+ backendType = RenderBackendType.WebGpu;
7420
+ _runtime = null;
7326
7421
  connect(runtime) {
7327
7422
  if (this._runtime !== null) {
7328
7423
  return;
@@ -7463,27 +7558,24 @@ fn fragmentMain(input: VertexOutput) -> @location(0) vec4<f32> {
7463
7558
  const vertexStrideBytes$1 = 20;
7464
7559
  const wordsPerVertex$1 = vertexStrideBytes$1 / Uint32Array.BYTES_PER_ELEMENT;
7465
7560
  class WebGpuPrimitiveRenderer extends AbstractWebGpuRenderer {
7466
- constructor() {
7467
- super(...arguments);
7468
- this._combinedTransform = new Matrix();
7469
- this._drawCalls = [];
7470
- this._drawCallCount = 0;
7471
- this._pipelines = new Map();
7472
- this._renderManager = null;
7473
- this._device = null;
7474
- this._shaderModule = null;
7475
- this._pipelineLayout = null;
7476
- this._vertexBuffer = null;
7477
- this._indexBuffer = null;
7478
- this._vertexBufferCapacity = 0;
7479
- this._indexBufferCapacity = 0;
7480
- this._vertexData = new ArrayBuffer(0);
7481
- this._float32View = new Float32Array(this._vertexData);
7482
- this._uint32View = new Uint32Array(this._vertexData);
7483
- this._packedIndexData = new Uint16Array(0);
7484
- this._generatedIndexData = new Uint16Array(0);
7485
- this._sequentialIndexData = new Uint16Array(0);
7486
- }
7561
+ _combinedTransform = new Matrix();
7562
+ _drawCalls = [];
7563
+ _drawCallCount = 0;
7564
+ _pipelines = new Map();
7565
+ _renderManager = null;
7566
+ _device = null;
7567
+ _shaderModule = null;
7568
+ _pipelineLayout = null;
7569
+ _vertexBuffer = null;
7570
+ _indexBuffer = null;
7571
+ _vertexBufferCapacity = 0;
7572
+ _indexBufferCapacity = 0;
7573
+ _vertexData = new ArrayBuffer(0);
7574
+ _float32View = new Float32Array(this._vertexData);
7575
+ _uint32View = new Uint32Array(this._vertexData);
7576
+ _packedIndexData = new Uint16Array(0);
7577
+ _generatedIndexData = new Uint16Array(0);
7578
+ _sequentialIndexData = new Uint16Array(0);
7487
7579
  render(shape) {
7488
7580
  const runtime = this._renderManager;
7489
7581
  if (runtime === null) {
@@ -7914,121 +8006,121 @@ class WebGpuPrimitiveRenderer extends AbstractWebGpuRenderer {
7914
8006
  }
7915
8007
 
7916
8008
  /// <reference types="@webgpu/types" />
7917
- const spriteShaderSource = `
7918
- struct ProjectionUniforms {
7919
- matrix: mat4x4<f32>,
7920
- };
7921
-
7922
- @group(0) @binding(0)
7923
- var<uniform> projection: ProjectionUniforms;
7924
-
7925
- @group(1) @binding(0)
7926
- var spriteTexture0: texture_2d<f32>;
7927
- @group(1) @binding(1)
7928
- var spriteTexture1: texture_2d<f32>;
7929
- @group(1) @binding(2)
7930
- var spriteTexture2: texture_2d<f32>;
7931
- @group(1) @binding(3)
7932
- var spriteTexture3: texture_2d<f32>;
7933
- @group(1) @binding(4)
7934
- var spriteTexture4: texture_2d<f32>;
7935
- @group(1) @binding(5)
7936
- var spriteTexture5: texture_2d<f32>;
7937
- @group(1) @binding(6)
7938
- var spriteTexture6: texture_2d<f32>;
7939
- @group(1) @binding(7)
7940
- var spriteTexture7: texture_2d<f32>;
7941
-
7942
- @group(1) @binding(8)
7943
- var spriteSampler0: sampler;
7944
- @group(1) @binding(9)
7945
- var spriteSampler1: sampler;
7946
- @group(1) @binding(10)
7947
- var spriteSampler2: sampler;
7948
- @group(1) @binding(11)
7949
- var spriteSampler3: sampler;
7950
- @group(1) @binding(12)
7951
- var spriteSampler4: sampler;
7952
- @group(1) @binding(13)
7953
- var spriteSampler5: sampler;
7954
- @group(1) @binding(14)
7955
- var spriteSampler6: sampler;
7956
- @group(1) @binding(15)
7957
- var spriteSampler7: sampler;
7958
-
7959
- struct VertexInput {
7960
- @location(0) position: vec2<f32>,
7961
- @location(1) texcoord: vec2<f32>,
7962
- @location(2) color: vec4<f32>,
7963
- @location(3) premultiplySample: u32,
7964
- @location(4) textureSlot: u32,
7965
- };
7966
-
7967
- struct VertexOutput {
7968
- @builtin(position) position: vec4<f32>,
7969
- @location(0) texcoord: vec2<f32>,
7970
- @location(1) color: vec4<f32>,
7971
- @location(2) @interpolate(flat) premultiplySample: u32,
7972
- @location(3) @interpolate(flat) textureSlot: u32,
7973
- };
7974
-
7975
- @vertex
7976
- fn vertexMain(input: VertexInput) -> VertexOutput {
7977
- var output: VertexOutput;
7978
-
7979
- output.position = projection.matrix * vec4<f32>(input.position, 0.0, 1.0);
7980
- output.texcoord = input.texcoord;
7981
- output.color = vec4(input.color.rgb * input.color.a, input.color.a);
7982
- output.premultiplySample = input.premultiplySample;
7983
- output.textureSlot = input.textureSlot;
7984
-
7985
- return output;
7986
- }
7987
-
7988
- fn sampleTexture(slot: u32, uv: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32> {
7989
- switch slot {
7990
- case 0u: {
7991
- return textureSampleGrad(spriteTexture0, spriteSampler0, uv, ddx, ddy);
7992
- }
7993
- case 1u: {
7994
- return textureSampleGrad(spriteTexture1, spriteSampler1, uv, ddx, ddy);
7995
- }
7996
- case 2u: {
7997
- return textureSampleGrad(spriteTexture2, spriteSampler2, uv, ddx, ddy);
7998
- }
7999
- case 3u: {
8000
- return textureSampleGrad(spriteTexture3, spriteSampler3, uv, ddx, ddy);
8001
- }
8002
- case 4u: {
8003
- return textureSampleGrad(spriteTexture4, spriteSampler4, uv, ddx, ddy);
8004
- }
8005
- case 5u: {
8006
- return textureSampleGrad(spriteTexture5, spriteSampler5, uv, ddx, ddy);
8007
- }
8008
- case 6u: {
8009
- return textureSampleGrad(spriteTexture6, spriteSampler6, uv, ddx, ddy);
8010
- }
8011
- default: {
8012
- return textureSampleGrad(spriteTexture7, spriteSampler7, uv, ddx, ddy);
8013
- }
8014
- }
8015
- }
8016
-
8017
- @fragment
8018
- fn fragmentMain(input: VertexOutput) -> @location(0) vec4<f32> {
8019
- // Compute screen-space derivatives in uniform control flow before the
8020
- // per-slot switch. WGSL requires textureSample (implicit LOD) to run in
8021
- // uniform control flow, which multi-texture batching breaks because the
8022
- // slot varies per fragment. textureSampleGrad takes explicit derivatives
8023
- // and is valid regardless of control-flow uniformity, while preserving
8024
- // mipmap-correct LOD when sprites use mipmapped textures.
8025
- let ddx = dpdx(input.texcoord);
8026
- let ddy = dpdy(input.texcoord);
8027
- let sample = sampleTexture(input.textureSlot, input.texcoord, ddx, ddy);
8028
- let resolvedSample = select(sample, vec4(sample.rgb * sample.a, sample.a), input.premultiplySample == 1u);
8029
-
8030
- return resolvedSample * input.color;
8031
- }
8009
+ const spriteShaderSource = `
8010
+ struct ProjectionUniforms {
8011
+ matrix: mat4x4<f32>,
8012
+ };
8013
+
8014
+ @group(0) @binding(0)
8015
+ var<uniform> projection: ProjectionUniforms;
8016
+
8017
+ @group(1) @binding(0)
8018
+ var spriteTexture0: texture_2d<f32>;
8019
+ @group(1) @binding(1)
8020
+ var spriteTexture1: texture_2d<f32>;
8021
+ @group(1) @binding(2)
8022
+ var spriteTexture2: texture_2d<f32>;
8023
+ @group(1) @binding(3)
8024
+ var spriteTexture3: texture_2d<f32>;
8025
+ @group(1) @binding(4)
8026
+ var spriteTexture4: texture_2d<f32>;
8027
+ @group(1) @binding(5)
8028
+ var spriteTexture5: texture_2d<f32>;
8029
+ @group(1) @binding(6)
8030
+ var spriteTexture6: texture_2d<f32>;
8031
+ @group(1) @binding(7)
8032
+ var spriteTexture7: texture_2d<f32>;
8033
+
8034
+ @group(1) @binding(8)
8035
+ var spriteSampler0: sampler;
8036
+ @group(1) @binding(9)
8037
+ var spriteSampler1: sampler;
8038
+ @group(1) @binding(10)
8039
+ var spriteSampler2: sampler;
8040
+ @group(1) @binding(11)
8041
+ var spriteSampler3: sampler;
8042
+ @group(1) @binding(12)
8043
+ var spriteSampler4: sampler;
8044
+ @group(1) @binding(13)
8045
+ var spriteSampler5: sampler;
8046
+ @group(1) @binding(14)
8047
+ var spriteSampler6: sampler;
8048
+ @group(1) @binding(15)
8049
+ var spriteSampler7: sampler;
8050
+
8051
+ struct VertexInput {
8052
+ @location(0) position: vec2<f32>,
8053
+ @location(1) texcoord: vec2<f32>,
8054
+ @location(2) color: vec4<f32>,
8055
+ @location(3) premultiplySample: u32,
8056
+ @location(4) textureSlot: u32,
8057
+ };
8058
+
8059
+ struct VertexOutput {
8060
+ @builtin(position) position: vec4<f32>,
8061
+ @location(0) texcoord: vec2<f32>,
8062
+ @location(1) color: vec4<f32>,
8063
+ @location(2) @interpolate(flat) premultiplySample: u32,
8064
+ @location(3) @interpolate(flat) textureSlot: u32,
8065
+ };
8066
+
8067
+ @vertex
8068
+ fn vertexMain(input: VertexInput) -> VertexOutput {
8069
+ var output: VertexOutput;
8070
+
8071
+ output.position = projection.matrix * vec4<f32>(input.position, 0.0, 1.0);
8072
+ output.texcoord = input.texcoord;
8073
+ output.color = vec4(input.color.rgb * input.color.a, input.color.a);
8074
+ output.premultiplySample = input.premultiplySample;
8075
+ output.textureSlot = input.textureSlot;
8076
+
8077
+ return output;
8078
+ }
8079
+
8080
+ fn sampleTexture(slot: u32, uv: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32> {
8081
+ switch slot {
8082
+ case 0u: {
8083
+ return textureSampleGrad(spriteTexture0, spriteSampler0, uv, ddx, ddy);
8084
+ }
8085
+ case 1u: {
8086
+ return textureSampleGrad(spriteTexture1, spriteSampler1, uv, ddx, ddy);
8087
+ }
8088
+ case 2u: {
8089
+ return textureSampleGrad(spriteTexture2, spriteSampler2, uv, ddx, ddy);
8090
+ }
8091
+ case 3u: {
8092
+ return textureSampleGrad(spriteTexture3, spriteSampler3, uv, ddx, ddy);
8093
+ }
8094
+ case 4u: {
8095
+ return textureSampleGrad(spriteTexture4, spriteSampler4, uv, ddx, ddy);
8096
+ }
8097
+ case 5u: {
8098
+ return textureSampleGrad(spriteTexture5, spriteSampler5, uv, ddx, ddy);
8099
+ }
8100
+ case 6u: {
8101
+ return textureSampleGrad(spriteTexture6, spriteSampler6, uv, ddx, ddy);
8102
+ }
8103
+ default: {
8104
+ return textureSampleGrad(spriteTexture7, spriteSampler7, uv, ddx, ddy);
8105
+ }
8106
+ }
8107
+ }
8108
+
8109
+ @fragment
8110
+ fn fragmentMain(input: VertexOutput) -> @location(0) vec4<f32> {
8111
+ // Compute screen-space derivatives in uniform control flow before the
8112
+ // per-slot switch. WGSL requires textureSample (implicit LOD) to run in
8113
+ // uniform control flow, which multi-texture batching breaks because the
8114
+ // slot varies per fragment. textureSampleGrad takes explicit derivatives
8115
+ // and is valid regardless of control-flow uniformity, while preserving
8116
+ // mipmap-correct LOD when sprites use mipmapped textures.
8117
+ let ddx = dpdx(input.texcoord);
8118
+ let ddy = dpdy(input.texcoord);
8119
+ let sample = sampleTexture(input.textureSlot, input.texcoord, ddx, ddy);
8120
+ let resolvedSample = select(sample, vec4(sample.rgb * sample.a, sample.a), input.premultiplySample == 1u);
8121
+
8122
+ return resolvedSample * input.color;
8123
+ }
8032
8124
  `;
8033
8125
  const vertexStrideBytes = 28;
8034
8126
  const spriteVertexCount = 4;
@@ -8038,27 +8130,24 @@ const initialBatchCapacity = 32;
8038
8130
  const wordsPerVertex = vertexStrideBytes / Uint32Array.BYTES_PER_ELEMENT;
8039
8131
  const maxBatchTextures = 8;
8040
8132
  class WebGpuSpriteRenderer extends AbstractWebGpuRenderer {
8041
- constructor() {
8042
- super(...arguments);
8043
- this._drawCalls = [];
8044
- this._drawCallCount = 0;
8045
- this._projectionData = new Float32Array(projectionByteLength / Float32Array.BYTES_PER_ELEMENT);
8046
- this._renderManager = null;
8047
- this._device = null;
8048
- this._shaderModule = null;
8049
- this._uniformBindGroupLayout = null;
8050
- this._textureBindGroupLayout = null;
8051
- this._pipelineLayout = null;
8052
- this._uniformBuffer = null;
8053
- this._uniformBindGroup = null;
8054
- this._vertexBuffer = null;
8055
- this._indexBuffer = null;
8056
- this._vertexCapacity = 0;
8057
- this._vertexData = new ArrayBuffer(0);
8058
- this._float32View = new Float32Array(this._vertexData);
8059
- this._uint32View = new Uint32Array(this._vertexData);
8060
- this._pipelines = new Map();
8061
- }
8133
+ _drawCalls = [];
8134
+ _drawCallCount = 0;
8135
+ _projectionData = new Float32Array(projectionByteLength / Float32Array.BYTES_PER_ELEMENT);
8136
+ _renderManager = null;
8137
+ _device = null;
8138
+ _shaderModule = null;
8139
+ _uniformBindGroupLayout = null;
8140
+ _textureBindGroupLayout = null;
8141
+ _pipelineLayout = null;
8142
+ _uniformBuffer = null;
8143
+ _uniformBindGroup = null;
8144
+ _vertexBuffer = null;
8145
+ _indexBuffer = null;
8146
+ _vertexCapacity = 0;
8147
+ _vertexData = new ArrayBuffer(0);
8148
+ _float32View = new Float32Array(this._vertexData);
8149
+ _uint32View = new Uint32Array(this._vertexData);
8150
+ _pipelines = new Map();
8062
8151
  onConnect(runtime) {
8063
8152
  if (!this._renderManager) {
8064
8153
  this._renderManager = runtime;
@@ -8517,28 +8606,25 @@ const staticIndexData = new Uint16Array([
8517
8606
  0, 2, 3,
8518
8607
  ]);
8519
8608
  class WebGpuParticleRenderer extends AbstractWebGpuRenderer {
8520
- constructor() {
8521
- super(...arguments);
8522
- this._drawCalls = [];
8523
- this._drawCallCount = 0;
8524
- this._uniformData = new Float32Array(uniformByteLength / Float32Array.BYTES_PER_ELEMENT);
8525
- this._renderManager = null;
8526
- this._device = null;
8527
- this._shaderModule = null;
8528
- this._uniformBindGroupLayout = null;
8529
- this._textureBindGroupLayout = null;
8530
- this._pipelineLayout = null;
8531
- this._uniformBuffer = null;
8532
- this._uniformBindGroup = null;
8533
- this._staticVertexBuffer = null;
8534
- this._instanceBuffer = null;
8535
- this._indexBuffer = null;
8536
- this._instanceBufferByteLength = 0;
8537
- this._instanceData = new ArrayBuffer(instanceStrideBytes * initialParticleCapacity);
8538
- this._float32View = new Float32Array(this._instanceData);
8539
- this._uint32View = new Uint32Array(this._instanceData);
8540
- this._pipelines = new Map();
8541
- }
8609
+ _drawCalls = [];
8610
+ _drawCallCount = 0;
8611
+ _uniformData = new Float32Array(uniformByteLength / Float32Array.BYTES_PER_ELEMENT);
8612
+ _renderManager = null;
8613
+ _device = null;
8614
+ _shaderModule = null;
8615
+ _uniformBindGroupLayout = null;
8616
+ _textureBindGroupLayout = null;
8617
+ _pipelineLayout = null;
8618
+ _uniformBuffer = null;
8619
+ _uniformBindGroup = null;
8620
+ _staticVertexBuffer = null;
8621
+ _instanceBuffer = null;
8622
+ _indexBuffer = null;
8623
+ _instanceBufferByteLength = 0;
8624
+ _instanceData = new ArrayBuffer(instanceStrideBytes * initialParticleCapacity);
8625
+ _float32View = new Float32Array(this._instanceData);
8626
+ _uint32View = new Uint32Array(this._instanceData);
8627
+ _pipelines = new Map();
8542
8628
  render(system) {
8543
8629
  const runtime = this._renderManager;
8544
8630
  const texture = system.texture;
@@ -8880,33 +8966,36 @@ class WebGpuParticleRenderer extends AbstractWebGpuRenderer {
8880
8966
  /// <reference types="@webgpu/types" />
8881
8967
  const managedTextureFormat = 'rgba8unorm';
8882
8968
  class WebGpuRenderManager {
8969
+ backendType = RenderBackendType.WebGpu;
8970
+ rendererRegistry = new RendererRegistry();
8971
+ _canvas;
8972
+ _rootRenderTarget;
8973
+ _clearColor = new Color();
8974
+ _textureStates = new Map();
8975
+ _textureDestroyHandlers = new Map();
8976
+ _renderTargetDestroyHandlers = new Map();
8977
+ _temporaryRenderTextures = [];
8978
+ _maskStack = [];
8979
+ _maskPixelStack = [];
8980
+ _maskPointA = new Vector();
8981
+ _maskPointB = new Vector();
8982
+ _mipmapShaderModule = null;
8983
+ _mipmapBindGroupLayout = null;
8984
+ _mipmapPipelineLayout = null;
8985
+ _mipmapPipeline = null;
8986
+ _mipmapSampler = null;
8987
+ _context = null;
8988
+ _device = null;
8989
+ _format = null;
8990
+ _initializePromise = null;
8991
+ _renderTarget;
8992
+ _renderer = null;
8993
+ _blendMode = null;
8994
+ _texture = null;
8995
+ _clearRequested = false;
8996
+ _hasPresentedFrame = false;
8997
+ _stats = createRenderStats();
8883
8998
  constructor(app) {
8884
- this.backendType = RenderBackendType.WebGpu;
8885
- this.rendererRegistry = new RendererRegistry();
8886
- this._clearColor = new Color();
8887
- this._textureStates = new Map();
8888
- this._textureDestroyHandlers = new Map();
8889
- this._renderTargetDestroyHandlers = new Map();
8890
- this._temporaryRenderTextures = [];
8891
- this._maskStack = [];
8892
- this._maskPixelStack = [];
8893
- this._maskPointA = new Vector();
8894
- this._maskPointB = new Vector();
8895
- this._mipmapShaderModule = null;
8896
- this._mipmapBindGroupLayout = null;
8897
- this._mipmapPipelineLayout = null;
8898
- this._mipmapPipeline = null;
8899
- this._mipmapSampler = null;
8900
- this._context = null;
8901
- this._device = null;
8902
- this._format = null;
8903
- this._initializePromise = null;
8904
- this._renderer = null;
8905
- this._blendMode = null;
8906
- this._texture = null;
8907
- this._clearRequested = false;
8908
- this._hasPresentedFrame = false;
8909
- this._stats = createRenderStats();
8910
8999
  const { width, height, clearColor, } = app.options;
8911
9000
  this._canvas = app.canvas;
8912
9001
  this._rootRenderTarget = new RenderTarget(width, height, true);
@@ -9640,6 +9729,12 @@ var ChannelSize;
9640
9729
  ChannelSize[ChannelSize["Category"] = 256] = "Category";
9641
9730
  ChannelSize[ChannelSize["Gamepad"] = 64] = "Gamepad";
9642
9731
  })(ChannelSize || (ChannelSize = {}));
9732
+ var ChannelOffset;
9733
+ (function (ChannelOffset) {
9734
+ ChannelOffset[ChannelOffset["Keyboard"] = 0] = "Keyboard";
9735
+ ChannelOffset[ChannelOffset["Pointers"] = 256] = "Pointers";
9736
+ ChannelOffset[ChannelOffset["Gamepads"] = 512] = "Gamepads";
9737
+ })(ChannelOffset || (ChannelOffset = {}));
9643
9738
  var Keyboard;
9644
9739
  (function (Keyboard) {
9645
9740
  Keyboard[Keyboard["Backspace"] = 8] = "Backspace";
@@ -9744,24 +9839,28 @@ var Keyboard;
9744
9839
  })(Keyboard || (Keyboard = {}));
9745
9840
 
9746
9841
  class Gamepad {
9842
+ onConnect = new Signal();
9843
+ onDisconnect = new Signal();
9844
+ onUpdate = new Signal();
9845
+ indexValue;
9846
+ channelsValue;
9847
+ channelOffset;
9848
+ mappingValue;
9849
+ browserGamepad = null;
9850
+ info = {
9851
+ name: 'Generic Gamepad',
9852
+ label: 'Generic Gamepad',
9853
+ vendorId: null,
9854
+ productId: null,
9855
+ productKey: null,
9856
+ };
9747
9857
  constructor(indexOrGamepad, channels, mappingOrDefinition) {
9748
- this.onConnect = new Signal();
9749
- this.onDisconnect = new Signal();
9750
- this.onUpdate = new Signal();
9751
- this.browserGamepad = null;
9752
- this.info = {
9753
- name: 'Generic Gamepad',
9754
- label: 'Generic Gamepad',
9755
- vendorId: null,
9756
- productId: null,
9757
- productKey: null,
9758
- };
9759
9858
  const isBrowserGamepad = typeof indexOrGamepad !== 'number';
9760
9859
  const gamepad = isBrowserGamepad ? indexOrGamepad : null;
9761
9860
  const index = isBrowserGamepad ? indexOrGamepad.index : indexOrGamepad;
9762
9861
  this.indexValue = index;
9763
9862
  this.channelsValue = channels;
9764
- this.channelOffset = 512 /* ChannelOffset.Gamepads */ + (index * ChannelSize.Gamepad);
9863
+ this.channelOffset = ChannelOffset.Gamepads + (index * ChannelSize.Gamepad);
9765
9864
  this.mappingValue = gamepad
9766
9865
  ? mappingOrDefinition.mapping
9767
9866
  : mappingOrDefinition;
@@ -9873,10 +9972,10 @@ class Gamepad {
9873
9972
  this.onUpdate.destroy();
9874
9973
  }
9875
9974
  resolveChannelOffset(channel) {
9876
- return this.channelOffset + (channel ^ 512 /* ChannelOffset.Gamepads */);
9975
+ return this.channelOffset + (channel ^ ChannelOffset.Gamepads);
9877
9976
  }
9878
9977
  static resolveChannelOffset(gamepadIndex, channel) {
9879
- return 512 /* ChannelOffset.Gamepads */ + (gamepadIndex * ChannelSize.Gamepad) + (channel ^ 512 /* ChannelOffset.Gamepads */);
9978
+ return ChannelOffset.Gamepads + (gamepadIndex * ChannelSize.Gamepad) + (channel ^ ChannelOffset.Gamepads);
9880
9979
  }
9881
9980
  clearMappedChannels() {
9882
9981
  for (const control of this.mappingValue.buttons) {
@@ -9909,10 +10008,19 @@ var PointerState;
9909
10008
  PointerState[PointerState["Cancelled"] = 6] = "Cancelled";
9910
10009
  })(PointerState || (PointerState = {}));
9911
10010
  class Pointer {
10011
+ id;
10012
+ type;
10013
+ position;
10014
+ startPos = new Vector(-1, -1);
10015
+ size;
10016
+ tilt;
10017
+ stateFlags = new Flags();
10018
+ _canvas;
10019
+ _buttons;
10020
+ _pressure;
10021
+ _rotation;
10022
+ _currentState = PointerState.Unknown;
9912
10023
  constructor(event, canvas) {
9913
- this.startPos = new Vector(-1, -1);
9914
- this.stateFlags = new Flags();
9915
- this._currentState = PointerState.Unknown;
9916
10024
  const { pointerId, pointerType, clientX, clientY, width, height, tiltX, tiltY, buttons, pressure, twist } = event;
9917
10025
  const { left, top } = canvas.getBoundingClientRect();
9918
10026
  this._canvas = canvas;
@@ -10042,6 +10150,11 @@ var GamepadChannel;
10042
10150
  })(GamepadChannel || (GamepadChannel = {}));
10043
10151
 
10044
10152
  class GamepadControl {
10153
+ index;
10154
+ channel;
10155
+ invert;
10156
+ normalize;
10157
+ threshold;
10045
10158
  constructor(index, channel, options = {}) {
10046
10159
  this.index = index;
10047
10160
  this.channel = channel;
@@ -10074,6 +10187,8 @@ var GamepadMappingFamily;
10074
10187
  GamepadMappingFamily["ArcadeStick"] = "arcadeStick";
10075
10188
  })(GamepadMappingFamily || (GamepadMappingFamily = {}));
10076
10189
  class GamepadMapping {
10190
+ buttons;
10191
+ axes;
10077
10192
  constructor(buttons, axes) {
10078
10193
  this.buttons = buttons;
10079
10194
  this.axes = axes;
@@ -10105,9 +10220,9 @@ const arcadeStickButtonDefinitions = [
10105
10220
  [16, GamepadChannel.Guide],
10106
10221
  ];
10107
10222
  class ArcadeStickGamepadMapping extends GamepadMapping {
10223
+ family = GamepadMappingFamily.ArcadeStick;
10108
10224
  constructor() {
10109
10225
  super(GamepadMapping.createControls(arcadeStickButtonDefinitions), []);
10110
- this.family = GamepadMappingFamily.ArcadeStick;
10111
10226
  }
10112
10227
  }
10113
10228
 
@@ -10153,59 +10268,38 @@ const genericDualAnalogAxisDefinitions = [
10153
10268
  [7, GamepadChannel.AuxiliaryAxis3Positive],
10154
10269
  ];
10155
10270
  class GenericDualAnalogGamepadMapping extends GamepadMapping {
10271
+ family = GamepadMappingFamily.GenericDualAnalog;
10156
10272
  constructor() {
10157
10273
  super(GamepadMapping.createControls(genericDualAnalogButtonDefinitions), GamepadMapping.createControls(genericDualAnalogAxisDefinitions));
10158
- this.family = GamepadMappingFamily.GenericDualAnalog;
10159
10274
  }
10160
10275
  }
10161
10276
 
10162
10277
  class GameCubeGamepadMapping extends GenericDualAnalogGamepadMapping {
10163
- constructor() {
10164
- super(...arguments);
10165
- this.family = GamepadMappingFamily.GameCube;
10166
- }
10278
+ family = GamepadMappingFamily.GameCube;
10167
10279
  }
10168
10280
 
10169
10281
  class JoyConLeftGamepadMapping extends GenericDualAnalogGamepadMapping {
10170
- constructor() {
10171
- super(...arguments);
10172
- this.family = GamepadMappingFamily.JoyConLeft;
10173
- }
10282
+ family = GamepadMappingFamily.JoyConLeft;
10174
10283
  }
10175
10284
 
10176
10285
  class JoyConRightGamepadMapping extends GenericDualAnalogGamepadMapping {
10177
- constructor() {
10178
- super(...arguments);
10179
- this.family = GamepadMappingFamily.JoyConRight;
10180
- }
10286
+ family = GamepadMappingFamily.JoyConRight;
10181
10287
  }
10182
10288
 
10183
10289
  class PlayStationGamepadMapping extends GenericDualAnalogGamepadMapping {
10184
- constructor() {
10185
- super(...arguments);
10186
- this.family = GamepadMappingFamily.PlayStation;
10187
- }
10290
+ family = GamepadMappingFamily.PlayStation;
10188
10291
  }
10189
10292
 
10190
10293
  class SteamControllerGamepadMapping extends GenericDualAnalogGamepadMapping {
10191
- constructor() {
10192
- super(...arguments);
10193
- this.family = GamepadMappingFamily.SteamController;
10194
- }
10294
+ family = GamepadMappingFamily.SteamController;
10195
10295
  }
10196
10296
 
10197
10297
  class SwitchProGamepadMapping extends GenericDualAnalogGamepadMapping {
10198
- constructor() {
10199
- super(...arguments);
10200
- this.family = GamepadMappingFamily.SwitchPro;
10201
- }
10298
+ family = GamepadMappingFamily.SwitchPro;
10202
10299
  }
10203
10300
 
10204
10301
  class XboxGamepadMapping extends GenericDualAnalogGamepadMapping {
10205
- constructor() {
10206
- super(...arguments);
10207
- this.family = GamepadMappingFamily.Xbox;
10208
- }
10302
+ family = GamepadMappingFamily.Xbox;
10209
10303
  }
10210
10304
 
10211
10305
  const vendorProductPattern = /vendor[:\s]*([0-9a-f]{4})\s*product[:\s]*([0-9a-f]{4})/i;
@@ -10380,43 +10474,47 @@ var InputManagerFlag;
10380
10474
  InputManagerFlag[InputManagerFlag["PointerUpdate"] = 8] = "PointerUpdate";
10381
10475
  })(InputManagerFlag || (InputManagerFlag = {}));
10382
10476
  class InputManager {
10477
+ canvas;
10478
+ channels = new Float32Array(ChannelSize.Container);
10479
+ inputs = new Set();
10480
+ pointers = {};
10481
+ gamepadsValue = [];
10482
+ gamepadsByIndex = new Map();
10483
+ gamepadSlotsActive = new Uint8Array(ChannelSize.Category / ChannelSize.Gamepad);
10484
+ wheelOffset = new Vector();
10485
+ flags = new Flags();
10486
+ channelsPressed = [];
10487
+ channelsReleased = [];
10488
+ gamepadDefinitions;
10489
+ canvasFocusedValue;
10490
+ pointerDistanceThreshold;
10491
+ keyDownHandler = this.handleKeyDown.bind(this);
10492
+ keyUpHandler = this.handleKeyUp.bind(this);
10493
+ canvasFocusHandler = this.handleCanvasFocus.bind(this);
10494
+ canvasBlurHandler = this.handleCanvasBlur.bind(this);
10495
+ windowBlurHandler = this.handleWindowBlur.bind(this);
10496
+ mouseWheelHandler = this.handleMouseWheel.bind(this);
10497
+ pointerOverHandler = this.handlePointerOver.bind(this);
10498
+ pointerLeaveHandler = this.handlePointerLeave.bind(this);
10499
+ pointerDownHandler = this.handlePointerDown.bind(this);
10500
+ pointerMoveHandler = this.handlePointerMove.bind(this);
10501
+ pointerUpHandler = this.handlePointerUp.bind(this);
10502
+ pointerCancelHandler = this.handlePointerCancel.bind(this);
10503
+ onPointerEnter = new Signal();
10504
+ onPointerLeave = new Signal();
10505
+ onPointerDown = new Signal();
10506
+ onPointerMove = new Signal();
10507
+ onPointerUp = new Signal();
10508
+ onPointerTap = new Signal();
10509
+ onPointerSwipe = new Signal();
10510
+ onPointerCancel = new Signal();
10511
+ onMouseWheel = new Signal();
10512
+ onKeyDown = new Signal();
10513
+ onKeyUp = new Signal();
10514
+ onGamepadConnected = new Signal();
10515
+ onGamepadDisconnected = new Signal();
10516
+ onGamepadUpdated = new Signal();
10383
10517
  constructor(app) {
10384
- this.channels = new Float32Array(ChannelSize.Container);
10385
- this.inputs = new Set();
10386
- this.pointers = {};
10387
- this.gamepadsValue = [];
10388
- this.gamepadsByIndex = new Map();
10389
- this.gamepadSlotsActive = new Uint8Array(ChannelSize.Category / ChannelSize.Gamepad);
10390
- this.wheelOffset = new Vector();
10391
- this.flags = new Flags();
10392
- this.channelsPressed = [];
10393
- this.channelsReleased = [];
10394
- this.keyDownHandler = this.handleKeyDown.bind(this);
10395
- this.keyUpHandler = this.handleKeyUp.bind(this);
10396
- this.canvasFocusHandler = this.handleCanvasFocus.bind(this);
10397
- this.canvasBlurHandler = this.handleCanvasBlur.bind(this);
10398
- this.windowBlurHandler = this.handleWindowBlur.bind(this);
10399
- this.mouseWheelHandler = this.handleMouseWheel.bind(this);
10400
- this.pointerOverHandler = this.handlePointerOver.bind(this);
10401
- this.pointerLeaveHandler = this.handlePointerLeave.bind(this);
10402
- this.pointerDownHandler = this.handlePointerDown.bind(this);
10403
- this.pointerMoveHandler = this.handlePointerMove.bind(this);
10404
- this.pointerUpHandler = this.handlePointerUp.bind(this);
10405
- this.pointerCancelHandler = this.handlePointerCancel.bind(this);
10406
- this.onPointerEnter = new Signal();
10407
- this.onPointerLeave = new Signal();
10408
- this.onPointerDown = new Signal();
10409
- this.onPointerMove = new Signal();
10410
- this.onPointerUp = new Signal();
10411
- this.onPointerTap = new Signal();
10412
- this.onPointerSwipe = new Signal();
10413
- this.onPointerCancel = new Signal();
10414
- this.onMouseWheel = new Signal();
10415
- this.onKeyDown = new Signal();
10416
- this.onKeyUp = new Signal();
10417
- this.onGamepadConnected = new Signal();
10418
- this.onGamepadDisconnected = new Signal();
10419
- this.onGamepadUpdated = new Signal();
10420
10518
  const { gamepadDefinitions = [], pointerDistanceThreshold } = app.options;
10421
10519
  this.canvas = app.canvas;
10422
10520
  this.canvasFocusedValue = document.activeElement === this.canvas;
@@ -10503,13 +10601,13 @@ class InputManager {
10503
10601
  this.onGamepadUpdated.destroy();
10504
10602
  }
10505
10603
  handleKeyDown(event) {
10506
- const channel = 0 /* ChannelOffset.Keyboard */ + event.keyCode;
10604
+ const channel = ChannelOffset.Keyboard + event.keyCode;
10507
10605
  this.channels[channel] = 1;
10508
10606
  this.channelsPressed.push(channel);
10509
10607
  this.flags.push(InputManagerFlag.KeyDown);
10510
10608
  }
10511
10609
  handleKeyUp(event) {
10512
- const channel = 0 /* ChannelOffset.Keyboard */ + event.keyCode;
10610
+ const channel = ChannelOffset.Keyboard + event.keyCode;
10513
10611
  this.channels[channel] = 0;
10514
10612
  this.channelsReleased.push(channel);
10515
10613
  this.flags.push(InputManagerFlag.KeyUp);
@@ -10702,6 +10800,13 @@ class InputManager {
10702
10800
  }
10703
10801
 
10704
10802
  class AbstractMedia {
10803
+ onStart = new Signal();
10804
+ onStop = new Signal();
10805
+ _duration;
10806
+ _volume;
10807
+ _playbackRate;
10808
+ _loop;
10809
+ _muted;
10705
10810
  get duration() {
10706
10811
  return this._duration;
10707
10812
  }
@@ -10752,8 +10857,6 @@ class AbstractMedia {
10752
10857
  }
10753
10858
  }
10754
10859
  constructor(initialState) {
10755
- this.onStart = new Signal();
10756
- this.onStop = new Signal();
10757
10860
  const { duration, volume, playbackRate, loop, muted } = initialState;
10758
10861
  this._duration = duration;
10759
10862
  this._volume = volume;
@@ -10907,9 +11010,10 @@ const getOfflineAudioContext = () => getOrCreateOfflineAudioContext();
10907
11010
  const decodeAudioData = async (arrayBuffer) => getOrCreateOfflineAudioContext().decodeAudioData(arrayBuffer);
10908
11011
 
10909
11012
  class Music extends AbstractMedia {
11013
+ _audioElement;
11014
+ _audioSetup = null;
10910
11015
  constructor(audioElement, options) {
10911
11016
  super(audioElement);
10912
- this._audioSetup = null;
10913
11017
  this._audioElement = audioElement;
10914
11018
  if (options) {
10915
11019
  this.applyOptions(options);
@@ -11019,6 +11123,16 @@ class Music extends AbstractMedia {
11019
11123
  }
11020
11124
 
11021
11125
  class Sound extends AbstractMedia {
11126
+ _audioBuffer;
11127
+ _pooledSources = [];
11128
+ _queuedPooledPlays = [];
11129
+ _sprites = new Map();
11130
+ _audioSetup = null;
11131
+ _paused = true;
11132
+ _startTime = 0;
11133
+ _currentTime = 0;
11134
+ _sourceNode = null;
11135
+ _poolSize = 1;
11022
11136
  get paused() {
11023
11137
  return this._paused;
11024
11138
  }
@@ -11047,15 +11161,6 @@ class Sound extends AbstractMedia {
11047
11161
  loop: false,
11048
11162
  muted: false,
11049
11163
  });
11050
- this._pooledSources = [];
11051
- this._queuedPooledPlays = [];
11052
- this._sprites = new Map();
11053
- this._audioSetup = null;
11054
- this._paused = true;
11055
- this._startTime = 0;
11056
- this._currentTime = 0;
11057
- this._sourceNode = null;
11058
- this._poolSize = 1;
11059
11164
  this._audioBuffer = audioBuffer;
11060
11165
  const { poolSize, sprites, ...playbackOptions } = options;
11061
11166
  this._poolSize = Math.max(1, Math.floor(poolSize ?? 1));
@@ -11406,18 +11511,23 @@ class Sound extends AbstractMedia {
11406
11511
  }
11407
11512
 
11408
11513
  class Video extends Sprite {
11514
+ onStart = new Signal();
11515
+ onStop = new Signal();
11516
+ _videoElement;
11517
+ _duration;
11518
+ _volume = 1;
11519
+ _playbackRate = 1;
11520
+ _loop = false;
11521
+ _muted = false;
11522
+ _audioSetup = null;
11523
+ _textureDirty = true;
11524
+ _lastVideoTime = Number.NaN;
11525
+ _videoFrameCallbackHandle = null;
11526
+ _onMetadataHandler;
11527
+ _onResizeHandler;
11528
+ _onVideoFrameHandler;
11409
11529
  constructor(videoElement, playbackOptions, samplerOptions) {
11410
11530
  super(new Texture(videoElement, samplerOptions));
11411
- this.onStart = new Signal();
11412
- this.onStop = new Signal();
11413
- this._volume = 1;
11414
- this._playbackRate = 1;
11415
- this._loop = false;
11416
- this._muted = false;
11417
- this._audioSetup = null;
11418
- this._textureDirty = true;
11419
- this._lastVideoTime = Number.NaN;
11420
- this._videoFrameCallbackHandle = null;
11421
11531
  const { duration, volume, playbackRate, loop, muted } = videoElement;
11422
11532
  this._videoElement = videoElement;
11423
11533
  this._duration = duration;
@@ -11716,9 +11826,7 @@ class VttAsset {
11716
11826
  }
11717
11827
 
11718
11828
  class FactoryRegistry {
11719
- constructor() {
11720
- this._factories = new Map();
11721
- }
11829
+ _factories = new Map();
11722
11830
  register(type, factory) {
11723
11831
  this._factories.set(type, factory);
11724
11832
  }
@@ -11758,9 +11866,7 @@ class FactoryRegistry {
11758
11866
  }
11759
11867
 
11760
11868
  class AbstractAssetFactory {
11761
- constructor() {
11762
- this._objectUrls = [];
11763
- }
11869
+ _objectUrls = [];
11764
11870
  createObjectUrl(blob) {
11765
11871
  const objectUrl = URL.createObjectURL(blob);
11766
11872
  this._objectUrls.push(objectUrl);
@@ -11782,11 +11888,8 @@ class AbstractAssetFactory {
11782
11888
  }
11783
11889
 
11784
11890
  class FontFactory extends AbstractAssetFactory {
11785
- constructor() {
11786
- super(...arguments);
11787
- this.storageName = 'font';
11788
- this._addedFontFaces = [];
11789
- }
11891
+ storageName = 'font';
11892
+ _addedFontFaces = [];
11790
11893
  async process(response) {
11791
11894
  return await response.arrayBuffer();
11792
11895
  }
@@ -11858,27 +11961,27 @@ const fileTypes = [
11858
11961
  mask: [0xFF, 0xFF, 0xFF],
11859
11962
  },
11860
11963
  {
11861
- mimeType: 'audio/basic',
11964
+ mimeType: '@/audio/basic',
11862
11965
  pattern: [0x2E, 0x73, 0x6E, 0x64],
11863
11966
  mask: [0xFF, 0xFF, 0xFF, 0xFF],
11864
11967
  },
11865
11968
  {
11866
- mimeType: 'audio/mpeg',
11969
+ mimeType: '@/audio/mpeg',
11867
11970
  pattern: [0x49, 0x44, 0x33],
11868
11971
  mask: [0xFF, 0xFF, 0xFF],
11869
11972
  },
11870
11973
  {
11871
- mimeType: 'audio/wave',
11974
+ mimeType: '@/audio/wave',
11872
11975
  pattern: [0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45],
11873
11976
  mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF],
11874
11977
  },
11875
11978
  {
11876
- mimeType: 'audio/midi',
11979
+ mimeType: '@/audio/midi',
11877
11980
  pattern: [0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06],
11878
11981
  mask: [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF],
11879
11982
  },
11880
11983
  {
11881
- mimeType: 'audio/aiff',
11984
+ mimeType: '@/audio/aiff',
11882
11985
  pattern: [0x46, 0x4F, 0x52, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x41, 0x49, 0x46, 0x46],
11883
11986
  mask: [0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF],
11884
11987
  },
@@ -11944,10 +12047,7 @@ const determineMimeType = (arrayBuffer) => {
11944
12047
  };
11945
12048
 
11946
12049
  class ImageFactory extends AbstractAssetFactory {
11947
- constructor() {
11948
- super(...arguments);
11949
- this.storageName = 'image';
11950
- }
12050
+ storageName = 'image';
11951
12051
  async process(response) {
11952
12052
  return await response.arrayBuffer();
11953
12053
  }
@@ -11977,10 +12077,7 @@ class ImageFactory extends AbstractAssetFactory {
11977
12077
  }
11978
12078
 
11979
12079
  class JsonFactory extends AbstractAssetFactory {
11980
- constructor() {
11981
- super(...arguments);
11982
- this.storageName = 'json';
11983
- }
12080
+ storageName = 'json';
11984
12081
  async process(response) {
11985
12082
  return await response.json();
11986
12083
  }
@@ -11991,11 +12088,8 @@ class JsonFactory extends AbstractAssetFactory {
11991
12088
 
11992
12089
  const onceListenerOption$1 = { once: true };
11993
12090
  class MusicFactory extends AbstractAssetFactory {
11994
- constructor() {
11995
- super(...arguments);
11996
- this.storageName = 'music';
11997
- this._audioElements = [];
11998
- }
12091
+ storageName = 'music';
12092
+ _audioElements = [];
11999
12093
  async process(response) {
12000
12094
  return await response.arrayBuffer();
12001
12095
  }
@@ -12024,10 +12118,7 @@ class MusicFactory extends AbstractAssetFactory {
12024
12118
  }
12025
12119
 
12026
12120
  class SoundFactory extends AbstractAssetFactory {
12027
- constructor() {
12028
- super(...arguments);
12029
- this.storageName = 'sound';
12030
- }
12121
+ storageName = 'sound';
12031
12122
  async process(response) {
12032
12123
  return await response.arrayBuffer();
12033
12124
  }
@@ -12043,10 +12134,7 @@ class SoundFactory extends AbstractAssetFactory {
12043
12134
  }
12044
12135
 
12045
12136
  class TextFactory extends AbstractAssetFactory {
12046
- constructor() {
12047
- super(...arguments);
12048
- this.storageName = 'text';
12049
- }
12137
+ storageName = 'text';
12050
12138
  async process(response) {
12051
12139
  return await response.text();
12052
12140
  }
@@ -12056,10 +12144,7 @@ class TextFactory extends AbstractAssetFactory {
12056
12144
  }
12057
12145
 
12058
12146
  class TextureFactory extends AbstractAssetFactory {
12059
- constructor() {
12060
- super(...arguments);
12061
- this.storageName = 'texture';
12062
- }
12147
+ storageName = 'texture';
12063
12148
  async process(response) {
12064
12149
  return await response.arrayBuffer();
12065
12150
  }
@@ -12091,11 +12176,8 @@ class TextureFactory extends AbstractAssetFactory {
12091
12176
 
12092
12177
  const onceListenerOption = { once: true };
12093
12178
  class VideoFactory extends AbstractAssetFactory {
12094
- constructor() {
12095
- super(...arguments);
12096
- this.storageName = 'video';
12097
- this._videoElements = [];
12098
- }
12179
+ storageName = 'video';
12180
+ _videoElements = [];
12099
12181
  async process(response) {
12100
12182
  return await response.arrayBuffer();
12101
12183
  }
@@ -12127,10 +12209,7 @@ class VideoFactory extends AbstractAssetFactory {
12127
12209
  }
12128
12210
 
12129
12211
  class SvgFactory extends AbstractAssetFactory {
12130
- constructor() {
12131
- super(...arguments);
12132
- this.storageName = 'svg';
12133
- }
12212
+ storageName = 'svg';
12134
12213
  async process(response) {
12135
12214
  return await response.text();
12136
12215
  }
@@ -12160,10 +12239,7 @@ class SvgFactory extends AbstractAssetFactory {
12160
12239
  }
12161
12240
 
12162
12241
  class BinaryFactory extends AbstractAssetFactory {
12163
- constructor() {
12164
- super(...arguments);
12165
- this.storageName = 'binary';
12166
- }
12242
+ storageName = 'binary';
12167
12243
  async process(response) {
12168
12244
  return response.arrayBuffer();
12169
12245
  }
@@ -12173,10 +12249,7 @@ class BinaryFactory extends AbstractAssetFactory {
12173
12249
  }
12174
12250
 
12175
12251
  class WasmFactory extends AbstractAssetFactory {
12176
- constructor() {
12177
- super(...arguments);
12178
- this.storageName = 'wasm';
12179
- }
12252
+ storageName = 'wasm';
12180
12253
  async process(response) {
12181
12254
  return response.arrayBuffer();
12182
12255
  }
@@ -12200,10 +12273,7 @@ const parseTimestamp = (value) => {
12200
12273
  return seconds;
12201
12274
  };
12202
12275
  class VttFactory extends AbstractAssetFactory {
12203
- constructor() {
12204
- super(...arguments);
12205
- this.storageName = 'vtt';
12206
- }
12276
+ storageName = 'vtt';
12207
12277
  async process(response) {
12208
12278
  return response.text();
12209
12279
  }
@@ -12242,6 +12312,8 @@ class VttFactory extends AbstractAssetFactory {
12242
12312
  }
12243
12313
 
12244
12314
  class BundleLoadError extends Error {
12315
+ bundle;
12316
+ failures;
12245
12317
  constructor(bundle, failures) {
12246
12318
  super(`Failed to load bundle "${bundle}" (${failures.length} failure${failures.length === 1 ? '' : 's'}).`);
12247
12319
  this.name = 'BundleLoadError';
@@ -12307,24 +12379,28 @@ function describeType(type) {
12307
12379
  // Loader
12308
12380
  // ---------------------------------------------------------------------------
12309
12381
  class Loader {
12382
+ _registry = new FactoryRegistry();
12383
+ _resources = new Map();
12384
+ _manifest = new Map();
12385
+ _bundles = new Map();
12386
+ _inFlight = new Map();
12387
+ _typeIds = new WeakMap();
12388
+ _preventStoreKeys = new Set();
12389
+ _stores;
12390
+ _resourcePath;
12391
+ _requestOptions;
12392
+ _concurrency;
12393
+ _nextTypeId = 1;
12394
+ _backgroundQueue = [];
12395
+ _backgroundActive = 0;
12396
+ _backgroundTotal = 0;
12397
+ _backgroundLoaded = 0;
12398
+ _backgroundResolve = null;
12399
+ onProgress = new Signal();
12400
+ onBundleProgress = new Signal();
12401
+ onLoaded = new Signal();
12402
+ onError = new Signal();
12310
12403
  constructor(options = {}) {
12311
- this._registry = new FactoryRegistry();
12312
- this._resources = new Map();
12313
- this._manifest = new Map();
12314
- this._bundles = new Map();
12315
- this._inFlight = new Map();
12316
- this._typeIds = new WeakMap();
12317
- this._preventStoreKeys = new Set();
12318
- this._nextTypeId = 1;
12319
- this._backgroundQueue = [];
12320
- this._backgroundActive = 0;
12321
- this._backgroundTotal = 0;
12322
- this._backgroundLoaded = 0;
12323
- this._backgroundResolve = null;
12324
- this.onProgress = new Signal();
12325
- this.onBundleProgress = new Signal();
12326
- this.onLoaded = new Signal();
12327
- this.onError = new Signal();
12328
12404
  this._resourcePath = options.resourcePath ?? '';
12329
12405
  this._requestOptions = options.requestOptions ?? {};
12330
12406
  this._concurrency = options.concurrency ?? 6;
@@ -12914,14 +12990,22 @@ const defaultAppSettings = {
12914
12990
  backend: defaultBackendConfig,
12915
12991
  };
12916
12992
  class Application {
12993
+ options;
12994
+ canvas;
12995
+ loader;
12996
+ inputManager;
12997
+ sceneManager;
12998
+ onResize = new Signal();
12999
+ _updateHandler;
13000
+ _startupClock = new Clock();
13001
+ _activeClock = new Clock();
13002
+ _frameClock = new Clock();
13003
+ _status = ApplicationStatus.Stopped;
13004
+ _frameCount = 0;
13005
+ _frameRequest = 0;
13006
+ _backendType;
13007
+ _renderManager;
12917
13008
  constructor(appSettings) {
12918
- this.onResize = new Signal();
12919
- this._startupClock = new Clock();
12920
- this._activeClock = new Clock();
12921
- this._frameClock = new Clock();
12922
- this._status = ApplicationStatus.Stopped;
12923
- this._frameCount = 0;
12924
- this._frameRequest = 0;
12925
13009
  this.options = {
12926
13010
  canvas: appSettings?.canvas ?? createDefaultCanvas(),
12927
13011
  ...defaultAppSettings,
@@ -13065,9 +13149,13 @@ class Application {
13065
13149
  }
13066
13150
 
13067
13151
  class Quadtree {
13152
+ static maxSceneNodes = 50;
13153
+ static maxLevel = 5;
13154
+ level;
13155
+ _bounds;
13156
+ _quadTrees = new Map();
13157
+ _sceneNodes = new Set();
13068
13158
  constructor(bounds, level = 0) {
13069
- this._quadTrees = new Map();
13070
- this._sceneNodes = new Set();
13071
13159
  this._bounds = bounds.clone();
13072
13160
  this.level = level;
13073
13161
  }
@@ -13141,17 +13229,12 @@ class Quadtree {
13141
13229
  }
13142
13230
  }
13143
13231
  }
13144
- Quadtree.maxSceneNodes = 50;
13145
- Quadtree.maxLevel = 5;
13146
13232
 
13147
13233
  class Container extends RenderNode {
13148
- constructor() {
13149
- super(...arguments);
13150
- this._children = [];
13151
- this._sortableChildren = false;
13152
- this._sortDirty = false;
13153
- this._nextChildOrder = 0;
13154
- }
13234
+ _children = [];
13235
+ _sortableChildren = false;
13236
+ _sortDirty = false;
13237
+ _nextChildOrder = 0;
13155
13238
  get children() {
13156
13239
  return this._children;
13157
13240
  }
@@ -13340,15 +13423,14 @@ class Container extends RenderNode {
13340
13423
  }
13341
13424
 
13342
13425
  class Scene {
13426
+ _app = null;
13427
+ _root = new Container();
13428
+ _stackMode = 'overlay';
13429
+ _inputMode = 'capture';
13343
13430
  static create(definition) {
13344
13431
  return Object.assign(new Scene(), definition);
13345
13432
  }
13346
- constructor() {
13347
- this._app = null;
13348
- this._root = new Container();
13349
- this._stackMode = 'overlay';
13350
- this._inputMode = 'capture';
13351
- }
13433
+ constructor() { }
13352
13434
  get app() {
13353
13435
  return this._app;
13354
13436
  }
@@ -13418,6 +13500,7 @@ class Scene {
13418
13500
  }
13419
13501
 
13420
13502
  class Timer extends Clock {
13503
+ _limit;
13421
13504
  constructor(limit, autoStart = false) {
13422
13505
  super();
13423
13506
  this._limit = limit.clone();
@@ -13446,10 +13529,20 @@ class Timer extends Clock {
13446
13529
  }
13447
13530
 
13448
13531
  class AudioAnalyser {
13532
+ _media;
13533
+ _fftSize;
13534
+ _minDecibels;
13535
+ _maxDecibels;
13536
+ _smoothingTimeConstant;
13537
+ _frequencyBinCount;
13538
+ _timeDomainData;
13539
+ _frequencyData;
13540
+ _preciseTimeDomainData;
13541
+ _preciseFrequencyData;
13542
+ _analyser = null;
13543
+ _audioContext = null;
13544
+ _analyserTarget = null;
13449
13545
  constructor(media, options = {}) {
13450
- this._analyser = null;
13451
- this._audioContext = null;
13452
- this._analyserTarget = null;
13453
13546
  const { fftSize, minDecibels, maxDecibels, smoothingTimeConstant } = options;
13454
13547
  this._media = media;
13455
13548
  this._fftSize = fftSize ?? 2048;
@@ -13628,6 +13721,25 @@ const promptLabelsByFamily = new Map([
13628
13721
  [GamepadMappingFamily.ArcadeStick, genericLabels],
13629
13722
  ]);
13630
13723
  class GamepadPromptLayouts {
13724
+ static controls = [
13725
+ 'DPad',
13726
+ 'DPadUp',
13727
+ 'DPadDown',
13728
+ 'DPadLeft',
13729
+ 'DPadRight',
13730
+ 'ButtonNorth',
13731
+ 'ButtonWest',
13732
+ 'ButtonEast',
13733
+ 'ButtonSouth',
13734
+ 'LeftShoulder',
13735
+ 'RightShoulder',
13736
+ 'LeftTrigger',
13737
+ 'RightTrigger',
13738
+ 'Select',
13739
+ 'Start',
13740
+ 'LeftStick',
13741
+ 'RightStick',
13742
+ ];
13631
13743
  static getControlPosition(control) {
13632
13744
  return basePositions.get(control) ?? [0.5, 0.5];
13633
13745
  }
@@ -13638,34 +13750,17 @@ class GamepadPromptLayouts {
13638
13750
  return channelMap;
13639
13751
  }
13640
13752
  }
13641
- GamepadPromptLayouts.controls = [
13642
- 'DPad',
13643
- 'DPadUp',
13644
- 'DPadDown',
13645
- 'DPadLeft',
13646
- 'DPadRight',
13647
- 'ButtonNorth',
13648
- 'ButtonWest',
13649
- 'ButtonEast',
13650
- 'ButtonSouth',
13651
- 'LeftShoulder',
13652
- 'RightShoulder',
13653
- 'LeftTrigger',
13654
- 'RightTrigger',
13655
- 'Select',
13656
- 'Start',
13657
- 'LeftStick',
13658
- 'RightStick',
13659
- ];
13660
13753
 
13661
13754
  class Input {
13755
+ static triggerThreshold = 300;
13756
+ channels = new Set();
13757
+ triggerTimer;
13758
+ valueState = 0;
13759
+ onStart = new Signal();
13760
+ onStop = new Signal();
13761
+ onActive = new Signal();
13762
+ onTrigger = new Signal();
13662
13763
  constructor(channels, { onStart, onStop, onActive, onTrigger, context, threshold } = {}) {
13663
- this.channels = new Set();
13664
- this.valueState = 0;
13665
- this.onStart = new Signal();
13666
- this.onStop = new Signal();
13667
- this.onActive = new Signal();
13668
- this.onTrigger = new Signal();
13669
13764
  this.channels = new Set(Array.isArray(channels) ? channels : [channels]);
13670
13765
  this.triggerTimer = new Timer(milliseconds(threshold ?? Input.triggerThreshold));
13671
13766
  if (onStart) {
@@ -13717,704 +13812,638 @@ class Input {
13717
13812
  this.onTrigger.destroy();
13718
13813
  }
13719
13814
  }
13720
- Input.triggerThreshold = 300;
13721
13815
 
13722
- function getDefaultExportFromCjs (x) {
13723
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
13816
+ function earcut(data, holeIndices, dim = 2) {
13817
+
13818
+ const hasHoles = holeIndices && holeIndices.length;
13819
+ const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
13820
+ let outerNode = linkedList(data, 0, outerLen, dim, true);
13821
+ const triangles = [];
13822
+
13823
+ if (!outerNode || outerNode.next === outerNode.prev) return triangles;
13824
+
13825
+ let minX, minY, invSize;
13826
+
13827
+ if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
13828
+
13829
+ // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
13830
+ if (data.length > 80 * dim) {
13831
+ minX = data[0];
13832
+ minY = data[1];
13833
+ let maxX = minX;
13834
+ let maxY = minY;
13835
+
13836
+ for (let i = dim; i < outerLen; i += dim) {
13837
+ const x = data[i];
13838
+ const y = data[i + 1];
13839
+ if (x < minX) minX = x;
13840
+ if (y < minY) minY = y;
13841
+ if (x > maxX) maxX = x;
13842
+ if (y > maxY) maxY = y;
13843
+ }
13844
+
13845
+ // minX, minY and invSize are later used to transform coords into integers for z-order calculation
13846
+ invSize = Math.max(maxX - minX, maxY - minY);
13847
+ invSize = invSize !== 0 ? 32767 / invSize : 0;
13848
+ }
13849
+
13850
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
13851
+
13852
+ return triangles;
13724
13853
  }
13725
13854
 
13726
- var earcut$1 = {exports: {}};
13855
+ // create a circular doubly linked list from polygon points in the specified winding order
13856
+ function linkedList(data, start, end, dim, clockwise) {
13857
+ let last;
13727
13858
 
13728
- var hasRequiredEarcut;
13859
+ if (clockwise === (signedArea(data, start, end, dim) > 0)) {
13860
+ for (let i = start; i < end; i += dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
13861
+ } else {
13862
+ for (let i = end - dim; i >= start; i -= dim) last = insertNode(i / dim | 0, data[i], data[i + 1], last);
13863
+ }
13729
13864
 
13730
- function requireEarcut () {
13731
- if (hasRequiredEarcut) return earcut$1.exports;
13732
- hasRequiredEarcut = 1;
13865
+ if (last && equals(last, last.next)) {
13866
+ removeNode(last);
13867
+ last = last.next;
13868
+ }
13733
13869
 
13734
- earcut$1.exports = earcut;
13735
- earcut$1.exports.default = earcut;
13870
+ return last;
13871
+ }
13736
13872
 
13737
- function earcut(data, holeIndices, dim) {
13873
+ // eliminate colinear or duplicate points
13874
+ function filterPoints(start, end) {
13875
+ if (!start) return start;
13876
+ if (!end) end = start;
13738
13877
 
13739
- dim = dim || 2;
13878
+ let p = start,
13879
+ again;
13880
+ do {
13881
+ again = false;
13740
13882
 
13741
- var hasHoles = holeIndices && holeIndices.length,
13742
- outerLen = hasHoles ? holeIndices[0] * dim : data.length,
13743
- outerNode = linkedList(data, 0, outerLen, dim, true),
13744
- triangles = [];
13883
+ if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
13884
+ removeNode(p);
13885
+ p = end = p.prev;
13886
+ if (p === p.next) break;
13887
+ again = true;
13745
13888
 
13746
- if (!outerNode || outerNode.next === outerNode.prev) return triangles;
13889
+ } else {
13890
+ p = p.next;
13891
+ }
13892
+ } while (again || p !== end);
13747
13893
 
13748
- var minX, minY, maxX, maxY, x, y, invSize;
13894
+ return end;
13895
+ }
13749
13896
 
13750
- if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
13897
+ // main ear slicing loop which triangulates a polygon (given as a linked list)
13898
+ function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
13899
+ if (!ear) return;
13751
13900
 
13752
- // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
13753
- if (data.length > 80 * dim) {
13754
- minX = maxX = data[0];
13755
- minY = maxY = data[1];
13901
+ // interlink polygon nodes in z-order
13902
+ if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
13756
13903
 
13757
- for (var i = dim; i < outerLen; i += dim) {
13758
- x = data[i];
13759
- y = data[i + 1];
13760
- if (x < minX) minX = x;
13761
- if (y < minY) minY = y;
13762
- if (x > maxX) maxX = x;
13763
- if (y > maxY) maxY = y;
13764
- }
13904
+ let stop = ear;
13765
13905
 
13766
- // minX, minY and invSize are later used to transform coords into integers for z-order calculation
13767
- invSize = Math.max(maxX - minX, maxY - minY);
13768
- invSize = invSize !== 0 ? 32767 / invSize : 0;
13769
- }
13906
+ // iterate through ears, slicing them one by one
13907
+ while (ear.prev !== ear.next) {
13908
+ const prev = ear.prev;
13909
+ const next = ear.next;
13770
13910
 
13771
- earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
13911
+ if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
13912
+ triangles.push(prev.i, ear.i, next.i); // cut off the triangle
13772
13913
 
13773
- return triangles;
13774
- }
13914
+ removeNode(ear);
13775
13915
 
13776
- // create a circular doubly linked list from polygon points in the specified winding order
13777
- function linkedList(data, start, end, dim, clockwise) {
13778
- var i, last;
13916
+ // skipping the next vertex leads to less sliver triangles
13917
+ ear = next.next;
13918
+ stop = next.next;
13779
13919
 
13780
- if (clockwise === (signedArea(data, start, end, dim) > 0)) {
13781
- for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);
13782
- } else {
13783
- for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);
13784
- }
13920
+ continue;
13921
+ }
13785
13922
 
13786
- if (last && equals(last, last.next)) {
13787
- removeNode(last);
13788
- last = last.next;
13789
- }
13923
+ ear = next;
13790
13924
 
13791
- return last;
13792
- }
13925
+ // if we looped through the whole remaining polygon and can't find any more ears
13926
+ if (ear === stop) {
13927
+ // try filtering points and slicing again
13928
+ if (!pass) {
13929
+ earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
13793
13930
 
13794
- // eliminate colinear or duplicate points
13795
- function filterPoints(start, end) {
13796
- if (!start) return start;
13797
- if (!end) end = start;
13931
+ // if this didn't work, try curing all small self-intersections locally
13932
+ } else if (pass === 1) {
13933
+ ear = cureLocalIntersections(filterPoints(ear), triangles);
13934
+ earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
13798
13935
 
13799
- var p = start,
13800
- again;
13801
- do {
13802
- again = false;
13936
+ // as a last resort, try splitting the remaining polygon into two
13937
+ } else if (pass === 2) {
13938
+ splitEarcut(ear, triangles, dim, minX, minY, invSize);
13939
+ }
13803
13940
 
13804
- if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
13805
- removeNode(p);
13806
- p = end = p.prev;
13807
- if (p === p.next) break;
13808
- again = true;
13941
+ break;
13942
+ }
13943
+ }
13944
+ }
13809
13945
 
13810
- } else {
13811
- p = p.next;
13812
- }
13813
- } while (again || p !== end);
13946
+ // check whether a polygon node forms a valid ear with adjacent nodes
13947
+ function isEar(ear) {
13948
+ const a = ear.prev,
13949
+ b = ear,
13950
+ c = ear.next;
13814
13951
 
13815
- return end;
13816
- }
13952
+ if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
13817
13953
 
13818
- // main ear slicing loop which triangulates a polygon (given as a linked list)
13819
- function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
13820
- if (!ear) return;
13954
+ // now make sure we don't have other points inside the potential ear
13955
+ const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
13821
13956
 
13822
- // interlink polygon nodes in z-order
13823
- if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
13957
+ // triangle bbox
13958
+ const x0 = Math.min(ax, bx, cx),
13959
+ y0 = Math.min(ay, by, cy),
13960
+ x1 = Math.max(ax, bx, cx),
13961
+ y1 = Math.max(ay, by, cy);
13824
13962
 
13825
- var stop = ear,
13826
- prev, next;
13963
+ let p = c.next;
13964
+ while (p !== a) {
13965
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&
13966
+ pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) &&
13967
+ area(p.prev, p, p.next) >= 0) return false;
13968
+ p = p.next;
13969
+ }
13827
13970
 
13828
- // iterate through ears, slicing them one by one
13829
- while (ear.prev !== ear.next) {
13830
- prev = ear.prev;
13831
- next = ear.next;
13832
-
13833
- if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
13834
- // cut off the triangle
13835
- triangles.push(prev.i / dim | 0);
13836
- triangles.push(ear.i / dim | 0);
13837
- triangles.push(next.i / dim | 0);
13838
-
13839
- removeNode(ear);
13840
-
13841
- // skipping the next vertex leads to less sliver triangles
13842
- ear = next.next;
13843
- stop = next.next;
13844
-
13845
- continue;
13846
- }
13847
-
13848
- ear = next;
13849
-
13850
- // if we looped through the whole remaining polygon and can't find any more ears
13851
- if (ear === stop) {
13852
- // try filtering points and slicing again
13853
- if (!pass) {
13854
- earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
13855
-
13856
- // if this didn't work, try curing all small self-intersections locally
13857
- } else if (pass === 1) {
13858
- ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
13859
- earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
13860
-
13861
- // as a last resort, try splitting the remaining polygon into two
13862
- } else if (pass === 2) {
13863
- splitEarcut(ear, triangles, dim, minX, minY, invSize);
13864
- }
13865
-
13866
- break;
13867
- }
13868
- }
13869
- }
13870
-
13871
- // check whether a polygon node forms a valid ear with adjacent nodes
13872
- function isEar(ear) {
13873
- var a = ear.prev,
13874
- b = ear,
13875
- c = ear.next;
13876
-
13877
- if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
13878
-
13879
- // now make sure we don't have other points inside the potential ear
13880
- var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
13881
-
13882
- // triangle bbox; min & max are calculated like this for speed
13883
- var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),
13884
- y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),
13885
- x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),
13886
- y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);
13887
-
13888
- var p = c.next;
13889
- while (p !== a) {
13890
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&
13891
- pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&
13892
- area(p.prev, p, p.next) >= 0) return false;
13893
- p = p.next;
13894
- }
13895
-
13896
- return true;
13897
- }
13898
-
13899
- function isEarHashed(ear, minX, minY, invSize) {
13900
- var a = ear.prev,
13901
- b = ear,
13902
- c = ear.next;
13903
-
13904
- if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
13905
-
13906
- var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
13907
-
13908
- // triangle bbox; min & max are calculated like this for speed
13909
- var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),
13910
- y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),
13911
- x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),
13912
- y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);
13913
-
13914
- // z-order range for the current triangle bbox;
13915
- var minZ = zOrder(x0, y0, minX, minY, invSize),
13916
- maxZ = zOrder(x1, y1, minX, minY, invSize);
13917
-
13918
- var p = ear.prevZ,
13919
- n = ear.nextZ;
13920
-
13921
- // look for points inside the triangle in both directions
13922
- while (p && p.z >= minZ && n && n.z <= maxZ) {
13923
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
13924
- pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
13925
- p = p.prevZ;
13926
-
13927
- if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
13928
- pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
13929
- n = n.nextZ;
13930
- }
13931
-
13932
- // look for remaining points in decreasing z-order
13933
- while (p && p.z >= minZ) {
13934
- if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
13935
- pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
13936
- p = p.prevZ;
13937
- }
13938
-
13939
- // look for remaining points in increasing z-order
13940
- while (n && n.z <= maxZ) {
13941
- if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
13942
- pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
13943
- n = n.nextZ;
13944
- }
13945
-
13946
- return true;
13947
- }
13948
-
13949
- // go through all polygon nodes and cure small local self-intersections
13950
- function cureLocalIntersections(start, triangles, dim) {
13951
- var p = start;
13952
- do {
13953
- var a = p.prev,
13954
- b = p.next.next;
13955
-
13956
- if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
13957
-
13958
- triangles.push(a.i / dim | 0);
13959
- triangles.push(p.i / dim | 0);
13960
- triangles.push(b.i / dim | 0);
13961
-
13962
- // remove two nodes involved
13963
- removeNode(p);
13964
- removeNode(p.next);
13965
-
13966
- p = start = b;
13967
- }
13968
- p = p.next;
13969
- } while (p !== start);
13970
-
13971
- return filterPoints(p);
13972
- }
13973
-
13974
- // try splitting polygon into two and triangulate them independently
13975
- function splitEarcut(start, triangles, dim, minX, minY, invSize) {
13976
- // look for a valid diagonal that divides the polygon into two
13977
- var a = start;
13978
- do {
13979
- var b = a.next.next;
13980
- while (b !== a.prev) {
13981
- if (a.i !== b.i && isValidDiagonal(a, b)) {
13982
- // split the polygon in two by the diagonal
13983
- var c = splitPolygon(a, b);
13984
-
13985
- // filter colinear points around the cuts
13986
- a = filterPoints(a, a.next);
13987
- c = filterPoints(c, c.next);
13988
-
13989
- // run earcut on each half
13990
- earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
13991
- earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
13992
- return;
13993
- }
13994
- b = b.next;
13995
- }
13996
- a = a.next;
13997
- } while (a !== start);
13998
- }
13999
-
14000
- // link every hole into the outer loop, producing a single-ring polygon without holes
14001
- function eliminateHoles(data, holeIndices, outerNode, dim) {
14002
- var queue = [],
14003
- i, len, start, end, list;
14004
-
14005
- for (i = 0, len = holeIndices.length; i < len; i++) {
14006
- start = holeIndices[i] * dim;
14007
- end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
14008
- list = linkedList(data, start, end, dim, false);
14009
- if (list === list.next) list.steiner = true;
14010
- queue.push(getLeftmost(list));
14011
- }
14012
-
14013
- queue.sort(compareX);
14014
-
14015
- // process holes from left to right
14016
- for (i = 0; i < queue.length; i++) {
14017
- outerNode = eliminateHole(queue[i], outerNode);
14018
- }
14019
-
14020
- return outerNode;
14021
- }
14022
-
14023
- function compareX(a, b) {
14024
- return a.x - b.x;
14025
- }
14026
-
14027
- // find a bridge between vertices that connects hole with an outer ring and and link it
14028
- function eliminateHole(hole, outerNode) {
14029
- var bridge = findHoleBridge(hole, outerNode);
14030
- if (!bridge) {
14031
- return outerNode;
14032
- }
14033
-
14034
- var bridgeReverse = splitPolygon(bridge, hole);
14035
-
14036
- // filter collinear points around the cuts
14037
- filterPoints(bridgeReverse, bridgeReverse.next);
14038
- return filterPoints(bridge, bridge.next);
14039
- }
14040
-
14041
- // David Eberly's algorithm for finding a bridge between hole and outer polygon
14042
- function findHoleBridge(hole, outerNode) {
14043
- var p = outerNode,
14044
- hx = hole.x,
14045
- hy = hole.y,
14046
- qx = -Infinity,
14047
- m;
14048
-
14049
- // find a segment intersected by a ray from the hole's leftmost point to the left;
14050
- // segment's endpoint with lesser x will be potential connection point
14051
- do {
14052
- if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
14053
- var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
14054
- if (x <= hx && x > qx) {
14055
- qx = x;
14056
- m = p.x < p.next.x ? p : p.next;
14057
- if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint
14058
- }
14059
- }
14060
- p = p.next;
14061
- } while (p !== outerNode);
14062
-
14063
- if (!m) return null;
14064
-
14065
- // look for points inside the triangle of hole point, segment intersection and endpoint;
14066
- // if there are no points found, we have a valid connection;
14067
- // otherwise choose the point of the minimum angle with the ray as connection point
14068
-
14069
- var stop = m,
14070
- mx = m.x,
14071
- my = m.y,
14072
- tanMin = Infinity,
14073
- tan;
14074
-
14075
- p = m;
14076
-
14077
- do {
14078
- if (hx >= p.x && p.x >= mx && hx !== p.x &&
14079
- pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
14080
-
14081
- tan = Math.abs(hy - p.y) / (hx - p.x); // tangential
14082
-
14083
- if (locallyInside(p, hole) &&
14084
- (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {
14085
- m = p;
14086
- tanMin = tan;
14087
- }
14088
- }
14089
-
14090
- p = p.next;
14091
- } while (p !== stop);
14092
-
14093
- return m;
14094
- }
14095
-
14096
- // whether sector in vertex m contains sector in vertex p in the same coordinates
14097
- function sectorContainsSector(m, p) {
14098
- return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
14099
- }
14100
-
14101
- // interlink polygon nodes in z-order
14102
- function indexCurve(start, minX, minY, invSize) {
14103
- var p = start;
14104
- do {
14105
- if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
14106
- p.prevZ = p.prev;
14107
- p.nextZ = p.next;
14108
- p = p.next;
14109
- } while (p !== start);
14110
-
14111
- p.prevZ.nextZ = null;
14112
- p.prevZ = null;
14113
-
14114
- sortLinked(p);
14115
- }
14116
-
14117
- // Simon Tatham's linked list merge sort algorithm
14118
- // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
14119
- function sortLinked(list) {
14120
- var i, p, q, e, tail, numMerges, pSize, qSize,
14121
- inSize = 1;
14122
-
14123
- do {
14124
- p = list;
14125
- list = null;
14126
- tail = null;
14127
- numMerges = 0;
14128
-
14129
- while (p) {
14130
- numMerges++;
14131
- q = p;
14132
- pSize = 0;
14133
- for (i = 0; i < inSize; i++) {
14134
- pSize++;
14135
- q = q.nextZ;
14136
- if (!q) break;
14137
- }
14138
- qSize = inSize;
14139
-
14140
- while (pSize > 0 || (qSize > 0 && q)) {
14141
-
14142
- if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
14143
- e = p;
14144
- p = p.nextZ;
14145
- pSize--;
14146
- } else {
14147
- e = q;
14148
- q = q.nextZ;
14149
- qSize--;
14150
- }
14151
-
14152
- if (tail) tail.nextZ = e;
14153
- else list = e;
14154
-
14155
- e.prevZ = tail;
14156
- tail = e;
14157
- }
14158
-
14159
- p = q;
14160
- }
14161
-
14162
- tail.nextZ = null;
14163
- inSize *= 2;
14164
-
14165
- } while (numMerges > 1);
14166
-
14167
- return list;
14168
- }
14169
-
14170
- // z-order of a point given coords and inverse of the longer side of data bbox
14171
- function zOrder(x, y, minX, minY, invSize) {
14172
- // coords are transformed into non-negative 15-bit integer range
14173
- x = (x - minX) * invSize | 0;
14174
- y = (y - minY) * invSize | 0;
14175
-
14176
- x = (x | (x << 8)) & 0x00FF00FF;
14177
- x = (x | (x << 4)) & 0x0F0F0F0F;
14178
- x = (x | (x << 2)) & 0x33333333;
14179
- x = (x | (x << 1)) & 0x55555555;
14180
-
14181
- y = (y | (y << 8)) & 0x00FF00FF;
14182
- y = (y | (y << 4)) & 0x0F0F0F0F;
14183
- y = (y | (y << 2)) & 0x33333333;
14184
- y = (y | (y << 1)) & 0x55555555;
14185
-
14186
- return x | (y << 1);
14187
- }
14188
-
14189
- // find the leftmost node of a polygon ring
14190
- function getLeftmost(start) {
14191
- var p = start,
14192
- leftmost = start;
14193
- do {
14194
- if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;
14195
- p = p.next;
14196
- } while (p !== start);
14197
-
14198
- return leftmost;
14199
- }
14200
-
14201
- // check if a point lies within a convex triangle
14202
- function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
14203
- return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&
14204
- (ax - px) * (by - py) >= (bx - px) * (ay - py) &&
14205
- (bx - px) * (cy - py) >= (cx - px) * (by - py);
14206
- }
14207
-
14208
- // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
14209
- function isValidDiagonal(a, b) {
14210
- return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges
14211
- (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
14212
- (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
14213
- equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
14214
- }
14215
-
14216
- // signed area of a triangle
14217
- function area(p, q, r) {
14218
- return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
14219
- }
14220
-
14221
- // check if two points are equal
14222
- function equals(p1, p2) {
14223
- return p1.x === p2.x && p1.y === p2.y;
14224
- }
14225
-
14226
- // check if two segments intersect
14227
- function intersects(p1, q1, p2, q2) {
14228
- var o1 = sign(area(p1, q1, p2));
14229
- var o2 = sign(area(p1, q1, q2));
14230
- var o3 = sign(area(p2, q2, p1));
14231
- var o4 = sign(area(p2, q2, q1));
14232
-
14233
- if (o1 !== o2 && o3 !== o4) return true; // general case
14234
-
14235
- if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1
14236
- if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1
14237
- if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2
14238
- if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2
14239
-
14240
- return false;
14241
- }
14242
-
14243
- // for collinear points p, q, r, check if point q lies on segment pr
14244
- function onSegment(p, q, r) {
14245
- return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
14246
- }
14247
-
14248
- function sign(num) {
14249
- return num > 0 ? 1 : num < 0 ? -1 : 0;
14250
- }
14251
-
14252
- // check if a polygon diagonal intersects any polygon segments
14253
- function intersectsPolygon(a, b) {
14254
- var p = a;
14255
- do {
14256
- if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&
14257
- intersects(p, p.next, a, b)) return true;
14258
- p = p.next;
14259
- } while (p !== a);
14260
-
14261
- return false;
14262
- }
14263
-
14264
- // check if a polygon diagonal is locally inside the polygon
14265
- function locallyInside(a, b) {
14266
- return area(a.prev, a, a.next) < 0 ?
14267
- area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :
14268
- area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
14269
- }
14270
-
14271
- // check if the middle point of a polygon diagonal is inside the polygon
14272
- function middleInside(a, b) {
14273
- var p = a,
14274
- inside = false,
14275
- px = (a.x + b.x) / 2,
14276
- py = (a.y + b.y) / 2;
14277
- do {
14278
- if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&
14279
- (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))
14280
- inside = !inside;
14281
- p = p.next;
14282
- } while (p !== a);
14283
-
14284
- return inside;
14285
- }
14286
-
14287
- // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
14288
- // if one belongs to the outer ring and another to a hole, it merges it into a single ring
14289
- function splitPolygon(a, b) {
14290
- var a2 = new Node(a.i, a.x, a.y),
14291
- b2 = new Node(b.i, b.x, b.y),
14292
- an = a.next,
14293
- bp = b.prev;
14294
-
14295
- a.next = b;
14296
- b.prev = a;
14297
-
14298
- a2.next = an;
14299
- an.prev = a2;
14300
-
14301
- b2.next = a2;
14302
- a2.prev = b2;
14303
-
14304
- bp.next = b2;
14305
- b2.prev = bp;
14306
-
14307
- return b2;
14308
- }
14309
-
14310
- // create a node and optionally link it with previous one (in a circular doubly linked list)
14311
- function insertNode(i, x, y, last) {
14312
- var p = new Node(i, x, y);
14313
-
14314
- if (!last) {
14315
- p.prev = p;
14316
- p.next = p;
14317
-
14318
- } else {
14319
- p.next = last.next;
14320
- p.prev = last;
14321
- last.next.prev = p;
14322
- last.next = p;
14323
- }
14324
- return p;
14325
- }
14326
-
14327
- function removeNode(p) {
14328
- p.next.prev = p.prev;
14329
- p.prev.next = p.next;
14330
-
14331
- if (p.prevZ) p.prevZ.nextZ = p.nextZ;
14332
- if (p.nextZ) p.nextZ.prevZ = p.prevZ;
14333
- }
14334
-
14335
- function Node(i, x, y) {
14336
- // vertex index in coordinates array
14337
- this.i = i;
14338
-
14339
- // vertex coordinates
14340
- this.x = x;
14341
- this.y = y;
14342
-
14343
- // previous and next vertex nodes in a polygon ring
14344
- this.prev = null;
14345
- this.next = null;
14346
-
14347
- // z-order curve value
14348
- this.z = 0;
14349
-
14350
- // previous and next nodes in z-order
14351
- this.prevZ = null;
14352
- this.nextZ = null;
14353
-
14354
- // indicates whether this is a steiner point
14355
- this.steiner = false;
14356
- }
14357
-
14358
- // return a percentage difference between the polygon area and its triangulation area;
14359
- // used to verify correctness of triangulation
14360
- earcut.deviation = function (data, holeIndices, dim, triangles) {
14361
- var hasHoles = holeIndices && holeIndices.length;
14362
- var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
14363
-
14364
- var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
14365
- if (hasHoles) {
14366
- for (var i = 0, len = holeIndices.length; i < len; i++) {
14367
- var start = holeIndices[i] * dim;
14368
- var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
14369
- polygonArea -= Math.abs(signedArea(data, start, end, dim));
14370
- }
14371
- }
14372
-
14373
- var trianglesArea = 0;
14374
- for (i = 0; i < triangles.length; i += 3) {
14375
- var a = triangles[i] * dim;
14376
- var b = triangles[i + 1] * dim;
14377
- var c = triangles[i + 2] * dim;
14378
- trianglesArea += Math.abs(
14379
- (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -
14380
- (data[a] - data[b]) * (data[c + 1] - data[a + 1]));
14381
- }
14382
-
14383
- return polygonArea === 0 && trianglesArea === 0 ? 0 :
14384
- Math.abs((trianglesArea - polygonArea) / polygonArea);
14385
- };
14386
-
14387
- function signedArea(data, start, end, dim) {
14388
- var sum = 0;
14389
- for (var i = start, j = end - dim; i < end; i += dim) {
14390
- sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
14391
- j = i;
14392
- }
14393
- return sum;
14394
- }
14395
-
14396
- // turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
14397
- earcut.flatten = function (data) {
14398
- var dim = data[0][0].length,
14399
- result = {vertices: [], holes: [], dimensions: dim},
14400
- holeIndex = 0;
14401
-
14402
- for (var i = 0; i < data.length; i++) {
14403
- for (var j = 0; j < data[i].length; j++) {
14404
- for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);
14405
- }
14406
- if (i > 0) {
14407
- holeIndex += data[i - 1].length;
14408
- result.holes.push(holeIndex);
14409
- }
14410
- }
14411
- return result;
14412
- };
14413
- return earcut$1.exports;
13971
+ return true;
14414
13972
  }
14415
13973
 
14416
- var earcutExports = requireEarcut();
14417
- var earcut = /*@__PURE__*/getDefaultExportFromCjs(earcutExports);
13974
+ function isEarHashed(ear, minX, minY, invSize) {
13975
+ const a = ear.prev,
13976
+ b = ear,
13977
+ c = ear.next;
13978
+
13979
+ if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
13980
+
13981
+ const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
13982
+
13983
+ // triangle bbox
13984
+ const x0 = Math.min(ax, bx, cx),
13985
+ y0 = Math.min(ay, by, cy),
13986
+ x1 = Math.max(ax, bx, cx),
13987
+ y1 = Math.max(ay, by, cy);
13988
+
13989
+ // z-order range for the current triangle bbox;
13990
+ const minZ = zOrder(x0, y0, minX, minY, invSize),
13991
+ maxZ = zOrder(x1, y1, minX, minY, invSize);
13992
+
13993
+ let p = ear.prevZ,
13994
+ n = ear.nextZ;
13995
+
13996
+ // look for points inside the triangle in both directions
13997
+ while (p && p.z >= minZ && n && n.z <= maxZ) {
13998
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
13999
+ pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
14000
+ p = p.prevZ;
14001
+
14002
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
14003
+ pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
14004
+ n = n.nextZ;
14005
+ }
14006
+
14007
+ // look for remaining points in decreasing z-order
14008
+ while (p && p.z >= minZ) {
14009
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&
14010
+ pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
14011
+ p = p.prevZ;
14012
+ }
14013
+
14014
+ // look for remaining points in increasing z-order
14015
+ while (n && n.z <= maxZ) {
14016
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&
14017
+ pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
14018
+ n = n.nextZ;
14019
+ }
14020
+
14021
+ return true;
14022
+ }
14023
+
14024
+ // go through all polygon nodes and cure small local self-intersections
14025
+ function cureLocalIntersections(start, triangles) {
14026
+ let p = start;
14027
+ do {
14028
+ const a = p.prev,
14029
+ b = p.next.next;
14030
+
14031
+ if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
14032
+
14033
+ triangles.push(a.i, p.i, b.i);
14034
+
14035
+ // remove two nodes involved
14036
+ removeNode(p);
14037
+ removeNode(p.next);
14038
+
14039
+ p = start = b;
14040
+ }
14041
+ p = p.next;
14042
+ } while (p !== start);
14043
+
14044
+ return filterPoints(p);
14045
+ }
14046
+
14047
+ // try splitting polygon into two and triangulate them independently
14048
+ function splitEarcut(start, triangles, dim, minX, minY, invSize) {
14049
+ // look for a valid diagonal that divides the polygon into two
14050
+ let a = start;
14051
+ do {
14052
+ let b = a.next.next;
14053
+ while (b !== a.prev) {
14054
+ if (a.i !== b.i && isValidDiagonal(a, b)) {
14055
+ // split the polygon in two by the diagonal
14056
+ let c = splitPolygon(a, b);
14057
+
14058
+ // filter colinear points around the cuts
14059
+ a = filterPoints(a, a.next);
14060
+ c = filterPoints(c, c.next);
14061
+
14062
+ // run earcut on each half
14063
+ earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
14064
+ earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
14065
+ return;
14066
+ }
14067
+ b = b.next;
14068
+ }
14069
+ a = a.next;
14070
+ } while (a !== start);
14071
+ }
14072
+
14073
+ // link every hole into the outer loop, producing a single-ring polygon without holes
14074
+ function eliminateHoles(data, holeIndices, outerNode, dim) {
14075
+ const queue = [];
14076
+
14077
+ for (let i = 0, len = holeIndices.length; i < len; i++) {
14078
+ const start = holeIndices[i] * dim;
14079
+ const end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
14080
+ const list = linkedList(data, start, end, dim, false);
14081
+ if (list === list.next) list.steiner = true;
14082
+ queue.push(getLeftmost(list));
14083
+ }
14084
+
14085
+ queue.sort(compareXYSlope);
14086
+
14087
+ // process holes from left to right
14088
+ for (let i = 0; i < queue.length; i++) {
14089
+ outerNode = eliminateHole(queue[i], outerNode);
14090
+ }
14091
+
14092
+ return outerNode;
14093
+ }
14094
+
14095
+ function compareXYSlope(a, b) {
14096
+ let result = a.x - b.x;
14097
+ // when the left-most point of 2 holes meet at a vertex, sort the holes counterclockwise so that when we find
14098
+ // the bridge to the outer shell is always the point that they meet at.
14099
+ if (result === 0) {
14100
+ result = a.y - b.y;
14101
+ if (result === 0) {
14102
+ const aSlope = (a.next.y - a.y) / (a.next.x - a.x);
14103
+ const bSlope = (b.next.y - b.y) / (b.next.x - b.x);
14104
+ result = aSlope - bSlope;
14105
+ }
14106
+ }
14107
+ return result;
14108
+ }
14109
+
14110
+ // find a bridge between vertices that connects hole with an outer ring and link it
14111
+ function eliminateHole(hole, outerNode) {
14112
+ const bridge = findHoleBridge(hole, outerNode);
14113
+ if (!bridge) {
14114
+ return outerNode;
14115
+ }
14116
+
14117
+ const bridgeReverse = splitPolygon(bridge, hole);
14118
+
14119
+ // filter collinear points around the cuts
14120
+ filterPoints(bridgeReverse, bridgeReverse.next);
14121
+ return filterPoints(bridge, bridge.next);
14122
+ }
14123
+
14124
+ // David Eberly's algorithm for finding a bridge between hole and outer polygon
14125
+ function findHoleBridge(hole, outerNode) {
14126
+ let p = outerNode;
14127
+ const hx = hole.x;
14128
+ const hy = hole.y;
14129
+ let qx = -Infinity;
14130
+ let m;
14131
+
14132
+ // find a segment intersected by a ray from the hole's leftmost point to the left;
14133
+ // segment's endpoint with lesser x will be potential connection point
14134
+ // unless they intersect at a vertex, then choose the vertex
14135
+ if (equals(hole, p)) return p;
14136
+ do {
14137
+ if (equals(hole, p.next)) return p.next;
14138
+ else if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
14139
+ const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
14140
+ if (x <= hx && x > qx) {
14141
+ qx = x;
14142
+ m = p.x < p.next.x ? p : p.next;
14143
+ if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint
14144
+ }
14145
+ }
14146
+ p = p.next;
14147
+ } while (p !== outerNode);
14148
+
14149
+ if (!m) return null;
14150
+
14151
+ // look for points inside the triangle of hole point, segment intersection and endpoint;
14152
+ // if there are no points found, we have a valid connection;
14153
+ // otherwise choose the point of the minimum angle with the ray as connection point
14154
+
14155
+ const stop = m;
14156
+ const mx = m.x;
14157
+ const my = m.y;
14158
+ let tanMin = Infinity;
14159
+
14160
+ p = m;
14161
+
14162
+ do {
14163
+ if (hx >= p.x && p.x >= mx && hx !== p.x &&
14164
+ pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
14165
+
14166
+ const tan = Math.abs(hy - p.y) / (hx - p.x); // tangential
14167
+
14168
+ if (locallyInside(p, hole) &&
14169
+ (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {
14170
+ m = p;
14171
+ tanMin = tan;
14172
+ }
14173
+ }
14174
+
14175
+ p = p.next;
14176
+ } while (p !== stop);
14177
+
14178
+ return m;
14179
+ }
14180
+
14181
+ // whether sector in vertex m contains sector in vertex p in the same coordinates
14182
+ function sectorContainsSector(m, p) {
14183
+ return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
14184
+ }
14185
+
14186
+ // interlink polygon nodes in z-order
14187
+ function indexCurve(start, minX, minY, invSize) {
14188
+ let p = start;
14189
+ do {
14190
+ if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
14191
+ p.prevZ = p.prev;
14192
+ p.nextZ = p.next;
14193
+ p = p.next;
14194
+ } while (p !== start);
14195
+
14196
+ p.prevZ.nextZ = null;
14197
+ p.prevZ = null;
14198
+
14199
+ sortLinked(p);
14200
+ }
14201
+
14202
+ // Simon Tatham's linked list merge sort algorithm
14203
+ // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
14204
+ function sortLinked(list) {
14205
+ let numMerges;
14206
+ let inSize = 1;
14207
+
14208
+ do {
14209
+ let p = list;
14210
+ let e;
14211
+ list = null;
14212
+ let tail = null;
14213
+ numMerges = 0;
14214
+
14215
+ while (p) {
14216
+ numMerges++;
14217
+ let q = p;
14218
+ let pSize = 0;
14219
+ for (let i = 0; i < inSize; i++) {
14220
+ pSize++;
14221
+ q = q.nextZ;
14222
+ if (!q) break;
14223
+ }
14224
+ let qSize = inSize;
14225
+
14226
+ while (pSize > 0 || (qSize > 0 && q)) {
14227
+
14228
+ if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
14229
+ e = p;
14230
+ p = p.nextZ;
14231
+ pSize--;
14232
+ } else {
14233
+ e = q;
14234
+ q = q.nextZ;
14235
+ qSize--;
14236
+ }
14237
+
14238
+ if (tail) tail.nextZ = e;
14239
+ else list = e;
14240
+
14241
+ e.prevZ = tail;
14242
+ tail = e;
14243
+ }
14244
+
14245
+ p = q;
14246
+ }
14247
+
14248
+ tail.nextZ = null;
14249
+ inSize *= 2;
14250
+
14251
+ } while (numMerges > 1);
14252
+
14253
+ return list;
14254
+ }
14255
+
14256
+ // z-order of a point given coords and inverse of the longer side of data bbox
14257
+ function zOrder(x, y, minX, minY, invSize) {
14258
+ // coords are transformed into non-negative 15-bit integer range
14259
+ x = (x - minX) * invSize | 0;
14260
+ y = (y - minY) * invSize | 0;
14261
+
14262
+ x = (x | (x << 8)) & 0x00FF00FF;
14263
+ x = (x | (x << 4)) & 0x0F0F0F0F;
14264
+ x = (x | (x << 2)) & 0x33333333;
14265
+ x = (x | (x << 1)) & 0x55555555;
14266
+
14267
+ y = (y | (y << 8)) & 0x00FF00FF;
14268
+ y = (y | (y << 4)) & 0x0F0F0F0F;
14269
+ y = (y | (y << 2)) & 0x33333333;
14270
+ y = (y | (y << 1)) & 0x55555555;
14271
+
14272
+ return x | (y << 1);
14273
+ }
14274
+
14275
+ // find the leftmost node of a polygon ring
14276
+ function getLeftmost(start) {
14277
+ let p = start,
14278
+ leftmost = start;
14279
+ do {
14280
+ if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;
14281
+ p = p.next;
14282
+ } while (p !== start);
14283
+
14284
+ return leftmost;
14285
+ }
14286
+
14287
+ // check if a point lies within a convex triangle
14288
+ function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
14289
+ return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&
14290
+ (ax - px) * (by - py) >= (bx - px) * (ay - py) &&
14291
+ (bx - px) * (cy - py) >= (cx - px) * (by - py);
14292
+ }
14293
+
14294
+ // check if a point lies within a convex triangle but false if its equal to the first point of the triangle
14295
+ function pointInTriangleExceptFirst(ax, ay, bx, by, cx, cy, px, py) {
14296
+ return !(ax === px && ay === py) && pointInTriangle(ax, ay, bx, by, cx, cy, px, py);
14297
+ }
14298
+
14299
+ // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
14300
+ function isValidDiagonal(a, b) {
14301
+ return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // doesn't intersect other edges
14302
+ (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible
14303
+ (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
14304
+ equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
14305
+ }
14306
+
14307
+ // signed area of a triangle
14308
+ function area(p, q, r) {
14309
+ return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
14310
+ }
14311
+
14312
+ // check if two points are equal
14313
+ function equals(p1, p2) {
14314
+ return p1.x === p2.x && p1.y === p2.y;
14315
+ }
14316
+
14317
+ // check if two segments intersect
14318
+ function intersects(p1, q1, p2, q2) {
14319
+ const o1 = sign(area(p1, q1, p2));
14320
+ const o2 = sign(area(p1, q1, q2));
14321
+ const o3 = sign(area(p2, q2, p1));
14322
+ const o4 = sign(area(p2, q2, q1));
14323
+
14324
+ if (o1 !== o2 && o3 !== o4) return true; // general case
14325
+
14326
+ if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1
14327
+ if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1
14328
+ if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2
14329
+ if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2
14330
+
14331
+ return false;
14332
+ }
14333
+
14334
+ // for collinear points p, q, r, check if point q lies on segment pr
14335
+ function onSegment(p, q, r) {
14336
+ return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
14337
+ }
14338
+
14339
+ function sign(num) {
14340
+ return num > 0 ? 1 : num < 0 ? -1 : 0;
14341
+ }
14342
+
14343
+ // check if a polygon diagonal intersects any polygon segments
14344
+ function intersectsPolygon(a, b) {
14345
+ let p = a;
14346
+ do {
14347
+ if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&
14348
+ intersects(p, p.next, a, b)) return true;
14349
+ p = p.next;
14350
+ } while (p !== a);
14351
+
14352
+ return false;
14353
+ }
14354
+
14355
+ // check if a polygon diagonal is locally inside the polygon
14356
+ function locallyInside(a, b) {
14357
+ return area(a.prev, a, a.next) < 0 ?
14358
+ area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :
14359
+ area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
14360
+ }
14361
+
14362
+ // check if the middle point of a polygon diagonal is inside the polygon
14363
+ function middleInside(a, b) {
14364
+ let p = a;
14365
+ let inside = false;
14366
+ const px = (a.x + b.x) / 2;
14367
+ const py = (a.y + b.y) / 2;
14368
+ do {
14369
+ if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&
14370
+ (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))
14371
+ inside = !inside;
14372
+ p = p.next;
14373
+ } while (p !== a);
14374
+
14375
+ return inside;
14376
+ }
14377
+
14378
+ // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
14379
+ // if one belongs to the outer ring and another to a hole, it merges it into a single ring
14380
+ function splitPolygon(a, b) {
14381
+ const a2 = createNode(a.i, a.x, a.y),
14382
+ b2 = createNode(b.i, b.x, b.y),
14383
+ an = a.next,
14384
+ bp = b.prev;
14385
+
14386
+ a.next = b;
14387
+ b.prev = a;
14388
+
14389
+ a2.next = an;
14390
+ an.prev = a2;
14391
+
14392
+ b2.next = a2;
14393
+ a2.prev = b2;
14394
+
14395
+ bp.next = b2;
14396
+ b2.prev = bp;
14397
+
14398
+ return b2;
14399
+ }
14400
+
14401
+ // create a node and optionally link it with previous one (in a circular doubly linked list)
14402
+ function insertNode(i, x, y, last) {
14403
+ const p = createNode(i, x, y);
14404
+
14405
+ if (!last) {
14406
+ p.prev = p;
14407
+ p.next = p;
14408
+
14409
+ } else {
14410
+ p.next = last.next;
14411
+ p.prev = last;
14412
+ last.next.prev = p;
14413
+ last.next = p;
14414
+ }
14415
+ return p;
14416
+ }
14417
+
14418
+ function removeNode(p) {
14419
+ p.next.prev = p.prev;
14420
+ p.prev.next = p.next;
14421
+
14422
+ if (p.prevZ) p.prevZ.nextZ = p.nextZ;
14423
+ if (p.nextZ) p.nextZ.prevZ = p.prevZ;
14424
+ }
14425
+
14426
+ function createNode(i, x, y) {
14427
+ return {
14428
+ i, // vertex index in coordinates array
14429
+ x, y, // vertex coordinates
14430
+ prev: null, // previous and next vertex nodes in a polygon ring
14431
+ next: null,
14432
+ z: 0, // z-order curve value
14433
+ prevZ: null, // previous and next nodes in z-order
14434
+ nextZ: null,
14435
+ steiner: false // indicates whether this is a steiner point
14436
+ };
14437
+ }
14438
+
14439
+ function signedArea(data, start, end, dim) {
14440
+ let sum = 0;
14441
+ for (let i = start, j = end - dim; i < end; i += dim) {
14442
+ sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
14443
+ j = i;
14444
+ }
14445
+ return sum;
14446
+ }
14418
14447
 
14419
14448
  const buildLine = (startX, startY, endX, endY, width, vertices = [], indices = []) => {
14420
14449
  const points = [startX, startY, endX, endY];
@@ -14606,8 +14635,10 @@ const buildStar = (centerX, centerY, points, radius, innerRadius = radius / 2, r
14606
14635
 
14607
14636
  let temp$3 = null;
14608
14637
  class Line {
14638
+ collisionType = CollisionType.Line;
14639
+ _fromPosition;
14640
+ _toPosition;
14609
14641
  constructor(x1 = 0, y1 = 0, x2 = 0, y2 = 0) {
14610
- this.collisionType = 1 /* CollisionType.Line */;
14611
14642
  this._fromPosition = new Vector(x1, y1);
14612
14643
  this._toPosition = new Vector(x2, y2);
14613
14644
  }
@@ -14674,13 +14705,13 @@ class Line {
14674
14705
  }
14675
14706
  intersectsWith(target) {
14676
14707
  switch (target.collisionType) {
14677
- case 6 /* CollisionType.SceneNode */: return intersectionLineRect(this, target.getBounds());
14678
- case 2 /* CollisionType.Rectangle */: return intersectionLineRect(this, target);
14679
- case 5 /* CollisionType.Polygon */: return intersectionLinePoly(this, target);
14680
- case 3 /* CollisionType.Circle */: return intersectionLineCircle(this, target);
14681
- case 4 /* CollisionType.Ellipse */: return intersectionLineEllipse(this, target);
14682
- case 1 /* CollisionType.Line */: return intersectionLineLine(this, target);
14683
- case 0 /* CollisionType.Point */: return intersectionPointLine(target, this);
14708
+ case CollisionType.SceneNode: return intersectionLineRect(this, target.getBounds());
14709
+ case CollisionType.Rectangle: return intersectionLineRect(this, target);
14710
+ case CollisionType.Polygon: return intersectionLinePoly(this, target);
14711
+ case CollisionType.Circle: return intersectionLineCircle(this, target);
14712
+ case CollisionType.Ellipse: return intersectionLineEllipse(this, target);
14713
+ case CollisionType.Line: return intersectionLineLine(this, target);
14714
+ case CollisionType.Point: return intersectionPointLine(target, this);
14684
14715
  default: return false;
14685
14716
  }
14686
14717
  }
@@ -14710,9 +14741,12 @@ class Line {
14710
14741
 
14711
14742
  let temp$2 = null;
14712
14743
  class Circle {
14744
+ static collisionSegments = 32;
14745
+ collisionType = CollisionType.Circle;
14746
+ _position;
14747
+ _collisionVertices = null;
14748
+ _radius;
14713
14749
  constructor(x = 0, y = 0, radius = 0) {
14714
- this.collisionType = 3 /* CollisionType.Circle */;
14715
- this._collisionVertices = null;
14716
14750
  this._position = new Vector(x, y);
14717
14751
  this._radius = radius;
14718
14752
  }
@@ -14786,22 +14820,22 @@ class Circle {
14786
14820
  }
14787
14821
  intersectsWith(target) {
14788
14822
  switch (target.collisionType) {
14789
- case 6 /* CollisionType.SceneNode */: return intersectionRectCircle(target.getBounds(), this);
14790
- case 2 /* CollisionType.Rectangle */: return intersectionRectCircle(target, this);
14791
- case 5 /* CollisionType.Polygon */: return intersectionCirclePoly(this, target);
14792
- case 3 /* CollisionType.Circle */: return intersectionCircleCircle(this, target);
14793
- case 4 /* CollisionType.Ellipse */: return intersectionCircleEllipse(this, target);
14794
- case 1 /* CollisionType.Line */: return intersectionLineCircle(target, this);
14795
- case 0 /* CollisionType.Point */: return intersectionPointCircle(target, this);
14823
+ case CollisionType.SceneNode: return intersectionRectCircle(target.getBounds(), this);
14824
+ case CollisionType.Rectangle: return intersectionRectCircle(target, this);
14825
+ case CollisionType.Polygon: return intersectionCirclePoly(this, target);
14826
+ case CollisionType.Circle: return intersectionCircleCircle(this, target);
14827
+ case CollisionType.Ellipse: return intersectionCircleEllipse(this, target);
14828
+ case CollisionType.Line: return intersectionLineCircle(target, this);
14829
+ case CollisionType.Point: return intersectionPointCircle(target, this);
14796
14830
  default: return false;
14797
14831
  }
14798
14832
  }
14799
14833
  collidesWith(target) {
14800
14834
  switch (target.collisionType) {
14801
- case 6 /* CollisionType.SceneNode */: return getCollisionCircleRectangle(this, target.getBounds());
14802
- case 2 /* CollisionType.Rectangle */: return getCollisionCircleRectangle(this, target);
14803
- case 5 /* CollisionType.Polygon */: return getCollisionPolygonCircle(target, this, true);
14804
- case 3 /* CollisionType.Circle */: return getCollisionCircleCircle(this, target);
14835
+ case CollisionType.SceneNode: return getCollisionCircleRectangle(this, target.getBounds());
14836
+ case CollisionType.Rectangle: return getCollisionCircleRectangle(this, target);
14837
+ case CollisionType.Polygon: return getCollisionPolygonCircle(target, this, true);
14838
+ case CollisionType.Circle: return getCollisionCircleCircle(this, target);
14805
14839
  // case CollisionType.Ellipse: return intersectionCircleEllipse(this, target as Ellipse);
14806
14840
  // case CollisionType.Line: return intersectionLineCircle(target as Line, this);
14807
14841
  // case CollisionType.Point: return intersectionPointCircle(target as Vector, this);
@@ -14833,11 +14867,12 @@ class Circle {
14833
14867
  return temp$2;
14834
14868
  }
14835
14869
  }
14836
- Circle.collisionSegments = 32;
14837
14870
 
14838
14871
  class Ellipse {
14872
+ collisionType = CollisionType.Ellipse;
14873
+ _position;
14874
+ _radius;
14839
14875
  constructor(x = 0, y = 0, halfWidth = 0, halfHeight = halfWidth) {
14840
- this.collisionType = 4 /* CollisionType.Ellipse */;
14841
14876
  this._position = new Vector(x, y);
14842
14877
  this._radius = new Vector(halfWidth, halfHeight);
14843
14878
  }
@@ -14909,13 +14944,13 @@ class Ellipse {
14909
14944
  }
14910
14945
  intersectsWith(target) {
14911
14946
  switch (target.collisionType) {
14912
- case 6 /* CollisionType.SceneNode */: return intersectionRectEllipse(target.getBounds(), this);
14913
- case 2 /* CollisionType.Rectangle */: return intersectionRectEllipse(target, this);
14914
- case 5 /* CollisionType.Polygon */: return intersectionEllipsePoly(this, target);
14915
- case 3 /* CollisionType.Circle */: return intersectionCircleEllipse(target, this);
14916
- case 4 /* CollisionType.Ellipse */: return intersectionEllipseEllipse(this, target);
14917
- case 1 /* CollisionType.Line */: return intersectionLineEllipse(target, this);
14918
- case 0 /* CollisionType.Point */: return intersectionPointEllipse(target, this);
14947
+ case CollisionType.SceneNode: return intersectionRectEllipse(target.getBounds(), this);
14948
+ case CollisionType.Rectangle: return intersectionRectEllipse(target, this);
14949
+ case CollisionType.Polygon: return intersectionEllipsePoly(this, target);
14950
+ case CollisionType.Circle: return intersectionCircleEllipse(target, this);
14951
+ case CollisionType.Ellipse: return intersectionEllipseEllipse(this, target);
14952
+ case CollisionType.Line: return intersectionLineEllipse(target, this);
14953
+ case CollisionType.Point: return intersectionPointEllipse(target, this);
14919
14954
  default: return false;
14920
14955
  }
14921
14956
  }
@@ -14939,11 +14974,12 @@ class Ellipse {
14939
14974
 
14940
14975
  let temp$1 = null;
14941
14976
  class Polygon {
14977
+ collisionType = CollisionType.Polygon;
14978
+ _position;
14979
+ _points = [];
14980
+ _edges = [];
14981
+ _normals = [];
14942
14982
  constructor(points = [], x = 0, y = 0) {
14943
- this.collisionType = 5 /* CollisionType.Polygon */;
14944
- this._points = [];
14945
- this._edges = [];
14946
- this._normals = [];
14947
14983
  this._position = new Vector(x, y);
14948
14984
  this.setPoints(points);
14949
14985
  }
@@ -15054,22 +15090,22 @@ class Polygon {
15054
15090
  }
15055
15091
  intersectsWith(target) {
15056
15092
  switch (target.collisionType) {
15057
- case 6 /* CollisionType.SceneNode */: return intersectionRectPoly(target.getBounds(), this);
15058
- case 2 /* CollisionType.Rectangle */: return intersectionRectPoly(target, this);
15059
- case 5 /* CollisionType.Polygon */: return intersectionPolyPoly(this, target);
15060
- case 3 /* CollisionType.Circle */: return intersectionCirclePoly(target, this);
15061
- case 4 /* CollisionType.Ellipse */: return intersectionEllipsePoly(target, this);
15062
- case 1 /* CollisionType.Line */: return intersectionLinePoly(target, this);
15063
- case 0 /* CollisionType.Point */: return intersectionPointPoly(target, this);
15093
+ case CollisionType.SceneNode: return intersectionRectPoly(target.getBounds(), this);
15094
+ case CollisionType.Rectangle: return intersectionRectPoly(target, this);
15095
+ case CollisionType.Polygon: return intersectionPolyPoly(this, target);
15096
+ case CollisionType.Circle: return intersectionCirclePoly(target, this);
15097
+ case CollisionType.Ellipse: return intersectionEllipsePoly(target, this);
15098
+ case CollisionType.Line: return intersectionLinePoly(target, this);
15099
+ case CollisionType.Point: return intersectionPointPoly(target, this);
15064
15100
  default: return false;
15065
15101
  }
15066
15102
  }
15067
15103
  collidesWith(target) {
15068
15104
  switch (target.collisionType) {
15069
- case 6 /* CollisionType.SceneNode */: return getCollisionSat(this, target);
15070
- case 2 /* CollisionType.Rectangle */: return getCollisionSat(this, target);
15071
- case 5 /* CollisionType.Polygon */: return getCollisionSat(this, target);
15072
- case 3 /* CollisionType.Circle */: return getCollisionPolygonCircle(this, target);
15105
+ case CollisionType.SceneNode: return getCollisionSat(this, target);
15106
+ case CollisionType.Rectangle: return getCollisionSat(this, target);
15107
+ case CollisionType.Polygon: return getCollisionSat(this, target);
15108
+ case CollisionType.Circle: return getCollisionPolygonCircle(this, target);
15073
15109
  // case CollisionType.Ellipse: return intersectionEllipsePoly(target as Ellipse, this);
15074
15110
  // case CollisionType.Line: return intersectionLinePoly(target as Line, this);
15075
15111
  // case CollisionType.Point: return intersectionPointPoly(target as Vector, this);
@@ -15093,6 +15129,8 @@ class Polygon {
15093
15129
 
15094
15130
  let temp = null;
15095
15131
  class Segment {
15132
+ _startPoint;
15133
+ _endPoint;
15096
15134
  constructor(startX = 0, startY = 0, endX = 0, endY = 0) {
15097
15135
  this._startPoint = new Vector(startX, startY);
15098
15136
  this._endPoint = new Vector(endX, endY);
@@ -15165,6 +15203,8 @@ class Segment {
15165
15203
  }
15166
15204
 
15167
15205
  class PolarVector {
15206
+ radius;
15207
+ phi;
15168
15208
  constructor(radius = 0, angle = 0) {
15169
15209
  this.radius = radius;
15170
15210
  this.phi = angle;
@@ -15178,6 +15218,8 @@ class PolarVector {
15178
15218
  }
15179
15219
 
15180
15220
  class ColorAffector {
15221
+ _fromColor;
15222
+ _toColor;
15181
15223
  constructor(fromColor, toColor) {
15182
15224
  this._fromColor = fromColor.clone();
15183
15225
  this._toColor = toColor.clone();
@@ -15216,6 +15258,7 @@ class ColorAffector {
15216
15258
  }
15217
15259
 
15218
15260
  class ForceAffector {
15261
+ _acceleration;
15219
15262
  constructor(accelerationX, accelerationY) {
15220
15263
  this._acceleration = new Vector(accelerationX, accelerationY);
15221
15264
  }
@@ -15239,6 +15282,7 @@ class ForceAffector {
15239
15282
  }
15240
15283
 
15241
15284
  class ScaleAffector {
15285
+ _scaleFactor;
15242
15286
  constructor(factorX, factorY) {
15243
15287
  this._scaleFactor = new Vector(factorX, factorY);
15244
15288
  }
@@ -15262,6 +15306,7 @@ class ScaleAffector {
15262
15306
  }
15263
15307
 
15264
15308
  class TorqueAffector {
15309
+ _angularAcceleration;
15265
15310
  constructor(angularAcceleration) {
15266
15311
  this._angularAcceleration = angularAcceleration;
15267
15312
  }
@@ -15285,6 +15330,15 @@ class TorqueAffector {
15285
15330
  }
15286
15331
 
15287
15332
  class ParticleOptions {
15333
+ _totalLifetime;
15334
+ _elapsedLifetime;
15335
+ _position;
15336
+ _velocity;
15337
+ _scale;
15338
+ _tint;
15339
+ _rotation;
15340
+ _rotationSpeed;
15341
+ _textureIndex;
15288
15342
  constructor(options = {}) {
15289
15343
  const { totalLifetime, elapsedLifetime, position, velocity, scale, rotation, rotationSpeed, textureIndex, tint, } = options;
15290
15344
  this._totalLifetime = (totalLifetime ?? Time.oneSecond).clone();
@@ -15373,8 +15427,10 @@ class ParticleOptions {
15373
15427
  }
15374
15428
 
15375
15429
  class UniversalEmitter {
15430
+ _emissionRate;
15431
+ _particleOptions;
15432
+ _emissionDelta = 0;
15376
15433
  constructor(emissionRate, particleOptions) {
15377
- this._emissionDelta = 0;
15378
15434
  this._emissionRate = emissionRate;
15379
15435
  this._particleOptions = particleOptions ?? new ParticleOptions();
15380
15436
  }
@@ -15429,13 +15485,10 @@ class CircleGeometry extends Geometry {
15429
15485
  }
15430
15486
 
15431
15487
  class Graphics extends Container {
15432
- constructor() {
15433
- super(...arguments);
15434
- this._lineWidth = 0;
15435
- this._lineColor = new Color();
15436
- this._fillColor = new Color();
15437
- this._currentPoint = new Vector(0, 0);
15438
- }
15488
+ _lineWidth = 0;
15489
+ _lineColor = new Color();
15490
+ _fillColor = new Color();
15491
+ _currentPoint = new Vector(0, 0);
15439
15492
  get lineWidth() {
15440
15493
  return this._lineWidth;
15441
15494
  }
@@ -15629,10 +15682,11 @@ class Graphics extends Container {
15629
15682
  }
15630
15683
 
15631
15684
  class Spritesheet {
15685
+ texture;
15686
+ frames = new Map();
15687
+ sprites = new Map();
15688
+ animations = new Map();
15632
15689
  constructor(texture, data) {
15633
- this.frames = new Map();
15634
- this.sprites = new Map();
15635
- this.animations = new Map();
15636
15690
  this.texture = texture;
15637
15691
  this.parse(data);
15638
15692
  }
@@ -15712,16 +15766,16 @@ class Spritesheet {
15712
15766
 
15713
15767
  const defaultClipFps = 12;
15714
15768
  class AnimatedSprite extends Sprite {
15769
+ _clips = new Map();
15770
+ _currentClipName = null;
15771
+ _currentFrameIndex = 0;
15772
+ _playing = false;
15773
+ _loopOverride = null;
15774
+ _elapsedFrameTimeMs = 0;
15775
+ onComplete = new Signal();
15776
+ onFrame = new Signal();
15715
15777
  constructor(texture, clips) {
15716
15778
  super(texture);
15717
- this._clips = new Map();
15718
- this._currentClipName = null;
15719
- this._currentFrameIndex = 0;
15720
- this._playing = false;
15721
- this._loopOverride = null;
15722
- this._elapsedFrameTimeMs = 0;
15723
- this.onComplete = new Signal();
15724
- this.onFrame = new Signal();
15725
15779
  if (clips) {
15726
15780
  this.setClips(clips);
15727
15781
  }
@@ -15883,8 +15937,21 @@ class AnimatedSprite extends Sprite {
15883
15937
  }
15884
15938
 
15885
15939
  class TextStyle {
15940
+ _align;
15941
+ _fill;
15942
+ _stroke;
15943
+ _strokeThickness;
15944
+ _fontSize;
15945
+ _fontWeight;
15946
+ _fontFamily;
15947
+ _wordWrap;
15948
+ _wordWrapWidth;
15949
+ _baseline;
15950
+ _lineJoin;
15951
+ _miterLimit;
15952
+ _padding;
15953
+ _dirty = true;
15886
15954
  constructor(options = {}) {
15887
- this._dirty = true;
15888
15955
  this._align = options.align ?? 'left';
15889
15956
  this._fill = options.fill ?? 'black';
15890
15957
  this._stroke = options.stroke ?? 'black';
@@ -16061,9 +16128,13 @@ class TextStyle {
16061
16128
 
16062
16129
  const newLinePattern = /(?:\r\n|\r|\n)/;
16063
16130
  class Text extends Sprite {
16131
+ _text;
16132
+ _style;
16133
+ _canvas;
16134
+ _context;
16135
+ _dirty = true;
16064
16136
  constructor(text, style, samplerOptions, canvas = document.createElement('canvas')) {
16065
16137
  super(new Texture(canvas, samplerOptions));
16066
- this._dirty = true;
16067
16138
  this._text = text;
16068
16139
  this._style = (style && style instanceof TextStyle) ? style : new TextStyle(style);
16069
16140
  this._canvas = canvas;
@@ -16178,6 +16249,13 @@ class Text extends Sprite {
16178
16249
  }
16179
16250
 
16180
16251
  class Sampler {
16252
+ _context;
16253
+ _sampler;
16254
+ _scaleMode;
16255
+ _wrapMode;
16256
+ _premultiplyAlpha;
16257
+ _generateMipMap;
16258
+ _flipY;
16181
16259
  constructor(gl, options) {
16182
16260
  const { scaleMode, wrapMode, premultiplyAlpha, generateMipMap, flipY } = options;
16183
16261
  this._context = gl;
@@ -16245,6 +16323,7 @@ class Sampler {
16245
16323
  }
16246
16324
 
16247
16325
  class CallbackRenderPass {
16326
+ _callback;
16248
16327
  constructor(callback) {
16249
16328
  this._callback = callback;
16250
16329
  }
@@ -16257,12 +16336,12 @@ class Filter {
16257
16336
  }
16258
16337
 
16259
16338
  class BlurFilter extends Filter {
16339
+ _sprite = new Sprite(null);
16340
+ _sampleTint = Color.white.clone();
16341
+ _radius = 2;
16342
+ _quality = 1;
16260
16343
  constructor(options = {}) {
16261
16344
  super();
16262
- this._sprite = new Sprite(null);
16263
- this._sampleTint = Color.white.clone();
16264
- this._radius = 2;
16265
- this._quality = 1;
16266
16345
  this._radius = Math.max(0, options.radius ?? 2);
16267
16346
  this._quality = Math.max(1, Math.floor(options.quality ?? 1));
16268
16347
  }
@@ -16317,9 +16396,10 @@ class BlurFilter extends Filter {
16317
16396
  }
16318
16397
 
16319
16398
  class ColorFilter extends Filter {
16399
+ _color;
16400
+ _sprite = new Sprite(null);
16320
16401
  constructor(color = Color.white) {
16321
16402
  super();
16322
- this._sprite = new Sprite(null);
16323
16403
  this._color = color.clone();
16324
16404
  }
16325
16405
  get color() {
@@ -16396,13 +16476,17 @@ const defaultStoreNames = [
16396
16476
  'text', 'svg', 'json', 'binary', 'wasm', 'vtt',
16397
16477
  ];
16398
16478
  class IndexedDbDatabase {
16479
+ name;
16480
+ version;
16481
+ _storeNames;
16482
+ _migrations;
16483
+ _onCloseHandler = this.disconnect.bind(this);
16484
+ _connected = false;
16485
+ _database = null;
16399
16486
  get connected() {
16400
16487
  return this._connected;
16401
16488
  }
16402
16489
  constructor(name, version = 1, storeNames = defaultStoreNames, migrations) {
16403
- this._onCloseHandler = this.disconnect.bind(this);
16404
- this._connected = false;
16405
- this._database = null;
16406
16490
  if (!supportsIndexedDb) {
16407
16491
  throw new Error('This browser does not support indexedDB!');
16408
16492
  }
@@ -16527,6 +16611,7 @@ class IndexedDbDatabase {
16527
16611
  }
16528
16612
 
16529
16613
  class IndexedDbStore {
16614
+ _db;
16530
16615
  constructor(nameOrOptions) {
16531
16616
  const options = typeof nameOrOptions === 'string'
16532
16617
  ? { name: nameOrOptions }
@@ -16672,6 +16757,14 @@ const assertBodyOptions = (options) => {
16672
16757
  toPackedCollisionGroups(options.collisionFilter);
16673
16758
  };
16674
16759
  class RapierPhysicsBinding {
16760
+ _world;
16761
+ _body;
16762
+ _collider;
16763
+ _syncMode;
16764
+ node;
16765
+ bodyType;
16766
+ shape;
16767
+ trigger;
16675
16768
  constructor(world, node, body, collider, options) {
16676
16769
  this._world = world;
16677
16770
  this.node = node;
@@ -16737,14 +16830,17 @@ class RapierPhysicsBinding {
16737
16830
  }
16738
16831
  }
16739
16832
  class RapierPhysicsWorld {
16833
+ onCollisionEnter = new Signal();
16834
+ onCollisionExit = new Signal();
16835
+ onTriggerEnter = new Signal();
16836
+ onTriggerExit = new Signal();
16837
+ _rapier;
16838
+ _world;
16839
+ _eventQueue;
16840
+ _bindings = new Set();
16841
+ _nodeBindings = new Map();
16842
+ _colliderBindings = new Map();
16740
16843
  constructor(rapier, world, eventQueue) {
16741
- this.onCollisionEnter = new Signal();
16742
- this.onCollisionExit = new Signal();
16743
- this.onTriggerEnter = new Signal();
16744
- this.onTriggerExit = new Signal();
16745
- this._bindings = new Set();
16746
- this._nodeBindings = new Map();
16747
- this._colliderBindings = new Map();
16748
16844
  this._rapier = rapier;
16749
16845
  this._world = world;
16750
16846
  this._eventQueue = eventQueue;
@@ -16757,7 +16853,7 @@ class RapierPhysicsWorld {
16757
16853
  }
16758
16854
  catch (error) {
16759
16855
  const message = error instanceof Error ? error.message : String(error);
16760
- throw new Error(`Rapier physics module is unavailable. Install "${rapierModuleName}" or provide a custom module loader. Original error: ${message}`);
16856
+ throw new Error(`Rapier physics module is unavailable. Install "${rapierModuleName}" or provide a custom module loader. Original error: ${message}`, { cause: error });
16761
16857
  }
16762
16858
  const rapier = resolveRapierModule(loadedModule);
16763
16859
  if (typeof rapier.init === 'function') {
@@ -17011,5 +17107,5 @@ const createRapierPhysicsWorld = async (options = {}) => {
17011
17107
  return await RapierPhysicsWorld.create(options);
17012
17108
  };
17013
17109
 
17014
- export { AbstractAssetFactory, AbstractMedia, AbstractWebGl2BatchedRenderer, AbstractWebGl2Renderer, AbstractWebGpuRenderer, AnimatedSprite, Application, ApplicationStatus, ArcadeStickGamepadMapping, AudioAnalyser, BinaryFactory, BlendModes, BlurFilter, Bounds, BufferTypes, BufferUsage, BundleLoadError, CacheFirstStrategy, CallbackRenderPass, ChannelSize, Circle, CircleGeometry, Clock, Color, ColorAffector, ColorFilter, Container, Drawable, DrawableShape, Ellipse, FactoryRegistry, Filter, Flags, FontFactory, ForceAffector, GameCubeGamepadMapping, Gamepad, GamepadChannel, GamepadControl, GamepadMapping, GamepadMappingFamily, GamepadPromptLayouts, GenericDualAnalogGamepadMapping, Geometry, Graphics, ImageFactory, IndexedDbDatabase, IndexedDbStore, Input, InputManager, Interval, JoyConLeftGamepadMapping, JoyConRightGamepadMapping, Json, JsonFactory, Keyboard, Line, Loader, Matrix, Music, MusicFactory, NetworkOnlyStrategy, ObservableSize, ObservableVector, Particle, ParticleOptions, ParticleSystem, PlayStationGamepadMapping, Pointer, PointerState, PointerStateFlag, PolarVector, Polygon, Quadtree, Random, RapierPhysicsBinding, RapierPhysicsWorld, Rectangle, RenderBackendType, RenderNode, RenderTarget, RenderTargetPass, RenderTexture, RendererRegistry, RenderingPrimitives, Sampler, ScaleAffector, ScaleModes, Scene, SceneManager, SceneNode, Segment, Shader, ShaderAttribute, ShaderPrimitives, ShaderUniform, Signal, Size, Sound, SoundFactory, Sprite, SpriteFlags, Spritesheet, SteamControllerGamepadMapping, SvgAsset, SvgFactory, SwitchProGamepadMapping, Text, TextAsset, TextFactory, TextStyle, Texture, TextureFactory, Time, Timer, TorqueAffector, Transformable, TransformableFlags, UniversalEmitter, Vector, Video, VideoFactory, View, ViewFlags, VttAsset, VttFactory, WasmFactory, WebGl2ParticleRenderer, WebGl2PrimitiveRenderer, WebGl2RenderBuffer, WebGl2RenderManager, WebGl2ShaderBlock, WebGl2SpriteRenderer, WebGl2VertexArrayObject, WebGpuParticleRenderer, WebGpuPrimitiveRenderer, WebGpuRenderManager, WebGpuSpriteRenderer, WrapModes, XboxGamepadMapping, bezierCurveTo, buildCircle, buildEllipse, buildLine, buildPath, buildPolygon, buildRectangle, buildStar, builtInGamepadDefinitions, canvasSourceToDataUrl, clamp, createRapierPhysicsWorld, createRenderStats, createWebGl2ShaderRuntime, decodeAudioData, defineAssetManifest, degreesPerRadian, degreesToRadians, determineMimeType, emptyArrayBuffer, getAudioContext, getCanvasSourceSize, getCollisionCircleCircle, getCollisionCircleRectangle, getCollisionPolygonCircle, getCollisionRectangleRectangle, getCollisionSat, getDistance, getOfflineAudioContext, getPreciseTime, getTextureSourceSize, getVoronoiRegion$1 as getVoronoiRegion, getWebGpuBlendState, hours, inRange, intersectionCircleCircle, intersectionCircleEllipse, intersectionCirclePoly, intersectionEllipseEllipse, intersectionEllipsePoly, intersectionLineCircle, intersectionLineEllipse, intersectionLineLine, intersectionLinePoly, intersectionLineRect, intersectionPointCircle, intersectionPointEllipse, intersectionPointLine, intersectionPointPoint, intersectionPointPoly, intersectionPointRect, intersectionPolyPoly, intersectionRectCircle, intersectionRectEllipse, intersectionRectPoly, intersectionRectRect, intersectionSat, isAudioContextReady, isPowerOfTwo, lerp, matchesIds, milliseconds, minutes, noop$1 as noop, normalizeIds, onAudioContextReady, parseGamepadDescriptor, quadraticCurveTo, radiansPerDegree, radiansToDegrees, rand, removeArrayItems, resetRenderStats, resolveDefinition, resolveGamepadDefinition, seconds, sign, stopEvent, supportsCodec, supportsEventOptions, supportsIndexedDb, supportsPointerEvents, supportsTouchEvents, supportsWebAudio, tau, trimRotation, webGl2PrimitiveArrayConstructors, webGl2PrimitiveByteSizeMapping, webGl2PrimitiveTypeNames };
17110
+ export { AbstractAssetFactory, AbstractMedia, AbstractWebGl2BatchedRenderer, AbstractWebGl2Renderer, AbstractWebGpuRenderer, AnimatedSprite, Application, ApplicationStatus, ArcadeStickGamepadMapping, AudioAnalyser, BinaryFactory, BlendModes, BlurFilter, Bounds, BufferTypes, BufferUsage, BundleLoadError, CacheFirstStrategy, CallbackRenderPass, ChannelOffset, ChannelSize, Circle, CircleGeometry, Clock, CollisionType, Color, ColorAffector, ColorFilter, Container, Drawable, DrawableShape, Ellipse, FactoryRegistry, Filter, Flags, FontFactory, ForceAffector, GameCubeGamepadMapping, Gamepad, GamepadChannel, GamepadControl, GamepadMapping, GamepadMappingFamily, GamepadPromptLayouts, GenericDualAnalogGamepadMapping, Geometry, Graphics, ImageFactory, IndexedDbDatabase, IndexedDbStore, Input, InputManager, Interval, JoyConLeftGamepadMapping, JoyConRightGamepadMapping, Json, JsonFactory, Keyboard, Line, Loader, Matrix, Music, MusicFactory, NetworkOnlyStrategy, ObservableSize, ObservableVector, Particle, ParticleOptions, ParticleSystem, PlayStationGamepadMapping, Pointer, PointerState, PointerStateFlag, PolarVector, Polygon, Quadtree, Random, RapierPhysicsBinding, RapierPhysicsWorld, Rectangle, RenderBackendType, RenderNode, RenderTarget, RenderTargetPass, RenderTexture, RendererRegistry, RenderingPrimitives, Sampler, ScaleAffector, ScaleModes, Scene, SceneManager, SceneNode, Segment, Shader, ShaderAttribute, ShaderPrimitives, ShaderUniform, Signal, Size, Sound, SoundFactory, Sprite, SpriteFlags, Spritesheet, SteamControllerGamepadMapping, SvgAsset, SvgFactory, SwitchProGamepadMapping, Text, TextAsset, TextFactory, TextStyle, Texture, TextureFactory, Time, Timer, TorqueAffector, Transformable, TransformableFlags, UniversalEmitter, Vector, Video, VideoFactory, View, ViewFlags, VoronoiRegion, VttAsset, VttFactory, WasmFactory, WebGl2ParticleRenderer, WebGl2PrimitiveRenderer, WebGl2RenderBuffer, WebGl2RenderManager, WebGl2ShaderBlock, WebGl2SpriteRenderer, WebGl2VertexArrayObject, WebGpuParticleRenderer, WebGpuPrimitiveRenderer, WebGpuRenderManager, WebGpuSpriteRenderer, WrapModes, XboxGamepadMapping, bezierCurveTo, buildCircle, buildEllipse, buildLine, buildPath, buildPolygon, buildRectangle, buildStar, builtInGamepadDefinitions, canvasSourceToDataUrl, clamp, createRapierPhysicsWorld, createRenderStats, createWebGl2ShaderRuntime, decodeAudioData, defineAssetManifest, degreesPerRadian, degreesToRadians, determineMimeType, emptyArrayBuffer, getAudioContext, getCanvasSourceSize, getCollisionCircleCircle, getCollisionCircleRectangle, getCollisionPolygonCircle, getCollisionRectangleRectangle, getCollisionSat, getDistance, getOfflineAudioContext, getPreciseTime, getTextureSourceSize, getVoronoiRegion$1 as getVoronoiRegion, getWebGpuBlendState, hours, inRange, intersectionCircleCircle, intersectionCircleEllipse, intersectionCirclePoly, intersectionEllipseEllipse, intersectionEllipsePoly, intersectionLineCircle, intersectionLineEllipse, intersectionLineLine, intersectionLinePoly, intersectionLineRect, intersectionPointCircle, intersectionPointEllipse, intersectionPointLine, intersectionPointPoint, intersectionPointPoly, intersectionPointRect, intersectionPolyPoly, intersectionRectCircle, intersectionRectEllipse, intersectionRectPoly, intersectionRectRect, intersectionSat, isAudioContextReady, isPowerOfTwo, lerp, matchesIds, milliseconds, minutes, noop$1 as noop, normalizeIds, onAudioContextReady, parseGamepadDescriptor, quadraticCurveTo, radiansPerDegree, radiansToDegrees, rand, removeArrayItems, resetRenderStats, resolveDefinition, resolveGamepadDefinition, seconds, sign$1 as sign, stopEvent, supportsCodec, supportsEventOptions, supportsIndexedDb, supportsPointerEvents, supportsTouchEvents, supportsWebAudio, tau, trimRotation, webGl2PrimitiveArrayConstructors, webGl2PrimitiveByteSizeMapping, webGl2PrimitiveTypeNames };
17015
17111
  //# sourceMappingURL=exo.esm.js.map