text: import hyphenate from 'fbjs/lib/hyphenateStyleName';
  import React, { cloneElement, Component, createElement } from 'react';
  import Stylis from 'stylis';
  import _insertRulePlugin from 'stylis-rule-sheet';
  import PropTypes from 'prop-types';
  import hoistStatics from 'hoist-non-react-statics';
  import { isValidElementType } from 'react-is';
  
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
    return typeof obj;
  } : function (obj) {
    return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  };
  
  var classCallCheck = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  };
  
  var createClass = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
  
    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();
  
  var _extends = Object.assign || function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
  
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
  
    return target;
  };
  
  var inherits = function (subClass, superClass) {
    if (typeof superClass !== "function" && superClass !== null) {
      throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
    }
  
    subClass.prototype = Object.create(superClass && superClass.prototype, {
      constructor: {
        value: subClass,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
    if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  };
  
  var objectWithoutProperties = function (obj, keys) {
    var target = {};
  
    for (var i in obj) {
      if (keys.indexOf(i) >= 0) continue;
      if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
      target[i] = obj[i];
    }
  
    return target;
  };
  
  var possibleConstructorReturn = function (self, call) {
    if (!self) {
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    }
  
    return call && (typeof call === "object" || typeof call === "function") ? call : self;
  };
  
  // 
  var isPlainObject = (function (x) {
    return (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && x.constructor === Object;
  });
  
  // 
  
  
  /**
   * Parse errors.md and turn it into a simple hash of code: message
   */
  var ERRORS = process.env.NODE_ENV !== 'production' ? {
    "1": "Cannot create styled-component for component: %s.\n\n",
    "2": "Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n* Are you trying to reuse it across renders?\n* Are you accidentally calling collectStyles twice?\n\n",
    "3": "Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",
    "4": "The `StyleSheetManager` expects a valid target or sheet prop!\n\n* Does this error occur on the client and is your target falsy?\n* Does this error occur on the server and is the sheet falsy?\n\n",
    "5": "The clone method cannot be used on the client!\n\n* Are you running in a client-like environment on the server?\n* Are you trying to run SSR on the client?\n\n",
    "6": "Trying to insert a new style tag, but the given Node is unmounted!\n\n* Are you using a custom target that isn't mounted?\n* Does your document not have a valid head element?\n* Have you accidentally removed a style tag manually?\n\n",
    "7": "ThemeProvider: Please return an object from your \"theme\" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n",
    "8": "ThemeProvider: Please make your \"theme\" prop an object.\n\n",
    "9": "Missing document `<head>`\n\n",
    "10": "Cannot find sheet for given tag\n\n",
    "11": "A plain React class (%s) has been interpolated into styles, probably as a component selector (https://www.styled-components.com/docs/advanced#referring-to-other-components). Only styled-component classes can be targeted in this fashion."
  } : {};
  
  /**
   * super basic version of sprintf
   */
  function format() {
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
  
    var a = args[0];
    var b = [];
    var c = void 0;
  
    for (c = 1; c < args.length; c += 1) {
      b.push(args[c]);
    }
  
    b.forEach(function (d) {
      a = a.replace(/%[a-z]/, d);
    });
  
    return a;
  }
  
  /**
   * Create an error file out of errors.md for development and a simple web link to the full errors
   * in production mode.
   */
  
  var StyledComponentsError = function (_Error) {
    inherits(StyledComponentsError, _Error);
  
    function StyledComponentsError(code) {
      classCallCheck(this, StyledComponentsError);
  
      for (var _len2 = arguments.length, interpolations = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
        interpolations[_key2 - 1] = arguments[_key2];
      }
  
      if (process.env.NODE_ENV === 'production') {
        var _this = possibleConstructorReturn(this, _Error.call(this, 'An error occurred. See https://github.com/styled-components/styled-components/blob/master/src/utils/errors.md#' + code + ' for more information. ' + (interpolations ? 'Additional arguments: ' + interpolations.join(', ') : '')));
      } else {
        var _this = possibleConstructorReturn(this, _Error.call(this, format.apply(undefined, [ERRORS[code]].concat(interpolations))));
      }
      return possibleConstructorReturn(_this);
    }
  
    return StyledComponentsError;
  }(Error);
  
  // 
  
  var objToCss = function objToCss(obj, prevKey) {
    var css = Object.keys(obj).filter(function (key) {
      var chunk = obj[key];
      return chunk !== undefined && chunk !== null && chunk !== false && chunk !== '';
    }).map(function (key) {
      if (isPlainObject(obj[key])) return objToCss(obj[key], key);
      return hyphenate(key) + ': ' + obj[key] + ';';
    }).join(' ');
    return prevKey ? prevKey + ' {\n  ' + css + '\n}' : css;
  };
  
  var flatten = function flatten(chunks, executionContext) {
    return chunks.reduce(function (ruleSet, chunk) {
      /* Remove falsey values */
      if (chunk === undefined || chunk === null || chunk === false || chunk === '') {
        return ruleSet;
      }
  
      /* Flatten ruleSet */
      if (Array.isArray(chunk)) {
        ruleSet.push.apply(ruleSet, flatten(chunk, executionContext));
        return ruleSet;
      }
  
      /* Handle other components */
      if (chunk.hasOwnProperty('styledComponentId')) {
        // $FlowFixMe not sure how to make this pass
        ruleSet.push('.' + chunk.styledComponentId);
        return ruleSet;
      }
  
      /* Either execute or defer the function */
      if (typeof chunk === 'function') {
        if (executionContext) {
          var nextChunk = chunk(executionContext);
          /* Throw if a React Element was given styles */
          if (React.isValidElement(nextChunk)) {
            var elementName = chunk.displayName || chunk.name;
            throw new StyledComponentsError(11, elementName);
          }
          ruleSet.push.apply(ruleSet, flatten([nextChunk], executionContext));
        } else ruleSet.push(chunk);
  
        return ruleSet;
      }
  
      /* Handle objects */
      ruleSet.push(
      // $FlowFixMe have to add %checks somehow to isPlainObject
      isPlainObject(chunk) ? objToCss(chunk) : chunk.toString());
  
      return ruleSet;
    }, []);
  };
  
  // 
  
  var COMMENT_REGEX = /^\s*\/\/.*$/gm;
  
  // NOTE: This stylis instance is only used to split rules from SSR'd style tags
  var stylisSplitter = new Stylis({
    global: false,
    cascade: true,
    keyframe: false,
    prefix: false,
    compress: false,
    semicolon: true
  });
  
  var stylis = new Stylis({
    global: false,
    cascade: true,
    keyframe: false,
    prefix: true,
    compress: false,
    semicolon: false // NOTE: This means "autocomplete missing semicolons"
  });
  
  // Wrap `insertRulePlugin to build a list of rules,
  // and then make our own plugin to return the rules. This
  // makes it easier to hook into the existing SSR architecture
  
  var parsingRules = [];
  // eslint-disable-next-line consistent-return
  var returnRulesPlugin = function returnRulesPlugin(context) {
    if (context === -2) {
      var parsedRules = parsingRules;
      parsingRules = [];
      return parsedRules;
    }
  };
  
  var parseRulesPlugin = _insertRulePlugin(function (rule) {
    parsingRules.push(rule);
  });
  
  stylis.use([parseRulesPlugin, returnRulesPlugin]);
  stylisSplitter.use([parseRulesPlugin, returnRulesPlugin]);
  
  var stringifyRules = function stringifyRules(rules, selector, prefix) {
    var flatCSS = rules.join('').replace(COMMENT_REGEX, ''); // replace JS comments
  
    var cssStr = selector && prefix ? prefix + ' ' + selector + ' { ' + flatCSS + ' }' : flatCSS;
  
    return stylis(prefix || !selector ? '' : selector, cssStr);
  };
  
  var splitByRules = function splitByRules(css) {
    return stylisSplitter('', css);
  };
  
  // 
  
  function isStyledComponent(target) /* : %checks */{
    return (
      // $FlowFixMe TODO: flow for styledComponentId
      typeof target === 'function' && typeof target.styledComponentId === 'string'
    );
  }
  
  // 
  
  /* This function is DEPRECATED and will be removed on the next major version release.
   * It was needed to rehydrate all style blocks prepended to chunks before React
   * tries to rehydrate its HTML stream. Since the master StyleSheet will now detect
   * the use of streamed style tags and will perform the rehydration earlier when needed
   * this function will not be needed anymore */
  function consolidateStreamedStyles() {
    if (process.env.NODE_ENV !== 'production') {
      // eslint-disable-next-line no-console
      console.warn('styled-components automatically does streaming SSR rehydration now.\n' + 'Calling consolidateStreamedStyles manually is no longer necessary and a noop now.\n' + '- Please remove the consolidateStreamedStyles call from your client.');
    }
  }
  
  // 
  /* eslint-disable no-bitwise */
  
  /* This is the "capacity" of our alphabet i.e. 2x26 for all letters plus their capitalised
   * counterparts */
  var charsLength = 52;
  
  /* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalised letters */
  var getAlphabeticChar = function getAlphabeticChar(code) {
    return String.fromCharCode(code + (code > 25 ? 39 : 97));
  };
  
  /* input a number, usually a hash and convert it to base-52 */
  var generateAlphabeticName = function generateAlphabeticName(code) {
    var name = '';
    var x = void 0;
  
    /* get a char and divide by alphabet-length */
    for (x = code; x > charsLength; x = Math.floor(x / charsLength)) {
      name = getAlphabeticChar(x % charsLength) + name;
    }
  
    return getAlphabeticChar(x % charsLength) + name;
  };
  
  // 
  
  var interleave = (function (strings, interpolations) {
    var result = [strings[0]];
  
    for (var i = 0, len = interpolations.length; i < len; i += 1) {
      result.push(interpolations[i], strings[i + 1]);
    }
  
    return result;
  });
  
  // 
  var EMPTY_ARRAY = Object.freeze([]);
  var EMPTY_OBJECT = Object.freeze({});
  
  // 
  
  var css = (function (styles) {
    for (var _len = arguments.length, interpolations = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      interpolations[_key - 1] = arguments[_key];
    }
  
    if (typeof styles === 'function' || isPlainObject(styles)) {
      // $FlowFixMe
      return flatten(interleave(EMPTY_ARRAY, [styles].concat(interpolations)));
    }
  
    // $FlowFixMe
    return flatten(interleave(styles, interpolations));
  });
  
  // 
  
  
  var SC_ATTR = typeof process !== 'undefined' && process.env.SC_ATTR || 'data-styled-components';
  var SC_STREAM_ATTR = 'data-styled-streamed';
  var CONTEXT_KEY = '__styled-components-stylesheet__';
  
  var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
  
  var DISABLE_SPEEDY = process.env.NODE_ENV !== 'production';
  
  // 
  var SC_COMPONENT_ID = /^[^\S\n]*?\/\* sc-component-id:\s*(\S+)\s+\*\//gm;
  
  var extractComps = (function (maybeCSS) {
    var css = '' + (maybeCSS || ''); // Definitely a string, and a clone
    var existingComponents = [];
    css.replace(SC_COMPONENT_ID, function (match, componentId, matchIndex) {
      existingComponents.push({ componentId: componentId, matchIndex: matchIndex });
      return match;
    });
    return existingComponents.map(function (_ref, i) {
      var componentId = _ref.componentId,
          matchIndex = _ref.matchIndex;
  
      var nextComp = existingComponents[i + 1];
      var cssFromDOM = nextComp ? css.slice(matchIndex, nextComp.matchIndex) : css.slice(matchIndex);
      return { componentId: componentId, cssFromDOM: cssFromDOM };
    });
  });
  
  // 
  /* eslint-disable camelcase, no-undef */
  
  var getNonce = (function () {
    return typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
  });
  
  // 
  // Helper to call a given function, only once
  var once = (function (cb) {
    var called = false;
  
    return function () {
      if (!called) {
        called = true;
        cb();
      }
    };
  });
  
  // 
  /* These are helpers for the StyleTags to keep track of the injected
   * rule names for each (component) ID that they're keeping track of.
   * They're crucial for detecting whether a name has already been
   * injected.
   * (This excludes rehydrated names) */
  
  /* adds a new ID:name pairing to a names dictionary */
  var addNameForId = function addNameForId(names, id, name) {
    if (name) {
      // eslint-disable-next-line no-param-reassign
      var namesForId = names[id] || (names[id] = Object.create(null));
      namesForId[name] = true;
    }
  };
  
  /* resets an ID entirely by overwriting it in the dictionary */
  var resetIdNames = function resetIdNames(names, id) {
    // eslint-disable-next-line no-param-reassign
    names[id] = Object.create(null);
  };
  
  /* factory for a names dictionary checking the existance of an ID:name pairing */
  var hasNameForId = function hasNameForId(names) {
    return function (id, name) {
      return names[id] !== undefined && names[id][name];
    };
  };
  
  /* stringifies names for the html/element output */
  var stringifyNames = function stringifyNames(names) {
    var str = '';
    // eslint-disable-next-line guard-for-in
    for (var id in names) {
      str += Object.keys(names[id]).join(' ') + ' ';
    }
    return str.trim();
  };
  
  /* clones the nested names dictionary */
  var cloneNames = function cloneNames(names) {
    var clone = Object.create(null);
    // eslint-disable-next-line guard-for-in
    for (var id in names) {
      clone[id] = _extends({}, names[id]);
    }
    return clone;
  };
  
  // 
  
  /* These are helpers that deal with the insertRule (aka speedy) API
   * They are used in the StyleTags and specifically the speedy tag
   */
  
  /* retrieve a sheet for a given style tag */
  var sheetForTag = function sheetForTag(tag) {
    // $FlowFixMe
    if (tag.sheet) return tag.sheet;
  
    /* Firefox quirk requires us to step through all stylesheets to find one owned by the given tag */
    var size = document.styleSheets.length;
    for (var i = 0; i < size; i += 1) {
      var sheet = document.styleSheets[i];
      // $FlowFixMe
      if (sheet.ownerNode === tag) return sheet;
    }
  
    /* we should always be able to find a tag */
    throw new StyledComponentsError(10);
  };
  
  /* insert a rule safely and return whether it was actually injected */
  var safeInsertRule = function safeInsertRule(sheet, cssRule, index) {
    /* abort early if cssRule string is falsy */
    if (!cssRule) return false;
  
    var maxIndex = sheet.cssRules.length;
  
    try {
      /* use insertRule and cap passed index with maxIndex (no of cssRules) */
      sheet.insertRule(cssRule, index <= maxIndex ? index : maxIndex);
    } catch (err) {
      /* any error indicates an invalid rule */
      return false;
    }
  
    return true;
  };
  
  /* deletes `size` rules starting from `removalIndex` */
  var deleteRules = function deleteRules(sheet, removalIndex, size) {
    var lowerBound = removalIndex - size;
    for (var i = removalIndex; i > lowerBound; i -= 1) {
      sheet.deleteRule(i);
    }
  };
  
  // 
  
  /* this marker separates component styles and is important for rehydration */
  var makeTextMarker = function makeTextMarker(id) {
    return '\n/* sc-component-id: ' + id + ' */\n';
  };
  
  /* add up all numbers in array up until and including the index */
  var addUpUntilIndex = function addUpUntilIndex(sizes, index) {
    var totalUpToIndex = 0;
    for (var i = 0; i <= index; i += 1) {
      totalUpToIndex += sizes[i];
    }
  
    return totalUpToIndex;
  };
  
  /* create a new style tag after lastEl */
  var makeStyleTag = function makeStyleTag(target, tagEl, insertBefore) {
    var el = document.createElement('style');
    el.setAttribute(SC_ATTR, '');
  
    var nonce = getNonce();
    if (nonce) {
      el.setAttribute('nonce', nonce);
    }
  
    /* Work around insertRule quirk in EdgeHTML */
    el.appendChild(document.createTextNode(''));
  
    if (target && !tagEl) {
      /* Append to target when no previous element was passed */
      target.appendChild(el);
    } else {
      if (!tagEl || !target || !tagEl.parentNode) {
        throw new StyledComponentsError(6);
      }
  
      /* Insert new style tag after the previous one */
      tagEl.parentNode.insertBefore(el, insertBefore ? tagEl : tagEl.nextSibling);
    }
  
    return el;
  };
  
  /* takes a css factory function and outputs an html styled tag factory */
  var wrapAsHtmlTag = function wrapAsHtmlTag(css, names) {
    return function (additionalAttrs) {
      var nonce = getNonce();
      var attrs = [nonce && 'nonce="' + nonce + '"', SC_ATTR + '="' + stringifyNames(names) + '"', additionalAttrs];
  
      var htmlAttr = attrs.filter(Boolean).join(' ');
      return '<style ' + htmlAttr + '>' + css() + '</style>';
    };
  };
  
  /* takes a css factory function and outputs an element factory */
  var wrapAsElement = function wrapAsElement(css, names) {
    return function () {
      var _props;
  
      var props = (_props = {}, _props[SC_ATTR] = stringifyNames(names), _props);
  
      var nonce = getNonce();
      if (nonce) {
        // $FlowFixMe
        props.nonce = nonce;
      }
  
      // eslint-disable-next-line react/no-danger
      return React.createElement('style', _extends({}, props, { dangerouslySetInnerHTML: { __html: css() } }));
    };
  };
  
  var getIdsFromMarkersFactory = function getIdsFromMarkersFactory(markers) {
    return function () {
      return Object.keys(markers);
    };
  };
  
  /* speedy tags utilise insertRule */
  var makeSpeedyTag = function makeSpeedyTag(el, getImportRuleTag) {
    var names = Object.create(null);
    var markers = Object.create(null);
    var sizes = [];
  
    var extractImport = getImportRuleTag !== undefined;
    /* indicates whther getImportRuleTag was called */
    var usedImportRuleTag = false;
  
    var insertMarker = function insertMarker(id) {
      var prev = markers[id];
      if (prev !== undefined) {
        return prev;
      }
  
      markers[id] = sizes.length;
      sizes.push(0);
      resetIdNames(names, id);
  
      return markers[id];
    };
  
    var insertRules = function insertRules(id, cssRules, name) {
      var marker = insertMarker(id);
      var sheet = sheetForTag(el);
      var insertIndex = addUpUntilIndex(sizes, marker);
  
      var injectedRules = 0;
      var importRules = [];
      var cssRulesSize = cssRules.length;
  
      for (var i = 0; i < cssRulesSize; i += 1) {
        var cssRule = cssRules[i];
        var mayHaveImport = extractImport; /* @import rules are reordered to appear first */
        if (mayHaveImport && cssRule.indexOf('@import') !== -1) {
          importRules.push(cssRule);
        } else if (safeInsertRule(sheet, cssRule, insertIndex + injectedRules)) {
          mayHaveImport = false;
          injectedRules += 1;
        }
      }
  
      if (extractImport && importRules.length > 0) {
        usedImportRuleTag = true;
        // $FlowFixMe
        getImportRuleTag().insertRules(id + '-import', importRules);
      }
  
      sizes[marker] += injectedRules; /* add up no of injected rules */
      addNameForId(names, id, name);
    };
  
    var removeRules = function removeRules(id) {
      var marker = markers[id];
      if (marker === undefined) return;
  
      var size = sizes[marker];
      var sheet = sheetForTag(el);
      var removalIndex = addUpUntilIndex(sizes, marker);
      deleteRules(sheet, removalIndex, size);
      sizes[marker] = 0;
      resetIdNames(names, id);
  
      if (extractImport && usedImportRuleTag) {
        // $FlowFixMe
        getImportRuleTag().removeRules(id + '-import');
      }
    };
  
    var css = function css() {
      var _sheetForTag = sheetForTag(el),
          cssRules = _sheetForTag.cssRules;
  
      var str = '';
  
      // eslint-disable-next-line guard-for-in
      for (var id in markers) {
        str += makeTextMarker(id);
        var marker = markers[id];
        var end = addUpUntilIndex(sizes, marker);
        var size = sizes[marker];
        for (var i = end - size; i < end; i += 1) {
          var rule = cssRules[i];
          if (rule !== undefined) {
            str += rule.cssText;
          }
        }
      }
  
      return str;
    };
  
    return {
      styleTag: el,
      getIds: getIdsFromMarkersFactory(markers),
      hasNameForId: hasNameForId(names),
      insertMarker: insertMarker,
      insertRules: insertRules,
      removeRules: removeRules,
      css: css,
      toHTML: wrapAsHtmlTag(css, names),
      toElement: wrapAsElement(css, names),
      clone: function clone() {
        throw new StyledComponentsError(5);
      }
    };
  };
  
  var makeTextNode = function makeTextNode(id) {
    return document.createTextNode(makeTextMarker(id));
  };
  
  var makeBrowserTag = function makeBrowserTag(el, getImportRuleTag) {
    var names = Object.create(null);
    var markers = Object.create(null);
  
    var extractImport = getImportRuleTag !== undefined;
  
    /* indicates whther getImportRuleTag was called */
    var usedImportRuleTag = false;
  
    var insertMarker = function insertMarker(id) {
      var prev = markers[id];
      if (prev !== undefined) {
        return prev;
      }
  
      markers[id] = makeTextNode(id);
      el.appendChild(markers[id]);
      names[id] = Object.create(null);
  
      return markers[id];
    };
  
    var insertRules = function insertRules(id, cssRules, name) {
      var marker = insertMarker(id);
      var importRules = [];
      var cssRulesSize = cssRules.length;
  
      for (var i = 0; i < cssRulesSize; i += 1) {
        var rule = cssRules[i];
        var mayHaveImport = extractImport;
        if (mayHaveImport && rule.indexOf('@import') !== -1) {
          importRules.push(rule);
        } else {
          mayHaveImport = false;
          var separator = i === cssRulesSize - 1 ? '' : ' ';
          marker.appendData('' + rule + separator);
        }
      }
  
      addNameForId(names, id, name);
  
      if (extractImport && importRules.length > 0) {
        usedImportRuleTag = true;
        // $FlowFixMe
        getImportRuleTag().insertRules(id + '-import', importRules);
      }
    };
  
    var removeRules = function removeRules(id) {
      var marker = markers[id];
      if (marker === undefined) return;
  
      /* create new empty text node and replace the current one */
      var newMarker = makeTextNode(id);
      el.replaceChild(newMarker, marker);
      markers[id] = newMarker;
      resetIdNames(names, id);
  
      if (extractImport && usedImportRuleTag) {
        // $FlowFixMe
        getImportRuleTag().removeRules(id + '-import');
      }
    };
  
    var css = function css() {
      var str = '';
      // eslint-disable-next-line guard-for-in
      for (var id in markers) {
        str += markers[id].data;
      }
      return str;
    };
  
    return {
      clone: function clone() {
        throw new StyledComponentsError(5);
      },
  
      css: css,
      getIds: getIdsFromMarkersFactory(markers),
      hasNameForId: hasNameForId(names),
      insertMarker: insertMarker,
      insertRules: insertRules,
      removeRules: removeRules,
      styleTag: el,
      toElement: wrapAsElement(css, names),
      toHTML: wrapAsHtmlTag(css, names)
    };
  };
  
  var makeServerTagInternal = function makeServerTagInternal(namesArg, markersArg) {
    var names = namesArg === undefined ? Object.create(null) : namesArg;
    var markers = markersArg === undefined ? Object.create(null) : markersArg;
  
    var insertMarker = function insertMarker(id) {
      var prev = markers[id];
      if (prev !== undefined) {
        return prev;
      }
  
      return markers[id] = [''];
    };
  
    var insertRules = function insertRules(id, cssRules, name) {
      var marker = insertMarker(id);
      marker[0] += cssRules.join(' ');
      addNameForId(names, id, name);
    };
  
    var removeRules = function removeRules(id) {
      var marker = markers[id];
      if (marker === undefined) return;
      marker[0] = '';
      resetIdNames(names, id);
    };
  
    var css = function css() {
      var str = '';
      // eslint-disable-next-line guard-for-in
      for (var id in markers) {
        var cssForId = markers[id][0];
        if (cssForId) {
          str += makeTextMarker(id) + cssForId;
        }
      }
      return str;
    };
  
    var clone = function clone() {
      var namesClone = cloneNames(names);
      var markersClone = Object.create(null);
  
      // eslint-disable-next-line guard-for-in
      for (var id in markers) {
        markersClone[id] = [markers[id][0]];
      }
  
      return makeServerTagInternal(namesClone, markersClone);
    };
  
    var tag = {
      clone: clone,
      css: css,
      getIds: getIdsFromMarkersFactory(markers),
      hasNameForId: hasNameForId(names),
      insertMarker: insertMarker,
      insertRules: insertRules,
      removeRules: removeRules,
      styleTag: null,
      toElement: wrapAsElement(css, names),
      toHTML: wrapAsHtmlTag(css, names)
    };
  
    return tag;
  };
  
  var makeServerTag = function makeServerTag() {
    return makeServerTagInternal();
  };
  
  var makeTag = function makeTag(target, tagEl, forceServer, insertBefore, getImportRuleTag) {
    if (IS_BROWSER && !forceServer) {
      var el = makeStyleTag(target, tagEl, insertBefore);
  
      if (DISABLE_SPEEDY) {
        return makeBrowserTag(el, getImportRuleTag);
      } else {
        return makeSpeedyTag(el, getImportRuleTag);
      }
    }
  
    return makeServerTag();
  };
  
  /* wraps a given tag so that rehydration is performed once when necessary */
  var makeRehydrationTag = function makeRehydrationTag(tag, els, extracted, immediateRehydration) {
    /* rehydration function that adds all rules to the new tag */
    var rehydrate = once(function () {
      /* add all extracted components to the new tag */
      for (var i = 0, len = extracted.length; i < len; i += 1) {
        var _extracted$i = extracted[i],
            componentId = _extracted$i.componentId,
            cssFromDOM = _extracted$i.cssFromDOM;
  
        var cssRules = splitByRules(cssFromDOM);
        tag.insertRules(componentId, cssRules);
      }
  
      /* remove old HTMLStyleElements, since they have been rehydrated */
      for (var _i = 0, _len = els.length; _i < _len; _i += 1) {
        var el = els[_i];
        if (el.parentNode) {
          el.parentNode.removeChild(el);
        }
      }
    });
  
    if (immediateRehydration) rehydrate();
  
    return _extends({}, tag, {
      /* add rehydration hook to insertion methods */
      insertMarker: function insertMarker(id) {
        rehydrate();
        return tag.insertMarker(id);
      },
      insertRules: function insertRules(id, cssRules, name) {
        rehydrate();
        return tag.insertRules(id, cssRules, name);
      }
    });
  };
  
  // 
  
  var SPLIT_REGEX = /\s+/;
  
  /* determine the maximum number of components before tags are sharded */
  var MAX_SIZE = void 0;
  if (IS_BROWSER) {
    /* in speedy mode we can keep a lot more rules in a sheet before a slowdown can be expected */
    MAX_SIZE = DISABLE_SPEEDY ? 40 : 1000;
  } else {
    /* for servers we do not need to shard at all */
    MAX_SIZE = -1;
  }
  
  var sheetRunningId = 0;
  var master = void 0;
  
  var StyleSheet = function () {
    /* a map from ids to tags */
    /* deferred rules for a given id */
    /* this is used for not reinjecting rules via hasNameForId() */
    /* when rules for an id are removed using remove() we have to ignore rehydratedNames for it */
    /* a list of tags belonging to this StyleSheet */
    /* a tag for import rules */
    /* current capacity until a new tag must be created */
    /* children (aka clones) of this StyleSheet inheriting all and future injections */
  
    function StyleSheet() {
      var _this = this;
  
      var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : IS_BROWSER ? document.head : null;
      var forceServer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      classCallCheck(this, StyleSheet);
  
      this.getImportRuleTag = function () {
        var importRuleTag = _this.importRuleTag;
  
        if (importRuleTag !== undefined) {
          return importRuleTag;
        }
  
        var firstTag = _this.tags[0];
        var insertBefore = true;
  
        return _this.importRuleTag = makeTag(_this.target, firstTag ? firstTag.styleTag : null, _this.forceServer, insertBefore);
      };
  
      sheetRunningId += 1;
      this.id = sheetRunningId;
      this.sealed = false;
      this.forceServer = forceServer;
      this.target = forceServer ? null : target;
      this.tagMap = {};
      this.deferred = {};
      this.rehydratedNames = {};
      this.ignoreRehydratedNames = {};
      this.tags = [];
      this.capacity = 1;
      this.clones = [];
    }
  
    /* rehydrate all SSR'd style tags */
  
  
    StyleSheet.prototype.rehydrate = function rehydrate() {
      if (!IS_BROWSER || this.forceServer) {
        return this;
      }
  
      var els = [];
      var extracted = [];
      var isStreamed = false;
  
      /* retrieve all of our SSR style elements from the DOM */
      var nodes = document.querySelectorAll('style[' + SC_ATTR + ']');
      var nodesSize = nodes.length;
  
      /* abort rehydration if no previous style tags were found */
      if (nodesSize === 0) {
        return this;
      }
  
      for (var i = 0; i < nodesSize; i += 1) {
        // $FlowFixMe: We can trust that all elements in this query are style elements
        var el = nodes[i];
  
        /* check if style tag is a streamed tag */
        if (!isStreamed) isStreamed = !!el.getAttribute(SC_STREAM_ATTR);
  
        /* retrieve all component names */
        var elNames = (el.getAttribute(SC_ATTR) || '').trim().split(SPLIT_REGEX);
        var elNamesSize = elNames.length;
        for (var j = 0; j < elNamesSize; j += 1) {
          var name = elNames[j];
          /* add rehydrated name to sheet to avoid readding styles */
          this.rehydratedNames[name] = true;
        }
  
        /* extract all components and their CSS */
        extracted.push.apply(extracted, extractComps(el.textContent));
  
        /* store original HTMLStyleElement */
        els.push(el);
      }
  
      /* abort rehydration if nothing was extracted */
      var extractedSize = extracted.length;
      if (extractedSize === 0) {
        return this;
      }
  
      /* create a tag to be used for rehydration */
      var tag = this.makeTag(null);
      var rehydrationTag = makeRehydrationTag(tag, els, extracted, isStreamed);
  
      /* reset capacity and adjust MAX_SIZE by the initial size of the rehydration */
      this.capacity = Math.max(1, MAX_SIZE - extractedSize);
      this.tags.push(rehydrationTag);
  
      /* retrieve all component ids */
      for (var _j = 0; _j < extractedSize; _j += 1) {
        this.tagMap[extracted[_j].componentId] = rehydrationTag;
      }
  
      return this;
    };
  
    /* retrieve a "master" instance of StyleSheet which is typically used when no other is available
     * The master StyleSheet is targeted by injectGlobal, keyframes, and components outside of any
      * StyleSheetManager's context */
  
  
    /* reset the internal "master" instance */
    StyleSheet.reset = function reset() {
      var forceServer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  
      master = new StyleSheet(undefined, forceServer).rehydrate();
    };
  
    /* adds "children" to the StyleSheet that inherit all of the parents' rules
     * while their own rules do not affect the parent */
  
  
    StyleSheet.prototype.clone = function clone() {
      var sheet = new StyleSheet(this.target, this.forceServer);
      /* add to clone array */
      this.clones.push(sheet);
  
      /* clone all tags */
      sheet.tags = this.tags.map(function (tag) {
        var ids = tag.getIds();
        var newTag = tag.clone();
  
        /* reconstruct tagMap */
        for (var i = 0; i < ids.length; i += 1) {
          sheet.tagMap[ids[i]] = newTag;
        }
  
        return newTag;
      });
  
      /* clone other maps */
      sheet.rehydratedNames = _extends({}, this.rehydratedNames);
      sheet.deferred = _extends({}, this.deferred);
  
      return sheet;
    };
  
    /* force StyleSheet to create a new tag on the next injection */
  
  
    StyleSheet.prototype.sealAllTags = function sealAllTags() {
      this.capacity = 1;
      this.sealed = true;
    };
  
    StyleSheet.prototype.makeTag = function makeTag$$1(tag) {
      var lastEl = tag ? tag.styleTag : null;
      var insertBefore = false;
  
      return makeTag(this.target, lastEl, this.forceServer, insertBefore, this.getImportRuleTag);
    };
  
    /* get a tag for a given componentId, assign the componentId to one, or shard */
    StyleSheet.prototype.getTagForId = function getTagForId(id) {
      /* simply return a tag, when the componentId was already assigned one */
      var prev = this.tagMap[id];
      if (prev !== undefined && !this.sealed) {
        return prev;
      }
  
      var tag = this.tags[this.tags.length - 1];
  
      /* shard (create a new tag) if the tag is exhausted (See MAX_SIZE) */
      this.capacity -= 1;
      if (this.capacity === 0) {
        this.capacity = MAX_SIZE;
        this.sealed = false;
        tag = this.makeTag(tag);
        this.tags.push(tag);
      }
  
      return this.tagMap[id] = tag;
    };
  
    /* mainly for injectGlobal to check for its id */
  
  
    StyleSheet.prototype.hasId = function hasId(id) {
      return this.tagMap[id] !== undefined;
    };
  
    /* caching layer checking id+name to already have a corresponding tag and injected rules */
  
  
    StyleSheet.prototype.hasNameForId = function hasNameForId(id, name) {
      /* exception for rehydrated names which are checked separately */
      if (this.ignoreRehydratedNames[id] === undefined && this.rehydratedNames[name]) {
        return true;
      }
  
      var tag = this.tagMap[id];
      return tag !== undefined && tag.hasNameForId(id, name);
    };
  
    /* registers a componentId and registers it on its tag */
  
  
    StyleSheet.prototype.deferredInject = function deferredInject(id, cssRules) {
      /* don't inject when the id is already registered */
      if (this.tagMap[id] !== undefined) return;
  
      var clones = this.clones;
  
      for (var i = 0; i < clones.length; i += 1) {
        clones[i].deferredInject(id, cssRules);
      }
  
      this.getTagForId(id).insertMarker(id);
      this.deferred[id] = cssRules;
    };
  
    /* injects rules for a given id with a name that will need to be cached */
  
  
    StyleSheet.prototype.inject = function inject(id, cssRules, name) {
      var clones = this.clones;
  
      for (var i = 0; i < clones.length; i += 1) {
        clones[i].inject(id, cssRules, name);
      }
  
      var tag = this.getTagForId(id);
  
      /* add deferred rules for component */
      if (this.deferred[id] !== undefined) {
        // Combine passed cssRules with previously deferred CSS rules
        // NOTE: We cannot mutate the deferred array itself as all clones
        // do the same (see clones[i].inject)
        var rules = this.deferred[id].concat(cssRules);
        tag.insertRules(id, rules, name);
        this.deferred[id] = undefined;
      } else {
        tag.insertRules(id, cssRules, name);
      }
    };
  
    /* removes all rules for a given id, which doesn't remove its marker but resets it */
  
  
    StyleSheet.prototype.remove = function remove(id) {
      var tag = this.tagMap[id];
      if (tag === undefined) return;
  
      var clones = this.clones;
  
      for (var i = 0; i < clones.length; i += 1) {
        clones[i].remove(id);
      }
  
      /* remove all rules from the tag */
      tag.removeRules(id);
      /* ignore possible rehydrated names */
      this.ignoreRehydratedNames[id] = true;
      /* delete possible deferred rules */
      this.deferred[id] = undefined;
    };
  
    StyleSheet.prototype.toHTML = function toHTML() {
      return this.tags.map(function (tag) {
        return tag.toHTML();
      }).join('');
    };
  
    StyleSheet.prototype.toReactElements = function toReactElements() {
      var id = this.id;
  
  
      return this.tags.map(function (tag, i) {
        var key = 'sc-' + id + '-' + i;
        return cloneElement(tag.toElement(), { key: key });
      });
    };
  
    createClass(StyleSheet, null, [{
      key: 'master',
      get: function get$$1() {
        return master || (master = new StyleSheet().rehydrate());
      }
  
      /* NOTE: This is just for backwards-compatibility with jest-styled-components */
  
    }, {
      key: 'instance',
      get: function get$$1() {
        return StyleSheet.master;
      }
    }]);
    return StyleSheet;
  }();
  
  var _StyleSheetManager$ch;
  
  var StyleSheetManager = function (_Component) {
    inherits(StyleSheetManager, _Component);
  
    function StyleSheetManager() {
      classCallCheck(this, StyleSheetManager);
      return possibleConstructorReturn(this, _Component.apply(this, arguments));
    }
  
    StyleSheetManager.prototype.getChildContext = function getChildContext() {
      var _ref;
  
      return _ref = {}, _ref[CONTEXT_KEY] = this.sheetInstance, _ref;
    };
  
    StyleSheetManager.prototype.componentWillMount = function componentWillMount() {
      if (this.props.sheet) {
        this.sheetInstance = this.props.sheet;
      } else if (this.props.target) {
        this.sheetInstance = new StyleSheet(this.props.target);
      } else {
        throw new StyledComponentsError(4);
      }
    };
  
    StyleSheetManager.prototype.render = function render() {
      /* eslint-disable react/prop-types */
      // Flow v0.43.1 will report an error accessing the `children` property,
      // but v0.47.0 will not. It is necessary to use a type cast instead of
      // a "fixme" comment to satisfy both Flow versions.
      return React.Children.only(this.props.children);
    };
  
    return StyleSheetManager;
  }(Component);
  
  StyleSheetManager.childContextTypes = (_StyleSheetManager$ch = {}, _StyleSheetManager$ch[CONTEXT_KEY] = PropTypes.oneOfType([PropTypes.instanceOf(StyleSheet), PropTypes.instanceOf(ServerStyleSheet)]).isRequired, _StyleSheetManager$ch);
  process.env.NODE_ENV !== "production" ? StyleSheetManager.propTypes = {
    sheet: PropTypes.oneOfType([PropTypes.instanceOf(StyleSheet), PropTypes.instanceOf(ServerStyleSheet)]),
    target: PropTypes.shape({
      appendChild: PropTypes.func.isRequired
    })
  } : void 0;
  
  // 
  
  var ServerStyleSheet = function () {
    function ServerStyleSheet() {
      classCallCheck(this, ServerStyleSheet);
  
      /* The master sheet might be reset, so keep a reference here */
      this.masterSheet = StyleSheet.master;
      this.instance = this.masterSheet.clone();
      this.closed = false;
    }
  
    ServerStyleSheet.prototype.complete = function complete() {
      if (!this.closed) {
        /* Remove closed StyleSheets from the master sheet */
        var index = this.masterSheet.clones.indexOf(this.instance);
        this.masterSheet.clones.splice(index, 1);
        this.closed = true;
      }
    };
  
    ServerStyleSheet.prototype.collectStyles = function collectStyles(children) {
      if (this.closed) {
        throw new StyledComponentsError(2);
      }
  
      return React.createElement(
        StyleSheetManager,
        { sheet: this.instance },
        children
      );
    };
  
    ServerStyleSheet.prototype.getStyleTags = function getStyleTags() {
      this.complete();
      return this.instance.toHTML();
    };
  
    ServerStyleSheet.prototype.getStyleElement = function getStyleElement() {
      this.complete();
      return this.instance.toReactElements();
    };
  
    ServerStyleSheet.prototype.interleaveWithNodeStream = function interleaveWithNodeStream(readableStream) {
      var _this = this;
  
      {
        throw new StyledComponentsError(3);
      }
  
      /* the tag index keeps track of which tags have already been emitted */
      var instance = this.instance;
  
      var instanceTagIndex = 0;
  
      var streamAttr = SC_STREAM_ATTR + '="true"';
  
      var transformer = new stream.Transform({
        transform: function appendStyleChunks(chunk, /* encoding */_, callback) {
          var tags = instance.tags;
  
          var html = '';
  
          /* retrieve html for each new style tag */
          for (; instanceTagIndex < tags.length; instanceTagIndex += 1) {
            var tag = tags[instanceTagIndex];
            html += tag.toHTML(streamAttr);
          }
  
          /* force our StyleSheets to emit entirely new tags */
          instance.sealAllTags();
  
          /* prepend style html to chunk */
          this.push(html + chunk);
          callback();
        }
      });
  
      readableStream.on('end', function () {
        return _this.complete();
      });
      readableStream.on('error', function (err) {
        _this.complete();
  
        // forward the error to the transform stream
        transformer.emit('error', err);
      });
  
      return readableStream.pipe(transformer);
    };
  
    return ServerStyleSheet;
  }();
  
  // 
  
  var LIMIT = 200;
  
  var createWarnTooManyClasses = (function (displayName) {
    var generatedClasses = {};
    var warningSeen = false;
  
    return function (className) {
      if (!warningSeen) {
        generatedClasses[className] = true;
        if (Object.keys(generatedClasses).length >= LIMIT) {
          // Unable to find latestRule in test environment.
          /* eslint-disable no-console, prefer-template */
          console.warn('Over ' + LIMIT + ' classes were generated for component ' + displayName + '. \n' + 'Consider using the attrs method, together with a style object for frequently changed styles.\n' + 'Example:\n' + '  const Component = styled.div.attrs({\n' + '    style: ({ background }) => ({\n' + '      background,\n' + '    }),\n' + '  })`width: 100%;`\n\n' + '  <Component />');
          warningSeen = true;
          generatedClasses = {};
        }
      }
    };
  });
  
  // 
  
  var determineTheme = (function (props, fallbackTheme, defaultProps) {
    // Props should take precedence over ThemeProvider, which should take precedence over
    // defaultProps, but React automatically puts defaultProps on props.
  
    /* eslint-disable react/prop-types */
    var isDefaultTheme = defaultProps && props.theme === defaultProps.theme;
    var theme = props.theme && !isDefaultTheme ? props.theme : fallbackTheme;
    /* eslint-enable */
  
    return theme;
  });
  
  // 
  var escapeRegex = /[[\].#*$><+~=|^:(),"'`-]+/g;
  var dashesAtEnds = /(^-|-$)/g;
  
  /**
   * TODO: Explore using CSS.escape when it becomes more available
   * in evergreen browsers.
   */
  function escape(str) {
    return str
    // Replace all possible CSS selectors
    .replace(escapeRegex, '-')
  
    // Remove extraneous hyphens at the start and end
    .replace(dashesAtEnds, '');
  }
  
  // 
  
  function getComponentName(target) {
    return target.displayName || target.name || 'Component';
  }
  
  // 
  
  function isTag(target) /* : %checks */{
    return typeof target === 'string';
  }
  
  // 
  
  function generateDisplayName(target) {
    return isTag(target) ? 'styled.' + target : 'Styled(' + getComponentName(target) + ')';
  }
  
  // 
  /* eslint-disable max-len */
  /**
   * Trying to avoid the unknown-prop errors on styled components by filtering by
   * React's attribute whitelist.
   *
   * To regenerate this regex:
   *
   * 1. `npm i -g regexgen` (https://github.com/devongovett/regexgen)
   * 2. Run `regexgen` with the list of space-separated words below as input
   * 3. Surround the emitted regex with this: `/^(GENERATED_REGEX)$/` -- this will ensure a full string match
   *    and no false positives from partials
   * */
  /*
  children dangerouslySetInnerHTML key ref autoFocus defaultValue valueLink defaultChecked checkedLink innerHTML suppressContentEditableWarning onFocusIn onFocusOut className onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown onKeyPress onKeyUp onFocus onBlur onChange onInput onInvalid onSubmit onReset onClick onContextMenu onDoubleClick onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onAnimationStart onAnimationEnd onAnimationIteration onTransitionEnd onCopyCapture onCutCapture onPasteCapture onCompositionEndCapture onCompositionStartCapture onCompositionUpdateCapture onKeyDownCapture onKeyPressCapture onKeyUpCapture onFocusCapture onBlurCapture onChangeCapture onInputCapture onSubmitCapture onResetCapture onClickCapture onContextMenuCapture onDoubleClickCapture onDragCapture onDragEndCapture onDragEnterCapture onDragExitCapture onDragLeaveCapture onDragOverCapture onDragStartCapture onDropCapture onMouseDownCapture onMouseEnterCapture onMouseLeaveCapture onMouseMoveCapture onMouseOutCapture onMouseOverCapture onMouseUpCapture onSelectCapture onTouchCancelCapture onTouchEndCapture onTouchMoveCapture onTouchStartCapture onScrollCapture onWheelCapture onAbortCapture onCanPlayCapture onCanPlayThroughCapture onDurationChangeCapture onEmptiedCapture onEncryptedCapture onEndedCapture onErrorCapture onLoadedDataCapture onLoadedMetadataCapture onLoadStartCapture onPauseCapture onPlayCapture onPlayingCapture onProgressCapture onRateChangeCapture onSeekedCapture onSeekingCapture onStalledCapture onSuspendCapture onTimeUpdateCapture onVolumeChangeCapture onWaitingCapture onLoadCapture onAnimationStartCapture onAnimationEndCapture onAnimationIterationCapture onTransitionEndCapture accept acceptCharset accessKey action allowFullScreen allowTransparency alt as async autoComplete autoPlay capture cellPadding cellSpacing charSet challenge checked cite classID className cols colSpan content contentEditable contextMenu controlsList controls coords crossOrigin data dateTime default defer dir disabled download draggable encType form formAction formEncType formMethod formNoValidate formTarget frameBorder headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media mediaGroup method min minLength multiple muted name nonce noValidate open optimum pattern placeholder playsInline poster preload profile radioGroup readOnly referrerPolicy rel required reversed role rows rowSpan sandbox scope scoped scrolling seamless selected shape size sizes span spellCheck src srcDoc srcLang srcSet start step style summary tabIndex target title type useMap value width wmode wrap about datatype inlist prefix property resource typeof vocab autoCapitalize autoCorrect autoSave color itemProp itemScope itemType itemID itemRef results security unselectable accentHeight accumulate additive alignmentBaseline allowReorder alphabetic amplitude arabicForm ascent attributeName attributeType autoReverse azimuth baseFrequency baseProfile baselineShift bbox begin bias by calcMode capHeight clip clipPath clipRule clipPathUnits colorInterpolation colorInterpolationFilters colorProfile colorRendering contentScriptType contentStyleType cursor cx cy d decelerate descent diffuseConstant direction display divisor dominantBaseline dur dx dy edgeMode elevation enableBackground end exponent externalResourcesRequired fill fillOpacity fillRule filter filterRes filterUnits floodColor floodOpacity focusable fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight format from fx fy g1 g2 glyphName glyphOrientationHorizontal glyphOrientationVertical glyphRef gradientTransform gradientUnits hanging horizAdvX horizOriginX ideographic imageRendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength kerning keyPoints keySplines keyTimes lengthAdjust letterSpacing lightingColor limitingConeAngle local markerEnd markerMid markerStart markerHeight markerUnits markerWidth mask maskContentUnits maskUnits mathematical mode numOctaves offset opacity operator order orient orientation origin overflow overlinePosition overlineThickness paintOrder panose1 pathLength patternContentUnits patternTransform patternUnits pointerEvents points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits r radius refX refY renderingIntent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry scale seed shapeRendering slope spacing specularConstant specularExponent speed spreadMethod startOffset stdDeviation stemh stemv stitchTiles stopColor stopOpacity strikethroughPosition strikethroughThickness string stroke strokeDasharray strokeDashoffset strokeLinecap strokeLinejoin strokeMiterlimit strokeOpacity strokeWidth surfaceScale systemLanguage tableValues targetX targetY textAnchor textDecoration textRendering textLength to transform u1 u2 underlinePosition underlineThickness unicode unicodeBidi unicodeRange unitsPerEm vAlphabetic vHanging vIdeographic vMathematical values vectorEffect version vertAdvY vertOriginX vertOriginY viewBox viewTarget visibility widths wordSpacing writingMode x xHeight x1 x2 xChannelSelector xlinkActuate xlinkArcrole xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType xmlBase xmlns xmlnsXlink xmlLang xmlSpace y y1 y2 yChannelSelector z zoomAndPan onPointerDown onPointerMove onPointerUp onPointerCancel onGotPointerCapture onLostPointerCapture onPointerEnter onPointerLeave onPointerOver onPointerOut class for autofocus
  */
  /* eslint-enable max-len */
  
  var ATTRIBUTE_REGEX = /^((?:s(?:uppressContentEditableWarn|croll|pac)|(?:shape|image|text)Render|(?:letter|word)Spac|vHang|hang)ing|(?:on(?:AnimationIteration|C(?:o(?:mposition(?:Update|Start|End)|ntextMenu|py)|anPlayThrough|anPlay|hange|lick|ut)|(?:Animation|Touch|Load|Drag)Start|(?:(?:Duration|Volume|Rate)Chang|(?:MouseLea|(?:Touch|Mouse)Mo|DragLea)v|Paus)e|Loaded(?:Metad|D)ata|(?:(?:T(?:ransition|ouch)|Animation)E|Suspe)nd|DoubleClick|(?:TouchCanc|Whe)el|Lo(?:stPointer|ad)|TimeUpdate|(?:Mouse(?:Ent|Ov)e|Drag(?:Ent|Ov)e|Erro)r|GotPointer|MouseDown|(?:E(?:n(?:crypt|d)|mpti)|S(?:tall|eek))ed|KeyPress|(?:MouseOu|DragExi|S(?:elec|ubmi)|Rese|Inpu)t|P(?:rogress|laying)|DragEnd|Key(?:Down|Up)|(?:MouseU|Dro)p|(?:Wait|Seek)ing|Scroll|Focus|Paste|Abort|Drag|Play|Blur)Captur|alignmentBaselin|(?:limitingConeAng|xlink(?:(?:Arcr|R)o|Tit)|s(?:urfaceSca|ty|ca)|unselectab|baseProfi|fontSty|(?:focus|dragg)ab|multip|profi|tit)l|d(?:ominantBaselin|efaultValu)|onPointerLeav|a(?:uto(?:Capitaliz|Revers|Sav)|dditiv)|(?:(?:formNoValid|xlinkActu|noValid|accumul|rot)a|autoComple|decelera)t|(?:(?:attribute|item)T|datat)yp|onPointerMov|(?:attribute|glyph)Nam|playsInlin|(?:writing|input|edge)Mod|(?:formE|e)ncTyp|(?:amplitu|mo)d|(?:xlinkTy|itemSco|keyTy|slo)p|(?:xmlSpa|non)c|fillRul|(?:dateTi|na)m|r(?:esourc|ol)|xmlBas|wmod)e|(?:glyphOrientationHorizont|loc)al|(?:externalResourcesRequir|select|revers|mut)ed|c(?:o(?:lorInterpolationFilter|ord)s|o(?:lor(?:Interpolation)?|nt(?:rols|ent))|(?:ontentS(?:cript|tyle)Typ|o(?:ntentEditab|lorProfi)l|l(?:assNam|ipRul)|a(?:lcMod|ptur)|it)e|olorRendering|l(?:ipPathUnits|assID)|(?:ontrolsLis|apHeigh)t|h(?:eckedLink|a(?:llenge|rSet)|ildren|ecked)|ell(?:Spac|Padd)ing|o(?:ntextMenu|ls)|(?:rossOrigi|olSpa)n|l(?:ip(?:Path)?|ass)|ursor|[xy])|glyphOrientationVertical|d(?:angerouslySetInnerHTML|efaultChecked|ownload|isabled|isplay|[xy])|(?:s(?:trikethroughThickn|eaml)es|(?:und|ov)erlineThicknes|r(?:equiredExtension|adiu)|(?:requiredFeatur|tableValu|stitchTil|numOctav|filterR)e|key(?:(?:Splin|Tim)e|Param)|auto[Ff]ocu|header|bia)s|(?:(?:st(?:rikethroughPosi|dDevia)|(?:und|ov)erlinePosi|(?:textDecor|elev)a|orienta)tio|(?:strokeLinejo|orig)i|on(?:PointerDow|FocusI)|formActio|zoomAndPa|directio|(?:vers|act)io|rowSpa|begi|ico)n|o(?:n(?:AnimationIteration|C(?:o(?:mposition(?:Update|Start|End)|ntextMenu|py)|anPlayThrough|anPlay|hange|lick|ut)|(?:(?:Duration|Volume|Rate)Chang|(?:MouseLea|(?:Touch|Mouse)Mo|DragLea)v|Paus)e|Loaded(?:Metad|D)ata|(?:Animation|Touch|Load|Drag)Start|(?:(?:T(?:ransition|ouch)|Animation)E|Suspe)nd|DoubleClick|(?:TouchCanc|Whe)el|(?:Mouse(?:Ent|Ov)e|Drag(?:Ent|Ov)e|Erro)r|TimeUpdate|(?:E(?:n(?:crypt|d)|mpti)|S(?:tall|eek))ed|MouseDown|P(?:rogress|laying)|(?:MouseOu|DragExi|S(?:elec|ubmi)|Rese|Inpu)t|KeyPress|DragEnd|Key(?:Down|Up)|(?:Wait|Seek)ing|(?:MouseU|Dro)p|Scroll|Paste|Focus|Abort|Drag|Play|Load|Blur)|rient)|p(?:reserveA(?:spectRatio|lpha)|ointsAt[X-Z]|anose1)|(?:patternContent|ma(?:sk(?:Content)?|rker)|primitive|gradient|pattern|filter)Units|(?:(?:allowTranspar|baseFrequ)enc|re(?:ferrerPolic|adOnl)|(?:(?:st(?:roke|op)O|floodO|fillO|o)pac|integr|secur)it|visibilit|fontFamil|accessKe|propert|summar)y|(?:gradientT|patternT|t)ransform|(?:[xy]ChannelSelect|lightingCol|textAnch|floodCol|stopCol|operat|htmlF)or|(?:strokeMiterlimi|(?:specularConsta|repeatCou|fontVaria)n|(?:(?:specularE|e)xpon|renderingInt|asc)en|d(?:iffuseConsta|esce)n|(?:fontSizeAdju|lengthAdju|manife)s|baselineShif|onPointerOu|vectorEffec|(?:(?:mar(?:ker|gin)|x)H|accentH|fontW)eigh|markerStar|a(?:utoCorrec|bou)|onFocusOu|intercep|restar|forma|inlis|heigh|lis)t|(?:(?:st(?:rokeDasho|artO)|o)ffs|acceptChars|formTarg|viewTarg|srcS)et|k(?:ernel(?:UnitLength|Matrix)|[1-4])|(?:(?:enableBackgrou|markerE)n|s(?:p(?:readMetho|ee)|ee)|formMetho|(?:markerM|onInval)i|preloa|metho|kin)d|strokeDasharray|(?:onPointerCanc|lab)el|(?:allowFullScre|hidd)en|systemLanguage|(?:(?:o(?:nPointer(?:Ent|Ov)|rd)|allowReord|placehold|frameBord|paintOrd|post)e|repeatDu|d(?:efe|u))r|v(?:Mathematical|ert(?:Origin[XY]|AdvY)|alues|ocab)|(?:pointerEve|keyPoi)nts|(?:strokeLineca|onPointerU|itemPro|useMa|wra|loo)p|h(?:oriz(?:Origin|Adv)X|ttpEquiv)|(?:vI|i)deographic|unicodeRange|mathematical|vAlphabetic|u(?:nicodeBidi|[12])|(?:fontStretc|hig)h|(?:(?:mar(?:ker|gin)W|strokeW)id|azimu)th|(?:xmlnsXl|valueL)ink|mediaGroup|spellCheck|(?:text|m(?:in|ax))Length|(?:unitsPerE|optimu|fro)m|r(?:adioGroup|e(?:sults|f[XY]|l)|ows|[xy])|a(?:rabicForm|l(?:phabetic|t)|sync)|pathLength|innerHTML|xlinkShow|(?:xlinkHr|glyphR)ef|(?:tabInde|(?:sand|b)bo|viewBo)x|(?:(?:href|xml|src)La|kerni)ng|autoPlay|o(?:verflow|pen)|f(?:o(?:ntSize|rm?)|il(?:ter|l))|r(?:e(?:quired|sult|f))?|divisor|p(?:attern|oints)|unicode|d(?:efault|ata|ir)?|i(?:temRef|n2|s)|t(?:arget[XY]|o)|srcDoc|s(?:coped|te(?:m[hv]|p)|pan)|(?:width|size)s|prefix|typeof|itemID|s(?:t(?:roke|art)|hape|cope|rc)|t(?:arget|ype)|(?:stri|la)ng|a(?:ccept|s)|m(?:edia|a(?:sk|x)|in)|x(?:mlns)?|width|value|size|href|k(?:ey)?|end|low|by|i[dn]|y[12]|g[12]|x[12]|f[xy]|[yz])$/;
  
  /* From DOMProperty */
  var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
  var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
  var isCustomAttribute = RegExp.prototype.test.bind(new RegExp('^(x|data|aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'));
  
  var validAttr = (function (name) {
    return ATTRIBUTE_REGEX.test(name) || isCustomAttribute(name.toLowerCase());
  });
  
  // 
  
  function hasInInheritanceChain(child, parent) {
    var target = child;
  
    while (target) {
      target = Object.getPrototypeOf(target);
  
      if (target && target === parent) {
        return true;
      }
    }
  
    return false;
  }
  
  // 
  /**
   * Creates a broadcast that can be listened to, i.e. simple event emitter
   *
   * @see https://github.com/ReactTraining/react-broadcast
   */
  
  var createBroadcast = function createBroadcast(initialState) {
    var listeners = {};
    var id = 0;
    var state = initialState;
  
    function publish(nextState) {
      state = nextState;
  
      // eslint-disable-next-line guard-for-in, no-restricted-syntax
      for (var key in listeners) {
        var listener = listeners[key];
        if (listener === undefined) {
          // eslint-disable-next-line no-continue
          continue;
        }
  
        listener(state);
      }
    }
  
    function subscribe(listener) {
      var currentId = id;
      listeners[currentId] = listener;
      id += 1;
      listener(state);
      return currentId;
    }
  
    function unsubscribe(unsubID) {
      listeners[unsubID] = undefined;
    }
  
    return { publish: publish, subscribe: subscribe, unsubscribe: unsubscribe };
  };
  
  var _contextShape, _ThemeProvider$contex;
  
  // NOTE: DO NOT CHANGE, changing this is a semver major change!
  var CHANNEL = '__styled-components__';
  var CHANNEL_NEXT = CHANNEL + 'next__';
  
  var CONTEXT_CHANNEL_SHAPE = PropTypes.shape({
    getTheme: PropTypes.func,
    subscribe: PropTypes.func,
    unsubscribe: PropTypes.func
  });
  
  var contextShape = (_contextShape = {}, _contextShape[CHANNEL] = PropTypes.func, _contextShape[CHANNEL_NEXT] = CONTEXT_CHANNEL_SHAPE, _contextShape);
  
  var warnChannelDeprecated = void 0;
  if (process.env.NODE_ENV !== 'production') {
    warnChannelDeprecated = once(function () {
      // eslint-disable-next-line no-console
      console.error('Warning: Usage of `context.' + CHANNEL + '` as a function is deprecated. It will be replaced with the object on `.context.' + CHANNEL_NEXT + '` in a future version.');
    });
  }
  
  var isFunction = function isFunction(test) {
    return typeof test === 'function';
  };
  
  /**
   * Provide a theme to an entire react component tree via context and event listeners (have to do
   * both context and event emitter as pure components block context updates)
   */
  
  var ThemeProvider = function (_Component) {
    inherits(ThemeProvider, _Component);
  
    function ThemeProvider() {
      classCallCheck(this, ThemeProvider);
  
      var _this = possibleConstructorReturn(this, _Component.call(this));
  
      _this.unsubscribeToOuterId = -1;
  
      _this.getTheme = _this.getTheme.bind(_this);
      return _this;
    }
  
    ThemeProvider.prototype.componentWillMount = function componentWillMount() {
      var _this2 = this;
  
      // If there is a ThemeProvider wrapper anywhere around this theme provider, merge this theme
      // with the outer theme
      var outerContext = this.context[CHANNEL_NEXT];
      if (outerContext !== undefined) {
        this.unsubscribeToOuterId = outerContext.subscribe(function (theme) {
          _this2.outerTheme = theme;
  
          if (_this2.broadcast !== undefined) {
            _this2.publish(_this2.props.theme);
          }
        });
      }
  
      this.broadcast = createBroadcast(this.getTheme());
    };
  
    ThemeProvider.prototype.getChildContext = function getChildContext() {
      var _this3 = this,
          _babelHelpers$extends;
  
      return _extends({}, this.context, (_babelHelpers$extends = {}, _babelHelpers$extends[CHANNEL_NEXT] = {
        getTheme: this.getTheme,
        subscribe: this.broadcast.subscribe,
        unsubscribe: this.broadcast.unsubscribe
      }, _babelHelpers$extends[CHANNEL] = function (subscriber) {
        if (process.env.NODE_ENV !== 'production') {
          warnChannelDeprecated();
        }
  
        // Patch the old `subscribe` provide via `CHANNEL` for older clients.
        var unsubscribeId = _this3.broadcast.subscribe(subscriber);
        return function () {
          return _this3.broadcast.unsubscribe(unsubscribeId);
        };
      }, _babelHelpers$extends));
    };
  
    ThemeProvider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
      if (this.props.theme !== nextProps.theme) {
        this.publish(nextProps.theme);
      }
    };
  
    ThemeProvider.prototype.componentWillUnmount = function componentWillUnmount() {
      if (this.unsubscribeToOuterId !== -1) {
        this.context[CHANNEL_NEXT].unsubscribe(this.unsubscribeToOuterId);
      }
    };
  
    // Get the theme from the props, supporting both (outerTheme) => {} as well as object notation
  
  
    ThemeProvider.prototype.getTheme = function getTheme(passedTheme) {
      var theme = passedTheme || this.props.theme;
  
      if (isFunction(theme)) {
        var mergedTheme = theme(this.outerTheme);
  
        if (process.env.NODE_ENV !== 'production' && (mergedTheme === null || Array.isArray(mergedTheme) || (typeof mergedTheme === 'undefined' ? 'undefined' : _typeof(mergedTheme)) !== 'object')) {
          throw new StyledComponentsError(7);
        }
  
        return mergedTheme;
      }
  
      if (theme === null || Array.isArray(theme) || (typeof theme === 'undefined' ? 'undefined' : _typeof(theme)) !== 'object') {
        throw new StyledComponentsError(8);
      }
  
      return _extends({}, this.outerTheme, theme);
    };
  
    ThemeProvider.prototype.publish = function publish(theme) {
      this.broadcast.publish(this.getTheme(theme));
    };
  
    ThemeProvider.prototype.render = function render() {
      if (!this.props.children) {
        return null;
      }
  
      return React.Children.only(this.props.children);
    };
  
    return ThemeProvider;
  }(Component);
  
  ThemeProvider.childContextTypes = contextShape;
  ThemeProvider.contextTypes = (_ThemeProvider$contex = {}, _ThemeProvider$contex[CHANNEL_NEXT] = CONTEXT_CHANNEL_SHAPE, _ThemeProvider$contex);
  
  var _babelHelpers$extends;
  
  // HACK for generating all static styles without needing to allocate
  // an empty execution context every single time...
  var STATIC_EXECUTION_CONTEXT = {};
  
  var modifiedContextShape = _extends({}, contextShape, (_babelHelpers$extends = {}, _babelHelpers$extends[CONTEXT_KEY] = PropTypes.oneOfType([PropTypes.instanceOf(StyleSheet), PropTypes.instanceOf(ServerStyleSheet)]), _babelHelpers$extends));
  
  var identifiers = {};
  
  /* We depend on components having unique IDs */
  var generateId = function generateId(ComponentStyle, _displayName, parentComponentId) {
    var displayName = typeof _displayName !== 'string' ? 'sc' : escape(_displayName);
  
    /**
     * This ensures uniqueness if two components happen to share
     * the same displayName.
     */
    var nr = (identifiers[displayName] || 0) + 1;
    identifiers[displayName] = nr;
  
    var componentId = displayName + '-' + ComponentStyle.generateName(displayName + nr);
  
    return parentComponentId !== undefined ? parentComponentId + '-' + componentId : componentId;
  };
  
  var warnExtendDeprecated = function warnExtendDeprecated() {};
  if (process.env.NODE_ENV !== 'production') {
    warnExtendDeprecated = once(function () {
      // eslint-disable-next-line no-console
      console.error('Warning: The "extend" API will be removed in the upcoming v4.0 release. Use styled(StyledComponent) instead. You can find more information here: https://github.com/styled-components/styled-components/issues/1546');
    });
  }
  
  // $FlowFixMe
  
  var BaseStyledComponent = function (_Component) {
    inherits(BaseStyledComponent, _Component);
  
    function BaseStyledComponent() {
      var _temp, _this, _ret;
  
      classCallCheck(this, BaseStyledComponent);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.attrs = {}, _this.state = {
        theme: null,
        generatedClassName: ''
      }, _this.unsubscribeId = -1, _temp), possibleConstructorReturn(_this, _ret);
    }
  
    BaseStyledComponent.prototype.unsubscribeFromContext = function unsubscribeFromContext() {
      if (this.unsubscribeId !== -1) {
        this.context[CHANNEL_NEXT].unsubscribe(this.unsubscribeId);
      }
    };
  
    BaseStyledComponent.prototype.buildExecutionContext = function buildExecutionContext(theme, props) {
      var attrs = this.constructor.attrs;
  
      var context = _extends({}, props, { theme: theme });
      if (attrs === undefined) {
        return context;
      }
  
      this.attrs = Object.keys(attrs).reduce(function (acc, key) {
        var attr = attrs[key];
  
        // eslint-disable-next-line no-param-reassign
        acc[key] = typeof attr === 'function' && !hasInInheritanceChain(attr, Component) ? attr(context) : attr;
        return acc;
      }, {});
  
      return _extends({}, context, this.attrs);
    };
  
    BaseStyledComponent.prototype.generateAndInjectStyles = function generateAndInjectStyles(theme, props) {
      var _constructor = this.constructor,
          attrs = _constructor.attrs,
          componentStyle = _constructor.componentStyle,
          warnTooManyClasses = _constructor.warnTooManyClasses;
  
      var styleSheet = this.context[CONTEXT_KEY] || StyleSheet.master;
  
      // statically styled-components don't need to build an execution context object,
      // and shouldn't be increasing the number of class names
      if (componentStyle.isStatic && attrs === undefined) {
        return componentStyle.generateAndInjectStyles(STATIC_EXECUTION_CONTEXT, styleSheet);
      } else {
        var executionContext = this.buildExecutionContext(theme, props);
        var className = componentStyle.generateAndInjectStyles(executionContext, styleSheet);
  
        if (process.env.NODE_ENV !== 'production' && warnTooManyClasses !== undefined) {
          warnTooManyClasses(className);
        }
  
        return className;
      }
    };
  
    BaseStyledComponent.prototype.componentWillMount = function componentWillMount() {
      var _this2 = this;
  
      var componentStyle = this.constructor.componentStyle;
  
      var styledContext = this.context[CHANNEL_NEXT];
  
      // If this is a statically-styled component, we don't need to the theme
      // to generate or build styles.
      if (componentStyle.isStatic) {
        var generatedClassName = this.generateAndInjectStyles(STATIC_EXECUTION_CONTEXT, this.props);
        this.setState({ generatedClassName: generatedClassName });
        // If there is a theme in the context, subscribe to the event emitter. This
        // is necessary due to pure components blocking context updates, this circumvents
        // that by updating when an event is emitted
      } else if (styledContext !== undefined) {
        var subscribe = styledContext.subscribe;
  
        this.unsubscribeId = subscribe(function (nextTheme) {
          // This will be called once immediately
          var theme = determineTheme(_this2.props, nextTheme, _this2.constructor.defaultProps);
  
          var generatedClassName = _this2.generateAndInjectStyles(theme, _this2.props);
  
          _this2.setState({ theme: theme, generatedClassName: generatedClassName });
        });
      } else {
        // eslint-disable-next-line react/prop-types
        var theme = this.props.theme || EMPTY_OBJECT;
        var _generatedClassName = this.generateAndInjectStyles(theme, this.props);
        this.setState({ theme: theme, generatedClassName: _generatedClassName });
      }
    };
  
    BaseStyledComponent.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
      var _this3 = this;
  
      // If this is a statically-styled component, we don't need to listen to
      // props changes to update styles
      var componentStyle = this.constructor.componentStyle;
  
      if (componentStyle.isStatic) {
        return;
      }
  
      this.setState(function (prevState) {
        var theme = determineTheme(nextProps, prevState.theme, _this3.constructor.defaultProps);
        var generatedClassName = _this3.generateAndInjectStyles(theme, nextProps);
  
        return { theme: theme, generatedClassName: generatedClassName };
      });
    };
  
    BaseStyledComponent.prototype.componentWillUnmount = function componentWillUnmount() {
      this.unsubscribeFromContext();
    };
  
    BaseStyledComponent.prototype.render = function render() {
      // eslint-disable-next-line react/prop-types
      var innerRef = this.props.innerRef;
      var generatedClassName = this.state.generatedClassName;
      var _constructor2 = this.constructor,
          styledComponentId = _constructor2.styledComponentId,
          target = _constructor2.target;
  
  
      var isTargetTag = isTag(target);
  
      var className = [
      // eslint-disable-next-line react/prop-types
      this.props.className, styledComponentId, this.attrs.className, generatedClassName].filter(Boolean).join(' ');
  
      var baseProps = _extends({}, this.attrs, {
        className: className
      });
  
      if (isStyledComponent(target)) {
        baseProps.innerRef = innerRef;
      } else {
        baseProps.ref = innerRef;
      }
  
      var propsForElement = baseProps;
      var key = void 0;
  
      for (key in this.props) {
        // Don't pass through non HTML tags through to HTML elements
        // always omit innerRef
        if (key !== 'innerRef' && key !== 'className' && (!isTargetTag || validAttr(key))) {
          propsForElement[key] = key === 'style' && key in this.attrs ? _extends({}, this.attrs[key], this.props[key]) : this.props[key];
        }
      }
  
      return createElement(target, propsForElement);
    };
  
    return BaseStyledComponent;
  }(Component);
  
  var _StyledComponent = (function (ComponentStyle, constructWithOptions) {
    var createStyledComponent = function createStyledComponent(target, options, rules) {
      var _options$isClass = options.isClass,
          isClass = _options$isClass === undefined ? !isTag(target) : _options$isClass,
          _options$displayName = options.displayName,
          displayName = _options$displayName === undefined ? generateDisplayName(target) : _options$displayName,
          _options$componentId = options.componentId,
          componentId = _options$componentId === undefined ? generateId(ComponentStyle, options.displayName, options.parentComponentId) : _options$componentId,
          _options$ParentCompon = options.ParentComponent,
          ParentComponent = _options$ParentCompon === undefined ? BaseStyledComponent : _options$ParentCompon,
          extendingRules = options.rules,
          attrs = options.attrs;
  
  
      var styledComponentId = options.displayName && options.componentId ? escape(options.displayName) + '-' + options.componentId : options.componentId || componentId;
  
      var componentStyle = new ComponentStyle(extendingRules === undefined ? rules : extendingRules.concat(rules), attrs, styledComponentId);
  
      var StyledComponent = function (_ParentComponent) {
        inherits(StyledComponent, _ParentComponent);
  
        function StyledComponent() {
          classCallCheck(this, StyledComponent);
          return possibleConstructorReturn(this, _ParentComponent.apply(this, arguments));
        }
  
        StyledComponent.withComponent = function withComponent(tag) {
          var previousComponentId = options.componentId,
              optionsToCopy = objectWithoutProperties(options, ['componentId']);
  
  
          var newComponentId = previousComponentId && previousComponentId + '-' + (isTag(tag) ? tag : escape(getComponentName(tag)));
  
          var newOptions = _extends({}, optionsToCopy, {
            componentId: newComponentId,
            ParentComponent: StyledComponent
          });
  
          return createStyledComponent(tag, newOptions, rules);
        };
  
        createClass(StyledComponent, null, [{
          key: 'extend',
          get: function get$$1() {
            var rulesFromOptions = options.rules,
                parentComponentId = options.componentId,
                optionsToCopy = objectWithoutProperties(options, ['rules', 'componentId']);
  
  
            var newRules = rulesFromOptions === undefined ? rules : rulesFromOptions.concat(rules);
  
            var newOptions = _extends({}, optionsToCopy, {
              rules: newRules,
              parentComponentId: parentComponentId,
              ParentComponent: StyledComponent
            });
  
            warnExtendDeprecated();
  
            return constructWithOptions(createStyledComponent, target, newOptions);
          }
        }]);
        return StyledComponent;
      }(ParentComponent);
  
      StyledComponent.attrs = attrs;
      StyledComponent.componentStyle = componentStyle;
      StyledComponent.contextTypes = modifiedContextShape;
      StyledComponent.displayName = displayName;
      StyledComponent.styledComponentId = styledComponentId;
      StyledComponent.target = target;
  
  
      if (process.env.NODE_ENV !== 'production') {
        StyledComponent.warnTooManyClasses = createWarnTooManyClasses(displayName);
      }
  
      if (isClass) {
        hoistStatics(StyledComponent, target, {
          // all SC-specific things should not be hoisted
          attrs: true,
          componentStyle: true,
          displayName: true,
          extend: true,
          styledComponentId: true,
          target: true,
          warnTooManyClasses: true,
          withComponent: true
        });
      }
  
      return StyledComponent;
    };
  
    return createStyledComponent;
  });
  
  // Source: https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js
  function murmurhash(str) {
    var l = str.length | 0,
        h = l | 0,
        i = 0,
        k;
  
    while (l >= 4) {
      k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
  
      k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
      k ^= k >>> 24;
      k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
  
      h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
  
      l -= 4;
      ++i;
    }
  
    switch (l) {
      case 3:
        h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
      case 2:
        h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
      case 1:
        h ^= str.charCodeAt(i) & 0xff;
        h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
    }
  
    h ^= h >>> 13;
    h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
    h ^= h >>> 15;
  
    return h >>> 0;
  }
  
  // 
  
  var areStylesCacheable = IS_BROWSER;
  
  var isStaticRules = function isStaticRules(rules, attrs) {
    for (var i = 0, len = rules.length; i < len; i += 1) {
      var rule = rules[i];
  
      // recursive case
      if (Array.isArray(rule) && !isStaticRules(rule)) {
        return false;
      } else if (typeof rule === 'function' && !isStyledComponent(rule)) {
        // functions are allowed to be static if they're just being
        // used to get the classname of a nested styled component
        return false;
      }
    }
  
    if (attrs !== undefined) {
      // eslint-disable-next-line guard-for-in, no-restricted-syntax
      for (var key in attrs) {
        if (typeof attrs[key] === 'function') {
          return false;
        }
      }
    }
  
    return true;
  };
  
  var isHMREnabled = typeof module !== 'undefined' && module.hot && process.env.NODE_ENV !== 'production';
  
  /*
   ComponentStyle is all the CSS-specific stuff, not
   the React-specific stuff.
   */
  var _ComponentStyle = (function (nameGenerator, flatten, stringifyRules) {
    /* combines hashStr (murmurhash) and nameGenerator for convenience */
    var generateRuleHash = function generateRuleHash(str) {
      return nameGenerator(murmurhash(str));
    };
  
    var ComponentStyle = function () {
      function ComponentStyle(rules, attrs, componentId) {
        classCallCheck(this, ComponentStyle);
  
        this.rules = rules;
        this.isStatic = !isHMREnabled && isStaticRules(rules, attrs);
        this.componentId = componentId;
  
        if (!StyleSheet.master.hasId(componentId)) {
          var placeholder = process.env.NODE_ENV !== 'production' ? ['.' + componentId + ' {}'] : [];
  
          StyleSheet.master.deferredInject(componentId, placeholder);
        }
      }
  
      /*
       * Flattens a rule set into valid CSS
       * Hashes it, wraps the whole chunk in a .hash1234 {}
       * Returns the hash to be injected on render()
       * */
  
  
      ComponentStyle.prototype.generateAndInjectStyles = function generateAndInjectStyles(executionContext, styleSheet) {
        var isStatic = this.isStatic,
            componentId = this.componentId,
            lastClassName = this.lastClassName;
  
        if (areStylesCacheable && isStatic && lastClassName !== undefined && styleSheet.hasNameForId(componentId, lastClassName)) {
          return lastClassName;
        }
  
        var flatCSS = flatten(this.rules, executionContext);
        var name = generateRuleHash(this.componentId + flatCSS.join(''));
  
        if (!styleSheet.hasNameForId(componentId, name)) {
          styleSheet.inject(this.componentId, stringifyRules(flatCSS, '.' + name), name);
        }
  
        this.lastClassName = name;
        return name;
      };
  
      ComponentStyle.generateName = function generateName(str) {
        return generateRuleHash(str);
      };
  
      return ComponentStyle;
    }();
  
    return ComponentStyle;
  });
  
  // 
  // Thanks to ReactDOMFactories for this handy list!
  
  var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr',
  
  // SVG
  'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
  
  // 
  
  var _styled = (function (styledComponent, constructWithOptions) {
    var styled = function styled(tag) {
      return constructWithOptions(styledComponent, tag);
    };
  
    // Shorthands for all valid HTML Elements
    domElements.forEach(function (domElement) {
      styled[domElement] = styled(domElement);
    });
  
    return styled;
  });
  
  // 
  
  var replaceWhitespace = function replaceWhitespace(str) {
    return str.replace(/\s|\\n/g, '');
  };
  
  var _keyframes = (function (nameGenerator, stringifyRules, css) {
    return function () {
      var styleSheet = StyleSheet.master;
      var rules = css.apply(undefined, arguments);
      var name = nameGenerator(murmurhash(replaceWhitespace(JSON.stringify(rules))));
      var id = 'sc-keyframes-' + name;
  
      if (!styleSheet.hasNameForId(id, name)) {
        styleSheet.inject(id, stringifyRules(rules, name, '@keyframes'), name);
      }
  
      return name;
    };
  });
  
  // 
  
  var _injectGlobal = (function (stringifyRules, css) {
    var injectGlobal = function injectGlobal() {
      var styleSheet = StyleSheet.master;
      var rules = css.apply(undefined, arguments);
      var hash = murmurhash(JSON.stringify(rules));
      var id = 'sc-global-' + hash;
  
      if (!styleSheet.hasId(id)) {
        styleSheet.inject(id, stringifyRules(rules));
      }
    };
  
    return injectGlobal;
  });
  
  // 
  
  var _constructWithOptions = (function (css) {
    var constructWithOptions = function constructWithOptions(componentConstructor, tag) {
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EMPTY_OBJECT;
  
      if (!isValidElementType(tag)) {
        throw new StyledComponentsError(1, String(tag));
      }
  
      /* This is callable directly as a template function */
      // $FlowFixMe: Not typed to avoid destructuring arguments
      var templateFunction = function templateFunction() {
        return componentConstructor(tag, options, css.apply(undefined, arguments));
      };
  
      /* If config methods are called, wrap up a new template function and merge options */
      templateFunction.withConfig = function (config) {
        return constructWithOptions(componentConstructor, tag, _extends({}, options, config));
      };
      templateFunction.attrs = function (attrs) {
        return constructWithOptions(componentConstructor, tag, _extends({}, options, {
          attrs: _extends({}, options.attrs || EMPTY_OBJECT, attrs)
        }));
      };
  
      return templateFunction;
    };
  
    return constructWithOptions;
  });
  
  // 
  
  var withTheme = (function (Component$$1) {
    var isStatelessFunctionalComponent = typeof Component$$1 === 'function' &&
    // $FlowFixMe TODO: flow for prototype
    !(Component$$1.prototype && 'isReactComponent' in Component$$1.prototype);
  
    // NOTE: We can't pass a ref to a stateless functional component
    var shouldSetInnerRef = isStyledComponent(Component$$1) || isStatelessFunctionalComponent;
  
    var WithTheme = function (_React$Component) {
      inherits(WithTheme, _React$Component);
  
      function WithTheme() {
        var _temp, _this, _ret;
  
        classCallCheck(this, WithTheme);
  
        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }
  
        return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = EMPTY_OBJECT, _this.unsubscribeId = -1, _temp), possibleConstructorReturn(_this, _ret);
      }
  
      // NOTE: This is so that isStyledComponent passes for the innerRef unwrapping
  
  
      WithTheme.prototype.componentWillMount = function componentWillMount() {
        var _this2 = this;
  
        var defaultProps = this.constructor.defaultProps;
  
        var styledContext = this.context[CHANNEL_NEXT];
        var themeProp = determineTheme(this.props, undefined, defaultProps);
        if (styledContext === undefined && themeProp === undefined && process.env.NODE_ENV !== 'production') {
          // eslint-disable-next-line no-console
          console.warn('[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps');
        } else if (styledContext === undefined && themeProp !== undefined) {
          this.setState({ theme: themeProp });
        } else {
          var subscribe = styledContext.subscribe;
  
          this.unsubscribeId = subscribe(function (nextTheme) {
            var theme = determineTheme(_this2.props, nextTheme, defaultProps);
            _this2.setState({ theme: theme });
          });
        }
      };
  
      WithTheme.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
        var defaultProps = this.constructor.defaultProps;
  
        this.setState(function (oldState) {
          var theme = determineTheme(nextProps, oldState.theme, defaultProps);
  
          return { theme: theme };
        });
      };
  
      WithTheme.prototype.componentWillUnmount = function componentWillUnmount() {
        if (this.unsubscribeId !== -1) {
          this.context[CHANNEL_NEXT].unsubscribe(this.unsubscribeId);
        }
      };
  
      WithTheme.prototype.render = function render() {
        var props = _extends({
          theme: this.state.theme
        }, this.props);
  
        if (!shouldSetInnerRef) {
          props.ref = props.innerRef;
          delete props.innerRef;
        }
  
        return React.createElement(Component$$1, props);
      };
  
      return WithTheme;
    }(React.Component);
  
    WithTheme.contextTypes = contextShape;
    WithTheme.displayName = 'WithTheme(' + getComponentName(Component$$1) + ')';
    WithTheme.styledComponentId = 'withTheme';
  
  
    return hoistStatics(WithTheme, Component$$1);
  });
  
  // 
  
  /* eslint-disable */
  var __DO_NOT_USE_OR_YOU_WILL_BE_HAUNTED_BY_SPOOKY_GHOSTS = {
    StyleSheet: StyleSheet
  };
  
  // 
  
  /* Warning if you've imported this file on React Native */
  if (process.env.NODE_ENV !== 'production' && typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
    // eslint-disable-next-line no-console
    console.warn("It looks like you've imported 'styled-components' on React Native.\n" + "Perhaps you're looking to import 'styled-components/native'?\n" + 'Read more about this at https://www.styled-components.com/docs/basics#react-native');
  }
  
  /* Warning if there are several instances of styled-components */
  if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test' && typeof window !== 'undefined' && typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Node.js') === -1 && navigator.userAgent.indexOf('jsdom') === -1) {
    window['__styled-components-init__'] = window['__styled-components-init__'] || 0;
  
    if (window['__styled-components-init__'] === 1) {
      // eslint-disable-next-line no-console
      console.warn("It looks like there are several instances of 'styled-components' initialized in this application. " + 'This may cause dynamic styles not rendering properly, errors happening during rehydration process ' + 'and makes your application bigger without a good reason.\n\n' + 'See https://s-c.sh/2BAXzed for more info.');
    }
  
    window['__styled-components-init__'] += 1;
  }
  
  /* Instantiate singletons */
  var ComponentStyle = _ComponentStyle(generateAlphabeticName, flatten, stringifyRules);
  var constructWithOptions = _constructWithOptions(css);
  var StyledComponent = _StyledComponent(ComponentStyle, constructWithOptions);
  
  /* Instantiate exported singletons */
  var keyframes = _keyframes(generateAlphabeticName, stringifyRules, css);
  var injectGlobal = _injectGlobal(stringifyRules, css);
  var styled = _styled(StyledComponent, constructWithOptions);
  
  export default styled;
  export { css, keyframes, injectGlobal, isStyledComponent, consolidateStreamedStyles, ThemeProvider, withTheme, ServerStyleSheet, StyleSheetManager, __DO_NOT_USE_OR_YOU_WILL_BE_HAUNTED_BY_SPOOKY_GHOSTS };
  //# sourceMappingURL=styled-components-no-parser.browser.esm.js.map
  