import{a as v}from"./chunk-NHSA3A3A.js";import{B as a,S as l,Tc as x,Xc as f,Xg as N,Y as u,aa as s,e as d,n as m,nh as H,og as C,sh as S,zh as R}from"./chunk-A3ION7ZA.js";import{i}from"./chunk-AI7IVZV2.js";var n=class n{authHttp=s(f);restExtractor=s(H);accountLoaded=new d(1);getAccount(e){return this.authHttp.get(n.BASE_ACCOUNT_URL+e).pipe(m(t=>new N(t)),l(t=>this.accountLoaded.next(t)),a(t=>this.restExtractor.handleError(t)))}};i(n,"BASE_ACCOUNT_URL",C.apiUrl+"/api/v1/accounts/"),i(n,"\u0275fac",function(t){return new(t||n)}),i(n,"\u0275prov",u({token:n,factory:n.\u0275fac}));var L=n;var r=class r{authHttp=s(f);restService=s(S);restExtractor=s(H);serverService=s(R);videoChannelLoaded=new d(1);static extractVideoChannels(e){let t=[];for(let o of e.data)t.push(new v(o));return{data:t,total:e.total}}getVideoChannel(e){return this.authHttp.get(r.BASE_VIDEO_CHANNEL_URL+e).pipe(m(t=>new v(t)),l(t=>this.videoChannelLoaded.next(t)),a(t=>this.restExtractor.handleError(t)))}listAccountVideoChannels(e){let{account:t,componentPagination:o,withStats:c=!1,sort:h,search:E}=e,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",c+""),E&&(p=p.set("search",E));let g=L.BASE_ACCOUNT_URL+t.nameWithHost+"/video-channels";return this.authHttp.get(g,{params:p}).pipe(m(A=>r.extractVideoChannels(A)),a(A=>this.restExtractor.handleError(A)))}createVideoChannel(e){return this.authHttp.post(r.BASE_VIDEO_CHANNEL_URL,e).pipe(a(t=>this.restExtractor.handleError(t)))}updateVideoChannel(e,t){return this.authHttp.put(r.BASE_VIDEO_CHANNEL_URL+e,t).pipe(a(o=>this.restExtractor.handleError(o)))}changeVideoChannelImage(e,t,o){let c=r.BASE_VIDEO_CHANNEL_URL+e+"/"+o+"/pick";return this.authHttp.post(c,t).pipe(a(h=>this.restExtractor.handleError(h)))}deleteVideoChannelImage(e,t){let o=r.BASE_VIDEO_CHANNEL_URL+e+"/"+t;return this.authHttp.delete(o).pipe(a(c=>this.restExtractor.handleError(c)))}removeVideoChannel(e){return this.authHttp.delete(r.BASE_VIDEO_CHANNEL_URL+e.nameWithHost).pipe(a(t=>this.restExtractor.handleError(t)))}importVideos(e,t,o){let c=r.BASE_VIDEO_CHANNEL_URL+e+"/import-videos",h={externalChannelUrl:t,videoChannelSyncId:o};return this.authHttp.post(c,h).pipe(a(E=>this.restExtractor.handleError(E)))}};i(r,"BASE_VIDEO_CHANNEL_URL",C.apiUrl+"/api/v1/video-channels/"),i(r,"\u0275fac",function(t){return new(t||r)}),i(r,"\u0275prov",u({token:r,factory:r.\u0275fac,providedIn:"root"}));var U=r;export{L as a,U as b};
/**i18n:1cf7c077143c4c267fdafbe5508f191afcef21bad6aba22a3a8dc180e1003753*/
//# sourceMappingURL=chunk-VNDV45NT.js.map
