@minicode-dev/chat 0.1.6 → 0.1.7
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/assets/sounds/tanks/big_explosion.mp3 +0 -0
- package/assets/sounds/tanks/big_explosion.ogg +0 -0
- package/assets/sounds/tanks/cannon_fire.mp3 +0 -0
- package/assets/sounds/tanks/cannon_fire.ogg +0 -0
- package/assets/sounds/tanks/defeat.mp3 +0 -0
- package/assets/sounds/tanks/defeat.ogg +0 -0
- package/assets/sounds/tanks/engine_loop.mp3 +0 -0
- package/assets/sounds/tanks/engine_loop.ogg +0 -0
- package/assets/sounds/tanks/engine_start.mp3 +0 -0
- package/assets/sounds/tanks/engine_start.ogg +0 -0
- package/assets/sounds/tanks/projectile_whistle.mp3 +0 -0
- package/assets/sounds/tanks/projectile_whistle.ogg +0 -0
- package/assets/sounds/tanks/tank_destroyed.mp3 +0 -0
- package/assets/sounds/tanks/tank_destroyed.ogg +0 -0
- package/assets/sounds/tanks/tank_hit.mp3 +0 -0
- package/assets/sounds/tanks/tank_hit.ogg +0 -0
- package/assets/sounds/tanks/terrain_impact.mp3 +0 -0
- package/assets/sounds/tanks/terrain_impact.ogg +0 -0
- package/assets/sounds/tanks/tracks_loop.mp3 +0 -0
- package/assets/sounds/tanks/tracks_loop.ogg +0 -0
- package/assets/sounds/tanks/turret_loop.mp3 +0 -0
- package/assets/sounds/tanks/turret_loop.ogg +0 -0
- package/assets/sounds/tanks/victory.mp3 +0 -0
- package/assets/sounds/tanks/victory.ogg +0 -0
- package/dist/chunks/{BattleshipGameCard-S-UdM6rn.js → BattleshipGameCard-CAWHxqJE.js} +231 -230
- package/dist/chunks/{BattleshipGameCard-S-UdM6rn.js.map → BattleshipGameCard-CAWHxqJE.js.map} +1 -1
- package/dist/chunks/{BattleshipPrototype-Dm6U_mCr.js → BattleshipPrototype-CmQd5AUO.js} +4 -3
- package/dist/chunks/{BattleshipPrototype-Dm6U_mCr.js.map → BattleshipPrototype-CmQd5AUO.js.map} +1 -1
- package/dist/chunks/ChatContext-CUiEAMKK.js +90 -0
- package/dist/chunks/ChatContext-CUiEAMKK.js.map +1 -0
- package/dist/chunks/TanksGameCard-BEnXTz_J.js +1705 -0
- package/dist/chunks/TanksGameCard-BEnXTz_J.js.map +1 -0
- package/dist/chunks/{battleship-DXKuIZ1I.js → board-DXKuIZ1I.js} +1 -1
- package/dist/chunks/board-DXKuIZ1I.js.map +1 -0
- package/dist/chunks/connect4Sounds-BDXQAvU1.js +3199 -0
- package/dist/chunks/connect4Sounds-BDXQAvU1.js.map +1 -0
- package/dist/chunks/core-geo-UJY-tH9L.js +361 -0
- package/dist/chunks/core-geo-UJY-tH9L.js.map +1 -0
- package/dist/chunks/createBattleScene-L4ZRWDED.js +1265 -0
- package/dist/chunks/createBattleScene-L4ZRWDED.js.map +1 -0
- package/dist/chunks/createTankScene-BuliAxwR.js +2150 -0
- package/dist/chunks/createTankScene-BuliAxwR.js.map +1 -0
- package/dist/index.js +2393 -2448
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunks/battleship-DXKuIZ1I.js.map +0 -1
- package/dist/chunks/connect4Sounds-9u0p-dAf.js +0 -1847
- package/dist/chunks/connect4Sounds-9u0p-dAf.js.map +0 -1
- package/dist/chunks/createBattleScene-HIAvjixn.js +0 -1621
- package/dist/chunks/createBattleScene-HIAvjixn.js.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as u, n as d, s as f, t as p } from "./
|
|
1
|
+
import { C as e, a as t, h as n, m as r, o as i, s as a, t as o, u as s, v as c, y as l } from "./connect4Sounds-BDXQAvU1.js";
|
|
2
|
+
import { l as u, n as d, s as f, t as p } from "./board-DXKuIZ1I.js";
|
|
3
|
+
import "../index.js";
|
|
3
4
|
import { t as ee } from "./webglSupport-2WjPEPZ_.js";
|
|
4
5
|
import { memo as m, useCallback as h, useEffect as g, useId as te, useMemo as _, useRef as v, useState as y } from "react";
|
|
5
6
|
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";
|
|
6
7
|
import { Fragment as he, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
7
8
|
// src/games/battleship/sound/battleshipSounds.js
|
|
8
|
-
var C = "ocean_ambient_loop", w =
|
|
9
|
+
var C = "ocean_ambient_loop", w = t({
|
|
9
10
|
id: "battleship",
|
|
10
11
|
baseUrl: () => l("battleship_audio_pack/assets"),
|
|
11
|
-
settingsFrom:
|
|
12
|
+
settingsFrom: o,
|
|
12
13
|
sounds: Object.fromEntries([
|
|
13
14
|
"cannon_fire",
|
|
14
15
|
"projectile_flyby",
|
|
@@ -41,14 +42,14 @@ var C = "ocean_ambient_loop", w = n({
|
|
|
41
42
|
defeat: .4,
|
|
42
43
|
[C]: .22
|
|
43
44
|
}
|
|
44
|
-
}),
|
|
45
|
-
function
|
|
46
|
-
|
|
45
|
+
}), T = () => typeof document < "u" && document.hidden;
|
|
46
|
+
function E(e) {
|
|
47
|
+
T() || w.play(e);
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function ge(e, t, n) {
|
|
49
50
|
e.forEach(({ name: e, at: r }) => {
|
|
50
51
|
let i = () => {
|
|
51
|
-
|
|
52
|
+
T() || w.play(e, { key: t(e) });
|
|
52
53
|
};
|
|
53
54
|
if (r <= 0) {
|
|
54
55
|
i();
|
|
@@ -60,26 +61,26 @@ function _e(e, t, n) {
|
|
|
60
61
|
n.add(a);
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
var
|
|
64
|
-
|
|
64
|
+
var D = 0, O = () => {
|
|
65
|
+
D > 0 && !T() ? w.startLoop(C) : w.stopLoop(C);
|
|
65
66
|
};
|
|
66
|
-
function
|
|
67
|
-
|
|
67
|
+
function _e() {
|
|
68
|
+
D += 1, D === 1 && document.addEventListener("visibilitychange", O), O();
|
|
68
69
|
let e = !1;
|
|
69
70
|
return () => {
|
|
70
|
-
e || (e = !0, --
|
|
71
|
+
e || (e = !0, --D, D === 0 && document.removeEventListener("visibilitychange", O), O());
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
74
|
// src/games/battleship/sound/cues.js
|
|
74
|
-
var
|
|
75
|
-
function
|
|
75
|
+
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;
|
|
76
|
+
function be(e, t, n) {
|
|
76
77
|
if (n?.result !== "hit") return !1;
|
|
77
|
-
let r = (e || []).find((e) => e.id ===
|
|
78
|
-
if (!r?.cells?.some((e) =>
|
|
79
|
-
let i =
|
|
78
|
+
let r = (e || []).find((e) => e.id === ve);
|
|
79
|
+
if (!r?.cells?.some((e) => ye(e, n))) return !1;
|
|
80
|
+
let i = k(r, t, n), a = k(r, t);
|
|
80
81
|
return i < 2 && a >= 2;
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function xe({ incoming: e }) {
|
|
83
84
|
return e ? [{
|
|
84
85
|
name: "projectile_flyby",
|
|
85
86
|
at: 0
|
|
@@ -91,7 +92,7 @@ function Se({ incoming: e }) {
|
|
|
91
92
|
at: 180
|
|
92
93
|
}];
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function Se({ result: e, sunk: t, defeated: n, won: r, cruiserAlarm: i }) {
|
|
95
96
|
let a = e === "hit" ? t ? [{
|
|
96
97
|
name: "ship_heavy_hit",
|
|
97
98
|
at: 0
|
|
@@ -114,20 +115,20 @@ function Ce({ result: e, sunk: t, defeated: n, won: r, cruiserAlarm: i }) {
|
|
|
114
115
|
}), a;
|
|
115
116
|
}
|
|
116
117
|
// src/games/battleship/BattleshipGameCard.jsx
|
|
117
|
-
var
|
|
118
|
+
var A = "ABCDEFGHIJ", Ce = {
|
|
118
119
|
carrier: "portaaviones",
|
|
119
120
|
battleship: "acorazado",
|
|
120
121
|
cruiser: "crucero",
|
|
121
122
|
submarine: "submarino",
|
|
122
123
|
destroyer: "destructor"
|
|
123
|
-
},
|
|
124
|
+
}, we = [
|
|
124
125
|
"placement",
|
|
125
126
|
"active",
|
|
126
127
|
"won",
|
|
127
128
|
"conflict",
|
|
128
129
|
"closed"
|
|
129
|
-
],
|
|
130
|
-
function
|
|
130
|
+
], 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(() => {});
|
|
131
|
+
function Ne(e) {
|
|
131
132
|
let t = d();
|
|
132
133
|
for (let n of e || []) {
|
|
133
134
|
let e = n.cells?.[0];
|
|
@@ -142,13 +143,13 @@ function Pe(e) {
|
|
|
142
143
|
}
|
|
143
144
|
return t;
|
|
144
145
|
}
|
|
145
|
-
function
|
|
146
|
+
function Pe(e, t, n) {
|
|
146
147
|
return Array.from({ length: t }, (t, r) => ({
|
|
147
148
|
row: e.row + (n === "vertical" ? r : 0),
|
|
148
149
|
col: e.col + (n === "horizontal" ? r : 0)
|
|
149
|
-
})).filter(
|
|
150
|
+
})).filter(M);
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
+
function Fe(e) {
|
|
152
153
|
let t = 0, n = 0;
|
|
153
154
|
for (let r of e || []) for (let e of r || []) e && (t += 1), e === "hit" && (n += 1);
|
|
154
155
|
return {
|
|
@@ -156,7 +157,7 @@ function Ie(e) {
|
|
|
156
157
|
hits: n
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
+
function Ie({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
160
161
|
return e?.status === "requesting" ? /* @__PURE__ */ x("div", {
|
|
161
162
|
className: "chat-game-sync",
|
|
162
163
|
role: "status",
|
|
@@ -183,8 +184,8 @@ function Le({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
|
183
184
|
]
|
|
184
185
|
});
|
|
185
186
|
}
|
|
186
|
-
function
|
|
187
|
-
let t =
|
|
187
|
+
function Le({ game: e }) {
|
|
188
|
+
let t = s(e);
|
|
188
189
|
return t ? /* @__PURE__ */ S("span", {
|
|
189
190
|
className: `bs-badge bs-badge--${e.verification}`,
|
|
190
191
|
children: [
|
|
@@ -200,7 +201,7 @@ function Re({ game: e }) {
|
|
|
200
201
|
]
|
|
201
202
|
}) : null;
|
|
202
203
|
}
|
|
203
|
-
function
|
|
204
|
+
function Re({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
204
205
|
let a = /* @__PURE__ */ new Map();
|
|
205
206
|
e.ships.forEach((e) => e.cells.forEach((t) => a.set(`${t.row}-${t.col}`, e)));
|
|
206
207
|
let o = new Set((e.preview?.cells || []).map((e) => `${e.row}-${e.col}`));
|
|
@@ -219,11 +220,11 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
219
220
|
d?.sunk && "is-sunk",
|
|
220
221
|
f && `is-${f}`,
|
|
221
222
|
o.has(u) && (e.preview.valid ? "is-preview" : "is-invalid"),
|
|
222
|
-
|
|
223
|
+
De(t, {
|
|
223
224
|
row: c,
|
|
224
225
|
col: l
|
|
225
226
|
}) && "is-selected",
|
|
226
|
-
|
|
227
|
+
De(n, {
|
|
227
228
|
row: c,
|
|
228
229
|
col: l
|
|
229
230
|
}) && "is-cursor"
|
|
@@ -234,7 +235,7 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
234
235
|
tabIndex: -1,
|
|
235
236
|
className: p,
|
|
236
237
|
disabled: !e.interactive,
|
|
237
|
-
"aria-label": `${
|
|
238
|
+
"aria-label": `${A[c]}${l + 1}${f === "hit" ? ", impacto" : f === "miss" ? ", agua" : ""}${d ? ", barco" : ""}`,
|
|
238
239
|
onMouseEnter: () => i({
|
|
239
240
|
row: c,
|
|
240
241
|
col: l
|
|
@@ -248,13 +249,13 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
248
249
|
}, c))
|
|
249
250
|
});
|
|
250
251
|
}
|
|
251
|
-
function
|
|
252
|
-
let { total: i, hits: a } =
|
|
252
|
+
function P({ game: e, currentUserId: t, status: r }) {
|
|
253
|
+
let { total: i, hits: a } = Fe(e.targetShots), o = e.sunkEnemyShips?.length || 0, s = [
|
|
253
254
|
"active",
|
|
254
255
|
"won",
|
|
255
256
|
"closed",
|
|
256
257
|
"conflict"
|
|
257
|
-
].includes(e.status) && i > 0, c = e.status === "won" &&
|
|
258
|
+
].includes(e.status) && i > 0, c = e.status === "won" && n(t, e.winnerId);
|
|
258
259
|
return /* @__PURE__ */ S("section", {
|
|
259
260
|
className: "chat-game-card chat-game-card--history bs-card bs-card--history",
|
|
260
261
|
"aria-label": "Partida de Batalla Naval",
|
|
@@ -275,7 +276,7 @@ function N({ game: e, currentUserId: t, status: n }) {
|
|
|
275
276
|
}),
|
|
276
277
|
/* @__PURE__ */ x("p", {
|
|
277
278
|
className: `chat-game-status${c ? " bs-status--win" : ""}`,
|
|
278
|
-
children:
|
|
279
|
+
children: r
|
|
279
280
|
}),
|
|
280
281
|
s && /* @__PURE__ */ S("p", {
|
|
281
282
|
className: "bs-history-stats",
|
|
@@ -290,194 +291,194 @@ function N({ game: e, currentUserId: t, status: n }) {
|
|
|
290
291
|
p.length
|
|
291
292
|
]
|
|
292
293
|
}),
|
|
293
|
-
/* @__PURE__ */ x(
|
|
294
|
+
/* @__PURE__ */ x(Le, { game: e })
|
|
294
295
|
]
|
|
295
296
|
});
|
|
296
297
|
}
|
|
297
|
-
function
|
|
298
|
-
let
|
|
299
|
-
if (!
|
|
300
|
-
let u =
|
|
301
|
-
return
|
|
302
|
-
game:
|
|
303
|
-
currentUserId:
|
|
298
|
+
function F({ gameKey: t, currentUserId: n, variant: r = "panel", onMinimize: i, onDismiss: o }) {
|
|
299
|
+
let s = e((e) => e.games[t]), l = c() === "connected";
|
|
300
|
+
if (!s) return null;
|
|
301
|
+
let u = a(s, n);
|
|
302
|
+
return r === "history" ? /* @__PURE__ */ x(P, {
|
|
303
|
+
game: s,
|
|
304
|
+
currentUserId: n,
|
|
304
305
|
status: u
|
|
305
|
-
}) : /* @__PURE__ */ x(
|
|
306
|
-
game:
|
|
307
|
-
gameKey:
|
|
308
|
-
currentUserId:
|
|
306
|
+
}) : /* @__PURE__ */ x(ze, {
|
|
307
|
+
game: s,
|
|
308
|
+
gameKey: t,
|
|
309
|
+
currentUserId: n,
|
|
309
310
|
connected: l,
|
|
310
311
|
status: u,
|
|
311
|
-
variant:
|
|
312
|
-
onMinimize:
|
|
313
|
-
onDismiss:
|
|
312
|
+
variant: r,
|
|
313
|
+
onMinimize: i,
|
|
314
|
+
onDismiss: o
|
|
314
315
|
});
|
|
315
316
|
}
|
|
316
|
-
function
|
|
317
|
-
let f = v(null), m = v(null), b = v(!1), C = v(void 0),
|
|
317
|
+
function ze({ game: e, gameKey: t, currentUserId: a, connected: o, status: s, variant: c, onMinimize: l, onDismiss: d }) {
|
|
318
|
+
let f = v(null), m = v(null), b = v(!1), C = v(void 0), T = v({
|
|
318
319
|
cell: null,
|
|
319
320
|
time: 0
|
|
320
|
-
}),
|
|
321
|
+
}), D = v({}), O = v(/* @__PURE__ */ new Set()), ve = v(e.status), ye = te(), [k, A] = y("idle"), [Ce, P] = y("own"), [F, ze] = y(null), [I, Be] = y(null), [L, Ve] = y(null), [R, He] = y("horizontal"), [Ue, We] = y(null), [Ge, Ke] = y(!1), [z, qe] = y(!1), [Je, Ye] = y(!1), [Xe, Ze] = y(null), Qe = n(a, e.hostId), $e = n(a, e.guestId), et = Qe || $e, tt = r(e), B = e.status === "placement", nt = e.status === "active" || e.status === "won", rt = e.status === "active" && n(a, e.turnId), it = !o || !!e.pending || !!e.pendingEvent, V = rt && !e.pendingShot && !it && !e.error && !Je, H = B && !e.myReady && !it, U = we.includes(e.status) && (e.status !== "closed" || (e.myFleet?.length ?? 0) > 0), W = k === "ready", G = _(() => e.myFleet || [], [e.myFleet]), K = e.incomingShots || Ee, q = e.targetShots || Ee, at = _(() => Ne(G), [G]), ot = _(() => new Set(G.map((e) => e.id)), [G]), st = p.every((e) => ot.has(e.id)), J = p.find((e) => e.id === Ue && !ot.has(e.id)) || p.find((e) => !ot.has(e.id)) || null, ct = _(() => G.map((e) => ({
|
|
321
322
|
...e,
|
|
322
|
-
sunk: !!e.cells?.length && e.cells.every((e) =>
|
|
323
|
-
})), [
|
|
323
|
+
sunk: !!e.cells?.length && e.cells.every((e) => ke(K, e) === "hit")
|
|
324
|
+
})), [G, K]), lt = _(() => (e.sunkEnemyShips || []).filter((e) => e?.cells?.length).map((e) => ({
|
|
324
325
|
...e,
|
|
325
326
|
size: e.size ?? e.cells.length,
|
|
326
327
|
sunk: !0
|
|
327
|
-
})), [e.sunkEnemyShips]), { total: ut, hits: dt } = _(() =>
|
|
328
|
+
})), [e.sunkEnemyShips]), { total: ut, hits: dt } = _(() => Fe(q), [q]), ft = _(() => {
|
|
328
329
|
let e = [];
|
|
329
|
-
return
|
|
330
|
+
return q.forEach((t, n) => t?.forEach((t, r) => {
|
|
330
331
|
t === "hit" && e.push({
|
|
331
332
|
row: n,
|
|
332
333
|
col: r
|
|
333
334
|
});
|
|
334
335
|
})), e;
|
|
335
|
-
}, [
|
|
336
|
-
if (!
|
|
337
|
-
let e = u(
|
|
336
|
+
}, [q]), Y = B ? "own" : Ce, X = F || I, pt = _(() => {
|
|
337
|
+
if (!H || !J || !X) return null;
|
|
338
|
+
let e = u(at, {
|
|
338
339
|
shipId: J.id,
|
|
339
340
|
row: X.row,
|
|
340
341
|
col: X.col,
|
|
341
|
-
orientation:
|
|
342
|
+
orientation: R
|
|
342
343
|
});
|
|
343
344
|
return {
|
|
344
|
-
cells: e.ok ? e.ship.cells :
|
|
345
|
+
cells: e.ok ? e.ship.cells : Pe(X, J.size, R),
|
|
345
346
|
valid: e.ok
|
|
346
347
|
};
|
|
347
348
|
}, [
|
|
348
|
-
|
|
349
|
+
H,
|
|
349
350
|
J,
|
|
350
351
|
X,
|
|
351
|
-
|
|
352
|
-
|
|
352
|
+
at,
|
|
353
|
+
R
|
|
353
354
|
]), mt = h((e, t) => {
|
|
354
355
|
if (e === "target") {
|
|
355
|
-
let e = t ?
|
|
356
|
+
let e = t ? q.map((e, n) => e.map((e, r) => n === t.row && r === t.col ? null : e)) : q;
|
|
356
357
|
return {
|
|
357
358
|
mode: "target",
|
|
358
|
-
ships: t ? lt.map((e) =>
|
|
359
|
+
ships: t ? lt.map((e) => Ae([e], t) ? {
|
|
359
360
|
...e,
|
|
360
361
|
sunk: !1
|
|
361
362
|
} : e) : lt,
|
|
362
363
|
shots: e,
|
|
363
364
|
preview: null,
|
|
364
|
-
interactive:
|
|
365
|
+
interactive: V
|
|
365
366
|
};
|
|
366
367
|
}
|
|
367
|
-
let n = t ?
|
|
368
|
+
let n = t ? K.map((e, n) => e.map((e, r) => n === t.row && r === t.col ? null : e)) : K;
|
|
368
369
|
return {
|
|
369
370
|
mode: "own",
|
|
370
|
-
ships: t ? ct.map((e) =>
|
|
371
|
+
ships: t ? ct.map((e) => Ae([e], t) ? {
|
|
371
372
|
...e,
|
|
372
373
|
sunk: !1
|
|
373
374
|
} : e) : ct,
|
|
374
375
|
shots: n,
|
|
375
|
-
preview:
|
|
376
|
-
interactive:
|
|
376
|
+
preview: B ? pt : null,
|
|
377
|
+
interactive: H
|
|
377
378
|
};
|
|
378
379
|
}, [
|
|
379
|
-
|
|
380
|
+
q,
|
|
380
381
|
lt,
|
|
381
|
-
|
|
382
|
+
K,
|
|
382
383
|
ct,
|
|
383
|
-
z,
|
|
384
|
-
pt,
|
|
385
384
|
B,
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
pt,
|
|
386
|
+
V,
|
|
387
|
+
H
|
|
388
|
+
]), ht = _(() => mt(Y), [mt, Y]), Z = h((e, t = "info") => Ze({
|
|
388
389
|
text: e,
|
|
389
390
|
kind: t,
|
|
390
391
|
id: Date.now()
|
|
391
|
-
}), []), gt = h((e =
|
|
392
|
-
|
|
392
|
+
}), []), gt = h((e = L) => {
|
|
393
|
+
V && M(e) && (ke(q, e) ? Z(`Ya disparaste en ${j(e)}`) : (Ve(null), m.current?.selectCell?.(null), E("ui_click"), N("bsFire", t, {
|
|
393
394
|
row: e.row,
|
|
394
395
|
col: e.col
|
|
395
396
|
})));
|
|
396
397
|
}, [
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
V,
|
|
399
|
+
L,
|
|
400
|
+
q,
|
|
400
401
|
t,
|
|
401
402
|
Z
|
|
402
403
|
]), _t = h((e) => {
|
|
403
|
-
if (!
|
|
404
|
-
let n =
|
|
404
|
+
if (!H || !M(e)) return;
|
|
405
|
+
let n = Ae(G, e);
|
|
405
406
|
if (n) {
|
|
406
|
-
|
|
407
|
+
We(n.id), n.orientation && He(n.orientation), E("ui_click"), N("bsRemoveShip", t, n.id);
|
|
407
408
|
return;
|
|
408
409
|
}
|
|
409
410
|
if (!J) return;
|
|
410
|
-
let r = u(
|
|
411
|
+
let r = u(at, {
|
|
411
412
|
shipId: J.id,
|
|
412
413
|
row: e.row,
|
|
413
414
|
col: e.col,
|
|
414
|
-
orientation:
|
|
415
|
+
orientation: R
|
|
415
416
|
});
|
|
416
|
-
r.ok ? (
|
|
417
|
+
r.ok ? (We(null), E("ship_place"), N("bsPlaceShip", t, {
|
|
417
418
|
shipId: J.id,
|
|
418
419
|
row: e.row,
|
|
419
420
|
col: e.col,
|
|
420
|
-
orientation:
|
|
421
|
+
orientation: R
|
|
421
422
|
})) : Z(r.reason === "overlap" ? "Se superpone con otro barco" : "No cabe en esa posición", "miss");
|
|
422
423
|
}, [
|
|
423
|
-
|
|
424
|
-
|
|
424
|
+
H,
|
|
425
|
+
G,
|
|
425
426
|
J,
|
|
426
|
-
|
|
427
|
-
|
|
427
|
+
at,
|
|
428
|
+
R,
|
|
428
429
|
t,
|
|
429
430
|
Z
|
|
430
431
|
]), vt = h((e) => {
|
|
431
|
-
if (!
|
|
432
|
-
if (
|
|
432
|
+
if (!M(e)) return;
|
|
433
|
+
if (Be(e), B) {
|
|
433
434
|
_t(e);
|
|
434
435
|
return;
|
|
435
436
|
}
|
|
436
|
-
if (Y !== "target" || !
|
|
437
|
-
let t = Date.now(), n =
|
|
438
|
-
|
|
437
|
+
if (Y !== "target" || !V) return;
|
|
438
|
+
let t = Date.now(), n = T.current;
|
|
439
|
+
T.current = {
|
|
439
440
|
cell: e,
|
|
440
441
|
time: t
|
|
441
|
-
},
|
|
442
|
+
}, De(n.cell, e) && t - n.time < Te ? gt(e) : ke(q, e) ? Z(`Ya disparaste en ${j(e)}`) : (Ve(e), m.current?.selectCell?.(e));
|
|
442
443
|
}, [
|
|
443
|
-
|
|
444
|
+
B,
|
|
444
445
|
_t,
|
|
445
446
|
Y,
|
|
446
|
-
|
|
447
|
+
V,
|
|
447
448
|
gt,
|
|
448
|
-
|
|
449
|
+
q,
|
|
449
450
|
Z
|
|
450
451
|
]);
|
|
451
|
-
|
|
452
|
+
D.current = {
|
|
452
453
|
selectCell: vt,
|
|
453
|
-
setHovered:
|
|
454
|
+
setHovered: ze
|
|
454
455
|
}, g(() => {
|
|
455
456
|
let e = f.current;
|
|
456
|
-
if (!
|
|
457
|
+
if (!U || !e) return;
|
|
457
458
|
if (!ee()) {
|
|
458
|
-
|
|
459
|
+
A("fallback");
|
|
459
460
|
return;
|
|
460
461
|
}
|
|
461
462
|
let t = !1, n = null;
|
|
462
|
-
return
|
|
463
|
+
return A("loading"), import("./createBattleScene-L4ZRWDED.js").then(({ createBattleScene: r }) => {
|
|
463
464
|
t || (n = r(e, {
|
|
464
465
|
quality: "auto",
|
|
465
|
-
reducedMotion:
|
|
466
|
+
reducedMotion: Me(),
|
|
466
467
|
onCellHover: (e) => {
|
|
467
|
-
t ||
|
|
468
|
+
t || D.current.setHovered(M(e) ? {
|
|
468
469
|
row: e.row,
|
|
469
470
|
col: e.col
|
|
470
471
|
} : null);
|
|
471
472
|
},
|
|
472
473
|
onCellSelect: (e) => {
|
|
473
|
-
t ||
|
|
474
|
+
t || D.current.selectCell(M(e) ? {
|
|
474
475
|
row: e.row,
|
|
475
476
|
col: e.col
|
|
476
477
|
} : null);
|
|
477
478
|
}
|
|
478
|
-
}), m.current = n,
|
|
479
|
+
}), m.current = n, A("ready"));
|
|
479
480
|
}).catch((e) => {
|
|
480
|
-
t || (console.error("[battleship] No se pudo iniciar la escena", e),
|
|
481
|
+
t || (console.error("[battleship] No se pudo iniciar la escena", e), A("fallback"));
|
|
481
482
|
}), () => {
|
|
482
483
|
t = !0, m.current = null;
|
|
483
484
|
try {
|
|
@@ -486,24 +487,24 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
486
487
|
console.error("[battleship] Error al liberar la escena", e);
|
|
487
488
|
}
|
|
488
489
|
};
|
|
489
|
-
}, [
|
|
490
|
+
}, [U]), g(() => {
|
|
490
491
|
w.preload();
|
|
491
|
-
let e =
|
|
492
|
+
let e = O.current;
|
|
492
493
|
return () => {
|
|
493
494
|
e.forEach(clearTimeout), e.clear();
|
|
494
495
|
};
|
|
495
496
|
}, []);
|
|
496
|
-
let yt =
|
|
497
|
-
g(() => yt ?
|
|
498
|
-
let t =
|
|
499
|
-
|
|
497
|
+
let yt = U && !tt;
|
|
498
|
+
g(() => yt ? _e() : void 0, [yt]), g(() => {
|
|
499
|
+
let t = ve.current;
|
|
500
|
+
ve.current = e.status, t === "placement" && e.status === "active" && ge([{
|
|
500
501
|
name: "sonar_ping",
|
|
501
502
|
at: 0
|
|
502
|
-
}], () => `${e.gameId}:start`,
|
|
503
|
+
}], () => `${e.gameId}:start`, O.current);
|
|
503
504
|
}, [e.status, e.gameId]);
|
|
504
505
|
let Q = e.lastShot;
|
|
505
506
|
g(() => {
|
|
506
|
-
if (!
|
|
507
|
+
if (!W && k !== "fallback") return;
|
|
507
508
|
let t = Q?.eventId ?? null;
|
|
508
509
|
if (C.current === void 0) {
|
|
509
510
|
C.current = t;
|
|
@@ -511,85 +512,85 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
511
512
|
}
|
|
512
513
|
if (!t || t === C.current) return;
|
|
513
514
|
C.current = t;
|
|
514
|
-
let
|
|
515
|
+
let r = !n(Q.by, a), i = {
|
|
515
516
|
row: Q.row,
|
|
516
517
|
col: Q.col
|
|
517
|
-
}, o =
|
|
518
|
+
}, o = j(i), s = typeof Q.sunk == "string" ? Q.sunk : Q.sunk ? Ae(r ? G : e.sunkEnemyShips || [], i)?.id : null, c = r ? Q.sunk ? `Te hundieron el ${Oe(s)}` : Q.result === "hit" ? `El rival impactó en ${o}` : `El rival falló: agua en ${o}` : Q.sunk ? `¡Hundiste el ${Oe(s)}!` : Q.result === "hit" ? `¡Impacto en ${o}!` : `Agua en ${o}`, l = Q.result === "hit" ? "hit" : "miss", u = r ? "own" : "target", d = r && be(G, e.incomingShots, Q), f = Se({
|
|
518
519
|
result: Q.result,
|
|
519
520
|
sunk: !!Q.sunk,
|
|
520
521
|
defeated: !!Q.defeated,
|
|
521
|
-
won: !
|
|
522
|
+
won: !r,
|
|
522
523
|
cruiserAlarm: d
|
|
523
|
-
}), p = (n) => n === "cruiser_damage_alarm" ? `${e.gameId}:cruiser` : n === "victory" || n === "defeat" ? `${e.gameId}:end` : t, ee =
|
|
524
|
-
|
|
524
|
+
}), p = (n) => n === "cruiser_damage_alarm" ? `${e.gameId}:cruiser` : n === "victory" || n === "defeat" ? `${e.gameId}:end` : t, ee = O.current;
|
|
525
|
+
P(u);
|
|
525
526
|
let h = m.current;
|
|
526
527
|
if (!h?.playShot) {
|
|
527
|
-
|
|
528
|
+
ge(f, p, ee), Z(c, l);
|
|
528
529
|
return;
|
|
529
530
|
}
|
|
530
|
-
|
|
531
|
+
ge(xe({ incoming: r }), p, ee), b.current = !0, Ye(!0);
|
|
531
532
|
let g = !1;
|
|
532
533
|
try {
|
|
533
|
-
h.setView(mt(u,
|
|
534
|
+
h.setView(mt(u, i));
|
|
534
535
|
} catch {}
|
|
535
|
-
let te =
|
|
536
|
+
let te = Me() ? 0 : 600;
|
|
536
537
|
return Promise.resolve(h.playShot({
|
|
537
|
-
row:
|
|
538
|
-
col:
|
|
538
|
+
row: i.row,
|
|
539
|
+
col: i.col,
|
|
539
540
|
result: Q.result,
|
|
540
541
|
sunk: !!Q.sunk,
|
|
541
|
-
incoming:
|
|
542
|
-
})).catch(() => {}).then(() => (
|
|
543
|
-
g || (b.current = !1,
|
|
542
|
+
incoming: r
|
|
543
|
+
})).catch(() => {}).then(() => (ge(f, p, ee), g || Z(c, l), new Promise((e) => setTimeout(e, te)))).then(() => {
|
|
544
|
+
g || (b.current = !1, Ye(!1));
|
|
544
545
|
}), () => {
|
|
545
|
-
g = !0, b.current = !1,
|
|
546
|
+
g = !0, b.current = !1, Ye(!1);
|
|
546
547
|
};
|
|
547
548
|
}, [
|
|
548
|
-
|
|
549
|
-
|
|
549
|
+
W,
|
|
550
|
+
k,
|
|
550
551
|
Q?.eventId
|
|
551
552
|
]), g(() => {
|
|
552
|
-
|
|
553
|
+
Je || e.status !== "active" || P(rt ? "target" : "own");
|
|
553
554
|
}, [
|
|
554
|
-
|
|
555
|
+
rt,
|
|
555
556
|
e.status,
|
|
556
|
-
|
|
557
|
+
Je
|
|
557
558
|
]), g(() => {
|
|
558
|
-
|
|
559
|
-
}, [
|
|
560
|
-
if (
|
|
559
|
+
V || Ve(null);
|
|
560
|
+
}, [V]), g(() => {
|
|
561
|
+
if (W && !b.current) try {
|
|
561
562
|
m.current?.setView(ht);
|
|
562
563
|
} catch (e) {
|
|
563
564
|
console.error("[battleship] setView", e);
|
|
564
565
|
}
|
|
565
566
|
}, [
|
|
566
|
-
|
|
567
|
+
W,
|
|
567
568
|
ht,
|
|
568
|
-
|
|
569
|
+
Je
|
|
569
570
|
]), g(() => {
|
|
570
|
-
|
|
571
|
+
W && m.current?.selectCell?.(Y === "target" ? L : null);
|
|
571
572
|
}, [
|
|
572
|
-
|
|
573
|
-
|
|
573
|
+
W,
|
|
574
|
+
L,
|
|
574
575
|
Y
|
|
575
576
|
]), g(() => {
|
|
576
|
-
if (!
|
|
577
|
+
if (!W) return;
|
|
577
578
|
let e = m.current;
|
|
578
|
-
e?.setRadarVisible?.(
|
|
579
|
+
e?.setRadarVisible?.(Ge && Y === "target"), e?.setRadarContacts?.(ft);
|
|
579
580
|
}, [
|
|
580
|
-
|
|
581
|
-
|
|
581
|
+
W,
|
|
582
|
+
Ge,
|
|
582
583
|
Y,
|
|
583
584
|
ft
|
|
584
585
|
]);
|
|
585
586
|
let bt = () => {
|
|
586
|
-
|
|
587
|
+
E("ship_rotate"), He((e) => e === "horizontal" ? "vertical" : "horizontal");
|
|
587
588
|
}, xt = () => {
|
|
588
|
-
st &&
|
|
589
|
+
st && H && (E("ui_click"), N("bsReady", t));
|
|
589
590
|
}, $ = (e) => (...t) => {
|
|
590
|
-
|
|
591
|
+
E("ui_click"), e(...t);
|
|
591
592
|
}, St = () => {
|
|
592
|
-
|
|
593
|
+
E(Ge ? "ui_click" : "sonar_ping"), Ke((e) => !e);
|
|
593
594
|
}, Ct = (e) => {
|
|
594
595
|
if (e.target !== e.currentTarget || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
595
596
|
let t = {
|
|
@@ -600,20 +601,20 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
600
601
|
};
|
|
601
602
|
if (t[e.key]) {
|
|
602
603
|
e.preventDefault();
|
|
603
|
-
let [n, r] = t[e.key], i = (Y === "target" ?
|
|
604
|
+
let [n, r] = t[e.key], i = (Y === "target" ? L : null) || I || F, a = i ? {
|
|
604
605
|
row: Math.min(9, Math.max(0, i.row + n)),
|
|
605
606
|
col: Math.min(9, Math.max(0, i.col + r))
|
|
606
607
|
} : {
|
|
607
608
|
row: 0,
|
|
608
609
|
col: 0
|
|
609
610
|
};
|
|
610
|
-
|
|
611
|
-
} else (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
611
|
+
Be(a), ze(null), Y === "target" && V && (Ve(a), m.current?.selectCell?.(a));
|
|
612
|
+
} else (e.key === "Enter" || e.key === " ") && (e.preventDefault(), B ? _t(I || F) : gt(L || I));
|
|
612
613
|
}, wt = (e) => {
|
|
613
|
-
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(),
|
|
614
|
-
}, Tt = /* @__PURE__ */ x(
|
|
614
|
+
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(), B ? bt() : m.current?.resetCamera?.()) : e.key === "Escape" && z && (e.preventDefault(), e.stopPropagation(), qe(!1)));
|
|
615
|
+
}, Tt = /* @__PURE__ */ x(Le, { game: e }), Et = e.status === "won" && n(a, e.winnerId), Dt = !o && !tt ? "Sin conexión · esperando reconexión" : e.pending ? "Sincronizando…" : s, Ot = lt.length;
|
|
615
616
|
return /* @__PURE__ */ S("section", {
|
|
616
|
-
className: `chat-game-card bs-card${
|
|
617
|
+
className: `chat-game-card bs-card${rt ? " chat-game-card--my-turn" : ""}${c ? ` chat-game-card--${c}` : ""}${z ? " bs-card--expanded" : ""}`,
|
|
617
618
|
"aria-label": "Partida de Batalla Naval",
|
|
618
619
|
onKeyDown: wt,
|
|
619
620
|
children: [
|
|
@@ -632,14 +633,14 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
632
633
|
})] })]
|
|
633
634
|
}),
|
|
634
635
|
c === "panel" && /* @__PURE__ */ x(i, { manager: w }),
|
|
635
|
-
|
|
636
|
+
U && /* @__PURE__ */ x("button", {
|
|
636
637
|
className: "chat-game-close bs-expand",
|
|
637
638
|
type: "button",
|
|
638
|
-
"aria-pressed":
|
|
639
|
-
"aria-label":
|
|
640
|
-
title:
|
|
641
|
-
onClick: $(() =>
|
|
642
|
-
children: x(
|
|
639
|
+
"aria-pressed": z,
|
|
640
|
+
"aria-label": z ? "Reducir tablero" : "Ampliar tablero",
|
|
641
|
+
title: z ? "Reducir (Esc)" : "Ampliar",
|
|
642
|
+
onClick: $(() => qe((e) => !e)),
|
|
643
|
+
children: x(z ? ce : se, {
|
|
643
644
|
size: 15,
|
|
644
645
|
"aria-hidden": "true"
|
|
645
646
|
})
|
|
@@ -650,19 +651,19 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
650
651
|
"aria-label": "Minimizar tablero",
|
|
651
652
|
title: "Minimizar tablero",
|
|
652
653
|
onClick: () => {
|
|
653
|
-
|
|
654
|
+
qe(!1), l();
|
|
654
655
|
},
|
|
655
656
|
children: /* @__PURE__ */ x(ie, {
|
|
656
657
|
size: 16,
|
|
657
658
|
"aria-hidden": "true"
|
|
658
659
|
})
|
|
659
660
|
}),
|
|
660
|
-
|
|
661
|
+
et && !tt && /* @__PURE__ */ x("button", {
|
|
661
662
|
className: "chat-game-close",
|
|
662
663
|
type: "button",
|
|
663
664
|
"aria-label": "Finalizar partida para ambos jugadores",
|
|
664
665
|
title: "Finalizar partida para ambos",
|
|
665
|
-
onClick: () => void
|
|
666
|
+
onClick: () => void N("act", t, "game_end"),
|
|
666
667
|
disabled: !o,
|
|
667
668
|
children: /* @__PURE__ */ x(me, {
|
|
668
669
|
size: 16,
|
|
@@ -692,25 +693,25 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
692
693
|
}),
|
|
693
694
|
e.status === "invited" && /* @__PURE__ */ S("div", {
|
|
694
695
|
className: "bs-invite",
|
|
695
|
-
children: [/* @__PURE__ */ x("p", { children: "Coloca 5 barcos en un tablero de 10×10 y hunde la flota rival por turnos." }),
|
|
696
|
+
children: [/* @__PURE__ */ x("p", { children: "Coloca 5 barcos en un tablero de 10×10 y hunde la flota rival por turnos." }), $e && /* @__PURE__ */ S("div", {
|
|
696
697
|
className: "chat-game-actions",
|
|
697
698
|
children: [/* @__PURE__ */ x("button", {
|
|
698
699
|
type: "button",
|
|
699
700
|
className: "chat-game-action chat-game-action--primary",
|
|
700
|
-
disabled:
|
|
701
|
-
onClick: $(() => void
|
|
701
|
+
disabled: it,
|
|
702
|
+
onClick: $(() => void N("act", t, "game_accept")),
|
|
702
703
|
children: "Aceptar partida"
|
|
703
704
|
}), /* @__PURE__ */ x("button", {
|
|
704
705
|
type: "button",
|
|
705
706
|
className: "chat-game-action",
|
|
706
|
-
disabled:
|
|
707
|
-
onClick: $(() => void
|
|
707
|
+
disabled: it,
|
|
708
|
+
onClick: $(() => void N("act", t, "game_decline")),
|
|
708
709
|
children: "Rechazar"
|
|
709
710
|
})]
|
|
710
711
|
})]
|
|
711
712
|
}),
|
|
712
|
-
|
|
713
|
-
|
|
713
|
+
U && /* @__PURE__ */ S(he, { children: [
|
|
714
|
+
nt && /* @__PURE__ */ S("div", {
|
|
714
715
|
className: "bs-hud",
|
|
715
716
|
role: "toolbar",
|
|
716
717
|
"aria-label": "Vista del tablero",
|
|
@@ -718,16 +719,16 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
718
719
|
className: "bs-segment",
|
|
719
720
|
children: [/* @__PURE__ */ S("button", {
|
|
720
721
|
type: "button",
|
|
721
|
-
"aria-pressed":
|
|
722
|
-
onClick: $(() =>
|
|
722
|
+
"aria-pressed": Ce === "target",
|
|
723
|
+
onClick: $(() => P("target")),
|
|
723
724
|
children: [/* @__PURE__ */ x(ae, {
|
|
724
725
|
size: 14,
|
|
725
726
|
"aria-hidden": "true"
|
|
726
727
|
}), "Objetivo"]
|
|
727
728
|
}), /* @__PURE__ */ S("button", {
|
|
728
729
|
type: "button",
|
|
729
|
-
"aria-pressed":
|
|
730
|
-
onClick: $(() =>
|
|
730
|
+
"aria-pressed": Ce === "own",
|
|
731
|
+
onClick: $(() => P("own")),
|
|
731
732
|
children: [/* @__PURE__ */ x(ne, {
|
|
732
733
|
size: 14,
|
|
733
734
|
"aria-hidden": "true"
|
|
@@ -751,22 +752,22 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
751
752
|
children: [
|
|
752
753
|
/* @__PURE__ */ x("div", {
|
|
753
754
|
ref: f,
|
|
754
|
-
className: `bs-stage${
|
|
755
|
+
className: `bs-stage${k === "fallback" ? " bs-stage--fallback" : ""}`,
|
|
755
756
|
tabIndex: 0,
|
|
756
757
|
role: "application",
|
|
757
|
-
"aria-label":
|
|
758
|
-
"aria-describedby":
|
|
759
|
-
"aria-busy":
|
|
758
|
+
"aria-label": B ? "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.",
|
|
759
|
+
"aria-describedby": ye,
|
|
760
|
+
"aria-busy": k === "loading",
|
|
760
761
|
onKeyDown: Ct,
|
|
761
|
-
children:
|
|
762
|
+
children: k === "fallback" && /* @__PURE__ */ x(Re, {
|
|
762
763
|
view: ht,
|
|
763
|
-
selected: Y === "target" ?
|
|
764
|
-
cursor:
|
|
764
|
+
selected: Y === "target" ? L : null,
|
|
765
|
+
cursor: I,
|
|
765
766
|
onSelect: vt,
|
|
766
|
-
onHover:
|
|
767
|
+
onHover: ze
|
|
767
768
|
})
|
|
768
769
|
}),
|
|
769
|
-
|
|
770
|
+
k === "loading" && /* @__PURE__ */ S("div", {
|
|
770
771
|
className: "bs-stage-state",
|
|
771
772
|
role: "status",
|
|
772
773
|
children: [/* @__PURE__ */ x(pe, {
|
|
@@ -774,7 +775,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
774
775
|
"aria-hidden": "true"
|
|
775
776
|
}), " Preparando el océano…"]
|
|
776
777
|
}),
|
|
777
|
-
|
|
778
|
+
k === "fallback" && /* @__PURE__ */ S("p", {
|
|
778
779
|
className: "bs-fallback-note",
|
|
779
780
|
children: [/* @__PURE__ */ x(fe, {
|
|
780
781
|
size: 12,
|
|
@@ -784,45 +785,45 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
784
785
|
/* @__PURE__ */ x("div", {
|
|
785
786
|
className: "bs-cell-chip",
|
|
786
787
|
"aria-hidden": "true",
|
|
787
|
-
children:
|
|
788
|
+
children: j(B ? X : Y === "target" && L || F)
|
|
788
789
|
}),
|
|
789
790
|
/* @__PURE__ */ x("div", {
|
|
790
791
|
className: "bs-live",
|
|
791
792
|
"aria-live": "polite",
|
|
792
793
|
"aria-atomic": "true",
|
|
793
|
-
children:
|
|
794
|
-
className: `bs-toast bs-toast--${
|
|
795
|
-
children:
|
|
796
|
-
},
|
|
794
|
+
children: Xe && /* @__PURE__ */ x("span", {
|
|
795
|
+
className: `bs-toast bs-toast--${Xe.kind}`,
|
|
796
|
+
children: Xe.text
|
|
797
|
+
}, Xe.id)
|
|
797
798
|
})
|
|
798
799
|
]
|
|
799
800
|
}),
|
|
800
801
|
/* @__PURE__ */ x("p", {
|
|
801
|
-
id:
|
|
802
|
+
id: ye,
|
|
802
803
|
className: "bs-hint",
|
|
803
|
-
children:
|
|
804
|
+
children: B ? "Clic para colocar · clic en un barco para quitarlo · R para rotar" : "Arrastra para rotar · doble clic o Enter para disparar"
|
|
804
805
|
}),
|
|
805
|
-
|
|
806
|
+
B && /* @__PURE__ */ S("div", {
|
|
806
807
|
className: "bs-placement",
|
|
807
808
|
children: [
|
|
808
809
|
/* @__PURE__ */ x("ul", {
|
|
809
810
|
className: "bs-fleet",
|
|
810
811
|
"aria-label": "Tu flota",
|
|
811
812
|
children: p.map((e) => {
|
|
812
|
-
let n =
|
|
813
|
+
let n = ot.has(e.id), r = J?.id === e.id;
|
|
813
814
|
return /* @__PURE__ */ x("li", { children: /* @__PURE__ */ S("button", {
|
|
814
815
|
type: "button",
|
|
815
816
|
className: `bs-ship${n ? " is-placed" : ""}${r ? " is-active" : ""}`,
|
|
816
817
|
"aria-pressed": r,
|
|
817
|
-
disabled: !
|
|
818
|
+
disabled: !H,
|
|
818
819
|
title: n ? "Quitar y volver a colocar" : "Seleccionar barco",
|
|
819
820
|
onClick: $(() => {
|
|
820
|
-
n &&
|
|
821
|
+
n && N("bsRemoveShip", t, e.id), We(e.id);
|
|
821
822
|
}),
|
|
822
823
|
children: [
|
|
823
824
|
/* @__PURE__ */ x("span", {
|
|
824
825
|
className: "bs-ship__name",
|
|
825
|
-
children:
|
|
826
|
+
children: je(Oe(e.id))
|
|
826
827
|
}),
|
|
827
828
|
/* @__PURE__ */ x("span", {
|
|
828
829
|
className: "bs-ship__pips",
|
|
@@ -843,20 +844,20 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
843
844
|
/* @__PURE__ */ S("button", {
|
|
844
845
|
type: "button",
|
|
845
846
|
className: "chat-game-action bs-btn",
|
|
846
|
-
disabled: !
|
|
847
|
+
disabled: !H,
|
|
847
848
|
onClick: bt,
|
|
848
849
|
title: "Rotar (R)",
|
|
849
850
|
children: [/* @__PURE__ */ x(ue, {
|
|
850
851
|
size: 15,
|
|
851
852
|
"aria-hidden": "true"
|
|
852
|
-
}),
|
|
853
|
+
}), R === "horizontal" ? "Horizontal" : "Vertical"]
|
|
853
854
|
}),
|
|
854
855
|
/* @__PURE__ */ S("button", {
|
|
855
856
|
type: "button",
|
|
856
857
|
className: "chat-game-action bs-btn",
|
|
857
|
-
disabled: !
|
|
858
|
+
disabled: !H,
|
|
858
859
|
onClick: () => {
|
|
859
|
-
|
|
860
|
+
E("ship_place"), N("bsRandomFleet", t);
|
|
860
861
|
},
|
|
861
862
|
children: [/* @__PURE__ */ x(de, {
|
|
862
863
|
size: 15,
|
|
@@ -866,12 +867,12 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
866
867
|
/* @__PURE__ */ S("button", {
|
|
867
868
|
type: "button",
|
|
868
869
|
className: "chat-game-action chat-game-action--primary bs-btn",
|
|
869
|
-
disabled: !
|
|
870
|
+
disabled: !H || !st,
|
|
870
871
|
onClick: xt,
|
|
871
872
|
children: [/* @__PURE__ */ x(re, {
|
|
872
873
|
size: 15,
|
|
873
874
|
"aria-hidden": "true"
|
|
874
|
-
}), e.myReady ? "Flota lista" : `Listo (${
|
|
875
|
+
}), e.myReady ? "Flota lista" : `Listo (${ot.size}/${p.length})`]
|
|
875
876
|
})
|
|
876
877
|
]
|
|
877
878
|
}),
|
|
@@ -881,29 +882,29 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
881
882
|
})
|
|
882
883
|
]
|
|
883
884
|
}),
|
|
884
|
-
|
|
885
|
+
nt && /* @__PURE__ */ S("div", {
|
|
885
886
|
className: "chat-game-actions bs-actions",
|
|
886
887
|
children: [
|
|
887
888
|
/* @__PURE__ */ S("button", {
|
|
888
889
|
type: "button",
|
|
889
890
|
className: "chat-game-action chat-game-action--primary bs-btn bs-btn--fire",
|
|
890
|
-
disabled: !
|
|
891
|
+
disabled: !V || !L || Y !== "target",
|
|
891
892
|
onClick: () => gt(),
|
|
892
|
-
title:
|
|
893
|
+
title: L ? `Disparar en ${j(L)} (Enter)` : "Selecciona una casilla",
|
|
893
894
|
children: [
|
|
894
895
|
/* @__PURE__ */ x(ae, {
|
|
895
896
|
size: 15,
|
|
896
897
|
"aria-hidden": "true"
|
|
897
898
|
}),
|
|
898
899
|
"Disparar",
|
|
899
|
-
|
|
900
|
+
L ? ` · ${j(L)}` : ""
|
|
900
901
|
]
|
|
901
902
|
}),
|
|
902
903
|
/* @__PURE__ */ S("button", {
|
|
903
904
|
type: "button",
|
|
904
905
|
className: "chat-game-action bs-btn",
|
|
905
|
-
"aria-pressed":
|
|
906
|
-
disabled: Y !== "target" || !
|
|
906
|
+
"aria-pressed": Ge,
|
|
907
|
+
disabled: Y !== "target" || !W,
|
|
907
908
|
onClick: St,
|
|
908
909
|
title: "Radar de impactos",
|
|
909
910
|
children: [/* @__PURE__ */ x(le, {
|
|
@@ -914,7 +915,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
914
915
|
/* @__PURE__ */ S("button", {
|
|
915
916
|
type: "button",
|
|
916
917
|
className: "chat-game-action bs-btn",
|
|
917
|
-
disabled: !
|
|
918
|
+
disabled: !W,
|
|
918
919
|
onClick: $(() => m.current?.resetCamera?.()),
|
|
919
920
|
title: "Centrar cámara (R)",
|
|
920
921
|
children: [/* @__PURE__ */ x(oe, {
|
|
@@ -928,11 +929,11 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
928
929
|
]
|
|
929
930
|
})
|
|
930
931
|
] }),
|
|
931
|
-
e.status === "conflict" &&
|
|
932
|
+
e.status === "conflict" && et && /* @__PURE__ */ x(Ie, {
|
|
932
933
|
sync: e.sync,
|
|
933
934
|
connected: o,
|
|
934
|
-
onResync: () => void
|
|
935
|
-
onAdoptOffer: () => void
|
|
935
|
+
onResync: () => void N("requestResync", t),
|
|
936
|
+
onAdoptOffer: () => void N("adoptResyncOffer", t)
|
|
936
937
|
}),
|
|
937
938
|
e.error && /* @__PURE__ */ S("div", {
|
|
938
939
|
className: "chat-game-error",
|
|
@@ -941,18 +942,18 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
941
942
|
type: "button",
|
|
942
943
|
className: "chat-game-action",
|
|
943
944
|
disabled: !o || e.pending,
|
|
944
|
-
onClick: () => void
|
|
945
|
+
onClick: () => void N("retry", t),
|
|
945
946
|
children: "Reintentar"
|
|
946
947
|
})]
|
|
947
948
|
}),
|
|
948
949
|
/* @__PURE__ */ x("footer", {
|
|
949
950
|
className: "chat-game-footer",
|
|
950
|
-
children:
|
|
951
|
+
children: tt ? "Puedes seguir conversando o invitar a otra partida." : "Hunde los 5 barcos rivales. El chat sigue disponible."
|
|
951
952
|
})
|
|
952
953
|
]
|
|
953
954
|
});
|
|
954
955
|
}
|
|
955
|
-
var
|
|
956
|
-
export {
|
|
956
|
+
var I = m(F);
|
|
957
|
+
export { I as default };
|
|
957
958
|
|
|
958
|
-
//# sourceMappingURL=BattleshipGameCard-
|
|
959
|
+
//# sourceMappingURL=BattleshipGameCard-CAWHxqJE.js.map
|