Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_chunk = require("../../chunk-BN4qSVkS.cjs");
const require_styles_breakpoints = require("../../styles/breakpoints.cjs");
const require_styles_colors = require("../../styles/colors.cjs");
const require_styles_themes = require("../../styles/themes.cjs");
const require_router = require("../../router.cjs");
const require_components_Icon_Icon = require("../Icon/Icon.cjs");
const require_utils_toReactNodes_toReactNodes = require("../../utils/toReactNodes/toReactNodes.cjs");
const require_hooks_useResizeObserver = require("../../hooks/useResizeObserver.cjs");
const require_styles_z_index = require("../../styles/z-index.cjs");
const require_components_Banner_constants = require("./constants.cjs");
let _emotion_styled = require("@emotion/styled");
_emotion_styled = require_chunk.__toESM(_emotion_styled);
let react = require("react");
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
//#region src/components/Banner/Banner.tsx
function Banner({ content, to, color, maxMdContentJustify, offsetTop = 0, onHeightChange, right, left, fixed, bgProgressDuration, borderProgress, minHeight = 0, hPadding = 0, vPadding = 0, borderColor, blurScroll = false }) {
	const [width, setWidth] = (0, react.useState)(70);
	const { ref, rect } = require_hooks_useResizeObserver.useResizeObserver((0, react.useMemo)(() => ["height"], []));
	(0, react.useEffect)(() => {
		if (bgProgressDuration) setTimeout(() => {
			setWidth(100);
		}, 0);
	}, [bgProgressDuration]);
	(0, react.useEffect)(() => {
		if (onHeightChange && typeof rect?.height === "number") onHeightChange(rect.height);
	}, [onHeightChange, rect?.height]);
	let contentNode = null;
	if (content) {
		const contentNodes = require_utils_toReactNodes_toReactNodes.toReactNodes(content);
		if (to) contentNode = /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_router.Link, {
			to,
			children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(BannerFlexInnerContent, { children: [contentNodes, /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_Icon_Icon.Icon, {
				name: "ArrowRight",
				width: 12,
				ml: 6
			})] })
		});
		else contentNode = contentNodes;
	}
	return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(StyledBanner, {
		colorProp: color,
		borderColor,
		isVisible: Boolean(content),
		offsetTop,
		hasSideContent: Boolean(right || left),
		ref,
		borderProgress,
		hPadding,
		vPadding,
		minHeight,
		fixed,
		blurScroll,
		children: [
			left,
			content ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(BannerInnerContent, {
				isVisible: Boolean(content),
				maxMdContentJustify: maxMdContentJustify || "center",
				children: contentNode
			}) : null,
			right,
			bgProgressDuration && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(BannerGradientBg, {
				duration: bgProgressDuration,
				width,
				isVisible: Boolean(content)
			})
		]
	});
}
const BannerInnerContent = _emotion_styled.default.div`
  z-index: 1;
  padding: ${({ isVisible }) => isVisible ? `0px 17.5px` : "0px"};
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  & > * {
    position: relative;
    z-index: 1;
    width: 100%;

    ${({ maxMdContentJustify }) => require_styles_breakpoints.bp.maxMd(maxMdContentJustify ? `justify-content: ${maxMdContentJustify};` : "")};
  }
`;
const StyledBanner = _emotion_styled.default.div`
  ${({ fixed }) => fixed ? "position: fixed; left: 0;" : ""};

  width: 100%;
  z-index: ${require_styles_z_index.z.notificationBanner};
  color: ${require_styles_colors.colors.white};
  font-weight: 500;
  background-color: ${({ colorProp, theme }) => colorProp ? require_styles_themes.getColor(theme, colorProp) : "none"};
  ${({ blurScroll }) => blurScroll ? `
      background: rgba(249, 249, 249, 0.8);
      backdrop-filter: blur(32px);
      ` : ""}
  display: flex;
  justify-content: ${({ hasSideContent }) => hasSideContent ? "space-between" : "center"};
  align-items: center;
  padding: ${({ hPadding, vPadding }) => `${vPadding}px ${hPadding}px`};
  min-height: ${({ minHeight }) => typeof minHeight === "number" ? `${minHeight}px` : "auto"};
  ${({ borderColor, theme }) => borderColor ? `border-bottom: 1px solid ${require_styles_themes.getColor(theme, borderColor)};` : ""}

  ${({ borderProgress }) => {
	if (typeof borderProgress === "number") return `
        &:before {
          content: "";
          position: absolute;
          left: 0;
          width: 100%;
          background-color: #C1C5CD;
          top: 0;
          height: 4px;
          ${require_styles_breakpoints.bp.sm(`
            height: 2px;
            top: initial;
            bottom: 0;
          `)}
        }
        &:after {
          content: "";
          position: absolute;
          bottom: 0;
          left: 0;
          width: ${borderProgress}%;
          background-color: #2B66C2;
          transition: width 0.3s ease-in;
          top: 0;
          height: 4px;
          ${require_styles_breakpoints.bp.sm(`
            height: 2px;
            top: initial;
            bottom: 0;
          `)}
        }
      `;
	return "";
}}

  ${require_styles_breakpoints.bp.sm(`
    z-index: ${require_styles_z_index.z.smBanner};
  `)}
`;
const BannerGradientBg = _emotion_styled.default.div`
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: ${({ width }) => width}%;
  height: 100%;

  background: linear-gradient(
    90deg,
    #000000 -25.9%,
    #1b4077 14.55%,
    #a152c7 82.22%,
    #3f2e7e 115.32%
  );

  transition: all ${require_components_Banner_constants.bannerTiming};
  height: ${({ isVisible }) => isVisible ? "auto" : "0"}px;

  transition: width ${({ duration }) => duration}s
    cubic-bezier(0.33, 0.54, 0.47, 0.87);
`;
const BannerFlexInnerContent = _emotion_styled.default.div`
  display: flex;
  align-items: center;
  justify-content: center;
`;
//#endregion
exports.Banner = Banner;
