PageSourceSearch

https://algomaster.io/_next/static/chunks/625968-b5cce7594eb7d2db.js?dpl=dpl_4DQj4WvqR7WXoEK4wS6BaVY5fc4E

js algomaster.io collected 2026-09-24 20:26:35 UTC 66,813 bytes, 5 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[625968],{208839:(e,t,s)=>{s.d(t,{F:()=>r});let r={LLD:"lld",SYSTEM_DESIGN:"system-design",CONCURRENCY:"concurrency"}},423616:(e,t,s)=>{s.d(t,{W:()=>a});var r=s(212115);function a(e=!0){let[t,s]=(0,r.useState)(!1),[l,n]=(0,r.useState)({}),[d,i]=(0,r.useState)(!0),o=(0,r.useCallback)(async()=>{if(e)try{let e=await fetch("/api/v1/user/daily-usage");if(!e.ok)return void i(!1);let t=await e.json();s(t.isPremium??!1),n(t.usage??{})}catch{}finally{i(!1)}},[e]);return(0,r.useEffect)(()=>{o()},[o]),{isPremium:t,usage:l,isLoading:d,refetch:o}}},625968:(e,t,s)=>{s.r(t),s.d(t,{LLDPracticeBlockComponent:()=>e3,default:()=>e2});var r=s(695155),a=s(212115),l=s(576045),n=s(5772),d=s(228202),i=s(979649),o=s(488093),c=s(506296),m=s(445916),x=s(760241),u=s(124371),h=s(94514),p=s(267635),b=s(9199),g=s(86901),f=s(20232),j=s(356204),N=s(412651),v=s(52530),w=s(931885),y=s(62791),k=s(984980),S=s(538194),C=s(541641),A=s(965903),E=s(521362),$=s(251900),T=s(836999),M=s(866591),z=s(244362),I=s(833210),L=s(683729),R=s(343963),_=s(38291),F=s(4474),P=s(515366),D=s(715306),O=s(626518),J=s(949156),W=s(462489),q=s(870521),V=s(660521),H=s(552622),U=s(420546),K=s(401164),B=s(779792),X=s(590466),Y=s(356386),Z=s(828601),G=s(655449),Q=s(292888),ee=s(379646),et=s(884262),es=s(396673);let er=[{id:"dracula",label:"Dracula",type:"dark",data:Y},{id:"github-dark",label:"GitHub Dark",type:"dark",data:Z},{id:"cobalt2",label:"Cobalt2",type:"dark",data:s(143179)},{id:"solarized-dark",label:"Solarized Dark",type:"dark",data:Q},{id:"tomorrow-night",label:"Tomorrow Night",type:"dark",data:et},{id:"github-light",label:"GitHub Light",type:"light",data:G},{id:"solarized-light",label:"Solarized Light",type:"light",data:ee},{id:"tomorrow",label:"Tomorrow",type:"light",data:es}],ea=er.filter(e=>"dark"===e.type),el=er.filter(e=>"light"===e.type);function en({settings:e,menuClassName:t=""}){let{fontSize:s,setFontSize:a,tabSize:l,setTabSize:n,minimap:d,setMinimap:i,lineNumbers:o,setLineNumbers:c,wordWrap:m,setWordWrap:x,vimMode:u,setVimMode:h,autocomplete:p,setAutocomplete:b,editorTheme:g,setEditorTheme:f}=e;return(0,r.jsxs)(W.AM,{children:[(0,r.jsx)(W.Wv,{asChild:!0,children:(0,r.jsx)("button",{className:"rounded-md p-1.5 hover:bg-muted",title:"Editor settings",children:(0,r.jsx)(K.A,{className:"h-4 w-4"})})}),(0,r.jsxs)(W.hl,{className:`w-64 space-y-3 p-3 ${t}`,align:"end",children:[(0,r.jsx)("h4",{className:"text-sm font-semibold",children:"Editor Settings"}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(B.J,{className:"text-xs",children:"Theme"}),(0,r.jsxs)(O.l6,{value:g,onValueChange:f,children:[(0,r.jsx)(O.bq,{className:"h-6 w-[120px] text-xs",children:(0,r.jsx)(O.yv,{})}),(0,r.jsxs)(O.gC,{className:t,children:[(0,r.jsx)(O.eb,{value:"auto",className:"text-xs",children:"Auto"}),(0,r.jsx)(O.mi,{}),(0,r.jsxs)(O.s3,{children:[(0,r.jsx)(O.TR,{className:"text-[10px] text-muted-foreground",children:"Dark"}),(0,r.jsx)(O.eb,{value:"vs-dark",className:"text-xs",children:"VS Dark"}),ea.map(e=>(0,r.jsx)(O.eb,{value:e.id,className:"text-xs",children:e.label},e.id))]}),(0,r.jsx)(O.mi,{}),(0,r.jsxs)(O.s3,{children:[(0,r.jsx)(O.TR,{className:"text-[10px] text-muted-foreground",children:"Light"}),(0,r.jsx)(O.eb,{value:"vs",className:"text-xs",children:"VS Light"}),el.map(e=>(0,r.jsx)(O.eb,{value:e.id,className:"text-xs",children:e.label},e.id))]})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(B.J,{className:"text-xs",children:"Font Size"}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(F.$,{variant:"outline",size:"sm",className:"h-6 w-6 p-0 text-xs",onClick:()=>a(e=>Math.max(10,e-1)),disabled:s<=10,children:"−"}),(0,r.jsx)("span",{className:"w-6 text-center text-xs",children:s}),(0,r.jsx)(F.$,{variant:"outline",size:"sm",className:"h-6 w-6 p-0 text-xs",onClick:()=>a(e=>Math.min(24,e+1)),disabled:s>=24,children:"+"})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(B.J,{className:"text-xs",children:"Tab Size"}),(0,r.jsxs)(O.l6,{value:String(l),onValueChange:e=>n(Number(e)),children:[(0,r.jsx)(O.bq,{className:"h-6 w-20 text-xs",children:(0,r.jsx)(O.yv,{})}),(0,r.jsx)(O.gC,{className:t,children:["0","2","4","8"].map(e=>(0,r.jsx)(O.eb,{value:e,className:"text-xs",children:"0"===e?"Auto":e},e))})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(B.J,{className:"text-xs",children:"Minimap"}),(0,r.jsx)(X.d,{checked:d,onCheckedChange:i})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(B.J,{className:"text-xs",children:"Line Numbers"}),(0,r.jsx)(X.d,{checked:o,onCheckedChange:c})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(B.J,{className:"text-xs",children:"Word Wrap"}),(0,r.jsx)(X.d,{checked:m,onCheckedChange:x})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(B.J,{className:"text-xs",children:"Autocomplete"}),(0,r.jsx)(X.d,{checked:p,onCheckedChange:b})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(B.J,{className:"text-xs",children:"Vim Mode"}),(0,r.jsx)(X.d,{checked:u,onCheckedChange:h})]})]})]})}var ed=s(615335),ei=s(140831),eo=s(34152);let ec=[{label:"15 min",seconds:900},{label:"30 min",seconds:1800},{label:"45 min",seconds:2700},{label:"60 min",seconds:3600}];function em(e){let t=Math.floor(e/3600),s=Math.floor(e%3600/60),r=e%60,a=e=>String(e).padStart(2,"0");return t>0?`${a(t)}:${a(s)}:${a(r)}
1`:`${a(s)}:${a(r)}`}function ex({menuClassName:e=""}){let[t,s]=(0,a.useState)("stopwatch"),[l,n]=(0,a.useState)(0),[d,i]=(0,a.useState)(!1),[o,c]=(0,a.useState)(1800),[m,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)(!1),[p,g]=(0,a.useState)(""),j=(0,a.useRef)(null);(0,a.useEffect)(()=>(d?j.current=setInterval(()=>{"stopwatch"===t?n(e=>e+1):n(e=>e<=1?(i(!1),x(!0),0):e-1)},1e3):j.current&&(clearInterval(j.current),j.current=null),()=>{j.current&&clearInterval(j.current)}),[d,t]);let N=e=>{i(!1),s(e),x(!1),h(!1),n("stopwatch"===e?0:o)},v=()=>{let e,s=(e=p.trim().split(":").map(e=>parseInt(e,10))).some(isNaN)||e.some(e=>e<0)?null:1===e.length?e[0]:2===e.length?60*e[0]+e[1]:3===e.length?3600*e[0]+60*e[1]+e[2]:null;null!==s&&s>=0&&(n(s),"countdown"===t&&(c(s),x(!1))),h(!1)};return(0,r.jsxs)(W.AM,{children:[(0,r.jsx)(W.Wv,{asChild:!0,children:(0,r.jsxs)("button",{className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-xs tabular-nums hover:bg-muted ${m?"text-red-500":d?"text-foreground":"text-muted-foreground"}`,title:"Timer",children:["stopwatch"===t?d?(0,r.jsx)(ed.A,{className:"h-3.5 w-3.5"}):(0,r.jsx)(ei.A,{className:"h-3.5 w-3.5"}):(0,r.jsx)(k.A,{className:`h-3.5 w-3.5 ${m?"animate-pulse":""}`}),em(l)]})}),(0,r.jsxs)(W.hl,{className:`w-64 p-3 ${e}`,align:"end",children:[(0,r.jsxs)("div",{className:"mb-3 flex gap-1 rounded-md bg-muted p-0.5",children:[(0,r.jsxs)("button",{onClick:()=>N("stopwatch"),className:`flex flex-1 items-center justify-center gap-1.5 rounded px-2 py-1 text-xs font-medium transition-colors ${"stopwatch"===t?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,r.jsx)(ed.A,{className:"h-3.5 w-3.5"})," Stopwatch"]}),(0,r.jsxs)("button",{onClick:()=>N("countdown"),className:`flex flex-1 items-center justify-center gap-1.5 rounded px-2 py-1 text-xs font-medium transition-colors ${"countdown"===t?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,r.jsx)(k.A,{className:"h-3.5 w-3.5"})," Timer"]})]}
1),u?(0,r.jsx)("input",{autoFocus:!0,type:"text",value:p,onChange:e=>g(e.target.value.replace(/[^0-9:]/g,"")),onBlur:v,onKeyDown:e=>{"Enter"===e.key&&v(),"Escape"===e.key&&h(!1)},placeholder:"MM:SS or HH:MM:SS",className:"w-full border-b border-primary bg-transparent py-2 text-center font-mono text-2xl font-semibold tabular-nums outline-none"}):(0,r.jsxs)("div",{onClick:()=>{d||(g(em(l)),h(!0))},title:d?void 0:"Click to edit",className:`rounded py-2 text-center font-mono text-2xl font-semibold tabular-nums transition-colors ${m&&"countdown"===t?"text-red-500":""} ${!d?"cursor-text hover:bg-muted/50":""}`,children:[em(l),m&&"countdown"===t&&(0,r.jsx)("div",{className:"mt-0.5 font-sans text-xs font-normal text-red-500",children:"Time's up!"})]}),(0,r.jsxs)("div",{className:"mt-2 flex items-center justify-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>i(e=>!e),disabled:m||u,className:"flex items-center gap-1 rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",children:d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eo.A,{className:"h-3 w-3"})," Pause"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.A,{className:"h-3 w-3"})," ",0===l||"countdown"===t&&l===o?"Start":"Resume"]})}),(0,r.jsx)("button",{onClick:()=>{i(!1),x(!1),n("stopwatch"===t?0:o)},className:"rounded-md p-1.5 hover:bg-muted",title:"Reset",children:(0,r.jsx)(b.A,{className:"h-3.5 w-3.5"})})]}),"countdown"===t&&(0,r.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,r.jsx)("p",{className:"mb-1.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"Presets"}),(0,r.jsx)("div",{className:"grid grid-cols-4 gap-1",children:ec.map(({label:e,seconds:t})=>(0,r.jsx)("button",{onClick:()=>{i(!1),c(t),n(t),x(!1)},className:`rounded px-2 py-1 text-xs font-medium transition-colors ${o===t&&!m?"bg-primary text-primary-foreground":"bg-muted text-foreground hover:bg-muted/80"}`,children:e},t))})]})]})]})}var eu=s(93608),eh=s(230604),ep=s(971382);function eb({operations:e,args:t,expected:s,actual:a}){return(0,r.jsxs)("div",{className:"space-y-1 p-3 font-mono text-xs",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"operations: "}),e]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"args: "}),t]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"expected: "}),s]}),a?(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"actual: "}),(0,r.jsx)("span",{className:"text-red-600 dark:text-red-400",children:a})]}):null]})}function eg({operations:e,args:t,expected:s,actual:a,passed:l}){let n=(0,ep.bj)(e,t,s);if(!n)return(0,r.jsx)(eb,{operations:e,args:t,expected:s,actual:a});let d=function(e){if(!e)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}(a),i=null!==d&&d.length===n.length?d:null,o=null!==i||!0===l;return(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-xs",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-left text-[10px] uppercase tracking-wide text-muted-foreground",children:[(0,r.jsx)("th",{className:"px-3 py-1.5 font-medium",children:"Call"}),(0,r.jsx)("th",{className:"px-3 py-1.5 font-medium",children:o?"Expected":"Returns"}),o&&(0,r.jsx)("th",{className:"px-3 py-1.5 font-medium",children:"Your output"})]})}),(0,r.jsx)("tbody",{children:n.map((e,t)=>{let s=o?i?JSON.stringify(i[t]):e.result:null,a=null!==s&&s!==e.result;return(0,r.jsxs)("tr",{className:"border-t border-border/60",children:[(0,r.jsx)("td",{className:"whitespace-nowrap px-3 py-1.5 font-mono",children:(0,r.jsx)("span",{className:e.isConstructor?"text-cyan-700 dark:text-cyan-400":"",children:e.call})}),(0,r.jsx)("td",{className:"whitespace-nowrap px-3 py-1.5 font-mono",children:(0,r.jsx)("span",{className:"null"===e.result?"text-muted-foreground":"text-foreground",children:e.result})}),o&&(0,r.jsx)("td",{className:"whitespace-nowrap px-3 py-1.5 font-mono",children:(0,r.jsx)("span",{className:a?"font-semibold text-red-600 dark:text-red-400":"null"===s?"text-muted-foreground":"text-foreground",children:s})})]},t)})})]})})}var ef=s(411746);let ej={wrong_answer:"Wrong answer",compile_error:"Compile error",runtime_error:"Runtime error",timeout:"Time limit exceeded",memory_limit:"Memory limit exceeded"};function eN(e){return e&&ej[e]||"Wrong answer"}function ev({label:e,tone:t,children:s}){return(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:e}),(0,r.jsx)("pre",{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words rounded px-2 py-1.5 font-mono text-xs ${"bad"===t?"bg-red-500/10 text-red-700 dark:text-red-400":"bg-muted/60"}`,children:s})]})}function ew({failure:e,status:t,totalTests:s}){if("compile_error"===t)return(0,r.jsx)(ev,{label:"Compiler output",tone
1:"bad",children:e.error||"Compilation failed"});let[a,l]=e.input,n=2===e.input.length?(0,ep.bj)(a,l,e.expected):null,d=!!n&&!e.error&&function(e,t){try{let s=JSON.parse(t);return Array.isArray(s)&&s.length===e}catch{return!1}}(n.length,e.actual);return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("p",{className:"text-xs font-medium text-foreground",children:["Failed on test ",e.testCaseIndex+1,null!=s?` of ${s}`:""]}),n?(0,r.jsx)("div",{className:"overflow-hidden rounded-md border border-border",children:(0,r.jsx)(eg,{operations:a,args:l,expected:e.expected,actual:d?e.actual:void 0})}):(0,r.jsxs)(r.Fragment,{children:[e.input.length>0&&(0,r.jsx)(ev,{label:"Input",children:e.input.join("\n")}),(0,r.jsx)(ev,{label:"Expected",children:e.expected})]}),!d&&!e.error&&(0,r.jsx)(ev,{label:"Your output",tone:"bad",children:e.actual||"no output"}),e.error&&(0,r.jsx)(ev,{label:"Error",tone:"bad",children:e.error})]})}var ey=s(441585),ek=s(576597);let eS={pass:{label:"Good",icon:N.A,iconClass:"text-emerald-600 dark:text-emerald-400",pill:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950/60 dark:text-emerald-300"},warn:{label:"Could improve",icon:ey.A,iconClass:"text-amber-600 dark:text-amber-400",pill:"bg-amber-100 text-amber-700 dark:bg-amber-950/60 dark:text-amber-300"},fail:{label:"Needs fixing",icon:y.A,iconClass:"text-red-600 dark:text-red-400",pill:"bg-red-100 text-red-700 dark:bg-red-950/60 dark:text-red-300"}},eC=({children:e})=>(0,r.jsx)("span",{className:"[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-px [&_code]:font-mono [&_code]:text-[11px] [&_code]:text-foreground [&_p]:m-0 [&_strong]:font-semibold [&_strong]:text-foreground",children:(0,r.jsx)(ek.oz,{children:e})});function eA({label:e,status:t,comment:s,meta:a,children:l}){let n=eS[t]??eS.warn,d=n.icon;return(0,r.jsxs)("div",{className:"rounded-lg border border-border p-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d,{className:`h-4 w-4 shrink-0 ${n.iconClass}`}),(0,r.jsx)("span",{className:"text-sm font-medium",children:e}),(0,r.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-2",children:[a,(0,r.jsx)("span",{className:`whitespace-nowrap rounded-full px-2 py-0.5 text-[10px] font-semibold ${n.pill}`,children:n.label})]})]}),l,s&&(0,r.jsx)("div",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:(0,r.jsx)(eC,{children:s})})]})}function eE({children:e}){return(0,r.jsx)("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(240px,1fr))] gap-2",children:e})}function e$({title:e="What to do next",children:t}){return(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-muted/40 p-3",children:[(0,r.jsx)("h4",{className:"text-sm font-medium",children:e}),t]})}function eT(e,t){return e>=t?"pass":e>=t-2?"warn":"fail"}let eM={pass:"bg-emerald-500",warn:"bg-amber-500",fail:"bg-red-500"};function ez({score:e,passingScore:t}){let s=Math.max(0,Math.min(100,e/10*100));return(0,r.jsx)("div",{className:"relative h-1.5 w-full overflow-hidden rounded-full bg-muted",children:(0,r.jsx)("div",{className:`h-full rounded-full transition-all ${eM[eT(e,t)]}`,style:{width:`${s}%`}})})}function eI({rubric:e}){let t=e?.dimensions??[];return 0===t.length?null:(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("h4",{className:"text-lg font-semibold",children:"How the design is graded"}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["needs ",ep.ft,"/10 to pass"]})]}),(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border",children:(0,r.jsx)("ul",{className:"divide-y divide-border/60",children:t.map(e=>(0,r.jsxs)("li",{className:"px-3 py-2",children:[(0,r.jsx)("div",{className:"text-xs font-medium",children:e.name}),(0,r.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:e.criteria})]},e.name))})}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Passing every test is not enough on its own. A submission is accepted only when the design also clears the bar."})]})}function eL({design:e}){return e.unavailable?(0,r.jsx)("div",{className:"rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm",children:e.feedback}):(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"rounded-lg border border-border p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5",children:[e.passed?(0,r.jsx)(N.A,{className:"h-4 w-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):(0,r.jsx)(y.A,{className:"h-4 w-4 shrink-0 text-red-600 dark:text-red-400"}),(0,r.jsx)("span",{className:"text-sm font-semibold",children:e.passed?"Design accepted":"Design needs work"}),(0,r.jsxs)("span",{className:"ml-auto font-mono text-sm tabular-nums",children:[e.score,(0,r.jsx)("span",{className:"text-muted-foreground",children:"/10"})]})]}),(0,r.jsxs)("div",{className:"mt-2",children:[(0,r.jsx)(ez,{score:e.score,passingScore:e.passingScore}),(0,r.jsxs)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["passing score ",e.passingScore,"/10"]})]})]}),e.dimensions.length>0&&(0,r.jsx)(eE,{children:e.dimensions.map((t,s)=>(0,r.jsx)(eA,{label:t.name,status:eT(t.score,e.passingScore),comment:t.comment,meta:(0,r.jsxs)("span",{className:"font-mono text-[11px] tabular-nums text-muted-foreground",children:[t.score,"/10"]}),children:(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(ez,{score:t.score,passingScore:e.passingScore})})},s))}),(0,r.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["A submission is accepted only when the tests pass and the design scores at least"," ",e.passingScore,"/10."]})]})}var eR=s(609114);let e_={correct:{label:"Looks correct",icon:N.A,className:"text-emerald-600 dark:text-emerald-400"},nearly:{label:"Nearly there",icon:ey.A,className:"text-amber-600 dar
1k:text-amber-400"},incorrect:{label:"Needs rework",icon:y.A,className:"text-red-600 dark:text-red-400"}},eF=[{key:"correctness",label:"Correctness"},{key:"edgeCases",label:"Edge cases"},{key:"efficiency",label:"Efficiency"},{key:"codeQuality",label:"Code quality"}];function eP({verdict:e}){if(e.unavailable)return(0,r.jsx)("div",{className:"rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm",children:e.summary});let{label:t,icon:s,className:a}=e_[e.rating]??e_.nearly,{time:l,space:n}=e.complexity??{time:"",space:""},d=e.suggestions??[];return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"rounded-lg border border-border p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1.5",children:[(0,r.jsx)(s,{className:`h-4 w-4 shrink-0 ${a}`}),(0,r.jsx)("span",{className:"text-sm font-semibold",children:t}),(l||n)&&(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-2.5 font-mono text-[11px] text-muted-foreground",children:[l&&(0,r.jsxs)("span",{className:"flex items-center gap-1",title:"Time complexity",children:[(0,r.jsx)(k.A,{"aria-hidden":!0,className:"h-3 w-3"}),l]}),n&&(0,r.jsxs)("span",{className:"flex items-center gap-1",title:"Space complexity",children:[(0,r.jsx)(eR.A,{"aria-hidden":!0,className:"h-3 w-3"}),n]})]})]}),e.summary&&(0,r.jsx)("div",{className:"mt-1.5 text-xs leading-relaxed text-muted-foreground",children:(0,r.jsx)(eC,{children:e.summary})})]}),(0,r.jsx)(eE,{children:eF.map(({key:t,label:s})=>{let a=e.aspects?.[t];return a?(0,r.jsx)(eA,{label:s,status:a.status,comment:a.comment},t):null})}),d.length>0&&(0,r.jsx)(e$,{children:(0,r.jsx)("ol",{className:"mt-2 space-y-1.5",children:d.map((e,t)=>(0,r.jsxs)("li",{className:"flex gap-2 text-xs leading-relaxed text-muted-foreground",children:[(0,r.jsx)("span",{className:"mt-px flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-background text-[10px] font-semibold text-foreground",children:t+1}),(0,r.jsx)(eC,{children:e})]},t))})}),(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"This review is advisory. Only the test cases decide whether a submission is accepted."})]})}var eD=s(208839);function eO(e=[]){return e.map(e=>({name:e.paramName,type:e.paramType,...e.elementType?{elementType:e.elementType}:{}}))}var eJ=s(817105),eW=s(598500),eq=s.n(eW),eV=s(298613),eH=s(423616),eU=s(65879);let eK={easy:"text-emerald-600 dark:text-emerald-400",medium:"text-amber-600 dark:text-amber-400",hard:"text-red-600 dark:text-red-400"},eB={easy:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-400 border border-emerald-200 dark:border-emerald-800",medium:"bg-amber-100 text-amber-700 dark:bg-amber-950/50 dark:text-amber-400 border border-amber-200 dark:border-amber-800",hard:"bg-red-100 text-red-700 dark:bg-red-950/50 dark:text-red-400 border border-red-200 dark:border-red-800"},eX="text-sm h-8 px-3 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:text-foreground data-[state=inactive]:text-muted-foreground data-[state=active]:shadow-none hover:text-foreground transition-colors",eY={notes:"solar:notebook-linear",discussion:"solar:chat-round-dots-linear"},eZ={"classes-and-objects":"Classes and Objects",encapsulation:"Encapsulation",abstraction:"Abstraction",inheritance:"Inheritance",polymorphism:"Polymorphism",interfaces:"Interfaces",enums:"Enums",association:"Association",aggregation:"Aggregation",composition:"Composition",dependency:"Dependency","single-responsibility":"Single Responsibility","open-closed":"Open/Closed","liskov-substitution":"Liskov Substitution","interface-segregation":"Interface Segregation","dependency-inversion":"Dependency Inversion","design-principles":"Design Principles","creational-patterns":"Creational Patterns","
1structural-patterns":"Structural Patterns","behavioral-patterns":"Behavioral Patterns","state-management":"State Management",concurrency:"Concurrency",design:"Design"},eG={"--reading-font-size":"1rem","--reading-line-height":"1.6","--reading-heading-scale":"0.9"},eQ="lld-practice-run",e0="lld-practice-submit",e1="lld-practice-format";function e5(e=[]){let t={};for(let s of e)t[function(e){let t=e.match(/^lldPractice(?:Template|Solution)(\w+)$/);return t?t[1].toLowerCase():e.toLowerCase()}(s.blockType)]=s.code;return t}let e4=(e,t)=>{var s;let r;return s=e.design,r=eO(s?.constructorParams),{functionName:s?.className??"",design:{className:s?.className??"",...r.length?{constructor:{params:r}}:{},methods:(s?.methods??[]).map(e=>({name:e.methodName,params:eO(e.params),returnType:e.returnType,...e.returnElementType?{returnElementType:e.returnElementType}:{}}))},inputs:[{name:"operations",type:"array",elementType:"string"},{name:"args",type:"matrix"}],output:{type:"array"},testCases:t.map(e=>({inputs:[e.operations,e.args],expected:e.expected}))}};function e3({node:e,editorOnly:t,variant:K="stacked",progressId:B,problemList:X,currentProblemSlug:Y,onNavigateProblem:Z,onExit:G,leftPanelTabs:Q,solutionContent:ee,onCodeChange:et,onAlgoChatOpen:es,track:ea=eD.F.LLD,exampleCases:el,runCases:ed,judgeProblemId:ei}){var eo,ec;let{fields:em}=e,{id:ep,title:eb,difficulty:ej="easy",description:ev,topics:ey=[],hints:ek=[],visibleTestCases:eS=[],hiddenTestCases:eC=[],rubric:eA,solutionTemplates:eE=[],solutions:e$=[]}=em,eT=B??ep,eM="split"===K,ez=ea===eD.F.LLD,eR=!!ei,e_=(el?.length??0)>0,{resolvedTheme:eF,setTheme:eO}=(0,l.D)(),eW=(0,eV.k)(e=>e.preferredLanguage),e2=(0,eV.k)(e=>e.setPreferredLanguage),e6=(0,eV.k)(e=>e.userId),e8=(0,a.useMemo)(()=>(function(e){let t=e?.root?.children??[],s=t.length;for(;s>0;){let e=t[s-1]?.type;if("heading"!==e&&"horizontalrule"!==e)break;s-=1}return s===t.length?e:{...e,root:{...e.root,children:t.slice(0,s)}}})(ev),[ev]),{usage:e9,isPremium:e7,isLoading:te,refetch:tt}=(0,eH.W)(!!e6),ts=(0,a.useMemo)(()=>e5(eE),[eE]),tr=(0,a.useMemo)(()=>e5(e$),[e$]),ta=(0,a.useMemo)(()=>Object.keys(ts),[ts]),[tl,tn]=(0,a.useState)(()=>eW&&ts[eW]?eW:ta[0]??"java"),[td,ti]=(0,a.useState)({}),[to,tc]=(0,a.useState)(null),[tm,tx]=(0,a.useState)(null),[tu,th]=(0,a.useState)(null),[tp,tb]=(0,a.useState)(null),[tg,tf]=(0,a.useState)(null),[tj,tN]=(0,a.useState)(null),[tv,tw]=(0,a.useState)("cases"),[ty,tk]=(0,a.useState)(0),[tS,tC]=(0,a.useState)("problem"),[tA,tE]=(0,a.useState)(!1),[t$,tT]=(0,a.useState)(!1),[tM,tz]=(0,a.useState)(!1),[tI,tL]=(0,a.useState)(!1),[tR,t_]=(0,a.useState)(!1),[tF,tP]=(0,a.useState)(!1),[tD,tO]=(0,a.useState)(!1),[tJ,tW]=(0,a.useState)(!1),[tq,tV]=(0,a.useState)(!1),[tH,tU]=(0,a.useState)(!1),[tK,tB]=(0,a.useState)(!1),[tX,tY]=(0,a.useState)(new Set),[tZ,tG]=(0,a.useState)([]),[tQ,t0]=(0,a.useState)(null),[t1,t5]=(0,a.useState)(!1),t4=(0,a.useRef)(!1),t3=function(){let[e,t]=(0,a.useState)(13),[s,r]=(0,a.useState)(0),[l,n]=(0,a.useState)(!1),[d,i]=(0,a.useState)(!0),[o,c]=(0,a.useState)(!0),[m,x]=(0,a.useState)(!1),[u,h]=(0,a.useState)(!1),[p,b]=(0,a.useState)("auto"),g=(0,a.useRef)(!1),f=(0,a.useRef)({fontSize:"coding-practice-fontSize",lineNumbers:"c
1oding-practice-lineNumbers"});return(0,a.useEffect)(()=>{let e=window.matchMedia("(max-width: 767px)").matches;f.current={fontSize:e?"coding-practice-fontSize-mobile":"coding-practice-fontSize",lineNumbers:e?"coding-practice-lineNumbers-mobile":"coding-practice-lineNumbers"};try{let s=localStorage.getItem(f.current.lineNumbers);t(Number(localStorage.getItem(f.current.fontSize))||(e?12:13)),r(Number(localStorage.getItem("coding-practice-tabSize"))||0),n("true"===localStorage.getItem("coding-practice-minimap")),i(null!==s?"false"!==s:!e),c("false"!==localStorage.getItem("coding-practice-wordWrap")),x("true"===localStorage.getItem("coding-practice-vimMode")),h((0,eh.Cv)()),b(localStorage.getItem("coding-practice-theme")||"auto")}catch{}g.current=!0},[]),(0,a.useEffect)(()=>{if(g.current)try{localStorage.setItem(f.current.fontSize,String(e)),localStorage.setItem("coding-practice-tabSize",String(s)),localStorage.setItem("coding-practice-minimap",String(l)),localStorage.setItem(f.current.lineNumbers,String(d)),localStorage.setItem("coding-practice-wordWrap",String(o)),localStorage.setItem("coding-practice-vimMode",String(m)),localStorage.setItem(eh.ZP,String(u)),localStorage.setItem("coding-practice-theme",p)}catch{}},[e,s,l,d,o,m,u,p]),{fontSize:e,setFontSize:t,tabSize:s,setTabSize:r,minimap:l,setMinimap:n,lineNumbers:d,setLineNumbers:i,wordWrap:o,setWordWrap:c,vimMode:m,setVimMode:x,autocomplete:u,setAutocomplete:h,editorTheme:p,setEditorTheme:b}}(),t2=(0,a.useRef)(null),t6=(0,a.useRef)(null),[t8,t9]=(0,a.useState)(0);eo=t3.vimMode,(0,a.useEffect)(()=>{let e=!1,t=null,r=()=>{try{t?.dispose()}catch{}t=null};return eo&&t8&&t2.current&&t6.current?(Promise.all([s.e(564721),s.e(587999),s.e(205164),s.e(678638),s.e(909688)]).then(s.t.bind(s,621827,23)).then(({initVimMode:s})=>{!e&&t2.current&&t6.current&&(t=s(t2.current,t6.current))}),()=>{e=!0,r()}):r},[eo,t8,t2,t6]);let t7=(0,a.useRef)({}),se=(0,a.useRef)({});(0,a.useEffect)(()=>{tT(!0),tz("u">typeof navigator&&navigator.userAgent.includes("Mac")),d.loader.init().then(e=>{er.forEach(t=>{e.editor.defineTheme(t.id,t.data)})})},[]);let[st,ss]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=window.matchMedia("(max-width: 767px)"),t=()=>ss(e.matches);return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]);let sr=`lld-practice-${eT}`,sa=`lld-practice:${eT}`,sl=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!sl.current){sl.current=!0;try{let e=window.localStorage.getItem(sa);e&&ti(JSON.parse(e))}catch{}}},[sa]),(0,a.useEffect)(()=>{if(!t$||!e6||!eT)return;let e=!1;return fetch(`/api/v1/lld-coding-practice/last-code?problem_id=${encodeURIComponent(eT)}`).then(e=>e.ok?e.json():null).then(t=>{!e&&t&&(t.hasPassed&&tE(!0),t.codeMap&&"object"==typeof t.codeMap&&ti(e=>{let s={...e};for(let[e,r]of Object.entries(t.codeMap))"string"==typeof r&&r.trim()&&!s[e]&&(s[e]=r);return s}))}).catch(()=>{}),()=>{e=!0}},[t$,e6,eT]),(0,a.useEffect)(()=>{e6&&X?.length&&fetch("/api/v1/lld-practice/solved-problems").then(e=>e.ok?e.json():null).then(e=>{Array.isArray(e?.solvedProblemIds)&&tY(new Set(e.solvedProblemIds))}).catch(()=>{})},[e6,X]);let sn=(0,a.useCallback)(()=>{e6&&eT&&(t5(!0),fetch(`/api/v1/lld-coding-practice/submissions?problem_id=${encodeURIComponent(eT)}`).then(e=>e.ok?e.json():null).then(e=>{Array.isArray(e?.submissions)&&tG(e.submissions),t4.current=!0}).catch(()=>{}).finally(()=>t5(!1)))},[e6,eT]),sd=td[tl]??ts[tl]??"";(0,a.useEffect)(()=>{et?.(sd,tl)},[sd,tl,et]);let si=(0,a.useCallback)(e=>{ti(t=>{let s={...t,[tl]:e};try{window.localStorage.setItem(sa,JSON.stringify(s))}catch{}return s})},[tl,sa]),so=(0,a.useCallback)(()=>{si(ts[tl]??"")},[tl,ts,si]),sc=(0,a.useMemo)(()=>({title:eb,description:function e(t){if(!t||"object"!=typeof t)return"";if(t.root)return e(t.root);if("string"==typeof t.text)return t.text;let s=t.fields;if(s){let e=[...Array.isArray(s.codeBlocks)?s.codeBlocks.map(e=>e?.code):[],s.code].filter(e=>"string"==typeof e&&e.trim().length>0);if(e.length)return e.map(e=>`
2\`\`\`
3${e}
4\`\`\`
5`).join("")}return Array.isArray(t.children)?t.children.map(e).join(" "):""}(e8),rubric:eA??{},templateCode:ts[tl]??"",solutionCode:tr[tl]??"",testCases:eS.map(({operations:e,args:t,expected:s})=>({operations:e,args:t,expected:s}))}),[eb,e8,eA,ts,tr,tl,eS]),sm=(0,a.useCallback)(e=>{let t=e.testResults?.find(e=>!e.passed);tk(t?t.index:0)},[]),sx=(0,a.useCallback)(async(e,t)=>{let s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await s.json();if(!s.ok)throw Error(r?.error||"Request failed");return r},[]),su=(0,a.useCallback)(async()=>
5{if(!e6)return void tO(!0);tc("run"),tN(null),tb(null),tf(null),tw("output");try{let e=await sx("/api/v1/lld-practice/submit",{code:sd,language:tl,problemId:eT,type:"lite",track:ea,...eR?{judgeProblemId:ei,runCases:ed}:{problem:e4(em,eS)}});tx(e),sm(e)}catch(e){tN(e.message)}finally{tc(null),tt()}},[e6,sd,tl,eT,em,eS,ea,eR,ei,ed,sx,sm,tt]),sh=(0,a.useCallback)(async()=>{if(!e6)return void tO(!0);tc("submit"),tN(null),th(null);try{let e=await sx("/api/v1/lld-practice/submit",{code:sd,language:tl,problemId:eT,problemContext:sc,track:ea,...eR?{judgeProblemId:ei}:{problem:e4(em,[...eS,...eC])}});th(e),tb(e.design??null),tE(t=>t||!0===e.accepted),(0,eU.cp)(e),t4.current=!1,tC("submissions"),sn()}catch(e){tN(e.message),tw("output")}finally{tc(null),tt()}},[e6,sd,tl,eT,em,eS,eC,sc,ea,eR,ei,sx,sn,tt]),sp=(0,a.useCallback)(async()=>{if(!e6)return void tO(!0);tc("evaluate"),tN(null),tw("design");try{let e={code:sd,language:tl,problemId:eT,problemContext:sc};ez?tb(await sx("/api/v1/lld-practice/evaluate",e)):tf(await sx("/api/v1/sd-practice/evaluate",e))}catch(e){tN(e.message)}finally{tc(null),tt()}},[e6,sd,tl,eT,sc,ez,sx,tt]),sb=(0,a.useCallback)(async()=>{if((0,eJ.q)(tl)){t_(!0);try{let e=await (0,eJ.P)(sd,tl,0===t3.tabSize?4:t3.tabSize);e!==sd&&si(e)}catch{}finally{t_(!1)}}},[tl,sd,t3.tabSize,si]);(0,a.useEffect)(()=>{let e=()=>su(),t=()=>sh(),s=()=>sb();return window.addEventListener(eQ,e),window.addEventListener(e0,t),window.addEventListener(e1,s),()=>{window.removeEventListener(eQ,e),window.removeEventListener(e0,t),window.removeEventListener(e1,s)}},[su,sh,sb]);let sg=(0,a.useCallback)(e=>!!e.defaultPrevented||t3.vimMode&&!!e.target?.closest?.(".monaco-editor"),[t3.vimMode]);(0,a.useEffect)(()=>{if(!tq)return;let e=e=>{"Escape"!==e.key||sg(e)||tV(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[tq,sg]),(0,a.useEffect)(()=>{if(!tH)return;let e=e=>{"Escape"!==e.key||sg(e)||tU(!1)};document.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",e),document.body.style.overflow=t}},[tH,sg]),(0,a.useEffect)(()=>{let e=()=>tB(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]);let sf=(0,a.useRef)(null),sj=(0,a.useCallback)(()=>{sf.current||(eO("dark"===eF?"light":"dark"),sf.current=setTimeout(()=>{sf.current=null},300))},[eF,eO]),sN=(0,a.useCallback)(()=>{document.fullscreenElement?document.exitFullscreen().catch(()=>{}):document.documentElement.requestFullscreen().catch(()=>{})},[]);(0,a.useEffect)(()=>{requestAnimationFrame(()=>{let e=t7.current[tS];e&&(e.scrollTop=se.current[tS]??0)})},[tS]);let sv=null!==to,sw=!!tm&&!tm.error&&null!=tm.totalTests&&tm.passed===tm.totalTests,sy=el?.[ty],sk=eS[ty],sS=tm?.testResults?.find(e=>e.index===ty),sC=tm?.testResults?.length??0,sA=0===sC?tm?.firstFailure?.error:void 0,sE=X??[],s$=sE.findIndex(e=>e.slug===Y),sT=s$>0,sM=s$>=0&&s$<sE.length-1,sz=(0,a.useCallback)(e=>{let t=t7.current[tS];t&&(se.current[tS]=t.scrollTop),tC(e),"submissions"===e&&!t4.current&&e6&&sn()},[tS,e6,sn]),sI=eM?"z-[10000]":"",sL=(0,r.jsxs)(O.l6,{value:tl,onValueChange:e=>{tn(e),e2?.(e)},children:[(0,r.jsx)(O.bq,{className:"h-8 w-auto gap-1.5 border-none bg-background text-xs shadow-sm",children:(0,r.jsx)(O.yv,{})}),(0,r.jsx)(O.gC,{className:sI,children:ta.map(e=>(0,r.jsx)(O.eb,{value:e,className:"text-xs",children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)(o.In,{icon:eu.Ut[e]??"mdi:code-tags",className:(0,eu.qZ)(e,"h-3.5 w-3.5")}),(0,eu.eV)(e)]})},e))})]}),sR=(0,r.jsxs)("div",{className:"flex shrink-0 items-center overflow-x-auto border-b bg-muted/20 px-2 py-1.5 scrollbar-none md:justify-between md:overflow-visible md:px-3",children:[sL,(0,r.jsxs)("div",{className:"ml-2 flex flex-shrink-0 items-center gap-0.5 border-l pl-2",children:[!eM&&(0,r.jsx)(ex,{menuClassName:sI}),(0,r.jsx)("button",{onClick:sb,disabled:tR||!(0,eJ.q)(tl),className:"rounded-md p-1.5 hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",title:(0,eJ.q)(tl)?`Format code (${tM?"⇧⌥F":"Shift+Alt+F"})`:"Formatting not available for this language",children:tR?(0,r.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,r.jsx)(m.A,{className:"h-4 w-4"})}),(0,r.jsx)(en,{settings:t3,menuClassName:sI}),(0,r.jsx)("button",{onClick:()=>tV(e=>!e),className:"rounded-md p-1.5 hover:bg-muted",title:tq?"Exit editor fullscreen":"Expand editor",children:tq?(0,r.jsx)(x.A,{className:"h-4 w-4"}):(0,r.jsx)(u.A,{className:"h-4 w-4"})}),(0,r.jsx)("button",{onClick:async()=>{await navigator.clipboard.writeText(sd),tL(!0),setTimeout(()=>tL(!1),2e3)},className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Copy code",children:tI?(0,r.jsx)(h.A,{className:"h-4 w-4 text-emerald-500"}):(0,r.jsx)(p.A,{className:"h-4 w-4"})}),(0,r.jsx)("button",{onClick:()=>tP(!0),disabled:sd===(ts[tl]??""),className:"rounded-md p-1.5 hover:bg-muted disabled:pointer-events-none disabled:opacity-50",title:"Reset code",children:(0,r.jsx)(b.A,{className:"h-4 w-4"})})]})]}),s_=(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[(0,r.jsx)("div",{className:t3.vimMode?"min-h-0 flex-1":"h-full",children:(0,r.jsx)(d.default,{height:"100%",language:(0,eu.Zm)(tl),theme:(ec=t3.editorTheme,"auto"!==ec?ec:"dark"===eF?"vs-dark":"light"),value:sd,onChange:e=>si(e??""),beforeMount:e=>{e.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}
5)},onMount:(e,t)=>{t2.current=e,t9(e=>e+1),e.addCommand(t.KeyMod.CtrlCmd|t.KeyCode.Quote,()=>{window.dispatchEvent(new CustomEvent(eQ))}),e.addCommand(t.KeyMod.CtrlCmd|t.KeyCode.Enter,()=>{window.dispatchEvent(new CustomEvent(e0))}),e.addCommand(t.KeyMod.Shift|t.KeyMod.Alt|t.KeyCode.KeyF,()=>{window.dispatchEvent(new CustomEvent(e1))})},options:{minimap:{enabled:t3.minimap},fontSize:t3.fontSize,lineNumbers:t3.lineNumbers?"on":"off",wordWrap:t3.wordWrap?"on":"off",scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:0===t3.tabSize?4:t3.tabSize,insertSpaces:!0,renderLineHighlight:"none",padding:{top:8,bottom:8},renderWhitespace:"none",occurrencesHighlight:"off",...(0,eh.Wh)(t3.autocomplete)}})}),t3.vimMode&&(0,r.jsx)("div",{ref:t6,className:"shrink-0 border-t bg-muted/40 px-2 py-1 font-mono text-xs text-muted-foreground"})]}),sF=(0,r.jsxs)("div",{className:"flex w-full items-center gap-2 md:w-auto md:shrink-0",children:[(0,r.jsxs)(F.$,{size:"sm",onClick:sp,disabled:sv||!sd.trim(),className:"h-8 flex-1 rounded-md bg-amber-500 px-3 text-xs font-medium text-white shadow-sm hover:bg-amber-600 md:flex-none",children:["evaluate"===to?(0,r.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(g.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Evaluate"]}),(0,r.jsx)(P.U,{text:"Run",isMac:tM,shortcut:"run",contentClassName:sI,children:(0,r.jsxs)(F.$,{size:"sm",onClick:su,disabled:sv||!sd.trim(),className:"h-8 flex-1 rounded-md bg-emerald-600 px-3 text-xs font-medium text-white shadow-sm hover:bg-emerald-700 md:flex-none",children:["run"===to?(0,r.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Run"]})}),(0,r.jsx)(P.U,{text:"Submit",isMac:tM,shortcut:"submit",contentClassName:sI,children:(0,r.jsxs)(F.$,{size:"sm",onClick:sh,disabled:sv||!sd.trim(),className:"h-8 flex-1 rounded-md bg-blue-600 px-3 text-xs font-medium text-white shadow-sm hover:bg-blue-700 md:flex-none",children:["submit"===to?(0,r.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(j.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Submit"]})})]}),sP=(0,r.jsxs)("div",{className:"space-y-4 p-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-base font-bold tracking-tight md:text-lg",children:eb}),tA&&(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-0.5 whitespace-nowrap rounded bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400",children:[(0,r.jsx)(N.A,{className:"h-3 w-3"}),"Solved"]})]}),(0,r.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,r.jsx)(_.E,{className:`text-xs capitalize ${eB[ej]??""}`,children:ej}),ey.length>0&&(0,r.jsxs)(W.AM,{children:[(0,r.jsx)(W.Wv,{asChild:!0,children:(0,r.jsxs)("button",{className:"flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs transition-colors hover:bg-muted",children:[(0,r.jsx)(v.A,{className:"h-3 w-3"}),"Topics"]})}),(0,r.jsx)(W.hl,{className:`w-72 p-3 ${sI}`,align:"start",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5",children:ey.map(e=>(0,r.jsx)(_.E,{variant:"secondary",className:"text-xs font-normal",children:eZ[e]??e.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())},e))})})]})]})]}),(0,r.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert [&_p]:mb-2.5 [&_ul]:my-2.5 [&_ol]:my-2.5 [&_li]:mb-1 [&_pre]:my-2.5 [&_table]:my-2.5",style:eG,children:(0,r.jsx)(i.s,{data:e8,converters:R.H})}),ez&&(0,r.jsx)(eI,{rubric:eA}),ek.length>0&&(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-lg font-semibold",children:[(0,r.jsx)(w.A,{className:"h-4 w-4 text-muted-foreground"}),"Hints"]}),(0,r.jsx)(J.nD,{type:"single",collapsible:!0,className:"w-full space-y-1.5",children:ek.map((e,t)=>(0,r.jsxs)(J.As,{value:`hint-${t}`,className:"overflow-hidden rounded-md border px-2",children:[(0,r.jsx)(J.$m,{className:"py-2 text-sm hover:no-underline",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-amber-100 text-[10px] font-semibold text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:t+1}),"Hint ",t+1]})}),(0,r.jsx)(J.ub,{className:"pb-2",children:(0,r.jsx)("div",{className:"prose prose-sm ml-1 mt-1 max-w-none border-l-2 border-amber-400 pl-3 dark:prose-invert dark:border-amber-600 [&>*:last-child]:mb-0 [&_p:last-child]:mb-0",children:(0,r.jsx)(i.s,{data:e.hint,converters:R.H})})})]},t))})]})]}),sD=(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-2 border-b bg-background/95 px-3 py-1.5 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Solution"}),(0,r.jsx)("button",{onClick:()=>tU(e=>!e),className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:tH?"Exit fullscreen (Esc)":"Read in fullscreen","aria-label":tH?"Exit fullscreen":"Read in fullscreen",children:tH?(0,r.jsx)(x.A,{className:"h-4 w-4"}):(0,r.jsx)(u.A,{className:"h-4 w-4"})})]}),(0,r.jsx)("div",{className:"space-y-4 p-4 md:p-5",children:ee?(0,r.jsx)(a.Fragment,{children:ee},"walkthrough"):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No written solution has been published for this problem yet."})})]}),sO=tH?null:sD,sJ=tH?(0,r.jsx)("div",{className:"custom-scrollbar fixed inset-0 z-[60] overflow-y-auto bg-background",children:(0,r.jsx)("div",{className:"mx-auto max-w-4xl",children:sD})}
5):null,sW=tu&&(0,r.jsxs)("div",{className:"mb-3 space-y-3 rounded-md border border-border p-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[tu.accepted?(0,r.jsx)(N.A,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}):(0,r.jsx)(y.A,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,r.jsx)("span",{className:`text-sm font-semibold ${tu.accepted?"text-emerald-600 dark:text-emerald-400":"text-red-600 dark:text-red-400"}`,children:tu.accepted?"Accepted":tu.testsPassed?"Design review below the bar":eN(tu.status)}),null!=tu.totalTests&&(0,r.jsxs)("span",{className:"text-xs tabular-nums text-muted-foreground",children:[tu.passed??0,"/",tu.totalTests," tests passed"]})]}),!tu.accepted&&tu.testsPassed&&tu.design&&(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Every test passed, but the design review scored ",tu.design.score,"/10 and needs ",tu.design.passingScore,"/10. The Design review tab has the breakdown."]}),!tu.testsPassed&&tu.firstFailure&&(0,r.jsx)(ew,{failure:tu.firstFailure,status:tu.status,totalTests:tu.totalTests})]}),sq=(0,r.jsxs)("div",{className:"p-3",children:[sW,e6?t1?(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,r.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Loading submissions..."]}):0===tZ.length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No submissions yet. Submit your code to see history here."}):(0,r.jsx)("div",{className:"space-y-1",children:tZ.map(e=>{let t=function(e){if(!e)return null;try{let t=JSON.parse(e);return"object"==typeof t&&null!==t?t:null}catch{return null}}(e.output),s="passed"===e.status,a=s?"Accepted":t?.judgeStatus&&"accepted"!==t.judgeStatus?eN(t.judgeStatus):"Not accepted";return(0,r.jsxs)("button",{onClick:()=>{e.code&&t0({code:e.code,language:e.language,statusLabel:a,accepted:s,createdAt:e.created_at,details:t?.firstFailure?(0,r.jsx)(ew,{failure:t.firstFailure,status:t.judgeStatus,totalTests:t.totalTests}):void 0})},className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted/60",title:"Click to view this code",children:[s?(0,r.jsx)(N.A,{className:"h-4 w-4 shrink-0 text-emerald-500"}):(0,r.jsx)(y.A,{className:"h-4 w-4 shrink-0 text-red-500"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:`text-xs font-semibold ${s?"text-emerald-600 dark:text-emerald-400":"text-red-600 dark:text-red-400"}`,children:a}),t?.totalTests!=null&&(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[t.passed??0,"/",t.totalTests," tests"]}),t?.designScore!=null&&(0,r.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["design ",t.designScore,"/10"]})]}),(0,r.jsxs)("div",{className:"mt-0.5 flex items-center gap-3",children:[(0,r.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground",children:[eu.Ut[e.language]&&(0,r.jsx)(o.In,{icon:eu.Ut[e.language],className:(0,eu.qZ)(e.language,"h-3 w-3")}),(0,eu.eV)(e.language)]}),(0,r.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-muted-foreground",children:[(0,r.jsx)(k.A,{className:"h-2.5 w-2.5"}),new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]},e.id)})}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Sign in to view your submission history."}),(0,r.jsx)(ef.W,{submission:tQ,onClose:()=>t0(null)})]}),sV=e=>(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:Array.from({length:e},(e,t)=>{let s=tm?.testResults?.find(e=>e.index===t),a=ty===t;return(0,r.jsxs)("button",{onClick:()=>tk(t),className:`inline-flex items-center gap-1 whitespace-nowrap rounded-md border px-2.5 py-1 text-xs font-medium transition-colors ${a?"border-primary/30 bg-primary/15 text-primary":"border-transparent bg-muted/60 text-muted-foreground hover:bg-muted"}`,children:[s&&(s.passed?(0,r.jsx)(N.A,{className:"h-3 w-3 text-emerald-500"}):(0,r.jsx)(y.A,{className:"h-3 w-3 text-red-500"})),"Case ",t+1]},t)})}),sH=(0,r.jsxs)("div",{className:"space-y-3 p-3",children:[(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:(el??[]).map((e,t)=>(0,r.jsxs)("button",{onClick:()=>tk(t),className:`inline-flex items-center whitespace-nowrap rounded-md border px-2.5 py-1 text-xs font-medium transition-colors ${ty===t?"border-primary/30 bg-primary/15 text-primary":"border-transparent bg-muted/60 text-muted-foreground hover:bg-muted"}`,children:["Example ",t+1]},t))}),sy&&(0,r.jsxs)("div",{className:"space-y-3 overflow-hidden rounded-md border border-border p-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Input"}),(0,r.jsx)("pre",{className:"whitespace-pre-wrap break-words rounded bg-muted/60 px-2 py-1.5 font-mono text-xs",children:sy.input})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Output"}),(0,r.jsx)("pre",{className:"whitespace-pre-wrap break-words rounded bg-muted/60 px-2 py-1.5 font-mono text-xs",children:sy.output})]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Run is a quick check against the first couple of scenarios, which is roughly what these examples describe. Submit puts your class under the full set, which stays hidden."})]}),sU=(0,r.jsx)("div",{className:"space-y-3 p-3",children:0===eS.length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"This problem has no example cases. Submit to run the full hidden set."}):(0,r.jsxs)(r.Fragment,{children:[sV(eS.length),sk&&(0,r.jsxs)("div",{className:"overflow-hidden rounded-md border border-border",children:[(0,r.jsx)(eg,{operations:sk.operations,args:sk.args,expected:sk.expected}),sk.explanation&&(0,r.jsx)("p",{className:"border-t border-border/60 px-3 py-2 text-xs text-muted-foreground",children:sk.explanation})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Run checks these cases. Submit also runs a larger hidden set."})]})}),sK=e_?sH:sU,sB=(0,r.jsxs)("div",{className:"space-y-3 p-3",children:[tj&&(0,r.jsx)("div",{className:"rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300",children:tj}),!tm&&!tj&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Run to check your code against the examples. Submit grades it against the full hidden set."}),tm?.error&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:tm.error}),tm&&!tm.error&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[sw?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.A,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-emerald-600 dark:text-emerald-400",children:1===tm.totalTests?"Example passed":"All examples passed"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.A,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,r.jsx)("span",{className:"text-sm font-semibold text-red-600 dark:text-red-400",children:"compile_error"===tm.status?"Compile error":"Wrong answer"})]}),null!=tm.totalTests&&(0,r.jsxs)("span",{className:"text-xs tabular-nums text-muted-foreground",children:[tm.passed??0,"/",tm.totalTests," passed"]})]}),sA?(0,r.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 text-xs",children:[(0,r.jsx)("p",{className:"mb-2 font-medium text-red-600 dark:text-red-400",children:"compile_error"===tm.status?"Your code did not compile":"The run could not complete"}),(0,r.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap text-red-600 dark:text-red-400",children:sA})]}):(0,r.jsxs)(r.Fragment,{children:[sC>0&&(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:Array.from({length:sC},(e,t)=>{let s=tm.testResults?.find(e=>e.index===t);return(0,r.jsxs)("button",{onClick:()=>tk(t),className:`inline-flex items-center gap-1 whitespace-nowrap rounded-md border px-2.5 py-1 text-xs font-medium transition-colors ${ty===t?"border-primary/30 bg-primary/15 text-primary":"border-transparent bg-muted/60 text-muted-foreground hover:bg-muted"}`,children:[s&&(s.passed?(0,r.jsx)(N.A,{className:"h-3 w-3 text-emerald-500"}):(0,r.jsx)(y.A,{className:"h-3 w-3 text-red-500"})),"Example ",t+1]},t)})}),sS&&(0,r.jsxs)("div",{className:"space-y-3 overflow-hidden rounded-md border border-border p-3",children:[el?.[ty]&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Input"}),(0,r.jsx)("pre",{className:"whitespace-pre-wrap break-words rounded bg-muted/60 px-2 py-1.5 font-mono text-xs",children:el[ty].input})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Expected"}),(0,r.jsx)("pre",{className:"whitespace-pre-wrap break-words rounded bg-muted/60 px-2 py-1.5 font-mono text-xs",children:sS.expected})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Your output"}),(0,r.jsx)("pre",{className:`whitespace-pre-wrap break-words rounded px-2 py-1.5 font-mono text-xs ${sS.passed?"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400":"bg-red-500/10 text-red-700 dark:text-red-400"}`,children:sS.actual||(sS.passed?sS.expected:"no output")})]}),sS.error&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-1 text-xs font-medium text-muted-foreground",children:"Error"}),(0,r.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap rounded bg-red-500/10 px-2 py-1.5 font-mono text-xs text-red-700 dark:text-red-400",children:sS.error})]})]})]})]})]}),sX=(0,r.jsxs)("div",{className:"space-y-3 p-3",children:[tj&&(0,r.jsx)("div",{className:"rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300",children:tj}),!tm&&!tj&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Run your code to check it against the example cases. Submit runs the full set and reports its verdict in the Submissions tab."}),tm?.error&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:tm.error}),tm&&!tm.error&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[tm.passed===tm.totalTests?(0,r.jsx)(N.A,{className:"h-4 w-4 text-emerald-600"}):(0,r.jsx)(y.A,{className:"h-4 w-4 text-red-600"}),(0,r.jsxs)("span",{className:"font-medium",children:[tm.passed," of ",tm.totalTests," test",1===tm.totalTests?"":"s"," ","passed"]})]}),sA?(0,r.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 text-xs",children:[(0,r.jsx)("p",{className:"mb-2 font-medium text-red-600 dark:text-red-400",children:"compile_error"===tm.status?"Your code did not compile":"The run could not complete"}),(0,r.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap text-red-600 dark:text-red-400",children:sA})]}):(0,r.jsxs)(r.Fragment,{children:[sC>0&&sV(sC),sS?.error?(0,r.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 p-3 text-xs",children:[(0,r.jsxs)("p",{className:"mb-2 font-medium text-red-600 dark:text-red-400",children:["Case ",ty+1," raised an error"]}),(0,r.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap text-red-600 dark:text-red-400",children:sS.error})]}):sk?(0,r.jsx)("div",{className:"overflow-hidden rounded-md border border-border",children:(0,r.jsx)(eg,{operations:sk.operations,args:sk.args,expected:sk.expected,actual:sS?.actual,passed:sS?.passed})}):null]})]})]}),sY=e_?sB:sX,sZ=ez?(0,r.jsx)("div",{className:"p-3",children:tp?(0,r.jsx)(eL,{design:tp}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Submit, or use Evaluate, to get a review of your class design."})}):(0,r.jsx)("div",{className:"p-3",children:tg?(0,r.jsx)(eP,{verdict:tg}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Use Evaluate to have your co
5de reviewed for correctness, edge cases, efficiency and code quality. It does not affect your submissions."})}),sG=[{label:"runs",action:"code_execute"},{label:"submits",action:"code_submit"},{label:ea===eD.F.LLD?"design reviews":"evaluations",action:"code_feedback"}].filter(({action:e})=>e9[e]),sQ=!e6||te||e7||0===sG.length?null:(0,r.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-x-3 gap-y-0.5 border-b bg-muted/30 px-3 py-1 text-[11px] text-muted-foreground",children:[(0,r.jsx)("span",{children:"Today"}),sG.map(({label:e,action:t})=>{let s=e9[t],a=s.limit-s.remaining;return(0,r.jsxs)("span",{children:[(0,r.jsxs)("span",{className:0===s.remaining?"font-medium text-red-600 dark:text-red-400":"font-medium text-foreground",children:[a,"/",s.limit]})," ",e]},t)}),(0,r.jsx)(eq(),{href:"/premium",className:"ml-auto font-medium text-primary hover:underline",children:"Upgrade for higher limits"})]}),s0=e=>(0,r.jsxs)(D.tU,{value:tv,onValueChange:e=>tw(e),className:"flex h-full flex-col",children:[(0,r.jsxs)("div",{className:"flex shrink-0 flex-col-reverse items-stretch gap-1.5 border-b px-2 py-1.5 md:flex-row md:items-center md:justify-between md:gap-2 md:px-3",children:[(0,r.jsxs)(D.j7,{className:"h-10 w-max shrink-0 justify-start rounded-none bg-transparent p-0",children:[(0,r.jsxs)(D.Xi,{value:"cases",className:eX,children:[(0,r.jsx)(o.In,{icon:"solar:test-tube-linear",className:"mr-1 h-4 w-4"}),"Test cases"]}),(0,r.jsxs)(D.Xi,{value:"output",className:eX,children:["run"===to?(0,r.jsx)(c.A,{className:"mr-1 h-4 w-4 animate-spin"}):tm&&!tm.error?tm.passed===tm.totalTests?(0,r.jsx)(N.A,{className:"mr-1 h-4 w-4 text-emerald-600"}):(0,r.jsx)(y.A,{className:"mr-1 h-4 w-4 text-red-600"}):(0,r.jsx)(o.In,{icon:"solar:code-square-linear",className:"mr-1 h-4 w-4"}),"Output",tm&&!tm.error?` ${tm.passed}/${tm.totalTests}`:""]}),(0,r.jsxs)(D.Xi,{value:"design",className:eX,children:["evaluate"===to||ez&&"submit"===to?(0,r.jsx)(c.A,{className:"mr-1 h-4 w-4 animate-spin"}):(0,r.jsx)(o.In,{icon:"solar:stars-linear",className:"mr-1 h-4 w-4"}),ez?"Design review":"Feedback",ez&&tp&&!tp.unavailable?` ${tp.score}/10`:""]})]}),e&&sF]}),sQ,(0,r.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[(0,r.jsx)(D.av,{value:"cases",className:"m-0",children:sK}),(0,r.jsx)(D.av,{value:"output",className:"m-0",children:sY}),(0,r.jsx)(D.av,{value:"design",className:"m-0",children:sZ})]})]}),s1=s0(!0),s5=(0,r.jsx)(q.Lt,{open:tF,onOpenChange:tP,children:(0,r.jsxs)(q.EO,{children:[(0,r.jsxs)(q.wd,{children:[(0,r.jsx)(q.r7,{children:"Reset code?"}),(0,r.jsx)(q.$v,{children:"This will replace your current code with the original template. This action cannot be undone."})]}),(0,r.jsxs)(q.ck,{children:[(0,r.jsx)(q.Zr,{children:"Cancel"}),(0,r.jsx)(q.Rx,{onClick:so,children:"Reset"})]})]})}),s4=(0,r.jsx)(H.O,{title:"Sign in to practice",open:tD,onOpenChange:tO,zIndex:10001});if(eM){let e=e=>eK[e?.toLowerCase()]??"",t=e=>e.length>25?`${e.slice(0,25)}...`:e,s=(0,r.jsxs)("div",{className:"flex h-full flex-col",children:[sR,(0,r.jsx)("div",{className:"min-h-0 flex-1",children:s_})]});return(0,r.jsxs)("div",{className:"flex h-full flex-col","data-tts-skip":!0,children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center border-b bg-background",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-between gap-2 overflow-x-auto px-3 py-2 scrollbar-none",children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,r.jsx)("a",{href:"/",className:"mr-1 shrink-0",title:"AlgoMaster",children:(0,r.jsx)(n.default,{src:L.default,alt:"AlgoMaster",width:20,height:20})}),sE.length>0&&(0,r.jsx)("button",{onClick:()=>tW(e=>!e),className:"rounded-md p-1.5 hover:bg-muted/80",title:"Problem list",children:(0,r.jsx)(S.A,{className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"truncate text-sm font-semibold",children:eb}),(0,r.jsx)("span",{className:`text-xs font-medium capitalize ${e(ej)}`,children:ej}),tA&&(0,r.jsxs)("span",{className:"flex items-center gap-0.5 whitespace-nowrap rounded bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400",children:[(0,r.jsx)(N.A,{className:"h-3 w-3"}),"Solved"]})]}),(0,r.jsx)("div",{className:"flex shrink-0 items-center justify-center gap-1",children:sE.length>1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>sT&&Z?.(sE[s$-1].slug),disabled:!sT,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-xs hover:bg-muted/80 disabled:cursor-not-allowed disabled:opacity-30",title:"Previous problem",children:[(0,r.jsx)(C.A,{className:"h-4 w-4 shrink-0"}),(0,r.jsx)("span",{className:`hidden max-w-[100px] truncate xl:block ${sT?e(sE[s$-1].difficulty):"text-muted-foreground"}`,children:sT?t(sE[s$-1].title):""})]}),(0,r.jsx)("button",{onClick:()=>{let e;if(!(sE.length<=1)){do e=Math.floor(Math.random()*sE.length);while(e===s$);Z?.(sE[e].slug)}},className:"shrink-0 rounded-md p-1.5 hover:bg-muted/80",title:"Random problem",children:(0,r.jsx)(A.A,{className:"h-4 w-4"})}),(0,r.jsxs)("button",{onClick:()=>sM&&Z?.(sE[s$+1].slug),disabled:!sM,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-xs hover:bg-muted/80 disabled:cursor-not-allowed disabled:opacity-30",title:"Next problem",children:[(0,r.jsx)("span",{className:`hidden max-w-[100px] truncate xl:block ${sM?e(sE[s$+1].difficulty):"text-muted-foreground"}`,children:sM?t(sE[s$+1].title):""}),(0,r.jsx)(E.A,{className:"h-4 w-4 shrink-0"})]})]})}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-1",children:[es&&(0,r.jsxs)("button",{onClick:es,className:"flex items-center gap-1 rounded-md px-2 py-1.5 text-primary hover:bg-muted/80 hover:text-primary/80",title:"AlgoChat",children:[(0,r.jsx)(g.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"hidden text-xs font-medium lg:inline",children:"AlgoChat"})]}),(0,r.jsx)(ex,{menuClassName:sI}),t$&&(0,r.jsx)("button",{onClick:sj,className:"rounded-md p-1.5 hover:bg-muted/80",title:"Toggle theme",children:"dark"===eF?(0,r.jsx)($.A,{className:"h-4 w-4"}):(0,r.jsx)(T.A,{className:"h-4 w-4"})}),t$&&!!document.documentElement.requestFullscreen&&(0,r.jsx)("button",{onClick:sN,className:"hidden rounded-md p-1.5 hover:bg-muted/80 md:inline-flex",title:tK?"Exit device fullscreen":"Expand to device fullscreen",children:tK?(0,r.jsx)(M.A,{className:"h-5 w-5"}):(0,r.jsx)(z.A,{className:"h-5 w-5"})})]})]}),(0,r.jsx)("button",{onClick:G,className:"mr-2 shrink-0 rounded-md p-1.5 hover:bg-muted/80",title:"Back to problems",children:(0,r.jsx)(I.A,{className:"h-5 w-5"})})]}),(0,r.jsxs)("div",{className:"relative min-h-0 flex-1",children:[tJ&&sE.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"absolute inset-0 z-[10000]",onClick:()=>tW(!1)}),(0,r.jsxs)("div",{className:"absolute bottom-0 left-0 top-0 z-[10001] flex w-64 flex-col border-r bg-background shadow-xl",children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b px-3 py-2",children:[(0,r.jsxs)("span",{className:"text-xs font-semibold text-muted-foreground",children:["Problems (",sE.length,")"]}),(0,r.jsx)("button",{onClick:()=>tW(!1),className:"rounded p-1 hover:bg-muted",title:"Close",children:(0,r.jsx)(I.A,{className:"h-3.5 w-3.5"})})]}),(0,r.jsx)(U.i,{problems:sE,currentSlug:Y??"",onNavigate:e=>{Z?.(e),tW(!1)},solvedProblemIds:tX})]})]}),tq?(0,r.jsx)("div",{className:"h-full",children:s}):(0,r.jsxs)(V.HK,{id:`${sr}-split`,direction:st?"vertical":"horizontal",className:"h-full",children:[(0,r.jsx)(V.wV,{id:`${sr}-problem`,order:1,defaultSize:st?42:45,minSize:st?20:25,children:(0,r.jsxs)(D.tU,{value:tS,onValueChange:sz,className:"flex h-full flex-col",children:[(0,r.jsxs)(D.j7,{className:"h-10 w-full shrink-0 flex-nowrap justify-start overflow-x-auto overflow-y-hidden rounded-none border-b bg-transparent px-2 scrollbar-none",children:[(0,r.jsxs)(D.Xi,{value:"problem",className:eX,children:[(0,r.jsx)(o.In,{icon:"solar:document-text-linear",className:"mr-1 h-4 w-4"}),"Problem"]}),(0,r.jsxs)(D.Xi,{value:"solution",className:eX,children:[(0,r.jsx)(o.In,{icon:"solar:lightbulb-linear",className:"mr-1 h-4 w-4"}),"Solution"]}),(0,r.jsxs)(D.Xi,{value:"submissions",className:eX,children:[(0,r.jsx)(o.In,{icon:"solar:chart-2-linear",className:"mr-1 h-4 w-4"}),"Submissions"]}),Q?.map(e=>(0,r.jsxs)(D.Xi,{value:e.id,className:eX,children:[(0,r.jsx)(o.In,{icon:eY[e.id]??"solar:document-text-linear",className:"mr-1 h-4 w-4"}),e.label]},e.id))]}),(0,r.jsx)(D.av,{value:"problem",className:"m-0 mt-0 flex-1 overflow-hidden",children:(0,r.jsx)("div",{ref:e=>{t7.current.problem=e},className:"custom-scrollbar h-full overflow-y-auto overflow-x-hidden",children:sP})}),(0,r.jsx)(D.av,{value:"solution",className:"m-0 mt-0 flex-1 overflow-hidden",children:(0,r.jsx)("div",{ref:e=>{t7.current.solution=e},className:"custom-scrollbar h-full overflow-y-auto overflow-x-hidden",children:sO})}),(0,r.jsx)(D.av,{value:"submissions",className:"m-0 mt-0 flex-1 overflow-hidden",children:(0,r.jsx)("div",{ref:e=>{t7.current.submissions=e},className:"custom-scrollbar h-full overflow-y-auto overflow-x-hidden",children:sq})}),Q?.map(e=>(0,r.jsx)(D.av,{value:e.id,className:"m-0 mt-0 flex-1 overflow-hidden",children:(0,r.jsx)("div",{ref:t=>{t7.current[e.id]=t},className:"custom-scrollbar h-full overflow-y-auto overflow-x-hidden",children:e.content})},e.id))]})}),(0,r.jsx)(V.WM,{withHandle:!0}),(0,r.jsx)(V.wV,{id:`${sr}-work`,order:2,defaultSize:st?58:55,minSize:35,children:(0,r.jsxs)(V.HK,{id:`${sr}-work-split`,direction:"vertical",className:"h-full",children:[(0,r.jsx)(V.wV,{id:`${sr}-editor`,order:1,defaultSize:62,minSize:25,children:s}),(0,r.jsx)(V.WM,{withHandle:!0}),(0,r.jsx)(V.wV,{id:`${sr}-results`,order:2,defaultSize:38,minSize:15,children:s1})]})})]})]}),sJ,s5,s4]})}return(0,r.jsxs)("div",{className:"my-6 overflow-hidden rounded-lg border border-border bg-card","data-tts-skip":!0,children:[(0,r.jsx)("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-border px-4 py-3",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-base font-semibold",children:eb}),(0,r.jsx)(_.E,{className:`capitalize ${eB[ej]??""}`,children:ej}),tA&&(0,r.jsxs)("span",{className:"flex items-center gap-0.5 whitespace-nowrap rounded bg-emerald-100 px-1.5 py-0.5 text-[10px] font-bold leading-none text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400",children:[(0,r.jsx)(N.A,{className:"h-3 w-3"}),"Solved"]})]})}),!t&&(0,r.jsx)("div",{className:"border-b border-border",children:sP}),sR,(0,r.jsx)("div",{className:"h-[420px]",children:s_}),(0,r.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-t bg-muted/20 px-3 py-2",children:sF}),(0,r.jsx)("div",{className:"max-h-[420px] overflow-y-auto border-t",children:s0(!1)}),!t&&sO&&(0,r.jsx)("div",{className:"border-t border-border",children:sO}),sJ,s5,s4]})}let e2=e3},971382:(e,t,s)=>{s.d(t,{Ul:()=>c,bj:()=>m,ft:()=>r,hR:()=>o});let r=7,a={java:{string:"String",float:"double",int:"int",long:"long",boolean:"boolean",char:"char",void:"void"},python:{string:"str",float:"float",int:"int",long:"int",boolean:"bool",char:"str",void:"None"},cpp:{string:"std::string",float:"double",int:"int",long:"long long",boolean:"bool",char:"char",void:"void"},csharp:{string:"string",float:"double",int:"int",long:"long",boolean:"bool",char:"char",void:"void"},go:{string:"string",float:"float64",int:"int",long:"int64",boolean:"bool",char:"byte",void:""},javascript:{string:"string",float:"number",int:"number",long:"number",boolean:"boolean",char:"string",void:"void"},typescript:{string:"string",float:"number",int:"number",long:"number",boolean:"boolean",char:"string",void:"void"}};function l(e,t){if(!t)return e;let s=a[t];return s?s[e]??e:e}function n(e,t){switch(t){case"python":return`list[${e}
5]`;case"go":return`[]${e}`;case"cpp":return`std::vector<${e}>`;case"csharp":return`List<${e}>`;default:return`${e}[]`}}function d(e,t,s){if(!t)return l(e,s);let r=l(t,s);return"array"===e?n(r,s):"matrix"===e?n(n(r,s),s):l(e,s)}function i(e=[],t){return e.map(e=>`${e.paramName}: ${d(e.paramType,e.elementType,t)}`).join(", ")}function o(e,t){let s=d(e.returnType,e.returnElementType,t);return`${e.methodName}(${i(e.params,t)})${s?`: ${s}`:""}`}function c(e,t){return`${e.className}(${i(e.constructorParams,t)})`}function m(e,t,s){let r,a,l;try{r=JSON.parse(e),a=JSON.parse(t),l=JSON.parse(s)}catch{return null}return Array.isArray(r)&&Array.isArray(a)&&Array.isArray(l)&&r.length===a.length&&r.length===l.length?r.map((e,t)=>{let s=a[t],r=(Array.isArray(s)?s:[s]).map(e=>JSON.stringify(e)).join(", ");return{call:0===t?`new ${String(e)}(${r})`:`${String(e)}(${r})`,result:JSON.stringify(l[t]),isConstructor:0===t}}):null}}}]);

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.