var _excluded = ["isFirst", "isLast", "link", "href", "children"];
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from 'react';
import { StyledBreadcrumbsItem } from './partials/StyledBreadcrumbsItem';
import { StyledEndTitle } from './partials/StyledEndTitle';
import { StyledIcon } from './partials/StyledIcon';
function getText(isLast, link, href, children) {
  if (isLast) {
    return /*#__PURE__*/React.createElement(StyledEndTitle, {
      "aria-current": "page"
    }, link ? link.props.children : children);
  }
  return link || /*#__PURE__*/React.createElement("a", {
    href: href
  }, children);
}
export var BreadcrumbsItem = function BreadcrumbsItem(_ref) {
  var isFirst = _ref.isFirst,
    _ref$isLast = _ref.isLast,
    isLast = _ref$isLast === void 0 ? false : _ref$isLast,
    link = _ref.link,
    href = _ref.href,
    children = _ref.children,
    rest = _objectWithoutProperties(_ref, _excluded);
  return /*#__PURE__*/React.createElement(StyledBreadcrumbsItem, rest, !isFirst && /*#__PURE__*/React.createElement(StyledIcon, {
    "aria-hidden": true
  }), getText(isLast, link, href, children));
};
BreadcrumbsItem.displayName = 'BreadcrumbsItem';