'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var ReactPDF = _interopDefault(require('@react-pdf/renderer'));
var transformDeclPairs = _interopDefault(require('css-to-react-native'));
var isPlainObject = _interopDefault(require('is-plain-object'));
var supportsColor = _interopDefault(require('supports-color'));
var hoist = _interopDefault(require('hoist-non-react-statics'));
var PropTypes = _interopDefault(require('prop-types'));
var React = require('react');
var React__default = _interopDefault(React);
var reactIs = require('react-is');

// 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;
}

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @typechecks
 */

var _uppercasePattern = /([A-Z])/g;

/**
 * Hyphenates a camelcased string, for example:
 *
 *   > hyphenate('backgroundColor')
 *   < "background-color"
 *
 * For CSS style names, use `hyphenateStyleName` instead which works properly
 * with all vendor prefixes, including `ms`.
 *
 * @param {string} string
 * @return {string}
 */
function hyphenate$2(string) {
  return string.replace(_uppercasePattern, '-$1').toLowerCase();
}

var hyphenate_1 = hyphenate$2;

var hyphenate = hyphenate_1;

var msPattern = /^ms-/;

/**
 * Hyphenates a camelcased CSS property name, for example:
 *
 *   > hyphenateStyleName('backgroundColor')
 *   < "background-color"
 *   > hyphenateStyleName('MozTransition')
 *   < "-moz-transition"
 *   > hyphenateStyleName('msTransition')
 *   < "-ms-transition"
 *
 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
 * is converted to `-ms-`.
 *
 * @param {string} string
 * @return {string}
 */
function hyphenateStyleName(string) {
  return hyphenate(string).replace(msPattern, '-ms-');
}

var hyphenateStyleName_1 = hyphenateStyleName;

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 defineProperty = function (obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }

  return obj;
};

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 get = function get(object, property, receiver) {
  if (object === null) object = Function.prototype;
  var desc = Object.getOwnPropertyDescriptor(object, property);

  if (desc === undefined) {
    var parent = Object.getPrototypeOf(object);

    if (parent === null) {
      return undefined;
    } else {
      return get(parent, property, receiver);
    }
  } else if ("value" in desc) {
    return desc.value;
  } else {
    var getter = desc.get;

    if (getter === undefined) {
      return undefined;
    }

    return getter.call(receiver);
  }
};

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 toConsumableArray = function (arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];

    return arr2;
  } else {
    return Array.from(arr);
  }
};

//
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 hyphenateStyleName_1(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)) {
      return [].concat(toConsumableArray(ruleSet), toConsumableArray(flatten(chunk, executionContext)));
    }

    /* Handle other components */
    if (chunk.hasOwnProperty('styledComponentId')) {
      // $FlowFixMe not sure how to make this pass
      return [].concat(toConsumableArray(ruleSet), ['.' + chunk.styledComponentId]);
    }

    /* Either execute or defer the function */
    if (typeof chunk === 'function') {
      return executionContext ? ruleSet.concat.apply(ruleSet, toConsumableArray(flatten([chunk(executionContext)], executionContext))) : ruleSet.concat(chunk);
    }

    /* Handle objects */
    return ruleSet.concat(
    // $FlowFixMe have to add %checks somehow to isPlainObject
    isPlainObject(chunk) ? objToCss(chunk) : chunk.toString());
  }, []);
};

var printed = {};

function warnOnce(message) {
    if (printed[message]) return;
    printed[message] = true;

    if (typeof console !== 'undefined' && console.warn) console.warn(message);
}

