     __prepareTabs: (tab) ->
       @addTab 'preview'
       @__hideTab 'preview'
-      
+
       @addTab tabName for tabName in @settings.tabs
       @switchTab(tab || @settings.tabs[0])
 

      return promise

    apiForTab: (tabName) ->
      api = 
        avalibleTabs: @settings.tabs
        fileColl: @files.readOnly()
        onSwitched: $.Callbacks()

  class Dialog
    constructor: (@settings, files, tab) ->

      if files
        unless $.isArray(files)
          files = [files]
      else
        files = []

      @dfd = $.Deferred()
      @dfd.always =>
        @__closeDialog()

      @content = $(tpl('dialog'))
        .hide()
        .appendTo('body')
        .addClass(if @settings.multiple then 'uploadcare-dialog-multiple')

      @files = new utils.CollectionOfPromises()

      @__bind()
