var l=Object.defineProperty;var g=(s,r,e)=>r in s?l(s,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[r]=e;var d=(s,r,e)=>g(s,typeof r!="symbol"?r+"":r,e);import{m as P,$ as a,a as u}from"./B8nX8PFk.js";class m{constructor(){d(this,"resource","/api/v2/Podcasts")}async get(r){var n,i;if(((n=r.props.extra)==null?void 0:n.podcast_id)!==void 0)return await this.getById((i=r.props.extra)==null?void 0:i.podcast_id);const{params:e,paginationHandler:t}=P(r);try{const o=await a(this.resource,{params:e});if(!o)return[];const c=o.items.map(p=>u(p));return c!=null&&c.length?t.getData(c):[]}catch(o){return console.error("[PodcastsRepo] get() mapping Failed",o),[]}}async getById(r){try{const e=await a(`${this.resource}/${r}`);return e?[u(e)]:[]}catch(e){return console.error("[PodcastsRepo] getById() mapping Failed",e),[]}}async getPodcast(r){try{const e=await a(`${this.resource}/${r.podcastId}`);return e||null}catch(e){return console.error("[PodcastsRepo] getPodcast() Request Failed",e),null}}async getList(r){const e={data:[],page:1,pages:1};try{const t=await a(this.resource,{params:r});return t&&(e.data=t.items||[],e.page=t.page||1,e.pages=t.pages||1),e}catch(t){return console.error("[PodcastsRepo] getList() Request Failed",t),e}}async getCategories(){try{const r=await a(`${this.resource}/filters/categories`);return r?r??[]:[]}catch(r){return console.error("[PodcastsRepo] getCategories() Request Failed",r),[]}}async getSports(){try{const r=await a(`${this.resource}/filters/sports`);return r?r??[]:[]}catch(r){return console.error("[PodcastsRepo] getSports() Request Failed",r),[]}}async trackPlay(r){try{await a(`${this.resource}/${r}/play`,{method:"POST"})}catch(e){console.error("[PodcastsRepo] trackPlay() Request Failed",e)}}async trackDownload(r){try{await a(`${this.resource}/${r}/download`,{method:"POST"})}catch(e){console.error("[PodcastsRepo] trackDownload() Request Failed",e)}}async recordProgress(r,e){try{await a(`${this.resource}/${r}/recordProgress`,{params:e,method:"POST"})}catch(t){console.error("[PodcastsRepo] recordProgress() Request Failed",t)}}async getSettings(){try{return await a(`${this.resource}/settings`)}catch(r){return console.error("[PodcastsRepo] getSettings() Request Failed",r),null}}}export{m as P};