"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBinaryEntry = exports.createConfig = exports.PACT_STANDALONE_VERSION = void 0;
var chalk = require("chalk");
exports.PACT_STANDALONE_VERSION = '1.89.02-rc1';
function throwError(msg) {
    throw new Error(chalk.red("Error while locating pact binary: " + msg));
}
function createConfig(location) {
    if (location === void 0) { location = process.cwd(); }
    var CHECKSUM_SUFFIX = '.checksum';
    return {
        binaries: [
            {
                platform: 'win32',
                binary: "pact-" + exports.PACT_STANDALONE_VERSION + "-win32.zip",
                binaryChecksum: "pact-" + exports.PACT_STANDALONE_VERSION + "-win32.zip" + CHECKSUM_SUFFIX,
                folderName: "win32-" + exports.PACT_STANDALONE_VERSION,
            },
            {
                platform: 'darwin',
                binary: "pact-" + exports.PACT_STANDALONE_VERSION + "-osx.tar.gz",
                binaryChecksum: "pact-" + exports.PACT_STANDALONE_VERSION + "-osx.tar.gz" + CHECKSUM_SUFFIX,
                folderName: "darwin-" + exports.PACT_STANDALONE_VERSION,
            },
            {
                platform: 'linux',
                arch: 'x64',
                binary: "pact-" + exports.PACT_STANDALONE_VERSION + "-linux-x86_64.tar.gz",
                binaryChecksum: "pact-" + exports.PACT_STANDALONE_VERSION + "-linux-x86_64.tar.gz" + CHECKSUM_SUFFIX,
                folderName: "linux-x64-" + exports.PACT_STANDALONE_VERSION,
            },
        ],
    };
}
exports.createConfig = createConfig;
var CONFIG = createConfig();
function getBinaryEntry(platform, arch) {
    platform = platform || process.platform;
    arch = arch || process.arch;
    for (var _i = 0, _a = CONFIG.binaries; _i < _a.length; _i++) {
        var value = _a[_i];
        if (value.platform === platform &&
            (value.arch ? value.arch === arch : true)) {
            return value;
        }
    }
    throw throwError("Cannot find binary for platform '" + platform + "' with architecture '" + arch + "'.");
}
exports.getBinaryEntry = getBinaryEntry;
//# sourceMappingURL=install.js.map