e.key === 'Escape') {
            closeViewer();
            closeRenameDialog();
        }
    });

    function renameMindmap(event, id) {
        event.stopPropagation();
        const history = JSON.parse(localStorage.getItem('mindmap-history') || '[]');
        const mindmap = history.find(item => item.id === id);

        if (!mindmap) 
            return;
        
        const overlay = document.createElement('div');
        overlay.className = 'overlay';
        overlay.style.display = 'block';

  