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