import{p as u,q as d,s as c}from"./chunk-HKLJ6VPZ.js";import{S as n,X as a,g as s,z as r}from"./chunk-56X5LYJH.js";var h=class i{constructor(t,o){this.router=t;this.route=o;this.resolveRouteState(),this.listenToRouteChanges()}routeStateSubject=new s({isAdd:!1,isUpdate:!1,isShow:!1,isShowBasic:!1,path:"",id:null,mode:void 0});getRouteState$(){return this.routeStateSubject.asObservable()}getRouteState(){return this.routeStateSubject.value.path||this.resolveRouteState(),this.routeStateSubject.value}listenToRouteChanges(){this.router.events.pipe(r(t=>t instanceof u)).subscribe(()=>this.resolveRouteState())}resolveRouteState(){let t=this.getDeepestChild(this.route),o=t.snapshot.paramMap.get("id"),p=t.snapshot.routeConfig?.path??"",e=t.snapshot.data?.mode,l={id:o,path:p,isAdd:e==="add",isUpdate:e==="update",isShow:e==="show",isShowBasic:e==="show-basic",mode:e};this.routeStateSubject.next(l)}getDeepestChild(t){for(;t.firstChild;)t=t.firstChild;return t}static \u0275fac=function(o){return new(o||i)(a(c),a(d))};static \u0275prov=n({token:i,factory:i.\u0275fac,providedIn:"root"})};export{h as a};
