import { c as LabelStringSet } from './index-4105bc4d.js';

const getChannelTitle = (channel, currentUserId, stringSet) => {
  var _channel$members;
  const LABEL_STRING_SET = stringSet || LabelStringSet;
  if (!(channel !== null && channel !== void 0 && channel.name) && !(channel !== null && channel !== void 0 && channel.members)) {
    return LABEL_STRING_SET.NO_TITLE;
  }
  if (channel !== null && channel !== void 0 && channel.name && channel.name !== 'Group Channel') {
    return channel.name;
  }
  if ((channel === null || channel === void 0 ? void 0 : (_channel$members = channel.members) === null || _channel$members === void 0 ? void 0 : _channel$members.length) === 1) {
    return LABEL_STRING_SET.NO_MEMBERS;
  }
  return channel === null || channel === void 0 ? void 0 : channel.members.filter(_ref => {
    let {
      userId
    } = _ref;
    return userId !== currentUserId;
  }).map(_ref2 => {
    let {
      nickname
    } = _ref2;
    return nickname || LABEL_STRING_SET.NO_NAME;
  }).join(', ');
};

export { getChannelTitle as g };
//# sourceMappingURL=utils-d317e3c3.js.map
