import{a as p}from"./chunk-ZBTJAN5I.js";import{b as _}from"./chunk-XFS4SIQZ.js";import{a as I}from"./chunk-ZSSEAP7S.js";import{$a as b,E as n,I as g,R as x,S as f,Y as i,Z as r,_ as v,cb as y,db as C,ga as m,gb as k,o as s,pa as o,qa as h,ra as l,x as d}from"./chunk-LH5Z5GGI.js";import"./chunk-C6Q5SG76.js";function S(t,a){if(t&1&&(v(0,"div",1),i(1,"div",2),o(2),r(),i(3,"div",3),o(4),r()),t&2){let e=m();n(2),l(" ",e.i18n.t("auth.cb.establishing")," "),n(2),l(" ",e.i18n.t("auth.cb.exchanging")," ")}}function E(t,a){if(t&1&&(i(0,"div",2),o(1),r(),i(2,"div",3),o(3),r(),i(4,"a",4),o(5),r()),t&2){let e=m();n(),l(" ",e.i18n.t("auth.cb.failTitle")," "),n(2),l(" ",e.message()," "),n(2),h(e.i18n.t("auth.cb.backToLogin"))}}var w=class t{auth=s(I);router=s(y);route=s(b);i18n=s(_);status=d("working");message=d("");constructor(){let a=this.route.snapshot.queryParamMap.get("code"),e=this.route.snapshot.queryParamMap.get("state"),c=sessionStorage.getItem(p)||"/app";sessionStorage.removeItem(p),setTimeout(async()=>{if(!a){this.fail(this.i18n.t("auth.cb.errMissingCode"));return}let u=await this.auth.exchangeIdpCode(a,e,`${location.origin}/auth/callback`);u.ok?this.router.navigateByUrl(c):this.fail(u.error??this.i18n.t("auth.cb.errInvalidCode"))},600)}fail(a){this.status.set("error"),this.message.set(a)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=g({type:t,selectors:[["page-callback"]],decls:3,vars:1,consts:[[1,"relative","z-[1]","flex","min-h-full","flex-col","items-center","justify-center","gap-[18px]","text-center"],[1,"h-[46px]","w-[46px]","animate-spin","rounded-full","border-[3px]","border-solid","border-[var(--border-strong)]","border-t-[var(--brand)]","[animation-duration:0.8s]"],[1,"font-[family-name:var(--font-head)]","text-[20px]"],[1,"font-[family-name:var(--mono)]","text-[12px]","text-[var(--fg-dim)]"],["routerLink","/login",1,"inline-flex","cursor-pointer","items-center","gap-[9px]","rounded-[var(--r-md)]","border","border-transparent","bg-[var(--ink)]","px-[22px]","py-[13px]","text-[15px]","font-semibold","text-[var(--on-ink)]","shadow-[shadow:var(--shadow)]","transition-[transform,box-shadow]","duration-150","hover:-translate-y-0.5","hover:shadow-[0_22px_50px_rgba(24,24,16,0.18)]"]],template:function(e,c){e&1&&(i(0,"div",0),x(1,S,5,2)(2,E,6,3),r()),e&2&&(n(),f(c.status()==="working"?1:2))},dependencies:[k,C],encapsulation:2,changeDetection:0})};export{w as CallbackPage};
