export function createOffscreenCanvas({ width, height, }: { width: number; height: number; }): OffscreenCanvas | HTMLCanvasElement { try { return new OffscreenCanvas(width, height); } catch { const canvas = document.createElement("canvas"); canvas.width = width; canvas.height = height; return canvas; } }