<commit_before>import _ from 'lodash'
import fp from 'lodash/fp'
import { createSelector } from 'reselect'

const isEmbedSelector = fp.get('isEmbed')

const locationSelector = fp.get('location')

const channelsSelector = fp.get('channels')

const sortedChannelsSelector = createSelector(
  channelsSelector,
  fp.sortBy('name')
)

const openedChannelsSelector = createSelector(
  channelsSelector, fp.get('messages'),
  (channels, messages) => fp.pipe(
    fp.map(channelName => channels[channelName]),
    fp.keyBy('name')
  )(fp.keys(messages))
)

const channelNameSelector = fp.get('channelName')

const getChannelSelector = (channelName = null) => createSelector(
  channelsSelector, channelNameSelector,
  (channels, name) => channels[channelName || name]
)

const getMessagesSelector = (channelName = null) => createSelector(
  fp.get('messages'), channelNameSelector,
  (messages, name) => (
    messages[channelName || name] || []
  )
)

const getLastMessageTimestampSelector = (channelName = null) => createSelector(
  getMessagesSelector(channelName),
  messages => fp.last(messages).timestamp
)

const usersSelector = createSelector(
  fp.get('users'), channelNameSelector,
  (users, channelName) => (
    users[channelName]
  )
)

const sortedUsersSelector = createSelector(
  usersSelector,
  fp.sortBy(fp.identity)
)

const userCountSelector = createSelector(
  usersSelector,
  fp.size
)

const isChannelLoadingSelector = createSelector(
  getChannelSelector(), usersSelector,
  (channel, users) => channel === undefined || users === undefined
)

const isAppLoadingSelector = createSelector(<commit_msg>Ignore case when sorting users<commit_after>import _ from 'lodash'
import fp from 'lodash/fp'
import { createSelector } from 'reselect'

const isEmbedSelector = fp.get('isEmbed')

const locationSelector = fp.get('location')

const channelsSelector = fp.get('channels')

const sortedChannelsSelector = createSelector(
  channelsSelector,
  fp.sortBy('name')
)

const openedChannelsSelector = createSelector(
  channelsSelector, fp.get('messages'),
  (channels, messages) => fp.pipe(
    fp.map(channelName => channels[channelName]),
    fp.keyBy('name')
  )(fp.keys(messages))
)

const channelNameSelector = fp.get('channelName')

const getChannelSelector = (channelName = null) => createSelector(
  channelsSelector, channelNameSelector,
  (channels, name) => channels[channelName || name]
)

const getMessagesSelector = (channelName = null) => createSelector(
  fp.get('messages'), channelNameSelector,
  (messages, name) => (
    messages[channelName || name] || []
  )
)

const getLastMessageTimestampSelector = (channelName = null) => createSelector(
  getMessagesSelector(channelName),
  messages => fp.last(messages).timestamp
)

const usersSelector = createSelector(
  fp.get('users'), channelNameSelector,
  (users, channelName) => (
    users[channelName]
  )
)

const sortedUsersSelector = createSelector(
  usersSelector,
  fp.sortBy(fp.toUpper)
)

const userCountSelector = createSelector(
  usersSelector,
  fp.size
)

const isChannelLoadingSelector = createSelector(
  getChannelSelector(), usersSelector,
  (channel, users) => channel === undefined || users === undefined
)

const isAppLoadingSelector = createSelector(
{'fraction_non_alphanumeric': 0.12361623616236163, 'fraction_numerical': 0.0, 'mean_word_length': 5.6796714579055445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2451734', 'n_tokens_mistral': 941, 'n_tokens_neox': 928, 'n_words': 207}