"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const R = require("ramda");
const filterImporter_1 = require("./filterImporter");
function filterShrinkwrap(shr, opts) {
    let pairs = R.toPairs(shr.packages || {})
        .filter(([relDepPath, pkg]) => !opts.skipped.has(relDepPath));
    if (!opts.include.dependencies) {
        pairs = pairs.filter(([relDepPath, pkg]) => pkg.dev !== false || pkg.optional);
    }
    if (!opts.include.devDependencies) {
        pairs = pairs.filter(([relDepPath, pkg]) => pkg.dev !== true);
    }
    if (!opts.include.optionalDependencies) {
        pairs = pairs.filter(([relDepPath, pkg]) => !pkg.optional);
    }
    return {
        importers: Object.keys(shr.importers).reduce((acc, importerId) => {
            acc[importerId] = filterImporter_1.default(shr.importers[importerId], opts.include);
            return acc;
        }, {}),
        packages: R.fromPairs(pairs),
        shrinkwrapVersion: shr.shrinkwrapVersion,
    };
}
exports.default = filterShrinkwrap;
//# sourceMappingURL=filterShrinkwrap.js.map