import{$ as u,B as i,C as h,D as f,Jc as w,Nc as E,Td as d,Xf as L,Y as A,bf as P,bg as g,i as p}from"./chunk-QXV2GR6R.js";import{i as l}from"./chunk-JJ4RDTEF.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:"\u0641\u06CC\u0644\u062A\u0631\u0647\u0627\u06CC \u067E\u06CC\u0634\u0631\u0641\u062A\u0647",children:[{value:"state:accepted",label:"\u0641\u0627\u0644\u0648\u0647\u0627\u06CC \u067E\u0630\u06CC\u0631\u0641\u062A\u0647 \u0634\u062F\u0647"},{value:"state:rejected",label:"\u0641\u0627\u0644\u0648\u0647\u0627\u06CC \u067E\u0630\u06CC\u0631\u0641\u062A\u0647 \u0646\u0634\u062F\u0647"},{value:"state:pending",label:"\u0641\u0627\u0648\u0644\u0648\u0647\u0627\u06CC \u062F\u0631 \u0627\u0646\u062A\u0638\u0627\u0631"}]}];}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:224bcada6943fe8b17ea60808c2d370cec9507c3bd670ebe71692d099a3befa1*///# sourceMappingURL=chunk-GTGWJ4QE.js.map