        showError('Invalid mind map ID');
                        return;
                    }

                    const history = JSON.parse(localStorage.getItem('mindmap-history') || '[]');
                    const mindMapIndex = history.findIndex(item => item.id === +id);
                    const topic = document
                        .getElementById('topic-title')
                        .textContent;

                    if (mindMapIndex !== -1) {
                        history[mindMapIndex].mar