'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var React = require('react');
var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var neetoCist = require('@bigbinary/neeto-cist');
var useHotkeys = require('@bigbinary/neeto-hotkeys');
var Help = require('@bigbinary/neeto-icons/Help');
var Profile = require('@bigbinary/neeto-team-members-frontend/Profile');
var Avatar = require('@bigbinary/neetoui/Avatar');
var Dropdown$1 = require('@bigbinary/neetoui/Dropdown');
var ramda = require('ramda');
var KeyboardShortcuts = require('./KeyboardShortcuts.js');
var Modal$1 = require('@bigbinary/neetoui/Modal');
var classnames = require('classnames');
var Search = require('@bigbinary/neeto-icons/Search');
var Input = require('@bigbinary/neetoui/Input');
var Typography = require('@bigbinary/neetoui/Typography');
var reactI18next = require('react-i18next');
var Spinner = require('@bigbinary/neetoui/Spinner');
var Neeto = require('@bigbinary/neeto-icons/typeface-logos/Neeto');
var AppIcons = require('@bigbinary/neeto-icons/typeface-logos');
var injectCss = require('./inject-css-B6qYtOJe.js');
var jsxRuntime = require('react/jsx-runtime');
var reactQuery = require('@tanstack/react-query');
var axios = require('axios');
var i18next = require('i18next');
var Book = require('@bigbinary/neeto-icons/Book');
var Community = require('@bigbinary/neeto-icons/Community');
var useBreakpoints = require('@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints');
var ExternalLink = require('@bigbinary/neeto-icons/ExternalLink');
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
var Right = require('@bigbinary/neeto-icons/Right');
var _objectDestructuringEmpty = require('@babel/runtime/helpers/objectDestructuringEmpty');
var ProductSwitcher$1 = require('@bigbinary/neeto-icons/ProductSwitcher');
var useLocalStorage = require('@bigbinary/neeto-commons-frontend/react-utils/useLocalStorage');
var Check = require('@bigbinary/neeto-icons/Check');
var utils = require('@bigbinary/neeto-commons-frontend/utils');
var axios$1 = require('@bigbinary/neeto-commons-frontend/utils/axios');
var general = require('@bigbinary/neeto-commons-frontend/utils/general');
require('./useKeyboardShortcutsPaneState-YnXpWOcs.js');
require('zustand/shallow');
require('@bigbinary/neeto-commons-frontend/react-utils/withImmutableActions');
require('zustand');
require('@bigbinary/neeto-icons/Close');
require('@bigbinary/neetoui/Button');
require('@bigbinary/neetoui/managers');
require('@bigbinary/neetoui/Kbd');
require('./ua-parser-E0eEtHJZ.js');

function _interopNamespaceDefault(e) {
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var AppIcons__namespace = /*#__PURE__*/_interopNamespaceDefault(AppIcons);

var QUERY_KEYS$1 = {
  NEETO_APPS_LIST: "neeto-apps-list"
};
var SPECIAL_APP_NAMES = {
  bugwatch: "BugWatch"
};

var css$1 = ".neeto-molecules-product-switcher__wrapper{align-items:flex-start;background-color:rgb(var(--neeto-ui-white));display:flex;flex-direction:column;justify-content:flex-start;max-width:100%;overflow-y:auto;padding:24px;position:relative;transition:all .3s;width:100%}@media screen and (max-width:768px){.neeto-molecules-product-switcher__wrapper{padding:16px}}.neeto-molecules-product-switcher__grid{grid-gap:12px;display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(288px,1fr))}@media only screen and (max-width:992px){.neeto-molecules-product-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(248px,1fr))}}@media only screen and (max-width:640px){.neeto-molecules-product-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(100%,1fr))}}.neeto-molecules-product-switcher__header{align-items:center;display:flex;gap:32px;justify-content:space-between;margin-bottom:32px;position:relative;width:100%}@media only screen and (max-width:768px){.neeto-molecules-product-switcher__header{align-items:flex-start;flex-direction:column;gap:24px}}@media only screen and (max-width:640px){.neeto-molecules-product-switcher__header h1{font-size:24px}}@media only screen and (max-width:768px){.neeto-molecules-product-switcher_modal-container .neeto-molecules-product-switcher__header-mobile{align-items:flex-start;margin-bottom:24px}}.neeto-molecules-product-switcher_modal-container .neeto-molecules-product-switcher__wrapper{padding:0}.neeto-molecules-product-switcher__close-btn{inset-inline-end:12px;position:absolute;top:12px}.neeto-molecules-product-switcher__search-wrapper{flex-grow:1}@media only screen and (min-width:992px){.neeto-molecules-product-switcher__search-wrapper{flex-grow:0;width:296px}}.neeto-molecules-product-switcher__body{display:flex;flex-direction:column;font-size:var(--neeto-ui-text-sm);gap:12px;margin-bottom:24px;width:100%}.neeto-molecules-product-switcher-link{background-color:rgb(var(--neeto-ui-white));border-color:rgb(var(--neeto-ui-gray-200));border-radius:var(--neeto-ui-rounded-lg);border-style:solid;border-width:1px;cursor:pointer;display:flex;flex-direction:column;gap:16px;max-width:100%;padding:10px 8px;text-decoration:none;transition:all .3s ease-in-out;width:100%}.neeto-molecules-product-switcher-link:focus,.neeto-molecules-product-switcher-link:focus-visible{outline:none}.neeto-molecules-product-switcher-link:focus-visible{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-product-switcher-link:not(.neeto-molecules-product-switcher-link--active):hover{border-color:rgb(var(--neeto-ui-primary-500))}.neeto-molecules-product-switcher-link--active{background-color:rgb(var(--neeto-ui-primary-50));border-color:rgb(var(--neeto-ui-primary-500))}.neeto-molecules-product-switcher-link--highlighted{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-product-switcher-link__icon-holder{flex-grow:1;flex-shrink:0}.neeto-molecules-product-switcher-link__icon-holder svg{height:36px;width:auto}.neeto-molecules-product-switcher-link__icon-holder .neeto-molecules-product-switcher-link__icon-default{height:24px}.neeto-molecules-product-switcher-link__content{flex-shrink:0}.neeto-molecules-product-switcher-link__content span{display:block}.neeto-molecules-product-switcher_modal{z-index:100000}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen{display:flex;flex-direction:column;height:100dvh!important;width:100vw!important}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen .neeto-ui-modal__header{flex-shrink:0}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen .neeto-ui-modal__body{--neeto-ui-modal-body-padding-top:24px;flex-grow:1;min-height:0;overflow-y:auto}.neeto-ui-theme--dark .neeto-molecules-product-switcher__wrapper [data-dark-mode-color=true]{fill:rgb(var(--neeto-ui-black))}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:24px;align-items:flex-start;padding-bottom:var(--neeto-molecules-product-switcher-modal-padding-y);padding-top:var(--neeto-molecules-product-switcher-modal-padding-y)}@media only screen and (min-width:1024px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:40px}}@media only screen and (min-width:1536px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:80px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-body-padding-top:24px;--neeto-ui-modal-body-padding-bottom:24px;--neeto-ui-modal-close-btn-top:12px;--neeto-ui-modal-close-btn-right:12px;--neeto-ui-modal-body-padding-x:0;--neeto-ui-text-h1:24px}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher-link__icon-holder svg{height:32px}@media only screen and (min-width:1024px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:960px}}@media only screen and (min-width:1280px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:1024px}}@media only screen and (min-width:1536px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:1280px}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher-link__icon-holder svg{height:36px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__header{background-color:rgb(var(--neeto-ui-white));margin-bottom:32px;padding-inline-end:56px;padding-inline-start:24px}@media only screen and (max-width:768px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__header{gap:16px;margin-bottom:16px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__body{height:calc(100dvh - var(--neeto-molecules-product-switcher-modal-padding-y)*2 - 124px);margin-bottom:0;overflow-y:auto;padding-inline-end:24px;padding-inline-start:24px}@media only screen and (max-width:768px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__body{height:calc(90dvh - var(--neeto-molecules-product-switcher-modal-padding-y)*2 - 124px)}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-ui-modal__close{z-index:2}@media only screen and (min-width:1280px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__search-wrapper{width:420px}}@media only screen and (min-width:1536px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__search-wrapper{width:500px}}";
injectCss.n(css$1,{});

var _excluded$2 = ["name", "description", "url", "isHighlighted"];
function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var ProductLink = function ProductLink(_ref) {
  var name = _ref.name,
    description = _ref.description,
    url = _ref.url,
    _ref$isHighlighted = _ref.isHighlighted,
    isHighlighted = _ref$isHighlighted === void 0 ? false : _ref$isHighlighted,
    props = _objectWithoutProperties(_ref, _excluded$2);
  var normalizedName = (name || "").toLowerCase();
  var specialCase = SPECIAL_APP_NAMES[normalizedName];
  var appName = "Neeto".concat(name.charAt(0)).concat(name.slice(1).toLowerCase());
  var AppIcon = specialCase ? AppIcons__namespace["Neeto".concat(specialCase)] : AppIcons__namespace[appName];
  return /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread$6(_objectSpread$6({
    "data-cy": "".concat(name, "-app-link"),
    "data-testid": "neetoapp-link-".concat(name),
    href: url,
    rel: "noreferrer",
    target: "_blank",
    className: classnames("neeto-molecules-product-switcher-link", {
      "neeto-molecules-product-switcher-link--active": globalProps.appName.includes(name),
      "neeto-molecules-product-switcher-link--highlighted": isHighlighted
    })
  }, props), {}, {
    children: [/*#__PURE__*/jsxRuntime.jsx("div", {
      className: "neeto-molecules-product-switcher-link__icon-holder",
      children: AppIcon ? /*#__PURE__*/jsxRuntime.jsx(AppIcon, {}) : /*#__PURE__*/jsxRuntime.jsx(Neeto, {
        className: "neeto-molecules-product-switcher-link__icon-default"
      })
    }), /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "neeto-molecules-product-switcher-link__content",
      children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
        className: "neeto-ui-text-gray-600",
        component: "span",
        style: "body3",
        weight: "normal",
        children: description
      })
    })]
  }));
};
var ProductLink$1 = /*#__PURE__*/React.memo(ProductLink);

