import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
import { memo, useState, useRef, useEffect, useMemo, forwardRef } from 'react';
import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import { Typography, Spinner, Input, Dialog, DropdownMenu, Badge, Avatar } from '@bigbinary/neeto-atoms';
import { Collapsible, CollapsibleTrigger, DropdownMenuItem, CollapsibleContent, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuSeparator, DropdownMenu as DropdownMenu$1, DropdownMenuTrigger, DropdownMenuContent } from '@bigbinary/neeto-atoms/primitives';
import { isNotEmpty, isNotPresent, isPresent, truncate, humanize } from '@bigbinary/neeto-cist';
import useHotkeys from '@bigbinary/neeto-hotkeys';
import { Profile } from '@bigbinary/neeto-team-members-frontend/v2';
import { isEmpty, toLower, mergeDeepLeft, not } from 'ramda';
import KeyboardShortcuts from './KeyboardShortcuts.js';
import SubscriptionUpgradeRequestModal from '../SubscriptionUpgradeRequestModal.js';
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
import classnames from 'classnames';
import { useTranslation } from 'react-i18next';
import Neeto from '@bigbinary/neeto-icons/typeface-logos/Neeto';
import * as AppIcons from '@bigbinary/neeto-icons/typeface-logos';
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
import { useQuery } from '@tanstack/react-query';
import axios from 'axios';
import { S as Search } from '../search-DCgpNjip.js';
import useBreakpoints from '@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints';
import { t } from 'i18next';
import { c as createLucideIcon } from '../createLucideIcon-mNMhCCpf.js';
import { C as CircleQuestionMark } from '../circle-question-mark-Dib48f5Z.js';
import { C as ChevronRight } from '../chevron-right-DcaO-Hlu.js';
import { U as User } from '../user-A843PT-q.js';
import useLocalStorage from '@bigbinary/neeto-commons-frontend/react-utils/useLocalStorage';
import { getFromLocalStorage } from '@bigbinary/neeto-commons-frontend/utils';
import { resetAuthTokens } from '@bigbinary/neeto-commons-frontend/utils/axios';
import { removeFromLocalStorage } from '@bigbinary/neeto-commons-frontend/utils/general';
import CopyToClipboardButton from './CopyToClipboardButton.js';
import '../useKeyboardShortcutsPaneState-dNIbb_PI.js';
import 'zustand/shallow';
import '@bigbinary/neeto-commons-frontend/react-utils/withImmutableActions';
import 'zustand';
import '@bigbinary/neetoui/managers';
import '../ua-parser-OzUiuIwt.js';
import '../x-B1Er0oV4.js';
import '@bigbinary/neetoui/Button';
import '@bigbinary/neetoui/Modal';
import '@bigbinary/neetoui/Typography';

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$9 = [
  [
    "path",
    {
      d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
      key: "169zse"
    }
  ]
];
const Activity = createLucideIcon("activity", __iconNode$9);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$8 = [
  ["path", { d: "M12 7v14", key: "1akyts" }],
  [
    "path",
    {
      d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",
      key: "ruj8y"
    }
  ]
];
const BookOpen = createLucideIcon("book-open", __iconNode$8);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$7 = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
];
const CircleCheck = createLucideIcon("circle-check", __iconNode$7);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$6 = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
];
const CircleX = createLucideIcon("circle-x", __iconNode$6);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$5 = [
  [
    "path",
    {
      d: "M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",
      key: "1vdc57"
    }
  ],
  ["path", { d: "M5 21h14", key: "11awu3" }]
];
const Crown = createLucideIcon("crown", __iconNode$5);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$4 = [
  ["path", { d: "m16 17 5-5-5-5", key: "1bji2h" }],
  ["path", { d: "M21 12H9", key: "dn1m92" }],
  ["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }]
];
const LogOut = createLucideIcon("log-out", __iconNode$4);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$3 = [
  [
    "path",
    {
      d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",
      key: "1sd12s"
    }
  ],
  ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
  ["path", { d: "M12 17h.01", key: "p32p05" }]
];
const MessageCircleQuestionMark = createLucideIcon("message-circle-question-mark", __iconNode$3);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$2 = [
  [
    "path",
    {
      d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
      key: "kfwtm"
    }
  ]
];
const Moon = createLucideIcon("moon", __iconNode$2);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode$1 = [
  ["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
  ["path", { d: "M12 2v2", key: "tus03m" }],
  ["path", { d: "M12 20v2", key: "1lh1kg" }],
  ["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
  ["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
  ["path", { d: "M2 12h2", key: "1t8f8n" }],
  ["path", { d: "M20 12h2", key: "1q8mjw" }],
  ["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
  ["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
];
const Sun = createLucideIcon("sun", __iconNode$1);

/**
 * @license lucide-react v1.7.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode = [
  ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
  ["path", { d: "M16 3.128a4 4 0 0 1 0 7.744", key: "16gr8j" }],
  ["path", { d: "M22 21v-2a4 4 0 0 0-3-3.87", key: "kshegd" }],
  ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }]
];
const Users = createLucideIcon("users", __iconNode);

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

var _excluded$3 = ["name", "description", "url", "isHighlighted"];
function ownKeys$7(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$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var ProductLink = function ProductLink(_ref) {
  var _globalProps, _globalProps2;
  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$3);
  var normalizedName = (name || "").toLowerCase();
  var specialCase = SPECIAL_APP_NAMES[normalizedName];
  var safeName = name || "";
  var appName = "Neeto".concat(safeName.charAt(0)).concat(safeName.slice(1).toLowerCase());
  var AppIcon = specialCase ? AppIcons["Neeto".concat(specialCase)] : AppIcons[appName];
  return /*#__PURE__*/jsxs("a", _objectSpread$7(_objectSpread$7({
    "data-testid": "".concat(normalizedName, "-app-link"),
    href: url,
    rel: "noreferrer",
    target: "_blank",
    className: classnames("bg-background focus-visible:bg-accent flex w-full max-w-full cursor-pointer flex-col gap-4 rounded-lg border p-2.5 no-underline transition-all outline-none max-md:gap-2 max-md:p-2", {
      "border-primary bg-primary/5": (_globalProps = globalProps) === null || _globalProps === void 0 || (_globalProps = _globalProps.appName) === null || _globalProps === void 0 ? void 0 : _globalProps.includes(name),
      "nv-product-link-highlighted bg-accent": isHighlighted,
      "border-border hover:border-primary": !((_globalProps2 = globalProps) !== null && _globalProps2 !== void 0 && (_globalProps2 = _globalProps2.appName) !== null && _globalProps2 !== void 0 && _globalProps2.includes(name))
    })
  }, props), {}, {
    children: [/*#__PURE__*/jsx("div", {
      className: "shrink-0 grow [&>svg]:h-9 [&>svg]:w-auto max-md:[&>svg]:h-6",
      children: AppIcon ? /*#__PURE__*/jsx(AppIcon, {}) : /*#__PURE__*/jsx(Neeto, {
        className: "h-6 w-auto max-md:h-5"
      })
    }), /*#__PURE__*/jsx("div", {
      className: "shrink-0",
      children: /*#__PURE__*/jsx(Typography, {
        color: "muted",
        variant: "caption",
        children: description
      })
    })]
  }));
};
var ProductLink$1 = /*#__PURE__*/memo(ProductLink);

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 Content = function Content(_ref) {
  var highlightedIndex = _ref.highlightedIndex,
    filteredApps = _ref.filteredApps,
    isLoading = _ref.isLoading;
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  if (isLoading) {
    return /*#__PURE__*/jsx("div", {
      className: "flex h-full items-center justify-center",
      children: /*#__PURE__*/jsx(Spinner, {
        "data-testid": "neeto-ui-spinner"
      })
    });
  }
  return (filteredApps === null || filteredApps === void 0 ? void 0 : filteredApps.length) > 0 ? /*#__PURE__*/jsx("div", {
    className: "grid grid-cols-[repeat(auto-fill,minmax(288px,1fr))] gap-3 max-lg:grid-cols-[repeat(auto-fill,minmax(248px,1fr))] max-sm:grid-cols-1",
    children: filteredApps.map(function (app, index) {
      return /*#__PURE__*/jsx(ProductLink$1, _objectSpread$6(_objectSpread$6({}, app), {}, {
        "data-highlighted-index": index,
        isHighlighted: index === highlightedIndex
      }), app.name);
    })
  }) : /*#__PURE__*/jsx("div", {
    className: "flex h-full items-center justify-center",
    "data-testid": "no-apps-found-title",
    children: /*#__PURE__*/jsx(Typography, {
      color: "muted",
      variant: "body2",
      children: t("neetoMolecules.productSwitcher.noApps")
    })
  });
};

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

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 useFetchNeetoApps = function useFetchNeetoApps(options) {
  return useQuery(_objectSpread$5({
    queryKey: [QUERY_KEYS$1.NEETO_APPS_LIST],
    queryFn: neetoAppsApi.fetch,
    staleTime: 5 * 60 * 1000
  }, options));
};

var useProductSwitcherNavigation = function useProductSwitcherNavigation() {
  var filteredApps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var _useState = useState(0),
    _useState2 = _slicedToArray(_useState, 2),
    highlightedIndex = _useState2[0],
    setHighlightedIndex = _useState2[1];
  var scrollContainerRef = useRef(null);
  useEffect(function () {
    return setHighlightedIndex(0);
  }, [filteredApps]);
  useEffect(function () {
    if (!scrollContainerRef.current || 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 (isNotEmpty(filteredApps)) action(e);
  };
  return {
    highlightedIndex: highlightedIndex,
    handleKeyDown: handleKeyDown,
    scrollContainerRef: scrollContainerRef
  };
};

var Menu = function Menu(_ref) {
  var _ref$isMobile = _ref.isMobile,
    isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var _useState = 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 = useMemo(function () {
    var _data$neetoApps;
    if (!data) return [];
    return data === null || data === void 0 || (_data$neetoApps = data.neetoApps) === null || _data$neetoApps === 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__*/jsxs("div", {
    className: "flex h-full w-full max-w-full flex-col items-start p-6 transition-all max-md:p-1",
    "data-testid": "switcher-wrapper",
    children: [/*#__PURE__*/jsxs("div", {
      "data-testid": "product-switcher-body-wrapper",
      className: classnames("mb-6 flex w-full shrink-0 items-center justify-between gap-8 pt-1 max-md:flex-col max-md:items-start max-md:gap-3", {
        "max-md:mb-4": isMobile
      }),
      children: [!isMobile && /*#__PURE__*/jsx("h1", {
        className: "text-2xl font-bold max-sm:text-xl",
        children: t("neetoMolecules.productSwitcher.chooseNeetoProduct")
      }), /*#__PURE__*/jsx("div", {
        className: "flex-grow lg:w-[296px] lg:flex-grow-0",
        children: /*#__PURE__*/jsxs("div", {
          className: "relative",
          children: [/*#__PURE__*/jsx(Search, {
            className: "text-muted-foreground absolute start-3 top-1/2 size-4 -translate-y-1/2"
          }), /*#__PURE__*/jsx(Input, {
            autoFocus: true,
            className: "h-10 ps-9",
            "data-testid": "product-switcher-search-input",
            placeholder: t("neetoMolecules.productSwitcher.searchProducts"),
            type: "search",
            value: searchTerm,
            onChange: function onChange(e) {
              return setSearchTerm(e.target.value);
            },
            onKeyDown: handleKeyDown
          })]
        })
      })]
    }), /*#__PURE__*/jsx("div", {
      className: "flex min-h-0 w-full flex-1 flex-col gap-3 overflow-y-auto text-sm",
      ref: scrollContainerRef,
      children: /*#__PURE__*/jsx(Content, {
        filteredApps: filteredApps,
        highlightedIndex: highlightedIndex,
        isLoading: isLoading
      })
    })]
  }, "switcher-wrapper");
};

var Modal = withT(function (_ref) {
  var t = _ref.t,
    isOpen = _ref.isOpen,
    onClose = _ref.onClose;
  return /*#__PURE__*/jsxs(Dialog, {
    isOpen: isOpen,
    onClose: onClose,
    "aria-describedby": undefined,
    className: "grid-rows-[1fr] sm:max-w-4xl",
    size: "fullScreen",
    children: [/*#__PURE__*/jsx(Dialog.Title, {
      className: "sr-only",
      children: t("neetoMolecules.productSwitcher.title")
    }), /*#__PURE__*/jsx(Dialog.Body, {
      className: "min-h-0 overflow-y-auto",
      children: /*#__PURE__*/jsx("div", {
        "data-testid": "product-switcher-modal",
        children: /*#__PURE__*/jsx(Menu, {})
      })
    })]
  });
});

var MY_ORGANIZATION_URL = "/auth/organization/edit";
var DELETE_WORKSPACE_URL = "/auth/organization/delete";
var ENGAGE_WIDGET_TRIGGER_ID = "neetoengage-trigger";
var DEFAULT_MENU_LINK_PROPS = {
  engageProps: {
    id: ENGAGE_WIDGET_TRIGGER_ID,
    label: t("neetoMolecules.sidebar.helpLinks.whatsNew"),
    "data-testid": "help-link-engage-button"
  },
  keyboardShortcutProps: {
    label: t("neetoMolecules.sidebar.helpLinks.keyboardShortcuts"),
    "data-testid": "help-link-keyboard-shortcut-button"
  }
};

// Theme switcher
var APP_THEME_LOCALSTORAGE_KEY = "appTheme";
var THEMES = {
  LIGHT: "light",
  DARK: "dark"
};

// Legacy neetoUI theme classes — kept until full migration is complete.
var LEGACY_THEMES = {
  LIGHT: "neeto-ui-theme--light",
  DARK: "neeto-ui-theme--dark"
};
var NEETO_AUTH_BILLING_INFO_URL = "/neeto_sso/api/v1/subscription/billing";
var MENU_ITEM_CLASSES = "gap-2.5 px-2.5 py-2 font-medium [&>[data-slot=menu-item-prefix]>svg]:!size-[18px] [&>[data-slot=menu-item-suffix]>svg]:!size-[18px]";
var THEME_BUTTON_BASE = "relative z-10 flex items-center justify-center gap-1 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none";
var THEME_ICON_BASE = "transition-transform duration-300 ease-out";

var _excluded$2 = ["className"];
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 MenuItem = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
  var className = _ref.className,
    props = _objectWithoutProperties(_ref, _excluded$2);
  return /*#__PURE__*/jsx(DropdownMenu.MenuItem, _objectSpread$4({
    className: classnames(MENU_ITEM_CLASSES, className),
    ref: forwardedRef
  }, props));
});
MenuItem.displayName = "FloatingActionMenu.MenuItem";

var HelpItems = withT(function (_ref) {
  var _globalProps;
  var t = _ref.t;
  return /*#__PURE__*/jsxs(Fragment, {
    children: [/*#__PURE__*/jsx(MenuItem, {
      "data-testid": "help-link-help-articles-button",
      href: "https://help.".concat(toLower(((_globalProps = globalProps) === null || _globalProps === void 0 ? void 0 : _globalProps.appName) || ""), ".com/"),
      prefix: /*#__PURE__*/jsx(BookOpen, {
        size: 18
      }),
      rel: "noreferrer",
      target: "_blank",
      children: t("neetoMolecules.sidebar.helpLinks.helpArticles")
    }), /*#__PURE__*/jsx(MenuItem, {
      "data-testid": "help-link-live-chat-button",
      prefix: /*#__PURE__*/jsx(MessageCircleQuestionMark, {
        size: 18
      }),
      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();
      },
      children: t("neetoMolecules.sidebar.helpLinks.liveChat")
    }), /*#__PURE__*/jsx(MenuItem, {
      "data-testid": "help-link-community-button",
      href: "https://www.launchpass.com/neetohq",
      prefix: /*#__PURE__*/jsx(Users, {
        size: 18
      }),
      rel: "noreferrer",
      target: "_blank",
      children: t("neetoMolecules.sidebar.helpLinks.askTheCommunity")
    }), /*#__PURE__*/jsx(MenuItem, {
      "data-testid": "help-link-status-button",
      href: "https://neetostatus.com/",
      prefix: /*#__PURE__*/jsx(Activity, {
        size: 18
      }),
      rel: "noreferrer",
      target: "_blank",
      children: t("neetoMolecules.sidebar.helpLinks.systemStatus")
    })]
  });
});

var MobileHelpMenu = function MobileHelpMenu() {
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    open = _useState2[0],
    setOpen = _useState2[1];
  return /*#__PURE__*/jsxs(Collapsible, {
    open: open,
    onOpenChange: setOpen,
    children: [/*#__PURE__*/jsx(CollapsibleTrigger, {
      asChild: true,
      children: /*#__PURE__*/jsxs(DropdownMenuItem, {
        className: classnames("group", MENU_ITEM_CLASSES),
        "data-testid": "help-menu-button",
        onSelect: function onSelect(e) {
          return e.preventDefault();
        },
        children: [/*#__PURE__*/jsx(CircleQuestionMark, {
          className: "size-[18px] shrink-0"
        }), /*#__PURE__*/jsx("span", {
          className: "flex-1 truncate",
          children: t("neetoMolecules.sidebar.help")
        }), /*#__PURE__*/jsx(ChevronRight, {
          className: "ms-auto shrink-0 transition-transform group-data-[state=open]:rotate-90 rtl:scale-x-[-1]",
          size: 18
        })]
      })
    }), /*#__PURE__*/jsx(CollapsibleContent, {
      className: "flex flex-col gap-0.5 ps-6 pt-1",
      children: /*#__PURE__*/jsx(HelpItems, {})
    })]
  });
};

var HelpMenu = function HelpMenu() {
  var _useBreakpoints = useBreakpoints(),
    isSize = _useBreakpoints.isSize;
  var isMobile = isSize("mobile");
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  if (isMobile) return /*#__PURE__*/jsx(MobileHelpMenu, {});
  return /*#__PURE__*/jsxs(DropdownMenuSub, {
    children: [/*#__PURE__*/jsxs(DropdownMenuSubTrigger, {
      className: MENU_ITEM_CLASSES,
      "data-testid": "help-menu-button",
      children: [/*#__PURE__*/jsx(CircleQuestionMark, {
        className: "size-[18px]"
      }), /*#__PURE__*/jsx("span", {
        className: "flex-1",
        children: t("neetoMolecules.sidebar.help")
      })]
    }), /*#__PURE__*/jsx(DropdownMenuSubContent, {
      className: "z-[99999]",
      collisionPadding: 16,
      sideOffset: 8,
      children: /*#__PURE__*/jsx(HelpItems, {})
    })]
  });
};

var _excluded$1 = ["label", "icon", "changesCount", "href"];
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;
  if (isNotPresent(links)) return null;
  return /*#__PURE__*/jsx(Fragment, {
    children: links.map(function (_ref2, idx) {
      var label = _ref2.label,
        Icon = _ref2.icon,
        changesCount = _ref2.changesCount,
        href = _ref2.href,
        otherProps = _objectWithoutProperties(_ref2, _excluded$1);
      return /*#__PURE__*/jsx(MenuItem, _objectSpread$3(_objectSpread$3(_objectSpread$3({
        "data-testid": "floating-action-menu-link-section",
        prefix: Icon && /*#__PURE__*/jsx(Icon, {
          size: 18
        }),
        suffix: isPresent(changesCount) && /*#__PURE__*/jsx("span", {
          className: "bg-foreground text-background flex h-[1.125rem] min-w-[1.125rem] items-center justify-center rounded-full px-1 text-[10px] select-none [--accent-foreground:var(--background)]",
          "data-testid": "help-section-menu-changes-count",
          children: changesCount
        })
      }, href ? {
        href: href
      } : {}), otherProps), {}, {
        children: label
      }), 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 useQuery({
    queryKey: [LOGGED_IN_ORGANIZATIONS_LIST, email],
    queryFn: function queryFn() {
      return loggedInOrganizationsApi.fetch(email);
    }
  });
};

var isCurrentSubdomain = function isCurrentSubdomain(link) {
  try {
    var currentSubdomain = window.location.hostname.split(".")[0];
    var linkSubdomain = new URL(link).hostname.split(".")[0];
    return currentSubdomain === linkSubdomain;
  } catch (_unused) {
    return false;
  }
};

var OrganizationItems = withT(function (_ref) {
  var t = _ref.t,
    organizations = _ref.organizations,
    authAppUrl = _ref.authAppUrl;
  return /*#__PURE__*/jsxs(Fragment, {
    children: [organizations === null || organizations === void 0 ? void 0 : organizations.map(function (organization) {
      var isCurrent = isCurrentSubdomain(organization.organizationUrl);
      return /*#__PURE__*/jsx(MenuItem, {
        className: classnames({
          "text-green-600": isCurrent
        }),
        href: organization.organizationUrl,
        rel: "noreferrer",
        target: "_blank",
        suffix: isCurrent && /*#__PURE__*/jsxs(Badge, {
          variant: "default",
          children: [/*#__PURE__*/jsx(CircleCheck, {
            size: 12
          }), t("neetoMolecules.sidebar.organizationSwitcher.signedin")]
        }),
        children: organization.orgName
      }, organization.userId);
    }), /*#__PURE__*/jsx(MenuItem, {
      href: authAppUrl,
      rel: "noreferrer",
      target: "_blank",
      children: t("neetoMolecules.sidebar.organizationSwitcher.addAccount")
    })]
  });
});

var MobileOrganizationSwitcher = function MobileOrganizationSwitcher(_ref) {
  var organizations = _ref.organizations,
    authAppUrl = _ref.authAppUrl;
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    open = _useState2[0],
    setOpen = _useState2[1];
  return /*#__PURE__*/jsxs(Collapsible, {
    open: open,
    onOpenChange: setOpen,
    children: [/*#__PURE__*/jsx(CollapsibleTrigger, {
      asChild: true,
      children: /*#__PURE__*/jsxs(DropdownMenuItem, {
        className: classnames("group", MENU_ITEM_CLASSES),
        "data-testid": "organization-switcher-button",
        onSelect: function onSelect(e) {
          return e.preventDefault();
        },
        children: [/*#__PURE__*/jsx("span", {
          className: "flex-1 truncate",
          children: t("neetoMolecules.sidebar.organizationSwitcher.label")
        }), /*#__PURE__*/jsx(ChevronRight, {
          className: "ms-auto shrink-0 transition-transform group-data-[state=open]:rotate-90 rtl:scale-x-[-1]",
          size: 18
        })]
      })
    }), /*#__PURE__*/jsx(CollapsibleContent, {
      className: "flex flex-col gap-0.5 ps-6 pt-1",
      children: /*#__PURE__*/jsx(OrganizationItems, {
        authAppUrl: authAppUrl,
        organizations: organizations
      })
    })]
  });
};

var OrganizationSwitcher = function OrganizationSwitcher() {
  var _globalProps$user;
  var _useBreakpoints = useBreakpoints(),
    isSize = _useBreakpoints.isSize;
  var isMobile = isSize("mobile");
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var _useFetchLoggedInOrga = useFetchLoggedInOrganizations(globalProps$1 === null || globalProps$1 === void 0 || (_globalProps$user = globalProps$1.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;
  if (isMobile) {
    return /*#__PURE__*/jsx(MobileOrganizationSwitcher, {
      authAppUrl: authAppUrl,
      organizations: organizations
    });
  }
  return /*#__PURE__*/jsxs(DropdownMenuSub, {
    children: [/*#__PURE__*/jsx(DropdownMenuSubTrigger, {
      className: MENU_ITEM_CLASSES,
      "data-testid": "organization-switcher-button",
      children: /*#__PURE__*/jsx("span", {
        className: "flex-1",
        children: t("neetoMolecules.sidebar.organizationSwitcher.label")
      })
    }), /*#__PURE__*/jsx(DropdownMenuSubContent, {
      className: "z-[99999]",
      collisionPadding: 16,
      sideOffset: 8,
      children: /*#__PURE__*/jsx(OrganizationItems, {
        authAppUrl: authAppUrl,
        organizations: organizations
      })
    })]
  });
};

var Dropdown = withT(function (_ref) {
  var t = _ref.t;
  return /*#__PURE__*/jsxs(DropdownMenuSub, {
    children: [/*#__PURE__*/jsx(DropdownMenuSubTrigger, {
      className: MENU_ITEM_CLASSES,
      "data-testid": "product-switcher-button",
      children: t("neetoMolecules.sidebar.productSwitcher")
    }), /*#__PURE__*/jsx(DropdownMenuSubContent, {
      className: "z-[99999] flex h-[max(36rem,min(80vh,48rem))] w-[calc(100vw-25rem)] max-w-7xl flex-col overflow-hidden rounded-xl p-0",
      collisionPadding: 16,
      sideOffset: 8,
      children: /*#__PURE__*/jsx(Menu, {})
    })]
  });
});

var ProductSwitcher = function ProductSwitcher(_ref) {
  var toggleModal = _ref.toggleModal;
  var _useBreakpoints = useBreakpoints(),
    isSize = _useBreakpoints.isSize;
  var isMobile = isSize("mobile");
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  if (isMobile) {
    return /*#__PURE__*/jsx(MenuItem, {
      "data-testid": "product-switcher-button",
      suffix: /*#__PURE__*/jsx(ChevronRight, {
        className: "rtl:scale-x-[-1]",
        size: 18
      }),
      onClick: function onClick() {
        return toggleModal(true);
      },
      children: t("neetoMolecules.sidebar.productSwitcher")
    });
  }
  return /*#__PURE__*/jsx(Dropdown, {});
};

var ProfileItems = withT(function (_ref) {
  var _window$globalProps;
  var t = _ref.t,
    onProfileClick = _ref.onProfileClick;
  return /*#__PURE__*/jsxs(Fragment, {
    children: [/*#__PURE__*/jsx(MenuItem, {
      "data-testid": "profile-my-profile-button",
      prefix: /*#__PURE__*/jsx(User, {
        size: 18
      }),
      onClick: onProfileClick,
      children: t("neetoMolecules.sidebar.myProfile")
    }), ((_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 || (_window$globalProps = _window$globalProps.user) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.isOwner) && /*#__PURE__*/jsx(MenuItem, {
      "data-testid": "profile-cancel-account-button",
      href: DELETE_WORKSPACE_URL,
      prefix: /*#__PURE__*/jsx(CircleX, {
        size: 18
      }),
      rel: "noreferrer",
      target: "_blank",
      children: t("neetoMolecules.sidebar.cancelAccount")
    })]
  });
});

var ProfileHeader = function ProfileHeader(_ref) {
  var profileInfo = _ref.profileInfo;
  var name = profileInfo.name,
    email = profileInfo.email,
    imageUrl = profileInfo.imageUrl;
  return /*#__PURE__*/jsxs("span", {
    className: "flex w-full min-w-0 items-center gap-2 text-start",
    "data-testid": "floating-action-menu-profile-header",
    children: [/*#__PURE__*/jsx(Avatar, {
      className: "size-8 shrink-0",
      "data-testid": "floating-action-menu-header-profile-icon",
      user: {
        name: name,
        imageUrl: imageUrl
      }
    }), /*#__PURE__*/jsxs("span", {
      className: "flex min-w-0 flex-grow flex-col gap-1",
      children: [/*#__PURE__*/jsx("span", {
        className: "text-sm leading-tight font-semibold",
        "data-testid": "floating-action-menu-header-user-name",
        title: name,
        children: truncate(name, 18)
      }), email && /*#__PURE__*/jsx(Typography, {
        asChild: true,
        className: "w-full truncate leading-tight",
        color: "muted",
        variant: "caption",
        children: /*#__PURE__*/jsx("span", {
          "data-testid": "floating-action-menu-header-user-email",
          children: email
        })
      })]
    })]
  });
};

var MobileProfileExpandMenu = function MobileProfileExpandMenu(_ref) {
  var profileInfo = _ref.profileInfo,
    onProfileClick = _ref.onProfileClick;
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    open = _useState2[0],
    setOpen = _useState2[1];
  return /*#__PURE__*/jsxs(Collapsible, {
    open: open,
    onOpenChange: setOpen,
    children: [/*#__PURE__*/jsx(CollapsibleTrigger, {
      asChild: true,
      children: /*#__PURE__*/jsxs(DropdownMenuItem, {
        className: classnames("group", MENU_ITEM_CLASSES),
        "data-testid": "profile-expand-menu-button",
        onSelect: function onSelect(e) {
          return e.preventDefault();
        },
        children: [/*#__PURE__*/jsx(ProfileHeader, {
          profileInfo: profileInfo
        }), /*#__PURE__*/jsx(ChevronRight, {
          className: "ms-auto shrink-0 transition-transform group-data-[state=open]:rotate-90 rtl:scale-x-[-1]",
          size: 18
        })]
      })
    }), /*#__PURE__*/jsx(CollapsibleContent, {
      className: "flex flex-col gap-0.5 ps-6 pt-1",
      children: /*#__PURE__*/jsx(ProfileItems, {
        onProfileClick: onProfileClick
      })
    })]
  });
};

var ProfileExpandMenu = function ProfileExpandMenu(_ref) {
  var profileInfo = _ref.profileInfo;
  var _Profile$usePaneState = Profile.usePaneState(),
    _Profile$usePaneState2 = _slicedToArray(_Profile$usePaneState, 2),
    setIsProfilePaneOpen = _Profile$usePaneState2[1];
  var _useBreakpoints = useBreakpoints(),
    isSize = _useBreakpoints.isSize;
  var isMobile = isSize("mobile");
  var onProfileClick = function onProfileClick() {
    return setIsProfilePaneOpen(true);
  };
  if (isMobile) {
    return /*#__PURE__*/jsx(MobileProfileExpandMenu, {
      onProfileClick: onProfileClick,
      profileInfo: profileInfo
    });
  }
  return /*#__PURE__*/jsxs(DropdownMenuSub, {
    children: [/*#__PURE__*/jsx(DropdownMenuSubTrigger, {
      className: classnames("group items-center", MENU_ITEM_CLASSES),
      "data-testid": "profile-expand-menu-button",
      children: /*#__PURE__*/jsx(ProfileHeader, {
        profileInfo: profileInfo
      })
    }), /*#__PURE__*/jsx(DropdownMenuSubContent, {
      className: "z-[99999]",
      collisionPadding: 16,
      sideOffset: 8,
      children: /*#__PURE__*/jsx(ProfileItems, {
        onProfileClick: onProfileClick
      })
    })]
  });
};

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 getDefaultBottomLinks = function getDefaultBottomLinks(isAuthenticated, isConsumer) {
  return [isAuthenticated ? {
    label: t("neetoMolecules.sidebar.logout"),
    icon: LogOut,
    onClick: function onClick() {
      resetAuthTokens();
      removeFromLocalStorage(getSidebarStateLocalStorageKey());
      isConsumer ? window.location.href = "/consumers/logout?redirect_uri=".concat(window.location.href) : window.location.href = "/logout";
    },
    "data-testid": "profile-logout-button"
  } : {
    label: t("neetoMolecules.sidebar.login"),
    onClick: function onClick() {
      window.location.href = "/login";
    },
    "data-testid": "profile-login-button"
  }];
};
var getProfileInfo = function getProfileInfo(profileInfoOverrides, isConsumer) {
  return mergeDeepLeft(profileInfoOverrides, isConsumer ? getConsumerProfileInfo() : getUserProfileInfo());
};

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

var ThemeSwitcher = function ThemeSwitcher() {
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var _useLocalStorage = useLocalStorage(APP_THEME_LOCALSTORAGE_KEY, THEMES.LIGHT),
    _useLocalStorage2 = _slicedToArray(_useLocalStorage, 2),
    appTheme = _useLocalStorage2[0],
    setAppTheme = _useLocalStorage2[1];
  var isDarkThemeSelected = appTheme === THEMES.DARK || appTheme === LEGACY_THEMES.DARK;
  var switchTheme = function switchTheme(theme) {
    theme === THEMES.LIGHT ? setLightTheme() : setDarkTheme();
    setAppTheme(theme);
  };
  return /*#__PURE__*/jsxs("div", {
    className: "bg-muted/40 flex items-center justify-between gap-3 rounded-b-xl px-4 py-3",
    children: [/*#__PURE__*/jsx(Typography, {
      color: "muted",
      variant: "caption",
      weight: "medium",
      children: t("neetoMolecules.sidebar.themeSwitcher.label")
    }), /*#__PURE__*/jsxs("div", {
      "aria-label": t("neetoMolecules.sidebar.themeSwitcher.label"),
      className: "bg-muted relative grid grid-cols-2 rounded-lg p-0.5",
      "data-testid": "theme-switcher-button",
      role: "group",
      children: [/*#__PURE__*/jsx("span", {
        "aria-hidden": true,
        className: "bg-background ring-border absolute inset-y-0.5 left-0.5 w-[calc(50%-2px)] rounded-md shadow-md ring-1 transition-transform duration-300 ease-out ring-inset",
        style: {
          transform: "translateX(".concat(isDarkThemeSelected ? "100%" : "0", ")")
        }
      }), /*#__PURE__*/jsx(DropdownMenuItem, {
        asChild: true,
        onSelect: function onSelect(e) {
          e.preventDefault();
          switchTheme(THEMES.LIGHT);
        },
        children: /*#__PURE__*/jsxs("button", {
          "aria-checked": !isDarkThemeSelected,
          "data-testid": "theme-switcher-light-button",
          role: "menuitemradio",
          type: "button",
          className: classnames(THEME_BUTTON_BASE, isDarkThemeSelected ? "text-muted-foreground hover:text-foreground" : "text-foreground"),
          children: [/*#__PURE__*/jsx(Sun, {
            size: 13,
            className: classnames(THEME_ICON_BASE, isDarkThemeSelected ? "scale-90 -rotate-45" : "rotate-0")
          }), t("neetoMolecules.sidebar.themeSwitcher.light")]
        })
      }), /*#__PURE__*/jsx(DropdownMenuItem, {
        asChild: true,
        onSelect: function onSelect(e) {
          e.preventDefault();
          switchTheme(THEMES.DARK);
        },
        children: /*#__PURE__*/jsxs("button", {
          "aria-checked": isDarkThemeSelected,
          "data-testid": "theme-switcher-dark-button",
          role: "menuitemradio",
          type: "button",
          className: classnames(THEME_BUTTON_BASE, isDarkThemeSelected ? "text-foreground" : "text-muted-foreground hover:text-foreground"),
          children: [/*#__PURE__*/jsx(Moon, {
            size: 13,
            className: classnames(THEME_ICON_BASE, isDarkThemeSelected ? "rotate-0" : "scale-90 rotate-45")
          }), t("neetoMolecules.sidebar.themeSwitcher.dark")]
        })
      })]
    })]
  });
};

var TriggerContent = withT(function (_ref) {
  var _globalProps$organiza;
  var t = _ref.t;
  return /*#__PURE__*/jsxs("span", {
    className: "flex flex-grow flex-col gap-1.5",
    children: [/*#__PURE__*/jsx(Typography, {
      asChild: true,
      variant: "body3",
      weight: "medium",
      children: /*#__PURE__*/jsx("span", {
        children: t("neetoMolecules.sidebar.workspace")
      })
    }), ((_globalProps$organiza = globalProps$1.organization) === null || _globalProps$organiza === void 0 ? void 0 : _globalProps$organiza.name) && /*#__PURE__*/jsx(Typography, {
      asChild: true,
      color: "muted",
      variant: "caption",
      children: /*#__PURE__*/jsx("span", {
        children: globalProps$1.organization.name
      })
    })]
  });
});

var WorkspaceItems = withT(function (_ref) {
  var _globalProps$organiza;
  var t = _ref.t;
  return /*#__PURE__*/jsxs(Fragment, {
    children: [/*#__PURE__*/jsx(MenuItem, {
      "data-testid": "profile-organization-settings-button",
      href: MY_ORGANIZATION_URL,
      rel: "noreferrer",
      target: "_blank",
      children: t("neetoMolecules.sidebar.workspaceMenu.settings")
    }), ((_globalProps$organiza = globalProps$1.organization) === null || _globalProps$organiza === void 0 ? void 0 : _globalProps$organiza.subdomain) && /*#__PURE__*/jsx("div", {
      className: "px-2.5 py-2",
      children: /*#__PURE__*/jsxs("span", {
        className: "flex flex-col gap-0.5 text-start",
        children: [/*#__PURE__*/jsx(Typography, {
          asChild: true,
          variant: "body3",
          weight: "medium",
          children: /*#__PURE__*/jsx("span", {
            children: t("neetoMolecules.sidebar.workspaceMenu.subdomain")
          })
        }), /*#__PURE__*/jsxs("span", {
          className: "flex items-center gap-1",
          children: [/*#__PURE__*/jsx(Typography, {
            asChild: true,
            color: "muted",
            variant: "caption",
            children: /*#__PURE__*/jsx("span", {
              className: "min-w-0 truncate",
              children: globalProps$1.organization.subdomain
            })
          }), /*#__PURE__*/jsx(CopyToClipboardButton, {
            className: "flex-shrink-0",
            value: globalProps$1.organization.subdomain,
            variant: "ghost"
          })]
        })]
      })
    })]
  });
});

var MobileWorkspaceMenu = function MobileWorkspaceMenu() {
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    open = _useState2[0],
    setOpen = _useState2[1];
  return /*#__PURE__*/jsxs(Collapsible, {
    open: open,
    onOpenChange: setOpen,
    children: [/*#__PURE__*/jsx(CollapsibleTrigger, {
      asChild: true,
      children: /*#__PURE__*/jsxs(DropdownMenuItem, {
        className: classnames("group items-center", MENU_ITEM_CLASSES),
        "data-testid": "workspace-display",
        onSelect: function onSelect(e) {
          return e.preventDefault();
        },
        children: [/*#__PURE__*/jsx(TriggerContent, {}), /*#__PURE__*/jsx(ChevronRight, {
          className: "ms-auto shrink-0 transition-transform group-data-[state=open]:rotate-90 rtl:scale-x-[-1]",
          size: 18
        })]
      })
    }), /*#__PURE__*/jsx(CollapsibleContent, {
      className: "flex flex-col gap-0.5 ps-6 pt-1",
      children: /*#__PURE__*/jsx(WorkspaceItems, {})
    })]
  });
};

var WorkspaceMenu = function WorkspaceMenu() {
  var _useBreakpoints = useBreakpoints(),
    isSize = _useBreakpoints.isSize;
  var isMobile = isSize("mobile");
  if (isMobile) return /*#__PURE__*/jsx(MobileWorkspaceMenu, {});
  return /*#__PURE__*/jsxs(DropdownMenuSub, {
    children: [/*#__PURE__*/jsx(DropdownMenuSubTrigger, {
      className: classnames("group items-center", MENU_ITEM_CLASSES),
      "data-testid": "workspace-display",
      children: /*#__PURE__*/jsx(TriggerContent, {})
    }), /*#__PURE__*/jsx(DropdownMenuSubContent, {
      className: "z-[99999]",
      collisionPadding: 16,
      sideOffset: 8,
      children: /*#__PURE__*/jsx(WorkspaceItems, {})
    })]
  });
};

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 ProfileMenu = function ProfileMenu(_ref) {
  var _globalProps$user, _globalProps$user2, _globalProps$user3, _globalProps$user4, _globalProps$user5;
  var profileInfo = _ref.profileInfo,
    showProductSwitcher = _ref.showProductSwitcher,
    defaultLinks = _ref.defaultLinks,
    topLinks = _ref.topLinks,
    bottomLinks = _ref.bottomLinks,
    customContent = _ref.customContent,
    toggleModal = _ref.toggleModal,
    isThemeSwitcherEnabled = _ref.isThemeSwitcherEnabled,
    isOrganizationSwitcherEnabled = _ref.isOrganizationSwitcherEnabled,
    isConsumer = _ref.isConsumer,
    enableSubscriptionUpgradeRequest = _ref.enableSubscriptionUpgradeRequest,
    openUpgradeModal = _ref.openUpgradeModal;
  var isAuthenticated = profileInfo.isAuthenticated;
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  var normalizedPlan = (((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.subscriptionPlan) || "").toLowerCase();
  var isFreePlan = normalizedPlan === "free";
  var isOwner = (_globalProps$user2 = globalProps.user) === null || _globalProps$user2 === void 0 ? void 0 : _globalProps$user2.isOwner;
  var showUpgradeModal = isFreePlan && enableSubscriptionUpgradeRequest && !isOwner;
  var getSubscriptionPlanAction = function getSubscriptionPlanAction() {
    if (showUpgradeModal) return {
      onClick: openUpgradeModal
    };
    if (isFreePlan && isOwner && enableSubscriptionUpgradeRequest) {
      var _globalProps$organiza;
      return {
        href: "".concat((_globalProps$organiza = globalProps.organization) === null || _globalProps$organiza === void 0 ? void 0 : _globalProps$organiza.authAppUrl, "/admin/billing/overview")
      };
    }
    return {
      href: NEETO_AUTH_BILLING_INFO_URL
    };
  };
  var isProPlan = normalizedPlan === "pro";
  var subscriptionPlanLink = _objectSpread$2({
    label: /*#__PURE__*/jsxs("span", {
      className: "flex items-center gap-2",
      children: [globalProps.appName, isProPlan ? /*#__PURE__*/jsx(Badge, {
        label: humanize((_globalProps$user3 = globalProps.user) === null || _globalProps$user3 === void 0 ? void 0 : _globalProps$user3.subscriptionPlan),
        style: {
          "--accent-foreground": "var(--color-amber-950)"
        },
        variant: "amber"
      }) : /*#__PURE__*/jsx(Badge, {
        icon: /*#__PURE__*/jsx(Crown, {
          className: "size-3"
        }),
        label: t("neetoMolecules.sidebar.upgradePlan"),
        style: {
          "--accent-foreground": "var(--primary-foreground)"
        }
      })]
    }),
    "data-testid": "subscription-plan"
  }, getSubscriptionPlanAction());
  return /*#__PURE__*/jsxs("div", {
    className: "p-1.5",
    children: [!isConsumer && /*#__PURE__*/jsxs(Fragment, {
      children: [/*#__PURE__*/jsx(LinkSection, {
        links: defaultLinks
      }), isNotEmpty(topLinks) && /*#__PURE__*/jsxs(Fragment, {
        children: [/*#__PURE__*/jsx(DropdownMenuSeparator, {
          className: "my-2"
        }), /*#__PURE__*/jsx(LinkSection, {
          links: topLinks
        })]
      }), isPresent(customContent) && /*#__PURE__*/jsxs(Fragment, {
        children: [/*#__PURE__*/jsx(DropdownMenuSeparator, {
          className: "my-2"
        }), /*#__PURE__*/jsx("div", {
          className: "px-3 py-1",
          children: customContent
        })]
      }), /*#__PURE__*/jsx(DropdownMenuSeparator, {
        className: "my-2"
      }), ((_globalProps$user4 = globalProps.user) === null || _globalProps$user4 === void 0 ? void 0 : _globalProps$user4.isOwner) && /*#__PURE__*/jsx(WorkspaceMenu, {}), isOrganizationSwitcherEnabled && /*#__PURE__*/jsx(OrganizationSwitcher, {}), /*#__PURE__*/jsx(DropdownMenuSeparator, {
        className: "my-2"
      }), isPresent((_globalProps$user5 = globalProps.user) === null || _globalProps$user5 === void 0 ? void 0 : _globalProps$user5.subscriptionPlan) && /*#__PURE__*/jsx(LinkSection, {
        links: [subscriptionPlanLink]
      }), showProductSwitcher && /*#__PURE__*/jsx(ProductSwitcher, {
        toggleModal: toggleModal
      }), /*#__PURE__*/jsx(HelpMenu, {}), /*#__PURE__*/jsx(DropdownMenuSeparator, {
        className: "my-2"
      })]
    }), isAuthenticated && !isConsumer && /*#__PURE__*/jsx(ProfileExpandMenu, {
      profileInfo: profileInfo
    }), /*#__PURE__*/jsx(LinkSection, {
      links: bottomLinks
    }), isThemeSwitcherEnabled && /*#__PURE__*/jsxs(Fragment, {
      children: [/*#__PURE__*/jsx(DropdownMenuSeparator, {
        className: "my-2"
      }), /*#__PURE__*/jsx(ThemeSwitcher, {})]
    })]
  });
};

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,
    enableSubscriptionUpgradeRequest = _ref.enableSubscriptionUpgradeRequest;
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    isModalOpen = _useState2[0],
    setIsModalOpen = _useState2[1];
  var _useState3 = useState(false),
    _useState4 = _slicedToArray(_useState3, 2),
    isUpgradeModalOpen = _useState4[0],
    setIsUpgradeModalOpen = _useState4[1];
  var _useState5 = useState(false),
    _useState6 = _slicedToArray(_useState5, 2),
    isMenuOpen = _useState6[0],
    setIsMenuOpen = _useState6[1];
  var _useState7 = useState(null),
    _useState8 = _slicedToArray(_useState7, 2),
    changesCount = _useState8[0],
    setChangesCount = _useState8[1];
  var _KeyboardShortcuts$us = KeyboardShortcuts.usePaneState(),
    _KeyboardShortcuts$us2 = _slicedToArray(_KeyboardShortcuts$us, 2),
    setIsOpen = _KeyboardShortcuts$us2[1];
  useHotkeys(["ctrl+u", "command+u"], function () {
    return setIsModalOpen(not);
  }, {
    mode: "global"
  });
  var profileInfo = getProfileInfo(profileInfoOverrides, isConsumer);
  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 newBottomLinks = [].concat(_toConsumableArray(getDefaultBottomLinks(profileInfo.isAuthenticated, isConsumer)), _toConsumableArray(bottomLinks));
  var defaultLinks = Object.keys(DEFAULT_MENU_LINK_PROPS).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 (_ref2) {
    var hide = _ref2.hide;
    return !hide;
  });
  return /*#__PURE__*/jsxs(Fragment, {
    children: [/*#__PURE__*/jsx(Profile.Pane, {
      popoverProps: profilePopoverProps
    }), isMenuOpen && /*#__PURE__*/jsx("div", {
      className: "pointer-events-none fixed inset-0 z-[99998] bg-black/[0.27]"
    }), /*#__PURE__*/jsxs(DropdownMenu$1, {
      open: isMenuOpen,
      onOpenChange: setIsMenuOpen,
      children: [/*#__PURE__*/jsx(DropdownMenuTrigger, {
        asChild: true,
        children: /*#__PURE__*/jsxs("button", {
          className: "bg-primary flex flex-col items-center justify-center gap-1.5 rounded-e-2xl p-1",
          type: "button",
          children: [/*#__PURE__*/jsx(Avatar, {
            className: "border-background size-[1.625rem] shrink-0 rounded-full border-2",
            "data-testid": "profile-avatar",
            user: {
              name: profileInfo.name,
              imageUrl: profileInfo.imageUrl
            }
          }), /*#__PURE__*/jsx("span", {
            className: "bg-background text-foreground flex size-[1.625rem] items-center justify-center rounded-full",
            children: /*#__PURE__*/jsx(CircleQuestionMark, {
              size: 20
            })
          })]
        })
      }), /*#__PURE__*/jsx(DropdownMenuContent, {
        align: "end",
        className: "z-[99999] max-h-[var(--radix-dropdown-menu-content-available-height)] w-64 overflow-y-auto rounded-xl p-0",
        collisionPadding: 16,
        side: "right",
        sideOffset: 8,
        onCloseAutoFocus: function onCloseAutoFocus(e) {
          return e.preventDefault();
        },
        children: /*#__PURE__*/jsx(ProfileMenu, {
          customContent: customContent,
          defaultLinks: defaultLinks,
          enableSubscriptionUpgradeRequest: enableSubscriptionUpgradeRequest,
          isConsumer: isConsumer,
          isOrganizationSwitcherEnabled: isOrganizationSwitcherEnabled,
          isThemeSwitcherEnabled: isThemeSwitcherEnabled,
          profileInfo: profileInfo,
          showProductSwitcher: showProductSwitcher,
          topLinks: topLinks,
          bottomLinks: newBottomLinks,
          openUpgradeModal: function openUpgradeModal() {
            return setIsUpgradeModalOpen(true);
          },
          toggleModal: setIsModalOpen
        })
      })]
    }), isPresent(changesCount) && /*#__PURE__*/jsx("span", {
      className: "bg-foreground text-background pointer-events-none absolute end-0 top-0 z-[3] flex h-[0.9375rem] min-w-[0.9375rem] items-center justify-center rounded-full border border-white px-1 text-[10px] select-none",
      "data-testid": "help-icon-changes-count",
      children: changesCount
    }), /*#__PURE__*/jsx(Modal, {
      isOpen: isModalOpen,
      onClose: function onClose() {
        return setIsModalOpen(false);
      }
    }), enableSubscriptionUpgradeRequest && !((_globalProps$user = globalProps.user) !== null && _globalProps$user !== void 0 && _globalProps$user.isOwner) && /*#__PURE__*/jsx(SubscriptionUpgradeRequestModal, {
      isOpen: isUpgradeModalOpen,
      onClose: function onClose() {
        return setIsUpgradeModalOpen(false);
      }
    })]
  });
};

var _excluded = ["profileInfoOverrides", "topLinks", "bottomLinks", "showProductSwitcher", "isThemeSwitcherEnabled", "isOrganizationSwitcherEnabled", "customContent", "profilePopoverProps", "isConsumer", "enableSubscriptionUpgradeRequest"];
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__*/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,
    _ref$enableSubscripti = _ref.enableSubscriptionUpgradeRequest,
    enableSubscriptionUpgradeRequest = _ref$enableSubscripti === void 0 ? true : _ref$enableSubscripti,
    otherProps = _objectWithoutProperties(_ref, _excluded);
  useEffect(function () {
    isThemeSwitcherEnabled && setAppTheme();
  }, [isThemeSwitcherEnabled]);
  var isBigBinaryEmail = globalProps$1 === null || globalProps$1 === void 0 || (_globalProps$user = globalProps$1.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__*/jsx("div", _objectSpread(_objectSpread({
    ref: ref,
    className: "bg-popover border-border fixed start-0 bottom-4 z-[99999] rounded-e-[1.0625rem] border border-s-0",
    "data-testid": "floating-action-menu-container"
  }, otherProps), {}, {
    children: /*#__PURE__*/jsx(ProfileButton, _defineProperty({
      bottomLinks: bottomLinks,
      customContent: customContent,
      enableSubscriptionUpgradeRequest: enableSubscriptionUpgradeRequest,
      isConsumer: isConsumer,
      isOrganizationSwitcherEnabled: isOrganizationSwitcherEnabled,
      isThemeSwitcherEnabled: isThemeSwitcherEnabled,
      profileInfoOverrides: profileInfoOverrides,
      profilePopoverProps: profilePopoverProps,
      showProductSwitcher: showProductSwitcher,
      topLinks: topLinks
    }, "isOrganizationSwitcherEnabled", isBigBinaryEmail || isOrganizationSwitcherEnabled))
  }));
});
FloatingActionMenu.displayName = "FloatingActionMenu";

export { FloatingActionMenu as default };
//# sourceMappingURL=FloatingActionMenu.js.map
