const TOLERANCE = 1; // Погрешность для субпиксельного рендеринга
const getIsFirstOverflowingTab = (item, maxScroll, orientation = 'horizontal')=>{
    if (!item.current) {
        return;
    }
    const currentOffset = orientation === 'horizontal' ? item.current.offsetLeft : item.current.offsetTop;
    if (currentOffset === undefined) {
        return;
    }
    return currentOffset < maxScroll - TOLERANCE;
};
const getIsLastOverflowingTab = (item, minScroll, orientation = 'horizontal')=>{
    if (!item.current) {
        return;
    }
    const currentOffset = orientation === 'horizontal' ? item.current.offsetLeft : item.current.offsetTop;
    if (currentOffset === undefined) {
        return;
    }
    const additionalOffset = orientation === 'horizontal' ? item.current.offsetWidth : item.current.offsetHeight;
    const itemRightEdge = currentOffset + additionalOffset;
    return itemRightEdge > minScroll + TOLERANCE;
};
export const getFirstOverflowingTab = (items, maxScroll, orientation = 'horizontal')=>items.find((item)=>getIsFirstOverflowingTab(item, maxScroll, orientation));
export const getLastOverflowingTab = (items, minScroll, orientation = 'horizontal')=>items.find((item)=>getIsLastOverflowingTab(item, minScroll, orientation));
