'use client'; import React from 'react'; import { Facebook, Instagram, Linkedin, Megaphone, Play, ImageIcon, } from 'lucide-react'; export type CreativeChannel = | 'meta_ads' | 'google_ads' | 'instagram' | 'facebook' | 'linkedin' | 'tiktok' | 'stories' | 'other'; export type CreativeFormat = | 'image' | 'video' | 'carousel' | 'reel' | 'story' | 'rsa' | 'pmax' | 'pmax_landscape' | 'pmax_square' | 'pmax_portrait' | 'pmax_vertical' | 'pmax_logo' | 'youtube' | 'other'; export type CreativePreviewData = { title: string; channel?: string | null; placement?: string | null; format?: string | null; headline?: string | null; primary_text?: string | null; description?: string | null; cta?: string | null; media_url?: string | null; brand_name?: string | null; landing_url?: string | null; }; function hostOf(url?: string | null): string { if (!url) return 'ejemplo.com'; try { return new URL(url).hostname.replace(/^www\./, ''); } catch { return url.replace(/^https?:\/\//, '').split('/')[0] || 'ejemplo.com'; } } function MediaBlock({ data, tall, dark, }: { data: CreativePreviewData; tall?: boolean; dark?: boolean; }) { const url = data.media_url?.trim(); const isVideo = (data.format || '').toLowerCase() === 'video' || (data.format || '').toLowerCase() === 'reel' || Boolean(url && /\.(mp4|webm|mov)(\?|$)/i.test(url)); if (url && isVideo) { return (