<commit_before>import React from "react";
import ReactDOM from "react-dom";
import {Provider, connect} from "react-redux";
import {createStore, combineReducers, bindActionCreators} from "redux";
import merge from "lodash.merge";

import "./less/jPlayer.less";
import jPlayerReducer from "./reducers/jPlayerReducer";
import * as jPlayerActions from "./actions/jPlayerActions";
import {defaultValues, jPlayerDefaultOptions, statusDefaultValues} from "./containers/jPlayer";
import JPlayer from "./containers/jPlayer";
import Media from "./components/media";
import Gui from "./components/gui";
import KeyControl from "./components/keyControl";
import Progress from "./components/progress";
import SeekBar from "./components/seekBar";
import PlayBar from "./components/playBar";
import Buffer from "./components/buffer";
import BrowserUnsupported from "./components/browserUnsupported";
import Poster from "./components/poster";
import Audio from "./components/audio";
import Video from "./components/video";
import Title from "./components/title";
import FullScreen from "./components/controls/fullScreen";
import Mute from "./components/controls/mute";
import Play from "./components/controls/play";
import Repeat from "./components/controls/repeat";
import PlaybackRateBar from "./components/controls/playbackRateBar";
import PlaybackRateBarValue from "./components/controls/playbackRateBarValue";
import VolumeBar from "./components/controls/volumeBar";
import VolumeBarValue from "./components/controls/volumeBarValue";
import Duration from "./components/duration";
import CurrentTime from "./components/currentTime";

const mapStateToProps = ({jPlayers}, {id}) => {
    const otherPlayers = {};

    for (var key in jPlayers) {
        const jPlayer = jPlayers[key];

        if (key !== id) {
            otherPlayers[key] = jPlayer;
        }
    }
    
    return {
        ...jPlayers[id],
        jPlayers: otherPlayers
    }
};

const mapDispatchToProps = (dispatch) => ({functions: bindActionCreators(jPlayerActions, dispatch)});

export default (...wrappedPlayers) => {
    const initialState = {jPlayers: {}};
    let ConnectedPlayers = [];

    wrappedPlayers.forEach(wrappedPlayer => {
        const ConnectedPlayer = connect(mapStateToProps, mapDispatchToProps)(wrappedPlayer);

        initialState.jPlayers[wrappedPlayer.options.id] = {
            ...merge({}, defaultValues, statusDefaultValues, jPlayerDefaultOptions, wrappedPlayer.options),
        }     
        ConnectedPlayers.push(<ConnectedPlayer key={wrappedPlayer.options.id} id={wrappedPlayer.options.id} />);<commit_msg>update mapStateToProps for main index.<commit_after>import React from "react";
import ReactDOM from "react-dom";
import {Provider, connect} from "react-redux";
import {createStore, combineReducers, bindActionCreators} from "redux";
import merge from "lodash.merge";

import "./less/jPlayer.less";
import jPlayerReducer from "./reducers/jPlayerReducer";
import * as jPlayerActions from "./actions/jPlayerActions";
import {defaultValues, jPlayerDefaultOptions, statusDefaultValues} from "./containers/jPlayer";
import JPlayer from "./containers/jPlayer";
import Media from "./components/media";
import Gui from "./components/gui";
import KeyControl from "./components/keyControl";
import Progress from "./components/progress";
import SeekBar from "./components/seekBar";
import PlayBar from "./components/playBar";
import Buffer from "./components/buffer";
import BrowserUnsupported from "./components/browserUnsupported";
import Poster from "./components/poster";
import Audio from "./components/audio";
import Video from "./components/video";
import Title from "./components/title";
import FullScreen from "./components/controls/fullScreen";
import Mute from "./components/controls/mute";
import Play from "./components/controls/play";
import Repeat from "./components/controls/repeat";
import PlaybackRateBar from "./components/controls/playbackRateBar";
import PlaybackRateBarValue from "./components/controls/playbackRateBarValue";
import VolumeBar from "./components/controls/volumeBar";
import VolumeBarValue from "./components/controls/volumeBarValue";
import Duration from "./components/duration";
import CurrentTime from "./components/currentTime";

const mapStateToProps = ({jPlayers}, {id}) => {
    const otherPlayers = {};

    Object.keys(jPlayers).forEach(key => key !== id ? otherPlayers[key] = jPlayers[key] : null);

    if (Object.keys(otherPlayers).length) {
        return {
            ...jPlayers[id],
            jPlayers: otherPlayers
        }
    }

    return {
        ...jPlayers[id]
    }
};

const mapDispatchToProps = (dispatch) => ({functions: bindActionCreators(jPlayerActions, dispatch)});

export default (...wrappedPlayers) => {
    const initialState = {jPlayers: {}};
    let ConnectedPlayers = [];

    wrappedPlayers.forEach(wrappedPlayer => {
        const ConnectedPlayer = connect(mapStateToProps, mapDispatchToProps)(wrappedPlayer);

        initialState.jPlayers[wrappedPlayer.options.id] = {
            ...merge({}, defaultValues, statusDefaultValues, jPlayerDefaultOptions, wrappedPlayer.options),
        }     
        ConnectedPlayers.push(<ConnectedPlayer key={wrappedPlayer.options.id} id={wrappedPlayer.options.id} />);
{'fraction_non_alphanumeric': 0.12890995260663507, 'fraction_numerical': 0.0, 'mean_word_length': 4.542016806722689, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '563334', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1368, 'n_words': 367}