import{a as h}from"./chunk-C72WNAXZ.js";import{a as p}from"./chunk-CEK6WLCM.js";import{J as a,M as o,e as s}from"./chunk-4SVIVQBS.js";var f=(()=>{let e=class e{constructor(i,t){this.deviceRouteService=i,this.uiService=t,this.openAppointments=[],this.watchForAppointmentDispostionChange=!1,this.trainingActive=!1,this.closingTraining=!1,this.initializing=new s(!1),this.active=new s(!1),this.init()}storeAppointment(i,t=!1){this.openAppointments.find(r=>r.id==i.id)==null&&this.openAppointments.push(i),t&&(this.activeAppointment=i)}removeAppointment(i){for(var t=0,c=this.openAppointments.length;t<c;t++)if(this.openAppointments[t].id==i){this.openAppointments.splice(t,1);break}}goToAppointment(i){this.deviceRouteService.viewRouteByType("Appointment",[i],!0)}closeTraining(){window.clearTimeout(this.trainingTimeout),this.closingTraining=!0,this.trainingTimeout=window.setTimeout(()=>{this.trainingActive=!1,this.closingTraining=!1},250)}goToTraining(){window.clearTimeout(this.trainingTimeout),this.trainingActive=!0}goToRoute(i,t=[]){this.activeAppointment=void 0,this.deviceRouteService.viewRouteByType(i,t,!0)}watchRoutes(){this.routeSubscription=this.deviceRouteService.activeRoute.subscribe({next:i=>{this.activeRoute=i}})}open(){this.active.next(!0)}close(){this.active.next(!1)}toggleActive(){this.active.getValue()?this.close():this.open()}init(){this.watchRoutes()}ngOnDestroy(){this.routeSubscription?.unsubscribe(),this.stateSubscription?.unsubscribe()}};e.\u0275fac=function(t){return new(t||e)(o(h),o(p))},e.\u0275prov=a({token:e,factory:e.\u0275fac});let n=e;return n})();export{f as a};
