import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import excludeVariablesFromRoot from './excludeVariablesFromRoot';
export default (function (theme) {
  return function (colorScheme, css) {
    if (theme.defaultColorScheme === colorScheme) {
      if (colorScheme === 'dark') {
        var excludedVariables = {};
        excludeVariablesFromRoot(theme.cssVarPrefix).forEach(function (cssVar) {
          excludedVariables[cssVar] = css[cssVar];
          delete css[cssVar];
        });
        return _defineProperty(_defineProperty({}, "[".concat(theme.attribute, "=\"").concat(String(colorScheme), "\"]"), excludedVariables), theme.colorSchemeSelector, css);
      }
      return "".concat(theme.colorSchemeSelector, ", [").concat(theme.attribute, "=\"").concat(String(colorScheme), "\"]");
    }
    if (colorScheme) {
      return "[".concat(theme.attribute, "=\"").concat(String(colorScheme), "\"]");
    }
    return theme.colorSchemeSelector;
  };
});