1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[963],{64008:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return z}});var r=t(85893),s=t(55645),a=t(809),c=t.n(a),i=t(30266),o=t(67294),l=t(33344),u=t(68527),d=t(20949),h=t(15193),x=t(41664),g=t(88767),f=t(9669),p=t.n(f),y=t(58747),j=t(99184),m=t(65976),v=t(41953),w=t(84144),C=function(){var e=(0,i.Z)(c().mark((function e(n){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p().post("".concat(y.M,"/api/challenge/"),n);case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),S=function(e){var n=e.startDate,t=e.wordsTyped,a=e.accuracy,c=e.restartChallengeMode,i=o.useState((0,m.y)(n,t)),l=(0,s.Z)(i,1)[0],d=o.useState((0,v.V)(n,new Date)),x=(0,s.Z)(d,1)[0],f=o.useState(function(e,n){return(n*(e/100)).toFixed(2)}(a,l)),p=(0,s.Z)(f,1)[0],y=(0,g.useMutation)((function(){return C({wpm:l,time_elapsed:x,accuracy:a,score:p})})),j=y.mutate,S=y.isError,b=y.error;return o.useEffect((function(){j()}),[]),(0,r.jsx)(u.xu,{children:(0,r.jsxs)(u.Kq,{align:"center",children:[S&&(0,w.h)(b),(0,r.jsx)(u.X6,{children:"Woohoo! You finished a challenge! \ud83e\udd73"}),(0,r.jsx)(u.X6,{as:"h2",size:"md",children:"Challenge Summary"}),(0,r.jsxs)(u.Ug,{spacing:"8",children:[(0,r.jsxs)(u.xv,{children:["Speed: ",l," WPM"]}),(0,r.jsxs)(u.xv,{children:["Accuracy: ",a,"%"]}),(0,r.jsxs)(u.xv,{children:["Score: ",p]}),(0,r.jsxs)(u.xv,{children:["Time Taken: ",x.toFixed(2)," seconds"]})]}),(0,r.jsx)(h.hE,{children:(0,r.jsx)(h.zx,{size:"sm",onClick:c,children:"Complete another challenge"})})]})})},b=t(73108),Z=t(50873),_=t(37162),k=t(14428),W=function(e,n){return Math.ceil(e/n*100)},M=function(){var e=(0,i.Z)(c().mark((function e(){var n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p().get("".concat(y.M,"/api/challenge/"));case 2:return n=e.sent,e.abrupt("return",n.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),z=function(){(0,k.Z)("KeyKorea - Challenge Mode");var e=(0,Z.b)("/auth/sign-in").isLoading,n=(0,l.Fg)(),t=(0,g.useQueryClient)(),a=o.useState(!1),c=(0,s.Z)(a,2),i=c[0],f=c[1],p=o.useState(100),y=(0,s.Z)(p,2),m=y[0],v=y[1],w=o.useState(0),C=(0,s.Z)(w,2),z=C[0],E=C[1],T=o.useState(new Date),D=(0,s.Z)(T,2),F=D[0],Q=D[1],L=o.useState(0),N=(0,s.Z)(L,2),X=N[0],I=N[1],K=(0,g.useQuery)("challenge",M,{refetchOnWindowFocus:!1,enabled:!1,onSuccess:function(){f(!0)}}),q=K.data,A=K.refetch,O=K.isFetching;return e?(0,r.jsx)(_.Z,{}):(0,r.jsx)(r.Fragment,{children:i?(0,r.jsxs)(u.W2,{pt:"8",maxW:"container.xl",children:[(0,r.jsx)(b.Z,{bgColor:n.colors.blue[400],isLabelVisible:0!=W(X,q.length),baseBgColor:(0,d.ff)(n.colors.gray[200],n.colors.gray[700]),labelColor:(0,d.ff)(n.colors.gray[700],n.colors.gray[200]),completed:W(X,q.length)}),(0,r.jsx)(u.Kq,{spacing:8,mx:"auto",maxW:"3xl",py:12,px:6,children:X>=q.length?(0,r.jsx)(S,{setCurrentQuestionIndex:I,startDate:F,wordsTyped:z,accuracy:m,refetch:A,restartChallengeMode:function(){t.invalidateQueries("challenge"),A(),v(100),E(0),Q(new Date),I(0)}}):(0,r.jsx)(j.Z,{questions:q,setCurrentQuestionIndex:I,currentQuestionIndex:X,startDate:F,wordsTyped:z,setWordsTyped:E,accuracy:m,setAccuracy:v})})]}):(0,r.jsx)(u.W2,{pt:"8",maxW:"container.xl",children:(0,r.jsxs)(u.gC,{spacing:4,width:"100%",children:[(0,r.jsx)(u.X6,{textAlign:"center",fontSize:"45px",children:"Challenge Mode"}),(0,r.jsx)(u.xv,{fontSize:"20px",align:"center",color:(0,d.ff)("gray.600","gray.200"),maxW:"container.md",children:"This mode puts your korean typing skills to the ultimate test! Challenge Mode tests all your skills, containing exercises on Letters, Sylabbles, Words, Short Sentances, Long Sentances and Diction!"}),(0,r.jsxs)(h.hE,{pt:"2",children:[(0,r.jsx)(h.zx,{size:"sm",variant:"ghost",isLoading:O,onClick:A,bgColor:"blue.400",_hover:{bg:"blue.500"},color:"white",children:"Start Challenge"}),(0,r.jsx)(x.default,{href:"/practice",children:(0,r.jsx)(h.zx,{size:"sm",variant:"solid",children:"I need some practice first"})})]})]})})})}},3752:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/challenge",function(){return t(64008)}])}},function(e){e.O(0,[445,874,729,667,811,731,774,888,179],(function(){return n=3752,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.