import * as _angular_core from '@angular/core'; import { AfterViewInit, ElementRef, OnDestroy } from '@angular/core'; import { Api } from 'chessground/api'; import { Key, Color } from 'chessground/types'; import { MatDialogRef } from '@angular/material/dialog'; import { Chess } from 'chess.js'; /** * Core chessboard component wrapping the chessground library via snabbdom. * * Accepts a `runFunction` signal-model input that receives the mounted DOM element * and must return a chessground `Api` instance. The component manages lifecycle: * - Uses an Angular `effect()` to watch `runFunction` changes and redraw the board. * - Calls `redraw()` on `ngAfterViewInit` so the board appears as soon as the view is ready. * - Provides a `toggleOrientation()` method to flip the board. * * Uses {@link NgxChessgroundService} (provided at component level) for snabbdom patching * and chessground instance management. * * @example * ```html * * ``` * * @example * ```typescript * myRunFn = signal<(el: HTMLElement) => Api>((el) => { * return Chessground(el, { fen: 'start' }); * }); * ``` */ declare class NgxChessgroundComponent implements AfterViewInit { /** * Signal-based view query for the board container element. * * References the DOM element with template variable `#chessboard`. * Used by {@link redraw} to pass the native element to chessground. */ readonly elementView: _angular_core.Signal>; /** * Signal-model function that constructs the chessground instance on a given element. * * This is the primary input mechanism of the component. Changes to this signal * trigger a board redraw via the internal `effect()`. * * @param el — The board container `HTMLElement` mounted in the DOM. * @returns A chessground `Api` instance configured as desired. */ runFunction: _angular_core.ModelSignal<((el: HTMLElement) => Api) | undefined>; /** Service managing the chessground instance and snabbdom patching lifecycle. */ private readonly ngxChessgroundService; /** * Sets up a reactive effect that redraws the board whenever {@link runFunction} changes. * * This is the wiring that makes dynamic board configuration (switching FEN, orientation, etc.) * work seamlessly — just update the signal and the board reacts. */ constructor(); /** * Redraws the board once the view is initialized. * * Ensures the board is rendered on first load. Subsequent redraws * are handled by the `effect()` watching `runFunction`. */ ngAfterViewInit(): void; /** * Flips the board orientation (white ↔ black). * * Delegates to {@link NgxChessgroundService.toggleOrientation}. */ toggleOrientation(): void; /** * Re-renders the chessboard via the snabbdom patching service. * * Retrieves the board element and current run function, then delegates * to {@link NgxChessgroundService.redraw}. */ private redraw; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * A table-style chessboard demo component. * * Displays a single chessboard initialized with the "Play legal moves from initial position" * unit preset, enhanced with dialog-based pawn promotion via {@link PromotionService}. * * Implements {@link AfterViewInit} to set the run function on the child * {@link NgxChessgroundComponent} once the view is ready. * * @example * ```html * * ``` */ declare class NgxChessgroundTableComponent implements AfterViewInit { /** * Signal-based view query for the child chessboard component. * * References the `NgxChessgroundComponent` with template variable `#chess`. * Used in {@link ngAfterViewInit} to set the initial board configuration. */ readonly ngxChessgroundComponent: _angular_core.Signal; /** Injected promotion dialog service for pawn promotion UX. */ private readonly promotionService; /** * Initializes the chessboard after the view is rendered. * * Creates unit presets enhanced with dialog-based promotion and assigns * the "initial" unit's run function to the child chessground component. */ ngAfterViewInit(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Criteria for filtering a parsed game collection in the PGN processor worker. * * All string fields are matched case-insensitively as substrings. * Rating fields default to 0 (no lower bound) or Infinity (no upper bound) when unset. * * @example * ```typescript * const criteria: FilterCriteria = { * white: 'carlsen', * black: '', * result: '1-0', * moves: true, * ignoreColor: false, * targetMoves: ['e4', 'e5', 'Nf3'], * minWhiteRating: 2500, * minBlackRating: 2400, * maxWhiteRating: Infinity, * maxBlackRating: Infinity, * eco: 'B33', * timeControl: '180+2', * event: '', * }; * ``` */ interface FilterCriteria { /** Filter by white player name (case-insensitive substring match). */ white: string; /** Filter by black player name (case-insensitive substring match). */ black: string; /** Comma-separated result strings: `"1-0"`, `"0-1"`, `"draw"`, or `"*"` for unfinished. */ result: string; /** When `true`, filter games by the {@link targetMoves} opening sequence. */ moves: boolean; /** When `true`, treat {@link white} and {@link black} fields as matching either color. */ ignoreColor: boolean; /** SAN move sequence the game must be prefixed with (only used when {@link moves} is `true`). */ targetMoves: string[]; /** Minimum white Elo rating (inclusive). Default 0. */ minWhiteRating: number; /** Minimum black Elo rating (inclusive). Default 0. */ minBlackRating: number; /** Maximum white Elo rating (inclusive). Use `Infinity` for no upper bound. */ maxWhiteRating: number; /** Maximum black Elo rating (inclusive). Use `Infinity` for no upper bound. */ maxBlackRating: number; /** ECO code filter (case-insensitive substring, e.g. `"B33"`). */ eco: string; /** Time control filter (case-insensitive substring, e.g. `"180+2"`). */ timeControl: string; /** Event/tournament name filter (case-insensitive substring). */ event: string; } /** * Discriminated union of responses sent from the PGN processor worker to the main thread. * * The `id` field matches the correlation ID from the originating {@link WorkerMessage}. */ type WorkerResponse = /** Response to a `'load'` message with game count and metadata. */ { type: 'load'; payload: { count: number; metadata: GameMetadata[]; }; id: number; } /** Response to a `'filter'` message with matching game indices. */ | { type: 'filter'; payload: number[]; id: number; } /** Response to a `'loadGame'` message with moves, cleaned PGN, evaluations, and optional error. */ | { type: 'loadGame'; payload: { moves: string[]; pgn: string; evaluations: (string | null)[]; error?: string; }; id: number; } /** Error response for any message type. */ | { type: 'error'; payload: string; id: number; }; /** * Metadata extracted from a single PGN game header. * * Used for displaying game lists, filtering, and sorting without parsing full move data. * The `timeControlNormalized` field converts human-readable time controls * (e.g. `"90+30"`, `"3:0"`) into a uniform `"baseSeconds+incrementSeconds"` format. */ interface GameMetadata { /** 1-based game number within the loaded PGN collection. */ number: number; /** White player display name (includes title and Elo if present, e.g. `"GM Carlsen (2850)"`). */ white: string; /** Black player display name (includes title and Elo if present). */ black: string; /** Normalized result: `"1-0"`, `"0-1"`, `"½-½"`, or `"*"`. */ result: string; /** White player Elo rating (0 if missing). */ whiteElo: number; /** Black player Elo rating (0 if missing). */ blackElo: number; /** ECO (Encyclopedia of Chess Openings) code (e.g. `"B33"`). */ eco?: string; /** Raw time control string from the PGN header. */ timeControl?: string; /** Normalized time control in `"seconds+increment"` format, or `undefined` if unparseable. */ timeControlNormalized?: string; /** Event/tournament name from the PGN header. */ event?: string; } /** * A full-featured PGN viewer component for Angular applications. * * Supports loading single or multi-game PGN files, navigating moves, auto-replay * with configurable timing modes, Stockfish-powered position analysis ("stop on error"), * filtering by player/ECO/opening moves, and batch replay across multiple games. * * All components used are standalone. Import this component directly: * ```typescript * imports: [NgxPgnViewerComponent] * ``` * * @example Basic usage * ```html * * ``` */ declare class NgxPgnViewerComponent implements OnDestroy { /** Service managing the PGN processor and Stockfish Web Workers. */ private readonly pgnViewerEngine; /** Material snackbar service for user notifications. */ private readonly snackBar; /** * PGN string to load and display. * Supports plain PGN, multi-game PGN, gzip-compressed (`.pgn.gz`), and ZIP archives. */ pgn: _angular_core.InputSignal; /** * Whether to highlight the last played move on the board with colored squares. * @default true */ highlightLastMove: _angular_core.InputSignal; /** * Updates the white player name filter from an input event. * @param event — Input event from the white filter text field. */ updateFilterWhite(event: Event): void; /** * Updates the black player name filter from an input event. * @param event — Input event from the black filter text field. */ updateFilterBlack(event: Event): void; /** * Opens the white player typeahead dropdown and resets the selection index. */ openWhiteTypeahead(): void; /** * Opens the black player typeahead dropdown and resets the selection index. */ openBlackTypeahead(): void; /** * Closes the white player typeahead dropdown after a 200ms delay * (allows mousedown on dropdown items to fire before close). */ closeWhiteTypeahead(): void; /** * Closes the black player typeahead dropdown after a 200ms delay * (allows mousedown on dropdown items to fire before close). */ closeBlackTypeahead(): void; /** * Handles input events on the white player typeahead, updating the filter * and keeping the dropdown open. * @param event — Input event from the white filter typeahead field. */ onWhiteTypeaheadInput(event: Event): void; /** * Handles input events on the black player typeahead. * @param event — Input event from the black filter typeahead field. */ onBlackTypeaheadInput(event: Event): void; /** * Selects a player from the white typeahead dropdown and closes it. * @param player — The selected player name. */ selectWhiteTypeahead(player: string): void; /** * Selects a player from the black typeahead dropdown and closes it. * @param player — The selected player name. */ selectBlackTypeahead(player: string): void; /** * Handles keyboard navigation in the white player typeahead dropdown. * * Arrow keys navigate the list, Enter selects, Escape closes. * If the dropdown is closed, ArrowDown/ArrowUp reopen it. * * @param event — Keyboard event from the white typeahead input field. */ onWhiteTypeaheadKeydown(event: KeyboardEvent): void; /** * Handles keyboard navigation in the black player typeahead dropdown. * * Arrow keys navigate the list, Enter selects, Escape closes. * If the dropdown is closed, ArrowDown/ArrowUp reopen it. * * @param event — Keyboard event from the black typeahead input field. */ onBlackTypeaheadKeydown(event: KeyboardEvent): void; /** * Splits text into match/non-match segments for typeahead highlighting. * * Used to render bold matching portions of player names in the typeahead dropdown. * * @param text — Full text to segment (e.g. a player name). * @param query — Search query string to match against. * @returns Array of `{ text, match }` objects for template rendering. */ highlightText(text: string, query: string): { text: string; match: boolean; }[]; /** * Updates the result filter from a multi-select dropdown change event. * * @param event — Change event from the result `` element. */ updateFilterEco(event: Event): void; /** * Updates the time control filter from a dropdown change event. * * @param event — Change event from the time control `` field. */ updateFilterWhiteRating(event: Event): void; /** * Updates the maximum white rating filter from an input event. * * @param event — Input event from the white rating max `` field. */ updateFilterWhiteRatingMax(event: Event): void; /** * Updates the minimum black rating filter from an input event. * * @param event — Input event from the black rating `` field. */ updateFilterBlackRating(event: Event): void; /** * Updates the maximum black rating filter from an input event. * * @param event — Input event from the black rating max `` field. */ updateFilterBlackRatingMax(event: Event): void; /** * Toggles the "ignore color" checkbox — when enabled, player name filters * match either white or black fields interchangeably. * * @param event — Change event from the ignore-color checkbox. */ toggleIgnoreColor(event: Event): void; /** * Toggles interactive opening-move filtering mode. * * When enabled, the board becomes editable so the user can play moves * to define an opening sequence filter. The current game position is * saved and restored when the mode is exited. * * @param event — Change event from the filter-moves checkbox. */ toggleFilterMoves(event: Event): void; /** * Looks up the defining move sequence for an ECO opening code. * * @param code — ECO code (e.g. `"B33"`). * @returns Pipe-separated SAN move sequence, or empty string if not found. */ getOpeningMoves(code: string): string; /** Parsed game metadata for all games in the loaded PGN. */ gamesMetadata: _angular_core.WritableSignal; /** Zero-based index of the currently active game. */ currentGameIndex: _angular_core.WritableSignal; /** Array of SAN move strings for the loaded game. */ moves: _angular_core.WritableSignal; /** Zero-based index of the current move (-1 means start position, before any move). */ currentMoveIndex: _angular_core.WritableSignal; /** Current board position in FEN notation. */ currentFen: _angular_core.WritableSignal; /** Whether PGN data is being loaded/parsed. */ isLoading: _angular_core.WritableSignal; /** Loading progress percentage (0–100). */ loadingProgress: _angular_core.WritableSignal; /** Human-readable loading status message. */ loadingStatus: _angular_core.WritableSignal; /** Set of selected game indices for batch operations like replay-all. */ selectedGames: _angular_core.WritableSignal>; /** Current white player filter text. */ filterWhite: _angular_core.WritableSignal; /** Current black player filter text. */ filterBlack: _angular_core.WritableSignal; /** Selected result filters (e.g. `["1-0", "draw"]`). */ filterResult: _angular_core.WritableSignal; /** Whether opening-move filtering is active. */ filterMoves: _angular_core.WritableSignal; /** Whether to swap white/black when filtering (match either color). */ ignoreColor: _angular_core.WritableSignal; /** Whether Elo rating filter fields are enabled. */ filterRatingEnabled: _angular_core.WritableSignal; /** Minimum white Elo rating filter value (as string for input binding). */ filterWhiteRating: _angular_core.WritableSignal; /** Minimum black Elo rating filter value (as string for input binding). */ filterBlackRating: _angular_core.WritableSignal; /** Maximum white Elo rating filter value (as string for input binding). */ filterWhiteRatingMax: _angular_core.WritableSignal; /** Maximum black Elo rating filter value (as string for input binding). */ filterBlackRatingMax: _angular_core.WritableSignal; /** ECO code filter value. */ filterEco: _angular_core.WritableSignal; /** Time control filter value (e.g. `"180+2"`). */ filterTimeControl: _angular_core.WritableSignal; /** Event/tournament name filter value. */ filterEvent: _angular_core.WritableSignal; /** Unique white player names from the loaded PGN (for typeahead). */ uniqueWhitePlayers: _angular_core.WritableSignal; /** Unique black player names from the loaded PGN (for typeahead). */ uniqueBlackPlayers: _angular_core.WritableSignal; /** Whether the white player typeahead dropdown is open. */ whiteTypeaheadOpen: _angular_core.WritableSignal; /** Whether the black player typeahead dropdown is open. */ blackTypeaheadOpen: _angular_core.WritableSignal; /** Currently highlighted index in the white typeahead dropdown. */ whiteTypeaheadIndex: _angular_core.WritableSignal; /** Currently highlighted index in the black typeahead dropdown. */ blackTypeaheadIndex: _angular_core.WritableSignal; /** Timeout handle for delayed closing of the white typeahead dropdown. */ private whiteTypeaheadCloseTimeout; /** Timeout handle for delayed closing of the black typeahead dropdown. */ private blackTypeaheadCloseTimeout; /** Filtered white player suggestions based on current filter text. */ filteredWhiteSuggestions: _angular_core.Signal; /** Filtered black player suggestions based on current filter text. */ filteredBlackSuggestions: _angular_core.Signal; /** Unique ECO codes mapped to occurrence counts in the loaded PGN. */ uniqueEcoCodes: _angular_core.WritableSignal>; /** Unique time controls mapped to occurrence counts and original format strings. */ uniqueTimeControls: _angular_core.WritableSignal; }>>; /** Unique event/tournament names mapped to occurrence counts. */ uniqueEvents: _angular_core.WritableSignal>; /** ECO codes sorted by popularity (most frequent first). */ sortedEcoCodes: _angular_core.Signal<{ code: string; count: number; }[]>; /** Time controls sorted by popularity with human-readable labels and original summaries. */ sortedTimeControls: _angular_core.Signal<{ key: string; count: number; label: string; originalsSummary: string; }[]>; /** Events sorted by popularity (most frequent first). */ sortedEvents: _angular_core.Signal<{ event: string; count: number; }[]>; /** Indices of games matching the current filter criteria. */ filteredGamesIndices: _angular_core.WritableSignal; /** Whether a filter operation is in progress. */ isFiltering: _angular_core.WritableSignal; /** Monotonic counter used as correlation ID for filter requests to the worker. */ private currentFilterId; /** When `true`, auto-select the first matching game after filtering completes. */ private autoSelectOnFinish; /** View query for the move list scroll container. */ readonly moveList: _angular_core.Signal | undefined>; /** Currently active opening move sequence for interactive mode filtering. */ private activeFilterMoves; /** Saved move index before entering filter-moves mode (restored when exiting). */ private savedGameMoveIndex; /** Active deferred timeout handles that should be cancelled on destroy. */ private readonly pendingTimeouts; /** Moves made by the user during interactive opening-move filtering mode. */ private interactiveMoves; /** Flag to uncheck the filter-moves toggle after a filter operation completes. */ private shouldUncheckFilterMoves; /** Number of currently selected games for batch operations. */ selectedGamesCount: _angular_core.Signal; /** Whether the replay-all button should be visible (multiple games + selection). */ canShowReplayAll: _angular_core.Signal; /** Display string: "Game X of Y". */ currentGameInfo: _angular_core.Signal; /** Display name of the white player for the current game. */ currentWhitePlayer: _angular_core.Signal; /** Display name of the black player for the current game. */ currentBlackPlayer: _angular_core.Signal; /** Formatted result string for the current game. */ currentGameResult: _angular_core.Signal; /** * Computed from-to squares of the last move for board highlighting. * Returns `undefined` when highlighting is disabled or no move has been played. */ lastMoveSquares: _angular_core.Signal<[Key, Key] | undefined>; /** Filtered game metadata for the current filter results. */ filteredGameInfos: _angular_core.Signal; /** Replay timing mode: fixed, realtime (clock-based), or proportional scaling. */ replayMode: _angular_core.WritableSignal<"realtime" | "proportional" | "fixed">; /** Total duration in minutes when `replayMode` is `'proportional'`. */ proportionalDuration: _angular_core.WritableSignal; /** Minimum seconds between moves in `'proportional'` and `'realtime'` modes. */ minSecondsBetweenMoves: _angular_core.WritableSignal; /** Fixed seconds between moves when `replayMode` is `'fixed'`. */ fixedTime: _angular_core.WritableSignal; /** Whether to pause replay when a large evaluation change is detected. */ stopOnError: _angular_core.WritableSignal; /** Evaluation change threshold (in pawns) that triggers a stop. */ stopOnErrorThreshold: _angular_core.WritableSignal; /** Display string for white's remaining clock time. */ whiteTimeRemaining: _angular_core.WritableSignal; /** Display string for black's remaining clock time. */ blackTimeRemaining: _angular_core.WritableSignal; /** Whether either clock has been populated (controls clock display visibility). */ showClocks: _angular_core.Signal; /** Whether a replay is currently in progress. */ isReplaying: _angular_core.WritableSignal; /** Whether the replay can be continued from the current move. */ canContinueReplay: _angular_core.Signal; /** Whether Stockfish is currently analyzing a position. */ isAnalyzing: _angular_core.WritableSignal; /** Stockfish analysis result: best move, PV line, and optional score. */ bestMoveInfo: _angular_core.WritableSignal<{ move: string; pv: { san: string; fen: string; }[]; score?: string; } | null>; /** Whether to show the "Show Better Move" button after a stop-on-error event. */ showBetterMoveBtn: _angular_core.WritableSignal; /** Whether the Stockfish analysis panel is currently visible. */ analysisVisible: _angular_core.WritableSignal; /** * Converts UCI move strings to SAN notation with resulting FENs. * * Used by Stockfish message handling to convert the engine's UCI PV line * into human-readable SAN for display. * * @param fen — Starting FEN position. * @param uciMoves — Array of UCI move strings (e.g. `["e2e4", "e7e5"]`). * @returns Array of `{ san, fen }` objects, one per successful move. */ private uciToSan; /** * Handles UCI protocol messages from the Stockfish Web Worker. * * Parses `info ... pv ...` lines to extract the best move, PV line, * and score (centipawns or mate). Updates {@link bestMoveInfo} and * sets {@link isAnalyzing} to `false` on `bestmove`. * * @param event — Message event from the Stockfish worker. */ private handleStockfishMessage; /** * Jumps the board display to a given FEN (used for PV preview in analysis). * * @param fen — FEN string to display on the board. */ previewPvMove(fen: string): void; /** FEN position currently being analyzed by Stockfish. */ private analyzedFen; /** Stockfish search depth in plies. */ stockfishDepth: _angular_core.WritableSignal; /** * Sends a FEN position to Stockfish for analysis at the configured depth. * * Stops any in-progress analysis before starting. Sets {@link isAnalyzing} * and clears any previous {@link bestMoveInfo}. * * @param fen — FEN string of the position to analyze. */ analyzePosition(fen: string): void; /** * Auto-plays the Stockfish best line on the board with 1-second delays. * * Iterates through the PV (principal variation) moves stored in * {@link bestMoveInfo} and displays each resulting FEN. */ autoplayBestLine(): Promise; /** Raw PGN text bound to the PGN textarea. */ pgnInput: _angular_core.WritableSignal; /** URL input for fetching remote PGN files. */ urlInput: _angular_core.WritableSignal; /** Per-move evaluation strings from `[%eval ...]` PGN comments. */ evaluations: _angular_core.WritableSignal<(string | null)[]>; /** Evaluation string at the current move index, or `null` at start position. */ currentEvaluation: _angular_core.Signal; /** * Computed height percentage (0–100) for the evaluation bar. * * Maps centipawn scores linearly from -5.0 (0%) to +5.0 (100%). * Mate scores force 0% or 100%. */ evaluationBarHeight: _angular_core.Signal; /** Active side to move: `'w'` or `'b'` parsed from the current FEN. */ activeColor: _angular_core.Signal; /** Selected year for Lichess database queries (two-way bound via `model`). */ lichessYear: _angular_core.ModelSignal; /** Selected month (1–12) for Lichess database queries (two-way bound via `model`). */ lichessMonth: _angular_core.ModelSignal; /** chess.js instance used for move validation and board state management. */ private chess; /** Active replay timeout handles (cleared when replay stops). */ private replayTimeouts; /** Resolve function for the replay-async Promise (called when replay completes). */ private replayResolve; /** Whether a batch replay sequence across multiple games is in progress. */ private isReplayingSequence; /** * Computed run function for the child {@link NgxChessgroundComponent}. * * Reacts to changes in FEN, filter-moves mode, and last-move squares. * In filter-moves mode the board is editable with legal-move highlighting; * otherwise it is view-only. This is the primary binding between the * PGN viewer state and the chessboard display. */ runFunction: _angular_core.Signal<(el: HTMLElement) => Api>; /** * Computes legal move destinations for the current chess.js position. * * Returns a `Map` suitable for chessground's * `movable.dests` configuration in interactive filter-moves mode. * * @returns Map of legal destination squares keyed by origin square. */ private getMovableDests; /** * Processes a move made by the user on the interactive board during filter-moves mode. * * If the move is legal, it's appended to {@link interactiveMoves} and the * board is updated via chess.js. The move is added to {@link activeFilterMoves} * if it belongs to the opening line being filtered. * * @param orig — Origin square (e.g. `"e2"`). * @param dest — Destination square (e.g. `"e4"`). */ private handleBoardMove; /** * Initializes the PGN viewer engine workers and sets up reactive effects. * * Three effects are registered: * 1. Auto-updates the Lichess URL when year/month selection changes. * 2. Loads the initial PGN from the bound input when provided. * 3. Auto-scrolls the move list when the current move index changes. */ constructor(); /** * Cleans up replay timeouts, workers, and all pending deferred timeouts. * * Called automatically by Angular when the component is destroyed. */ ngOnDestroy(): void; /** * Updates the Stockfish search depth from an input event. * * @param event — Input event from the depth slider/number input. */ onStockfishDepthChange(event: Event): void; /** * Creates a tracked `setTimeout` that is automatically cancelled on destroy. * * All timeout handles are stored in {@link pendingTimeouts} and cleared * in {@link ngOnDestroy} to prevent memory leaks. * * @param callback — Function to execute after the delay. * @param delay — Delay in milliseconds (default 0). * @returns The timeout handle. */ private setDeferredTimeout; /** * Shows a Material snackbar notification to the user. * * @param message — Text to display in the snackbar. * @param duration — Auto-dismiss duration in milliseconds (default 4000). */ private showMessage; /** * Routes PGN processor worker responses to the appropriate handler logic. * * Handles `'load'` (populate metadata, unique players, ECO codes), * `'filter'` (update filtered indices, auto-select game), * `'loadGame'` (display moves, evaluations, clocks), and `'error'` messages. * * @param data — Response from the PGN processor worker. */ private handleWorkerMessage; /** * Formats a normalized time control key for display. * * Converts `"seconds+increment"` (e.g. `"5400+30"`) to a human-readable * form using minutes when divisible by 60 and ≤ 180 (e.g. `"90+30"`). * * @param key — Normalized time control string like `"5400+30"`. * @returns Display-friendly time control string. */ private formatTimeControlKey; /** * Builds a summary string of the most common original time control formats. * * @param originals — Map of original format strings to occurrence counts. * @param maxItems — Maximum number of entries to include (default 6). * @returns Summary string like `"Originals: 90+30 (500), 180+2 (300) +3 more"`. */ private formatOriginalsSummary; /** * Applies the current filter criteria and re-runs game filtering. * * Stops any in-progress replay and delegates to {@link runFilterLogic} * with the values from the filter signal state. Auto-selects the first * matching game when filtering completes. */ applyFilter(): void; /** * Resets all filter fields to their default values and stops any in-progress replay. * * If the filter-moves mode was active, it's exited and the saved position is restored. */ clearFilters(): void; /** * Sends filter criteria to the PGN processor worker and tracks the request. * * Increments a monotonic filter ID to detect stale responses. * Called by {@link applyFilter} after collecting current signal values. * * @param fWhite — White player filter text. * @param fBlack — Black player filter text. * @param fResult — Comma-separated result filter string. * @param fMoves — Whether opening-move filtering is enabled. * @param fIgnoreColor — Whether to swap white/black matching. * @param fWhiteRating — Minimum white Elo. * @param fBlackRating — Minimum black Elo. * @param fWhiteRatingMax — Maximum white Elo. * @param fBlackRatingMax — Maximum black Elo. * @param fEco — ECO code filter. * @param fTimeControl — Time control filter. * @param fEvent — Event name filter. * @param targetMoves — SAN move sequence to match. */ private runFilterLogic; /** * Loads a raw PGN string into the viewer, resetting current game state. * * Delegates to {@link PgnViewerEngineService.loadPgn} for background parsing. * The worker response (via {@link handleWorkerMessage}) populates metadata * and triggers the first game load. * * @param pgn — Raw PGN text (supports multi-game, compressed formats). */ loadPgnString(pgn: string): void; /** * Reads PGN text from the system clipboard and loads it into the viewer. * * Uses the Clipboard API. On failure, shows an error snackbar. */ loadFromClipboard(): Promise; /** * Copies the current PGN text to the system clipboard. * * Uses the Clipboard API. On failure, shows an error snackbar. */ copyToClipboard(): Promise; /** * Updates the proportional replay duration from an input event. * * @param event — Change event from the proportional duration input. */ onProportionalDurationChange(event: Event): void; /** * Updates the minimum-seconds-between-moves setting from an input event. * * @param event — Change event from the minimum seconds input. */ onMinSecondsBetweenMovesChange(event: Event): void; /** * Updates the fixed-time replay setting from an input event. * * @param event — Change event from the fixed time input. */ onFixedTimeChange(event: Event): void; /** * Updates the PGN input text from a textarea change event. * * @param event — Change event from the PGN textarea input. */ onPgnInputChange(event: Event): void; /** * Updates the URL input from a text input change event. * * @param event — Change event from the URL text input. */ onUrlInputChange(event: Event): void; /** * Updates the event filter from a select element change event. * * @param event — Change event from the event filter `` element. */ onLichessYearChange(event: Event): void; /** * Updates the Lichess month selection from a select element change event. * * @param event — Change event from the month `` element. */ onPgnZipSelected(event: Event): Promise; /** * Reads a user-selected PGN file from a file input and loads it into the viewer. * * Handles `.pgn` and `.pgn.gz` files via the browser's FileReader API. * * @param event — Change event from the file `` element. */ onPgnFileSelected(event: Event): void; /** * Loads a specific game by its index in the parsed game list. * * Delegates parsing to the PGN processor worker. The response * (via {@link handleWorkerMessage}) updates moves, evaluations, and clocks. * * @param index — Zero-based game index. */ loadGame(index: number): void; /** * Toggles a game's selection state for batch replay operations. * * @param index — Zero-based game index to toggle. */ toggleGameSelection(index: number): void; /** Selects all games in the current filtered list for batch replay. */ selectAllGames(): void; /** Clears all game selections. */ clearSelection(): void; /** Advances to the next game in the list, if available. */ nextGame(): void; /** Moves to the previous game in the list, if available. */ prevGame(): void; /** * Jumps the board to a specific move index, replaying all moves up to that point. * * `-1` resets to the starting position before any moves. * * @param index — The target move index (-1 for start position). */ jumpToMove(index: number): void; /** Scrolls the move list container to keep the active move visible. */ private scrollToActiveMove; /** * Advances to the next move in the current game. * * Updates the board, move index, and clock display. */ next(): void; /** * Goes back one move in the current game. * * Undoes the last move on the board and updates the clock display. */ prev(): void; /** Stops any in-progress replay sequence and cancels pending timeouts. */ stopSequence(): void; /** * Toggles the rating filter enable/disable checkbox. * * @param event — Change event from the rating-filter checkbox. */ toggleFilterRatingEnabled(event: Event): void; /** * Applies a rating preset (e.g. "2000+", "2500+", "3000+") from a dropdown. * * Sets the minimum rating to the selected value and the maximum to 3000 * (or 4000 for the "3000+" tier). * * @param event — Change event from the rating preset `