<commit_before>// https://github.com/unclecheese/react-selectable/
cloneWithProps = React.cloneElement;

function isNodeInRoot(node, root) {
  while (node) {
    if (node === root) {
      return true;
    }
    node = node.parentNode;
  }

  return false;
}

Selectable = React.createClass({

  /**
   * @type {Object}
   */
  propTypes: {

    /**
     * Event that will fire when items are selected. Passes an array of keys
     */
    onSelection: React.PropTypes.func,

    /**
     * The component that will represent the Selectable DOM node
     */
    component: React.PropTypes.oneOfType([
      React.PropTypes.func,
      React.PropTypes.string
    ]),

    /**
     * Expands the boundary of the selectable area. It can be an integer, which
     * applies to all sides, or an object containing "top", "bottom", "left",
     * and "right" values for custom distance on each side
     */
    distance: React.PropTypes.oneOfType([
      React.PropTypes.object,
      React.PropTypes.number
    ]),

    /**
     * Amount of forgiveness an item will offer to the selectbox before registering
     * a selection, i.e. if only 1px of the item is in the selection, it shouldn't be
     * included.
     */
    tolerance: React.PropTypes.number,

    /**
     * If true, a click-and-drag with the mouse will generate a select box anywhere
     * in the document.
     */
    globalMouse: React.PropTypes.bool,

    /**
     * If true, a click will not generate event onSelection
     */
    disableSingleSelection: React.PropTypes.bool
  },

  /**
   * This is stored outside the state, so that setting it doesn't
   * rerender the app during selection. shouldComponentUpdate() could work around that.
   * @type {Object}
   */
  _mouseDownData: null,

  /**
   * @return {Object}
   */
  getInitialState: function() {
    return {
      isBoxSelecting: false,
      persist: false,
      boxWidth: 0,
      boxHeight: 0,
      selectedItems: []
    };
  },

  /**
   * @return {Object}
   */
  getDefaultProps: function() {
    return {
      onSelection: function () {},
      component: 'div',
      distance: 0,
      tolerance: 0,
      globalMouse: false,
      disableSingleSelection: false
    };
  },

  /**
   * Attach global event listeners
   */
  componentDidMount: function() {
    console.log('this')
    console.log(this)
    var node = ReactDOM.findDOMNode(this);
    console.log('node')
    console.log(node)
    node.addEventListener('mousedown', this._mouseDown);
    node.addEventListener('keydown', this._keyListener);
    node.addEventListener('keyup', this._keyListener);
  },

  /**
   * Remove global event listeners
   */
  componentWillUnmount: function() {
    var node = ReactDOM.findDOMNode(this);
    node.removeEventListener('mousedown', this._mouseDown);
    node.removeEventListener('keydown', this._keyListener);
    node.removeEventListener('keyup', this._keyListener);
  },

  /**
   * Renders the component
   * @return {ReactComponent}
   */
  render: function() {
    var boxStyle = {
      left: this.state.boxLeft,
      top: this.state.boxTop,
      width: this.state.boxWidth,
      height: this.state.boxHeight,<commit_msg>Remove console.log's + change defaultProps<commit_after>// https://github.com/unclecheese/react-selectable/
cloneWithProps = React.cloneElement;

function isNodeInRoot(node, root) {
  while (node) {
    if (node === root) {
      return true;
    }
    node = node.parentNode;
  }

  return false;
}

Selectable = React.createClass({

  /**
   * @type {Object}
   */
  propTypes: {

    /**
     * Event that will fire when items are selected. Passes an array of keys
     */
    onSelection: React.PropTypes.func,

    /**
     * The component that will represent the Selectable DOM node
     */
    component: React.PropTypes.oneOfType([
      React.PropTypes.func,
      React.PropTypes.string
    ]),

    /**
     * Expands the boundary of the selectable area. It can be an integer, which
     * applies to all sides, or an object containing "top", "bottom", "left",
     * and "right" values for custom distance on each side
     */
    distance: React.PropTypes.oneOfType([
      React.PropTypes.object,
      React.PropTypes.number
    ]),

    /**
     * Amount of forgiveness an item will offer to the selectbox before registering
     * a selection, i.e. if only 1px of the item is in the selection, it shouldn't be
     * included.
     */
    tolerance: React.PropTypes.number,

    /**
     * If true, a click-and-drag with the mouse will generate a select box anywhere
     * in the document.
     */
    globalMouse: React.PropTypes.bool,

    /**
     * If true, a click will not generate event onSelection
     */
    disableSingleSelection: React.PropTypes.bool
  },

  /**
   * This is stored outside the state, so that setting it doesn't
   * rerender the app during selection. shouldComponentUpdate() could work around that.
   * @type {Object}
   */
  _mouseDownData: null,

  /**
   * @return {Object}
   */
  getInitialState: function() {
    return {
      isBoxSelecting: false,
      persist: false,
      boxWidth: 0,
      boxHeight: 0,
      selectedItems: []
    };
  },

  /**
   * @return {Object}
   */
  getDefaultProps: function() {
    return {
      onSelection: function () {},
      component: 'div',
      distance: 1,
      tolerance: 1,
      globalMouse: true,
      disableSingleSelection: true
    };
  },

  /**
   * Attach global event listeners
   */
  componentDidMount: function() {
    var node = ReactDOM.findDOMNode(this);
    node.addEventListener('mousedown', this._mouseDown);
    node.addEventListener('keydown', this._keyListener);
    node.addEventListener('keyup', this._keyListener);
  },

  /**
   * Remove global event listeners
   */
  componentWillUnmount: function() {
    var node = ReactDOM.findDOMNode(this);
    node.removeEventListener('mousedown', this._mouseDown);
    node.removeEventListener('keydown', this._keyListener);
    node.removeEventListener('keyup', this._keyListener);
  },

  /**
   * Renders the component
   * @return {ReactComponent}
   */
  render: function() {
    var boxStyle = {
      left: this.state.boxLeft,
      top: this.state.boxTop,
      width: this.state.boxWidth,
      height: this.state.boxHeight,
{'fraction_non_alphanumeric': 0.11733800350262696, 'fraction_numerical': 0.0015921031682853048, 'mean_word_length': 2.602064220183486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5440925', 'n_tokens_mistral': 1894, 'n_tokens_neox': 1852, 'n_words': 508}