function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var Content = function Content(_ref) {
  var highlightedIndex = _ref.highlightedIndex,
    filteredApps = _ref.filteredApps,
    isLoading = _ref.isLoading;
  var _useTranslation = reactI18next.useTranslation(),
    t = _useTranslation.t;
  if (isLoading) {
    return /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "flex items-center justify-center py-8",
      children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
    });
  }
  return (filteredApps === null || filteredApps === void 0 ? void 0 : filteredApps.length) > 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
    className: "neeto-molecules-product-switcher__grid",
    children: filteredApps.map(function (app, index) {
      return /*#__PURE__*/jsxRuntime.jsx(ProductLink$1, _objectSpread$5(_objectSpread$5({}, app), {}, {
        "data-highlighted-index": index,
        isHighlighted: index === highlightedIndex
      }), app.name);
    })
  }) : /*#__PURE__*/jsxRuntime.jsx(Typography, {
    className: "neeto-ui-text-center",
    "data-cy": "no-apps-found-title",
    style: "body1",
    children: t("neetoMolecules.productSwitcher.noApps")
  });
};

var fetch$1 = function fetch() {
  return axios.get("/api/v1/neeto_apps");
};
var neetoAppsApi = {
  fetch: fetch$1
};

function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var useFetchNeetoApps = function useFetchNeetoApps(options) {
  return reactQuery.useQuery(_objectSpread$4({
    queryKey: [QUERY_KEYS$1.NEETO_APPS_LIST],
    queryFn: neetoAppsApi.fetch
  }, options));
};

var useProductSwitcherNavigation = function useProductSwitcherNavigation() {
  var filteredApps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var _useState = React.useState(0),
    _useState2 = _slicedToArray(_useState, 2),
    highlightedIndex = _useState2[0],
    setHighlightedIndex = _useState2[1];
  var scrollContainerRef = React.useRef(null);
  React.useEffect(function () {
    return setHighlightedIndex(0);
  }, [filteredApps]);
  React.useEffect(function () {
    if (!scrollContainerRef.current || ramda.isEmpty(filteredApps)) return;
    var container = scrollContainerRef.current;
    var highlightedElement = container.querySelector("[data-highlighted-index=\"".concat(highlightedIndex, "\"]"));
    if (!highlightedElement) return;
    var containerRect = container.getBoundingClientRect();
    var elRect = highlightedElement.getBoundingClientRect();
    if (elRect.top < containerRect.top) {
      container.scrollTop += elRect.top - containerRect.top;
    } else if (elRect.bottom > containerRect.bottom) {
      container.scrollTop += elRect.bottom - containerRect.bottom;
    }
  }, [highlightedIndex, filteredApps]);
  var getColumnsPerRow = function getColumnsPerRow() {
    var width = window.innerWidth;
    if (width < 768) return 1;
    if (width < 1024) return 2;
    if (width < 1536) return 3;
    return 4;
  };
  var handleOpenHighlightedApp = function handleOpenHighlightedApp() {
    var app = filteredApps[highlightedIndex];
    if (!(app !== null && app !== void 0 && app.url)) return;
    window.open(app.url, "_blank", "noopener,noreferrer");
  };
  var navigationHandlers = {
    left: function left(prev) {
      return prev === 0 ? filteredApps.length - 1 : prev - 1;
    },
    right: function right(prev) {
      return prev === filteredApps.length - 1 ? 0 : prev + 1;
    },
    up: function up(prev) {
      var columnsPerRow = getColumnsPerRow();
      var newIndex = prev - columnsPerRow;
      if (newIndex >= 0) return newIndex;
      var currentCol = prev % columnsPerRow;
      var lastIndex = filteredApps.length - 1;
      return lastIndex - (lastIndex - currentCol) % columnsPerRow;
    },
    down: function down(prev) {
      var columnsPerRow = getColumnsPerRow();
      var newIndex = prev + columnsPerRow;
      if (newIndex < filteredApps.length) return newIndex;
      return prev % columnsPerRow;
    }
  };
  var keyActions = {
    Enter: handleOpenHighlightedApp,
    ArrowLeft: function ArrowLeft() {
      return setHighlightedIndex(navigationHandlers["left"]);
    },
    ArrowRight: function ArrowRight() {
      return setHighlightedIndex(navigationHandlers["right"]);
    },
    ArrowUp: function ArrowUp() {
      return setHighlightedIndex(navigationHandlers["up"]);
    },
    ArrowDown: function ArrowDown() {
      return setHighlightedIndex(navigationHandlers["down"]);
    },
    Tab: function Tab(e) {
      return setHighlightedIndex(navigationHandlers[e.shiftKey ? "left" : "right"]);
    }
  };
  var handleKeyDown = function handleKeyDown(e) {
    var action = keyActions[e.key];
    if (!action) return;
    e.preventDefault();
    e.stopPropagation();
    if (neetoCist.isNotEmpty(filteredApps)) action(e);
  };
  return {
    highlightedIndex: highlightedIndex,
    handleKeyDown: handleKeyDown,
    scrollContainerRef: scrollContainerRef
  };
};

