@puzzmo/sdk 1.0.81 → 1.0.82
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/dist/analytics.d.ts.map +1 -1
- package/dist/bootstrapPayload.d.ts.map +1 -1
- package/dist/bootstrapPayload.spec.d.ts.map +1 -1
- package/dist/bundles.cjs +1 -1
- package/dist/bundles.cjs.map +1 -1
- package/dist/bundles.d.ts +10 -2
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +2 -2
- package/dist/bundles.js.map +1 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/createSimulator-CIE72Xs2.cjs +2233 -0
- package/dist/createSimulator-CIE72Xs2.cjs.map +1 -0
- package/dist/{createSimulator-2M7vXzRZ.js → createSimulator-Dz1KYZ25.js} +1579 -596
- package/dist/createSimulator-Dz1KYZ25.js.map +1 -0
- package/dist/easing.d.ts +6 -0
- package/dist/easing.d.ts.map +1 -0
- package/dist/editor.d.ts +25 -3
- package/dist/editor.d.ts.map +1 -1
- package/dist/fontFiles.gen.d.ts.map +1 -1
- package/dist/fonts-CP_kAAac.js +83 -0
- package/dist/fonts-CP_kAAac.js.map +1 -0
- package/dist/fonts-CS5qdLf3.cjs +3 -0
- package/dist/fonts-CS5qdLf3.cjs.map +1 -0
- package/dist/fonts.cjs +1 -3
- package/dist/fonts.d.ts +2 -0
- package/dist/fonts.d.ts.map +1 -1
- package/dist/fonts.js +2 -83
- package/dist/gameTracker.d.ts.map +1 -1
- package/dist/global.d.ts.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inputs/decoder.d.ts.map +1 -1
- package/dist/inputs/encoder.d.ts.map +1 -1
- package/dist/inputs/encodings.d.ts.map +1 -1
- package/dist/inputs/index.d.ts.map +1 -1
- package/dist/inputs/inputStringEncoder.spec.d.ts.map +1 -1
- package/dist/inputs/migration.d.ts.map +1 -1
- package/dist/inputs/types.d.ts.map +1 -1
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.spec.d.ts.map +1 -1
- package/dist/{lua-DKb2Tu2V.js → lua-B8exrfmB.js} +1 -1
- package/dist/{lua-DKb2Tu2V.js.map → lua-B8exrfmB.js.map} +1 -1
- package/dist/{lua-CclI-QKD.cjs → lua-C5r7UXeR.cjs} +1 -1
- package/dist/{lua-CclI-QKD.cjs.map → lua-C5r7UXeR.cjs.map} +1 -1
- package/dist/pico8/channel.d.ts.map +1 -1
- package/dist/pico8/index.cjs +1 -1
- package/dist/pico8/index.d.ts.map +1 -1
- package/dist/pico8/index.js +1 -1
- package/dist/pico8/lua.d.ts.map +1 -1
- package/dist/pico8/palette.d.ts.map +1 -1
- package/dist/pico8/pico8.spec.d.ts.map +1 -1
- package/dist/pico8/protocol.d.ts.map +1 -1
- package/dist/pico8/vitePlugin.d.ts.map +1 -1
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.spec.d.ts.map +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.gameCompleted.spec.d.ts.map +1 -1
- package/dist/sdk.gameReady.spec.d.ts.map +1 -1
- package/dist/sdk.pause.spec.d.ts.map +1 -1
- package/dist/sdk.session.spec.d.ts.map +1 -1
- package/dist/settings.spec.d.ts.map +1 -1
- package/dist/simulator/checklistProgress.d.ts.map +1 -1
- package/dist/simulator/checklistProgress.spec.d.ts.map +1 -1
- package/dist/simulator/createSimulator.d.ts.map +1 -1
- package/dist/simulator/dockedKeyboard.d.ts.map +1 -1
- package/dist/simulator/fixtures.d.ts.map +1 -1
- package/dist/simulator/index.cjs +1 -1
- package/dist/simulator/index.d.ts.map +1 -1
- package/dist/simulator/index.js +2 -1
- package/dist/simulator/marker.d.ts.map +1 -1
- package/dist/simulator/messaging.d.ts.map +1 -1
- package/dist/simulator/normalizeThumbnail.d.ts.map +1 -1
- package/dist/simulator/pmmgOverlay.d.ts +36 -0
- package/dist/simulator/pmmgOverlay.d.ts.map +1 -0
- package/dist/simulator/pmmgOverlay.spec.d.ts +2 -0
- package/dist/simulator/pmmgOverlay.spec.d.ts.map +1 -0
- package/dist/simulator/pmmgRenderer.d.ts +86 -0
- package/dist/simulator/pmmgRenderer.d.ts.map +1 -0
- package/dist/simulator/pmmgRenderer.spec.d.ts +2 -0
- package/dist/simulator/pmmgRenderer.spec.d.ts.map +1 -0
- package/dist/simulator/standalone.cjs +1 -1
- package/dist/simulator/standalone.cjs.map +1 -1
- package/dist/simulator/standalone.d.ts.map +1 -1
- package/dist/simulator/standalone.js +2 -1
- package/dist/simulator/standalone.js.map +1 -1
- package/dist/simulator/state.d.ts +19 -0
- package/dist/simulator/state.d.ts.map +1 -1
- package/dist/simulator/state.spec.d.ts.map +1 -1
- package/dist/simulator/styles.d.ts +1 -1
- package/dist/simulator/styles.d.ts.map +1 -1
- package/dist/simulator/types.d.ts +5 -0
- package/dist/simulator/types.d.ts.map +1 -1
- package/dist/simulator/views/AuthView.d.ts.map +1 -1
- package/dist/simulator/views/ChecklistView.d.ts.map +1 -1
- package/dist/simulator/views/CheckpointsView.d.ts.map +1 -1
- package/dist/simulator/views/CtrlView.d.ts.map +1 -1
- package/dist/simulator/views/DataView.d.ts.map +1 -1
- package/dist/simulator/views/DoneView.d.ts.map +1 -1
- package/dist/simulator/views/FeaturesView.d.ts.map +1 -1
- package/dist/simulator/views/HostView.d.ts.map +1 -1
- package/dist/simulator/views/KeyboardView.d.ts.map +1 -1
- package/dist/simulator/views/MsgsView.d.ts.map +1 -1
- package/dist/simulator/views/PmmgView.d.ts +7 -0
- package/dist/simulator/views/PmmgView.d.ts.map +1 -0
- package/dist/simulator/views/SettingsView.d.ts.map +1 -1
- package/dist/simulator/views/SoundView.d.ts.map +1 -1
- package/dist/simulator/views/ThemeView.d.ts.map +1 -1
- package/dist/simulator/views/ThumbView.d.ts.map +1 -1
- package/dist/simulator/views/index.d.ts +1 -0
- package/dist/simulator/views/index.d.ts.map +1 -1
- package/dist/svgJSX.d.ts.map +1 -1
- package/dist/tableBoard-B0I9wVQq.js +635 -0
- package/dist/tableBoard-B0I9wVQq.js.map +1 -0
- package/dist/tableBoard-CLDBwRYs.cjs +2 -0
- package/dist/tableBoard-CLDBwRYs.cjs.map +1 -0
- package/dist/tableBoard.cjs +1 -0
- package/dist/tableBoard.d.ts +138 -0
- package/dist/tableBoard.d.ts.map +1 -0
- package/dist/tableBoard.js +2 -0
- package/dist/tableBoardScene.d.ts +21 -0
- package/dist/tableBoardScene.d.ts.map +1 -0
- package/dist/themes.d.ts +16 -16
- package/dist/themes.d.ts.map +1 -1
- package/dist/types.d.ts +161 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vite.cjs +3 -3
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.ts +20 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +72 -16
- package/dist/vite.js.map +1 -1
- package/package.json +5 -5
- package/dist/createSimulator-2M7vXzRZ.js.map +0 -1
- package/dist/createSimulator-B4QlohUV.cjs +0 -1930
- package/dist/createSimulator-B4QlohUV.cjs.map +0 -1
- package/dist/fonts.cjs.map +0 -1
- package/dist/fonts.js.map +0 -1
- package/dist/thumbnailMotion.cjs +0 -5
- package/dist/thumbnailMotion.cjs.map +0 -1
- package/dist/thumbnailMotion.d.ts +0 -119
- package/dist/thumbnailMotion.d.ts.map +0 -1
- package/dist/thumbnailMotion.js +0 -480
- package/dist/thumbnailMotion.js.map +0 -1
- package/dist/thumbnailMotion.spec.d.ts +0 -2
- package/dist/thumbnailMotion.spec.d.ts.map +0 -1
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
import { n as e, t } from "./objectSpread2-BJrS9rM5.js";
|
|
2
|
+
import { t as n } from "./asyncToGenerator-DSd3oTwb.js";
|
|
3
|
+
/**
|
|
4
|
+
* Turns a CSS easing into a progress function: keywords, cubic-bezier() and linear() with optional stops. Anything
|
|
5
|
+
* else (`steps()`, or a malformed value) is linear.
|
|
6
|
+
*/
|
|
7
|
+
const r = (e) => {
|
|
8
|
+
let t = e.trim();
|
|
9
|
+
if (t === "linear") return i;
|
|
10
|
+
let n = a[t];
|
|
11
|
+
if (n) return o(n[0], n[1], n[2], n[3]);
|
|
12
|
+
let r = /^cubic-bezier\(([^)]+)\)$/.exec(t);
|
|
13
|
+
if (r) {
|
|
14
|
+
let e = r[1].split(",").map(Number);
|
|
15
|
+
return e.length !== 4 || e.some((e) => Number.isNaN(e)) ? i : o(e[0], e[1], e[2], e[3]);
|
|
16
|
+
}
|
|
17
|
+
let c = /^linear\(([^)]+)\)$/.exec(t);
|
|
18
|
+
return c ? s(c[1]) : i;
|
|
19
|
+
};
|
|
20
|
+
var i = (e) => e, a = {
|
|
21
|
+
ease: [
|
|
22
|
+
.25,
|
|
23
|
+
.1,
|
|
24
|
+
.25,
|
|
25
|
+
1
|
|
26
|
+
],
|
|
27
|
+
"ease-in": [
|
|
28
|
+
.42,
|
|
29
|
+
0,
|
|
30
|
+
1,
|
|
31
|
+
1
|
|
32
|
+
],
|
|
33
|
+
"ease-out": [
|
|
34
|
+
0,
|
|
35
|
+
0,
|
|
36
|
+
.58,
|
|
37
|
+
1
|
|
38
|
+
],
|
|
39
|
+
"ease-in-out": [
|
|
40
|
+
.42,
|
|
41
|
+
0,
|
|
42
|
+
.58,
|
|
43
|
+
1
|
|
44
|
+
]
|
|
45
|
+
}, o = (e, t, n, r) => {
|
|
46
|
+
let i = (t) => 3 * e * t * (1 - t) * (1 - t) + 3 * n * t * t * (1 - t) + t * t * t, a = (e) => 3 * t * e * (1 - e) * (1 - e) + 3 * r * e * e * (1 - e) + e * e * e;
|
|
47
|
+
return (e) => {
|
|
48
|
+
let t = 0, n = 1, r = e;
|
|
49
|
+
for (let a = 0; a < 24; a++) {
|
|
50
|
+
let a = i(r);
|
|
51
|
+
if (Math.abs(a - e) < 1e-5) break;
|
|
52
|
+
a < e ? t = r : n = r, r = (t + n) / 2;
|
|
53
|
+
}
|
|
54
|
+
return a(r);
|
|
55
|
+
};
|
|
56
|
+
}, s = (e) => {
|
|
57
|
+
let t = e.split(",").map((e) => {
|
|
58
|
+
let t = e.trim().split(/\s+/);
|
|
59
|
+
return {
|
|
60
|
+
value: Number(t[0]),
|
|
61
|
+
at: t[1] ? parseFloat(t[1]) / 100 : NaN
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
if (t.some((e) => Number.isNaN(e.value))) return i;
|
|
65
|
+
Number.isNaN(t[0].at) && (t[0].at = 0), Number.isNaN(t[t.length - 1].at) && (t[t.length - 1].at = 1);
|
|
66
|
+
let n = 0;
|
|
67
|
+
for (let e = 0; e < t.length; e++) {
|
|
68
|
+
if (!Number.isNaN(t[e].at)) {
|
|
69
|
+
n = e;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
let r = e;
|
|
73
|
+
for (; Number.isNaN(t[r].at);) r++;
|
|
74
|
+
for (let e = n + 1; e < r; e++) t[e].at = t[n].at + (t[r].at - t[n].at) * (e - n) / (r - n);
|
|
75
|
+
n = r;
|
|
76
|
+
}
|
|
77
|
+
return (e) => {
|
|
78
|
+
if (e <= t[0].at) return t[0].value;
|
|
79
|
+
for (let n = 1; n < t.length; n++) if (e <= t[n].at) {
|
|
80
|
+
let r = t[n - 1], i = t[n];
|
|
81
|
+
return r.value + (i.value - r.value) * (e - r.at) / (i.at - r.at || 1);
|
|
82
|
+
}
|
|
83
|
+
return t[t.length - 1].value;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/** The most of each thing one scene can hold */
|
|
87
|
+
const c = {
|
|
88
|
+
nodes: 5e3,
|
|
89
|
+
effects: 5e3,
|
|
90
|
+
keyframes: 32,
|
|
91
|
+
ms: 1e4,
|
|
92
|
+
size: 1e5,
|
|
93
|
+
text: 200,
|
|
94
|
+
depth: 16,
|
|
95
|
+
brightness: 10
|
|
96
|
+
}, l = (e) => {
|
|
97
|
+
let t = _(e, "The scene"), n = x(t.width, "The scene's width", c.size), r = x(t.height, "The scene's height", c.size), i = v(t.nodes, "The scene's nodes", c.nodes), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map(), s = [], l = /* @__PURE__ */ new Set(), u = {
|
|
98
|
+
width: n,
|
|
99
|
+
height: r,
|
|
100
|
+
nodes: i.map((e, t) => {
|
|
101
|
+
let n = d(e, `Node ${t}`);
|
|
102
|
+
if (a.has(n.key)) throw Error(`Node ${t}'s key "${n.key}" is used twice`);
|
|
103
|
+
if (n.parent !== void 0 && !a.has(n.parent)) throw Error(`Node "${n.key}"'s parent "${n.parent}" must come before it`);
|
|
104
|
+
a.add(n.key), o.set(n.key, n.parent);
|
|
105
|
+
let r = /* @__PURE__ */ new Set();
|
|
106
|
+
for (let e = n.parent; e !== void 0; e = o.get(e)) r.add(e);
|
|
107
|
+
if (r.size >= c.depth) throw Error(`Node "${n.key}" is nested over ${c.depth} nodes deep`);
|
|
108
|
+
for (; s.length && !r.has(s[s.length - 1]);) l.add(s.pop());
|
|
109
|
+
let i = [...r].find((e) => l.has(e));
|
|
110
|
+
if (i) throw Error(`Node "${n.key}" is in isolated "${i}", so it must come straight after its other children`);
|
|
111
|
+
return n.isolate && s.push(n.key), n;
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
return t.grid !== void 0 && (u.grid = x(t.grid, "The scene's grid", n)), t.transition !== void 0 && (u.transition = h(t.transition, "The scene's transition")), t.effects !== void 0 && (u.effects = v(t.effects, "The scene's effects", c.effects).map((e, t) => {
|
|
115
|
+
let n = f(e, `Effect ${t}`);
|
|
116
|
+
if (!a.has(n.key)) throw Error(`Effect ${t} is for "${n.key}", which isn't in the scene`);
|
|
117
|
+
return n;
|
|
118
|
+
})), u;
|
|
119
|
+
}, u = (e) => {
|
|
120
|
+
var t;
|
|
121
|
+
let n = /* @__PURE__ */ new Set(), r = (e) => e == null ? void 0 : e.keyframes.forEach((e) => e.sprite && n.add(e.sprite));
|
|
122
|
+
for (let t of e.nodes) t.sprite && n.add(t.sprite), r(t.enter), r(t.exit);
|
|
123
|
+
return (t = e.effects) == null || t.forEach(r), n;
|
|
124
|
+
};
|
|
125
|
+
var d = (e, t) => {
|
|
126
|
+
let n = _(e, t), r = {
|
|
127
|
+
key: y(n.key, `${t}'s key`),
|
|
128
|
+
x: b(n.x, `${t}'s x`),
|
|
129
|
+
y: b(n.y, `${t}'s y`)
|
|
130
|
+
};
|
|
131
|
+
if (n.sprite !== void 0 && (r.sprite = y(n.sprite, `${t}'s sprite`)), n.parent !== void 0 && (r.parent = y(n.parent, `${t}'s parent`)), n.blend !== void 0) {
|
|
132
|
+
if (!g.includes(n.blend)) throw Error(`${t}'s blend must be one of ${g.join(", ")}`);
|
|
133
|
+
r.blend = n.blend;
|
|
134
|
+
}
|
|
135
|
+
return n.isolate === !0 && (r.isolate = !0), Object.assign(r, p(n, t)), n.transition === !1 ? r.transition = !1 : n.transition !== void 0 && (r.transition = h(n.transition, `${t}'s transition`)), n.enter !== void 0 && (r.enter = m(n.enter, `${t}'s enter`)), n.exit !== void 0 && (r.exit = m(n.exit, `${t}'s exit`)), r;
|
|
136
|
+
}, f = (e, n) => {
|
|
137
|
+
let r = _(e, n), i = t({ key: y(r.key, `${n}'s key`) }, m(r, n));
|
|
138
|
+
if (r.iterations !== void 0) {
|
|
139
|
+
let e = Number(r.iterations);
|
|
140
|
+
if (!(e >= 1)) throw Error(`${n}'s iterations must be 1 or more`);
|
|
141
|
+
i.iterations = e;
|
|
142
|
+
}
|
|
143
|
+
return i;
|
|
144
|
+
}, p = (e, t) => {
|
|
145
|
+
let n = {};
|
|
146
|
+
return e.rotation !== void 0 && (n.rotation = b(e.rotation, `${t}'s rotation`)), e.scale !== void 0 && (n.scale = S(e.scale, `${t}'s scale`)), e.opacity !== void 0 && (n.opacity = C(b(e.opacity, `${t}'s opacity`), 0, 1)), e.brightness !== void 0 && (n.brightness = C(b(e.brightness, `${t}'s brightness`), 0, c.brightness)), e.tint !== void 0 && (n.tint = y(e.tint, `${t}'s tint`)), n;
|
|
147
|
+
}, m = (e, n) => {
|
|
148
|
+
let r = _(e, n), i = -1, a = v(r.keyframes, `${n}'s keyframes`, c.keyframes).map((e, r) => {
|
|
149
|
+
let a = `${n}'s keyframe ${r}`, o = _(e, a), s = b(o.offset, `${a}'s offset`);
|
|
150
|
+
if (s < 0 || s > 1 || s < i) throw Error(`${a}'s offset must be from 0 to 1, in order`);
|
|
151
|
+
i = s;
|
|
152
|
+
let c = t({ offset: s }, p(o, a));
|
|
153
|
+
return o.x !== void 0 && (c.x = b(o.x, `${a}'s x`)), o.y !== void 0 && (c.y = b(o.y, `${a}'s y`)), o.easing !== void 0 && (c.easing = y(o.easing, `${a}'s easing`)), o.sprite !== void 0 && (c.sprite = y(o.sprite, `${a}'s sprite`)), c;
|
|
154
|
+
});
|
|
155
|
+
return t(t({}, h(r, n)), {}, { keyframes: a });
|
|
156
|
+
}, h = (e, t) => {
|
|
157
|
+
let n = _(e, t), r = { duration: C(b(n.duration, `${t}'s duration`), 0, c.ms) };
|
|
158
|
+
return n.delay !== void 0 && (r.delay = C(b(n.delay, `${t}'s delay`), 0, c.ms)), n.easing !== void 0 && (r.easing = y(n.easing, `${t}'s easing`)), r;
|
|
159
|
+
}, g = [
|
|
160
|
+
"normal",
|
|
161
|
+
"multiply",
|
|
162
|
+
"screen",
|
|
163
|
+
"overlay",
|
|
164
|
+
"darken",
|
|
165
|
+
"lighten",
|
|
166
|
+
"color-dodge",
|
|
167
|
+
"color-burn",
|
|
168
|
+
"hard-light",
|
|
169
|
+
"soft-light",
|
|
170
|
+
"difference",
|
|
171
|
+
"exclusion",
|
|
172
|
+
"hue",
|
|
173
|
+
"saturation",
|
|
174
|
+
"color",
|
|
175
|
+
"luminosity"
|
|
176
|
+
], _ = (e, t) => {
|
|
177
|
+
if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`${t} must be an object`);
|
|
178
|
+
return e;
|
|
179
|
+
}, v = (e, t, n) => {
|
|
180
|
+
if (!Array.isArray(e)) throw Error(`${t} must be a list`);
|
|
181
|
+
if (e.length > n) throw Error(`${t} can hold at most ${n}, got ${e.length}`);
|
|
182
|
+
return e;
|
|
183
|
+
}, y = (e, t) => {
|
|
184
|
+
if (typeof e != "string" || !e || e.length > c.text) throw Error(`${t} must be text of 1 to ${c.text} characters`);
|
|
185
|
+
return e;
|
|
186
|
+
}, b = (e, t) => {
|
|
187
|
+
if (typeof e != "number" || !Number.isFinite(e)) throw Error(`${t} must be a finite number`);
|
|
188
|
+
return e;
|
|
189
|
+
}, x = (e, t, n) => {
|
|
190
|
+
let r = b(e, t);
|
|
191
|
+
if (r <= 0 || r > n) throw Error(`${t} must be above 0 and at most ${n}`);
|
|
192
|
+
return r;
|
|
193
|
+
}, S = (e, t) => {
|
|
194
|
+
if (!Array.isArray(e) || e.length !== 2) throw Error(`${t} must be two numbers`);
|
|
195
|
+
return [b(e[0], t), b(e[1], t)];
|
|
196
|
+
}, C = (e, t, n) => Math.min(n, Math.max(t, e)), w = 3e3, T = 250, E = 3, D = /* @__PURE__ */ new Set(), O = 0, k = class {
|
|
197
|
+
constructor(t, n, r, i) {
|
|
198
|
+
e(this, "scene", null), e(
|
|
199
|
+
this,
|
|
200
|
+
/** The resolution the scene's sprites were made at, and the one the canvas wants once its width settles */
|
|
201
|
+
"spritesPpu",
|
|
202
|
+
0
|
|
203
|
+
), e(this, "wantedPpu", 0), e(this, "live", /* @__PURE__ */ new Map()), e(this, "order", []), e(
|
|
204
|
+
this,
|
|
205
|
+
/** When everything the last step started has finished, loops aside */
|
|
206
|
+
"until",
|
|
207
|
+
0
|
|
208
|
+
), e(this, "looping", !1), e(this, "shown", null), e(this, "waiting", null), e(this, "skipped", 0), e(this, "rendering", !1), e(this, "failures", 0), e(this, "disposed", !1), e(
|
|
209
|
+
this,
|
|
210
|
+
/** The box the board fits inside, and the width it's drawn at there */
|
|
211
|
+
"boxWidth",
|
|
212
|
+
0
|
|
213
|
+
), e(this, "boxHeight", 0), e(this, "cssWidth", 0), e(
|
|
214
|
+
this,
|
|
215
|
+
/** The canvas's width in device pixels, which sets the board's scale */
|
|
216
|
+
"pixelWidth",
|
|
217
|
+
0
|
|
218
|
+
), e(this, "height", 0), e(this, "pendingHeight", 0), e(this, "needsFit", !1), e(this, "settleTimer", void 0), e(this, "stepTimer", void 0), e(this, "ctx", void 0), e(this, "theme", null), e(this, "look", { fidelity: "high" }), e(this, "layers", []), e(this, "dirty", !1), e(
|
|
219
|
+
this,
|
|
220
|
+
/** Called after every frame with where each node was drawn, for the simulator's debug overlay */
|
|
221
|
+
"onDrawn",
|
|
222
|
+
void 0
|
|
223
|
+
), e(
|
|
224
|
+
this,
|
|
225
|
+
/** Called with the canvas's size on the page whenever it changes, for a canvas whose element is on another thread */
|
|
226
|
+
"onFit",
|
|
227
|
+
void 0
|
|
228
|
+
), e(this, "fittedWidth", 0), e(this, "fittedHeight", 0), e(this, "stepStart", 0), this.canvas = t, this.renderer = n, this.boardID = r, this.onBroken = i, this.ctx = t.getContext("2d"), D.add(this);
|
|
229
|
+
}
|
|
230
|
+
/** The newest view of the board; it shows once the step on screen has played out */
|
|
231
|
+
update(e) {
|
|
232
|
+
if (this.waiting) this.skipped++;
|
|
233
|
+
else if (this.shown && e.input === this.shown.input && e.puzzle === this.shown.puzzle) return;
|
|
234
|
+
this.waiting = e, this.pump();
|
|
235
|
+
}
|
|
236
|
+
/** A new theme makes new sprites, so the board is drawn again in it; nothing's drawn before the first */
|
|
237
|
+
setTheme(e) {
|
|
238
|
+
e !== this.theme && (this.theme = e, this.shown && !this.waiting && (this.waiting = this.shown), this.pump());
|
|
239
|
+
}
|
|
240
|
+
/** How much detail to draw and what's behind the board; a change draws it again, as a theme's does. Set it before the theme. */
|
|
241
|
+
setLook(e) {
|
|
242
|
+
e.fidelity === this.look.fidelity && e.backgroundStyle === this.look.backgroundStyle || (this.look = e, this.shown && !this.waiting && (this.waiting = this.shown), this.pump());
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The box the board fits inside, as a thumbnail does: as wide as it can be without running past the bottom. A box
|
|
246
|
+
* with no height of its own is only a width. The fitted width sets the canvas's pixel size and, once it settles, the
|
|
247
|
+
* sprites' resolution
|
|
248
|
+
*/
|
|
249
|
+
resize(e, t) {
|
|
250
|
+
e === this.boxWidth && t === this.boxHeight || e <= 0 || (this.boxWidth = e, this.boxHeight = t, this.scene || (this.cssWidth = e), this.needsFit = !0, this.dirty = !0, F());
|
|
251
|
+
}
|
|
252
|
+
/** Draws the board again on the next frame, for an overlay that changed when nothing on the board did */
|
|
253
|
+
redraw() {
|
|
254
|
+
this.dirty = !0, F();
|
|
255
|
+
}
|
|
256
|
+
/** Stops for good, showing the last scene as it ends, so a broken renderer reads as a neighbour who's paused */
|
|
257
|
+
freeze() {
|
|
258
|
+
this.disposed || (this.scene && this.draw(Infinity), this.dispose());
|
|
259
|
+
}
|
|
260
|
+
dispose() {
|
|
261
|
+
this.disposed = !0, clearTimeout(this.settleTimer), clearTimeout(this.stepTimer), D.delete(this);
|
|
262
|
+
}
|
|
263
|
+
/** Starts the next render when the queue allows one */
|
|
264
|
+
pump() {
|
|
265
|
+
var e;
|
|
266
|
+
if (this.disposed || this.rendering || !this.theme) return;
|
|
267
|
+
let t = performance.now(), n = t >= Math.min(this.until, this.stepStart + w) || N();
|
|
268
|
+
if (this.waiting && !n) {
|
|
269
|
+
clearTimeout(this.stepTimer), this.stepTimer = setTimeout(() => this.pump(), Math.min(this.until, this.stepStart + w) - t + 1);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
let r = (e = this.waiting) == null ? this.shown && this.wantedPpu && this.wantedPpu !== this.spritesPpu ? this.shown : null : e;
|
|
273
|
+
if (!r) return;
|
|
274
|
+
this.waiting = null;
|
|
275
|
+
let i = this.skipped;
|
|
276
|
+
this.skipped = 0, this.render(r, i);
|
|
277
|
+
}
|
|
278
|
+
render(e, t) {
|
|
279
|
+
var r = this;
|
|
280
|
+
return n(function* () {
|
|
281
|
+
var n, i;
|
|
282
|
+
r.rendering = !0;
|
|
283
|
+
let a = r.wantedPpu || r.ppuFor((n = (i = r.scene) == null ? void 0 : i.width) == null ? A.get(r.renderer) : n);
|
|
284
|
+
try {
|
|
285
|
+
var o, s;
|
|
286
|
+
let n = yield r.renderer.render({
|
|
287
|
+
board: r.boardID,
|
|
288
|
+
puzzle: e.puzzle,
|
|
289
|
+
input: e.input,
|
|
290
|
+
previous: (o = r.shown) == null ? void 0 : o,
|
|
291
|
+
skipped: t,
|
|
292
|
+
theme: r.theme,
|
|
293
|
+
fidelity: r.look.fidelity,
|
|
294
|
+
backgroundStyle: (s = r.look.backgroundStyle) == null ? r.theme.type : s,
|
|
295
|
+
pixelsPerUnit: a
|
|
296
|
+
});
|
|
297
|
+
if (r.disposed) return;
|
|
298
|
+
r.failures = 0, A.set(r.renderer, n.width), r.spritesPpu = a, r.wantedPpu = r.ppuFor(n.width), r.show(n, r.shown ? performance.now() : -Infinity), r.shown = e;
|
|
299
|
+
} catch (t) {
|
|
300
|
+
if (r.disposed) return;
|
|
301
|
+
if (r.failures++, !r.shown || r.failures >= E) return r.freeze(), r.onBroken(t, !!r.shown);
|
|
302
|
+
console.warn("A table board couldn't render:", t), r.waiting != null || (r.waiting = e);
|
|
303
|
+
} finally {
|
|
304
|
+
r.rendering = !1;
|
|
305
|
+
}
|
|
306
|
+
r.pump();
|
|
307
|
+
})();
|
|
308
|
+
}
|
|
309
|
+
/** Device pixels per board unit: the canvas's exactly, so sprites drawn at their own size are the board's size */
|
|
310
|
+
ppuFor(e) {
|
|
311
|
+
let t = M();
|
|
312
|
+
if (!e) return t;
|
|
313
|
+
let n = this.pixelWidth || this.cssWidth * t;
|
|
314
|
+
return n ? Math.round(n / e * 1e6) / 1e6 : t;
|
|
315
|
+
}
|
|
316
|
+
/** Matches the scene to what's on screen by key, and starts what moves; `now` of -Infinity shows it settled */
|
|
317
|
+
show(e, n) {
|
|
318
|
+
let r = n === -Infinity || N(), i = r ? 0 : n;
|
|
319
|
+
this.stepStart = i;
|
|
320
|
+
let a = i, o = !1, s = this.live, c = /* @__PURE__ */ new Map();
|
|
321
|
+
for (let t of e.nodes) {
|
|
322
|
+
let n = t.parent ? c.get(t.parent) : null, o = s.get(t.key), p = R(t);
|
|
323
|
+
if (o && !o.exit) {
|
|
324
|
+
var l, u, d, f;
|
|
325
|
+
let s = r || t.transition === !1 || (l = (u = t.transition) == null ? e.transition : u) == null ? null : l;
|
|
326
|
+
o.from = z(o, i), o.to = p, o.start = i + ((d = s == null ? void 0 : s.delay) == null ? 0 : d), o.duration = (f = s == null ? void 0 : s.duration) == null ? 0 : f, o.ease = Y(s == null ? void 0 : s.easing), o.node = t, o.parent = n, a = Math.max(a, o.start + o.duration), c.set(t.key, o);
|
|
327
|
+
} else {
|
|
328
|
+
let e = {
|
|
329
|
+
node: t,
|
|
330
|
+
parent: n,
|
|
331
|
+
from: p,
|
|
332
|
+
to: p,
|
|
333
|
+
start: i,
|
|
334
|
+
duration: 0,
|
|
335
|
+
ease: L,
|
|
336
|
+
effects: []
|
|
337
|
+
};
|
|
338
|
+
t.enter && !r && (e.enter = U(t.enter, i), a = Math.max(a, e.enter.end)), c.set(t.key, e);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
let p = e.nodes.map((e) => c.get(e.key));
|
|
342
|
+
for (let e = 0; e < this.order.length; e++) {
|
|
343
|
+
let n = this.order[e];
|
|
344
|
+
if (c.get(n.node.key) !== n) {
|
|
345
|
+
if (n.exit) {
|
|
346
|
+
!r && n.exit.end > i && q(p, this.order, e, n);
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
!n.node.exit || r || (n.frozen = t(t({}, z(n, i)), H(n, i)), n.exit = U(n.node.exit, i), n.effects = [], a = Math.max(a, n.exit.end), q(p, this.order, e, n));
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if (!r) {
|
|
353
|
+
var m;
|
|
354
|
+
for (let t of (m = e.effects) == null ? [] : m) {
|
|
355
|
+
var h;
|
|
356
|
+
let e = c.get(t.key);
|
|
357
|
+
if (!e) continue;
|
|
358
|
+
let n = U(t, i, (h = t.iterations) == null ? 1 : h);
|
|
359
|
+
e.effects.push(n), n.end === Infinity ? o = !0 : a = Math.max(a, n.end);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
for (let e of c.values()) e.effects = e.effects.filter((e) => e.end > i), e.effects.some((e) => e.end === Infinity) && (o = !0);
|
|
363
|
+
this.live = c, this.order = p, this.until = a, this.looping = o;
|
|
364
|
+
let g = !this.scene || e.height / e.width > this.height / (this.scene.width || 1);
|
|
365
|
+
this.scene = e, g || r ? (this.height = e.height, this.pendingHeight = 0) : this.pendingHeight = e.height, this.fit(), this.dirty = !0, F();
|
|
366
|
+
}
|
|
367
|
+
animating(e) {
|
|
368
|
+
return this.looping || e < this.until || this.pendingHeight > 0 && e >= this.until;
|
|
369
|
+
}
|
|
370
|
+
/** Draws the board as it is at `now`; true while something still moves */
|
|
371
|
+
draw(e) {
|
|
372
|
+
this.dirty = !1;
|
|
373
|
+
let t = this.scene;
|
|
374
|
+
if (!t || !this.cssWidth) return !1;
|
|
375
|
+
this.needsFit && this.fit(), this.pendingHeight && e >= this.until && (this.height = this.pendingHeight, this.pendingHeight = 0, this.fit());
|
|
376
|
+
let { ctx: n, canvas: r } = this, i = r.width / t.width;
|
|
377
|
+
n.setTransform(1, 0, 0, 1, 0, 0), n.clearRect(0, 0, r.width, r.height);
|
|
378
|
+
let a = /* @__PURE__ */ new Map(), o = [], s = () => o.length ? o[o.length - 1].layer : n, c = () => {
|
|
379
|
+
let { owner: e, layer: t } = o.pop(), n = s();
|
|
380
|
+
n.setTransform(1, 0, 0, 1, 0, 0), n.globalAlpha = 1, n.globalCompositeOperation = K(e.node.blend), n.drawImage(t.canvas, 0, 0), n.globalCompositeOperation = "source-over";
|
|
381
|
+
}, l = this.onDrawn ? [] : null;
|
|
382
|
+
for (let t of this.order) {
|
|
383
|
+
if (t.exit && e >= t.exit.end) continue;
|
|
384
|
+
for (; o.length && !ie(t, o[o.length - 1].owner);) c();
|
|
385
|
+
let n = G(t, e, a);
|
|
386
|
+
n && l && l.push({
|
|
387
|
+
key: t.node.key,
|
|
388
|
+
sprite: n.sprite,
|
|
389
|
+
matrix: n.matrix,
|
|
390
|
+
alpha: n.alpha,
|
|
391
|
+
exiting: !!t.exit
|
|
392
|
+
}), !(!n || n.alpha <= 0) && (t.node.isolate && o.push({
|
|
393
|
+
owner: t,
|
|
394
|
+
layer: this.layer(o.length)
|
|
395
|
+
}), n.sprite && this.drawSprite(s(), n.sprite, n, n.alpha, i, t.node.blend));
|
|
396
|
+
}
|
|
397
|
+
for (; o.length;) c();
|
|
398
|
+
return n.globalAlpha = 1, n.globalCompositeOperation = "source-over", n.setTransform(1, 0, 0, 1, 0, 0), l && this.onDrawn({
|
|
399
|
+
ctx: n,
|
|
400
|
+
scale: i,
|
|
401
|
+
scene: t,
|
|
402
|
+
nodes: l
|
|
403
|
+
}), this.animating(e);
|
|
404
|
+
}
|
|
405
|
+
/** A cleared layer the canvas's size for isolated nodes at `depth`, kept from frame to frame */
|
|
406
|
+
layer(e) {
|
|
407
|
+
let t = this.layers[e];
|
|
408
|
+
return (!t || t.canvas.width !== this.canvas.width || t.canvas.height !== this.canvas.height) && (t = this.layers[e] = new OffscreenCanvas(this.canvas.width, this.canvas.height).getContext("2d")), t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, t.canvas.width, t.canvas.height), t;
|
|
409
|
+
}
|
|
410
|
+
drawSprite(e, t, n, r, i, a) {
|
|
411
|
+
let o = this.renderer.sprite(t, this.spritesPpu);
|
|
412
|
+
if (!o || r <= 0) return;
|
|
413
|
+
let s = n.matrix, c = n.tint ? oe(o, n.tint) : o.bitmap, l = s[0] === 1 && s[1] === 0 && s[2] === 0 && s[3] === 1 && Math.abs(i / this.spritesPpu - 1) < 1e-5;
|
|
414
|
+
if (e.globalAlpha = r, e.globalCompositeOperation = K(a), l) {
|
|
415
|
+
e.setTransform(1, 0, 0, 1, 0, 0);
|
|
416
|
+
let t = Math.round((s[4] - o.anchor[0]) * i), a = Math.round((s[5] - o.anchor[1]) * i);
|
|
417
|
+
e.drawImage(c, t, a);
|
|
418
|
+
for (let i = n.brightness - 1; i > 0; i--) e.globalCompositeOperation = "lighter", e.globalAlpha = r * Math.min(1, i), e.drawImage(c, t, a);
|
|
419
|
+
} else {
|
|
420
|
+
e.setTransform(s[0] * i, s[1] * i, s[2] * i, s[3] * i, s[4] * i, s[5] * i);
|
|
421
|
+
let t = () => e.drawImage(c, -o.anchor[0], -o.anchor[1], o.width, o.height);
|
|
422
|
+
t();
|
|
423
|
+
for (let i = n.brightness - 1; i > 0; i--) e.globalCompositeOperation = "lighter", e.globalAlpha = r * Math.min(1, i), t();
|
|
424
|
+
}
|
|
425
|
+
e.globalCompositeOperation = "source-over";
|
|
426
|
+
}
|
|
427
|
+
/** The canvas's size on the page and in pixels, for its box and the board's shape */
|
|
428
|
+
fit() {
|
|
429
|
+
let e = this.scene;
|
|
430
|
+
if (!e || !this.boxWidth) return;
|
|
431
|
+
this.needsFit = !1;
|
|
432
|
+
let t = M(), n = this.boxHeight > 0 ? Math.min(this.boxWidth, this.boxHeight * e.width / this.height) : this.boxWidth, r = Math.round(e.grid ? Math.max(1, Math.floor(n * t / e.width * e.grid)) * (e.width / e.grid) : n * t), i = r / t;
|
|
433
|
+
this.pixelWidth = r, i !== this.cssWidth && (this.cssWidth = i, clearTimeout(this.settleTimer), this.settleTimer = setTimeout(() => {
|
|
434
|
+
var e;
|
|
435
|
+
this.wantedPpu = this.ppuFor((e = this.scene) == null ? void 0 : e.width), this.pump();
|
|
436
|
+
}, T));
|
|
437
|
+
let a = this.cssWidth * this.height / e.width, o = r, s = Math.round(r * this.height / e.width);
|
|
438
|
+
if ("style" in this.canvas && (this.canvas.style.width = `${this.cssWidth}px`, this.canvas.style.height = `${a}px`), this.cssWidth !== this.fittedWidth || a !== this.fittedHeight) {
|
|
439
|
+
var c;
|
|
440
|
+
this.fittedWidth = this.cssWidth, this.fittedHeight = a, (c = this.onFit) == null || c.call(this, this.cssWidth, a);
|
|
441
|
+
}
|
|
442
|
+
o === this.canvas.width && s === this.canvas.height || (this.canvas.width = o, this.canvas.height = s, this.dirty = !0, F());
|
|
443
|
+
}
|
|
444
|
+
}, A = /* @__PURE__ */ new WeakMap(), j = {};
|
|
445
|
+
/** Says what the page knows of the screen, where boards draw without a document; what's left out is read from the globals */
|
|
446
|
+
const ee = (e) => void Object.assign(j, e);
|
|
447
|
+
var M = () => {
|
|
448
|
+
var e;
|
|
449
|
+
return (e = j.devicePixelRatio) == null ? devicePixelRatio || 1 : e;
|
|
450
|
+
}, N = () => {
|
|
451
|
+
var e, t, n;
|
|
452
|
+
return ((e = j.hidden) == null ? document.hidden : e) || ((t = j.reducedMotion) == null ? ((n = P) == null ? P = matchMedia("(prefers-reduced-motion: reduce)") : n).matches : t);
|
|
453
|
+
}, P, F = () => {
|
|
454
|
+
O || (O = requestAnimationFrame(I));
|
|
455
|
+
}, I = (e) => {
|
|
456
|
+
O = 0;
|
|
457
|
+
let t = !1;
|
|
458
|
+
for (let n of D) if (!(!n.dirty && !n.animating(e))) try {
|
|
459
|
+
t = n.draw(e) || t;
|
|
460
|
+
} catch (e) {
|
|
461
|
+
console.error("A table board couldn't be drawn:", e);
|
|
462
|
+
}
|
|
463
|
+
t && F();
|
|
464
|
+
}, L = (e) => e, R = (e) => {
|
|
465
|
+
var t, n, r, i, a, o, s;
|
|
466
|
+
return {
|
|
467
|
+
x: e.x,
|
|
468
|
+
y: e.y,
|
|
469
|
+
rotation: (t = e.rotation) == null ? 0 : t,
|
|
470
|
+
sx: (n = (r = e.scale) == null ? void 0 : r[0]) == null ? 1 : n,
|
|
471
|
+
sy: (i = (a = e.scale) == null ? void 0 : a[1]) == null ? 1 : i,
|
|
472
|
+
opacity: (o = e.opacity) == null ? 1 : o,
|
|
473
|
+
brightness: (s = e.brightness) == null ? 1 : s,
|
|
474
|
+
tint: e.tint ? Q(e.tint) : null
|
|
475
|
+
};
|
|
476
|
+
}, z = (e, t) => {
|
|
477
|
+
if (e.frozen) return e.frozen;
|
|
478
|
+
if (!e.duration || t >= e.start + e.duration) return e.to;
|
|
479
|
+
let n = t <= e.start ? 0 : e.ease((t - e.start) / e.duration);
|
|
480
|
+
return B(e.from, e.to, n);
|
|
481
|
+
}, B = (e, t, n) => ({
|
|
482
|
+
x: e.x + (t.x - e.x) * n,
|
|
483
|
+
y: e.y + (t.y - e.y) * n,
|
|
484
|
+
rotation: e.rotation + (t.rotation - e.rotation) * n,
|
|
485
|
+
sx: e.sx + (t.sx - e.sx) * n,
|
|
486
|
+
sy: e.sy + (t.sy - e.sy) * n,
|
|
487
|
+
opacity: e.opacity + (t.opacity - e.opacity) * n,
|
|
488
|
+
brightness: e.brightness + (t.brightness - e.brightness) * n,
|
|
489
|
+
tint: e.tint && t.tint ? V(e.tint, t.tint, n) : t.tint
|
|
490
|
+
}), V = (e, t, n) => [
|
|
491
|
+
e[0] + (t[0] - e[0]) * n,
|
|
492
|
+
e[1] + (t[1] - e[1]) * n,
|
|
493
|
+
e[2] + (t[2] - e[2]) * n
|
|
494
|
+
], H = (e, t) => {
|
|
495
|
+
if (!e.parent) return {};
|
|
496
|
+
let n = G(e.parent, t, /* @__PURE__ */ new Map());
|
|
497
|
+
return n ? {
|
|
498
|
+
parentMatrix: n.matrix,
|
|
499
|
+
parentAlpha: n.alpha
|
|
500
|
+
} : {};
|
|
501
|
+
}, U = (e, t, n = 1) => {
|
|
502
|
+
var r;
|
|
503
|
+
let i = [...e.keyframes];
|
|
504
|
+
(!i.length || i[0].offset > 0) && i.unshift({ offset: 0 }), i[i.length - 1].offset < 1 && i.push({ offset: 1 });
|
|
505
|
+
let a = t + ((r = e.delay) == null ? 0 : r), o = Math.max(1, e.duration), s = e.easing;
|
|
506
|
+
return {
|
|
507
|
+
frames: i,
|
|
508
|
+
start: a,
|
|
509
|
+
duration: o,
|
|
510
|
+
iterations: n,
|
|
511
|
+
end: n === Infinity ? Infinity : a + o * n,
|
|
512
|
+
ease: i.map((e) => {
|
|
513
|
+
var t;
|
|
514
|
+
return Y((t = e.easing) == null ? s : t);
|
|
515
|
+
})
|
|
516
|
+
};
|
|
517
|
+
}, W = (e, t, n) => {
|
|
518
|
+
var r, i, a, o, s, c;
|
|
519
|
+
if (t < e.start && !n || t >= e.end && !n) return null;
|
|
520
|
+
let l = Math.max(0, Math.min(t, e.end === Infinity ? t : e.end) - e.start) / e.duration;
|
|
521
|
+
l = t >= e.end ? 1 : l - Math.floor(l);
|
|
522
|
+
let { frames: u } = e, d = 0;
|
|
523
|
+
for (; d < u.length - 2 && l > u[d + 1].offset;) d++;
|
|
524
|
+
let f = u[d], p = u[d + 1], m = p.offset - f.offset || 1, h = e.ease[d](Math.min(1, Math.max(0, (l - f.offset) / m))), g;
|
|
525
|
+
for (let e of u) e.offset <= l && e.sprite && (g = e.sprite);
|
|
526
|
+
let _ = (e, t, n) => (e == null ? n : e) + ((t == null ? n : t) - (e == null ? n : e)) * h;
|
|
527
|
+
return {
|
|
528
|
+
x: _(f.x, p.x, 0),
|
|
529
|
+
y: _(f.y, p.y, 0),
|
|
530
|
+
rotation: _(f.rotation, p.rotation, 0),
|
|
531
|
+
sx: _((r = f.scale) == null ? void 0 : r[0], (i = p.scale) == null ? void 0 : i[0], 1),
|
|
532
|
+
sy: _((a = f.scale) == null ? void 0 : a[1], (o = p.scale) == null ? void 0 : o[1], 1),
|
|
533
|
+
opacity: _(f.opacity, p.opacity, 1),
|
|
534
|
+
brightness: _(f.brightness, p.brightness, 1),
|
|
535
|
+
tint: f.tint || p.tint ? V(Q((s = f.tint) == null ? p.tint : s), Q((c = p.tint) == null ? f.tint : c), h) : null,
|
|
536
|
+
sprite: g
|
|
537
|
+
};
|
|
538
|
+
}, G = (e, t, n) => {
|
|
539
|
+
var r;
|
|
540
|
+
let i = n.get(e);
|
|
541
|
+
if (i) return i;
|
|
542
|
+
let { x: a, y: o, rotation: s, sx: l, sy: u, opacity: d, brightness: f, tint: p } = z(e, t), m = e.node.sprite, h = [
|
|
543
|
+
[e.enter, !0],
|
|
544
|
+
[e.exit, !0],
|
|
545
|
+
...e.effects.map((e) => [e, !1])
|
|
546
|
+
];
|
|
547
|
+
for (let [e, n] of h) {
|
|
548
|
+
if (!e) continue;
|
|
549
|
+
let r = W(e, t, n);
|
|
550
|
+
r && (a += r.x, o += r.y, s += r.rotation, l *= r.sx, u *= r.sy, d *= r.opacity, f *= r.brightness, r.tint && (p = r.tint), r.sprite && (m = r.sprite));
|
|
551
|
+
}
|
|
552
|
+
let g = te, _ = 1, v = 1;
|
|
553
|
+
if ((r = e.frozen) != null && r.parentMatrix) {
|
|
554
|
+
var y;
|
|
555
|
+
g = e.frozen.parentMatrix, _ = (y = e.frozen.parentAlpha) == null ? 1 : y;
|
|
556
|
+
} else if (e.parent) {
|
|
557
|
+
let r = G(e.parent, t, n);
|
|
558
|
+
if (!r) return null;
|
|
559
|
+
g = r.matrix, _ = r.alpha, v = r.brightness;
|
|
560
|
+
}
|
|
561
|
+
let b = s * Math.PI / 180, x = Math.cos(b), S = Math.sin(b), C = [
|
|
562
|
+
x * l,
|
|
563
|
+
S * l,
|
|
564
|
+
-S * u,
|
|
565
|
+
x * u,
|
|
566
|
+
a,
|
|
567
|
+
o
|
|
568
|
+
], w = {
|
|
569
|
+
matrix: ne(g, re(C)),
|
|
570
|
+
alpha: _ * d,
|
|
571
|
+
brightness: Math.min(v * f, c.brightness),
|
|
572
|
+
tint: p,
|
|
573
|
+
sprite: m
|
|
574
|
+
};
|
|
575
|
+
return n.set(e, w), w;
|
|
576
|
+
}, te = [
|
|
577
|
+
1,
|
|
578
|
+
0,
|
|
579
|
+
0,
|
|
580
|
+
1,
|
|
581
|
+
0,
|
|
582
|
+
0
|
|
583
|
+
], ne = (e, t) => [
|
|
584
|
+
e[0] * t[0] + e[2] * t[1],
|
|
585
|
+
e[1] * t[0] + e[3] * t[1],
|
|
586
|
+
e[0] * t[2] + e[2] * t[3],
|
|
587
|
+
e[1] * t[2] + e[3] * t[3],
|
|
588
|
+
e[0] * t[4] + e[2] * t[5] + e[4],
|
|
589
|
+
e[1] * t[4] + e[3] * t[5] + e[5]
|
|
590
|
+
], re = (e) => e.map((e, t) => t < 4 && Math.abs(e - Math.round(e)) < 1e-9 ? Math.round(e) : e), K = (e) => !e || e === "normal" ? "source-over" : e, ie = (e, t) => {
|
|
591
|
+
for (let n = e.parent; n; n = n.parent) if (n === t) return !0;
|
|
592
|
+
return !1;
|
|
593
|
+
}, q = (e, t, n, r) => {
|
|
594
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
595
|
+
let n = e.indexOf(t[i]);
|
|
596
|
+
if (n >= 0) return void e.splice(n + 1, 0, r);
|
|
597
|
+
}
|
|
598
|
+
e.unshift(r);
|
|
599
|
+
}, J = /* @__PURE__ */ new Map(), Y = (e) => {
|
|
600
|
+
if (!e) return L;
|
|
601
|
+
let t = J.get(e);
|
|
602
|
+
return t || J.set(e, t = r(e)), t;
|
|
603
|
+
}, X, Z = /* @__PURE__ */ new Map(), Q = (e) => {
|
|
604
|
+
var t, n;
|
|
605
|
+
let r = Z.get(e);
|
|
606
|
+
if (r) return r;
|
|
607
|
+
X != null || (X = typeof OffscreenCanvas > "u" ? document.createElement("canvas").getContext("2d") : new OffscreenCanvas(1, 1).getContext("2d")), X.fillStyle = "#000", X.fillStyle = e;
|
|
608
|
+
let i = String(X.fillStyle), a = /^#([0-9a-f]{6})$/i.exec(i), o = a ? [
|
|
609
|
+
0,
|
|
610
|
+
2,
|
|
611
|
+
4
|
|
612
|
+
].map((e) => parseInt(a[1].slice(e, e + 2), 16)) : (t = (n = /rgba?\(([^)]+)\)/.exec(i)) == null ? void 0 : n[1].split(",").slice(0, 3).map(Number)) == null ? [
|
|
613
|
+
0,
|
|
614
|
+
0,
|
|
615
|
+
0
|
|
616
|
+
] : t;
|
|
617
|
+
return r = [
|
|
618
|
+
o[0],
|
|
619
|
+
o[1],
|
|
620
|
+
o[2]
|
|
621
|
+
], Z.set(e, r), r;
|
|
622
|
+
}, $ = /* @__PURE__ */ new WeakMap(), ae = 48, oe = (e, t) => {
|
|
623
|
+
let n = t.map((e) => Math.round(e / 4) * 4).join(","), r = $.get(e.bitmap);
|
|
624
|
+
r || $.set(e.bitmap, r = /* @__PURE__ */ new Map());
|
|
625
|
+
let i = r.get(n);
|
|
626
|
+
if (i) return i;
|
|
627
|
+
r.size >= ae && r.clear();
|
|
628
|
+
let { width: a, height: o } = e.bitmap;
|
|
629
|
+
i = new OffscreenCanvas(a, o);
|
|
630
|
+
let s = i.getContext("2d");
|
|
631
|
+
return s.drawImage(e.bitmap, 0, 0), s.globalCompositeOperation = "multiply", s.fillStyle = `rgb(${n})`, s.fillRect(0, 0, a, o), s.globalCompositeOperation = "destination-in", s.drawImage(e.bitmap, 0, 0), r.set(n, i), i;
|
|
632
|
+
};
|
|
633
|
+
export { l as a, u as i, ee as n, c as r, k as t };
|
|
634
|
+
|
|
635
|
+
//# sourceMappingURL=tableBoard-B0I9wVQq.js.map
|