;
        if (dialog) 
            dialog.remove();
        if (overlay) 
            overlay.remove();
        }
    
    document.addEventListener('keydown', function (e) {
        const mindmapVisible = document
            .getElementById('mindmap-viewer')
            .style
            .display === 'block';
        const isTyping = ['input', 'textarea'].includes(
            document.activeElement.tagName.toLowerCase()
        );

        if (mindmapVisible && !isTyping) {
            // Edit: E
      