<commit_before>
define [
  "underscore"
  "./has_properties"
  "./logging"
  "./selector"
], (_, HasProperties, Logging, Selector) ->

  logger = Logging.logger

  class SelectionManager extends HasProperties
    type: 'SelectionManager'

    initialize: (attrs, options) ->
      super(attrs, options)
      @selectors = {}

    select: (tool, renderer_view, geometry, final, append=false) ->
      source = @get('source')
      if source != renderer_view.mget('data_source')
        logger.warn('select called with mis-matched data sources')

      indices = renderer_view.hit_test(geometry)

      selector = @_get_selector(tool)
      selector.update(indices, geometry, final, append)

      @_save(selector)
      source.trigger('select')

    inspect: (tool, renderer_view, geometry, data) ->
      source = @get('source')
      if source != renderer_view.mget('data_source')
        logger.warn('inspect called with mis-matched data sources')

      indices = renderer_view.hit_test(geometry)

      if indices?
        source.trigger(
          'inspect', indices, tool, renderer_view, source, data
        )

    clear: (tool) ->
      selector = @_get_selector(tool)
      selector.clear()
      @_save(selector)
<commit_msg>add selector-specific events<commit_after>
define [
  "underscore"
  "./has_properties"
  "./logging"
  "./selector"
], (_, HasProperties, Logging, Selector) ->

  logger = Logging.logger

  class SelectionManager extends HasProperties
    type: 'SelectionManager'

    initialize: (attrs, options) ->
      super(attrs, options)
      @selectors = {}

    select: (tool, renderer_view, geometry, final, append=false) ->
      source = @get('source')
      if source != renderer_view.mget('data_source')
        logger.warn('select called with mis-matched data sources')

      indices = renderer_view.hit_test(geometry)

      selector = @_get_selector(tool)
      selector.update(indices, geometry, final, append)

      @_save(selector)
      source.trigger('select')
      source.trigger('select-' + renderer_view.mget('id'))

    inspect: (tool, renderer_view, geometry, data) ->
      source = @get('source')
      if source != renderer_view.mget('data_source')
        logger.warn('inspect called with mis-matched data sources')

      indices = renderer_view.hit_test(geometry)

      if indices?
        source.trigger(
          'inspect', indices, tool, renderer_view, source, data
        )
        source.trigger(
          'inspect' + renderer_view.mget('id'), indices, tool, renderer_view, source, data
        )

    clear: (tool) ->
      selector = @_get_selector(tool)
      selector.clear()
      @_save(selector)

{'fraction_non_alphanumeric': 0.12551517422255526, 'fraction_numerical': 0.0, 'mean_word_length': 2.985074626865672, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2268425', 'n_tokens_mistral': 801, 'n_tokens_neox': 783, 'n_words': 178}