PageSourceSearch

https://www.kingchess.io/assets/career-report-Bu1XjvRb.js

js kingchess.io collected 2026-10-08 11:33:02 UTC 29,022 bytes, 32 lines download raw bytes

1import{r as C,j as e,B as m,h as v,F,T as r,aq as le,b as ce,d as de,O as me,aM as he,a as ue,V as B,H as E,A as ee,g as W,aR as T,L as xe,S as fe}from"./index-B5_v9qME.js";import{R as _}from"./Reveal-zXuPyitN.js";import{k as pe,Y as ge}from"./index-BYNKCrL8.js";import{u as be}from"./usePuzzleGeneration-IAo_QVOO.js";import{a as je}from"./packs-CedROZ0j.js";import{P as ke}from"./PremiumUpgradeModal-DWUAzIRi.js";import{b as ye}from"./billing-api-oCwfIcGA.js";import{C as G}from"./container-B8o_vqjm.js";import"./puzzle-generation-api-Cv_R0fv5.js";import"./dialog-9E3HaqSl.js";import"./render-strategy-DKlMToVI.js";import"./create-split-props-u5h9OPvL.js";import"./pricing-DzBFbOCI.js";import"./image-ByjVXa23.js";const a={ink:"var(--kc-inf-ink)",sub:"var(--kc-inf-sub)",muted:"var(--kc-inf-muted)",rule:"var(--kc-inf-rule)",surface:"var(--kc-inf-surface)",win:"var(--kc-inf-win)",draw:"var(--kc-inf-draw)",loss:"var(--kc-inf-loss)",line:"var(--kc-inf-line)",mono:'ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", monospace'},we={timeout:"On the clock",resigned:"Resigned",checkmated:"Checkmated",abandoned:"Abandoned"};function I({children:n}){return e.jsx(r,{fontSize:"xs",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"0.09em",color:a.muted,mb:3,children:n})}function ne({wins:n,draws:o,losses:i,height:d="10px"}){if(n+o+i===0)return null;const u=(g,l,f,s)=>g>0?e.jsx(m,{h:d,bg:l,flexGrow:g,flexBasis:0,borderLeftRadius:f?"4px":0,borderRightRadius:s?"4px":0}):null;return e.jsxs(F,{w:"100%",gap:"2px",align:"center",children:[u(n,a.win,!0,o===0&&i===0),u(o,a.draw,n===0,i===0),u(i,a.loss,n===0&&o===0,!0)]})}function U(n){return new Date(n*1e3).toLocaleDateString(void 0,{month:"short",year:"2-digit"})}function Se({points:n}){const o=C.useRef(null),[i,d]=C.useState(null),h=720,u=220,g={l:44,r:16,t:12,b:22},l=C.useMemo(()=>{if(n.length<2)return null;const p=n.map(k=>k[0]),y=n.map(k=>k[1]),x=Math.min(...p),S=Math.max(...p),w=Math.min(...y),b=Math.max(...y),j=Math.floor((w-20)/100)*100,M=Math.ceil((b+20)/100)*100,R=k=>g.l+(k-x)/Math.max(1,S-x)*(h-g.l-g.r),L=k=>g.t+(1-(k-j)/Math.max(1,M-j))*(u-g.t-g.b),$=n.map((k,D)=>`${D===0?"M":"L"}${R(k[0]).toFixed(1)},${L(k[1]).toFixed(1)}`).join(" "),O=M-j>600?200:100,P=[];for(let k=j;k<=M;k+=O)P.push(k);return{x:R,y:L,path:$,lo:j,hi:M,grid:P,t0:x,t1:S}},[n]);if(!l)return null;const f=i!=null?n[i]:null,s=p=>{const y=o.current;if(!y)return;const x=y.getBoundingClientRect(),S=(p.clientX-x.left)/x.width*h;let w=0,b=1/0;for(let j=0;j<n.length;j++){const M=Math.abs(l.x(n[j][0])-S);M<b&&(b=M,w=j)}d(w)};return e.jsxs(m,{ref:o,position:"relative",onMouseMove:s,onMouseLeave:()=>d(null),children:[e.jsxs("svg",{viewBox:`0 0 ${h} ${u}`,style:{width:"100%",height:"auto",display:"block"},children:[l.grid.map(p=>e.jsxs("g",{children:[e.jsx("line",{x1:g.l,x2:h-g.r,y1:l.y(p),y2:l.y(p),stroke:a.rule,strokeWidth:"1"}),e.jsx("text",{x:g.l-8,y:l.y(p)+3,textAnchor:"end",fontSize:"10",fill:a.muted,fontFamily:a.mono,children:p})]},p)),e.jsx("path",{d:l.path,fill:"none",stroke:a.line,strokeWidth:"2",strokeLinejoin:"round"}),[0,n.length-1].map(p=>e.jsx("circle",{cx:l.x(n[p][0]),cy:l.y(n[p][1]),r:"3",fill:a.line},p)),e.jsx("text",{x:g.l,y:u-4,fontSize:"10",fill:a.muted,fontFamily:a.mono,children:U(l.t0)}),e.jsx("text",{x:h-g.r,y:u-4,textAnchor:"end",fontSize:"10",fill:a.muted,fontFamily:a.mono,children:U(l.t1)}),f&&e.jsxs("g",{children:[e.jsx("line",{x1:l.x(f[0]),x2:l.x(f[0]),y1:g.t,y2:u-g.b,stroke:a.muted,strokeWidth:"1",strokeDasharray:"3,3"}),e.jsx("circle",{cx:l.x(f[0]),cy:l.y(f[1]),r:"4",fill:a.line,stroke:a.surface,strokeWidth:"2"})]})]}),f&&e.jsx(m,{position:"absolute",top:"2px",left:`${l.x(f[0])/h*100}%`,transform:l.x(f[0])>h*.7?"translateX(-105%)":"translateX(8px)",bg:a.surface,border:`1px solid ${a.rule}`,borderRadius:"md",px:2,py:1,pointerEvents:"none",children:e.jsxs(r,{fontSize:"xs",fontFamily:a.mono,color:a.ink,children:[f[1]," · ",U(f[0])]})})]})}function ze({counts:n,total:o}){const i=Object.entries(n).slice(0,5),d=Math.max(...i.map(([,h])=>h),1);return e.jsx(F,{direction:"column",gap:2,children:i.map(([h,u])=>e.jsxs(F,{align:"center",gap:3,children:[e.jsx(r,{w:"120px",flexShrink:0,fontSize:"sm",color:a.ink,
1children:we[h]??h}),e.jsx(m,{flex:"1",children:e.jsx(m,{h:"10px",w:`${u/d*100}%`,minW:"4px",bg:a.loss,borderRightRadius:"4px"})}),e.jsxs(r,{w:"90px",flexShrink:0,textAlign:"right",fontSize:"sm",fontFamily:a.mono,color:a.sub,children:[u," · ",Math.round(u/Math.max(1,o)*100),"%"]})]},h))})}const te={much_weaker:{name:"Much weaker",range:"−200 or more"},weaker:{name:"Weaker",range:"−199 to −50"},even:{name:"Evenly matched",range:"within 49"},stronger:{name:"Stronger",range:"+50 to +199"},much_stronger:{name:"Much stronger",range:"+200 or more"}},re=["bullet","blitz","rapid","daily"];function _e({stats:n}){var f;const o=Object.keys(n.classes).sort((s,p)=>n.classes[p].totals.games-n.classes[s].totals.games||re.indexOf(s)-re.indexOf(p)),[i,d]=C.useState(o[0]??"all"),h=i==="all"?n.all:n.classes[i]??n.all,u=h.totals;if(!n.all.totals.games)return null;const g=s=>`${(s/Math.max(1,u.games)*100).toFixed(1)}%`,l=(h.opp_strength_bands??[]).filter(s=>te[s.band]&&s.wins+s.draws+s.losses>=5);return e.jsxs(m,{mt:12,children:[e.jsxs(_,{children:[e.jsx(I,{children:"The career, in numbers"}),e.jsx(v,{gap:2,mb:5,flexWrap:"wrap",children:[...o,"all"].map(s=>e.jsx(m,{as:"button",onClick:()=>d(s),px:3,py:1,borderRadius:"full",border:`1px solid ${i===s?a.ink:a.rule}`,bg:i===s?a.ink:"transparent",color:i===s?a.surface:a.muted,fontSize:"xs",fontFamily:a.mono,cursor:"pointer",textTransform:"capitalize",children:s==="all"?`all speeds · ${n.all.totals.games.toLocaleString()}`:`${s} · ${n.classes[s].totals.games.toLocaleString()}`},s))}),e.jsxs(F,{gap:8,wrap:"wrap",align:"baseline",mb:3,children:[e.jsxs(r,{fontSize:"3xl",fontWeight:"bold",fontFamily:a.mono,color:a.ink,children:[u.games.toLocaleString(),e.jsxs(r,{as:"span",fontSize:"sm",fontFamily:"body",color:a.sub,fontWeight:"medium",children:[" ","games"]})]}),[["wins",a.win],["draws",a.draw],["losses",a.loss]].map(([s,p])=>e.jsxs(v,{gap:2,align:"baseline",children:[e.jsx(m,{w:"10px",h:"10px",borderRadius:"2px",bg:p,alignSelf:"center"}),e.jsx(r,{fontSize:"lg",fontWeight:"bold",fontFamily:a.mono,color:a.ink,children:u[s].toLocaleString()}),e.jsxs(r,{fontSize:"sm",color:a.sub,children:[s," · ",g(u[s])]})]},s))]}),e.jsx(ne,{wins:u.wins,draws:u.draws,losses:u.losses})]}),(((f=h.elo_timeline)==null?void 0:f.length)??0)>=2&&e.jsx(_,{children:e.jsxs(m,{mt:10,children:[e.jsxs(I,{children:["Rating over the whole run · ",i]}),e.jsx(Se,{points:h.elo_timeline})]})}),Object.keys(h.loss_terminations).length>0&&e.jsx(_,{children:e.jsxs(m,{mt:10,children:[e.jsx(I,{children:"How the losses end"}),e.jsx(ze,{counts:h.loss_terminations,total:u.losses})]})}),h.openings.length>0&&e.jsx(_,{children:e.jsxs(m,{mt:10,children:[e.jsx(I,{children:"Your openings"}),e.jsx(F,{direction:"column",children:h.openings.slice(0,12).map(s=>e.jsxs(F,{align:"center",gap:3,py:2,borderBottom:`1px solid ${a.rule}`,children:[e.jsx(r,{flex:"1",minW:0,fontSize:"sm",color:a.ink,lineClamp:1,children:s.name}),e.jsx(r,{w:"70px",flexShrink:0,textAlign:"right",fontSize:"xs",fontFamily:a.mono,color:a.sub,children:s.games}),e.jsx(m,{w:{base:"90px",md:"180px"},flexShrink:0,children:e.jsx(ne,{wins:s.wins,draws:s.draws,losses:s.losses,height:"8px"})}),e.jsxs(r,{w:"52px",flexShrink:0,textAlign:"right",fontSize:"xs",fontFamily:a.mono,color:a.sub,children:[Math.round(s.wins/Math.max(1,s.games)*100),"% W"]})]},s.name))})]})}),l.length>=3&&e.jsx(_,{children:e.jsxs(m,{mt:10,children:[e.jsx(I,{children:"Against stronger and weaker"}),e.jsx(F,{align:"flex-end",gap:{base:"10px",md:"18px"},wrap:"wrap",children:l.map(s=>{const p=s.wins+s.draws+s.losses,y=te[s.band];return e.jsxs(F,{direction:"column",align:"stretch",flex:"1",minW:"96px",gap:1,title:`${y.name}: ${s.wins}W ${s.draws}D ${s.losses}L`,children:[e.jsx(r,{fontSize:"sm",fontWeight:"medium",color:a.sub,textAlign:"center",children:y.name}),e.jsx(r,{fontSize:"xs",fontFamily:a.mono,color:a.muted,textAlign:"center",mb:1,children:y.range}),e.jsxs(F,{direction:"column",h:"90px",justify:"flex-end",gap:"2px",children:[e.jsx(m,{bg:a.win,flexGrow:s.wins,flexBasis:0,borderTopRadius:"3px",minH:s.wins?"2px":0}),e.jsx(m,{bg:a.draw,flexGrow:s.draws,flexBasis:0,minH:s.draws?"2px":0}),e.jsx(m,{bg:a.loss,flexGrow:s.losses,flexBasis:0,minH:s.losses?"2px":0})]}),e.jsxs(r,{fontSize:"sm",fontWeight:"semibold",color:a.ink,textAlign:"center",mt:1,children:[Math.round(s.wins/Math.max(1,p)*100),"% wins"]}),e.jsxs(r,{fontSize:"xs",fontFamily:a.mono,color:a.sub,textAlign:"center",children:[p.toLocaleStr
1ing()," games"]})]},s.band)})}),e.jsx(r,{fontSize:"sm",color:a.sub,mt:3,children:"Opponent rating compared with yours at the time of each game."})]})})]})}async function K(n,o={}){const i=localStorage.getItem("access_token");return fetch(`${me.BASE}${n}`,{...o,credentials:"include",headers:{"Content-Type":"application/json",...i?{Authorization:`Bearer ${i}`}:{},...o.headers??{}}})}async function q(n){try{const o=await n.json(),i=(o==null?void 0:o.detail)??(o==null?void 0:o.message)??o;return typeof i=="string"?i:JSON.stringify(i)}catch{return`HTTP ${n.status}`}}async function Fe(n,o){const i=await K("/api/v1/career-report/generate",{method:"POST",body:JSON.stringify({external_account_id:n,time_class:o??null})});if(!i.ok){const d=await q(i),h=new Error(d);throw h.status=i.status,h}return i.json()}async function ve(n){const o=await K(`/api/v1/career-report/${n}`);if(!o.ok)throw new Error(`Fetch failed: ${await q(o)}`);return o.json()}async function Ce(n){const o=await K(`/api/v1/career-report/${n}/cancel`,{method:"POST"});if(!o.ok)throw new Error(`Cancel failed: ${await q(o)}`);return o.json()}const Q={all:["career-report"],job:n=>[...Q.all,n]};function Me(n){const o=ce();return de({mutationFn:({externalAccountId:i,timeClass:d})=>Fe(i,d),...n,onSuccess:(i,d,h,u)=>{var g;o.setQueryData(Q.job(i.id),i),(g=n==null?void 0:n.onSuccess)==null||g.call(n,i,d,h,u)}})}function Re(n,o){return le({queryKey:Q.job(n??"none"),queryFn:()=>ve(n),enabled:!!n&&!0,refetchInterval:i=>{const d=i.state.data;return!d||d.status==="pending"||d.status==="running"?4e3:!1}})}const J="careerReportJobId",We={opening:"Opening",middlegame:"Middlegame",endgame:"Endgame"},Ae={endgame:{theme:"endgame",cta:"Drill 30 endgame puzzles"},middlegame:{theme:"fork",cta:"Drill 30 fork puzzles"},opening:null};function en(){he("career-report");const n=ue(),{data:o}=be(),i=(o==null?void 0:o.filter(b=>b.status==="connected"))??[],[d,h]=C.useState(()=>localStorage.getItem(J)),[u,g]=C.useState(!1),{data:l}=Re(d),f=Me({onSuccess:b=>{h(b.id),localStorage.setItem(J,b.id)},onError:b=>{b.status===402?g(!0):T.create({title:"Could not start report",description:b.message,type:"error"})}}),s=async b=>{try{await ye.upgradeToPremium(b)}catch{T.create({title:"Upgrade failed",description:"Could not start the upgrade flow. Please try again.",type:"error"})}},p=()=>{h(null),localStorage.removeItem(J)},[y,x]=C.useState(!1),S=async()=>{if(d){x(!0);try{await Ce(d),p()}catch(b){T.create({title:"Could not cancel",description:b.message,type:"error"})}finally{x(!1)}}};let w;return i.length===0?w=e.jsx(G,{maxW:"3xl",py:16,children:e.jsx(F,{justify:"center",children:e.jsxs(B,{gap:5,textAlign:"center",w:"full",maxW:"440px",bg:"bg.panel",border:"1px solid",borderColor:"border",borderRadius:"2xl",px:8,py:10,boxShadow:"sm",children:[e.jsx(F,{align:"center",justify:"center",w:"56px",h:"56px",borderRadius:"full",bg:"purple.50",color:"purple.600",children:e.jsx(ge,{size:24})}),e.jsxs(B,{gap:1.5,children:[e.jsx(E,{size:"md",color:"fg",children:"Career Report"}),e.jsx(r,{color:"fg.muted",fontSize:"sm",lineHeight:"relaxed",children:"Link your Chess.com or Lichess account and we'll turn your game history into a report: what's improved, what's regressed, and the patterns still costing you points."})]}),e.jsx(W,{bg:"#5457E0",color:"white",_hover:{bg:"#6B6EF0"},size:"lg",px:8,onClick:()=>n({to:"/puzzle-generation"}),children:"Link an account"})]})})}):!l||!d?w=e.jsx(se,{accounts:i,isGenerating:f.isPending,onGenerate:(b,j)=>f.mutate({externalAccountId:b,timeClass:j})}):l.status==="pending"||l.status==="running"?w=e.jsx(Ee,{job:l,onCancel:S,isCancelling:y}):l.status==="failed"?w=e.jsx($e,{job:l,onRetry:p}):l.status==="completed"&&l.result?w=e.jsx(Le,{result:l.result,onStartNew:p,platformLabel:V[l.platform]??l.platform,timeClass:l.time_class,username:l.username}):w=e.jsx(se,{accounts:i,isGenerating:f.isPending,onGenerate:(b,j)=>f.mutate({externalAccountId:b,timeClass:j})}),e.jsxs(e.Fragment,{children:[w,e.jsx(ke,{open:u,onClose:()=>g(!1),onUpgrade:s,headerSubtitle:"Unlock the Career Report and the rest of Premium",bodyHeadline:"Career Report is a Premium feature",bodyDescription:e.jsx(r,{children:"Compare your most recent 52 weeks against an earlier 52-week window where you played enough games to compare against. See where you've improved, what's still costing you points, and drill the patterns that haven't broken open yet."})})]})}const V={chess_com:"Chess.com",lichess:"Lichess"},Te=["bullet","blitz","rapid","classical"];function se({accounts:n,isGenerating:o,onGenerate:i}){var y;const[d,h]=C.useState(((y=n[0])==null?void 0:y.id)??""),[u,g]=C.useState("rapid");C.useEffect(()=>{!d&&n[0]&&h(n[0].id)},[n,d]);const l=n.find(x=>x.id===d),f=(l==null?void 0:l.platform)==="lichess",s=V[(l==null?void 0:l.platform)??""]??"your platform",p=Te.filter(x=>x!=="classical"||f);return C.useEffect(()=>
1{!f&&u==="classical"&&g("rapid")},[f,u]),e.jsx(G,{maxW:"3xl",py:{base:12,md:20},children:e.jsxs(B,{gap:6,textAlign:"center",children:[e.jsx(E,{size:{base:"xl",md:"2xl"},lineHeight:"shorter",children:"Your chess career, analyzed."}),e.jsx(r,{fontSize:{base:"md",md:"lg"},color:"fg.muted",maxW:"2xl",children:"We compare your last year of play against an earlier year you played enough to match, one time control at a time so the numbers compare like with like. Stockfish reviews every position. You get a clear picture of what's improved, what's worse, and what's still costing you points."}),e.jsxs(m,{bg:"bg.panel",borderRadius:"2xl",boxShadow:"lg",p:{base:6,md:8},mt:4,w:"full",maxW:"lg",children:[n.length>1&&e.jsxs(m,{mb:4,textAlign:"left",children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",mb:2,color:"fg",children:"Which account?"}),e.jsx(ee,{direction:"row",gap:2,flexWrap:"wrap",children:n.map(x=>e.jsxs(W,{size:"sm",variant:d===x.id?"solid":"outline",bg:d===x.id?"#5457E0":"transparent",color:d===x.id?"white":"fg.muted",onClick:()=>h(x.id),children:[x.platform_username,e.jsxs(r,{as:"span",fontSize:"xs",opacity:.7,ml:1,children:["(",V[x.platform]??x.platform,")"]})]},x.id))})]}),n.length===1&&e.jsxs(r,{fontSize:"sm",color:"fg.muted",mb:4,children:["Analyzing"," ",e.jsx(r,{as:"span",fontWeight:"bold",color:"fg",children:n[0].platform_username})," ","on ",s]}),e.jsxs(m,{mb:4,textAlign:"left",children:[e.jsx(r,{fontSize:"sm",fontWeight:"semibold",mb:2,color:"fg",children:"Time control"}),e.jsx(ee,{direction:"row",gap:2,flexWrap:"wrap",children:p.map(x=>e.jsx(W,{size:"sm",variant:u===x?"solid":"outline",bg:u===x?"#5457E0":"transparent",color:u===x?"white":"fg.muted",onClick:()=>g(x),children:x.charAt(0).toUpperCase()+x.slice(1)},x))})]}),e.jsx(W,{w:"full",bg:"#5457E0",color:"white",_hover:{bg:"#6B6EF0"},size:"lg",onClick:()=>d&&i(d,u),loading:o,disabled:!d,children:"Generate my Career Report"}),e.jsxs(v,{mt:4,justify:"center",color:"fg.subtle",fontSize:"sm",children:[e.jsx(pe,{}),e.jsx(r,{children:"Takes about 5 minutes"})]})]}),e.jsx(r,{fontSize:"xs",color:"fg.subtle",mt:2,children:"Premium feature. Needs 50+ games in each of two 52-week windows for the chosen time control."})]})})}function Ee({job:n,onCancel:o,isCancelling:i}){const d=Math.round(n.processed_games/n.total_games*100),h=n.total_games/2,u=n.processed_games===0?`Fetching your games from ${V[n.platform]??"your platform"}…`:n.processed_games<h?"Analyzing your earlier games…":n.processed_games<n.total_games?"Analyzing your recent games…":"Wrapping up…";return e.jsx(G,{maxW:"2xl",py:{base:12,md:20},children:e.jsxs(B,{gap:8,textAlign:"center",children:[e.jsxs(m,{children:[e.jsx(E,{size:"lg",children:"Running your report…"}),e.jsx(r,{color:"fg.muted",mt:2,children:u})]}),e.jsxs(m,{w:"full",maxW:"md",children:[e.jsxs(v,{justify:"space-between",mb:2,children:[e.jsxs(r,{fontSize:"sm",color:"fg.muted",children:[n.processed_games," of ",n.total_games," games"]}),e.jsxs(r,{fontSize:"sm",fontWeight:"bold",color:"fg",children:[d,"%"]})]}),e.jsx(m,{bg:"bg.emphasized",borderRadius:"full",h:"10px",overflow:"hidden",children:e.jsx(m,{bg:"purple.500",h:"full",w:`${d}%`,transition:"width 0.6s ease-out",borderRadius:"full"})})]}),e.jsxs(v,{color:"fg.subtle",children:[e.jsx(fe,{size:"sm"}),e.jsx(r,{fontSize:"sm",children:"Stockfish doesn't rush. Feel free to come back in a few minutes."})]}),e.jsx(W,{size:"sm",variant:"ghost",color:"fg.subtle",_hover:{color:"red.600",bg:"red.50"},onClick:o,loading:i,children:"Cancel report"})]})})}function $e({job:n,onRetry:o}){return e.jsx(G,{maxW:"2xl",py:20,children:e.jsxs(B,{gap:6,textAlign:"center",children:[e.jsx(E,{size:"lg",color:"red.600",children:"Report failed"}),e.jsx(r,{color:"fg.muted",children:n.error_message||"Something went wrong while analyzing your games."}),e.jsx(W,{bg:"#5457E0",color:"white",_hover:{bg:"#6B6EF0"},onClick:o,children:"Try again"})]})})}const t={bg:"var(--kc-inf-bg)",surface:"var(--kc-inf-surface)",ink:"var(--kc-inf-ink)",subInk:"var(--kc-inf-sub)",mutedInk:"var(--kc-inf-muted)",rule:"var(--kc-inf-rule)",ruleStrong:"var(--kc-inf-rule-strong)",accent:"var(--kc-inf-accent)",good:"var(--kc-inf-good)",mono:'ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", monospace'},Ie=`
2  :root {
3    --kc-inf-bg: #F5F3EE;
4    --kc-inf-surface: #FFFFFF;
5    --kc-inf-ink: #111110;
6    --kc-inf-sub: #54524B;
7    --kc-inf-muted: #6B695F;
8    --kc-inf-rule: #DEDAD1;
9    --kc-inf-rule-strong: #C6C2B8;
10    --kc-inf-win: #16A34A;
11    --kc-inf-draw: #6B7280;
12    --kc-inf-loss: #DC2626;
13    --kc-inf-line: #5457E0;
14    --kc-inf-accent: #C2372C;
15    --kc-inf-good: #2F7D45;
16  }
17  .dark {
18    --kc-inf-bg: #0B0C0E;
19    --kc-inf-surface: #101215;
20    --kc-inf-ink: #E8E6E1;
21    --kc-inf-sub: #B4B2AB;
22    --kc-inf-muted: #98968F;
23    --kc-inf-rule: #22252A;
24    --kc-inf-rule-strong: #343841;
25    --kc-inf-win: #3FB950;
26    --kc-inf-draw: #8B949E;
27    --kc-inf-loss: #F85149;
28    --kc-inf-line: #7072F6;
29    --kc-inf-accent: #E0604F;
30    --kc-inf-good: #3FB950;
31  }
32`;function Be(n){return n<=-40?{glyph:"!!",label:"much better"}:n<=-8?{glyph:"!",label:"better"}:n<8?{glyph:"=",label:"flat"}:n<40?{glyph:"?",label:"worse"}:{glyph:"??",label:"much worse"}}function Le({result:n,onStartNew:o,platformLabel:i,timeClass:d,username:h}){const u=oe(n.first_batch.year_range),g=oe(n.latest_batch.year_range),l=n.first_batch,f=n.latest_batch,s=H(l.total_blunders,f.total_blunders),p=l.games_analyzed+f.games_analyzed,x=["opening","middlegame","endgame"].map(c=>({phase:c,before:l.phase_counts[c],after:f.phase_counts[c],delta:H(l.phase_counts[c],f.phase_counts[c])})),S=[...x].filter(c=>c.delta<=-20&&c.before>=5).sort((c,z)=>c.delta-z.delta)[0]??null,w=[...x].filter(c=>c!==S&&c.delta>=8&&c.before>=5).sort((c,z)=>z.delta-c.delta)[0]??x.find(c=>c!==S&&Math.abs(c.delta)<8)??null,b=x.filter(c=>c.delta>=8).length,j=Math.min(...x.map(c=>c.delta)),M=[...[...x].sort((c,z)=>Math.abs(z.after-z.before)-Math.abs(c.after-c.before)).map(c=>{var A;const N=((A=n.persistent_weakness)==null?void 0:A.phase)===c.phase&&Math.abs(c.delta)<10?"No progress. The standing problem.":c.delta<=-20&&c.delta===j?"Where the year was won":c.delta<=-8?"Trending the right way":c.delta>=8?b===1?"Only phase trending worse":"Trending worse":"Flat, inside the noise band";return{name:`${We[c.phase]} blunders`,sub:N,before:c.before,after:c.after}})],R={name:"Total blunders",before:l.total_blunders,after:f.total_blunders},L=R.after-R.before,$=H(R.before,R.after),O=Math.abs($)<=8,P=L<0&&!O?t.good:O?t.mutedInk:t.accent,k=Math.max(1,...M.map(c=>Math.abs(c.after-c.before))),D=(c,z)=>z>0?(c/z).toFixed(2):"0.00";
32return e.jsxs(m,{color:t.ink,py:{base:8,md:16},px:{base:5,md:6},children:[e.jsx("style",{children:Ie}),e.jsxs(m,{maxW:"760px",mx:"auto",children:[e.jsx(_,{children:e.jsxs(v,{justify:"space-between",mb:{base:12,md:16},fontSize:"sm",color:t.subInk,children:[e.jsxs(v,{gap:2,children:[e.jsx(m,{w:2,h:2,borderRadius:"full",bg:t.ink}),e.jsx(r,{fontWeight:"medium",color:t.ink,children:"Career annotation"}),e.jsx(r,{children:"·"}),e.jsx(r,{children:h})]}),e.jsxs(v,{gap:1.5,children:[e.jsx(m,{fontSize:"13px",px:3,py:1,borderRadius:"full",bg:t.ink,color:t.bg,children:i}),d&&e.jsx(m,{fontSize:"13px",px:3,py:1,borderRadius:"full",bg:t.ink,color:t.bg,textTransform:"capitalize",children:d})]})]})}),e.jsxs(m,{mb:{base:12,md:16},children:[e.jsx(_,{children:e.jsx(E,{as:"h1",fontSize:{base:"4xl",md:"6xl"},fontWeight:"semibold",letterSpacing:"-0.022em",lineHeight:"1.04",mb:10,color:t.ink,maxW:"15ch",children:S&&w?e.jsxs(e.Fragment,{children:["Your"," ",e.jsx(r,{as:"span",color:t.good,children:S.phase})," ","transformed. Your ",w.phase," didn't."]}):S?e.jsxs(e.Fragment,{children:["Your"," ",e.jsx(r,{as:"span",color:t.good,children:S.phase})," ","transformed."]}):s<=-5?e.jsxs(e.Fragment,{children:[e.jsx(r,{as:"span",color:t.good,children:"Fewer blunders,"})," ","across the board."]}):s>=5?e.jsxs(e.Fragment,{children:[e.jsx(r,{as:"span",color:t.accent,children:"More blunders"})," ","than the year before."]}):e.jsx(e.Fragment,{children:"A year of holding steady."})})}),e.jsx(_,{delay:150,children:e.jsxs(F,{gap:{base:8,md:14},wrap:"wrap",align:"flex-end",pb:8,borderBottom:`1px solid ${t.rule}`,children:[e.jsxs(m,{children:[e.jsx(r,{fontSize:"xs",letterSpacing:"0.09em",textTransform:"uppercase",color:t.mutedInk,mb:2.5,fontWeight:"semibold",children:"Your blunders per game"}),e.jsxs(v,{gap:2.5,align:"baseline",children:[e.jsx(r,{fontSize:"3xl",fontWeight:"semibold",letterSpacing:"-0.02em",color:t.subInk,fontVariantNumeric:"tabular-nums",lineHeight:"1",children:D(l.total_blunders,l.games_analyzed)}),e.jsx(r,{fontSize:"xl",color:t.mutedInk,lineHeight:"1",children:"→"}),e.jsx(r,{fontSize:"3xl",fontWeight:"semibold",letterSpacing:"-0.02em",color:t.ink,fontVariantNumeric:"tabular-nums",lineHeight:"1",children:D(f.total_blunders,f.games_analyzed)}),e.jsxs(r,{fontSize:"md",fontWeight:"semibold",color:s<-2?t.good:s>2?t.accent:t.mutedInk,fontVariantNumeric:"tabular-nums",children:[s>0?"+":"−",Math.abs(s),"%"]})]})]}),e.jsxs(m,{children:[e.jsx(r,{fontSize:"xs",letterSpacing:"0.09em",textTransform:"uppercase",color:t.mutedInk,mb:2.5,fontWeight:"semibold",children:"Sample"}),e.jsxs(r,{fontSize:"sm",color:t.subInk,lineHeight:"1.6",children:[l.games_analyzed," games in each period",e.jsx("br",{}),u," compared with ",g," · ",p," games analyzed"]})]})]})})]}),e.jsxs(m,{mb:{base:12,md:16},children:[e.jsx(_,{children:e.jsxs(v,{justify:"space-between",pb:2.5,fontSize:"xs",letterSpacing:"0.09em",textTransform:"uppercase",color:t.mutedInk,fontWeight:"semibold",children:[e.jsx(r,{children:"Findings"}),e.jsx(r,{children:"Before → after · change"})]})}),e.jsxs(m,{position:"relative",children:[e.jsx(m,{display:{base:"none",md:"block"},position:"absolute",top:0,bottom:0,right:"262px",w:"1px",bg:t.ruleStrong}),M.map((c,z)=>{const N=c.after-c.before,A=H(c.before,c.after),X=Math.abs(A)<=8,Z=N<0&&!X,Y=Z?t.good:X?t.mutedInk:t.accent,ie=Math.max(3,Math.round(Math.abs(N)/k*52)),ae=Be(A);return e.jsx(_,{delay:z*120,children:e.jsxs(m,{display:"grid",gridTemplateColumns:{base:"minmax(0,1fr) auto",md:"30px minmax(0,1fr) 104px 110px 60px"},gap:{base:3,md:4},alignItems:"center",py:5,px:2,borderTop:`1px solid ${t.rule}`,children:[e.jsx(r,{display:{base:"none",md:"block"},fontFamily:t.mono,fontSize:"xs",color:t.mutedInk,children:String(z+1).padStart(2,"0")}),e.jsxs(m,{minW:0,children:[e.jsxs(r,{fontSize:{base:"md",md:"lg"},letterSpacing:"-0.01em",color:t.ink,children:[c.name,e.jsx(r,{as:"span",fontFamily:t.mono,fontWeight:"semibold",color:Y,ml:2,children:ae.glyph})]}),e.jsx(r,{fontSize:"sm",fontWeight:"medium",color:t.subInk,mt:.5,children:c.sub})]}),e.jsx(m,{display:{base:"none",md:"block"},position:"relative",h:"10px",children:e.jsx(m,{position:"absolute",top:0,h:"10px",borderRadius:"2px",bg:Y,...Z?{right:"50%"}:{left:"50%"},w:`${ie}px`})}),e.jsxs(r,{fontSize:{base:"sm",md:"md"},textAlign:"right",color:t.subInk,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums",children:[c.before," →"," ",e.jsx(r,{as:"span",color:t.ink,children:c.after})]}),e.jsxs(r,{display:{base:"none",md:"block"},fontSize:"md",fontWeight:"semibold",textAlign:"right",color:Y,fontVariantNumeric:"tabular-nums",children:[A>0?"+":"−",Math.abs(A),"%"]})]})},c.name)})]}),e.jsxs(_,{delay:360,children:[e.jsxs(m,{display:"grid",gridTemplateColumns:{base:"minmax(0,1fr) auto",md:"30px minmax(0,1fr) 104px 110px 60px"},gap:{base:3,md:4},alignItems:"center",py:4,px:2,borderTop:`2px solid ${t.ruleStrong}`,borderBottom:`1px solid ${t.rule}`,children:[e.jsx(m,{display:{base:"none",md:"block"}}),e.jsx(r,{fontSize:{base:"md",md:"lg"},fontWeight:"semibold",letterSpacing:"-0.01em",color:t.ink,children:R.name}),e.jsx(m,{display:{base:"none",md:"block"}}),e.jsxs(r,{fontSize:{base:"sm",md:"md"},textAlign:"right",color:t.subInk,whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums",children:[R.before," →"," ",e.jsx(r,{as:"span",color:t.ink,fontWeight:"semibold",children:R.after})]}),e.jsxs(r,{display:{base:"none",md:"block"},fontSize:"md",fontWeight:"semibold",textAlign:"right",color:P,fontVariantNumeric:"tabular-nums",children:[$>0?"+":"−",Math.abs($),"%"]})]}),e.jsx(r,{fontSize:"sm",color:t.mutedInk,mt:3.5,children:"Bars are scaled to the largest phase change. Left of the axis is fewer blunders, right is more."}),e.jsx(r,{fontSize:"xs",fontFamily:t.mono,color:t.mutedInk,mt:1.5,children:"!! much better · ! better · = flat · ? worse · ?? much worse"})]})]}),n.career_stats&&e.jsx(_e,{stats:n.career_stats}),e.jsx(_,{children:n.persistent_weakness&&e.jsx(Oe,{weakness:n.persistent_weakness})}),e.jsx(_,{children:e.jsx(m,{mt:{base:12,md:16},pt:6,borderTop:`1px solid ${t.rule}`,fontSize:"xs",color:t.mutedInk,children:e.jsxs(v,{justify:"space-between",align:"center",wrap:"wrap",gap:3,children:[e.jsxs(r,{children:["Generated from ",p," ",d?`${d} `:"","games on ",i,". Stockfish."]}),e.jsx(W,{variant:"plain",onClick:o,border:`1px solid ${t.ruleStrong}`,color:t.ink,bg:"transparent",px:5,py:2.5,borderRadius:"md",fontSize:"sm",fontWeight:"medium",curs
32or:"pointer",_hover:{borderColor:t.ink},transition:"border-color 0.15s",children:"Run a new report →"})]})})})]})]})}function Oe({weakness:n}){const o=Ae[n.phase],i=je({onSuccess:d=>{d.added===0?T.create({title:"Already in your drills",description:`You already have all available ${d.theme} puzzles.`,type:"info"}):T.create({title:`${d.added} puzzles added`,description:"Open Training to start drilling them.",type:"success"})},onError:d=>{T.create({title:"Could not add puzzles",description:d.message,type:"error"})}});return e.jsxs(m,{bg:t.surface,border:`1px solid ${t.rule}`,borderRadius:"xl",p:{base:7,md:9},children:[e.jsxs(v,{gap:2,mb:4,children:[e.jsx(m,{w:1.5,h:1.5,borderRadius:"full",bg:t.accent}),e.jsx(r,{fontSize:"xs",letterSpacing:"0.12em",textTransform:"uppercase",color:t.accent,fontWeight:"semibold",children:"Standing problem"})]}),e.jsxs(E,{as:"h2",fontSize:{base:"2xl",md:"3xl"},fontWeight:"medium",letterSpacing:"-0.02em",mb:4,color:t.ink,children:["Your ",n.phase," hasn't broken open yet."]}),e.jsxs(r,{fontSize:{base:"md",md:"lg"},color:t.subInk,lineHeight:"1.65",mb:7,maxW:"56ch",children:[e.jsxs(r,{as:"span",color:t.ink,fontWeight:"medium",children:[n.latest_count," ",n.phase," blunders this period"]})," ","against ",n.first_count," the year before. This is the number that hasn't responded to playing volume alone. Deliberate practice is how it breaks."]}),e.jsxs(F,{gap:3,wrap:"wrap",children:[o&&e.jsx(W,{variant:"plain",onClick:()=>i.mutate({theme:o.theme,count:30}),disabled:i.isPending,bg:t.ink,color:t.surface,px:6,py:3,borderRadius:"md",fontSize:"sm",fontWeight:"medium",letterSpacing:"0.01em",cursor:i.isPending?"wait":"pointer",opacity:i.isPending?.6:1,_hover:{bg:i.isPending?t.ink:"#262626"},transition:"background 0.15s",children:i.isPending?"Adding…":`${o.cta} →`}),e.jsx(xe,{to:"/weaknesses",children:e.jsx(m,{as:"span",display:"inline-block",border:`1px solid ${t.ruleStrong}`,color:t.ink,px:6,py:3,borderRadius:"md",fontSize:"sm",fontWeight:"medium",cursor:"pointer",_hover:{borderColor:t.ink},transition:"border-color 0.15s",children:"See the patterns behind it"})})]})]})}function H(n,o){return n===0?o===0?0:100:Math.round((o-n)/n*100)}function oe(n){const[o,i]=n;return o==null&&i==null?"recently":o===i||i==null?String(o):o==null?String(i):`${o}–${i}`}export{en as component};

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.