/**
 * @fileoverview Interpolate keys from an object into a string with {{ }} markers.
 * @author Jed Fox
 */

"use strict";

//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------

module.exports = (text, data) => {
    if (!data) {
        return text;
    }
    return text.replace(/\{\{\s*([^{}]+?)\s*\}\}/g, (fullMatch, term) => {
        if (term in data) {
            return data[term];
        }

        // Preserve old behavior: If parameter name not provided, don't replace it.
        return fullMatch;
    });
};

@@ -380,16 +380,68 @@
 t;%0A    %7D
+%0A%0A    // Substitution content for any %7B%7B %7D%7D markers.
 %0A    ret
@@ -462,19 +462,16 @@
 ce(/%5C%7B%5C%7B
-%5Cs*
 (%5B%5E%7B%7D%5D+?
@@ -476,11 +476,8 @@
 +?)%5C
-s*%5C
 %7D%5C%7D/
@@ -495,22 +495,85 @@
 ch, term
-) =%3E %7B
+WithWhitespace) =%3E %7B%0A        const term = termWithWhitespace.trim();%0A
 %0A       

remove catastrophic backtracking vulnerability (fixes #10002) (#10019)