/** * Variable Interpolation Engine * * Replaces ${variable} patterns in template strings with actual values. * Supports: * - Simple variables: ${paces.easy} → "5:30/km" * - Math expressions: ${10 + (reps * 3)} → "22" * - Nested access: ${zones.hr.lthr} → "170" */ import type { InterpolationContext } from "./template.types.js"; /** * Evaluate a simple math expression with variable substitution. * * This uses a safe evaluation approach that only allows basic math operations. * Variables in the expression are first replaced with their values from context. * * @example * evaluateExpression("10 + (reps * 3)", { reps: 4 }) // 22 */ export declare function evaluateExpression(expr: string, context: InterpolationContext): string | number; /** * Interpolate all ${variable} patterns in a string. * * @example * interpolate("Run ${duration} min @ ${paces.easy}", { * duration: 30, * paces: { easy: "5:30/km" } * }) * // "Run 30 min @ 5:30/km" */ export declare function interpolate(template: string, context: InterpolationContext): string; /** * Interpolate all string values in an object recursively. */ export declare function interpolateObject(obj: T, context: InterpolationContext): T; /** * Create an interpolation context from a compact plan's athlete data. */ export declare function createContext(paces: Record, zones?: InterpolationContext["zones"], params?: Record): InterpolationContext; /** * Check if a string contains any interpolation markers. */ export declare function hasInterpolation(str: string): boolean; /** * Extract all variable names from a template string. * * @example * extractVariables("Run ${duration} min @ ${paces.easy}") * // ["duration", "paces.easy"] */ export declare function extractVariables(template: string): string[];