import{k as f,O as v,L as w,r as b,c as n,Q as m}from"./jwt-decode.esm.d4517a10.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f134193d-e190-4e80-8444-8bcc1113e56f",t._sentryDebugIdIdentifier="sentry-dbid-f134193d-e190-4e80-8444-8bcc1113e56f")}catch{}})();const p=2*60*60,y=t=>{try{const e=m(t);if(!e.exp)throw Error("expired jwt");return{email:e.email,expiresInSeconds:e.exp*1e3}}catch{console.warn("Invalid JWT")}return null},g=f("user",()=>{const t=new v(w.string(),"auth:jwt"),e=b(null),a=()=>{e.value=null,t.remove()},o=r=>{t.set(r),e.value=r},u=()=>{e.value=t.get()},l=n(()=>e.value?{Authorization:`Bearer ${e.value}`}:{}),c=n(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),s=n(()=>e.value?y(e.value):null),i=n(()=>{var r;return(r=s.value)==null?void 0:r.email}),d=()=>s.value?s.value.expiresInSeconds-Date.now()>p:!1;return u(),{jwt:e,email:i,saveJWT:o,removeJWT:a,isJWTValid:d,authHeaders:l,wsAuthHeaders:c}});export{g as u};
//# sourceMappingURL=userStore.31024da3.js.map
