"use strict";(this.__LOADABLE_LOADED_CHUNKS__=this.__LOADABLE_LOADED_CHUNKS__||[]).push([[696],{8140:(t,e,r)=>{var a=r(5086),n=r(6933),i=r(6955),o=r(7004),s=r(3944),d=r(8161),l=r(486),c=r(3254),u=r(1002),p=r(6821),g=r(2651),h=r(8098);const Z=(0,g.Z)("p",{target:"e17tdogt0"})({fontSize:h.Z.size[10],opacity:.7},"");var m=r(2970),f=r(5613),y=r(9295);function P(t,e){const r=new Date(t);return`${function(t,e){return{1:e("Jan"),2:e("Feb"),3:e("Mar"),4:e("Apr"),5:e("May"),6:e("Jun"),7:e("Jul"),8:e("Aug"),9:e("Sep"),10:e("Oct"),11:e("Nov"),12:e("Dec")}[t]}(r.getMonth()+1,e)} ${r.getDate()}, ${r.getFullYear()} `}function S(t){const e=Math.floor(t/60);return e>0?`${e} min${e>1?"s":""}`:`${t} secs`}var I=r(6044),v=r(6832),b=r(6991),E=r(8458);const w=function({analytics:t,episodes:e,onClick:r,podcastId:a,podcastUrl:n,title:g}){const h=(0,y.Z)(),w=(0,b.qM)(),{getCurrentlyPlaying:k,play:C,playerState:_}=(0,v.useContext)(l.Z.Context),[O]=(0,b.se)(),$=_===c.ZP.Playing,{trackId:D}=k()||{},[T,U]=(0,v.useState)(0),[x,A]=(0,v.useState)(0),L=(0,v.useRef)((0,I.xv)({episodeId:"",name:g,playedFrom:d.Z.RESP_WIDGET_PROFILE_EPISODE_PLAY,podcastId:a,subName:""})),R={id:D,name:g,type:"podcast",typeId:a},H=(n,s)=>{var l;const c=e.find((t=>`${t.id}`===D)),u=(0,I.xv)({episodeId:D||"",name:g,playedFrom:d.Z.RESP_WIDGET_PROFILE_EPISODE_PLAY,podcastId:a,subName:null!=(l=null==c?void 0:c.title)?l:""});var p,Z;$&&n===D?(h.track(o.Z.Pause),null==t||t.track(o.Z.Pause,u),null==t||t.track(o.Z.StreamEnd,(0,I.qz)(u,{endReason:i.Z.PAUSE,listenTime:Math.round(null!=(p=null==O?void 0:O.position)?p:0)}))):(L.current=(0,I.xv)({episodeId:n,name:g,playedFrom:d.Z.RESP_WIDGET_PROFILE_EPISODE_PLAY,podcastId:a,subName:s}),null==t||t.track(o.Z.Play,L.current),A(Date.now()),h.track(o.Z.Play,R),$&&(null==t||t.track(o.Z.StreamEnd,(0,I.qz)(u,{endReason:i.Z.NEW_STATION_START,listenTime:Math.round(null!=(Z=null==O?void 0:O.position)?Z:0)})))),r(),C(a,{trackId:n})};(0,f.Z)((()=>{var t;U(null==(t=window)?void 0:t.innerHeight)})),(0,v.useEffect)((()=>{_===c.ZP.Playing&&x&&(null==t||t.track(o.Z.StreamStart,(0,I.qz)(L.current,{playbackStartTime:Date.now(),streamInitTime:x})),A(0),h.track(o.Z.StreamStart,R))}),[_,x]);const B=["Space"," ","Enter"];return(0,E.BX)(p.Z,{height:T,children:[e.map((({duration:t,id:e,startDate:r,title:a})=>(0,E.BX)(u.Z,{"data-test":"podcast-episode-row",onClick:()=>H(`${e}`,a),onKeyUp:t=>{B.includes(t.key)&&H(`${e}`,a)},tabIndex:0,children:[(0,E.tZ)(m.Z,{"data-test":"episode-title",selected:`${e}`===D,children:a}),(0,E.BX)(Z,{"data-test":"subtext",children:[P(r,w)," • ",S(t)]})]},e))),(0,E.tZ)(s.Z,{href:n||"",text:w("Listen to more episodes")})]})};var k=r(2038),C=r(3029),_=r(2218),O=r(3422),$=r(6056),D=r(6676),T=r(8914),U=r.n(T),x=r(5358),A=r(6438),L=r(1724),R=r(4258),H=r(9170),B=r(1515),M=r(8591);const F={fetchPodcastEpisodes:async function({ampUrl:t="",logger:e=H.Z,podcastId:r,sortAsc:a,transport:n}){if(!r){const t=new M.Z(400,"Failed to fetch podcast info, podcast id missing.");throw e.error(H.K.SERVER,t.message,{},t),t}const i=a?"startDate-asc":"startDate-desc",[o,s]=B.Z`${{ampUrl:t}}/api/v3/podcast/podcasts/${{podcastId:String(r)}}/episodes?sortBy=${{sortBy:i}}`,{data:d}=await n.get(o,{params:{requestName:s}});return d.data},fetchPodcastShow:r(2509).Z};var N=r(2787),z=r.n(N),j=r(6959),q=r(7996);function V(){return V=Object.assign?Object.assign.bind():function(t){for(var e=1;e{t&&t.trackPageView((0,I.BS)({name:Z,pageName:"podcast_profile",podcastId:p}))}));const[,z]=(0,x.Z)((0,E.tZ)(_.Z,{body:r?U()(r):"",title:Z,url:g})),j=B||a,V=i.find((t=>`${t.id}`===j)),W=V?V.title:"",Q=V?V.imageUrl:s;return(0,v.useEffect)((()=>{Object.values(c.rO).includes(S)?F(!0):S===c.ZP.Playing&&F(!1)}),[H,S]),(0,E.BX)(n.Z,{children:[(0,E.tZ)(D.Z,{shouldShow:!(H||M),children:(0,E.tZ)(O.Z,{description:r?U()(r):"",hasPlayed:[c.ZP.Playing,c.ZP.Paused,c.ZP.Buffering].includes(S),icons:[(0,E.tZ)(C.Z,{href:g},"iheartlink")],infoHeading:"iHeart",infoHeadingSmallHeight:`${h} •`,isPodcast:!0,showDescription:!1,subHeading:(0,E.tZ)(k.Z,{"data-test":"subheading-link",href:g,children:W||h}),title:(0,E.tZ)(k.Z,{"data-test":"title-link",href:g,children:Z}),toggleInfoModal:z})}),(0,E.tZ)($.Z,{analytics:t,analyticsData:{name:Z,playedFrom:N,subName:W},autoplay:e,description:r,dimensions:q.I.PODCAST_PROFILE,episodeId:j,followUrl:o,getPlaybackErrorMessage:(0,L.e)(y),hasPlayed:T,imageUrl:Q,isError:H||M,metadata:{episode:W,mainImage:s,podcast:Z,trackImage:Q},origQuery:u,podcastId:p,podcastUrl:g,positionBottom:!1,shareText:y("Share this podcast"),shareTitle:Z,shareUrl:g,title:Z,urlWithQuery:m}),(0,E.tZ)(D.Z,{shouldShow:!(H||M),children:(0,E.tZ)(w,{analytics:t,episodes:i,onClick:()=>{R(!0)},podcastId:p,podcastUrl:g,title:Z})})]})}W.getInitialProps=async function({params:t,query:e},{logger:r=H.Z,transport:a},{websiteUrl:n=""}){const{id:i,namespace:o}=t,{autoplay:s,episodeCount:d}=e,l=(0,j.OR)(i),c=d?Math.min(10,Math.max(1,Number(d))):5,u=F.fetchPodcastShow({logger:r,podcastId:l,transport:a}),{description:p,imageUrl:g,showType:h,title:Z}=await u,m="serial"===h,f=F.fetchPodcastEpisodes({logger:r,podcastId:l,sortAsc:m,transport:a}),y=await f,P=y[0].id,S=y[0].title,I=y.slice(0,c),v={keyid:[Z],pname:"podcast_profile",sc:"widget_share"},b=[];y.length>0&&I.forEach((t=>b.push({stationId:String(l),trackId:String(t.id)})));const E=`${n}/${o}/${i}/`,w=function(t,e={}){const{description:r="true",thumbnail:a="true"}=e,n={description:"true"===r,imageUrl:"true"===a};return(0,R.Z)(t,((t,e)=>n[e]))}({description:p,imageUrl:g},e);return V({autoplay:!!s,basePodcastUrl:E,dimensions:V({},q.I.PODCAST_PROFILE),episodeId:String(P),episodes:I,followUrl:`${E}?${z().stringify(V({},v,{follow:!0}))}`,origQuery:e,podcastId:String(l),podcastUrl:`${E}?${z().stringify(v)}`,subtitle:S,title:Z,tracks:b,urlWithQuery:`${E}?${z().stringify(e)}`},w)};const Q=W;(0,a.Z)(Q)},3944:(t,e,r)=>{r.d(e,{Z:()=>h});var a=r(8458);function n(){return(0,a.tZ)("svg",{fill:"none",height:"14",viewBox:"0 0 18 18",width:"14",xmlns:"http://www.w3.org/2000/svg",children:(0,a.tZ)("path",{d:"M15 16H3C2.45 16 2 15.55 2 15V3C2 2.45 2.45 2 3 2H8C8.55 2 9 1.55 9 1C9 0.45 8.55 0 8 0H2C0.89 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V10C18 9.45 17.55 9 17 9C16.45 9 16 9.45 16 10V15C16 15.55 15.55 16 15 16ZM11 1C11 1.55 11.45 2 12 2H14.59L5.46 11.13C5.07 11.52 5.07 12.15 5.46 12.54C5.85 12.93 6.48 12.93 6.87 12.54L16 3.41V6C16 6.55 16.45 7 17 7C17.55 7 18 6.55 18 6V1C18 0.45 17.55 0 17 0H12C11.45 0 11 0.45 11 1Z"})})}var i=r(2651),o=r(8098);const s=(0,i.Z)("p",{target:"ef22gkm0"})({fontSize:o.Z.size[14],padding:"0.1rem 2rem"},"");var d=r(2038),l=r(5856);const c=(0,i.Z)(d.Z,{target:"ew7m1u20"})((({theme:t})=>{const{r:e,g:r,b:a}=(0,l.Z)(t.backgroundSecondary);return{":hover":{backgroundColor:`rgba(${e}, ${r}, ${a}, 0.5)`},display:"block",padding:"1rem"}}),""),u=["children"];function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0||(n[r]=t[r]);return n}(t,u);return(0,a.tZ)(c,p({},r,{children:e}))}function h({href:t,text:e}){return(0,a.BX)(g,{"data-test":"more-link",href:t,children:[(0,a.tZ)("div",{style:{float:"left"},children:(0,a.tZ)(n,{})}),(0,a.tZ)(s,{children:e})]})}},1002:(t,e,r)=>{r.d(e,{Z:()=>o});var a=r(2651),n=r(8098),i=r(5856);const o=(0,a.Z)("div",{target:"emqn7nu0"})((({cursorPointer:t=!0,theme:e,thinRow:r})=>{const{r:a,g:o,b:s}=(0,i.Z)(e.backgroundSecondary);return{":hover":{backgroundColor:t?`rgba(${a}, ${o}, ${s}, 0.5)`:"auto"},cursor:t?"pointer":"auto",fontSize:n.Z.size[12],overflow:"auto",padding:r?"0.5rem 1.3rem":"1rem"}}),"")},6821:(t,e,r)=>{r.d(e,{Z:()=>o});var a=r(2651),n=r(5420),i=r(6299);const o=(0,a.Z)("div",{target:"esak4d00"})((({height:t,theme:e})=>({backgroundColor:e.backgroundTertiary,height:t-164+"px",marginTop:"8.2rem",overflow:"scroll",[(0,i.Z)(n.Z.max.height[399])]:{height:t-157+"px",marginTop:"7.5rem"},[(0,i.Z)(n.Z.max.width[199])]:{height:t-127+"px",marginTop:"4.9rem"}})),"")},2970:(t,e,r)=>{r.d(e,{Z:()=>i});var a=r(2651),n=r(8098);const i=(0,a.Z)("p",{target:"e15fws500"})((({selected:t=!1,theme:e})=>({color:t?e.activeText:"inherit",fontSize:n.Z.size[14],lineHeight:1.3,paddingBottom:"0.5rem",paddingTop:"1rem"})),"")}},t=>{t.O(0,[109,402,700,246,90,937],(()=>(8140,t(t.s=8140)))),t.O()}]); //# sourceMappingURL=podcastProfile.widget.js.map