{"version":3,"sources":["../src/index.ts","../src/components/ChessGame/parts/Root.tsx","../src/hooks/useChessGame.ts","../src/utils/chess.ts","../src/hooks/useChessGameBoardContainerContext.ts","../src/hooks/useChessGameContext.ts","../src/theme/context.tsx","../src/theme/defaults.ts","../src/theme/utils.ts","../src/components/ChessGame/parts/Board.tsx","../src/utils/board.ts","../src/components/ChessGame/parts/Sounds.tsx","../src/hooks/useBoardSounds.ts","../src/assets/sounds.ts","../src/types/audio.ts","../src/utils/audioManager.ts","../src/hooks/useKeyboardControls.ts","../src/components/ChessGame/parts/KeyboardControls.tsx","../src/components/ChessGame/Clock/index.tsx","../src/components/ChessGame/index.ts","../src/theme/presets.ts","../src/theme/index.ts"],"sourcesContent":["// Components\nexport { ChessGame } from \"./components/ChessGame\";\n\n// Clock - Re-export from react-chess-clock for convenience\nexport { ChessClock } from \"@react-chess-tools/react-chess-clock\";\nexport type {\n  TimeControlConfig,\n  TimeControlInput,\n  TimingMethod,\n  ClockStartMode,\n  UseChessClockReturn,\n} from \"@react-chess-tools/react-chess-clock\";\n\n// Hooks & Context\nexport { useChessGameContext } from \"./hooks/useChessGameContext\";\nexport { useChessGame } from \"./hooks/useChessGame\";\nexport type { ChessGameContextType } from \"./hooks/useChessGameContext\";\nexport type { useChessGameProps } from \"./hooks/useChessGame\";\n\n// Audio Types\nexport type { AudioEventName, AudioOverrides } from \"./types/audio\";\nexport type {\n  ChessGameClockTimeoutEvent,\n  ChessGameEvent,\n  ChessGameEventName,\n  ChessGameIllegalMoveEvent,\n  ChessGameMoveEvent,\n} from \"./types/gameEvents\";\nexport type { SoundsProps } from \"./components/ChessGame/parts/Sounds\";\n\n// Keyboard Types\nexport type { KeyboardControls } from \"./components/ChessGame/parts/KeyboardControls\";\n\n// Utility Types\nexport type { GameInfo } from \"./utils/chess\";\nexport { deepMergeChessboardOptions } from \"./utils/board\";\n\n// Component Props\nexport type { ChessGameProps } from \"./components/ChessGame/parts/Board\";\nexport type { RootProps } from \"./components/ChessGame/parts/Root\";\n\n// Theme - Types\nexport type {\n  ChessGameTheme,\n  BoardTheme,\n  StateTheme,\n  IndicatorTheme,\n  PartialChessGameTheme,\n  DeepPartial,\n} from \"./theme/types\";\n\n// Theme - Values\nexport { defaultGameTheme } from \"./theme/defaults\";\nexport { lichessTheme, chessComTheme } from \"./theme/presets\";\nexport { themes } from \"./theme\";\n\n// Theme - Utilities\nexport { mergeTheme, mergeThemeWith } from \"./theme/utils\";\nexport { useChessGameTheme, ChessGameThemeContext } from \"./theme/context\";\n","import React from \"react\";\nimport { Color } from \"chess.js\";\nimport { useChessGame } from \"../../../hooks/useChessGame\";\nimport { ChessGameBoardContainerContext } from \"../../../hooks/useChessGameBoardContainerContext\";\nimport { ChessGameContext } from \"../../../hooks/useChessGameContext\";\nimport { ThemeProvider } from \"../../../theme/context\";\nimport { mergeTheme } from \"../../../theme/utils\";\nimport type { PartialChessGameTheme } from \"../../../theme/types\";\nimport type { TimeControlConfig } from \"@react-chess-tools/react-chess-clock\";\n\nexport interface RootProps {\n  fen?: string;\n  orientation?: Color;\n  /** Optional theme configuration. Supports partial themes - only override the colors you need. */\n  theme?: PartialChessGameTheme;\n  /** Optional clock configuration to enable chess clock functionality */\n  timeControl?: TimeControlConfig;\n  /** Auto-switch clock on move (default: true) */\n  autoSwitchOnMove?: boolean;\n}\n\nexport const Root: React.FC<React.PropsWithChildren<RootProps>> = ({\n  fen,\n  orientation,\n  theme,\n  timeControl,\n  autoSwitchOnMove,\n  children,\n}) => {\n  const context = useChessGame({\n    fen,\n    orientation,\n    timeControl,\n    autoSwitchOnMove,\n  });\n  const boardContainerRef = React.useRef<HTMLDivElement | null>(null);\n  const [boardContainerElement, setBoardContainerElement] =\n    React.useState<HTMLDivElement | null>(null);\n\n  // Merge partial theme with defaults\n  const mergedTheme = React.useMemo(() => mergeTheme(theme), [theme]);\n  const boardContainerContext = React.useMemo(\n    () => ({\n      boardContainerRef,\n      boardContainerElement,\n      setBoardContainerElement,\n    }),\n    [boardContainerElement],\n  );\n\n  return (\n    <ChessGameContext.Provider value={context}>\n      <ChessGameBoardContainerContext.Provider value={boardContainerContext}>\n        <ThemeProvider theme={mergedTheme}>{children}</ThemeProvider>\n      </ChessGameBoardContainerContext.Provider>\n    </ChessGameContext.Provider>\n  );\n};\n\nRoot.displayName = \"ChessGame.Root\";\n","import React, { useEffect, useRef } from \"react\";\nimport { useOptionalChessClock } from \"@react-chess-tools/react-chess-clock\";\nimport type { TimeControlConfig } from \"@react-chess-tools/react-chess-clock\";\nimport { Chess, Color, type Move } from \"chess.js\";\n\nimport type {\n  ChessGameClockTimeoutEvent,\n  ChessGameEvent,\n  ChessGameIllegalMoveEvent,\n  ChessGameMoveEvent,\n} from \"../types/gameEvents\";\nimport { cloneGame, getCurrentFen, getGameInfo } from \"../utils/chess\";\n\nexport type useChessGameProps = {\n  fen?: string;\n  orientation?: Color;\n  /** Optional clock configuration to enable chess clock functionality */\n  timeControl?: TimeControlConfig;\n  /** Automatically switch the clock after each move (default: true).\n   * Set to false to let players manually press the clock, mimicking real-life over-the-board play. */\n  autoSwitchOnMove?: boolean;\n};\n\nexport const useChessGame = ({\n  fen,\n  orientation: initialOrientation,\n  timeControl,\n  autoSwitchOnMove = true,\n}: useChessGameProps = {}) => {\n  // Track initial FEN as state for reactive updates in useMemo\n  const [initialFen, setInitialFen] = React.useState(fen);\n  // Mount guard to skip the fen effect on first render (game already initialized)\n  const isMounted = useRef(false);\n\n  const [game, setGame] = React.useState(() => {\n    try {\n      return new Chess(fen);\n    } catch (e) {\n      console.error(\"Invalid FEN:\", fen, e);\n      return new Chess();\n    }\n  });\n\n  const [orientation, setOrientation] = React.useState<Color>(\n    initialOrientation ?? \"w\",\n  );\n  const [currentMoveIndex, setCurrentMoveIndex] = React.useState(-1);\n  const [gameEvent, setGameEvent] = React.useState<ChessGameEvent | null>(null);\n  const gameEventIdRef = React.useRef(0);\n  // Incremented every time a new position is loaded (fen prop change or\n  // setPosition), but not on moves. Consumers can key the board on it to\n  // discard in-flight move animations that would replay over the new position\n  const [positionId, setPositionId] = React.useState(0);\n\n  // Sync game state when fen prop changes (skip on mount to avoid double initialization)\n  useEffect(() => {\n    if (!isMounted.current) {\n      isMounted.current = true;\n      return;\n    }\n    try {\n      const newGame = new Chess(fen);\n      setInitialFen(fen);\n      setGame(newGame);\n      setCurrentMoveIndex(-1); // Reset move navigation when position changes externally\n      setPositionId((id) => id + 1);\n    } catch (e) {\n      console.error(\"Invalid FEN:\", fen, e);\n      setInitialFen(undefined);\n      setGame(new Chess());\n      setCurrentMoveIndex(-1);\n      setPositionId((id) => id + 1);\n    }\n  }, [fen]);\n\n  // Sync orientation when prop changes\n  useEffect(() => {\n    if (initialOrientation !== undefined) {\n      setOrientation(initialOrientation);\n    }\n  }, [initialOrientation]);\n\n  const history = React.useMemo(() => game.history(), [game]);\n  // Empty history: length - 1 is -1, which matches the initial index.\n  // After moves, goToStart() writes -1 for the starting FEN — that is review,\n  // not the live position, so it must not count as latest.\n  const isLatestMove = currentMoveIndex === history.length - 1;\n\n  const info = React.useMemo(\n    () => getGameInfo(game, orientation),\n    [game, orientation],\n  );\n\n  const currentFen = React.useMemo(\n    () => getCurrentFen(initialFen, game, currentMoveIndex),\n    [initialFen, game, currentMoveIndex],\n  );\n\n  const currentPosition = game.history()[currentMoveIndex];\n\n  const clockState = useOptionalChessClock(timeControl);\n  const isPlayable = !info.isGameOver && (clockState?.timeout ?? null) === null;\n\n  // Keep clockState in a ref to avoid re-creating makeMove on every clock tick.\n  // The clock state object is recreated on every render (especially during active\n  // ticking), which would defeat the useCallback memoization.\n  const clockStateRef = useRef(clockState);\n  clockStateRef.current = clockState;\n  const previousTimeoutRef = React.useRef(clockState?.timeout ?? null);\n\n  const emitGameEvent = React.useCallback(\n    (\n      event:\n        | Omit<ChessGameMoveEvent, \"id\">\n        | Omit<ChessGameIllegalMoveEvent, \"id\">\n        | Omit<ChessGameClockTimeoutEvent, \"id\">,\n    ) => {\n      gameEventIdRef.current += 1;\n      setGameEvent({\n        ...event,\n        id: gameEventIdRef.current,\n      });\n    },\n    [],\n  );\n\n  useEffect(() => {\n    const timeout = clockState?.timeout ?? null;\n\n    if (previousTimeoutRef.current === null && timeout !== null) {\n      emitGameEvent({\n        type: \"clock-timeout\",\n        player: timeout,\n      });\n    }\n\n    previousTimeoutRef.current = timeout;\n  }, [clockState?.timeout, emitGameEvent]);\n\n  const getGameEventForMove = React.useCallback(\n    (nextGame: Chess, moveResult: Move): Omit<ChessGameMoveEvent, \"id\"> => ({\n      type: \"move-made\",\n      move: moveResult,\n      fen: nextGame.fen(),\n      isCheck: nextGame.isCheck(),\n      isCheckmate: nextGame.isCheckmate(),\n      isDraw: nextGame.isDraw(),\n    }),\n    [],\n  );\n\n  const setPosition = React.useCallback((fen: string, orientation: Color) => {\n    try {\n      const newGame = new Chess();\n      newGame.load(fen);\n      setInitialFen(fen); // Update state when position is set imperatively\n      setOrientation(orientation);\n      setGame(newGame);\n      setCurrentMoveIndex(-1);\n      setPositionId((id) => id + 1);\n    } catch (e) {\n      console.error(\"Failed to load FEN:\", fen, e);\n    }\n  }, []);\n\n  const makeMove = React.useCallback(\n    (move: Parameters<Chess[\"move\"]>[0]): boolean => {\n      // Only allow moves when we're at the latest position\n      if (!isLatestMove) {\n        return false;\n      }\n\n      // Access clock state via ref to avoid stale closures while keeping\n      // the callback stable (not re-created on every clock tick)\n      const clock = clockStateRef.current;\n\n      // Don't allow moves after clock timeout\n      if (clock && clock.timeout !== null) {\n        return false;\n      }\n\n      try {\n        const copy = cloneGame(game);\n        const moveResult = copy.move(move);\n        setGame(copy);\n        setCurrentMoveIndex(copy.history().length - 1);\n        emitGameEvent(getGameEventForMove(copy, moveResult));\n\n        // Auto-start clock on first move\n        if (clock && clock.status === \"idle\") {\n          clock.methods.start();\n        }\n\n        // Pause clock on game over (checked immediately after move)\n        if (clock && clock.status === \"running\" && copy.isGameOver()) {\n          clock.methods.pause();\n        }\n\n        // Auto-switch clock after a move is made if enabled\n        if (autoSwitchOnMove && clock && clock.status !== \"finished\") {\n          clock.methods.switch();\n        }\n\n        return true;\n      } catch (e) {\n        emitGameEvent({\n          type: \"illegal-move\",\n          attemptedMove: move,\n        });\n        return false;\n      }\n    },\n    [isLatestMove, game, autoSwitchOnMove, emitGameEvent, getGameEventForMove],\n  );\n\n  const flipBoard = React.useCallback(() => {\n    setOrientation((orientation) => (orientation === \"w\" ? \"b\" : \"w\"));\n  }, []);\n\n  const goToMove = React.useCallback(\n    (moveIndex: number) => {\n      if (moveIndex < -1 || moveIndex >= history.length) return;\n      setCurrentMoveIndex(moveIndex);\n    },\n    [history.length],\n  );\n\n  const goToStart = React.useCallback(() => goToMove(-1), [goToMove]);\n  const goToEnd = React.useCallback(\n    () => goToMove(history.length - 1),\n    [goToMove, history.length],\n  );\n  const goToPreviousMove = React.useCallback(\n    () => goToMove(currentMoveIndex - 1),\n    [goToMove, currentMoveIndex],\n  );\n  const goToNextMove = React.useCallback(\n    () => goToMove(currentMoveIndex + 1),\n    [goToMove, currentMoveIndex],\n  );\n\n  const methods = React.useMemo(\n    () => ({\n      makeMove,\n      setPosition,\n      flipBoard,\n      goToMove,\n      goToStart,\n      goToEnd,\n      goToPreviousMove,\n      goToNextMove,\n    }),\n    [\n      makeMove,\n      setPosition,\n      flipBoard,\n      goToMove,\n      goToStart,\n      goToEnd,\n      goToPreviousMove,\n      goToNextMove,\n    ],\n  );\n\n  return {\n    game,\n    currentFen,\n    currentPosition,\n    orientation,\n    currentMoveIndex,\n    isLatestMove,\n    isPlayable,\n    positionId,\n    info,\n    gameEvent,\n    methods,\n    clock: clockState,\n  };\n};\n","import { Chess, Color, Square } from \"chess.js\";\nimport _ from \"lodash\";\n\n/**\n * Creates a clone of the given Chess.js instance. This is needed to update the state\n * of react-chessboard component\n * @param game - The Chess.js instance to clone.\n * @returns A new Chess.js instance with the same state as the original.\n */\nexport const cloneGame = (game: Chess) => {\n  try {\n    const copy = new Chess();\n    const pgn = game?.pgn();\n    if (pgn) {\n      copy.loadPgn(pgn);\n    }\n    return copy;\n  } catch (e) {\n    console.error(\"Failed to clone game:\", e);\n    return new Chess();\n  }\n};\n\n/**\n * Returns an object with information about the current state of the game. This can be determined\n * using chess.js instance, but this function is provided for convenience.\n * @param game - The Chess.js instance representing the game.\n * @returns An object with information about the current state of the game.\n */\n\nexport const getGameInfo = (game: Chess, orientation: Color) => {\n  const turn = game.turn();\n  const isPlayerTurn = turn === orientation;\n  const isOpponentTurn = !isPlayerTurn;\n  const moveNumber = game.history().length;\n  const lastMove = _.last(game.history({ verbose: true }));\n  const isCheck = game.isCheck();\n  const isCheckmate = game.isCheckmate();\n  const isDraw = game.isDraw();\n  const isStalemate = game.isStalemate();\n  const isThreefoldRepetition = game.isThreefoldRepetition();\n  const isInsufficientMaterial = game.isInsufficientMaterial();\n  const isGameOver = game.isGameOver();\n  const hasPlayerWon = isOpponentTurn && isGameOver && !isDraw;\n  const hasPlayerLost = isPlayerTurn && isGameOver && !isDraw;\n  const isDrawn = game.isDraw();\n  return {\n    turn,\n    isPlayerTurn,\n    isOpponentTurn,\n    moveNumber,\n    lastMove,\n    isCheck,\n    isCheckmate,\n    isDraw,\n    isStalemate,\n    isThreefoldRepetition,\n    isInsufficientMaterial,\n    isGameOver,\n    isDrawn,\n    hasPlayerWon,\n    hasPlayerLost,\n  };\n};\n\nexport type GameInfo = ReturnType<typeof getGameInfo>;\n\nexport const isLegalMove = (\n  game: Chess,\n  move: Parameters<Chess[\"move\"]>[0],\n) => {\n  try {\n    const copy = cloneGame(game);\n    copy.move(move);\n    return true;\n  } catch (e) {\n    return false;\n  }\n};\n\nexport const requiresPromotion = (\n  game: Chess,\n  move: Parameters<Chess[\"move\"]>[0],\n) => {\n  if (!game) {\n    throw new Error(\"Game is required\");\n  }\n\n  try {\n    const copy = cloneGame(game);\n    const result = copy.move(move);\n\n    return result.flags.indexOf(\"p\") !== -1;\n  } catch (e) {\n    if (e instanceof Error && e.message.includes(\"Invalid move\")) {\n      return false;\n    }\n    throw e;\n  }\n};\n\nexport const getDestinationSquares = (game: Chess, square: Square) => {\n  const moves = game.moves({ square, verbose: true });\n  return moves.map((move) => move.to);\n};\n\nexport const getCurrentFen = (\n  fen: string | undefined,\n  game: Chess,\n  currentMoveIndex: number,\n) => {\n  const tempGame = new Chess();\n  if (currentMoveIndex === -1) {\n    if (fen) {\n      try {\n        tempGame.load(fen);\n      } catch (e) {\n        console.error(\"Failed to load FEN in getCurrentFen:\", fen, e);\n      }\n    }\n  } else {\n    const moves = game.history().slice(0, currentMoveIndex + 1);\n\n    if (fen) {\n      try {\n        tempGame.load(fen);\n      } catch (e) {\n        console.error(\"Failed to load FEN in getCurrentFen:\", fen, e);\n      }\n    }\n    moves.forEach((move) => tempGame.move(move));\n  }\n  return tempGame.fen();\n};\n","import React from \"react\";\n\nexport type ChessGameBoardContainerContextType = {\n  boardContainerRef: React.RefObject<HTMLDivElement | null>;\n  boardContainerElement: HTMLDivElement | null;\n  setBoardContainerElement: (node: HTMLDivElement | null) => void;\n};\n\nexport const ChessGameBoardContainerContext =\n  React.createContext<ChessGameBoardContainerContextType | null>(null);\n\nexport const useChessGameBoardContainerContext = () => {\n  const context = React.useContext(ChessGameBoardContainerContext);\n  if (!context) {\n    throw new Error(\n      \"useChessGameBoardContainerContext must be used within a ChessGame.Root component.\",\n    );\n  }\n  return context;\n};\n","import React from \"react\";\nimport { useChessGame } from \"./useChessGame\";\n\nexport const ChessGameContext = React.createContext<ReturnType<\n  typeof useChessGame\n> | null>(null);\n\nexport const useChessGameContext = () => {\n  const context = React.useContext(ChessGameContext);\n  if (!context) {\n    throw new Error(\n      `useChessGameContext must be used within a ChessGame component. Make sure your component is wrapped with <ChessGame.Root> or ensure the ChessGame component is properly rendered in the component tree.`,\n    );\n  }\n  return context;\n};\n\nexport type ChessGameContextType = ReturnType<typeof useChessGame>;\n","import React, { createContext, useContext } from \"react\";\nimport type { ChessGameTheme } from \"./types\";\nimport { defaultGameTheme } from \"./defaults\";\n\n/**\n * Context for ChessGame theme\n */\nexport const ChessGameThemeContext =\n  createContext<ChessGameTheme>(defaultGameTheme);\n\n/**\n * Hook to access the current ChessGame theme.\n * Returns the default theme if no ThemeProvider is present.\n */\nexport const useChessGameTheme = (): ChessGameTheme => {\n  return useContext(ChessGameThemeContext);\n};\n\nexport interface ThemeProviderProps {\n  theme: ChessGameTheme;\n  children: React.ReactNode;\n}\n\n/**\n * Internal provider component used by Root when a theme prop is provided.\n * This is not exported directly - users pass theme via Root's theme prop.\n */\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\n  theme,\n  children,\n}) => {\n  return (\n    <ChessGameThemeContext.Provider value={theme}>\n      {children}\n    </ChessGameThemeContext.Provider>\n  );\n};\n","import type { ChessGameTheme } from \"./types\";\n\n/**\n * Default theme for ChessGame component.\n * These values match the original hardcoded colors for backward compatibility.\n */\nexport const defaultGameTheme: ChessGameTheme = {\n  board: {\n    lightSquare: { backgroundColor: \"#f0d9b5\" },\n    darkSquare: { backgroundColor: \"#b58863\" },\n  },\n  state: {\n    lastMove: \"rgba(255, 255, 0, 0.5)\",\n    check: \"rgba(255, 0, 0, 0.5)\",\n    activeSquare: \"rgba(255, 255, 0, 0.5)\",\n    dropSquare: { backgroundColor: \"rgba(255, 255, 0, 0.4)\" },\n  },\n  indicators: {\n    move: \"rgba(0, 0, 0, 0.1)\",\n    capture: \"rgba(1, 0, 0, 0.1)\",\n  },\n};\n","import { merge } from \"lodash\";\nimport type { ChessGameTheme, PartialChessGameTheme } from \"./types\";\nimport { defaultGameTheme } from \"./defaults\";\n\n/**\n * Deep merges a partial theme with the default theme.\n * Allows users to override only specific theme properties while keeping defaults for the rest.\n *\n * @param partialTheme - Partial theme with only the properties to override\n * @returns Complete theme with overridden properties merged with defaults\n *\n * @example\n * ```typescript\n * const customTheme = mergeTheme({\n *   state: { lastMove: \"rgba(100, 200, 100, 0.6)\" }\n * });\n * // Returns full theme with only lastMove color changed\n * ```\n */\nexport const mergeTheme = (\n  partialTheme?: PartialChessGameTheme,\n): ChessGameTheme => {\n  if (!partialTheme) {\n    return { ...defaultGameTheme };\n  }\n\n  return merge({}, defaultGameTheme, partialTheme);\n};\n\n/**\n * Deep merges a partial theme with a base theme.\n * Useful when extending an existing theme.\n *\n * @param baseTheme - The base theme to extend\n * @param partialTheme - Partial theme with properties to override\n * @returns Complete theme with overridden properties\n */\nexport const mergeThemeWith = (\n  baseTheme: ChessGameTheme,\n  partialTheme?: PartialChessGameTheme,\n): ChessGameTheme => {\n  if (!partialTheme) {\n    return { ...baseTheme };\n  }\n\n  return merge({}, baseTheme, partialTheme);\n};\n","import React from \"react\";\nimport {\n  Chessboard,\n  ChessboardOptions,\n  defaultPieces,\n  chessColumnToColumnIndex,\n} from \"react-chessboard\";\nimport { Chess, Move, Square } from \"chess.js\";\nimport {\n  getCustomSquareStyles,\n  deepMergeChessboardOptions,\n} from \"../../../utils/board\";\nimport {\n  getGameInfo,\n  isLegalMove,\n  requiresPromotion,\n} from \"../../../utils/chess\";\nimport { useChessGameBoardContainerContext } from \"../../../hooks/useChessGameBoardContainerContext\";\nimport { useChessGameContext } from \"../../../hooks/useChessGameContext\";\nimport { useChessGameTheme } from \"../../../theme/context\";\n\nexport interface ChessGameProps extends React.HTMLAttributes<HTMLDivElement> {\n  options?: ChessboardOptions;\n}\n\nexport const Board = React.forwardRef<HTMLDivElement, ChessGameProps>(\n  (\n    {\n      options = {},\n      className,\n      style: userStyle,\n      onPointerDownCapture,\n      tabIndex = 0,\n      ...rest\n    },\n    ref,\n  ) => {\n    const gameContext = useChessGameContext();\n    const { boardContainerRef, setBoardContainerElement } =\n      useChessGameBoardContainerContext();\n    const theme = useChessGameTheme();\n\n    if (!gameContext) {\n      throw new Error(\"ChessGameContext not found\");\n    }\n\n    const {\n      game,\n      currentFen,\n      orientation,\n      info,\n      isLatestMove,\n      isPlayable,\n      positionId,\n      currentMoveIndex,\n      methods: { makeMove },\n    } = gameContext;\n\n    // While reviewing history the board renders `currentFen`, so the highlights\n    // must describe that position, not the live one.\n    const currentGame = isLatestMove ? game : new Chess(currentFen);\n    const currentInfo = isLatestMove\n      ? info\n      : {\n          ...getGameInfo(currentGame, orientation),\n          lastMove: game.history({ verbose: true })[currentMoveIndex],\n        };\n\n    const { turn } = info;\n\n    const [activeSquare, setActiveSquare] = React.useState<Square | null>(null);\n\n    const [promotionMove, setPromotionMove] =\n      React.useState<Partial<Move> | null>(null);\n\n    // Track square width for responsive updates\n    const [squareWidth, setSquareWidth] = React.useState(80);\n\n    const focusBoardContainer = React.useCallback(() => {\n      boardContainerRef.current?.focus({ preventScroll: true });\n    }, [boardContainerRef]);\n\n    const setBoardContainerRef = React.useCallback(\n      (node: HTMLDivElement | null) => {\n        boardContainerRef.current = node;\n        setBoardContainerElement(node);\n\n        if (typeof ref === \"function\") {\n          ref(node);\n          return;\n        }\n\n        if (ref) {\n          ref.current = node;\n        }\n      },\n      [boardContainerRef, ref, setBoardContainerElement],\n    );\n\n    const handlePointerDownCapture = React.useCallback(\n      (event: React.PointerEvent<HTMLDivElement>) => {\n        onPointerDownCapture?.(event);\n\n        if (!event.defaultPrevented) {\n          focusBoardContainer();\n        }\n      },\n      [focusBoardContainer, onPointerDownCapture],\n    );\n\n    const onSquareClick = (square: Square) => {\n      focusBoardContainer();\n\n      // During history review the live game and the rendered position differ:\n      // selecting would paint legal-move dots for a position the user can't see\n      if (!isPlayable || !isLatestMove) {\n        return;\n      }\n\n      if (activeSquare === null) {\n        const squadreInfo = game.get(square);\n        if (squadreInfo && squadreInfo.color === turn) {\n          return setActiveSquare(square);\n        }\n        return;\n      }\n\n      // Deselecting (clicking an unreachable square) is not an attempted\n      // move: it must not emit an illegal-move event\n      if (\n        !isLegalMove(game, {\n          from: activeSquare,\n          to: square,\n          promotion: \"q\",\n        })\n      ) {\n        return setActiveSquare(null);\n      }\n\n      if (\n        requiresPromotion(game, {\n          from: activeSquare,\n          to: square,\n          promotion: \"q\",\n        })\n      ) {\n        return setPromotionMove({\n          from: activeSquare,\n          to: square,\n        });\n      }\n\n      setActiveSquare(null);\n      void makeMove({\n        from: activeSquare,\n        to: square,\n      });\n    };\n\n    const onPromotionPieceSelect = (piece: string): void => {\n      focusBoardContainer();\n\n      if (promotionMove?.from && promotionMove?.to) {\n        makeMove({\n          from: promotionMove.from,\n          to: promotionMove.to,\n          promotion: piece.toLowerCase(),\n        });\n        setPromotionMove(null);\n      }\n    };\n\n    const onSquareRightClick = () => {\n      focusBoardContainer();\n      setActiveSquare(null);\n      setPromotionMove(null);\n    };\n\n    // Use ResizeObserver for responsive square width updates\n    React.useEffect(() => {\n      if (typeof window === \"undefined\" || !boardContainerRef.current) return;\n\n      const updateSquareWidth = () => {\n        const squareElement =\n          boardContainerRef.current?.querySelector(\"[data-square]\");\n        if (squareElement) {\n          setSquareWidth(squareElement.getBoundingClientRect().width);\n        }\n      };\n\n      // Initial measurement\n      updateSquareWidth();\n\n      // Only use ResizeObserver if available (not in all test environments)\n      if (typeof ResizeObserver !== \"undefined\" && boardContainerRef.current) {\n        const observer = new ResizeObserver(updateSquareWidth);\n        observer.observe(boardContainerRef.current);\n        return () => observer.disconnect();\n      }\n    }, []);\n\n    // Calculate promotion square position\n    const promotionSquareLeft = React.useMemo(() => {\n      if (!promotionMove?.to) return 0;\n      const column = promotionMove.to.match(/^[a-h]/)?.[0] ?? \"a\";\n      return (\n        squareWidth *\n        chessColumnToColumnIndex(\n          column,\n          8,\n          orientation === \"b\" ? \"black\" : \"white\",\n        )\n      );\n    }, [promotionMove, squareWidth, orientation]);\n\n    const baseOptions: ChessboardOptions = {\n      squareStyles: getCustomSquareStyles(\n        currentGame,\n        currentInfo,\n        activeSquare,\n        theme,\n      ),\n      boardOrientation: orientation === \"b\" ? \"black\" : \"white\",\n      position: currentFen,\n      showNotation: true,\n      showAnimations: isLatestMove,\n      lightSquareStyle: theme.board.lightSquare,\n      darkSquareStyle: theme.board.darkSquare,\n      canDragPiece: ({ piece }) => {\n        if (!isPlayable || !isLatestMove) return false;\n        return piece.pieceType[0] === turn;\n      },\n      dropSquareStyle: theme.state.dropSquare,\n      onPieceDrag: ({ piece, square }) => {\n        focusBoardContainer();\n        if (piece.pieceType[0] === turn) {\n          setActiveSquare(square as Square);\n        }\n      },\n      // Escape / right-click cancel does not call onPieceDrop (5.12). Clear\n      // the drag selection so move dots do not stay on the board.\n      onPieceDragCancel: () => {\n        focusBoardContainer();\n        setActiveSquare(null);\n      },\n      onPieceDrop: ({ sourceSquare, targetSquare }) => {\n        focusBoardContainer();\n        setActiveSquare(null);\n\n        // Off-board drop is not a cancel; it still hits onPieceDrop with a\n        // null target. Do not treat that as an attempted move.\n        if (!targetSquare || !targetSquare.match(/^[a-h][1-8]$/)) {\n          return false;\n        }\n\n        const moveData = {\n          from: sourceSquare as Square,\n          to: targetSquare as Square,\n        };\n\n        // Check if promotion is needed\n        if (requiresPromotion(game, { ...moveData, promotion: \"q\" })) {\n          setPromotionMove(moveData);\n          return false; // Prevent the move until promotion is selected\n        }\n\n        return makeMove(moveData);\n      },\n      onSquareClick: ({ square }) => {\n        if (square.match(/^[a-h][1-8]$/)) {\n          onSquareClick(square as Square);\n        }\n      },\n      onSquareRightClick: onSquareRightClick,\n      allowDrawingArrows: true,\n      animationDurationInMs: game.history().length === 0 ? 0 : 300,\n    };\n\n    const mergedOptions = deepMergeChessboardOptions(baseOptions, options);\n\n    const mergedStyle = {\n      ...userStyle,\n      position: \"relative\" as const,\n    };\n\n    // Calculate promotion menu vertical position based on orientation\n    const isBlackOrientation = orientation === \"b\";\n    const promotionRank = promotionMove?.to?.[1];\n    const isTopRank = isBlackOrientation\n      ? promotionRank === \"1\"\n      : promotionRank === \"8\";\n\n    return (\n      <div\n        ref={setBoardContainerRef}\n        className={className}\n        style={mergedStyle}\n        tabIndex={tabIndex}\n        onPointerDownCapture={handlePointerDownCapture}\n        {...rest}\n      >\n        {/* Remounting on positionId discards react-chessboard's in-flight\n            animation timers, which would otherwise replay the previous\n            position over a newly loaded one (#83) */}\n        <Chessboard key={positionId} options={mergedOptions} />\n        {promotionMove && (\n          <>\n            {/* Backdrop overlay - click to cancel */}\n            <div\n              onClick={() => setPromotionMove(null)}\n              onContextMenu={(e) => {\n                e.preventDefault();\n                setPromotionMove(null);\n              }}\n              style={{\n                position: \"absolute\",\n                top: 0,\n                left: 0,\n                right: 0,\n                bottom: 0,\n                backgroundColor: \"rgba(0, 0, 0, 0.1)\",\n                zIndex: 1000,\n              }}\n            />\n            {/* Promotion piece selection */}\n            <div\n              style={{\n                position: \"absolute\",\n                top: isTopRank ? 0 : \"auto\",\n                bottom: isTopRank ? \"auto\" : 0,\n                left: promotionSquareLeft,\n                backgroundColor: \"white\",\n                width: squareWidth,\n                zIndex: 1001,\n                display: \"flex\",\n                flexDirection: \"column\",\n                boxShadow: \"0 0 10px 0 rgba(0, 0, 0, 0.5)\",\n              }}\n            >\n              {[\"q\", \"r\", \"n\", \"b\"].map((piece) => (\n                <button\n                  key={piece}\n                  onClick={() => onPromotionPieceSelect(piece)}\n                  onContextMenu={(e) => {\n                    e.preventDefault();\n                  }}\n                  style={{\n                    width: \"100%\",\n                    aspectRatio: \"1\",\n                    display: \"flex\",\n                    alignItems: \"center\",\n                    justifyContent: \"center\",\n                    padding: 0,\n                    border: \"none\",\n                    cursor: \"pointer\",\n                    backgroundColor: \"white\",\n                  }}\n                  onMouseEnter={(e) => {\n                    e.currentTarget.style.backgroundColor = \"#f0f0f0\";\n                  }}\n                  onMouseLeave={(e) => {\n                    e.currentTarget.style.backgroundColor = \"white\";\n                  }}\n                >\n                  {defaultPieces[\n                    `${turn}${piece.toUpperCase()}` as keyof typeof defaultPieces\n                  ]()}\n                </button>\n              ))}\n            </div>\n          </>\n        )}\n      </div>\n    );\n  },\n);\n\nBoard.displayName = \"ChessGame.Board\";\n","import { type Chess, type Square } from \"chess.js\";\nimport { type CSSProperties } from \"react\";\nimport { mergeWith } from \"lodash\";\nimport type { ChessboardOptions } from \"react-chessboard\";\nimport { getDestinationSquares, type GameInfo } from \"./chess\";\nimport type { ChessGameTheme } from \"../theme/types\";\nimport { defaultGameTheme } from \"../theme/defaults\";\n\n/**\n * Generates custom square styles based on game state and theme.\n *\n * @param game - Chess.js game instance\n * @param info - Game info containing lastMove, isCheck, turn\n * @param activeSquare - Currently selected square (if any)\n * @param theme - Theme configuration (defaults to defaultGameTheme)\n * @returns Record of square names to CSS properties\n */\nexport const getCustomSquareStyles = (\n  game: Chess,\n  info: GameInfo,\n  activeSquare: Square | null,\n  theme: ChessGameTheme = defaultGameTheme,\n) => {\n  const customSquareStyles: Record<string, CSSProperties> = {};\n\n  const { lastMove, isCheck, turn } = info;\n\n  if (lastMove) {\n    customSquareStyles[lastMove.from] = {\n      backgroundColor: theme.state.lastMove,\n    };\n    customSquareStyles[lastMove.to] = {\n      backgroundColor: theme.state.lastMove,\n    };\n  }\n\n  if (activeSquare) {\n    customSquareStyles[activeSquare] = {\n      backgroundColor: theme.state.activeSquare,\n    };\n  }\n\n  if (activeSquare) {\n    const destinationSquares = getDestinationSquares(game, activeSquare);\n    destinationSquares.forEach((square) => {\n      customSquareStyles[square] = {\n        background:\n          game.get(square) && game.get(square)?.color !== turn\n            ? `radial-gradient(circle, ${theme.indicators.capture} 85%, transparent 85%)`\n            : `radial-gradient(circle, ${theme.indicators.move} 25%, transparent 25%)`,\n      };\n    });\n  }\n\n  if (isCheck) {\n    game.board().forEach((row) => {\n      return row.forEach((square) => {\n        if (square?.type === \"k\" && square?.color === info.turn) {\n          customSquareStyles[square.square] = {\n            backgroundColor: theme.state.check,\n          };\n        }\n      });\n    });\n  }\n  return customSquareStyles;\n};\n\n/**\n * Smart deep merge for ChessboardOptions that handles different property types appropriately:\n * - Functions: Overwrite (custom functions replace base functions)\n * - Objects: Deep merge (nested objects merge recursively)\n * - Primitives: Overwrite (custom values replace base values)\n *\n * This ensures that computed options (like squareStyles with move highlighting) are preserved\n * while allowing custom options to extend or override them intelligently.\n *\n * @param baseOptions - The computed base options (e.g., computed squareStyles, event handlers)\n * @param customOptions - Custom options provided by the user\n * @returns Intelligently merged ChessboardOptions\n */\nexport const deepMergeChessboardOptions = (\n  baseOptions: ChessboardOptions,\n  customOptions?: Partial<ChessboardOptions>,\n): ChessboardOptions => {\n  if (!customOptions) {\n    return { ...baseOptions }; // Return a new object even when no custom options\n  }\n\n  return mergeWith({}, baseOptions, customOptions, (_objValue, srcValue) => {\n    // Functions should always overwrite (not merge)\n    // This is important for event handlers like onSquareClick, onPieceDrop, etc.\n    if (typeof srcValue === \"function\") {\n      return srcValue;\n    }\n\n    // For arrays, we typically want to overwrite rather than merge\n    // This avoids unexpected behavior with array concatenation\n    if (Array.isArray(srcValue)) {\n      return srcValue;\n    }\n\n    // Let lodash handle objects with default deep merge behavior\n    // This will properly merge nested objects like squareStyles, dropSquareStyle, etc.\n    return undefined; // Use default merge behavior\n  });\n};\n","import { useMemo } from \"react\";\n\nimport { useBoardSounds } from \"../../../hooks/useBoardSounds\";\nimport { type AudioOverrides, AUDIO_EVENT_NAMES } from \"../../../types/audio\";\nimport { resolveAudioSources } from \"../../../utils/audioManager\";\n\n/**\n * Props for the Sounds component\n *\n * Note: This is a logic-only component that returns null and does not render\n * any DOM elements. It sets up board sounds via the useBoardSounds hook.\n * Therefore, it does not accept HTML attributes like className, style, etc.\n */\nexport type SoundsProps = {\n  sounds?: AudioOverrides;\n};\n\nexport const Sounds: React.FC<SoundsProps> = ({ sounds }) => {\n  const resolvedSources = useMemo(\n    () => resolveAudioSources(sounds),\n    AUDIO_EVENT_NAMES.map((eventName) => sounds?.[eventName]),\n  );\n\n  useBoardSounds(resolvedSources);\n  return null;\n};\n\nSounds.displayName = \"ChessGame.Sounds\";\n","import { useEffect, useRef } from \"react\";\n\nimport { type AudioEventName, type ResolvedAudioSources } from \"../types/audio\";\nimport { type ChessGameEvent } from \"../types/gameEvents\";\nimport { createAudioManager, type AudioManager } from \"../utils/audioManager\";\nimport { useChessGameContext } from \"./useChessGameContext\";\n\nconst getAudioEventForGameEvent = (\n  gameEvent: ChessGameEvent,\n): AudioEventName => {\n  if (gameEvent.type === \"illegal-move\") {\n    return \"illegalMove\";\n  }\n\n  if (gameEvent.type === \"clock-timeout\") {\n    return \"timeout\";\n  }\n\n  if (gameEvent.isCheckmate) {\n    return \"checkmate\";\n  }\n\n  if (gameEvent.isDraw) {\n    return \"draw\";\n  }\n\n  if (gameEvent.move.promotion) {\n    return \"promotion\";\n  }\n\n  if (\n    gameEvent.move.flags.includes(\"k\") ||\n    gameEvent.move.flags.includes(\"q\")\n  ) {\n    return \"castle\";\n  }\n\n  if (gameEvent.move.captured) {\n    return \"capture\";\n  }\n\n  if (gameEvent.isCheck) {\n    return \"check\";\n  }\n\n  return \"move\";\n};\n\nexport const useBoardSounds = (sources: ResolvedAudioSources) => {\n  const { gameEvent } = useChessGameContext();\n  const audioManagerRef = useRef<AudioManager | null>(null);\n  // Events emitted before mount must not replay when the hook mounts mid-game\n  const lastHandledEventIdRef = useRef(gameEvent?.id ?? null);\n\n  useEffect(() => {\n    const audioManager = createAudioManager(sources);\n    audioManagerRef.current = audioManager;\n\n    return () => {\n      audioManager.destroy();\n\n      if (audioManagerRef.current === audioManager) {\n        audioManagerRef.current = null;\n      }\n    };\n  }, [sources]);\n\n  useEffect(() => {\n    if (!gameEvent || gameEvent.id === lastHandledEventIdRef.current) {\n      return;\n    }\n\n    lastHandledEventIdRef.current = gameEvent.id;\n    audioManagerRef.current?.play(getAudioEventForGameEvent(gameEvent));\n  }, [gameEvent]);\n};\n","import captureSound from \"./audio/capture.ogg\";\nimport silenceSound from \"./audio/silence.ogg\";\nimport moveSound from \"./audio/move.ogg\";\nimport notifySound from \"./audio/notify.ogg\";\nimport timeoutSound from \"./audio/timeout.ogg\";\n\nimport { type ResolvedAudioSources } from \"../types/audio\";\n\n// Sound mappings based on lichess audio:\n// - move, check, castle, promotion → Move.ogg (all are moves)\n// - capture → Capture.ogg\n// - checkmate, draw → GenericNotify.ogg (renamed to notify.ogg)\n// - timeout → LowTime.ogg (renamed to timeout.ogg)\n// - illegalMove → Silence.ogg from lichess (silent for invalid moves)\nexport const defaultSoundSources: ResolvedAudioSources = {\n  move: moveSound,\n  capture: captureSound,\n  check: moveSound,\n  checkmate: notifySound,\n  draw: notifySound,\n  timeout: timeoutSound,\n  castle: moveSound,\n  promotion: moveSound,\n  illegalMove: silenceSound,\n};\n","export const AUDIO_EVENT_NAMES = [\n  \"move\",\n  \"capture\",\n  \"check\",\n  \"checkmate\",\n  \"draw\",\n  \"timeout\",\n  \"castle\",\n  \"promotion\",\n  \"illegalMove\",\n] as const;\n\nexport type AudioEventName = (typeof AUDIO_EVENT_NAMES)[number];\n\nexport type AudioOverrides = Partial<Record<AudioEventName, string>>;\n\nexport type ResolvedAudioSources = Record<AudioEventName, string>;\n","import { defaultSoundSources } from \"../assets/sounds\";\nimport {\n  AUDIO_EVENT_NAMES,\n  type AudioEventName,\n  type AudioOverrides,\n  type ResolvedAudioSources,\n} from \"../types/audio\";\n\nexport interface AudioManager {\n  play: (eventName: AudioEventName) => void;\n  destroy: () => void;\n}\n\nconst createNoopAudioManager = (): AudioManager => ({\n  play: () => {},\n  destroy: () => {},\n});\n\nconst canUseAudioElement = () =>\n  typeof window !== \"undefined\" && typeof Audio !== \"undefined\";\n\nexport const resolveAudioSources = (\n  overrides?: AudioOverrides,\n): ResolvedAudioSources => ({\n  ...defaultSoundSources,\n  ...overrides,\n});\n\nexport const createAudioManager = (\n  sources: ResolvedAudioSources,\n): AudioManager => {\n  if (!canUseAudioElement()) {\n    return createNoopAudioManager();\n  }\n\n  const audioElements = Object.fromEntries(\n    AUDIO_EVENT_NAMES.map((eventName) => {\n      const audioElement = new Audio(sources[eventName]);\n      audioElement.preload = \"auto\";\n\n      return [eventName, audioElement];\n    }),\n  ) as Record<AudioEventName, HTMLAudioElement>;\n\n  return {\n    play: (eventName) => {\n      const audioElement = audioElements[eventName];\n\n      if (!audioElement) {\n        return;\n      }\n\n      try {\n        audioElement.currentTime = 0;\n        void audioElement.play().catch(() => {});\n      } catch {\n        // Ignore playback failures such as autoplay restrictions.\n      }\n    },\n    destroy: () => {\n      Object.values(audioElements).forEach((audioElement) => {\n        try {\n          audioElement.pause();\n          audioElement.removeAttribute(\"src\");\n          audioElement.load();\n        } catch {\n          // Ignore cleanup failures in partial browser/test environments.\n        }\n      });\n    },\n  };\n};\n","import { useEffect, useRef, type RefObject } from \"react\";\nimport {\n  defaultKeyboardControls,\n  KeyboardControls,\n} from \"../components/ChessGame/parts/KeyboardControls\";\nimport { useChessGameContext } from \"./useChessGameContext\";\n\nexport type UseKeyboardControlsOptions = {\n  controls?: KeyboardControls;\n  /**\n   * Optional container ref to scope keyboard handling to a specific board.\n   * Keyboard events only trigger when focus is within this container.\n   */\n  containerRef?: RefObject<HTMLElement | null>;\n};\n\nexport const useKeyboardControls = (options?: UseKeyboardControlsOptions) => {\n  const controls = options?.controls;\n  const containerRef = options?.containerRef;\n\n  const gameContext = useChessGameContext();\n  if (!gameContext) {\n    throw new Error(\"ChessGameContext not found\");\n  }\n  const keyboardControls = { ...defaultKeyboardControls, ...controls };\n\n  // Use ref to store controls to avoid stale closure issues\n  const controlsRef = useRef(keyboardControls);\n  controlsRef.current = keyboardControls;\n\n  useEffect(() => {\n    const handleKeyDown = (event: KeyboardEvent) => {\n      const activeElement = document.activeElement as HTMLElement | null;\n\n      // If containerRef is provided, only respond when focus is within that container\n      if (containerRef) {\n        const containerElement = containerRef.current;\n        const isWithinContainer =\n          !!containerElement &&\n          !!activeElement &&\n          containerElement.contains(activeElement);\n        if (!isWithinContainer) {\n          return;\n        }\n      }\n\n      // Ignore events from editable elements using the proper isContentEditable property\n      // This handles contenteditable=\"true\", \"plaintext-only\", and inherited editability\n      if (activeElement?.isContentEditable) {\n        return;\n      }\n\n      // Also ignore input and textarea elements\n      if (\n        activeElement instanceof HTMLInputElement ||\n        activeElement instanceof HTMLTextAreaElement ||\n        activeElement instanceof HTMLSelectElement\n      ) {\n        return;\n      }\n\n      const handler = controlsRef.current[event.key];\n      if (handler) {\n        event.preventDefault();\n        handler(gameContext);\n      }\n    };\n    window.addEventListener(\"keydown\", handleKeyDown);\n    return () => {\n      window.removeEventListener(\"keydown\", handleKeyDown);\n    };\n  }, [gameContext, containerRef]);\n  return null;\n};\n","import type { FC, RefObject } from \"react\";\nimport { useChessGameBoardContainerContext } from \"../../../hooks/useChessGameBoardContainerContext\";\nimport { ChessGameContextType } from \"../../../hooks/useChessGameContext\";\nimport { useKeyboardControls } from \"../../../hooks/useKeyboardControls\";\n\nexport type KeyboardControls = Record<\n  string,\n  (context: ChessGameContextType) => void\n>;\n\nexport const defaultKeyboardControls: KeyboardControls = {\n  ArrowLeft: (context) => context.methods.goToPreviousMove(),\n  ArrowRight: (context) => context.methods.goToNextMove(),\n  ArrowUp: (context) => context.methods.goToStart(),\n  ArrowDown: (context) => context.methods.goToEnd(),\n  Home: (context) => context.methods.goToStart(),\n  End: (context) => context.methods.goToEnd(),\n  f: (context) => context.methods.flipBoard(),\n  F: (context) => context.methods.flipBoard(),\n};\n\n/**\n * Props for the KeyboardControls component\n *\n * Note: This is a logic-only component that returns null and does not render\n * any DOM elements. It sets up keyboard controls via the useKeyboardControls hook.\n * Therefore, it does not accept HTML attributes like className, style, etc.\n */\ntype KeyboardControlsProps = {\n  controls?: KeyboardControls;\n  /**\n   * Optional ref to a container element to scope keyboard handling.\n   * When omitted, the controls automatically scope to the ChessGame.Board rendered\n   * within the same ChessGame.Root. Pass a custom ref to override that behavior.\n   */\n  containerRef?: RefObject<HTMLElement | null>;\n};\n\nexport const KeyboardControls: FC<KeyboardControlsProps> = ({\n  controls,\n  containerRef,\n}) => {\n  const { boardContainerElement, boardContainerRef } =\n    useChessGameBoardContainerContext();\n\n  useKeyboardControls({\n    controls,\n    containerRef:\n      containerRef ?? (boardContainerElement ? boardContainerRef : undefined),\n  });\n  return null;\n};\n\nKeyboardControls.displayName = \"ChessGame.KeyboardControls\";\n","import React from \"react\";\nimport { useChessGameContext } from \"../../../hooks/useChessGameContext\";\nimport {\n  Display as ClockDisplay,\n  Switch as ClockSwitch,\n  PlayPause as ClockPlayPause,\n  Reset as ClockReset,\n  ChessClockContext,\n} from \"@react-chess-tools/react-chess-clock\";\nimport type {\n  ChessClockDisplayProps,\n  ChessClockControlProps,\n  ChessClockPlayPauseProps,\n  ChessClockResetProps,\n  ClockColor,\n} from \"@react-chess-tools/react-chess-clock\";\n\nexport type {\n  ChessClockDisplayProps,\n  ChessClockControlProps,\n  ChessClockPlayPauseProps,\n  ChessClockResetProps,\n  ClockColor,\n} from \"@react-chess-tools/react-chess-clock\";\n\nexport interface ClockDisplayProps extends Omit<\n  ChessClockDisplayProps,\n  \"color\"\n> {\n  color: ClockColor;\n}\n\n/**\n * ChessGame.Clock.Display - Autonomous display component\n *\n * Wraps react-chess-clock's Display component, providing clock state from ChessGame.Root context.\n * No need to pass timeControl - it's inherited from the root.\n *\n * @example\n * ```tsx\n * <ChessGame.Root timeControl={{ time: \"5+3\" }}>\n *   <ChessGame.Clock.Display color=\"white\" />\n *   <ChessGame.Board />\n *   <ChessGame.Clock.Display color=\"black\" />\n * </ChessGame.Root>\n * ```\n */\nexport const Display = React.forwardRef<HTMLDivElement, ClockDisplayProps>(\n  ({ color, ...rest }, ref) => {\n    const { clock } = useChessGameContext();\n\n    if (!clock) {\n      return null;\n    }\n\n    return (\n      <ChessClockContext.Provider value={clock}>\n        <ClockDisplay ref={ref} color={color} {...rest} />\n      </ChessClockContext.Provider>\n    );\n  },\n);\n\nDisplay.displayName = \"ChessGame.Clock.Display\";\n\n/**\n * ChessGame.Clock.Switch - Manual switch control\n *\n * Wraps react-chess-clock's Switch component, providing clock state from ChessGame.Root context.\n *\n * @example\n * ```tsx\n * <ChessGame.Root timeControl={{ time: \"5+3\" }}>\n *   <ChessGame.Clock.Switch>Switch Clock</ChessGame.Clock.Switch>\n * </ChessGame.Root>\n * ```\n */\nexport const Switch = React.forwardRef<\n  HTMLElement,\n  React.PropsWithChildren<ChessClockControlProps>\n>(({ children, ...rest }, ref) => {\n  const { clock } = useChessGameContext();\n\n  if (!clock) {\n    return null;\n  }\n\n  return (\n    <ChessClockContext.Provider value={clock}>\n      <ClockSwitch ref={ref} {...rest}>\n        {children}\n      </ClockSwitch>\n    </ChessClockContext.Provider>\n  );\n});\n\nSwitch.displayName = \"ChessGame.Clock.Switch\";\n\n/**\n * ChessGame.Clock.PlayPause - Play/pause control\n *\n * Wraps react-chess-clock's PlayPause component, providing clock state from ChessGame.Root context.\n *\n * @example\n * ```tsx\n * <ChessGame.Root timeControl={{ time: \"5+3\" }}>\n *   <ChessGame.Clock.PlayPause\n *     startContent=\"Start\"\n *     pauseContent=\"Pause\"\n *     resumeContent=\"Resume\"\n *   />\n * </ChessGame.Root>\n * ```\n */\nexport const PlayPause = React.forwardRef<\n  HTMLElement,\n  React.PropsWithChildren<ChessClockPlayPauseProps>\n>(({ children, ...rest }, ref) => {\n  const { clock } = useChessGameContext();\n\n  if (!clock) {\n    return null;\n  }\n\n  return (\n    <ChessClockContext.Provider value={clock}>\n      <ClockPlayPause ref={ref} {...rest}>\n        {children}\n      </ClockPlayPause>\n    </ChessClockContext.Provider>\n  );\n});\n\nPlayPause.displayName = \"ChessGame.Clock.PlayPause\";\n\n/**\n * ChessGame.Clock.Reset - Reset control\n *\n * Wraps react-chess-clock's Reset component, providing clock state from ChessGame.Root context.\n *\n * @example\n * ```tsx\n * <ChessGame.Root timeControl={{ time: \"5+3\" }}>\n *   <ChessGame.Clock.Reset>Reset</ChessGame.Clock.Reset>\n * </ChessGame.Root>\n * ```\n */\nexport const Reset = React.forwardRef<\n  HTMLElement,\n  React.PropsWithChildren<ChessClockResetProps>\n>(({ children, ...rest }, ref) => {\n  const { clock } = useChessGameContext();\n\n  if (!clock) {\n    return null;\n  }\n\n  return (\n    <ChessClockContext.Provider value={clock}>\n      <ClockReset ref={ref} {...rest}>\n        {children}\n      </ClockReset>\n    </ChessClockContext.Provider>\n  );\n});\n\nReset.displayName = \"ChessGame.Clock.Reset\";\n\nexport const Clock = {\n  Display,\n  Switch,\n  PlayPause,\n  Reset,\n};\n","import { Root } from \"./parts/Root\";\nimport { Board } from \"./parts/Board\";\nimport { Sounds } from \"./parts/Sounds\";\nimport { KeyboardControls } from \"./parts/KeyboardControls\";\nimport { Clock } from \"./Clock\";\n\nexport const ChessGame = {\n  Root,\n  Board,\n  Sounds,\n  KeyboardControls,\n  Clock,\n};\n","import type { ChessGameTheme } from \"./types\";\n\n/**\n * Lichess-inspired theme with green highlights\n */\nexport const lichessTheme: ChessGameTheme = {\n  board: {\n    lightSquare: { backgroundColor: \"#f0d9b5\" },\n    darkSquare: { backgroundColor: \"#b58863\" },\n  },\n  state: {\n    lastMove: \"rgba(155, 199, 0, 0.41)\",\n    check: \"rgba(255, 0, 0, 0.5)\",\n    activeSquare: \"rgba(20, 85, 30, 0.5)\",\n    dropSquare: { backgroundColor: \"rgba(20, 85, 30, 0.3)\" },\n  },\n  indicators: {\n    move: \"rgba(20, 85, 30, 0.3)\",\n    capture: \"rgba(20, 85, 30, 0.3)\",\n  },\n};\n\n/**\n * Chess.com-inspired theme with green board and yellow highlights\n */\nexport const chessComTheme: ChessGameTheme = {\n  board: {\n    lightSquare: { backgroundColor: \"#ebecd0\" },\n    darkSquare: { backgroundColor: \"#779556\" },\n  },\n  state: {\n    lastMove: \"rgba(255, 255, 0, 0.5)\",\n    check: \"rgba(255, 0, 0, 0.7)\",\n    activeSquare: \"rgba(255, 255, 0, 0.5)\",\n    dropSquare: { backgroundColor: \"rgba(255, 255, 0, 0.4)\" },\n  },\n  indicators: {\n    move: \"rgba(0, 0, 0, 0.1)\",\n    capture: \"rgba(0, 0, 0, 0.1)\",\n  },\n};\n","// Types\nexport type {\n  ChessGameTheme,\n  BoardTheme,\n  StateTheme,\n  IndicatorTheme,\n  PartialChessGameTheme,\n  DeepPartial,\n} from \"./types\";\n\n// Default theme\nexport { defaultGameTheme } from \"./defaults\";\n\n// Preset themes\nexport { lichessTheme, chessComTheme } from \"./presets\";\n\n// All themes as a single object\nimport { defaultGameTheme } from \"./defaults\";\nimport { lichessTheme, chessComTheme } from \"./presets\";\n\nexport const themes = {\n  default: defaultGameTheme,\n  lichess: lichessTheme,\n  chessCom: chessComTheme,\n} as const;\n\n// Utilities\nexport { mergeTheme, mergeThemeWith } from \"./utils\";\n\n// Context and hook\nexport {\n  ChessGameThemeContext,\n  useChessGameTheme,\n  ThemeProvider,\n} from \"./context\";\nexport type { ThemeProviderProps } from \"./context\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAkB;;;ACAlB,mBAAyC;AACzC,+BAAsC;AAEtC,IAAAC,gBAAwC;;;ACHxC,mBAAqC;AACrC,oBAAc;AAQP,IAAM,YAAY,CAAC,SAAgB;AACxC,MAAI;AACF,UAAM,OAAO,IAAI,mBAAM;AACvB,UAAM,MAAM,6BAAM;AAClB,QAAI,KAAK;AACP,WAAK,QAAQ,GAAG;AAAA,IAClB;AACA,WAAO;AAAA,EACT,SAAS,GAAG;AACV,YAAQ,MAAM,yBAAyB,CAAC;AACxC,WAAO,IAAI,mBAAM;AAAA,EACnB;AACF;AASO,IAAM,cAAc,CAAC,MAAa,gBAAuB;AAC9D,QAAM,OAAO,KAAK,KAAK;AACvB,QAAM,eAAe,SAAS;AAC9B,QAAM,iBAAiB,CAAC;AACxB,QAAM,aAAa,KAAK,QAAQ,EAAE;AAClC,QAAM,WAAW,cAAAC,QAAE,KAAK,KAAK,QAAQ,EAAE,SAAS,KAAK,CAAC,CAAC;AACvD,QAAM,UAAU,KAAK,QAAQ;AAC7B,QAAM,cAAc,KAAK,YAAY;AACrC,QAAM,SAAS,KAAK,OAAO;AAC3B,QAAM,cAAc,KAAK,YAAY;AACrC,QAAM,wBAAwB,KAAK,sBAAsB;AACzD,QAAM,yBAAyB,KAAK,uBAAuB;AAC3D,QAAM,aAAa,K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A2B,OAAO,SACjC,+BAAAA,QAAA,cAAC,0BAAAI,OAAA,EAAW,KAAW,GAAG,QACvB,QACH,CACF;AAEJ,CAAC;AAED,MAAM,cAAc;AAEb,IAAM,QAAQ;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACvKO,IAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAAC;AAAA,EACA;AACF;;;AnBRA,IAAAC,4BAA2B;;;AoBCpB,IAAM,eAA+B;AAAA,EAC1C,OAAO;AAAA,IACL,aAAa,EAAE,iBAAiB,UAAU;AAAA,IAC1C,YAAY,EAAE,iBAAiB,UAAU;AAAA,EAC3C;AAAA,EACA,OAAO;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,IACP,cAAc;AAAA,IACd,YAAY,EAAE,iBAAiB,wBAAwB;AAAA,EACzD;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;AAKO,IAAM,gBAAgC;AAAA,EAC3C,OAAO;AAAA,IACL,aAAa,EAAE,iBAAiB,UAAU;AAAA,IAC1C,YAAY,EAAE,iBAAiB,UAAU;AAAA,EAC3C;AAAA,EACA,OAAO;AAAA,IACL,UAAU;AAAA,IACV,OAAO;AAAA,IACP,cAAc;AAAA,IACd,YAAY,EAAE,iBAAiB,yBAAyB;AAAA,EAC1D;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;;;ACpBO,IAAM,SAAS;AAAA,EACpB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AACZ;","names":["import_react","import_chess","_","React","fen","orientation","import_react","React","import_react","React","import_react","React","import_lodash","React","import_react","import_chess","import_lodash","React","_a","import_react","import_react","import_react","KeyboardControls","import_react","import_react_chess_clock","React","ClockDisplay","ClockSwitch","ClockPlayPause","ClockReset","KeyboardControls","import_react_chess_clock"]}