/** * Core Expander * * Converts compact training plans to expanded format for HTML rendering. */ import type { CompactPlan } from "../schema/compact-plan.js"; import type { TemplateRegistry, InterpolationContext } from "../templates/index.js"; import type { ExpandedPlan, ExpandedWorkout, ExpansionOptions } from "./types.js"; /** * Parse an ISO date string (YYYY-MM-DD) as a local date, avoiding timezone issues. * When you use `new Date("2025-02-16")`, it creates a UTC date which can shift * to the previous day in timezones behind UTC. This function creates a date in * local timezone. */ export declare function parseLocalDate(dateStr: string): Date; /** * Create an ExpandedWorkout from a template reference. * * Builds a full interpolation context from the provided base `context` and any * parameters embedded in `ref`, interpolates description and duration, converts * any template structure to object form, and returns the expanded workout record. * * @param ref - The workout reference string (template id optionally with positional/keyword params) * @param workoutId - The id to assign to the expanded workout instance * @param context - Base interpolation variables (athlete paces, zones, etc.) * @param templates - Registry of available templates used to resolve the referenced template * @returns An ExpandedWorkout populated from the resolved template, including `id`, `sport`, `type`, `category`, `name`, `durationMinutes`, `primaryZone`, `rpe`, `coachingNotes`, `humanReadable`, `structure`, and `completed` */ export declare function expandWorkout(ref: string, workoutId: string, context: InterpolationContext, templates: TemplateRegistry): ExpandedWorkout; /** * Convert a compact training plan into a fully expanded plan suitable for rendering. * * The expansion resolves workout templates, interpolates template parameters, computes per-week * schedules and summaries, calculates athlete zones, and assembles metadata, preferences, and * phased weekly hour ranges. * * @param compact - The compact plan to expand * @param templates - Registry of available workout templates used during expansion * @param options - Expansion behavior overrides * @param options.startDate - If provided, use this date as the plan start date; otherwise the function will use an explicit athlete startDate if present or compute a start date from the athlete's eventDate and total weeks * @returns The expanded plan containing version, meta, preferences, zones, phases, weeks, and optional raceStrategy, assessment, athleteNotes, and athletePaces. * */ export declare function expandPlan(compact: CompactPlan, templates: TemplateRegistry, options?: ExpansionOptions): ExpandedPlan; /** * Validate that all workout references in a compact plan have corresponding templates. */ export declare function validateWorkoutRefs(compact: CompactPlan, templates: TemplateRegistry): string[];