import{$c as E,B as l,C as c,D as h,Xc as w,Y as A,aa as u,i as p,ie as f,sh as L,tg as P,xh as g}from"./chunk-GM43ZGTR.js";import{i as d}from"./chunk-SLIYHYWC.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:"Roz\u0161\xED\u0159en\xE9 filtry",children:[{value:"state:accepted",label:"P\u0159ijat\xE9 n\xE1sleduj\xEDc\xED"},{value:"state:rejected",label:"Odm\xEDtnut\xE9 sleduj\xEDc\xED"},{value:"state:pending",label:"\u010Cekaj\xEDc\xED sleduj\xEDc\xED"}]}];}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:aa38438cfc6bb6877c9985433629bf5f310ba8cfd6183982ad2c0c8f601d3935*///# sourceMappingURL=chunk-DIXEORHR.js.map