"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get getListWithInsertedItems () {
        return getListWithInsertedItems;
    },
    get getListWithRemovedItems () {
        return getListWithRemovedItems;
    }
});
const _function = require("../../../helpers/function");
const _array = require("../../../helpers/array");
function getListWithInsertedItems(indexedValues, insertionIndex, insertedIndexes, insertedValuesMapping) {
    const firstInsertedIndex = insertedIndexes.length ? insertedIndexes[0] : undefined;
    return [
        ...indexedValues.slice(0, firstInsertedIndex),
        ...insertedIndexes.map((insertedIndex, ordinalNumber)=>{
            if ((0, _function.isFunction)(insertedValuesMapping)) {
                return insertedValuesMapping(insertedIndex, ordinalNumber);
            }
            return insertedValuesMapping;
        }),
        ...firstInsertedIndex === undefined ? [] : indexedValues.slice(firstInsertedIndex)
    ];
}
function getListWithRemovedItems(indexedValues, removedIndexes) {
    return (0, _array.arrayFilter)(indexedValues, (_, index)=>removedIndexes.includes(index) === false);
}
