import{Bc as zn,Hs as se,Wa as g,Wt as Jn,fr as S,gt as G,ha as cf,jo as kr,or as Rg,pc as vn,ro as he,sn as M,ys as pt}from"./chunk-B_pj7Jpm.js";import{r as b,t as H}from"./chunk-CagJEiiY.js";var y=class i{authHttp=g(zn);restService=g(Rg);restExtractor=g(Jn);static BASE_REDUNDANCY_URL=se.apiUrl+`/api/v1/server/redundancy`;updateRedundancy(t,e){let r=i.BASE_REDUNDANCY_URL+`/`+t,o={redundancyAllowed:e};return this.authHttp.put(r,o).pipe(he(a=>this.restExtractor.handleError(a)))}listVideoRedundancies(t){let{pagination:e,sort:r,target:o}=t,a=new vn;return a=this.restService.addRestGetParams(a,e,r),o&&(a=a.append(`target`,o)),this.authHttp.get(i.BASE_REDUNDANCY_URL+`/videos`,{params:a}).pipe(he(b=>this.restExtractor.handleError(b)))}addVideoRedundancy(t){return this.authHttp.post(i.BASE_REDUNDANCY_URL+`/videos`,{videoId:t.id}).pipe(he(e=>this.restExtractor.handleError(e)))}removeVideoRedundancies(t){return kr(...t.redundancies.streamingPlaylists.map(r=>r.id).map(r=>this.removeRedundancy(r))).pipe(cf())}removeRedundancy(t){return this.authHttp.delete(i.BASE_REDUNDANCY_URL+`/videos/`+t).pipe(he(e=>this.restExtractor.handleError(e)))}static ɵfac=function(e){return new(e||i)};static ɵprov=S({token:i,factory:i.ɵfac})};var x=class i{authHttp=g(zn);restExtractor=g(Jn);store=new Map;getVideoFileToken({videoUUID:t,videoPassword:e}){let r=this.store.get(t);return r?M(r):this.createVideoFileToken(t,e).pipe(pt(o=>this.store.set(t,{token:o.token,expires:new Date(o.expires)})))}createVideoFileToken(t,e){let r=b.buildVideoPasswordHeader(e);return this.authHttp.post(`${H.BASE_VIDEO_URL}/${t}/token`,{},{headers:r}).pipe(G(({files:o})=>o),he(o=>this.restExtractor.handleError(o)))}static ɵfac=function(e){return new(e||i)};static ɵprov=S({token:i,factory:i.ɵfac})};export{y as n,x as t};
//# debugId=e33453a2-3e95-5b1b-9026-14810a44871c
//# sourceMappingURL=chunk-DFa38la6.js.map