"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunk6LDWPPMNjs = require('./chunk-6LDWPPMN.js');var _chunkZZILP3JHjs = require('./chunk-ZZILP3JH.js');var _chunkZNIEPKGZjs = require('./chunk-ZNIEPKGZ.js');var _chunkBUTRJNO3js = require('./chunk-BUTRJNO3.js');var _chunkWVPMDLTKjs = require('./chunk-WVPMDLTK.js');var _chunkMBKDZBVUjs = require('./chunk-MBKDZBVU.js');var _chunkKIVWK2EBjs = require('./chunk-KIVWK2EB.js');var _react = require('react');var _authentication = require('@baseapp-frontend/authentication');var _avatars = require('@baseapp-frontend/design-system/components/web/avatars');var _buttons = require('@baseapp-frontend/design-system/components/web/buttons');var _icons = require('@baseapp-frontend/design-system/components/web/icons');var _images = require('@baseapp-frontend/design-system/components/web/images');var _popovers = require('@baseapp-frontend/design-system/components/web/popovers');var _typographies = require('@baseapp-frontend/design-system/components/web/typographies');var _common = require('@baseapp-frontend/design-system/hooks/common');var _web = require('@baseapp-frontend/design-system/hooks/web');var _material = require('@mui/material');var _reactrelay = require('react-relay');var _jsxruntime = require('react/jsx-runtime');function O(o,t){return V(o)||Q(o,t)||K(o,t)||J()}function J(){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 K(o,t){if(o){if(typeof o=="string")return w(o,t);var r={}.toString.call(o).slice(8,-1);return r==="Object"&&o.constructor&&(r=o.constructor.name),r==="Map"||r==="Set"?Array.from(o):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(o,t):void 0}}function w(o,t){(t==null||t>o.length)&&(t=o.length);for(var r=0,i=Array(t);r<t;r++)i[r]=o[r];return i}function Q(o,t){var r=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(r!=null){var i,h,u,n,l=[],s=!0,m=!1;try{if(u=(r=r.call(o)).next,t===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(i=u.call(r)).done)&&(l.push(i.value),l.length!==t);s=!0);}catch(C){m=!0,h=C}finally{try{if(!s&&r.return!=null&&(n=r.return(),Object(n)!==n))return}finally{if(m)throw h}}return l}}function V(o){if(Array.isArray(o))return o}var co=function(t){var r=t.isArchived,i=t.participantsCount,h=t.roomTitleRef,u=t.onDisplayGroupDetailsClicked,n=t.roomId,l=_reactrelay.useFragment.call(void 0, _chunkBUTRJNO3js.a,h),s=_react.useState.call(void 0, !1),m=O(s,2),C=m[0],y=m[1],g=_web.useResponsive.call(void 0, "up","md"),G=_chunkMBKDZBVUjs.a.call(void 0, ),H=G.resetChatRoom,d=l.isGroup,A=_chunkKIVWK2EBjs.b.call(void 0, l),L=A.title,W=A.avatar,B=_chunkKIVWK2EBjs.c.call(void 0, i),c=_common.usePopover.call(void 0, ),N=_authentication.useCurrentProfile.call(void 0, ),a=N.currentProfile,E=_chunkWVPMDLTKjs.b.call(void 0, ),b=O(E,2),U=b[0],z=b[1],$=function(){c.onClose(),a!=null&&a.id&&n&&U({variables:{input:{roomId:n,profileId:a.id,archive:!r}}})},q=function(v){v.stopPropagation(),c.onOpen(v)};return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkZNIEPKGZjs.a,{open:C,onClose:function(){return y(!1)},profileId:_optionalChain([a, 'optionalAccess', _2 => _2.id]),roomId:n}),_jsxruntime.jsxs.call(void 0, _chunkZZILP3JHjs.a,{children:[g?_jsxruntime.jsx.call(void 0, "div",{}):_jsxruntime.jsx.call(void 0, _chunkZZILP3JHjs.c,{children:_jsxruntime.jsx.call(void 0, _buttons.IconButton,{"aria-label":"return to chat room list",onClick:H,sx:{maxWidth:"fit-content"},children:_jsxruntime.jsx.call(void 0, _images.Iconify,{icon:"eva:arrow-ios-back-fill",width:24})})}),_jsxruntime.jsxs.call(void 0, _chunkZZILP3JHjs.b,{onClick:d?u:void 0,isClickable:d,children:[_jsxruntime.jsx.call(void 0, _avatars.AvatarWithPlaceholder,{className:"self-start justify-self-center",width:32,height:32,src:W,sx:{border:"none",alignSelf:"center"}}),_jsxruntime.jsxs.call(void 0, _material.Box,{children:[_jsxruntime.jsx.call(void 0, _typographies.TypographyWithEllipsis,{component:"span",variant:"subtitle2",maxWidth:g?"300px":"200px",sx:{float:"left",clear:"left"},children:L}),d&&_jsxruntime.jsx.call(void 0, _material.Typography,{component:"span",variant:"caption",sx:{float:"left",clear:"left"},children:B})]}),_jsxruntime.jsxs.call(void 0, _material.Box,{children:[_jsxruntime.jsx.call(void 0, _buttons.IconButton,{onClick:q,"aria-label":"Show chatroom options",children:_jsxruntime.jsx.call(void 0, _icons.ThreeDotsIcon,{sx:{fontSize:"24px"}})}),_jsxruntime.jsx.call(void 0, _popovers.Popover,{open:c.open,onClose:c.onClose,slotProps:{root:{onClick:function(v){return v.stopPropagation()}}},children:_jsxruntime.jsx.call(void 0, _chunk6LDWPPMNjs.a,{isArchived:r,isArchiveMutationInFlight:z,isGroup:d,onArchiveClicked:$,onDetailsClicked:function(){c.onClose(),u()},onLeaveClicked:function(){c.onClose(),y(!0)}})})]})]})]})]})},_o= exports.a =co;exports.a = _o;
//# sourceMappingURL=chunk-WW564GQY.js.map