@caperjs/core 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assetpack.mjs +35 -3
- package/build/defaults.mjs +39 -1
- package/build/index.mjs +13 -2
- package/build/internal/outputMarker.mjs +52 -0
- package/cli/doctor.mjs +205 -2
- package/cli/doctor.test.mjs +522 -1
- package/cli/native.mjs +808 -0
- package/cli/native.test.mjs +1039 -0
- package/cli.mjs +4 -0
- package/extras/css/fullscreen.css +8 -0
- package/extras/llms.txt +18 -0
- package/extras/skills/caper/SKILL.md +1 -0
- package/lib/{CaptionsPlugin-Boj-gm3A.js → CaptionsPlugin-COrofpHN.js} +2 -2
- package/lib/{CaptionsPlugin-Boj-gm3A.js.map → CaptionsPlugin-COrofpHN.js.map} +1 -1
- package/lib/{DataAdapter-Cra9dJ6W.js → DataAdapter-T-22-_D1.js} +2 -2
- package/lib/{DataAdapter-Cra9dJ6W.js.map → DataAdapter-T-22-_D1.js.map} +1 -1
- package/lib/{DebugRenderer-19S58S4h.js → DebugRenderer-ZN692Pbg.js} +4 -4
- package/lib/{DebugRenderer-19S58S4h.js.map → DebugRenderer-ZN692Pbg.js.map} +1 -1
- package/lib/{DevToolsPlugin-BTSkRsdS.js → DevToolsPlugin-CQXFoj1T.js} +3 -3
- package/lib/{DevToolsPlugin-BTSkRsdS.js.map → DevToolsPlugin-CQXFoj1T.js.map} +1 -1
- package/lib/{GSAPPlugin-BcL7vjyw.js → GSAPPlugin-CNkncyXS.js} +2 -2
- package/lib/{GSAPPlugin-BcL7vjyw.js.map → GSAPPlugin-CNkncyXS.js.map} +1 -1
- package/lib/{LayoutPlugin-BDhSngz_.js → LayoutPlugin-BuJgr9bd.js} +26 -26
- package/lib/{LayoutPlugin-BDhSngz_.js.map → LayoutPlugin-BuJgr9bd.js.map} +1 -1
- package/lib/{ScreenDebugPlugin-C6pxs_3O.js → ScreenDebugPlugin-kz9Mr6j1.js} +2 -2
- package/lib/{ScreenDebugPlugin-C6pxs_3O.js.map → ScreenDebugPlugin-kz9Mr6j1.js.map} +1 -1
- package/lib/{SpinePlugin-CrQhaK6r.js → SpinePlugin-DDzD-Qxd.js} +1099 -877
- package/lib/SpinePlugin-DDzD-Qxd.js.map +1 -0
- package/lib/{StatsPlugin-Cu625dmk.js → StatsPlugin-tyFGzVjy.js} +2 -2
- package/lib/{StatsPlugin-Cu625dmk.js.map → StatsPlugin-tyFGzVjy.js.map} +1 -1
- package/lib/{VoiceOverPlugin-D4rfHFyJ.js → VoiceOverPlugin-rTNz_9eb.js} +2 -2
- package/lib/{VoiceOverPlugin-D4rfHFyJ.js.map → VoiceOverPlugin-rTNz_9eb.js.map} +1 -1
- package/lib/caper.mjs +51 -51
- package/lib/caper.mjs.map +1 -1
- package/lib/{const-BQ2iMCtc.js → const-Cj14a5U2.js} +5 -3
- package/lib/const-Cj14a5U2.js.map +1 -0
- package/lib/plugins/FullScreenPlugin.d.ts +65 -0
- package/lib/plugins/FullScreenPlugin.d.ts.map +1 -1
- package/lib/plugins/spine/SpinePlugin.d.ts.map +1 -1
- package/lib/plugins/spine/SpinePlugin.test.d.ts +2 -0
- package/lib/plugins/spine/SpinePlugin.test.d.ts.map +1 -0
- package/lib/{registries-BmDw_GV1.js → registries-DmNGVLAi.js} +489 -446
- package/lib/registries-DmNGVLAi.js.map +1 -0
- package/lib/ui/Button.d.ts.map +1 -1
- package/lib/utils/platform.d.ts +5 -0
- package/lib/utils/platform.d.ts.map +1 -1
- package/lib/utils/platform.test.d.ts +2 -0
- package/lib/utils/platform.test.d.ts.map +1 -0
- package/lib/utils/types.d.ts +1 -1
- package/lib/utils/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/plugins/FullScreenPlugin.test.ts +138 -0
- package/src/plugins/FullScreenPlugin.ts +132 -0
- package/src/plugins/spine/SpinePlugin.test.ts +31 -0
- package/src/plugins/spine/SpinePlugin.ts +9 -2
- package/src/ui/Button.test.ts +22 -0
- package/src/ui/Button.ts +7 -0
- package/src/utils/platform.test.ts +20 -0
- package/src/utils/platform.ts +6 -0
- package/src/utils/types.ts +5 -1
- package/src/version.ts +2 -2
- package/lib/SpinePlugin-CrQhaK6r.js.map +0 -1
- package/lib/const-BQ2iMCtc.js.map +0 -1
- package/lib/registries-BmDw_GV1.js.map +0 -1
|
@@ -26,30 +26,30 @@ function ue() {
|
|
|
26
26
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function de(e, t, n = !1) {
|
|
30
30
|
return e + Math.random() * (t - e + +!!n);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function fe(e, t = !1) {
|
|
33
|
+
return de(e.x, e.y, t);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return Math.floor(
|
|
35
|
+
function pe(e, t, n = !1) {
|
|
36
|
+
return Math.floor(de(e, t, n));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
38
|
+
function me(e, t = !1) {
|
|
39
|
+
return pe(e.x, e.y, t);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function he() {
|
|
42
42
|
return Math.random() < .5;
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
45
|
//#region src/utils/bind.ts
|
|
46
|
-
function
|
|
46
|
+
function ge(e, ...t) {
|
|
47
47
|
t.forEach((t) => {
|
|
48
48
|
let n = e[t];
|
|
49
49
|
typeof n == "function" && (e[t] = n.bind(e));
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function _e(e, t = [], n = []) {
|
|
53
53
|
let r = Object.getPrototypeOf(e), i = [];
|
|
54
54
|
for (; r;) {
|
|
55
55
|
let e = Object.getOwnPropertyNames(r).filter((e) => typeof Object.getOwnPropertyDescriptor(r, e)?.value == "function" && e !== "constructor" && !t.some((t) => e.startsWith(t)) && !n.includes(e));
|
|
@@ -58,37 +58,37 @@ function ge(e, t = [], n = []) {
|
|
|
58
58
|
}
|
|
59
59
|
return i;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
61
|
+
function g(e, t = [], n = []) {
|
|
62
|
+
_e(e, t, n).forEach((t) => {
|
|
63
63
|
e[t] = e[t].bind(e);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function ve(e, t, ...n) {
|
|
67
67
|
typeof e[t] == "function" && e[t](...n);
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/utils/env.ts
|
|
71
|
-
var
|
|
71
|
+
var _ = process.env.NODE_ENV, v = _ === "development", ye = _ === "production";
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/utils/string.ts
|
|
74
|
-
function
|
|
74
|
+
function y(e) {
|
|
75
75
|
return e ? e.charAt(0).toUpperCase() + e.slice(1) : "";
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return e ? e.split(" ").map(
|
|
77
|
+
function be(e) {
|
|
78
|
+
return e ? e.split(" ").map(y).join(" ") : "";
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/utils/console/Logger.ts
|
|
82
|
-
var
|
|
82
|
+
var b = {
|
|
83
83
|
log: "background: #74b64c; color: black;",
|
|
84
84
|
warn: "background: yellow; color: black;",
|
|
85
85
|
error: "background: red; color: white;"
|
|
86
|
-
},
|
|
86
|
+
}, x = "background: #1f2937; color: #74b64c;", S = class e {
|
|
87
87
|
static {
|
|
88
88
|
this._instance = null;
|
|
89
89
|
}
|
|
90
90
|
constructor(t) {
|
|
91
|
-
e._instance = this, e.mode = t === void 0 ?
|
|
91
|
+
e._instance = this, e.mode = t === void 0 ? v ? "development" : "default" : t, [
|
|
92
92
|
"development",
|
|
93
93
|
"default",
|
|
94
94
|
"disabled"
|
|
@@ -119,30 +119,30 @@ var x = {
|
|
|
119
119
|
static lifecycle(t, n = "init", ...r) {
|
|
120
120
|
if (e.mode === "disabled") return;
|
|
121
121
|
let i = `${t} ${n}`;
|
|
122
|
-
if (e.mode === "default") return console.log(`%c ${
|
|
123
|
-
console.groupCollapsed(`%c ${
|
|
122
|
+
if (e.mode === "default") return console.log(`%c ${y(n)} `, x, i, ...r);
|
|
123
|
+
console.groupCollapsed(`%c ${y(n)} `, x, i, ...r), console.trace("%c Stack ", x), console.groupEnd();
|
|
124
124
|
}
|
|
125
125
|
static trace(t = "log", ...n) {
|
|
126
126
|
if (e.mode !== "disabled") {
|
|
127
|
-
if (t === "error") return console.error(`%c ${
|
|
128
|
-
if (e.mode === "default") return console.log(`%c ${
|
|
129
|
-
console.groupCollapsed(`%c ${
|
|
127
|
+
if (t === "error") return console.error(`%c ${y(t)} `, b[t], ...n);
|
|
128
|
+
if (e.mode === "default") return console.log(`%c ${y(t)} `, b[t], ...n);
|
|
129
|
+
console.groupCollapsed(`%c ${y(t)} `, b[t], ...n), console.trace("%c Stack ", b[t]), console.groupEnd();
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
},
|
|
132
|
+
}, C = /* @__PURE__ */ function(e) {
|
|
133
133
|
return e.REQUIRED_ASSETS_START = "caper-required-assets-start", e.REQUIRED_ASSETS_PROGRESS = "caper-required-assets-progress", e.REQUIRED_ASSETS_COMPLETE = "caper-required-assets-complete", e.ASSETS_START = "caper-assets-start", e.ASSETS_PROGRESS = "caper-assets-progress", e.ASSETS_COMPLETE = "caper-assets-complete", e;
|
|
134
|
-
}({}),
|
|
134
|
+
}({}), xe = (e = 0) => new Promise((t) => setTimeout(t, e * 1e3)), Se = (e = 0) => xe(e), Ce = (e) => e && typeof e.then == "function";
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region src/utils/vite.ts
|
|
137
|
-
function
|
|
138
|
-
|
|
137
|
+
function w(e) {
|
|
138
|
+
S.error(e);
|
|
139
139
|
}
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/utils/promise/Queue.ts
|
|
142
|
-
function
|
|
143
|
-
return new
|
|
142
|
+
function we(...e) {
|
|
143
|
+
return new Te(e);
|
|
144
144
|
}
|
|
145
|
-
var
|
|
145
|
+
var Te = class {
|
|
146
146
|
constructor(e = []) {
|
|
147
147
|
this._currentIndex = 0, this._isPaused = !1, this._isCanceled = !1, this._promises = e;
|
|
148
148
|
}
|
|
@@ -175,7 +175,7 @@ var Ce = class {
|
|
|
175
175
|
this._results.push(t), this._currentIndex++, this._next();
|
|
176
176
|
} catch (e) {
|
|
177
177
|
let t = e instanceof Error ? e : Error(String(e));
|
|
178
|
-
console.error("Queue didn't complete due to an error:", e),
|
|
178
|
+
console.error("Queue didn't complete due to an error:", e), w({
|
|
179
179
|
message: `Queue didn't complete due to an error: ${t.message}`,
|
|
180
180
|
stack: t.stack,
|
|
181
181
|
id: e?.id
|
|
@@ -185,23 +185,23 @@ var Ce = class {
|
|
|
185
185
|
};
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region src/utils/framework.ts
|
|
188
|
-
function
|
|
188
|
+
function Ee(e) {
|
|
189
189
|
return typeof e == "function" && /^class\s/.test(Function.prototype.toString.call(e));
|
|
190
190
|
}
|
|
191
|
-
async function
|
|
191
|
+
async function T(e) {
|
|
192
192
|
let t, n;
|
|
193
|
-
return
|
|
193
|
+
return Ce(e.module) ? (t = await e.module, n = e?.namedExport ? t[e.namedExport] : t.default) : typeof e.module == "function" ? Ee(e.module) ? (t = e.module, n = t) : (t = await e.module(), n = e?.namedExport ? t[e.namedExport] : t.default) : (t = e.module, n = t), n;
|
|
194
194
|
}
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region src/utils/map.ts
|
|
197
|
-
function
|
|
197
|
+
function De(e, t) {
|
|
198
198
|
let n;
|
|
199
199
|
for (let r of e) {
|
|
200
200
|
if (r[0] === t) return n;
|
|
201
201
|
n = r;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function Oe(e, t) {
|
|
205
205
|
let n, r = Array.from(e.entries());
|
|
206
206
|
for (let e = r.length - 1; e >= 0; e--) {
|
|
207
207
|
let i = r[e];
|
|
@@ -209,23 +209,23 @@ function Ee(e, t) {
|
|
|
209
209
|
n = i;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function ke(e) {
|
|
213
213
|
return Array.from(e.entries()).pop();
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Ae(e) {
|
|
216
216
|
return Array.from(e.entries()).shift();
|
|
217
217
|
}
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/utils/math.ts
|
|
220
|
-
function
|
|
220
|
+
function je(e, t, n) {
|
|
221
221
|
return Math.max(t, Math.min(n, e));
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function Me(e, t, n) {
|
|
224
224
|
return e + (t - e) * n;
|
|
225
225
|
}
|
|
226
226
|
//#endregion
|
|
227
227
|
//#region src/utils/misc.ts
|
|
228
|
-
function
|
|
228
|
+
function Ne(e) {
|
|
229
229
|
if (e === void 0) return {
|
|
230
230
|
width: 0,
|
|
231
231
|
height: 0
|
|
@@ -249,7 +249,7 @@ function je(e) {
|
|
|
249
249
|
height: e ?? 0
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function Pe(e, t) {
|
|
253
253
|
let n = null;
|
|
254
254
|
return function(...r) {
|
|
255
255
|
n && clearTimeout(n), n = setTimeout(() => {
|
|
@@ -259,53 +259,53 @@ function Me(e, t) {
|
|
|
259
259
|
}
|
|
260
260
|
//#endregion
|
|
261
261
|
//#region src/utils/object.ts
|
|
262
|
-
function
|
|
262
|
+
function Fe(e, t) {
|
|
263
263
|
return t.reduce((t, n) => n in e ? {
|
|
264
264
|
...t,
|
|
265
265
|
[n]: e[n]
|
|
266
266
|
} : t, {});
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function Ie(e, t) {
|
|
269
269
|
return Object.entries(t).filter(([t]) => !e.includes(t)).reduce((e, [t, n]) => ({
|
|
270
270
|
...e,
|
|
271
271
|
[t]: n
|
|
272
272
|
}), {});
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
for (let n in t) t[n] !== void 0 && Object.prototype.toString.call(t[n]) === "[object Object]" && n in e && typeof e[n] == "object" ? e[n] =
|
|
274
|
+
function E(e, t) {
|
|
275
|
+
for (let n in t) t[n] !== void 0 && Object.prototype.toString.call(t[n]) === "[object Object]" && n in e && typeof e[n] == "object" ? e[n] = E(e[n], t[n]) : t[n] !== void 0 && (e[n] = t[n]);
|
|
276
276
|
return e;
|
|
277
277
|
}
|
|
278
278
|
//#endregion
|
|
279
279
|
//#region src/utils/point.ts
|
|
280
|
-
function
|
|
280
|
+
function Le(e, t) {
|
|
281
281
|
return new c(e.x + t.x, e.y + t.y);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Re(e, t) {
|
|
284
284
|
e.x += t.x, e.y += t.y;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function ze(e, t) {
|
|
287
287
|
return new c(e.x - t.x, e.y - t.y);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Be(e, t) {
|
|
290
290
|
e.x -= t.x, e.y -= t.y;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function Ve(e, t) {
|
|
293
293
|
let n = new c(e.x, e.y);
|
|
294
294
|
return n.x *= t, n.y *= t, n;
|
|
295
295
|
}
|
|
296
|
-
function Ve(e, t) {
|
|
297
|
-
return Ae(e.x, e.y, t);
|
|
298
|
-
}
|
|
299
296
|
function He(e, t) {
|
|
300
|
-
return
|
|
297
|
+
return Me(e.x, e.y, t);
|
|
301
298
|
}
|
|
302
299
|
function Ue(e, t) {
|
|
300
|
+
return Math.sqrt(We(e, t));
|
|
301
|
+
}
|
|
302
|
+
function We(e, t) {
|
|
303
303
|
return (t.x - e.x) * (t.x - e.x) + (t.y - e.y) * (t.y - e.y);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Ge(e) {
|
|
306
306
|
return Math.sqrt(e.x * e.x + e.y * e.y);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function Ke(e, t = !1, n = 0, r = 0) {
|
|
309
309
|
if (e instanceof c) n = e.x, r = e.y;
|
|
310
310
|
else if (Array.isArray(e)) n = e[0], r = e[1] === void 0 ? e[0] : e[1];
|
|
311
311
|
else if (typeof e == "object") {
|
|
@@ -319,16 +319,16 @@ function Ge(e, t = !1, n = 0, r = 0) {
|
|
|
319
319
|
}
|
|
320
320
|
//#endregion
|
|
321
321
|
//#region src/utils/web.ts
|
|
322
|
-
function
|
|
322
|
+
function qe() {
|
|
323
323
|
return window.innerWidth > window.innerHeight ? "landscape" : "portrait";
|
|
324
324
|
}
|
|
325
325
|
//#endregion
|
|
326
326
|
//#region src/core/config.ts
|
|
327
|
-
async function
|
|
327
|
+
async function Je(e) {
|
|
328
328
|
let t = globalThis.Caper?.get?.("pluginsList") ?? [];
|
|
329
329
|
return e.map((e) => {
|
|
330
330
|
let n = Array.isArray(e) ? e[0] : e, r = t.find((e) => e.id === n);
|
|
331
|
-
if (!r) return
|
|
331
|
+
if (!r) return S.warn(`Plugin ${e} not found`), null;
|
|
332
332
|
let i = e;
|
|
333
333
|
return {
|
|
334
334
|
id: r.id,
|
|
@@ -340,10 +340,10 @@ async function qe(e) {
|
|
|
340
340
|
};
|
|
341
341
|
}).filter(Boolean);
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Ye(e) {
|
|
344
344
|
return e;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function Xe(e, t) {
|
|
347
347
|
if (e.length < 2) return e.slice();
|
|
348
348
|
let n = /* @__PURE__ */ new Map();
|
|
349
349
|
for (let t of e) n.set(t.id, t);
|
|
@@ -378,12 +378,12 @@ function Ye(e, t) {
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
if (l.length !== e.length) {
|
|
381
|
-
let t = e.filter((e) => !l.includes(e)).map((e) => e.id), r =
|
|
381
|
+
let t = e.filter((e) => !l.includes(e)).map((e) => e.id), r = Ze(t, n);
|
|
382
382
|
throw Error(`Caper bootstrap failed: plugin dependency cycle detected: ${r.join(" → ")}\nPlugins involved: ${t.join(", ")}`);
|
|
383
383
|
}
|
|
384
384
|
return l;
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function Ze(e, t) {
|
|
387
387
|
let n = /* @__PURE__ */ new Set(), r = [], i = new Set(e);
|
|
388
388
|
function a(e) {
|
|
389
389
|
if (n.has(e)) {
|
|
@@ -406,13 +406,13 @@ function Xe(e, t) {
|
|
|
406
406
|
}
|
|
407
407
|
//#endregion
|
|
408
408
|
//#region src/mixins/factory/defaults.ts
|
|
409
|
-
var
|
|
409
|
+
var D = null;
|
|
410
410
|
function Qe(e) {
|
|
411
|
-
|
|
411
|
+
D = e;
|
|
412
412
|
}
|
|
413
413
|
function $e() {
|
|
414
|
-
if (!
|
|
415
|
-
return
|
|
414
|
+
if (!D) throw Error("[caper] The factory method table hasn't been initialized. Import '@caperjs/core' (or its factory module) before deep-importing display/ui classes so the table is registered first.");
|
|
415
|
+
return D;
|
|
416
416
|
}
|
|
417
417
|
//#endregion
|
|
418
418
|
//#region src/core/interfaces/IStorageCapability.ts
|
|
@@ -685,7 +685,7 @@ var k = /* @__PURE__ */ h(((e) => {
|
|
|
685
685
|
this.onError.disconnectAll();
|
|
686
686
|
}
|
|
687
687
|
_emitError(e) {
|
|
688
|
-
|
|
688
|
+
S.error(`[Store.${e.operation}] adapter='${e.adapterId}' key='${e.key}': ${e.error.message}`), this.onError.emit(e);
|
|
689
689
|
}
|
|
690
690
|
getAdapter(e) {
|
|
691
691
|
let t = this._app.getPlugin(e);
|
|
@@ -779,10 +779,10 @@ var N = class {
|
|
|
779
779
|
return this._options;
|
|
780
780
|
}
|
|
781
781
|
constructor(e = "Plugin") {
|
|
782
|
-
this.id = e, this._signalConnections = new A.SignalConnections(), this._disposers = [],
|
|
782
|
+
this.id = e, this._signalConnections = new A.SignalConnections(), this._disposers = [], g(this);
|
|
783
783
|
}
|
|
784
784
|
get app() {
|
|
785
|
-
return
|
|
785
|
+
return Q.getInstance();
|
|
786
786
|
}
|
|
787
787
|
destroy() {
|
|
788
788
|
let e = this._disposers;
|
|
@@ -790,7 +790,7 @@ var N = class {
|
|
|
790
790
|
for (let t = e.length - 1; t >= 0; t--) try {
|
|
791
791
|
e[t]();
|
|
792
792
|
} catch (e) {
|
|
793
|
-
|
|
793
|
+
S.error(`Plugin "${this.id}" threw while running a disposer:`, e);
|
|
794
794
|
}
|
|
795
795
|
this._signalConnections.disconnectAll();
|
|
796
796
|
}
|
|
@@ -827,13 +827,13 @@ var N = class {
|
|
|
827
827
|
registerCoreFunctions() {
|
|
828
828
|
this.getCoreFunctions().forEach((e) => {
|
|
829
829
|
let t = e;
|
|
830
|
-
$
|
|
830
|
+
$[t] = this[e];
|
|
831
831
|
});
|
|
832
832
|
}
|
|
833
833
|
registerCoreSignals() {
|
|
834
834
|
this.getCoreSignals().forEach((e) => {
|
|
835
835
|
let t = e;
|
|
836
|
-
|
|
836
|
+
er[t] = this[e];
|
|
837
837
|
});
|
|
838
838
|
}
|
|
839
839
|
getCoreFunctions() {
|
|
@@ -843,7 +843,7 @@ var N = class {
|
|
|
843
843
|
return [];
|
|
844
844
|
}
|
|
845
845
|
}, ut = {
|
|
846
|
-
preferWorkers: !
|
|
846
|
+
preferWorkers: !v,
|
|
847
847
|
crossOrigin: "anonymous"
|
|
848
848
|
};
|
|
849
849
|
function dt(e) {
|
|
@@ -864,24 +864,24 @@ function P(e) {
|
|
|
864
864
|
}
|
|
865
865
|
var ft = class extends N {
|
|
866
866
|
constructor(...e) {
|
|
867
|
-
super(...e), this.id = "assets", this.onLoadStart = new j(), this.onLoadProgress = new j(), this.onLoadComplete = new j(), this.onLoadRequiredStart = new j(), this.onLoadRequiredProgress = new j(), this.onLoadRequiredComplete = new j(), this.onBackgroundLoadStart = new j(), this.onBackgroundAssetLoaded = new j(), this.onBackgroundBundlesLoaded = new j(), this._loadedBundles = /* @__PURE__ */ new Set(), this._loadedAssets = /* @__PURE__ */ new Set(), this._required = {}, this._background = {}, this._isLoadingRequired = !1, this.webRequiredStartEvent = new Event(
|
|
867
|
+
super(...e), this.id = "assets", this.onLoadStart = new j(), this.onLoadProgress = new j(), this.onLoadComplete = new j(), this.onLoadRequiredStart = new j(), this.onLoadRequiredProgress = new j(), this.onLoadRequiredComplete = new j(), this.onBackgroundLoadStart = new j(), this.onBackgroundAssetLoaded = new j(), this.onBackgroundBundlesLoaded = new j(), this._loadedBundles = /* @__PURE__ */ new Set(), this._loadedAssets = /* @__PURE__ */ new Set(), this._required = {}, this._background = {}, this._isLoadingRequired = !1, this.webRequiredStartEvent = new Event(C.REQUIRED_ASSETS_START, {
|
|
868
868
|
bubbles: !0,
|
|
869
869
|
cancelable: !1
|
|
870
|
-
}), this.webRequiredProgressEvent = new CustomEvent(
|
|
870
|
+
}), this.webRequiredProgressEvent = new CustomEvent(C.REQUIRED_ASSETS_PROGRESS, {
|
|
871
871
|
bubbles: !0,
|
|
872
872
|
cancelable: !1,
|
|
873
873
|
detail: { progress: 0 }
|
|
874
|
-
}), this.webRequiredCompleteEvent = new Event(
|
|
874
|
+
}), this.webRequiredCompleteEvent = new Event(C.REQUIRED_ASSETS_COMPLETE, {
|
|
875
875
|
bubbles: !0,
|
|
876
876
|
cancelable: !1
|
|
877
|
-
}), this.webStartEvent = new Event(
|
|
877
|
+
}), this.webStartEvent = new Event(C.ASSETS_START, {
|
|
878
878
|
bubbles: !0,
|
|
879
879
|
cancelable: !1
|
|
880
|
-
}), this.webProgressEvent = new CustomEvent(
|
|
880
|
+
}), this.webProgressEvent = new CustomEvent(C.ASSETS_PROGRESS, {
|
|
881
881
|
bubbles: !0,
|
|
882
882
|
cancelable: !1,
|
|
883
883
|
detail: { progress: 0 }
|
|
884
|
-
}), this.webCompleteEvent = new Event(
|
|
884
|
+
}), this.webCompleteEvent = new Event(C.ASSETS_COMPLETE, {
|
|
885
885
|
bubbles: !0,
|
|
886
886
|
cancelable: !1
|
|
887
887
|
});
|
|
@@ -1045,10 +1045,10 @@ var ft = class extends N {
|
|
|
1045
1045
|
return this._fullScreenElement;
|
|
1046
1046
|
}
|
|
1047
1047
|
constructor() {
|
|
1048
|
-
super(), this.id = "fullscreen", this.onFullScreenChange = new j(), this._isFullScreen = !1, this._fullScreenElement = null,
|
|
1048
|
+
super(), this.id = "fullscreen", this.onFullScreenChange = new j(), this._isFullScreen = !1, this._fullScreenElement = null, this._driver = null, this._driverUnsubscribe = null, this._driverIsFullScreen = !1, g(this);
|
|
1049
1049
|
}
|
|
1050
1050
|
get app() {
|
|
1051
|
-
return
|
|
1051
|
+
return Q.getInstance();
|
|
1052
1052
|
}
|
|
1053
1053
|
initialize() {
|
|
1054
1054
|
this.listen(document, "fullscreenchange", this._onFullScreenChange), this.listen(document, "webkitfullscreenchange", this._onFullScreenChange), this.listen(document, "mozfullscreenchange", this._onFullScreenChange), this.listen(document, "msfullscreenchange", this._onFullScreenChange);
|
|
@@ -1057,19 +1057,32 @@ var ft = class extends N {
|
|
|
1057
1057
|
this.setFullScreen(!this._isFullScreen);
|
|
1058
1058
|
}
|
|
1059
1059
|
setFullScreen(e) {
|
|
1060
|
-
this._isFullScreen = e
|
|
1060
|
+
this._isFullScreen = e;
|
|
1061
|
+
let t = this._driver;
|
|
1062
|
+
if (t) {
|
|
1063
|
+
this._runDriver(() => e ? t.request() : t.exit());
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
e ? this._requestFullscreen() : this._exitFullscreen();
|
|
1061
1067
|
}
|
|
1062
1068
|
setFullScreenElement(e) {
|
|
1063
|
-
e ||
|
|
1069
|
+
e || S.warn("No element passed to setFullScreenElement for fullscreen mode"), this._fullScreenElement = e;
|
|
1070
|
+
}
|
|
1071
|
+
setFullscreenDriver(e) {
|
|
1072
|
+
this._unsubscribeDriver(), this._driver = e, this._driverIsFullScreen = !1, e?.subscribe && (this._driverUnsubscribe = e.subscribe(this._onDriverStateChange));
|
|
1073
|
+
}
|
|
1074
|
+
destroy() {
|
|
1075
|
+
this._unsubscribeDriver(), super.destroy();
|
|
1064
1076
|
}
|
|
1065
1077
|
get canFullscreen() {
|
|
1066
|
-
|
|
1078
|
+
if (this._driver) return this._driver.supported;
|
|
1079
|
+
let e = this._fullScreenElement || Q.containerElement;
|
|
1067
1080
|
if (!e) return !1;
|
|
1068
1081
|
let t = e;
|
|
1069
1082
|
return !!(t.requestFullscreen || t.webkitRequestFullscreen || t.msRequestFullscreen || t.mozRequestFullScreen);
|
|
1070
1083
|
}
|
|
1071
1084
|
get isFullscreen() {
|
|
1072
|
-
return !!(document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement || document.mozFullScreenElement);
|
|
1085
|
+
return this._driver ? this._driverIsFullScreen : !!(document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement || document.mozFullScreenElement);
|
|
1073
1086
|
}
|
|
1074
1087
|
getCoreSignals() {
|
|
1075
1088
|
return ["onFullScreenChange"];
|
|
@@ -1082,13 +1095,13 @@ var ft = class extends N {
|
|
|
1082
1095
|
];
|
|
1083
1096
|
}
|
|
1084
1097
|
_requestFullscreen() {
|
|
1085
|
-
let e = this._fullScreenElement ||
|
|
1098
|
+
let e = this._fullScreenElement || Q.containerElement;
|
|
1086
1099
|
if (!e) throw Error("No element available for fullscreen mode");
|
|
1087
1100
|
let t = e;
|
|
1088
1101
|
try {
|
|
1089
1102
|
t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.msRequestFullscreen ? t.msRequestFullscreen() : t.mozRequestFullScreen && t.mozRequestFullScreen();
|
|
1090
1103
|
} catch (e) {
|
|
1091
|
-
|
|
1104
|
+
S.error("Failed to request fullscreen:", e), this._isFullScreen = !1;
|
|
1092
1105
|
}
|
|
1093
1106
|
}
|
|
1094
1107
|
_exitFullscreen() {
|
|
@@ -1097,13 +1110,43 @@ var ft = class extends N {
|
|
|
1097
1110
|
_onFullScreenChange() {
|
|
1098
1111
|
this._isFullScreen = this.isFullscreen, this.onFullScreenChange.emit(this._isFullScreen);
|
|
1099
1112
|
}
|
|
1113
|
+
_onDriverStateChange(e) {
|
|
1114
|
+
e !== this._driverIsFullScreen && (this._driverIsFullScreen = e, this._isFullScreen = e, this.onFullScreenChange.emit(e));
|
|
1115
|
+
}
|
|
1116
|
+
_runDriver(e) {
|
|
1117
|
+
try {
|
|
1118
|
+
let t = e();
|
|
1119
|
+
t && typeof t.catch == "function" && t.catch((e) => {
|
|
1120
|
+
S.error("Fullscreen driver failed:", mt(e));
|
|
1121
|
+
});
|
|
1122
|
+
} catch (e) {
|
|
1123
|
+
S.error("Fullscreen driver failed:", mt(e));
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
_unsubscribeDriver() {
|
|
1127
|
+
let e = this._driverUnsubscribe;
|
|
1128
|
+
if (this._driverUnsubscribe = null, e) try {
|
|
1129
|
+
e();
|
|
1130
|
+
} catch (e) {
|
|
1131
|
+
S.error("Fullscreen driver unsubscribe failed:", e);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1100
1134
|
};
|
|
1135
|
+
function mt(e) {
|
|
1136
|
+
if (e instanceof Error) return e.message;
|
|
1137
|
+
if (typeof e == "string") return e;
|
|
1138
|
+
try {
|
|
1139
|
+
return JSON.stringify(e);
|
|
1140
|
+
} catch {
|
|
1141
|
+
return String(e);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1101
1144
|
//#endregion
|
|
1102
1145
|
//#region src/plugins/KeyboardPlugin.ts
|
|
1103
1146
|
function F(e) {
|
|
1104
1147
|
return e === void 0 ? e = "*undefined*" : e === " " ? e = "Space" : e.length === 1 && (e = e.toUpperCase()), e;
|
|
1105
1148
|
}
|
|
1106
|
-
var
|
|
1149
|
+
var ht = class extends N {
|
|
1107
1150
|
constructor(...e) {
|
|
1108
1151
|
super(...e), this.id = "keyboard", this.onGlobalKeyDown = new j(), this.onGlobalKeyUp = new j(), this._keyDownSignals = /* @__PURE__ */ new Map(), this._keyUpSignals = /* @__PURE__ */ new Map(), this._keysDown = /* @__PURE__ */ new Set(), this._warnedNoConsumers = !1, this._enabled = !0;
|
|
1109
1152
|
}
|
|
@@ -1148,7 +1191,7 @@ var mt = class extends N {
|
|
|
1148
1191
|
}
|
|
1149
1192
|
_handleKeyUp(e) {
|
|
1150
1193
|
let t = F(e.key);
|
|
1151
|
-
this._keysDown.delete(t),
|
|
1194
|
+
this._keysDown.delete(t), v && !this._warnedNoConsumers && this._keyUpSignals.size === 0 && this._keyDownSignals.size === 0 && (this._warnedNoConsumers = !0, S.warn("KeyboardPlugin received a key event but no consumers are connected, so keyboard actions will not fire. Ensure the InputPlugin controls are connected — e.g. an Application subclass overriding postInitialize() must not skip framework wiring, or call app.controls.connect().")), this.onGlobalKeyUp.emit({
|
|
1152
1195
|
event: e,
|
|
1153
1196
|
key: e.key
|
|
1154
1197
|
});
|
|
@@ -1171,7 +1214,7 @@ var mt = class extends N {
|
|
|
1171
1214
|
key: n
|
|
1172
1215
|
});
|
|
1173
1216
|
}
|
|
1174
|
-
},
|
|
1217
|
+
}, gt = class extends N {
|
|
1175
1218
|
constructor(...e) {
|
|
1176
1219
|
super(...e), this.id = "actions", this.onActionContextChanged = new j(), this.onActionDispatched = new j(), this._context = "default", this._signals = /* @__PURE__ */ new Map(), this._actions = {}, this._debug = !1;
|
|
1177
1220
|
}
|
|
@@ -1198,7 +1241,7 @@ var mt = class extends N {
|
|
|
1198
1241
|
}
|
|
1199
1242
|
sendAction(e, t) {
|
|
1200
1243
|
if (!this._actions[e]) {
|
|
1201
|
-
this._debug &&
|
|
1244
|
+
this._debug && S.warn(`Action ${e} is not defined`);
|
|
1202
1245
|
return;
|
|
1203
1246
|
}
|
|
1204
1247
|
let n = this._actions[e].context;
|
|
@@ -1211,7 +1254,7 @@ var mt = class extends N {
|
|
|
1211
1254
|
this.getAction(e).emit(n), this.onActionDispatched.emit(n);
|
|
1212
1255
|
return;
|
|
1213
1256
|
}
|
|
1214
|
-
this._debug &&
|
|
1257
|
+
this._debug && S.warn(`Action ${e} is not allowed for context ${this.context}`);
|
|
1215
1258
|
}
|
|
1216
1259
|
setActionContext(e) {
|
|
1217
1260
|
return this.context = e, this.context;
|
|
@@ -1227,19 +1270,19 @@ var mt = class extends N {
|
|
|
1227
1270
|
getCoreSignals() {
|
|
1228
1271
|
return ["onActionContextChanged", "onActionDispatched"];
|
|
1229
1272
|
}
|
|
1230
|
-
},
|
|
1273
|
+
}, _t = {
|
|
1231
1274
|
default: "default",
|
|
1232
1275
|
menu: "menu",
|
|
1233
1276
|
pause: "pause",
|
|
1234
1277
|
popup: "popup",
|
|
1235
1278
|
game: "game"
|
|
1236
|
-
},
|
|
1279
|
+
}, vt = [
|
|
1237
1280
|
"default",
|
|
1238
1281
|
"menu",
|
|
1239
1282
|
"pause",
|
|
1240
1283
|
"popup",
|
|
1241
1284
|
"game"
|
|
1242
|
-
],
|
|
1285
|
+
], yt = [
|
|
1243
1286
|
"up",
|
|
1244
1287
|
"down",
|
|
1245
1288
|
"left",
|
|
@@ -1252,7 +1295,7 @@ var mt = class extends N {
|
|
|
1252
1295
|
"menu",
|
|
1253
1296
|
"back",
|
|
1254
1297
|
"next"
|
|
1255
|
-
],
|
|
1298
|
+
], bt = {
|
|
1256
1299
|
action: { context: "*" },
|
|
1257
1300
|
back: { context: [
|
|
1258
1301
|
"menu",
|
|
@@ -1289,10 +1332,10 @@ var mt = class extends N {
|
|
|
1289
1332
|
pause: { context: "*" },
|
|
1290
1333
|
unpause: { context: "*" },
|
|
1291
1334
|
start: { context: "*" }
|
|
1292
|
-
},
|
|
1335
|
+
}, xt = { __default_do_not_use__: "__default_do_not_use__" };
|
|
1293
1336
|
//#endregion
|
|
1294
1337
|
//#region src/plugins/breakpoints/evaluate.ts
|
|
1295
|
-
function
|
|
1338
|
+
function St(e) {
|
|
1296
1339
|
let t = Object.entries(e);
|
|
1297
1340
|
if (t.length === 0) throw Error("[breakpoints] `tiers` is empty — declare at least one tier in caper.config.ts.");
|
|
1298
1341
|
for (let [e, n] of t) if (!Number.isFinite(n) || n < 0) throw Error(`[breakpoints] tier '${e}' has an invalid stop (${n}) — stops must be finite numbers >= 0.`);
|
|
@@ -1305,25 +1348,25 @@ function xt(e) {
|
|
|
1305
1348
|
byName: Object.fromEntries(n)
|
|
1306
1349
|
};
|
|
1307
1350
|
}
|
|
1308
|
-
function
|
|
1351
|
+
function Ct(e, t) {
|
|
1309
1352
|
let n = e.names[0];
|
|
1310
1353
|
for (let r = 0; r < e.stops.length && !(t < e.stops[r]); r++) n = e.names[r];
|
|
1311
1354
|
return n;
|
|
1312
1355
|
}
|
|
1313
|
-
var
|
|
1314
|
-
function
|
|
1315
|
-
|
|
1356
|
+
var wt = /* @__PURE__ */ new Set();
|
|
1357
|
+
function Tt(e, t) {
|
|
1358
|
+
wt.has(e) || (wt.add(e), S.warn(t));
|
|
1316
1359
|
}
|
|
1317
1360
|
function I(e, t) {
|
|
1318
1361
|
if (typeof t == "number") return t;
|
|
1319
1362
|
let n = e.byName[t];
|
|
1320
|
-
return n === void 0 &&
|
|
1363
|
+
return n === void 0 && Tt(`stop:${t}`, `[breakpoints] unknown tier '${t}' — known tiers: ${e.names.join(", ")}.`), n;
|
|
1321
1364
|
}
|
|
1322
|
-
function
|
|
1365
|
+
function Et(e, t, n, r = "mode") {
|
|
1323
1366
|
if (typeof t == "function") try {
|
|
1324
1367
|
return t(e) === !0;
|
|
1325
1368
|
} catch (e) {
|
|
1326
|
-
return
|
|
1369
|
+
return Tt(`predicate:${r}`, `[breakpoints] mode '${r}' threw; treating as false. ${String(e)}`), !1;
|
|
1327
1370
|
}
|
|
1328
1371
|
if (t.tier !== void 0 && !(Array.isArray(t.tier) ? t.tier : [t.tier]).includes(e.tier)) return !1;
|
|
1329
1372
|
if (t.atLeast !== void 0) {
|
|
@@ -1342,21 +1385,21 @@ function L(e, t, n) {
|
|
|
1342
1385
|
width: r,
|
|
1343
1386
|
height: i,
|
|
1344
1387
|
aspect: i === 0 ? 0 : r / i,
|
|
1345
|
-
tier:
|
|
1388
|
+
tier: Ct(t, r),
|
|
1346
1389
|
orientation: r > i ? "landscape" : "portrait",
|
|
1347
1390
|
pointer: n
|
|
1348
1391
|
};
|
|
1349
1392
|
}
|
|
1350
|
-
function
|
|
1393
|
+
function Dt(e, t, n) {
|
|
1351
1394
|
let r = new Set([
|
|
1352
1395
|
e.tier,
|
|
1353
1396
|
e.orientation,
|
|
1354
1397
|
e.pointer
|
|
1355
1398
|
]);
|
|
1356
|
-
for (let [i, a] of t)
|
|
1399
|
+
for (let [i, a] of t) Et(e, a, n, i) && r.add(i);
|
|
1357
1400
|
return r;
|
|
1358
1401
|
}
|
|
1359
|
-
function
|
|
1402
|
+
function Ot(e, t) {
|
|
1360
1403
|
let n = [], r = [];
|
|
1361
1404
|
for (let r of t) e.has(r) || n.push(r);
|
|
1362
1405
|
for (let n of e) t.has(n) || r.push(n);
|
|
@@ -1365,7 +1408,7 @@ function Dt(e, t) {
|
|
|
1365
1408
|
left: r
|
|
1366
1409
|
};
|
|
1367
1410
|
}
|
|
1368
|
-
function
|
|
1411
|
+
function kt(e, t, n) {
|
|
1369
1412
|
let r = e.names.indexOf(t);
|
|
1370
1413
|
for (let t = r; t >= 0; t--) {
|
|
1371
1414
|
let r = n[e.names[t]];
|
|
@@ -1383,7 +1426,7 @@ var R = {
|
|
|
1383
1426
|
tablet: 768,
|
|
1384
1427
|
desktop: 1024,
|
|
1385
1428
|
wide: 1440
|
|
1386
|
-
},
|
|
1429
|
+
}, At = new Set([
|
|
1387
1430
|
"portrait",
|
|
1388
1431
|
"landscape",
|
|
1389
1432
|
"coarse",
|
|
@@ -1391,10 +1434,10 @@ var R = {
|
|
|
1391
1434
|
]), z = {
|
|
1392
1435
|
width: 0,
|
|
1393
1436
|
height: 0
|
|
1394
|
-
},
|
|
1437
|
+
}, jt = class extends N {
|
|
1395
1438
|
constructor(...e) {
|
|
1396
1439
|
super(...e), this.id = "breakpoints", this.onBreakpointChanged = new j(), this._modes = /* @__PURE__ */ new Map(), this._active = /* @__PURE__ */ new Set(), this._enter = /* @__PURE__ */ new Map(), this._leave = /* @__PURE__ */ new Map(), this._pointer = "fine", this._pointerQuery = null, this._warnedListenerNames = /* @__PURE__ */ new Set(), this._evaluate = (e) => {
|
|
1397
|
-
let t = L(e ?? z, this._ladder, this._pointer), n =
|
|
1440
|
+
let t = L(e ?? z, this._ladder, this._pointer), n = Dt(t, this._modes, this._ladder), { entered: r, left: i } = Ot(this._active, n), a = this._ctx.tier;
|
|
1398
1441
|
if (this._ctx = t, this._active = n, !(r.length === 0 && i.length === 0)) {
|
|
1399
1442
|
for (let e of i) this._leave.get(e)?.emit();
|
|
1400
1443
|
for (let e of r) this._enter.get(e)?.emit();
|
|
@@ -1438,12 +1481,12 @@ var R = {
|
|
|
1438
1481
|
return this._ctx.pointer;
|
|
1439
1482
|
}
|
|
1440
1483
|
async initialize(e = {}) {
|
|
1441
|
-
this._ladder =
|
|
1484
|
+
this._ladder = St({ ...R }), this._ctx = L(z, this._ladder, this._pointer), this._options = {
|
|
1442
1485
|
tiers: e.tiers ?? { ...R },
|
|
1443
1486
|
modes: e.modes ?? {}
|
|
1444
|
-
}, this._ladder =
|
|
1487
|
+
}, this._ladder = St(this._options.tiers);
|
|
1445
1488
|
for (let [e, t] of Object.entries(this._options.modes)) this._modes.set(e, t);
|
|
1446
|
-
this._initPointer(), this._ctx = L(z, this._ladder, this._pointer), this._active =
|
|
1489
|
+
this._initPointer(), this._ctx = L(z, this._ladder, this._pointer), this._active = Dt(this._ctx, this._modes, this._ladder);
|
|
1447
1490
|
}
|
|
1448
1491
|
async postInitialize(e) {
|
|
1449
1492
|
this._evaluate(this.app.size ?? z), this.addSignalConnection(this.app.onResize.connect(this._evaluate, "highest"));
|
|
@@ -1455,7 +1498,7 @@ var R = {
|
|
|
1455
1498
|
this._enter.clear(), this._leave.clear(), this.onBreakpointChanged.disconnectAll(), super.destroy();
|
|
1456
1499
|
}
|
|
1457
1500
|
is(e) {
|
|
1458
|
-
return this._isKnown(e) ? this._active.has(e) : (
|
|
1501
|
+
return this._isKnown(e) ? this._active.has(e) : (S.warn(`[breakpoints] unknown name '${e}'. Known: ${this._knownNames().join(", ")}.`), !1);
|
|
1459
1502
|
}
|
|
1460
1503
|
atLeast(e) {
|
|
1461
1504
|
let t = I(this._ladder, e);
|
|
@@ -1469,10 +1512,10 @@ var R = {
|
|
|
1469
1512
|
return this.atLeast(e) && this.below(t);
|
|
1470
1513
|
}
|
|
1471
1514
|
matches(e) {
|
|
1472
|
-
return
|
|
1515
|
+
return Et(this._ctx, e, this._ladder);
|
|
1473
1516
|
}
|
|
1474
1517
|
value(e) {
|
|
1475
|
-
return
|
|
1518
|
+
return kt(this._ladder, this._ctx.tier, e);
|
|
1476
1519
|
}
|
|
1477
1520
|
define(e, t) {
|
|
1478
1521
|
this._modes.set(e, t), this._evaluate(this.size);
|
|
@@ -1504,19 +1547,19 @@ var R = {
|
|
|
1504
1547
|
return n || (n = new j(), e.set(t, n)), n;
|
|
1505
1548
|
}
|
|
1506
1549
|
_isKnown(e) {
|
|
1507
|
-
return e in this._ladder.byName || this._modes.has(e) ||
|
|
1550
|
+
return e in this._ladder.byName || this._modes.has(e) || At.has(e);
|
|
1508
1551
|
}
|
|
1509
1552
|
_warnIfUnknown(e) {
|
|
1510
|
-
this._isKnown(e) || this._warnedListenerNames.has(e) || (this._warnedListenerNames.add(e),
|
|
1553
|
+
this._isKnown(e) || this._warnedListenerNames.has(e) || (this._warnedListenerNames.add(e), S.warn(`[breakpoints] unknown name '${e}'. Known: ${this._knownNames().join(", ")}.`));
|
|
1511
1554
|
}
|
|
1512
1555
|
_knownNames() {
|
|
1513
1556
|
return [
|
|
1514
1557
|
...this._ladder.names,
|
|
1515
1558
|
...this._modes.keys(),
|
|
1516
|
-
...
|
|
1559
|
+
...At
|
|
1517
1560
|
];
|
|
1518
1561
|
}
|
|
1519
|
-
},
|
|
1562
|
+
}, Mt = class {
|
|
1520
1563
|
constructor(e, t) {
|
|
1521
1564
|
this.name = e, this.manager = t, this._sounds = /* @__PURE__ */ new Map(), this._muted = !1, this._volume = 1, this.muted = this.manager.muted;
|
|
1522
1565
|
}
|
|
@@ -1564,7 +1607,7 @@ var R = {
|
|
|
1564
1607
|
try {
|
|
1565
1608
|
e.pause();
|
|
1566
1609
|
} catch (t) {
|
|
1567
|
-
|
|
1610
|
+
S.error("Error pausing sound", e.id, t);
|
|
1568
1611
|
}
|
|
1569
1612
|
});
|
|
1570
1613
|
});
|
|
@@ -1575,7 +1618,7 @@ var R = {
|
|
|
1575
1618
|
try {
|
|
1576
1619
|
e.resume();
|
|
1577
1620
|
} catch (t) {
|
|
1578
|
-
|
|
1621
|
+
S.error("Error resuming sound", e.id, t);
|
|
1579
1622
|
}
|
|
1580
1623
|
});
|
|
1581
1624
|
});
|
|
@@ -1607,9 +1650,9 @@ var R = {
|
|
|
1607
1650
|
[...e].forEach((e) => e.destroy());
|
|
1608
1651
|
}), this._sounds.clear();
|
|
1609
1652
|
}
|
|
1610
|
-
},
|
|
1653
|
+
}, Nt = class {
|
|
1611
1654
|
constructor(e, t, n) {
|
|
1612
|
-
this.id = e, this.channel = t, this.manager = n, this.onStart = new j(), this.onStop = new j(), this.onEnd = new j(), this.onPaused = new j(), this.onResumed = new j(), this.onProgress = new j(), this._volume = 1, this._muted = !1, this._isPlaying = !1,
|
|
1655
|
+
this.id = e, this.channel = t, this.manager = n, this.onStart = new j(), this.onStop = new j(), this.onEnd = new j(), this.onPaused = new j(), this.onResumed = new j(), this.onProgress = new j(), this._volume = 1, this._muted = !1, this._isPlaying = !1, g(this), this.muted = this.channel.muted;
|
|
1613
1656
|
}
|
|
1614
1657
|
get media() {
|
|
1615
1658
|
return this._media;
|
|
@@ -1690,16 +1733,16 @@ var R = {
|
|
|
1690
1733
|
_handleMediaResumed() {
|
|
1691
1734
|
this._isPlaying = !0, this.onResumed.emit(this);
|
|
1692
1735
|
}
|
|
1693
|
-
},
|
|
1694
|
-
function
|
|
1695
|
-
return
|
|
1736
|
+
}, Pt;
|
|
1737
|
+
function Ft(e) {
|
|
1738
|
+
return Pt = e, e;
|
|
1696
1739
|
}
|
|
1697
|
-
function
|
|
1698
|
-
return
|
|
1740
|
+
function B() {
|
|
1741
|
+
return Pt;
|
|
1699
1742
|
}
|
|
1700
1743
|
//#endregion
|
|
1701
|
-
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.
|
|
1702
|
-
var
|
|
1744
|
+
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.22.0/node_modules/@pixi/sound/lib/filters/Filter.mjs
|
|
1745
|
+
var It = class {
|
|
1703
1746
|
constructor(e, t) {
|
|
1704
1747
|
this.init(e, t);
|
|
1705
1748
|
}
|
|
@@ -1715,71 +1758,71 @@ var Pt = class {
|
|
|
1715
1758
|
destroy() {
|
|
1716
1759
|
this.disconnect(), this.destination = null, this.source = null;
|
|
1717
1760
|
}
|
|
1718
|
-
},
|
|
1761
|
+
}, V = class {
|
|
1719
1762
|
static setParamValue(e, t) {
|
|
1720
1763
|
if (e.setValueAtTime) {
|
|
1721
|
-
let n =
|
|
1764
|
+
let n = B().context;
|
|
1722
1765
|
e.setValueAtTime(t, n.audioContext.currentTime);
|
|
1723
1766
|
} else e.value = t;
|
|
1724
1767
|
return t;
|
|
1725
1768
|
}
|
|
1726
|
-
},
|
|
1769
|
+
}, H = class extends It {
|
|
1727
1770
|
constructor(e = 0, t = 0, n = 0, r = 0, i = 0, a = 0, o = 0, s = 0, c = 0, l = 0) {
|
|
1728
1771
|
let u = [], d = [
|
|
1729
1772
|
{
|
|
1730
|
-
f:
|
|
1773
|
+
f: H.F32,
|
|
1731
1774
|
type: "lowshelf",
|
|
1732
1775
|
gain: e
|
|
1733
1776
|
},
|
|
1734
1777
|
{
|
|
1735
|
-
f:
|
|
1778
|
+
f: H.F64,
|
|
1736
1779
|
type: "peaking",
|
|
1737
1780
|
gain: t
|
|
1738
1781
|
},
|
|
1739
1782
|
{
|
|
1740
|
-
f:
|
|
1783
|
+
f: H.F125,
|
|
1741
1784
|
type: "peaking",
|
|
1742
1785
|
gain: n
|
|
1743
1786
|
},
|
|
1744
1787
|
{
|
|
1745
|
-
f:
|
|
1788
|
+
f: H.F250,
|
|
1746
1789
|
type: "peaking",
|
|
1747
1790
|
gain: r
|
|
1748
1791
|
},
|
|
1749
1792
|
{
|
|
1750
|
-
f:
|
|
1793
|
+
f: H.F500,
|
|
1751
1794
|
type: "peaking",
|
|
1752
1795
|
gain: i
|
|
1753
1796
|
},
|
|
1754
1797
|
{
|
|
1755
|
-
f:
|
|
1798
|
+
f: H.F1K,
|
|
1756
1799
|
type: "peaking",
|
|
1757
1800
|
gain: a
|
|
1758
1801
|
},
|
|
1759
1802
|
{
|
|
1760
|
-
f:
|
|
1803
|
+
f: H.F2K,
|
|
1761
1804
|
type: "peaking",
|
|
1762
1805
|
gain: o
|
|
1763
1806
|
},
|
|
1764
1807
|
{
|
|
1765
|
-
f:
|
|
1808
|
+
f: H.F4K,
|
|
1766
1809
|
type: "peaking",
|
|
1767
1810
|
gain: s
|
|
1768
1811
|
},
|
|
1769
1812
|
{
|
|
1770
|
-
f:
|
|
1813
|
+
f: H.F8K,
|
|
1771
1814
|
type: "peaking",
|
|
1772
1815
|
gain: c
|
|
1773
1816
|
},
|
|
1774
1817
|
{
|
|
1775
|
-
f:
|
|
1818
|
+
f: H.F16K,
|
|
1776
1819
|
type: "highshelf",
|
|
1777
1820
|
gain: l
|
|
1778
1821
|
}
|
|
1779
1822
|
];
|
|
1780
|
-
|
|
1781
|
-
let t =
|
|
1782
|
-
return t.type = e.type,
|
|
1823
|
+
B().useLegacy || (u = d.map((e) => {
|
|
1824
|
+
let t = B().context.audioContext.createBiquadFilter();
|
|
1825
|
+
return t.type = e.type, V.setParamValue(t.Q, 1), t.frequency.value = e.f, V.setParamValue(t.gain, e.gain), t;
|
|
1783
1826
|
})), super(u[0], u[u.length - 1]), this.bands = u, this.bandsMap = {};
|
|
1784
1827
|
for (let e = 0; e < this.bands.length; e++) {
|
|
1785
1828
|
let t = this.bands[e];
|
|
@@ -1788,75 +1831,75 @@ var Pt = class {
|
|
|
1788
1831
|
}
|
|
1789
1832
|
setGain(e, t = 0) {
|
|
1790
1833
|
if (!this.bandsMap[e]) throw Error(`No band found for frequency ${e}`);
|
|
1791
|
-
|
|
1834
|
+
V.setParamValue(this.bandsMap[e].gain, t);
|
|
1792
1835
|
}
|
|
1793
1836
|
getGain(e) {
|
|
1794
1837
|
if (!this.bandsMap[e]) throw Error(`No band found for frequency ${e}`);
|
|
1795
1838
|
return this.bandsMap[e].gain.value;
|
|
1796
1839
|
}
|
|
1797
1840
|
set f32(e) {
|
|
1798
|
-
this.setGain(
|
|
1841
|
+
this.setGain(H.F32, e);
|
|
1799
1842
|
}
|
|
1800
1843
|
get f32() {
|
|
1801
|
-
return this.getGain(
|
|
1844
|
+
return this.getGain(H.F32);
|
|
1802
1845
|
}
|
|
1803
1846
|
set f64(e) {
|
|
1804
|
-
this.setGain(
|
|
1847
|
+
this.setGain(H.F64, e);
|
|
1805
1848
|
}
|
|
1806
1849
|
get f64() {
|
|
1807
|
-
return this.getGain(
|
|
1850
|
+
return this.getGain(H.F64);
|
|
1808
1851
|
}
|
|
1809
1852
|
set f125(e) {
|
|
1810
|
-
this.setGain(
|
|
1853
|
+
this.setGain(H.F125, e);
|
|
1811
1854
|
}
|
|
1812
1855
|
get f125() {
|
|
1813
|
-
return this.getGain(
|
|
1856
|
+
return this.getGain(H.F125);
|
|
1814
1857
|
}
|
|
1815
1858
|
set f250(e) {
|
|
1816
|
-
this.setGain(
|
|
1859
|
+
this.setGain(H.F250, e);
|
|
1817
1860
|
}
|
|
1818
1861
|
get f250() {
|
|
1819
|
-
return this.getGain(
|
|
1862
|
+
return this.getGain(H.F250);
|
|
1820
1863
|
}
|
|
1821
1864
|
set f500(e) {
|
|
1822
|
-
this.setGain(
|
|
1865
|
+
this.setGain(H.F500, e);
|
|
1823
1866
|
}
|
|
1824
1867
|
get f500() {
|
|
1825
|
-
return this.getGain(
|
|
1868
|
+
return this.getGain(H.F500);
|
|
1826
1869
|
}
|
|
1827
1870
|
set f1k(e) {
|
|
1828
|
-
this.setGain(
|
|
1871
|
+
this.setGain(H.F1K, e);
|
|
1829
1872
|
}
|
|
1830
1873
|
get f1k() {
|
|
1831
|
-
return this.getGain(
|
|
1874
|
+
return this.getGain(H.F1K);
|
|
1832
1875
|
}
|
|
1833
1876
|
set f2k(e) {
|
|
1834
|
-
this.setGain(
|
|
1877
|
+
this.setGain(H.F2K, e);
|
|
1835
1878
|
}
|
|
1836
1879
|
get f2k() {
|
|
1837
|
-
return this.getGain(
|
|
1880
|
+
return this.getGain(H.F2K);
|
|
1838
1881
|
}
|
|
1839
1882
|
set f4k(e) {
|
|
1840
|
-
this.setGain(
|
|
1883
|
+
this.setGain(H.F4K, e);
|
|
1841
1884
|
}
|
|
1842
1885
|
get f4k() {
|
|
1843
|
-
return this.getGain(
|
|
1886
|
+
return this.getGain(H.F4K);
|
|
1844
1887
|
}
|
|
1845
1888
|
set f8k(e) {
|
|
1846
|
-
this.setGain(
|
|
1889
|
+
this.setGain(H.F8K, e);
|
|
1847
1890
|
}
|
|
1848
1891
|
get f8k() {
|
|
1849
|
-
return this.getGain(
|
|
1892
|
+
return this.getGain(H.F8K);
|
|
1850
1893
|
}
|
|
1851
1894
|
set f16k(e) {
|
|
1852
|
-
this.setGain(
|
|
1895
|
+
this.setGain(H.F16K, e);
|
|
1853
1896
|
}
|
|
1854
1897
|
get f16k() {
|
|
1855
|
-
return this.getGain(
|
|
1898
|
+
return this.getGain(H.F16K);
|
|
1856
1899
|
}
|
|
1857
1900
|
reset() {
|
|
1858
1901
|
this.bands.forEach((e) => {
|
|
1859
|
-
|
|
1902
|
+
V.setParamValue(e.gain, 0);
|
|
1860
1903
|
});
|
|
1861
1904
|
}
|
|
1862
1905
|
destroy() {
|
|
@@ -1864,11 +1907,11 @@ var Pt = class {
|
|
|
1864
1907
|
e.disconnect();
|
|
1865
1908
|
}), this.bands = null, this.bandsMap = null;
|
|
1866
1909
|
}
|
|
1867
|
-
},
|
|
1868
|
-
|
|
1910
|
+
}, U = H;
|
|
1911
|
+
U.F32 = 32, U.F64 = 64, U.F125 = 125, U.F250 = 250, U.F500 = 500, U.F1K = 1e3, U.F2K = 2e3, U.F4K = 4e3, U.F8K = 8e3, U.F16K = 16e3;
|
|
1869
1912
|
//#endregion
|
|
1870
|
-
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.
|
|
1871
|
-
var
|
|
1913
|
+
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.22.0/node_modules/@pixi/sound/lib/htmlaudio/HTMLAudioContext.mjs
|
|
1914
|
+
var Lt = class extends i {
|
|
1872
1915
|
constructor() {
|
|
1873
1916
|
super(...arguments), this.speed = 1, this.muted = !1, this.volume = 1, this.paused = !1;
|
|
1874
1917
|
}
|
|
@@ -1896,9 +1939,9 @@ var Ft = class extends i {
|
|
|
1896
1939
|
destroy() {
|
|
1897
1940
|
this.removeAllListeners();
|
|
1898
1941
|
}
|
|
1899
|
-
},
|
|
1942
|
+
}, Rt = 0, zt = class extends i {
|
|
1900
1943
|
constructor(e) {
|
|
1901
|
-
super(), this.id =
|
|
1944
|
+
super(), this.id = Rt++, this.init(e);
|
|
1902
1945
|
}
|
|
1903
1946
|
set(e, t) {
|
|
1904
1947
|
if (this[e] === void 0) throw Error(`Property with name ${e} does not exist.`);
|
|
@@ -1996,7 +2039,7 @@ var Ft = class extends i {
|
|
|
1996
2039
|
}
|
|
1997
2040
|
play(e) {
|
|
1998
2041
|
let { start: t, end: n, speed: r, loop: i, volume: a, muted: o } = e;
|
|
1999
|
-
n && console.assert(n > t, "End time is before start time"), this._speed = r, this._volume = a, this._loop = !!i, this._muted = o, this.refresh(), this.loop && n !== null && (console.warn("Looping not support when specifying an \"end\" time"), this.loop = !1), this._start = t, this._end = n || this._duration, this._start = Math.max(0, this._start -
|
|
2042
|
+
n && console.assert(n > t, "End time is before start time"), this._speed = r, this._volume = a, this._loop = !!i, this._muted = o, this.refresh(), this.loop && n !== null && (console.warn("Looping not support when specifying an \"end\" time"), this.loop = !1), this._start = t, this._end = n || this._duration, this._start = Math.max(0, this._start - zt.PADDING), this._end = Math.min(this._end + zt.PADDING, this._duration), this._source.onloadedmetadata = () => {
|
|
2000
2043
|
this._source && (this._source.currentTime = t, this._source.onloadedmetadata = null, this.emit("progress", t / this._duration, this._duration), d.shared.add(this._onUpdate, this));
|
|
2001
2044
|
}, this._source.onended = this._onComplete.bind(this), this._source.play(), this.emit("start");
|
|
2002
2045
|
}
|
|
@@ -2014,16 +2057,16 @@ var Ft = class extends i {
|
|
|
2014
2057
|
toString() {
|
|
2015
2058
|
return `[HTMLAudioInstance id=${this.id}]`;
|
|
2016
2059
|
}
|
|
2017
|
-
},
|
|
2018
|
-
|
|
2060
|
+
}, Bt = zt;
|
|
2061
|
+
Bt.PADDING = .1;
|
|
2019
2062
|
//#endregion
|
|
2020
|
-
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.
|
|
2021
|
-
var
|
|
2063
|
+
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.22.0/node_modules/@pixi/sound/lib/htmlaudio/HTMLAudioMedia.mjs
|
|
2064
|
+
var Vt = class extends i {
|
|
2022
2065
|
init(e) {
|
|
2023
2066
|
this.parent = e, this._source = e.options.source || new Audio(), e.url && (this._source.src = e.url);
|
|
2024
2067
|
}
|
|
2025
2068
|
create() {
|
|
2026
|
-
return new
|
|
2069
|
+
return new Bt(this);
|
|
2027
2070
|
}
|
|
2028
2071
|
get isPlayable() {
|
|
2029
2072
|
return !!this._source && this._source.readyState === 4;
|
|
@@ -2076,7 +2119,7 @@ var zt = class extends i {
|
|
|
2076
2119
|
};
|
|
2077
2120
|
t.addEventListener("canplaythrough", r, !1), t.addEventListener("load", r, !1), t.addEventListener("abort", i, !1), t.addEventListener("error", a, !1), t.load();
|
|
2078
2121
|
}
|
|
2079
|
-
},
|
|
2122
|
+
}, Ht = class {
|
|
2080
2123
|
constructor(e, t) {
|
|
2081
2124
|
this.parent = e, Object.assign(this, t), this.duration = this.end - this.start, console.assert(this.duration > 0, "End time must be after start time");
|
|
2082
2125
|
}
|
|
@@ -2092,7 +2135,7 @@ var zt = class extends i {
|
|
|
2092
2135
|
destroy() {
|
|
2093
2136
|
this.parent = null;
|
|
2094
2137
|
}
|
|
2095
|
-
},
|
|
2138
|
+
}, W = [
|
|
2096
2139
|
"ogg",
|
|
2097
2140
|
"oga",
|
|
2098
2141
|
"opus",
|
|
@@ -2104,8 +2147,8 @@ var zt = class extends i {
|
|
|
2104
2147
|
"wma",
|
|
2105
2148
|
"mid",
|
|
2106
2149
|
"caf"
|
|
2107
|
-
],
|
|
2108
|
-
function
|
|
2150
|
+
], Ut = ["audio/mpeg", "audio/ogg"], G = {};
|
|
2151
|
+
function Wt(e) {
|
|
2109
2152
|
let t = {
|
|
2110
2153
|
m4a: "audio/mp4",
|
|
2111
2154
|
oga: "audio/ogg",
|
|
@@ -2113,17 +2156,17 @@ function Ht(e) {
|
|
|
2113
2156
|
caf: "audio/x-caf; codecs=\"opus\"",
|
|
2114
2157
|
...e || {}
|
|
2115
2158
|
}, n = document.createElement("audio"), r = {}, i = /^no$/;
|
|
2116
|
-
|
|
2159
|
+
W.forEach((e) => {
|
|
2117
2160
|
let a = n.canPlayType(`audio/${e}`).replace(i, ""), o = t[e] ? n.canPlayType(t[e]).replace(i, "") : "";
|
|
2118
2161
|
r[e] = !!a || !!o;
|
|
2119
|
-
}), Object.assign(
|
|
2162
|
+
}), Object.assign(G, r);
|
|
2120
2163
|
}
|
|
2121
|
-
|
|
2164
|
+
Wt();
|
|
2122
2165
|
//#endregion
|
|
2123
|
-
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.
|
|
2124
|
-
var
|
|
2166
|
+
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.22.0/node_modules/@pixi/sound/lib/webaudio/WebAudioInstance.mjs
|
|
2167
|
+
var Gt = 0, Kt = class extends i {
|
|
2125
2168
|
constructor(e) {
|
|
2126
|
-
super(), this.id =
|
|
2169
|
+
super(), this.id = Gt++, this._media = null, this._paused = !1, this._muted = !1, this._elapsed = 0, this.init(e);
|
|
2127
2170
|
}
|
|
2128
2171
|
set(e, t) {
|
|
2129
2172
|
if (this[e] === void 0) throw Error(`Property with name ${e} does not exist.`);
|
|
@@ -2184,7 +2227,7 @@ var Ut = 0, Wt = class extends i {
|
|
|
2184
2227
|
let e = this._media.context, t = this._media.parent;
|
|
2185
2228
|
this._source.loop = this._loop || t.loop;
|
|
2186
2229
|
let n = e.volume * +!e.muted, r = t.volume * +!t.muted, i = this._volume * +!this._muted;
|
|
2187
|
-
|
|
2230
|
+
V.setParamValue(this._gain.gain, i * r * n), V.setParamValue(this._source.playbackRate, this._speed * t.speed * e.speed), this.applyFilters();
|
|
2188
2231
|
}
|
|
2189
2232
|
applyFilters() {
|
|
2190
2233
|
if (this._filters?.length) {
|
|
@@ -2275,7 +2318,7 @@ var Ut = 0, Wt = class extends i {
|
|
|
2275
2318
|
}
|
|
2276
2319
|
this._source = null, this._progress = 1, this.emit("progress", 1, this._duration), this.emit("end", this);
|
|
2277
2320
|
}
|
|
2278
|
-
},
|
|
2321
|
+
}, qt = class {
|
|
2279
2322
|
constructor(e, t) {
|
|
2280
2323
|
this._output = t, this._input = e;
|
|
2281
2324
|
}
|
|
@@ -2299,20 +2342,20 @@ var Ut = 0, Wt = class extends i {
|
|
|
2299
2342
|
destroy() {
|
|
2300
2343
|
this.filters = null, this._input = null, this._output = null;
|
|
2301
2344
|
}
|
|
2302
|
-
},
|
|
2345
|
+
}, Jt = class extends qt {
|
|
2303
2346
|
constructor(e) {
|
|
2304
2347
|
let t = e.audioContext, n = t.createBufferSource(), r = t.createGain(), i = t.createAnalyser();
|
|
2305
2348
|
n.connect(i), i.connect(r), r.connect(e.destination), super(i, r), this.context = e, this.bufferSource = n, this.gain = r, this.analyser = i;
|
|
2306
2349
|
}
|
|
2307
2350
|
get script() {
|
|
2308
|
-
return this._script || (this._script = this.context.audioContext.createScriptProcessor(
|
|
2351
|
+
return this._script || (this._script = this.context.audioContext.createScriptProcessor(Jt.BUFFER_SIZE), this._script.connect(this.context.destination)), this._script;
|
|
2309
2352
|
}
|
|
2310
2353
|
destroy() {
|
|
2311
2354
|
super.destroy(), this.bufferSource.disconnect(), this._script && this._script.disconnect(), this.gain.disconnect(), this.analyser.disconnect(), this.bufferSource = null, this._script = null, this.gain = null, this.analyser = null, this.context = null;
|
|
2312
2355
|
}
|
|
2313
2356
|
cloneBufferSource() {
|
|
2314
2357
|
let e = this.bufferSource, t = this.context.audioContext.createBufferSource();
|
|
2315
|
-
t.buffer = e.buffer,
|
|
2358
|
+
t.buffer = e.buffer, V.setParamValue(t.playbackRate, e.playbackRate.value), t.loop = e.loop;
|
|
2316
2359
|
let n = this.context.audioContext.createGain();
|
|
2317
2360
|
return t.connect(n), n.connect(this.destination), {
|
|
2318
2361
|
source: t,
|
|
@@ -2322,13 +2365,13 @@ var Ut = 0, Wt = class extends i {
|
|
|
2322
2365
|
get bufferSize() {
|
|
2323
2366
|
return this.script.bufferSize;
|
|
2324
2367
|
}
|
|
2325
|
-
},
|
|
2326
|
-
|
|
2368
|
+
}, Yt = Jt;
|
|
2369
|
+
Yt.BUFFER_SIZE = 0;
|
|
2327
2370
|
//#endregion
|
|
2328
|
-
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.
|
|
2329
|
-
var
|
|
2371
|
+
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.22.0/node_modules/@pixi/sound/lib/webaudio/WebAudioMedia.mjs
|
|
2372
|
+
var Xt = class {
|
|
2330
2373
|
init(e) {
|
|
2331
|
-
this.parent = e, this._nodes = new
|
|
2374
|
+
this.parent = e, this._nodes = new Yt(this.context), this._source = this._nodes.bufferSource, this.source = e.options.source;
|
|
2332
2375
|
}
|
|
2333
2376
|
destroy() {
|
|
2334
2377
|
this.parent = null, this._nodes.destroy(), this._nodes = null;
|
|
@@ -2340,7 +2383,7 @@ var Jt = class {
|
|
|
2340
2383
|
this._source = null, this.source = null;
|
|
2341
2384
|
}
|
|
2342
2385
|
create() {
|
|
2343
|
-
return new
|
|
2386
|
+
return new Kt(this);
|
|
2344
2387
|
}
|
|
2345
2388
|
get context() {
|
|
2346
2389
|
return this.parent.context;
|
|
@@ -2384,7 +2427,7 @@ var Jt = class {
|
|
|
2384
2427
|
};
|
|
2385
2428
|
e instanceof AudioBuffer ? n(null, e) : this.parent.context.decode(e, n);
|
|
2386
2429
|
}
|
|
2387
|
-
},
|
|
2430
|
+
}, K = class {
|
|
2388
2431
|
static from(e) {
|
|
2389
2432
|
let t = {};
|
|
2390
2433
|
return typeof e == "string" ? t.url = e : e instanceof ArrayBuffer || e instanceof AudioBuffer || e instanceof HTMLAudioElement ? t.source = e : Array.isArray(e) ? t.url = e : t = e, t = {
|
|
@@ -2399,7 +2442,7 @@ var Jt = class {
|
|
|
2399
2442
|
loaded: null,
|
|
2400
2443
|
loop: !1,
|
|
2401
2444
|
...t
|
|
2402
|
-
}, Object.freeze(t), new
|
|
2445
|
+
}, Object.freeze(t), new K(B().useLegacy ? new Vt() : new Xt(), t);
|
|
2403
2446
|
}
|
|
2404
2447
|
constructor(e, t) {
|
|
2405
2448
|
this.media = e, this.options = t, this._instances = [], this._sprites = {}, this.media.init(this);
|
|
@@ -2410,12 +2453,12 @@ var Jt = class {
|
|
|
2410
2453
|
let [t] = e.map((e) => ({
|
|
2411
2454
|
url: e,
|
|
2412
2455
|
ext: f.extname(e).slice(1)
|
|
2413
|
-
})).filter(({ ext: e }) =>
|
|
2456
|
+
})).filter(({ ext: e }) => G[e]).sort((e, t) => W.indexOf(e.ext) - W.indexOf(t.ext));
|
|
2414
2457
|
if (!t) throw Error("No supported file type found");
|
|
2415
2458
|
return t.url;
|
|
2416
2459
|
}
|
|
2417
2460
|
get context() {
|
|
2418
|
-
return
|
|
2461
|
+
return B().context;
|
|
2419
2462
|
}
|
|
2420
2463
|
pause() {
|
|
2421
2464
|
return this.isPlaying = !1, this.paused = !0, this;
|
|
@@ -2448,7 +2491,7 @@ var Jt = class {
|
|
|
2448
2491
|
return t;
|
|
2449
2492
|
}
|
|
2450
2493
|
console.assert(!this._sprites[e], `Alias ${e} is already taken`);
|
|
2451
|
-
let n = new
|
|
2494
|
+
let n = new Ht(this, t);
|
|
2452
2495
|
return this._sprites[e] = n, n;
|
|
2453
2496
|
}
|
|
2454
2497
|
destroy() {
|
|
@@ -2564,20 +2607,20 @@ var Jt = class {
|
|
|
2564
2607
|
this._poolInstance(e);
|
|
2565
2608
|
}
|
|
2566
2609
|
_createInstance() {
|
|
2567
|
-
if (
|
|
2568
|
-
let e =
|
|
2610
|
+
if (K._pool.length > 0) {
|
|
2611
|
+
let e = K._pool.pop();
|
|
2569
2612
|
return e.init(this.media), e;
|
|
2570
2613
|
}
|
|
2571
2614
|
return this.media.create();
|
|
2572
2615
|
}
|
|
2573
2616
|
_poolInstance(e) {
|
|
2574
|
-
e.destroy(),
|
|
2617
|
+
e.destroy(), K._pool.indexOf(e) < 0 && K._pool.push(e);
|
|
2575
2618
|
}
|
|
2576
|
-
},
|
|
2577
|
-
|
|
2619
|
+
}, q = K;
|
|
2620
|
+
q._pool = [];
|
|
2578
2621
|
//#endregion
|
|
2579
|
-
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.
|
|
2580
|
-
var
|
|
2622
|
+
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.22.0/node_modules/@pixi/sound/lib/webaudio/WebAudioContext.mjs
|
|
2623
|
+
var Zt = class e extends qt {
|
|
2581
2624
|
constructor() {
|
|
2582
2625
|
let t = window, n = new e.AudioContext(), r = n.createDynamicsCompressor(), a = n.createAnalyser();
|
|
2583
2626
|
a.connect(r), r.connect(n.destination), super(a, r), this.autoPause = !0, this._ctx = n, this._offlineCtx = new e.OfflineAudioContext(1, 2, t.OfflineAudioContext ? Math.max(8e3, Math.min(96e3, n.sampleRate)) : 44100), this.compressor = r, this.analyser = a, this.events = new i(), this.volume = 1, this.speed = 1, this.muted = !1, this.paused = !1, this._locked = n.state === "suspended" && ("ontouchstart" in globalThis || "onclick" in globalThis), this._locked && (this._unlock(), this._unlock = this._unlock.bind(this), document.addEventListener("mousedown", this._unlock, !0), document.addEventListener("touchstart", this._unlock, !0), document.addEventListener("touchend", this._unlock, !0)), this.onFocus = this.onFocus.bind(this), this.onBlur = this.onBlur.bind(this), globalThis.addEventListener("focus", this.onFocus), globalThis.addEventListener("blur", this.onBlur);
|
|
@@ -2642,12 +2685,12 @@ var Yt = class e extends Gt {
|
|
|
2642
2685
|
}, n);
|
|
2643
2686
|
r && r.catch(n);
|
|
2644
2687
|
}
|
|
2645
|
-
},
|
|
2688
|
+
}, Qt = class {
|
|
2646
2689
|
constructor() {
|
|
2647
2690
|
this.init();
|
|
2648
2691
|
}
|
|
2649
2692
|
init() {
|
|
2650
|
-
return this.supported && (this._webAudioContext = new
|
|
2693
|
+
return this.supported && (this._webAudioContext = new Zt()), this._htmlAudioContext = new Lt(), this._sounds = {}, this.useLegacy = !this.supported, this;
|
|
2651
2694
|
}
|
|
2652
2695
|
get context() {
|
|
2653
2696
|
return this._context;
|
|
@@ -2659,7 +2702,7 @@ var Yt = class e extends Gt {
|
|
|
2659
2702
|
this.useLegacy || (this._context.filters = e);
|
|
2660
2703
|
}
|
|
2661
2704
|
get supported() {
|
|
2662
|
-
return
|
|
2705
|
+
return Zt.AudioContext !== null;
|
|
2663
2706
|
}
|
|
2664
2707
|
add(e, t) {
|
|
2665
2708
|
if (typeof e == "object") {
|
|
@@ -2670,8 +2713,8 @@ var Yt = class e extends Gt {
|
|
|
2670
2713
|
}
|
|
2671
2714
|
return n;
|
|
2672
2715
|
}
|
|
2673
|
-
if (console.assert(!this._sounds[e], `Sound with alias ${e} already exists.`), t instanceof
|
|
2674
|
-
let n = this._getOptions(t), r =
|
|
2716
|
+
if (console.assert(!this._sounds[e], `Sound with alias ${e} already exists.`), t instanceof q) return this._sounds[e] = t, t;
|
|
2717
|
+
let n = this._getOptions(t), r = q.from(n);
|
|
2675
2718
|
return this._sounds[e] = r, r;
|
|
2676
2719
|
}
|
|
2677
2720
|
_getOptions(e, t) {
|
|
@@ -2771,14 +2814,14 @@ var Yt = class e extends Gt {
|
|
|
2771
2814
|
close() {
|
|
2772
2815
|
return this.removeAll(), this._sounds = null, this._webAudioContext &&= (this._webAudioContext.destroy(), null), this._htmlAudioContext &&= (this._htmlAudioContext.destroy(), null), this._context = null, this;
|
|
2773
2816
|
}
|
|
2774
|
-
},
|
|
2817
|
+
}, $t = (e) => {
|
|
2775
2818
|
let t = e.src, n = e?.alias?.[0];
|
|
2776
2819
|
return (!n || e.src === n) && (n = f.basename(t, f.extname(t))), n;
|
|
2777
|
-
},
|
|
2820
|
+
}, en = {
|
|
2778
2821
|
extension: a.Asset,
|
|
2779
2822
|
detection: {
|
|
2780
2823
|
test: async () => !0,
|
|
2781
|
-
add: async (e) => [...e, ...
|
|
2824
|
+
add: async (e) => [...e, ...W.filter((e) => G[e])],
|
|
2782
2825
|
remove: async (e) => e.filter((t) => e.includes(t))
|
|
2783
2826
|
},
|
|
2784
2827
|
loader: {
|
|
@@ -2788,10 +2831,10 @@ var Yt = class e extends Gt {
|
|
|
2788
2831
|
priority: s.High
|
|
2789
2832
|
},
|
|
2790
2833
|
test(e) {
|
|
2791
|
-
return !!
|
|
2834
|
+
return !!G[f.extname(e).slice(1)] || Ut.some((t) => e.startsWith(`data:${t}`));
|
|
2792
2835
|
},
|
|
2793
2836
|
async load(e, t) {
|
|
2794
|
-
let n = await new Promise((n, r) =>
|
|
2837
|
+
let n = await new Promise((n, r) => q.from({
|
|
2795
2838
|
...t.data,
|
|
2796
2839
|
url: e,
|
|
2797
2840
|
preload: !0,
|
|
@@ -2799,20 +2842,20 @@ var Yt = class e extends Gt {
|
|
|
2799
2842
|
e ? r(e) : n(i), t.data?.loaded?.(e, i);
|
|
2800
2843
|
}
|
|
2801
2844
|
}));
|
|
2802
|
-
return
|
|
2845
|
+
return B().add($t(t), n), n;
|
|
2803
2846
|
},
|
|
2804
2847
|
async unload(e, t) {
|
|
2805
|
-
|
|
2848
|
+
B().remove($t(t));
|
|
2806
2849
|
}
|
|
2807
2850
|
}
|
|
2808
2851
|
};
|
|
2809
|
-
ee.add(
|
|
2852
|
+
ee.add(en);
|
|
2810
2853
|
//#endregion
|
|
2811
|
-
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.
|
|
2812
|
-
var
|
|
2854
|
+
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.22.0/node_modules/@pixi/sound/lib/index.mjs
|
|
2855
|
+
var J = Ft(new Qt());
|
|
2813
2856
|
//#endregion
|
|
2814
2857
|
//#region src/plugins/audio/AudioManagerPlugin.ts
|
|
2815
|
-
|
|
2858
|
+
J.add = function(e, t) {
|
|
2816
2859
|
if (typeof e == "object") {
|
|
2817
2860
|
let n = {};
|
|
2818
2861
|
for (let r in e) {
|
|
@@ -2821,16 +2864,16 @@ Y.add = function(e, t) {
|
|
|
2821
2864
|
}
|
|
2822
2865
|
return n;
|
|
2823
2866
|
}
|
|
2824
|
-
if (t instanceof
|
|
2825
|
-
let n = this._getOptions(t), r =
|
|
2867
|
+
if (t instanceof q) return this._sounds[e] = t, t;
|
|
2868
|
+
let n = this._getOptions(t), r = q.from(n);
|
|
2826
2869
|
return this._sounds[e] = r, r;
|
|
2827
2870
|
};
|
|
2828
|
-
var
|
|
2871
|
+
var tn = class extends N {
|
|
2829
2872
|
constructor(e = "audio") {
|
|
2830
2873
|
super(e), this.onSoundStarted = new j(), this.onSoundEnded = new j(), this.onMuted = new j(), this.onMasterVolumeChanged = new j(), this.onChannelVolumeChanged = new j(), this.onChannelMuted = new j(), this._storedVolume = void 0, this._paused = !1, this._idMap = /* @__PURE__ */ new Map(), this._masterVolume = 1, this._muted = !1, this._channels = /* @__PURE__ */ new Map(), this.createChannel("music"), this.createChannel("sfx"), this.createChannel("voiceover");
|
|
2831
2874
|
}
|
|
2832
2875
|
get audioContext() {
|
|
2833
|
-
return
|
|
2876
|
+
return J.context?.audioContext;
|
|
2834
2877
|
}
|
|
2835
2878
|
get masterVolume() {
|
|
2836
2879
|
return this._masterVolume;
|
|
@@ -2865,11 +2908,11 @@ var $t = class extends N {
|
|
|
2865
2908
|
}), this._channels.clear(), this.onSoundStarted.disconnectAll(), this.onSoundEnded.disconnectAll(), this.onMuted.disconnectAll(), this.onMasterVolumeChanged.disconnectAll(), this.onChannelVolumeChanged.disconnectAll(), this.onChannelMuted.disconnectAll(), super.destroy();
|
|
2866
2909
|
}
|
|
2867
2910
|
initialize(e, t) {
|
|
2868
|
-
return
|
|
2911
|
+
return J.disableAutoPause = !0, typeof t?.manifest == "object" && this.addAllFromManifest(t.manifest), Promise.resolve();
|
|
2869
2912
|
}
|
|
2870
2913
|
createChannel(e) {
|
|
2871
2914
|
if (this._channels.has(e)) throw Error(`Channel with name ${e} already exists.`);
|
|
2872
|
-
let t = new
|
|
2915
|
+
let t = new Mt(e, this);
|
|
2873
2916
|
this._channels.set(e, t);
|
|
2874
2917
|
}
|
|
2875
2918
|
setChannelVolume(e, t) {
|
|
@@ -2919,8 +2962,8 @@ var $t = class extends N {
|
|
|
2919
2962
|
if (Array.isArray(e.alias) || (t = [e.alias]), !t) return;
|
|
2920
2963
|
let n = {}, r = !1;
|
|
2921
2964
|
t.forEach((t) => {
|
|
2922
|
-
t === void 0 ||
|
|
2923
|
-
}), r &&
|
|
2965
|
+
t === void 0 || J.exists(t) || (n[t] = e.src, r = !0);
|
|
2966
|
+
}), r && J.add(n);
|
|
2924
2967
|
}
|
|
2925
2968
|
isPlaying(e, t) {
|
|
2926
2969
|
let n = this._channels.get(t);
|
|
@@ -2934,15 +2977,15 @@ var $t = class extends N {
|
|
|
2934
2977
|
let n = e?.destination;
|
|
2935
2978
|
return !n?.context || n.context === t;
|
|
2936
2979
|
});
|
|
2937
|
-
return n.length !== e.length &&
|
|
2980
|
+
return n.length !== e.length && S.error("AudioManager: ignoring filter(s) built on a different AudioContext — playing dry. Build filter nodes on `app.audio.audioContext` (an app bundling its own copy of @pixi/sound gets a separate context)."), n.length ? n : void 0;
|
|
2938
2981
|
}
|
|
2939
2982
|
async play(e, t = "sfx", n) {
|
|
2940
2983
|
this._idMap.has(e) && (e = this._idMap.get(e));
|
|
2941
2984
|
let r = this._channels.get(t);
|
|
2942
2985
|
if (r) {
|
|
2943
2986
|
e = this._verifySoundId(e);
|
|
2944
|
-
let i = r.add(e, new
|
|
2945
|
-
return i.media = await
|
|
2987
|
+
let i = r.add(e, new Nt(e, r, this)), a = (n?.volume ?? 1) * r.volume * this.masterVolume;
|
|
2988
|
+
return i.media = await J.play(e, {
|
|
2946
2989
|
...n,
|
|
2947
2990
|
filters: this._usableFilters(n?.filters),
|
|
2948
2991
|
volume: r.muted ? 0 : a,
|
|
@@ -2963,7 +3006,7 @@ var $t = class extends N {
|
|
|
2963
3006
|
}
|
|
2964
3007
|
async fadeIn(e, t = "music", n) {
|
|
2965
3008
|
let r = this._channels.get(t);
|
|
2966
|
-
r && (e = this._verifySoundId(e)), r?.get(e) || await this.play(e, t, { volume: 0 }), n?.volume === 0 &&
|
|
3009
|
+
r && (e = this._verifySoundId(e)), r?.get(e) || await this.play(e, t, { volume: 0 }), n?.volume === 0 && S.warn("fadeIn volume is 0", e, t, n);
|
|
2967
3010
|
let i = Object.assign({
|
|
2968
3011
|
volume: n?.volume ?? 1,
|
|
2969
3012
|
duration: 1,
|
|
@@ -2972,7 +3015,7 @@ var $t = class extends N {
|
|
|
2972
3015
|
return this.fade(e, t, i);
|
|
2973
3016
|
}
|
|
2974
3017
|
async fadeOut(e, t = "music", n = { volume: 0 }) {
|
|
2975
|
-
n ||= {}, n?.volume === void 0 && (n.volume = 0), n?.volume > 0 &&
|
|
3018
|
+
n ||= {}, n?.volume === void 0 && (n.volume = 0), n?.volume > 0 && S.warn("fadeOut volume should probably be 0", e, t, n);
|
|
2976
3019
|
let r = Object.assign({
|
|
2977
3020
|
volume: 0,
|
|
2978
3021
|
duration: 1,
|
|
@@ -3000,7 +3043,7 @@ var $t = class extends N {
|
|
|
3000
3043
|
return null;
|
|
3001
3044
|
}
|
|
3002
3045
|
async restore() {
|
|
3003
|
-
let e =
|
|
3046
|
+
let e = J?.context?.audioContext;
|
|
3004
3047
|
e && await e.resume(), this.resume(), this._storedVolume !== void 0 && (this.masterVolume = this._storedVolume), this._channels.forEach((e) => {
|
|
3005
3048
|
e.restore();
|
|
3006
3049
|
}), this.muted = this._muted;
|
|
@@ -3020,12 +3063,12 @@ var $t = class extends N {
|
|
|
3020
3063
|
let e = this._channels.get(t);
|
|
3021
3064
|
if (e) {
|
|
3022
3065
|
r = this._verifySoundId(r);
|
|
3023
|
-
let t =
|
|
3066
|
+
let t = J.find(r);
|
|
3024
3067
|
t.options = {
|
|
3025
3068
|
...n,
|
|
3026
3069
|
autoPlay: !1
|
|
3027
3070
|
};
|
|
3028
|
-
let i = e.add(r, new
|
|
3071
|
+
let i = e.add(r, new Nt(r, e, this));
|
|
3029
3072
|
i.media = t.instances[0], i.pause();
|
|
3030
3073
|
} else throw Error(`Channel ${t} does not exist.`);
|
|
3031
3074
|
}
|
|
@@ -3047,7 +3090,7 @@ var $t = class extends N {
|
|
|
3047
3090
|
});
|
|
3048
3091
|
}
|
|
3049
3092
|
});
|
|
3050
|
-
} else
|
|
3093
|
+
} else J.stopAll();
|
|
3051
3094
|
}
|
|
3052
3095
|
getCoreSignals() {
|
|
3053
3096
|
return [
|
|
@@ -3062,9 +3105,9 @@ var $t = class extends N {
|
|
|
3062
3105
|
_verifySoundId(e) {
|
|
3063
3106
|
let n = e;
|
|
3064
3107
|
if (this._idMap.has(e)) return this._idMap.get(e);
|
|
3065
|
-
if (!
|
|
3066
|
-
else if (
|
|
3067
|
-
else if (
|
|
3108
|
+
if (!J.exists(e)) if (J.exists(e + ".mp3")) e += ".mp3";
|
|
3109
|
+
else if (J.exists(e + ".ogg")) e += ".ogg";
|
|
3110
|
+
else if (J.exists(e + ".wav")) e += ".wav";
|
|
3068
3111
|
else {
|
|
3069
3112
|
e = n;
|
|
3070
3113
|
let r = t.get(e);
|
|
@@ -3098,10 +3141,10 @@ var $t = class extends N {
|
|
|
3098
3141
|
}
|
|
3099
3142
|
}
|
|
3100
3143
|
_setMuted() {
|
|
3101
|
-
this._muted ?
|
|
3144
|
+
this._muted ? J.muteAll() : J.unmuteAll(), this.onMuted.emit(this._muted);
|
|
3102
3145
|
}
|
|
3103
3146
|
_setPaused() {
|
|
3104
|
-
this._paused ?
|
|
3147
|
+
this._paused ? J.pauseAll() : J.resumeAll();
|
|
3105
3148
|
}
|
|
3106
3149
|
_setChannelVolume(e, t) {
|
|
3107
3150
|
let n = this._channels.get(e);
|
|
@@ -3122,9 +3165,9 @@ var $t = class extends N {
|
|
|
3122
3165
|
channelName: n
|
|
3123
3166
|
});
|
|
3124
3167
|
}
|
|
3125
|
-
},
|
|
3168
|
+
}, nn = class extends n {
|
|
3126
3169
|
constructor(e) {
|
|
3127
|
-
super(),
|
|
3170
|
+
super(), g(this), this._config = {
|
|
3128
3171
|
color: 65535,
|
|
3129
3172
|
shape: "rounded rectangle",
|
|
3130
3173
|
radius: 8,
|
|
@@ -3146,10 +3189,10 @@ var $t = class extends N {
|
|
|
3146
3189
|
this.clear(), this._graphics.destroy(), super.destroy(e);
|
|
3147
3190
|
}
|
|
3148
3191
|
setFocusTarget(e) {
|
|
3149
|
-
e && (this.focusTarget = e, this.focusBounds = this.focusTarget.getFocusArea().clone(),
|
|
3192
|
+
e && (this.focusTarget = e, this.focusBounds = this.focusTarget.getFocusArea().clone(), Q.getInstance().ticker.add(this.updatePosition));
|
|
3150
3193
|
}
|
|
3151
3194
|
clearFocusTarget() {
|
|
3152
|
-
this.focusTarget = null,
|
|
3195
|
+
this.focusTarget = null, Q.getInstance().ticker.remove(this.updatePosition);
|
|
3153
3196
|
}
|
|
3154
3197
|
updatePosition() {
|
|
3155
3198
|
if (!this.focusTarget || !this.parent) return;
|
|
@@ -3160,12 +3203,12 @@ var $t = class extends N {
|
|
|
3160
3203
|
} else e = this.parent.toLocal(this.focusTarget.getGlobalPosition());
|
|
3161
3204
|
let t = this.focusTarget.getFocusPosition();
|
|
3162
3205
|
if (t) {
|
|
3163
|
-
let n =
|
|
3206
|
+
let n = Ke(t);
|
|
3164
3207
|
e.x += n.x, e.y += n.y;
|
|
3165
3208
|
}
|
|
3166
3209
|
this.position.set(e.x, e.y);
|
|
3167
3210
|
}
|
|
3168
|
-
},
|
|
3211
|
+
}, rn = class {
|
|
3169
3212
|
constructor(e) {
|
|
3170
3213
|
this.id = e, this.currentFocusable = null, this.lastFocusable = null, this.defaultFocusable = null, this._focusables = [], this._currentIndex = 0, this._current = !1;
|
|
3171
3214
|
}
|
|
@@ -3209,7 +3252,7 @@ var $t = class extends N {
|
|
|
3209
3252
|
prev() {
|
|
3210
3253
|
return --this._currentIndex, this._currentIndex < 0 && (this._currentIndex = this._focusables.length - 1), this.currentFocusable = this._focusables[this._currentIndex], this.availableFocusables.length === 0 ? null : this.currentFocusable.focusEnabled ? this.currentFocusable : this.prev();
|
|
3211
3254
|
}
|
|
3212
|
-
},
|
|
3255
|
+
}, an = class extends N {
|
|
3213
3256
|
constructor(...e) {
|
|
3214
3257
|
super(...e), this.id = "focus", this.view = new n({ label: "FocusManager" }), this.onFocusManagerActivated = new j(), this.onFocusManagerDeactivated = new j(), this.onFocusLayerChange = new j(), this.onFocusChange = new j(), this._focusTarget = null, this._keyboardActive = !1, this._layers = /* @__PURE__ */ new Map(), this._currentLayerId = null, this._active = !1, this._enabled = !0;
|
|
3215
3258
|
}
|
|
@@ -3238,9 +3281,9 @@ var $t = class extends N {
|
|
|
3238
3281
|
this._getCurrentLayer()?.sortFocusablesByPosition();
|
|
3239
3282
|
}
|
|
3240
3283
|
initialize(e, t) {
|
|
3241
|
-
|
|
3284
|
+
ge(this, "removeAllFocusLayers", "_handleGlobalMouseMove", "_handleGlobalPointerDown");
|
|
3242
3285
|
let n = t.config?.focus || {};
|
|
3243
|
-
n.usePixiAccessibility = n.usePixiAccessibility ?? !1, this._focusOutliner = typeof n?.outliner == "function" ? new n.outliner() : new
|
|
3286
|
+
n.usePixiAccessibility = n.usePixiAccessibility ?? !1, this._focusOutliner = typeof n?.outliner == "function" ? new n.outliner() : new nn(n.outliner), this._options = n, this.view.addChild(this._focusOutliner), this._updatePixiAccessibility(), this._setupKeyboardListeners(), this._setupAppListeners();
|
|
3244
3287
|
}
|
|
3245
3288
|
destroy() {
|
|
3246
3289
|
this._removeGlobalListeners(), this.deactivate(), this._focusOutliner.destroy(), this._layers.clear(), super.destroy();
|
|
@@ -3255,7 +3298,7 @@ var $t = class extends N {
|
|
|
3255
3298
|
(t === void 0 || t == null) && (t = this._currentLayerId ?? null);
|
|
3256
3299
|
let r = this._layers.get(t);
|
|
3257
3300
|
if (!r) {
|
|
3258
|
-
|
|
3301
|
+
S.error(`Layer with ID ${t} does not exist.`);
|
|
3259
3302
|
return;
|
|
3260
3303
|
}
|
|
3261
3304
|
Array.isArray(e) || (e = [e]), e.forEach((e, t) => {
|
|
@@ -3282,12 +3325,12 @@ var $t = class extends N {
|
|
|
3282
3325
|
addFocusLayer(e, t = !0, n) {
|
|
3283
3326
|
e === void 0 && (e = this._layers.size);
|
|
3284
3327
|
let r;
|
|
3285
|
-
return this._layers.has(e) ? (
|
|
3328
|
+
return this._layers.has(e) ? (S.error(`Layer with ID ${e} already exists.`), r = this._layers.get(e)) : (r = new rn(e), this._layers.set(e, r)), (t || this._currentLayerId === null) && this.setFocusLayer(e), n && this.addFocusable(n, e), r;
|
|
3286
3329
|
}
|
|
3287
3330
|
removeFocusLayer(e, t = !0) {
|
|
3288
3331
|
if (e === void 0 && t) return this._removeTopLayer();
|
|
3289
|
-
this._layers.has(e) ||
|
|
3290
|
-
let n =
|
|
3332
|
+
this._layers.has(e) || S.warn(`Layer with ID ${e} does not exist.`);
|
|
3333
|
+
let n = De(this._layers, e)?.[0];
|
|
3291
3334
|
this._layers.delete(e), this._postDelete(n);
|
|
3292
3335
|
}
|
|
3293
3336
|
restart(e = !1) {
|
|
@@ -3363,7 +3406,7 @@ var $t = class extends N {
|
|
|
3363
3406
|
_next() {
|
|
3364
3407
|
let e = this._getCurrentLayer()?.next();
|
|
3365
3408
|
if (!e) {
|
|
3366
|
-
|
|
3409
|
+
S.error("FocusManager:: _next():: No focusable found in the current layer.");
|
|
3367
3410
|
return;
|
|
3368
3411
|
}
|
|
3369
3412
|
this._setTarget(e);
|
|
@@ -3371,7 +3414,7 @@ var $t = class extends N {
|
|
|
3371
3414
|
_prev() {
|
|
3372
3415
|
let e = this._getCurrentLayer()?.prev();
|
|
3373
3416
|
if (!e) {
|
|
3374
|
-
|
|
3417
|
+
S.error("FocusManager:: _prev():: No focusable found in the current layer.");
|
|
3375
3418
|
return;
|
|
3376
3419
|
}
|
|
3377
3420
|
this._setTarget(e);
|
|
@@ -3389,7 +3432,7 @@ var $t = class extends N {
|
|
|
3389
3432
|
return this._currentLayerId == null ? null : this._layers.get(this._currentLayerId) || null;
|
|
3390
3433
|
}
|
|
3391
3434
|
_removeTopLayer() {
|
|
3392
|
-
let e =
|
|
3435
|
+
let e = ke(this._layers)?.[0], t = De(this._layers, e)?.[0];
|
|
3393
3436
|
e !== void 0 && (this._layers.delete(e), this._postDelete(t));
|
|
3394
3437
|
}
|
|
3395
3438
|
_postDelete(e) {
|
|
@@ -3399,7 +3442,7 @@ var $t = class extends N {
|
|
|
3399
3442
|
let n = this._getCurrentLayer(), r = this._focusTarget;
|
|
3400
3443
|
if (this._focusTarget = e, r && this._active && this._clearFocusTarget(r), this.app.renderer.accessibility.isActive || this._keyboardActive) this._focusTarget ? (this._active ||= !0, this._options.usePixiAccessibility && !this._focusTarget._accessibleDiv && this.app.renderer.accessibility.postrender(), this._options.usePixiAccessibility && this.app.ticker.addOnce(() => {
|
|
3401
3444
|
this._focusTarget?._accessibleDiv?.focus();
|
|
3402
|
-
}), n?.hasFocusable(e) ? this._focusTarget && (this._focusTarget.focusIn(), this._focusTarget.isFocused = !0, this._focusTarget.onFocusIn.emit(this._focusTarget), n.setCurrentFocusable(this._focusTarget), this._updateOutliner()) :
|
|
3445
|
+
}), n?.hasFocusable(e) ? this._focusTarget && (this._focusTarget.focusIn(), this._focusTarget.isFocused = !0, this._focusTarget.onFocusIn.emit(this._focusTarget), n.setCurrentFocusable(this._focusTarget), this._updateOutliner()) : S.warn("The focusable", e, `does not exist on the current focus layer: ${this._currentLayerId}`)) : this._focusOutliner.clear();
|
|
3403
3446
|
else if (this._focusOutliner.clear(), this._active && t) {
|
|
3404
3447
|
this._active = !1, this.onFocusManagerDeactivated.emit();
|
|
3405
3448
|
return;
|
|
@@ -3433,8 +3476,8 @@ var $t = class extends N {
|
|
|
3433
3476
|
_updateOutliner() {
|
|
3434
3477
|
this._focusTarget ? this._focusOutliner.draw(this._focusTarget) : this._focusOutliner.clear();
|
|
3435
3478
|
}
|
|
3436
|
-
},
|
|
3437
|
-
function
|
|
3479
|
+
}, on = .01;
|
|
3480
|
+
function Y(e) {
|
|
3438
3481
|
let t = e.length;
|
|
3439
3482
|
if (t === 0) return {
|
|
3440
3483
|
centerX: 0,
|
|
@@ -3451,22 +3494,22 @@ function X(e) {
|
|
|
3451
3494
|
spread: o / t
|
|
3452
3495
|
};
|
|
3453
3496
|
}
|
|
3454
|
-
function
|
|
3497
|
+
function sn(e, t) {
|
|
3455
3498
|
return {
|
|
3456
3499
|
dx: t.centerX - e.centerX,
|
|
3457
3500
|
dy: t.centerY - e.centerY,
|
|
3458
|
-
scale: e.spread <
|
|
3501
|
+
scale: e.spread < on ? 1 : t.spread / e.spread
|
|
3459
3502
|
};
|
|
3460
3503
|
}
|
|
3461
3504
|
//#endregion
|
|
3462
3505
|
//#region src/plugins/gesture/types.ts
|
|
3463
|
-
var
|
|
3506
|
+
var cn = {
|
|
3464
3507
|
enabled: !0,
|
|
3465
3508
|
pointerTypes: ["touch"],
|
|
3466
3509
|
pinchThreshold: 8,
|
|
3467
3510
|
panThreshold: 8,
|
|
3468
3511
|
preventDefault: !0
|
|
3469
|
-
},
|
|
3512
|
+
}, ln = .01, un = class extends N {
|
|
3470
3513
|
constructor(...e) {
|
|
3471
3514
|
super(...e), this.id = "gesture", this.onGestureStart = new j(), this.onGestureChange = new j(), this.onGestureEnd = new j(), this._pointers = /* @__PURE__ */ new Map(), this._state = "idle", this._startFrame = null, this._lastFrame = null, this._canvas = null, this._previousTouchAction = "", this._onPointerDown = (e) => {
|
|
3472
3515
|
if (!this._options.pointerTypes.includes(e.pointerType)) return;
|
|
@@ -3476,9 +3519,9 @@ var on = {
|
|
|
3476
3519
|
x: e.clientX,
|
|
3477
3520
|
y: e.clientY
|
|
3478
3521
|
}), this._state === "idle" && this._pointers.size === 2) {
|
|
3479
|
-
let e =
|
|
3522
|
+
let e = Y([...this._pointers.values()]);
|
|
3480
3523
|
this._startFrame = e, this._lastFrame = e, this._state = "pending";
|
|
3481
|
-
} else this._state !== "idle" && n && (this._lastFrame =
|
|
3524
|
+
} else this._state !== "idle" && n && (this._lastFrame = Y([...this._pointers.values()]));
|
|
3482
3525
|
this._maybePreventDefault(e, t, this._state);
|
|
3483
3526
|
}, this._onPointerMove = (e) => {
|
|
3484
3527
|
if (!this._pointers.has(e.pointerId)) return;
|
|
@@ -3489,16 +3532,16 @@ var on = {
|
|
|
3489
3532
|
});
|
|
3490
3533
|
let t = this._state;
|
|
3491
3534
|
if (this._pointers.size >= 2) {
|
|
3492
|
-
let e =
|
|
3535
|
+
let e = Y([...this._pointers.values()]);
|
|
3493
3536
|
if (this._state === "pending") {
|
|
3494
|
-
let t =
|
|
3537
|
+
let t = sn(this._lastFrame, e), n = Math.abs(e.spread - this._lastFrame.spread), r = Math.hypot(t.dx, t.dy);
|
|
3495
3538
|
(n >= this._options.pinchThreshold || r >= this._options.panThreshold) && (this._lastFrame = e, this._state = "active", this.onGestureStart.emit({
|
|
3496
3539
|
centerX: e.centerX,
|
|
3497
3540
|
centerY: e.centerY,
|
|
3498
3541
|
pointerCount: this._pointers.size
|
|
3499
3542
|
}));
|
|
3500
3543
|
} else if (this._state === "active") {
|
|
3501
|
-
let t =
|
|
3544
|
+
let t = sn(this._lastFrame, e), n = this._computeTotalScale(e);
|
|
3502
3545
|
this._lastFrame = e, this.onGestureChange.emit({
|
|
3503
3546
|
centerX: e.centerX,
|
|
3504
3547
|
centerY: e.centerY,
|
|
@@ -3525,7 +3568,7 @@ var on = {
|
|
|
3525
3568
|
}
|
|
3526
3569
|
async initialize(e = {}, t) {
|
|
3527
3570
|
if (this._options = {
|
|
3528
|
-
...
|
|
3571
|
+
...cn,
|
|
3529
3572
|
...e
|
|
3530
3573
|
}, !this._options.enabled) return;
|
|
3531
3574
|
let n = t.canvas;
|
|
@@ -3548,21 +3591,21 @@ var on = {
|
|
|
3548
3591
|
centerX: this._lastFrame.centerX,
|
|
3549
3592
|
centerY: this._lastFrame.centerY,
|
|
3550
3593
|
totalScale: this._computeTotalScale(this._lastFrame)
|
|
3551
|
-
}), this._state = "idle", this._startFrame = null, this._lastFrame = null) : this._state !== "idle" && (this._lastFrame =
|
|
3594
|
+
}), this._state = "idle", this._startFrame = null, this._lastFrame = null) : this._state !== "idle" && (this._lastFrame = Y([...this._pointers.values()])), this._maybePreventDefault(e, t, this._state);
|
|
3552
3595
|
}
|
|
3553
3596
|
_computeTotalScale(e) {
|
|
3554
|
-
return !this._startFrame || this._startFrame.spread <
|
|
3597
|
+
return !this._startFrame || this._startFrame.spread < ln ? 1 : e.spread / this._startFrame.spread;
|
|
3555
3598
|
}
|
|
3556
3599
|
_maybePreventDefault(e, t, n) {
|
|
3557
3600
|
this._options.preventDefault && (t !== "idle" || n !== "idle") && e.preventDefault();
|
|
3558
3601
|
}
|
|
3559
|
-
},
|
|
3602
|
+
}, dn = {
|
|
3560
3603
|
defaultLocale: "en",
|
|
3561
3604
|
locales: ["en"],
|
|
3562
3605
|
loadAll: !1,
|
|
3563
3606
|
files: []
|
|
3564
3607
|
};
|
|
3565
|
-
function
|
|
3608
|
+
function fn(e, t) {
|
|
3566
3609
|
if (t in e) return e[t];
|
|
3567
3610
|
if (!t.includes(".")) return;
|
|
3568
3611
|
let n = e;
|
|
@@ -3570,7 +3613,7 @@ function un(e, t) {
|
|
|
3570
3613
|
else return;
|
|
3571
3614
|
return n;
|
|
3572
3615
|
}
|
|
3573
|
-
var
|
|
3616
|
+
var pn = class extends N {
|
|
3574
3617
|
constructor(...e) {
|
|
3575
3618
|
super(...e), this.id = "i18n", this.onLocaleChanged = new j(), this._dicts = {};
|
|
3576
3619
|
}
|
|
@@ -3582,7 +3625,7 @@ var dn = class extends N {
|
|
|
3582
3625
|
}
|
|
3583
3626
|
async initialize(e) {
|
|
3584
3627
|
if (this._options = {
|
|
3585
|
-
...
|
|
3628
|
+
...dn,
|
|
3586
3629
|
...e
|
|
3587
3630
|
}, this._locale = this._options.defaultLocale, this._options.loadAll && this._options.files.length > 0) {
|
|
3588
3631
|
let e = this._options.files.filter((e) => this._options.locales.includes(e.id));
|
|
@@ -3594,9 +3637,9 @@ var dn = class extends N {
|
|
|
3594
3637
|
}
|
|
3595
3638
|
t(e, t, n = this._locale) {
|
|
3596
3639
|
let r = this._dicts[n];
|
|
3597
|
-
if (!r) return
|
|
3598
|
-
let i =
|
|
3599
|
-
if (!a) return
|
|
3640
|
+
if (!r) return S.error(`i18n:: No dictionary loaded for current locale: ${n}`), e;
|
|
3641
|
+
let i = fn(r, e), a = typeof i == "string" ? i : void 0;
|
|
3642
|
+
if (!a) return S.error(`i18n:: No result found for the key ${e} in the locale: ${this._locale}`), e;
|
|
3600
3643
|
let o = t?.variant;
|
|
3601
3644
|
if (a = a.replace(/\[(.*?)\]/g, (e, t) => {
|
|
3602
3645
|
let n = t.split("|");
|
|
@@ -3612,14 +3655,14 @@ var dn = class extends N {
|
|
|
3612
3655
|
}
|
|
3613
3656
|
tCount(e, t, n, r = this._locale) {
|
|
3614
3657
|
let i = new Intl.PluralRules(r).select(t), a = this._dicts[r], o = `${e}.${i}`;
|
|
3615
|
-
return (!a || typeof
|
|
3658
|
+
return (!a || typeof fn(a, o) != "string") && (o = `${e}.other`), this.t(o, {
|
|
3616
3659
|
count: t,
|
|
3617
3660
|
...n
|
|
3618
3661
|
}, r);
|
|
3619
3662
|
}
|
|
3620
3663
|
parse(e, t = this._locale) {
|
|
3621
3664
|
let n = this._dicts[t];
|
|
3622
|
-
if (!n) return
|
|
3665
|
+
if (!n) return S.error(`i18n:: No dictionary loaded for current locale: ${this._locale}`), "";
|
|
3623
3666
|
let r = e, i = r.match(/{(.*?)}/g);
|
|
3624
3667
|
return i && i.forEach((e) => {
|
|
3625
3668
|
let t = e.slice(1, -1);
|
|
@@ -3629,10 +3672,10 @@ var dn = class extends N {
|
|
|
3629
3672
|
async loadLocale(e) {
|
|
3630
3673
|
let n = this._options.files.find((t) => e === t.id);
|
|
3631
3674
|
if (!n) {
|
|
3632
|
-
|
|
3675
|
+
S.error(`i18n:: Could not find locale file for ${e}`);
|
|
3633
3676
|
return;
|
|
3634
3677
|
}
|
|
3635
|
-
this._dicts[e] = n.json ? await t.load(n.json) : await
|
|
3678
|
+
this._dicts[e] = n.json ? await t.load(n.json) : await T(n);
|
|
3636
3679
|
}
|
|
3637
3680
|
getCoreFunctions() {
|
|
3638
3681
|
return [
|
|
@@ -3648,12 +3691,12 @@ var dn = class extends N {
|
|
|
3648
3691
|
async _loadAndSetLocale(e) {
|
|
3649
3692
|
this._dicts[e] || await this.loadLocale(e), this.onLocaleChanged.emit(e);
|
|
3650
3693
|
}
|
|
3651
|
-
},
|
|
3694
|
+
}, X = /* @__PURE__ */ function(e) {
|
|
3652
3695
|
return e.Keyboard = "keyboard", e.GamePad = "gamepad", e.Mouse = "mouse", e.Touch = "touch", e;
|
|
3653
3696
|
}({});
|
|
3654
3697
|
//#endregion
|
|
3655
3698
|
//#region src/mixins/signals.ts
|
|
3656
|
-
function
|
|
3699
|
+
function mn(e) {
|
|
3657
3700
|
return class extends e {
|
|
3658
3701
|
constructor(...e) {
|
|
3659
3702
|
super(...e), this.signalConnections = new A.SignalConnections();
|
|
@@ -3674,12 +3717,12 @@ function fn(e) {
|
|
|
3674
3717
|
}
|
|
3675
3718
|
//#endregion
|
|
3676
3719
|
//#region src/plugins/input/controlsCore.ts
|
|
3677
|
-
function
|
|
3720
|
+
function hn(e, t) {
|
|
3678
3721
|
return e === "*" ? !0 : Array.isArray(e) ? e.includes(t) : e === t;
|
|
3679
3722
|
}
|
|
3680
|
-
function
|
|
3723
|
+
function gn(e, t, n, r) {
|
|
3681
3724
|
let i = [], a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
3682
|
-
return
|
|
3725
|
+
return bn(e, t, n, r, (e, t) => {
|
|
3683
3726
|
if (t.includes("+")) {
|
|
3684
3727
|
let n = t.split("+");
|
|
3685
3728
|
i.push(n), a.set(n, e);
|
|
@@ -3690,16 +3733,16 @@ function mn(e, t, n, r) {
|
|
|
3690
3733
|
singles: o
|
|
3691
3734
|
};
|
|
3692
3735
|
}
|
|
3693
|
-
function
|
|
3736
|
+
function _n(e, t, n, r) {
|
|
3694
3737
|
let i = /* @__PURE__ */ new Map();
|
|
3695
|
-
return
|
|
3738
|
+
return bn(e, t, n, r, (e, t) => {
|
|
3696
3739
|
i.set(t, e);
|
|
3697
3740
|
}), i;
|
|
3698
3741
|
}
|
|
3699
|
-
function
|
|
3742
|
+
function vn(e, t, n = t) {
|
|
3700
3743
|
return e.includes("+") ? e.split("+").every((e) => n(e)) : t(e);
|
|
3701
3744
|
}
|
|
3702
|
-
function
|
|
3745
|
+
function yn(e, t) {
|
|
3703
3746
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
3704
3747
|
for (let i = 0; i < e.length; i++) {
|
|
3705
3748
|
let a = e[i];
|
|
@@ -3710,31 +3753,31 @@ function _n(e, t) {
|
|
|
3710
3753
|
eliminated: r
|
|
3711
3754
|
};
|
|
3712
3755
|
}
|
|
3713
|
-
function
|
|
3756
|
+
function bn(e, t, n, r, i) {
|
|
3714
3757
|
e && Object.keys(e).forEach((a) => {
|
|
3715
3758
|
let o = t[a];
|
|
3716
3759
|
if (!o) {
|
|
3717
3760
|
r(a);
|
|
3718
3761
|
return;
|
|
3719
3762
|
}
|
|
3720
|
-
if (!
|
|
3763
|
+
if (!hn(o.context, n)) return;
|
|
3721
3764
|
let s = e[a];
|
|
3722
3765
|
s && (Array.isArray(s) ? s : [s]).forEach((e) => i(a, e));
|
|
3723
3766
|
});
|
|
3724
3767
|
}
|
|
3725
3768
|
//#endregion
|
|
3726
3769
|
//#region src/plugins/input/AbstractControls.ts
|
|
3727
|
-
var
|
|
3770
|
+
var xn = class {
|
|
3728
3771
|
static {
|
|
3729
3772
|
this.__caper_method_binding_root = !0;
|
|
3730
3773
|
}
|
|
3731
3774
|
destroy() {}
|
|
3732
|
-
},
|
|
3775
|
+
}, Sn = class extends mn(xn) {
|
|
3733
3776
|
constructor(...e) {
|
|
3734
3777
|
super(...e), this.combinations = [], this.combinationsMap = /* @__PURE__ */ new Map(), this.activeDownInputs = /* @__PURE__ */ new Map(), this.activeUpInputs = /* @__PURE__ */ new Map(), this._warnedMissingActions = /* @__PURE__ */ new Set();
|
|
3735
3778
|
}
|
|
3736
3779
|
get app() {
|
|
3737
|
-
return
|
|
3780
|
+
return Q.getInstance();
|
|
3738
3781
|
}
|
|
3739
3782
|
initialize(e) {
|
|
3740
3783
|
this.scheme = e, this.addSignalConnection(this.app.signal.onActionContextChanged.connect(this._sortActions)), this._sortActions();
|
|
@@ -3759,18 +3802,18 @@ var yn = class {
|
|
|
3759
3802
|
return this.isInputDown(e);
|
|
3760
3803
|
}
|
|
3761
3804
|
_isInputActive(e) {
|
|
3762
|
-
return
|
|
3805
|
+
return vn(e, this.isInputDown, this.isComboPartDown);
|
|
3763
3806
|
}
|
|
3764
3807
|
_sortActions() {
|
|
3765
|
-
let e = this.app.actionsPlugin.getActions(), t = this.app.actionContext, { combinations: n, combinationsMap: r, singles: i } =
|
|
3766
|
-
this.combinations = n, this.combinationsMap = r, this.activeDownInputs = i, this.activeUpInputs =
|
|
3808
|
+
let e = this.app.actionsPlugin.getActions(), t = this.app.actionContext, { combinations: n, combinationsMap: r, singles: i } = gn(this.downSection, e, t, this._warnMissingAction);
|
|
3809
|
+
this.combinations = n, this.combinationsMap = r, this.activeDownInputs = i, this.activeUpInputs = _n(this.upSection, e, t, this._warnMissingAction);
|
|
3767
3810
|
}
|
|
3768
3811
|
_warnMissingAction(e) {
|
|
3769
|
-
this._warnedMissingActions.has(e) || (this._warnedMissingActions.add(e),
|
|
3812
|
+
this._warnedMissingActions.has(e) || (this._warnedMissingActions.add(e), S.warn(`${this.logLabel}: scheme references unknown action "${e}"`));
|
|
3770
3813
|
}
|
|
3771
|
-
},
|
|
3814
|
+
}, Cn = class extends Sn {
|
|
3772
3815
|
constructor() {
|
|
3773
|
-
super(), this.logLabel = "KeyboardControls", this._singleDownKeys = /* @__PURE__ */ new Set(),
|
|
3816
|
+
super(), this.logLabel = "KeyboardControls", this._singleDownKeys = /* @__PURE__ */ new Set(), g(this);
|
|
3774
3817
|
}
|
|
3775
3818
|
initialize(e) {
|
|
3776
3819
|
super.initialize(e);
|
|
@@ -3799,7 +3842,7 @@ var yn = class {
|
|
|
3799
3842
|
if (!this.app.keyboard) return;
|
|
3800
3843
|
let e = this.app.keyboard.keysDown;
|
|
3801
3844
|
if (e.size === 0) return;
|
|
3802
|
-
let { fired: t, eliminated: n } =
|
|
3845
|
+
let { fired: t, eliminated: n } = yn(this.combinations, (t) => e.has(t));
|
|
3803
3846
|
t.forEach((e) => {
|
|
3804
3847
|
let t = this.combinationsMap.get(e);
|
|
3805
3848
|
t && this.app.action(t, {
|
|
@@ -3818,9 +3861,9 @@ var yn = class {
|
|
|
3818
3861
|
}
|
|
3819
3862
|
});
|
|
3820
3863
|
}
|
|
3821
|
-
},
|
|
3864
|
+
}, wn = class extends Sn {
|
|
3822
3865
|
constructor() {
|
|
3823
|
-
super(), this.logLabel = "VirtualControls", this._buttons = /* @__PURE__ */ new Set(), this._singleDownButtons = /* @__PURE__ */ new Set(), this._activeJoystickDirections = /* @__PURE__ */ new Map(), this._buttonConnections = /* @__PURE__ */ new Map(),
|
|
3866
|
+
super(), this.logLabel = "VirtualControls", this._buttons = /* @__PURE__ */ new Set(), this._singleDownButtons = /* @__PURE__ */ new Set(), this._activeJoystickDirections = /* @__PURE__ */ new Map(), this._buttonConnections = /* @__PURE__ */ new Map(), g(this);
|
|
3824
3867
|
}
|
|
3825
3868
|
get joystick() {
|
|
3826
3869
|
return this._joystick;
|
|
@@ -3878,7 +3921,7 @@ var yn = class {
|
|
|
3878
3921
|
});
|
|
3879
3922
|
}
|
|
3880
3923
|
_update() {
|
|
3881
|
-
let e = this._joystick?.direction ?? null, t = this._singleDownButtons, { fired: n, eliminated: r } =
|
|
3924
|
+
let e = this._joystick?.direction ?? null, t = this._singleDownButtons, { fired: n, eliminated: r } = yn(this.combinations, (n) => t.has(n) || e === n);
|
|
3882
3925
|
if (n.forEach((e) => {
|
|
3883
3926
|
let t = this.combinationsMap.get(e);
|
|
3884
3927
|
t && this.app.action(t, {
|
|
@@ -3900,12 +3943,12 @@ var yn = class {
|
|
|
3900
3943
|
t && this.app.action(t, { inputState: "joystick" });
|
|
3901
3944
|
}
|
|
3902
3945
|
}
|
|
3903
|
-
},
|
|
3946
|
+
}, Tn = class {
|
|
3904
3947
|
constructor() {
|
|
3905
|
-
|
|
3948
|
+
g(this);
|
|
3906
3949
|
}
|
|
3907
3950
|
get app() {
|
|
3908
|
-
return
|
|
3951
|
+
return Q.getInstance();
|
|
3909
3952
|
}
|
|
3910
3953
|
get virtual() {
|
|
3911
3954
|
return this.touch;
|
|
@@ -3917,14 +3960,14 @@ var yn = class {
|
|
|
3917
3960
|
return this.keyboard?.isActionActive(e) || this.touch?.isActionActive(e) || !1;
|
|
3918
3961
|
}
|
|
3919
3962
|
initialize(e) {
|
|
3920
|
-
e.keyboard && (this.keyboard = new
|
|
3963
|
+
e.keyboard && (this.keyboard = new Cn(), this.keyboard.initialize(e.keyboard)), e.touch && (this.touch = new wn(), this.touch.initialize(e.touch));
|
|
3921
3964
|
}
|
|
3922
3965
|
connect() {
|
|
3923
3966
|
this.keyboard && this.keyboard.connect(), this.touch && this.touch.connect();
|
|
3924
3967
|
}
|
|
3925
|
-
},
|
|
3968
|
+
}, En = { actions: yt }, Dn = class extends N {
|
|
3926
3969
|
constructor(...e) {
|
|
3927
|
-
super(...e), this.id = "input", this.controls = new
|
|
3970
|
+
super(...e), this.id = "input", this.controls = new Tn(), this.activeGamepads = /* @__PURE__ */ new Map(), this.activeControllers = /* @__PURE__ */ new Set([]), this._lastUsedController = null, this._canvas = null, this.onGamepadConnected = new j(), this.onGamepadDisconnected = new j(), this.onControllerActivated = new j(), this.onControllerDeactivated = new j(), this.onControllerChanged = new j();
|
|
3928
3971
|
}
|
|
3929
3972
|
get lastUsedController() {
|
|
3930
3973
|
return this._lastUsedController;
|
|
@@ -3932,9 +3975,9 @@ var yn = class {
|
|
|
3932
3975
|
isActionActive(e) {
|
|
3933
3976
|
return this.controls.isActionActive(e);
|
|
3934
3977
|
}
|
|
3935
|
-
async initialize(e =
|
|
3978
|
+
async initialize(e = En, t) {
|
|
3936
3979
|
this._options = {
|
|
3937
|
-
...
|
|
3980
|
+
...En,
|
|
3938
3981
|
...e
|
|
3939
3982
|
}, t.stage.eventMode = "static", this._canvas = t.canvas, this.listen(this._canvas, "pointerdown", this._onPointerDown), this.listen(this._canvas, "pointermove", this._onPointerMove), this.listen(window, "keydown", this._onKeyDown), this.listen(window, "gamepadconnected", this._onGamepadConnected), this.listen(window, "gamepaddisconnected", this._onGamepadDisconnected), this._options.controls && this.controls.initialize(this._options.controls);
|
|
3940
3983
|
}
|
|
@@ -3960,7 +4003,7 @@ var yn = class {
|
|
|
3960
4003
|
];
|
|
3961
4004
|
}
|
|
3962
4005
|
_isInputControllerType(e) {
|
|
3963
|
-
return Object.values(
|
|
4006
|
+
return Object.values(X).includes(e);
|
|
3964
4007
|
}
|
|
3965
4008
|
_activateController(e) {
|
|
3966
4009
|
let t = !this.activeControllers.has(e);
|
|
@@ -3976,31 +4019,31 @@ var yn = class {
|
|
|
3976
4019
|
this.activeGamepads.delete(e);
|
|
3977
4020
|
}
|
|
3978
4021
|
_onPointerDown(e) {
|
|
3979
|
-
e.pointerType === "touch" && this._activateController(
|
|
4022
|
+
e.pointerType === "touch" && this._activateController(X.Touch);
|
|
3980
4023
|
}
|
|
3981
4024
|
_onPointerMove(e) {
|
|
3982
|
-
e.pointerType === "mouse" && this._activateController(
|
|
4025
|
+
e.pointerType === "mouse" && this._activateController(X.Mouse);
|
|
3983
4026
|
}
|
|
3984
4027
|
_onKeyDown() {
|
|
3985
|
-
this._activateController(
|
|
4028
|
+
this._activateController(X.Keyboard);
|
|
3986
4029
|
}
|
|
3987
4030
|
_onGamepadConnected(e) {
|
|
3988
|
-
this._activateController(
|
|
4031
|
+
this._activateController(X.GamePad), this._activateController(e.gamepad.id), this._activateGamepad(e.gamepad), this.onGamepadConnected.emit(e.gamepad);
|
|
3989
4032
|
}
|
|
3990
4033
|
_onGamepadDisconnected(e) {
|
|
3991
|
-
this._deactivateGamepad(e.gamepad.id), this.actionsPlugin.sendAction("pause"), this.onGamepadDisconnected.emit(e.gamepad), this.activeGamepads.size === 0 && this._deactivateController(
|
|
4034
|
+
this._deactivateGamepad(e.gamepad.id), this.actionsPlugin.sendAction("pause"), this.onGamepadDisconnected.emit(e.gamepad), this.activeGamepads.size === 0 && this._deactivateController(X.GamePad);
|
|
3992
4035
|
}
|
|
3993
4036
|
get actionsPlugin() {
|
|
3994
4037
|
return this.app.getPlugin("actions");
|
|
3995
4038
|
}
|
|
3996
|
-
},
|
|
4039
|
+
}, On = {
|
|
3997
4040
|
x: !0,
|
|
3998
4041
|
y: !0,
|
|
3999
4042
|
intensity: 3,
|
|
4000
4043
|
duration: .05,
|
|
4001
4044
|
times: 4
|
|
4002
4045
|
};
|
|
4003
|
-
function
|
|
4046
|
+
function kn(e) {
|
|
4004
4047
|
return class extends e {
|
|
4005
4048
|
constructor(...e) {
|
|
4006
4049
|
super(...e), this.onAnimationStart = new j(), this.onAnimationUpdate = new j(), this.onAnimationComplete = new j(), this._activeTweens = [];
|
|
@@ -4073,7 +4116,7 @@ function Dn(e) {
|
|
|
4073
4116
|
}
|
|
4074
4117
|
shake(e, t = this) {
|
|
4075
4118
|
let n = {
|
|
4076
|
-
...
|
|
4119
|
+
...On,
|
|
4077
4120
|
...e
|
|
4078
4121
|
}, r = {
|
|
4079
4122
|
x: t.x,
|
|
@@ -4119,7 +4162,7 @@ function Dn(e) {
|
|
|
4119
4162
|
}
|
|
4120
4163
|
//#endregion
|
|
4121
4164
|
//#region src/mixins/factory/Factory.ts
|
|
4122
|
-
function
|
|
4165
|
+
function An(e) {
|
|
4123
4166
|
return class extends n {
|
|
4124
4167
|
constructor() {
|
|
4125
4168
|
super(), e = Object.assign({}, $e(), e), this.make = M(e, this, !1), this.add = M(e, this, !0);
|
|
@@ -4128,26 +4171,26 @@ function On(e) {
|
|
|
4128
4171
|
}
|
|
4129
4172
|
//#endregion
|
|
4130
4173
|
//#region src/mixins/lifecycle.ts
|
|
4131
|
-
var
|
|
4174
|
+
var jn = {
|
|
4132
4175
|
autoResize: !0,
|
|
4133
4176
|
autoUpdate: !1,
|
|
4134
4177
|
resizePriority: 0,
|
|
4135
4178
|
updatePriority: -999999
|
|
4136
4179
|
};
|
|
4137
|
-
function
|
|
4180
|
+
function Mn(e) {
|
|
4138
4181
|
return class extends e {
|
|
4139
4182
|
constructor(...e) {
|
|
4140
|
-
super(...e), this.onDestroy = new j(), this.__lifecycleConfig = { ...
|
|
4183
|
+
super(...e), this.onDestroy = new j(), this.__lifecycleConfig = { ...jn };
|
|
4141
4184
|
}
|
|
4142
4185
|
static {
|
|
4143
4186
|
this.__caper_method_binding_root = !0;
|
|
4144
4187
|
}
|
|
4145
4188
|
get app() {
|
|
4146
|
-
return
|
|
4189
|
+
return Q.getInstance();
|
|
4147
4190
|
}
|
|
4148
4191
|
_initLifecycle(e = {}) {
|
|
4149
4192
|
this.__lifecycleConfig = {
|
|
4150
|
-
...
|
|
4193
|
+
...jn,
|
|
4151
4194
|
...e
|
|
4152
4195
|
}, this.on("added", this._added), this.on("removed", this._removed);
|
|
4153
4196
|
}
|
|
@@ -4168,15 +4211,15 @@ function An(e) {
|
|
|
4168
4211
|
}
|
|
4169
4212
|
//#endregion
|
|
4170
4213
|
//#region src/display/Container.ts
|
|
4171
|
-
var
|
|
4214
|
+
var Nn = [
|
|
4172
4215
|
"autoResize",
|
|
4173
4216
|
"autoUpdate",
|
|
4174
4217
|
"priority"
|
|
4175
|
-
],
|
|
4218
|
+
], Pn = {
|
|
4176
4219
|
autoResize: !0,
|
|
4177
4220
|
autoUpdate: !1,
|
|
4178
4221
|
priority: 0
|
|
4179
|
-
},
|
|
4222
|
+
}, Z = class e extends Mn(kn(mn(An()))) {
|
|
4180
4223
|
get animationContext() {
|
|
4181
4224
|
return this._animationContext;
|
|
4182
4225
|
}
|
|
@@ -4198,10 +4241,10 @@ var jn = [
|
|
|
4198
4241
|
constructor(e = {}) {
|
|
4199
4242
|
super();
|
|
4200
4243
|
let { autoResize: t, autoUpdate: n, priority: r } = {
|
|
4201
|
-
...
|
|
4244
|
+
...Pn,
|
|
4202
4245
|
...e
|
|
4203
4246
|
};
|
|
4204
|
-
|
|
4247
|
+
g(this), this._initLifecycle({
|
|
4205
4248
|
autoResize: t,
|
|
4206
4249
|
autoUpdate: n,
|
|
4207
4250
|
resizePriority: r
|
|
@@ -4246,9 +4289,9 @@ var jn = [
|
|
|
4246
4289
|
addAnimation(e, t) {
|
|
4247
4290
|
return this.app.addAnimation(e, t ?? this.animationContext);
|
|
4248
4291
|
}
|
|
4249
|
-
},
|
|
4292
|
+
}, Fn = class extends N {
|
|
4250
4293
|
constructor(...e) {
|
|
4251
|
-
super(...e), this.id = "popups", this.view = new
|
|
4294
|
+
super(...e), this.id = "popups", this.view = new Z(), this.onShowPopup = new j(), this.onHidePopup = new j(), this.onPopupChanged = new j(), this._popups = /* @__PURE__ */ new Map(), this._activePopups = /* @__PURE__ */ new Map(), this._currentPopupId = void 0;
|
|
4252
4295
|
}
|
|
4253
4296
|
get currentPopupId() {
|
|
4254
4297
|
return this._currentPopupId;
|
|
@@ -4263,7 +4306,7 @@ var jn = [
|
|
|
4263
4306
|
return this._activePopups.size > 0;
|
|
4264
4307
|
}
|
|
4265
4308
|
initialize() {
|
|
4266
|
-
|
|
4309
|
+
g(this), this.view.label = "PopupManager", this._setupAppListeners(), this._registerDiscoveredPopups();
|
|
4267
4310
|
}
|
|
4268
4311
|
destroy() {
|
|
4269
4312
|
this._activePopups.clear(), super.destroy();
|
|
@@ -4291,7 +4334,7 @@ var jn = [
|
|
|
4291
4334
|
}
|
|
4292
4335
|
async hidePopup(e, t) {
|
|
4293
4336
|
let n = this._activePopups.get(e);
|
|
4294
|
-
if (n) return n.beforeHide(), await n.hide(), this.view.removeChild(n), this._activePopups.delete(e), this._currentPopupId =
|
|
4337
|
+
if (n) return n.beforeHide(), await n.hide(), this.view.removeChild(n), this._activePopups.delete(e), this._currentPopupId = ke(this._activePopups)?.[0] || void 0, new Promise((r) => {
|
|
4295
4338
|
this.app.ticker.addOnce(() => {
|
|
4296
4339
|
this.onHidePopup.emit({
|
|
4297
4340
|
id: e,
|
|
@@ -4342,7 +4385,7 @@ var jn = [
|
|
|
4342
4385
|
_handleEscape() {
|
|
4343
4386
|
this.current && this.current.config.closeOnEscape && this.hidePopup(this.current.id);
|
|
4344
4387
|
}
|
|
4345
|
-
},
|
|
4388
|
+
}, In = {
|
|
4346
4389
|
autoScroll: !1,
|
|
4347
4390
|
minWidth: 0,
|
|
4348
4391
|
minHeight: 0,
|
|
@@ -4350,7 +4393,7 @@ var jn = [
|
|
|
4350
4393
|
center: !1,
|
|
4351
4394
|
debug: !1,
|
|
4352
4395
|
useSafeArea: !0
|
|
4353
|
-
},
|
|
4396
|
+
}, Ln = class extends N {
|
|
4354
4397
|
constructor(...e) {
|
|
4355
4398
|
super(...e), this.id = "resizer", this._safeArea = {
|
|
4356
4399
|
top: 0,
|
|
@@ -4372,7 +4415,7 @@ var jn = [
|
|
|
4372
4415
|
}
|
|
4373
4416
|
async initialize(e) {
|
|
4374
4417
|
this._options = {
|
|
4375
|
-
...
|
|
4418
|
+
...In,
|
|
4376
4419
|
...e
|
|
4377
4420
|
};
|
|
4378
4421
|
}
|
|
@@ -4449,24 +4492,24 @@ var jn = [
|
|
|
4449
4492
|
}, this._options.debug && this._drawDebug();
|
|
4450
4493
|
}
|
|
4451
4494
|
_drawDebug() {
|
|
4452
|
-
this._debugContainer || (this._debugContainer = this.app.stage.addChild(new
|
|
4495
|
+
this._debugContainer || (this._debugContainer = this.app.stage.addChild(new Z()), this._gfx = this._debugContainer.add.graphics()), this._gfx.clear(), this._gfx.rect(0, 0, this._size.width, this._size.height), this._gfx.stroke({
|
|
4453
4496
|
width: 4,
|
|
4454
4497
|
color: 4095
|
|
4455
4498
|
});
|
|
4456
4499
|
}
|
|
4457
|
-
},
|
|
4458
|
-
function
|
|
4500
|
+
}, Rn = "caper-screen-debug", zn = "caper:screen-debug";
|
|
4501
|
+
function Bn() {
|
|
4459
4502
|
if (typeof window > "u") return !1;
|
|
4460
|
-
let e = new URLSearchParams(window.location.search).get(
|
|
4503
|
+
let e = new URLSearchParams(window.location.search).get(Rn), t = e === "1" || e === "true", n = e === "0" || e === "false";
|
|
4461
4504
|
try {
|
|
4462
|
-
return t ? (window.localStorage.setItem(
|
|
4505
|
+
return t ? (window.localStorage.setItem(zn, "1"), !0) : n ? (window.localStorage.removeItem(zn), !1) : window.localStorage.getItem(zn) === "1";
|
|
4463
4506
|
} catch {
|
|
4464
4507
|
return t;
|
|
4465
4508
|
}
|
|
4466
4509
|
}
|
|
4467
4510
|
//#endregion
|
|
4468
4511
|
//#region src/plugins/SceneManagerPlugin.ts
|
|
4469
|
-
var
|
|
4512
|
+
var Vn = {
|
|
4470
4513
|
view: null,
|
|
4471
4514
|
hideWhen: "firstSceneEnter",
|
|
4472
4515
|
zOrder: "top",
|
|
@@ -4474,9 +4517,9 @@ var zn = {
|
|
|
4474
4517
|
assets: [],
|
|
4475
4518
|
bundles: []
|
|
4476
4519
|
}
|
|
4477
|
-
},
|
|
4520
|
+
}, Hn = class extends N {
|
|
4478
4521
|
constructor() {
|
|
4479
|
-
super(), this.id = "scenes", this.onSceneChangeStart = new j(), this.onSceneChangeComplete = new j(), this.view = new n(), this.isFirstScene = !0, this.list = [], this.groupOrder = [], this.debugGroupsList = [], this._sceneModules = /* @__PURE__ */ new Map(), this._pendingLoadProps = void 0, this._lastScene = null, this._defaultLoadMethod = "immediate", this._debugVisible = !1, this._useHash = !1,
|
|
4522
|
+
super(), this.id = "scenes", this.onSceneChangeStart = new j(), this.onSceneChangeComplete = new j(), this.view = new n(), this.isFirstScene = !0, this.list = [], this.groupOrder = [], this.debugGroupsList = [], this._sceneModules = /* @__PURE__ */ new Map(), this._pendingLoadProps = void 0, this._lastScene = null, this._defaultLoadMethod = "immediate", this._debugVisible = !1, this._useHash = !1, g(this);
|
|
4480
4523
|
}
|
|
4481
4524
|
get ids() {
|
|
4482
4525
|
return this.list.map((e) => e.id);
|
|
@@ -4485,14 +4528,14 @@ var zn = {
|
|
|
4485
4528
|
this._defaultLoadMethod = e;
|
|
4486
4529
|
}
|
|
4487
4530
|
async initialize(e, t) {
|
|
4488
|
-
if (this._debugVisible = this.app.config?.showSceneDebugMenu === !0 ||
|
|
4531
|
+
if (this._debugVisible = this.app.config?.showSceneDebugMenu === !0 || v && this.app.config?.showSceneDebugMenu !== !1, this._useHash = t.config?.useHash === !0 || this._debugVisible, this.view.sortableChildren = !0, this.list = (Caper.get("sceneList") || []).filter((e) => e.active !== !1), this.groupOrder = t.config?.sceneGroupOrder || [], (this._debugVisible || this._useHash) && (this.defaultScene = this.getSceneFromHash() || ""), !this.splash) {
|
|
4489
4532
|
this.splash = {
|
|
4490
4533
|
view: null,
|
|
4491
4534
|
hideWhen: "firstSceneEnter",
|
|
4492
4535
|
zOrder: "top"
|
|
4493
4536
|
};
|
|
4494
4537
|
let e = {
|
|
4495
|
-
...
|
|
4538
|
+
...Vn,
|
|
4496
4539
|
...t.config?.splash ?? {}
|
|
4497
4540
|
};
|
|
4498
4541
|
e.view && (this.splash.view = typeof e.view == "function" ? new e.view() : e.view), this.splash.preload = e.preload;
|
|
@@ -4513,12 +4556,12 @@ var zn = {
|
|
|
4513
4556
|
let n = typeof e == "string" ? e : e.id, r = typeof e == "string" ? this._defaultLoadMethod : e?.method || this._defaultLoadMethod;
|
|
4514
4557
|
this.currentScene && (this._lastScene = this.currentScene);
|
|
4515
4558
|
let i = this.list.find((e) => e.id === n);
|
|
4516
|
-
if (!i) throw
|
|
4559
|
+
if (!i) throw w({ message: `Scene item not found for id ${n}` }), Error(`Scene item not found for id ${n}`);
|
|
4517
4560
|
if (i?.plugins?.length) for (let e of i.plugins) {
|
|
4518
4561
|
let t = this.app.getUnloadedPlugin(e);
|
|
4519
4562
|
t && await this.app.loadPlugin(t);
|
|
4520
4563
|
}
|
|
4521
|
-
switch (this._currentSceneId = n, this._queue =
|
|
4564
|
+
switch (this._currentSceneId = n, this._queue = we(this._createCurrentScene), r) {
|
|
4522
4565
|
case "exitEnter":
|
|
4523
4566
|
this._queue.add(this._exitLastScene, this._destroyLastScene, this._unloadLastScene, this._loadCurrentScene, this._initializeCurrentScene, this._addCurrentScene, this._enterCurrentScene, this._startCurrentScene);
|
|
4524
4567
|
break;
|
|
@@ -4564,7 +4607,7 @@ var zn = {
|
|
|
4564
4607
|
let e = this.list.find((e) => e.id === this._currentSceneId), t;
|
|
4565
4608
|
if (this._sceneModules.has(this._currentSceneId)) t = this._sceneModules.get(this._currentSceneId);
|
|
4566
4609
|
else {
|
|
4567
|
-
let n = await
|
|
4610
|
+
let n = await T(e);
|
|
4568
4611
|
if (!n) throw Error(`Couldn't load ${this._currentSceneId}"`);
|
|
4569
4612
|
t = n[this._currentSceneId] ? n[this._currentSceneId] : n, t && this._sceneModules.set(this._currentSceneId, t);
|
|
4570
4613
|
}
|
|
@@ -4623,7 +4666,7 @@ var zn = {
|
|
|
4623
4666
|
_createDebugMenu() {
|
|
4624
4667
|
this._debugMenu = document.createElement("div"), this._debugMenu.id = "scene-debug", this._debugMenu.style.cssText = "position: absolute; bottom: 0; left:0; width:48px; height:48px; z-index: 1000; background-color:rgba(0,0,0,0.8); color:white; border-top-right-radius:8px;";
|
|
4625
4668
|
let e = document.createElement("i");
|
|
4626
|
-
e.style.cssText = "cursor:pointer; position:absolute;width:100%; font-style:normal; font-size:20px; top:50%; left:50%; transform:translate(-50%, -50%); text-align:center; pointer-events:none", e.innerHTML = "🎬", this._debugMenu.appendChild(e), (
|
|
4669
|
+
e.style.cssText = "cursor:pointer; position:absolute;width:100%; font-style:normal; font-size:20px; top:50%; left:50%; transform:translate(-50%, -50%); text-align:center; pointer-events:none", e.innerHTML = "🎬", this._debugMenu.appendChild(e), (Q.containerElement || document.body).appendChild(this._debugMenu), this.addDisposer(() => this._debugMenu?.parentElement?.removeChild(this._debugMenu)), this._sceneSelect = document.createElement("select"), this._sceneSelect.style.cssText = "padding:0; border-radius:5px; opacity:0; width:48px; height:48px; cursor:pointer", this._sceneSelect.value = this.defaultScene || "";
|
|
4627
4670
|
let t = document.createElement("option");
|
|
4628
4671
|
t.value = "", t.innerHTML = "Select a scene", t.setAttribute("disabled", "disabled"), this._sceneSelect.appendChild(t);
|
|
4629
4672
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
@@ -4664,7 +4707,7 @@ var zn = {
|
|
|
4664
4707
|
};
|
|
4665
4708
|
//#endregion
|
|
4666
4709
|
//#region src/plugins/TimerPlugin.ts
|
|
4667
|
-
function
|
|
4710
|
+
function Un() {
|
|
4668
4711
|
try {
|
|
4669
4712
|
let e = new Blob(["\n const timers = new Map();\n\n self.onmessage = (e) => {\n const { type, timerId, options, timeAdjustment } = e.data;\n \n switch (type) {\n case 'start': {\n let timer = timers.get(timerId);\n \n if (timer) {\n // Resume existing timer\n timer.startTime = performance.now() - (timer.pausedTime || 0);\n timer.interval = createInterval(timer, options, timerId);\n } else {\n // Create new timer\n timer = {\n startTime: performance.now(),\n duration: options.duration,\n loopCount: 0,\n pausedTime: 0,\n options // Store options with the timer\n };\n timer.interval = createInterval(timer, options, timerId);\n timers.set(timerId, timer);\n }\n break;\n }\n \n case 'stop': {\n const timer = timers.get(timerId);\n if (timer) {\n clearInterval(timer.interval);\n timer.interval = null;\n timer.pausedTime = performance.now() - timer.startTime;\n }\n break;\n }\n\n case 'reset': {\n const timer = timers.get(timerId);\n if (timer) {\n timer.startTime = performance.now();\n timer.loopCount = 0;\n timer.pausedTime = 0;\n }\n break;\n }\n\n case 'adjustTime': {\n const timer = timers.get(timerId);\n if (timer) {\n if (timer.duration !== undefined) {\n // For countdown timers, adjust the duration\n timer.duration = Math.max(0, timer.duration + timeAdjustment);\n } else {\n // For count-up timers, adjust the start time\n timer.startTime -= timeAdjustment;\n }\n }\n break;\n }\n }\n };\n\n function createInterval(timer, options, timerId) {\n return setInterval(() => {\n const currentTime = performance.now();\n const totalElapsed = currentTime - timer.startTime;\n \n if (timer.duration !== undefined) {\n // Calculate elapsed time within the current loop\n const loopElapsed = totalElapsed - (timer.loopCount * timer.duration);\n const remaining = Math.max(0, timer.duration - loopElapsed);\n \n self.postMessage({ type: 'tick', timerId, time: remaining });\n \n if (remaining <= 0) {\n self.postMessage({ type: 'complete', timerId, time: 0 });\n \n if (options.loop) {\n timer.loopCount++;\n } else {\n clearInterval(timer.interval);\n timers.delete(timerId);\n }\n }\n } else {\n self.postMessage({ type: 'tick', timerId, time: totalElapsed });\n }\n }, options.workerInterval || 16);\n }\n "], { type: "application/javascript" });
|
|
4670
4713
|
return new Worker(URL.createObjectURL(e));
|
|
@@ -4672,7 +4715,7 @@ function Vn() {
|
|
|
4672
4715
|
return null;
|
|
4673
4716
|
}
|
|
4674
4717
|
}
|
|
4675
|
-
function
|
|
4718
|
+
function Wn(e, t = "mm:ss", n = "string") {
|
|
4676
4719
|
let r = Math.floor(e / 1e3), i = Math.floor(r / 3600), a = Math.floor(r % 3600 / 60), o = r % 60, s = Math.floor(e % 1e3 / 10);
|
|
4677
4720
|
if (n === "string") switch (t) {
|
|
4678
4721
|
case "hh:mm:ss": return `${i.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}`;
|
|
@@ -4687,9 +4730,9 @@ function Hn(e, t = "mm:ss", n = "string") {
|
|
|
4687
4730
|
ms: s
|
|
4688
4731
|
};
|
|
4689
4732
|
}
|
|
4690
|
-
var
|
|
4733
|
+
var Gn = class {
|
|
4691
4734
|
constructor(e = {}, t) {
|
|
4692
|
-
this.options = e, this.plugin = t, this.startTime = performance.now(), this.pausedTime = 0, this.isPaused = !0, this.isDestroyed = !1, this.timerId = ue(), e.useWorker && !t.hasWorkerSupport && (
|
|
4735
|
+
this.options = e, this.plugin = t, this.startTime = performance.now(), this.pausedTime = 0, this.isPaused = !0, this.isDestroyed = !1, this.timerId = ue(), e.useWorker && !t.hasWorkerSupport && (S.warn("Web Worker support not available, falling back to main thread timer"), e.useWorker = !1), this.isWorkerTimer = !!e.useWorker, e.autoStart && this.start();
|
|
4693
4736
|
}
|
|
4694
4737
|
start() {
|
|
4695
4738
|
this.isPaused && (this.isPaused = !1, this.isWorkerTimer ? this.plugin.startWorkerTimer(this.timerId, this.options) : this.startTime = performance.now() - this.pausedTime);
|
|
@@ -4735,7 +4778,7 @@ var Un = class {
|
|
|
4735
4778
|
removeTime(e) {
|
|
4736
4779
|
return this.addTime(-e);
|
|
4737
4780
|
}
|
|
4738
|
-
},
|
|
4781
|
+
}, Kn = class extends N {
|
|
4739
4782
|
get hasWorkerSupport() {
|
|
4740
4783
|
return this._hasWorkerSupport;
|
|
4741
4784
|
}
|
|
@@ -4777,7 +4820,7 @@ var Un = class {
|
|
|
4777
4820
|
this.addTickerCallback(this.update), this.initWorker();
|
|
4778
4821
|
}
|
|
4779
4822
|
initWorker() {
|
|
4780
|
-
typeof Worker < "u" ? (this.worker =
|
|
4823
|
+
typeof Worker < "u" ? (this.worker = Un(), this.worker ? (this._hasWorkerSupport = !0, this.worker.onmessage = this.handleWorkerMessage) : (S.warn("Failed to create Web Worker for TimerPlugin, all timers will run on main thread"), this._hasWorkerSupport = !1)) : (S.warn("Web Workers not supported in this environment, all timers will run on main thread"), this._hasWorkerSupport = !1);
|
|
4781
4824
|
}
|
|
4782
4825
|
startWorkerTimer(e, t) {
|
|
4783
4826
|
this.worker && (this.timerCallbacks.set(e, t), this.worker.postMessage({
|
|
@@ -4809,7 +4852,7 @@ var Un = class {
|
|
|
4809
4852
|
for (let e of this.mainThreadTimers) e.update();
|
|
4810
4853
|
}
|
|
4811
4854
|
createTimer(e) {
|
|
4812
|
-
let t = new
|
|
4855
|
+
let t = new Gn(e, this);
|
|
4813
4856
|
return t.isWorker() ? this.workerTimers.add(t) : this.mainThreadTimers.add(t), this.onTimerCreated.emit(t), t;
|
|
4814
4857
|
}
|
|
4815
4858
|
destroyTimer(e) {
|
|
@@ -4834,14 +4877,14 @@ var Un = class {
|
|
|
4834
4877
|
timeAdjustment: t
|
|
4835
4878
|
});
|
|
4836
4879
|
}
|
|
4837
|
-
},
|
|
4880
|
+
}, qn = class extends N {
|
|
4838
4881
|
constructor() {
|
|
4839
|
-
super(), this.id = "webEvents", this.onResize = new j(), this.onVisibilityChanged = new j(), this.onOrientationChanged = new j(), this._debouncedEmitVisibility =
|
|
4882
|
+
super(), this.id = "webEvents", this.onResize = new j(), this.onVisibilityChanged = new j(), this.onOrientationChanged = new j(), this._debouncedEmitVisibility = Pe((e) => {
|
|
4840
4883
|
this.onVisibilityChanged.emit(e);
|
|
4841
|
-
}, 1), this._orientationTimeoutId = null,
|
|
4884
|
+
}, 1), this._orientationTimeoutId = null, g(this);
|
|
4842
4885
|
}
|
|
4843
4886
|
get app() {
|
|
4844
|
-
return
|
|
4887
|
+
return Q.getInstance();
|
|
4845
4888
|
}
|
|
4846
4889
|
initialize() {
|
|
4847
4890
|
this.listen(document, "visibilitychange", this._onVisibilityChanged, !1), this.listen(window, "pagehide", this._onPageHide, !1), this.listen(window, "pageshow", this._onPageShow, !1), this.listen(window, "resize", this._onResize), this.listen(document, "fullscreenchange", this._onResize), this.listen(window, "orientationchange", this._onOrientationChanged), window.visualViewport && this.listen(window.visualViewport, "resize", this._onVisualViewportResize), this.addDisposer(() => {
|
|
@@ -4883,13 +4926,13 @@ var Un = class {
|
|
|
4883
4926
|
return;
|
|
4884
4927
|
}
|
|
4885
4928
|
this._orientationTimeoutId !== null && clearTimeout(this._orientationTimeoutId), this._orientationTimeoutId = setTimeout(() => {
|
|
4886
|
-
this._orientationTimeoutId = null, t =
|
|
4929
|
+
this._orientationTimeoutId = null, t = qe(), this.onOrientationChanged.emit({
|
|
4887
4930
|
orientation: t,
|
|
4888
4931
|
screenOrientation: n
|
|
4889
4932
|
});
|
|
4890
4933
|
}, 10);
|
|
4891
4934
|
}
|
|
4892
|
-
},
|
|
4935
|
+
}, Jn = class extends N {
|
|
4893
4936
|
constructor(...e) {
|
|
4894
4937
|
super(...e), this.name = "lookup", this.pathToContainer = /* @__PURE__ */ new Map(), this.containerToPath = /* @__PURE__ */ new Map();
|
|
4895
4938
|
}
|
|
@@ -4903,7 +4946,7 @@ var Un = class {
|
|
|
4903
4946
|
];
|
|
4904
4947
|
}
|
|
4905
4948
|
async initialize() {
|
|
4906
|
-
this.addSignalConnection(
|
|
4949
|
+
this.addSignalConnection(Z.onGlobalChildAdded.connect(this.onChildAdded), Z.onGlobalChildRemoved.connect(this.onChildRemoved));
|
|
4907
4950
|
}
|
|
4908
4951
|
destroy() {
|
|
4909
4952
|
this.pathToContainer.clear(), this.containerToPath.clear(), super.destroy();
|
|
@@ -4946,15 +4989,15 @@ var Un = class {
|
|
|
4946
4989
|
for (; n && n.label && (t.unshift(n.label), n = n.parent, n?.label !== "Stage"););
|
|
4947
4990
|
return t.length > 0 ? t.join("/") : "";
|
|
4948
4991
|
}
|
|
4949
|
-
},
|
|
4992
|
+
}, Yn = [
|
|
4950
4993
|
{
|
|
4951
4994
|
id: "lookup",
|
|
4952
|
-
module:
|
|
4995
|
+
module: Jn,
|
|
4953
4996
|
namedExport: "LookupPlugin"
|
|
4954
4997
|
},
|
|
4955
4998
|
{
|
|
4956
4999
|
id: "webEvents",
|
|
4957
|
-
module:
|
|
5000
|
+
module: qn,
|
|
4958
5001
|
namedExport: "WebEventsPlugin"
|
|
4959
5002
|
},
|
|
4960
5003
|
{
|
|
@@ -4964,12 +5007,12 @@ var Un = class {
|
|
|
4964
5007
|
},
|
|
4965
5008
|
{
|
|
4966
5009
|
id: "resizer",
|
|
4967
|
-
module:
|
|
5010
|
+
module: Ln,
|
|
4968
5011
|
namedExport: "ResizerPlugin"
|
|
4969
5012
|
},
|
|
4970
5013
|
{
|
|
4971
5014
|
id: "breakpoints",
|
|
4972
|
-
module:
|
|
5015
|
+
module: jt,
|
|
4973
5016
|
namedExport: "BreakpointPlugin"
|
|
4974
5017
|
},
|
|
4975
5018
|
{
|
|
@@ -4979,61 +5022,61 @@ var Un = class {
|
|
|
4979
5022
|
},
|
|
4980
5023
|
{
|
|
4981
5024
|
id: "scenes",
|
|
4982
|
-
module:
|
|
5025
|
+
module: Hn,
|
|
4983
5026
|
namedExport: "SceneManagerPlugin"
|
|
4984
5027
|
},
|
|
4985
5028
|
{
|
|
4986
5029
|
id: "actions",
|
|
4987
|
-
module:
|
|
5030
|
+
module: gt,
|
|
4988
5031
|
namedExport: "ActionsPlugin"
|
|
4989
5032
|
},
|
|
4990
5033
|
{
|
|
4991
5034
|
id: "input",
|
|
4992
|
-
module:
|
|
5035
|
+
module: Dn,
|
|
4993
5036
|
namedExport: "InputPlugin"
|
|
4994
5037
|
},
|
|
4995
5038
|
{
|
|
4996
5039
|
id: "gesture",
|
|
4997
|
-
module:
|
|
5040
|
+
module: un,
|
|
4998
5041
|
namedExport: "GesturePlugin"
|
|
4999
5042
|
},
|
|
5000
5043
|
{
|
|
5001
5044
|
id: "keyboard",
|
|
5002
|
-
module:
|
|
5045
|
+
module: ht,
|
|
5003
5046
|
namedExport: "KeyboardPlugin"
|
|
5004
5047
|
},
|
|
5005
5048
|
{
|
|
5006
5049
|
id: "focus",
|
|
5007
|
-
module:
|
|
5050
|
+
module: an,
|
|
5008
5051
|
namedExport: "FocusManagerPlugin"
|
|
5009
5052
|
},
|
|
5010
5053
|
{
|
|
5011
5054
|
id: "popups",
|
|
5012
|
-
module:
|
|
5055
|
+
module: Fn,
|
|
5013
5056
|
namedExport: "PopupManagerPlugin"
|
|
5014
5057
|
},
|
|
5015
5058
|
{
|
|
5016
5059
|
id: "audio",
|
|
5017
|
-
module:
|
|
5060
|
+
module: tn,
|
|
5018
5061
|
namedExport: "AudioManagerPlugin"
|
|
5019
5062
|
},
|
|
5020
5063
|
{
|
|
5021
5064
|
id: "i18n",
|
|
5022
|
-
module:
|
|
5065
|
+
module: pn,
|
|
5023
5066
|
namedExport: "i18nPlugin"
|
|
5024
5067
|
},
|
|
5025
5068
|
{
|
|
5026
5069
|
id: "timers",
|
|
5027
|
-
module:
|
|
5070
|
+
module: Kn,
|
|
5028
5071
|
namedExport: "TimerPlugin"
|
|
5029
5072
|
}
|
|
5030
5073
|
];
|
|
5031
5074
|
//#endregion
|
|
5032
5075
|
//#region src/core/Application.ts
|
|
5033
|
-
function
|
|
5076
|
+
function Xn() {
|
|
5034
5077
|
return typeof window < "u" ? window.devicePixelRatio > 1 ? 2 : 1 : 2;
|
|
5035
5078
|
}
|
|
5036
|
-
var
|
|
5079
|
+
var Zn = {
|
|
5037
5080
|
antialias: !1,
|
|
5038
5081
|
autoStart: !0,
|
|
5039
5082
|
resizeToContainer: !0,
|
|
@@ -5071,10 +5114,10 @@ var Yn = {
|
|
|
5071
5114
|
wordWrap: !1,
|
|
5072
5115
|
wordWrapWidth: 100
|
|
5073
5116
|
},
|
|
5074
|
-
resolution:
|
|
5075
|
-
useHash:
|
|
5076
|
-
showSceneDebugMenu:
|
|
5077
|
-
showStats:
|
|
5117
|
+
resolution: Xn(),
|
|
5118
|
+
useHash: v,
|
|
5119
|
+
showSceneDebugMenu: v,
|
|
5120
|
+
showStats: v,
|
|
5078
5121
|
useStore: !0,
|
|
5079
5122
|
useSpine: !1,
|
|
5080
5123
|
useLayout: !1,
|
|
@@ -5083,17 +5126,17 @@ var Yn = {
|
|
|
5083
5126
|
scenes: [],
|
|
5084
5127
|
defaultSceneLoadMethod: "immediate",
|
|
5085
5128
|
assets: { manifest: "./assets.json" }
|
|
5086
|
-
},
|
|
5129
|
+
}, Qn = {
|
|
5087
5130
|
pauseAudio: !0,
|
|
5088
5131
|
pauseAnimations: !0,
|
|
5089
5132
|
pauseTicker: !0,
|
|
5090
5133
|
pauseTimers: !0
|
|
5091
|
-
},
|
|
5134
|
+
}, $n = {
|
|
5092
5135
|
pauseAudio: !1,
|
|
5093
5136
|
pauseAnimations: !1,
|
|
5094
5137
|
pauseTicker: !1,
|
|
5095
5138
|
pauseTimers: !1
|
|
5096
|
-
},
|
|
5139
|
+
}, Q = class r extends e {
|
|
5097
5140
|
static {
|
|
5098
5141
|
this.__caper_method_binding_root = !0;
|
|
5099
5142
|
}
|
|
@@ -5114,7 +5157,7 @@ var Yn = {
|
|
|
5114
5157
|
}
|
|
5115
5158
|
pause(e) {
|
|
5116
5159
|
this._paused = !0, this._pauseConfig = {
|
|
5117
|
-
...e ?
|
|
5160
|
+
...e ? $n : Qn,
|
|
5118
5161
|
...e
|
|
5119
5162
|
}, this._pauseConfig.pauseAudio && this.audio.pause(), this._pauseConfig.pauseAnimations && p?.globalTimeline?.pause(), this._pauseConfig.pauseTicker && this.ticker.stop(), this._pauseConfig.pauseTimers && this.timers.pauseAllTimers(), this._pauseConfig.pauseOther && this._pauseConfig.pauseOther.forEach((e) => {
|
|
5120
5163
|
typeof e?.pause == "function" && e.pause();
|
|
@@ -5135,7 +5178,7 @@ var Yn = {
|
|
|
5135
5178
|
MODE: "production",
|
|
5136
5179
|
PROD: !0,
|
|
5137
5180
|
SSR: !1
|
|
5138
|
-
}, this._isFullScreen = !1, this._fullScreenElement = null, this._paused = !1, this._pauseConfig = {}, this._center = new c(0, 0),
|
|
5181
|
+
}, this._isFullScreen = !1, this._fullScreenElement = null, this._paused = !1, this._pauseConfig = {}, this._center = new c(0, 0), g(this);
|
|
5139
5182
|
}
|
|
5140
5183
|
get appVersion() {
|
|
5141
5184
|
try {
|
|
@@ -5281,13 +5324,13 @@ var Yn = {
|
|
|
5281
5324
|
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
5282
5325
|
}
|
|
5283
5326
|
get signal() {
|
|
5284
|
-
return
|
|
5327
|
+
return er;
|
|
5285
5328
|
}
|
|
5286
5329
|
get signals() {
|
|
5287
5330
|
return this.signal;
|
|
5288
5331
|
}
|
|
5289
5332
|
get func() {
|
|
5290
|
-
return
|
|
5333
|
+
return $;
|
|
5291
5334
|
}
|
|
5292
5335
|
get exec() {
|
|
5293
5336
|
return this.func;
|
|
@@ -5297,7 +5340,7 @@ var Yn = {
|
|
|
5297
5340
|
return this.scenes.splash.view && e.push(this.scenes.splash.view), this.scenes.transition && e.push(this.scenes.transition), this.captions?.view && e.push(this.captions.view), e;
|
|
5298
5341
|
}
|
|
5299
5342
|
static getInstance() {
|
|
5300
|
-
return r.instance ||
|
|
5343
|
+
return r.instance || S.warn("Application not created yet"), r.instance;
|
|
5301
5344
|
}
|
|
5302
5345
|
destroy(e, t) {
|
|
5303
5346
|
this._plugins.forEach((e) => {
|
|
@@ -5309,26 +5352,26 @@ var Yn = {
|
|
|
5309
5352
|
}
|
|
5310
5353
|
async initialize(e, t) {
|
|
5311
5354
|
if (r.instance) throw Error("Application is already initialized");
|
|
5312
|
-
if (r.instance = this, this.config =
|
|
5355
|
+
if (r.instance = this, this.config = E(Zn, e), this.signals.onResize = this.onResize, e.container && (r.containerElement = e.container), S.initialize(this.config.logger), this.config.resolution !== 1 && this.config.resolution !== 2) {
|
|
5313
5356
|
let e = this.config.resolution;
|
|
5314
|
-
this.config.resolution =
|
|
5357
|
+
this.config.resolution = Xn(), S.warn(`App resolution must be 1 or 2, setting to ${this.config.resolution} instead of ${e}. Modify your app config to set the resolution to 1 or 2.`);
|
|
5315
5358
|
}
|
|
5316
5359
|
if (await this.boot(this.config), await this.initAssets(), await this.init(this.config), this.stage.label = "Stage", this.config.defaultTextStyle && (l.defaultTextStyle = {
|
|
5317
|
-
...
|
|
5360
|
+
...Zn.defaultTextStyle,
|
|
5318
5361
|
...this.config.defaultTextStyle
|
|
5319
5362
|
}), this.config.defaultDropShadow && (l.defaultDropShadow = this.config.defaultDropShadow), t) t.appendChild(this.canvas), this.setContainer(t);
|
|
5320
5363
|
else throw Error("No element found to append the view to.");
|
|
5321
|
-
return await this.registerDefaultPlugins(),
|
|
5364
|
+
return await this.registerDefaultPlugins(), v && this.getPlugin("DevToolsPlugin").initializeDevTools(this), this.signals.onLoadRequiredComplete.connectOnce(this.requiredAssetsLoaded), await this._setup(), this.plugins = await Je(this.config.plugins || []), await this.registerPlugins(), await this.setup(), await this.loadDefaultScene(), this.renderer.canvas.focus(), this.config.container && this.config.container.classList.add("loaded"), r.instance;
|
|
5322
5365
|
}
|
|
5323
5366
|
getPlugin(e, t = !1) {
|
|
5324
5367
|
let n = this._plugins.get(e);
|
|
5325
|
-
return !n && t &&
|
|
5368
|
+
return !n && t && S.warn(`Plugin with name "${e}" not found.`), n;
|
|
5326
5369
|
}
|
|
5327
5370
|
async _postInitialize() {
|
|
5328
5371
|
for (let e of this._plugins.values()) try {
|
|
5329
5372
|
await e.postInitialize(this);
|
|
5330
5373
|
} catch (t) {
|
|
5331
|
-
|
|
5374
|
+
w({
|
|
5332
5375
|
message: `Plugin "${e.id}" failed in postInitialize: ${t instanceof Error ? t.message : String(t)}`,
|
|
5333
5376
|
stack: t instanceof Error ? t.stack : void 0
|
|
5334
5377
|
}), this.onPluginError.emit({
|
|
@@ -5359,7 +5402,7 @@ var Yn = {
|
|
|
5359
5402
|
}
|
|
5360
5403
|
async loadPlugin(e, t = !1) {
|
|
5361
5404
|
if (this._plugins.has(e.id)) return await this.registerPlugin(this._plugins.get(e.id), e.options);
|
|
5362
|
-
let n = new (await (
|
|
5405
|
+
let n = new (await (T(e)))(e.id);
|
|
5363
5406
|
n.id !== e.id && (n.id = e.id);
|
|
5364
5407
|
let r = e.options;
|
|
5365
5408
|
return t && !r && (r = this.config[n.id]), await this.registerPlugin(n, r);
|
|
@@ -5381,42 +5424,42 @@ var Yn = {
|
|
|
5381
5424
|
}
|
|
5382
5425
|
async boot(e) {
|
|
5383
5426
|
this.config = {
|
|
5384
|
-
...
|
|
5427
|
+
...Zn,
|
|
5385
5428
|
...e
|
|
5386
5429
|
}, await this.preInitialize(this.config);
|
|
5387
5430
|
}
|
|
5388
5431
|
async preInitialize(e) {
|
|
5389
5432
|
let { id: t } = e;
|
|
5390
|
-
this._appName = t,
|
|
5433
|
+
this._appName = t, v && await this.loadPlugin({
|
|
5391
5434
|
id: "DevToolsPlugin",
|
|
5392
|
-
module: () => import("./DevToolsPlugin-
|
|
5435
|
+
module: () => import("./DevToolsPlugin-CQXFoj1T.js"),
|
|
5393
5436
|
namedExport: "DevToolsPlugin"
|
|
5394
5437
|
}), e.useLayout && await this.loadPlugin({
|
|
5395
5438
|
id: "LayoutPlugin",
|
|
5396
|
-
module: () => import("./LayoutPlugin-
|
|
5439
|
+
module: () => import("./LayoutPlugin-BuJgr9bd.js"),
|
|
5397
5440
|
namedExport: "LayoutPlugin"
|
|
5398
5441
|
}), await this.loadPlugin({
|
|
5399
5442
|
id: "GSAPPlugin",
|
|
5400
|
-
module: () => import("./GSAPPlugin-
|
|
5443
|
+
module: () => import("./GSAPPlugin-CNkncyXS.js"),
|
|
5401
5444
|
namedExport: "GSAPPlugin"
|
|
5402
5445
|
}), e.useSpine && await this.loadPlugin({
|
|
5403
5446
|
id: "SpinePlugin",
|
|
5404
|
-
module: () => import("./SpinePlugin-
|
|
5447
|
+
module: () => import("./SpinePlugin-DDzD-Qxd.js"),
|
|
5405
5448
|
namedExport: "SpinePlugin"
|
|
5406
5449
|
}), this.config.useStore && (this._store = new lt(), this._store.initialize(this), await this.loadPlugin({
|
|
5407
5450
|
id: "data",
|
|
5408
|
-
module: () => import("./DataAdapter-
|
|
5451
|
+
module: () => import("./DataAdapter-T-22-_D1.js").then((e) => e.n),
|
|
5409
5452
|
namedExport: "DataAdapter",
|
|
5410
5453
|
options: this.config.data
|
|
5411
5454
|
}));
|
|
5412
5455
|
}
|
|
5413
5456
|
async registerPlugin(e, t) {
|
|
5414
|
-
if (this._plugins.has(e.id)) return
|
|
5457
|
+
if (this._plugins.has(e.id)) return S.warn(`Plugin with id "${e.id}" already registered. Not registering.`), e.initialize(t, this);
|
|
5415
5458
|
e.registerCoreFunctions(), e.registerCoreSignals(), this._plugins.set(e.id, e);
|
|
5416
5459
|
try {
|
|
5417
5460
|
return await e.initialize(t, this);
|
|
5418
5461
|
} catch (t) {
|
|
5419
|
-
|
|
5462
|
+
w({
|
|
5420
5463
|
message: `Plugin "${e.id}" failed to initialize: ${t instanceof Error ? t.message : String(t)}`,
|
|
5421
5464
|
stack: t instanceof Error ? t.stack : void 0
|
|
5422
5465
|
}), this.onPluginError.emit({
|
|
@@ -5428,40 +5471,40 @@ var Yn = {
|
|
|
5428
5471
|
}
|
|
5429
5472
|
}
|
|
5430
5473
|
async registerDefaultPlugins() {
|
|
5431
|
-
for (let e = 0; e <
|
|
5432
|
-
let t =
|
|
5474
|
+
for (let e = 0; e < Yn.length; e++) {
|
|
5475
|
+
let t = Yn[e];
|
|
5433
5476
|
await this.loadPlugin(t, !0);
|
|
5434
5477
|
}
|
|
5435
|
-
(this.config.showStats === !0 ||
|
|
5478
|
+
(this.config.showStats === !0 || v && this.config.showStats !== !1) && await this.loadPlugin({
|
|
5436
5479
|
id: "stats",
|
|
5437
|
-
module: () => import("./StatsPlugin-
|
|
5480
|
+
module: () => import("./StatsPlugin-tyFGzVjy.js"),
|
|
5438
5481
|
namedExport: "StatsPlugin"
|
|
5439
|
-
}),
|
|
5482
|
+
}), Bn() && await this.loadPlugin({
|
|
5440
5483
|
id: "screenDebug",
|
|
5441
|
-
module: () => import("./ScreenDebugPlugin-
|
|
5484
|
+
module: () => import("./ScreenDebugPlugin-kz9Mr6j1.js").then((e) => e.n),
|
|
5442
5485
|
namedExport: "ScreenDebugPlugin"
|
|
5443
5486
|
}), this.config.useVoiceover && (await this.loadPlugin({
|
|
5444
5487
|
id: "voiceover",
|
|
5445
|
-
module: () => import("./VoiceOverPlugin-
|
|
5488
|
+
module: () => import("./VoiceOverPlugin-rTNz_9eb.js"),
|
|
5446
5489
|
namedExport: "VoiceOverPlugin",
|
|
5447
5490
|
options: this.config.voiceover || void 0
|
|
5448
5491
|
}), await this.loadPlugin({
|
|
5449
5492
|
id: "captions",
|
|
5450
|
-
module: () => import("./CaptionsPlugin-
|
|
5493
|
+
module: () => import("./CaptionsPlugin-COrofpHN.js"),
|
|
5451
5494
|
namedExport: "CaptionsPlugin",
|
|
5452
5495
|
options: this.config.captions || void 0
|
|
5453
5496
|
}));
|
|
5454
5497
|
}
|
|
5455
5498
|
async registerPlugins() {
|
|
5456
5499
|
if (!this.plugins?.length) return;
|
|
5457
|
-
let e =
|
|
5500
|
+
let e = Xe(this.plugins, new Set(this._plugins.keys()));
|
|
5458
5501
|
for (let t of e) t.autoLoad && await this.loadPlugin(t);
|
|
5459
5502
|
}
|
|
5460
5503
|
async requiredAssetsLoaded() {}
|
|
5461
5504
|
async setup() {}
|
|
5462
5505
|
async initAssets() {
|
|
5463
5506
|
let e = this.config.assets?.initOptions || {}, n = this.config.assets?.manifest || e.manifest;
|
|
5464
|
-
|
|
5507
|
+
Ce(n) && (n = await n), e.manifest = n, e.basePath = e.basePath || "./assets", await t.init(e), this.manifest = t.resolver._manifest;
|
|
5465
5508
|
}
|
|
5466
5509
|
async loadDefaultScene() {
|
|
5467
5510
|
return this.scenes.loadDefaultScene();
|
|
@@ -5483,8 +5526,8 @@ var Yn = {
|
|
|
5483
5526
|
_addSplash() {
|
|
5484
5527
|
this.scenes.splash.view && (this.scenes.splash.view.label = "Splash", this.stage.addChild(this.scenes.splash.view));
|
|
5485
5528
|
}
|
|
5486
|
-
},
|
|
5529
|
+
}, er = {}, $ = {};
|
|
5487
5530
|
//#endregion
|
|
5488
|
-
export {
|
|
5531
|
+
export { Xe as $, Nt as A, y as At, ht as B, fe as Bt, X as C, Te as Ct, an as D, Se as Dt, cn as E, Ce as Et, vt as F, g as Ft, M as G, se as Gt, pt as H, me as Ht, yt as I, ge as It, A as J, lt as K, le as Kt, xt as L, ve as Lt, jt as M, _ as Mt, R as N, v as Nt, nn as O, C as Ot, _t as P, ye as Pt, Je as Q, bt as R, he as Rt, mn as S, T as St, un as T, xe as Tt, ft as U, ue as Ut, F as V, pe as Vt, N as W, h as Wt, Qe as X, O as Y, Ye as Z, kn as _, Me as _t, qn as a, He as at, wn as b, Oe as bt, Wn as c, Ke as ct, Ln as d, E as dt, qe as et, Fn as f, Ie as ft, An as g, je as gt, Mn as h, Ne as ht, Jn as i, We as it, Mt as j, be as jt, tn as k, S as kt, Hn as l, ze as lt, Nn as m, Pe as mt, er as n, Re as nt, Gn as o, Ge as ot, Z as p, Fe as pt, j as q, Q as r, Ue as rt, Kn as s, Ve as st, $ as t, Le as tt, Bn as u, Be as ut, Dn as v, Ae as vt, pn as w, we as wt, Cn as x, De as xt, Tn as y, ke as yt, gt as z, de as zt };
|
|
5489
5532
|
|
|
5490
|
-
//# sourceMappingURL=registries-
|
|
5533
|
+
//# sourceMappingURL=registries-DmNGVLAi.js.map
|