       ]
 
       @__jCropApi = $.Jcrop(@__img[0], jCropOptions)
-      @__setState 'loaded'

      @__originalSize = originalSize
      @__resizedSize = resizedSize

    #             |
    #             v
    #   +----> waiting <-----+
    #   |         |          |
    #   |         v          |
    # error <-         -> loaded
    __setState: (state) ->
      return if @__state is state
      @__state = state
      prefix = 'uploadcare-crop-widget--'
      @__widgetElement
        .removeClass((prefix + s for s in ['error', 'loaded', 'waiting']).join ' ')
        .addClass(prefix + state)

    __initJcrop: (previousCoords) ->
      jCropOptions =


    __buildWidget: ->
      @__widgetElement = $(tpl('crop-widget')).appendTo @container

    __clearImage: ->
      @__jCropApi?.destroy()
      @__img?.off().remove()
      @__deferred?.reject(IMAGE_CLEARED)
      @__deferred = $.Deferred()

    __setImage: (@__url) ->
      @__img = $('<img/>')
