import{k as p}from"./chunk-7NZWIHPJ.js";import{c as L,i as q}from"./chunk-R7INA2TP.js";import"./chunk-UQLLME4S.js";import{I as T,Ja as _,O as D,Qa as j,R as O,Ra as A,Ta as F,Va as B,ba as R,bb as N,da as M,kb as Y,lb as J,mb as U}from"./chunk-N445P7BV.js";import{$ as y,Ca as w,Db as x,F as b,Fc as m,Gc as d,Hc as k,M as C,Sc as I,Yc as h,Zc as g,fc as l,fd as E,gc as s,ka as a,nb as c,qc as P,t as v,tb as o,u as S}from"./chunk-DZ62WUBN.js";import{i as u}from"./chunk-2AVGQ2MQ.js";var le=(()=>{class i{#t;#e;#o;constructor(e,t,n,f,z,G){this.authService=e,this.router=t,this.apiService=n,this.titleService=f,this.userRoleService=z,this.cdr=G,this.title="Logout Page",this.portalSSOutEnable=!1,this.cloudPropertyElement=null,this.#t=a(D),this.#e=a(B),this.colorMode=this.#e.colorMode,this.#o=a(w),this.currentYear=new Date().getFullYear(),this.#e.localStorageItemName.set("theme-default"),this.#e.eventName.set("ColorSchemeChange"),this.#t.queryParams.pipe(C(1),S(r=>r.theme?.match(/^[A-Za-z0-9\s]+/)?.[0]),b(r=>["dark","light","auto"].includes(r)),y(r=>{this.colorMode.set(r)}),M(this.#o)).subscribe(),this.titleService.setTitle(this.title)}ngOnInit(){return u(this,null,function*(){try{yield this.getCloudProperties(),this.logout()}catch(e){console.error("ngOnInit error in LogoutComponent:",e)}})}logout(){try{let e=localStorage.getItem("theme-default");this.authService.clearToken(),localStorage.clear(),e&&localStorage.setItem("theme-default",e),this.userRoleService.clear(),this.portalSSOutEnable==!0&&setTimeout(()=>{window.open("https://login.microsoftonline.com/common/oauth2/v2.0/logout","_blank")},3e3),this.router.url!=="/logout"&&this.router.navigate(["/logout"])}catch(e){console.error("Logout failed:",e)}}goToLogin(){this.authService.clearToken(),this.router.navigate(["/login"])}getCloudProperties(){return u(this,null,function*(){try{let e=yield v(this.apiService.cloudProperties()),t=e?.body?JSON.parse(JSON.stringify(e.body)):{};this.cloudPropertyElement=t.cloudPropertyElement,this.portalSSOutEnable=this.cloudPropertyElement.portalSSOutEnable,this.cdr.detectChanges()}catch(e){throw console.error("Error from getCloudProperties: ",e),e}})}static{this.\u0275fac=function(t){return new(t||i)(o(L),o(O),o(p),o(T),o(q),o(E))}}static{this.\u0275cmp=x({type:i,selectors:[["app-logout"]],features:[I([p])],decls:19,vars:7,consts:[[1,"bg-light","dark:bg-transparent","min-vh-100","d-flex","flex-row","align-items-center"],["breakpoint","md"],[1,"justify-content-center"],["lg","10","xl","8"],[1,"p-4"],["cForm",""],["xs","6"],["cButton","","color","primary",1,"logout-btn",3,"click"],[1,"text-center"],["href","https://www.crashplan.com","target","_blank",2,"color","#062D4D","text-decoration","none"]],template:function(t,n){t&1&&(l(0,"div",0)(1,"c-container",1)(2,"c-row",2)(3,"c-col",3)(4,"c-card-group")(5,"c-card",4)(6,"c-card-body")(7,"form",5)(8,"h2"),m(9),h(10,"translate"),s(),l(11,"c-row")(12,"c-col",6)(13,"button",7),P("click",function(){return n.goToLogin()}),m(14),h(15,"translate"),s()()()()()()()()()()(),l(16,"div",8)(17,"a",9),m(18),s()()),t&2&&(c(9),d(g(10,3,"You have been successfully logged out")),c(5),d(g(15,5,"Login to Portal")),c(4),k("\xA9 CrashPlan ",n.currentYear," "))},dependencies:[Y,U,J,F,j,A,N,_,R],styles:[".logout-btn[_ngcontent-%COMP%]{color:#fff!important;background-color:#35b7f4!important;border-color:#35b7f4!important;transition:none}.logout-btn[_ngcontent-%COMP%]:hover{transition:background-color .3s ease-in-out,box-shadow .3s ease-in-out;background-color:#35b7f4!important;box-shadow:0 0 5px #0003}"]})}}return i})();export{le as LogoutComponent};
