import{a as n,b as F,c as m,d as R,e as v,f as W}from"./chunk-KOYZ2E2W.js";import{Aj as b,Bj as j,s as h,t as w}from"./chunk-EAIMSMGJ.js";import{g as S,h as V}from"./chunk-AIHAZUSZ.js";import{b as l,c as A}from"./chunk-IOINCEV4.js";import{Gd as g,ka as s,na as y,sa as p,x as i,xa as a}from"./chunk-JSJB5BKT.js";import{a as c,b as u,e as d}from"./chunk-SZAW6ZBW.js";var B,z=d(()=>{w();y();R();F();g();A();V();W();j();B=(()=>{class o extends h{constructor(e,t,r,f){super(e,t),this.subscriberFactoryService=r,this.assetServices=f}get(e){return this.assetServices.GetSubscriber(e).pipe(s(t=>this.handleGetApiResult(t)),i(t=>this.returnWhenSuccessful(t,()=>this.normalizeSubscriber(t.data))))}getAll(){return this.assetServices.GetAllSubscribers().pipe(s(e=>this.handleGetApiResult(e)),i(e=>this.returnWhenSuccessful(e,()=>this.toViewModels(this.normalizeSubscribers(e.data)))))}save(e){if(e.type===n.Syslog){let t=this.getSyslogSubscriberSaveVersion(e);return this.assetServices.SaveSyslogSubscriber(t).pipe(s(r=>this.handleSaveApiResult(r)),i(r=>this.returnWhenSuccessful(r,()=>r.data)))}else return this.assetServices.SaveEmailSubscriber(e).pipe(s(t=>this.handleSaveApiResult(t)),i(t=>this.returnWhenSuccessful(t,()=>t.data)))}delete(e){return this.assetServices.DeleteSubscriber(e).pipe(s(t=>this.handleDeleteApiResult(t)),i(t=>this.isSuccessful(t)))}normalizeSubscriber(e){return this.subscriberFactoryService.toSubscriber(e)}normalizeSubscribers(e){return e.map(this.subscriberFactoryService.toSubscriber)}toViewModel(e){return u(c({},e),{subscriptions:e.subscriptions||[],groups:e.groups||[],subscriptionCount:(e.subscriptions||[]).length,groupCount:(e.groups||[]).length,type:e.type,typeDisplayValue:this.translatorService.translateEnum(n,e.type)})}toViewModels(e){return e.map(t=>this.toViewModel(t))}getSyslogSubscriberSaveVersion(e){let t=new m(e);return t.useDefaultSettings&&(t.hostname=null,t.port=null,t.protocol=null),t}static{this.\u0275fac=function(t){return new(t||o)(a(l),a(S),a(v),a(b))}}static{this.\u0275prov=p({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})()});export{B as a,z as b};
