"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var a=require("styled-components"),t=require("../../utils/index.js"),g=require("./utils.js");function c(e){return e&&e.__esModule?e:{default:e}}var o=c(a);const i=200,l=a.keyframes`
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
`,d=a.keyframes`
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
`,p=o.default.div.withConfig({shouldForwardProp:t.convertToTransientProps(["isOpen"])})`
  inset: 0;
  position: fixed;
  background-color: ${t.getColorAlias("overlay")};
  z-index: 5000;

  display: flex;
  justify-content: center;

  ${e=>e.isOpen?a.css`
          animation: ${l} ${i}ms forwards;
        `:a.css`
          animation: ${d} ${i}ms ${i}ms
            forwards;
        `}
`,u=o.default.div`
  --height-offset: ${({position:e})=>e==="top"?2:1};
  --dialog-gutter: ${({variant:e})=>e==="narrow"?t.getSpacing("s04"):t.getSpacing("s05")};
  max-height: calc(100vh - ${t.getSpacing("s09")} * var(--height-offset));
  width: calc(100vw - 60px);
  max-width: ${({size:e})=>g.getModalSize(e)};
  display: flex;
  flex-direction: column;
  font-family: ${e=>e.theme.font.familyPrimary};
  background-color: ${t.getColorAlias("backgroundDefault")};
  color: ${t.getColorAlias("contentDefault")};
  position: fixed;
  padding-top: var(--dialog-gutter);
  padding-bottom: var(--dialog-gutter);
  box-shadow: ${e=>e.theme.elevation.e4};
  outline: none;
  border-radius: ${t.getSpacing("s04")};
  overflow-y: auto;

  ${({position:e})=>e==="center"?a.css`
          align-self: center;
        `:a.css`
          margin-top: ${t.getSpacing("s10")};
          @media (max-height: 600px) {
            margin-top: 5vh;
          }
        `};
`,f=o.default.div`
  --header-gutter: ${({variant:e})=>e==="narrow"?t.getSpacing("s04"):t.getSpacing("s05")};
  padding-left: var(--header-gutter);
  padding-right: var(--header-gutter);
  position: sticky;
  top: ${t.getSpacing("s00")};

  button {
    position: absolute;
    right: var(--header-gutter);
    top: calc(${t.getSpacing("s02")} * -1);
    width: ${t.getSpacing("s07")};
    height: ${t.getSpacing("s07")};

    svg {
      width: ${t.getSpacing("s05")};
      height: ${t.getSpacing("s05")};
      fill: ${t.getColorAlias("contentDefault")};
    }

    @media print {
      display: none;
    }
  }
`,h=o.default.h1.withConfig({shouldForwardProp:t.convertToTransientProps(["hideCloseIcon"])})`
  ${({variant:e})=>e==="narrow"?t.getFontSize("size20"):t.getFontSize("size24")}
  color: ${t.getColorAlias("contentDefault")};
  margin-top: ${t.getSpacing("s00")};
  margin-right: ${t.getSpacing("s00")};
  margin-bottom: ${t.getSpacing("s04")};
  margin-left: ${t.getSpacing("s00")};
  font-weight: 800;
  word-break: break-word;

  ${({hideCloseIcon:e})=>!e&&a.css`
      width: calc(100% - ${t.getSpacing("s08")});
    `};

  ${({mode:e})=>e==="truncated"&&a.css`
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    `};
`,$=o.default.div.withConfig({shouldForwardProp:t.convertToTransientProps(["pinnedFooter","stackedActionButtons"])})`
  --content-margin: calc(${t.getSpacing("s10")} - ${t.getSpacing("s01")});
  --content-gutter: ${({variant:e})=>e==="narrow"?t.getSpacing("s04"):t.getSpacing("s05")};
  overflow-y: auto;
  padding-left: var(--content-gutter);
  padding-right: var(--content-gutter);

  ${({pinnedFooter:e,action:n,stackedActionButtons:r,theme:s})=>e&&n&&a.css`
      margin-bottom: calc(
        var(--content-margin) *
          ${r&&n==="confirm"?2:1}
      );

      ${s.mode==="light"&&a.css`
        /* Shadow if content is scrollable */
        background: linear-gradient(white 30%, transparent) center top,
          linear-gradient(transparent, white 70%) center bottom,
          radial-gradient(farthest-side at 50% 0, transparent, rgba(0, 0, 0, 0))
            center top,
          radial-gradient(
              farthest-side at 50% 100%,
              rgba(0, 0, 0, 0.3),
              rgba(0, 0, 0, 0)
            )
            center bottom;

        background-repeat: no-repeat;
        background-size: 100% 40px, 100% 40px, 100% 14px, 110% 14px;
        background-attachment: local, local, scroll, scroll;
      `}
    `};
`,m=o.default.div.withConfig({shouldForwardProp:t.convertToTransientProps(["pinnedFooter","stackedActionButtons"])})`
  display: flex;
  box-sizing: initial;

  ${({stackedActionButtons:e})=>e?a.css`
          flex-direction: column;
          justify-content: center;

          button {
            &:not(:last-child) {
              margin-bottom: ${t.getSpacing("s04")};
            }
          }
        `:a.css`
          justify-content: flex-end;

          button {
            &:not(:last-child) {
              margin-right: ${t.getSpacing("s04")};
            }
          }
        `}

  ${({pinnedFooter:e,variant:n})=>e?a.css`
          --footer-gutter: ${n==="narrow"?t.getSpacing("s04"):t.getSpacing("s05")};
          position: absolute;
          bottom: 0;
          left: 0;
          width: calc(100% - var(--footer-gutter) * 2);
          padding: var(--footer-gutter);
        `:a.css`
          margin-top: ${t.getSpacing("s05")};
        `}
`,v=o.default.div`
  display: flex;
  align-items: center;
  justify-content: center;
  height: 188px;
`;exports.Dialog=u;exports.ModalFooter=m;exports.ModalLoadingWrapper=v;exports.ModalTitle=h;exports.Overlay=p;exports.StyledModalContent=$;exports.StyledModalHeader=f;
