1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9610],{49610:(t,e,n)=>{n.r(e),n.d(e,{clearCurrentUser:()=>g,getCurrentUser:()=>y,refreshCurrentUser:()=>C,setCurrentUser:()=>S,useCurrentUser:()=>p});var u=n(14685),r=n(52453);let l="auth-cache",a="auth-state",o=r.env.NEXT_PUBLIC_API_BASE||"",s=null,c=null,i=new Set;function f(t){s=t;try{t?window.localStorage.setItem(l,JSON.stringify(t)):window.localStorage.removeItem(l)}catch{}t&&function(t){if("u"<typeof document)return;let e=function(){let t=window.location.hostname;if("localhost"===t||/^\d+\.\d+\.\d+\.\d+$/.test(t))return null;let e=t.split(".");return e.length<2?null:e.slice(-2).join(".")}(),n=[`${a}=${t}`,"Path=/","Max-Age=31536000","SameSite=Lax"];e&&n.push(`Domain=${e}`),"https:"===window.location.protocol&&n.push("Secure"),document.cookie=n.join("; ")}(t.state),i.forEach(t=>t())}async function d(){return c||(c=(async()=>{try{let t=await fetch(`${o}/v1/auth/me`,{credentials:"include"});if(401===t.status)return f({state:"anon"}),null;if(!t.ok)return s?.state==="user"?s.user:null;let e=await t.json();if(e?.id)return f({state:"user",user:e}),e;return f({state:"anon"}),null}finally{c=null}})())}function h(){if(null!==s)return s;let t=function(){try{let t=window.localStorage.getItem(l);if(!t)return null;let e=JSON.parse(t);if(e?.state==="anon")return{state:"anon"};if(e?.state==="user"&&e.user?.id)return{state:"user",user:e.user};return null}catch{return null}}();return t?s=t:"anon"===function(t){if("u"<typeof document)return null;let e=document.cookie.match(RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null}(a)?s={state:"anon"}:null}function w(){return null}function m(t){return i.add(t),()=>{i.delete(t)}}function p(){let t=(0,u.useSyncExternalStore)(m,h,w);return(0,u.useEffect)(()=>{null!==t||c||d()},[t]),{user:t?.state==="user"?t.user:null,loading:null===t}}async function y(){let t=h();return t?"user"===t.state?t.user:null:d()}function S(t){f({state:"user",user:t})}function g(){f({state:"anon"})}async function C(){return c=null,d()}}}]);
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.