import{j as f,L as v,z as w,r as m,e as r,o as p}from"./jwt-decode.esm-Dca5fHH5.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]="750756a8-f84d-4020-8513-55516fa71890",t._sentryDebugIdIdentifier="sentry-dbid-750756a8-f84d-4020-8513-55516fa71890")}catch{}})();const y=7200,_=t=>{try{const e=p(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=m(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}`}:{}),i=r(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),n=r(()=>e.value?_(e.value):null),d=r(()=>n.value?.email),c=()=>n.value?n.value.expiresInSeconds-Date.now()>y:!1;return u(),{jwt:e,email:d,saveJWT:o,removeJWT:a,isJWTValid:c,authHeaders:l,wsAuthHeaders:i}});export{g as u};
//# sourceMappingURL=userStore-C7NmNY8K.js.map
