             break
           else if @_cursorPos > bufferPos
             @_cursorPos--
-            # @_cursorPos ?= i
 
         if inputPos >= input.length
           @_resetBuffer(bufferPos + 1, @props.mask.length)

React = window?.React || require 'react'
jsdiff = require 'diff'

assert = require('chai').assert

DEFAULT_TRANSLATIONS =
  '9': /\d/

          char

    @_cursorPos = @_firstNonMaskIdx

    # TODO: Any way we can do this in one pass?
    value: @_maskedValue(@props.value || '')

  componentDidUpdate: ->
    @_setSelection(@_cursorPos) if @_cursorPos?

  componentDidMount: ->
    if @props.mask? && @props.onChange? && @props.value? && @state.value isnt @props.value
      @props.onChange(target: {value: @state.value})

  render: ->
    if @props.mask?
      props =
        onChange: @_handleChange
        onKeyDown: @_handleKeyDown
        onFocus: @_handleFocus
        value: @state.value
    else
      props = {}

    <input {...@props} {...props} />

