import { useEffect } from "react";
import { useGetAriaLabelOfPopover } from "./useGetAriaLabelOfPopover.mjs";
function useSetAriaLabelForPopover(visible) {
    const { getAriaLabel } = useGetAriaLabelOfPopover();
    useEffect(()=>{
        if (visible) {
            const wrappers = [
                ...document.querySelectorAll('.ant-popover-content')
            ];
            const currentWrapper = wrappers[wrappers.length - 1];
            if (currentWrapper) {
                currentWrapper.setAttribute('role', 'button');
                currentWrapper.setAttribute('data-testid', getAriaLabel());
                currentWrapper.setAttribute('aria-label', getAriaLabel());
            }
        }
    }, [
        getAriaLabel,
        visible
    ]);
}
export { useSetAriaLabelForPopover };