var Menu$3 = function Menu(_ref) {
  var _ref$isMobile = _ref.isMobile,
    isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile,
    initialFocusRef = _ref.initialFocusRef;
  var _useTranslation = reactI18next.useTranslation(),
    t = _useTranslation.t;
  var _useState = React.useState(""),
    _useState2 = _slicedToArray(_useState, 2),
    searchTerm = _useState2[0],
    setSearchTerm = _useState2[1];
  var _useFetchNeetoApps = useFetchNeetoApps(),
    data = _useFetchNeetoApps.data,
    isLoading = _useFetchNeetoApps.isLoading;
  var substring = searchTerm.replace(/ /g, "").toLowerCase();
  var filteredApps = React.useMemo(function () {
    if (!data) return [];
    return data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref2) {
      var name = _ref2.name;
      var nameLower = name.toLowerCase();
      var searchTermLower = substring.toLowerCase();
      var isNeetoPrefixMatch = searchTermLower.length <= 4 && "neeto".startsWith(searchTermLower);
      if (isNeetoPrefixMatch) return true;
      var productName = searchTermLower.startsWith("neeto") ? searchTermLower.replace("neeto", "") : searchTermLower;
      return nameLower.includes(productName);
    });
  }, [data, substring]);
  var _useProductSwitcherNa = useProductSwitcherNavigation(filteredApps),
    highlightedIndex = _useProductSwitcherNa.highlightedIndex,
    handleKeyDown = _useProductSwitcherNa.handleKeyDown,
    scrollContainerRef = _useProductSwitcherNa.scrollContainerRef;
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
    className: "neeto-molecules-product-switcher__wrapper",
    "data-cy": "switcher-wrapper",
    "data-testid": "switcher-wrapper",
    children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
      "data-cy": "product-switcher-body-wrapper",
      className: classnames("neeto-molecules-product-switcher__header pt-1", {
        "neeto-molecules-product-switcher__header-mobile": isMobile
      }),
      children: [!isMobile && /*#__PURE__*/jsxRuntime.jsx(Typography, {
        style: "h1",
        children: t("neetoMolecules.productSwitcher.chooseNeetoProduct")
      }), /*#__PURE__*/jsxRuntime.jsx("div", {
        className: "neeto-molecules-product-switcher__search-wrapper",
        children: /*#__PURE__*/jsxRuntime.jsx(Input, {
          autoFocus: true,
          "data-cy": "product-switcher-search-input",
          placeholder: t("neetoMolecules.productSwitcher.searchProducts"),
          prefix: /*#__PURE__*/jsxRuntime.jsx(Search, {}),
          ref: initialFocusRef,
          size: "large",
          type: "search",
          value: searchTerm,
          onChange: function onChange(e) {
            return setSearchTerm(e.target.value);
          },
          onKeyDown: handleKeyDown
        })
      })]
    }), /*#__PURE__*/jsxRuntime.jsx("div", {
      ref: scrollContainerRef,
      className: classnames("neeto-molecules-product-switcher__body", _defineProperty({}, "neeto-molecules-product-switcher__body-mobile", isMobile)),
      children: /*#__PURE__*/jsxRuntime.jsx(Content, {
        filteredApps: filteredApps,
        highlightedIndex: highlightedIndex,
        isLoading: isLoading
      })
    })]
  }, "switcher-wrapper");
};

var Modal = function Modal(_ref) {
  var isOpen = _ref.isOpen,
    onClose = _ref.onClose;
  var initialFocusRef = React.useRef(null);
  return /*#__PURE__*/jsxRuntime.jsx(Modal$1, {
    initialFocusRef: initialFocusRef,
    isOpen: isOpen,
    onClose: onClose,
    backdropClassName: "neeto-molecules-product-switcher_modal",
    size: "large",
    children: /*#__PURE__*/jsxRuntime.jsx(Modal$1.Body, {
      children: /*#__PURE__*/jsxRuntime.jsx("div", {
        className: "neeto-molecules-product-switcher_modal-container",
        "data-testid": "product-switcher-modal",
        children: /*#__PURE__*/jsxRuntime.jsx(Menu$3, {
          initialFocusRef: initialFocusRef
        })
      })
    })
  });
};

var shouldShowWhatsNew = function shouldShowWhatsNew() {
  var _window$globalProps;
  var currentUserEmail = (_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 || (_window$globalProps = _window$globalProps.user) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.email;
  return window.location.hostname === "localhost" || currentUserEmail === "oliver@example.com" || (currentUserEmail === null || currentUserEmail === void 0 ? void 0 : currentUserEmail.endsWith("@bigbinary.com"));
};
var MY_ORGANIZATION_URL = "/auth/organization/edit";
var ENGAGE_WIDGET_TRIGGER_ID = "neetoengage-trigger";
var DEFAULT_HELP_LINK_PROPS = {
  communityProps: {
    label: i18next.t("neetoMolecules.sidebar.helpLinks.community", {
      app: globalProps.appName
    }),
    icon: Community,
    "data-cy": "help-link-community-button",
    "data-btn-weight": "bold",
    href: "https://www.launchpass.com/neetohq",
    target: "_blank"
  },
  helpCenterProps: {
    label: i18next.t("neetoMolecules.sidebar.helpLinks.helpCenter"),
    icon: Book,
    "data-cy": "help-link-help-center-button",
    "data-btn-weight": "bold",
    href: "https://help.".concat(ramda.toLower(globalProps.appName), ".com/"),
    target: "_blank"
  },
  liveChatProps: {
    label: i18next.t("neetoMolecules.sidebar.helpLinks.liveChat"),
    icon: Help,
    "data-cy": "help-link-live-chat-button",
    "data-btn-weight": "bold",
    onClick: function onClick() {
      var _window$NeetoChat, _window$NeetoChat2;
      (_window$NeetoChat = window.NeetoChat) === null || _window$NeetoChat === void 0 || (_window$NeetoChat = _window$NeetoChat.contextualHelp) === null || _window$NeetoChat === void 0 || _window$NeetoChat.maximizeWidget();
      (_window$NeetoChat2 = window.NeetoChat) === null || _window$NeetoChat2 === void 0 || (_window$NeetoChat2 = _window$NeetoChat2.contextualHelp) === null || _window$NeetoChat2 === void 0 || _window$NeetoChat2.openWidget();
    }
  }
};
var DEFAULT_MENU_LINK_PROPS = {
  engageProps: {
    id: ENGAGE_WIDGET_TRIGGER_ID,
    label: i18next.t("neetoMolecules.sidebar.helpLinks.whatsNew"),
    "data-cy": "help-link-engage-button",
    isVisible: shouldShowWhatsNew
  },
  keyboardShortcutProps: {
    label: i18next.t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
    "data-cy": "help-link-keyboard-shortcut-button"
  },
  statusProps: {
    label: i18next.t("neetoMolecules.sidebar.helpLinks.productStatus", {
      app: globalProps.appName
    }),
    "data-cy": "help-link-status-button",
    href: "https://neetostatus.com/",
    target: "_blank"
  }
};
var NON_BUTTON_PROPS = ["isVisible"];

// Theme switcher
var APP_THEME_LOCALSTORAGE_KEY = "appTheme";
var THEMES = {
  LIGHT: "neeto-ui-theme--light",
  DARK: "neeto-ui-theme--dark"
};
var NEETO_AUTH_BILLING_INFO_URL = "/neeto_sso/api/v1/subscription/billing";

var _excluded$1 = ["label", "icon", "changesCount"];
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var LinkSection = function LinkSection(_ref) {
  var links = _ref.links;
  var MenuItem = Dropdown$1.MenuItem;
  if (neetoCist.isNotPresent(links)) return null;
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
    children: links.map(function (_ref2, idx) {
      var label = _ref2.label,
        Icon = _ref2.icon,
        changesCount = _ref2.changesCount,
        otherProps = _objectWithoutProperties(_ref2, _excluded$1);
      return /*#__PURE__*/jsxRuntime.jsxs(MenuItem.Button, _objectSpread$3(_objectSpread$3({
        className: "neeto-molecules-menu-sublist__item-btn",
        "data-cy": "floating-action-menu-link-section",
        prefix: Icon && /*#__PURE__*/jsxRuntime.jsx(Icon, {
          size: 18
        }),
        style: "text"
      }, ramda.omit(NON_BUTTON_PROPS, otherProps)), {}, {
        children: [label, neetoCist.isPresent(changesCount) && /*#__PURE__*/jsxRuntime.jsx("span", {
          className: "neeto-molecules-menu-list__item-btn-count",
          "data-cy": "help-section-menu-changes-count",
          "data-testid": "help-section-menu-changes-count",
          children: changesCount
        })]
      }), idx);
    })
  });
};

