speakid-build-a-sentence 1.0.21 → 1.0.22
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import { useState as h, useCallback as we, useRef as
|
|
1
|
+
import { jsx as l, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useCallback as we, useRef as Q, useEffect as V, useMemo as dn, Component as an } from "react";
|
|
3
3
|
const ln = `
|
|
4
4
|
@keyframes spin {
|
|
5
5
|
from { transform: rotate(0deg); }
|
|
@@ -173,50 +173,50 @@ const De = {
|
|
|
173
173
|
// ===== Анимационные стили =====
|
|
174
174
|
...De
|
|
175
175
|
}, cn = () => {
|
|
176
|
-
const [w, s] = h([]),
|
|
176
|
+
const [w, s] = h([]), H = we((z, E, m) => {
|
|
177
177
|
const W = [];
|
|
178
|
-
|
|
178
|
+
z.trim() || W.push({
|
|
179
179
|
type: "empty",
|
|
180
180
|
message: "Sentence cannot be empty"
|
|
181
|
-
}),
|
|
181
|
+
}), z.length > 41 && W.push({
|
|
182
182
|
type: "length",
|
|
183
|
-
message: `Sentence is too long (${
|
|
184
|
-
}),
|
|
183
|
+
message: `Sentence is too long (${z.length}/41 characters)`
|
|
184
|
+
}), z && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(z) && W.push({
|
|
185
185
|
type: "characters",
|
|
186
186
|
message: "Only Latin characters, numbers, spaces and punctuation are allowed"
|
|
187
187
|
});
|
|
188
|
-
const
|
|
189
|
-
return
|
|
188
|
+
const k = m.findIndex((R, ee) => ee !== E && R.toLowerCase().trim() === z.toLowerCase().trim());
|
|
189
|
+
return k !== -1 && W.push({
|
|
190
190
|
type: "duplicate",
|
|
191
|
-
message: `Duplicate sentence (same as sentence ${
|
|
191
|
+
message: `Duplicate sentence (same as sentence ${k + 1})`
|
|
192
192
|
}), s(W), {
|
|
193
193
|
isValid: W.length === 0,
|
|
194
194
|
errors: W
|
|
195
195
|
};
|
|
196
|
-
}, []),
|
|
197
|
-
const
|
|
198
|
-
return
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
...
|
|
202
|
-
message: `Sentence ${W + 1}: ${
|
|
196
|
+
}, []), le = we((z) => {
|
|
197
|
+
const E = [];
|
|
198
|
+
return z.forEach((m, W) => {
|
|
199
|
+
const b = H(m, W, z);
|
|
200
|
+
E.push(...b.errors.map((k) => ({
|
|
201
|
+
...k,
|
|
202
|
+
message: `Sentence ${W + 1}: ${k.message}`
|
|
203
203
|
})));
|
|
204
204
|
}), {
|
|
205
|
-
isValid:
|
|
206
|
-
errors:
|
|
205
|
+
isValid: E.length === 0,
|
|
206
|
+
errors: E
|
|
207
207
|
};
|
|
208
|
-
}, [
|
|
208
|
+
}, [H]), ce = we(() => {
|
|
209
209
|
s([]);
|
|
210
210
|
}, []);
|
|
211
211
|
return {
|
|
212
212
|
errors: w,
|
|
213
|
-
validateSentence:
|
|
214
|
-
validateAllSentences:
|
|
215
|
-
clearErrors:
|
|
213
|
+
validateSentence: H,
|
|
214
|
+
validateAllSentences: le,
|
|
215
|
+
clearErrors: ce
|
|
216
216
|
};
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
},
|
|
217
|
+
}, un = (w, s, H) => s && H ? `${w} word "${s}" ${H}` : s ? `${w} word "${s}"` : w, hn = (w, s, H = ["Enter", " "]) => {
|
|
218
|
+
H.includes(w.key) && (w.preventDefault(), s());
|
|
219
|
+
}, L = (w) => {
|
|
220
220
|
const s = document.createElement("div");
|
|
221
221
|
s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.style.position = "absolute", s.style.left = "-10000px", s.style.width = "1px", s.style.height = "1px", s.style.overflow = "hidden", document.body.appendChild(s), s.textContent = w, setTimeout(() => {
|
|
222
222
|
document.body.removeChild(s);
|
|
@@ -254,7 +254,7 @@ const De = {
|
|
|
254
254
|
s && s.remove(), document.head.appendChild(w);
|
|
255
255
|
}, pn = (w) => [...w].sort(() => Math.random() - 0.5);
|
|
256
256
|
function bn(w = {}) {
|
|
257
|
-
const { logoUrl: s, showLogo:
|
|
257
|
+
const { logoUrl: s, showLogo: H = !0 } = w, le = Q(null), { validateAllSentences: ce, errors: z } = cn(), E = () => a || window.innerWidth < 768, m = () => a || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, W = (e = "medium") => {
|
|
258
258
|
if (!m())
|
|
259
259
|
return {
|
|
260
260
|
padding: "12px 24px",
|
|
@@ -282,26 +282,26 @@ function bn(w = {}) {
|
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
|
-
|
|
285
|
+
V(() => (gn(), () => {
|
|
286
286
|
document.documentElement.style.overflow = "", document.body.style.overflow = "";
|
|
287
287
|
const e = document.getElementById("magic-sentence-reset");
|
|
288
288
|
e && e.remove();
|
|
289
289
|
}), []);
|
|
290
|
-
const [
|
|
290
|
+
const [b, k] = h("select"), [R, ee] = h(null), [fe, me] = h(null), [T, ne] = h([]), [C, xe] = h(0), [ue, ye] = h([]), [S, he] = h([]), [U, be] = h(20), [J, B] = h(0), [wn, We] = h(null), [A, v] = h(null), [c, te] = h(!1), [Y, K] = h(!1), [ge, Re] = h(
|
|
291
291
|
Number(localStorage.getItem("magicSentenceBest")) || 0
|
|
292
|
-
),
|
|
293
|
-
|
|
292
|
+
), Z = Q(null), ze = Q(null), Se = Q(0), [x, M] = h({ list: null, id: null, side: null }), [a, Ee] = h(!1), [Pe, ie] = h(1), [ke, re] = h(null), [Be, Me] = h(!1), [$, Le] = h(!1), [O, Ae] = h(!1), [N, $e] = h(!1), [G, Oe] = h(!1), [X, Ne] = h(!1), [j, Ge] = h(!1), [F, Xe] = h(!1), [q, je] = h(!1), [fn, Fe] = h(!1), [mn, qe] = h(!1);
|
|
293
|
+
V(() => {
|
|
294
294
|
const e = () => {
|
|
295
|
-
const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430, r = n < 700,
|
|
296
|
-
Me(Ce), Le(p), Ae(o), $e(
|
|
295
|
+
const t = window.innerWidth, n = window.innerHeight, i = t < 768 || t === 926 && n === 428 || t === 932 && n === 430, r = n < 700, u = t / n > 1.8, p = t === 768 && n === 1024, o = t === 1024 && n === 768, d = t === 820 && n === 1180, D = t === 1180 && n === 820, I = t === 540 && n === 720, ae = t === 720 && n === 540, Ie = t === 1024 && n === 1366, Te = t === 1366 && n === 1024, Ce = t >= 1200 && n >= 600 && !i;
|
|
296
|
+
Me(Ce), Le(p), Ae(o), $e(d), Oe(D), Ne(I), Ge(ae), Xe(Ie), je(Te), qe(u);
|
|
297
297
|
const sn = i && t > n || i || // ✅ ВСЕ мобильные устройства (включая portrait)
|
|
298
|
-
n < 700 ||
|
|
299
|
-
t === 1366 && n === 766 || t === 1366 && n === 768 || t === 1280 && n === 720 || t === 1440 && n === 900 || p || o ||
|
|
298
|
+
n < 700 || u || // ✅ Широкие экраны
|
|
299
|
+
t === 1366 && n === 766 || t === 1366 && n === 768 || t === 1280 && n === 720 || t === 1440 && n === 900 || p || o || d || D || I || ae || Ie || Te || Ce;
|
|
300
300
|
if (Fe(sn), Ee(i), i)
|
|
301
301
|
re(null), ie(1);
|
|
302
302
|
else if (r)
|
|
303
303
|
re(null), ie(1);
|
|
304
|
-
else if (
|
|
304
|
+
else if (u) {
|
|
305
305
|
const pe = Math.min(1e3, Math.min(t, n) * 0.9);
|
|
306
306
|
re(pe), ie(0.85);
|
|
307
307
|
} else {
|
|
@@ -312,22 +312,22 @@ function bn(w = {}) {
|
|
|
312
312
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
313
313
|
}, []);
|
|
314
314
|
const oe = (e, t, n, i) => {
|
|
315
|
-
if (
|
|
316
|
-
let r = [...
|
|
317
|
-
const p = e === "bank" ? r :
|
|
318
|
-
if (
|
|
319
|
-
const [
|
|
320
|
-
let
|
|
321
|
-
e === t &&
|
|
322
|
-
},
|
|
323
|
-
if (e.preventDefault(),
|
|
324
|
-
|
|
315
|
+
if (c) return;
|
|
316
|
+
let r = [...ue], u = [...S];
|
|
317
|
+
const p = e === "bank" ? r : u, o = t === "bank" ? r : u, d = p.findIndex((ae) => ae.id === n);
|
|
318
|
+
if (d === -1) return;
|
|
319
|
+
const [D] = p.splice(d, 1);
|
|
320
|
+
let I = i;
|
|
321
|
+
e === t && I !== null && I !== void 0 && I > d && (I = I - 1), I == null || I < 0 || I > o.length ? o.push(D) : o.splice(I, 0, D), e === "bank" ? r = p : u = p, t === "bank" ? r = o : u = o, ye(r), he(u);
|
|
322
|
+
}, _ = (e, t, n) => {
|
|
323
|
+
if (e.preventDefault(), c) {
|
|
324
|
+
M({ list: null, id: null, side: null });
|
|
325
325
|
return;
|
|
326
326
|
}
|
|
327
327
|
const i = e.dataTransfer.getData("application/x-token") || (() => {
|
|
328
328
|
const r = e.dataTransfer.getData("text/plain");
|
|
329
329
|
if (!r) return "";
|
|
330
|
-
const
|
|
330
|
+
const u = ue.some((d) => d.id === r), p = S.some((d) => d.id === r), o = u ? "bank" : p ? "selected" : null;
|
|
331
331
|
return o ? JSON.stringify({ from: o, id: r }) : "";
|
|
332
332
|
})();
|
|
333
333
|
if (i) {
|
|
@@ -337,91 +337,103 @@ function bn(w = {}) {
|
|
|
337
337
|
oe(r.from, t, r.id, n);
|
|
338
338
|
} catch {
|
|
339
339
|
}
|
|
340
|
-
|
|
340
|
+
M({ list: null, id: null, side: null });
|
|
341
341
|
}
|
|
342
342
|
}, Ve = (e) => {
|
|
343
|
-
|
|
343
|
+
ee(e), ze.current = e, ne(Array(e).fill("")), k("time");
|
|
344
344
|
}, Ue = (e) => {
|
|
345
|
-
me(e),
|
|
345
|
+
me(e), k("type");
|
|
346
346
|
}, Je = (e, t) => {
|
|
347
347
|
if (t.length > 41 || t && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(t))
|
|
348
348
|
return;
|
|
349
|
-
const i = [...
|
|
350
|
-
i[e] = t,
|
|
351
|
-
const r =
|
|
349
|
+
const i = [...T];
|
|
350
|
+
i[e] = t, ne(i);
|
|
351
|
+
const r = ce(i);
|
|
352
352
|
r.isValid || console.warn("Validation errors:", r.errors);
|
|
353
353
|
}, Ye = (e) => e.trim().replace(/\s+/g, " "), ve = (e) => e <= 3 ? 20 : e <= 5 ? 18 : e <= 7 ? 16 : e <= 9 ? 14 : 12, Ke = () => {
|
|
354
|
-
|
|
354
|
+
T.some((t) => t.trim().length === 0) || (ne((t) => t.map((n) => Ye(n))), B(0), xe(0), Se.current = 0, We(null), k("getready"));
|
|
355
355
|
};
|
|
356
|
-
|
|
357
|
-
if (
|
|
358
|
-
const e = setTimeout(() =>
|
|
356
|
+
V(() => {
|
|
357
|
+
if (b === "getready") {
|
|
358
|
+
const e = setTimeout(() => se(0), 3e3);
|
|
359
359
|
return () => clearTimeout(e);
|
|
360
360
|
}
|
|
361
|
-
}, [
|
|
362
|
-
const
|
|
363
|
-
const t =
|
|
361
|
+
}, [b]);
|
|
362
|
+
const se = (e) => {
|
|
363
|
+
const t = T[e];
|
|
364
364
|
if (!t) return;
|
|
365
365
|
const i = pn(
|
|
366
366
|
t.trim().split(/\s+/).filter(Boolean)
|
|
367
|
-
).map((r,
|
|
368
|
-
id: `${Date.now()}-${e}-${
|
|
367
|
+
).map((r, u) => ({
|
|
368
|
+
id: `${Date.now()}-${e}-${u}-${Math.random().toString(36).slice(2)}`,
|
|
369
369
|
text: r
|
|
370
370
|
}));
|
|
371
|
-
ye(i),
|
|
372
|
-
}, f =
|
|
373
|
-
|
|
374
|
-
if (
|
|
371
|
+
ye(i), he([]), xe(e), Se.current = e, be(fe || 20), v(null), te(!1), K(!1), k("play");
|
|
372
|
+
}, f = Q(null);
|
|
373
|
+
V(() => {
|
|
374
|
+
if (b !== "play" || c) {
|
|
375
375
|
f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
|
-
const e = C
|
|
378
|
+
const e = T[C];
|
|
379
379
|
if (!e) {
|
|
380
|
-
|
|
380
|
+
v(null), f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
|
-
if (
|
|
384
|
-
|
|
383
|
+
if (S.length === 0) {
|
|
384
|
+
v(null), f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
385
385
|
return;
|
|
386
386
|
}
|
|
387
|
-
const t = e.trim().split(/\s+/), n =
|
|
388
|
-
if (n.length === t.length && n.every((r,
|
|
389
|
-
f.current !== null && (window.clearTimeout(f.current), f.current = null),
|
|
390
|
-
else if (n.length >= t.length
|
|
387
|
+
const t = e.trim().split(/\s+/), n = S.map((r) => r.text);
|
|
388
|
+
if (n.length === t.length && n.every((r, u) => r === t[u]))
|
|
389
|
+
f.current !== null && (window.clearTimeout(f.current), f.current = null), v("correct"), Y || (K(!0), B((r) => r + 1), P("correct"), L("Correct! Well done!"));
|
|
390
|
+
else if (n.length >= t.length) {
|
|
391
391
|
f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
392
|
-
const
|
|
393
|
-
|
|
392
|
+
const r = t.filter((d) => !n.includes(d)).length, u = n.filter((d) => !t.includes(d)).length, p = t.filter((d, D) => d !== n[D]).length, o = r + u + p;
|
|
393
|
+
v(o === 1 ? "almost" : "wrong"), Y && (K(!1), B((d) => Math.max(0, d - 1)));
|
|
394
394
|
} else
|
|
395
|
-
|
|
395
|
+
v(null), f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
396
396
|
return () => {
|
|
397
397
|
f.current !== null && (window.clearTimeout(f.current), f.current = null);
|
|
398
398
|
};
|
|
399
|
-
}, [S,
|
|
400
|
-
if (
|
|
401
|
-
if (
|
|
402
|
-
|
|
399
|
+
}, [b, S, T, C, c, A, Y, R]), V(() => {
|
|
400
|
+
if (b === "play" && !c)
|
|
401
|
+
if (Z.current !== null && window.clearTimeout(Z.current), U > 0)
|
|
402
|
+
Z.current = window.setTimeout(() => be((e) => e - 1), 1e3);
|
|
403
403
|
else {
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
|
|
404
|
+
te(!0);
|
|
405
|
+
const e = T[C];
|
|
406
|
+
if (!e) {
|
|
407
|
+
v(null);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const t = e.trim().split(/\s+/), n = S.map((o) => o.text), i = t.filter((o) => !n.includes(o)).length, r = n.filter((o) => !t.includes(o)).length, u = t.filter((o, d) => o !== n[d]).length, p = i + r + u;
|
|
411
|
+
p === 0 ? (v("correct"), Y || (K(!0), B((o) => o + 1)), P("correct"), L("Correct! Well done!")) : p === 1 ? (v("almost"), B((o) => o + 0.5), P("half"), L("Almost correct! Just one mistake.")) : (v("wrong"), P("wrong"), L("Not quite right. Keep trying!"));
|
|
407
412
|
}
|
|
408
413
|
return () => {
|
|
409
|
-
|
|
414
|
+
Z.current !== null && window.clearTimeout(Z.current);
|
|
410
415
|
};
|
|
411
|
-
}, [
|
|
416
|
+
}, [b, U, c, T, C, S, Y]);
|
|
412
417
|
const Ze = (e = !0) => {
|
|
413
|
-
if (
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
const
|
|
419
|
-
|
|
418
|
+
if (e) {
|
|
419
|
+
if (c) {
|
|
420
|
+
C + 1 < (R || 0) ? se(C + 1) : (k("results"), setTimeout(() => de(), 600));
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const t = T[C];
|
|
424
|
+
if (!t) {
|
|
425
|
+
C + 1 < (R || 0) ? se(C + 1) : (k("results"), setTimeout(() => de(), 600));
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
const n = t.trim().split(/\s+/), i = S.map((d) => d.text), r = n.filter((d) => !i.includes(d)).length, u = i.filter((d) => !n.includes(d)).length, p = n.filter((d, D) => d !== i[D]).length, o = r + u + p;
|
|
429
|
+
o === 0 ? (B((d) => d + 1), v("correct"), K(!0), P("correct"), L("Correct! Well done!")) : o === 1 ? (B((d) => d + 0.5), v("almost"), P("half"), L("Almost correct! Just one mistake.")) : (v("wrong"), P("wrong"), L("Not quite right. Keep trying!")), C + 1 < (R || 0) ? setTimeout(() => se(C + 1), 800) : setTimeout(() => {
|
|
430
|
+
k("results"), setTimeout(() => de(), 600);
|
|
431
|
+
}, 800);
|
|
420
432
|
}
|
|
421
433
|
};
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}, [
|
|
434
|
+
V(() => {
|
|
435
|
+
b === "results" && J > ge && (Re(J), localStorage.setItem("magicSentenceBest", String(J)));
|
|
436
|
+
}, [b, J, ge]);
|
|
425
437
|
const P = (e) => {
|
|
426
438
|
const t = new (window.AudioContext || window.webkitAudioContext)(), n = t.createOscillator(), i = t.createGain();
|
|
427
439
|
switch (n.connect(i), i.connect(t.destination), e) {
|
|
@@ -442,10 +454,10 @@ function bn(w = {}) {
|
|
|
442
454
|
break;
|
|
443
455
|
}
|
|
444
456
|
i.gain.setValueAtTime(0.1, t.currentTime), n.start(), n.stop(t.currentTime + 0.2);
|
|
445
|
-
},
|
|
457
|
+
}, de = () => {
|
|
446
458
|
const t = Date.now() + 2500, n = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], i = document.createElement("canvas"), r = i.getContext("2d");
|
|
447
459
|
i.width = window.innerWidth, i.height = window.innerHeight, i.style.position = "fixed", i.style.top = "0", i.style.left = "0", i.style.pointerEvents = "none", document.body.appendChild(i);
|
|
448
|
-
const
|
|
460
|
+
const u = Array.from({ length: 100 }).map(() => ({
|
|
449
461
|
x: Math.random() * i.width,
|
|
450
462
|
y: Math.random() * i.height - i.height,
|
|
451
463
|
size: 6 + Math.random() * 6,
|
|
@@ -453,19 +465,19 @@ function bn(w = {}) {
|
|
|
453
465
|
speed: 2 + Math.random() * 4,
|
|
454
466
|
tilt: Math.random() * 2 * Math.PI
|
|
455
467
|
})), p = () => {
|
|
456
|
-
r.clearRect(0, 0, i.width, i.height),
|
|
468
|
+
r.clearRect(0, 0, i.width, i.height), u.forEach((o) => {
|
|
457
469
|
r.fillStyle = o.color, r.beginPath(), r.ellipse(o.x, o.y, o.size, o.size / 2, o.tilt, 0, 2 * Math.PI), r.fill(), o.y += o.speed, o.x += Math.sin(o.tilt);
|
|
458
470
|
}), Date.now() < t ? requestAnimationFrame(p) : document.body.removeChild(i);
|
|
459
471
|
};
|
|
460
472
|
p();
|
|
461
|
-
}, _e = () => /* @__PURE__ */
|
|
473
|
+
}, _e = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
462
474
|
/* @__PURE__ */ l("h1", { style: g.gmHeadline1, children: "MAGIC SENTENCE" }),
|
|
463
475
|
/* @__PURE__ */ l("p", { style: g.gmBodyM, children: "Select number of rounds" }),
|
|
464
476
|
/* @__PURE__ */ l("div", { style: {
|
|
465
477
|
display: "flex",
|
|
466
478
|
gap: m() ? "8px" : "16px",
|
|
467
479
|
justifyContent: "center"
|
|
468
|
-
}, children: [3, 4, 5].map((e) => /* @__PURE__ */
|
|
480
|
+
}, children: [3, 4, 5].map((e) => /* @__PURE__ */ y(
|
|
469
481
|
"button",
|
|
470
482
|
{
|
|
471
483
|
onClick: () => Ve(e),
|
|
@@ -480,14 +492,14 @@ function bn(w = {}) {
|
|
|
480
492
|
},
|
|
481
493
|
e
|
|
482
494
|
)) })
|
|
483
|
-
] }), Qe = () => /* @__PURE__ */
|
|
495
|
+
] }), Qe = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
484
496
|
/* @__PURE__ */ l("h1", { style: g.gmHeadline1, children: "MAGIC SENTENCE" }),
|
|
485
497
|
/* @__PURE__ */ l("p", { style: g.gmBodyM, children: "Select time per round" }),
|
|
486
498
|
/* @__PURE__ */ l("div", { style: {
|
|
487
499
|
display: "flex",
|
|
488
500
|
gap: m() ? "8px" : "16px",
|
|
489
501
|
justifyContent: "center"
|
|
490
|
-
}, children: [15, 20, 30].map((e) => /* @__PURE__ */
|
|
502
|
+
}, children: [15, 20, 30].map((e) => /* @__PURE__ */ y(
|
|
491
503
|
"button",
|
|
492
504
|
{
|
|
493
505
|
onClick: () => Ue(e),
|
|
@@ -502,12 +514,12 @@ function bn(w = {}) {
|
|
|
502
514
|
},
|
|
503
515
|
e
|
|
504
516
|
)) })
|
|
505
|
-
] }), en = () => /* @__PURE__ */
|
|
506
|
-
/* @__PURE__ */
|
|
517
|
+
] }), en = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
518
|
+
/* @__PURE__ */ y("h2", { style: { ...g.gmBodyM, marginBottom: "0px" }, children: [
|
|
507
519
|
"Type down ",
|
|
508
|
-
|
|
520
|
+
R,
|
|
509
521
|
" sentence",
|
|
510
|
-
|
|
522
|
+
R && R > 1 ? "s" : "",
|
|
511
523
|
" for your student"
|
|
512
524
|
] }),
|
|
513
525
|
/* @__PURE__ */ l("p", { style: { ...g.gmBodyS, marginBottom: "16px", marginTop: "0px", color: "#6b7280" }, children: "Maximum 41 characters per sentence" }),
|
|
@@ -521,7 +533,7 @@ function bn(w = {}) {
|
|
|
521
533
|
// Минимальная ширина по содержимому
|
|
522
534
|
maxWidth: "600px"
|
|
523
535
|
// Ограничиваем максимальную ширину
|
|
524
|
-
}, children:
|
|
536
|
+
}, children: T.map((e, t) => /* @__PURE__ */ l(
|
|
525
537
|
"input",
|
|
526
538
|
{
|
|
527
539
|
value: e,
|
|
@@ -543,34 +555,34 @@ function bn(w = {}) {
|
|
|
543
555
|
"button",
|
|
544
556
|
{
|
|
545
557
|
onClick: Ke,
|
|
546
|
-
disabled:
|
|
558
|
+
disabled: T.some((e) => e.trim().length === 0),
|
|
547
559
|
style: {
|
|
548
560
|
...g.gmButton,
|
|
549
561
|
marginTop: 30,
|
|
550
|
-
background:
|
|
551
|
-
cursor:
|
|
562
|
+
background: T.some((e) => e.trim().length === 0) ? "#ccc" : "#ec4c44",
|
|
563
|
+
cursor: T.some((e) => e.trim().length === 0) ? "not-allowed" : "pointer",
|
|
552
564
|
...W("large")
|
|
553
565
|
},
|
|
554
566
|
children: "PLAY"
|
|
555
567
|
}
|
|
556
568
|
)
|
|
557
|
-
] }), nn = () => /* @__PURE__ */
|
|
569
|
+
] }), nn = () => /* @__PURE__ */ y("div", { style: g.gmReadyWrapper, children: [
|
|
558
570
|
/* @__PURE__ */ l("h1", { style: {
|
|
559
571
|
...g.gmHeadline1,
|
|
560
572
|
color: "#ec4c44"
|
|
561
573
|
}, children: "GET READY" }),
|
|
562
574
|
/* @__PURE__ */ l("div", { style: g.gmHourglass, children: "⏳" })
|
|
563
|
-
] }), tn = () => /* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
575
|
+
] }), tn = () => /* @__PURE__ */ y("div", { style: g.gmGameLayout, children: [
|
|
576
|
+
/* @__PURE__ */ y("h2", { style: {
|
|
565
577
|
marginBottom: m() ? "5px" : "10px",
|
|
566
578
|
fontSize: m() ? "16px" : "20px"
|
|
567
579
|
}, children: [
|
|
568
580
|
"Round ",
|
|
569
|
-
|
|
581
|
+
C + 1,
|
|
570
582
|
"/",
|
|
571
|
-
|
|
583
|
+
R,
|
|
572
584
|
" — ",
|
|
573
|
-
|
|
585
|
+
c ? "TIME'S UP!" : `Time: ${U}s`
|
|
574
586
|
] }),
|
|
575
587
|
/* @__PURE__ */ l(
|
|
576
588
|
"div",
|
|
@@ -588,8 +600,8 @@ function bn(w = {}) {
|
|
|
588
600
|
{
|
|
589
601
|
style: {
|
|
590
602
|
height: "100%",
|
|
591
|
-
width: `${
|
|
592
|
-
background:
|
|
603
|
+
width: `${U / (fe || 20) * 100}%`,
|
|
604
|
+
background: U <= 5 ? "#ec4c44" : "#4caf50",
|
|
593
605
|
transition: "width 1s linear"
|
|
594
606
|
}
|
|
595
607
|
}
|
|
@@ -600,10 +612,10 @@ function bn(w = {}) {
|
|
|
600
612
|
"div",
|
|
601
613
|
{
|
|
602
614
|
onDragOver: (e) => e.preventDefault(),
|
|
603
|
-
onDrop: (e) =>
|
|
615
|
+
onDrop: (e) => _(e, "bank", null),
|
|
604
616
|
style: {
|
|
605
617
|
display: "flex",
|
|
606
|
-
flexWrap:
|
|
618
|
+
flexWrap: E() ? "wrap" : "nowrap",
|
|
607
619
|
gap: a || window.innerWidth < 768 ? "6px" : "10px",
|
|
608
620
|
justifyContent: "center",
|
|
609
621
|
marginBottom: a || window.innerWidth < 768 ? "15px" : "30px",
|
|
@@ -611,52 +623,52 @@ function bn(w = {}) {
|
|
|
611
623
|
width: "100%",
|
|
612
624
|
boxSizing: "border-box"
|
|
613
625
|
},
|
|
614
|
-
children:
|
|
626
|
+
children: ue.map((e, t) => /* @__PURE__ */ l(
|
|
615
627
|
"div",
|
|
616
628
|
{
|
|
617
|
-
draggable: !
|
|
629
|
+
draggable: !c,
|
|
618
630
|
role: "button",
|
|
619
|
-
tabIndex:
|
|
620
|
-
"aria-label":
|
|
631
|
+
tabIndex: c ? -1 : 0,
|
|
632
|
+
"aria-label": c ? `Word: ${e.text} (time expired)` : un("Drag word", e.text, "to build sentence"),
|
|
621
633
|
onDragStart: (n) => {
|
|
622
|
-
if (
|
|
634
|
+
if (c) {
|
|
623
635
|
n.preventDefault();
|
|
624
636
|
return;
|
|
625
637
|
}
|
|
626
638
|
n.dataTransfer.setData(
|
|
627
639
|
"application/x-token",
|
|
628
640
|
JSON.stringify({ from: "bank", id: e.id })
|
|
629
|
-
), n.dataTransfer.setData("text/plain", e.id),
|
|
641
|
+
), n.dataTransfer.setData("text/plain", e.id), L(`Dragging word: ${e.text}`);
|
|
630
642
|
},
|
|
631
643
|
onKeyDown: (n) => {
|
|
632
|
-
|
|
644
|
+
c || hn(n, () => oe("bank", "selected", e.id, null));
|
|
633
645
|
},
|
|
634
646
|
onDragOver: (n) => n.preventDefault(),
|
|
635
647
|
onDrop: (n) => {
|
|
636
|
-
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2,
|
|
637
|
-
|
|
648
|
+
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, u = n.clientX > r ? t + 1 : t;
|
|
649
|
+
M({ list: null, id: null, side: null }), n.stopPropagation(), _(n, "bank", u);
|
|
638
650
|
},
|
|
639
651
|
onDragEnter: (n) => {
|
|
640
|
-
if (
|
|
652
|
+
if (c) return;
|
|
641
653
|
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
|
|
642
|
-
|
|
654
|
+
M({ list: "bank", id: e.id, side: n.clientX > r ? "right" : "left" });
|
|
643
655
|
},
|
|
644
|
-
onDragLeave: () =>
|
|
656
|
+
onDragLeave: () => M({ list: null, id: null, side: null }),
|
|
645
657
|
onClick: () => {
|
|
646
|
-
|
|
658
|
+
c || oe("bank", "selected", e.id, null);
|
|
647
659
|
},
|
|
648
660
|
style: {
|
|
649
661
|
padding: a || window.innerWidth < 768 ? "6px 10px" : "10px 16px",
|
|
650
662
|
borderRadius: a || window.innerWidth < 768 ? "6px" : "10px",
|
|
651
663
|
border: "1px solid #ccc",
|
|
652
|
-
background:
|
|
653
|
-
cursor:
|
|
664
|
+
background: c ? "#f0f0f0" : "#f9f9f9",
|
|
665
|
+
cursor: c ? "not-allowed" : x.list === "bank" && x.id === e.id ? "grabbing" : "grab",
|
|
654
666
|
fontSize: a || window.innerWidth < 768 ? "12px" : "18px",
|
|
655
667
|
...x.list === "bank" && x.id === e.id && x.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
|
|
656
668
|
...x.list === "bank" && x.id === e.id && x.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
|
|
657
669
|
flexShrink: 0,
|
|
658
670
|
flexBasis: "auto",
|
|
659
|
-
opacity:
|
|
671
|
+
opacity: c ? 0.6 : 1,
|
|
660
672
|
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
661
673
|
...x.list === "bank" && x.id === e.id ? {
|
|
662
674
|
transform: "scale(1.05)",
|
|
@@ -676,14 +688,14 @@ function bn(w = {}) {
|
|
|
676
688
|
onDrop: (e) => {
|
|
677
689
|
const t = e.currentTarget.getBoundingClientRect(), n = Array.from(e.currentTarget.children);
|
|
678
690
|
if (n.length === 0) {
|
|
679
|
-
|
|
691
|
+
_(e, "selected", 0);
|
|
680
692
|
return;
|
|
681
693
|
}
|
|
682
|
-
let i =
|
|
683
|
-
n.forEach((
|
|
684
|
-
const o =
|
|
685
|
-
|
|
686
|
-
}), e.clientX > t.right - 30 && (i =
|
|
694
|
+
let i = S.length, r = 1 / 0;
|
|
695
|
+
n.forEach((u, p) => {
|
|
696
|
+
const o = u.getBoundingClientRect(), d = o.left + o.width / 2, D = Math.abs(e.clientX - d);
|
|
697
|
+
D < r && (r = D, i = e.clientX < d ? p : p + 1);
|
|
698
|
+
}), e.clientX > t.right - 30 && (i = S.length), e.clientX < t.left + 30 && (i = 0), _(e, "selected", i);
|
|
687
699
|
},
|
|
688
700
|
style: {
|
|
689
701
|
minHeight: a || window.innerWidth < 768 ? "50px" : "70px",
|
|
@@ -697,20 +709,20 @@ function bn(w = {}) {
|
|
|
697
709
|
borderRadius: a || window.innerWidth < 768 ? "8px" : "12px",
|
|
698
710
|
padding: a || window.innerWidth < 768 ? "8px" : "12px",
|
|
699
711
|
display: "flex",
|
|
700
|
-
flexWrap:
|
|
712
|
+
flexWrap: E() ? "wrap" : "nowrap",
|
|
701
713
|
alignItems: "center",
|
|
702
714
|
justifyContent: "center",
|
|
703
|
-
fontSize: `${ve(
|
|
715
|
+
fontSize: `${ve(S.length)}px`,
|
|
704
716
|
background: A === "correct" ? "#e8f5e8" : A === "almost" ? "#fff3e0" : A === "wrong" ? "#ffebee" : "#fafafa",
|
|
705
|
-
overflowX:
|
|
706
|
-
whiteSpace:
|
|
717
|
+
overflowX: E() ? "hidden" : "auto",
|
|
718
|
+
whiteSpace: E() ? "normal" : "nowrap"
|
|
707
719
|
},
|
|
708
|
-
children:
|
|
720
|
+
children: S.map((e, t) => /* @__PURE__ */ l(
|
|
709
721
|
"span",
|
|
710
722
|
{
|
|
711
|
-
draggable: !
|
|
723
|
+
draggable: !c,
|
|
712
724
|
onDragStart: (n) => {
|
|
713
|
-
if (
|
|
725
|
+
if (c) {
|
|
714
726
|
n.preventDefault();
|
|
715
727
|
return;
|
|
716
728
|
}
|
|
@@ -721,36 +733,36 @@ function bn(w = {}) {
|
|
|
721
733
|
},
|
|
722
734
|
onDragOver: (n) => n.preventDefault(),
|
|
723
735
|
onDrop: (n) => {
|
|
724
|
-
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2,
|
|
725
|
-
|
|
736
|
+
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2, u = i.width * 0.25, p = n.clientX < r - u ? t : n.clientX > r + u || n.clientX > r ? t + 1 : t;
|
|
737
|
+
M({ list: null, id: null, side: null }), n.stopPropagation(), _(n, "selected", p);
|
|
726
738
|
},
|
|
727
739
|
onDragEnter: (n) => {
|
|
728
|
-
if (
|
|
740
|
+
if (c) return;
|
|
729
741
|
const i = n.currentTarget.getBoundingClientRect(), r = i.left + i.width / 2;
|
|
730
|
-
|
|
742
|
+
M({ list: "selected", id: e.id, side: n.clientX > r ? "right" : "left" });
|
|
731
743
|
},
|
|
732
|
-
onDragLeave: () =>
|
|
744
|
+
onDragLeave: () => M({ list: null, id: null, side: null }),
|
|
733
745
|
onClick: () => {
|
|
734
|
-
|
|
746
|
+
c || oe("selected", "bank", e.id, null);
|
|
735
747
|
},
|
|
736
|
-
title:
|
|
748
|
+
title: c ? "Time expired" : "Click to remove back to bank",
|
|
737
749
|
style: {
|
|
738
750
|
padding: m() ? "4px 6px" : "6px 10px",
|
|
739
751
|
margin: m() ? "2px" : "4px",
|
|
740
752
|
borderRadius: m() ? "4px" : "8px",
|
|
741
|
-
background:
|
|
742
|
-
border:
|
|
753
|
+
background: c ? "#f0f0f0" : "#ffe9e7",
|
|
754
|
+
border: c ? "1px solid #ccc" : "1px solid #ec4c44",
|
|
743
755
|
...x.list === "selected" && x.id === e.id && x.side === "left" ? { borderLeft: "3px solid #3b82f6" } : {},
|
|
744
756
|
...x.list === "selected" && x.id === e.id && x.side === "right" ? { borderRight: "3px solid #3b82f6" } : {},
|
|
745
|
-
cursor:
|
|
757
|
+
cursor: c ? "not-allowed" : x.list === "selected" && x.id === e.id ? "grabbing" : "grab",
|
|
746
758
|
userSelect: "none",
|
|
747
|
-
fontSize: `${ve(
|
|
759
|
+
fontSize: `${ve(S.length)}px`,
|
|
748
760
|
// Адаптивный размер шрифта для слов
|
|
749
761
|
fontFamily: '"Roboto", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',
|
|
750
762
|
// Более плотный шрифт
|
|
751
763
|
whiteSpace: "nowrap",
|
|
752
764
|
// Запрещаем перенос слов
|
|
753
|
-
opacity:
|
|
765
|
+
opacity: c ? 0.6 : 1,
|
|
754
766
|
transition: "opacity 0.3s ease, transform 0.2s ease",
|
|
755
767
|
...x.list === "selected" && x.id === e.id ? {
|
|
756
768
|
transform: "scale(1.05)",
|
|
@@ -767,49 +779,49 @@ function bn(w = {}) {
|
|
|
767
779
|
"button",
|
|
768
780
|
{
|
|
769
781
|
onClick: () => Ze(!0),
|
|
770
|
-
disabled: !
|
|
782
|
+
disabled: !c && S.length === 0,
|
|
771
783
|
style: {
|
|
772
784
|
marginTop: m() ? "15px" : "30px",
|
|
773
785
|
fontSize: m() ? "14px" : "20px",
|
|
774
786
|
padding: m() ? "6px 12px" : "10px 24px",
|
|
775
787
|
borderRadius: m() ? "8px" : "12px",
|
|
776
|
-
background:
|
|
788
|
+
background: c || S.length > 0 ? "#ec4c44" : "#ccc",
|
|
777
789
|
color: "white",
|
|
778
790
|
border: "none",
|
|
779
|
-
cursor:
|
|
791
|
+
cursor: c || S.length > 0 ? "pointer" : "not-allowed"
|
|
780
792
|
},
|
|
781
793
|
children: "NEXT"
|
|
782
794
|
}
|
|
783
795
|
)
|
|
784
|
-
] }), rn = () => /* @__PURE__ */
|
|
796
|
+
] }), rn = () => /* @__PURE__ */ y("div", { style: g.gmCenterScreen, children: [
|
|
785
797
|
/* @__PURE__ */ l("h1", { style: {
|
|
786
798
|
...g.gmHeadline1,
|
|
787
|
-
marginTop: (a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || O || N || G || X || j || F || q
|
|
788
|
-
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || O || N || G || X || j || F || q
|
|
799
|
+
marginTop: (a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q, "0px"),
|
|
800
|
+
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "10px",
|
|
789
801
|
fontSize: a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "32px" : "clamp(28px, 4vw, 40px)"
|
|
790
802
|
}, children: "Game Over 🎯" }),
|
|
791
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ y("h2", { style: {
|
|
792
804
|
...g.gmHeadline2,
|
|
793
|
-
marginTop: (a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || O || N || G || X || j || F || q
|
|
794
|
-
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || O || N || G || X || j || F || q
|
|
805
|
+
marginTop: (a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q, "0px"),
|
|
806
|
+
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "16px",
|
|
795
807
|
fontSize: a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "18px" : "24px"
|
|
796
808
|
}, children: [
|
|
797
809
|
"Your score: ",
|
|
798
810
|
J,
|
|
799
811
|
" out of ",
|
|
800
|
-
|
|
812
|
+
R
|
|
801
813
|
] }),
|
|
802
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ y("p", { style: {
|
|
803
815
|
...g.gmBodyM,
|
|
804
816
|
color: "#10b981",
|
|
805
|
-
marginTop: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || O || N || G || X || j || F || q
|
|
806
|
-
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || O || N || G || X || j || F || q
|
|
817
|
+
marginTop: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "0px" : "12px",
|
|
818
|
+
marginBottom: a && window.innerWidth > window.innerHeight || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 || $ || O || N || G || X || j || F || q ? "2px" : "16px",
|
|
807
819
|
fontSize: a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "14px" : "16px"
|
|
808
820
|
}, children: [
|
|
809
821
|
"Best score: ",
|
|
810
|
-
|
|
822
|
+
ge
|
|
811
823
|
] }),
|
|
812
|
-
/* @__PURE__ */
|
|
824
|
+
/* @__PURE__ */ y("div", { style: {
|
|
813
825
|
display: "flex",
|
|
814
826
|
gap: a && window.innerWidth > window.innerHeight || a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "6px" : "12px",
|
|
815
827
|
marginTop: a && window.innerWidth > window.innerHeight || a && window.innerWidth <= 375 && window.innerHeight <= 667 || window.innerWidth === 896 && window.innerHeight === 414 || window.innerWidth === 844 && window.innerHeight === 390 || window.innerWidth === 926 && window.innerHeight === 428 || window.innerWidth === 932 && window.innerHeight === 430 ? "2px" : window.innerWidth === 1366 && window.innerHeight === 766 || window.innerWidth === 1366 && window.innerHeight === 768 || window.innerWidth === 1280 && window.innerHeight === 720 || window.innerWidth === 1440 && window.innerHeight === 900 || Be ? "12px" : "24px"
|
|
@@ -818,8 +830,8 @@ function bn(w = {}) {
|
|
|
818
830
|
"button",
|
|
819
831
|
{
|
|
820
832
|
onClick: () => {
|
|
821
|
-
|
|
822
|
-
|
|
833
|
+
de(), P("start"), setTimeout(() => {
|
|
834
|
+
k("getready"), We(null), te(!1);
|
|
823
835
|
}, 800);
|
|
824
836
|
},
|
|
825
837
|
style: {
|
|
@@ -833,7 +845,7 @@ function bn(w = {}) {
|
|
|
833
845
|
"button",
|
|
834
846
|
{
|
|
835
847
|
onClick: () => {
|
|
836
|
-
P("click"),
|
|
848
|
+
P("click"), k("select"), ee(null), me(null), ne([]), B(0), he([]), te(!1);
|
|
837
849
|
},
|
|
838
850
|
style: {
|
|
839
851
|
...g.gmButton,
|
|
@@ -843,14 +855,14 @@ function bn(w = {}) {
|
|
|
843
855
|
}
|
|
844
856
|
)
|
|
845
857
|
] })
|
|
846
|
-
] }), He = !a &&
|
|
858
|
+
] }), He = !a && H, on = dn(
|
|
847
859
|
() => {
|
|
848
860
|
if (a && window.innerWidth > window.innerHeight || window.innerHeight < 700 || !He)
|
|
849
861
|
return null;
|
|
850
862
|
const e = s || (typeof window < "u" && window.origin ? `${window.origin}/cloud/speakid/games/magic%20sentence/logo` : "/cloud/speakid/games/magic%20sentence/logo");
|
|
851
863
|
return (
|
|
852
864
|
// ensure logo is positioned inside the square container
|
|
853
|
-
/* @__PURE__ */ l("div", { style: { ...g.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ l("div", { style: { ...g.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ y("picture", { children: [
|
|
854
866
|
/* @__PURE__ */ l(
|
|
855
867
|
"source",
|
|
856
868
|
{
|
|
@@ -875,7 +887,7 @@ function bn(w = {}) {
|
|
|
875
887
|
return /* @__PURE__ */ l(
|
|
876
888
|
"div",
|
|
877
889
|
{
|
|
878
|
-
ref:
|
|
890
|
+
ref: le,
|
|
879
891
|
style: {
|
|
880
892
|
width: "100%",
|
|
881
893
|
height: "100%",
|
|
@@ -921,14 +933,14 @@ function bn(w = {}) {
|
|
|
921
933
|
justifyContent: "center",
|
|
922
934
|
alignItems: "center"
|
|
923
935
|
},
|
|
924
|
-
children: /* @__PURE__ */
|
|
936
|
+
children: /* @__PURE__ */ y("div", { id: "magic-sentence-root", children: [
|
|
925
937
|
on,
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
938
|
+
b === "select" ? _e() : null,
|
|
939
|
+
b === "time" ? Qe() : null,
|
|
940
|
+
b === "type" ? en() : null,
|
|
941
|
+
b === "getready" ? nn() : null,
|
|
942
|
+
b === "play" ? tn() : null,
|
|
943
|
+
b === "results" ? rn() : null
|
|
932
944
|
] })
|
|
933
945
|
}
|
|
934
946
|
)
|
|
@@ -937,7 +949,7 @@ function bn(w = {}) {
|
|
|
937
949
|
}
|
|
938
950
|
);
|
|
939
951
|
}
|
|
940
|
-
class
|
|
952
|
+
class Wn extends an {
|
|
941
953
|
constructor(s) {
|
|
942
954
|
super(s), this.state = { hasError: !1 };
|
|
943
955
|
}
|
|
@@ -947,17 +959,17 @@ class Sn extends an {
|
|
|
947
959
|
error: s
|
|
948
960
|
};
|
|
949
961
|
}
|
|
950
|
-
componentDidCatch(s,
|
|
951
|
-
console.error("Game Error:", s,
|
|
962
|
+
componentDidCatch(s, H) {
|
|
963
|
+
console.error("Game Error:", s, H), this.setState({
|
|
952
964
|
error: s,
|
|
953
|
-
errorInfo:
|
|
965
|
+
errorInfo: H
|
|
954
966
|
});
|
|
955
967
|
}
|
|
956
968
|
handleReset = () => {
|
|
957
969
|
this.setState({ hasError: !1, error: void 0, errorInfo: void 0 });
|
|
958
970
|
};
|
|
959
971
|
render() {
|
|
960
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
972
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ y("div", { style: {
|
|
961
973
|
display: "flex",
|
|
962
974
|
flexDirection: "column",
|
|
963
975
|
alignItems: "center",
|
|
@@ -990,9 +1002,9 @@ class Sn extends an {
|
|
|
990
1002
|
children: "🔄 Restart Game"
|
|
991
1003
|
}
|
|
992
1004
|
),
|
|
993
|
-
typeof process < "u" && process.env.NODE_ENV === "development" && this.state.error && /* @__PURE__ */
|
|
1005
|
+
typeof process < "u" && process.env.NODE_ENV === "development" && this.state.error && /* @__PURE__ */ y("details", { style: { marginTop: "20px", textAlign: "left", maxWidth: "600px" }, children: [
|
|
994
1006
|
/* @__PURE__ */ l("summary", { style: { cursor: "pointer", fontSize: "14px" }, children: "Technical Details (Development Only)" }),
|
|
995
|
-
/* @__PURE__ */
|
|
1007
|
+
/* @__PURE__ */ y("pre", { style: {
|
|
996
1008
|
backgroundColor: "#f3f4f6",
|
|
997
1009
|
padding: "12px",
|
|
998
1010
|
borderRadius: "4px",
|
|
@@ -1008,12 +1020,12 @@ class Sn extends an {
|
|
|
1008
1020
|
}
|
|
1009
1021
|
}
|
|
1010
1022
|
export {
|
|
1011
|
-
|
|
1023
|
+
Wn as ErrorBoundary,
|
|
1012
1024
|
bn as Game,
|
|
1013
|
-
|
|
1014
|
-
|
|
1025
|
+
L as announceToScreenReader,
|
|
1026
|
+
un as createAriaLabel,
|
|
1015
1027
|
bn as default,
|
|
1016
|
-
|
|
1028
|
+
hn as handleKeyDown,
|
|
1017
1029
|
cn as useValidation
|
|
1018
1030
|
};
|
|
1019
1031
|
//# sourceMappingURL=speakid-build-a-sentence.es.js.map
|