import{An as M,Dr as Rg,Fa as er,Ja as g,Mr as S,St as G,To as je,ea as ae,fc as vn,pi as Wn,ro as he}from"./chunk-b0nJCs5_.js";import{i as z}from"./chunk-BXrVgciI.js";import{t as H}from"./chunk-CswnO8Ym.js";import{t as Z}from"./chunk-D3sqbh442.js";var A=class o{authHttp=g(Wn);restExtractor=g(er);restService=g(Rg);videoService=g(H);playlistService=g(Z);static BASE_SEARCH_URL=ae.apiUrl+`/api/v1/search/`;searchVideos(c){let{search:i,uuids:a,componentPagination:s,advancedSearch:r,skipCount:l}=c;if(r?.resultType!==void 0&&r.resultType!==`videos`)return M({total:0,data:[]});let n=o.BASE_SEARCH_URL+`videos`,t;s&&(t=this.restService.componentToRestPagination(s));let e=new vn;if(e=this.restService.addRestGetParams(e,t),i&&(e=e.append(`search`,i)),l===!0&&(e=e.append(`skipCount`,!0)),a&&(e=this.restService.addArrayParams(e,`uuids`,a)),r){let p=r.toVideosAPIObject();e=this.restService.addObjectParams(e,p)}return e=this.videoService.buildNSFWParams(e,{}),this.authHttp.get(n,{params:e}).pipe(je(p=>this.videoService.extractVideos(p)),he(p=>this.restExtractor.handleError(p)))}searchVideoChannels(c){let{search:i,advancedSearch:a,componentPagination:s,handles:r}=c;if(a?.resultType!==void 0&&a.resultType!==`channels`)return M({total:0,data:[]});let l=o.BASE_SEARCH_URL+`video-channels`,n;s&&(n=this.restService.componentToRestPagination(s));let t=new vn;if(t=this.restService.addRestGetParams(t,n),i&&(t=t.append(`search`,i)),r&&(t=this.restService.addArrayParams(t,`handles`,r)),a){let e=a.toChannelAPIObject();t=this.restService.addObjectParams(t,e)}return this.authHttp.get(l,{params:t}).pipe(G(e=>z.extractVideoChannels(e)),he(e=>this.restExtractor.handleError(e)))}searchVideoPlaylists(c){let{search:i,advancedSearch:a,componentPagination:s,uuids:r}=c;if(a?.resultType!==void 0&&a.resultType!==`playlists`)return M({total:0,data:[]});let l=o.BASE_SEARCH_URL+`video-playlists`,n;s&&(n=this.restService.componentToRestPagination(s));let t=new vn;if(t=this.restService.addRestGetParams(t,n),i&&(t=t.append(`search`,i)),r&&(t=this.restService.addArrayParams(t,`uuids`,r)),a){let e=a.toPlaylistAPIObject();t=this.restService.addObjectParams(t,e)}return this.authHttp.get(l,{params:t}).pipe(je(e=>this.playlistService.extractPlaylists(e)),he(e=>this.restExtractor.handleError(e)))}static ɵfac=function(i){return new(i||o)};static ɵprov=S({token:o,factory:o.ɵfac})};export{A as t};
//# debugId=95ca5f86-c3c9-5d96-9458-2c0e6ce4400b
//# sourceMappingURL=chunk-2WQXD8yV2.js.map