{"version":3,"sources":["webpack:///app/javascript/opt/mastodon/app/javascript/flavours/glitch/features/account_timeline/index.jsx"],"names":["emptyList","ImmutableList","RemoteHint","_ref2","accountId","url","acct","useAppSelector","state","_state$accounts$get","accounts","get","domain","split","undefined","_jsx","TimelineHint","message","FormattedMessage","id","defaultMessage","label","values","AccountTimeline","ImmutablePureComponent","constructor","arguments","_defineProperty","this","column","scrollTop","maxId","props","dispatch","expandAccountTimeline","withReplies","tagged","params","c","_load","fetchAccount","expandAccountFeaturedTimeline","fetchFeaturedTags","componentDidMount","lookupAccount","componentDidUpdate","prevProps","UNSAFE_componentWillReceiveProps","nextProps","render","statusIds","featuredStatusIds","isLoading","hasMore","suspended","isAccount","hidden","multiColumn","remote","remoteUrl","isEmpty","Column","LoadingIndicator","BundleColumnError","errorType","emptyMessage","forceEmptyState","LimitedAccountHint","remoteMessage","_jsxs","ref","setRef","children","ProfileColumnHeader","onClick","handleHeaderClick","StatusList","prepend","AccountHeader","hideTabs","alwaysPrepend","append","scrollKey","onLoadMore","handleLoadMore","bindToDocument","timelineId","PropTypes","shape","string","isRequired","func","ImmutablePropTypes","list","bool","connect","mapStateToProps","_ref","getIn","normalizeForLookup","path","getAccountHidden"],"mappings":"kUA0BA,MAAMA,EAAYC,iBAkCZC,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,sCAAuCC,eAAe,iDACnFC,MAAON,YAACG,IAAgB,CAACC,GAAE,gCAAiCC,eAAe,6BAA6BE,OAAQ,CAAEV,OAAQG,YAAA,mBAASH,OACnI,EASN,MAAMW,UAAwB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W9F,WAAmBgC,EAAS,IAAIA,IAAW,KAAM,SAAUnC,kBACnJmD,UAAW5C,EAAM0F,MAAM,CAAC,YAAa,WAAWE,IAAQ,cACxD/C,QAAW7C,EAAM0F,MAAM,CAAC,YAAa,WAAWE,IAAQ,YACxD9C,UAAW9C,EAAM0F,MAAM,CAAC,WAAY9F,EAAW,cAAc,GAC7DoD,OAAQ6C,YAAiB7F,EAAOJ,GACjC,GAmKY2F,CAAyBxE,E","file":"js/flavours/glitch/async/account_timeline-52f7d1916988c25ce37b.chunk.js","sourcesContent":["import PropTypes from 'prop-types';\n\nimport { FormattedMessage } from 'react-intl';\n\nimport { List as ImmutableList } from 'immutable';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport ImmutablePureComponent from 'react-immutable-pure-component';\nimport { connect } from 'react-redux';\n\nimport { TimelineHint } from 'flavours/glitch/components/timeline_hint';\nimport ProfileColumnHeader from 'flavours/glitch/features/account/components/profile_column_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 { lookupAccount, fetchAccount } from '../../actions/accounts';\nimport { fetchFeaturedTags } from '../../actions/featured_tags';\nimport { expandAccountFeaturedTimeline, expandAccountTimeline } from '../../actions/timelines';\nimport { LoadingIndicator } from '../../components/loading_indicator';\nimport StatusList from '../../components/status_list';\nimport Column from '../ui/components/column';\n\nimport { AccountHeader } from './components/account_header';\nimport { LimitedAccountHint } from './components/limited_account_hint';\n\nconst emptyList = ImmutableList();\n\nconst mapStateToProps = (state, { params: { acct, id, tagged }, withReplies = false }) => {\n  const accountId = id || state.getIn(['accounts_map', normalizeForLookup(acct)]);\n\n  if (accountId === null) {\n    return {\n      isLoading: false,\n      isAccount: false,\n      statusIds: emptyList,\n    };\n  } else if (!accountId) {\n    return {\n      isLoading: true,\n      statusIds: emptyList,\n    };\n  }\n\n  const path = withReplies ? `${accountId}:with_replies` : `${accountId}${tagged ? `:${tagged}` : ''}`;\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    statusIds: state.getIn(['timelines', `account:${path}`, 'items'], ImmutableList()),\n    featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned${tagged ? `:${tagged}` : ''}`, 'items'], ImmutableList()),\n    isLoading: state.getIn(['timelines', `account:${path}`, 'isLoading']),\n    hasMore:   state.getIn(['timelines', `account:${path}`, 'hasMore']),\n    suspended: state.getIn(['accounts', accountId, 'suspended'], 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.posts_may_be_missing' defaultMessage='Some posts from this profile may be missing.' />}\n      label={<FormattedMessage id='hints.profiles.see_more_posts' defaultMessage='See more posts 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 AccountTimeline extends ImmutablePureComponent {\n\n  static propTypes = {\n    params: PropTypes.shape({\n      acct: PropTypes.string,\n      id: PropTypes.string,\n      tagged: PropTypes.string,\n    }).isRequired,\n    accountId: PropTypes.string,\n    dispatch: PropTypes.func.isRequired,\n    statusIds: ImmutablePropTypes.list,\n    featuredStatusIds: ImmutablePropTypes.list,\n    isLoading: PropTypes.bool,\n    hasMore: PropTypes.bool,\n    withReplies: 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, withReplies, params: { tagged }, dispatch } = this.props;\n\n    dispatch(fetchAccount(accountId));\n\n    if (!withReplies) {\n      dispatch(expandAccountFeaturedTimeline(accountId, { tagged }));\n    }\n\n    dispatch(fetchFeaturedTags(accountId));\n    dispatch(expandAccountTimeline(accountId, { withReplies, tagged }));\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, tagged }, accountId, withReplies, 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    } else if (prevProps.params.tagged !== tagged) {\n      if (!withReplies) {\n        dispatch(expandAccountFeaturedTimeline(accountId, { tagged }));\n      }\n      dispatch(expandAccountTimeline(accountId, { withReplies, tagged }));\n    }\n  }\n\n  UNSAFE_componentWillReceiveProps (nextProps) {\n    const { dispatch } = this.props;\n\n    if ((nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) || nextProps.withReplies !== this.props.withReplies) {\n      dispatch(fetchAccount(nextProps.params.accountId));\n\n      if (!nextProps.withReplies) {\n        dispatch(expandAccountFeaturedTimeline(nextProps.params.accountId));\n      }\n\n      dispatch(expandAccountTimeline(nextProps.params.accountId, { withReplies: nextProps.params.withReplies }));\n    }\n  }\n\n  handleHeaderClick = () => {\n    this.column.scrollTop();\n  };\n\n  handleLoadMore = maxId => {\n    this.props.dispatch(expandAccountTimeline(this.props.accountId, { maxId, withReplies: this.props.withReplies, tagged: this.props.params.tagged }));\n  };\n\n  setRef = c => {\n    this.column = c;\n  };\n\n  render () {\n    const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, suspended, isAccount, hidden, multiColumn, remote, remoteUrl } = this.props;\n\n    if (isLoading && statusIds.isEmpty()) {\n      return (\n        <Column>\n          <LoadingIndicator />\n        </Column>\n      );\n    } else if (!isLoading && !isAccount) {\n      return (\n        <BundleColumnError multiColumn={multiColumn} errorType='routing' />\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 (remote && statusIds.isEmpty()) {\n      emptyMessage = <RemoteHint accountId={accountId} url={remoteUrl} />;\n    } else {\n      emptyMessage = <FormattedMessage id='empty_column.account_timeline' defaultMessage='No posts found' />;\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        <StatusList\n          prepend={<AccountHeader accountId={this.props.accountId} hideTabs={forceEmptyState} tagged={this.props.params.tagged} />}\n          alwaysPrepend\n          append={remoteMessage}\n          scrollKey='account_timeline'\n          statusIds={forceEmptyState ? emptyList : statusIds}\n          featuredStatusIds={featuredStatusIds}\n          isLoading={isLoading}\n          hasMore={!forceEmptyState && hasMore}\n          onLoadMore={this.handleLoadMore}\n          emptyMessage={emptyMessage}\n          bindToDocument={!multiColumn}\n          timelineId='account'\n        />\n      </Column>\n    );\n  }\n\n}\n\nexport default connect(mapStateToProps)(AccountTimeline);\n"],"sourceRoot":""}