speakid-build-a-sentence 1.0.11 → 1.0.13

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,4 +1,4 @@
1
- import rn, { useState as g, useCallback as Ee, useRef as Ie, useEffect as ue, useMemo as on, Component as sn } from "react";
1
+ import on, { useState as g, useCallback as Ee, useRef as je, useEffect as ue, Component as sn } from "react";
2
2
  var ve = { exports: {} }, pe = {};
3
3
  /**
4
4
  * @license React
@@ -9,12 +9,12 @@ var ve = { exports: {} }, pe = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var je;
12
+ var Pe;
13
13
  function an() {
14
- if (je) return pe;
15
- je = 1;
16
- var p = Symbol.for("react.transitional.element"), l = Symbol.for("react.fragment");
17
- function S(T, W, w) {
14
+ if (Pe) return pe;
15
+ Pe = 1;
16
+ var p = Symbol.for("react.transitional.element"), d = Symbol.for("react.fragment");
17
+ function S(j, W, w) {
18
18
  var P = null;
19
19
  if (w !== void 0 && (P = "" + w), W.key !== void 0 && (P = "" + W.key), "key" in W) {
20
20
  w = {};
@@ -23,13 +23,13 @@ function an() {
23
23
  } else w = W;
24
24
  return W = w.ref, {
25
25
  $$typeof: p,
26
- type: T,
26
+ type: j,
27
27
  key: P,
28
28
  ref: W !== void 0 ? W : null,
29
29
  props: w
30
30
  };
31
31
  }
32
- return pe.Fragment = l, pe.jsx = S, pe.jsxs = S, pe;
32
+ return pe.Fragment = d, pe.jsx = S, pe.jsxs = S, pe;
33
33
  }
34
34
  var fe = {};
35
35
  /**
@@ -41,9 +41,9 @@ var fe = {};
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
43
  */
