import{a as y}from"./chunk-NAEHKFOZ.mjs";import{a as p}from"./chunk-NAS5LN2B.mjs";import{b as h}from"./chunk-SQFWWN4R.mjs";import{useCurrentProfile as P}from"@baseapp-frontend/authentication";import{AvatarWithPlaceholder as S}from"@baseapp-frontend/design-system/components/web/avatars";import{TypographyWithEllipsis as T}from"@baseapp-frontend/design-system/components/web/typographies";import{LoadingButton as L}from"@mui/lab";import{Box as w,Typography as F}from"@mui/material";import{ConnectionHandler as g,useFragment as W}from"react-relay";import{jsx as m,jsxs as C}from"react/jsx-runtime";function I(t,e){return M(t)||R(t,e)||j(t,e)||A()}function A(){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 j(t,e){if(t){if(typeof t=="string")return v(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}function v(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,o=Array(e);r<e;r++)o[r]=t[r];return o}function R(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var o,c,i,l,n=[],s=!0,a=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(o=i.call(r)).done)&&(n.push(o.value),n.length!==e);s=!0);}catch(f){a=!0,c=f}finally{try{if(!s&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(a)throw c}}return n}}function M(t){if(Array.isArray(t))return t}var k=function(e){var r,o=e.profile,c=e.onChatCreation,i=W(p,o),l=i.id,n=i.image,s=i.name,a=i.urlPath,f=h(),d=I(f,2),b=d[0],_=d[1],x=P(),u=x.currentProfile;return C(y,{children:[m(S,{width:48,height:48,src:n?.url,sx:{alignSelf:"center",justifySelf:"center"}}),C(w,{sx:{display:"grid",gridTemplateRows:"repeat(2, minmax(0, 1fr))"},children:[m(T,{variant:"subtitle2",children:s}),m(F,{variant:"caption",color:"text.secondary",children:a?.path&&"@".concat((r=a.path)===null||r===void 0?void 0:r.replace("/",""))})]}),m(L,{color:"inherit",variant:"outlined",size:"small",onClick:function(){u!=null&&u.id&&b({variables:{input:{profileId:u.id,participants:[l]},connections:[g.getConnectionID(u.id,"roomsList_chatRooms",{unreadMessages:!1,archived:!1,q:""}),g.getConnectionID(u.id,"roomsList_chatRooms",{unreadMessages:!0,archived:!1,q:""})]},onCompleted:c})},loading:_,sx:{maxWidth:"fit-content",justifySelf:"end"},children:"Message"})]},"chat-room-item-".concat(l))},K=k;export{K as a};
//# sourceMappingURL=chunk-PLFI3MCM.mjs.map