"use strict";
// aside from holding the compiled binaries to run a validator for all of our supported systems
// this repo's main functionality is to expose the full path to the binary for the system that
// loaded this file
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBinPath = void 0;
const node_path_1 = require("node:path");
// NOTE: We are creating this file in the prebuild.sh script so that we can support cjs and esm
const module_specific_js_1 = require("./module-specific.js");
const _dirname = (0, module_specific_js_1.getDirname)();
// ref for all possilbe values of process.platform
const platformMap = {
    aix: "",
    darwin: "",
    freebsd: "",
    linux: "",
    openbsd: "",
    netbsd: "",
    sunos: "",
    win32: "",
    cygwin: "",
    android: "",
    haiku: "",
};
// top level keys are all possible values for process.arch
const archMap = {
    arm: platformMap,
    // we don't have an automated build setup for these, but a manual build is
    // included which might be out of date with the latest Validator release
    arm64: {
        aix: "",
        darwin: "darwin-arm64",
        freebsd: "linux-arm64",
        linux: "linux-arm64",
        openbsd: "linux-arm64",
        netbsd: "linux-arm64",
        sunos: "",
        win32: "windows-arm64.exe",
        cygwin: "",
        android: "",
        haiku: "",
    },
    ia32: platformMap,
    mips: platformMap,
    mipsel: platformMap,
    ppc: platformMap,
    ppc64: platformMap,
    s390: platformMap,
    s390x: platformMap,
    // a.k.a. amd64
    x64: {
        aix: "",
        darwin: "darwin-amd64",
        freebsd: "linux-amd64",
        linux: "linux-amd64",
        openbsd: "linux-amd64",
        netbsd: "linux-amd64",
        sunos: "",
        win32: "windows-amd64.exe",
        cygwin: "",
        android: "",
        haiku: "",
    },
};
const getBinPath = function () {
    const binName = getBinName();
    // _dirname is the dist/{module type} directory
    return `${(0, node_path_1.resolve)(_dirname, "..", "..", "bin", binName)}`;
};
exports.getBinPath = getBinPath;
const getBinName = function () {
    const arch = archMap[process.arch];
    const binName = arch[process.platform];
    // use `process` to determine what to return
    return binName;
};
