@js-gamifications/word-search-react 1.0.1

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/index.mjs ADDED
@@ -0,0 +1,672 @@
1
+ // src/wordSearchBoard.tsx
2
+ import { createWordSearch } from "@js-gamifications/word-search-core";
3
+ import { useEffect, useMemo, useState } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ function playSound(frequency, duration) {
6
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)();
7
+ const oscillator = audioContext.createOscillator();
8
+ const gainNode = audioContext.createGain();
9
+ oscillator.connect(gainNode);
10
+ gainNode.connect(audioContext.destination);
11
+ oscillator.frequency.value = frequency;
12
+ oscillator.type = "sine";
13
+ gainNode.gain.setValueAtTime(0.3, audioContext.currentTime);
14
+ gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + duration);
15
+ oscillator.start(audioContext.currentTime);
16
+ oscillator.stop(audioContext.currentTime + duration);
17
+ }
18
+ function playSuccessSound() {
19
+ playSound(800, 0.15);
20
+ setTimeout(() => {
21
+ playSound(1e3, 0.15);
22
+ }, 150);
23
+ }
24
+ function playWinnerSound() {
25
+ playSound(523.25, 0.2);
26
+ setTimeout(() => {
27
+ playSound(659.25, 0.2);
28
+ }, 220);
29
+ setTimeout(() => {
30
+ playSound(783.99, 0.4);
31
+ }, 440);
32
+ }
33
+ var TRANSLATIONS = {
34
+ ES: {
35
+ title: "B\xFAsqueda de Palabras",
36
+ found: "encontradas",
37
+ instructions: "Haz clic y arrastra sobre las letras para seleccionar una palabra.",
38
+ clearProgress: "Reiniciar",
39
+ newPuzzle: "Nuevo Juego",
40
+ words: "Palabras",
41
+ allWordsFound: "Todas las palabras encontradas",
42
+ squareText: "El tablero se muestra en un contenedor cuadrado para un seguimiento m\xE1s f\xE1cil.",
43
+ timer: "Tiempo",
44
+ completionTitle: "Puzzle completado",
45
+ completionMessage: "Excelente trabajo, encontraste todas las palabras.",
46
+ completionTime: "Tiempo total",
47
+ completionWords: "Palabras encontradas",
48
+ completionGrid: "Tamanio de tablero",
49
+ completionDiagonal: "Diagonal habilitada",
50
+ completionAt: "Completado a las",
51
+ yes: "Si",
52
+ no: "No"
53
+ },
54
+ EN: {
55
+ title: "Word Search",
56
+ found: "found",
57
+ instructions: "Hold click and drag over letters to select a word.",
58
+ clearProgress: "Clear Progress",
59
+ newPuzzle: "New Puzzle",
60
+ words: "Words",
61
+ allWordsFound: "All words found",
62
+ squareText: "Board is rendered in a square container for easier tracking.",
63
+ timer: "Time",
64
+ completionTitle: "Puzzle Completed",
65
+ completionMessage: "Great job, you found every word.",
66
+ completionTime: "Total time",
67
+ completionWords: "Words found",
68
+ completionGrid: "Grid size",
69
+ completionDiagonal: "Diagonal enabled",
70
+ completionAt: "Completed at",
71
+ yes: "Yes",
72
+ no: "No"
73
+ },
74
+ AR: {
75
+ title: "\u0627\u0644\u0628\u062D\u062B \u0639\u0646 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",
76
+ found: "\u0645\u0648\u062C\u0648\u062F\u0629",
77
+ instructions: "\u0627\u0636\u063A\u0637 \u0648\u0627\u0633\u062D\u0628 \u0641\u0648\u0642 \u0627\u0644\u062D\u0631\u0648\u0641 \u0644\u062A\u062D\u062F\u064A\u062F \u0643\u0644\u0645\u0629",
78
+ clearProgress: "\u0645\u0633\u062D \u0627\u0644\u062A\u0642\u062F\u0645",
79
+ newPuzzle: "\u0644\u0639\u0628\u0629 \u062C\u062F\u064A\u062F\u0629",
80
+ words: "\u0627\u0644\u0643\u0644\u0645\u0627\u062A",
81
+ allWordsFound: "\u062A\u0645 \u0627\u0644\u0639\u062B\u0648\u0631 \u0639\u0644\u0649 \u062C\u0645\u064A\u0639 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",
82
+ squareText: "\u064A\u062A\u0645 \u062A\u0642\u062F\u064A\u0645 \u0627\u0644\u0644\u0648\u062D\u0629 \u0641\u064A \u062D\u0627\u0648\u064A\u0629 \u0645\u0631\u0628\u0639\u0629 \u0644\u062A\u062A\u0628\u0639 \u0623\u0633\u0647\u0644",
83
+ timer: "\u0627\u0644\u0648\u0642\u062A",
84
+ completionTitle: "\u0627\u0643\u062A\u0645\u0644 \u0627\u0644\u0644\u063A\u0632",
85
+ completionMessage: "\u0639\u0645\u0644 \u0631\u0627\u0626\u0639\u060C \u0644\u0642\u062F \u0639\u062B\u0631\u062A \u0639\u0644\u0649 \u062C\u0645\u064A\u0639 \u0627\u0644\u0643\u0644\u0645\u0627\u062A",
86
+ completionTime: "\u0627\u0644\u0648\u0642\u062A \u0627\u0644\u0643\u0644\u064A",
87
+ completionWords: "\u0627\u0644\u0643\u0644\u0645\u0627\u062A \u0627\u0644\u062A\u064A \u062A\u0645 \u0627\u0644\u0639\u062B\u0648\u0631 \u0639\u0644\u064A\u0647\u0627",
88
+ completionGrid: "\u062D\u062C\u0645 \u0627\u0644\u0634\u0628\u0643\u0629",
89
+ completionDiagonal: "\u0627\u0644\u0642\u0637\u0631\u064A \u0645\u0641\u0639\u0644",
90
+ completionAt: "\u0627\u0643\u062A\u0645\u0644 \u0641\u064A",
91
+ yes: "\u0646\u0639\u0645",
92
+ no: "\u0644\u0627"
93
+ }
94
+ };
95
+ function toCellKey(cell) {
96
+ return `${cell.row}:${cell.col}`;
97
+ }
98
+ function normalizeWord(word) {
99
+ return word.trim().toUpperCase().replace(/\s+/g, "");
100
+ }
101
+ function buildPath(start, end) {
102
+ const rowDiff = end.row - start.row;
103
+ const colDiff = end.col - start.col;
104
+ const absRowDiff = Math.abs(rowDiff);
105
+ const absColDiff = Math.abs(colDiff);
106
+ const isHorizontal = rowDiff === 0;
107
+ const isVertical = colDiff === 0;
108
+ const isDiagonal = absRowDiff === absColDiff;
109
+ if (!isHorizontal && !isVertical && !isDiagonal) {
110
+ return [start];
111
+ }
112
+ const rowStep = rowDiff === 0 ? 0 : rowDiff / absRowDiff;
113
+ const colStep = colDiff === 0 ? 0 : colDiff / absColDiff;
114
+ const steps = Math.max(absRowDiff, absColDiff);
115
+ return Array.from({ length: steps + 1 }, (_, index) => ({
116
+ row: start.row + rowStep * index,
117
+ col: start.col + colStep * index
118
+ }));
119
+ }
120
+ function toPathFromPlacement(placement) {
121
+ return Array.from({ length: placement.word.length }, (_, index) => ({
122
+ row: placement.startRow + placement.deltaRow * index,
123
+ col: placement.startCol + placement.deltaCol * index
124
+ }));
125
+ }
126
+ function matchesPlacement(path, placement) {
127
+ if (path.length !== placement.word.length) {
128
+ return false;
129
+ }
130
+ const expectedForward = toPathFromPlacement(placement);
131
+ const forwardMatch = expectedForward.every((expectedCell, index) => {
132
+ const selected = path[index];
133
+ return selected?.row === expectedCell.row && selected?.col === expectedCell.col;
134
+ });
135
+ if (forwardMatch) {
136
+ return true;
137
+ }
138
+ return expectedForward.every((expectedCell, index) => {
139
+ const selected = path[path.length - 1 - index];
140
+ return selected?.row === expectedCell.row && selected?.col === expectedCell.col;
141
+ });
142
+ }
143
+ function WordSearchBoard(props) {
144
+ const [puzzleSeed, setPuzzleSeed] = useState(0);
145
+ const [language, setLanguage] = useState("EN");
146
+ const [elapsedSeconds, setElapsedSeconds] = useState(0);
147
+ const [showCelebration, setShowCelebration] = useState(false);
148
+ const [completionReport, setCompletionReport] = useState(null);
149
+ const t = TRANSLATIONS[language];
150
+ const puzzle = useMemo(() => {
151
+ const options = {
152
+ rows: props.rows,
153
+ cols: props.cols,
154
+ words: props.words
155
+ };
156
+ if (props.allowDiagonal !== void 0) {
157
+ Object.assign(options, { allowDiagonal: props.allowDiagonal });
158
+ }
159
+ const generated = createWordSearch(options);
160
+ props.onGenerated?.(generated);
161
+ return generated;
162
+ }, [props.rows, props.cols, props.words, props.allowDiagonal, props.onGenerated, puzzleSeed]);
163
+ const normalizedInputWords = useMemo(
164
+ () => props.words.map(normalizeWord).filter(Boolean),
165
+ [props.words]
166
+ );
167
+ const [foundWords, setFoundWords] = useState(/* @__PURE__ */ new Set());
168
+ const [isDragging, setIsDragging] = useState(false);
169
+ const [dragStart, setDragStart] = useState(null);
170
+ const [dragCurrent, setDragCurrent] = useState(null);
171
+ useEffect(() => {
172
+ setFoundWords(/* @__PURE__ */ new Set());
173
+ setIsDragging(false);
174
+ setDragStart(null);
175
+ setDragCurrent(null);
176
+ setElapsedSeconds(0);
177
+ setShowCelebration(false);
178
+ setCompletionReport(null);
179
+ }, [puzzle]);
180
+ useEffect(() => {
181
+ const interval = setInterval(() => {
182
+ setElapsedSeconds((previous) => previous + 1);
183
+ }, 1e3);
184
+ return () => {
185
+ clearInterval(interval);
186
+ };
187
+ }, []);
188
+ const formatTime = (seconds) => {
189
+ const hours = Math.floor(seconds / 3600);
190
+ const minutes = Math.floor(seconds % 3600 / 60);
191
+ const secs = seconds % 60;
192
+ if (hours > 0) {
193
+ return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
194
+ }
195
+ return `${String(minutes).padStart(2, "0")}:${String(secs).padStart(2, "0")}`;
196
+ };
197
+ const currentPath = useMemo(() => {
198
+ if (!dragStart || !dragCurrent) {
199
+ return [];
200
+ }
201
+ return buildPath(dragStart, dragCurrent);
202
+ }, [dragStart, dragCurrent]);
203
+ const foundPlacements = useMemo(
204
+ () => puzzle.placements.filter((placement) => foundWords.has(placement.word)),
205
+ [puzzle.placements, foundWords]
206
+ );
207
+ const foundCellKeys = useMemo(() => {
208
+ const result = /* @__PURE__ */ new Set();
209
+ for (const placement of foundPlacements) {
210
+ for (const cell of toPathFromPlacement(placement)) {
211
+ result.add(toCellKey(cell));
212
+ }
213
+ }
214
+ return result;
215
+ }, [foundPlacements]);
216
+ const currentPathKeys = useMemo(() => {
217
+ const result = /* @__PURE__ */ new Set();
218
+ for (const cell of currentPath) {
219
+ result.add(toCellKey(cell));
220
+ }
221
+ return result;
222
+ }, [currentPath]);
223
+ const pendingWords = useMemo(
224
+ () => normalizedInputWords.filter((word) => !foundWords.has(word)),
225
+ [normalizedInputWords, foundWords]
226
+ );
227
+ const completeSelection = () => {
228
+ if (!dragStart || !dragCurrent) {
229
+ setIsDragging(false);
230
+ setDragStart(null);
231
+ setDragCurrent(null);
232
+ return;
233
+ }
234
+ const path = buildPath(dragStart, dragCurrent);
235
+ const match = puzzle.placements.find((placement) => matchesPlacement(path, placement));
236
+ if (match) {
237
+ setFoundWords((previous) => {
238
+ const next = new Set(previous);
239
+ next.add(match.word);
240
+ playSuccessSound();
241
+ if (next.size === normalizedInputWords.length) {
242
+ const report = {
243
+ elapsedSeconds,
244
+ foundWords: next.size,
245
+ totalWords: normalizedInputWords.length,
246
+ rows: props.rows,
247
+ cols: props.cols,
248
+ allowDiagonal: props.allowDiagonal ?? true,
249
+ completedAt: (/* @__PURE__ */ new Date()).toISOString()
250
+ };
251
+ setTimeout(() => {
252
+ playWinnerSound();
253
+ setShowCelebration(true);
254
+ setCompletionReport(report);
255
+ props.onCompleted?.(report);
256
+ setTimeout(() => {
257
+ setShowCelebration(false);
258
+ }, 3e3);
259
+ }, 100);
260
+ }
261
+ return next;
262
+ });
263
+ }
264
+ setIsDragging(false);
265
+ setDragStart(null);
266
+ setDragCurrent(null);
267
+ };
268
+ useEffect(() => {
269
+ if (!isDragging) {
270
+ return;
271
+ }
272
+ const handleMouseUp = () => {
273
+ completeSelection();
274
+ };
275
+ window.addEventListener("mouseup", handleMouseUp);
276
+ return () => {
277
+ window.removeEventListener("mouseup", handleMouseUp);
278
+ };
279
+ }, [isDragging, dragStart, dragCurrent, puzzle.placements]);
280
+ const startSelection = (row, col) => {
281
+ setIsDragging(true);
282
+ setDragStart({ row, col });
283
+ setDragCurrent({ row, col });
284
+ };
285
+ const moveSelection = (row, col) => {
286
+ if (!isDragging) {
287
+ return;
288
+ }
289
+ setDragCurrent({ row, col });
290
+ };
291
+ const finishSelection = () => {
292
+ if (!isDragging) {
293
+ return;
294
+ }
295
+ completeSelection();
296
+ };
297
+ const resetProgress = () => {
298
+ setFoundWords(/* @__PURE__ */ new Set());
299
+ setIsDragging(false);
300
+ setDragStart(null);
301
+ setDragCurrent(null);
302
+ };
303
+ const generateNewPuzzle = () => {
304
+ resetProgress();
305
+ setPuzzleSeed((previous) => previous + 1);
306
+ };
307
+ const boardSize = useMemo(() => {
308
+ const maxDimension = Math.max(props.rows, props.cols);
309
+ return Math.min(560, Math.max(280, maxDimension * 38));
310
+ }, [props.rows, props.cols]);
311
+ return /* @__PURE__ */ jsxs(
312
+ "div",
313
+ {
314
+ className: props.className,
315
+ style: {
316
+ width: "100%",
317
+ borderRadius: "16px",
318
+ border: "1px solid #e4e4e7",
319
+ background: "linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(248, 250, 252, 1) 100%)",
320
+ boxShadow: "0 10px 30px rgba(15, 23, 42, 0.06)",
321
+ padding: "16px",
322
+ position: "relative",
323
+ overflow: "hidden"
324
+ },
325
+ children: [
326
+ showCelebration && /* @__PURE__ */ jsxs(
327
+ "div",
328
+ {
329
+ style: {
330
+ position: "absolute",
331
+ inset: 0,
332
+ pointerEvents: "none",
333
+ zIndex: 20,
334
+ borderRadius: "inherit"
335
+ },
336
+ children: [
337
+ /* @__PURE__ */ jsx(
338
+ "div",
339
+ {
340
+ style: {
341
+ position: "absolute",
342
+ inset: 0,
343
+ background: "linear-gradient(45deg, rgba(34, 197, 94, 0.3) 0%, rgba(34, 197, 94, 0) 100%)",
344
+ animation: "pulse 0.6s ease-out"
345
+ }
346
+ }
347
+ ),
348
+ /* @__PURE__ */ jsx("style", { children: `
349
+ @keyframes pulse {
350
+ 0% { opacity: 1; }
351
+ 100% { opacity: 0; }
352
+ }
353
+ @keyframes bounce {
354
+ 0%, 100% { transform: scale(1); }
355
+ 50% { transform: scale(1.1); }
356
+ }
357
+ ` }),
358
+ /* @__PURE__ */ jsx(
359
+ "div",
360
+ {
361
+ style: {
362
+ position: "absolute",
363
+ top: "50%",
364
+ left: "50%",
365
+ transform: "translate(-50%, -50%)",
366
+ fontSize: "48px",
367
+ fontWeight: "bold",
368
+ color: "#22c55e",
369
+ animation: "bounce 0.6s ease-out",
370
+ textShadow: "0 4px 12px rgba(34, 197, 94, 0.4)"
371
+ },
372
+ children: "\u{1F389}"
373
+ }
374
+ )
375
+ ]
376
+ }
377
+ ),
378
+ /* @__PURE__ */ jsxs(
379
+ "div",
380
+ {
381
+ style: {
382
+ display: "flex",
383
+ justifyContent: "space-between",
384
+ alignItems: "center",
385
+ marginBottom: "12px",
386
+ gap: "10px",
387
+ flexWrap: "wrap"
388
+ },
389
+ children: [
390
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
391
+ /* @__PURE__ */ jsx("strong", { style: { fontSize: "16px", color: "#111827" }, children: t.title }),
392
+ /* @__PURE__ */ jsxs(
393
+ "span",
394
+ {
395
+ style: {
396
+ fontSize: "12px",
397
+ color: "#374151",
398
+ background: "#f3f4f6",
399
+ padding: "4px 8px",
400
+ borderRadius: "999px"
401
+ },
402
+ children: [
403
+ foundWords.size,
404
+ "/",
405
+ normalizedInputWords.length,
406
+ " ",
407
+ t.found
408
+ ]
409
+ }
410
+ ),
411
+ /* @__PURE__ */ jsxs(
412
+ "span",
413
+ {
414
+ style: {
415
+ fontSize: "12px",
416
+ color: "#374151",
417
+ background: "#f3f4f6",
418
+ padding: "4px 8px",
419
+ borderRadius: "999px"
420
+ },
421
+ children: [
422
+ t.timer,
423
+ ": ",
424
+ formatTime(elapsedSeconds)
425
+ ]
426
+ }
427
+ )
428
+ ] }),
429
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "12px", color: "#6b7280" }, children: t.instructions })
430
+ ]
431
+ }
432
+ ),
433
+ /* @__PURE__ */ jsxs(
434
+ "div",
435
+ {
436
+ style: {
437
+ display: "flex",
438
+ justifyContent: "space-between",
439
+ alignItems: "center",
440
+ gap: "8px",
441
+ marginBottom: "12px",
442
+ flexWrap: "wrap"
443
+ },
444
+ children: [
445
+ /* @__PURE__ */ jsxs("div", { children: [
446
+ /* @__PURE__ */ jsx("label", { style: { fontSize: "12px", color: "#6b7280", marginRight: "6px" }, children: "Language:" }),
447
+ /* @__PURE__ */ jsxs(
448
+ "select",
449
+ {
450
+ value: language,
451
+ onChange: (event) => setLanguage(event.target.value),
452
+ style: {
453
+ fontSize: "12px",
454
+ padding: "4px 8px",
455
+ borderRadius: "6px",
456
+ border: "1px solid #d4d4d8",
457
+ background: "#ffffff",
458
+ cursor: "pointer"
459
+ },
460
+ children: [
461
+ /* @__PURE__ */ jsx("option", { value: "EN", children: "English" }),
462
+ /* @__PURE__ */ jsx("option", { value: "ES", children: "Espa\xF1ol" }),
463
+ /* @__PURE__ */ jsx("option", { value: "AR", children: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629" })
464
+ ]
465
+ }
466
+ )
467
+ ] }),
468
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
469
+ /* @__PURE__ */ jsx(
470
+ "button",
471
+ {
472
+ type: "button",
473
+ onClick: resetProgress,
474
+ style: {
475
+ border: "1px solid #d4d4d8",
476
+ background: "#ffffff",
477
+ color: "#374151",
478
+ borderRadius: "8px",
479
+ fontSize: "12px",
480
+ padding: "6px 10px",
481
+ cursor: "pointer"
482
+ },
483
+ children: t.clearProgress
484
+ }
485
+ ),
486
+ /* @__PURE__ */ jsx(
487
+ "button",
488
+ {
489
+ type: "button",
490
+ onClick: generateNewPuzzle,
491
+ style: {
492
+ border: "1px solid #0ea5e9",
493
+ background: "#0ea5e9",
494
+ color: "#ffffff",
495
+ borderRadius: "4px",
496
+ fontSize: "12px",
497
+ padding: "6px 10px",
498
+ cursor: "pointer"
499
+ },
500
+ children: t.newPuzzle
501
+ }
502
+ )
503
+ ] })
504
+ ]
505
+ }
506
+ ),
507
+ /* @__PURE__ */ jsx("div", { style: { width: "100%", display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsx(
508
+ "div",
509
+ {
510
+ style: {
511
+ width: `min(100%, ${boardSize}px)`,
512
+ aspectRatio: "1 / 1",
513
+ display: "grid",
514
+ gridTemplateColumns: `repeat(${props.cols}, minmax(0, 1fr))`,
515
+ gridTemplateRows: `repeat(${props.rows}, minmax(0, 1fr))`,
516
+ gap: "1px",
517
+ userSelect: "none",
518
+ touchAction: "none"
519
+ },
520
+ onMouseLeave: finishSelection,
521
+ children: puzzle.grid.flatMap(
522
+ (row, rowIndex) => row.map((cell, colIndex) => /* @__PURE__ */ jsx(
523
+ "button",
524
+ {
525
+ type: "button",
526
+ onMouseDown: () => startSelection(rowIndex, colIndex),
527
+ onMouseEnter: () => moveSelection(rowIndex, colIndex),
528
+ onMouseUp: finishSelection,
529
+ style: {
530
+ display: "inline-flex",
531
+ width: "100%",
532
+ height: "100%",
533
+ minWidth: 0,
534
+ alignItems: "center",
535
+ justifyContent: "center",
536
+ border: "1px solid #d4d4d8",
537
+ borderRadius: "8px",
538
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",
539
+ fontWeight: 700,
540
+ fontSize: "clamp(12px, 1.8vw, 16px)",
541
+ color: "#111827",
542
+ background: foundCellKeys.has(toCellKey({ row: rowIndex, col: colIndex })) ? "#bae6fd" : currentPathKeys.has(toCellKey({ row: rowIndex, col: colIndex })) ? "#e0f2fe" : "#ffffff",
543
+ cursor: "pointer",
544
+ transition: "background 120ms ease, transform 120ms ease"
545
+ },
546
+ children: cell
547
+ },
548
+ `${rowIndex}-${colIndex}`
549
+ ))
550
+ )
551
+ }
552
+ ) }),
553
+ /* @__PURE__ */ jsxs(
554
+ "div",
555
+ {
556
+ style: {
557
+ marginTop: "14px",
558
+ display: "grid",
559
+ gridTemplateColumns: "1fr",
560
+ gap: "8px"
561
+ },
562
+ children: [
563
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "12px", color: "#6b7280" }, children: t.words }),
564
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: normalizedInputWords.map((word) => {
565
+ const found = foundWords.has(word);
566
+ return /* @__PURE__ */ jsx(
567
+ "span",
568
+ {
569
+ style: {
570
+ display: "inline-flex",
571
+ alignItems: "center",
572
+ padding: "6px 10px",
573
+ borderRadius: "999px",
574
+ border: found ? "1px solid #22c55e" : "1px solid #d4d4d8",
575
+ background: found ? "#dcfce7" : "#fafafa",
576
+ color: found ? "#166534" : "#3f3f46",
577
+ fontSize: "12px",
578
+ fontWeight: 600,
579
+ letterSpacing: "0.04em",
580
+ textDecoration: found ? "line-through" : "none",
581
+ textDecorationThickness: found ? "2px" : void 0,
582
+ textDecorationColor: found ? "#166534" : void 0
583
+ },
584
+ children: word
585
+ },
586
+ word
587
+ );
588
+ }) }),
589
+ pendingWords.length === 0 ? /* @__PURE__ */ jsx("span", { style: { fontSize: "12px", color: "#16a34a", fontWeight: 600 }, children: t.allWordsFound }) : null
590
+ ]
591
+ }
592
+ ),
593
+ completionReport ? /* @__PURE__ */ jsxs(
594
+ "div",
595
+ {
596
+ style: {
597
+ marginTop: "14px",
598
+ border: "1px solid #86efac",
599
+ background: "linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%)",
600
+ borderRadius: "12px",
601
+ padding: "12px"
602
+ },
603
+ children: [
604
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "14px", fontWeight: 700, color: "#166534", marginBottom: "4px" }, children: t.completionTitle }),
605
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "12px", color: "#166534", marginBottom: "10px" }, children: t.completionMessage }),
606
+ /* @__PURE__ */ jsxs(
607
+ "div",
608
+ {
609
+ style: {
610
+ display: "grid",
611
+ gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))",
612
+ gap: "8px"
613
+ },
614
+ children: [
615
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", color: "#14532d" }, children: [
616
+ /* @__PURE__ */ jsxs("strong", { children: [
617
+ t.completionTime,
618
+ ":"
619
+ ] }),
620
+ " ",
621
+ formatTime(completionReport.elapsedSeconds)
622
+ ] }),
623
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", color: "#14532d" }, children: [
624
+ /* @__PURE__ */ jsxs("strong", { children: [
625
+ t.completionWords,
626
+ ":"
627
+ ] }),
628
+ " ",
629
+ completionReport.foundWords,
630
+ "/",
631
+ completionReport.totalWords
632
+ ] }),
633
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", color: "#14532d" }, children: [
634
+ /* @__PURE__ */ jsxs("strong", { children: [
635
+ t.completionGrid,
636
+ ":"
637
+ ] }),
638
+ " ",
639
+ completionReport.rows,
640
+ "x",
641
+ completionReport.cols
642
+ ] }),
643
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", color: "#14532d" }, children: [
644
+ /* @__PURE__ */ jsxs("strong", { children: [
645
+ t.completionDiagonal,
646
+ ":"
647
+ ] }),
648
+ " ",
649
+ completionReport.allowDiagonal ? t.yes : t.no
650
+ ] }),
651
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: "12px", color: "#14532d" }, children: [
652
+ /* @__PURE__ */ jsxs("strong", { children: [
653
+ t.completionAt,
654
+ ":"
655
+ ] }),
656
+ " ",
657
+ new Date(completionReport.completedAt).toLocaleTimeString()
658
+ ] })
659
+ ]
660
+ }
661
+ )
662
+ ]
663
+ }
664
+ ) : null
665
+ ]
666
+ }
667
+ );
668
+ }
669
+ export {
670
+ WordSearchBoard
671
+ };
672
+ //# sourceMappingURL=index.mjs.map