@streamlayer/react 0.39.1 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/provider.d.ts +2 -1
- package/lib/cjs/gamification-feature.js +1 -1
- package/lib/cjs/index2.js +7 -7
- package/lib/cjs/masters2.js +41 -41
- package/lib/cjs/useStreamLayerApp.js +1 -1
- package/lib/dist/cjs/gamification-feature.js +1 -1
- package/lib/dist/cjs/masters.js +65 -65
- package/lib/dist/es/gamification-feature.js +573 -554
- package/lib/dist/es/index.js +1 -1
- package/lib/dist/es/masters.js +12167 -12049
- package/lib/dist/index.d.ts +30 -4
- package/lib/dist/style.css +1 -1
- package/lib/es/gamification-feature.js +581 -562
- package/lib/es/index2.js +44 -41
- package/lib/es/masters2.js +7678 -7588
- package/lib/es/useStreamLayerApp.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +13 -12
package/lib/app/provider.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { StreamLayerSDK, StreamLayerPlugin } from '@streamlayer/sdk-web-interfaces';
|
|
3
|
-
import type { DeepLinkCallback } from '@streamlayer/sdk-web-core';
|
|
3
|
+
import type { DeepLinkCallback, VideoPlayerCallback } from '@streamlayer/sdk-web-core';
|
|
4
4
|
export declare enum StreamLayerStatus {
|
|
5
5
|
UNSET = 0,
|
|
6
6
|
CONNECTED = 1,
|
|
@@ -16,6 +16,7 @@ export type StreamLayerProps = {
|
|
|
16
16
|
production?: boolean;
|
|
17
17
|
autoEnable?: boolean;
|
|
18
18
|
onDeepLinkHandled?: DeepLinkCallback;
|
|
19
|
+
videoPlayerController?: VideoPlayerCallback;
|
|
19
20
|
};
|
|
20
21
|
export declare const StreamLayerProvider: React.FC<StreamLayerProps & {
|
|
21
22
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./useSdkFeature.js"),S=require("@nanostores/react"),h=require("react"),y=require("./masters2.js"),u=require("@streamlayer/sdk-web-types");require("react-countup");const de=require("react-countdown-circle-timer"),k=require("./index2.js"),ce=require("react-infinite-scroller");require("lodash.throttle");require("@streamlayer/sdk-web-interfaces");require("@streamlayer/sdk-web-notifications");require("./useStreamLayerApp.js");require("@streamlayer/sdk-web");const ue=t.styled_default("div")({name:"Container",class:"c1vwopgc",propsAsIs:!1}),pe=t.styled_default("div")({name:"QuestionTypeWrap",class:"qyktpt0",propsAsIs:!1}),me=()=>t.c1,he=t.styled_default(me())({name:"QuestionTypeIcon",class:"q951jdx",propsAsIs:!0}),xe=t.styled_default("span")({name:"QuestionTypeTitle",class:"qss5f0e",propsAsIs:!1}),fe=t.styled_default("div")({name:"CloseIconWrap",class:"c1ao1jtv",propsAsIs:!1}),Ie=()=>t.c1,ye=t.styled_default(Ie())({name:"CloseIcon",class:"cvsl7l3",propsAsIs:!0}),se=({type:s,close:n,label:i})=>{const o=s?y.o[s]:{label:i,iconName:void 0};return e.jsxs(ue,{children:[e.jsxs(pe,{children:[(o==null?void 0:o.iconName)&&e.jsx(he,{"data-type-trivia":s===u.QuestionType.TRIVIA,"data-type-poll":s===u.QuestionType.POLL,name:o.iconName}),(o==null?void 0:o.label)&&e.jsx(xe,{children:o.label})]}),e.jsx(fe,{onClick:n,children:e.jsx(ye,{name:"icon-cross"})})]})},ve=t.styled_default("div")({name:"Container",class:"c1zy8a",propsAsIs:!1}),je=t.styled_default("div")({name:"Title",class:"t1vih9p5",propsAsIs:!1}),Ce=t.styled_default("div")({name:"Indicator",class:"i1fbnvpb",propsAsIs:!1}),Y=({indicator:s,title:n})=>e.jsxs(ve,{children:[e.jsx(je,{children:n}),e.jsx(Ce,{children:s})]}),Ae=t.styled_default("div")({name:"Container",class:"ctmhwyc",propsAsIs:!1}),ge=t.styled_default("div")({name:"Indicator",class:"i1jri200",propsAsIs:!1}),_e=t.styled_default("div")({name:"Title",class:"t8s05oq",propsAsIs:!1}),V=({indicator:s,title:n})=>e.jsxs(Ae,{children:[e.jsx(ge,{children:s}),e.jsx(_e,{children:n})]}),be=t.styled_default("div")({name:"Container",class:"c1yrpn9o",propsAsIs:!1}),Te=t.styled_default("div")({name:"TopInfo",class:"t17fwahh",propsAsIs:!1}),$e=t.styled_default("div")({name:"BottomInfo",class:"by6w7e9",propsAsIs:!1}),Se=t.styled_default("div")({name:"User",class:"u1g7arbm",propsAsIs:!1}),Re=t.styled_default("img")({name:"Avatar",class:"a1ldeata",propsAsIs:!1}),ke=t.styled_default("div")({name:"UserInfo",class:"u10d4koz",propsAsIs:!1}),we=t.styled_default("div")({name:"UserName",class:"u1q6roj0",propsAsIs:!1}),qe=t.styled_default("div")({name:"UserRating",class:"ui0m425",propsAsIs:!1}),Qe=t.styled_default("img")({name:"TrophyIcon",class:"t1el3mrn",propsAsIs:!1}),Ee=t.styled_default("div")({name:"Rts",class:"r2vgnxv",propsAsIs:!1}),Ne=t.styled_default("div")({name:"RtsIndicator",class:"roqn06j",propsAsIs:!1}),De=t.styled_default("div")({name:"RtsLabel",class:"r15adx7c",propsAsIs:!1}),Le=t.styled_default("div")({name:"Divider",class:"dv59lta",propsAsIs:!1}),Pe=t.styled_default("div")({name:"Ranks",class:"r55lotb",propsAsIs:!1}),Ve=t.styled_default("div")({name:"Statistics",class:"s1knfgqt",propsAsIs:!1}),Oe=t.styled_default("div")({name:"AvatarPlaceholder",class:"a1mqo824",propsAsIs:!1}),Me=t.styled_default("button")({name:"UserAccountBtn",class:"uxareh6",propsAsIs:!1}),Ue="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Trophy'%3e%3cpath%20id='Combined%20Shape'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3.69197%204.66662C3.69197%205.99705%203.92914%207.17787%204.4035%208.20912C3.49966%208.02451%202.74487%207.66486%202.1391%207.13014C1.53333%206.59542%201.23046%206.0798%201.23046%205.58328V4.66662H3.69197ZM14.7686%204.66662V5.58328C14.7686%206.0798%2014.4658%206.59542%2013.86%207.13014C13.2542%207.66486%2012.4994%208.02451%2011.5956%208.20912C12.0699%207.17787%2012.3071%205.99705%2012.3071%204.66662H14.7686ZM15.9998%205.58329V4.36108C15.9998%204.10645%2015.9101%203.89002%2015.7306%203.71178C15.5511%203.53354%2015.3332%203.44442%2015.0768%203.44442H12.3076V2.52776C12.3076%202.10763%2012.1569%201.74797%2011.8556%201.44878C11.5544%201.14959%2011.1922%201%2010.7691%201H5.23072C4.80764%201%204.44547%201.14959%204.14419%201.44878C3.84291%201.74797%203.69227%202.10763%203.69227%202.52776V3.44442H0.923068C0.666659%203.44442%200.448714%203.53354%200.269228%203.71178C0.0897418%203.89002%200%204.10645%200%204.36108V5.58329C0%206.03525%200.13301%206.49039%200.399034%206.94872C0.665059%207.40705%201.02403%207.82082%201.47595%208.19003C1.92787%208.55924%202.48234%208.86957%203.13939%209.12101C3.79644%209.37246%204.48713%209.51409%205.21149%209.54592C5.48071%209.88967%205.7852%2010.192%206.12494%2010.453C6.36853%2010.6695%206.53679%2010.9002%206.62974%2011.1453C6.72269%2011.3904%206.76916%2011.6752%206.76916%2011.9999C6.76916%2012.3436%206.67141%2012.6333%206.4759%2012.8688C6.28038%2013.1043%205.96789%2013.2221%205.53841%2013.2221C5.05764%2013.2221%204.62976%2013.3669%204.25476%2013.6566C3.87977%2013.9462%203.69227%2014.3106%203.69227%2014.7499V15.361C3.69227%2015.4501%203.72112%2015.5233%203.77881%2015.5806C3.8365%2015.6379%203.91022%2015.6665%203.99996%2015.6665H11.9999C12.0896%2015.6665%2012.1633%2015.6379%2012.221%2015.5806C12.2787%2015.5233%2012.3076%2015.4501%2012.3076%2015.361V14.7499C12.3076%2014.3106%2012.1201%2013.9462%2011.7451%2013.6566C11.3701%2013.3669%2010.9422%2013.2221%2010.4614%2013.2221C10.0319%2013.2221%209.71945%2013.1043%209.52394%2012.8688C9.32843%2012.6333%209.23068%2012.3436%209.23068%2011.9999C9.23068%2011.6752%209.27715%2011.3904%209.3701%2011.1453C9.46305%2010.9002%209.63131%2010.6695%209.8749%2010.453C10.2146%2010.192%2010.5191%209.88967%2010.7884%209.54592C11.5127%209.51409%2012.2034%209.37246%2012.8604%209.12101C13.5175%208.86957%2014.072%208.55924%2014.5239%208.19003C14.9758%207.82082%2015.3348%207.40705%2015.6008%206.94872C15.8668%206.49039%2015.9998%206.03525%2015.9998%205.58329ZM6.76047%207.1798L8.05109%206.49997L9.3417%207.1798L9.09521%205.73989L10.1393%204.72015L8.69639%204.51007L8.05109%203.2L7.40578%204.51007L5.96283%204.72015L7.00696%205.73989L6.76047%207.1798Z'%20fill='%23F2C94C'/%3e%3c/g%3e%3c/svg%3e",te=({avatar:s,name:n,points:i,friendsRank:o,rank:a,streak:c,correct:r,incorrect:l,inTop:d,successRate:p})=>e.jsxs(be,{children:[e.jsx(Te,{children:e.jsxs(Se,{children:[e.jsxs(Me,{children:[s&&e.jsx(Re,{alt:"avatar",src:s}),!s&&e.jsx(Oe,{children:y.I(n||"")})]}),e.jsxs(ke,{children:[e.jsx(we,{children:n}),e.jsxs(qe,{children:[e.jsxs(Ee,{children:[e.jsx(Qe,{alt:"rank-icon",src:Ue}),e.jsxs(Ne,{children:[y.s(i),e.jsx(De,{children:"PTS"})]})]}),e.jsx(Le,{}),e.jsxs("div",{children:["TOP ",d||0,"%"]})]})]})]})}),e.jsxs($e,{children:[e.jsxs(Pe,{children:[e.jsx(Y,{indicator:o||0,title:"Friends rank"}),e.jsx(Y,{indicator:a||0,title:"Global rank"})]}),e.jsxs(Ve,{children:[e.jsx(V,{indicator:c||0,title:"Win streak"}),e.jsx(V,{indicator:r||0,title:"Correct"}),e.jsx(V,{indicator:l||0,title:"Incorrect"}),e.jsx(V,{indicator:`${p||0}%`,title:"Succ. rate"})]})]})]}),Be=t.styled_default("div")({name:"SponsorLogoWrap",class:"s8p5v5z",propsAsIs:!1}),Fe=()=>t.c1,ze=t.styled_default(Fe())({name:"SponsorLogo",class:"s755yti",propsAsIs:!0}),He=()=>e.jsx(Be,{children:e.jsx(ze,{name:"mastersLogo"})}),We=t.styled_default("div")({name:"Container",class:"c38csyt",propsAsIs:!1}),Ze=t.styled_default("div")({name:"Title",class:"ty221rx",propsAsIs:!1}),Ye=t.styled_default("div")({name:"Description",class:"dlaj9xp",propsAsIs:!1}),Ge=({title:s,description:n})=>e.jsxs(We,{children:[e.jsx(t.c1,{name:"icon-check-circle"}),e.jsx(Ze,{children:s}),e.jsx(Ye,{children:n})]}),Ke=t.styled_default("div")({name:"Container",class:"c16sbdnm",propsAsIs:!1}),Xe=()=>t.c1,Je=t.styled_default(Xe())({name:"IconPrediction",class:"ibhorgl",propsAsIs:!0}),L=t.styled_default("div")({name:"FeedbackIconWrap",class:"f1g20ja7",propsAsIs:!1}),O=t.styled_default("div")({name:"FeedbackHeader",class:"f455ozj",propsAsIs:!1}),es=t.styled_default("span")({name:"FeedbackTitle",class:"f1913njx",propsAsIs:!1}),E=t.styled_default("span")({name:"FeedbackDescription",class:"fzfk69z",propsAsIs:!1}),H=t.styled_default("div")({name:"FeedbackText",class:"fx87qaj",propsAsIs:!1}),ss=({feedbackMessages:s,questionVotedCorrectly:n,questionVoted:i,questionType:o,hasCorrectAnswer:a,questionStatus:c,showExpiredNotification:r,showClosedNotificationTrivia:l,votedInCurrentRender:d,votedAfterQuestionClosed:p,enteredAnActiveQuestion:m,marketClosed:I})=>{const x=i&&(o===u.QuestionType.TRIVIA||o===u.QuestionType.PREDICTION)&&d&&c!==u.QuestionStatus.RESOLVED,v=o===u.QuestionType.PREDICTION&&!a,T=I&&o===u.QuestionType.PREDICTION&&!i&&!m||o===u.QuestionType.PREDICTION&&p&&d&&m,C=x&&v,b=x&&a,A=o===u.QuestionType.PREDICTION&&i&&d&&a,w=i&&o===u.QuestionType.POLL&&d;if(!r&&!l&&!C&&!b&&!T&&!w&&!A)return null;const R=n?"correct":"incorrect",$=n?s==null?void 0:s.correctFeedback:s==null?void 0:s.incorrectFeedback;return e.jsxs(Ke,{"data-isPrediction":v,children:[r&&e.jsxs(e.Fragment,{children:[e.jsx(L,{children:e.jsx(t.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Expired"})}),e.jsx(H,{children:"You can still answer to see if you're correct, but no points are awarded for expired questions."})]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(L,{children:e.jsx(t.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Closed"})}),e.jsx(H,{children:"This question was answered after the moderator closed the question. So the points for this answer won’t tally."})]})]}),T&&e.jsxs(e.Fragment,{children:[e.jsx(L,{children:e.jsx(t.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Closed"})}),e.jsx(H,{children:"This event has already taken place, so the ability to make a prediction on its outcome is no longer available."})]})]}),C&&e.jsxs(e.Fragment,{children:[e.jsx(Je,{name:"icon-prediction"}),e.jsx(E,{children:"Stay tuned to see if your prediction was correct."})]}),w&&e.jsxs(e.Fragment,{children:[e.jsx(L,{"data-feedback-type":"correct",children:e.jsx(t.c1,{name:"correct"})}),e.jsx(E,{children:"Thanks for answering. Please stay tuned for the next question."})]}),(b||A)&&e.jsxs(e.Fragment,{children:[e.jsx(L,{"data-feedback-type":R,children:e.jsx(t.c1,{name:R})}),e.jsx("div",{children:e.jsxs(O,{children:[e.jsx(es,{"data-feedback-type":R,children:$==null?void 0:$.title}),e.jsx(E,{children:$==null?void 0:$.description})]})})]})]})},ts=t.styled_default("div")({name:"Container",class:"c14ielyq",propsAsIs:!1}),ns=()=>y.c,is=t.styled_default(ns())({name:"QuestionScrollContainer",class:"q1tlqx57",propsAsIs:!0}),os=t.styled_default("div")({name:"Content",class:"c1hq58md",propsAsIs:!1}),as=t.styled_default("div")({name:"Title",class:"t1c8nxcx",propsAsIs:!1}),ls=t.styled_default("div")({name:"Options",class:"oiozuc3",propsAsIs:!1}),rs=t.styled_default("button")({name:"ButtonContainer",class:"b1b6dl8t",propsAsIs:!1}),ds=t.styled_default("div")({name:"ButtonPct",class:"b4iik8i",propsAsIs:!1}),cs=t.styled_default("span")({name:"ButtonBody",class:"b1gq1lnf",propsAsIs:!1}),us=t.styled_default("div")({name:"IconContainer",class:"i1j65z51",propsAsIs:!1}),ps=t.styled_default("div")({name:"IconWrap",class:"i19tpfua",propsAsIs:!1}),ne=t.styled_default("img")({name:"Icon",class:"i1tubmma",propsAsIs:!1}),ms=()=>ne,hs=t.styled_default(ms())({name:"IconDefault",class:"i1grrgwj",propsAsIs:!0}),xs=()=>ne,fs=t.styled_default(xs())({name:"IconCircle",class:"ibemyq8",propsAsIs:!0}),Is=t.styled_default("span")({name:"Title",class:"t1dceht",propsAsIs:!1}),ys=t.styled_default("span")({name:"Indicators",class:"i116q4vq",propsAsIs:!1}),vs=t.styled_default("span")({name:"Pts",class:"p17ajcu2",propsAsIs:!1}),js=t.styled_default("span")({name:"Percentage",class:"pu9kmlb",propsAsIs:!1}),Cs=()=>t.c1,As=t.styled_default(Cs())({name:"CheckIcon",class:"c1j2j0s0",propsAsIs:!0}),G={[u.QuestionImages.CENTERED]:s=>e.jsx(hs,{alt:"option-icon",src:s}),[u.QuestionImages.TRANSPARENT]:s=>e.jsx(us,{children:e.jsx(ps,{style:{backgroundImage:`url(${s})`}})}),[u.QuestionImages.ROUNDED]:s=>e.jsx(fs,{alt:"option-icon",src:s}),[u.QuestionImages.NONE]:()=>null,[u.QuestionImages.UNSET]:()=>null},gs=({questionType:s,hasCorrectAnswer:n,correct:i,youVoted:o,questionVoted:a})=>{if(s===u.QuestionType.POLL&&o)return"correct";if(s===u.QuestionType.PREDICTION){if(n&&a)return o?i?"correct":"incorrect":"unset";if(o)return"correct"}return s===u.QuestionType.TRIVIA&&a&&o?i?"correct":"incorrect":"unset"},_s=({questionType:s,questionVoted:n,correct:i,hasCorrectAnswer:o,questionStatus:a})=>s===u.QuestionType.TRIVIA?n&&i:s===u.QuestionType.PREDICTION?n&&i&&o||a===u.QuestionStatus.RESOLVED&&i:!1,bs=s=>{var n;const{id:i,icon:o,text:a,percentageDecimal:c,points:r,onVote:l,markThatVoted:d,youSelected:p,questionVoted:m,imageMode:I,answerTimeExpired:x,questionStatus:v,isLoading:T,questionType:C,correct:b,hasCorrectAnswer:A,votedAfterQuestionClosed:w,enteredAnActiveQuestion:R,marketClosed:$}=s,[N,P]=h.useState(c),q=gs(s),B=_s({questionType:C,questionVoted:m,correct:b,hasCorrectAnswer:A,questionStatus:v}),f=$&&C===u.QuestionType.PREDICTION,j=m||f,g=C===u.QuestionType.PREDICTION&&!m&&!$,F=m&&!p&&q!=="incorrect";return h.useLayoutEffect(()=>{c>0&&(P(0),requestAnimationFrame(()=>{P(c)}))},[c]),e.jsxs(rs,{value:i,"data-selected":p,"data-answer-state":q,disabled:m||T||x||f&&!R||f&&R&&w,"data-is-not-checked":F,onClick:z=>{d(C===u.QuestionType.PREDICTION?$:v===u.QuestionStatus.RESOLVED),l(z)},children:[e.jsx(ds,{"data-answer-state":q,style:{width:`${j?N:0}%`}}),e.jsxs(cs,{children:[o&&I&&((n=G[I])==null?void 0:n.call(G,o)),e.jsx(Is,{children:a}),g&&e.jsxs("div",{children:[r,e.jsx(vs,{children:"pts"})]}),j&&e.jsxs(ys,{children:[B&&e.jsx(As,{name:"selected"}),e.jsx(js,{children:e.jsx(t.d,{value:c,suffix:"%"})})]})]})]})},Ts=[k.E.PRIMARY_GREEN1,k.E.SECONDARY_RED1,k.E.SECONDARY_RED1,k.E.NEUTRALS_GRAY3],$s=[10,10,1,0],Ss=t.styled_default("div")({name:"RemainingTime",class:"r165427",propsAsIs:!1}),Rs=k.E.SECONDARY_GREEN6,K=k.E.SECONDARY_RED3,ks=k.E.NEUTRALS_GRAY3,ws=({isPlaying:s=!0,duration:n=30,onTimerExpired:i})=>{const[o,a]=h.useState(n>10?Rs:K),c=({remainingTime:d})=>e.jsx(Ss,{children:d}),r=h.useCallback(()=>{i==null||i(),a(ks)},[i,a]),l=h.useCallback(d=>{d===10&&a(K)},[a]);return e.jsx(de.CountdownCircleTimer,{isPlaying:s,duration:n,colors:Ts,colorsTime:$s,size:32,strokeWidth:2,trailStrokeWidth:2,trailColor:o,onComplete:r,onUpdate:l,children:c})},qs=t.styled_default("div")({name:"WinBarContainer",class:"wie6cqo",propsAsIs:!1}),Qs=t.styled_default("div")({name:"Content",class:"cgizw4u",propsAsIs:!1}),Es=t.styled_default("div")({name:"Title",class:"t1l3ucjp",propsAsIs:!1}),Ns=()=>t.c1,Ds=t.styled_default(Ns())({name:"WinIcon",class:"wx7j799",propsAsIs:!0}),Ls=t.styled_default("div")({name:"Points",class:"p4lwuj0",propsAsIs:!1}),Ps=t.styled_default("span")({name:"PointsCount",class:"po9i64o",propsAsIs:!1}),Vs=t.styled_default("span")({name:"PointsUnits",class:"pe5g05h",propsAsIs:!1}),Os=({title:s,points:n,isPlayingTimer:i,isTimer:o,animatePoints:a,questionType:c,timerDuration:r,onTimerExpired:l})=>e.jsxs(qs,{style:{justifyContent:c===u.QuestionType.PREDICTION?"center":"space-between"},children:[e.jsxs(Qs,{children:[s&&e.jsx(Es,{children:s}),n!==void 0&&c!==u.QuestionType.POLL&&e.jsxs(e.Fragment,{children:[e.jsx(Ds,{name:"icon-trophy"}),e.jsxs(Ls,{children:[e.jsx(Ps,{children:a?e.jsx(t.d,{value:n,delay:.3}):n}),e.jsx(Vs,{children:"PTS"})]})]})]}),o&&c!==u.QuestionType.PREDICTION&&e.jsx(ws,{isPlaying:i,onTimerExpired:l,duration:r})]}),Ms=({openedQuestion:s,isLoading:n,vote:i,close:o})=>{var a,c;const r=s.subject,l=s.type,d=s.status,p=(a=s.options)==null?void 0:a.options,m=s.marketClosed,[I,x]=h.useState(!1),[v,T]=h.useState(!1),[C,b]=h.useState(!0),[A,w]=h.useState(!1),[R,$]=h.useState(""),N=s==null?void 0:s.id;h.useEffect(()=>{l===u.QuestionType.PREDICTION?m&&b(!1):d===u.QuestionStatus.RESOLVED&&b(!1)},[]);const P=h.useCallback(_=>{T(_),x(!0)},[]),q=h.useCallback(async _=>{if(N){const D=_.currentTarget.value;$(D),await i(N,D)}},[N,$,i]),B=h.useCallback(()=>{w(!0),setTimeout(o,3e3)},[o]),f=h.useMemo(()=>s==null?void 0:s.answers.find(_=>_.youVoted===!0),[s]),j=h.useMemo(()=>!!(s!=null&&s.answers.find(_=>_.correct===!0)),[s]),g=h.useMemo(()=>s==null?void 0:s.answers.find(_=>_.correct===!0),[s]),F=h.useMemo(()=>s?s.answers.map(_=>{var D;return{..._,questionVoted:!!f,youSelected:R===_.id,isLoading:n,hasCorrectAnswer:j,questionType:s.type,answerTimeExpired:A,questionStatus:d,imageMode:(D=s.appearance)==null?void 0:D.images,onVote:q}}):[],[j,A,n,s,f,d,q,R]),z=p&&(p.case==="trivia"||p.case==="prediction")?p.value:void 0,Q=d===u.QuestionStatus.RESOLVED&&l===u.QuestionType.TRIVIA&&!f&&!C,W=l===u.QuestionType.TRIVIA&&v&&I&&C,Z=h.useMemo(()=>l===u.QuestionType.PREDICTION?!!(f&&!j||f&&j&&g!=null&&g.youVoted):!0,[l,f,j,g]),oe=h.useMemo(()=>{if(l===u.QuestionType.PREDICTION&&f&&(!j||j&&g!=null&&g.youVoted))return f.points;if(!(Q||A))return d===u.QuestionStatus.RESOLVED?0:f?f.correct?f.points:0:g==null?void 0:g.points},[A,f,g,d,Q,l,j]),ae=h.useMemo(()=>l===u.QuestionType.PREDICTION&&f?j?j&&g!=null&&g.youVoted?"You won":"":"To win":Q||A?"Time expired":l===u.QuestionType.POLL?"Time remaining":f?"You won":"To win",[A,l,f,Q,j,g]),le=(l===u.QuestionType.TRIVIA||l===u.QuestionType.PREDICTION)&&f&&j&&(g==null?void 0:g.youVoted),re=f||Q||W||l===u.QuestionType.TRIVIA&&d===u.QuestionStatus.RESOLVED&&C;return e.jsx(is,{children:e.jsx(ts,{children:e.jsxs(os,{children:[e.jsx(ss,{feedbackMessages:z,questionVoted:!!f,questionVotedCorrectly:f==null?void 0:f.correct,questionType:l,hasCorrectAnswer:j,questionStatus:d,showExpiredNotification:Q,showClosedNotificationTrivia:W,votedInCurrentRender:I,votedAfterQuestionClosed:v,enteredAnActiveQuestion:C,marketClosed:m}),Z&&e.jsx(Os,{title:ae,points:oe,onTimerExpired:B,questionType:s.type,isTimer:!n,isPlayingTimer:!f,animatePoints:le,timerDuration:re?0:Number(((c=s==null?void 0:s.appearance)==null?void 0:c.autoHideInterval)||"30")}),A?e.jsx(Ge,{title:"More to come...",description:"Watch for additional enhanced stream interactive experience."}):e.jsxs(e.Fragment,{children:[e.jsx(as,{style:Z?{}:{marginTop:0},children:r}),e.jsx(ls,{children:F.map(_=>e.jsx(bs,{..._,markThatVoted:P,votedAfterQuestionClosed:v,enteredAnActiveQuestion:C,marketClosed:m},_.id))})]})]})})})},Us=t.styled_default("div")({name:"Container",class:"cgn5uen",propsAsIs:!1}),Bs=t.styled_default("div")({name:"Content",class:"c1px8nt6",propsAsIs:!1}),Fs=t.styled_default("h3")({name:"Title",class:"t5et2jt",propsAsIs:!1}),zs=t.styled_default("div")({name:"Description",class:"d1i2kpk2",propsAsIs:!1}),Hs=t.styled_default("img")({name:"Image",class:"id3lh3p",propsAsIs:!1}),ie=({instantView:s,isDetail:n,notification:i})=>{const o=s==null?void 0:s.heading,a=s==null?void 0:s.body,c=o||a,r=i==null?void 0:i.title,l=i==null?void 0:i.body;return e.jsxs(Us,{children:[(s==null?void 0:s.video)&&e.jsx(y.H,{source:s.video.url,poster:s.video.thumbnailUrl}),(s==null?void 0:s.image)&&!(s!=null&&s.video)&&e.jsx(Hs,{src:s==null?void 0:s.image}),e.jsxs(Bs,{children:[e.jsx(Fs,{children:n&&c?o:r}),e.jsx(zs,{children:n&&c?a:l})]})]})},Ws=t.styled_default("div")({name:"Container",class:"c1euiow",propsAsIs:!1}),Zs=t.styled_default("a")({name:"WebLinkBtn",class:"w19zie3h",propsAsIs:!1}),Ys=({instantView:s,...n})=>e.jsxs(Ws,{children:[e.jsx(ie,{instantView:s,...n,isDetail:!0}),(s==null?void 0:s.webLink)&&e.jsxs(Zs,{href:s==null?void 0:s.webLink.url,target:"_blank",children:[s==null?void 0:s.webLink.label,e.jsx(t.c1,{name:"icon-external-link"})]})]}),Gs=t.styled_default("div")({name:"Container",class:"c1dcxmvf",propsAsIs:!1}),Ks=t.styled_default("blockquote")({name:"Quote",class:"qb4q22c",propsAsIs:!1}),Xs=s=>e.jsxs(Gs,{children:[s.title&&e.jsx(Ks,{children:s.title}),e.jsx(y.G,{...s,isDetail:!0})]}),Js=t.styled_default("div")({name:"QuestionContainer",class:"qdri6g3",propsAsIs:!1}),et=({openedQuestion:s})=>{var n,i;return((n=s==null?void 0:s.attributes)==null?void 0:n.attributes.case)==="insight"?e.jsx(Ys,{...s.attributes.attributes.value}):((i=s==null?void 0:s.attributes)==null?void 0:i.attributes.case)==="tweet"?e.jsx(Xs,{...s.attributes.attributes.value}):null},st=({extendedQuestion:s,vote:n,close:i})=>{const{loading:o,data:a}=s;return a?e.jsx(Ms,{vote:n,close:i,openedQuestion:a,isLoading:!!o}):null},tt=({gamification:s})=>{var n;const i=S.useStore(s.openedQuestion.$store),o=S.useStore(s.openedQuestion.$extendedStore);if(!i)return null;const a=i.type;return e.jsxs(Js,{children:[e.jsx(se,{close:s.closeQuestion,type:((n=i.attributes)==null?void 0:n.type)||u.QuestionType.UNSET}),a==="question"&&e.jsx(st,{vote:s.submitAnswer,close:s.closeQuestion,extendedQuestion:o}),a!=="question"&&e.jsx(et,{openedQuestion:i}),e.jsx(He,{sponsorLogo:""})]})},nt=t.styled_default("div")({name:"Container",class:"c115qtkr",propsAsIs:!1}),it=t.styled_default("div")({name:"STabs",class:"sxnslc8",propsAsIs:!1}),ot=t.styled_default("button")({name:"Button",class:"b1umzux0",propsAsIs:!1}),at=t.styled_default("span")({name:"Title",class:"tspsaas",propsAsIs:!1});var U=(s=>(s.HOME="home",s.LEADERBOARD="leaderboard",s))(U||{});const X=({title:s,active:n,onClick:i})=>e.jsx(ot,{onClick:i,"data-selected":n,children:e.jsx(at,{children:s})}),lt=({activePage:s="home",toggleActivePage:n})=>e.jsx(nt,{children:e.jsxs(it,{"data-position":s==="home"?"left":"right",children:[e.jsx(X,{title:"Home",active:s==="home",onClick:()=>n("home")}),e.jsx(X,{title:"Friends",active:s==="leaderboard",onClick:()=>n("leaderboard")})]})}),rt=t.styled_default("div")({name:"Container",class:"c1ux29ft",propsAsIs:!1}),dt=t.styled_default("img")({name:"FriendsIcon",class:"f10ncfg2",propsAsIs:!1}),ct=t.styled_default("div")({name:"Content",class:"c1yc07bd",propsAsIs:!1}),ut=t.styled_default("div")({name:"Title",class:"tj6cq7w",propsAsIs:!1}),pt=t.styled_default("div")({name:"Description",class:"d1ag78xo",propsAsIs:!1}),mt=()=>t.c1,ht=t.styled_default(mt())({name:"ArrowInviteIcon",class:"awohrz6",propsAsIs:!0}),xt="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='32'%20height='32'%20rx='16'%20fill='white'/%3e%3cpath%20d='M10.4615%2012.6875C9.44231%2012.6875%208.61538%2013.4665%208.61538%2014.4266C8.61538%2015.3868%209.44231%2016.1658%2010.4615%2016.1658C11.4808%2016.1658%2012.3077%2015.3868%2012.3077%2014.4266C12.3077%2013.4665%2011.4808%2012.6875%2010.4615%2012.6875ZM10.4615%2016.1658C9.10817%2016.1658%208%2017.2097%208%2018.4846V19.7527C8%2019.7527%208.61538%2020.2237%2010.4615%2020.2237C12.3077%2020.2237%2012.9231%2019.7527%2012.9231%2019.7527V18.4846C12.9231%2017.2097%2011.8149%2016.1658%2010.4615%2016.1658ZM21.5385%2012.6875C20.5192%2012.6875%2019.6923%2013.4665%2019.6923%2014.4266C19.6923%2015.3868%2020.5192%2016.1658%2021.5385%2016.1658C22.5577%2016.1658%2023.3846%2015.3868%2023.3846%2014.4266C23.3846%2013.4665%2022.5577%2012.6875%2021.5385%2012.6875ZM21.5385%2016.1658C20.1851%2016.1658%2019.0769%2017.2097%2019.0769%2018.4846V19.7527C19.0769%2019.7527%2019.6923%2020.2237%2021.5385%2020.2237C23.3846%2020.2237%2024%2019.7527%2024%2019.7527V18.4846C24%2017.2097%2022.8918%2016.1658%2021.5385%2016.1658ZM16%2015.0063C14.9808%2015.0063%2014.1538%2015.7853%2014.1538%2016.7455C14.1538%2017.7056%2014.9808%2018.4846%2016%2018.4846C17.0192%2018.4846%2017.8462%2017.7056%2017.8462%2016.7455C17.8462%2015.7853%2017.0192%2015.0063%2016%2015.0063ZM16%2018.4846C14.6466%2018.4846%2013.5385%2019.5285%2013.5385%2020.8034V22.0715C13.5385%2022.0715%2014.1538%2022.5425%2016%2022.5425C17.8462%2022.5425%2018.4615%2022.0715%2018.4615%2022.0715V20.8034C18.4615%2019.5285%2017.3534%2018.4846%2016%2018.4846Z'%20fill='%23107D57'/%3e%3cpath%20opacity='0.5'%20d='M13.3908%209C12.3103%209%2011.4336%209.82584%2011.4336%2010.8437C11.4336%2011.8616%2012.3103%2012.6875%2013.3908%2012.6875C14.4713%2012.6875%2015.348%2011.8616%2015.348%2010.8437C15.348%209.82584%2014.4713%209%2013.3908%209ZM13.3908%2012.6875C13.1946%2012.6875%2012.9958%2012.6827%2012.7996%2012.7451C13.192%2013.2372%2013.3908%2013.8542%2013.3908%2014.5312C13.3908%2014.7761%2013.3296%2015.0161%2013.3296%2015.261C13.8521%2014.524%2014.6956%2014.0391%2015.6742%2013.9166C15.218%2013.1796%2014.3694%2012.6875%2013.3908%2012.6875ZM18.61%209C17.5295%209%2016.6528%209.82584%2016.6528%2010.8437C16.6528%2011.8616%2017.5295%2012.6875%2018.61%2012.6875C19.6905%2012.6875%2020.5672%2011.8616%2020.5672%2010.8437C20.5672%209.82584%2019.6905%209%2018.61%209ZM18.61%2012.6875C17.6314%2012.6875%2016.7828%2013.1796%2016.3266%2013.9166C17.3052%2014.0391%2018.1487%2014.524%2018.6712%2015.261C18.6712%2015.0161%2018.61%2014.7761%2018.61%2014.5312C18.61%2013.8542%2018.8088%2013.2372%2019.2012%2012.7451C19.005%2012.6827%2018.8062%2012.6875%2018.61%2012.6875Z'%20fill='%23107D57'/%3e%3c/svg%3e",ft=({title:s,description:n,onClick:i,className:o})=>e.jsxs(rt,{onClick:i,className:o,children:[e.jsx(dt,{alt:"friends-icon",src:xt}),e.jsxs(ct,{children:[e.jsx(ut,{children:s}),e.jsx(pt,{children:n})]}),e.jsx(ht,{name:"icon-copy"})]});function It(s){var n=s.lastRenderedStartIndex,i=s.lastRenderedStopIndex,o=s.startIndex,a=s.stopIndex;return!(o>i||a<n)}function yt(s){for(var n=s.isItemLoaded,i=s.itemCount,o=s.minimumBatchSize,a=s.startIndex,c=s.stopIndex,r=[],l=null,d=null,p=a;p<=c;p++){var m=n(p);m?d!==null&&(r.push(l,d),l=d=null):(d=p,l===null&&(l=p))}if(d!==null){for(var I=Math.min(Math.max(d,l+o-1),i-1),x=d+1;x<=I&&!n(x);x++)d=x;r.push(l,d)}if(r.length)for(;r[1]-r[0]+1<o&&r[0]>0;){var v=r[0]-1;if(!n(v))r[0]=v;else break}return r}var vt=function(s,n){if(!(s instanceof n))throw new TypeError("Cannot call a class as a function")},jt=function(){function s(n,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,a.key,a)}}return function(n,i,o){return i&&s(n.prototype,i),o&&s(n,o),n}}(),Ct=function(s,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof n);s.prototype=Object.create(n&&n.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(s,n):s.__proto__=n)},J=function(s,n){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n&&(typeof n=="object"||typeof n=="function")?n:s};(function(s){Ct(n,s);function n(){var i,o,a,c;vt(this,n);for(var r=arguments.length,l=Array(r),d=0;d<r;d++)l[d]=arguments[d];return c=(o=(a=J(this,(i=n.__proto__||Object.getPrototypeOf(n)).call.apply(i,[this].concat(l))),a),a._lastRenderedStartIndex=-1,a._lastRenderedStopIndex=-1,a._memoizedUnloadedRanges=[],a._onItemsRendered=function(p){var m=p.visibleStartIndex,I=p.visibleStopIndex;a._lastRenderedStartIndex=m,a._lastRenderedStopIndex=I,a._ensureRowsLoaded(m,I)},a._setRef=function(p){a._listRef=p},o),J(a,c)}return jt(n,[{key:"resetloadMoreItemsCache",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this._memoizedUnloadedRanges=[],o&&this._ensureRowsLoaded(this._lastRenderedStartIndex,this._lastRenderedStopIndex)}},{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var o=this.props.children;return o({onItemsRendered:this._onItemsRendered,ref:this._setRef})}},{key:"_ensureRowsLoaded",value:function(o,a){var c=this.props,r=c.isItemLoaded,l=c.itemCount,d=c.minimumBatchSize,p=d===void 0?10:d,m=c.threshold,I=m===void 0?15:m,x=yt({isItemLoaded:r,itemCount:l,minimumBatchSize:p,startIndex:Math.max(0,o-I),stopIndex:Math.min(l-1,a+I)});(this._memoizedUnloadedRanges.length!==x.length||this._memoizedUnloadedRanges.some(function(v,T){return x[T]!==v}))&&(this._memoizedUnloadedRanges=x,this._loadUnloadedRanges(x))}},{key:"_loadUnloadedRanges",value:function(o){for(var a=this,c=this.props.loadMoreItems||this.props.loadMoreRows,r=function(p){var m=o[p],I=o[p+1],x=c(m,I);x!=null&&x.then(function(){if(It({lastRenderedStartIndex:a._lastRenderedStartIndex,lastRenderedStopIndex:a._lastRenderedStopIndex,startIndex:m,stopIndex:I})){if(a._listRef==null)return;typeof a._listRef.resetAfterIndex=="function"?a._listRef.resetAfterIndex(m,!0):(typeof a._listRef._getItemStyleCache=="function"&&a._listRef._getItemStyleCache(-1),a._listRef.forceUpdate())}})},l=0;l<o.length;l+=2)r(l)}}]),n})(h.PureComponent);const At=t.styled_default("div")({name:"Container",class:"culdu4a",propsAsIs:!1}),gt=t.styled_default("div")({name:"Position",class:"pwf8e69",propsAsIs:!1}),_t=t.styled_default("img")({name:"Avatar",class:"atf4yh4",propsAsIs:!1}),bt=t.styled_default("div")({name:"AvatarPlaceholder",class:"a1dg29ja",propsAsIs:!1}),Tt=t.styled_default("div")({name:"Content",class:"c10a68rc",propsAsIs:!1}),$t=t.styled_default("div")({name:"NameContainer",class:"nc4kck5",propsAsIs:!1}),St=t.styled_default("span")({name:"Name",class:"njsrqgr",propsAsIs:!1}),Rt=()=>t.c1,kt=t.styled_default(Rt())({name:"CurrentUserBadge",class:"c17uc4zr",propsAsIs:!0}),wt=({rank:s,avatar:n,name:i,points:o,isCurrentUser:a,openItemDetail:c,style:r})=>e.jsxs(At,{onClick:c,style:r,children:[e.jsx(gt,{children:s||0}),e.jsxs(Tt,{children:[n?e.jsx(_t,{alt:"leaderboard-item-avatar",src:n}):e.jsx(bt,{children:y.I(i||"")}),e.jsxs($t,{children:[e.jsx(St,{children:i||""}),a&&e.jsx(kt,{name:"icon-star"})]})]}),e.jsx("div",{children:y.s(o)})]}),qt=t.styled_default("div")({name:"Container",class:"c16btbfp",propsAsIs:!1}),Qt=({items:s,currentUserId:n,openItemDetail:i,fetchMore:o,scrollNode:a,hasMore:c})=>e.jsx(ce,{loadMore:o,initialLoad:!1,hasMore:c,useWindow:!1,getScrollParent:()=>a.current,children:e.jsx(qt,{children:s.map(r=>e.jsx(wt,{...r,openItemDetail:()=>i(r.userId),isCurrentUser:!!n&&n===r.userId},r.userId))})}),Et=({renderClipBoardNode:s,deepLink:n})=>e.jsx(y.F,{renderToNode:s,inviteLink:n,socialLinks:[{icon:"icon-facebook",link:"https://www.facebook.com/TheMasters",label:"Facebook"},{icon:"icon-twitter",link:"https://twitter.com/@TheMasters",label:"X"}],inviteCardTitle:"It’s More Fun With Friends",inviteCardSubtext:"Invite and compete against your friends for the top spot on the leaderboard."}),Nt=t.styled_default("div")({name:"InviteLinkContainer",class:"i1chxfpe",propsAsIs:!1}),Dt=({gamification:s,scrollNode:n,scrollStore:i,renderClipBoardNode:o})=>{const{data:a,hasMore:c,loading:r,key:l}=S.useStore(s.leaderboardList.$store),{data:d}=S.useStore(s.deepLink.$store),[p,m]=y.h(o);return!a.length&&!r?e.jsx(Et,{renderClipBoardNode:o,deepLink:d}):e.jsxs(e.Fragment,{children:[e.jsx(Qt,{items:a,scrollNode:n,scrollStore:i,fetchMore:s.leaderboardList.fetchMore,hasMore:c,openItemDetail:s.openUser,currentUserId:s.currentUserId.get()},l),d&&e.jsx(Nt,{children:e.jsx(ft,{onClick:()=>p(d),title:"Invite Friends",description:"Challenge them now!"})}),m]})},Lt=t.styled_default("div")({name:"QuestionItem",class:"q1w97g3p",propsAsIs:!1}),Pt=t.styled_default("div")({name:"QuestionCaption",class:"q2sl39u",propsAsIs:!1}),Vt=t.styled_default("div")({name:"QuestionBody",class:"qd5h0uc",propsAsIs:!1}),Ot=t.styled_default("div")({name:"QuestionAction",class:"q105uluy",propsAsIs:!1}),Mt=()=>t.c1,M=t.styled_default(Mt())({name:"QuestionActionIcon",class:"q1fa0b9h",propsAsIs:!0}),Ut=()=>t.c1,Bt=t.styled_default(Ut())({name:"QuestionTypeIcon",class:"qxlt78s",propsAsIs:!0}),Ft=t.styled_default("div")({name:"QuestionTypeLabel",class:"qmg0vkx",propsAsIs:!1}),zt=t.styled_default("div")({name:"QuestionContent",class:"q1uz5j1g",propsAsIs:!1}),Ht=t.styled_default("button")({name:"PlayButton",class:"p1pba9p1",propsAsIs:!1}),Wt={[u.PickHistoryStatus.LOST]:e.jsx(M,{name:"incorrectVoted"}),[u.PickHistoryStatus.WON]:e.jsx(M,{name:"icon-check"}),[u.PickHistoryStatus.UNSET]:e.jsx(M,{name:"icon-arrow"}),[u.PickHistoryStatus.DNP]:e.jsx(M,{name:"icon-arrow"})},Zt=({questionId:s,questionType:n,questionStatus:i,subject:o,openForVoting:a,openQuestion:c,status:r})=>{const l=y.o[n],d=Wt[r];return l?e.jsxs(Lt,{onClick:()=>c==null?void 0:c(s),children:[e.jsxs(zt,{children:[e.jsxs(Pt,{children:[e.jsx(Bt,{"data-type-trivia":n===u.QuestionType.TRIVIA,"data-type-poll":n===u.QuestionType.POLL,name:l.iconName}),e.jsxs(Ft,{children:[l.label,n===u.QuestionType.TRIVIA&&i===u.QuestionStatus.RESOLVED&&" • Expired"]})]}),e.jsx(Vt,{children:o||""})]}),e.jsx(Ot,{children:a?e.jsx(Ht,{children:"Play"}):d})]}):null},Yt=t.styled_default("div")({name:"Container",class:"cll3md7",propsAsIs:!1}),Gt=t.styled_default("button")({name:"ActionBtn",class:"a10g1iik",propsAsIs:!1}),Kt=({openInsight:s,questionId:n,...i})=>e.jsxs(Yt,{children:[e.jsx(ie,{questionId:n,...i}),s&&e.jsx(Gt,{onClick:()=>s(n),children:"View Insight"})]}),Xt=t.styled_default("div")({name:"Container",class:"cl56x6b",propsAsIs:!1}),Jt=()=>y.c$1,en=t.styled_default(Jt())({name:"ActionButton",class:"a11pzf92",propsAsIs:!0}),sn=t.styled_default("blockquote")({name:"Quote",class:"q1hbaleq",propsAsIs:!1}),tn=({openTweet:s,...n})=>e.jsxs(Xt,{children:[n.title&&e.jsx(sn,{children:n.title}),e.jsx(y.G,{...n}),s&&e.jsx(en,{onClick:()=>s(n.tweetId),children:"View Insight"})]}),nn=t.styled_default("div")({name:"QuestionsContainer",class:"qvghv3l",propsAsIs:!1}),on=({questions:s,openQuestion:n})=>e.jsx(nn,{children:s==null?void 0:s.map(i=>{var o,a,c;if(i.type==="question"&&((o=i.attributes)==null?void 0:o.attributes.case)==="question"){const r=i.attributes.attributes.value;return e.jsx(Zt,{openQuestion:n,...r},r.questionId)}if(i.type==="insight"&&((a=i.attributes)==null?void 0:a.attributes.case)==="insight"){const r=i.attributes.attributes.value;return e.jsx(Kt,{openInsight:n,...r},r.questionId)}if(i.type==="tweet"&&((c=i.attributes)==null?void 0:c.attributes.case)==="tweet"){const r=i.attributes.attributes.value,l=i.attributes.id;return e.jsx(tn,{openTweet:n,...r,tweetId:l},l)}return null})}),an=({store:s,openQuestion:n})=>{const i=S.useStore(s);return i!=null&&i.data?e.jsx(on,{openQuestion:n,questions:i.data}):e.jsx("div",{children:"wait questions..."})},ln=({userSummary:s})=>{var n;const[i,o]=h.useState(void 0);return h.useEffect(()=>{const a=s.subscribe(c=>{c!=null&&c.data&&o(c.data)});return()=>{a()}},[s]),i!=null&&i.summary?e.jsx(te,{...i.summary,successRate:(n=i.percentage)==null?void 0:n.correct}):e.jsx("div",{children:"wait user..."})},rn=({gamification:s,className:n,scrollStore:i,scrollNode:o,appNode:a,style:c,responsiveStore:r,headerNode:l})=>{const{tabsShown:d}=S.useStore(i,{keys:["tabsShown"]}),[p,m]=h.useState(U.HOME),[,I]=h.useTransition(),{sdkInDesktopView:x}=S.useStore(r,{keys:["sdkInDesktopView"]}),v=b=>{I(()=>{var A;m(b),x===!1&&(((A=a.current)==null?void 0:A.getBoundingClientRect().y)||0)<0&&y.C$1(a,{behavior:"instant"})})};h.useEffect(()=>i.listen(b=>{if(b.scrollPosition===0){i.setKey("tabsShown",!0);return}r.get().sdkInDesktopView?i.setKey("tabsShown",b.scrollDirection==="backward"):i.setKey("tabsShown",b.scrollDirection==="forward")}),[i,r]);let T="0px";x?T=d?"0px":"calc(8px - var(--header-height) - var(--header-offset))":T=d?"calc(var(--header-height) + var(--header-offset) - 2px)":"0px";const C=x?a:l;return e.jsxs(y.p,{className:n,style:c,children:[e.jsx(y.C,{style:{top:T},children:e.jsx(lt,{activePage:p,toggleActivePage:v})}),p===U.HOME&&e.jsxs(e.Fragment,{children:[e.jsx(y.n,{style:{paddingTop:"8px"},children:e.jsx(y.m,{children:e.jsx(ln,{userSummary:s.userSummary})})}),e.jsx(y.a,{style:{flex:1},children:e.jsx(an,{openQuestion:s.openQuestion,store:s.feedList.getStore()})})]}),p===U.LEADERBOARD&&e.jsx(y.l,{children:e.jsx(Dt,{renderClipBoardNode:C,scrollStore:i,scrollNode:o,gamification:s})})]})},dn=()=>y.l$1,ee=t.styled_default(dn())({name:"OpenedContainer",class:"oar61gl",propsAsIs:!0}),cn=t.styled_default("div")({name:"UserContainer",class:"u14zaal4",propsAsIs:!1}),un=({correct:s,incorrect:n})=>{const i=s+n;return i===0?0:Math.round(s/i*100)},pn=({gamification:s,scrollStore:n,className:i,appNode:o,scrollNode:a,headerNode:c,responsiveStore:r})=>{const l=S.useStore(s.openedQuestion.$store),d=S.useStore(s.openedUser),{sdkInDesktopView:p}=S.useStore(r,{keys:["sdkInDesktopView"]}),m=h.useMemo(()=>{var I;const x=(((I=o.current)==null?void 0:I.getBoundingClientRect().y)||0)<0;if(!o.current||!l&&!d)return null;const v=l?e.jsx(ee,{className:i,children:e.jsx(tt,{gamification:s})}):d?e.jsx(ee,{className:i,children:e.jsxs(cn,{children:[e.jsx(se,{label:"Friend's Rank",close:s.closeUser}),e.jsx(y.n,{children:e.jsx(te,{...d,successRate:un(d)})})]})}):null;return y.C$2({Modal:v,container:o,useContainer:!p,fixedView:x})},[o,i,s,l,d,p]);return e.jsxs(e.Fragment,{children:[m,e.jsx(rn,{appNode:o,headerNode:c,scrollStore:n,scrollNode:a,className:i,gamification:s,responsiveStore:r})]})};exports.default=pn;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./useSdkFeature.js"),k=require("@nanostores/react"),h=require("react"),I=require("./masters2.js"),u=require("@streamlayer/sdk-web-types");require("react-countup");const de=require("react-countdown-circle-timer"),R=require("./index2.js"),ce=require("react-infinite-scroller");require("lodash.throttle");require("@streamlayer/sdk-web-interfaces");require("@streamlayer/sdk-web-notifications");require("./useStreamLayerApp.js");require("@streamlayer/sdk-web");const ue=t.styled_default("div")({name:"Container",class:"c1vwopgc",propsAsIs:!1}),pe=t.styled_default("div")({name:"QuestionTypeWrap",class:"qyktpt0",propsAsIs:!1}),me=()=>t.c1,he=t.styled_default(me())({name:"QuestionTypeIcon",class:"q951jdx",propsAsIs:!0}),xe=t.styled_default("span")({name:"QuestionTypeTitle",class:"qss5f0e",propsAsIs:!1}),fe=t.styled_default("div")({name:"CloseIconWrap",class:"c1ao1jtv",propsAsIs:!1}),Ie=()=>t.c1,ye=t.styled_default(Ie())({name:"CloseIcon",class:"cvsl7l3",propsAsIs:!0}),se=({type:s,close:n,label:i})=>{const o=s?I.o[s]:{label:i,iconName:void 0};return e.jsxs(ue,{children:[e.jsxs(pe,{children:[(o==null?void 0:o.iconName)&&e.jsx(he,{"data-type-trivia":s===u.QuestionType.TRIVIA,"data-type-poll":s===u.QuestionType.POLL,name:o.iconName}),(o==null?void 0:o.label)&&e.jsx(xe,{children:o.label})]}),e.jsx(fe,{onClick:n,children:e.jsx(ye,{name:"icon-cross"})})]})},ve=t.styled_default("div")({name:"Container",class:"c1zy8a",propsAsIs:!1}),je=t.styled_default("div")({name:"Title",class:"t1vih9p5",propsAsIs:!1}),Ce=t.styled_default("div")({name:"Indicator",class:"i1fbnvpb",propsAsIs:!1}),Y=({indicator:s,title:n})=>e.jsxs(ve,{children:[e.jsx(je,{children:n}),e.jsx(Ce,{children:s})]}),Ae=t.styled_default("div")({name:"Container",class:"ctmhwyc",propsAsIs:!1}),ge=t.styled_default("div")({name:"Indicator",class:"i1jri200",propsAsIs:!1}),_e=t.styled_default("div")({name:"Title",class:"t8s05oq",propsAsIs:!1}),L=({indicator:s,title:n})=>e.jsxs(Ae,{children:[e.jsx(ge,{children:s}),e.jsx(_e,{children:n})]}),be=t.styled_default("div")({name:"Container",class:"c1yrpn9o",propsAsIs:!1}),Te=t.styled_default("div")({name:"TopInfo",class:"t17fwahh",propsAsIs:!1}),$e=t.styled_default("div")({name:"BottomInfo",class:"by6w7e9",propsAsIs:!1}),ke=t.styled_default("div")({name:"User",class:"u1g7arbm",propsAsIs:!1}),Se=t.styled_default("img")({name:"Avatar",class:"a1ldeata",propsAsIs:!1}),Re=t.styled_default("div")({name:"UserInfo",class:"u10d4koz",propsAsIs:!1}),we=t.styled_default("div")({name:"UserName",class:"u1q6roj0",propsAsIs:!1}),qe=t.styled_default("div")({name:"UserRating",class:"ui0m425",propsAsIs:!1}),Qe=t.styled_default("img")({name:"TrophyIcon",class:"t1el3mrn",propsAsIs:!1}),Ee=t.styled_default("div")({name:"Rts",class:"r2vgnxv",propsAsIs:!1}),Ve=t.styled_default("div")({name:"RtsIndicator",class:"roqn06j",propsAsIs:!1}),Ne=t.styled_default("div")({name:"RtsLabel",class:"r15adx7c",propsAsIs:!1}),Pe=t.styled_default("div")({name:"Divider",class:"dv59lta",propsAsIs:!1}),De=t.styled_default("div")({name:"Ranks",class:"r55lotb",propsAsIs:!1}),Le=t.styled_default("div")({name:"Statistics",class:"s1knfgqt",propsAsIs:!1}),Oe=t.styled_default("div")({name:"AvatarPlaceholder",class:"a1mqo824",propsAsIs:!1}),Me=t.styled_default("button")({name:"UserAccountBtn",class:"uxareh6",propsAsIs:!1}),Ue="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Trophy'%3e%3cpath%20id='Combined%20Shape'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3.69197%204.66662C3.69197%205.99705%203.92914%207.17787%204.4035%208.20912C3.49966%208.02451%202.74487%207.66486%202.1391%207.13014C1.53333%206.59542%201.23046%206.0798%201.23046%205.58328V4.66662H3.69197ZM14.7686%204.66662V5.58328C14.7686%206.0798%2014.4658%206.59542%2013.86%207.13014C13.2542%207.66486%2012.4994%208.02451%2011.5956%208.20912C12.0699%207.17787%2012.3071%205.99705%2012.3071%204.66662H14.7686ZM15.9998%205.58329V4.36108C15.9998%204.10645%2015.9101%203.89002%2015.7306%203.71178C15.5511%203.53354%2015.3332%203.44442%2015.0768%203.44442H12.3076V2.52776C12.3076%202.10763%2012.1569%201.74797%2011.8556%201.44878C11.5544%201.14959%2011.1922%201%2010.7691%201H5.23072C4.80764%201%204.44547%201.14959%204.14419%201.44878C3.84291%201.74797%203.69227%202.10763%203.69227%202.52776V3.44442H0.923068C0.666659%203.44442%200.448714%203.53354%200.269228%203.71178C0.0897418%203.89002%200%204.10645%200%204.36108V5.58329C0%206.03525%200.13301%206.49039%200.399034%206.94872C0.665059%207.40705%201.02403%207.82082%201.47595%208.19003C1.92787%208.55924%202.48234%208.86957%203.13939%209.12101C3.79644%209.37246%204.48713%209.51409%205.21149%209.54592C5.48071%209.88967%205.7852%2010.192%206.12494%2010.453C6.36853%2010.6695%206.53679%2010.9002%206.62974%2011.1453C6.72269%2011.3904%206.76916%2011.6752%206.76916%2011.9999C6.76916%2012.3436%206.67141%2012.6333%206.4759%2012.8688C6.28038%2013.1043%205.96789%2013.2221%205.53841%2013.2221C5.05764%2013.2221%204.62976%2013.3669%204.25476%2013.6566C3.87977%2013.9462%203.69227%2014.3106%203.69227%2014.7499V15.361C3.69227%2015.4501%203.72112%2015.5233%203.77881%2015.5806C3.8365%2015.6379%203.91022%2015.6665%203.99996%2015.6665H11.9999C12.0896%2015.6665%2012.1633%2015.6379%2012.221%2015.5806C12.2787%2015.5233%2012.3076%2015.4501%2012.3076%2015.361V14.7499C12.3076%2014.3106%2012.1201%2013.9462%2011.7451%2013.6566C11.3701%2013.3669%2010.9422%2013.2221%2010.4614%2013.2221C10.0319%2013.2221%209.71945%2013.1043%209.52394%2012.8688C9.32843%2012.6333%209.23068%2012.3436%209.23068%2011.9999C9.23068%2011.6752%209.27715%2011.3904%209.3701%2011.1453C9.46305%2010.9002%209.63131%2010.6695%209.8749%2010.453C10.2146%2010.192%2010.5191%209.88967%2010.7884%209.54592C11.5127%209.51409%2012.2034%209.37246%2012.8604%209.12101C13.5175%208.86957%2014.072%208.55924%2014.5239%208.19003C14.9758%207.82082%2015.3348%207.40705%2015.6008%206.94872C15.8668%206.49039%2015.9998%206.03525%2015.9998%205.58329ZM6.76047%207.1798L8.05109%206.49997L9.3417%207.1798L9.09521%205.73989L10.1393%204.72015L8.69639%204.51007L8.05109%203.2L7.40578%204.51007L5.96283%204.72015L7.00696%205.73989L6.76047%207.1798Z'%20fill='%23F2C94C'/%3e%3c/g%3e%3c/svg%3e",te=({avatar:s,name:n,points:i,friendsRank:o,rank:a,streak:d,correct:c,incorrect:l,inTop:r,successRate:p})=>e.jsxs(be,{children:[e.jsx(Te,{children:e.jsxs(ke,{children:[e.jsxs(Me,{children:[s&&e.jsx(Se,{alt:"avatar",src:s}),!s&&e.jsx(Oe,{children:I.I(n||"")})]}),e.jsxs(Re,{children:[e.jsx(we,{children:n}),e.jsxs(qe,{children:[e.jsxs(Ee,{children:[e.jsx(Qe,{alt:"rank-icon",src:Ue}),e.jsxs(Ve,{children:[I.s(i),e.jsx(Ne,{children:"PTS"})]})]}),e.jsx(Pe,{}),e.jsxs("div",{children:["TOP ",r||0,"%"]})]})]})]})}),e.jsxs($e,{children:[e.jsxs(De,{children:[e.jsx(Y,{indicator:o||0,title:"Friends rank"}),e.jsx(Y,{indicator:a||0,title:"Global rank"})]}),e.jsxs(Le,{children:[e.jsx(L,{indicator:d||0,title:"Win streak"}),e.jsx(L,{indicator:c||0,title:"Correct"}),e.jsx(L,{indicator:l||0,title:"Incorrect"}),e.jsx(L,{indicator:`${p||0}%`,title:"Succ. rate"})]})]})]}),Be=t.styled_default("div")({name:"SponsorLogoWrap",class:"s8p5v5z",propsAsIs:!1}),Fe=()=>t.c1,ze=t.styled_default(Fe())({name:"SponsorLogo",class:"s755yti",propsAsIs:!0}),He=()=>e.jsx(Be,{children:e.jsx(ze,{name:"mastersLogo"})}),We=t.styled_default("div")({name:"Container",class:"c38csyt",propsAsIs:!1}),Ze=t.styled_default("div")({name:"Title",class:"ty221rx",propsAsIs:!1}),Ye=t.styled_default("div")({name:"Description",class:"dlaj9xp",propsAsIs:!1}),Ge=({title:s,description:n})=>e.jsxs(We,{children:[e.jsx(t.c1,{name:"icon-check-circle"}),e.jsx(Ze,{children:s}),e.jsx(Ye,{children:n})]}),Je=t.styled_default("div")({name:"Container",class:"c16sbdnm",propsAsIs:!1}),Ke=()=>t.c1,Xe=t.styled_default(Ke())({name:"IconPrediction",class:"ibhorgl",propsAsIs:!0}),P=t.styled_default("div")({name:"FeedbackIconWrap",class:"f1g20ja7",propsAsIs:!1}),O=t.styled_default("div")({name:"FeedbackHeader",class:"f455ozj",propsAsIs:!1}),es=t.styled_default("span")({name:"FeedbackTitle",class:"f1913njx",propsAsIs:!1}),E=t.styled_default("span")({name:"FeedbackDescription",class:"fzfk69z",propsAsIs:!1}),H=t.styled_default("div")({name:"FeedbackText",class:"fx87qaj",propsAsIs:!1}),ss=({feedbackMessages:s,questionVotedCorrectly:n,questionVoted:i,questionType:o,hasCorrectAnswer:a,questionStatus:d,showExpiredNotification:c,showClosedNotificationTrivia:l,votedInCurrentRender:r,votedAfterQuestionClosed:p,enteredAnActiveQuestion:m,marketClosed:y})=>{const x=i&&(o===u.QuestionType.TRIVIA||o===u.QuestionType.PREDICTION)&&r&&d!==u.QuestionStatus.RESOLVED,v=o===u.QuestionType.PREDICTION&&!a,T=y&&o===u.QuestionType.PREDICTION&&!i&&!m||o===u.QuestionType.PREDICTION&&p&&r&&m,C=x&&v,b=x&&a,A=o===u.QuestionType.PREDICTION&&i&&r&&a,w=i&&o===u.QuestionType.POLL&&r;if(!c&&!l&&!C&&!b&&!T&&!w&&!A)return null;const S=n?"correct":"incorrect",$=n?s==null?void 0:s.correctFeedback:s==null?void 0:s.incorrectFeedback;return e.jsxs(Je,{"data-isPrediction":v,children:[c&&e.jsxs(e.Fragment,{children:[e.jsx(P,{children:e.jsx(t.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Expired"})}),e.jsx(H,{children:"You can still answer to see if you're correct, but no points are awarded for expired questions."})]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(P,{children:e.jsx(t.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Closed"})}),e.jsx(H,{children:"This question was answered after the moderator closed the question. So the points for this answer won’t tally."})]})]}),T&&e.jsxs(e.Fragment,{children:[e.jsx(P,{children:e.jsx(t.c1,{name:"questionExpired"})}),e.jsxs("div",{children:[e.jsx(O,{children:e.jsx(E,{children:"Question Closed"})}),e.jsx(H,{children:"This event has already taken place, so the ability to make a prediction on its outcome is no longer available."})]})]}),C&&e.jsxs(e.Fragment,{children:[e.jsx(Xe,{name:"icon-prediction"}),e.jsx(E,{children:"Stay tuned to see if your prediction was correct."})]}),w&&e.jsxs(e.Fragment,{children:[e.jsx(P,{"data-feedback-type":"correct",children:e.jsx(t.c1,{name:"correct"})}),e.jsx(E,{children:"Thanks for answering. Please stay tuned for the next question."})]}),(b||A)&&e.jsxs(e.Fragment,{children:[e.jsx(P,{"data-feedback-type":S,children:e.jsx(t.c1,{name:S})}),e.jsx("div",{children:e.jsxs(O,{children:[e.jsx(es,{"data-feedback-type":S,children:$==null?void 0:$.title}),e.jsx(E,{children:$==null?void 0:$.description})]})})]})]})},ts=t.styled_default("div")({name:"Container",class:"c14ielyq",propsAsIs:!1}),ns=()=>I.c,os=t.styled_default(ns())({name:"QuestionScrollContainer",class:"q1tlqx57",propsAsIs:!0}),is=t.styled_default("div")({name:"Content",class:"c1hq58md",propsAsIs:!1}),as=t.styled_default("div")({name:"Title",class:"t1c8nxcx",propsAsIs:!1}),ls=t.styled_default("div")({name:"Options",class:"oiozuc3",propsAsIs:!1}),rs=t.styled_default("button")({name:"ButtonContainer",class:"b1b6dl8t",propsAsIs:!1}),ds=t.styled_default("div")({name:"ButtonPct",class:"b4iik8i",propsAsIs:!1}),cs=t.styled_default("span")({name:"ButtonBody",class:"b1gq1lnf",propsAsIs:!1}),us=t.styled_default("div")({name:"IconContainer",class:"i1j65z51",propsAsIs:!1}),ps=t.styled_default("div")({name:"IconWrap",class:"i19tpfua",propsAsIs:!1}),ne=t.styled_default("img")({name:"Icon",class:"i1tubmma",propsAsIs:!1}),ms=()=>ne,hs=t.styled_default(ms())({name:"IconDefault",class:"i1grrgwj",propsAsIs:!0}),xs=()=>ne,fs=t.styled_default(xs())({name:"IconCircle",class:"ibemyq8",propsAsIs:!0}),Is=t.styled_default("span")({name:"Title",class:"t1dceht",propsAsIs:!1}),ys=t.styled_default("span")({name:"Indicators",class:"i116q4vq",propsAsIs:!1}),vs=t.styled_default("span")({name:"Pts",class:"p17ajcu2",propsAsIs:!1}),js=t.styled_default("span")({name:"Percentage",class:"pu9kmlb",propsAsIs:!1}),Cs=()=>t.c1,As=t.styled_default(Cs())({name:"CheckIcon",class:"c1j2j0s0",propsAsIs:!0}),G={[u.QuestionImages.CENTERED]:s=>e.jsx(hs,{alt:"option-icon",src:s}),[u.QuestionImages.TRANSPARENT]:s=>e.jsx(us,{children:e.jsx(ps,{style:{backgroundImage:`url(${s})`}})}),[u.QuestionImages.ROUNDED]:s=>e.jsx(fs,{alt:"option-icon",src:s}),[u.QuestionImages.NONE]:()=>null,[u.QuestionImages.UNSET]:()=>null},gs=({questionType:s,hasCorrectAnswer:n,correct:i,youVoted:o,questionVoted:a})=>{if(s===u.QuestionType.POLL&&o)return"correct";if(s===u.QuestionType.PREDICTION){if(n&&a)return o?i?"correct":"incorrect":"unset";if(o)return"correct"}return s===u.QuestionType.TRIVIA&&a&&o?i?"correct":"incorrect":"unset"},_s=({questionType:s,questionVoted:n,correct:i,hasCorrectAnswer:o,questionStatus:a})=>s===u.QuestionType.TRIVIA?n&&i:s===u.QuestionType.PREDICTION?n&&i&&o||a===u.QuestionStatus.RESOLVED&&i:!1,bs=s=>{var n;const{id:i,icon:o,text:a,percentageDecimal:d,points:c,onVote:l,markThatVoted:r,youSelected:p,questionVoted:m,imageMode:y,answerTimeExpired:x,questionStatus:v,isLoading:T,questionType:C,correct:b,hasCorrectAnswer:A,votedAfterQuestionClosed:w,enteredAnActiveQuestion:S,marketClosed:$}=s,[V,D]=h.useState(d),q=gs(s),B=_s({questionType:C,questionVoted:m,correct:b,hasCorrectAnswer:A,questionStatus:v}),f=$&&C===u.QuestionType.PREDICTION,j=m||f,g=C===u.QuestionType.PREDICTION&&!m&&!$,F=m&&!p&&q!=="incorrect";return h.useLayoutEffect(()=>{d>0&&(D(0),requestAnimationFrame(()=>{D(d)}))},[d]),e.jsxs(rs,{value:i,"data-selected":p,"data-answer-state":q,disabled:m||T||x||f&&!S||f&&S&&w,"data-is-not-checked":F,onClick:z=>{r(C===u.QuestionType.PREDICTION?$:v===u.QuestionStatus.RESOLVED),l(z)},children:[e.jsx(ds,{"data-answer-state":q,style:{width:`${j?V:0}%`}}),e.jsxs(cs,{children:[o&&y&&((n=G[y])==null?void 0:n.call(G,o)),e.jsx(Is,{children:a}),g&&e.jsxs("div",{children:[c,e.jsx(vs,{children:"pts"})]}),j&&e.jsxs(ys,{children:[B&&e.jsx(As,{name:"selected"}),e.jsx(js,{children:e.jsx(t.d,{value:d,suffix:"%"})})]})]})]})},Ts=[R.E.PRIMARY_GREEN1,R.E.SECONDARY_RED1,R.E.SECONDARY_RED1,R.E.NEUTRALS_GRAY3],$s=[10,10,1,0],ks=t.styled_default("div")({name:"RemainingTime",class:"r165427",propsAsIs:!1}),Ss=R.E.SECONDARY_GREEN6,J=R.E.SECONDARY_RED3,Rs=R.E.NEUTRALS_GRAY3,ws=({isPlaying:s=!0,duration:n=30,onTimerExpired:i})=>{const[o,a]=h.useState(n>10?Ss:J),d=({remainingTime:r})=>e.jsx(ks,{children:r}),c=h.useCallback(()=>{i==null||i(),a(Rs)},[i,a]),l=h.useCallback(r=>{r===10&&a(J)},[a]);return e.jsx(de.CountdownCircleTimer,{isPlaying:s,duration:n,colors:Ts,colorsTime:$s,size:32,strokeWidth:2,trailStrokeWidth:2,trailColor:o,onComplete:c,onUpdate:l,children:d})},qs=t.styled_default("div")({name:"WinBarContainer",class:"wie6cqo",propsAsIs:!1}),Qs=t.styled_default("div")({name:"Content",class:"cgizw4u",propsAsIs:!1}),Es=t.styled_default("div")({name:"Title",class:"t1l3ucjp",propsAsIs:!1}),Vs=()=>t.c1,Ns=t.styled_default(Vs())({name:"WinIcon",class:"wx7j799",propsAsIs:!0}),Ps=t.styled_default("div")({name:"Points",class:"p4lwuj0",propsAsIs:!1}),Ds=t.styled_default("span")({name:"PointsCount",class:"po9i64o",propsAsIs:!1}),Ls=t.styled_default("span")({name:"PointsUnits",class:"pe5g05h",propsAsIs:!1}),Os=({title:s,points:n,isPlayingTimer:i,isTimer:o,animatePoints:a,questionType:d,timerDuration:c,onTimerExpired:l})=>e.jsxs(qs,{style:{justifyContent:d===u.QuestionType.PREDICTION?"center":"space-between"},children:[e.jsxs(Qs,{children:[s&&e.jsx(Es,{children:s}),n!==void 0&&d!==u.QuestionType.POLL&&e.jsxs(e.Fragment,{children:[e.jsx(Ns,{name:"icon-trophy"}),e.jsxs(Ps,{children:[e.jsx(Ds,{children:a?e.jsx(t.d,{value:n,delay:.3}):n}),e.jsx(Ls,{children:"PTS"})]})]})]}),o&&d!==u.QuestionType.PREDICTION&&e.jsx(ws,{isPlaying:i,onTimerExpired:l,duration:c})]}),Ms=({openedQuestion:s,isLoading:n,vote:i,close:o})=>{var a,d;const c=s.subject,l=s.type,r=s.status,p=(a=s.options)==null?void 0:a.options,m=s.marketClosed,[y,x]=h.useState(!1),[v,T]=h.useState(!1),[C,b]=h.useState(!0),[A,w]=h.useState(!1),[S,$]=h.useState(""),V=s==null?void 0:s.id;h.useEffect(()=>{l===u.QuestionType.PREDICTION?m&&b(!1):r===u.QuestionStatus.RESOLVED&&b(!1)},[]);const D=h.useCallback(_=>{T(_),x(!0)},[]),q=h.useCallback(async _=>{if(V){const N=_.currentTarget.value;$(N),await i(V,N)}},[V,$,i]),B=h.useCallback(()=>{w(!0),setTimeout(o,3e3)},[o]),f=h.useMemo(()=>s==null?void 0:s.answers.find(_=>_.youVoted===!0),[s]),j=h.useMemo(()=>!!(s!=null&&s.answers.find(_=>_.correct===!0)),[s]),g=h.useMemo(()=>s==null?void 0:s.answers.find(_=>_.correct===!0),[s]),F=h.useMemo(()=>s?s.answers.map(_=>{var N;return{..._,questionVoted:!!f,youSelected:S===_.id,isLoading:n,hasCorrectAnswer:j,questionType:s.type,answerTimeExpired:A,questionStatus:r,imageMode:(N=s.appearance)==null?void 0:N.images,onVote:q}}):[],[j,A,n,s,f,r,q,S]),z=p&&(p.case==="trivia"||p.case==="prediction")?p.value:void 0,Q=r===u.QuestionStatus.RESOLVED&&l===u.QuestionType.TRIVIA&&!f&&!C,W=l===u.QuestionType.TRIVIA&&v&&y&&C,Z=h.useMemo(()=>l===u.QuestionType.PREDICTION?!!(f&&!j||f&&j&&g!=null&&g.youVoted):!0,[l,f,j,g]),ie=h.useMemo(()=>{if(l===u.QuestionType.PREDICTION&&f&&(!j||j&&g!=null&&g.youVoted))return f.points;if(!(Q||A))return r===u.QuestionStatus.RESOLVED?0:f?f.correct?f.points:0:g==null?void 0:g.points},[A,f,g,r,Q,l,j]),ae=h.useMemo(()=>l===u.QuestionType.PREDICTION&&f?j?j&&g!=null&&g.youVoted?"You won":"":"To win":Q||A?"Time expired":l===u.QuestionType.POLL?"Time remaining":f?"You won":"To win",[A,l,f,Q,j,g]),le=(l===u.QuestionType.TRIVIA||l===u.QuestionType.PREDICTION)&&f&&j&&(g==null?void 0:g.youVoted),re=f||Q||W||l===u.QuestionType.TRIVIA&&r===u.QuestionStatus.RESOLVED&&C;return e.jsx(os,{children:e.jsx(ts,{children:e.jsxs(is,{children:[e.jsx(ss,{feedbackMessages:z,questionVoted:!!f,questionVotedCorrectly:f==null?void 0:f.correct,questionType:l,hasCorrectAnswer:j,questionStatus:r,showExpiredNotification:Q,showClosedNotificationTrivia:W,votedInCurrentRender:y,votedAfterQuestionClosed:v,enteredAnActiveQuestion:C,marketClosed:m}),Z&&e.jsx(Os,{title:ae,points:ie,onTimerExpired:B,questionType:s.type,isTimer:!n,isPlayingTimer:!f,animatePoints:le,timerDuration:re?0:Number(((d=s==null?void 0:s.appearance)==null?void 0:d.autoHideInterval)||"30")}),A?e.jsx(Ge,{title:"More to come...",description:"Watch for additional enhanced stream interactive experience."}):e.jsxs(e.Fragment,{children:[e.jsx(as,{style:Z?{}:{marginTop:0},children:c}),e.jsx(ls,{children:F.map(_=>e.jsx(bs,{..._,markThatVoted:D,votedAfterQuestionClosed:v,enteredAnActiveQuestion:C,marketClosed:m},_.id))})]})]})})})},Us=t.styled_default("div")({name:"Container",class:"cgn5uen",propsAsIs:!1}),Bs=t.styled_default("div")({name:"Content",class:"c1px8nt6",propsAsIs:!1}),Fs=t.styled_default("h3")({name:"Title",class:"t5et2jt",propsAsIs:!1}),zs=t.styled_default("div")({name:"Description",class:"d1i2kpk2",propsAsIs:!1}),Hs=t.styled_default("img")({name:"Image",class:"id3lh3p",propsAsIs:!1}),oe=({instantView:s,isDetail:n,notification:i,controlVideo:o})=>{const a=s==null?void 0:s.heading,d=s==null?void 0:s.body,c=a||d,l=i==null?void 0:i.title,r=i==null?void 0:i.body;return e.jsxs(Us,{children:[(s==null?void 0:s.video)&&e.jsx(I.q,{source:s.video.url,poster:s.video.thumbnailUrl,controlVideo:o}),(s==null?void 0:s.image)&&!(s!=null&&s.video)&&e.jsx(Hs,{src:s==null?void 0:s.image}),e.jsxs(Bs,{children:[e.jsx(Fs,{children:n&&c?a:l}),e.jsx(zs,{children:n&&c?d:r})]})]})},Ws=t.styled_default("div")({name:"Container",class:"c1euiow",propsAsIs:!1}),Zs=t.styled_default("a")({name:"WebLinkBtn",class:"w19zie3h",propsAsIs:!1}),Ys=({instantView:s,...n})=>e.jsxs(Ws,{children:[e.jsx(oe,{instantView:s,...n,isDetail:!0}),(s==null?void 0:s.webLink)&&e.jsxs(Zs,{href:s==null?void 0:s.webLink.url,target:"_blank",children:[s==null?void 0:s.webLink.label,e.jsx(t.c1,{name:"icon-external-link"})]})]}),Gs=t.styled_default("div")({name:"Container",class:"c1dcxmvf",propsAsIs:!1}),Js=t.styled_default("blockquote")({name:"Quote",class:"qb4q22c",propsAsIs:!1}),Ks=s=>e.jsxs(Gs,{children:[s.title&&e.jsx(Js,{children:s.title}),e.jsx(I.J,{...s,isDetail:!0})]}),Xs=t.styled_default("div")({name:"QuestionContainer",class:"qdri6g3",propsAsIs:!1}),et=({openedQuestion:s})=>{var n,i;const{sdk:o}=I.n();return((n=s==null?void 0:s.attributes)==null?void 0:n.attributes.case)==="insight"?e.jsx(Ys,{...s.attributes.attributes.value,controlVideo:o==null?void 0:o.controlVideoPlayer}):((i=s==null?void 0:s.attributes)==null?void 0:i.attributes.case)==="tweet"?e.jsx(Ks,{...s.attributes.attributes.value,controlVideo:o==null?void 0:o.controlVideoPlayer}):null},st=({extendedQuestion:s,vote:n,close:i})=>{const{loading:o,data:a}=s;return a?e.jsx(Ms,{vote:n,close:i,openedQuestion:a,isLoading:!!o}):null},tt=({gamification:s})=>{var n;const i=k.useStore(s.openedQuestion.$store),o=k.useStore(s.openedQuestion.$extendedStore);if(!i)return null;const a=i.type;return e.jsxs(Xs,{children:[e.jsx(se,{close:s.closeQuestion,type:((n=i.attributes)==null?void 0:n.type)||u.QuestionType.UNSET}),a==="question"&&e.jsx(st,{vote:s.submitAnswer,close:s.closeQuestion,extendedQuestion:o}),a!=="question"&&e.jsx(et,{openedQuestion:i}),e.jsx(He,{sponsorLogo:""})]})},nt=t.styled_default("div")({name:"Container",class:"c115qtkr",propsAsIs:!1}),ot=t.styled_default("div")({name:"STabs",class:"sxnslc8",propsAsIs:!1}),it=t.styled_default("button")({name:"Button",class:"b1umzux0",propsAsIs:!1}),at=t.styled_default("span")({name:"Title",class:"tspsaas",propsAsIs:!1});var U=(s=>(s.HOME="home",s.LEADERBOARD="leaderboard",s))(U||{});const K=({title:s,active:n,onClick:i})=>e.jsx(it,{onClick:i,"data-selected":n,children:e.jsx(at,{children:s})}),lt=({activePage:s="home",toggleActivePage:n})=>e.jsx(nt,{children:e.jsxs(ot,{"data-position":s==="home"?"left":"right",children:[e.jsx(K,{title:"Home",active:s==="home",onClick:()=>n("home")}),e.jsx(K,{title:"Friends",active:s==="leaderboard",onClick:()=>n("leaderboard")})]})}),rt=t.styled_default("div")({name:"Container",class:"c1ux29ft",propsAsIs:!1}),dt=t.styled_default("img")({name:"FriendsIcon",class:"f10ncfg2",propsAsIs:!1}),ct=t.styled_default("div")({name:"Content",class:"c1yc07bd",propsAsIs:!1}),ut=t.styled_default("div")({name:"Title",class:"tj6cq7w",propsAsIs:!1}),pt=t.styled_default("div")({name:"Description",class:"d1ag78xo",propsAsIs:!1}),mt=()=>t.c1,ht=t.styled_default(mt())({name:"ArrowInviteIcon",class:"awohrz6",propsAsIs:!0}),xt="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='32'%20height='32'%20rx='16'%20fill='white'/%3e%3cpath%20d='M10.4615%2012.6875C9.44231%2012.6875%208.61538%2013.4665%208.61538%2014.4266C8.61538%2015.3868%209.44231%2016.1658%2010.4615%2016.1658C11.4808%2016.1658%2012.3077%2015.3868%2012.3077%2014.4266C12.3077%2013.4665%2011.4808%2012.6875%2010.4615%2012.6875ZM10.4615%2016.1658C9.10817%2016.1658%208%2017.2097%208%2018.4846V19.7527C8%2019.7527%208.61538%2020.2237%2010.4615%2020.2237C12.3077%2020.2237%2012.9231%2019.7527%2012.9231%2019.7527V18.4846C12.9231%2017.2097%2011.8149%2016.1658%2010.4615%2016.1658ZM21.5385%2012.6875C20.5192%2012.6875%2019.6923%2013.4665%2019.6923%2014.4266C19.6923%2015.3868%2020.5192%2016.1658%2021.5385%2016.1658C22.5577%2016.1658%2023.3846%2015.3868%2023.3846%2014.4266C23.3846%2013.4665%2022.5577%2012.6875%2021.5385%2012.6875ZM21.5385%2016.1658C20.1851%2016.1658%2019.0769%2017.2097%2019.0769%2018.4846V19.7527C19.0769%2019.7527%2019.6923%2020.2237%2021.5385%2020.2237C23.3846%2020.2237%2024%2019.7527%2024%2019.7527V18.4846C24%2017.2097%2022.8918%2016.1658%2021.5385%2016.1658ZM16%2015.0063C14.9808%2015.0063%2014.1538%2015.7853%2014.1538%2016.7455C14.1538%2017.7056%2014.9808%2018.4846%2016%2018.4846C17.0192%2018.4846%2017.8462%2017.7056%2017.8462%2016.7455C17.8462%2015.7853%2017.0192%2015.0063%2016%2015.0063ZM16%2018.4846C14.6466%2018.4846%2013.5385%2019.5285%2013.5385%2020.8034V22.0715C13.5385%2022.0715%2014.1538%2022.5425%2016%2022.5425C17.8462%2022.5425%2018.4615%2022.0715%2018.4615%2022.0715V20.8034C18.4615%2019.5285%2017.3534%2018.4846%2016%2018.4846Z'%20fill='%23107D57'/%3e%3cpath%20opacity='0.5'%20d='M13.3908%209C12.3103%209%2011.4336%209.82584%2011.4336%2010.8437C11.4336%2011.8616%2012.3103%2012.6875%2013.3908%2012.6875C14.4713%2012.6875%2015.348%2011.8616%2015.348%2010.8437C15.348%209.82584%2014.4713%209%2013.3908%209ZM13.3908%2012.6875C13.1946%2012.6875%2012.9958%2012.6827%2012.7996%2012.7451C13.192%2013.2372%2013.3908%2013.8542%2013.3908%2014.5312C13.3908%2014.7761%2013.3296%2015.0161%2013.3296%2015.261C13.8521%2014.524%2014.6956%2014.0391%2015.6742%2013.9166C15.218%2013.1796%2014.3694%2012.6875%2013.3908%2012.6875ZM18.61%209C17.5295%209%2016.6528%209.82584%2016.6528%2010.8437C16.6528%2011.8616%2017.5295%2012.6875%2018.61%2012.6875C19.6905%2012.6875%2020.5672%2011.8616%2020.5672%2010.8437C20.5672%209.82584%2019.6905%209%2018.61%209ZM18.61%2012.6875C17.6314%2012.6875%2016.7828%2013.1796%2016.3266%2013.9166C17.3052%2014.0391%2018.1487%2014.524%2018.6712%2015.261C18.6712%2015.0161%2018.61%2014.7761%2018.61%2014.5312C18.61%2013.8542%2018.8088%2013.2372%2019.2012%2012.7451C19.005%2012.6827%2018.8062%2012.6875%2018.61%2012.6875Z'%20fill='%23107D57'/%3e%3c/svg%3e",ft=({title:s,description:n,onClick:i,className:o})=>e.jsxs(rt,{onClick:i,className:o,children:[e.jsx(dt,{alt:"friends-icon",src:xt}),e.jsxs(ct,{children:[e.jsx(ut,{children:s}),e.jsx(pt,{children:n})]}),e.jsx(ht,{name:"icon-copy"})]});function It(s){var n=s.lastRenderedStartIndex,i=s.lastRenderedStopIndex,o=s.startIndex,a=s.stopIndex;return!(o>i||a<n)}function yt(s){for(var n=s.isItemLoaded,i=s.itemCount,o=s.minimumBatchSize,a=s.startIndex,d=s.stopIndex,c=[],l=null,r=null,p=a;p<=d;p++){var m=n(p);m?r!==null&&(c.push(l,r),l=r=null):(r=p,l===null&&(l=p))}if(r!==null){for(var y=Math.min(Math.max(r,l+o-1),i-1),x=r+1;x<=y&&!n(x);x++)r=x;c.push(l,r)}if(c.length)for(;c[1]-c[0]+1<o&&c[0]>0;){var v=c[0]-1;if(!n(v))c[0]=v;else break}return c}var vt=function(s,n){if(!(s instanceof n))throw new TypeError("Cannot call a class as a function")},jt=function(){function s(n,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,a.key,a)}}return function(n,i,o){return i&&s(n.prototype,i),o&&s(n,o),n}}(),Ct=function(s,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof n);s.prototype=Object.create(n&&n.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(s,n):s.__proto__=n)},X=function(s,n){if(!s)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n&&(typeof n=="object"||typeof n=="function")?n:s};(function(s){Ct(n,s);function n(){var i,o,a,d;vt(this,n);for(var c=arguments.length,l=Array(c),r=0;r<c;r++)l[r]=arguments[r];return d=(o=(a=X(this,(i=n.__proto__||Object.getPrototypeOf(n)).call.apply(i,[this].concat(l))),a),a._lastRenderedStartIndex=-1,a._lastRenderedStopIndex=-1,a._memoizedUnloadedRanges=[],a._onItemsRendered=function(p){var m=p.visibleStartIndex,y=p.visibleStopIndex;a._lastRenderedStartIndex=m,a._lastRenderedStopIndex=y,a._ensureRowsLoaded(m,y)},a._setRef=function(p){a._listRef=p},o),X(a,d)}return jt(n,[{key:"resetloadMoreItemsCache",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this._memoizedUnloadedRanges=[],o&&this._ensureRowsLoaded(this._lastRenderedStartIndex,this._lastRenderedStopIndex)}},{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var o=this.props.children;return o({onItemsRendered:this._onItemsRendered,ref:this._setRef})}},{key:"_ensureRowsLoaded",value:function(o,a){var d=this.props,c=d.isItemLoaded,l=d.itemCount,r=d.minimumBatchSize,p=r===void 0?10:r,m=d.threshold,y=m===void 0?15:m,x=yt({isItemLoaded:c,itemCount:l,minimumBatchSize:p,startIndex:Math.max(0,o-y),stopIndex:Math.min(l-1,a+y)});(this._memoizedUnloadedRanges.length!==x.length||this._memoizedUnloadedRanges.some(function(v,T){return x[T]!==v}))&&(this._memoizedUnloadedRanges=x,this._loadUnloadedRanges(x))}},{key:"_loadUnloadedRanges",value:function(o){for(var a=this,d=this.props.loadMoreItems||this.props.loadMoreRows,c=function(p){var m=o[p],y=o[p+1],x=d(m,y);x!=null&&x.then(function(){if(It({lastRenderedStartIndex:a._lastRenderedStartIndex,lastRenderedStopIndex:a._lastRenderedStopIndex,startIndex:m,stopIndex:y})){if(a._listRef==null)return;typeof a._listRef.resetAfterIndex=="function"?a._listRef.resetAfterIndex(m,!0):(typeof a._listRef._getItemStyleCache=="function"&&a._listRef._getItemStyleCache(-1),a._listRef.forceUpdate())}})},l=0;l<o.length;l+=2)c(l)}}]),n})(h.PureComponent);const At=t.styled_default("div")({name:"Container",class:"culdu4a",propsAsIs:!1}),gt=t.styled_default("div")({name:"Position",class:"pwf8e69",propsAsIs:!1}),_t=t.styled_default("img")({name:"Avatar",class:"atf4yh4",propsAsIs:!1}),bt=t.styled_default("div")({name:"AvatarPlaceholder",class:"a1dg29ja",propsAsIs:!1}),Tt=t.styled_default("div")({name:"Content",class:"c10a68rc",propsAsIs:!1}),$t=t.styled_default("div")({name:"NameContainer",class:"nc4kck5",propsAsIs:!1}),kt=t.styled_default("span")({name:"Name",class:"njsrqgr",propsAsIs:!1}),St=()=>t.c1,Rt=t.styled_default(St())({name:"CurrentUserBadge",class:"c17uc4zr",propsAsIs:!0}),wt=({rank:s,avatar:n,name:i,points:o,isCurrentUser:a,openItemDetail:d,style:c})=>e.jsxs(At,{onClick:d,style:c,children:[e.jsx(gt,{children:s||0}),e.jsxs(Tt,{children:[n?e.jsx(_t,{alt:"leaderboard-item-avatar",src:n}):e.jsx(bt,{children:I.I(i||"")}),e.jsxs($t,{children:[e.jsx(kt,{children:i||""}),a&&e.jsx(Rt,{name:"icon-star"})]})]}),e.jsx("div",{children:I.s(o)})]}),qt=t.styled_default("div")({name:"Container",class:"c16btbfp",propsAsIs:!1}),Qt=({items:s,currentUserId:n,openItemDetail:i,fetchMore:o,scrollNode:a,hasMore:d})=>e.jsx(ce,{loadMore:o,initialLoad:!1,hasMore:d,useWindow:!1,getScrollParent:()=>a.current,children:e.jsx(qt,{children:s.map(c=>e.jsx(wt,{...c,openItemDetail:()=>i(c.userId),isCurrentUser:!!n&&n===c.userId},c.userId))})}),Et=({renderClipBoardNode:s,deepLink:n})=>e.jsx(I.F,{renderToNode:s,inviteLink:n,socialLinks:[{icon:"icon-facebook",link:"https://www.facebook.com/TheMasters",label:"Facebook"},{icon:"icon-twitter",link:"https://twitter.com/@TheMasters",label:"X"}],inviteCardTitle:"It’s More Fun With Friends",inviteCardSubtext:"Invite and compete against your friends for the top spot on the leaderboard."}),Vt=t.styled_default("div")({name:"InviteLinkContainer",class:"i1chxfpe",propsAsIs:!1}),Nt=({gamification:s,scrollNode:n,scrollStore:i,renderClipBoardNode:o})=>{const{data:a,hasMore:d,loading:c,key:l}=k.useStore(s.leaderboardList.$store),{data:r}=k.useStore(s.deepLink.$store),[p,m]=I.h(o);return!a.length&&!c?e.jsx(Et,{renderClipBoardNode:o,deepLink:r}):e.jsxs(e.Fragment,{children:[e.jsx(Qt,{items:a,scrollNode:n,scrollStore:i,fetchMore:s.leaderboardList.fetchMore,hasMore:d,openItemDetail:s.openUser,currentUserId:s.currentUserId.get()},l),r&&e.jsx(Vt,{children:e.jsx(ft,{onClick:()=>p(r),title:"Invite Friends",description:"Challenge them now!"})}),m]})},Pt=t.styled_default("div")({name:"QuestionItem",class:"q1w97g3p",propsAsIs:!1}),Dt=t.styled_default("div")({name:"QuestionCaption",class:"q2sl39u",propsAsIs:!1}),Lt=t.styled_default("div")({name:"QuestionBody",class:"qd5h0uc",propsAsIs:!1}),Ot=t.styled_default("div")({name:"QuestionAction",class:"q105uluy",propsAsIs:!1}),Mt=()=>t.c1,M=t.styled_default(Mt())({name:"QuestionActionIcon",class:"q1fa0b9h",propsAsIs:!0}),Ut=()=>t.c1,Bt=t.styled_default(Ut())({name:"QuestionTypeIcon",class:"qxlt78s",propsAsIs:!0}),Ft=t.styled_default("div")({name:"QuestionTypeLabel",class:"qmg0vkx",propsAsIs:!1}),zt=t.styled_default("div")({name:"QuestionContent",class:"q1uz5j1g",propsAsIs:!1}),Ht=t.styled_default("button")({name:"PlayButton",class:"p1pba9p1",propsAsIs:!1}),Wt={[u.PickHistoryStatus.LOST]:e.jsx(M,{name:"incorrectVoted"}),[u.PickHistoryStatus.WON]:e.jsx(M,{name:"icon-check"}),[u.PickHistoryStatus.UNSET]:e.jsx(M,{name:"icon-arrow"}),[u.PickHistoryStatus.DNP]:e.jsx(M,{name:"icon-arrow"})},Zt=({questionId:s,questionType:n,questionStatus:i,subject:o,openForVoting:a,openQuestion:d,status:c})=>{const l=I.o[n],r=Wt[c];return l?e.jsxs(Pt,{onClick:()=>d==null?void 0:d(s),children:[e.jsxs(zt,{children:[e.jsxs(Dt,{children:[e.jsx(Bt,{"data-type-trivia":n===u.QuestionType.TRIVIA,"data-type-poll":n===u.QuestionType.POLL,name:l.iconName}),e.jsxs(Ft,{children:[l.label,n===u.QuestionType.TRIVIA&&i===u.QuestionStatus.RESOLVED&&" • Expired"]})]}),e.jsx(Lt,{children:o||""})]}),e.jsx(Ot,{children:a?e.jsx(Ht,{children:"Play"}):r})]}):null},Yt=t.styled_default("div")({name:"Container",class:"cll3md7",propsAsIs:!1}),Gt=t.styled_default("button")({name:"ActionBtn",class:"a10g1iik",propsAsIs:!1}),Jt=({openInsight:s,questionId:n,...i})=>e.jsxs(Yt,{children:[e.jsx(oe,{questionId:n,...i}),s&&e.jsx(Gt,{onClick:()=>s(n),children:"View Insight"})]}),Kt=t.styled_default("div")({name:"Container",class:"cl56x6b",propsAsIs:!1}),Xt=()=>I.c$1,en=t.styled_default(Xt())({name:"ActionButton",class:"a11pzf92",propsAsIs:!0}),sn=t.styled_default("blockquote")({name:"Quote",class:"q1hbaleq",propsAsIs:!1}),tn=({openTweet:s,...n})=>e.jsxs(Kt,{children:[n.title&&e.jsx(sn,{children:n.title}),e.jsx(I.J,{...n}),s&&e.jsx(en,{onClick:()=>s(n.tweetId),children:"View Insight"})]}),nn=t.styled_default("div")({name:"QuestionsContainer",class:"qvghv3l",propsAsIs:!1}),on=({questions:s,openQuestion:n,controlVideo:i})=>e.jsx(nn,{children:s==null?void 0:s.map(o=>{var a,d,c;if(o.type==="question"&&((a=o.attributes)==null?void 0:a.attributes.case)==="question"){const l=o.attributes.attributes.value;return e.jsx(Zt,{openQuestion:n,...l},l.questionId)}if(o.type==="insight"&&((d=o.attributes)==null?void 0:d.attributes.case)==="insight"){const l=o.attributes.attributes.value;return e.jsx(Jt,{openInsight:n,controlVideo:i,...l},l.questionId)}if(o.type==="tweet"&&((c=o.attributes)==null?void 0:c.attributes.case)==="tweet"){const l=o.attributes.attributes.value,r=o.attributes.id;return e.jsx(tn,{openTweet:n,controlVideo:i,...l,tweetId:r},r)}return null})}),an=({store:s,openQuestion:n})=>{const{sdk:i}=I.n(),o=k.useStore(s);return o!=null&&o.data?e.jsx(on,{openQuestion:n,questions:o.data,controlVideo:i==null?void 0:i.controlVideoPlayer}):e.jsx("div",{children:"wait questions..."})},ln=({userSummary:s})=>{var n;const[i,o]=h.useState(void 0);return h.useEffect(()=>{const a=s.subscribe(d=>{d!=null&&d.data&&o(d.data)});return()=>{a()}},[s]),i!=null&&i.summary?e.jsx(te,{...i.summary,successRate:(n=i.percentage)==null?void 0:n.correct}):e.jsx("div",{children:"wait user..."})},rn=({gamification:s,className:n,scrollStore:i,scrollNode:o,appNode:a,style:d,responsiveStore:c,headerNode:l})=>{const{tabsShown:r}=k.useStore(i,{keys:["tabsShown"]}),[p,m]=h.useState(U.HOME),[,y]=h.useTransition(),{sdkInDesktopView:x}=k.useStore(c,{keys:["sdkInDesktopView"]}),v=b=>{y(()=>{var A;m(b),x===!1&&(((A=a.current)==null?void 0:A.getBoundingClientRect().y)||0)<0&&I.C$1(a,{behavior:"instant"})})};h.useEffect(()=>i.listen(b=>{if(b.scrollPosition===0){i.setKey("tabsShown",!0);return}c.get().sdkInDesktopView?i.setKey("tabsShown",b.scrollDirection==="backward"):i.setKey("tabsShown",b.scrollDirection==="forward")}),[i,c]);let T="0px";x?T=r?"0px":"calc(8px - var(--header-height) - var(--header-offset))":T=r?"calc(var(--header-height) + var(--header-offset) - 2px)":"0px";const C=x?a:l;return e.jsxs(I.p,{className:n,style:d,children:[e.jsx(I.C,{style:{top:T},children:e.jsx(lt,{activePage:p,toggleActivePage:v})}),p===U.HOME&&e.jsxs(e.Fragment,{children:[e.jsx(I.n$1,{style:{paddingTop:"8px"},children:e.jsx(I.m,{children:e.jsx(ln,{userSummary:s.userSummary})})}),e.jsx(I.a,{style:{flex:1},children:e.jsx(an,{openQuestion:s.openQuestion,store:s.feedList.getStore()})})]}),p===U.LEADERBOARD&&e.jsx(I.l,{children:e.jsx(Nt,{renderClipBoardNode:C,scrollStore:i,scrollNode:o,gamification:s})})]})},dn=()=>I.l$1,ee=t.styled_default(dn())({name:"OpenedContainer",class:"oar61gl",propsAsIs:!0}),cn=t.styled_default("div")({name:"UserContainer",class:"u14zaal4",propsAsIs:!1}),un=({correct:s,incorrect:n})=>{const i=s+n;return i===0?0:Math.round(s/i*100)},pn=({gamification:s,scrollStore:n,className:i,appNode:o,scrollNode:a,headerNode:d,responsiveStore:c})=>{const l=k.useStore(s.openedQuestion.$store),r=k.useStore(s.openedUser),{sdkInDesktopView:p}=k.useStore(c,{keys:["sdkInDesktopView"]}),m=h.useMemo(()=>{var y;const x=(((y=o.current)==null?void 0:y.getBoundingClientRect().y)||0)<0;if(!o.current||!l&&!r)return null;const v=l?e.jsx(ee,{className:i,children:e.jsx(tt,{gamification:s})}):r?e.jsx(ee,{className:i,children:e.jsxs(cn,{children:[e.jsx(se,{label:"Friend's Rank",close:s.closeUser}),e.jsx(I.n$1,{children:e.jsx(te,{...r,successRate:un(r)})})]})}):null;return e.jsx(I.V,{container:o,useContainer:!p,fixedView:x,children:v})},[o,i,s,l,r,p]);return e.jsxs(e.Fragment,{children:[m,e.jsx(rn,{appNode:o,headerNode:d,scrollStore:n,scrollNode:a,className:i,gamification:s,responsiveStore:c})]})};exports.default=pn;
|
package/lib/cjs/index2.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),i=require("react"),O=require("./useStreamLayerApp.js");var S=(R=>(R[R.UNSET=0]="UNSET",R[R.CONNECTED=1]="CONNECTED",R[R.READY=2]="READY",R))(S||{});const d=i.createContext({status:0,sdk:null}),B=({sdkKey:R,plugins:e,children:t,production:N=!0,autoEnable:G=!0,onDeepLinkHandled:_,videoPlayerController:n})=>{const E=O.useStreamLayerApp(R,e,N,G),c=i.useMemo(()=>E?(n&&E.addVideoPlayerController(n),_&&E.addDeepLinkHandler(_),{sdk:E,status:2}):{status:1,sdk:null},[E]);return i.useEffect(()=>()=>{_&&(E==null||E.removeDeepLinkHandler(_)),n&&(E==null||E.removeVideoPlayerController(n))},[E]),s.jsx(d.Provider,{value:c,children:t})},D={BG_TRANSPARENT:"rgba(0,0,0, .8)",BG_TRANSPARENT_VOTE_CONTAINER:"rgba(10, 14, 19, 0.8)",BG_TRANSPARENT_ITEM:"rgba(0, 0, 0, 0.7)",BG_TRANSPARENT_ITEM_VOTE:"rgba(255, 255, 255, 0.1)",BG_TRANSPARENT_ITEM_SUCCESS:"rgba(0, 139, 251, 0.2)",BG_TRANSPARENT_ITEM_ERROR:"rgba(205, 37, 37, 0.2)",BG_TRANSPARENT_VOTE_PROGRESS:"rgba(255, 255, 255, 0.2)",BG_TRANSPARENT_VOTE_PROGRESS_SUCCESS:"rgba(60, 139, 251, 0.5)",BG_TRANSPARENT_VOTE_PROGRESS_ERROR:"rgba(205, 37, 37, 0.5)",BG_TRANSPARENT_ONBOARDING_INAPP:"rgba(138, 159, 182, 0.2)",LEADERBOARD_UNIT:"rgba(255, 255, 255, 0.5)",BLUE_PRIMARY:"#1589EE",RED_PRIMARY:"#CD2525",RED_SECONDARY:"#EB5757",BLUE_QUESTION_ACTION_BTN:"#1589ee",WHITE:"#FFFFFF",GREY_1:"#909395",GREY_2:"#22262b",GREY_3:"#2d3135",GREY_4:"#53565a",GREY_PRIMARY_ONBOARDING_INAPP:"#B5B7B8",BLACK_1:"#161a1f",GREEN_1:"#F7B801",RED_1:"#A30000",RED_2:"#FF4170",GREY_PRIMARY:"#909395",DIVIDER_COLOR_SECONDARY:"#53565a",GREEN_PRIMARY_BTN:"#009B77"},Y={PRIMARY_GREEN1:"#107D57",PRIMARY_GREEN2:"#006747",PRIMARY_GREEN3:"#1C4932",PRIMARY_GREEN4:"#193526",SECONDARY_RED1:"#DF2F3B",SECONDARY_RED2:"#BA0C2F",SECONDARY_RED3:"#f9d6d8",SECONDARY_YELLOW:"#fce300",SECONDARY_GREEN5:"#C0DC8F",SECONDARY_GREEN6:"#cee5de",NEUTRALS_WHITE:"#FFFFFF",NEUTRALS_GRAY1:"#F7F7F7",NEUTRALS_GRAY2:"#F2F2F1",NEUTRALS_GRAY3:"#E8E8E8",NEUTRALS_GRAY4:"#D9D9D6",NEUTRALS_GRAY5:"#B1B3B3",NEUTRALS_GRAY6:"#888B8D",NEUTRALS_GRAY7:"#6B6F73",NEUTRALS_GRAY8:"#53565A",NEUTRALS_GRAY9:"#25282A",NEUTRALS_BLACK:"#000000"},T=Object.assign({},D,Y),r={REGULAR:"'Benton Sans', BentonSans, Arial, Helvetica, sans-serif",SERIF:"'Tiempos', 'Tiempos Text', Times New Roman, serif",COLOR:"#fff",WEIGHT_DEFAULT:"500"},A={xs:324,sm:576,md:768,lg:992,xl:1215,xxl:1440},f={landscape:"landscape",portrait:"portrait"},C=Object.keys(T).reduce((R,e)=>{const t=T[e];return`
|
|
2
2
|
${R}
|
|
3
|
-
--color-${e.toLowerCase().replaceAll("_","-")}: ${
|
|
4
|
-
`},""),
|
|
3
|
+
--color-${e.toLowerCase().replaceAll("_","-")}: ${t};
|
|
4
|
+
`},""),a=R=>e=>`
|
|
5
5
|
@media only screen and (${R}) {
|
|
6
6
|
${e}
|
|
7
7
|
}
|
|
8
|
-
`,
|
|
8
|
+
`,x=(R,e)=>t=>`
|
|
9
9
|
@media only screen and (${R}) and (${e}) {
|
|
10
|
-
${
|
|
10
|
+
${t}
|
|
11
11
|
}
|
|
12
|
-
`,o={up:R=>{const e=
|
|
12
|
+
`,o={up:R=>{const e=A[R];return a(`min-width: ${e}px`)},down:R=>{const e=A[R]-1;return a(`max-width: ${e}px`)},intermediate:(R,e)=>{const t=A[R]-1,N=A[e];return x(`max-width: ${t}px`,`min-width: ${N}px`)},orientation:R=>{const e=f[R];return a(`orientation: ${e}`)}};`${C}${r.REGULAR}${r.REGULAR}${r.COLOR}${r.SERIF}${r.WEIGHT_DEFAULT}${o.down("xl")`
|
|
13
13
|
--header-offset: 56px;
|
|
14
14
|
`}${o.intermediate("xl","lg")`
|
|
15
15
|
--header-offset: 76px;
|
|
16
|
-
`}`;const
|
|
16
|
+
`}`;const l="StreamLayerCSSReset",u="ttkj0ah",F=({children:R,style:e})=>s.jsx("div",{className:"StreamLayerSDKTheme",children:s.jsx("div",{className:u,style:e,children:R})});exports.E=T;exports.O=A;exports.StreamLayerContext=d;exports.StreamLayerProvider=B;exports.StreamLayerStatus=S;exports.m=l;exports.p=F;
|