import{$ as u,B as i,C as h,D as f,Ic as w,Mc as E,Sd as d,Wf as L,Y as A,_f as g,af as P,i as p}from"./chunk-X3RCWQ3R.js";import{i as l}from"./chunk-SR6RTMQI.js";var s=class s{constructor(e,o,t){l(this,"authHttp");l(this,"restService");l(this,"restExtractor");this.authHttp=e,this.restService=o,this.restExtractor=t;}getFollowing(e){let{pagination:o,sort:t,search:a,state:n,actorType:c}=e,r=new w();return r=this.restService.addRestGetParams(r,o,t),a&&(r=this.restService.addObjectParams(r,this.parseFollowsListFilters(a))),n&&(r=r.append("state",n)),c&&(r=r.append("actorType",c)),this.authHttp.get(s.BASE_APPLICATION_URL+"/following",{params:r}).pipe(i(m=>this.restExtractor.handleError(m)));}getFollowers(e){let{pagination:o,sort:t,search:a,state:n,actorType:c}=e,r=new w();return r=this.restService.addRestGetParams(r,o,t),a&&(r=this.restService.addObjectParams(r,this.parseFollowsListFilters(a))),n&&(r=r.append("state",n)),c&&(r=r.append("actorType",c)),this.authHttp.get(s.BASE_APPLICATION_URL+"/followers",{params:r}).pipe(i(m=>this.restExtractor.handleError(m)));}follow(e){let o={handles:e.filter(t=>t.includes("@")),hosts:e.filter(t=>!t.includes("@"))};return this.authHttp.post(s.BASE_APPLICATION_URL+"/following",o).pipe(i(t=>this.restExtractor.handleError(t)));}unfollow(e){let o=d(e);return p(o).pipe(f(t=>{let a=t.following.name+"@"+t.following.host;return this.authHttp.delete(s.BASE_APPLICATION_URL+"/following/"+a);}),h(),i(t=>this.restExtractor.handleError(t)));}acceptFollower(e){let o=d(e);return p(o).pipe(f(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${s.BASE_APPLICATION_URL}/followers/${a}/accept`,{});}),h(),i(t=>this.restExtractor.handleError(t)));}rejectFollower(e){let o=d(e);return p(o).pipe(f(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.post(`${s.BASE_APPLICATION_URL}/followers/${a}/reject`,{});}),h(),i(t=>this.restExtractor.handleError(t)));}removeFollower(e){let o=d(e);return p(o).pipe(f(t=>{let a=t.follower.name+"@"+t.follower.host;return this.authHttp.delete(`${s.BASE_APPLICATION_URL}/followers/${a}`);}),h(),i(t=>this.restExtractor.handleError(t)));}buildFollowsListFilters(){return[{title:"Filtros avan\xE7ados",children:[{value:"state:accepted",label:"Seguidores aceitos"},{value:"state:rejected",label:"Seguidores rejeitados"},{value:"state:pending",label:"Seguidores pendentes"}]}];}parseFollowsListFilters(e){return this.restService.parseQueryStringFilter(e,{state:{prefix:"state:"}});}};l(s,"BASE_APPLICATION_URL",P.apiUrl+"/api/v1/server"),l(s,"\u0275fac",function(o){return new(o||s)(u(E),u(g),u(L));}),l(s,"\u0275prov",A({token:s,factory:s.ɵfac}));var I=s;export{I as a};/**i18n:3d16453f213eb5db982e7e7dd90631843ac5d3f860726a614777c3e9e3f9b57e*///# sourceMappingURL=chunk-W7JKU7IQ.js.map