@caperjs/core 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/build/assetpack.mjs +90 -0
  2. package/build/index.d.mts +29 -0
  3. package/build/plugins/pruneFallbacks.mjs +25 -2
  4. package/lib/{CaptionsPlugin-BLbLl3WB.js → CaptionsPlugin-cSJj-R9M.js} +4 -4
  5. package/lib/{CaptionsPlugin-BLbLl3WB.js.map → CaptionsPlugin-cSJj-R9M.js.map} +1 -1
  6. package/lib/{DataAdapter-aHSNM_26.js → DataAdapter-D2tc6hx9.js} +5 -5
  7. package/lib/{DataAdapter-aHSNM_26.js.map → DataAdapter-D2tc6hx9.js.map} +1 -1
  8. package/lib/{DebugRenderer-8LjHtBzA.js → DebugRenderer-CGUKy6Fy.js} +2 -2
  9. package/lib/{DebugRenderer-8LjHtBzA.js.map → DebugRenderer-CGUKy6Fy.js.map} +1 -1
  10. package/lib/{DevToolsPlugin-Vrk6aOtS.js → DevToolsPlugin-B8GX3H9b.js} +2 -2
  11. package/lib/{DevToolsPlugin-Vrk6aOtS.js.map → DevToolsPlugin-B8GX3H9b.js.map} +1 -1
  12. package/lib/{GSAPPlugin-Hm3F4zdg.js → GSAPPlugin-Br9AjuTD.js} +5 -5
  13. package/lib/{GSAPPlugin-Hm3F4zdg.js.map → GSAPPlugin-Br9AjuTD.js.map} +1 -1
  14. package/lib/{LayoutPlugin-Dpgeawfw.js → LayoutPlugin-BX3OP7pw.js} +4 -4
  15. package/lib/{LayoutPlugin-Dpgeawfw.js.map → LayoutPlugin-BX3OP7pw.js.map} +1 -1
  16. package/lib/{SpinePlugin-B08yAw1S.js → SpinePlugin-C-JDdXpf.js} +2 -2
  17. package/lib/{SpinePlugin-B08yAw1S.js.map → SpinePlugin-C-JDdXpf.js.map} +1 -1
  18. package/lib/{StatsPlugin-D2Xa5j97.js → StatsPlugin-yJlJtoQ2.js} +7 -10
  19. package/lib/{StatsPlugin-D2Xa5j97.js.map → StatsPlugin-yJlJtoQ2.js.map} +1 -1
  20. package/lib/{VoiceOverPlugin-qtFlqpRn.js → VoiceOverPlugin-DjSZp4Ko.js} +4 -4
  21. package/lib/{VoiceOverPlugin-qtFlqpRn.js.map → VoiceOverPlugin-DjSZp4Ko.js.map} +1 -1
  22. package/lib/caper.mjs +156 -1927
  23. package/lib/caper.mjs.map +1 -1
  24. package/lib/const-C3sxeYhl.js +1746 -0
  25. package/lib/const-C3sxeYhl.js.map +1 -0
  26. package/lib/core/create.d.ts.map +1 -1
  27. package/lib/padding-1kHDpGlQ.js +41 -0
  28. package/lib/padding-1kHDpGlQ.js.map +1 -0
  29. package/lib/plugins/FullScreenPlugin.d.ts +0 -5
  30. package/lib/plugins/FullScreenPlugin.d.ts.map +1 -1
  31. package/lib/plugins/KeyboardPlugin.d.ts +0 -1
  32. package/lib/plugins/KeyboardPlugin.d.ts.map +1 -1
  33. package/lib/plugins/Plugin.d.ts +101 -2
  34. package/lib/plugins/Plugin.d.ts.map +1 -1
  35. package/lib/plugins/SceneManagerPlugin.d.ts +0 -1
  36. package/lib/plugins/SceneManagerPlugin.d.ts.map +1 -1
  37. package/lib/plugins/StatsPlugin.d.ts +0 -1
  38. package/lib/plugins/StatsPlugin.d.ts.map +1 -1
  39. package/lib/plugins/TimerPlugin.d.ts.map +1 -1
  40. package/lib/plugins/WebEventsPlugin.d.ts +0 -1
  41. package/lib/plugins/WebEventsPlugin.d.ts.map +1 -1
  42. package/lib/plugins/breakpoints/BreakpointPlugin.d.ts.map +1 -1
  43. package/lib/plugins/gesture/GesturePlugin.d.ts.map +1 -1
  44. package/lib/plugins/input/AbstractControls.d.ts +46 -7
  45. package/lib/plugins/input/AbstractControls.d.ts.map +1 -1
  46. package/lib/plugins/input/InputPlugin.d.ts.map +1 -1
  47. package/lib/plugins/input/controlsCore.d.ts +58 -0
  48. package/lib/plugins/input/controlsCore.d.ts.map +1 -0
  49. package/lib/plugins/input/controlsCore.test.d.ts +2 -0
  50. package/lib/plugins/input/controlsCore.test.d.ts.map +1 -0
  51. package/lib/plugins/input/keyboard/KeyboardControls.d.ts +15 -0
  52. package/lib/plugins/input/keyboard/KeyboardControls.d.ts.map +1 -0
  53. package/lib/plugins/input/keyboard/index.d.ts +1 -1
  54. package/lib/plugins/input/keyboard/index.d.ts.map +1 -1
  55. package/lib/plugins/input/touch/VirtualControls.d.ts +7 -19
  56. package/lib/plugins/input/touch/VirtualControls.d.ts.map +1 -1
  57. package/lib/{registries-m2vKTIih.js → registries-BfV-VF7a.js} +565 -552
  58. package/lib/registries-BfV-VF7a.js.map +1 -0
  59. package/package.json +2 -1
  60. package/src/core/create.ts +11 -0
  61. package/src/plugins/FullScreenPlugin.ts +5 -18
  62. package/src/plugins/KeyboardPlugin.ts +3 -10
  63. package/src/plugins/Plugin.test.ts +130 -2
  64. package/src/plugins/Plugin.ts +159 -3
  65. package/src/plugins/SceneManagerPlugin.ts +3 -8
  66. package/src/plugins/StatsPlugin.ts +3 -10
  67. package/src/plugins/TimerPlugin.ts +1 -2
  68. package/src/plugins/WebEventsPlugin.ts +9 -18
  69. package/src/plugins/breakpoints/BreakpointPlugin.ts +1 -2
  70. package/src/plugins/captions/CaptionsPlugin.ts +1 -1
  71. package/src/plugins/gesture/GesturePlugin.ts +4 -8
  72. package/src/plugins/input/AbstractControls.ts +103 -8
  73. package/src/plugins/input/Controls.test.ts +56 -0
  74. package/src/plugins/input/InputPlugin.ts +6 -14
  75. package/src/plugins/input/controlsCore.test.ts +151 -0
  76. package/src/plugins/input/controlsCore.ts +162 -0
  77. package/src/plugins/input/keyboard/KeyboardControls.ts +84 -0
  78. package/src/plugins/input/keyboard/index.ts +1 -1
  79. package/src/plugins/input/touch/VirtualControls.ts +41 -142
  80. package/src/version.ts +1 -1
  81. package/lib/plugins/input/keyboard/KeyboardContols.d.ts +0 -33
  82. package/lib/plugins/input/keyboard/KeyboardContols.d.ts.map +0 -1
  83. package/lib/registries-m2vKTIih.js.map +0 -1
  84. package/src/plugins/input/keyboard/KeyboardContols.ts +0 -206
@@ -26,30 +26,30 @@ function ue() {
26
26
  return (e === "x" ? t : t & 3 | 8).toString(16);
27
27
  });
28
28
  }
