(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[626],{4347:function(e,t,n){Promise.resolve().then(n.bind(n,1870))},1870:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return l}});var r=n(7437),a=n(2265),s=n(9376);let i=a.forwardRef(function(e,t){let{title:n,titleId:r,...s}=e;return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},s),n?a.createElement("title",{id:r},n):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"}))});function l(){let[e,t]=(0,a.useState)(""),[n,l]=(0,a.useState)(null),c=(0,s.useSearchParams)();(0,a.useEffect)(()=>{"false"===c.get("success")&&l("Authentication failed. Please try again.")},[c]);let o=async t=>{t.preventDefault(),l(null);try{let t=await fetch("/api/login?token=".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(t.redirected){let e=new URL(t.url).searchParams.get("success");if("false"===e)throw Error("Invalid token");window.location.href=t.url}}catch(e){l("Login failed. Please try again.")}};return(0,r.jsx)("div",{className:"flex items-center justify-center mt-96",children:(0,r.jsxs)("form",{onSubmit:o,className:"py-3 px-1 w-2/5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-center mb-4",children:[(0,r.jsx)("input",{type:"text",placeholder:"Enter authentication token",value:e,onChange:e=>t(e.target.value),className:"w-full rounded-none rounded-l-md border-0 py-1.5 pl-3 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-500 sm:text-sm sm:leading-6",style:{boxSizing:"border-box"}}),(0,r.jsxs)("button",{type:"submit",className:"relative -ml-px inline-flex items-center gap-x-1.5 rounded-r-md px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50",style:{boxSizing:"border-box",height:"100%"},children:[(0,r.jsx)(i,{className:"h-5 w-5"}),"Login"]})]}),n&&(0,r.jsx)("p",{className:"text-red-500 text-center mb-4",children:n})]})})}},9376:function(e,t,n){"use strict";var r=n(5475);n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})}},function(e){e.O(0,[971,117,744],function(){return e(e.s=4347)}),_N_E=e.O()}]);