"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 _chunkU3GMDVPAjs = require('./chunk-U3GMDVPA.js');var _chunk5RANKLPAjs = require('./chunk-5RANKLPA.js');var _chunk47MTGABTjs = require('./chunk-47MTGABT.js');var _react = require('react');var _inputs = require('@baseapp-frontend/design-system/components/web/inputs');var _material = require('@mui/material');var _reacthookform = require('react-hook-form');var _jsxruntime = require('react/jsx-runtime');function f(r){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(r)}function E(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function h(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?E(Object(t),!0).forEach(function(n){ae(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ae(r,e,t){return(e=se(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function se(r){var e=le(r,"string");return f(e)=="symbol"?e:e+""}function le(r,e){if(f(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(f(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function ue(r){return me(r)||de(r)||H(r)||ce()}function ce(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function de(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function me(r){if(Array.isArray(r))return P(r)}function fe(r,e){return pe(r)||he(r,e)||H(r,e)||be()}function be(){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 H(r,e){if(r){if(typeof r=="string")return P(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?P(r,e):void 0}}function P(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function he(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,c,a,d=[],l=!0,b=!1;try{if(c=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=c.call(t)).done)&&(d.push(n.value),d.length!==e);l=!0);}catch(p){b=!0,i=p}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(b)throw i}}return d}}function pe(r){if(Array.isArray(r))return r}var Se=function(e){var t=e.FORM_VALUE,n=e.setValue,i=e.refetch,c=e.connections,a=e.currentParticipants,d=e.connectionsLoadNext,l=e.connectionsHasNext,b=e.connectionsIsLoadingNext,p=e.membersLoadNext,F=e.membersHasNext,U=e.membersIsLoadingNext,g=e.ProfilesContainer,W=g===void 0?_chunk47MTGABTjs.b:g,S=e.ProfileCard,k=S===void 0?_chunkU3GMDVPAjs.a:S,C=e.ProfileCardProps,q=C===void 0?{}:C,L=e.Searchbar,G=L===void 0?_inputs.Searchbar:L,x=e.SearchbarProps,K=x===void 0?{}:x,j=e.SearchbarContainer,B=j===void 0?_chunk47MTGABTjs.a:j,O=e.ConnectionsList,z=O===void 0?_chunk5RANKLPAjs.a:O,A=e.ConnectionsListProps,J=A===void 0?{}:A,M=e.MembersList,Q=M===void 0?_chunk5RANKLPAjs.a:M,N=e.MembersListProps,X=N===void 0?{}:N,Y=_react.useTransition.call(void 0, ),I=fe(Y,2),w=I[0],T=I[1],y=_reacthookform.useForm.call(void 0, {defaultValues:{search:""}}),Z=y.control,ee=y.reset,re=y.watch,te=function(o){var s=o.target.value||"";T(function(){_optionalChain([i, 'optionalCall', _2 => _2({q:s})])})},ne=function(){T(function(){ee(),_optionalChain([i, 'optionalCall', _3 => _3({q:""})])})},oe=function(o){n(t.participants,[].concat(ue(a),[o]),{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0})},ie=function(o){n(t.participants,a.filter(function(s){return _optionalChain([s, 'optionalAccess', _4 => _4.id])!==_optionalChain([o, 'optionalAccess', _5 => _5.id])}),{shouldValidate:!0,shouldDirty:!0,shouldTouch:!0})},_=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return o?_jsxruntime.jsx.call(void 0, k,h({profile:o,handleAddMember:oe,handleRemoveMember:ie,isMember:s},q)):null};return _jsxruntime.jsxs.call(void 0, W,{children:[_jsxruntime.jsx.call(void 0, B,{children:_jsxruntime.jsx.call(void 0, G,h({name:"search",onChange:te,onClear:ne,control:Z,isPending:w},K))}),_jsxruntime.jsxs.call(void 0, _material.Box,{height:"100%",width:"100%",children:[_jsxruntime.jsx.call(void 0, Q,h({profiles:a,renderItem:function(o){return _(o,!0)},loadNext:p,hasNext:F,isLoadingNext:U,label:"Selected group members",title:"Members"},X)),c&&_jsxruntime.jsx.call(void 0, z,h({profiles:c,renderItem:function(o){return _(o)},loadNext:d,hasNext:l,isLoadingNext:b,isPending:w,searchValue:re("search")},J))]})]})},Ie= exports.a =Se;exports.a = Ie;
//# sourceMappingURL=chunk-KOEBCSNM.js.map