import{a as D}from"./chunk-MK2TH4QY.mjs";import{a as F,b as O,c as w}from"./chunk-T2IUCKYP.mjs";import{a as j}from"./chunk-HJ3UWYSU.mjs";import{a as T}from"./chunk-HFEGUIQL.mjs";import{b as P}from"./chunk-TJUNVA3H.mjs";import{a as I}from"./chunk-UB5P4QTT.mjs";import{b as R,c as _,e as S}from"./chunk-AZ65ECT7.mjs";import{a as x}from"./chunk-5GQV6TVL.mjs";import{useState as ao}from"react";import{useCurrentProfile as lo}from"@baseapp-frontend/authentication";import{AvatarWithPlaceholder as so}from"@baseapp-frontend/design-system/components/web/avatars";import{IconButton as H}from"@baseapp-frontend/design-system/components/web/buttons";import{ThreeDotsIcon as co}from"@baseapp-frontend/design-system/components/web/icons";import{Iconify as mo}from"@baseapp-frontend/design-system/components/web/images";import{Popover as uo}from"@baseapp-frontend/design-system/components/web/popovers";import{TypographyWithEllipsis as po}from"@baseapp-frontend/design-system/components/web/typographies";import{usePopover as fo}from"@baseapp-frontend/design-system/hooks/common";import{useResponsive as ho}from"@baseapp-frontend/design-system/hooks/web";import{Box as L,Typography as vo}from"@mui/material";import{useFragment as W}from"react-relay";import{jsx as e,jsxs as d,Fragment as Co}from"react/jsx-runtime";function M(o,t){return no(o)||io(o,t)||eo(o,t)||to()}function to(){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 eo(o,t){if(o){if(typeof o=="string")return G(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)?G(o,t):void 0}}function G(o,t){(t==null||t>o.length)&&(t=o.length);for(var r=0,n=Array(t);r<t;r++)n[r]=o[r];return n}function io(o,t){var r=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(r!=null){var n,m,f,u,l=[],a=!0,s=!1;try{if(f=(r=r.call(o)).next,t===0){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=f.call(r)).done)&&(l.push(n.value),l.length!==t);a=!0);}catch(C){s=!0,m=C}finally{try{if(!a&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(s)throw m}}return l}}function no(o){if(Array.isArray(o))return o}var yo=function(t){var r,n,m=t.isArchived,f=t.participantsCount,u=t.roomTitleRef,l=t.onDisplayGroupDetailsClicked,a=t.roomId,s=W(T,u),C=ao(!1),y=M(C,2),B=y[0],A=y[1],N=lo(),i=N.currentProfile,g=ho("up","md"),$=I(),E=$.resetChatRoom,h=s.isGroup,b=R(s),U=b.title,z=b.avatar,q=W(x,s),J=q.participants,K=S(J),Q=K.isSoleAdmin,V=_(f),c=fo(),X=P(),k=M(X,2),Y=k[0],Z=k[1],oo=function(){c.onClose(),i!=null&&i.id&&a&&Y({variables:{input:{roomId:a,profileId:i.id,archive:!m}}})},ro=function(v){v.stopPropagation(),c.onOpen(v)};return d(Co,{children:[e(j,{open:B,onClose:function(){return A(!1)},profileId:(r=i?.id)!==null&&r!==void 0?r:"",roomId:a,removingParticipantId:(n=i?.id)!==null&&n!==void 0?n:"",isSoleAdmin:Q}),d(F,{children:[g?e("div",{}):e(w,{children:e(H,{"aria-label":"return to chat room list",onClick:E,sx:{maxWidth:"fit-content"},children:e(mo,{icon:"eva:arrow-ios-back-fill",width:24})})}),d(O,{onClick:h?l:void 0,isClickable:h,children:[e(so,{className:"self-start justify-self-center",width:32,height:32,src:z,sx:{border:"none",alignSelf:"center"}}),d(L,{children:[e(po,{component:"span",variant:"subtitle2",maxWidth:g?"300px":"200px",sx:{float:"left",clear:"left"},children:U}),h&&e(vo,{component:"span",variant:"caption",sx:{float:"left",clear:"left"},children:V})]}),d(L,{children:[e(H,{onClick:ro,"aria-label":"Show chatroom options",children:e(co,{sx:{fontSize:"24px"}})}),e(uo,{open:c.open,onClose:c.onClose,slotProps:{root:{onClick:function(v){return v.stopPropagation()}}},children:e(D,{isArchived:m,isArchiveMutationInFlight:Z,isGroup:h,onArchiveClicked:oo,onDetailsClicked:function(){c.onClose(),l()},onLeaveClicked:function(){c.onClose(),A(!0)}})})]})]})]})]})},Ho=yo;export{Ho as a};
//# sourceMappingURL=chunk-VD2L3GRG.mjs.map