@minicode-dev/chat 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +2 -0
- package/dist/chunks/{BattleshipGameCard-8H-sBCsv.js → BattleshipGameCard-DwNzgH5G.js} +199 -199
- package/dist/chunks/{BattleshipGameCard-8H-sBCsv.js.map → BattleshipGameCard-DwNzgH5G.js.map} +1 -1
- package/dist/chunks/{BattleshipPrototype-CmQd5AUO.js → BattleshipPrototype-CSQxQJt5.js} +52 -52
- package/dist/chunks/{BattleshipPrototype-CmQd5AUO.js.map → BattleshipPrototype-CSQxQJt5.js.map} +1 -1
- package/dist/chunks/{ChatContext-CVW58bzC.js → ChatContext-D5rqvt5D.js} +2 -2
- package/dist/chunks/{ChatContext-CVW58bzC.js.map → ChatContext-D5rqvt5D.js.map} +1 -1
- package/dist/chunks/RacingLiveGameCard-_wvhDRlG.js +1873 -0
- package/dist/chunks/RacingLiveGameCard-_wvhDRlG.js.map +1 -0
- package/dist/chunks/{TanksGameCard-DnCufSH6.js → TanksGameCard-B-gtDYYg.js} +137 -137
- package/dist/chunks/{TanksGameCard-DnCufSH6.js.map → TanksGameCard-B-gtDYYg.js.map} +1 -1
- package/dist/chunks/{TanksLiveGameCard-D_27Jomp.js → TanksLiveGameCard-DXgd1J2Y.js} +392 -392
- package/dist/chunks/{TanksLiveGameCard-D_27Jomp.js.map → TanksLiveGameCard-DXgd1J2Y.js.map} +1 -1
- package/dist/chunks/{avalancheScene3d-CIE2WKQn.js → avalancheScene3d-CNbQyGUd.js} +2 -2
- package/dist/chunks/{avalancheScene3d-CIE2WKQn.js.map → avalancheScene3d-CNbQyGUd.js.map} +1 -1
- package/dist/chunks/{connect4Sounds-BqEHULjv.js → connect4Sounds-3a6h7gUC.js} +8 -8
- package/dist/chunks/{connect4Sounds-BqEHULjv.js.map → connect4Sounds-3a6h7gUC.js.map} +1 -1
- package/dist/chunks/createLiveScene-jrzyQogh.js +756 -0
- package/dist/chunks/{createLiveScene-MTGRv8rx.js.map → createLiveScene-jrzyQogh.js.map} +1 -1
- package/dist/chunks/createRaceScene-C-aw0dlX.js +291 -0
- package/dist/chunks/createRaceScene-C-aw0dlX.js.map +1 -0
- package/dist/chunks/{createTankScene-yhX6la27.js → createTankScene-6asWHKFf.js} +123 -125
- package/dist/chunks/{createTankScene-yhX6la27.js.map → createTankScene-6asWHKFf.js.map} +1 -1
- package/dist/chunks/fx-BNJvJYOu.js +871 -0
- package/dist/chunks/fx-BNJvJYOu.js.map +1 -0
- package/dist/chunks/{games-Bl_8raG6.js → games-D_9SiSBT.js} +708 -697
- package/dist/chunks/games-D_9SiSBT.js.map +1 -0
- package/dist/chunks/tank-DIn6Jyt8.js +605 -0
- package/dist/chunks/tank-DIn6Jyt8.js.map +1 -0
- package/dist/chunks/{tanks-live-BcKmrhnV.js → tanks-live-BRhYW4MG.js} +36 -36
- package/dist/chunks/{tanks-live-BcKmrhnV.js.map → tanks-live-BRhYW4MG.js.map} +1 -1
- package/dist/chunks/{tanksSounds-DTnidbiq.js → tanksSounds-tYPzje61.js} +4 -4
- package/dist/chunks/{tanksSounds-DTnidbiq.js.map → tanksSounds-tYPzje61.js.map} +1 -1
- package/dist/chunks/track-C1TWWT19.js +557 -0
- package/dist/chunks/track-C1TWWT19.js.map +1 -0
- package/dist/index.js +4236 -4020
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/index.d.ts +3 -1
- package/package.json +1 -1
- package/dist/chunks/RacingLiveGameCard-8j9QLnxW.js +0 -1654
- package/dist/chunks/RacingLiveGameCard-8j9QLnxW.js.map +0 -1
- package/dist/chunks/createLiveScene-MTGRv8rx.js +0 -758
- package/dist/chunks/createRaceScene-BiEtQsVs.js +0 -306
- package/dist/chunks/createRaceScene-BiEtQsVs.js.map +0 -1
- package/dist/chunks/decor-CyyCnmct.js +0 -418
- package/dist/chunks/decor-CyyCnmct.js.map +0 -1
- package/dist/chunks/fx-1ZwzmPWj.js +0 -458
- package/dist/chunks/fx-1ZwzmPWj.js.map +0 -1
- package/dist/chunks/games-Bl_8raG6.js.map +0 -1
- package/dist/chunks/rolldown-runtime-CGnMp29N.js +0 -10
- package/dist/chunks/tank-DjEQ4FXF.js +0 -553
- package/dist/chunks/tank-DjEQ4FXF.js.map +0 -1
- package/dist/chunks/track-BcnnpnAm.js +0 -259
- package/dist/chunks/track-BcnnpnAm.js.map +0 -1
- package/dist/chunks/util-DwI9bfS7.js +0 -57
- package/dist/chunks/util-DwI9bfS7.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as e, t } from "./games-
|
|
1
|
+
import { a as e, t } from "./games-D_9SiSBT.js";
|
|
2
2
|
import { l as n, n as r, s as i, t as a } from "./board-DXKuIZ1I.js";
|
|
3
3
|
import { r as o } from "./connectionStore-DwgIUl30.js";
|
|
4
4
|
import { c as s, i as c, l, t as u } from "./gameStatus-BChd29yI.js";
|
|
5
|
-
import { a as d, o as f, t as p } from "./connect4Sounds-
|
|
5
|
+
import { a as d, o as f, t as p } from "./connect4Sounds-3a6h7gUC.js";
|
|
6
6
|
import "../index.js";
|
|
7
7
|
import { t as ee } from "./webglSupport-2WjPEPZ_.js";
|
|
8
8
|
import { memo as m, useCallback as h, useEffect as g, useId as te, useMemo as _, useRef as v, useState as y } from "react";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { Fragment as ne, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
10
|
+
import { Anchor as re, Check as ie, ChevronDown as ae, Crosshair as oe, LocateFixed as se, Maximize2 as ce, Minimize2 as le, Radar as ue, RotateCw as de, ShieldCheck as S, Shuffle as fe, TriangleAlert as pe, Waves as me, X as he } from "lucide-react";
|
|
11
11
|
// src/games/battleship/sound/battleshipSounds.js
|
|
12
12
|
var C = "ocean_ambient_loop", w = d({
|
|
13
13
|
id: "battleship",
|
|
@@ -45,14 +45,14 @@ var C = "ocean_ambient_loop", w = d({
|
|
|
45
45
|
defeat: .4,
|
|
46
46
|
[C]: .22
|
|
47
47
|
}
|
|
48
|
-
}),
|
|
49
|
-
function
|
|
50
|
-
|
|
48
|
+
}), ge = () => typeof document < "u" && document.hidden;
|
|
49
|
+
function T(e) {
|
|
50
|
+
ge() || w.play(e);
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function _e(e, t, n) {
|
|
53
53
|
e.forEach(({ name: e, at: r }) => {
|
|
54
54
|
let i = () => {
|
|
55
|
-
|
|
55
|
+
ge() || w.play(e, { key: t(e) });
|
|
56
56
|
};
|
|
57
57
|
if (r <= 0) {
|
|
58
58
|
i();
|
|
@@ -64,26 +64,26 @@ function ge(e, t, n) {
|
|
|
64
64
|
n.add(a);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
var
|
|
68
|
-
|
|
67
|
+
var E = 0, D = () => {
|
|
68
|
+
E > 0 && !ge() ? w.startLoop(C) : w.stopLoop(C);
|
|
69
69
|
};
|
|
70
|
-
function
|
|
71
|
-
|
|
70
|
+
function ve() {
|
|
71
|
+
E += 1, E === 1 && document.addEventListener("visibilitychange", D), D();
|
|
72
72
|
let e = !1;
|
|
73
73
|
return () => {
|
|
74
|
-
e || (e = !0, --
|
|
74
|
+
e || (e = !0, --E, E === 0 && document.removeEventListener("visibilitychange", D), D());
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
// src/games/battleship/sound/cues.js
|
|
78
|
-
var
|
|
79
|
-
function
|
|
78
|
+
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;
|
|
79
|
+
function xe(e, t, n) {
|
|
80
80
|
if (n?.result !== "hit") return !1;
|
|
81
|
-
let r = (e || []).find((e) => e.id ===
|
|
82
|
-
if (!r?.cells?.some((e) =>
|
|
83
|
-
let i =
|
|
81
|
+
let r = (e || []).find((e) => e.id === ye);
|
|
82
|
+
if (!r?.cells?.some((e) => be(e, n))) return !1;
|
|
83
|
+
let i = O(r, t, n), a = O(r, t);
|
|
84
84
|
return i < 2 && a >= 2;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function Se({ incoming: e }) {
|
|
87
87
|
return e ? [{
|
|
88
88
|
name: "projectile_flyby",
|
|
89
89
|
at: 0
|
|
@@ -95,7 +95,7 @@ function xe({ incoming: e }) {
|
|
|
95
95
|
at: 180
|
|
96
96
|
}];
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function Ce({ result: e, sunk: t, defeated: n, won: r, cruiserAlarm: i }) {
|
|
99
99
|
let a = e === "hit" ? t ? [{
|
|
100
100
|
name: "ship_heavy_hit",
|
|
101
101
|
at: 0
|
|
@@ -118,20 +118,20 @@ function Se({ result: e, sunk: t, defeated: n, won: r, cruiserAlarm: i }) {
|
|
|
118
118
|
}), a;
|
|
119
119
|
}
|
|
120
120
|
// src/games/battleship/BattleshipGameCard.jsx
|
|
121
|
-
var
|
|
121
|
+
var k = "ABCDEFGHIJ", we = {
|
|
122
122
|
carrier: "portaaviones",
|
|
123
123
|
battleship: "acorazado",
|
|
124
124
|
cruiser: "crucero",
|
|
125
125
|
submarine: "submarino",
|
|
126
126
|
destroyer: "destructor"
|
|
127
|
-
},
|
|
127
|
+
}, Te = [
|
|
128
128
|
"placement",
|
|
129
129
|
"active",
|
|
130
130
|
"won",
|
|
131
131
|
"conflict",
|
|
132
132
|
"closed"
|
|
133
|
-
],
|
|
134
|
-
function
|
|
133
|
+
], 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 = (t, ...n) => Promise.resolve().then(() => e.getState()[t]?.(...n)).catch(() => {});
|
|
134
|
+
function Pe(e) {
|
|
135
135
|
let t = r();
|
|
136
136
|
for (let n of e || []) {
|
|
137
137
|
let e = n.cells?.[0];
|
|
@@ -146,13 +146,13 @@ function Ne(e) {
|
|
|
146
146
|
}
|
|
147
147
|
return t;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function Fe(e, t, n) {
|
|
150
150
|
return Array.from({ length: t }, (t, r) => ({
|
|
151
151
|
row: e.row + (n === "vertical" ? r : 0),
|
|
152
152
|
col: e.col + (n === "horizontal" ? r : 0)
|
|
153
|
-
})).filter(
|
|
153
|
+
})).filter(j);
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Ie(e) {
|
|
156
156
|
let t = 0, n = 0;
|
|
157
157
|
for (let r of e || []) for (let e of r || []) e && (t += 1), e === "hit" && (n += 1);
|
|
158
158
|
return {
|
|
@@ -160,24 +160,24 @@ function Fe(e) {
|
|
|
160
160
|
hits: n
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
return e?.status === "requesting" ? /* @__PURE__ */
|
|
163
|
+
function Le({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
164
|
+
return e?.status === "requesting" ? /* @__PURE__ */ b("div", {
|
|
165
165
|
className: "chat-game-sync",
|
|
166
166
|
role: "status",
|
|
167
167
|
children: "Sincronizando partida…"
|
|
168
|
-
}) : /* @__PURE__ */
|
|
168
|
+
}) : /* @__PURE__ */ x("div", {
|
|
169
169
|
className: "chat-game-sync",
|
|
170
170
|
role: "alert",
|
|
171
171
|
children: [
|
|
172
|
-
e?.message && /* @__PURE__ */
|
|
173
|
-
e?.status === "incompatible" && e.offer && /* @__PURE__ */
|
|
172
|
+
e?.message && /* @__PURE__ */ b("span", { children: e.message }),
|
|
173
|
+
e?.status === "incompatible" && e.offer && /* @__PURE__ */ b("button", {
|
|
174
174
|
type: "button",
|
|
175
175
|
className: "chat-game-action chat-game-action--primary",
|
|
176
176
|
disabled: !t,
|
|
177
177
|
onClick: r,
|
|
178
178
|
children: "Usar estado del anfitrión"
|
|
179
179
|
}),
|
|
180
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ b("button", {
|
|
181
181
|
type: "button",
|
|
182
182
|
className: "chat-game-action",
|
|
183
183
|
disabled: !t,
|
|
@@ -187,16 +187,16 @@ function Ie({ sync: e, connected: t, onResync: n, onAdoptOffer: r }) {
|
|
|
187
187
|
]
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function Re({ game: e }) {
|
|
191
191
|
let t = c(e);
|
|
192
|
-
return t ? /* @__PURE__ */
|
|
192
|
+
return t ? /* @__PURE__ */ x("span", {
|
|
193
193
|
className: `bs-badge bs-badge--${e.verification}`,
|
|
194
194
|
children: [
|
|
195
|
-
e.verification === "ok" && /* @__PURE__ */
|
|
195
|
+
e.verification === "ok" && /* @__PURE__ */ b(S, {
|
|
196
196
|
size: 12,
|
|
197
197
|
"aria-hidden": "true"
|
|
198
198
|
}),
|
|
199
|
-
e.verification === "mismatch" && /* @__PURE__ */
|
|
199
|
+
e.verification === "mismatch" && /* @__PURE__ */ b(pe, {
|
|
200
200
|
size: 12,
|
|
201
201
|
"aria-hidden": "true"
|
|
202
202
|
}),
|
|
@@ -204,16 +204,16 @@ function Le({ game: e }) {
|
|
|
204
204
|
]
|
|
205
205
|
}) : null;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function ze({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
208
208
|
let a = /* @__PURE__ */ new Map();
|
|
209
209
|
e.ships.forEach((e) => e.cells.forEach((t) => a.set(`${t.row}-${t.col}`, e)));
|
|
210
210
|
let o = new Set((e.preview?.cells || []).map((e) => `${e.row}-${e.col}`));
|
|
211
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ b("div", {
|
|
212
212
|
className: "bs-grid",
|
|
213
213
|
role: "grid",
|
|
214
214
|
"aria-label": e.mode === "target" ? "Tablero objetivo" : "Mi flota",
|
|
215
215
|
onMouseLeave: () => i(null),
|
|
216
|
-
children: Array.from({ length: 10 }, (s, c) => /* @__PURE__ */
|
|
216
|
+
children: Array.from({ length: 10 }, (s, c) => /* @__PURE__ */ b("div", {
|
|
217
217
|
role: "row",
|
|
218
218
|
className: "bs-grid__row",
|
|
219
219
|
children: Array.from({ length: 10 }, (s, l) => {
|
|
@@ -223,22 +223,22 @@ function Re({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
223
223
|
d?.sunk && "is-sunk",
|
|
224
224
|
f && `is-${f}`,
|
|
225
225
|
o.has(u) && (e.preview.valid ? "is-preview" : "is-invalid"),
|
|
226
|
-
|
|
226
|
+
Oe(t, {
|
|
227
227
|
row: c,
|
|
228
228
|
col: l
|
|
229
229
|
}) && "is-selected",
|
|
230
|
-
|
|
230
|
+
Oe(n, {
|
|
231
231
|
row: c,
|
|
232
232
|
col: l
|
|
233
233
|
}) && "is-cursor"
|
|
234
234
|
].filter(Boolean).join(" ");
|
|
235
|
-
return /* @__PURE__ */
|
|
235
|
+
return /* @__PURE__ */ b("button", {
|
|
236
236
|
type: "button",
|
|
237
237
|
role: "gridcell",
|
|
238
238
|
tabIndex: -1,
|
|
239
239
|
className: p,
|
|
240
240
|
disabled: !e.interactive,
|
|
241
|
-
"aria-label": `${
|
|
241
|
+
"aria-label": `${k[c]}${l + 1}${f === "hit" ? ", impacto" : f === "miss" ? ", agua" : ""}${d ? ", barco" : ""}`,
|
|
242
242
|
onMouseEnter: () => i({
|
|
243
243
|
row: c,
|
|
244
244
|
col: l
|
|
@@ -252,36 +252,36 @@ function Re({ view: e, selected: t, cursor: n, onSelect: r, onHover: i }) {
|
|
|
252
252
|
}, c))
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
let { total: r, hits: i } =
|
|
255
|
+
function N({ game: e, currentUserId: t, status: n }) {
|
|
256
|
+
let { total: r, hits: i } = Ie(e.targetShots), o = e.sunkEnemyShips?.length || 0, s = [
|
|
257
257
|
"active",
|
|
258
258
|
"won",
|
|
259
259
|
"closed",
|
|
260
260
|
"conflict"
|
|
261
261
|
].includes(e.status) && r > 0, c = e.status === "won" && l(t, e.winnerId);
|
|
262
|
-
return /* @__PURE__ */
|
|
262
|
+
return /* @__PURE__ */ x("section", {
|
|
263
263
|
className: "chat-game-card chat-game-card--history bs-card bs-card--history",
|
|
264
264
|
"aria-label": "Partida de Batalla Naval",
|
|
265
265
|
children: [
|
|
266
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ b("header", {
|
|
267
267
|
className: "chat-game-header",
|
|
268
|
-
children: /* @__PURE__ */
|
|
268
|
+
children: /* @__PURE__ */ x("div", {
|
|
269
269
|
className: "chat-game-heading",
|
|
270
|
-
children: [/* @__PURE__ */
|
|
270
|
+
children: [/* @__PURE__ */ b("span", {
|
|
271
271
|
className: "chat-game-eyebrow",
|
|
272
272
|
children: "MINIJUEGOS · 2 JUGADORES"
|
|
273
|
-
}), /* @__PURE__ */
|
|
273
|
+
}), /* @__PURE__ */ x("h3", { children: ["Batalla Naval ", /* @__PURE__ */ b(re, {
|
|
274
274
|
size: 13,
|
|
275
275
|
"aria-hidden": "true",
|
|
276
276
|
className: "bs-title-icon"
|
|
277
277
|
})] })]
|
|
278
278
|
})
|
|
279
279
|
}),
|
|
280
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ b("p", {
|
|
281
281
|
className: `chat-game-status${c ? " bs-status--win" : ""}`,
|
|
282
282
|
children: n
|
|
283
283
|
}),
|
|
284
|
-
s && /* @__PURE__ */
|
|
284
|
+
s && /* @__PURE__ */ x("p", {
|
|
285
285
|
className: "bs-history-stats",
|
|
286
286
|
children: [
|
|
287
287
|
"Disparos ",
|
|
@@ -294,19 +294,19 @@ function P({ game: e, currentUserId: t, status: n }) {
|
|
|
294
294
|
a.length
|
|
295
295
|
]
|
|
296
296
|
}),
|
|
297
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ b(Re, { game: e })
|
|
298
298
|
]
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function P({ gameKey: t, currentUserId: n, variant: r = "panel", onMinimize: i, onDismiss: a }) {
|
|
302
302
|
let s = e((e) => e.games[t]), c = o() === "connected";
|
|
303
303
|
if (!s) return null;
|
|
304
304
|
let l = u(s, n);
|
|
305
|
-
return r === "history" ? /* @__PURE__ */
|
|
305
|
+
return r === "history" ? /* @__PURE__ */ b(N, {
|
|
306
306
|
game: s,
|
|
307
307
|
currentUserId: n,
|
|
308
308
|
status: l
|
|
309
|
-
}) : /* @__PURE__ */
|
|
309
|
+
}) : /* @__PURE__ */ b(Be, {
|
|
310
310
|
game: s,
|
|
311
311
|
gameKey: t,
|
|
312
312
|
currentUserId: n,
|
|
@@ -318,17 +318,17 @@ function ze({ gameKey: t, currentUserId: n, variant: r = "panel", onMinimize: i,
|
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
320
|
function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, variant: c, onMinimize: u, onDismiss: d }) {
|
|
321
|
-
let p = v(null), m = v(null),
|
|
321
|
+
let p = v(null), m = v(null), S = v(!1), C = v(void 0), ge = v({
|
|
322
322
|
cell: null,
|
|
323
323
|
time: 0
|
|
324
|
-
}),
|
|
324
|
+
}), 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 = l(r, e.hostId), et = l(r, e.guestId), tt = $e || et, nt = s(e), z = e.status === "placement", rt = e.status === "active" || e.status === "won", it = e.status === "active" && l(r, e.turnId), at = !i || !!e.pending || !!e.pendingEvent, B = it && !e.pendingShot && !at && !e.error && !Ye, V = z && !e.myReady && !at, H = 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 = a.every((e) => q.has(e.id)), J = a.find((e) => e.id === We && !q.has(e.id)) || a.find((e) => !q.has(e.id)) || null, ct = _(() => W.map((e) => ({
|
|
325
325
|
...e,
|
|
326
|
-
sunk: !!e.cells?.length && e.cells.every((e) =>
|
|
326
|
+
sunk: !!e.cells?.length && e.cells.every((e) => Ae(G, e) === "hit")
|
|
327
327
|
})), [W, G]), lt = _(() => (e.sunkEnemyShips || []).filter((e) => e?.cells?.length).map((e) => ({
|
|
328
328
|
...e,
|
|
329
329
|
size: e.size ?? e.cells.length,
|
|
330
330
|
sunk: !0
|
|
331
|
-
})), [e.sunkEnemyShips]), { total: ut, hits: dt } = _(() =>
|
|
331
|
+
})), [e.sunkEnemyShips]), { total: ut, hits: dt } = _(() => Ie(K), [K]), ft = _(() => {
|
|
332
332
|
let e = [];
|
|
333
333
|
return K.forEach((t, n) => t?.forEach((t, r) => {
|
|
334
334
|
t === "hit" && e.push({
|
|
@@ -336,7 +336,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
336
336
|
col: r
|
|
337
337
|
});
|
|
338
338
|
})), e;
|
|
339
|
-
}, [K]), Y = z ? "own" :
|
|
339
|
+
}, [K]), Y = z ? "own" : we, X = P || F, pt = _(() => {
|
|
340
340
|
if (!V || !J || !X) return null;
|
|
341
341
|
let e = n(ot, {
|
|
342
342
|
shipId: J.id,
|
|
@@ -345,7 +345,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
345
345
|
orientation: L
|
|
346
346
|
});
|
|
347
347
|
return {
|
|
348
|
-
cells: e.ok ? e.ship.cells :
|
|
348
|
+
cells: e.ok ? e.ship.cells : Fe(X, J.size, L),
|
|
349
349
|
valid: e.ok
|
|
350
350
|
};
|
|
351
351
|
}, [
|
|
@@ -359,7 +359,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
359
359
|
let e = t ? K.map((e, n) => e.map((e, r) => n === t.row && r === t.col ? null : e)) : K;
|
|
360
360
|
return {
|
|
361
361
|
mode: "target",
|
|
362
|
-
ships: t ? lt.map((e) =>
|
|
362
|
+
ships: t ? lt.map((e) => je([e], t) ? {
|
|
363
363
|
...e,
|
|
364
364
|
sunk: !1
|
|
365
365
|
} : e) : lt,
|
|
@@ -371,7 +371,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
371
371
|
let n = t ? G.map((e, n) => e.map((e, r) => n === t.row && r === t.col ? null : e)) : G;
|
|
372
372
|
return {
|
|
373
373
|
mode: "own",
|
|
374
|
-
ships: t ? ct.map((e) =>
|
|
374
|
+
ships: t ? ct.map((e) => je([e], t) ? {
|
|
375
375
|
...e,
|
|
376
376
|
sunk: !1
|
|
377
377
|
} : e) : ct,
|
|
@@ -393,7 +393,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
393
393
|
kind: t,
|
|
394
394
|
id: Date.now()
|
|
395
395
|
}), []), gt = h((e = I) => {
|
|
396
|
-
B &&
|
|
396
|
+
B && j(e) && (Ae(K, e) ? Z(`Ya disparaste en ${A(e)}`) : (He(null), m.current?.selectCell?.(null), T("ui_click"), M("bsFire", t, {
|
|
397
397
|
row: e.row,
|
|
398
398
|
col: e.col
|
|
399
399
|
})));
|
|
@@ -404,10 +404,10 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
404
404
|
t,
|
|
405
405
|
Z
|
|
406
406
|
]), _t = h((e) => {
|
|
407
|
-
if (!V || !
|
|
408
|
-
let r =
|
|
407
|
+
if (!V || !j(e)) return;
|
|
408
|
+
let r = je(W, e);
|
|
409
409
|
if (r) {
|
|
410
|
-
Ge(r.id), r.orientation && Ue(r.orientation),
|
|
410
|
+
Ge(r.id), r.orientation && Ue(r.orientation), T("ui_click"), M("bsRemoveShip", t, r.id);
|
|
411
411
|
return;
|
|
412
412
|
}
|
|
413
413
|
if (!J) return;
|
|
@@ -417,7 +417,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
417
417
|
col: e.col,
|
|
418
418
|
orientation: L
|
|
419
419
|
});
|
|
420
|
-
i.ok ? (Ge(null),
|
|
420
|
+
i.ok ? (Ge(null), T("ship_place"), M("bsPlaceShip", t, {
|
|
421
421
|
shipId: J.id,
|
|
422
422
|
row: e.row,
|
|
423
423
|
col: e.col,
|
|
@@ -432,17 +432,17 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
432
432
|
t,
|
|
433
433
|
Z
|
|
434
434
|
]), vt = h((e) => {
|
|
435
|
-
if (!
|
|
435
|
+
if (!j(e)) return;
|
|
436
436
|
if (Ve(e), z) {
|
|
437
437
|
_t(e);
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
if (Y !== "target" || !B) return;
|
|
441
|
-
let t = Date.now(), n =
|
|
442
|
-
|
|
441
|
+
let t = Date.now(), n = ge.current;
|
|
442
|
+
ge.current = {
|
|
443
443
|
cell: e,
|
|
444
444
|
time: t
|
|
445
|
-
},
|
|
445
|
+
}, 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));
|
|
446
446
|
}, [
|
|
447
447
|
z,
|
|
448
448
|
_t,
|
|
@@ -452,36 +452,36 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
452
452
|
K,
|
|
453
453
|
Z
|
|
454
454
|
]);
|
|
455
|
-
|
|
455
|
+
E.current = {
|
|
456
456
|
selectCell: vt,
|
|
457
457
|
setHovered: Be
|
|
458
458
|
}, g(() => {
|
|
459
459
|
let e = p.current;
|
|
460
460
|
if (!H || !e) return;
|
|
461
461
|
if (!ee()) {
|
|
462
|
-
|
|
462
|
+
k("fallback");
|
|
463
463
|
return;
|
|
464
464
|
}
|
|
465
465
|
let t = !1, n = null;
|
|
466
|
-
return
|
|
466
|
+
return k("loading"), import("./createBattleScene-L4ZRWDED.js").then(({ createBattleScene: r }) => {
|
|
467
467
|
t || (n = r(e, {
|
|
468
468
|
quality: "auto",
|
|
469
|
-
reducedMotion:
|
|
469
|
+
reducedMotion: Ne(),
|
|
470
470
|
onCellHover: (e) => {
|
|
471
|
-
t ||
|
|
471
|
+
t || E.current.setHovered(j(e) ? {
|
|
472
472
|
row: e.row,
|
|
473
473
|
col: e.col
|
|
474
474
|
} : null);
|
|
475
475
|
},
|
|
476
476
|
onCellSelect: (e) => {
|
|
477
|
-
t ||
|
|
477
|
+
t || E.current.selectCell(j(e) ? {
|
|
478
478
|
row: e.row,
|
|
479
479
|
col: e.col
|
|
480
480
|
} : null);
|
|
481
481
|
}
|
|
482
|
-
}), m.current = n,
|
|
482
|
+
}), m.current = n, k("ready"));
|
|
483
483
|
}).catch((e) => {
|
|
484
|
-
t || (console.error("[battleship] No se pudo iniciar la escena", e),
|
|
484
|
+
t || (console.error("[battleship] No se pudo iniciar la escena", e), k("fallback"));
|
|
485
485
|
}), () => {
|
|
486
486
|
t = !0, m.current = null;
|
|
487
487
|
try {
|
|
@@ -492,22 +492,22 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
492
492
|
};
|
|
493
493
|
}, [H]), g(() => {
|
|
494
494
|
w.preload();
|
|
495
|
-
let e =
|
|
495
|
+
let e = D.current;
|
|
496
496
|
return () => {
|
|
497
497
|
e.forEach(clearTimeout), e.clear();
|
|
498
498
|
};
|
|
499
499
|
}, []);
|
|
500
500
|
let yt = H && !nt;
|
|
501
|
-
g(() => yt ?
|
|
502
|
-
let t =
|
|
503
|
-
|
|
501
|
+
g(() => yt ? ve() : void 0, [yt]), g(() => {
|
|
502
|
+
let t = ye.current;
|
|
503
|
+
ye.current = e.status, t === "placement" && e.status === "active" && _e([{
|
|
504
504
|
name: "sonar_ping",
|
|
505
505
|
at: 0
|
|
506
|
-
}], () => `${e.gameId}:start`,
|
|
506
|
+
}], () => `${e.gameId}:start`, D.current);
|
|
507
507
|
}, [e.status, e.gameId]);
|
|
508
508
|
let Q = e.lastShot;
|
|
509
509
|
g(() => {
|
|
510
|
-
if (!U &&
|
|
510
|
+
if (!U && O !== "fallback") return;
|
|
511
511
|
let t = Q?.eventId ?? null;
|
|
512
512
|
if (C.current === void 0) {
|
|
513
513
|
C.current = t;
|
|
@@ -518,42 +518,42 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
518
518
|
let n = !l(Q.by, r), i = {
|
|
519
519
|
row: Q.row,
|
|
520
520
|
col: Q.col
|
|
521
|
-
}, a =
|
|
521
|
+
}, 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", u = n ? "own" : "target", d = n && xe(W, e.incomingShots, Q), f = Ce({
|
|
522
522
|
result: Q.result,
|
|
523
523
|
sunk: !!Q.sunk,
|
|
524
524
|
defeated: !!Q.defeated,
|
|
525
525
|
won: !n,
|
|
526
526
|
cruiserAlarm: d
|
|
527
|
-
}), p = (n) => n === "cruiser_damage_alarm" ? `${e.gameId}:cruiser` : n === "victory" || n === "defeat" ? `${e.gameId}:end` : t, ee =
|
|
528
|
-
|
|
527
|
+
}), p = (n) => n === "cruiser_damage_alarm" ? `${e.gameId}:cruiser` : n === "victory" || n === "defeat" ? `${e.gameId}:end` : t, ee = D.current;
|
|
528
|
+
N(u);
|
|
529
529
|
let h = m.current;
|
|
530
530
|
if (!h?.playShot) {
|
|
531
|
-
|
|
531
|
+
_e(f, p, ee), Z(s, c);
|
|
532
532
|
return;
|
|
533
533
|
}
|
|
534
|
-
|
|
534
|
+
_e(Se({ incoming: n }), p, ee), S.current = !0, Xe(!0);
|
|
535
535
|
let g = !1;
|
|
536
536
|
try {
|
|
537
537
|
h.setView(mt(u, i));
|
|
538
538
|
} catch {}
|
|
539
|
-
let te =
|
|
539
|
+
let te = Ne() ? 0 : 600;
|
|
540
540
|
return Promise.resolve(h.playShot({
|
|
541
541
|
row: i.row,
|
|
542
542
|
col: i.col,
|
|
543
543
|
result: Q.result,
|
|
544
544
|
sunk: !!Q.sunk,
|
|
545
545
|
incoming: n
|
|
546
|
-
})).catch(() => {}).then(() => (
|
|
547
|
-
g || (
|
|
546
|
+
})).catch(() => {}).then(() => (_e(f, p, ee), g || Z(s, c), new Promise((e) => setTimeout(e, te)))).then(() => {
|
|
547
|
+
g || (S.current = !1, Xe(!1));
|
|
548
548
|
}), () => {
|
|
549
|
-
g = !0,
|
|
549
|
+
g = !0, S.current = !1, Xe(!1);
|
|
550
550
|
};
|
|
551
551
|
}, [
|
|
552
552
|
U,
|
|
553
|
-
|
|
553
|
+
O,
|
|
554
554
|
Q?.eventId
|
|
555
555
|
]), g(() => {
|
|
556
|
-
Ye || e.status !== "active" ||
|
|
556
|
+
Ye || e.status !== "active" || N(it ? "target" : "own");
|
|
557
557
|
}, [
|
|
558
558
|
it,
|
|
559
559
|
e.status,
|
|
@@ -561,7 +561,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
561
561
|
]), g(() => {
|
|
562
562
|
B || He(null);
|
|
563
563
|
}, [B]), g(() => {
|
|
564
|
-
if (U && !
|
|
564
|
+
if (U && !S.current) try {
|
|
565
565
|
m.current?.setView(ht);
|
|
566
566
|
} catch (e) {
|
|
567
567
|
console.error("[battleship] setView", e);
|
|
@@ -587,13 +587,13 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
587
587
|
ft
|
|
588
588
|
]);
|
|
589
589
|
let bt = () => {
|
|
590
|
-
|
|
590
|
+
T("ship_rotate"), Ue((e) => e === "horizontal" ? "vertical" : "horizontal");
|
|
591
591
|
}, xt = () => {
|
|
592
|
-
st && V && (
|
|
592
|
+
st && V && (T("ui_click"), M("bsReady", t));
|
|
593
593
|
}, $ = (e) => (...t) => {
|
|
594
|
-
|
|
594
|
+
T("ui_click"), e(...t);
|
|
595
595
|
}, St = () => {
|
|
596
|
-
|
|
596
|
+
T(Ke ? "ui_click" : "sonar_ping"), qe((e) => !e);
|
|
597
597
|
}, Ct = (e) => {
|
|
598
598
|
if (e.target !== e.currentTarget || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
599
599
|
let t = {
|
|
@@ -604,7 +604,7 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
604
604
|
};
|
|
605
605
|
if (t[e.key]) {
|
|
606
606
|
e.preventDefault();
|
|
607
|
-
let [n, r] = t[e.key], i = (Y === "target" ? I : null) || F ||
|
|
607
|
+
let [n, r] = t[e.key], i = (Y === "target" ? I : null) || F || P, a = i ? {
|
|
608
608
|
row: Math.min(9, Math.max(0, i.row + n)),
|
|
609
609
|
col: Math.min(9, Math.max(0, i.col + r))
|
|
610
610
|
} : {
|
|
@@ -612,43 +612,43 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
612
612
|
col: 0
|
|
613
613
|
};
|
|
614
614
|
Ve(a), Be(null), Y === "target" && B && (He(a), m.current?.selectCell?.(a));
|
|
615
|
-
} else (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z ? _t(F ||
|
|
615
|
+
} else (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z ? _t(F || P) : gt(I || F));
|
|
616
616
|
}, wt = (e) => {
|
|
617
617
|
e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || /^(INPUT|TEXTAREA|SELECT)$/.test(e.target.tagName) || e.target.isContentEditable || (e.key === "r" || e.key === "R" ? (e.preventDefault(), z ? bt() : m.current?.resetCamera?.()) : e.key === "Escape" && R && (e.preventDefault(), e.stopPropagation(), Je(!1)));
|
|
618
|
-
}, Tt = /* @__PURE__ */
|
|
619
|
-
return /* @__PURE__ */
|
|
618
|
+
}, Tt = /* @__PURE__ */ b(Re, { game: e }), Et = e.status === "won" && l(r, e.winnerId), Dt = !i && !nt ? "Sin conexión · esperando reconexión" : e.pending ? "Sincronizando…" : o, Ot = lt.length;
|
|
619
|
+
return /* @__PURE__ */ x("section", {
|
|
620
620
|
className: `chat-game-card bs-card${it ? " chat-game-card--my-turn" : ""}${c ? ` chat-game-card--${c}` : ""}${R ? " bs-card--expanded" : ""}`,
|
|
621
621
|
"aria-label": "Partida de Batalla Naval",
|
|
622
622
|
onKeyDown: wt,
|
|
623
623
|
children: [
|
|
624
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ x("header", {
|
|
625
625
|
className: "chat-game-header",
|
|
626
626
|
children: [
|
|
627
|
-
/* @__PURE__ */
|
|
627
|
+
/* @__PURE__ */ x("div", {
|
|
628
628
|
className: "chat-game-heading",
|
|
629
|
-
children: [/* @__PURE__ */
|
|
629
|
+
children: [/* @__PURE__ */ b("span", {
|
|
630
630
|
className: "chat-game-eyebrow",
|
|
631
631
|
children: "MINIJUEGOS · 2 JUGADORES"
|
|
632
|
-
}), /* @__PURE__ */
|
|
632
|
+
}), /* @__PURE__ */ x("h3", { children: ["Batalla Naval ", /* @__PURE__ */ b(re, {
|
|
633
633
|
size: 13,
|
|
634
634
|
"aria-hidden": "true",
|
|
635
635
|
className: "bs-title-icon"
|
|
636
636
|
})] })]
|
|
637
637
|
}),
|
|
638
|
-
c === "panel" && /* @__PURE__ */
|
|
639
|
-
H && /* @__PURE__ */
|
|
638
|
+
c === "panel" && /* @__PURE__ */ b(f, { manager: w }),
|
|
639
|
+
H && /* @__PURE__ */ b("button", {
|
|
640
640
|
className: "chat-game-close bs-expand",
|
|
641
641
|
type: "button",
|
|
642
642
|
"aria-pressed": R,
|
|
643
643
|
"aria-label": R ? "Reducir tablero" : "Ampliar tablero",
|
|
644
644
|
title: R ? "Reducir (Esc)" : "Ampliar",
|
|
645
645
|
onClick: $(() => Je((e) => !e)),
|
|
646
|
-
children:
|
|
646
|
+
children: b(R ? le : ce, {
|
|
647
647
|
size: 15,
|
|
648
648
|
"aria-hidden": "true"
|
|
649
649
|
})
|
|
650
650
|
}),
|
|
651
|
-
u && /* @__PURE__ */
|
|
651
|
+
u && /* @__PURE__ */ b("button", {
|
|
652
652
|
className: "chat-game-close",
|
|
653
653
|
type: "button",
|
|
654
654
|
"aria-label": "Minimizar tablero",
|
|
@@ -656,93 +656,93 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
656
656
|
onClick: () => {
|
|
657
657
|
Je(!1), u();
|
|
658
658
|
},
|
|
659
|
-
children: /* @__PURE__ */
|
|
659
|
+
children: /* @__PURE__ */ b(ae, {
|
|
660
660
|
size: 16,
|
|
661
661
|
"aria-hidden": "true"
|
|
662
662
|
})
|
|
663
663
|
}),
|
|
664
|
-
tt && !nt && /* @__PURE__ */
|
|
664
|
+
tt && !nt && /* @__PURE__ */ b("button", {
|
|
665
665
|
className: "chat-game-close",
|
|
666
666
|
type: "button",
|
|
667
667
|
"aria-label": "Finalizar partida para ambos jugadores",
|
|
668
668
|
title: "Finalizar partida para ambos",
|
|
669
|
-
onClick: () => void
|
|
669
|
+
onClick: () => void M("act", t, "game_end"),
|
|
670
670
|
disabled: !i,
|
|
671
|
-
children: /* @__PURE__ */
|
|
671
|
+
children: /* @__PURE__ */ b(he, {
|
|
672
672
|
size: 16,
|
|
673
673
|
"aria-hidden": "true"
|
|
674
674
|
})
|
|
675
675
|
}),
|
|
676
|
-
d && /* @__PURE__ */
|
|
676
|
+
d && /* @__PURE__ */ b("button", {
|
|
677
677
|
className: "chat-game-close",
|
|
678
678
|
type: "button",
|
|
679
679
|
"aria-label": "Cerrar tablero y volver al chat",
|
|
680
680
|
title: "Cerrar tablero",
|
|
681
681
|
onClick: d,
|
|
682
|
-
children: /* @__PURE__ */
|
|
682
|
+
children: /* @__PURE__ */ b(he, {
|
|
683
683
|
size: 16,
|
|
684
684
|
"aria-hidden": "true"
|
|
685
685
|
})
|
|
686
686
|
})
|
|
687
687
|
]
|
|
688
688
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ x("div", {
|
|
690
690
|
className: "bs-statusline",
|
|
691
|
-
children: [/* @__PURE__ */
|
|
691
|
+
children: [/* @__PURE__ */ b("p", {
|
|
692
692
|
className: `chat-game-status${Et ? " bs-status--win" : ""}`,
|
|
693
693
|
role: "status",
|
|
694
694
|
children: Dt
|
|
695
695
|
}), Tt]
|
|
696
696
|
}),
|
|
697
|
-
e.status === "invited" && /* @__PURE__ */
|
|
697
|
+
e.status === "invited" && /* @__PURE__ */ x("div", {
|
|
698
698
|
className: "bs-invite",
|
|
699
|
-
children: [/* @__PURE__ */
|
|
699
|
+
children: [/* @__PURE__ */ b("p", { children: "Coloca 5 barcos en un tablero de 10×10 y hunde la flota rival por turnos." }), et && /* @__PURE__ */ x("div", {
|
|
700
700
|
className: "chat-game-actions",
|
|
701
|
-
children: [/* @__PURE__ */
|
|
701
|
+
children: [/* @__PURE__ */ b("button", {
|
|
702
702
|
type: "button",
|
|
703
703
|
className: "chat-game-action chat-game-action--primary",
|
|
704
704
|
disabled: at,
|
|
705
|
-
onClick: $(() => void
|
|
705
|
+
onClick: $(() => void M("act", t, "game_accept")),
|
|
706
706
|
children: "Aceptar partida"
|
|
707
|
-
}), /* @__PURE__ */
|
|
707
|
+
}), /* @__PURE__ */ b("button", {
|
|
708
708
|
type: "button",
|
|
709
709
|
className: "chat-game-action",
|
|
710
710
|
disabled: at,
|
|
711
|
-
onClick: $(() => void
|
|
711
|
+
onClick: $(() => void M("act", t, "game_decline")),
|
|
712
712
|
children: "Rechazar"
|
|
713
713
|
})]
|
|
714
714
|
})]
|
|
715
715
|
}),
|
|
716
|
-
H && /* @__PURE__ */
|
|
717
|
-
rt && /* @__PURE__ */
|
|
716
|
+
H && /* @__PURE__ */ x(ne, { children: [
|
|
717
|
+
rt && /* @__PURE__ */ x("div", {
|
|
718
718
|
className: "bs-hud",
|
|
719
719
|
role: "toolbar",
|
|
720
720
|
"aria-label": "Vista del tablero",
|
|
721
|
-
children: [/* @__PURE__ */
|
|
721
|
+
children: [/* @__PURE__ */ x("div", {
|
|
722
722
|
className: "bs-segment",
|
|
723
|
-
children: [/* @__PURE__ */
|
|
723
|
+
children: [/* @__PURE__ */ x("button", {
|
|
724
724
|
type: "button",
|
|
725
|
-
"aria-pressed":
|
|
726
|
-
onClick: $(() =>
|
|
727
|
-
children: [/* @__PURE__ */
|
|
725
|
+
"aria-pressed": we === "target",
|
|
726
|
+
onClick: $(() => N("target")),
|
|
727
|
+
children: [/* @__PURE__ */ b(oe, {
|
|
728
728
|
size: 14,
|
|
729
729
|
"aria-hidden": "true"
|
|
730
730
|
}), "Objetivo"]
|
|
731
|
-
}), /* @__PURE__ */
|
|
731
|
+
}), /* @__PURE__ */ x("button", {
|
|
732
732
|
type: "button",
|
|
733
|
-
"aria-pressed":
|
|
734
|
-
onClick: $(() =>
|
|
735
|
-
children: [/* @__PURE__ */
|
|
733
|
+
"aria-pressed": we === "own",
|
|
734
|
+
onClick: $(() => N("own")),
|
|
735
|
+
children: [/* @__PURE__ */ b(re, {
|
|
736
736
|
size: 14,
|
|
737
737
|
"aria-hidden": "true"
|
|
738
738
|
}), "Mi flota"]
|
|
739
739
|
})]
|
|
740
|
-
}), /* @__PURE__ */
|
|
740
|
+
}), /* @__PURE__ */ x("dl", {
|
|
741
741
|
className: "bs-stats",
|
|
742
742
|
children: [
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "Disparos" }), /* @__PURE__ */ b("dd", { children: ut })] }),
|
|
744
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "Impactos" }), /* @__PURE__ */ b("dd", { children: dt })] }),
|
|
745
|
+
/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("dt", { children: "Hundidos" }), /* @__PURE__ */ x("dd", { children: [
|
|
746
746
|
Ot,
|
|
747
747
|
"/",
|
|
748
748
|
a.length
|
|
@@ -750,19 +750,19 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
750
750
|
]
|
|
751
751
|
})]
|
|
752
752
|
}),
|
|
753
|
-
/* @__PURE__ */
|
|
753
|
+
/* @__PURE__ */ x("div", {
|
|
754
754
|
className: "bs-stage-wrap",
|
|
755
755
|
children: [
|
|
756
|
-
/* @__PURE__ */
|
|
756
|
+
/* @__PURE__ */ b("div", {
|
|
757
757
|
ref: p,
|
|
758
|
-
className: `bs-stage${
|
|
758
|
+
className: `bs-stage${O === "fallback" ? " bs-stage--fallback" : ""}`,
|
|
759
759
|
tabIndex: 0,
|
|
760
760
|
role: "application",
|
|
761
761
|
"aria-label": z ? "Tablero 3D de tu flota. Flechas para mover, Enter para colocar o quitar un barco, R para rotar." : "Tablero 3D de Batalla Naval. Flechas para mover la selección, Enter para disparar, R para centrar la cámara.",
|
|
762
|
-
"aria-describedby":
|
|
763
|
-
"aria-busy":
|
|
762
|
+
"aria-describedby": be,
|
|
763
|
+
"aria-busy": O === "loading",
|
|
764
764
|
onKeyDown: Ct,
|
|
765
|
-
children:
|
|
765
|
+
children: O === "fallback" && /* @__PURE__ */ b(ze, {
|
|
766
766
|
view: ht,
|
|
767
767
|
selected: Y === "target" ? I : null,
|
|
768
768
|
cursor: F,
|
|
@@ -770,70 +770,70 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
770
770
|
onHover: Be
|
|
771
771
|
})
|
|
772
772
|
}),
|
|
773
|
-
|
|
773
|
+
O === "loading" && /* @__PURE__ */ x("div", {
|
|
774
774
|
className: "bs-stage-state",
|
|
775
775
|
role: "status",
|
|
776
|
-
children: [/* @__PURE__ */
|
|
776
|
+
children: [/* @__PURE__ */ b(me, {
|
|
777
777
|
size: 16,
|
|
778
778
|
"aria-hidden": "true"
|
|
779
779
|
}), " Preparando el océano…"]
|
|
780
780
|
}),
|
|
781
|
-
|
|
781
|
+
O === "fallback" && /* @__PURE__ */ x("p", {
|
|
782
782
|
className: "bs-fallback-note",
|
|
783
|
-
children: [/* @__PURE__ */
|
|
783
|
+
children: [/* @__PURE__ */ b(pe, {
|
|
784
784
|
size: 12,
|
|
785
785
|
"aria-hidden": "true"
|
|
786
786
|
}), " Vista 3D no disponible · modo 2D"]
|
|
787
787
|
}),
|
|
788
|
-
/* @__PURE__ */
|
|
788
|
+
/* @__PURE__ */ b("div", {
|
|
789
789
|
className: "bs-cell-chip",
|
|
790
790
|
"aria-hidden": "true",
|
|
791
|
-
children:
|
|
791
|
+
children: A(z ? X : Y === "target" && I || P)
|
|
792
792
|
}),
|
|
793
|
-
/* @__PURE__ */
|
|
793
|
+
/* @__PURE__ */ b("div", {
|
|
794
794
|
className: "bs-live",
|
|
795
795
|
"aria-live": "polite",
|
|
796
796
|
"aria-atomic": "true",
|
|
797
|
-
children: Ze && /* @__PURE__ */
|
|
797
|
+
children: Ze && /* @__PURE__ */ b("span", {
|
|
798
798
|
className: `bs-toast bs-toast--${Ze.kind}`,
|
|
799
799
|
children: Ze.text
|
|
800
800
|
}, Ze.id)
|
|
801
801
|
})
|
|
802
802
|
]
|
|
803
803
|
}),
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
id:
|
|
804
|
+
/* @__PURE__ */ b("p", {
|
|
805
|
+
id: be,
|
|
806
806
|
className: "bs-hint",
|
|
807
807
|
children: z ? "Clic para colocar · clic en un barco para quitarlo · R para rotar" : "Arrastra para rotar · doble clic o Enter para disparar"
|
|
808
808
|
}),
|
|
809
|
-
z && /* @__PURE__ */
|
|
809
|
+
z && /* @__PURE__ */ x("div", {
|
|
810
810
|
className: "bs-placement",
|
|
811
811
|
children: [
|
|
812
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ b("ul", {
|
|
813
813
|
className: "bs-fleet",
|
|
814
814
|
"aria-label": "Tu flota",
|
|
815
815
|
children: a.map((e) => {
|
|
816
816
|
let n = q.has(e.id), r = J?.id === e.id;
|
|
817
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ b("li", { children: /* @__PURE__ */ x("button", {
|
|
818
818
|
type: "button",
|
|
819
819
|
className: `bs-ship${n ? " is-placed" : ""}${r ? " is-active" : ""}`,
|
|
820
820
|
"aria-pressed": r,
|
|
821
821
|
disabled: !V,
|
|
822
822
|
title: n ? "Quitar y volver a colocar" : "Seleccionar barco",
|
|
823
823
|
onClick: $(() => {
|
|
824
|
-
n &&
|
|
824
|
+
n && M("bsRemoveShip", t, e.id), Ge(e.id);
|
|
825
825
|
}),
|
|
826
826
|
children: [
|
|
827
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ b("span", {
|
|
828
828
|
className: "bs-ship__name",
|
|
829
|
-
children:
|
|
829
|
+
children: Me(ke(e.id))
|
|
830
830
|
}),
|
|
831
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ b("span", {
|
|
832
832
|
className: "bs-ship__pips",
|
|
833
833
|
"aria-label": `${e.size} casillas`,
|
|
834
|
-
children: Array.from({ length: e.size }, (e, t) => /* @__PURE__ */
|
|
834
|
+
children: Array.from({ length: e.size }, (e, t) => /* @__PURE__ */ b("i", {}, t))
|
|
835
835
|
}),
|
|
836
|
-
n && /* @__PURE__ */
|
|
836
|
+
n && /* @__PURE__ */ b(ie, {
|
|
837
837
|
size: 13,
|
|
838
838
|
"aria-label": "colocado"
|
|
839
839
|
})
|
|
@@ -841,90 +841,90 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
841
841
|
}) }, e.id);
|
|
842
842
|
})
|
|
843
843
|
}),
|
|
844
|
-
/* @__PURE__ */
|
|
844
|
+
/* @__PURE__ */ x("div", {
|
|
845
845
|
className: "chat-game-actions bs-actions",
|
|
846
846
|
children: [
|
|
847
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ x("button", {
|
|
848
848
|
type: "button",
|
|
849
849
|
className: "chat-game-action bs-btn",
|
|
850
850
|
disabled: !V,
|
|
851
851
|
onClick: bt,
|
|
852
852
|
title: "Rotar (R)",
|
|
853
|
-
children: [/* @__PURE__ */
|
|
853
|
+
children: [/* @__PURE__ */ b(de, {
|
|
854
854
|
size: 15,
|
|
855
855
|
"aria-hidden": "true"
|
|
856
856
|
}), L === "horizontal" ? "Horizontal" : "Vertical"]
|
|
857
857
|
}),
|
|
858
|
-
/* @__PURE__ */
|
|
858
|
+
/* @__PURE__ */ x("button", {
|
|
859
859
|
type: "button",
|
|
860
860
|
className: "chat-game-action bs-btn",
|
|
861
861
|
disabled: !V,
|
|
862
862
|
onClick: () => {
|
|
863
|
-
|
|
863
|
+
T("ship_place"), M("bsRandomFleet", t);
|
|
864
864
|
},
|
|
865
|
-
children: [/* @__PURE__ */
|
|
865
|
+
children: [/* @__PURE__ */ b(fe, {
|
|
866
866
|
size: 15,
|
|
867
867
|
"aria-hidden": "true"
|
|
868
868
|
}), "Aleatorio"]
|
|
869
869
|
}),
|
|
870
|
-
/* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ x("button", {
|
|
871
871
|
type: "button",
|
|
872
872
|
className: "chat-game-action chat-game-action--primary bs-btn",
|
|
873
873
|
disabled: !V || !st,
|
|
874
874
|
onClick: xt,
|
|
875
|
-
children: [/* @__PURE__ */
|
|
875
|
+
children: [/* @__PURE__ */ b(ie, {
|
|
876
876
|
size: 15,
|
|
877
877
|
"aria-hidden": "true"
|
|
878
878
|
}), e.myReady ? "Flota lista" : `Listo (${q.size}/${a.length})`]
|
|
879
879
|
})
|
|
880
880
|
]
|
|
881
881
|
}),
|
|
882
|
-
e.myReady && /* @__PURE__ */
|
|
882
|
+
e.myReady && /* @__PURE__ */ b("p", {
|
|
883
883
|
className: "bs-waiting",
|
|
884
884
|
children: e.opponentReady ? "Ambas flotas listas · iniciando…" : "Flota lista. Esperando a que el rival coloque su flota…"
|
|
885
885
|
})
|
|
886
886
|
]
|
|
887
887
|
}),
|
|
888
|
-
rt && /* @__PURE__ */
|
|
888
|
+
rt && /* @__PURE__ */ x("div", {
|
|
889
889
|
className: "chat-game-actions bs-actions",
|
|
890
890
|
children: [
|
|
891
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ x("button", {
|
|
892
892
|
type: "button",
|
|
893
893
|
className: "chat-game-action chat-game-action--primary bs-btn bs-btn--fire",
|
|
894
894
|
disabled: !B || !I || Y !== "target",
|
|
895
895
|
onClick: () => gt(),
|
|
896
|
-
title: I ? `Disparar en ${
|
|
896
|
+
title: I ? `Disparar en ${A(I)} (Enter)` : "Selecciona una casilla",
|
|
897
897
|
children: [
|
|
898
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ b(oe, {
|
|
899
899
|
size: 15,
|
|
900
900
|
"aria-hidden": "true"
|
|
901
901
|
}),
|
|
902
902
|
"Disparar",
|
|
903
|
-
I ? ` · ${
|
|
903
|
+
I ? ` · ${A(I)}` : ""
|
|
904
904
|
]
|
|
905
905
|
}),
|
|
906
|
-
/* @__PURE__ */
|
|
906
|
+
/* @__PURE__ */ x("button", {
|
|
907
907
|
type: "button",
|
|
908
908
|
className: "chat-game-action bs-btn",
|
|
909
909
|
"aria-pressed": Ke,
|
|
910
910
|
disabled: Y !== "target" || !U,
|
|
911
911
|
onClick: St,
|
|
912
912
|
title: "Radar de impactos",
|
|
913
|
-
children: [/* @__PURE__ */
|
|
913
|
+
children: [/* @__PURE__ */ b(ue, {
|
|
914
914
|
size: 15,
|
|
915
915
|
"aria-hidden": "true"
|
|
916
916
|
}), "Radar"]
|
|
917
917
|
}),
|
|
918
|
-
/* @__PURE__ */
|
|
918
|
+
/* @__PURE__ */ x("button", {
|
|
919
919
|
type: "button",
|
|
920
920
|
className: "chat-game-action bs-btn",
|
|
921
921
|
disabled: !U,
|
|
922
922
|
onClick: $(() => m.current?.resetCamera?.()),
|
|
923
923
|
title: "Centrar cámara (R)",
|
|
924
|
-
children: [/* @__PURE__ */
|
|
924
|
+
children: [/* @__PURE__ */ b(se, {
|
|
925
925
|
size: 15,
|
|
926
926
|
"aria-hidden": "true"
|
|
927
|
-
}), /* @__PURE__ */
|
|
927
|
+
}), /* @__PURE__ */ b("span", {
|
|
928
928
|
className: "bs-btn-label",
|
|
929
929
|
children: "Centrar"
|
|
930
930
|
})]
|
|
@@ -932,31 +932,31 @@ function Be({ game: e, gameKey: t, currentUserId: r, connected: i, status: o, va
|
|
|
932
932
|
]
|
|
933
933
|
})
|
|
934
934
|
] }),
|
|
935
|
-
e.status === "conflict" && tt && /* @__PURE__ */
|
|
935
|
+
e.status === "conflict" && tt && /* @__PURE__ */ b(Le, {
|
|
936
936
|
sync: e.sync,
|
|
937
937
|
connected: i,
|
|
938
|
-
onResync: () => void
|
|
939
|
-
onAdoptOffer: () => void
|
|
938
|
+
onResync: () => void M("requestResync", t),
|
|
939
|
+
onAdoptOffer: () => void M("adoptResyncOffer", t)
|
|
940
940
|
}),
|
|
941
|
-
e.error && /* @__PURE__ */
|
|
941
|
+
e.error && /* @__PURE__ */ x("div", {
|
|
942
942
|
className: "chat-game-error",
|
|
943
943
|
role: "alert",
|
|
944
|
-
children: [/* @__PURE__ */
|
|
944
|
+
children: [/* @__PURE__ */ b("span", { children: e.error }), e.pendingEvent && /* @__PURE__ */ b("button", {
|
|
945
945
|
type: "button",
|
|
946
946
|
className: "chat-game-action",
|
|
947
947
|
disabled: !i || e.pending,
|
|
948
|
-
onClick: () => void
|
|
948
|
+
onClick: () => void M("retry", t),
|
|
949
949
|
children: "Reintentar"
|
|
950
950
|
})]
|
|
951
951
|
}),
|
|
952
|
-
/* @__PURE__ */
|
|
952
|
+
/* @__PURE__ */ b("footer", {
|
|
953
953
|
className: "chat-game-footer",
|
|
954
954
|
children: nt ? "Puedes seguir conversando o invitar a otra partida." : "Hunde los 5 barcos rivales. El chat sigue disponible."
|
|
955
955
|
})
|
|
956
956
|
]
|
|
957
957
|
});
|
|
958
958
|
}
|
|
959
|
-
var F = m(
|
|
959
|
+
var F = m(P);
|
|
960
960
|
export { F as default };
|
|
961
961
|
|
|
962
|
-
//# sourceMappingURL=BattleshipGameCard-
|
|
962
|
+
//# sourceMappingURL=BattleshipGameCard-DwNzgH5G.js.map
|