/**
 * @internal
 */ export const getTabRoleOnly = (container)=>[
        ...container.querySelectorAll('[role="tab"]')
    ];
/**
 * @internal
 */ export const scrollTabIntoView = (options)=>{
    const { container, vertical, forward, backward, activeIndex } = options;
    if (!container) {
        return;
    }
    const activeTab = getTabRoleOnly(container)[activeIndex];
    if (!activeTab) {
        return;
    }
    const sizeAttribute = vertical ? "offsetHeight" : "offsetWidth";
    const offsetAttribute = vertical ? "offsetTop" : "offsetLeft";
    const scrollAttribute = vertical ? "scrollTop" : "scrollLeft";
    const firstOffset = backward?.[sizeAttribute] || 0;
    const lastOffset = forward?.[sizeAttribute] || 0;
    const elementStart = activeTab[offsetAttribute];
    const elementEnd = elementStart + activeTab[sizeAttribute];
    const containerStart = container[scrollAttribute];
    const containerEnd = containerStart + container[sizeAttribute] - lastOffset;
    if (elementEnd > containerEnd) {
        const containerSize = container[sizeAttribute] - lastOffset;
        container[scrollAttribute] = elementEnd - containerSize;
    } else if (elementStart < containerStart + firstOffset) {
        container[scrollAttribute] = elementStart - firstOffset;
    }
};
/**
 * @since 6.0.0
 */ export const getTabListScrollToOptions = (options)=>{
    const { isRTL, animate, vertical, increment, container } = options;
    const { scrollLeft, scrollTop, scrollWidth, scrollHeight } = container;
    const currentScroll = vertical ? scrollTop : scrollLeft;
    const scrollDistance = vertical ? scrollHeight : scrollWidth;
    const amount = scrollDistance / 10 * (increment ? 1 : -1);
    const distance = currentScroll + amount * (vertical || !isRTL ? 1 : -1);
    return {
        left: vertical ? undefined : distance,
        top: vertical ? distance : undefined,
        behavior: animate ? "smooth" : "auto"
    };
};

//# sourceMappingURL=utils.js.map