 class ActivityInputView extends KDTokenizedInput
+  {JTag} = KD.remote.api
+
   constructor: (options = {}, data) ->
     options.cssClass         = KD.utils.curry "input-view", options.cssClass
     options.type           or= "html"

      tokenView.emit "viewAppended"
      return tokenView.getElement().outerHTML

  fillTokenMap = (tokens, map) ->
    tokens.forEach (token) ->
      map[token.getId()] = token

    @tokenInput.textContent = prefix + words.join "-"
    @utils.selectEnd @tokenInput

  selectToken: ->
    return  unless @menu
    {prefix} = @activeRule
    value = @tokenInput.textContent.substring(prefix.length).toLowerCase()
    tokens = @menu.getData().filter @getTokenFilter()
    for token in tokens
      if value is token.title.toLowerCase()
        @addToken token, @getOptions().tokenViewClass
        @hideMenu()
        return  true

  keyDown: (event) ->
    super
    return  if event.isPropagationStopped()
    switch event.which
      when 27 # Escape
        @emit "Escape"

    if /\s/.test String.fromCharCode event.which
      KD.utils.stopDOMEvent event  if @selectToken()

  focus: ->
    return  if @focused
