"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 _chunkX5SXS2YTjs = require('./chunk-X5SXS2YT.js');var _chunkJFFACKERjs = require('./chunk-JFFACKER.js');var _chunkGGVHDHJ6js = require('./chunk-GGVHDHJ6.js');var _chunkN7GR5V2Qjs = require('./chunk-N7GR5V2Q.js');var _chunkP6TSSCDPjs = require('./chunk-P6TSSCDP.js');var _react = require('react');var _authentication = require('@baseapp-frontend/authentication');var _avatars = require('@baseapp-frontend/design-system/components/web/avatars');var _displays = require('@baseapp-frontend/design-system/components/web/displays');var _inputs = require('@baseapp-frontend/design-system/components/web/inputs');var _material = require('@mui/material');var _image = require('next/image'); var _image2 = _interopRequireDefault(_image);var _reacthookform = require('react-hook-form');var _reactvirtuoso = require('react-virtuoso');var _jsxruntime = require('react/jsx-runtime');function d(r){"@babel/helpers - typeof";return d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(r)}function k(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);t&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(r,l).enumerable})),e.push.apply(e,o)}return e}function P(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?k(Object(e),!0).forEach(function(o){tr(r,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):k(Object(e)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o))})}return r}function tr(r,t,e){return(t=er(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function er(r){var t=or(r,"string");return d(t)=="symbol"?t:t+""}function or(r,t){if(d(r)!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var o=e.call(r,t||"default");if(d(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function nr(r,t){return ur(r)||lr(r,t)||ar(r,t)||ir()}function ir(){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 ar(r,t){if(r){if(typeof r=="string")return D(r,t);var e={}.toString.call(r).slice(8,-1);return e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set"?Array.from(r):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?D(r,t):void 0}}function D(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,o=Array(t);e<t;e++)o[e]=r[e];return o}function lr(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var o,l,f,m,u=[],s=!0,p=!1;try{if(f=(e=e.call(r)).next,t===0){if(Object(e)!==e)return;s=!1}else for(;!(s=(o=f.call(e)).done)&&(u.push(o.value),u.length!==t);s=!0);}catch(v){p=!0,l=v}finally{try{if(!s&&e.return!=null&&(m=e.return(),Object(m)!==m))return}finally{if(p)throw l}}return u}}function ur(r){if(Array.isArray(r))return r}var Cr=function(t){var e=t.allProfilesRef,o=t.ChatRoomListItem,l=o===void 0?_chunkX5SXS2YTjs.a:o,f=t.ChatRoomListItemProps,m=f===void 0?{}:f,u=t.Searchbar,s=u===void 0?_inputs.Searchbar:u,p=t.SearchbarProps,v=p===void 0?{}:p,S=t.VirtuosoProps,$=S===void 0?{}:S,E=t.onChatCreation,F=t.onGroupChatCreationButtonClicked,h=_chunkN7GR5V2Qjs.b.call(void 0, e),y=h.data.allProfiles,G=h.loadNext,B=h.isLoadingNext,M=h.hasNext,j=h.refetch,W=_react.useTransition.call(void 0, ),x=nr(W,2),b=x[0],L=x[1],g=_reacthookform.useForm.call(void 0, {defaultValues:{search:""}}),q=g.control,H=g.reset,K=g.watch,z=_authentication.useCurrentProfile.call(void 0, ),c=z.currentProfile,U=function(a){var C=a.target.value||"";L(function(){j({q:C})})},J=function(){L(function(){H(),j({q:""})})},O=_react.useMemo.call(void 0, function(){return _optionalChain([y, 'optionalAccess', _2 => _2.edges, 'access', _3 => _3.filter, 'call', _4 => _4(function(n){return _optionalChain([n, 'optionalAccess', _5 => _5.node])&&n.node.id!==_optionalChain([c, 'optionalAccess', _6 => _6.id])}), 'access', _7 => _7.map, 'call', _8 => _8(function(n){return _optionalChain([n, 'optionalAccess', _9 => _9.node])})])||[]},[y,_optionalChain([c, 'optionalAccess', _10 => _10.id])]),Q=function(){return B?_jsxruntime.jsx.call(void 0, _displays.LoadingState,{sx:{paddingTop:3,paddingBottom:1},CircularProgressProps:{size:15},"aria-label":"loading more profiles"}):_jsxruntime.jsx.call(void 0, _material.Box,{sx:{paddingTop:3}})},X=function(a){return a?_jsxruntime.jsx.call(void 0, l,P({profile:a,onChatCreation:E},m)):null},Y=function(){var a=O.length===0,C=K("search");return!b&&C&&a?_jsxruntime.jsx.call(void 0, _chunkP6TSSCDPjs.a,{}):!b&&a?_jsxruntime.jsx.call(void 0, _chunkGGVHDHJ6js.a,{}):_jsxruntime.jsx.call(void 0, _reactvirtuoso.Virtuoso,P({data:O,itemContent:function(Pr,rr){return X(rr)},style:{scrollbarWidth:"none",maxHeight:"calc(100vh - 72px - 57px - 61px - 72px)"},components:{Footer:Q},endReached:function(){M&&G(5)}},$))};return _jsxruntime.jsxs.call(void 0, _chunkJFFACKERjs.a,{children:[_jsxruntime.jsx.call(void 0, _chunkJFFACKERjs.b,{children:_jsxruntime.jsx.call(void 0, s,P({name:"search",onChange:U,onClear:J,control:q,isPending:b},v))}),_jsxruntime.jsxs.call(void 0, _chunkJFFACKERjs.c,{onClick:F,children:[_jsxruntime.jsx.call(void 0, _avatars.AvatarWithPlaceholder,{width:48,height:48,sx:{bgcolor:"primary.main",alignSelf:"flex-start",justifySelf:"center"},children:_jsxruntime.jsx.call(void 0, _image2.default,{src:"/svg/avatar-group-chat.svg",alt:"Avatar Group Fallback",width:24,height:24})}),_jsxruntime.jsx.call(void 0, _material.Typography,{component:"span",variant:"subtitle2",sx:{alignSelf:"center"},children:"New Group"})]}),Y()]})},$r= exports.a =Cr;exports.a = $r;
//# sourceMappingURL=chunk-CX63QK6V.js.map