"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.default = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")); var _classnames = _interopRequireDefault(require("classnames")); var _all = _interopRequireDefault(require("prop-types-extra/lib/all")); var _react = _interopRequireWildcard(require("react")); var _uncontrollable = require("uncontrollable"); var _ThemeProvider = require("./ThemeProvider"); var _NavbarContext = _interopRequireDefault(require("./NavbarContext")); var _CardContext = _interopRequireDefault(require("./CardContext")); var _AbstractNav = _interopRequireDefault(require("./AbstractNav")); var _NavItem = _interopRequireDefault(require("./NavItem")); var _NavLink = _interopRequireDefault(require("./NavLink")); var _excluded = ["as", "bsPrefix", "variant", "fill", "justify", "navbar", "navbarScroll", "className", "children", "activeKey"]; function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } var defaultProps = { justify: false, fill: false }; var Nav = /*#__PURE__*/_react.default.forwardRef(function (uncontrolledProps, ref) { var _classNames; var _useUncontrolled = (0, _uncontrollable.useUncontrolled)(uncontrolledProps, { activeKey: 'onSelect' }), _useUncontrolled$as = _useUncontrolled.as, as = _useUncontrolled$as === void 0 ? 'div' : _useUncontrolled$as, initialBsPrefix = _useUncontrolled.bsPrefix, variant = _useUncontrolled.variant, fill = _useUncontrolled.fill, justify = _useUncontrolled.justify, navbar = _useUncontrolled.navbar, navbarScroll = _useUncontrolled.navbarScroll, className = _useUncontrolled.className, children = _useUncontrolled.children, activeKey = _useUncontrolled.activeKey, props = (0, _objectWithoutPropertiesLoose2.default)(_useUncontrolled, _excluded); var bsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(initialBsPrefix, 'nav'); var navbarBsPrefix; var cardHeaderBsPrefix; var isNavbar = false; var navbarContext = (0, _react.useContext)(_NavbarContext.default); var cardContext = (0, _react.useContext)(_CardContext.default); if (navbarContext) { navbarBsPrefix = navbarContext.bsPrefix; isNavbar = navbar == null ? true : navbar; } else if (cardContext) { cardHeaderBsPrefix = cardContext.cardHeaderBsPrefix; } return /*#__PURE__*/_react.default.createElement(_AbstractNav.default, (0, _extends2.default)({ as: as, ref: ref, activeKey: activeKey, className: (0, _classnames.default)(className, (_classNames = {}, _classNames[bsPrefix] = !isNavbar, _classNames[navbarBsPrefix + "-nav"] = isNavbar, _classNames[navbarBsPrefix + "-nav-scroll"] = isNavbar && navbarScroll, _classNames[cardHeaderBsPrefix + "-" + variant] = !!cardHeaderBsPrefix, _classNames[bsPrefix + "-" + variant] = !!variant, _classNames[bsPrefix + "-fill"] = fill, _classNames[bsPrefix + "-justified"] = justify, _classNames)) }, props), children); }); Nav.displayName = 'Nav'; Nav.defaultProps = defaultProps; Nav.Item = _NavItem.default; Nav.Link = _NavLink.default; var _default = Nav; exports.default = _default; module.exports = exports["default"];