import{q as f,O as v,L as b,r as w,c as n,Q as m}from"./jwt-decode.esm.95147216.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]="cf1bc12d-7ce4-4bca-8d55-4d78b91573e2",t._sentryDebugIdIdentifier="sentry-dbid-cf1bc12d-7ce4-4bca-8d55-4d78b91573e2")}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(b.string(),"auth:jwt"),e=w(null),s=()=>{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}`]:[]),a=n(()=>e.value?y(e.value):null),d=n(()=>{var r;return(r=a.value)==null?void 0:r.email}),i=()=>a.value?a.value.expiresInSeconds-Date.now()>p:!1;return u(),{jwt:e,email:d,saveJWT:o,removeJWT:s,isJWTValid:i,authHeaders:l,wsAuthHeaders:c}});export{g as u};
//# sourceMappingURL=userStore.58432b7f.js.map
