import { type ClassValue } from 'clsx'
import { create } from '@weapp-tailwindcss/merge';
import Taro from '@tarojs/taro';

// 根据当前环境判断是否需要转义
const isWeapp = Taro.getEnv() === Taro.ENV_TYPE.WEAPP;

const { twMerge } = create({
  // 仅在小程序环境下启用转义，H5环境禁用
  disableEscape: !isWeapp
});

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