"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.error = exports.warning = exports.isSameUser = exports.isSameDay = exports.StylePropType = void 0;
const prop_types_1 = __importDefault(require("prop-types"));
const dayjs_1 = __importDefault(require("dayjs"));
exports.StylePropType = prop_types_1.default.oneOfType([
    prop_types_1.default.array,
    prop_types_1.default.object,
    prop_types_1.default.number,
    prop_types_1.default.bool,
]);
function isSameDay(currentMessage, diffMessage) {
    if (!diffMessage || !diffMessage.createdAt) {
        return false;
    }
    const currentCreatedAt = dayjs_1.default(currentMessage.createdAt);
    const diffCreatedAt = dayjs_1.default(diffMessage.createdAt);
    if (!currentCreatedAt.isValid() || !diffCreatedAt.isValid()) {
        return false;
    }
    return currentCreatedAt.isSame(diffCreatedAt, 'day');
}
exports.isSameDay = isSameDay;
function isSameUser(currentMessage, diffMessage) {
    return !!(diffMessage &&
        diffMessage.user &&
        currentMessage.user &&
        diffMessage.user._id === currentMessage.user._id);
}
exports.isSameUser = isSameUser;
const styleString = (color) => `color: ${color}; font-weight: bold`;
const headerLog = '%c[react-native-gifted-chat]';
const warning = (...args) => console.log(headerLog, styleString('orange'), ...args);
exports.warning = warning;
const error = (...args) => console.log(headerLog, styleString('red'), ...args);
exports.error = error;
//# sourceMappingURL=utils.js.map