"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeParams = void 0;
exports.normalizeEmail = normalizeEmail;
const serializeParams = (params) => {
    return Object.entries(params)
        .reduce((acc, [k, v]) => {
        if (Array.isArray(v)) {
            for (const val of v) {
                acc.append(k, val);
            }
            return acc;
        }
        if (v) {
            acc.append(k, v);
        }
        return acc;
    }, new URLSearchParams())
        .toString();
};
exports.serializeParams = serializeParams;
function normalizeEmail(email) {
    if (!email) {
        return '';
    }
    email = email.trim().toLowerCase();
    if (email.endsWith('@gmail.com')) {
        const [localPart, domain] = email.split('@');
        const cleanedLocalPart = localPart.replace(/\./g, '').split('+')[0];
        return `${cleanedLocalPart}@${domain}`;
    }
    return email;
}
//# sourceMappingURL=utils.js.map