import{a as A}from"./chunk-MOA5OONJ.js";import{C as i,Ef as S,Kc as x,Oc as f,Rf as H,U as l,Xf as N,Ye as C,Z as u,aa as c,e as d,hg as R,n as m}from"./chunk-4JM6MIZ5.js";import{i as s}from"./chunk-QJQRWPYR.js";var n=class n{authHttp;restExtractor;accountLoaded=new d(1);constructor(r,t){this.authHttp=r,this.restExtractor=t}getAccount(r){return this.authHttp.get(n.BASE_ACCOUNT_URL+r).pipe(m(t=>new S(t)),l(t=>this.accountLoaded.next(t)),i(t=>this.restExtractor.handleError(t)))}};s(n,"BASE_ACCOUNT_URL",C.apiUrl+"/api/v1/accounts/"),s(n,"\u0275fac",function(t){return new(t||n)(c(f),c(H))}),s(n,"\u0275prov",u({token:n,factory:n.\u0275fac}));var v=n;var e=class e{authHttp;restService;restExtractor;serverService;videoChannelLoaded=new d(1);constructor(r,t,o,a){this.authHttp=r,this.restService=t,this.restExtractor=o,this.serverService=a}static extractVideoChannels(r){let t=[];for(let o of r.data)t.push(new A(o));return{data:t,total:r.total}}getVideoChannel(r){return this.authHttp.get(e.BASE_VIDEO_CHANNEL_URL+r).pipe(m(t=>new A(t)),l(t=>this.videoChannelLoaded.next(t)),i(t=>this.restExtractor.handleError(t)))}listAccountVideoChannels(r){let{account:t,componentPagination:o,withStats:a=!1,sort:h,search:E}=r,I=Math.min(this.serverService.getHTMLConfig().videoChannels.maxPerUser,100),V=o?this.restService.componentToRestPagination(o):{start:0,count:I},p=new x;p=this.restService.addRestGetParams(p,V,h),p=p.set("withStats",a+""),E&&(p=p.set("search",E));let g=v.BASE_ACCOUNT_URL+t.nameWithHost+"/video-channels";return this.authHttp.get(g,{params:p}).pipe(m(L=>e.extractVideoChannels(L)),i(L=>this.restExtractor.handleError(L)))}createVideoChannel(r){return this.authHttp.post(e.BASE_VIDEO_CHANNEL_URL,r).pipe(i(t=>this.restExtractor.handleError(t)))}updateVideoChannel(r,t){return this.authHttp.put(e.BASE_VIDEO_CHANNEL_URL+r,t).pipe(i(o=>this.restExtractor.handleError(o)))}changeVideoChannelImage(r,t,o){let a=e.BASE_VIDEO_CHANNEL_URL+r+"/"+o+"/pick";return this.authHttp.post(a,t).pipe(i(h=>this.restExtractor.handleError(h)))}deleteVideoChannelImage(r,t){let o=e.BASE_VIDEO_CHANNEL_URL+r+"/"+t;return this.authHttp.delete(o).pipe(i(a=>this.restExtractor.handleError(a)))}removeVideoChannel(r){return this.authHttp.delete(e.BASE_VIDEO_CHANNEL_URL+r.nameWithHost).pipe(i(t=>this.restExtractor.handleError(t)))}importVideos(r,t,o){let a=e.BASE_VIDEO_CHANNEL_URL+r+"/import-videos",h={externalChannelUrl:t,videoChannelSyncId:o};return this.authHttp.post(a,h).pipe(i(E=>this.restExtractor.handleError(E)))}};s(e,"BASE_VIDEO_CHANNEL_URL",C.apiUrl+"/api/v1/video-channels/"),s(e,"\u0275fac",function(t){return new(t||e)(c(f),c(N),c(H),c(R))}),s(e,"\u0275prov",u({token:e,factory:e.\u0275fac,providedIn:"root"}));var U=e;export{v as a,U as b};
/**i18n:68865f44f2a527c44cf5136a17c76a0ff8308c2bae5c7c8d50070a5fb9847c44*/
//# sourceMappingURL=chunk-DRC3434R.js.map
