<commit_before>import { isLoaded as isAuthLoaded, load as loadAuth } from 'redux/modules/auth';

import { FAQ, TermsAndPolicies } from 'components/siteComponents';
import {
  Application,
  CollectionList,
  CollectionDetail,
  Extract,
  Home,
  HttpStatus,
  Logout,
  NewRecording,
  PasswordReset,
  Patch,
  Record,
  Replay,
  UserSignup,
  UserSettings
} from 'containers';


export default (store) => {
  const requireLogin = (nextState, replace, cb) => {
    function checkAuth() {
      const state = store.getState();
      if (!state.getIn(['auth', 'user', 'username'])) {
        // oops, not logged in, so can't be here!
        replace('/');
      }
      cb();
    }

    if (!isAuthLoaded(store.getState())) {
      store.dispatch(loadAuth()).then(checkAuth);
    } else {
      checkAuth();
    }
  };

  const userRoutes = [
    /* collection */
    {
      path: '/:user([^_]\w+)',
      name: 'collection',
      breadcrumb: true,
      footer: true,
      component: CollectionList,
    },
    {
      path: ':user/_settings',
      name: 'settings',
      footer: true,
      onEnter: requireLogin,
      component: UserSettings
    },
    {
      path: ':user/:coll(/:rec)',
      name: 'collectionDetail',
      breadcrumb: true,
      footer: true,
      component: CollectionDetail
    }
  ];

  const controllerRoutes = [
    /* TODO: add permissions check */
    {
      path: ':user/:coll/$new',
      name: 'new recording',
      footer: false,
      classOverride: true,
      component: NewRecording
    },
    {
      path: ':user/:coll/:rec/record/*',
      name: 'record',
      footer: false,
      classOverride: true,
      component: Record
    },
    {
      path: ':user/:coll/:rec/patch/:ts/*',
      name: 'patch',
      footer: false,
      classOverride: true,
      component: Patch
    },
    {
      path: ':user/:coll/:rec/extract:**/:ts/*',
      name: 'patch',
      footer: false,
      classOverride: true,
      component: Extract
    },
    {
      path: ':user/:coll/:rec/extract_only:**/:ts/*',
      name: 'patch',
      footer: false,
      classOverride: true,
      component: Extract
    },
    {
      path: ':user/:coll/:ts/*',
      name: 'replay',
      mode: 'replay',<commit_msg>Route updates for extract mode, use greedy splat<commit_after>import { isLoaded as isAuthLoaded, load as loadAuth } from 'redux/modules/auth';

import { FAQ, TermsAndPolicies } from 'components/siteComponents';
import {
  Application,
  CollectionList,
  CollectionDetail,
  Extract,
  Home,
  HttpStatus,
  Logout,
  NewRecording,
  PasswordReset,
  Patch,
  Record,
  Replay,
  UserSignup,
  UserSettings
} from 'containers';


export default (store) => {
  const requireLogin = (nextState, replace, cb) => {
    function checkAuth() {
      const state = store.getState();
      if (!state.getIn(['auth', 'user', 'username'])) {
        // oops, not logged in, so can't be here!
        replace('/');
      }
      cb();
    }

    if (!isAuthLoaded(store.getState())) {
      store.dispatch(loadAuth()).then(checkAuth);
    } else {
      checkAuth();
    }
  };

  const userRoutes = [
    /* collection */
    {
      path: ':user',
      name: 'collection',
      breadcrumb: true,
      footer: true,
      component: CollectionList,
    },
    {
      path: ':user/_settings',
      name: 'settings',
      footer: true,
      onEnter: requireLogin,
      component: UserSettings
    },
    {
      path: ':user/:coll(/:rec)',
      name: 'collectionDetail',
      breadcrumb: true,
      footer: true,
      component: CollectionDetail
    }
  ];

  const controllerRoutes = [
    /* TODO: add permissions check */
    {
      path: ':user/:coll/$new',
      name: 'new recording',
      footer: false,
      classOverride: true,
      component: NewRecording
    },
    {
      path: ':user/:coll/:rec/record/**',
      name: 'record',
      footer: false,
      classOverride: true,
      component: Record
    },
    {
      path: ':user/:coll/:rec/patch/:ts/**',
      name: 'patch',
      footer: false,
      classOverride: true,
      component: Patch
    },
    {
      path: ':user/:coll/:rec/:extractMode::archiveId(::collId)/:ts/**',
      name: 'extract',
      footer: false,
      classOverride: true,
      component: Extract
    },
    {
      path: ':user/:coll/:ts/**',
      name: 'replay',
      mode: 'replay',
{'fraction_non_alphanumeric': 0.151742993848257, 'fraction_numerical': 0.0, 'mean_word_length': 2.2494448556624724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2321310', 'n_tokens_mistral': 1406, 'n_tokens_neox': 1381, 'n_words': 314}