"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotificationStackContainer = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const inject_style_1 = require("react-toastify-next/dist/inject-style");
const classNames_1 = require("../../utils/classNames");
const constants_1 = require("../constants");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
if (typeof window !== 'undefined') {
    (0, inject_style_1.injectStyle)();
}
const NotificationStackContainer = ({ containerId = constants_1.NOTIFY_CONTAINER_ID, staticContainerId = constants_1.NOTIFY_STATIC_CONTAINER_ID, bannerContainer, closeButton, ...props }) => {
    const { isVisibleCloseButton, isStackExpanded, isStartedClosingNotify, closeAll, } = (0, useLogic_1.useLogic)({
        containerId,
    });
    return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: (0, classNames_1.classNames)({
            [constants_1.notifyClassnames.container]: isStackExpanded,
        }), children: [(0, jsx_runtime_1.jsx)("div", { className: constants_1.notifyClassnames.stackHost, children: (0, jsx_runtime_1.jsx)(styles_1.Inner, { ...props, className: (0, classNames_1.classNames)(constants_1.notifyClassnames.stack, props.className), ...{ stacked: true }, containerId: containerId, pauseOnFocusLoss: true, position: constants_1.NOTIFY_POSITIONS.BOTTOM_RIGHT, newestOnTop: false, closeOnClick: false, draggable: false, rtl: false, closeButton: false, bodyClassName: `${constants_1.notifyClassnames.body}`, toastClassName: constants_1.notifyClassnames.root, progressClassName: `${constants_1.notifyClassnames.progress}` }) }), isVisibleCloseButton && ((0, jsx_runtime_1.jsx)(styles_1.CloseButton, { size: "small", variant: "light", color: "grey", className: (0, classNames_1.classNames)({
                    [constants_1.notifyClassnames.closeButtonAnimationOut]: isStartedClosingNotify,
                }), onClick: closeAll, children: "\u0421\u043A\u0440\u044B\u0442\u044C \u0432\u0441\u0435" })), (0, jsx_runtime_1.jsx)(styles_1.StaticInner, { containerId: staticContainerId, position: constants_1.NOTIFY_POSITIONS.BOTTOM_RIGHT, newestOnTop: false, closeOnClick: false, draggable: false, rtl: false, closeButton: false, bodyClassName: `${constants_1.notifyClassnames.body}`, toastClassName: constants_1.notifyClassnames.root, progressClassName: `${constants_1.notifyClassnames.progress}` }), bannerContainer] }));
};
exports.NotificationStackContainer = NotificationStackContainer;
