1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BjKjOzxq.js","assets/vendor-react-4XT1lARu.js","assets/motion-BM9awnXo.js","assets/index-BVK4sMpl.js","assets/i18n-D2s5SYoo.js","assets/vendor-radix-Dw269-bE.js","assets/index-tC3l5Q6-.css","assets/BugReportSheet-QgJaSQPs.js","assets/useHapticConfig-C_ZeV05c.js","assets/schema-CgDlJKsP.js","assets/fluid-DAgnqsUg.js","assets/LockedContent-BUQyaf6R.js","assets/GuestSignupPrompt-5aMyNrBZ.js","assets/rotate-ccw-CW08gl13.js","assets/eye-off-ts5o47YC.js","assets/eye-CR6l8q_5.js","assets/switch-KIf71EN3.js","assets/popover-Do544U9E.js","assets/type-BVpfSWGe.js","assets/tag-DZ6Hr7Zc.js","assets/mouse-pointer-click-DxC0pu37.js","assets/calendar-days-DbZdHarG.js","assets/infinity-D38nt8d7.js","assets/use-motion-value-j5_Z5R2I.js","assets/list-checks-Gdk31EiI.js","assets/link-CV6MU3zy.js","assets/scale-DOWMCxxf.js","assets/trending-down-BRHeyr7I.js","assets/timer-BSNDEPhH.js","assets/tabs-CAN9dd7h.js","assets/textarea-CVdtJ7zA.js","assets/RevisionAnalytics-D3wZ_fDE.js","assets/skeleton-c6EPB6ZS.js","assets/generateCategoricalChart-2KZu1iG2.js","assets/index-Dh4i1-J3.js","assets/AreaChart-Dv1Vsn0a.js","assets/plus-BPUL2Yay.js","assets/lock-open-B1Kg1aQt.js","assets/trash-2-BJuB1KE5.js","assets/square-pen-D4u9WBDu.js"])))=>i.map(i=>d[i]); 2import{i as K,f as Ra,u as Aa,b as Ie,d as E,O as Ze,N as ea,_ as $a,e as D,I as J,H as Q,P as aa,q as S}from"./i18n-D2s5SYoo.js";import{r as p,j as e,R as Oa,a as Ba}from"./vendor-react-4XT1lARu.js";import{u as Ia,R as za,j as ce,k as Va,i as ta,t as qa,l as Ga,d as sa,P as Ha,H as Ua,c as ra}from"./fluid-DAgnqsUg.js";import{cw as na,bC as Wa,cb as wa,c9 as _a,ca as Ka,O as Ya,cx as Z,a4 as Ja,k as Qa,c8 as Xa,o as Ae,bh as Za,a5 as et,u as at,at as tt,av as st,g as ya,Y as rt,h as nt,f as ze,a9 as Ve,S as qe,T as Na,an as ka,bq as de,cy as Ge,e as w,br as ue,bz as it,bA as lt,bs as me,bt as he,aC as b,ah as A,ai as $,aj as O,ak as B,al as o,af as U,l as le,F as Ce,bi as xe,bj as ge,bk as ve,bd as ia,cz as la,ay as Fe,bu as oa,cA as ca,B as X,Z as ot,x as ct,cB as dt,bl as ut,bm as mt}from"./index-BVK4sMpl.js";import{F as ht}from"./LockedContent-BUQyaf6R.js";import{T as xt,a as gt,b as Te,c as Pe}from"./tabs-CAN9dd7h.js";import{T as Ee}from"./textarea-CVdtJ7zA.js";import{S as da}from"./switch-KIf71EN3.js";import{R as vt}from"./RevisionAnalytics-D3wZ_fDE.js";import{P as ua}from"./plus-BPUL2Yay.js";import{L as ma}from"./lock-open-B1Kg1aQt.js";import{T as De}from"./trash-2-BJuB1KE5.js";import{S as ha}from"./square-pen-D4u9WBDu.js";function pt(s){return s.includes("removeChild")||s.includes("insertBefore")||s.includes("is not a child of this node")||s.includes("The object can not be found here")}class ft extends p.Component{constructor(i){super(i),this.handleRetry=()=>{this.setState(d=>({error:null,attemptKey:d.attemptKey+1}))},this.state={error:null,attemptKey:0}}static getDerivedStateFromError(i){return{error:i}}componentDidCatch(i,d){const l=String((i==null?void 0:i.message)??i??"");if(console.error(`[PracticeErrorBoundary:${this.props.surface}] Caught error:`,l,d),!na(l)){if(pt(l)){console.warn(`[PracticeErrorBoundary:${this.props.surface}] portal teardown error reached React â the main.tsx Node.prototype guard did not absorb it`);return}try{Wa(l,{stack:i==null?void 0:i.stack,source:"PracticeErrorBoundary",context:{surface:this.props.surface,componentStack:d.componentStack},severity:"critical"})}catch{}}}render(){var i;if(this.state.error){if(na(String(((i=this.state.error)==null?void 0:i.message)??"")))throw this.state.error;return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 px-6 py-12 text-center",role:"alert","data-testid":`error-${this.props.surface}`,children:[e.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:this.props.message??"Something went wrong with this question. Your progress is saved."}),e.jsx("button",{type:"button",onClick:this.handleRetry,className:"rounded-full bg-primary px-5 py-2 text-sm font-semibold text-primary-foreground","data-testid":`button-retry-${this.props.surface}`,children:this.props.retryLabel??"Try again"})]})}return e.jsx(Oa.Fragment,{children:this.props.children},this.state.attemptKey)}}const jt=80;function bt(s,i,d,l=jt){return d&&s-i>=l}const wt=s=>s instanceof HTMLElement&&s.matches('input, textarea, [contenteditable="true"]');function yt(s){p.useEffect(()=>{if(typeof window>"u")return;
2const i=window.visualViewport;if(!i)return;let d=0,l=i.height,m=i.width;const t=()=>{d=0;const c=s.current;if(!c)return;const k=i.height;c.style.setProperty("--rv2-vvh",`${k}px`),c.style.setProperty("--rv2-vvoffset",`${Math.max(0,i.offsetTop)}px`);const x=document.activeElement,I=wt(x)&&c.contains(x);Math.abs(i.width-m)>1&&(m=i.width,l=k),bt(l,k,I)?c.setAttribute("data-rv2-kb-open",""):(c.removeAttribute("data-rv2-kb-open"),(!I||k>l)&&(l=k))},g=()=>{d||(d=requestAnimationFrame(t))};return t(),i.addEventListener("resize",g),i.addEventListener("scroll",g),document.addEventListener("focusin",g),document.addEventListener("focusout",g),()=>{d&&cancelAnimationFrame(d),i.removeEventListener("resize",g),i.removeEventListener("scroll",g),document.removeEventListener("focusin",g),document.removeEventListener("focusout",g);const c=s.current;c&&(c.style.removeProperty("--rv2-vvh"),c.style.removeProperty("--rv2-vvoffset"),c.removeAttribute("data-rv2-kb-open"))}},[s])}const xa=44,V=20,Me=(s={})=>({width:xa,height:xa,borderRadius:999,border:s.bordered?"1px solid var(--rv2-line-acc)":"none",background:"transparent",color:s.bordered?"var(--rv2-accent)":"var(--rv2-muted)",cursor:"pointer",flexShrink:0});function ga({children:s,color:i,bg:d,border:l,animate:m,compact:t,testId:g}){return e.jsx("span",{"data-testid":g,style:{fontSize:ce(12),fontWeight:600,color:i,background:d,border:`1px solid ${l}`,borderRadius:999,padding:t?"6px 10px":"6px 13px",whiteSpace:"nowrap",animation:m?"rv2PopIn 0.35s ease":void 0},children:s})}function Nt({theme:s,onToggleTheme:i,onExit:d,chrome:l=!0,combo:m=0,xp:t=0,answered:g=0,total:c=0,currentNumber:k=0,zenMode:x=!1,onZenEnd:I,textScale:ee=1,readingScale:W=1,fit:q=1,onOpenSettings:ae,onOpenBugReport:pe,onOpenHelp:G,children:r}){const N=K(),u=wa(),_=Ia(),H=_/Math.max(ee,.5),te=Va(H),F=p.useRef(null);yt(F),p.useEffect(()=>{const je=window.scrollY,re=document.documentElement,j=document.body,ne=re.style.overflow,be=j.style.overflow,ie=j.style.position,we=j.style.top,$e=j.style.left,Y=j.style.right,Oe=j.style.backgroundColor,T=document.getElementById("root"),ye=T==null?void 0:T.style.visibility;re.style.overflow="hidden",j.style.overflow="hidden",j.style.position="fixed",j.style.top=`-${je}px`,j.style.left="0",j.style.right="0";const Ne=F.current?getComputedStyle(F.current).getPropertyValue("--rv2-bg").trim():"";return Ne&&(j.style.backgroundColor=Ne),T&&(T.style.visibility="hidden"),()=>{re.style.overflow=ne,j.style.overflow=be,j.style.position=ie,j.style.top=we,j.style.left=$e,j.style.right=Y,j.style.backgroundColor=Oe,T&&(T.style.visibility=ye??""),window.scrollTo(0,je)}},[]);const fe=c>0?Math.min(100,100*k/c):0,se=e.jsxs("div",{ref:F,"data-rv2-theme":s,"data-rv2-density":te,className:"fixed left-0 right-0 z-[9999] font-sans overflow-y-auto overflow-x-hidden overscroll-y-contain",style:{to
2p:0,height:"calc(var(--rv2-vvh, 100dvh) + var(--rv2-vvoffset, 0px))",background:"radial-gradient(130% 70% at 50% -5%, var(--rv2-bg2) 0%, var(--rv2-bg) 62%)",color:"var(--rv2-text)",transition:"background 0.4s","--rv2-text-scale":ee,"--rv2-reading-scale":W,"--rv2-fit":q,"--rv2-evh":`${Math.max(_,320)/100}px`},children:[e.jsx("style",{children:za}),e.jsxs("div",{className:"h-full w-full flex flex-col items-center",style:{boxSizing:"border-box",height:"100%",padding:"22px 20px 32px",paddingTop:"calc(var(--rv2-pad-col-top-kb, var(--rv2-pad-col-top)) + var(--safe-area-top, 0px) + var(--rv2-vvoffset, 0px))",paddingBottom:"calc(max(var(--rv2-pad-col-bottom-kb, var(--rv2-pad-col-bottom)), var(--rv2-bottom-nav-clearance, 0px)) + var(--rv2-safe-bottom-kb, var(--safe-area-bottom, 0px)))",paddingLeft:"max(var(--rv2-pad-col-x), var(--rv2-safe-left))",paddingRight:"max(var(--rv2-pad-col-x), var(--rv2-safe-right))"},children:[l&&e.jsxs("div",{className:"rv2-session-chrome contents",children:[e.jsxs("div",{className:"w-full max-w-[640px] flex items-center",style:{columnGap:"clamp(4px, calc(4px + (100vw - 320px) * 0.1), 8px)"},children:[e.jsx("button",{type:"button",onClick:d,"aria-label":N.revision.exit,"data-testid":"button-rv2-exit",className:"rv2-tap",style:{width:38,height:38,borderRadius:999,border:"1px solid var(--rv2-line-acc)",background:"transparent",color:"var(--rv2-accent)",fontSize:ce(15),cursor:"pointer",flexShrink:0},children:"â"}),e.jsx("div",{className:"flex-1"}),e.jsxs(ga,{color:"var(--rv2-gold)",bg:"var(--rv2-gold-dim)",border:"var(--rv2-gold-dim)",compact:!0,testId:"chip-rv2-xp",children:["â
",N.revisionV2.xpChip(t)]}),pe&&e.jsx("button",{type:"button",onClick:pe,"aria-label":N.revisionV2.bugReportAria,title:N.revisionV2.bugReportAria,"data-testid":"button-rv2-open-bug-report",className:"rv2-tap inline-flex items-center justify-center",style:Me(),children:e.jsx(_a,{size:V})}),e.jsx("button",{type:"button",onClick:i,"aria-label":N.revisionV2.themeToggleAria,"data-testid":"button-rv2-theme-toggle",className:"rv2-tap rv2-chrome-theme inline-flex items-center justify-center",style:Me(),children:s==="dark"?e.jsx(Ka,{style:{width:V,height:V}}):e.jsx(Ya,{style:{width:V,height:V}})}),G&&e.jsx("button",{type:"button",onClick:G,"aria-label":N.revisionV2.helpSheetTitle,title:N.revisionV2.helpSheetTitle,"data-testid":"button-rv2-open-help",className:"rv2-tap inline-flex items-center justify-center",style:Me(),children:e.jsx(Z,{style:{width:V,height:V}})}),ae&&e.jsx("button",{type:"button",onClick:ae,"aria-label":N.revisionV2.settingsPanelTitle,"data-testid":"button-rv2-open-settings",className:"rv2-tap inline-flex items-center justify-center",style:Me(),children:e.jsx(Ja,{style:{width:V,height:V}})})]}),m>=2&&e.jsx("div",{className:"rv2-chrome-chips w-full max-w-[640px] flex items-center justify-center mt-2.5",children:e.jsxs(ga,{color:"#F5A65B",bg:"rgba(245,166,91,0.12)",border:"rgba(245,166,91,0.3)",animate:!u,testId:"chip-rv2-combo",children:["ð¥ ",N.revisionV2.comboChip(m)]})}),x?e.jsxs("div",{className:"w-full max-w-[640px] flex items-center justify-between gap-3",style:{marginTop:"var(--rv2-progress-mt)"},"aria-label":N.revisionV2.questionProgressAria,children:[e.jsxs("span",{"data-testid":"text-rv2-zen-count",className:"inline-flex items-center gap-1.5",style:{height:32,padding:"0 14px",borderRadius:999,border:"1px solid var(--rv2-line-acc)",background:"var(--rv2-accent-dim)",color:"var(--rv2-accent)",fontSize:ce(13),fontWeight:600,flexShrink:0},children:[e.jsx(Qa,{className:"h-4 w-4"}),g]}),I&&e.jsx("button",{type:"button",onClick:I,"data-testid":"button-rv2-zen-end",className:"rv2-tap",style:{height:32,padding:"0 14px",borderRadius:999,border:"1px solid var(--rv2-line-acc)",background:"transparent",color:"var(--rv2-accent)",fontFamily:"inherit",fontSize:ce(12),fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},children:N.revisionV2.finishSession})]}):e.jsxs("div",{className:"w-full max-w-[640px] flex items-center gap-3",style:{marginTop:"var(--rv2-progress-mt)"},"aria-label":N.revisionV2.questionProgressAria,children:[e.jsx("div",{style:{flex:1,height:8,borderRadius:999,background:"var(--rv2-line)",overflow:"hidden"},children:e.jsx("div",{"data-testid":"bar-rv2-progress",style:{width:`${fe}%`,height:"100%",borderRadius:999,background:"linear-gradient(90deg, var(--rv2-accent), var(--rv2-accent2))",transition:u?"none":"width 0.5s cubic-bezier(0.2,0.9,0.3,1)"}})}),e.jsxs("span",{"data-testid":"text-rv2-progress-counter",style:{fontSize:ce(12.5),fontWeight:600,color:"var(--rv2-muted)",flexShrink:0},children:[k," / ",c]})]})]}),r]})]});return Ba.createPortal(se,document.body)}function va({textScale:s=1,readingScale:i=1}){const{theme:d,toggleTheme:l}=Xa();return e.jsx(Nt,{theme:d,onToggleTheme:l,onExit:()=>{},chrome:!1,textScale:s,readingScale:i,children:e.jsx(kt,{})})}function kt(){const s=wa(),i=K();return e.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"flex-1 flex flex-col items-center justify-center gap-6","data-testid":"stage-rv2-daily-loading",children:[e.jsx("span",{className:"sr-only",children:i.common.loading}),e.jsx("div",{className:"flex items-end",style:{gap:10,height:18},"aria-hidden":"true",children:[0,1,2].map(d=>
2e.jsx(Ae.span,{style:{width:11,height:11,borderRadius:999,background:"var(--rv2-accent)"},animate:s?{opacity:.5}:{y:[0,-9,0],opacity:[.35,1,.35]},transition:s?void 0:{duration:1.05,ease:[.4,0,.2,1],repeat:1/0,delay:d*.15}},d))})]})}const St=p.lazy(()=>$a(()=>import("./index-BjKjOzxq.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39]))),Lt={hidden:{opacity:0,y:20},visible:s=>({opacity:1,y:0,transition:{delay:s*.1,duration:.5,ease:[.25,.46,.45,.94]}})};function Ct({value:s}){const i=s.toLocaleString().split("");return e.jsx("span",{className:"inline-flex",children:i.map((d,l)=>e.jsx(Ae.span,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.4,delay:l*.05,type:"spring",bounce:.3},children:d},`${l}-${d}`))})}function oe({title:s,value:i,icon:d,iconBg:l,iconColor:m,cardBg:t,index:g}){return e.jsx(Ae.div,{custom:g,initial:"hidden",animate:"visible",variants:Lt,className:"group",children:e.jsxs("div",{className:` 3 rounded-2xl p-3 sm:p-5 md:p-6 ${t} 4 border border-border 5 transition-all duration-300 6 hover:shadow-lg hover:shadow-black/[0.04] 7 min-h-[110px] sm:min-h-[130px] md:min-h-[150px] flex flex-col justify-between 8 `,children:[e.jsx("div",{className:`inline-flex p-2 sm:p-2.5 rounded-xl ${l} w-fit transition-transform duration-300 group-hover:scale-110`,children:e.jsx(d,{className:`h-4 w-4 sm:h-5 sm:w-5 ${m}`})}),e.jsxs("div",{className:"mt-auto pt-2 sm:pt-4",children:[e.jsx("div",{className:"text-2xl sm:text-3xl md:text-4xl font-bold text-foreground dark:text-white tracking-tight",children:e.jsx(Ct,{value:i})}),e.jsx("p",{className:"text-[9px] sm:text-[11px] font-semibold uppercase tracking-wide text-[#999] dark:text-[#777] mt-1 leading-tight",children:s})]})]})})}function Sa(s){return s<20?"text-rose-500":s<40?"text-orange-500":s<60?"text-amber-500":s<80?"text-teal-500":"text-emerald-500"}function pa(s,i){return s<20?i.strengthNew:s<40?i.strengthLearning:s<60?i.strengthFamiliar:s<80?i.strengthStrong:i.strengthMastered}function Ft(){const s=K(),i=[{label:s.revision.strengthNew,range:"0-19%",color:"bg-rose-500",description:s.revision.strengthNewDesc},{label:s.revision.strengthLearning,range:"20-39%",color:"bg-orange-500",description:s.revision.strengthLearningDesc},{label:s.revision.strengthFamiliar,range:"40-59%",color:"bg-amber-500",description:s.revision.strengthFamiliarDesc},{label:s.revision.strengthStrong,range:"60-79%",color:"bg-teal-500",description:s.revision.strengthStrongDesc},{label:s.revision.strengthMastered,range:"80-100%",color:"bg-emerald-500",description:s.revision.strengthMasteredDesc}],d=[{icon:qe,title:s.revision.modeLearnNewTitle,range:"0-19%",color:"text-purple-500",description:s.revision.modeLearnNewDesc},{icon:ya,title:s.revision.modePracticeWeakTitle,range:"0-39%",color:"text-orange-500",description:s.revision.modePracticeWeakDesc},{icon:ot,title:s.revision.modeReinforce,range:"40-79%",color:"text-yellow-500",description:s.revision.modeReinforceDesc},{icon:ct,title:s.revision.modeRetain,range:"80-100%",color:"text-emerald-500",description:s.revision.modeRetainDesc}];return e.jsxs(de,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(w,{variant:"ghost",size:"icon",className:"text-muted-foreground","data-testid":"button-how-it-works",children:e.jsx(Z,{className:"h-5 w-5"})})}),e.jsxs(ue,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsx(me,{children:e.jsxs(he,{className:"flex items-center gap-2 text-xl",children:[e.jsx(Z,{className:"h-5 w-5 text-primary"}),s.revision.howItWorksTitle]})}),e.jsxs("div",{className:"space-y-6 pt-2","data-testid":"modal-how-it-works-content",children:[e.jsxs("div",{"data-testid":"section-strength-indicator",children:[e.jsx("h3",{className:"font-semibold text-base mb-3",children:s.revision.strengthIndicatorTitle}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s.revision.strengthIndicatorDesc}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 mb-4","data-testid":"visual-strength-dots",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:i.map((l,m)=>e.jsxs(xe,{children:[e.jsx(ge,{asChild:!0,children:e.jsx("div",{className:`w-4 h-4 rounded-full ${m===1?"ring-2 ring-offset-2 ring-orange-500":""} ${l.color}`,"data-testid":`dot-strength-${l.label.toLowerCase()}`})}),e.jsx(ve,{children:e.jsxs("p",{children:[l.label,": ",l.range]})})]},l.label))}),e.jsxs("span",{className:"text-sm font-medium text-orange-500 uppercase","data-testid":"text-example-strength",children:["20% ",s.revision.strengthLearning]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:s.revision.strengthExampleNote})]})]}),e.jsxs("div",{"data-testid":"section-strength-levels",children:[e.jsx("h3",{className:"font-semibold text-base mb-3",children:s.revision.fiveStrengthLevelsTitle}),e.jsx("div",{className:"space-y-2",children:i.map(l=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-muted/30","data-testid":`row-level-${l.label.toLowerCase()}`,children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${l.color} flex-shrink-0`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:l.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",l.range,")"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.description})]})]},l.label))})]}),e.jsxs("div",{"data-testid":"section-practice-effects",children:[e.jsx("h3",{className:"font-semibold text-base mb-3",children:s.revision.howPracticeAffectsTitle}),e.jsxs("div",{className:"bg-muted/30 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ka,{className:"h-4 w-4 text-green-500 mt-0.5 flex-shrink-0"}),e.jsxs("p",{className:"text-sm",children:[e.jsx("strong",{children:s.revision.correctAnswersLabel})," ",s.revision.correctAnswersEffect]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Na,{className:"h-4 w-4 text-orange-500 mt-0.5 flex-shrink-0"}),e.jsxs("p",{className:"text-sm",children:[e.jsx("strong",{children:s.revision.wrongAnswersLabel})," ",s.revision.wrongAnswersEffect]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(dt,{className:"h-4 w-4 text-blue-500 mt-0.5 flex-shrink-0"}),e.jsxs("p",{className:"text-sm",children:[e.jsx("strong",{children:s.revision.streaksLabel})," ",s.revision.streaksEffect]})]})]})]}),e.jsxs("div",{"data-testid":"section-practice-modes",children:[e.jsx("h3",{className:"font-semibold text-base mb-3",children:s.revision.whichModeTitle}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:s.revision.whichModeSubtitle}
8),e.jsx("div",{className:"space-y-2",children:d.map(l=>e.jsxs("div",{className:"flex items-start gap-3 p-2 rounded-lg bg-muted/30","data-testid":`row-mode-${l.title.toLowerCase().replace(" ","-")}`,children:[e.jsx(l.icon,{className:`h-5 w-5 ${l.color} mt-0.5 flex-shrink-0`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:l.title}),e.jsx(X,{variant:"outline",className:"text-xs",children:l.range})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.description})]})]},l.title))})]}),e.jsxs("div",{className:"bg-primary/5 border border-primary/20 rounded-lg p-4","data-testid":"section-pro-tip",children:[e.jsxs("h3",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4 text-primary"}),s.revision.proTipTitle]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.revision.proTipText})]})]})]})]})}function Tt({strength:s}){const i=K(),d=2*Math.PI*18,l=d-s/100*d,m=Sa(s);return e.jsxs("div",{className:"relative inline-flex flex-col items-center","data-testid":"strength-meter",children:[e.jsxs("div",{className:"relative w-12 h-12",children:[e.jsxs("svg",{className:"w-12 h-12 -rotate-90",viewBox:"0 0 44 44",children:[e.jsx("circle",{cx:"22",cy:"22",r:"18",stroke:"currentColor",strokeWidth:"4",fill:"none",className:"text-muted/30"}),e.jsx("circle",{cx:"22",cy:"22",r:"18",stroke:"currentColor",strokeWidth:"4",fill:"none",strokeLinecap:"round",className:m,style:{strokeDasharray:d,strokeDashoffset:l,transition:"stroke-dashoffset 0.5s ease-in-out"}})]}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("span",{className:`text-xs font-bold ${m}`,children:[s,"%"]})})]}),e.jsx("div",{className:`mt-1 text-[10px] font-medium ${m} uppercase tracking-wide`,children:s<20?i.revision.strengthNew:s<40?i.revision.strengthLearning:s<60?i.revision.strengthFamiliar:s<80?i.revision.strengthStrong:i.revision.strengthMastered})]})}const Pt=[{label:"New",value:10,color:"bg-rose-500",hoverColor:"hover:bg-rose-600",activeColor:"ring-rose-500"},{label:"Learning",value:30,color:"bg-orange-500",hoverColor:"hover:bg-orange-600",activeColor:"ring-orange-500"},{label:"Familiar",value:50,color:"bg-amber-500",hoverColor:"hover:bg-amber-600",activeColor:"ring-amber-500"},{label:"Strong",value:70,color:"bg-teal-500",hoverColor:"hover:bg-teal-600",activeColor:"ring-teal-500"},{label:"Mastered",value:100,color:"bg-emerald-500",hoverColor:"hover:bg-emerald-600",activeColor:"ring-emerald-500"}];function Et(s){return s<20?0:s<40?1:s<60?2:s<80?3:4}function fa(s){return s<20?"10":s<40?"30":s<60?"50":s<80?"70":"100"}function ja({strength:s,onSelect:i,disabled:d=!1}){const l=K(),m=Et(s),t=[l.revision.strengthNew,l.revision.strengthLearning,l.revision.strengthFamiliar,l.revision.strengthStrong,l.revision.strengthMastered];return e.jsx("div",{className:"flex items-center gap-2.5","data-testid":"strength-level-selector",children:Pt.map((g,c)=>{const k=c===m,x=c<=m;return e.jsxs(xe,{children:[e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",disabled:d,onClick:()=>i(g.value),className:` 9 w-4 h-4 rounded-full transition-all duration-200 10 ${x?g.color:"bg-muted/40"} 11 ${!d&&g.hoverColor} 12 ${k?`ring-2 ring-offset-1 ring-offset-background ${g.activeColor}`:""} 13 ${d?"cursor-not-allowed opacity-50":"cursor-pointer"} 14 `,"data-testid":`strength-level-${g.label.toLowerCase()}`})}),e.jsx(ve,{side:"bottom",className:"text-xs",children:e.jsx("p",{children:t[c]})})]},c)})})}function Dt({text:s,maxLines:i=3}){const[d,l]=p.useState(!1),[m,t]=p.useState(!1),g=p.useRef(null),c=K();return p.useEffect(()=>{if(g.current){const x=(parseInt(getComputedStyle(g.current).lineHeight)||20)*i;t(g.current.scrollHeight>x+5)}},[s,i]),e.jsxs("div",{children:[e.jsx("p",{ref:g,className:`text-sm transition-all ${!d&&m?"line-clamp-3":""}`,"data-testid":"text-vocab-translation",children:s}),m&&e.jsx("button",{onClick:()=>l(!d),className:"text-xs text-primary hover:underline flex items-center gap-1 mt-1","data-testid":"button-expand-text",children:d?e.jsxs(e.Fragment,{children:[c.revision.showLess," ",e.jsx(ut,{className:"h-3 w-3"})]}):e.jsxs(e.Fragment,{children:[c.revision.showMore," ",e.jsx(mt,{className:"h-3 w-3"})]})})]})}function Mt(s,i,d){if(!s||s==="-")return null;const l=i.toLowerCase();if(l==="german"||l==="de"){if(s==="m")return"der";if(s==="f")return"die";if(s==="n")return"das"}else if(l==="spanish"||l==="es"){if(s==="m")return"el";if(s==="f")return"la"}else if(l==="french"||l==="fr"){if(d){const m=d.trim().toLowerCase().charAt(0);if(["a","e","i","o","u","é","è","ê","ë","à ","â","î","ï","ô","ù","û","ü","Å","æ","h"].includes(m))return"l'"}if(s==="m")return"le";if(s==="f")return"la"}return null}function Rt(s){if(!s)return!1;const i=s.trim().toLowerCase().charAt(0);return["a","e","i","o","u","é","è","ê","ë","à ","â","î","ï","ô","ù","û","ü","Å","æ","h"].includes(i)}function At(s){return s==="m"?"le":s==="f"?"la":null}function Re(s){const i=s.toLowerCase();return["german","de","spanish","es","french","fr"].includes(i)}function ba(s){return typeof window>"u"?null:new URLSearchParams(window.location.search).get(s)}function $t(){const{user:s,isLoading:i}=Ra(),{convertChinese:d,showTraditional:l}=Za(),{toast:m}=Aa(),t=K(),g=(a,n)=>n==="mandarin"?d(a):a,[c,k]=p.useState({language:"",level:"",strength:"",search:""}),[x,I]=p.useState({language:"",level:"",strength:"",search:""}),[ee,W]=p.useState(!1),[q,ae]=p.useState(!1),[pe,G]=p.useState(!1),[r,N]=p.useState(null),[u,_]=p.useState(null),H=p.useRef(0),[te,F]=p.useState(()=>ba("tab")??"practice"),[fe,se]=p.useState(()=>ba("mode")),[je,re]=p.useState(0),j=a=>{se(a),re(n=>n+1)},[ne,be]=p.useState(!1),[ie,we]=p.useState(!1),[$e,Y]=p.useState(!1),[Oe,T]=p.useState(!1),ye=et(),[,Ne]=at();p.useEffect(()=>{const a=new URLSearchParams(ye||window.location.search),n=a.get("tab"),h=a.get("mode"),v=a.get("v");n&&F(n),h&&j(h),(n||h||v)&&Ne(window.location.pathname,{replace:!0})},[ye]);const{data:M=[],isLoading:La}=Ie({queryKey:["/api/revision-hub/vocabulary",c],queryFn:async()=>{const a=new URLSearchParams;c.language&&a.append("language",c.language),c.level&&a.append("level",c.level),c.strength&&a.append("strength",c.strength),c.search&&a.append("search",c.search);const n=`/api/revision-hub/vocabulary${a.toString()?"?"+a.toString():""}`;console.log("[RevisionHub] Fetching vocabulary from:",n);const h=await fetch(n,{credentials:"include"});if(!h.ok)throw new Error("Failed to fetch vocabulary");const v=await h.json();return console.log("[RevisionHub] Vocabulary fetched:",v.length,"items"),v},enabled:!!s,refetchOnMount:"always"}),{data:R=[],isLoading:Ca}=Ie({queryKey:["/api/revision-hub/grammar",x,s==null?void 0:s.nativeLanguage],queryFn:async()=>{const a=new URLSearchParams;x.language&&a.append("language",x.language),x.level&&a.append("level",x.level),x.strength&&a.append("strength",x.strength),x.search&&a.append("search",x.search),s!=null&&s.nativeLanguage&&a.append("nativeLanguage",s.nativeLanguage);const n=`/api/revision-hub/grammar${a.toString()?"?"+a.toString():""}`,h=await fetch(n,{credentials:"include"});if(!h.ok)throw new Error("Failed to fetch grammar");return h.json()},enabled:!!s,refetchOnMount:"always"}),{data:z}=Ie({queryKey:["/api/revision-hub/summary"],queryFn:async()=>{const a=await fetch("/api/revision-hub/summary",{credentials:"include"});if(!a.ok)throw new Error("Failed to fetch summary");return a.json()},enabled:!!s,refetchOnMount:"always"}),He=E({mutationFn:a=>D("POST","/api/revision-hub/vocabulary",a),onSuccess:()=>{J(S),W(!1)},onError:()=>{m({title:t.revision.failedToSaveVocab,variant:"warning"})}}),Ue=E({mutationFn:({id:a,data:n})=>D("PUT",`/api/revision-hub/vocabulary/${a}`,n),onSuccess:()=>{J(S),N(null),W(!1)},onError:()=>{m({title:t.revision.failedToUpdateVocab,variant:"warning"})}}),Fa=E({mutationFn:a=>D("DELETE",`/api/revision-hub/vocabulary/${a}`),onSuccess:()=>{J(S)}}),We=E({mutationFn:a=>D("POST","/api/revision-hub/grammar",a),onSuccess:()=>{Q(S),G(!1)},onError:()=>{m({title:t.revision.failedToSaveGrammar,variant:"warning"})}}),_e=E({mutationFn:({id:a,data:n})=>D("PUT",`/api/revision-hub/grammar/${a}`,n),onSuccess:()=>{Q(S),_(null),G(!1)},onError:()=>{m({title:t.revision.failedToUpdateGrammar,variant:"warning"})}}),Ta=E({mutationFn:a=>D("DELETE",`/api/revision-hub/grammar/${a}`),onSuccess:()=>{Q(S)}}),ke=E({mutationFn:async a=>await(await D("POST","/api/revision-hub/vocabulary/bulk-delete",a)).json(),onSuccess:()=>{J(S),aa(S),Y(!1)},onError:()=>{m({title:t.revision.failedToDeleteVocab,variant:"warning"})}}),Se=E({mutationFn:async a=>await(await D("POST","/api/revision-hub/grammar/bulk-delete",a)).json(),onSuccess:()=>{Q(S),aa(S),T(!1)},onError:()=>{m({title:t.revision.failedToDeleteGrammar,variant:"warning"})}});function Ke(a){const n=[];if(a.language){const h={mandarin:t.header.langMandarin,spanish:t.header.langSpanish,german:t.header.langGerman,french:t.header.langFrench,japanese:t.header.langJapanese,english:t.header.langEnglish};n.push(h[a.language]||a.language)}if(a.strength){const h={new:t.revision.strengthNew,learning:t.revision.strengthLearning,familiar:t.revision.strengthFamiliar,strong:t.revision.strengthStrong,mastered:t.revision.strengthMastered};n.push(h[a.strength]||a.strength)}return a.search&&n.push(t.revision.filterMatchingSearch(a.search)),n.length>0?n.join(" + "):t.revision.filterAll}function Le(a){return!!(a.language||a.strength||a.search)}async function Ye(a,n,h){const v=new File([a],n,{type:"text/csv;charset=utf-8;"});if(navigator.userAgent.includes("WirelingoApp")||!!window.ReactNativeWebView){const y=window.ReactNativeWebView;if(y!=null&&y.postMessage){const Be=await a.text();y.postMessage(JSON.stringify({action:"share-file",filename:n,content:Be,mimeType:"text/csv"})),m({title:h})}else m({title:t.revision.exportUnavailable,description:t.revision.exportUpdateApp,variant:"destructive"});return}const C=/Android|iPhone|iPad|iPod/i.test(navigator.userAgent);if(C&&(()=>{try{return!!(navigator.canShare&&navigator.canShare({files:[v]}))}catch{return!1}})()){try{await navigator.share({files:[v],title:n}),m({title:h})}catch(y){y instanceof Error&&y.name!=="AbortError"&&m({title:t.revision.exportFailed,description:t.revision.exportShareFailedDesc,variant:"destructive"})}return}if(C&&navigator.share){try{const y=await a.text();await navigator.share({text:y,title:n}),m({title:h})}catch(y){y instanceof Error&&y.name!=="AbortError"&&m({title:t.revision.exportFailed,description:t.revision.exportShareFailedDesc,variant:"destructive"})}return}const P=document.createElement("a");if("download"in P){const y=URL.createObjectURL(a);P.href=y,P.download=n,document.body.appendChild(P),P.click(),document.body.removeChild(P),URL.revokeObjectURL(y),m({title:h})}else m({title:t.revision.exportUnavailable,description:t.revision.exportOpenDesktop,variant:"destructive"})}async function Pa(){if(M.length===0)return;const a=["Language","Article Level","Word","Pronunciation (optional)","Grammatical Gender","Translation","Example Sentence (optional)","Tags (comma-separated)","Strength Level"],n=M.map(f=>[f.language||"",f.level||"",f.word,f.pronunciation||"",f.gender||"",f.translation,"",(f.tags||[]).join(", "),pa(f.strengthPercent??0,t.revision)]),h=[a,...n].map(f=>f.map(P=>`"${String(P).replace(/"/g,'""')}"`).join(",")).join(` 15`),v=new Blob(["\uFEFF"+h],{type:"text/csv;charset=utf-8;"}),L=`wirelingo-vocabulary-${new Date().toISOString().slice(0,10)}.csv`,C=t.revision.exportedVocabItems(M.length);await Ye(v,L,C)}async function Ea(){if(R.length===0)return;const a=["Language","Article Level","Pattern Title","Definition","Example (optional)","Personal Notes (optional)","Strength Level"],n=R.map(f=>[f.language||"",f.level||"",f.title,f.definition,f.example||"",f.notes||"",pa(f.strengthPercent??0,t.revision)]),h=[a,...n].map(f=>f.map(P=>`"${String(P).replace(/"/g,'""')}"`).join(",")).join(` 16`),v=new Blob(["\uFEFF"+h],{type:"text/csv;charset=utf-8;"}),L=`wirelingo-grammar-${new Date().toISOString().slice(0,10)}.csv`,C=t.revision.exportedGrammarItems(R.length);await Ye(v,L,C)}E({mutationFn:({id:a,status:n})=>D("PUT",`/api/revision-hub/vocabulary/${a}`,{status:n}),onSuccess:()=>{J(S)}}),E({mutationFn:({id:a,status:n})=>D("PUT",`/api/revision-hub/grammar/${a}`,{status:n}),onSuccess:()=>{Q(S)}});const Je=E({mutationFn:({id:a,strengthPercent:n})=>D("PUT",`/api/revision-hub/vocabulary/${a}`,{strengthPercent:n}),onSuccess:()=>{J(S)}}),Qe=E({mutationFn:({id:a,strengthPercent:n})=>D("PUT",`/api/revision-hub/grammar/${a}`,{strengthPercent:n}),onSuccess:()=>{Q(S)}}),Da=a=>{a.preventDefault();const n=new FormData(a.currentTarget),h=n.get("tags"),v=n.get("language"),L=parseInt(n.get("strengthLevel"))||0,C=n.get("gender"),f=C&&C!=="none"?C:void 0,P=n.get("baseForm"),y={language:v,level:n.get("level"),word:n.get("word"),pronunciation:n.get("pronunciation")||void 0,romaji:v==="japanese"&&n.get("romaji")||void 0,gender:Re(v)?f:void 0,baseForm:P||void 0,translation:n.get("translation"),example:n.get("example")||void 0,tags:h?h.split(",").map(Be=>
16Be.trim()).filter(Boolean):[],status:"learning",strengthPercent:L,decayLocked:r?ne:!1};r?Ue.mutate({id:r.id,data:y}):He.mutate(y)},Ma=a=>{a.preventDefault();const n=new FormData(a.currentTarget),h=parseInt(n.get("strengthLevel"))||0,v={language:n.get("language"),level:n.get("level"),title:n.get("title"),definition:n.get("definition"),example:n.get("example")||void 0,notes:n.get("notes")||void 0,status:"learning",strengthPercent:h,decayLocked:u?ie:!1};u?_e.mutate({id:u.id,data:v}):We.mutate(v)},Xe=fe==="daily_review";return i?Xe?e.jsx(va,{}):e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsx("div",{className:"animate-pulse text-muted-foreground",children:t.common.loading})}):s?e.jsx(ht,{feature:"revision",children:e.jsx("div",{className:"min-h-screen bg-background",children:e.jsx("div",{className:"container mx-auto px-6 sm:px-8 lg:px-12 py-6 max-w-7xl pb-24",children:e.jsx(Ae.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},transition:{duration:.5},children:e.jsxs(xt,{value:te,onValueChange:F,className:"w-full",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-4 mb-8",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-primary/20 to-emerald-500/20 mt-0.5",children:e.jsx(ya,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-xl md:text-2xl font-bold text-foreground","data-testid":"text-page-title",children:t.revision.revisionHub}),e.jsx(Ft,{})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5","data-testid":"text-page-description",children:t.revision.trackingSubtitle})]})]}),e.jsx("div",{className:"flex items-center gap-0.5 p-1 bg-muted rounded-2xl border border-transparent w-full sm:w-auto","data-testid":"tabs-revision-type",role:"tablist","aria-label":t.revision.ariaRevisionSections,children:[{value:"practice",icon:rt,label:t.revision.practice},{value:"analytics",icon:nt,label:t.revision.analyticsTab},{value:"vocabulary",icon:ze,label:t.revision.vocab},{value:"grammar",icon:Ve,label:t.revision.grammar}].map(a=>{const n=te===a.value,h=a.icon;return e.jsxs("button",{role:"tab","aria-selected":n,"aria-controls":`tabpanel-${a.value}`,tabIndex:n?0:-1,onClick:()=>F(a.value),onKeyDown:v=>{const L=["practice","analytics","vocabulary","grammar"],C=L.indexOf(a.value);v.key==="ArrowRight"&&(v.preventDefault(),F(L[(C+1)%L.length])),v.key==="ArrowLeft"&&(v.preventDefault(),F(L[(C-1+L.length)%L.length]))},"data-testid":`tab-${a.value}`,className:` 17 flex-1 min-w-0 flex items-center justify-center gap-1.5 px-2 sm:px-3 py-2 rounded-xl text-sm font-medium whitespace-nowrap 18 transition-all duration-200 ease-out 19 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-1 20 ${n?"bg-card text-foreground dark:text-white shadow-sm":"text-[#6a6a6a] dark:text-[#999] hover:text-foreground dark:hover:text-white"} 21 `,title:a.label,children:[e.jsx(h,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"hidden sm:inline text-[13px]",children:a.label})]},a.value)})})]}),z&&te==="practice"&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"grid grid-cols-3 grid-rows-1 md:grid-cols-5 gap-3 md:gap-4 mb-8",children:[e.jsx(oe,{title:t.revision.vocabularyLabel,value:z.totalVocabulary,icon:ze,iconBg:"bg-primary/10",iconColor:"text-primary",cardBg:"bg-card",index:0}),e.jsx(oe,{title:t.revision.grammarLabel,value:z.totalGrammar,icon:Ve,iconBg:"bg-primary/10",iconColor:"text-primary",cardBg:"bg-card",index:1}),e.jsx(oe,{title:t.revision.newItemsLabel,value:(z.newVocabulary||0)+(z.newGrammar||0),icon:qe,iconBg:"bg-primary/10",iconColor:"text-primary",cardBg:"bg-card",index:2}),e.jsx(oe,{title:t.revision.strengthLearning,value:(z.learningVocabulary||0)+(z.learningGrammar||0),icon:Na,iconBg:"bg-amber-500/15",iconColor:"text-amber-500",cardBg:"bg-card",index:3}),e.jsx(oe,{title:t.revision.strengthMastered,value:(z.masteredVocabulary||0)+(z.masteredGrammar||0),icon:ka,iconBg:"bg-primary/10",iconColor:"text-primary",cardBg:"bg-card",index:4})]})}),e.jsxs(gt,{className:"hidden",children:[e.jsx(Te,{value:"practice"}),e.jsx(Te,{value:"analytics"}),e.jsx(Te,{value:"vocabulary"}),e.jsx(Te,{value:"grammar"})]}
21),e.jsx(Pe,{value:"practice",className:"space-y-4 mt-6",children:e.jsx(ft,{surface:"revision-practice-v2",message:t.common.somethingWentWrong,retryLabel:t.common.tryAgain,children:e.jsx(p.Suspense,{fallback:Xe?e.jsx(va,{}):e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"h-7 w-7 rounded-full border-2 border-primary border-t-transparent animate-spin"})}),children:e.jsx(St,{initialMode:fe,modeRequestId:je,onModeCleared:()=>se(null)})})})}),e.jsx(Pe,{value:"analytics",className:"space-y-4 mt-6",children:e.jsx(vt,{onStartDailyReview:()=>{j("daily_review"),F("practice")},onStartWeakPractice:()=>{se("practice_weak"),F("practice")}})}),e.jsxs(Pe,{value:"vocabulary",className:"space-y-4",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(de,{open:ee,onOpenChange:a=>{a||ae(!1),W(a),a||(N(null),requestAnimationFrame(()=>{window.scrollTo(0,H.current)}))},children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(w,{"data-testid":"button-add-vocabulary",children:[e.jsx(ua,{className:"h-4 w-4 mr-2"}),t.revision.addVocabulary]})}),e.jsxs(ue,{className:q?"w-screen h-dvh max-w-none max-h-none rounded-none overflow-y-auto transition-all duration-200 flex flex-col":"sm:max-w-lg w-[calc(100vw-2rem)] max-h-[90dvh] overflow-y-auto transition-all duration-200",headerActions:e.jsxs("button",{type:"button",className:"rounded-sm p-1 bg-muted hover:bg-accent text-muted-foreground hover:text-foreground opacity-80 ring-offset-background transition-all hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",onClick:()=>ae(a=>!a),"data-testid":"button-vocab-dialog-fullscreen","aria-label":q?t.common.minimise:t.common.fullscreen,children:[q?e.jsx(it,{className:"h-4 w-4"}):e.jsx(lt,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:q?t.common.minimise:t.common.fullscreen})]}),onCloseAutoFocus:a=>{a.preventDefault(),window.scrollTo(0,H.current)},children:[e.jsx(me,{children:e.jsx(he,{children:r?t.revision.editVocabTitle:t.revision.addVocabTitle})}),e.jsxs("form",{onSubmit:Da,className:`space-y-3 ${q?"max-w-2xl mx-auto w-full":""}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(b,{htmlFor:"vocab-language",children:t.revision.labelLanguage}),e.jsxs(A,{name:"language",defaultValue:(r==null?void 0:r.language)||"mandarin",required:!0,children:[e.jsx($,{id:"vocab-language",children:e.jsx(O,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"mandarin",children:t.header.langMandarin}),e.jsx(o,{value:"spanish",children:t.header.langSpanish}),e.jsx(o,{value:"german",children:t.header.langGerman}),e.jsx(o,{value:"french",children:t.header.langFrench}),e.jsx(o,{value:"japanese",children:t.header.langJapanese}),e.jsx(o,{value:"english",children:t.header.langEnglish})]})]})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"vocab-level",children:t.revision.labelLevel}),e.jsxs(A,{name:"level",defaultValue:(r==null?void 0:r.level)||"beginner",required:!0,children:[e.jsx($,{id:"vocab-level",children:e.jsx(O,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"beginner",children:t.header.levelBeginner}),e.jsx(o,{value:"lower-intermediate",children:t.header.levelLowerIntermediate}),e.jsx(o,{value:"intermediate",children:t.header.levelIntermediate}),e.jsx(o,{value:"upper-intermediate",children:t.header.levelUpperIntermediate}),e.jsx(o,{value:"advanced",children:t.header.levelAdvanced})]})]})]})]}),e.jsxs("div",{className:"grid gap-3",style:{gridTemplateColumns:Re((r==null?void 0:r.language)||"")?"1fr 1fr":"1fr"},children:[e.jsxs("div",{children:[e.jsxs(b,{htmlFor:"vocab-word",children:[l&&(r==null?void 0:r.language)==="mandarin"?t.revision.labelSimplified:t.revision.labelWord," *"]}),e.jsx(U,{id:"vocab-word",name:"word",lang:le(r==null?void 0:r.language),defaultValue:r==null?void 0:r.word,required:!0}),(r==null?void 0:r.partOfSpeech)&&e.jsxs("div",{className:"mt-1 flex items-center gap-1 flex-wrap",children:[e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs bg-muted/60 text-muted-foreground
21/70 font-normal","data-testid":"text-vocab-pos-display",children:r.partOfSpeech}),r.baseForm&&!ta(r.baseForm,r.word)&&e.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs bg-emerald-50 dark:bg-emerald-950/30 text-emerald-700 dark:text-emerald-400 font-normal","data-testid":"text-vocab-base-form-display",children:["â ",r.baseForm]})]})]}),Re((r==null?void 0:r.language)||"")&&e.jsxs("div",{children:[e.jsxs(b,{htmlFor:"vocab-gender",children:[t.revision.labelGender,e.jsxs("span",{className:"text-muted-foreground text-xs ml-1",children:["(",(r==null?void 0:r.language)==="german"?"der/die/das":"el/la",")"]})]}),e.jsxs(A,{name:"gender",defaultValue:(r==null?void 0:r.gender)||"none",children:[e.jsx($,{id:"vocab-gender","data-testid":"select-vocab-gender",children:e.jsx(O,{placeholder:t.revision.selectGender})}),e.jsxs(B,{children:[e.jsx(o,{value:"none",children:t.revision.genderNotApplicable}),e.jsx(o,{value:"m",children:(r==null?void 0:r.language)==="german"?`${t.revision.genderMasculine} (der)`:(r==null?void 0:r.language)==="spanish"?`${t.revision.genderMasculine} (el)`:`${t.revision.genderMasculine} (le)`}),e.jsx(o,{value:"f",children:(r==null?void 0:r.language)==="german"?`${t.revision.genderFeminine} (die)`:(r==null?void 0:r.language)==="spanish"?`${t.revision.genderFeminine} (la)`:`${t.revision.genderFeminine} (la)`}),(r==null?void 0:r.language)==="german"&&e.jsxs(o,{value:"n",children:[t.revision.genderNeuter," (das)"]})]})]})]})]}),e.jsxs("div",{children:[e.jsxs(b,{htmlFor:"vocab-translation",children:[t.revision.labelTranslation," *"]}),e.jsxs("div",{className:"relative",children:[e.jsx(U,{id:"vocab-translation",name:"translation",defaultValue:r==null?void 0:r.translation,required:!0,className:r!=null&&r.translationLanguage?"pr-8":""}),(r==null?void 0:r.translationLanguage)&&e.jsx("div",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:e.jsx(Ce,{language:r.translationLanguage,size:"xs"})})]})]}),l&&(r==null?void 0:r.language)==="mandarin"&&(r==null?void 0:r.word)&&e.jsxs("div",{children:[e.jsx(b,{htmlFor:"vocab-traditional",children:t.revision.labelTraditional}),e.jsx(U,{id:"vocab-traditional",lang:"zh",value:d(r.word),readOnly:!0,className:"bg-muted text-muted-foreground"})]}),e.jsxs("div",{children:[e.jsxs(b,{htmlFor:"vocab-pronunciation",children:[(r==null?void 0:r.language)==="japanese"?t.revision.labelReading:(r==null?void 0:r.language)==="mandarin"?"Pinyin":t.revision.labelPronunciation,e.jsxs("span",{className:"text-muted-foreground text-xs ml-1",children:["(",t.common.optional.toLowerCase(),")"]})]}),e.jsx(U,{id:"vocab-pronunciation",name:"pronunciation",defaultValue:(r==null?void 0:r.pronunciation)||""})]}),e.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"1fr"},children:e.jsxs("div",{children:[e.jsx(b,{htmlFor:"vocab-strength",children:t.revision.labelStrengthLevel}),e.jsxs(A,{name:"strengthLevel",defaultValue:fa((r==null?void 0:r.strengthPercent)??0),required:!0,children:[e.jsx($,{id:"vocab-strength",children:e.jsx(O,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"10",children:t.revision.strengthNew}),e.jsx(o,{value:"30",children:t.revision.strengthLearning}),e.jsx(o,{value:"50",children:t.revision.strengthFamiliar}),e.jsx(o,{value:"70",children:t.revision.strengthStrong}),e.jsx(o,{value:"100",children:t.revision.strengthMastered})]})]})]})}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"vocab-example",children:t.revision.labelExampleOptional}),e.jsx(Ee,{id:"vocab-example",name:"example",defaultValue:(r==null?void 0:r.example)||"",className:"resize-none",rows:q?5:2})]}),e.jsxs("div",{children:[e.jsxs(b,{htmlFor:"vocab-tags",children:[t.revision.labelTags," ",e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",t.revision.labelCommaSeparated,")"]})]}),e.jsx(U,{id:"vocab-tags",name:"tags",defaultValue:(r==null?void 0:r.tags.join(", "))||"",placeholder:t.revision.tagsPlaceholder})]}),(r==null?void 0:r.surfaceForms)&&r.surfaceForms.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(b,{className:"text-muted-foreground text-xs",children:t.revision.labelAttestedForms}
21),e.jsxs(xe,{delayDuration:0,children:[e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex touch-manipulation",onClick:a=>a.preventDefault(),children:e.jsx(Z,{className:"h-3 w-3 text-muted-foreground"})})}),e.jsx(ve,{side:"top",className:"max-w-[260px] text-xs leading-relaxed",children:t.revision.attestedFormsTooltip})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:r.surfaceForms.map(a=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-md bg-muted text-xs text-muted-foreground border",children:a},a))})]}),r&&(r.strengthPercent??0)>=80&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3 bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[ne?e.jsx(ia,{className:"h-4 w-4 text-amber-500"}):e.jsx(ma,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"vocab-decay-lock",className:"text-sm font-medium cursor-pointer",children:t.revision.keepMastered}),e.jsxs(xe,{delayDuration:0,children:[e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"ml-1 inline-flex touch-manipulation",onClick:a=>a.preventDefault(),children:e.jsx(Z,{className:"h-3.5 w-3.5 text-muted-foreground"})})}),e.jsx(ve,{side:"top",className:"max-w-[250px]",children:e.jsx("p",{className:"text-xs",children:t.revision.decayLockTooltipVocab})})]})]})]}),e.jsx(da,{id:"vocab-decay-lock",checked:ne,onCheckedChange:be,"data-testid":"switch-vocab-decay-lock"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(w,{type:"button",variant:"outline",onClick:()=>{W(!1),N(null)},children:t.revision.buttonCancel}),e.jsx(w,{type:"submit",disabled:He.isPending||Ue.isPending,children:r?t.revision.buttonUpdate:t.revision.buttonCreate})]})]})]})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 p-3 rounded-2xl bg-muted",style:{touchAction:"manipulation"},children:[e.jsx("div",{className:"flex-1",children:e.jsx(U,{placeholder:t.revision.searchVocabulary,value:c.search,onChange:a=>k({...c,search:a.target.value}),"data-testid":"input-vocab-search",className:"border-0 bg-card shadow-sm rounded-xl text-sm"})}),e.jsxs(A,{value:c.language||"all",onValueChange:a=>k({...c,language:a==="all"?"":a}),children:[e.jsx($,{"data-testid":"select-vocab-language",className:"border-0 bg-card shadow-sm rounded-xl w-full sm:w-[160px] text-sm",children:e.jsx(O,{placeholder:t.revision.labelLanguage})}),e.jsxs(B,{position:"popper",sideOffset:4,children:[e.jsx(o,{value:"all",children:t.revision.allLanguages}),e.jsx(o,{value:"mandarin",children:t.header.langMandarin}),e.jsx(o,{value:"spanish",children:t.header.langSpanish}),e.jsx(o,{value:"german",children:t.header.langGerman}),e.jsx(o,{value:"french",children:t.header.langFrench}),e.jsx(o,{value:"japanese",children:t.header.langJapanese}),e.jsx(o,{value:"english",children:t.header.langEnglish})]})]}),e.jsxs(A,{value:c.strength||"all",onValueChange:a=>k({...c,strength:a==="all"?"":a}),children:[e.jsx($,{"data-testid":"select-vocab-strength",className:"border-0 bg-card shadow-sm rounded-xl w-full sm:w-[160px] text-sm",children:e.jsx(O,{placeholder:t.revision.labelStrengthFilter})}),e.jsxs(B,{position:"popper",sideOffset:4,children:[e.jsx(o,{value:"all",children:t.revision.allStrengths}),e.jsxs(o,{value:"new",children:[t.revision.strengthNew," (0-19%)"]}),e.jsxs(o,{value:"learning",children:[t.revision.strengthLearning," (20-39%)"]}),e.jsxs(o,{value:"familiar",children:[t.revision.strengthFamiliar," (40-59%)"]}),e.jsxs(o,{value:"strong",children:[t.revision.strengthStrong," (60-79%)"]}),e.jsxs(o,{value:"mastered",children:[t.revision.strengthMastered," (80-100%)"]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:"outline",size:"sm",onClick:Pa,disabled:M.length===0,"data-testid":"button-vocab-export",className:"border-0 bg-card shadow-sm rounded-xl whitespace-nowrap",children:[e.jsx(la,{className:"h-3.5 w-3.5 mr-1.5"}),t.revision.exportLabel]}),e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>Y(!0),disabled:M.length===0,"data-testid":"button-vocab-cleanup",className:"border-0 bg-card shadow-sm rounded-xl whitespace-nowrap text-destructive hover:text-destructive",children:[e.jsx(De,{className:"h-3.5 w-3.5 mr-1.5"}),t.revision.cleanup]})]})]}),e.jsx(de,{open:$e,onOpenChange:Y,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(me,{children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-2",children:e.jsx(Fe,{className:"h-6 w-6 text-destructive"})}),e.jsx(he,{className:"text-center",children:t.revision.deleteVocabTitle}),e.jsx(oa,{className:"text-center",children:Le(c)?t.revision.deleteVocabFiltered(M.length,Ke(c)):t.revision.deleteVocabAll(M.length)})]}),e.jsx("div",{className:"rounded-xl border border-destructive/20 bg-destructive/5 p-4 my-2",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(Fe,{className:"h-5 w-5 text-destructive shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium text-destructive mb-1",children:t.revision.cannotBeUndone}),e.jsx("p",{className:"text-muted-foreground",children:t.revision.deleteVocabWarning})]})]})}),e.jsxs(ca,{className:"flex flex-col gap-2 sm:flex-col",children:[e.jsx(w,{variant:"destructive",onClick:()=>{const a={};c.language&&(a.language=c.language),c.strength&&(a.strength=c.strength),c.search&&(a.search=c.search),ke.mutate(a)},disabled:ke.isPending,"data-testid":"button-vocab-confirm-delete",className:"w-full",children:ke.isPending?t.revision.deletingLabel:Le(c)?t.revision.deleteFilteredItems(M.length):t.revision.deleteAllItems(M.length)}),e.jsx(w,{variant:"outline",onClick:()=>Y(!1),disabled:ke.isPending,"data-testid":"button-vocab-cancel-delete",className:"w-full",children:t.revision.buttonCancel})]})]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:La?e.jsx("p",{className:"text-muted-foreground col-span-full text-center",children:t.revision.loadingVocab}):M.length===0?e.jsxs("div",{className:"col-span-full flex flex-col items-center justify-center py-10 px-4 text-center","data-testid":"text-no-vocabulary",children:[e.jsx("div",{className:"inline-flex p-3 rounded-2xl bg-muted mb-4",children:e.jsx(ze,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:t.revision.vocabEmptyState})]}):M.map(a=>e.jsx("div",{"data-testid":`card-vocab-${a.id}`,className:"relative group rounded-2xl bg-card border border-border overflow-hidden transition-all duration-200 hover:shadow-md hover:shadow-black/5",children:e.jsxs("div",{className:"p-4 sm:p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h3",{lang:le(a.language),className:"text-lg sm:text-xl font-semibold text-foreground dark:text-white leading-tight break-words","data-testid":"text-vocab-word",children:[(()=>{const n=Mt(a.gender,a.language,a.word);if(n){const h=n==="l'";return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-primary font-medium",children:n}),!h&&e.jsx("span",{className:"mx-1",children:" "})]})}return null})(),g(a.word,a.language)]}),a.partOfSpeech&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs bg-muted/60 text-muted-foreground
21/70 font-normal mt-0.5","data-testid":"text-vocab-pos-card",children:[qa(a.partOfSpeech,(s==null?void 0:s.nativeLanguage)??"english"),Re(a.language)&&a.gender&&a.gender!=="-"&&(()=>{const n=a.language.toLowerCase(),h=(n==="french"||n==="fr")&&Rt(a.word),v=h?At(a.gender):null;return e.jsxs("span",{className:"opacity-70",children:["(",a.gender,")",h&&v&&e.jsxs("span",{className:"ml-1",children:["· ",v]})]})})()]}),a.baseForm&&!ta(a.baseForm,a.word)&&e.jsxs("span",{lang:le(a.language),className:"inline-flex items-center px-1.5 py-0.5 rounded text-xs bg-emerald-50 dark:bg-emerald-950/30 text-emerald-700 dark:text-emerald-400 font-normal mt-0.5 ml-1","data-testid":`text-vocab-base-form-card-${a.id}`,children:["â ",a.baseForm]}),a.language==="japanese"?(()=>{const n=Ga({word:a.word,pronunciation:a.pronunciation,romaji:a.romaji,translation:a.translation});return n.displayReading?e.jsxs("p",{className:"text-sm text-muted-foreground mt-1","data-testid":"text-vocab-pronunciation",children:[n.hiragana&&e.jsx("span",{children:n.hiragana}),n.hiragana&&n.romaji&&e.jsx("span",{className:"mx-1.5",children:"·"}),n.romaji&&e.jsx("span",{className:"italic",children:n.romaji})]}):null})():a.pronunciation?e.jsx("p",{className:"text-sm text-muted-foreground mt-1","data-testid":"text-vocab-pronunciation",children:sa(a.pronunciation)}):null]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(Ha,{word:a.language==="japanese"&&a.pronunciation?a.pronunciation:a.word,language:a.language,"data-testid":`button-pronunciation-vocab-${a.id}`}),(a.language==="mandarin"||a.language==="japanese")&&e.jsx(Ua,{characters:a.word,word:a.word,translation:ra(a.translation),pronunciation:a.pronunciation?sa(a.pronunciation):void 0,language:a.language,className:"h-7 w-7"}),e.jsx(w,{size:"icon",variant:"ghost",onClick:()=>{H.current=window.scrollY,N(a),be(a.decayLocked??!1),W(!0)},"data-testid":"button-edit-vocab",children:e.jsx(ha,{className:"h-3.5 w-3.5"})}),e.jsx(w,{size:"icon",variant:"ghost",onClick:()=>Fa.mutate(a.id),"data-testid":"button-delete-vocab",children:e.jsx(De,{className:"h-3.5 w-3.5"})})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[a.translationLanguage&&e.jsx(Ce,{language:a.translationLanguage,size:"xs",className:"flex-shrink-0"}),e.jsx("div",{className:"text-[13px] sm:text-sm text-[#6a6a6a] dark:text-[#a0a0a0]",children:e.jsx(Dt,{text:ra(a.translation),maxLines:2})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(X,{variant:"secondary",className:"text-xs","data-testid":"badge-vocab-language",children:Ze(a.language,t)}),e.jsx(X,{variant:"secondary",className:"text-xs","data-testid":"badge-vocab-level",children:ea(a.level,t)}),a.tags.map(n=>e.jsx(X,{variant:"outline",className:"text-xs",children:n},n))]}),e.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-border border-border",children:[e.jsx(ja,{strength:a.strengthPercent||0,onSelect:n=>Je.mutate({id:a.id,strengthPercent:n}),disabled:Je.isPending}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:[a.strengthPercent||0,"%"]}),e.jsx("span",{className:`text-xs font-semibold uppercase tracking-wide ${Sa(a.strengthPercent||0)}`,children:(a.strengthPercent||0)<20?t.revision.strengthNew:(a.strengthPercent||0)<40?t.revision.strengthLearning:(a.strengthPercent||0)<60?t.revision.strengthFamiliar:(a.strengthPercent||0)<80?t.revision.strengthStrong:t.revision.strengthMastered})]})]})]})},a.id))})]}),e.jsxs(Pe,{value:"grammar",className:"space-y-4",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(de,{open:pe,onOpenChange:a=>{G(a),a||(_(null),requestAnimationFrame(()=>{window.scrollTo(0,H.current)}))},children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(w,{"data-testid":"button-add-grammar",children:[e.jsx(ua,{className:"h-4 w-4 mr-2"}),t.revision.addGrammarPattern]})}),e.jsxs(ue,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",onCloseAutoFocus:a=>{a.preventDefault(),window.scrollTo(0,H.current)},children:[e.jsx(me,{children:e.jsx(he,{children:u?t.revision.editGrammarTitle:t.revision.addGrammarTitle})}),e.jsxs("form",{onSubmit:Ma,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(b,{htmlFor:"grammar-language",children:t.revision.labelLanguage}),e.jsxs(A,{name:"language",defaultValue:(u==null?void 0:u.language)||"mandarin",required:!0,children:[e.jsx($,{id:"grammar-language",children:e.jsx(O,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"mandarin",children:t.header.langMandarin}),e.jsx(o,{value:"spanish",children:t.header.langSpanish}),e.jsx(o,{value:"german",children:t.header.langGerman}),e.jsx(o,{value:"french",children:t.header.langFrench}),e.jsx(o,{value:"japanese",children:t.header.langJapanese}),e.jsx(o,{value:"english",children:t.header.langEnglish})]})]})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"grammar-level",children:t.revision.labelArticleLevel}),e.jsxs(A,{name:"level",defaultValue:(u==null?void 0:u.level)||"beginner",required:!0,children:[e.jsx($,{id:"grammar-level",children:e.jsx(O,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"beginner",children:t.header.levelBeginner}),e.jsx(o,{value:"lower-intermediate",children:t.header.levelLowerIntermediate}),e.jsx(o,{value:"intermediate",children:t.header.levelIntermediate}),e.jsx(o,{value:"upper-intermediate",children:t.header.levelUpperIntermediate}),e.jsx(o,{value:"advanced",children:t.header.levelAdvanced})]})]})]})]}),e.jsxs("div",{children:[e.jsxs(b,{htmlFor:"grammar-title",children:[t.revision.labelPatternTitle," *"]}),e.jsx(U,{id:"grammar-title",name:"title",lang:le(u==null?void 0:u.language),defaultValue:u==null?void 0:u.title,required:!0})]}),e.jsxs("div",{children:[e.jsxs(b,{htmlFor:"grammar-definition",children:[t.revision.labelDefinition," *"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ee,{id:"grammar-definition",name:"definition",defaultValue:u==null?void 0:u.definition,required:!0,className:u!=null&&u.translationLanguage?"pr-8":""}),(u==null?void 0:u.translationLanguage)&&e.jsx("div",{className:"absolute right-2.5 top-2.5 pointer-events-none",children:e.jsx(Ce,{language:u.translationLanguage,size:"xs"})})]})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"grammar-example",children:t.revision.labelExampleOptional}),e.jsx(Ee,{id:"grammar-example",name:"example",defaultValue:(u==null?void 0:u.example)||""})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"grammar-notes",children:t.revision.labelPersonalNotesOptional}),e.jsx(Ee,{id:"grammar-notes",name:"notes",defaultValue:(u==null?void 0:u.notes)||""})]}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"grammar-strength",children:t.revision.labelStrengthLevel}),e.jsxs(A,{name:"strengthLevel",defaultValue:fa((u==null?void 0:u.strengthPercent)??0),required:!0,children:[e.jsx($,{id:"grammar-strength",children:e.jsx(O,{})}),e.jsxs(B,{children:[e.jsxs(o,{value:"10",children:[t.revision.strengthNew," (0-19%)"]}),e.jsxs(o,{value:"30",children:[t.revision.strengthLearning," (20-39%)"]}),e.jsxs(o,{value:"50",children:[t.revision.strengthFamiliar," (40-59%)"]}),e.jsxs(o,{value:"70",children:[t.revision.strengthStrong," (60-79%)"]}),e.jsxs(o,{value:"100",children:[t.revision.strengthMastered," (80-100%)"]})]})]})]}),u&&(u.strengthPercent??0)>=80&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3 bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[ie?e.jsx(ia,{className:"h-4 w-4 text-amber-500"}):e.jsx(ma,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx(b,{htmlFor:"grammar-decay-lock",className:"text-sm font-medium cursor-pointer",children:t.revision.keepMastered}
21),e.jsxs(xe,{delayDuration:0,children:[e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"ml-1 inline-flex touch-manipulation",onClick:a=>a.preventDefault(),children:e.jsx(Z,{className:"h-3.5 w-3.5 text-muted-foreground"})})}),e.jsx(ve,{side:"top",className:"max-w-[250px]",children:e.jsx("p",{className:"text-xs",children:t.revision.decayLockTooltipGrammar})})]})]})]}),e.jsx(da,{id:"grammar-decay-lock",checked:ie,onCheckedChange:we,"data-testid":"switch-grammar-decay-lock"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(w,{type:"button",variant:"outline",onClick:()=>{G(!1),_(null)},children:t.revision.buttonCancel}),e.jsx(w,{type:"submit",disabled:We.isPending||_e.isPending,children:u?t.revision.buttonUpdate:t.revision.buttonCreate})]})]})]})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 p-3 rounded-2xl bg-muted",style:{touchAction:"manipulation"},children:[e.jsx("div",{className:"flex-1",children:e.jsx(U,{placeholder:t.revision.searchGrammar,value:x.search,onChange:a=>I({...x,search:a.target.value}),"data-testid":"input-grammar-search",className:"border-0 bg-card shadow-sm rounded-xl text-sm"})}),e.jsxs(A,{value:x.language||"all",onValueChange:a=>I({...x,language:a==="all"?"":a}),children:[e.jsx($,{"data-testid":"select-grammar-language",className:"border-0 bg-card shadow-sm rounded-xl w-full sm:w-[160px] text-sm",children:e.jsx(O,{placeholder:t.revision.labelLanguage})}),e.jsxs(B,{position:"popper",sideOffset:4,children:[e.jsx(o,{value:"all",children:t.revision.allLanguages}),e.jsx(o,{value:"mandarin",children:t.header.langMandarin}),e.jsx(o,{value:"spanish",children:t.header.langSpanish}),e.jsx(o,{value:"german",children:t.header.langGerman}),e.jsx(o,{value:"french",children:t.header.langFrench}),e.jsx(o,{value:"japanese",children:t.header.langJapanese}),e.jsx(o,{value:"english",children:t.header.langEnglish})]})]}),e.jsxs(A,{value:x.strength||"all",onValueChange:a=>I({...x,strength:a==="all"?"":a}),children:[e.jsx($,{"data-testid":"select-grammar-strength",className:"border-0 bg-card shadow-sm rounded-xl w-full sm:w-[160px] text-sm",children:e.jsx(O,{placeholder:t.revision.labelStrengthFilter})}),e.jsxs(B,{position:"popper",sideOffset:4,children:[e.jsx(o,{value:"all",children:t.revision.allStrengths}),e.jsxs(o,{value:"new",children:[t.revision.strengthNew," (0-19%)"]}),e.jsxs(o,{value:"learning",children:[t.revision.strengthLearning," (20-39%)"]}),e.jsxs(o,{value:"familiar",children:[t.revision.strengthFamiliar," (40-59%)"]}),e.jsxs(o,{value:"strong",children:[t.revision.strengthStrong," (60-79%)"]}),e.jsxs(o,{value:"mastered",children:[t.revision.strengthMastered," (80-100%)"]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:"outline",size:"sm",onClick:Ea,disabled:R.length===0,"data-testid":"button-grammar-export",className:"border-0 bg-card shadow-sm rounded-xl whitespace-nowrap",children:[e.jsx(la,{className:"h-3.5 w-3.5 mr-1.5"}),t.revision.exportLabel]}),e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>T(!0),disabled:R.length===0,"data-testid":"button-grammar-cleanup",className:"border-0 bg-card shadow-sm rounded-xl whitespace-nowrap text-destructive hover:text-destructive",children:[e.jsx(De,{className:"h-3.5 w-3.5 mr-1.5"}),t.revision.cleanup]})]})]}),e.jsx(de,{open:Oe,onOpenChange:T,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(me,{children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-2",children:e.jsx(Fe,{className:"h-6 w-6 text-destructive"})}),e.jsx(he,{className:"text-center",children:t.revision.deleteGrammarTitle}),e.jsx(oa,{className:"text-center",children:Le(x)?t.revision.deleteGrammarFiltered(R.length,Ke(x)):t.revision.deleteGrammarAll(R.length)})]}),e.jsx("div",{className:"rounded-xl border border-destructive/20 bg-destructive/5 p-4 my-2",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(Fe,{className:"h-5 w-5 text-destructive shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium text-destructive mb-1",children:t.revision.cannotBeUndone}),e.jsx("p",{className:"text-muted-foreground",children:t.revision.deleteGrammarWarning})]})]})}),e.jsxs(ca,{className:"flex flex-col gap-2 sm:flex-col",children:[e.jsx(w,{variant:"destructive",onClick:()=>{const a={};x.language&&(a.language=x.language),x.strength&&(a.strength=x.strength),x.search&&(a.search=x.search),Se.mutate(a)},disabled:Se.isPending,"data-testid":"button-grammar-confirm-delete",className:"w-full",children:Se.isPending?t.revision.deletingLabel:Le(x)?t.revision.deleteFilteredItems(R.length):t.revision.deleteAllItems(R.length)}),e.jsx(w,{variant:"outline",onClick:()=>T(!1),disabled:Se.isPending,"data-testid":"button-grammar-cancel-delete",className:"w-full",children:t.revision.buttonCancel})]})]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:Ca?e.jsx("p",{className:"text-muted-foreground col-span-full text-center",children:t.revision.loadingGrammar}):R.length===0?e.jsxs("div",{className:"col-span-full flex flex-col items-center justify-center py-10 px-4 text-center","data-testid":"text-no-grammar",children:[e.jsx("div",{className:"inline-flex p-3 rounded-2xl bg-muted mb-4",children:e.jsx(Ve,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:t.revision.grammarEmptyState})]}):R.map(a=>e.jsx("div",{"data-testid":`card-grammar-${a.id}`,className:"relative group rounded-2xl bg-card border border-border overflow-hidden transition-all duration-200 hover:shadow-md hover:shadow-black/5",children:e.jsxs("div",{className:"p-4 sm:p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("h3",{lang:le(a.language),className:"text-base sm:text-lg font-semibold text-foreground dark:text-white min-w-0 flex-1 leading-snug","data-testid":"text-grammar-title",children:g(a.title,a.language)}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx(w,{size:"icon",variant:"ghost",className:"sm:opacity-0 sm:group-hover:opacity-60 sm:group-focus-within:opacity-60 sm:focus-visible:!opacity-100 sm:hover:!opacity-100 transition-opacity",onClick:()=>{H.current=window.scrollY,_(a),we(a.decayLocked??!1),G(!0)},"data-testid":"button-edit-grammar",children:e.jsx(ha,{className:"h-3.5 w-3.5"})}),e.jsx(w,{size:"icon",variant:"ghost",className:"sm:opacity-0 sm:group-hover:opacity-60 sm:group-focus-within:opacity-60 sm:focus-visible:!opacity-100 sm:hover:!opacity-100 transition-opacity",onClick:()=>Ta.mutate(a.id),"data-testid":"button-delete-grammar",children:e.jsx(De,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"shrink-0",children:e.jsx(Tt,{strength:a.strengthPercent||0})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[a.translationLanguage&&e.jsx(Ce,{language:a.translationLanguage,size:"xs",className:"flex-shrink-0"}),e.jsx("p",{className:"text-[13px] sm:text-sm text-[#6a6a6a] dark:text-[#a0a0a0] leading-relaxed","data-testid":"text-grammar-definition",children:a.definition})]}),a.example&&e.jsxs("p",{className:"text-xs sm:text-[13px] text-muted-foreground italic leading-relaxed","data-testid":"text-grammar-example",children:['"',g(a.example,a.language),'"']}
21),a.notes&&e.jsxs("div",{className:"bg-[#f9f9fb] dark:bg-muted/50 p-3 rounded-xl",children:[e.jsx("p",{className:"text-xs font-medium text-[#6a6a6a] dark:text-[#a0a0a0] mb-1",children:t.revision.notesLabel}),e.jsx("p",{className:"text-[13px] text-foreground/70 dark:text-muted-foreground/50 leading-relaxed","data-testid":"text-grammar-notes",children:a.notes})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-3 border-t border-border border-border",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(X,{variant:"secondary",className:"text-xs","data-testid":"badge-grammar-language",children:Ze(a.language,t)}),e.jsx(X,{variant:"secondary",className:"text-xs","data-testid":"badge-grammar-level",children:ea(a.level,t)})]}),e.jsx(ja,{strength:a.strengthPercent||0,onSelect:n=>Qe.mutate({id:a.id,strengthPercent:n}),disabled:Qe.isPending})]})]})},a.id))})]})]})})})})}):e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsxs(tt,{className:"p-6",children:[e.jsx(st,{children:t.revision.authRequiredTitle}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:t.revision.authRequiredDesc})]})})}const Jt=Object.freeze(Object.defineProperty({__proto__:null,default:$t},Symbol.toStringTag,{value:"Module"}));export{kt as D,Nt as P,Jt as 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.