import {Z}from'./chunk-DKL7x6EW.js';import {g,aS as kn,aT as to,aU as XP,aC as x,aV as oe,bs as L$1,aW as ln,a9 as Oe,aX as fe,aN as $,aY as S,dF as z}from'./main-BiUBeaMj.js';var j=class o{authHttp=g(kn);restExtractor=g(to);restService=g(XP);videoService=g(x);playlistService=g(Z);static BASE_SEARCH_URL=oe.apiUrl+"/api/v1/search/";searchVideos(c){let{search:a,uuids:r,componentPagination:s,advancedSearch:i,skipCount:p}=c;if(i?.resultType!==void 0&&i.resultType!=="videos")return L$1({total:0,data:[]});let n=o.BASE_SEARCH_URL+"videos",t;s&&(t=this.restService.componentToRestPagination(s));let e=new ln;if(e=this.restService.addRestGetParams(e,t),a&&(e=e.append("search",a)),p===true&&(e=e.append("skipCount",true)),r&&(e=this.restService.addArrayParams(e,"uuids",r)),i){let h=i.toVideosAPIObject();e=this.restService.addObjectParams(e,h);}return e=this.videoService.buildNSFWParams(e,{}),this.authHttp.get(n,{params:e}).pipe(Oe(h=>this.videoService.extractVideos(h)),fe(h=>this.restExtractor.handleError(h)))}searchVideoChannels(c){let{search:a,advancedSearch:r,componentPagination:s,handles:i}=c;if(r?.resultType!==void 0&&r.resultType!=="channels")return L$1({total:0,data:[]});let p=o.BASE_SEARCH_URL+"video-channels",n;s&&(n=this.restService.componentToRestPagination(s));let t=new ln;if(t=this.restService.addRestGetParams(t,n),a&&(t=t.append("search",a)),i&&(t=this.restService.addArrayParams(t,"handles",i)),r){let e=r.toChannelAPIObject();t=this.restService.addObjectParams(t,e);}return this.authHttp.get(p,{params:t}).pipe($(e=>z.extractVideoChannels(e)),fe(e=>this.restExtractor.handleError(e)))}searchVideoPlaylists(c){let{search:a,advancedSearch:r,componentPagination:s,uuids:i}=c;if(r?.resultType!==void 0&&r.resultType!=="playlists")return L$1({total:0,data:[]});let p=o.BASE_SEARCH_URL+"video-playlists",n;s&&(n=this.restService.componentToRestPagination(s));let t=new ln;if(t=this.restService.addRestGetParams(t,n),a&&(t=t.append("search",a)),i&&(t=this.restService.addArrayParams(t,"uuids",i)),r){let e=r.toPlaylistAPIObject();t=this.restService.addObjectParams(t,e);}return this.authHttp.get(p,{params:t}).pipe(Oe(e=>this.playlistService.extractPlaylists(e)),fe(e=>this.restExtractor.handleError(e)))}static \u0275fac=function(a){return new(a||o)};static \u0275prov=S({token:o,factory:o.\u0275fac})};/**i18n:fad79908930cbb4c308e7550a5fe49bb3841dbb330066a6429aebaa006173605*/export{j};//# sourceMappingURL=chunk-BkaflMxL.js.map