var SINGLE_QUOTE = '\''.charCodeAt(0);
var DOUBLE_QUOTE = '"'.charCodeAt(0);
var BACKSLASH = '\\'.charCodeAt(0);
var SLASH = '/'.charCodeAt(0);
var NEWLINE = '\n'.charCodeAt(0);
var SPACE = ' '.charCodeAt(0);
var FEED = '\f'.charCodeAt(0);
var TAB = '\t'.charCodeAt(0);
var CR = '\r'.charCodeAt(0);
var OPEN_SQUARE = '['.charCodeAt(0);
var CLOSE_SQUARE = ']'.charCodeAt(0);
var OPEN_PARENTHESES = '('.charCodeAt(0);
var CLOSE_PARENTHESES = ')'.charCodeAt(0);
var OPEN_CURLY = '{'.charCodeAt(0);
var CLOSE_CURLY = '}'.charCodeAt(0);
var SEMICOLON = ';'.charCodeAt(0);
var ASTERISK = '*'.charCodeAt(0);
var COLON = ':'.charCodeAt(0);
var AT = '@'.charCodeAt(0);

var RE_AT_END = /[ \n\t\r\f\{\(\)'"\\;/\[\]#]/g;
var RE_WORD_END = /[ \n\t\r\f\(\)\{\}:;@!'"\\\]\[#]|\/(?=\*)/g;
var RE_BAD_BRACKET = /.[\\\/\("'\n]/;

function tokenize(input) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    var tokens = [];
    var css = input.css.valueOf();

    var ignore = options.ignoreErrors;

    var code = void 0,
        next = void 0,
        quote = void 0,
        lines = void 0,
        last = void 0,
        content = void 0,
        escape = void 0,
        nextLine = void 0,
        nextOffset = void 0,
        escaped = void 0,
        escapePos = void 0,
        prev = void 0,
        n = void 0;

    var length = css.length;
    var offset = -1;
    var line = 1;
    var pos = 0;

    function unclosed(what) {
        throw input.error('Unclosed ' + what, line, pos - offset);
    }

    while (pos < length) {
        code = css.charCodeAt(pos);

        if (code === NEWLINE || code === FEED || code === CR && css.charCodeAt(pos + 1) !== NEWLINE) {
            offset = pos;
            line += 1;
        }

        switch (code) {
            case NEWLINE:
            case SPACE:
            case TAB:
            case CR:
            case FEED:
                next = pos;
                do {
                    next += 1;
                    code = css.charCodeAt(next);
                    if (code === NEWLINE) {
                        offset = next;
                        line += 1;
                    }
                } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);

                tokens.push(['space', css.slice(pos, next)]);
                pos = next - 1;
                break;

            case OPEN_SQUARE:
                tokens.push(['[', '[', line, pos - offset]);
                break;

            case CLOSE_SQUARE:
                tokens.push([']', ']', line, pos - offset]);
                break;

            case OPEN_CURLY:
                tokens.push(['{', '{', line, pos - offset]);
                break;

            case CLOSE_CURLY:
                tokens.push(['}', '}', line, pos - offset]);
                break;

            case COLON:
                tokens.push([':', ':', line, pos - offset]);
                break;

            case SEMICOLON:
                tokens.push([';', ';', line, pos - offset]);
                break;

            case OPEN_PARENTHESES:
                prev = tokens.length ? tokens[tokens.length - 1][1] : '';
                n = css.charCodeAt(pos + 1);
                if (prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {
                    next = pos;
                    do {
                        escaped = false;
                        next = css.indexOf(')', next + 1);
                        if (next === -1) {
                            if (ignore) {
                                next = pos;
                                break;
                            } else {
                                unclosed('bracket');
                            }
                        }
                        escapePos = next;
                        while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
                            escapePos -= 1;
                            escaped = !escaped;
                        }
                    } while (escaped);

                    tokens.push(['brackets', css.slice(pos, next + 1), line, pos - offset, line, next - offset]);
                    pos = next;
                } else {
                    next = css.indexOf(')', pos + 1);
                    content = css.slice(pos, next + 1);

                    if (next === -1 || RE_BAD_BRACKET.test(content)) {
                        tokens.push(['(', '(', line, pos - offset]);
                    } else {
                        tokens.push(['brackets', content, line, pos - offset, line, next - offset]);
                        pos = next;
                    }
                }

                break;

            case CLOSE_PARENTHESES:
                tokens.push([')', ')', line, pos - offset]);
                break;

            case SINGLE_QUOTE:
            case DOUBLE_QUOTE:
                quote = code === SINGLE_QUOTE ? '\'' : '"';
                next = pos;
                do {
                    escaped = false;
                    next = css.indexOf(quote, next + 1);
                    if (next === -1) {
                        if (ignore) {
                            next = pos + 1;
                            break;
                        } else {
                            unclosed('quote');
                        }
                    }
                    escapePos = next;
                    while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
                        escapePos -= 1;
                        escaped = !escaped;
                    }
                } while (escaped);

                content = css.slice(pos, next + 1);
                lines = content.split('\n');
                last = lines.length - 1;

                if (last > 0) {
                    nextLine = line + last;
                    nextOffset = next - lines[last].length;
                } else {
                    nextLine = line;
                    nextOffset = offset;
                }

                tokens.push(['string', css.slice(pos, next + 1), line, pos - offset, nextLine, next - nextOffset]);

                offset = nextOffset;
                line = nextLine;
                pos = next;
                break;

            case AT:
                RE_AT_END.lastIndex = pos + 1;
                RE_AT_END.test(css);
                if (RE_AT_END.lastIndex === 0) {
                    next = css.length - 1;
                } else {
                    next = RE_AT_END.lastIndex - 2;
                }
            <response clipped><NOTE>Due to the max output limit, only part of the full response has been shown to you.</NOTE>d
      }, _this.unsubscribeId = -1, _this.onRef = function (node) {
        // eslint-disable-next-line react/prop-types
        var innerRef = _this.props.innerRef;

        _this.root = node;

        if (typeof innerRef === 'function') {
          innerRef(node);
        } else if ((typeof innerRef === 'undefined' ? 'undefined' : _typeof(innerRef)) === 'object' && innerRef && innerRef.hasOwnProperty('current')) {
          innerRef.current = node;
        }
      }, _temp), possibleConstructorReturn(_this, _ret);
    }

    createClass(BaseStyledNativeComponent, [{
      key: 'unsubscribeFromContext',
      value: function unsubscribeFromContext() {
        if (this.unsubscribeId !== -1) {
          this.context[CHANNEL_NEXT].unsubscribe(this.unsubscribeId);
        }
      }
    }, {
      key: 'buildExecutionContext',
      value: 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, React.Component) ? attr(context) : attr;
          return acc;
        }, {});

        return _extends({}, context, this.attrs);
      }
    }, {
      key: 'generateAndInjectStyles',
      value: function generateAndInjectStyles(theme, props) {
        var inlineStyle = this.constructor.inlineStyle;

        var executionContext = this.buildExecutionContext(theme, props);

        return inlineStyle.generateStyleObject(executionContext);
      }
    }, {
      key: 'componentWillMount',
      value: function componentWillMount() {
        var _this2 = this;

        // 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
        var styledContext = this.context[CHANNEL_NEXT];
        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 generatedStyles = _this2.generateAndInjectStyles(theme, _this2.props);

            _this2.setState({ theme: theme, generatedStyles: generatedStyles });
          });
        } else {
          // eslint-disable-next-line react/prop-types
          var theme = this.props.theme || {};
          var generatedStyles = this.generateAndInjectStyles(theme, this.props);
          this.setState({ theme: theme, generatedStyles: generatedStyles });
        }
      }
    }, {
      key: 'componentWillReceiveProps',
      value: function componentWillReceiveProps(nextProps) {
        var _this3 = this;

        this.setState(function (prevState) {
          var theme = determineTheme(nextProps, prevState.theme, _this3.constructor.defaultProps);
          var generatedStyles = _this3.generateAndInjectStyles(theme, nextProps);

          return { theme: theme, generatedStyles: generatedStyles };
        });
      }
    }, {
      key: 'componentWillUnmount',
      value: function componentWillUnmount() {
        this.unsubscribeFromContext();
      }
    }, {
      key: 'setNativeProps',
      value: function setNativeProps(nativeProps) {
        if (this.root !== undefined) {
          // $FlowFixMe
          this.root.setNativeProps(nativeProps);
        } else if (process.env.NODE_ENV !== 'production') {
          var displayName = this.constructor.displayName;

          // eslint-disable-next-line no-console

          console.warn('setNativeProps was called on a Styled Component wrapping a stateless functional component. ' + 'In this case no ref will be stored, and instead an innerRef prop will be passed on.\n' + ('Check whether the stateless functional component is passing on innerRef as a ref in ' + (displayName || 'UnknownStyledNativeComponent') + '.'));
        }
      }
    }, {
      key: 'render',
      value: function render() {
        // eslint-disable-next-line react/prop-types
        var _props = this.props,
            children = _props.children,
            style = _props.style;
        var generatedStyles = this.state.generatedStyles;
        var target = this.constructor.target;


        var propsForElement = _extends({}, this.attrs, this.props, {
          style: [generatedStyles, style]
        });

        if (!isStyledComponent(target) && (
        // NOTE: We can't pass a ref to a stateless functional component
        typeof target !== 'function' ||
        // $FlowFixMe TODO: flow for prototype
        target.prototype && 'isReactComponent' in target.prototype)) {
          propsForElement.ref = this.onRef;
          delete propsForElement.innerRef;
        } else {
          propsForElement.innerRef = this.onRef;
        }

        return React.createElement(target, propsForElement, children);
      }
    }]);
    return BaseStyledNativeComponent;
  }(React.Component);

  var createStyledNativeComponent = function createStyledNativeComponent(target, options, rules) {
    var _StyledNativeComponen;

    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$ParentCompon = options.ParentComponent,
        ParentComponent = _options$ParentCompon === undefined ? BaseStyledNativeComponent : _options$ParentCompon,
        extendingRules = options.rules,
        attrs = options.attrs;


    var inlineStyle = new InlineStyle(extendingRules === undefined ? rules : extendingRules.concat(rules));

    var StyledNativeComponent = function (_ParentComponent) {
      inherits(StyledNativeComponent, _ParentComponent);

      function StyledNativeComponent() {
        classCallCheck(this, StyledNativeComponent);
        return possibleConstructorReturn(this, (StyledNativeComponent.__proto__ || Object.getPrototypeOf(StyledNativeComponent)).apply(this, arguments));
      }

      createClass(StyledNativeComponent, null, [{
        key: 'withComponent',
        value: function withComponent(tag) {
          var _ = options.displayName,
              __ = options.componentId,
              optionsToCopy = objectWithoutProperties(options, ['displayName', 'componentId']);

          var newOptions = _extends({}, optionsToCopy, {
            ParentComponent: StyledNativeComponent
          });
          return createStyledNativeComponent(tag, newOptions, rules);
        }
      }, {
        key: 'extend',
        get: function get$$1() {
          var _ = options.displayName,
              __ = options.componentId,
              rulesFromOptions = options.rules,
              optionsToCopy = objectWithoutProperties(options, ['displayName', 'componentId', 'rules']);


          var newRules = rulesFromOptions === undefined ? rules : rulesFromOptions.concat(rules);

          var newOptions = _extends({}, optionsToCopy, {
            rules: newRules,
            ParentComponent: StyledNativeComponent
          });

          return constructWithOptions(createStyledNativeComponent, target, newOptions);
        }
      }]);
      return StyledNativeComponent;
    }(ParentComponent);

    StyledNativeComponent.attrs = attrs;
    StyledNativeComponent.displayName = displayName;
    StyledNativeComponent.inlineStyle = inlineStyle;
    StyledNativeComponent.styledComponentId = 'StyledNativeComponent';
    StyledNativeComponent.target = target;
    StyledNativeComponent.contextTypes = (_StyledNativeComponen = {}, defineProperty(_StyledNativeComponen, CHANNEL, PropTypes.func), defineProperty(_StyledNativeComponen, CHANNEL_NEXT, CONTEXT_CHANNEL_SHAPE), _StyledNativeComponen);


    if (isClass) {
      hoist(StyledNativeComponent, target, {
        // all SC-specific things should not be hoisted
        attrs: true,
        displayName: true,
        extend: true,
        inlineStyle: true,
        styledComponentId: true,
        target: true,
        withComponent: true
      });
    }

    return StyledNativeComponent;
  };

  return createStyledNativeComponent;
});

