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