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