@minicode-dev/chat 0.1.12 → 0.1.14
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/CHANGELOG.md +112 -5
- package/README.md +401 -309
- package/assets/sounds/effects/avalanche.mp3 +0 -0
- package/assets/sounds/racing/car_boost.mp3 +0 -0
- package/assets/sounds/racing/car_boost.ogg +0 -0
- package/assets/sounds/racing/car_bump.mp3 +0 -0
- package/assets/sounds/racing/car_bump.ogg +0 -0
- package/assets/sounds/racing/car_drift_loop.mp3 +0 -0
- package/assets/sounds/racing/car_drift_loop.ogg +0 -0
- package/assets/sounds/racing/car_engine_loop.mp3 +0 -0
- package/assets/sounds/racing/car_engine_loop.ogg +0 -0
- package/assets/sounds/racing/car_engine_start.mp3 +0 -0
- package/assets/sounds/racing/car_engine_start.ogg +0 -0
- package/assets/sounds/racing/countdown_beep.mp3 +0 -0
- package/assets/sounds/racing/countdown_beep.ogg +0 -0
- package/assets/sounds/racing/countdown_go.mp3 +0 -0
- package/assets/sounds/racing/countdown_go.ogg +0 -0
- package/assets/sounds/racing/final_lap.mp3 +0 -0
- package/assets/sounds/racing/final_lap.ogg +0 -0
- package/assets/sounds/racing/finish_line.mp3 +0 -0
- package/assets/sounds/racing/finish_line.ogg +0 -0
- package/assets/sounds/racing/lap_complete.mp3 +0 -0
- package/assets/sounds/racing/lap_complete.ogg +0 -0
- package/assets/sounds/racing/music_circuit.mp3 +0 -0
- package/assets/sounds/racing/music_circuit.ogg +0 -0
- package/assets/sounds/racing/music_final_lap.mp3 +0 -0
- package/assets/sounds/racing/music_final_lap.ogg +0 -0
- package/assets/sounds/racing/race_defeat.mp3 +0 -0
- package/assets/sounds/racing/race_defeat.ogg +0 -0
- package/assets/sounds/racing/race_victory.mp3 +0 -0
- package/assets/sounds/racing/race_victory.ogg +0 -0
- package/assets/sounds/tanks/barrel_explode.mp3 +0 -0
- package/assets/sounds/tanks/barrel_explode.ogg +0 -0
- package/assets/sounds/tanks/crate_break.mp3 +0 -0
- package/assets/sounds/tanks/crate_break.ogg +0 -0
- package/assets/sounds/tanks/health_pickup.mp3 +0 -0
- package/assets/sounds/tanks/health_pickup.ogg +0 -0
- package/assets/sounds/tanks/last_life.mp3 +0 -0
- package/assets/sounds/tanks/last_life.ogg +0 -0
- package/assets/sounds/tanks/life_lost.mp3 +0 -0
- package/assets/sounds/tanks/life_lost.ogg +0 -0
- package/assets/sounds/tanks/respawn.mp3 +0 -0
- package/assets/sounds/tanks/respawn.ogg +0 -0
- package/assets/sounds/tanks/shield_end.mp3 +0 -0
- package/assets/sounds/tanks/shield_end.ogg +0 -0
- package/assets/sounds/tanks/shield_loop.mp3 +0 -0
- package/assets/sounds/tanks/shield_loop.ogg +0 -0
- package/assets/sounds/tanks/wall_hit.mp3 +0 -0
- package/assets/sounds/tanks/wall_hit.ogg +0 -0
- package/dist/chunks/{BattleshipGameCard-iRk8d4vR.js → BattleshipGameCard-B-B4r7lK.js} +146 -144
- package/dist/chunks/{BattleshipGameCard-iRk8d4vR.js.map → BattleshipGameCard-B-B4r7lK.js.map} +1 -1
- package/dist/chunks/{ChatContext-DjIEifGY.js → ChatContext-DQtKsR6Z.js} +2 -2
- package/dist/chunks/{ChatContext-DjIEifGY.js.map → ChatContext-DQtKsR6Z.js.map} +1 -1
- package/dist/chunks/RacingLiveGameCard-c1G7uoDI.js +1654 -0
- package/dist/chunks/RacingLiveGameCard-c1G7uoDI.js.map +1 -0
- package/dist/chunks/{TanksGameCard-B47ZQcSr.js → TanksGameCard-CvTaF7tu.js} +164 -162
- package/dist/chunks/{TanksGameCard-B47ZQcSr.js.map → TanksGameCard-CvTaF7tu.js.map} +1 -1
- package/dist/chunks/TanksLiveGameCard-COr9Oay5.js +1011 -0
- package/dist/chunks/TanksLiveGameCard-COr9Oay5.js.map +1 -0
- package/dist/chunks/avalancheScene3d-Z5QyZIid.js +1299 -0
- package/dist/chunks/avalancheScene3d-Z5QyZIid.js.map +1 -0
- package/dist/chunks/connect4Sounds-DmD-E9kX.js +235 -0
- package/dist/chunks/connect4Sounds-DmD-E9kX.js.map +1 -0
- package/dist/chunks/connectionStore-DwgIUl30.js +13 -0
- package/dist/chunks/connectionStore-DwgIUl30.js.map +1 -0
- package/dist/chunks/createLiveScene-CWBunxPi.js +367 -0
- package/dist/chunks/createLiveScene-CWBunxPi.js.map +1 -0
- package/dist/chunks/createRaceScene-C7Rw89kj.js +305 -0
- package/dist/chunks/createRaceScene-C7Rw89kj.js.map +1 -0
- package/dist/chunks/{createTankScene-CV7Brxmt.js → createTankScene-yhX6la27.js} +150 -147
- package/dist/chunks/{createTankScene-CV7Brxmt.js.map → createTankScene-yhX6la27.js.map} +1 -1
- package/dist/chunks/decor-CyyCnmct.js +418 -0
- package/dist/chunks/decor-CyyCnmct.js.map +1 -0
- package/dist/chunks/fx-1ZwzmPWj.js +458 -0
- package/dist/chunks/fx-1ZwzmPWj.js.map +1 -0
- package/dist/chunks/fx-UZwhOmdl.js +584 -0
- package/dist/chunks/fx-UZwhOmdl.js.map +1 -0
- package/dist/chunks/gameStatus-BChd29yI.js +62 -0
- package/dist/chunks/gameStatus-BChd29yI.js.map +1 -0
- package/dist/chunks/{connect4Sounds-Cv0q31VW.js → games-BvYTWgaR.js} +814 -951
- package/dist/chunks/games-BvYTWgaR.js.map +1 -0
- package/dist/chunks/rolldown-runtime-CGnMp29N.js +10 -0
- package/dist/chunks/tank-DjEQ4FXF.js +553 -0
- package/dist/chunks/tank-DjEQ4FXF.js.map +1 -0
- package/dist/chunks/tanks-live-BcKmrhnV.js +261 -0
- package/dist/chunks/tanks-live-BcKmrhnV.js.map +1 -0
- package/dist/chunks/{tanksSounds-CUNDIOal.js → tanksSounds-DwjfSp3W.js} +43 -11
- package/dist/chunks/tanksSounds-DwjfSp3W.js.map +1 -0
- package/dist/chunks/track-BcnnpnAm.js +259 -0
- package/dist/chunks/track-BcnnpnAm.js.map +1 -0
- package/dist/chunks/util-DwI9bfS7.js +57 -0
- package/dist/chunks/util-DwI9bfS7.js.map +1 -0
- package/dist/index.js +2176 -1592
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +4 -2
- package/package.json +1 -1
- package/dist/chunks/TanksLiveGameCard-DGsnMD3j.js +0 -1225
- package/dist/chunks/TanksLiveGameCard-DGsnMD3j.js.map +0 -1
- package/dist/chunks/connect4Sounds-Cv0q31VW.js.map +0 -1
- package/dist/chunks/createLiveScene-BqI7qV4n.js +0 -364
- package/dist/chunks/createLiveScene-BqI7qV4n.js.map +0 -1
- package/dist/chunks/fx-BHsl4S_J.js +0 -1470
- package/dist/chunks/fx-BHsl4S_J.js.map +0 -1
- package/dist/chunks/gameStatus-Cu1Z8un9.js +0 -69
- package/dist/chunks/gameStatus-Cu1Z8un9.js.map +0 -1
- package/dist/chunks/tanksSounds-CUNDIOal.js.map +0 -1
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { a as e,
|
|
2
|
-
import { l as
|
|
3
|
-
import {
|
|
1
|
+
import { a as e, t } from "./games-BvYTWgaR.js";
|
|
2
|
+
import { l as n, n as r, s as i, t as a } from "./board-DXKuIZ1I.js";
|
|
3
|
+
import { r as o } from "./connectionStore-DwgIUl30.js";
|
|
4
|
+
import { c as s, i as c, l, t as u } from "./gameStatus-BChd29yI.js";
|
|
5
|
+
import { a as d, o as f, t as p } from "./connect4Sounds-DmD-E9kX.js";
|
|
4
6
|
import "../index.js";
|
|
5
7
|
import { t as ee } from "./webglSupport-2WjPEPZ_.js";
|
|
6
8
|
import { memo as m, useCallback as h, useEffect as g, useId as te, useMemo as _, useRef as v, useState as y } from "react";
|
|
7
9
|
import { Anchor as ne, Check as re, ChevronDown as ie, Crosshair as ae, LocateFixed as oe, Maximize2 as se, Minimize2 as ce, Radar as le, RotateCw as ue, ShieldCheck as b, Shuffle as de, TriangleAlert as fe, Waves as pe, X as me } from "lucide-react";
|
|
8
10
|
import { Fragment as he, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
9
11
|
// src/games/battleship/sound/battleshipSounds.js
|
|
10
|
-
var C = "ocean_ambient_loop", w =
|
|
12
|
+
var C = "ocean_ambient_loop", w = d({
|
|
11
13
|
id: "battleship",
|
|
12
|
-
baseUrl: () =>
|
|
13
|
-
settingsFrom:
|
|
14
|
+
baseUrl: () => t("battleship_audio_pack/assets"),
|
|
15
|
+
settingsFrom: p,
|
|
14
16
|
sounds: Object.fromEntries([
|
|
15
17
|
"cannon_fire",
|
|
16
18
|
"projectile_flyby",
|
|
@@ -43,14 +45,14 @@ var C = "ocean_ambient_loop", w = e({
|
|
|
43
45
|
defeat: .4,
|
|
44
46
|
[C]: .22
|
|
45
47
|
}
|
|
46
|
-
}),
|
|
47
|
-
function
|
|
48
|
-
|
|
48
|
+
}), T = () => typeof document < "u" && document.hidden;
|
|
49
|
+
function E(e) {
|
|
50
|
+
T() || w.play(e);
|
|
49
51
|
}
|
|
50
|
-
function
|
|
52
|
+
function ge(e, t, n) {
|
|
51
53
|
e.forEach(({ name: e, at: r }) => {
|
|
52
54
|
let i = () => {
|
|
53
|
-
|
|
55
|
+
T() || w.play(e, { key: t(e) });
|
|
54
56
|
};
|
|
55
57
|
if (r <= 0) {
|
|
56
58
|
i();
|
|
@@ -62,26 +64,26 @@ function _e(e, t, n) {
|
|
|
62
64
|
n.add(a);
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
+
var D = 0, O = () => {
|
|
68
|
+
D > 0 && !T() ? w.startLoop(C) : w.stopLoop(C);
|
|
67
69
|
};
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
+
function _e() {
|
|
71
|
+
D += 1, D === 1 && document.addEventListener("visibilitychange", O), O();
|
|
70
72
|
let e = !1;
|
|
71
73
|
return () => {
|
|
72
|
-
e || (e = !0, --
|
|
74
|
+
e || (e = !0, --D, D === 0 && document.removeEventListener("visibilitychange", O), O());
|
|
73
75
|
};
|
|
74
76
|
}
|
|
75
77
|
// src/games/battleship/sound/cues.js
|
|
76
|
-
var
|
|
77
|
-
function
|
|
78
|
+
var ve = "cruiser", ye = (e, t) => e.row === t.row && e.col === t.col, k = (e, t, n) => e.cells.filter((e) => t?.[e.row]?.[e.col] === "hit" && !(n && ye(e, n))).length;
|
|
79
|
+
function be(e, t, n) {
|
|
78
80
|
if (n?.result !== "hit") return !1;
|
|
79
|
-
let r = (e || []).find((e) => e.id ===
|
|
80
|
-
if (!r?.cells?.some((e) =>
|
|
81
|
-
let i =
|
|
81
|
+
let r = (e || []).find((e) => e.id === ve);
|
|
82
|
+
if (!r?.cells?.some((e) => ye(e, n))) return !1;
|
|
83
|
+
let i = k(r, t, n), a = k(r, t);
|
|
82
84
|
return i < 2 && a >= 2;
|
|
83
85
|
}
|
|
84
|
-
function
|
|
86
|
+
function xe({ incoming: e }) {
|
|
85
87
|
return e ? [{
|
|
86
88
|
name: "projectile_flyby",
|
|
87
89
|
at: 0
|
|
@@ -93,7 +95,7 @@ function Se({ incoming: e }) {
|
|
|
93
95
|
at: 180
|
|
94
96
|
}];
|
|
95
97
|
}
|
|
96
|
-
function
|
|
98
|
+
function Se({ result: e, sunk: t, defeated: n, won: r, cruiserAlarm: i }) {
|
|
97
99
|
let a = e === "hit" ? t ? [{
|
|
98
100
|
name: "ship_heavy_hit",
|
|
99
101
|
at: 0
|
|
@@ -116,25 +118,25 @@ function Ce({ result: e, sunk: t, defeated: n, won: r, cruiserAlarm: i }) {
|
|
|
116
118
|
}), a;
|
|
117
119
|
}
|
|
118
120
|
// src/games/battleship/BattleshipGameCard.jsx
|
|
119
|
-
var
|
|
121
|
+
var A = "ABCDEFGHIJ", Ce = {
|
|
120
122
|
carrier: "portaaviones",
|
|
121
123
|
battleship: "acorazado",
|
|
122
124
|
cruiser: "crucero",
|
|
123
125
|
submarine: "submarino",
|
|
124
126
|
destroyer: "destructor"
|
|
125
|
-
},
|
|
127
|
+
}, we = [
|
|
126
128
|
"placement",
|
|
127
129
|
"active",
|
|
128
130
|
"won",
|
|
129
131
|
"conflict",
|
|
130
132
|
"closed"
|
|
131
|
-
],
|
|
132
|
-
function
|
|
133
|
-
let t =
|
|
133
|
+
], Te = 400, Ee = Array.from({ length: 10 }, () => Array(10).fill(null)), j = (e) => e ? `${A[e.row]}${e.col + 1}` : "—", De = (e, t) => !!(e && t && e.row === t.row && e.col === t.col), M = (e) => !!e && Number.isInteger(e.row) && Number.isInteger(e.col) && e.row >= 0 && e.row < 10 && e.col >= 0 && e.col < 10, Oe = (e) => Ce[e] || "barco", ke = (e, t) => e?.[t.row]?.[t.col] ?? null, Ae = (e, t) => e.find((e) => e.cells?.some((e) => De(e, t))), je = (e) => e.charAt(0).toUpperCase() + e.slice(1), Me = () => typeof window < "u" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, N = (t, ...n) => Promise.resolve().then(() => e.getState()[t]?.(...n)).catch(() => {});
|
|
134
|
+
function Ne(e) {
|
|
135
|
+
let t = r();
|
|
134
136
|
for (let n of e || []) {
|
|
135
137
|
let e = n.cells?.[0];
|
|
136
138
|
if (!e) continue;
|
|
137
|
-
let r =
|
|
139
|
+
let r = i(t, {
|
|
138
140
|
shipId: n.id,
|
|
139
141
|
row: e.row,
|
|
140
142
|
col: e.col,
|
|
@@ -144,13 +146,13 @@ function Pe(e) {
|
|
|
144
146
|
}
|
|
145
147
|
return t;
|
|
146
148
|
}
|
|
147
|
-
function
|
|
149
|
+
function Pe(e, t, n) {
|
|
148
150
|
return Array.from({ length: t }, (t, r) => ({
|
|
149
151
|
row: e.row + (n === "vertical" ? r : 0),
|
|
150
152
|
col: e.col + (n === "horizontal" ? r : 0)
|
|
151
|
-
})).filter(
|
|
153
|
+
})).filter(M);
|
|
152
154
|
}
|
|
153
|
-
function
|
|
155
|
+
function Fe(e) {
|
|
154
156
|
let t = 0, n = 0;
|
|
155
157
|
for (let r of e || []) for (let e of r || []) e && (t += 1), e === "hit" && (n += 1);
|
|
156
158
|
return {
|
|
@@ -158,7 +160,7 @@ function Ie(e) {
|
|
|
158
160
|
hits: n
|
|
159
161
|
};
|
|
160
162
|
}
|
|
161
|
-
function
|
|
163
|
+
function Ie({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
162
164
|
return e?.status === "requesting" ? /* @__PURE__ */ x("div", {
|
|
163
165
|
className: "chat-game-sync",
|
|
164
166
|
role: "status",
|
|
@@ -185,8 +187,8 @@ function Le({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
|
185
187
|
]
|
|
186
188
|
});
|
|
187
189
|
}
|
|
188
|
-
function
|
|
189
|
-
let t =
|
|
190
|
+
function Le({ game: e }) {
|
|
191
|
+
let t = c(e);
|
|
190
192
|
return t ? /* @__PURE__ */ S("span", {
|
|
191
193
|
className: `bs-badge bs-badge--${e.verification}`,
|
|
192
194
|
children: [
|
|
@@ -202,7 +204,7 @@ function Re({ game: e }) {
|
|
|
202
204
|
]
|
|
203
205
|
}) : null;
|
|
204
206
|
}
|
|
205
|
-
function
|
|
207
|
+
function Re({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
206
208
|
let a = /* @__PURE__ */ new Map();
|
|
207
209
|
e.ships.forEach((e) => e.cells.forEach((t) => a.set(`${t.row}-${t.col}`, e)));
|
|
208
210
|
let o = new Set((e.preview?.cells || []).map((e) => `${e.row}-${e.col}`));
|
|
@@ -221,11 +223,11 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
221
223
|
d?.sunk && "is-sunk",
|
|
222
224
|
f && `is-${f}`,
|
|
223
225
|
o.has(u) && (e.preview.valid ? "is-preview" : "is-invalid"),
|
|
224
|
-
|
|
226
|
+
De(t, {
|
|
225
227
|
row: c,
|
|
226
228
|
col: l
|
|
227
229
|
}) && "is-selected",
|
|
228
|
-
|
|
230
|
+
De(n, {
|
|
229
231
|
row: c,
|
|
230
232
|
col: l
|
|
231
233
|
}) && "is-cursor"
|
|
@@ -236,7 +238,7 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
236
238
|
tabIndex: -1,
|
|
237
239
|
className: p,
|
|
238
240
|
disabled: !e.interactive,
|
|
239
|
-
"aria-label": `${
|
|
241
|
+
"aria-label": `${A[c]}${l + 1}${f === "hit" ? ", impacto" : f === "miss" ? ", agua" : ""}${d ? ", barco" : ""}`,
|
|
240
242
|
onMouseEnter: () => i({
|
|
241
243
|
row: c,
|
|
242
244
|
col: l
|
|
@@ -250,13 +252,13 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
250
252
|
}, c))
|
|
251
253
|
});
|
|
252
254
|
}
|
|
253
|
-
function
|
|
254
|
-
let { total: r, hits: i } =
|
|
255
|
+
function P({ game: e, currentUserId: t, status: n }) {
|
|
256
|
+
let { total: r, hits: i } = Fe(e.targetShots), o = e.sunkEnemyShips?.length || 0, s = [
|
|
255
257
|
"active",
|
|
256
258
|
"won",
|
|
257
259
|
"closed",
|
|
258
260
|
"conflict"
|
|
259
|
-
].includes(e.status) && r > 0,
|
|
261
|
+
].includes(e.status) && r > 0, c = e.status === "won" && l(t, e.winnerId);
|
|
260
262
|
return /* @__PURE__ */ S("section", {
|
|
261
263
|
className: "chat-game-card chat-game-card--history bs-card bs-card--history",
|
|
262
264
|
"aria-label": "Partida de Batalla Naval",
|
|
@@ -276,10 +278,10 @@ function N({ game: e, currentUserId: t, status: n }) {
|
|
|
276
278
|
})
|
|
277
279
|
}),
|
|
278
280
|
/* @__PURE__ */ x("p", {
|
|
279
|
-
className: `chat-game-status${
|
|
281
|
+
className: `chat-game-status${c ? " bs-status--win" : ""}`,
|
|
280
282
|
children: n
|
|
281
283
|
}),
|
|
282
|
-
|
|
284
|
+
s && /* @__PURE__ */ S("p", {
|
|
283
285
|
className: "bs-history-stats",
|
|
284
286
|
children: [
|
|
285
287
|
"Disparos ",
|
|
@@ -287,46 +289,46 @@ function N({ game: e, currentUserId: t, status: n }) {
|
|
|
287
289
|
" · Impactos ",
|
|
288
290
|
i,
|
|
289
291
|
" · Hundidos ",
|
|
290
|
-
|
|
292
|
+
o,
|
|
291
293
|
"/",
|
|
292
|
-
|
|
294
|
+
a.length
|
|
293
295
|
]
|
|
294
296
|
}),
|
|
295
|
-
/* @__PURE__ */ x(
|
|
297
|
+
/* @__PURE__ */ x(Le, { game: e })
|
|
296
298
|
]
|
|
297
299
|
});
|
|
298
300
|
}
|
|
299
|
-
function
|
|
300
|
-
let
|
|
301
|
-
if (!
|
|
302
|
-
let
|
|
303
|
-
return r === "history" ? /* @__PURE__ */ x(
|
|
304
|
-
game:
|
|
301
|
+
function ze({ gameKey: t, currentUserId: n, variant: r = "panel", onMinimize: i, onDismiss: a }) {
|
|
302
|
+
let s = e((e) => e.games[t]), c = o() === "connected";
|
|
303
|
+
if (!s) return null;
|
|
304
|
+
let l = u(s, n);
|
|
305
|
+
return r === "history" ? /* @__PURE__ */ x(P, {
|
|
306
|
+
game: s,
|
|
305
307
|
currentUserId: n,
|
|
306
|
-
status:
|
|
308
|
+
status: l
|
|
307
309
|
}) : /* @__PURE__ */ x(Be, {
|
|
308
|
-
game:
|
|
309
|
-
gameKey:
|
|
310
|
+
game: s,
|
|
311
|
+
gameKey: t,
|
|
310
312
|
currentUserId: n,
|
|
311
|
-
connected:
|
|
312
|
-
status:
|
|
313
|
+
connected: c,
|
|
314
|
+
status: l,
|
|
313
315
|
variant: r,
|
|
314
316
|
onMinimize: i,
|
|
315
317
|
onDismiss: a
|
|
316
318
|
});
|
|
317
319
|
}
|
|
318
|
-
function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, variant:
|
|
319
|
-
let p = v(null), m = v(null), b = v(!1), C = v(void 0),
|
|
320
|
+
function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, variant: c, onMinimize: u, onDismiss: d }) {
|
|
321
|
+
let p = v(null), m = v(null), b = v(!1), C = v(void 0), T = v({
|
|
320
322
|
cell: null,
|
|
321
323
|
time: 0
|
|
322
|
-
}),
|
|
324
|
+
}), D = v({}), O = v(/* @__PURE__ */ new Set()), ve = v(e.status), ye = te(), [k, A] = y("idle"), [Ce, P] = y("own"), [ze, Be] = y(null), [F, Ve] = y(null), [I, He] = y(null), [L, Ue] = y("horizontal"), [We, Ge] = y(null), [Ke, qe] = y(!1), [R, Je] = y(!1), [Ye, Xe] = y(!1), [Ze, Qe] = y(null), $e = l(r, e.hostId), et = l(r, e.guestId), tt = $e || et, nt = s(e), z = e.status === "placement", rt = e.status === "active" || e.status === "won", it = e.status === "active" && l(r, e.turnId), at = !i || !!e.pending || !!e.pendingEvent, B = it && !e.pendingShot && !at && !e.error && !Ye, V = z && !e.myReady && !at, H = we.includes(e.status) && (e.status !== "closed" || (e.myFleet?.length ?? 0) > 0), U = k === "ready", W = _(() => e.myFleet || [], [e.myFleet]), G = e.incomingShots || Ee, K = e.targetShots || Ee, ot = _(() => Ne(W), [W]), q = _(() => new Set(W.map((e) => e.id)), [W]), st = a.every((e) => q.has(e.id)), J = a.find((e) => e.id === We && !q.has(e.id)) || a.find((e) => !q.has(e.id)) || null, ct = _(() => W.map((e) => ({
|
|
323
325
|
...e,
|
|
324
|
-
sunk: !!e.cells?.length && e.cells.every((e) =>
|
|
326
|
+
sunk: !!e.cells?.length && e.cells.every((e) => ke(G, e) === "hit")
|
|
325
327
|
})), [W, G]), lt = _(() => (e.sunkEnemyShips || []).filter((e) => e?.cells?.length).map((e) => ({
|
|
326
328
|
...e,
|
|
327
329
|
size: e.size ?? e.cells.length,
|
|
328
330
|
sunk: !0
|
|
329
|
-
})), [e.sunkEnemyShips]), { total: ut, hits: dt } = _(() =>
|
|
331
|
+
})), [e.sunkEnemyShips]), { total: ut, hits: dt } = _(() => Fe(K), [K]), ft = _(() => {
|
|
330
332
|
let e = [];
|
|
331
333
|
return K.forEach((t, n) => t?.forEach((t, r) => {
|
|
332
334
|
t === "hit" && e.push({
|
|
@@ -334,16 +336,16 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
334
336
|
col: r
|
|
335
337
|
});
|
|
336
338
|
})), e;
|
|
337
|
-
}, [K]), Y = z ? "own" :
|
|
339
|
+
}, [K]), Y = z ? "own" : Ce, X = ze || F, pt = _(() => {
|
|
338
340
|
if (!V || !J || !X) return null;
|
|
339
|
-
let e =
|
|
341
|
+
let e = n(ot, {
|
|
340
342
|
shipId: J.id,
|
|
341
343
|
row: X.row,
|
|
342
344
|
col: X.col,
|
|
343
345
|
orientation: L
|
|
344
346
|
});
|
|
345
347
|
return {
|
|
346
|
-
cells: e.ok ? e.ship.cells :
|
|
348
|
+
cells: e.ok ? e.ship.cells : Pe(X, J.size, L),
|
|
347
349
|
valid: e.ok
|
|
348
350
|
};
|
|
349
351
|
}, [
|
|
@@ -357,7 +359,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
357
359
|
let e = t ? K.map((e, n) => e.map((e, r) => n === t.row && r === t.col ? null : e)) : K;
|
|
358
360
|
return {
|
|
359
361
|
mode: "target",
|
|
360
|
-
ships: t ? lt.map((e) =>
|
|
362
|
+
ships: t ? lt.map((e) => Ae([e], t) ? {
|
|
361
363
|
...e,
|
|
362
364
|
sunk: !1
|
|
363
365
|
} : e) : lt,
|
|
@@ -369,7 +371,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
369
371
|
let n = t ? G.map((e, n) => e.map((e, r) => n === t.row && r === t.col ? null : e)) : G;
|
|
370
372
|
return {
|
|
371
373
|
mode: "own",
|
|
372
|
-
ships: t ? ct.map((e) =>
|
|
374
|
+
ships: t ? ct.map((e) => Ae([e], t) ? {
|
|
373
375
|
...e,
|
|
374
376
|
sunk: !1
|
|
375
377
|
} : e) : ct,
|
|
@@ -391,7 +393,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
391
393
|
kind: t,
|
|
392
394
|
id: Date.now()
|
|
393
395
|
}), []), gt = h((e = I) => {
|
|
394
|
-
B &&
|
|
396
|
+
B && M(e) && (ke(K, e) ? Z(`Ya disparaste en ${j(e)}`) : (He(null), m.current?.selectCell?.(null), E("ui_click"), N("bsFire", t, {
|
|
395
397
|
row: e.row,
|
|
396
398
|
col: e.col
|
|
397
399
|
})));
|
|
@@ -402,25 +404,25 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
402
404
|
t,
|
|
403
405
|
Z
|
|
404
406
|
]), _t = h((e) => {
|
|
405
|
-
if (!V || !
|
|
406
|
-
let
|
|
407
|
-
if (
|
|
408
|
-
Ge(
|
|
407
|
+
if (!V || !M(e)) return;
|
|
408
|
+
let r = Ae(W, e);
|
|
409
|
+
if (r) {
|
|
410
|
+
Ge(r.id), r.orientation && Ue(r.orientation), E("ui_click"), N("bsRemoveShip", t, r.id);
|
|
409
411
|
return;
|
|
410
412
|
}
|
|
411
413
|
if (!J) return;
|
|
412
|
-
let
|
|
414
|
+
let i = n(ot, {
|
|
413
415
|
shipId: J.id,
|
|
414
416
|
row: e.row,
|
|
415
417
|
col: e.col,
|
|
416
418
|
orientation: L
|
|
417
419
|
});
|
|
418
|
-
|
|
420
|
+
i.ok ? (Ge(null), E("ship_place"), N("bsPlaceShip", t, {
|
|
419
421
|
shipId: J.id,
|
|
420
422
|
row: e.row,
|
|
421
423
|
col: e.col,
|
|
422
424
|
orientation: L
|
|
423
|
-
})) : Z(
|
|
425
|
+
})) : Z(i.reason === "overlap" ? "Se superpone con otro barco" : "No cabe en esa posición", "miss");
|
|
424
426
|
}, [
|
|
425
427
|
V,
|
|
426
428
|
W,
|
|
@@ -430,17 +432,17 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
430
432
|
t,
|
|
431
433
|
Z
|
|
432
434
|
]), vt = h((e) => {
|
|
433
|
-
if (!
|
|
435
|
+
if (!M(e)) return;
|
|
434
436
|
if (Ve(e), z) {
|
|
435
437
|
_t(e);
|
|
436
438
|
return;
|
|
437
439
|
}
|
|
438
440
|
if (Y !== "target" || !B) return;
|
|
439
|
-
let t = Date.now(), n =
|
|
440
|
-
|
|
441
|
+
let t = Date.now(), n = T.current;
|
|
442
|
+
T.current = {
|
|
441
443
|
cell: e,
|
|
442
444
|
time: t
|
|
443
|
-
},
|
|
445
|
+
}, De(n.cell, e) && t - n.time < Te ? gt(e) : ke(K, e) ? Z(`Ya disparaste en ${j(e)}`) : (He(e), m.current?.selectCell?.(e));
|
|
444
446
|
}, [
|
|
445
447
|
z,
|
|
446
448
|
_t,
|
|
@@ -450,36 +452,36 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
450
452
|
K,
|
|
451
453
|
Z
|
|
452
454
|
]);
|
|
453
|
-
|
|
455
|
+
D.current = {
|
|
454
456
|
selectCell: vt,
|
|
455
457
|
setHovered: Be
|
|
456
458
|
}, g(() => {
|
|
457
459
|
let e = p.current;
|
|
458
460
|
if (!H || !e) return;
|
|
459
461
|
if (!ee()) {
|
|
460
|
-
|
|
462
|
+
A("fallback");
|
|
461
463
|
return;
|
|
462
464
|
}
|
|
463
465
|
let t = !1, n = null;
|
|
464
|
-
return
|
|
466
|
+
return A("loading"), import("./createBattleScene-L4ZRWDED.js").then(({ createBattleScene: r }) => {
|
|
465
467
|
t || (n = r(e, {
|
|
466
468
|
quality: "auto",
|
|
467
|
-
reducedMotion:
|
|
469
|
+
reducedMotion: Me(),
|
|
468
470
|
onCellHover: (e) => {
|
|
469
|
-
t ||
|
|
471
|
+
t || D.current.setHovered(M(e) ? {
|
|
470
472
|
row: e.row,
|
|
471
473
|
col: e.col
|
|
472
474
|
} : null);
|
|
473
475
|
},
|
|
474
476
|
onCellSelect: (e) => {
|
|
475
|
-
t ||
|
|
477
|
+
t || D.current.selectCell(M(e) ? {
|
|
476
478
|
row: e.row,
|
|
477
479
|
col: e.col
|
|
478
480
|
} : null);
|
|
479
481
|
}
|
|
480
|
-
}), m.current = n,
|
|
482
|
+
}), m.current = n, A("ready"));
|
|
481
483
|
}).catch((e) => {
|
|
482
|
-
t || (console.error("[battleship] No se pudo iniciar la escena", e),
|
|
484
|
+
t || (console.error("[battleship] No se pudo iniciar la escena", e), A("fallback"));
|
|
483
485
|
}), () => {
|
|
484
486
|
t = !0, m.current = null;
|
|
485
487
|
try {
|
|
@@ -490,22 +492,22 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
490
492
|
};
|
|
491
493
|
}, [H]), g(() => {
|
|
492
494
|
w.preload();
|
|
493
|
-
let e =
|
|
495
|
+
let e = O.current;
|
|
494
496
|
return () => {
|
|
495
497
|
e.forEach(clearTimeout), e.clear();
|
|
496
498
|
};
|
|
497
499
|
}, []);
|
|
498
500
|
let yt = H && !nt;
|
|
499
|
-
g(() => yt ?
|
|
500
|
-
let t =
|
|
501
|
-
|
|
501
|
+
g(() => yt ? _e() : void 0, [yt]), g(() => {
|
|
502
|
+
let t = ve.current;
|
|
503
|
+
ve.current = e.status, t === "placement" && e.status === "active" && ge([{
|
|
502
504
|
name: "sonar_ping",
|
|
503
505
|
at: 0
|
|
504
|
-
}], () => `${e.gameId}:start`,
|
|
506
|
+
}], () => `${e.gameId}:start`, O.current);
|
|
505
507
|
}, [e.status, e.gameId]);
|
|
506
508
|
let Q = e.lastShot;
|
|
507
509
|
g(() => {
|
|
508
|
-
if (!U &&
|
|
510
|
+
if (!U && k !== "fallback") return;
|
|
509
511
|
let t = Q?.eventId ?? null;
|
|
510
512
|
if (C.current === void 0) {
|
|
511
513
|
C.current = t;
|
|
@@ -513,45 +515,45 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
513
515
|
}
|
|
514
516
|
if (!t || t === C.current) return;
|
|
515
517
|
C.current = t;
|
|
516
|
-
let n = !
|
|
518
|
+
let n = !l(Q.by, r), i = {
|
|
517
519
|
row: Q.row,
|
|
518
520
|
col: Q.col
|
|
519
|
-
}, a =
|
|
521
|
+
}, a = j(i), o = typeof Q.sunk == "string" ? Q.sunk : Q.sunk ? Ae(n ? W : e.sunkEnemyShips || [], i)?.id : null, s = n ? Q.sunk ? `Te hundieron el ${Oe(o)}` : Q.result === "hit" ? `El rival impactó en ${a}` : `El rival falló: agua en ${a}` : Q.sunk ? `¡Hundiste el ${Oe(o)}!` : Q.result === "hit" ? `¡Impacto en ${a}!` : `Agua en ${a}`, c = Q.result === "hit" ? "hit" : "miss", u = n ? "own" : "target", d = n && be(W, e.incomingShots, Q), f = Se({
|
|
520
522
|
result: Q.result,
|
|
521
523
|
sunk: !!Q.sunk,
|
|
522
524
|
defeated: !!Q.defeated,
|
|
523
525
|
won: !n,
|
|
524
|
-
cruiserAlarm:
|
|
525
|
-
}), p = (n) => n === "cruiser_damage_alarm" ? `${e.gameId}:cruiser` : n === "victory" || n === "defeat" ? `${e.gameId}:end` : t, ee =
|
|
526
|
-
|
|
526
|
+
cruiserAlarm: d
|
|
527
|
+
}), p = (n) => n === "cruiser_damage_alarm" ? `${e.gameId}:cruiser` : n === "victory" || n === "defeat" ? `${e.gameId}:end` : t, ee = O.current;
|
|
528
|
+
P(u);
|
|
527
529
|
let h = m.current;
|
|
528
530
|
if (!h?.playShot) {
|
|
529
|
-
|
|
531
|
+
ge(f, p, ee), Z(s, c);
|
|
530
532
|
return;
|
|
531
533
|
}
|
|
532
|
-
|
|
534
|
+
ge(xe({ incoming: n }), p, ee), b.current = !0, Xe(!0);
|
|
533
535
|
let g = !1;
|
|
534
536
|
try {
|
|
535
|
-
h.setView(mt(
|
|
537
|
+
h.setView(mt(u, i));
|
|
536
538
|
} catch {}
|
|
537
|
-
let te =
|
|
539
|
+
let te = Me() ? 0 : 600;
|
|
538
540
|
return Promise.resolve(h.playShot({
|
|
539
541
|
row: i.row,
|
|
540
542
|
col: i.col,
|
|
541
543
|
result: Q.result,
|
|
542
544
|
sunk: !!Q.sunk,
|
|
543
545
|
incoming: n
|
|
544
|
-
})).catch(() => {}).then(() => (
|
|
546
|
+
})).catch(() => {}).then(() => (ge(f, p, ee), g || Z(s, c), new Promise((e) => setTimeout(e, te)))).then(() => {
|
|
545
547
|
g || (b.current = !1, Xe(!1));
|
|
546
548
|
}), () => {
|
|
547
549
|
g = !0, b.current = !1, Xe(!1);
|
|
548
550
|
};
|
|
549
551
|
}, [
|
|
550
552
|
U,
|
|
551
|
-
|
|
553
|
+
k,
|
|
552
554
|
Q?.eventId
|
|
553
555
|
]), g(() => {
|
|
554
|
-
Ye || e.status !== "active" ||
|
|
556
|
+
Ye || e.status !== "active" || P(it ? "target" : "own");
|
|
555
557
|
}, [
|
|
556
558
|
it,
|
|
557
559
|
e.status,
|
|
@@ -585,13 +587,13 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
585
587
|
ft
|
|
586
588
|
]);
|
|
587
589
|
let bt = () => {
|
|
588
|
-
|
|
590
|
+
E("ship_rotate"), Ue((e) => e === "horizontal" ? "vertical" : "horizontal");
|
|
589
591
|
}, xt = () => {
|
|
590
|
-
st && V && (
|
|
592
|
+
st && V && (E("ui_click"), N("bsReady", t));
|
|
591
593
|
}, $ = (e) => (...t) => {
|
|
592
|
-
|
|
594
|
+
E("ui_click"), e(...t);
|
|
593
595
|
}, St = () => {
|
|
594
|
-
|
|
596
|
+
E(Ke ? "ui_click" : "sonar_ping"), qe((e) => !e);
|
|
595
597
|
}, Ct = (e) => {
|
|
596
598
|
if (e.target !== e.currentTarget || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
597
599
|
let t = {
|
|
@@ -602,7 +604,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
602
604
|
};
|
|
603
605
|
if (t[e.key]) {
|
|
604
606
|
e.preventDefault();
|
|
605
|
-
let [n, r] = t[e.key], i = (Y === "target" ? I : null) || F ||
|
|
607
|
+
let [n, r] = t[e.key], i = (Y === "target" ? I : null) || F || ze, a = i ? {
|
|
606
608
|
row: Math.min(9, Math.max(0, i.row + n)),
|
|
607
609
|
col: Math.min(9, Math.max(0, i.col + r))
|
|
608
610
|
} : {
|
|
@@ -610,12 +612,12 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
610
612
|
col: 0
|
|
611
613
|
};
|
|
612
614
|
Ve(a), Be(null), Y === "target" && B && (He(a), m.current?.selectCell?.(a));
|
|
613
|
-
} else (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z ? _t(F ||
|
|
615
|
+
} else (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z ? _t(F || ze) : gt(I || F));
|
|
614
616
|
}, wt = (e) => {
|
|
615
617
|
e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || /^(INPUT|TEXTAREA|SELECT)$/.test(e.target.tagName) || e.target.isContentEditable || (e.key === "r" || e.key === "R" ? (e.preventDefault(), z ? bt() : m.current?.resetCamera?.()) : e.key === "Escape" && R && (e.preventDefault(), e.stopPropagation(), Je(!1)));
|
|
616
|
-
}, Tt = /* @__PURE__ */ x(
|
|
618
|
+
}, Tt = /* @__PURE__ */ x(Le, { game: e }), Et = e.status === "won" && l(r, e.winnerId), Dt = !i && !nt ? "Sin conexión · esperando reconexión" : e.pending ? "Sincronizando…" : o, Ot = lt.length;
|
|
617
619
|
return /* @__PURE__ */ S("section", {
|
|
618
|
-
className: `chat-game-card bs-card${it ? " chat-game-card--my-turn" : ""}${
|
|
620
|
+
className: `chat-game-card bs-card${it ? " chat-game-card--my-turn" : ""}${c ? ` chat-game-card--${c}` : ""}${R ? " bs-card--expanded" : ""}`,
|
|
619
621
|
"aria-label": "Partida de Batalla Naval",
|
|
620
622
|
onKeyDown: wt,
|
|
621
623
|
children: [
|
|
@@ -633,7 +635,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
633
635
|
className: "bs-title-icon"
|
|
634
636
|
})] })]
|
|
635
637
|
}),
|
|
636
|
-
|
|
638
|
+
c === "panel" && /* @__PURE__ */ x(f, { manager: w }),
|
|
637
639
|
H && /* @__PURE__ */ x("button", {
|
|
638
640
|
className: "chat-game-close bs-expand",
|
|
639
641
|
type: "button",
|
|
@@ -664,7 +666,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
664
666
|
type: "button",
|
|
665
667
|
"aria-label": "Finalizar partida para ambos jugadores",
|
|
666
668
|
title: "Finalizar partida para ambos",
|
|
667
|
-
onClick: () => void
|
|
669
|
+
onClick: () => void N("act", t, "game_end"),
|
|
668
670
|
disabled: !i,
|
|
669
671
|
children: /* @__PURE__ */ x(me, {
|
|
670
672
|
size: 16,
|
|
@@ -700,13 +702,13 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
700
702
|
type: "button",
|
|
701
703
|
className: "chat-game-action chat-game-action--primary",
|
|
702
704
|
disabled: at,
|
|
703
|
-
onClick: $(() => void
|
|
705
|
+
onClick: $(() => void N("act", t, "game_accept")),
|
|
704
706
|
children: "Aceptar partida"
|
|
705
707
|
}), /* @__PURE__ */ x("button", {
|
|
706
708
|
type: "button",
|
|
707
709
|
className: "chat-game-action",
|
|
708
710
|
disabled: at,
|
|
709
|
-
onClick: $(() => void
|
|
711
|
+
onClick: $(() => void N("act", t, "game_decline")),
|
|
710
712
|
children: "Rechazar"
|
|
711
713
|
})]
|
|
712
714
|
})]
|
|
@@ -720,16 +722,16 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
720
722
|
className: "bs-segment",
|
|
721
723
|
children: [/* @__PURE__ */ S("button", {
|
|
722
724
|
type: "button",
|
|
723
|
-
"aria-pressed":
|
|
724
|
-
onClick: $(() =>
|
|
725
|
+
"aria-pressed": Ce === "target",
|
|
726
|
+
onClick: $(() => P("target")),
|
|
725
727
|
children: [/* @__PURE__ */ x(ae, {
|
|
726
728
|
size: 14,
|
|
727
729
|
"aria-hidden": "true"
|
|
728
730
|
}), "Objetivo"]
|
|
729
731
|
}), /* @__PURE__ */ S("button", {
|
|
730
732
|
type: "button",
|
|
731
|
-
"aria-pressed":
|
|
732
|
-
onClick: $(() =>
|
|
733
|
+
"aria-pressed": Ce === "own",
|
|
734
|
+
onClick: $(() => P("own")),
|
|
733
735
|
children: [/* @__PURE__ */ x(ne, {
|
|
734
736
|
size: 14,
|
|
735
737
|
"aria-hidden": "true"
|
|
@@ -743,7 +745,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
743
745
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("dt", { children: "Hundidos" }), /* @__PURE__ */ S("dd", { children: [
|
|
744
746
|
Ot,
|
|
745
747
|
"/",
|
|
746
|
-
|
|
748
|
+
a.length
|
|
747
749
|
] })] })
|
|
748
750
|
]
|
|
749
751
|
})]
|
|
@@ -753,14 +755,14 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
753
755
|
children: [
|
|
754
756
|
/* @__PURE__ */ x("div", {
|
|
755
757
|
ref: p,
|
|
756
|
-
className: `bs-stage${
|
|
758
|
+
className: `bs-stage${k === "fallback" ? " bs-stage--fallback" : ""}`,
|
|
757
759
|
tabIndex: 0,
|
|
758
760
|
role: "application",
|
|
759
761
|
"aria-label": z ? "Tablero 3D de tu flota. Flechas para mover, Enter para colocar o quitar un barco, R para rotar." : "Tablero 3D de Batalla Naval. Flechas para mover la selección, Enter para disparar, R para centrar la cámara.",
|
|
760
|
-
"aria-describedby":
|
|
761
|
-
"aria-busy":
|
|
762
|
+
"aria-describedby": ye,
|
|
763
|
+
"aria-busy": k === "loading",
|
|
762
764
|
onKeyDown: Ct,
|
|
763
|
-
children:
|
|
765
|
+
children: k === "fallback" && /* @__PURE__ */ x(Re, {
|
|
764
766
|
view: ht,
|
|
765
767
|
selected: Y === "target" ? I : null,
|
|
766
768
|
cursor: F,
|
|
@@ -768,7 +770,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
768
770
|
onHover: Be
|
|
769
771
|
})
|
|
770
772
|
}),
|
|
771
|
-
|
|
773
|
+
k === "loading" && /* @__PURE__ */ S("div", {
|
|
772
774
|
className: "bs-stage-state",
|
|
773
775
|
role: "status",
|
|
774
776
|
children: [/* @__PURE__ */ x(pe, {
|
|
@@ -776,7 +778,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
776
778
|
"aria-hidden": "true"
|
|
777
779
|
}), " Preparando el océano…"]
|
|
778
780
|
}),
|
|
779
|
-
|
|
781
|
+
k === "fallback" && /* @__PURE__ */ S("p", {
|
|
780
782
|
className: "bs-fallback-note",
|
|
781
783
|
children: [/* @__PURE__ */ x(fe, {
|
|
782
784
|
size: 12,
|
|
@@ -786,7 +788,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
786
788
|
/* @__PURE__ */ x("div", {
|
|
787
789
|
className: "bs-cell-chip",
|
|
788
790
|
"aria-hidden": "true",
|
|
789
|
-
children:
|
|
791
|
+
children: j(z ? X : Y === "target" && I || ze)
|
|
790
792
|
}),
|
|
791
793
|
/* @__PURE__ */ x("div", {
|
|
792
794
|
className: "bs-live",
|
|
@@ -800,7 +802,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
800
802
|
]
|
|
801
803
|
}),
|
|
802
804
|
/* @__PURE__ */ x("p", {
|
|
803
|
-
id:
|
|
805
|
+
id: ye,
|
|
804
806
|
className: "bs-hint",
|
|
805
807
|
children: z ? "Clic para colocar · clic en un barco para quitarlo · R para rotar" : "Arrastra para rotar · doble clic o Enter para disparar"
|
|
806
808
|
}),
|
|
@@ -810,7 +812,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
810
812
|
/* @__PURE__ */ x("ul", {
|
|
811
813
|
className: "bs-fleet",
|
|
812
814
|
"aria-label": "Tu flota",
|
|
813
|
-
children:
|
|
815
|
+
children: a.map((e) => {
|
|
814
816
|
let n = q.has(e.id), r = J?.id === e.id;
|
|
815
817
|
return /* @__PURE__ */ x("li", { children: /* @__PURE__ */ S("button", {
|
|
816
818
|
type: "button",
|
|
@@ -819,12 +821,12 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
819
821
|
disabled: !V,
|
|
820
822
|
title: n ? "Quitar y volver a colocar" : "Seleccionar barco",
|
|
821
823
|
onClick: $(() => {
|
|
822
|
-
n &&
|
|
824
|
+
n && N("bsRemoveShip", t, e.id), Ge(e.id);
|
|
823
825
|
}),
|
|
824
826
|
children: [
|
|
825
827
|
/* @__PURE__ */ x("span", {
|
|
826
828
|
className: "bs-ship__name",
|
|
827
|
-
children:
|
|
829
|
+
children: je(Oe(e.id))
|
|
828
830
|
}),
|
|
829
831
|
/* @__PURE__ */ x("span", {
|
|
830
832
|
className: "bs-ship__pips",
|
|
@@ -858,7 +860,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
858
860
|
className: "chat-game-action bs-btn",
|
|
859
861
|
disabled: !V,
|
|
860
862
|
onClick: () => {
|
|
861
|
-
|
|
863
|
+
E("ship_place"), N("bsRandomFleet", t);
|
|
862
864
|
},
|
|
863
865
|
children: [/* @__PURE__ */ x(de, {
|
|
864
866
|
size: 15,
|
|
@@ -873,7 +875,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
873
875
|
children: [/* @__PURE__ */ x(re, {
|
|
874
876
|
size: 15,
|
|
875
877
|
"aria-hidden": "true"
|
|
876
|
-
}), e.myReady ? "Flota lista" : `Listo (${q.size}/${
|
|
878
|
+
}), e.myReady ? "Flota lista" : `Listo (${q.size}/${a.length})`]
|
|
877
879
|
})
|
|
878
880
|
]
|
|
879
881
|
}),
|
|
@@ -891,14 +893,14 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
891
893
|
className: "chat-game-action chat-game-action--primary bs-btn bs-btn--fire",
|
|
892
894
|
disabled: !B || !I || Y !== "target",
|
|
893
895
|
onClick: () => gt(),
|
|
894
|
-
title: I ? `Disparar en ${
|
|
896
|
+
title: I ? `Disparar en ${j(I)} (Enter)` : "Selecciona una casilla",
|
|
895
897
|
children: [
|
|
896
898
|
/* @__PURE__ */ x(ae, {
|
|
897
899
|
size: 15,
|
|
898
900
|
"aria-hidden": "true"
|
|
899
901
|
}),
|
|
900
902
|
"Disparar",
|
|
901
|
-
I ? ` · ${
|
|
903
|
+
I ? ` · ${j(I)}` : ""
|
|
902
904
|
]
|
|
903
905
|
}),
|
|
904
906
|
/* @__PURE__ */ S("button", {
|
|
@@ -930,11 +932,11 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
930
932
|
]
|
|
931
933
|
})
|
|
932
934
|
] }),
|
|
933
|
-
e.status === "conflict" && tt && /* @__PURE__ */ x(
|
|
935
|
+
e.status === "conflict" && tt && /* @__PURE__ */ x(Ie, {
|
|
934
936
|
sync: e.sync,
|
|
935
937
|
connected: i,
|
|
936
|
-
onResync: () => void
|
|
937
|
-
onAdoptOffer: () => void
|
|
938
|
+
onResync: () => void N("requestResync", t),
|
|
939
|
+
onAdoptOffer: () => void N("adoptResyncOffer", t)
|
|
938
940
|
}),
|
|
939
941
|
e.error && /* @__PURE__ */ S("div", {
|
|
940
942
|
className: "chat-game-error",
|
|
@@ -943,7 +945,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
943
945
|
type: "button",
|
|
944
946
|
className: "chat-game-action",
|
|
945
947
|
disabled: !i || e.pending,
|
|
946
|
-
onClick: () => void
|
|
948
|
+
onClick: () => void N("retry", t),
|
|
947
949
|
children: "Reintentar"
|
|
948
950
|
})]
|
|
949
951
|
}),
|
|
@@ -954,7 +956,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
954
956
|
]
|
|
955
957
|
});
|
|
956
958
|
}
|
|
957
|
-
var F = m(
|
|
959
|
+
var F = m(ze);
|
|
958
960
|
export { F as default };
|
|
959
961
|
|
|
960
|
-
//# sourceMappingURL=BattleshipGameCard-
|
|
962
|
+
//# sourceMappingURL=BattleshipGameCard-B-B4r7lK.js.map
|