import{k as f,O as v,L as w,r as b,c as r,Q as m}from"./jwt-decode.esm.7f2ef0df.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="5a723ef2-c5cb-41f5-a390-a29afadaf616",a._sentryDebugIdIdentifier="sentry-dbid-5a723ef2-c5cb-41f5-a390-a29afadaf616")}catch{}})();const p=2*60*60,y=a=>{try{const e=m(a);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 a=new v(w.string(),"auth:jwt"),e=b(null),s=()=>{e.value=null,a.remove()},o=t=>{a.set(t),e.value=t},u=()=>{e.value=a.get()},l=r(()=>e.value?{Authorization:`Bearer ${e.value}`}:{}),c=r(()=>e.value?["default",`base64url.bearer.authorization.${e.value}`]:[]),n=r(()=>e.value?y(e.value):null),i=r(()=>{var t;return(t=n.value)==null?void 0:t.email}),d=()=>n.value?n.value.expiresInSeconds-Date.now()>p:!1;return u(),{jwt:e,email:i,saveJWT:o,removeJWT:s,isJWTValid:d,authHeaders:l,wsAuthHeaders:c}});export{g as u};
//# sourceMappingURL=userStore.73b89fbb.js.map
