import{a as y,b as g,c as s}from"./chunk-U4X5SOV4.js";import{aa as w,bc as $,oa as R}from"./chunk-4VIHFD42.js";import{Ed as u,S as d,W as v,a,aa as f,b as l,da as A,x as m}from"./chunk-FK3HKV4J.js";var M=(()=>{let o=class o{constructor(t,r){this.reqService=t,this.apiService=r,this.categoryArticlesCache={}}getCategoryArticles(t,r=0,e=10,i,c,n=[]){let p=[t,r,e,i,c,n].join("/");return this.categoryArticlesCache[p]||(this.categoryArticlesCache[p]=this.apiService.getCategoryArticles(t,r,e,i,c,n).pipe(d())),this.categoryArticlesCache[p]}getArticlePreview(t,r,e){let i=Math.floor(new Date().getTime());return this.reqService.get(`/content-page/article/${t}/preview/view?previewHash=${r}&t=${i.toString()}`,{params:{previewType:e}}).pipe(m(({data:c,meta:n})=>({data:y(c),meta:n})))}getArticleRedirect(t){return this.reqService.get(`/portal/redirection?url=${t}`)}getArticle(t,r,e,i,c){let n=c?`?token=${c}`:"";return this.reqService.get(`/content-page/article/${t}/${r}/${(e+"").padStart(2,"0")}/${i}${n}`).pipe(m(({data:p,meta:C})=>({data:y(p),meta:C})))}getArticleRecommendations(t,r){return r?this.getCategoryArticles(r,0,5).pipe(v(e=>this.reqService.get(`/content-page/article/${t}/recommendation`).pipe(m(({data:i,meta:c})=>({data:l(a({},i),{categoryArticles:e.data,highPriorityArticles:i.highPriorityArticles?.map(s),lowPriorityArticles:i.lowPriorityArticles?.map(s),externalRecommendation:i.externalRecommendation?.map(g),lastThreeDaysMostReadArticles:i.lastThreeDaysMostReadArticles?.map(s)}),meta:c}))))):this.reqService.get(`/content-page/article/${t}/recommendation`).pipe(m(({data:e,meta:i})=>({data:l(a({},e),{highPriorityArticles:e.highPriorityArticles?.map(s),lowPriorityArticles:e.lowPriorityArticles?.map(s),externalRecommendation:e.externalRecommendation?.map(g),lastThreeDaysMostReadArticles:e.lastThreeDaysMostReadArticles?.map(s)}),meta:i})))}prepareArticleBody(t){return t?.map(r=>l(a({},r),{details:(r.details??[]).map(e=>a(a({},e),this.prepareArticleBodyDetail(e,r.type)))}))}prepareArticleBodyDetail(t,r){let e;switch(r){case w.Article:e=l(a({},t),{value:l(a({},R(t.value)),{label:{text:"Ezt is aj\xE1nljuk a t\xE9m\xE1ban"}})});break;default:e=a({},t)}return e}};o.\u0275fac=function(r){return new(r||o)(A(u),A($))},o.\u0275prov=f({token:o,factory:o.\u0275fac,providedIn:"root"});let h=o;return h})();export{M as a};