<commit_before>import difference from 'lodash/difference';
import union from 'lodash/union';
import isPlainObject from 'lodash/isPlainObject';
import $$observable from 'symbol-observable';

export const ActionTypes = {
  PERFORM_ACTION: 'PERFORM_ACTION',
  RESET: 'RESET',
  ROLLBACK: 'ROLLBACK',
  COMMIT: 'COMMIT',
  SWEEP: 'SWEEP',
  TOGGLE_ACTION: 'TOGGLE_ACTION',
  SET_ACTIONS_ACTIVE: 'SET_ACTIONS_ACTIVE',
  JUMP_TO_STATE: 'JUMP_TO_STATE',
  JUMP_TO_ACTION: 'JUMP_TO_ACTION',
  REORDER_ACTION: 'REORDER_ACTION',
  IMPORT_STATE: 'IMPORT_STATE',
  LOCK_CHANGES: 'LOCK_CHANGES',
  PAUSE_RECORDING: 'PAUSE_RECORDING'
};

/**
 * Action creators to change the History state.
 */
export const ActionCreators = {
  performAction(action, trace, traceLimit, toExcludeFromTrace) {
    if (!isPlainObject(action)) {
      throw new Error(
        'Actions must be plain objects. ' +
        'Use custom middleware for async actions.'
      );
    }

    if (typeof action.type === 'undefined') {
      throw new Error(
        'Actions may not have an undefined "type" property. ' +
        'Have you misspelled a constant?'
      );
    }

    let stack;
    let error;
    let frames;
    if (trace) {
      if (typeof trace === 'function') stack = trace(action);
      else {
        error = Error();
        // https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions
        if (Error.captureStackTrace) Error.captureStackTrace(error, toExcludeFromTrace);
        stack = error.stack;
        if (typeof Error.stackTraceLimit !== 'number' || Error.stackTraceLimit > traceLimit) {
          frames = stack.split('\n');
          if (frames.length > traceLimit) stack = frames.slice(0, traceLimit + 1).join('\n'); // +1 for `Error\n`
        }
      }
    }

    return { type: ActionTypes.PERFORM_ACTION, action, timestamp: Date.now(), stack };
  },
<commit_msg>Take into account that there's an extra 1st frame in Chrome only<commit_after>import difference from 'lodash/difference';
import union from 'lodash/union';
import isPlainObject from 'lodash/isPlainObject';
import $$observable from 'symbol-observable';

export const ActionTypes = {
  PERFORM_ACTION: 'PERFORM_ACTION',
  RESET: 'RESET',
  ROLLBACK: 'ROLLBACK',
  COMMIT: 'COMMIT',
  SWEEP: 'SWEEP',
  TOGGLE_ACTION: 'TOGGLE_ACTION',
  SET_ACTIONS_ACTIVE: 'SET_ACTIONS_ACTIVE',
  JUMP_TO_STATE: 'JUMP_TO_STATE',
  JUMP_TO_ACTION: 'JUMP_TO_ACTION',
  REORDER_ACTION: 'REORDER_ACTION',
  IMPORT_STATE: 'IMPORT_STATE',
  LOCK_CHANGES: 'LOCK_CHANGES',
  PAUSE_RECORDING: 'PAUSE_RECORDING'
};

/**
 * Action creators to change the History state.
 */
export const ActionCreators = {
  performAction(action, trace, traceLimit, toExcludeFromTrace) {
    if (!isPlainObject(action)) {
      throw new Error(
        'Actions must be plain objects. ' +
        'Use custom middleware for async actions.'
      );
    }

    if (typeof action.type === 'undefined') {
      throw new Error(
        'Actions may not have an undefined "type" property. ' +
        'Have you misspelled a constant?'
      );
    }

    let stack;
    let error;
    let frames;
    if (trace) {
      if (typeof trace === 'function') stack = trace(action);
      else {
        error = Error();
        // https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions
        if (Error.captureStackTrace) Error.captureStackTrace(error, toExcludeFromTrace);
        stack = error.stack;
        if (typeof Error.stackTraceLimit !== 'number' || Error.stackTraceLimit > traceLimit) {
          frames = stack.split('\n');
          if (frames.length > traceLimit) {
            stack = frames.slice(0, traceLimit + (frames[0] === 'Error' ? 1 : 0)).join('\n');
          }
        }
      }
    }

    return { type: ActionTypes.PERFORM_ACTION, action, timestamp: Date.now(), stack };
  },

{'fraction_non_alphanumeric': 0.12652320456313196, 'fraction_numerical': 0.0025926886180969665, 'mean_word_length': 3.161812297734628, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2975634', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1220, 'n_words': 299}