"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPushRejectedError = isPushRejectedError;
function isPushRejectedError(error) {
    if (!(error instanceof Error)) {
        return false;
    }
    const text = [
        error.name,
        error.message,
        readStringProperty(error, "stderr"),
        readStringProperty(error, "stdout"),
    ]
        .join("\n")
        .toLowerCase();
    return (text.includes("pushrejected") ||
        text.includes("push rejected") ||
        (text.includes("rejected") &&
            (text.includes("non-fast-forward") ||
                text.includes("fetch first") ||
                text.includes("failed to push some refs") ||
                text.includes("updates were rejected"))));
}
function readStringProperty(value, key) {
    const property = value[key];
    return typeof property === "string" ? property : "";
}
