"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTitleListItem = exports.flattenGroupedItemsData = void 0;
var ramda_1 = require("ramda");
var flattenGroupedItemsData = function (groupedItems) {
    var getFlattenedItems = function (items) {
        return (0, ramda_1.flatten)(items.map(function (item) { return [item].concat(item.items ? getFlattenedItems(item.items) : []); }));
    };
    var titleItemIndex = null;
    var items = getFlattenedItems(groupedItems).map(function (item, index) {
        if (item && item.items) {
            titleItemIndex = index;
        }
        return { item: item, index: index, titleItemIndex: titleItemIndex };
    });
    return items;
};
exports.flattenGroupedItemsData = flattenGroupedItemsData;
var isTitleListItem = function (listItem) {
    return listItem.titleItemIndex === listItem.index;
};
exports.isTitleListItem = isTitleListItem;
