"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var themed_components_1 = __importDefault(require("@monstrosity/utilities/themed-components"));
var pose_1 = require("@monstrosity/utilities/themed-components/pose");
var apply_opacity_1 = require("@monstrosity/utilities/apply-opacity/apply-opacity");
var StyledMask = themed_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  left: 0px;\n  top: 0px;\n  width: 100%;\n  height: 100%;\n  position: fixed;\n  background-color: ", "; /* Make this sorta opaque */\n \n  cursor: auto;\n \n  & :hover {\n    cursor: auto;\n  }\n"], ["\n  left: 0px;\n  top: 0px;\n  width: 100%;\n  height: 100%;\n  position: fixed;\n  background-color: ", "; /* Make this sorta opaque */\n \n  cursor: auto;\n \n  & :hover {\n    cursor: auto;\n  }\n"])), function (_a) {
    var theme = _a.theme, opacity = _a.opacity;
    return apply_opacity_1.ApplyOpacity(theme.style.colour.constrast, opacity);
});
var PosedMask = pose_1.themedPosed(StyledMask)({
    'hidden': {
        'applyAtEnd': {
            'display': 'none',
            'zIndex': function (_a) {
                var theme = _a.theme;
                return theme.zIndex.behind;
            },
        },
        'opacity': 0,
        'transition': {
            'opacity': { 'ease': 'easeOut', 'duration': 300 },
        },
    },
    'visible': {
        'applyAtStart': {
            'display': 'block',
            'zIndex': function (_a) {
                var theme = _a.theme;
                return theme.zIndex.mask;
            },
        },
        'opacity': function (_a) {
            var opacity = _a.opacity;
            return opacity;
        },
        'transition': {
            'opacity': { 'ease': 'easeIn', 'duration': 150 },
        },
    },
});
exports.Mask = function (_a) {
    var isVisible = _a.isVisible, onClick = _a.onClick, opacity = _a.opacity;
    return react_1.default.createElement(PosedMask, { pose: isVisible ? 'visible' : 'hidden', opacity: opacity || 0.5, onClick: onClick });
};
var templateObject_1;
