1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7003],{78424:function(e,t,n){n.d(t,{l4:function(){return s}});class s 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 r extends s{}r.kind="signIn";class a extends s{}a.type="AdapterError";class o extends s{}o.type="AccessDenied";class i extends s{}i.type="CallbackRouteError";class c extends s{}c.type="ErrorPageLoop";class l extends s{}l.type="EventError";class d extends s{}d.type="InvalidCallbackUrl";class u extends Error{constructor(){super(...arguments),this.code="credentials"}}u.type="CredentialsSignin";class v extends s{}v.type="InvalidEndpoints";class h extends s{}h.type="InvalidCheck";class p extends s{}p.type="JWTSessionError";class f extends s{}f.type="MissingAdapter";class w extends s{}w.type="MissingAdapterMethods";class y extends s{}y.type="MissingAuthorize";class g extends s{}g.type="MissingSecret";class E extends r{}E.type="OAuthAccountNotLinked";class S extends r{}S.type="OAuthCallbackError";class x extends s{}x.type="OAuthProfileParseError";class m extends s{}m.type="SessionTokenError";class _ extends r{}_.type="OAuthSignInError";class b extends r{}b.type="EmailSignInError";class L extends s{}L.type="SignOutError";class U extends s{}U.type="UnknownAction";class R extends s{}R.type="UnsupportedStrategy";class k extends s{}k.type="InvalidProvider";class A extends s{}A.type="UntrustedHost";class C extends s{}C.type="Verification";class T extends r{}T.type="MissingCSRF";class P extends s{}P.type="DuplicateConditionalUI";class N extends s{}N.type="MissingWebAuthnAutocomplete";class M extends s{}M.type="WebAuthnVerificationError";class I extends r{}I.type="AccountNotLinked";class O extends s{}O.type="ExperimentalFeatureNotEnabled"},27003:function(e,t,n){n.d(t,{SessionProvider:function(){return C},zB:function(){return k},w7:function(){return A},kP:function(){return b}});var s,r,a,o,i,c=n(27573),l=n(7653),d=n.t(l,2),u=n(78424);class v extends u.l4{}class h extends u.l4{}async function p(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 v(e.message,e)),null}}function f(e){return"undefined"==typeof window?"".concat(e.baseUrlServer).concat(e.basePathServer):e.basePath}function w(){return Math.floor(Date.now()/1e3)}function y(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 g=n(68571);let E={baseUrl:y(null!==(r=g.env.NEXTAUTH_URL)&&void 0!==r?r:g.env.VERCEL_URL).origin,basePath:y(g.env.NEXTAUTH_URL).path,baseUrlServer:y(null!==(o=null!==(a=g.env.NEXTAUTH_URL_INTERNAL)&&void 0!==a?a:g.env.NEXTAUTH_URL)&&void 0!==o?o:g.env.VERCEL_URL).origin,basePathServer:y(null!==(i=g.env.NEXTAUTH_URL_INTERNAL)&&void 0!==i?i:g.env.NEXTAUTH_URL).path,_lastSync:0,_session:void 0,_getSession:()=>{}},S=null;function x(){return"undefined"==typeof BroadcastChannel?{postMessage:()=>{},addEventListener:()=>{},removeEventListener:()=>{}}:(null===S&&(S=new BroadcastChannel("next-auth")),S)}let m={debug:console.debug,error:console.error,warn:console.warn},_=null===(s=l.createContext)||void 0===s?void 0:s.call(d,void 0);function b(e){if(!_)throw Error("React Context is unavailable in Server Components");let t=l.useContext(_),{required:n,onUnauthenticated:s}=null!=e?e:{},r=n&&"unauthenticated"===t.status;return(l.useEffect(()=>
1{if(r){let e="".concat(E.basePath,"/signin?").concat(new URLSearchParams({error:"SessionRequired",callbackUrl:window.location.href}));s?s():window.location.href=e}},[r,s]),r)?{data:t.data,update:t.update,status:"loading"}:t}async function L(e){var t;let n=await p("session",E,m,e);return(null===(t=null==e?void 0:e.broadcast)||void 0===t||t)&&x().postMessage({event:"session",data:{trigger:"getSession"}}),n}async function U(){var e;let t=await p("csrf",E,m);return null!==(e=null==t?void 0:t.csrfToken)&&void 0!==e?e:""}async function R(){return p("providers",E,m)}async function k(e,t,n){let{callbackUrl:s=window.location.href,redirect:r=!0}=null!=t?t:{},a=f(E),o=await R();if(!o){window.location.href="".concat(a,"/error");return}if(!e||!(e in o)){window.location.href="".concat(a,"/signin?").concat(new URLSearchParams({callbackUrl:s}));return}let i="credentials"===o[e].type,c="email"===o[e].type,l="".concat(a,"/").concat(i?"callback":"signin","/").concat(e),d=await U(),u=await fetch("".concat(l,"?").concat(new URLSearchParams(n)),{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Auth-Return-Redirect":"1"},body:new URLSearchParams({...t,csrfToken:d,callbackUrl:s})}),v=await u.json();if(r||!(i||c)){var h;let e=null!==(h=v.url)&&void 0!==h?h:s;window.location.href=e,e.includes("#")&&window.location.reload();return}let p=new URL(v.url).searchParams.get("error"),w=new URL(v.url).searchParams.get("code");return u.ok&&await E._getSession({event:"storage"}),{error:p,code:w,status:u.status,ok:u.ok,url:p?null:v.url}}async function A(e){var t,n;let{callbackUrl:s=window.location.href}=null!=e?e:{},r=f(E),a=await U(),o=await fetch("".concat(r,"/signout"),{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Auth-Return-Redirect":"1"},body:new URLSearchParams({csrfToken:a,callbackUrl:s})}),i=await o.json();if(x().postMessage({event:"session",data:{trigger:"signout"}}),null===(t=null==e?void 0:e.redirect)||void 0===t||t){let e=null!==(n=i.url)&&void 0!==n?n:s;window.location.href=e,e.includes("#")&&window.location.reload();return}return await E._getSession({event:"storage"}),i}function C(e){if(!_)throw Error("React Context is unavailable in Server Components");let{children:t,basePath:n,refetchInterval:s,refetchWhenOffline:r}=e;n&&(E.basePath=n);let a=void 0!==e.session;E._lastSync=a?w():0;let[o,i]=l.useState(()=>(a&&(E._session=e.session),e.session)),[d,u]=l.useState(!a);l.useEffect(()=>(E._getSession=async function(){let{event:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t="storage"===e;if(t||void 0===E._session){E._lastSync=w(),E._session=await L({broadcast:!t}),i(E._session);return}if(!e||null===E._session||w()<E._lastSync)return;E._lastSync=w(),E._session=await L(),i(E._session)}catch(e){m.error(new h(e.message,e))}finally{u(!1)}},E._getSession(),()=>{E._lastSync=0,E._session=void 0,E._getSession=()=>{}}),[]),l.useEffect(()=>{let e=()=>E._getSession({event:"storage"});return x().addEventListener("message",e),()=>x().removeEventListener("message",e)},[]),l.useEffect(()=>{let{refetchOnWindowFocus:t=!0}=e,n=()=>{t&&"visible"===document.visibilityState&&E._getSession({event:"visibilitychange"})};return document.addEventListener("visibilitychange",n,!1),()=>document.removeEventListener("visibilitychange",n,!1)},[e.refetchOnWindowFocus]);let v=function(){let[e,t]=l.useState("undefined"!=typeof navigator&&navigator.onLine),n=()=>t(!0),s=()=>t(!1);return l.useEffect(()=>(window.addEventListener("online",n),window.addEventListener("offline",s),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}),[]),e}(),f=!1!==r||v;l.useEffect(()=>{if(s&&f){let e=setInterval(()=>{E._session&&E._getSession({event:"poll"})},1e3*s);return()=>clearInterval(e)}},[s,f]);let y=l.useMemo(()=>({data:o,status:d?"loading":o?"authenticated":"unauthenticated",async update(e){if(d||!o)return;u(!0);let t=await p("session",E,m,void 0===e?void 0:{body:{csrfToken:await U(),data:e}});return u(!1),t&&(i(t),x().postMessage({event:"session",data:{trigger:"getSession"}})),t}}),[o,d]);return(0,c.jsx)(_.Provider,{value:y,children:t})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.