var fetch = function fetch(email) {
  return axios.get("/logged_in_organizations", {
    params: {
      email: email
    }
  });
};
var loggedInOrganizationsApi = {
  fetch: fetch
};

var QUERY_KEYS = {
  LOGGED_IN_ORGANIZATIONS_LIST: "logged-in-organizations-list"
};

var LOGGED_IN_ORGANIZATIONS_LIST = QUERY_KEYS.LOGGED_IN_ORGANIZATIONS_LIST;
var useFetchLoggedInOrganizations = function useFetchLoggedInOrganizations(email) {
  return reactQuery.useQuery({
    queryKey: [LOGGED_IN_ORGANIZATIONS_LIST],
    queryFn: function queryFn() {
      return loggedInOrganizationsApi.fetch(email);
    }
  });
};

var MenuItem$4 = Dropdown$1.MenuItem;
var MenuButton$2 = reactUtils.withT(function (_ref) {
  var t = _ref.t;
  return /*#__PURE__*/jsxRuntime.jsx(MenuItem$4.Button, {
    className: "neeto-molecules-menu-sublist__item-btn",
    "data-cy": "organization-switcher-button",
    "data-testid": "organization-switcher-button",
    style: "text",
    suffix: /*#__PURE__*/jsxRuntime.jsx(Right, {
      className: "rtl:scale-x-[-1]",
      size: 18
    }),
    children: t("neetoMolecules.sidebar.organizationSwitcher.label")
  });
});

var Menu$2 = Dropdown$1.Menu,
  MenuItem$3 = Dropdown$1.MenuItem;
var OrganizationSwitcher = function OrganizationSwitcher() {
  var _globalProps$user;
  var _useTranslation = reactI18next.useTranslation(),
    t = _useTranslation.t;
  var _useBreakpoints = useBreakpoints(),
    isSize = _useBreakpoints.isSize;
  var _useFetchLoggedInOrga = useFetchLoggedInOrganizations(initializers.globalProps === null || initializers.globalProps === void 0 || (_globalProps$user = initializers.globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email),
    _useFetchLoggedInOrga2 = _useFetchLoggedInOrga.data,
    _useFetchLoggedInOrga3 = _useFetchLoggedInOrga2 === void 0 ? {} : _useFetchLoggedInOrga2,
    organizations = _useFetchLoggedInOrga3.organizations,
    authAppUrl = _useFetchLoggedInOrga3.authAppUrl;
  var isMobile = isSize("mobile");
  var isCurrentSubdomain = function isCurrentSubdomain(link) {
    var currentSubdomain = window.location.hostname.split(".")[0];
    var linkSubdomain = new URL(link).hostname.split(".")[0];
    return currentSubdomain === linkSubdomain;
  };
  return /*#__PURE__*/jsxRuntime.jsx(Dropdown$1, {
    className: "neeto-molecules-theme-switcher-menu-popup-wrapper",
    closeOnSelect: false,
    customTarget: /*#__PURE__*/jsxRuntime.jsx(MenuButton$2, {}),
    interactiveDebounce: 30,
    offset: [0, 5],
    position: isMobile ? "bottom" : "right",
    trigger: "all",
    zIndex: 99999,
    children: /*#__PURE__*/jsxRuntime.jsxs(Menu$2, {
      children: [organizations === null || organizations === void 0 ? void 0 : organizations.map(function (organization) {
        return /*#__PURE__*/jsxRuntime.jsxs(MenuItem$3.Button, {
          href: organization.organizationUrl,
          rel: "noreferrer",
          style: "text",
          suffix: /*#__PURE__*/jsxRuntime.jsx(ExternalLink, {
            size: 18
          }),
          target: "_blank",
          className: classnames({
            "neeto-molecules-organization-switcher-active-button": isCurrentSubdomain(organization.organizationUrl)
          }),
          children: [/*#__PURE__*/jsxRuntime.jsx(Avatar, {
            user: {
              name: organization.userName,
              imageUrl: organization.userImageUrl
            }
          }), organization.orgName]
        }, organization.userId);
      }), /*#__PURE__*/jsxRuntime.jsx(MenuItem$3.Button, {
        href: authAppUrl,
        rel: "noreferrer",
        target: "_blank",
        children: t("neetoMolecules.sidebar.organizationSwitcher.addAccount")
      })]
    })
  });
};

function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var MenuButton$1 = function MenuButton(_ref) {
  var otherProps = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
  var _useTranslation = reactI18next.useTranslation(),
    t = _useTranslation.t;
  var MenuItem = Dropdown$1.MenuItem;
  return /*#__PURE__*/jsxRuntime.jsxs(MenuItem.Button, _objectSpread$2(_objectSpread$2({
    className: "neeto-molecules-menu-sublist__item-btn",
    "data-cy": "product-switcher-button",
    "data-testid": "product-switcher-button",
    label: t("neetoMolecules.sidebar.productSwitcher"),
    style: "text",
    suffix: /*#__PURE__*/jsxRuntime.jsx(Right, {
      className: "rtl:scale-x-[-1]",
      size: 18
    })
  }, otherProps), {}, {
    children: [/*#__PURE__*/jsxRuntime.jsx(ProductSwitcher$1, {
      size: 20
    }), t("neetoMolecules.sidebar.productSwitcher")]
  }));
};

var Menu$1 = Dropdown$1.Menu,
  MenuItem$2 = Dropdown$1.MenuItem;
var Dropdown = function Dropdown() {
  return /*#__PURE__*/jsxRuntime.jsx(Dropdown$1, {
    appendTo: "parent",
    className: "neeto-molecules-product-switcher-menu-popup-wrapper",
    closeOnSelect: false,
    customTarget: /*#__PURE__*/jsxRuntime.jsx(MenuButton$1, {}),
    interactiveDebounce: 30,
    offset: [0, 5],
    position: "right",
    trigger: "all",
    zIndex: 99999,
    dropdownProps: {
      classNames: "neeto-molecules-product-switcher-menu-popup__dropdown"
    },
    children: /*#__PURE__*/jsxRuntime.jsx(Menu$1, {
      children: /*#__PURE__*/jsxRuntime.jsx(MenuItem$2, {
        children: /*#__PURE__*/jsxRuntime.jsx(Menu$3, {})
      })
    })
  });
};

var ProductSwitcher = function ProductSwitcher(_ref) {
  var toggleModal = _ref.toggleModal;
  var _useBreakpoints = useBreakpoints(),
    isSize = _useBreakpoints.isSize;
  var isMobile = isSize("mobile");
  return isMobile ? /*#__PURE__*/jsxRuntime.jsx(MenuButton$1, {
    onClick: function onClick() {
      return toggleModal(true);
    }
  }) : /*#__PURE__*/jsxRuntime.jsx(Dropdown, {});
};

var ProfileHeader = function ProfileHeader(_ref) {
  var profileInfo = _ref.profileInfo;
  var name = profileInfo.name,
    email = profileInfo.email;
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
    className: "neeto-ui-relative neeto-ui-flex neeto-ui-items-center neeto-ui-p-3 neeto-ui-bg-primary-50 neeto-molecules-profile-popup__top-section",
    "data-cy": "floating-action-menu-profile-header",
    children: [/*#__PURE__*/jsxRuntime.jsx("div", {
      className: "start-0 top-0",
      children: /*#__PURE__*/jsxRuntime.jsx(Avatar, {
        "data-cy": "floating-action-menu-header-profile-icon",
        size: "large",
        user: profileInfo
      })
    }), /*#__PURE__*/jsxRuntime.jsxs("div", {
      className: "neeto-ui-flex neeto-ui-flex-col neeto-ui-flex-grow neeto-ui-min-w-0 neeto-ui-ps-3",
      children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
        className: "neeto-ui-m-0",
        component: "h2",
        "data-cy": "floating-action-menu-header-user-name",
        lineHeight: "tight",
        style: "h5",
        title: name,
        weight: "semibold",
        children: neetoCist.truncate(name, 18)
      }), email && /*#__PURE__*/jsxRuntime.jsx(Typography, {
        className: "neeto-ui-w-full neeto-ui-truncate neeto-ui-text-gray-700",
        "data-cy": "floating-action-menu-header-user-email",
        lineHeight: "tight",
        style: "body3",
        children: email
      })]
    })]
  });
};

