import{d as f,L as b,z as v,r as w,c as r,o as m}from"./jwt-decode.esm-DyyavT6h.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]="46db3352-1a89-45f9-af5b-2308389fbb3d",t._sentryDebugIdIdentifier="sentry-dbid-46db3352-1a89-45f9-af5b-2308389fbb3d")}catch{}})();const p=7200,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 b(v.string(),"auth:jwt"),e=w(null),a=()=>{e.value=null,t.remove()},o=s=>{t.set(s),e.value=s},u=()=>{e.value=t.get()},l=r(()=>e.value?{Authorization:`Bearer ${e.value}`}:{}),d=r(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),n=r(()=>e.value?y(e.value):null),i=r(()=>n.value?.email),c=()=>n.value?n.value.expiresInSeconds-Date.now()>p:!1;return u(),{jwt:e,email:i,saveJWT:o,removeJWT:a,isJWTValid:c,authHeaders:l,wsAuthHeaders:d}});export{g as u};
//# sourceMappingURL=userStore-CViq8J7-.js.map
