type RotatingPartnerScoreContract = { combinedPointTotal: number; tieResolution: 'ALLOW' | 'DECIDING_POINT' | 'WIN_BY_MARGIN'; winningMargin?: number; }; type TiebreakFormat = { tiebreakTo: number; modifier?: string; NoAD?: boolean; invalid?: boolean; }; type SetFormat$1 = { tiebreakFormat?: TiebreakFormat; tiebreakSet?: TiebreakFormat; tiebreakAt?: string | number; noTiebreak?: boolean; modifier?: string; minutes?: number; timed?: boolean; based?: string; NoAD?: boolean; setTo?: number; winBy?: number; outs?: number; shootout?: number; combinedPointTotal?: number; tieResolution?: RotatingPartnerScoreContract['tieResolution']; winningMargin?: number; }; type GameFormat = { type: 'CONSECUTIVE'; count: number; deuceAfter?: number; } | { type: 'TRADITIONAL'; deuceAfter?: number; }; type ParsedFormat = { matchRoot?: string; aggregate?: boolean; matchMods?: string[]; finalSetFormat?: any; overtimeFormat?: OvertimeFormat; simplified?: boolean; exactly?: number; setFormat?: any; bestOf?: number; gameFormat?: GameFormat; matchUpConstraint?: { timed?: boolean; minutes?: number; }; }; type OvertimeFormat = { count: number | 'unlimited'; exactly?: true; suddenDeath?: true; setFormat: SetFormat$1; }; type SideNumber = 1 | 2; type ScoreEntrySet = { setNumber?: number; side1Score?: number; side2Score?: number; side1TiebreakScore?: number; side2TiebreakScore?: number; side1PointScore?: string | number; side2PointScore?: string | number; winningSide?: number; }; type SetFormat = { setTo?: number; tiebreakAt?: number; NoAD?: boolean; tiebreakFormat?: { tiebreakTo?: number; NoAD?: boolean; }; tiebreakSet?: { tiebreakTo?: number; NoAD?: boolean; }; timed?: boolean; minutes?: number; noTiebreak?: boolean; winBy?: number; [key: string]: unknown; }; type MatchUpConfig = { bestOf: number; exactly?: number; aggregate?: boolean; setFormat?: SetFormat; finalSetFormat?: SetFormat; overtimeFormat?: OvertimeFormat; }; declare enum MatchUpStatusEnum { ABANDONED = "ABANDONED", AWAITING_RESULT = "AWAITING_RESULT", BYE = "BYE", CANCELLED = "CANCELLED", CHALLENGED = "CHALLENGED", COMPLETED = "COMPLETED", DEAD_RUBBER = "DEAD_RUBBER", DEFAULTED = "DEFAULTED", DOUBLE_DEFAULT = "DOUBLE_DEFAULT", DOUBLE_WALKOVER = "DOUBLE_WALKOVER", IN_PROGRESS = "IN_PROGRESS", INCOMPLETE = "INCOMPLETE", NOT_PLAYED = "NOT_PLAYED", RETIRED = "RETIRED", SUSPENDED = "SUSPENDED", TO_BE_PLAYED = "TO_BE_PLAYED", WALKOVER = "WALKOVER" } type MatchUpStatusUnion = `${MatchUpStatusEnum}`; declare const DEFAULT_MATCH_UP_FORMAT = "SET3-S:6/TB7"; declare function matchUpConfigFor(matchUpFormat?: string): MatchUpConfig; declare function getSetFormatForIndex(setIndex: number, config: MatchUpConfig): SetFormat | undefined; declare function isSetTiebreakOnly(format?: SetFormat): boolean; declare function isSetTimed(format?: SetFormat): boolean; declare function getMaxAllowedScore(setIndex: number, side: SideNumber, currentScores: { side1: number; side2: number; }, config: MatchUpConfig): number; declare function isSetComplete(setIndex: number, scores: { side1: number; side2: number; tiebreak?: number; }, config: MatchUpConfig): boolean; declare function getSetWinner(setIndex: number, scores: { side1: number; side2: number; tiebreak?: number; }, config: MatchUpConfig): SideNumber | undefined; declare function isMatchComplete(sets: readonly ScoreEntrySet[], config: MatchUpConfig): boolean; declare function getMatchWinner(sets: readonly ScoreEntrySet[], config: MatchUpConfig): SideNumber | undefined; declare function calculateComplement(digit: number, setFormat?: SetFormat): number | null; declare function shouldShowTiebreak(setIndex: number, scores: { side1: number; side2: number; }, config: MatchUpConfig): boolean; declare function buildSetScore(setIndex: number, side1Value: string, side2Value: string, tiebreakValue: string | undefined, config: MatchUpConfig): ScoreEntrySet; declare const NEITHER_SIDE = "NEITHER"; declare const SELECTABLE_ENDINGS: string[]; declare const WINNER_REQUIRING_STATUSES: Set; declare const NON_DIRECTING_ENDINGS: Set; declare function requiresWinner(selectedOutcome: string | undefined): boolean; declare const NO_SCORE_STATUSES: Set; declare const SCORE_PRESERVING_ENDINGS: Set; declare function coexistsWithScore(selectedOutcome: string | undefined): boolean; declare function carriesNoScore(selectedOutcome: string | undefined): boolean; type WinnerSelection = 1 | 2 | typeof NEITHER_SIDE | undefined; declare const DOUBLE_EXIT_STATUSES: Set; declare function isDoubleExitStatus(matchUpStatus: MatchUpStatusUnion | undefined): boolean; declare function winnerFromExitingSide(matchUpStatus: MatchUpStatusUnion | undefined, exitingSideNumber?: number): number | undefined; declare function supportsNeitherSide(selectedOutcome: string | undefined): boolean; type IrregularEndingResolution = { matchUpStatus?: MatchUpStatusUnion; winningSide?: number; isValid: boolean; awaitingWinner: boolean; isDoubleExit: boolean; }; declare function resolveIrregularEnding(params: { selectedOutcome: string | undefined; winnerSelection: WinnerSelection; }): IrregularEndingResolution; declare function hydrateIrregularEnding(matchUp?: { matchUpStatus?: MatchUpStatusUnion; winningSide?: number; }): { selectedOutcome: string; winnerSelection: WinnerSelection; }; type StatusCodeEntry = { matchUpStatusCode: string; matchUpStatusCodeDisplay?: string; label?: string; description?: string; }; type StatusCodeGroups = Record; declare function groupKeyForStatus(matchUpStatus: MatchUpStatusUnion | undefined): string | undefined; type RecordedReason = { matchUpStatus?: MatchUpStatusUnion; winningSide?: number; sideStatusCodes?: Record; matchUpStatusCode?: unknown; matchUpStatusCodes?: unknown[]; }; declare function recordedStatusCode(matchUp?: RecordedReason): string | undefined; declare function normalizeStatusCode(entry: unknown): string | undefined; declare function codesForStatus(groups: StatusCodeGroups | undefined, matchUpStatus: MatchUpStatusUnion | undefined): StatusCodeEntry[]; type ScoreEntryState = { sideEnding?: { sideNumber: SideNumber; status: string; }; bothSidesOut?: boolean; matchEnding?: string; reasonCode?: string; }; type ScoreEntryResolution = IrregularEndingResolution & { clearsScore: boolean; hasEnding: boolean; }; declare const emptyScoreEntryState: ScoreEntryState; declare function chooseSideEnding(state: ScoreEntryState, sideNumber: SideNumber, status: string): ScoreEntryState; declare function chooseMatchEnding(state: ScoreEntryState, status: string): ScoreEntryState; declare function toggleBothSidesOut(state: ScoreEntryState): ScoreEntryState; declare function offersBothSidesOut(state: ScoreEntryState): boolean; declare function chooseReasonCode(state: ScoreEntryState, code: string | undefined): ScoreEntryState; declare function hydrateScoreEntryState(matchUp?: RecordedReason): ScoreEntryState; declare function reasonCodeStatus(state: ScoreEntryState): string | undefined; declare function resolveScoreEntry(state: ScoreEntryState): ScoreEntryResolution; declare function resolveReportedEnding(matchUpStatus?: MatchUpStatusUnion, winningSide?: number): ScoreEntryResolution; declare function sideEndingOptions(): string[]; declare function matchEndingOptions(): string[]; type ScoreEntryApproach = 'dynamicSets' | 'freeScore' | 'dialPad'; type SetEntry = { side1?: number; side2?: number; tiebreak1?: number; tiebreak2?: number; }; type CellRef = { setIndex: number; side: SideNumber; kind: 'games' | 'tiebreak'; }; type ScoreEntryModel = { matchUpFormat: string; approach: ScoreEntryApproach; sets: readonly SetEntry[]; ending: ScoreEntryState; }; type EndingIntent = { kind: 'side'; sideNumber: SideNumber; status: string; } | { kind: 'match'; status: string; } | { kind: 'bothSidesOut'; } | { kind: 'reasonCode'; code: string | undefined; }; type CreateScoreEntryModelParams = { matchUpFormat?: string; approach?: ScoreEntryApproach; sets?: ScoreEntrySet[]; matchUp?: Parameters[0]; }; declare function createScoreEntryModel(params?: CreateScoreEntryModelParams): ScoreEntryModel; type TypeDigitIntent = { cell: CellRef; digit: number; complement?: boolean; }; declare function typeDigit(model: ScoreEntryModel, intent: TypeDigitIntent): ScoreEntryModel; declare function setCell(model: ScoreEntryModel, cell: CellRef, value: number | undefined): ScoreEntryModel; declare function clearCell(model: ScoreEntryModel, cell: CellRef): ScoreEntryModel; declare function clearScore(model: ScoreEntryModel): ScoreEntryModel; declare function clearAll(model: ScoreEntryModel): ScoreEntryModel; declare function chooseEnding(model: ScoreEntryModel, intent: EndingIntent): ScoreEntryModel; declare function changeFormat(model: ScoreEntryModel, matchUpFormat: string): ScoreEntryModel; declare function switchApproach(model: ScoreEntryModel, approach: ScoreEntryApproach): ScoreEntryModel; declare function decidingIndex(sets: readonly SetEntry[], config: MatchUpConfig): number | undefined; declare function enteredFactorySets(sets: readonly SetEntry[], config: MatchUpConfig): ScoreEntrySet[]; declare function toFactorySet(entry: SetEntry, index: number, config: MatchUpConfig): ScoreEntrySet; declare function replaceSets(model: ScoreEntryModel, sets: ScoreEntrySet[]): ScoreEntryModel; declare function readCell(entry: SetEntry, cell: CellRef): number | undefined; declare function gamesLoser(entry: SetEntry): SideNumber | undefined; declare function isEntered(entry: SetEntry): boolean; declare function isEmptyEntry(entry: SetEntry): boolean; declare function setCountOf(config: MatchUpConfig): number; declare function isFinalSetIndex(index: number, config: MatchUpConfig): boolean; declare function deciderSetNumberOf(config: MatchUpConfig): number | undefined; type ScoreSlot = { kind: 'games' | 'tiebreak'; setIndex: number; }; type ColumnOptions = { editingSet?: number; }; declare function resolveEnding(model: ScoreEntryModel): ScoreEntryResolution; declare function enteredSets(model: ScoreEntryModel): ScoreEntrySet[]; declare function completedSets(model: ScoreEntryModel): ScoreEntrySet[]; declare function hasEntry(model: ScoreEntryModel): boolean; declare function scoreString(model: ScoreEntryModel): string | undefined; declare function discardedScore(model: ScoreEntryModel): string | undefined; declare function isComplete(model: ScoreEntryModel): boolean; declare function winningSide(model: ScoreEntryModel): SideNumber | undefined; declare function matchUpStatus(model: ScoreEntryModel): string | undefined; type ScoreEntryIssue = { code: 'TIEBREAK_CONTRADICTION'; setIndex: number; gamesWinner: SideNumber; } | { code: 'INVALID_SET'; setIndex: number; message: string; } | { code: 'SET_HAS_NO_SCORE'; setIndex: number; } | { code: 'SET_NOT_FINISHED'; setIndex: number; } | { code: 'OVERTIME_REFUSED'; setIndex: number; message: string; }; declare const TIEBREAK_CONTRADICTION = "TIEBREAK_CONTRADICTION"; declare const INVALID_SET = "INVALID_SET"; declare const SET_HAS_NO_SCORE = "SET_HAS_NO_SCORE"; declare const SET_NOT_FINISHED = "SET_NOT_FINISHED"; declare const OVERTIME_REFUSED = "OVERTIME_REFUSED"; declare function scoreEntryIssue(model: ScoreEntryModel): ScoreEntryIssue | undefined; declare function columns(model: ScoreEntryModel, options?: ColumnOptions): ScoreSlot[]; declare function isSettled(model: ScoreEntryModel, index: number): boolean; declare function tiebreakOutstanding(model: ScoreEntryModel, index: number): boolean; declare function unrecordedTiebreakSets(model: ScoreEntryModel): number[]; declare function cellValue(model: ScoreEntryModel, setIndex: number, side: SideNumber, kind: ScoreSlot['kind']): number | undefined; type ScoreEntryView = { model: ScoreEntryModel; reportedStatus?: MatchUpStatusUnion; regionHasEntry?: boolean; }; type ScoreEntryRulesContext = { disabledMatchUpStatuses?: readonly string[]; }; declare function statusOutOfScope(status: string | undefined, disabledMatchUpStatuses?: readonly string[]): boolean; type ScoreEntryOutcome = { matchUpStatus?: MatchUpStatusUnion; winningSide?: number; reasonCode?: string; score?: string; cleared?: boolean; }; declare function scoreIsFinished(view: ScoreEntryView): boolean; declare function scoreEntered(view: ScoreEntryView): boolean; declare function holdsEntry(view: ScoreEntryView): boolean; declare function resolutionInForce(view: ScoreEntryView): ScoreEntryResolution; type ScopeIssue = { code: 'STATUS_UNAVAILABLE'; matchUpStatus: MatchUpStatusUnion; }; declare const STATUS_UNAVAILABLE = "STATUS_UNAVAILABLE"; declare function scoreEntryProblem(view: ScoreEntryView, context?: ScoreEntryRulesContext): ScopeIssue | ScoreEntryIssue | undefined; declare function contradictsFinishedScore(status: string): boolean; declare function endingOffered(status: string, view: ScoreEntryView, disabledMatchUpStatuses?: readonly string[]): boolean; type EndingRefusal = 'STATUS_UNAVAILABLE' | 'ENDING_NEEDS_SCORE' | 'ENDING_AFTER_COMPLETE_SCORE'; declare function endingRefusal(status: string, view: ScoreEntryView, context?: ScoreEntryRulesContext): EndingRefusal; declare function retractEndingContradictedByScore(view: ScoreEntryView): EndingIntent | undefined; declare function scoreLocked(model: ScoreEntryModel): boolean; declare function clearScoreForEnding(model: ScoreEntryModel): { model: ScoreEntryModel; discarded?: string; } | undefined; type ClearGateInput = { openedOnRecordedOutcome: boolean; cleared: boolean; clearable?: boolean; holdsEntry: boolean; }; type ClearGate = { removalRefused: boolean; refusedNow: boolean; submitsAClear: boolean; }; declare function clearGate(input: ClearGateInput): ClearGate; declare function footerState(view: ScoreEntryView, gate: ClearGate, context?: ScoreEntryRulesContext): { submitDisabled: boolean; submitRefusedNow: boolean; clearDisabled: boolean; }; declare function clearHeadline(gate: ClearGate): 'clearRefused' | 'clearedHeadline' | undefined; declare function submission(view: ScoreEntryView, gate: ClearGate, context?: ScoreEntryRulesContext): ScoreEntryOutcome | undefined; type ReportedOutcome = { matchUpStatus?: MatchUpStatusUnion; winningSide?: number; reasonCode?: string; score?: string; cleared?: boolean; sets?: ScoreEntrySet[]; }; type EngineOutcome = { matchUpStatus?: MatchUpStatusUnion; winningSide?: number; matchUpFormat?: string; matchUpStatusCodes?: string[]; score: { sets: ScoreEntrySet[]; }; }; declare function toEngineOutcome(outcome: ReportedOutcome, matchUpFormat?: string): EngineOutcome; declare function positionalCodes({ reasonCode, matchUpStatus, winningSide }: ReportedOutcome): string[] | undefined; type FormatInput = string | ParsedFormat | MatchUpConfig | undefined; type OvertimeProgress = { complete: boolean; winningSide?: 1 | 2; next?: SetFormat; refused?: string; refusedAt?: number; }; declare const PLAYED_AFTER_DECIDED = "played after the match was decided"; declare function isOvertimeFormat(format: FormatInput): boolean; declare function overtimeSetCeiling(format: FormatInput): number | undefined; declare function overtimeSetFormat(format: FormatInput, setNumber: number): SetFormat | undefined; type OvertimePhase = { phase: 'REGULATION'; } | { phase: 'OVERTIME'; period: number; } | { phase: 'DECIDER'; shootout: boolean; }; declare function overtimePhaseOf(format: FormatInput, setNumber: number): OvertimePhase | undefined; declare function overtimeDeciderSetNumber(format: FormatInput): number | undefined; declare function overtimeProgress(matchUpFormat: string | undefined, sets: readonly ScoreEntrySet[]): OvertimeProgress; declare function isCompletedCombinedPointTie(sets: readonly ScoreEntrySet[], matchUpFormat?: string): boolean; declare function isCompletedLevelClose(sets: readonly ScoreEntrySet[], matchUpFormat?: string): boolean; declare function tiebreakOnlyTarget(setFormat?: SetFormat): number | undefined; declare function completeTiebreakOnly(lowValue: number, lowSide: SideNumber, setFormat?: SetFormat): { side1: number; side2: number; } | undefined; declare function scoreLine(sets: readonly ScoreEntrySet[], matchUpFormat?: string): string | undefined; export { DEFAULT_MATCH_UP_FORMAT, DOUBLE_EXIT_STATUSES, INVALID_SET, NEITHER_SIDE, NON_DIRECTING_ENDINGS, NO_SCORE_STATUSES, OVERTIME_REFUSED, PLAYED_AFTER_DECIDED, SCORE_PRESERVING_ENDINGS, SELECTABLE_ENDINGS, SET_HAS_NO_SCORE, SET_NOT_FINISHED, STATUS_UNAVAILABLE, TIEBREAK_CONTRADICTION, WINNER_REQUIRING_STATUSES, buildSetScore, calculateComplement, carriesNoScore, cellValue, changeFormat, chooseEnding, chooseMatchEnding, chooseReasonCode, chooseSideEnding, clearAll, clearCell, clearGate, clearHeadline, clearScore, clearScoreForEnding, codesForStatus, coexistsWithScore, columns, completeTiebreakOnly, completedSets, contradictsFinishedScore, createScoreEntryModel, deciderSetNumberOf, decidingIndex, discardedScore, emptyScoreEntryState, endingOffered, endingRefusal, enteredFactorySets, enteredSets, footerState, gamesLoser, getMatchWinner, getMaxAllowedScore, getSetFormatForIndex, getSetWinner, groupKeyForStatus, hasEntry, holdsEntry, hydrateIrregularEnding, hydrateScoreEntryState, isComplete, isCompletedCombinedPointTie, isCompletedLevelClose, isDoubleExitStatus, isEmptyEntry, isEntered, isFinalSetIndex, isMatchComplete, isOvertimeFormat, isSetComplete, isSetTiebreakOnly, isSetTimed, isSettled, matchEndingOptions, matchUpConfigFor, matchUpStatus, normalizeStatusCode, offersBothSidesOut, overtimeDeciderSetNumber, overtimePhaseOf, overtimeProgress, overtimeSetCeiling, overtimeSetFormat, positionalCodes, readCell, reasonCodeStatus, recordedStatusCode, replaceSets, requiresWinner, resolutionInForce, resolveEnding, resolveIrregularEnding, resolveReportedEnding, resolveScoreEntry, retractEndingContradictedByScore, scoreEntered, scoreEntryIssue, scoreEntryProblem, scoreIsFinished, scoreLine, scoreLocked, scoreString, setCell, setCountOf, shouldShowTiebreak, sideEndingOptions, statusOutOfScope, submission, supportsNeitherSide, switchApproach, tiebreakOnlyTarget, tiebreakOutstanding, toEngineOutcome, toFactorySet, toggleBothSidesOut, typeDigit, unrecordedTiebreakSets, winnerFromExitingSide, winningSide }; export type { CellRef, ClearGate, ClearGateInput, ColumnOptions, CreateScoreEntryModelParams, EndingIntent, EndingRefusal, EngineOutcome, IrregularEndingResolution, MatchUpConfig, MatchUpStatusUnion, OvertimePhase, OvertimeProgress, RecordedReason, ReportedOutcome, ScopeIssue, ScoreEntryApproach, ScoreEntryIssue, ScoreEntryModel, ScoreEntryOutcome, ScoreEntryResolution, ScoreEntryRulesContext, ScoreEntrySet, ScoreEntryState, ScoreEntryView, ScoreSlot, SetEntry, SetFormat, SideNumber, StatusCodeEntry, StatusCodeGroups, TypeDigitIntent, WinnerSelection };