text: 'use strict';
  
  exports.__esModule = true;
  
  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; }; /*
                                                                                                                                                                                                                                                                     * This file is part of the nivo project.
                                                                                                                                                                                                                                                                     *
                                                                                                                                                                                                                                                                     * Copyright 2016-present, Raphaël Benitte.
                                                                                                                                                                                                                                                                     *
                                                                                                                                                                                                                                                                     * For the full copyright and license information, please view the LICENSE
                                                                                                                                                                                                                                                                     * file that was distributed with this source code.
                                                                                                                                                                                                                                                                     */
  
  
  var _react = require('react');
  
  var _react2 = _interopRequireDefault(_react);
  
  var _reactMotion = require('react-motion');
  
  var _pick = require('lodash/pick');
  
  var _pick2 = _interopRequireDefault(_pick);
  
  var _colors = require('../../../lib/colors');
  
  var _Container = require('../Container');
  
  var _Container2 = _interopRequireDefault(_Container);
  
  var _enhance = require('./enhance');
  
  var _enhance2 = _interopRequireDefault(_enhance);
  
  var _motion = require('./motion');
  
  var _interactivity = require('./interactivity');
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  var BubbleHtml = function BubbleHtml(_ref) {
      var nodes = _ref.nodes,
          nodeComponent = _ref.nodeComponent,
          margin = _ref.margin,
          outerWidth = _ref.outerWidth,
          outerHeight = _ref.outerHeight,
          theme = _ref.theme,
          borderWidth = _ref.borderWidth,
          getBorderColor = _ref.getBorderColor,
          getLabelTextColor = _ref.getLabelTextColor,
          animate = _ref.animate,
          motionStiffness = _ref.motionStiffness,
          motionDamping = _ref.motionDamping,
          isInteractive = _ref.isInteractive,
          onClick = _ref.onClick,
          isZoomable = _ref.isZoomable,
          zoomToNode = _ref.zoomToNode;
  
      var springConfig = {
          stiffness: motionStiffness,
          damping: motionDamping
      };
  
      var getHandlers = function getHandlers(node, showTooltip, hideTooltip) {
          return (0, _interactivity.getNodeHandlers)(node, {
              isInteractive: isInteractive,
              onClick: onClick,
              showTooltip: showTooltip,
              hideTooltip: hideTooltip,
              isZoomable: isZoomable,
              zoomToNode: zoomToNode,
              theme: theme
          });
      };
  
      return _react2.default.createElement(
          _Container2.default,
          { isInteractive: isInteractive, theme: theme },
          function (_ref2) {
              var showTooltip = _ref2.showTooltip,
                  hideTooltip = _ref2.hideTooltip;
              return _react2.default.createElement(
                  'div',
                  {
                      style: {
                          position: 'relative',
                          width: outerWidth,
                          height: outerHeight
                      }
                  },
                  !animate && _react2.default.createElement(
                      'div',
                      { style: { position: 'absolute', top: margin.top, left: margin.left } },
                      nodes.map(function (node) {
                          return _react2.default.createElement(nodeComponent, {
                              key: node.path,
                              node: node,
                              style: _extends({}, (0, _pick2.default)(node, ['scale', 'r', 'x', 'y', 'color']), {
                                  borderWidth: borderWidth,
                                  borderColor: getBorderColor(node),
                                  labelTextColor: getLabelTextColor(node)
                              }),
                              handlers: getHandlers(node, showTooltip, hideTooltip)
                          });
                      })
                  ),
                  animate && _react2.default.createElement(
                      _reactMotion.TransitionMotion,
                      {
                          willEnter: _motion.nodeWillEnter,
                          willLeave: (0, _motion.nodeWillLeave)(springConfig),
                          styles: nodes.map(function (node) {
                              return {
                                  key: node.path,
                                  data: node,
                                  style: _extends({
                                      scale: (0, _reactMotion.spring)(1, springConfig),
                                      r: (0, _reactMotion.spring)(node.r, springConfig),
                                      x: (0, _reactMotion.spring)(node.x, springConfig),
                                      y: (0, _reactMotion.spring)(node.y, springConfig),
                                      opacity: (0, _reactMotion.spring)(1, springConfig)
                                  }, (0, _colors.colorMotionSpring)(node.color, springConfig))
                              };
                          })
                      },
                      function (interpolatedStyles) {
                          return _react2.default.createElement(
                              'div',
                              {
                                  style: {
                                      position: 'absolute',
                                      top: margin.top,
                                      left: margin.left
                                  }
                              },
                              interpolatedStyles.map(function (_ref3) {
                                  var style = _ref3.style,
                                      node = _ref3.data;
  
                                  style.color = (0, _colors.getInterpolatedColor)(style);
  
                                  return _react2.default.createElement(nodeComponent, {
                                      key: node.path,
                                      node: node,
                                      style: _extends({}, style, {
                                          borderWidth: borderWidth,
                                          borderColor: getBorderColor(style),
                                          labelTextColor: getLabelTextColor(style)
                                      }),
                                      handlers: getHandlers(node, showTooltip, hideTooltip)
                                  });
                              })
                          );
                      }
                  )
              );
          }
      );
  };
  
  BubbleHtml.displayName = 'BubbleHtml';
  
  exports.default = (0, _enhance2.default)(BubbleHtml);