//
var _constructWithOptions = (function (css) {
  var constructWithOptions = function constructWithOptions(componentConstructor, tag) {
    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

    if (!reactIs.isValidElementType(tag)) {
      throw new Error(process.env.NODE_ENV !== 'production' ? 'Cannot create styled-component for component: ' + 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 || {}, attrs)
      }));
    };

    return templateFunction;
  };

  return constructWithOptions;
});

//

var interleave = (function (strings, interpolations) {
  return interpolations.reduce(function (array, interp, i) {
    return array.concat(interp, strings[i + 1]);
  }, [strings[0]]);
});

//
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 (!Array.isArray(styles) && (typeof styles === 'undefined' ? 'undefined' : _typeof(styles)) === 'object') {
    return flatten(interleave([], [styles].concat(interpolations)));
  }
  return flatten(interleave(styles, interpolations));
});

//
var wrapWithTheme = function wrapWithTheme(Component$$1) {
  var _WithTheme$contextTyp;

  var componentName = Component$$1.displayName || Component$$1.name || 'Component';
  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 _ref;

      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, (_ref = WithTheme.__proto__ || Object.getPrototypeOf(WithTheme)).call.apply(_ref, [this].concat(args))), _this), _this.state = {}, _this.unsubscribeId = -1, _temp), possibleConstructorReturn(_this, _ret);
    }

    // NOTE: This is so that isStyledComponent passes for the innerRef unwrapping


    createClass(WithTheme, [{
      key: 'componentWillMount',
      value: 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 });
          });
        }
      }
    }, {
      key: 'componentWillReceiveProps',
      value: function componentWillReceiveProps(nextProps) {
        var defaultProps = this.constructor.defaultProps;

        this.setState(function (oldState) {
          var theme = determineTheme(nextProps, oldState.theme, defaultProps);

          return { theme: theme };
        });
      }
    }, {
      key: 'componentWillUnmount',
      value: function componentWillUnmount() {
        if (this.unsubscribeId !== -1) {
          this.context[CHANNEL_NEXT].unsubscribe(this.unsubscribeId);
        }
      }
    }, {
      key: 'render',
      value: function render() {
        var props = _extends({
          theme: this.state.theme
        }, this.props);

        if (!shouldSetInnerRef) {
          props.ref = props.innerRef;
          delete props.innerRef;
        }

        return React__default.createElement(Component$$1, props);
      }
    }]);
    return WithTheme;
  }(React__default.Component);

  WithTheme.displayName = 'WithTheme(' + componentName + ')';
  WithTheme.styledComponentId = 'withTheme';
  WithTheme.contextTypes = (_WithTheme$contextTyp = {}, defineProperty(_WithTheme$contextTyp, CHANNEL, PropTypes.func), defineProperty(_WithTheme$contextTyp, CHANNEL_NEXT, CONTEXT_CHANNEL_SHAPE), _WithTheme$contextTyp);


  return hoist(WithTheme, Component$$1);
};

var constructWithOptions = _constructWithOptions(css);
var InlineStyle = _InlineStyle(ReactPDF.StyleSheet);
var StyledNativeComponent = _StyledNativeComponent(constructWithOptions, InlineStyle);
var styled = function styled(tag) {
  return constructWithOptions(StyledNativeComponent, tag);
};

var aliases = 'Image Text View Link Page Document';

// Define a getter for each alias which simply gets the ReactPDF component and passes it to styled
aliases.split(/\s+/m).forEach(function (alias) {
  return Object.defineProperty(styled, alias, {
    enumerable: true,
    configurable: false,
    get: function get() {
      return styled(ReactPDF[alias]);
    }
  });
});

exports.css = css;
exports.isStyledComponent = isStyledComponent;
exports.ThemeProvider = ThemeProvider;
exports.withTheme = wrapWithTheme;
exports['default'] = styled;
//# sourceMappingURL=index.js.map
[The command completed with exit code 0.]
[Current working directory: /workspace/react-pdf]
[Python interpreter: /usr/bin/python]
[Command finished with exit code 0]