1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26],{59941:function(e,r,t){"use strict";t.d(r,{n:function(){return x}});var n=t(809),c=t.n(n),s=t(30266),a=t(9669),u=t.n(a),o=t(88767),i=t(58747),l=function(){var e=(0,s.Z)(c().mark((function e(r){var t,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length<=0)){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,u().get("".concat(i.M,"/api/subexercises/exercise/").concat(r,"/"));case 4:return t=e.sent,n=t.data,e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),x=function(e){return(0,o.useQuery)(["subexercise","dashboard",e],(function(){return l(e)}))}},17471:function(e,r,t){"use strict";t.r(r),t.d(r,{default:function(){return C}});var n=t(85893),c=t(55645),s=t(809),a=t.n(s),u=t(30266),o=t(67294),i=t(33344),l=t(68527),x=t(20949),f=t(99184),d=t(92809),p=t(15193),h=t(65976),g=t(41953),b=t(9669),y=t.n(b),m=t(58747),j=t(88767),v=t(41664),w=t(59941),S=t(37162),O=t(84144);function Z(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Z(Object(t),!0).forEach((function(r){(0,d.Z)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Z(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var E=function(){var e=(0,u.Z)(a().mark((function e(r,t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y().post("".concat(m.M,"/api/practice/attempt/"),_({subexercise_slug:r},t));case 2:return n=e.sent,e.abrupt("return",n.data);case 4:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}(),D=function(e){var r=e.startDate,t=e.wordsTyped,s=e.accuracy,a=e.subexercise,u=e.restart,i=e.exercise,x=(0,w.n)(i),f=x.data,d=x.isLoading,b=o.useState((0,h.y)(r,t)),y=(0,c.Z)(b,1)[0],m=o.useState((0,g.V)(r,new Date)),S=(0,c.Z)(m,1)[0],Z=o.useState(y*(s/100)),_=(0,c.Z)(Z,1)[0],D=o.useState(null),k=(0,c.Z)(D,2),P=k[0],I=k[1],z=(0,j.useMutation)((function(){return E(a,{wpm:y,time_elapsed:S,score:_,accuracy:s})})),T=z.mutate,q=z.isError,C=z.error;return o.useEffect((function(){localStorage.removeItem("".concat(a,"-accuracy")),localStorage.removeItem("".concat(a,"-words-typed")),localStorage.removeItem("".concat(a,"-current-question-index")),localStorage.removeItem("".concat(a,"-time-elapsed"))}),[a]),o.useEffect((function(){T()}),[]),o.useEffect((function(){if(f){var e=f.map((function(e){return e.subexercise_slug})).indexOf(a);if(!(e>=f.length-1)){var r=f[e+1];I(r.subexercise_slug)}}}),[d]),(0,n.jsx)(l.xu,{children:(0,n.jsxs)(l.Kq,{align:"center",children:[q&&(0,O.h)(C),(0,n.jsx)(l.X6,{children:"Woohoo! You finished the subexercise! \ud83e\udd73"}),(0,n.jsx)(l.X6,{as:"h2",size:"md",children:"Subexercise Summary"}),(0,n.jsxs)(l.Ug,{spacing:"8",children:[(0,n.jsxs)(l.xv,{children:["Speed: ",y," WPM"]}),(0,n.jsxs)(l.xv,{children:["Accuracy: ",s,"%"]}),(0,n.jsxs)(l.xv,{children:["Score: ",(y*(s/100)).toFixed(2)]}),(0,n.jsxs)(l.xv,{children:["Time Taken: ",S.toFixed(2)," seconds"]})]}),(0,n.jsxs)(p.hE,{children:[(0,n.jsx)(p.zx,{size:"sm",variant:"ghost",onClick:u,children:"Restart Exercise"}),d?(0,n.jsx)(p.zx,{size:"sm",children:"Loading next subexercise..."}):P?(0,n.jsx)(v.default,{href:"/practice/".concat(i,"/subexercise/").concat(P),children:(0,n.jsx)(p.zx,{size:"sm",children:"Next Subexercise"})}):(0,n.jsx)(v.default,{href:"/practice",children:(0,n.jsx)(p.zx,{size:"sm",children:"Back to practice page"})})]})]})})},k=t(73108),P=t(11163),I=t(50873),z=t(14428),T=function(e,r){return Math.ceil(e/r*100)},q=function(){var e=(0,u.Z)(a().mark((function e(r){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y().get("".concat(m.M,"/api/questions/subexercise/").concat(r,"/"));case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),C=function(){(0,z.Z)("KeyKorea - Practice Mode");var e=(0,I.b)("/auth/sign-in").isLoading,r=(0,i.Fg)(),t=(0,P.useRouter)().query,s=t.subexercise,a=t.exercise,u=(0,j.useQuery)(["practice","questions",s],(function(){return q(s)}),{retry:3,retryDelay:0}),d=u.data,p=u.isLoading,h=u.isError,g=u.error;console.log(d);var b=o.useState(100),y=(0,c.Z)(b,2),m=y[0],v=y[1],w=o.useState(0),Z=(0,c.Z)(w,2),_=Z[0],E=Z[1],C=o.use
1State(new Date),M=(0,c.Z)(C,2),N=M[0],W=M[1],L=o.useState(0),Q=(0,c.Z)(L,2),F=Q[0],K=Q[1];return o.useEffect((function(){s&&(v(function(e){return 1*localStorage.getItem("".concat(e,"-accuracy"))||100}(s)),E(function(e){return 1*localStorage.getItem("".concat(e,"-words-typed"))||0}(s)),W(function(e){var r=new Date,t=1*localStorage.getItem("".concat(e,"-time-elapsed"));return t>=0?new Date(r.getTime()-t):r}(s)),K(function(e){return 1*localStorage.getItem("".concat(e,"-current-question-index"))||0}(s)))}),[s]),e?(0,n.jsx)(S.Z,{}):(0,n.jsx)(l.W2,{pt:"8",maxW:"container.xl",children:h?(0,O.h)(g):p?(0,n.jsx)(S.Z,{}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k.Z,{bgColor:r.colors.blue[400],baseBgColor:(0,x.ff)(r.colors.gray[200],r.colors.gray[700]),labelColor:(0,x.ff)(r.colors.gray[700],r.colors.gray[200]),isLabelVisible:0!=T(F,d.length),completed:T(F,d.length)}),(0,n.jsx)(l.Kq,{spacing:8,mx:"auto",maxW:"3xl",py:12,px:6,children:F>=d.length?(0,n.jsx)(D,{setCurrentQuestionIndex:K,startDate:N,wordsTyped:_,accuracy:m,subexercise:s,exercise:a,restart:function(){v(100),E(0),W(new Date),K(0)}}):(0,n.jsx)(f.Z,{questions:d,setCurrentQuestionIndex:K,currentQuestionIndex:F,startDate:N,wordsTyped:_,setWordsTyped:E,accuracy:m,exercise:s,setAccuracy:v})})]})})}},42791:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/practice/[exercise]/subexercise/[subexercise]",function(){return t(17471)}])}},function(e){e.O(0,[445,874,729,667,811,731,774,888,179],(function(){return r=42791,e(e.s=r);var r}));var r=e.O();_N_E=r}]);
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.