1import{b as g}from"./chunk-Y74B67QC.js";import{b as f}from"./chunk-2PLE7YEL.js";import{a as i}from"./chunk-CG65MUSR.js";import{b as u,c as k,d as _}from"./chunk-NE2NOTW3.js";import{I as d,R as m,W as a,h as p,m as o}from"./chunk-PFD3P3UK.js";var w=n=>{let e=n.data.token;return{mustChangePwd:e.must_change_pwd??!1,accessToken:e.access_token??"",userName:e.user_data?.name??"",userRole:e.user_data?.role??0}};var b=class n{#e=a(_);#t=i.API_URL;#s=a(f);#n=a(g);_randomDelay(e=300,s=700){return Math.floor(Math.random()*(s-e+1)+e)}authToken(e){let s=`${this.#t}/oauth/token`,r=new u({"Content-Type":"application/x-www-form-urlencoded"}),t=new k().set("client_id",i.clientId).set("client_secret",i.clientSecret).set("grant_type",e.grant_type);return e.password&&(t=t.set("password",e.password)),e.username&&(t=t.set("username",e.username)),e.refresh_token&&(t=t.set("refresh_token",e.refresh_token)),e.space_id&&(t=t.set("space_id",e.space_id)),e.admin_space_id&&(t=t.set("admin_space_id",e.admin_space_id)),e.partner_slug&&(t=t.set("partner_slug",e.partner_slug)),this.#e.post(s,t,{headers:r}).pipe(o(c=>{let{user_data:l,access_token:h,at_expires_in:T,refresh_token:A,rt_expires_in:I}=c.data.token;return l&&this.#n.set(l),h&&(this.#s.setAccessToken(h,T),this.#s.setRefreshToken(A,I),this.#r()),w(c)}))}login(e,s){let r={username:e,password:s,grant_type:"password"};return this.authToken(r).pipe(d(t=>t.mustChangePwd?p({mustChangePwd:t.mustChangePwd,accessToken:t.accessToken,userName:t.userName,userRole:t.userRole}):p({mustChangePwd:t.mustChangePwd,accessToken:t.accessToken,userName:t.userName,userRole:t.userRole})))}logout(){let e=`${this.#t}/oauth/logout`;return this.#e.post(e,{}).pipe(o(s=>(this.#s.deleteAllCookies(),this.#n.clear(),this.#r(),!0)))}#r(){typeof window<"u"&&new BroadcastChannel("liceo-eco-app").postMessage("refreshPage")}tokenValidation(){let e=`${this.#t}/oauth/token`,s=new u({"Content-Type":"application/x-www-form-urlencoded"});return this.#e.get(e,{headers:s}).pipe(o(r=>
1r.data.token.call_refresh_token))}refreshToken(e){return this.authToken({refresh_token:e,grant_type:"refresh_token"}).pipe(o(s=>s.accessToken))}static \u0275fac=function(s){return new(s||n)};static \u0275prov=m({token:n,factory:n.\u0275fac,providedIn:"root"})};export{b as a};
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.