var getSidebarStateLocalStorageKey = function getSidebarStateLocalStorageKey() {
  var _globalProps$user, _globalProps$user2;
  var user = ((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email) || ((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.phoneNumber);
  return "sidebarState-".concat(user);
};
var getUserProfileInfo = function getUserProfileInfo() {
  var _globalProps$user$fir, _globalProps$user3, _globalProps$user$las, _globalProps$user4, _globalProps$user5, _globalProps$user6, _globalProps$user7;
  return {
    name: "".concat((_globalProps$user$fir = (_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.firstName) !== null && _globalProps$user$fir !== void 0 ? _globalProps$user$fir : "", " ").concat((_globalProps$user$las = (_globalProps$user4 = globalProps.user) === null || _globalProps$user4 === void 0 ? void 0 : _globalProps$user4.lastName) !== null && _globalProps$user$las !== void 0 ? _globalProps$user$las : ""),
    imageUrl: globalProps.authenticated ? (_globalProps$user5 = globalProps.user) === null || _globalProps$user5 === void 0 ? void 0 : _globalProps$user5.profileImageUrl : "https://d2v7kzglnr2dnh.cloudfront.net/others/profile-pic.jpg",
    email: ((_globalProps$user6 = globalProps.user) === null || _globalProps$user6 === void 0 ? void 0 : _globalProps$user6.email) || ((_globalProps$user7 = globalProps.user) === null || _globalProps$user7 === void 0 ? void 0 : _globalProps$user7.phoneNumber),
    isAuthenticated: globalProps.authenticated
  };
};
var getConsumerProfileInfo = function getConsumerProfileInfo() {
  var _globalProps$consumer, _globalProps$consumer2, _globalProps$consumer3, _globalProps$consumer4, _globalProps$consumer5, _globalProps$consumer6, _globalProps$consumer7;
  return {
    name: "".concat((_globalProps$consumer = (_globalProps$consumer2 = globalProps.consumer) === null || _globalProps$consumer2 === void 0 ? void 0 : _globalProps$consumer2.firstName) !== null && _globalProps$consumer !== void 0 ? _globalProps$consumer : "", " ").concat((_globalProps$consumer3 = (_globalProps$consumer4 = globalProps.consumer) === null || _globalProps$consumer4 === void 0 ? void 0 : _globalProps$consumer4.lastName) !== null && _globalProps$consumer3 !== void 0 ? _globalProps$consumer3 : ""),
    imageUrl: ((_globalProps$consumer5 = globalProps.consumer) === null || _globalProps$consumer5 === void 0 ? void 0 : _globalProps$consumer5.profileImageUrl) || "https://d2v7kzglnr2dnh.cloudfront.net/others/profile-pic.jpg",
    email: ((_globalProps$consumer6 = globalProps.consumer) === null || _globalProps$consumer6 === void 0 ? void 0 : _globalProps$consumer6.email) || ((_globalProps$consumer7 = globalProps.consumer) === null || _globalProps$consumer7 === void 0 ? void 0 : _globalProps$consumer7.phoneNumber),
    isAuthenticated: globalProps.isConsumer
  };
};
var getDefaultTopLinks = function getDefaultTopLinks(isOwner, setIsProfilePaneOpen, isAuthenticated) {
  if (!isAuthenticated) return [];
  var topLinks = [{
    label: i18next.t("neetoMolecules.sidebar.myProfile"),
    onClick: function onClick() {
      return setIsProfilePaneOpen(true);
    },
    "data-cy": "my-profile-button",
    "data-testid": "my-profile-button"
  }];
  if (isOwner) {
    topLinks.push({
      label: i18next.t("neetoMolecules.sidebar.myWorkspace"),
      onClick: function onClick() {
        return window.open(MY_ORGANIZATION_URL, "_self");
      },
      "data-cy": "profile-organization-settings-button"
    });
  }
  return topLinks;
};
var getDefaultBottomLinks = function getDefaultBottomLinks(isAuthenticated, isConsumer) {
  return [isAuthenticated ? {
    label: i18next.t("neetoMolecules.sidebar.logout"),
    onClick: function onClick() {
      axios$1.resetAuthTokens();
      general.removeFromLocalStorage(getSidebarStateLocalStorageKey());
      isConsumer ?
      // eslint-disable-next-line xss/no-location-href-assign
      window.location.href = "/consumers/logout?redirect_uri=".concat(window.location.href) :
      // eslint-disable-next-line xss/no-location-href-assign
      window.location.href = "/logout";
    },
    "data-cy": "profile-logout-button"
  } : {
    label: i18next.t("neetoMolecules.sidebar.login"),
    onClick: function onClick() {
      // eslint-disable-next-line xss/no-location-href-assign
      window.location.href = "/login";
    },
    "data-cy": "profile-login-button"
  }];
};
var getProfileInfo = function getProfileInfo(profileInfoOverrides, isConsumer) {
  return ramda.mergeDeepLeft(profileInfoOverrides, isConsumer ? getConsumerProfileInfo() : getUserProfileInfo());
};

// Theme switcher utils.
var setDarkTheme = function setDarkTheme() {
  if (!document.body) return;
  document.body.classList.remove(THEMES.LIGHT);
  document.body.classList.add(THEMES.DARK);
};
var setLightTheme = function setLightTheme() {
  if (!document.body) return;
  document.body.classList.remove(THEMES.DARK);
  document.body.classList.add(THEMES.LIGHT);
};
var setAppTheme = function setAppTheme() {
  var isDarkTheme = utils.getFromLocalStorage(APP_THEME_LOCALSTORAGE_KEY) === THEMES.DARK;
  isDarkTheme ? setDarkTheme() : setLightTheme();
};

var MenuItem$1 = Dropdown$1.MenuItem;
var MenuButton = reactUtils.withT(function (_ref) {
  var t = _ref.t,
    selectedThemeName = _ref.selectedThemeName;
  return /*#__PURE__*/jsxRuntime.jsx(MenuItem$1.Button, {
    className: "neeto-molecules-menu-sublist__item-btn",
    "data-cy": "theme-switcher-button",
    "data-testid": "theme-switcher-button",
    style: "text",
    suffix: /*#__PURE__*/jsxRuntime.jsx(Right, {
      className: "rtl:scale-x-[-1]",
      size: 18
    }),
    children: t("neetoMolecules.sidebar.themeSwitcher.label", {
      selectedTheme: selectedThemeName
    })
  });
});

var Menu = Dropdown$1.Menu,
  MenuItem = Dropdown$1.MenuItem;
var ThemeSwitcher = function ThemeSwitcher() {
  var _useTranslation = reactI18next.useTranslation(),
    t = _useTranslation.t;
  var _useBreakpoints = useBreakpoints(),
    isSize = _useBreakpoints.isSize;
  var _useLocalStorage = useLocalStorage(APP_THEME_LOCALSTORAGE_KEY, THEMES.LIGHT),
    _useLocalStorage2 = _slicedToArray(_useLocalStorage, 2),
    appTheme = _useLocalStorage2[0],
    setAppTheme = _useLocalStorage2[1];
  var isDarkThemeSelected = appTheme === THEMES.DARK;
  var selectedThemeName = isDarkThemeSelected ? t("neetoMolecules.sidebar.themeSwitcher.dark") : t("neetoMolecules.sidebar.themeSwitcher.light");
  var isMobile = isSize("mobile");
  var switchTheme = function switchTheme(theme) {
    theme === THEMES.LIGHT ? setLightTheme() : setDarkTheme();
    setAppTheme(theme);
  };
  return /*#__PURE__*/jsxRuntime.jsx(Dropdown$1, {
    appendTo: "parent",
    className: "neeto-molecules-theme-switcher-menu-popup-wrapper",
    closeOnSelect: false,
    customTarget: /*#__PURE__*/jsxRuntime.jsx(MenuButton, {
      selectedThemeName: selectedThemeName
    }),
    interactiveDebounce: 30,
    offset: [0, 5],
    position: isMobile ? "bottom" : "right",
    trigger: "all",
    zIndex: 99999,
    children: /*#__PURE__*/jsxRuntime.jsxs(Menu, {
      children: [/*#__PURE__*/jsxRuntime.jsx(MenuItem.Button, {
        "data-cy": "theme-switcher-light-button",
        "data-testid": "theme-switcher-light-button",
        suffix: !isDarkThemeSelected && /*#__PURE__*/jsxRuntime.jsx(Check, {
          size: 18
        }),
        className: classnames({
          "neeto-molecules-theme-switcher-active-button": !isDarkThemeSelected
        }),
        onClick: function onClick() {
          return switchTheme(THEMES.LIGHT);
        },
        children: t("neetoMolecules.sidebar.themeSwitcher.light")
      }), /*#__PURE__*/jsxRuntime.jsx(MenuItem.Button, {
        "data-cy": "theme-switcher-dark-button",
        "data-testid": "theme-switcher-dark-button",
        suffix: isDarkThemeSelected && /*#__PURE__*/jsxRuntime.jsx(Check, {
          size: 18
        }),
        className: classnames({
          "neeto-molecules-theme-switcher-active-button": isDarkThemeSelected
        }),
        onClick: function onClick() {
          return switchTheme(THEMES.DARK);
        },
        children: t("neetoMolecules.sidebar.themeSwitcher.dark")
      })]
    })
  });
};

var ProfileMenu = function ProfileMenu(_ref) {
  var _globalProps$user, _globalProps$user2;
  var profileInfo = _ref.profileInfo,
    showProductSwitcher = _ref.showProductSwitcher,
    helpLinks = _ref.helpLinks,
    defaultLinks = _ref.defaultLinks,
    topLinks = _ref.topLinks,
    bottomLinks = _ref.bottomLinks,
    customContent = _ref.customContent,
    toggleModal = _ref.toggleModal,
    isThemeSwitcherEnabled = _ref.isThemeSwitcherEnabled,
    isOrganizationSwitcherEnabled = _ref.isOrganizationSwitcherEnabled,
    isConsumer = _ref.isConsumer;
  var Menu = Dropdown$1.Menu,
    MenuItem = Dropdown$1.MenuItem,
    Divider = Dropdown$1.Divider;
  var isAuthenticated = profileInfo.isAuthenticated;
  return /*#__PURE__*/jsxRuntime.jsxs(Menu, {
    className: "pb-1",
    children: [/*#__PURE__*/jsxRuntime.jsx(MenuItem, {
      className: "neeto-molecules-profile-popup",
      "data-cy": "profile-popup",
      "data-testid": "profile-popup",
      children: isAuthenticated && /*#__PURE__*/jsxRuntime.jsx(ProfileHeader, {
        profileInfo: profileInfo
      })
    }), !isConsumer && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
      children: [neetoCist.isPresent((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.subscriptionPlan) && /*#__PURE__*/jsxRuntime.jsx(LinkSection, {
        links: [{
          label: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
            i18nKey: "neetoMolecules.sidebar.currentPlan",
            values: {
              subscriptionPlan: neetoCist.humanize((_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.subscriptionPlan)
            }
          }),
          href: NEETO_AUTH_BILLING_INFO_URL,
          "data-cy": "subscription-plan",
          "data-testid": "subscription-plan"
        }]
      }), showProductSwitcher && /*#__PURE__*/jsxRuntime.jsx(ProductSwitcher, {
        toggleModal: toggleModal
      }), isOrganizationSwitcherEnabled && /*#__PURE__*/jsxRuntime.jsx(OrganizationSwitcher, {}), isThemeSwitcherEnabled && /*#__PURE__*/jsxRuntime.jsx(ThemeSwitcher, {}), neetoCist.isNotEmpty(topLinks) && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
        children: [/*#__PURE__*/jsxRuntime.jsx(Divider, {}), /*#__PURE__*/jsxRuntime.jsx(LinkSection, {
          links: topLinks
        })]
      }), neetoCist.isPresent(customContent) && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
        children: [/*#__PURE__*/jsxRuntime.jsx(Divider, {}), /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
          className: "neeto-molecules-floating-action-button__profile-wrapper-custom-content",
          children: customContent
        })]
      }), /*#__PURE__*/jsxRuntime.jsx(Divider, {}), /*#__PURE__*/jsxRuntime.jsx(LinkSection, {
        links: defaultLinks
      }), /*#__PURE__*/jsxRuntime.jsx(Divider, {}), /*#__PURE__*/jsxRuntime.jsx(LinkSection, {
        links: helpLinks
      }), /*#__PURE__*/jsxRuntime.jsx(Divider, {})]
    }), /*#__PURE__*/jsxRuntime.jsx(LinkSection, {
      links: bottomLinks
    })]
  });
};

