"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _range = _interopRequireDefault(require("@alifd/next/lib/range"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var React = _interopRequireWildcard(require("react"));
require("./index.less");
var _excluded = ["type", "prefix", "className", "style", "slider", "min", "max", "step", "value", "defaultValue", "marks", "marksPosition", "disabled", "hasTip", "reverse", "pure", "fixedWidth", "ifFixedWidth", "tooltipVisible", "disperse", "disperseValue", "rtl"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var mySlider = function mySlider(_ref) {
  var type = _ref.type,
    prefix = _ref.prefix,
    className = _ref.className,
    style = _ref.style,
    slider = _ref.slider,
    min = _ref.min,
    max = _ref.max,
    step = _ref.step,
    value = _ref.value,
    defaultValue = _ref.defaultValue,
    marks = _ref.marks,
    marksPosition = _ref.marksPosition,
    disabled = _ref.disabled,
    hasTip = _ref.hasTip,
    reverse = _ref.reverse,
    pure = _ref.pure,
    fixedWidth = _ref.fixedWidth,
    ifFixedWidth = _ref.ifFixedWidth,
    tooltipVisible = _ref.tooltipVisible,
    disperse = _ref.disperse,
    disperseValue = _ref.disperseValue,
    rtl = _ref.rtl,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  var dan = function dan() {
    return disperse === '无' ? /*#__PURE__*/React.createElement(_range["default"], (0, _extends2["default"])({
      value: value,
      disabled: disabled,
      style: style
    }, otherProps)) : /*#__PURE__*/React.createElement(_range["default"], (0, _extends2["default"])({
      value: value,
      disabled: disabled,
      marks: disperseValue,
      style: style
    }, otherProps));
  };
  var shuang = function shuang() {
    return disperse === '无' ? ifFixedWidth ? /*#__PURE__*/React.createElement(_range["default"], (0, _extends2["default"])({
      fixedWidth: true,
      value: [value, defaultValue],
      defaultValue: [value, defaultValue],
      style: style
    }, otherProps)) : /*#__PURE__*/React.createElement(_range["default"], (0, _extends2["default"])({
      slider: "double",
      value: [value, defaultValue],
      defaultValue: [value, defaultValue],
      style: style
    }, otherProps)) : ifFixedWidth ? /*#__PURE__*/React.createElement(_range["default"], (0, _extends2["default"])({
      fixedWidth: true,
      value: [value, defaultValue],
      defaultValue: [value, defaultValue],
      disabled: disabled,
      marks: disperseValue,
      style: style
    }, otherProps)) : /*#__PURE__*/React.createElement(_range["default"], (0, _extends2["default"])({
      slider: "double",
      value: [value, defaultValue],
      defaultValue: [value, defaultValue],
      disabled: disabled,
      marks: disperseValue,
      style: style
    }, otherProps));
  };
  return function () {
    switch (type) {
      case "单滑块":
        return dan();
        break;
      case "双滑块":
        return shuang();
        break;
      default:
        return null;
    }
  }();
  // return (
  //   type === '单滑块' ? (disperse === '无' ? <Range value={value} disabled={disabled} style={style} {...otherProps} /> : <Range value={value} disabled={disabled} marks={disperseValue} style={style} {...otherProps} />) :
  //     (disperse === '无' ? <Range fixedWidth value={[value, defaultValue]} defaultValue={[value, defaultValue]} style={style} {...otherProps} /> : <Range fixedWidth value={[value, defaultValue]} defaultValue={[value, defaultValue]} disabled={disabled} marks={disperseValue} style={style} {...otherProps} />)
  // )
};

mySlider.displayName = 'mySlider';
var _default = mySlider;
exports["default"] = _default;