44
- var Pe;
45
- function dn() {
46
- return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && (function() {
44
+ var He;
45
+ function ln() {
46
+ return He || (He = 1, process.env.NODE_ENV !== "production" && (function() {
47
47
  function p(e) {
48
48
  if (e == null) return null;
49
49
  if (typeof e == "function")
@@ -56,7 +56,7 @@ function dn() {
56
56
  return "Profiler";
57
57
  case U:
58
58
  return "StrictMode";
59
- case j:
59
+ case I:
60
60
  return "Suspense";
61
61
  case ae:
62
62
  return "SuspenseList";
@@ -87,12 +87,12 @@ function dn() {
87
87
  }
88
88
  return null;
89
89
  }
90
- function l(e) {
90
+ function d(e) {
91
91
  return "" + e;
92
92
  }
93
93
  function S(e) {
94
94
  try {
95
- l(e);
95
+ d(e);
96
96
  var a = !1;
97
97
  } catch {
98
98
  a = !0;
@@ -104,10 +104,10 @@ function dn() {
104
104
  a,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
106
  b
107
- ), l(e);
107
+ ), d(e);
108
108
  }
109
109
  }
110
- function T(e) {
110
+ function j(e) {
111
111
  if (e === E) return "<>";
112
112
  if (typeof e == "object" && e !== null && e.$$typeof === J)
113
113
  return "<...>";
@@ -126,7 +126,7 @@ function dn() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
128
  function P(e) {
129
- if (de.call(e, "key")) {
129
+ if (le.call(e, "key")) {
130
130
  var a = Object.getOwnPropertyDescriptor(e, "key").get;
131
131
  if (a && a.isReactWarning) return !1;
132
132
  }
@@ -150,7 +150,7 @@ function dn() {
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
151
  )), e = this.props.ref, e !== void 0 ? e : null;
152
152
  }
153
- function D(e, a, r, b, le, G) {
153
+ function D(e, a, r, b, de, G) {
154
154
  var x = r.ref;
155
155
  return e = {
156
156
  $$typeof: oe,
@@ -175,7 +175,7 @@ function dn() {
175
175
  configurable: !1,
176
176
  enumerable: !1,
177
177
  writable: !0,
178
- value: le
178
+ value: de
179
179
  }), Object.defineProperty(e, "_debugTask", {
180
180
  configurable: !1,
181
181
  enumerable: !1,
@@ -183,20 +183,20 @@ function dn() {
183
183
  value: G
184
184
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
185
  }
186
- function y(e, a, r, b, le, G) {
186
+ function y(e, a, r, b, de, G) {
187
187
  var x = a.children;
188
188
  if (x !== void 0)
189
189
  if (b)
190
190
  if (M(x)) {
191
191
  for (b = 0; b < x.length; b++)
192
- I(x[b]);
192
+ T(x[b]);
193
193
  Object.freeze && Object.freeze(x);
194
194
  } else
195
195
  console.error(
196
196
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
197
  );
198
- else I(x);
199
- if (de.call(a, "key")) {
198
+ else T(x);
199
+ if (le.call(a, "key")) {
200
200
  x = p(e);
201
201
  var O = Object.keys(a).filter(function(Se) {
202
202
  return Se !== "key";
@@ -227,17 +227,17 @@ React keys must be passed directly to JSX without using spread:
227
227
  x,
228
228
  r,
229
229
  W(),
230
- le,
230
+ de,
231
231
  G
232
232
  );
233
233
  }
234
- function I(e) {
234
+ function T(e) {
235
235
  H(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === J && (e._payload.status === "fulfilled" ? H(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
236
236
  }
237
237
  function H(e) {
238
238
  return typeof e == "object" && e !== null && e.$$typeof === oe;
239
239
  }
240
- var B = rn, oe = Symbol.for("react.transitional.element"), ge = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), he = Symbol.for("react.consumer"), se = Symbol.for("react.context"), me = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), J = Symbol.for("react.lazy"), $ = Symbol.for("react.activity"), V = Symbol.for("react.client.reference"), we = B.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, de = Object.prototype.hasOwnProperty, M = Array.isArray, A = console.createTask ? console.createTask : function() {
240
+ var B = on, oe = Symbol.for("react.transitional.element"), ge = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), he = Symbol.for("react.consumer"), se = Symbol.for("react.context"), me = Symbol.for("react.forward_ref"), I = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), J = Symbol.for("react.lazy"), $ = Symbol.for("react.activity"), V = Symbol.for("react.client.reference"), we = B.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, le = Object.prototype.hasOwnProperty, M = Array.isArray, A = console.createTask ? console.createTask : function() {
241
241
  return null;
242
242
  };
243
243
  B = {
@@ -248,7 +248,7 @@ React keys must be passed directly to JSX without using spread:
248
248
  var c, F = {}, X = B.react_stack_bottom_frame.bind(
249
249
  B,
250
250
  w
251
- )(), xe = A(T(w)), L = {};
251
+ )(), xe = A(j(w)), L = {};
252
252
  fe.Fragment = E, fe.jsx = function(e, a, r) {
253
253
  var b = 1e4 > we.recentlyCreatedOwnerStacks++;
254
254
  return y(
@@ -257,7 +257,7 @@ React keys must be passed directly to JSX without using spread:
257
257
  r,
258
258
  !1,
259
259
  b ? Error("react-stack-top-frame") : X,
260
- b ? A(T(e)) : xe
260
+ b ? A(j(e)) : xe
261
261
  );
262
262
  }, fe.jsxs = function(e, a, r) {
263
263
  var b = 1e4 > we.recentlyCreatedOwnerStacks++;
@@ -267,16 +267,16 @@ React keys must be passed directly to JSX without using spread:
267
267
  r,
268
268
  !0,
269
269
  b ? Error("react-stack-top-frame") : X,
270
- b ? A(T(e)) : xe
270
+ b ? A(j(e)) : xe
271
271
  );
272
272
  };
273
273
  })()), fe;
274
274
  }
275
- var He;
276
- function ln() {
277
- return He || (He = 1, process.env.NODE_ENV === "production" ? ve.exports = an() : ve.exports = dn()), ve.exports;
275
+ var Ce;
276
+ function dn() {
277
+ return Ce || (Ce = 1, process.env.NODE_ENV === "production" ? ve.exports = an() : ve.exports = ln()), ve.exports;
278
278
  }
279
- var s = ln();
279
+ var s = dn();
280
280
  const cn = `
281
281
  @keyframes magic-sentence-spin {
282
282
  from { transform: rotate(0deg); }
@@ -315,7 +315,7 @@ if (typeof document < "u" && !document.getElementById("magic-sentence-keyframes"
315
315
  const p = document.createElement("style");
316
316
  p.id = "magic-sentence-keyframes", p.innerHTML = cn, document.head.appendChild(p);
317
317
  }
318
- const Ce = {
318
+ const Ae = {
319
319
  spin: {
320
320
  animation: "magic-sentence-spin 1.4s linear infinite"
321
321
  },
@@ -448,12 +448,12 @@ const Ce = {
448
448
  },
449
449
  gmHourglass: {
450
450
  fontSize: "42px",
451
- ...Ce.spin
451
+ ...Ae.spin
452
452
  },
453
453
  // ===== Анимационные стили =====
454
- ...Ce
454
+ ...Ae
455
455
  }, un = () => {
456
- const [p, l] = g([]), S = Ee((w, P, R) => {
456
+ const [p, d] = g([]), S = Ee((w, P, R) => {
457
457
  const f = [];
458
458
  w.trim() || f.push({
459
459
  type: "empty",
@@ -465,15 +465,15 @@ const Ce = {
465
465
  type: "characters",
466
466
  message: "Only Latin characters, numbers, spaces and punctuation are allowed"
467
467
  });
468
- const y = R.findIndex((I, H) => H !== P && I.toLowerCase().trim() === w.toLowerCase().trim());
468
+ const y = R.findIndex((T, H) => H !== P && T.toLowerCase().trim() === w.toLowerCase().trim());
469
469
  return y !== -1 && f.push({
470
470
  type: "duplicate",
471
471
  message: `Duplicate sentence (same as sentence ${y + 1})`
472
- }), l(f), {
472
+ }), d(f), {
473
473
  isValid: f.length === 0,
474
474
  errors: f
475
475
  };
476
- }, []), T = Ee((w) => {
476
+ }, []), j = Ee((w) => {
477
477
  const P = [];
478
478
  return w.forEach((R, f) => {
479
479
  const D = S(R, f, w);
@@ -486,20 +486,20 @@ const Ce = {
486
486
  errors: P
487
487
  };
488
488
  }, [S]), W = Ee(() => {
489
- l([]);
489
+ d([]);
490
490
  }, []);
491
491
  return {
492
492
  errors: p,
493
493
  validateSentence: S,
494
- validateAllSentences: T,
494
+ validateAllSentences: j,
495
495
  clearErrors: W
496
496
  };
497
- }, pn = (p, l, S) => l && S ? `${p} word "${l}" ${S}` : l ? `${p} word "${l}"` : p, fn = (p, l, S = ["Enter", " "]) => {
498
- S.includes(p.key) && (p.preventDefault(), l());
497
+ }, pn = (p, d, S) => d && S ? `${p} word "${d}" ${S}` : d ? `${p} word "${d}"` : p, fn = (p, d, S = ["Enter", " "]) => {
498
+ S.includes(p.key) && (p.preventDefault(), d());
499
499
  }, Y = (p) => {
500
- const l = document.createElement("div");
501
- l.setAttribute("aria-live", "polite"), l.setAttribute("aria-atomic", "true"), l.style.position = "absolute", l.style.left = "-10000px", l.style.width = "1px", l.style.height = "1px", l.style.overflow = "hidden", document.body.appendChild(l), l.textContent = p, setTimeout(() => {
502
- document.body.removeChild(l);
500
+ const d = document.createElement("div");
501
+ d.setAttribute("aria-live", "polite"), d.setAttribute("aria-atomic", "true"), d.style.position = "absolute", d.style.left = "-10000px", d.style.width = "1px", d.style.height = "1px", d.style.overflow = "hidden", document.body.appendChild(d), d.textContent = p, setTimeout(() => {
502
+ document.body.removeChild(d);
503
503
  }, 1e3);
504
504
  }, gn = () => {
505
505
  const p = document.createElement("style");
@@ -532,7 +532,7 @@ const Ce = {
532
532
  `, document.head.appendChild(p);
533
533
  }, hn = (p) => [...p].sort(() => Math.random() - 0.5);
534
534
  function wn(p = {}) {
535
- const { logoUrl: l, showLogo: S = !0, baseURL: T } = p, W = Ie(null), { validateAllSentences: w, errors: P } = un(), R = () => r || window.innerWidth < 768, f = () => r || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, D = (n = "medium") => {
535
+ const { logoUrl: d, showLogo: S = !0, baseURL: j } = p, W = je(null), { validateAllSentences: w, errors: P } = un(), R = () => r || window.innerWidth < 768, f = () => r || window.innerWidth < 768 || window.innerWidth >= 320 && window.innerWidth <= 932 && window.innerHeight >= 390 && window.innerHeight <= 932, D = (n = "medium") => {
536
536
  if (!f())
537
537
  return {
538
538
  padding: "12px 24px",
@@ -563,64 +563,64 @@ function wn(p = {}) {
563
563
  ue(() => (gn(), () => {
564
564
  document.body.style.overflow = "";
565
565
  }), []);
566
- const [y, I] = g("select"), [H, B] = g(null), [oe, ge] = g(null), [E, U] = g([]), [_, he] = g(0), [se, me] = g([]), [j, ae] = g([]), [z, J] = g(20), [$, V] = g(0), [we, de] = g(null), [M, A] = g(null), [c, F] = g(!1), [X, xe] = g(
566
+ const [y, T] = g("select"), [H, B] = g(null), [oe, ge] = g(null), [E, U] = g([]), [_, he] = g(0), [se, me] = g([]), [I, ae] = g([]), [z, J] = g(20), [$, V] = g(0), [we, le] = g(null), [M, A] = g(null), [c, F] = g(!1), [X, xe] = g(
567
567
  Number(localStorage.getItem("magicSentenceBest")) || 0
568
- ), L = Ie(null), [e, a] = g({ list: null, index: null, side: null }), [r, b] = g(!1), [le, G] = g(1), [x, O] = g(null), [ce, Se] = g(!1), [q, Ae] = g(!1), [Z, De] = g(!1), [Q, _e] = g(!1), [K, Oe] = g(!1), [ee, ze] = g(!1), [ne, Me] = g(!1), [te, Le] = g(!1), [ie, Ne] = g(!1);
568
+ ), L = je(null), [e, a] = g({ list: null, index: null, side: null }), [r, b] = g(!1), [de, G] = g(1), [x, O] = g(null), [ce, Se] = g(!1), [q, De] = g(!1), [Z, _e] = g(!1), [Q, Oe] = g(!1), [K, ze] = g(!1), [ee, Me] = g(!1), [ne, Le] = g(!1), [te, Ne] = g(!1), [ie, Be] = g(!1);
569
569
  ue(() => {
570
570
  const n = () => {
571
- const i = window.innerWidth, t = window.innerHeight, o = i < 768 || i === 926 && t === 428 || i === 932 && t === 430, d = t < 700, v = i === 768 && t === 1024, k = i === 1024 && t === 768, u = i === 820 && t === 1180, m = i === 1180 && t === 820, re = i === 540 && t === 720, C = i === 720 && t === 540, Re = i === 1024 && t === 1366, en = i === 1366 && t === 1024, nn = i >= 1200 && t >= 600 && !o;
572
- if (Se(nn), Ae(v), De(k), _e(u), Oe(m), ze(re), Me(C), Le(Re), Ne(en), b(o), o)
571
+ const i = window.innerWidth, t = window.innerHeight, o = i < 768 || i === 926 && t === 428 || i === 932 && t === 430, l = t < 700, v = i === 768 && t === 1024, k = i === 1024 && t === 768, u = i === 820 && t === 1180, m = i === 1180 && t === 820, re = i === 540 && t === 720, C = i === 720 && t === 540, Re = i === 1024 && t === 1366, nn = i === 1366 && t === 1024, tn = i >= 1200 && t >= 600 && !o;
572
+ if (Se(tn), De(v), _e(k), Oe(u), ze(m), Me(re), Le(C), Ne(Re), Be(nn), b(o), o)
573
573
  O(null), G(1);
574
- else if (d)
574
+ else if (l)
575
575
  O(null), G(1);
576
576
  else {
577
- const tn = Math.min(1e3, Math.min(i, t) * 0.9);
578
- O(tn), G(1);
577
+ const rn = Math.min(1e3, Math.min(i, t) * 0.9);
578
+ O(rn), G(1);
579
579
  }
580
580
  };
581
581
  return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
582
582
  }, []);
583
583
  const ye = (n, i, t, o) => {
584
584
  if (c) return;
585
- let d = [...se], v = [...j];
586
- const k = n === "bank" ? d : v, u = i === "bank" ? d : v, m = k.findIndex((Re) => Re.id === t);
585
+ let l = [...se], v = [...I];
586
+ const k = n === "bank" ? l : v, u = i === "bank" ? l : v, m = k.findIndex((Re) => Re.id === t);
587
587
  if (m === -1) return;
588
588
  const [re] = k.splice(m, 1);
589
589
  let C = o;
590
- n === i && C !== null && C !== void 0 && C > m && (C = C - 1), C == null || C < 0 || C > u.length ? u.push(re) : u.splice(C, 0, re), n === "bank" ? d = k : v = k, i === "bank" ? d = u : v = u, me(d), ae(v);
590
+ n === i && C !== null && C !== void 0 && C > m && (C = C - 1), C == null || C < 0 || C > u.length ? u.push(re) : u.splice(C, 0, re), n === "bank" ? l = k : v = k, i === "bank" ? l = u : v = u, me(l), ae(v);
591
591
  }, be = (n, i, t) => {
592
592
  if (n.preventDefault(), c) {
593
593
  a({ list: null, index: null, side: null });
594
594
  return;
595
595
  }
596
596
  const o = n.dataTransfer.getData("application/x-token") || (() => {
597
- const d = n.dataTransfer.getData("text/plain");
598
- if (!d) return "";
599
- const v = se.some((m) => m.id === d), k = j.some((m) => m.id === d), u = v ? "bank" : k ? "selected" : null;
600
- return u ? JSON.stringify({ from: u, id: d }) : "";
597
+ const l = n.dataTransfer.getData("text/plain");
598
+ if (!l) return "";
599
+ const v = se.some((m) => m.id === l), k = I.some((m) => m.id === l), u = v ? "bank" : k ? "selected" : null;
600
+ return u ? JSON.stringify({ from: u, id: l }) : "";
601
601
  })();
602
602
  if (o) {
603
603
  try {
604
- const d = JSON.parse(o);
605
- if (!d || !d.id || !d.from) return;
606
- ye(d.from, i, d.id, t);
604
+ const l = JSON.parse(o);
605
+ if (!l || !l.id || !l.from) return;
606
+ ye(l.from, i, l.id, t);
607
607
  } catch {
608
608
  }
609
609
  a({ list: null, index: null, side: null });
610
610
  }
611
- }, Be = (n) => {
612
- B(n), U(Array(n).fill("")), I("time");
613
611
  }, $e = (n) => {
614
- ge(n), I("type");
615
- }, Fe = (n, i) => {
612
+ B(n), U(Array(n).fill("")), T("time");
613
+ }, Fe = (n) => {
614
+ ge(n), T("type");
615
+ }, Ge = (n, i) => {
616
616
  if (i.length > 41 || i && !/^[a-zA-Z0-9\s.,!?;:'"-]*$/.test(i))
617
617
  return;
618
618
  const o = [...E];
619
619
  o[n] = i, U(o);
620
- const d = w(o);
621
- d.isValid || console.warn("Validation errors:", d.errors);
622
- }, Ge = (n) => n.trim().replace(/\s+/g, " "), Te = (n) => n <= 3 ? 20 : n <= 5 ? 18 : n <= 7 ? 16 : n <= 9 ? 14 : 12, Ye = () => {
623
- E.some((i) => i.trim().length === 0) || (U((i) => i.map((t) => Ge(t))), V(0), he(0), de(null), I("getready"));
620
+ const l = w(o);
621
+ l.isValid || console.warn("Validation errors:", l.errors);
622
+ }, Ye = (n) => n.trim().replace(/\s+/g, " "), Te = (n) => n <= 3 ? 20 : n <= 5 ? 18 : n <= 7 ? 16 : n <= 9 ? 14 : 12, Ue = () => {
623
+ E.some((i) => i.trim().length === 0) || (U((i) => i.map((t) => Ye(t))), V(0), he(0), le(null), T("getready"));
624
624
  };
625
625
  ue(() => {
626
626
  if (y === "getready") {
@@ -633,11 +633,11 @@ function wn(p = {}) {
633
633
  if (!i) return;
634
634
  const o = hn(
635
635
  i.trim().split(/\s+/).filter(Boolean)
636
- ).map((d, v) => ({
636
+ ).map((l, v) => ({
637
637
  id: `${Date.now()}-${n}-${v}-${Math.random().toString(36).slice(2)}`,
638
- text: d
638
+ text: l
639
639
  }));
640
- me(o), ae([]), he(n), J(oe || 20), A(null), F(!1), I("play");
640
+ me(o), ae([]), he(n), J(oe || 20), A(null), F(!1), T("play");
641
641
  };
642
642
  ue(() => {
643
643
  if (y === "play" && !c)
@@ -645,21 +645,21 @@ function wn(p = {}) {
645
645
  L.current = window.setTimeout(() => J((n) => n - 1), 1e3);
646
646
  else {
647
647
  F(!0);
648
- const i = E[_].trim().split(/\s+/), t = j.map((u) => u.text), o = i.filter((u) => !t.includes(u)).length, d = t.filter((u) => !i.includes(u)).length, v = i.filter((u, m) => u !== t[m]).length, k = o + d + v;
648
+ const i = E[_].trim().split(/\s+/), t = I.map((u) => u.text), o = i.filter((u) => !t.includes(u)).length, l = t.filter((u) => !i.includes(u)).length, v = i.filter((u, m) => u !== t[m]).length, k = o + l + v;
649
649
  k === 0 ? (A("correct"), N("correct"), Y("Correct! Well done!")) : k === 1 ? (A("almost"), N("half"), Y("Almost correct! Just one mistake.")) : (A("wrong"), N("wrong"), Y("Not quite right. Keep trying!"));
650
650
  }
651
651
  return () => {
652
652
  L.current !== null && window.clearTimeout(L.current);
653
653
  };
654
- }, [y, z, c, E, _, j]);
655
- const Ue = (n = !0) => {
654
+ }, [y, z, c, E, _, I]);
655
+ const Je = (n = !0) => {
656
656
  if (c && n) {
657
- _ + 1 < (H || 0) ? ke(_ + 1) : (I("results"), setTimeout(() => We(), 600));
657
+ _ + 1 < (H || 0) ? ke(_ + 1) : (T("results"), setTimeout(() => We(), 600));
658
658
  return;
659
659
  }
660
660
  if (n && !c) {
661
- const t = E[_].trim().split(/\s+/), o = j.map((m) => m.text), d = t.filter((m) => !o.includes(m)).length, v = o.filter((m) => !t.includes(m)).length, k = t.filter((m, re) => m !== o[re]).length, u = d + v + k;
662
- u === 0 && z > 0 ? (V((m) => m + 1), A("correct"), N("correct"), Y("Correct! Well done!")) : u === 1 ? (V((m) => m + 0.5), A("almost"), N("half"), Y("Almost correct! Just one mistake.")) : (A("wrong"), N("wrong"), Y("Not quite right. Keep trying!")), _ + 1 < (H || 0) ? setTimeout(() => ke(_ + 1), 800) : (I("results"), setTimeout(() => We(), 600));
661
+ const t = E[_].trim().split(/\s+/), o = I.map((m) => m.text), l = t.filter((m) => !o.includes(m)).length, v = o.filter((m) => !t.includes(m)).length, k = t.filter((m, re) => m !== o[re]).length, u = l + v + k;
662
+ u === 0 && z > 0 ? (V((m) => m + 1), A("correct"), N("correct"), Y("Correct! Well done!")) : u === 1 ? (V((m) => m + 0.5), A("almost"), N("half"), Y("Almost correct! Just one mistake.")) : (A("wrong"), N("wrong"), Y("Not quite right. Keep trying!")), _ + 1 < (H || 0) ? setTimeout(() => ke(_ + 1), 800) : (T("results"), setTimeout(() => We(), 600));
663
663
  }
664
664
  };
665
665
  ue(() => {
@@ -686,7 +686,7 @@ function wn(p = {}) {
686
686
  }
687
687
  o.gain.setValueAtTime(0.1, i.currentTime), t.start(), t.stop(i.currentTime + 0.2);
688
688
  }, We = () => {
689
- const i = Date.now() + 2500, t = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], o = document.createElement("canvas"), d = o.getContext("2d");
689
+ const i = Date.now() + 2500, t = ["#ec4c44", "#f7c948", "#6fcf97", "#56ccf2", "#bb6bd9"], o = document.createElement("canvas"), l = o.getContext("2d");
690
690
  o.width = window.innerWidth, o.height = window.innerHeight, o.style.position = "fixed", o.style.top = "0", o.style.left = "0", o.style.pointerEvents = "none", document.body.appendChild(o);
691
691
  const v = Array.from({ length: 100 }).map(() => ({
692
692
  x: Math.random() * o.width,
@@ -696,12 +696,12 @@ function wn(p = {}) {
696
696
  speed: 2 + Math.random() * 4,
697
697
  tilt: Math.random() * 2 * Math.PI
698
698
  })), k = () => {
699
- d.clearRect(0, 0, o.width, o.height), v.forEach((u) => {
700
- d.fillStyle = u.color, d.beginPath(), d.ellipse(u.x, u.y, u.size, u.size / 2, u.tilt, 0, 2 * Math.PI), d.fill(), u.y += u.speed, u.x += Math.sin(u.tilt);
699
+ l.clearRect(0, 0, o.width, o.height), v.forEach((u) => {
700
+ l.fillStyle = u.color, l.beginPath(), l.ellipse(u.x, u.y, u.size, u.size / 2, u.tilt, 0, 2 * Math.PI), l.fill(), u.y += u.speed, u.x += Math.sin(u.tilt);
701
701
  }), Date.now() < i ? requestAnimationFrame(k) : document.body.removeChild(o);
702
702
  };
703
703
  k();
704
- }, Je = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmCenterScreen, children: [
704
+ }, Ve = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmCenterScreen, children: [
705
705
  /* @__PURE__ */ s.jsx("h1", { style: h.gmHeadline1, children: "MAGIC SENTENCE" }),
706
706
  /* @__PURE__ */ s.jsx("p", { style: h.gmBodyM, children: "Select number of rounds" }),
707
707
  /* @__PURE__ */ s.jsx("div", { style: {
@@ -711,7 +711,7 @@ function wn(p = {}) {
711
711
  }, children: [3, 4, 5].map((n) => /* @__PURE__ */ s.jsxs(
712
712
  "button",
713
713
  {
714
- onClick: () => Be(n),
714
+ onClick: () => $e(n),
715
715
  style: {
716
716
  ...h.gmButton,
717
717
  ...D("medium")
@@ -723,7 +723,7 @@ function wn(p = {}) {
723
723
  },
724
724
  n
725
725
  )) })
726
- ] }), Ve = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmCenterScreen, children: [
726
+ ] }), Xe = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmCenterScreen, children: [
727
727
  /* @__PURE__ */ s.jsx("h1", { style: h.gmHeadline1, children: "MAGIC SENTENCE" }),
728
728
  /* @__PURE__ */ s.jsx("p", { style: h.gmBodyM, children: "Select time per round" }),
729
729
  /* @__PURE__ */ s.jsx("div", { style: {
@@ -733,7 +733,7 @@ function wn(p = {}) {
733
733
  }, children: [15, 20, 30].map((n) => /* @__PURE__ */ s.jsxs(
734
734
  "button",
735
735
  {
736
- onClick: () => $e(n),
736
+ onClick: () => Fe(n),
737
737
  style: {
738
738
  ...h.gmButton,
739
739
  ...D("medium")
@@ -745,7 +745,7 @@ function wn(p = {}) {
745
745
  },
746
746
  n
747
747
  )) })
748
- ] }), Xe = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmCenterScreen, children: [
748
+ ] }), qe = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmCenterScreen, children: [
749
749
  /* @__PURE__ */ s.jsxs("h2", { style: { ...h.gmBodyM, marginBottom: "0px" }, children: [
750
750
  "Type down ",
751
751
  H,
@@ -769,7 +769,7 @@ function wn(p = {}) {
769
769
  {
770
770
  value: n,
771
771
  placeholder: `Sentence ${i + 1}`,
772
- onChange: (t) => Fe(i, t.target.value),
772
+ onChange: (t) => Ge(i, t.target.value),
773
773
  style: {
774
774
  ...h.gmInput,
775
775
  padding: f() ? "8px 12px" : "12px 16px",
@@ -785,7 +785,7 @@ function wn(p = {}) {
785
785
  /* @__PURE__ */ s.jsx(
786
786
  "button",
787
787
  {
788
- onClick: Ye,
788
+ onClick: Ue,
789
789
  disabled: E.some((n) => n.trim().length === 0),
790
790
  style: {
791
791
  ...h.gmButton,
@@ -797,7 +797,7 @@ function wn(p = {}) {
797
797
  children: "PLAY"
798
798
  }
799
799
  )
800
- ] }), qe = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmReadyWrapper, children: [
800
+ ] }), Ze = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmReadyWrapper, children: [
801
801
  /* @__PURE__ */ s.jsx("h1", { style: {
802
802
  ...h.gmHeadline1,
803
803
  fontSize: f() ? "36px" : "72px",
@@ -806,7 +806,7 @@ function wn(p = {}) {
806
806
  animation: "pulse 1s ease-in-out infinite"
807
807
  }, children: "GET READY" }),
808
808
  /* @__PURE__ */ s.jsx("div", { style: h.gmHourglass, children: "⏳" })
809
- ] }), Ze = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmGameLayout, children: [
809
+ ] }), Qe = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmGameLayout, children: [
810
810
  /* @__PURE__ */ s.jsxs("h2", { style: {
811
811
  marginBottom: f() ? "5px" : "10px",
812
812
  fontSize: f() ? "16px" : "20px"
@@ -879,13 +879,13 @@ function wn(p = {}) {
879
879
  },
880
880
  onDragOver: (t) => t.preventDefault(),
881
881
  onDrop: (t) => {
882
- const o = t.currentTarget.getBoundingClientRect(), d = o.left + o.width / 2, v = t.clientX > d ? i + 1 : i;
882
+ const o = t.currentTarget.getBoundingClientRect(), l = o.left + o.width / 2, v = t.clientX > l ? i + 1 : i;
883
883
  a({ list: null, index: null, side: null }), t.stopPropagation(), be(t, "bank", v);
884
884
  },
885
885
  onDragEnter: (t) => {
886
886
  if (c) return;
887
- const o = t.currentTarget.getBoundingClientRect(), d = o.left + o.width / 2;
888
- a({ list: "bank", index: i, side: t.clientX > d ? "right" : "left" });
887
+ const o = t.currentTarget.getBoundingClientRect(), l = o.left + o.width / 2;
888
+ a({ list: "bank", index: i, side: t.clientX > l ? "right" : "left" });
889
889
  },
890
890
  onDragLeave: () => a({ list: null, index: null, side: null }),
891
891
  onClick: () => {
@@ -931,12 +931,12 @@ function wn(p = {}) {
931
931
  flexWrap: R() ? "wrap" : "nowrap",
932
932
  alignItems: "center",
933
933
  justifyContent: "center",
934
- fontSize: `${Te(j.length)}px`,
934
+ fontSize: `${Te(I.length)}px`,
935
935
  background: M === "correct" ? "#e8f5e8" : M === "almost" ? "#fff3e0" : M === "wrong" ? "#ffebee" : "#fafafa",
936
936
  overflowX: R() ? "hidden" : "auto",
937
937
  whiteSpace: R() ? "normal" : "nowrap"
938
938
  },
939
- children: j.map((n, i) => /* @__PURE__ */ s.jsx(
939
+ children: I.map((n, i) => /* @__PURE__ */ s.jsx(
940
940
  "span",
941
941
  {
942
942
  draggable: !c,
@@ -952,13 +952,13 @@ function wn(p = {}) {
952
952
  },
953
953
  onDragOver: (t) => t.preventDefault(),
954
954
  onDrop: (t) => {
955
- const o = t.currentTarget.getBoundingClientRect(), d = o.left + o.width / 2, v = t.clientX > d ? i + 1 : i;
955
+ const o = t.currentTarget.getBoundingClientRect(), l = o.left + o.width / 2, v = t.clientX > l ? i + 1 : i;
956
956
  a({ list: null, index: null, side: null }), t.stopPropagation(), be(t, "selected", v);
957
957
  },
958
958
  onDragEnter: (t) => {
959
959
  if (c) return;
960
- const o = t.currentTarget.getBoundingClientRect(), d = o.left + o.width / 2;
961
- a({ list: "selected", index: i, side: t.clientX > d ? "right" : "left" });
960
+ const o = t.currentTarget.getBoundingClientRect(), l = o.left + o.width / 2;
961
+ a({ list: "selected", index: i, side: t.clientX > l ? "right" : "left" });
962
962
  },
963
963
  onDragLeave: () => a({ list: null, index: null, side: null }),
964
964
  onClick: () => {
@@ -975,7 +975,7 @@ function wn(p = {}) {
975
975
  borderRight: e.list === "selected" && e.index === i && e.side === "right" ? "3px solid #3b82f6" : void 0,
976
976
  cursor: c ? "not-allowed" : "pointer",
977
977
  userSelect: "none",
978
- fontSize: `${Te(j.length)}px`,
978
+ fontSize: `${Te(I.length)}px`,
979
979
  // Адаптивный размер шрифта для слов
980
980
  fontFamily: '"Roboto", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif',
981
981
  // Более плотный шрифт
@@ -993,22 +993,22 @@ function wn(p = {}) {
993
993
  /* @__PURE__ */ s.jsx(
994
994
  "button",
995
995
  {
996
- onClick: () => Ue(!0),
997
- disabled: !c && j.length === 0,
996
+ onClick: () => Je(!0),
997
+ disabled: !c && I.length === 0,
998
998
  style: {
999
999
  marginTop: f() ? "15px" : "30px",
1000
1000
  fontSize: f() ? "14px" : "20px",
1001
1001
  padding: f() ? "6px 12px" : "10px 24px",
1002
1002
  borderRadius: f() ? "8px" : "12px",
1003
- background: c || j.length > 0 ? "#ec4c44" : "#ccc",
1003
+ background: c || I.length > 0 ? "#ec4c44" : "#ccc",
1004
1004
  color: "white",
1005
1005
  border: "none",
1006
- cursor: c || j.length > 0 ? "pointer" : "not-allowed"
1006
+ cursor: c || I.length > 0 ? "pointer" : "not-allowed"
1007
1007
  },
1008
1008
  children: "NEXT"
1009
1009
  }
1010
1010
  )
1011
- ] }), Qe = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmCenterScreen, children: [
1011
+ ] }), Ke = () => /* @__PURE__ */ s.jsxs("div", { style: h.gmCenterScreen, children: [
1012
1012
  /* @__PURE__ */ s.jsx("h1", { style: {
1013
1013
  ...h.gmHeadline1,
1014
1014
  marginTop: (r && 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 || q || Z || Q || K || ee || ne || te || ie, "0px"),
@@ -1046,7 +1046,7 @@ function wn(p = {}) {
1046
1046
  {
1047
1047
  onClick: () => {
1048
1048
  We(), N("start"), setTimeout(() => {
1049
- I("getready"), de(null), F(!1);
1049
+ T("getready"), le(null), F(!1);
1050
1050
  }, 800);
1051
1051
  },
1052
1052
  style: {
@@ -1060,7 +1060,7 @@ function wn(p = {}) {
1060
1060
  "button",
1061
1061
  {
1062
1062
  onClick: () => {
1063
- N("click"), I("select"), B(null), ge(null), U([]), V(0), ae([]), F(!1);
1063
+ N("click"), T("select"), B(null), ge(null), U([]), V(0), ae([]), F(!1);
1064
1064
  },
1065
1065
  style: {
1066
1066
  ...h.gmButton,
@@ -1070,24 +1070,7 @@ function wn(p = {}) {
1070
1070
  }
1071
1071
  )
1072
1072
  ] })
1073
- ] }), Ke = on(
1074
- () => {
1075
- let n = l;
1076
- return n || (T ? n = `${T.endsWith("/") ? T.slice(0, -1) : T}/logo.svg` : typeof window < "u" && window.origin && (n = `${window.origin}/browser/speakid/games/magic%20sentence/logo.svg`)), /* @__PURE__ */ s.jsx("div", { style: {
1077
- ...h.gmLogoFixed,
1078
- display: !S || r && window.innerWidth > window.innerHeight || window.innerHeight < 700 ? "none" : "block"
1079
- }, children: n ? /* @__PURE__ */ s.jsx(
1080
- "img",
1081
- {
1082
- src: n,
1083
- alt: "SPEAKID Logo",
1084
- style: h.gmLogoImg,
1085
- loading: "lazy"
1086
- }
1087
- ) : /* @__PURE__ */ s.jsx("div", { style: h.gmLogoImg, children: "SPEAKID" }) });
1088
- },
1089
- [r, S, l, T]
1090
- );
1073
+ ] }), Ie = d || (j ? `${j.endsWith("/") ? j.slice(0, -1) : j}/logo.svg` : typeof window < "u" && window.origin ? `${window.origin}/browser/speakid/games/magic%20sentence/logo.svg` : null), en = !r && S && !(window.innerWidth > window.innerHeight) && window.innerHeight >= 700;
1091
1074
  return /* @__PURE__ */ s.jsx(
1092
1075
  "div",
1093
1076
  {
@@ -1135,13 +1118,24 @@ function wn(p = {}) {
1135
1118
  alignItems: "center"
1136
1119
  },
1137
1120
  children: /* @__PURE__ */ s.jsxs("div", { id: "magic-sentence-root", children: [
1138
- !r && Ke,
1139
- y === "select" && Je(),
1140
- y === "time" && Ve(),
1141
- y === "type" && Xe(),
1142
- y === "getready" && qe(),
1143
- y === "play" && Ze(),
1144
- y === "results" && Qe()
1121
+ en ? /* @__PURE__ */ s.jsx("div", { style: {
1122
+ ...h.gmLogoFixed,
1123
+ display: "block"
1124
+ }, children: Ie ? /* @__PURE__ */ s.jsx(
1125
+ "img",
1126
+ {
1127
+ src: Ie,
1128
+ alt: "SPEAKID Logo",
1129
+ style: h.gmLogoImg,
1130
+ loading: "lazy"
1131
+ }
1132
+ ) : /* @__PURE__ */ s.jsx("div", { style: h.gmLogoImg, children: "SPEAKID" }) }) : null,
1133
+ y === "select" ? Ve() : null,
1134
+ y === "time" ? Xe() : null,
1135
+ y === "type" ? qe() : null,
1136
+ y === "getready" ? Ze() : null,
1137
+ y === "play" ? Qe() : null,
1138
+ y === "results" ? Ke() : null
1145
1139
  ] })
1146
1140
  }
1147
1141
  )
@@ -1151,18 +1145,18 @@ function wn(p = {}) {
1151
1145
  );
1152
1146
  }
1153
1147
  class xn extends sn {
1154
- constructor(l) {
1155
- super(l), this.state = { hasError: !1 };
1148
+ constructor(d) {
1149
+ super(d), this.state = { hasError: !1 };
1156
1150
  }
1157
- static getDerivedStateFromError(l) {
1151
+ static getDerivedStateFromError(d) {
1158
1152
  return {
1159
1153
  hasError: !0,
1160
- error: l
1154
+ error: d
1161
1155
  };
1162
1156
  }
1163
- componentDidCatch(l, S) {
1164
- console.error("Game Error:", l, S), this.setState({
1165
- error: l,
1157
+ componentDidCatch(d, S) {
1158
+ console.error("Game Error:", d, S), this.setState({
1159
+ error: d,
1166
1160
  errorInfo: S
1167
1161
  });
1168
1162
  }
@@ -1198,8 +1192,8 @@ class xn extends sn {
1198
1192
  cursor: "pointer",
1199
1193
  transition: "background-color 0.2s"
1200
1194
  },
1201
- onMouseOver: (l) => l.currentTarget.style.backgroundColor = "#b91c1c",
1202
- onMouseOut: (l) => l.currentTarget.style.backgroundColor = "#dc2626",
1195
+ onMouseOver: (d) => d.currentTarget.style.backgroundColor = "#b91c1c",
1196
+ onMouseOut: (d) => d.currentTarget.style.backgroundColor = "#dc2626",
1203
1197
  children: "🔄 Restart Game"
1204
1198
  }
1205
1199
  ),