@vpmedia/phaser 1.106.0 → 1.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/index.js +225 -226
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts +2 -2
  4. package/dist/phaser/core/animation.d.ts.map +1 -1
  5. package/dist/phaser/core/animation_manager.d.ts +2 -2
  6. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  7. package/dist/phaser/core/animation_parser.d.ts +2 -2
  8. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  9. package/dist/phaser/core/array_set.d.ts.map +1 -1
  10. package/dist/phaser/core/cache.d.ts +6 -6
  11. package/dist/phaser/core/cache.d.ts.map +1 -1
  12. package/dist/phaser/core/device.d.ts.map +1 -1
  13. package/dist/phaser/core/device_util.d.ts.map +1 -1
  14. package/dist/phaser/core/dom.d.ts +2 -2
  15. package/dist/phaser/core/dom.d.ts.map +1 -1
  16. package/dist/phaser/core/event_manager.d.ts.map +1 -1
  17. package/dist/phaser/core/factory.d.ts +1 -1
  18. package/dist/phaser/core/factory.d.ts.map +1 -1
  19. package/dist/phaser/core/frame.d.ts.map +1 -1
  20. package/dist/phaser/core/frame_data.d.ts.map +1 -1
  21. package/dist/phaser/core/frame_util.d.ts.map +1 -1
  22. package/dist/phaser/core/game.d.ts +1 -1
  23. package/dist/phaser/core/game.d.ts.map +1 -1
  24. package/dist/phaser/core/input.d.ts +3 -3
  25. package/dist/phaser/core/input.d.ts.map +1 -1
  26. package/dist/phaser/core/input_handler.d.ts +8 -8
  27. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  28. package/dist/phaser/core/input_mouse.d.ts +8 -8
  29. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  30. package/dist/phaser/core/input_mspointer.d.ts +6 -6
  31. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  32. package/dist/phaser/core/input_pointer.d.ts +3 -3
  33. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  34. package/dist/phaser/core/input_touch.d.ts +7 -7
  35. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  36. package/dist/phaser/core/loader.d.ts +6 -6
  37. package/dist/phaser/core/loader.d.ts.map +1 -1
  38. package/dist/phaser/core/loader_parser.d.ts +4 -4
  39. package/dist/phaser/core/loader_parser.d.ts.map +1 -1
  40. package/dist/phaser/core/raf.d.ts.map +1 -1
  41. package/dist/phaser/core/scale_manager.d.ts +5 -5
  42. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  43. package/dist/phaser/core/scene.d.ts +3 -3
  44. package/dist/phaser/core/scene.d.ts.map +1 -1
  45. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  46. package/dist/phaser/core/signal.d.ts +7 -7
  47. package/dist/phaser/core/signal.d.ts.map +1 -1
  48. package/dist/phaser/core/signal_binding.d.ts +1 -1
  49. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  50. package/dist/phaser/core/sound.d.ts +3 -3
  51. package/dist/phaser/core/sound.d.ts.map +1 -1
  52. package/dist/phaser/core/sound_manager.d.ts +1 -1
  53. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  54. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  55. package/dist/phaser/core/stage.d.ts.map +1 -1
  56. package/dist/phaser/core/time.d.ts.map +1 -1
  57. package/dist/phaser/core/timer.d.ts +5 -5
  58. package/dist/phaser/core/timer.d.ts.map +1 -1
  59. package/dist/phaser/core/timer_event.d.ts.map +1 -1
  60. package/dist/phaser/core/tween.d.ts +1 -1
  61. package/dist/phaser/core/tween.d.ts.map +1 -1
  62. package/dist/phaser/core/tween_data.d.ts +1 -1
  63. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  64. package/dist/phaser/core/tween_easing.d.ts.map +1 -1
  65. package/dist/phaser/core/tween_manager.d.ts +1 -1
  66. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  67. package/dist/phaser/core/world.d.ts.map +1 -1
  68. package/dist/phaser/display/bitmap_text.d.ts +3 -3
  69. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  70. package/dist/phaser/display/button.d.ts +12 -11
  71. package/dist/phaser/display/button.d.ts.map +1 -1
  72. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  73. package/dist/phaser/display/canvas/graphics.d.ts +3 -3
  74. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  75. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  76. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  77. package/dist/phaser/display/canvas/renderer.d.ts +2 -2
  78. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  79. package/dist/phaser/display/canvas/tinter.d.ts +1 -1
  80. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  81. package/dist/phaser/display/canvas/util.d.ts +1 -1
  82. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  83. package/dist/phaser/display/display_object.d.ts +12 -21
  84. package/dist/phaser/display/display_object.d.ts.map +1 -1
  85. package/dist/phaser/display/graphics.d.ts +1 -1
  86. package/dist/phaser/display/graphics.d.ts.map +1 -1
  87. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  88. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  89. package/dist/phaser/display/group.d.ts +3 -3
  90. package/dist/phaser/display/group.d.ts.map +1 -1
  91. package/dist/phaser/display/image.d.ts +8 -8
  92. package/dist/phaser/display/image.d.ts.map +1 -1
  93. package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
  94. package/dist/phaser/display/sprite_util.d.ts +5 -5
  95. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  96. package/dist/phaser/display/text.d.ts +8 -7
  97. package/dist/phaser/display/text.d.ts.map +1 -1
  98. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  99. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  100. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  101. package/dist/phaser/display/webgl/earcut.d.ts +5 -5
  102. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  103. package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  104. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +3 -2
  105. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  106. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  107. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  108. package/dist/phaser/display/webgl/graphics.d.ts +4 -3
  109. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  110. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  111. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  112. package/dist/phaser/display/webgl/render_texture.d.ts +2 -2
  113. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  114. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  115. package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  116. package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  117. package/dist/phaser/display/webgl/shader/normal.d.ts +1 -1
  118. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  119. package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  120. package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  121. package/dist/phaser/display/webgl/shader_manager.d.ts +2 -1
  122. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  123. package/dist/phaser/display/webgl/sprite_batch.d.ts +2 -1
  124. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  125. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  126. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  127. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  128. package/dist/phaser/display/webgl/util.d.ts +8 -4
  129. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  130. package/dist/phaser/geom/circle.d.ts +1 -1
  131. package/dist/phaser/geom/circle.d.ts.map +1 -1
  132. package/dist/phaser/geom/ellipse.d.ts +1 -1
  133. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  134. package/dist/phaser/geom/line.d.ts +3 -3
  135. package/dist/phaser/geom/line.d.ts.map +1 -1
  136. package/dist/phaser/geom/matrix.d.ts +3 -3
  137. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  138. package/dist/phaser/geom/point.d.ts.map +1 -1
  139. package/dist/phaser/geom/polygon.d.ts +1 -1
  140. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  141. package/dist/phaser/geom/rectangle.d.ts +2 -2
  142. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  143. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  144. package/dist/phaser/geom/util/circle.d.ts +3 -3
  145. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  146. package/dist/phaser/geom/util/ellipse.d.ts +1 -1
  147. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  148. package/dist/phaser/geom/util/line.d.ts +3 -3
  149. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  150. package/dist/phaser/geom/util/matrix.d.ts +1 -1
  151. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  152. package/dist/phaser/geom/util/point.d.ts +15 -15
  153. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  154. package/dist/phaser/geom/util/polygon.d.ts +1 -1
  155. package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
  156. package/dist/phaser/geom/util/rectangle.d.ts +5 -5
  157. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  158. package/dist/phaser/geom/util/rounded_rectangle.d.ts +1 -1
  159. package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  160. package/dist/phaser/util/math.d.ts.map +1 -1
  161. package/package.json +13 -13
  162. package/src/phaser/core/animation.ts +6 -6
  163. package/src/phaser/core/animation_manager.ts +2 -2
  164. package/src/phaser/core/cache.ts +9 -8
  165. package/src/phaser/core/device_util.ts +4 -2
  166. package/src/phaser/core/dom.ts +2 -2
  167. package/src/phaser/core/factory.ts +3 -5
  168. package/src/phaser/core/game.ts +21 -34
  169. package/src/phaser/core/input.ts +2 -2
  170. package/src/phaser/core/input_handler.ts +6 -5
  171. package/src/phaser/core/input_mouse.ts +8 -84
  172. package/src/phaser/core/input_mspointer.ts +12 -8
  173. package/src/phaser/core/input_touch.ts +7 -7
  174. package/src/phaser/core/loader.ts +35 -31
  175. package/src/phaser/core/loader_parser.ts +12 -4
  176. package/src/phaser/core/scale_manager.ts +5 -5
  177. package/src/phaser/core/scene.ts +3 -3
  178. package/src/phaser/core/signal.ts +9 -9
  179. package/src/phaser/core/signal_binding.ts +1 -1
  180. package/src/phaser/core/sound.ts +12 -21
  181. package/src/phaser/core/sound_manager.ts +3 -3
  182. package/src/phaser/core/stage.ts +6 -6
  183. package/src/phaser/core/timer.ts +4 -4
  184. package/src/phaser/core/tween.ts +7 -5
  185. package/src/phaser/core/tween_data.ts +2 -2
  186. package/src/phaser/core/tween_manager.ts +2 -2
  187. package/src/phaser/display/bitmap_text.ts +6 -6
  188. package/src/phaser/display/button.ts +33 -26
  189. package/src/phaser/display/canvas/renderer.ts +2 -2
  190. package/src/phaser/display/canvas/util.ts +12 -12
  191. package/src/phaser/display/display_object.ts +17 -31
  192. package/src/phaser/display/graphics.ts +9 -9
  193. package/src/phaser/display/group.ts +8 -8
  194. package/src/phaser/display/image.ts +21 -21
  195. package/src/phaser/display/sprite_util.ts +1 -1
  196. package/src/phaser/display/text.ts +9 -9
  197. package/src/phaser/display/webgl/earcut.ts +12 -4
  198. package/src/phaser/display/webgl/fast_sprite_batch.ts +4 -2
  199. package/src/phaser/display/webgl/graphics.ts +3 -2
  200. package/src/phaser/display/webgl/render_texture.ts +2 -2
  201. package/src/phaser/display/webgl/shader/normal.ts +1 -1
  202. package/src/phaser/display/webgl/shader_manager.ts +2 -1
  203. package/src/phaser/display/webgl/sprite_batch.ts +2 -1
  204. package/src/phaser/display/webgl/util.ts +9 -0
  205. package/src/phaser/geom/circle.ts +1 -1
  206. package/src/phaser/geom/ellipse.ts +1 -1
  207. package/src/phaser/geom/line.ts +2 -2
  208. package/src/phaser/geom/matrix.ts +3 -3
  209. package/src/phaser/geom/polygon.ts +1 -1
  210. package/src/phaser/geom/rectangle.ts +2 -2
  211. package/src/phaser/geom/util/circle.ts +8 -3
  212. package/src/phaser/geom/util/line.ts +9 -2
  213. package/src/phaser/geom/util/matrix.ts +1 -1
  214. package/src/phaser/geom/util/point.ts +15 -15
  215. package/src/phaser/geom/util/polygon.ts +1 -1
  216. package/src/phaser/geom/util/rectangle.ts +5 -5
  217. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
