import { type ClassValue, clsx } from 'clsx' import { twMerge } from 'tailwind-merge' export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } export function generateApiKey(): string { const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' let result = 'nfc_' for (let i = 0; i < 32; i++) { result += chars.charAt(Math.floor(Math.random() * chars.length)) } return result } export function slugify(text: string): string { return text .toLowerCase() .replace(/[^a-z0-9]+/g, '-') .replace(/(^-|-$)/g, '') } export function formatPhone(phone: string): string { const cleaned = phone.replace(/\D/g, '') if (cleaned.startsWith('0') && cleaned.length === 11) { return '63' + cleaned.slice(1) } if (cleaned.startsWith('63') && cleaned.length === 12) return cleaned if (cleaned.length === 10) return '63' + cleaned return cleaned }