import { attributeNameReplacer } from './attribute-name-replacer.function';
export var BRACED_INDEX_REGEX = /\[(\d+)]/g;
/**
 * Creates a unique attribute value placeholder name to use in the expression
 *
 * @returns {string} The unique attribute value placeholder name in respect to the given existing value names (no duplicates)
 */
export function uniqAttributeValueName(key, existingValueNames) {
    key = key.replace(/\./g, '__').replace(BRACED_INDEX_REGEX, attributeNameReplacer);
    var potentialName = ":" + key;
    var idx = 1;
    if (existingValueNames && existingValueNames.length) {
        while (existingValueNames.includes(potentialName)) {
            idx++;
            potentialName = ":" + key + "_" + idx;
        }
    }
    return potentialName;
}
//# sourceMappingURL=unique-attribute-value-name.function.js.map