"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MultiSet = void 0;
exports.toSnakeCase = toSnakeCase;
class MultiSet {
    constructor() {
        this._entries = new Map();
    }
    add(entry) {
        const key = JSON.stringify(Object.entries(entry).sort());
        this._entries.set(key, (this._entries.get(key) ?? 0) + 1);
    }
    clear() {
        this._entries.clear();
    }
    *[Symbol.iterator]() {
        for (const [key, count] of this._entries) {
            yield [Object.fromEntries(JSON.parse(key)), count];
        }
    }
}
exports.MultiSet = MultiSet;
function toSnakeCase(str) {
    const matches = str.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);
    if (!matches) {
        return str;
    }
    return matches.map((x) => x.toLowerCase()).join('_');
}
//# sourceMappingURL=helpers.js.map