export default function init() {
    // Three-dot row menu — same data-attribute pattern as /admin/users + /admin/workspaces.
    document.querySelectorAll('[data-row-menu-toggle]').forEach((btn) => {
        btn.addEventListener('click', (e) => {
            e.stopPropagation();
            const panel = btn.closest('[data-row-menu]')?.querySelector('[data-row-menu-panel]');
            if (!panel) return;
            document.querySelectorAll('[data-row-menu-panel]').forEach((p) => {
                if (p !== panel) p.classList.add('hidden');
            });
            panel.classList.toggle('hidden');
        });
    });
    document.addEventListener('click', () => {
        document.querySelectorAll('[data-row-menu-panel]').forEach((p) => p.classList.add('hidden'));
    });
    document.addEventListener('keydown', (e) => {
        if (e.key === 'Escape') {
            document.querySelectorAll('[data-row-menu-panel]').forEach((p) => p.classList.add('hidden'));
        }
    });
}
