            .body
                    .appendChild(dialog);
            }
        } catch (error) {
            console.error('Error sharing mindmap:', error);
            alert('Failed to share mindmap. Please try again.');

            if (window.dataLayer) {
                window
                    .dataLayer
                    .push({'event': 'mindmap_share_error', 'action': 'Share Failed'});
            }
        }
    }

    function copyShareLink() {
        const shareLink = document.querySelecto