import{jsx as i,jsxs as t}from"react/jsx-runtime";import{useState as o,useEffect as m}from"react";import{styled as s}from"../styled-components.js";const n="Invalid license key",g=n+": missing key",d="Invalid license key: expired",y=d,v="Invalid license key: host not allowed",E=({licenseInfo:e})=>{const[r,a]=o(null),[l,h]=o(-1),[p,x]=o(!1);return m(()=>{if(e.local){x(!0);return}e.valid?e.allowed?e.expired&&a(e.t?d:y):a(v):a(e.valid===!1?n+(e.cryptoMissing?": works only with https":""):g),e.t&&h(Math.ceil(((e?.e??0)-Date.now()/1e3)/60/60/24))},[e]),p?t(c,{children:[i("a",{href:"https://redoc.ly",children:"Redocly API reference docs"})," preview"]}):!r&&l>-1?t(c,{children:[" Trial version: ",l," days remaining "]}):r?i(f,{children:t("span",{children:[r," ",i("br",{}),t("small",{children:["Please contact ",i("a",{href:"mailto:team@redoc.ly",children:"team@redoc.ly"})," to remedy the problem."," "]})]})}):null},c=s.div`
  padding: 10px 40px;
  position: fixed;
  text-align: right;
  width: 100%;
  box-sizing: border-box;
  color: orange;
  z-index: var(--z-index-surface);
  opacity: 0.6;

  > a,
  a:visited {
    color: orange;
  }
`,f=s.div`
  font-size: 1.5em;
  position: fixed;
  z-index: var(--z-index-raised);
  background: rgba(38, 50, 56, 0.93);
  margin: 0;
  padding: 1em;
  width: 100%;
  color: white;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;

  text-align: center;
  box-sizing: border-box;

  > span {
    display: inline-block;
    line-height: 1.5;
  }

  a,
  a:hover,
  a:visited {
    color: white;
  }
`;export{E as Overlay};