29
- function de(e, t, n = !1) {
29
+ function g(e, t, n = !1) {
30
30
  return e + Math.random() * (t - e + +!!n);
31
31
  }
32
- function fe(e, t = !1) {
33
- return de(e.x, e.y, t);
32
+ function de(e, t = !1) {
33
+ return g(e.x, e.y, t);
34
34
  }
35
- function pe(e, t, n = !1) {
36
- return Math.floor(de(e, t, n));
35
+ function fe(e, t, n = !1) {
36
+ return Math.floor(g(e, t, n));
37
37
  }
38
- function me(e, t = !1) {
39
- return pe(e.x, e.y, t);
38
+ function pe(e, t = !1) {
39
+ return fe(e.x, e.y, t);
40
40
  }
41
- function he() {
41
+ function me() {
42
42
  return Math.random() < .5;
43
43
  }
44
44
  //#endregion
45
45
  //#region src/utils/bind.ts
46
- function ge(e, ...t) {
46
+ function he(e, ...t) {
47
47
  t.forEach((t) => {
48
48
  let n = e[t];
49
49
  typeof n == "function" && (e[t] = n.bind(e));
50
50
  });
51
51
  }
52
- function _e(e, t = [], n = []) {
52
+ function ge(e, t = [], n = []) {
53
53
  let r = Object.getPrototypeOf(e), i = [];
54
54
  for (; r;) {
55
55
  let e = Object.getOwnPropertyNames(r).filter((e) => typeof Object.getOwnPropertyDescriptor(r, e)?.value == "function" && e !== "constructor" && !t.some((t) => e.startsWith(t)) && !n.includes(e));
@@ -58,17 +58,17 @@ function _e(e, t = [], n = []) {
58
58
  }
59
59
  return i;
60
60
  }
61
- function g(e, t = [], n = []) {
62
- _e(e, t, n).forEach((t) => {
61
+ function _(e, t = [], n = []) {
62
+ ge(e, t, n).forEach((t) => {
63
63
  e[t] = e[t].bind(e);
64
64
  });
65
65
  }
66
- function ve(e, t, ...n) {
66
+ function _e(e, t, ...n) {
67
67
  typeof e[t] == "function" && e[t](...n);
68
68
  }
69
69
  //#endregion
70
70
  //#region src/utils/env.ts
71
- var _ = process.env.NODE_ENV, v = _ === "development", ye = _ === "production";
71
+ var ve = process.env.NODE_ENV, v = ve === "development", ye = ve === "production";
72
72
  //#endregion
73
73
  //#region src/utils/string.ts
74
74
  function y(e) {
@@ -83,7 +83,7 @@ var b = {
83
83
  log: "background: #74b64c; color: black;",
84
84
  warn: "background: yellow; color: black;",
85
85
  error: "background: red; color: white;"
86
- }, x = "background: #1f2937; color: #74b64c;", S = class e {
86
+ }, xe = "background: #1f2937; color: #74b64c;", x = class e {
87
87
  static {
88
88
  this._instance = null;
89
89
  }
@@ -119,8 +119,8 @@ var b = {
119
119
  static lifecycle(t, n = "init", ...r) {
120
120
  if (e.mode === "disabled") return;
121
121
  let i = `${t} ${n}`;
122
- if (e.mode === "default") return console.log(`%c ${y(n)} `, x, i, ...r);
123
- console.groupCollapsed(`%c ${y(n)} `, x, i, ...r), console.trace("%c Stack ", x), console.groupEnd();
122
+ if (e.mode === "default") return console.log(`%c ${y(n)} `, xe, i, ...r);
123
+ console.groupCollapsed(`%c ${y(n)} `, xe, i, ...r), console.trace("%c Stack ", xe), console.groupEnd();
124
124
  }
125
125
  static trace(t = "log", ...n) {
126
126
  if (e.mode !== "disabled") {
@@ -129,20 +129,20 @@ var b = {
129
129
  console.groupCollapsed(`%c ${y(t)} `, b[t], ...n), console.trace("%c Stack ", b[t]), console.groupEnd();
130
130
  }
131
131
  }
132
- }, C = /* @__PURE__ */ function(e) {
132
+ }, S = /* @__PURE__ */ function(e) {
133
133
  return e.REQUIRED_ASSETS_START = "caper-required-assets-start", e.REQUIRED_ASSETS_PROGRESS = "caper-required-assets-progress", e.REQUIRED_ASSETS_COMPLETE = "caper-required-assets-complete", e.ASSETS_START = "caper-assets-start", e.ASSETS_PROGRESS = "caper-assets-progress", e.ASSETS_COMPLETE = "caper-assets-complete", e;
134
- }({}), xe = (e = 0) => new Promise((t) => setTimeout(t, e * 1e3)), Se = (e = 0) => xe(e), w = (e) => e && typeof e.then == "function";
134
+ }({}), Se = (e = 0) => new Promise((t) => setTimeout(t, e * 1e3)), Ce = (e = 0) => Se(e), C = (e) => e && typeof e.then == "function";
135
135
  //#endregion
136
136
  //#region src/utils/vite.ts
137
- function T(e) {
138
- S.error(e);
137
+ function w(e) {
138
+ x.error(e);
139
139
  }
140
140
  //#endregion
141
141
  //#region src/utils/promise/Queue.ts
142
- function Ce(...e) {
143
- return new we(e);
142
+ function we(...e) {
143
+ return new Te(e);
144
144
  }
145
- var we = class {
145
+ var Te = class {
146
146
  constructor(e = []) {
147
147
  this._currentIndex = 0, this._isPaused = !1, this._isCanceled = !1, this._promises = e;
148
148
  }
@@ -175,7 +175,7 @@ var we = class {
175
175
  this._results.push(t), this._currentIndex++, this._next();
176
176
  } catch (e) {
177
177
  let t = e instanceof Error ? e : Error(String(e));
178
- console.error("Queue didn't complete due to an error:", e), T({
178
+ console.error("Queue didn't complete due to an error:", e), w({
179
179
  message: `Queue didn't complete due to an error: ${t.message}`,
180
180
  stack: t.stack,
181
181
  id: e?.id
@@ -185,23 +185,23 @@ var we = class {
185
185
  };
186
186
  //#endregion
187
187
  //#region src/utils/framework.ts
188
- function Te(e) {
188
+ function Ee(e) {
189
189
  return typeof e == "function" && /^class\s/.test(Function.prototype.toString.call(e));
190
190
  }
191
- async function E(e) {
191
+ async function T(e) {
192
192
  let t, n;
193
- return w(e.module) ? (t = await e.module, n = e?.namedExport ? t[e.namedExport] : t.default) : typeof e.module == "function" ? Te(e.module) ? (t = e.module, n = t) : (t = await e.module(), n = e?.namedExport ? t[e.namedExport] : t.default) : (t = e.module, n = t), n;
193
+ return C(e.module) ? (t = await e.module, n = e?.namedExport ? t[e.namedExport] : t.default) : typeof e.module == "function" ? Ee(e.module) ? (t = e.module, n = t) : (t = await e.module(), n = e?.namedExport ? t[e.namedExport] : t.default) : (t = e.module, n = t), n;
194
194
  }
195
195
  //#endregion
196
196
  //#region src/utils/map.ts
197
- function Ee(e, t) {
197
+ function De(e, t) {
198
198
  let n;
199
199
  for (let r of e) {
200
200
  if (r[0] === t) return n;
201
201
  n = r;
202
202
  }
203
203
  }
204
- function De(e, t) {
204
+ function Oe(e, t) {
205
205
  let n, r = Array.from(e.entries());
206
206
  for (let e = r.length - 1; e >= 0; e--) {
207
207
  let i = r[e];
@@ -209,23 +209,23 @@ function De(e, t) {
209
209
  n = i;
210
210
  }
211
211
  }
212
- function Oe(e) {
212
+ function ke(e) {
213
213
  return Array.from(e.entries()).pop();
214
214
  }
215
- function ke(e) {
215
+ function Ae(e) {
216
216
  return Array.from(e.entries()).shift();
217
217
  }
218
218
  //#endregion
219
219
  //#region src/utils/math.ts
220
- function Ae(e, t, n) {
220
+ function je(e, t, n) {
221
221
  return Math.max(t, Math.min(n, e));
222
222
  }
223
- function je(e, t, n) {
223
+ function Me(e, t, n) {
224
224
  return e + (t - e) * n;
225
225
  }
226
226
  //#endregion
227
227
  //#region src/utils/misc.ts
228
- function Me(e) {
228
+ function Ne(e) {
229
229
  if (e === void 0) return {
230
230
  width: 0,
231
231
  height: 0
@@ -249,7 +249,7 @@ function Me(e) {
249
249
  height: e ?? 0
250
250
  };
251
251
  }
252
- function Ne(e, t) {
252
+ function Pe(e, t) {
253
253
  let n = null;
254
254
  return function(...r) {
255
255
  n && clearTimeout(n), n = setTimeout(() => {
@@ -259,20 +259,20 @@ function Ne(e, t) {
259
259
  }
260
260
  //#endregion
261
261
  //#region src/utils/object.ts
262
- function Pe(e, t) {
262
+ function Fe(e, t) {
263
263
  return t.reduce((t, n) => n in e ? {
264
264
  ...t,
265
265
  [n]: e[n]
266
266
  } : t, {});
267
267
  }
268
- function Fe(e, t) {
268
+ function Ie(e, t) {
269
269
  return Object.entries(t).filter(([t]) => !e.includes(t)).reduce((e, [t, n]) => ({
270
270
  ...e,
271
271
  [t]: n
272
272
  }), {});
273
273
  }
274
- function Ie(e, t) {
275
- for (let n in t) t[n] !== void 0 && Object.prototype.toString.call(t[n]) === "[object Object]" && n in e && typeof e[n] == "object" ? e[n] = Ie(e[n], t[n]) : t[n] !== void 0 && (e[n] = t[n]);
274
+ function E(e, t) {
275
+ for (let n in t) t[n] !== void 0 && Object.prototype.toString.call(t[n]) === "[object Object]" && n in e && typeof e[n] == "object" ? e[n] = E(e[n], t[n]) : t[n] !== void 0 && (e[n] = t[n]);
276
276
  return e;
277
277
  }
278
278
  //#endregion
@@ -294,7 +294,7 @@ function Ve(e, t) {
294
294
  return n.x *= t, n.y *= t, n;
295
295
  }
296
296
  function He(e, t) {
297
- return je(e.x, e.y, t);
297
+ return Me(e.x, e.y, t);
298
298
  }
299
299
  function Ue(e, t) {
300
300
  return Math.sqrt(We(e, t));
@@ -328,7 +328,7 @@ async function Je(e) {
328
328
  let t = globalThis.Caper?.get?.("pluginsList") ?? [];
329
329
  return e.map((e) => {
330
330
  let n = Array.isArray(e) ? e[0] : e, r = t.find((e) => e.id === n);
331
- if (!r) return S.warn(`Plugin ${e} not found`), null;
331
+ if (!r) return x.warn(`Plugin ${e} not found`), null;
332
332
  let i = e;
333
333
  return {
334
334
  id: r.id,
@@ -405,13 +405,23 @@ function Ze(e, t) {
405
405
  return e;
406
406
  }
407
407
  //#endregion
408
+ //#region src/mixins/factory/defaults.ts
409
+ var D = null;
410
+ function Qe(e) {
411
+ D = e;
412
+ }
413
+ function $e() {
414
+ if (!D) throw Error("[caper] The factory method table hasn't been initialized. Import '@caperjs/core' (or its factory module) before deep-importing display/ui classes so the table is registered first.");
415
+ return D;
416
+ }
417
+ //#endregion
408
418
  //#region src/core/interfaces/IStorageCapability.ts
409
- function D(e) {
419
+ function O(e) {
410
420
  return !!e && typeof e.save == "function" && typeof e.load == "function";
411
421
  }
412
422
  //#endregion
413
423
  //#region ../../node_modules/.pnpm/typed-signals@2.5.0/node_modules/typed-signals/dist/Collector.js
414
- var O = /* @__PURE__ */ h(((e) => {
424
+ var k = /* @__PURE__ */ h(((e) => {
415
425
  Object.defineProperty(e, "__esModule", { value: !0 }), e.Collector = void 0, e.Collector = class {
416
426
  constructor(e) {
417
427
  this.emit = (...t) => {
@@ -419,9 +429,9 @@ var O = /* @__PURE__ */ h(((e) => {
419
429
  };
420
430
  }
421
431
  };
422
- })), Qe = /* @__PURE__ */ h(((e) => {
432
+ })), et = /* @__PURE__ */ h(((e) => {
423
433
  Object.defineProperty(e, "__esModule", { value: !0 }), e.CollectorArray = void 0;
424
- var t = O();
434
+ var t = k();
425
435
  e.CollectorArray = class extends t.Collector {
426
436
  constructor() {
427
437
  super(...arguments), this.result = [];
@@ -436,9 +446,9 @@ var O = /* @__PURE__ */ h(((e) => {
436
446
  this.result.length = 0;
437
447
  }
438
448
  };
439
- })), $e = /* @__PURE__ */ h(((e) => {
449
+ })), tt = /* @__PURE__ */ h(((e) => {
440
450
  Object.defineProperty(e, "__esModule", { value: !0 }), e.CollectorLast = void 0;
441
- var t = O();
451
+ var t = k();
442
452
  e.CollectorLast = class extends t.Collector {
443
453
  handleResult(e) {
444
454
  return this.result = e, !0;
@@ -450,9 +460,9 @@ var O = /* @__PURE__ */ h(((e) => {
450
460
  delete this.result;
451
461
  }
452
462
  };
453
- })), et = /* @__PURE__ */ h(((e) => {
463
+ })), nt = /* @__PURE__ */ h(((e) => {
454
464
  Object.defineProperty(e, "__esModule", { value: !0 }), e.CollectorUntil0 = void 0;
455
- var t = O();
465
+ var t = k();
456
466
  e.CollectorUntil0 = class extends t.Collector {
457
467
  constructor() {
458
468
  super(...arguments), this.result = !1;
@@ -467,9 +477,9 @@ var O = /* @__PURE__ */ h(((e) => {
467
477
  this.result = !1;
468
478
  }
469
479
  };
470
- })), tt = /* @__PURE__ */ h(((e) => {
480
+ })), rt = /* @__PURE__ */ h(((e) => {
471
481
  Object.defineProperty(e, "__esModule", { value: !0 }), e.CollectorWhile0 = void 0;
472
- var t = O();
482
+ var t = k();
473
483
  e.CollectorWhile0 = class extends t.Collector {
474
484
  constructor() {
475
485
  super(...arguments), this.result = !1;
@@ -484,7 +494,7 @@ var O = /* @__PURE__ */ h(((e) => {
484
494
  this.result = !1;
485
495
  }
486
496
  };
487
- })), nt = /* @__PURE__ */ h(((e) => {
497
+ })), it = /* @__PURE__ */ h(((e) => {
488
498
  Object.defineProperty(e, "__esModule", { value: !0 }), e.SignalConnectionImpl = void 0, e.SignalConnectionImpl = class {
489
499
  constructor(e, t) {
490
500
  this.link = e, this.parentCleanup = t;
@@ -499,7 +509,7 @@ var O = /* @__PURE__ */ h(((e) => {
499
509
  return this.link !== null && this.link.isEnabled();
500
510
  }
501
511
  };
502
- })), rt = /* @__PURE__ */ h(((e) => {
512
+ })), at = /* @__PURE__ */ h(((e) => {
503
513
  Object.defineProperty(e, "__esModule", { value: !0 }), e.SignalLink = void 0, e.SignalLink = class e {
504
514
  constructor(e = null, t = null, n = 0) {
505
515
  this.enabled = !0, this.newLink = !1, this.callback = null, this.prev = e ?? this, this.next = t ?? this, this.order = n;
@@ -520,9 +530,9 @@ var O = /* @__PURE__ */ h(((e) => {
520
530
  return i.callback = t, r.next = i, i.next.prev = i, i;
521
531
  }
522
532
  };
523
- })), it = /* @__PURE__ */ h(((e) => {
533
+ })), ot = /* @__PURE__ */ h(((e) => {
524
534
  Object.defineProperty(e, "__esModule", { value: !0 }), e.Signal = void 0;
525
- var t = nt(), n = rt();
535
+ var t = it(), n = at();
526
536
  e.Signal = class {
527
537
  constructor() {
528
538
  this.head = new n.SignalLink(), this.hasNewLinks = !1, this.emitDepth = 0, this.connectionsCount = 0;
@@ -569,7 +579,7 @@ var O = /* @__PURE__ */ h(((e) => {
569
579
  }
570
580
  }
571
581
  };
572
- })), at = /* @__PURE__ */ h(((e) => {
582
+ })), st = /* @__PURE__ */ h(((e) => {
573
583
  Object.defineProperty(e, "__esModule", { value: !0 }), e.SignalConnections = void 0, e.SignalConnections = class {
574
584
  constructor() {
575
585
  this.list = [];
@@ -588,58 +598,58 @@ var O = /* @__PURE__ */ h(((e) => {
588
598
  return this.list.length === 0;
589
599
  }
590
600
  };
591
- })), k = (/* @__PURE__ */ h(((e) => {
601
+ })), A = (/* @__PURE__ */ h(((e) => {
592
602
  Object.defineProperty(e, "__esModule", { value: !0 }), e.SignalConnections = e.Signal = e.CollectorWhile0 = e.CollectorUntil0 = e.CollectorLast = e.CollectorArray = e.Collector = void 0;
593
- var t = O();
603
+ var t = k();
594
604
  Object.defineProperty(e, "Collector", {
595
605
  enumerable: !0,
596
606
  get: function() {
597
607
  return t.Collector;
598
608
  }
599
609
  });
600
- var n = Qe();
610
+ var n = et();
601
611
  Object.defineProperty(e, "CollectorArray", {
602
612
  enumerable: !0,
603
613
  get: function() {
604
614
  return n.CollectorArray;
605
615
  }
606
616
  });
607
- var r = $e();
617
+ var r = tt();
608
618
  Object.defineProperty(e, "CollectorLast", {
609
619
  enumerable: !0,
610
620
  get: function() {
611
621
  return r.CollectorLast;
612
622
  }
613
623
  });
614
- var i = et();
624
+ var i = nt();
615
625
  Object.defineProperty(e, "CollectorUntil0", {
616
626
  enumerable: !0,
617
627
  get: function() {
618
628
  return i.CollectorUntil0;
619
629
  }
620
630
  });
621
- var a = tt();
631
+ var a = rt();
622
632
  Object.defineProperty(e, "CollectorWhile0", {
623
633
  enumerable: !0,
624
634
  get: function() {
625
635
  return a.CollectorWhile0;
626
636
  }
627
637
  });
628
- var o = it();
638
+ var o = ot();
629
639
  Object.defineProperty(e, "Signal", {
630
640
  enumerable: !0,
631
641
  get: function() {
632
642
  return o.Signal;
633
643
  }
634
644
  });
635
- var s = at();
645
+ var s = st();
636
646
  Object.defineProperty(e, "SignalConnections", {
637
647
  enumerable: !0,
638
648
  get: function() {
639
649
  return s.SignalConnections;
640
650
  }
641
651
  });
642
- })))(), ot = {
652
+ })))(), ct = {
643
653
  highest: -(2 ** 53 - 1),
644
654
  higher: -1e3,
645
655
  high: -100,
@@ -647,7 +657,7 @@ var O = /* @__PURE__ */ h(((e) => {
647
657
  low: 100,
648
658
  lower: 1e3,
649
659
  lowest: 2 ** 53 - 1
650
- }, A = class extends k.Signal {
660
+ }, j = class extends A.Signal {
651
661
  connectOnce(e, t) {
652
662
  let n = this.connect(((...t) => {
653
663
  e(...t), n.disconnect();
@@ -661,12 +671,12 @@ var O = /* @__PURE__ */ h(((e) => {
661
671
  return i;
662
672
  }
663
673
  connect(e, t = "normal") {
664
- let n = ot[t] ?? t;
674
+ let n = ct[t] ?? t;
665
675
  return super.connect(e, n);
666
676
  }
667
- }, st = class {
677
+ }, lt = class {
668
678
  constructor() {
669
- this.onError = new A();
679
+ this.onError = new j();
670
680
  }
671
681
  initialize(e) {
672
682
  return this._app = e, this;
@@ -675,21 +685,21 @@ var O = /* @__PURE__ */ h(((e) => {
675
685
  this.onError.disconnectAll();
676
686
  }
677
687
  _emitError(e) {
678
- S.error(`[Store.${e.operation}] adapter='${e.adapterId}' key='${e.key}': ${e.error.message}`), this.onError.emit(e);
688
+ x.error(`[Store.${e.operation}] adapter='${e.adapterId}' key='${e.key}': ${e.error.message}`), this.onError.emit(e);
679
689
  }
680
690
  getAdapter(e) {
681
691
  let t = this._app.getPlugin(e);
682
692
  if (!t) throw Error(`Adapter ${String(e)} not found`);
683
- if (!D(t)) throw Error(`Plugin '${String(e)}' is not storage-capable (missing save/load)`);
693
+ if (!O(t)) throw Error(`Plugin '${String(e)}' is not storage-capable (missing save/load)`);
684
694
  return t;
685
695
  }
686
696
  hasAdapter(e) {
687
697
  let t = this._app.getPlugin(e);
688
- return !!t && D(t);
698
+ return !!t && O(t);
689
699
  }
690
700
  allAdapterIds() {
691
701
  let e = this._app._plugins, t = [];
692
- if (e) for (let [n, r] of e) D(r) && t.push(n);
702
+ if (e) for (let [n, r] of e) O(r) && t.push(n);
693
703
  return t;
694
704
  }
695
705
  async save(e, t, n, r = !0) {
@@ -748,17 +758,10 @@ var O = /* @__PURE__ */ h(((e) => {
748
758
  }), n;
749
759
  }
750
760
  }
751
- }, ct = null;
752
- function lt(e) {
753
- ct = e;
754
- }
755
- function ut() {
756
- if (!ct) throw Error("[caper] The factory method table hasn't been initialized. Import '@caperjs/core' (or its factory module) before deep-importing display/ui classes so the table is registered first.");
757
- return ct;
758
- }
761
+ };
759
762
  //#endregion
760
763
  //#region src/mixins/factory/methods.ts
761
- function j(e, t, n) {
764
+ function M(e, t, n) {
762
765
  let r = {};
763
766
  for (let i in e) r[i] = (...r) => {
764
767
  let a = e[i](...r);
@@ -768,7 +771,7 @@ function j(e, t, n) {
768
771
  }
769
772
  //#endregion
770
773
  //#region src/plugins/Plugin.ts
771
- var M = class {
774
+ var N = class {
772
775
  static {
773
776
  this.__caper_method_binding_root = !0;
774
777
  }
@@ -776,12 +779,19 @@ var M = class {
776
779
  return this._options;
777
780
  }
778
781
  constructor(e = "Plugin") {
779
- this.id = e, this._signalConnections = new k.SignalConnections(), g(this);
782
+ this.id = e, this._signalConnections = new A.SignalConnections(), this._disposers = [], _(this);
780
783
  }
781
784
  get app() {
782
785
  return $.getInstance();
783
786
  }
784
787
  destroy() {
788
+ let e = this._disposers;
789
+ this._disposers = [];
790
+ for (let t = e.length - 1; t >= 0; t--) try {
791
+ e[t]();
792
+ } catch (e) {
793
+ x.error(`Plugin "${this.id}" threw while running a disposer:`, e);
794
+ }
785
795
  this._signalConnections.disconnectAll();
786
796
  }
787
797
  async initialize(e, t) {
@@ -796,16 +806,34 @@ var M = class {
796
806
  clearSignalConnections() {
797
807
  this._signalConnections.disconnectAll();
798
808
  }
809
+ addDisposer(...e) {
810
+ for (let t of e) this._disposers.push(t);
811
+ }
812
+ listen(e, t, n, r) {
813
+ e.addEventListener(t, n, r);
814
+ let i = !1, a = () => {
815
+ i || (i = !0, e.removeEventListener(t, n, r));
816
+ };
817
+ return this.addDisposer(a), a;
818
+ }
819
+ addTickerCallback(e, t, n) {
820
+ let r = this.app.ticker;
821
+ r.add(e, t, n);
822
+ let i = !1, a = () => {
823
+ i || (i = !0, r.remove(e, t));
824
+ };
825
+ return this.addDisposer(a), a;
826
+ }
799
827
  registerCoreFunctions() {
800
828
  this.getCoreFunctions().forEach((e) => {
801
829
  let t = e;
802
- Vn[t] = this[e];
830
+ Jn[t] = this[e];
803
831
  });
804
832
  }
805
833
  registerCoreSignals() {
806
834
  this.getCoreSignals().forEach((e) => {
807
835
  let t = e;
808
- Bn[t] = this[e];
836
+ qn[t] = this[e];
809
837
  });
810
838
  }
811
839
  getCoreFunctions() {
@@ -814,65 +842,65 @@ var M = class {
814
842
  getCoreSignals() {
815
843
  return [];
816
844
  }
817
- }, dt = {
845
+ }, ut = {
818
846
  preferWorkers: !v,
819
847
  crossOrigin: "anonymous"
820
848
  };
821
- function ft(e) {
849
+ function dt(e) {
822
850
  if (typeof e == "string") {
823
851
  if (!e?.includes(".svg")) return e;
824
852
  e = { src: e };
825
853
  } else if (Array.isArray(e.src) || !e.src?.includes(".svg")) return e;
826
854
  return e.data ||= {}, e.data.parseAsGraphicsContext = !0, e;
827
855
  }
828
- function N(e) {
856
+ function P(e) {
829
857
  return Array.isArray(e) || (e = [e]), e.map((e) => {
830
- if (typeof e == "string") return ft(e);
858
+ if (typeof e == "string") return dt(e);
831
859
  if (typeof e == "object") {
832
860
  let t = e?.src || [];
833
- return Array.isArray(t) || (t = [t]), e.ext ? (e.src && !Array.isArray(e.src) && (t.push(e.src), e.src = [e.src]), e.src = e.src.map((t) => `${t}.${e.ext}`), e.alias = [...t, ...e.src].filter(Boolean)) : ft(e), e;
861
+ return Array.isArray(t) || (t = [t]), e.ext ? (e.src && !Array.isArray(e.src) && (t.push(e.src), e.src = [e.src]), e.src = e.src.map((t) => `${t}.${e.ext}`), e.alias = [...t, ...e.src].filter(Boolean)) : dt(e), e;
834
862
  }
835
863
  });
836
864
  }
837
- var pt = class extends M {
865
+ var ft = class extends N {
838
866
  constructor(...e) {
839
- super(...e), this.id = "assets", this.onLoadStart = new A(), this.onLoadProgress = new A(), this.onLoadComplete = new A(), this.onLoadRequiredStart = new A(), this.onLoadRequiredProgress = new A(), this.onLoadRequiredComplete = new A(), this.onBackgroundLoadStart = new A(), this.onBackgroundAssetLoaded = new A(), this.onBackgroundBundlesLoaded = new A(), this._loadedBundles = /* @__PURE__ */ new Set(), this._loadedAssets = /* @__PURE__ */ new Set(), this._required = {}, this._background = {}, this._isLoadingRequired = !1, this.webRequiredStartEvent = new Event(C.REQUIRED_ASSETS_START, {
867
+ super(...e), this.id = "assets", this.onLoadStart = new j(), this.onLoadProgress = new j(), this.onLoadComplete = new j(), this.onLoadRequiredStart = new j(), this.onLoadRequiredProgress = new j(), this.onLoadRequiredComplete = new j(), this.onBackgroundLoadStart = new j(), this.onBackgroundAssetLoaded = new j(), this.onBackgroundBundlesLoaded = new j(), this._loadedBundles = /* @__PURE__ */ new Set(), this._loadedAssets = /* @__PURE__ */ new Set(), this._required = {}, this._background = {}, this._isLoadingRequired = !1, this.webRequiredStartEvent = new Event(S.REQUIRED_ASSETS_START, {
840
868
  bubbles: !0,
841
869
  cancelable: !1
842
- }), this.webRequiredProgressEvent = new CustomEvent(C.REQUIRED_ASSETS_PROGRESS, {
870
+ }), this.webRequiredProgressEvent = new CustomEvent(S.REQUIRED_ASSETS_PROGRESS, {
843
871
  bubbles: !0,
844
872
  cancelable: !1,
845
873
  detail: { progress: 0 }
846
- }), this.webRequiredCompleteEvent = new Event(C.REQUIRED_ASSETS_COMPLETE, {
874
+ }), this.webRequiredCompleteEvent = new Event(S.REQUIRED_ASSETS_COMPLETE, {
847
875
  bubbles: !0,
848
876
  cancelable: !1
849
- }), this.webStartEvent = new Event(C.ASSETS_START, {
877
+ }), this.webStartEvent = new Event(S.ASSETS_START, {
850
878
  bubbles: !0,
851
879
  cancelable: !1
852
- }), this.webProgressEvent = new CustomEvent(C.ASSETS_PROGRESS, {
880
+ }), this.webProgressEvent = new CustomEvent(S.ASSETS_PROGRESS, {
853
881
  bubbles: !0,
854
882
  cancelable: !1,
855
883
  detail: { progress: 0 }
856
- }), this.webCompleteEvent = new Event(C.ASSETS_COMPLETE, {
884
+ }), this.webCompleteEvent = new Event(S.ASSETS_COMPLETE, {
857
885
  bubbles: !0,
858
886
  cancelable: !1
859
887
  });
860
888
  }
861
889
  initialize(e) {
862
890
  e?.preload && (this._required = e.preload), e?.background && (this._background = e.background), t.setPreferences({
863
- ...dt,
891
+ ...ut,
864
892
  ...e?.assetPreferences
865
893
  });
866
894
  }
867
895
  async loadRequired() {
868
- if (this._isLoadingRequired = !0, this._handleLoadStart(), this._handleLoadProgress(0), this._required && (this._required.assets && await t.load(N(this._required.assets), this._handleLoadProgress), this._required.bundles)) {
896
+ if (this._isLoadingRequired = !0, this._handleLoadStart(), this._handleLoadProgress(0), this._required && (this._required.assets && await t.load(P(this._required.assets), this._handleLoadProgress), this._required.bundles)) {
869
897
  let e = this._required.bundles;
870
898
  Array.isArray(e) || (e = [e]), e = e.filter((e) => !this._isBundleLoaded(e)), e.length && await t.loadBundle(e, this._handleLoadProgress);
871
899
  }
872
900
  return this._handleLoadComplete(), this._isLoadingRequired = !1, Promise.resolve();
873
901
  }
874
902
  loadBackground() {
875
- this.onBackgroundLoadStart.emit(), this._background && (this._background.assets && N(this._background.assets).forEach((e) => {
903
+ this.onBackgroundLoadStart.emit(), this._background && (this._background.assets && P(this._background.assets).forEach((e) => {
876
904
  if (e?.src) {
877
905
  let n = e.src;
878
906
  if (n) return t.backgroundLoad(n);
@@ -885,14 +913,14 @@ var pt = class extends M {
885
913
  }));
886
914
  }
887
915
  async loadAssets(e, n = !0) {
888
- return e = N(e), await t.load(e, n ? this._handleLoadProgress : void 0), this._markAssetsLoaded(e), Promise.resolve();
916
+ return e = P(e), await t.load(e, n ? this._handleLoadProgress : void 0), this._markAssetsLoaded(e), Promise.resolve();
889
917
  }
890
918
  async loadBundles(e, n = !0) {
891
919
  return await t.loadBundle(e, n ? this._handleLoadProgress : void 0), this._markBundlesLoaded(e), Promise.resolve();
892
920
  }
893
921
  async unloadSceneAssets(e) {
894
922
  if (e.assets?.preload?.assets) {
895
- let n = N(e.assets.preload.assets);
923
+ let n = P(e.assets.preload.assets);
896
924
  t.unload(n).then(() => {
897
925
  this._markAssetsUnloaded(n);
898
926
  });
@@ -909,7 +937,7 @@ var pt = class extends M {
909
937
  if (n) {
910
938
  if (e.assets?.background) {
911
939
  if (e.assets.background.assets) {
912
- let n = N(e.assets.background.assets).filter((e) => !this._isAssetLoaded(e));
940
+ let n = P(e.assets.background.assets).filter((e) => !this._isAssetLoaded(e));
913
941
  n.length && n.forEach((e) => {
914
942
  if (e?.src) {
915
943
  let n = e.src;
@@ -925,7 +953,7 @@ var pt = class extends M {
925
953
  }
926
954
  } else {
927
955
  if (this._handleLoadStart(), this._handleLoadProgress(0), e.assets?.preload?.assets) {
928
- let n = N(e.assets.preload.assets), r = n.filter((e) => !this._isAssetLoaded(e));
956
+ let n = P(e.assets.preload.assets), r = n.filter((e) => !this._isAssetLoaded(e));
929
957
  r.length && (await t.load(r, this._handleLoadProgress), this._markAssetsLoaded(n));
930
958
  }
931
959
  if (e.assets?.preload?.bundles) {
@@ -1003,7 +1031,7 @@ var pt = class extends M {
1003
1031
  throw Error("Error dispatching web event", { cause: e });
1004
1032
  }
1005
1033
  }
1006
- }, mt = class extends M {
1034
+ }, pt = class extends N {
1007
1035
  set isFullScreen(e) {
1008
1036
  this._isFullScreen = e, this.setFullScreen(e);
1009
1037
  }
@@ -1017,16 +1045,13 @@ var pt = class extends M {
1017
1045
  return this._fullScreenElement;
1018
1046
  }
1019
1047
  constructor() {
1020
- super(), this.id = "fullscreen", this.onFullScreenChange = new A(), this._isFullScreen = !1, this._fullScreenElement = null, g(this);
1048
+ super(), this.id = "fullscreen", this.onFullScreenChange = new j(), this._isFullScreen = !1, this._fullScreenElement = null, _(this);
1021
1049
  }
1022
1050
  get app() {
1023
1051
  return $.getInstance();
1024
1052
  }
1025
1053
  initialize() {
1026
- document.addEventListener("fullscreenchange", this._onFullScreenChange), document.addEventListener("webkitfullscreenchange", this._onFullScreenChange), document.addEventListener("mozfullscreenchange", this._onFullScreenChange), document.addEventListener("msfullscreenchange", this._onFullScreenChange), document.addEventListener("fullscreenchange", this._onFullScreenChange);
1027
- }
1028
- destroy() {
1029
- document.removeEventListener("fullscreenchange", this._onFullScreenChange), document.removeEventListener("webkitfullscreenchange", this._onFullScreenChange), document.removeEventListener("mozfullscreenchange", this._onFullScreenChange), document.removeEventListener("msfullscreenchange", this._onFullScreenChange), document.removeEventListener("fullscreenchange", this._onFullScreenChange), super.destroy();
1054
+ this.listen(document, "fullscreenchange", this._onFullScreenChange), this.listen(document, "webkitfullscreenchange", this._onFullScreenChange), this.listen(document, "mozfullscreenchange", this._onFullScreenChange), this.listen(document, "msfullscreenchange", this._onFullScreenChange), this.listen(document, "fullscreenchange", this._onFullScreenChange);
1030
1055
  }
1031
1056
  toggleFullScreen() {
1032
1057
  this.setFullScreen(!this._isFullScreen);
@@ -1035,7 +1060,7 @@ var pt = class extends M {
1035
1060
  this._isFullScreen = e, e ? this._requestFullscreen() : this._exitFullscreen();
1036
1061
  }
1037
1062
  setFullScreenElement(e) {
1038
- e || S.warn("No element passed to setFullScreenElement for fullscreen mode"), this._fullScreenElement = e;
1063
+ e || x.warn("No element passed to setFullScreenElement for fullscreen mode"), this._fullScreenElement = e;
1039
1064
  }
1040
1065
  get canFullscreen() {
1041
1066
  let e = this._fullScreenElement || $.containerElement;
@@ -1063,7 +1088,7 @@ var pt = class extends M {
1063
1088
  try {
1064
1089
  t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.msRequestFullscreen ? t.msRequestFullscreen() : t.mozRequestFullScreen && t.mozRequestFullScreen();
1065
1090
  } catch (e) {
1066
- S.error("Failed to request fullscreen:", e), this._isFullScreen = !1;
1091
+ x.error("Failed to request fullscreen:", e), this._isFullScreen = !1;
1067
1092
  }
1068
1093
  }
1069
1094
  _exitFullscreen() {
@@ -1075,12 +1100,12 @@ var pt = class extends M {
1075
1100
  };
1076
1101
  //#endregion
1077
1102
  //#region src/plugins/KeyboardPlugin.ts
1078
- function P(e) {
1103
+ function F(e) {
1079
1104
  return e === void 0 ? e = "*undefined*" : e === " " ? e = "Space" : e.length === 1 && (e = e.toUpperCase()), e;
1080
1105
  }
1081
- var ht = class extends M {
1106
+ var mt = class extends N {
1082
1107
  constructor(...e) {
1083
- super(...e), this.id = "keyboard", this.onGlobalKeyDown = new A(), this.onGlobalKeyUp = new A(), this._keyDownSignals = /* @__PURE__ */ new Map(), this._keyUpSignals = /* @__PURE__ */ new Map(), this._keysDown = /* @__PURE__ */ new Set(), this._warnedNoConsumers = !1, this._enabled = !0;
1108
+ super(...e), this.id = "keyboard", this.onGlobalKeyDown = new j(), this.onGlobalKeyUp = new j(), this._keyDownSignals = /* @__PURE__ */ new Map(), this._keyUpSignals = /* @__PURE__ */ new Map(), this._keysDown = /* @__PURE__ */ new Set(), this._warnedNoConsumers = !1, this._enabled = !0;
1084
1109
  }
1085
1110
  get keysDown() {
1086
1111
  return this._keysDown;
@@ -1092,10 +1117,7 @@ var ht = class extends M {
1092
1117
  this._enabled = e;
1093
1118
  }
1094
1119
  initialize(e, t) {
1095
- document.addEventListener("keydown", this._handleKeyDown), document.addEventListener("keyup", this._handleKeyUp);
1096
- }
1097
- destroy() {
1098
- document.removeEventListener("keydown", this._handleKeyDown), document.removeEventListener("keyup", this._handleKeyUp), document.removeEventListener("keydown", this._handleEvent), document.removeEventListener("keyup", this._handleEvent);
1120
+ this.listen(document, "keydown", this._handleKeyDown), this.listen(document, "keyup", this._handleKeyUp);
1099
1121
  }
1100
1122
  onKeyDown(e) {
1101
1123
  return this._checkAndAddSignal(e || void 0, "keydown");
@@ -1118,29 +1140,29 @@ var ht = class extends M {
1118
1140
  ];
1119
1141
  }
1120
1142
  _handleKeyDown(e) {
1121
- let t = P(e.key);
1143
+ let t = F(e.key);
1122
1144
  this._keysDown.add(t), this.onGlobalKeyDown.emit({
1123
1145
  event: e,
1124
1146
  key: e.key
1125
1147
  });
1126
1148
  }
1127
1149
  _handleKeyUp(e) {
1128
- let t = P(e.key);
1129
- this._keysDown.delete(t), v && !this._warnedNoConsumers && this._keyUpSignals.size === 0 && this._keyDownSignals.size === 0 && (this._warnedNoConsumers = !0, S.warn("KeyboardPlugin received a key event but no consumers are connected, so keyboard actions will not fire. Ensure the InputPlugin controls are connected — e.g. an Application subclass overriding postInitialize() must not skip framework wiring, or call app.controls.connect().")), this.onGlobalKeyUp.emit({
1150
+ let t = F(e.key);
1151
+ this._keysDown.delete(t), v && !this._warnedNoConsumers && this._keyUpSignals.size === 0 && this._keyDownSignals.size === 0 && (this._warnedNoConsumers = !0, x.warn("KeyboardPlugin received a key event but no consumers are connected, so keyboard actions will not fire. Ensure the InputPlugin controls are connected — e.g. an Application subclass overriding postInitialize() must not skip framework wiring, or call app.controls.connect().")), this.onGlobalKeyUp.emit({
1130
1152
  event: e,
1131
1153
  key: e.key
1132
1154
  });
1133
1155
  }
1134
1156
  _checkAndAddSignal(e, t) {
1135
1157
  let n = t === "keydown" ? this._keyDownSignals : this._keyUpSignals;
1136
- return n.size || this._listen(t), e = P(e), n.has(e) || n.set(e, new A()), n.get(e);
1158
+ return n.size || this._listen(t), e = F(e), n.has(e) || n.set(e, new j()), n.get(e);
1137
1159
  }
1138
1160
  _listen(e) {
1139
- document.addEventListener(e, this._handleEvent);
1161
+ this.listen(document, e, this._handleEvent);
1140
1162
  }
1141
1163
  _handleEvent(e) {
1142
1164
  if (!this._enabled) return;
1143
- let t = e.type === "keydown" ? this._keyDownSignals : this._keyUpSignals, n = P(e.key);
1165
+ let t = e.type === "keydown" ? this._keyDownSignals : this._keyUpSignals, n = F(e.key);
1144
1166
  t.get("*undefined*")?.emit({
1145
1167
  event: e,
1146
1168
  key: n
@@ -1149,9 +1171,9 @@ var ht = class extends M {
1149
1171
  key: n
1150
1172
  });
1151
1173
  }
1152
- }, gt = class extends M {
1174
+ }, ht = class extends N {
1153
1175
  constructor(...e) {
1154
- super(...e), this.id = "actions", this.onActionContextChanged = new A(), this.onActionDispatched = new A(), this._context = "default", this._signals = /* @__PURE__ */ new Map(), this._actions = {}, this._debug = !1;
1176
+ super(...e), this.id = "actions", this.onActionContextChanged = new j(), this.onActionDispatched = new j(), this._context = "default", this._signals = /* @__PURE__ */ new Map(), this._actions = {}, this._debug = !1;
1155
1177
  }
1156
1178
  set debug(e) {
1157
1179
  this._debug = e;
@@ -1169,14 +1191,14 @@ var ht = class extends M {
1169
1191
  this._actions = t?.config?.actions && t.config.actions || {};
1170
1192
  }
1171
1193
  getAction(e) {
1172
- return this._signals.has(e) || this._signals.set(e, new A()), this._signals.get(e);
1194
+ return this._signals.has(e) || this._signals.set(e, new j()), this._signals.get(e);
1173
1195
  }
1174
1196
  getActions() {
1175
1197
  return this._actions;
1176
1198
  }
1177
1199
  sendAction(e, t) {
1178
1200
  if (!this._actions[e]) {
1179
- this._debug && S.warn(`Action ${e} is not defined`);
1201
+ this._debug && x.warn(`Action ${e} is not defined`);
1180
1202
  return;
1181
1203
  }
1182
1204
  let n = this._actions[e].context;
@@ -1189,7 +1211,7 @@ var ht = class extends M {
1189
1211
  this.getAction(e).emit(n), this.onActionDispatched.emit(n);
1190
1212
  return;
1191
1213
  }
1192
- this._debug && S.warn(`Action ${e} is not allowed for context ${this.context}`);
1214
+ this._debug && x.warn(`Action ${e} is not allowed for context ${this.context}`);
1193
1215
  }
1194
1216
  setActionContext(e) {
1195
1217
  return this.context = e, this.context;
@@ -1205,19 +1227,19 @@ var ht = class extends M {
1205
1227
  getCoreSignals() {
1206
1228
  return ["onActionContextChanged", "onActionDispatched"];
1207
1229
  }
1208
- }, _t = {
1230
+ }, gt = {
1209
1231
  default: "default",
1210
1232
  menu: "menu",
1211
1233
  pause: "pause",
1212
1234
  popup: "popup",
1213
1235
  game: "game"
1214
- }, vt = [
1236
+ }, _t = [
1215
1237
  "default",
1216
1238
  "menu",
1217
1239
  "pause",
1218
1240
  "popup",
1219
1241
  "game"
1220
- ], yt = [
1242
+ ], vt = [
1221
1243
  "up",
1222
1244
  "down",
1223
1245
  "left",
@@ -1230,7 +1252,7 @@ var ht = class extends M {
1230
1252
  "menu",
1231
1253
  "back",
1232
1254
  "next"
1233
- ], bt = {
1255
+ ], yt = {
1234
1256
  action: { context: "*" },
1235
1257
  back: { context: [
1236
1258
  "menu",
@@ -1267,10 +1289,10 @@ var ht = class extends M {
1267
1289
  pause: { context: "*" },
1268
1290
  unpause: { context: "*" },
1269
1291
  start: { context: "*" }
1270
- }, xt = { __default_do_not_use__: "__default_do_not_use__" };
1292
+ }, bt = { __default_do_not_use__: "__default_do_not_use__" };
1271
1293
  //#endregion
1272
1294
  //#region src/plugins/breakpoints/evaluate.ts
1273
- function St(e) {
1295
+ function xt(e) {
1274
1296
  let t = Object.entries(e);
1275
1297
  if (t.length === 0) throw Error("[breakpoints] `tiers` is empty — declare at least one tier in caper.config.ts.");
1276
1298
  for (let [e, n] of t) if (!Number.isFinite(n) || n < 0) throw Error(`[breakpoints] tier '${e}' has an invalid stop (${n}) — stops must be finite numbers >= 0.`);
@@ -1283,58 +1305,58 @@ function St(e) {
1283
1305
  byName: Object.fromEntries(n)
1284
1306
  };
1285
1307
  }
1286
- function Ct(e, t) {
1308
+ function St(e, t) {
1287
1309
  let n = e.names[0];
1288
1310
  for (let r = 0; r < e.stops.length && !(t < e.stops[r]); r++) n = e.names[r];
1289
1311
  return n;
1290
1312
  }
1291
- var wt = /* @__PURE__ */ new Set();
1292
- function Tt(e, t) {
1293
- wt.has(e) || (wt.add(e), S.warn(t));
1313
+ var Ct = /* @__PURE__ */ new Set();
1314
+ function wt(e, t) {
1315
+ Ct.has(e) || (Ct.add(e), x.warn(t));
1294
1316
  }
1295
- function F(e, t) {
1317
+ function I(e, t) {
1296
1318
  if (typeof t == "number") return t;
1297
1319
  let n = e.byName[t];
1298
- return n === void 0 && Tt(`stop:${t}`, `[breakpoints] unknown tier '${t}' — known tiers: ${e.names.join(", ")}.`), n;
1320
+ return n === void 0 && wt(`stop:${t}`, `[breakpoints] unknown tier '${t}' — known tiers: ${e.names.join(", ")}.`), n;
1299
1321
  }
1300
- function Et(e, t, n, r = "mode") {
1322
+ function Tt(e, t, n, r = "mode") {
1301
1323
  if (typeof t == "function") try {
1302
1324
  return t(e) === !0;
1303
1325
  } catch (e) {
1304
- return Tt(`predicate:${r}`, `[breakpoints] mode '${r}' threw; treating as false. ${String(e)}`), !1;
1326
+ return wt(`predicate:${r}`, `[breakpoints] mode '${r}' threw; treating as false. ${String(e)}`), !1;
1305
1327
  }
1306
1328
  if (t.tier !== void 0 && !(Array.isArray(t.tier) ? t.tier : [t.tier]).includes(e.tier)) return !1;
1307
1329
  if (t.atLeast !== void 0) {
1308
- let r = F(n, t.atLeast);
1330
+ let r = I(n, t.atLeast);
1309
1331
  if (r === void 0 || e.width < r) return !1;
1310
1332
  }
1311
1333
  if (t.below !== void 0) {
1312
- let r = F(n, t.below);
1334
+ let r = I(n, t.below);
1313
1335
  if (r === void 0 || e.width >= r) return !1;
1314
1336
  }
1315
1337
  return !(t.orientation !== void 0 && e.orientation !== t.orientation || t.pointer !== void 0 && e.pointer !== t.pointer || t.minHeight !== void 0 && e.height < t.minHeight || t.maxHeight !== void 0 && e.height > t.maxHeight);
1316
1338
  }
1317
- function I(e, t, n) {
1339
+ function L(e, t, n) {
1318
1340
  let { width: r, height: i } = e;
1319
1341
  return {
1320
1342
  width: r,
1321
1343
  height: i,
1322
1344
  aspect: i === 0 ? 0 : r / i,
1323
- tier: Ct(t, r),
1345
+ tier: St(t, r),
1324
1346
  orientation: r > i ? "landscape" : "portrait",
1325
1347
  pointer: n
1326
1348
  };
1327
1349
  }
1328
- function Dt(e, t, n) {
1350
+ function Et(e, t, n) {
1329
1351
  let r = new Set([
1330
1352
  e.tier,
1331
1353
  e.orientation,
1332
1354
  e.pointer
1333
1355
  ]);
1334
- for (let [i, a] of t) Et(e, a, n, i) && r.add(i);
1356
+ for (let [i, a] of t) Tt(e, a, n, i) && r.add(i);
1335
1357
  return r;
1336
1358
  }
1337
- function Ot(e, t) {
1359
+ function Dt(e, t) {
1338
1360
  let n = [], r = [];
1339
1361
  for (let r of t) e.has(r) || n.push(r);
1340
1362
  for (let n of e) t.has(n) || r.push(n);
@@ -1343,7 +1365,7 @@ function Ot(e, t) {
1343
1365
  left: r
1344
1366
  };
1345
1367
  }
1346
- function kt(e, t, n) {
1368
+ function Ot(e, t, n) {
1347
1369
  let r = e.names.indexOf(t);
1348
1370
  for (let t = r; t >= 0; t--) {
1349
1371
  let r = n[e.names[t]];
@@ -1356,23 +1378,23 @@ function kt(e, t, n) {
1356
1378
  }
1357
1379
  //#endregion
1358
1380
  //#region src/plugins/breakpoints/types.ts
1359
- var L = {
1381
+ var R = {
1360
1382
  mobile: 0,
1361
1383
  tablet: 768,
1362
1384
  desktop: 1024,
1363
1385
  wide: 1440
1364
- }, At = new Set([
1386
+ }, kt = new Set([
1365
1387
  "portrait",
1366
1388
  "landscape",
1367
1389
  "coarse",
1368
1390
  "fine"
1369
- ]), R = {
1391
+ ]), z = {
1370
1392
  width: 0,
1371
1393
  height: 0
1372
- }, jt = class extends M {
1394
+ }, At = class extends N {
1373
1395
  constructor(...e) {
1374
- super(...e), this.id = "breakpoints", this.onBreakpointChanged = new A(), this._modes = /* @__PURE__ */ new Map(), this._active = /* @__PURE__ */ new Set(), this._enter = /* @__PURE__ */ new Map(), this._leave = /* @__PURE__ */ new Map(), this._pointer = "fine", this._pointerQuery = null, this._warnedListenerNames = /* @__PURE__ */ new Set(), this._evaluate = (e) => {
1375
- let t = I(e ?? R, this._ladder, this._pointer), n = Dt(t, this._modes, this._ladder), { entered: r, left: i } = Ot(this._active, n), a = this._ctx.tier;
1396
+ super(...e), this.id = "breakpoints", this.onBreakpointChanged = new j(), this._modes = /* @__PURE__ */ new Map(), this._active = /* @__PURE__ */ new Set(), this._enter = /* @__PURE__ */ new Map(), this._leave = /* @__PURE__ */ new Map(), this._pointer = "fine", this._pointerQuery = null, this._warnedListenerNames = /* @__PURE__ */ new Set(), this._evaluate = (e) => {
1397
+ let t = L(e ?? z, this._ladder, this._pointer), n = Et(t, this._modes, this._ladder), { entered: r, left: i } = Dt(this._active, n), a = this._ctx.tier;
1376
1398
  if (this._ctx = t, this._active = n, !(r.length === 0 && i.length === 0)) {
1377
1399
  for (let e of i) this._leave.get(e)?.emit();
1378
1400
  for (let e of r) this._enter.get(e)?.emit();
@@ -1416,41 +1438,41 @@ var L = {
1416
1438
  return this._ctx.pointer;
1417
1439
  }
1418
1440
  async initialize(e = {}) {
1419
- this._ladder = St({ ...L }), this._ctx = I(R, this._ladder, this._pointer), this._options = {
1420
- tiers: e.tiers ?? { ...L },
1441
+ this._ladder = xt({ ...R }), this._ctx = L(z, this._ladder, this._pointer), this._options = {
1442
+ tiers: e.tiers ?? { ...R },
1421
1443
  modes: e.modes ?? {}
1422
- }, this._ladder = St(this._options.tiers);
1444
+ }, this._ladder = xt(this._options.tiers);
1423
1445
  for (let [e, t] of Object.entries(this._options.modes)) this._modes.set(e, t);
1424
- this._initPointer(), this._ctx = I(R, this._ladder, this._pointer), this._active = Dt(this._ctx, this._modes, this._ladder);
1446
+ this._initPointer(), this._ctx = L(z, this._ladder, this._pointer), this._active = Et(this._ctx, this._modes, this._ladder);
1425
1447
  }
1426
1448
  async postInitialize(e) {
1427
- this._evaluate(this.app.size ?? R), this.addSignalConnection(this.app.onResize.connect(this._evaluate, "highest"));
1449
+ this._evaluate(this.app.size ?? z), this.addSignalConnection(this.app.onResize.connect(this._evaluate, "highest"));
1428
1450
  }
1429
1451
  destroy() {
1430
- this._pointerQuery?.removeEventListener("change", this._onPointerChange), this._pointerQuery = null;
1452
+ this._pointerQuery = null;
1431
1453
  for (let e of this._enter.values()) e.disconnectAll();
1432
1454
  for (let e of this._leave.values()) e.disconnectAll();
1433
1455
  this._enter.clear(), this._leave.clear(), this.onBreakpointChanged.disconnectAll(), super.destroy();
1434
1456
  }
1435
1457
  is(e) {
1436
- return this._isKnown(e) ? this._active.has(e) : (S.warn(`[breakpoints] unknown name '${e}'. Known: ${this._knownNames().join(", ")}.`), !1);
1458
+ return this._isKnown(e) ? this._active.has(e) : (x.warn(`[breakpoints] unknown name '${e}'. Known: ${this._knownNames().join(", ")}.`), !1);
1437
1459
  }
1438
1460
  atLeast(e) {
1439
- let t = F(this._ladder, e);
1461
+ let t = I(this._ladder, e);
1440
1462
  return t !== void 0 && this._ctx.width >= t;
1441
1463
  }
1442
1464
  below(e) {
1443
- let t = F(this._ladder, e);
1465
+ let t = I(this._ladder, e);
1444
1466
  return t !== void 0 && this._ctx.width < t;
1445
1467
  }
1446
1468
  between(e, t) {
1447
1469
  return this.atLeast(e) && this.below(t);
1448
1470
  }
1449
1471
  matches(e) {
1450
- return Et(this._ctx, e, this._ladder);
1472
+ return Tt(this._ctx, e, this._ladder);
1451
1473
  }
1452
1474
  value(e) {
1453
- return kt(this._ladder, this._ctx.tier, e);
1475
+ return Ot(this._ladder, this._ctx.tier, e);
1454
1476
  }
1455
1477
  define(e, t) {
1456
1478
  this._modes.set(e, t), this._evaluate(this.size);
@@ -1475,26 +1497,26 @@ var L = {
1475
1497
  this._pointer = "fine";
1476
1498
  return;
1477
1499
  }
1478
- this._pointerQuery = window.matchMedia("(pointer: coarse)"), this._pointer = this._pointerQuery.matches ? "coarse" : "fine", this._pointerQuery.addEventListener("change", this._onPointerChange);
1500
+ this._pointerQuery = window.matchMedia("(pointer: coarse)"), this._pointer = this._pointerQuery.matches ? "coarse" : "fine", this.listen(this._pointerQuery, "change", this._onPointerChange);
1479
1501
  }
1480
1502
  _signal(e, t) {
1481
1503
  let n = e.get(t);
1482
- return n || (n = new A(), e.set(t, n)), n;
1504
+ return n || (n = new j(), e.set(t, n)), n;
1483
1505
  }
1484
1506
  _isKnown(e) {
1485
- return e in this._ladder.byName || this._modes.has(e) || At.has(e);
1507
+ return e in this._ladder.byName || this._modes.has(e) || kt.has(e);
1486
1508
  }
1487
1509
  _warnIfUnknown(e) {
1488
- this._isKnown(e) || this._warnedListenerNames.has(e) || (this._warnedListenerNames.add(e), S.warn(`[breakpoints] unknown name '${e}'. Known: ${this._knownNames().join(", ")}.`));
1510
+ this._isKnown(e) || this._warnedListenerNames.has(e) || (this._warnedListenerNames.add(e), x.warn(`[breakpoints] unknown name '${e}'. Known: ${this._knownNames().join(", ")}.`));
1489
1511
  }
1490
1512
  _knownNames() {
1491
1513
  return [
1492
1514
  ...this._ladder.names,
1493
1515
  ...this._modes.keys(),
1494
- ...At
1516
+ ...kt
1495
1517
  ];
1496
1518
  }
1497
- }, Mt = class {
1519
+ }, jt = class {
1498
1520
  constructor(e, t) {
1499
1521
  this.name = e, this.manager = t, this._sounds = /* @__PURE__ */ new Map(), this._muted = !1, this._volume = 1, this.muted = this.manager.muted;
1500
1522
  }
@@ -1542,7 +1564,7 @@ var L = {
1542
1564
  try {
1543
1565
  e.pause();
1544
1566
  } catch (t) {
1545
- S.error("Error pausing sound", e.id, t);
1567
+ x.error("Error pausing sound", e.id, t);
1546
1568
  }
1547
1569
  });
1548
1570
  });
@@ -1553,7 +1575,7 @@ var L = {
1553
1575
  try {
1554
1576
  e.resume();
1555
1577
  } catch (t) {
1556
- S.error("Error resuming sound", e.id, t);
1578
+ x.error("Error resuming sound", e.id, t);
1557
1579
  }
1558
1580
  });
1559
1581
  });
@@ -1585,9 +1607,9 @@ var L = {
1585
1607
  [...e].forEach((e) => e.destroy());
1586
1608
  }), this._sounds.clear();
1587
1609
  }
1588
- }, z = class {
1610
+ }, Mt = class {
1589
1611
  constructor(e, t, n) {
1590
- this.id = e, this.channel = t, this.manager = n, this.onStart = new A(), this.onStop = new A(), this.onEnd = new A(), this.onPaused = new A(), this.onResumed = new A(), this.onProgress = new A(), this._volume = 1, this._muted = !1, this._isPlaying = !1, g(this), this.muted = this.channel.muted;
1612
+ this.id = e, this.channel = t, this.manager = n, this.onStart = new j(), this.onStop = new j(), this.onEnd = new j(), this.onPaused = new j(), this.onResumed = new j(), this.onProgress = new j(), this._volume = 1, this._muted = !1, this._isPlaying = !1, _(this), this.muted = this.channel.muted;
1591
1613
  }
1592
1614
  get media() {
1593
1615
  return this._media;
@@ -1874,7 +1896,7 @@ var It = class extends i {
1874
1896
  destroy() {
1875
1897
  this.removeAllListeners();
1876
1898
  }
1877
- }, Lt = 0, Rt = class extends i {
1899
+ }, Lt = 0, W = class extends i {
1878
1900
  constructor(e) {
1879
1901
  super(), this.id = Lt++, this.init(e);
1880
1902
  }
@@ -1974,7 +1996,7 @@ var It = class extends i {
1974
1996
  }
1975
1997
  play(e) {
1976
1998
  let { start: t, end: n, speed: r, loop: i, volume: a, muted: o } = e;
1977
- n && console.assert(n > t, "End time is before start time"), this._speed = r, this._volume = a, this._loop = !!i, this._muted = o, this.refresh(), this.loop && n !== null && (console.warn("Looping not support when specifying an \"end\" time"), this.loop = !1), this._start = t, this._end = n || this._duration, this._start = Math.max(0, this._start - Rt.PADDING), this._end = Math.min(this._end + Rt.PADDING, this._duration), this._source.onloadedmetadata = () => {
1999
+ n && console.assert(n > t, "End time is before start time"), this._speed = r, this._volume = a, this._loop = !!i, this._muted = o, this.refresh(), this.loop && n !== null && (console.warn("Looping not support when specifying an \"end\" time"), this.loop = !1), this._start = t, this._end = n || this._duration, this._start = Math.max(0, this._start - W.PADDING), this._end = Math.min(this._end + W.PADDING, this._duration), this._source.onloadedmetadata = () => {
1978
2000
  this._source && (this._source.currentTime = t, this._source.onloadedmetadata = null, this.emit("progress", t / this._duration, this._duration), d.shared.add(this._onUpdate, this));
1979
2001
  }, this._source.onended = this._onComplete.bind(this), this._source.play(), this.emit("start");
1980
2002
  }
@@ -1992,16 +2014,16 @@ var It = class extends i {
1992
2014
  toString() {
1993
2015
  return `[HTMLAudioInstance id=${this.id}]`;
1994
2016
  }
1995
- }, zt = Rt;
1996
- zt.PADDING = .1;
2017
+ }, Rt = W;
2018
+ Rt.PADDING = .1;
1997
2019
  //#endregion
1998
2020
  //#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/htmlaudio/HTMLAudioMedia.mjs
1999
- var Bt = class extends i {
2021
+ var zt = class extends i {
2000
2022
  init(e) {
2001
2023
  this.parent = e, this._source = e.options.source || new Audio(), e.url && (this._source.src = e.url);
2002
2024
  }
2003
2025
  create() {
2004
- return new zt(this);
2026
+ return new Rt(this);
2005
2027
  }
2006
2028
  get isPlayable() {
2007
2029
  return !!this._source && this._source.readyState === 4;
@@ -2054,7 +2076,7 @@ var Bt = class extends i {
2054
2076
  };
2055
2077
  t.addEventListener("canplaythrough", r, !1), t.addEventListener("load", r, !1), t.addEventListener("abort", i, !1), t.addEventListener("error", a, !1), t.load();
2056
2078
  }
2057
- }, Vt = class {
2079
+ }, Bt = class {
2058
2080
  constructor(e, t) {
2059
2081
  this.parent = e, Object.assign(this, t), this.duration = this.end - this.start, console.assert(this.duration > 0, "End time must be after start time");
2060
2082
  }
@@ -2070,7 +2092,7 @@ var Bt = class extends i {
2070
2092
  destroy() {
2071
2093
  this.parent = null;
2072
2094
  }
2073
- }, W = [
2095
+ }, G = [
2074
2096
  "ogg",
2075
2097
  "oga",
2076
2098
  "opus",
@@ -2082,8 +2104,8 @@ var Bt = class extends i {
2082
2104
  "wma",
2083
2105
  "mid",
2084
2106
  "caf"
2085
- ], Ht = ["audio/mpeg", "audio/ogg"], G = {};
2086
- function Ut(e) {
2107
+ ], Vt = ["audio/mpeg", "audio/ogg"], K = {};
2108
+ function Ht(e) {
2087
2109
  let t = {
2088
2110
  m4a: "audio/mp4",
2089
2111
  oga: "audio/ogg",
@@ -2091,17 +2113,17 @@ function Ut(e) {
2091
2113
  caf: "audio/x-caf; codecs=\"opus\"",
2092
2114
  ...e || {}
2093
2115
  }, n = document.createElement("audio"), r = {}, i = /^no$/;
2094
- W.forEach((e) => {
2116
+ G.forEach((e) => {
2095
2117
  let a = n.canPlayType(`audio/${e}`).replace(i, ""), o = t[e] ? n.canPlayType(t[e]).replace(i, "") : "";
2096
2118
  r[e] = !!a || !!o;
2097
- }), Object.assign(G, r);
2119
+ }), Object.assign(K, r);
2098
2120
  }
2099
- Ut();
2121
+ Ht();
2100
2122
  //#endregion
2101
2123
  //#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/webaudio/WebAudioInstance.mjs
2102
- var Wt = 0, Gt = class extends i {
2124
+ var Ut = 0, Wt = class extends i {
2103
2125
  constructor(e) {
2104
- super(), this.id = Wt++, this._media = null, this._paused = !1, this._muted = !1, this._elapsed = 0, this.init(e);
2126
+ super(), this.id = Ut++, this._media = null, this._paused = !1, this._muted = !1, this._elapsed = 0, this.init(e);
2105
2127
  }
2106
2128
  set(e, t) {
2107
2129
  if (this[e] === void 0) throw Error(`Property with name ${e} does not exist.`);
@@ -2253,7 +2275,7 @@ var Wt = 0, Gt = class extends i {
2253
2275
  }
2254
2276
  this._source = null, this._progress = 1, this.emit("progress", 1, this._duration), this.emit("end", this);
2255
2277
  }
2256
- }, Kt = class {
2278
+ }, Gt = class {
2257
2279
  constructor(e, t) {
2258
2280
  this._output = t, this._input = e;
2259
2281
  }
@@ -2277,13 +2299,13 @@ var Wt = 0, Gt = class extends i {
2277
2299
  destroy() {
2278
2300
  this.filters = null, this._input = null, this._output = null;
2279
2301
  }
2280
- }, qt = class extends Kt {
2302
+ }, Kt = class extends Gt {
2281
2303
  constructor(e) {
2282
2304
  let t = e.audioContext, n = t.createBufferSource(), r = t.createGain(), i = t.createAnalyser();
2283
2305
  n.connect(i), i.connect(r), r.connect(e.destination), super(i, r), this.context = e, this.bufferSource = n, this.gain = r, this.analyser = i;
2284
2306
  }
2285
2307
  get script() {
2286
- return this._script || (this._script = this.context.audioContext.createScriptProcessor(qt.BUFFER_SIZE), this._script.connect(this.context.destination)), this._script;
2308
+ return this._script || (this._script = this.context.audioContext.createScriptProcessor(Kt.BUFFER_SIZE), this._script.connect(this.context.destination)), this._script;
2287
2309
  }
2288
2310
  destroy() {
2289
2311
  super.destroy(), this.bufferSource.disconnect(), this._script && this._script.disconnect(), this.gain.disconnect(), this.analyser.disconnect(), this.bufferSource = null, this._script = null, this.gain = null, this.analyser = null, this.context = null;
@@ -2300,13 +2322,13 @@ var Wt = 0, Gt = class extends i {
2300
2322
  get bufferSize() {
2301
2323
  return this.script.bufferSize;
2302
2324
  }
2303
- }, Jt = qt;
2304
- Jt.BUFFER_SIZE = 0;
2325
+ }, qt = Kt;
2326
+ qt.BUFFER_SIZE = 0;
2305
2327
  //#endregion
2306
2328
  //#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/webaudio/WebAudioMedia.mjs
2307
- var Yt = class {
2329
+ var Jt = class {
2308
2330
  init(e) {
2309
- this.parent = e, this._nodes = new Jt(this.context), this._source = this._nodes.bufferSource, this.source = e.options.source;
2331
+ this.parent = e, this._nodes = new qt(this.context), this._source = this._nodes.bufferSource, this.source = e.options.source;
2310
2332
  }
2311
2333
  destroy() {
2312
2334
  this.parent = null, this._nodes.destroy(), this._nodes = null;
@@ -2318,7 +2340,7 @@ var Yt = class {
2318
2340
  this._source = null, this.source = null;
2319
2341
  }
2320
2342
  create() {
2321
- return new Gt(this);
2343
+ return new Wt(this);
2322
2344
  }
2323
2345
  get context() {
2324
2346
  return this.parent.context;
@@ -2362,7 +2384,7 @@ var Yt = class {
2362
2384
  };
2363
2385
  e instanceof AudioBuffer ? n(null, e) : this.parent.context.decode(e, n);
2364
2386
  }
2365
- }, K = class {
2387
+ }, q = class {
2366
2388
  static from(e) {
2367
2389
  let t = {};
2368
2390
  return typeof e == "string" ? t.url = e : e instanceof ArrayBuffer || e instanceof AudioBuffer || e instanceof HTMLAudioElement ? t.source = e : Array.isArray(e) ? t.url = e : t = e, t = {
@@ -2377,7 +2399,7 @@ var Yt = class {
2377
2399
  loaded: null,
2378
2400
  loop: !1,
2379
2401
  ...t
2380
- }, Object.freeze(t), new K(B().useLegacy ? new Bt() : new Yt(), t);
2402
+ }, Object.freeze(t), new q(B().useLegacy ? new zt() : new Jt(), t);
2381
2403
  }
2382
2404
  constructor(e, t) {
2383
2405
  this.media = e, this.options = t, this._instances = [], this._sprites = {}, this.media.init(this);
@@ -2388,7 +2410,7 @@ var Yt = class {
2388
2410
  let [t] = e.map((e) => ({
2389
2411
  url: e,
2390
2412
  ext: f.extname(e).slice(1)
2391
- })).filter(({ ext: e }) => G[e]).sort((e, t) => W.indexOf(e.ext) - W.indexOf(t.ext));
2413
+ })).filter(({ ext: e }) => K[e]).sort((e, t) => G.indexOf(e.ext) - G.indexOf(t.ext));
2392
2414
  if (!t) throw Error("No supported file type found");
2393
2415
  return t.url;
2394
2416
  }
@@ -2426,7 +2448,7 @@ var Yt = class {
2426
2448
  return t;
2427
2449
  }
2428
2450
  console.assert(!this._sprites[e], `Alias ${e} is already taken`);
2429
- let n = new Vt(this, t);
2451
+ let n = new Bt(this, t);
2430
2452
  return this._sprites[e] = n, n;
2431
2453
  }
2432
2454
  destroy() {
@@ -2542,20 +2564,20 @@ var Yt = class {
2542
2564
  this._poolInstance(e);
2543
2565
  }
2544
2566
  _createInstance() {
2545
- if (K._pool.length > 0) {
2546
- let e = K._pool.pop();
2567
+ if (q._pool.length > 0) {
2568
+ let e = q._pool.pop();
2547
2569
  return e.init(this.media), e;
2548
2570
  }
2549
2571
  return this.media.create();
2550
2572
  }
2551
2573
  _poolInstance(e) {
2552
- e.destroy(), K._pool.indexOf(e) < 0 && K._pool.push(e);
2574
+ e.destroy(), q._pool.indexOf(e) < 0 && q._pool.push(e);
2553
2575
  }
2554
- }, q = K;
2555
- q._pool = [];
2576
+ }, J = q;
2577
+ J._pool = [];
2556
2578
  //#endregion
2557
2579
  //#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/webaudio/WebAudioContext.mjs
2558
- var Xt = class e extends Kt {
2580
+ var Yt = class e extends Gt {
2559
2581
  constructor() {
2560
2582
  let t = window, n = new e.AudioContext(), r = n.createDynamicsCompressor(), a = n.createAnalyser();
2561
2583
  a.connect(r), r.connect(n.destination), super(a, r), this.autoPause = !0, this._ctx = n, this._offlineCtx = new e.OfflineAudioContext(1, 2, t.OfflineAudioContext ? Math.max(8e3, Math.min(96e3, n.sampleRate)) : 44100), this.compressor = r, this.analyser = a, this.events = new i(), this.volume = 1, this.speed = 1, this.muted = !1, this.paused = !1, this._locked = n.state === "suspended" && ("ontouchstart" in globalThis || "onclick" in globalThis), this._locked && (this._unlock(), this._unlock = this._unlock.bind(this), document.addEventListener("mousedown", this._unlock, !0), document.addEventListener("touchstart", this._unlock, !0), document.addEventListener("touchend", this._unlock, !0)), this.onFocus = this.onFocus.bind(this), this.onBlur = this.onBlur.bind(this), globalThis.addEventListener("focus", this.onFocus), globalThis.addEventListener("blur", this.onBlur);
@@ -2620,12 +2642,12 @@ var Xt = class e extends Kt {
2620
2642
  }, n);
2621
2643
  r && r.catch(n);
2622
2644
  }
2623
- }, Zt = class {
2645
+ }, Xt = class {
2624
2646
  constructor() {
2625
2647
  this.init();
2626
2648
  }
2627
2649
  init() {
2628
- return this.supported && (this._webAudioContext = new Xt()), this._htmlAudioContext = new It(), this._sounds = {}, this.useLegacy = !this.supported, this;
2650
+ return this.supported && (this._webAudioContext = new Yt()), this._htmlAudioContext = new It(), this._sounds = {}, this.useLegacy = !this.supported, this;
2629
2651
  }
2630
2652
  get context() {
2631
2653
  return this._context;
@@ -2637,7 +2659,7 @@ var Xt = class e extends Kt {
2637
2659
  this.useLegacy || (this._context.filters = e);
2638
2660
  }
2639
2661
  get supported() {
2640
- return Xt.AudioContext !== null;
2662
+ return Yt.AudioContext !== null;
2641
2663
  }
2642
2664
  add(e, t) {
2643
2665
  if (typeof e == "object") {
@@ -2648,8 +2670,8 @@ var Xt = class e extends Kt {
2648
2670
  }
2649
2671
  return n;
2650
2672
  }
2651
- if (console.assert(!this._sounds[e], `Sound with alias ${e} already exists.`), t instanceof q) return this._sounds[e] = t, t;
2652
- let n = this._getOptions(t), r = q.from(n);
2673
+ if (console.assert(!this._sounds[e], `Sound with alias ${e} already exists.`), t instanceof J) return this._sounds[e] = t, t;
2674
+ let n = this._getOptions(t), r = J.from(n);
2653
2675
  return this._sounds[e] = r, r;
2654
2676
  }
2655
2677
  _getOptions(e, t) {
@@ -2749,14 +2771,14 @@ var Xt = class e extends Kt {
2749
2771
  close() {
2750
2772
  return this.removeAll(), this._sounds = null, this._webAudioContext &&= (this._webAudioContext.destroy(), null), this._htmlAudioContext &&= (this._htmlAudioContext.destroy(), null), this._context = null, this;
2751
2773
  }
2752
- }, Qt = (e) => {
2774
+ }, Zt = (e) => {
2753
2775
  let t = e.src, n = e?.alias?.[0];
2754
2776
  return (!n || e.src === n) && (n = f.basename(t, f.extname(t))), n;
2755
- }, $t = {
2777
+ }, Qt = {
2756
2778
  extension: a.Asset,
2757
2779
  detection: {
2758
2780
  test: async () => !0,
2759
- add: async (e) => [...e, ...W.filter((e) => G[e])],
2781
+ add: async (e) => [...e, ...G.filter((e) => K[e])],
2760
2782
  remove: async (e) => e.filter((t) => e.includes(t))
2761
2783
  },
2762
2784
  loader: {
@@ -2766,10 +2788,10 @@ var Xt = class e extends Kt {
2766
2788
  priority: s.High
2767
2789
  },
2768
2790
  test(e) {
2769
- return !!G[f.extname(e).slice(1)] || Ht.some((t) => e.startsWith(`data:${t}`));
2791
+ return !!K[f.extname(e).slice(1)] || Vt.some((t) => e.startsWith(`data:${t}`));
2770
2792
  },
2771
2793
  async load(e, t) {
2772
- let n = await new Promise((n, r) => q.from({
2794
+ let n = await new Promise((n, r) => J.from({
2773
2795
  ...t.data,
2774
2796
  url: e,
2775
2797
  preload: !0,
@@ -2777,20 +2799,20 @@ var Xt = class e extends Kt {
2777
2799
  e ? r(e) : n(i), t.data?.loaded?.(e, i);
2778
2800
  }
2779
2801
  }));
2780
- return B().add(Qt(t), n), n;
2802
+ return B().add(Zt(t), n), n;
2781
2803
  },
2782
2804
  async unload(e, t) {
2783
- B().remove(Qt(t));
2805
+ B().remove(Zt(t));
2784
2806
  }
2785
2807
  }
2786
2808
  };
2787
- ee.add($t);
2809
+ ee.add(Qt);
2788
2810
  //#endregion
2789
2811
  //#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/index.mjs
2790
- var J = Pt(new Zt());
2812
+ var Y = Pt(new Xt());
2791
2813
  //#endregion
2792
2814
  //#region src/plugins/audio/AudioManagerPlugin.ts
2793
- J.add = function(e, t) {
2815
+ Y.add = function(e, t) {
2794
2816
  if (typeof e == "object") {
2795
2817
  let n = {};
2796
2818
  for (let r in e) {
@@ -2799,16 +2821,16 @@ J.add = function(e, t) {
2799
2821
  }
2800
2822
  return n;
2801
2823
  }
2802
- if (t instanceof q) return this._sounds[e] = t, t;
2803
- let n = this._getOptions(t), r = q.from(n);
2824
+ if (t instanceof J) return this._sounds[e] = t, t;
2825
+ let n = this._getOptions(t), r = J.from(n);
2804
2826
  return this._sounds[e] = r, r;
2805
2827
  };
2806
- var en = class extends M {
2828
+ var $t = class extends N {
2807
2829
  constructor(e = "audio") {
2808
- super(e), this.onSoundStarted = new A(), this.onSoundEnded = new A(), this.onMuted = new A(), this.onMasterVolumeChanged = new A(), this.onChannelVolumeChanged = new A(), this.onChannelMuted = new A(), this._storedVolume = void 0, this._paused = !1, this._idMap = /* @__PURE__ */ new Map(), this._masterVolume = 1, this._muted = !1, this._channels = /* @__PURE__ */ new Map(), this.createChannel("music"), this.createChannel("sfx"), this.createChannel("voiceover");
2830
+ super(e), this.onSoundStarted = new j(), this.onSoundEnded = new j(), this.onMuted = new j(), this.onMasterVolumeChanged = new j(), this.onChannelVolumeChanged = new j(), this.onChannelMuted = new j(), this._storedVolume = void 0, this._paused = !1, this._idMap = /* @__PURE__ */ new Map(), this._masterVolume = 1, this._muted = !1, this._channels = /* @__PURE__ */ new Map(), this.createChannel("music"), this.createChannel("sfx"), this.createChannel("voiceover");
2809
2831
  }
2810
2832
  get audioContext() {
2811
- return J.context?.audioContext;
2833
+ return Y.context?.audioContext;
2812
2834
  }
2813
2835
  get masterVolume() {
2814
2836
  return this._masterVolume;
@@ -2843,11 +2865,11 @@ var en = class extends M {
2843
2865
  }), this._channels.clear(), this.onSoundStarted.disconnectAll(), this.onSoundEnded.disconnectAll(), this.onMuted.disconnectAll(), this.onMasterVolumeChanged.disconnectAll(), this.onChannelVolumeChanged.disconnectAll(), this.onChannelMuted.disconnectAll(), super.destroy();
2844
2866
  }
2845
2867
  initialize(e, t) {
2846
- return J.disableAutoPause = !0, typeof t?.manifest == "object" && this.addAllFromManifest(t.manifest), Promise.resolve();
2868
+ return Y.disableAutoPause = !0, typeof t?.manifest == "object" && this.addAllFromManifest(t.manifest), Promise.resolve();
2847
2869
  }
2848
2870
  createChannel(e) {
2849
2871
  if (this._channels.has(e)) throw Error(`Channel with name ${e} already exists.`);
2850
- let t = new Mt(e, this);
2872
+ let t = new jt(e, this);
2851
2873
  this._channels.set(e, t);
2852
2874
  }
2853
2875
  setChannelVolume(e, t) {
@@ -2897,8 +2919,8 @@ var en = class extends M {
2897
2919
  if (Array.isArray(e.alias) || (t = [e.alias]), !t) return;
2898
2920
  let n = {}, r = !1;
2899
2921
  t.forEach((t) => {
2900
- t === void 0 || J.exists(t) || (n[t] = e.src, r = !0);
2901
- }), r && J.add(n);
2922
+ t === void 0 || Y.exists(t) || (n[t] = e.src, r = !0);
2923
+ }), r && Y.add(n);
2902
2924
  }
2903
2925
  isPlaying(e, t) {
2904
2926
  let n = this._channels.get(t);
@@ -2912,15 +2934,15 @@ var en = class extends M {
2912
2934
  let n = e?.destination;
2913
2935
  return !n?.context || n.context === t;
2914
2936
  });
2915
- return n.length !== e.length && S.error("AudioManager: ignoring filter(s) built on a different AudioContext — playing dry. Build filter nodes on `app.audio.audioContext` (an app bundling its own copy of @pixi/sound gets a separate context)."), n.length ? n : void 0;
2937
+ return n.length !== e.length && x.error("AudioManager: ignoring filter(s) built on a different AudioContext — playing dry. Build filter nodes on `app.audio.audioContext` (an app bundling its own copy of @pixi/sound gets a separate context)."), n.length ? n : void 0;
2916
2938
  }
2917
2939
  async play(e, t = "sfx", n) {
2918
2940
  this._idMap.has(e) && (e = this._idMap.get(e));
2919
2941
  let r = this._channels.get(t);
2920
2942
  if (r) {
2921
2943
  e = this._verifySoundId(e);
2922
- let i = r.add(e, new z(e, r, this)), a = (n?.volume ?? 1) * r.volume * this.masterVolume;
2923
- return i.media = await J.play(e, {
2944
+ let i = r.add(e, new Mt(e, r, this)), a = (n?.volume ?? 1) * r.volume * this.masterVolume;
2945
+ return i.media = await Y.play(e, {
2924
2946
  ...n,
2925
2947
  filters: this._usableFilters(n?.filters),
2926
2948
  volume: r.muted ? 0 : a,
@@ -2941,7 +2963,7 @@ var en = class extends M {
2941
2963
  }
2942
2964
  async fadeIn(e, t = "music", n) {
2943
2965
  let r = this._channels.get(t);
2944
- r && (e = this._verifySoundId(e)), r?.get(e) || await this.play(e, t, { volume: 0 }), n?.volume === 0 && S.warn("fadeIn volume is 0", e, t, n);
2966
+ r && (e = this._verifySoundId(e)), r?.get(e) || await this.play(e, t, { volume: 0 }), n?.volume === 0 && x.warn("fadeIn volume is 0", e, t, n);
2945
2967
  let i = Object.assign({
2946
2968
  volume: n?.volume ?? 1,
2947
2969
  duration: 1,
@@ -2950,7 +2972,7 @@ var en = class extends M {
2950
2972
  return this.fade(e, t, i);
2951
2973
  }
2952
2974
  async fadeOut(e, t = "music", n = { volume: 0 }) {
2953
- n ||= {}, n?.volume === void 0 && (n.volume = 0), n?.volume > 0 && S.warn("fadeOut volume should probably be 0", e, t, n);
2975
+ n ||= {}, n?.volume === void 0 && (n.volume = 0), n?.volume > 0 && x.warn("fadeOut volume should probably be 0", e, t, n);
2954
2976
  let r = Object.assign({
2955
2977
  volume: 0,
2956
2978
  duration: 1,
@@ -2978,7 +3000,7 @@ var en = class extends M {
2978
3000
  return null;
2979
3001
  }
2980
3002
  async restore() {
2981
- let e = J?.context?.audioContext;
3003
+ let e = Y?.context?.audioContext;
2982
3004
  e && await e.resume(), this.resume(), this._storedVolume !== void 0 && (this.masterVolume = this._storedVolume), this._channels.forEach((e) => {
2983
3005
  e.restore();
2984
3006
  }), this.muted = this._muted;
@@ -2998,12 +3020,12 @@ var en = class extends M {
2998
3020
  let e = this._channels.get(t);
2999
3021
  if (e) {
3000
3022
  r = this._verifySoundId(r);
3001
- let t = J.find(r);
3023
+ let t = Y.find(r);
3002
3024
  t.options = {
3003
3025
  ...n,
3004
3026
  autoPlay: !1
3005
3027
  };
3006
- let i = e.add(r, new z(r, e, this));
3028
+ let i = e.add(r, new Mt(r, e, this));
3007
3029
  i.media = t.instances[0], i.pause();
3008
3030
  } else throw Error(`Channel ${t} does not exist.`);
3009
3031
  }
@@ -3025,7 +3047,7 @@ var en = class extends M {
3025
3047
  });
3026
3048
  }
3027
3049
  });
3028
- } else J.stopAll();
3050
+ } else Y.stopAll();
3029
3051
  }
3030
3052
  getCoreSignals() {
3031
3053
  return [
@@ -3040,9 +3062,9 @@ var en = class extends M {
3040
3062
  _verifySoundId(e) {
3041
3063
  let n = e;
3042
3064
  if (this._idMap.has(e)) return this._idMap.get(e);
3043
- if (!J.exists(e)) if (J.exists(e + ".mp3")) e += ".mp3";
3044
- else if (J.exists(e + ".ogg")) e += ".ogg";
3045
- else if (J.exists(e + ".wav")) e += ".wav";
3065
+ if (!Y.exists(e)) if (Y.exists(e + ".mp3")) e += ".mp3";
3066
+ else if (Y.exists(e + ".ogg")) e += ".ogg";
3067
+ else if (Y.exists(e + ".wav")) e += ".wav";
3046
3068
  else {
3047
3069
  e = n;
3048
3070
  let r = t.get(e);
@@ -3076,10 +3098,10 @@ var en = class extends M {
3076
3098
  }
3077
3099
  }
3078
3100
  _setMuted() {
3079
- this._muted ? J.muteAll() : J.unmuteAll(), this.onMuted.emit(this._muted);
3101
+ this._muted ? Y.muteAll() : Y.unmuteAll(), this.onMuted.emit(this._muted);
3080
3102
  }
3081
3103
  _setPaused() {
3082
- this._paused ? J.pauseAll() : J.resumeAll();
3104
+ this._paused ? Y.pauseAll() : Y.resumeAll();
3083
3105
  }
3084
3106
  _setChannelVolume(e, t) {
3085
3107
  let n = this._channels.get(e);
@@ -3100,9 +3122,9 @@ var en = class extends M {
3100
3122
  channelName: n
3101
3123
  });
3102
3124
  }
3103
- }, tn = class extends n {
3125
+ }, en = class extends n {
3104
3126
  constructor(e) {
3105
- super(), g(this), this._config = {
3127
+ super(), _(this), this._config = {
3106
3128
  color: 65535,
3107
3129
  shape: "rounded rectangle",
3108
3130
  radius: 8,
@@ -3143,7 +3165,7 @@ var en = class extends M {
3143
3165
  }
3144
3166
  this.position.set(e.x, e.y);
3145
3167
  }
3146
- }, nn = class {
3168
+ }, tn = class {
3147
3169
  constructor(e) {
3148
3170
  this.id = e, this.currentFocusable = null, this.lastFocusable = null, this.defaultFocusable = null, this._focusables = [], this._currentIndex = 0, this._current = !1;
3149
3171
  }
@@ -3187,9 +3209,9 @@ var en = class extends M {
3187
3209
  prev() {
3188
3210
  return --this._currentIndex, this._currentIndex < 0 && (this._currentIndex = this._focusables.length - 1), this.currentFocusable = this._focusables[this._currentIndex], this.availableFocusables.length === 0 ? null : this.currentFocusable.focusEnabled ? this.currentFocusable : this.prev();
3189
3211
  }
3190
- }, rn = class extends M {
3212
+ }, nn = class extends N {
3191
3213
  constructor(...e) {
3192
- super(...e), this.id = "focus", this.view = new n({ label: "FocusManager" }), this.onFocusManagerActivated = new A(), this.onFocusManagerDeactivated = new A(), this.onFocusLayerChange = new A(), this.onFocusChange = new A(), this._focusTarget = null, this._keyboardActive = !1, this._layers = /* @__PURE__ */ new Map(), this._currentLayerId = null, this._active = !1, this._enabled = !0;
3214
+ super(...e), this.id = "focus", this.view = new n({ label: "FocusManager" }), this.onFocusManagerActivated = new j(), this.onFocusManagerDeactivated = new j(), this.onFocusLayerChange = new j(), this.onFocusChange = new j(), this._focusTarget = null, this._keyboardActive = !1, this._layers = /* @__PURE__ */ new Map(), this._currentLayerId = null, this._active = !1, this._enabled = !0;
3193
3215
  }
3194
3216
  get layers() {
3195
3217
  return this._layers;
@@ -3216,9 +3238,9 @@ var en = class extends M {
3216
3238
  this._getCurrentLayer()?.sortFocusablesByPosition();
3217
3239
  }
3218
3240
  initialize(e, t) {
3219
- ge(this, "removeAllFocusLayers", "_handleGlobalMouseMove", "_handleGlobalPointerDown");
3241
+ he(this, "removeAllFocusLayers", "_handleGlobalMouseMove", "_handleGlobalPointerDown");
3220
3242
  let n = t.config?.focus || {};
3221
- n.usePixiAccessibility = n.usePixiAccessibility ?? !1, this._focusOutliner = typeof n?.outliner == "function" ? new n.outliner() : new tn(n.outliner), this._options = n, this.view.addChild(this._focusOutliner), this._updatePixiAccessibility(), this._setupKeyboardListeners(), this._setupAppListeners();
3243
+ n.usePixiAccessibility = n.usePixiAccessibility ?? !1, this._focusOutliner = typeof n?.outliner == "function" ? new n.outliner() : new en(n.outliner), this._options = n, this.view.addChild(this._focusOutliner), this._updatePixiAccessibility(), this._setupKeyboardListeners(), this._setupAppListeners();
3222
3244
  }
3223
3245
  destroy() {
3224
3246
  this._removeGlobalListeners(), this.deactivate(), this._focusOutliner.destroy(), this._layers.clear(), super.destroy();
@@ -3233,7 +3255,7 @@ var en = class extends M {
3233
3255
  (t === void 0 || t == null) && (t = this._currentLayerId ?? null);
3234
3256
  let r = this._layers.get(t);
3235
3257
  if (!r) {
3236
- S.error(`Layer with ID ${t} does not exist.`);
3258
+ x.error(`Layer with ID ${t} does not exist.`);
3237
3259
  return;
3238
3260
  }
3239
3261
  Array.isArray(e) || (e = [e]), e.forEach((e, t) => {
@@ -3260,12 +3282,12 @@ var en = class extends M {
3260
3282
  addFocusLayer(e, t = !0, n) {
3261
3283
  e === void 0 && (e = this._layers.size);
3262
3284
  let r;
3263
- return this._layers.has(e) ? (S.error(`Layer with ID ${e} already exists.`), r = this._layers.get(e)) : (r = new nn(e), this._layers.set(e, r)), (t || this._currentLayerId === null) && this.setFocusLayer(e), n && this.addFocusable(n, e), r;
3285
+ return this._layers.has(e) ? (x.error(`Layer with ID ${e} already exists.`), r = this._layers.get(e)) : (r = new tn(e), this._layers.set(e, r)), (t || this._currentLayerId === null) && this.setFocusLayer(e), n && this.addFocusable(n, e), r;
3264
3286
  }
3265
3287
  removeFocusLayer(e, t = !0) {
3266
3288
  if (e === void 0 && t) return this._removeTopLayer();
3267
- this._layers.has(e) || S.warn(`Layer with ID ${e} does not exist.`);
3268
- let n = Ee(this._layers, e)?.[0];
3289
+ this._layers.has(e) || x.warn(`Layer with ID ${e} does not exist.`);
3290
+ let n = De(this._layers, e)?.[0];
3269
3291
  this._layers.delete(e), this._postDelete(n);
3270
3292
  }
3271
3293
  restart(e = !1) {
@@ -3341,7 +3363,7 @@ var en = class extends M {
3341
3363
  _next() {
3342
3364
  let e = this._getCurrentLayer()?.next();
3343
3365
  if (!e) {
3344
- S.error("FocusManager:: _next():: No focusable found in the current layer.");
3366
+ x.error("FocusManager:: _next():: No focusable found in the current layer.");
3345
3367
  return;
3346
3368
  }
3347
3369
  this._setTarget(e);
@@ -3349,7 +3371,7 @@ var en = class extends M {
3349
3371
  _prev() {
3350
3372
  let e = this._getCurrentLayer()?.prev();
3351
3373
  if (!e) {
3352
- S.error("FocusManager:: _prev():: No focusable found in the current layer.");
3374
+ x.error("FocusManager:: _prev():: No focusable found in the current layer.");
3353
3375
  return;
3354
3376
  }
3355
3377
  this._setTarget(e);
@@ -3367,7 +3389,7 @@ var en = class extends M {
3367
3389
  return this._currentLayerId == null ? null : this._layers.get(this._currentLayerId) || null;
3368
3390
  }
3369
3391
  _removeTopLayer() {
3370
- let e = Oe(this._layers)?.[0], t = Ee(this._layers, e)?.[0];
3392
+ let e = ke(this._layers)?.[0], t = De(this._layers, e)?.[0];
3371
3393
  e !== void 0 && (this._layers.delete(e), this._postDelete(t));
3372
3394
  }
3373
3395
  _postDelete(e) {
@@ -3377,7 +3399,7 @@ var en = class extends M {
3377
3399
  let n = this._getCurrentLayer(), r = this._focusTarget;
3378
3400
  if (this._focusTarget = e, r && this._active && this._clearFocusTarget(r), this.app.renderer.accessibility.isActive || this._keyboardActive) this._focusTarget ? (this._active ||= !0, this._options.usePixiAccessibility && !this._focusTarget._accessibleDiv && this.app.renderer.accessibility.postrender(), this._options.usePixiAccessibility && this.app.ticker.addOnce(() => {
3379
3401
  this._focusTarget?._accessibleDiv?.focus();
3380
- }), n?.hasFocusable(e) ? this._focusTarget && (this._focusTarget.focusIn(), this._focusTarget.isFocused = !0, this._focusTarget.onFocusIn.emit(this._focusTarget), n.setCurrentFocusable(this._focusTarget), this._updateOutliner()) : S.warn("The focusable", e, `does not exist on the current focus layer: ${this._currentLayerId}`)) : this._focusOutliner.clear();
3402
+ }), n?.hasFocusable(e) ? this._focusTarget && (this._focusTarget.focusIn(), this._focusTarget.isFocused = !0, this._focusTarget.onFocusIn.emit(this._focusTarget), n.setCurrentFocusable(this._focusTarget), this._updateOutliner()) : x.warn("The focusable", e, `does not exist on the current focus layer: ${this._currentLayerId}`)) : this._focusOutliner.clear();
3381
3403
  else if (this._focusOutliner.clear(), this._active && t) {
3382
3404
  this._active = !1, this.onFocusManagerDeactivated.emit();
3383
3405
  return;
@@ -3411,8 +3433,8 @@ var en = class extends M {
3411
3433
  _updateOutliner() {
3412
3434
  this._focusTarget ? this._focusOutliner.draw(this._focusTarget) : this._focusOutliner.clear();
3413
3435
  }
3414
- }, an = .01;
3415
- function Y(e) {
3436
+ }, rn = .01;
3437
+ function X(e) {
3416
3438
  let t = e.length;
3417
3439
  if (t === 0) return {
3418
3440
  centerX: 0,
@@ -3429,24 +3451,24 @@ function Y(e) {
3429
3451
  spread: o / t
3430
3452
  };
3431
3453
  }
3432
- function on(e, t) {
3454
+ function an(e, t) {
3433
3455
  return {
3434
3456
  dx: t.centerX - e.centerX,
3435
3457
  dy: t.centerY - e.centerY,
3436
- scale: e.spread < an ? 1 : t.spread / e.spread
3458
+ scale: e.spread < rn ? 1 : t.spread / e.spread
3437
3459
  };
3438
3460
  }
3439
3461
  //#endregion
3440
3462
  //#region src/plugins/gesture/types.ts
3441
- var sn = {
3463
+ var on = {
3442
3464
  enabled: !0,
3443
3465
  pointerTypes: ["touch"],
3444
3466
  pinchThreshold: 8,
3445
3467
  panThreshold: 8,
3446
3468
  preventDefault: !0
3447
- }, cn = .01, ln = class extends M {
3469
+ }, sn = .01, cn = class extends N {
3448
3470
  constructor(...e) {
3449
- super(...e), this.id = "gesture", this.onGestureStart = new A(), this.onGestureChange = new A(), this.onGestureEnd = new A(), this._pointers = /* @__PURE__ */ new Map(), this._state = "idle", this._startFrame = null, this._lastFrame = null, this._canvas = null, this._previousTouchAction = "", this._onPointerDown = (e) => {
3471
+ super(...e), this.id = "gesture", this.onGestureStart = new j(), this.onGestureChange = new j(), this.onGestureEnd = new j(), this._pointers = /* @__PURE__ */ new Map(), this._state = "idle", this._startFrame = null, this._lastFrame = null, this._canvas = null, this._previousTouchAction = "", this._onPointerDown = (e) => {
3450
3472
  if (!this._options.pointerTypes.includes(e.pointerType)) return;
3451
3473
  let t = this._state, n = this._pointers.size >= 2;
3452
3474
  if (this._pointers.set(e.pointerId, {
@@ -3454,9 +3476,9 @@ var sn = {
3454
3476
  x: e.clientX,
3455
3477
  y: e.clientY
3456
3478
  }), this._state === "idle" && this._pointers.size === 2) {
3457
- let e = Y([...this._pointers.values()]);
3479
+ let e = X([...this._pointers.values()]);
3458
3480
  this._startFrame = e, this._lastFrame = e, this._state = "pending";
3459
- } else this._state !== "idle" && n && (this._lastFrame = Y([...this._pointers.values()]));
3481
+ } else this._state !== "idle" && n && (this._lastFrame = X([...this._pointers.values()]));
3460
3482
  this._maybePreventDefault(e, t, this._state);
3461
3483
  }, this._onPointerMove = (e) => {
3462
3484
  if (!this._pointers.has(e.pointerId)) return;
@@ -3467,16 +3489,16 @@ var sn = {
3467
3489
  });
3468
3490
  let t = this._state;
3469
3491
  if (this._pointers.size >= 2) {
3470
- let e = Y([...this._pointers.values()]);
3492
+ let e = X([...this._pointers.values()]);
3471
3493
  if (this._state === "pending") {
3472
- let t = on(this._lastFrame, e), n = Math.abs(e.spread - this._lastFrame.spread), r = Math.hypot(t.dx, t.dy);
3494
+ let t = an(this._lastFrame, e), n = Math.abs(e.spread - this._lastFrame.spread), r = Math.hypot(t.dx, t.dy);
3473
3495
  (n >= this._options.pinchThreshold || r >= this._options.panThreshold) && (this._lastFrame = e, this._state = "active", this.onGestureStart.emit({
3474
3496
  centerX: e.centerX,
3475
3497
  centerY: e.centerY,
3476
3498
  pointerCount: this._pointers.size
3477
3499
  }));
3478
3500
  } else if (this._state === "active") {
3479
- let t = on(this._lastFrame, e), n = this._computeTotalScale(e);
3501
+ let t = an(this._lastFrame, e), n = this._computeTotalScale(e);
3480
3502
  this._lastFrame = e, this.onGestureChange.emit({
3481
3503
  centerX: e.centerX,
3482
3504
  centerY: e.centerY,
@@ -3503,14 +3525,14 @@ var sn = {
3503
3525
  }
3504
3526
  async initialize(e = {}, t) {
3505
3527
  if (this._options = {
3506
- ...sn,
3528
+ ...on,
3507
3529
  ...e
3508
3530
  }, !this._options.enabled) return;
3509
3531
  let n = t.canvas;
3510
- this._canvas = n, this._options.preventDefault && (this._previousTouchAction = n.style.touchAction, n.style.touchAction = "none"), n.addEventListener("pointerdown", this._onPointerDown), window.addEventListener("pointermove", this._onPointerMove), window.addEventListener("pointerup", this._onPointerUp), window.addEventListener("pointercancel", this._onPointerCancel);
3532
+ this._canvas = n, this._options.preventDefault && (this._previousTouchAction = n.style.touchAction, n.style.touchAction = "none"), this.listen(n, "pointerdown", this._onPointerDown), this.listen(window, "pointermove", this._onPointerMove), this.listen(window, "pointerup", this._onPointerUp), this.listen(window, "pointercancel", this._onPointerCancel);
3511
3533
  }
3512
3534
  destroy() {
3513
- this._canvas &&= (this._canvas.removeEventListener("pointerdown", this._onPointerDown), this._options.preventDefault && (this._canvas.style.touchAction = this._previousTouchAction), null), window.removeEventListener("pointermove", this._onPointerMove), window.removeEventListener("pointerup", this._onPointerUp), window.removeEventListener("pointercancel", this._onPointerCancel), this._pointers.clear(), this._state = "idle", this._startFrame = null, this._lastFrame = null, this.onGestureStart.disconnectAll(), this.onGestureChange.disconnectAll(), this.onGestureEnd.disconnectAll(), super.destroy();
3535
+ this._canvas &&= (this._options.preventDefault && (this._canvas.style.touchAction = this._previousTouchAction), null), this._pointers.clear(), this._state = "idle", this._startFrame = null, this._lastFrame = null, this.onGestureStart.disconnectAll(), this.onGestureChange.disconnectAll(), this.onGestureEnd.disconnectAll(), super.destroy();
3514
3536
  }
3515
3537
  getCoreSignals() {
3516
3538
  return [
@@ -3526,21 +3548,21 @@ var sn = {
3526
3548
  centerX: this._lastFrame.centerX,
3527
3549
  centerY: this._lastFrame.centerY,
3528
3550
  totalScale: this._computeTotalScale(this._lastFrame)
3529
- }), this._state = "idle", this._startFrame = null, this._lastFrame = null) : this._state !== "idle" && (this._lastFrame = Y([...this._pointers.values()])), this._maybePreventDefault(e, t, this._state);
3551
+ }), this._state = "idle", this._startFrame = null, this._lastFrame = null) : this._state !== "idle" && (this._lastFrame = X([...this._pointers.values()])), this._maybePreventDefault(e, t, this._state);
3530
3552
  }
3531
3553
  _computeTotalScale(e) {
3532
- return !this._startFrame || this._startFrame.spread < cn ? 1 : e.spread / this._startFrame.spread;
3554
+ return !this._startFrame || this._startFrame.spread < sn ? 1 : e.spread / this._startFrame.spread;
3533
3555
  }
3534
3556
  _maybePreventDefault(e, t, n) {
3535
3557
  this._options.preventDefault && (t !== "idle" || n !== "idle") && e.preventDefault();
3536
3558
  }
3537
- }, un = {
3559
+ }, ln = {
3538
3560
  defaultLocale: "en",
3539
3561
  locales: ["en"],
3540
3562
  loadAll: !1,
3541
3563
  files: []
3542
3564
  };
3543
- function dn(e, t) {
3565
+ function un(e, t) {
3544
3566
  if (t in e) return e[t];
3545
3567
  if (!t.includes(".")) return;
3546
3568
  let n = e;
@@ -3548,9 +3570,9 @@ function dn(e, t) {
3548
3570
  else return;
3549
3571
  return n;
3550
3572
  }
3551
- var fn = class extends M {
3573
+ var dn = class extends N {
3552
3574
  constructor(...e) {
3553
- super(...e), this.id = "i18n", this.onLocaleChanged = new A(), this._dicts = {};
3575
+ super(...e), this.id = "i18n", this.onLocaleChanged = new j(), this._dicts = {};
3554
3576
  }
3555
3577
  get locale() {
3556
3578
  return this._locale;
@@ -3560,7 +3582,7 @@ var fn = class extends M {
3560
3582
  }
3561
3583
  async initialize(e) {
3562
3584
  if (this._options = {
3563
- ...un,
3585
+ ...ln,
3564
3586
  ...e
3565
3587
  }, this._locale = this._options.defaultLocale, this._options.loadAll && this._options.files.length > 0) {
3566
3588
  let e = this._options.files.filter((e) => this._options.locales.includes(e.id));
@@ -3572,9 +3594,9 @@ var fn = class extends M {
3572
3594
  }
3573
3595
  t(e, t, n = this._locale) {
3574
3596
  let r = this._dicts[n];
3575
- if (!r) return S.error(`i18n:: No dictionary loaded for current locale: ${n}`), e;
3576
- let i = dn(r, e), a = typeof i == "string" ? i : void 0;
3577
- if (!a) return S.error(`i18n:: No result found for the key ${e} in the locale: ${this._locale}`), e;
3597
+ if (!r) return x.error(`i18n:: No dictionary loaded for current locale: ${n}`), e;
3598
+ let i = un(r, e), a = typeof i == "string" ? i : void 0;
3599
+ if (!a) return x.error(`i18n:: No result found for the key ${e} in the locale: ${this._locale}`), e;
3578
3600
  let o = t?.variant;
3579
3601
  if (a = a.replace(/\[(.*?)\]/g, (e, t) => {
3580
3602
  let n = t.split("|");
@@ -3590,14 +3612,14 @@ var fn = class extends M {
3590
3612
  }
3591
3613
  tCount(e, t, n, r = this._locale) {
3592
3614
  let i = new Intl.PluralRules(r).select(t), a = this._dicts[r], o = `${e}.${i}`;
3593
- return (!a || typeof dn(a, o) != "string") && (o = `${e}.other`), this.t(o, {
3615
+ return (!a || typeof un(a, o) != "string") && (o = `${e}.other`), this.t(o, {
3594
3616
  count: t,
3595
3617
  ...n
3596
3618
  }, r);
3597
3619
  }
3598
3620
  parse(e, t = this._locale) {
3599
3621
  let n = this._dicts[t];
3600
- if (!n) return S.error(`i18n:: No dictionary loaded for current locale: ${this._locale}`), "";
3622
+ if (!n) return x.error(`i18n:: No dictionary loaded for current locale: ${this._locale}`), "";
3601
3623
  let r = e, i = r.match(/{(.*?)}/g);
3602
3624
  return i && i.forEach((e) => {
3603
3625
  let t = e.slice(1, -1);
@@ -3607,10 +3629,10 @@ var fn = class extends M {
3607
3629
  async loadLocale(e) {
3608
3630
  let n = this._options.files.find((t) => e === t.id);
3609
3631
  if (!n) {
3610
- S.error(`i18n:: Could not find locale file for ${e}`);
3632
+ x.error(`i18n:: Could not find locale file for ${e}`);
3611
3633
  return;
3612
3634
  }
3613
- this._dicts[e] = n.json ? await t.load(n.json) : await E(n);
3635
+ this._dicts[e] = n.json ? await t.load(n.json) : await T(n);
3614
3636
  }
3615
3637
  getCoreFunctions() {
3616
3638
  return [
@@ -3626,15 +3648,15 @@ var fn = class extends M {
3626
3648
  async _loadAndSetLocale(e) {
3627
3649
  this._dicts[e] || await this.loadLocale(e), this.onLocaleChanged.emit(e);
3628
3650
  }
3629
- }, X = /* @__PURE__ */ function(e) {
3651
+ }, Z = /* @__PURE__ */ function(e) {
3630
3652
  return e.Keyboard = "keyboard", e.GamePad = "gamepad", e.Mouse = "mouse", e.Touch = "touch", e;
3631
3653
  }({});
3632
3654
  //#endregion
3633
3655
  //#region src/mixins/signals.ts
3634
- function Z(e) {
3656
+ function fn(e) {
3635
3657
  return class extends e {
3636
3658
  constructor(...e) {
3637
- super(...e), this.signalConnections = new k.SignalConnections();
3659
+ super(...e), this.signalConnections = new A.SignalConnections();
3638
3660
  }
3639
3661
  addSignalConnection(...e) {
3640
3662
  for (let t of e) this.signalConnections.add(t);
@@ -3651,80 +3673,122 @@ function Z(e) {
3651
3673
  };
3652
3674
  }
3653
3675
  //#endregion
3654
- //#region src/plugins/input/AbstractControls.ts
3655
- var pn = class {
3656
- get app() {
3657
- return $.getInstance();
3676
+ //#region src/plugins/input/controlsCore.ts
3677
+ function pn(e, t) {
3678
+ return e === "*" ? !0 : Array.isArray(e) ? e.includes(t) : e === t;
3679
+ }
3680
+ function mn(e, t, n, r) {
3681
+ let i = [], a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
3682
+ return vn(e, t, n, r, (e, t) => {
3683
+ if (t.includes("+")) {
3684
+ let n = t.split("+");
3685
+ i.push(n), a.set(n, e);
3686
+ } else o.set(t, e);
3687
+ }), i.sort((e, t) => t.length - e.length), {
3688
+ combinations: i,
3689
+ combinationsMap: a,
3690
+ singles: o
3691
+ };
3692
+ }
3693
+ function hn(e, t, n, r) {
3694
+ let i = /* @__PURE__ */ new Map();
3695
+ return vn(e, t, n, r, (e, t) => {
3696
+ i.set(t, e);
3697
+ }), i;
3698
+ }
3699
+ function gn(e, t, n = t) {
3700
+ return e.includes("+") ? e.split("+").every((e) => n(e)) : t(e);
3701
+ }
3702
+ function _n(e, t) {
3703
+ let n = [], r = /* @__PURE__ */ new Set();
3704
+ for (let i = 0; i < e.length; i++) {
3705
+ let a = e[i];
3706
+ a.some((e) => r.has(e)) || a.every((e) => t(e)) && (a.forEach((e) => r.add(e)), n.push(a));
3658
3707
  }
3659
- initialize(e) {
3660
- this.scheme = e;
3708
+ return {
3709
+ fired: n,
3710
+ eliminated: r
3711
+ };
3712
+ }
3713
+ function vn(e, t, n, r, i) {
3714
+ e && Object.keys(e).forEach((a) => {
3715
+ let o = t[a];
3716
+ if (!o) {
3717
+ r(a);
3718
+ return;
3719
+ }
3720
+ if (!pn(o.context, n)) return;
3721
+ let s = e[a];
3722
+ s && (Array.isArray(s) ? s : [s]).forEach((e) => i(a, e));
3723
+ });
3724
+ }
3725
+ //#endregion
3726
+ //#region src/plugins/input/AbstractControls.ts
3727
+ var yn = class {
3728
+ static {
3729
+ this.__caper_method_binding_root = !0;
3661
3730
  }
3662
3731
  destroy() {}
3663
- }, mn = class extends Z(pn) {
3664
- constructor() {
3665
- super(), this._keyCombinations = [], this._singleDownKeys = /* @__PURE__ */ new Set(), this._keyCombinationsMap = /* @__PURE__ */ new Map(), this._activeDownKeys = /* @__PURE__ */ new Map(), this._activeUpKeys = /* @__PURE__ */ new Map(), this._warnedMissingActions = /* @__PURE__ */ new Set(), g(this);
3732
+ }, bn = class extends fn(yn) {
3733
+ constructor(...e) {
3734
+ super(...e), this.combinations = [], this.combinationsMap = /* @__PURE__ */ new Map(), this.activeDownInputs = /* @__PURE__ */ new Map(), this.activeUpInputs = /* @__PURE__ */ new Map(), this._warnedMissingActions = /* @__PURE__ */ new Set();
3666
3735
  }
3667
3736
  get app() {
3668
3737
  return $.getInstance();
3669
3738
  }
3670
- isActionActive(e) {
3671
- let t = this.scheme.down?.[e] ?? null;
3672
- return t ? Array.isArray(t) ? t.some((e) => this._isInputActive(e)) : this._isInputActive(t) : !1;
3673
- }
3674
3739
  initialize(e) {
3675
- super.initialize(e), this._keyDownMap = e.down || {}, this._keyUpMap = e.up || {}, this._sortActions();
3740
+ this.scheme = e, this.addSignalConnection(this.app.signal.onActionContextChanged.connect(this._sortActions)), this._sortActions();
3676
3741
  }
3677
3742
  connect() {
3678
- this.addSignalConnection(this.app.signal.onActionContextChanged.connect(this._handleContextChanged), this.app.keyboard.onKeyDown().connect(this._handleKeyDown), this.app.keyboard.onKeyUp().connect(this._handleKeyUp)), this._handleContextChanged(), this.app.ticker.add(this._update);
3743
+ this.app.ticker.add(this._update);
3679
3744
  }
3680
3745
  destroy() {
3681
3746
  this.app.ticker.remove(this._update), super.destroy();
3682
3747
  }
3748
+ isActionActive(e) {
3749
+ let t = this.scheme?.down?.[e] ?? null;
3750
+ return t ? Array.isArray(t) ? t.some((e) => this._isInputActive(e)) : this._isInputActive(t) : !1;
3751
+ }
3752
+ get downSection() {
3753
+ return this.scheme?.down;
3754
+ }
3755
+ get upSection() {
3756
+ return this.scheme?.up;
3757
+ }
3758
+ isComboPartDown(e) {
3759
+ return this.isInputDown(e);
3760
+ }
3683
3761
  _isInputActive(e) {
3684
- return e.includes("+") ? e.split("+").every((e) => this._singleDownKeys.has(e)) : this._singleDownKeys.has(e);
3762
+ return gn(e, this.isInputDown, this.isComboPartDown);
3763
+ }
3764
+ _sortActions() {
3765
+ let e = this.app.actionsPlugin.getActions(), t = this.app.actionContext, { combinations: n, combinationsMap: r, singles: i } = mn(this.downSection, e, t, this._warnMissingAction);
3766
+ this.combinations = n, this.combinationsMap = r, this.activeDownInputs = i, this.activeUpInputs = hn(this.upSection, e, t, this._warnMissingAction);
3685
3767
  }
3686
3768
  _warnMissingAction(e) {
3687
- this._warnedMissingActions.has(e) || (this._warnedMissingActions.add(e), S.warn(`KeyboardControls: scheme references unknown action "${e}"`));
3769
+ this._warnedMissingActions.has(e) || (this._warnedMissingActions.add(e), x.warn(`${this.logLabel}: scheme references unknown action "${e}"`));
3688
3770
  }
3689
- _sortActions() {
3690
- let e = this.app.actionsPlugin.getActions();
3691
- this._keyCombinations = [], this._keyCombinationsMap.clear(), this._activeDownKeys.clear(), this._activeUpKeys.clear();
3692
- let t = Object.keys(this._keyDownMap);
3693
- t.forEach((t) => {
3694
- let n = this._keyDownMap[t], r = e[t];
3695
- if (!r) {
3696
- this._warnMissingAction(t);
3697
- return;
3698
- }
3699
- if (r.context !== "*" && r.context !== this.app.actionContext && !r.context.includes(this.app.actionContext)) return;
3700
- let i = n;
3701
- i && (Array.isArray(i) || (i = [i]), i.forEach((e) => {
3702
- if (e.includes("+")) {
3703
- let n = e.split("+");
3704
- this._keyCombinations.push(n), this._keyCombinationsMap.set(n, t);
3705
- } else this._activeDownKeys.set(e, t);
3706
- }));
3707
- }), this._keyCombinations.sort((e, t) => t.length - e.length), t = Object.keys(this._keyUpMap), t.forEach((e) => {
3708
- let t = this._keyUpMap[e];
3709
- t && (Array.isArray(t) || (t = [t]), t.forEach((t) => {
3710
- this._activeUpKeys.set(t, e);
3711
- }));
3712
- });
3771
+ }, xn = class extends bn {
3772
+ constructor() {
3773
+ super(), this.logLabel = "KeyboardControls", this._singleDownKeys = /* @__PURE__ */ new Set(), _(this);
3713
3774
  }
3714
- _handleContextChanged() {
3715
- this._getPossibleActions();
3775
+ initialize(e) {
3776
+ super.initialize(e);
3777
+ }
3778
+ connect() {
3779
+ this.addSignalConnection(this.app.keyboard.onKeyDown().connect(this._handleKeyDown), this.app.keyboard.onKeyUp().connect(this._handleKeyUp)), super.connect();
3716
3780
  }
3717
- _getPossibleActions() {
3718
- this._sortActions();
3781
+ isInputDown(e) {
3782
+ return this._singleDownKeys.has(e);
3719
3783
  }
3720
3784
  _handleKeyDown(e) {
3721
- let t = P(e.event.key);
3785
+ let t = F(e.event.key);
3722
3786
  this._singleDownKeys.add(t);
3723
3787
  }
3724
3788
  _handleKeyUp(e) {
3725
- let t = P(e.event.key);
3789
+ let t = F(e.event.key);
3726
3790
  this._singleDownKeys.delete(t);
3727
- let n = this._activeUpKeys.get(t);
3791
+ let n = this.activeUpInputs.get(t);
3728
3792
  n && this.app.action(n, {
3729
3793
  combination: !1,
3730
3794
  inputState: "up",
@@ -3735,33 +3799,28 @@ var pn = class {
3735
3799
  if (!this.app.keyboard) return;
3736
3800
  let e = this.app.keyboard.keysDown;
3737
3801
  if (e.size === 0) return;
3738
- let t = /* @__PURE__ */ new Set();
3739
- for (let n = 0; n < this._keyCombinations.length; n++) {
3740
- let r = this._keyCombinations[n];
3741
- if (!r.some((e) => t.has(e)) && r.every((t) => e.has(t))) {
3742
- r.forEach((e) => t.add(e));
3743
- let e = this._keyCombinationsMap.get(r);
3744
- e && this.app.action(e, {
3745
- key: r,
3746
- combination: !0,
3747
- inputState: "down"
3748
- });
3749
- }
3750
- }
3751
- this._singleDownKeys.forEach((n) => {
3752
- if (!t.has(n) && e.has(n)) {
3753
- let e = this._activeDownKeys.get(n);
3802
+ let { fired: t, eliminated: n } = _n(this.combinations, (t) => e.has(t));
3803
+ t.forEach((e) => {
3804
+ let t = this.combinationsMap.get(e);
3805
+ t && this.app.action(t, {
3806
+ key: e,
3807
+ combination: !0,
3808
+ inputState: "down"
3809
+ });
3810
+ }), this._singleDownKeys.forEach((t) => {
3811
+ if (!n.has(t) && e.has(t)) {
3812
+ let e = this.activeDownInputs.get(t);
3754
3813
  e && this.app.action(e, {
3755
- key: n,
3814
+ key: t,
3756
3815
  combination: !1,
3757
3816
  inputState: "down"
3758
3817
  });
3759
3818
  }
3760
3819
  });
3761
3820
  }
3762
- }, hn = class extends Z(pn) {
3821
+ }, Sn = class extends bn {
3763
3822
  constructor() {
3764
- super(), this._buttons = /* @__PURE__ */ new Set(), this._combinations = [], this._singleDownButtons = /* @__PURE__ */ new Set(), this._activeJoystickDirections = /* @__PURE__ */ new Map(), this._activeButtonDownIds = /* @__PURE__ */ new Map(), this._activeButtonUpIds = /* @__PURE__ */ new Map(), this._combinationsMap = /* @__PURE__ */ new Map(), this._buttonConnections = /* @__PURE__ */ new Map(), this._warnedMissingActions = /* @__PURE__ */ new Set(), g(this);
3823
+ super(), this.logLabel = "VirtualControls", this._buttons = /* @__PURE__ */ new Set(), this._singleDownButtons = /* @__PURE__ */ new Set(), this._activeJoystickDirections = /* @__PURE__ */ new Map(), this._buttonConnections = /* @__PURE__ */ new Map(), _(this);
3765
3824
  }
3766
3825
  get joystick() {
3767
3826
  return this._joystick;
@@ -3769,9 +3828,6 @@ var pn = class {
3769
3828
  set joystick(e) {
3770
3829
  this._joystick = e;
3771
3830
  }
3772
- get app() {
3773
- return $.getInstance();
3774
- }
3775
3831
  addButton(e) {
3776
3832
  if (!e || this._buttons.has(e)) return;
3777
3833
  let t = [
@@ -3786,58 +3842,26 @@ var pn = class {
3786
3842
  !e || !this._buttons.has(e) || (this._buttonConnections.get(e)?.forEach((e) => e.disconnect()), this._buttonConnections.delete(e), this._singleDownButtons.delete(e.id), this._buttons.delete(e));
3787
3843
  }
3788
3844
  initialize(e) {
3789
- super.initialize(e), this._buttonDownMap = e.down || {}, this._buttonUpMap = e.up || {}, this._joystickMap = e.joystick || {}, this.addSignalConnection(this.app.signal.onActionContextChanged.connect(this._sortActions)), this._sortActions();
3790
- }
3791
- connect() {
3792
- this.app.ticker.add(this._update);
3793
- }
3794
- destroy() {
3795
- this.app.ticker.remove(this._update), super.destroy();
3845
+ super.initialize(e);
3796
3846
  }
3797
3847
  isActionActive(e) {
3798
- let t = this.scheme.down?.[e] ?? null;
3799
- if (t) return Array.isArray(t) ? t.some((e) => this._isInputActive(e)) : this._isInputActive(t);
3800
- {
3801
- let t = this.scheme.joystick?.[e] ?? null;
3802
- if (this._joystick && t) return Array.isArray(t) ? t.includes(this._joystick.direction) : t === this._joystick?.direction;
3803
- }
3804
- return !1;
3848
+ if (this.scheme.down?.[e] ?? null) return super.isActionActive(e);
3849
+ let t = this.scheme.joystick?.[e] ?? null;
3850
+ return this._joystick && t ? Array.isArray(t) ? t.includes(this._joystick.direction) : t === this._joystick?.direction : !1;
3805
3851
  }
3806
- _isInputActive(e) {
3807
- return e.includes("+") ? e.split("+").every((e) => this._singleDownButtons.has(e) || this._joystick?.direction === e) : this._singleDownButtons.has(e);
3852
+ isInputDown(e) {
3853
+ return this._singleDownButtons.has(e);
3808
3854
  }
3809
- _warnMissingAction(e) {
3810
- this._warnedMissingActions.has(e) || (this._warnedMissingActions.add(e), S.warn(`VirtualControls: scheme references unknown action "${e}"`));
3855
+ isComboPartDown(e) {
3856
+ return this._singleDownButtons.has(e) || this._joystick?.direction === e;
3811
3857
  }
3812
3858
  _sortActions() {
3813
- let e = this.app.actionsPlugin.getActions();
3814
- this._combinations = [], this._combinationsMap.clear(), this._activeJoystickDirections.clear(), this._activeButtonDownIds.clear(), this._activeButtonUpIds.clear();
3815
- let t = Object.keys(this._buttonDownMap);
3816
- t.forEach((t) => {
3817
- let n = this._buttonDownMap[t], r = e[t];
3818
- if (!r) {
3819
- this._warnMissingAction(t);
3820
- return;
3821
- }
3822
- if (r.context !== "*" && r.context !== this.app.actionContext && !r.context.includes(this.app.actionContext)) return;
3823
- let i = n;
3824
- i && (Array.isArray(i) || (i = [i]), i.forEach((e) => {
3825
- if (e.includes("+")) {
3826
- let n = e.split("+");
3827
- this._combinations.push(n), this._combinationsMap.set(n, t);
3828
- } else this._activeButtonDownIds.set(e, t);
3829
- }));
3830
- }), this._combinations.sort((e, t) => t.length - e.length), t = Object.keys(this._buttonUpMap), t.forEach((t) => {
3831
- let n = this._buttonUpMap[t], r = e[t];
3832
- if (!r) {
3833
- this._warnMissingAction(t);
3834
- return;
3835
- }
3836
- r.context !== "*" && r.context !== this.app.actionContext && !r.context.includes(this.app.actionContext) || this._activeButtonUpIds.set(n, t);
3837
- }), Object.keys(this._joystickMap).forEach((e) => {
3838
- let t = this._joystickMap[e];
3839
- t && (Array.isArray(t) || (t = [t]), t.forEach((t) => {
3840
- this._activeJoystickDirections.set(t, e);
3859
+ super._sortActions(), this._activeJoystickDirections.clear();
3860
+ let e = this.scheme.joystick || {};
3861
+ Object.keys(e).forEach((t) => {
3862
+ let n = e[t];
3863
+ n && (Array.isArray(n) || (n = [n]), n.forEach((e) => {
3864
+ this._activeJoystickDirections.set(e, t);
3841
3865
  }));
3842
3866
  });
3843
3867
  }
@@ -3846,7 +3870,7 @@ var pn = class {
3846
3870
  }
3847
3871
  _handleButtonUp(e) {
3848
3872
  this._singleDownButtons.delete(e.id);
3849
- let t = this._activeButtonUpIds.get(e.id);
3873
+ let t = this.activeUpInputs.get(e.id);
3850
3874
  t && this.app.action(t, {
3851
3875
  combination: !1,
3852
3876
  inputState: "up",
@@ -3854,22 +3878,17 @@ var pn = class {
3854
3878
  });
3855
3879
  }
3856
3880
  _update() {
3857
- let e = this._joystick?.direction ?? null, t = this._singleDownButtons, n = /* @__PURE__ */ new Set();
3858
- for (let r = 0; r < this._combinations.length; r++) {
3859
- let i = this._combinations[r];
3860
- if (!i.some((e) => n.has(e)) && i.every((n) => t.has(n) || e === n)) {
3861
- i.forEach((e) => n.add(e));
3862
- let e = this._combinationsMap.get(i);
3863
- e && this.app.action(e, {
3864
- button: i,
3865
- combination: !0,
3866
- inputState: "down"
3867
- });
3868
- }
3869
- }
3870
- if (this._singleDownButtons.forEach((e) => {
3871
- if (!n.has(e) && t.has(e)) {
3872
- let t = this._activeButtonDownIds.get(e);
3881
+ let e = this._joystick?.direction ?? null, t = this._singleDownButtons, { fired: n, eliminated: r } = _n(this.combinations, (n) => t.has(n) || e === n);
3882
+ if (n.forEach((e) => {
3883
+ let t = this.combinationsMap.get(e);
3884
+ t && this.app.action(t, {
3885
+ button: e,
3886
+ combination: !0,
3887
+ inputState: "down"
3888
+ });
3889
+ }), this._singleDownButtons.forEach((e) => {
3890
+ if (!r.has(e) && t.has(e)) {
3891
+ let t = this.activeDownInputs.get(e);
3873
3892
  t && this.app.action(t, {
3874
3893
  button: e,
3875
3894
  combination: !1,
@@ -3881,9 +3900,9 @@ var pn = class {
3881
3900
  t && this.app.action(t, { inputState: "joystick" });
3882
3901
  }
3883
3902
  }
3884
- }, gn = class {
3903
+ }, Cn = class {
3885
3904
  constructor() {
3886
- g(this);
3905
+ _(this);
3887
3906
  }
3888
3907
  get app() {
3889
3908
  return $.getInstance();
@@ -3898,14 +3917,14 @@ var pn = class {
3898
3917
  return this.keyboard?.isActionActive(e) || this.touch?.isActionActive(e) || !1;
3899
3918
  }
3900
3919
  initialize(e) {
3901
- e.keyboard && (this.keyboard = new mn(), this.keyboard.initialize(e.keyboard)), e.touch && (this.touch = new hn(), this.touch.initialize(e.touch));
3920
+ e.keyboard && (this.keyboard = new xn(), this.keyboard.initialize(e.keyboard)), e.touch && (this.touch = new Sn(), this.touch.initialize(e.touch));
3902
3921
  }
3903
3922
  connect() {
3904
3923
  this.keyboard && this.keyboard.connect(), this.touch && this.touch.connect();
3905
3924
  }
3906
- }, _n = { actions: yt }, vn = class extends M {
3925
+ }, wn = { actions: vt }, Tn = class extends N {
3907
3926
  constructor(...e) {
3908
- super(...e), this.id = "input", this.controls = new gn(), this.activeGamepads = /* @__PURE__ */ new Map(), this.activeControllers = /* @__PURE__ */ new Set([]), this._lastUsedController = null, this._canvas = null, this.onGamepadConnected = new A(), this.onGamepadDisconnected = new A(), this.onControllerActivated = new A(), this.onControllerDeactivated = new A(), this.onControllerChanged = new A();
3927
+ super(...e), this.id = "input", this.controls = new Cn(), this.activeGamepads = /* @__PURE__ */ new Map(), this.activeControllers = /* @__PURE__ */ new Set([]), this._lastUsedController = null, this._canvas = null, this.onGamepadConnected = new j(), this.onGamepadDisconnected = new j(), this.onControllerActivated = new j(), this.onControllerDeactivated = new j(), this.onControllerChanged = new j();
3909
3928
  }
3910
3929
  get lastUsedController() {
3911
3930
  return this._lastUsedController;
@@ -3913,17 +3932,17 @@ var pn = class {
3913
3932
  isActionActive(e) {
3914
3933
  return this.controls.isActionActive(e);
3915
3934
  }
3916
- async initialize(e = _n, t) {
3935
+ async initialize(e = wn, t) {
3917
3936
  this._options = {
3918
- ..._n,
3937
+ ...wn,
3919
3938
  ...e
3920
- }, t.stage.eventMode = "static", this._canvas = t.canvas, this._canvas.addEventListener("pointerdown", this._onPointerDown), this._canvas.addEventListener("pointermove", this._onPointerMove), window.addEventListener("keydown", this._onKeyDown), window.addEventListener("gamepadconnected", this._onGamepadConnected), window.addEventListener("gamepaddisconnected", this._onGamepadDisconnected), this._options.controls && this.controls.initialize(this._options.controls);
3939
+ }, t.stage.eventMode = "static", this._canvas = t.canvas, this.listen(this._canvas, "pointerdown", this._onPointerDown), this.listen(this._canvas, "pointermove", this._onPointerMove), this.listen(window, "keydown", this._onKeyDown), this.listen(window, "gamepadconnected", this._onGamepadConnected), this.listen(window, "gamepaddisconnected", this._onGamepadDisconnected), this._options.controls && this.controls.initialize(this._options.controls);
3921
3940
  }
3922
3941
  postInitialize() {
3923
3942
  this.controls && this.controls.connect();
3924
3943
  }
3925
3944
  destroy() {
3926
- this._canvas &&= (this._canvas.removeEventListener("pointerdown", this._onPointerDown), this._canvas.removeEventListener("pointermove", this._onPointerMove), null), window.removeEventListener("keydown", this._onKeyDown), window.removeEventListener("gamepadconnected", this._onGamepadConnected), window.removeEventListener("gamepaddisconnected", this._onGamepadDisconnected), this.controls.destroy(), this.onGamepadConnected.disconnectAll(), this.onGamepadDisconnected.disconnectAll(), this.onControllerActivated.disconnectAll(), this.onControllerDeactivated.disconnectAll(), this.onControllerChanged.disconnectAll(), super.destroy();
3945
+ this._canvas = null, this.controls.destroy(), this.onGamepadConnected.disconnectAll(), this.onGamepadDisconnected.disconnectAll(), this.onControllerActivated.disconnectAll(), this.onControllerDeactivated.disconnectAll(), this.onControllerChanged.disconnectAll(), super.destroy();
3927
3946
  }
3928
3947
  isControllerActive(e) {
3929
3948
  return this.activeControllers.has(e);
@@ -3941,7 +3960,7 @@ var pn = class {
3941
3960
  ];
3942
3961
  }
3943
3962
  _isInputControllerType(e) {
3944
- return Object.values(X).includes(e);
3963
+ return Object.values(Z).includes(e);
3945
3964
  }
3946
3965
  _activateController(e) {
3947
3966
  let t = !this.activeControllers.has(e);
@@ -3957,34 +3976,34 @@ var pn = class {
3957
3976
  this.activeGamepads.delete(e);
3958
3977
  }
3959
3978
  _onPointerDown(e) {
3960
- e.pointerType === "touch" && this._activateController(X.Touch);
3979
+ e.pointerType === "touch" && this._activateController(Z.Touch);
3961
3980
  }
3962
3981
  _onPointerMove(e) {
3963
- e.pointerType === "mouse" && this._activateController(X.Mouse);
3982
+ e.pointerType === "mouse" && this._activateController(Z.Mouse);
3964
3983
  }
3965
3984
  _onKeyDown() {
3966
- this._activateController(X.Keyboard);
3985
+ this._activateController(Z.Keyboard);
3967
3986
  }
3968
3987
  _onGamepadConnected(e) {
3969
- this._activateController(X.GamePad), this._activateController(e.gamepad.id), this._activateGamepad(e.gamepad), this.onGamepadConnected.emit(e.gamepad);
3988
+ this._activateController(Z.GamePad), this._activateController(e.gamepad.id), this._activateGamepad(e.gamepad), this.onGamepadConnected.emit(e.gamepad);
3970
3989
  }
3971
3990
  _onGamepadDisconnected(e) {
3972
- this._deactivateGamepad(e.gamepad.id), this.actionsPlugin.sendAction("pause"), this.onGamepadDisconnected.emit(e.gamepad), this.activeGamepads.size === 0 && this._deactivateController(X.GamePad);
3991
+ this._deactivateGamepad(e.gamepad.id), this.actionsPlugin.sendAction("pause"), this.onGamepadDisconnected.emit(e.gamepad), this.activeGamepads.size === 0 && this._deactivateController(Z.GamePad);
3973
3992
  }
3974
3993
  get actionsPlugin() {
3975
3994
  return this.app.getPlugin("actions");
3976
3995
  }
3977
- }, yn = {
3996
+ }, En = {
3978
3997
  x: !0,
3979
3998
  y: !0,
3980
3999
  intensity: 3,
3981
4000
  duration: .05,
3982
4001
  times: 4
3983
4002
  };
3984
- function bn(e) {
4003
+ function Dn(e) {
3985
4004
  return class extends e {
3986
4005
  constructor(...e) {
3987
- super(...e), this.onAnimationStart = new A(), this.onAnimationUpdate = new A(), this.onAnimationComplete = new A(), this._activeTweens = [];
4006
+ super(...e), this.onAnimationStart = new j(), this.onAnimationUpdate = new j(), this.onAnimationComplete = new j(), this._activeTweens = [];
3988
4007
  }
3989
4008
  animate(e, t = this) {
3990
4009
  let n = p.to(t, {
@@ -4054,7 +4073,7 @@ function bn(e) {
4054
4073
  }
4055
4074
  shake(e, t = this) {
4056
4075
  let n = {
4057
- ...yn,
4076
+ ...En,
4058
4077
  ...e
4059
4078
  }, r = {
4060
4079
  x: t.x,
@@ -4100,24 +4119,24 @@ function bn(e) {
4100
4119
  }
4101
4120
  //#endregion
4102
4121
  //#region src/mixins/factory/Factory.ts
4103
- function xn(e) {
4122
+ function On(e) {
4104
4123
  return class extends n {
4105
4124
  constructor() {
4106
- super(), e = Object.assign({}, ut(), e), this.make = j(e, this, !1), this.add = j(e, this, !0);
4125
+ super(), e = Object.assign({}, $e(), e), this.make = M(e, this, !1), this.add = M(e, this, !0);
4107
4126
  }
4108
4127
  };
4109
4128
  }
4110
4129
  //#endregion
4111
4130
  //#region src/display/Container.ts
4112
- var Sn = [
4131
+ var kn = [
4113
4132
  "autoResize",
4114
4133
  "autoUpdate",
4115
4134
  "priority"
4116
- ], Cn = {
4135
+ ], An = {
4117
4136
  autoResize: !0,
4118
4137
  autoUpdate: !1,
4119
4138
  priority: 0
4120
- }, Q = class e extends bn(Z(xn())) {
4139
+ }, Q = class e extends Dn(fn(On())) {
4121
4140
  static {
4122
4141
  this.__caper_method_binding_root = !0;
4123
4142
  }
@@ -4128,10 +4147,10 @@ var Sn = [
4128
4147
  this._animationContext = e;
4129
4148
  }
4130
4149
  static {
4131
- this.onGlobalChildAdded = new A();
4150
+ this.onGlobalChildAdded = new j();
4132
4151
  }
4133
4152
  static {
4134
- this.onGlobalChildRemoved = new A();
4153
+ this.onGlobalChildRemoved = new j();
4135
4154
  }
4136
4155
  static childAdded(t) {
4137
4156
  e.onGlobalChildAdded.emit(t);
@@ -4143,10 +4162,10 @@ var Sn = [
4143
4162
  return $.getInstance();
4144
4163
  }
4145
4164
  constructor(e = {}) {
4146
- super(), this.onDestroy = new A(), this.__config = {
4147
- ...Cn,
4165
+ super(), this.onDestroy = new j(), this.__config = {
4166
+ ...An,
4148
4167
  ...e
4149
- }, g(this), this.on("added", this._added), this.on("removed", this._removed), this.on("childAdded", this._childAdded), this.on("childRemoved", this._childRemoved);
4168
+ }, _(this), this.on("added", this._added), this.on("removed", this._removed), this.on("childAdded", this._childAdded), this.on("childRemoved", this._childRemoved);
4150
4169
  }
4151
4170
  addColoredBackground(e = 0, t = 1) {
4152
4171
  let n = {
@@ -4197,9 +4216,9 @@ var Sn = [
4197
4216
  addAnimation(e, t) {
4198
4217
  return this.app.addAnimation(e, t ?? this.animationContext);
4199
4218
  }
4200
- }, wn = class extends M {
4219
+ }, jn = class extends N {
4201
4220
  constructor(...e) {
4202
- super(...e), this.id = "popups", this.view = new Q(), this.onShowPopup = new A(), this.onHidePopup = new A(), this.onPopupChanged = new A(), this._popups = /* @__PURE__ */ new Map(), this._activePopups = /* @__PURE__ */ new Map(), this._currentPopupId = void 0;
4221
+ super(...e), this.id = "popups", this.view = new Q(), this.onShowPopup = new j(), this.onHidePopup = new j(), this.onPopupChanged = new j(), this._popups = /* @__PURE__ */ new Map(), this._activePopups = /* @__PURE__ */ new Map(), this._currentPopupId = void 0;
4203
4222
  }
4204
4223
  get currentPopupId() {
4205
4224
  return this._currentPopupId;
@@ -4214,7 +4233,7 @@ var Sn = [
4214
4233
  return this._activePopups.size > 0;
4215
4234
  }
4216
4235
  initialize() {
4217
- g(this), this.view.label = "PopupManager", this._setupAppListeners(), this._registerDiscoveredPopups();
4236
+ _(this), this.view.label = "PopupManager", this._setupAppListeners(), this._registerDiscoveredPopups();
4218
4237
  }
4219
4238
  destroy() {
4220
4239
  this._activePopups.clear(), super.destroy();
@@ -4242,7 +4261,7 @@ var Sn = [
4242
4261
  }
4243
4262
  async hidePopup(e, t) {
4244
4263
  let n = this._activePopups.get(e);
4245
- if (n) return n.beforeHide(), await n.hide(), this.view.removeChild(n), this._activePopups.delete(e), this._currentPopupId = Oe(this._activePopups)?.[0] || void 0, new Promise((r) => {
4264
+ if (n) return n.beforeHide(), await n.hide(), this.view.removeChild(n), this._activePopups.delete(e), this._currentPopupId = ke(this._activePopups)?.[0] || void 0, new Promise((r) => {
4246
4265
  this.app.ticker.addOnce(() => {
4247
4266
  this.onHidePopup.emit({
4248
4267
  id: e,
@@ -4293,7 +4312,7 @@ var Sn = [
4293
4312
  _handleEscape() {
4294
4313
  this.current && this.current.config.closeOnEscape && this.hidePopup(this.current.id);
4295
4314
  }
4296
- }, Tn = {
4315
+ }, Mn = {
4297
4316
  autoScroll: !1,
4298
4317
  minWidth: 0,
4299
4318
  minHeight: 0,
@@ -4301,7 +4320,7 @@ var Sn = [
4301
4320
  center: !1,
4302
4321
  debug: !1,
4303
4322
  useSafeArea: !0
4304
- }, En = class extends M {
4323
+ }, Nn = class extends N {
4305
4324
  constructor(...e) {
4306
4325
  super(...e), this.id = "resizer", this._safeArea = {
4307
4326
  top: 0,
@@ -4323,7 +4342,7 @@ var Sn = [
4323
4342
  }
4324
4343
  async initialize(e) {
4325
4344
  this._options = {
4326
- ...Tn,
4345
+ ...Mn,
4327
4346
  ...e
4328
4347
  };
4329
4348
  }
@@ -4405,7 +4424,7 @@ var Sn = [
4405
4424
  color: 4095
4406
4425
  });
4407
4426
  }
4408
- }, Dn = {
4427
+ }, Pn = {
4409
4428
  view: null,
4410
4429
  hideWhen: "firstSceneEnter",
4411
4430
  zOrder: "top",
@@ -4413,9 +4432,9 @@ var Sn = [
4413
4432
  assets: [],
4414
4433
  bundles: []
4415
4434
  }
4416
- }, On = class extends M {
4435
+ }, Fn = class extends N {
4417
4436
  constructor() {
4418
- super(), this.id = "scenes", this.onSceneChangeStart = new A(), this.onSceneChangeComplete = new A(), this.view = new n(), this.isFirstScene = !0, this.list = [], this.groupOrder = [], this.debugGroupsList = [], this._sceneModules = /* @__PURE__ */ new Map(), this._pendingLoadProps = void 0, this._lastScene = null, this._defaultLoadMethod = "immediate", this._debugVisible = !1, this._useHash = !1, g(this);
4437
+ super(), this.id = "scenes", this.onSceneChangeStart = new j(), this.onSceneChangeComplete = new j(), this.view = new n(), this.isFirstScene = !0, this.list = [], this.groupOrder = [], this.debugGroupsList = [], this._sceneModules = /* @__PURE__ */ new Map(), this._pendingLoadProps = void 0, this._lastScene = null, this._defaultLoadMethod = "immediate", this._debugVisible = !1, this._useHash = !1, _(this);
4419
4438
  }
4420
4439
  get ids() {
4421
4440
  return this.list.map((e) => e.id);
@@ -4423,9 +4442,6 @@ var Sn = [
4423
4442
  setDefaultLoadMethod(e) {
4424
4443
  this._defaultLoadMethod = e;
4425
4444
  }
4426
- destroy() {
4427
- window.removeEventListener("hashchange", this._onHashChange), this._debugMenu?.parentElement?.removeChild(this._debugMenu), super.destroy();
4428
- }
4429
4445
  async initialize(e, t) {
4430
4446
  if (this._debugVisible = this.app.config?.showSceneDebugMenu === !0 || v && this.app.config?.showSceneDebugMenu !== !1, this._useHash = t.config?.useHash === !0 || this._debugVisible, this.view.sortableChildren = !0, this.list = (Caper.get("sceneList") || []).filter((e) => e.active !== !1), this.groupOrder = t.config?.sceneGroupOrder || [], (this._debugVisible || this._useHash) && (this.defaultScene = this.getSceneFromHash() || ""), !this.splash) {
4431
4447
  this.splash = {
@@ -4434,7 +4450,7 @@ var Sn = [
4434
4450
  zOrder: "top"
4435
4451
  };
4436
4452
  let e = {
4437
- ...Dn,
4453
+ ...Pn,
4438
4454
  ...t.config?.splash ?? {}
4439
4455
  };
4440
4456
  e.view && (this.splash.view = typeof e.view == "function" ? new e.view() : e.view), this.splash.preload = e.preload;
@@ -4455,12 +4471,12 @@ var Sn = [
4455
4471
  let n = typeof e == "string" ? e : e.id, r = typeof e == "string" ? this._defaultLoadMethod : e?.method || this._defaultLoadMethod;
4456
4472
  this.currentScene && (this._lastScene = this.currentScene);
4457
4473
  let i = this.list.find((e) => e.id === n);
4458
- if (!i) throw T({ message: `Scene item not found for id ${n}` }), Error(`Scene item not found for id ${n}`);
4474
+ if (!i) throw w({ message: `Scene item not found for id ${n}` }), Error(`Scene item not found for id ${n}`);
4459
4475
  if (i?.plugins?.length) for (let e of i.plugins) {
4460
4476
  let t = this.app.getUnloadedPlugin(e);
4461
4477
  t && await this.app.loadPlugin(t);
4462
4478
  }
4463
- switch (this._currentSceneId = n, this._queue = Ce(this._createCurrentScene), r) {
4479
+ switch (this._currentSceneId = n, this._queue = we(this._createCurrentScene), r) {
4464
4480
  case "exitEnter":
4465
4481
  this._queue.add(this._exitLastScene, this._destroyLastScene, this._unloadLastScene, this._loadCurrentScene, this._initializeCurrentScene, this._addCurrentScene, this._enterCurrentScene, this._startCurrentScene);
4466
4482
  break;
@@ -4496,7 +4512,7 @@ var Sn = [
4496
4512
  return ["loadScene"];
4497
4513
  }
4498
4514
  _listenForHashChange() {
4499
- window.addEventListener("hashchange", this._onHashChange);
4515
+ this.listen(window, "hashchange", this._onHashChange);
4500
4516
  }
4501
4517
  _onHashChange() {
4502
4518
  let e = this.getSceneFromHash();
@@ -4506,7 +4522,7 @@ var Sn = [
4506
4522
  let e = this.list.find((e) => e.id === this._currentSceneId), t;
4507
4523
  if (this._sceneModules.has(this._currentSceneId)) t = this._sceneModules.get(this._currentSceneId);
4508
4524
  else {
4509
- let n = await E(e);
4525
+ let n = await T(e);
4510
4526
  if (!n) throw Error(`Couldn't load ${this._currentSceneId}"`);
4511
4527
  t = n[this._currentSceneId] ? n[this._currentSceneId] : n, t && this._sceneModules.set(this._currentSceneId, t);
4512
4528
  }
@@ -4565,7 +4581,7 @@ var Sn = [
4565
4581
  _createDebugMenu() {
4566
4582
  this._debugMenu = document.createElement("div"), this._debugMenu.id = "scene-debug", this._debugMenu.style.cssText = "position: absolute; bottom: 0; left:0; width:48px; height:48px; z-index: 1000; background-color:rgba(0,0,0,0.8); color:white; border-top-right-radius:8px;";
4567
4583
  let e = document.createElement("i");
4568
- e.style.cssText = "cursor:pointer; position:absolute;width:100%; font-style:normal; font-size:20px; top:50%; left:50%; transform:translate(-50%, -50%); text-align:center; pointer-events:none", e.innerHTML = "🎬", this._debugMenu.appendChild(e), ($.containerElement || document.body).appendChild(this._debugMenu), this._sceneSelect = document.createElement("select"), this._sceneSelect.style.cssText = "padding:0; border-radius:5px; opacity:0; width:48px; height:48px; cursor:pointer", this._sceneSelect.value = this.defaultScene || "";
4584
+ e.style.cssText = "cursor:pointer; position:absolute;width:100%; font-style:normal; font-size:20px; top:50%; left:50%; transform:translate(-50%, -50%); text-align:center; pointer-events:none", e.innerHTML = "🎬", this._debugMenu.appendChild(e), ($.containerElement || document.body).appendChild(this._debugMenu), this.addDisposer(() => this._debugMenu?.parentElement?.removeChild(this._debugMenu)), this._sceneSelect = document.createElement("select"), this._sceneSelect.style.cssText = "padding:0; border-radius:5px; opacity:0; width:48px; height:48px; cursor:pointer", this._sceneSelect.value = this.defaultScene || "";
4569
4585
  let t = document.createElement("option");
4570
4586
  t.value = "", t.innerHTML = "Select a scene", t.setAttribute("disabled", "disabled"), this._sceneSelect.appendChild(t);
4571
4587
  let n = /* @__PURE__ */ new Map(), r = [];
@@ -4588,7 +4604,7 @@ var Sn = [
4588
4604
  t.value = e.id, t.innerHTML = e?.debugLabel || e.id, e.id === this.defaultScene && (t.selected = !0), e.debugGroup ? n.get(e.debugGroup)?.appendChild(t) : this._sceneSelect.appendChild(t);
4589
4605
  }), r.sort((e, t) => this.groupOrder.indexOf(e.label) - this.groupOrder.indexOf(t.label)), r.forEach((e) => {
4590
4606
  this._sceneSelect.appendChild(e);
4591
- }), this._debugMenu.appendChild(this._sceneSelect), this._debugMenu.addEventListener("change", (e) => {
4607
+ }), this._debugMenu.appendChild(this._sceneSelect), this.listen(this._debugMenu, "change", (e) => {
4592
4608
  if (this._queue) {
4593
4609
  e.preventDefault();
4594
4610
  return;
@@ -4606,7 +4622,7 @@ var Sn = [
4606
4622
  };
4607
4623
  //#endregion
4608
4624
  //#region src/plugins/TimerPlugin.ts
4609
- function kn() {
4625
+ function In() {
4610
4626
  try {
4611
4627
  let e = new Blob(["\n const timers = new Map();\n\n self.onmessage = (e) => {\n const { type, timerId, options, timeAdjustment } = e.data;\n \n switch (type) {\n case 'start': {\n let timer = timers.get(timerId);\n \n if (timer) {\n // Resume existing timer\n timer.startTime = performance.now() - (timer.pausedTime || 0);\n timer.interval = createInterval(timer, options, timerId);\n } else {\n // Create new timer\n timer = {\n startTime: performance.now(),\n duration: options.duration,\n loopCount: 0,\n pausedTime: 0,\n options // Store options with the timer\n };\n timer.interval = createInterval(timer, options, timerId);\n timers.set(timerId, timer);\n }\n break;\n }\n \n case 'stop': {\n const timer = timers.get(timerId);\n if (timer) {\n clearInterval(timer.interval);\n timer.interval = null;\n timer.pausedTime = performance.now() - timer.startTime;\n }\n break;\n }\n\n case 'reset': {\n const timer = timers.get(timerId);\n if (timer) {\n timer.startTime = performance.now();\n timer.loopCount = 0;\n timer.pausedTime = 0;\n }\n break;\n }\n\n case 'adjustTime': {\n const timer = timers.get(timerId);\n if (timer) {\n if (timer.duration !== undefined) {\n // For countdown timers, adjust the duration\n timer.duration = Math.max(0, timer.duration + timeAdjustment);\n } else {\n // For count-up timers, adjust the start time\n timer.startTime -= timeAdjustment;\n }\n }\n break;\n }\n }\n };\n\n function createInterval(timer, options, timerId) {\n return setInterval(() => {\n const currentTime = performance.now();\n const totalElapsed = currentTime - timer.startTime;\n \n if (timer.duration !== undefined) {\n // Calculate elapsed time within the current loop\n const loopElapsed = totalElapsed - (timer.loopCount * timer.duration);\n const remaining = Math.max(0, timer.duration - loopElapsed);\n \n self.postMessage({ type: 'tick', timerId, time: remaining });\n \n if (remaining <= 0) {\n self.postMessage({ type: 'complete', timerId, time: 0 });\n \n if (options.loop) {\n timer.loopCount++;\n } else {\n clearInterval(timer.interval);\n timers.delete(timerId);\n }\n }\n } else {\n self.postMessage({ type: 'tick', timerId, time: totalElapsed });\n }\n }, options.workerInterval || 16);\n }\n "], { type: "application/javascript" });
4612
4628
  return new Worker(URL.createObjectURL(e));
@@ -4614,7 +4630,7 @@ function kn() {
4614
4630
  return null;
4615
4631
  }
4616
4632
  }
4617
- function An(e, t = "mm:ss", n = "string") {
4633
+ function Ln(e, t = "mm:ss", n = "string") {
4618
4634
  let r = Math.floor(e / 1e3), i = Math.floor(r / 3600), a = Math.floor(r % 3600 / 60), o = r % 60, s = Math.floor(e % 1e3 / 10);
4619
4635
  if (n === "string") switch (t) {
4620
4636
  case "hh:mm:ss": return `${i.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}`;
@@ -4629,9 +4645,9 @@ function An(e, t = "mm:ss", n = "string") {
4629
4645
  ms: s
4630
4646
  };
4631
4647
  }
4632
- var jn = class {
4648
+ var Rn = class {
4633
4649
  constructor(e = {}, t) {
4634
- this.options = e, this.plugin = t, this.startTime = performance.now(), this.pausedTime = 0, this.isPaused = !0, this.isDestroyed = !1, this.timerId = ue(), e.useWorker && !t.hasWorkerSupport && (S.warn("Web Worker support not available, falling back to main thread timer"), e.useWorker = !1), this.isWorkerTimer = !!e.useWorker, e.autoStart && this.start();
4650
+ this.options = e, this.plugin = t, this.startTime = performance.now(), this.pausedTime = 0, this.isPaused = !0, this.isDestroyed = !1, this.timerId = ue(), e.useWorker && !t.hasWorkerSupport && (x.warn("Web Worker support not available, falling back to main thread timer"), e.useWorker = !1), this.isWorkerTimer = !!e.useWorker, e.autoStart && this.start();
4635
4651
  }
4636
4652
  start() {
4637
4653
  this.isPaused && (this.isPaused = !1, this.isWorkerTimer ? this.plugin.startWorkerTimer(this.timerId, this.options) : this.startTime = performance.now() - this.pausedTime);
@@ -4677,12 +4693,12 @@ var jn = class {
4677
4693
  removeTime(e) {
4678
4694
  return this.addTime(-e);
4679
4695
  }
4680
- }, Mn = class extends M {
4696
+ }, zn = class extends N {
4681
4697
  get hasWorkerSupport() {
4682
4698
  return this._hasWorkerSupport;
4683
4699
  }
4684
4700
  constructor() {
4685
- super("timers"), this.mainThreadTimers = /* @__PURE__ */ new Set(), this.workerTimers = /* @__PURE__ */ new Set(), this.isPageVisible = !0, this.worker = null, this.timerCallbacks = /* @__PURE__ */ new Map(), this._hasWorkerSupport = !1, this.onTimerCreated = new A(), this.onTimerDestroyed = new A(), this.onAllTimersPaused = new A(), this.onAllTimersResumed = new A(), this.handleWorkerMessage = (e) => {
4701
+ super("timers"), this.mainThreadTimers = /* @__PURE__ */ new Set(), this.workerTimers = /* @__PURE__ */ new Set(), this.isPageVisible = !0, this.worker = null, this.timerCallbacks = /* @__PURE__ */ new Map(), this._hasWorkerSupport = !1, this.onTimerCreated = new j(), this.onTimerDestroyed = new j(), this.onAllTimersPaused = new j(), this.onAllTimersResumed = new j(), this.handleWorkerMessage = (e) => {
4686
4702
  let { type: t, timerId: n, time: r, timeAdjustment: i } = e.data, a = this.timerCallbacks.get(n);
4687
4703
  if (a) switch (t) {
4688
4704
  case "tick":
@@ -4716,10 +4732,10 @@ var jn = class {
4716
4732
  ];
4717
4733
  }
4718
4734
  postInitialize() {
4719
- this.app.ticker.add(this.update), this.initWorker();
4735
+ this.addTickerCallback(this.update), this.initWorker();
4720
4736
  }
4721
4737
  initWorker() {
4722
- typeof Worker < "u" ? (this.worker = kn(), this.worker ? (this._hasWorkerSupport = !0, this.worker.onmessage = this.handleWorkerMessage) : (S.warn("Failed to create Web Worker for TimerPlugin, all timers will run on main thread"), this._hasWorkerSupport = !1)) : (S.warn("Web Workers not supported in this environment, all timers will run on main thread"), this._hasWorkerSupport = !1);
4738
+ typeof Worker < "u" ? (this.worker = In(), this.worker ? (this._hasWorkerSupport = !0, this.worker.onmessage = this.handleWorkerMessage) : (x.warn("Failed to create Web Worker for TimerPlugin, all timers will run on main thread"), this._hasWorkerSupport = !1)) : (x.warn("Web Workers not supported in this environment, all timers will run on main thread"), this._hasWorkerSupport = !1);
4723
4739
  }
4724
4740
  startWorkerTimer(e, t) {
4725
4741
  this.worker && (this.timerCallbacks.set(e, t), this.worker.postMessage({
@@ -4745,13 +4761,13 @@ var jn = class {
4745
4761
  });
4746
4762
  }
4747
4763
  destroy() {
4748
- this.app.ticker.remove(this.update), this.worker?.terminate(), this.worker = null, this.timerCallbacks.clear(), this.mainThreadTimers.clear(), this.workerTimers.clear(), super.destroy();
4764
+ this.worker?.terminate(), this.worker = null, this.timerCallbacks.clear(), this.mainThreadTimers.clear(), this.workerTimers.clear(), super.destroy();
4749
4765
  }
4750
4766
  update() {
4751
4767
  for (let e of this.mainThreadTimers) e.update();
4752
4768
  }
4753
4769
  createTimer(e) {
4754
- let t = new jn(e, this);
4770
+ let t = new Rn(e, this);
4755
4771
  return t.isWorker() ? this.workerTimers.add(t) : this.mainThreadTimers.add(t), this.onTimerCreated.emit(t), t;
4756
4772
  }
4757
4773
  destroyTimer(e) {
@@ -4776,20 +4792,17 @@ var jn = class {
4776
4792
  timeAdjustment: t
4777
4793
  });
4778
4794
  }
4779
- }, Nn = class extends M {
4795
+ }, Bn = class extends N {
4780
4796
  constructor() {
4781
- super(), this.id = "webEvents", this.onResize = new A(), this.onVisibilityChanged = new A(), this.onOrientationChanged = new A(), this._debouncedEmitVisibility = Ne((e) => {
4797
+ super(), this.id = "webEvents", this.onResize = new j(), this.onVisibilityChanged = new j(), this.onOrientationChanged = new j(), this._debouncedEmitVisibility = Pe((e) => {
4782
4798
  this.onVisibilityChanged.emit(e);
4783
- }, 1), g(this);
4799
+ }, 1), _(this);
4784
4800
  }
4785
4801
  get app() {
4786
4802
  return $.getInstance();
4787
4803
  }
4788
4804
  initialize() {
4789
- document.addEventListener("visibilitychange", this._onVisibilityChanged, !1), window.addEventListener("pagehide", this._onPageHide, !1), window.addEventListener("pageshow", this._onPageShow, !1), window.addEventListener("resize", this._onResize), document.addEventListener("fullscreenchange", this._onResize), window.addEventListener("orientationchange", this._onOrientationChanged), window.visualViewport?.addEventListener("resize", this._onVisualViewportResize);
4790
- }
4791
- destroy() {
4792
- document.removeEventListener("visibilitychange", this._onVisibilityChanged, !1), window.removeEventListener("resize", this._onResize), document.removeEventListener("fullscreenchange", this._onResize), window.removeEventListener("pagehide", this._onPageHide, !1), window.removeEventListener("pageshow", this._onPageShow, !1), window.removeEventListener("orientationchange", this._onOrientationChanged), window.visualViewport?.removeEventListener("resize", this._onVisualViewportResize), super.destroy();
4805
+ this.listen(document, "visibilitychange", this._onVisibilityChanged, !1), this.listen(window, "pagehide", this._onPageHide, !1), this.listen(window, "pageshow", this._onPageShow, !1), this.listen(window, "resize", this._onResize), this.listen(document, "fullscreenchange", this._onResize), this.listen(window, "orientationchange", this._onOrientationChanged), window.visualViewport && this.listen(window.visualViewport, "resize", this._onVisualViewportResize);
4793
4806
  }
4794
4807
  getCoreSignals() {
4795
4808
  return ["onVisibilityChanged", "onOrientationChanged"];
@@ -4832,7 +4845,7 @@ var jn = class {
4832
4845
  });
4833
4846
  }, 10);
4834
4847
  }
4835
- }, Pn = class extends M {
4848
+ }, Vn = class extends N {
4836
4849
  constructor(...e) {
4837
4850
  super(...e), this.name = "lookup", this.pathToContainer = /* @__PURE__ */ new Map(), this.containerToPath = /* @__PURE__ */ new Map();
4838
4851
  }
@@ -4889,94 +4902,94 @@ var jn = class {
4889
4902
  for (; n && n.label && (t.unshift(n.label), n = n.parent, n?.label !== "Stage"););
4890
4903
  return t.length > 0 ? t.join("/") : "";
4891
4904
  }
4892
- }, Fn = [
4905
+ }, Hn = [
4893
4906
  {
4894
4907
  id: "lookup",
4895
- module: Pn,
4908
+ module: Vn,
4896
4909
  namedExport: "LookupPlugin"
4897
4910
  },
4898
4911
  {
4899
4912
  id: "webEvents",
4900
- module: Nn,
4913
+ module: Bn,
4901
4914
  namedExport: "WebEventsPlugin"
4902
4915
  },
4903
4916
  {
4904
4917
  id: "fullscreen",
4905
- module: mt,
4918
+ module: pt,
4906
4919
  namedExport: "FullScreenPlugin"
4907
4920
  },
4908
4921
  {
4909
4922
  id: "resizer",
4910
- module: En,
4923
+ module: Nn,
4911
4924
  namedExport: "ResizerPlugin"
4912
4925
  },
4913
4926
  {
4914
4927
  id: "breakpoints",
4915
- module: jt,
4928
+ module: At,
4916
4929
  namedExport: "BreakpointPlugin"
4917
4930
  },
4918
4931
  {
4919
4932
  id: "assets",
4920
- module: pt,
4933
+ module: ft,
4921
4934
  namedExport: "AssetsPlugin"
4922
4935
  },
4923
4936
  {
4924
4937
  id: "scenes",
4925
- module: On,
4938
+ module: Fn,
4926
4939
  namedExport: "SceneManagerPlugin"
4927
4940
  },
4928
4941
  {
4929
4942
  id: "actions",
4930
- module: gt,
4943
+ module: ht,
4931
4944
  namedExport: "ActionsPlugin"
4932
4945
  },
4933
4946
  {
4934
4947
  id: "input",
4935
- module: vn,
4948
+ module: Tn,
4936
4949
  namedExport: "InputPlugin"
4937
4950
  },
4938
4951
  {
4939
4952
  id: "gesture",
4940
- module: ln,
4953
+ module: cn,
4941
4954
  namedExport: "GesturePlugin"
4942
4955
  },
4943
4956
  {
4944
4957
  id: "keyboard",
4945
- module: ht,
4958
+ module: mt,
4946
4959
  namedExport: "KeyboardPlugin"
4947
4960
  },
4948
4961
  {
4949
4962
  id: "focus",
4950
- module: rn,
4963
+ module: nn,
4951
4964
  namedExport: "FocusManagerPlugin"
4952
4965
  },
4953
4966
  {
4954
4967
  id: "popups",
4955
- module: wn,
4968
+ module: jn,
4956
4969
  namedExport: "PopupManagerPlugin"
4957
4970
  },
4958
4971
  {
4959
4972
  id: "audio",
4960
- module: en,
4973
+ module: $t,
4961
4974
  namedExport: "AudioManagerPlugin"
4962
4975
  },
4963
4976
  {
4964
4977
  id: "i18n",
4965
- module: fn,
4978
+ module: dn,
4966
4979
  namedExport: "i18nPlugin"
4967
4980
  },
4968
4981
  {
4969
4982
  id: "timers",
4970
- module: Mn,
4983
+ module: zn,
4971
4984
  namedExport: "TimerPlugin"
4972
4985
  }
4973
4986
  ];
4974
4987
  //#endregion
4975
4988
  //#region src/core/Application.ts
4976
- function In() {
4989
+ function Un() {
4977
4990
  return typeof window < "u" ? window.devicePixelRatio > 1 ? 2 : 1 : 2;
4978
4991
  }
4979
- var Ln = {
4992
+ var Wn = {
4980
4993
  antialias: !1,
4981
4994
  autoStart: !0,
4982
4995
  resizeToContainer: !0,
@@ -5014,7 +5027,7 @@ var Ln = {
5014
5027
  wordWrap: !1,
5015
5028
  wordWrapWidth: 100
5016
5029
  },
5017
- resolution: In(),
5030
+ resolution: Un(),
5018
5031
  useHash: v,
5019
5032
  showSceneDebugMenu: v,
5020
5033
  showStats: v,
@@ -5026,12 +5039,12 @@ var Ln = {
5026
5039
  scenes: [],
5027
5040
  defaultSceneLoadMethod: "immediate",
5028
5041
  assets: { manifest: "./assets.json" }
5029
- }, Rn = {
5042
+ }, Gn = {
5030
5043
  pauseAudio: !0,
5031
5044
  pauseAnimations: !0,
5032
5045
  pauseTicker: !0,
5033
5046
  pauseTimers: !0
5034
- }, zn = {
5047
+ }, Kn = {
5035
5048
  pauseAudio: !1,
5036
5049
  pauseAnimations: !1,
5037
5050
  pauseTicker: !1,
@@ -5041,7 +5054,7 @@ var Ln = {
5041
5054
  this.__caper_method_binding_root = !0;
5042
5055
  }
5043
5056
  get make() {
5044
- return this._makeFactory ||= j(ut(), this, !1), this._makeFactory;
5057
+ return this._makeFactory ||= M($e(), this, !1), this._makeFactory;
5045
5058
  }
5046
5059
  get env() {
5047
5060
  return this._env;
@@ -5057,7 +5070,7 @@ var Ln = {
5057
5070
  }
5058
5071
  pause(e) {
5059
5072
  this._paused = !0, this._pauseConfig = {
5060
- ...e ? zn : Rn,
5073
+ ...e ? Kn : Gn,
5061
5074
  ...e
5062
5075
  }, this._pauseConfig.pauseAudio && this.audio.pause(), this._pauseConfig.pauseAnimations && p?.globalTimeline?.pause(), this._pauseConfig.pauseTicker && this.ticker.stop(), this._pauseConfig.pauseTimers && this.timers.pauseAllTimers(), this._pauseConfig.pauseOther && this._pauseConfig.pauseOther.forEach((e) => {
5063
5076
  typeof e?.pause == "function" && e.pause();
@@ -5072,13 +5085,13 @@ var Ln = {
5072
5085
  this._paused = !this._paused, this._paused ? this.pause(e) : this.resume();
5073
5086
  }
5074
5087
  constructor() {
5075
- super(), this.onPause = new A(), this.onResume = new A(), this.onResize = new A(), this.onPluginError = new A(), this.onPwaInstallAvailable = new A(), this.onPwaUpdateAvailable = new A(), this._plugins = /* @__PURE__ */ new Map(), this._env = {
5088
+ super(), this.onPause = new j(), this.onResume = new j(), this.onResize = new j(), this.onPluginError = new j(), this.onPwaInstallAvailable = new j(), this.onPwaUpdateAvailable = new j(), this._plugins = /* @__PURE__ */ new Map(), this._env = {
5076
5089
  BASE_URL: "/",
5077
5090
  DEV: !1,
5078
5091
  MODE: "production",
5079
5092
  PROD: !0,
5080
5093
  SSR: !1
5081
- }, this._isFullScreen = !1, this._fullScreenElement = null, this._paused = !1, this._pauseConfig = {}, this._center = new c(0, 0), g(this);
5094
+ }, this._isFullScreen = !1, this._fullScreenElement = null, this._paused = !1, this._pauseConfig = {}, this._center = new c(0, 0), _(this);
5082
5095
  }
5083
5096
  get appVersion() {
5084
5097
  try {
@@ -5224,13 +5237,13 @@ var Ln = {
5224
5237
  return "ontouchstart" in window || navigator.maxTouchPoints > 0;
5225
5238
  }
5226
5239
  get signal() {
5227
- return Bn;
5240
+ return qn;
5228
5241
  }
5229
5242
  get signals() {
5230
5243
  return this.signal;
5231
5244
  }
5232
5245
  get func() {
5233
- return Vn;
5246
+ return Jn;
5234
5247
  }
5235
5248
  get exec() {
5236
5249
  return this.func;
@@ -5240,7 +5253,7 @@ var Ln = {
5240
5253
  return this.scenes.splash.view && e.push(this.scenes.splash.view), this.scenes.transition && e.push(this.scenes.transition), this.captions?.view && e.push(this.captions.view), e;
5241
5254
  }
5242
5255
  static getInstance() {
5243
- return r.instance || S.warn("Application not created yet"), r.instance;
5256
+ return r.instance || x.warn("Application not created yet"), r.instance;
5244
5257
  }
5245
5258
  destroy(e, t) {
5246
5259
  this._plugins.forEach((e) => {
@@ -5252,12 +5265,12 @@ var Ln = {
5252
5265
  }
5253
5266
  async initialize(e, t) {
5254
5267
  if (r.instance) throw Error("Application is already initialized");
5255
- if (r.instance = this, this.config = Ie(Ln, e), this.signals.onResize = this.onResize, e.container && (r.containerElement = e.container), S.initialize(this.config.logger), this.config.resolution !== 1 && this.config.resolution !== 2) {
5268
+ if (r.instance = this, this.config = E(Wn, e), this.signals.onResize = this.onResize, e.container && (r.containerElement = e.container), x.initialize(this.config.logger), this.config.resolution !== 1 && this.config.resolution !== 2) {
5256
5269
  let e = this.config.resolution;
5257
- this.config.resolution = In(), S.warn(`App resolution must be 1 or 2, setting to ${this.config.resolution} instead of ${e}. Modify your app config to set the resolution to 1 or 2.`);
5270
+ this.config.resolution = Un(), x.warn(`App resolution must be 1 or 2, setting to ${this.config.resolution} instead of ${e}. Modify your app config to set the resolution to 1 or 2.`);
5258
5271
  }
5259
5272
  if (await this.boot(this.config), await this.initAssets(), await this.init(this.config), this.stage.label = "Stage", this.config.defaultTextStyle && (l.defaultTextStyle = {
5260
- ...Ln.defaultTextStyle,
5273
+ ...Wn.defaultTextStyle,
5261
5274
  ...this.config.defaultTextStyle
5262
5275
  }), this.config.defaultDropShadow && (l.defaultDropShadow = this.config.defaultDropShadow), t) t.appendChild(this.canvas), this.setContainer(t);
5263
5276
  else throw Error("No element found to append the view to.");
@@ -5265,13 +5278,13 @@ var Ln = {
5265
5278
  }
5266
5279
  getPlugin(e, t = !1) {
5267
5280
  let n = this._plugins.get(e);
5268
- return !n && t && S.warn(`Plugin with name "${e}" not found.`), n;
5281
+ return !n && t && x.warn(`Plugin with name "${e}" not found.`), n;
5269
5282
  }
5270
5283
  async _postInitialize() {
5271
5284
  for (let e of this._plugins.values()) try {
5272
5285
  await e.postInitialize(this);
5273
5286
  } catch (t) {
5274
- T({
5287
+ w({
5275
5288
  message: `Plugin "${e.id}" failed in postInitialize: ${t instanceof Error ? t.message : String(t)}`,
5276
5289
  stack: t instanceof Error ? t.stack : void 0
5277
5290
  }), this.onPluginError.emit({
@@ -5302,7 +5315,7 @@ var Ln = {
5302
5315
  }
5303
5316
  async loadPlugin(e, t = !1) {
5304
5317
  if (this._plugins.has(e.id)) return await this.registerPlugin(this._plugins.get(e.id), e.options);
5305
- let n = new (await (E(e)))(e.id);
5318
+ let n = new (await (T(e)))(e.id);
5306
5319
  n.id !== e.id && (n.id = e.id);
5307
5320
  let r = e.options;
5308
5321
  return t && !r && (r = this.config[n.id]), await this.registerPlugin(n, r);
@@ -5324,7 +5337,7 @@ var Ln = {
5324
5337
  }
5325
5338
  async boot(e) {
5326
5339
  this.config = {
5327
- ...Ln,
5340
+ ...Wn,
5328
5341
  ...e
5329
5342
  }, await this.preInitialize(this.config);
5330
5343
  }
@@ -5332,34 +5345,34 @@ var Ln = {
5332
5345
  let { id: t } = e;
5333
5346
  this._appName = t, v && await this.loadPlugin({
5334
5347
  id: "DevToolsPlugin",
5335
- module: () => import("./DevToolsPlugin-Vrk6aOtS.js"),
5348
+ module: () => import("./DevToolsPlugin-B8GX3H9b.js"),
5336
5349
  namedExport: "DevToolsPlugin"
5337
5350
  }), e.useLayout && await this.loadPlugin({
5338
5351
  id: "LayoutPlugin",
5339
- module: () => import("./LayoutPlugin-Dpgeawfw.js"),
5352
+ module: () => import("./LayoutPlugin-BX3OP7pw.js"),
5340
5353
  namedExport: "LayoutPlugin"
5341
5354
  }), await this.loadPlugin({
5342
5355
  id: "GSAPPlugin",
5343
- module: () => import("./GSAPPlugin-Hm3F4zdg.js"),
5356
+ module: () => import("./GSAPPlugin-Br9AjuTD.js"),
5344
5357
  namedExport: "GSAPPlugin"
5345
5358
  }), e.useSpine && await this.loadPlugin({
5346
5359
  id: "SpinePlugin",
5347
- module: () => import("./SpinePlugin-B08yAw1S.js"),
5360
+ module: () => import("./SpinePlugin-C-JDdXpf.js"),
5348
5361
  namedExport: "SpinePlugin"
5349
- }), this.config.useStore && (this._store = new st(), this._store.initialize(this), await this.loadPlugin({
5362
+ }), this.config.useStore && (this._store = new lt(), this._store.initialize(this), await this.loadPlugin({
5350
5363
  id: "data",
5351
- module: () => import("./DataAdapter-aHSNM_26.js").then((e) => e.n),
5364
+ module: () => import("./DataAdapter-D2tc6hx9.js").then((e) => e.n),
5352
5365
  namedExport: "DataAdapter",
5353
5366
  options: this.config.data
5354
5367
  }));
5355
5368
  }
5356
5369
  async registerPlugin(e, t) {
5357
- if (this._plugins.has(e.id)) return S.warn(`Plugin with id "${e.id}" already registered. Not registering.`), e.initialize(t, this);
5370
+ if (this._plugins.has(e.id)) return x.warn(`Plugin with id "${e.id}" already registered. Not registering.`), e.initialize(t, this);
5358
5371
  e.registerCoreFunctions(), e.registerCoreSignals(), this._plugins.set(e.id, e);
5359
5372
  try {
5360
5373
  return await e.initialize(t, this);
5361
5374
  } catch (t) {
5362
- T({
5375
+ w({
5363
5376
  message: `Plugin "${e.id}" failed to initialize: ${t instanceof Error ? t.message : String(t)}`,
5364
5377
  stack: t instanceof Error ? t.stack : void 0
5365
5378
  }), this.onPluginError.emit({
@@ -5371,22 +5384,22 @@ var Ln = {
5371
5384
  }
5372
5385
  }
5373
5386
  async registerDefaultPlugins() {
5374
- for (let e = 0; e < Fn.length; e++) {
5375
- let t = Fn[e];
5387
+ for (let e = 0; e < Hn.length; e++) {
5388
+ let t = Hn[e];
5376
5389
  await this.loadPlugin(t, !0);
5377
5390
  }
5378
5391
  (this.config.showStats === !0 || v && this.config.showStats !== !1) && await this.loadPlugin({
5379
5392
  id: "stats",
5380
- module: () => import("./StatsPlugin-D2Xa5j97.js"),
5393
+ module: () => import("./StatsPlugin-yJlJtoQ2.js"),
5381
5394
  namedExport: "StatsPlugin"
5382
5395
  }), this.config.useVoiceover && (await this.loadPlugin({
5383
5396
  id: "voiceover",
5384
- module: () => import("./VoiceOverPlugin-qtFlqpRn.js"),
5397
+ module: () => import("./VoiceOverPlugin-DjSZp4Ko.js"),
5385
5398
  namedExport: "VoiceOverPlugin",
5386
5399
  options: this.config.voiceover || void 0
5387
5400
  }), await this.loadPlugin({
5388
5401
  id: "captions",
5389
- module: () => import("./CaptionsPlugin-BLbLl3WB.js"),
5402
+ module: () => import("./CaptionsPlugin-cSJj-R9M.js"),
5390
5403
  namedExport: "CaptionsPlugin",
5391
5404
  options: this.config.captions || void 0
5392
5405
  }));
@@ -5400,7 +5413,7 @@ var Ln = {
5400
5413
  async setup() {}
5401
5414
  async initAssets() {
5402
5415
  let e = this.config.assets?.initOptions || {}, n = this.config.assets?.manifest || e.manifest;
5403
- w(n) && (n = await n), e.manifest = n, e.basePath = e.basePath || "./assets", await t.init(e), this.manifest = t.resolver._manifest;
5416
+ C(n) && (n = await n), e.manifest = n, e.basePath = e.basePath || "./assets", await t.init(e), this.manifest = t.resolver._manifest;
5404
5417
  }
5405
5418
  async loadDefaultScene() {
5406
5419
  return this.scenes.loadDefaultScene();
@@ -5422,8 +5435,8 @@ var Ln = {
5422
5435
  _addSplash() {
5423
5436
  this.scenes.splash.view && (this.scenes.splash.view.label = "Splash", this.stage.addChild(this.scenes.splash.view));
5424
5437
  }
5425
- }, Bn = {}, Vn = {};
5438
+ }, qn = {}, Jn = {};
5426
5439
  //#endregion
5427
- export { Le as $, jt as A, _ as At, mt as B, me as Bt, ln as C, xe as Ct, en as D, S as Dt, tn as E, C as Et, xt as F, ve as Ft, st as G, M as H, h as Ht, bt as I, he as It, D as J, A as K, gt as L, de as Lt, _t as M, ye as Mt, vt as N, g as Nt, z as O, y as Ot, yt as P, ge as Pt, qe as Q, ht as R, fe as Rt, fn as S, Ce as St, rn as T, Se as Tt, j as U, se as Ut, pt as V, ue as Vt, lt as W, le as Wt, Je as X, Ye as Y, Xe as Z, gn as _, Oe as _t, Nn as a, Ve as at, Z as b, E as bt, An as c, Be as ct, wn as d, Pe as dt, Re as et, Q as f, Ne as ft, vn as g, ke as gt, bn as h, je as ht, Pn as i, Ge as it, L as j, v as jt, Mt as k, be as kt, On as l, Ie as lt, xn as m, Ae as mt, Bn as n, We as nt, jn as o, Ke as ot, Sn as p, Me as pt, k as q, $ as r, He as rt, Mn as s, ze as st, Vn as t, Ue as tt, En as u, Fe as ut, hn as v, De as vt, sn as w, w as wt, X as x, we as xt, mn as y, Ee as yt, P as z, pe as zt };
5440
+ export { Le as $, At as A, ve as At, pt as B, pe as Bt, cn as C, Se as Ct, $t as D, x as Dt, en as E, S as Et, bt as F, _e as Ft, j as G, N as H, h as Ht, yt as I, me as It, Qe as J, A as K, ht as L, g as Lt, gt as M, ye as Mt, _t as N, _ as Nt, Mt as O, y as Ot, vt as P, he as Pt, qe as Q, mt as R, de as Rt, dn as S, we as St, nn as T, Ce as Tt, M as U, se as Ut, ft as V, ue as Vt, lt as W, le as Wt, Je as X, Ye as Y, Xe as Z, Cn as _, ke as _t, Bn as a, Ve as at, fn as b, T as bt, Ln as c, Be as ct, jn as d, Fe as dt, Re as et, Q as f, Pe as ft, Tn as g, Ae as gt, Dn as h, Me as ht, Vn as i, Ge as it, R as j, v as jt, jt as k, be as kt, Fn as l, E as lt, On as m, je as mt, qn as n, We as nt, Rn as o, Ke as ot, kn as p, Ne as pt, O as q, $ as r, He as rt, zn as s, ze as st, Jn as t, Ue as tt, Nn as u, Ie as ut, Sn as v, Oe as vt, on as w, C as wt, Z as x, Te as xt, xn as y, De as yt, F as z, fe as zt };
5428
5441
 
5429
- //# sourceMappingURL=registries-m2vKTIih.js.map
5442
+ //# sourceMappingURL=registries-BfV-VF7a.js.map