import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { useReducer } from "react";
export default (function () {
  var _useReducer = useReducer(function (state, newTimeToComplete) {
    var newSamplesInWindow = state.samplesInWindow.slice(-10).concat([newTimeToComplete]);
    return {
      timeToCompleteSample: newSamplesInWindow.reduce(function (acc, a) {
        return acc + a;
      }, 0) / newSamplesInWindow.length,
      samplesInWindow: newSamplesInWindow
    };
  }, {
    timeToCompleteSample: 0,
    samplesInWindow: []
  }),
      _useReducer2 = _slicedToArray(_useReducer, 2),
      timeToCompleteSample = _useReducer2[0].timeToCompleteSample,
      changeSampleTimeToComplete = _useReducer2[1];

  return [timeToCompleteSample, changeSampleTimeToComplete];
});