@minicode-dev/chat 0.1.5 → 0.1.7

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