import { ExerciseType, GeospatialPoint, RPE, SetType, ShareToPlatform, WorkoutBiometrics, WorkoutMedia, WorkoutVisibility } from '..'; /** * Events are used to determine the start time, end time and duration of a * `NormalizedWorkout`, in a way that can be persisted to disk. */ export interface NormalizedWorkoutEvent { type: 'resume' | 'pause'; unixTimestamp: number; } /** * NormalizedWorkout describes the state of a workout. It's used when * persisting an ongoing workout to disk, or calculating shareables after * completing the workout. * * The duration of a `NormalizedWorkout` is _derived_ from the `timeEvents` * array. There is no single "duration" variable, because that would require * pausing to be a complex stateful operation. */ export interface NormalizedWorkout { name: string; description: string; media: WorkoutMedia[]; startTime: number; timeEvents: NormalizedWorkoutEvent[]; exercises: NormalizedExercise[]; routineId?: string; trackWorkoutAsRoutine: boolean; updateRoutineFromWorkout?: boolean; appleWatch: boolean; wearosWatch: boolean; workoutVisibility: WorkoutVisibility; isWorkoutBiometricsPublic: boolean; shareTo: { [key in ShareToPlatform]: boolean; }; clientId: string; biometrics?: WorkoutBiometrics; trainerProgramId: string | undefined; trainerWorkoutTemplateId: string | undefined; gymId: string | undefined; isHomeGym: boolean; } export interface NormalizedSet { index: number; indicator: SetType; weight?: number; reps?: number; distance?: number; duration?: number; customMetric?: number; rpe?: RPE; targetRpe?: RPE; completed: boolean; completedAt?: string; geospatialData?: GeospatialPoint[]; } export interface NormalizedExercise { title: string; exerciseTemplateId: string; supersetId?: number; autoRestTimerSeconds?: number; routineNotes: string; notes: string; volumeDoublingEnabled: boolean; sets: NormalizedSet[]; } export declare const calculateDuration: (normalizedWorkout: Pick, nowUnix: number) => number; export declare const calculateEndTime: (normalizedWorkout: Pick, nowUnix: number) => number; interface GenerateWorkoutTimeEventsArgs { startTimeUnix: number; durationSeconds: number; nowUnix: number; /** * if this is `true`, generate a pause event at the current timestamp */ isPaused?: boolean; } export declare const generateWorkoutTimeEvents: ({ startTimeUnix, durationSeconds, nowUnix, isPaused, }: GenerateWorkoutTimeEventsArgs) => NormalizedWorkoutEvent[]; export declare const isWorkoutCurrentlyPaused: (normalizedWorkout: NormalizedWorkout) => boolean; /** * When logging a workout, we can't just use the `completed` state of a set to * determine if the user meant for the set to be included in the workout. This * is because a lot of users never mark sets as completed, and forcing them to * do that wouldn't add anything to the app. For that reason, we count a set as * completed if it contains inputted valid values based on its exercise type. * This function filters out all sets in a `NormalizedWorkout` that are * incomplete based on the values inputted. */ export declare const trimWorkout: (workout: NormalizedWorkout, exerciseTypeMap: { [key: string]: ExerciseType; }) => NormalizedWorkout; export {};