speakid-build-a-sentence 1.0.25 → 1.0.27

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