Utility to Conditionally Compose CSS Class Name Strings

Implement a classNames(...args) utility function (similar to the popular 'classnames' npm package widely used in React projects) that accepts any combination of strings, numbers, arrays, and plain objects as arguments and returns a single space-separated string of truthy class names. Rules: strings and numbers are included as-is; arrays are recursively processed; object keys are included only when their value is truthy; falsy values (false, null, undefined, 0, '') are ignored. Bonus: support a dedupe mode that removes duplicate class names from the final output.

Examples
Input: []
Output:
Hints

Utility to Conditionally Compose CSS Class Name Strings

Implement a classNames(...args) utility function (similar to the popular 'classnames' npm package widely used in React projects) that accepts any combination of strings, numbers, arrays, and plain objects as arguments and returns a single space-separated string of truthy class names. Rules: strings and numbers are included as-is; arrays are recursively processed; object keys are included only when their value is truthy; falsy values (false, null, undefined, 0, '') are ignored. Bonus: support a dedupe mode that removes duplicate class names from the final output.