<div ng-switch="::document.isSpecial">

  <div ng-switch-when="gif" my-load-gif document="document"></div>

  <div ng-switch-when="sticker">
    <img
      class="im_message_sticker"
      my-load-thumb
      thumb="document.thumb"
    />
  </div>

  <div ng-switch-when="audio" class="im_message_audio">
    <div my-audio-player audio="document"></div>
  </div>

  <div ng-switch-default class="im_message_document clearfix" ng-class="{im_message_document_thumbed: !!document.thumb, im_message_document_progress: document.progress.enabled}">

    <a ng-if="::!document.thumb" class="im_message_file_button" ng-click="docOpen()" ng-class="{im_message_file_button_dl_doc: document.downloaded}">
      <i class="im_message_file_button_icon"></i>
    </a>
    <a ng-if="::document.thumb" ng-click="docOpen()">
      <div class="im_message_document_thumb_wrap">
        <img
          class="im_message_document_thumb"
          my-load-thumb
          thumb="document.thumb"
        />
      </div>
    </a>

    <div class="im_message_document_info">
      <div class="im_message_document_name_wrap">
        <a href="" ng-click="docOpen()" class="im_message_document_name" ng-bind="::document.file_name"></a>
        <span class="im_message_document_size" ng-if="!document.progress.enabled" ng-bind="::document.size | formatSize"></span>
        <span class="im_message_document_size" ng-if="document.progress.enabled" ng-bind="document.progress | formatSizeProgress"></span>
      </div>
      <div class="im_message_document_actions" ng-if="!document.progress.enabled" ng-switch="document.downloaded">
        <a ng-switch-when="true" href="" ng-click="docSave()" my-i18n="message_attach_document_save"></a>
        <a ng-switch-default href="" ng-click="docSave()" my-i18n="message_attach_document_download"></a>
        <a ng-if="::document.withPreview" href="" ng-click="docOpen()" my-i18n="message_attach_document_open"></a>
      </div>
      <div class="clearfix im_message_cancelable_progress_wrap" ng-if="document.progress.enabled">
        <a class="im_message_media_progress_cancel pull-right" ng-click="document.progress.cancel()" my-i18n="modal_cancel"></a>
        <div class="im_message_download_progress_wrap">
          <div class="progress tg_down_progress">
            <div class="progress-bar progress-bar-success" ng-style="{width: document.progress.percent + '%'}"></div>
          </div>
        </div>
      </div>
    </div>

  </div>
</div>
