{"version":3,"sources":["webpack:///app/javascript/opt/mastodon/app/javascript/flavours/glitch/features/following/index.jsx"],"names":["RemoteHint","_ref2","accountId","url","acct","useAppSelector","state","_state$accounts$get","accounts","get","domain","split","undefined","_jsx","TimelineHint","message","FormattedMessage","id","defaultMessage","label","values","Following","ImmutablePureComponent","constructor","arguments","_defineProperty","_debounce","this","props","dispatch","expandFollowing","leading","c","column","scrollTop","_load","isAccount","fetchAccount","fetchFollowing","componentDidMount","params","lookupAccount","componentDidUpdate","prevProps","render","accountIds","hasMore","multiColumn","isLoading","suspended","hidden","remote","remoteUrl","hideCollections","BundleColumnError","errorType","Column","LoadingIndicator","emptyMessage","forceEmptyState","LimitedAccountHint","isEmpty","remoteMessage","_jsxs","ref","setRef","children","ProfileColumnHeader","onClick","handleHeaderClick","ScrollableList","scrollKey","onLoadMore","handleLoadMore","prepend","AccountHeader","hideTabs","alwaysPrepend","append","bindToDocument","map","Account","PropTypes","shape","string","isRequired","func","ImmutablePropTypes","list","bool","connect","mapStateToProps","_ref","getIn","normalizeForLookup","getAccountHidden"],"mappings":"iVA8BA,MAuBMA,EAAaC,IAAyB,IAAxB,UAAEC,EAAS,IAAEC,GAAKF,EACpC,MAAMG,EAAOC,aAAeC,IAAK,IAAAC,EAAA,OAAiC,QAAjCA,EAAID,EAAME,SAASC,IAAIP,UAAU,IAAAK,OAAA,EAA7BA,EAA+BH,IAAI,IAClEM,EAASN,EAAOA,EAAKO,MAAM,KAAK,QAAKC,EAE3C,OACEC,YAACC,IAAY,CACXX,IAAKA,EACLY,QAASF,YAACG,IAAgB,CAACC,GAAE,wCAAyCC,eAAe,6CACrFC,MAAON,YAACG,IAAgB,CAACC,GAAE,kCAAmCC,eAAe,+BAA+BE,OAAQ,CAAEV,OAAQG,YAAA,mBAASH,OACvI,EASN,MAAMW,UAAkBC,IAAuBC,cAAA,SAAAC,WAAAC,YAAA,sBA+C5BC,KAAS,KACxBC,KAAKC,MAAMC,SAASC,YAAgBH,KAAKC,MAAM1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AAM,CAAC,WAAY3F,EAAW,QAC/CkC,YAAa9B,EAAMuF,MAAM,CAAC,WAAY3F,IACtC2C,WAAYvC,EAAMuF,MAAM,CAAC,aAAc,YAAa3F,EAAW,UAC/D4C,UAAWxC,EAAMuF,MAAM,CAAC,aAAc,YAAa3F,EAAW,SAC9D8C,UAAW1C,EAAMuF,MAAM,CAAC,aAAc,YAAa3F,EAAW,cAAc,GAC5E+C,UAAW3C,EAAMuF,MAAM,CAAC,WAAY3F,EAAW,cAAc,GAC7DmD,gBAAiB/C,EAAMuF,MAAM,CAAC,WAAY3F,EAAW,qBAAqB,GAC1EgD,OAAQ6C,YAAiBzF,EAAOJ,IAfzB,CACL8C,WAAW,EAed,GA4IY0C,CAAyBrE,E","file":"js/flavours/glitch/async/following-43c3a4d617208b583ed4.chunk.js","sourcesContent":["import PropTypes from 'prop-types';\n\nimport { FormattedMessage } from 'react-intl';\n\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { connect } from 'react-redux';\n\nimport { debounce } from 'lodash';\n\nimport { Account } from 'flavours/glitch/components/account';\nimport { TimelineHint } from 'flavours/glitch/components/timeline_hint';\nimport { AccountHeader } from 'flavours/glitch/features/account_timeline/components/account_header';\nimport BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error';\nimport { normalizeForLookup } from 'flavours/glitch/reducers/accounts_map';\nimport { getAccountHidden } from 'flavours/glitch/selectors/accounts';\nimport { useAppSelector } from 'flavours/glitch/store';\n\nimport {\n lookupAccount,\n fetchAccount,\n fetchFollowing,\n expandFollowing,\n} from '../../actions/accounts';\nimport { LoadingIndicator } from '../../components/loading_indicator';\nimport ScrollableList from '../../components/scrollable_list';\nimport ProfileColumnHeader from '../account/components/profile_column_header';\nimport { LimitedAccountHint } from '../account_timeline/components/limited_account_hint';\nimport Column from '../ui/components/column';\n\nconst mapStateToProps = (state, { params: { acct, id } }) => {\n const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);\n\n if (!accountId) {\n return {\n isLoading: true,\n };\n }\n\n return {\n accountId,\n remote: !!(state.getIn(['accounts', accountId, 'acct']) !== state.getIn(['accounts', accountId, 'username'])),\n remoteUrl: state.getIn(['accounts', accountId, 'url']),\n isAccount: !!state.getIn(['accounts', accountId]),\n accountIds: state.getIn(['user_lists', 'following', accountId, 'items']),\n hasMore: !!state.getIn(['user_lists', 'following', accountId, 'next']),\n isLoading: state.getIn(['user_lists', 'following', accountId, 'isLoading'], true),\n suspended: state.getIn(['accounts', accountId, 'suspended'], false),\n hideCollections: state.getIn(['accounts', accountId, 'hide_collections'], false),\n hidden: getAccountHidden(state, accountId),\n };\n};\n\nconst RemoteHint = ({ accountId, url }) => {\n const acct = useAppSelector(state => state.accounts.get(accountId)?.acct);\n const domain = acct ? acct.split('@')[1] : undefined;\n\n return (\n <TimelineHint\n url={url}\n message={<FormattedMessage id='hints.profiles.follows_may_be_missing' defaultMessage='Follows for this profile may be missing.' />}\n label={<FormattedMessage id='hints.profiles.see_more_follows' defaultMessage='See more follows on {domain}' values={{ domain: <strong>{domain}</strong> }} />}\n />\n );\n};\n\nRemoteHint.propTypes = {\n url: PropTypes.string.isRequired,\n accountId: PropTypes.string.isRequired,\n};\n\nclass Following extends ImmutablePureComponent {\n\n static propTypes = {\n params: PropTypes.shape({\n acct: PropTypes.string,\n id: PropTypes.string,\n }).isRequired,\n accountId: PropTypes.string,\n dispatch: PropTypes.func.isRequired,\n accountIds: ImmutablePropTypes.list,\n hasMore: PropTypes.bool,\n isLoading: PropTypes.bool,\n isAccount: PropTypes.bool,\n suspended: PropTypes.bool,\n hidden: PropTypes.bool,\n remote: PropTypes.bool,\n remoteUrl: PropTypes.string,\n multiColumn: PropTypes.bool,\n };\n\n _load () {\n const { accountId, isAccount, dispatch } = this.props;\n\n if (!isAccount) dispatch(fetchAccount(accountId));\n dispatch(fetchFollowing(accountId));\n }\n\n componentDidMount () {\n const { params: { acct }, accountId, dispatch } = this.props;\n\n if (accountId) {\n this._load();\n } else {\n dispatch(lookupAccount(acct));\n }\n }\n\n componentDidUpdate (prevProps) {\n const { params: { acct }, accountId, dispatch } = this.props;\n\n if (prevProps.accountId !== accountId && accountId) {\n this._load();\n } else if (prevProps.params.acct !== acct) {\n dispatch(lookupAccount(acct));\n }\n }\n\n handleLoadMore = debounce(() => {\n this.props.dispatch(expandFollowing(this.props.accountId));\n }, 300, { leading: true });\n\n setRef = c => {\n this.column = c;\n };\n\n handleHeaderClick = () => {\n this.column.scrollTop();\n };\n\n render () {\n const { accountId, accountIds, hasMore, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl, hideCollections } = this.props;\n\n if (!isAccount) {\n return (\n <BundleColumnError multiColumn={multiColumn} errorType='routing' />\n );\n }\n\n if (!accountIds) {\n return (\n <Column>\n <LoadingIndicator />\n </Column>\n );\n }\n\n let emptyMessage;\n\n const forceEmptyState = suspended || hidden;\n\n if (suspended) {\n emptyMessage = <FormattedMessage id='empty_column.account_suspended' defaultMessage='Account suspended' />;\n } else if (hidden) {\n emptyMessage = <LimitedAccountHint accountId={accountId} />;\n } else if (hideCollections && accountIds.isEmpty()) {\n emptyMessage = <FormattedMessage id='empty_column.account_hides_collections' defaultMessage='This user has chosen to not make this information available' />;\n } else if (remote && accountIds.isEmpty()) {\n emptyMessage = <RemoteHint accountId={accountId} url={remoteUrl} />;\n } else {\n emptyMessage = <FormattedMessage id='account.follows.empty' defaultMessage=\"This user doesn't follow anyone yet.\" />;\n }\n\n const remoteMessage = remote ? <RemoteHint accountId={accountId} url={remoteUrl} /> : null;\n\n return (\n <Column ref={this.setRef}>\n <ProfileColumnHeader onClick={this.handleHeaderClick} multiColumn={multiColumn} />\n\n <ScrollableList\n scrollKey='following'\n hasMore={!forceEmptyState && hasMore}\n isLoading={isLoading}\n onLoadMore={this.handleLoadMore}\n prepend={<AccountHeader accountId={this.props.accountId} hideTabs />}\n alwaysPrepend\n append={remoteMessage}\n emptyMessage={emptyMessage}\n bindToDocument={!multiColumn}\n >\n {accountIds.map(id =>\n <Account key={id} id={id} />,\n )}\n </ScrollableList>\n </Column>\n );\n }\n\n}\n\nexport default connect(mapStateToProps)(Following);\n"],"sourceRoot":""}