excalibur 0.32.0-alpha.1566 → 0.32.0-alpha.1568

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.
package/CHANGELOG.md CHANGED
@@ -52,6 +52,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
52
52
 
53
53
  - Fixed issue where overriding built in uniforms and graphics no longer worked as v0.30.x
54
54
  - Fixed issue where clearSchedule during a scheduled callback could cause a cb to be skipped
55
+ - Fixed issue where specifying custom events was difficult in TypeScript switched from `export type ...Events {` to `export interface ...Events {` which allows declaration merging by user game code to specify custom events
55
56
  - Fixed issue where the Loader could run twice even if already loaded when included in the scene loader.
56
57
  - Fixed issue where pixel ratio was accidentally doubled during load if the loader was included in the scene loader.
57
58
  - Fixed issue where Slide trasition did not work properly when DisplayMode was FitScreenAndFill
@@ -157,7 +157,7 @@ type ColliderArgs = // custom collider
157
157
  width?: undefined;
158
158
  height?: undefined;
159
159
  };
160
- export type ActorEvents = EntityEvents & {
160
+ export interface ActorEvents extends EntityEvents {
161
161
  collisionstart: CollisionStartEvent;
162
162
  collisionend: CollisionEndEvent;
163
163
  precollision: PreCollisionEvent;
@@ -187,7 +187,7 @@ export type ActorEvents = EntityEvents & {
187
187
  exitviewport: ExitViewPortEvent;
188
188
  actionstart: ActionStartEvent;
189
189
  actioncomplete: ActionCompleteEvent;
190
- };
190
+ }
191
191
  export declare const ActorEvents: {
192
192
  readonly CollisionStart: "collisionstart";
193
193
  readonly CollisionEnd: "collisionend";
@@ -139,11 +139,11 @@ export declare class LimitCameraBoundsStrategy implements CameraStrategy<Boundin
139
139
  constructor(target: BoundingBox);
140
140
  action: (target: BoundingBox, cam: Camera, _eng: Engine, elapsed: number) => Vector;
141
141
  }
142
- export type CameraEvents = {
142
+ export interface CameraEvents {
143
143
  preupdate: PreUpdateEvent<Camera>;
144
144
  postupdate: PostUpdateEvent<Camera>;
145
145
  initialize: InitializeEvent<Camera>;
146
- };
146
+ }
147
147
  export declare const CameraEvents: {
148
148
  Initialize: string;
149
149
  PreUpdate: string;
@@ -9,13 +9,13 @@ export interface DefaultLoaderOptions {
9
9
  */
10
10
  loadables?: Loadable<any>[];
11
11
  }
12
- export type LoaderEvents = {
12
+ export interface LoaderEvents {
13
13
  beforeload: void;
14
14
  afterload: void;
15
15
  useraction: void;
16
16
  loadresourcestart: Loadable<any>;
17
17
  loadresourceend: Loadable<any>;
18
- };
18
+ }
19
19
  export declare const LoaderEvents: {
20
20
  BeforeLoad: string;
21
21
  AfterLoad: string;
@@ -11,11 +11,11 @@ export interface DirectorNavigationEvent {
11
11
  destinationName: string;
12
12
  destinationScene: Scene;
13
13
  }
14
- export type DirectorEvents = {
14
+ export interface DirectorEvents {
15
15
  navigationstart: DirectorNavigationEvent;
16
16
  navigation: DirectorNavigationEvent;
17
17
  navigationend: DirectorNavigationEvent;
18
- };
18
+ }
19
19
  export declare const DirectorEvents: {
20
20
  readonly NavigationStart: "navigationstart";
21
21
  readonly Navigation: "navigation";
@@ -29,7 +29,7 @@ import type { PhysicsConfig } from './Collision/PhysicsConfig';
29
29
  import type { DeepRequired } from './Util/Required';
30
30
  import type { Context } from './Context';
31
31
  import type { GarbageCollectionOptions } from './GarbageCollector';
32
- export type EngineEvents = DirectorEvents & {
32
+ export interface EngineEvents extends DirectorEvents {
33
33
  fallbackgraphicscontext: ExcaliburGraphicsContext2DCanvas;
34
34
  initialize: InitializeEvent<Engine>;
35
35
  visible: VisibleEvent;
@@ -42,7 +42,7 @@ export type EngineEvents = DirectorEvents & {
42
42
  postframe: PostFrameEvent;
43
43
  predraw: PreDrawEvent;
44
44
  postdraw: PostDrawEvent;
45
- };
45
+ }
46
46
  export declare const EngineEvents: {
47
47
  readonly NavigationStart: "navigationstart";
48
48
  readonly Navigation: "navigation";
@@ -44,14 +44,14 @@ export declare function isRemovedComponent(x: Message<EntityComponent>): x is Re
44
44
  /**
45
45
  * Built in events supported by all entities
46
46
  */
47
- export type EntityEvents = {
47
+ export interface EntityEvents {
48
48
  initialize: InitializeEvent;
49
49
  add: AddEvent;
50
50
  remove: RemoveEvent;
51
51
  preupdate: PreUpdateEvent;
52
52
  postupdate: PostUpdateEvent;
53
53
  kill: KillEvent;
54
- };
54
+ }
55
55
  export declare const EntityEvents: {
56
56
  readonly Add: "add";
57
57
  readonly Remove: "remove";
@@ -90,11 +90,11 @@ export interface AnimationOptions {
90
90
  */
91
91
  data?: Record<string, any>;
92
92
  }
93
- export type AnimationEvents = {
93
+ export interface AnimationEvents {
94
94
  frame: FrameEvent;
95
95
  loop: Animation;
96
96
  end: Animation;
97
- };
97
+ }
98
98
  export declare const AnimationEvents: {
99
99
  Frame: string;
100
100
  Loop: string;
@@ -1,12 +1,12 @@
1
1
  import { GamepadConnectEvent, GamepadDisconnectEvent, GamepadButtonEvent, GamepadAxisEvent } from '../Events';
2
2
  import type { EventKey, Handler, Subscription } from '../EventEmitter';
3
3
  import { EventEmitter } from '../EventEmitter';
4
- export type GamepadEvents = {
4
+ export interface GamepadEvents {
5
5
  connect: GamepadConnectEvent;
6
6
  disconnect: GamepadDisconnectEvent;
7
7
  button: GamepadButtonEvent;
8
8
  axis: GamepadAxisEvent;
9
- };
9
+ }
10
10
  export declare const GamepadEvents: {
11
11
  GamepadConnect: string;
12
12
  GamepadDisconnect: string;
@@ -205,11 +205,11 @@ export interface KeyboardInitOptions {
205
205
  global: GlobalEventHandlers | (() => GlobalEventHandlers);
206
206
  grabWindowFocus?: boolean;
207
207
  }
208
- export type KeyEvents = {
208
+ export interface KeyEvents {
209
209
  press: KeyEvent;
210
210
  hold: KeyEvent;
211
211
  release: KeyEvent;
212
- };
212
+ }
213
213
  export declare const KeyEvents: {
214
214
  Press: string;
215
215
  Hold: string;
@@ -10,12 +10,12 @@ export type NativePointerEvent = globalThis.PointerEvent;
10
10
  export type NativeMouseEvent = globalThis.MouseEvent;
11
11
  export type NativeTouchEvent = globalThis.TouchEvent;
12
12
  export type NativeWheelEvent = globalThis.WheelEvent;
13
- export type PointerEvents = {
13
+ export interface PointerEvents {
14
14
  move: PointerEvent;
15
15
  down: PointerEvent;
16
16
  up: PointerEvent;
17
17
  wheel: WheelEvent;
18
- };
18
+ }
19
19
  export declare const PointerEvents: {
20
20
  Move: string;
21
21
  Down: string;
@@ -1,13 +1,13 @@
1
1
  import type { Loadable } from '../Interfaces/Loadable';
2
2
  import { Logger } from '../Util/Log';
3
3
  import { EventEmitter } from '../EventEmitter';
4
- export type ResourceEvents = {
4
+ export interface ResourceEvents {
5
5
  complete: any;
6
6
  load: ProgressEvent<XMLHttpRequestEventTarget>;
7
7
  loadstart: ProgressEvent<XMLHttpRequestEventTarget>;
8
8
  progress: ProgressEvent<XMLHttpRequestEventTarget>;
9
9
  error: ProgressEvent<XMLHttpRequestEventTarget>;
10
- };
10
+ }
11
11
  export declare const ResourceEvents: {
12
12
  Complete: string;
13
13
  Load: string;
@@ -5,7 +5,7 @@ import type { Loadable } from '../../Interfaces/Index';
5
5
  import { Logger } from '../../Util/Log';
6
6
  import type { EventKey, Handler, Subscription } from '../../EventEmitter';
7
7
  import { EventEmitter } from '../../EventEmitter';
8
- export type SoundEvents = {
8
+ export interface SoundEvents {
9
9
  volumechange: NativeSoundEvent;
10
10
  processed: NativeSoundProcessedEvent;
11
11
  pause: NativeSoundEvent;
@@ -13,7 +13,7 @@ export type SoundEvents = {
13
13
  playbackend: NativeSoundEvent;
14
14
  resume: NativeSoundEvent;
15
15
  playbackstart: NativeSoundEvent;
16
- };
16
+ }
17
17
  export declare const SoundEvents: {
18
18
  VolumeChange: string;
19
19
  Processed: string;
@@ -21,7 +21,7 @@ import { InputHost } from './Input/InputHost';
21
21
  export declare class PreLoadEvent {
22
22
  loader: DefaultLoader;
23
23
  }
24
- export type SceneEvents = {
24
+ export interface SceneEvents {
25
25
  initialize: InitializeEvent<Scene>;
26
26
  activate: ActivateEvent;
27
27
  deactivate: DeactivateEvent;
@@ -34,7 +34,7 @@ export type SceneEvents = {
34
34
  preload: PreLoadEvent;
35
35
  transitionstart: Transition;
36
36
  transitionend: Transition;
37
- };
37
+ }
38
38
  export declare const SceneEvents: {
39
39
  readonly Initialize: "initialize";
40
40
  readonly Activate: "activate";
@@ -179,7 +179,7 @@ export interface FullScreenChangeEvent {
179
179
  /**
180
180
  * Built in events supported by all entities
181
181
  */
182
- export type ScreenEvents = {
182
+ export interface ScreenEvents {
183
183
  /**
184
184
  * Fires when the screen resizes, useful if you have logic that needs to be aware of resolution/viewport constraints
185
185
  */
@@ -192,7 +192,7 @@ export type ScreenEvents = {
192
192
  * Fires when the browser fullscreen api is successfully engaged or disengaged
193
193
  */
194
194
  fullscreen: FullScreenChangeEvent;
195
- };
195
+ }
196
196
  export declare const ScreenEvents: {
197
197
  readonly ScreenResize: "resize";
198
198
  readonly PixelRatioChange: "pixelratio";
@@ -11,14 +11,14 @@ import type { PointerEvent } from '../Input/PointerEvent';
11
11
  import { EventEmitter } from '../EventEmitter';
12
12
  import type { HasNestedPointerEvents } from '../Input/PointerEventsToObjectDispatcher';
13
13
  import type { PointerEventReceiver } from '../Input/PointerEventReceiver';
14
- export type IsometricTilePointerEvents = {
14
+ export interface IsometricTilePointerEvents {
15
15
  pointerup: PointerEvent;
16
16
  pointerdown: PointerEvent;
17
17
  pointermove: PointerEvent;
18
18
  pointercancel: PointerEvent;
19
19
  pointerenter: PointerEvent;
20
20
  pointerleave: PointerEvent;
21
- };
21
+ }
22
22
  export declare class IsometricTile extends Entity {
23
23
  /**
24
24
  * Indicates whether this tile is solid
@@ -55,20 +55,20 @@ export interface TileMapOptions {
55
55
  */
56
56
  meshingLookBehind?: number;
57
57
  }
58
- export type TilePointerEvents = {
58
+ export interface TilePointerEvents {
59
59
  pointerup: PointerEvent;
60
60
  pointerdown: PointerEvent;
61
61
  pointermove: PointerEvent;
62
62
  pointercancel: PointerEvent;
63
63
  pointerenter: PointerEvent;
64
64
  pointerleave: PointerEvent;
65
- };
66
- export type TileMapEvents = EntityEvents & TilePointerEvents & {
65
+ }
66
+ export interface TileMapEvents extends EntityEvents, TilePointerEvents {
67
67
  preupdate: PreUpdateEvent<TileMap>;
68
68
  postupdate: PostUpdateEvent<TileMap>;
69
69
  predraw: PreDrawEvent;
70
70
  postdraw: PostDrawEvent;
71
- };
71
+ }
72
72
  export declare const TileMapEvents: {
73
73
  PreUpdate: string;
74
74
  PostUpdate: string;
@@ -1,14 +1,13 @@
1
1
  import type { Vector } from './Math/vector';
2
- import type { CollisionEndEvent, CollisionStartEvent } from './Events';
3
2
  import { ExitTriggerEvent, EnterTriggerEvent } from './Events';
4
3
  import type { Entity } from './EntityComponentSystem';
5
4
  import type { ActorArgs, ActorEvents } from './Actor';
6
5
  import { Actor } from './Actor';
7
6
  import { EventEmitter } from './EventEmitter';
8
- export type TriggerEvents = ActorEvents & {
7
+ export interface TriggerEvents extends ActorEvents {
9
8
  exit: ExitTriggerEvent;
10
9
  enter: EnterTriggerEvent;
11
- };
10
+ }
12
11
  export declare const TriggerEvents: {
13
12
  ExitTrigger: string;
14
13
  EnterTrigger: string;
@@ -32,40 +31,7 @@ export interface TriggerOptions {
32
31
  * are invisible, and can only be seen when {@apilink Trigger.visible} is set to `true`.
33
32
  */
34
33
  export declare class Trigger extends Actor {
35
- events: EventEmitter<import("./EntityComponentSystem").EntityEvents & {
36
- collisionstart: CollisionStartEvent;
37
- collisionend: CollisionEndEvent;
38
- precollision: import("./Events").PreCollisionEvent;
39
- postcollision: import("./Events").PostCollisionEvent;
40
- kill: import("./Events").KillEvent;
41
- prekill: import("./Events").PreKillEvent;
42
- postkill: import("./Events").PostKillEvent;
43
- predraw: import("./Events").PreDrawEvent;
44
- postdraw: import("./Events").PostDrawEvent;
45
- pretransformdraw: import("./Events").PreDrawEvent;
46
- posttransformdraw: import("./Events").PostDrawEvent;
47
- predebugdraw: import("./Events").PreDebugDrawEvent;
48
- postdebugdraw: import("./Events").PostDebugDrawEvent;
49
- pointerup: import(".").PointerEvent;
50
- pointerdown: import(".").PointerEvent;
51
- pointerenter: import(".").PointerEvent;
52
- pointerleave: import(".").PointerEvent;
53
- pointermove: import(".").PointerEvent;
54
- pointercancel: import(".").PointerEvent;
55
- pointerwheel: import(".").WheelEvent;
56
- pointerdragstart: import(".").PointerEvent;
57
- pointerdragend: import(".").PointerEvent;
58
- pointerdragenter: import(".").PointerEvent;
59
- pointerdragleave: import(".").PointerEvent;
60
- pointerdragmove: import(".").PointerEvent;
61
- enterviewport: import("./Events").EnterViewPortEvent;
62
- exitviewport: import("./Events").ExitViewPortEvent;
63
- actionstart: import("./Events").ActionStartEvent;
64
- actioncomplete: import("./Events").ActionCompleteEvent;
65
- } & {
66
- exit: ExitTriggerEvent;
67
- enter: EnterTriggerEvent;
68
- }>;
34
+ events: EventEmitter<TriggerEvents & ActorEvents>;
69
35
  target?: Entity;
70
36
  /**
71
37
  * Action to fire when triggered by collision
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1566+bfb6759 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1568+800f627 - 2025-11-25
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -33102,7 +33102,7 @@ Read more about this issue at https://excaliburjs.com/docs/performance`
33102
33102
  this._count += count;
33103
33103
  }
33104
33104
  }
33105
- const EX_VERSION = "0.32.0-alpha.1566+bfb6759";
33105
+ const EX_VERSION = "0.32.0-alpha.1568+800f627";
33106
33106
  polyfill();
33107
33107
  exports2.ActionCompleteEvent = ActionCompleteEvent;
33108
33108
  exports2.ActionContext = ActionContext;
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1566+bfb6759 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1568+800f627 - 2025-11-25
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -33102,7 +33102,7 @@ Read more about this issue at https://excaliburjs.com/docs/performance`
33102
33102
  this._count += count;
33103
33103
  }
33104
33104
  }
33105
- const EX_VERSION = "0.32.0-alpha.1566+bfb6759";
33105
+ const EX_VERSION = "0.32.0-alpha.1568+800f627";
33106
33106
  polyfill();
33107
33107
  exports2.ActionCompleteEvent = ActionCompleteEvent;
33108
33108
  exports2.ActionContext = ActionContext;
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1566+bfb6759 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1568+800f627 - 2025-11-25
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -817,4 +817,4 @@ If in Firefox, visit about:config
817
817
 
818
818
  Read more about this issue at https://excaliburjs.com/docs/performance`),i&&this._toaster.toast("Excalibur is encountering performance issues. It's possible that your browser doesn't have hardware acceleration enabled. Visit [LINK] for more information and potential solutions.","https://excaliburjs.com/docs/performance"),this.useCanvas2DFallback(),this.emit("fallbackgraphicscontext",this.graphicsContext))}}useCanvas2DFallback(){var t,e,i;const s=this.canvas.cloneNode(!1);this.canvas.parentNode.replaceChild(s,this.canvas),this.canvas=s;const n={...this._originalOptions,antialiasing:this.screen.antialiasing},o=this._originalDisplayMode;this.graphicsContext=new Xi({canvasElement:this.canvas,enableTransparency:this.enableCanvasTransparency,antialiasing:n.antialiasing,backgroundColor:n.backgroundColor,snapToPixel:n.snapToPixel,useDrawSorting:n.useDrawSorting}),this.screen&&this.screen.dispose(),this.screen=new Ln({canvas:this.canvas,context:this.graphicsContext,antialiasing:(t=n.antialiasing)!=null?t:!0,browser:this.browser,viewport:(e=n.viewport)!=null?e:n.width&&n.height?{width:n.width,height:n.height}:Bn.SVGA,resolution:n.resolution,displayMode:o,pixelRatio:n.suppressHiDPIScaling?1:(i=n.pixelRatio)!=null?i:null}),this.screen.setCurrentCamera(this.currentScene.camera),this.input.pointers.detach();const a=n&&n.pointerScope===Fe.Document?document:this.canvas;this.input.pointers=this.input.pointers.recreate(a,this),this.input.pointers.init()}dispose(){this._disposed||(this._disposed=!0,this.stop(),this._garbageCollector.forceCollectAll(),this.input.toggleEnabled(!1),this._hasCreatedCanvas&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null,this.screen.dispose(),this.graphicsContext.dispose(),this.graphicsContext=null,ue.InstanceCount--)}isDisposed(){return this._disposed}getWorldBounds(){return this.screen.getWorldBounds()}get timescale(){return this._timescale}set timescale(t){if(t<0){R.getInstance().warnOnce("engine.timescale to a value less than 0 are ignored");return}this._timescale=t}addTimer(t){return this.currentScene.addTimer(t)}removeTimer(t){return this.currentScene.removeTimer(t)}addScene(t,e){return this.director.add(t,e),this}removeScene(t){this.director.remove(t)}add(t){if(arguments.length===2){this.director.add(arguments[0],arguments[1]);return}const e=this.director.getDeferredScene();e instanceof Rt?e.add(t):this.currentScene.add(t)}remove(t){t instanceof Tt&&this.currentScene.remove(t),(t instanceof Rt||$t(t))&&this.removeScene(t),typeof t=="string"&&this.removeScene(t)}async goToScene(t,e){await this.scope(async()=>{await this.director.goToScene(t,e)})}screenToWorldCoordinates(t){return this.screen.screenToWorldCoordinates(t)}worldToScreenCoordinates(t){return this.screen.worldToScreenCoordinates(t)}_initialize(t){var e,i;this.pageScrollPreventionMode=t.scrollPreventionMode;const s=t&&t.pointerScope===Fe.Document?document:this.canvas,n=(i=(e=this._originalOptions)==null?void 0:e.grabWindowFocus)!=null?i:!0;this.input=new Yn({global:this.global,pointerTarget:s,grabWindowFocus:n,engine:this}),this.inputMapper=this.input.inputMapper,this.browser.document.on("visibilitychange",()=>{document.visibilityState==="hidden"?(this.events.emit("hidden",new Hs(this)),this._logger.debug("Window hidden")):document.visibilityState==="visible"&&(this.events.emit("visible",new Os(this)),this._logger.debug("Window visible"))}),!this.canvasElementId&&!t.canvasElement&&document.body.appendChild(this.canvas)}toggleInputEnabled(t){this._inputEnabled=t,this.input.toggleEnabled(this._inputEnabled)}onInitialize(t){}get isInitialized(){return this._isInitialized}async _overrideInitialize(t){this.isInitialized||(await this.director.onInitialize(),await this.onInitialize(t),this.events.emit("initialize",new ze(t,this)),this._isInitialized=!0)}_update(t){var e;if(this._isLoading){(e=this._loader)==null||e.onUpdate(this,t),this.input.update();return}this.clock.__runScheduledCbs("preupdate"),this._preupdate(t),this.currentScene.update(this,t),this.graphicsContext.updatePostProcessors(t),this.clock.__runScheduledCbs("postupdate"),this._postupdate(t),this.input.update()}_preupdate(t){this.emit("preupdate",new ne(this,t,this)),this.onPreUpdate(this,t)}onPreUpdate(t,e){}_postupdate(t){this.emit("postupdate",new re(this,t,this)),this.onPostUpdate(this,t)}onPostUpdate(t,e){}_draw(t){var e,i;if(this.graphicsContext.backgroundColor=(e=this.currentScene.backgroundColor)!=null?e:this.backgroundColor,this.graphicsContext.beginDrawLifecycle(),this.graphicsContext.clear(),this.clock.__runScheduledCbs("predraw"),this._predraw(this.graphicsContext,t),this._isLoading){this._hideLoader||((i=this._loader)==null||i.canvas.draw(this.graphicsContext,0,0),this.clock.__runScheduledCbs("postdraw"),this.graphicsContext.flush(),this.graphicsContext.endDrawLifecycle());return}this.currentScene.draw(this.graphicsContext,t),this.clock.__runScheduledCbs("postdraw"),this._postdraw(this.graphicsContext,t),this.graphicsContext.flush(),this.graphicsContext.endDrawLifecycle(),this._checkForScreenShots()}_predraw(t,e){this.emit("predraw",new ke(t,e,this)),this.onPreDraw(t,e)}onPreDraw(t,e){}_postdraw(t,e){this.emit("postdraw",new Ue(t,e,this)),this.onPostDraw(t,e)}onPostDraw(t,e){}showDebug(t){this._isDebug=t}toggleDebug(){return this._isDebug=!this._isDebug,this._isDebug}get loadingComplete(){return!this._isLoading}get ready(){return this._isReadyFuture.isCompleted}isReady(){return this._isReadyFuture.promise}async start(t,e){await this.scope(async()=>{if(!this._compatible)throw new Error("Excalibur is incompatible with your browser");this._isLoading=!0;let i;return t instanceof pi?i=t:typeof t=="string"&&(this.director.configureStart(t,e),i=this.director.mainLoader),this._logger.debug("Starting game clock..."),this.browser.resume(),this.clock.start(),this.garbageCollectorConfig&&this._garbageCollector.start(),this._logger.debug("Game clock started"),await this.load(i!=null?i:new Ji),await this._overrideInitialize(this),this._isReadyFuture.resolve(),this.emit("start",new As(this)),this._isReadyFuture.promise})}_mainloop(t){this.scope(()=>{this.emit("preframe",new Fs(this,this.stats.prevFrame));const e=t*this.timescale;this.currentFrameElapsedMs=e;const i=this.stats.prevFrame.id+1;this.stats.currFrame.reset(),this.stats.currFrame.id=i,this.stats.currFrame.elapsedMs=e,this.stats.currFrame.fps=this.clock.fpsSampler.fps,st.clear();const s=this.clock.now(),n=this.fixedUpdateTimestep;if(this.fixedUpdateTimestep)for(this._lagMs+=e;this._lagMs>=n;)this._update(n),this._lagMs-=n;else this._update(e);const o=this.clock.now();this.currentFrameLagMs=this._lagMs,this._draw(e);const a=this.clock.now();this.stats.currFrame.duration.update=o-s,this.stats.currFrame.duration.draw=a-o,this.stats.currFrame.graphics.drawnImages=st.DrawnImagesCount,this.stats.currFrame.graphics.drawCalls=st.DrawCallCount,this.emit("postframe",new Bs(this,this.stats.currFrame)),this.stats.prevFrame.reset(this.stats.currFrame),this._monitorPerformanceThresholdAndTriggerFallback()})}stop(){this.clock.isRunning()&&(this.emit("stop",new Es(this)),this.browser.pause(),this.clock.stop(),this._garbageCollector.stop(),this._logger.debug("Game stopped"))}isRunning(){return this.clock.isRunning()}screenshot(t=!1){return new Promise(i=>{this._screenShotRequests.push({preserveHiDPIResolution:t,resolve:i})})}_checkForScreenShots(){for(const t of this._screenShotRequests){const e=t.preserveHiDPIResolution?this.canvas.width:this.screen.resolution.width,i=t.preserveHiDPIResolution?this.canvas.height:this.screen.resolution.height,s=document.createElement("canvas");s.width=e,s.height=i;const n=s.getContext("2d");n.imageSmoothingEnabled=this.screen.antialiasing,n.drawImage(this.canvas,0,0,e,i);const o=new Image,a=s.toDataURL("image/png");o.onload=()=>{t.resolve(o)},o.src=a}this._screenShotRequests.length=0}async load(t,e=!1){await this.scope(async()=>{try{if(t.isLoaded())return;this._loader=t,this._isLoading=!0,this._hideLoader=e,t instanceof Ji&&(t.suppressPlayButton=t.suppressPlayButton||this._suppressPlayButton),this._loader.onInitialize(this),await t.load()}catch(i){this._logger.error("Error loading resources, things may not behave properly",i),await Promise.resolve()}finally{this._isLoading=!1,this._hideLoader=!1,this._loader=null}})}};rs.Context=ma(),rs.InstanceCount=0,rs._DEFAULT_ENGINE_OPTIONS={width:0,height:0,enableCanvasTransparency:!0,useDrawSorting:!0,configurePerformanceCanvas2DFallback:{allow:!1,showPlayerMessage:!1,threshold:{fps:20,numberOfFrames:100}},canvasElementId:"",canvasElement:void 0,enableCanvasContextMenu:!1,snapToPixel:!1,antialiasing:!0,pixelArt:!1,garbageCollection:!0,powerPreference:"high-performance",pointerScope:Fe.Canvas,suppressConsoleBootMessage:null,suppressMinimumBrowserFeatureDetection:null,suppressHiDPIScaling:null,suppressPlayButton:null,grabWindowFocus:!0,scrollPreventionMode:1,backgroundColor:P.fromHex("#2185d0")};let os=rs;class Gl extends Ft{constructor(t){super(t),this._font=new Ce,this._text=new ui({text:"",font:this._font});const{text:e,pos:i,x:s,y:n,spriteFont:o,font:a,color:h,maxWidth:l}={text:"",...t};this.pos=i!=null?i:s&&n?x(s,n):this.pos,this.text=e!=null?e:this.text,this.font=a!=null?a:this.font,this.maxWidth=l!=null?l:this.maxWidth,this.spriteFont=o!=null?o:this.spriteFont,this._text.color=h!=null?h:this.color;const c=this.get(j);c.anchor=v.Zero,c.use(this._text)}set maxWidth(t){this._text.maxWidth=t}get maxWidth(){return this._text.maxWidth}get font(){return this._font}set font(t){this._font=t,this._text.font=t}get text(){return this._text.text}set text(t){this._text.text=t}get color(){return this._text.color}set color(t){this._text&&(this._text.color=t)}get opacity(){return this.graphics.opacity}set opacity(t){this.graphics.opacity=t}get spriteFont(){return this._spriteFont}set spriteFont(t){t&&(this._spriteFont=t,this._text.font=this._spriteFont)}_initialize(t){super._initialize(t)}getTextWidth(){return this._text.width}}var Ae=(r=>(r.Circle="circle",r.Rectangle="rectangle",r))(Ae||{});class Vl extends Ft{constructor(t){var e,i;super({width:(e=t.width)!=null?e:0,height:(i=t.height)!=null?i:0}),this._particlesToEmit=0,this._particlePool=new Ve(()=>new Yi({}),p=>p,500),this.numParticles=0,this.isEmitting=!0,this.deadParticles=[],this.emitRate=1,this.emitterType=Ae.Rectangle,this.radius=0,this.particle={life:2e3,transform:Vt.Global,graphic:void 0,opacity:1,angularVelocity:0,focus:void 0,focusAccel:void 0,randomRotation:!1},this._activeParticles=[];const{particle:s,x:n,y:o,z:a,pos:h,isEmitting:l,emitRate:c,emitterType:u,radius:_,random:f}={...t};this.particle={...this.particle,...s},this.pos=h!=null?h:x(n!=null?n:0,o!=null?o:0),this.z=a!=null?a:0,this.isEmitting=l!=null?l:this.isEmitting,this.emitRate=c!=null?c:this.emitRate,this.emitterType=u!=null?u:this.emitterType,this.radius=_!=null?_:this.radius,this.body.collisionType=M.PreventCollision,this.random=f!=null?f:new ie}removeParticle(t){this.deadParticles.push(t)}emitParticles(t){var e;if(!(t<=0)){t=t|0;for(let i=0;i<t;i++){const s=this._createParticle();(e=this==null?void 0:this.scene)!=null&&e.world&&(this.particle.transform===Vt.Global?this.scene.world.add(s):this.addChild(s)),this._activeParticles.push(s)}}}clearParticles(){for(let t=0;t<this._activeParticles.length;t++)this.removeParticle(this._activeParticles[t])}_createParticle(){let t=0,e=0;const i=Ot(this.particle.minAngle||0,this.particle.maxAngle||Math.PI*2,this.random),s=Ot(this.particle.minSpeed||0,this.particle.maxSpeed||0,this.random),n=this.particle.startSize||Ot(this.particle.minSize||5,this.particle.maxSize||5,this.random),o=s*Math.cos(i),a=s*Math.sin(i);if(this.emitterType===Ae.Rectangle)t=Ot(0,this.width,this.random),e=Ot(0,this.height,this.random);else if(this.emitterType===Ae.Circle){const l=Ot(0,this.radius,this.random);t=l*Math.cos(i),e=l*Math.sin(i)}const h=this._particlePool.rent();return h.unparent(),h.configure({transform:this.particle.transform,life:this.particle.life,opacity:this.particle.opacity,beginColor:this.particle.beginColor,endColor:this.particle.endColor,pos:x(t,e),z:this.particle.transform===Vt.Global?this.z:void 0,vel:x(o,a),acc:this.particle.acc,angularVelocity:this.particle.angularVelocity,startSize:this.particle.startSize,endSize:this.particle.endSize,size:n,graphic:this.particle.graphic,fade:this.particle.fade}),h.registerEmitter(this),this.particle.randomRotation&&(h.transform.rotation=Ot(0,Math.PI*2,this.random)),this.particle.focus&&(h.focus=this.particle.focus.add(x(this.pos.x,this.pos.y)),h.focusAccel=this.particle.focusAccel),h}update(t,e){var i;super.update(t,e),this.isEmitting&&(this._particlesToEmit+=this.emitRate*(e/1e3),this._particlesToEmit>1&&(this.emitParticles(Math.floor(this._particlesToEmit)),this._particlesToEmit=this._particlesToEmit-Math.floor(this._particlesToEmit)));for(let s=0;s<this.deadParticles.length;s++){(i=this==null?void 0:this.scene)!=null&&i.world&&(this.scene.world.remove(this.deadParticles[s],!1),this._particlePool.return(this.deadParticles[s]));const n=this._activeParticles.indexOf(this.deadParticles[s]);n>-1&&this._activeParticles.splice(n,1)}this.deadParticles.length=0}}function Jn(r,t){if(!t())throw new Error(r)}class as{constructor(t,e,i){this.emitRate=1,this._initialized=!1,this._vaos=[],this._buffers=[],this._drawIndex=0,this._numInputFloats=7,this._particleIndex=0,this._uploadIndex=0,this._wrappedLife=0,this._wrappedParticles=0,this._particleLife=0,this._clearRequested=!1,this._emitted=[];var s;this.emitter=t,this.particle=i,this._particleData=new Float32Array(this.emitter.maxParticles*this._numInputFloats),this._random=e,this._particleLife=(s=this.particle.life)!=null?s:2e3}get isInitialized(){return this._initialized}get maxParticles(){return this.emitter.maxParticles}initialize(t,e){if(this._initialized)return;const i=this.emitter.maxParticles,s=this._numInputFloats,n=this._particleData,o=4,a=t.createBuffer(),h=t.createVertexArray();t.bindVertexArray(h),t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,i*s*o,t.DYNAMIC_DRAW),t.bufferSubData(t.ARRAY_BUFFER,0,n);let l=0;t.vertexAttribPointer(0,2,t.FLOAT,!1,s*o,0),l+=o*2,t.vertexAttribPointer(1,2,t.FLOAT,!1,s*o,l),l+=o*2,t.vertexAttribPointer(2,1,t.FLOAT,!1,s*o,l),l+=o*1,t.vertexAttribPointer(3,1,t.FLOAT,!1,s*o,l),l+=o*1,t.vertexAttribPointer(4,1,t.FLOAT,!1,s*o,l),l+=o*1,t.enableVertexAttribArray(0),t.enableVertexAttribArray(1),t.enableVertexAttribArray(2),t.enableVertexAttribArray(3),t.enableVertexAttribArray(4),this._vaos.push(h),this._buffers.push(a),t.bindVertexArray(null),t.bindBuffer(t.ARRAY_BUFFER,null);const c=t.createBuffer(),u=t.createVertexArray();t.bindVertexArray(u),t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,i*s*o,t.DYNAMIC_DRAW),l=0,t.vertexAttribPointer(0,2,t.FLOAT,!1,s*o,0),l+=o*2,t.vertexAttribPointer(1,2,t.FLOAT,!1,s*o,l),l+=o*2,t.vertexAttribPointer(2,1,t.FLOAT,!1,s*o,l),l+=o*1,t.vertexAttribPointer(3,1,t.FLOAT,!1,s*o,l),l+=o*1,t.vertexAttribPointer(4,1,t.FLOAT,!1,s*o,l),l+=o*1,t.enableVertexAttribArray(0),t.enableVertexAttribArray(1),t.enableVertexAttribArray(2),t.enableVertexAttribArray(3),t.enableVertexAttribArray(4),this._vaos.push(u),this._buffers.push(c),t.bindVertexArray(null),t.bindBuffer(t.ARRAY_BUFFER,null),this._currentVao=this._vaos[this._drawIndex%2],this._currentBuffer=this._buffers[(this._drawIndex+1)%2],this._initialized=!0}clearParticles(){this._particleData.fill(0),this._clearRequested=!0}emitParticles(t){const e=this._particleIndex,i=this.maxParticles*this._numInputFloats,s=t*this._numInputFloats+e;for(let n=e;n<s;n+=this._numInputFloats){let o=this._random.floating(this.particle.minAngle||0,this.particle.maxAngle||et);o+=this.particle.transform===Vt.Local?this.emitter.transform.rotation:this.emitter.transform.globalRotation;const a=this._random.floating(this.particle.minSpeed||0,this.particle.maxSpeed||0),h=this._random.floating(this.particle.minSpeed||0,this.particle.maxSpeed||0),l=a*Math.cos(o),c=h*Math.sin(o);let u=0,_=0;if(this.emitter.emitterType===Ae.Rectangle)u=this._random.floating(-.5,.5)*this.emitter.width,_=this._random.floating(-.5,.5)*this.emitter.height;else{const g=this._random.floating(0,this.emitter.radius);u=g*Math.cos(o),_=g*Math.sin(o)}const f=this.emitter.transform.apply(x(u,_)),p=[this.particle.transform===Vt.Local?u:f.x,this.particle.transform===Vt.Local?_:f.y,l,c,this.particle.randomRotation?Ot(0,et,this._random):this.particle.rotation||0,this.particle.angularVelocity||0,this._particleLife];this._particleData.set(p,n%this._particleData.length)}s>=i?(this._wrappedParticles+=(s-i)/this._numInputFloats,this._wrappedLife=this._particleLife):this._wrappedLife>0&&(this._wrappedParticles+=t),this._particleIndex=s%i,this._emitted.push([this._particleLife,e])}_uploadEmitted(t){this._particleIndex!==this._uploadIndex&&(t.bindBuffer(t.ARRAY_BUFFER,this._buffers[(this._drawIndex+1)%2]),this._particleIndex>=this._uploadIndex?t.bufferSubData(t.ARRAY_BUFFER,this._uploadIndex*4,this._particleData,this._uploadIndex,this._particleIndex-this._uploadIndex):(t.bufferSubData(t.ARRAY_BUFFER,this._uploadIndex*4,this._particleData,this._uploadIndex,this._particleData.length-this._uploadIndex),this._wrappedParticles&&t.bufferSubData(t.ARRAY_BUFFER,0,this._particleData,0,this._wrappedParticles*this._numInputFloats),this._wrappedLife=this._particleLife),t.bindBuffer(t.ARRAY_BUFFER,null)),this._uploadIndex=this._particleIndex%(this.maxParticles*this._numInputFloats)}update(t){var e;if(this._particleLife=(e=this.particle.life)!=null?e:this._particleLife,this._wrappedLife>0?this._wrappedLife-=t:(this._wrappedLife=0,this._wrappedParticles=0),!!this._emitted.length){for(let i=this._emitted.length-1;i>=0;i--){const s=this._emitted[i];s[0]-=t,s[0]<=0&&this._emitted.splice(i,1)}this._emitted.sort((i,s)=>i[0]-s[0])}}draw(t){if(this._initialized){if(this._clearRequested?(t.bindBuffer(t.ARRAY_BUFFER,this._buffers[(this._drawIndex+1)%2]),t.bufferSubData(t.ARRAY_BUFFER,0,this._particleData),t.bindBuffer(t.ARRAY_BUFFER,null),this._clearRequested=!1):this._uploadEmitted(t),t.bindVertexArray(this._currentVao),t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,0,this._currentBuffer),this._wrappedLife&&this._emitted[0]&&this._emitted[0][1]>0){const e=this._emitted[0][1]/this._numInputFloats;Jn(`midpoint greater than 0, actual: ${e}`,()=>e>0),Jn(`midpoint is less than max, actual: ${e}`,()=>e<this.maxParticles),t.bindBufferRange(t.TRANSFORM_FEEDBACK_BUFFER,0,this._currentBuffer,this._emitted[0][1]*4,(this.maxParticles-e)*this._numInputFloats*4),t.beginTransformFeedback(t.POINTS),t.drawArrays(t.POINTS,e,this.maxParticles-e),t.endTransformFeedback(),t.bindBufferRange(t.TRANSFORM_FEEDBACK_BUFFER,0,this._currentBuffer,0,this._emitted[0][1]*4),t.beginTransformFeedback(t.POINTS),t.drawArrays(t.POINTS,0,e),t.endTransformFeedback()}else t.bindBufferRange(t.TRANSFORM_FEEDBACK_BUFFER,0,this._currentBuffer,0,this._particleData.length*4),t.beginTransformFeedback(t.POINTS),t.drawArrays(t.POINTS,0,this.maxParticles),t.endTransformFeedback();t.bindVertexArray(null),t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,0,null),this._currentVao=this._vaos[this._drawIndex%2],this._currentBuffer=this._buffers[(this._drawIndex+1)%2],this._drawIndex=(this._drawIndex+1)%2}}}as.GPU_MAX_PARTICLES=1e5;class ql extends Ft{constructor(t){super({name:"GpuParticleEmitter",width:t.width,height:t.height}),this.particle={life:2e3,transform:Vt.Global,graphic:void 0,opacity:1,angularVelocity:0,focus:void 0,focusAccel:void 0,randomRotation:!1},this.graphics=new j,this.isEmitting=!1,this.emitRate=1,this.emitterType=Ae.Rectangle,this.radius=0,this.maxParticles=2e3,this._particlesToEmit=0,this.addComponent(this.graphics,!0),this.graphics.onPostDraw=this.draw.bind(this);const{particle:e,maxParticles:i,x:s,y:n,z:o,pos:a,isEmitting:h,emitRate:l,emitterType:c,radius:u,random:_}={...t};this.maxParticles=F(i!=null?i:this.maxParticles,0,as.GPU_MAX_PARTICLES),this.pos=a!=null?a:x(s!=null?s:0,n!=null?n:0),this.z=o!=null?o:0,this.isEmitting=h!=null?h:this.isEmitting,this.emitRate=l!=null?l:this.emitRate,this.emitterType=c!=null?c:this.emitterType,this.radius=u!=null?u:this.radius,this.particle={...this.particle,...e},this.random=_!=null?_:new ie,this.renderer=new as(this,this.random,this.particle)}get pos(){return this.transform.pos}set pos(t){this.transform.pos=t}get z(){return this.transform.z}set z(t){this.transform.z=t}_initialize(t){super._initialize(t);const e=t.graphicsContext;this.renderer.initialize(e.__gl,e)}update(t,e){super.update(t,e),this.isEmitting&&(this._particlesToEmit+=this.emitRate*(e/1e3),this._particlesToEmit>1&&(this.emitParticles(Math.floor(this._particlesToEmit)),this._particlesToEmit=this._particlesToEmit-Math.floor(this._particlesToEmit))),this.renderer.update(e)}emitParticles(t){t<=0||this.renderer.emitParticles(t|0)}clearParticles(){this.renderer.clearParticles()}draw(t,e){t.draw("ex.particle",this.renderer,e)}}class Kn{constructor(t,e){this.id=N(),this._stopped=!1,this._sequenceBuilder=e,this._sequenceContext=new _i(t),this._actionQueue=this._sequenceContext.getQueue(),this._sequenceBuilder(this._sequenceContext)}update(t){this._actionQueue.update(t)}isComplete(){return this._stopped||this._actionQueue.isComplete()}stop(){this._stopped=!0}reset(){this._stopped=!1,this._actionQueue.reset()}clone(t){return new Kn(t,this._sequenceBuilder)}}class Xl{constructor(t){this.id=N(),this._actions=t}update(t){for(let e=0;e<this._actions.length;e++)this._actions[e].update(t)}isComplete(t){return this._actions.every(e=>e.isComplete(t))}reset(){this._actions.forEach(t=>t.reset())}stop(){this._actions.forEach(t=>t.stop())}}function Yl(r){return!!r._initialize}function $l(r){return!!r.onAdd}function jl(r){return!!r.onRemove}function Zl(r){return!!r.onInitialize}function Ql(r){return!!r._preupdate}function Jl(r){return!!r.onPreUpdate}function Kl(r){return!!r.onPostUpdate}function tc(r){return!!r.onPostUpdate}function ec(r){return!!r.onAdd}function ic(r){return!!r.onRemove}function sc(r){return!!r.onPreDraw}function nc(r){return!!r.onPostDraw}class xa{constructor(t,e){this.soundManager=e}stop(t){if(!t)return;const e=this.soundManager.getSoundsForChannel(t);for(let i=0;i<e.length;i++)e[i].stop()}setVolume(t,e){const i=this.soundManager.getSoundsForChannel(t);for(const s of i)this.soundManager._isMuted(s)||this.soundManager.setVolume(t,e)}play(t,e){e!=null||(e=this.soundManager.defaultVolume);const i=[],s=new Set,n=this.soundManager.getSoundsForChannel(t);for(const o of n){if(s.has(o)||this.soundManager._isMuted(o))continue;const a=this.soundManager._getEffectiveVolume(o);i.push(o.play(a*e)),s.add(o)}return Promise.all(i)}mute(t){const e=this.soundManager.getSoundsForChannel(t);for(let i=0;i<e.length;i++)this.soundManager._muted.add(e[i]),e[i].pause()}unmute(t){const e=this.soundManager.getSoundsForChannel(t);for(let i=0;i<e.length;i++)this.soundManager._muted.has(e[i])&&(e[i].play(),this.soundManager._muted.delete(e[i]))}toggle(t){const e=this.soundManager.getSoundsForChannel(t);for(let i=0;i<e.length;i++)this.soundManager._isMuted(e[i])?(e[i].play(),this.soundManager._muted.delete(e[i])):(this.soundManager._muted.add(e[i]),e[i].pause())}}class rc{constructor(t){this._channelToConfig=new Map,this._nameToConfig=new Map,this._mix=new Map,this._muted=new Set,this._all=new Set,this._defaultVolume=1;var e;if(this._defaultVolume=(e=t.volume)!=null?e:1,this.channel=new xa(t,this),t.sounds)for(const[i,s]of Object.entries(t.sounds))this.track(i,s)}set defaultVolume(t){this._defaultVolume=F(t,0,1)}get defaultVolume(){return this._defaultVolume}getSounds(){return Array.from(this._all)}getSoundsForChannel(t){const e=this._channelToConfig.get(t);return e?e.sounds:[]}_isMuted(t){return this._muted.has(t)}_getEffectiveVolume(t){var e;if(this._isMuted(t))return 0;let i=this._defaultVolume;return this._mix.has(t)&&(i*=(e=this._mix.get(t))!=null?e:this._defaultVolume),i}play(t,e=this._defaultVolume){const i=this._nameToConfig.get(t);if(!i)return Promise.resolve();const{sound:s}=i;if(this._isMuted(s))return Promise.resolve();const n=e*this._getEffectiveVolume(s);return s.play(n)}getSound(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;return i}setVolume(t,e=this._defaultVolume){const i=this._nameToConfig.get(t);if(!i)return;const{sound:s}=i;this._setMix(s,e)}getVolume(t){var e;const i=this.getSound(t);return i&&(e=this._mix.get(i))!=null?e:0}_setMix(t,e){this._mix.set(t,e),t.volume=e}track(t,e){let i,s,n;e instanceof zn?(i=e,s=this._defaultVolume,n=[]):{sound:i,volume:s,channels:n}=e,this._nameToConfig.set(t,{sound:i,volume:s,channels:n}),this._mix.set(i,s!=null?s:this._defaultVolume),this._all.add(i),n&&this.addChannel(t,n)}untrack(t){this._nameToConfig.delete(t);const e=this.getSound(t);e&&(this._mix.delete(e),this._all.delete(e))}stop(t){if(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;i.stop();return}this._all.forEach(e=>e.stop())}mute(t){if(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;this._muted.add(i),i.pause();return}this._muted=new Set(this._all),this._muted.forEach(e=>e.pause())}unmute(t){if(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;i.play(),this._muted.delete(i);return}this._muted.forEach(e=>e.play()),this._muted.clear()}toggle(t){if(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;this._isMuted(i)?this.unmute(t):this.mute(t);return}this._muted.size>0?(this._muted.forEach(e=>e.play()),this._muted.clear()):(this._muted=new Set(this._all),this._muted.forEach(e=>e.pause()))}addChannel(t,e){const i=this.getSound(t);if(!i)return;const s=this._mix.get(i);this._mix.set(i,s!=null?s:this._defaultVolume),this._all.add(i);for(const n of e){let o=this._channelToConfig.get(n);o||(o={sounds:[i]}),o.sounds.indexOf(i)===-1&&o.sounds.push(i),this._channelToConfig.set(n,o)}}removeChannel(t,e){const i=this.getSound(t);if(i)for(const s of e){const n=this._channelToConfig.get(s);if(!n)return;const o=n.sounds.indexOf(i);o>=-1&&n.sounds.splice(o,1),this._channelToConfig.set(s,n)}}}class oc{constructor(t,e=!1){this.path=t,this.width=0,this.height=0,this._images=[],this.data=[],this._sprites=[],this._resource=new ai(t,"arraybuffer",e)}get bustCache(){return this._resource.bustCache}set bustCache(t){this._resource.bustCache=t}async load(){const t=await this._resource.load();this._stream=new ba(t),this._gif=new ya(this._stream);const e=this._gif.images.map(i=>new Gt(i.src,!1));return await Promise.all(e.map(i=>i.load())),this.data=this._images=e,this._sprites=this._images.map(i=>i.toSprite()),this.data}isLoaded(){return!!this.data}toSprite(t=0){var e;return(e=this._sprites[t])!=null?e:null}toSpriteSheet(){const t=this._sprites;return t.length?new be({sprites:t}):null}toAnimation(t){var e;const i=(e=this._gif)==null?void 0:e.images;if(i!=null&&i.length){const s=i.map((n,o)=>{var a;return{graphic:this._sprites[o],duration:((a=this._gif)==null?void 0:a.frames[o].delayMs)||void 0}});return this._animation=new zi({frames:s,frameDuration:t}),this._animation}return null}get readCheckBytes(){var t,e;return(e=(t=this._gif)==null?void 0:t.checkBytes)!=null?e:[]}}const hs=r=>r.reduce(function(t,e){return t*2+e},0),tr=r=>{const t=[];for(let e=7;e>=0;e--)t.push(!!(r&1<<e));return t};class ba{constructor(t){if(this.len=0,this.position=0,this.readByte=()=>{if(this.position>=this.data.byteLength)throw new Error("Attempted to read past end of stream.");return this.data[this.position++]},this.readBytes=e=>{const i=[];for(let s=0;s<e;s++)i.push(this.readByte());return i},this.read=e=>{let i="";for(let s=0;s<e;s++)i+=String.fromCharCode(this.readByte());return i},this.readUnsigned=()=>{const e=this.readBytes(2);return(e[1]<<8)+e[0]},this.data=new Uint8Array(t),this.len=this.data.byteLength,this.len===0)throw new Error("No data loaded from file")}}const ac=function(r,t){let e=0;const i=function(_){let f=0;for(let p=0;p<_;p++)t.charCodeAt(e>>3)&1<<(e&7)&&(f|=1<<p),e++;return f},s=[],n=1<<r,o=n+1;let a=r+1,h=[];const l=function(){h=[],a=r+1;for(let _=0;_<n;_++)h[_]=[_];h[n]=[],h[o]=null};let c=0,u=0;for(;;){if(u=c,c=i(a),c===n){l();continue}if(c===o)break;if(c<h.length)u!==n&&h.push(h[u].concat(h[c][0]));else{if(c!==h.length)throw new Error("Invalid LZW code.");h.push(h[u].concat(h[u][0]))}s.push.apply(s,h[c]),h.length===1<<a&&a<12&&a++}return s};class ya{constructor(t){this._handler={},this.frames=[],this.images=[],this.globalColorTableBytes=[],this.checkBytes=[],this.parseColorTableBytes=e=>{const i=[];for(let s=0;s<e;s++){const n=this._st.readBytes(3);i.push(n)}return i},this.readSubBlocks=()=>{let e,i;i="";do e=this._st.readByte(),i+=this._st.read(e);while(e!==0);return i},this.parseHeader=()=>{const e={sig:"",ver:"",width:0,height:0,colorResolution:0,globalColorTableSize:0,gctFlag:!1,sortedFlag:!1,globalColorTable:[],backgroundColorIndex:0,pixelAspectRatio:0};if(e.sig=this._st.read(3),e.ver=this._st.read(3),e.sig!=="GIF")throw new Error("Not a GIF file.");e.width=this._st.readUnsigned(),e.height=this._st.readUnsigned(),this._currentFrameCanvas.width=e.width,this._currentFrameCanvas.height=e.height;const i=tr(this._st.readByte());e.gctFlag=i.shift(),e.colorResolution=hs(i.splice(0,3)),e.sortedFlag=i.shift(),e.globalColorTableSize=hs(i.splice(0,3)),e.backgroundColorIndex=this._st.readByte(),e.pixelAspectRatio=this._st.readByte(),e.gctFlag&&(this.globalColorTableBytes=this.parseColorTableBytes(1<<e.globalColorTableSize+1)),this._handler.hdr&&this._handler.hdr(e)&&this.checkBytes.push(this._handler.hdr)},this.parseExt=e=>{const i=h=>{this.checkBytes.push(this._st.readByte());const l=tr(this._st.readByte());return h.reserved=l.splice(0,3),h.disposalMethod=hs(l.splice(0,3)),h.userInputFlag=l.shift(),h.transparentColorFlag=l.shift(),h.delayTime=this._st.readUnsigned(),h.transparentColorIndex=this._st.readByte(),h.terminator=this._st.readByte(),this._handler.gce&&this._handler.gce(h)&&this.checkBytes.push(this._handler.gce),h},s=h=>{h.comment=this.readSubBlocks(),this._handler.com&&this._handler.com(h)&&this.checkBytes.push(this._handler.com)},n=h=>{this.checkBytes.push(this._st.readByte()),h.ptHeader=this._st.readBytes(12),h.ptData=this.readSubBlocks(),this._handler.pte&&this._handler.pte(h)&&this.checkBytes.push(this._handler.pte)},o=h=>{const l=u=>{this.checkBytes.push(this._st.readByte()),u.unknown=this._st.readByte(),u.iterations=this._st.readUnsigned(),u.terminator=this._st.readByte(),this._handler.app&&this._handler.app.NETSCAPE&&this._handler.app.NETSCAPE(u)&&this.checkBytes.push(this._handler.app)},c=u=>{u.appData=this.readSubBlocks(),this._handler.app&&this._handler.app[u.identifier]&&this._handler.app[u.identifier](u)&&this.checkBytes.push(this._handler.app[u.identifier])};switch(this.checkBytes.push(this._st.readByte()),h.identifier=this._st.read(8),h.authCode=this._st.read(3),h.identifier){case"NETSCAPE":l(h);break;default:c(h);break}},a=h=>{h.data=this.readSubBlocks(),this._handler.unknown&&this._handler.unknown(h)&&this.checkBytes.push(this._handler.unknown)};switch(e.label=this._st.readByte(),e.label){case 249:e.extType="gce",this._gce=i(e);break;case 254:e.extType="com",s(e);break;case 1:e.extType="pte",n(e);break;case 255:e.extType="app",o(e);break;default:e.extType="unknown",a(e);break}},this.parseImg=e=>{var i;const s=(a,h)=>{const l=new Array(a.length),c=a.length/h,u=(g,w)=>{const m=a.slice(w*h,(w+1)*h);l.splice.apply(l,[g*h,h].concat(m))},_=[0,4,2,1],f=[8,8,4,2];let p=0;for(let g=0;g<4;g++)for(let w=_[g];w<c;w+=f[g])u(w,p),p++;return l};e.leftPos=this._st.readUnsigned(),e.topPos=this._st.readUnsigned(),e.width=this._st.readUnsigned(),e.height=this._st.readUnsigned();const n=tr(this._st.readByte());e.lctFlag=n.shift(),e.interlaced=n.shift(),e.sorted=n.shift(),e.reserved=n.splice(0,2),e.lctSize=hs(n.splice(0,3)),e.lctFlag&&(e.lctBytes=this.parseColorTableBytes(1<<e.lctSize+1)),e.lzwMinCodeSize=this._st.readByte();const o=this.readSubBlocks();e.pixels=ac(e.lzwMinCodeSize,o),e.interlaced&&(e.pixels=s(e.pixels,e.width)),(i=this._gce)!=null&&i.delayTime&&(e.delayMs=this._gce.delayTime*10),this.frames.push(e),this.arrayToImage(e,e.lctFlag?e.lctBytes:this.globalColorTableBytes),this._handler.img&&this._handler.img(e)&&this.checkBytes.push(this._handler)},this.parseBlocks=()=>{const e={sentinel:this._st.readByte(),type:""};switch(String.fromCharCode(e.sentinel)){case"!":e.type="ext",this.parseExt(e);break;case",":e.type="img",this.parseImg(e);break;case";":e.type="eof",this._handler.eof&&this._handler.eof(e)&&this.checkBytes.push(this._handler.eof);break;default:throw new Error("Unknown block: 0x"+e.sentinel.toString(16))}e.type!=="eof"&&this.parseBlocks()},this.arrayToImage=(e,i)=>{var s,n,o,a;const h=document.createElement("canvas");h.width=e.width,h.height=e.height;const l=h.getContext("2d"),c=l.getImageData(0,0,h.width,h.height);let u=-1;(s=this._gce)!=null&&s.transparentColorFlag&&(u=this._gce.transparentColorIndex);for(let f=0;f<e.pixels.length;f++){const p=e.pixels[f],g=i[p];p===u?c.data.set([0,0,0,0],f*4):c.data.set([...g,255],f*4)}if(l.putImageData(c,0,0),((n=this._gce)==null?void 0:n.disposalMethod)===1&&this.images.length)this._currentFrameContext.drawImage(this.images[this.images.length-1],0,0);else if(((o=this._gce)==null?void 0:o.disposalMethod)===2&&((a=this._hdr)!=null&&a.gctFlag)){const f=i[this._hdr.backgroundColorIndex];this._currentFrameContext.fillStyle=`rgb(${f[0]}, ${f[1]}, ${f[2]})`,this._currentFrameContext.fillRect(0,0,this._hdr.width,this._hdr.height)}else this._currentFrameContext.clearRect(0,0,this._currentFrameCanvas.width,this._currentFrameCanvas.height);this._currentFrameContext.drawImage(h,e.leftPos,e.topPos,e.width,e.height);const _=new Image;_.src=this._currentFrameCanvas.toDataURL(),this.images.push(_)},this._st=t,this._handler={},this._currentFrameCanvas=document.createElement("canvas"),this._currentFrameContext=this._currentFrameCanvas.getContext("2d"),this.parseHeader(),this.parseBlocks()}}class hc{constructor(t,e,{bustCache:i,...s}={}){this.path=t,this.family=e,this._isLoaded=!1,this._resource=new ai(t,"blob",i),this._options=s}async load(){if(this.isLoaded())return this.data;try{const t=await this._resource.load(),e=URL.createObjectURL(t);this.data||(this.data=new FontFace(this.family,`url(${e})`),document.fonts.add(this.data)),await this.data.load(),this._isLoaded=!0}catch(t){throw`Error loading FontSource from path '${this.path}' with error [${t.message}]`}return this.data}isLoaded(){return this._isLoaded}toFont(t){return new Ce({family:this.family,...this._options,...t})}}const Ca=ma(),lc=/^\s*(?:function)?\*/;function Sa(r){return typeof r!="function"?!1:lc.test(Function.prototype.toString.call(r))?!0:Object.getPrototypeOf?Object.getPrototypeOf(r)===Object.getPrototypeOf(new Function("return function * () {}")()):!1}function Ta(...r){var t;const e=R.getInstance();let i,s,n,o;Sa(r[0])&&(s=globalThis,i=r[0],n=r[1]),Sa(r[1])&&(s=r[0],i=r[1],n=r[2]),r[1]instanceof os&&(s=r[0],o=r[1],i=r[2],n=r[3]),r[0]instanceof os&&(s=globalThis,o=r[0],i=r[1],n=r[2]);const a=va(Ca),h=n==null?void 0:n.timing,l=a?!1:(t=n==null?void 0:n.autostart)!=null?t:!0;let c;try{c=o!=null?o:os.useEngine()}catch(T){throw Error(`Cannot run coroutine without engine parameter outside of an excalibur lifecycle method.
819
819
  Pass an engine parameter to ex.coroutine(engine, function * {...})`)}let u=!1,_=!1,f=!1;const p=i.bind(s),g=p();let w;const m=new Promise((T,C)=>{w=S=>{try{if(f){_=!0,T();return}const{done:I,value:y}=Ca.scope(!0,()=>g.next(S));if(I||f){_=!0,T();return}y instanceof Promise?y.then(()=>{c.clock.schedule(w,0,h)}):y===void 0||y===void 0?c.clock.schedule(w,0,h):c.clock.schedule(w,y||0,h)}catch(I){C(I);return}},l&&(u=!0,w(c.clock.elapsed()))}),b={isRunning:()=>u&&!f&&!_,isComplete:()=>_,cancel:()=>{f=!0},start:()=>(u?e.warn(`.start() was called on a coroutine that was already started, this is probably a bug:
820
- `,Function.prototype.toString.call(p)):(u=!0,w(c.clock.elapsed())),b),generator:g,done:m,then:m.then.bind(m),[Symbol.iterator]:()=>g};return b}class ls extends Tt{constructor(t){var e,i,s,n,o;super(),this._logger=R.getInstance(),this.transform=new A,this.graphics=new j,this._completeFuture=new wt,this.started=!1,this._currentDistance=0,this._currentProgress=0,this.done=this._completeFuture.promise,this._useLegacyEasing=!1,this.name=`Transition#${this.id}`,this.duration=t.duration,Se(t.easing)?(this.legacyEasing=(e=t.easing)!=null?e:It.Linear,this._useLegacyEasing=!0):this.easing=(i=t.easing)!=null?i:Ti,this.direction=(s=t.direction)!=null?s:"out",this.hideLoader=(n=t.hideLoader)!=null?n:!1,this.blockInput=(o=t.blockInput)!=null?o:!1,this.transform.coordPlane=rt.Screen,this.transform.pos=v.Zero,this.transform.z=1/0,this.graphics.anchor=v.Zero,this.addComponent(this.transform),this.addComponent(this.graphics),this.direction==="out"?this._currentProgress=0:this._currentProgress=1}get progress(){return this._currentProgress}get distance(){return this._currentDistance}get complete(){return this.direction==="out"?this.progress>=1:this.progress<=0}updateTransition(t,e){this.complete||(this._currentDistance+=F(e/this.duration,0,1),this._currentDistance>=1&&(this._currentDistance=1),this.direction==="out"?this._useLegacyEasing?this._currentProgress=F(this.legacyEasing(this._currentDistance,0,1,1),0,1):this._currentProgress=F(ot(0,1,this.easing(this._currentDistance)),0,1):this._useLegacyEasing?this._currentProgress=F(this.legacyEasing(this._currentDistance,1,0,1),0,1):this._currentProgress=F(ot(1,0,this.easing(this._currentDistance)),0,1))}async onPreviousSceneDeactivate(t){}onStart(t){}onUpdate(t){}onEnd(t){}onReset(){}reset(){this.started=!1,this._completeFuture=new wt,this.done=this._completeFuture.promise,this._currentDistance=0,this.direction==="out"?this._currentProgress=0:this._currentProgress=1,this.onReset()}_addToTargetScene(t,e){const i=e;if(this.started&&this._logger.warn(`Attempted to add a transition ${this.name} that is already playing.`),i.world.entityManager.getById(this.id))return this._co;this._engine=t,i.add(this);const s=this;return this._co=Ta(t,function*(){for(;!s.complete;){const n=yield;s.updateTransition(s._engine,n),s._execute()}},{autostart:!1}),this._co}async _play(){this.started&&(this.reset(),this._logger.warn(`Attempted to play a transition ${this.name} that is already playing, reset transition.`)),(!this._engine||!this._co)&&(this.reset(),this._logger.warn(`Attempted to play a transition ${this.name} that hasn't been added`)),this._co&&await this._co.start()}_execute(){this.isInitialized&&(this.started||(this.started=!0,this.onStart(this.progress)),this.onUpdate(this.progress),this.complete&&!this._completeFuture.isCompleted&&(this.onEnd(this.progress),this._completeFuture.resolve()))}}class cc extends ls{constructor(t){var e,i;super({...t,duration:(e=t.duration)!=null?e:2e3}),this.name=`FadeInOut#${this.id}`,this.color=(i=t.color)!=null?i:P.Black}onInitialize(t){this.transform.pos=t.screen.unsafeArea.topLeft,this.screenCover=new ci({width:t.screen.resolution.width,height:t.screen.resolution.height,color:this.color}),this.graphics.add(this.screenCover),this.graphics.opacity=this.progress}onReset(){this.graphics.opacity=this.progress}onStart(t){this.graphics.opacity=t}onEnd(t){this.graphics.opacity=t}onUpdate(t){this.graphics.opacity=t}}class dc extends ls{constructor(t){super({direction:"in",...t}),this.name=`CrossFade#${this.id}`}async onPreviousSceneDeactivate(t){this.image=await t.engine.screenshot(!0),await this.image.decode()}onInitialize(t){this.engine=t,this.transform.pos=t.screen.unsafeArea.topLeft,this.screenCover=Gt.fromHtmlImageElement(this.image).toSprite(),this.graphics.add(this.screenCover),this.transform.scale=x(1/t.screen.pixelRatio,1/t.screen.pixelRatio),this.graphics.opacity=this.progress}onStart(t){this.graphics.opacity=this.progress}onReset(){this.graphics.opacity=this.progress}onEnd(t){this.graphics.opacity=t}onUpdate(t){this.graphics.opacity=t}}class uc extends ls{constructor(t){var e;super({direction:"in",...t}),this._easing=It.Linear,this._start=v.Zero,this._end=v.Zero,this.name=`Slide#${this.id}`,this.slideDirection=t.slideDirection,this.transform.coordPlane=rt.Screen,this.graphics.forceOnScreen=!0,this._easing=(e=t.easingFunction)!=null?e:this._easing}async onPreviousSceneDeactivate(t){this._image=await t.engine.screenshot(!0),await this._image.decode(),this._screenCover=Gt.fromHtmlImageElement(this._image).toSprite()}onInitialize(t){this._engine=t;let e=t.screen.unsafeArea;switch(e.hasZeroDimensions()&&(e=t.screen.contentArea),this.slideDirection){case"up":{this._directionOffset=x(0,-e.height);break}case"down":{this._directionOffset=x(0,e.height);break}case"left":{this._directionOffset=x(-e.width,0);break}case"right":{this._directionOffset=x(e.width,0);break}}this._camera=this._engine.currentScene.camera,this._destinationCameraPosition=this._camera.pos.clone(),this._camera.pos=this._camera.pos.add(this._directionOffset),this.transform.pos=this.transform.pos.add(this._directionOffset),this._startCameraPosition=this._camera.pos.clone(),this._start=e.topLeft,this._end=this._start.add(this._directionOffset),this.transform.pos=this._start,this.graphics.use(this._screenCover),this.transform.scale=x(1/t.screen.pixelRatio,1/t.screen.pixelRatio)}onStart(t){const e=this._easing(this.distance,0,1,1);this.transform.pos.x=ot(this._start.x,this._end.x,e),this.transform.pos.y=ot(this._start.y,this._end.y,e),this._camera.pos.x=ot(this._startCameraPosition.x,this._destinationCameraPosition.x,e),this._camera.pos.y=ot(this._startCameraPosition.y,this._destinationCameraPosition.y,e)}onUpdate(t){const e=this._easing(this.distance,0,1,1);this.transform.pos.x=ot(this._start.x,this._end.x,e),this.transform.pos.y=ot(this._start.y,this._end.y,e),this._camera.pos.x=ot(this._startCameraPosition.x,this._destinationCameraPosition.x,e),this._camera.pos.y=ot(this._startCameraPosition.y,this._destinationCameraPosition.y,e)}}const _c=Object.freeze(Object.defineProperty({__proto__:null,ConsoleAppender:ys,DrawUtil:Uh,EasingFunctions:It,LogLevel:Le,Logger:R,Observable:gt,ScreenAppender:mr,addItemToArray:Ch,contains:xr,delay:Di,fail:br,getMinIndex:wr,getPosition:ni,isLegacyEasing:Se,isObject:Fi,mergeDeep:Bi,omit:yr,removeItemFromArray:Oe},Symbol.toStringTag,{value:"Module"})),Pa=5,Je={},fc=()=>{for(const r in Je)Je[r]=0},cs=(r,t)=>{const e=De.isEnabled("suppress-obsolete-message");Je[r]<Pa&&!e&&(R.getInstance().warn(r),console.trace&&t.showStackTrace&&console.trace()),Je[r]++};function gc(r){return r={message:"This feature will be removed in future versions of Excalibur.",alternateMethod:null,showStackTrace:!1,...r},function(t,e,i){if(i&&!(typeof i.value=="function"||typeof i.get=="function"||typeof i.set=="function"))throw new SyntaxError("Only classes/functions/getters/setters can be marked as obsolete");const n=`${`${t.name||""}${t.name&&e?".":""}${e||""}`} is marked obsolete: ${r.message}`+(r.alternateMethod?` Use ${r.alternateMethod} instead`:"");Je[n]||(Je[n]=0);const o=i?{...i}:t;if(!i){class a extends o{constructor(...l){cs(n,r),super(...l)}}return a}return i&&i.value?(o.value=function(){return cs(n,r),i.value.apply(this,arguments)},o):(i&&i.get&&(o.get=function(){return cs(n,r),i.get.apply(this,arguments)}),i&&i.set&&(o.set=function(){return cs(n,r),i.set.apply(this,arguments)}),o)}}class pc{constructor(){this._queue=[]}get length(){return this._queue.length}enqueue(){const t=new wt;return this._queue.push(t),t.promise}dequeue(t){this._queue.shift().resolve(t)}}class mc{constructor(t){this._count=t,this._waitQueue=new pc}get count(){return this._count}get waiting(){return this._waitQueue.length}async enter(){return this._count!==0?(this._count--,Promise.resolve()):this._waitQueue.enqueue()}exit(t=1){if(t!==0){for(;t!==0&&this._waitQueue.length!==0;)this._waitQueue.dequeue(null),t--;this._count+=t}}}const er="0.32.0-alpha.1566+bfb6759";Me(),d.ActionCompleteEvent=$s,d.ActionContext=_i,d.ActionQueue=eo,d.ActionSequence=Kn,d.ActionStartEvent=Ys,d.ActionsComponent=je,d.ActionsSystem=Vn,d.ActivateEvent=Ns,d.Actor=Ft,d.ActorEvents=Cl,d.AddEvent=js,d.AddedComponent=Sh,d.AffineMatrix=Q,d.Animation=zi,d.AnimationDirection=Br,d.AnimationEvents=Fh,d.AnimationStrategy=Lr,d.ArcadeSolver=Dn,d.AudioContextFactory=gi,d.Axes=ea,d.Axis=Yo,d.BaseAlign=an,d.BezierCurve=ei,d.Blink=yo,d.BodyComponent=W,d.BoundingBox=D,d.BrowserComponent=$n,d.BrowserEvents=da,d.Buttons=qn,d.Camera=Ko,d.CameraEvents=Ll,d.Canvas=qi,d.ChannelCollection=xa,d.Circle=Vi,d.CircleCollider=dt,d.Clock=jn,d.ClosestLineJumpTable=Wt,d.Collider=ri,d.ColliderComponent=tt,d.CollisionContact=we,d.CollisionEndEvent=si,d.CollisionGroup=pe,d.CollisionGroupManager=Pi,d.CollisionJumpTable=Lt,d.CollisionPostSolveEvent=Mi,d.CollisionPreSolveEvent=Ri,d.CollisionStartEvent=ii,d.CollisionSystem=Zi,d.CollisionType=M,d.Color=P,d.ColorBlindFlags=la,d.ColorBlindnessMode=Ye,d.ColorBlindnessPostProcessor=Qr,d.Component=Dt,d.CompositeCollider=at,d.ConsoleAppender=ys,d.ContactConstraintPoint=Mo,d.ContactEndEvent=Ii,d.ContactSolveBias=oe,d.ContactStartEvent=Ei,d.CoordPlane=rt,d.CrossFade=dc,d.CurveBy=Eo,d.CurveTo=Ao,d.DeactivateEvent=Ws,d.Debug=Cn,d.DebugConfig=ca,d.DebugGraphicsComponent=Ni,d.DebugSystem=Gn,d.DebugText=un,d.DefaultAntialiasOptions=Or,d.DefaultGarbageCollectionOptions=Qn,d.DefaultLoader=pi,d.DefaultPixelArtOptions=Hr,d.DegreeOfFreedom=he,d.Delay=So,d.Detector=Oo,d.Die=To,d.Direction=ln,d.Director=pa,d.DirectorEvents=ga,d.DisplayMode=fi,d.DynamicTree=Ks,d.DynamicTreeCollisionProcessor=Li,d.EX_VERSION=er,d.EaseBy=bo,d.EaseTo=xo,d.EasingFunctions=It,d.Edge=vs,d.EdgeCollider=Ct,d.ElasticToActorStrategy=Zo,d.EmitterType=Ae,d.Engine=os,d.EngineEvents=Wl,d.EnterTriggerEvent=qs,d.EnterViewPortEvent=Vs,d.Entity=Tt,d.EntityEvents=Eh,d.EntityManager=Sr,d.EventEmitter=X,d.EventTypes=Ss,d.Events=yh,d.ExResponse=kn,d.ExcaliburGraphicsContext2DCanvas=Xi,d.ExcaliburGraphicsContextWebGL=Xt,d.ExitTriggerEvent=Xs,d.ExitViewPortEvent=Gs,d.Fade=Co,d.FadeInOut=cc,d.Flags=De,d.Flash=Po,d.Follow=An,d.Font=Ce,d.FontCache=Gi,d.FontSource=hc,d.FontStyle=hn,d.FontUnit=rn,d.FpsSampler=ua,d.FrameStats=bi,d.Future=wt,d.GameEvent=L,d.GameStartEvent=As,d.GameStopEvent=Es,d.Gamepad=is,d.GamepadAxisEvent=zs,d.GamepadButtonEvent=Us,d.GamepadConnectEvent=Ls,d.GamepadDisconnectEvent=ks,d.Gamepads=es,d.GarbageCollector=wa,d.Gif=oc,d.GifParser=ya,d.GlobalCoordinates=Be,d.GpuParticleEmitter=ql,d.GpuParticleRenderer=as,d.Graph=ms,d.Graphic=it,d.GraphicsComponent=j,d.GraphicsGroup=Ne,d.GraphicsSystem=fn,d.HashColliderProxy=Ro,d.HashGridCell=Yt,d.HashGridProxy=In,d.HiddenEvent=Hs,d.HorizontalFirst=en,d.ImageFiltering=mt,d.ImageSource=Gt,d.ImageSourceAttributeConstants=O,d.ImageWrapping=_t,d.InitializeEvent=ze,d.InputHost=Yn,d.InputMapper=ia,d.IsometricEntityComponent=mi,d.IsometricEntitySystem=Wn,d.IsometricMap=Bl,d.IsometricTile=qo,d.KeyEvent=vi,d.Keyboard=aa,d.Keys=oa,d.KillEvent=Ai,d.Label=Gl,d.LimitCameraBoundsStrategy=Jo,d.Line=_n,d.LineSegment=J,d.Loader=Ji,d.LoaderEvents=Il,d.LockCameraToActorAxisStrategy=jo,d.LockCameraToActorStrategy=$o,d.LogLevel=Le,d.Logger=R,d.Material=Kr,d.Matrix=yt,d.MatrixLocations=cr,d.MediaEvent=Un,d.Meet=$i,d.MotionComponent=H,d.MotionSystem=ji,d.MoveBy=Tn,d.MoveByWithOptions=ro,d.MoveTo=Pn,d.MoveToWithOptions=ao,d.NativePointerButton=Pe,d.NativeSoundEvent=Te,d.NativeSoundProcessedEvent=ko,d.NineSlice=mn,d.NineSliceStretch=zr,d.Node=Si,d.None=sn,d.Observable=gt,d.OffscreenSystem=gn,d.Pair=pt,d.ParallaxComponent=Wi,d.ParallelActions=Xl,d.Particle=Yi,d.ParticleEmitter=Vl,d.ParticleRenderer=jr,d.ParticleTransform=Vt,d.PhysicsStats=ns,d.PhysicsWorld=Do,d.PointerAbstraction=Xn,d.PointerButton=le,d.PointerComponent=ae,d.PointerEvent=wi,d.PointerEventReceiver=ss,d.PointerScope=Fe,d.PointerSystem=ts,d.PointerType=ce,d.Polygon=pn,d.PolygonCollider=lt,d.Pool=Ui,d.PositionNode=_r,d.PostCollisionEvent=ve,d.PostDebugDrawEvent=Ds,d.PostDrawEvent=Ue,d.PostFrameEvent=Bs,d.PostKillEvent=Ps,d.PostTransformDrawEvent=Rs,d.PostUpdateEvent=re,d.PreCollisionEvent=me,d.PreDebugDrawEvent=Ms,d.PreDrawEvent=ke,d.PreFrameEvent=Fs,d.PreKillEvent=Ts,d.PreLoadEvent=Ol,d.PreTransformDrawEvent=Is,d.PreUpdateEvent=ne,d.Projection=Ke,d.QuadIndexBuffer=di,d.QuadTree=Ze,d.Query=Bt,d.QueryManager=Tr,d.RadiusAroundActorStrategy=Qo,d.Random=ie,d.Raster=We,d.Ray=fe,d.RealisticSolver=Fn,d.Rectangle=ci,d.RemoveEvent=Zs,d.RemovedComponent=Ph,d.RentalPool=Ve,d.Repeat=io,d.RepeatForever=so,d.Resolution=Bn,d.Resource=ai,d.ResourceEvents=Hh,d.RotateBy=uo,d.RotateByWithOptions=co,d.RotateTo=lo,d.RotateToWithOptions=ho,d.RotationType=Z,d.ScaleBy=vo,d.ScaleByWithOptions=mo,d.ScaleTo=go,d.ScaleToWithOptions=fo,d.Scene=Rt,d.SceneEvents=Hl,d.Screen=Ln,d.ScreenAppender=mr,d.ScreenElement=Hn,d.ScreenEvents=Sl,d.ScreenShader=Zr,d.ScrollPreventionMode=Qe,d.Semaphore=mc,d.SeparatingAxis=He,d.SeparationInfo=Mr,d.Shader=zt,d.Shape=ut,d.Slide=uc,d.SolverStrategy=ki,d.Sound=zn,d.SoundEvents=Al,d.SoundManager=rc,d.SparseHashGrid=Rn,d.SparseHashGridCollisionProcessor=Mn,d.SpatialPartitionStrategy=oi,d.Sprite=kt,d.SpriteFont=Oi,d.SpriteSheet=be,d.StandardClock=Zn,d.StateMachine=Qi,d.StrategyContainer=Xo,d.Stream=ba,d.System=At,d.SystemManager=Ar,d.SystemPriority=Nt,d.SystemType=Pt,d.TagQuery=Qs,d.TestClock=_a,d.Text=ui,d.TextAlign=on,d.TextureLoader=qe,d.Tile=Vo,d.TileMap=Go,d.TileMapEvents=Fl,d.TiledAnimation=vn,d.TiledSprite=li,d.Timer=Ki,d.Toaster=fa,d.Transform=Qt,d.TransformComponent=A,d.Transition=ls,d.TreeNode=Js,d.Trigger=ta,d.TriggerEvents=kl,d.TwoPI=et,d.UniformBuffer=Nr,d.Util=_c,d.Vector=v,d.VectorView=gs,d.VertexBuffer=qt,d.VertexLayout=Kt,d.VerticalFirst=tn,d.VisibleEvent=Os,d.WebAudio=Bo,d.WebAudioInstance=Lo,d.WheelDeltaMode=xi,d.WheelEvent=ha,d.World=Er,d.approximatelyEqual=ar,d.assert=Jn,d.canonicalizeAngle=Zt,d.clamp=F,d.coroutine=Ta,d.createId=_e,d.easeInBack=fh,d.easeInBounce=gr,d.easeInCirc=dh,d.easeInCubic=th,d.easeInElastic=mh,d.easeInExpo=hh,d.easeInOutBack=ph,d.easeInOutBounce=xh,d.easeInOutCirc=_h,d.easeInOutCubic=xs,d.easeInOutElastic=wh,d.easeInOutExpo=ch,d.easeInOutQuad=Ka,d.easeInOutQuart=nh,d.easeInOutQuint=ah,d.easeInOutSine=Za,d.easeInQuad=Qa,d.easeInQuart=ih,d.easeInQuint=rh,d.easeInSine=$a,d.easeOutBack=gh,d.easeOutBounce=bs,d.easeOutCirc=uh,d.easeOutCubic=eh,d.easeOutElastic=vh,d.easeOutExpo=lh,d.easeOutQuad=Ja,d.easeOutQuart=sh,d.easeOutQuint=oh,d.easeOutSine=ja,d.frac=Na,d.getDefaultPhysicsConfig=Jt,d.glTypeToUniformTypeName=Xr,d.hasGraphicsTick=Sn,d.hasOnAdd=ec,d.hasOnInitialize=Zl,d.hasOnPostUpdate=tc,d.hasOnPreUpdate=Jl,d.hasOnRemove=ic,d.hasPostDraw=nc,d.hasPreDraw=sc,d.has_add=$l,d.has_initialize=Yl,d.has_postupdate=Kl,d.has_preupdate=Ql,d.has_remove=jl,d.inverseLerp=dr,d.inverseLerpVector=ur,d.isActor=yl,d.isAddedComponent=Th,d.isComponentCtor=vr,d.isLegacyEasing=Se,d.isLoaderConstructor=On,d.isMoveByOptions=no,d.isMoveToOptions=oo,d.isRemovedComponent=Ah,d.isRotateByOptions=bl,d.isRotateToOptions=xl,d.isScaleByOptions=po,d.isScaleToOptions=_o,d.isSceneConstructor=$t,d.isScreenElement=Ho,d.isSystemConstructor=Pr,d.lerp=ot,d.lerpAngle=ps,d.lerpVector=ti,d.linear=Ti,d.maxMessages=Pa,d.nextActionId=N,d.obsolete=gc,d.parseImageFiltering=Ge,d.parseImageWrapping=Ut,d.pixelSnapEpsilon=B,d.randomInRange=Ot,d.randomIntInRange=Va,d.range=Ga,d.remap=Ht,d.remapVector=qa,d.resetObsoleteCounter=fc,d.sign=V,d.smootherstep=Ya,d.smoothstep=Xa,d.toDegrees=hr,d.toRadians=Wa,d.vec=x,d.webgl=Yh,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
820
+ `,Function.prototype.toString.call(p)):(u=!0,w(c.clock.elapsed())),b),generator:g,done:m,then:m.then.bind(m),[Symbol.iterator]:()=>g};return b}class ls extends Tt{constructor(t){var e,i,s,n,o;super(),this._logger=R.getInstance(),this.transform=new A,this.graphics=new j,this._completeFuture=new wt,this.started=!1,this._currentDistance=0,this._currentProgress=0,this.done=this._completeFuture.promise,this._useLegacyEasing=!1,this.name=`Transition#${this.id}`,this.duration=t.duration,Se(t.easing)?(this.legacyEasing=(e=t.easing)!=null?e:It.Linear,this._useLegacyEasing=!0):this.easing=(i=t.easing)!=null?i:Ti,this.direction=(s=t.direction)!=null?s:"out",this.hideLoader=(n=t.hideLoader)!=null?n:!1,this.blockInput=(o=t.blockInput)!=null?o:!1,this.transform.coordPlane=rt.Screen,this.transform.pos=v.Zero,this.transform.z=1/0,this.graphics.anchor=v.Zero,this.addComponent(this.transform),this.addComponent(this.graphics),this.direction==="out"?this._currentProgress=0:this._currentProgress=1}get progress(){return this._currentProgress}get distance(){return this._currentDistance}get complete(){return this.direction==="out"?this.progress>=1:this.progress<=0}updateTransition(t,e){this.complete||(this._currentDistance+=F(e/this.duration,0,1),this._currentDistance>=1&&(this._currentDistance=1),this.direction==="out"?this._useLegacyEasing?this._currentProgress=F(this.legacyEasing(this._currentDistance,0,1,1),0,1):this._currentProgress=F(ot(0,1,this.easing(this._currentDistance)),0,1):this._useLegacyEasing?this._currentProgress=F(this.legacyEasing(this._currentDistance,1,0,1),0,1):this._currentProgress=F(ot(1,0,this.easing(this._currentDistance)),0,1))}async onPreviousSceneDeactivate(t){}onStart(t){}onUpdate(t){}onEnd(t){}onReset(){}reset(){this.started=!1,this._completeFuture=new wt,this.done=this._completeFuture.promise,this._currentDistance=0,this.direction==="out"?this._currentProgress=0:this._currentProgress=1,this.onReset()}_addToTargetScene(t,e){const i=e;if(this.started&&this._logger.warn(`Attempted to add a transition ${this.name} that is already playing.`),i.world.entityManager.getById(this.id))return this._co;this._engine=t,i.add(this);const s=this;return this._co=Ta(t,function*(){for(;!s.complete;){const n=yield;s.updateTransition(s._engine,n),s._execute()}},{autostart:!1}),this._co}async _play(){this.started&&(this.reset(),this._logger.warn(`Attempted to play a transition ${this.name} that is already playing, reset transition.`)),(!this._engine||!this._co)&&(this.reset(),this._logger.warn(`Attempted to play a transition ${this.name} that hasn't been added`)),this._co&&await this._co.start()}_execute(){this.isInitialized&&(this.started||(this.started=!0,this.onStart(this.progress)),this.onUpdate(this.progress),this.complete&&!this._completeFuture.isCompleted&&(this.onEnd(this.progress),this._completeFuture.resolve()))}}class cc extends ls{constructor(t){var e,i;super({...t,duration:(e=t.duration)!=null?e:2e3}),this.name=`FadeInOut#${this.id}`,this.color=(i=t.color)!=null?i:P.Black}onInitialize(t){this.transform.pos=t.screen.unsafeArea.topLeft,this.screenCover=new ci({width:t.screen.resolution.width,height:t.screen.resolution.height,color:this.color}),this.graphics.add(this.screenCover),this.graphics.opacity=this.progress}onReset(){this.graphics.opacity=this.progress}onStart(t){this.graphics.opacity=t}onEnd(t){this.graphics.opacity=t}onUpdate(t){this.graphics.opacity=t}}class dc extends ls{constructor(t){super({direction:"in",...t}),this.name=`CrossFade#${this.id}`}async onPreviousSceneDeactivate(t){this.image=await t.engine.screenshot(!0),await this.image.decode()}onInitialize(t){this.engine=t,this.transform.pos=t.screen.unsafeArea.topLeft,this.screenCover=Gt.fromHtmlImageElement(this.image).toSprite(),this.graphics.add(this.screenCover),this.transform.scale=x(1/t.screen.pixelRatio,1/t.screen.pixelRatio),this.graphics.opacity=this.progress}onStart(t){this.graphics.opacity=this.progress}onReset(){this.graphics.opacity=this.progress}onEnd(t){this.graphics.opacity=t}onUpdate(t){this.graphics.opacity=t}}class uc extends ls{constructor(t){var e;super({direction:"in",...t}),this._easing=It.Linear,this._start=v.Zero,this._end=v.Zero,this.name=`Slide#${this.id}`,this.slideDirection=t.slideDirection,this.transform.coordPlane=rt.Screen,this.graphics.forceOnScreen=!0,this._easing=(e=t.easingFunction)!=null?e:this._easing}async onPreviousSceneDeactivate(t){this._image=await t.engine.screenshot(!0),await this._image.decode(),this._screenCover=Gt.fromHtmlImageElement(this._image).toSprite()}onInitialize(t){this._engine=t;let e=t.screen.unsafeArea;switch(e.hasZeroDimensions()&&(e=t.screen.contentArea),this.slideDirection){case"up":{this._directionOffset=x(0,-e.height);break}case"down":{this._directionOffset=x(0,e.height);break}case"left":{this._directionOffset=x(-e.width,0);break}case"right":{this._directionOffset=x(e.width,0);break}}this._camera=this._engine.currentScene.camera,this._destinationCameraPosition=this._camera.pos.clone(),this._camera.pos=this._camera.pos.add(this._directionOffset),this.transform.pos=this.transform.pos.add(this._directionOffset),this._startCameraPosition=this._camera.pos.clone(),this._start=e.topLeft,this._end=this._start.add(this._directionOffset),this.transform.pos=this._start,this.graphics.use(this._screenCover),this.transform.scale=x(1/t.screen.pixelRatio,1/t.screen.pixelRatio)}onStart(t){const e=this._easing(this.distance,0,1,1);this.transform.pos.x=ot(this._start.x,this._end.x,e),this.transform.pos.y=ot(this._start.y,this._end.y,e),this._camera.pos.x=ot(this._startCameraPosition.x,this._destinationCameraPosition.x,e),this._camera.pos.y=ot(this._startCameraPosition.y,this._destinationCameraPosition.y,e)}onUpdate(t){const e=this._easing(this.distance,0,1,1);this.transform.pos.x=ot(this._start.x,this._end.x,e),this.transform.pos.y=ot(this._start.y,this._end.y,e),this._camera.pos.x=ot(this._startCameraPosition.x,this._destinationCameraPosition.x,e),this._camera.pos.y=ot(this._startCameraPosition.y,this._destinationCameraPosition.y,e)}}const _c=Object.freeze(Object.defineProperty({__proto__:null,ConsoleAppender:ys,DrawUtil:Uh,EasingFunctions:It,LogLevel:Le,Logger:R,Observable:gt,ScreenAppender:mr,addItemToArray:Ch,contains:xr,delay:Di,fail:br,getMinIndex:wr,getPosition:ni,isLegacyEasing:Se,isObject:Fi,mergeDeep:Bi,omit:yr,removeItemFromArray:Oe},Symbol.toStringTag,{value:"Module"})),Pa=5,Je={},fc=()=>{for(const r in Je)Je[r]=0},cs=(r,t)=>{const e=De.isEnabled("suppress-obsolete-message");Je[r]<Pa&&!e&&(R.getInstance().warn(r),console.trace&&t.showStackTrace&&console.trace()),Je[r]++};function gc(r){return r={message:"This feature will be removed in future versions of Excalibur.",alternateMethod:null,showStackTrace:!1,...r},function(t,e,i){if(i&&!(typeof i.value=="function"||typeof i.get=="function"||typeof i.set=="function"))throw new SyntaxError("Only classes/functions/getters/setters can be marked as obsolete");const n=`${`${t.name||""}${t.name&&e?".":""}${e||""}`} is marked obsolete: ${r.message}`+(r.alternateMethod?` Use ${r.alternateMethod} instead`:"");Je[n]||(Je[n]=0);const o=i?{...i}:t;if(!i){class a extends o{constructor(...l){cs(n,r),super(...l)}}return a}return i&&i.value?(o.value=function(){return cs(n,r),i.value.apply(this,arguments)},o):(i&&i.get&&(o.get=function(){return cs(n,r),i.get.apply(this,arguments)}),i&&i.set&&(o.set=function(){return cs(n,r),i.set.apply(this,arguments)}),o)}}class pc{constructor(){this._queue=[]}get length(){return this._queue.length}enqueue(){const t=new wt;return this._queue.push(t),t.promise}dequeue(t){this._queue.shift().resolve(t)}}class mc{constructor(t){this._count=t,this._waitQueue=new pc}get count(){return this._count}get waiting(){return this._waitQueue.length}async enter(){return this._count!==0?(this._count--,Promise.resolve()):this._waitQueue.enqueue()}exit(t=1){if(t!==0){for(;t!==0&&this._waitQueue.length!==0;)this._waitQueue.dequeue(null),t--;this._count+=t}}}const er="0.32.0-alpha.1568+800f627";Me(),d.ActionCompleteEvent=$s,d.ActionContext=_i,d.ActionQueue=eo,d.ActionSequence=Kn,d.ActionStartEvent=Ys,d.ActionsComponent=je,d.ActionsSystem=Vn,d.ActivateEvent=Ns,d.Actor=Ft,d.ActorEvents=Cl,d.AddEvent=js,d.AddedComponent=Sh,d.AffineMatrix=Q,d.Animation=zi,d.AnimationDirection=Br,d.AnimationEvents=Fh,d.AnimationStrategy=Lr,d.ArcadeSolver=Dn,d.AudioContextFactory=gi,d.Axes=ea,d.Axis=Yo,d.BaseAlign=an,d.BezierCurve=ei,d.Blink=yo,d.BodyComponent=W,d.BoundingBox=D,d.BrowserComponent=$n,d.BrowserEvents=da,d.Buttons=qn,d.Camera=Ko,d.CameraEvents=Ll,d.Canvas=qi,d.ChannelCollection=xa,d.Circle=Vi,d.CircleCollider=dt,d.Clock=jn,d.ClosestLineJumpTable=Wt,d.Collider=ri,d.ColliderComponent=tt,d.CollisionContact=we,d.CollisionEndEvent=si,d.CollisionGroup=pe,d.CollisionGroupManager=Pi,d.CollisionJumpTable=Lt,d.CollisionPostSolveEvent=Mi,d.CollisionPreSolveEvent=Ri,d.CollisionStartEvent=ii,d.CollisionSystem=Zi,d.CollisionType=M,d.Color=P,d.ColorBlindFlags=la,d.ColorBlindnessMode=Ye,d.ColorBlindnessPostProcessor=Qr,d.Component=Dt,d.CompositeCollider=at,d.ConsoleAppender=ys,d.ContactConstraintPoint=Mo,d.ContactEndEvent=Ii,d.ContactSolveBias=oe,d.ContactStartEvent=Ei,d.CoordPlane=rt,d.CrossFade=dc,d.CurveBy=Eo,d.CurveTo=Ao,d.DeactivateEvent=Ws,d.Debug=Cn,d.DebugConfig=ca,d.DebugGraphicsComponent=Ni,d.DebugSystem=Gn,d.DebugText=un,d.DefaultAntialiasOptions=Or,d.DefaultGarbageCollectionOptions=Qn,d.DefaultLoader=pi,d.DefaultPixelArtOptions=Hr,d.DegreeOfFreedom=he,d.Delay=So,d.Detector=Oo,d.Die=To,d.Direction=ln,d.Director=pa,d.DirectorEvents=ga,d.DisplayMode=fi,d.DynamicTree=Ks,d.DynamicTreeCollisionProcessor=Li,d.EX_VERSION=er,d.EaseBy=bo,d.EaseTo=xo,d.EasingFunctions=It,d.Edge=vs,d.EdgeCollider=Ct,d.ElasticToActorStrategy=Zo,d.EmitterType=Ae,d.Engine=os,d.EngineEvents=Wl,d.EnterTriggerEvent=qs,d.EnterViewPortEvent=Vs,d.Entity=Tt,d.EntityEvents=Eh,d.EntityManager=Sr,d.EventEmitter=X,d.EventTypes=Ss,d.Events=yh,d.ExResponse=kn,d.ExcaliburGraphicsContext2DCanvas=Xi,d.ExcaliburGraphicsContextWebGL=Xt,d.ExitTriggerEvent=Xs,d.ExitViewPortEvent=Gs,d.Fade=Co,d.FadeInOut=cc,d.Flags=De,d.Flash=Po,d.Follow=An,d.Font=Ce,d.FontCache=Gi,d.FontSource=hc,d.FontStyle=hn,d.FontUnit=rn,d.FpsSampler=ua,d.FrameStats=bi,d.Future=wt,d.GameEvent=L,d.GameStartEvent=As,d.GameStopEvent=Es,d.Gamepad=is,d.GamepadAxisEvent=zs,d.GamepadButtonEvent=Us,d.GamepadConnectEvent=Ls,d.GamepadDisconnectEvent=ks,d.Gamepads=es,d.GarbageCollector=wa,d.Gif=oc,d.GifParser=ya,d.GlobalCoordinates=Be,d.GpuParticleEmitter=ql,d.GpuParticleRenderer=as,d.Graph=ms,d.Graphic=it,d.GraphicsComponent=j,d.GraphicsGroup=Ne,d.GraphicsSystem=fn,d.HashColliderProxy=Ro,d.HashGridCell=Yt,d.HashGridProxy=In,d.HiddenEvent=Hs,d.HorizontalFirst=en,d.ImageFiltering=mt,d.ImageSource=Gt,d.ImageSourceAttributeConstants=O,d.ImageWrapping=_t,d.InitializeEvent=ze,d.InputHost=Yn,d.InputMapper=ia,d.IsometricEntityComponent=mi,d.IsometricEntitySystem=Wn,d.IsometricMap=Bl,d.IsometricTile=qo,d.KeyEvent=vi,d.Keyboard=aa,d.Keys=oa,d.KillEvent=Ai,d.Label=Gl,d.LimitCameraBoundsStrategy=Jo,d.Line=_n,d.LineSegment=J,d.Loader=Ji,d.LoaderEvents=Il,d.LockCameraToActorAxisStrategy=jo,d.LockCameraToActorStrategy=$o,d.LogLevel=Le,d.Logger=R,d.Material=Kr,d.Matrix=yt,d.MatrixLocations=cr,d.MediaEvent=Un,d.Meet=$i,d.MotionComponent=H,d.MotionSystem=ji,d.MoveBy=Tn,d.MoveByWithOptions=ro,d.MoveTo=Pn,d.MoveToWithOptions=ao,d.NativePointerButton=Pe,d.NativeSoundEvent=Te,d.NativeSoundProcessedEvent=ko,d.NineSlice=mn,d.NineSliceStretch=zr,d.Node=Si,d.None=sn,d.Observable=gt,d.OffscreenSystem=gn,d.Pair=pt,d.ParallaxComponent=Wi,d.ParallelActions=Xl,d.Particle=Yi,d.ParticleEmitter=Vl,d.ParticleRenderer=jr,d.ParticleTransform=Vt,d.PhysicsStats=ns,d.PhysicsWorld=Do,d.PointerAbstraction=Xn,d.PointerButton=le,d.PointerComponent=ae,d.PointerEvent=wi,d.PointerEventReceiver=ss,d.PointerScope=Fe,d.PointerSystem=ts,d.PointerType=ce,d.Polygon=pn,d.PolygonCollider=lt,d.Pool=Ui,d.PositionNode=_r,d.PostCollisionEvent=ve,d.PostDebugDrawEvent=Ds,d.PostDrawEvent=Ue,d.PostFrameEvent=Bs,d.PostKillEvent=Ps,d.PostTransformDrawEvent=Rs,d.PostUpdateEvent=re,d.PreCollisionEvent=me,d.PreDebugDrawEvent=Ms,d.PreDrawEvent=ke,d.PreFrameEvent=Fs,d.PreKillEvent=Ts,d.PreLoadEvent=Ol,d.PreTransformDrawEvent=Is,d.PreUpdateEvent=ne,d.Projection=Ke,d.QuadIndexBuffer=di,d.QuadTree=Ze,d.Query=Bt,d.QueryManager=Tr,d.RadiusAroundActorStrategy=Qo,d.Random=ie,d.Raster=We,d.Ray=fe,d.RealisticSolver=Fn,d.Rectangle=ci,d.RemoveEvent=Zs,d.RemovedComponent=Ph,d.RentalPool=Ve,d.Repeat=io,d.RepeatForever=so,d.Resolution=Bn,d.Resource=ai,d.ResourceEvents=Hh,d.RotateBy=uo,d.RotateByWithOptions=co,d.RotateTo=lo,d.RotateToWithOptions=ho,d.RotationType=Z,d.ScaleBy=vo,d.ScaleByWithOptions=mo,d.ScaleTo=go,d.ScaleToWithOptions=fo,d.Scene=Rt,d.SceneEvents=Hl,d.Screen=Ln,d.ScreenAppender=mr,d.ScreenElement=Hn,d.ScreenEvents=Sl,d.ScreenShader=Zr,d.ScrollPreventionMode=Qe,d.Semaphore=mc,d.SeparatingAxis=He,d.SeparationInfo=Mr,d.Shader=zt,d.Shape=ut,d.Slide=uc,d.SolverStrategy=ki,d.Sound=zn,d.SoundEvents=Al,d.SoundManager=rc,d.SparseHashGrid=Rn,d.SparseHashGridCollisionProcessor=Mn,d.SpatialPartitionStrategy=oi,d.Sprite=kt,d.SpriteFont=Oi,d.SpriteSheet=be,d.StandardClock=Zn,d.StateMachine=Qi,d.StrategyContainer=Xo,d.Stream=ba,d.System=At,d.SystemManager=Ar,d.SystemPriority=Nt,d.SystemType=Pt,d.TagQuery=Qs,d.TestClock=_a,d.Text=ui,d.TextAlign=on,d.TextureLoader=qe,d.Tile=Vo,d.TileMap=Go,d.TileMapEvents=Fl,d.TiledAnimation=vn,d.TiledSprite=li,d.Timer=Ki,d.Toaster=fa,d.Transform=Qt,d.TransformComponent=A,d.Transition=ls,d.TreeNode=Js,d.Trigger=ta,d.TriggerEvents=kl,d.TwoPI=et,d.UniformBuffer=Nr,d.Util=_c,d.Vector=v,d.VectorView=gs,d.VertexBuffer=qt,d.VertexLayout=Kt,d.VerticalFirst=tn,d.VisibleEvent=Os,d.WebAudio=Bo,d.WebAudioInstance=Lo,d.WheelDeltaMode=xi,d.WheelEvent=ha,d.World=Er,d.approximatelyEqual=ar,d.assert=Jn,d.canonicalizeAngle=Zt,d.clamp=F,d.coroutine=Ta,d.createId=_e,d.easeInBack=fh,d.easeInBounce=gr,d.easeInCirc=dh,d.easeInCubic=th,d.easeInElastic=mh,d.easeInExpo=hh,d.easeInOutBack=ph,d.easeInOutBounce=xh,d.easeInOutCirc=_h,d.easeInOutCubic=xs,d.easeInOutElastic=wh,d.easeInOutExpo=ch,d.easeInOutQuad=Ka,d.easeInOutQuart=nh,d.easeInOutQuint=ah,d.easeInOutSine=Za,d.easeInQuad=Qa,d.easeInQuart=ih,d.easeInQuint=rh,d.easeInSine=$a,d.easeOutBack=gh,d.easeOutBounce=bs,d.easeOutCirc=uh,d.easeOutCubic=eh,d.easeOutElastic=vh,d.easeOutExpo=lh,d.easeOutQuad=Ja,d.easeOutQuart=sh,d.easeOutQuint=oh,d.easeOutSine=ja,d.frac=Na,d.getDefaultPhysicsConfig=Jt,d.glTypeToUniformTypeName=Xr,d.hasGraphicsTick=Sn,d.hasOnAdd=ec,d.hasOnInitialize=Zl,d.hasOnPostUpdate=tc,d.hasOnPreUpdate=Jl,d.hasOnRemove=ic,d.hasPostDraw=nc,d.hasPreDraw=sc,d.has_add=$l,d.has_initialize=Yl,d.has_postupdate=Kl,d.has_preupdate=Ql,d.has_remove=jl,d.inverseLerp=dr,d.inverseLerpVector=ur,d.isActor=yl,d.isAddedComponent=Th,d.isComponentCtor=vr,d.isLegacyEasing=Se,d.isLoaderConstructor=On,d.isMoveByOptions=no,d.isMoveToOptions=oo,d.isRemovedComponent=Ah,d.isRotateByOptions=bl,d.isRotateToOptions=xl,d.isScaleByOptions=po,d.isScaleToOptions=_o,d.isSceneConstructor=$t,d.isScreenElement=Ho,d.isSystemConstructor=Pr,d.lerp=ot,d.lerpAngle=ps,d.lerpVector=ti,d.linear=Ti,d.maxMessages=Pa,d.nextActionId=N,d.obsolete=gc,d.parseImageFiltering=Ge,d.parseImageWrapping=Ut,d.pixelSnapEpsilon=B,d.randomInRange=Ot,d.randomIntInRange=Va,d.range=Ga,d.remap=Ht,d.remapVector=qa,d.resetObsoleteCounter=fc,d.sign=V,d.smootherstep=Ya,d.smoothstep=Xa,d.toDegrees=hr,d.toRadians=Wa,d.vec=x,d.webgl=Yh,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1566+bfb6759 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1568+800f627 - 2025-11-25
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -817,4 +817,4 @@ If in Firefox, visit about:config
817
817
 
818
818
  Read more about this issue at https://excaliburjs.com/docs/performance`),i&&this._toaster.toast("Excalibur is encountering performance issues. It's possible that your browser doesn't have hardware acceleration enabled. Visit [LINK] for more information and potential solutions.","https://excaliburjs.com/docs/performance"),this.useCanvas2DFallback(),this.emit("fallbackgraphicscontext",this.graphicsContext))}}useCanvas2DFallback(){var t,e,i;const s=this.canvas.cloneNode(!1);this.canvas.parentNode.replaceChild(s,this.canvas),this.canvas=s;const n={...this._originalOptions,antialiasing:this.screen.antialiasing},o=this._originalDisplayMode;this.graphicsContext=new Xi({canvasElement:this.canvas,enableTransparency:this.enableCanvasTransparency,antialiasing:n.antialiasing,backgroundColor:n.backgroundColor,snapToPixel:n.snapToPixel,useDrawSorting:n.useDrawSorting}),this.screen&&this.screen.dispose(),this.screen=new Ln({canvas:this.canvas,context:this.graphicsContext,antialiasing:(t=n.antialiasing)!=null?t:!0,browser:this.browser,viewport:(e=n.viewport)!=null?e:n.width&&n.height?{width:n.width,height:n.height}:Bn.SVGA,resolution:n.resolution,displayMode:o,pixelRatio:n.suppressHiDPIScaling?1:(i=n.pixelRatio)!=null?i:null}),this.screen.setCurrentCamera(this.currentScene.camera),this.input.pointers.detach();const a=n&&n.pointerScope===Fe.Document?document:this.canvas;this.input.pointers=this.input.pointers.recreate(a,this),this.input.pointers.init()}dispose(){this._disposed||(this._disposed=!0,this.stop(),this._garbageCollector.forceCollectAll(),this.input.toggleEnabled(!1),this._hasCreatedCanvas&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null,this.screen.dispose(),this.graphicsContext.dispose(),this.graphicsContext=null,ue.InstanceCount--)}isDisposed(){return this._disposed}getWorldBounds(){return this.screen.getWorldBounds()}get timescale(){return this._timescale}set timescale(t){if(t<0){R.getInstance().warnOnce("engine.timescale to a value less than 0 are ignored");return}this._timescale=t}addTimer(t){return this.currentScene.addTimer(t)}removeTimer(t){return this.currentScene.removeTimer(t)}addScene(t,e){return this.director.add(t,e),this}removeScene(t){this.director.remove(t)}add(t){if(arguments.length===2){this.director.add(arguments[0],arguments[1]);return}const e=this.director.getDeferredScene();e instanceof Rt?e.add(t):this.currentScene.add(t)}remove(t){t instanceof Tt&&this.currentScene.remove(t),(t instanceof Rt||$t(t))&&this.removeScene(t),typeof t=="string"&&this.removeScene(t)}async goToScene(t,e){await this.scope(async()=>{await this.director.goToScene(t,e)})}screenToWorldCoordinates(t){return this.screen.screenToWorldCoordinates(t)}worldToScreenCoordinates(t){return this.screen.worldToScreenCoordinates(t)}_initialize(t){var e,i;this.pageScrollPreventionMode=t.scrollPreventionMode;const s=t&&t.pointerScope===Fe.Document?document:this.canvas,n=(i=(e=this._originalOptions)==null?void 0:e.grabWindowFocus)!=null?i:!0;this.input=new Yn({global:this.global,pointerTarget:s,grabWindowFocus:n,engine:this}),this.inputMapper=this.input.inputMapper,this.browser.document.on("visibilitychange",()=>{document.visibilityState==="hidden"?(this.events.emit("hidden",new Hs(this)),this._logger.debug("Window hidden")):document.visibilityState==="visible"&&(this.events.emit("visible",new Os(this)),this._logger.debug("Window visible"))}),!this.canvasElementId&&!t.canvasElement&&document.body.appendChild(this.canvas)}toggleInputEnabled(t){this._inputEnabled=t,this.input.toggleEnabled(this._inputEnabled)}onInitialize(t){}get isInitialized(){return this._isInitialized}async _overrideInitialize(t){this.isInitialized||(await this.director.onInitialize(),await this.onInitialize(t),this.events.emit("initialize",new ze(t,this)),this._isInitialized=!0)}_update(t){var e;if(this._isLoading){(e=this._loader)==null||e.onUpdate(this,t),this.input.update();return}this.clock.__runScheduledCbs("preupdate"),this._preupdate(t),this.currentScene.update(this,t),this.graphicsContext.updatePostProcessors(t),this.clock.__runScheduledCbs("postupdate"),this._postupdate(t),this.input.update()}_preupdate(t){this.emit("preupdate",new ne(this,t,this)),this.onPreUpdate(this,t)}onPreUpdate(t,e){}_postupdate(t){this.emit("postupdate",new re(this,t,this)),this.onPostUpdate(this,t)}onPostUpdate(t,e){}_draw(t){var e,i;if(this.graphicsContext.backgroundColor=(e=this.currentScene.backgroundColor)!=null?e:this.backgroundColor,this.graphicsContext.beginDrawLifecycle(),this.graphicsContext.clear(),this.clock.__runScheduledCbs("predraw"),this._predraw(this.graphicsContext,t),this._isLoading){this._hideLoader||((i=this._loader)==null||i.canvas.draw(this.graphicsContext,0,0),this.clock.__runScheduledCbs("postdraw"),this.graphicsContext.flush(),this.graphicsContext.endDrawLifecycle());return}this.currentScene.draw(this.graphicsContext,t),this.clock.__runScheduledCbs("postdraw"),this._postdraw(this.graphicsContext,t),this.graphicsContext.flush(),this.graphicsContext.endDrawLifecycle(),this._checkForScreenShots()}_predraw(t,e){this.emit("predraw",new ke(t,e,this)),this.onPreDraw(t,e)}onPreDraw(t,e){}_postdraw(t,e){this.emit("postdraw",new Ue(t,e,this)),this.onPostDraw(t,e)}onPostDraw(t,e){}showDebug(t){this._isDebug=t}toggleDebug(){return this._isDebug=!this._isDebug,this._isDebug}get loadingComplete(){return!this._isLoading}get ready(){return this._isReadyFuture.isCompleted}isReady(){return this._isReadyFuture.promise}async start(t,e){await this.scope(async()=>{if(!this._compatible)throw new Error("Excalibur is incompatible with your browser");this._isLoading=!0;let i;return t instanceof pi?i=t:typeof t=="string"&&(this.director.configureStart(t,e),i=this.director.mainLoader),this._logger.debug("Starting game clock..."),this.browser.resume(),this.clock.start(),this.garbageCollectorConfig&&this._garbageCollector.start(),this._logger.debug("Game clock started"),await this.load(i!=null?i:new Ji),await this._overrideInitialize(this),this._isReadyFuture.resolve(),this.emit("start",new As(this)),this._isReadyFuture.promise})}_mainloop(t){this.scope(()=>{this.emit("preframe",new Fs(this,this.stats.prevFrame));const e=t*this.timescale;this.currentFrameElapsedMs=e;const i=this.stats.prevFrame.id+1;this.stats.currFrame.reset(),this.stats.currFrame.id=i,this.stats.currFrame.elapsedMs=e,this.stats.currFrame.fps=this.clock.fpsSampler.fps,st.clear();const s=this.clock.now(),n=this.fixedUpdateTimestep;if(this.fixedUpdateTimestep)for(this._lagMs+=e;this._lagMs>=n;)this._update(n),this._lagMs-=n;else this._update(e);const o=this.clock.now();this.currentFrameLagMs=this._lagMs,this._draw(e);const a=this.clock.now();this.stats.currFrame.duration.update=o-s,this.stats.currFrame.duration.draw=a-o,this.stats.currFrame.graphics.drawnImages=st.DrawnImagesCount,this.stats.currFrame.graphics.drawCalls=st.DrawCallCount,this.emit("postframe",new Bs(this,this.stats.currFrame)),this.stats.prevFrame.reset(this.stats.currFrame),this._monitorPerformanceThresholdAndTriggerFallback()})}stop(){this.clock.isRunning()&&(this.emit("stop",new Es(this)),this.browser.pause(),this.clock.stop(),this._garbageCollector.stop(),this._logger.debug("Game stopped"))}isRunning(){return this.clock.isRunning()}screenshot(t=!1){return new Promise(i=>{this._screenShotRequests.push({preserveHiDPIResolution:t,resolve:i})})}_checkForScreenShots(){for(const t of this._screenShotRequests){const e=t.preserveHiDPIResolution?this.canvas.width:this.screen.resolution.width,i=t.preserveHiDPIResolution?this.canvas.height:this.screen.resolution.height,s=document.createElement("canvas");s.width=e,s.height=i;const n=s.getContext("2d");n.imageSmoothingEnabled=this.screen.antialiasing,n.drawImage(this.canvas,0,0,e,i);const o=new Image,a=s.toDataURL("image/png");o.onload=()=>{t.resolve(o)},o.src=a}this._screenShotRequests.length=0}async load(t,e=!1){await this.scope(async()=>{try{if(t.isLoaded())return;this._loader=t,this._isLoading=!0,this._hideLoader=e,t instanceof Ji&&(t.suppressPlayButton=t.suppressPlayButton||this._suppressPlayButton),this._loader.onInitialize(this),await t.load()}catch(i){this._logger.error("Error loading resources, things may not behave properly",i),await Promise.resolve()}finally{this._isLoading=!1,this._hideLoader=!1,this._loader=null}})}};rs.Context=ma(),rs.InstanceCount=0,rs._DEFAULT_ENGINE_OPTIONS={width:0,height:0,enableCanvasTransparency:!0,useDrawSorting:!0,configurePerformanceCanvas2DFallback:{allow:!1,showPlayerMessage:!1,threshold:{fps:20,numberOfFrames:100}},canvasElementId:"",canvasElement:void 0,enableCanvasContextMenu:!1,snapToPixel:!1,antialiasing:!0,pixelArt:!1,garbageCollection:!0,powerPreference:"high-performance",pointerScope:Fe.Canvas,suppressConsoleBootMessage:null,suppressMinimumBrowserFeatureDetection:null,suppressHiDPIScaling:null,suppressPlayButton:null,grabWindowFocus:!0,scrollPreventionMode:1,backgroundColor:P.fromHex("#2185d0")};let os=rs;class Gl extends Ft{constructor(t){super(t),this._font=new Ce,this._text=new ui({text:"",font:this._font});const{text:e,pos:i,x:s,y:n,spriteFont:o,font:a,color:h,maxWidth:l}={text:"",...t};this.pos=i!=null?i:s&&n?x(s,n):this.pos,this.text=e!=null?e:this.text,this.font=a!=null?a:this.font,this.maxWidth=l!=null?l:this.maxWidth,this.spriteFont=o!=null?o:this.spriteFont,this._text.color=h!=null?h:this.color;const c=this.get(j);c.anchor=v.Zero,c.use(this._text)}set maxWidth(t){this._text.maxWidth=t}get maxWidth(){return this._text.maxWidth}get font(){return this._font}set font(t){this._font=t,this._text.font=t}get text(){return this._text.text}set text(t){this._text.text=t}get color(){return this._text.color}set color(t){this._text&&(this._text.color=t)}get opacity(){return this.graphics.opacity}set opacity(t){this.graphics.opacity=t}get spriteFont(){return this._spriteFont}set spriteFont(t){t&&(this._spriteFont=t,this._text.font=this._spriteFont)}_initialize(t){super._initialize(t)}getTextWidth(){return this._text.width}}var Ae=(r=>(r.Circle="circle",r.Rectangle="rectangle",r))(Ae||{});class Vl extends Ft{constructor(t){var e,i;super({width:(e=t.width)!=null?e:0,height:(i=t.height)!=null?i:0}),this._particlesToEmit=0,this._particlePool=new Ve(()=>new Yi({}),p=>p,500),this.numParticles=0,this.isEmitting=!0,this.deadParticles=[],this.emitRate=1,this.emitterType=Ae.Rectangle,this.radius=0,this.particle={life:2e3,transform:Vt.Global,graphic:void 0,opacity:1,angularVelocity:0,focus:void 0,focusAccel:void 0,randomRotation:!1},this._activeParticles=[];const{particle:s,x:n,y:o,z:a,pos:h,isEmitting:l,emitRate:c,emitterType:u,radius:_,random:f}={...t};this.particle={...this.particle,...s},this.pos=h!=null?h:x(n!=null?n:0,o!=null?o:0),this.z=a!=null?a:0,this.isEmitting=l!=null?l:this.isEmitting,this.emitRate=c!=null?c:this.emitRate,this.emitterType=u!=null?u:this.emitterType,this.radius=_!=null?_:this.radius,this.body.collisionType=M.PreventCollision,this.random=f!=null?f:new ie}removeParticle(t){this.deadParticles.push(t)}emitParticles(t){var e;if(!(t<=0)){t=t|0;for(let i=0;i<t;i++){const s=this._createParticle();(e=this==null?void 0:this.scene)!=null&&e.world&&(this.particle.transform===Vt.Global?this.scene.world.add(s):this.addChild(s)),this._activeParticles.push(s)}}}clearParticles(){for(let t=0;t<this._activeParticles.length;t++)this.removeParticle(this._activeParticles[t])}_createParticle(){let t=0,e=0;const i=Ot(this.particle.minAngle||0,this.particle.maxAngle||Math.PI*2,this.random),s=Ot(this.particle.minSpeed||0,this.particle.maxSpeed||0,this.random),n=this.particle.startSize||Ot(this.particle.minSize||5,this.particle.maxSize||5,this.random),o=s*Math.cos(i),a=s*Math.sin(i);if(this.emitterType===Ae.Rectangle)t=Ot(0,this.width,this.random),e=Ot(0,this.height,this.random);else if(this.emitterType===Ae.Circle){const l=Ot(0,this.radius,this.random);t=l*Math.cos(i),e=l*Math.sin(i)}const h=this._particlePool.rent();return h.unparent(),h.configure({transform:this.particle.transform,life:this.particle.life,opacity:this.particle.opacity,beginColor:this.particle.beginColor,endColor:this.particle.endColor,pos:x(t,e),z:this.particle.transform===Vt.Global?this.z:void 0,vel:x(o,a),acc:this.particle.acc,angularVelocity:this.particle.angularVelocity,startSize:this.particle.startSize,endSize:this.particle.endSize,size:n,graphic:this.particle.graphic,fade:this.particle.fade}),h.registerEmitter(this),this.particle.randomRotation&&(h.transform.rotation=Ot(0,Math.PI*2,this.random)),this.particle.focus&&(h.focus=this.particle.focus.add(x(this.pos.x,this.pos.y)),h.focusAccel=this.particle.focusAccel),h}update(t,e){var i;super.update(t,e),this.isEmitting&&(this._particlesToEmit+=this.emitRate*(e/1e3),this._particlesToEmit>1&&(this.emitParticles(Math.floor(this._particlesToEmit)),this._particlesToEmit=this._particlesToEmit-Math.floor(this._particlesToEmit)));for(let s=0;s<this.deadParticles.length;s++){(i=this==null?void 0:this.scene)!=null&&i.world&&(this.scene.world.remove(this.deadParticles[s],!1),this._particlePool.return(this.deadParticles[s]));const n=this._activeParticles.indexOf(this.deadParticles[s]);n>-1&&this._activeParticles.splice(n,1)}this.deadParticles.length=0}}function Jn(r,t){if(!t())throw new Error(r)}class as{constructor(t,e,i){this.emitRate=1,this._initialized=!1,this._vaos=[],this._buffers=[],this._drawIndex=0,this._numInputFloats=7,this._particleIndex=0,this._uploadIndex=0,this._wrappedLife=0,this._wrappedParticles=0,this._particleLife=0,this._clearRequested=!1,this._emitted=[];var s;this.emitter=t,this.particle=i,this._particleData=new Float32Array(this.emitter.maxParticles*this._numInputFloats),this._random=e,this._particleLife=(s=this.particle.life)!=null?s:2e3}get isInitialized(){return this._initialized}get maxParticles(){return this.emitter.maxParticles}initialize(t,e){if(this._initialized)return;const i=this.emitter.maxParticles,s=this._numInputFloats,n=this._particleData,o=4,a=t.createBuffer(),h=t.createVertexArray();t.bindVertexArray(h),t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,i*s*o,t.DYNAMIC_DRAW),t.bufferSubData(t.ARRAY_BUFFER,0,n);let l=0;t.vertexAttribPointer(0,2,t.FLOAT,!1,s*o,0),l+=o*2,t.vertexAttribPointer(1,2,t.FLOAT,!1,s*o,l),l+=o*2,t.vertexAttribPointer(2,1,t.FLOAT,!1,s*o,l),l+=o*1,t.vertexAttribPointer(3,1,t.FLOAT,!1,s*o,l),l+=o*1,t.vertexAttribPointer(4,1,t.FLOAT,!1,s*o,l),l+=o*1,t.enableVertexAttribArray(0),t.enableVertexAttribArray(1),t.enableVertexAttribArray(2),t.enableVertexAttribArray(3),t.enableVertexAttribArray(4),this._vaos.push(h),this._buffers.push(a),t.bindVertexArray(null),t.bindBuffer(t.ARRAY_BUFFER,null);const c=t.createBuffer(),u=t.createVertexArray();t.bindVertexArray(u),t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,i*s*o,t.DYNAMIC_DRAW),l=0,t.vertexAttribPointer(0,2,t.FLOAT,!1,s*o,0),l+=o*2,t.vertexAttribPointer(1,2,t.FLOAT,!1,s*o,l),l+=o*2,t.vertexAttribPointer(2,1,t.FLOAT,!1,s*o,l),l+=o*1,t.vertexAttribPointer(3,1,t.FLOAT,!1,s*o,l),l+=o*1,t.vertexAttribPointer(4,1,t.FLOAT,!1,s*o,l),l+=o*1,t.enableVertexAttribArray(0),t.enableVertexAttribArray(1),t.enableVertexAttribArray(2),t.enableVertexAttribArray(3),t.enableVertexAttribArray(4),this._vaos.push(u),this._buffers.push(c),t.bindVertexArray(null),t.bindBuffer(t.ARRAY_BUFFER,null),this._currentVao=this._vaos[this._drawIndex%2],this._currentBuffer=this._buffers[(this._drawIndex+1)%2],this._initialized=!0}clearParticles(){this._particleData.fill(0),this._clearRequested=!0}emitParticles(t){const e=this._particleIndex,i=this.maxParticles*this._numInputFloats,s=t*this._numInputFloats+e;for(let n=e;n<s;n+=this._numInputFloats){let o=this._random.floating(this.particle.minAngle||0,this.particle.maxAngle||et);o+=this.particle.transform===Vt.Local?this.emitter.transform.rotation:this.emitter.transform.globalRotation;const a=this._random.floating(this.particle.minSpeed||0,this.particle.maxSpeed||0),h=this._random.floating(this.particle.minSpeed||0,this.particle.maxSpeed||0),l=a*Math.cos(o),c=h*Math.sin(o);let u=0,_=0;if(this.emitter.emitterType===Ae.Rectangle)u=this._random.floating(-.5,.5)*this.emitter.width,_=this._random.floating(-.5,.5)*this.emitter.height;else{const g=this._random.floating(0,this.emitter.radius);u=g*Math.cos(o),_=g*Math.sin(o)}const f=this.emitter.transform.apply(x(u,_)),p=[this.particle.transform===Vt.Local?u:f.x,this.particle.transform===Vt.Local?_:f.y,l,c,this.particle.randomRotation?Ot(0,et,this._random):this.particle.rotation||0,this.particle.angularVelocity||0,this._particleLife];this._particleData.set(p,n%this._particleData.length)}s>=i?(this._wrappedParticles+=(s-i)/this._numInputFloats,this._wrappedLife=this._particleLife):this._wrappedLife>0&&(this._wrappedParticles+=t),this._particleIndex=s%i,this._emitted.push([this._particleLife,e])}_uploadEmitted(t){this._particleIndex!==this._uploadIndex&&(t.bindBuffer(t.ARRAY_BUFFER,this._buffers[(this._drawIndex+1)%2]),this._particleIndex>=this._uploadIndex?t.bufferSubData(t.ARRAY_BUFFER,this._uploadIndex*4,this._particleData,this._uploadIndex,this._particleIndex-this._uploadIndex):(t.bufferSubData(t.ARRAY_BUFFER,this._uploadIndex*4,this._particleData,this._uploadIndex,this._particleData.length-this._uploadIndex),this._wrappedParticles&&t.bufferSubData(t.ARRAY_BUFFER,0,this._particleData,0,this._wrappedParticles*this._numInputFloats),this._wrappedLife=this._particleLife),t.bindBuffer(t.ARRAY_BUFFER,null)),this._uploadIndex=this._particleIndex%(this.maxParticles*this._numInputFloats)}update(t){var e;if(this._particleLife=(e=this.particle.life)!=null?e:this._particleLife,this._wrappedLife>0?this._wrappedLife-=t:(this._wrappedLife=0,this._wrappedParticles=0),!!this._emitted.length){for(let i=this._emitted.length-1;i>=0;i--){const s=this._emitted[i];s[0]-=t,s[0]<=0&&this._emitted.splice(i,1)}this._emitted.sort((i,s)=>i[0]-s[0])}}draw(t){if(this._initialized){if(this._clearRequested?(t.bindBuffer(t.ARRAY_BUFFER,this._buffers[(this._drawIndex+1)%2]),t.bufferSubData(t.ARRAY_BUFFER,0,this._particleData),t.bindBuffer(t.ARRAY_BUFFER,null),this._clearRequested=!1):this._uploadEmitted(t),t.bindVertexArray(this._currentVao),t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,0,this._currentBuffer),this._wrappedLife&&this._emitted[0]&&this._emitted[0][1]>0){const e=this._emitted[0][1]/this._numInputFloats;Jn(`midpoint greater than 0, actual: ${e}`,()=>e>0),Jn(`midpoint is less than max, actual: ${e}`,()=>e<this.maxParticles),t.bindBufferRange(t.TRANSFORM_FEEDBACK_BUFFER,0,this._currentBuffer,this._emitted[0][1]*4,(this.maxParticles-e)*this._numInputFloats*4),t.beginTransformFeedback(t.POINTS),t.drawArrays(t.POINTS,e,this.maxParticles-e),t.endTransformFeedback(),t.bindBufferRange(t.TRANSFORM_FEEDBACK_BUFFER,0,this._currentBuffer,0,this._emitted[0][1]*4),t.beginTransformFeedback(t.POINTS),t.drawArrays(t.POINTS,0,e),t.endTransformFeedback()}else t.bindBufferRange(t.TRANSFORM_FEEDBACK_BUFFER,0,this._currentBuffer,0,this._particleData.length*4),t.beginTransformFeedback(t.POINTS),t.drawArrays(t.POINTS,0,this.maxParticles),t.endTransformFeedback();t.bindVertexArray(null),t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,0,null),this._currentVao=this._vaos[this._drawIndex%2],this._currentBuffer=this._buffers[(this._drawIndex+1)%2],this._drawIndex=(this._drawIndex+1)%2}}}as.GPU_MAX_PARTICLES=1e5;class ql extends Ft{constructor(t){super({name:"GpuParticleEmitter",width:t.width,height:t.height}),this.particle={life:2e3,transform:Vt.Global,graphic:void 0,opacity:1,angularVelocity:0,focus:void 0,focusAccel:void 0,randomRotation:!1},this.graphics=new j,this.isEmitting=!1,this.emitRate=1,this.emitterType=Ae.Rectangle,this.radius=0,this.maxParticles=2e3,this._particlesToEmit=0,this.addComponent(this.graphics,!0),this.graphics.onPostDraw=this.draw.bind(this);const{particle:e,maxParticles:i,x:s,y:n,z:o,pos:a,isEmitting:h,emitRate:l,emitterType:c,radius:u,random:_}={...t};this.maxParticles=F(i!=null?i:this.maxParticles,0,as.GPU_MAX_PARTICLES),this.pos=a!=null?a:x(s!=null?s:0,n!=null?n:0),this.z=o!=null?o:0,this.isEmitting=h!=null?h:this.isEmitting,this.emitRate=l!=null?l:this.emitRate,this.emitterType=c!=null?c:this.emitterType,this.radius=u!=null?u:this.radius,this.particle={...this.particle,...e},this.random=_!=null?_:new ie,this.renderer=new as(this,this.random,this.particle)}get pos(){return this.transform.pos}set pos(t){this.transform.pos=t}get z(){return this.transform.z}set z(t){this.transform.z=t}_initialize(t){super._initialize(t);const e=t.graphicsContext;this.renderer.initialize(e.__gl,e)}update(t,e){super.update(t,e),this.isEmitting&&(this._particlesToEmit+=this.emitRate*(e/1e3),this._particlesToEmit>1&&(this.emitParticles(Math.floor(this._particlesToEmit)),this._particlesToEmit=this._particlesToEmit-Math.floor(this._particlesToEmit))),this.renderer.update(e)}emitParticles(t){t<=0||this.renderer.emitParticles(t|0)}clearParticles(){this.renderer.clearParticles()}draw(t,e){t.draw("ex.particle",this.renderer,e)}}class Kn{constructor(t,e){this.id=N(),this._stopped=!1,this._sequenceBuilder=e,this._sequenceContext=new _i(t),this._actionQueue=this._sequenceContext.getQueue(),this._sequenceBuilder(this._sequenceContext)}update(t){this._actionQueue.update(t)}isComplete(){return this._stopped||this._actionQueue.isComplete()}stop(){this._stopped=!0}reset(){this._stopped=!1,this._actionQueue.reset()}clone(t){return new Kn(t,this._sequenceBuilder)}}class Xl{constructor(t){this.id=N(),this._actions=t}update(t){for(let e=0;e<this._actions.length;e++)this._actions[e].update(t)}isComplete(t){return this._actions.every(e=>e.isComplete(t))}reset(){this._actions.forEach(t=>t.reset())}stop(){this._actions.forEach(t=>t.stop())}}function Yl(r){return!!r._initialize}function $l(r){return!!r.onAdd}function jl(r){return!!r.onRemove}function Zl(r){return!!r.onInitialize}function Ql(r){return!!r._preupdate}function Jl(r){return!!r.onPreUpdate}function Kl(r){return!!r.onPostUpdate}function tc(r){return!!r.onPostUpdate}function ec(r){return!!r.onAdd}function ic(r){return!!r.onRemove}function sc(r){return!!r.onPreDraw}function nc(r){return!!r.onPostDraw}class xa{constructor(t,e){this.soundManager=e}stop(t){if(!t)return;const e=this.soundManager.getSoundsForChannel(t);for(let i=0;i<e.length;i++)e[i].stop()}setVolume(t,e){const i=this.soundManager.getSoundsForChannel(t);for(const s of i)this.soundManager._isMuted(s)||this.soundManager.setVolume(t,e)}play(t,e){e!=null||(e=this.soundManager.defaultVolume);const i=[],s=new Set,n=this.soundManager.getSoundsForChannel(t);for(const o of n){if(s.has(o)||this.soundManager._isMuted(o))continue;const a=this.soundManager._getEffectiveVolume(o);i.push(o.play(a*e)),s.add(o)}return Promise.all(i)}mute(t){const e=this.soundManager.getSoundsForChannel(t);for(let i=0;i<e.length;i++)this.soundManager._muted.add(e[i]),e[i].pause()}unmute(t){const e=this.soundManager.getSoundsForChannel(t);for(let i=0;i<e.length;i++)this.soundManager._muted.has(e[i])&&(e[i].play(),this.soundManager._muted.delete(e[i]))}toggle(t){const e=this.soundManager.getSoundsForChannel(t);for(let i=0;i<e.length;i++)this.soundManager._isMuted(e[i])?(e[i].play(),this.soundManager._muted.delete(e[i])):(this.soundManager._muted.add(e[i]),e[i].pause())}}class rc{constructor(t){this._channelToConfig=new Map,this._nameToConfig=new Map,this._mix=new Map,this._muted=new Set,this._all=new Set,this._defaultVolume=1;var e;if(this._defaultVolume=(e=t.volume)!=null?e:1,this.channel=new xa(t,this),t.sounds)for(const[i,s]of Object.entries(t.sounds))this.track(i,s)}set defaultVolume(t){this._defaultVolume=F(t,0,1)}get defaultVolume(){return this._defaultVolume}getSounds(){return Array.from(this._all)}getSoundsForChannel(t){const e=this._channelToConfig.get(t);return e?e.sounds:[]}_isMuted(t){return this._muted.has(t)}_getEffectiveVolume(t){var e;if(this._isMuted(t))return 0;let i=this._defaultVolume;return this._mix.has(t)&&(i*=(e=this._mix.get(t))!=null?e:this._defaultVolume),i}play(t,e=this._defaultVolume){const i=this._nameToConfig.get(t);if(!i)return Promise.resolve();const{sound:s}=i;if(this._isMuted(s))return Promise.resolve();const n=e*this._getEffectiveVolume(s);return s.play(n)}getSound(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;return i}setVolume(t,e=this._defaultVolume){const i=this._nameToConfig.get(t);if(!i)return;const{sound:s}=i;this._setMix(s,e)}getVolume(t){var e;const i=this.getSound(t);return i&&(e=this._mix.get(i))!=null?e:0}_setMix(t,e){this._mix.set(t,e),t.volume=e}track(t,e){let i,s,n;e instanceof zn?(i=e,s=this._defaultVolume,n=[]):{sound:i,volume:s,channels:n}=e,this._nameToConfig.set(t,{sound:i,volume:s,channels:n}),this._mix.set(i,s!=null?s:this._defaultVolume),this._all.add(i),n&&this.addChannel(t,n)}untrack(t){this._nameToConfig.delete(t);const e=this.getSound(t);e&&(this._mix.delete(e),this._all.delete(e))}stop(t){if(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;i.stop();return}this._all.forEach(e=>e.stop())}mute(t){if(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;this._muted.add(i),i.pause();return}this._muted=new Set(this._all),this._muted.forEach(e=>e.pause())}unmute(t){if(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;i.play(),this._muted.delete(i);return}this._muted.forEach(e=>e.play()),this._muted.clear()}toggle(t){if(t){const e=this._nameToConfig.get(t);if(!e)return;const{sound:i}=e;this._isMuted(i)?this.unmute(t):this.mute(t);return}this._muted.size>0?(this._muted.forEach(e=>e.play()),this._muted.clear()):(this._muted=new Set(this._all),this._muted.forEach(e=>e.pause()))}addChannel(t,e){const i=this.getSound(t);if(!i)return;const s=this._mix.get(i);this._mix.set(i,s!=null?s:this._defaultVolume),this._all.add(i);for(const n of e){let o=this._channelToConfig.get(n);o||(o={sounds:[i]}),o.sounds.indexOf(i)===-1&&o.sounds.push(i),this._channelToConfig.set(n,o)}}removeChannel(t,e){const i=this.getSound(t);if(i)for(const s of e){const n=this._channelToConfig.get(s);if(!n)return;const o=n.sounds.indexOf(i);o>=-1&&n.sounds.splice(o,1),this._channelToConfig.set(s,n)}}}class oc{constructor(t,e=!1){this.path=t,this.width=0,this.height=0,this._images=[],this.data=[],this._sprites=[],this._resource=new ai(t,"arraybuffer",e)}get bustCache(){return this._resource.bustCache}set bustCache(t){this._resource.bustCache=t}async load(){const t=await this._resource.load();this._stream=new ba(t),this._gif=new ya(this._stream);const e=this._gif.images.map(i=>new Gt(i.src,!1));return await Promise.all(e.map(i=>i.load())),this.data=this._images=e,this._sprites=this._images.map(i=>i.toSprite()),this.data}isLoaded(){return!!this.data}toSprite(t=0){var e;return(e=this._sprites[t])!=null?e:null}toSpriteSheet(){const t=this._sprites;return t.length?new be({sprites:t}):null}toAnimation(t){var e;const i=(e=this._gif)==null?void 0:e.images;if(i!=null&&i.length){const s=i.map((n,o)=>{var a;return{graphic:this._sprites[o],duration:((a=this._gif)==null?void 0:a.frames[o].delayMs)||void 0}});return this._animation=new zi({frames:s,frameDuration:t}),this._animation}return null}get readCheckBytes(){var t,e;return(e=(t=this._gif)==null?void 0:t.checkBytes)!=null?e:[]}}const hs=r=>r.reduce(function(t,e){return t*2+e},0),tr=r=>{const t=[];for(let e=7;e>=0;e--)t.push(!!(r&1<<e));return t};class ba{constructor(t){if(this.len=0,this.position=0,this.readByte=()=>{if(this.position>=this.data.byteLength)throw new Error("Attempted to read past end of stream.");return this.data[this.position++]},this.readBytes=e=>{const i=[];for(let s=0;s<e;s++)i.push(this.readByte());return i},this.read=e=>{let i="";for(let s=0;s<e;s++)i+=String.fromCharCode(this.readByte());return i},this.readUnsigned=()=>{const e=this.readBytes(2);return(e[1]<<8)+e[0]},this.data=new Uint8Array(t),this.len=this.data.byteLength,this.len===0)throw new Error("No data loaded from file")}}const ac=function(r,t){let e=0;const i=function(_){let f=0;for(let p=0;p<_;p++)t.charCodeAt(e>>3)&1<<(e&7)&&(f|=1<<p),e++;return f},s=[],n=1<<r,o=n+1;let a=r+1,h=[];const l=function(){h=[],a=r+1;for(let _=0;_<n;_++)h[_]=[_];h[n]=[],h[o]=null};let c=0,u=0;for(;;){if(u=c,c=i(a),c===n){l();continue}if(c===o)break;if(c<h.length)u!==n&&h.push(h[u].concat(h[c][0]));else{if(c!==h.length)throw new Error("Invalid LZW code.");h.push(h[u].concat(h[u][0]))}s.push.apply(s,h[c]),h.length===1<<a&&a<12&&a++}return s};class ya{constructor(t){this._handler={},this.frames=[],this.images=[],this.globalColorTableBytes=[],this.checkBytes=[],this.parseColorTableBytes=e=>{const i=[];for(let s=0;s<e;s++){const n=this._st.readBytes(3);i.push(n)}return i},this.readSubBlocks=()=>{let e,i;i="";do e=this._st.readByte(),i+=this._st.read(e);while(e!==0);return i},this.parseHeader=()=>{const e={sig:"",ver:"",width:0,height:0,colorResolution:0,globalColorTableSize:0,gctFlag:!1,sortedFlag:!1,globalColorTable:[],backgroundColorIndex:0,pixelAspectRatio:0};if(e.sig=this._st.read(3),e.ver=this._st.read(3),e.sig!=="GIF")throw new Error("Not a GIF file.");e.width=this._st.readUnsigned(),e.height=this._st.readUnsigned(),this._currentFrameCanvas.width=e.width,this._currentFrameCanvas.height=e.height;const i=tr(this._st.readByte());e.gctFlag=i.shift(),e.colorResolution=hs(i.splice(0,3)),e.sortedFlag=i.shift(),e.globalColorTableSize=hs(i.splice(0,3)),e.backgroundColorIndex=this._st.readByte(),e.pixelAspectRatio=this._st.readByte(),e.gctFlag&&(this.globalColorTableBytes=this.parseColorTableBytes(1<<e.globalColorTableSize+1)),this._handler.hdr&&this._handler.hdr(e)&&this.checkBytes.push(this._handler.hdr)},this.parseExt=e=>{const i=h=>{this.checkBytes.push(this._st.readByte());const l=tr(this._st.readByte());return h.reserved=l.splice(0,3),h.disposalMethod=hs(l.splice(0,3)),h.userInputFlag=l.shift(),h.transparentColorFlag=l.shift(),h.delayTime=this._st.readUnsigned(),h.transparentColorIndex=this._st.readByte(),h.terminator=this._st.readByte(),this._handler.gce&&this._handler.gce(h)&&this.checkBytes.push(this._handler.gce),h},s=h=>{h.comment=this.readSubBlocks(),this._handler.com&&this._handler.com(h)&&this.checkBytes.push(this._handler.com)},n=h=>{this.checkBytes.push(this._st.readByte()),h.ptHeader=this._st.readBytes(12),h.ptData=this.readSubBlocks(),this._handler.pte&&this._handler.pte(h)&&this.checkBytes.push(this._handler.pte)},o=h=>{const l=u=>{this.checkBytes.push(this._st.readByte()),u.unknown=this._st.readByte(),u.iterations=this._st.readUnsigned(),u.terminator=this._st.readByte(),this._handler.app&&this._handler.app.NETSCAPE&&this._handler.app.NETSCAPE(u)&&this.checkBytes.push(this._handler.app)},c=u=>{u.appData=this.readSubBlocks(),this._handler.app&&this._handler.app[u.identifier]&&this._handler.app[u.identifier](u)&&this.checkBytes.push(this._handler.app[u.identifier])};switch(this.checkBytes.push(this._st.readByte()),h.identifier=this._st.read(8),h.authCode=this._st.read(3),h.identifier){case"NETSCAPE":l(h);break;default:c(h);break}},a=h=>{h.data=this.readSubBlocks(),this._handler.unknown&&this._handler.unknown(h)&&this.checkBytes.push(this._handler.unknown)};switch(e.label=this._st.readByte(),e.label){case 249:e.extType="gce",this._gce=i(e);break;case 254:e.extType="com",s(e);break;case 1:e.extType="pte",n(e);break;case 255:e.extType="app",o(e);break;default:e.extType="unknown",a(e);break}},this.parseImg=e=>{var i;const s=(a,h)=>{const l=new Array(a.length),c=a.length/h,u=(g,w)=>{const m=a.slice(w*h,(w+1)*h);l.splice.apply(l,[g*h,h].concat(m))},_=[0,4,2,1],f=[8,8,4,2];let p=0;for(let g=0;g<4;g++)for(let w=_[g];w<c;w+=f[g])u(w,p),p++;return l};e.leftPos=this._st.readUnsigned(),e.topPos=this._st.readUnsigned(),e.width=this._st.readUnsigned(),e.height=this._st.readUnsigned();const n=tr(this._st.readByte());e.lctFlag=n.shift(),e.interlaced=n.shift(),e.sorted=n.shift(),e.reserved=n.splice(0,2),e.lctSize=hs(n.splice(0,3)),e.lctFlag&&(e.lctBytes=this.parseColorTableBytes(1<<e.lctSize+1)),e.lzwMinCodeSize=this._st.readByte();const o=this.readSubBlocks();e.pixels=ac(e.lzwMinCodeSize,o),e.interlaced&&(e.pixels=s(e.pixels,e.width)),(i=this._gce)!=null&&i.delayTime&&(e.delayMs=this._gce.delayTime*10),this.frames.push(e),this.arrayToImage(e,e.lctFlag?e.lctBytes:this.globalColorTableBytes),this._handler.img&&this._handler.img(e)&&this.checkBytes.push(this._handler)},this.parseBlocks=()=>{const e={sentinel:this._st.readByte(),type:""};switch(String.fromCharCode(e.sentinel)){case"!":e.type="ext",this.parseExt(e);break;case",":e.type="img",this.parseImg(e);break;case";":e.type="eof",this._handler.eof&&this._handler.eof(e)&&this.checkBytes.push(this._handler.eof);break;default:throw new Error("Unknown block: 0x"+e.sentinel.toString(16))}e.type!=="eof"&&this.parseBlocks()},this.arrayToImage=(e,i)=>{var s,n,o,a;const h=document.createElement("canvas");h.width=e.width,h.height=e.height;const l=h.getContext("2d"),c=l.getImageData(0,0,h.width,h.height);let u=-1;(s=this._gce)!=null&&s.transparentColorFlag&&(u=this._gce.transparentColorIndex);for(let f=0;f<e.pixels.length;f++){const p=e.pixels[f],g=i[p];p===u?c.data.set([0,0,0,0],f*4):c.data.set([...g,255],f*4)}if(l.putImageData(c,0,0),((n=this._gce)==null?void 0:n.disposalMethod)===1&&this.images.length)this._currentFrameContext.drawImage(this.images[this.images.length-1],0,0);else if(((o=this._gce)==null?void 0:o.disposalMethod)===2&&((a=this._hdr)!=null&&a.gctFlag)){const f=i[this._hdr.backgroundColorIndex];this._currentFrameContext.fillStyle=`rgb(${f[0]}, ${f[1]}, ${f[2]})`,this._currentFrameContext.fillRect(0,0,this._hdr.width,this._hdr.height)}else this._currentFrameContext.clearRect(0,0,this._currentFrameCanvas.width,this._currentFrameCanvas.height);this._currentFrameContext.drawImage(h,e.leftPos,e.topPos,e.width,e.height);const _=new Image;_.src=this._currentFrameCanvas.toDataURL(),this.images.push(_)},this._st=t,this._handler={},this._currentFrameCanvas=document.createElement("canvas"),this._currentFrameContext=this._currentFrameCanvas.getContext("2d"),this.parseHeader(),this.parseBlocks()}}class hc{constructor(t,e,{bustCache:i,...s}={}){this.path=t,this.family=e,this._isLoaded=!1,this._resource=new ai(t,"blob",i),this._options=s}async load(){if(this.isLoaded())return this.data;try{const t=await this._resource.load(),e=URL.createObjectURL(t);this.data||(this.data=new FontFace(this.family,`url(${e})`),document.fonts.add(this.data)),await this.data.load(),this._isLoaded=!0}catch(t){throw`Error loading FontSource from path '${this.path}' with error [${t.message}]`}return this.data}isLoaded(){return this._isLoaded}toFont(t){return new Ce({family:this.family,...this._options,...t})}}const Ca=ma(),lc=/^\s*(?:function)?\*/;function Sa(r){return typeof r!="function"?!1:lc.test(Function.prototype.toString.call(r))?!0:Object.getPrototypeOf?Object.getPrototypeOf(r)===Object.getPrototypeOf(new Function("return function * () {}")()):!1}function Ta(...r){var t;const e=R.getInstance();let i,s,n,o;Sa(r[0])&&(s=globalThis,i=r[0],n=r[1]),Sa(r[1])&&(s=r[0],i=r[1],n=r[2]),r[1]instanceof os&&(s=r[0],o=r[1],i=r[2],n=r[3]),r[0]instanceof os&&(s=globalThis,o=r[0],i=r[1],n=r[2]);const a=va(Ca),h=n==null?void 0:n.timing,l=a?!1:(t=n==null?void 0:n.autostart)!=null?t:!0;let c;try{c=o!=null?o:os.useEngine()}catch(T){throw Error(`Cannot run coroutine without engine parameter outside of an excalibur lifecycle method.
819
819
  Pass an engine parameter to ex.coroutine(engine, function * {...})`)}let u=!1,_=!1,f=!1;const p=i.bind(s),g=p();let w;const m=new Promise((T,C)=>{w=S=>{try{if(f){_=!0,T();return}const{done:I,value:y}=Ca.scope(!0,()=>g.next(S));if(I||f){_=!0,T();return}y instanceof Promise?y.then(()=>{c.clock.schedule(w,0,h)}):y===void 0||y===void 0?c.clock.schedule(w,0,h):c.clock.schedule(w,y||0,h)}catch(I){C(I);return}},l&&(u=!0,w(c.clock.elapsed()))}),b={isRunning:()=>u&&!f&&!_,isComplete:()=>_,cancel:()=>{f=!0},start:()=>(u?e.warn(`.start() was called on a coroutine that was already started, this is probably a bug:
820
- `,Function.prototype.toString.call(p)):(u=!0,w(c.clock.elapsed())),b),generator:g,done:m,then:m.then.bind(m),[Symbol.iterator]:()=>g};return b}class ls extends Tt{constructor(t){var e,i,s,n,o;super(),this._logger=R.getInstance(),this.transform=new A,this.graphics=new j,this._completeFuture=new wt,this.started=!1,this._currentDistance=0,this._currentProgress=0,this.done=this._completeFuture.promise,this._useLegacyEasing=!1,this.name=`Transition#${this.id}`,this.duration=t.duration,Se(t.easing)?(this.legacyEasing=(e=t.easing)!=null?e:It.Linear,this._useLegacyEasing=!0):this.easing=(i=t.easing)!=null?i:Ti,this.direction=(s=t.direction)!=null?s:"out",this.hideLoader=(n=t.hideLoader)!=null?n:!1,this.blockInput=(o=t.blockInput)!=null?o:!1,this.transform.coordPlane=rt.Screen,this.transform.pos=v.Zero,this.transform.z=1/0,this.graphics.anchor=v.Zero,this.addComponent(this.transform),this.addComponent(this.graphics),this.direction==="out"?this._currentProgress=0:this._currentProgress=1}get progress(){return this._currentProgress}get distance(){return this._currentDistance}get complete(){return this.direction==="out"?this.progress>=1:this.progress<=0}updateTransition(t,e){this.complete||(this._currentDistance+=F(e/this.duration,0,1),this._currentDistance>=1&&(this._currentDistance=1),this.direction==="out"?this._useLegacyEasing?this._currentProgress=F(this.legacyEasing(this._currentDistance,0,1,1),0,1):this._currentProgress=F(ot(0,1,this.easing(this._currentDistance)),0,1):this._useLegacyEasing?this._currentProgress=F(this.legacyEasing(this._currentDistance,1,0,1),0,1):this._currentProgress=F(ot(1,0,this.easing(this._currentDistance)),0,1))}async onPreviousSceneDeactivate(t){}onStart(t){}onUpdate(t){}onEnd(t){}onReset(){}reset(){this.started=!1,this._completeFuture=new wt,this.done=this._completeFuture.promise,this._currentDistance=0,this.direction==="out"?this._currentProgress=0:this._currentProgress=1,this.onReset()}_addToTargetScene(t,e){const i=e;if(this.started&&this._logger.warn(`Attempted to add a transition ${this.name} that is already playing.`),i.world.entityManager.getById(this.id))return this._co;this._engine=t,i.add(this);const s=this;return this._co=Ta(t,function*(){for(;!s.complete;){const n=yield;s.updateTransition(s._engine,n),s._execute()}},{autostart:!1}),this._co}async _play(){this.started&&(this.reset(),this._logger.warn(`Attempted to play a transition ${this.name} that is already playing, reset transition.`)),(!this._engine||!this._co)&&(this.reset(),this._logger.warn(`Attempted to play a transition ${this.name} that hasn't been added`)),this._co&&await this._co.start()}_execute(){this.isInitialized&&(this.started||(this.started=!0,this.onStart(this.progress)),this.onUpdate(this.progress),this.complete&&!this._completeFuture.isCompleted&&(this.onEnd(this.progress),this._completeFuture.resolve()))}}class cc extends ls{constructor(t){var e,i;super({...t,duration:(e=t.duration)!=null?e:2e3}),this.name=`FadeInOut#${this.id}`,this.color=(i=t.color)!=null?i:P.Black}onInitialize(t){this.transform.pos=t.screen.unsafeArea.topLeft,this.screenCover=new ci({width:t.screen.resolution.width,height:t.screen.resolution.height,color:this.color}),this.graphics.add(this.screenCover),this.graphics.opacity=this.progress}onReset(){this.graphics.opacity=this.progress}onStart(t){this.graphics.opacity=t}onEnd(t){this.graphics.opacity=t}onUpdate(t){this.graphics.opacity=t}}class dc extends ls{constructor(t){super({direction:"in",...t}),this.name=`CrossFade#${this.id}`}async onPreviousSceneDeactivate(t){this.image=await t.engine.screenshot(!0),await this.image.decode()}onInitialize(t){this.engine=t,this.transform.pos=t.screen.unsafeArea.topLeft,this.screenCover=Gt.fromHtmlImageElement(this.image).toSprite(),this.graphics.add(this.screenCover),this.transform.scale=x(1/t.screen.pixelRatio,1/t.screen.pixelRatio),this.graphics.opacity=this.progress}onStart(t){this.graphics.opacity=this.progress}onReset(){this.graphics.opacity=this.progress}onEnd(t){this.graphics.opacity=t}onUpdate(t){this.graphics.opacity=t}}class uc extends ls{constructor(t){var e;super({direction:"in",...t}),this._easing=It.Linear,this._start=v.Zero,this._end=v.Zero,this.name=`Slide#${this.id}`,this.slideDirection=t.slideDirection,this.transform.coordPlane=rt.Screen,this.graphics.forceOnScreen=!0,this._easing=(e=t.easingFunction)!=null?e:this._easing}async onPreviousSceneDeactivate(t){this._image=await t.engine.screenshot(!0),await this._image.decode(),this._screenCover=Gt.fromHtmlImageElement(this._image).toSprite()}onInitialize(t){this._engine=t;let e=t.screen.unsafeArea;switch(e.hasZeroDimensions()&&(e=t.screen.contentArea),this.slideDirection){case"up":{this._directionOffset=x(0,-e.height);break}case"down":{this._directionOffset=x(0,e.height);break}case"left":{this._directionOffset=x(-e.width,0);break}case"right":{this._directionOffset=x(e.width,0);break}}this._camera=this._engine.currentScene.camera,this._destinationCameraPosition=this._camera.pos.clone(),this._camera.pos=this._camera.pos.add(this._directionOffset),this.transform.pos=this.transform.pos.add(this._directionOffset),this._startCameraPosition=this._camera.pos.clone(),this._start=e.topLeft,this._end=this._start.add(this._directionOffset),this.transform.pos=this._start,this.graphics.use(this._screenCover),this.transform.scale=x(1/t.screen.pixelRatio,1/t.screen.pixelRatio)}onStart(t){const e=this._easing(this.distance,0,1,1);this.transform.pos.x=ot(this._start.x,this._end.x,e),this.transform.pos.y=ot(this._start.y,this._end.y,e),this._camera.pos.x=ot(this._startCameraPosition.x,this._destinationCameraPosition.x,e),this._camera.pos.y=ot(this._startCameraPosition.y,this._destinationCameraPosition.y,e)}onUpdate(t){const e=this._easing(this.distance,0,1,1);this.transform.pos.x=ot(this._start.x,this._end.x,e),this.transform.pos.y=ot(this._start.y,this._end.y,e),this._camera.pos.x=ot(this._startCameraPosition.x,this._destinationCameraPosition.x,e),this._camera.pos.y=ot(this._startCameraPosition.y,this._destinationCameraPosition.y,e)}}const _c=Object.freeze(Object.defineProperty({__proto__:null,ConsoleAppender:ys,DrawUtil:Uh,EasingFunctions:It,LogLevel:Le,Logger:R,Observable:gt,ScreenAppender:mr,addItemToArray:Ch,contains:xr,delay:Di,fail:br,getMinIndex:wr,getPosition:ni,isLegacyEasing:Se,isObject:Fi,mergeDeep:Bi,omit:yr,removeItemFromArray:Oe},Symbol.toStringTag,{value:"Module"})),Pa=5,Je={},fc=()=>{for(const r in Je)Je[r]=0},cs=(r,t)=>{const e=De.isEnabled("suppress-obsolete-message");Je[r]<Pa&&!e&&(R.getInstance().warn(r),console.trace&&t.showStackTrace&&console.trace()),Je[r]++};function gc(r){return r={message:"This feature will be removed in future versions of Excalibur.",alternateMethod:null,showStackTrace:!1,...r},function(t,e,i){if(i&&!(typeof i.value=="function"||typeof i.get=="function"||typeof i.set=="function"))throw new SyntaxError("Only classes/functions/getters/setters can be marked as obsolete");const n=`${`${t.name||""}${t.name&&e?".":""}${e||""}`} is marked obsolete: ${r.message}`+(r.alternateMethod?` Use ${r.alternateMethod} instead`:"");Je[n]||(Je[n]=0);const o=i?{...i}:t;if(!i){class a extends o{constructor(...l){cs(n,r),super(...l)}}return a}return i&&i.value?(o.value=function(){return cs(n,r),i.value.apply(this,arguments)},o):(i&&i.get&&(o.get=function(){return cs(n,r),i.get.apply(this,arguments)}),i&&i.set&&(o.set=function(){return cs(n,r),i.set.apply(this,arguments)}),o)}}class pc{constructor(){this._queue=[]}get length(){return this._queue.length}enqueue(){const t=new wt;return this._queue.push(t),t.promise}dequeue(t){this._queue.shift().resolve(t)}}class mc{constructor(t){this._count=t,this._waitQueue=new pc}get count(){return this._count}get waiting(){return this._waitQueue.length}async enter(){return this._count!==0?(this._count--,Promise.resolve()):this._waitQueue.enqueue()}exit(t=1){if(t!==0){for(;t!==0&&this._waitQueue.length!==0;)this._waitQueue.dequeue(null),t--;this._count+=t}}}const er="0.32.0-alpha.1566+bfb6759";Me(),d.ActionCompleteEvent=$s,d.ActionContext=_i,d.ActionQueue=eo,d.ActionSequence=Kn,d.ActionStartEvent=Ys,d.ActionsComponent=je,d.ActionsSystem=Vn,d.ActivateEvent=Ns,d.Actor=Ft,d.ActorEvents=Cl,d.AddEvent=js,d.AddedComponent=Sh,d.AffineMatrix=Q,d.Animation=zi,d.AnimationDirection=Br,d.AnimationEvents=Fh,d.AnimationStrategy=Lr,d.ArcadeSolver=Dn,d.AudioContextFactory=gi,d.Axes=ea,d.Axis=Yo,d.BaseAlign=an,d.BezierCurve=ei,d.Blink=yo,d.BodyComponent=W,d.BoundingBox=D,d.BrowserComponent=$n,d.BrowserEvents=da,d.Buttons=qn,d.Camera=Ko,d.CameraEvents=Ll,d.Canvas=qi,d.ChannelCollection=xa,d.Circle=Vi,d.CircleCollider=dt,d.Clock=jn,d.ClosestLineJumpTable=Wt,d.Collider=ri,d.ColliderComponent=tt,d.CollisionContact=we,d.CollisionEndEvent=si,d.CollisionGroup=pe,d.CollisionGroupManager=Pi,d.CollisionJumpTable=Lt,d.CollisionPostSolveEvent=Mi,d.CollisionPreSolveEvent=Ri,d.CollisionStartEvent=ii,d.CollisionSystem=Zi,d.CollisionType=M,d.Color=P,d.ColorBlindFlags=la,d.ColorBlindnessMode=Ye,d.ColorBlindnessPostProcessor=Qr,d.Component=Dt,d.CompositeCollider=at,d.ConsoleAppender=ys,d.ContactConstraintPoint=Mo,d.ContactEndEvent=Ii,d.ContactSolveBias=oe,d.ContactStartEvent=Ei,d.CoordPlane=rt,d.CrossFade=dc,d.CurveBy=Eo,d.CurveTo=Ao,d.DeactivateEvent=Ws,d.Debug=Cn,d.DebugConfig=ca,d.DebugGraphicsComponent=Ni,d.DebugSystem=Gn,d.DebugText=un,d.DefaultAntialiasOptions=Or,d.DefaultGarbageCollectionOptions=Qn,d.DefaultLoader=pi,d.DefaultPixelArtOptions=Hr,d.DegreeOfFreedom=he,d.Delay=So,d.Detector=Oo,d.Die=To,d.Direction=ln,d.Director=pa,d.DirectorEvents=ga,d.DisplayMode=fi,d.DynamicTree=Ks,d.DynamicTreeCollisionProcessor=Li,d.EX_VERSION=er,d.EaseBy=bo,d.EaseTo=xo,d.EasingFunctions=It,d.Edge=vs,d.EdgeCollider=Ct,d.ElasticToActorStrategy=Zo,d.EmitterType=Ae,d.Engine=os,d.EngineEvents=Wl,d.EnterTriggerEvent=qs,d.EnterViewPortEvent=Vs,d.Entity=Tt,d.EntityEvents=Eh,d.EntityManager=Sr,d.EventEmitter=X,d.EventTypes=Ss,d.Events=yh,d.ExResponse=kn,d.ExcaliburGraphicsContext2DCanvas=Xi,d.ExcaliburGraphicsContextWebGL=Xt,d.ExitTriggerEvent=Xs,d.ExitViewPortEvent=Gs,d.Fade=Co,d.FadeInOut=cc,d.Flags=De,d.Flash=Po,d.Follow=An,d.Font=Ce,d.FontCache=Gi,d.FontSource=hc,d.FontStyle=hn,d.FontUnit=rn,d.FpsSampler=ua,d.FrameStats=bi,d.Future=wt,d.GameEvent=L,d.GameStartEvent=As,d.GameStopEvent=Es,d.Gamepad=is,d.GamepadAxisEvent=zs,d.GamepadButtonEvent=Us,d.GamepadConnectEvent=Ls,d.GamepadDisconnectEvent=ks,d.Gamepads=es,d.GarbageCollector=wa,d.Gif=oc,d.GifParser=ya,d.GlobalCoordinates=Be,d.GpuParticleEmitter=ql,d.GpuParticleRenderer=as,d.Graph=ms,d.Graphic=it,d.GraphicsComponent=j,d.GraphicsGroup=Ne,d.GraphicsSystem=fn,d.HashColliderProxy=Ro,d.HashGridCell=Yt,d.HashGridProxy=In,d.HiddenEvent=Hs,d.HorizontalFirst=en,d.ImageFiltering=mt,d.ImageSource=Gt,d.ImageSourceAttributeConstants=O,d.ImageWrapping=_t,d.InitializeEvent=ze,d.InputHost=Yn,d.InputMapper=ia,d.IsometricEntityComponent=mi,d.IsometricEntitySystem=Wn,d.IsometricMap=Bl,d.IsometricTile=qo,d.KeyEvent=vi,d.Keyboard=aa,d.Keys=oa,d.KillEvent=Ai,d.Label=Gl,d.LimitCameraBoundsStrategy=Jo,d.Line=_n,d.LineSegment=J,d.Loader=Ji,d.LoaderEvents=Il,d.LockCameraToActorAxisStrategy=jo,d.LockCameraToActorStrategy=$o,d.LogLevel=Le,d.Logger=R,d.Material=Kr,d.Matrix=yt,d.MatrixLocations=cr,d.MediaEvent=Un,d.Meet=$i,d.MotionComponent=H,d.MotionSystem=ji,d.MoveBy=Tn,d.MoveByWithOptions=ro,d.MoveTo=Pn,d.MoveToWithOptions=ao,d.NativePointerButton=Pe,d.NativeSoundEvent=Te,d.NativeSoundProcessedEvent=ko,d.NineSlice=mn,d.NineSliceStretch=zr,d.Node=Si,d.None=sn,d.Observable=gt,d.OffscreenSystem=gn,d.Pair=pt,d.ParallaxComponent=Wi,d.ParallelActions=Xl,d.Particle=Yi,d.ParticleEmitter=Vl,d.ParticleRenderer=jr,d.ParticleTransform=Vt,d.PhysicsStats=ns,d.PhysicsWorld=Do,d.PointerAbstraction=Xn,d.PointerButton=le,d.PointerComponent=ae,d.PointerEvent=wi,d.PointerEventReceiver=ss,d.PointerScope=Fe,d.PointerSystem=ts,d.PointerType=ce,d.Polygon=pn,d.PolygonCollider=lt,d.Pool=Ui,d.PositionNode=_r,d.PostCollisionEvent=ve,d.PostDebugDrawEvent=Ds,d.PostDrawEvent=Ue,d.PostFrameEvent=Bs,d.PostKillEvent=Ps,d.PostTransformDrawEvent=Rs,d.PostUpdateEvent=re,d.PreCollisionEvent=me,d.PreDebugDrawEvent=Ms,d.PreDrawEvent=ke,d.PreFrameEvent=Fs,d.PreKillEvent=Ts,d.PreLoadEvent=Ol,d.PreTransformDrawEvent=Is,d.PreUpdateEvent=ne,d.Projection=Ke,d.QuadIndexBuffer=di,d.QuadTree=Ze,d.Query=Bt,d.QueryManager=Tr,d.RadiusAroundActorStrategy=Qo,d.Random=ie,d.Raster=We,d.Ray=fe,d.RealisticSolver=Fn,d.Rectangle=ci,d.RemoveEvent=Zs,d.RemovedComponent=Ph,d.RentalPool=Ve,d.Repeat=io,d.RepeatForever=so,d.Resolution=Bn,d.Resource=ai,d.ResourceEvents=Hh,d.RotateBy=uo,d.RotateByWithOptions=co,d.RotateTo=lo,d.RotateToWithOptions=ho,d.RotationType=Z,d.ScaleBy=vo,d.ScaleByWithOptions=mo,d.ScaleTo=go,d.ScaleToWithOptions=fo,d.Scene=Rt,d.SceneEvents=Hl,d.Screen=Ln,d.ScreenAppender=mr,d.ScreenElement=Hn,d.ScreenEvents=Sl,d.ScreenShader=Zr,d.ScrollPreventionMode=Qe,d.Semaphore=mc,d.SeparatingAxis=He,d.SeparationInfo=Mr,d.Shader=zt,d.Shape=ut,d.Slide=uc,d.SolverStrategy=ki,d.Sound=zn,d.SoundEvents=Al,d.SoundManager=rc,d.SparseHashGrid=Rn,d.SparseHashGridCollisionProcessor=Mn,d.SpatialPartitionStrategy=oi,d.Sprite=kt,d.SpriteFont=Oi,d.SpriteSheet=be,d.StandardClock=Zn,d.StateMachine=Qi,d.StrategyContainer=Xo,d.Stream=ba,d.System=At,d.SystemManager=Ar,d.SystemPriority=Nt,d.SystemType=Pt,d.TagQuery=Qs,d.TestClock=_a,d.Text=ui,d.TextAlign=on,d.TextureLoader=qe,d.Tile=Vo,d.TileMap=Go,d.TileMapEvents=Fl,d.TiledAnimation=vn,d.TiledSprite=li,d.Timer=Ki,d.Toaster=fa,d.Transform=Qt,d.TransformComponent=A,d.Transition=ls,d.TreeNode=Js,d.Trigger=ta,d.TriggerEvents=kl,d.TwoPI=et,d.UniformBuffer=Nr,d.Util=_c,d.Vector=v,d.VectorView=gs,d.VertexBuffer=qt,d.VertexLayout=Kt,d.VerticalFirst=tn,d.VisibleEvent=Os,d.WebAudio=Bo,d.WebAudioInstance=Lo,d.WheelDeltaMode=xi,d.WheelEvent=ha,d.World=Er,d.approximatelyEqual=ar,d.assert=Jn,d.canonicalizeAngle=Zt,d.clamp=F,d.coroutine=Ta,d.createId=_e,d.easeInBack=fh,d.easeInBounce=gr,d.easeInCirc=dh,d.easeInCubic=th,d.easeInElastic=mh,d.easeInExpo=hh,d.easeInOutBack=ph,d.easeInOutBounce=xh,d.easeInOutCirc=_h,d.easeInOutCubic=xs,d.easeInOutElastic=wh,d.easeInOutExpo=ch,d.easeInOutQuad=Ka,d.easeInOutQuart=nh,d.easeInOutQuint=ah,d.easeInOutSine=Za,d.easeInQuad=Qa,d.easeInQuart=ih,d.easeInQuint=rh,d.easeInSine=$a,d.easeOutBack=gh,d.easeOutBounce=bs,d.easeOutCirc=uh,d.easeOutCubic=eh,d.easeOutElastic=vh,d.easeOutExpo=lh,d.easeOutQuad=Ja,d.easeOutQuart=sh,d.easeOutQuint=oh,d.easeOutSine=ja,d.frac=Na,d.getDefaultPhysicsConfig=Jt,d.glTypeToUniformTypeName=Xr,d.hasGraphicsTick=Sn,d.hasOnAdd=ec,d.hasOnInitialize=Zl,d.hasOnPostUpdate=tc,d.hasOnPreUpdate=Jl,d.hasOnRemove=ic,d.hasPostDraw=nc,d.hasPreDraw=sc,d.has_add=$l,d.has_initialize=Yl,d.has_postupdate=Kl,d.has_preupdate=Ql,d.has_remove=jl,d.inverseLerp=dr,d.inverseLerpVector=ur,d.isActor=yl,d.isAddedComponent=Th,d.isComponentCtor=vr,d.isLegacyEasing=Se,d.isLoaderConstructor=On,d.isMoveByOptions=no,d.isMoveToOptions=oo,d.isRemovedComponent=Ah,d.isRotateByOptions=bl,d.isRotateToOptions=xl,d.isScaleByOptions=po,d.isScaleToOptions=_o,d.isSceneConstructor=$t,d.isScreenElement=Ho,d.isSystemConstructor=Pr,d.lerp=ot,d.lerpAngle=ps,d.lerpVector=ti,d.linear=Ti,d.maxMessages=Pa,d.nextActionId=N,d.obsolete=gc,d.parseImageFiltering=Ge,d.parseImageWrapping=Ut,d.pixelSnapEpsilon=B,d.randomInRange=Ot,d.randomIntInRange=Va,d.range=Ga,d.remap=Ht,d.remapVector=qa,d.resetObsoleteCounter=fc,d.sign=V,d.smootherstep=Ya,d.smoothstep=Xa,d.toDegrees=hr,d.toRadians=Wa,d.vec=x,d.webgl=Yh,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
820
+ `,Function.prototype.toString.call(p)):(u=!0,w(c.clock.elapsed())),b),generator:g,done:m,then:m.then.bind(m),[Symbol.iterator]:()=>g};return b}class ls extends Tt{constructor(t){var e,i,s,n,o;super(),this._logger=R.getInstance(),this.transform=new A,this.graphics=new j,this._completeFuture=new wt,this.started=!1,this._currentDistance=0,this._currentProgress=0,this.done=this._completeFuture.promise,this._useLegacyEasing=!1,this.name=`Transition#${this.id}`,this.duration=t.duration,Se(t.easing)?(this.legacyEasing=(e=t.easing)!=null?e:It.Linear,this._useLegacyEasing=!0):this.easing=(i=t.easing)!=null?i:Ti,this.direction=(s=t.direction)!=null?s:"out",this.hideLoader=(n=t.hideLoader)!=null?n:!1,this.blockInput=(o=t.blockInput)!=null?o:!1,this.transform.coordPlane=rt.Screen,this.transform.pos=v.Zero,this.transform.z=1/0,this.graphics.anchor=v.Zero,this.addComponent(this.transform),this.addComponent(this.graphics),this.direction==="out"?this._currentProgress=0:this._currentProgress=1}get progress(){return this._currentProgress}get distance(){return this._currentDistance}get complete(){return this.direction==="out"?this.progress>=1:this.progress<=0}updateTransition(t,e){this.complete||(this._currentDistance+=F(e/this.duration,0,1),this._currentDistance>=1&&(this._currentDistance=1),this.direction==="out"?this._useLegacyEasing?this._currentProgress=F(this.legacyEasing(this._currentDistance,0,1,1),0,1):this._currentProgress=F(ot(0,1,this.easing(this._currentDistance)),0,1):this._useLegacyEasing?this._currentProgress=F(this.legacyEasing(this._currentDistance,1,0,1),0,1):this._currentProgress=F(ot(1,0,this.easing(this._currentDistance)),0,1))}async onPreviousSceneDeactivate(t){}onStart(t){}onUpdate(t){}onEnd(t){}onReset(){}reset(){this.started=!1,this._completeFuture=new wt,this.done=this._completeFuture.promise,this._currentDistance=0,this.direction==="out"?this._currentProgress=0:this._currentProgress=1,this.onReset()}_addToTargetScene(t,e){const i=e;if(this.started&&this._logger.warn(`Attempted to add a transition ${this.name} that is already playing.`),i.world.entityManager.getById(this.id))return this._co;this._engine=t,i.add(this);const s=this;return this._co=Ta(t,function*(){for(;!s.complete;){const n=yield;s.updateTransition(s._engine,n),s._execute()}},{autostart:!1}),this._co}async _play(){this.started&&(this.reset(),this._logger.warn(`Attempted to play a transition ${this.name} that is already playing, reset transition.`)),(!this._engine||!this._co)&&(this.reset(),this._logger.warn(`Attempted to play a transition ${this.name} that hasn't been added`)),this._co&&await this._co.start()}_execute(){this.isInitialized&&(this.started||(this.started=!0,this.onStart(this.progress)),this.onUpdate(this.progress),this.complete&&!this._completeFuture.isCompleted&&(this.onEnd(this.progress),this._completeFuture.resolve()))}}class cc extends ls{constructor(t){var e,i;super({...t,duration:(e=t.duration)!=null?e:2e3}),this.name=`FadeInOut#${this.id}`,this.color=(i=t.color)!=null?i:P.Black}onInitialize(t){this.transform.pos=t.screen.unsafeArea.topLeft,this.screenCover=new ci({width:t.screen.resolution.width,height:t.screen.resolution.height,color:this.color}),this.graphics.add(this.screenCover),this.graphics.opacity=this.progress}onReset(){this.graphics.opacity=this.progress}onStart(t){this.graphics.opacity=t}onEnd(t){this.graphics.opacity=t}onUpdate(t){this.graphics.opacity=t}}class dc extends ls{constructor(t){super({direction:"in",...t}),this.name=`CrossFade#${this.id}`}async onPreviousSceneDeactivate(t){this.image=await t.engine.screenshot(!0),await this.image.decode()}onInitialize(t){this.engine=t,this.transform.pos=t.screen.unsafeArea.topLeft,this.screenCover=Gt.fromHtmlImageElement(this.image).toSprite(),this.graphics.add(this.screenCover),this.transform.scale=x(1/t.screen.pixelRatio,1/t.screen.pixelRatio),this.graphics.opacity=this.progress}onStart(t){this.graphics.opacity=this.progress}onReset(){this.graphics.opacity=this.progress}onEnd(t){this.graphics.opacity=t}onUpdate(t){this.graphics.opacity=t}}class uc extends ls{constructor(t){var e;super({direction:"in",...t}),this._easing=It.Linear,this._start=v.Zero,this._end=v.Zero,this.name=`Slide#${this.id}`,this.slideDirection=t.slideDirection,this.transform.coordPlane=rt.Screen,this.graphics.forceOnScreen=!0,this._easing=(e=t.easingFunction)!=null?e:this._easing}async onPreviousSceneDeactivate(t){this._image=await t.engine.screenshot(!0),await this._image.decode(),this._screenCover=Gt.fromHtmlImageElement(this._image).toSprite()}onInitialize(t){this._engine=t;let e=t.screen.unsafeArea;switch(e.hasZeroDimensions()&&(e=t.screen.contentArea),this.slideDirection){case"up":{this._directionOffset=x(0,-e.height);break}case"down":{this._directionOffset=x(0,e.height);break}case"left":{this._directionOffset=x(-e.width,0);break}case"right":{this._directionOffset=x(e.width,0);break}}this._camera=this._engine.currentScene.camera,this._destinationCameraPosition=this._camera.pos.clone(),this._camera.pos=this._camera.pos.add(this._directionOffset),this.transform.pos=this.transform.pos.add(this._directionOffset),this._startCameraPosition=this._camera.pos.clone(),this._start=e.topLeft,this._end=this._start.add(this._directionOffset),this.transform.pos=this._start,this.graphics.use(this._screenCover),this.transform.scale=x(1/t.screen.pixelRatio,1/t.screen.pixelRatio)}onStart(t){const e=this._easing(this.distance,0,1,1);this.transform.pos.x=ot(this._start.x,this._end.x,e),this.transform.pos.y=ot(this._start.y,this._end.y,e),this._camera.pos.x=ot(this._startCameraPosition.x,this._destinationCameraPosition.x,e),this._camera.pos.y=ot(this._startCameraPosition.y,this._destinationCameraPosition.y,e)}onUpdate(t){const e=this._easing(this.distance,0,1,1);this.transform.pos.x=ot(this._start.x,this._end.x,e),this.transform.pos.y=ot(this._start.y,this._end.y,e),this._camera.pos.x=ot(this._startCameraPosition.x,this._destinationCameraPosition.x,e),this._camera.pos.y=ot(this._startCameraPosition.y,this._destinationCameraPosition.y,e)}}const _c=Object.freeze(Object.defineProperty({__proto__:null,ConsoleAppender:ys,DrawUtil:Uh,EasingFunctions:It,LogLevel:Le,Logger:R,Observable:gt,ScreenAppender:mr,addItemToArray:Ch,contains:xr,delay:Di,fail:br,getMinIndex:wr,getPosition:ni,isLegacyEasing:Se,isObject:Fi,mergeDeep:Bi,omit:yr,removeItemFromArray:Oe},Symbol.toStringTag,{value:"Module"})),Pa=5,Je={},fc=()=>{for(const r in Je)Je[r]=0},cs=(r,t)=>{const e=De.isEnabled("suppress-obsolete-message");Je[r]<Pa&&!e&&(R.getInstance().warn(r),console.trace&&t.showStackTrace&&console.trace()),Je[r]++};function gc(r){return r={message:"This feature will be removed in future versions of Excalibur.",alternateMethod:null,showStackTrace:!1,...r},function(t,e,i){if(i&&!(typeof i.value=="function"||typeof i.get=="function"||typeof i.set=="function"))throw new SyntaxError("Only classes/functions/getters/setters can be marked as obsolete");const n=`${`${t.name||""}${t.name&&e?".":""}${e||""}`} is marked obsolete: ${r.message}`+(r.alternateMethod?` Use ${r.alternateMethod} instead`:"");Je[n]||(Je[n]=0);const o=i?{...i}:t;if(!i){class a extends o{constructor(...l){cs(n,r),super(...l)}}return a}return i&&i.value?(o.value=function(){return cs(n,r),i.value.apply(this,arguments)},o):(i&&i.get&&(o.get=function(){return cs(n,r),i.get.apply(this,arguments)}),i&&i.set&&(o.set=function(){return cs(n,r),i.set.apply(this,arguments)}),o)}}class pc{constructor(){this._queue=[]}get length(){return this._queue.length}enqueue(){const t=new wt;return this._queue.push(t),t.promise}dequeue(t){this._queue.shift().resolve(t)}}class mc{constructor(t){this._count=t,this._waitQueue=new pc}get count(){return this._count}get waiting(){return this._waitQueue.length}async enter(){return this._count!==0?(this._count--,Promise.resolve()):this._waitQueue.enqueue()}exit(t=1){if(t!==0){for(;t!==0&&this._waitQueue.length!==0;)this._waitQueue.dequeue(null),t--;this._count+=t}}}const er="0.32.0-alpha.1568+800f627";Me(),d.ActionCompleteEvent=$s,d.ActionContext=_i,d.ActionQueue=eo,d.ActionSequence=Kn,d.ActionStartEvent=Ys,d.ActionsComponent=je,d.ActionsSystem=Vn,d.ActivateEvent=Ns,d.Actor=Ft,d.ActorEvents=Cl,d.AddEvent=js,d.AddedComponent=Sh,d.AffineMatrix=Q,d.Animation=zi,d.AnimationDirection=Br,d.AnimationEvents=Fh,d.AnimationStrategy=Lr,d.ArcadeSolver=Dn,d.AudioContextFactory=gi,d.Axes=ea,d.Axis=Yo,d.BaseAlign=an,d.BezierCurve=ei,d.Blink=yo,d.BodyComponent=W,d.BoundingBox=D,d.BrowserComponent=$n,d.BrowserEvents=da,d.Buttons=qn,d.Camera=Ko,d.CameraEvents=Ll,d.Canvas=qi,d.ChannelCollection=xa,d.Circle=Vi,d.CircleCollider=dt,d.Clock=jn,d.ClosestLineJumpTable=Wt,d.Collider=ri,d.ColliderComponent=tt,d.CollisionContact=we,d.CollisionEndEvent=si,d.CollisionGroup=pe,d.CollisionGroupManager=Pi,d.CollisionJumpTable=Lt,d.CollisionPostSolveEvent=Mi,d.CollisionPreSolveEvent=Ri,d.CollisionStartEvent=ii,d.CollisionSystem=Zi,d.CollisionType=M,d.Color=P,d.ColorBlindFlags=la,d.ColorBlindnessMode=Ye,d.ColorBlindnessPostProcessor=Qr,d.Component=Dt,d.CompositeCollider=at,d.ConsoleAppender=ys,d.ContactConstraintPoint=Mo,d.ContactEndEvent=Ii,d.ContactSolveBias=oe,d.ContactStartEvent=Ei,d.CoordPlane=rt,d.CrossFade=dc,d.CurveBy=Eo,d.CurveTo=Ao,d.DeactivateEvent=Ws,d.Debug=Cn,d.DebugConfig=ca,d.DebugGraphicsComponent=Ni,d.DebugSystem=Gn,d.DebugText=un,d.DefaultAntialiasOptions=Or,d.DefaultGarbageCollectionOptions=Qn,d.DefaultLoader=pi,d.DefaultPixelArtOptions=Hr,d.DegreeOfFreedom=he,d.Delay=So,d.Detector=Oo,d.Die=To,d.Direction=ln,d.Director=pa,d.DirectorEvents=ga,d.DisplayMode=fi,d.DynamicTree=Ks,d.DynamicTreeCollisionProcessor=Li,d.EX_VERSION=er,d.EaseBy=bo,d.EaseTo=xo,d.EasingFunctions=It,d.Edge=vs,d.EdgeCollider=Ct,d.ElasticToActorStrategy=Zo,d.EmitterType=Ae,d.Engine=os,d.EngineEvents=Wl,d.EnterTriggerEvent=qs,d.EnterViewPortEvent=Vs,d.Entity=Tt,d.EntityEvents=Eh,d.EntityManager=Sr,d.EventEmitter=X,d.EventTypes=Ss,d.Events=yh,d.ExResponse=kn,d.ExcaliburGraphicsContext2DCanvas=Xi,d.ExcaliburGraphicsContextWebGL=Xt,d.ExitTriggerEvent=Xs,d.ExitViewPortEvent=Gs,d.Fade=Co,d.FadeInOut=cc,d.Flags=De,d.Flash=Po,d.Follow=An,d.Font=Ce,d.FontCache=Gi,d.FontSource=hc,d.FontStyle=hn,d.FontUnit=rn,d.FpsSampler=ua,d.FrameStats=bi,d.Future=wt,d.GameEvent=L,d.GameStartEvent=As,d.GameStopEvent=Es,d.Gamepad=is,d.GamepadAxisEvent=zs,d.GamepadButtonEvent=Us,d.GamepadConnectEvent=Ls,d.GamepadDisconnectEvent=ks,d.Gamepads=es,d.GarbageCollector=wa,d.Gif=oc,d.GifParser=ya,d.GlobalCoordinates=Be,d.GpuParticleEmitter=ql,d.GpuParticleRenderer=as,d.Graph=ms,d.Graphic=it,d.GraphicsComponent=j,d.GraphicsGroup=Ne,d.GraphicsSystem=fn,d.HashColliderProxy=Ro,d.HashGridCell=Yt,d.HashGridProxy=In,d.HiddenEvent=Hs,d.HorizontalFirst=en,d.ImageFiltering=mt,d.ImageSource=Gt,d.ImageSourceAttributeConstants=O,d.ImageWrapping=_t,d.InitializeEvent=ze,d.InputHost=Yn,d.InputMapper=ia,d.IsometricEntityComponent=mi,d.IsometricEntitySystem=Wn,d.IsometricMap=Bl,d.IsometricTile=qo,d.KeyEvent=vi,d.Keyboard=aa,d.Keys=oa,d.KillEvent=Ai,d.Label=Gl,d.LimitCameraBoundsStrategy=Jo,d.Line=_n,d.LineSegment=J,d.Loader=Ji,d.LoaderEvents=Il,d.LockCameraToActorAxisStrategy=jo,d.LockCameraToActorStrategy=$o,d.LogLevel=Le,d.Logger=R,d.Material=Kr,d.Matrix=yt,d.MatrixLocations=cr,d.MediaEvent=Un,d.Meet=$i,d.MotionComponent=H,d.MotionSystem=ji,d.MoveBy=Tn,d.MoveByWithOptions=ro,d.MoveTo=Pn,d.MoveToWithOptions=ao,d.NativePointerButton=Pe,d.NativeSoundEvent=Te,d.NativeSoundProcessedEvent=ko,d.NineSlice=mn,d.NineSliceStretch=zr,d.Node=Si,d.None=sn,d.Observable=gt,d.OffscreenSystem=gn,d.Pair=pt,d.ParallaxComponent=Wi,d.ParallelActions=Xl,d.Particle=Yi,d.ParticleEmitter=Vl,d.ParticleRenderer=jr,d.ParticleTransform=Vt,d.PhysicsStats=ns,d.PhysicsWorld=Do,d.PointerAbstraction=Xn,d.PointerButton=le,d.PointerComponent=ae,d.PointerEvent=wi,d.PointerEventReceiver=ss,d.PointerScope=Fe,d.PointerSystem=ts,d.PointerType=ce,d.Polygon=pn,d.PolygonCollider=lt,d.Pool=Ui,d.PositionNode=_r,d.PostCollisionEvent=ve,d.PostDebugDrawEvent=Ds,d.PostDrawEvent=Ue,d.PostFrameEvent=Bs,d.PostKillEvent=Ps,d.PostTransformDrawEvent=Rs,d.PostUpdateEvent=re,d.PreCollisionEvent=me,d.PreDebugDrawEvent=Ms,d.PreDrawEvent=ke,d.PreFrameEvent=Fs,d.PreKillEvent=Ts,d.PreLoadEvent=Ol,d.PreTransformDrawEvent=Is,d.PreUpdateEvent=ne,d.Projection=Ke,d.QuadIndexBuffer=di,d.QuadTree=Ze,d.Query=Bt,d.QueryManager=Tr,d.RadiusAroundActorStrategy=Qo,d.Random=ie,d.Raster=We,d.Ray=fe,d.RealisticSolver=Fn,d.Rectangle=ci,d.RemoveEvent=Zs,d.RemovedComponent=Ph,d.RentalPool=Ve,d.Repeat=io,d.RepeatForever=so,d.Resolution=Bn,d.Resource=ai,d.ResourceEvents=Hh,d.RotateBy=uo,d.RotateByWithOptions=co,d.RotateTo=lo,d.RotateToWithOptions=ho,d.RotationType=Z,d.ScaleBy=vo,d.ScaleByWithOptions=mo,d.ScaleTo=go,d.ScaleToWithOptions=fo,d.Scene=Rt,d.SceneEvents=Hl,d.Screen=Ln,d.ScreenAppender=mr,d.ScreenElement=Hn,d.ScreenEvents=Sl,d.ScreenShader=Zr,d.ScrollPreventionMode=Qe,d.Semaphore=mc,d.SeparatingAxis=He,d.SeparationInfo=Mr,d.Shader=zt,d.Shape=ut,d.Slide=uc,d.SolverStrategy=ki,d.Sound=zn,d.SoundEvents=Al,d.SoundManager=rc,d.SparseHashGrid=Rn,d.SparseHashGridCollisionProcessor=Mn,d.SpatialPartitionStrategy=oi,d.Sprite=kt,d.SpriteFont=Oi,d.SpriteSheet=be,d.StandardClock=Zn,d.StateMachine=Qi,d.StrategyContainer=Xo,d.Stream=ba,d.System=At,d.SystemManager=Ar,d.SystemPriority=Nt,d.SystemType=Pt,d.TagQuery=Qs,d.TestClock=_a,d.Text=ui,d.TextAlign=on,d.TextureLoader=qe,d.Tile=Vo,d.TileMap=Go,d.TileMapEvents=Fl,d.TiledAnimation=vn,d.TiledSprite=li,d.Timer=Ki,d.Toaster=fa,d.Transform=Qt,d.TransformComponent=A,d.Transition=ls,d.TreeNode=Js,d.Trigger=ta,d.TriggerEvents=kl,d.TwoPI=et,d.UniformBuffer=Nr,d.Util=_c,d.Vector=v,d.VectorView=gs,d.VertexBuffer=qt,d.VertexLayout=Kt,d.VerticalFirst=tn,d.VisibleEvent=Os,d.WebAudio=Bo,d.WebAudioInstance=Lo,d.WheelDeltaMode=xi,d.WheelEvent=ha,d.World=Er,d.approximatelyEqual=ar,d.assert=Jn,d.canonicalizeAngle=Zt,d.clamp=F,d.coroutine=Ta,d.createId=_e,d.easeInBack=fh,d.easeInBounce=gr,d.easeInCirc=dh,d.easeInCubic=th,d.easeInElastic=mh,d.easeInExpo=hh,d.easeInOutBack=ph,d.easeInOutBounce=xh,d.easeInOutCirc=_h,d.easeInOutCubic=xs,d.easeInOutElastic=wh,d.easeInOutExpo=ch,d.easeInOutQuad=Ka,d.easeInOutQuart=nh,d.easeInOutQuint=ah,d.easeInOutSine=Za,d.easeInQuad=Qa,d.easeInQuart=ih,d.easeInQuint=rh,d.easeInSine=$a,d.easeOutBack=gh,d.easeOutBounce=bs,d.easeOutCirc=uh,d.easeOutCubic=eh,d.easeOutElastic=vh,d.easeOutExpo=lh,d.easeOutQuad=Ja,d.easeOutQuart=sh,d.easeOutQuint=oh,d.easeOutSine=ja,d.frac=Na,d.getDefaultPhysicsConfig=Jt,d.glTypeToUniformTypeName=Xr,d.hasGraphicsTick=Sn,d.hasOnAdd=ec,d.hasOnInitialize=Zl,d.hasOnPostUpdate=tc,d.hasOnPreUpdate=Jl,d.hasOnRemove=ic,d.hasPostDraw=nc,d.hasPreDraw=sc,d.has_add=$l,d.has_initialize=Yl,d.has_postupdate=Kl,d.has_preupdate=Ql,d.has_remove=jl,d.inverseLerp=dr,d.inverseLerpVector=ur,d.isActor=yl,d.isAddedComponent=Th,d.isComponentCtor=vr,d.isLegacyEasing=Se,d.isLoaderConstructor=On,d.isMoveByOptions=no,d.isMoveToOptions=oo,d.isRemovedComponent=Ah,d.isRotateByOptions=bl,d.isRotateToOptions=xl,d.isScaleByOptions=po,d.isScaleToOptions=_o,d.isSceneConstructor=$t,d.isScreenElement=Ho,d.isSystemConstructor=Pr,d.lerp=ot,d.lerpAngle=ps,d.lerpVector=ti,d.linear=Ti,d.maxMessages=Pa,d.nextActionId=N,d.obsolete=gc,d.parseImageFiltering=Ge,d.parseImageWrapping=Ut,d.pixelSnapEpsilon=B,d.randomInRange=Ot,d.randomIntInRange=Va,d.range=Ga,d.remap=Ht,d.remapVector=qa,d.resetObsoleteCounter=fc,d.sign=V,d.smootherstep=Ya,d.smoothstep=Xa,d.toDegrees=hr,d.toRadians=Wa,d.vec=x,d.webgl=Yh,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1566+bfb6759 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1568+800f627 - 2025-11-25
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -33098,7 +33098,7 @@ class Semaphore {
33098
33098
  this._count += count;
33099
33099
  }
33100
33100
  }
33101
- const EX_VERSION = "0.32.0-alpha.1566+bfb6759";
33101
+ const EX_VERSION = "0.32.0-alpha.1568+800f627";
33102
33102
  polyfill();
33103
33103
  export {
33104
33104
  ActionCompleteEvent,
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1566+bfb6759 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1568+800f627 - 2025-11-25
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -33098,7 +33098,7 @@ class Semaphore {
33098
33098
  this._count += count;
33099
33099
  }
33100
33100
  }
33101
- const EX_VERSION = "0.32.0-alpha.1566+bfb6759";
33101
+ const EX_VERSION = "0.32.0-alpha.1568+800f627";
33102
33102
  polyfill();
33103
33103
  export {
33104
33104
  ActionCompleteEvent,
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1566+bfb6759 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1568+800f627 - 2025-11-25
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -22211,7 +22211,7 @@ class wc {
22211
22211
  }
22212
22212
  }
22213
22213
  }
22214
- const an = "0.32.0-alpha.1566+bfb6759";
22214
+ const an = "0.32.0-alpha.1568+800f627";
22215
22215
  hn();
22216
22216
  export {
22217
22217
  Nn as ActionCompleteEvent,
@@ -1,4 +1,4 @@
1
- /*! excalibur - 0.32.0-alpha.1566+bfb6759 - 2025-11-24
1
+ /*! excalibur - 0.32.0-alpha.1568+800f627 - 2025-11-25
2
2
  https://github.com/excaliburjs/Excalibur
3
3
  Copyright (c) 2025 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
4
4
  Licensed BSD-2-Clause
@@ -22211,7 +22211,7 @@ class wc {
22211
22211
  }
22212
22212
  }
22213
22213
  }
22214
- const an = "0.32.0-alpha.1566+bfb6759";
22214
+ const an = "0.32.0-alpha.1568+800f627";
22215
22215
  hn();
22216
22216
  export {
22217
22217
  Nn as ActionCompleteEvent,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "excalibur",
3
3
  "sideEffects": false,
4
- "version": "0.32.0-alpha.1566",
4
+ "version": "0.32.0-alpha.1568",
5
5
  "exNextVersion": "0.32.0",
6
6
  "publishConfig": {
7
7
  "provenance": true