"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 _chunkQT3YYU3Djs = require('./chunk-QT3YYU3D.js');var _chunk4O6FQ6U5js = require('./chunk-4O6FQ6U5.js');var _chunkGQRQITT5js = require('./chunk-GQRQITT5.js');var _chunkBUTRJNO3js = require('./chunk-BUTRJNO3.js');var _chunk7BMVU7BQjs = require('./chunk-7BMVU7BQ.js');var _chunkWVPMDLTKjs = require('./chunk-WVPMDLTK.js');var _chunkHWPAFCPPjs = require('./chunk-HWPAFCPP.js');var _chunkKIVWK2EBjs = require('./chunk-KIVWK2EB.js');var _chunkUYGX5XSAjs = require('./chunk-UYGX5XSA.js');var _react = require('react');var _authentication = require('@baseapp-frontend/authentication');var _avatars = require('@baseapp-frontend/design-system/components/web/avatars');var _icons = require('@baseapp-frontend/design-system/components/web/icons');var _typographies = require('@baseapp-frontend/design-system/components/web/typographies');var _material = require('@mui/material');var _reactrelay = require('react-relay');var _jsxruntime = require('react/jsx-runtime');function m(e){"@babel/helpers - typeof";return m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},m(e)}function D(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function ne(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?D(Object(t),!0).forEach(function(n){ae(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):D(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function ae(e,r,t){return(r=oe(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function oe(e){var r=ie(e,"string");return m(r)=="symbol"?r:r+""}function ie(e,r){if(m(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(m(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function $(e,r){return ce(e)||ue(e,r)||se(e,r)||le()}function le(){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 se(e,r){if(e){if(typeof e=="string")return E(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?E(e,r):void 0}}function E(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function ue(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n,i,s,a,u=[],c=!0,d=!1;try{if(s=(t=t.call(e)).next,r===0){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=s.call(t)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(f){d=!0,i=f}finally{try{if(!c&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(d)throw i}}return u}}function ce(e){if(Array.isArray(e))return e}var Ce=function(r){var t,n,i,s,a=r.roomRef,u=r.isCardSelected,c=u===void 0?!1:u,d=r.handleClick,f=r.Badge,L=f===void 0?_material.Badge:f,b=r.BadgeProps,N=b===void 0?{}:b,C=r.isInArchivedTab,p=C===void 0?!1:C,M=_reactrelay.useFragment.call(void 0, _chunkHWPAFCPPjs.a,a),K=_reactrelay.useFragment.call(void 0, _chunkBUTRJNO3js.a,a),v=_reactrelay.useFragment.call(void 0, _chunk7BMVU7BQjs.a,a),H=_chunkGQRQITT5js.b.call(void 0, ),X=$(H,1),q=X[0],z=function(te){te.stopPropagation(),d&&d()},G=_react.useRef.call(void 0, null),J=_authentication.useCurrentProfile.call(void 0, ),l=J.currentProfile,P=_chunkKIVWK2EBjs.b.call(void 0, K),Q=P.title,V=P.avatar,j=M.lastMessageTime,A=(t=M.lastMessage)===null||t===void 0?void 0:t.content,O=((n=v.unreadMessages)===null||n===void 0?void 0:n.markedUnread)||!!((i=v.unreadMessages)!==null&&i!==void 0&&i.count),Y=_react.useCallback.call(void 0, function(){q({variables:{input:{roomId:a.id,profileId:_optionalChain([l, 'optionalAccess', _2 => _2.id])}}})},[a.id,l]),Z=_chunkWVPMDLTKjs.b.call(void 0, ),I=$(Z,2),ee=I[0],re=I[1];return _jsxruntime.jsx.call(void 0, _chunkUYGX5XSAjs.a,{title:"Chat",offsetTop:-12,actions:[{disabled:re,icon:p?_jsxruntime.jsx.call(void 0, _icons.UnarchiveIcon,{}):_jsxruntime.jsx.call(void 0, _icons.ArchiveIcon,{}),label:p?"Unarchive Chat":"Archive Chat",onClick:function(){l!=null&&l.id&&ee({variables:{input:{roomId:a.id,profileId:l.id,archive:!p}}})},hasPermission:!0},{disabled:O,icon:_jsxruntime.jsx.call(void 0, _icons.UnreadIcon,{}),label:"Mark as Unread",onClick:Y,hasPermission:!0,closeOnClick:!0}],showDeleteButton:!0,handleDeleteItem:function(){},isDeletingItem:!1,ref:G,children:_jsxruntime.jsxs.call(void 0, _chunkQT3YYU3Djs.a,{onClick:z,isCardSelected:c,showPointer:!!d,children:[_jsxruntime.jsx.call(void 0, _avatars.AvatarWithPlaceholder,{sx:{alignSelf:"center",justifySelf:"center"},width:48,height:48,src:V}),_jsxruntime.jsxs.call(void 0, _material.Box,{display:"grid",gridTemplateRows:"repeat(2, minmax(0, 1fr))",children:[_jsxruntime.jsx.call(void 0, _typographies.TypographyWithEllipsis,{variant:"subtitle2",children:Q}),A&&j?_jsxruntime.jsxs.call(void 0, _material.Box,{display:"grid",gridTemplateColumns:"min-content min-content auto",alignItems:"center",children:[_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"caption",color:"text.secondary",noWrap:!0,children:_chunk4O6FQ6U5js.a.call(void 0, j)}),_jsxruntime.jsx.call(void 0, _material.Box,{sx:{display:"inline-block",height:"6px",width:"6px",borderRadius:"50%",backgroundColor:"text.disabled",marginX:"8px"}}),_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"caption",color:"text.secondary",noWrap:!0,sx:{overflow:"hidden",textOverflow:"ellipsis"},children:A})]}):_jsxruntime.jsx.call(void 0, "div",{})]}),_jsxruntime.jsx.call(void 0, L,ne({sx:{marginRight:"12px",justifySelf:"center",display:"flex",alignItems:"center"},badgeContent:((s=v.unreadMessages)===null||s===void 0?void 0:s.count)||"",color:"error",max:99,invisible:!O},N))]},"room-".concat(a.id))})},Re= exports.a =Ce;exports.a = Re;
//# sourceMappingURL=chunk-MVQKZO7F.js.map