"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _react = require("react");
var _default = exports["default"] = function _default(ref, target, itemsLength, collapsed) {
  var _useState = (0, _react.useState)(false),
    arrowLeft = _useState[0],
    setArrowLeft = _useState[1];
  var _useState2 = (0, _react.useState)(false),
    arrowRight = _useState2[0],
    setArrowRight = _useState2[1];
  var onScroll = (0, _react.useCallback)(function () {
    if (!ref.current || !target.current) return;
    if (!collapsed) return;
    var scroll = ref.current.scrollLeft;
    var _ref$current$getBound = ref.current.getBoundingClientRect(),
      containerRight = _ref$current$getBound.right;
    var _target$current$getBo = target.current.getBoundingClientRect(),
      lastTabRight = _target$current$getBo.right;
    setArrowRight(lastTabRight > containerRight + 20);
    setArrowLeft(scroll > 20);
  }, [collapsed, itemsLength]);
  return [arrowLeft, arrowRight, onScroll];
};