"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _defineProperty2=require("babel-runtime/helpers/defineProperty"),_defineProperty3=_interopRequireDefault(_defineProperty2),_extends3=require("babel-runtime/helpers/extends"),_extends4=_interopRequireDefault(_extends3),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_react=require("react"),React=_interopRequireWildcard(_react),_Slider=require("rc-slider/lib/Slider"),_Slider2=_interopRequireDefault(_Slider),_Range=require("rc-slider/lib/Range"),_Range2=_interopRequireDefault(_Range),_Handle=require("rc-slider/lib/Handle"),_Handle2=_interopRequireDefault(_Handle),_tooltip=require("../tooltip"),_tooltip2=_interopRequireDefault(_tooltip);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var __rest=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&(r[i[l]]=e[i[l]])}return r},Slider=function(e){function t(e){(0,_classCallCheck3.default)(this,t);var d=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return d.toggleTooltipVisible=function(r,i){d.setState(function(e){var t=e.visibles;return{visibles:(0,_extends4.default)({},t,(0,_defineProperty3.default)({},r,i))}})},d.handleWithTooltip=function(e){var t=e.value,r=e.dragging,i=e.index,l=__rest(e,["value","dragging","index"]),n=d.props,o=n.tooltipPrefixCls,a=n.tipFormatter,u=d.state.visibles,s=!!a&&(u[i]||r);return React.createElement(_tooltip2.default,{prefixCls:o,title:a?a(t):"",visible:s,placement:"top",transitionName:"zoom-down",key:i},React.createElement(_Handle2.default,(0,_extends4.default)({},l,{value:t,onMouseEnter:function(){return d.toggleTooltipVisible(i,!0)},onMouseLeave:function(){return d.toggleTooltipVisible(i,!1)}})))},d.saveSlider=function(e){d.rcSlider=e},d.state={visibles:{}},d}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"focus",value:function(){this.rcSlider.focus()}},{key:"blur",value:function(){this.rcSlider.focus()}},{key:"render",value:function(){var e=this.props,t=e.range,r=__rest(e,["range"]);return t?React.createElement(_Range2.default,(0,_extends4.default)({},r,{ref:this.saveSlider,handle:this.handleWithTooltip})):React.createElement(_Slider2.default,(0,_extends4.default)({},r,{ref:this.saveSlider,handle:this.handleWithTooltip}))}}]),t}(React.Component);(exports.default=Slider).defaultProps={prefixCls:"dt-slider",tooltipPrefixCls:"dt-tooltip",tipFormatter:function(e){return e.toString()}},module.exports=exports.default;