<commit_before>/* @flow */
import { combineReducers, createStore, applyMiddleware, compose } from "redux";
import { createEpicMiddleware, combineEpics } from "redux-observable";

import { List as ImmutableList, Map as ImmutableMap } from "immutable";

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

import { document, metadata, comms, config } from "@nteract/core/reducers";

import {
  AppRecord,
  MetadataRecord,
  DocumentRecord,
  CommsRecord
} from "@nteract/core/records";

import epics from "./epics";

const webAppReducer = (state = {}, action) => {
  switch (action.type) {
    case "LOADED":
      return Object.assign({}, state, { contents: action.payload });
    case "KERNELSPECS_LISTED":
      return Object.assign({}, state, { kernelspecs: action.payload });
  }
  return state;
};

export type AppState = {
  app: AppRecord,
  metadata: MetadataRecord,
  document: DocumentRecord,
  comms: CommsRecord,
  config: ImmutableMap<string, any>,
  contents: any
};

const rootReducer = combineReducers({
  webApp: webAppReducer,
  app: (state = {}) => state,
  metadata,
  document,
  comms,
  config
});

const defaultState = {
  app: AppRecord(),
  metadata: MetadataRecord(),
  document: DocumentRecord(),
  comms: CommsRecord(),
  config: ImmutableMap({
    theme: "light"
  })
};

export default function configureStore(config: any) {
  const initialState = Object.assign({}, { webApp: config }, defaultState);

  const rootEpic = combineEpics(...epics);
  const middlewares = [createEpicMiddleware(rootEpic)];

  return createStore(
    rootReducer,
    initialState,
    composeEnhancers(applyMiddleware(...middlewares))
  );
}<commit_msg>delete the metadata reducer setup for nbextension (#2142)<commit_after>/* @flow */
import { combineReducers, createStore, applyMiddleware, compose } from "redux";
import { createEpicMiddleware, combineEpics } from "redux-observable";

import { List as ImmutableList, Map as ImmutableMap } from "immutable";

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

import { document, comms, config } from "@nteract/core/reducers";

import { AppRecord, DocumentRecord, CommsRecord } from "@nteract/core/records";

import epics from "./epics";

const webAppReducer = (state = {}, action) => {
  switch (action.type) {
    case "LOADED":
      return Object.assign({}, state, { contents: action.payload });
    case "KERNELSPECS_LISTED":
      return Object.assign({}, state, { kernelspecs: action.payload });
  }
  return state;
};

export type AppState = {
  app: AppRecord,
  document: DocumentRecord,
  comms: CommsRecord,
  config: ImmutableMap<string, any>,
  contents: any
};

const rootReducer = combineReducers({
  webApp: webAppReducer,
  app: (state = {}) => state,
  document,
  comms,
  config
});

const defaultState = {
  app: AppRecord(),
  document: DocumentRecord(),
  comms: CommsRecord(),
  config: ImmutableMap({
    theme: "light"
  })
};

export default function configureStore(config: any) {
  const initialState = Object.assign({}, { webApp: config }, defaultState);

  const rootEpic = combineEpics(...epics);
  const middlewares = [createEpicMiddleware(rootEpic)];

  return createStore(
    rootReducer,
    initialState,
    composeEnhancers(applyMiddleware(...middlewares))
  );
}
{'fraction_non_alphanumeric': 0.12876052948255115, 'fraction_numerical': 0.0012033694344163659, 'mean_word_length': 4.569514237855946, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 9, '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': '6953295', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1050, 'n_words': 262}