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