"use strict";

exports.__esModule = true;
exports.useFilterValueTotalState = useFilterValueTotalState;
var _FilterContext = require("../FilterContext");
var _CollectionContext = require("../CollectionContext");
var _react = require("react");
var _state = require("../../state");
function useFilterValueTotalState({
  value,
  ...params
}) {
  const filter = (0, _FilterContext.useFilterContext)();
  const collection = (0, _CollectionContext.useCollectionContext)();
  const [state] = (0, _react.useState)(() => new _state.FilterValueTotalState({
    filter,
    value,
    collection,
    ...params
  }));
  (0, _react.useEffect)(() => state.init(), []);
  (0, _react.useEffect)(() => {
    if (value !== state.value) {
      state.refresh(value);
    }
  }, [value]);
  return state;
}
//# sourceMappingURL=useFilterValueTotalState.js.map