import{v as f,a0 as b,Z as v,r as w,c as r,a1 as m}from"./jwt-decode.esm.f87c17f7.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]="60f01502-ab23-4b1c-ba5b-1e42ba205aa0",a._sentryDebugIdIdentifier="sentry-dbid-60f01502-ab23-4b1c-ba5b-1e42ba205aa0")}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 b(v.string(),"auth:jwt"),e=w(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.3989ac4e.js.map