package/dist/index.js CHANGED
@@ -1447,12 +1447,13 @@ const getRGB = (color) => {
1447
1447
  };
1448
1448
  /** Converts a color value (string or number) to an object with various color formats. */
1449
1449
  const valueToColor = (value, out) => {
1450
- if (typeof value === "string") if (value.indexOf("rgb") === 0) webToColor(value, out);
1451
- else {
1452
- out.a = 1;
1453
- hexToColor(value, out);
1454
- }
1455
- else if (typeof value === "number") {
1450
+ if (typeof value === "string") {
1451
+ if (value.indexOf("rgb") === 0) webToColor(value, out);
1452
+ else {
1453
+ out.a = 1;
1454
+ hexToColor(value, out);
1455
+ }
1456
+ } else if (typeof value === "number") {
1456
1457
  const tempColor = getRGB(value);
1457
1458
  out.r = tempColor.r;
1458
1459
  out.g = tempColor.g;
@@ -1897,35 +1898,26 @@ var DisplayObject = class {
1897
1898
  rotation = 0;
1898
1899
  /** @type {number} */
1899
1900
  alpha = 1;
1900
- /** @type {Rectangle} */
1901
1901
  hitArea = null;
1902
- /** @type {DisplayObject} */
1903
1902
  parent = null;
1904
1903
  /** @type {number} */
1905
1904
  worldAlpha = 1;
1906
1905
  worldTransform;
1907
1906
  worldScale;
1908
- /** @type {Rectangle} */
1909
1907
  filterArea = null;
1910
1908
  /** @type {number} */
1911
1909
  _sr = 0;
1912
1910
  /** @type {number} */
1913
1911
  _cr = 1;
1914
1912
  cachedBounds;
1915
- /** @type {Rectangle} */
1916
1913
  currentBounds = null;
1917
- /** @type {import('./graphics.js').Graphics} */
1918
1914
  _mask = null;
1919
- /** @type {object[]} */
1920
1915
  _filters = null;
1921
- /** @type {object} */
1922
1916
  _filterBlock = null;
1923
1917
  children;
1924
1918
  /** @type {boolean} */
1925
1919
  ignoreChildInput = false;
1926
- /** @type {string | null} */
1927
1920
  name = null;
1928
- /** @type {object | null} */
1929
1921
  data = null;
1930
1922
  game;
1931
1923
  type;
@@ -2147,9 +2139,7 @@ var DisplayObject = class {
2147
2139
  updateTransform(parent = null) {
2148
2140
  if (!parent && !this.parent) return this;
2149
2141
  if (!this.game || !this.visible) return this;
2150
- let p = this.parent;
2151
- if (parent) p = parent;
2152
- else if (!this.parent) p = this.game.world;
2142
+ const p = parent ?? this.parent ?? this.game.world;
2153
2143
  const pt = p.worldTransform;
2154
2144
  const wt = this.worldTransform;
2155
2145
  let a;
@@ -2492,7 +2482,7 @@ var DisplayObject = class {
2492
2482
  set mask(value) {
2493
2483
  if (this._mask) this._mask.isMask = false;
2494
2484
  this._mask = value;
2495
- if (value) this._mask.isMask = true;
2485
+ if (value) value.isMask = true;
2496
2486
  }
2497
2487
  /**
2498
2488
  * Gets the x offset for this display object (based on anchor point).
@@ -3163,8 +3153,10 @@ var Animation = class {
3163
3153
  */
3164
3154
  next(quantity = 1) {
3165
3155
  let frame = this._frameIndex + quantity;
3166
- if (frame >= this._frames.length) if (this.loop) frame %= this._frames.length;
3167
- else frame = this._frames.length - 1;
3156
+ if (frame >= this._frames.length) {
3157
+ if (this.loop) frame %= this._frames.length;
3158
+ else frame = this._frames.length - 1;
3159
+ }
3168
3160
  if (frame !== this._frameIndex) {
3169
3161
  this._frameIndex = frame;
3170
3162
  this.updateCurrentFrame(true);
@@ -3176,8 +3168,10 @@ var Animation = class {
3176
3168
  */
3177
3169
  previous(quantity = 1) {
3178
3170
  let frame = this._frameIndex - quantity;
3179
- if (frame < 0) if (this.loop) frame = this._frames.length + frame;
3180
- else frame += 1;
3171
+ if (frame < 0) {
3172
+ if (this.loop) frame = this._frames.length + frame;
3173
+ else frame += 1;
3174
+ }
3181
3175
  if (frame !== this._frameIndex) {
3182
3176
  this._frameIndex = frame;
3183
3177
  this.updateCurrentFrame(true);
@@ -3412,8 +3406,10 @@ var AnimationManager = class {
3412
3406
  */
3413
3407
  add(name, frameList, frameRate = 60, loop = false, useNumericIndex = void 0) {
3414
3408
  const frames = frameList || [];
3415
- if (useNumericIndex === void 0) if (frames && typeof frames[0] === "number") useNumericIndex = true;
3416
- else useNumericIndex = false;
3409
+ if (useNumericIndex === void 0) {
3410
+ if (frames && typeof frames[0] === "number") useNumericIndex = true;
3411
+ else useNumericIndex = false;
3412
+ }
3417
3413
  this._outputFrames = [];
3418
3414
  this._frameData.getFrameIndexes(frames, useNumericIndex, this._outputFrames);
3419
3415
  this._anims[name] = new Animation(this.game, this.sprite, name, this._frameData, this._outputFrames, frameRate, loop);
@@ -3985,7 +3981,7 @@ var Image$1 = class extends DisplayObject {
3985
3981
  this.destroy();
3986
3982
  return;
3987
3983
  }
3988
- if (!this.exists || !this.parent.exists) {
3984
+ if (!this.exists || !this.parent?.exists) {
3989
3985
  this.renderOrderID = -1;
3990
3986
  return;
3991
3987
  }
@@ -4004,7 +4000,7 @@ var Image$1 = class extends DisplayObject {
4004
4000
  */
4005
4001
  loadTexture(key, frame = 0, stopAnimation = true) {
4006
4002
  if (key === -1) {
4007
- key = frame;
4003
+ key = frame ?? 0;
4008
4004
  frame = 0;
4009
4005
  } else frame = frame || 0;
4010
4006
  if (stopAnimation) this.animations.stop();
@@ -4065,11 +4061,11 @@ var Image$1 = class extends DisplayObject {
4065
4061
  }
4066
4062
  /**
4067
4063
  * Resizes the frame of this image.
4068
- * @param {DisplayObject} parent - The parent display object.
4064
+ * @param {DisplayObject} _parent - The parent display object.
4069
4065
  * @param {number} width - The new width of the frame.
4070
4066
  * @param {number} height - The new height of the frame.
4071
4067
  */
4072
- resizeFrame(parent, width, height) {
4068
+ resizeFrame(_parent, width, height) {
4073
4069
  this.texture.frame.resize(width, height);
4074
4070
  this.texture.setFrame(this.texture.frame);
4075
4071
  }
@@ -4301,7 +4297,7 @@ var BitmapText = class extends DisplayObject {
4301
4297
  this.destroy();
4302
4298
  return;
4303
4299
  }
4304
- if (!this.exists || !this.parent.exists) {
4300
+ if (!this.exists || !this.parent?.exists) {
4305
4301
  this.renderOrderID = -1;
4306
4302
  return;
4307
4303
  }
@@ -4476,10 +4472,10 @@ var BitmapText = class extends DisplayObject {
4476
4472
  /**
4477
4473
  * Adds a color to a specific position in the text.
4478
4474
  * @param {string} value - The color to apply (in hex format or CSS color name).
4479
- * @param {number} position - The character position to apply the color to.
4475
+ * @param {number} _position - The character position to apply the color to.
4480
4476
  * @returns {BitmapText} This bitmap text instance for chaining.
4481
4477
  */
4482
- addColor(value, position) {
4478
+ addColor(value, _position) {
4483
4479
  const color = typeof value === "string" ? Number.parseInt(value.replace("#", ""), 16) : value;
4484
4480
  if (color !== this._tint) {
4485
4481
  this._tint = color;
@@ -4927,6 +4923,7 @@ var InputHandler = class {
4927
4923
  if (!this.enabled) return false;
4928
4924
  if (pointerId === void 0 || pointerId === null) {
4929
4925
  for (let i = 0; i < 10; i += 1) if (this._pointerData[i].isOut) return true;
4926
+ return false;
4930
4927
  }
4931
4928
  return this._pointerData[pointerId].isOut;
4932
4929
  }
@@ -4991,7 +4988,7 @@ var InputHandler = class {
4991
4988
  */
4992
4989
  checkPixel(x, y, pointer) {
4993
4990
  if (this.sprite.texture.baseTexture.source) {
4994
- if (x === null && y === null) {
4991
+ if (x === null || y === null) {
4995
4992
  this.game.input.getLocalPosition(this.sprite, pointer, this._tempPoint);
4996
4993
  x = this._tempPoint.x;
4997
4994
  y = this._tempPoint.y;
@@ -5106,14 +5103,16 @@ var InputHandler = class {
5106
5103
  if (this.sprite && this.sprite.parent && this.sprite.parent.type === 7) this.sprite.parent.onChildInputDown.dispatch(this.sprite, pointer);
5107
5104
  if (this.sprite === null) return;
5108
5105
  }
5109
- if (this.draggable && this.isDragged === false) if (this.dragTimeThreshold === 0 && this.dragDistanceThreshold === 0) this.startDrag(pointer);
5110
- else {
5111
- this._pendingDrag = true;
5112
- this._dragDistancePass = this.dragDistanceThreshold === 0;
5113
- if (this.dragTimeThreshold > 0) {
5114
- this._dragTimePass = false;
5115
- this.game.time.events.add(this.dragTimeThreshold, this.dragTimeElapsed, this, pointer);
5116
- } else this._dragTimePass = true;
5106
+ if (this.draggable && this.isDragged === false) {
5107
+ if (this.dragTimeThreshold === 0 && this.dragDistanceThreshold === 0) this.startDrag(pointer);
5108
+ else {
5109
+ this._pendingDrag = true;
5110
+ this._dragDistancePass = this.dragDistanceThreshold === 0;
5111
+ if (this.dragTimeThreshold > 0) {
5112
+ this._dragTimePass = false;
5113
+ this.game.time.events.add(this.dragTimeThreshold, this.dragTimeElapsed, this, pointer);
5114
+ } else this._dragTimePass = true;
5115
+ }
5117
5116
  }
5118
5117
  if (this.bringToTop) this.sprite.bringToTop();
5119
5118
  }
@@ -5544,10 +5543,10 @@ var Button = class extends Image$1 {
5544
5543
  }
5545
5544
  /**
5546
5545
  * Handles the input over event for this button.
5547
- * @param {object} sprite - The sprite that triggered the event.
5546
+ * @param {object} _sprite - The sprite that triggered the event.
5548
5547
  * @param {object} pointer - The pointer that triggered the event.
5549
5548
  */
5550
- onInputOverHandler(sprite, pointer) {
5549
+ onInputOverHandler(_sprite, pointer) {
5551
5550
  if (pointer.justReleased() && (this.justReleasedPreventsOver & pointer.pointerMode) === pointer.pointerMode) return;
5552
5551
  this.changeStateFrame(STATE_OVER);
5553
5552
  if (this.onOverMouseOnly && !pointer.isMouse) return;
@@ -5555,34 +5554,36 @@ var Button = class extends Image$1 {
5555
5554
  }
5556
5555
  /**
5557
5556
  * Handles the input out event for this button.
5558
- * @param {object} sprite - The sprite that triggered the event.
5557
+ * @param {object} _sprite - The sprite that triggered the event.
5559
5558
  * @param {object} pointer - The pointer that triggered the event.
5560
5559
  */
5561
- onInputOutHandler(sprite, pointer) {
5560
+ onInputOutHandler(_sprite, pointer) {
5562
5561
  this.changeStateFrame(STATE_OUT);
5563
5562
  if (this.onInputOut) this.onInputOut.dispatch(this, pointer);
5564
5563
  }
5565
5564
  /**
5566
5565
  * Handles the input down event for this button.
5567
- * @param {object} sprite - The sprite that triggered the event.
5566
+ * @param {object} _sprite - The sprite that triggered the event.
5568
5567
  * @param {object} pointer - The pointer that triggered the event.
5569
5568
  */
5570
- onInputDownHandler(sprite, pointer) {
5569
+ onInputDownHandler(_sprite, pointer) {
5571
5570
  this.changeStateFrame(STATE_DOWN);
5572
5571
  if (this.onInputDown) this.onInputDown.dispatch(this, pointer);
5573
5572
  }
5574
5573
  /**
5575
5574
  * Handles the input up event for this button.
5576
- * @param {object} sprite - The sprite that triggered the event.
5575
+ * @param {object} _sprite - The sprite that triggered the event.
5577
5576
  * @param {object} pointer - The pointer that triggered the event.
5578
5577
  * @param {boolean} isOver - Whether the pointer is currently over the button (default: true).
5579
5578
  */
5580
- onInputUpHandler(sprite, pointer, isOver) {
5579
+ onInputUpHandler(_sprite, pointer, isOver) {
5581
5580
  if (this.onInputUp) this.onInputUp.dispatch(this, pointer, isOver);
5582
5581
  if (this.freezeFrames) return;
5583
5582
  if (this.forceOut === true || (this.forceOut & pointer.pointerMode) === pointer.pointerMode) this.changeStateFrame(STATE_OUT);
5584
- else if (!this.changeStateFrame(STATE_UP)) if (isOver) this.changeStateFrame(STATE_OVER);
5585
- else this.changeStateFrame(STATE_OUT);
5583
+ else if (!this.changeStateFrame(STATE_UP)) {
5584
+ if (isOver) this.changeStateFrame(STATE_OVER);
5585
+ else this.changeStateFrame(STATE_OUT);
5586
+ }
5586
5587
  }
5587
5588
  /**
5588
5589
  * Gets whether input is currently enabled for this button.
@@ -6685,7 +6686,7 @@ function zOrder(x, y, minX, minY, size) {
6685
6686
  * @param {number} minY - The minimum y-coordinate of the bounding box.
6686
6687
  * @param {number} size - The size of the bounding box.
6687
6688
  */
6688
- function indexCurve(start, minX, minY, size) {
6689
+ function indexCurve(start, minX = 0, minY = 0, size = 0) {
6689
6690
  let p = start;
6690
6691
  do {
6691
6692
  if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);
@@ -6882,7 +6883,7 @@ function isEar(ear) {
6882
6883
  * @param {number} size - TBD.
6883
6884
  * @returns {boolean} TBD.
6884
6885
  */
6885
- function isEarHashed(ear, minX, minY, size) {
6886
+ function isEarHashed(ear, minX = 0, minY = 0, size = 0) {
6886
6887
  const a = ear.prev;
6887
6888
  const b = ear;
6888
6889
  const c = ear.next;
@@ -7021,6 +7022,7 @@ function eliminateHoles(data, holeIndices, outerNode, dim) {
7021
7022
  start = holeIndices[i] * dim;
7022
7023
  end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
7023
7024
  list = linkedList(data, start, end, dim, false);
7025
+ if (!list) continue;
7024
7026
  if (list === list.next) list.steiner = true;
7025
7027
  queue.push(getLeftmost(list));
7026
7028
  }
@@ -7065,7 +7067,7 @@ function cureLocalIntersections(start, triangles, dim) {
7065
7067
  * @param {number} minY - The minimum y-coordinate of the bounding box.
7066
7068
  * @param {number} size - The size of the bounding box.
7067
7069
  */
7068
- function splitEarcut(start, triangles, dim, minX, minY, size) {
7070
+ function splitEarcut(start, triangles, dim, minX = 0, minY = 0, size = 0) {
7069
7071
  let a = start;
7070
7072
  do {
7071
7073
  let b = a.next.next;
@@ -7676,15 +7678,17 @@ const updateGraphics = (graphics, gl) => {
7676
7678
  if (data.points[0] !== data.points[data.points.length - 2] || data.points[1] !== data.points[data.points.length - 1]) data.points.push(data.points[0], data.points[1]);
7677
7679
  }
7678
7680
  if (data.fill) {
7679
- if (data.points.length >= stencilBufferLimit) if (data.points.length < stencilBufferLimit * 2) {
7680
- webGLData = switchMode(webGL, 0);
7681
- if (!buildPoly(data, webGLData)) {
7681
+ if (data.points.length >= stencilBufferLimit) {
7682
+ if (data.points.length < stencilBufferLimit * 2) {
7683
+ webGLData = switchMode(webGL, 0);
7684
+ if (!buildPoly(data, webGLData)) {
7685
+ webGLData = switchMode(webGL, 1);
7686
+ buildComplexPoly(data, webGLData);
7687
+ }
7688
+ } else {
7682
7689
  webGLData = switchMode(webGL, 1);
7683
7690
  buildComplexPoly(data, webGLData);
7684
7691
  }
7685
- } else {
7686
- webGLData = switchMode(webGL, 1);
7687
- buildComplexPoly(data, webGLData);
7688
7692
  }
7689
7693
  }
7690
7694
  if (data.lineWidth > 0) {
@@ -7934,11 +7938,13 @@ var Graphics = class extends DisplayObject {
7934
7938
  this.lineWidth = lineWidth || 0;
7935
7939
  this.lineColor = color || 0;
7936
7940
  this.lineAlpha = alpha === void 0 ? 1 : alpha;
7937
- if (this.currentPath) if (this.currentPath.shape.points.length) this.drawShape(new Polygon(this.currentPath.shape.points.slice(-2)));
7938
- else {
7939
- this.currentPath.lineWidth = this.lineWidth;
7940
- this.currentPath.lineColor = this.lineColor;
7941
- this.currentPath.lineAlpha = this.lineAlpha;
7941
+ if (this.currentPath) {
7942
+ if (this.currentPath.shape.points.length) this.drawShape(new Polygon(this.currentPath.shape.points.slice(-2)));
7943
+ else {
7944
+ this.currentPath.lineWidth = this.lineWidth;
7945
+ this.currentPath.lineColor = this.lineColor;
7946
+ this.currentPath.lineAlpha = this.lineAlpha;
7947
+ }
7942
7948
  }
7943
7949
  return this;
7944
7950
  }
@@ -8569,25 +8575,26 @@ var Graphics = class extends DisplayObject {
8569
8575
  const point3 = new Point();
8570
8576
  let points = [];
8571
8577
  let i;
8572
- if (!indices) if (vertices[0] instanceof Point) for (i = 0; i < vertices.length / 3; i += 1) this.drawTriangle([
8573
- vertices[i * 3],
8574
- vertices[i * 3 + 1],
8575
- vertices[i * 3 + 2]
8576
- ], cull);
8577
- else for (i = 0; i < vertices.length / 6; i += 1) {
8578
- point1.x = vertices[i * 6 + 0];
8579
- point1.y = vertices[i * 6 + 1];
8580
- point2.x = vertices[i * 6 + 2];
8581
- point2.y = vertices[i * 6 + 3];
8582
- point3.x = vertices[i * 6 + 4];
8583
- point3.y = vertices[i * 6 + 5];
8584
- this.drawTriangle([
8585
- point1,
8586
- point2,
8587
- point3
8578
+ if (!indices) {
8579
+ if (vertices[0] instanceof Point) for (i = 0; i < vertices.length / 3; i += 1) this.drawTriangle([
8580
+ vertices[i * 3],
8581
+ vertices[i * 3 + 1],
8582
+ vertices[i * 3 + 2]
8588
8583
  ], cull);
8589
- }
8590
- else if (vertices[0] instanceof Point) for (i = 0; i < indices.length / 3; i += 1) {
8584
+ else for (i = 0; i < vertices.length / 6; i += 1) {
8585
+ point1.x = vertices[i * 6 + 0];
8586
+ point1.y = vertices[i * 6 + 1];
8587
+ point2.x = vertices[i * 6 + 2];
8588
+ point2.y = vertices[i * 6 + 3];
8589
+ point3.x = vertices[i * 6 + 4];
8590
+ point3.y = vertices[i * 6 + 5];
8591
+ this.drawTriangle([
8592
+ point1,
8593
+ point2,
8594
+ point3
8595
+ ], cull);
8596
+ }
8597
+ } else if (vertices[0] instanceof Point) for (i = 0; i < indices.length / 3; i += 1) {
8591
8598
  points.push(vertices[indices[i * 3]]);
8592
8599
  points.push(vertices[indices[i * 3 + 1]]);
8593
8600
  points.push(vertices[indices[i * 3 + 2]]);
@@ -8818,7 +8825,7 @@ var Group = class extends DisplayObject {
8818
8825
  this.destroy();
8819
8826
  return;
8820
8827
  }
8821
- if (!this.exists || !this.parent.exists) {
8828
+ if (!this.exists || !this.parent?.exists) {
8822
8829
  this.renderOrderID = -1;
8823
8830
  return;
8824
8831
  }
@@ -9325,7 +9332,8 @@ var Text = class extends Image$1 {
9325
9332
  if (wordWidth <= currentLineWidth) break;
9326
9333
  }
9327
9334
  if (!newWord.length) throw new Error("This text's wordWrapWidth setting is less than a single character!");
9328
- words[j] = word.substr(newWord.length);
9335
+ const secondPart = word.substr(newWord.length);
9336
+ words[j] = secondPart;
9329
9337
  out += newWord;
9330
9338
  }
9331
9339
  const offset = words[j].length ? j : j + 1;
@@ -10118,8 +10126,7 @@ var GameObjectFactory = class {
10118
10126
  * @returns {Image} The created Image object.
10119
10127
  */
10120
10128
  image(x, y, key, frame, group = null) {
10121
- if (!group) group = this.game.world;
10122
- return group.add(new Image$1(this.game, x, y, key, frame));
10129
+ return (group ?? this.game.world).add(new Image$1(this.game, x, y, key, frame));
10123
10130
  }
10124
10131
  /**
10125
10132
  * Creates a new Group object.
@@ -10243,9 +10250,8 @@ const create = (parent, width, height, id, skipPool) => {
10243
10250
  */
10244
10251
  const setTouchAction = (canvas, value = "none") => {
10245
10252
  value = value || "none";
10246
- canvas.style.msTouchAction = value;
10247
- canvas.style["ms-touch-action"] = value;
10248
- canvas.style["touch-action"] = value;
10253
+ canvas.style.setProperty("-ms-touch-action", value);
10254
+ canvas.style.setProperty("touch-action", value);
10249
10255
  return canvas;
10250
10256
  };
10251
10257
  /**
@@ -10256,13 +10262,13 @@ const setTouchAction = (canvas, value = "none") => {
10256
10262
  */
10257
10263
  const setUserSelect = (canvas, value = "none") => {
10258
10264
  value = value || "none";
10259
- canvas.style["-webkit-touch-callout"] = value;
10260
- canvas.style["-webkit-user-select"] = value;
10261
- canvas.style["-khtml-user-select"] = value;
10262
- canvas.style["-moz-user-select"] = value;
10263
- canvas.style["-ms-user-select"] = value;
10264
- canvas.style["user-select"] = value;
10265
- canvas.style["-webkit-tap-highlight-color"] = "rgba(0, 0, 0, 0)";
10265
+ canvas.style.setProperty("-webkit-touch-callout", value);
10266
+ canvas.style.setProperty("-webkit-user-select", value);
10267
+ canvas.style.setProperty("-khtml-user-select", value);
10268
+ canvas.style.setProperty("-moz-user-select", value);
10269
+ canvas.style.setProperty("-ms-user-select", value);
10270
+ canvas.style.setProperty("user-select", value);
10271
+ canvas.style.setProperty("-webkit-tap-highlight-color", "rgba(0, 0, 0, 0)");
10266
10272
  return canvas;
10267
10273
  };
10268
10274
  /**
@@ -10303,9 +10309,10 @@ const getSmoothingPrefix = (context) => {
10303
10309
  "mozI",
10304
10310
  "oI"
10305
10311
  ];
10312
+ const smoothingFlags = context;
10306
10313
  for (let i = 0; i < VENDORS.length; i += 1) {
10307
10314
  const s = `${VENDORS[i]}mageSmoothingEnabled`;
10308
- if (context && context[s]) return s;
10315
+ if (context && smoothingFlags[s]) return s;
10309
10316
  }
10310
10317
  return null;
10311
10318
  };
@@ -10327,7 +10334,7 @@ var CanvasRenderer = class {
10327
10334
  renderSession;
10328
10335
  /**
10329
10336
  * Creates a new CanvasRenderer instance.
10330
- * @param {import('../../core/game.js').Game} game - The game instance.
10337
+ * @param {import('../../core/game.js').Game} _game - The game instance.
10331
10338
  */
10332
10339
  constructor(game) {
10333
10340
  detectCapabilities(game);
@@ -10447,7 +10454,7 @@ var CanvasRenderer = class {
10447
10454
  * Initializes the WebGL context for rendering.
10448
10455
  * @param {import('../../core/game.js').Game} game - The game instance.
10449
10456
  */
10450
- initContext(game) {}
10457
+ initContext(_game) {}
10451
10458
  };
10452
10459
  //#endregion
10453
10460
  //#region src/phaser/display/webgl/blend_manager.ts
@@ -10603,6 +10610,7 @@ const getWebGLContextErrorName = (errorCode) => {
10603
10610
  const compileShader = (gl, shaderSrc, shaderType) => {
10604
10611
  const src = Array.isArray(shaderSrc) ? shaderSrc.join("\n") : shaderSrc;
10605
10612
  const shader = gl.createShader(shaderType);
10613
+ if (!shader) return null;
10606
10614
  gl.shaderSource(shader, src);
10607
10615
  gl.compileShader(shader);
10608
10616
  if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
@@ -10641,6 +10649,7 @@ const compileProgram = (gl, vertexSrc, fragmentSrc) => {
10641
10649
  const fragmentShader = compileFragmentShader(gl, fragmentSrc);
10642
10650
  const vertexShader = compileVertexShader(gl, vertexSrc);
10643
10651
  const shaderProgram = gl.createProgram();
10652
+ if (!shaderProgram || !vertexShader || !fragmentShader) return null;
10644
10653
  gl.attachShader(shaderProgram, vertexShader);
10645
10654
  gl.attachShader(shaderProgram, fragmentShader);
10646
10655
  gl.linkProgram(shaderProgram);
@@ -10971,18 +10980,21 @@ var NormalShader = class {
10971
10980
  for (let i = 0; i < keys.length; i += 1) {
10972
10981
  const key = keys[i];
10973
10982
  uniform = this.uniforms[key];
10974
- if (uniform.glValueLength === 1) if (uniform.glMatrix === true) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.transpose, uniform.value);
10975
- else uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value);
10976
- else if (uniform.glValueLength === 2) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y);
10983
+ if (uniform.glValueLength === 1) {
10984
+ if (uniform.glMatrix === true) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.transpose, uniform.value);
10985
+ else uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value);
10986
+ } else if (uniform.glValueLength === 2) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y);
10977
10987
  else if (uniform.glValueLength === 3) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y, uniform.value.z);
10978
10988
  else if (uniform.glValueLength === 4) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y, uniform.value.z, uniform.value.w);
10979
- else if (uniform.type === "sampler2D") if (uniform._init) {
10980
- gl.activeTexture(gl[`TEXTURE${this.textureCount}`]);
10981
- if (uniform.value.baseTexture._dirty[gl.id]) window.PhaserRegistry.INSTANCES[gl.id].updateTexture(uniform.value.baseTexture);
10982
- else gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]);
10983
- gl.uniform1i(uniform.uniformLocation, this.textureCount);
10984
- this.textureCount += 1;
10985
- } else this.initSampler2D(uniform);
10989
+ else if (uniform.type === "sampler2D") {
10990
+ if (uniform._init) {
10991
+ gl.activeTexture(gl[`TEXTURE${this.textureCount}`]);
10992
+ if (uniform.value.baseTexture._dirty[gl.id]) window.PhaserRegistry.INSTANCES[gl.id].updateTexture(uniform.value.baseTexture);
10993
+ else gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]);
10994
+ gl.uniform1i(uniform.uniformLocation, this.textureCount);
10995
+ this.textureCount += 1;
10996
+ } else this.initSampler2D(uniform);
10997
+ }
10986
10998
  }
10987
10999
  }
10988
11000
  /**
@@ -12207,7 +12219,8 @@ const jsonBitmapFont = (json, baseTexture, xSpacing, ySpacing) => {
12207
12219
  };
12208
12220
  });
12209
12221
  if (json.font.kernings && json.font.kernings.kerning) json.font.kernings.kerning.forEach((kerning) => {
12210
- data.chars[kerning._second].kerning[kerning._first] = Number.parseInt(kerning._amount, 10);
12222
+ const char = data.chars[Number.parseInt(kerning._second, 10)];
12223
+ if (char) char.kerning[Number.parseInt(kerning._first, 10)] = Number.parseInt(kerning._amount, 10);
12211
12224
  });
12212
12225
  return finalizeBitmapFont(baseTexture, data);
12213
12226
  };
@@ -12284,18 +12297,19 @@ var Cache = class {
12284
12297
  * @returns {object} The cached image object.
12285
12298
  */
12286
12299
  addImage(key, url, data) {
12300
+ const resolvedUrl = url ?? "";
12287
12301
  if (this.checkImageKey(key)) this.removeImage(key);
12288
12302
  const img = {
12289
12303
  key,
12290
- url,
12304
+ url: resolvedUrl,
12291
12305
  data,
12292
12306
  base: new BaseTexture(data),
12293
12307
  frame: new Frame(0, 0, 0, data.width, data.height, key),
12294
12308
  frameData: new FrameData()
12295
12309
  };
12296
- img.frameData.addFrame(new Frame(0, 0, 0, data.width, data.height, url));
12310
+ img.frameData.addFrame(new Frame(0, 0, 0, data.width, data.height, resolvedUrl));
12297
12311
  this._cache.image[key] = img;
12298
- this._resolveURL(url, img);
12312
+ this._resolveURL(resolvedUrl, img);
12299
12313
  return img;
12300
12314
  }
12301
12315
  /**
@@ -12528,11 +12542,11 @@ var Cache = class {
12528
12542
  * TBD.
12529
12543
  * @param {string} key - TBD.
12530
12544
  * @param {number} cache - TBD.
12531
- * @param {string} method - TBD.
12545
+ * @param {string} _method - TBD.
12532
12546
  * @param {string} property - TBD.
12533
12547
  * @returns {*} TBD.
12534
12548
  */
12535
- getItem(key, cache, method, property = null) {
12549
+ getItem(key, cache, _method, property = null) {
12536
12550
  if (this.checkKey(cache, key)) {
12537
12551
  if (!property) return this._cacheMap[cache][key];
12538
12552
  return this._cacheMap[cache][key][property];
@@ -13054,14 +13068,15 @@ const checkFullScreenSupport = (device) => {
13054
13068
  "mozCancelFullScreen",
13055
13069
  "mozExitFullscreen"
13056
13070
  ];
13057
- const element = document.createElement("div");
13058
- for (let i = 0; i < fs.length; i += 1) if (element[fs[i]]) {
13071
+ const elementApi = document.createElement("div");
13072
+ for (let i = 0; i < fs.length; i += 1) if (elementApi[fs[i]]) {
13059
13073
  device.fullscreen = true;
13060
13074
  device.requestFullscreen = fs[i];
13061
13075
  break;
13062
13076
  }
13063
13077
  if (device.fullscreen) {
13064
- for (let i = 0; i < cfs.length; i += 1) if (document[cfs[i]]) {
13078
+ const documentApi = document;
13079
+ for (let i = 0; i < cfs.length; i += 1) if (documentApi[cfs[i]]) {
13065
13080
  device.cancelFullscreen = cfs[i];
13066
13081
  break;
13067
13082
  }
@@ -13600,10 +13615,10 @@ var MSPointer = class {
13600
13615
  canvas.removeEventListener("pointerdown", this._onMSPointerDown, false);
13601
13616
  canvas.removeEventListener("pointermove", this._onMSPointerMove, false);
13602
13617
  canvas.removeEventListener("pointerup", this._onMSPointerUp, false);
13603
- window.removeEventListener("MSPointerUp", this._onMSPointerUpGlobal, true);
13618
+ if (this._onMSPointerUpGlobal) window.removeEventListener("MSPointerUp", this._onMSPointerUpGlobal, true);
13604
13619
  canvas.removeEventListener("MSPointerOver", this._onMSPointerOver, true);
13605
13620
  canvas.removeEventListener("MSPointerOut", this._onMSPointerOut, true);
13606
- window.removeEventListener("pointerup", this._onMSPointerUpGlobal, true);
13621
+ if (this._onMSPointerUpGlobal) window.removeEventListener("pointerup", this._onMSPointerUpGlobal, true);
13607
13622
  canvas.removeEventListener("pointerover", this._onMSPointerOver, true);
13608
13623
  canvas.removeEventListener("pointerout", this._onMSPointerOut, true);
13609
13624
  }
@@ -14931,10 +14946,12 @@ var Loader = class {
14931
14946
  this.game.logger.warn(`Loader: Invalid or no key given of type ${type}`);
14932
14947
  return this;
14933
14948
  }
14934
- if (url === void 0 || url === null) if (extension) url = key + extension;
14935
- else {
14936
- this.game.logger.warn(`Loader: No URL given for file type: ${type} key: ${key}`);
14937
- return this;
14949
+ if (url === void 0 || url === null) {
14950
+ if (extension) url = key + extension;
14951
+ else {
14952
+ this.game.logger.warn(`Loader: No URL given for file type: ${type} key: ${key}`);
14953
+ return this;
14954
+ }
14938
14955
  }
14939
14956
  const file = {
14940
14957
  type,
@@ -14948,11 +14965,8 @@ var Loader = class {
14948
14965
  error: false
14949
14966
  };
14950
14967
  if (properties) {
14951
- const keys = Object.keys(properties);
14952
- for (let i = 0; i < keys.length; i += 1) {
14953
- const prop = keys[i];
14954
- file[prop] = properties[prop];
14955
- }
14968
+ const extraProperties = properties;
14969
+ for (const prop of Object.keys(extraProperties)) file[prop] = extraProperties[prop];
14956
14970
  }
14957
14971
  const fileIndex = this.getAssetIndex(type, key);
14958
14972
  if (overwrite && fileIndex > -1) {
@@ -15374,9 +15388,7 @@ var Loader = class {
15374
15388
  case "bitmapFont":
15375
15389
  this.bitmapFont(file.key, file.textureURL, file.fontDataURL ? file.fontDataURL : file.atlasURL, file.atlasData, file.xSpacing, file.ySpacing);
15376
15390
  break;
15377
- case "atlas":
15378
- this.atlas(file.key, file.textureURL, file.atlasURL, file.atlasData, TEXTURE_ATLAS_JSON_HASH);
15379
- break;
15391
+ case "atlas": this.atlas(file.key, file.textureURL, file.atlasURL, file.atlasData, TEXTURE_ATLAS_JSON_HASH);
15380
15392
  }
15381
15393
  }
15382
15394
  }
@@ -15419,10 +15431,7 @@ var Loader = class {
15419
15431
  case "xml":
15420
15432
  this.xhrLoad(file, this.transformUrl(file.url, file), "text", this.xmlLoadComplete);
15421
15433
  break;
15422
- case "text":
15423
- this.xhrLoad(file, this.transformUrl(file.url, file), "text", this.fileComplete);
15424
- break;
15425
- default: break;
15434
+ case "text": this.xhrLoad(file, this.transformUrl(file.url, file), "text", this.fileComplete);
15426
15435
  }
15427
15436
  }
15428
15437
  /**
@@ -15474,13 +15483,15 @@ var Loader = class {
15474
15483
  onerror = onerror || this.fileError;
15475
15484
  xhr.onload = () => {
15476
15485
  try {
15477
- if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
15478
- setTimeout(() => {
15479
- file.numRetry = !file.numRetry ? 1 : file.numRetry += 1;
15480
- scope.xhrLoad(file, url, type, onload, onerror);
15481
- }, 1e3);
15482
- return null;
15483
- } else return onerror.call(scope, file, xhr);
15486
+ if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) {
15487
+ if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
15488
+ setTimeout(() => {
15489
+ file.numRetry = !file.numRetry ? 1 : file.numRetry += 1;
15490
+ scope.xhrLoad(file, url, type, onload, onerror);
15491
+ }, 1e3);
15492
+ return null;
15493
+ } else return onerror.call(scope, file, xhr);
15494
+ }
15484
15495
  return onload.call(scope, file, xhr);
15485
15496
  } catch (error) {
15486
15497
  const typedError = error instanceof Error ? error : new Error(String(error));
@@ -15605,8 +15616,6 @@ var Loader = class {
15605
15616
  case "text":
15606
15617
  file.data = xhr.responseText;
15607
15618
  this.cache.addText(file.key, file.url, file.data);
15608
- break;
15609
- default: break;
15610
15619
  }
15611
15620
  if (loadNext) this.asyncComplete(file);
15612
15621
  }
@@ -16229,8 +16238,10 @@ var ScaleManager = class {
16229
16238
  * @param {object} config - TBD.
16230
16239
  */
16231
16240
  parseConfig(config) {
16232
- if (config.scaleMode !== void 0) if (this._booted) this.scaleMode = config.scaleMode;
16233
- else this._pendingScaleMode = config.scaleMode;
16241
+ if (config.scaleMode !== void 0) {
16242
+ if (this._booted) this.scaleMode = config.scaleMode;
16243
+ else this._pendingScaleMode = config.scaleMode;
16244
+ }
16234
16245
  if (config.fullScreenScaleMode !== void 0) this.fullScreenScaleMode = config.fullScreenScaleMode;
16235
16246
  if (config.fullScreenTarget) this.fullScreenTarget = config.fullScreenTarget;
16236
16247
  else this.fullScreenTarget = document.documentElement;
@@ -16433,8 +16444,10 @@ var ScaleManager = class {
16433
16444
  this.incorrectOrientation = this.forceLandscape && !this.isLandscape || this.forcePortrait && !this.isPortrait;
16434
16445
  const changed = previousOrientation !== this.screenOrientation;
16435
16446
  const correctnessChanged = previouslyIncorrect !== this.incorrectOrientation;
16436
- if (correctnessChanged) if (this.incorrectOrientation) this.enterIncorrectOrientation.dispatch();
16437
- else this.leaveIncorrectOrientation.dispatch();
16447
+ if (correctnessChanged) {
16448
+ if (this.incorrectOrientation) this.enterIncorrectOrientation.dispatch();
16449
+ else this.leaveIncorrectOrientation.dispatch();
16450
+ }
16438
16451
  if (changed || correctnessChanged) this.onOrientationChange.dispatch(this, previousOrientation, previouslyIncorrect);
16439
16452
  return changed || correctnessChanged;
16440
16453
  }
@@ -16471,12 +16484,13 @@ var ScaleManager = class {
16471
16484
  }
16472
16485
  if (this.incorrectOrientation) this.setMaximum();
16473
16486
  else if (scaleMode === 0) this.setExactFit();
16474
- else if (scaleMode === 2) if (!this.isFullScreen && this.boundingParent && this.compatibility.canExpandParent) {
16475
- this.setShowAll(true);
16476
- this.resetCanvas();
16477
- this.setShowAll();
16478
- } else this.setShowAll();
16479
- else if (scaleMode === 1) {
16487
+ else if (scaleMode === 2) {
16488
+ if (!this.isFullScreen && this.boundingParent && this.compatibility.canExpandParent) {
16489
+ this.setShowAll(true);
16490
+ this.resetCanvas();
16491
+ this.setShowAll();
16492
+ } else this.setShowAll();
16493
+ } else if (scaleMode === 1) {
16480
16494
  this.width = this.game.width;
16481
16495
  this.height = this.game.height;
16482
16496
  } else if (scaleMode === 4) {
@@ -16583,8 +16597,10 @@ var ScaleManager = class {
16583
16597
  this.height = Math.max(this.minHeight || 0, Math.min(this.maxHeight || this.height, this.height));
16584
16598
  }
16585
16599
  this.resetCanvas();
16586
- if (!this.compatibility.noMargins) if (this.isFullScreen && this._createdFullScreenTarget) this.alignCanvas(true, true);
16587
- else this.alignCanvas(this.pageAlignHorizontally, this.pageAlignVertically);
16600
+ if (!this.compatibility.noMargins) {
16601
+ if (this.isFullScreen && this._createdFullScreenTarget) this.alignCanvas(true, true);
16602
+ else this.alignCanvas(this.pageAlignHorizontally, this.pageAlignVertically);
16603
+ }
16588
16604
  this.updateScalingAndBounds();
16589
16605
  }
16590
16606
  /**
@@ -16834,12 +16850,14 @@ var ScaleManager = class {
16834
16850
  * TBD.
16835
16851
  */
16836
16852
  set fullScreenScaleMode(value) {
16837
- if (value !== this._fullScreenScaleMode) if (this.isFullScreen) {
16838
- this.prepScreenMode(false);
16839
- this._fullScreenScaleMode = value;
16840
- this.prepScreenMode(true);
16841
- this.queueUpdate(true);
16842
- } else this._fullScreenScaleMode = value;
16853
+ if (value !== this._fullScreenScaleMode) {
16854
+ if (this.isFullScreen) {
16855
+ this.prepScreenMode(false);
16856
+ this._fullScreenScaleMode = value;
16857
+ this.prepScreenMode(true);
16858
+ this.queueUpdate(true);
16859
+ } else this._fullScreenScaleMode = value;
16860
+ }
16843
16861
  }
16844
16862
  /**
16845
16863
  * TBD.
@@ -16932,10 +16950,10 @@ var Scene = class {
16932
16950
  update() {}
16933
16951
  /**
16934
16952
  * Handle scene resize.
16935
- * @param {number} width - The new width of the scene.
16936
- * @param {number} height - The new height of the scene.
16953
+ * @param {number} _width - The new width of the scene.
16954
+ * @param {number} _height - The new height of the scene.
16937
16955
  */
16938
- resize(width, height) {}
16956
+ resize(_width, _height) {}
16939
16957
  /**
16940
16958
  * Update the scene while paused.
16941
16959
  * This method is called every frame while the scene is paused.
@@ -17011,8 +17029,10 @@ var SceneManager = class {
17011
17029
  newState.game = this.game;
17012
17030
  } else if (typeof state === "function") newState = new state(this.game);
17013
17031
  this.states[key] = newState;
17014
- if (autoStart) if (this.game.isBooted) this.start(key);
17015
- else this._pendingState = key;
17032
+ if (autoStart) {
17033
+ if (this.game.isBooted) this.start(key);
17034
+ else this._pendingState = key;
17035
+ }
17016
17036
  return newState;
17017
17037
  }
17018
17038
  /**
@@ -17280,7 +17300,6 @@ var Sound = class {
17280
17300
  this.key = key;
17281
17301
  this.loop = loop;
17282
17302
  this.markers = {};
17283
- this.context = null;
17284
17303
  this.autoplay = false;
17285
17304
  this.totalDuration = 0;
17286
17305
  this.startTime = 0;
@@ -17300,20 +17319,14 @@ var Sound = class {
17300
17319
  this.allowMultiple = false;
17301
17320
  /** @type {GainNode} */
17302
17321
  this.externalNode = null;
17303
- /** @type {GainNode} */
17304
- this.masterGainNode = null;
17305
- /** @type {GainNode} */
17306
- this.gainNode = null;
17307
- /** @type {AudioBufferSourceNode} */
17308
- this._sound = null;
17309
17322
  this._markedToDelete = false;
17310
17323
  this._removeFromSoundManager = false;
17311
17324
  this.context = this.game.sound.context;
17312
17325
  this.masterGainNode = this.game.sound.masterGain;
17313
- if (this.context.createGain === void 0) this.gainNode = this.context.createGainNode();
17314
- else this.gainNode = this.context.createGain();
17315
- this.gainNode.gain.value = volume * this.game.sound.volume;
17316
- if (connect) this.gainNode.connect(this.masterGainNode);
17326
+ const gainNode = this.context.createGain === void 0 ? this.context.createGainNode() : this.context.createGain();
17327
+ this.gainNode = gainNode;
17328
+ gainNode.gain.value = volume * this.game.sound.volume;
17329
+ if (connect && this.masterGainNode) gainNode.connect(this.masterGainNode);
17317
17330
  this.onPlay = new Signal();
17318
17331
  this.onPause = new Signal();
17319
17332
  this.onResume = new Signal();
@@ -17455,24 +17468,25 @@ var Sound = class {
17455
17468
  this.isPlaying = false;
17456
17469
  }
17457
17470
  if (marker === "" && Object.keys(this.markers).length > 0) return this;
17458
- if (marker !== "") if (this.markers[marker]) {
17459
- this.currentMarker = marker;
17460
- this.position = this.markers[marker].start;
17461
- this.volume = this.markers[marker].volume;
17462
- this.loop = this.markers[marker].loop;
17463
- this.duration = this.markers[marker].duration;
17464
- this.durationMS = this.markers[marker].durationMS;
17465
- if (volume !== void 0) this.volume = volume;
17466
- if (loop !== void 0) this.loop = loop;
17467
- this._tempMarker = marker;
17468
- this._tempPosition = this.position;
17469
- this._tempVolume = this.volume;
17470
- this._tempLoop = this.loop;
17471
+ if (marker !== "") {
17472
+ if (this.markers[marker]) {
17473
+ this.currentMarker = marker;
17474
+ this.position = this.markers[marker].start;
17475
+ this.volume = this.markers[marker].volume;
17476
+ this.loop = this.markers[marker].loop;
17477
+ this.duration = this.markers[marker].duration;
17478
+ this.durationMS = this.markers[marker].durationMS;
17479
+ if (volume !== void 0) this.volume = volume;
17480
+ if (loop !== void 0) this.loop = loop;
17481
+ this._tempMarker = marker;
17482
+ this._tempPosition = this.position;
17483
+ this._tempVolume = this.volume;
17484
+ this._tempLoop = this.loop;
17485
+ } else {
17486
+ this.game.logger.warn(`Sound.play: audio marker ${marker} does not exist`);
17487
+ return this;
17488
+ }
17471
17489
  } else {
17472
- this.game.logger.warn(`Sound.play: audio marker ${marker} does not exist`);
17473
- return this;
17474
- }
17475
- else {
17476
17490
  position = position || 0;
17477
17491
  if (volume === void 0) volume = this._volume;
17478
17492
  if (loop === void 0) ({loop} = this);
@@ -17494,7 +17508,7 @@ var Sound = class {
17494
17508
  this._sound.buffer = this._buffer;
17495
17509
  if (this.loop && marker === "") this._sound.loop = true;
17496
17510
  if (!this.loop && marker === "") this._sound.onended = this.onEndedHandler.bind(this);
17497
- this.totalDuration = this._sound.buffer.duration;
17511
+ this.totalDuration = this._sound.buffer?.duration ?? 0;
17498
17512
  if (this.duration === 0) {
17499
17513
  this.duration = this.totalDuration;
17500
17514
  this.durationMS = Math.ceil(this.totalDuration * 1e3);
@@ -19044,9 +19058,10 @@ var TweenData = class {
19044
19058
  * @returns {number} The tween status (TWEEN_PENDING, TWEEN_RUNNING, or TWEEN_COMPLETE).
19045
19059
  */
19046
19060
  update(time) {
19047
- if (!this.isRunning) if (time >= this.startTime) this.isRunning = true;
19048
- else return 0;
19049
- else if (time < this.startTime) return 1;
19061
+ if (!this.isRunning) {
19062
+ if (time >= this.startTime) this.isRunning = true;
19063
+ else return 0;
19064
+ } else if (time < this.startTime) return 1;
19050
19065
  const ms = this.game.time.elapsedMS;
19051
19066
  if (this.parent.reverse) {
19052
19067
  this.dt -= ms * this.parent.timeScale;
@@ -19274,7 +19289,8 @@ var Tween = class {
19274
19289
  const keys = Object.keys(this.timeline[i].vEnd);
19275
19290
  for (let k = 0; k < keys.length; k += 1) {
19276
19291
  const property = keys[k];
19277
- this.properties[property] = this.target[property] || 0;
19292
+ const targetProperties = this.target;
19293
+ this.properties[property] = targetProperties[property] || 0;
19278
19294
  if (!Array.isArray(this.properties[property])) this.properties[property] *= 1;
19279
19295
  }
19280
19296
  }
@@ -19312,7 +19328,7 @@ var Tween = class {
19312
19328
  */
19313
19329
  updateTweenData(property, value, index = 0) {
19314
19330
  if (this.timeline.length === 0) return this;
19315
- if (index === -1) for (let i = 0; i < this.timeline.length; i += 1) this.timeline[i][property] = value;
19331
+ if (index === -1) for (const timelineEntry of this.timeline) timelineEntry[property] = value;
19316
19332
  else this.timeline[index][property] = value;
19317
19333
  return this;
19318
19334
  }
@@ -19533,7 +19549,8 @@ var Tween = class {
19533
19549
  const keys = Object.keys(this.timeline[i].vEnd);
19534
19550
  for (let k = 0; k < keys.length; k += 1) {
19535
19551
  const property = keys[k];
19536
- this.properties[property] = this.target[property] || 0;
19552
+ const targetProperties = this.target;
19553
+ this.properties[property] = targetProperties[property] || 0;
19537
19554
  if (!Array.isArray(this.properties[property])) this.properties[property] *= 1;
19538
19555
  }
19539
19556
  }
@@ -19817,7 +19834,7 @@ const BackOut = (k) => {
19817
19834
  * @returns {number} TBD.
19818
19835
  */
19819
19836
  const BackInOut = (k) => {
19820
- const s = 1.70158 * 1.525;
19837
+ const s = 2.5949095;
19821
19838
  if ((k *= 2) < 1) return .5 * (k * k * (3.5949095 * k - s));
19822
19839
  return .5 * ((k -= 2) * k * (3.5949095 * k + s) + 2);
19823
19840
  };
@@ -20106,27 +20123,9 @@ var Game = class {
20106
20123
  this.parent = "";
20107
20124
  this.width = 800;
20108
20125
  this.height = 600;
20109
- this.renderer = null;
20110
- this.state = null;
20111
20126
  this.isBooted = false;
20112
20127
  this.paused = false;
20113
- this.raf = null;
20114
- this.add = null;
20115
- this.cache = null;
20116
- this.input = null;
20117
- this.load = null;
20118
- this.scale = null;
20119
- this.sound = null;
20120
- this.stage = null;
20121
- this.time = null;
20122
- this.tweens = null;
20123
- this.world = null;
20124
20128
  this.device = new Device();
20125
- /** @type {Logger} */
20126
- this.logger = null;
20127
- /** @type {HTMLCanvasElement} */
20128
- this.canvas = null;
20129
- /** @type {CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext} */
20130
20129
  this.context = null;
20131
20130
  this.onPause = new Signal();
20132
20131
  this.onResume = new Signal();
@@ -20182,9 +20181,9 @@ var Game = class {
20182
20181
  if (this.config.canvas) this.canvas = this.config.canvas;
20183
20182
  else this.canvas = create(this, this.width, this.height, this.config.canvasID, true);
20184
20183
  if (this.config.canvasStyle) {
20185
- const properties = Object.keys(this.config.canvasStyle);
20186
- for (const property of properties) this.canvas.style[property] = this.config.canvasStyle[property];
20187
- } else this.canvas.style["-webkit-full-screen"] = "width: 100%; height: 100%";
20184
+ const canvasStyle = this.config.canvasStyle;
20185
+ for (const property of Object.keys(canvasStyle)) this.canvas.style.setProperty(property, canvasStyle[property]);
20186
+ } else this.canvas.style.setProperty("-webkit-full-screen", "width: 100%; height: 100%");
20188
20187
  }
20189
20188
  /**
20190
20189
  * Initializes the renderer and sets up the rendering context.