function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var ProfileButton = function ProfileButton(_ref) {
  var _globalProps$user;
  var profileInfoOverrides = _ref.profileInfoOverrides,
    showProductSwitcher = _ref.showProductSwitcher,
    bottomLinks = _ref.bottomLinks,
    topLinks = _ref.topLinks,
    customContent = _ref.customContent,
    isThemeSwitcherEnabled = _ref.isThemeSwitcherEnabled,
    isOrganizationSwitcherEnabled = _ref.isOrganizationSwitcherEnabled,
    profilePopoverProps = _ref.profilePopoverProps,
    isConsumer = _ref.isConsumer;
  var _useState = React.useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    isModalOpen = _useState2[0],
    setIsModalOpen = _useState2[1];
  var _useState3 = React.useState(null),
    _useState4 = _slicedToArray(_useState3, 2),
    changesCount = _useState4[0],
    setChangesCount = _useState4[1];
  var _KeyboardShortcuts$us = KeyboardShortcuts.usePaneState(),
    _KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
    setIsOpen = _KeyboardShortcuts$us2[1];
  var _Profile$usePaneState = Profile.usePaneState(),
    _Profile$usePaneState2 = _slicedToArray(_Profile$usePaneState, 2),
    setIsProfilePaneOpen = _Profile$usePaneState2[1];
  useHotkeys(["ctrl+e", "command+e"], function () {
    return setIsModalOpen(ramda.not);
  }, {
    mode: "global"
  });
  var profileInfo = getProfileInfo(profileInfoOverrides, isConsumer);
  React.useEffect(function () {
    var Nv = {
      onReceiveData: function onReceiveData(data) {
        if (!data.unreadCount) return;
        setChangesCount(data.unreadCount);
      },
      onShow: function onShow() {
        setChangesCount(null);
      }
    };
    window.Nv = window.Nv ? Object.assign(window.Nv, Nv) : Nv;
  }, []);
  var newTopLinks = globalProps.appName.toLowerCase() !== "neetoauth" ? [].concat(_toConsumableArray(getDefaultTopLinks((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.isOwner, setIsProfilePaneOpen, profileInfo.isAuthenticated)), _toConsumableArray(topLinks)) : topLinks;
  var newBottomLinks = [].concat(_toConsumableArray(getDefaultBottomLinks(profileInfo.isAuthenticated, isConsumer)), _toConsumableArray(bottomLinks));
  var helpLinks = Object.keys(DEFAULT_HELP_LINK_PROPS).map(function (key) {
    return _objectSpread$1({}, DEFAULT_HELP_LINK_PROPS[key]);
  }).filter(function (_ref2) {
    var hide = _ref2.hide;
    return !hide;
  });
  var defaultLinks = Object.keys(DEFAULT_MENU_LINK_PROPS).filter(function (key) {
    var _DEFAULT_MENU_LINK_PR, _DEFAULT_MENU_LINK_PR2, _DEFAULT_MENU_LINK_PR3;
    return (_DEFAULT_MENU_LINK_PR = (_DEFAULT_MENU_LINK_PR2 = (_DEFAULT_MENU_LINK_PR3 = DEFAULT_MENU_LINK_PROPS[key]).isVisible) === null || _DEFAULT_MENU_LINK_PR2 === void 0 ? void 0 : _DEFAULT_MENU_LINK_PR2.call(_DEFAULT_MENU_LINK_PR3)) !== null && _DEFAULT_MENU_LINK_PR !== void 0 ? _DEFAULT_MENU_LINK_PR : true;
  }).map(function (key) {
    return _objectSpread$1(_objectSpread$1(_objectSpread$1({}, DEFAULT_MENU_LINK_PROPS[key]), key === "keyboardShortcutProps" && {
      onClick: function onClick() {
        return setIsOpen(function (prev) {
          return !prev;
        });
      }
    }), key === "engageProps" && changesCount && {
      changesCount: changesCount
    });
  }).filter(function (_ref3) {
    var hide = _ref3.hide;
    return !hide;
  });
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
    children: [/*#__PURE__*/jsxRuntime.jsx(Profile.Pane, {
      popoverProps: profilePopoverProps
    }), /*#__PURE__*/jsxRuntime.jsx(Dropdown$1, {
      appendTo: function appendTo() {
        return document.body;
      },
      buttonStyle: "link",
      closeOnSelect: false,
      icon: neetoCist.noop,
      interactiveDebounce: 30,
      offset: [15, 10],
      position: "right-end",
      strategy: "fixed",
      theme: "light",
      trigger: "all",
      zIndex: 99999,
      customTarget: /*#__PURE__*/jsxRuntime.jsxs("button", {
        className: "neeto-molecules-floating-action-button",
        type: "button",
        children: [/*#__PURE__*/jsxRuntime.jsx(Avatar, {
          className: "neeto-ui-flex-shrink-0 neeto-molecules-floating-action-button__profile-avatar",
          "data-cy": "profile-avatar",
          "data-testid": "profile-avatar",
          size: "medium",
          user: profileInfo
        }), /*#__PURE__*/jsxRuntime.jsx("span", {
          className: "neeto-molecules-floating-action-button__help-icon",
          children: /*#__PURE__*/jsxRuntime.jsx(Help, {
            size: 20
          })
        })]
      }),
      dropdownProps: {
        classNames: "neeto-molecules-floating-action-button__dropdown"
      },
      children: /*#__PURE__*/jsxRuntime.jsx(ProfileMenu, {
        customContent: customContent,
        defaultLinks: defaultLinks,
        helpLinks: helpLinks,
        isConsumer: isConsumer,
        isOrganizationSwitcherEnabled: isOrganizationSwitcherEnabled,
        isThemeSwitcherEnabled: isThemeSwitcherEnabled,
        profileInfo: profileInfo,
        showProductSwitcher: showProductSwitcher,
        bottomLinks: newBottomLinks,
        toggleModal: setIsModalOpen,
        topLinks: newTopLinks
      })
    }), neetoCist.isPresent(changesCount) && /*#__PURE__*/jsxRuntime.jsx("span", {
      className: "neeto-molecules-menu__notif-count",
      "data-cy": "help-icon-changes-count",
      "data-testid": "help-icon-changes-count",
      children: changesCount
    }), /*#__PURE__*/jsxRuntime.jsx(Modal, {
      isOpen: isModalOpen,
      onClose: function onClose() {
        return setIsModalOpen(false);
      }
    })]
  });
};

