import{B as l,C as c,D as h,Kh as L,Ph as g,Y as A,aa as u,fd as w,i as p,id as E,sf as P,ve as f}from"./chunk-DWEAL4OJ.js";import{i as d}from"./chunk-YM6OINSR.js";var s=class s{authHttp=u(E);restService=u(g);restExtractor=u(L);getFollowing(r){let{pagination:o,sort:t,search:a,state:i,actorType:n}=r,e=new w();return e=this.restService.addRestGetParams(e,o,t),a&&(e=this.restService.addObjectParams(e,this.parseFollowsListFilters(a))),i&&(e=e.append("state",i)),n&&(e=e.append("actorType",n)),this.authHttp.get(s.BASE_APPLICATION_URL+"/following",{params:e}).pipe(l(m=>this.restExtractor.handleError(m)));}getFollowers(r){let{pagination:o,sort:t,search:a,state:i,actorType:n}=r,e=new w();return e=this.restService.addRestGetParams(e,o,t),a&&(e=this.restService.addObjectParams(e,this.parseFollowsListFilters(a))),i&&(e=e.append("state",i)),n&&(e=e.append("actorType",n)),this.authHttp.get(s.BASE_APPLICATION_URL+"/followers",{params:e}).pipe(l(m=>this.restExtractor.handleError(m)));}follow(r){let o={handles:r.filter(t=>t.includes("@")),hosts:r.filter(t=>!t.includes("@"))};return this.authHttp.post(s.BASE_APPLICATION_URL+"/following",o).pipe(l(t=>this.restExtractor.handleError(t)));}unfollow(r){let o=f(r);return p(o).pipe(h(t=>{let a=t.following.name+"@"+t.following.host;return this.authHttp.delete(s.BASE_APPLICATION_URL+"/following/"+a);}),c(),l(t=>this.restExtractor.handleError(t)));}acceptFollower(r){let o=f(r);return p(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${s.BASE_APPLICATION_URL}/followers/${a}/accept`,{});}),c(),l(t=>this.restExtractor.handleError(t)));}rejectFollower(r){let o=f(r);return p(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${s.BASE_APPLICATION_URL}/followers/${a}/reject`,{});}),c(),l(t=>this.restExtractor.handleError(t)));}removeFollower(r){let o=f(r);return p(o).pipe(h(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.delete(`${s.BASE_APPLICATION_URL}/followers/${a}`);}),c(),l(t=>this.restExtractor.handleError(t)));}buildFollowsListFilters(){return[{title:"Avancerade filter",children:[{value:"state:accepted",label:"Godk\xE4nda prenumerationsf\xF6rfr\xE5gningar"},{value:"state:rejected",label:"Avvisade prenumerationsf\xF6rfr\xE5gningar"},{value:"state:pending",label:"V\xE4ntande prenumerationsf\xF6rfr\xE5gningar"}]}];}parseFollowsListFilters(r){return this.restService.parseQueryStringFilter(r,{state:{prefix:"state:"}});}};d(s,"BASE_APPLICATION_URL",P.apiUrl+"/api/v1/server"),d(s,"\u0275fac",function(o){return new(o||s)();}),d(s,"\u0275prov",A({token:s,factory:s.ɵfac}));var I=s;export{I as a};/**i18n:5a85df092a135682c90bae008e37ec28160e04e5f445e29af2927333ba91ffa1*///# sourceMappingURL=chunk-3JRW664Q.js.map