const getIndex = (model) => {
    const siblings = (model.page.getParent(model)?.children ||
        []);
    const fakeIndex = siblings.findIndex(v => v === model);
    // fakeIndex is the index of the model in the parent's children array
    // but we need to filter out the other list items
    let index = 0;
    for (let i = 0; i < fakeIndex; i++) {
        if (siblings[i].flavour === model.flavour &&
            siblings[i].type === model.type) {
            index += 1;
        }
        else {
            index = 0;
        }
    }
    return index;
};
const getListDeep = (model) => {
    let deep = 0;
    let parent = model.page.getParent(model);
    while (parent?.flavour === model.flavour) {
        deep++;
        parent = model.page.getParent(parent);
    }
    return deep;
};
export const getListInfo = (model) => {
    const deep = getListDeep(model);
    const index = getIndex(model);
    return { deep, index };
};
//# sourceMappingURL=get-list-info.js.map