import e,{useState as m}from"react";import s from"styled-components";import{Button as d}from"@redocly/theme/components/Button/Button";import{H3 as p}from"@redocly/theme/components/Typography/H3";import{ServerRoutes as u}from"../../../../constants/index.js";function g(){const t=new URLSearchParams(window.location.search);return{code:t.get("code")||"",org:t.get("org")||"",invitedBy:t.get("invitedBy")||""}}function w(){const{code:t,org:a,invitedBy:i}=g(),[o,l]=m(t),c=async r=>{if(r.preventDefault(),!o)return;const n=new URL(u.IDP_LOGIN,window.location.href);n.searchParams.set("inviteCode",o),n.searchParams.set("redirectTo","/"),window.location.href=n.toString()};return e.createElement(f,null,e.createElement(p,null,"Join ",a||"Redocly"),e.createElement("form",{onSubmit:c},e.createElement("div",{className:"form-content"},!t&&e.createElement(e.Fragment,null,e.createElement("span",{className:"label"},"Enter your invite code"),e.createElement("input",{type:"text",value:o,onChange:r=>l(r.target.value),placeholder:"Invite code",autoFocus:!0})),i&&e.createElement("div",{className:"invite-info"},e.createElement("strong",null,i)," has invited you to join"," ",e.createElement("strong",null,a||"Redocly")),e.createElement(d,{fullWidth:!0,size:"large",variant:"primary",type:"submit",disabled:!o},"Accept invite"))))}const f=s.div`
  font-family: var(--font-family-base);
  display: flex;
  justify-content: center;
  flex-direction: column;
  max-width: 90%;
  width: 450px;
  margin: auto;
  min-height: calc(100vh - var(--navbar-height));
  gap: 10px;

  h3 {
    color: var(--color-blue-6);
    font-size: 38px;
    font-weight: 600;
    letter-spacing: 1.9px;
    line-height: 1;
    margin-top: 0;
    margin-bottom: 24px;
    text-align: center;
  }

  .form-content {
    text-align: center;
  }

  input {
    outline: 0;
    border: 0;
    padding: 20px 30px;
    margin-bottom: 16px;
    background-color: var(--layer-color);
    border-bottom: 1px solid var(--border-color-primary);
    width: 100%;
    font-size: 16px;
    transition: border-color 0.25s ease;

    &:focus {
      border-color: var(--color-blue-6);
    }
  }

  .label {
    display: inline-block;
    text-align: left;
    width: 100%;
    font-size: 12px;
    color: #555;
    margin-bottom: 8px;
    margin-left: 16px;
  }

  .invite-info {
    margin-bottom: 16px;
    color: var(--color-gray-6);
    font-size: 14px;
  }
`;export{w as default};
