'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.originalImage = exports.originalJpegImage = exports.mediumImage = exports.smallImage = exports.thumbnailImage = exports.derivativeImage = exports.getDerivativePath = exports.getImageViewerPath = exports.DERIVATIVE_ORIGINAL = exports.DERIVATIVE_ORIGINAL_JPEG = exports.DERIVATIVE_MEDIUM = exports.DERIVATIVE_SMALL = exports.DERIVATIVE_THUMBNAIL = exports.VIEWER_WINDOW_NAME = undefined;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _BlobImage = require('../components/media/BlobImage');

var _BlobImage2 = _interopRequireDefault(_BlobImage);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var VIEWER_WINDOW_NAME = exports.VIEWER_WINDOW_NAME = 'viewer';

var DERIVATIVE_THUMBNAIL = exports.DERIVATIVE_THUMBNAIL = 'Thumbnail';
var DERIVATIVE_SMALL = exports.DERIVATIVE_SMALL = 'Small';
var DERIVATIVE_MEDIUM = exports.DERIVATIVE_MEDIUM = 'Medium';
var DERIVATIVE_ORIGINAL_JPEG = exports.DERIVATIVE_ORIGINAL_JPEG = 'OriginalJpeg';
var DERIVATIVE_ORIGINAL = exports.DERIVATIVE_ORIGINAL = '';

var getImageViewerPath = exports.getImageViewerPath = function getImageViewerPath(config, imagePath) {
  var basename = config.basename;


  return (basename || '') + '/view/' + imagePath;
};

var getDerivativePath = exports.getDerivativePath = function getDerivativePath(csid, derivative) {
  var derivativePath = derivative ? '/derivatives/' + derivative : '';

  return 'blobs/' + csid + derivativePath + '/content';
};

var derivativeImage = exports.derivativeImage = function derivativeImage(blobCsid, derivative) {
  return blobCsid ? _react2.default.createElement(_BlobImage2.default, { csid: blobCsid, derivative: derivative }) : null;
};

var thumbnailImage = exports.thumbnailImage = function thumbnailImage(blobCsid) {
  return derivativeImage(blobCsid, DERIVATIVE_THUMBNAIL);
};

var smallImage = exports.smallImage = function smallImage(blobCsid) {
  return derivativeImage(blobCsid, DERIVATIVE_SMALL);
};

var mediumImage = exports.mediumImage = function mediumImage(blobCsid) {
  return derivativeImage(blobCsid, DERIVATIVE_MEDIUM);
};

var originalJpegImage = exports.originalJpegImage = function originalJpegImage(blobCsid) {
  return derivativeImage(blobCsid, DERIVATIVE_ORIGINAL_JPEG);
};

var originalImage = exports.originalImage = function originalImage(blobCsid) {
  return derivativeImage(blobCsid, DERIVATIVE_ORIGINAL);
};