@mblinkov/whats-missing 20.0.24 → 20.0.25
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/whats-missing.cjs.js +3 -4
- package/dist/whats-missing.es.js +190 -211
- package/package.json +1 -1
- package/src/Game.tsx +433 -528
package/dist/whats-missing.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
const
|
|
4
|
-
src: `${
|
|
5
|
-
name:
|
|
6
|
-
})),
|
|
1
|
+
import { jsx as t, jsxs as s, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as U, useState as l, useEffect as oe, useLayoutEffect as re, useMemo as pe } from "react";
|
|
3
|
+
const fe = window.origin + "/cloud/speakid/games/whatsmissing/", P = (i, y) => i.map(([m, o]) => ({
|
|
4
|
+
src: `${fe}${y}/${o.replace(/\s/g, "%20")}.png`,
|
|
5
|
+
name: o
|
|
6
|
+
})), ye = [
|
|
7
7
|
["apple", "apple"],
|
|
8
8
|
["banana", "banana"],
|
|
9
9
|
["bread", "bread"],
|
|
@@ -29,7 +29,7 @@ const ke = window.origin + "/cloud/speakid/games/whatsmissing/", Y = (l, f) => l
|
|
|
29
29
|
["strawberry", "strawberry"],
|
|
30
30
|
["tomato", "tomato"],
|
|
31
31
|
["watermelon", "watermelon"]
|
|
32
|
-
],
|
|
32
|
+
], xe = [
|
|
33
33
|
["bear", "bear"],
|
|
34
34
|
["cat", "cat"],
|
|
35
35
|
["crocodile", "crocodile"],
|
|
@@ -49,7 +49,7 @@ const ke = window.origin + "/cloud/speakid/games/whatsmissing/", Y = (l, f) => l
|
|
|
49
49
|
["tortoise", "tortoise"],
|
|
50
50
|
["wolf", "wolf"],
|
|
51
51
|
["zebra", "zebra"]
|
|
52
|
-
],
|
|
52
|
+
], be = [
|
|
53
53
|
["ball", "ball"],
|
|
54
54
|
["balloon", "balloon"],
|
|
55
55
|
["blocks", "blocks"],
|
|
@@ -69,21 +69,21 @@ const ke = window.origin + "/cloud/speakid/games/whatsmissing/", Y = (l, f) => l
|
|
|
69
69
|
["teddy_bear", "teddy bear"],
|
|
70
70
|
["yo-yo", "yo-yo"],
|
|
71
71
|
["crayons", "crayons"]
|
|
72
|
-
],
|
|
73
|
-
food:
|
|
74
|
-
animals:
|
|
75
|
-
toys:
|
|
76
|
-
},
|
|
72
|
+
], ie = {
|
|
73
|
+
food: P(ye, "food"),
|
|
74
|
+
animals: P(xe, "animals"),
|
|
75
|
+
toys: P(be, "toys")
|
|
76
|
+
}, we = `
|
|
77
77
|
@keyframes spin {
|
|
78
78
|
from { transform: rotate(0deg); }
|
|
79
79
|
to { transform: rotate(360deg); }
|
|
80
80
|
}
|
|
81
81
|
`;
|
|
82
82
|
if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
|
|
83
|
-
const
|
|
84
|
-
|
|
83
|
+
const i = document.createElement("style");
|
|
84
|
+
i.id = "spin-keyframes", i.innerHTML = we, document.head.appendChild(i);
|
|
85
85
|
}
|
|
86
|
-
const
|
|
86
|
+
const ve = {
|
|
87
87
|
animation: "spin 1.4s linear infinite"
|
|
88
88
|
}, n = {
|
|
89
89
|
gmCenterScreen: {
|
|
@@ -236,188 +236,167 @@ const Ee = {
|
|
|
236
236
|
},
|
|
237
237
|
gmHourglass: {
|
|
238
238
|
fontSize: "42px",
|
|
239
|
-
...
|
|
239
|
+
...ve
|
|
240
240
|
}
|
|
241
|
-
},
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
/* scope only inside game root */
|
|
241
|
+
}, ke = () => {
|
|
242
|
+
const i = document.createElement("style");
|
|
243
|
+
i.textContent = `
|
|
245
244
|
#whats-missing-root, #whats-missing-root * { box-sizing: border-box; }
|
|
246
245
|
#whats-missing-root img { max-width:100%; height:auto; display:block; user-select:none; }
|
|
247
|
-
`, document.head.appendChild(
|
|
248
|
-
},
|
|
249
|
-
const
|
|
250
|
-
for (let
|
|
251
|
-
for (let
|
|
252
|
-
for (let
|
|
253
|
-
for (let
|
|
254
|
-
|
|
255
|
-
return
|
|
246
|
+
`, document.head.appendChild(i);
|
|
247
|
+
}, Ce = (i, y) => {
|
|
248
|
+
const m = Array.from({ length: i.length + 1 }, () => Array(y.length + 1).fill(0));
|
|
249
|
+
for (let o = 0; o <= i.length; o++) m[o][0] = o;
|
|
250
|
+
for (let o = 0; o <= y.length; o++) m[0][o] = o;
|
|
251
|
+
for (let o = 1; o <= i.length; o++)
|
|
252
|
+
for (let g = 1; g <= y.length; g++)
|
|
253
|
+
m[o][g] = i[o - 1] === y[g - 1] ? m[o - 1][g - 1] : Math.min(m[o - 1][g - 1], m[o][g - 1], m[o - 1][g]) + 1;
|
|
254
|
+
return m[i.length][y.length];
|
|
256
255
|
};
|
|
257
|
-
function
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
if (typeof window > "u" || !
|
|
261
|
-
const
|
|
256
|
+
function ze(i, y = { minDesktopWidth: 1200, forceResize: !1 }) {
|
|
257
|
+
const m = U(null), o = y.minDesktopWidth ?? 1200, g = !!y.forceResize;
|
|
258
|
+
re(() => {
|
|
259
|
+
if (typeof window > "u" || !i || !i.current) return;
|
|
260
|
+
const d = i.current, B = () => {
|
|
262
261
|
try {
|
|
263
|
-
const
|
|
264
|
-
if (y && !isNaN(y) && y > 0) return y;
|
|
265
|
-
const T = parseFloat(b.zoom || "");
|
|
262
|
+
const a = document.body, u = getComputedStyle(a), T = parseFloat(a.style && a.style.zoom || "");
|
|
266
263
|
if (T && !isNaN(T) && T > 0) return T;
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
264
|
+
const k = parseFloat(u.zoom || "");
|
|
265
|
+
if (k && !isNaN(k) && k > 0) return k;
|
|
266
|
+
const h = document.createElement("div");
|
|
267
|
+
h.style.position = "absolute", h.style.left = "0", h.style.top = "0", h.style.width = "100px", h.style.height = "1px", h.style.visibility = "hidden", h.style.pointerEvents = "none", document.documentElement.appendChild(h);
|
|
268
|
+
const x = h.getBoundingClientRect();
|
|
269
|
+
if (document.documentElement.removeChild(h), x && x.width > 0) {
|
|
270
|
+
const A = x.width / 100;
|
|
271
|
+
if (!isNaN(A) && A > 0) return A;
|
|
273
272
|
}
|
|
274
273
|
} catch {
|
|
275
274
|
}
|
|
276
275
|
return 1;
|
|
277
|
-
},
|
|
278
|
-
if (
|
|
279
|
-
|
|
276
|
+
}, C = () => {
|
|
277
|
+
if (o && window.innerWidth < o) {
|
|
278
|
+
I();
|
|
280
279
|
return;
|
|
281
280
|
}
|
|
282
|
-
const
|
|
283
|
-
if (!
|
|
284
|
-
|
|
281
|
+
const a = B();
|
|
282
|
+
if (!a || a === 1) {
|
|
283
|
+
I();
|
|
285
284
|
return;
|
|
286
285
|
}
|
|
287
|
-
|
|
288
|
-
transform:
|
|
289
|
-
transformOrigin:
|
|
290
|
-
width:
|
|
291
|
-
height:
|
|
292
|
-
willChange:
|
|
286
|
+
m.current || (m.current = {
|
|
287
|
+
transform: d.style.transform || null,
|
|
288
|
+
transformOrigin: d.style.transformOrigin || null,
|
|
289
|
+
width: d.style.width || null,
|
|
290
|
+
height: d.style.height || null,
|
|
291
|
+
willChange: d.style.willChange || null
|
|
293
292
|
});
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
if (!
|
|
298
|
-
const
|
|
299
|
-
|
|
293
|
+
const u = 1 / a;
|
|
294
|
+
g && (d.style.width = `${a * 100}%`, d.style.height = `${a * 100}%`), d.style.transformOrigin = "50% 50%", d.style.transform = `scale(${u})`, d.style.willChange = "transform";
|
|
295
|
+
}, I = () => {
|
|
296
|
+
if (!m.current) return;
|
|
297
|
+
const a = m.current;
|
|
298
|
+
d.style.transform = a.transform ?? "", d.style.transformOrigin = a.transformOrigin ?? "", d.style.width = a.width ?? "", d.style.height = a.height ?? "", d.style.willChange = a.willChange ?? "", m.current = null;
|
|
300
299
|
};
|
|
301
|
-
let
|
|
302
|
-
const
|
|
303
|
-
cancelAnimationFrame(
|
|
304
|
-
},
|
|
305
|
-
for (const
|
|
306
|
-
if (
|
|
307
|
-
|
|
300
|
+
let v = 0;
|
|
301
|
+
const z = () => {
|
|
302
|
+
cancelAnimationFrame(v), v = requestAnimationFrame(C);
|
|
303
|
+
}, S = new MutationObserver((a) => {
|
|
304
|
+
for (const u of a)
|
|
305
|
+
if (u.type === "attributes" && (u.attributeName === "style" || u.attributeName === "class")) {
|
|
306
|
+
z();
|
|
308
307
|
break;
|
|
309
308
|
}
|
|
310
309
|
});
|
|
311
|
-
return
|
|
312
|
-
cancelAnimationFrame(
|
|
310
|
+
return S.observe(document.body, { attributes: !0, attributeFilter: ["style", "class"] }), window.addEventListener("resize", z), z(), () => {
|
|
311
|
+
cancelAnimationFrame(v), S.disconnect(), window.removeEventListener("resize", z), I();
|
|
313
312
|
};
|
|
314
|
-
}, [
|
|
313
|
+
}, [i, o, g]);
|
|
315
314
|
}
|
|
316
|
-
function
|
|
317
|
-
|
|
318
|
-
|
|
315
|
+
function Ie({
|
|
316
|
+
gameCubeSize: i,
|
|
317
|
+
screenHeight: y,
|
|
318
|
+
screenWidth: m
|
|
319
|
+
}) {
|
|
320
|
+
const o = U(null), g = U(null), [d, B] = l(null);
|
|
321
|
+
ze(o, { minDesktopWidth: 1200, forceResize: !1 }), oe(() => (ke(), () => {
|
|
319
322
|
document.body.style.overflow = "";
|
|
320
323
|
}), []);
|
|
321
|
-
const [
|
|
322
|
-
|
|
323
|
-
const e =
|
|
324
|
+
const [C, I] = l(null), [v, z] = l([]), [S, a] = l(4), [u, T] = l(!1), [k, h] = l(1), [x, A] = l(null), [b, L] = l("ready"), [V, Z] = l(3), [F, $] = l(10), [G, _] = l(20), [se, N] = l(0), [j, O] = l(!1), [E, K] = l(""), [M, D] = l(!1), [q, J] = l(!1), [Q, W] = l(null), [le, Y] = l([]), [ae, X] = l([]), [w, Se] = l(!1);
|
|
325
|
+
re(() => {
|
|
326
|
+
const e = g.current;
|
|
324
327
|
if (!e || typeof window > "u") return;
|
|
325
|
-
let
|
|
328
|
+
let r = null;
|
|
326
329
|
try {
|
|
327
|
-
|
|
328
|
-
for (const
|
|
329
|
-
const
|
|
330
|
-
|
|
330
|
+
r = new ResizeObserver((p) => {
|
|
331
|
+
for (const c of p) {
|
|
332
|
+
const f = c.contentRect;
|
|
333
|
+
B(Math.round(Math.min(f.width, f.height)));
|
|
331
334
|
}
|
|
332
|
-
}),
|
|
335
|
+
}), r.observe(e), B(Math.round(Math.min(e.clientWidth, e.clientHeight)));
|
|
333
336
|
} catch {
|
|
334
|
-
|
|
337
|
+
B(Math.round(Math.min(e.clientWidth, e.clientHeight)));
|
|
335
338
|
}
|
|
336
|
-
return () =>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
const e = ()
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
};
|
|
349
|
-
e(), window.addEventListener("resize", e);
|
|
350
|
-
const o = window.visualViewport;
|
|
351
|
-
return o && typeof o.addEventListener == "function" && (o.addEventListener("resize", e), o.addEventListener("scroll", e)), () => {
|
|
352
|
-
window.removeEventListener("resize", e), o && typeof o.removeEventListener == "function" && (o.removeEventListener("resize", e), o.removeEventListener("scroll", e));
|
|
353
|
-
};
|
|
354
|
-
}, []);
|
|
355
|
-
const te = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), ne = () => {
|
|
356
|
-
if (!u) return;
|
|
357
|
-
const e = te(re[u]);
|
|
358
|
-
H(e), I(!0), D(!1), b(1), $(0), q([]), X([]), oe(e, [], !0);
|
|
359
|
-
}, oe = (e = S, o = de, g = !1) => {
|
|
360
|
-
const d = te(e.length ? e : re[u]);
|
|
361
|
-
let p = Math.floor(Math.random() * d.length), k = d[p].name, v = 0;
|
|
362
|
-
for (; o.includes(k) && v < 20; )
|
|
363
|
-
p = Math.floor(Math.random() * d.length), k = d[p].name, v++;
|
|
364
|
-
H(d), T(p), X([...o, k]), G(!1), U(""), K(20), B(null), g ? (C("ready"), Z(3), F(10)) : (C("memorize"), F(10));
|
|
339
|
+
return () => r?.disconnect();
|
|
340
|
+
}, [w]);
|
|
341
|
+
const ee = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), te = () => {
|
|
342
|
+
if (!C) return;
|
|
343
|
+
const e = ee(ie[C]);
|
|
344
|
+
z(e), T(!0), O(!1), h(1), N(0), Y([]), X([]), ne(e, [], !0);
|
|
345
|
+
}, ne = (e = v, r = ae, p = !1) => {
|
|
346
|
+
const c = ee(e.length ? e : ie[C]);
|
|
347
|
+
let f = Math.floor(Math.random() * c.length), H = c[f].name, R = 0;
|
|
348
|
+
for (; r.includes(H) && R < 20; )
|
|
349
|
+
f = Math.floor(Math.random() * c.length), H = c[f].name, R++;
|
|
350
|
+
z(c), A(f), X([...r, H]), D(!1), K(""), _(20), W(null), p ? (L("ready"), Z(3), $(10)) : (L("memorize"), $(10));
|
|
365
351
|
};
|
|
366
|
-
|
|
367
|
-
if (!(!
|
|
368
|
-
if (
|
|
369
|
-
if (
|
|
352
|
+
oe(() => {
|
|
353
|
+
if (!(!u || j || M)) {
|
|
354
|
+
if (b === "ready")
|
|
355
|
+
if (V <= 0) L("memorize");
|
|
370
356
|
else {
|
|
371
|
-
const e = setTimeout(() => Z((
|
|
357
|
+
const e = setTimeout(() => Z((r) => r - 1), 1e3);
|
|
372
358
|
return () => clearTimeout(e);
|
|
373
359
|
}
|
|
374
|
-
if (
|
|
375
|
-
if (
|
|
360
|
+
if (b === "memorize")
|
|
361
|
+
if (F <= 0) L("guess");
|
|
376
362
|
else {
|
|
377
|
-
const e = setTimeout(() =>
|
|
363
|
+
const e = setTimeout(() => $((r) => r - 1), 1e3);
|
|
378
364
|
return () => clearTimeout(e);
|
|
379
365
|
}
|
|
380
|
-
if (
|
|
381
|
-
if (
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
...g,
|
|
386
|
-
{ round: r, answer: W, correct: o, result: "wrong" }
|
|
387
|
-
]);
|
|
366
|
+
if (b === "guess") {
|
|
367
|
+
if (G <= 0) {
|
|
368
|
+
D(!0), W("wrong");
|
|
369
|
+
const r = v[x].name;
|
|
370
|
+
Y((p) => [...p, { round: k, answer: E, correct: r, result: "wrong" }]);
|
|
388
371
|
return;
|
|
389
372
|
}
|
|
390
|
-
const e = setTimeout(() =>
|
|
373
|
+
const e = setTimeout(() => _((r) => r - 1), 1e3);
|
|
391
374
|
return () => clearTimeout(e);
|
|
392
375
|
}
|
|
393
376
|
}
|
|
394
|
-
}, [
|
|
395
|
-
const
|
|
396
|
-
if (
|
|
397
|
-
const e =
|
|
398
|
-
let
|
|
399
|
-
|
|
400
|
-
J(!1),
|
|
377
|
+
}, [b, V, F, G, u, j, M, v, x, k, E]);
|
|
378
|
+
const de = () => {
|
|
379
|
+
if (x === null || q) return;
|
|
380
|
+
const e = v[x].name, r = E.toLowerCase().trim();
|
|
381
|
+
let p = "wrong";
|
|
382
|
+
r === e ? (N((c) => c + 1), W("correct"), p = "correct") : Ce(r, e) === 1 ? (N((c) => c + 0.5), W("almost"), p = "almost") : (W("wrong"), p = "wrong"), Y((c) => [...c, { round: k, answer: r, correct: e, result: p }]), J(!0), setTimeout(() => {
|
|
383
|
+
J(!1), D(!0);
|
|
401
384
|
}, 600);
|
|
402
|
-
},
|
|
403
|
-
|
|
404
|
-
},
|
|
405
|
-
() => (
|
|
406
|
-
|
|
407
|
-
/* @__PURE__ */ t("
|
|
408
|
-
|
|
409
|
-
/* @__PURE__ */ t("img", { src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png", alt: "SPEAKID Logo", style: n.gmLogoImg, loading: "lazy" })
|
|
410
|
-
] }) })
|
|
411
|
-
),
|
|
385
|
+
}, ce = () => k < S ? (h((e) => e + 1), ne()) : O(!0), me = () => {
|
|
386
|
+
T(!1), O(!1), I(null);
|
|
387
|
+
}, ge = pe(
|
|
388
|
+
() => /* @__PURE__ */ t("div", { style: { ...n.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ s("picture", { children: [
|
|
389
|
+
/* @__PURE__ */ t("source", { srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg", type: "image/svg+xml" }),
|
|
390
|
+
/* @__PURE__ */ t("img", { src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png", alt: "SPEAKID Logo", style: n.gmLogoImg, loading: "lazy" })
|
|
391
|
+
] }) }),
|
|
412
392
|
[]
|
|
413
393
|
);
|
|
414
394
|
return /* @__PURE__ */ t(
|
|
415
395
|
"div",
|
|
416
396
|
{
|
|
417
|
-
ref:
|
|
397
|
+
ref: o,
|
|
418
398
|
style: {
|
|
419
|
-
|
|
420
|
-
position: "absolute",
|
|
399
|
+
position: "fixed",
|
|
421
400
|
inset: 0,
|
|
422
401
|
display: "flex",
|
|
423
402
|
justifyContent: "center",
|
|
@@ -425,16 +404,16 @@ function We() {
|
|
|
425
404
|
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
426
405
|
transition: "background 0.3s ease",
|
|
427
406
|
overflow: "hidden",
|
|
428
|
-
zIndex:
|
|
407
|
+
zIndex: 9999,
|
|
429
408
|
pointerEvents: "auto"
|
|
430
409
|
},
|
|
431
410
|
children: /* @__PURE__ */ t(
|
|
432
411
|
"div",
|
|
433
412
|
{
|
|
434
|
-
ref:
|
|
413
|
+
ref: g,
|
|
435
414
|
style: {
|
|
436
|
-
width:
|
|
437
|
-
height:
|
|
415
|
+
width: i ? `${i}px` : w ? "100%" : "1000px",
|
|
416
|
+
height: i ? `${i}px` : w ? "100%" : "1000px",
|
|
438
417
|
maxWidth: "calc(100vw - 24px)",
|
|
439
418
|
maxHeight: "calc(100vh - 20px)",
|
|
440
419
|
display: "flex",
|
|
@@ -458,69 +437,69 @@ function We() {
|
|
|
458
437
|
justifyContent: "center",
|
|
459
438
|
alignItems: "center"
|
|
460
439
|
},
|
|
461
|
-
children: /* @__PURE__ */
|
|
462
|
-
!w &&
|
|
463
|
-
!
|
|
440
|
+
children: /* @__PURE__ */ s("div", { id: "whats-missing-root", children: [
|
|
441
|
+
!w && ge,
|
|
442
|
+
!C && !u && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
|
|
464
443
|
/* @__PURE__ */ t("h1", { style: n.gmHeadline1, children: "WHAT'S MISSING?" }),
|
|
465
444
|
/* @__PURE__ */ t("p", { style: n.gmBodyM, children: "Select a theme:" }),
|
|
466
|
-
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ t("button", { style: n.gmButton, onClick: () =>
|
|
467
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ t("button", { style: n.gmButton, onClick: () => I(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
|
|
446
|
+
/* @__PURE__ */ s("div", { style: { marginTop: 24 }, children: [
|
|
468
447
|
/* @__PURE__ */ t("p", { style: n.gmBodyS, children: "Choose number of rounds:" }),
|
|
469
448
|
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ t(
|
|
470
449
|
"button",
|
|
471
450
|
{
|
|
472
451
|
style: {
|
|
473
452
|
...n.gmButton,
|
|
474
|
-
...
|
|
453
|
+
...S === e ? n.gmButtonActive : {}
|
|
475
454
|
},
|
|
476
|
-
onClick: () =>
|
|
455
|
+
onClick: () => a(e),
|
|
477
456
|
children: e
|
|
478
457
|
},
|
|
479
458
|
e
|
|
480
459
|
)) })
|
|
481
460
|
] })
|
|
482
461
|
] }),
|
|
483
|
-
|
|
484
|
-
/* @__PURE__ */
|
|
462
|
+
C && !u && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
|
|
463
|
+
/* @__PURE__ */ s("h1", { style: n.gmHeadline1, children: [
|
|
485
464
|
"Theme selected: ",
|
|
486
|
-
|
|
465
|
+
C
|
|
487
466
|
] }),
|
|
488
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ s("p", { style: n.gmBodyM, children: [
|
|
489
468
|
"Rounds: ",
|
|
490
|
-
|
|
469
|
+
S
|
|
491
470
|
] }),
|
|
492
|
-
/* @__PURE__ */ t("button", { style: n.gmButton, onClick:
|
|
471
|
+
/* @__PURE__ */ t("button", { style: n.gmButton, onClick: te, children: "▶ Start game" })
|
|
493
472
|
] }),
|
|
494
|
-
|
|
473
|
+
j && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
|
|
495
474
|
/* @__PURE__ */ t("h1", { style: n.gmHeadline1, children: "Results" }),
|
|
496
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ s("h2", { style: n.gmHeadline3, children: [
|
|
497
476
|
"Your score: ",
|
|
498
|
-
|
|
477
|
+
se,
|
|
499
478
|
" / ",
|
|
500
|
-
|
|
479
|
+
S
|
|
501
480
|
] }),
|
|
502
481
|
/* @__PURE__ */ t("p", { style: { ...n.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */
|
|
482
|
+
/* @__PURE__ */ s("table", { style: n.gmTable, children: [
|
|
483
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ s("tr", { children: [
|
|
505
484
|
/* @__PURE__ */ t("th", { children: "Round" }),
|
|
506
485
|
/* @__PURE__ */ t("th", { children: "Your Answer" }),
|
|
507
486
|
/* @__PURE__ */ t("th", { children: "Correct" }),
|
|
508
487
|
/* @__PURE__ */ t("th", { children: "Result" })
|
|
509
488
|
] }) }),
|
|
510
|
-
/* @__PURE__ */ t("tbody", { children:
|
|
489
|
+
/* @__PURE__ */ t("tbody", { children: le.map((e, r) => /* @__PURE__ */ s("tr", { children: [
|
|
511
490
|
/* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.round }),
|
|
512
491
|
/* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.answer || "—" }),
|
|
513
492
|
/* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.correct }),
|
|
514
493
|
/* @__PURE__ */ t("td", { style: n.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
515
|
-
] },
|
|
494
|
+
] }, r)) })
|
|
516
495
|
] }),
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
-
/* @__PURE__ */ t("button", { style: n.gmButton, onClick:
|
|
519
|
-
/* @__PURE__ */ t("button", { style: n.gmButton, onClick:
|
|
496
|
+
/* @__PURE__ */ s("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
497
|
+
/* @__PURE__ */ t("button", { style: n.gmButton, onClick: te, children: "🔁 Play again" }),
|
|
498
|
+
/* @__PURE__ */ t("button", { style: n.gmButton, onClick: me, children: "⬅️ Choose theme" })
|
|
520
499
|
] })
|
|
521
500
|
] }),
|
|
522
|
-
|
|
523
|
-
/* @__PURE__ */
|
|
501
|
+
u && !j && /* @__PURE__ */ s("div", { style: n.gmGameLayout, children: [
|
|
502
|
+
/* @__PURE__ */ s(
|
|
524
503
|
"div",
|
|
525
504
|
{
|
|
526
505
|
style: {
|
|
@@ -531,79 +510,79 @@ function We() {
|
|
|
531
510
|
alignItems: "center"
|
|
532
511
|
},
|
|
533
512
|
children: [
|
|
534
|
-
|
|
513
|
+
b === "ready" && /* @__PURE__ */ s(he, { children: [
|
|
535
514
|
/* @__PURE__ */ t("h1", { style: { ...n.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
536
515
|
/* @__PURE__ */ t("div", { style: n.gmHourglass, children: "⏳" })
|
|
537
516
|
] }),
|
|
538
|
-
|
|
517
|
+
b === "memorize" && /* @__PURE__ */ s("p", { style: { ...n.gmBodyM, color: "#10b981" }, children: [
|
|
539
518
|
"MEMORIZE (",
|
|
540
|
-
|
|
519
|
+
F,
|
|
541
520
|
")"
|
|
542
521
|
] }),
|
|
543
|
-
|
|
522
|
+
b === "guess" && !M && /* @__PURE__ */ s("p", { style: n.gmBodyM, children: [
|
|
544
523
|
"⏳ Time left: ",
|
|
545
|
-
|
|
524
|
+
G,
|
|
546
525
|
"s"
|
|
547
526
|
] })
|
|
548
527
|
]
|
|
549
528
|
}
|
|
550
529
|
),
|
|
551
|
-
|
|
552
|
-
const e = w ? 12 : 20,
|
|
530
|
+
b !== "ready" && (() => {
|
|
531
|
+
const e = w ? 12 : 20, r = 32, p = i ?? d ?? (w ? 360 : 1e3), c = w ? 2 : 3, f = Math.max(
|
|
553
532
|
90,
|
|
554
|
-
Math.floor((
|
|
533
|
+
Math.floor((p - r - e * (c - 1)) / c)
|
|
555
534
|
);
|
|
556
535
|
return /* @__PURE__ */ t(
|
|
557
536
|
"div",
|
|
558
537
|
{
|
|
559
538
|
style: {
|
|
560
539
|
...n.gmGrid,
|
|
561
|
-
gridTemplateColumns: `repeat(${
|
|
562
|
-
gridAutoRows: `${
|
|
540
|
+
gridTemplateColumns: `repeat(${c}, ${f}px)`,
|
|
541
|
+
gridAutoRows: `${f}px`,
|
|
563
542
|
gap: `${e}px`,
|
|
564
543
|
justifyContent: "center",
|
|
565
544
|
justifyItems: "center",
|
|
566
545
|
padding: 8,
|
|
567
546
|
boxSizing: "border-box"
|
|
568
547
|
},
|
|
569
|
-
children:
|
|
570
|
-
const
|
|
548
|
+
children: v.map((H, R) => {
|
|
549
|
+
const ue = x === R && b === "guess" && !M;
|
|
571
550
|
return /* @__PURE__ */ t(
|
|
572
551
|
"div",
|
|
573
552
|
{
|
|
574
553
|
style: {
|
|
575
554
|
...n.gmCard,
|
|
576
|
-
width: `${
|
|
577
|
-
height: `${
|
|
555
|
+
width: `${f}px`,
|
|
556
|
+
height: `${f}px`,
|
|
578
557
|
padding: w ? 8 : 10,
|
|
579
558
|
boxSizing: "border-box",
|
|
580
|
-
...Q === "correct" &&
|
|
581
|
-
...Q === "wrong" &&
|
|
559
|
+
...Q === "correct" && x === R ? n.gmCorrect : {},
|
|
560
|
+
...Q === "wrong" && x === R ? n.gmWrong : {}
|
|
582
561
|
},
|
|
583
|
-
children: !
|
|
562
|
+
children: !ue && /* @__PURE__ */ t(
|
|
584
563
|
"img",
|
|
585
564
|
{
|
|
586
|
-
src:
|
|
587
|
-
alt:
|
|
565
|
+
src: H.src,
|
|
566
|
+
alt: H.name,
|
|
588
567
|
style: { width: "100%", height: "100%", objectFit: "cover", display: "block" }
|
|
589
568
|
}
|
|
590
569
|
)
|
|
591
570
|
},
|
|
592
|
-
|
|
571
|
+
R
|
|
593
572
|
);
|
|
594
573
|
})
|
|
595
574
|
}
|
|
596
575
|
);
|
|
597
576
|
})(),
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
-
|
|
577
|
+
/* @__PURE__ */ s("div", { style: { marginTop: 16, height: 80 }, children: [
|
|
578
|
+
b === "guess" && !M && /* @__PURE__ */ s("div", { children: [
|
|
600
579
|
/* @__PURE__ */ t(
|
|
601
580
|
"input",
|
|
602
581
|
{
|
|
603
582
|
type: "text",
|
|
604
583
|
placeholder: "Type the missing word",
|
|
605
|
-
value:
|
|
606
|
-
onChange: (e) =>
|
|
584
|
+
value: E,
|
|
585
|
+
onChange: (e) => K(e.target.value),
|
|
607
586
|
style: n.gmInput
|
|
608
587
|
}
|
|
609
588
|
),
|
|
@@ -611,13 +590,13 @@ function We() {
|
|
|
611
590
|
"button",
|
|
612
591
|
{
|
|
613
592
|
style: { ...n.gmButton, marginLeft: 8 },
|
|
614
|
-
onClick:
|
|
615
|
-
disabled:
|
|
616
|
-
children:
|
|
593
|
+
onClick: de,
|
|
594
|
+
disabled: q,
|
|
595
|
+
children: q ? "..." : "Check"
|
|
617
596
|
}
|
|
618
597
|
)
|
|
619
598
|
] }),
|
|
620
|
-
|
|
599
|
+
M && /* @__PURE__ */ t("button", { type: "button", style: n.gmButton, onClick: ce, children: "Next round" })
|
|
621
600
|
] })
|
|
622
601
|
] })
|
|
623
602
|
] })
|
|
@@ -629,6 +608,6 @@ function We() {
|
|
|
629
608
|
);
|
|
630
609
|
}
|
|
631
610
|
export {
|
|
632
|
-
|
|
633
|
-
|
|
611
|
+
Ie as Game,
|
|
612
|
+
ie as themes
|
|
634
613
|
};
|