var i,a;!function(i){i.Article="Article",i.Blog="Blog",i.Book="Book",i.CaseStudy="Case Study",i.CustomerInterview="Customer Interview",i.Course="Course",i.Learning="Learning",i.Doc="Doc",i.Guide="Guide",i.Podcast="Podcast",i.Tutorial="Tutorial",i.Video="Video",i.Whitepaper="Whitepaper",i.Webinar="Webinar"}(i||(i={})),function(i){i.Prismic="prismic"}(a||(a={}));const e=i=>{var a,e,o;let t=[];return null===(o=null===(e=null===(a=i.doc)||void 0===a?void 0:a.data)||void 0===e?void 0:e.body)||void 0===o||o.forEach(i=>{var a,e;null===(e=null===(a=i.primary)||void 0===a?void 0:a.content)||void 0===e||e.forEach(i=>{var a;(null===(a=i.type)||void 0===a?void 0:a.includes("heading"))&&t.push(i.text)})}),t},o=i=>({id:i.uid,title:i.data.title||null,description:i.data.tagline||null,tags:i.tags||[],publishDate:i.first_publication_date||null,updatedDate:i.last_publication_date||null,type:r(i.type),authors:l(i),metaImage:t(i.data.meta_image),heroImage:t(i.data.hero_image||i.data.cover_image),source:a.Prismic,doc:i}),t=i=>i&&i.url?i.url:"",l=i=>{var a;return i.data.hosts&&i.data.hosts.length||i.data.author&&i.data.author.length?"webinar"===i.type?i.data.hosts.map(i=>{var a;return{name:i.name||"",title:i.title||"",link:(null===(a=i.profile_link)||void 0===a?void 0:a.url)||"",avatar:i.photo||""}}):i.data.author&&i.data.author.length?i.data.author.map(i=>{var a;return{name:i.name||"",title:i.title||"",link:(null===(a=i.author_url)||void 0===a?void 0:a.url)||"",avatar:i.photo||""}}):i.data.author?[{name:i.data.author.name||"",title:i.data.author.title||"",link:(null===(a=i.data.author.author_url)||void 0===a?void 0:a.url)||"",avatar:i.data.author.photo||""}]:[]:[]},r=a=>({article:i.Article,blog:i.Blog,book:i.Book,case_study:i.CaseStudy,course:i.Course,customer_story:i.CustomerInterview,doc:i.Doc,guide:i.Guide,learning:i.Learning,podcast:i.Podcast,tutorial:i.Tutorial,video:i.Video,webinar:i.Webinar,whitepaper:i.Whitepaper}[a]);export{i as R,e as a,l as g,o as p}