"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "default", {
    enumerable: true,
    get: function() {
        return loadNodeVersionInstall;
    }
});
var _installmodulelinked = /*#__PURE__*/ _interop_require_default(require("install-module-linked"));
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
function _getRequireWildcardCache(nodeInterop) {
    if (typeof WeakMap !== "function") return null;
    var cacheBabelInterop = new WeakMap();
    var cacheNodeInterop = new WeakMap();
    return (_getRequireWildcardCache = function(nodeInterop) {
        return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
    })(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
    if (!nodeInterop && obj && obj.__esModule) {
        return obj;
    }
    if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
        return {
            default: obj
        };
    }
    var cache = _getRequireWildcardCache(nodeInterop);
    if (cache && cache.has(obj)) {
        return cache.get(obj);
    }
    var newObj = {
        __proto__: null
    };
    var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for(var key in obj){
        if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
            var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
            if (desc && (desc.get || desc.set)) {
                Object.defineProperty(newObj, key, desc);
            } else {
                newObj[key] = obj[key];
            }
        }
    }
    newObj.default = obj;
    if (cache) {
        cache.set(obj, newObj);
    }
    return newObj;
}
var _dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
var nodeModules = _path.default.join(_dirname, '..', '..', '..', 'node_modules');
var moduleName = 'node-version-install';
var cached;
function loadModule(moduleName, callback) {
    if (typeof require === 'undefined') {
        Promise.resolve(moduleName).then(function(p) {
            return /*#__PURE__*/ _interop_require_wildcard(require(p));
        }).then(function(mod) {
            var _ref;
            callback(null, (_ref = mod === null || mod === void 0 ? void 0 : mod.default) !== null && _ref !== void 0 ? _ref : null);
        }).catch(callback);
    } else {
        try {
            callback(null, require(moduleName));
        } catch (err) {
            callback(err, null);
        }
    }
}
function loadNodeVersionInstall(callback) {
    if (cached !== undefined) return callback(null, cached);
    (0, _installmodulelinked.default)(moduleName, nodeModules, {}, function(err) {
        if (err) return callback(err, null);
        loadModule(moduleName, function(err, _cached) {
            if (err) return callback(err, null);
            cached = _cached;
            callback(null, cached);
        });
    });
}
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }