function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
import React from "react";
import { Animated, Easing, StyleSheet, View } from "react-native";
import Indicator from "./indicator";
const floatEpsilon = Math.pow(2, -23);
const WaveIndicator = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(({
  size = 30,
  count = 4,
  color = "rgb(0, 0, 0)",
  animationDuration = 1600,
  animationEasing = Easing.out(Easing.ease),
  waveFactor = 0.54,
  waveMode = "fill",
  ...rest
}, ref) => {
  const _renderComponent = React.useCallback(({
    index,
    count,
    progress
  }) => {
    let fill = waveMode === "fill";
    let factor = Math.max(1 - Math.pow(waveFactor, index), floatEpsilon);
    let waveStyle = {
      height: size,
      width: size,
      borderRadius: size / 2,
      borderWidth: fill ? 0 : Math.floor(size / 20),
      [fill ? "backgroundColor" : "borderColor"]: color,
      transform: [{
        scale: progress.interpolate({
          inputRange: [factor, 1],
          outputRange: [0, 1],
          extrapolate: "clamp"
        })
      }],
      opacity: progress.interpolate({
        inputRange: [0, factor, 1],
        outputRange: [0, 1, 0]
      })
    };
    return /*#__PURE__*/React.createElement(Animated.View, {
      style: {
        ...StyleSheet.absoluteFillObject,
        justifyContent: "center",
        alignItems: "center"
      },
      key: index
    }, /*#__PURE__*/React.createElement(Animated.View, {
      style: waveStyle
    }));
  }, [waveMode, waveFactor, size, color]);
  const {
    style,
    ...props
  } = rest;
  return /*#__PURE__*/React.createElement(View, {
    style: [{
      flex: 1,
      justifyContent: "center",
      alignItems: "center"
    }, style]
  }, /*#__PURE__*/React.createElement(Indicator, _extends({}, props, {
    ref: ref,
    style: {
      width: size,
      height: size
    },
    renderComponent: _renderComponent,
    animationDuration: animationDuration,
    animationEasing: animationEasing,
    count: count
  })));
}));
export default WaveIndicator;
//# sourceMappingURL=wave.js.map