"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _chunk4VVPSX5Ocjs = require('./chunk-4VVPSX5O.cjs');


var _chunk3JTH7BHIcjs = require('./chunk-3JTH7BHI.cjs');


var _chunkDDGSFIWAcjs = require('./chunk-DDGSFIWA.cjs');


var _chunkZU72XWNEcjs = require('./chunk-ZU72XWNE.cjs');


var _chunkWF7Z2VITcjs = require('./chunk-WF7Z2VIT.cjs');


var _chunkGH54P25Bcjs = require('./chunk-GH54P25B.cjs');


var _chunkOBHJBBPCcjs = require('./chunk-OBHJBBPC.cjs');


var _chunkKW3JYLRIcjs = require('./chunk-KW3JYLRI.cjs');


var _chunkQQDRBCBYcjs = require('./chunk-QQDRBCBY.cjs');

// src/components/Banner/Banner.tsx
var _styled = require('@emotion/styled'); var _styled2 = _interopRequireDefault(_styled);
var _react = require('react');
var _jsxruntime = require('@emotion/react/jsx-runtime');
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] = _react.useState.call(void 0, 70);
  const resizeProps = _react.useMemo.call(void 0, () => ["height"], []);
  const { ref, rect } = _chunk3JTH7BHIcjs.useResizeObserver.call(void 0, resizeProps);
  _react.useEffect.call(void 0, () => {
    if (bgProgressDuration) {
      setTimeout(() => {
        setWidth(100);
      }, 0);
    }
  }, [bgProgressDuration]);
  _react.useEffect.call(void 0, () => {
    if (onHeightChange && typeof (rect == null ? void 0 : rect.height) === "number") {
      onHeightChange(rect.height);
    }
  }, [onHeightChange, rect == null ? void 0 : rect.height]);
  let contentNode = null;
  if (content) {
    const contentNodes = _chunkDDGSFIWAcjs.toReactNodes.call(void 0, content);
    if (to) {
      contentNode = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGH54P25Bcjs.Link, { to, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, BannerFlexInnerContent, { children: [
        contentNodes,
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWF7Z2VITcjs.Icon, { name: "ArrowRight", width: 12, ml: 6 })
      ] }) });
    } else {
      contentNode = contentNodes;
    }
  }
  const innerContent = content ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
    BannerInnerContent,
    {
      isVisible: Boolean(content),
      maxMdContentJustify: maxMdContentJustify || "center",
      children: contentNode
    }
  ) : null;
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, 
    StyledBanner,
    {
      colorProp: color,
      borderColor,
      isVisible: Boolean(content),
      offsetTop,
      hasSideContent: Boolean(right || left),
      ref,
      borderProgress,
      hPadding,
      vPadding,
      minHeight,
      fixed,
      blurScroll,
      children: [
        left,
        innerContent,
        right,
        bgProgressDuration && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
          BannerGradientBg,
          {
            duration: bgProgressDuration,
            width,
            isVisible: Boolean(content)
          }
        )
      ]
    }
  );
}
var BannerInnerContent = _styled2.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 }) => _chunkKW3JYLRIcjs.bp.maxMd(
  maxMdContentJustify ? `justify-content: ${maxMdContentJustify};` : ""
)};
  }
`;
var StyledBanner = _styled2.default.div`
  ${({ fixed }) => fixed ? "position: fixed; left: 0;" : ""};

  width: 100%;
  z-index: ${_chunkZU72XWNEcjs.z.notificationBanner};
  color: ${_chunkQQDRBCBYcjs.colors.white};
  font-weight: 500;
  background-color: ${({ colorProp, theme }) => colorProp ? _chunkOBHJBBPCcjs.getColor.call(void 0, 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 ${_chunkOBHJBBPCcjs.getColor.call(void 0, theme, borderColor)};` : ""}

  ${({ borderProgress }) => {
  if (typeof borderProgress === "number") {
    return `
        &:before {
          content: "";
          position: absolute;
          left: 0;
          width: 100%;
          background-color: #C1C5CD;
          top: 0;
          height: 4px;
          ${_chunkKW3JYLRIcjs.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;
          ${_chunkKW3JYLRIcjs.bp.sm(`
            height: 2px;
            top: initial;
            bottom: 0;
          `)}
        }
      `;
  }
  return "";
}}

  ${_chunkKW3JYLRIcjs.bp.sm(`
    z-index: ${_chunkZU72XWNEcjs.z.smBanner};
  `)}
`;
var BannerGradientBg = _styled2.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 ${_chunk4VVPSX5Ocjs.bannerTiming};
  height: ${({ isVisible }) => isVisible ? "auto" : "0"}px;

  transition: width ${({ duration }) => duration}s
    cubic-bezier(0.33, 0.54, 0.47, 0.87);
`;
var BannerFlexInnerContent = _styled2.default.div`
  display: flex;
  align-items: center;
  justify-content: center;
`;



exports.Banner = Banner;
