Module 448887

4,083 characters · in 539bb36d2614891a.js
Dependencies
Source Raw
function(e,s,t){t.d(s,{default:()=>M});var a=t(477900),n=t(582128),l=t(503698),o=t.n(l),c=t(17928),d=t(366010),r=t(192308),i=t(297264),u=t(834730),b=t(821609),m=t(736653),h=t(775602),p=t(793574),f=t(839534),x=t(607470),j=t(318346),y=t(761705),S=t(106799),C=t(287809),g=t(396813),A=t(738822),R=t(309593),E=t(801365),w=t(801870),O=t(586035),_=t(190107),v=t(652215),L=t(758836),T=t(375708),k=t(426963),N=t(181713);function P(e){let{onVideoLoaded:s}=e;return(0,a.jsx)(x.A,{className:k.d0,playsInline:!0,controls:!1,autoPlay:!0,loop:!0,onCanPlayThrough:s,children:(0,a.jsx)("source",{src:N.A,type:"video/webm"})})}function D(e){let{onVideoLoaded:s,isLoading:t}=e,l=(0,c.bG)([h.Ay],()=>h.Ay.useReducedMotion),[r,i]=n.useState(!l),u=(0,m.Ay)(),b=(0,d.q)(u),p=n.useRef(null),f=n.useRef(null),[j,y]=n.useState(!1),[S,C]=n.useState(!1),[g,A]=n.useState(!1);n.useEffect(()=>{j&&S&&g&&s()},[j,S,g,s]),n.useEffect(()=>{t||l||setTimeout(()=>{p.current?.play()},200)},[t,l]);let R=n.useCallback(()=>{l||(i(!1),f.current?.play())},[l]);return(0,a.jsxs)("div",{className:k.GF,children:[(0,a.jsx)(x.A,{ref:f,autoPlay:!1,loop:!0,muted:!0,playsInline:!0,className:o()(k.nH,k.EZ,{[k.R]:r}),controls:!1,onCanPlayThrough:n.useCallback(()=>C(!0),[]),children:(0,a.jsx)("source",{src:b?"https://cdn.discordapp.com/assets/content/4c65c8edcb240ab88372cd7e405619919a35d2d6e2255bb24d335e1829ce4089.webm":"https://cdn.discordapp.com/assets/content/759ca0dd0fedd8b1c983f6b2f457fc85cf6656be30a8538e7eab546704f43a47.webm",type:"video/webm"})}),(0,a.jsx)(x.A,{ref:p,autoPlay:!1,muted:!0,playsInline:!0,className:k.nH,controls:!1,onCanPlayThrough:n.useCallback(()=>y(!0),[]),onEnded:R,children:(0,a.jsx)("source",{src:b?"https://cdn.discordapp.com/assets/content/e6b9db9480bfd82c547ee83086a8efc485af6ee22bcc4b418e0ee366785d5b91.webm":"https://cdn.discordapp.com/assets/content/88a67852778d47306c14ce2403d7b072aba847a61640b029915adc6448d386ba.webm",type:"video/webm"})}),(0,a.jsxs)("div",{className:k.Se,children:[(0,a.jsx)(P,{onVideoLoaded:n.useCallback(()=>A(!0),[])}),(0,a.jsx)(P,{}),(0,a.jsx)(P,{}),(0,a.jsx)(P,{})]})]})}function B(e){let{isLoading:s,orbsEarned:t,orbsBalance:n,onVideoLoaded:l}=e;return(0,a.jsxs)("div",{className:k.hQ,children:[(0,a.jsx)(D,{isLoading:s,onVideoLoaded:l}),(0,a.jsxs)("div",{className:k.dD,children:[(0,a.jsxs)("div",{className:k.R_,children:[(0,a.jsx)(S.B,{shouldUseThemeColor:!0,className:k.Uu}),(0,a.jsx)(i.D,{variant:"heading-xl/semibold",color:"text-strong","aria-label":T.intl.formatToPlainString(T.t.WPNjGe,{count:t}),children:T.intl.formatToPlainString(T.t.YMor7k,{count:t})})]}),null!=n?(0,a.jsx)(u.E,{variant:"text-sm/medium",color:"text-subtle",children:T.intl.format(T.t.g4t9aw,{orbsBalance:n,orbsBalanceHook:(e,s)=>(0,a.jsx)(u.E,{variant:"text-sm/medium",color:"text-strong",tag:"span",children:e},s)})}):null]}),(0,a.jsx)(b.$,{variant:"secondary",size:"sm",text:T.intl.string(T.t.WYchde),onClick:function(){(0,j.Y)({pageType:v.liQ.GLOBAL_DISCOVERY_QUESTS,sectionType:v.JJy.ORBS_REWARD_MODAL,ctaObject:v.ZSU.CTA_TO_ORBS_SHOP}),(0,r.closeAllModals)(),(0,f.Cz)({tab:L.G2.ORBS,analyticsLocations:[],analyticsSource:p.A.QUEST_REWARD_MODAL})},fullWidth:!0})]})}function M(e){let{initialQuest:s,onClose:t,transitionState:l,sourceQuestContent:o,location:d}=e,r=(0,R.C5)(s.id)??s,i=r.userStatus?.claimedAt!=null,{balance:u,error:b}=(0,y.W)(),m=(0,c.bG)([C.default],()=>C.default.getCurrentUser()),h=r.userStatus?.orbQuantityClaimed??(0,E.wo)(r.config,m),[p,f]=n.useState(i?"success":"loading"),[x,j]=n.useState(!1),S=n.useCallback(()=>{j(!0)},[]);n.useEffect(()=>{i||"loading"!==p||(0,g.Oq)(r.id,A.pY.CROSS_PLATFORM,d).then(()=>f("success")).catch(()=>f("error"))},[r.id,i,p,d]);let v=!x||"loading"===p||null==u&&null==b,L="error"===p||null==h||null==u&&null!=b;return(0,a.jsx)(O.A,{onClose:t,transitionState:l,quest:r,sourceQuestContent:o,location:_.rE.ORBS_REWARD_MODAL,isRewardContentLoading:v,rewardContentHasError:L,rewardContent:L?null:(0,a.jsx)(w.A,{rewardName:T.intl.string(T.t.Lmysvd),children:(0,a.jsx)(B,{orbsEarned:h,orbsBalance:u,isLoading:v,onVideoLoaded:S})})})}}