text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.switchProp = exports.ifProp = exports.get = exports.prop = undefined;
  
  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 _get2 = require('lodash/get');
  
  var _get3 = _interopRequireDefault(_get2);
  
  var _at = require('lodash/at');
  
  var _at2 = _interopRequireDefault(_at);
  
  var _values = require('lodash/values');
  
  var _values2 = _interopRequireDefault(_values);
  
  var _difference = require('lodash/difference');
  
  var _difference2 = _interopRequireDefault(_difference);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  /**
   * Returns the value of `props[path]` or `defaultValue`
   * @example
   * const Button = styled.button`
   *  color: ${prop('color', 'red')};
   * `
   */
  var prop = exports.prop = function prop(path, defaultValue) {
    return function () {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      return (0, _get3.default)(props, path, defaultValue);
    };
  };
  
  var get = exports.get = prop;
  
  /**
   * Returns `pass` if prop is truthy. Otherwise returns `fail`
   * @example
   * // usage with styled-theme
   * import styled from 'styled-components'
   * import { ifProp } from 'styled-tools'
   * import { palette } from 'styled-theme'
   *
   * const Button = styled.button`
   *  background-color: ${ifProp('transparent', 'transparent', palette(0))};
   *  color: ${ifProp(['transparent', 'accent'], palette('secondary', 0))};
   *  font-size: ${ifProp({ size: 'large' }, '20px', ifProp({ size: 'medium' }, '16px', '12px'))};
   *`
   */
  var ifProp = exports.ifProp = function ifProp(needle, pass, fail) {
    return function () {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      var result = void 0;
      if (Array.isArray(needle)) {
        result = !(0, _at2.default)(props, needle).filter(function (value) {
          return !value;
        }).length;
      } else if ((typeof needle === 'undefined' ? 'undefined' : _typeof(needle)) === 'object') {
        var needleKeys = Object.keys(needle);
        var needleValues = (0, _values2.default)(needle);
        result = !(0, _difference2.default)((0, _at2.default)(props, needleKeys), needleValues).length;
      } else {
        result = (0, _get3.default)(props, needle);
      }
      return result ? pass : fail;
    };
  };
  
  /**
   * Switches on a given prop. Returns the value or function for a given prop value.
   * @example
   * import styled, { css } from 'styled-components'
   * import { switchProp } from 'styled-theme'
   *
   * const Button = styled.button`
   *  font-size: ${switchProp('size', {
   *    small: prop('theme.sizes.sm', '12px'),
   *    large: prop('theme.sizes.lg', '20px'),
   *    default: prop('theme.sizes.md', '16px'),
   *  })};
   *  ${switchProp('theme.kind', {
   *    light: css`
   *      color: LightBlue;
   *    `,
   *    dark: css`
   *      color: DarkBlue;
   *    `,
   *  })}
   * `
   *
   * <Button size="large" theme={{ kind: 'light' }} />
   */
  var switchProp = exports.switchProp = function switchProp(needle, switches) {
    return function () {
      var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      var propType = (0, _get3.default)(props, needle);
      return (0, _get3.default)(switches, propType);
    };
  };