gigaboard 1.3.3 → 1.4.0

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/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkENYRJ4Q2_cjs = require('./chunk-ENYRJ4Q2.cjs');
3
+ var chunkK7D2C72S_cjs = require('./chunk-K7D2C72S.cjs');
4
4
  var chunkD45G3J5E_cjs = require('./chunk-D45G3J5E.cjs');
5
5
  require('./chunk-G6ZFOJZR.cjs');
6
6
  require('./chunk-AYVQCHSG.cjs');
@@ -143,6 +143,7 @@ function redraw(canvas, arrows, preview, orientation, palette) {
143
143
  ctx.clearRect(0, 0, cssWidth, cssHeight);
144
144
  const sqSize = cssWidth / 8;
145
145
  for (const arrow of arrows) {
146
+ if (arrow.label?.background !== void 0) continue;
146
147
  drawArrow(ctx, arrow.from, arrow.to, resolveColor(arrow, palette), sqSize, orientation, false);
147
148
  }
148
149
  if (preview !== null) {
@@ -156,6 +157,243 @@ function anchorPct(from, to, orientation, center) {
156
157
  if (center === "dest") return b;
157
158
  return { cx: (a.cx + b.cx) / 2, cy: (a.cy + b.cy) / 2 };
158
159
  }
160
+ function computeDynamicAeroGeometry(text, style, fontSize, isTerminal = true) {
161
+ const resolvedStyle = style ?? "aero_chisel";
162
+ const hasText = Boolean(text && text.trim().length > 0);
163
+ if (!hasText) {
164
+ const tipX = 2.8;
165
+ const shoulderX = 0.2;
166
+ const rearX = -1.2;
167
+ const dockX2 = -1.8;
168
+ const halfH2 = 2.2;
169
+ const path2 = `M ${rearX},${-halfH2} L ${shoulderX},${-halfH2} L ${tipX},0 L ${shoulderX},${halfH2} L ${rearX},${halfH2} C ${dockX2},${halfH2} ${dockX2},${-halfH2} ${rearX},${-halfH2} Z`;
170
+ return {
171
+ path: path2,
172
+ tipLen: tipX,
173
+ dockLen: -dockX2,
174
+ frontLen: tipX,
175
+ cabinW: 0
176
+ };
177
+ }
178
+ const charWidth = fontSize * 0.6;
179
+ const textWidth = text.length * charWidth;
180
+ const halfTextW = textWidth / 2;
181
+ const padX = 0.75;
182
+ const cabinW = Math.max(3.2, halfTextW + padX);
183
+ const halfH = Math.max(2.3, fontSize * 0.9);
184
+ const rearInset = 0.65;
185
+ const dockX = -cabinW - rearInset;
186
+ let frontLen = 0;
187
+ let path = "";
188
+ if (resolvedStyle === "aero_chisel") {
189
+ if (isTerminal) {
190
+ const noseLead = 1.25;
191
+ const tipX = cabinW + noseLead;
192
+ frontLen = tipX;
193
+ path = `M ${-cabinW},${-halfH} L ${cabinW},${-halfH} L ${tipX},0 L ${cabinW},${halfH} L ${-cabinW},${halfH} C ${dockX},${halfH} ${dockX},${-halfH} ${-cabinW},${-halfH} Z`;
194
+ } else {
195
+ frontLen = cabinW + rearInset;
196
+ path = `M ${-cabinW},${-halfH} L ${cabinW},${-halfH} C ${frontLen},${-halfH} ${frontLen},${halfH} ${cabinW},${halfH} L ${-cabinW},${halfH} C ${dockX},${halfH} ${dockX},${-halfH} ${-cabinW},${-halfH} Z`;
197
+ }
198
+ } else if (resolvedStyle === "chamfer_arrow") {
199
+ if (isTerminal) {
200
+ const tipX = cabinW + 1.4;
201
+ frontLen = tipX;
202
+ path = `M ${-cabinW},-1.2 L ${-cabinW + 1.2},${-halfH} L ${cabinW},${-halfH} L ${tipX},0 L ${cabinW},${halfH} L ${-cabinW + 1.2},${halfH} L ${-cabinW},1.2 Z`;
203
+ } else {
204
+ frontLen = cabinW + 0.8;
205
+ path = `M ${-cabinW},-1.2 L ${-cabinW + 1.2},${-halfH} L ${cabinW - 1.2},${-halfH} L ${cabinW},-1.2 L ${cabinW},1.2 L ${cabinW - 1.2},${halfH} L ${-cabinW + 1.2},${halfH} L ${-cabinW},1.2 Z`;
206
+ }
207
+ } else if (resolvedStyle === "blunt_wedge") {
208
+ if (isTerminal) {
209
+ const tipX = cabinW + 1.1;
210
+ frontLen = tipX;
211
+ path = `M ${-cabinW},${-halfH} L ${cabinW},${-halfH} L ${tipX},${-halfH * 0.35} L ${tipX},${halfH * 0.35} L ${cabinW},${halfH} L ${-cabinW},${halfH} C ${dockX},${halfH} ${dockX},${-halfH} ${-cabinW},${-halfH} Z`;
212
+ } else {
213
+ frontLen = cabinW + rearInset;
214
+ path = `M ${-cabinW},${-halfH} L ${cabinW},${-halfH} C ${frontLen},${-halfH} ${frontLen},${halfH} ${cabinW},${halfH} L ${-cabinW},${halfH} C ${dockX},${halfH} ${dockX},${-halfH} ${-cabinW},${-halfH} Z`;
215
+ }
216
+ } else if (resolvedStyle === "stealth") {
217
+ const wingBack = cabinW + 2.3;
218
+ const wingY = halfH + 0.35;
219
+ const shoulderX = cabinW * 0.35;
220
+ const tipX = cabinW + 3.6;
221
+ frontLen = tipX;
222
+ path = `M ${dockX.toFixed(2)},0 L ${(-wingBack).toFixed(2)},${(-wingY).toFixed(2)} L ${(-cabinW).toFixed(2)},${(-halfH).toFixed(2)} L ${shoulderX.toFixed(2)},${(-halfH).toFixed(2)} L ${tipX.toFixed(2)},0 L ${shoulderX.toFixed(2)},${halfH.toFixed(2)} L ${(-cabinW).toFixed(2)},${halfH.toFixed(2)} L ${(-wingBack).toFixed(2)},${wingY.toFixed(2)} Z`;
223
+ } else {
224
+ const noseLead = 1.25;
225
+ const tipX = cabinW + noseLead;
226
+ frontLen = tipX;
227
+ path = `M ${-cabinW},${-halfH} L ${cabinW},${-halfH} L ${tipX},0 L ${cabinW},${halfH} L ${-cabinW},${halfH} C ${dockX},${halfH} ${dockX},${-halfH} ${-cabinW},${-halfH} Z`;
228
+ }
229
+ return {
230
+ path,
231
+ tipLen: frontLen,
232
+ dockLen: -dockX,
233
+ frontLen,
234
+ cabinW
235
+ };
236
+ }
237
+ function chooseKnightCorner(fromIndex, toIndex, allArrows, orientation) {
238
+ const a = squareCentrePct(fromIndex, orientation);
239
+ const b = squareCentrePct(toIndex, orientation);
240
+ const dx = b.cx - a.cx;
241
+ const dy = b.cy - a.cy;
242
+ const corner1 = { x: b.cx, y: a.cy };
243
+ const corner2 = { x: a.cx, y: b.cy };
244
+ const fromFile = fromIndex & 7;
245
+ const hasColinearArrowOnFile = allArrows.some(
246
+ (other) => other.from !== fromIndex && (other.from & 7) === fromFile
247
+ );
248
+ if (hasColinearArrowOnFile) {
249
+ return corner1;
250
+ }
251
+ return Math.abs(dx) > Math.abs(dy) ? corner1 : corner2;
252
+ }
253
+ function computeIntegratedArrowVectors(arrow, orientation, allArrows) {
254
+ const label = arrow.label;
255
+ if (!label || label.background === void 0) return null;
256
+ const a = squareCentrePct(arrow.from, orientation);
257
+ const b = squareCentrePct(arrow.to, orientation);
258
+ if (arrow.from === arrow.to) return null;
259
+ const isKnight = isKnightMove(arrow.from, arrow.to);
260
+ const fontSize = label.fontSize ?? 2.45;
261
+ const geom = computeDynamicAeroGeometry(label.text, label.headStyle, fontSize, true);
262
+ let startUnit;
263
+ let finalUnit;
264
+ let corner = null;
265
+ if (!isKnight) {
266
+ const u = unitVector({ x: a.cx, y: a.cy }, { x: b.cx, y: b.cy });
267
+ if (u === null) return null;
268
+ startUnit = u;
269
+ finalUnit = u;
270
+ } else {
271
+ corner = chooseKnightCorner(arrow.from, arrow.to, allArrows, orientation);
272
+ startUnit = unitVector({ x: a.cx, y: a.cy }, corner);
273
+ finalUnit = unitVector(corner, { x: b.cx, y: b.cy });
274
+ if (startUnit === null || finalUnit === null) return null;
275
+ }
276
+ const tip = {
277
+ x: b.cx + finalUnit.x * 2.08,
278
+ y: b.cy + finalUnit.y * 2.08
279
+ };
280
+ const headCenter = {
281
+ x: tip.x - finalUnit.x * geom.frontLen,
282
+ y: tip.y - finalUnit.y * geom.frontLen
283
+ };
284
+ const shaftEnd = {
285
+ x: headCenter.x - finalUnit.x * geom.dockLen,
286
+ y: headCenter.y - finalUnit.y * geom.dockLen
287
+ };
288
+ const dist = Math.hypot(b.cx - a.cx, b.cy - a.cy);
289
+ const startOffset = dist < 18 ? 0.5 : 2.4;
290
+ const shaftStart = {
291
+ x: a.cx + startUnit.x * startOffset,
292
+ y: a.cy + startUnit.y * startOffset
293
+ };
294
+ const angleRad = Math.atan2(finalUnit.y, finalUnit.x);
295
+ const angleDeg = angleRad * 180 / Math.PI;
296
+ let textRot = 0;
297
+ const rotMode = label.textRotation ?? "auto";
298
+ if (rotMode === "flat") {
299
+ textRot = -angleDeg;
300
+ } else if (rotMode === "auto") {
301
+ const norm = (angleDeg % 360 + 360) % 360;
302
+ if (norm > 90 && norm < 270) {
303
+ textRot = 180;
304
+ }
305
+ }
306
+ const shaftD = corner !== null ? `M ${shaftStart.x} ${shaftStart.y} L ${corner.x} ${corner.y} L ${shaftEnd.x} ${shaftEnd.y}` : `M ${shaftStart.x} ${shaftStart.y} L ${shaftEnd.x} ${shaftEnd.y}`;
307
+ const shaftLen = (shaftEnd.x - shaftStart.x) * startUnit.x + (shaftEnd.y - shaftStart.y) * startUnit.y;
308
+ const showShaft = isKnight || shaftLen > 0.2;
309
+ return {
310
+ label,
311
+ fontSize,
312
+ geom,
313
+ headCenter,
314
+ shaftD,
315
+ showShaft,
316
+ angleDeg,
317
+ textRot
318
+ };
319
+ }
320
+ function renderIntegratedShaft(arrow, color, orientation, key, allArrows) {
321
+ const v = computeIntegratedArrowVectors(arrow, orientation, allArrows);
322
+ if (v === null || !v.showShaft) return null;
323
+ const is3d = v.label.style3d !== false;
324
+ const filterId = is3d ? "url(#gb-apple-elevation)" : "url(#gb-arrow-shadow)";
325
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { filter: filterId, children: [
326
+ /* @__PURE__ */ jsxRuntime.jsx(
327
+ "path",
328
+ {
329
+ d: v.shaftD,
330
+ fill: "none",
331
+ stroke: is3d ? "rgba(44, 27, 20, 0.75)" : color,
332
+ strokeWidth: is3d ? "3.2" : "2.2",
333
+ strokeLinecap: "round",
334
+ strokeLinejoin: "round"
335
+ }
336
+ ),
337
+ /* @__PURE__ */ jsxRuntime.jsx(
338
+ "path",
339
+ {
340
+ d: v.shaftD,
341
+ fill: "none",
342
+ stroke: color,
343
+ strokeWidth: "2.1",
344
+ strokeLinecap: "round",
345
+ strokeLinejoin: "round"
346
+ }
347
+ ),
348
+ is3d && /* @__PURE__ */ jsxRuntime.jsx(
349
+ "path",
350
+ {
351
+ d: v.shaftD,
352
+ fill: "none",
353
+ stroke: "rgba(255, 255, 255, 0.3)",
354
+ strokeWidth: "0.6",
355
+ strokeLinecap: "round",
356
+ strokeLinejoin: "round"
357
+ }
358
+ )
359
+ ] }, `${key}-shaft`);
360
+ }
361
+ function renderIntegratedHead(arrow, _color, orientation, key, allArrows) {
362
+ const v = computeIntegratedArrowVectors(arrow, orientation, allArrows);
363
+ if (v === null) return null;
364
+ const is3d = v.label.style3d !== false;
365
+ const filterId = is3d ? "url(#gb-apple-elevation)" : "url(#gb-arrow-shadow)";
366
+ const headFill = v.label.background === "#F59E0B" && is3d ? "url(#gb-apple-amber-grad)" : v.label.background;
367
+ const headStroke = v.label.borderColor ?? "#78350F";
368
+ return /* @__PURE__ */ jsxRuntime.jsx("g", { filter: filterId, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${v.headCenter.x}, ${v.headCenter.y}) rotate(${v.angleDeg})`, children: [
369
+ /* @__PURE__ */ jsxRuntime.jsx(
370
+ "path",
371
+ {
372
+ d: v.geom.path,
373
+ fill: headFill,
374
+ stroke: headStroke,
375
+ strokeWidth: "0.7",
376
+ strokeLinejoin: "round"
377
+ }
378
+ ),
379
+ Boolean(v.label.text && v.label.text.trim().length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
380
+ "text",
381
+ {
382
+ x: 0,
383
+ y: 0,
384
+ transform: v.textRot !== 0 ? `rotate(${v.textRot})` : void 0,
385
+ fill: v.label.fill ?? "#000000",
386
+ fontSize: v.fontSize,
387
+ fontWeight: "800",
388
+ fontFamily: "'JetBrains Mono', ui-monospace, monospace",
389
+ textAnchor: "middle",
390
+ dominantBaseline: "central",
391
+ style: { userSelect: "none" },
392
+ children: v.label.text
393
+ }
394
+ )
395
+ ] }) }, `${key}-head`);
396
+ }
159
397
  var ArrowsLayer = react.memo(
160
398
  react.forwardRef(function ArrowsLayer2({ model, orientation, palette, below = false }, handle) {
161
399
  const canvasRef = react.useRef(null);
@@ -214,7 +452,7 @@ var ArrowsLayer = react.memo(
214
452
  }
215
453
  }
216
454
  ),
217
- hasDecorations ? /* @__PURE__ */ jsxRuntime.jsx(
455
+ hasDecorations ? /* @__PURE__ */ jsxRuntime.jsxs(
218
456
  "svg",
219
457
  {
220
458
  "data-layer": below ? "arrows-below-decor" : "arrows-decor",
@@ -230,50 +468,126 @@ var ArrowsLayer = react.memo(
230
468
  // Decorations share the z-plane of the canvas they annotate.
231
469
  ...layerZIndex !== void 0 ? { zIndex: layerZIndex } : {}
232
470
  },
233
- children: arrows.map((arrow) => {
234
- const key = `${arrow.from}-${arrow.to}-${arrow.color}-${arrow.brush ?? ""}`;
235
- const color = resolveColor(arrow, palette);
236
- const nodes = [];
237
- if (arrow.label !== void 0) {
238
- const { cx, cy } = anchorPct(arrow.from, arrow.to, orientation, "label");
239
- nodes.push(
240
- /* @__PURE__ */ jsxRuntime.jsx(
241
- "text",
242
- {
243
- x: cx,
244
- y: cy,
245
- fill: arrow.label.fill ?? color,
246
- fontSize: "4",
247
- fontWeight: "700",
248
- textAnchor: "middle",
249
- dominantBaseline: "central",
250
- style: { userSelect: "none" },
251
- children: arrow.label.text
252
- },
253
- `${key}-label`
254
- )
255
- );
256
- }
257
- if (arrow.customSvg !== void 0) {
258
- const { cx, cy } = anchorPct(
259
- arrow.from,
260
- arrow.to,
261
- orientation,
262
- arrow.customSvg.center ?? "dest"
263
- );
264
- nodes.push(
265
- /* @__PURE__ */ jsxRuntime.jsx(
266
- "g",
267
- {
268
- transform: `translate(${cx}, ${cy})`,
269
- dangerouslySetInnerHTML: { __html: arrow.customSvg.html }
270
- },
271
- `${key}-svg`
272
- )
273
- );
274
- }
275
- return nodes.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("g", { children: nodes }, key);
276
- })
471
+ children: [
472
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
473
+ /* @__PURE__ */ jsxRuntime.jsx(
474
+ "filter",
475
+ {
476
+ id: "gb-arrow-shadow",
477
+ filterUnits: "userSpaceOnUse",
478
+ x: "-20",
479
+ y: "-20",
480
+ width: "140",
481
+ height: "140",
482
+ children: /* @__PURE__ */ jsxRuntime.jsx(
483
+ "feDropShadow",
484
+ {
485
+ dx: "0",
486
+ dy: "1.2",
487
+ stdDeviation: "1.2",
488
+ floodColor: "#000000",
489
+ floodOpacity: "0.55"
490
+ }
491
+ )
492
+ }
493
+ ),
494
+ /* @__PURE__ */ jsxRuntime.jsxs(
495
+ "filter",
496
+ {
497
+ id: "gb-apple-elevation",
498
+ filterUnits: "userSpaceOnUse",
499
+ x: "-20",
500
+ y: "-20",
501
+ width: "140",
502
+ height: "140",
503
+ children: [
504
+ /* @__PURE__ */ jsxRuntime.jsx(
505
+ "feDropShadow",
506
+ {
507
+ dx: "0",
508
+ dy: "2.8",
509
+ stdDeviation: "2.2",
510
+ floodColor: "#000000",
511
+ floodOpacity: "0.4"
512
+ }
513
+ ),
514
+ /* @__PURE__ */ jsxRuntime.jsx(
515
+ "feDropShadow",
516
+ {
517
+ dx: "0",
518
+ dy: "1.0",
519
+ stdDeviation: "0.7",
520
+ floodColor: "#000000",
521
+ floodOpacity: "0.6"
522
+ }
523
+ )
524
+ ]
525
+ }
526
+ ),
527
+ /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "gb-apple-amber-grad", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
528
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "#FBBF24", stopOpacity: "1" }),
529
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "60%", stopColor: "#F59E0B", stopOpacity: "1" }),
530
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "#D97706", stopOpacity: "1" })
531
+ ] })
532
+ ] }),
533
+ arrows.map((arrow) => {
534
+ if (arrow.label?.background === void 0) return null;
535
+ const key = `${arrow.from}-${arrow.to}-${arrow.color}-${arrow.brush ?? ""}`;
536
+ const color = resolveColor(arrow, palette);
537
+ return renderIntegratedShaft(arrow, color, orientation, key, arrows);
538
+ }),
539
+ arrows.map((arrow) => {
540
+ if (arrow.label?.background === void 0) return null;
541
+ const key = `${arrow.from}-${arrow.to}-${arrow.color}-${arrow.brush ?? ""}`;
542
+ const color = resolveColor(arrow, palette);
543
+ return renderIntegratedHead(arrow, color, orientation, key, arrows);
544
+ }),
545
+ arrows.map((arrow) => {
546
+ if (arrow.label?.background !== void 0) return null;
547
+ const key = `${arrow.from}-${arrow.to}-${arrow.color}-${arrow.brush ?? ""}`;
548
+ const color = resolveColor(arrow, palette);
549
+ const nodes = [];
550
+ if (arrow.label !== void 0) {
551
+ const { cx, cy } = anchorPct(arrow.from, arrow.to, orientation, "label");
552
+ nodes.push(
553
+ /* @__PURE__ */ jsxRuntime.jsx(
554
+ "text",
555
+ {
556
+ x: cx,
557
+ y: cy,
558
+ fill: arrow.label.fill ?? color,
559
+ fontSize: "4",
560
+ fontWeight: "700",
561
+ textAnchor: "middle",
562
+ dominantBaseline: "central",
563
+ style: { userSelect: "none" },
564
+ children: arrow.label.text
565
+ },
566
+ `${key}-label`
567
+ )
568
+ );
569
+ }
570
+ if (arrow.customSvg !== void 0) {
571
+ const { cx, cy } = anchorPct(
572
+ arrow.from,
573
+ arrow.to,
574
+ orientation,
575
+ arrow.customSvg.center ?? "dest"
576
+ );
577
+ nodes.push(
578
+ /* @__PURE__ */ jsxRuntime.jsx(
579
+ "g",
580
+ {
581
+ transform: `translate(${cx}, ${cy})`,
582
+ dangerouslySetInnerHTML: { __html: arrow.customSvg.html }
583
+ },
584
+ `${key}-svg`
585
+ )
586
+ );
587
+ }
588
+ return nodes.length === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("g", { children: nodes }, key);
589
+ })
590
+ ]
277
591
  }
278
592
  ) : null
279
593
  ] });
@@ -719,7 +1033,7 @@ function pieceName(cell) {
719
1033
  }
720
1034
  }
721
1035
  function announcementFor(lastMove, board, wasCapture) {
722
- const { from, to, kind, promotion } = chunkENYRJ4Q2_cjs.decodePackedMove(lastMove);
1036
+ const { from, to, kind, promotion } = chunkK7D2C72S_cjs.decodePackedMove(lastMove);
723
1037
  if (kind === "castle") {
724
1038
  const isKingside = (to & 7) > (from & 7);
725
1039
  return isKingside ? "Castles kingside." : "Castles queenside.";
@@ -944,20 +1258,20 @@ function positionOf4(index, orientation) {
944
1258
  return { x: col * 12.5, y: row * 12.5 };
945
1259
  }
946
1260
  var CHOICE_ORDER = [
947
- chunkENYRJ4Q2_cjs.PieceType.Queen,
948
- chunkENYRJ4Q2_cjs.PieceType.Knight,
949
- chunkENYRJ4Q2_cjs.PieceType.Rook,
950
- chunkENYRJ4Q2_cjs.PieceType.Bishop
1261
+ chunkK7D2C72S_cjs.PieceType.Queen,
1262
+ chunkK7D2C72S_cjs.PieceType.Knight,
1263
+ chunkK7D2C72S_cjs.PieceType.Rook,
1264
+ chunkK7D2C72S_cjs.PieceType.Bishop
951
1265
  ];
952
1266
  var SHORTCUTS = {
953
- q: chunkENYRJ4Q2_cjs.PieceType.Queen,
954
- r: chunkENYRJ4Q2_cjs.PieceType.Rook,
955
- b: chunkENYRJ4Q2_cjs.PieceType.Bishop,
956
- n: chunkENYRJ4Q2_cjs.PieceType.Knight,
957
- Q: chunkENYRJ4Q2_cjs.PieceType.Queen,
958
- R: chunkENYRJ4Q2_cjs.PieceType.Rook,
959
- B: chunkENYRJ4Q2_cjs.PieceType.Bishop,
960
- N: chunkENYRJ4Q2_cjs.PieceType.Knight
1267
+ q: chunkK7D2C72S_cjs.PieceType.Queen,
1268
+ r: chunkK7D2C72S_cjs.PieceType.Rook,
1269
+ b: chunkK7D2C72S_cjs.PieceType.Bishop,
1270
+ n: chunkK7D2C72S_cjs.PieceType.Knight,
1271
+ Q: chunkK7D2C72S_cjs.PieceType.Queen,
1272
+ R: chunkK7D2C72S_cjs.PieceType.Rook,
1273
+ B: chunkK7D2C72S_cjs.PieceType.Bishop,
1274
+ N: chunkK7D2C72S_cjs.PieceType.Knight
961
1275
  };
962
1276
  function PromotionOverlay({
963
1277
  from: _from,
@@ -975,7 +1289,7 @@ function PromotionOverlay({
975
1289
  [getPromotionPieceAriaLabel, color]
976
1290
  );
977
1291
  const [activeAnnouncement, setActiveAnnouncement] = react.useState(
978
- () => getLabel(CHOICE_ORDER[0] ?? chunkENYRJ4Q2_cjs.PieceType.Queen)
1292
+ () => getLabel(CHOICE_ORDER[0] ?? chunkK7D2C72S_cjs.PieceType.Queen)
979
1293
  );
980
1294
  react.useEffect(() => {
981
1295
  buttonRefs.current[0]?.focus();
@@ -1073,7 +1387,7 @@ function PromotionOverlay({
1073
1387
  overflow: "hidden"
1074
1388
  },
1075
1389
  children: CHOICE_ORDER.map((piece, index) => {
1076
- const cell = chunkENYRJ4Q2_cjs.encodeBoardCell(color, piece);
1390
+ const cell = chunkK7D2C72S_cjs.encodeBoardCell(color, piece);
1077
1391
  const label = getLabel(piece);
1078
1392
  return /* @__PURE__ */ jsxRuntime.jsx(
1079
1393
  "button",
@@ -1125,13 +1439,13 @@ var srOnlyStyle2 = {
1125
1439
  };
1126
1440
  function pieceName2(t) {
1127
1441
  switch (t) {
1128
- case chunkENYRJ4Q2_cjs.PieceType.Queen:
1442
+ case chunkK7D2C72S_cjs.PieceType.Queen:
1129
1443
  return "Queen";
1130
- case chunkENYRJ4Q2_cjs.PieceType.Rook:
1444
+ case chunkK7D2C72S_cjs.PieceType.Rook:
1131
1445
  return "Rook";
1132
- case chunkENYRJ4Q2_cjs.PieceType.Bishop:
1446
+ case chunkK7D2C72S_cjs.PieceType.Bishop:
1133
1447
  return "Bishop";
1134
- case chunkENYRJ4Q2_cjs.PieceType.Knight:
1448
+ case chunkK7D2C72S_cjs.PieceType.Knight:
1135
1449
  return "Knight";
1136
1450
  default:
1137
1451
  return "Piece";
@@ -1411,7 +1725,7 @@ function useArrowGesture(options) {
1411
1725
  function wouldPromote(fromCell, toIndex) {
1412
1726
  if (fromCell === 0) return false;
1413
1727
  const pieceType = (fromCell - 1) % 6;
1414
- if (pieceType !== chunkENYRJ4Q2_cjs.PieceType.Pawn) return false;
1728
+ if (pieceType !== chunkK7D2C72S_cjs.PieceType.Pawn) return false;
1415
1729
  const toRank = toIndex >> 3;
1416
1730
  return toRank === 0 || toRank === 7;
1417
1731
  }
@@ -1422,7 +1736,7 @@ function useClickToMove(model, onMove, onPromotionNeeded, enabled = true) {
1422
1736
  if (model === null) return;
1423
1737
  const snap = model.getSnapshot();
1424
1738
  const cell = snap.board[index] ?? 0;
1425
- const pieceColour = cell === 0 ? -1 : cell > 6 ? chunkENYRJ4Q2_cjs.Color.Black : chunkENYRJ4Q2_cjs.Color.White;
1739
+ const pieceColour = cell === 0 ? -1 : cell > 6 ? chunkK7D2C72S_cjs.Color.Black : chunkK7D2C72S_cjs.Color.White;
1426
1740
  if (snap.selected === null) {
1427
1741
  if (pieceColour === snap.turn) model.selectSquare(index);
1428
1742
  return;
@@ -1438,7 +1752,7 @@ function useClickToMove(model, onMove, onPromotionNeeded, enabled = true) {
1438
1752
  onPromotionNeeded(snap.selected, index);
1439
1753
  return;
1440
1754
  }
1441
- const played2 = model.tryMove(snap.selected, index, chunkENYRJ4Q2_cjs.PieceType.Queen);
1755
+ const played2 = model.tryMove(snap.selected, index, chunkK7D2C72S_cjs.PieceType.Queen);
1442
1756
  if (played2 !== null && onMove !== void 0) onMove(played2);
1443
1757
  return;
1444
1758
  }
@@ -1572,7 +1886,7 @@ function useDrag(options) {
1572
1886
  if (!enabled) return;
1573
1887
  const container = containerRef.current;
1574
1888
  if (container === null || game === null) return;
1575
- const controller = chunkENYRJ4Q2_cjs.createDragController(
1889
+ const controller = chunkK7D2C72S_cjs.createDragController(
1576
1890
  activationDistance === void 0 ? {} : { activationDistance }
1577
1891
  );
1578
1892
  let originEl = null;
@@ -2350,7 +2664,7 @@ function parseTransitionMove(transition) {
2350
2664
  };
2351
2665
  }
2352
2666
  function isPawn(cell) {
2353
- return !chunkENYRJ4Q2_cjs.isEmptyCell(cell) && chunkENYRJ4Q2_cjs.pieceTypeOf(cell) === 0;
2667
+ return !chunkK7D2C72S_cjs.isEmptyCell(cell) && chunkK7D2C72S_cjs.pieceTypeOf(cell) === 0;
2354
2668
  }
2355
2669
  function controlledFeedbackDescriptors(transition, previousBoard, nextBoard) {
2356
2670
  if (transition === null || transition === void 0) return null;
@@ -2359,25 +2673,25 @@ function controlledFeedbackDescriptors(transition, previousBoard, nextBoard) {
2359
2673
  const before = transition.direction === "forward" ? previousBoard : nextBoard;
2360
2674
  const after = transition.direction === "forward" ? nextBoard : previousBoard;
2361
2675
  const movingPiece = before[parsed.from] ?? 0;
2362
- if (chunkENYRJ4Q2_cjs.isEmptyCell(movingPiece)) return null;
2676
+ if (chunkK7D2C72S_cjs.isEmptyCell(movingPiece)) return null;
2363
2677
  const fromFile = parsed.from & 7;
2364
2678
  const toFile = parsed.to & 7;
2365
2679
  const targetBefore = before[parsed.to] ?? 0;
2366
2680
  const targetAfter = after[parsed.to] ?? 0;
2367
- if (chunkENYRJ4Q2_cjs.pieceTypeOf(movingPiece) === 5 && Math.abs(toFile - fromFile) === 2) {
2681
+ if (chunkK7D2C72S_cjs.pieceTypeOf(movingPiece) === 5 && Math.abs(toFile - fromFile) === 2) {
2368
2682
  return [{ kind: "castle" }];
2369
2683
  }
2370
- if (parsed.promotion !== null || isPawn(movingPiece) && (parsed.to >> 3 === 0 || parsed.to >> 3 === 7) && !chunkENYRJ4Q2_cjs.isEmptyCell(targetAfter) && chunkENYRJ4Q2_cjs.pieceTypeOf(targetAfter) !== 0) {
2684
+ if (parsed.promotion !== null || isPawn(movingPiece) && (parsed.to >> 3 === 0 || parsed.to >> 3 === 7) && !chunkK7D2C72S_cjs.isEmptyCell(targetAfter) && chunkK7D2C72S_cjs.pieceTypeOf(targetAfter) !== 0) {
2371
2685
  return [{ kind: "promotion" }];
2372
2686
  }
2373
- if (!chunkENYRJ4Q2_cjs.isEmptyCell(targetBefore) && chunkENYRJ4Q2_cjs.colorOf(targetBefore) !== chunkENYRJ4Q2_cjs.colorOf(movingPiece)) {
2687
+ if (!chunkK7D2C72S_cjs.isEmptyCell(targetBefore) && chunkK7D2C72S_cjs.colorOf(targetBefore) !== chunkK7D2C72S_cjs.colorOf(movingPiece)) {
2374
2688
  return [{ kind: "capture" }];
2375
2689
  }
2376
- if (isPawn(movingPiece) && fromFile !== toFile && chunkENYRJ4Q2_cjs.isEmptyCell(targetBefore)) {
2690
+ if (isPawn(movingPiece) && fromFile !== toFile && chunkK7D2C72S_cjs.isEmptyCell(targetBefore)) {
2377
2691
  const capturedSquare = parsed.from & -8 | toFile;
2378
2692
  const capturedBefore = before[capturedSquare] ?? 0;
2379
2693
  const capturedAfter = after[capturedSquare] ?? 0;
2380
- if (!chunkENYRJ4Q2_cjs.isEmptyCell(capturedBefore) && chunkENYRJ4Q2_cjs.colorOf(capturedBefore) !== chunkENYRJ4Q2_cjs.colorOf(movingPiece) && chunkENYRJ4Q2_cjs.isEmptyCell(capturedAfter)) {
2694
+ if (!chunkK7D2C72S_cjs.isEmptyCell(capturedBefore) && chunkK7D2C72S_cjs.colorOf(capturedBefore) !== chunkK7D2C72S_cjs.colorOf(movingPiece) && chunkK7D2C72S_cjs.isEmptyCell(capturedAfter)) {
2381
2695
  return [{ kind: "en-passant" }];
2382
2696
  }
2383
2697
  }
@@ -2884,15 +3198,15 @@ function useChessGame(options = {}) {
2884
3198
  const { fen, ...modelOptions } = options;
2885
3199
  const [initialModelOptions] = react.useState(() => modelOptions);
2886
3200
  const [model, setModel] = react.useState(() => {
2887
- const adapter = chunkENYRJ4Q2_cjs.createGigachessAdapter(fen);
2888
- return chunkENYRJ4Q2_cjs.createBoardModel(adapter, modelOptions);
3201
+ const adapter = chunkK7D2C72S_cjs.createGigachessAdapter(fen);
3202
+ return chunkK7D2C72S_cjs.createBoardModel(adapter, modelOptions);
2889
3203
  });
2890
3204
  const prevFenRef = react.useRef(fen);
2891
3205
  react.useEffect(() => {
2892
3206
  if (prevFenRef.current !== fen) {
2893
3207
  prevFenRef.current = fen;
2894
- const adapter = chunkENYRJ4Q2_cjs.createGigachessAdapter(fen);
2895
- const nextModel = chunkENYRJ4Q2_cjs.createBoardModel(adapter, initialModelOptions);
3208
+ const adapter = chunkK7D2C72S_cjs.createGigachessAdapter(fen);
3209
+ const nextModel = chunkK7D2C72S_cjs.createBoardModel(adapter, initialModelOptions);
2896
3210
  setModel((prev) => {
2897
3211
  prev.dispose();
2898
3212
  return nextModel;
@@ -2912,31 +3226,31 @@ var PACKAGE_VERSION = "1.3.3";
2912
3226
 
2913
3227
  Object.defineProperty(exports, "Color", {
2914
3228
  enumerable: true,
2915
- get: function () { return chunkENYRJ4Q2_cjs.Color; }
3229
+ get: function () { return chunkK7D2C72S_cjs.Color; }
2916
3230
  });
2917
3231
  Object.defineProperty(exports, "PieceType", {
2918
3232
  enumerable: true,
2919
- get: function () { return chunkENYRJ4Q2_cjs.PieceType; }
3233
+ get: function () { return chunkK7D2C72S_cjs.PieceType; }
2920
3234
  });
2921
3235
  Object.defineProperty(exports, "createBoardModel", {
2922
3236
  enumerable: true,
2923
- get: function () { return chunkENYRJ4Q2_cjs.createBoardModel; }
3237
+ get: function () { return chunkK7D2C72S_cjs.createBoardModel; }
2924
3238
  });
2925
3239
  Object.defineProperty(exports, "createGigachessAdapter", {
2926
3240
  enumerable: true,
2927
- get: function () { return chunkENYRJ4Q2_cjs.createGigachessAdapter; }
3241
+ get: function () { return chunkK7D2C72S_cjs.createGigachessAdapter; }
2928
3242
  });
2929
3243
  Object.defineProperty(exports, "packMove", {
2930
3244
  enumerable: true,
2931
- get: function () { return chunkENYRJ4Q2_cjs.packMove; }
3245
+ get: function () { return chunkK7D2C72S_cjs.packMove; }
2932
3246
  });
2933
3247
  Object.defineProperty(exports, "preloadGigachessAdapter", {
2934
3248
  enumerable: true,
2935
- get: function () { return chunkENYRJ4Q2_cjs.preloadGigachessAdapter; }
3249
+ get: function () { return chunkK7D2C72S_cjs.preloadGigachessAdapter; }
2936
3250
  });
2937
3251
  Object.defineProperty(exports, "unpackMove", {
2938
3252
  enumerable: true,
2939
- get: function () { return chunkENYRJ4Q2_cjs.unpackMove; }
3253
+ get: function () { return chunkK7D2C72S_cjs.unpackMove; }
2940
3254
  });
2941
3255
  Object.defineProperty(exports, "CSS_VARS", {
2942
3256
  enumerable: true,