@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
package/lib/caper.mjs CHANGED
@@ -1,18 +1,20 @@
1
- import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as ee, H as te, I as ne, It as re, J as ie, K as p, L as ae, Lt as oe, M as se, Mt as ce, N as le, Nt as m, O as ue, Ot as de, P as fe, Pt as pe, Q as me, R as he, Rt as ge, S as _e, St as ve, T as ye, Tt as be, U as xe, V as Se, Vt as Ce, W as we, X as Te, Y as Ee, Z as De, _ as Oe, _t as ke, a as Ae, at as je, b as h, bt as Me, c as Ne, ct as Pe, d as Fe, dt as g, et as Ie, f as _, ft as Le, g as Re, gt as ze, h as Be, ht as Ve, i as He, it as Ue, j as We, jt as Ge, k as Ke, kt as qe, l as Je, lt as Ye, m as v, mt as Xe, n as Ze, nt as Qe, o as $e, ot as y, p as b, pt as et, q as x, r as S, rt as tt, s as nt, st as rt, t as it, tt as at, u as ot, ut as st, v as ct, vt as lt, w as ut, wt as dt, x as ft, xt as pt, y as mt, yt as ht, z as gt, zt as _t } from "./registries-m2vKTIih.js";
2
- import { r as vt, t as yt } from "./DataAdapter-aHSNM_26.js";
3
- import { AnimatedSprite as bt, Assets as C, BitmapText as w, CanvasTextMetrics as T, Container as xt, Graphics as E, HTMLText as St, ParticleContainer as Ct, Point as D, Polygon as wt, Rectangle as Tt, Sprite as Et, Text as O, Texture as k, TilingSprite as Dt, isMobile as Ot } from "pixi.js";
4
- import { gsap as A } from "gsap";
1
+ import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as p, H as ee, I as m, It as te, J as ne, K as h, L as g, Lt as re, M as ie, Mt as ae, N as _, Nt as v, O as oe, Ot as se, P as ce, Pt as le, Q as ue, R as de, Rt as fe, S as pe, St as me, T as he, Tt as ge, U as _e, V as ve, Vt as ye, W as be, X as xe, Y as Se, Z as Ce, _ as we, _t as Te, a as Ee, at as De, b as y, bt as Oe, c as ke, ct as Ae, d as je, dt as Me, et as Ne, f as b, ft as Pe, g as Fe, gt as Ie, h as Le, ht as Re, i as ze, it as Be, j as Ve, jt as He, k as Ue, kt as We, l as Ge, lt as Ke, m as qe, mt as Je, n as Ye, nt as Xe, o as Ze, ot as x, p as Qe, pt as $e, q as et, r as S, rt as tt, s as nt, st as rt, t as it, tt as at, u as ot, ut as st, v as C, vt as ct, w as lt, wt as ut, x as dt, xt as ft, y as pt, yt as mt, z as ht, zt as w } from "./registries-BfV-VF7a.js";
2
+ import { A as gt, C as _t, D as vt, E as yt, F as bt, I as xt, L as St, M as Ct, N as wt, O as Tt, P as Et, S as Dt, T as Ot, _ as T, a as kt, b as At, c as jt, d as Mt, f as Nt, g as E, h as Pt, i as Ft, j as It, k as Lt, l as Rt, m as zt, n as Bt, o as Vt, p as Ht, r as Ut, s as Wt, u as Gt, v as Kt, w as qt, x as Jt, y as Yt } from "./const-C3sxeYhl.js";
3
+ import { n as Xt, t as D } from "./padding-1kHDpGlQ.js";
4
+ import { r as Zt, t as Qt } from "./DataAdapter-D2tc6hx9.js";
5
+ import { CanvasTextMetrics as O, Container as $t, Graphics as k, Point as A, Polygon as en, Rectangle as tn, Sprite as nn, Texture as j, isMobile as M } from "pixi.js";
6
+ import { gsap as N } from "gsap";
5
7
  //#region src/utils/array.ts
