/* Share buttons — zero external scripts, just share URLs + navigator.share + clipboard. Mount into any container:
*/ (function () { function enc(s) { return encodeURIComponent(s); } window.Share = { mountAll() { document.querySelectorAll('[data-share]').forEach(function (el) { var url = location.href, title = document.title; var text = (window.I18N && I18N.t('share.title')) || 'Share'; var items = []; if (navigator.share) items.push({ label: '↗ ' + text, fn: function () { navigator.share({ title: title, url: url }).catch(function () {}); } }); items.push({ label: '𝕏', url: 'https://twitter.com/intent/tweet?url=' + enc(url) + '&text=' + enc(title) }); items.push({ label: 'in', url: 'https://www.linkedin.com/sharing/share-offsite/?url=' + enc(url) }); items.push({ label: '✈ telegram', url: 'https://t.me/share/url?url=' + enc(url) + '&text=' + enc(title) }); items.push({ label: '✆ whatsapp', url: 'https://wa.me/?text=' + enc(title + ' ' + url) }); items.push({ label: '🐘 mastodon', url: 'https://mastodon.social/share?text=' + enc(title + ' ' + url) }); items.push({ label: '✉ email', url: 'mailto:?subject=' + enc(title) + '&body=' + enc(url) }); items.push({ label: '🔗', fn: function () { (navigator.clipboard ? navigator.clipboard.writeText(url) : Promise.reject()).then(function () { el.querySelector('[data-copy]').textContent = '✓'; }).catch(function () { var t = document.createElement('input'); t.value = url; document.body.appendChild(t); t.select(); try { document.execCommand('copy'); } catch (e) {} t.remove(); }); }, copy: true }); el.innerHTML = ''; items.forEach(function (it) { var a = document.createElement(it.url ? 'a' : 'button'); a.textContent = it.label; a.className = 'share-btn'; if (it.copy) a.setAttribute('data-copy', ''); if (it.url) { a.href = it.url; a.target = '_blank'; a.rel = 'noopener nofollow'; } else a.addEventListener('click', it.fn); el.appendChild(a); }); }); } }; window.addEventListener('DOMContentLoaded', function () { Share.mountAll(); }); })();