import type { ReplayObject, ReplayStoppage, ReplayTimeline } from "./replay.types.ts"; type P = readonly [number, number]; /** * The stoppages of a timeline, in order, each checked: a `start` and an `end` that are numbers, the end not before the start. Ones that overlap are joined. Read once and kept. * @example * ```ts * import { replayStoppages } from "@johnmorrisdotca/kyogijo-stadiums/replay"; * const frames = [{ t: 0, objects: [] }]; * console.log(replayStoppages({ frames, stoppages: [{ start: 9, end: 12 }, { start: 2, end: 5, reason: "goal" }, { start: 4, end: 6 }, { start: 8, end: 7 }] })); * // [ { start: 2, end: 6, reason: 'goal' }, { start: 9, end: 12 } ] * ``` */ export declare function replayStoppages(timeline: ReplayTimeline): readonly ReplayStoppage[]; /** The stoppage a time is in (from its start, up to but not at its end, when play starts again), or `undefined` while play is on. */ export declare function stoppageAt(timeline: ReplayTimeline, t: number): ReplayStoppage | undefined; /** The seconds of a span of the timeline's clock that were dead: the parts of it in stoppages. */ export declare function deadSeconds(timeline: ReplayTimeline, from: number, to: number): number; /** * The restarts that went by while the clock moved from `from` to `to` (`(from, to]`): the stoppages whose end, the drop of the puck, is in it. What a page plays the drop's sound on, as it plays the * horn on a goal of `eventsBetween`. */ export declare function restartsBetween(timeline: ReplayTimeline, from: number, to: number): readonly ReplayStoppage[]; /** How a sport's dead time goes: the speed the players go at and how long each part lasts, by the reason for the stoppage. */ export interface DeadTimeRules { /** The fastest a player goes to his place, in the timeline's units a second. */ speed: number; /** Seconds after play stops before anyone heads for the restart: a goal is celebrated, a whistle is a moment. */ pause(reason: string): number; /** Seconds after play stops that the dead ball or puck is still seen where it stopped; then it is out of sight until the restart. */ shown(reason: string): number; /** The shortest time the players take to get to their places, and how long they stand in them before the restart. */ least: number; hold: number; /** Where a player who comes off goes, and one who comes on comes from (the bench's gate), or `undefined` for none: then they only go and come at the restart. */ bench?(object: ReplayObject): P | undefined; /** Is it the ball or the puck: dead in the stoppage, out of sight until the restart. */ dead(object: ReplayObject): boolean; } /** A stoppage to write into a timeline: play stops at `t`; the timeline's frames from `until` on (the players in their places, the puck on the dot) are the restart. */ export interface DeadStop { t: number; /** The time on the timeline given of the restart's frame: `t` and `until` are moved apart by the dead time, what was between them is left out, and the instant between them becomes part of the stoppage. 0.04 seconds after `t` by default. */ until?: number; reason: string; /** Where play starts again. */ x?: number; y?: number; team?: "home" | "away"; } /** * Write stoppages into a timeline. The timeline given has each stoppage as an instant: the play up to `t`, then at `until` the restart (the players in their places, the puck on the dot). Each is * opened into the dead time the rules give: the puck stays where it stopped for a moment and is then out of sight, the players stand a moment (a goal is celebrated) and then go to their places at the * rules' speed or slower (all getting there together, the farthest at the rules' speed), a player going off goes to the bench and the one coming on comes from it, and they stand in their places a * moment before the restart. Everything after is moved on by the dead time; the periods with it (each keeps its length on the game clock), the events, the stoppages already there and the * penalties. Pure. */ export declare function addDeadTime(timeline: ReplayTimeline, stops: readonly DeadStop[], rules: DeadTimeRules): ReplayTimeline; export {};