1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8698],{5010:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>x});var n=r(37876),a=r(14232),s=r(48230),l=r.n(s),i=r(89099),d=r(62422),o=r(92814),c=r(49297);function x(){let{learner:e,band:t}=(0,i.useRouter)().query,[r,s]=(0,a.useState)({loading:!0}),[x,u]=(0,a.useState)(0),[g,b]=(0,a.useState)(null),m=(0,a.useRef)({}),[f,p]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&fetch("/api/learn/learners").then(e=>e.json()).then(t=>{let r=(t.learners||[]).find(t=>String(t.id)===String(e));if(!r)return s({loading:!1,cards:[]});let n=r.progress?.cards||[];s({loading:!1,cards:n,standing:(0,c.CK)(n,Date.now()),name:r.first_name})}).catch(()=>s({loading:!1,cards:[]}))},[e]);let w=(r.cards?(0,c.Y3)(r.cards,Date.now(),{max:20}):[]).map(e=>({card:e,found:(0,o.PQ)(e.key)})).filter(e=>e.found);async function k(){if(p(!0),e&&Object.keys(m.current).length)try{await fetch("/api/learn/progress",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({learnerId:Number(e),reviewOnly:!0,results:m.current})})}catch{}}if(r.loading)return(0,n.jsx)(d.Ay,{title:"Practice",children:(0,n.jsx)("div",{className:"h-40 rounded-3xl bg-white border border-orange-100 app-shine"})});if(!w.length||f){let e=Object.keys(m.current).length,t=Object.values(m.current).filter(Boolean).length;return(0,n.jsx)(d.Ay,{title:"Practice",children:(0,n.jsxs)("div",{className:"text-center py-12",children:[(0,n.jsx)("p",{className:"text-5xl mb-3",children:e?"\uD83C\uDF31":"â
"}),(0,n.jsx)("h1",{className:"text-xl font-extrabold text-brand-navy dark:text-white",children:e?"Review done":"Nothing to review yet"}),(0,n.jsx)("p",{className:"text-gray-500 dark:text-white/60 text-sm mt-2 max-w-xs mx-auto leading-relaxed",children:e?`${t} of ${e} remembered. The ones you missed will come back sooner.`:"Words come back here a day or two after you learn them, then less and less often as they stick."}),r.standing?.total>0&&(0,n.jsxs)("p",{className:"text-gray-400 dark:text-white/40 text-xs mt-4",children:[r.standing.total," words in your review deck \xb7 ",r.standing.known+r.standing.mastered," settled in"]}),(0,n.jsx)(l(),{href:"/app/learn",className:"inline-block mt-6 bg-brand-orange text-white font-bold rounded-2xl px-6 py-3 text-sm",children:"Back to lessons"})]})})}let y=w[Math.min(x,w.length-1)],j=y.found.word,N=y.found.unit.id,v=(0,o.U7)(N,j.tr),_="latin"!==(0,o.BV)(t).script,S=[...y.found.unit.words.filter(e=>e.tr!==j.tr).slice(0,3).map(e=>e.en),j.en].sort();return(0,n.jsxs)(d.Ay,{title:"Practice",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,n.jsx)(l(),{href:"/app/learn",className:"text-gray-400 dark:text-white/40 text-sm shrink-0",children:"â"}),(0,n.jsx)("div",{className:"flex-1 h-2 rounded-full bg-orange-100 dark:bg-white/10 overflow-hidden",children:(0,n.jsx)("div",{className:"h-full bg-brand-green-dark transition-all duration-300",style:{width:`${Math.round(x/w.length*100)}%`}})}),(0,n.jsxs)("span",{className:"text-[11px] font-bold text-gray-400 dark:text-white/40 shrink-0",children:[x+1,"/",w.length]})]}),(0,n.jsxs)("div",{className:"bg-white dark:bg-white/5 rounded-3xl border border-orange-100 dark:border-white/10 p-6 shadow-xs",children:[(0,n.jsx)("p",{className:"text-[11px] font-bold uppercase tracking-wide text-brand-green-dark mb-3",children:"Do you still remember?"}),_&&(0,n.jsx)("p",{className:"text-3xl font-bold text-brand-navy dark:text-white text-center leading-tight",lang:"hi",children:j.hi}),(0,n.jsx)("p",{className:`text-center font-bold text-brand-navy dark:text-white ${_?"text-lg mt-1":"text-4xl"}`,children:j.tr}),(0,n.jsx)("div",{className:"flex justify-center mt-4 mb-5",children:(0,n.jsx)(h,{audio:v},v)}),(0,n.jsx)("div",{className:"space-y-2",children:S.map(e=>(0,n.jsx)("button",{onClick:()=>{!g&&(b(e),m.current[v]=e===j.en)},disabled:!!g,className:`w-full text-left rounded-2xl border px-4 py-3 text-sm font-semibold transition-colors ${g===e?e===j.en?"bg-green-50 border-brand-green-dark text-brand-green-dark":"bg-red-50 border-red-300 text-red-600":g&&e===j.en?"bg-green-50 border-brand-green-dark text-brand-green-dark":"bg-white dark:bg-white/4 border-gray-200 dark:border-white/10 text-brand-navy dark:text-white"}`,children:e},e))}),g&&(0,n.jsx)("p",{className:`text-center text-sm font-bold mt-3 ${g===j.en?"text-brand-green-dark":"text-gray-500 dark:text-white/60"}`,children:g===j.en?"Still there!":`It means â${j.en}â â it will come back sooner now.`})]}),g&&(0,n.jsx)("button",{onClick:function(){b(null),x+1>=w.length?k():u(x+1)},className:"w-full mt-5 bg-brand-navy text-white font-bold rounded-2xl py-3.5 text-sm active:scale-[0.99]",children:x+1>=w.length?"Finish":"Next"})]})}function h({audio:e}){let t=(0,a.useRef)(null),[r,s]=(0,a.useState)(!1);return(0,n.jsxs)("span",{className:"inline-flex flex-col items-center gap-1",children:[(0,n.jsx)("audio",{ref:t,src:`/api/learn/audio?key=${encodeURIComponent(e)}`,preload:"none",onError:()=>s(!0)}),(0,n.jsxs)("button",{onClick:()=>{s(!1),t.current?.play().catch(()=>s(!0))},className:`inline-flex items-center gap-2 font-bold rounded-full px-4 py-2 text-sm active:scale-95 ${r?"bg-gray-100 dark:bg-white/10 text-gray-500 dark:text-white/50":"bg-orange-50 dark:bg-white/10 text-brand-orange"}`,children:[(0,n.jsxs)("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,n.jsx)("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),(0,n.jsx)("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"})]}),r?"Try again":"Hear it"]}),r&&(0,n.jsx)("span",{className:"text-[11px] text-gray-400 dark:text-white/40",children:"No sound yet â carry on."})]})}},49297:(e,t,r)=>{"use strict";r.d(t,{CK:()=>s,Y3:()=>a});let n=e=>{if(null==e)return null;if(e instanceof Date)return e.getTime();if("number"==typeof e)return e;let t=Date.parse(String(e));return Number.isNaN(t)?null:t};function a(e=[],t=Date.now(),{max:r=20}={}){return e.filter(e=>(function(e,t=Date.now()){let r=n(e?.due);return null==r||r<=t})(e,t)).sort((e,t)=>
1(n(e.due)??0)-(n(t.due)??0)).slice(0,r)}function s(e=[],t=Date.now()){let r=0,n=0,l=0;for(let t of e){let e=Number(t.box)||0;e>=6?l++:e>=4?n++:r++}return{total:e.length,learning:r,known:n,mastered:l,due:a(e,t,{max:9999}).length}}},63584:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/learn/practice",function(){return r(5010)}])}},e=>{e.O(0,[8230,900,8766,2422,2814,636,6593,8792],()=>e(e.s=63584)),_N_E=e.O()}]);
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.