function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

/*
Copyright (c) Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
import { styled, withStyle } from '../styles';
import { getMediaQueries } from '../helpers/responsive-helpers';
import { StyledListItem } from '../menu';
import { KIND } from './constants';
var StyledButton = styled('button', function (_ref) {
  var $theme = _ref.$theme,
      $isFocusVisible = _ref.$isFocusVisible;
  return {
    boxSizing: 'border-box',
    display: 'flex',
    flexDirection: 'row',
    flexWrap: 'nowrap',
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'transparent',
    color: $theme.colors.contentPrimary,
    borderLeftWidth: 0,
    borderTopWidth: 0,
    borderRightWidth: 0,
    borderBottomWidth: 0,
    paddingTop: '0',
    paddingBottom: '0',
    paddingLeft: '0',
    paddingRight: '0',
    marginLeft: 0,
    marginTop: 0,
    marginRight: 0,
    marginBottom: 0,
    outline: $isFocusVisible ? "3px solid ".concat($theme.colors.accent) : 'none',
    outlineOffset: '-3px',
    WebkitAppearance: 'none',
    cursor: 'pointer'
  };
});
StyledButton.displayName = "StyledButton";
export var StyledRoot = styled('div', function (props) {
  var $theme = props.$theme;
  var mediaQueries = getMediaQueries($theme.breakpoints);
  var breakpoints = Object.values($theme.breakpoints).sort();
  var margins = [];

  if (Array.isArray($theme.grid.margins)) {
    for (var i = 0; i < breakpoints.length; i++) {
      var margin = $theme.grid.margins[i];

      if (margin == null) {
        margins.push($theme.grid.margins[$theme.grid.margins.length - 1]);
      } else {
        margins.push(margin);
      }
    }
  } else {
    for (var _i = 0; _i < breakpoints.length; _i++) {
      margins.push($theme.grid.margins);
    }
  }

  var style = _objectSpread(_objectSpread({}, $theme.typography.font300), {}, {
    boxSizing: 'border-box',
    backgroundColor: $theme.colors.backgroundPrimary,
    borderBottomWidth: '1px',
    borderBottomStyle: 'solid',
    borderBottomColor: "".concat($theme.colors.borderOpaque),
    paddingInlineStart: margins[0] + 'px',
    paddingInlineEnd: margins[0] + 'px'
  });

  for (var _i2 = 1; _i2 < mediaQueries.length; _i2++) {
    var _margin = Array.isArray($theme.grid.margins) ? $theme.grid.margins[_i2] : $theme.grid.margins;

    style[mediaQueries[_i2]] = {
      paddingInlineStart: _margin + 'px',
      paddingInlineEnd: _margin + 'px'
    };
  }

  return style;
});
StyledRoot.displayName = "StyledRoot";
export var StyledSubnavContainer = styled('div', {});
StyledSubnavContainer.displayName = "StyledSubnavContainer";
export var StyledSpacing = styled('div', function (props) {
  var $theme = props.$theme;
  return _defineProperty({
    boxSizing: 'border-box',
    height: '100%',
    display: 'flex',
    alignItems: 'center',
    paddingTop: $theme.sizing.scale400,
    paddingBottom: $theme.sizing.scale400
  }, $theme.mediaQuery.medium, {
    paddingTop: $theme.sizing.scale700,
    paddingBottom: $theme.sizing.scale700
  });
});
StyledSpacing.displayName = "StyledSpacing";
export var StyledAppName = styled('div', function (_ref3) {
  var $theme = _ref3.$theme;
  return _objectSpread(_objectSpread({}, $theme.typography.font550), {}, _defineProperty({
    color: $theme.colors.primary,
    textDecoration: 'none'
  }, $theme.mediaQuery.medium, _objectSpread({}, $theme.typography.font650)));
});
StyledAppName.displayName = "StyledAppName";
export var StyledSideMenuButton = withStyle(StyledButton, function (_ref4) {
  var $theme = _ref4.$theme;
  return _objectSpread(_objectSpread({}, $theme.direction === 'rtl' ? {
    marginLeft: $theme.sizing.scale600
  } : {
    marginRight: $theme.sizing.scale600
  }), {}, {
    paddingTop: $theme.sizing.scale100,
    paddingBottom: $theme.sizing.scale100,
    paddingLeft: $theme.sizing.scale100,
    paddingRight: $theme.sizing.scale100
  });
});
StyledSideMenuButton.displayName = "StyledSideMenuButton";
export var StyledPrimaryMenuContainer = styled('div', function (_ref5) {
  var $theme = _ref5.$theme;
  return {
    boxSizing: 'border-box',
    height: '100%',
    display: 'flex',
    flexDirection: 'row',
    flexGrow: 1,
    flexWrap: 'nowrap',
    justifyContent: 'flex-end',
    alignItems: 'stretch',
    paddingInlineEnd: $theme.sizing.scale1000
  };
});
StyledPrimaryMenuContainer.displayName = "StyledPrimaryMenuContainer";
export var StyledMainMenuItem = styled('div', function (props) {
  var $active = props.$active,
      $isFocusVisible = props.$isFocusVisible,
      $kind = props.$kind,
      _props$$theme = props.$theme,
      colors = _props$$theme.colors,
      sizing = _props$$theme.sizing,
      direction = _props$$theme.direction;
  return {
    boxSizing: 'border-box',
    display: 'flex',
    alignItems: 'center',
    color: $active ? colors.contentPrimary : colors.contentTertiary,
    marginLeft: sizing.scale700,
    marginRight: sizing.scale700,
    paddingTop: $kind === KIND.secondary ? sizing.scale750 : '0',
    paddingBottom: $kind === KIND.secondary ? sizing.scale750 : '0',
    outline: $isFocusVisible ? "3px solid ".concat(colors.accent) : 'none',
    outlineOffset: '-3px',
    borderBottomWidth: '2px',
    borderBottomStyle: 'solid',
    borderBottomColor: $active && !$isFocusVisible ? colors.primary : 'transparent',
    cursor: $active ? 'default' : 'pointer',
    whiteSpace: $kind === KIND.secondary ? 'nowrap' : 'initial',
    ':first-child': _objectSpread({}, direction === 'rtl' ? {
      marginRight: '0'
    } : {
      marginLeft: '0'
    }),
    ':last-child': _objectSpread({}, direction === 'rtl' ? {
      marginLeft: '0'
    } : {
      marginRight: '0'
    }),
    ':hover': {
      color: colors.primary
    }
  };
});
StyledMainMenuItem.displayName = "StyledMainMenuItem";
export var StyledSecondaryMenuContainer = styled('div', function (_ref6) {
  var $theme = _ref6.$theme;
  return {
    boxSizing: 'border-box',
    height: '100%',
    display: 'flex',
    flexDirection: 'row',
    flexWrap: 'nowrap',
    justifyContent: 'flex-start',
    margin: 'auto',
    maxWidth: "".concat($theme.grid.maxWidth, "px"),
    alignItems: 'stretch',
    overflow: 'auto'
  };
});
StyledSecondaryMenuContainer.displayName = "StyledSecondaryMenuContainer";
export var StyledUserMenuButton = StyledButton;
export var StyledUserMenuProfileListItem = withStyle(StyledListItem, function (_ref7) {
  var $theme = _ref7.$theme;
  return _objectSpread({
    paddingTop: '0',
    paddingBottom: '0'
  }, $theme.direction === 'rtl' ? {
    paddingLeft: '0'
  } : {
    paddingRight: '0'
  });
});
StyledUserMenuProfileListItem.displayName = "StyledUserMenuProfileListItem";
export var StyledUserProfileTileContainer = styled('div', function (_ref8) {
  var $theme = _ref8.$theme;
  return {
    boxSizing: 'border-box',
    height: '100%',
    display: 'flex',
    flexDirection: 'row',
    flexWrap: 'nowrap',
    justifyContent: 'flex-start',
    paddingTop: $theme.sizing.scale650,
    paddingBottom: $theme.sizing.scale650
  };
});
StyledUserProfileTileContainer.displayName = "StyledUserProfileTileContainer";
export var StyledUserProfilePictureContainer = styled('div', function (_ref9) {
  var $theme = _ref9.$theme;
  return _objectSpread({}, $theme.direction === 'rtl' ? {
    marginLeft: $theme.sizing.scale600
  } : {
    marginRight: $theme.sizing.scale600
  });
});
StyledUserProfilePictureContainer.displayName = "StyledUserProfilePictureContainer";
export var StyledUserProfileInfoContainer = styled('div', function (_ref10) {
  var $theme = _ref10.$theme;
  return {
    boxSizing: 'border-box',
    alignSelf: 'center'
  };
});
StyledUserProfileInfoContainer.displayName = "StyledUserProfileInfoContainer";
export var StyledDesktopMenuContainer = styled('div', function (_ref11) {
  var $theme = _ref11.$theme;
  return {};
});
StyledDesktopMenuContainer.displayName = "StyledDesktopMenuContainer";
export var StyledDesktopMenu = styled('div', function (_ref12) {
  var $theme = _ref12.$theme;
  return {
    alignItems: 'center',
    display: 'flex',
    justifyContent: 'space-between',
    margin: 'auto',
    maxWidth: "".concat($theme.grid.maxWidth, "px"),
    paddingBlockStart: '18px',
    paddingBlockEnd: '18px'
  };
});
StyledDesktopMenu.displayName = "StyledDesktopMenu";