"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SmoothTransitionLoader = SmoothTransitionLoader;
exports.wrapperClassName = exports.hiddenWrapperClassName = void 0;
var _react = _interopRequireDefault(require("react"));
var _useTranslation = require("../hooks/use-translation");
var _message = require("../message");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const wrapperClassName = exports.wrapperClassName = 'smooth-transition-content';
const hiddenWrapperClassName = exports.hiddenWrapperClassName = 'smooth-transition-content-hidden';
/** The component designed to render loading state for charts
 * @midnight-gray-supported
 * @alpine-light-supported
 */
function SmoothTransitionLoader({
  children,
  isLoading,
  loadingMessage,
  loaderTestId = 'smooth-transition-prerender-loader',
  wrapperTestId = 'smooth-transition-prerender-wrapper'
}) {
  const {
    t
  } = (0, _useTranslation.useTranslation)();
  const loader = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
    className: "smooth-transition-prerender-loader",
    "test-id": loaderTestId,
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_message.Message, {
      type: _message.MESSAGE_TYPES.IN_PROGRESS,
      isCentered: true,
      children: loadingMessage ?? t('Initializing Data')
    })
  });
  if (!children) {
    return loader;
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
    children: [isLoading && loader, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      "test-id": wrapperTestId,
      className: isLoading ? hiddenWrapperClassName : wrapperClassName,
      children: children
    })]
  });
}