import { b as __makeTemplateObject, _ as __assign } from '../tslib.es6-faad35dc.js';
import { k as keyframes, c as css, j as jsxs, a as jsx } from '../emotion-react.esm-0cec8e54.js';
import MuiBox from '@mui/material/Box';
import { styled, useTheme } from '@mui/material/styles';
import Icon, { iconSizeMap } from './Icon.js';
import 'react';
import 'react/jsx-runtime';
import '../icons/ArrowLeft.js';
import '../icons/ArrowRight.js';
import '../icons/CloseCircle.js';
import '../icons/InfoCircle.js';
import '../icons/ErrorCircle.js';
import '../icons/Attention.js';
import '../icons/HelpCircle.js';
import '../icons/Document.js';
import '../icons/DocumentText.js';
import '../icons/Lock.js';
import '../icons/Delete.js';
import '../icons/Users.js';
import '../icons/Stakefish.js';
import '../icons/Sound.js';
import '../icons/Beacon.js';
import '../icons/TriangleRight.js';
import '../icons/TriangleLeft.js';
import '../icons/TriangleUp.js';
import '../icons/TriangleDown.js';
import '../icons/Sent.js';
import '../icons/Download.js';
import '../icons/Faster.js';
import '../icons/Slower.js';
import '../icons/Usb.js';
import '../icons/Key.js';
import '../icons/Edit.js';
import '../icons/Expand.js';
import '../icons/Collapse.js';
import '../icons/Success.js';
import '../icons/SuccessCircle.js';
import '../icons/Fail.js';
import '../icons/Desktop.js';
import '../icons/Mobile.js';
import '../icons/Loading.js';
import '../icons/Upload.js';
import '../icons/Check.js';
import '../icons/ChevronLeft.js';
import '../icons/ChevronRight.js';
import '../icons/Plus.js';
import '../icons/Minus.js';
import '../icons/Globe.js';
import '../icons/Link.js';
import '../icons/Copy.js';
import '../icons/Medium.js';
import '../icons/Twitter.js';
import '../icons/Telegram.js';
import '../icons/Eth.js';
import '../icons/Sort.js';
import '../icons/Close.js';
import '../icons/DollarSign.js';
import '../icons/Search.js';
import '../icons/Range.js';
import '../icons/Instagram.js';
import '../icons/LinkedIn.js';
import '../icons/Reddit.js';
import '../icons/YouTube.js';
import '../icons/Chrome.js';
import '../icons/CloudConnect.js';
import '../icons/Update.js';
import '../icons/Menu.js';
import '../icons/Settings.js';

/**
 * Constants
 */
var STROKE_WIDTH = 3;
var iconPaddingMap = {
    xs2: 4,
    xs1: 4,
    sm: 4,
    md: 8,
    lg: 8,
    xl1: 16,
    xl2: 16,
    xl3: 16
};
/**
 * Styles
 */
var StyledProgressCircle = styled("circle")(function () { return ({
    strokeDasharray: 180,
    strokeDashoffset: 90
}); });
var LoadingIconBox = styled(MuiBox)(function () { return ({
    height: "100%",
    "& svg": {
        display: "block",
        height: "100%"
    }
}); });
var IconBox = styled(MuiBox)(function (_a) {
    var $size = _a.$size;
    return ({
        position: "absolute",
        top: 0,
        left: 0,
        width: "100%",
        height: "100%",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        padding: iconPaddingMap[$size],
        "& .icon": {
            height: "100%"
        }
    });
});
var LoadingIconRoot = styled(MuiBox)(function (_a) {
    var $size = _a.$size;
    return ({
        position: "relative",
        width: iconSizeMap[$size],
        height: iconSizeMap[$size]
    });
});
var progressEffect = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  0% {\n    stroke-dashoffset: 0;\n  }\n  100% {\n    stroke-dashoffset: 360;\n  }\n"], ["\n  0% {\n    stroke-dashoffset: 0;\n  }\n  100% {\n    stroke-dashoffset: 360;\n  }\n"
    /**
     * Main
     */
])));
/**
 * Main
 */
var LoadingIcon = function (_a) {
    var _b;
    var _c = _a.size, size = _c === void 0 ? "xl2" : _c, iconProps = _a.iconProps;
    var theme = useTheme();
    var animatedRing = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n    transform-origin: center;\n    animation: ", " 1.5s ease-in-out infinite;\n  "], ["\n    transform-origin: center;\n    animation: ", " 1.5s ease-in-out infinite;\n  "])), progressEffect);
    return (jsxs(LoadingIconRoot, __assign({ "$size": size }, { children: [jsx(LoadingIconBox, { children: jsxs("svg", __assign({ viewBox: "0 0 48 48", fill: "none" }, { children: [jsx("circle", { id: "loadingIcon__ring", cx: "24", cy: "24", r: "22", strokeLinecap: "round", stroke: theme.palette.gray[300], strokeWidth: STROKE_WIDTH }, void 0), jsx(StyledProgressCircle, { id: "loadingIcon__progressRing", cx: "24", cy: "24", r: "22", strokeLinecap: "round", stroke: theme.palette.gray[900], strokeWidth: STROKE_WIDTH, css: animatedRing }, void 0), jsx("circle", { id: "loadingIcon__radius", cx: "24", cy: "24", r: "18", fill: theme.palette.gray[100] }, void 0)] }), void 0) }, void 0), jsx(IconBox, __assign({ "$size": size }, { children: jsx(Icon, __assign({}, iconProps, { iconKey: (_b = iconProps === null || iconProps === void 0 ? void 0 : iconProps.iconKey) !== null && _b !== void 0 ? _b : "cloudConnect" }), void 0) }), void 0)] }), void 0));
};
var templateObject_1, templateObject_2;

export { LoadingIcon as default };
