import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs) {
  return twMerge(clsx(inputs));
}

/**
 * Update a Vue ref with either a direct value or a function
 * Used by TanStack Table for state management
 * @param {*} updaterOrValue - Either a direct value or a function that takes current value
 * @param {import('vue').Ref} ref - The Vue ref to update
 */
export function valueUpdater(updaterOrValue, ref) {
  ref.value = typeof updaterOrValue === 'function'
    ? updaterOrValue(ref.value)
    : updaterOrValue;
}
