import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

export function formatNodeName(name: string): string {
  // If the name looks like an ID (contains underscores or colons), try to format it nicely
  // Otherwise, assume it's already a human-readable name (like "新闻分析") and return as is.
  
  // Basic heuristic: If it has Chinese characters, it's probably already a name.
  if (/[\u4e00-\u9fa5]/.test(name)) {
      return name;
  }

  // Fallback for IDs: remove prefix, replace underscores
  return name.replace(/^(analysis:|fetch:)/, '').replace(/_/g, ' ');
}

