"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6668],{76668:function(e,t,n){n.d(t,{zB:function(){return ee},w7:function(){return et}}),n(38036);var s,r,a,o,i,c=n(45226),l=n.t(c,2);class d extends Error{constructor(e,t){e instanceof Error?super(void 0,{cause:{err:e,...e.cause,...t}}):"string"==typeof e?(t instanceof Error&&(t={err:t,...t.cause}),super(e,t)):super(void 0,e),this.name=this.constructor.name,this.type=this.constructor.type??"AuthError",this.kind=this.constructor.kind??"error",Error.captureStackTrace?.(this,this.constructor);let n=`https://errors.authjs.dev#${this.type.toLowerCase()}`;this.message+=`${this.message?". ":""}Read more at ${n}`}}class u extends d{}u.kind="signIn";class p extends d{}p.type="AdapterError";class h extends d{}h.type="AccessDenied";class v extends d{}v.type="CallbackRouteError";class y extends d{}y.type="ErrorPageLoop";class w extends d{}w.type="EventError";class g extends d{}g.type="InvalidCallbackUrl";class f extends u{constructor(){super(...arguments),this.code="credentials"}}f.type="CredentialsSignin";class x extends d{}x.type="InvalidEndpoints";class E extends d{}E.type="InvalidCheck";class U extends d{}U.type="JWTSessionError";class k extends d{}k.type="MissingAdapter";class b extends d{}b.type="MissingAdapterMethods";class R extends d{}R.type="MissingAuthorize";class A extends d{}A.type="MissingSecret";class L extends u{}L.type="OAuthAccountNotLinked";class m extends u{}m.type="OAuthCallbackError";class S extends d{}S.type="OAuthProfileParseError";class T extends d{}T.type="SessionTokenError";class _ extends u{}_.type="OAuthSignInError";class C extends u{}C.type="EmailSignInError";class N extends d{}N.type="SignOutError";class P extends d{}P.type="UnknownAction";class I extends d{}I.type="UnsupportedStrategy";class M extends d{}M.type="InvalidProvider";class X extends d{}X.type="UntrustedHost";class H extends d{}H.type="Verification";class O extends u{}O.type="MissingCSRF";class j extends d{}j.type="DuplicateConditionalUI";class V extends d{}V.type="MissingWebAuthnAutocomplete";class W extends d{}W.type="WebAuthnVerificationError";class $ extends u{}$.type="AccountNotLinked";class B extends d{}B.type="ExperimentalFeatureNotEnabled";class z extends d{}async function D(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r="".concat(F(t),"/").concat(e);try{var a;let e={headers:{"Content-Type":"application/json",...(null==s?void 0:null===(a=s.headers)||void 0===a?void 0:a.cookie)?{cookie:s.headers.cookie}:{}}};(null==s?void 0:s.body)&&(e.body=JSON.stringify(s.body),e.method="POST");let t=await fetch(r,e),n=await t.json();if(!t.ok)throw n;return n}catch(e){return n.error(new z(e.message,e)),null}}function F(e){return"undefined"==typeof window?"".concat(e.baseUrlServer).concat(e.basePathServer):e.basePath}function J(e){let t=new URL("http://localhost:3000/api/auth");e&&!e.startsWith("http")&&(e="https://".concat(e));let n=new URL(e||t),s=("/"===n.pathname?t.pathname:n.pathname).replace(/\/$/,""),r="".concat(n.origin).concat(s);return{origin:n.origin,host:n.host,path:s,base:r,toString:()=>r}}var q=n(57404);let G={baseUrl:J(null!==(r=q.env.NEXTAUTH_URL)&&void 0!==r?r:q.env.VERCEL_URL).origin,basePath:J(q.env.NEXTAUTH_URL).path,baseUrlServer:J(null!==(o=null!==(a=q.env.NEXTAUTH_URL_INTERNAL)&&void 0!==a?a:q.env.NEXTAUTH_URL)&&void 0!==o?o:q.env.VERCEL_URL).origin,basePathServer:J(null!==(i=q.env.NEXTAUTH_URL_INTERNAL)&&void 0!==i?i:q.env.NEXTAUTH_URL).path,_lastSync:0,_session:void 0,_getSession:()=>{}},K=null,Q={debug:console.debug,error:console.error,warn:console.warn};async function Y(){var e;let t=await D("csrf",G,Q);return null!==(e=null==t?void 0:t.csrfToken)&&void 0!==e?e:""}async function Z(){return D("providers",G,Q)}async function ee(e,t,n){var s,r,a;let{redirect:o=!0}=null!=t?t:{},i=null!==(r=null!==(s=null==t?void 0:t.redirectTo)&&void 0!==s?s:null==t?void 0:t.callbackUrl)&&void 0!==r?r:window.location.href,c=F(G),l=await Z();if(!l){window.location.href="".concat(c,"/error");return}if(!e||!(e in l)){window.location.href="".concat(c,"/signin?").concat(new URLSearchParams({callbackUrl:i}));return}let d="credentials"===l[e].type,u="email"===l[e].type,p="".concat(c,"/").concat(d?"callback":"signin","/").concat(e),h=await Y(),v=await fetch("".concat(p,"?").concat(new URLSearchParams(n)),{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Auth-Return-Redirect":"1"},body:new URLSearchParams({...t,csrfToken:h,callbackUrl:i})}),y=await v.json();if(o||!(d||u)){let e=null!==(a=y.url)&&void 0!==a?a:i;window.location.href=e,e.includes("#")&&window.location.reload();return}let w=new URL(y.url).searchParams.get("error"),g=new URL(y.url).searchParams.get("code");return v.ok&&await G._getSession({event:"storage"}),{error:w,code:g,status:v.status,ok:v.ok,url:w?null:y.url}}async function et(e){var t,n,s,r;let a=null!==(n=null!==(t=null==e?void 0:e.redirectTo)&&void 0!==t?t:null==e?void 0:e.callbackUrl)&&void 0!==n?n:window.location.href,o=F(G),i=await Y(),c=await fetch("".concat(o,"/signout"),{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Auth-Return-Redirect":"1"},body:new URLSearchParams({csrfToken:i,callbackUrl:a})}),l=await c.json();if(("undefined"==typeof BroadcastChannel?{postMessage:()=>{},addEventListener:()=>{},removeEventListener:()=>{}}:(null===K&&(K=new BroadcastChannel("next-auth")),K)).postMessage({event:"session",data:{trigger:"signout"}}),null===(s=null==e?void 0:e.redirect)||void 0===s||s){let e=null!==(r=l.url)&&void 0!==r?r:a;window.location.href=e,e.includes("#")&&window.location.reload();return}return await G._getSession({event:"storage"}),l}null===(s=c.createContext)||void 0===s||s.call(l,void 0)}}]);