import log from '../../lib/log.js';
const tokenPattern = /{{\s*([A-Za-z][A-Za-z0-9]*)\s*}}/g;
export default function renderTemplate(template, vars) {
    const warnedTokens = new Set();
    return template.replace(tokenPattern, (match, token) => {
        if (token in vars) {
            return vars[token];
        }
        if (!warnedTokens.has(token)) {
            warnedTokens.add(token);
            log('warn', `Unknown component template token "{{ ${token} }}" left unchanged.`);
        }
        return match;
    });
}
