1import{K as e,p as t,yt as n}from"./BPsVqlsv.js";import"./DMFpKwy8.js";import{t as r}from"./DUEcuDoL.js";import{a as i,g as a,i as o,n as s,p as c,r as l,s as u,t as d}from"./BdOgpimk.js";import{n as f}from"./C0hueuQh.js";function p(t=e()){let n=f(t);return e=>{let r=a(e??t.$router.currentRoute.value.path);return n({name:`login`},r)||c(r)}}var m={csrfCookie:s,login:`/login`,logout:`/logout`,user:`/api/user`,oneTimeLoginValidate:`/api/one-time-login/validate`,googleCallback:`/auth/google/callback`};function h(e){return{csrfCookie:async()=>{await e.get(m.csrfCookie)},login:(t,n)=>e.post(m.login,t,n),logout:()=>e.post(m.logout),fetchUser:t=>e.get(m.user,t),oneTimeLoginValidate:(t,n)=>e.post(m.oneTimeLoginValidate,{token:t},n),loginWithGoogle:(t,n,r)=>e.post(m.googleCallback,{code:t,remember:n},{referrerPolicy:`origin`,...r})}}function g(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var _=null,v=null;function y(){let e=g();if(!e)return _;try{return e.getItem(l)}catch{return _}}function b(){return i(y())}function x(){return b()!==null}function S(){let e=(()=>{let e=g();if(!e)return v;try{return e.getItem(o)}catch{return v}})();if(!e)return null;try{let t=JSON.parse(e);return E(t)?t:null}catch{return null}}function C(e,t){let n=i(e)??e,r=JSON.stringify(t);_=null,v=null;try{let e=g();if(!e)throw Error(`localStorage unavailable`);e.setItem(l,n),e.setItem(o,r)}catch{_=n,v=r}}function w(e){if(!x())return;let t=JSON.stringify(e);try{let e=g();if(!e)throw Error(`localStorage unavailable`);e.setItem(o,t)}catch{_!==null&&(v=t)}}function T(){_=null,v=null;try{g()?.removeItem(l),g()?.removeItem(o)}catch{}}function E(e){return typeof e==`object`&&!!e&&typeof e.id==`number`}var D={strategy:`auth.strategy`,token:`auth._token.laravelSanctum`,expiration:`auth._token_expiration.laravelSanctum`},O=`laravelSanctum`,k=3456e4,A=`true`,j=`false`;function M(e,t,n){let r=window.location.protocol===`https:`?`; Secure`:``,i=n===null?``:`; Max-Age=${n}`;document.cookie=`${e}=${encodeURIComponent(t)}; Path=/${i}; SameSite=Lax${r}`}function N(e){document.cookie=`${e}=; Path=/; Max-Age=0; SameSite=Lax`}function P(e={}){if(typeof document>`u`)return;let t=e.remember===!0?k:null;M(D.strategy,O,t),M(D.token,A,t),M(D.expiration,j,t)}function F(){typeof document>`u`||(N(D.token),N(D.expiration),N(D.strategy))}var I=`seomaker_remembered`,L=`1`;function R(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function z(e){if(!e){V();return}try{R()?.setItem(I,L)}catch{}}function B(){try{return R()?.getItem(I)===L}catch{return!1}}function V(){try{R()?.removeItem(I)}catch{}}var H=`auth:user`,U=`auth:ready`,W=`auth:write-issued`,G=`auth:write-applied`;function K(){let i=e(),a=r(H,()=>null),o=r(U,()=>!1),s=r(W,()=>0),c=r(G,()=>0),l=h(d());function u(e){let t={};return e&&(t.Authorization=e),{skipGlobalErrorHandler:!0,headers:t}}function f(){return s.value+=1,s.value}function m(e){return e<=c.value}function g(e,t=f()){return m(t)?a.value:(c.value=t,a.value=e,e?w(e):T(),e)}function _(e,t){if(e===null){V();return}t||P({remember:B()})}async function v(){let e=b(),t=f();try{let n=await l.fetchUser(u(e));return m(t)?a.value:(o.value=!0,_(n,e!==null),g(n,t))}catch(n){if(!q(n))throw n;if(m(t))return a.value;if(e){T();try{let e=await l.fetchUser(u(null));return m(t)?a.value:(o.value=!0,_(e,!1),g(e,t))}catch(e){if(!q(e))throw e;if(m(t))return a.value}}return o.value=!0,_(null,e!==null),g(null,t)}finally{i._authRestore=null}}async function y(){return o.value&&!x()&&!S()?a.value:(i._authRestore??=v(),await i._authRestore)}function x(){return a.value===null&&b()!==null}function S(){return a.value===null&&B()}async function E(){return i._authRestore=v(),await i._authRestore}async function D(e){await l.csrfCookie(),await l.login(e,{skipGlobalErrorHandler:!0}),T(),z(e.remember===!0),P({remember:e.remember===!0}),c.value=f();let t=await l.fetchUser();return o.value=!0,g(t),t}async function O(e={}){try{await l.logout()}catch{}if(j(),e.redirect!==!1){let e=p(i)();await i.runWithContext(()=>t(e,{replace:!0}))}}function k(e,t){C(e,t)}function A(e){g(e)}function j(e={}){T(),e.keepLegacyBridge||(F(),V()),c.value=f(),a.value=null,o.value=!1,i._authRestore=null}return{user:a,loggedIn:n(()=>a.value!==null),ready:o,restore:y,refresh:E,login:D,logout:O,setSession:k,setUser:A,clear:j}}function q(e){return u(e)&&e.status===401}export{S as a,y as i,z as n,h as o,P as r,p as s,K as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.