"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const styles_1 = require("@mui/material/styles");
const react_1 = require("react");
const BaseLightbox_1 = tslib_1.__importDefault(require("./BaseLightbox"));
const constants_1 = require("./constants");
const classes = {
    root: `${constants_1.PREFIX}-lightbox-root`
};
const Root = (0, styles_1.styled)(BaseLightbox_1.default, {
    name: constants_1.PREFIX,
    slot: 'LightboxRoot'
})(() => ({}));
function Lightbox(props) {
    // PROPS
    const { medias = [], index = 0, toolbarButtons, onClose, onIndexChange } = props, rest = tslib_1.__rest(props, ["medias", "index", "toolbarButtons", "onClose", "onIndexChange"]);
    const mediaToDataTypeMap = (0, react_1.useCallback)((media, index) => {
        return { src: media.image, width: media.image_width, height: media.image_height, key: index };
    }, []);
    /**
     * Renders root object
     */
    return ((0, jsx_runtime_1.jsx)(Root, Object.assign({}, rest, { className: classes.root, images: medias.map(mediaToDataTypeMap), visible: index !== -1, onClose: onClose, index: index, onIndexChange: onIndexChange, toolbarButtons: toolbarButtons })));
}
exports.default = Lightbox;