var css = ":root{--neeto-molecules-floating-menu-z-index:99999}.neeto-molecules-floating-action-menu__container{background-color:rgb(var(--neeto-ui-white));border:1px solid rgb(var(--neeto-ui-white));border-end-end-radius:1.0625rem;border-inline-start:none;border-start-end-radius:1.0625rem;bottom:16px;inset-inline-start:0;position:fixed;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button{align-items:center;background-color:rgb(var(--neeto-ui-primary-500));border-color:rgb(var(--neeto-ui-primary-500));border-end-end-radius:1rem;border-start-end-radius:1rem;display:flex;flex-direction:column;gap:.375rem;justify-content:center;padding:.25rem}.neeto-molecules-floating-action-button__help-icon{align-items:center;background-color:#fff;border-radius:6.25rem;display:flex;height:1.625rem;justify-content:center;width:1.625rem}.neeto-molecules-floating-action-button__profile-avatar{--neeto-ui-avatar-container-width:1.625rem;--neeto-ui-avatar-container-height:1.625rem;border:2px solid #fff;border-radius:6.25rem}.neeto-molecules-floating-action-button__profile-avatar>div{height:100%;width:100%}.neeto-molecules-floating-action-button__profile-avatar .neeto-ui-avatar{height:100%!important;width:100%!important}.neeto-molecules-floating-action-button__dropdown{flex-shrink:0;max-height:95vh!important;max-width:none;width:16rem;z-index:99999;z-index:var(--neeto-molecules-floating-menu-z-index)}.neeto-molecules-floating-action-button__dropdown ul{padding-top:0!important}.neeto-molecules-product-switcher-menu-popup__dropdown{max-height:none!important;max-width:none}.neeto-molecules-menu__notif-count{border:1px solid #fff;height:.9375rem;inset-inline-end:0;min-width:.9375rem;pointer-events:none;position:absolute;top:0;z-index:3}.neeto-molecules-menu-list__item-btn-count,.neeto-molecules-menu__notif-count{align-items:center;background-color:rgb(var(--neeto-ui-accent-500));border-radius:var(--neeto-ui-rounded-full);color:rgb(var(--neeto-ui-white));display:flex;flex-shrink:0;font-size:var(--neeto-ui-text-xxs);justify-content:center;padding-inline-end:.25rem;padding-inline-start:.25rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.neeto-molecules-menu-list__item-btn-count{height:1.125rem;min-width:1.125rem}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper{border:1px solid rgb(var(--neeto-ui-gray-400));border-radius:var(--neeto-ui-rounded)!important;min-width:15rem}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper .tippy-content{padding:0}.neeto-ui-dropdown__popup .neeto-molecules-product-switcher-menu-popup-wrapper .tippy-svg-arrow{display:none!important}.neeto-molecules-profile-popup__top-section{border-start-end-radius:var(--neeto-ui-rounded);border-start-start-radius:var(--neeto-ui-rounded)}.neeto-molecules-menu-sublist__item-btn{font-weight:500!important;height:2.5rem}.neeto-molecules-menu-sublist__item-btn[data-btn-weight=bold]{font-weight:700!important}.neeto-molecules-menu-sublist__item-btn.active{background-color:rgb(var(--neeto-ui-gray-800));color:rgb(var(--neeto-ui-white))}.neeto-molecules-menu-sublist__item-btn-icon svg path{vector-effect:non-scaling-stroke}.neeto-molecules-menu-sublist__item-btn span{align-items:center;display:flex;gap:.5rem}.neeto-molecules-product-switcher-menu-popup-wrapper{height:95vh;overflow-y:auto;width:calc(100vw - 25rem)}.neeto-molecules-floating-action-button__profile-wrapper-custom-content:hover{background-color:rgb(var(--neeto-ui-white))!important}.neeto-molecules-theme-switcher-menu-popup-wrapper .neeto-ui-dropdown__popup-menu{padding-top:.25rem!important}.neeto-molecules-organization-switcher-active-button,.neeto-molecules-theme-switcher-active-button{color:rgb(var(--neeto-ui-success-600))!important}";
injectCss.n(css,{});

