dotfiles/.config/spicetify/Extracted/Raw/xpui/xpui-routes-episode.js

2 lines
18 KiB
JavaScript
Executable File

"use strict";(("undefined"!=typeof self?self:global).webpackChunkopen=("undefined"!=typeof self?self:global).webpackChunkopen||[]).push([[3472],{47998:(e,t,i)=>{i.d(t,{o:()=>n});var s=i(36844),a=i(41836);function n(){return{version:(0,s.W6)(a.GE)?2:1}}},22315:(e,t,i)=>{i.d(t,{p:()=>u,q:()=>r.q});var s=i(59496),a=i(61740),n=i(66632),r=i(13655),o=i(6664),l=i(95663),c=i(4637);const d=s.memo((function({uri:e,size:t=r.q.md,className:i,onClick:d,showUpsell:u}){const[p,m]=(0,n.Z)(e),h=(0,a.I0)(),g=(0,l.o)(),x=(0,s.useCallback)((()=>{g({targetUri:e,intent:p?"remove-from-library":"add-to-library",type:"click"}),m(!p),h(p?(0,o.SS)():(0,o.kK)())}),[g,e,p,m,h]);return(0,c.jsx)(r.o,{className:i,isFollowing:p,onFollow:x,onClick:d,uri:e,size:t,showUpsell:u})})),u=s.memo((function(e){return(0,c.jsx)(d,{...e})}))},17264:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ht});var s=i(59496),a=i(89605),n=i(36844),r=i(91399),o=i(47792),l=i(50346),c=i(3802),d=i(91703),u=i(92009),p=i(23627),m=i(63082),h=i(47998),g=i(14556),x=i(4637);const y=(0,s.lazy)((()=>i.e(9248).then(i.bind(i,49248)))),b="Episode page";function k(e){const t=(0,g.m)(),i=(0,h.o)();return t?(0,x.jsx)(s.Suspense,{fallback:!0,children:(0,x.jsx)(y,{reason:b,...i,...e})}):null}const C="dpN5ViPOceUWNB5EQPHN",j="vBcxPq3E2okwgXOkVPEM",P="HCCBXwdFvq6omWW2hR0N",T="bJOPO5Zo7dpjSVDwEpSw",f="TXdDDpokVTyJzDEDWHHf",I="HaSbtEVJnxBsaJ5SRi0M",v="YldGldlfaI9myEGXQf9g",S="qJHVIpJn1vLPWsAKfTEZ",E="wSIzjkVlr0Zdy7di2vRm",U="hYS_K1NATGyWt6tCSRqQ",D="hVVaM4pF9arpQ8Nvn2a1",w="zf0Eac1LugsHUacz74Zf",N="TnNaqxbaI0hzhBQZ7wE0",R="zSw1lG1TNe_xm6KTqtCv",L="MlEQDkXnjdKKJueJ9kkB",B="jg0xlyD1yjh0DPNG6eOg",M="QiHXpFb4dLZNOFe5gpp3";var F=i(56162),A=i(34223),O=i(96170),z=i(79475),H=i(41836),$=i(88333);const W=({cardHeaderText:e,cardBodyText:t,buttonText:i,buttonTarget:s})=>(0,n.W6)(H.vp)?(0,x.jsxs)("div",{className:v,children:[(0,x.jsxs)("div",{className:S,children:[(0,x.jsx)(F.D,{variant:"balladBold",semanticColor:"textBase",children:e}),(0,x.jsx)(F.D,{semanticColor:"textBase",children:t})]}),(0,x.jsx)(z.D,{buttonSize:"sm",colorSet:"invertedLight",href:(0,l.EC)(s).toURLPath(!0),component:$.Z,children:i})]}):null,_=({areHTMLDescriptionsEnabled:e,contentInformation:t,description:i,hasDescription:a,htmlDescription:n,onExpanded:r,onTimeStampClick:o,playability:l,showHeader:d=!0,spec:u})=>{const p=(0,O.$P)(),m=(a||t)&&d,h=(0,s.useCallback)((e=>{const t=u.readMoreButtonFactory();p.logInteraction(e?t.hitUiReveal():t.hitUiHide()),r?.()}),[u,p,r]);return(0,x.jsxs)(x.Fragment,{children:[m&&(0,x.jsx)(F.D,{as:"h2",variant:"canon",semanticColor:"textBase",className:P,children:c.ag.get("episode.description-title")}),t&&(0,x.jsx)(W,{cardHeaderText:t.cardHeaderText,cardBodyText:t.cardBodyText,buttonText:t.buttonText,buttonTarget:t.buttonTarget}),a&&(0,x.jsx)(A.o,{className:j,onTimeStampClick:o,maxLines:4,onExpanded:h,content:(i||"").trim(),htmlContent:e&&n?n:void 0,enableTimestamps:l.playable})]})};var K=i(84875),q=i.n(K),Z=i(91929),V=i(84588),J=i(78780),G=i(17096),Q=i(34553),Y=i(21524),X=function(e){return e.DESCRIPTION="description",e.TRANSCRIPT="transcript",e}(X||{});const ee=s.memo((function({transcriptSections:e,descriptionContent:t,transcriptContent:i,spec:a}){const n=(0,O.$P)(),[r,o]=(0,s.useState)(X.DESCRIPTION),{scrollNodeRef:l}=s.useContext(Y.VX),{ref:d,inView:u}=(0,Z.YD)({threshold:[1],root:l.current,rootMargin:`-${Q.K1+1}px 100000px 0px 100000px`}),p=(0,s.useRef)(null),m=(0,s.useCallback)((e=>{p.current=e,d(e)}),[d]);return(0,s.useEffect)((()=>{const e=p.current?.parentElement?.offsetTop,t=l?.current;if(!e||!t)return;const i=e-Q.K1;t.scrollTop>i&&t.scrollTo({top:i})}),[l,r]),(0,x.jsx)(V.l,{list:(0,x.jsxs)(J.F,{className:q()(L,{[B]:!u}),ref:m,children:[(0,x.jsx)(G.c,{label:c.ag.get("web-player.episode.description"),sentenceCase:!0,active:r===X.DESCRIPTION,onClick:()=>{const e=a.tabsFactory().descriptionTabButtonFactory().hitUiReveal();n.logInteraction(e),o(X.DESCRIPTION)},className:q()(M,{[E]:r===X.DESCRIPTION})}),(0,x.jsx)(G.c,{label:c.ag.get("web-player.episode.transcript"),sentenceCase:!0,disabled:null===e,active:r===X.TRANSCRIPT,onClick:()=>{const e=a.tabsFactory().transcriptTabButtonFactory().hitUiReveal();n.logInteraction(e),o(X.TRANSCRIPT)},className:q()(M,{[E]:r===X.TRANSCRIPT})})]}),children:null===e||r===X.DESCRIPTION?t:i})}));var te=i(22733),ie=i(64238),se=i(48607),ae=i(27509);const ne=(0,s.memo)((function({transcriptSections:e,onTimeStampClick:t,episodeUri:i}){const{spec:s,logger:a}=(0,O.fU)(te.m,{data:{uri:i}}),{isPlaying:n}=(0,se.n)({uri:i},{featureIdentifier:"episode"}),r=s.timestampLinkFactory();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{className:D,children:(0,x.jsx)(F.D,{variant:"viola",semanticColor:"textBase",children:c.ag.get("web-player.episode.transcript.disclaimer")})}),e.map(((e,s)=>{const o=`transcript-section-${s}`;return(0,x.jsxs)("div",{className:U,children:[(0,x.jsx)("button",{className:w,onClick:()=>{t(e.startMs,o),a.logInteraction(n?r.hitSeekToTime({msToSeekTo:e.startMs}):r.hitPlay({itemToBePlayed:i}))},children:(0,x.jsx)(ie.D,{id:o,targetURI:(0,l.EC)(i),fadeOut:!0,children:(0,x.jsx)(F.D,{variant:"finaleBold",semanticColor:"textSubdued",className:N,children:(0,ae.m)(e.startMs)})})}),e.content.map(((e,t)=>(0,x.jsx)(F.D,{variant:"viola",semanticColor:"textBase",className:R,dir:"auto",children:e},`transcript-text-${t}`)))]},o)}))]})}));var re=i(51336),oe=i(53417),le=i(55345),ce=i(29251),de=i(95167),ue=i(84229),pe=i(61108),me=i(28106),he=i(49921),ge=i(59200),xe=i(98340);const ye="OYehkMWcGJRKPkByp46K",be="uc1bXkrZqrCz0CMK4lBb",ke="qZeibBbA3SVClzEueYND",Ce=({episodeUri:e,index:t,duration:i,start:a,stop:n,name:r,uri:o,artists:l,album:d,playable:u})=>{const{isActive:p,isPlaying:m,onClick:h}=(0,he.k)({episodeUri:e,start:a,stop:n}),g=(0,s.useCallback)(((e,t)=>{h(t)}),[h]),{spec:y}=(0,O.fU)(de.r,{data:{position:t,reason:"",uri:o}});return(0,x.jsx)(xe.ZP,{value:"row",index:t,children:(0,x.jsx)(ge.xV,{trigger:"right-click",action:"open",menu:(0,x.jsx)(ue.$,{uri:o}),children:(0,x.jsxs)(me.c,{uri:o,index:t,ariaRowIndex:t+1,dragMetadata:{name:r,createdBy:l?.[0].name??""},onTriggerPlay:g,isActive:p,isPlayable:u,spec:y,children:[(0,x.jsxs)(pe.vZ,{ariaColIndex:0,children:[(0,x.jsx)(pe.Du,{uri:o,playAriaLabel:c.ag.get("tracklist.a11y.play",r,l?.[0].name),onClick:g,isPlaying:m,isActive:p,spec:y,children:(0,x.jsx)(pe.km,{children:(0,x.jsx)("img",{className:be,src:d.image,alt:d.name})})}),(0,x.jsxs)(pe.vm,{children:[(0,x.jsx)(pe.Wh,{titleText:r,children:r}),(0,x.jsx)(pe.K9,{children:(0,x.jsx)(pe.T6,{artists:l,spec:y})})]})]}),(0,x.jsx)(pe.UA,{ariaColIndex:1,children:(0,x.jsx)(pe.BM,{uri:d.uri,name:d.name,spec:y,children:d.name})}),(0,x.jsxs)(pe.mU,{ariaColIndex:2,children:[(0,x.jsx)(pe.qS,{uri:o,spec:y}),(0,x.jsx)(pe.A$,{duration:i}),(0,x.jsx)(pe.Zv,{spec:y,menu:(0,x.jsx)(ue.$,{uri:o,artists:l}),label:c.ag.get("more.label.track",r,l?.[0].name)})]})]})})})};function je(e,t,i){return e.reduce(((e,s,a)=>((a>0||t>0)&&e.push({type:"SPACER",id:`spacer-${e.length}`}),"MUSIC"===s.type?e.push(function(e,t,i){return{type:"MUSIC",index:t,uri:i.uri,episodeUri:e,start:i.start,stop:i.stop,duration:i.duration,name:i.track.name,artists:i.track.artists,album:i.track.album,playable:i.track.playable}}(i,a,s)):"TALK"===s.type&&e.push(function(e,t,i){return{type:"TALK",index:t,uri:e,title:i.title,subtitle:i.subtitle,start:i.start,stop:i.stop,duration:i.duration,showUri:i.show.uri,showName:i.show.name}}(i,a,s)),e)),[])}const Pe=({uri:e,segmentCount:t})=>{const i=(0,le.G)(),a=(0,s.useCallback)((async(s,a)=>{const n=Math.ceil(s/2);try{return{items:je(await i.getSegments(e,n,a),n,e),totalLength:2*t-1}}catch(e){return{items:[],totalLength:0}}}),[t,i,e]),n=(0,s.useCallback)((t=>{switch(t.type){case"SPACER":return(0,x.jsx)("div",{className:ke},t.id);case"MUSIC":return(0,x.jsx)(Ce,{...t},`${e}-${t.index}`);case"TALK":return(0,x.jsx)(re.t,{...t},`${e}-${t.index}`);default:return(0,ce.U)(t)}}),[e]),r=c.ag.get("music_and_talk.in_this_episode");return(0,x.jsxs)("div",{children:[(0,x.jsx)(F.D,{as:"h2",variant:"canon",semanticColor:"textBase",className:ye,children:r}),(0,x.jsx)(oe.Pv,{ariaLabel:r,hasHeaderRow:!0,rowPlaceholder:oe.hU,columns:[oe.QD.TITLE,oe.QD.ALBUM_OR_SHOW,oe.QD.DURATION],renderRow:n,fetchTracks:a,resolveUri:e=>"MUSIC"===e.type?e.uri:"",limit:50,nrTracks:2*t-1,testID:"music-and-talk-tracklist"})]})};var Te=i(19932);const fe=({areHTMLDescriptionsEnabled:e,contentInformation:t,description:i,hasDescription:a,hasMusicAndTalkSegements:n,htmlDescription:r,onExpanded:o,onDescriptionTimestampClick:l,onTranscriptTimestampClick:d,playability:u,segmentCount:p,showUrl:h,transcript:g,transcriptEnabled:y,uri:b,spec:C})=>{const j=(0,O.$P)(),P=(0,s.useMemo)((()=>C.descriptionSectionFactory()),[C]),f=(0,s.useMemo)((()=>P.trackListFactory()),[P]),[I,v]=(0,s.useState)(null),S=(0,s.useCallback)((async e=>{const t=await(0,Te.l)(e);v(t)}),[]);(0,s.useEffect)((()=>{g&&g.length>0&&S(g[0].cdnUrl)}),[S,g]);const E=s=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(_,{hasDescription:a,contentInformation:t,onTimeStampClick:l,onExpanded:o,description:i,areHTMLDescriptionsEnabled:e,htmlDescription:r,playability:u,showHeader:s,spec:P}),n&&(0,x.jsx)(O.Nh,{spec:f,children:(0,x.jsx)(Pe,{segmentCount:p,uri:b})}),h&&(0,x.jsx)(m.P,{buttonSize:"sm",className:T,href:h,component:$.Z,onClick:()=>{j.logInteraction(P.allEpisodesLinkFactory().hitUiNavigate({destination:h}))},children:c.ag.get("episode.see_all_episodes")}),(0,x.jsx)(k,{uri:b})]});return(0,x.jsx)(x.Fragment,{children:y&&g&&g?.length>0?(0,x.jsx)(ee,{transcriptSections:I,descriptionContent:E(!1),transcriptContent:(0,x.jsx)(ne,{transcriptSections:I||[],onTimeStampClick:d,episodeUri:b}),spec:C}):E(!0)})};var Ie=i(84449),ve=i(4055),Se=i(60599),Ee=i(72171);const Ue="activation-trigger-mme",De=({episodeUri:e,showUri:t,isLocked:i,isPlaying:s,isPlayDisabled:a,playButtonPlayLabel:n,playButtonPauseLabel:r,onClick:o})=>{const c=(0,Ee.E)();if((0,ve.g)())return(0,x.jsx)(Se.JM,{size:Se.qE.lg,onClick:o,isPlaying:s,disabled:a,locked:i,ariaPlayLabel:n,ariaPauseLabel:r});const d=(0,x.jsx)(Ie.l,{showUri:t,enabled:i,renderInline:!1,children:(0,x.jsx)(Se.JM,{size:Se.qE.lg,onClick:o,isPlaying:s,disabled:a,locked:i,ariaPlayLabel:n,ariaPauseLabel:r})});return c?(0,x.jsx)(ie.D,{id:Ue,targetURI:(0,l.EC)(e),fadeOut:!0,children:d}):d};var we=i(95663),Ne=i(65970),Re=i(16201),Le=i(37409),Be=i(30301),Me=i(99948),Fe=i(52315),Ae=i(26406),Oe=i(6444),ze=i(73972),He=i(9374),$e=i(61740),We=i(23451),_e=i(4270),Ke=i(14241),qe=i(22315),Ze=i(35394),Ve=i(46525),Je=i(73769),Ge=i(80964),Qe=i(69812),Ye=i(90303),Xe=i(91048),et=i(82998),tt=i(94033);const it=({episode:e,onPlayEpisode:t,isPlaying:i,isActive:a,isFullyPlayed:n,setIsFullyPlayed:r,backgroundColor:o,isLocked:l,spec:d})=>{const{uri:u,playedState:p,contentRating:m,playability:h}=e,g=(0,O.$P)(),y=(0,$e.I0)(),[b]=(0,Xe.z)(1e4,(e=>e?.item?.uri===u)),k=(0,Me.Y)((e=>e?.duration)),{badges:C}=(0,tt.r)({contentRating:m?.label}),j=(0,s.useCallback)((e=>{!h.playable&&C.nineteen&&(e.stopPropagation(),y((0,We.RM)(u||"")))}),[u,h.playable,C.nineteen,y]),P=(0,s.useCallback)((()=>{const e=d.contextMenuButtonFactory().hitUiReveal();g.logInteraction(e)}),[g,d]),T=(0,s.useCallback)(((e,t)=>{(0,Ge.l7)(t,d.downloadButtonFactory(),g,u)}),[g,d,u]),I=(0,s.useCallback)((e=>{const t=d.saveButtonFactory();g.logInteraction(e?t.hitLike({itemToBeLiked:u}):t.hitRemoveLike({itemNoLongerLiked:u}))}),[g,d,u]),v=!l&&!e.playability.playable,S=c.ag.get("tracklist.a11y.play",e.name,e.podcast?.name),E=c.ag.get("tracklist.a11y.pause",e.name,e.podcast?.name),U=e.podcast?.uri;return(0,x.jsxs)(_e.o,{backgroundColor:o,children:[(0,x.jsxs)(_e.F,{children:[C.nineteen&&(0,x.jsx)(Ye.X,{className:f,size:16}),(0,x.jsx)(et.E,{size:et.$.LARGE,fullyPlayed:n,durationMs:a&&k?k:e.duration.milliseconds,releaseDate:gt(e.releaseDate?.isoString),resumePositionMs:p.playPositionMilliseconds,isPlaying:i,position:a&&b||void 0})]}),(0,x.jsxs)(_e.F,{children:[(0,x.jsx)("div",{onClick:j,children:(0,x.jsx)(De,{episodeUri:e.uri,showUri:U,isLocked:l,onClick:()=>{t(p.playPositionMilliseconds)},isPlaying:i,isPlayDisabled:v,playButtonPlayLabel:S,playButtonPauseLabel:E})}),!l&&(0,x.jsx)(qe.p,{uri:e.uri,onClick:T}),(0,x.jsx)(Ve.w,{uri:e.uri,size:Ke.q.md,onClick:I}),(0,x.jsx)(Qe.y,{onShow:P,menu:(0,x.jsx)(Je.k,{uri:e.uri,sharingInfo:e.sharingInfo,showUri:U,contextUri:e.uri,isPlayed:n,onMarkAsPlayed:r}),children:(0,x.jsx)(Ze.z,{label:c.ag.get("more.label.context",e.name)})})]})]})};var st=i(41226),at=i(16743),nt=i(73997),rt=i(63120),ot=i(54299),lt=i(40780);const ct=({episode:e,isFullyPlayed:t,setIsFullyPlayed:i,backgroundColor:a,spec:n})=>{const{uri:r,name:o,sharingInfo:d,playedState:u,episodeType:p,releaseDate:m}=e,h=(0,O.$P)(),g=function(e,t,i,s,a){const n=t===ze.Wf.Episode;return(0,lt.G3)(e,s,i,a)?(0,x.jsx)(lt.Fg,{isMusicAndTalk:n}):n?c.ag.get("type.showEpisode"):c.ag.get("type.podcastEpisode")}(r,p||ze.Wf.Unknown,u.playPositionMilliseconds,gt(m?.isoString),u.state===ze.sY.Completed),y=e.podcast?.uri,b=function(e){const t=(0,l.EC)(e);return`/show/${(0,l.HB)(t?.id||"")}`}(y),k=(0,s.useCallback)((()=>{h.logInteraction(n.podcastLinkFactory().hitUiNavigate({destination:b}))}),[h,b,n]);return(0,x.jsxs)(st.gF,{backgroundColor:a,children:[(0,x.jsx)(at.W,{children:(0,x.jsx)(nt.i,{text:e.name,dragUri:r,dragLabel:e.name})}),(0,x.jsx)("div",{className:I,children:(0,x.jsx)(ot._,{menu:(0,x.jsx)(Je.k,{uri:e.uri,sharingInfo:e.sharingInfo,showUri:y,contextUri:e.uri,isPlayed:t,onMarkAsPlayed:i}),children:(0,x.jsx)(st.Oe,{loading:"eager",name:e.name,images:e.coverArt,placeholderType:"episode",shape:st.Kc.ROUNDED_CORNERS})})}),(0,x.jsxs)(st.sP,{children:[(0,x.jsx)(F.D,{variant:"mestoBold",children:g}),(0,x.jsx)(ot._,{menu:(0,x.jsx)(Je.k,{uri:r,sharingInfo:d,showUri:y,contextUri:r,isPlayed:t,onMarkAsPlayed:i}),children:(0,x.jsx)(st.xd,{dragUri:r,dragLabel:o,children:(0,x.jsx)("span",{"data-testid":"episodeTitle",children:o})})}),(0,x.jsx)(ot._,{menu:(0,x.jsx)(Je.k,{uri:e.uri,sharingInfo:e.sharingInfo,showUri:y,contextUri:e.uri,isPlayed:t,onMarkAsPlayed:i}),children:(0,x.jsx)(F.D,{variant:"canon",children:(0,x.jsx)(rt.default,{to:b,onClick:k,children:(0,x.jsx)("span",{"data-testid":"showTitle",children:e.podcast?.name})})})})]})]})};var dt=i(32812),ut=i(50042),pt=i(13198);const mt=({episode:e})=>{const{uri:t,episodeType:i,description:a,htmlDescription:o,podcastSubscription:c,segmentsCount:p,podcast:m,contentInformation:h,playedState:g,coverArt:y}=e,{spec:b,logger:k}=(0,O.fU)(r.J,{data:{uri:t}}),j=(0,dt.k)(),P=(0,s.useMemo)((()=>b.headerFactory()),[b]),T=(0,s.useMemo)((()=>b.actionBarFactory()),[b]),[f,I]=(0,s.useState)(g.state===ze.sY.Completed),v=(0,Le.g)(),S=(0,we.o)(),E=(0,n.W6)(H.Cz),U=void 0!==p&&p>0,D=(0,n.W6)(H.WE,{loadingValue:!1}),w=(0,ve.g)(),{triggerPlay:N,togglePlay:R,isPlaying:L,isActive:B}=(0,se.n)({uri:t,...j?{}:{pages:[{items:[{type:He.p.EPISODE,uri:t,uid:null,provider:null}]}]}},{featureIdentifier:"episode"}),{isActive:M}=(0,Be.$o)(t),F=y[0].url,A=(0,Re.Zj)(F||null),z=(0,Me.Y)((e=>e?.isPaused??void 0)),$=(0,Ee.E)(),W=c.isPaywalled&&!c.isUserSubscribed,_=M||B,K=e?{name:e.name,uri:e.uri,audio:{items:e.audio.items.map((e=>({url:e.url})))}}:null,q=m?{name:m.name,uri:m.uri,trailer:m.trailer,showTypes:m.showTypes}:null,Z=(0,Ne.s)(K,q),V=(0,s.useCallback)(((e,s,a,n)=>{const r=()=>{z?(n?.("resume"),v.resume()):(n?.("pause"),v.pause())};if(W)return;let o="play";if(!L||0!==e&&s||(o="pause"),S({intent:o,targetUri:t,type:"click",itemIdSuffix:e>0?"podcast-description-timestamp":"button"}),i===ze.Wf.Episode&&$)u.y.set((()=>({triggerId:a||Ue,triggerAction:null})));else if(B&&!s)w?r():R({loggingParams:n?.()});else if(M&&!s)r();else{const t=n?.("play");w?Z({seekTo:e,loggingParams:t}):N({seekTo:e,loggingParams:t})}}),[W,L,S,t,i,$,M,B,w,z,v,R,Z,N]),J=(0,s.useCallback)((e=>{V(e,!1,void 0,(e=>{const i=b.actionBarFactory().playButtonFactory();let s;return s="pause"===e||L?i.hitPause({itemToBePaused:t}):"resume"===e||_?i.hitResume({itemToBeResumed:t}):i.hitPlay({itemToBePlayed:t}),k.logInteraction(s)}))}),[V,_,L,k,b,t]),G=(0,s.useCallback)((e=>{V(e,!0,void 0,(()=>k.logInteraction(b.descriptionSectionFactory().timestampLinkFactory().hitPlay({itemToBePlayed:t}))))}),[V,k,b,t]),Q=(0,s.useCallback)(((e,t)=>{V(e,!0,t)}),[V]),Y=(0,s.useCallback)((()=>{S({intent:"expand-description",type:"click"})}),[S]);(0,s.useEffect)((()=>{if(e&&!_){const t=new URLSearchParams(location.search);if(t.has("t")){const i=t.get("t")||"0",s=1e3*parseInt(i,10);s<=e.duration.milliseconds&&V(s,!0)}}}),[e,_]);const X=!!a||E&&!!o,ee=e.podcast?.uri,te=(0,l.EC)(ee)?.toURLPath(!0);return(0,x.jsxs)("section",{"data-testid":"episode",className:C,children:[(0,x.jsx)(d.$,{children:(0,Oe.mK)({episodeOrChapterName:e.name,showOrAudiobookName:e.podcast?.name??"",type:"Podcast"})}),(0,x.jsx)(ct,{episode:e,isFullyPlayed:f,setIsFullyPlayed:I,backgroundColor:A,spec:P}),(0,x.jsx)(it,{episode:e,onPlayEpisode:J,isPlaying:L,isActive:_,isFullyPlayed:f,setIsFullyPlayed:I,backgroundColor:A,isLocked:W,spec:T}),(0,x.jsx)("div",{className:"contentSpacing",children:(0,x.jsx)(fe,{transcriptEnabled:D,transcript:e.transcript,hasDescription:X,contentInformation:h,onDescriptionTimestampClick:G,onTranscriptTimestampClick:Q,onExpanded:Y,description:e.description,areHTMLDescriptionsEnabled:E,htmlDescription:e.htmlDescription,playability:e.playability,hasMusicAndTalkSegements:U,segmentCount:p,uri:e.uri,showUrl:te,spec:b})})]})},ht=s.memo((function(){const{episodeId:e=""}=(0,a.UO)(),t=(0,l.YD)(e).toURI(),i=(0,Fe.I)(t);return i?.isError||!i?.episodeOrChapter?(0,x.jsx)(p.h,{hasError:i?.isError||!1,errorMessage:c.ag.get("error.not_found.title.podcast")}):(0,Ae.Ey)(i.episodeOrChapter)?(0,x.jsx)(ut.InstrumentedRedirect,{to:(0,l.EC)(i.episodeOrChapter.book?.uri).toURLPath(!0)}):(0,x.jsx)(s.Suspense,{fallback:null,children:(0,x.jsx)(pt.C,{pageId:o.Wg.PODCAST_EPISODE,uri:t,children:(0,x.jsx)(mt,{episode:i.episodeOrChapter})})})}));function gt(e){return e?.replace(/T.*/,"")||""}}}]);
//# sourceMappingURL=xpui-routes-episode.js.map