{"version":3,"sources":["webpack:///./app/javascript/mastodon/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","maxId","this","props","dispatch","expandAccountTimeline","withReplies","tagged","params","_load","fetchAccount","expandAccountFeaturedTimeline","fetchFeaturedTags","me","connectTimeline","componentDidMount","lookupAccount","componentDidUpdate","prevProps","disconnectTimeline","timeline","componentWillUnmount","render","statusIds","featuredStatusIds","isLoading","hasMore","blockedBy","suspended","isAccount","hidden","multiColumn","remote","remoteUrl","isEmpty","Column","LoadingIndicator","BundleColumnError","errorType","emptyMessage","forceEmptyState","LimitedAccountHint","remoteMessage","ColumnBackButton","StatusList","prepend","HeaderContainer","hideTabs","alwaysPrepend","append","scrollKey","onLoadMore","handleLoadMore","bindToDocument","timelineId","withCounters","PropTypes","shape","string","isRequired","func","ImmutablePropTypes","list","bool","connect","mapStateToProps","_ref","getIn","normalizeForLookup","path","getAccountHidden"],"mappings":"4TA2BA,MAAMA,EAAYC,iBAmCZC,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,UAAwBC,IAAuBC,cAAA,SAAAC,WAAAC,YAAA,uBA8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MAAM,CAAC,WAAY1F,EAAW,cAAc,GAC7DqD,OAAQwC,YAAiBzF,EAAOJ,GAChCkD,UAAW9C,EAAMsF,MAAM,CAAC,gBAAiB1F,EAAW,eAAe,GACpE,GAiKYuF,CAAyBpE,E","file":"js/features/account_timeline-904ad89f2a8e8f33a277.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 'mastodon/components/timeline_hint';\nimport BundleColumnError from 'mastodon/features/ui/components/bundle_column_error';\nimport { me } from 'mastodon/initial_state';\nimport { normalizeForLookup } from 'mastodon/reducers/accounts_map';\nimport { getAccountHidden } from 'mastodon/selectors';\nimport { useAppSelector } from 'mastodon/store';\n\nimport { lookupAccount, fetchAccount } from '../../actions/accounts';\nimport { fetchFeaturedTags } from '../../actions/featured_tags';\nimport { expandAccountFeaturedTimeline, expandAccountTimeline, connectTimeline, disconnectTimeline } from '../../actions/timelines';\nimport { ColumnBackButton } from '../../components/column_back_button';\nimport { LoadingIndicator } from '../../components/loading_indicator';\nimport StatusList from '../../components/status_list';\nimport Column from '../ui/components/column';\n\nimport { LimitedAccountHint } from './components/limited_account_hint';\nimport HeaderContainer from './containers/header_container';\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'], emptyList),\n    featuredStatusIds: withReplies ? ImmutableList() : state.getIn(['timelines', `account:${accountId}:pinned${tagged ? `:${tagged}` : ''}`, 'items'], emptyList),\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    blockedBy: state.getIn(['relationships', accountId, 'blocked_by'], false),\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    blockedBy: 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    if (accountId === me) {\n      dispatch(connectTimeline(`account:${me}`));\n    }\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    if (prevProps.accountId === me && accountId !== me) {\n      dispatch(disconnectTimeline({ timeline: `account:${me}` }));\n    }\n  }\n\n  componentWillUnmount () {\n    const { dispatch, accountId } = this.props;\n\n    if (accountId === me) {\n      dispatch(disconnectTimeline({ timeline: `account:${me}` }));\n    }\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  render () {\n    const { accountId, statusIds, featuredStatusIds, isLoading, hasMore, blockedBy, 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 || blockedBy || 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 (blockedBy) {\n      emptyMessage = <FormattedMessage id='empty_column.account_unavailable' defaultMessage='Profile unavailable' />;\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>\n        <ColumnBackButton />\n\n        <StatusList\n          prepend={<HeaderContainer 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          withCounters\n        />\n      </Column>\n    );\n  }\n\n}\n\nexport default connect(mapStateToProps)(AccountTimeline);\n"],"sourceRoot":""}