6
- function kt(e) {
8
+ function rn(e) {
7
9
  let t, n;
8
- for (let r = 0; r < e.length; ++r) n = _t(0, e.length), t = e[r], e[r] = e[n], e[n] = t;
10
+ for (let r = 0; r < e.length; ++r) n = w(0, e.length), t = e[r], e[r] = e[n], e[n] = t;
9
11
  }
10
- function At(e) {
11
- return e[_t(0, e.length)];
12
+ function an(e) {
13
+ return e[w(0, e.length)];
12
14
  }
13
15
  //#endregion
14
16
  //#region src/utils/canvas.ts
15
- function jt(e) {
17
+ function on(e) {
16
18
  let t = e.getContext("webgl");
17
19
  if (t) {
18
20
  let e = t.getExtension("WEBGL_lose_context");
@@ -23,13 +25,13 @@ function jt(e) {
23
25
  }
24
26
  //#endregion
25
27
  //#region src/utils/color.ts
26
- function Mt(e) {
28
+ function sn(e) {
27
29
  return `#${e.toString(16)}`;
28
30
  }
29
- function Nt(e) {
31
+ function cn(e) {
30
32
  return parseInt(e.replace(/^#/, ""), 16);
31
33
  }
32
- var Pt = class e {
34
+ var ln = class e {
33
35
  static {
34
36
  this.WHITE = new e(255, 255, 255);
35
37
  }
@@ -94,193 +96,106 @@ var Pt = class e {
94
96
  this.b / 255
95
97
  ];
96
98
  }
97
- }, j = {
98
- bounds: 65535,
99
- innerBounds: 65280,
100
- outerBounds: 16711680,
101
- direction: 16776960,
102
- gap: 16711935,
103
- region: 30975
104
- }, M = {
105
- stroke: .6,
106
- fill: .1,
107
- fillActive: .2,
108
- crosshair: .5
109
99
  };
110
- function Ft(e) {
111
- let t = new E();
112
- return t.eventMode = "none", t.interactiveChildren = !1, t.layout = !1, t.label = e ?? "DebugGraphics", t;
113
- }
114
- function N(e, t = j.bounds) {
115
- let n = new O({
116
- text: e,
117
- style: {
118
- fontFamily: "monospace",
119
- fontSize: 10,
120
- fill: t,
121
- stroke: {
122
- color: 0,
123
- width: 2
124
- }
125
- }
126
- });
127
- return n.eventMode = "none", n.layout = !1, n.label = "DebugLabel", n;
128
- }
129
- var It = /* @__PURE__ */ new Map();
130
- function P(e, t, n) {
131
- It.set(e, {
132
- label: t,
133
- color: n
134
- });
135
- }
136
- function F(e) {
137
- It.delete(e);
138
- }
139
- function Lt() {
140
- return It;
141
- }
142
100
  //#endregion
143
101
  //#region src/utils/define.ts
144
- function Rt(e) {
102
+ function un(e) {
145
103
  return e;
146
104
  }
147
- function zt(e) {
105
+ function dn(e) {
148
106
  return e;
149
107
  }
150
- function Bt(e) {
108
+ function fn(e) {
151
109
  return e;
152
110
  }
153
- function Vt(e) {
111
+ function pn(e) {
154
112
  return e;
155
113
  }
156
- function Ht(e) {
114
+ function mn(e) {
157
115
  return e;
158
116
  }
159
117
  //#endregion
160
- //#region src/utils/number.ts
161
- function Ut(e, t = 0) {
162
- return e.toString().padStart(t, "0");
163
- }
164
- //#endregion
165
- //#region src/utils/padding.ts
166
- function Wt(e, t) {
167
- return e >= 0 && e <= 1 ? e * t : e;
168
- }
169
- function I(e) {
170
- if (Array.isArray(e)) return {
171
- top: e[0],
172
- right: e?.[1] ?? e[0],
173
- bottom: e?.[2] ?? e[0],
174
- left: e?.[3] ?? e?.[1] ?? e[0] ?? 0
175
- };
176
- if (typeof e == "number") return {
177
- top: e,
178
- right: e,
179
- bottom: e,
180
- left: e
181
- };
182
- if (typeof e == "object") {
183
- let t = e;
184
- return t.x !== void 0 && t.y !== void 0 ? {
185
- top: t.y,
186
- right: t.x,
187
- bottom: t.y,
188
- left: t.x
189
- } : {
190
- top: e.top ?? 0,
191
- right: e.right ?? 0,
192
- bottom: e.bottom ?? 0,
193
- left: e.left ?? 0
194
- };
195
- } else return {
196
- top: 0,
197
- right: 0,
198
- bottom: 0,
199
- left: 0
200
- };
201
- }
202
- //#endregion
203
118
  //#region src/utils/pixi.ts
204
- function Gt(e, t) {
119
+ function hn(e, t) {
205
120
  e.parent && e.parent.worldTransform.apply(e.position, e.position), t.worldTransform.applyInverse(e.position, e.position), e.parent?.removeChild(e), t.addChild(e);
206
121
  }
207
- function Kt(e) {
122
+ function gn(e) {
208
123
  return Math.sqrt(e.width * e.width + e.height * e.height);
209
124
  }
210
- function qt(e) {
125
+ function _n(e) {
211
126
  let t = e.parent;
212
127
  t && (t.removeChild(e), t.addChild(e));
213
128
  }
214
- function Jt(e) {
129
+ function vn(e) {
215
130
  let t = e.parent;
216
131
  t && (t.removeChild(e), t.addChildAt(e, 0));
217
132
  }
218
- function Yt(e, t) {
219
- if (e instanceof wt) {
133
+ function yn(e, t) {
134
+ if (e instanceof en) {
220
135
  for (let n = 0; n < e.points.length; n += 2) e.points[n] += t.x, e.points[n + 1] += t.y;
221
136
  return e;
222
137
  } else return e.x += t.x, e.y += t.y, e;
223
138
  }
224
- function Xt(e, t) {
139
+ function bn(e, t) {
225
140
  return e.x += t.x, e.y += t.y, e;
226
141
  }
227
- function L(e, t, n = "width") {
142
+ function P(e, t, n = "width") {
228
143
  let r = n === "width" ? "y" : "x", i = n === "width" ? "x" : "y";
229
144
  e[n] = t, e.scale[r] = e.scale[i];
230
145
  }
231
- function R(e, t) {
232
- L(e, t, "width");
146
+ function F(e, t) {
147
+ P(e, t, "width");
233
148
  }
234
- function z(e, t) {
235
- L(e, t, "height");
149
+ function I(e, t) {
150
+ P(e, t, "height");
236
151
  }
237
- function Zt(e, t, n = "width") {
152
+ function xn(e, t, n = "width") {
238
153
  let r;
239
154
  r = t?.width && t?.height ? {
240
155
  x: t.width,
241
156
  y: t.height
242
- } : y(t), n === "width" ? (R(e, r.x), e.height < r.y && z(e, r.y)) : (z(e, r.y), e.width < r.x && R(e, r.x));
157
+ } : x(t), n === "width" ? (F(e, r.x), e.height < r.y && I(e, r.y)) : (I(e, r.y), e.width < r.x && F(e, r.x));
243
158
  }
244
159
  //#endregion
245
160
  //#region src/utils/platform.ts
246
- var Qt = typeof window < "u" ? window.devicePixelRatio > 1 || window.matchMedia && window.matchMedia("(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)").matches : !1, B = typeof window < "u" ? "ontouchstart" in window || navigator.maxTouchPoints > 0 : !1, $t = Ot.any, en = Ot.android.device, tn = Ot.apple.device;
161
+ var Sn = typeof window < "u" ? window.devicePixelRatio > 1 || window.matchMedia && window.matchMedia("(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)").matches : !1, L = typeof window < "u" ? "ontouchstart" in window || navigator.maxTouchPoints > 0 : !1, R = M.any, z = M.android.device, Cn = M.apple.device;
247
162
  //#endregion
248
163
  //#region src/utils/rect.ts
249
- function nn(e, t) {
164
+ function wn(e, t) {
250
165
  return e.x += t.x, e.y += t.y, e;
251
166
  }
252
- function rn(e, t) {
253
- return t === void 0 && (t = new D()), t.set(e.x + e.width * .5, e.y + e.height * .5), t;
167
+ function Tn(e, t) {
168
+ return t === void 0 && (t = new A()), t.set(e.x + e.width * .5, e.y + e.height * .5), t;
254
169
  }
255
- function an(e, t) {
170
+ function En(e, t) {
256
171
  return e.x *= t, e.y *= t, e.width *= t, e.height *= t, e;
257
172
  }
258
- function on(e, t) {
259
- return t === void 0 && (t = new D()), t.set(e.width, e.height), t;
173
+ function Dn(e, t) {
174
+ return t === void 0 && (t = new A()), t.set(e.width, e.height), t;
260
175
  }
261
176
  //#endregion
262
177
  //#region src/utils/set.ts
263
- function sn(e, t) {
178
+ function On(e, t) {
264
179
  let n = /* @__PURE__ */ new Set();
265
180
  for (let r of e) t(r) && n.add(r);
266
181
  return n;
267
182
  }
268
- function cn(e) {
183
+ function kn(e) {
269
184
  return e?.values().next().value;
270
185
  }
271
- function ln(e) {
186
+ function An(e) {
272
187
  let t;
273
188
  for (let n of e) t = n;
274
189
  return t;
275
190
  }
276
191
  //#endregion
277
192
  //#region src/utils/text.ts
278
- function un(e, t) {
279
- let n = T.measureText(e.text, e.style), r = n.lines, i = n.lineHeight, a = e.toLocal(new D(t.pageX, t.pageY)), o = 0, s = Infinity, c = 0;
193
+ function B(e, t) {
194
+ let n = O.measureText(e.text, e.style), r = n.lines, i = n.lineHeight, a = e.toLocal(new A(t.pageX, t.pageY)), o = 0, s = Infinity, c = 0;
280
195
  for (let t = 0; t < r.length; t++) {
281
196
  let n = r[t];
282
197
  for (let r = 0; r <= n.length; r++) {
283
- let l = n.substring(0, r), u = T.measureText(l, e.style).width, d = t * i, f = Math.hypot(u - a.x, d - a.y);
198
+ let l = n.substring(0, r), u = O.measureText(l, e.style).width, d = t * i, f = Math.hypot(u - a.x, d - a.y);
284
199
  f < s && (s = f, o = c + r);
285
200
  }
286
201
  c += n.length;
@@ -289,35 +204,35 @@ function un(e, t) {
289
204
  }
290
205
  //#endregion
291
206
  //#region src/version.ts
292
- var dn = "0.3.0", fn = "8.19.0", pn = " ........ ..... ............ ............. ........... \n ............. ....... ................ ............. .............. \n .............. ......... ............... ............. .............. \n ..... ........... .............. ............ .............. \n ..... ...... ...... .............. ............. ............. \n .............. ...... ..... ............ ............. ..... ...... \n ................... ..... ..... ............. ..... ....... \n ................ .......... ............. ..... ..... ";
293
- function mn() {
294
- let e = `\n${pn}\n\n v${dn} | %cPixi.js v${fn} %c| %chttps://github.com/anthonysapp/caper\n\n`;
207
+ var V = "0.4.1", H = "8.19.0", jn = " ........ ..... ............ ............. ........... \n ............. ....... ................ ............. .............. \n .............. ......... ............... ............. .............. \n ..... ........... .............. ............ .............. \n ..... ...... ...... .............. ............. ............. \n .............. ...... ..... ............ ............. ..... ...... \n ................... ..... ..... ............. ..... ....... \n ................ .......... ............. ..... ..... ";
208
+ function U() {
209
+ let e = `\n${jn}\n\n v${V} | %cPixi.js v${H} %c| %chttps://github.com/anthonysapp/caper\n\n`;
295
210
  console.log(e, "color: #E91E63; font-weight: 600;", "color: inherit;", "color: #00BCD4; text-decoration: underline;");
296
211
  }
297
212
  //#endregion
298
213
  //#region src/webgl-check.ts
299
- function hn() {
214
+ function Mn() {
300
215
  if (typeof document > "u") return;
301
216
  let e = document.createElement("canvas");
302
217
  e.getContext("webgl") || e.getContext("experimental-webgl") || console.error("Your browser does not support WebGL.");
303
218
  }
304
219
  //#endregion
305
220
  //#region src/plugins/actions/methods.ts
306
- function gn(e) {
307
- return e ?? le;
221
+ function Nn(e) {
222
+ return e ?? _;
308
223
  }
309
- function _n(e, t, n = !0) {
224
+ function Pn(e, t, n = !0) {
310
225
  return n && (t = {
311
- ...ne,
226
+ ...m,
312
227
  ...t
313
228
  }), t;
314
229
  }
315
- function vn(e) {
230
+ function Fn(e) {
316
231
  return e || [];
317
232
  }
318
233
  //#endregion
319
234
  //#region src/plugins/breakpoints/methods.ts
320
- function yn(e) {
235
+ function In(e) {
321
236
  return {
322
237
  tiers: e.tiers,
323
238
  modes: e.modes ?? {}
@@ -325,43 +240,43 @@ function yn(e) {
325
240
  }
326
241
  //#endregion
327
242
  //#region src/plugins/input/touch/constants.ts
328
- var V = /* @__PURE__ */ function(e) {
243
+ var W = /* @__PURE__ */ function(e) {
329
244
  return e.None = "none", e.Left = "left", e.Top = "top", e.Bottom = "bottom", e.Right = "right", e.TopLeft = "top_left", e.TopRight = "top_right", e.BottomLeft = "bottom_left", e.BottomRight = "bottom_right", e;
330
- }({}), bn = [
331
- V.None,
332
- V.Left,
333
- V.Top,
334
- V.Bottom,
335
- V.Right,
336
- V.TopLeft,
337
- V.TopRight,
338
- V.BottomLeft,
339
- V.BottomRight
245
+ }({}), Ln = [
246
+ W.None,
247
+ W.Left,
248
+ W.Top,
249
+ W.Bottom,
250
+ W.Right,
251
+ W.TopLeft,
252
+ W.TopRight,
253
+ W.BottomLeft,
254
+ W.BottomRight
340
255
  ];
341
256
  //#endregion
342
257
  //#region src/plugins/input/methods.ts
343
- function xn(e, t, n) {
258
+ function Rn(e, t, n) {
344
259
  return n || [];
345
260
  }
346
261
  //#endregion
347
262
  //#region src/core/globals.ts
348
- var Sn = 200, Cn = "CaperApplication";
349
- function wn() {
263
+ var G = 200, zn = "CaperApplication";
264
+ function Bn() {
350
265
  try {
351
266
  return globalThis.Caper?.__dev === !0;
352
267
  } catch {
353
268
  return !1;
354
269
  }
355
270
  }
356
- function Tn() {
271
+ function Vn() {
357
272
  try {
358
273
  return !1;
359
274
  } catch {
360
275
  return !1;
361
276
  }
362
277
  }
363
- var En = "__first__";
364
- function Dn() {
278
+ var K = "__first__";
279
+ function q() {
365
280
  let e = globalThis, t = e.Caper ||= {};
366
281
  return t.apps instanceof Map || (t.apps = /* @__PURE__ */ new Map()), (typeof t.automation != "object" || t.automation === null) && (t.automation = {}), t.__readyResolvers instanceof Map || (t.__readyResolvers = /* @__PURE__ */ new Map()), t.__readyApps instanceof Set || (t.__readyApps = /* @__PURE__ */ new Set()), typeof t.ready != "function" && (t.ready = (e) => {
367
282
  let n = t.__readyResolvers, r = t.__readyApps;
@@ -370,7 +285,7 @@ function Dn() {
370
285
  let e = r.values().next().value;
371
286
  return Promise.resolve(t.apps.get(e));
372
287
  }
373
- let i = e ?? En, a = n.get(i);
288
+ let i = e ?? K, a = n.get(i);
374
289
  if (!a) {
375
290
  let e, t = new Promise((t) => {
376
291
  e = t;
@@ -383,15 +298,15 @@ function Dn() {
383
298
  return a.promise;
384
299
  }), t;
385
300
  }
386
- function On() {
387
- Dn();
301
+ function Hn() {
302
+ q();
388
303
  }
389
- function kn(e) {
390
- return e.config?.id || Cn;
304
+ function J(e) {
305
+ return e.config?.id || zn;
391
306
  }
392
- function An(e) {
393
- let t = kn(e), n = [], r, i = [], a = (e) => {
394
- n.push(e), n.length > Sn && n.splice(0, n.length - Sn);
307
+ function Un(e) {
308
+ let t = J(e), n = [], r, i = [], a = (e) => {
309
+ n.push(e), n.length > G && n.splice(0, n.length - G);
395
310
  }, o = () => r ? r() : void 0, s = (e) => {
396
311
  if (i.length !== 0) for (let t = i.length - 1; t >= 0; t--) {
397
312
  let n = !1;
@@ -461,88 +376,60 @@ function An(e) {
461
376
  });
462
377
  })), c;
463
378
  }
464
- function jn(e) {
465
- let t = Dn(), n = kn(e);
466
- if (t.apps.set(n, e), t.app = e, wn() || e.config?.automation === !0 || Tn()) {
467
- let r = An(e);
379
+ function Y(e) {
380
+ let t = q(), n = J(e);
381
+ if (t.apps.set(n, e), t.app = e, Bn() || e.config?.automation === !0 || Vn()) {
382
+ let r = Un(e);
468
383
  t.automation[n] = r, e.automation = r;
469
384
  }
470
385
  }
471
- function Mn(e) {
472
- let t = Dn(), n = kn(e);
386
+ function X(e) {
387
+ let t = q(), n = J(e);
473
388
  t.__readyApps.add(n);
474
389
  let r = t.__readyResolvers, i = r.get(n);
475
390
  i && (i.resolve(e), r.delete(n));
476
- let a = r.get(En);
477
- a && (a.resolve(e), r.delete(En));
391
+ let a = r.get(K);
392
+ a && (a.resolve(e), r.delete(K));
478
393
  }
479
394
  //#endregion
480
395
  //#region src/core/create.ts
481
- var Nn = "caper-game-container";
482
- function Pn(e) {
396
+ var Wn = "caper-game-container";
397
+ function Z(e) {
483
398
  let t = document.createElement("div");
484
399
  return t.setAttribute("id", e), document.body.appendChild(t), t;
485
400
  }
486
- async function Fn() {
401
+ async function Gn() {
487
402
  return new Promise((e) => {
488
403
  document.readyState === "complete" || document.readyState === "interactive" ? e(!0) : document.addEventListener("DOMContentLoaded", () => {
489
404
  e(!0);
490
405
  });
491
406
  });
492
407
  }
493
- async function In(e = { id: "CaperApplication" }, t = Nn, n = !0) {
494
- await Fn(), hn(), n && mn();
495
- let r = null;
496
- if (typeof t == "string" ? (r = document.getElementById(t), r ||= Pn(t)) : t instanceof HTMLElement ? r = t : t === window && (r = document.body), !r) throw Error("You passed in a DOM Element, but none was found. If you instead pass in a string, a container will be created for you, using the string for its id.");
497
- e.resizeToContainer && (e.resizeTo = r), e.useLayout && (e.layout = {
408
+ async function Kn(e = { id: "CaperApplication" }, t = Wn, n = !0) {
409
+ let { defaultFactoryMethods: r } = await import("./const-C3sxeYhl.js").then((e) => e.t);
410
+ ne(r), await Gn(), Mn(), n && U();
411
+ let i = null;
412
+ if (typeof t == "string" ? (i = document.getElementById(t), i ||= Z(t)) : t instanceof HTMLElement ? i = t : t === window && (i = document.body), !i) throw Error("You passed in a DOM Element, but none was found. If you instead pass in a string, a container will be created for you, using the string for its id.");
413
+ e.resizeToContainer && (e.resizeTo = i), e.useLayout && (e.layout = {
498
414
  autoUpdate: !1,
499
415
  enableDebug: !1,
500
416
  debugModificationCount: 0,
501
417
  throttle: 100
502
- }), e.container = r;
503
- let i = new (e.application || S)();
504
- return await i.initialize(e, r), e.useLayout && (i.stage.layout = {
418
+ }), e.container = i;
419
+ let a = new (e.application || S)();
420
+ return await a.initialize(e, i), e.useLayout && (a.stage.layout = {
505
421
  position: "absolute",
506
422
  width: "100%",
507
423
  height: "100%"
508
- }), await i._postInitialize(), jn(i), globalThis.Caper?.__runtimeManaged || Mn(i), i;
424
+ }), await a._postInitialize(), Y(a), globalThis.Caper?.__runtimeManaged || X(a), a;
509
425
  }
510
426
  //#endregion
511
427
  //#region src/display/Entity.ts
512
- var Ln = class extends _ {
428
+ var qn = class extends b {
513
429
  constructor(e) {
514
430
  super(), this.props = e ?? {};
515
431
  }
516
- }, Rn = ["autoUpdate", "priority"], zn = {
517
- autoUpdate: !0,
518
- priority: 0
519
- }, Bn = class extends Ct {
520
- static {
521
- this.__caper_method_binding_root = !0;
522
- }
523
- constructor(e = {}) {
524
- super(e), this.onDestroy = new p(), this.__config = {
525
- ...zn,
526
- ...e
527
- }, m(this), this.on("added", this._added), this.on("removed", this._removed);
528
- }
529
- get app() {
530
- return S.getInstance();
531
- }
532
- update(e) {}
533
- resize(e) {}
534
- added() {}
535
- destroy(e) {
536
- this.__config.autoUpdate && this.app.ticker.remove(this.update, this), this.onDestroy.emit(), super.destroy(e);
537
- }
538
- removed() {}
539
- _added() {
540
- this.__config.autoUpdate && this.app.ticker.add(this.update, this, this.__config.priority), this.added();
541
- }
542
- _removed() {
543
- this.__config.autoUpdate && this.app.ticker.remove(this.update, this), this.removed();
544
- }
545
- }, Vn = class extends _ {
432
+ }, Jn = class extends b {
546
433
  get animationContext() {
547
434
  return this._animationContext ?? `__scene_${this.id}`;
548
435
  }
@@ -577,7 +464,7 @@ var Ln = class extends _ {
577
464
  }
578
465
  onPause(e) {}
579
466
  onResume(e) {}
580
- }, Hn = class extends _ {
467
+ }, Yn = class extends b {
581
468
  get active() {
582
469
  return this._active;
583
470
  }
@@ -618,163 +505,9 @@ var Ln = class extends _ {
618
505
  _update(e) {
619
506
  this.active && this.initialized && this.update(e);
620
507
  }
621
- }, Un = class extends E {
622
- constructor(e) {
623
- super(typeof e == "string" ? C.get(e) : e);
624
- let t = this.getLocalBounds();
625
- this.pivot.set((t.x + t.width) / 2, (t.y + t.height) / 2);
626
- }
627
- }, Wn;
628
- function H(e, t) {
629
- for (let n in e) try {
630
- t[n] = e[n];
631
- } catch (e) {
632
- c.warn(`Error setting property ${n}`, e);
633
- }
634
- }
635
- function U() {
636
- if (!Wn) {
637
- let e = new E();
638
- e.rect(0, 0, 100, 100), e.fill({ color: 16711680 }), e.stroke({
639
- color: 16777215,
640
- width: 1,
641
- alignment: 0
642
- }), e.moveTo(0, 0), e.lineTo(100, 100), e.moveTo(100, 0), e.lineTo(0, 100), e.stroke({
643
- color: 16777215,
644
- width: 2,
645
- alignment: .5
646
- }), Wn = S.getInstance().renderer.generateTexture(e), e.destroy();
647
- }
648
- return Wn;
649
- }
650
- function W(e) {
651
- let t, n = e?.asset, r = n, i = e?.sheet;
652
- if (n instanceof k) t = n;
653
- else if (!i || i?.length === 0) C.cache.has(r) ? t = C.get(r) : C.get(r) ? t = C.get(r).texture : (c.error("Asset \"" + n + "\" not loaded into Pixi cache"), t = U());
654
- else if (C.get(i)) {
655
- let e = C.get(i), a = e.textures;
656
- if (a !== void 0) if (a.hasOwnProperty(r)) t = a[r];
657
- else if (e.linkedSheets !== void 0 && e.linkedSheets.length > 0) {
658
- for (let n of e.linkedSheets) if (n.textures !== void 0 && n.textures.hasOwnProperty(r)) {
659
- t = n.textures[r];
660
- break;
661
- }
662
- t === void 0 && (c.error("Asset \"" + n + "\" not found inside spritesheet \"" + n + "' or any of its linked sheets"), t = U());
663
- } else c.error("Asset \"" + n + "\" not found inside spritesheet \"" + i + "'"), t = U();
664
- else c.error("Spritesheet \"" + i + "\" loaded but textures arent?!"), t = U();
665
- } else return c.error("Spritesheet \"" + i + "\" not loaded into Pixi cache"), U();
666
- return t || new Et().texture;
667
- }
668
- function G(e, t) {
669
- let n = y(e.position, !1, e.x, e.y);
670
- t.x = n.x, t.y = n.y;
671
- }
672
- function K(e, t) {
673
- if (!e) return;
674
- if (e.scale === void 0) {
675
- if (e.scaleX === void 0 && e.scaleY === void 0) return;
676
- e.scaleX === void 0 && (e.scaleX = 1), e.scaleY === void 0 && (e.scaleY = 1);
677
- }
678
- let n = y(e.scale, !1, e.scaleX, e.scaleY);
679
- t.scale.set(n.x, n.y);
680
- }
681
- function Gn(e, t) {
682
- if (e !== void 0) {
683
- let n = y(e);
684
- t.anchor.set(n.x, n.y);
685
- }
686
- }
687
- function q(e, t) {
688
- if (e !== void 0) {
689
- let n = y(e);
690
- t.pivot.set(n.x, n.y);
691
- }
692
- }
693
- //#endregion
694
- //#region src/display/AnimatedSprite.ts
695
- var Kn = class e extends bt {
696
- constructor(t) {
697
- let n = t?.animations ?? {}, r = t?.animation ?? Object.keys(n)[0], i = n[r], a = t?.sheet, o = t?.texturePrefix || "", s = t?.zeroPad, c = t?.startIndex ?? 0;
698
- super(e.generateTexturesFromProps(r, i, o, a, s, c), t?.autoUpdate !== !1), this.config = t, this.onAnimationChange = new p(), this.onAnimationStart = new p(), this.onAnimationStop = new p(), this.onAnimationLoop = new p(), this.onAnimationComplete = new p(), this.onAnimationFrameChange = new p(), this.defaultTexturePrefix = "", this._paused = !1, this._isReversed = !1, m(this), this.defaultSheet = a, this.defaultTexturePrefix = o, this.defaultZeroPad = s, this._generateAnimations(), this.currentAnimation = this.defaultAnimation = r, this.autoPlay = t?.autoPlay ?? !0, this.loop = t?.loop ?? !0, this.updateAnchor = t?.updateAnchor ?? !1, this.animationSpeed = this.defaultAnimationSpeed = t?.animationSpeed ?? 1, this.on("added", this._added);
699
- }
700
- get paused() {
701
- return this._paused;
702
- }
703
- set paused(e) {
704
- this._paused = e;
705
- }
706
- get speed() {
707
- return this.animationSpeed;
708
- }
709
- set speed(e) {
710
- this.animationSpeed = this.defaultAnimationSpeed = e;
711
- }
712
- get isReversed() {
713
- return this._isReversed;
714
- }
715
- static generateTexturesFromProps(e, t, n = "", r = void 0, i, a) {
716
- let o = [], s = "", c = t?.sheet ?? r;
717
- if (t?.numFrames > 1) {
718
- let r = t?.startIndex ?? a ?? 0;
719
- for (let a = r; a < r + t?.numFrames; a++) s = `${n}${t?.texturePrefix ?? e}${Ut(a, t?.zeroPad ?? i)}`, o.push(W({
720
- asset: s,
721
- sheet: c
722
- }));
723
- } else s = `${n}${t?.texturePrefix ?? e}`, o.push(W({
724
- asset: s,
725
- sheet: c
726
- }));
727
- return o;
728
- }
729
- reverse() {
730
- this._isReversed = !this._isReversed, this._isReversed ? this.setAnimation(`${this.currentAnimation}_reverse`) : this.setAnimation(this.currentAnimation.split("_reverse")[0]);
731
- }
732
- setAnimation(e, t = !0) {
733
- if (!this._animations.has(e)) throw Error(`Animation ${e} does not exist`);
734
- this.textures = this._animations.get(e), this.currentAnimation = e;
735
- let n = this.config?.animations?.[e.split("_reverse")[0]]?.animationSpeed;
736
- n ? this.animationSpeed = n : this.animationSpeed = this.defaultAnimationSpeed, this.onAnimationChange.emit(e), t && this.play();
737
- }
738
- play() {
739
- super.play(), this.onAnimationStart?.emit();
740
- }
741
- stop() {
742
- super.stop(), this.onAnimationStop?.emit();
743
- }
744
- nextAnimation() {
745
- let e = lt(this._animations, this.currentAnimation) ?? ze(this._animations);
746
- e && this.setAnimation(e[0]);
747
- }
748
- previousAnimation() {
749
- let e = ht(this._animations, this.currentAnimation) ?? ke(this._animations);
750
- e && this.setAnimation(e[0]);
751
- }
752
- update(e) {
753
- this._paused || super.update(e);
754
- }
755
- _generateAnimations() {
756
- this._animations = /* @__PURE__ */ new Map();
757
- let t = this.config?.animations ?? {};
758
- if (t) {
759
- for (let [n, r] of Object.entries(t)) this._animations.set(n, e.generateTexturesFromProps(n, r, this.defaultTexturePrefix, this.defaultSheet, this.defaultZeroPad));
760
- if (this.config?.reversible) for (let [n, r] of Object.entries(t)) {
761
- let t = e.generateTexturesFromProps(n, r, this.defaultTexturePrefix, this.defaultSheet, this.defaultZeroPad);
762
- t.reverse(), this._animations.set(`${n}_reverse`, t);
763
- }
764
- }
765
- }
766
- _added() {
767
- this.onLoop = () => {
768
- this.onAnimationLoop.emit();
769
- }, this.onComplete = () => {
770
- this.onAnimationComplete.emit();
771
- }, this.onFrameChange = () => {
772
- this.onAnimationFrameChange.emit();
773
- }, this.autoPlay && this.play();
774
- }
775
- }, qn = class extends xt {
508
+ }, Xn = class extends $t {
776
509
  constructor(e) {
777
- return super({ isRenderGroup: !0 }), this.config = e, this.onZoom = new p(), this.onZoomComplete = new p(), this.minX = 0, this.minY = 0, this._zooming = !1, this._zoomLerp = .1, this._targetPivot = new D(0, 0), this._targetScale = new D(1, 1), this._lerp = 0, this._target = null, this._followOffset = new D(0, 0), m(this), e && (this.container = e.container, this.addChild(this.container), e.minX && (this.minX = e.minX), e.maxX && (this.maxX = e.maxX), e.minY && (this.minY = e.minY), this.viewportWidth = e.viewportWidth ?? this.app.size.width, this.viewportHeight = e.viewportHeight ?? this.app.size.height, this.worldWidth = e.worldWidth ?? this.viewportWidth, this.worldHeight = e.worldHeight ?? this.viewportHeight, this.maxX = e.maxX ?? this.worldWidth - this.viewportWidth, this.maxY = e.maxY ?? this.worldHeight - this.viewportHeight), this._targetPivot.set(this.viewportWidth * .5, this.viewportHeight * .5), e.target && (this.target = e.target), this._lerp = 1, this.update(), e.lerp && (this.lerp = e.lerp), this;
510
+ return super({ isRenderGroup: !0 }), this.config = e, this.onZoom = new p(), this.onZoomComplete = new p(), this.minX = 0, this.minY = 0, this._zooming = !1, this._zoomLerp = .1, this._targetPivot = new A(0, 0), this._targetScale = new A(1, 1), this._lerp = 0, this._target = null, this._followOffset = new A(0, 0), v(this), e && (this.container = e.container, this.addChild(this.container), e.minX && (this.minX = e.minX), e.maxX && (this.maxX = e.maxX), e.minY && (this.minY = e.minY), this.viewportWidth = e.viewportWidth ?? this.app.size.width, this.viewportHeight = e.viewportHeight ?? this.app.size.height, this.worldWidth = e.worldWidth ?? this.viewportWidth, this.worldHeight = e.worldHeight ?? this.viewportHeight, this.maxX = e.maxX ?? this.worldWidth - this.viewportWidth, this.maxY = e.maxY ?? this.worldHeight - this.viewportHeight), this._targetPivot.set(this.viewportWidth * .5, this.viewportHeight * .5), e.target && (this.target = e.target), this._lerp = 1, this.update(), e.lerp && (this.lerp = e.lerp), this;
778
511
  }
779
512
  get zooming() {
780
513
  return this._zooming;
@@ -805,7 +538,7 @@ var Kn = class e extends bt {
805
538
  return this._followOffset;
806
539
  }
807
540
  set followOffset(e) {
808
- this._followOffset = y(e, !0);
541
+ this._followOffset = x(e, !0);
809
542
  }
810
543
  get app() {
811
544
  return S.getInstance();
@@ -845,9 +578,9 @@ var Kn = class e extends bt {
845
578
  } else this.pivot.set(this._targetPivot.x, this._targetPivot.y);
846
579
  this.position.set(this.viewportWidth / 2, this.viewportHeight / 2);
847
580
  }
848
- }, Jn = class {
581
+ }, Zn = class {
849
582
  constructor(e, t) {
850
- this.camera = e, this.interactiveArea = t, this.dragging = !1, this.previousPointerPosition = null, m(this), this.camera = e, this.interactiveArea = t, this.app.keyboard.onKeyDown().connect(this.handleKeyDown), this.interactiveArea.on("pointerdown", this.onPointerDown.bind(this)), this.interactiveArea.on("pointermove", this.onPointerMove.bind(this)), this.app.stage.on("pointerup", this.onPointerUp.bind(this)), this.app.stage.on("pointerupoutside", this.onPointerUp.bind(this)), this.interactiveArea.on("touchstart", this.onPointerDown.bind(this)), this.interactiveArea.on("touchmove", this.onPointerMove.bind(this)), this.interactiveArea.on("touchend", this.onPointerUp.bind(this));
583
+ this.camera = e, this.interactiveArea = t, this.dragging = !1, this.previousPointerPosition = null, v(this), this.camera = e, this.interactiveArea = t, this.app.keyboard.onKeyDown().connect(this.handleKeyDown), this.interactiveArea.on("pointerdown", this.onPointerDown.bind(this)), this.interactiveArea.on("pointermove", this.onPointerMove.bind(this)), this.app.stage.on("pointerup", this.onPointerUp.bind(this)), this.app.stage.on("pointerupoutside", this.onPointerUp.bind(this)), this.interactiveArea.on("touchstart", this.onPointerDown.bind(this)), this.interactiveArea.on("touchmove", this.onPointerMove.bind(this)), this.interactiveArea.on("touchend", this.onPointerUp.bind(this));
851
584
  }
852
585
  get app() {
853
586
  return S.getInstance();
@@ -890,1519 +623,15 @@ var Kn = class e extends bt {
890
623
  this.dragging = !1, this.previousPointerPosition = null;
891
624
  }
892
625
  getEventPosition(e) {
893
- return e instanceof TouchEvent ? new D(e.touches[0].clientX, e.touches[0].clientY) : new D(e.clientX, e.clientY);
894
- }
895
- }, Yn = h(v()), Xn = class extends Yn {
896
- get app() {
897
- return S.getInstance();
898
- }
899
- get animationNames() {
900
- return this.spine.state.data.skeletonData.animations.map((e) => e.name);
901
- }
902
- get currentEntry() {
903
- return this.spine.state.getCurrent(0);
904
- }
905
- get elapsedAnimationTime() {
906
- return this.currentEntry ? this.currentEntry.trackTime : -1;
907
- }
908
- constructor(e) {
909
- super(), this.onAnimationComplete = new p(), this.onAnimationStart = new p(), this.onAnimationInterrupt = new p(), this.onAnimationDispose = new p(), this.onAnimationEnd = new p(), this.onAnimationEvent = new p(), this.onPaused = new p(), this.onResumed = new p(), m(this);
910
- let t = e?.data, n = "";
911
- if (typeof t == "string") {
912
- let e = t.slice(-5);
913
- e !== ".json" && e !== ".skel" ? e = ".json" : t = t.substring(0, t.length - 5), n = {
914
- skeleton: t + e,
915
- atlas: t + ".atlas"
916
- };
917
- }
918
- this.spine = window.Spine.from(n), this.add.existing(this.spine), e && (e.autoUpdate !== void 0 && (this.spine.autoUpdate = e.autoUpdate), e.animationName && this.setAnimation(e.animationName, e.loop, e.trackIndex ?? 0)), this.addSignalConnection(this.app.actions("toggle_pause").connect(this.togglePause)), e?.paused && this.pause(), this._stateListener = {
919
- start: this._handleAnimationStart,
920
- interrupt: this._handleAnimationInterrupt,
921
- dispose: this._handleAnimationDispose,
922
- end: this._handleAnimationEnd,
923
- event: this._handleAnimationEvent,
924
- complete: this._handleAnimationComplete
925
- }, this.spine.state.addListener(this._stateListener);
926
- }
927
- destroy() {
928
- this.spine.state.removeListener(this._stateListener), super.destroy();
929
- }
930
- getCurrentAnimation(e = 0) {
931
- return this.spine.state.getCurrent(e)?.animation?.name || "";
932
- }
933
- setAnimation(e, t = !1, n = 0) {
934
- this.spine.state.setAnimation(n, e, t);
935
- }
936
- pause() {
937
- this.paused = !0, this.spine.autoUpdate = !1, this.currentEntry && (this.currentEntry.timeScale = 0), this.onPaused.emit(this.currentEntry);
938
- }
939
- resume() {
940
- this.paused = !1, this.spine.autoUpdate = !0, this.currentEntry && (this.currentEntry.timeScale = 1), this.onResumed.emit(this.currentEntry);
941
- }
942
- togglePause() {
943
- this.paused ? this.resume() : this.pause();
944
- }
945
- _handleAnimationComplete(e) {
946
- this.onAnimationComplete.emit(e);
947
- }
948
- _handleAnimationStart(e) {
949
- this.onAnimationStart.emit(e);
950
- }
951
- _handleAnimationInterrupt(e) {
952
- this.onAnimationInterrupt.emit(e);
953
- }
954
- _handleAnimationDispose(e) {
955
- this.onAnimationDispose.emit(e);
956
- }
957
- _handleAnimationEnd(e) {
958
- this.onAnimationEnd.emit(e);
959
- }
960
- _handleAnimationEvent(e, t) {
961
- this.onAnimationEvent.emit(e, t);
962
- }
963
- };
964
- //#endregion
965
- //#region src/mixins/focus.ts
966
- function J(e) {
967
- return class extends e {
968
- constructor(...e) {
969
- super(...e), this.isFocused = !1, this.isKeyDown = !1, this.focusEnabled = !0, this.tabIndex = 0, this.accessible = !1, this.accessibleType = "button", this.accessibleTitle = "Focusable", this.accessibleHint = "Press enter to focus", this.accessiblePointerEvents = "auto", this.accessibleChildren = !0, this.onFocus = new p(), this.onFocusIn = new p(), this.onFocusOut = new p(), this.onBlur = new p(), this._eventsDisabled = !1, this.eventMode = "static", this.on("mouseover", this._onMouseOver), this.on("mousedown", this._onMouseDown), this.on("click", this._handleClick), this.on("tap", this._handleClick);
970
- }
971
- get app() {
972
- return S.getInstance();
973
- }
974
- destroy(e) {
975
- this.off("mouseover", this._onMouseOver), this.off("mousedown", this._onMouseDown), this.off("click", this._handleClick), this.off("tap", this._handleClick), super.destroy(e);
976
- }
977
- focusIn() {
978
- this.app.focus.active && this.emit("pointerover", { type: "pointerover" });
979
- }
980
- blur() {
981
- this.isKeyDown || window.removeEventListener("keyup", this._handleKeyUp.bind(this));
982
- }
983
- focusOut() {
984
- this.isKeyDown || window.removeEventListener("keyup", this._handleKeyUp.bind(this)), this.app.focus.active && this.emit("pointerout", { type: "pointerout" });
985
- }
986
- click() {}
987
- getFocusPosition() {
988
- return null;
989
- }
990
- getFocusArea() {
991
- return this.getBounds();
992
- }
993
- getFocusSize() {
994
- return [this.getFocusArea().width, this.getFocusArea().height];
995
- }
996
- _onMouseOver(e) {
997
- this.app.focus.setFocus(this);
998
- }
999
- _onMouseDown(e) {
1000
- this._maybeEmit("pointerdown", e);
1001
- }
1002
- _handleClick(e) {
1003
- this._maybeEmit("click", e), this.click();
1004
- }
1005
- _handleKeyUp(e) {}
1006
- _maybeEmit(e, t) {
1007
- this._eventsDisabled || t.type || (this._eventsDisabled = !0, this.emit(e, { type: e }), this._eventsDisabled = !1);
1008
- }
1009
- };
1010
- }
1011
- J.INITTED = !1;
1012
- //#endregion
1013
- //#region src/mixins/interaction.ts
1014
- function Zn(e) {
1015
- return class extends e {
1016
- constructor(...e) {
1017
- super(...e), this._signals = /* @__PURE__ */ new Map(), this._emitSignal = this._emitSignal.bind(this), this.eventMode = "static";
1018
- }
1019
- onInteraction(e) {
1020
- if (!this._signals.has(e)) {
1021
- let t = new p();
1022
- this._signals.set(e, t), this.on(e, this._emitSignal);
1023
- }
1024
- return this._signals.get(e);
1025
- }
1026
- destroy(e) {
1027
- for (let e of this._signals.keys()) this.off(e, this._emitSignal);
1028
- this._signals.clear(), super.destroy(e);
1029
- }
1030
- _emitSignal(e) {
1031
- let t = e.type, n = this._signals.get(t);
1032
- n && n.emit(e);
1033
- }
1034
- };
1035
- }
1036
- //#endregion
1037
- //#region src/ui/Button.ts
1038
- var Qn = [
1039
- "textures",
1040
- "sounds",
1041
- "actions",
1042
- "cursor",
1043
- "disabledCursor",
1044
- "sheet",
1045
- "enabled",
1046
- "layout",
1047
- "textLabel"
1048
- ], $n = J(Zn(h(v()))), er = class extends $n {
1049
- get textLabel() {
1050
- return this._textLabel;
1051
- }
1052
- constructor(e) {
1053
- super(), this.onDown = new p(), this.onUp = new p(), this.onUpOutside = new p(), this.onOut = new p(), this.onOver = new p(), this.onClick = new p(), this.onEnabled = new p(), this.onDisabled = new p(), this.onKeyboardEvent = new p(), this.onDestroy = new p(), this._isDownCallbacks = /* @__PURE__ */ new Map(), this._isDownListenerAdded = !1, m(this), this.config = Object.assign({
1054
- id: "button",
1055
- textures: { default: "" },
1056
- sheet: void 0,
1057
- enabled: !0,
1058
- cursor: "default",
1059
- disabledCursor: "not-allowed"
1060
- }, e), this.id = this.config.id, e.layout === void 0 ? this.layout = !1 : this.layout = e.layout, this.view = this.add.sprite({
1061
- asset: this.config.textures.default,
1062
- sheet: this.config.sheet ?? void 0
1063
- }), this.cursor = this.config.cursor, this.enabled = e.enabled !== !1, this.layout?.style.transformOrigin !== "top left" && (this.layout = { transformOrigin: "top left" }, this.app.renderer.layout && this.app.renderer.layout.update(this)), this.config.textLabel && this.addLabel(this.config.textLabel), this.addSignalConnection(this.onInteraction("pointerover").connect(this.handlePointerOver, -1), this.onInteraction("pointerout").connect(this.handlePointerOut, -1), this.onInteraction("pointerup").connect(this.handlePointerUp, -1), this.onInteraction("click").connect(this.handleClick, -1), this.onInteraction("tap").connect(this.handleClick, -1), this.onInteraction("pointerdown").connect(this.handlePointerDown, -1)), this.on("removed", this._resetPressState);
1064
- }
1065
- set enabled(e) {
1066
- this._enabled !== e && (this._enabled = e, this.cursor = this._enabled ? this.config.cursor : this.config.disabledCursor, this.focusEnabled = e, this._enabled ? (this.view.texture = this.make.texture({
1067
- asset: this.config.textures.default,
1068
- sheet: this.config.sheet ?? void 0
1069
- }), this.onEnabled.emit()) : (this._resetPressState(), this.view.texture = this.make.texture({
1070
- asset: this.config.textures.disabled || this.config.textures.default,
1071
- sheet: this.config.sheet ?? void 0
1072
- }), this.onDisabled.emit()));
1073
- }
1074
- _resetPressState() {
1075
- window.removeEventListener("pointerup", this.handlePointerUpOutside), this.off("pointerupoutside", this.handlePointerUpOutside), this.isDown = !1, this._pointerId = void 0;
1076
- }
1077
- addLabel(e) {
1078
- if (e instanceof O || e instanceof St || e instanceof w) e.anchor.set(.5, .5), this._textLabel = this.add.existing(e), this._textLabel.layout = !1;
1079
- else switch (e.anchor = .5, e.type) {
1080
- case "bitmap":
1081
- this._textLabel = this.add.bitmapText({
1082
- ...e,
1083
- layout: !1
1084
- });
1085
- break;
1086
- case "html":
1087
- this._textLabel = this.add.htmlText({
1088
- ...e,
1089
- layout: !1
1090
- });
1091
- break;
1092
- default:
1093
- this._textLabel = this.add.text({
1094
- ...e,
1095
- layout: !1
1096
- });
1097
- break;
1098
- }
1099
- return this.positionLabel(), this._textLabel;
1100
- }
1101
- positionLabel() {
1102
- this._textLabel && this._textLabel.position.set(this.view.width * .5, this.view.height * .5);
1103
- }
1104
- get enabled() {
1105
- return this._enabled;
1106
- }
1107
- get app() {
1108
- return S.getInstance();
1109
- }
1110
- destroy(e) {
1111
- this.onDestroy.emit(), this._resetPressState(), this._isDownListenerAdded &&= (this.app.ticker.remove(this._handleIsDownCallbacks), !1), super.destroy(e);
1112
- }
1113
- focusOut() {
1114
- super.focusOut(), this.isDown = !1, this.isOver = !1;
1115
- }
1116
- blur() {
1117
- super.blur(), this.isDown = !1, this.isOver = !1;
1118
- }
1119
- getFocusArea() {
1120
- return this.view.getBounds().clone();
1121
- }
1122
- addIsDownCallback(e, t) {
1123
- this._isDownCallbacks.set(e, t), this._checkIsDownCallbacks();
1124
- }
1125
- removeIsDownCallback(e) {
1126
- this._isDownCallbacks.delete(e), this._checkIsDownCallbacks();
1127
- }
1128
- setTexture(e, t) {
1129
- this.config.textures[e] = t, e === "default" && (this.view.texture = this.make.texture({
1130
- asset: this.config.textures.default,
1131
- sheet: this.config.sheet
1132
- })), this.positionLabel();
1133
- }
1134
- handlePointerOver() {
1135
- this._enabled && (this.isOver ||= !0, !this.isDown && (this.view.texture = this.make.texture({
1136
- asset: this.config.textures.hover || this.config.textures.default,
1137
- sheet: this.config.sheet
1138
- }), this.onOver.emit(), this.config.sounds?.hover && this.app.audio.play(this.config.sounds.hover, "sfx"), this.config.actions?.hover && this._doAction(this.config.actions.hover)));
1139
- }
1140
- handlePointerOut() {
1141
- this.isOver = !1, this._enabled && (this.isDown || (this.view.texture = this.make.texture({
1142
- asset: this.config.textures.default,
1143
- sheet: this.config.sheet
1144
- }), this.config.sounds?.out && this.app.audio.play(this.config.sounds.out, "sfx"), this.onOut.emit()));
1145
- }
1146
- handlePointerDown(e) {
1147
- !this._enabled && !this.isKeyDown || !this.isDown && this._pointerId === void 0 && (this._pointerId = e.pointerId, window.removeEventListener("pointerup", this.handlePointerUpOutside), this.off("pointerupoutside", this.handlePointerUpOutside), window.addEventListener("pointerup", this.handlePointerUpOutside), this.on("pointerupoutside", this.handlePointerUpOutside), this.isDown = !0, this.view.texture = this.make.texture({
1148
- asset: this.config.textures.active || this.config.textures.hover || this.config.textures.default,
1149
- sheet: this.config.sheet
1150
- }), this.onDown.emit(), this.config.sounds?.down && this.app.audio.play(this.config.sounds.down, "sfx"), this.config.actions?.down && this._doAction(this.config.actions.down));
1151
- }
1152
- handlePointerUp(e) {
1153
- !this._enabled || !this.isOver || e.pointerId !== this._pointerId || (window.removeEventListener("pointerup", this.handlePointerUpOutside), this.view.texture = this.make.texture({
1154
- asset: this.config.textures.default,
1155
- sheet: this.config.sheet
1156
- }), this.onUp.emit(), this._pointerId = void 0);
1157
- }
1158
- handleClick(e) {
1159
- this._enabled && (e?.pointerId !== void 0 && !this.isDown || e !== void 0 && e === this._lastClickEvent || (this._lastClickEvent = e, this.isDown = !1, this.onClick.emit(), this.config.sounds?.click && this.app.audio.play(this.config.sounds.click, "sfx"), this.config.actions?.click && this._doAction(this.config.actions.click)));
1160
- }
1161
- handlePointerUpOutside(e) {
1162
- if (e.pointerId !== this._pointerId) return;
1163
- let t = this._enabled;
1164
- this._resetPressState(), this.isOver = !1, t && (this.view.texture = this.make.texture({
1165
- asset: this.config.textures.default,
1166
- sheet: this.config.sheet
1167
- }), this.onUpOutside.emit());
1168
- }
1169
- _doAction(e) {
1170
- typeof e == "function" ? e() : (e.data ??= {}, e.data.button || (e.data.button = this), this.app.action(e.id, e.data));
1171
- }
1172
- _checkIsDownCallbacks() {
1173
- !this._isDownListenerAdded && this._isDownCallbacks.size > 0 ? (this._isDownListenerAdded = !0, this.app.ticker.add(this._handleIsDownCallbacks)) : this._isDownListenerAdded && this._isDownCallbacks.size === 0 && (this.app.ticker.remove(this._handleIsDownCallbacks), this._isDownListenerAdded = !1);
1174
- }
1175
- _handleIsDownCallbacks() {
1176
- this.isDown && this._isDownCallbacks.forEach((e) => {
1177
- e();
1178
- });
1179
- }
1180
- }, tr = h(v());
1181
- function nr(e) {
1182
- return e instanceof O || e instanceof w;
1183
- }
1184
- var rr = [
1185
- "bindTo",
1186
- "bindToAppSize",
1187
- "autoLayoutChildren",
1188
- "debug"
1189
- ], ir = class extends tr {
1190
- constructor(e = {}) {
1191
- if (super(), this.onLayoutComplete = new p(), this._debugGraphics = null, this._debugLabel = null, !this.app.config.useLayout) throw Error("You must set useLayout to true in your app config to use FlexContainer");
1192
- m(this), this.config = {
1193
- autoLayoutChildren: !0,
1194
- ...e
1195
- }, this.layout = this.createLayout(e), this.on("added", this.handleAdded), this.on("childAdded", this.handleChildAdded), this.on("childRemoved", this.handleChildRemoved), this.config.bindToAppSize && this.app.onResize.connect(this.handleResize), this.config.bindTo && "on" in this.config.bindTo && this.config.bindTo.on("layout", this.handleBindToResize);
1196
- }
1197
- createLayout(e) {
1198
- e?.layout === !0 && (e.layout = {});
1199
- let t = { ...e?.layout ?? {} };
1200
- return this.config.bindToAppSize ? (t.width = this.app.size.width, t.height = this.app.size.height) : this.config.bindTo && (t.width = this.config.bindTo.width, t.height = this.config.bindTo.height), t;
1201
- }
1202
- handleAdded() {
1203
- this.updateLayout();
1204
- }
1205
- _updateLayout() {
1206
- this.app.ticker.addOnce(this.updateLayout);
1207
- }
1208
- handleChildAdded(e) {
1209
- this.config.autoLayoutChildren && (e.layout ? nr(e) && !e.layout?.style?.isLeaf && (e.layout = { isLeaf: !0 }) : e.layout = { isLeaf: !0 }), _.childAdded(e), e.on("layout", this._updateLayout), this._updateLayout();
1210
- }
1211
- handleChildRemoved(e) {
1212
- e.off("layout", this._updateLayout), _.childRemoved(e), this._updateLayout();
1213
- }
1214
- handleResize() {
1215
- this.config.bindToAppSize && (this.layout = {
1216
- width: this.app.size.width,
1217
- height: this.app.size.height
1218
- }), this._updateLayout();
1219
- }
1220
- handleBindToResize() {
1221
- this.config.bindTo && (this.layout = {
1222
- width: this.config.bindTo.width,
1223
- height: this.config.bindTo.height
1224
- }, this._updateLayout());
1225
- }
1226
- updateLayout() {
1227
- this.destroyed || !this.layout || !this.app?.renderer.layout || (this.app.renderer.layout.update(this), this.onLayoutComplete.emit(), this.config.debug && this.drawDebug());
1228
- }
1229
- get app() {
1230
- return S.getInstance();
1231
- }
1232
- configure(e) {
1233
- this.layout = e, this._updateLayout();
1234
- }
1235
- get gap() {
1236
- return this.layout?.style?.gap ?? 0;
1237
- }
1238
- set gap(e) {
1239
- this.layout = { gap: e }, this._updateLayout();
1240
- }
1241
- get flexWrap() {
1242
- return this.layout?.style?.flexWrap;
1243
- }
1244
- set flexWrap(e) {
1245
- this.layout = { flexWrap: e }, this._updateLayout();
1246
- }
1247
- get flexDirection() {
1248
- return this.layout?.style?.flexDirection;
1249
- }
1250
- set flexDirection(e) {
1251
- this.layout = { flexDirection: e }, this._updateLayout();
1252
- }
1253
- get alignItems() {
1254
- return this.layout?.style?.alignItems;
1255
- }
1256
- set alignItems(e) {
1257
- this.layout = { alignItems: e }, this._updateLayout();
1258
- }
1259
- get justifyContent() {
1260
- return this.layout?.style?.justifyContent;
1261
- }
1262
- set justifyContent(e) {
1263
- this.layout = { justifyContent: e }, this._updateLayout();
1264
- }
1265
- get size() {
1266
- return {
1267
- width: this.layout?.style?.width,
1268
- height: this.layout?.style?.height
1269
- };
1270
- }
1271
- set size(e) {
1272
- Array.isArray(e) && (e = {
1273
- width: e[0],
1274
- height: e[1]
1275
- }), (typeof e == "number" || typeof e == "string") && (e = {
1276
- width: e,
1277
- height: e
1278
- }), this.layout = { ...e }, this._updateLayout();
1279
- }
1280
- get layoutWidth() {
1281
- return this.layout?.style?.width;
1282
- }
1283
- set layoutWidth(e) {
1284
- this.layout = { width: e }, this._updateLayout();
1285
- }
1286
- get layoutHeight() {
1287
- return this.layout?.style?.height;
1288
- }
1289
- set layoutHeight(e) {
1290
- this.layout = { height: e }, this._updateLayout();
1291
- }
1292
- get padding() {
1293
- return this.layout?.style?.padding;
1294
- }
1295
- set padding(e) {
1296
- this.layout = { padding: e }, this._updateLayout();
1297
- }
1298
- get paddingTop() {
1299
- return this.layout?.style?.paddingTop;
1300
- }
1301
- set paddingTop(e) {
1302
- this.layout = { paddingTop: e }, this._updateLayout();
1303
- }
1304
- get paddingRight() {
1305
- return this.layout?.style?.paddingRight;
1306
- }
1307
- set paddingRight(e) {
1308
- this.layout = { paddingRight: e }, this._updateLayout();
1309
- }
1310
- get paddingBottom() {
1311
- return this.layout?.style?.paddingBottom;
1312
- }
1313
- set paddingBottom(e) {
1314
- this.layout = { paddingBottom: e }, this._updateLayout();
1315
- }
1316
- get paddingLeft() {
1317
- return this.layout?.style?.paddingLeft;
1318
- }
1319
- set paddingLeft(e) {
1320
- this.layout = { paddingLeft: e }, this._updateLayout();
626
+ return e instanceof TouchEvent ? new A(e.touches[0].clientX, e.touches[0].clientY) : new A(e.clientX, e.clientY);
1321
627
  }
1322
- get margin() {
1323
- return this.layout?.style?.margin;
1324
- }
1325
- set margin(e) {
1326
- this.layout = { margin: e }, this._updateLayout();
1327
- }
1328
- get marginTop() {
1329
- return this.layout?.style?.marginTop;
1330
- }
1331
- set marginTop(e) {
1332
- this.layout = { marginTop: e }, this._updateLayout();
1333
- }
1334
- get marginRight() {
1335
- return this.layout?.style?.marginRight;
1336
- }
1337
- set marginRight(e) {
1338
- this.layout = { marginRight: e }, this._updateLayout();
1339
- }
1340
- get marginBottom() {
1341
- return this.layout?.style?.marginBottom;
1342
- }
1343
- set marginBottom(e) {
1344
- this.layout = { marginBottom: e }, this._updateLayout();
1345
- }
1346
- get marginLeft() {
1347
- return this.layout?.style?.marginLeft;
1348
- }
1349
- set marginLeft(e) {
1350
- this.layout = { marginLeft: e }, this._updateLayout();
1351
- }
1352
- get debug() {
1353
- return this.config.debug ?? !1;
1354
- }
1355
- set debug(e) {
1356
- this.config.debug = e, e ? (P(`FlexContainer:${this.uid}`, this.label || "FlexContainer", j.bounds), this.drawDebug()) : (F(`FlexContainer:${this.uid}`), this._debugGraphics && this._debugGraphics.clear(), this._debugLabel && (this._debugLabel.visible = !1));
1357
- }
1358
- drawDebug() {
1359
- (!this._debugGraphics || this._debugGraphics.parent !== this) && (this._debugGraphics ||= Ft(`${this.label ?? "FlexContainer"}:debug`), this.addChild(this._debugGraphics), this._debugGraphics.layout = !1), (!this._debugLabel || this._debugLabel.parent !== this) && (this._debugLabel ||= N(this.label || "FlexContainer", j.bounds), this.addChild(this._debugLabel), this._debugLabel.layout = !1), this._debugLabel.text = this.label || "FlexContainer", this._debugLabel.visible = !0, this.setChildIndex(this._debugGraphics, this.children.length - 1), this.setChildIndex(this._debugLabel, this.children.length - 1), this._debugGraphics.clear();
1360
- let e = this.layout?.computedLayout;
1361
- if (!e) return;
1362
- let t = e.width, n = e.height, r = this.layout?.style?.flexDirection ?? "row", i = this.layout?.style?.gap ?? 0;
1363
- this._debugGraphics.rect(0, 0, t, n).stroke({
1364
- width: 1,
1365
- color: j.bounds,
1366
- alpha: M.stroke,
1367
- pixelLine: !0
1368
- });
1369
- let a = this.layout?.style?.paddingTop ?? 0, o = this.layout?.style?.paddingRight ?? 0, s = this.layout?.style?.paddingBottom ?? 0, c = this.layout?.style?.paddingLeft ?? 0;
1370
- a > 0 && this._debugGraphics.rect(0, 0, t, a).fill({
1371
- color: j.outerBounds,
1372
- alpha: M.fill
1373
- }), s > 0 && this._debugGraphics.rect(0, n - s, t, s).fill({
1374
- color: j.outerBounds,
1375
- alpha: M.fill
1376
- }), c > 0 && this._debugGraphics.rect(0, a, c, n - a - s).fill({
1377
- color: j.outerBounds,
1378
- alpha: M.fill
1379
- }), o > 0 && this._debugGraphics.rect(t - o, a, o, n - a - s).fill({
1380
- color: j.outerBounds,
1381
- alpha: M.fill
1382
- });
1383
- let l = Math.min(t, n, 40), u = t / 2, d = n / 2, f = r === "row" || r === "row-reverse";
1384
- if (f) {
1385
- let e = r === "row" ? 1 : -1, t = u - e * l / 2, n = u + e * l / 2;
1386
- this._debugGraphics.moveTo(t, d).lineTo(n, d).moveTo(n, d).lineTo(n - e * 6, d - 4).moveTo(n, d).lineTo(n - e * 6, d + 4).stroke({
1387
- width: 1,
1388
- color: j.direction,
1389
- alpha: .8,
1390
- pixelLine: !0
1391
- });
1392
- } else {
1393
- let e = r === "column" ? 1 : -1, t = d - e * l / 2, n = d + e * l / 2;
1394
- this._debugGraphics.moveTo(u, t).lineTo(u, n).moveTo(u, n).lineTo(u - 4, n - e * 6).moveTo(u, n).lineTo(u + 4, n - e * 6).stroke({
1395
- width: 1,
1396
- color: j.direction,
1397
- alpha: .8,
1398
- pixelLine: !0
1399
- });
1400
- }
1401
- if (i > 0) for (let e = 0; e < this.children.length - 1; e++) {
1402
- let r = this.children[e];
1403
- if (r === this._debugGraphics || r === this._debugLabel || !r.layout?.computedLayout) continue;
1404
- let a = r.layout.computedLayout;
1405
- if (f) {
1406
- let e = a.left + a.width;
1407
- this._debugGraphics.rect(e, 0, i, n).fill({
1408
- color: j.gap,
1409
- alpha: M.fill
1410
- });
1411
- } else {
1412
- let e = a.top + a.height;
1413
- this._debugGraphics.rect(0, e, t, i).fill({
1414
- color: j.gap,
1415
- alpha: M.fill
1416
- });
1417
- }
1418
- }
1419
- for (let e of this.children) {
1420
- if (e === this._debugGraphics || e === this._debugLabel || !e.layout?.computedLayout) continue;
1421
- let t = e.layout.computedLayout;
1422
- this._debugGraphics.rect(t.left, t.top, t.width, t.height).stroke({
1423
- width: 1,
1424
- color: j.innerBounds,
1425
- alpha: .4,
1426
- pixelLine: !0
1427
- });
1428
- }
1429
- this._debugLabel.position.set(2, 2);
1430
- }
1431
- destroy() {
1432
- this.config.debug && F(`FlexContainer:${this.uid}`), this._debugGraphics &&= (this._debugGraphics.destroy(), null), this._debugLabel &&= (this._debugLabel.destroy(), null), this.off("added", this.handleAdded), this.off("childAdded", this.handleChildAdded), this.off("childRemoved", this.handleChildRemoved), this.config.bindToAppSize && this.app.onResize.disconnect(this.handleResize), this.config.bindTo && "off" in this.config.bindTo && this.config.bindTo.off("layout", this.handleBindToResize), super.destroy();
1433
- }
1434
- }, Y = {
1435
- type: "info",
1436
- duration: 3e3,
1437
- width: 300,
1438
- height: 80,
1439
- backgroundColor: 0,
1440
- backgroundAlpha: .8,
1441
- cornerRadius: 0,
1442
- padding: 10,
1443
- autoClose: !0,
1444
- textAlign: "center",
1445
- verticalAlign: "middle",
1446
- colorBarWidth: 6,
1447
- shadow: {
1448
- color: 0,
1449
- alpha: .2,
1450
- offset: {
1451
- x: 1,
1452
- y: 3
1453
- }
1454
- },
1455
- closeButton: {
1456
- show: !1,
1457
- position: "top right",
1458
- size: 12,
1459
- offset: 4
1460
- },
1461
- style: {
1462
- fill: 16777215,
1463
- fontSize: 16,
1464
- wordWrap: !0
1465
- },
1466
- textColors: {
1467
- info: 3447003,
1468
- success: 3066993,
1469
- warning: 15844367,
1470
- error: 15158332
1471
- }
1472
- }, ar = class extends h(_) {
1473
- set toaster(e) {
1474
- this._toaster = e;
1475
- }
1476
- get toaster() {
1477
- return this._toaster;
1478
- }
1479
- set text(e) {
1480
- this.textDisplay.text = e, this.alignText();
1481
- }
1482
- constructor(e = {}) {
1483
- super(), this.onToastClosed = new p(), this.isHiding = !1, this.config = {
1484
- ...Y,
1485
- ...e
1486
- }, this.initialize();
1487
- }
1488
- initialize() {
1489
- if (this.view = this.add.container(), this.config.shadow && (this.shadow = this.view.add.graphics().roundRect(this.config.shadow.offset?.x ?? 4, this.config.shadow.offset?.y ?? 4, this.config.width, this.config.height, this.config.cornerRadius).fill({
1490
- color: this.config.shadow.color ?? 0,
1491
- alpha: this.config.shadow.alpha ?? .2
1492
- })), this.background = this.view.add.graphics().roundRect(0, 0, this.config.width, this.config.height, this.config.cornerRadius).fill({
1493
- color: this.config.backgroundColor,
1494
- alpha: this.config.backgroundAlpha
1495
- }), this.config.type) {
1496
- let e = new E().roundRect(0, 0, this.config.width, this.config.height, this.config.cornerRadius).fill({ color: 16777215 }), t = this.view.add.graphics().rect(0, 0, this.config.colorBarWidth, this.config.height).fill({ color: this.config.textColors[this.config.type] });
1497
- t.mask = e, this.view.addChild(e), this.view.addChild(t);
1498
- }
1499
- this.config.closeButton?.show && this.addCloseButton();
1500
- let e = this.config.type ? this.config.colorBarWidth + this.config.padding : this.config.padding, t = this.config.closeButton?.show && this.config.closeButton.position === "top right" ? this.config.closeButton.size + this.config.closeButton.offset * 2 : this.config.padding;
1501
- this.textDisplay = this.view.add.text({
1502
- text: this.config.message,
1503
- style: {
1504
- ...Y.style,
1505
- ...this.config.style,
1506
- wordWrapWidth: this.config.style?.wordWrapWidth ?? this.config.width - e - t
1507
- },
1508
- x: e,
1509
- y: this.config.padding
1510
- }), this.alignText(), this.view.pivot.set(this.config.width * .5, this.config.height * .5), this.view.position.set(this.config.width * .5, this.config.height * .5), this.alpha = 0, this.addChild(this.view);
1511
- }
1512
- addCloseButton() {
1513
- let e = this.config.closeButton?.class || er, t = this.config.closeButton?.size ?? 12, n = this.config.closeButton?.offset ?? 4, r = this.config.closeButton?.position ?? "top right";
1514
- this.closeButton = this.view.add.existing(new e({ cursor: "pointer" }));
1515
- let i = r === "top right" ? this.config.width - t * .5 - n : t * .5 + n, a = t * .5 + n;
1516
- this.closeButton.position.set(i, a), this.closeButton.onClick.connect(() => {
1517
- this.hide();
1518
- });
1519
- }
1520
- alignText() {
1521
- switch (this.config.textAlign) {
1522
- case "left":
1523
- this.textDisplay.anchor.set(0, .5);
1524
- break;
1525
- case "center":
1526
- this.textDisplay.anchor.set(.5, .5), this.textDisplay.x = this.config.width / 2;
1527
- break;
1528
- case "right":
1529
- this.textDisplay.anchor.set(1, .5);
1530
- break;
1531
- }
1532
- switch (this.config.verticalAlign) {
1533
- case "top":
1534
- this.textDisplay.y = this.config.padding;
1535
- break;
1536
- case "middle":
1537
- this.textDisplay.y = this.config.height * .5;
1538
- break;
1539
- case "bottom":
1540
- this.textDisplay.y = this.config.height - this.textDisplay.height - this.config.padding;
1541
- break;
1542
- }
1543
- }
1544
- getShowAnimation() {
1545
- let e = A.timeline({ paused: !0 });
1546
- return e.to(this, {
1547
- alpha: 1,
1548
- duration: .4,
1549
- ease: "power2.out"
1550
- }), e;
1551
- }
1552
- getHideAnimation() {
1553
- let e = A.timeline({ paused: !0 });
1554
- return e.to(this, {
1555
- alpha: 0,
1556
- duration: .25,
1557
- ease: "power2.in"
1558
- }), e;
1559
- }
1560
- async show() {
1561
- return this.timeline = this.getShowAnimation(), await this.timeline.play(), this.config.autoClose && (this.closeTimeout = setTimeout(() => {
1562
- this.hide();
1563
- }, this.config.duration)), this;
1564
- }
1565
- async hide() {
1566
- if (this.isHiding || this.destroyed) return this;
1567
- this.isHiding = !0, this.closeTimeout &&= (clearTimeout(this.closeTimeout), void 0);
1568
- try {
1569
- await this.getHideAnimation().play(), this.destroyed || this.onToastClosed.emit();
1570
- } catch (e) {
1571
- console.warn("Toast hide animation error:", e), this.destroyed || this.onToastClosed.emit();
1572
- }
1573
- return this;
1574
- }
1575
- destroy() {
1576
- this.isHiding = !0, this.closeTimeout &&= (clearTimeout(this.closeTimeout), void 0), A.killTweensOf(this), this.timeline &&= (this.timeline.kill(), void 0), !this.destroyed && !this.isHiding && this.onToastClosed.emit(), super.destroy({ children: !0 });
1577
- }
1578
- }, or = {
1579
- position: "bottom right",
1580
- maxToasts: 5,
1581
- spacing: 10,
1582
- offset: {
1583
- x: 20,
1584
- y: 20
1585
- },
1586
- stackDirection: "up",
1587
- animationSpeed: 1
1588
- }, sr = class extends h(_) {
1589
- get size() {
1590
- return this.toasts.length;
1591
- }
1592
- get toastPosition() {
1593
- return this.config.position ?? "top right";
1594
- }
1595
- get stackDirection() {
1596
- return this.config.stackDirection ?? "up";
1597
- }
1598
- get spacing() {
1599
- return this.config.spacing ?? 10;
1600
- }
1601
- get offset() {
1602
- return this.config.offset ?? {
1603
- x: 20,
1604
- y: 20
1605
- };
1606
- }
1607
- get maxToasts() {
1608
- return this.config.maxToasts ?? 5;
1609
- }
1610
- get toastConfig() {
1611
- return this.defaultToastConfig ?? {};
1612
- }
1613
- constructor(e = {}, t = {}) {
1614
- super({ autoResize: !0 }), this.onToastAdded = new p(), this.onToastRemoved = new p(), this.onAllToastsRemoved = new p(), this.toasts = [], this.config = {
1615
- ...or,
1616
- ...e
1617
- }, this.defaultToastConfig = { ...t }, this.initialize(), this.resize();
1618
- }
1619
- initialize() {
1620
- this.container = this.add.container();
1621
- }
1622
- async show(e = this.defaultToastConfig, t = !1) {
1623
- if (this.size >= this.config.maxToasts) {
1624
- let e = this.toasts[0];
1625
- await e.hide(), await this.removeToast(e);
1626
- }
1627
- !t && this.defaultToastConfig && (e = {
1628
- ...this.defaultToastConfig,
1629
- ...e,
1630
- style: this.defaultToastConfig.style || e.style ? {
1631
- ...this.defaultToastConfig.style ?? {},
1632
- ...e.style ?? {}
1633
- } : this.defaultToastConfig.style,
1634
- textColors: this.defaultToastConfig.textColors || e.textColors ? {
1635
- ...this.defaultToastConfig.textColors ?? {},
1636
- ...e.textColors ?? {}
1637
- } : Y.textColors,
1638
- shadow: this.defaultToastConfig.shadow || e.shadow ? {
1639
- ...this.defaultToastConfig.shadow ?? {},
1640
- ...e.shadow ?? {}
1641
- } : this.defaultToastConfig.shadow,
1642
- closeButton: this.defaultToastConfig.closeButton || e.closeButton ? {
1643
- ...this.defaultToastConfig.closeButton ?? {},
1644
- ...e.closeButton ?? {}
1645
- } : Y.closeButton
1646
- });
1647
- let n = new (e.class ?? ar)(e);
1648
- return n.toaster = this, this.container.addChild(n), this.toasts.push(n), this.positionToast(n, this.toasts.length - 1, !1), n.onToastClosed.connectOnce(() => this.removeToast(n)), this.positionToasts(), this.onToastAdded.emit(n), n.show();
1649
- }
1650
- async hideAll() {
1651
- let e = [...this.toasts];
1652
- await Promise.all(e.map((e) => e.hide())), this.onAllToastsRemoved.emit();
1653
- }
1654
- async removeAll() {
1655
- return this.hideAll();
1656
- }
1657
- async removeToast(e) {
1658
- let t = this.toasts.indexOf(e);
1659
- t === -1 || e.destroyed || (this.toasts.splice(t, 1), this.positionToasts(), e.destroyed || (this.container.removeChild(e), e.destroy()), this.onToastRemoved.emit(e));
1660
- }
1661
- positionToasts(e = !0, t = !1) {
1662
- this.toasts.filter((e, n) => e && !e.destroyed && (t ? n !== this.toasts.length - 1 : !0)).forEach((t, n) => {
1663
- this.positionToast(t, n, e);
1664
- });
1665
- }
1666
- positionToast(e, t, n = !0) {
1667
- if (!e?.parent || e.destroyed) return;
1668
- let { position: r, spacing: i, offset: a, stackDirection: o } = this.config, s = typeof a == "number" ? a : a.x, c = typeof a == "number" ? a : a.y, l = this.app.size.width * .5, u = this.app.size.height * .5;
1669
- switch (r) {
1670
- case "top right":
1671
- case "right top":
1672
- l += this.app.size.width * .5 - e.width - s, u -= this.app.size.height * .5 - c;
1673
- break;
1674
- case "top left":
1675
- case "left top":
1676
- l -= this.app.size.width * .5 - s, u -= this.app.size.height * .5 - c;
1677
- break;
1678
- case "bottom right":
1679
- case "right bottom":
1680
- l += this.app.size.width * .5 - e.width - s, u += this.app.size.height * .5 - e.height - c;
1681
- break;
1682
- case "bottom left":
1683
- case "left bottom":
1684
- l -= this.app.size.width * .5 - s, u += this.app.size.height * .5 - e.height - c;
1685
- break;
1686
- case "top":
1687
- case "top center":
1688
- l += -e.width * .5, u -= this.app.size.height * .5 - c;
1689
- break;
1690
- case "bottom":
1691
- case "bottom center":
1692
- l += -e.width * .5, u += this.app.size.height * .5 - e.height - c;
1693
- break;
1694
- }
1695
- o === "down" ? u += t * (e.height + i) : u -= t * (e.height + i);
1696
- try {
1697
- n ? A.to(e, {
1698
- x: l,
1699
- y: u,
1700
- duration: .3 / this.config.animationSpeed,
1701
- ease: "power2.out"
1702
- }) : e.position.set(l, u);
1703
- } catch (e) {
1704
- console.warn("Error positioning toast:", e);
1705
- }
1706
- }
1707
- resize() {
1708
- this.position.set(-this.app.size.width * .5, -this.app.size.height * .5), this.positionToasts(!1);
1709
- }
1710
- destroy() {
1711
- this.toasts.forEach((e) => {
1712
- A.killTweensOf(e);
1713
- }), this.hideAll(), this.toasts = [], super.destroy({ children: !0 });
1714
- }
1715
- }, cr = [
1716
- "debug",
1717
- "padding",
1718
- "size",
1719
- "useAppSize",
1720
- "useSafeArea",
1721
- "layout"
1722
- ], lr = {
1723
- top: 0,
1724
- right: 0,
1725
- bottom: 0,
1726
- left: 0
1727
- };
1728
- function ur(e, t) {
1729
- return {
1730
- top: e.top + t.top,
1731
- right: e.right + t.right,
1732
- bottom: e.bottom + t.bottom,
1733
- left: e.left + t.left
1734
- };
1735
- }
1736
- var dr = {
1737
- flexGrow: 0,
1738
- flexShrink: 0,
1739
- autoLayoutChildren: !0
1740
- }, fr = h(v()), pr = class e extends fr {
1741
- constructor(e) {
1742
- if (super(), this.settingsMap = /* @__PURE__ */ new Map(), this._childMap = /* @__PURE__ */ new Map(), this._debugGraphics = null, this._debugLabel = null, this._regionLabels = [], this._disableAddChildError = !1, this._bindings = [], this._canvasChildren = [], this.removeChildren = (e, t) => super.removeChildren(e, t), this.removeChildAt = (e) => super.removeChildAt(e), this.addChildAt = (e, t) => {
1743
- throw Error("UICanvas: Do not call addChildAt() directly. Use addElement(child, { align }) instead.\nExample: uiCanvas.addElement(myChild, { align: 'top right' })");
1744
- }, this.setChildIndex = (e, t) => {
1745
- throw Error("UICanvas: Do not call setChildIndex() directly. Use reorderElement(child, index), bringToFront(child), or sendToBack(child) instead.\nExample: uiCanvas.reorderElement(myChild, 0)");
1746
- }, this.getChildIndex = (e) => super.getChildIndex(e), this.getChildAt = (e) => super.getChildAt(e), !this.app.config.useLayout) throw Error("You must set useLayout to true in your app config to use UICanvas");
1747
- m(this), this._positionContainers = /* @__PURE__ */ new Map(), this.config = {
1748
- debug: e.debug === !0,
1749
- padding: I(e?.padding ?? 0),
1750
- size: e.size === void 0 ? {
1751
- width: 0,
1752
- height: 0
1753
- } : et(e.size),
1754
- useAppSize: e.useAppSize === !0,
1755
- useSafeArea: e.useSafeArea ?? !0,
1756
- autoLayoutChildren: e.autoLayoutChildren ?? !0
1757
- }, e.layout ? typeof e.layout == "boolean" ? this.config.layout = e.layout : this.config.layout = {
1758
- ...dr,
1759
- ...e.layout
1760
- } : this.config.layout = { ...dr }, this.config.useAppSize && (this.config.size = this.app.size), this.layout = {
1761
- width: this.config.size.width,
1762
- height: this.config.size.height,
1763
- flexDirection: "column",
1764
- justifyContent: "space-between",
1765
- ...typeof this.config.layout == "object" ? this.config.layout : {}
1766
- }, this.on("childRemoved", this._childRemoved), this.once("added", this._added), this.addSignalConnection(this.app.onResize.connect(this.resize)), this._initializeLayout(), this._updateLayout(), this.config.debug && P(`UICanvas:${this.uid}`, this.label || "UICanvas", j.outerBounds);
1767
- }
1768
- _updateLayout() {
1769
- this.app.ticker.addOnce(this.updateLayout);
1770
- }
1771
- _initializeLayout() {
1772
- this._disableAddChildError = !0, this.topRow = this.add.flexContainer({
1773
- label: "Top",
1774
- layout: {
1775
- width: "100%",
1776
- height: "auto",
1777
- flexDirection: "row",
1778
- justifyContent: "space-between",
1779
- alignItems: "flex-start"
1780
- }
1781
- }), this.middleRow = this.add.flexContainer({
1782
- label: "Middle",
1783
- layout: {
1784
- width: "100%",
1785
- flexDirection: "row",
1786
- justifyContent: "space-between",
1787
- alignItems: "center"
1788
- }
1789
- }), this.bottomRow = this.add.flexContainer({
1790
- label: "Bottom",
1791
- layout: {
1792
- width: "100%",
1793
- height: "auto",
1794
- flexDirection: "row",
1795
- justifyContent: "space-between",
1796
- alignItems: "flex-end"
1797
- }
1798
- }), this._disableAddChildError = !1;
1799
- let e = this._createPositionContainer(this.topRow, {
1800
- justifyContent: "flex-start",
1801
- alignItems: "flex-start",
1802
- flexGrow: 0,
1803
- flexShrink: 0
1804
- }, "Left"), t = this._createPositionContainer(this.topRow, {
1805
- justifyContent: "center",
1806
- alignItems: "flex-start",
1807
- flexGrow: 1,
1808
- flexShrink: 0
1809
- }, "Center"), n = this._createPositionContainer(this.topRow, {
1810
- justifyContent: "flex-end",
1811
- alignItems: "flex-start",
1812
- flexGrow: 0,
1813
- flexShrink: 0
1814
- }, "Right"), r = this._createPositionContainer(this.middleRow, {
1815
- justifyContent: "flex-start",
1816
- alignItems: "center",
1817
- flexDirection: "row",
1818
- flexGrow: 0,
1819
- flexShrink: 0
1820
- }, "Left"), i = this._createPositionContainer(this.middleRow, {
1821
- justifyContent: "center",
1822
- alignItems: "center",
1823
- flexDirection: "row",
1824
- flexGrow: 1,
1825
- flexShrink: 0
1826
- }, "Center"), a = this._createPositionContainer(this.middleRow, {
1827
- justifyContent: "flex-end",
1828
- alignItems: "center",
1829
- flexDirection: "row",
1830
- flexGrow: 0,
1831
- flexShrink: 0
1832
- }, "Right"), o = this._createPositionContainer(this.bottomRow, {
1833
- justifyContent: "flex-start",
1834
- alignItems: "flex-end",
1835
- flexDirection: "row",
1836
- flexGrow: 0,
1837
- flexShrink: 0
1838
- }, "Left"), s = this._createPositionContainer(this.bottomRow, {
1839
- justifyContent: "center",
1840
- alignItems: "flex-end",
1841
- flexGrow: 1,
1842
- flexShrink: 0,
1843
- flexDirection: "row"
1844
- }, "Center"), c = this._createPositionContainer(this.bottomRow, {
1845
- justifyContent: "flex-end",
1846
- alignItems: "flex-end",
1847
- flexDirection: "row",
1848
- flexGrow: 0,
1849
- flexShrink: 0
1850
- }, "Right");
1851
- this._positionContainers.set("top left", e), this._positionContainers.set("left top", e), this._positionContainers.set("top center", t), this._positionContainers.set("top", t), this._positionContainers.set("top right", n), this._positionContainers.set("right top", n), this._positionContainers.set("left center", r), this._positionContainers.set("left", r), this._positionContainers.set("left bottom", o), this._positionContainers.set("center", i), this._positionContainers.set("right center", a), this._positionContainers.set("right", a), this._positionContainers.set("right bottom", c), this._positionContainers.set("bottom left", o), this._positionContainers.set("bottom center", s), this._positionContainers.set("bottom", s), this._positionContainers.set("bottom right", c);
1852
- }
1853
- _createPositionContainer(e, t, n) {
1854
- let r = e.add.container({ layout: {
1855
- width: "auto",
1856
- height: "auto",
1857
- ...t
1858
- } });
1859
- return r.label = n, r.on("childAdded", this._updateLayout), r.on("childRemoved", this._updateLayout), r.on("layout", this._updateLayout), r;
1860
- }
1861
- get canvasChildren() {
1862
- return this._canvasChildren;
1863
- }
1864
- get app() {
1865
- return S.getInstance();
1866
- }
1867
- destroy() {
1868
- this._disableAddChildError = !0, this.config.debug && F(`UICanvas:${this.uid}`), this._debugGraphics &&= (this._debugGraphics.destroy(), null), this._debugLabel &&= (this._debugLabel.destroy(), null);
1869
- for (let e of this._regionLabels) e.destroy();
1870
- this._regionLabels = [], this.canvasChildren?.forEach((e) => {
1871
- e.off("layout", this._updateLayout);
1872
- }), this.children.forEach((e) => {
1873
- e.off("layout", this._updateLayout);
1874
- }), this.off("childAdded", this._updateLayout), this.off("childRemoved", this._updateLayout), this._positionContainers.forEach((e) => {
1875
- e.off("childAdded", this._updateLayout), e.off("childRemoved", this._updateLayout);
1876
- }), this._bindings = [], super.destroy();
1877
- }
1878
- set size(e) {
1879
- this.config.size = e === void 0 ? {
1880
- width: 0,
1881
- height: 0
1882
- } : et(e), this.layout = {
1883
- width: this.config.size.width,
1884
- height: this.config.size.height
1885
- }, this.updateLayout();
1886
- }
1887
- set padding(e) {
1888
- this.config.padding = I(e), this._applyPadding(), this._updateLayout();
1889
- }
1890
- _applyPadding() {
1891
- let e = ur(this.config.padding, this.config.useSafeArea ? this.app.safeArea : lr);
1892
- this.layout = {
1893
- paddingLeft: e.left,
1894
- paddingTop: e.top,
1895
- paddingRight: e.right,
1896
- paddingBottom: e.bottom
1897
- };
1898
- }
1899
- static isFlexContainer(e) {
1900
- return e instanceof ir;
1901
- }
1902
- addChild(...e) {
1903
- if (this._disableAddChildError) return super.addChild(...e);
1904
- throw Error("UICanvas: Do not call addChild() directly. Use addElement(child, { align }) instead.\nExample: uiCanvas.addElement(myChild, { align: 'top right' })");
1905
- }
1906
- removeChild(...e) {
1907
- if (this._disableAddChildError) return super.removeChild(...e);
1908
- throw Error("UICanvas: Do not call removeChild() directly. Use removeElement(child) instead.");
1909
- }
1910
- resize() {
1911
- this._applyPadding(), this.config.useAppSize ? (this.size = {
1912
- width: this.app.size.width,
1913
- height: this.app.size.height
1914
- }, this.position.set(-this.app.size.width * .5, -this.app.size.height * .5)) : this._updateLayout();
1915
- }
1916
- updateLayout() {
1917
- this.destroyed || !this.layout || !this.app?.renderer.layout || (this.app.renderer.layout.update(this), this._positionContainers.forEach((e) => {
1918
- this.app.renderer.layout.update(e);
1919
- }), this.config.useAppSize && this.position.set(-this.config.size.width * .5, -this.config.size.height * .5), this._updateBindings(), this.config.debug && this.app.ticker.addOnce(this.drawDebug));
1920
- }
1921
- bindElement(e, t, n) {
1922
- e.parent !== this && (this._disableAddChildError = !0, super.addChild(e), this._disableAddChildError = !1), e.layout = !1, this._bindings = this._bindings.filter((t) => t.child !== e), this._bindings.push({
1923
- child: e,
1924
- anchor: t,
1925
- place: n
1926
- }), this._updateLayout();
1927
- }
1928
- unbindElement(e) {
1929
- let t = this._bindings.some((t) => t.child === e);
1930
- this._bindings = this._bindings.filter((t) => t.child !== e), t && e.parent === this && (this._disableAddChildError = !0, super.removeChild(e), this._disableAddChildError = !1);
1931
- }
1932
- _updateBindings() {
1933
- for (let { child: e, anchor: t, place: n } of this._bindings) {
1934
- let r = this._anchorRect(t);
1935
- r && n(r, e);
1936
- }
1937
- }
1938
- _anchorRect(e) {
1939
- let t = e.layout?.computedLayout;
1940
- if (!t) return null;
1941
- let n = 0, r = 0;
1942
- for (let t = e; t && t !== this; t = t.parent) {
1943
- let e = t.layout?.computedLayout;
1944
- e && (n += e.left, r += e.top);
1945
- }
1946
- return {
1947
- left: n,
1948
- top: r,
1949
- width: t.width,
1950
- height: t.height
1951
- };
1952
- }
1953
- addElement(t, n) {
1954
- let r = n?.align ?? "top left", i = this._positionContainers.get(r);
1955
- return i ? (e.isFlexContainer(t) && this.addSignalConnection(t.onLayoutComplete.connect(this._updateLayout)), this.settingsMap.set(t, {
1956
- align: r,
1957
- padding: n?.padding ? I(n.padding) : {
1958
- top: 0,
1959
- left: 0,
1960
- bottom: 0,
1961
- right: 0
1962
- }
1963
- }), this._childMap.set(t, i), this._canvasChildren = Array.from(this._childMap.keys()), i.add.existing(t), this._childAdded(t), t) : (c.error(`UICanvas:: Invalid position "${r}" for element`), t);
1964
- }
1965
- removeElement(e) {
1966
- let t = this._childMap.get(e);
1967
- if (!t) throw Error(`UICanvas: Cannot remove element — it was not added via addElement().\nChild label: "${e.label ?? "(unlabeled)"}"`);
1968
- return t.removeChild(e), e.off("layout", this._updateLayout), this.settingsMap.delete(e), this._childMap.delete(e), this._canvasChildren = Array.from(this._childMap.keys()), this._updateLayout(), e;
1969
- }
1970
- reorderElement(e, t) {
1971
- let n = this._childMap.get(e);
1972
- if (!n) throw Error(`UICanvas: Cannot reorder element — it was not added via addElement().\nChild label: "${e.label ?? "(unlabeled)"}"`);
1973
- return n.setChildIndex(e, t), this._updateLayout(), e;
1974
- }
1975
- bringToFront(e) {
1976
- let t = this._childMap.get(e);
1977
- if (!t) throw Error(`UICanvas: Cannot reorder element — it was not added via addElement().\nChild label: "${e.label ?? "(unlabeled)"}"`);
1978
- return this.reorderElement(e, t.children.length - 1);
1979
- }
1980
- sendToBack(e) {
1981
- return this.reorderElement(e, 0);
1982
- }
1983
- _childAdded(e) {
1984
- this.config.autoLayoutChildren && (e.layout ||= !0, e.layout?.style?.width || (e.layout = { width: "auto" }), e.layout?.style?.height || (e.layout = { height: "auto" })), e.on("layout", this._updateLayout), _.childAdded(e), this._updateLayout();
1985
- }
1986
- _childRemoved(e) {
1987
- this.settingsMap.delete(e), this._childMap.delete(e), this._canvasChildren = Array.from(this._childMap.keys()), _.childRemoved(e);
1988
- }
1989
- _added() {
1990
- this._updateLayout();
1991
- }
1992
- get debug() {
1993
- return this.config.debug;
1994
- }
1995
- set debug(e) {
1996
- if (this.config.debug = e, e) P(`UICanvas:${this.uid}`, this.label || "UICanvas", j.outerBounds), this.drawDebug();
1997
- else {
1998
- F(`UICanvas:${this.uid}`), this._debugGraphics && this._debugGraphics.clear(), this._debugLabel && (this._debugLabel.visible = !1);
1999
- for (let e of this._regionLabels) e.visible = !1;
2000
- }
2001
- }
2002
- drawDebug() {
2003
- this._debugGraphics || (this._disableAddChildError = !0, this._debugGraphics = Ft(`${this.label ?? "UICanvas"}:debug`), super.addChild(this._debugGraphics), this._debugGraphics.layout = !1, this._disableAddChildError = !1), this._debugLabel || (this._disableAddChildError = !0, this._debugLabel = N(this.label || "UICanvas", j.outerBounds), super.addChild(this._debugLabel), this._debugLabel.layout = !1, this._disableAddChildError = !1), this._debugLabel.text = this.label || "UICanvas", this._debugLabel.visible = !0, this._debugLabel.position.set(2, 2), this._debugGraphics.clear();
2004
- let e = this.config.size.width, t = this.config.size.height, n = this.config.padding;
2005
- this._debugGraphics.rect(0, 0, e, t).stroke({
2006
- width: 1,
2007
- color: j.outerBounds,
2008
- alpha: M.stroke,
2009
- pixelLine: !0
2010
- }), n.top > 0 && this._debugGraphics.rect(0, 0, e, n.top).fill({
2011
- color: j.outerBounds,
2012
- alpha: M.fill
2013
- }), n.bottom > 0 && this._debugGraphics.rect(0, t - n.bottom, e, n.bottom).fill({
2014
- color: j.outerBounds,
2015
- alpha: M.fill
2016
- }), n.left > 0 && this._debugGraphics.rect(0, n.top, n.left, t - n.top - n.bottom).fill({
2017
- color: j.outerBounds,
2018
- alpha: M.fill
2019
- }), n.right > 0 && this._debugGraphics.rect(e - n.right, n.top, n.right, t - n.top - n.bottom).fill({
2020
- color: j.outerBounds,
2021
- alpha: M.fill
2022
- });
2023
- let r = n.left, i = n.top, a = e - n.left - n.right, o = t - n.top - n.bottom;
2024
- this._debugGraphics.rect(r, i, a, o).stroke({
2025
- width: 1,
2026
- color: j.innerBounds,
2027
- alpha: M.stroke,
2028
- pixelLine: !0
2029
- });
2030
- let s = /* @__PURE__ */ new Map();
2031
- this._positionContainers.forEach((e, t) => {
2032
- (!s.has(e) || t.length < s.get(e).length) && s.set(e, t);
2033
- });
2034
- let c = [...new Set(this._positionContainers.values())];
2035
- for (; this._regionLabels.length < c.length;) {
2036
- this._disableAddChildError = !0;
2037
- let e = N("", j.region);
2038
- super.addChild(e), e.layout = !1, this._regionLabels.push(e), this._disableAddChildError = !1;
2039
- }
2040
- c.forEach((e, t) => {
2041
- if (!e.layout?.computedLayout) return;
2042
- let n = e.layout.computedLayout, r = e.parent;
2043
- if (!r?.layout?.computedLayout) return;
2044
- let i = r.layout.computedLayout, a = i.left + n.left, o = i.top + n.top, c = n.width, l = n.height, u = e.children.length > 0;
2045
- this._debugGraphics.rect(a, o, c, l).fill({
2046
- color: j.region,
2047
- alpha: u ? M.fillActive : M.fill
2048
- }).stroke({
2049
- width: 1,
2050
- color: j.region,
2051
- alpha: .3,
2052
- pixelLine: !0
2053
- });
2054
- let d = this._regionLabels[t];
2055
- d.text = s.get(e) ?? "", d.visible = !0, d.position.set(a + 2, o + 2);
2056
- });
2057
- for (let e = c.length; e < this._regionLabels.length; e++) this._regionLabels[e].visible = !1;
2058
- let l = e / 2, u = t / 2;
2059
- this._debugGraphics.moveTo(l, u - 10).lineTo(l, u + 10).stroke({
2060
- width: 1,
2061
- color: j.outerBounds,
2062
- alpha: M.crosshair,
2063
- pixelLine: !0
2064
- }).moveTo(l - 10, u).lineTo(l + 10, u).stroke({
2065
- width: 1,
2066
- color: j.outerBounds,
2067
- alpha: M.crosshair,
2068
- pixelLine: !0
2069
- });
2070
- }
2071
- }, X = null;
2072
- function mr() {
2073
- if (X) return X;
2074
- X = /* @__PURE__ */ new Map();
2075
- let e = globalThis.Caper?.get?.("entityList") ?? [];
2076
- for (let t of e) t.active !== !1 && typeof t.module == "function" && t.module.prototype && X.set(t.id, t.module);
2077
- return X;
2078
- }
2079
- function hr(e) {
2080
- return mr().get(e);
2081
- }
2082
- function gr() {
2083
- return [...mr().keys()];
2084
- }
2085
- //#endregion
2086
- //#region src/mixins/factory/ui-registry.ts
2087
- var Z = null;
2088
- function _r() {
2089
- if (Z) return Z;
2090
- Z = /* @__PURE__ */ new Map();
2091
- let e = globalThis.Caper?.get?.("uiList") ?? [];
2092
- for (let t of e) t.active !== !1 && typeof t.module == "function" && t.module.prototype && Z.set(t.id, t.module);
2093
- return Z;
2094
- }
2095
- function vr(e) {
2096
- return _r().get(e);
2097
- }
2098
- function yr() {
2099
- return [..._r().keys()];
2100
- }
2101
- //#endregion
2102
- //#region src/mixins/factory/schema.ts
2103
- var br = [
2104
- "position",
2105
- "scale",
2106
- "pivot"
2107
- ], xr = [
2108
- "position",
2109
- "x",
2110
- "y",
2111
- "scale",
2112
- "scaleX",
2113
- "scaleY",
2114
- "pivot",
2115
- "anchor"
2116
- ];
2117
- function Q(e) {
2118
- let t = e.applies ?? br, n = t.includes("position"), r = t.includes("scale"), i = t.includes("pivot"), a = t.includes("anchor"), o = [...xr, ...e.exclude ?? []];
2119
- return (t) => {
2120
- let s = e.build(t);
2121
- if (t == null) return s;
2122
- let c = t;
2123
- return n && G({
2124
- position: c.position,
2125
- x: c.x,
2126
- y: c.y
2127
- }, s), r && K({
2128
- scale: c.scale,
2129
- scaleX: c.scaleX,
2130
- scaleY: c.scaleY
2131
- }, s), i && q(c.pivot, s), a && Gn(c.anchor, s), H(st(o, c), s), s;
2132
- };
2133
- }
2134
- //#endregion
2135
- //#region src/mixins/factory/const.ts
2136
- var Sr = [
2137
- "text",
2138
- "roundPixels",
2139
- "resolution",
2140
- "style",
2141
- "anchor",
2142
- "pivot"
2143
- ], Cr = {
2144
- existing: (e, t) => {
2145
- if (!t) return e;
2146
- let { position: n, x: r, y: i, pivot: a, scale: o, scaleX: s, scaleY: c, ...l } = t;
2147
- return G({
2148
- position: n,
2149
- x: r,
2150
- y: i
2151
- }, e), K({
2152
- scale: o,
2153
- scaleX: s,
2154
- scaleY: c
2155
- }, e), q(a, e), H(l, e), e;
2156
- },
2157
- container: Q({
2158
- build: (e) => new _(e ? g(e, b) : void 0),
2159
- applies: [
2160
- "position",
2161
- "scale",
2162
- "pivot"
2163
- ],
2164
- exclude: b
2165
- }),
2166
- particleContainer: Q({
2167
- build: (e) => new Bn(e ? g(e, Rn) : void 0),
2168
- applies: [
2169
- "position",
2170
- "scale",
2171
- "pivot"
2172
- ],
2173
- exclude: Rn
2174
- }),
2175
- texture: W,
2176
- sprite: Q({
2177
- build: (e) => new Et(e ? W(e) : void 0),
2178
- applies: [
2179
- "position",
2180
- "scale",
2181
- "pivot",
2182
- "anchor"
2183
- ],
2184
- exclude: ["asset", "sheet"]
2185
- }),
2186
- tilingSprite: Q({
2187
- build: (e) => new Dt(e ? W(e) : void 0),
2188
- applies: [
2189
- "position",
2190
- "scale",
2191
- "pivot",
2192
- "anchor"
2193
- ],
2194
- exclude: ["asset", "sheet"]
2195
- }),
2196
- animatedSprite: Q({
2197
- build: (e) => new Kn(e),
2198
- applies: [
2199
- "position",
2200
- "scale",
2201
- "pivot"
2202
- ],
2203
- exclude: [
2204
- "sheet",
2205
- "texturePrefix",
2206
- "zeroPad",
2207
- "animations",
2208
- "autoPlay",
2209
- "autoUpdate",
2210
- "defaultAnimation",
2211
- "reversible",
2212
- "animationSpeed",
2213
- "startIndex",
2214
- "animation"
2215
- ]
2216
- }),
2217
- graphics: Q({
2218
- build: (e) => new E(),
2219
- applies: [
2220
- "position",
2221
- "scale",
2222
- "pivot"
2223
- ]
2224
- }),
2225
- svg(e) {
2226
- let t = new Un(e.ctx), { position: n, x: r, y: i, pivot: a, scale: o, scaleX: s, scaleY: c, ctx: l, ...u } = e;
2227
- return G({
2228
- position: n,
2229
- x: r,
2230
- y: i
2231
- }, t), K({
2232
- scale: o,
2233
- scaleX: s,
2234
- scaleY: c
2235
- }, t), q(a, t), H(u, t), t;
2236
- },
2237
- text: Q({
2238
- build: (e) => new O(e ? {
2239
- text: e.text,
2240
- roundPixels: e.roundPixels,
2241
- resolution: e.resolution,
2242
- style: e.style,
2243
- anchor: e.anchor ? y(e.anchor, !0) : void 0,
2244
- pivot: e.pivot ? y(e.pivot, !0) : void 0
2245
- } : {}),
2246
- applies: [
2247
- "position",
2248
- "scale",
2249
- "pivot"
2250
- ],
2251
- exclude: [...Sr]
2252
- }),
2253
- htmlText: Q({
2254
- build: (e) => new St(e ? {
2255
- text: e.text,
2256
- roundPixels: e.roundPixels,
2257
- resolution: e.resolution,
2258
- style: e.style,
2259
- anchor: e.anchor ? y(e.anchor, !0) : void 0,
2260
- pivot: e.pivot ? y(e.pivot, !0) : void 0
2261
- } : {}),
2262
- applies: [
2263
- "position",
2264
- "scale",
2265
- "pivot"
2266
- ],
2267
- exclude: [...Sr]
2268
- }),
2269
- bitmapText: Q({
2270
- build: (e) => new w(e ? {
2271
- text: e.text,
2272
- roundPixels: e.roundPixels,
2273
- style: e.style,
2274
- anchor: e.anchor ? y(e.anchor, !0) : void 0,
2275
- pivot: e.pivot ? y(e.pivot, !0) : void 0
2276
- } : {}),
2277
- applies: [
2278
- "position",
2279
- "scale",
2280
- "pivot"
2281
- ],
2282
- exclude: [...Sr]
2283
- }),
2284
- button: Q({
2285
- build: (e) => new er(e ? g(e, Qn) : void 0),
2286
- applies: [
2287
- "position",
2288
- "scale",
2289
- "pivot"
2290
- ],
2291
- exclude: Qn
2292
- }),
2293
- flexContainer: Q({
2294
- build: (e) => new ir(e),
2295
- applies: [
2296
- "position",
2297
- "scale",
2298
- "pivot"
2299
- ],
2300
- exclude: rr
2301
- }),
2302
- uiCanvas: Q({
2303
- build: (e) => new pr(e ? g(e, cr) : {}),
2304
- applies: [
2305
- "position",
2306
- "scale",
2307
- "pivot"
2308
- ],
2309
- exclude: cr
2310
- }),
2311
- spine: Q({
2312
- build: (e) => {
2313
- let t = "", n = e?.data;
2314
- if (typeof n == "string") {
2315
- let e = n.slice(-5);
2316
- e !== ".json" && e !== ".skel" ? e = ".json" : t = n.substring(0, n.length - 5), t = {
2317
- skeleton: n + e,
2318
- atlas: n + ".atlas"
2319
- };
2320
- }
2321
- let r = window.Spine.from(t);
2322
- return e?.autoUpdate !== void 0 && (r.autoUpdate = e.autoUpdate), e?.animationName && r.state.setAnimation(e.trackIndex ?? 0, e.animationName, e.loop), r;
2323
- },
2324
- applies: [
2325
- "position",
2326
- "scale",
2327
- "pivot",
2328
- "anchor"
2329
- ],
2330
- exclude: [
2331
- "data",
2332
- "autoUpdate",
2333
- "animationName",
2334
- "trackIndex",
2335
- "loop"
2336
- ]
2337
- }),
2338
- spineAnimation: (e) => {
2339
- let t = new Xn(e);
2340
- if (!e) return t;
2341
- let { position: n, x: r, y: i, anchor: a, pivot: o, scale: s, scaleX: c, scaleY: l, ...u } = e;
2342
- return G({
2343
- position: n,
2344
- x: r,
2345
- y: i
2346
- }, t), K({
2347
- scale: s,
2348
- scaleX: c,
2349
- scaleY: l
2350
- }, t), Gn(a, t), q(o, t), H(u, t), t;
2351
- },
2352
- toaster: (e, t = {}) => new sr(e, t),
2353
- entity: (e, t) => {
2354
- let n = hr(e);
2355
- if (!n) {
2356
- let t = gr();
2357
- throw Error(`[caper] Unknown entity id '${String(e)}'. Known: ${t.length > 0 ? t.map((e) => `'${e}'`).join(", ") : "(none — discovery may have failed)"}`);
2358
- }
2359
- let r = new n(t);
2360
- if (t) {
2361
- let { position: e, x: n, y: i, pivot: a, scale: o, scaleX: s, scaleY: c, alpha: l, visible: u } = t;
2362
- G({
2363
- position: e,
2364
- x: n,
2365
- y: i
2366
- }, r), K({
2367
- scale: o,
2368
- scaleX: s,
2369
- scaleY: c
2370
- }, r), q(a, r), l !== void 0 && (r.alpha = l), u !== void 0 && (r.visible = u);
2371
- }
2372
- return r;
2373
- },
2374
- ui: (e, t) => {
2375
- let n = vr(e);
2376
- if (!n) {
2377
- let t = yr();
2378
- throw Error(`[caper] Unknown ui id '${String(e)}'. Known: ${t.length > 0 ? t.map((e) => `'${e}'`).join(", ") : "(none — discovery may have failed)"}`);
2379
- }
2380
- let r = new n(t);
2381
- if (t) {
2382
- let { position: e, x: n, y: i, pivot: a, scale: o, scaleX: s, scaleY: c, alpha: l, visible: u } = t;
2383
- G({
2384
- position: e,
2385
- x: n,
2386
- y: i
2387
- }, r), K({
2388
- scale: o,
2389
- scaleX: s,
2390
- scaleY: c
2391
- }, r), q(a, r), l !== void 0 && (r.alpha = l), u !== void 0 && (r.visible = u);
2392
- }
2393
- return r;
2394
- }
2395
- };
2396
- we(Cr);
2397
- //#endregion
2398
- //#region src/mixins/factory/props.ts
2399
- var wr = [
628
+ }, Qn = [
2400
629
  "text",
2401
630
  "anchor",
2402
631
  "roundPixels",
2403
632
  "style",
2404
633
  "pivot"
2405
- ], $ = {
634
+ ], Q = {
2406
635
  value: "",
2407
636
  type: "text",
2408
637
  fixed: !0,
@@ -2441,32 +670,32 @@ var wr = [
2441
670
  scale: 1,
2442
671
  marginTop: 60
2443
672
  }
2444
- }, Tr = [
673
+ }, $n = [
2445
674
  "text",
2446
675
  "password",
2447
676
  "number",
2448
677
  "email",
2449
678
  "tel",
2450
679
  "url"
2451
- ], Er = class e extends J(Zn(h(_))) {
680
+ ], er = class e extends T(E(y(b))) {
2452
681
  constructor(e, t = !1, n = null) {
2453
682
  if (super({
2454
683
  autoUpdate: !0,
2455
684
  autoResize: !t
2456
685
  }), this.isClone = t, this.clone = n, this.onEnter = new p(), this.onChange = new p(), this.onError = new p(), this._lastWidth = 0, this._lastHeight = 0, this._placeholderPositioned = !1, this._placeholderAnimating = !1, this._caretPosition = -1, this._value = "", this.options = {
2457
- ...$,
686
+ ...Q,
2458
687
  ...e,
2459
688
  style: {
2460
- ...$.style,
689
+ ...Q.style,
2461
690
  ...e?.style ?? {}
2462
691
  },
2463
- padding: I(e.padding ?? $.padding),
692
+ padding: D(e.padding ?? Q.padding),
2464
693
  bg: {
2465
- ...$.bg,
694
+ ...Q.bg,
2466
695
  ...e.bg ?? {}
2467
696
  },
2468
697
  focusOverlay: {
2469
- ...$.focusOverlay,
698
+ ...Q.focusOverlay,
2470
699
  ...e.focusOverlay ?? {}
2471
700
  }
2472
701
  }, this.options.layout && typeof this.options.layout == "object" ? this.layout = { ...this.options.layout } : this.layout = { transformOrigin: "top left" }, this.options.placeholder || (this.options.placeholder = { color: Number(this.options.style?.fill) ?? 6710886 }), this._inner = this.add.container({ layout: {
@@ -2493,7 +722,7 @@ var wr = [
2493
722
  width: "100%",
2494
723
  height: "100%"
2495
724
  }
2496
- }), this._placeholderContainer.eventMode = "none", this.addSelection(), this.addCaret(), this.addInput(), this.addPlaceholder(), this.placeholder.text = this.options.placeholder.text || `Enter ${this.options.type}`, this.input.eventMode = this.placeholder.eventMode = "none", B && this.addSignalConnection(this.onInteraction("pointertap").connect(this.handleClick, -1)), this.addSignalConnection(this.onInteraction("click").connect(this.handleClick, -1)), this.options.fixed) {
725
+ }), this._placeholderContainer.eventMode = "none", this.addSelection(), this.addCaret(), this.addInput(), this.addPlaceholder(), this.placeholder.text = this.options.placeholder.text || `Enter ${this.options.type}`, this.input.eventMode = this.placeholder.eventMode = "none", L && this.addSignalConnection(this.onInteraction("pointertap").connect(this.handleClick, -1)), this.addSignalConnection(this.onInteraction("click").connect(this.handleClick, -1)), this.options.fixed) {
2497
726
  let e = this.isClone ? this.clone?.options?.focusOverlay?.scale ?? 1 : 1;
2498
727
  this._mask = this._inner.add.graphics().rect(0, 0, this.bg.width * e - this.options.padding.left - this.options.padding.right, this.bg.height * e - this.options.padding.top - this.options.padding.bottom).fill({ color: 0 }), this._inputContainer.mask = this._mask;
2499
728
  }
@@ -2541,7 +770,7 @@ var wr = [
2541
770
  handleClick(e) {
2542
771
  if (e?.originalEvent?.key) return;
2543
772
  clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer);
2544
- let t = e ? un(this.input, e) : this.input.text?.length ?? 0;
773
+ let t = e ? B(this.input, e) : this.input.text?.length ?? 0;
2545
774
  this.createDomElement(t);
2546
775
  }
2547
776
  focusIn() {
@@ -2595,7 +824,7 @@ var wr = [
2595
824
  if (this.placeholder.visible = !0, !this.isClone && this._placeholderPositioned && !this._placeholderAnimating) {
2596
825
  this._placeholderAnimating = !0;
2597
826
  let e = this.input.x, t = this.input.y;
2598
- this.options.placeholder.animationOnType ? this.addAnimation([A.to(this.placeholder, {
827
+ this.options.placeholder.animationOnType ? this.addAnimation([N.to(this.placeholder, {
2599
828
  x: e,
2600
829
  y: t,
2601
830
  tint: 16777215,
@@ -2606,7 +835,7 @@ var wr = [
2606
835
  onComplete: () => {
2607
836
  this._placeholderPositioned = !1, this._placeholderAnimating = !1;
2608
837
  }
2609
- }), A.to(this.placeholder.scale, {
838
+ }), N.to(this.placeholder.scale, {
2610
839
  x: 1,
2611
840
  y: 1,
2612
841
  duration: this.options.placeholder.animationOnType.duration || .4,
@@ -2627,11 +856,11 @@ var wr = [
2627
856
  break;
2628
857
  }
2629
858
  if (this.options.placeholder.offsetOnType) {
2630
- let n = y(this.options.placeholder.offsetOnType);
859
+ let n = x(this.options.placeholder.offsetOnType);
2631
860
  e += n.x, t += n.y;
2632
861
  }
2633
862
  if (this.options.placeholder.animationOnType) {
2634
- if (this.addAnimation(A.to(this.placeholder, {
863
+ if (this.addAnimation(N.to(this.placeholder, {
2635
864
  x: e,
2636
865
  y: t,
2637
866
  duration: this.options.placeholder.animationOnType.duration || .4,
@@ -2640,8 +869,8 @@ var wr = [
2640
869
  alpha: this.options.placeholder.animationOnType.alpha ?? this.options.placeholder.alpha ?? 1,
2641
870
  overwrite: !0
2642
871
  })), this.options.placeholder.scaleOnType) {
2643
- let e = y(this.options.placeholder.scaleOnType);
2644
- this.addAnimation(A.to(this.placeholder.scale, {
872
+ let e = x(this.options.placeholder.scaleOnType);
873
+ this.addAnimation(N.to(this.placeholder.scale, {
2645
874
  x: e.x,
2646
875
  y: e.y,
2647
876
  duration: this.options.placeholder.animationOnType.duration || .4,
@@ -2687,7 +916,7 @@ var wr = [
2687
916
  }
2688
917
  addCaret() {
2689
918
  this.caret = this._inputContainer.add.sprite({
2690
- asset: k.WHITE,
919
+ asset: j.WHITE,
2691
920
  width: 3,
2692
921
  height: 10,
2693
922
  tint: this.options.caret.color ?? 0,
@@ -2728,9 +957,9 @@ var wr = [
2728
957
  this.domElement = this.clone.domElement, this._addDomElementListeners();
2729
958
  return;
2730
959
  }
2731
- clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer), this.domElement = document.createElement("input"), this.domElement.type = "text", this.options.type && Tr.includes(this.options.type) && (this.domElement.type = this.options.type), this.options.pattern && (this.domElement.pattern = this.options.pattern), this.options.regex && (this._regex = this.options.regex);
960
+ clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer), this.domElement = document.createElement("input"), this.domElement.type = "text", this.options.type && $n.includes(this.options.type) && (this.domElement.type = this.options.type), this.options.pattern && (this.domElement.pattern = this.options.pattern), this.options.regex && (this._regex = this.options.regex);
2732
961
  let t = this.getGlobalPosition(), n = this.getBounds();
2733
- n.x = t.x, n.y = t.y, n.width = this.width - this.options.padding.left, this.domElement.style.position = "fixed", this.domElement.style.border = "none", this.domElement.style.outline = "none", this.domElement.style.left = en ? "0" : `${n.left}px`, this.domElement.style.top = en ? "0" : `${n.top}px`, this.domElement.style.width = `${n.width}px`, this.domElement.style.height = `${n.height}px`, this.domElement.style.padding = "0", this.options.debug ? this.domElement.style.opacity = "0.8" : this.domElement.style.opacity = "0.0000001", this.app.canvas.parentElement?.appendChild(this.domElement), this.domElement.value = this.value, this.domElement.setAttribute("placeholder", this.options?.placeholder?.text ?? ""), this.options?.maxLength && this.domElement.setAttribute("maxLength", this.options.maxLength.toString()), this._addDomElementListeners(), this._focusDomElement(e);
962
+ n.x = t.x, n.y = t.y, n.width = this.width - this.options.padding.left, this.domElement.style.position = "fixed", this.domElement.style.border = "none", this.domElement.style.outline = "none", this.domElement.style.left = z ? "0" : `${n.left}px`, this.domElement.style.top = z ? "0" : `${n.top}px`, this.domElement.style.width = `${n.width}px`, this.domElement.style.height = `${n.height}px`, this.domElement.style.padding = "0", this.options.debug ? this.domElement.style.opacity = "0.8" : this.domElement.style.opacity = "0.0000001", this.app.canvas.parentElement?.appendChild(this.domElement), this.domElement.value = this.value, this.domElement.setAttribute("placeholder", this.options?.placeholder?.text ?? ""), this.options?.maxLength && this.domElement.setAttribute("maxLength", this.options.maxLength.toString()), this._addDomElementListeners(), this._focusDomElement(e);
2734
963
  }
2735
964
  destroyDomElement() {
2736
965
  this.isClone || (this.domElement &&= (this._removeDomElementListeners(), this.domElement.remove(), this.domElement.parentNode && this.domElement.parentNode.removeChild(this.domElement), null));
@@ -2742,7 +971,7 @@ var wr = [
2742
971
  this.cursorAnimation?.kill(), this.caret.visible = !1;
2743
972
  }
2744
973
  blinkCaret() {
2745
- this.cursorAnimation && this.cursorAnimation.kill(), this.cursorAnimation = A.fromTo(this.caret, { alpha: 0 }, {
974
+ this.cursorAnimation && this.cursorAnimation.kill(), this.cursorAnimation = N.fromTo(this.caret, { alpha: 0 }, {
2746
975
  duration: .5,
2747
976
  alpha: 1,
2748
977
  yoyo: !0,
@@ -2775,15 +1004,15 @@ var wr = [
2775
1004
  let n = Array.isArray(this.options.focusOverlay.activeFilter), r = !1;
2776
1005
  if (n) {
2777
1006
  let e = this.options.focusOverlay.activeFilter;
2778
- ($t && e.includes("mobile") || B && e.includes("touch") || !$t && !B && e.includes("desktop")) && (r = !0);
1007
+ (R && e.includes("mobile") || L && e.includes("touch") || !R && !L && e.includes("desktop")) && (r = !0);
2779
1008
  } else r = typeof this.options.focusOverlay.activeFilter == "function" ? this.options.focusOverlay.activeFilter() : t;
2780
1009
  if (r) {
2781
1010
  let t = structuredClone(this.options), n = this.options.focusOverlay?.scale || 1;
2782
1011
  t.focusOverlay = { activeFilter: !1 };
2783
- let r = Number(t.style?.fontSize || $.style?.fontSize || 20) * n;
1012
+ let r = Number(t.style?.fontSize || Q.style?.fontSize || 20) * n;
2784
1013
  if (t.style ||= {}, t.style.fontSize = r, t.padding && (t.padding.left *= n, t.padding.top *= n, t.padding.right *= n, t.padding.bottom *= n), t.bg?.radius && (t.bg.radius *= n), t.bg?.stroke?.width && (t.bg.stroke.width *= n), t.minWidth && (t.minWidth *= n, t.minWidth > this.app.size.width && (t.minWidth = this.app.size.width - (t.bg?.stroke?.width ? t.bg.stroke.width * 2 + 20 : 20))), this.options.focusOverlay?.backing?.active) {
2785
1014
  let e = this.make.sprite({
2786
- asset: k.WHITE,
1015
+ asset: j.WHITE,
2787
1016
  tint: this.options.focusOverlay.backing.options?.color ?? 0,
2788
1017
  alpha: this.options.focusOverlay.backing.options?.alpha ?? .8,
2789
1018
  width: this.app.size.width,
@@ -2798,12 +1027,12 @@ var wr = [
2798
1027
  }
2799
1028
  }
2800
1029
  _showCloneOverlay() {
2801
- this.cloneOverlay.pivot.y = -20, this.addAnimation(A.to(this.cloneOverlay, {
1030
+ this.cloneOverlay.pivot.y = -20, this.addAnimation(N.to(this.cloneOverlay, {
2802
1031
  duration: .5,
2803
1032
  alpha: .8,
2804
1033
  ease: "sine.out",
2805
1034
  delay: .1
2806
- })), this.addAnimation(A.to(this.cloneOverlay.pivot, {
1035
+ })), this.addAnimation(N.to(this.cloneOverlay.pivot, {
2807
1036
  duration: .5,
2808
1037
  y: 0,
2809
1038
  ease: "sine.out",
@@ -2840,11 +1069,11 @@ var wr = [
2840
1069
  return;
2841
1070
  }
2842
1071
  let e = this.domElement.selectionStart || 0, t = this.domElement.selectionEnd || -1, n = this.domElement.selectionDirection, r = "", i = this.options.type === "password" ? this.input.text : this._value;
2843
- if (t === void 0) r = i.substring(0, e), this._caretPosition = T.measureText(r, this.input.style).width, this._selectionRect = null;
1072
+ if (t === void 0) r = i.substring(0, e), this._caretPosition = O.measureText(r, this.input.style).width, this._selectionRect = null;
2844
1073
  else {
2845
1074
  r = i.substring(e > t ? t : e, e > t ? e : t);
2846
- let a = i.substring(0, e > t ? t : e), o = T.measureText(a, this.input.style), s = T.measureText(r, this.input.style);
2847
- this._selectionRect = new Tt(o.width, 0, s.width, this.input.height), this._caretPosition = n === "backward" ? this._selectionRect.left : this._selectionRect.left + this._selectionRect.width;
1075
+ let a = i.substring(0, e > t ? t : e), o = O.measureText(a, this.input.style), s = O.measureText(r, this.input.style);
1076
+ this._selectionRect = new tn(o.width, 0, s.width, this.input.height), this._caretPosition = n === "backward" ? this._selectionRect.left : this._selectionRect.left + this._selectionRect.width;
2848
1077
  }
2849
1078
  }
2850
1079
  _handleDomElementChange(e) {
@@ -2863,17 +1092,17 @@ var wr = [
2863
1092
  let e = this._inputContainer.getBounds();
2864
1093
  return e.width = this._lastWidth, e.height = this._lastHeight, e;
2865
1094
  }
2866
- }, Dr = class extends _ {
1095
+ }, tr = class extends b {
2867
1096
  constructor(e) {
2868
- if (super(), this.onChange = new p(), this.onStart = new p(), this.onEnd = new p(), this.onDestroy = new p(), this.outerRadius = 0, this.innerRadius = 0, this.innerAlphaStandby = .5, this.dragging = !1, this.pointData = new D(), this.direction = V.None, this.settings = Object.assign({
1097
+ if (super(), this.onChange = new p(), this.onStart = new p(), this.onEnd = new p(), this.onDestroy = new p(), this.outerRadius = 0, this.innerRadius = 0, this.innerAlphaStandby = .5, this.dragging = !1, this.pointData = new A(), this.direction = W.None, this.settings = Object.assign({
2869
1098
  outerScale: 1,
2870
1099
  innerScale: 1
2871
1100
  }, e), !this.settings.outer) {
2872
- let e = new E();
1101
+ let e = new k();
2873
1102
  e.circle(0, 0, 60).fill({ color: 0 }), e.alpha = .5, this.settings.outer = e;
2874
1103
  }
2875
1104
  if (!this.settings.inner) {
2876
- let e = new E();
1105
+ let e = new k();
2877
1106
  e.circle(0, 0, 35).fill({ color: 0 }), e.alpha = this.innerAlphaStandby, this.settings.inner = e;
2878
1107
  }
2879
1108
  this.threshold = this.settings.threshold ?? .01, this.initialize();
@@ -2883,12 +1112,12 @@ var wr = [
2883
1112
  }
2884
1113
  handleDragMove(e) {
2885
1114
  if (!this.dragging || e.pointerId !== this._pointerId) return;
2886
- let t = this.toLocal(e.global), n = t.x - this.startPosition.x, r = t.y - this.startPosition.y, i = new D(0, 0), a = 0, o = V.None;
1115
+ let t = this.toLocal(e.global), n = t.x - this.startPosition.x, r = t.y - this.startPosition.y, i = new A(0, 0), a = 0, o = W.None;
2887
1116
  if (n == 0 && r == 0) {
2888
1117
  this.direction = o;
2889
1118
  return;
2890
1119
  }
2891
- if (n === 0 && (r > 0 ? (i.set(0, r > this.outerRadius ? this.outerRadius : r), a = 270, o = V.Bottom) : (i.set(0, -(Math.abs(r) > this.outerRadius ? this.outerRadius : Math.abs(r))), a = 90, o = V.Top), this.inner.position.set(i.x, i.y), this.power = this.getPower(i), this.power >= this.threshold)) {
1120
+ if (n === 0 && (r > 0 ? (i.set(0, r > this.outerRadius ? this.outerRadius : r), a = 270, o = W.Bottom) : (i.set(0, -(Math.abs(r) > this.outerRadius ? this.outerRadius : Math.abs(r))), a = 90, o = W.Top), this.inner.position.set(i.x, i.y), this.power = this.getPower(i), this.power >= this.threshold)) {
2892
1121
  this.direction = o, this.onChange.emit({
2893
1122
  angle: a,
2894
1123
  direction: o,
@@ -2896,7 +1125,7 @@ var wr = [
2896
1125
  });
2897
1126
  return;
2898
1127
  }
2899
- if (r === 0 && (n > 0 ? (i.set(Math.abs(n) > this.outerRadius ? this.outerRadius : Math.abs(n), 0), a = 0, o = V.Right) : (i.set(-(Math.abs(n) > this.outerRadius ? this.outerRadius : Math.abs(n)), 0), a = 180, o = V.Left), this.inner.position.set(i.x, i.y), this.power = this.getPower(i), this.power >= this.threshold)) {
1128
+ if (r === 0 && (n > 0 ? (i.set(Math.abs(n) > this.outerRadius ? this.outerRadius : Math.abs(n), 0), a = 0, o = W.Right) : (i.set(-(Math.abs(n) > this.outerRadius ? this.outerRadius : Math.abs(n)), 0), a = 180, o = W.Left), this.inner.position.set(i.x, i.y), this.power = this.getPower(i), this.power >= this.threshold)) {
2900
1129
  this.direction = o, this.onChange.emit({
2901
1130
  angle: a,
2902
1131
  direction: o,
@@ -2920,7 +1149,7 @@ var wr = [
2920
1149
  this._pointerId === void 0 && (this._pointerId = e.pointerId, this.startPosition = this.toLocal(e.global), this.dragging = !0, this.inner.alpha = 1, this.onStart.emit());
2921
1150
  }
2922
1151
  handleDragEnd(e) {
2923
- this._pointerId === e.pointerId && (this.direction = V.None, this.inner.position.set(0, 0), this.dragging = !1, this.inner.alpha = this.innerAlphaStandby, this.onEnd.emit(), this._pointerId = void 0);
1152
+ this._pointerId === e.pointerId && (this.direction = W.None, this.inner.position.set(0, 0), this.dragging = !1, this.inner.alpha = this.innerAlphaStandby, this.onEnd.emit(), this._pointerId = void 0);
2924
1153
  }
2925
1154
  bindEvents() {
2926
1155
  this.eventMode = "static", this.on("pointerdown", this.handleDragStart).on("pointerup", this.handleDragEnd).on("pointerupoutside", this.handleDragEnd).on("pointermove", this.handleDragMove), window.addEventListener("pointerup", this.handleDragEnd);
@@ -2931,24 +1160,24 @@ var wr = [
2931
1160
  }
2932
1161
  getDirection(e) {
2933
1162
  let t = Math.atan2(e.y, e.x);
2934
- return t >= -Math.PI / 8 && t < 0 || t >= 0 && t < Math.PI / 8 ? V.Right : t >= Math.PI / 8 && t < 3 * Math.PI / 8 ? V.BottomRight : t >= 3 * Math.PI / 8 && t < 5 * Math.PI / 8 ? V.Bottom : t >= 5 * Math.PI / 8 && t < 7 * Math.PI / 8 ? V.BottomLeft : t >= 7 * Math.PI / 8 && t < Math.PI || t >= -Math.PI && t < -7 * Math.PI / 8 ? V.Left : t >= -7 * Math.PI / 8 && t < -5 * Math.PI / 8 ? V.TopLeft : t >= -5 * Math.PI / 8 && t < -3 * Math.PI / 8 ? V.Top : V.TopRight;
1163
+ return t >= -Math.PI / 8 && t < 0 || t >= 0 && t < Math.PI / 8 ? W.Right : t >= Math.PI / 8 && t < 3 * Math.PI / 8 ? W.BottomRight : t >= 3 * Math.PI / 8 && t < 5 * Math.PI / 8 ? W.Bottom : t >= 5 * Math.PI / 8 && t < 7 * Math.PI / 8 ? W.BottomLeft : t >= 7 * Math.PI / 8 && t < Math.PI || t >= -Math.PI && t < -7 * Math.PI / 8 ? W.Left : t >= -7 * Math.PI / 8 && t < -5 * Math.PI / 8 ? W.TopLeft : t >= -5 * Math.PI / 8 && t < -3 * Math.PI / 8 ? W.Top : W.TopRight;
2935
1164
  }
2936
- }, Or = {
1165
+ }, nr = {
2937
1166
  color: 0,
2938
1167
  alpha: .75
2939
- }, kr = {
1168
+ }, $ = {
2940
1169
  backing: !0,
2941
1170
  closeOnEscape: !0,
2942
1171
  closeOnPointerDownOutside: !0,
2943
1172
  actionContext: "popup"
2944
- }, Ar = class e extends _ {
1173
+ }, rr = class e extends b {
2945
1174
  get actionContext() {
2946
1175
  return this.config.actionContext;
2947
1176
  }
2948
1177
  constructor(e, t = {}) {
2949
1178
  super(), this.id = e, this.isShowing = !1, this._storedActionContext = void 0, this.config = Object.assign({
2950
1179
  id: e,
2951
- ...kr
1180
+ ...$
2952
1181
  }, t), this._initialize();
2953
1182
  }
2954
1183
  get data() {
@@ -2957,7 +1186,7 @@ var wr = [
2957
1186
  static makeBacking(e, t) {
2958
1187
  let n = {};
2959
1188
  typeof e == "object" && (n = e);
2960
- let r = Object.assign({ ...Or }, n), i = new Et(k.WHITE);
1189
+ let r = Object.assign({ ...nr }, n), i = new nn(j.WHITE);
2961
1190
  return i.anchor.set(.5), i.alpha = r.alpha, i.tint = r.color, i.width = t.width, i.height = t.height, i;
2962
1191
  }
2963
1192
  initialize() {}
@@ -2999,7 +1228,7 @@ var wr = [
2999
1228
  restoreActionContext() {
3000
1229
  this._storedActionContext && (c.log("Popup", "Restoring action context", this._storedActionContext), this.app.actionContext = this._storedActionContext), this._storedActionContext = void 0;
3001
1230
  }
3002
- }, jr = x.Collector, Mr = x.CollectorArray, Nr = x.CollectorLast, Pr = x.CollectorUntil0, Fr = x.CollectorWhile0, Ir = x.SignalConnections;
3003
- export { ae as ActionsPlugin, Be as Animated, Kn as AnimatedSprite, S as Application, Se as AssetsPlugin, Ke as AudioChannel, ue as AudioInstance, s as AudioManagerPlugin, t as BreakpointPlugin, er as Button, Qn as ButtonConfigKeys, qn as Camera, Jn as CameraController, u as CaperEvent, jr as Collector, Mr as CollectorArray, Nr as CollectorLast, Pr as CollectorUntil0, Fr as CollectorWhile0, Pt as Color, _ as Container, b as ContainerConfigKeys, Oe as Controls, yt as DataAdapter, M as DebugAlpha, j as DebugColors, se as DefaultActionContexts, le as DefaultActionContextsArray, fe as DefaultActions, d as DefaultButtonIds, Ln as Entity, v as Factory, ir as FlexContainer, rr as FlexContainerConfigKeys, ye as FocusManagerPlugin, l as FocusOutliner, J as Focusable, r as FullScreenPlugin, a as GesturePlugin, Er as Input, ft as InputControllerTypes, Re as InputPlugin, Zn as Interactive, bn as JOYSTICK_DIRECTIONS, Dr as Joystick, V as JoystickDirection, mt as KeyboardControls, he as KeyboardPlugin, c as Logger, He as LookupPlugin, Bn as ParticleContainer, Rn as ParticleContainerConfigKeys, te as Plugin, Ar as Popup, Fe as PopupManagerPlugin, pt as Queue, ot as ResizerPlugin, Vn as Scene, Je as SceneManagerPlugin, Hn as SceneTransition, p as Signal, Ir as SignalConnections, Xn as SpineAnimation, ee as Store, Un as Svg, wr as TextPropsKeys, $e as Timer, nt as TimerPlugin, ar as Toast, sr as Toaster, ct as TouchControls, ct as VirtualControls, pr as UICanvas, cr as UICanvasConfigKeys, Ae as WebEventsPlugin, h as WithSignals, e as add, Ie as addToPoint, m as bindAllMethods, pe as bindMethods, re as bool, de as capitalize, qe as capitalizeWords, rn as center, f as checkAndInvokeMethod, Xe as clamp, ur as computeEffectivePadding, it as coreFunctionRegistry, Ze as coreSignalRegistry, In as create, Pn as createContainer, Ft as createDebugGraphics, N as createDebugLabel, xe as createFactoryMethods, ve as createQueue, Le as debounce, Ye as deepMerge, ne as defaultActionsList, We as defaultBreakpoints, Cr as defaultFactoryMethods, ut as defaultGestureOptions, Y as defaultToastConfig, _n as defineActions, yn as defineBreakpoints, vn as defineButtons, Ee as defineConfig, gn as defineContexts, xn as defineControls, vt as defineData, Vt as defineEntity, zt as definePlugin, Bt as definePopup, Rt as defineScene, Ht as defineUI, o as delay, jt as destroyCanvas, at as distance, Qe as distanceSq, I as ensurePadding, n as env, sn as filterSet, cn as firstFromSet, oe as floatBetween, ge as floatBetweenPoint, Ne as formatTime, Te as generatePluginList, Lt as getDebugRegistry, Me as getDynamicModuleFromImportListItem, U as getErrorTexture, ze as getFirstMapEntry, ke as getLastMapEntry, un as getNearestCharacterIndex, lt as getNextMapEntry, me as getOrientation, ht as getPreviousMapEntry, At as getRandomElement, gr as getRegisteredEntityIds, yr as getRegisteredUIIds, Ut as getZeroPaddedNumber, _e as i18nPlugin, On as installCaperGlobal, _t as intBetween, i as intBetweenPoint, en as isAndroid, Ge as isDev, tn as isIos, $t as isMobile, ce as isProduction, dt as isPromise, Qt as isRetina, ie as isStorageCapable, nr as isText, B as isTouch, ln as lastFromSet, Ve as lerp, tt as lerpPoint, Ue as magnitude, je as multiply, gt as normalizeKey, Kt as objectDiagonal, nn as offset, Yt as offsetShape, Xt as offsetSimpleShape, st as omitKeys, fn as pixiVersion, g as pluck, Ce as randomUUID, Gt as reParent, jn as registerCaperApp, P as registerDebug, Gn as resolveAnchor, Wt as resolvePadding, q as resolvePivot, y as resolvePointLike, G as resolvePosition, K as resolveScale, et as resolveSizeLike, W as resolveTexture, H as resolveUnknownKeys, mn as sayHello, an as scale, z as scaleToHeight, Zt as scaleToSize, R as scaleToWidth, L as scaleUniform, Jt as sendToBack, qt as sendToFront, kt as shuffle, Mn as signalCaperReady, on as size, De as sortPluginsByRequires, rt as subtract, Pe as subtractFromPoint, Mt as toHex, Nt as toRgb, F as unregisterDebug, dn as version, be as wait };
1231
+ }, ir = h.Collector, ar = h.CollectorArray, or = h.CollectorLast, sr = h.CollectorUntil0, cr = h.CollectorWhile0, lr = h.SignalConnections;
1232
+ export { g as ActionsPlugin, Le as Animated, Yt as AnimatedSprite, S as Application, ve as AssetsPlugin, Ue as AudioChannel, oe as AudioInstance, s as AudioManagerPlugin, t as BreakpointPlugin, zt as Button, Pt as ButtonConfigKeys, Xn as Camera, Zn as CameraController, u as CaperEvent, ir as Collector, ar as CollectorArray, or as CollectorLast, sr as CollectorUntil0, cr as CollectorWhile0, ln as Color, b as Container, Qe as ContainerConfigKeys, we as Controls, Qt as DataAdapter, It as DebugAlpha, Ct as DebugColors, ie as DefaultActionContexts, _ as DefaultActionContextsArray, ce as DefaultActions, d as DefaultButtonIds, qn as Entity, qe as Factory, Mt as FlexContainer, Nt as FlexContainerConfigKeys, he as FocusManagerPlugin, l as FocusOutliner, T as Focusable, r as FullScreenPlugin, a as GesturePlugin, er as Input, dt as InputControllerTypes, Fe as InputPlugin, E as Interactive, Ln as JOYSTICK_DIRECTIONS, tr as Joystick, W as JoystickDirection, pt as KeyboardControls, de as KeyboardPlugin, c as Logger, ze as LookupPlugin, Tt as ParticleContainer, Lt as ParticleContainerConfigKeys, ee as Plugin, rr as Popup, je as PopupManagerPlugin, ft as Queue, ot as ResizerPlugin, Jn as Scene, Ge as SceneManagerPlugin, Yn as SceneTransition, p as Signal, lr as SignalConnections, Kt as SpineAnimation, be as Store, vt as Svg, Qn as TextPropsKeys, Ze as Timer, nt as TimerPlugin, Rt as Toast, jt as Toaster, C as TouchControls, C as VirtualControls, kt as UICanvas, Vt as UICanvasConfigKeys, Ee as WebEventsPlugin, y as WithSignals, e as add, Ne as addToPoint, v as bindAllMethods, le as bindMethods, te as bool, se as capitalize, We as capitalizeWords, Tn as center, f as checkAndInvokeMethod, Je as clamp, Wt as computeEffectivePadding, it as coreFunctionRegistry, Ye as coreSignalRegistry, Kn as create, Z as createContainer, wt as createDebugGraphics, Et as createDebugLabel, _e as createFactoryMethods, me as createQueue, Pe as debounce, Ke as deepMerge, m as defaultActionsList, Ve as defaultBreakpoints, Bt as defaultFactoryMethods, lt as defaultGestureOptions, Gt as defaultToastConfig, Pn as defineActions, In as defineBreakpoints, Fn as defineButtons, Se as defineConfig, Nn as defineContexts, Rn as defineControls, Zt as defineData, pn as defineEntity, dn as definePlugin, fn as definePopup, un as defineScene, mn as defineUI, o as delay, on as destroyCanvas, at as distance, Xe as distanceSq, D as ensurePadding, n as env, On as filterSet, kn as firstFromSet, re as floatBetween, fe as floatBetweenPoint, ke as formatTime, xe as generatePluginList, bt as getDebugRegistry, Oe as getDynamicModuleFromImportListItem, At as getErrorTexture, Ie as getFirstMapEntry, Te as getLastMapEntry, B as getNearestCharacterIndex, ct as getNextMapEntry, ue as getOrientation, mt as getPreviousMapEntry, an as getRandomElement, Ft as getRegisteredEntityIds, Ut as getRegisteredUIIds, gt as getZeroPaddedNumber, pe as i18nPlugin, Hn as installCaperGlobal, w as intBetween, i as intBetweenPoint, z as isAndroid, He as isDev, Cn as isIos, R as isMobile, ae as isProduction, ut as isPromise, Sn as isRetina, et as isStorageCapable, Ht as isText, L as isTouch, An as lastFromSet, Re as lerp, tt as lerpPoint, Be as magnitude, De as multiply, ht as normalizeKey, gn as objectDiagonal, wn as offset, yn as offsetShape, bn as offsetSimpleShape, st as omitKeys, H as pixiVersion, Me as pluck, ye as randomUUID, hn as reParent, Y as registerCaperApp, xt as registerDebug, Jt as resolveAnchor, Xt as resolvePadding, Dt as resolvePivot, x as resolvePointLike, _t as resolvePosition, qt as resolveScale, $e as resolveSizeLike, Ot as resolveTexture, yt as resolveUnknownKeys, U as sayHello, En as scale, I as scaleToHeight, xn as scaleToSize, F as scaleToWidth, P as scaleUniform, vn as sendToBack, _n as sendToFront, rn as shuffle, X as signalCaperReady, Dn as size, Ce as sortPluginsByRequires, rt as subtract, Ae as subtractFromPoint, sn as toHex, cn as toRgb, St as unregisterDebug, V as version, ge as wait };
3004
1233
 
3005
1234
  //# sourceMappingURL=caper.mjs.map