"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkOFXE5KF4js = require('./chunk-OFXE5KF4.js');var _chunkQY5FWMPEjs = require('./chunk-QY5FWMPE.js');var _chunkN6A55EEEjs = require('./chunk-N6A55EEE.js');var _chunkC5IZ2GUCjs = require('./chunk-C5IZ2GUC.js');var _chunk76SYFDGDjs = require('./chunk-76SYFDGD.js');var _chunk2IIS36RMjs = require('./chunk-2IIS36RM.js');var _chunkUJITMIZ2js = require('./chunk-UJITMIZ2.js');var _chunk6S5LPSJPjs = require('./chunk-6S5LPSJP.js');var _chunkVVWSJLBSjs = require('./chunk-VVWSJLBS.js');var _react = require('react');var _authentication = require('@baseapp-frontend/authentication');var _avatars = require('@baseapp-frontend/design-system/components/web/avatars');var _popovers = require('@baseapp-frontend/design-system/components/web/popovers');var _common = require('@baseapp-frontend/design-system/hooks/common');var _material = require('@mui/material');var _Divider = require('@mui/material/Divider'); var _Divider2 = _interopRequireDefault(_Divider);var _jsxruntime = require('react/jsx-runtime');function c(r){"@babel/helpers - typeof";return c=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(r)}function K(r,e){var o=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),o.push.apply(o,t)}return o}function p(r){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};e%2?K(Object(o),!0).forEach(function(t){Y(r,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):K(Object(o)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(o,t))})}return r}function Y(r,e,o){return(e=Z(e))in r?Object.defineProperty(r,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[e]=o,r}function Z(r){var e=ee(r,"string");return c(e)=="symbol"?e:e+""}function ee(r,e){if(c(r)!="object"||!r)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var t=o.call(r,e||"default");if(c(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function re(r,e){return ie(r)||ne(r,e)||te(r,e)||oe()}function oe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function te(r,e){if(r){if(typeof r=="string")return R(r,e);var o={}.toString.call(r).slice(8,-1);return o==="Object"&&r.constructor&&(o=r.constructor.name),o==="Map"||o==="Set"?Array.from(r):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?R(r,e):void 0}}function R(r,e){(e==null||e>r.length)&&(e=r.length);for(var o=0,t=Array(e);o<e;o++)t[o]=r[o];return t}function ne(r,e){var o=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(o!=null){var t,n,s,f,i=[],l=!0,a=!1;try{if(s=(o=o.call(r)).next,e===0){if(Object(o)!==o)return;l=!1}else for(;!(l=(t=s.call(o)).done)&&(i.push(t.value),i.length!==e);l=!0);}catch(y){a=!0,n=y}finally{try{if(!l&&o.return!=null&&(f=o.return(),Object(f)!==f))return}finally{if(a)throw n}}return i}}function ie(r){if(Array.isArray(r))return r}var de=function(e){var o,t=e.PopoverStyles,n=t===void 0?{}:t,s=e.MenuItems,f=s===void 0?_chunkC5IZ2GUCjs.a:s,i=e.MenuItemsProps,l=i===void 0?{}:i,a=e.CurrentUser,y=a===void 0?_chunkQY5FWMPEjs.a:a,O=e.CurrentProfile,H=O===void 0?_chunk2IIS36RMjs.a:O,I=e.SwitchProfileMenu,N=I===void 0?_chunk6S5LPSJPjs.a:I,C=e.SwitchProfileMenuProps,W=C===void 0?{}:C,j=e.ProfilesList,w=j===void 0?_chunkUJITMIZ2js.a:j,A=e.ProfilesListProps,q=A===void 0?{}:A,_=e.AddProfileMenuItem,z=_===void 0?_chunkVVWSJLBSjs.a:_,L=e.AddProfileMenuItemProps,G=L===void 0?{}:L,$=e.LogoutItemProps,J=$===void 0?{}:$,Q=_authentication.useCurrentProfile.call(void 0, {noSSR:!1}),v=Q.currentProfile,m=_common.usePopover.call(void 0, ),V=_react.useState.call(void 0, !1),D=re(V,2),P=D[0],b=D[1],d=null,S=function(){m.onClose(),P&&(d=setTimeout(function(){b(!1)},500))};return _react.useEffect.call(void 0, function(){return function(){d&&clearTimeout(d)}},[d]),_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _avatars.ClickableAvatar,{color:"secondary",src:(o=_optionalChain([v, 'optionalAccess', _2 => _2.image]))!==null&&o!==void 0?o:"",alt:"User avatar",onClick:m.onOpen,isOpen:!!m.open}),_jsxruntime.jsxs.call(void 0, _popovers.Popover,{open:m.open,onClose:S,sx:p(p({},_chunk76SYFDGDjs.a),n),children:[w&&P?_jsxruntime.jsx.call(void 0, w,p({openSubmenu:P,handleCloseSubmenu:function(){return b(!1)}},q)):_jsxruntime.jsx.call(void 0, _chunkOFXE5KF4js.a,{CurrentUser:y,CurrentProfile:H,SwitchProfileMenu:N,SwitchProfileMenuProps:W,MenuItems:f,MenuItemsProps:l,handlePopoverOnClose:S,setOpenProfilesList:b}),!!_chunkN6A55EEEjs.a&&_jsxruntime.jsx.call(void 0, _Divider2.default,{sx:{borderStyle:"solid"}}),_jsxruntime.jsxs.call(void 0, _material.Box,{margin:1.5,display:"flex",flexDirection:"column",gap:.5,children:[P&&!!z&&_jsxruntime.jsx.call(void 0, _chunkVVWSJLBSjs.a,p({},G)),_jsxruntime.jsx.call(void 0, _chunkN6A55EEEjs.a,p({handlePopoverOnClose:S},J))]})]})]})},Le= exports.a =de;exports.a = Le;
//# sourceMappingURL=chunk-OC25BW2P.js.map