function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import isPropValid from '@emotion/is-prop-valid';
import { all as allProps } from './config';
var allPropnames = ['mode', 'variant'].concat(_toConsumableArray(Object.keys(allProps)));

/**
 * Emotion will not attempt to forward all system props - so this pre filters all possible exceptions to search agains
 * props like `color` and `width`.
 */
var validPropnames = allPropnames.filter(isPropValid);
export function createStyledOptions() {
  var additional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  // Cache possible valid prop names to prevent searching a larger list.
  var additionalExclusions = additional.filter(isPropValid);
  return {
    shouldForwardProp: function shouldForwardProp(prop) {
      return isPropValid(prop) && !validPropnames.includes(prop) && !additionalExclusions.includes(prop);
    }
  };
}

/**
 * @description
 * This object can be passed to the second argument of `styled('div', styledOptions)` or be called as a function to filter additional prop names
 * If you are extending a component that already has filtered props - you do not need to provide additional guards if  you are not passing additional props
 * @example
 * import { styledOptions } from '@codecademy/gamut-styles';
 * // default case for divs
 * styled('div', styledOptions)();
 * // elements other than div
 * styled('svg', styledOptions<'svg'>())();
 * // additional non system props to filter
 * styled('div', styledOptions(['data-invalidsomething']))();
 * // Extending existing components
 * styled(Box)()
 *
 */
export var styledOptions = Object.assign(createStyledOptions, createStyledOptions());