@britannica/quiz-components
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0-beta.7
@@ -44,5 +44,9 @@ export declare enum Template { | ||
} | ||
export interface UserPercentile { | ||
userId: string; | ||
scorePercentile: number; | ||
} | ||
export interface LeaderboardServiceUser { | ||
userId: string; | ||
rank?: number; | ||
rank: number; | ||
maxScore: number; | ||
@@ -52,3 +56,3 @@ } | ||
id: string; | ||
rank?: number; | ||
rank: number; | ||
name: string; | ||
@@ -55,0 +59,0 @@ score: number; |
@@ -10,5 +10,5 @@ import { type FC } from 'react'; | ||
user?: User; | ||
onLeaderboardResults: (leaderboardUsers: LeaderboardServiceUser[]) => LeaderboardQuizResults[]; | ||
onLeaderboardResults: (leaderboardUsers: LeaderboardServiceUser[]) => Promise<LeaderboardQuizResults[]>; | ||
} | ||
declare const Quiz: FC<QuizProps>; | ||
export default Quiz; |
@@ -12,2 +12,4 @@ import { ElementType, FC, HTMLAttributes, ReactElement } from 'react'; | ||
shadow?: boolean; | ||
shadowSm?: boolean; | ||
superButton?: boolean; | ||
tag?: ElementType; | ||
@@ -14,0 +16,0 @@ [prop: string]: any; |
@@ -10,7 +10,8 @@ import { FC, HTMLAttributes } from 'react'; | ||
export interface LeaderboardProps extends HTMLAttributes<HTMLElement> { | ||
className?: string; | ||
newScore: number; | ||
items: Array<LeaderboardItem>; | ||
user?: User; | ||
user?: User | undefined | null; | ||
} | ||
declare const Leaderboard: FC<LeaderboardProps>; | ||
export default Leaderboard; |
import { FC } from 'react'; | ||
export interface LeaderboardTabProps { | ||
onRestartQuiz: () => void; | ||
} | ||
declare const LeaderboardTab: FC<LeaderboardTabProps>; | ||
export default LeaderboardTab; |
import { type FC } from 'react'; | ||
export interface ScoreTabProps { | ||
onRestartQuiz: () => void; | ||
} | ||
declare const ScoreTab: FC<ScoreTabProps>; | ||
export default ScoreTab; |
@@ -14,5 +14,5 @@ import { FC, LegacyRef } from 'react'; | ||
timerScore?: number; | ||
onTimerExpire?: Function; | ||
onTimerExpire?: () => void; | ||
} | ||
declare const StatusBar: FC<StatusBarProps>; | ||
export default StatusBar; |
@@ -23,5 +23,5 @@ import { FC, HTMLAttributes, LegacyRef } from 'react'; | ||
theme: TimerTheme; | ||
onExpire?: Function; | ||
onExpire?: () => void; | ||
} | ||
declare const Timer: FC<TimerProps>; | ||
export default Timer; |
@@ -8,6 +8,8 @@ import React, { Dispatch, FC, HTMLAttributes } from 'react'; | ||
restarted: boolean; | ||
score: number; | ||
totalCorrectScore: number; | ||
totalScore: number; | ||
totalTimerScore: number; | ||
timerEnabled: boolean; | ||
user?: User | null; | ||
getLeaderboardResults: (leaderboardUsers: LeaderboardServiceUser[]) => LeaderboardQuizResults[]; | ||
getLeaderboardResults: (leaderboardUsers: LeaderboardServiceUser[]) => Promise<LeaderboardQuizResults[]>; | ||
dispatch: Dispatch<QuizStateAction>; | ||
@@ -21,8 +23,10 @@ } | ||
SetRestarted = 3, | ||
SetScore = 4, | ||
SetTimerEnabled = 5 | ||
setTotalCorrectScore = 4, | ||
SetTotalScore = 5, | ||
setTotalTimerScore = 6, | ||
SetTimerEnabled = 7 | ||
} | ||
interface QuizStateAction { | ||
type: QuizStateActionType; | ||
payload: any; | ||
payload?: any; | ||
} | ||
@@ -33,3 +37,3 @@ export declare const QuizStateContext: React.Context<IQuizState>; | ||
user?: User | null; | ||
getLeaderboardResults: (leaderboardUsers: LeaderboardServiceUser[]) => LeaderboardQuizResults[]; | ||
getLeaderboardResults: (leaderboardUsers: LeaderboardServiceUser[]) => Promise<LeaderboardQuizResults[]>; | ||
}; | ||
@@ -36,0 +40,0 @@ } |
import { type LeaderboardQuizResults } from '../common/types'; | ||
export declare function useLeaderboardService(): { | ||
leaderboardResults: LeaderboardQuizResults[] | undefined; | ||
getLeaderboardResults: () => Promise<void>; | ||
getLeaderboardResults: (limit?: number) => Promise<void>; | ||
getUserPercentile: (userId: string) => Promise<void>; | ||
getUserRankResults: (userId: string, neighbors?: number) => Promise<void>; | ||
saveUserScore: (userId: string) => Promise<void>; | ||
leaderboardResults: LeaderboardQuizResults[] | null; | ||
leaderboardResultsError: boolean; | ||
leaderboardResultsLoading: boolean; | ||
userPercentile: number | null; | ||
userRankResults: LeaderboardQuizResults[] | null; | ||
userRankResultsError: boolean; | ||
userRankResultsLoading: boolean; | ||
}; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("deepmerge"),t=require("react"),r=require("react-router-dom"),a=require("classnames"),n=require("react-responsive");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(e),c=o(t),s=o(a),i=t.createContext({}),d=i.Provider,u=function(){return u=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},u.apply(this,arguments)};function f(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r}function m(e,t,r,a){return new(r||(r=Promise))((function(n,o){function l(e){try{s(a.next(e))}catch(e){o(e)}}function c(e){try{s(a.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(l,c)}s((a=a.apply(e,t||[])).next())}))}function p(e,t){var r,a,n,o,l={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;l;)try{if(r=1,a&&(n=2&o[0]?a.return:o[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,o[1])).done)return n;switch(a=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return l.label++,{value:o[1],done:!1};case 5:l.label++,a=o[1],o=[0];continue;case 7:o=l.ops.pop(),l.trys.pop();continue;default:if(!(n=l.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){l=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){l.label=o[1];break}if(6===o[0]&&l.label<n[1]){l.label=n[1],n=o;break}if(n&&l.label<n[2]){l.label=n[2],l.ops.push(o);break}n[2]&&l.ops.pop(),l.trys.pop();continue}o=t.call(e,l)}catch(e){o=[6,e],a=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function b(e,t,r){if(r||2===arguments.length)for(var a,n=0,o=t.length;n<o;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var v,h={responseIndexes:[],correctResponses:0,currentQuestionIndex:0,restarted:!1,score:0,timerEnabled:!0,user:null,getLeaderboardResults:function(){return[]},dispatch:function(){}};function y(e,t){switch(t.type){case v.SetCorrectIndexes:return u(u({},e),{responseIndexes:t.payload});case v.SetCorrectResponses:return u(u({},e),{correctResponses:t.payload});case v.setCurrentQuestionIndex:return u(u({},e),{currentQuestionIndex:t.payload});case v.SetRestarted:return u(u({},e),{restarted:t.payload});case v.SetScore:return u(u({},e),{score:t.payload});case v.SetTimerEnabled:return u(u({},e),{timerEnabled:t.payload});default:throw new Error("Please make sure to use the right action type reducer.")}}!function(e){e[e.SetCorrectIndexes=0]="SetCorrectIndexes",e[e.SetCorrectResponses=1]="SetCorrectResponses",e[e.setCurrentQuestionIndex=2]="setCurrentQuestionIndex",e[e.SetRestarted=3]="SetRestarted",e[e.SetScore=4]="SetScore",e[e.SetTimerEnabled=5]="SetTimerEnabled"}(v||(v={}));var x,E,g=t.createContext(h),w=function(e){var r=e.children,a=e.value,n=t.useReducer(y,h),o=n[0],l=n[1];return c.default.createElement(g.Provider,{value:u(u(u({},o),a),{dispatch:l})},r)},S={quizContainer:"eb-16RLBn"},N=t.createContext(S),I=N.Provider;function _(){var e=t.useState(!1),r=e[0],a=e[1];return t.useEffect((function(){void 0!==window.gtag&&a(!0)}),[]),{event:t.useCallback((function(e,t){r&&window.gtag("event",e,t)}),[r])}}function O(){return t.useContext(i)}function C(){return t.useContext(g)}exports.Template=void 0,(x=exports.Template||(exports.Template={})).TextMultipleChoice="TEXT_MULTIPLE_CHOICE",x.ImageMultipleChoice="IMAGE_MULTIPLE_CHOICE",exports.Breakpoint=void 0,(E=exports.Breakpoint||(exports.Breakpoint={}))[E.XsMin=0]="XsMin",E[E.XsMax=671]="XsMax",E[E.SmMin=672]="SmMin",E[E.SmMax=959]="SmMax",E[E.MdMin=960]="MdMin",E[E.MdMax=1247]="MdMax",E[E.LgMin=1248]="LgMin",E[E.LgMax=1399]="LgMax",E[E.XlMin=1400]="XlMin";var j={Box:"eb-ASYLqS",snowBackground:"eb-ZLkp2m",whiteBackground:"eb-DGfpHy",iceBackground:"eb-Nvt3tb",rainBorder:"eb-cMrTGF",grayBorder:"eb-94S9mY",rounded:"eb-GHgeM2",shadow:"eb-PiP0Bt"},k=function(e){var t,r,a=e.children,n=e.className,o=e.backgroundColor,l=void 0===o?"white":o,i=e.borderColor,d=void 0===i?"gray":i,m=e.rounded,p=void 0!==m&&m,b=e.shadow,v=void 0!==b&&b,h=f(e,["children","className","backgroundColor","borderColor","rounded","shadow"]);return c.default.createElement("div",u({className:s.default(j.Box,(t={},t[j.rounded]=p,t),(r={},r[j.shadow]=v,r),j["".concat(l,"Background")],j["".concat(d,"Border")],n),"data-testid":"Box"},h),a)},T=t.lazy((function(){return Promise.resolve().then((function(){return ut}))})),P=function(e){return c.default.createElement(t.Suspense,{fallback:null},c.default.createElement(T,u({},e)))},R=t.lazy((function(){return Promise.resolve().then((function(){return It}))})),M=function(e){return c.default.createElement(t.Suspense,{fallback:null},c.default.createElement(R,u({},e)))},L=t.lazy((function(){return Promise.resolve().then((function(){return hr}))})),z=function(e){return c.default.createElement(t.Suspense,{fallback:null},c.default.createElement(L,u({},e)))},q=function(){return c.default.createElement(r.MemoryRouter,null,c.default.createElement(r.Routes,null,c.default.createElement(r.Route,{path:"/",element:c.default.createElement(M,null)}),c.default.createElement(r.Route,{path:"/:questionId",element:c.default.createElement(z,null)}),c.default.createElement(r.Route,{path:"/results",element:c.default.createElement(P,null)})))},V=function(e){var r=e.template,a=t.useContext(N).quizContainer,n=_().event,o=O(),l=o.id,s=o.questions,i=o.type,d=C(),u=d.correctResponses,f=d.restarted,m=d.responseIndexes;return t.useEffect((function(){function e(){m.length<s.length&&n("quiz_abandoned",{quiz_id:l,questions_answered:m.length,restarted:f,correct_responses:u,quiz_type:i.toString(),total_questions:s.length})}return window.addEventListener("beforeunload",e),function(){return window.removeEventListener("beforeunload",e)}}),[l,m,u,s.length,n,f,i]),c.default.createElement(k,{className:a,borderColor:"rain",rounded:!0,"data-testid":"TemplateLoader"},r===exports.Template.TextMultipleChoice&&c.default.createElement(q,null))},A=function(e){var t=e.data,r=e.template,a=e.theme,n=void 0===a?{}:a,o=e.user,s=e.onLeaderboardResults;return c.default.createElement(I,{value:l.default(S,n)},c.default.createElement(d,{value:t},c.default.createElement(w,{value:{getLeaderboardResults:s,user:o}},c.default.createElement(V,{template:r}))))},B="eb-6lGJ0X",H="eb-hAkxpo",G="eb-HLIy3V",F="eb-VsNFkm",Q="eb-6nDHds",D="eb-DBAmCC",W="eb-HjILKR",X=function(){var e=O().questions,t=C().responseIndexes;return c.default.createElement("div",{className:B,"data-testid":"AnswersTab"},e.map((function(e,r){var a=e.text,n=e.answers,o=e.correctAnswerIndex,l=e.explanation;return c.default.createElement("div",{className:s.default(H,"mb-32"),key:a},c.default.createElement("div",{className:G},r+1),c.default.createElement("div",{className:s.default(F,"font-weight-semi-bold"),dangerouslySetInnerHTML:{__html:a}}),c.default.createElement("div",{className:Q},c.default.createElement("div",{className:s.default(o===t[r]?W:D)},"Your Answer: ",n[t[r]]),c.default.createElement("div",null,"Correct Answer: ",n[o]),c.default.createElement("div",{className:"mt-16",dangerouslySetInnerHTML:{__html:l}})))})))};var U="eb-KmoX7Q",Z="eb-z33RWL",K="eb-Hq5iFO",Y=function(){var e=function(){var e=O(),r=e.metadata,a=e.id,n=C().getLeaderboardResults,o=t.useState(),l=o[0],c=o[1];return{leaderboardResults:l,getLeaderboardResults:function(){return m(this,void 0,void 0,(function(){var e,t;return p(this,(function(o){switch(o.label){case 0:return[4,fetch("".concat("https://9zdy2kcoy6.execute-api.us-east-1.amazonaws.com","/dev/leaderboard?appId=").concat(r.source,"&quizId=").concat(a))];case 1:return[4,o.sent().json()];case 2:return e=o.sent(),[4,n(e)];case 3:return t=o.sent(),c(t),[2]}}))}))}}}(),r=e.leaderboardResults,a=e.getLeaderboardResults;return t.useEffect((function(){a()}),[]),console.log(r),c.default.createElement("div",{className:K,"data-testid":"LeaderboardTab"},c.default.createElement(k,{className:U,backgroundColor:"snow",borderColor:"rain",rounded:!0},"All Quizzes",null==r?void 0:r.map((function(e){return c.default.createElement("div",{key:e.id},e.score)}))),c.default.createElement(k,{className:Z,backgroundColor:"white",borderColor:"rain",rounded:!0},"This Quiz"))},J="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})})),r}var ee,te={},re={exports:{}},ae={};function ne(){if(ee)return ae;ee=1;var e=c.default,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function l(e,r,l){var c,s={},i=null,d=null;for(c in void 0!==l&&(i=""+l),void 0!==r.key&&(i=""+r.key),void 0!==r.ref&&(d=r.ref),r)a.call(r,c)&&!o.hasOwnProperty(c)&&(s[c]=r[c]);if(e&&e.defaultProps)for(c in r=e.defaultProps)void 0===s[c]&&(s[c]=r[c]);return{$$typeof:t,type:e,key:i,ref:d,props:s,_owner:n.current}}return ae.Fragment=r,ae.jsx=l,ae.jsxs=l,ae}function oe(e,t){if(!t)return e;var r=Object.prototype.hasOwnProperty;return Object.keys(t).reduce((function(a,n){return r.call(t,n)&&t[n]&&(a="".concat(a," ").concat(e,"--").concat(n)),a}),e)}function le(e){return function(t,r){return t?"string"!=typeof t?oe(e,t):oe("".concat(e,"__").concat(t),r):e}}re.exports=ne();var ce=function(){return ce=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},ce.apply(this,arguments)},se=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},ie=le("rmd-icon"),de=t.forwardRef((function(e,t){var r=e.className,a=e.children,n=e["aria-hidden"],o=void 0===n||n,l=e.dense,c=void 0!==l&&l,i=e.iconClassName,d=void 0===i?"material-icons":i,u=e.forceSize,f=void 0!==u&&u,m=e.forceFontSize,p=void 0!==m&&m,b=se(e,["className","children","aria-hidden","dense","iconClassName","forceSize","forceFontSize"]);return re.exports.jsx("i",ce({},b,{"aria-hidden":o,ref:t,className:s.default(ie({font:!0,dense:c,"forced-font":p,"forced-size":f}),d,r)},{children:a}))})),ue=function(){return ue=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},ue.apply(this,arguments)},fe=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},me=le("rmd-icon"),pe=t.forwardRef((function(e,t){var r=e["aria-hidden"],a=void 0===r||r,n=e.focusable,o=void 0===n?"false":n,l=e.xmlns,c=void 0===l?"http://www.w3.org/2000/svg":l,i=e.viewBox,d=void 0===i?"0 0 24 24":i,u=e.dense,f=void 0!==u&&u,m=e.className,p=e.use,b=e.children,v=fe(e,["aria-hidden","focusable","xmlns","viewBox","dense","className","use","children"]),h=b;return!h&&p&&(h=re.exports.jsx("use",{xlinkHref:p})),re.exports.jsx("svg",ue({},v,{"aria-hidden":a,ref:t,className:s.default(me({svg:!0,dense:f}),m),focusable:o,xmlns:c,viewBox:d},{children:h}))})),be=function(){return be=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},be.apply(this,arguments)};var ve=function(){return ve=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},ve.apply(this,arguments)},he=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},ye=le("rmd-icon-rotator"),xe=t.forwardRef((function(e,r){var a=e.style,n=e.className,o=e.animate,l=void 0===o||o,c=e.rotated,i=e.children,d=e.forceIconWrap,u=void 0!==d&&d,f=he(e,["style","className","animate","rotated","children","forceIconWrap"]),m=s.default(ye({animate:l,rotated:c}),n);if(!u&&t.isValidElement(i)){var p=t.Children.only(i);return t.cloneElement(p,{className:s.default(m,p.props.className)})}return re.exports.jsx("span",ve({},f,{style:a,className:m,ref:r},{children:i}))})),Ee=function(){return Ee=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Ee.apply(this,arguments)},ge={back:re.exports.jsx(de,{children:"keyboard_arrow_left"}),checkbox:re.exports.jsx(de,{children:"check_box"}),upload:re.exports.jsx(de,{children:"file_upload"}),dropdown:re.exports.jsx(de,{children:"arrow_drop_down"}),error:re.exports.jsx(de,{children:"error_outline"}),expander:re.exports.jsx(de,{children:"keyboard_arrow_down"}),forward:re.exports.jsx(de,{children:"keyboard_arrow_right"}),menu:re.exports.jsx(de,{children:"menu"}),notification:re.exports.jsx(de,{children:"notifications"}),password:re.exports.jsx(de,{children:"remove_red_eye"}),radio:re.exports.jsx(de,{children:"radio_button_checked"}),selected:re.exports.jsx(de,{children:"check"}),sort:re.exports.jsx(de,{children:"arrow_upward"})},we=t.createContext(ge),Se=we.Provider;var Ne=$(Object.freeze({__proto__:null,FontIcon:de,SVGIcon:pe,TextIconSpacing:function(e){var r,a=e.className,n=e.icon,o=e.children,l=void 0===o?null:o,c=e.stacked,i=void 0!==c&&c,d=e.iconAfter,u=void 0!==d&&d,f=e.flexReverse,m=void 0!==f&&f,p=e.forceIconWrap,b=void 0!==p&&p,v=e.beforeClassName,h=void 0===v?"rmd-icon--before":v,y=e.afterClassName,x=void 0===y?"rmd-icon--after":y,E=e.aboveClassName,g=void 0===E?"rmd-icon--above":E,w=e.belowClassName,S=void 0===w?"rmd-icon--below":w;if(!n)return re.exports.jsx(re.exports.Fragment,{children:l});var N=m?!u:u,I=s.default(((r={})[h]=!i&&!N,r[x]=!i&&N,r[g]=i&&!N,r[S]=i&&N,r),a),_=n,O=l;if(!b&&t.isValidElement(n)){var C=t.Children.only(n);_=t.cloneElement(C,{className:s.default(I,C.props.className)})}else n&&(_=re.exports.jsx("span",be({className:s.default("rmd-text-icon-spacing",I)},{children:n})));return _&&(O=re.exports.jsxs(re.exports.Fragment,{children:[!u&&_,l,u&&_]})),re.exports.jsx(re.exports.Fragment,{children:O})},IconRotator:xe,useIcon:function(e,r){var a=t.useContext(we);return void 0!==r?r:a[e]},IconProvider:function(e){var r=e.children,a=e.back,n=void 0===a?ge.back:a,o=e.checkbox,l=void 0===o?ge.checkbox:o,c=e.dropdown,s=void 0===c?ge.dropdown:c,i=e.expander,d=void 0===i?ge.expander:i,u=e.error,f=void 0===u?ge.error:u,m=e.forward,p=void 0===m?ge.forward:m,b=e.menu,v=void 0===b?ge.menu:b,h=e.notification,y=void 0===h?ge.notification:h,x=e.password,E=void 0===x?ge.password:x,g=e.radio,w=void 0===g?ge.radio:g,S=e.selected,N=void 0===S?ge.selected:S,I=e.sort,_=void 0===I?ge.sort:I,O=e.upload,C=void 0===O?ge.upload:O,j=t.useMemo((function(){return{back:n,checkbox:l,dropdown:s,error:f,expander:d,forward:p,menu:v,notification:y,password:E,radio:w,selected:N,sort:_,upload:C}}),[n,l,s,f,d,p,v,y,E,w,N,_,C]);return re.exports.jsx(Se,Ee({value:j},{children:r}))}})),Ie=J&&J.__assign||function(){return Ie=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Ie.apply(this,arguments)};Object.defineProperty(te,"__esModule",{value:!0});var _e=te.ReplaySVGIcon=void 0,Oe=re.exports,Ce=c.default,je=Ne;_e=te.ReplaySVGIcon=(0,Ce.forwardRef)((function(e,t){return(0,Oe.jsx)(je.SVGIcon,Ie({},e,{ref:t},{children:(0,Oe.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"})}))}));var ke,Te="eb-h0JoJS",Pe="eb-g0oWRe",Re="eb-cDH2ZZ",Me="eb-PMfRkP",Le="eb-6MTWIi",ze="eb-P5IGFV",qe="eb-R87VrN";!function(e){e.Left="left",e.Right="right"}(ke||(ke={}));var Ve,Ae=function(e){var r,a,n,o,l=e.block,i=void 0!==l&&l,d=e.children,m=e.className,p=e.icon,b=e.iconPosition,v=void 0===b?ke.Left:b,h=e.outline,y=void 0!==h&&h,x=e.shadow,E=void 0!==x&&x,g=e.tag,w=void 0===g?"button":g,S=f(e,["block","children","className","icon","iconPosition","outline","shadow","tag"]);return c.default.createElement(w,u({className:s.default(Te,(r={},r[Pe]=i,r),(a={},a[Me]=p,a),(n={},n[Re]=y,n),(o={},o[qe]=E,o),m),"data-testid":"Button"},S),v===ke.Left&&p&&t.cloneElement(p,{className:s.default(p.props.className,Le)}),d,v===ke.Right&&p&&t.cloneElement(p,{className:s.default(p.props.className,ze)}))},Be=function(){var e=O().nextUpQuiz,t=e.image,r=e.url,a=e.title;return c.default.createElement(k,{borderColor:"rain",className:"mt-20","data-testid":"NextUpQuizCard",rounded:!0,shadow:!0},c.default.createElement("div",{style:{aspectRatio:"4/3"}},c.default.createElement("img",{src:t.fullUrl,alt:t.altText})),c.default.createElement("div",{className:"p-20"},c.default.createElement("a",{href:r},a),c.default.createElement(Ae,{tag:"a",href:r,className:"mt-20",block:!0},"Play")))},He="eb-fQMdMF",Ge="eb-i8uKTc",Fe="eb-ZBrDqu",Qe="eb-FOeG4W",De="eb-fQceh4",We="eb-vzHSa2",Xe="eb-sS9sRH",Ue=function(){var e=C(),t=e.correctResponses,r=e.score,a=O().questions,n=t/a.length*100;return c.default.createElement("div",{className:He,"data-testid":"ScoreSummaryWheel"},c.default.createElement("div",{className:s.default(De,"px-12 py-8 font-weight-semi-bold")},"Congrats!"),c.default.createElement("svg",{viewBox:"0 0 36 36",className:Ge},c.default.createElement("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",className:Qe}),c.default.createElement("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",className:Fe,strokeDasharray:"".concat(n," 100")})),c.default.createElement("div",{className:s.default(We,"text-center")},c.default.createElement("div",{className:s.default(Xe,"font-weight-super-bold")},t,"/",a.length),c.default.createElement("div",{className:"font-12"},r," points")))},Ze="eb-od4oX9",Ke="eb-F71AtK",Ye="eb-EM5HVl",Je="eb-yx3D4X",$e=function(){var e=n.useMediaQuery({maxWidth:exports.Breakpoint.XsMax}),t=O().title,a=r.useNavigate(),o=C().dispatch;return c.default.createElement("div",{"data-testid":"ScoreTab",className:Ze},c.default.createElement(k,{className:Ke,borderColor:"rain",backgroundColor:"ice",rounded:!e,shadow:!e},c.default.createElement("div",{className:Ye},c.default.createElement("div",{className:"font-18 font-weight-semi-bold"},t),c.default.createElement(Ue,null),c.default.createElement(Ae,{icon:c.default.createElement(_e,null),onClick:function(){o({type:v.SetScore,payload:0}),o({type:v.SetCorrectIndexes,payload:[]}),o({type:v.SetCorrectResponses,payload:0}),o({type:v.setCurrentQuestionIndex,payload:0}),o({type:v.SetRestarted,payload:!0}),a("/")},outline:!0,shadow:!0},"Play Again")),c.default.createElement("div",{className:Je},c.default.createElement("div",{className:"font-weight-extra-bold font-24"},"Next Up!"),c.default.createElement(Be,null))))},et={activeTabId:"default",setActiveTabId:function(){}},tt=t.createContext(et),rt=function(e){var r=e.children,a=e.defaultActiveTabId,n=t.useState(a),o=n[0],l=n[1];return c.default.createElement(tt.Provider,{value:{activeTabId:o,setActiveTabId:l}},r)},at="eb-fkZcg2",nt="eb-ntGIO4",ot=function(e){var r,a=e.children,n=e.className,o=e.controlFor,l=t.useContext(tt),i=l.setActiveTabId,d=l.activeTabId===o;return c.default.createElement("button",{className:s.default(at,(r={},r[nt]=d,r),n),"data-testid":"Tab",id:"".concat(o,"-tab"),role:"tab","aria-controls":o,"aria-selected":d,tabIndex:d?void 0:-1,onClick:function(){return i(o)}},a)},lt=function(e){var r=e.children,a=e.className,n=e.id,o=f(e,["children","className","id"]);return n===t.useContext(tt).activeTabId?c.default.createElement("div",u({id:n,className:a,"data-testid":"TabContent",tabIndex:0,role:"tabpanel","aria-labelledby":"".concat(n,"-tab")},o),r):null},ct="eb-ftdu2H",st=function(e){var t=e.children,r=e.className,a=e.label;return c.default.createElement("div",{className:s.default(ct,r),"data-testid":"Tabs",role:"tablist","aria-label":a},t)},it="eb-vDPeCr",dt="eb-bMiWKa";!function(e){e.AnswersTab="AnswersTab",e.LeaderboardTab="LeaderboardTab",e.ScoreTab="ScoreTab"}(Ve||(Ve={}));var ut=Object.freeze({__proto__:null,default:function(){var e=O().image;return c.default.createElement("div",{"data-testid":"ResultsView",className:it,style:{backgroundImage:"url(".concat(e.fullUrl,")")}},c.default.createElement(rt,{defaultActiveTabId:Ve.ScoreTab},c.default.createElement(st,{label:"Results View"},c.default.createElement(ot,{controlFor:Ve.ScoreTab},"Score"),c.default.createElement(ot,{controlFor:Ve.AnswersTab},"Answers"),c.default.createElement(ot,{controlFor:Ve.LeaderboardTab},"Leaderboard")),c.default.createElement(lt,{className:dt,id:Ve.ScoreTab},c.default.createElement($e,null)),c.default.createElement(lt,{className:dt,id:Ve.AnswersTab},c.default.createElement(X,null)),c.default.createElement(lt,{className:dt,id:Ve.LeaderboardTab},c.default.createElement(Y,null))))}}),ft="eb-8LB0Z6",mt="eb-xrnrMX",pt="eb-uQ6x3r",bt="eb-RTZJDf",vt="eb-XBUSmk",ht="eb-6uIIpF",yt="eb-WrBwzW",xt="eb-LlKpPo",Et=function(e){var t,r=e.children,a=e.className,n=e.bgColor,o=void 0===n?void 0:n,l=e.outline;return c.default.createElement("div",{className:s.default(yt,(t={},t[xt]=l,t),a),style:{backgroundColor:o},"data-testid":"Badge"},r)},gt="eb-FGnvGm",wt=function(e){var t=e.children;return c.default.createElement("div",{className:gt,"data-testid":"SwitchControl"},t)},St="eb-FxfgLd",Nt=function(e){var t=e.id,r=f(e,["id"]);return c.default.createElement("input",u({id:t,className:St,type:"checkbox",role:"switch"},r))},It=Object.freeze({__proto__:null,default:function(){var e=O(),t=e.id,a=e.categories,n=e.image,o=e.title,l=e.timed,i=e.questions,d=C(),u=d.dispatch,f=d.timerEnabled;return c.default.createElement("div",{className:ft,"data-testid":"IntroView",style:{aspectRatio:"900 / 675"}},c.default.createElement("img",{className:mt,src:n.fullUrl,alt:n.altText}),c.default.createElement("div",{className:pt},c.default.createElement(k,{className:vt,rounded:!0,shadow:!0},c.default.createElement("div",{className:bt},c.default.createElement(Et,{bgColor:"var(--qc-ice)",outline:!0},a[0].label)),c.default.createElement("h1",null,o),c.default.createElement(Ae,{tag:r.Link,to:"/".concat(t),block:!0},"Start"),c.default.createElement("div",{className:s.default(ht,"pt-16")},c.default.createElement("div",null,i.length," Questions"),l&&c.default.createElement(wt,null,c.default.createElement("label",{htmlFor:"toggle"},"Timer on"),c.default.createElement(Nt,{id:"".concat(t),defaultChecked:f,onClick:function(){return u({type:v.SetTimerEnabled,payload:!f})}}))))))}}),_t={},Ot=J&&J.__assign||function(){return Ot=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Ot.apply(this,arguments)};Object.defineProperty(_t,"__esModule",{value:!0});var Ct=_t.ArrowForwardSVGIcon=void 0,jt=re.exports,kt=c.default,Tt=Ne;Ct=_t.ArrowForwardSVGIcon=(0,kt.forwardRef)((function(e,t){return(0,jt.jsx)(Tt.SVGIcon,Ot({},e,{ref:t},{children:(0,jt.jsx)("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})}))}));var Pt={},Rt=J&&J.__assign||function(){return Rt=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Rt.apply(this,arguments)};Object.defineProperty(Pt,"__esModule",{value:!0});var Mt=Pt.CloseSVGIcon=void 0,Lt=re.exports,zt=c.default,qt=Ne;Mt=Pt.CloseSVGIcon=(0,zt.forwardRef)((function(e,t){return(0,Lt.jsx)(qt.SVGIcon,Rt({},e,{ref:t},{children:(0,Lt.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}));var Vt={},At=J&&J.__assign||function(){return At=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},At.apply(this,arguments)};Object.defineProperty(Vt,"__esModule",{value:!0});var Bt=Vt.CheckSVGIcon=void 0,Ht=re.exports,Gt=c.default,Ft=Ne;Bt=Vt.CheckSVGIcon=(0,Gt.forwardRef)((function(e,t){return(0,Ht.jsx)(Ft.SVGIcon,At({},e,{ref:t},{children:(0,Ht.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})}))}));var Qt,Dt={answerButtonContainer:"eb-hm0P2D",answerButton:"eb-EkupIl",selected:"eb-p8ZbDY",correct:"eb-5WC5qo",correctSelected:"eb-Z1YT6r",incorrectSelected:"eb-V0bjjy",disabled:"eb-N51x3L",default:"eb-e7y9O4",icon:"eb-8I8Gjv",correctIcon:"eb-NVqaa3",incorrectIcon:"eb-5sHpoZ"};!function(e){e.Correct="correct",e.CorrectSelected="correctSelected",e.Default="default",e.IncorrectSelected="incorrectSelected",e.Selected="selected"}(Qt||(Qt={}));var Wt=function(e){var t,r=e.children,a=e.status,n=void 0===a?Qt.Default:a,o=e.disabled,l=f(e,["children","status","disabled"]);return c.default.createElement("div",{className:Dt.answerButtonContainer},Qt.CorrectSelected===n&&c.default.createElement(Bt,{className:s.default(Dt.icon,Dt.correctIcon,"font-12 p-4")}),Qt.IncorrectSelected===n&&c.default.createElement(Mt,{className:s.default(Dt.icon,Dt.incorrectIcon,"font-12 p-4")}),c.default.createElement(Ae,u({className:s.default(Dt.answerButton,n&&Dt[n],(t={},t[Dt.disabled]=o,t)),outline:!0,block:!0,disabled:o},l),r))},Xt={},Ut=J&&J.__assign||function(){return Ut=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Ut.apply(this,arguments)};Object.defineProperty(Xt,"__esModule",{value:!0});var Zt=Xt.LightbulbOutlineSVGIcon=void 0,Kt=re.exports,Yt=c.default,Jt=Ne;Zt=Xt.LightbulbOutlineSVGIcon=(0,Yt.forwardRef)((function(e,t){return(0,Kt.jsx)(Jt.SVGIcon,Ut({},e,{ref:t},{children:(0,Kt.jsx)("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"})}))}));var $t,er,tr,rr="eb-dV9X8L",ar=function(e){var t=e.className,r=e.explanation;return c.default.createElement("div",{className:s.default(rr,t),"data-testid":"Explanation"},c.default.createElement(Zt,{className:"mr-8"})," ",c.default.createElement("span",{className:"m-0",dangerouslySetInnerHTML:{__html:r}}))},nr="eb-fKHH4k",or="eb-Ka5TRS",lr="eb-eQLIHc",cr="eb-YcibRH",sr="eb-pAHhPN";!function(e){e.Play="play",e.Pause="pause",e.Stop="stop"}($t||($t={})),function(e){e.Correct="var(--qc-green)",e.Incorrect="var(--qc-red)",e.Default="var(--qc-blue-200)"}(er||(er={})),function(e){e.Left="left",e.Right="right"}(tr||(tr={}));var ir=function(e){var r=e.labelMessage,a=e.labelPosition,n=void 0===a?tr.Left:a,o=e.onExpire,l=e.status,s=e.theme,i=void 0===s?er.Default:s,d=e.time,u=void 0===d?15:d,f=e.timerRef,m=t.useState(u),p=m[0],b=m[1],v=t.useState(!1),h=v[0],y=v[1],x=t.useRef(0);function E(){clearInterval(x.current)}return t.useEffect((function(){return l===$t.Play&&function(){0===p&&b(u);x.current=window.setInterval((function(){return b((function(e){return e-1}))}),1e3)}(),l===$t.Stop&&(clearInterval(x.current),b(u)),l===$t.Pause&&E(),function(){clearInterval(x.current),y(!1)}}),[l]),t.useEffect((function(){0===p&&(E(),y(!0),o&&o())}),[p]),c.default.createElement("div",{className:nr,"data-testid":"Timer"},n===tr.Left&&c.default.createElement("div",{className:cr},!p&&c.default.createElement(Et,{bgColor:er.Incorrect},"Time's Up!"),r&&!!p&&c.default.createElement(Et,{bgColor:i},r)),c.default.createElement("div",{className:or},c.default.createElement("svg",null,c.default.createElement("circle",{cx:"23",cy:"23",r:"23",style:{stroke:h?er.Incorrect:"var(--qc-rain)"}}),c.default.createElement("circle",{cx:"23",cy:"23",r:"23",style:{stroke:i,strokeDashoffset:145-145*p/u}})),c.default.createElement("p",{ref:f,className:lr},p)),n===tr.Right&&c.default.createElement("div",{className:sr},!p&&c.default.createElement(Et,{bgColor:er.Incorrect},"Time's Up!"),r&&!!p&&c.default.createElement(Et,{bgColor:i},r)))},dr="eb-db86L8",ur="eb-fl8Stz",fr="eb-MbWQdV",mr=function(e){var t=e.title,r=e.timerEnabled,a=void 0===r||r,o=e.timerRef,l=e.timerScore,i=e.timerStatus,d=void 0===i?$t.Stop:i,u=e.timerTheme,f=void 0===u?er.Default:u,m=e.timerTime,p=void 0===m?15:m,b=e.onTimerExpire,v=e.totalScore,h=void 0===v?0:v,y=e.currentCount,x=void 0===y?0:y,E=e.totalCount,g=void 0===E?0:E,w=n.useMediaQuery({maxWidth:exports.Breakpoint.MdMin});return c.default.createElement("div",{className:s.default(dr,"p-4")},c.default.createElement("span",{className:s.default(fr,"pl-16")},t),c.default.createElement("div",{className:s.default(ur,"px-16")},a&&c.default.createElement(ir,{time:p,timerRef:o,theme:f,status:d,onExpire:b,labelMessage:l?"+".concat(l):void 0,labelPosition:w?tr.Right:tr.Left}),c.default.createElement("div",{className:"pl-24"},c.default.createElement("span",{className:"font-weight-bold "},x)," of"," ",c.default.createElement("span",{className:"font-weight-bold"},g)),c.default.createElement("div",{className:"pl-24"},"Score: ",c.default.createElement("span",{className:"font-weight-bold"},h))))},pr="eb-NelLRW",br="eb-nXyIBf",vr="eb-VgMNit",hr=Object.freeze({__proto__:null,default:function(){var e=r.useNavigate(),a=_().event,n=t.useRef(null),o=t.useState($t.Stop),l=o[0],i=o[1],d=t.useState(0),u=d[0],f=d[1],m=t.useState(null),p=m[0],h=m[1],y=O(),x=y.id,E=y.title,g=y.questions,w=y.seconds,S=y.type,N=C(),I=N.currentQuestionIndex,j=N.correctResponses,T=N.dispatch,P=N.responseIndexes,R=N.restarted,M=N.score,L=N.timerEnabled,z=g[I];function q(e){var t,r,o=e===z.correctAnswerIndex;if(o){var l=function(e,t,r){return r?100*t+10*Math.min(e,10):100*t}((null===(t=n.current)||void 0===t?void 0:t.innerHTML)?+(null===(r=n.current)||void 0===r?void 0:r.innerHTML):0,z.difficulty,L);f(l),T({type:v.SetScore,payload:l+M}),T({type:v.SetCorrectResponses,payload:j+1})}h(e),i($t.Pause),T({type:v.SetCorrectIndexes,payload:b(b([],P,!0),[e],!1)}),a("question_answered",{quiz_id:x,question_index:I,answer_index:e,answered_correctly:o,answer_text:z.answers[e],quiz_type:S.toString(),total_questions:g.length})}function V(e){return e===p&&p===z.correctAnswerIndex?Qt.CorrectSelected:e===p&&p!==z.correctAnswerIndex?Qt.IncorrectSelected:null!==p&&e===z.correctAnswerIndex?Qt.Correct:Qt.Default}return t.useEffect((function(){return L&&i($t.Play),function(){L&&i($t.Stop)}}),[I,L]),c.default.createElement("div",{"data-testid":"QuestionView"},c.default.createElement(mr,{currentCount:I+1,onTimerExpire:function(){h(-1)},title:E,totalCount:g.length,totalScore:M,timerEnabled:L,timerRef:n,timerScore:u,timerStatus:l,timerTime:w,timerTheme:p===z.correctAnswerIndex?er.Correct:null!==p&&p!==z.correctAnswerIndex?er.Incorrect:er.Default}),c.default.createElement(k,{className:s.default(pr),backgroundColor:"ice"},c.default.createElement("div",{className:"p-24",dangerouslySetInnerHTML:{__html:z.text}}),c.default.createElement("div",{className:s.default(br,"p-24")},z.answers.map((function(e,t){return c.default.createElement(Wt,{disabled:null!==p,key:e,onClick:function(){return q(t)},status:V(t)},e)}))),null!==p&&c.default.createElement(Ae,{onClick:function(){I<g.length-1?(T({type:v.setCurrentQuestionIndex,payload:I+1}),h(null),L&&(i($t.Stop),f(0))):(e("/results"),a("quiz_complete",{quiz_id:x,questions_answered:P.length,restarted:R,correct_responses:j,quiz_type:S.toString(),total_questions:g.length}))}},"Next ",c.default.createElement(Ct,{className:"ml-8"})),null!==p&&c.default.createElement(ar,{className:s.default(vr,"mt-24 p-24"),explanation:z.explanation})))}});exports.Quiz=A; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("deepmerge"),t=require("react"),r=require("react-router-dom"),a=require("classnames"),n=require("react-responsive");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=l(e),c=l(t),s=l(a),u=t.createContext({}),i=u.Provider,d=function(){return d=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},d.apply(this,arguments)};function f(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r}function m(e,t,r,a){return new(r||(r=Promise))((function(n,l){function o(e){try{s(a.next(e))}catch(e){l(e)}}function c(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}s((a=a.apply(e,t||[])).next())}))}function p(e,t){var r,a,n,l,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return l={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function c(l){return function(c){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,a&&(n=2&l[0]?a.return:l[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,l[1])).done)return n;switch(a=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,a=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){o.label=l[1];break}if(6===l[0]&&o.label<n[1]){o.label=n[1],n=l;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(l);break}n[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],a=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}function b(e,t,r){if(r||2===arguments.length)for(var a,n=0,l=t.length;n<l;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var v,h={responseIndexes:[],correctResponses:0,currentQuestionIndex:0,restarted:!1,totalCorrectScore:0,totalScore:0,totalTimerScore:0,timerEnabled:!0,user:null,getLeaderboardResults:function(){return m(void 0,void 0,void 0,(function(){return p(this,(function(e){return[2,[]]}))}))},dispatch:function(){}};function E(e,t){switch(t.type){case v.SetCorrectIndexes:return d(d({},e),{responseIndexes:t.payload});case v.SetCorrectResponses:return d(d({},e),{correctResponses:t.payload});case v.setCurrentQuestionIndex:return d(d({},e),{currentQuestionIndex:t.payload});case v.SetRestarted:return d(d({},e),{correctResponses:h.correctResponses,currentQuestionIndex:h.currentQuestionIndex,responseIndexes:h.responseIndexes,restarted:!0,totalCorrectScore:h.totalCorrectScore,totalScore:h.totalScore,totalTimerScore:h.totalTimerScore});case v.setTotalCorrectScore:return d(d({},e),{totalCorrectScore:t.payload});case v.SetTotalScore:return d(d({},e),{totalScore:t.payload});case v.setTotalTimerScore:return d(d({},e),{totalTimerScore:t.payload});case v.SetTimerEnabled:return d(d({},e),{timerEnabled:t.payload});default:throw new Error("Please make sure to use the right action type reducer.")}}!function(e){e[e.SetCorrectIndexes=0]="SetCorrectIndexes",e[e.SetCorrectResponses=1]="SetCorrectResponses",e[e.setCurrentQuestionIndex=2]="setCurrentQuestionIndex",e[e.SetRestarted=3]="SetRestarted",e[e.setTotalCorrectScore=4]="setTotalCorrectScore",e[e.SetTotalScore=5]="SetTotalScore",e[e.setTotalTimerScore=6]="setTotalTimerScore",e[e.SetTimerEnabled=7]="SetTimerEnabled"}(v||(v={}));var y,x,g=t.createContext(h),w=function(e){var r=e.children,a=e.value,n=t.useReducer(E,h),l=n[0],o=n[1];return c.default.createElement(g.Provider,{value:d(d(d({},l),a),{dispatch:o})},r)},S={quizContainer:"eb-16RLBn"},N=t.createContext(S),I=N.Provider;function C(){var e=t.useState(!1),r=e[0],a=e[1];return t.useEffect((function(){void 0!==window.gtag&&a(!0)}),[]),{event:t.useCallback((function(e,t){r&&window.gtag("event",e,t)}),[r])}}function O(){return t.useContext(u)}function j(){return t.useContext(g)}exports.Template=void 0,(y=exports.Template||(exports.Template={})).TextMultipleChoice="TEXT_MULTIPLE_CHOICE",y.ImageMultipleChoice="IMAGE_MULTIPLE_CHOICE",exports.Breakpoint=void 0,(x=exports.Breakpoint||(exports.Breakpoint={}))[x.XsMin=0]="XsMin",x[x.XsMax=671]="XsMax",x[x.SmMin=672]="SmMin",x[x.SmMax=959]="SmMax",x[x.MdMin=960]="MdMin",x[x.MdMax=1247]="MdMax",x[x.LgMin=1248]="LgMin",x[x.LgMax=1399]="LgMax",x[x.XlMin=1400]="XlMin";var _={Box:"eb-ASYLqS",snowBackground:"eb-ZLkp2m",whiteBackground:"eb-DGfpHy",iceBackground:"eb-Nvt3tb",rainBorder:"eb-cMrTGF",grayBorder:"eb-94S9mY",rounded:"eb-GHgeM2",shadow:"eb-PiP0Bt"},T=function(e){var t,r,a=e.children,n=e.className,l=e.backgroundColor,o=void 0===l?"white":l,u=e.borderColor,i=void 0===u?"gray":u,m=e.rounded,p=void 0!==m&&m,b=e.shadow,v=void 0!==b&&b,h=f(e,["children","className","backgroundColor","borderColor","rounded","shadow"]);return c.default.createElement("div",d({className:s.default(_.Box,(t={},t[_.rounded]=p,t),(r={},r[_.shadow]=v,r),_["".concat(o,"Background")],_["".concat(i,"Border")],n),"data-testid":"Box"},h),a)},k=t.lazy((function(){return Promise.resolve().then((function(){return or}))})),R=function(e){return c.default.createElement(t.Suspense,{fallback:null},c.default.createElement(k,d({},e)))},P=t.lazy((function(){return Promise.resolve().then((function(){return yr}))})),M=function(e){return c.default.createElement(t.Suspense,{fallback:null},c.default.createElement(P,d({},e)))},L=t.lazy((function(){return Promise.resolve().then((function(){return na}))})),z=function(e){return c.default.createElement(t.Suspense,{fallback:null},c.default.createElement(L,d({},e)))},q=function(){return c.default.createElement(r.MemoryRouter,null,c.default.createElement(r.Routes,null,c.default.createElement(r.Route,{path:"/",element:c.default.createElement(M,null)}),c.default.createElement(r.Route,{path:"/:questionId",element:c.default.createElement(z,null)}),c.default.createElement(r.Route,{path:"/results",element:c.default.createElement(R,null)})))},V=function(e){var r=e.template,a=t.useContext(N).quizContainer,n=C().event,l=O(),o=l.id,s=l.questions,u=l.type,i=j(),d=i.correctResponses,f=i.restarted,m=i.responseIndexes;return t.useEffect((function(){function e(){m.length<s.length&&n("quiz_abandoned",{quiz_id:o,questions_answered:m.length,restarted:f,correct_responses:d,quiz_type:u.toString(),total_questions:s.length})}return window.addEventListener("beforeunload",e),function(){return window.removeEventListener("beforeunload",e)}}),[o,m,d,s.length,n,f,u]),c.default.createElement(T,{className:a,borderColor:"rain",rounded:!0,"data-testid":"TemplateLoader"},r===exports.Template.TextMultipleChoice&&c.default.createElement(q,null))},B=function(e){var t=e.data,r=e.template,a=e.theme,n=void 0===a?{}:a,l=e.user,s=e.onLeaderboardResults;return c.default.createElement(I,{value:o.default(S,n)},c.default.createElement(i,{value:t},c.default.createElement(w,{value:{getLeaderboardResults:s,user:l}},c.default.createElement(V,{template:r}))))},G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function A(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})})),r}var F,H={},Q={exports:{}},D={};function U(){if(F)return D;F=1;var e=c.default,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function o(e,r,o){var c,s={},u=null,i=null;for(c in void 0!==o&&(u=""+o),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(i=r.ref),r)a.call(r,c)&&!l.hasOwnProperty(c)&&(s[c]=r[c]);if(e&&e.defaultProps)for(c in r=e.defaultProps)void 0===s[c]&&(s[c]=r[c]);return{$$typeof:t,type:e,key:u,ref:i,props:s,_owner:n.current}}return D.Fragment=r,D.jsx=o,D.jsxs=o,D}function W(e,t){if(!t)return e;var r=Object.prototype.hasOwnProperty;return Object.keys(t).reduce((function(a,n){return r.call(t,n)&&t[n]&&(a="".concat(a," ").concat(e,"--").concat(n)),a}),e)}function X(e){return function(t,r){return t?"string"!=typeof t?W(e,t):W("".concat(e,"__").concat(t),r):e}}Q.exports=U();var Z=function(){return Z=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Z.apply(this,arguments)},Y=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},K=X("rmd-icon"),J=t.forwardRef((function(e,t){var r=e.className,a=e.children,n=e["aria-hidden"],l=void 0===n||n,o=e.dense,c=void 0!==o&&o,u=e.iconClassName,i=void 0===u?"material-icons":u,d=e.forceSize,f=void 0!==d&&d,m=e.forceFontSize,p=void 0!==m&&m,b=Y(e,["className","children","aria-hidden","dense","iconClassName","forceSize","forceFontSize"]);return Q.exports.jsx("i",Z({},b,{"aria-hidden":l,ref:t,className:s.default(K({font:!0,dense:c,"forced-font":p,"forced-size":f}),i,r)},{children:a}))})),$=function(){return $=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},$.apply(this,arguments)},ee=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},te=X("rmd-icon"),re=t.forwardRef((function(e,t){var r=e["aria-hidden"],a=void 0===r||r,n=e.focusable,l=void 0===n?"false":n,o=e.xmlns,c=void 0===o?"http://www.w3.org/2000/svg":o,u=e.viewBox,i=void 0===u?"0 0 24 24":u,d=e.dense,f=void 0!==d&&d,m=e.className,p=e.use,b=e.children,v=ee(e,["aria-hidden","focusable","xmlns","viewBox","dense","className","use","children"]),h=b;return!h&&p&&(h=Q.exports.jsx("use",{xlinkHref:p})),Q.exports.jsx("svg",$({},v,{"aria-hidden":a,ref:t,className:s.default(te({svg:!0,dense:f}),m),focusable:l,xmlns:c,viewBox:i},{children:h}))})),ae=function(){return ae=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},ae.apply(this,arguments)};var ne=function(){return ne=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},ne.apply(this,arguments)},le=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r},oe=X("rmd-icon-rotator"),ce=t.forwardRef((function(e,r){var a=e.style,n=e.className,l=e.animate,o=void 0===l||l,c=e.rotated,u=e.children,i=e.forceIconWrap,d=void 0!==i&&i,f=le(e,["style","className","animate","rotated","children","forceIconWrap"]),m=s.default(oe({animate:o,rotated:c}),n);if(!d&&t.isValidElement(u)){var p=t.Children.only(u);return t.cloneElement(p,{className:s.default(m,p.props.className)})}return Q.exports.jsx("span",ne({},f,{style:a,className:m,ref:r},{children:u}))})),se=function(){return se=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},se.apply(this,arguments)},ue={back:Q.exports.jsx(J,{children:"keyboard_arrow_left"}),checkbox:Q.exports.jsx(J,{children:"check_box"}),upload:Q.exports.jsx(J,{children:"file_upload"}),dropdown:Q.exports.jsx(J,{children:"arrow_drop_down"}),error:Q.exports.jsx(J,{children:"error_outline"}),expander:Q.exports.jsx(J,{children:"keyboard_arrow_down"}),forward:Q.exports.jsx(J,{children:"keyboard_arrow_right"}),menu:Q.exports.jsx(J,{children:"menu"}),notification:Q.exports.jsx(J,{children:"notifications"}),password:Q.exports.jsx(J,{children:"remove_red_eye"}),radio:Q.exports.jsx(J,{children:"radio_button_checked"}),selected:Q.exports.jsx(J,{children:"check"}),sort:Q.exports.jsx(J,{children:"arrow_upward"})},ie=t.createContext(ue),de=ie.Provider;var fe=A(Object.freeze({__proto__:null,FontIcon:J,SVGIcon:re,TextIconSpacing:function(e){var r,a=e.className,n=e.icon,l=e.children,o=void 0===l?null:l,c=e.stacked,u=void 0!==c&&c,i=e.iconAfter,d=void 0!==i&&i,f=e.flexReverse,m=void 0!==f&&f,p=e.forceIconWrap,b=void 0!==p&&p,v=e.beforeClassName,h=void 0===v?"rmd-icon--before":v,E=e.afterClassName,y=void 0===E?"rmd-icon--after":E,x=e.aboveClassName,g=void 0===x?"rmd-icon--above":x,w=e.belowClassName,S=void 0===w?"rmd-icon--below":w;if(!n)return Q.exports.jsx(Q.exports.Fragment,{children:o});var N=m?!d:d,I=s.default(((r={})[h]=!u&&!N,r[y]=!u&&N,r[g]=u&&!N,r[S]=u&&N,r),a),C=n,O=o;if(!b&&t.isValidElement(n)){var j=t.Children.only(n);C=t.cloneElement(j,{className:s.default(I,j.props.className)})}else n&&(C=Q.exports.jsx("span",ae({className:s.default("rmd-text-icon-spacing",I)},{children:n})));return C&&(O=Q.exports.jsxs(Q.exports.Fragment,{children:[!d&&C,o,d&&C]})),Q.exports.jsx(Q.exports.Fragment,{children:O})},IconRotator:ce,useIcon:function(e,r){var a=t.useContext(ie);return void 0!==r?r:a[e]},IconProvider:function(e){var r=e.children,a=e.back,n=void 0===a?ue.back:a,l=e.checkbox,o=void 0===l?ue.checkbox:l,c=e.dropdown,s=void 0===c?ue.dropdown:c,u=e.expander,i=void 0===u?ue.expander:u,d=e.error,f=void 0===d?ue.error:d,m=e.forward,p=void 0===m?ue.forward:m,b=e.menu,v=void 0===b?ue.menu:b,h=e.notification,E=void 0===h?ue.notification:h,y=e.password,x=void 0===y?ue.password:y,g=e.radio,w=void 0===g?ue.radio:g,S=e.selected,N=void 0===S?ue.selected:S,I=e.sort,C=void 0===I?ue.sort:I,O=e.upload,j=void 0===O?ue.upload:O,_=t.useMemo((function(){return{back:n,checkbox:o,dropdown:s,error:f,expander:i,forward:p,menu:v,notification:E,password:x,radio:w,selected:N,sort:C,upload:j}}),[n,o,s,f,i,p,v,E,x,w,N,C,j]);return Q.exports.jsx(de,se({value:_},{children:r}))}})),me=G&&G.__assign||function(){return me=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},me.apply(this,arguments)};Object.defineProperty(H,"__esModule",{value:!0});var pe=H.LightbulbOutlineSVGIcon=void 0,be=Q.exports,ve=c.default,he=fe;pe=H.LightbulbOutlineSVGIcon=(0,ve.forwardRef)((function(e,t){return(0,be.jsx)(he.SVGIcon,me({},e,{ref:t},{children:(0,be.jsx)("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"})}))}));var Ee={lightbulbIcon:"eb-z4RCtv"},ye=function(e){var t=e.className,r=e.explanation;return c.default.createElement("div",{className:s.default(Ee.explanationContainer,t),"data-testid":"Explanation"},c.default.createElement(pe,{className:s.default(Ee.lightbulbIcon,"mr-4")}),c.default.createElement("span",{className:s.default(Ee.explanation,"m-0"),dangerouslySetInnerHTML:{__html:r}}))},xe="eb-6lGJ0X",ge="eb-hAkxpo",we="eb-HLIy3V",Se="eb-VsNFkm",Ne="eb-6nDHds",Ie="eb-DBAmCC",Ce="eb-HjILKR",Oe=function(){var e=O().questions,t=j().responseIndexes;return c.default.createElement("div",{className:xe,"data-testid":"AnswersTab"},e.map((function(e,r){var a=e.text,n=e.answers,l=e.correctAnswerIndex,o=e.explanation;return c.default.createElement("div",{className:s.default(ge,"mb-32"),key:a},c.default.createElement("div",{className:s.default(we,"font-weight-bold")},r+1),c.default.createElement("div",{className:s.default(Se,"font-weight-bold"),dangerouslySetInnerHTML:{__html:a}}),c.default.createElement("div",{className:Ne},c.default.createElement("div",{className:s.default(l===t[r]?Ce:Ie)},"Your Answer: ",n[t[r]]),c.default.createElement("div",{className:"mt-4"},"Correct Answer: ",n[l]),c.default.createElement(ye,{className:"mt-16",explanation:o})))})))},je={},_e=G&&G.__assign||function(){return _e=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},_e.apply(this,arguments)};Object.defineProperty(je,"__esModule",{value:!0});var Te=je.CheckCircleSVGIcon=void 0,ke=Q.exports,Re=c.default,Pe=fe;Te=je.CheckCircleSVGIcon=(0,Re.forwardRef)((function(e,t){return(0,ke.jsx)(Pe.SVGIcon,_e({},e,{ref:t},{children:(0,ke.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}))}));var Me={},Le=G&&G.__assign||function(){return Le=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Le.apply(this,arguments)};Object.defineProperty(Me,"__esModule",{value:!0});var ze=Me.ReplaySVGIcon=void 0,qe=Q.exports,Ve=c.default,Be=fe;ze=Me.ReplaySVGIcon=(0,Ve.forwardRef)((function(e,t){return(0,qe.jsx)(Be.SVGIcon,Le({},e,{ref:t},{children:(0,qe.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"})}))}));var Ge={},Ae=G&&G.__assign||function(){return Ae=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Ae.apply(this,arguments)};Object.defineProperty(Ge,"__esModule",{value:!0});var Fe=Ge.AlarmSVGIcon=void 0,He=Q.exports,Qe=c.default,De=fe;Fe=Ge.AlarmSVGIcon=(0,Qe.forwardRef)((function(e,t){return(0,He.jsx)(De.SVGIcon,Ae({},e,{ref:t},{children:(0,He.jsx)("path",{d:"M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12.5 8H11v6l4.75 2.85.75-1.23-4-2.37V8zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"})}))}));var Ue="https://9zdy2kcoy6.execute-api.us-east-1.amazonaws.com/dev";function We(){var e=this,r=O(),a=r.categories,n=r.generalAudience,l=r.metadata,o=r.id,c=r.popular,s=r.tightrope,u=r.type,i=r.vocab,d=j(),f=d.getLeaderboardResults,b=d.totalScore,v=t.useState(null),h=v[0],E=v[1],y=t.useState(!1),x=y[0],g=y[1],w=t.useState(!1),S=w[0],N=w[1],I=t.useState(null),C=I[0],_=I[1],T=t.useState(null),k=T[0],R=T[1],P=t.useState(!1),M=P[0],L=P[1],z=t.useState(!1),q=z[0],V=z[1],B=t.useCallback((function(t){return void 0===t&&(t=3),m(e,void 0,void 0,(function(){var e,r,a;return p(this,(function(n){switch(n.label){case 0:return n.trys.push([0,4,5,6]),N(!0),[4,fetch("".concat(Ue,"/leaderboard?appId=").concat(l.source,"&quizId=").concat(o,"&limit=").concat(t))];case 1:return[4,n.sent().json()];case 2:return e=n.sent(),[4,f(e)];case 3:return r=n.sent(),E(r),g(!1),[3,6];case 4:return a=n.sent(),console.log(a),g(!0),[3,6];case 5:return N(!1),[7];case 6:return[2]}}))}))}),[f,l,o]),G=t.useCallback((function(t){return m(e,void 0,void 0,(function(){var e,r;return p(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,fetch("".concat(Ue,"/stats/percentile?appId=").concat(l.source,"&quizId=").concat(o,"&userId=").concat(t))];case 1:return[4,a.sent().json()];case 2:return e=a.sent(),_(e.scorePercentile),[3,4];case 3:return r=a.sent(),console.log(r),[3,4];case 4:return[2]}}))}))}),[l.source,o]),A=t.useCallback((function(t,r){return void 0===r&&(r=1),m(e,void 0,void 0,(function(){var e,a,n;return p(this,(function(c){switch(c.label){case 0:return c.trys.push([0,4,5,6]),V(!0),[4,fetch("".concat(Ue,"/rank?appId=").concat(l.source,"&quizId=").concat(o,"&userId=").concat(t,"&neighbors=").concat(r))];case 1:return[4,c.sent().json()];case 2:return e=c.sent(),[4,f(e)];case 3:return a=c.sent(),R(a),[3,6];case 4:return n=c.sent(),console.log(n),L(!0),[3,6];case 5:return V(!1),[7];case 6:return[2]}}))}))}),[f,l.source,o]),F=t.useCallback((function(t){return m(e,void 0,void 0,(function(){var e,r;return p(this,(function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),console.log("saving user score..."),[4,fetch("".concat(Ue,"/score"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({appId:l.source,quizId:o,score:b,userId:t,metadata:{isGeneralAudience:n,isPopular:c,isTightrope:s,isVocab:i,primaryCategory:a[0].label,type:u,slug:l.slug}})})];case 1:return e=d.sent(),console.log("done",e),[3,3];case 2:return r=d.sent(),console.log(r),[3,3];case 3:return[2]}}))}))}),[a,n,l.source,l.slug,c,o,s,b,u,i]);return{getLeaderboardResults:B,getUserPercentile:G,getUserRankResults:A,saveUserScore:F,leaderboardResults:h,leaderboardResultsError:x,leaderboardResultsLoading:S,userPercentile:C,userRankResults:k,userRankResultsError:M,userRankResultsLoading:q}}function Xe(e){return 10*Math.min(e,10)}function Ze(e,t,r){return r?100*t+Xe(e):100*t}var Ye,Ke="eb-h0JoJS",Je="eb-g0oWRe",$e="eb-cDH2ZZ",et="eb-PMfRkP",tt="eb-6MTWIi",rt="eb-P5IGFV",at="eb-R87VrN",nt="eb-b7udwo",lt="eb-mzexJz";!function(e){e.Left="left",e.Right="right"}(Ye||(Ye={}));var ot,ct=function(e){var r,a,n,l,o,u,i=e.block,m=void 0!==i&&i,p=e.children,b=e.className,v=e.icon,h=e.iconPosition,E=void 0===h?Ye.Left:h,y=e.outline,x=void 0!==y&&y,g=e.shadow,w=void 0!==g&&g,S=e.shadowSm,N=void 0!==S&&S,I=e.superButton,C=void 0!==I&&I,O=e.tag,j=void 0===O?"button":O,_=f(e,["block","children","className","icon","iconPosition","outline","shadow","shadowSm","superButton","tag"]);return c.default.createElement(j,d({className:s.default(Ke,(r={},r[Je]=m,r),(a={},a[et]=v,a),(n={},n[$e]=x,n),(l={},l[at]=w,l),(o={},o[nt]=N,o),(u={},u[lt]=C,u),b),"data-testid":"Button"},_),E===Ye.Left&&v&&t.cloneElement(v,{className:s.default(v.props.className,tt)}),p,E===Ye.Right&&v&&t.cloneElement(v,{className:s.default(v.props.className,rt)}))},st="eb-WrBwzW",ut="eb-LlKpPo",it=function(e){var t,r=e.children,a=e.className,n=e.bgColor,l=void 0===n?void 0:n,o=e.outline;return c.default.createElement("div",{className:s.default(st,(t={},t[ut]=o,t),a),style:{backgroundColor:l},"data-testid":"Badge"},r)},dt="eb-ttCsCh",ft=function(e){var t=e.children,r=e.className,a=f(e,["children","className"]);return c.default.createElement("div",d({className:s.default(dt,r),"data-testid":"ListGroup"},a),t)},mt="eb-Dgd6nO",pt="eb-DkhGFO",bt="eb-kwge39",vt=function(e){var t,r,a=e.children,n=e.active,l=e.className,o=e.justified,u=f(e,["children","active","className","justified"]);return c.default.createElement("div",d({className:s.default(mt,(t={},t[pt]=n,t),(r={},r[bt]=o,r),l),"data-testid":"ListItem"},u),a)},ht="eb-l7tnqS",Et="eb-FQUR34",yt=function(e){var t=e.className,r=e.items,a=e.newScore,n=e.user;return c.default.createElement(ft,{className:t,"data-testid":"Leaderboard"},r.map((function(e,t){var r=e.id,l=e.rank,o=e.name,s=e.score;return c.default.createElement(vt,{key:r,justified:!0,active:r===(null==n?void 0:n.id)},c.default.createElement("div",{className:ht},l||t+1,". ",c.default.createElement("strong",null,o)),c.default.createElement("div",{className:Et},r===(null==n?void 0:n.id)&&a>0&&a>s&&c.default.createElement(it,null,"+",a-s),(new Intl.NumberFormat).format(s)))})))},xt="eb-Hq5iFO",gt="eb-p1vZ3L",wt="eb-8GC4cE",St="eb-rgrfl0",Nt="eb-KmoX7Q",It="eb-z33RWL",Ct="eb-5f5DSo",Ot="eb-RjthEk",jt="eb-lf4O2l",_t="eb-ykC0zi",Tt=function(e){var r=e.onRestartQuiz,a=O().questions,n=j(),l=n.correctResponses,o=n.totalCorrectScore,u=n.totalScore,i=n.totalTimerScore,d=n.user,f=We(),m=f.leaderboardResults,p=f.leaderboardResultsError,b=f.getLeaderboardResults,v=f.getUserPercentile,h=f.getUserRankResults,E=f.userPercentile,y=f.userRankResults,x=f.userRankResultsError;return t.useEffect((function(){d?(h(d.id),v(d.id)):b()}),[v,h,b,d]),t.useEffect((function(){if(d&&(null==y?void 0:y.length)&&!x){var e=y.find((function(e){return e.id===d.id}));!!e&&e.rank<=3||b()}x&&b()}),[b,d,y,x]),c.default.createElement("div",{className:xt,"data-testid":"LeaderboardTab"},c.default.createElement(T,{className:Nt,backgroundColor:"snow",borderColor:"rain",rounded:!0},c.default.createElement("div",{className:gt},c.default.createElement("h2",{className:"mb-4"},"All Quizzes"),c.default.createElement("p",{className:"font-14"},"Total Weekly Points")),m&&c.default.createElement(yt,{className:"mt-20",newScore:u,items:m}),p&&c.default.createElement("p",null,"We're experiencing issues loading the Leaderboard at this time. Please try again later."),y&&c.default.createElement(yt,{className:"mt-20",newScore:u,items:y,user:d}),x&&c.default.createElement("p",null,"We're experiencing issues loading your score at this time. Please try again later.")),c.default.createElement(T,{className:It,backgroundColor:"white",borderColor:"rain",rounded:!0},c.default.createElement("div",{className:s.default(wt,"text-center mb-20")},c.default.createElement("h2",{className:"mb-16"},"This Quiz"),E&&c.default.createElement("p",{className:"mt-16 font-14"},"You scored ",E,"% better than most users!")),c.default.createElement("div",{className:Ct},c.default.createElement("div",null,c.default.createElement("div",{className:"mb-8"},c.default.createElement("div",{className:Ot},c.default.createElement(Te,{className:"mr-4"})," ",c.default.createElement("strong",null,l," Correct")),c.default.createElement("div",null,c.default.createElement("strong",null,o," Points"))),c.default.createElement("div",{className:"mt-16"},c.default.createElement("div",{className:jt},c.default.createElement(Fe,{className:"mr-4"})," ",c.default.createElement("strong",null,"Time Bonus")),c.default.createElement("div",null,c.default.createElement("strong",null,i," Points")))),c.default.createElement("div",{className:"text-center"},c.default.createElement("div",{className:St},c.default.createElement("div",null,c.default.createElement("h1",null,u)),c.default.createElement("div",null,c.default.createElement("strong",null,"POINTS"))),c.default.createElement("div",null,"Of ",function(e){var t=0;return e.forEach((function(e){return t+=100*e.difficulty+100})),t}(a)))),c.default.createElement("div",{className:"text-center mt-28"},c.default.createElement(ct,{icon:c.default.createElement(ze,{className:_t}),onClick:r,outline:!0,shadow:!0},"Play Again"))))},kt="eb-oCfRGq",Rt=function(e){var t=e.children,r=e.className,a=f(e,["children","className"]);return c.default.createElement("a",d({},a,{className:s.default(kt,"font-weight-semi-bold",r)}),t)},Pt=function(){var e=O().nextUpQuiz,t=e.image,r=e.url,a=e.title;return c.default.createElement(T,{borderColor:"rain",className:"mt-20","data-testid":"NextUpQuizCard",rounded:!0,shadow:!0},c.default.createElement("div",{style:{aspectRatio:"16/9"}},c.default.createElement("img",{src:t.fullUrl,alt:t.altText})),c.default.createElement("div",{className:"p-20"},c.default.createElement(Rt,{className:"font-20",href:r},a),c.default.createElement(ct,{tag:"a",href:r,className:"mt-20",block:!0},"Play")))},Mt="eb-NdGzM3",Lt="eb-fQMdMF",zt="eb-i8uKTc",qt="eb-ZBrDqu",Vt="eb-FOeG4W",Bt="eb-fQceh4",Gt="eb-vzHSa2",At="eb-sS9sRH",Ft=function(){var e=j(),t=e.correctResponses,r=e.totalScore,a=O().questions,n=t/a.length*100;return c.default.createElement("div",{className:Mt},c.default.createElement("div",{className:Lt,"data-testid":"ScoreSummaryWheel"},c.default.createElement("div",{className:s.default(Bt,"px-12 py-8 font-weight-semi-bold")},"Congrats!"),c.default.createElement("svg",{viewBox:"0 0 36 36",className:zt},c.default.createElement("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",className:Vt}),c.default.createElement("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",className:qt,strokeDasharray:"".concat(n," 100")})),c.default.createElement("div",{className:s.default(Gt,"text-center")},c.default.createElement("div",{className:s.default(At,"font-weight-super-bold")},t,"/",a.length),c.default.createElement("div",{className:"font-12"},r," points"))))},Ht="eb-od4oX9",Qt="eb-F71AtK",Dt="eb-EM5HVl",Ut="eb-yx3D4X",Wt="eb-0AMT86",Xt=function(e){var t=e.onRestartQuiz,r=n.useMediaQuery({maxWidth:exports.Breakpoint.XsMax}),a=O().title;return c.default.createElement("div",{"data-testid":"ScoreTab",className:Ht},c.default.createElement(T,{className:Qt,borderColor:"rain",backgroundColor:"ice",rounded:!r,shadow:!r},c.default.createElement("div",{className:Dt},c.default.createElement("div",{className:"font-18 font-weight-extra-bold"},a),c.default.createElement(Ft,null),c.default.createElement(ct,{icon:c.default.createElement(ze,{className:Wt}),onClick:t,outline:!0,shadow:!0},"Play Again")),c.default.createElement("div",{className:Ut},c.default.createElement("div",{className:"font-weight-extra-bold font-24"},"Next Up!"),c.default.createElement(Pt,null))))},Zt={activeTabId:"default",setActiveTabId:function(){}},Yt=t.createContext(Zt),Kt=function(e){var r=e.children,a=e.defaultActiveTabId,n=t.useState(a),l=n[0],o=n[1];return c.default.createElement(Yt.Provider,{value:{activeTabId:l,setActiveTabId:o}},r)},Jt="eb-fkZcg2",$t="eb-ntGIO4",er=function(e){var r,a=e.children,n=e.className,l=e.controlFor,o=t.useContext(Yt),u=o.setActiveTabId,i=o.activeTabId===l;return c.default.createElement("button",{className:s.default(Jt,(r={},r[$t]=i,r),n),"data-testid":"Tab",id:"".concat(l,"-tab"),role:"tab","aria-controls":l,"aria-selected":i,tabIndex:i?void 0:-1,onClick:function(){return u(l)}},a)},tr=function(e){var r=e.children,a=e.className,n=e.id,l=f(e,["children","className","id"]);return n===t.useContext(Yt).activeTabId?c.default.createElement("div",d({id:n,className:a,"data-testid":"TabContent",tabIndex:0,role:"tabpanel","aria-labelledby":"".concat(n,"-tab")},l),r):null},rr="eb-ftdu2H",ar=function(e){var t=e.children,r=e.className,a=e.label;return c.default.createElement("div",{className:s.default(rr,r),"data-testid":"Tabs",role:"tablist","aria-label":a},t)},nr="eb-vDPeCr",lr="eb-bMiWKa";!function(e){e.AnswersTab="AnswersTab",e.LeaderboardTab="LeaderboardTab",e.ScoreTab="ScoreTab"}(ot||(ot={}));var or=Object.freeze({__proto__:null,default:function(){var e=O().image,a=j(),n=a.dispatch,l=a.user,o=We().saveUserScore,s=r.useNavigate();function u(){n({type:v.SetRestarted}),s("/")}return t.useEffect((function(){l&&o(l.id)}),[o,l]),c.default.createElement("div",{"data-testid":"ResultsView",className:nr,style:{backgroundImage:"url(".concat(e.fullUrl,")")}},c.default.createElement(Kt,{defaultActiveTabId:ot.ScoreTab},c.default.createElement(ar,{label:"Results View"},c.default.createElement(er,{controlFor:ot.ScoreTab},"Score"),c.default.createElement(er,{controlFor:ot.AnswersTab},"Answers"),c.default.createElement(er,{controlFor:ot.LeaderboardTab},"Leaderboard")),c.default.createElement(tr,{className:lr,id:ot.ScoreTab},c.default.createElement(Xt,{onRestartQuiz:u})),c.default.createElement(tr,{className:lr,id:ot.AnswersTab},c.default.createElement(Oe,null)),c.default.createElement(tr,{className:lr,id:ot.LeaderboardTab},c.default.createElement(Tt,{onRestartQuiz:u}))))}}),cr="eb-8LB0Z6",sr="eb-xrnrMX",ur="eb-uQ6x3r",ir="eb-RTZJDf",dr="eb-nCZamz",fr="eb-XBUSmk",mr="eb-6uIIpF",pr="eb-vaYYcz",br="eb-FGnvGm",vr=function(e){var t=e.children;return c.default.createElement("div",{className:br,"data-testid":"SwitchControl"},t)},hr="eb-FxfgLd",Er=function(e){var t=e.id,r=f(e,["id"]);return c.default.createElement("input",d({id:t,className:hr,type:"checkbox",role:"switch"},r))},yr=Object.freeze({__proto__:null,default:function(){var e=O(),t=e.id,a=e.categories,n=e.image,l=e.title,o=e.timed,u=e.questions,i=j(),d=i.dispatch,f=i.timerEnabled;return c.default.createElement("div",{className:cr,"data-testid":"IntroView",style:{aspectRatio:"900 / 675"}},c.default.createElement("img",{className:sr,src:n.fullUrl,alt:n.altText}),c.default.createElement("div",{className:ur},c.default.createElement(T,{borderColor:"rain",className:s.default(fr,"p-20"),rounded:!0,shadow:!0},c.default.createElement("div",{className:ir},c.default.createElement(it,{className:s.default(dr),bgColor:"var(--qc-ice)",outline:!0},c.default.createElement("span",{className:"font-14"},a[0].label))),c.default.createElement("h1",{className:s.default(pr,"font-weight-semi-bold text-center")},l),c.default.createElement("div",{className:"text-center"},c.default.createElement(ct,{className:"p-28",tag:r.Link,to:"/".concat(t),block:!0,superButton:!0},"Start")),c.default.createElement("div",{className:s.default(mr,"pt-16")},c.default.createElement("div",{className:"font-14 font-weight-semi-bold"},u.length," Questions"),o&&c.default.createElement(vr,null,c.default.createElement("label",{className:"font-14",htmlFor:"toggle"},"Timer Bonus"),c.default.createElement(Er,{id:"".concat(t),defaultChecked:f,onClick:function(){return d({type:v.SetTimerEnabled,payload:!f})}}))))))}}),xr={},gr=G&&G.__assign||function(){return gr=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},gr.apply(this,arguments)};Object.defineProperty(xr,"__esModule",{value:!0});var wr=xr.ArrowForwardSVGIcon=void 0,Sr=Q.exports,Nr=c.default,Ir=fe;wr=xr.ArrowForwardSVGIcon=(0,Nr.forwardRef)((function(e,t){return(0,Sr.jsx)(Ir.SVGIcon,gr({},e,{ref:t},{children:(0,Sr.jsx)("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})}))}));var Cr={},Or=G&&G.__assign||function(){return Or=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Or.apply(this,arguments)};Object.defineProperty(Cr,"__esModule",{value:!0});var jr=Cr.CloseSVGIcon=void 0,_r=Q.exports,Tr=c.default,kr=fe;jr=Cr.CloseSVGIcon=(0,Tr.forwardRef)((function(e,t){return(0,_r.jsx)(kr.SVGIcon,Or({},e,{ref:t},{children:(0,_r.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}));var Rr={},Pr=G&&G.__assign||function(){return Pr=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Pr.apply(this,arguments)};Object.defineProperty(Rr,"__esModule",{value:!0});var Mr=Rr.CheckSVGIcon=void 0,Lr=Q.exports,zr=c.default,qr=fe;Mr=Rr.CheckSVGIcon=(0,zr.forwardRef)((function(e,t){return(0,Lr.jsx)(qr.SVGIcon,Pr({},e,{ref:t},{children:(0,Lr.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})}))}));var Vr,Br={answerButtonContainer:"eb-hm0P2D",answerButton:"eb-EkupIl",selected:"eb-p8ZbDY",correct:"eb-5WC5qo",correctSelected:"eb-Z1YT6r",incorrectSelected:"eb-V0bjjy",disabled:"eb-N51x3L",default:"eb-e7y9O4",icon:"eb-8I8Gjv",correctIcon:"eb-NVqaa3",incorrectIcon:"eb-5sHpoZ"};!function(e){e.Correct="correct",e.CorrectSelected="correctSelected",e.Default="default",e.IncorrectSelected="incorrectSelected",e.Selected="selected"}(Vr||(Vr={}));var Gr,Ar,Fr,Hr=function(e){var t,r=e.children,a=e.status,n=void 0===a?Vr.Default:a,l=e.disabled,o=f(e,["children","status","disabled"]);return c.default.createElement("div",{className:Br.answerButtonContainer},Vr.CorrectSelected===n&&c.default.createElement(Mr,{className:s.default(Br.icon,Br.correctIcon,"font-12 p-4")}),Vr.IncorrectSelected===n&&c.default.createElement(jr,{className:s.default(Br.icon,Br.incorrectIcon,"font-12 p-4")}),c.default.createElement(ct,d({className:s.default(Br.answerButton,n&&Br[n],(t={},t[Br.disabled]=l,t)),outline:!0,block:!0,disabled:l,superButton:!0,shadowSm:!0},o),r))},Qr="eb-fKHH4k",Dr="eb-Ka5TRS",Ur="eb-eQLIHc",Wr="eb-YcibRH",Xr="eb-pAHhPN";!function(e){e.Play="play",e.Pause="pause",e.Stop="stop"}(Gr||(Gr={})),function(e){e.Correct="var(--qc-green)",e.Incorrect="var(--qc-red)",e.Default="var(--qc-blue-200)"}(Ar||(Ar={})),function(e){e.Left="left",e.Right="right"}(Fr||(Fr={}));var Zr=function(e){var r=e.labelMessage,a=e.labelPosition,n=void 0===a?Fr.Left:a,l=e.onExpire,o=e.status,s=e.theme,u=void 0===s?Ar.Default:s,i=e.time,d=void 0===i?15:i,f=e.timerRef,m=t.useState(d),p=m[0],b=m[1],v=t.useState(!1),h=v[0],E=v[1],y=t.useRef(0);return t.useEffect((function(){return o===Gr.Play&&(y.current=window.setInterval((function(){return b((function(e){return e-1}))}),1e3)),o===Gr.Stop&&(clearInterval(y.current),b(d)),o===Gr.Pause&&clearInterval(y.current),function(){clearInterval(y.current),E(!1)}}),[o,d]),t.useEffect((function(){0===p&&(clearInterval(y.current),E(!0),l&&l())}),[l,p]),c.default.createElement("div",{className:Qr,"data-testid":"Timer"},n===Fr.Left&&c.default.createElement("div",{className:Wr},!p&&c.default.createElement(it,{bgColor:Ar.Incorrect},"Time's Up!"),r&&!!p&&c.default.createElement(it,{bgColor:u},r)),c.default.createElement("div",{className:Dr},c.default.createElement("svg",null,c.default.createElement("circle",{cx:"23",cy:"23",r:"23",style:{stroke:h?Ar.Incorrect:"var(--qc-rain)"}}),c.default.createElement("circle",{cx:"23",cy:"23",r:"23",style:{stroke:u,strokeDashoffset:145-145*p/d}})),c.default.createElement("p",{ref:f,className:Ur},p)),n===Fr.Right&&c.default.createElement("div",{className:Xr},!p&&c.default.createElement(it,{bgColor:Ar.Incorrect},"Time's Up!"),r&&!!p&&c.default.createElement(it,{bgColor:u},r)))},Yr="eb-db86L8",Kr="eb-fl8Stz",Jr="eb-MbWQdV",$r=function(e){var t=e.title,r=e.timerEnabled,a=void 0===r||r,l=e.timerRef,o=e.timerScore,u=e.timerStatus,i=void 0===u?Gr.Stop:u,d=e.timerTheme,f=void 0===d?Ar.Default:d,m=e.timerTime,p=void 0===m?15:m,b=e.onTimerExpire,v=e.totalScore,h=void 0===v?0:v,E=e.currentCount,y=void 0===E?0:E,x=e.totalCount,g=void 0===x?0:x,w=n.useMediaQuery({maxWidth:exports.Breakpoint.MdMin});return c.default.createElement("div",{className:s.default(Yr,"p-4")},c.default.createElement("span",{className:s.default(Jr,"pl-16")},t),c.default.createElement("div",{className:s.default(Kr,"px-16")},a&&c.default.createElement(Zr,{time:p,timerRef:l,theme:f,status:i,onExpire:b,labelMessage:o?"+".concat(o):void 0,labelPosition:w?Fr.Right:Fr.Left}),c.default.createElement("div",{className:"pl-24"},c.default.createElement("span",{className:"font-weight-bold "},y)," of"," ",c.default.createElement("span",{className:"font-weight-bold"},g)),c.default.createElement("div",{className:"pl-24"},"Score: ",c.default.createElement("span",{className:"font-weight-bold"},h))))},ea="eb-NelLRW",ta="eb-nXyIBf",ra="eb-VgMNit",aa="eb-8SxGFY",na=Object.freeze({__proto__:null,default:function(){var e=r.useNavigate(),a=C().event,n=t.useRef(null),l=t.useState(Gr.Stop),o=l[0],u=l[1],i=t.useState(0),d=i[0],f=i[1],m=t.useState(null),p=m[0],h=m[1],E=O(),y=E.id,x=E.title,g=E.questions,w=E.seconds,S=E.type,N=j(),I=N.currentQuestionIndex,_=N.correctResponses,k=N.dispatch,R=N.responseIndexes,P=N.restarted,M=N.totalCorrectScore,L=N.totalScore,z=N.totalTimerScore,q=N.timerEnabled,V=g[I];t.useEffect((function(){return q&&u(Gr.Play),function(){q&&u(Gr.Stop)}}),[I,q]);var B=t.useCallback((function(){h(-1)}),[]);function G(e){return e===p&&p===V.correctAnswerIndex?Vr.CorrectSelected:e===p&&p!==V.correctAnswerIndex?Vr.IncorrectSelected:null!==p&&e===V.correctAnswerIndex?Vr.Correct:Vr.Default}return c.default.createElement("div",{"data-testid":"QuestionView"},c.default.createElement($r,{currentCount:I+1,onTimerExpire:B,title:x,totalCount:g.length,totalScore:L,timerEnabled:q,timerRef:n,timerScore:d,timerStatus:o,timerTime:w,timerTheme:p===V.correctAnswerIndex?Ar.Correct:null!==p&&p!==V.correctAnswerIndex?Ar.Incorrect:Ar.Default}),c.default.createElement(T,{className:s.default(s.default(ea,"pb-20")),backgroundColor:"ice"},c.default.createElement("div",{className:s.default(aa,"p-24 font-24 font-weight-normal text-center"),dangerouslySetInnerHTML:{__html:V.text}}),c.default.createElement("div",{className:s.default(ta,"p-24")},V.answers.map((function(e,t){return c.default.createElement(Hr,{disabled:null!==p,key:e,onClick:function(){return function(e){var t,r,l=e===V.correctAnswerIndex;if(l){var o=(null===(t=n.current)||void 0===t?void 0:t.innerHTML)?+(null===(r=n.current)||void 0===r?void 0:r.innerHTML):0,c=Ze(o,V.difficulty,q);f(c),k({type:v.setTotalCorrectScore,payload:M+Ze(0,V.difficulty,!1)}),q&&k({type:v.setTotalTimerScore,payload:z+Xe(o)}),k({type:v.SetTotalScore,payload:L+c}),k({type:v.SetCorrectResponses,payload:_+1})}h(e),u(Gr.Pause),k({type:v.SetCorrectIndexes,payload:b(b([],R,!0),[e],!1)}),a("question_answered",{quiz_id:y,question_index:I,answer_index:e,answered_correctly:l,answer_text:V.answers[e],quiz_type:S.toString(),total_questions:g.length})}(t)},status:G(t)},e)}))),null!==p&&c.default.createElement(ct,{onClick:function(){I<g.length-1?(k({type:v.setCurrentQuestionIndex,payload:I+1}),h(null),q&&(u(Gr.Stop),f(0))):(e("/results"),a("quiz_complete",{quiz_id:y,questions_answered:R.length,restarted:P,correct_responses:_,quiz_type:S.toString(),total_questions:g.length}))},superButton:!0},"Next ",c.default.createElement(wr,{className:"ml-8"})),null!==p&&c.default.createElement(ye,{className:s.default(ra,"mt-24 p-24"),explanation:V.explanation})))}});exports.Quiz=B; | ||
//# sourceMappingURL=quiz-components.cjs.production.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"deepmerge";import t,{createContext as r,useReducer as n,useState as a,useEffect as o,useCallback as c,useContext as l,Suspense as i,lazy as s,forwardRef as d,isValidElement as u,Children as m,cloneElement as f,useMemo as p,useRef as b}from"react";import{MemoryRouter as v,Routes as h,Route as y,useNavigate as x,Link as E}from"react-router-dom";import g from"classnames";import{useMediaQuery as w}from"react-responsive";var N=r({}),S=N.Provider,I=function(){return I=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},I.apply(this,arguments)};function _(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}function O(e,t,r,n){return new(r||(r=Promise))((function(a,o){function c(e){try{i(n.next(e))}catch(e){o(e)}}function l(e){try{i(n.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,l)}i((n=n.apply(e,t||[])).next())}))}function j(e,t){var r,n,a,o,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,n=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(a=c.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){c.label=o[1];break}if(6===o[0]&&c.label<a[1]){c.label=a[1],a=o;break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(o);break}a[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function C(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}var k,T={responseIndexes:[],correctResponses:0,currentQuestionIndex:0,restarted:!1,score:0,timerEnabled:!0,user:null,getLeaderboardResults:function(){return[]},dispatch:function(){}};function P(e,t){switch(t.type){case k.SetCorrectIndexes:return I(I({},e),{responseIndexes:t.payload});case k.SetCorrectResponses:return I(I({},e),{correctResponses:t.payload});case k.setCurrentQuestionIndex:return I(I({},e),{currentQuestionIndex:t.payload});case k.SetRestarted:return I(I({},e),{restarted:t.payload});case k.SetScore:return I(I({},e),{score:t.payload});case k.SetTimerEnabled:return I(I({},e),{timerEnabled:t.payload});default:throw new Error("Please make sure to use the right action type reducer.")}}!function(e){e[e.SetCorrectIndexes=0]="SetCorrectIndexes",e[e.SetCorrectResponses=1]="SetCorrectResponses",e[e.setCurrentQuestionIndex=2]="setCurrentQuestionIndex",e[e.SetRestarted=3]="SetRestarted",e[e.SetScore=4]="SetScore",e[e.SetTimerEnabled=5]="SetTimerEnabled"}(k||(k={}));var M,L,R=r(T),z=function(e){var r=e.children,a=e.value,o=n(P,T),c=o[0],l=o[1];return t.createElement(R.Provider,{value:I(I(I({},c),a),{dispatch:l})},r)},q={quizContainer:"eb-16RLBn"},A=r(q),V=A.Provider;function B(){var e=a(!1),t=e[0],r=e[1];return o((function(){void 0!==window.gtag&&r(!0)}),[]),{event:c((function(e,r){t&&window.gtag("event",e,r)}),[t])}}function H(){return l(N)}function G(){return l(R)}!function(e){e.TextMultipleChoice="TEXT_MULTIPLE_CHOICE",e.ImageMultipleChoice="IMAGE_MULTIPLE_CHOICE"}(M||(M={})),function(e){e[e.XsMin=0]="XsMin",e[e.XsMax=671]="XsMax",e[e.SmMin=672]="SmMin",e[e.SmMax=959]="SmMax",e[e.MdMin=960]="MdMin",e[e.MdMax=1247]="MdMax",e[e.LgMin=1248]="LgMin",e[e.LgMax=1399]="LgMax",e[e.XlMin=1400]="XlMin"}(L||(L={}));var F={Box:"eb-ASYLqS",snowBackground:"eb-ZLkp2m",whiteBackground:"eb-DGfpHy",iceBackground:"eb-Nvt3tb",rainBorder:"eb-cMrTGF",grayBorder:"eb-94S9mY",rounded:"eb-GHgeM2",shadow:"eb-PiP0Bt"},D=function(e){var r,n,a=e.children,o=e.className,c=e.backgroundColor,l=void 0===c?"white":c,i=e.borderColor,s=void 0===i?"gray":i,d=e.rounded,u=void 0!==d&&d,m=e.shadow,f=void 0!==m&&m,p=_(e,["children","className","backgroundColor","borderColor","rounded","shadow"]);return t.createElement("div",I({className:g(F.Box,(r={},r[F.rounded]=u,r),(n={},n[F.shadow]=f,n),F["".concat(l,"Background")],F["".concat(s,"Border")],o),"data-testid":"Box"},p),a)},Q=s((function(){return Promise.resolve().then((function(){return St}))})),W=function(e){return t.createElement(i,{fallback:null},t.createElement(Q,I({},e)))},X=s((function(){return Promise.resolve().then((function(){return At}))})),U=function(e){return t.createElement(i,{fallback:null},t.createElement(X,I({},e)))},Z=s((function(){return Promise.resolve().then((function(){return kr}))})),K=function(e){return t.createElement(i,{fallback:null},t.createElement(Z,I({},e)))},Y=function(){return t.createElement(v,null,t.createElement(h,null,t.createElement(y,{path:"/",element:t.createElement(U,null)}),t.createElement(y,{path:"/:questionId",element:t.createElement(K,null)}),t.createElement(y,{path:"/results",element:t.createElement(W,null)})))},J=function(e){var r=e.template,n=l(A).quizContainer,a=B().event,c=H(),i=c.id,s=c.questions,d=c.type,u=G(),m=u.correctResponses,f=u.restarted,p=u.responseIndexes;return o((function(){function e(){p.length<s.length&&a("quiz_abandoned",{quiz_id:i,questions_answered:p.length,restarted:f,correct_responses:m,quiz_type:d.toString(),total_questions:s.length})}return window.addEventListener("beforeunload",e),function(){return window.removeEventListener("beforeunload",e)}}),[i,p,m,s.length,a,f,d]),t.createElement(D,{className:n,borderColor:"rain",rounded:!0,"data-testid":"TemplateLoader"},r===M.TextMultipleChoice&&t.createElement(Y,null))},$=function(r){var n=r.data,a=r.template,o=r.theme,c=void 0===o?{}:o,l=r.user,i=r.onLeaderboardResults;return t.createElement(V,{value:e(q,c)},t.createElement(S,{value:n},t.createElement(z,{value:{getLeaderboardResults:i,user:l}},t.createElement(J,{template:a}))))},ee="eb-6lGJ0X",te="eb-hAkxpo",re="eb-HLIy3V",ne="eb-VsNFkm",ae="eb-6nDHds",oe="eb-DBAmCC",ce="eb-HjILKR",le=function(){var e=H().questions,r=G().responseIndexes;return t.createElement("div",{className:ee,"data-testid":"AnswersTab"},e.map((function(e,n){var a=e.text,o=e.answers,c=e.correctAnswerIndex,l=e.explanation;return t.createElement("div",{className:g(te,"mb-32"),key:a},t.createElement("div",{className:re},n+1),t.createElement("div",{className:g(ne,"font-weight-semi-bold"),dangerouslySetInnerHTML:{__html:a}}),t.createElement("div",{className:ae},t.createElement("div",{className:g(c===r[n]?ce:oe)},"Your Answer: ",o[r[n]]),t.createElement("div",null,"Correct Answer: ",o[c]),t.createElement("div",{className:"mt-16",dangerouslySetInnerHTML:{__html:l}})))})))};var ie="eb-KmoX7Q",se="eb-z33RWL",de="eb-Hq5iFO",ue=function(){var e=function(){var e=H(),t=e.metadata,r=e.id,n=G().getLeaderboardResults,o=a(),c=o[0],l=o[1];return{leaderboardResults:c,getLeaderboardResults:function(){return O(this,void 0,void 0,(function(){var e,a;return j(this,(function(o){switch(o.label){case 0:return[4,fetch("".concat("https://9zdy2kcoy6.execute-api.us-east-1.amazonaws.com","/dev/leaderboard?appId=").concat(t.source,"&quizId=").concat(r))];case 1:return[4,o.sent().json()];case 2:return e=o.sent(),[4,n(e)];case 3:return a=o.sent(),l(a),[2]}}))}))}}}(),r=e.leaderboardResults,n=e.getLeaderboardResults;return o((function(){n()}),[]),console.log(r),t.createElement("div",{className:de,"data-testid":"LeaderboardTab"},t.createElement(D,{className:ie,backgroundColor:"snow",borderColor:"rain",rounded:!0},"All Quizzes",null==r?void 0:r.map((function(e){return t.createElement("div",{key:e.id},e.score)}))),t.createElement(D,{className:se,backgroundColor:"white",borderColor:"rain",rounded:!0},"This Quiz"))},me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function fe(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var pe,be={},ve={exports:{}},he={};function ye(){if(pe)return he;pe=1;var e=t,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,n){var l,i={},s=null,d=null;for(l in void 0!==n&&(s=""+n),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(d=t.ref),t)a.call(t,l)&&!c.hasOwnProperty(l)&&(i[l]=t[l]);if(e&&e.defaultProps)for(l in t=e.defaultProps)void 0===i[l]&&(i[l]=t[l]);return{$$typeof:r,type:e,key:s,ref:d,props:i,_owner:o.current}}return he.Fragment=n,he.jsx=l,he.jsxs=l,he}function xe(e,t){if(!t)return e;var r=Object.prototype.hasOwnProperty;return Object.keys(t).reduce((function(n,a){return r.call(t,a)&&t[a]&&(n="".concat(n," ").concat(e,"--").concat(a)),n}),e)}function Ee(e){return function(t,r){return t?"string"!=typeof t?xe(e,t):xe("".concat(e,"__").concat(t),r):e}}ve.exports=ye();var ge=function(){return ge=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},ge.apply(this,arguments)},we=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},Ne=Ee("rmd-icon"),Se=d((function(e,t){var r=e.className,n=e.children,a=e["aria-hidden"],o=void 0===a||a,c=e.dense,l=void 0!==c&&c,i=e.iconClassName,s=void 0===i?"material-icons":i,d=e.forceSize,u=void 0!==d&&d,m=e.forceFontSize,f=void 0!==m&&m,p=we(e,["className","children","aria-hidden","dense","iconClassName","forceSize","forceFontSize"]);return ve.exports.jsx("i",ge({},p,{"aria-hidden":o,ref:t,className:g(Ne({font:!0,dense:l,"forced-font":f,"forced-size":u}),s,r)},{children:n}))})),Ie=function(){return Ie=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ie.apply(this,arguments)},_e=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},Oe=Ee("rmd-icon"),je=d((function(e,t){var r=e["aria-hidden"],n=void 0===r||r,a=e.focusable,o=void 0===a?"false":a,c=e.xmlns,l=void 0===c?"http://www.w3.org/2000/svg":c,i=e.viewBox,s=void 0===i?"0 0 24 24":i,d=e.dense,u=void 0!==d&&d,m=e.className,f=e.use,p=e.children,b=_e(e,["aria-hidden","focusable","xmlns","viewBox","dense","className","use","children"]),v=p;return!v&&f&&(v=ve.exports.jsx("use",{xlinkHref:f})),ve.exports.jsx("svg",Ie({},b,{"aria-hidden":n,ref:t,className:g(Oe({svg:!0,dense:u}),m),focusable:o,xmlns:l,viewBox:s},{children:v}))})),Ce=function(){return Ce=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ce.apply(this,arguments)};var ke=function(){return ke=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},ke.apply(this,arguments)},Te=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},Pe=Ee("rmd-icon-rotator"),Me=d((function(e,t){var r=e.style,n=e.className,a=e.animate,o=void 0===a||a,c=e.rotated,l=e.children,i=e.forceIconWrap,s=void 0!==i&&i,d=Te(e,["style","className","animate","rotated","children","forceIconWrap"]),p=g(Pe({animate:o,rotated:c}),n);if(!s&&u(l)){var b=m.only(l);return f(b,{className:g(p,b.props.className)})}return ve.exports.jsx("span",ke({},d,{style:r,className:p,ref:t},{children:l}))})),Le=function(){return Le=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Le.apply(this,arguments)},Re={back:ve.exports.jsx(Se,{children:"keyboard_arrow_left"}),checkbox:ve.exports.jsx(Se,{children:"check_box"}),upload:ve.exports.jsx(Se,{children:"file_upload"}),dropdown:ve.exports.jsx(Se,{children:"arrow_drop_down"}),error:ve.exports.jsx(Se,{children:"error_outline"}),expander:ve.exports.jsx(Se,{children:"keyboard_arrow_down"}),forward:ve.exports.jsx(Se,{children:"keyboard_arrow_right"}),menu:ve.exports.jsx(Se,{children:"menu"}),notification:ve.exports.jsx(Se,{children:"notifications"}),password:ve.exports.jsx(Se,{children:"remove_red_eye"}),radio:ve.exports.jsx(Se,{children:"radio_button_checked"}),selected:ve.exports.jsx(Se,{children:"check"}),sort:ve.exports.jsx(Se,{children:"arrow_upward"})},ze=r(Re),qe=ze.Provider;var Ae=fe(Object.freeze({__proto__:null,FontIcon:Se,SVGIcon:je,TextIconSpacing:function(e){var t,r=e.className,n=e.icon,a=e.children,o=void 0===a?null:a,c=e.stacked,l=void 0!==c&&c,i=e.iconAfter,s=void 0!==i&&i,d=e.flexReverse,p=void 0!==d&&d,b=e.forceIconWrap,v=void 0!==b&&b,h=e.beforeClassName,y=void 0===h?"rmd-icon--before":h,x=e.afterClassName,E=void 0===x?"rmd-icon--after":x,w=e.aboveClassName,N=void 0===w?"rmd-icon--above":w,S=e.belowClassName,I=void 0===S?"rmd-icon--below":S;if(!n)return ve.exports.jsx(ve.exports.Fragment,{children:o});var _=p?!s:s,O=g(((t={})[y]=!l&&!_,t[E]=!l&&_,t[N]=l&&!_,t[I]=l&&_,t),r),j=n,C=o;if(!v&&u(n)){var k=m.only(n);j=f(k,{className:g(O,k.props.className)})}else n&&(j=ve.exports.jsx("span",Ce({className:g("rmd-text-icon-spacing",O)},{children:n})));return j&&(C=ve.exports.jsxs(ve.exports.Fragment,{children:[!s&&j,o,s&&j]})),ve.exports.jsx(ve.exports.Fragment,{children:C})},IconRotator:Me,useIcon:function(e,t){var r=l(ze);return void 0!==t?t:r[e]},IconProvider:function(e){var t=e.children,r=e.back,n=void 0===r?Re.back:r,a=e.checkbox,o=void 0===a?Re.checkbox:a,c=e.dropdown,l=void 0===c?Re.dropdown:c,i=e.expander,s=void 0===i?Re.expander:i,d=e.error,u=void 0===d?Re.error:d,m=e.forward,f=void 0===m?Re.forward:m,b=e.menu,v=void 0===b?Re.menu:b,h=e.notification,y=void 0===h?Re.notification:h,x=e.password,E=void 0===x?Re.password:x,g=e.radio,w=void 0===g?Re.radio:g,N=e.selected,S=void 0===N?Re.selected:N,I=e.sort,_=void 0===I?Re.sort:I,O=e.upload,j=void 0===O?Re.upload:O,C=p((function(){return{back:n,checkbox:o,dropdown:l,error:u,expander:s,forward:f,menu:v,notification:y,password:E,radio:w,selected:S,sort:_,upload:j}}),[n,o,l,u,s,f,v,y,E,w,S,_,j]);return ve.exports.jsx(qe,Le({value:C},{children:t}))}})),Ve=me&&me.__assign||function(){return Ve=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ve.apply(this,arguments)};Object.defineProperty(be,"__esModule",{value:!0});var Be=be.ReplaySVGIcon=void 0,He=ve.exports,Ge=t,Fe=Ae;Be=be.ReplaySVGIcon=(0,Ge.forwardRef)((function(e,t){return(0,He.jsx)(Fe.SVGIcon,Ve({},e,{ref:t},{children:(0,He.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"})}))}));var De,Qe="eb-h0JoJS",We="eb-g0oWRe",Xe="eb-cDH2ZZ",Ue="eb-PMfRkP",Ze="eb-6MTWIi",Ke="eb-P5IGFV",Ye="eb-R87VrN";!function(e){e.Left="left",e.Right="right"}(De||(De={}));var Je,$e=function(e){var r,n,a,o,c=e.block,l=void 0!==c&&c,i=e.children,s=e.className,d=e.icon,u=e.iconPosition,m=void 0===u?De.Left:u,p=e.outline,b=void 0!==p&&p,v=e.shadow,h=void 0!==v&&v,y=e.tag,x=void 0===y?"button":y,E=_(e,["block","children","className","icon","iconPosition","outline","shadow","tag"]);return t.createElement(x,I({className:g(Qe,(r={},r[We]=l,r),(n={},n[Ue]=d,n),(a={},a[Xe]=b,a),(o={},o[Ye]=h,o),s),"data-testid":"Button"},E),m===De.Left&&d&&f(d,{className:g(d.props.className,Ze)}),i,m===De.Right&&d&&f(d,{className:g(d.props.className,Ke)}))},et=function(){var e=H().nextUpQuiz,r=e.image,n=e.url,a=e.title;return t.createElement(D,{borderColor:"rain",className:"mt-20","data-testid":"NextUpQuizCard",rounded:!0,shadow:!0},t.createElement("div",{style:{aspectRatio:"4/3"}},t.createElement("img",{src:r.fullUrl,alt:r.altText})),t.createElement("div",{className:"p-20"},t.createElement("a",{href:n},a),t.createElement($e,{tag:"a",href:n,className:"mt-20",block:!0},"Play")))},tt="eb-fQMdMF",rt="eb-i8uKTc",nt="eb-ZBrDqu",at="eb-FOeG4W",ot="eb-fQceh4",ct="eb-vzHSa2",lt="eb-sS9sRH",it=function(){var e=G(),r=e.correctResponses,n=e.score,a=H().questions,o=r/a.length*100;return t.createElement("div",{className:tt,"data-testid":"ScoreSummaryWheel"},t.createElement("div",{className:g(ot,"px-12 py-8 font-weight-semi-bold")},"Congrats!"),t.createElement("svg",{viewBox:"0 0 36 36",className:rt},t.createElement("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",className:at}),t.createElement("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",className:nt,strokeDasharray:"".concat(o," 100")})),t.createElement("div",{className:g(ct,"text-center")},t.createElement("div",{className:g(lt,"font-weight-super-bold")},r,"/",a.length),t.createElement("div",{className:"font-12"},n," points")))},st="eb-od4oX9",dt="eb-F71AtK",ut="eb-EM5HVl",mt="eb-yx3D4X",ft=function(){var e=w({maxWidth:L.XsMax}),r=H().title,n=x(),a=G().dispatch;return t.createElement("div",{"data-testid":"ScoreTab",className:st},t.createElement(D,{className:dt,borderColor:"rain",backgroundColor:"ice",rounded:!e,shadow:!e},t.createElement("div",{className:ut},t.createElement("div",{className:"font-18 font-weight-semi-bold"},r),t.createElement(it,null),t.createElement($e,{icon:t.createElement(Be,null),onClick:function(){a({type:k.SetScore,payload:0}),a({type:k.SetCorrectIndexes,payload:[]}),a({type:k.SetCorrectResponses,payload:0}),a({type:k.setCurrentQuestionIndex,payload:0}),a({type:k.SetRestarted,payload:!0}),n("/")},outline:!0,shadow:!0},"Play Again")),t.createElement("div",{className:mt},t.createElement("div",{className:"font-weight-extra-bold font-24"},"Next Up!"),t.createElement(et,null))))},pt=r({activeTabId:"default",setActiveTabId:function(){}}),bt=function(e){var r=e.children,n=e.defaultActiveTabId,o=a(n),c=o[0],l=o[1];return t.createElement(pt.Provider,{value:{activeTabId:c,setActiveTabId:l}},r)},vt="eb-fkZcg2",ht="eb-ntGIO4",yt=function(e){var r,n=e.children,a=e.className,o=e.controlFor,c=l(pt),i=c.setActiveTabId,s=c.activeTabId===o;return t.createElement("button",{className:g(vt,(r={},r[ht]=s,r),a),"data-testid":"Tab",id:"".concat(o,"-tab"),role:"tab","aria-controls":o,"aria-selected":s,tabIndex:s?void 0:-1,onClick:function(){return i(o)}},n)},xt=function(e){var r=e.children,n=e.className,a=e.id,o=_(e,["children","className","id"]);return a===l(pt).activeTabId?t.createElement("div",I({id:a,className:n,"data-testid":"TabContent",tabIndex:0,role:"tabpanel","aria-labelledby":"".concat(a,"-tab")},o),r):null},Et="eb-ftdu2H",gt=function(e){var r=e.children,n=e.className,a=e.label;return t.createElement("div",{className:g(Et,n),"data-testid":"Tabs",role:"tablist","aria-label":a},r)},wt="eb-vDPeCr",Nt="eb-bMiWKa";!function(e){e.AnswersTab="AnswersTab",e.LeaderboardTab="LeaderboardTab",e.ScoreTab="ScoreTab"}(Je||(Je={}));var St=Object.freeze({__proto__:null,default:function(){var e=H().image;return t.createElement("div",{"data-testid":"ResultsView",className:wt,style:{backgroundImage:"url(".concat(e.fullUrl,")")}},t.createElement(bt,{defaultActiveTabId:Je.ScoreTab},t.createElement(gt,{label:"Results View"},t.createElement(yt,{controlFor:Je.ScoreTab},"Score"),t.createElement(yt,{controlFor:Je.AnswersTab},"Answers"),t.createElement(yt,{controlFor:Je.LeaderboardTab},"Leaderboard")),t.createElement(xt,{className:Nt,id:Je.ScoreTab},t.createElement(ft,null)),t.createElement(xt,{className:Nt,id:Je.AnswersTab},t.createElement(le,null)),t.createElement(xt,{className:Nt,id:Je.LeaderboardTab},t.createElement(ue,null))))}}),It="eb-8LB0Z6",_t="eb-xrnrMX",Ot="eb-uQ6x3r",jt="eb-RTZJDf",Ct="eb-XBUSmk",kt="eb-6uIIpF",Tt="eb-WrBwzW",Pt="eb-LlKpPo",Mt=function(e){var r,n=e.children,a=e.className,o=e.bgColor,c=void 0===o?void 0:o,l=e.outline;return t.createElement("div",{className:g(Tt,(r={},r[Pt]=l,r),a),style:{backgroundColor:c},"data-testid":"Badge"},n)},Lt="eb-FGnvGm",Rt=function(e){var r=e.children;return t.createElement("div",{className:Lt,"data-testid":"SwitchControl"},r)},zt="eb-FxfgLd",qt=function(e){var r=e.id,n=_(e,["id"]);return t.createElement("input",I({id:r,className:zt,type:"checkbox",role:"switch"},n))},At=Object.freeze({__proto__:null,default:function(){var e=H(),r=e.id,n=e.categories,a=e.image,o=e.title,c=e.timed,l=e.questions,i=G(),s=i.dispatch,d=i.timerEnabled;return t.createElement("div",{className:It,"data-testid":"IntroView",style:{aspectRatio:"900 / 675"}},t.createElement("img",{className:_t,src:a.fullUrl,alt:a.altText}),t.createElement("div",{className:Ot},t.createElement(D,{className:Ct,rounded:!0,shadow:!0},t.createElement("div",{className:jt},t.createElement(Mt,{bgColor:"var(--qc-ice)",outline:!0},n[0].label)),t.createElement("h1",null,o),t.createElement($e,{tag:E,to:"/".concat(r),block:!0},"Start"),t.createElement("div",{className:g(kt,"pt-16")},t.createElement("div",null,l.length," Questions"),c&&t.createElement(Rt,null,t.createElement("label",{htmlFor:"toggle"},"Timer on"),t.createElement(qt,{id:"".concat(r),defaultChecked:d,onClick:function(){return s({type:k.SetTimerEnabled,payload:!d})}}))))))}}),Vt={},Bt=me&&me.__assign||function(){return Bt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Bt.apply(this,arguments)};Object.defineProperty(Vt,"__esModule",{value:!0});var Ht=Vt.ArrowForwardSVGIcon=void 0,Gt=ve.exports,Ft=t,Dt=Ae;Ht=Vt.ArrowForwardSVGIcon=(0,Ft.forwardRef)((function(e,t){return(0,Gt.jsx)(Dt.SVGIcon,Bt({},e,{ref:t},{children:(0,Gt.jsx)("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})}))}));var Qt={},Wt=me&&me.__assign||function(){return Wt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Wt.apply(this,arguments)};Object.defineProperty(Qt,"__esModule",{value:!0});var Xt=Qt.CloseSVGIcon=void 0,Ut=ve.exports,Zt=t,Kt=Ae;Xt=Qt.CloseSVGIcon=(0,Zt.forwardRef)((function(e,t){return(0,Ut.jsx)(Kt.SVGIcon,Wt({},e,{ref:t},{children:(0,Ut.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}));var Yt={},Jt=me&&me.__assign||function(){return Jt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Jt.apply(this,arguments)};Object.defineProperty(Yt,"__esModule",{value:!0});var $t=Yt.CheckSVGIcon=void 0,er=ve.exports,tr=t,rr=Ae;$t=Yt.CheckSVGIcon=(0,tr.forwardRef)((function(e,t){return(0,er.jsx)(rr.SVGIcon,Jt({},e,{ref:t},{children:(0,er.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})}))}));var nr,ar={answerButtonContainer:"eb-hm0P2D",answerButton:"eb-EkupIl",selected:"eb-p8ZbDY",correct:"eb-5WC5qo",correctSelected:"eb-Z1YT6r",incorrectSelected:"eb-V0bjjy",disabled:"eb-N51x3L",default:"eb-e7y9O4",icon:"eb-8I8Gjv",correctIcon:"eb-NVqaa3",incorrectIcon:"eb-5sHpoZ"};!function(e){e.Correct="correct",e.CorrectSelected="correctSelected",e.Default="default",e.IncorrectSelected="incorrectSelected",e.Selected="selected"}(nr||(nr={}));var or=function(e){var r,n=e.children,a=e.status,o=void 0===a?nr.Default:a,c=e.disabled,l=_(e,["children","status","disabled"]);return t.createElement("div",{className:ar.answerButtonContainer},nr.CorrectSelected===o&&t.createElement($t,{className:g(ar.icon,ar.correctIcon,"font-12 p-4")}),nr.IncorrectSelected===o&&t.createElement(Xt,{className:g(ar.icon,ar.incorrectIcon,"font-12 p-4")}),t.createElement($e,I({className:g(ar.answerButton,o&&ar[o],(r={},r[ar.disabled]=c,r)),outline:!0,block:!0,disabled:c},l),n))},cr={},lr=me&&me.__assign||function(){return lr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},lr.apply(this,arguments)};Object.defineProperty(cr,"__esModule",{value:!0});var ir=cr.LightbulbOutlineSVGIcon=void 0,sr=ve.exports,dr=t,ur=Ae;ir=cr.LightbulbOutlineSVGIcon=(0,dr.forwardRef)((function(e,t){return(0,sr.jsx)(ur.SVGIcon,lr({},e,{ref:t},{children:(0,sr.jsx)("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"})}))}));var mr,fr,pr,br="eb-dV9X8L",vr=function(e){var r=e.className,n=e.explanation;return t.createElement("div",{className:g(br,r),"data-testid":"Explanation"},t.createElement(ir,{className:"mr-8"})," ",t.createElement("span",{className:"m-0",dangerouslySetInnerHTML:{__html:n}}))},hr="eb-fKHH4k",yr="eb-Ka5TRS",xr="eb-eQLIHc",Er="eb-YcibRH",gr="eb-pAHhPN";!function(e){e.Play="play",e.Pause="pause",e.Stop="stop"}(mr||(mr={})),function(e){e.Correct="var(--qc-green)",e.Incorrect="var(--qc-red)",e.Default="var(--qc-blue-200)"}(fr||(fr={})),function(e){e.Left="left",e.Right="right"}(pr||(pr={}));var wr=function(e){var r=e.labelMessage,n=e.labelPosition,c=void 0===n?pr.Left:n,l=e.onExpire,i=e.status,s=e.theme,d=void 0===s?fr.Default:s,u=e.time,m=void 0===u?15:u,f=e.timerRef,p=a(m),v=p[0],h=p[1],y=a(!1),x=y[0],E=y[1],g=b(0);function w(){clearInterval(g.current)}return o((function(){return i===mr.Play&&function(){0===v&&h(m);g.current=window.setInterval((function(){return h((function(e){return e-1}))}),1e3)}(),i===mr.Stop&&(clearInterval(g.current),h(m)),i===mr.Pause&&w(),function(){clearInterval(g.current),E(!1)}}),[i]),o((function(){0===v&&(w(),E(!0),l&&l())}),[v]),t.createElement("div",{className:hr,"data-testid":"Timer"},c===pr.Left&&t.createElement("div",{className:Er},!v&&t.createElement(Mt,{bgColor:fr.Incorrect},"Time's Up!"),r&&!!v&&t.createElement(Mt,{bgColor:d},r)),t.createElement("div",{className:yr},t.createElement("svg",null,t.createElement("circle",{cx:"23",cy:"23",r:"23",style:{stroke:x?fr.Incorrect:"var(--qc-rain)"}}),t.createElement("circle",{cx:"23",cy:"23",r:"23",style:{stroke:d,strokeDashoffset:145-145*v/m}})),t.createElement("p",{ref:f,className:xr},v)),c===pr.Right&&t.createElement("div",{className:gr},!v&&t.createElement(Mt,{bgColor:fr.Incorrect},"Time's Up!"),r&&!!v&&t.createElement(Mt,{bgColor:d},r)))},Nr="eb-db86L8",Sr="eb-fl8Stz",Ir="eb-MbWQdV",_r=function(e){var r=e.title,n=e.timerEnabled,a=void 0===n||n,o=e.timerRef,c=e.timerScore,l=e.timerStatus,i=void 0===l?mr.Stop:l,s=e.timerTheme,d=void 0===s?fr.Default:s,u=e.timerTime,m=void 0===u?15:u,f=e.onTimerExpire,p=e.totalScore,b=void 0===p?0:p,v=e.currentCount,h=void 0===v?0:v,y=e.totalCount,x=void 0===y?0:y,E=w({maxWidth:L.MdMin});return t.createElement("div",{className:g(Nr,"p-4")},t.createElement("span",{className:g(Ir,"pl-16")},r),t.createElement("div",{className:g(Sr,"px-16")},a&&t.createElement(wr,{time:m,timerRef:o,theme:d,status:i,onExpire:f,labelMessage:c?"+".concat(c):void 0,labelPosition:E?pr.Right:pr.Left}),t.createElement("div",{className:"pl-24"},t.createElement("span",{className:"font-weight-bold "},h)," of"," ",t.createElement("span",{className:"font-weight-bold"},x)),t.createElement("div",{className:"pl-24"},"Score: ",t.createElement("span",{className:"font-weight-bold"},b))))},Or="eb-NelLRW",jr="eb-nXyIBf",Cr="eb-VgMNit",kr=Object.freeze({__proto__:null,default:function(){var e=x(),r=B().event,n=b(null),c=a(mr.Stop),l=c[0],i=c[1],s=a(0),d=s[0],u=s[1],m=a(null),f=m[0],p=m[1],v=H(),h=v.id,y=v.title,E=v.questions,w=v.seconds,N=v.type,S=G(),I=S.currentQuestionIndex,_=S.correctResponses,O=S.dispatch,j=S.responseIndexes,T=S.restarted,P=S.score,M=S.timerEnabled,L=E[I];function R(e){var t,a,o=e===L.correctAnswerIndex;if(o){var c=function(e,t,r){return r?100*t+10*Math.min(e,10):100*t}((null===(t=n.current)||void 0===t?void 0:t.innerHTML)?+(null===(a=n.current)||void 0===a?void 0:a.innerHTML):0,L.difficulty,M);u(c),O({type:k.SetScore,payload:c+P}),O({type:k.SetCorrectResponses,payload:_+1})}p(e),i(mr.Pause),O({type:k.SetCorrectIndexes,payload:C(C([],j,!0),[e],!1)}),r("question_answered",{quiz_id:h,question_index:I,answer_index:e,answered_correctly:o,answer_text:L.answers[e],quiz_type:N.toString(),total_questions:E.length})}function z(e){return e===f&&f===L.correctAnswerIndex?nr.CorrectSelected:e===f&&f!==L.correctAnswerIndex?nr.IncorrectSelected:null!==f&&e===L.correctAnswerIndex?nr.Correct:nr.Default}return o((function(){return M&&i(mr.Play),function(){M&&i(mr.Stop)}}),[I,M]),t.createElement("div",{"data-testid":"QuestionView"},t.createElement(_r,{currentCount:I+1,onTimerExpire:function(){p(-1)},title:y,totalCount:E.length,totalScore:P,timerEnabled:M,timerRef:n,timerScore:d,timerStatus:l,timerTime:w,timerTheme:f===L.correctAnswerIndex?fr.Correct:null!==f&&f!==L.correctAnswerIndex?fr.Incorrect:fr.Default}),t.createElement(D,{className:g(Or),backgroundColor:"ice"},t.createElement("div",{className:"p-24",dangerouslySetInnerHTML:{__html:L.text}}),t.createElement("div",{className:g(jr,"p-24")},L.answers.map((function(e,r){return t.createElement(or,{disabled:null!==f,key:e,onClick:function(){return R(r)},status:z(r)},e)}))),null!==f&&t.createElement($e,{onClick:function(){I<E.length-1?(O({type:k.setCurrentQuestionIndex,payload:I+1}),p(null),M&&(i(mr.Stop),u(0))):(e("/results"),r("quiz_complete",{quiz_id:h,questions_answered:j.length,restarted:T,correct_responses:_,quiz_type:N.toString(),total_questions:E.length}))}},"Next ",t.createElement(Ht,{className:"ml-8"})),null!==f&&t.createElement(vr,{className:g(Cr,"mt-24 p-24"),explanation:L.explanation})))}});export{L as Breakpoint,$ as Quiz,M as Template}; | ||
import e from"deepmerge";import t,{createContext as r,useReducer as n,useState as a,useEffect as o,useCallback as c,useContext as l,Suspense as s,lazy as i,forwardRef as d,isValidElement as u,Children as m,cloneElement as f,useMemo as p,useRef as v}from"react";import{MemoryRouter as b,Routes as h,Route as y,useNavigate as E,Link as g}from"react-router-dom";import x from"classnames";import{useMediaQuery as w}from"react-responsive";var N=r({}),S=N.Provider,I=function(){return I=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},I.apply(this,arguments)};function O(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}function C(e,t,r,n){return new(r||(r=Promise))((function(a,o){function c(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,l)}s((n=n.apply(e,t||[])).next())}))}function j(e,t){var r,n,a,o,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,n=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(a=c.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){c.label=o[1];break}if(6===o[0]&&c.label<a[1]){c.label=a[1],a=o;break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(o);break}a[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function _(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}var T,k={responseIndexes:[],correctResponses:0,currentQuestionIndex:0,restarted:!1,totalCorrectScore:0,totalScore:0,totalTimerScore:0,timerEnabled:!0,user:null,getLeaderboardResults:function(){return C(void 0,void 0,void 0,(function(){return j(this,(function(e){return[2,[]]}))}))},dispatch:function(){}};function R(e,t){switch(t.type){case T.SetCorrectIndexes:return I(I({},e),{responseIndexes:t.payload});case T.SetCorrectResponses:return I(I({},e),{correctResponses:t.payload});case T.setCurrentQuestionIndex:return I(I({},e),{currentQuestionIndex:t.payload});case T.SetRestarted:return I(I({},e),{correctResponses:k.correctResponses,currentQuestionIndex:k.currentQuestionIndex,responseIndexes:k.responseIndexes,restarted:!0,totalCorrectScore:k.totalCorrectScore,totalScore:k.totalScore,totalTimerScore:k.totalTimerScore});case T.setTotalCorrectScore:return I(I({},e),{totalCorrectScore:t.payload});case T.SetTotalScore:return I(I({},e),{totalScore:t.payload});case T.setTotalTimerScore:return I(I({},e),{totalTimerScore:t.payload});case T.SetTimerEnabled:return I(I({},e),{timerEnabled:t.payload});default:throw new Error("Please make sure to use the right action type reducer.")}}!function(e){e[e.SetCorrectIndexes=0]="SetCorrectIndexes",e[e.SetCorrectResponses=1]="SetCorrectResponses",e[e.setCurrentQuestionIndex=2]="setCurrentQuestionIndex",e[e.SetRestarted=3]="SetRestarted",e[e.setTotalCorrectScore=4]="setTotalCorrectScore",e[e.SetTotalScore=5]="SetTotalScore",e[e.setTotalTimerScore=6]="setTotalTimerScore",e[e.SetTimerEnabled=7]="SetTimerEnabled"}(T||(T={}));var P,M,L=r(k),z=function(e){var r=e.children,a=e.value,o=n(R,k),c=o[0],l=o[1];return t.createElement(L.Provider,{value:I(I(I({},c),a),{dispatch:l})},r)},G={quizContainer:"eb-16RLBn"},V=r(G),q=V.Provider;function A(){var e=a(!1),t=e[0],r=e[1];return o((function(){void 0!==window.gtag&&r(!0)}),[]),{event:c((function(e,r){t&&window.gtag("event",e,r)}),[t])}}function B(){return l(N)}function F(){return l(L)}!function(e){e.TextMultipleChoice="TEXT_MULTIPLE_CHOICE",e.ImageMultipleChoice="IMAGE_MULTIPLE_CHOICE"}(P||(P={})),function(e){e[e.XsMin=0]="XsMin",e[e.XsMax=671]="XsMax",e[e.SmMin=672]="SmMin",e[e.SmMax=959]="SmMax",e[e.MdMin=960]="MdMin",e[e.MdMax=1247]="MdMax",e[e.LgMin=1248]="LgMin",e[e.LgMax=1399]="LgMax",e[e.XlMin=1400]="XlMin"}(M||(M={}));var H={Box:"eb-ASYLqS",snowBackground:"eb-ZLkp2m",whiteBackground:"eb-DGfpHy",iceBackground:"eb-Nvt3tb",rainBorder:"eb-cMrTGF",grayBorder:"eb-94S9mY",rounded:"eb-GHgeM2",shadow:"eb-PiP0Bt"},Q=function(e){var r,n,a=e.children,o=e.className,c=e.backgroundColor,l=void 0===c?"white":c,s=e.borderColor,i=void 0===s?"gray":s,d=e.rounded,u=void 0!==d&&d,m=e.shadow,f=void 0!==m&&m,p=O(e,["children","className","backgroundColor","borderColor","rounded","shadow"]);return t.createElement("div",I({className:x(H.Box,(r={},r[H.rounded]=u,r),(n={},n[H.shadow]=f,n),H["".concat(l,"Background")],H["".concat(i,"Border")],o),"data-testid":"Box"},p),a)},D=i((function(){return Promise.resolve().then((function(){return Er}))})),U=function(e){return t.createElement(s,{fallback:null},t.createElement(D,I({},e)))},W=i((function(){return Promise.resolve().then((function(){return Rr}))})),X=function(e){return t.createElement(s,{fallback:null},t.createElement(W,I({},e)))},Z=i((function(){return Promise.resolve().then((function(){return yn}))})),Y=function(e){return t.createElement(s,{fallback:null},t.createElement(Z,I({},e)))},K=function(){return t.createElement(b,null,t.createElement(h,null,t.createElement(y,{path:"/",element:t.createElement(X,null)}),t.createElement(y,{path:"/:questionId",element:t.createElement(Y,null)}),t.createElement(y,{path:"/results",element:t.createElement(U,null)})))},J=function(e){var r=e.template,n=l(V).quizContainer,a=A().event,c=B(),s=c.id,i=c.questions,d=c.type,u=F(),m=u.correctResponses,f=u.restarted,p=u.responseIndexes;return o((function(){function e(){p.length<i.length&&a("quiz_abandoned",{quiz_id:s,questions_answered:p.length,restarted:f,correct_responses:m,quiz_type:d.toString(),total_questions:i.length})}return window.addEventListener("beforeunload",e),function(){return window.removeEventListener("beforeunload",e)}}),[s,p,m,i.length,a,f,d]),t.createElement(Q,{className:n,borderColor:"rain",rounded:!0,"data-testid":"TemplateLoader"},r===P.TextMultipleChoice&&t.createElement(K,null))},$=function(r){var n=r.data,a=r.template,o=r.theme,c=void 0===o?{}:o,l=r.user,s=r.onLeaderboardResults;return t.createElement(q,{value:e(G,c)},t.createElement(S,{value:n},t.createElement(z,{value:{getLeaderboardResults:s,user:l}},t.createElement(J,{template:a}))))},ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function te(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var re,ne={},ae={exports:{}},oe={};function ce(){if(re)return oe;re=1;var e=t,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,n){var l,s={},i=null,d=null;for(l in void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),void 0!==t.ref&&(d=t.ref),t)a.call(t,l)&&!c.hasOwnProperty(l)&&(s[l]=t[l]);if(e&&e.defaultProps)for(l in t=e.defaultProps)void 0===s[l]&&(s[l]=t[l]);return{$$typeof:r,type:e,key:i,ref:d,props:s,_owner:o.current}}return oe.Fragment=n,oe.jsx=l,oe.jsxs=l,oe}function le(e,t){if(!t)return e;var r=Object.prototype.hasOwnProperty;return Object.keys(t).reduce((function(n,a){return r.call(t,a)&&t[a]&&(n="".concat(n," ").concat(e,"--").concat(a)),n}),e)}function se(e){return function(t,r){return t?"string"!=typeof t?le(e,t):le("".concat(e,"__").concat(t),r):e}}ae.exports=ce();var ie=function(){return ie=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},ie.apply(this,arguments)},de=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},ue=se("rmd-icon"),me=d((function(e,t){var r=e.className,n=e.children,a=e["aria-hidden"],o=void 0===a||a,c=e.dense,l=void 0!==c&&c,s=e.iconClassName,i=void 0===s?"material-icons":s,d=e.forceSize,u=void 0!==d&&d,m=e.forceFontSize,f=void 0!==m&&m,p=de(e,["className","children","aria-hidden","dense","iconClassName","forceSize","forceFontSize"]);return ae.exports.jsx("i",ie({},p,{"aria-hidden":o,ref:t,className:x(ue({font:!0,dense:l,"forced-font":f,"forced-size":u}),i,r)},{children:n}))})),fe=function(){return fe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},fe.apply(this,arguments)},pe=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},ve=se("rmd-icon"),be=d((function(e,t){var r=e["aria-hidden"],n=void 0===r||r,a=e.focusable,o=void 0===a?"false":a,c=e.xmlns,l=void 0===c?"http://www.w3.org/2000/svg":c,s=e.viewBox,i=void 0===s?"0 0 24 24":s,d=e.dense,u=void 0!==d&&d,m=e.className,f=e.use,p=e.children,v=pe(e,["aria-hidden","focusable","xmlns","viewBox","dense","className","use","children"]),b=p;return!b&&f&&(b=ae.exports.jsx("use",{xlinkHref:f})),ae.exports.jsx("svg",fe({},v,{"aria-hidden":n,ref:t,className:x(ve({svg:!0,dense:u}),m),focusable:o,xmlns:l,viewBox:i},{children:b}))})),he=function(){return he=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},he.apply(this,arguments)};var ye=function(){return ye=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},ye.apply(this,arguments)},Ee=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},ge=se("rmd-icon-rotator"),xe=d((function(e,t){var r=e.style,n=e.className,a=e.animate,o=void 0===a||a,c=e.rotated,l=e.children,s=e.forceIconWrap,i=void 0!==s&&s,d=Ee(e,["style","className","animate","rotated","children","forceIconWrap"]),p=x(ge({animate:o,rotated:c}),n);if(!i&&u(l)){var v=m.only(l);return f(v,{className:x(p,v.props.className)})}return ae.exports.jsx("span",ye({},d,{style:r,className:p,ref:t},{children:l}))})),we=function(){return we=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},we.apply(this,arguments)},Ne={back:ae.exports.jsx(me,{children:"keyboard_arrow_left"}),checkbox:ae.exports.jsx(me,{children:"check_box"}),upload:ae.exports.jsx(me,{children:"file_upload"}),dropdown:ae.exports.jsx(me,{children:"arrow_drop_down"}),error:ae.exports.jsx(me,{children:"error_outline"}),expander:ae.exports.jsx(me,{children:"keyboard_arrow_down"}),forward:ae.exports.jsx(me,{children:"keyboard_arrow_right"}),menu:ae.exports.jsx(me,{children:"menu"}),notification:ae.exports.jsx(me,{children:"notifications"}),password:ae.exports.jsx(me,{children:"remove_red_eye"}),radio:ae.exports.jsx(me,{children:"radio_button_checked"}),selected:ae.exports.jsx(me,{children:"check"}),sort:ae.exports.jsx(me,{children:"arrow_upward"})},Se=r(Ne),Ie=Se.Provider;var Oe=te(Object.freeze({__proto__:null,FontIcon:me,SVGIcon:be,TextIconSpacing:function(e){var t,r=e.className,n=e.icon,a=e.children,o=void 0===a?null:a,c=e.stacked,l=void 0!==c&&c,s=e.iconAfter,i=void 0!==s&&s,d=e.flexReverse,p=void 0!==d&&d,v=e.forceIconWrap,b=void 0!==v&&v,h=e.beforeClassName,y=void 0===h?"rmd-icon--before":h,E=e.afterClassName,g=void 0===E?"rmd-icon--after":E,w=e.aboveClassName,N=void 0===w?"rmd-icon--above":w,S=e.belowClassName,I=void 0===S?"rmd-icon--below":S;if(!n)return ae.exports.jsx(ae.exports.Fragment,{children:o});var O=p?!i:i,C=x(((t={})[y]=!l&&!O,t[g]=!l&&O,t[N]=l&&!O,t[I]=l&&O,t),r),j=n,_=o;if(!b&&u(n)){var T=m.only(n);j=f(T,{className:x(C,T.props.className)})}else n&&(j=ae.exports.jsx("span",he({className:x("rmd-text-icon-spacing",C)},{children:n})));return j&&(_=ae.exports.jsxs(ae.exports.Fragment,{children:[!i&&j,o,i&&j]})),ae.exports.jsx(ae.exports.Fragment,{children:_})},IconRotator:xe,useIcon:function(e,t){var r=l(Se);return void 0!==t?t:r[e]},IconProvider:function(e){var t=e.children,r=e.back,n=void 0===r?Ne.back:r,a=e.checkbox,o=void 0===a?Ne.checkbox:a,c=e.dropdown,l=void 0===c?Ne.dropdown:c,s=e.expander,i=void 0===s?Ne.expander:s,d=e.error,u=void 0===d?Ne.error:d,m=e.forward,f=void 0===m?Ne.forward:m,v=e.menu,b=void 0===v?Ne.menu:v,h=e.notification,y=void 0===h?Ne.notification:h,E=e.password,g=void 0===E?Ne.password:E,x=e.radio,w=void 0===x?Ne.radio:x,N=e.selected,S=void 0===N?Ne.selected:N,I=e.sort,O=void 0===I?Ne.sort:I,C=e.upload,j=void 0===C?Ne.upload:C,_=p((function(){return{back:n,checkbox:o,dropdown:l,error:u,expander:i,forward:f,menu:b,notification:y,password:g,radio:w,selected:S,sort:O,upload:j}}),[n,o,l,u,i,f,b,y,g,w,S,O,j]);return ae.exports.jsx(Ie,we({value:_},{children:t}))}})),Ce=ee&&ee.__assign||function(){return Ce=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ce.apply(this,arguments)};Object.defineProperty(ne,"__esModule",{value:!0});var je=ne.LightbulbOutlineSVGIcon=void 0,_e=ae.exports,Te=t,ke=Oe;je=ne.LightbulbOutlineSVGIcon=(0,Te.forwardRef)((function(e,t){return(0,_e.jsx)(ke.SVGIcon,Ce({},e,{ref:t},{children:(0,_e.jsx)("path",{d:"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"})}))}));var Re={lightbulbIcon:"eb-z4RCtv"},Pe=function(e){var r=e.className,n=e.explanation;return t.createElement("div",{className:x(Re.explanationContainer,r),"data-testid":"Explanation"},t.createElement(je,{className:x(Re.lightbulbIcon,"mr-4")}),t.createElement("span",{className:x(Re.explanation,"m-0"),dangerouslySetInnerHTML:{__html:n}}))},Me="eb-6lGJ0X",Le="eb-hAkxpo",ze="eb-HLIy3V",Ge="eb-VsNFkm",Ve="eb-6nDHds",qe="eb-DBAmCC",Ae="eb-HjILKR",Be=function(){var e=B().questions,r=F().responseIndexes;return t.createElement("div",{className:Me,"data-testid":"AnswersTab"},e.map((function(e,n){var a=e.text,o=e.answers,c=e.correctAnswerIndex,l=e.explanation;return t.createElement("div",{className:x(Le,"mb-32"),key:a},t.createElement("div",{className:x(ze,"font-weight-bold")},n+1),t.createElement("div",{className:x(Ge,"font-weight-bold"),dangerouslySetInnerHTML:{__html:a}}),t.createElement("div",{className:Ve},t.createElement("div",{className:x(c===r[n]?Ae:qe)},"Your Answer: ",o[r[n]]),t.createElement("div",{className:"mt-4"},"Correct Answer: ",o[c]),t.createElement(Pe,{className:"mt-16",explanation:l})))})))},Fe={},He=ee&&ee.__assign||function(){return He=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},He.apply(this,arguments)};Object.defineProperty(Fe,"__esModule",{value:!0});var Qe=Fe.CheckCircleSVGIcon=void 0,De=ae.exports,Ue=t,We=Oe;Qe=Fe.CheckCircleSVGIcon=(0,Ue.forwardRef)((function(e,t){return(0,De.jsx)(We.SVGIcon,He({},e,{ref:t},{children:(0,De.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}))}));var Xe={},Ze=ee&&ee.__assign||function(){return Ze=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ze.apply(this,arguments)};Object.defineProperty(Xe,"__esModule",{value:!0});var Ye=Xe.ReplaySVGIcon=void 0,Ke=ae.exports,Je=t,$e=Oe;Ye=Xe.ReplaySVGIcon=(0,Je.forwardRef)((function(e,t){return(0,Ke.jsx)($e.SVGIcon,Ze({},e,{ref:t},{children:(0,Ke.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"})}))}));var et={},tt=ee&&ee.__assign||function(){return tt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},tt.apply(this,arguments)};Object.defineProperty(et,"__esModule",{value:!0});var rt=et.AlarmSVGIcon=void 0,nt=ae.exports,at=t,ot=Oe;rt=et.AlarmSVGIcon=(0,at.forwardRef)((function(e,t){return(0,nt.jsx)(ot.SVGIcon,tt({},e,{ref:t},{children:(0,nt.jsx)("path",{d:"M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12.5 8H11v6l4.75 2.85.75-1.23-4-2.37V8zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"})}))}));var ct="https://9zdy2kcoy6.execute-api.us-east-1.amazonaws.com/dev";function lt(){var e=this,t=B(),r=t.categories,n=t.generalAudience,o=t.metadata,l=t.id,s=t.popular,i=t.tightrope,d=t.type,u=t.vocab,m=F(),f=m.getLeaderboardResults,p=m.totalScore,v=a(null),b=v[0],h=v[1],y=a(!1),E=y[0],g=y[1],x=a(!1),w=x[0],N=x[1],S=a(null),I=S[0],O=S[1],_=a(null),T=_[0],k=_[1],R=a(!1),P=R[0],M=R[1],L=a(!1),z=L[0],G=L[1],V=c((function(t){return void 0===t&&(t=3),C(e,void 0,void 0,(function(){var e,r,n;return j(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,5,6]),N(!0),[4,fetch("".concat(ct,"/leaderboard?appId=").concat(o.source,"&quizId=").concat(l,"&limit=").concat(t))];case 1:return[4,a.sent().json()];case 2:return e=a.sent(),[4,f(e)];case 3:return r=a.sent(),h(r),g(!1),[3,6];case 4:return n=a.sent(),console.log(n),g(!0),[3,6];case 5:return N(!1),[7];case 6:return[2]}}))}))}),[f,o,l]),q=c((function(t){return C(e,void 0,void 0,(function(){var e,r;return j(this,(function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,fetch("".concat(ct,"/stats/percentile?appId=").concat(o.source,"&quizId=").concat(l,"&userId=").concat(t))];case 1:return[4,n.sent().json()];case 2:return e=n.sent(),O(e.scorePercentile),[3,4];case 3:return r=n.sent(),console.log(r),[3,4];case 4:return[2]}}))}))}),[o.source,l]),A=c((function(t,r){return void 0===r&&(r=1),C(e,void 0,void 0,(function(){var e,n,a;return j(this,(function(c){switch(c.label){case 0:return c.trys.push([0,4,5,6]),G(!0),[4,fetch("".concat(ct,"/rank?appId=").concat(o.source,"&quizId=").concat(l,"&userId=").concat(t,"&neighbors=").concat(r))];case 1:return[4,c.sent().json()];case 2:return e=c.sent(),[4,f(e)];case 3:return n=c.sent(),k(n),[3,6];case 4:return a=c.sent(),console.log(a),M(!0),[3,6];case 5:return G(!1),[7];case 6:return[2]}}))}))}),[f,o.source,l]),H=c((function(t){return C(e,void 0,void 0,(function(){var e,a;return j(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),console.log("saving user score..."),[4,fetch("".concat(ct,"/score"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({appId:o.source,quizId:l,score:p,userId:t,metadata:{isGeneralAudience:n,isPopular:s,isTightrope:i,isVocab:u,primaryCategory:r[0].label,type:d,slug:o.slug}})})];case 1:return e=c.sent(),console.log("done",e),[3,3];case 2:return a=c.sent(),console.log(a),[3,3];case 3:return[2]}}))}))}),[r,n,o.source,o.slug,s,l,i,p,d,u]);return{getLeaderboardResults:V,getUserPercentile:q,getUserRankResults:A,saveUserScore:H,leaderboardResults:b,leaderboardResultsError:E,leaderboardResultsLoading:w,userPercentile:I,userRankResults:T,userRankResultsError:P,userRankResultsLoading:z}}function st(e){return 10*Math.min(e,10)}function it(e,t,r){return r?100*t+st(e):100*t}var dt,ut="eb-h0JoJS",mt="eb-g0oWRe",ft="eb-cDH2ZZ",pt="eb-PMfRkP",vt="eb-6MTWIi",bt="eb-P5IGFV",ht="eb-R87VrN",yt="eb-b7udwo",Et="eb-mzexJz";!function(e){e.Left="left",e.Right="right"}(dt||(dt={}));var gt,xt=function(e){var r,n,a,o,c,l,s=e.block,i=void 0!==s&&s,d=e.children,u=e.className,m=e.icon,p=e.iconPosition,v=void 0===p?dt.Left:p,b=e.outline,h=void 0!==b&&b,y=e.shadow,E=void 0!==y&&y,g=e.shadowSm,w=void 0!==g&&g,N=e.superButton,S=void 0!==N&&N,C=e.tag,j=void 0===C?"button":C,_=O(e,["block","children","className","icon","iconPosition","outline","shadow","shadowSm","superButton","tag"]);return t.createElement(j,I({className:x(ut,(r={},r[mt]=i,r),(n={},n[pt]=m,n),(a={},a[ft]=h,a),(o={},o[ht]=E,o),(c={},c[yt]=w,c),(l={},l[Et]=S,l),u),"data-testid":"Button"},_),v===dt.Left&&m&&f(m,{className:x(m.props.className,vt)}),d,v===dt.Right&&m&&f(m,{className:x(m.props.className,bt)}))},wt="eb-WrBwzW",Nt="eb-LlKpPo",St=function(e){var r,n=e.children,a=e.className,o=e.bgColor,c=void 0===o?void 0:o,l=e.outline;return t.createElement("div",{className:x(wt,(r={},r[Nt]=l,r),a),style:{backgroundColor:c},"data-testid":"Badge"},n)},It="eb-ttCsCh",Ot=function(e){var r=e.children,n=e.className,a=O(e,["children","className"]);return t.createElement("div",I({className:x(It,n),"data-testid":"ListGroup"},a),r)},Ct="eb-Dgd6nO",jt="eb-DkhGFO",_t="eb-kwge39",Tt=function(e){var r,n,a=e.children,o=e.active,c=e.className,l=e.justified,s=O(e,["children","active","className","justified"]);return t.createElement("div",I({className:x(Ct,(r={},r[jt]=o,r),(n={},n[_t]=l,n),c),"data-testid":"ListItem"},s),a)},kt="eb-l7tnqS",Rt="eb-FQUR34",Pt=function(e){var r=e.className,n=e.items,a=e.newScore,o=e.user;return t.createElement(Ot,{className:r,"data-testid":"Leaderboard"},n.map((function(e,r){var n=e.id,c=e.rank,l=e.name,s=e.score;return t.createElement(Tt,{key:n,justified:!0,active:n===(null==o?void 0:o.id)},t.createElement("div",{className:kt},c||r+1,". ",t.createElement("strong",null,l)),t.createElement("div",{className:Rt},n===(null==o?void 0:o.id)&&a>0&&a>s&&t.createElement(St,null,"+",a-s),(new Intl.NumberFormat).format(s)))})))},Mt="eb-Hq5iFO",Lt="eb-p1vZ3L",zt="eb-8GC4cE",Gt="eb-rgrfl0",Vt="eb-KmoX7Q",qt="eb-z33RWL",At="eb-5f5DSo",Bt="eb-RjthEk",Ft="eb-lf4O2l",Ht="eb-ykC0zi",Qt=function(e){var r=e.onRestartQuiz,n=B().questions,a=F(),c=a.correctResponses,l=a.totalCorrectScore,s=a.totalScore,i=a.totalTimerScore,d=a.user,u=lt(),m=u.leaderboardResults,f=u.leaderboardResultsError,p=u.getLeaderboardResults,v=u.getUserPercentile,b=u.getUserRankResults,h=u.userPercentile,y=u.userRankResults,E=u.userRankResultsError;return o((function(){d?(b(d.id),v(d.id)):p()}),[v,b,p,d]),o((function(){if(d&&(null==y?void 0:y.length)&&!E){var e=y.find((function(e){return e.id===d.id}));!!e&&e.rank<=3||p()}E&&p()}),[p,d,y,E]),t.createElement("div",{className:Mt,"data-testid":"LeaderboardTab"},t.createElement(Q,{className:Vt,backgroundColor:"snow",borderColor:"rain",rounded:!0},t.createElement("div",{className:Lt},t.createElement("h2",{className:"mb-4"},"All Quizzes"),t.createElement("p",{className:"font-14"},"Total Weekly Points")),m&&t.createElement(Pt,{className:"mt-20",newScore:s,items:m}),f&&t.createElement("p",null,"We're experiencing issues loading the Leaderboard at this time. Please try again later."),y&&t.createElement(Pt,{className:"mt-20",newScore:s,items:y,user:d}),E&&t.createElement("p",null,"We're experiencing issues loading your score at this time. Please try again later.")),t.createElement(Q,{className:qt,backgroundColor:"white",borderColor:"rain",rounded:!0},t.createElement("div",{className:x(zt,"text-center mb-20")},t.createElement("h2",{className:"mb-16"},"This Quiz"),h&&t.createElement("p",{className:"mt-16 font-14"},"You scored ",h,"% better than most users!")),t.createElement("div",{className:At},t.createElement("div",null,t.createElement("div",{className:"mb-8"},t.createElement("div",{className:Bt},t.createElement(Qe,{className:"mr-4"})," ",t.createElement("strong",null,c," Correct")),t.createElement("div",null,t.createElement("strong",null,l," Points"))),t.createElement("div",{className:"mt-16"},t.createElement("div",{className:Ft},t.createElement(rt,{className:"mr-4"})," ",t.createElement("strong",null,"Time Bonus")),t.createElement("div",null,t.createElement("strong",null,i," Points")))),t.createElement("div",{className:"text-center"},t.createElement("div",{className:Gt},t.createElement("div",null,t.createElement("h1",null,s)),t.createElement("div",null,t.createElement("strong",null,"POINTS"))),t.createElement("div",null,"Of ",function(e){var t=0;return e.forEach((function(e){return t+=100*e.difficulty+100})),t}(n)))),t.createElement("div",{className:"text-center mt-28"},t.createElement(xt,{icon:t.createElement(Ye,{className:Ht}),onClick:r,outline:!0,shadow:!0},"Play Again"))))},Dt="eb-oCfRGq",Ut=function(e){var r=e.children,n=e.className,a=O(e,["children","className"]);return t.createElement("a",I({},a,{className:x(Dt,"font-weight-semi-bold",n)}),r)},Wt=function(){var e=B().nextUpQuiz,r=e.image,n=e.url,a=e.title;return t.createElement(Q,{borderColor:"rain",className:"mt-20","data-testid":"NextUpQuizCard",rounded:!0,shadow:!0},t.createElement("div",{style:{aspectRatio:"16/9"}},t.createElement("img",{src:r.fullUrl,alt:r.altText})),t.createElement("div",{className:"p-20"},t.createElement(Ut,{className:"font-20",href:n},a),t.createElement(xt,{tag:"a",href:n,className:"mt-20",block:!0},"Play")))},Xt="eb-NdGzM3",Zt="eb-fQMdMF",Yt="eb-i8uKTc",Kt="eb-ZBrDqu",Jt="eb-FOeG4W",$t="eb-fQceh4",er="eb-vzHSa2",tr="eb-sS9sRH",rr=function(){var e=F(),r=e.correctResponses,n=e.totalScore,a=B().questions,o=r/a.length*100;return t.createElement("div",{className:Xt},t.createElement("div",{className:Zt,"data-testid":"ScoreSummaryWheel"},t.createElement("div",{className:x($t,"px-12 py-8 font-weight-semi-bold")},"Congrats!"),t.createElement("svg",{viewBox:"0 0 36 36",className:Yt},t.createElement("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",className:Jt}),t.createElement("path",{d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",className:Kt,strokeDasharray:"".concat(o," 100")})),t.createElement("div",{className:x(er,"text-center")},t.createElement("div",{className:x(tr,"font-weight-super-bold")},r,"/",a.length),t.createElement("div",{className:"font-12"},n," points"))))},nr="eb-od4oX9",ar="eb-F71AtK",or="eb-EM5HVl",cr="eb-yx3D4X",lr="eb-0AMT86",sr=function(e){var r=e.onRestartQuiz,n=w({maxWidth:M.XsMax}),a=B().title;return t.createElement("div",{"data-testid":"ScoreTab",className:nr},t.createElement(Q,{className:ar,borderColor:"rain",backgroundColor:"ice",rounded:!n,shadow:!n},t.createElement("div",{className:or},t.createElement("div",{className:"font-18 font-weight-extra-bold"},a),t.createElement(rr,null),t.createElement(xt,{icon:t.createElement(Ye,{className:lr}),onClick:r,outline:!0,shadow:!0},"Play Again")),t.createElement("div",{className:cr},t.createElement("div",{className:"font-weight-extra-bold font-24"},"Next Up!"),t.createElement(Wt,null))))},ir=r({activeTabId:"default",setActiveTabId:function(){}}),dr=function(e){var r=e.children,n=e.defaultActiveTabId,o=a(n),c=o[0],l=o[1];return t.createElement(ir.Provider,{value:{activeTabId:c,setActiveTabId:l}},r)},ur="eb-fkZcg2",mr="eb-ntGIO4",fr=function(e){var r,n=e.children,a=e.className,o=e.controlFor,c=l(ir),s=c.setActiveTabId,i=c.activeTabId===o;return t.createElement("button",{className:x(ur,(r={},r[mr]=i,r),a),"data-testid":"Tab",id:"".concat(o,"-tab"),role:"tab","aria-controls":o,"aria-selected":i,tabIndex:i?void 0:-1,onClick:function(){return s(o)}},n)},pr=function(e){var r=e.children,n=e.className,a=e.id,o=O(e,["children","className","id"]);return a===l(ir).activeTabId?t.createElement("div",I({id:a,className:n,"data-testid":"TabContent",tabIndex:0,role:"tabpanel","aria-labelledby":"".concat(a,"-tab")},o),r):null},vr="eb-ftdu2H",br=function(e){var r=e.children,n=e.className,a=e.label;return t.createElement("div",{className:x(vr,n),"data-testid":"Tabs",role:"tablist","aria-label":a},r)},hr="eb-vDPeCr",yr="eb-bMiWKa";!function(e){e.AnswersTab="AnswersTab",e.LeaderboardTab="LeaderboardTab",e.ScoreTab="ScoreTab"}(gt||(gt={}));var Er=Object.freeze({__proto__:null,default:function(){var e=B().image,r=F(),n=r.dispatch,a=r.user,c=lt().saveUserScore,l=E();function s(){n({type:T.SetRestarted}),l("/")}return o((function(){a&&c(a.id)}),[c,a]),t.createElement("div",{"data-testid":"ResultsView",className:hr,style:{backgroundImage:"url(".concat(e.fullUrl,")")}},t.createElement(dr,{defaultActiveTabId:gt.ScoreTab},t.createElement(br,{label:"Results View"},t.createElement(fr,{controlFor:gt.ScoreTab},"Score"),t.createElement(fr,{controlFor:gt.AnswersTab},"Answers"),t.createElement(fr,{controlFor:gt.LeaderboardTab},"Leaderboard")),t.createElement(pr,{className:yr,id:gt.ScoreTab},t.createElement(sr,{onRestartQuiz:s})),t.createElement(pr,{className:yr,id:gt.AnswersTab},t.createElement(Be,null)),t.createElement(pr,{className:yr,id:gt.LeaderboardTab},t.createElement(Qt,{onRestartQuiz:s}))))}}),gr="eb-8LB0Z6",xr="eb-xrnrMX",wr="eb-uQ6x3r",Nr="eb-RTZJDf",Sr="eb-nCZamz",Ir="eb-XBUSmk",Or="eb-6uIIpF",Cr="eb-vaYYcz",jr="eb-FGnvGm",_r=function(e){var r=e.children;return t.createElement("div",{className:jr,"data-testid":"SwitchControl"},r)},Tr="eb-FxfgLd",kr=function(e){var r=e.id,n=O(e,["id"]);return t.createElement("input",I({id:r,className:Tr,type:"checkbox",role:"switch"},n))},Rr=Object.freeze({__proto__:null,default:function(){var e=B(),r=e.id,n=e.categories,a=e.image,o=e.title,c=e.timed,l=e.questions,s=F(),i=s.dispatch,d=s.timerEnabled;return t.createElement("div",{className:gr,"data-testid":"IntroView",style:{aspectRatio:"900 / 675"}},t.createElement("img",{className:xr,src:a.fullUrl,alt:a.altText}),t.createElement("div",{className:wr},t.createElement(Q,{borderColor:"rain",className:x(Ir,"p-20"),rounded:!0,shadow:!0},t.createElement("div",{className:Nr},t.createElement(St,{className:x(Sr),bgColor:"var(--qc-ice)",outline:!0},t.createElement("span",{className:"font-14"},n[0].label))),t.createElement("h1",{className:x(Cr,"font-weight-semi-bold text-center")},o),t.createElement("div",{className:"text-center"},t.createElement(xt,{className:"p-28",tag:g,to:"/".concat(r),block:!0,superButton:!0},"Start")),t.createElement("div",{className:x(Or,"pt-16")},t.createElement("div",{className:"font-14 font-weight-semi-bold"},l.length," Questions"),c&&t.createElement(_r,null,t.createElement("label",{className:"font-14",htmlFor:"toggle"},"Timer Bonus"),t.createElement(kr,{id:"".concat(r),defaultChecked:d,onClick:function(){return i({type:T.SetTimerEnabled,payload:!d})}}))))))}}),Pr={},Mr=ee&&ee.__assign||function(){return Mr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Mr.apply(this,arguments)};Object.defineProperty(Pr,"__esModule",{value:!0});var Lr=Pr.ArrowForwardSVGIcon=void 0,zr=ae.exports,Gr=t,Vr=Oe;Lr=Pr.ArrowForwardSVGIcon=(0,Gr.forwardRef)((function(e,t){return(0,zr.jsx)(Vr.SVGIcon,Mr({},e,{ref:t},{children:(0,zr.jsx)("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})}))}));var qr={},Ar=ee&&ee.__assign||function(){return Ar=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ar.apply(this,arguments)};Object.defineProperty(qr,"__esModule",{value:!0});var Br=qr.CloseSVGIcon=void 0,Fr=ae.exports,Hr=t,Qr=Oe;Br=qr.CloseSVGIcon=(0,Hr.forwardRef)((function(e,t){return(0,Fr.jsx)(Qr.SVGIcon,Ar({},e,{ref:t},{children:(0,Fr.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})}))}));var Dr={},Ur=ee&&ee.__assign||function(){return Ur=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ur.apply(this,arguments)};Object.defineProperty(Dr,"__esModule",{value:!0});var Wr=Dr.CheckSVGIcon=void 0,Xr=ae.exports,Zr=t,Yr=Oe;Wr=Dr.CheckSVGIcon=(0,Zr.forwardRef)((function(e,t){return(0,Xr.jsx)(Yr.SVGIcon,Ur({},e,{ref:t},{children:(0,Xr.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})}))}));var Kr,Jr={answerButtonContainer:"eb-hm0P2D",answerButton:"eb-EkupIl",selected:"eb-p8ZbDY",correct:"eb-5WC5qo",correctSelected:"eb-Z1YT6r",incorrectSelected:"eb-V0bjjy",disabled:"eb-N51x3L",default:"eb-e7y9O4",icon:"eb-8I8Gjv",correctIcon:"eb-NVqaa3",incorrectIcon:"eb-5sHpoZ"};!function(e){e.Correct="correct",e.CorrectSelected="correctSelected",e.Default="default",e.IncorrectSelected="incorrectSelected",e.Selected="selected"}(Kr||(Kr={}));var $r,en,tn,rn=function(e){var r,n=e.children,a=e.status,o=void 0===a?Kr.Default:a,c=e.disabled,l=O(e,["children","status","disabled"]);return t.createElement("div",{className:Jr.answerButtonContainer},Kr.CorrectSelected===o&&t.createElement(Wr,{className:x(Jr.icon,Jr.correctIcon,"font-12 p-4")}),Kr.IncorrectSelected===o&&t.createElement(Br,{className:x(Jr.icon,Jr.incorrectIcon,"font-12 p-4")}),t.createElement(xt,I({className:x(Jr.answerButton,o&&Jr[o],(r={},r[Jr.disabled]=c,r)),outline:!0,block:!0,disabled:c,superButton:!0,shadowSm:!0},l),n))},nn="eb-fKHH4k",an="eb-Ka5TRS",on="eb-eQLIHc",cn="eb-YcibRH",ln="eb-pAHhPN";!function(e){e.Play="play",e.Pause="pause",e.Stop="stop"}($r||($r={})),function(e){e.Correct="var(--qc-green)",e.Incorrect="var(--qc-red)",e.Default="var(--qc-blue-200)"}(en||(en={})),function(e){e.Left="left",e.Right="right"}(tn||(tn={}));var sn=function(e){var r=e.labelMessage,n=e.labelPosition,c=void 0===n?tn.Left:n,l=e.onExpire,s=e.status,i=e.theme,d=void 0===i?en.Default:i,u=e.time,m=void 0===u?15:u,f=e.timerRef,p=a(m),b=p[0],h=p[1],y=a(!1),E=y[0],g=y[1],x=v(0);return o((function(){return s===$r.Play&&(x.current=window.setInterval((function(){return h((function(e){return e-1}))}),1e3)),s===$r.Stop&&(clearInterval(x.current),h(m)),s===$r.Pause&&clearInterval(x.current),function(){clearInterval(x.current),g(!1)}}),[s,m]),o((function(){0===b&&(clearInterval(x.current),g(!0),l&&l())}),[l,b]),t.createElement("div",{className:nn,"data-testid":"Timer"},c===tn.Left&&t.createElement("div",{className:cn},!b&&t.createElement(St,{bgColor:en.Incorrect},"Time's Up!"),r&&!!b&&t.createElement(St,{bgColor:d},r)),t.createElement("div",{className:an},t.createElement("svg",null,t.createElement("circle",{cx:"23",cy:"23",r:"23",style:{stroke:E?en.Incorrect:"var(--qc-rain)"}}),t.createElement("circle",{cx:"23",cy:"23",r:"23",style:{stroke:d,strokeDashoffset:145-145*b/m}})),t.createElement("p",{ref:f,className:on},b)),c===tn.Right&&t.createElement("div",{className:ln},!b&&t.createElement(St,{bgColor:en.Incorrect},"Time's Up!"),r&&!!b&&t.createElement(St,{bgColor:d},r)))},dn="eb-db86L8",un="eb-fl8Stz",mn="eb-MbWQdV",fn=function(e){var r=e.title,n=e.timerEnabled,a=void 0===n||n,o=e.timerRef,c=e.timerScore,l=e.timerStatus,s=void 0===l?$r.Stop:l,i=e.timerTheme,d=void 0===i?en.Default:i,u=e.timerTime,m=void 0===u?15:u,f=e.onTimerExpire,p=e.totalScore,v=void 0===p?0:p,b=e.currentCount,h=void 0===b?0:b,y=e.totalCount,E=void 0===y?0:y,g=w({maxWidth:M.MdMin});return t.createElement("div",{className:x(dn,"p-4")},t.createElement("span",{className:x(mn,"pl-16")},r),t.createElement("div",{className:x(un,"px-16")},a&&t.createElement(sn,{time:m,timerRef:o,theme:d,status:s,onExpire:f,labelMessage:c?"+".concat(c):void 0,labelPosition:g?tn.Right:tn.Left}),t.createElement("div",{className:"pl-24"},t.createElement("span",{className:"font-weight-bold "},h)," of"," ",t.createElement("span",{className:"font-weight-bold"},E)),t.createElement("div",{className:"pl-24"},"Score: ",t.createElement("span",{className:"font-weight-bold"},v))))},pn="eb-NelLRW",vn="eb-nXyIBf",bn="eb-VgMNit",hn="eb-8SxGFY",yn=Object.freeze({__proto__:null,default:function(){var e=E(),r=A().event,n=v(null),l=a($r.Stop),s=l[0],i=l[1],d=a(0),u=d[0],m=d[1],f=a(null),p=f[0],b=f[1],h=B(),y=h.id,g=h.title,w=h.questions,N=h.seconds,S=h.type,I=F(),O=I.currentQuestionIndex,C=I.correctResponses,j=I.dispatch,k=I.responseIndexes,R=I.restarted,P=I.totalCorrectScore,M=I.totalScore,L=I.totalTimerScore,z=I.timerEnabled,G=w[O];o((function(){return z&&i($r.Play),function(){z&&i($r.Stop)}}),[O,z]);var V=c((function(){b(-1)}),[]);function q(e){return e===p&&p===G.correctAnswerIndex?Kr.CorrectSelected:e===p&&p!==G.correctAnswerIndex?Kr.IncorrectSelected:null!==p&&e===G.correctAnswerIndex?Kr.Correct:Kr.Default}return t.createElement("div",{"data-testid":"QuestionView"},t.createElement(fn,{currentCount:O+1,onTimerExpire:V,title:g,totalCount:w.length,totalScore:M,timerEnabled:z,timerRef:n,timerScore:u,timerStatus:s,timerTime:N,timerTheme:p===G.correctAnswerIndex?en.Correct:null!==p&&p!==G.correctAnswerIndex?en.Incorrect:en.Default}),t.createElement(Q,{className:x(x(pn,"pb-20")),backgroundColor:"ice"},t.createElement("div",{className:x(hn,"p-24 font-24 font-weight-normal text-center"),dangerouslySetInnerHTML:{__html:G.text}}),t.createElement("div",{className:x(vn,"p-24")},G.answers.map((function(e,a){return t.createElement(rn,{disabled:null!==p,key:e,onClick:function(){return function(e){var t,a,o=e===G.correctAnswerIndex;if(o){var c=(null===(t=n.current)||void 0===t?void 0:t.innerHTML)?+(null===(a=n.current)||void 0===a?void 0:a.innerHTML):0,l=it(c,G.difficulty,z);m(l),j({type:T.setTotalCorrectScore,payload:P+it(0,G.difficulty,!1)}),z&&j({type:T.setTotalTimerScore,payload:L+st(c)}),j({type:T.SetTotalScore,payload:M+l}),j({type:T.SetCorrectResponses,payload:C+1})}b(e),i($r.Pause),j({type:T.SetCorrectIndexes,payload:_(_([],k,!0),[e],!1)}),r("question_answered",{quiz_id:y,question_index:O,answer_index:e,answered_correctly:o,answer_text:G.answers[e],quiz_type:S.toString(),total_questions:w.length})}(a)},status:q(a)},e)}))),null!==p&&t.createElement(xt,{onClick:function(){O<w.length-1?(j({type:T.setCurrentQuestionIndex,payload:O+1}),b(null),z&&(i($r.Stop),m(0))):(e("/results"),r("quiz_complete",{quiz_id:y,questions_answered:k.length,restarted:R,correct_responses:C,quiz_type:S.toString(),total_questions:w.length}))},superButton:!0},"Next ",t.createElement(Lr,{className:"ml-8"})),null!==p&&t.createElement(Pe,{className:x(bn,"mt-24 p-24"),explanation:G.explanation})))}});export{M as Breakpoint,$ as Quiz,P as Template}; | ||
//# sourceMappingURL=quiz-components.esm.production.js.map |
@@ -1,2 +0,4 @@ | ||
import { Difficulty } from '../common/types'; | ||
import { type Difficulty, type Question } from '../common/types'; | ||
export declare function calculateTimerBonus(secondsRemaining: number): number; | ||
export declare function calculateQuestionScore(secondsRemaining: number, difficulty: Difficulty, timerEnabled: boolean): number; | ||
export declare function calculatePotentialMaxQuizScore(questions: Question[]): number; |
{ | ||
"name": "@britannica/quiz-components", | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0-beta.7", | ||
"author": "Ryan Walters", | ||
@@ -26,2 +26,3 @@ "license": "MIT", | ||
"@react-md/material-icons": "^5.1.3", | ||
"canvas-confetti": "^1.5.1", | ||
"classnames": "^2.3.1", | ||
@@ -37,3 +38,3 @@ "deepmerge": "^4.2.2", | ||
"devDependencies": { | ||
"@babel/core": "7.18.6", | ||
"@babel/core": "7.18.9", | ||
"@commitlint/cli": "17.0.3", | ||
@@ -45,6 +46,6 @@ "@commitlint/config-conventional": "17.0.3", | ||
"@rollup/plugin-replace": "4.0.0", | ||
"@rollup/plugin-typescript": "8.3.3", | ||
"@rollup/plugin-typescript": "8.3.4", | ||
"@semantic-release/commit-analyzer": "9.0.2", | ||
"@semantic-release/git": "10.0.1", | ||
"@semantic-release/github": "8.0.4", | ||
"@semantic-release/github": "8.0.5", | ||
"@semantic-release/npm": "9.0.1", | ||
@@ -65,11 +66,12 @@ "@semantic-release/release-notes-generator": "10.0.3", | ||
"@testing-library/react": "13.3.0", | ||
"@types/canvas-confetti": "^1.4.3", | ||
"@types/gtag.js": "0.0.10", | ||
"@types/react": "18.0.14", | ||
"@types/react-dom": "18.0.5", | ||
"@typescript-eslint/eslint-plugin": "^5.30.6", | ||
"@typescript-eslint/parser": "^5.30.6", | ||
"@types/react": "18.0.15", | ||
"@types/react-dom": "18.0.6", | ||
"@typescript-eslint/eslint-plugin": "5.31.0", | ||
"@typescript-eslint/parser": "5.31.0", | ||
"babel-loader": "8.2.5", | ||
"babel-plugin-annotate-pure-calls": "0.4.0", | ||
"babel-plugin-dev-expression": "0.2.3", | ||
"eslint": "^8.19.0", | ||
"eslint": "8.20.0", | ||
"eslint-plugin-react": "^7.30.1", | ||
@@ -79,4 +81,4 @@ "eslint-plugin-react-hooks": "^4.6.0", | ||
"identity-obj-proxy": "3.0.0", | ||
"jest": "28.1.2", | ||
"jest-environment-jsdom": "28.1.2", | ||
"jest": "28.1.3", | ||
"jest-environment-jsdom": "28.1.3", | ||
"postcss": "8.4.14", | ||
@@ -87,11 +89,11 @@ "prettier": "2.7.1", | ||
"react-dom": "18.2.0", | ||
"rollup": "2.75.7", | ||
"rollup": "2.77.2", | ||
"rollup-plugin-postcss": "4.0.2", | ||
"rollup-plugin-sourcemaps": "0.6.3", | ||
"rollup-plugin-terser": "7.0.2", | ||
"sass": "1.53.0", | ||
"sass": "1.54.0", | ||
"sass-loader": "13.0.2", | ||
"semantic-release": "19.0.3", | ||
"size-limit": "7.0.8", | ||
"ts-jest": "28.0.5", | ||
"ts-jest": "28.0.7", | ||
"tslib": "2.4.0", | ||
@@ -98,0 +100,0 @@ "typescript": "4.7.4" |
@@ -55,5 +55,10 @@ export enum Template { | ||
export interface UserPercentile { | ||
userId: string; | ||
scorePercentile: number; | ||
} | ||
export interface LeaderboardServiceUser { | ||
userId: string; | ||
rank?: number; | ||
rank: number; | ||
maxScore: number; | ||
@@ -64,3 +69,3 @@ } | ||
id: string; | ||
rank?: number; | ||
rank: number; | ||
name: string; | ||
@@ -67,0 +72,0 @@ score: number; |
@@ -1,27 +0,147 @@ | ||
import { useState } from 'react'; | ||
import { type LeaderboardQuizResults, type LeaderboardServiceUser } from '../common/types'; | ||
import { useCallback, useState } from 'react'; | ||
import { type UserPercentile, type LeaderboardQuizResults, type LeaderboardServiceUser } from '../common/types'; | ||
import { useQuizData } from './useQuizData'; | ||
import { useQuizState } from './useQuizState'; | ||
const leaderboardServicBaseUrl = 'https://9zdy2kcoy6.execute-api.us-east-1.amazonaws.com'; | ||
const leaderboardServicBaseUrl = 'https://9zdy2kcoy6.execute-api.us-east-1.amazonaws.com/dev'; | ||
export function useLeaderboardService() { | ||
const { metadata, id: quizId } = useQuizData(); | ||
const { getLeaderboardResults: fetchLeaderboardResults } = useQuizState(); | ||
const [leaderboardResults, setLeaderboardResults] = useState<LeaderboardQuizResults[]>(); | ||
const { categories, generalAudience, metadata, id: quizId, popular, tightrope, type, vocab } = useQuizData(); | ||
const { getLeaderboardResults: fetchLeaderboardResults, totalScore } = useQuizState(); | ||
const [leaderboardResults, setLeaderboardResults] = useState<LeaderboardQuizResults[] | null>(null); | ||
const [leaderboardResultsError, setLeaderboardResultsError] = useState<boolean>(false); | ||
const [leaderboardResultsLoading, setLeaderboardResultsLoading] = useState<boolean>(false); | ||
const [userPercentile, setUserPercentile] = useState<number | null>(null); | ||
const [userRankResults, setUserRankResults] = useState<LeaderboardQuizResults[] | null>(null); | ||
const [userRankResultsError, setUserRankResultsError] = useState<boolean>(false); | ||
const [userRankResultsLoading, setUserRankResultsLoading] = useState<boolean>(false); | ||
async function getLeaderboardResults() { | ||
const leaderboardServiceUserResponse = await fetch( | ||
`${leaderboardServicBaseUrl}/dev/leaderboard?appId=${metadata.source}&quizId=${quizId}` | ||
); | ||
const leaderboardServiceUsers: LeaderboardServiceUser[] = await leaderboardServiceUserResponse.json(); | ||
const leaderboardResults: LeaderboardQuizResults[] = await fetchLeaderboardResults(leaderboardServiceUsers); | ||
const getLeaderboardResults = useCallback( | ||
async (limit = 3) => { | ||
try { | ||
setLeaderboardResultsLoading(true); | ||
setLeaderboardResults(leaderboardResults); | ||
} | ||
// Fetch rawLeaderboardServiceUsers | ||
const leaderboardServiceUserResponse = await fetch( | ||
`${leaderboardServicBaseUrl}/leaderboard?appId=${metadata.source}&quizId=${quizId}&limit=${limit}` | ||
); | ||
// Get leaderboardServiceUserResponse json | ||
const leaderboardServiceUsers: LeaderboardServiceUser[] = await leaderboardServiceUserResponse.json(); | ||
// Pass leaderboardServiceUsers to fetchLeaderboardResults | ||
const leaderboardResults: LeaderboardQuizResults[] = await fetchLeaderboardResults(leaderboardServiceUsers); | ||
// setLeaderboardResults | ||
setLeaderboardResults(leaderboardResults); | ||
setLeaderboardResultsError(false); | ||
} catch (e) { | ||
console.log(e); | ||
setLeaderboardResultsError(true); | ||
} finally { | ||
setLeaderboardResultsLoading(false); | ||
} | ||
}, | ||
[fetchLeaderboardResults, metadata, quizId] | ||
); | ||
const getUserPercentile = useCallback( | ||
async (userId: string) => { | ||
try { | ||
// Fetch user percentile | ||
const userPercentileResponse = await fetch( | ||
`${leaderboardServicBaseUrl}/stats/percentile?appId=${metadata.source}&quizId=${quizId}&userId=${userId}` | ||
); | ||
// Get user percentile json | ||
const userPercentile: UserPercentile = await userPercentileResponse.json(); | ||
// setUserPercentile | ||
setUserPercentile(userPercentile.scorePercentile); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
}, | ||
[metadata.source, quizId] | ||
); | ||
const getUserRankResults = useCallback( | ||
async (userId: string, neighbors = 1) => { | ||
try { | ||
setUserRankResultsLoading(true); | ||
// Fetch user rank | ||
const userRankResponse = await fetch( | ||
`${leaderboardServicBaseUrl}/rank?appId=${metadata.source}&quizId=${quizId}&userId=${userId}&neighbors=${neighbors}` | ||
); | ||
// Get user rank json | ||
const userRank: LeaderboardServiceUser[] = await userRankResponse.json(); | ||
// Pass user rank to fetchLeaderboardResults | ||
const userRankResultsPayload: LeaderboardQuizResults[] = await fetchLeaderboardResults(userRank); | ||
// setUserRank | ||
setUserRankResults(userRankResultsPayload); | ||
} catch (e) { | ||
console.log(e); | ||
setUserRankResultsError(true); | ||
} finally { | ||
setUserRankResultsLoading(false); | ||
} | ||
}, | ||
[fetchLeaderboardResults, metadata.source, quizId] | ||
); | ||
const saveUserScore = useCallback( | ||
async (userId: string) => { | ||
try { | ||
console.log('saving user score...'); | ||
// Save user score | ||
const res = await fetch(`${leaderboardServicBaseUrl}/score`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
appId: metadata.source, | ||
quizId: quizId, | ||
score: totalScore, | ||
userId, | ||
metadata: { | ||
isGeneralAudience: generalAudience, | ||
isPopular: popular, | ||
isTightrope: tightrope, | ||
isVocab: vocab, | ||
primaryCategory: categories[0].label, | ||
type: type, | ||
slug: metadata.slug, | ||
}, | ||
}), | ||
}); | ||
console.log('done', res); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
}, | ||
[categories, generalAudience, metadata.source, metadata.slug, popular, quizId, tightrope, totalScore, type, vocab] | ||
); | ||
return { | ||
// Methods | ||
getLeaderboardResults, | ||
getUserPercentile, | ||
getUserRankResults, | ||
saveUserScore, | ||
// Properties | ||
leaderboardResults, | ||
getLeaderboardResults, | ||
leaderboardResultsError, | ||
leaderboardResultsLoading, | ||
userPercentile, | ||
userRankResults, | ||
userRankResultsError, | ||
userRankResultsLoading, | ||
}; | ||
} |
@@ -1,8 +0,19 @@ | ||
import { Difficulty } from '../common/types'; | ||
import { type Difficulty, type Question } from '../common/types'; | ||
// Calculate Timer Bonus | ||
export function calculateTimerBonus(secondsRemaining: number): number { | ||
const maxTimerBonus = 10; | ||
return Math.min(secondsRemaining, maxTimerBonus) * 10; | ||
} | ||
// Calculate Question score | ||
export function calculateQuestionScore(secondsRemaining: number, difficulty: Difficulty, timerEnabled: boolean) { | ||
export function calculateQuestionScore( | ||
secondsRemaining: number, | ||
difficulty: Difficulty, | ||
timerEnabled: boolean | ||
): number { | ||
// If timer is enabled: Question Difficulty (1-4) * 100 + Remaining Time up to 10 seconds * 10 | ||
if (timerEnabled) { | ||
return difficulty * 100 + Math.min(secondsRemaining, 10) * 10; | ||
return difficulty * 100 + calculateTimerBonus(secondsRemaining); | ||
} | ||
@@ -13,1 +24,11 @@ | ||
} | ||
// Calculate potential max score for a given quiz. | ||
export function calculatePotentialMaxQuizScore(questions: Question[]): number { | ||
const maxTimerBonus = 10; | ||
let maxQuizScore = 0; | ||
questions.forEach((question) => (maxQuizScore += question.difficulty * 100 + maxTimerBonus * 10)); | ||
return maxQuizScore; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
786381
228
6817
8
58
12
+ Addedcanvas-confetti@^1.5.1
+ Addedcanvas-confetti@1.9.3(transitive)