Module 979204

2,525 characters · in 95d8b2ac774452cf.js
Dependencies
Required by (2)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){n.d(t,{A:()=>g});var r=n(627968),l=n(64700),s=n(717421),a=n(801365),i=n(503698),u=n.n(i),o=n(873174),c=n(939249),d=n(834730),E=n(613373),m=n(507107),f=n(646764);n(795068);var _=n(190107),S=n(777555);let p={duration:250},v=e=>{let{currentPx:t,indicator:n,isAnimated:a,quest:i,sourceQuestContent:_,expansionSpring:v,onClick:C,onMouseEnter:g,onMouseLeave:A}=e,{label:h,targetSec:D,leftPx:x,rightPx:T,index:I}=n,O=i.userStatus?.completedAt!=null,[b,R]=l.useState(!1),L=x-4,k=t>=L?Math.min(1,(t-L)/(T-L)):0,N=0===I&&!O,{fill:P}=(0,s.z)({fill:100*k,config:p,onRest:()=>{k<=0&&R(!1)},onStart:()=>{R(!0)}}),y=e=>e.stopPropagation(),M=null!=C?e=>{e.stopPropagation(),C()}:void 0;return(0,r.jsxs)(o.animated.div,{className:u()(S.ck,{[S.a]:N&&b,[S.C9]:!N&&b}),style:{left:a?v.to(e=>x-e):x,"--custom-indicator-size":a?v.to(e=>`${26+2*e}px`):"26px","--custom-indicator-fill":P.to(e=>e)},onMouseDown:y,children:[(0,r.jsx)(c.D,{className:S.E6,"data-testid":"video-quest-reward-indicator",onClick:M,onMouseDown:y,onMouseEnter:g,onMouseLeave:A,children:(0,r.jsx)(f.A,{fullWidth:!0,quest:i,questContent:m.uF.VIDEO_MODAL,sourceQuestContent:_,autoplay:!1})}),(0,r.jsxs)("div",{className:S.Ru,role:"tooltip","aria-label":null!=h?`${(0,E.rB)(D)} - ${h}`:(0,E.rB)(D),children:[(0,r.jsx)(d.E,{variant:"text-xs/normal",color:"always-white",children:(0,E.rB)(D)}),null!=h&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:S.AE,"aria-hidden":"true"}),(0,r.jsx)(d.E,{variant:"text-xs/normal",color:"always-white",children:h})]})]})]})},C={tension:500,friction:30,clamp:!0};function g(e){let{targetSec:t,quest:n,sourceQuestContent:i,questConfig:u,clickable:o=!1}=e,c=l.useMemo(()=>u?.features.includes(_.Li.FULL_EPISODE_VIDEO_QUEST)===!0,[u?.features]),[d,E]=l.useState(null),m=l.useRef(null),[{expansion:f},S]=(0,s.z)(()=>({expansion:0,config:C,onRest:()=>{null==m.current&&E(null)}})),p=l.useCallback(e=>{m.current=e,null!=e?(E(e),S({expansion:4})):S({expansion:0})},[S]),g=l.useMemo(()=>[{index:0,timeSec:t,widthPx:32,gapPx:4,align:"end",clickable:o}],[t,o]),A=l.useMemo(()=>c?(0,a.mq)(u):void 0,[u,c]),h=l.useCallback((e,l,s)=>{let a={leftPx:e.leftPx,rightPx:e.rightPx,targetSec:t,index:e.index,label:A};return(0,r.jsx)(v,{currentPx:l,indicator:a,isAnimated:d===e.index,expansionSpring:f,quest:n,sourceQuestContent:i,onMouseEnter:()=>p(e.index),onMouseLeave:()=>p(null),onClick:s},`indicator-${e.index}`)},[t,A,d,f,n,i,p]);if(c)return{indicators:g,animatingIndex:d,expansionSpring:f,hoverExpansionPx:4,renderIndicator:h}}}