var _excluded = ["profileInfoOverrides", "topLinks", "bottomLinks", "showProductSwitcher", "isThemeSwitcherEnabled", "isOrganizationSwitcherEnabled", "customContent", "profilePopoverProps", "isConsumer"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var FloatingActionMenu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
  var _globalProps$user;
  var _ref$profileInfoOverr = _ref.profileInfoOverrides,
    profileInfoOverrides = _ref$profileInfoOverr === void 0 ? {} : _ref$profileInfoOverr,
    _ref$topLinks = _ref.topLinks,
    topLinks = _ref$topLinks === void 0 ? [] : _ref$topLinks,
    _ref$bottomLinks = _ref.bottomLinks,
    bottomLinks = _ref$bottomLinks === void 0 ? [] : _ref$bottomLinks,
    _ref$showProductSwitc = _ref.showProductSwitcher,
    showProductSwitcher = _ref$showProductSwitc === void 0 ? true : _ref$showProductSwitc,
    _ref$isThemeSwitcherE = _ref.isThemeSwitcherEnabled,
    isThemeSwitcherEnabled = _ref$isThemeSwitcherE === void 0 ? false : _ref$isThemeSwitcherE,
    _ref$isOrganizationSw = _ref.isOrganizationSwitcherEnabled,
    isOrganizationSwitcherEnabled = _ref$isOrganizationSw === void 0 ? false : _ref$isOrganizationSw,
    customContent = _ref.customContent,
    _ref$profilePopoverPr = _ref.profilePopoverProps,
    profilePopoverProps = _ref$profilePopoverPr === void 0 ? {} : _ref$profilePopoverPr,
    _ref$isConsumer = _ref.isConsumer,
    isConsumer = _ref$isConsumer === void 0 ? false : _ref$isConsumer,
    otherProps = _objectWithoutProperties(_ref, _excluded);
  React.useEffect(function () {
    isThemeSwitcherEnabled && setAppTheme();
  }, []);
  var isBigBinaryEmail = initializers.globalProps === null || initializers.globalProps === void 0 || (_globalProps$user = initializers.globalProps.user) === null || _globalProps$user === void 0 || (_globalProps$user = _globalProps$user.email) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.endsWith("@bigbinary.com");
  return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
    ref: ref,
    className: "neeto-molecules-floating-action-menu__container",
    "data-cy": "floating-action-menu-container",
    "data-testid": "floating-action-menu-container"
  }, otherProps), {}, {
    children: /*#__PURE__*/jsxRuntime.jsx(ProfileButton, _defineProperty({
      bottomLinks: bottomLinks,
      customContent: customContent,
      isConsumer: isConsumer,
      isOrganizationSwitcherEnabled: isOrganizationSwitcherEnabled,
      isThemeSwitcherEnabled: isThemeSwitcherEnabled,
      profileInfoOverrides: profileInfoOverrides,
      profilePopoverProps: profilePopoverProps,
      showProductSwitcher: showProductSwitcher,
      topLinks: topLinks
    }, "isOrganizationSwitcherEnabled", isBigBinaryEmail || isOrganizationSwitcherEnabled))
  }));
});
FloatingActionMenu.displayName = "FloatingActionMenu";

module.exports = FloatingActionMenu;
//# sourceMappingURL=FloatingActionMenu.js.map
