// Supported clients: iOS Safari, Android Chrome, PC Chrome/Edge/Firefox. // Gated on required API presence; anything missing → hard stop. export function supported(): string | null { if (typeof window === 'undefined') return 'window unavailable'; if (typeof createImageBitmap !== 'function') return 'createImageBitmap'; if (typeof Worker === 'undefined') return 'Worker'; if (typeof indexedDB === 'undefined') return 'IndexedDB'; const hasOffscreen = typeof OffscreenCanvas !== 'undefined' && typeof OffscreenCanvas.prototype.convertToBlob === 'function'; const hasCanvasBlob = typeof HTMLCanvasElement !== 'undefined' && typeof HTMLCanvasElement.prototype.toBlob === 'function'; if (!hasOffscreen && !hasCanvasBlob) return 'canvas PNG encode'; const ua = navigator.userAgent; const isIOS = /iPad|iPhone|iPod/.test(ua) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); const isAndroid = /Android/i.test(ua); const isSafari = /Safari/i.test(ua) && !/Chrome|CriOS|Edg|Firefox|FxiOS/i.test(ua); const isChrome = /Chrome|CriOS/i.test(ua) && !/Edg/i.test(ua); const isEdge = /Edg/i.test(ua); const isFirefox = /Firefox|FxiOS/i.test(ua); if (isIOS && isSafari) return null; if (isAndroid && isChrome) return null; if (!isIOS && !isAndroid && (isChrome || isEdge || isFirefox)) return null; return 'unsupported browser'; }