"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = preview;

var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));

var _react = _interopRequireDefault(require("react"));

var _modalManager = _interopRequireDefault(require("../modal-manager"));

var _ModalContainer = require("../modal-container/ModalContainer");

var _PictureViewer = _interopRequireDefault(require("../picture/PictureViewer"));

function preview(_x, _x2) {
  return _preview.apply(this, arguments);
}

function _preview() {
  _preview = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(props, modalProps) {
    var container, customizedPrefixCls;
    return _regenerator["default"].wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            _context.next = 2;
            return (0, _ModalContainer.getContainer)();

          case 2:
            container = _context.sent;
            customizedPrefixCls = container.context.getProPrefixCls('picture-viewer', props.prefixCls);
            (0, _ModalContainer.open)((0, _objectSpread2["default"])({
              key: _modalManager["default"].getKey(),
              className: "".concat(customizedPrefixCls, "-modal"),
              border: false,
              header: null,
              footer: null,
              destroyOnClose: true,
              movable: false,
              closable: true,
              style: {
                width: 'auto'
              },
              fullScreen: true,
              maskClassName: "".concat(customizedPrefixCls, "-modal-mask"),
              children: /*#__PURE__*/_react["default"].createElement(_PictureViewer["default"], (0, _extends2["default"])({
                prefixCls: customizedPrefixCls
              }, props))
            }, modalProps));

          case 5:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _preview.apply(this, arguments);
}
//# sourceMappingURL=preview.js.map
