@minicode-dev/chat 0.1.6 → 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/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-BFqA0cjT.js} +67 -65
- package/dist/chunks/{BattleshipGameCard-S-UdM6rn.js.map → BattleshipGameCard-BFqA0cjT.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-dty_KPDX.js +90 -0
- package/dist/chunks/ChatContext-dty_KPDX.js.map +1 -0
- 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/{battleship-DXKuIZ1I.js → board-DXKuIZ1I.js} +1 -1
- package/dist/chunks/board-DXKuIZ1I.js.map +1 -0
- package/dist/chunks/connect4Sounds-BN7d_TM2.js +3235 -0
- package/dist/chunks/connect4Sounds-BN7d_TM2.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/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 +2404 -2427
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +63 -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
package/README.md
CHANGED
|
@@ -296,3 +296,28 @@ effect can replace the animation currently playing. Confetti fills the panel wit
|
|
|
296
296
|
Browsers can still block sound before the recipient interacts with the site; the visual
|
|
297
297
|
effect does not depend on successful audio playback. Both participants must use an updated
|
|
298
298
|
package, and explicitly saved `autoPlay: false` settings still disable automatic playback.
|
|
299
|
+
|
|
300
|
+
## Tanques LIVE 3D (preview)
|
|
301
|
+
|
|
302
|
+
This fourth game is independent of turn-based Tanks, Connect 4 and Battleship. Enable it explicitly:
|
|
303
|
+
|
|
304
|
+
```js
|
|
305
|
+
const config = {
|
|
306
|
+
features: { games: { tanksLive: true } },
|
|
307
|
+
// Optional: supply runtime STUN/TURN settings from your application.
|
|
308
|
+
webrtc: { iceServers, iceTransportPolicy: 'all' },
|
|
309
|
+
};
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Omit `webrtc` to use the existing default STUN servers. Never ship permanent TURN credentials.
|
|
313
|
+
Both players need a compatible package version and a browser with WebRTC. Invitations and
|
|
314
|
+
acceptance use the chat transport; movement and combat use DataChannels. The inviting player
|
|
315
|
+
resolves damage. Three.js loads dynamically, with a Canvas 2D fallback. Shared game mute and
|
|
316
|
+
volume settings apply to the existing tank sounds.
|
|
317
|
+
|
|
318
|
+
For a local two-player test, run `npm run dev -- --host` and open
|
|
319
|
+
`/tanks-live-lab.html?user=ana` and `/tanks-live-lab.html?user=luis` before inviting.
|
|
320
|
+
Use WASD/arrows, mouse and click/space on desktop, or the joystick, arena touch aiming and fire
|
|
321
|
+
button on mobile. Minimize preserves the match; reload/reopening the chat is not a persisted
|
|
322
|
+
match recovery flow. Wi-Fi versus cellular connectivity and runtime TURN still require real-device
|
|
323
|
+
validation.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,14 +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";
|
|
4
|
+
import "../index.js";
|
|
3
5
|
import { t as ee } from "./webglSupport-2WjPEPZ_.js";
|
|
4
6
|
import { memo as m, useCallback as h, useEffect as g, useId as te, useMemo as _, useRef as v, useState as y } from "react";
|
|
5
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";
|
|
6
8
|
import { Fragment as he, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
7
9
|
// src/games/battleship/sound/battleshipSounds.js
|
|
8
|
-
var C = "ocean_ambient_loop", w =
|
|
10
|
+
var C = "ocean_ambient_loop", w = e({
|
|
9
11
|
id: "battleship",
|
|
10
|
-
baseUrl: () =>
|
|
11
|
-
settingsFrom:
|
|
12
|
+
baseUrl: () => r("battleship_audio_pack/assets"),
|
|
13
|
+
settingsFrom: i,
|
|
12
14
|
sounds: Object.fromEntries([
|
|
13
15
|
"cannon_fire",
|
|
14
16
|
"projectile_flyby",
|
|
@@ -126,13 +128,13 @@ var k = "ABCDEFGHIJ", we = {
|
|
|
126
128
|
"won",
|
|
127
129
|
"conflict",
|
|
128
130
|
"closed"
|
|
129
|
-
], 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 = (
|
|
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(() => {});
|
|
130
132
|
function Pe(e) {
|
|
131
|
-
let t =
|
|
133
|
+
let t = o();
|
|
132
134
|
for (let n of e || []) {
|
|
133
135
|
let e = n.cells?.[0];
|
|
134
136
|
if (!e) continue;
|
|
135
|
-
let r =
|
|
137
|
+
let r = s(t, {
|
|
136
138
|
shipId: n.id,
|
|
137
139
|
row: e.row,
|
|
138
140
|
col: e.col,
|
|
@@ -184,7 +186,7 @@ function Le({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
|
184
186
|
});
|
|
185
187
|
}
|
|
186
188
|
function Re({ game: e }) {
|
|
187
|
-
let t =
|
|
189
|
+
let t = d(e);
|
|
188
190
|
return t ? /* @__PURE__ */ S("span", {
|
|
189
191
|
className: `bs-badge bs-badge--${e.verification}`,
|
|
190
192
|
children: [
|
|
@@ -249,12 +251,12 @@ function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
249
251
|
});
|
|
250
252
|
}
|
|
251
253
|
function N({ game: e, currentUserId: t, status: n }) {
|
|
252
|
-
let { total:
|
|
254
|
+
let { total: r, hits: i } = Ie(e.targetShots), a = e.sunkEnemyShips?.length || 0, o = [
|
|
253
255
|
"active",
|
|
254
256
|
"won",
|
|
255
257
|
"closed",
|
|
256
258
|
"conflict"
|
|
257
|
-
].includes(e.status) &&
|
|
259
|
+
].includes(e.status) && r > 0, s = e.status === "won" && f(t, e.winnerId);
|
|
258
260
|
return /* @__PURE__ */ S("section", {
|
|
259
261
|
className: "chat-game-card chat-game-card--history bs-card bs-card--history",
|
|
260
262
|
"aria-label": "Partida de Batalla Naval",
|
|
@@ -274,50 +276,50 @@ function N({ game: e, currentUserId: t, status: n }) {
|
|
|
274
276
|
})
|
|
275
277
|
}),
|
|
276
278
|
/* @__PURE__ */ x("p", {
|
|
277
|
-
className: `chat-game-status${
|
|
279
|
+
className: `chat-game-status${s ? " bs-status--win" : ""}`,
|
|
278
280
|
children: n
|
|
279
281
|
}),
|
|
280
|
-
|
|
282
|
+
o && /* @__PURE__ */ S("p", {
|
|
281
283
|
className: "bs-history-stats",
|
|
282
284
|
children: [
|
|
283
285
|
"Disparos ",
|
|
284
|
-
|
|
286
|
+
r,
|
|
285
287
|
" · Impactos ",
|
|
286
|
-
|
|
288
|
+
i,
|
|
287
289
|
" · Hundidos ",
|
|
288
|
-
|
|
290
|
+
a,
|
|
289
291
|
"/",
|
|
290
|
-
|
|
292
|
+
c.length
|
|
291
293
|
]
|
|
292
294
|
}),
|
|
293
295
|
/* @__PURE__ */ x(Re, { game: e })
|
|
294
296
|
]
|
|
295
297
|
});
|
|
296
298
|
}
|
|
297
|
-
function P({ gameKey:
|
|
298
|
-
let
|
|
299
|
-
if (!
|
|
300
|
-
let
|
|
301
|
-
return
|
|
302
|
-
game:
|
|
303
|
-
currentUserId:
|
|
304
|
-
status:
|
|
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,
|
|
305
|
+
currentUserId: n,
|
|
306
|
+
status: c
|
|
305
307
|
}) : /* @__PURE__ */ x(Be, {
|
|
306
|
-
game:
|
|
307
|
-
gameKey:
|
|
308
|
-
currentUserId:
|
|
309
|
-
connected:
|
|
310
|
-
status:
|
|
311
|
-
variant:
|
|
312
|
-
onMinimize:
|
|
313
|
-
onDismiss:
|
|
308
|
+
game: o,
|
|
309
|
+
gameKey: e,
|
|
310
|
+
currentUserId: n,
|
|
311
|
+
connected: s,
|
|
312
|
+
status: c,
|
|
313
|
+
variant: r,
|
|
314
|
+
onMinimize: i,
|
|
315
|
+
onDismiss: a
|
|
314
316
|
});
|
|
315
317
|
}
|
|
316
|
-
function Be({ game: e, gameKey: t, currentUserId:
|
|
317
|
-
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({
|
|
318
320
|
cell: null,
|
|
319
321
|
time: 0
|
|
320
|
-
}), 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 = r
|
|
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) => ({
|
|
321
323
|
...e,
|
|
322
324
|
sunk: !!e.cells?.length && e.cells.every((e) => Ae(G, e) === "hit")
|
|
323
325
|
})), [W, G]), lt = _(() => (e.sunkEnemyShips || []).filter((e) => e?.cells?.length).map((e) => ({
|
|
@@ -334,7 +336,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
334
336
|
})), e;
|
|
335
337
|
}, [K]), Y = z ? "own" : we, X = P || F, pt = _(() => {
|
|
336
338
|
if (!V || !J || !X) return null;
|
|
337
|
-
let e =
|
|
339
|
+
let e = a(ot, {
|
|
338
340
|
shipId: J.id,
|
|
339
341
|
row: X.row,
|
|
340
342
|
col: X.col,
|
|
@@ -407,7 +409,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
407
409
|
return;
|
|
408
410
|
}
|
|
409
411
|
if (!J) return;
|
|
410
|
-
let r =
|
|
412
|
+
let r = a(ot, {
|
|
411
413
|
shipId: J.id,
|
|
412
414
|
row: e.row,
|
|
413
415
|
col: e.col,
|
|
@@ -452,14 +454,14 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
452
454
|
selectCell: vt,
|
|
453
455
|
setHovered: Be
|
|
454
456
|
}, g(() => {
|
|
455
|
-
let e =
|
|
457
|
+
let e = p.current;
|
|
456
458
|
if (!H || !e) return;
|
|
457
459
|
if (!ee()) {
|
|
458
460
|
k("fallback");
|
|
459
461
|
return;
|
|
460
462
|
}
|
|
461
463
|
let t = !1, n = null;
|
|
462
|
-
return k("loading"), import("./createBattleScene-
|
|
464
|
+
return k("loading"), import("./createBattleScene-L4ZRWDED.js").then(({ createBattleScene: r }) => {
|
|
463
465
|
t || (n = r(e, {
|
|
464
466
|
quality: "auto",
|
|
465
467
|
reducedMotion: Ne(),
|
|
@@ -511,35 +513,35 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
511
513
|
}
|
|
512
514
|
if (!t || t === C.current) return;
|
|
513
515
|
C.current = t;
|
|
514
|
-
let
|
|
516
|
+
let n = !f(Q.by, r), i = {
|
|
515
517
|
row: Q.row,
|
|
516
518
|
col: Q.col
|
|
517
|
-
},
|
|
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({
|
|
518
520
|
result: Q.result,
|
|
519
521
|
sunk: !!Q.sunk,
|
|
520
522
|
defeated: !!Q.defeated,
|
|
521
|
-
won: !
|
|
522
|
-
cruiserAlarm:
|
|
523
|
+
won: !n,
|
|
524
|
+
cruiserAlarm: u
|
|
523
525
|
}), p = (n) => n === "cruiser_damage_alarm" ? `${e.gameId}:cruiser` : n === "victory" || n === "defeat" ? `${e.gameId}:end` : t, ee = D.current;
|
|
524
|
-
N(
|
|
526
|
+
N(l);
|
|
525
527
|
let h = m.current;
|
|
526
528
|
if (!h?.playShot) {
|
|
527
|
-
_e(
|
|
529
|
+
_e(d, p, ee), Z(s, c);
|
|
528
530
|
return;
|
|
529
531
|
}
|
|
530
|
-
_e(Se({ incoming:
|
|
532
|
+
_e(Se({ incoming: n }), p, ee), b.current = !0, Xe(!0);
|
|
531
533
|
let g = !1;
|
|
532
534
|
try {
|
|
533
|
-
h.setView(mt(
|
|
535
|
+
h.setView(mt(l, i));
|
|
534
536
|
} catch {}
|
|
535
537
|
let te = Ne() ? 0 : 600;
|
|
536
538
|
return Promise.resolve(h.playShot({
|
|
537
|
-
row:
|
|
538
|
-
col:
|
|
539
|
+
row: i.row,
|
|
540
|
+
col: i.col,
|
|
539
541
|
result: Q.result,
|
|
540
542
|
sunk: !!Q.sunk,
|
|
541
|
-
incoming:
|
|
542
|
-
})).catch(() => {}).then(() => (_e(
|
|
543
|
+
incoming: n
|
|
544
|
+
})).catch(() => {}).then(() => (_e(d, p, ee), g || Z(s, c), new Promise((e) => setTimeout(e, te)))).then(() => {
|
|
543
545
|
g || (b.current = !1, Xe(!1));
|
|
544
546
|
}), () => {
|
|
545
547
|
g = !0, b.current = !1, Xe(!1);
|
|
@@ -611,9 +613,9 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
611
613
|
} else (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z ? _t(F || P) : gt(I || F));
|
|
612
614
|
}, wt = (e) => {
|
|
613
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)));
|
|
614
|
-
}, Tt = /* @__PURE__ */ x(Re, { game: e }), Et = e.status === "won" && r
|
|
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;
|
|
615
617
|
return /* @__PURE__ */ S("section", {
|
|
616
|
-
className: `chat-game-card bs-card${it ? " chat-game-card--my-turn" : ""}${
|
|
618
|
+
className: `chat-game-card bs-card${it ? " chat-game-card--my-turn" : ""}${s ? ` chat-game-card--${s}` : ""}${R ? " bs-card--expanded" : ""}`,
|
|
617
619
|
"aria-label": "Partida de Batalla Naval",
|
|
618
620
|
onKeyDown: wt,
|
|
619
621
|
children: [
|
|
@@ -631,7 +633,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
631
633
|
className: "bs-title-icon"
|
|
632
634
|
})] })]
|
|
633
635
|
}),
|
|
634
|
-
|
|
636
|
+
s === "panel" && /* @__PURE__ */ x(n, { manager: w }),
|
|
635
637
|
H && /* @__PURE__ */ x("button", {
|
|
636
638
|
className: "chat-game-close bs-expand",
|
|
637
639
|
type: "button",
|
|
@@ -644,13 +646,13 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
644
646
|
"aria-hidden": "true"
|
|
645
647
|
})
|
|
646
648
|
}),
|
|
647
|
-
|
|
649
|
+
u && /* @__PURE__ */ x("button", {
|
|
648
650
|
className: "chat-game-close",
|
|
649
651
|
type: "button",
|
|
650
652
|
"aria-label": "Minimizar tablero",
|
|
651
653
|
title: "Minimizar tablero",
|
|
652
654
|
onClick: () => {
|
|
653
|
-
Je(!1),
|
|
655
|
+
Je(!1), u();
|
|
654
656
|
},
|
|
655
657
|
children: /* @__PURE__ */ x(ie, {
|
|
656
658
|
size: 16,
|
|
@@ -663,7 +665,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
663
665
|
"aria-label": "Finalizar partida para ambos jugadores",
|
|
664
666
|
title: "Finalizar partida para ambos",
|
|
665
667
|
onClick: () => void M("act", t, "game_end"),
|
|
666
|
-
disabled: !
|
|
668
|
+
disabled: !i,
|
|
667
669
|
children: /* @__PURE__ */ x(me, {
|
|
668
670
|
size: 16,
|
|
669
671
|
"aria-hidden": "true"
|
|
@@ -741,7 +743,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
741
743
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("dt", { children: "Hundidos" }), /* @__PURE__ */ S("dd", { children: [
|
|
742
744
|
Ot,
|
|
743
745
|
"/",
|
|
744
|
-
|
|
746
|
+
c.length
|
|
745
747
|
] })] })
|
|
746
748
|
]
|
|
747
749
|
})]
|
|
@@ -750,7 +752,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
750
752
|
className: "bs-stage-wrap",
|
|
751
753
|
children: [
|
|
752
754
|
/* @__PURE__ */ x("div", {
|
|
753
|
-
ref:
|
|
755
|
+
ref: p,
|
|
754
756
|
className: `bs-stage${O === "fallback" ? " bs-stage--fallback" : ""}`,
|
|
755
757
|
tabIndex: 0,
|
|
756
758
|
role: "application",
|
|
@@ -808,7 +810,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
808
810
|
/* @__PURE__ */ x("ul", {
|
|
809
811
|
className: "bs-fleet",
|
|
810
812
|
"aria-label": "Tu flota",
|
|
811
|
-
children:
|
|
813
|
+
children: c.map((e) => {
|
|
812
814
|
let n = q.has(e.id), r = J?.id === e.id;
|
|
813
815
|
return /* @__PURE__ */ x("li", { children: /* @__PURE__ */ S("button", {
|
|
814
816
|
type: "button",
|
|
@@ -871,7 +873,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
871
873
|
children: [/* @__PURE__ */ x(re, {
|
|
872
874
|
size: 15,
|
|
873
875
|
"aria-hidden": "true"
|
|
874
|
-
}), e.myReady ? "Flota lista" : `Listo (${q.size}/${
|
|
876
|
+
}), e.myReady ? "Flota lista" : `Listo (${q.size}/${c.length})`]
|
|
875
877
|
})
|
|
876
878
|
]
|
|
877
879
|
}),
|
|
@@ -930,7 +932,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
930
932
|
] }),
|
|
931
933
|
e.status === "conflict" && tt && /* @__PURE__ */ x(Le, {
|
|
932
934
|
sync: e.sync,
|
|
933
|
-
connected:
|
|
935
|
+
connected: i,
|
|
934
936
|
onResync: () => void M("requestResync", t),
|
|
935
937
|
onAdoptOffer: () => void M("adoptResyncOffer", t)
|
|
936
938
|
}),
|
|
@@ -940,7 +942,7 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
940
942
|
children: [/* @__PURE__ */ x("span", { children: e.error }), e.pendingEvent && /* @__PURE__ */ x("button", {
|
|
941
943
|
type: "button",
|
|
942
944
|
className: "chat-game-action",
|
|
943
|
-
disabled: !
|
|
945
|
+
disabled: !i || e.pending,
|
|
944
946
|
onClick: () => void M("retry", t),
|
|
945
947
|
children: "Reintentar"
|
|
946
948
|
})]
|
|
@@ -955,4 +957,4 @@ function Be({ game: e, gameKey: t, currentUserId: n, connected: o, status: s, va
|
|
|
955
957
|
var F = m(P);
|
|
956
958
|
export { F as default };
|
|
957
959
|
|
|
958
|
-
//# sourceMappingURL=BattleshipGameCard-
|
|
960
|
+
//# sourceMappingURL=BattleshipGameCard-BFqA0cjT.js.map
|