Spaces:
Running
Running
feat: better sandbox test runner evaluation and LeetCode parsing support
Browse files- algospaced-ui/dist/assets/{GitHubSyncWindow-BDkliP2c.js → GitHubSyncWindow-CPAEU3Yo.js} +1 -1
- algospaced-ui/dist/assets/{JourneyPath-BePpfjT_.js → JourneyPath-BOxOnYvR.js} +1 -1
- algospaced-ui/dist/assets/{PrincessChamber-TQv-dX2B.js → PrincessChamber-DMbQcfRj.js} +1 -1
- algospaced-ui/dist/assets/{PythonChallenge-crvxTeXU.js → PythonChallenge-O0le9Y-n.js} +1 -1
- algospaced-ui/dist/assets/{ReviewQueue-COA1o2bS.js → ReviewQueue-LqZVd9BQ.js} +2 -2
- algospaced-ui/dist/assets/{Settings-1J_m2sOB.js → Settings-DCDc0IAI.js} +1 -1
- algospaced-ui/dist/assets/{confetti.module-Cj_6Odin.js → confetti.module-CexOBsNI.js} +1 -1
- algospaced-ui/dist/assets/{external-link-2pRbXZFT.js → external-link-D_lyOHrp.js} +1 -1
- algospaced-ui/dist/assets/{eye-DiDlGDv5.js → eye-DYmzmFTZ.js} +1 -1
- algospaced-ui/dist/assets/{githubSyncService-D3lo509P.js → githubSyncService-CjQshwem.js} +1 -1
- algospaced-ui/dist/assets/{index-BjHs_aR9.js → index-CPCBFJ0E.js} +0 -0
- algospaced-ui/dist/assets/{info-DoO2J6qy.js → info-CZH6IVe4.js} +1 -1
- algospaced-ui/dist/assets/{save-_CuJzOt0.js → save-DFA_q4GT.js} +1 -1
- algospaced-ui/dist/index.html +1 -1
- algospaced-ui/dist/sw.js +1 -1
- algospaced-ui/src/data/neetcode150Data.ts +4 -4
- algospaced-ui/src/hooks/useSandboxRunner.ts +4 -1
- algospaced-ui/src/services/reviewService.ts +6 -2
- routers/reviews.py +11 -2
- sandbox.py +350 -40
- tests/unit/test_sandbox_advanced.py +198 -0
algospaced-ui/dist/assets/{GitHubSyncWindow-BDkliP2c.js → GitHubSyncWindow-CPAEU3Yo.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{a as e,c as t,t as n}from"./jsx-runtime-j9uSgrFF.js";import{n as r,r as i,t as a}from"./eye-DiDlGDv5.js";import{t as o}from"./external-link-2pRbXZFT.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,t as h,u as g}from"./githubSyncService-D3lo509P.js";import{B as _,H as v,I as y,M as b,S as x}from"./index-BjHs_aR9.js";var S=v(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),C=v(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),w=v(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),T=v(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),E=t(e(),1),D=n(),O=({onClose:e,currentProblem:t})=>{let[n,v]=(0,E.useState)(()=>p()),[O,k]=(0,E.useState)(()=>l()),[A,j]=(0,E.useState)(``),[M,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(!1),[I,L]=(0,E.useState)(!1),[R,z]=(0,E.useState)(!1),[B,V]=(0,E.useState)(!1),[H,U]=(0,E.useState)(!1),[W,G]=(0,E.useState)(!1),[K,q]=(0,E.useState)(null),J=!!(n.token&&(n.username||O?.login));(0,E.useEffect)(()=>{n.token&&!O&&u(n.token).then(e=>{e.valid&&e.user&&(k(e.user),m({username:e.user.login},e.user))})},[n.token,O]);let Y=async()=>{L(!0),q(null);try{let{token:e,user:t}=await d();k(t);let n=p();v(n);try{await s(e,n.repoName,n.isPrivate)}catch{}q({type:`success`,text:`Connected successfully to GitHub as @${t.login}!`,linkUrl:t.html_url})}catch(e){q({type:`error`,text:e.message||`GitHub OAuth authorization failed.`})}finally{L(!1)}},X=async()=>{let e=A.trim();if(!e){q({type:`error`,text:`Please enter a valid GitHub token.`});return}z(!0),q(null);try{let t=await u(e);if(t.valid&&t.user){k(t.user),m({token:e,username:t.user.login},t.user),v(p());try{await s(e,n.repoName,n.isPrivate)}catch{}j(``),N(!1),q({type:`success`,text:`Verified and connected as @${t.user.login}!`,linkUrl:t.user.html_url})}else q({type:`error`,text:t.error||`Token verification failed. Please check permissions.`})}catch(e){q({type:`error`,text:e.message||`Failed to connect with token.`})}finally{z(!1)}},Z=async()=>{if(n.token){V(!0),q(null);try{let e=await s(n.token,n.repoName,n.isPrivate);m({repoName:n.repoName}),q({type:`success`,text:e.created?`Created new repository ${e.full_name} on GitHub!`:`Connected to existing repository ${e.full_name}!`,linkUrl:e.html_url})}catch(e){q({type:`error`,text:e.message||`Failed to initialize repository.`})}finally{V(!1)}}},Q=async()=>{if(n.token&&n.repoName){U(!0),q(null);try{let e=await c(n.token,n.repoName,n.branch);q({type:`success`,text:e.message||`Synced ${e.synced_count} solutions to ${n.repoName}!`,linkUrl:e.repo_url})}catch(e){q({type:`error`,text:e.message||`Batch sync failed.`})}finally{U(!1)}}},$=async()=>{if(!t||!n.token)return;let e=t.code||t.reference_code;if(!e||!e.trim()){q({type:`error`,text:`Current problem has no code to push. Write or save code first!`});return}G(!0),q(null);try{let r={token:n.token,repo:n.repoName,branch:n.branch,problem_number:t.problem_number,problem_name:t.name||`Algorithm Problem`,difficulty:t.difficulty||`Medium`,pattern:t.pattern||`Algorithms`,optimal_time:t.optimal_time||`O(N)`,optimal_space:t.optimal_space||`O(1)`,description:t.description||``,code:e},i=await f(r);q({type:`success`,text:`Committed ${t.name} to GitHub!`,linkUrl:i.html_url})}catch(e){q({type:`error`,text:e.message||`Failed to push current solution.`})}finally{G(!1)}},ee=e=>{m({autoCommit:e}),v(t=>({...t,autoCommit:e})),q({type:`info`,text:e?`Auto-commit ENABLED: Solutions will sync automatically on submission.`:`Auto-commit DISABLED: You can still push manually any time.`})};return(0,D.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-4 sm:p-6 flex flex-col justify-between select-none font-sans text-ink-black overflow-y-auto custom-scrollbar`,children:[(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between border-b-[3px] border-ink-black pb-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`w-9 h-9 bg-ink-black rounded border-2 border-ink-black flex items-center justify-center text-white shadow-[2px_2px_0px_0px_rgba(0,0,0,0.15)]`,children:(0,D.jsx)(`svg`,{className:`w-5 h-5 fill-white`,viewBox:`0 0 19 19`,children:(0,D.jsx)(`path`,{fillRule:`evenodd`,d:`M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844`,clipRule:`evenodd`})})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`font-headline-md font-bold text-sm uppercase m-0 flex items-center gap-2`,children:`GitHub Solutions Station`}),(0,D.jsx)(`p`,{className:`text-[11px] text-trash-gray font-semibold m-0`,children:`Sync algorithm solutions & auto-commit to your personal portfolio repository`})]})]}),(0,D.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,D.jsx)(`span`,{className:`px-2.5 py-1 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black ${J?`bg-emerald-300 text-emerald-950`:`bg-amber-200 text-amber-950`}`,children:J?`CONNECTED`:`DISCONNECTED`})})]}),J?(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O?.avatar_url?(0,D.jsx)(`img`,{src:O.avatar_url,alt:O.login,className:`w-10 h-10 rounded-full border-2 border-ink-black shadow-[1px_1px_0px_0px_#1E293B]`}):(0,D.jsx)(`div`,{className:`w-10 h-10 bg-slate-200 rounded-full border-2 border-ink-black flex items-center justify-center font-bold`,children:`GH`}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`font-bold text-xs text-ink-black`,children:O?.name||O?.login||n.username}),(0,D.jsxs)(`span`,{className:`text-[10px] text-trash-gray font-mono`,children:[`(@`,O?.login||n.username,`)`]})]}),(0,D.jsxs)(`div`,{className:`text-[11px] text-slate-600 font-medium flex items-center gap-1 mt-0.5`,children:[(0,D.jsx)(g,{className:`w-3.5 h-3.5 text-blue-600 shrink-0`}),(0,D.jsxs)(`span`,{className:`font-semibold text-ink-black`,children:[n.username||O?.login,`/`,n.repoName]}),(0,D.jsxs)(`span`,{className:`text-slate-400`,children:[`(`,n.branch,`)`]})]})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsxs)(`a`,{href:`https://github.com/${n.username||O?.login}/${n.repoName}`,target:`_blank`,rel:`noopener noreferrer`,className:`px-3 py-1.5 bg-slate-50 hover:bg-slate-100 border-2 border-ink-black text-xs font-bold text-ink-black flex items-center gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none no-underline cursor-pointer`,children:[(0,D.jsx)(o,{className:`w-3.5 h-3.5`}),(0,D.jsx)(`span`,{children:`View Repo`})]}),(0,D.jsxs)(`button`,{onClick:()=>{window.confirm(`Disconnect your GitHub account from AlgoSpaced?`)&&(h(),v(p()),k(null),q({type:`info`,text:`Disconnected from GitHub.`}))},className:`px-3 py-1.5 bg-white hover:bg-rose-50 border-2 border-rose-300 text-rose-700 text-xs font-bold flex items-center gap-1 cursor-pointer transition-all`,title:`Disconnect GitHub`,children:[(0,D.jsx)(T,{className:`w-3 h-3`}),(0,D.jsx)(`span`,{children:`Disconnect`})]})]})]}),(0,D.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2 border-slate-200`,children:[(0,D.jsxs)(`span`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5`,children:[(0,D.jsx)(C,{className:`w-3.5 h-3.5 text-ink-black`}),`Target Repository & Branch`]}),(0,D.jsxs)(`button`,{onClick:Z,disabled:B,className:`px-2.5 py-1 bg-yellow-100 hover:bg-yellow-200 border border-ink-black text-[10px] font-bold text-ink-black flex items-center gap-1 cursor-pointer disabled:opacity-50 shadow-[1px_1px_0px_0px_#1E293B]`,children:[B?(0,D.jsx)(b,{className:`w-3 h-3 animate-spin`}):(0,D.jsx)(_,{className:`w-3 h-3 text-emerald-700`}),(0,D.jsx)(`span`,{children:`Verify / Init Repo`})]})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`label`,{className:`block text-[10px] font-bold text-trash-gray uppercase mb-1`,children:`Repository Name`}),(0,D.jsx)(`input`,{type:`text`,value:n.repoName,onChange:e=>{let t=e.target.value;v(e=>({...e,repoName:t})),m({repoName:t})},placeholder:`algospaced-solutions`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`label`,{className:`block text-[10px] font-bold text-trash-gray uppercase mb-1`,children:`Branch Name`}),(0,D.jsx)(`input`,{type:`text`,value:n.branch,onChange:e=>{let t=e.target.value;v(e=>({...e,branch:t})),m({branch:t})},placeholder:`main`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white`})]})]}),(0,D.jsxs)(`div`,{className:`pt-2 border-t border-slate-100 flex items-center justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,D.jsx)(x,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,D.jsx)(`span`,{className:`text-[10px] text-trash-gray font-medium`,children:`Automatically push code to your repo when grading a review card or saving a solution.`})]})]}),(0,D.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer select-none`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:n.autoCommit,onChange:e=>ee(e.target.checked),className:`sr-only peer`}),(0,D.jsx)(`div`,{className:`w-9 h-5 bg-slate-300 peer-focus:outline-none border-2 border-ink-black rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-2 after:border-ink-black after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-emerald-500`})]})]})]}),(0,D.jsxs)(`div`,{className:`bg-[#fffdf0] border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,D.jsxs)(`span`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5`,children:[(0,D.jsx)(S,{className:`w-3.5 h-3.5 text-ink-black`}),`Manual Push & Sync Operations`]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,D.jsxs)(`button`,{onClick:$,disabled:W||!t,className:`p-3 bg-white hover:bg-emerald-50 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,D.jsxs)(`span`,{className:`font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5`,children:[W?(0,D.jsx)(b,{className:`w-3.5 h-3.5 animate-spin text-emerald-600`}):(0,D.jsx)(w,{className:`w-3.5 h-3.5 text-emerald-600`}),`Push Active Problem`]}),t?.problem_number&&(0,D.jsxs)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 bg-emerald-100 text-emerald-800 rounded font-bold`,children:[`#`,t.problem_number]})]}),(0,D.jsx)(`span`,{className:`text-[10px] text-slate-500 line-clamp-1`,children:t?.name||`No active problem open in review`})]}),(0,D.jsxs)(`button`,{onClick:Q,disabled:H,className:`p-3 bg-[#ffe24c] hover:bg-yellow-300 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,D.jsxs)(`span`,{className:`font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5`,children:[H?(0,D.jsx)(b,{className:`w-3.5 h-3.5 animate-spin text-ink-black`}):(0,D.jsx)(g,{className:`w-3.5 h-3.5 text-ink-black`}),`Sync Entire Library`]}),(0,D.jsx)(`span`,{className:`text-[8px] font-arcade uppercase font-bold bg-white px-1.5 py-0.5 border border-ink-black`,children:`BATCH`})]}),(0,D.jsx)(`span`,{className:`text-[10px] text-slate-700`,children:`Push all solved problems + generate root README index`})]})]})]})]}):(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-5 sm:p-6 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] text-center space-y-4`,children:[(0,D.jsxs)(`div`,{className:`max-w-md mx-auto space-y-2`,children:[(0,D.jsx)(`h4`,{className:`font-headline-md font-bold text-sm uppercase text-ink-black m-0`,children:`Connect Your GitHub Account`}),(0,D.jsx)(`p`,{className:`text-xs text-trash-gray font-medium leading-relaxed m-0`,children:`Sync all your DSA solutions directly to your GitHub repository. Commit automatically on review completion or push anytime with 1-click.`})]}),(0,D.jsxs)(`div`,{className:`pt-2 flex flex-col items-center`,children:[(0,D.jsx)(`button`,{onClick:Y,disabled:I,className:`w-full sm:w-auto px-6 py-3 bg-[#24292e] hover:bg-black text-white font-bold text-xs uppercase font-headline-md border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center justify-center gap-2.5 transition-all cursor-pointer disabled:opacity-50`,children:I?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`w-4 h-4 animate-spin text-yellow-300`}),(0,D.jsx)(`span`,{children:`AUTHORIZING WITH GITHUB...`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`svg`,{className:`w-4 h-4 fill-white`,viewBox:`0 0 19 19`,children:(0,D.jsx)(`path`,{fillRule:`evenodd`,d:`M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844`,clipRule:`evenodd`})}),(0,D.jsx)(`span`,{children:`CONNECT WITH GITHUB (1-CLICK)`})]})}),(0,D.jsxs)(`span`,{className:`text-[10px] text-trash-gray mt-2`,children:[`Direct 1-click OAuth (works for guest and signed-in users). Requests `,(0,D.jsx)(`code`,{children:`repo`}),` access.`]})]})]}),(0,D.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)]`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>N(!M),className:`w-full flex items-center justify-between text-left text-xs font-bold text-ink-black font-headline-md uppercase cursor-pointer bg-transparent border-0 p-0`,children:[(0,D.jsx)(`span`,{children:`Or connect via Personal Access Token (PAT)`}),(0,D.jsx)(`span`,{className:`text-slate-500`,children:M?`▲ Hide`:`▼ Show`})]}),M&&(0,D.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-slate-200 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,D.jsx)(`span`,{className:`font-semibold text-slate-700`,children:`Personal Access Token:`}),(0,D.jsxs)(`a`,{href:`https://github.com/settings/tokens/new?scopes=repo&description=AlgoSpaced%20Solutions%20Sync`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 hover:text-blue-800 font-bold flex items-center gap-1 no-underline text-[10px]`,children:[(0,D.jsx)(`span`,{children:`Generate token with repo scope`}),(0,D.jsx)(o,{className:`w-3 h-3`})]})]}),(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(`input`,{type:P?`text`:`password`,value:A,onChange:e=>j(e.target.value),placeholder:`ghp_... or github_pat_...`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-2 pl-3 pr-9 text-xs font-mono focus:outline-none focus:bg-white`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>F(!P),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-ink-black cursor-pointer bg-transparent border-0 p-1`,children:P?(0,D.jsx)(r,{className:`w-3.5 h-3.5`}):(0,D.jsx)(a,{className:`w-3.5 h-3.5`})})]}),(0,D.jsx)(`button`,{onClick:X,disabled:R||!A.trim(),className:`px-4 py-2 bg-[#ffe24c] hover:bg-yellow-300 text-ink-black font-bold text-xs uppercase border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer disabled:opacity-50 flex items-center gap-1.5`,children:R?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`w-3.5 h-3.5 animate-spin`}),(0,D.jsx)(`span`,{children:`VERIFYING TOKEN...`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(_,{className:`w-3.5 h-3.5`}),(0,D.jsx)(`span`,{children:`SAVE & CONNECT TOKEN`})]})})]})]})]}),K&&(0,D.jsxs)(`div`,{className:`p-3 border-[2px] border-ink-black text-xs font-semibold rounded flex items-center justify-between gap-2 ${K.type===`success`?`bg-emerald-100 text-emerald-900 border-emerald-600`:K.type===`error`?`bg-rose-100 text-rose-900 border-rose-600`:`bg-sky-100 text-sky-900 border-sky-600`}`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[K.type===`success`?(0,D.jsx)(y,{className:`w-4 h-4 shrink-0`}):(0,D.jsx)(i,{className:`w-4 h-4 shrink-0`}),(0,D.jsx)(`span`,{children:K.text})]}),K.linkUrl&&(0,D.jsxs)(`a`,{href:K.linkUrl,target:`_blank`,rel:`noopener noreferrer`,className:`px-2 py-0.5 bg-white border border-ink-black text-[10px] font-bold text-ink-black hover:bg-slate-50 no-underline shrink-0 flex items-center gap-1`,children:[(0,D.jsx)(`span`,{children:`Open`}),(0,D.jsx)(o,{className:`w-3 h-3`})]})]})]}),(0,D.jsx)(`div`,{className:`pt-4 border-t border-slate-300 flex justify-end`,children:(0,D.jsx)(`button`,{onClick:e,className:`px-4 py-2 bg-white hover:bg-slate-100 border-[2px] border-ink-black text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer uppercase`,children:`CLOSE`})})]})};export{O as GitHubSyncWindow,O as default};
|
|
|
|
| 1 |
+
import{a as e,c as t,t as n}from"./jsx-runtime-j9uSgrFF.js";import{n as r,r as i,t as a}from"./eye-DYmzmFTZ.js";import{t as o}from"./external-link-D_lyOHrp.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,t as h,u as g}from"./githubSyncService-CjQshwem.js";import{B as _,H as v,I as y,M as b,S as x}from"./index-CPCBFJ0E.js";var S=v(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),C=v(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),w=v(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),T=v(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),E=t(e(),1),D=n(),O=({onClose:e,currentProblem:t})=>{let[n,v]=(0,E.useState)(()=>p()),[O,k]=(0,E.useState)(()=>l()),[A,j]=(0,E.useState)(``),[M,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(!1),[I,L]=(0,E.useState)(!1),[R,z]=(0,E.useState)(!1),[B,V]=(0,E.useState)(!1),[H,U]=(0,E.useState)(!1),[W,G]=(0,E.useState)(!1),[K,q]=(0,E.useState)(null),J=!!(n.token&&(n.username||O?.login));(0,E.useEffect)(()=>{n.token&&!O&&u(n.token).then(e=>{e.valid&&e.user&&(k(e.user),m({username:e.user.login},e.user))})},[n.token,O]);let Y=async()=>{L(!0),q(null);try{let{token:e,user:t}=await d();k(t);let n=p();v(n);try{await s(e,n.repoName,n.isPrivate)}catch{}q({type:`success`,text:`Connected successfully to GitHub as @${t.login}!`,linkUrl:t.html_url})}catch(e){q({type:`error`,text:e.message||`GitHub OAuth authorization failed.`})}finally{L(!1)}},X=async()=>{let e=A.trim();if(!e){q({type:`error`,text:`Please enter a valid GitHub token.`});return}z(!0),q(null);try{let t=await u(e);if(t.valid&&t.user){k(t.user),m({token:e,username:t.user.login},t.user),v(p());try{await s(e,n.repoName,n.isPrivate)}catch{}j(``),N(!1),q({type:`success`,text:`Verified and connected as @${t.user.login}!`,linkUrl:t.user.html_url})}else q({type:`error`,text:t.error||`Token verification failed. Please check permissions.`})}catch(e){q({type:`error`,text:e.message||`Failed to connect with token.`})}finally{z(!1)}},Z=async()=>{if(n.token){V(!0),q(null);try{let e=await s(n.token,n.repoName,n.isPrivate);m({repoName:n.repoName}),q({type:`success`,text:e.created?`Created new repository ${e.full_name} on GitHub!`:`Connected to existing repository ${e.full_name}!`,linkUrl:e.html_url})}catch(e){q({type:`error`,text:e.message||`Failed to initialize repository.`})}finally{V(!1)}}},Q=async()=>{if(n.token&&n.repoName){U(!0),q(null);try{let e=await c(n.token,n.repoName,n.branch);q({type:`success`,text:e.message||`Synced ${e.synced_count} solutions to ${n.repoName}!`,linkUrl:e.repo_url})}catch(e){q({type:`error`,text:e.message||`Batch sync failed.`})}finally{U(!1)}}},$=async()=>{if(!t||!n.token)return;let e=t.code||t.reference_code;if(!e||!e.trim()){q({type:`error`,text:`Current problem has no code to push. Write or save code first!`});return}G(!0),q(null);try{let r={token:n.token,repo:n.repoName,branch:n.branch,problem_number:t.problem_number,problem_name:t.name||`Algorithm Problem`,difficulty:t.difficulty||`Medium`,pattern:t.pattern||`Algorithms`,optimal_time:t.optimal_time||`O(N)`,optimal_space:t.optimal_space||`O(1)`,description:t.description||``,code:e},i=await f(r);q({type:`success`,text:`Committed ${t.name} to GitHub!`,linkUrl:i.html_url})}catch(e){q({type:`error`,text:e.message||`Failed to push current solution.`})}finally{G(!1)}},ee=e=>{m({autoCommit:e}),v(t=>({...t,autoCommit:e})),q({type:`info`,text:e?`Auto-commit ENABLED: Solutions will sync automatically on submission.`:`Auto-commit DISABLED: You can still push manually any time.`})};return(0,D.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-4 sm:p-6 flex flex-col justify-between select-none font-sans text-ink-black overflow-y-auto custom-scrollbar`,children:[(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between border-b-[3px] border-ink-black pb-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`w-9 h-9 bg-ink-black rounded border-2 border-ink-black flex items-center justify-center text-white shadow-[2px_2px_0px_0px_rgba(0,0,0,0.15)]`,children:(0,D.jsx)(`svg`,{className:`w-5 h-5 fill-white`,viewBox:`0 0 19 19`,children:(0,D.jsx)(`path`,{fillRule:`evenodd`,d:`M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844`,clipRule:`evenodd`})})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`font-headline-md font-bold text-sm uppercase m-0 flex items-center gap-2`,children:`GitHub Solutions Station`}),(0,D.jsx)(`p`,{className:`text-[11px] text-trash-gray font-semibold m-0`,children:`Sync algorithm solutions & auto-commit to your personal portfolio repository`})]})]}),(0,D.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,D.jsx)(`span`,{className:`px-2.5 py-1 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black ${J?`bg-emerald-300 text-emerald-950`:`bg-amber-200 text-amber-950`}`,children:J?`CONNECTED`:`DISCONNECTED`})})]}),J?(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O?.avatar_url?(0,D.jsx)(`img`,{src:O.avatar_url,alt:O.login,className:`w-10 h-10 rounded-full border-2 border-ink-black shadow-[1px_1px_0px_0px_#1E293B]`}):(0,D.jsx)(`div`,{className:`w-10 h-10 bg-slate-200 rounded-full border-2 border-ink-black flex items-center justify-center font-bold`,children:`GH`}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`font-bold text-xs text-ink-black`,children:O?.name||O?.login||n.username}),(0,D.jsxs)(`span`,{className:`text-[10px] text-trash-gray font-mono`,children:[`(@`,O?.login||n.username,`)`]})]}),(0,D.jsxs)(`div`,{className:`text-[11px] text-slate-600 font-medium flex items-center gap-1 mt-0.5`,children:[(0,D.jsx)(g,{className:`w-3.5 h-3.5 text-blue-600 shrink-0`}),(0,D.jsxs)(`span`,{className:`font-semibold text-ink-black`,children:[n.username||O?.login,`/`,n.repoName]}),(0,D.jsxs)(`span`,{className:`text-slate-400`,children:[`(`,n.branch,`)`]})]})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsxs)(`a`,{href:`https://github.com/${n.username||O?.login}/${n.repoName}`,target:`_blank`,rel:`noopener noreferrer`,className:`px-3 py-1.5 bg-slate-50 hover:bg-slate-100 border-2 border-ink-black text-xs font-bold text-ink-black flex items-center gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none no-underline cursor-pointer`,children:[(0,D.jsx)(o,{className:`w-3.5 h-3.5`}),(0,D.jsx)(`span`,{children:`View Repo`})]}),(0,D.jsxs)(`button`,{onClick:()=>{window.confirm(`Disconnect your GitHub account from AlgoSpaced?`)&&(h(),v(p()),k(null),q({type:`info`,text:`Disconnected from GitHub.`}))},className:`px-3 py-1.5 bg-white hover:bg-rose-50 border-2 border-rose-300 text-rose-700 text-xs font-bold flex items-center gap-1 cursor-pointer transition-all`,title:`Disconnect GitHub`,children:[(0,D.jsx)(T,{className:`w-3 h-3`}),(0,D.jsx)(`span`,{children:`Disconnect`})]})]})]}),(0,D.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2 border-slate-200`,children:[(0,D.jsxs)(`span`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5`,children:[(0,D.jsx)(C,{className:`w-3.5 h-3.5 text-ink-black`}),`Target Repository & Branch`]}),(0,D.jsxs)(`button`,{onClick:Z,disabled:B,className:`px-2.5 py-1 bg-yellow-100 hover:bg-yellow-200 border border-ink-black text-[10px] font-bold text-ink-black flex items-center gap-1 cursor-pointer disabled:opacity-50 shadow-[1px_1px_0px_0px_#1E293B]`,children:[B?(0,D.jsx)(b,{className:`w-3 h-3 animate-spin`}):(0,D.jsx)(_,{className:`w-3 h-3 text-emerald-700`}),(0,D.jsx)(`span`,{children:`Verify / Init Repo`})]})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`label`,{className:`block text-[10px] font-bold text-trash-gray uppercase mb-1`,children:`Repository Name`}),(0,D.jsx)(`input`,{type:`text`,value:n.repoName,onChange:e=>{let t=e.target.value;v(e=>({...e,repoName:t})),m({repoName:t})},placeholder:`algospaced-solutions`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`label`,{className:`block text-[10px] font-bold text-trash-gray uppercase mb-1`,children:`Branch Name`}),(0,D.jsx)(`input`,{type:`text`,value:n.branch,onChange:e=>{let t=e.target.value;v(e=>({...e,branch:t})),m({branch:t})},placeholder:`main`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-1.5 px-2.5 text-xs font-mono font-medium focus:outline-none focus:bg-white`})]})]}),(0,D.jsxs)(`div`,{className:`pt-2 border-t border-slate-100 flex items-center justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,D.jsx)(x,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,D.jsx)(`span`,{className:`text-[10px] text-trash-gray font-medium`,children:`Automatically push code to your repo when grading a review card or saving a solution.`})]})]}),(0,D.jsxs)(`label`,{className:`relative inline-flex items-center cursor-pointer select-none`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:n.autoCommit,onChange:e=>ee(e.target.checked),className:`sr-only peer`}),(0,D.jsx)(`div`,{className:`w-9 h-5 bg-slate-300 peer-focus:outline-none border-2 border-ink-black rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-2 after:border-ink-black after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-emerald-500`})]})]})]}),(0,D.jsxs)(`div`,{className:`bg-[#fffdf0] border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,D.jsxs)(`span`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black flex items-center gap-1.5`,children:[(0,D.jsx)(S,{className:`w-3.5 h-3.5 text-ink-black`}),`Manual Push & Sync Operations`]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,D.jsxs)(`button`,{onClick:$,disabled:W||!t,className:`p-3 bg-white hover:bg-emerald-50 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,D.jsxs)(`span`,{className:`font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5`,children:[W?(0,D.jsx)(b,{className:`w-3.5 h-3.5 animate-spin text-emerald-600`}):(0,D.jsx)(w,{className:`w-3.5 h-3.5 text-emerald-600`}),`Push Active Problem`]}),t?.problem_number&&(0,D.jsxs)(`span`,{className:`text-[9px] font-mono px-1.5 py-0.5 bg-emerald-100 text-emerald-800 rounded font-bold`,children:[`#`,t.problem_number]})]}),(0,D.jsx)(`span`,{className:`text-[10px] text-slate-500 line-clamp-1`,children:t?.name||`No active problem open in review`})]}),(0,D.jsxs)(`button`,{onClick:Q,disabled:H,className:`p-3 bg-[#ffe24c] hover:bg-yellow-300 border-2 border-ink-black text-left flex flex-col justify-between gap-1 shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer transition-all disabled:opacity-50`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,D.jsxs)(`span`,{className:`font-bold text-xs text-ink-black font-headline-md flex items-center gap-1.5`,children:[H?(0,D.jsx)(b,{className:`w-3.5 h-3.5 animate-spin text-ink-black`}):(0,D.jsx)(g,{className:`w-3.5 h-3.5 text-ink-black`}),`Sync Entire Library`]}),(0,D.jsx)(`span`,{className:`text-[8px] font-arcade uppercase font-bold bg-white px-1.5 py-0.5 border border-ink-black`,children:`BATCH`})]}),(0,D.jsx)(`span`,{className:`text-[10px] text-slate-700`,children:`Push all solved problems + generate root README index`})]})]})]})]}):(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-5 sm:p-6 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] text-center space-y-4`,children:[(0,D.jsxs)(`div`,{className:`max-w-md mx-auto space-y-2`,children:[(0,D.jsx)(`h4`,{className:`font-headline-md font-bold text-sm uppercase text-ink-black m-0`,children:`Connect Your GitHub Account`}),(0,D.jsx)(`p`,{className:`text-xs text-trash-gray font-medium leading-relaxed m-0`,children:`Sync all your DSA solutions directly to your GitHub repository. Commit automatically on review completion or push anytime with 1-click.`})]}),(0,D.jsxs)(`div`,{className:`pt-2 flex flex-col items-center`,children:[(0,D.jsx)(`button`,{onClick:Y,disabled:I,className:`w-full sm:w-auto px-6 py-3 bg-[#24292e] hover:bg-black text-white font-bold text-xs uppercase font-headline-md border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none flex items-center justify-center gap-2.5 transition-all cursor-pointer disabled:opacity-50`,children:I?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`w-4 h-4 animate-spin text-yellow-300`}),(0,D.jsx)(`span`,{children:`AUTHORIZING WITH GITHUB...`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`svg`,{className:`w-4 h-4 fill-white`,viewBox:`0 0 19 19`,children:(0,D.jsx)(`path`,{fillRule:`evenodd`,d:`M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844`,clipRule:`evenodd`})}),(0,D.jsx)(`span`,{children:`CONNECT WITH GITHUB (1-CLICK)`})]})}),(0,D.jsxs)(`span`,{className:`text-[10px] text-trash-gray mt-2`,children:[`Direct 1-click OAuth (works for guest and signed-in users). Requests `,(0,D.jsx)(`code`,{children:`repo`}),` access.`]})]})]}),(0,D.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)]`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>N(!M),className:`w-full flex items-center justify-between text-left text-xs font-bold text-ink-black font-headline-md uppercase cursor-pointer bg-transparent border-0 p-0`,children:[(0,D.jsx)(`span`,{children:`Or connect via Personal Access Token (PAT)`}),(0,D.jsx)(`span`,{className:`text-slate-500`,children:M?`▲ Hide`:`▼ Show`})]}),M&&(0,D.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-slate-200 space-y-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,D.jsx)(`span`,{className:`font-semibold text-slate-700`,children:`Personal Access Token:`}),(0,D.jsxs)(`a`,{href:`https://github.com/settings/tokens/new?scopes=repo&description=AlgoSpaced%20Solutions%20Sync`,target:`_blank`,rel:`noopener noreferrer`,className:`text-blue-600 hover:text-blue-800 font-bold flex items-center gap-1 no-underline text-[10px]`,children:[(0,D.jsx)(`span`,{children:`Generate token with repo scope`}),(0,D.jsx)(o,{className:`w-3 h-3`})]})]}),(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(`input`,{type:P?`text`:`password`,value:A,onChange:e=>j(e.target.value),placeholder:`ghp_... or github_pat_...`,className:`w-full bg-slate-50 border-2 border-ink-black rounded py-2 pl-3 pr-9 text-xs font-mono focus:outline-none focus:bg-white`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>F(!P),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-ink-black cursor-pointer bg-transparent border-0 p-1`,children:P?(0,D.jsx)(r,{className:`w-3.5 h-3.5`}):(0,D.jsx)(a,{className:`w-3.5 h-3.5`})})]}),(0,D.jsx)(`button`,{onClick:X,disabled:R||!A.trim(),className:`px-4 py-2 bg-[#ffe24c] hover:bg-yellow-300 text-ink-black font-bold text-xs uppercase border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer disabled:opacity-50 flex items-center gap-1.5`,children:R?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`w-3.5 h-3.5 animate-spin`}),(0,D.jsx)(`span`,{children:`VERIFYING TOKEN...`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(_,{className:`w-3.5 h-3.5`}),(0,D.jsx)(`span`,{children:`SAVE & CONNECT TOKEN`})]})})]})]})]}),K&&(0,D.jsxs)(`div`,{className:`p-3 border-[2px] border-ink-black text-xs font-semibold rounded flex items-center justify-between gap-2 ${K.type===`success`?`bg-emerald-100 text-emerald-900 border-emerald-600`:K.type===`error`?`bg-rose-100 text-rose-900 border-rose-600`:`bg-sky-100 text-sky-900 border-sky-600`}`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[K.type===`success`?(0,D.jsx)(y,{className:`w-4 h-4 shrink-0`}):(0,D.jsx)(i,{className:`w-4 h-4 shrink-0`}),(0,D.jsx)(`span`,{children:K.text})]}),K.linkUrl&&(0,D.jsxs)(`a`,{href:K.linkUrl,target:`_blank`,rel:`noopener noreferrer`,className:`px-2 py-0.5 bg-white border border-ink-black text-[10px] font-bold text-ink-black hover:bg-slate-50 no-underline shrink-0 flex items-center gap-1`,children:[(0,D.jsx)(`span`,{children:`Open`}),(0,D.jsx)(o,{className:`w-3 h-3`})]})]})]}),(0,D.jsx)(`div`,{className:`pt-4 border-t border-slate-300 flex justify-end`,children:(0,D.jsx)(`button`,{onClick:e,className:`px-4 py-2 bg-white hover:bg-slate-100 border-[2px] border-ink-black text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer uppercase`,children:`CLOSE`})})]})};export{O as GitHubSyncWindow,O as default};
|
algospaced-ui/dist/assets/{JourneyPath-BePpfjT_.js → JourneyPath-BOxOnYvR.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{a as e,c as t,i as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import{i,n as a,r as o,t as s}from"./confetti.module-Cj_6Odin.js";import{t as c}from"./external-link-2pRbXZFT.js";import{t as l}from"./info-DoO2J6qy.js";import{A as u,B as d,C as f,H as p,I as m,L as h,M as g,O as _,P as v,R as y,S as b,T as x,j as S,n as C,s as w,w as T,z as E}from"./index-BjHs_aR9.js";var D=p(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),O=p(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),k=p(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),A=p(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),j=p(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),M=p(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ee=p(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),te=p(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),N=p(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ne=p(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),re=p(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),P=p(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ie=p(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),F=p(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ae=p(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),oe=p(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),se=p(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),I=t(e(),1),L=2600,R=1500,z=[{tMax:.15,name:`The Whispering Coast & Lowlands`,biome:`coast`},{tMax:.32,name:`The Elderwood Deep Forest`,biome:`forest`},{tMax:.48,name:`River Elden & The Twin Fords`,biome:`river`},{tMax:.68,name:`The Dragon Tooth Mountains & Passes`,biome:`mountain`},{tMax:.83,name:`The Misty Glade & Highland Woods`,biome:`forest`},{tMax:.93,name:`The Roaring Gorge & Cataracts`,biome:`river`},{tMax:1,name:`The Sunstone Peaks & Ancient Citadel`,biome:`ancient_ruins`}],B=[`Pencil marks still visible from the cartographer’s first survey.`,`A calm breeze sweeps through the grass, carrying the scent of pine.`,`Wooden planks creak underfoot as the river roars below.`,`Craggy pencil hatchings reveal steep, unforgiving granite slopes.`,`Ancient roots break through the worn gravel pathway.`,`The sound of rushing water echoes across the canyon walls.`,`A solitary stone marker inscribed with early explorer symbols.`,`Golden light filters softly through the sketched canopy.`,`Distant mountain ridges frame the expanding horizon.`,`A tranquil haven where wanderers rest before the mountain climb.`];function ce(e=[],t={}){let n=[],r=e.length>0?e.length:150,i=[{t:0,x:220,y:1320,elev:10},{t:.08,x:380,y:1140,elev:45},{t:.16,x:580,y:980,elev:120},{t:.24,x:820,y:1120,elev:90},{t:.32,x:940,y:860,elev:180},{t:.4,x:720,y:640,elev:320},{t:.48,x:1050,y:520,elev:580},{t:.56,x:1320,y:720,elev:890},{t:.64,x:1540,y:480,elev:1250},{t:.72,x:1780,y:680,elev:920},{t:.8,x:1980,y:920,elev:460},{t:.88,x:2220,y:760,elev:750},{t:.94,x:2180,y:480,elev:1180},{t:1,x:2420,y:240,elev:1620}];for(let a=0;a<r;a++){let o=r>1?a/(r-1):0,s=0;for(;s<i.length-2&&i[s+1].t<o;)s++;let c=i[Math.max(0,s-1)],l=i[s],u=i[Math.min(i.length-1,s+1)],d=i[Math.min(i.length-1,s+2)],f=u.t-l.t||.001,p=(o-l.t)/f,m=p,h=m*m,g=h*m,_=-.5*g+h-.5*m,v=1.5*g-2.5*h+1,y=-1.5*g+2*h+.5*m,b=.5*g-.5*h,x=_*c.x+v*l.x+y*u.x+b*d.x,S=_*c.y+v*l.y+y*u.y+b*d.y,C=Math.sin(a*.45)*14+Math.cos(a*.9)*8,w=Math.cos(a*.4)*14+Math.sin(a*.85)*8;x=Math.round(x+C),S=Math.round(S+w);let T=Math.round(l.elev+p*(u.elev-l.elev)+Math.sin(a*.5)*15),E=z.find(e=>o<=e.tMax)||z[z.length-1],D=e.length>0?e[a]:a+1,O=t[D]||(D<0?`Custom Challenge ${a+1}`:`LeetCode #${D}`),k=B[a%B.length];n.push({id:D,sequenceIndex:a,x,y:S,name:O,biome:E.biome,regionName:E.name,elevation:Math.max(10,T),lore:k})}return n}var V=[{id:`wm-bg1`,x:380,y:310,size:70,height:85,ridgeShift:-4,hasSnow:!1,layer:0,elevation:840,rangeName:`Western Crags`},{id:`wm-bg2`,x:490,y:280,size:85,height:105,ridgeShift:6,hasSnow:!0,layer:0,elevation:1120,name:`Peak of the North Wind`,rangeName:`Western Crags`},{id:`wm-bg3`,x:620,y:300,size:75,height:95,ridgeShift:-3,hasSnow:!1,layer:0,elevation:960,rangeName:`Western Crags`},{id:`wm-bg4`,x:730,y:320,size:65,height:80,ridgeShift:4,hasSnow:!1,layer:0,elevation:780,rangeName:`Western Crags`},{id:`m1`,x:430,y:375,size:80,height:105,ridgeShift:5,hasSnow:!0,elevation:1240,name:`Crag of the Mist`,rangeName:`Western Crags`},{id:`m2`,x:530,y:345,size:95,height:125,ridgeShift:-7,hasSnow:!0,elevation:1480,name:`Peak of Solitude`,rangeName:`Western Crags`},{id:`m3`,x:630,y:365,size:85,height:110,ridgeShift:3,hasSnow:!0,elevation:1310,name:`Shadowhorn`,rangeName:`Western Crags`},{id:`m4`,x:720,y:385,size:70,height:90,ridgeShift:-4,hasSnow:!1,elevation:990,rangeName:`Western Crags`},{id:`m5`,x:370,y:430,size:55,height:65,ridgeShift:4,hasSnow:!1,layer:2,elevation:620,rangeName:`Western Crags`},{id:`m6`,x:470,y:425,size:68,height:80,ridgeShift:-3,hasSnow:!1,layer:2,elevation:760,name:`Gullwing Bluff`,rangeName:`Western Crags`},{id:`m6b`,x:575,y:420,size:72,height:88,ridgeShift:3,hasSnow:!1,layer:2,elevation:850,rangeName:`Western Crags`},{id:`m6c`,x:670,y:435,size:58,height:70,ridgeShift:-2,hasSnow:!1,layer:2,elevation:680,rangeName:`Western Crags`},{id:`dt-bg1`,x:1130,y:260,size:90,height:120,ridgeShift:-6,hasSnow:!0,layer:0,elevation:1850,rangeName:`Dragon's Tooth Range`},{id:`dt-bg2`,x:1250,y:225,size:115,height:150,ridgeShift:8,hasSnow:!0,layer:0,elevation:2180,name:`Crown of the North`,rangeName:`Dragon's Tooth Range`},{id:`dt-bg3`,x:1380,y:210,size:130,height:175,ridgeShift:-10,hasSnow:!0,layer:0,elevation:2450,name:`Apex of Clouds`,rangeName:`Dragon's Tooth Range`},{id:`dt-bg4`,x:1510,y:240,size:110,height:145,ridgeShift:7,hasSnow:!0,layer:0,elevation:2020,rangeName:`Dragon's Tooth Range`},{id:`dt-bg5`,x:1640,y:280,size:90,height:115,ridgeShift:-5,hasSnow:!0,layer:0,elevation:1690,rangeName:`Dragon's Tooth Range`},{id:`m7`,x:1190,y:325,size:105,height:140,ridgeShift:-8,hasSnow:!0,elevation:1980,name:`The Dragon's Crest`,rangeName:`Dragon's Tooth Range`},{id:`m8`,x:1310,y:295,size:125,height:165,ridgeShift:10,hasSnow:!0,elevation:2360,name:`Frostcrag Pinnacle`,rangeName:`Dragon's Tooth Range`},{id:`m9`,x:1435,y:320,size:115,height:150,ridgeShift:-6,hasSnow:!0,elevation:2120,name:`Thunderhorn Peak`,rangeName:`Dragon's Tooth Range`},{id:`m10`,x:1560,y:355,size:98,height:125,ridgeShift:7,hasSnow:!0,elevation:1780,name:`Screaming Ridge`,rangeName:`Dragon's Tooth Range`},{id:`m10b`,x:1680,y:375,size:85,height:105,ridgeShift:-4,hasSnow:!1,elevation:1420,rangeName:`Dragon's Tooth Range`},{id:`m11`,x:1260,y:415,size:90,height:115,ridgeShift:-5,hasSnow:!0,elevation:1560,name:`Ironhorn Needle`,rangeName:`Dragon's Tooth Range`},{id:`m12`,x:1375,y:405,size:100,height:130,ridgeShift:6,hasSnow:!0,elevation:1720,name:`Shadowcrevasse Crag`,rangeName:`Dragon's Tooth Range`},{id:`m13`,x:1490,y:440,size:88,height:110,ridgeShift:-4,hasSnow:!0,elevation:1490,rangeName:`Dragon's Tooth Range`},{id:`m14`,x:1610,y:435,size:82,height:100,ridgeShift:5,hasSnow:!1,elevation:1320,rangeName:`Dragon's Tooth Range`},{id:`m15`,x:1160,y:590,size:80,height:100,ridgeShift:5,hasSnow:!1,elevation:1180,name:`Wanderer's Bluff`,rangeName:`Mid-Pass Gorge`},{id:`m16`,x:1390,y:610,size:90,height:115,ridgeShift:-6,hasSnow:!0,elevation:1390,name:`Eagle Eye Ridge`,rangeName:`Mid-Pass Gorge`},{id:`m17`,x:1510,y:585,size:95,height:120,ridgeShift:5,hasSnow:!0,elevation:1520,name:`Razorback Spine`,rangeName:`Mid-Pass Gorge`},{id:`m18`,x:1630,y:565,size:85,height:105,ridgeShift:-4,hasSnow:!1,elevation:1280,rangeName:`Mid-Pass Gorge`},{id:`m18b`,x:1740,y:580,size:75,height:90,ridgeShift:3,hasSnow:!1,elevation:1050,rangeName:`Mid-Pass Gorge`},{id:`es-bg1`,x:1980,y:310,size:88,height:115,ridgeShift:-5,hasSnow:!0,layer:0,elevation:1650,rangeName:`Sunstone Highlands`},{id:`es-bg2`,x:2110,y:245,size:105,height:140,ridgeShift:6,hasSnow:!0,layer:0,elevation:1980,name:`Sun Pillar`,rangeName:`Sunstone Highlands`},{id:`es-bg3`,x:2260,y:160,size:135,height:180,ridgeShift:-8,hasSnow:!0,layer:0,elevation:2580,name:`Crown of the Heavens`,rangeName:`Sunstone Highlands`},{id:`es-bg4`,x:2410,y:210,size:115,height:150,ridgeShift:7,hasSnow:!0,layer:0,elevation:2240,rangeName:`Sunstone Highlands`},{id:`m19`,x:2040,y:375,size:98,height:128,ridgeShift:6,hasSnow:!0,elevation:1720,name:`Sunstone Spire`,rangeName:`Sunstone Highlands`},{id:`m20`,x:2170,y:315,size:115,height:150,ridgeShift:-7,hasSnow:!0,elevation:2080,name:`Sanctuary Peak`,rangeName:`Sunstone Highlands`},{id:`m21`,x:2310,y:220,size:130,height:170,ridgeShift:8,hasSnow:!0,elevation:2390,name:`Pinnacle of the Ancients`,rangeName:`Sunstone Highlands`},{id:`m22`,x:2440,y:360,size:90,height:115,ridgeShift:-5,hasSnow:!0,elevation:1610,name:`Falcon Perch`,rangeName:`Sunstone Highlands`},{id:`m23`,x:2260,y:405,size:82,height:98,ridgeShift:4,hasSnow:!1,elevation:1250,name:`Altar Crag`,rangeName:`Sunstone Highlands`},{id:`m24`,x:2380,y:420,size:76,height:88,ridgeShift:-3,hasSnow:!1,elevation:1120,rangeName:`Sunstone Highlands`},{id:`m25`,x:2140,y:450,size:70,height:80,ridgeShift:3,hasSnow:!1,elevation:980,rangeName:`Sunstone Highlands`}],le=[{id:`river-elden`,name:`River Elden`,d:`M 1340,290 C 1310,380 1260,460 1210,540 C 1140,640 1020,700 960,820 C 900,940 930,1060 880,1180 C 840,1280 760,1360 690,1480`,width:14,hasBridges:[{x:945,y:855,angle:-35},{x:890,y:1160,angle:25}]},{id:`river-silver`,name:`Silver Meander`,d:`M 580,410 C 650,490 730,550 780,660 C 830,760 910,810 960,820`,width:8,hasBridges:[{x:740,y:620,angle:45}]},{id:`river-cataract`,name:`Highland Torrent`,d:`M 2150,320 C 2100,450 2050,600 2020,760 C 1990,920 1920,1050 1840,1180 C 1760,1310 1710,1420 1660,1500`,width:11,hasBridges:[{x:2010,y:810,angle:-20}]}],H=[{id:`f1`,name:`The Whispering Pines`,cx:580,cy:1040,rx:230,ry:160,treeCount:42,trees:U(580,1040,210,140,42,`pines`)},{id:`f2`,name:`Elderwood Deep`,cx:820,cy:1140,rx:250,ry:180,treeCount:52,trees:U(820,1140,230,160,52,`oaks`)},{id:`f3`,name:`Mistwood Valley`,cx:860,cy:620,rx:190,ry:140,treeCount:36,trees:U(860,620,170,120,36,`willows`)},{id:`f4`,name:`Highland Spruces`,cx:1760,cy:740,rx:210,ry:155,treeCount:38,trees:U(1760,740,190,135,38,`highland_spruce`)},{id:`f5`,name:`Verdant Basin`,cx:1960,cy:980,rx:200,ry:150,treeCount:38,trees:U(1960,980,180,130,38,`mixed`)},{id:`f6`,name:`Shadowglen Copse`,cx:390,cy:690,rx:140,ry:100,treeCount:22,trees:U(390,690,120,80,22,`pines`)},{id:`f7`,name:`Sunstone Grove`,cx:2360,cy:580,rx:150,ry:110,treeCount:24,trees:U(2360,580,130,90,24,`mixed`)}];function U(e,t,n,r,i,a){let o=[];for(let s=0;s<i;s++){let c=s*2.399963+Math.sin(s*1.7)*.4,l=((s+.5)/i)**.65,u=Math.sin(s*4.3+e)*14,d=Math.cos(s*3.9+t)*12,f=Math.round(e+n*l*Math.cos(c)+u),p=Math.round(t+r*l*Math.sin(c)+d),m=.85+s%4*.1;s===0||s===5?m=1.35:s%7==0&&(m=.68);let h=`pine`;if(a===`pines`)h=s%6==0?`birch`:`pine`;else if(a===`oaks`)h=s===0||s===5?`ancient_oak`:s%5==0?`birch`:`oak`;else if(a===`willows`)h=s%3==0?`willow`:s%4==0?`birch`:`oak`;else if(a===`highland_spruce`)h=s%5==0?`pine`:`spruce`;else{let e=s%5;h=e===0?`ancient_oak`:e===1?`pine`:e===2?`oak`:e===3?`spruce`:`birch`}o.push({x:f,y:p,scale:m,type:h,seed:Math.round(e*7+t*11+s*31)})}return o}function W(e){if(e.length===0)return``;if(e.length===1)return`M ${e[0].x},${e[0].y}`;let t=`M ${e[0].x},${e[0].y}`;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],a=(r.x+i.x)/2,o=(r.y+i.y)/2;if(n===0)t+=` Q ${r.x},${r.y} ${a},${o}`;else{let a=e[n-1],o=r.x+(i.x-a.x)*.18,s=r.y+(i.y-a.y)*.18;t+=` S ${o},${s} ${i.x},${i.y}`}}return t}function G(e,t){return t<=0||e.length===0?``:W(e.slice(0,t+1))}var ue={parchment:{id:`parchment`,name:`Daylight Parchment`,bgClass:`parchment-bg`,textColor:`#2c221a`,pencilColor:`#382e25`,pencilShade:`#8c765c`,riverColor:`#96afbe`,glowColor:`#f59e0b`,glowSubtle:`#fbbf24`,nodeUnlit:`#f0e5ce`,nodeLit:`#fbbf24`,nodeLitStroke:`#ffffff`},dark_parchment:{id:`dark_parchment`,name:`Midnight Cartography`,bgClass:`parchment-dark-bg`,textColor:`#f3e9d2`,pencilColor:`#8a7761`,pencilShade:`#4a3f33`,riverColor:`#365163`,glowColor:`#fbbf24`,glowSubtle:`#f59e0b`,nodeUnlit:`#231e17`,nodeLit:`#f59e0b`,nodeLitStroke:`#fffbeb`}},K=new class{ctx=null;enabled=!0;initCtx(){if(!this.ctx&&typeof window<`u`){let e=window.AudioContext||window.webkitAudioContext;e&&(this.ctx=new e)}this.ctx&&this.ctx.state===`suspended`&&this.ctx.resume()}setEnabled(e){this.enabled=e,e&&this.initCtx()}isEnabled(){return this.enabled}playNodeLightUp(e,t=150){if(this.enabled&&(this.initCtx(),this.ctx))try{let n=this.ctx.currentTime,r=[261.63,293.66,329.63,392,440,523.25,587.33,659.25,783.99,880],i=Math.floor(e/Math.max(1,t)*20),a=1+Math.floor(i/r.length)*.5,o=r[i%r.length]*a,s=this.ctx.createOscillator(),c=this.ctx.createOscillator(),l=this.ctx.createGain();s.type=`sine`,s.frequency.setValueAtTime(o,n),c.type=`triangle`,c.frequency.setValueAtTime(o*2.01,n),l.gain.setValueAtTime(.001,n),l.gain.linearRampToValueAtTime(.12,n+.02),l.gain.exponentialRampToValueAtTime(1e-4,n+.55),s.connect(l),c.connect(l),l.connect(this.ctx.destination),s.start(n),c.start(n),s.stop(n+.6),c.stop(n+.6)}catch{}}playPencilScratch(){if(this.enabled&&(this.initCtx(),this.ctx))try{let e=this.ctx.currentTime,t=Math.floor(this.ctx.sampleRate*.06),n=this.ctx.createBuffer(1,t,this.ctx.sampleRate),r=n.getChannelData(0);for(let e=0;e<t;e++)r[e]=(Math.random()*2-1)*Math.exp(-e/(t*.4));let i=this.ctx.createBufferSource();i.buffer=n;let a=this.ctx.createBiquadFilter();a.type=`bandpass`,a.frequency.setValueAtTime(1400+Math.random()*800,e),a.Q.setValueAtTime(3.5,e);let o=this.ctx.createGain();o.gain.setValueAtTime(.04,e),o.gain.exponentialRampToValueAtTime(.001,e+.05),i.connect(a),a.connect(o),o.connect(this.ctx.destination),i.start(e)}catch{}}playVictoryChime(){this.enabled&&(this.initCtx(),this.ctx&&[523.25,659.25,783.99,1046.5].forEach((e,t)=>{setTimeout(()=>{if(!this.ctx)return;let t=this.ctx.currentTime,n=this.ctx.createOscillator(),r=this.ctx.createGain();n.type=`sine`,n.frequency.setValueAtTime(e,t),r.gain.setValueAtTime(.001,t),r.gain.linearRampToValueAtTime(.15,t+.05),r.gain.exponentialRampToValueAtTime(1e-4,t+1.2),n.connect(r),r.connect(this.ctx.destination),n.start(t),n.stop(t+1.3)},t*120)}))}},q=r();function J(e){let t=Math.sin(e*12.9898+78.233)*43758.5453;return t-Math.floor(t)}var Y=({mountain:e,theme:t})=>{let n=t.id!==`parchment`,r=t.pencilColor,i=t.pencilShade,{id:a,x:o,y:s,size:c,height:l,ridgeShift:u=0,hasSnow:d=l>95}=e,f=(0,I.useMemo)(()=>{let e=0;for(let t=0;t<a.length;t++)e+=a.charCodeAt(t)*(t+1);e+=Math.round(o+s);let t=o+u,n=s-l,r=o-c,i=o+c,f=[{x:t,y:n}];for(let i=1;i<=6;i++){let a=i/6,o=t-(t-r)*a,s=n+l*a,u=(J(e+i*17)-.48)*(c*.14)*Math.sin(a*Math.PI),d=J(e+i*31)>.65?l*.04:0;f.push({x:Math.round(o+u),y:Math.round(s+d)})}let p=[];for(let r=1;r<=6;r++){let a=r/6,o=t+(i-t)*a,s=n+l*a,u=(J(e+r*43)-.48)*(c*.14)*Math.sin(a*Math.PI),d=J(e+r*59)>.65?l*.04:0;p.push({x:Math.round(o+u),y:Math.round(s+d)})}let m=[{x:t,y:n}];for(let r=1;r<=7;r++){let i=r/7,a=t+(o+u*.25+(J(e+101)-.5)*(c*.15)-t)*i**1.2,s=n+l*i,d=Math.sin(i*Math.PI*2.2+J(e+113))*(c*.1);m.push({x:Math.round(a+d),y:Math.round(s)})}let h=[],g=m[Math.min(m.length-1,2)];if(g){let t=o+c*.55+(J(e+201)-.5)*15,n=s-l*.12,r=(g.x+t)/2+12,i=(g.y+n)/2-6;h.push({d:`M ${g.x},${g.y} Q ${r},${i} ${t},${n}`,side:`right`})}let _=m[Math.min(m.length-1,5)];if(_){let t=o+c*.85+(J(e+209)-.5)*15,n=s,r=(_.x+t)/2+10,i=(_.y+n)/2-4;h.push({d:`M ${_.x},${_.y} Q ${r},${i} ${t},${n}`,side:`right`})}let v=m[Math.min(m.length-1,3)];if(v){let t=o-c*.6+(J(e+301)-.5)*15,n=s-l*.15,r=(v.x+t)/2-10,i=(v.y+n)/2-5;h.push({d:`M ${v.x},${v.y} Q ${r},${i} ${t},${n}`,side:`left`})}let y=[],b=Math.max(14,Math.round(l/4.8));for(let r=1;r<=b;r++){let a=r/(b+1),o=m[Math.min(m.length-1,Math.max(0,Math.round(a*(m.length-1))))],s=n+l*a,c=p[Math.min(p.length-1,Math.max(0,Math.round(a*(p.length-1))))]||{x:t+(i-t)*a,y:s},u=o.x+(c.x-o.x)*.08,d=s+(J(e+r*71)-.5)*3,f=r%3==0?.92:r%2==0?.75:.6,h=u+(c.x-u)*f,g=d+((s-n)*.22+(c.y-s)*.35)+(J(e+r*83)-.5)*4;y.push({x1:Math.round(u),y1:Math.round(d),x2:Math.round(h),y2:Math.round(g),width:r<4?.9:1.25,opacity:r<3?.6:.85}),r>4&&r%2==0&&y.push({x1:Math.round(u+(h-u)*.3),y1:Math.round(d+(g-d)*.3),x2:Math.round(u+(h-u)*.75),y2:Math.round(d+(g-d)*.15),width:.75,opacity:.55})}let x=[],S=Math.max(4,Math.round(l/18));for(let i=1;i<=S;i++){let a=(i+.3)/(S+1),o=n+l*a,s=m[Math.min(m.length-1,Math.round(a*(m.length-1)))],c=f[Math.min(f.length-1,Math.round(a*(f.length-1)))]||{x:t-(t-r)*a,y:o},u=s.x-(s.x-c.x)*.25,d=o+2,p=s.x-(s.x-c.x)*(.6+J(e+i*97)*.3),h=o+8+J(e+i*103)*6,g=(u+p)/2-4,_=(d+h)/2+3;if(x.push({d:`M ${Math.round(u)},${Math.round(d)} Q ${Math.round(g)},${Math.round(_)} ${Math.round(p)},${Math.round(h)}`,width:.9}),i%2==1){let e=u-6,t=d+3;x.push({d:`M ${Math.round(e)},${Math.round(t)} L ${Math.round(e-8)},${Math.round(t+10)}`,width:.75})}}let C=``,w=``;if(d){let e=n+l*.32,a=t-(t-r)*.32,o=t+(i-t)*.32,s=m[Math.min(m.length-1,2)]||{x:t,y:e},c={x:t-(t-r)*.16,y:e-4},u={x:t-(t-r)*.26,y:e+6},d={x:t+(i-t)*.14,y:e+3},h={x:t+(i-t)*.24,y:e-2};C=`M ${t},${n}
|
| 2 |
L ${f[1].x},${f[1].y}
|
| 3 |
L ${a},${e}
|
| 4 |
Q ${u.x},${u.y} ${c.x},${c.y}
|
|
|
|
| 1 |
+
import{a as e,c as t,i as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import{i,n as a,r as o,t as s}from"./confetti.module-CexOBsNI.js";import{t as c}from"./external-link-D_lyOHrp.js";import{t as l}from"./info-CZH6IVe4.js";import{A as u,B as d,C as f,H as p,I as m,L as h,M as g,O as _,P as v,R as y,S as b,T as x,j as S,n as C,s as w,w as T,z as E}from"./index-CPCBFJ0E.js";var D=p(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),O=p(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),k=p(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),A=p(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),j=p(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),M=p(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ee=p(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),te=p(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),N=p(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ne=p(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),re=p(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),P=p(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ie=p(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),F=p(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ae=p(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),oe=p(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),se=p(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),I=t(e(),1),L=2600,R=1500,z=[{tMax:.15,name:`The Whispering Coast & Lowlands`,biome:`coast`},{tMax:.32,name:`The Elderwood Deep Forest`,biome:`forest`},{tMax:.48,name:`River Elden & The Twin Fords`,biome:`river`},{tMax:.68,name:`The Dragon Tooth Mountains & Passes`,biome:`mountain`},{tMax:.83,name:`The Misty Glade & Highland Woods`,biome:`forest`},{tMax:.93,name:`The Roaring Gorge & Cataracts`,biome:`river`},{tMax:1,name:`The Sunstone Peaks & Ancient Citadel`,biome:`ancient_ruins`}],B=[`Pencil marks still visible from the cartographer’s first survey.`,`A calm breeze sweeps through the grass, carrying the scent of pine.`,`Wooden planks creak underfoot as the river roars below.`,`Craggy pencil hatchings reveal steep, unforgiving granite slopes.`,`Ancient roots break through the worn gravel pathway.`,`The sound of rushing water echoes across the canyon walls.`,`A solitary stone marker inscribed with early explorer symbols.`,`Golden light filters softly through the sketched canopy.`,`Distant mountain ridges frame the expanding horizon.`,`A tranquil haven where wanderers rest before the mountain climb.`];function ce(e=[],t={}){let n=[],r=e.length>0?e.length:150,i=[{t:0,x:220,y:1320,elev:10},{t:.08,x:380,y:1140,elev:45},{t:.16,x:580,y:980,elev:120},{t:.24,x:820,y:1120,elev:90},{t:.32,x:940,y:860,elev:180},{t:.4,x:720,y:640,elev:320},{t:.48,x:1050,y:520,elev:580},{t:.56,x:1320,y:720,elev:890},{t:.64,x:1540,y:480,elev:1250},{t:.72,x:1780,y:680,elev:920},{t:.8,x:1980,y:920,elev:460},{t:.88,x:2220,y:760,elev:750},{t:.94,x:2180,y:480,elev:1180},{t:1,x:2420,y:240,elev:1620}];for(let a=0;a<r;a++){let o=r>1?a/(r-1):0,s=0;for(;s<i.length-2&&i[s+1].t<o;)s++;let c=i[Math.max(0,s-1)],l=i[s],u=i[Math.min(i.length-1,s+1)],d=i[Math.min(i.length-1,s+2)],f=u.t-l.t||.001,p=(o-l.t)/f,m=p,h=m*m,g=h*m,_=-.5*g+h-.5*m,v=1.5*g-2.5*h+1,y=-1.5*g+2*h+.5*m,b=.5*g-.5*h,x=_*c.x+v*l.x+y*u.x+b*d.x,S=_*c.y+v*l.y+y*u.y+b*d.y,C=Math.sin(a*.45)*14+Math.cos(a*.9)*8,w=Math.cos(a*.4)*14+Math.sin(a*.85)*8;x=Math.round(x+C),S=Math.round(S+w);let T=Math.round(l.elev+p*(u.elev-l.elev)+Math.sin(a*.5)*15),E=z.find(e=>o<=e.tMax)||z[z.length-1],D=e.length>0?e[a]:a+1,O=t[D]||(D<0?`Custom Challenge ${a+1}`:`LeetCode #${D}`),k=B[a%B.length];n.push({id:D,sequenceIndex:a,x,y:S,name:O,biome:E.biome,regionName:E.name,elevation:Math.max(10,T),lore:k})}return n}var V=[{id:`wm-bg1`,x:380,y:310,size:70,height:85,ridgeShift:-4,hasSnow:!1,layer:0,elevation:840,rangeName:`Western Crags`},{id:`wm-bg2`,x:490,y:280,size:85,height:105,ridgeShift:6,hasSnow:!0,layer:0,elevation:1120,name:`Peak of the North Wind`,rangeName:`Western Crags`},{id:`wm-bg3`,x:620,y:300,size:75,height:95,ridgeShift:-3,hasSnow:!1,layer:0,elevation:960,rangeName:`Western Crags`},{id:`wm-bg4`,x:730,y:320,size:65,height:80,ridgeShift:4,hasSnow:!1,layer:0,elevation:780,rangeName:`Western Crags`},{id:`m1`,x:430,y:375,size:80,height:105,ridgeShift:5,hasSnow:!0,elevation:1240,name:`Crag of the Mist`,rangeName:`Western Crags`},{id:`m2`,x:530,y:345,size:95,height:125,ridgeShift:-7,hasSnow:!0,elevation:1480,name:`Peak of Solitude`,rangeName:`Western Crags`},{id:`m3`,x:630,y:365,size:85,height:110,ridgeShift:3,hasSnow:!0,elevation:1310,name:`Shadowhorn`,rangeName:`Western Crags`},{id:`m4`,x:720,y:385,size:70,height:90,ridgeShift:-4,hasSnow:!1,elevation:990,rangeName:`Western Crags`},{id:`m5`,x:370,y:430,size:55,height:65,ridgeShift:4,hasSnow:!1,layer:2,elevation:620,rangeName:`Western Crags`},{id:`m6`,x:470,y:425,size:68,height:80,ridgeShift:-3,hasSnow:!1,layer:2,elevation:760,name:`Gullwing Bluff`,rangeName:`Western Crags`},{id:`m6b`,x:575,y:420,size:72,height:88,ridgeShift:3,hasSnow:!1,layer:2,elevation:850,rangeName:`Western Crags`},{id:`m6c`,x:670,y:435,size:58,height:70,ridgeShift:-2,hasSnow:!1,layer:2,elevation:680,rangeName:`Western Crags`},{id:`dt-bg1`,x:1130,y:260,size:90,height:120,ridgeShift:-6,hasSnow:!0,layer:0,elevation:1850,rangeName:`Dragon's Tooth Range`},{id:`dt-bg2`,x:1250,y:225,size:115,height:150,ridgeShift:8,hasSnow:!0,layer:0,elevation:2180,name:`Crown of the North`,rangeName:`Dragon's Tooth Range`},{id:`dt-bg3`,x:1380,y:210,size:130,height:175,ridgeShift:-10,hasSnow:!0,layer:0,elevation:2450,name:`Apex of Clouds`,rangeName:`Dragon's Tooth Range`},{id:`dt-bg4`,x:1510,y:240,size:110,height:145,ridgeShift:7,hasSnow:!0,layer:0,elevation:2020,rangeName:`Dragon's Tooth Range`},{id:`dt-bg5`,x:1640,y:280,size:90,height:115,ridgeShift:-5,hasSnow:!0,layer:0,elevation:1690,rangeName:`Dragon's Tooth Range`},{id:`m7`,x:1190,y:325,size:105,height:140,ridgeShift:-8,hasSnow:!0,elevation:1980,name:`The Dragon's Crest`,rangeName:`Dragon's Tooth Range`},{id:`m8`,x:1310,y:295,size:125,height:165,ridgeShift:10,hasSnow:!0,elevation:2360,name:`Frostcrag Pinnacle`,rangeName:`Dragon's Tooth Range`},{id:`m9`,x:1435,y:320,size:115,height:150,ridgeShift:-6,hasSnow:!0,elevation:2120,name:`Thunderhorn Peak`,rangeName:`Dragon's Tooth Range`},{id:`m10`,x:1560,y:355,size:98,height:125,ridgeShift:7,hasSnow:!0,elevation:1780,name:`Screaming Ridge`,rangeName:`Dragon's Tooth Range`},{id:`m10b`,x:1680,y:375,size:85,height:105,ridgeShift:-4,hasSnow:!1,elevation:1420,rangeName:`Dragon's Tooth Range`},{id:`m11`,x:1260,y:415,size:90,height:115,ridgeShift:-5,hasSnow:!0,elevation:1560,name:`Ironhorn Needle`,rangeName:`Dragon's Tooth Range`},{id:`m12`,x:1375,y:405,size:100,height:130,ridgeShift:6,hasSnow:!0,elevation:1720,name:`Shadowcrevasse Crag`,rangeName:`Dragon's Tooth Range`},{id:`m13`,x:1490,y:440,size:88,height:110,ridgeShift:-4,hasSnow:!0,elevation:1490,rangeName:`Dragon's Tooth Range`},{id:`m14`,x:1610,y:435,size:82,height:100,ridgeShift:5,hasSnow:!1,elevation:1320,rangeName:`Dragon's Tooth Range`},{id:`m15`,x:1160,y:590,size:80,height:100,ridgeShift:5,hasSnow:!1,elevation:1180,name:`Wanderer's Bluff`,rangeName:`Mid-Pass Gorge`},{id:`m16`,x:1390,y:610,size:90,height:115,ridgeShift:-6,hasSnow:!0,elevation:1390,name:`Eagle Eye Ridge`,rangeName:`Mid-Pass Gorge`},{id:`m17`,x:1510,y:585,size:95,height:120,ridgeShift:5,hasSnow:!0,elevation:1520,name:`Razorback Spine`,rangeName:`Mid-Pass Gorge`},{id:`m18`,x:1630,y:565,size:85,height:105,ridgeShift:-4,hasSnow:!1,elevation:1280,rangeName:`Mid-Pass Gorge`},{id:`m18b`,x:1740,y:580,size:75,height:90,ridgeShift:3,hasSnow:!1,elevation:1050,rangeName:`Mid-Pass Gorge`},{id:`es-bg1`,x:1980,y:310,size:88,height:115,ridgeShift:-5,hasSnow:!0,layer:0,elevation:1650,rangeName:`Sunstone Highlands`},{id:`es-bg2`,x:2110,y:245,size:105,height:140,ridgeShift:6,hasSnow:!0,layer:0,elevation:1980,name:`Sun Pillar`,rangeName:`Sunstone Highlands`},{id:`es-bg3`,x:2260,y:160,size:135,height:180,ridgeShift:-8,hasSnow:!0,layer:0,elevation:2580,name:`Crown of the Heavens`,rangeName:`Sunstone Highlands`},{id:`es-bg4`,x:2410,y:210,size:115,height:150,ridgeShift:7,hasSnow:!0,layer:0,elevation:2240,rangeName:`Sunstone Highlands`},{id:`m19`,x:2040,y:375,size:98,height:128,ridgeShift:6,hasSnow:!0,elevation:1720,name:`Sunstone Spire`,rangeName:`Sunstone Highlands`},{id:`m20`,x:2170,y:315,size:115,height:150,ridgeShift:-7,hasSnow:!0,elevation:2080,name:`Sanctuary Peak`,rangeName:`Sunstone Highlands`},{id:`m21`,x:2310,y:220,size:130,height:170,ridgeShift:8,hasSnow:!0,elevation:2390,name:`Pinnacle of the Ancients`,rangeName:`Sunstone Highlands`},{id:`m22`,x:2440,y:360,size:90,height:115,ridgeShift:-5,hasSnow:!0,elevation:1610,name:`Falcon Perch`,rangeName:`Sunstone Highlands`},{id:`m23`,x:2260,y:405,size:82,height:98,ridgeShift:4,hasSnow:!1,elevation:1250,name:`Altar Crag`,rangeName:`Sunstone Highlands`},{id:`m24`,x:2380,y:420,size:76,height:88,ridgeShift:-3,hasSnow:!1,elevation:1120,rangeName:`Sunstone Highlands`},{id:`m25`,x:2140,y:450,size:70,height:80,ridgeShift:3,hasSnow:!1,elevation:980,rangeName:`Sunstone Highlands`}],le=[{id:`river-elden`,name:`River Elden`,d:`M 1340,290 C 1310,380 1260,460 1210,540 C 1140,640 1020,700 960,820 C 900,940 930,1060 880,1180 C 840,1280 760,1360 690,1480`,width:14,hasBridges:[{x:945,y:855,angle:-35},{x:890,y:1160,angle:25}]},{id:`river-silver`,name:`Silver Meander`,d:`M 580,410 C 650,490 730,550 780,660 C 830,760 910,810 960,820`,width:8,hasBridges:[{x:740,y:620,angle:45}]},{id:`river-cataract`,name:`Highland Torrent`,d:`M 2150,320 C 2100,450 2050,600 2020,760 C 1990,920 1920,1050 1840,1180 C 1760,1310 1710,1420 1660,1500`,width:11,hasBridges:[{x:2010,y:810,angle:-20}]}],H=[{id:`f1`,name:`The Whispering Pines`,cx:580,cy:1040,rx:230,ry:160,treeCount:42,trees:U(580,1040,210,140,42,`pines`)},{id:`f2`,name:`Elderwood Deep`,cx:820,cy:1140,rx:250,ry:180,treeCount:52,trees:U(820,1140,230,160,52,`oaks`)},{id:`f3`,name:`Mistwood Valley`,cx:860,cy:620,rx:190,ry:140,treeCount:36,trees:U(860,620,170,120,36,`willows`)},{id:`f4`,name:`Highland Spruces`,cx:1760,cy:740,rx:210,ry:155,treeCount:38,trees:U(1760,740,190,135,38,`highland_spruce`)},{id:`f5`,name:`Verdant Basin`,cx:1960,cy:980,rx:200,ry:150,treeCount:38,trees:U(1960,980,180,130,38,`mixed`)},{id:`f6`,name:`Shadowglen Copse`,cx:390,cy:690,rx:140,ry:100,treeCount:22,trees:U(390,690,120,80,22,`pines`)},{id:`f7`,name:`Sunstone Grove`,cx:2360,cy:580,rx:150,ry:110,treeCount:24,trees:U(2360,580,130,90,24,`mixed`)}];function U(e,t,n,r,i,a){let o=[];for(let s=0;s<i;s++){let c=s*2.399963+Math.sin(s*1.7)*.4,l=((s+.5)/i)**.65,u=Math.sin(s*4.3+e)*14,d=Math.cos(s*3.9+t)*12,f=Math.round(e+n*l*Math.cos(c)+u),p=Math.round(t+r*l*Math.sin(c)+d),m=.85+s%4*.1;s===0||s===5?m=1.35:s%7==0&&(m=.68);let h=`pine`;if(a===`pines`)h=s%6==0?`birch`:`pine`;else if(a===`oaks`)h=s===0||s===5?`ancient_oak`:s%5==0?`birch`:`oak`;else if(a===`willows`)h=s%3==0?`willow`:s%4==0?`birch`:`oak`;else if(a===`highland_spruce`)h=s%5==0?`pine`:`spruce`;else{let e=s%5;h=e===0?`ancient_oak`:e===1?`pine`:e===2?`oak`:e===3?`spruce`:`birch`}o.push({x:f,y:p,scale:m,type:h,seed:Math.round(e*7+t*11+s*31)})}return o}function W(e){if(e.length===0)return``;if(e.length===1)return`M ${e[0].x},${e[0].y}`;let t=`M ${e[0].x},${e[0].y}`;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],a=(r.x+i.x)/2,o=(r.y+i.y)/2;if(n===0)t+=` Q ${r.x},${r.y} ${a},${o}`;else{let a=e[n-1],o=r.x+(i.x-a.x)*.18,s=r.y+(i.y-a.y)*.18;t+=` S ${o},${s} ${i.x},${i.y}`}}return t}function G(e,t){return t<=0||e.length===0?``:W(e.slice(0,t+1))}var ue={parchment:{id:`parchment`,name:`Daylight Parchment`,bgClass:`parchment-bg`,textColor:`#2c221a`,pencilColor:`#382e25`,pencilShade:`#8c765c`,riverColor:`#96afbe`,glowColor:`#f59e0b`,glowSubtle:`#fbbf24`,nodeUnlit:`#f0e5ce`,nodeLit:`#fbbf24`,nodeLitStroke:`#ffffff`},dark_parchment:{id:`dark_parchment`,name:`Midnight Cartography`,bgClass:`parchment-dark-bg`,textColor:`#f3e9d2`,pencilColor:`#8a7761`,pencilShade:`#4a3f33`,riverColor:`#365163`,glowColor:`#fbbf24`,glowSubtle:`#f59e0b`,nodeUnlit:`#231e17`,nodeLit:`#f59e0b`,nodeLitStroke:`#fffbeb`}},K=new class{ctx=null;enabled=!0;initCtx(){if(!this.ctx&&typeof window<`u`){let e=window.AudioContext||window.webkitAudioContext;e&&(this.ctx=new e)}this.ctx&&this.ctx.state===`suspended`&&this.ctx.resume()}setEnabled(e){this.enabled=e,e&&this.initCtx()}isEnabled(){return this.enabled}playNodeLightUp(e,t=150){if(this.enabled&&(this.initCtx(),this.ctx))try{let n=this.ctx.currentTime,r=[261.63,293.66,329.63,392,440,523.25,587.33,659.25,783.99,880],i=Math.floor(e/Math.max(1,t)*20),a=1+Math.floor(i/r.length)*.5,o=r[i%r.length]*a,s=this.ctx.createOscillator(),c=this.ctx.createOscillator(),l=this.ctx.createGain();s.type=`sine`,s.frequency.setValueAtTime(o,n),c.type=`triangle`,c.frequency.setValueAtTime(o*2.01,n),l.gain.setValueAtTime(.001,n),l.gain.linearRampToValueAtTime(.12,n+.02),l.gain.exponentialRampToValueAtTime(1e-4,n+.55),s.connect(l),c.connect(l),l.connect(this.ctx.destination),s.start(n),c.start(n),s.stop(n+.6),c.stop(n+.6)}catch{}}playPencilScratch(){if(this.enabled&&(this.initCtx(),this.ctx))try{let e=this.ctx.currentTime,t=Math.floor(this.ctx.sampleRate*.06),n=this.ctx.createBuffer(1,t,this.ctx.sampleRate),r=n.getChannelData(0);for(let e=0;e<t;e++)r[e]=(Math.random()*2-1)*Math.exp(-e/(t*.4));let i=this.ctx.createBufferSource();i.buffer=n;let a=this.ctx.createBiquadFilter();a.type=`bandpass`,a.frequency.setValueAtTime(1400+Math.random()*800,e),a.Q.setValueAtTime(3.5,e);let o=this.ctx.createGain();o.gain.setValueAtTime(.04,e),o.gain.exponentialRampToValueAtTime(.001,e+.05),i.connect(a),a.connect(o),o.connect(this.ctx.destination),i.start(e)}catch{}}playVictoryChime(){this.enabled&&(this.initCtx(),this.ctx&&[523.25,659.25,783.99,1046.5].forEach((e,t)=>{setTimeout(()=>{if(!this.ctx)return;let t=this.ctx.currentTime,n=this.ctx.createOscillator(),r=this.ctx.createGain();n.type=`sine`,n.frequency.setValueAtTime(e,t),r.gain.setValueAtTime(.001,t),r.gain.linearRampToValueAtTime(.15,t+.05),r.gain.exponentialRampToValueAtTime(1e-4,t+1.2),n.connect(r),r.connect(this.ctx.destination),n.start(t),n.stop(t+1.3)},t*120)}))}},q=r();function J(e){let t=Math.sin(e*12.9898+78.233)*43758.5453;return t-Math.floor(t)}var Y=({mountain:e,theme:t})=>{let n=t.id!==`parchment`,r=t.pencilColor,i=t.pencilShade,{id:a,x:o,y:s,size:c,height:l,ridgeShift:u=0,hasSnow:d=l>95}=e,f=(0,I.useMemo)(()=>{let e=0;for(let t=0;t<a.length;t++)e+=a.charCodeAt(t)*(t+1);e+=Math.round(o+s);let t=o+u,n=s-l,r=o-c,i=o+c,f=[{x:t,y:n}];for(let i=1;i<=6;i++){let a=i/6,o=t-(t-r)*a,s=n+l*a,u=(J(e+i*17)-.48)*(c*.14)*Math.sin(a*Math.PI),d=J(e+i*31)>.65?l*.04:0;f.push({x:Math.round(o+u),y:Math.round(s+d)})}let p=[];for(let r=1;r<=6;r++){let a=r/6,o=t+(i-t)*a,s=n+l*a,u=(J(e+r*43)-.48)*(c*.14)*Math.sin(a*Math.PI),d=J(e+r*59)>.65?l*.04:0;p.push({x:Math.round(o+u),y:Math.round(s+d)})}let m=[{x:t,y:n}];for(let r=1;r<=7;r++){let i=r/7,a=t+(o+u*.25+(J(e+101)-.5)*(c*.15)-t)*i**1.2,s=n+l*i,d=Math.sin(i*Math.PI*2.2+J(e+113))*(c*.1);m.push({x:Math.round(a+d),y:Math.round(s)})}let h=[],g=m[Math.min(m.length-1,2)];if(g){let t=o+c*.55+(J(e+201)-.5)*15,n=s-l*.12,r=(g.x+t)/2+12,i=(g.y+n)/2-6;h.push({d:`M ${g.x},${g.y} Q ${r},${i} ${t},${n}`,side:`right`})}let _=m[Math.min(m.length-1,5)];if(_){let t=o+c*.85+(J(e+209)-.5)*15,n=s,r=(_.x+t)/2+10,i=(_.y+n)/2-4;h.push({d:`M ${_.x},${_.y} Q ${r},${i} ${t},${n}`,side:`right`})}let v=m[Math.min(m.length-1,3)];if(v){let t=o-c*.6+(J(e+301)-.5)*15,n=s-l*.15,r=(v.x+t)/2-10,i=(v.y+n)/2-5;h.push({d:`M ${v.x},${v.y} Q ${r},${i} ${t},${n}`,side:`left`})}let y=[],b=Math.max(14,Math.round(l/4.8));for(let r=1;r<=b;r++){let a=r/(b+1),o=m[Math.min(m.length-1,Math.max(0,Math.round(a*(m.length-1))))],s=n+l*a,c=p[Math.min(p.length-1,Math.max(0,Math.round(a*(p.length-1))))]||{x:t+(i-t)*a,y:s},u=o.x+(c.x-o.x)*.08,d=s+(J(e+r*71)-.5)*3,f=r%3==0?.92:r%2==0?.75:.6,h=u+(c.x-u)*f,g=d+((s-n)*.22+(c.y-s)*.35)+(J(e+r*83)-.5)*4;y.push({x1:Math.round(u),y1:Math.round(d),x2:Math.round(h),y2:Math.round(g),width:r<4?.9:1.25,opacity:r<3?.6:.85}),r>4&&r%2==0&&y.push({x1:Math.round(u+(h-u)*.3),y1:Math.round(d+(g-d)*.3),x2:Math.round(u+(h-u)*.75),y2:Math.round(d+(g-d)*.15),width:.75,opacity:.55})}let x=[],S=Math.max(4,Math.round(l/18));for(let i=1;i<=S;i++){let a=(i+.3)/(S+1),o=n+l*a,s=m[Math.min(m.length-1,Math.round(a*(m.length-1)))],c=f[Math.min(f.length-1,Math.round(a*(f.length-1)))]||{x:t-(t-r)*a,y:o},u=s.x-(s.x-c.x)*.25,d=o+2,p=s.x-(s.x-c.x)*(.6+J(e+i*97)*.3),h=o+8+J(e+i*103)*6,g=(u+p)/2-4,_=(d+h)/2+3;if(x.push({d:`M ${Math.round(u)},${Math.round(d)} Q ${Math.round(g)},${Math.round(_)} ${Math.round(p)},${Math.round(h)}`,width:.9}),i%2==1){let e=u-6,t=d+3;x.push({d:`M ${Math.round(e)},${Math.round(t)} L ${Math.round(e-8)},${Math.round(t+10)}`,width:.75})}}let C=``,w=``;if(d){let e=n+l*.32,a=t-(t-r)*.32,o=t+(i-t)*.32,s=m[Math.min(m.length-1,2)]||{x:t,y:e},c={x:t-(t-r)*.16,y:e-4},u={x:t-(t-r)*.26,y:e+6},d={x:t+(i-t)*.14,y:e+3},h={x:t+(i-t)*.24,y:e-2};C=`M ${t},${n}
|
| 2 |
L ${f[1].x},${f[1].y}
|
| 3 |
L ${a},${e}
|
| 4 |
Q ${u.x},${u.y} ${c.x},${c.y}
|
algospaced-ui/dist/assets/{PrincessChamber-TQv-dX2B.js → PrincessChamber-DMbQcfRj.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{a as e,c as t,s as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import{C as i,D as a,H as o,I as s,N as c,O as l,S as u,T as d,V as f,_ as p,b as m,g as h,h as g,j as _,m as v,v as y,w as b,x,y as S}from"./index-BjHs_aR9.js";var C=o(`castle`,[[`path`,{d:`M10 5V3`,key:`1y54qe`}],[`path`,{d:`M14 5V3`,key:`m6isi`}],[`path`,{d:`M15 21v-3a3 3 0 0 0-6 0v3`,key:`lbp5hj`}],[`path`,{d:`M18 3v8`,key:`2ollhf`}],[`path`,{d:`M18 5H6`,key:`98imr9`}],[`path`,{d:`M22 11H2`,key:`1lmjae`}],[`path`,{d:`M22 9v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9`,key:`1rly83`}],[`path`,{d:`M6 3v8`,key:`csox7g`}]]),w=o(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),T=o(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),E=o(`scroll`,[[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),D=o(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),O=o(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),k=t(e(),1),A={1:{particleType:`pollen`,particleCount:16,particleColors:[`#FDE047`,`#FEF08A`,`#86EFAC`],gradientBg:`from-[#FFFDF0] via-[#FFF9E6] to-[#FEF3C7]`,glowColor:`rgba(251, 191, 36, 0.3)`,badgeLabel:`🌾 Plains Breeze`},2:{particleType:`leaves`,particleCount:18,particleColors:[`#86EFAC`,`#4ADE80`,`#22C55E`,`#A7F3D0`],gradientBg:`from-[#F0FDF4] via-[#DCFCE7] to-[#FEF9C3]`,glowColor:`rgba(34, 197, 94, 0.3)`,badgeLabel:`🍃 Whispering Leaves`},3:{particleType:`spores`,particleCount:22,particleColors:[`#67E8F9`,`#38BDF8`,`#818CF8`,`#C084FC`],gradientBg:`from-[#F0F9FF] via-[#E0F2FE] to-[#EDE9FE]`,glowColor:`rgba(56, 189, 248, 0.35)`,badgeLabel:`✨ Crystal Spores`},4:{particleType:`snow`,particleCount:28,particleColors:[`#FFFFFF`,`#E0F2FE`,`#BAE6FD`],gradientBg:`from-[#F8FAFC] via-[#F1F5F9] to-[#E2E8F0]`,glowColor:`rgba(186, 230, 253, 0.4)`,badgeLabel:`❄️ Alpine Snowfall`},5:{particleType:`runes`,particleCount:20,particleColors:[`#E879F9`,`#C084FC`,`#A855F7`,`#F472B6`],gradientBg:`from-[#FAF5FF] via-[#F3E8FF] to-[#FCE7F3]`,glowColor:`rgba(192, 132, 252, 0.4)`,badgeLabel:`🔮 Arcane Runes`},6:{particleType:`stardust`,particleCount:35,particleColors:[`#FDE047`,`#F59E0B`,`#E11D48`,`#818CF8`],gradientBg:`from-[#FFFBEB] via-[#FEF3C7] to-[#FFE4E6]`,glowColor:`rgba(245, 158, 11, 0.5)`,badgeLabel:`👑 Spire Gates`}};function j(e){return e<=30?A[1]:e<=60?A[2]:e<=90?A[3]:e<=120?A[4]:e<150?A[5]:A[6]}var M=r();function N({emotion:e,floor:t,rhythm:n,activity:r,isLoading:i=!1}){let a=p[e]||p.smiling_warmly,o=(0,k.useMemo)(()=>j(t),[t]),s=(0,k.useMemo)(()=>{switch(n){case`dawn`:return`from-amber-400/40 via-yellow-300/30 to-rose-300/20`;case`dusk`:return`from-orange-400/40 via-purple-400/30 to-amber-300/20`;case`night`:return`from-indigo-600/40 via-blue-500/30 to-amber-500/20`;default:return`from-amber-400/30 via-yellow-300/40 to-indigo-400/30`}},[n]);return(0,M.jsxs)(`div`,{className:`relative flex flex-col items-center justify-center my-auto w-full max-w-xl`,children:[(0,M.jsx)(`div`,{className:`absolute -inset-10 overflow-hidden pointer-events-none z-0`,children:Array.from({length:Math.min(18,o.particleCount)}).map((e,t)=>{let n=o.particleColors[t%o.particleColors.length],r=`${t*19%100}%`,i=`${6+t%5*2}s`,a=`${t*.7%4}s`,s=o.particleType===`leaves`||o.particleType===`runes`?`w-2.5 h-2.5`:`w-1.5 h-1.5`;return(0,M.jsx)(`span`,{className:`absolute rounded-full opacity-65 animate-pulse ${s}`,style:{backgroundColor:n,left:r,top:`${t*23%90}%`,boxShadow:`0 0 8px ${n}`,animationDuration:i,animationDelay:a}},t)})}),(0,M.jsxs)(`div`,{className:`relative group z-10`,children:[(0,M.jsx)(`div`,{className:`absolute -inset-2 bg-gradient-to-r ${s} rounded-2xl blur-md opacity-80 group-hover:opacity-100 transition duration-500`}),(0,M.jsxs)(`div`,{className:`relative w-36 h-44 sm:w-44 sm:h-52 bg-gradient-to-b from-amber-100 to-amber-200 border-[3px] border-ink-black rounded-xl overflow-hidden shadow-[4px_4px_0px_0px_#1E293B] transition-transform duration-300 flex items-center justify-center`,children:[(0,M.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center text-amber-700/40 pointer-events-none select-none`,children:[(0,M.jsx)(l,{className:`w-8 h-8 animate-pulse`}),(0,M.jsx)(`span`,{className:`font-arcade text-[10px] mt-2`,children:`Princess Aurelia`})]}),(0,M.jsx)(`img`,{src:a.imagePath,alt:a.label,loading:`eager`,className:`w-full h-full object-cover object-top transition-all duration-300 relative z-10 ${i?`scale-105 filter saturate-125`:`scale-100`}`,onError:e=>{let t=e.currentTarget;t.src.endsWith(`/sprites/princess/neutral.png`)?t.style.display=`none`:t.src=`/sprites/princess/neutral.png`}}),(0,M.jsxs)(`div`,{className:`absolute bottom-0 inset-x-0 bg-ink-black/85 backdrop-blur-xs text-[10px] text-amber-300 py-1 px-2 font-bold uppercase tracking-wider text-center flex items-center justify-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${i?`bg-amber-400 animate-ping`:`bg-emerald-400`}`}),(0,M.jsx)(`span`,{children:i?`Pondering...`:a.label})]})]}),(0,M.jsx)(`div`,{className:`absolute -top-2 -right-2 bg-[#FFE24C] border-[2px] border-ink-black rounded-full p-1 shadow-[2px_2px_0px_0px_#1E293B]`,children:(0,M.jsx)(l,{className:`w-3.5 h-3.5 text-amber-800`})})]}),r&&(0,M.jsx)(`div`,{className:`mt-2 text-center max-w-sm px-2`,children:(0,M.jsxs)(`span`,{className:`text-[10px] font-semibold text-slate-700 bg-white/85 px-2.5 py-0.5 rounded-full border border-ink-black/20 shadow-xs inline-flex items-center gap-1`,children:[(0,M.jsx)(`span`,{children:`🏰`}),(0,M.jsx)(`span`,{className:`truncate`,children:r})]})})]})}function P({text:e,characterName:t,emotion:n,isLoading:r=!1,isStreaming:i=!1,toolCalls:a,onTypingStatusChange:o}){let[s,c]=(0,k.useState)(e),[l,u]=(0,k.useState)(!1),d=(0,k.useRef)(null),f=(0,k.useRef)(e),m=(0,k.useRef)(0),h=(0,k.useRef)(o);(0,k.useEffect)(()=>{h.current=o},[o]);let _=p[n]||p.smiling_warmly,v=e=>{u(e),h.current?.(e)};return(0,k.useEffect)(()=>{if(i){d.current&&clearInterval(d.current),c(e),v(!0),e.length-m.current>=4&&(m.current=e.length,g(e.length)),f.current=e;return}if(e!==f.current&&!r){let t=f.current.length>0&&e.startsWith(f.current);if(f.current=e,d.current&&clearInterval(d.current),t)c(e),v(!1);else{c(``),v(!0);let t=0;d.current=setInterval(()=>{t<e.length?(t++,c(e.slice(0,t)),t%2==0&&e[t-1]!==` `&&g(t)):(d.current&&clearInterval(d.current),v(!1))},22)}}else!r&&e===f.current&&!i&&(c(e),l&&v(!1));return()=>{d.current&&clearInterval(d.current)}},[e,r,i]),(0,M.jsxs)(`div`,{onClick:()=>{l&&(d.current&&clearInterval(d.current),c(e),v(!1))},className:`w-full max-w-xl mt-3 sm:mt-4 relative bg-white border-[3px] border-ink-black rounded-xl p-3.5 sm:p-4 shadow-[4px_4px_0px_0px_#1E293B] transition-all cursor-pointer group select-text`,children:[(0,M.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 w-0 h-0 border-x-8 border-x-transparent border-b-8 border-b-ink-black pointer-events-none`}),(0,M.jsx)(`div`,{className:`absolute -top-2 left-1/2 -translate-x-1/2 w-0 h-0 border-x-6 border-x-transparent border-b-6 border-b-white pointer-events-none`}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-amber-100 pb-1.5 mb-2 select-none`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsxs)(`span`,{className:`font-headline-md font-bold text-xs text-amber-900 flex items-center gap-1`,children:[`👑 `,t||`Princess Aurelia`]}),(0,M.jsx)(`span`,{className:`text-[9px] bg-amber-100 text-amber-800 font-bold px-1.5 py-0.2 rounded border border-amber-200`,children:_.label})]}),l&&(0,M.jsx)(`span`,{className:`text-[9px] text-trash-gray font-medium animate-pulse`,children:`Click bubble to skip`})]}),r?(0,M.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs font-medium text-trash-gray select-none`,children:[(0,M.jsx)(`span`,{className:`inline-block w-2 h-2 bg-amber-500 rounded-full animate-bounce`}),(0,M.jsx)(`span`,{className:`inline-block w-2 h-2 bg-amber-500 rounded-full animate-bounce [animation-delay:0.2s]`}),(0,M.jsx)(`span`,{className:`inline-block w-2 h-2 bg-amber-500 rounded-full animate-bounce [animation-delay:0.4s]`}),(0,M.jsxs)(`span`,{className:`ml-1 text-slate-600`,children:[t||`Princess Aurelia`,` is attuning the crystal relay...`]})]}):(0,M.jsxs)(`div`,{className:`text-xs sm:text-[13px] text-ink-black font-medium leading-relaxed whitespace-pre-wrap`,children:[(e=>e.split(/(\*[^*]+\*)/g).map((e,t)=>e.startsWith(`*`)&&e.endsWith(`*`)?(0,M.jsx)(`span`,{className:`text-amber-700 italic font-semibold mr-1 inline-block`,children:e},t):(0,M.jsx)(`span`,{children:e},t)))(s),l&&(0,M.jsx)(`span`,{className:`inline-block w-1.5 h-3.5 bg-amber-500 ml-1 animate-pulse align-middle`})]}),a&&a.length>0&&!r&&(0,M.jsx)(`div`,{className:`mt-2.5 pt-2 border-t border-amber-100/80 flex flex-wrap gap-1.5 select-none`,children:a.map((e,t)=>{let n=`✨ Enchantment: ${e.name}`;return e.name===`open_app_window`&&(n=`📜 Summoned: ${e.args?.window_id||`Grimoire`}`),e.name===`set_study_timer`&&(n=`⏳ Hourglass: ${e.args?.minutes||15}m rest`),e.name===`play_ambient_sound`&&(n=`🔥 Kindled: ${e.args?.soundscape||`Soundscape`}`),e.name===`write_spire_diary`&&(n=`📖 Chronicled in Spire Diary`),(0,M.jsx)(`span`,{className:`px-2 py-0.5 rounded-full bg-indigo-50 border border-indigo-200 text-[10px] font-bold text-indigo-800 flex items-center gap-1 shadow-xs`,children:(0,M.jsx)(`span`,{children:n})},t)})})]})}var F=[{label:`💪 Solved a Tough One`,prompt:`I just solved a really tough problem! Felt so good getting all test cases to pass.`},{label:`😩 Feeling Stuck`,prompt:`I feel really stuck and discouraged today. It feels like everyone else gets this except me.`},{label:`☕ Need a Breather`,prompt:`My brain is pretty fried from practicing today. Can we just take a short breather?`},{label:`🌙 Life Beyond the Tower`,prompt:`What’s the first thing you want to do once we break the seals and get you out of that tower?`}];function I({suggestions:e,isLoading:t=!1,onSendMessage:n,placeholder:r=`Speak with Princess Aurelia...`}){let[i,a]=(0,k.useState)(``),o=()=>{let e=i.trim();e&&!t&&(n(e),a(``))},s=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),o())},c=Array.isArray(e)&&e.length>0;return(0,M.jsxs)(`div`,{className:`w-full flex flex-col items-center gap-2 select-none z-10`,children:[(0,M.jsx)(`div`,{className:`w-full max-w-xl flex items-center justify-center gap-1.5 flex-wrap py-1.5 px-2`,children:c?e.map((e,r)=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e),disabled:t,className:`px-2.5 py-1 bg-white hover:bg-amber-100 disabled:opacity-50 border-[1.5px] border-ink-black rounded-full text-[10px] sm:text-[11px] font-bold text-slate-800 cursor-pointer shadow-[1px_1px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all flex items-center gap-1`,children:[(0,M.jsx)(l,{className:`w-3 h-3 text-amber-600 shrink-0`}),(0,M.jsx)(`span`,{className:`truncate max-w-[200px]`,children:e})]},r)):F.map((e,r)=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>n(e.prompt),disabled:t,className:`px-2.5 py-1 bg-white hover:bg-amber-100 disabled:opacity-50 border-[1.5px] border-ink-black rounded-full text-[10px] sm:text-[11px] font-bold text-slate-800 cursor-pointer shadow-[1px_1px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all`,children:e.label},r))}),(0,M.jsxs)(`div`,{className:`w-full bg-white border-t-[3px] border-ink-black p-3 sm:px-4 flex items-center gap-2 shrink-0`,children:[(0,M.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:s,disabled:t,placeholder:r,className:`flex-1 bg-[#FFFDF0] border-[2px] border-ink-black rounded-lg px-3.5 py-2 text-xs sm:text-sm font-medium text-ink-black placeholder-slate-400 focus:outline-none focus:border-amber-500 shadow-inner disabled:opacity-50`}),(0,M.jsxs)(`button`,{type:`button`,onClick:o,disabled:t||!i.trim(),className:`px-4 sm:px-5 py-2 bg-[#FFE24C] hover:bg-yellow-300 disabled:opacity-50 border-[2px] border-ink-black rounded-lg font-bold text-xs sm:text-sm text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center gap-1.5 shrink-0`,children:[(0,M.jsx)(D,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Send`})]})]})]})}function L({currentFloor:e,onClose:t}){let n=x(e),r=Math.min(100,Math.round(e/150*100));return(0,M.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/40 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 select-none`,onClick:t,children:(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl p-4 sm:p-5 max-w-md w-full shadow-[6px_6px_0px_0px_#1E293B] flex flex-col gap-3.5`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(C,{className:`w-5 h-5 text-indigo-600`}),(0,M.jsx)(`h4`,{className:`font-headline-md font-bold text-sm text-ink-black m-0`,children:`Journey to the Big-O Spire`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,M.jsx)(i,{className:`w-4 h-4`})})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-bold font-headline-md`,children:[(0,M.jsx)(`span`,{children:`Path Progress:`}),(0,M.jsxs)(`span`,{className:`font-arcade bg-indigo-100 text-indigo-900 px-2 py-0.5 rounded border border-indigo-300`,children:[e,` / 150 Leagues`]})]}),(0,M.jsx)(`div`,{className:`w-full bg-slate-200 h-4 border-[2px] border-ink-black rounded-full overflow-hidden p-0.5`,children:(0,M.jsx)(`div`,{className:`bg-gradient-to-r from-amber-400 via-yellow-400 to-emerald-400 h-full rounded-full transition-all duration-500`,style:{width:`${r}%`}})}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-trash-gray font-medium`,children:[(0,M.jsxs)(`span`,{children:[`Progress: `,(0,M.jsxs)(`strong`,{children:[r,`%`]})]}),(0,M.jsxs)(`span`,{children:[`Distance to Tower: `,(0,M.jsxs)(`strong`,{children:[Math.max(0,150-e),` leagues`]})]})]})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[2px] border-ink-black rounded-lg p-3 shadow-[2px_2px_0px_0px_#1E293B] flex flex-col gap-1`,children:[(0,M.jsx)(`div`,{className:`text-[10px] font-bold uppercase text-amber-700 tracking-wider`,children:`Current Realm:`}),(0,M.jsx)(`div`,{className:`font-bold text-xs text-ink-black`,children:n.title}),(0,M.jsx)(`p`,{className:`text-[11px] text-slate-600 m-0 leading-relaxed font-medium`,children:n.description}),(0,M.jsxs)(`div`,{className:`text-[10px] text-amber-900 bg-amber-50 p-1.5 rounded border border-amber-200 italic mt-1`,children:[`📜 `,n.bgLore]})]}),(0,M.jsx)(`div`,{className:`flex items-center justify-between gap-1 text-center`,children:[{floor:30,label:`Arrays`},{floor:60,label:`Pointers`},{floor:90,label:`Trees`},{floor:120,label:`Heaps`},{floor:150,label:`Spire`}].map(t=>{let n=e>=t.floor;return(0,M.jsxs)(`div`,{className:`flex-1 p-1.5 rounded border text-[10px] flex flex-col items-center ${n?`bg-emerald-100 border-emerald-600 text-emerald-900 font-bold`:`bg-slate-100 border-slate-300 text-slate-500`}`,children:[(0,M.jsx)(`span`,{children:n?`✓`:t.floor}),(0,M.jsx)(`span`,{className:`text-[9px] truncate w-full`,children:t.label})]},t.floor)})}),(0,M.jsx)(`div`,{className:`flex items-center justify-end border-t border-slate-200 pt-2 mt-1`,children:(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-1.5 bg-white hover:bg-slate-100 border-[1.5px] border-ink-black rounded font-bold text-xs text-ink-black cursor-pointer shadow-xs active:translate-y-0.5`,children:`Done`})})]})})}function R({unlockedLetters:e,spireChronicles:t,currentFloor:n,heroCodex:r,episodicEvents:o,recentToolTelemetry:d,onRemoveCodexItem:p,onClose:h}){let[g,_]=(0,k.useState)(`letters`),[v,y]=(0,k.useState)(e[e.length-1]||null);return(0,M.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/50 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 select-none`,onClick:h,children:(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl max-w-lg w-full h-[85%] max-h-[560px] shadow-[6px_6px_0px_0px_#1E293B] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`bg-white border-b-[2px] border-ink-black px-4 py-2.5 flex items-center justify-between shrink-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(E,{className:`w-5 h-5 text-amber-700`}),(0,M.jsx)(`h4`,{className:`font-headline-md font-bold text-sm text-ink-black m-0`,children:`The Royal Satchel`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:h,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,M.jsx)(i,{className:`w-4 h-4`})})]}),(0,M.jsxs)(`div`,{className:`flex border-b-2 border-ink-black bg-amber-100/70 shrink-0`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>_(`letters`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer border-r border-ink-black/20 ${g===`letters`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,M.jsx)(E,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Missives (`,e.length,`/5)`]})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>_(`diary`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer border-r border-ink-black/20 ${g===`diary`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,M.jsx)(f,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Chronicles (`,t.length,`)`]})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>_(`codex`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer ${g===`codex`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,M.jsx)(l,{className:`w-3.5 h-3.5 text-amber-700`}),(0,M.jsx)(`span`,{children:`Codex`})]})]}),(0,M.jsxs)(`div`,{className:`flex-1 p-3 sm:p-4 overflow-y-auto custom-scrollbar flex flex-col gap-3 min-h-0`,children:[g===`letters`&&(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1`,children:[(0,M.jsx)(`div`,{className:`flex items-center gap-1.5 overflow-x-auto pb-1`,children:[30,60,90,120,150].map(e=>{let t=m[e],r=n>=e,i=v?.floor===e;return(0,M.jsxs)(`button`,{type:`button`,disabled:!r,onClick:()=>r&&y(t),className:`px-3 py-1 rounded-full text-[11px] font-bold border-[1.5px] border-ink-black flex items-center gap-1 shrink-0 transition-all cursor-pointer ${r?i?`bg-[#FFE24C] text-ink-black shadow-[1.5px_1.5px_0px_0px_#1E293B]`:`bg-white hover:bg-amber-100 text-slate-800`:`opacity-40 bg-slate-200 text-slate-500 cursor-not-allowed`}`,children:[r?(0,M.jsx)(`span`,{children:`📜`}):(0,M.jsx)(c,{className:`w-3 h-3`}),(0,M.jsxs)(`span`,{children:[`League `,e]})]},e)})}),v?(0,M.jsxs)(`div`,{className:`bg-[#FFF9E6] border-[2px] border-amber-900/40 rounded-lg p-4 shadow-sm flex-1 overflow-y-auto custom-scrollbar flex flex-col select-text`,children:[(0,M.jsxs)(`div`,{className:`border-b border-amber-800/20 pb-2 mb-3 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`text-[10px] font-bold text-amber-800 uppercase tracking-wider`,children:[v.chapterTitle,` • League `,v.floor]}),(0,M.jsx)(`h5`,{className:`font-headline-md font-bold text-sm text-amber-950 m-0`,children:v.title})]}),(0,M.jsx)(`span`,{className:`text-xl`,children:`🪶`})]}),(0,M.jsx)(`p`,{className:`text-xs sm:text-[13px] text-amber-950 font-serif leading-relaxed whitespace-pre-wrap flex-1 italic`,children:v.letterText})]}):(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center p-6 text-slate-500`,children:[(0,M.jsx)(c,{className:`w-8 h-8 mb-2 text-slate-400`}),(0,M.jsx)(`p`,{className:`text-xs font-medium`,children:`Conquer 30 LeetCode problems along the path to receive your first Royal Missive from Aurelia.`})]})]}),g===`diary`&&(0,M.jsx)(`div`,{className:`flex flex-col gap-2.5 flex-1`,children:t.length>0?t.map(e=>(0,M.jsxs)(`div`,{className:`p-3 bg-white border-[1.5px] border-ink-black rounded-lg shadow-xs flex flex-col gap-1 select-text`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-amber-800 font-bold border-b border-slate-100 pb-1`,children:[(0,M.jsxs)(`span`,{children:[`League `,e.floor,` along the Path`]}),(0,M.jsx)(`span`,{children:new Date(e.timestamp).toLocaleDateString()})]}),(0,M.jsxs)(`p`,{className:`text-xs text-ink-black font-medium leading-relaxed m-0 italic font-serif`,children:[`“`,e.text,`”`]})]},e.id)):(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center p-6 text-slate-500`,children:[(0,M.jsx)(f,{className:`w-8 h-8 mb-2 text-slate-400`}),(0,M.jsx)(`p`,{className:`text-xs font-medium`,children:`Aurelia records entries in her Spire Chronicles autonomously as you chat, rest, and cross chapter milestones.`})]})}),g===`codex`&&(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1 select-text`,children:[(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(l,{className:`w-4 h-4 text-amber-600`}),(0,M.jsx)(`h5`,{className:`font-headline-md font-bold text-xs text-ink-black m-0`,children:`Hero Codex (MemGPT & Mem0 Core Memory)`})]}),(0,M.jsx)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:`Cognitive Sync`})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs`,children:[(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2`,children:[(0,M.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Hero Alias`}),(0,M.jsx)(`span`,{className:`font-bold text-ink-black text-xs`,children:r?.heroName||`Champion`})]}),(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2`,children:[(0,M.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Target Goal`}),(0,M.jsx)(`span`,{className:`font-bold text-amber-900 text-xs`,children:r?.targetGoal||`None shared yet (mention to Aurelia!)`})]})]}),r?.preferredLanguage&&(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Weapon of Choice (Language)`}),(0,M.jsx)(`span`,{className:`font-bold text-ink-black`,children:r.preferredLanguage})]})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-emerald-800`,children:[(0,M.jsx)(s,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Mastered Patterns (`,r?.strengths?.length||0,`)`]})]}),r?.strengths&&r.strengths.length>0?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.strengths.map(e=>(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-300`,children:[e,p&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>p(`strengths`,e),className:`hover:text-red-600 ml-0.5 cursor-pointer`,title:`Forget strength`,children:(0,M.jsx)(i,{className:`w-3 h-3`})})]},e))}):(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Aurelia will note topics you conquer during your practice.`})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-rose-800`,children:[(0,M.jsx)(O,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Nemesis Patterns (`,r?.nemesisPatterns?.length||0,`)`]})]}),r?.nemesisPatterns&&r.nemesisPatterns.length>0?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.nemesisPatterns.map(e=>(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-rose-50 text-rose-800 border border-rose-300`,children:[e,p&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>p(`nemesisPatterns`,e),className:`hover:text-red-700 ml-0.5 cursor-pointer`,title:`Forget nemesis`,children:(0,M.jsx)(i,{className:`w-3 h-3`})})]},e))}):(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Aurelia tracks patterns that give you trouble to help you prepare targeted drills.`})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsx)(`div`,{className:`text-xs font-bold text-slate-800`,children:(0,M.jsxs)(`span`,{children:[`Personal Notes & Shared Lore (`,r?.personalNotes?.length||0,`)`]})}),r?.personalNotes&&r.personalNotes.length>0?(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:r.personalNotes.map(e=>(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2 p-2 bg-slate-50 border border-slate-200 rounded text-[11px] text-slate-700`,children:[(0,M.jsxs)(`span`,{children:[`• `,e]}),p&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>p(`personalNotes`,e),className:`text-slate-400 hover:text-red-600 shrink-0 cursor-pointer p-0.5`,title:`Forget note`,children:(0,M.jsx)(a,{className:`w-3 h-3`})})]},e))}):(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Share your background or routine with Aurelia and she will hold it in her memory.`})]}),o&&o.length>0&&(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1`,children:[(0,M.jsx)(`span`,{className:`text-xs font-bold text-slate-800`,children:`Episodic Memory Chain (EM-LLM)`}),(0,M.jsxs)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:[o.length,` events`]})]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-2 max-h-40 overflow-y-auto custom-scrollbar`,children:o.slice(0,8).map(e=>(0,M.jsxs)(`div`,{className:`text-[11px] p-2 bg-[#FFFDF0] border border-amber-900/15 rounded flex flex-col gap-0.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`font-bold text-ink-black uppercase text-[9px] px-1.5 py-0.5 bg-amber-200/60 rounded`,children:e.eventType.replace(`_`,` `)}),(0,M.jsx)(`span`,{className:`text-[10px] text-slate-400`,children:new Date(e.timestamp).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),(0,M.jsx)(`div`,{className:`font-bold text-slate-800 mt-0.5`,children:e.title}),(0,M.jsx)(`div`,{className:`text-slate-600 text-[10px]`,children:e.description})]},e.id))})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-indigo-900`,children:[(0,M.jsx)(u,{className:`w-3.5 h-3.5 text-amber-500`}),(0,M.jsx)(`span`,{children:`Autonomous Enchantment Telemetry`})]}),(0,M.jsxs)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:[d?.length||0,` executed`]})]}),d&&d.length>0?(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5 max-h-36 overflow-y-auto custom-scrollbar`,children:d.slice(0,10).map((e,t)=>(0,M.jsxs)(`div`,{className:`text-[11px] p-2 bg-indigo-50/50 border border-indigo-100 rounded flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,M.jsxs)(`span`,{className:`font-bold text-indigo-950 font-mono text-[10px] truncate`,children:[e.tool_name,`()`]}),e.args&&Object.keys(e.args).length>0&&(0,M.jsx)(`span`,{className:`text-[9px] text-slate-500 truncate`,children:JSON.stringify(e.args).slice(0,50)})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[e.execution_time_ms!==void 0&&(0,M.jsxs)(`span`,{className:`text-[9px] text-slate-400 flex items-center gap-0.5 font-mono`,children:[(0,M.jsx)(w,{className:`w-2.5 h-2.5`}),e.execution_time_ms,`ms`]}),(0,M.jsx)(`span`,{className:`px-1.5 py-0.2 text-[9px] font-bold rounded ${e.success?`bg-emerald-100 text-emerald-800`:`bg-rose-100 text-rose-800`}`,children:e.success?`SUCCESS`:`ERR`})]})]},t))}):(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`No autonomous enchantments executed yet in this session.`})]})]})]}),(0,M.jsx)(`div`,{className:`bg-white border-t border-slate-200 px-4 py-2 flex items-center justify-end shrink-0`,children:(0,M.jsx)(`button`,{type:`button`,onClick:h,className:`px-4 py-1.5 bg-white hover:bg-slate-100 border-[1.5px] border-ink-black rounded font-bold text-xs text-ink-black cursor-pointer shadow-xs active:translate-y-0.5`,children:`Close`})})]})})}var z=n({default:()=>B});function B(){let e=S(),[t,n]=(0,k.useState)(v()),[r,a]=(0,k.useState)(!1),[o,s]=(0,k.useState)(!1),[c,u]=(0,k.useState)(!1);(0,k.useEffect)(()=>{y.syncWithBackend(),y.triggerProactiveGreeting()},[]);let f=()=>{let e=!t;n(e),h(e)},p=()=>{window.confirm(`Clear conversation transcript with Princess Aurelia?`)&&y.clearTranscript()},m=(0,k.useCallback)(e=>{y.setIsTyping(e)},[]),g=(0,k.useMemo)(()=>[...e.transcript].reverse().find(e=>e.sender===`princess`)||e.transcript[0],[e.transcript]);return(0,M.jsxs)(`div`,{className:`relative w-full h-full bg-gradient-to-b from-[#FFFDF0] via-[#FFF9E6] to-[#FFF3CD] flex flex-col select-none font-sans text-ink-black overflow-hidden`,children:[(0,M.jsxs)(`div`,{className:`h-12 bg-white/95 backdrop-blur-sm border-b-[3px] border-ink-black px-3 sm:px-4 flex items-center justify-between gap-2 shrink-0 shadow-sm z-20`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,M.jsx)(l,{className:`w-4 h-4 text-amber-500 shrink-0`}),(0,M.jsx)(`h3`,{className:`font-headline-md font-bold text-xs sm:text-sm text-ink-black m-0 truncate`,children:e.companionSettings.name||`Princess Aurelia`})]}),(0,M.jsx)(`span`,{className:`hidden sm:inline-flex px-2 py-0.5 rounded-full bg-amber-100 border border-amber-300 text-[10px] font-bold text-amber-900 shadow-inner shrink-0`,children:e.bondTier}),(0,M.jsx)(`span`,{className:`hidden md:inline-flex px-2 py-0.5 rounded-full bg-indigo-50 border border-indigo-200 text-[10px] font-bold text-indigo-800 shrink-0`,children:e.currentRhythm.toUpperCase()})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 shrink-0`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`px-2.5 py-1 bg-amber-100 hover:bg-amber-200 border-[2px] border-ink-black rounded font-bold text-[11px] text-ink-black cursor-pointer shadow-[1.5px_1.5px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all flex items-center gap-1.5`,title:`View Spire Journey Progress`,children:[(0,M.jsx)(C,{className:`w-3.5 h-3.5 text-indigo-700`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[9px] text-indigo-950`,children:[e.currentFloor,`/150 LC`]})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`px-2.5 py-1 bg-white hover:bg-amber-50 border-[2px] border-ink-black rounded font-bold text-[11px] text-ink-black cursor-pointer shadow-[1.5px_1.5px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all flex items-center gap-1.5`,title:`Open Royal Satchel (Missives & Diary)`,children:[(0,M.jsx)(E,{className:`w-3.5 h-3.5 text-amber-700`}),(0,M.jsx)(`span`,{className:`hidden md:inline`,children:`Satchel`}),e.unlockedLetters.length>0&&(0,M.jsx)(`span`,{className:`w-4 h-4 rounded-full bg-amber-400 text-ink-black text-[9px] font-extrabold flex items-center justify-center border border-ink-black`,children:e.unlockedLetters.length})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(!0),className:`p-1.5 bg-white hover:bg-slate-100 border-[2px] border-ink-black rounded text-ink-black cursor-pointer shadow-[1.5px_1.5px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all`,title:`View Transcript History`,children:(0,M.jsx)(T,{className:`w-3.5 h-3.5 text-slate-700`})}),(0,M.jsx)(`button`,{type:`button`,onClick:f,className:`p-1.5 border-[2px] border-ink-black rounded text-ink-black cursor-pointer shadow-[1.5px_1.5px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all ${t?`bg-slate-200 opacity-80`:`bg-[#FFE24C] hover:bg-yellow-300`}`,title:t?`Unmute Audio`:`Mute Audio`,children:t?(0,M.jsx)(b,{className:`w-3.5 h-3.5`}):(0,M.jsx)(d,{className:`w-3.5 h-3.5`})})]})]}),(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-start gap-3 sm:gap-4 p-3 sm:p-5 overflow-y-auto custom-scrollbar min-h-0 relative`,children:[(0,M.jsx)(N,{emotion:e.activeEmotion,floor:e.currentFloor,rhythm:e.currentRhythm,activity:e.currentActivity,isLoading:e.isLoading}),(0,M.jsx)(P,{text:g?.text||`I believe in you, champion!`,characterName:e.companionSettings.name,emotion:e.activeEmotion,isLoading:e.isLoading,isStreaming:g?.isStreaming,toolCalls:g?.toolCalls,onTypingStatusChange:m})]}),(0,M.jsx)(I,{suggestions:g?.choiceSuggestions,isLoading:e.isLoading,onSendMessage:e=>y.sendMessage(e),placeholder:`Speak with ${e.companionSettings.name||`Princess Aurelia`}...`}),r&&(0,M.jsx)(L,{currentFloor:e.currentFloor,totalSolved:e.totalSolved,onClose:()=>a(!1)}),o&&(0,M.jsx)(R,{unlockedLetters:e.unlockedLetters,spireChronicles:e.spireChronicles,currentFloor:e.currentFloor,heroCodex:e.heroCodex,episodicEvents:e.episodicEvents,recentToolTelemetry:e.recentToolTelemetry,onRemoveCodexItem:y.removeCodexItem,onClose:()=>s(!1)}),c&&(0,M.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/40 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200`,onClick:()=>u(!1),children:(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl max-w-lg w-full h-[80%] max-h-[520px] shadow-[6px_6px_0px_0px_#1E293B] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`bg-white border-b-[2px] border-ink-black px-4 py-2.5 flex items-center justify-between shrink-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(T,{className:`w-4 h-4 text-ink-black`}),(0,M.jsxs)(`h4`,{className:`font-headline-md font-bold text-xs sm:text-sm text-ink-black m-0`,children:[`Dialogue Transcript (`,e.transcript.length,` turns)`]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:p,className:`p-1 hover:bg-rose-100 text-rose-700 rounded text-[11px] font-bold flex items-center gap-1 cursor-pointer mr-1`,title:`Clear Chat History`,children:[(0,M.jsx)(_,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Clear`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(!1),className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,M.jsx)(i,{className:`w-4 h-4`})})]})]}),(0,M.jsx)(`div`,{className:`flex-1 p-3 sm:p-4 overflow-y-auto custom-scrollbar flex flex-col gap-2.5`,children:e.transcript.map((t,n)=>(0,M.jsxs)(`div`,{className:`p-2.5 rounded-lg border-[2px] border-ink-black shadow-[2px_2px_0px_0px_#1E293B] max-w-[90%] ${t.sender===`princess`?`bg-white text-ink-black self-start`:`bg-[#FFE24C] text-ink-black self-end`}`,children:[(0,M.jsx)(`div`,{className:`text-[10px] font-bold font-headline-md mb-1 text-slate-600`,children:t.sender===`princess`?e.companionSettings.name:`Hero`}),(0,M.jsx)(`p`,{className:`text-xs font-medium m-0 leading-relaxed whitespace-pre-wrap select-text`,children:t.text})]},t.id||n))})]})})]})}export{z as t};
|
|
|
|
| 1 |
+
import{a as e,c as t,s as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import{C as i,D as a,H as o,I as s,N as c,O as l,S as u,T as d,V as f,_ as p,b as m,g as h,h as g,j as _,m as v,v as y,w as b,x,y as S}from"./index-CPCBFJ0E.js";var C=o(`castle`,[[`path`,{d:`M10 5V3`,key:`1y54qe`}],[`path`,{d:`M14 5V3`,key:`m6isi`}],[`path`,{d:`M15 21v-3a3 3 0 0 0-6 0v3`,key:`lbp5hj`}],[`path`,{d:`M18 3v8`,key:`2ollhf`}],[`path`,{d:`M18 5H6`,key:`98imr9`}],[`path`,{d:`M22 11H2`,key:`1lmjae`}],[`path`,{d:`M22 9v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9`,key:`1rly83`}],[`path`,{d:`M6 3v8`,key:`csox7g`}]]),w=o(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),T=o(`rotate-ccw-clock`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),E=o(`scroll`,[[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),D=o(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),O=o(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),k=t(e(),1),A={1:{particleType:`pollen`,particleCount:16,particleColors:[`#FDE047`,`#FEF08A`,`#86EFAC`],gradientBg:`from-[#FFFDF0] via-[#FFF9E6] to-[#FEF3C7]`,glowColor:`rgba(251, 191, 36, 0.3)`,badgeLabel:`🌾 Plains Breeze`},2:{particleType:`leaves`,particleCount:18,particleColors:[`#86EFAC`,`#4ADE80`,`#22C55E`,`#A7F3D0`],gradientBg:`from-[#F0FDF4] via-[#DCFCE7] to-[#FEF9C3]`,glowColor:`rgba(34, 197, 94, 0.3)`,badgeLabel:`🍃 Whispering Leaves`},3:{particleType:`spores`,particleCount:22,particleColors:[`#67E8F9`,`#38BDF8`,`#818CF8`,`#C084FC`],gradientBg:`from-[#F0F9FF] via-[#E0F2FE] to-[#EDE9FE]`,glowColor:`rgba(56, 189, 248, 0.35)`,badgeLabel:`✨ Crystal Spores`},4:{particleType:`snow`,particleCount:28,particleColors:[`#FFFFFF`,`#E0F2FE`,`#BAE6FD`],gradientBg:`from-[#F8FAFC] via-[#F1F5F9] to-[#E2E8F0]`,glowColor:`rgba(186, 230, 253, 0.4)`,badgeLabel:`❄️ Alpine Snowfall`},5:{particleType:`runes`,particleCount:20,particleColors:[`#E879F9`,`#C084FC`,`#A855F7`,`#F472B6`],gradientBg:`from-[#FAF5FF] via-[#F3E8FF] to-[#FCE7F3]`,glowColor:`rgba(192, 132, 252, 0.4)`,badgeLabel:`🔮 Arcane Runes`},6:{particleType:`stardust`,particleCount:35,particleColors:[`#FDE047`,`#F59E0B`,`#E11D48`,`#818CF8`],gradientBg:`from-[#FFFBEB] via-[#FEF3C7] to-[#FFE4E6]`,glowColor:`rgba(245, 158, 11, 0.5)`,badgeLabel:`👑 Spire Gates`}};function j(e){return e<=30?A[1]:e<=60?A[2]:e<=90?A[3]:e<=120?A[4]:e<150?A[5]:A[6]}var M=r();function N({emotion:e,floor:t,rhythm:n,activity:r,isLoading:i=!1}){let a=p[e]||p.smiling_warmly,o=(0,k.useMemo)(()=>j(t),[t]),s=(0,k.useMemo)(()=>{switch(n){case`dawn`:return`from-amber-400/40 via-yellow-300/30 to-rose-300/20`;case`dusk`:return`from-orange-400/40 via-purple-400/30 to-amber-300/20`;case`night`:return`from-indigo-600/40 via-blue-500/30 to-amber-500/20`;default:return`from-amber-400/30 via-yellow-300/40 to-indigo-400/30`}},[n]);return(0,M.jsxs)(`div`,{className:`relative flex flex-col items-center justify-center my-auto w-full max-w-xl`,children:[(0,M.jsx)(`div`,{className:`absolute -inset-10 overflow-hidden pointer-events-none z-0`,children:Array.from({length:Math.min(18,o.particleCount)}).map((e,t)=>{let n=o.particleColors[t%o.particleColors.length],r=`${t*19%100}%`,i=`${6+t%5*2}s`,a=`${t*.7%4}s`,s=o.particleType===`leaves`||o.particleType===`runes`?`w-2.5 h-2.5`:`w-1.5 h-1.5`;return(0,M.jsx)(`span`,{className:`absolute rounded-full opacity-65 animate-pulse ${s}`,style:{backgroundColor:n,left:r,top:`${t*23%90}%`,boxShadow:`0 0 8px ${n}`,animationDuration:i,animationDelay:a}},t)})}),(0,M.jsxs)(`div`,{className:`relative group z-10`,children:[(0,M.jsx)(`div`,{className:`absolute -inset-2 bg-gradient-to-r ${s} rounded-2xl blur-md opacity-80 group-hover:opacity-100 transition duration-500`}),(0,M.jsxs)(`div`,{className:`relative w-36 h-44 sm:w-44 sm:h-52 bg-gradient-to-b from-amber-100 to-amber-200 border-[3px] border-ink-black rounded-xl overflow-hidden shadow-[4px_4px_0px_0px_#1E293B] transition-transform duration-300 flex items-center justify-center`,children:[(0,M.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center text-amber-700/40 pointer-events-none select-none`,children:[(0,M.jsx)(l,{className:`w-8 h-8 animate-pulse`}),(0,M.jsx)(`span`,{className:`font-arcade text-[10px] mt-2`,children:`Princess Aurelia`})]}),(0,M.jsx)(`img`,{src:a.imagePath,alt:a.label,loading:`eager`,className:`w-full h-full object-cover object-top transition-all duration-300 relative z-10 ${i?`scale-105 filter saturate-125`:`scale-100`}`,onError:e=>{let t=e.currentTarget;t.src.endsWith(`/sprites/princess/neutral.png`)?t.style.display=`none`:t.src=`/sprites/princess/neutral.png`}}),(0,M.jsxs)(`div`,{className:`absolute bottom-0 inset-x-0 bg-ink-black/85 backdrop-blur-xs text-[10px] text-amber-300 py-1 px-2 font-bold uppercase tracking-wider text-center flex items-center justify-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full ${i?`bg-amber-400 animate-ping`:`bg-emerald-400`}`}),(0,M.jsx)(`span`,{children:i?`Pondering...`:a.label})]})]}),(0,M.jsx)(`div`,{className:`absolute -top-2 -right-2 bg-[#FFE24C] border-[2px] border-ink-black rounded-full p-1 shadow-[2px_2px_0px_0px_#1E293B]`,children:(0,M.jsx)(l,{className:`w-3.5 h-3.5 text-amber-800`})})]}),r&&(0,M.jsx)(`div`,{className:`mt-2 text-center max-w-sm px-2`,children:(0,M.jsxs)(`span`,{className:`text-[10px] font-semibold text-slate-700 bg-white/85 px-2.5 py-0.5 rounded-full border border-ink-black/20 shadow-xs inline-flex items-center gap-1`,children:[(0,M.jsx)(`span`,{children:`🏰`}),(0,M.jsx)(`span`,{className:`truncate`,children:r})]})})]})}function P({text:e,characterName:t,emotion:n,isLoading:r=!1,isStreaming:i=!1,toolCalls:a,onTypingStatusChange:o}){let[s,c]=(0,k.useState)(e),[l,u]=(0,k.useState)(!1),d=(0,k.useRef)(null),f=(0,k.useRef)(e),m=(0,k.useRef)(0),h=(0,k.useRef)(o);(0,k.useEffect)(()=>{h.current=o},[o]);let _=p[n]||p.smiling_warmly,v=e=>{u(e),h.current?.(e)};return(0,k.useEffect)(()=>{if(i){d.current&&clearInterval(d.current),c(e),v(!0),e.length-m.current>=4&&(m.current=e.length,g(e.length)),f.current=e;return}if(e!==f.current&&!r){let t=f.current.length>0&&e.startsWith(f.current);if(f.current=e,d.current&&clearInterval(d.current),t)c(e),v(!1);else{c(``),v(!0);let t=0;d.current=setInterval(()=>{t<e.length?(t++,c(e.slice(0,t)),t%2==0&&e[t-1]!==` `&&g(t)):(d.current&&clearInterval(d.current),v(!1))},22)}}else!r&&e===f.current&&!i&&(c(e),l&&v(!1));return()=>{d.current&&clearInterval(d.current)}},[e,r,i]),(0,M.jsxs)(`div`,{onClick:()=>{l&&(d.current&&clearInterval(d.current),c(e),v(!1))},className:`w-full max-w-xl mt-3 sm:mt-4 relative bg-white border-[3px] border-ink-black rounded-xl p-3.5 sm:p-4 shadow-[4px_4px_0px_0px_#1E293B] transition-all cursor-pointer group select-text`,children:[(0,M.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 w-0 h-0 border-x-8 border-x-transparent border-b-8 border-b-ink-black pointer-events-none`}),(0,M.jsx)(`div`,{className:`absolute -top-2 left-1/2 -translate-x-1/2 w-0 h-0 border-x-6 border-x-transparent border-b-6 border-b-white pointer-events-none`}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-amber-100 pb-1.5 mb-2 select-none`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsxs)(`span`,{className:`font-headline-md font-bold text-xs text-amber-900 flex items-center gap-1`,children:[`👑 `,t||`Princess Aurelia`]}),(0,M.jsx)(`span`,{className:`text-[9px] bg-amber-100 text-amber-800 font-bold px-1.5 py-0.2 rounded border border-amber-200`,children:_.label})]}),l&&(0,M.jsx)(`span`,{className:`text-[9px] text-trash-gray font-medium animate-pulse`,children:`Click bubble to skip`})]}),r?(0,M.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs font-medium text-trash-gray select-none`,children:[(0,M.jsx)(`span`,{className:`inline-block w-2 h-2 bg-amber-500 rounded-full animate-bounce`}),(0,M.jsx)(`span`,{className:`inline-block w-2 h-2 bg-amber-500 rounded-full animate-bounce [animation-delay:0.2s]`}),(0,M.jsx)(`span`,{className:`inline-block w-2 h-2 bg-amber-500 rounded-full animate-bounce [animation-delay:0.4s]`}),(0,M.jsxs)(`span`,{className:`ml-1 text-slate-600`,children:[t||`Princess Aurelia`,` is attuning the crystal relay...`]})]}):(0,M.jsxs)(`div`,{className:`text-xs sm:text-[13px] text-ink-black font-medium leading-relaxed whitespace-pre-wrap`,children:[(e=>e.split(/(\*[^*]+\*)/g).map((e,t)=>e.startsWith(`*`)&&e.endsWith(`*`)?(0,M.jsx)(`span`,{className:`text-amber-700 italic font-semibold mr-1 inline-block`,children:e},t):(0,M.jsx)(`span`,{children:e},t)))(s),l&&(0,M.jsx)(`span`,{className:`inline-block w-1.5 h-3.5 bg-amber-500 ml-1 animate-pulse align-middle`})]}),a&&a.length>0&&!r&&(0,M.jsx)(`div`,{className:`mt-2.5 pt-2 border-t border-amber-100/80 flex flex-wrap gap-1.5 select-none`,children:a.map((e,t)=>{let n=`✨ Enchantment: ${e.name}`;return e.name===`open_app_window`&&(n=`📜 Summoned: ${e.args?.window_id||`Grimoire`}`),e.name===`set_study_timer`&&(n=`⏳ Hourglass: ${e.args?.minutes||15}m rest`),e.name===`play_ambient_sound`&&(n=`🔥 Kindled: ${e.args?.soundscape||`Soundscape`}`),e.name===`write_spire_diary`&&(n=`📖 Chronicled in Spire Diary`),(0,M.jsx)(`span`,{className:`px-2 py-0.5 rounded-full bg-indigo-50 border border-indigo-200 text-[10px] font-bold text-indigo-800 flex items-center gap-1 shadow-xs`,children:(0,M.jsx)(`span`,{children:n})},t)})})]})}var F=[{label:`💪 Solved a Tough One`,prompt:`I just solved a really tough problem! Felt so good getting all test cases to pass.`},{label:`😩 Feeling Stuck`,prompt:`I feel really stuck and discouraged today. It feels like everyone else gets this except me.`},{label:`☕ Need a Breather`,prompt:`My brain is pretty fried from practicing today. Can we just take a short breather?`},{label:`🌙 Life Beyond the Tower`,prompt:`What’s the first thing you want to do once we break the seals and get you out of that tower?`}];function I({suggestions:e,isLoading:t=!1,onSendMessage:n,placeholder:r=`Speak with Princess Aurelia...`}){let[i,a]=(0,k.useState)(``),o=()=>{let e=i.trim();e&&!t&&(n(e),a(``))},s=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),o())},c=Array.isArray(e)&&e.length>0;return(0,M.jsxs)(`div`,{className:`w-full flex flex-col items-center gap-2 select-none z-10`,children:[(0,M.jsx)(`div`,{className:`w-full max-w-xl flex items-center justify-center gap-1.5 flex-wrap py-1.5 px-2`,children:c?e.map((e,r)=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e),disabled:t,className:`px-2.5 py-1 bg-white hover:bg-amber-100 disabled:opacity-50 border-[1.5px] border-ink-black rounded-full text-[10px] sm:text-[11px] font-bold text-slate-800 cursor-pointer shadow-[1px_1px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all flex items-center gap-1`,children:[(0,M.jsx)(l,{className:`w-3 h-3 text-amber-600 shrink-0`}),(0,M.jsx)(`span`,{className:`truncate max-w-[200px]`,children:e})]},r)):F.map((e,r)=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>n(e.prompt),disabled:t,className:`px-2.5 py-1 bg-white hover:bg-amber-100 disabled:opacity-50 border-[1.5px] border-ink-black rounded-full text-[10px] sm:text-[11px] font-bold text-slate-800 cursor-pointer shadow-[1px_1px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all`,children:e.label},r))}),(0,M.jsxs)(`div`,{className:`w-full bg-white border-t-[3px] border-ink-black p-3 sm:px-4 flex items-center gap-2 shrink-0`,children:[(0,M.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:s,disabled:t,placeholder:r,className:`flex-1 bg-[#FFFDF0] border-[2px] border-ink-black rounded-lg px-3.5 py-2 text-xs sm:text-sm font-medium text-ink-black placeholder-slate-400 focus:outline-none focus:border-amber-500 shadow-inner disabled:opacity-50`}),(0,M.jsxs)(`button`,{type:`button`,onClick:o,disabled:t||!i.trim(),className:`px-4 sm:px-5 py-2 bg-[#FFE24C] hover:bg-yellow-300 disabled:opacity-50 border-[2px] border-ink-black rounded-lg font-bold text-xs sm:text-sm text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer flex items-center gap-1.5 shrink-0`,children:[(0,M.jsx)(D,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Send`})]})]})]})}function L({currentFloor:e,onClose:t}){let n=x(e),r=Math.min(100,Math.round(e/150*100));return(0,M.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/40 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 select-none`,onClick:t,children:(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl p-4 sm:p-5 max-w-md w-full shadow-[6px_6px_0px_0px_#1E293B] flex flex-col gap-3.5`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(C,{className:`w-5 h-5 text-indigo-600`}),(0,M.jsx)(`h4`,{className:`font-headline-md font-bold text-sm text-ink-black m-0`,children:`Journey to the Big-O Spire`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,M.jsx)(i,{className:`w-4 h-4`})})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-xs font-bold font-headline-md`,children:[(0,M.jsx)(`span`,{children:`Path Progress:`}),(0,M.jsxs)(`span`,{className:`font-arcade bg-indigo-100 text-indigo-900 px-2 py-0.5 rounded border border-indigo-300`,children:[e,` / 150 Leagues`]})]}),(0,M.jsx)(`div`,{className:`w-full bg-slate-200 h-4 border-[2px] border-ink-black rounded-full overflow-hidden p-0.5`,children:(0,M.jsx)(`div`,{className:`bg-gradient-to-r from-amber-400 via-yellow-400 to-emerald-400 h-full rounded-full transition-all duration-500`,style:{width:`${r}%`}})}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-trash-gray font-medium`,children:[(0,M.jsxs)(`span`,{children:[`Progress: `,(0,M.jsxs)(`strong`,{children:[r,`%`]})]}),(0,M.jsxs)(`span`,{children:[`Distance to Tower: `,(0,M.jsxs)(`strong`,{children:[Math.max(0,150-e),` leagues`]})]})]})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[2px] border-ink-black rounded-lg p-3 shadow-[2px_2px_0px_0px_#1E293B] flex flex-col gap-1`,children:[(0,M.jsx)(`div`,{className:`text-[10px] font-bold uppercase text-amber-700 tracking-wider`,children:`Current Realm:`}),(0,M.jsx)(`div`,{className:`font-bold text-xs text-ink-black`,children:n.title}),(0,M.jsx)(`p`,{className:`text-[11px] text-slate-600 m-0 leading-relaxed font-medium`,children:n.description}),(0,M.jsxs)(`div`,{className:`text-[10px] text-amber-900 bg-amber-50 p-1.5 rounded border border-amber-200 italic mt-1`,children:[`📜 `,n.bgLore]})]}),(0,M.jsx)(`div`,{className:`flex items-center justify-between gap-1 text-center`,children:[{floor:30,label:`Arrays`},{floor:60,label:`Pointers`},{floor:90,label:`Trees`},{floor:120,label:`Heaps`},{floor:150,label:`Spire`}].map(t=>{let n=e>=t.floor;return(0,M.jsxs)(`div`,{className:`flex-1 p-1.5 rounded border text-[10px] flex flex-col items-center ${n?`bg-emerald-100 border-emerald-600 text-emerald-900 font-bold`:`bg-slate-100 border-slate-300 text-slate-500`}`,children:[(0,M.jsx)(`span`,{children:n?`✓`:t.floor}),(0,M.jsx)(`span`,{className:`text-[9px] truncate w-full`,children:t.label})]},t.floor)})}),(0,M.jsx)(`div`,{className:`flex items-center justify-end border-t border-slate-200 pt-2 mt-1`,children:(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`px-4 py-1.5 bg-white hover:bg-slate-100 border-[1.5px] border-ink-black rounded font-bold text-xs text-ink-black cursor-pointer shadow-xs active:translate-y-0.5`,children:`Done`})})]})})}function R({unlockedLetters:e,spireChronicles:t,currentFloor:n,heroCodex:r,episodicEvents:o,recentToolTelemetry:d,onRemoveCodexItem:p,onClose:h}){let[g,_]=(0,k.useState)(`letters`),[v,y]=(0,k.useState)(e[e.length-1]||null);return(0,M.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/50 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200 select-none`,onClick:h,children:(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl max-w-lg w-full h-[85%] max-h-[560px] shadow-[6px_6px_0px_0px_#1E293B] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`bg-white border-b-[2px] border-ink-black px-4 py-2.5 flex items-center justify-between shrink-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(E,{className:`w-5 h-5 text-amber-700`}),(0,M.jsx)(`h4`,{className:`font-headline-md font-bold text-sm text-ink-black m-0`,children:`The Royal Satchel`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:h,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,M.jsx)(i,{className:`w-4 h-4`})})]}),(0,M.jsxs)(`div`,{className:`flex border-b-2 border-ink-black bg-amber-100/70 shrink-0`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>_(`letters`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer border-r border-ink-black/20 ${g===`letters`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,M.jsx)(E,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Missives (`,e.length,`/5)`]})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>_(`diary`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer border-r border-ink-black/20 ${g===`diary`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,M.jsx)(f,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Chronicles (`,t.length,`)`]})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>_(`codex`),className:`flex-1 py-2 text-xs font-bold font-headline-md flex items-center justify-center gap-1.5 transition-colors cursor-pointer ${g===`codex`?`bg-[#FFFDF0] text-amber-950 border-b-2 border-b-[#FFFDF0] -mb-[2px]`:`text-slate-600 hover:bg-amber-200/50`}`,children:[(0,M.jsx)(l,{className:`w-3.5 h-3.5 text-amber-700`}),(0,M.jsx)(`span`,{children:`Codex`})]})]}),(0,M.jsxs)(`div`,{className:`flex-1 p-3 sm:p-4 overflow-y-auto custom-scrollbar flex flex-col gap-3 min-h-0`,children:[g===`letters`&&(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1`,children:[(0,M.jsx)(`div`,{className:`flex items-center gap-1.5 overflow-x-auto pb-1`,children:[30,60,90,120,150].map(e=>{let t=m[e],r=n>=e,i=v?.floor===e;return(0,M.jsxs)(`button`,{type:`button`,disabled:!r,onClick:()=>r&&y(t),className:`px-3 py-1 rounded-full text-[11px] font-bold border-[1.5px] border-ink-black flex items-center gap-1 shrink-0 transition-all cursor-pointer ${r?i?`bg-[#FFE24C] text-ink-black shadow-[1.5px_1.5px_0px_0px_#1E293B]`:`bg-white hover:bg-amber-100 text-slate-800`:`opacity-40 bg-slate-200 text-slate-500 cursor-not-allowed`}`,children:[r?(0,M.jsx)(`span`,{children:`📜`}):(0,M.jsx)(c,{className:`w-3 h-3`}),(0,M.jsxs)(`span`,{children:[`League `,e]})]},e)})}),v?(0,M.jsxs)(`div`,{className:`bg-[#FFF9E6] border-[2px] border-amber-900/40 rounded-lg p-4 shadow-sm flex-1 overflow-y-auto custom-scrollbar flex flex-col select-text`,children:[(0,M.jsxs)(`div`,{className:`border-b border-amber-800/20 pb-2 mb-3 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`text-[10px] font-bold text-amber-800 uppercase tracking-wider`,children:[v.chapterTitle,` • League `,v.floor]}),(0,M.jsx)(`h5`,{className:`font-headline-md font-bold text-sm text-amber-950 m-0`,children:v.title})]}),(0,M.jsx)(`span`,{className:`text-xl`,children:`🪶`})]}),(0,M.jsx)(`p`,{className:`text-xs sm:text-[13px] text-amber-950 font-serif leading-relaxed whitespace-pre-wrap flex-1 italic`,children:v.letterText})]}):(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center p-6 text-slate-500`,children:[(0,M.jsx)(c,{className:`w-8 h-8 mb-2 text-slate-400`}),(0,M.jsx)(`p`,{className:`text-xs font-medium`,children:`Conquer 30 LeetCode problems along the path to receive your first Royal Missive from Aurelia.`})]})]}),g===`diary`&&(0,M.jsx)(`div`,{className:`flex flex-col gap-2.5 flex-1`,children:t.length>0?t.map(e=>(0,M.jsxs)(`div`,{className:`p-3 bg-white border-[1.5px] border-ink-black rounded-lg shadow-xs flex flex-col gap-1 select-text`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-amber-800 font-bold border-b border-slate-100 pb-1`,children:[(0,M.jsxs)(`span`,{children:[`League `,e.floor,` along the Path`]}),(0,M.jsx)(`span`,{children:new Date(e.timestamp).toLocaleDateString()})]}),(0,M.jsxs)(`p`,{className:`text-xs text-ink-black font-medium leading-relaxed m-0 italic font-serif`,children:[`“`,e.text,`”`]})]},e.id)):(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center p-6 text-slate-500`,children:[(0,M.jsx)(f,{className:`w-8 h-8 mb-2 text-slate-400`}),(0,M.jsx)(`p`,{className:`text-xs font-medium`,children:`Aurelia records entries in her Spire Chronicles autonomously as you chat, rest, and cross chapter milestones.`})]})}),g===`codex`&&(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1 select-text`,children:[(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(l,{className:`w-4 h-4 text-amber-600`}),(0,M.jsx)(`h5`,{className:`font-headline-md font-bold text-xs text-ink-black m-0`,children:`Hero Codex (MemGPT & Mem0 Core Memory)`})]}),(0,M.jsx)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:`Cognitive Sync`})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs`,children:[(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2`,children:[(0,M.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Hero Alias`}),(0,M.jsx)(`span`,{className:`font-bold text-ink-black text-xs`,children:r?.heroName||`Champion`})]}),(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2`,children:[(0,M.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Target Goal`}),(0,M.jsx)(`span`,{className:`font-bold text-amber-900 text-xs`,children:r?.targetGoal||`None shared yet (mention to Aurelia!)`})]})]}),r?.preferredLanguage&&(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border border-amber-900/20 rounded p-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-[10px] font-bold text-slate-500 uppercase tracking-wider block`,children:`Weapon of Choice (Language)`}),(0,M.jsx)(`span`,{className:`font-bold text-ink-black`,children:r.preferredLanguage})]})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-emerald-800`,children:[(0,M.jsx)(s,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Mastered Patterns (`,r?.strengths?.length||0,`)`]})]}),r?.strengths&&r.strengths.length>0?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.strengths.map(e=>(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-emerald-50 text-emerald-800 border border-emerald-300`,children:[e,p&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>p(`strengths`,e),className:`hover:text-red-600 ml-0.5 cursor-pointer`,title:`Forget strength`,children:(0,M.jsx)(i,{className:`w-3 h-3`})})]},e))}):(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Aurelia will note topics you conquer during your practice.`})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-rose-800`,children:[(0,M.jsx)(O,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Nemesis Patterns (`,r?.nemesisPatterns?.length||0,`)`]})]}),r?.nemesisPatterns&&r.nemesisPatterns.length>0?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.nemesisPatterns.map(e=>(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[11px] font-bold bg-rose-50 text-rose-800 border border-rose-300`,children:[e,p&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>p(`nemesisPatterns`,e),className:`hover:text-red-700 ml-0.5 cursor-pointer`,title:`Forget nemesis`,children:(0,M.jsx)(i,{className:`w-3 h-3`})})]},e))}):(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Aurelia tracks patterns that give you trouble to help you prepare targeted drills.`})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsx)(`div`,{className:`text-xs font-bold text-slate-800`,children:(0,M.jsxs)(`span`,{children:[`Personal Notes & Shared Lore (`,r?.personalNotes?.length||0,`)`]})}),r?.personalNotes&&r.personalNotes.length>0?(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:r.personalNotes.map(e=>(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2 p-2 bg-slate-50 border border-slate-200 rounded text-[11px] text-slate-700`,children:[(0,M.jsxs)(`span`,{children:[`• `,e]}),p&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>p(`personalNotes`,e),className:`text-slate-400 hover:text-red-600 shrink-0 cursor-pointer p-0.5`,title:`Forget note`,children:(0,M.jsx)(a,{className:`w-3 h-3`})})]},e))}):(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`Share your background or routine with Aurelia and she will hold it in her memory.`})]}),o&&o.length>0&&(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1`,children:[(0,M.jsx)(`span`,{className:`text-xs font-bold text-slate-800`,children:`Episodic Memory Chain (EM-LLM)`}),(0,M.jsxs)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:[o.length,` events`]})]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-2 max-h-40 overflow-y-auto custom-scrollbar`,children:o.slice(0,8).map(e=>(0,M.jsxs)(`div`,{className:`text-[11px] p-2 bg-[#FFFDF0] border border-amber-900/15 rounded flex flex-col gap-0.5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`font-bold text-ink-black uppercase text-[9px] px-1.5 py-0.5 bg-amber-200/60 rounded`,children:e.eventType.replace(`_`,` `)}),(0,M.jsx)(`span`,{className:`text-[10px] text-slate-400`,children:new Date(e.timestamp).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),(0,M.jsx)(`div`,{className:`font-bold text-slate-800 mt-0.5`,children:e.title}),(0,M.jsx)(`div`,{className:`text-slate-600 text-[10px]`,children:e.description})]},e.id))})]}),(0,M.jsxs)(`div`,{className:`bg-white border-[1.5px] border-ink-black rounded-lg p-3 shadow-xs flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-slate-100 pb-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold text-indigo-900`,children:[(0,M.jsx)(u,{className:`w-3.5 h-3.5 text-amber-500`}),(0,M.jsx)(`span`,{children:`Autonomous Enchantment Telemetry`})]}),(0,M.jsxs)(`span`,{className:`text-[10px] text-slate-400 font-mono`,children:[d?.length||0,` executed`]})]}),d&&d.length>0?(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5 max-h-36 overflow-y-auto custom-scrollbar`,children:d.slice(0,10).map((e,t)=>(0,M.jsxs)(`div`,{className:`text-[11px] p-2 bg-indigo-50/50 border border-indigo-100 rounded flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col min-w-0`,children:[(0,M.jsxs)(`span`,{className:`font-bold text-indigo-950 font-mono text-[10px] truncate`,children:[e.tool_name,`()`]}),e.args&&Object.keys(e.args).length>0&&(0,M.jsx)(`span`,{className:`text-[9px] text-slate-500 truncate`,children:JSON.stringify(e.args).slice(0,50)})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[e.execution_time_ms!==void 0&&(0,M.jsxs)(`span`,{className:`text-[9px] text-slate-400 flex items-center gap-0.5 font-mono`,children:[(0,M.jsx)(w,{className:`w-2.5 h-2.5`}),e.execution_time_ms,`ms`]}),(0,M.jsx)(`span`,{className:`px-1.5 py-0.2 text-[9px] font-bold rounded ${e.success?`bg-emerald-100 text-emerald-800`:`bg-rose-100 text-rose-800`}`,children:e.success?`SUCCESS`:`ERR`})]})]},t))}):(0,M.jsx)(`p`,{className:`text-[11px] text-slate-400 italic m-0`,children:`No autonomous enchantments executed yet in this session.`})]})]})]}),(0,M.jsx)(`div`,{className:`bg-white border-t border-slate-200 px-4 py-2 flex items-center justify-end shrink-0`,children:(0,M.jsx)(`button`,{type:`button`,onClick:h,className:`px-4 py-1.5 bg-white hover:bg-slate-100 border-[1.5px] border-ink-black rounded font-bold text-xs text-ink-black cursor-pointer shadow-xs active:translate-y-0.5`,children:`Close`})})]})})}var z=n({default:()=>B});function B(){let e=S(),[t,n]=(0,k.useState)(v()),[r,a]=(0,k.useState)(!1),[o,s]=(0,k.useState)(!1),[c,u]=(0,k.useState)(!1);(0,k.useEffect)(()=>{y.syncWithBackend(),y.triggerProactiveGreeting()},[]);let f=()=>{let e=!t;n(e),h(e)},p=()=>{window.confirm(`Clear conversation transcript with Princess Aurelia?`)&&y.clearTranscript()},m=(0,k.useCallback)(e=>{y.setIsTyping(e)},[]),g=(0,k.useMemo)(()=>[...e.transcript].reverse().find(e=>e.sender===`princess`)||e.transcript[0],[e.transcript]);return(0,M.jsxs)(`div`,{className:`relative w-full h-full bg-gradient-to-b from-[#FFFDF0] via-[#FFF9E6] to-[#FFF3CD] flex flex-col select-none font-sans text-ink-black overflow-hidden`,children:[(0,M.jsxs)(`div`,{className:`h-12 bg-white/95 backdrop-blur-sm border-b-[3px] border-ink-black px-3 sm:px-4 flex items-center justify-between gap-2 shrink-0 shadow-sm z-20`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,M.jsx)(l,{className:`w-4 h-4 text-amber-500 shrink-0`}),(0,M.jsx)(`h3`,{className:`font-headline-md font-bold text-xs sm:text-sm text-ink-black m-0 truncate`,children:e.companionSettings.name||`Princess Aurelia`})]}),(0,M.jsx)(`span`,{className:`hidden sm:inline-flex px-2 py-0.5 rounded-full bg-amber-100 border border-amber-300 text-[10px] font-bold text-amber-900 shadow-inner shrink-0`,children:e.bondTier}),(0,M.jsx)(`span`,{className:`hidden md:inline-flex px-2 py-0.5 rounded-full bg-indigo-50 border border-indigo-200 text-[10px] font-bold text-indigo-800 shrink-0`,children:e.currentRhythm.toUpperCase()})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1.5 sm:gap-2 shrink-0`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`px-2.5 py-1 bg-amber-100 hover:bg-amber-200 border-[2px] border-ink-black rounded font-bold text-[11px] text-ink-black cursor-pointer shadow-[1.5px_1.5px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all flex items-center gap-1.5`,title:`View Spire Journey Progress`,children:[(0,M.jsx)(C,{className:`w-3.5 h-3.5 text-indigo-700`}),(0,M.jsxs)(`span`,{className:`font-arcade text-[9px] text-indigo-950`,children:[e.currentFloor,`/150 LC`]})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`px-2.5 py-1 bg-white hover:bg-amber-50 border-[2px] border-ink-black rounded font-bold text-[11px] text-ink-black cursor-pointer shadow-[1.5px_1.5px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all flex items-center gap-1.5`,title:`Open Royal Satchel (Missives & Diary)`,children:[(0,M.jsx)(E,{className:`w-3.5 h-3.5 text-amber-700`}),(0,M.jsx)(`span`,{className:`hidden md:inline`,children:`Satchel`}),e.unlockedLetters.length>0&&(0,M.jsx)(`span`,{className:`w-4 h-4 rounded-full bg-amber-400 text-ink-black text-[9px] font-extrabold flex items-center justify-center border border-ink-black`,children:e.unlockedLetters.length})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(!0),className:`p-1.5 bg-white hover:bg-slate-100 border-[2px] border-ink-black rounded text-ink-black cursor-pointer shadow-[1.5px_1.5px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all`,title:`View Transcript History`,children:(0,M.jsx)(T,{className:`w-3.5 h-3.5 text-slate-700`})}),(0,M.jsx)(`button`,{type:`button`,onClick:f,className:`p-1.5 border-[2px] border-ink-black rounded text-ink-black cursor-pointer shadow-[1.5px_1.5px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all ${t?`bg-slate-200 opacity-80`:`bg-[#FFE24C] hover:bg-yellow-300`}`,title:t?`Unmute Audio`:`Mute Audio`,children:t?(0,M.jsx)(b,{className:`w-3.5 h-3.5`}):(0,M.jsx)(d,{className:`w-3.5 h-3.5`})})]})]}),(0,M.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-start gap-3 sm:gap-4 p-3 sm:p-5 overflow-y-auto custom-scrollbar min-h-0 relative`,children:[(0,M.jsx)(N,{emotion:e.activeEmotion,floor:e.currentFloor,rhythm:e.currentRhythm,activity:e.currentActivity,isLoading:e.isLoading}),(0,M.jsx)(P,{text:g?.text||`I believe in you, champion!`,characterName:e.companionSettings.name,emotion:e.activeEmotion,isLoading:e.isLoading,isStreaming:g?.isStreaming,toolCalls:g?.toolCalls,onTypingStatusChange:m})]}),(0,M.jsx)(I,{suggestions:g?.choiceSuggestions,isLoading:e.isLoading,onSendMessage:e=>y.sendMessage(e),placeholder:`Speak with ${e.companionSettings.name||`Princess Aurelia`}...`}),r&&(0,M.jsx)(L,{currentFloor:e.currentFloor,totalSolved:e.totalSolved,onClose:()=>a(!1)}),o&&(0,M.jsx)(R,{unlockedLetters:e.unlockedLetters,spireChronicles:e.spireChronicles,currentFloor:e.currentFloor,heroCodex:e.heroCodex,episodicEvents:e.episodicEvents,recentToolTelemetry:e.recentToolTelemetry,onRemoveCodexItem:y.removeCodexItem,onClose:()=>s(!1)}),c&&(0,M.jsx)(`div`,{className:`absolute inset-0 z-50 bg-ink-black/40 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4 animate-in fade-in duration-200`,onClick:()=>u(!1),children:(0,M.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black rounded-xl max-w-lg w-full h-[80%] max-h-[520px] shadow-[6px_6px_0px_0px_#1E293B] flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[(0,M.jsxs)(`div`,{className:`bg-white border-b-[2px] border-ink-black px-4 py-2.5 flex items-center justify-between shrink-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(T,{className:`w-4 h-4 text-ink-black`}),(0,M.jsxs)(`h4`,{className:`font-headline-md font-bold text-xs sm:text-sm text-ink-black m-0`,children:[`Dialogue Transcript (`,e.transcript.length,` turns)`]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:p,className:`p-1 hover:bg-rose-100 text-rose-700 rounded text-[11px] font-bold flex items-center gap-1 cursor-pointer mr-1`,title:`Clear Chat History`,children:[(0,M.jsx)(_,{className:`w-3.5 h-3.5`}),(0,M.jsx)(`span`,{children:`Clear`})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(!1),className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,M.jsx)(i,{className:`w-4 h-4`})})]})]}),(0,M.jsx)(`div`,{className:`flex-1 p-3 sm:p-4 overflow-y-auto custom-scrollbar flex flex-col gap-2.5`,children:e.transcript.map((t,n)=>(0,M.jsxs)(`div`,{className:`p-2.5 rounded-lg border-[2px] border-ink-black shadow-[2px_2px_0px_0px_#1E293B] max-w-[90%] ${t.sender===`princess`?`bg-white text-ink-black self-start`:`bg-[#FFE24C] text-ink-black self-end`}`,children:[(0,M.jsx)(`div`,{className:`text-[10px] font-bold font-headline-md mb-1 text-slate-600`,children:t.sender===`princess`?e.companionSettings.name:`Hero`}),(0,M.jsx)(`p`,{className:`text-xs font-medium m-0 leading-relaxed whitespace-pre-wrap select-text`,children:t.text})]},t.id||n))})]})})]})}export{z as t};
|
algospaced-ui/dist/assets/{PythonChallenge-crvxTeXU.js → PythonChallenge-O0le9Y-n.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import{a as e,c as t,i as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import"./index-
|
| 2 |
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
| 3 |
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
| 4 |
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
|
|
|
| 1 |
+
import{a as e,c as t,i as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import"./index-CPCBFJ0E.js";var i=t(e(),1),a=class e extends Error{constructor(t,n){var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}super(r),this.name=`ParseError`,this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},o=/([A-Z])/g,s=e=>e.replace(o,`-$1`).toLowerCase(),c={"&":`&`,">":`>`,"<":`<`,'"':`"`,"'":`'`},l=/[&><"']/g,u=e=>String(e).replace(l,e=>c[e]),d=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?d(e.body[0]):e:e.type===`font`?d(e.body):e,f=new Set([`mathord`,`textord`,`atom`]),p=e=>f.has(d(e).type),m=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},h={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function g(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function _(e){return Object.prototype.hasOwnProperty.call(e,`default`)&&e.default!==void 0?e.default:g(Array.isArray(e.type)?e.type[0]:e.type)}function v(e,t,n,r){var i=Object.prototype.hasOwnProperty.call(n,t)?n[t]:void 0,a=Object.prototype.hasOwnProperty.call(r,`processor`)?r.processor:void 0;e[t]=i===void 0?_(r):a?a(i):i}var y=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(h)){var n=h[t];n&&v(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),r&&r!==`ignore`){if(r===!0||r===`error`)throw new a(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=m(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},b=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return ne[re[this.id]]}sub(){return ne[ie[this.id]]}fracNum(){return ne[ae[this.id]]}fracDen(){return ne[oe[this.id]]}cramp(){return ne[se[this.id]]}text(){return ne[ce[this.id]]}isTight(){return this.size>=2}},x=0,S=1,C=2,w=3,ee=4,T=5,te=6,E=7,ne=[new b(x,0,!1),new b(S,0,!0),new b(C,1,!1),new b(w,1,!0),new b(ee,2,!1),new b(T,2,!0),new b(te,3,!1),new b(E,3,!0)],re=[ee,T,ee,T,te,E,te,E],ie=[T,T,T,T,E,E,E,E],ae=[C,w,ee,T,te,E,te,E],oe=[w,w,T,T,E,E,E,E],se=[S,S,w,w,T,T,E,E],ce=[x,S,C,w,C,w,C,w],D={DISPLAY:ne[x],TEXT:ne[C],SCRIPT:ne[ee],SCRIPTSCRIPT:ne[te]},le=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function ue(e){for(var t=0;t<le.length;t++)for(var n=le[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var de=[];le.forEach(e=>e.blocks.forEach(e=>de.push(...e)));function fe(e){for(var t=0;t<de.length;t+=2)if(e>=de[t]&&e<=de[t+1])return!0;return!1}var pe=e=>e+` `+e,me=80,he=function(e,t){return`M95,`+(622+e+t)+`
|
| 2 |
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
| 3 |
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
| 4 |
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
algospaced-ui/dist/assets/{ReviewQueue-COA1o2bS.js → ReviewQueue-LqZVd9BQ.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
-
import{a as e,c as t,i as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import"./PrincessChamber-
|
| 2 |
`).map(e=>e.replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean)),n.length===0||r.length===0){let e=t.search(/\bExample\s*\d*:/i),i=t.search(/\bConstraints\s*:/i),a=-1;if(e!==-1&&i!==-1?a=Math.min(e,i):e===-1?i!==-1&&(a=i):a=e,a!==-1){let e=t.substring(0,a).trim(),i=t.substring(a),o=i,s=``,c=i.search(/\bConstraints\s*:/i);if(c!==-1&&(o=i.substring(0,c).trim(),s=i.substring(c).replace(/\bConstraints\s*:/i,``).trim()),n.length===0&&o){let e=/\bExample\s*(\d*)\s*:/gi,t=[],r;for(;(r=e.exec(o))!==null;)t.push({index:r.index,text:r[0]});for(let e=0;e<t.length;e++){let r=t[e].index+t[e].text.length,i=e+1<t.length?t[e+1].index:o.length,a=o.substring(r,i).trim(),s=a.match(/Input:\s*([\s\S]+?)(?=(?:Output:|Explanation:|$))/i),c=a.match(/Output:\s*([\s\S]+?)(?=(?:Explanation:|$))/i),l=a.match(/Explanation:\s*([\s\S]+)/i),u=s?s[1].trim():``,d=c?c[1].trim():``,f=l?l[1].trim():``;u||d?n.push({input:u,output:d,explanation:f}):a&&n.push({input:a,output:``,explanation:``})}}r.length===0&&s&&(r=s.split(`
|
| 3 |
`).map(e=>e.replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean)),(n.length>0||r.length>0)&&(t=e)}}return{description:t,examples:n,constraints:r}}function ye(e){return e.split(/(\*\*.*?\*\*|`.*?`)/g).map((e,t)=>e.startsWith(`**`)&&e.endsWith(`**`)?(0,D.jsx)(`strong`,{className:`text-ink-black font-bold`,children:e.slice(2,-2)},t):e.startsWith("`")&&e.endsWith("`")?(0,D.jsx)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] px-1.5 py-0.5 font-code-mono text-[11px] border border-ink-black`,children:e.slice(1,-1)},t):e)}function be(e){return e.split(/(```[\s\S]*?```)/g).map((e,t)=>{if(e.startsWith("```")){let n=e.split(`
|
| 4 |
`).slice(1,-1).join(`
|
| 5 |
`);return(0,D.jsx)(`pre`,{className:`bg-[#1E293B] p-3 border border-ink-black overflow-x-auto font-code-mono text-[11px] text-[#4ADE80] my-2 select-text`,children:(0,D.jsx)(`code`,{children:n})},t)}return e.split(`
|
| 6 |
-
`).map((e,n)=>{let r=`${t}-${n}`;if(e.startsWith(`### `))return(0,D.jsx)(`h3`,{className:`text-xs font-bold text-ink-black mt-3 mb-1.5 uppercase font-arcade`,children:e.substring(4)},r);if(e.startsWith(`## `))return(0,D.jsx)(`h2`,{className:`text-sm font-bold text-ink-black mt-4 mb-2 font-headline-md`,children:e.substring(3)},r);if(e.startsWith(`# `))return(0,D.jsx)(`h1`,{className:`text-base font-extrabold text-ink-black mt-5 mb-2 font-headline-md`,children:e.substring(2)},r);if(e.trim().startsWith(`- `)||e.trim().startsWith(`* `)){let t=e.trim().substring(2);return(0,D.jsxs)(`div`,{className:`flex items-start gap-1.5 pl-2 my-1`,children:[(0,D.jsx)(`span`,{className:`text-primary mt-1`,children:`•`}),(0,D.jsx)(`span`,{className:`text-ink-black text-xs leading-relaxed`,children:ye(t)})]},r)}return e.trim()===``?(0,D.jsx)(`div`,{className:`h-2`},r):(0,D.jsx)(`p`,{className:`text-ink-black text-xs leading-relaxed my-1`,children:ye(e)},r)})})}function xe({overrideProblemId:e,refreshTrigger:t,onClearOverride:r,onOpenOnboarding:i,setIsOnboardingOpen:a}){let[o,c]=(0,E.useState)([]),[d,f]=(0,E.useState)(!0),[p,m]=(0,E.useState)(!1),[h,g]=(0,E.useState)(null),[_,v]=(0,E.useState)(null),[y,b]=(0,E.useState)(``),[x,S]=(0,E.useState)(null),[C,ee]=(0,E.useState)(!1),[te,re]=(0,E.useState)(void 0),ie=(0,E.useRef)(!1),oe=(0,E.useRef)(i),ce=(0,E.useRef)(a),ue=(0,E.useRef)(r);(0,E.useEffect)(()=>{oe.current=i,ce.current=a,ue.current=r});let de=(0,E.useCallback)(()=>{oe.current?oe.current():ce.current&&ce.current(!0)},[]),fe=(0,E.useCallback)(async(t=!0)=>{t&&f(!0),v(null),b(``),ie.current=!1;try{let{data:{session:t}}=await n.auth.getSession(),r=t?t.access_token:`sandbox`;t?.user?.id&&re(t.user.id);let i={Authorization:`Bearer ${r}`},a=`/api/reviews/due`;e&&(a=`/api/reviews/problems/id/${e}`);let o=await fetch(a,{headers:i});if(o.ok){let n=await o.json();if(e&&(!n||n.length===0)){let t=/^\d+$/.test(e)?se(parseInt(e,10)):w(e);if(t)try{let e=await ae(t);if(e?.problem_id){let t=await fetch(`/api/reviews/problems/id/${e.problem_id}`,{headers:i});if(t.ok){let e=await t.json();e&&e.length>0&&(n=e)}}}catch(e){console.error(`Failed to auto-activate problem for override review:`,e)}}c(n);let r=t?.user?.id,a=r===`sandbox-user-id`||!r?`sandbox`:r;if(!localStorage.getItem(`algospaced_onboarding_done_${a}`)&&!e&&de(),n&&n.length>0){let e=n[0].problems,t=e?.problem_number?se(e.problem_number):w(e?.id||``),r=e?.starter_code||t?.starter_code||``;b(r)}else try{let e=await fetch(`/api/journey-progress`,{headers:i});if(e.ok){let t=await e.json();S(ne(new Set(t))??null)}else S(ne(new Set)??null)}catch{S(ne(new Set)??null)}}}catch(e){console.error(`Error fetching review queue:`,e)}finally{f(!1)}},[e,de]);return(0,E.useEffect)(()=>{let e=!1,t=setTimeout(()=>{e||fe(!0)},0);return()=>{e=!0,clearTimeout(t)}},[fe,t]),(0,E.useEffect)(()=>{if(!d&&o.length===0&&!e&&!ie.current){ie.current=!0;try{s({particleCount:90,spread:70,origin:{y:.6}})}catch{}}},[d,o.length,e]),{reviews:o,setReviews:c,loading:d,submitting:p,submittingRating:h,gradeError:_,setGradeError:v,code:y,setCode:b,nextMilestone:x,activatingMilestone:C,currentUserId:te,fetchQueue:fe,handleGrade:(0,E.useCallback)(async t=>{if(o.length===0||p)return;let r=o[0];if(!r||!r.id)return;m(!0),g(t),v(null);let i=[...o];try{let{data:{session:a}}=await n.auth.getSession(),o=a?a.access_token:`sandbox`,s=await fetch(`/api/reviews/complete`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${o}`},body:JSON.stringify({review_id:r.id,fsrs_state:r.fsrs_state??0,fsrs_stability:r.fsrs_stability??0,fsrs_difficulty:r.fsrs_difficulty??0,fsrs_elapsed_days:r.fsrs_elapsed_days??0,fsrs_scheduled_days:r.fsrs_scheduled_days??0,fsrs_reps:r.fsrs_reps??0,fsrs_lapses:r.fsrs_lapses??0,last_reviewed:r.last_reviewed,rating:t})});if(s.ok){let n=r?.problems?.name||``,i=r?.problems?.pattern||``,a=`Correct`;a=t===1?`Incorrect`:t===2?`Mixed`:`Correct`,le.addReviewEvent(a,n,i).catch(()=>{});let o=u(),s=y.trim()||r?.problems?.reference_code||``;o.token&&o.repoName&&o.autoCommit&&s&&l({token:o.token,repo:o.repoName,branch:o.branch,problem_number:r?.problems?.problem_number,problem_name:n||`Algorithm Problem`,pattern:i||`Algorithms`,difficulty:r?.problems?.difficulty||`Medium`,optimal_time:r?.problems?.optimal_time||`O(N)`,optimal_space:r?.problems?.optimal_space||`O(1)`,description:r?.problems?.description||``,code:s}).catch(e=>{console.warn(`GitHub background auto-commit failed:`,e)}),e&&ue.current?ue.current():(c(e=>e.slice(1)),fe(!1))}else{let e=await s.json().catch(()=>({}));v(e.detail||`Server returned error (${s.status}). Please try again.`),c(i)}}catch(e){console.error(`Error logging review completion:`,e);let t=e instanceof Error?e.message:`Network connection failed while logging review.`;v(t),c(i)}finally{m(!1),g(null)}},[o,p,e,fe,y]),handleActivateNextMilestone:(0,E.useCallback)(async()=>{if(x&&!C){ee(!0);try{await ae(x),await fe()}catch(e){console.error(`Failed to activate next milestone:`,e)}finally{ee(!1)}}},[x,C,fe]),handleResetStarterCode:(0,E.useCallback)(()=>{let e=o[0]?.problems,t=e?.problem_number?se(e.problem_number):w(e?.id||``),n=e?.starter_code||t?.starter_code||``;b(n)},[o])}}function Se(){let[e,t]=(0,E.useState)(!1),[n,r]=(0,E.useState)(null),[i,a]=(0,E.useState)(null),[o,s]=(0,E.useState)(!1),[c,l]=(0,E.useState)(!1),[u,d]=(0,E.useState)(null);return{sandboxRunning:e,sandboxResults:n,sandboxError:i,savingReference:o,savedRefSuccess:c,saveRefError:u,handleRunSandbox:(0,E.useCallback)(async(n,i)=>{if(!n||!i.trim()||e)return;let o=n.problems,s=o?.problem_number?se(o.problem_number):w(o?.id||``),c=(o?.examples&&o.examples.length>0?o.examples:s?.examples||[]).map(e=>typeof e==`string`?{input:e,expected:``}:{input:e?.input??``,expected:e?.output??``});t(!0),r(null),a(null),l(!1);try{let e=await re(i,c);r(e)}catch(e){let t=e instanceof Error?e.message:`Execution failed`;a(t)}finally{t(!1)}},[e]),handleSaveReference:(0,E.useCallback)(async(e,t,n)=>{if(!e||!t.trim()||o)return;let r=e.problems?.id||e.problem_id;if(r){s(!0),d(null);try{await te(r,t),l(!0),n&&n(t),setTimeout(()=>l(!1),3500)}catch(e){let t=e instanceof Error?e.message:`Failed to save solution`;d(t)}finally{s(!1)}}},[o]),resetSandbox:(0,E.useCallback)(()=>{r(null),a(null),l(!1),d(null)},[])}}function Ce(){let[e,t]=(0,E.useState)(!1),[r,i]=(0,E.useState)(null),[a,o]=(0,E.useState)(null),[s,c]=(0,E.useState)(!1),[l,u]=(0,E.useState)(null),[d,f]=(0,E.useState)(null),[p,m]=(0,E.useState)(!1),[h,g]=(0,E.useState)(null);return{aiLoading:e,aiResult:r,aiError:a,explainLoading:s,explanationText:l,explainError:d,aiSolutionLoading:p,aiSolutionError:h,handleAiEvaluation:(0,E.useCallback)(async(r,a)=>{if(!r||!a.trim()||e)return;let s=r.problems;t(!0),i(null),o(null);try{let{data:{session:e}}=await n.auth.getSession(),t=e?e.access_token:`sandbox`,r=await fetch(`/api/reviews/evaluate`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({problem_name:s.name,pattern:s.pattern,optimal_time:s.optimal_time,optimal_space:s.optimal_space,code:a})});if(r.ok){let e=await r.json();i(e)}else{let e=await r.json().catch(()=>({}));o(e.detail||`Failed to analyze code.`)}}catch{o(`Connection to evaluation server failed.`)}finally{t(!1)}},[e]),handleExplainCode:(0,E.useCallback)(async e=>{if(!e||s)return;let t=e.problems;if(!t)return;let r=t.problem_number?se(t.problem_number):w(t.id||``),i=t.reference_code||r?.reference_solution;if(i){c(!0),u(null),f(null);try{let{data:{session:e}}=await n.auth.getSession(),a=e?e.access_token:`sandbox`,o=await fetch(`/api/reviews/explain`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify({problem_number:t.problem_number||r?.problem_number,method:t.pattern||r?.pattern,code:i,problem_name:t.name,optimal_time:t.optimal_time||r?.time_complexity,optimal_space:t.optimal_space||r?.space_complexity})});if(o.ok){let e=await o.json();u(e.explanation)}else{let e=await o.json().catch(()=>({}));f(e.detail||`Failed to generate code explanation.`)}}catch{f(`Connection to explanation server failed.`)}finally{c(!1)}}},[s]),handleFetchAiSolution:(0,E.useCallback)(async(e,t)=>{if(!e||p)return;let n=e.problems,r=n?.id||e.problem_id,i=n?.problem_number?se(n.problem_number):w(n?.id||``);m(!0),g(null);try{let e=await oe({problemId:r,problemNumber:n?.problem_number||i?.problem_number,problemName:n?.name,pattern:n?.pattern||i?.pattern});e.solution&&t&&t(e.solution)}catch(e){let t=e instanceof Error?e.message:`Failed to retrieve AI Grimoire solution`;g(t)}finally{m(!1)}},[p]),resetAiState:(0,E.useCallback)(()=>{i(null),o(null),u(null),f(null),g(null)},[])}}var we=({problem:e,totalInQueue:t,fsrsState:n,overrideProblemId:r,onClearOverride:i,onOpenJourney:a,onOpenCreateProblem:s,onOpenOnboarding:l})=>{let u=`https://leetcode.com/problemset/all/?search=${encodeURIComponent(e.name||``)}`;return(0,D.jsxs)(`div`,{className:`shrink-0 bg-paper-white border-b-[3px] border-ink-black px-4 py-2.5 flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2 shadow-[0_2px_0_0_rgba(30,41,59,0.05)]`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1 bg-amber-300 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] shrink-0`,children:[(0,D.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-emerald-500 animate-ping`}),(0,D.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black tracking-wide`,children:r?`CUSTOM OVERRIDE`:`CARD 1 OF ${t}`})]}),(0,D.jsx)(`span`,{className:`text-[9px] font-arcade font-bold px-2 py-0.5 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] shrink-0 text-white ${e.difficulty===`Easy`?`bg-emerald-500`:e.difficulty===`Medium`?`bg-amber-500`:`bg-rose-500`}`,children:e.difficulty?e.difficulty.toUpperCase():`EASY`}),(0,D.jsx)(`div`,{className:`truncate min-w-0`,children:(0,D.jsx)(`h2`,{className:`text-sm sm:text-base font-extrabold text-ink-black font-headline-md truncate leading-tight`,children:e.name})})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 justify-end`,children:[(0,D.jsxs)(`button`,{onClick:a,className:`px-2 py-1 bg-white hover:bg-amber-50 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`View Journey Path Map`,children:[(0,D.jsx)(x,{className:`w-3 h-3 text-amber-600`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`JOURNEY`})]}),(0,D.jsxs)(`button`,{onClick:s,className:`px-2 py-1 bg-white hover:bg-purple-50 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`Create or Import Problem`,children:[(0,D.jsx)(fe,{className:`w-3 h-3 text-purple-600`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`ADD`})]}),(0,D.jsxs)(`button`,{onClick:l,className:`px-2 py-1 bg-amber-200 hover:bg-amber-300 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`Fast-Track: Enroll Known Problems from 150 Catalog`,children:[(0,D.jsx)(C,{className:`w-3 h-3 text-amber-800`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`FAST-TRACK`})]}),(0,D.jsxs)(`div`,{className:`px-2 py-0.5 bg-white border-2 border-ink-black text-[9px] font-arcade font-bold text-ink-black flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,D.jsx)(o,{className:`w-3 h-3 text-purple-600`}),(0,D.jsxs)(`span`,{children:[`FSRS: `,n===0?`NEW`:n===1?`LEARNING`:n===2?`REVIEW`:`RELEARNING`]})]}),e.google_doc_url&&(0,D.jsxs)(`a`,{href:e.google_doc_url,target:`_blank`,rel:`noreferrer`,className:`px-2 py-1 bg-white hover:bg-slate-100 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`Open Google Doc Notes`,children:[(0,D.jsx)(`span`,{children:`DOC`}),(0,D.jsx)(c,{className:`w-2.5 h-2.5 text-primary`})]}),(0,D.jsxs)(`a`,{href:u,target:`_blank`,rel:`noreferrer`,className:`px-2 py-1 bg-white hover:bg-slate-100 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`Search LeetCode`,children:[(0,D.jsx)(`span`,{children:`LC`}),(0,D.jsx)(c,{className:`w-2.5 h-2.5 text-amber-600`})]}),r&&i&&(0,D.jsx)(`button`,{onClick:i,className:`px-2 py-1 bg-rose-100 hover:bg-rose-200 border-2 border-ink-black text-rose-800 text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,children:`EXIT OVERRIDE`})]})]})},Te=({leftTab:e,onSelectLeftTab:t,mobileView:n,problem:r,parsed:i,effectiveReferenceCode:a,copiedSnippet:s,onCopyText:c,code:l,savingReference:u,savedRefSuccess:d,onSaveReference:f,aiSolutionLoading:m,aiSolutionError:h,onFetchAiSolution:_,explainLoading:x,explainError:S,explanationText:te,onExplainCode:ne,activeReview:re})=>(0,D.jsxs)(`div`,{className:`w-full lg:w-[46%] flex flex-col bg-paper-white border-b-[3px] lg:border-b-0 lg:border-r-[3px] border-ink-black overflow-hidden ${n!==`spec`&&n!==`ref`?`hidden lg:flex`:`flex`}`,children:[(0,D.jsxs)(`div`,{className:`shrink-0 bg-[#f4f1ea] border-b-2 border-ink-black px-3 pt-2 flex items-end gap-1.5 font-arcade text-[9px]`,children:[(0,D.jsxs)(`button`,{onClick:()=>t(`spec`),className:`h-11 px-3 border-t-2 border-x-2 border-ink-black cursor-pointer font-bold transition-all flex items-center justify-center gap-1.5 focus:outline-none focus-visible:outline-none ${e===`spec`?`bg-paper-white text-ink-black -mb-[2px] pb-2 font-extrabold shadow-[0_-2px_0_0_rgba(30,41,59,0.1)] relative z-10 border-b-2 border-b-paper-white`:`bg-slate-200 text-trash-gray hover:bg-slate-100 hover:text-ink-black border-b-2 border-b-ink-black`}`,children:[(0,D.jsx)(he,{className:`w-3.5 h-3.5 text-purple-700 shrink-0`}),(0,D.jsx)(`span`,{children:`SPECIFICATION`})]}),(0,D.jsxs)(`button`,{onClick:()=>t(`ref`),className:`h-11 px-3 border-t-2 border-x-2 border-ink-black cursor-pointer font-bold transition-all flex items-center justify-center gap-1.5 focus:outline-none focus-visible:outline-none ${e===`ref`?`bg-paper-white text-ink-black -mb-[2px] pb-2 font-extrabold shadow-[0_-2px_0_0_rgba(30,41,59,0.1)] relative z-10 border-b-2 border-b-paper-white`:`bg-slate-200 text-trash-gray hover:bg-slate-100 hover:text-ink-black border-b-2 border-b-ink-black`}`,children:[(0,D.jsx)(me,{className:`w-3.5 h-3.5 text-blue-700 shrink-0`}),(0,D.jsx)(`span`,{className:`text-center leading-tight`,children:`SOLUTION`})]}),(0,D.jsxs)(`button`,{onClick:()=>t(`leitner`),className:`h-11 px-3 border-t-2 border-x-2 border-ink-black cursor-pointer font-bold transition-all flex items-center justify-center gap-1.5 focus:outline-none focus-visible:outline-none ${e===`leitner`?`bg-paper-white text-ink-black -mb-[2px] pb-2 font-extrabold shadow-[0_-2px_0_0_rgba(30,41,59,0.1)] relative z-10 border-b-2 border-b-paper-white`:`bg-slate-200 text-trash-gray hover:bg-slate-100 hover:text-ink-black border-b-2 border-b-ink-black`}`,children:[(0,D.jsx)(_e,{className:`w-3.5 h-3.5 text-emerald-700 shrink-0`}),(0,D.jsxs)(`span`,{className:`text-center leading-tight`,children:[`FSRS`,(0,D.jsx)(`br`,{}),`STATS`]})]})]}),(0,D.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar p-4 sm:p-5 space-y-4`,children:[e===`spec`&&(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsx)(`div`,{className:`p-3 bg-amber-50 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs font-bold text-ink-black`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray uppercase`,children:`Pattern:`}),(0,D.jsx)(`span`,{className:`px-2 py-0.5 bg-white border border-ink-black font-arcade text-[9px] text-purple-700`,children:r.pattern||`General Algorithm`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray uppercase`,children:`Optimal:`}),(0,D.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-1.5 py-0.5 text-[11px] border border-ink-black`,children:[`T: `,r.optimal_time||`O(N)`]}),(0,D.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-1.5 py-0.5 text-[11px] border border-ink-black`,children:[`S: `,r.optimal_space||`O(1)`]})]})]})}),i.description&&(0,D.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold mb-2 flex items-center gap-1`,children:[(0,D.jsx)(ee,{className:`w-3 h-3 text-primary`}),`PROBLEM DESCRIPTION`]}),(0,D.jsx)(`div`,{className:`font-sans text-xs sm:text-[13px] text-slate-800 leading-relaxed space-y-2 font-medium`,children:i.description.split(`
|
| 7 |
`).map((e,t)=>e.trim()?(0,D.jsx)(`p`,{className:`m-0 leading-relaxed whitespace-pre-wrap select-text`,children:ye(e)},t):(0,D.jsx)(`div`,{className:`h-1.5`},t))})]}),i.examples.length>0&&(0,D.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,D.jsx)(C,{className:`w-3 h-3 text-amber-500`}),`EXAMPLES (`,i.examples.length,`)`]}),(0,D.jsx)(`div`,{className:`space-y-2.5`,children:i.examples.map((e,t)=>(0,D.jsxs)(`div`,{className:`p-3 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-2 text-xs`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-primary`,children:[`EXAMPLE `,t+1]}),e.input&&(0,D.jsxs)(`button`,{onClick:()=>c(e.input,`ex-${t}`),className:`px-2 py-0.5 bg-slate-100 hover:bg-slate-200 border border-ink-black text-[9px] font-arcade text-ink-black flex items-center gap-1 cursor-pointer`,title:`Copy input data`,children:[(0,D.jsx)(T,{className:`w-2.5 h-2.5`}),s===`ex-${t}`?`COPIED!`:`COPY`]})]}),e.input&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase block`,children:`Input:`}),(0,D.jsx)(`div`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono p-2 border border-ink-black text-[11px] break-all select-text`,children:e.input})]}),e.output&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase block`,children:`Output:`}),(0,D.jsx)(`div`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono p-2 border border-ink-black text-[11px] break-all select-text`,children:e.output})]}),e.explanation&&(0,D.jsxs)(`div`,{className:`text-[11px] font-sans text-slate-700 bg-amber-50/70 p-2 border border-dashed border-amber-300 select-text`,children:[(0,D.jsx)(`span`,{className:`font-bold text-ink-black`,children:`Explanation: `}),e.explanation]})]},t))})]}),i.constraints.length>0&&(0,D.jsxs)(`div`,{className:`p-3 bg-[#fdfbf7] border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-2`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1`,children:[(0,D.jsx)(g,{className:`w-3 h-3 text-amber-600`}),`CONSTRAINTS`]}),(0,D.jsx)(`ul`,{className:`space-y-1.5 list-none m-0 p-0`,children:i.constraints.map((e,t)=>(0,D.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,children:[(0,D.jsx)(`span`,{className:`text-primary font-bold select-none`,children:`•`}),(0,D.jsx)(`code`,{className:`bg-white text-ink-black font-code-mono px-2 py-0.5 border border-slate-300 text-[11px] select-text`,children:e})]},t))})]})]}),e===`ref`&&(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`border-2 border-ink-black bg-[#1E293B] shadow-[3px_3px_0px_0px_rgba(30,41,59,1)]`,children:[(0,D.jsxs)(`div`,{className:`bg-slate-800 px-3 py-1.5 border-b-2 border-ink-black flex items-center justify-between`,children:[(0,D.jsxs)(`span`,{className:`font-arcade text-[9px] text-[#4ADE80] font-bold flex items-center gap-1`,children:[(0,D.jsx)(me,{className:`w-3 h-3`}),r.reference_code?`CUSTOM SAVED SOLUTION (PYTHON)`:`OFFICIAL SOLUTION (PYTHON)`]}),a&&(0,D.jsxs)(`button`,{onClick:()=>c(a,`ref-code`),className:`px-2 py-0.5 bg-white hover:bg-slate-100 text-ink-black border border-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 cursor-pointer`,children:[(0,D.jsx)(T,{className:`w-2.5 h-2.5`}),s===`ref-code`?`COPIED!`:`COPY`]})]}),(0,D.jsx)(`div`,{className:`p-3 text-xs overflow-x-auto max-h-72 custom-scrollbar`,children:(0,D.jsx)(`pre`,{className:`font-code-mono text-[#4ADE80] text-[11px] leading-relaxed select-text m-0`,children:(0,D.jsx)(`code`,{children:a||`# No solution archived for this problem yet`})})})]}),!a&&(0,D.jsxs)(`div`,{className:`p-4 bg-amber-50 border-2 border-dashed border-amber-300 text-center space-y-3`,children:[(0,D.jsx)(`p`,{className:`text-xs font-sans text-stone-700`,children:`No solution has been generated or saved for this problem yet.`}),(0,D.jsx)(`button`,{onClick:_,disabled:m,className:`px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white font-arcade text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer inline-flex items-center gap-2 disabled:opacity-50`,children:m?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{className:`w-3.5 h-3.5 animate-spin`}),(0,D.jsx)(`span`,{children:`CONSULTING AI GRIMOIRE...`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`w-3.5 h-3.5 text-amber-300`}),(0,D.jsx)(`span`,{children:`CONSULT AI GRIMOIRE FOR SOLUTION`})]})}),h&&(0,D.jsx)(`div`,{className:`text-xs text-rose-600 font-medium`,children:h})]}),l.trim()&&(0,D.jsxs)(`button`,{onClick:f,disabled:u,className:`w-full bg-white hover:bg-slate-50 border-2 border-ink-black text-ink-black font-arcade text-[9px] py-2 px-3 font-bold flex items-center justify-center gap-1.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer disabled:opacity-50`,children:[u?(0,D.jsx)(y,{className:`w-3 h-3 animate-spin`}):d?(0,D.jsx)(v,{className:`w-3.5 h-3.5 text-emerald-600`}):(0,D.jsx)(p,{className:`w-3.5 h-3.5 text-blue-600`}),(0,D.jsx)(`span`,{children:d?`SAVED TO DB!`:`SAVE CURRENT STUDIO CODE AS SOLUTION`})]}),a&&(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`button`,{onClick:ne,disabled:x,className:`w-full bg-amber-300 hover:bg-amber-400 border-2 border-ink-black text-ink-black font-arcade text-[9px] py-2.5 px-4 font-bold flex items-center justify-center gap-2 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer disabled:opacity-50`,children:x?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{className:`w-3.5 h-3.5 animate-spin`}),(0,D.jsx)(`span`,{children:`EXPLAINING VIA GEMINI...`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`w-3.5 h-3.5 text-purple-700`}),(0,D.jsx)(`span`,{children:`EXPLAIN SOLUTION WITH GEMINI`})]})}),S&&(0,D.jsx)(`div`,{className:`p-3 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-semibold`,children:S}),te&&(0,D.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-2 select-text`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 pb-2 border-b-2 border-dashed border-ink-black`,children:[(0,D.jsx)(de,{className:`w-4 h-4 text-purple-600`}),(0,D.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black uppercase`,children:`Gemini Code Breakdown`})]}),(0,D.jsx)(`div`,{className:`font-sans text-xs space-y-2 max-h-80 overflow-y-auto custom-scrollbar pt-1 font-medium text-slate-800`,children:be(te)})]})]})]}),e===`leitner`&&(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,D.jsx)(o,{className:`w-3 h-3 text-purple-600`}),`SPACED REPETITION PROGRESSION`]}),(0,D.jsx)(`div`,{className:`space-y-2`,children:[{state:0,label:`NEW`,color:`#3b82f6`},{state:1,label:`LEARNING`,color:`#f59e0b`},{state:2,label:`REVIEW`,color:`#10b981`},{state:3,label:`RELEARNING`,color:`#ef4444`}].map(e=>{let t=(re.fsrs_state??0)===e.state;return(0,D.jsxs)(`div`,{className:`p-2.5 border-2 border-ink-black flex items-center justify-between transition-all ${t?`bg-amber-100 shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] translate-x-1 font-bold`:`bg-slate-50 opacity-70`}`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`w-5 h-5 border border-ink-black flex items-center justify-center font-arcade text-[9px] text-white font-bold`,style:{backgroundColor:e.color},children:e.state}),(0,D.jsx)(`span`,{className:`font-arcade text-[9px] text-ink-black`,children:e.label})]}),(0,D.jsx)(`div`,{className:`flex items-center gap-2`,children:t&&(0,D.jsx)(`span`,{className:`px-1.5 py-0.5 bg-emerald-500 text-white font-arcade text-[7px] border border-ink-black font-bold`,children:`CURRENT`})})]},e.state)})})]}),(0,D.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,D.jsx)(_e,{className:`w-3 h-3 text-emerald-600`}),`PERFORMANCE METRICS`]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,D.jsxs)(`div`,{className:`p-2.5 bg-slate-50 border border-ink-black`,children:[(0,D.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase`,children:`Total Reviews`}),(0,D.jsx)(`span`,{className:`font-headline-md text-lg font-bold text-ink-black`,children:re.total_attempts||0})]}),(0,D.jsxs)(`div`,{className:`p-2.5 bg-slate-50 border border-ink-black`,children:[(0,D.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase`,children:`Correct Recall`}),(0,D.jsx)(`span`,{className:`font-headline-md text-lg font-bold text-emerald-600`,children:re.times_correct||0})]})]}),(0,D.jsxs)(`div`,{className:`text-xs font-sans text-slate-600 pt-1`,children:[`Next Due Date:`,` `,(0,D.jsx)(`span`,{className:`font-code-mono font-bold text-ink-black`,children:re.next_review?new Date(re.next_review).toLocaleDateString():`Today`})]})]})]})]})]});function Ee(){return Ee=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ee.apply(null,arguments)}function De(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Oe=[],ke=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?ke:Oe).push(n+=e[t])})();function Ae(e){if(e<768)return!1;for(let t=0,n=Oe.length;;){let r=t+n>>1;if(e<Oe[r])n=r;else if(e>=ke[r])t=r+1;else return!0;if(t==n)return!1}}function je(e){return e>=127462&&e<=127487}var Me=8205;function Ne(e,t,n=!0,r=!0){return(n?Pe:Fe)(e,t,r)}function Pe(e,t,n){if(t==e.length)return t;t&&Le(e.charCodeAt(t))&&Re(e.charCodeAt(t-1))&&t--;let r=Ie(e,t);for(t+=ze(r);t<e.length;){let i=Ie(e,t);if(r==Me||i==Me||n&&Ae(i))t+=ze(i),r=i;else if(je(i)){let n=0,r=t-2;for(;r>=0&&je(Ie(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Fe(e,t,n){for(;t>1;){let r=Pe(e,t-2,n);if(r<t)return r;t--}return 0}function Ie(e,t){let n=e.charCodeAt(t);if(!Re(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Le(r)?(n-55296<<10)+(r-56320)+65536:n}function Le(e){return e>=56320&&e<57344}function Re(e){return e>=55296&&e<56320}function ze(e){return e<65536?1:2}var O=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ye(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ve.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ye(this,e,t);let n=[];return this.decompose(e,t,n,0),Ve.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Ge(this),i=new Ge(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new Ge(this,e)}iterRange(e,t=this.length){return new Ke(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qe(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new Be(t):Ve.from(Be.split(t,[]))}},Be=class e extends O{constructor(e,t=He(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new Je(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(We(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Ue(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=Ye(this,t,n);let i=Ue(this.text,Ue(r.text,We(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Ve.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
| 8 |
`){[e,t]=Ye(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},Ve=class e extends O{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=Ye(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
|
| 9 |
`){[e,t]=Ye(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new Be(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof Be&&c&&(n=u[u.length-1])instanceof Be&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new Be(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};O.empty=new Be([``],0);function He(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Ue(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function We(e,t,n){return Ue(e,[``],t,n)}var Ge=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof Be?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof Be?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
| 1 |
+
import{a as e,c as t,i as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import"./PrincessChamber-DMbQcfRj.js";import{i,n as a,r as o,t as s}from"./confetti.module-CexOBsNI.js";import{t as c}from"./external-link-D_lyOHrp.js";import{o as l,r as u,u as d}from"./githubSyncService-CjQshwem.js";import{t as f}from"./info-CZH6IVe4.js";import{t as p}from"./save-DFA_q4GT.js";import{B as m,D as h,E as g,H as _,I as v,M as y,O as b,P as x,R as S,S as C,V as ee,a as te,c as ne,i as re,j as ie,n as ae,o as w,r as oe,s as se,t as ce,v as le}from"./index-CPCBFJ0E.js";var ue=_(`award`,[[`path`,{d:`m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526`,key:`1yiouv`}],[`circle`,{cx:`12`,cy:`8`,r:`6`,key:`1vp47v`}]]),de=_(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),fe=_(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),pe=_(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),me=_(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),T=_(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),he=_(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ge=_(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),_e=_(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),E=t(e(),1),D=r();function ve(e){if(!e)return{description:``,examples:[],constraints:[]};let t=e.description||``,n=[],r=[];if(Array.isArray(e.examples)&&e.examples.length>0&&(n=e.examples.map(e=>typeof e==`string`?{input:e,output:``}:{input:e?.input||``,output:e?.output||``,explanation:e?.explanation||``})),Array.isArray(e.constraints)&&e.constraints.length>0?r=e.constraints.map(e=>String(e).replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean):typeof e.constraints==`string`&&e.constraints.trim()&&(r=e.constraints.split(`
|
| 2 |
`).map(e=>e.replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean)),n.length===0||r.length===0){let e=t.search(/\bExample\s*\d*:/i),i=t.search(/\bConstraints\s*:/i),a=-1;if(e!==-1&&i!==-1?a=Math.min(e,i):e===-1?i!==-1&&(a=i):a=e,a!==-1){let e=t.substring(0,a).trim(),i=t.substring(a),o=i,s=``,c=i.search(/\bConstraints\s*:/i);if(c!==-1&&(o=i.substring(0,c).trim(),s=i.substring(c).replace(/\bConstraints\s*:/i,``).trim()),n.length===0&&o){let e=/\bExample\s*(\d*)\s*:/gi,t=[],r;for(;(r=e.exec(o))!==null;)t.push({index:r.index,text:r[0]});for(let e=0;e<t.length;e++){let r=t[e].index+t[e].text.length,i=e+1<t.length?t[e+1].index:o.length,a=o.substring(r,i).trim(),s=a.match(/Input:\s*([\s\S]+?)(?=(?:Output:|Explanation:|$))/i),c=a.match(/Output:\s*([\s\S]+?)(?=(?:Explanation:|$))/i),l=a.match(/Explanation:\s*([\s\S]+)/i),u=s?s[1].trim():``,d=c?c[1].trim():``,f=l?l[1].trim():``;u||d?n.push({input:u,output:d,explanation:f}):a&&n.push({input:a,output:``,explanation:``})}}r.length===0&&s&&(r=s.split(`
|
| 3 |
`).map(e=>e.replace(/^[\u2022\-*]\s*/,``).trim()).filter(Boolean)),(n.length>0||r.length>0)&&(t=e)}}return{description:t,examples:n,constraints:r}}function ye(e){return e.split(/(\*\*.*?\*\*|`.*?`)/g).map((e,t)=>e.startsWith(`**`)&&e.endsWith(`**`)?(0,D.jsx)(`strong`,{className:`text-ink-black font-bold`,children:e.slice(2,-2)},t):e.startsWith("`")&&e.endsWith("`")?(0,D.jsx)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] px-1.5 py-0.5 font-code-mono text-[11px] border border-ink-black`,children:e.slice(1,-1)},t):e)}function be(e){return e.split(/(```[\s\S]*?```)/g).map((e,t)=>{if(e.startsWith("```")){let n=e.split(`
|
| 4 |
`).slice(1,-1).join(`
|
| 5 |
`);return(0,D.jsx)(`pre`,{className:`bg-[#1E293B] p-3 border border-ink-black overflow-x-auto font-code-mono text-[11px] text-[#4ADE80] my-2 select-text`,children:(0,D.jsx)(`code`,{children:n})},t)}return e.split(`
|
| 6 |
+
`).map((e,n)=>{let r=`${t}-${n}`;if(e.startsWith(`### `))return(0,D.jsx)(`h3`,{className:`text-xs font-bold text-ink-black mt-3 mb-1.5 uppercase font-arcade`,children:e.substring(4)},r);if(e.startsWith(`## `))return(0,D.jsx)(`h2`,{className:`text-sm font-bold text-ink-black mt-4 mb-2 font-headline-md`,children:e.substring(3)},r);if(e.startsWith(`# `))return(0,D.jsx)(`h1`,{className:`text-base font-extrabold text-ink-black mt-5 mb-2 font-headline-md`,children:e.substring(2)},r);if(e.trim().startsWith(`- `)||e.trim().startsWith(`* `)){let t=e.trim().substring(2);return(0,D.jsxs)(`div`,{className:`flex items-start gap-1.5 pl-2 my-1`,children:[(0,D.jsx)(`span`,{className:`text-primary mt-1`,children:`•`}),(0,D.jsx)(`span`,{className:`text-ink-black text-xs leading-relaxed`,children:ye(t)})]},r)}return e.trim()===``?(0,D.jsx)(`div`,{className:`h-2`},r):(0,D.jsx)(`p`,{className:`text-ink-black text-xs leading-relaxed my-1`,children:ye(e)},r)})})}function xe({overrideProblemId:e,refreshTrigger:t,onClearOverride:r,onOpenOnboarding:i,setIsOnboardingOpen:a}){let[o,c]=(0,E.useState)([]),[d,f]=(0,E.useState)(!0),[p,m]=(0,E.useState)(!1),[h,g]=(0,E.useState)(null),[_,v]=(0,E.useState)(null),[y,b]=(0,E.useState)(``),[x,S]=(0,E.useState)(null),[C,ee]=(0,E.useState)(!1),[te,re]=(0,E.useState)(void 0),ie=(0,E.useRef)(!1),oe=(0,E.useRef)(i),ce=(0,E.useRef)(a),ue=(0,E.useRef)(r);(0,E.useEffect)(()=>{oe.current=i,ce.current=a,ue.current=r});let de=(0,E.useCallback)(()=>{oe.current?oe.current():ce.current&&ce.current(!0)},[]),fe=(0,E.useCallback)(async(t=!0)=>{t&&f(!0),v(null),b(``),ie.current=!1;try{let{data:{session:t}}=await n.auth.getSession(),r=t?t.access_token:`sandbox`;t?.user?.id&&re(t.user.id);let i={Authorization:`Bearer ${r}`},a=`/api/reviews/due`;e&&(a=`/api/reviews/problems/id/${e}`);let o=await fetch(a,{headers:i});if(o.ok){let n=await o.json();if(e&&(!n||n.length===0)){let t=/^\d+$/.test(e)?se(parseInt(e,10)):w(e);if(t)try{let e=await ae(t);if(e?.problem_id){let t=await fetch(`/api/reviews/problems/id/${e.problem_id}`,{headers:i});if(t.ok){let e=await t.json();e&&e.length>0&&(n=e)}}}catch(e){console.error(`Failed to auto-activate problem for override review:`,e)}}c(n);let r=t?.user?.id,a=r===`sandbox-user-id`||!r?`sandbox`:r;if(!localStorage.getItem(`algospaced_onboarding_done_${a}`)&&!e&&de(),n&&n.length>0){let e=n[0].problems,t=e?.problem_number?se(e.problem_number):w(e?.id||``),r=e?.starter_code||t?.starter_code||``;b(r)}else try{let e=await fetch(`/api/journey-progress`,{headers:i});if(e.ok){let t=await e.json();S(ne(new Set(t))??null)}else S(ne(new Set)??null)}catch{S(ne(new Set)??null)}}}catch(e){console.error(`Error fetching review queue:`,e)}finally{f(!1)}},[e,de]);return(0,E.useEffect)(()=>{let e=!1,t=setTimeout(()=>{e||fe(!0)},0);return()=>{e=!0,clearTimeout(t)}},[fe,t]),(0,E.useEffect)(()=>{if(!d&&o.length===0&&!e&&!ie.current){ie.current=!0;try{s({particleCount:90,spread:70,origin:{y:.6}})}catch{}}},[d,o.length,e]),{reviews:o,setReviews:c,loading:d,submitting:p,submittingRating:h,gradeError:_,setGradeError:v,code:y,setCode:b,nextMilestone:x,activatingMilestone:C,currentUserId:te,fetchQueue:fe,handleGrade:(0,E.useCallback)(async t=>{if(o.length===0||p)return;let r=o[0];if(!r||!r.id)return;m(!0),g(t),v(null);let i=[...o];try{let{data:{session:a}}=await n.auth.getSession(),o=a?a.access_token:`sandbox`,s=await fetch(`/api/reviews/complete`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${o}`},body:JSON.stringify({review_id:r.id,fsrs_state:r.fsrs_state??0,fsrs_stability:r.fsrs_stability??0,fsrs_difficulty:r.fsrs_difficulty??0,fsrs_elapsed_days:r.fsrs_elapsed_days??0,fsrs_scheduled_days:r.fsrs_scheduled_days??0,fsrs_reps:r.fsrs_reps??0,fsrs_lapses:r.fsrs_lapses??0,last_reviewed:r.last_reviewed,rating:t})});if(s.ok){let n=r?.problems?.name||``,i=r?.problems?.pattern||``,a=`Correct`;a=t===1?`Incorrect`:t===2?`Mixed`:`Correct`,le.addReviewEvent(a,n,i).catch(()=>{});let o=u(),s=y.trim()||r?.problems?.reference_code||``;o.token&&o.repoName&&o.autoCommit&&s&&l({token:o.token,repo:o.repoName,branch:o.branch,problem_number:r?.problems?.problem_number,problem_name:n||`Algorithm Problem`,pattern:i||`Algorithms`,difficulty:r?.problems?.difficulty||`Medium`,optimal_time:r?.problems?.optimal_time||`O(N)`,optimal_space:r?.problems?.optimal_space||`O(1)`,description:r?.problems?.description||``,code:s}).catch(e=>{console.warn(`GitHub background auto-commit failed:`,e)}),e&&ue.current?ue.current():(c(e=>e.slice(1)),fe(!1))}else{let e=await s.json().catch(()=>({}));v(e.detail||`Server returned error (${s.status}). Please try again.`),c(i)}}catch(e){console.error(`Error logging review completion:`,e);let t=e instanceof Error?e.message:`Network connection failed while logging review.`;v(t),c(i)}finally{m(!1),g(null)}},[o,p,e,fe,y]),handleActivateNextMilestone:(0,E.useCallback)(async()=>{if(x&&!C){ee(!0);try{await ae(x),await fe()}catch(e){console.error(`Failed to activate next milestone:`,e)}finally{ee(!1)}}},[x,C,fe]),handleResetStarterCode:(0,E.useCallback)(()=>{let e=o[0]?.problems,t=e?.problem_number?se(e.problem_number):w(e?.id||``),n=e?.starter_code||t?.starter_code||``;b(n)},[o])}}function Se(){let[e,t]=(0,E.useState)(!1),[n,r]=(0,E.useState)(null),[i,a]=(0,E.useState)(null),[o,s]=(0,E.useState)(!1),[c,l]=(0,E.useState)(!1),[u,d]=(0,E.useState)(null);return{sandboxRunning:e,sandboxResults:n,sandboxError:i,savingReference:o,savedRefSuccess:c,saveRefError:u,handleRunSandbox:(0,E.useCallback)(async(n,i)=>{if(!n||!i.trim()||e)return;let o=n.problems,s=o?.problem_number?se(o.problem_number):w(o?.id||``),c=(o?.examples&&o.examples.length>0?o.examples:s?.examples||[]).map(e=>typeof e==`string`?{input:e,expected:``}:{input:e?.input??``,expected:e?.output??``}),u=o?.starter_code||s?.starter_code,d=o?.name||s?.name;t(!0),r(null),a(null),l(!1);try{let e=await re(i,c,4,u,d);r(e)}catch(e){let t=e instanceof Error?e.message:`Execution failed`;a(t)}finally{t(!1)}},[e]),handleSaveReference:(0,E.useCallback)(async(e,t,n)=>{if(!e||!t.trim()||o)return;let r=e.problems?.id||e.problem_id;if(r){s(!0),d(null);try{await te(r,t),l(!0),n&&n(t),setTimeout(()=>l(!1),3500)}catch(e){let t=e instanceof Error?e.message:`Failed to save solution`;d(t)}finally{s(!1)}}},[o]),resetSandbox:(0,E.useCallback)(()=>{r(null),a(null),l(!1),d(null)},[])}}function Ce(){let[e,t]=(0,E.useState)(!1),[r,i]=(0,E.useState)(null),[a,o]=(0,E.useState)(null),[s,c]=(0,E.useState)(!1),[l,u]=(0,E.useState)(null),[d,f]=(0,E.useState)(null),[p,m]=(0,E.useState)(!1),[h,g]=(0,E.useState)(null);return{aiLoading:e,aiResult:r,aiError:a,explainLoading:s,explanationText:l,explainError:d,aiSolutionLoading:p,aiSolutionError:h,handleAiEvaluation:(0,E.useCallback)(async(r,a)=>{if(!r||!a.trim()||e)return;let s=r.problems;t(!0),i(null),o(null);try{let{data:{session:e}}=await n.auth.getSession(),t=e?e.access_token:`sandbox`,r=await fetch(`/api/reviews/evaluate`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({problem_name:s.name,pattern:s.pattern,optimal_time:s.optimal_time,optimal_space:s.optimal_space,code:a})});if(r.ok){let e=await r.json();i(e)}else{let e=await r.json().catch(()=>({}));o(e.detail||`Failed to analyze code.`)}}catch{o(`Connection to evaluation server failed.`)}finally{t(!1)}},[e]),handleExplainCode:(0,E.useCallback)(async e=>{if(!e||s)return;let t=e.problems;if(!t)return;let r=t.problem_number?se(t.problem_number):w(t.id||``),i=t.reference_code||r?.reference_solution;if(i){c(!0),u(null),f(null);try{let{data:{session:e}}=await n.auth.getSession(),a=e?e.access_token:`sandbox`,o=await fetch(`/api/reviews/explain`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${a}`},body:JSON.stringify({problem_number:t.problem_number||r?.problem_number,method:t.pattern||r?.pattern,code:i,problem_name:t.name,optimal_time:t.optimal_time||r?.time_complexity,optimal_space:t.optimal_space||r?.space_complexity})});if(o.ok){let e=await o.json();u(e.explanation)}else{let e=await o.json().catch(()=>({}));f(e.detail||`Failed to generate code explanation.`)}}catch{f(`Connection to explanation server failed.`)}finally{c(!1)}}},[s]),handleFetchAiSolution:(0,E.useCallback)(async(e,t)=>{if(!e||p)return;let n=e.problems,r=n?.id||e.problem_id,i=n?.problem_number?se(n.problem_number):w(n?.id||``);m(!0),g(null);try{let e=await oe({problemId:r,problemNumber:n?.problem_number||i?.problem_number,problemName:n?.name,pattern:n?.pattern||i?.pattern});e.solution&&t&&t(e.solution)}catch(e){let t=e instanceof Error?e.message:`Failed to retrieve AI Grimoire solution`;g(t)}finally{m(!1)}},[p]),resetAiState:(0,E.useCallback)(()=>{i(null),o(null),u(null),f(null),g(null)},[])}}var we=({problem:e,totalInQueue:t,fsrsState:n,overrideProblemId:r,onClearOverride:i,onOpenJourney:a,onOpenCreateProblem:s,onOpenOnboarding:l})=>{let u=`https://leetcode.com/problemset/all/?search=${encodeURIComponent(e.name||``)}`;return(0,D.jsxs)(`div`,{className:`shrink-0 bg-paper-white border-b-[3px] border-ink-black px-4 py-2.5 flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2 shadow-[0_2px_0_0_rgba(30,41,59,0.05)]`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1 bg-amber-300 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] shrink-0`,children:[(0,D.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-emerald-500 animate-ping`}),(0,D.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black tracking-wide`,children:r?`CUSTOM OVERRIDE`:`CARD 1 OF ${t}`})]}),(0,D.jsx)(`span`,{className:`text-[9px] font-arcade font-bold px-2 py-0.5 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] shrink-0 text-white ${e.difficulty===`Easy`?`bg-emerald-500`:e.difficulty===`Medium`?`bg-amber-500`:`bg-rose-500`}`,children:e.difficulty?e.difficulty.toUpperCase():`EASY`}),(0,D.jsx)(`div`,{className:`truncate min-w-0`,children:(0,D.jsx)(`h2`,{className:`text-sm sm:text-base font-extrabold text-ink-black font-headline-md truncate leading-tight`,children:e.name})})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 justify-end`,children:[(0,D.jsxs)(`button`,{onClick:a,className:`px-2 py-1 bg-white hover:bg-amber-50 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`View Journey Path Map`,children:[(0,D.jsx)(x,{className:`w-3 h-3 text-amber-600`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`JOURNEY`})]}),(0,D.jsxs)(`button`,{onClick:s,className:`px-2 py-1 bg-white hover:bg-purple-50 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`Create or Import Problem`,children:[(0,D.jsx)(fe,{className:`w-3 h-3 text-purple-600`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`ADD`})]}),(0,D.jsxs)(`button`,{onClick:l,className:`px-2 py-1 bg-amber-200 hover:bg-amber-300 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`Fast-Track: Enroll Known Problems from 150 Catalog`,children:[(0,D.jsx)(C,{className:`w-3 h-3 text-amber-800`}),(0,D.jsx)(`span`,{className:`hidden sm:inline`,children:`FAST-TRACK`})]}),(0,D.jsxs)(`div`,{className:`px-2 py-0.5 bg-white border-2 border-ink-black text-[9px] font-arcade font-bold text-ink-black flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,D.jsx)(o,{className:`w-3 h-3 text-purple-600`}),(0,D.jsxs)(`span`,{children:[`FSRS: `,n===0?`NEW`:n===1?`LEARNING`:n===2?`REVIEW`:`RELEARNING`]})]}),e.google_doc_url&&(0,D.jsxs)(`a`,{href:e.google_doc_url,target:`_blank`,rel:`noreferrer`,className:`px-2 py-1 bg-white hover:bg-slate-100 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`Open Google Doc Notes`,children:[(0,D.jsx)(`span`,{children:`DOC`}),(0,D.jsx)(c,{className:`w-2.5 h-2.5 text-primary`})]}),(0,D.jsxs)(`a`,{href:u,target:`_blank`,rel:`noreferrer`,className:`px-2 py-1 bg-white hover:bg-slate-100 border-2 border-ink-black text-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,title:`Search LeetCode`,children:[(0,D.jsx)(`span`,{children:`LC`}),(0,D.jsx)(c,{className:`w-2.5 h-2.5 text-amber-600`})]}),r&&i&&(0,D.jsx)(`button`,{onClick:i,className:`px-2 py-1 bg-rose-100 hover:bg-rose-200 border-2 border-ink-black text-rose-800 text-[9px] font-arcade font-bold shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer`,children:`EXIT OVERRIDE`})]})]})},Te=({leftTab:e,onSelectLeftTab:t,mobileView:n,problem:r,parsed:i,effectiveReferenceCode:a,copiedSnippet:s,onCopyText:c,code:l,savingReference:u,savedRefSuccess:d,onSaveReference:f,aiSolutionLoading:m,aiSolutionError:h,onFetchAiSolution:_,explainLoading:x,explainError:S,explanationText:te,onExplainCode:ne,activeReview:re})=>(0,D.jsxs)(`div`,{className:`w-full lg:w-[46%] flex flex-col bg-paper-white border-b-[3px] lg:border-b-0 lg:border-r-[3px] border-ink-black overflow-hidden ${n!==`spec`&&n!==`ref`?`hidden lg:flex`:`flex`}`,children:[(0,D.jsxs)(`div`,{className:`shrink-0 bg-[#f4f1ea] border-b-2 border-ink-black px-3 pt-2 flex items-end gap-1.5 font-arcade text-[9px]`,children:[(0,D.jsxs)(`button`,{onClick:()=>t(`spec`),className:`h-11 px-3 border-t-2 border-x-2 border-ink-black cursor-pointer font-bold transition-all flex items-center justify-center gap-1.5 focus:outline-none focus-visible:outline-none ${e===`spec`?`bg-paper-white text-ink-black -mb-[2px] pb-2 font-extrabold shadow-[0_-2px_0_0_rgba(30,41,59,0.1)] relative z-10 border-b-2 border-b-paper-white`:`bg-slate-200 text-trash-gray hover:bg-slate-100 hover:text-ink-black border-b-2 border-b-ink-black`}`,children:[(0,D.jsx)(he,{className:`w-3.5 h-3.5 text-purple-700 shrink-0`}),(0,D.jsx)(`span`,{children:`SPECIFICATION`})]}),(0,D.jsxs)(`button`,{onClick:()=>t(`ref`),className:`h-11 px-3 border-t-2 border-x-2 border-ink-black cursor-pointer font-bold transition-all flex items-center justify-center gap-1.5 focus:outline-none focus-visible:outline-none ${e===`ref`?`bg-paper-white text-ink-black -mb-[2px] pb-2 font-extrabold shadow-[0_-2px_0_0_rgba(30,41,59,0.1)] relative z-10 border-b-2 border-b-paper-white`:`bg-slate-200 text-trash-gray hover:bg-slate-100 hover:text-ink-black border-b-2 border-b-ink-black`}`,children:[(0,D.jsx)(me,{className:`w-3.5 h-3.5 text-blue-700 shrink-0`}),(0,D.jsx)(`span`,{className:`text-center leading-tight`,children:`SOLUTION`})]}),(0,D.jsxs)(`button`,{onClick:()=>t(`leitner`),className:`h-11 px-3 border-t-2 border-x-2 border-ink-black cursor-pointer font-bold transition-all flex items-center justify-center gap-1.5 focus:outline-none focus-visible:outline-none ${e===`leitner`?`bg-paper-white text-ink-black -mb-[2px] pb-2 font-extrabold shadow-[0_-2px_0_0_rgba(30,41,59,0.1)] relative z-10 border-b-2 border-b-paper-white`:`bg-slate-200 text-trash-gray hover:bg-slate-100 hover:text-ink-black border-b-2 border-b-ink-black`}`,children:[(0,D.jsx)(_e,{className:`w-3.5 h-3.5 text-emerald-700 shrink-0`}),(0,D.jsxs)(`span`,{className:`text-center leading-tight`,children:[`FSRS`,(0,D.jsx)(`br`,{}),`STATS`]})]})]}),(0,D.jsxs)(`div`,{className:`flex-1 overflow-y-auto custom-scrollbar p-4 sm:p-5 space-y-4`,children:[e===`spec`&&(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsx)(`div`,{className:`p-3 bg-amber-50 border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs font-bold text-ink-black`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray uppercase`,children:`Pattern:`}),(0,D.jsx)(`span`,{className:`px-2 py-0.5 bg-white border border-ink-black font-arcade text-[9px] text-purple-700`,children:r.pattern||`General Algorithm`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray uppercase`,children:`Optimal:`}),(0,D.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-1.5 py-0.5 text-[11px] border border-ink-black`,children:[`T: `,r.optimal_time||`O(N)`]}),(0,D.jsxs)(`code`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono px-1.5 py-0.5 text-[11px] border border-ink-black`,children:[`S: `,r.optimal_space||`O(1)`]})]})]})}),i.description&&(0,D.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)]`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold mb-2 flex items-center gap-1`,children:[(0,D.jsx)(ee,{className:`w-3 h-3 text-primary`}),`PROBLEM DESCRIPTION`]}),(0,D.jsx)(`div`,{className:`font-sans text-xs sm:text-[13px] text-slate-800 leading-relaxed space-y-2 font-medium`,children:i.description.split(`
|
| 7 |
`).map((e,t)=>e.trim()?(0,D.jsx)(`p`,{className:`m-0 leading-relaxed whitespace-pre-wrap select-text`,children:ye(e)},t):(0,D.jsx)(`div`,{className:`h-1.5`},t))})]}),i.examples.length>0&&(0,D.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,D.jsx)(C,{className:`w-3 h-3 text-amber-500`}),`EXAMPLES (`,i.examples.length,`)`]}),(0,D.jsx)(`div`,{className:`space-y-2.5`,children:i.examples.map((e,t)=>(0,D.jsxs)(`div`,{className:`p-3 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-2 text-xs`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,D.jsxs)(`span`,{className:`font-arcade text-[9px] font-bold text-primary`,children:[`EXAMPLE `,t+1]}),e.input&&(0,D.jsxs)(`button`,{onClick:()=>c(e.input,`ex-${t}`),className:`px-2 py-0.5 bg-slate-100 hover:bg-slate-200 border border-ink-black text-[9px] font-arcade text-ink-black flex items-center gap-1 cursor-pointer`,title:`Copy input data`,children:[(0,D.jsx)(T,{className:`w-2.5 h-2.5`}),s===`ex-${t}`?`COPIED!`:`COPY`]})]}),e.input&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase block`,children:`Input:`}),(0,D.jsx)(`div`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono p-2 border border-ink-black text-[11px] break-all select-text`,children:e.input})]}),e.output&&(0,D.jsxs)(`div`,{className:`space-y-1`,children:[(0,D.jsx)(`span`,{className:`text-[9px] font-arcade text-trash-gray font-bold uppercase block`,children:`Output:`}),(0,D.jsx)(`div`,{className:`bg-[#1E293B] text-[#4ADE80] font-code-mono p-2 border border-ink-black text-[11px] break-all select-text`,children:e.output})]}),e.explanation&&(0,D.jsxs)(`div`,{className:`text-[11px] font-sans text-slate-700 bg-amber-50/70 p-2 border border-dashed border-amber-300 select-text`,children:[(0,D.jsx)(`span`,{className:`font-bold text-ink-black`,children:`Explanation: `}),e.explanation]})]},t))})]}),i.constraints.length>0&&(0,D.jsxs)(`div`,{className:`p-3 bg-[#fdfbf7] border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-2`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1`,children:[(0,D.jsx)(g,{className:`w-3 h-3 text-amber-600`}),`CONSTRAINTS`]}),(0,D.jsx)(`ul`,{className:`space-y-1.5 list-none m-0 p-0`,children:i.constraints.map((e,t)=>(0,D.jsxs)(`li`,{className:`flex items-start gap-2 text-xs`,children:[(0,D.jsx)(`span`,{className:`text-primary font-bold select-none`,children:`•`}),(0,D.jsx)(`code`,{className:`bg-white text-ink-black font-code-mono px-2 py-0.5 border border-slate-300 text-[11px] select-text`,children:e})]},t))})]})]}),e===`ref`&&(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`border-2 border-ink-black bg-[#1E293B] shadow-[3px_3px_0px_0px_rgba(30,41,59,1)]`,children:[(0,D.jsxs)(`div`,{className:`bg-slate-800 px-3 py-1.5 border-b-2 border-ink-black flex items-center justify-between`,children:[(0,D.jsxs)(`span`,{className:`font-arcade text-[9px] text-[#4ADE80] font-bold flex items-center gap-1`,children:[(0,D.jsx)(me,{className:`w-3 h-3`}),r.reference_code?`CUSTOM SAVED SOLUTION (PYTHON)`:`OFFICIAL SOLUTION (PYTHON)`]}),a&&(0,D.jsxs)(`button`,{onClick:()=>c(a,`ref-code`),className:`px-2 py-0.5 bg-white hover:bg-slate-100 text-ink-black border border-ink-black text-[9px] font-arcade font-bold flex items-center gap-1 cursor-pointer`,children:[(0,D.jsx)(T,{className:`w-2.5 h-2.5`}),s===`ref-code`?`COPIED!`:`COPY`]})]}),(0,D.jsx)(`div`,{className:`p-3 text-xs overflow-x-auto max-h-72 custom-scrollbar`,children:(0,D.jsx)(`pre`,{className:`font-code-mono text-[#4ADE80] text-[11px] leading-relaxed select-text m-0`,children:(0,D.jsx)(`code`,{children:a||`# No solution archived for this problem yet`})})})]}),!a&&(0,D.jsxs)(`div`,{className:`p-4 bg-amber-50 border-2 border-dashed border-amber-300 text-center space-y-3`,children:[(0,D.jsx)(`p`,{className:`text-xs font-sans text-stone-700`,children:`No solution has been generated or saved for this problem yet.`}),(0,D.jsx)(`button`,{onClick:_,disabled:m,className:`px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white font-arcade text-[9px] font-bold border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer inline-flex items-center gap-2 disabled:opacity-50`,children:m?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{className:`w-3.5 h-3.5 animate-spin`}),(0,D.jsx)(`span`,{children:`CONSULTING AI GRIMOIRE...`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`w-3.5 h-3.5 text-amber-300`}),(0,D.jsx)(`span`,{children:`CONSULT AI GRIMOIRE FOR SOLUTION`})]})}),h&&(0,D.jsx)(`div`,{className:`text-xs text-rose-600 font-medium`,children:h})]}),l.trim()&&(0,D.jsxs)(`button`,{onClick:f,disabled:u,className:`w-full bg-white hover:bg-slate-50 border-2 border-ink-black text-ink-black font-arcade text-[9px] py-2 px-3 font-bold flex items-center justify-center gap-1.5 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer disabled:opacity-50`,children:[u?(0,D.jsx)(y,{className:`w-3 h-3 animate-spin`}):d?(0,D.jsx)(v,{className:`w-3.5 h-3.5 text-emerald-600`}):(0,D.jsx)(p,{className:`w-3.5 h-3.5 text-blue-600`}),(0,D.jsx)(`span`,{children:d?`SAVED TO DB!`:`SAVE CURRENT STUDIO CODE AS SOLUTION`})]}),a&&(0,D.jsxs)(`div`,{className:`space-y-3`,children:[(0,D.jsx)(`button`,{onClick:ne,disabled:x,className:`w-full bg-amber-300 hover:bg-amber-400 border-2 border-ink-black text-ink-black font-arcade text-[9px] py-2.5 px-4 font-bold flex items-center justify-center gap-2 shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer disabled:opacity-50`,children:x?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{className:`w-3.5 h-3.5 animate-spin`}),(0,D.jsx)(`span`,{children:`EXPLAINING VIA GEMINI...`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`w-3.5 h-3.5 text-purple-700`}),(0,D.jsx)(`span`,{children:`EXPLAIN SOLUTION WITH GEMINI`})]})}),S&&(0,D.jsx)(`div`,{className:`p-3 border-2 border-rose-500 bg-rose-50 text-rose-800 text-xs font-semibold`,children:S}),te&&(0,D.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-2 select-text`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 pb-2 border-b-2 border-dashed border-ink-black`,children:[(0,D.jsx)(de,{className:`w-4 h-4 text-purple-600`}),(0,D.jsx)(`span`,{className:`font-arcade text-[9px] font-bold text-ink-black uppercase`,children:`Gemini Code Breakdown`})]}),(0,D.jsx)(`div`,{className:`font-sans text-xs space-y-2 max-h-80 overflow-y-auto custom-scrollbar pt-1 font-medium text-slate-800`,children:be(te)})]})]})]}),e===`leitner`&&(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,D.jsx)(o,{className:`w-3 h-3 text-purple-600`}),`SPACED REPETITION PROGRESSION`]}),(0,D.jsx)(`div`,{className:`space-y-2`,children:[{state:0,label:`NEW`,color:`#3b82f6`},{state:1,label:`LEARNING`,color:`#f59e0b`},{state:2,label:`REVIEW`,color:`#10b981`},{state:3,label:`RELEARNING`,color:`#ef4444`}].map(e=>{let t=(re.fsrs_state??0)===e.state;return(0,D.jsxs)(`div`,{className:`p-2.5 border-2 border-ink-black flex items-center justify-between transition-all ${t?`bg-amber-100 shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] translate-x-1 font-bold`:`bg-slate-50 opacity-70`}`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`span`,{className:`w-5 h-5 border border-ink-black flex items-center justify-center font-arcade text-[9px] text-white font-bold`,style:{backgroundColor:e.color},children:e.state}),(0,D.jsx)(`span`,{className:`font-arcade text-[9px] text-ink-black`,children:e.label})]}),(0,D.jsx)(`div`,{className:`flex items-center gap-2`,children:t&&(0,D.jsx)(`span`,{className:`px-1.5 py-0.5 bg-emerald-500 text-white font-arcade text-[7px] border border-ink-black font-bold`,children:`CURRENT`})})]},e.state)})})]}),(0,D.jsxs)(`div`,{className:`p-4 bg-white border-2 border-ink-black shadow-[2px_2px_0px_0px_rgba(30,41,59,1)] space-y-3`,children:[(0,D.jsxs)(`div`,{className:`text-[9px] font-arcade text-trash-gray uppercase font-bold flex items-center gap-1.5`,children:[(0,D.jsx)(_e,{className:`w-3 h-3 text-emerald-600`}),`PERFORMANCE METRICS`]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,D.jsxs)(`div`,{className:`p-2.5 bg-slate-50 border border-ink-black`,children:[(0,D.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase`,children:`Total Reviews`}),(0,D.jsx)(`span`,{className:`font-headline-md text-lg font-bold text-ink-black`,children:re.total_attempts||0})]}),(0,D.jsxs)(`div`,{className:`p-2.5 bg-slate-50 border border-ink-black`,children:[(0,D.jsx)(`span`,{className:`font-arcade text-[8px] text-trash-gray block uppercase`,children:`Correct Recall`}),(0,D.jsx)(`span`,{className:`font-headline-md text-lg font-bold text-emerald-600`,children:re.times_correct||0})]})]}),(0,D.jsxs)(`div`,{className:`text-xs font-sans text-slate-600 pt-1`,children:[`Next Due Date:`,` `,(0,D.jsx)(`span`,{className:`font-code-mono font-bold text-ink-black`,children:re.next_review?new Date(re.next_review).toLocaleDateString():`Today`})]})]})]})]})]});function Ee(){return Ee=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ee.apply(null,arguments)}function De(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Oe=[],ke=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?ke:Oe).push(n+=e[t])})();function Ae(e){if(e<768)return!1;for(let t=0,n=Oe.length;;){let r=t+n>>1;if(e<Oe[r])n=r;else if(e>=ke[r])t=r+1;else return!0;if(t==n)return!1}}function je(e){return e>=127462&&e<=127487}var Me=8205;function Ne(e,t,n=!0,r=!0){return(n?Pe:Fe)(e,t,r)}function Pe(e,t,n){if(t==e.length)return t;t&&Le(e.charCodeAt(t))&&Re(e.charCodeAt(t-1))&&t--;let r=Ie(e,t);for(t+=ze(r);t<e.length;){let i=Ie(e,t);if(r==Me||i==Me||n&&Ae(i))t+=ze(i),r=i;else if(je(i)){let n=0,r=t-2;for(;r>=0&&je(Ie(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function Fe(e,t,n){for(;t>1;){let r=Pe(e,t-2,n);if(r<t)return r;t--}return 0}function Ie(e,t){let n=e.charCodeAt(t);if(!Re(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Le(r)?(n-55296<<10)+(r-56320)+65536:n}function Le(e){return e>=56320&&e<57344}function Re(e){return e>=55296&&e<56320}function ze(e){return e<65536?1:2}var O=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ye(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ve.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ye(this,e,t);let n=[];return this.decompose(e,t,n,0),Ve.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Ge(this),i=new Ge(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new Ge(this,e)}iterRange(e,t=this.length){return new Ke(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new qe(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new Be(t):Ve.from(Be.split(t,[]))}},Be=class e extends O{constructor(e,t=He(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new Je(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(We(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Ue(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=Ye(this,t,n);let i=Ue(this.text,Ue(r.text,We(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Ve.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
| 8 |
`){[e,t]=Ye(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},Ve=class e extends O{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=Ye(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
|
| 9 |
`){[e,t]=Ye(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new Be(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof Be&&c&&(n=u[u.length-1])instanceof Be&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new Be(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};O.empty=new Be([``],0);function He(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Ue(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function We(e,t,n){return Ue(e,[``],t,n)}var Ge=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof Be?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof Be?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
algospaced-ui/dist/assets/{Settings-1J_m2sOB.js → Settings-DCDc0IAI.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{a as e,c as t,t as n}from"./jsx-runtime-j9uSgrFF.js";import{n as r,r as i,t as ee}from"./eye-DiDlGDv5.js";import{t as a}from"./external-link-2pRbXZFT.js";import{a as o,i as s,n as te,r as c,s as l,t as u,u as d}from"./githubSyncService-D3lo509P.js";import{t as f}from"./info-DoO2J6qy.js";import{t as p}from"./save-_CuJzOt0.js";import{E as m,F as h,H as g,I as _,M as ne,O as v,S as y,d as b,f as x,g as re,j as S,k as C,l as w,p as T,u as E}from"./index-BjHs_aR9.js";var D=g(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),O=g(`key`,[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]),k=t(e(),1),A=n(),j=[{id:`default`,name:`Default`,desc:`Subject to Availability`},{id:`groq`,name:`Groq`,badge:`Fastest`,desc:`Llama 3.3 & Qwen`,keyPrefix:`gsk_...`,portalUrl:`https://console.groq.com/keys`},{id:`gemini`,name:`Google Gemini`,desc:`Gemini 2.5 / 3.5`,keyPrefix:`AIzaSy...`,portalUrl:`https://aistudio.google.com/app/apikey`},{id:`openrouter`,name:`OpenRouter`,desc:`Multi-Provider`,keyPrefix:`sk-or-v1-...`,portalUrl:`https://openrouter.ai/keys`}];function M(){let[e,t]=(0,k.useState)(()=>localStorage.getItem(`algospaced_custom_ai_provider`)||`default`),[n,g]=(0,k.useState)(()=>localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``),[M,N]=(0,k.useState)(!1),[P,F]=(0,k.useState)(null),[I,L]=(0,k.useState)(()=>w()),[R,z]=(0,k.useState)(null),[B,V]=(0,k.useState)(()=>E().currentFloor),[H,U]=(0,k.useState)(()=>c()),[W,G]=(0,k.useState)(()=>s()),[K,q]=(0,k.useState)(!1),[J,Y]=(0,k.useState)(null),X=!!(H.token&&(H.username||W?.login)),Z=!!(n.trim()&&e!=="default"),Q=e!=="default"&&!n.trim(),$=j.find(t=>t.id===e),ie=e=>{t(e),localStorage.setItem(`algospaced_custom_ai_provider`,e),F(e==="default"?{type:`info`,text:`Switched to Server Default (Shared Pool).`}:{type:`info`,text:`Switched to ${e.toUpperCase()}.`}),setTimeout(()=>F(null),3e3)},ae=()=>{let t=n.trim();if(!t){F({type:`error`,text:`Please enter an API key for ${e.toUpperCase()}.`}),setTimeout(()=>F(null),3e3);return}localStorage.setItem(`algospaced_custom_api_key`,t),localStorage.setItem(`sandbox_gemini_api_key`,t),localStorage.setItem(`algospaced_custom_ai_provider`,e),F({type:`success`,text:`${e.toUpperCase()} API key saved successfully.`}),setTimeout(()=>F(null),3e3)},oe=()=>{localStorage.removeItem(`algospaced_custom_api_key`),localStorage.removeItem(`sandbox_gemini_api_key`),g(``),F({type:`info`,text:`Cleared custom API key.`}),setTimeout(()=>F(null),3e3)},se=()=>{localStorage.removeItem(`algospaced_custom_api_key`),localStorage.removeItem(`sandbox_gemini_api_key`),localStorage.setItem(`algospaced_custom_ai_provider`,`default`),g(``),t(`default`),F({type:`info`,text:`Reset to Server Default provider.`}),setTimeout(()=>F(null),3e3)},ce=()=>{x(I),z({type:`success`,text:`Princess Companion settings saved!`}),setTimeout(()=>z(null),3e3)},le=()=>{L(T),x(T),z({type:`info`,text:`Reset companion to default settings.`}),setTimeout(()=>z(null),3e3)},ue=()=>{if(window.confirm(`Are you sure you want to reset your Spire Journey progress back to 0 problems?`)){let e=b();V(e.currentFloor),z({type:`info`,text:`Spire journey progress reset to 0 problems.`}),setTimeout(()=>z(null),3e3)}},de=async()=>{q(!0),Y(null);try{let{token:e,user:t}=await te();G(t);let n=c();U(n);try{await o(e,n.repoName,n.isPrivate)}catch{}Y({type:`success`,text:`Connected to GitHub as @${t.login}!`}),setTimeout(()=>Y(null),4e3)}catch(e){Y({type:`error`,text:e.message||`GitHub connection failed.`}),setTimeout(()=>Y(null),5e3)}finally{q(!1)}},fe=()=>{u(),U(c()),G(null),Y({type:`info`,text:`Disconnected from GitHub.`}),setTimeout(()=>Y(null),3e3)},pe=e=>{l({autoCommit:e}),U(t=>({...t,autoCommit:e})),Y({type:`info`,text:e?`Auto-commit enabled for review submissions.`:`Auto-commit disabled.`}),setTimeout(()=>Y(null),3e3)};return(0,A.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-5 sm:p-6 flex flex-col gap-4 select-none font-sans text-ink-black overflow-y-auto custom-scrollbar`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-b-[3px] border-ink-black pb-2.5`,children:[(0,A.jsxs)(`h3`,{className:`font-headline-md font-bold text-sm m-0 flex items-center gap-2 tracking-wide`,children:[(0,A.jsx)(O,{className:`w-4 h-4 text-ink-black`}),`API & AI Configuration`]}),(0,A.jsx)(`p`,{className:`text-[11px] text-trash-gray font-medium m-0`,children:`Configure your AI model provider..`})]}),(0,A.jsx)(`div`,{className:`px-4 py-3 border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] transition-all ${Z?`bg-emerald-50`:Q?`bg-rose-50`:`bg-amber-50/70`}`,children:(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Z?(0,A.jsx)(y,{className:`w-4 h-4 text-emerald-600 shrink-0`}):Q?(0,A.jsx)(i,{className:`w-4 h-4 text-rose-600 shrink-0`}):(0,A.jsx)(D,{className:`w-4 h-4 text-amber-600 shrink-0`}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-xs font-bold font-headline-md text-ink-black flex items-center gap-1.5`,children:(0,A.jsxs)(`span`,{children:[`Active:`,` `,Z?`${e.toUpperCase()} (Custom Key)`:Q?`${e.toUpperCase()} (Key Required)`:`Default`]})}),(0,A.jsx)(`div`,{className:`text-[10px] text-trash-gray font-medium`,children:Z?`Requests are routed directly through your personal API key.`:Q?`Enter your API key below to activate this provider.`:`Using basic, free built-in developer keys with auto-failover.`})]})]}),(0,A.jsx)(`span`,{className:`px-2 py-0.5 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black shrink-0 ${Z?`bg-emerald-300 text-emerald-950`:Q?`bg-rose-300 text-rose-950`:`bg-amber-200 text-amber-950`}`,children:Z?`ACTIVE`:Q?`NEEDS KEY`:`LIMITED`})]})}),(0,A.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider mb-2 font-headline-md flex items-center gap-1.5`,children:[(0,A.jsx)(D,{className:`w-3.5 h-3.5 text-ink-black`}),`Select Provider`]}),(0,A.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:j.map(t=>{let n=e===t.id;return(0,A.jsxs)(`button`,{type:`button`,onClick:()=>ie(t.id),className:`p-2.5 border-[2px] text-left transition-all cursor-pointer flex flex-col justify-between rounded ${n?`border-ink-black bg-[#ffe24c] shadow-[2px_2px_0px_0px_#1E293B] font-bold`:`border-slate-300 bg-slate-50 hover:bg-slate-100 text-slate-700`}`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,A.jsx)(`span`,{className:`text-xs font-bold font-headline-md`,children:t.name}),t.badge&&(0,A.jsx)(`span`,{className:`text-[8px] font-bold uppercase px-1 py-0.2 bg-orange-100 text-orange-700 rounded border border-orange-300`,children:t.badge})]}),(0,A.jsx)(`span`,{className:`text-[9px] mt-1 text-slate-600 leading-tight block`,children:t.desc})]},t.id)})})]}),e==="default"?(0,A.jsxs)(`div`,{className:`p-3.5 bg-slate-50 border border-slate-200 rounded flex items-start gap-3`,children:[(0,A.jsx)(m,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs text-slate-700`,children:[(0,A.jsxs)(`span`,{className:`font-bold text-ink-black`,children:[`Shared Quotas (`,(0,A.jsx)(`i`,{children:`limited`}),`)`]}),(0,A.jsx)(`p`,{className:`text-[11px] text-trash-gray m-0 leading-relaxed`,children:`Powered by shared, basic developer keys. Because limits are shared with everyone, requests may fail. Use your own provider keys above for stable performance.`})]})]}):(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1.5`,children:[(0,A.jsx)(O,{className:`w-3.5 h-3.5 text-ink-black`}),$?.name,` API Key`]}),$?.portalUrl&&(0,A.jsxs)(`a`,{href:$.portalUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-[10px] text-sky-600 hover:text-sky-800 font-medium flex items-center gap-1 no-underline`,children:[(0,A.jsx)(`span`,{children:`Get API Key`}),(0,A.jsx)(a,{className:`w-3 h-3`})]})]}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`input`,{type:M?`text`:`password`,value:n,onChange:e=>g(e.target.value),placeholder:`Enter ${$?.keyPrefix||`API Key`}`,className:`w-full bg-white border-[2px] border-ink-black rounded py-2 pl-3 pr-9 text-ink-black placeholder-slate-400 focus:outline-none focus:border-sky-600 text-xs font-code-mono`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>N(!M),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-trash-gray hover:text-ink-black cursor-pointer bg-transparent border-0 outline-none p-1`,title:M?`Hide API key`:`Show API key`,children:M?(0,A.jsx)(r,{className:`w-3.5 h-3.5`}):(0,A.jsx)(ee,{className:`w-3.5 h-3.5`})})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-trash-gray font-medium`,children:[(0,A.jsx)(C,{className:`w-3.5 h-3.5 text-emerald-600 shrink-0`}),(0,A.jsx)(`span`,{children:`Stored locally in your browser. Sent directly via request headers.`})]}),(0,A.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,A.jsxs)(`button`,{onClick:ae,className:`flex-1 flex items-center justify-center gap-1.5 py-2 border-[2px] border-ink-black bg-[#ffe24c] hover:bg-yellow-300 text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:[(0,A.jsx)(p,{className:`w-3.5 h-3.5`}),`Save Key`]}),n&&(0,A.jsx)(`button`,{onClick:oe,className:`px-3 py-2 border-[2px] border-slate-300 bg-white hover:bg-slate-50 text-xs font-bold text-slate-700 hover:text-rose-600 shadow-[2px_2px_0px_0px_rgba(0,0,0,0.05)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:`Clear Key`})]})]}),P&&(0,A.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${P.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:P.type===`error`?`bg-rose-100 border-rose-600 text-rose-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[P.type===`success`?(0,A.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}):P.type===`error`?(0,A.jsx)(i,{className:`w-3.5 h-3.5 shrink-0`}):(0,A.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}),P.text]}),e!=="default"&&(0,A.jsx)(`div`,{className:`pt-2 border-t border-slate-200 flex justify-end`,children:(0,A.jsxs)(`button`,{onClick:se,className:`flex items-center gap-1.5 py-1.5 px-3 border border-slate-300 bg-slate-50 hover:bg-slate-100 text-[11px] font-bold text-slate-600 hover:text-ink-black transition-all cursor-pointer rounded`,children:[(0,A.jsx)(S,{className:`w-3 h-3 text-slate-500`}),`Reset to Server Default`]})})]}),(0,A.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,A.jsx)(`div`,{className:`w-8 h-8 rounded bg-[#24292e] border-[2px] border-ink-black flex items-center justify-center text-white shadow-[1px_1px_0px_0px_#1E293B]`,children:(0,A.jsx)(d,{className:`w-4 h-4 text-white`})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0 flex items-center gap-2`,children:`GitHub Solutions Sync & Auto-Commit`}),(0,A.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Sync solutions to personal GitHub repository and commit automatically on submission`})]})]}),(0,A.jsx)(`span`,{className:`px-2 py-0.5 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black shrink-0 ${X?`bg-emerald-300 text-emerald-950`:`bg-slate-200 text-slate-800`}`,children:X?`CONNECTED`:`DISCONNECTED`})]}),X?(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-2 p-3 bg-slate-50 border border-slate-200 rounded`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[W?.avatar_url&&(0,A.jsx)(`img`,{src:W.avatar_url,alt:W.login,className:`w-7 h-7 rounded-full border border-ink-black`}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`span`,{className:`text-xs font-bold text-ink-black`,children:[`@`,W?.login||H.username]}),(0,A.jsxs)(`span`,{className:`text-[11px] text-slate-600 font-mono block`,children:[H.username,`/`,H.repoName,` (`,H.branch,`)`]})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(`a`,{href:`https://github.com/${H.username}/${H.repoName}`,target:`_blank`,rel:`noopener noreferrer`,className:`px-2.5 py-1 text-[11px] font-bold bg-white hover:bg-slate-100 text-ink-black border border-slate-300 rounded no-underline flex items-center gap-1 cursor-pointer`,children:[(0,A.jsx)(a,{className:`w-3 h-3`}),(0,A.jsx)(`span`,{children:`View Repo`})]}),(0,A.jsx)(`button`,{type:`button`,onClick:fe,className:`px-2.5 py-1 text-[11px] font-bold bg-white hover:bg-rose-50 text-rose-700 border border-rose-300 rounded cursor-pointer`,children:`Disconnect`})]})]}),(0,A.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-emerald-50/50 border border-emerald-300 rounded cursor-pointer`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:H.autoCommit,onChange:e=>pe(e.target.checked),className:`w-4 h-4 accent-emerald-600 cursor-pointer`}),(0,A.jsxs)(`div`,{className:`text-xs`,children:[(0,A.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,A.jsxs)(`span`,{className:`text-[10px] text-trash-gray`,children:[`Automatically pushes your code to `,H.repoName,` whenever you grade a review card.`]})]})]})]}):(0,A.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 p-3.5 bg-slate-50 border border-slate-200 rounded`,children:[(0,A.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,A.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Connect your GitHub Account (1-Click OAuth)`}),(0,A.jsx)(`p`,{className:`text-[11px] text-trash-gray m-0`,children:`Grant repository access to automatically sync your DSA problem solutions as you study.`})]}),(0,A.jsx)(`button`,{type:`button`,onClick:de,disabled:K,className:`px-4 py-2 bg-[#24292e] hover:bg-black text-white text-xs font-bold uppercase rounded border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none flex items-center gap-2 shrink-0 cursor-pointer disabled:opacity-50`,children:K?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{className:`w-3.5 h-3.5 animate-spin`}),(0,A.jsx)(`span`,{children:`CONNECTING...`})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d,{className:`w-3.5 h-3.5 text-yellow-300`}),(0,A.jsx)(`span`,{children:`CONNECT GITHUB`})]})})]}),J&&(0,A.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${J.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:J.type===`error`?`bg-rose-100 border-rose-600 text-rose-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[J.type===`success`?(0,A.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}):J.type===`error`?(0,A.jsx)(i,{className:`w-3.5 h-3.5 shrink-0`}):(0,A.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}),J.text]})]}),(0,A.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`div`,{className:`w-7 h-7 rounded bg-[#FFE24C] border-[2px] border-ink-black flex items-center justify-center shadow-[1px_1px_0px_0px_#1E293B]`,children:(0,A.jsx)(v,{className:`w-4 h-4 text-ink-black`})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0`,children:`Princess AI Companion & RPG Settings`}),(0,A.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Trapped Princess Persona, Study Break Timer & 8-bit RPG Audio`})]})]}),(0,A.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,A.jsx)(`span`,{className:`text-[11px] font-bold text-ink-black font-headline-md uppercase`,children:I.enabled?`Enabled`:`Disabled`}),(0,A.jsx)(`input`,{type:`checkbox`,checked:I.enabled,onChange:e=>L(t=>({...t,enabled:e.target.checked})),className:`w-4 h-4 accent-amber-500 cursor-pointer`})]})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Companion Name`}),(0,A.jsx)(`input`,{type:`text`,value:I.name,onChange:e=>L(t=>({...t,name:e.target.value})),placeholder:`e.g. Princess Aurelia`,className:`bg-white border-[2px] border-ink-black rounded py-2 px-3 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1`,children:[(0,A.jsx)(h,{className:`w-3.5 h-3.5 text-amber-700`}),`Study Break Reminder`]}),(0,A.jsxs)(`select`,{value:I.breakIntervalMinutes,onChange:e=>L(t=>({...t,breakIntervalMinutes:Number(e.target.value)})),className:`bg-white border-[2px] border-ink-black rounded py-2 px-3 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600 cursor-pointer`,children:[(0,A.jsx)(`option`,{value:25,children:`Every 25 Minutes (Classic Pomodoro)`}),(0,A.jsx)(`option`,{value:45,children:`Every 45 Minutes`}),(0,A.jsx)(`option`,{value:60,children:`Every 60 Minutes`}),(0,A.jsx)(`option`,{value:0,children:`Disabled (No automatic break popups)`})]})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Princess Backstory & Persona Prompt`}),(0,A.jsx)(`textarea`,{rows:2,value:I.backstory,onChange:e=>L(t=>({...t,backstory:e.target.value})),placeholder:`Describe her background, tone, and connection to your DSA studies...`,className:`bg-white border-[2px] border-ink-black rounded p-2.5 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600 resize-y`})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1`,children:[(0,A.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-white border border-slate-300 rounded cursor-pointer hover:border-ink-black transition-all`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:I.soundEnabled,onChange:e=>{let t=e.target.checked;L(e=>({...e,soundEnabled:t})),re(!t)},className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,A.jsxs)(`div`,{className:`text-xs`,children:[(0,A.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`8-bit Sound Effects`}),(0,A.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Typewriter blips, chimes & fanfare`})]})]}),(0,A.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-white border border-slate-300 rounded cursor-pointer hover:border-ink-black transition-all`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:I.autoPopupEnabled,onChange:e=>L(t=>({...t,autoPopupEnabled:e.target.checked})),className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,A.jsxs)(`div`,{className:`text-xs`,children:[(0,A.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Spontaneous RPG Popups`}),(0,A.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Speech bubbles for breaks & milestones`})]})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-slate-200`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:ce,className:`flex items-center gap-1.5 py-2 px-4 border-[2px] border-ink-black bg-[#ffe24c] hover:bg-yellow-300 text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:[(0,A.jsx)(p,{className:`w-3.5 h-3.5`}),`Save Companion Settings`]}),(0,A.jsx)(`button`,{type:`button`,onClick:le,className:`py-2 px-3 border border-slate-300 bg-white hover:bg-slate-50 text-xs font-bold text-slate-700 transition-all cursor-pointer rounded`,children:`Default Persona`})]}),(0,A.jsxs)(`button`,{type:`button`,onClick:ue,className:`flex items-center gap-1 py-1.5 px-3 border border-rose-300 bg-rose-50 hover:bg-rose-100 text-rose-700 text-[11px] font-bold transition-all cursor-pointer rounded`,children:[(0,A.jsx)(S,{className:`w-3 h-3 text-rose-500`}),(0,A.jsxs)(`span`,{children:[`Reset Journey (`,B,`/150 LC)`]})]})]}),R&&(0,A.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${R.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[(0,A.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}),R.text]})]}),(0,A.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,A.jsx)(f,{className:`w-3.5 h-3.5 text-[#0ea5e9]`}),(0,A.jsx)(`h4`,{className:`text-xs font-bold uppercase font-headline-md m-0`,children:`Get Free API Keys`})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-2 text-[10px]`,children:[(0,A.jsxs)(`a`,{href:`https://console.groq.com/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,A.jsx)(`span`,{children:`Groq Cloud`}),(0,A.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,A.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Fast inference with generous free rate limits.`})]}),(0,A.jsxs)(`a`,{href:`https://aistudio.google.com/app/apikey`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,A.jsx)(`span`,{children:`Google AI Studio`}),(0,A.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,A.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Free Gemini Flash API quota.`})]}),(0,A.jsxs)(`a`,{href:`https://openrouter.ai/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,A.jsx)(`span`,{children:`OpenRouter`}),(0,A.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,A.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Unified API for open-weights models.`})]})]})]})]})}export{M as default};
|
|
|
|
| 1 |
+
import{a as e,c as t,t as n}from"./jsx-runtime-j9uSgrFF.js";import{n as r,r as i,t as ee}from"./eye-DYmzmFTZ.js";import{t as a}from"./external-link-D_lyOHrp.js";import{a as o,i as s,n as te,r as c,s as l,t as u,u as d}from"./githubSyncService-CjQshwem.js";import{t as f}from"./info-CZH6IVe4.js";import{t as p}from"./save-DFA_q4GT.js";import{E as m,F as h,H as g,I as _,M as ne,O as v,S as y,d as b,f as x,g as re,j as S,k as C,l as w,p as T,u as E}from"./index-CPCBFJ0E.js";var D=g(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),O=g(`key`,[[`path`,{d:`m2 21 9.6-9.6`,key:`9l79m3`}],[`path`,{d:`m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19`,key:`fw8biw`}],[`circle`,{cx:`15.5`,cy:`7.5`,r:`5.5`,key:`4wxmhb`}]]),k=t(e(),1),A=n(),j=[{id:`default`,name:`Default`,desc:`Subject to Availability`},{id:`groq`,name:`Groq`,badge:`Fastest`,desc:`Llama 3.3 & Qwen`,keyPrefix:`gsk_...`,portalUrl:`https://console.groq.com/keys`},{id:`gemini`,name:`Google Gemini`,desc:`Gemini 2.5 / 3.5`,keyPrefix:`AIzaSy...`,portalUrl:`https://aistudio.google.com/app/apikey`},{id:`openrouter`,name:`OpenRouter`,desc:`Multi-Provider`,keyPrefix:`sk-or-v1-...`,portalUrl:`https://openrouter.ai/keys`}];function M(){let[e,t]=(0,k.useState)(()=>localStorage.getItem(`algospaced_custom_ai_provider`)||`default`),[n,g]=(0,k.useState)(()=>localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``),[M,N]=(0,k.useState)(!1),[P,F]=(0,k.useState)(null),[I,L]=(0,k.useState)(()=>w()),[R,z]=(0,k.useState)(null),[B,V]=(0,k.useState)(()=>E().currentFloor),[H,U]=(0,k.useState)(()=>c()),[W,G]=(0,k.useState)(()=>s()),[K,q]=(0,k.useState)(!1),[J,Y]=(0,k.useState)(null),X=!!(H.token&&(H.username||W?.login)),Z=!!(n.trim()&&e!=="default"),Q=e!=="default"&&!n.trim(),$=j.find(t=>t.id===e),ie=e=>{t(e),localStorage.setItem(`algospaced_custom_ai_provider`,e),F(e==="default"?{type:`info`,text:`Switched to Server Default (Shared Pool).`}:{type:`info`,text:`Switched to ${e.toUpperCase()}.`}),setTimeout(()=>F(null),3e3)},ae=()=>{let t=n.trim();if(!t){F({type:`error`,text:`Please enter an API key for ${e.toUpperCase()}.`}),setTimeout(()=>F(null),3e3);return}localStorage.setItem(`algospaced_custom_api_key`,t),localStorage.setItem(`sandbox_gemini_api_key`,t),localStorage.setItem(`algospaced_custom_ai_provider`,e),F({type:`success`,text:`${e.toUpperCase()} API key saved successfully.`}),setTimeout(()=>F(null),3e3)},oe=()=>{localStorage.removeItem(`algospaced_custom_api_key`),localStorage.removeItem(`sandbox_gemini_api_key`),g(``),F({type:`info`,text:`Cleared custom API key.`}),setTimeout(()=>F(null),3e3)},se=()=>{localStorage.removeItem(`algospaced_custom_api_key`),localStorage.removeItem(`sandbox_gemini_api_key`),localStorage.setItem(`algospaced_custom_ai_provider`,`default`),g(``),t(`default`),F({type:`info`,text:`Reset to Server Default provider.`}),setTimeout(()=>F(null),3e3)},ce=()=>{x(I),z({type:`success`,text:`Princess Companion settings saved!`}),setTimeout(()=>z(null),3e3)},le=()=>{L(T),x(T),z({type:`info`,text:`Reset companion to default settings.`}),setTimeout(()=>z(null),3e3)},ue=()=>{if(window.confirm(`Are you sure you want to reset your Spire Journey progress back to 0 problems?`)){let e=b();V(e.currentFloor),z({type:`info`,text:`Spire journey progress reset to 0 problems.`}),setTimeout(()=>z(null),3e3)}},de=async()=>{q(!0),Y(null);try{let{token:e,user:t}=await te();G(t);let n=c();U(n);try{await o(e,n.repoName,n.isPrivate)}catch{}Y({type:`success`,text:`Connected to GitHub as @${t.login}!`}),setTimeout(()=>Y(null),4e3)}catch(e){Y({type:`error`,text:e.message||`GitHub connection failed.`}),setTimeout(()=>Y(null),5e3)}finally{q(!1)}},fe=()=>{u(),U(c()),G(null),Y({type:`info`,text:`Disconnected from GitHub.`}),setTimeout(()=>Y(null),3e3)},pe=e=>{l({autoCommit:e}),U(t=>({...t,autoCommit:e})),Y({type:`info`,text:e?`Auto-commit enabled for review submissions.`:`Auto-commit disabled.`}),setTimeout(()=>Y(null),3e3)};return(0,A.jsxs)(`div`,{className:`w-full h-full bg-[#fdf8e1] p-5 sm:p-6 flex flex-col gap-4 select-none font-sans text-ink-black overflow-y-auto custom-scrollbar`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-b-[3px] border-ink-black pb-2.5`,children:[(0,A.jsxs)(`h3`,{className:`font-headline-md font-bold text-sm m-0 flex items-center gap-2 tracking-wide`,children:[(0,A.jsx)(O,{className:`w-4 h-4 text-ink-black`}),`API & AI Configuration`]}),(0,A.jsx)(`p`,{className:`text-[11px] text-trash-gray font-medium m-0`,children:`Configure your AI model provider..`})]}),(0,A.jsx)(`div`,{className:`px-4 py-3 border-[3px] border-ink-black shadow-[3px_3px_0px_0px_rgba(30,41,59,1)] transition-all ${Z?`bg-emerald-50`:Q?`bg-rose-50`:`bg-amber-50/70`}`,children:(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Z?(0,A.jsx)(y,{className:`w-4 h-4 text-emerald-600 shrink-0`}):Q?(0,A.jsx)(i,{className:`w-4 h-4 text-rose-600 shrink-0`}):(0,A.jsx)(D,{className:`w-4 h-4 text-amber-600 shrink-0`}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`div`,{className:`text-xs font-bold font-headline-md text-ink-black flex items-center gap-1.5`,children:(0,A.jsxs)(`span`,{children:[`Active:`,` `,Z?`${e.toUpperCase()} (Custom Key)`:Q?`${e.toUpperCase()} (Key Required)`:`Default`]})}),(0,A.jsx)(`div`,{className:`text-[10px] text-trash-gray font-medium`,children:Z?`Requests are routed directly through your personal API key.`:Q?`Enter your API key below to activate this provider.`:`Using basic, free built-in developer keys with auto-failover.`})]})]}),(0,A.jsx)(`span`,{className:`px-2 py-0.5 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black shrink-0 ${Z?`bg-emerald-300 text-emerald-950`:Q?`bg-rose-300 text-rose-950`:`bg-amber-200 text-amber-950`}`,children:Z?`ACTIVE`:Q?`NEEDS KEY`:`LIMITED`})]})}),(0,A.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider mb-2 font-headline-md flex items-center gap-1.5`,children:[(0,A.jsx)(D,{className:`w-3.5 h-3.5 text-ink-black`}),`Select Provider`]}),(0,A.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:j.map(t=>{let n=e===t.id;return(0,A.jsxs)(`button`,{type:`button`,onClick:()=>ie(t.id),className:`p-2.5 border-[2px] text-left transition-all cursor-pointer flex flex-col justify-between rounded ${n?`border-ink-black bg-[#ffe24c] shadow-[2px_2px_0px_0px_#1E293B] font-bold`:`border-slate-300 bg-slate-50 hover:bg-slate-100 text-slate-700`}`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,A.jsx)(`span`,{className:`text-xs font-bold font-headline-md`,children:t.name}),t.badge&&(0,A.jsx)(`span`,{className:`text-[8px] font-bold uppercase px-1 py-0.2 bg-orange-100 text-orange-700 rounded border border-orange-300`,children:t.badge})]}),(0,A.jsx)(`span`,{className:`text-[9px] mt-1 text-slate-600 leading-tight block`,children:t.desc})]},t.id)})})]}),e==="default"?(0,A.jsxs)(`div`,{className:`p-3.5 bg-slate-50 border border-slate-200 rounded flex items-start gap-3`,children:[(0,A.jsx)(m,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs text-slate-700`,children:[(0,A.jsxs)(`span`,{className:`font-bold text-ink-black`,children:[`Shared Quotas (`,(0,A.jsx)(`i`,{children:`limited`}),`)`]}),(0,A.jsx)(`p`,{className:`text-[11px] text-trash-gray m-0 leading-relaxed`,children:`Powered by shared, basic developer keys. Because limits are shared with everyone, requests may fail. Use your own provider keys above for stable performance.`})]})]}):(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1.5`,children:[(0,A.jsx)(O,{className:`w-3.5 h-3.5 text-ink-black`}),$?.name,` API Key`]}),$?.portalUrl&&(0,A.jsxs)(`a`,{href:$.portalUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-[10px] text-sky-600 hover:text-sky-800 font-medium flex items-center gap-1 no-underline`,children:[(0,A.jsx)(`span`,{children:`Get API Key`}),(0,A.jsx)(a,{className:`w-3 h-3`})]})]}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`input`,{type:M?`text`:`password`,value:n,onChange:e=>g(e.target.value),placeholder:`Enter ${$?.keyPrefix||`API Key`}`,className:`w-full bg-white border-[2px] border-ink-black rounded py-2 pl-3 pr-9 text-ink-black placeholder-slate-400 focus:outline-none focus:border-sky-600 text-xs font-code-mono`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>N(!M),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-trash-gray hover:text-ink-black cursor-pointer bg-transparent border-0 outline-none p-1`,title:M?`Hide API key`:`Show API key`,children:M?(0,A.jsx)(r,{className:`w-3.5 h-3.5`}):(0,A.jsx)(ee,{className:`w-3.5 h-3.5`})})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-trash-gray font-medium`,children:[(0,A.jsx)(C,{className:`w-3.5 h-3.5 text-emerald-600 shrink-0`}),(0,A.jsx)(`span`,{children:`Stored locally in your browser. Sent directly via request headers.`})]}),(0,A.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,A.jsxs)(`button`,{onClick:ae,className:`flex-1 flex items-center justify-center gap-1.5 py-2 border-[2px] border-ink-black bg-[#ffe24c] hover:bg-yellow-300 text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:[(0,A.jsx)(p,{className:`w-3.5 h-3.5`}),`Save Key`]}),n&&(0,A.jsx)(`button`,{onClick:oe,className:`px-3 py-2 border-[2px] border-slate-300 bg-white hover:bg-slate-50 text-xs font-bold text-slate-700 hover:text-rose-600 shadow-[2px_2px_0px_0px_rgba(0,0,0,0.05)] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:`Clear Key`})]})]}),P&&(0,A.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${P.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:P.type===`error`?`bg-rose-100 border-rose-600 text-rose-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[P.type===`success`?(0,A.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}):P.type===`error`?(0,A.jsx)(i,{className:`w-3.5 h-3.5 shrink-0`}):(0,A.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}),P.text]}),e!=="default"&&(0,A.jsx)(`div`,{className:`pt-2 border-t border-slate-200 flex justify-end`,children:(0,A.jsxs)(`button`,{onClick:se,className:`flex items-center gap-1.5 py-1.5 px-3 border border-slate-300 bg-slate-50 hover:bg-slate-100 text-[11px] font-bold text-slate-600 hover:text-ink-black transition-all cursor-pointer rounded`,children:[(0,A.jsx)(S,{className:`w-3 h-3 text-slate-500`}),`Reset to Server Default`]})})]}),(0,A.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,A.jsx)(`div`,{className:`w-8 h-8 rounded bg-[#24292e] border-[2px] border-ink-black flex items-center justify-center text-white shadow-[1px_1px_0px_0px_#1E293B]`,children:(0,A.jsx)(d,{className:`w-4 h-4 text-white`})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0 flex items-center gap-2`,children:`GitHub Solutions Sync & Auto-Commit`}),(0,A.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Sync solutions to personal GitHub repository and commit automatically on submission`})]})]}),(0,A.jsx)(`span`,{className:`px-2 py-0.5 text-[9px] font-bold font-arcade uppercase border-2 border-ink-black shrink-0 ${X?`bg-emerald-300 text-emerald-950`:`bg-slate-200 text-slate-800`}`,children:X?`CONNECTED`:`DISCONNECTED`})]}),X?(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-2 p-3 bg-slate-50 border border-slate-200 rounded`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[W?.avatar_url&&(0,A.jsx)(`img`,{src:W.avatar_url,alt:W.login,className:`w-7 h-7 rounded-full border border-ink-black`}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`span`,{className:`text-xs font-bold text-ink-black`,children:[`@`,W?.login||H.username]}),(0,A.jsxs)(`span`,{className:`text-[11px] text-slate-600 font-mono block`,children:[H.username,`/`,H.repoName,` (`,H.branch,`)`]})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(`a`,{href:`https://github.com/${H.username}/${H.repoName}`,target:`_blank`,rel:`noopener noreferrer`,className:`px-2.5 py-1 text-[11px] font-bold bg-white hover:bg-slate-100 text-ink-black border border-slate-300 rounded no-underline flex items-center gap-1 cursor-pointer`,children:[(0,A.jsx)(a,{className:`w-3 h-3`}),(0,A.jsx)(`span`,{children:`View Repo`})]}),(0,A.jsx)(`button`,{type:`button`,onClick:fe,className:`px-2.5 py-1 text-[11px] font-bold bg-white hover:bg-rose-50 text-rose-700 border border-rose-300 rounded cursor-pointer`,children:`Disconnect`})]})]}),(0,A.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-emerald-50/50 border border-emerald-300 rounded cursor-pointer`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:H.autoCommit,onChange:e=>pe(e.target.checked),className:`w-4 h-4 accent-emerald-600 cursor-pointer`}),(0,A.jsxs)(`div`,{className:`text-xs`,children:[(0,A.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,A.jsxs)(`span`,{className:`text-[10px] text-trash-gray`,children:[`Automatically pushes your code to `,H.repoName,` whenever you grade a review card.`]})]})]})]}):(0,A.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 p-3.5 bg-slate-50 border border-slate-200 rounded`,children:[(0,A.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,A.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Connect your GitHub Account (1-Click OAuth)`}),(0,A.jsx)(`p`,{className:`text-[11px] text-trash-gray m-0`,children:`Grant repository access to automatically sync your DSA problem solutions as you study.`})]}),(0,A.jsx)(`button`,{type:`button`,onClick:de,disabled:K,className:`px-4 py-2 bg-[#24292e] hover:bg-black text-white text-xs font-bold uppercase rounded border-2 border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none flex items-center gap-2 shrink-0 cursor-pointer disabled:opacity-50`,children:K?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{className:`w-3.5 h-3.5 animate-spin`}),(0,A.jsx)(`span`,{children:`CONNECTING...`})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d,{className:`w-3.5 h-3.5 text-yellow-300`}),(0,A.jsx)(`span`,{children:`CONNECT GITHUB`})]})})]}),J&&(0,A.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${J.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:J.type===`error`?`bg-rose-100 border-rose-600 text-rose-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[J.type===`success`?(0,A.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}):J.type===`error`?(0,A.jsx)(i,{className:`w-3.5 h-3.5 shrink-0`}):(0,A.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}),J.text]})]}),(0,A.jsxs)(`div`,{className:`bg-[#FFFDF0] border-[3px] border-ink-black p-4 sm:p-5 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`div`,{className:`w-7 h-7 rounded bg-[#FFE24C] border-[2px] border-ink-black flex items-center justify-center shadow-[1px_1px_0px_0px_#1E293B]`,children:(0,A.jsx)(v,{className:`w-4 h-4 text-ink-black`})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0`,children:`Princess AI Companion & RPG Settings`}),(0,A.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Trapped Princess Persona, Study Break Timer & 8-bit RPG Audio`})]})]}),(0,A.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,A.jsx)(`span`,{className:`text-[11px] font-bold text-ink-black font-headline-md uppercase`,children:I.enabled?`Enabled`:`Disabled`}),(0,A.jsx)(`input`,{type:`checkbox`,checked:I.enabled,onChange:e=>L(t=>({...t,enabled:e.target.checked})),className:`w-4 h-4 accent-amber-500 cursor-pointer`})]})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Companion Name`}),(0,A.jsx)(`input`,{type:`text`,value:I.name,onChange:e=>L(t=>({...t,name:e.target.value})),placeholder:`e.g. Princess Aurelia`,className:`bg-white border-[2px] border-ink-black rounded py-2 px-3 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1`,children:[(0,A.jsx)(h,{className:`w-3.5 h-3.5 text-amber-700`}),`Study Break Reminder`]}),(0,A.jsxs)(`select`,{value:I.breakIntervalMinutes,onChange:e=>L(t=>({...t,breakIntervalMinutes:Number(e.target.value)})),className:`bg-white border-[2px] border-ink-black rounded py-2 px-3 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600 cursor-pointer`,children:[(0,A.jsx)(`option`,{value:25,children:`Every 25 Minutes (Classic Pomodoro)`}),(0,A.jsx)(`option`,{value:45,children:`Every 45 Minutes`}),(0,A.jsx)(`option`,{value:60,children:`Every 60 Minutes`}),(0,A.jsx)(`option`,{value:0,children:`Disabled (No automatic break popups)`})]})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Princess Backstory & Persona Prompt`}),(0,A.jsx)(`textarea`,{rows:2,value:I.backstory,onChange:e=>L(t=>({...t,backstory:e.target.value})),placeholder:`Describe her background, tone, and connection to your DSA studies...`,className:`bg-white border-[2px] border-ink-black rounded p-2.5 text-ink-black text-xs font-sans font-medium focus:outline-none focus:border-amber-600 resize-y`})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1`,children:[(0,A.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-white border border-slate-300 rounded cursor-pointer hover:border-ink-black transition-all`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:I.soundEnabled,onChange:e=>{let t=e.target.checked;L(e=>({...e,soundEnabled:t})),re(!t)},className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,A.jsxs)(`div`,{className:`text-xs`,children:[(0,A.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`8-bit Sound Effects`}),(0,A.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Typewriter blips, chimes & fanfare`})]})]}),(0,A.jsxs)(`label`,{className:`flex items-center gap-2.5 p-2.5 bg-white border border-slate-300 rounded cursor-pointer hover:border-ink-black transition-all`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:I.autoPopupEnabled,onChange:e=>L(t=>({...t,autoPopupEnabled:e.target.checked})),className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,A.jsxs)(`div`,{className:`text-xs`,children:[(0,A.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Spontaneous RPG Popups`}),(0,A.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Speech bubbles for breaks & milestones`})]})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-slate-200`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(`button`,{type:`button`,onClick:ce,className:`flex items-center gap-1.5 py-2 px-4 border-[2px] border-ink-black bg-[#ffe24c] hover:bg-yellow-300 text-xs font-bold text-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none transition-all cursor-pointer rounded uppercase`,children:[(0,A.jsx)(p,{className:`w-3.5 h-3.5`}),`Save Companion Settings`]}),(0,A.jsx)(`button`,{type:`button`,onClick:le,className:`py-2 px-3 border border-slate-300 bg-white hover:bg-slate-50 text-xs font-bold text-slate-700 transition-all cursor-pointer rounded`,children:`Default Persona`})]}),(0,A.jsxs)(`button`,{type:`button`,onClick:ue,className:`flex items-center gap-1 py-1.5 px-3 border border-rose-300 bg-rose-50 hover:bg-rose-100 text-rose-700 text-[11px] font-bold transition-all cursor-pointer rounded`,children:[(0,A.jsx)(S,{className:`w-3 h-3 text-rose-500`}),(0,A.jsxs)(`span`,{children:[`Reset Journey (`,B,`/150 LC)`]})]})]}),R&&(0,A.jsxs)(`div`,{className:`p-2.5 border-[2px] border-ink-black text-xs font-medium rounded flex items-center gap-2 ${R.type===`success`?`bg-emerald-100 border-emerald-600 text-emerald-900`:`bg-sky-100 border-sky-600 text-sky-900`}`,children:[(0,A.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}),R.text]})]}),(0,A.jsxs)(`div`,{className:`bg-white border-[3px] border-ink-black p-4 shadow-[4px_4px_0px_0px_rgba(30,41,59,1)] flex flex-col gap-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,A.jsx)(f,{className:`w-3.5 h-3.5 text-[#0ea5e9]`}),(0,A.jsx)(`h4`,{className:`text-xs font-bold uppercase font-headline-md m-0`,children:`Get Free API Keys`})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-2 text-[10px]`,children:[(0,A.jsxs)(`a`,{href:`https://console.groq.com/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,A.jsx)(`span`,{children:`Groq Cloud`}),(0,A.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,A.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Fast inference with generous free rate limits.`})]}),(0,A.jsxs)(`a`,{href:`https://aistudio.google.com/app/apikey`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,A.jsx)(`span`,{children:`Google AI Studio`}),(0,A.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,A.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Free Gemini Flash API quota.`})]}),(0,A.jsxs)(`a`,{href:`https://openrouter.ai/keys`,target:`_blank`,rel:`noopener noreferrer`,className:`p-2.5 border border-slate-200 hover:border-ink-black hover:bg-slate-50 rounded flex flex-col justify-between gap-1 transition-all no-underline text-inherit cursor-pointer`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,A.jsx)(`span`,{children:`OpenRouter`}),(0,A.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,A.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Unified API for open-weights models.`})]})]})]})]})}export{M as default};
|
algospaced-ui/dist/assets/{confetti.module-Cj_6Odin.js → confetti.module-CexOBsNI.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
import{H as e}from"./index-
|
| 2 |
`);try{t=new Worker(URL.createObjectURL(new Blob([n])))}catch(e){return typeof console<`u`&&typeof console.warn==`function`&&console.warn(`🎊 Could not load worker`,e),null}o(t)}return t}})(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:[`square`,`circle`],zIndex:100,colors:[`#26ccff`,`#a25afd`,`#ff5e7e`,`#88ff5a`,`#fcff42`,`#ffa62d`,`#ff36ff`],disableForReducedMotion:!1,scalar:1};function m(e,t){return t?t(e):e}function h(e){return e!=null}function g(e,t,n){return m(e&&h(e[t])?e[t]:p[t],n)}function _(e){return e<0?0:Math.floor(e)}function v(e,t){return Math.floor(Math.random()*(t-e))+e}function y(e){return parseInt(e,16)}function b(e){return e.map(x)}function x(e){var t=String(e).replace(/[^0-9a-f]/gi,``);return t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),{r:y(t.substring(0,2)),g:y(t.substring(2,4)),b:y(t.substring(4,6))}}function S(e){var t=g(e,`origin`,Object);return t.x=g(t,`x`,Number),t.y=g(t,`y`,Number),t}function C(e){e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight}function w(e){var t=e.getBoundingClientRect();e.width=t.width,e.height=t.height}function T(e){var t=document.createElement(`canvas`);return t.style.position=`fixed`,t.style.top=`0px`,t.style.left=`0px`,t.style.pointerEvents=`none`,t.style.zIndex=e,t}function E(e,t,n,r,i,a,o,s,c){e.save(),e.translate(t,n),e.rotate(a),e.scale(r,i),e.arc(0,0,1,o,s,c),e.restore()}function D(e){var t=e.angle*(Math.PI/180),n=e.spread*(Math.PI/180);return{x:e.x,y:e.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:e.startVelocity*.5+Math.random()*e.startVelocity,angle2D:-t+(.5*n-Math.random()*n),tiltAngle:(Math.random()*.5+.25)*Math.PI,color:e.color,shape:e.shape,tick:0,totalTicks:e.ticks,decay:e.decay,drift:e.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:e.gravity*3,ovalScalar:.6,scalar:e.scalar,flat:e.flat}}function O(e,t){t.x+=Math.cos(t.angle2D)*t.velocity+t.drift,t.y+=Math.sin(t.angle2D)*t.velocity+t.gravity,t.velocity*=t.decay,t.flat?(t.wobble=0,t.wobbleX=t.x+10*t.scalar,t.wobbleY=t.y+10*t.scalar,t.tiltSin=0,t.tiltCos=0,t.random=1):(t.wobble+=t.wobbleSpeed,t.wobbleX=t.x+10*t.scalar*Math.cos(t.wobble),t.wobbleY=t.y+10*t.scalar*Math.sin(t.wobble),t.tiltAngle+=.1,t.tiltSin=Math.sin(t.tiltAngle),t.tiltCos=Math.cos(t.tiltAngle),t.random=Math.random()+2);var n=t.tick++/t.totalTicks,r=t.x+t.random*t.tiltCos,i=t.y+t.random*t.tiltSin,a=t.wobbleX+t.random*t.tiltCos,s=t.wobbleY+t.random*t.tiltSin;if(e.fillStyle=`rgba(`+t.color.r+`, `+t.color.g+`, `+t.color.b+`, `+(1-n)+`)`,e.beginPath(),o&&t.shape.type===`path`&&typeof t.shape.path==`string`&&Array.isArray(t.shape.matrix))e.fill(N(t.shape.path,t.shape.matrix,t.x,t.y,Math.abs(a-r)*.1,Math.abs(s-i)*.1,Math.PI/10*t.wobble));else if(t.shape.type===`bitmap`){var c=Math.PI/10*t.wobble,l=Math.abs(a-r)*.1,d=Math.abs(s-i)*.1,f=t.shape.bitmap.width*t.scalar,p=t.shape.bitmap.height*t.scalar,m=new DOMMatrix([Math.cos(c)*l,Math.sin(c)*l,-Math.sin(c)*d,Math.cos(c)*d,t.x,t.y]);m.multiplySelf(new DOMMatrix(t.shape.matrix));var h=e.createPattern(u.transform(t.shape.bitmap),`no-repeat`);h.setTransform(m),e.globalAlpha=1-n,e.fillStyle=h,e.fillRect(t.x-f/2,t.y-p/2,f,p),e.globalAlpha=1}else if(t.shape===`circle`)e.ellipse?e.ellipse(t.x,t.y,Math.abs(a-r)*t.ovalScalar,Math.abs(s-i)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI):E(e,t.x,t.y,Math.abs(a-r)*t.ovalScalar,Math.abs(s-i)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI);else if(t.shape===`star`)for(var g=Math.PI/2*3,_=4*t.scalar,v=8*t.scalar,y=t.x,b=t.y,x=5,S=Math.PI/x;x--;)y=t.x+Math.cos(g)*v,b=t.y+Math.sin(g)*v,e.lineTo(y,b),g+=S,y=t.x+Math.cos(g)*_,b=t.y+Math.sin(g)*_,e.lineTo(y,b),g+=S;else e.moveTo(Math.floor(t.x),Math.floor(t.y)),e.lineTo(Math.floor(t.wobbleX),Math.floor(i)),e.lineTo(Math.floor(a),Math.floor(s)),e.lineTo(Math.floor(r),Math.floor(t.wobbleY));return e.closePath(),e.fill(),t.tick<t.totalTicks}function k(e,t,n,a,o){var s=t.slice(),c=e.getContext(`2d`),f,p,m=l(function(t){function l(){f=p=null,c.clearRect(0,0,a.width,a.height),u.clear(),o(),t()}function m(){r&&(a.width!==i.width||a.height!==i.height)&&(a.width=e.width=i.width,a.height=e.height=i.height),!a.width&&!a.height&&(n(e),a.width=e.width,a.height=e.height),c.clearRect(0,0,a.width,a.height),s=s.filter(function(e){return O(c,e)}),s.length?f=d.frame(m):l()}f=d.frame(m),p=l});return{addFettis:function(e){return s=s.concat(e),m},canvas:e,promise:m,reset:function(){f&&d.cancel(f),p&&p()}}}function A(e,n){var r=!e,i=!!g(n||{},`resize`),o=!1,s=g(n,`disableForReducedMotion`,Boolean),c=a&&g(n||{},`useWorker`)?f():null,u=r?C:w,d=e&&c?!!e.__confetti_initialized:!1,p=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion)`).matches,m;function h(t,n,r){for(var i=g(t,`particleCount`,_),a=g(t,`angle`,Number),o=g(t,`spread`,Number),s=g(t,`startVelocity`,Number),c=g(t,`decay`,Number),l=g(t,`gravity`,Number),d=g(t,`drift`,Number),f=g(t,`colors`,b),p=g(t,`ticks`,Number),h=g(t,`shapes`),y=g(t,`scalar`),x=!!g(t,`flat`),C=S(t),w=i,T=[],E=e.width*C.x,O=e.height*C.y;w--;)T.push(D({x:E,y:O,angle:a,spread:o,startVelocity:s,color:f[w%f.length],shape:h[v(0,h.length)],ticks:p,decay:c,gravity:l,drift:d,scalar:y,flat:x}));return m?m.addFettis(T):(m=k(e,T,u,n,r),m.promise)}function y(n){var a=s||g(n,`disableForReducedMotion`,Boolean),f=g(n,`zIndex`,Number);if(a&&p)return l(function(e){e()});r&&m?e=m.canvas:r&&!e&&(e=T(f),document.body.appendChild(e)),i&&!d&&u(e);var _={width:e.width,height:e.height};c&&!d&&c.init(e),d=!0,c&&(e.__confetti_initialized=!0);function v(){if(c){var t={getBoundingClientRect:function(){if(!r)return e.getBoundingClientRect()}};u(t),c.postMessage({resize:{width:t.width,height:t.height}});return}_.width=_.height=null}function y(){m=null,i&&(o=!1,t.removeEventListener(`resize`,v)),r&&e&&(document.body.contains(e)&&document.body.removeChild(e),e=null,d=!1)}return i&&!o&&(o=!0,t.addEventListener(`resize`,v,!1)),c?c.fire(n,_,y):h(n,_,y)}return y.reset=function(){c&&c.reset(),m&&m.reset()},y}var j;function M(){return j||=A(null,{useWorker:!0,resize:!0}),j}function N(e,t,n,r,i,a,o){var s=new Path2D(e),c=new Path2D;c.addPath(s,new DOMMatrix(t));var l=new Path2D;return l.addPath(c,new DOMMatrix([Math.cos(o)*i,Math.sin(o)*i,-Math.sin(o)*a,Math.cos(o)*a,n,r])),l}function P(e){if(!o)throw Error(`path confetti are not supported in this browser`);var t,n;typeof e==`string`?t=e:(t=e.path,n=e.matrix);var r=new Path2D(t),i=document.createElement(`canvas`).getContext(`2d`);if(!n){for(var a=1e3,s=a,c=a,l=0,u=0,d,f,p=0;p<a;p+=2)for(var m=0;m<a;m+=2)i.isPointInPath(r,p,m,`nonzero`)&&(s=Math.min(s,p),c=Math.min(c,m),l=Math.max(l,p),u=Math.max(u,m));d=l-s,f=u-c;var h=10,g=Math.min(h/d,h/f);n=[g,0,0,g,-Math.round(d/2+s)*g,-Math.round(f/2+c)*g]}return{type:`path`,path:t,matrix:n}}function F(e){var t,n=1,r=`#000000`,i=`"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif`;typeof e==`string`?t=e:(t=e.text,n=`scalar`in e?e.scalar:n,i=`fontFamily`in e?e.fontFamily:i,r=`color`in e?e.color:r);var a=10*n,o=``+a+`px `+i,s=new OffscreenCanvas(a,a),c=s.getContext(`2d`);c.font=o;var l=c.measureText(t),u=Math.ceil(l.actualBoundingBoxRight+l.actualBoundingBoxLeft),d=Math.ceil(l.actualBoundingBoxAscent+l.actualBoundingBoxDescent),f=2,p=l.actualBoundingBoxLeft+f,m=l.actualBoundingBoxAscent+f;u+=f+f,d+=f+f,s=new OffscreenCanvas(u,d),c=s.getContext(`2d`),c.font=o,c.fillStyle=r,c.fillText(t,p,m);var h=1/n;return{type:`bitmap`,bitmap:s.transferToImageBitmap(),matrix:[h,0,0,h,-u*h/2,-d*h/2]}}n.exports=function(){return M().apply(this,arguments)},n.exports.reset=function(){M().reset()},n.exports.create=A,n.exports.shapeFromPath=P,n.exports.shapeFromText=F})((function(){return typeof window<`u`?window:typeof self<`u`?self:this||{}})(),i,!1);var a=i.exports;i.exports.create;export{t as i,r as n,n as r,a as t};
|
|
|
|
| 1 |
+
import{H as e}from"./index-CPCBFJ0E.js";var t=e(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),n=e(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),r=e(`trophy`,[[`path`,{d:`M10 14.66V17a1 1 0 0 1-1 1 2 2 0 0 0-2 2v2`,key:`pwuv1l`}],[`path`,{d:`M14 14.66V17a1 1 0 0 0 1 1 2 2 0 0 1 2 2v2`,key:`1y54w1`}],[`path`,{d:`M17.916 10H19.5A2.5 2.5 0 0 0 22 7.5V5a1 1 0 0 0-1-1h-3`,key:`e30mpu`}],[`path`,{d:`M4 22h16`,key:`57wxv0`}],[`path`,{d:`M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z`,key:`1mhfuq`}],[`path`,{d:`M6.084 10H4.5A2.5 2.5 0 0 1 2 7.5V5a1 1 0 0 1 1-1h3`,key:`i0yafy`}]]),i={};(function e(t,n,r,i){var a=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o=typeof Path2D==`function`&&typeof DOMMatrix==`function`,s=(function(){if(!t.OffscreenCanvas)return!1;try{var e=new OffscreenCanvas(1,1),n=e.getContext(`2d`);n.fillRect(0,0,1,1);var r=e.transferToImageBitmap();n.createPattern(r,`no-repeat`)}catch{return!1}return!0})();function c(){}function l(e){var r=n.exports.Promise,i=r===void 0?t.Promise:r;return typeof i==`function`?new i(e):(e(c,c),null)}var u=(function(e,t){return{transform:function(n){if(e)return n;if(t.has(n))return t.get(n);var r=new OffscreenCanvas(n.width,n.height);return r.getContext(`2d`).drawImage(n,0,0),t.set(n,r),r},clear:function(){t.clear()}}})(s,new Map),d=function(){var e,t,n={},r=0;return typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`?(e=function(e){var t=Math.random();return n[t]=requestAnimationFrame(function i(a){r===a||r+16-1<a?(r=a,delete n[t],e()):n[t]=requestAnimationFrame(i)}),t},t=function(e){n[e]&&cancelAnimationFrame(n[e])}):(e=function(e){return setTimeout(e,16)},t=function(e){return clearTimeout(e)}),{frame:e,cancel:t}}(),f=(function(){var t,n,i={};function o(e){function t(t,n){e.postMessage({options:t||{},callback:n})}e.init=function(t){var n=t.transferControlToOffscreen();e.postMessage({canvas:n},[n])},e.fire=function(r,a,o){if(n)return t(r,null),n;var s=Math.random().toString(36).slice(2);return n=l(function(a){function c(t){t.data.callback===s&&(delete i[s],e.removeEventListener(`message`,c),n=null,u.clear(),o(),a())}e.addEventListener(`message`,c),t(r,s),i[s]=c.bind(null,{data:{callback:s}})}),n},e.reset=function(){for(var t in e.postMessage({reset:!0}),i)i[t](),delete i[t]}}return function(){if(t)return t;if(!r&&a){var n=[`var CONFETTI, SIZE = {}, module = {};`,`(`+e.toString()+`)(this, module, true, SIZE);`,`onmessage = function(msg) {`,` if (msg.data.options) {`,` CONFETTI(msg.data.options).then(function () {`,` if (msg.data.callback) {`,` postMessage({ callback: msg.data.callback });`,` }`,` });`,` } else if (msg.data.reset) {`,` CONFETTI && CONFETTI.reset();`,` } else if (msg.data.resize) {`,` SIZE.width = msg.data.resize.width;`,` SIZE.height = msg.data.resize.height;`,` } else if (msg.data.canvas) {`,` SIZE.width = msg.data.canvas.width;`,` SIZE.height = msg.data.canvas.height;`,` CONFETTI = module.exports.create(msg.data.canvas);`,` }`,`}`].join(`
|
| 2 |
`);try{t=new Worker(URL.createObjectURL(new Blob([n])))}catch(e){return typeof console<`u`&&typeof console.warn==`function`&&console.warn(`🎊 Could not load worker`,e),null}o(t)}return t}})(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:[`square`,`circle`],zIndex:100,colors:[`#26ccff`,`#a25afd`,`#ff5e7e`,`#88ff5a`,`#fcff42`,`#ffa62d`,`#ff36ff`],disableForReducedMotion:!1,scalar:1};function m(e,t){return t?t(e):e}function h(e){return e!=null}function g(e,t,n){return m(e&&h(e[t])?e[t]:p[t],n)}function _(e){return e<0?0:Math.floor(e)}function v(e,t){return Math.floor(Math.random()*(t-e))+e}function y(e){return parseInt(e,16)}function b(e){return e.map(x)}function x(e){var t=String(e).replace(/[^0-9a-f]/gi,``);return t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),{r:y(t.substring(0,2)),g:y(t.substring(2,4)),b:y(t.substring(4,6))}}function S(e){var t=g(e,`origin`,Object);return t.x=g(t,`x`,Number),t.y=g(t,`y`,Number),t}function C(e){e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight}function w(e){var t=e.getBoundingClientRect();e.width=t.width,e.height=t.height}function T(e){var t=document.createElement(`canvas`);return t.style.position=`fixed`,t.style.top=`0px`,t.style.left=`0px`,t.style.pointerEvents=`none`,t.style.zIndex=e,t}function E(e,t,n,r,i,a,o,s,c){e.save(),e.translate(t,n),e.rotate(a),e.scale(r,i),e.arc(0,0,1,o,s,c),e.restore()}function D(e){var t=e.angle*(Math.PI/180),n=e.spread*(Math.PI/180);return{x:e.x,y:e.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:e.startVelocity*.5+Math.random()*e.startVelocity,angle2D:-t+(.5*n-Math.random()*n),tiltAngle:(Math.random()*.5+.25)*Math.PI,color:e.color,shape:e.shape,tick:0,totalTicks:e.ticks,decay:e.decay,drift:e.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:e.gravity*3,ovalScalar:.6,scalar:e.scalar,flat:e.flat}}function O(e,t){t.x+=Math.cos(t.angle2D)*t.velocity+t.drift,t.y+=Math.sin(t.angle2D)*t.velocity+t.gravity,t.velocity*=t.decay,t.flat?(t.wobble=0,t.wobbleX=t.x+10*t.scalar,t.wobbleY=t.y+10*t.scalar,t.tiltSin=0,t.tiltCos=0,t.random=1):(t.wobble+=t.wobbleSpeed,t.wobbleX=t.x+10*t.scalar*Math.cos(t.wobble),t.wobbleY=t.y+10*t.scalar*Math.sin(t.wobble),t.tiltAngle+=.1,t.tiltSin=Math.sin(t.tiltAngle),t.tiltCos=Math.cos(t.tiltAngle),t.random=Math.random()+2);var n=t.tick++/t.totalTicks,r=t.x+t.random*t.tiltCos,i=t.y+t.random*t.tiltSin,a=t.wobbleX+t.random*t.tiltCos,s=t.wobbleY+t.random*t.tiltSin;if(e.fillStyle=`rgba(`+t.color.r+`, `+t.color.g+`, `+t.color.b+`, `+(1-n)+`)`,e.beginPath(),o&&t.shape.type===`path`&&typeof t.shape.path==`string`&&Array.isArray(t.shape.matrix))e.fill(N(t.shape.path,t.shape.matrix,t.x,t.y,Math.abs(a-r)*.1,Math.abs(s-i)*.1,Math.PI/10*t.wobble));else if(t.shape.type===`bitmap`){var c=Math.PI/10*t.wobble,l=Math.abs(a-r)*.1,d=Math.abs(s-i)*.1,f=t.shape.bitmap.width*t.scalar,p=t.shape.bitmap.height*t.scalar,m=new DOMMatrix([Math.cos(c)*l,Math.sin(c)*l,-Math.sin(c)*d,Math.cos(c)*d,t.x,t.y]);m.multiplySelf(new DOMMatrix(t.shape.matrix));var h=e.createPattern(u.transform(t.shape.bitmap),`no-repeat`);h.setTransform(m),e.globalAlpha=1-n,e.fillStyle=h,e.fillRect(t.x-f/2,t.y-p/2,f,p),e.globalAlpha=1}else if(t.shape===`circle`)e.ellipse?e.ellipse(t.x,t.y,Math.abs(a-r)*t.ovalScalar,Math.abs(s-i)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI):E(e,t.x,t.y,Math.abs(a-r)*t.ovalScalar,Math.abs(s-i)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI);else if(t.shape===`star`)for(var g=Math.PI/2*3,_=4*t.scalar,v=8*t.scalar,y=t.x,b=t.y,x=5,S=Math.PI/x;x--;)y=t.x+Math.cos(g)*v,b=t.y+Math.sin(g)*v,e.lineTo(y,b),g+=S,y=t.x+Math.cos(g)*_,b=t.y+Math.sin(g)*_,e.lineTo(y,b),g+=S;else e.moveTo(Math.floor(t.x),Math.floor(t.y)),e.lineTo(Math.floor(t.wobbleX),Math.floor(i)),e.lineTo(Math.floor(a),Math.floor(s)),e.lineTo(Math.floor(r),Math.floor(t.wobbleY));return e.closePath(),e.fill(),t.tick<t.totalTicks}function k(e,t,n,a,o){var s=t.slice(),c=e.getContext(`2d`),f,p,m=l(function(t){function l(){f=p=null,c.clearRect(0,0,a.width,a.height),u.clear(),o(),t()}function m(){r&&(a.width!==i.width||a.height!==i.height)&&(a.width=e.width=i.width,a.height=e.height=i.height),!a.width&&!a.height&&(n(e),a.width=e.width,a.height=e.height),c.clearRect(0,0,a.width,a.height),s=s.filter(function(e){return O(c,e)}),s.length?f=d.frame(m):l()}f=d.frame(m),p=l});return{addFettis:function(e){return s=s.concat(e),m},canvas:e,promise:m,reset:function(){f&&d.cancel(f),p&&p()}}}function A(e,n){var r=!e,i=!!g(n||{},`resize`),o=!1,s=g(n,`disableForReducedMotion`,Boolean),c=a&&g(n||{},`useWorker`)?f():null,u=r?C:w,d=e&&c?!!e.__confetti_initialized:!1,p=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion)`).matches,m;function h(t,n,r){for(var i=g(t,`particleCount`,_),a=g(t,`angle`,Number),o=g(t,`spread`,Number),s=g(t,`startVelocity`,Number),c=g(t,`decay`,Number),l=g(t,`gravity`,Number),d=g(t,`drift`,Number),f=g(t,`colors`,b),p=g(t,`ticks`,Number),h=g(t,`shapes`),y=g(t,`scalar`),x=!!g(t,`flat`),C=S(t),w=i,T=[],E=e.width*C.x,O=e.height*C.y;w--;)T.push(D({x:E,y:O,angle:a,spread:o,startVelocity:s,color:f[w%f.length],shape:h[v(0,h.length)],ticks:p,decay:c,gravity:l,drift:d,scalar:y,flat:x}));return m?m.addFettis(T):(m=k(e,T,u,n,r),m.promise)}function y(n){var a=s||g(n,`disableForReducedMotion`,Boolean),f=g(n,`zIndex`,Number);if(a&&p)return l(function(e){e()});r&&m?e=m.canvas:r&&!e&&(e=T(f),document.body.appendChild(e)),i&&!d&&u(e);var _={width:e.width,height:e.height};c&&!d&&c.init(e),d=!0,c&&(e.__confetti_initialized=!0);function v(){if(c){var t={getBoundingClientRect:function(){if(!r)return e.getBoundingClientRect()}};u(t),c.postMessage({resize:{width:t.width,height:t.height}});return}_.width=_.height=null}function y(){m=null,i&&(o=!1,t.removeEventListener(`resize`,v)),r&&e&&(document.body.contains(e)&&document.body.removeChild(e),e=null,d=!1)}return i&&!o&&(o=!0,t.addEventListener(`resize`,v,!1)),c?c.fire(n,_,y):h(n,_,y)}return y.reset=function(){c&&c.reset(),m&&m.reset()},y}var j;function M(){return j||=A(null,{useWorker:!0,resize:!0}),j}function N(e,t,n,r,i,a,o){var s=new Path2D(e),c=new Path2D;c.addPath(s,new DOMMatrix(t));var l=new Path2D;return l.addPath(c,new DOMMatrix([Math.cos(o)*i,Math.sin(o)*i,-Math.sin(o)*a,Math.cos(o)*a,n,r])),l}function P(e){if(!o)throw Error(`path confetti are not supported in this browser`);var t,n;typeof e==`string`?t=e:(t=e.path,n=e.matrix);var r=new Path2D(t),i=document.createElement(`canvas`).getContext(`2d`);if(!n){for(var a=1e3,s=a,c=a,l=0,u=0,d,f,p=0;p<a;p+=2)for(var m=0;m<a;m+=2)i.isPointInPath(r,p,m,`nonzero`)&&(s=Math.min(s,p),c=Math.min(c,m),l=Math.max(l,p),u=Math.max(u,m));d=l-s,f=u-c;var h=10,g=Math.min(h/d,h/f);n=[g,0,0,g,-Math.round(d/2+s)*g,-Math.round(f/2+c)*g]}return{type:`path`,path:t,matrix:n}}function F(e){var t,n=1,r=`#000000`,i=`"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif`;typeof e==`string`?t=e:(t=e.text,n=`scalar`in e?e.scalar:n,i=`fontFamily`in e?e.fontFamily:i,r=`color`in e?e.color:r);var a=10*n,o=``+a+`px `+i,s=new OffscreenCanvas(a,a),c=s.getContext(`2d`);c.font=o;var l=c.measureText(t),u=Math.ceil(l.actualBoundingBoxRight+l.actualBoundingBoxLeft),d=Math.ceil(l.actualBoundingBoxAscent+l.actualBoundingBoxDescent),f=2,p=l.actualBoundingBoxLeft+f,m=l.actualBoundingBoxAscent+f;u+=f+f,d+=f+f,s=new OffscreenCanvas(u,d),c=s.getContext(`2d`),c.font=o,c.fillStyle=r,c.fillText(t,p,m);var h=1/n;return{type:`bitmap`,bitmap:s.transferToImageBitmap(),matrix:[h,0,0,h,-u*h/2,-d*h/2]}}n.exports=function(){return M().apply(this,arguments)},n.exports.reset=function(){M().reset()},n.exports.create=A,n.exports.shapeFromPath=P,n.exports.shapeFromText=F})((function(){return typeof window<`u`?window:typeof self<`u`?self:this||{}})(),i,!1);var a=i.exports;i.exports.create;export{t as i,r as n,n as r,a as t};
|
algospaced-ui/dist/assets/{external-link-2pRbXZFT.js → external-link-D_lyOHrp.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{H as e}from"./index-
|
|
|
|
| 1 |
+
import{H as e}from"./index-CPCBFJ0E.js";var t=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);export{t};
|
algospaced-ui/dist/assets/{eye-DiDlGDv5.js → eye-DYmzmFTZ.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{H as e}from"./index-
|
|
|
|
| 1 |
+
import{H as e}from"./index-CPCBFJ0E.js";var t=e(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),n=e(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),r=e(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);export{n,t as r,r as t};
|
algospaced-ui/dist/assets/{githubSyncService-D3lo509P.js → githubSyncService-CjQshwem.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{i as e}from"./jsx-runtime-j9uSgrFF.js";import{H as t}from"./index-
|
|
|
|
| 1 |
+
import{i as e}from"./jsx-runtime-j9uSgrFF.js";import{H as t}from"./index-CPCBFJ0E.js";var n=t(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),r={TOKEN:`algospaced_github_token`,USERNAME:`algospaced_github_username`,REPO:`algospaced_github_repo`,BRANCH:`algospaced_github_branch`,AUTOCOMMIT:`algospaced_github_autocommit`,PRIVATE:`algospaced_github_private`,AVATAR:`algospaced_github_avatar`,NAME:`algospaced_github_name`};function i(){return{token:localStorage.getItem(r.TOKEN)||``,username:localStorage.getItem(r.USERNAME)||``,repoName:localStorage.getItem(r.REPO)||`algospaced-solutions`,branch:localStorage.getItem(r.BRANCH)||`main`,autoCommit:localStorage.getItem(r.AUTOCOMMIT)!==`false`,isPrivate:localStorage.getItem(r.PRIVATE)!==`false`}}function a(){let e=localStorage.getItem(r.USERNAME);return e?{login:e,name:localStorage.getItem(r.NAME)||e,avatar_url:localStorage.getItem(r.AVATAR)||``,html_url:`https://github.com/${e}`}:null}function o(e,t){e.token!==void 0&&localStorage.setItem(r.TOKEN,e.token.trim()),e.username!==void 0&&localStorage.setItem(r.USERNAME,e.username.trim()),e.repoName!==void 0&&localStorage.setItem(r.REPO,e.repoName.trim()),e.branch!==void 0&&localStorage.setItem(r.BRANCH,e.branch.trim()),e.autoCommit!==void 0&&localStorage.setItem(r.AUTOCOMMIT,String(e.autoCommit)),e.isPrivate!==void 0&&localStorage.setItem(r.PRIVATE,String(e.isPrivate)),t&&(t.login&&localStorage.setItem(r.USERNAME,t.login),t.name&&localStorage.setItem(r.NAME,t.name),t.avatar_url&&localStorage.setItem(r.AVATAR,t.avatar_url))}function s(){Object.values(r).forEach(e=>localStorage.removeItem(e))}async function c(){let e=window.open(`/api/github/oauth/login`,`algospaced_github_oauth`,`width=600,height=750,menubar=no,toolbar=no,status=no,location=no`);if(!e)throw Error(`Popup window was blocked by your browser. Please allow popups for AlgoSpaced and try again.`);let t=await new Promise((t,n)=>{let r=null,i=()=>{window.removeEventListener(`message`,a),r!==null&&(clearInterval(r),r=null)},a=e=>{if(!e.data||typeof e.data!=`object`)return;let r=e.data;r.type===`GITHUB_OAUTH_SUCCESS`?(i(),r.token&&typeof r.token==`string`?t(r.token.trim()):n(Error(`GitHub authorization succeeded but no access token was returned.`))):r.type===`GITHUB_OAUTH_ERROR`&&(i(),n(Error(r.error||`GitHub authorization was denied or encountered an error.`)))};window.addEventListener(`message`,a),r=setInterval(()=>{e.closed&&(i(),n(Error(`GitHub authorization window was closed before completing.`)))},1e3)}),n=await l(t);if(!n.valid||!n.user)throw Error(n.error||`Failed to retrieve profile with GitHub token.`);let r=n.user;return o({token:t,username:r.login,repoName:i().repoName||`algospaced-solutions`},r),{token:t,user:r}}async function l(e){let t=await fetch(`/api/github/verify`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e.trim()})});return t.ok?await t.json():{valid:!1,error:(await t.json().catch(()=>({}))).detail||`Server returned error (${t.status})`}}async function u(e,t,n=!0){let r=await fetch(`/api/github/init-repo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e.trim(),repo_name:t.trim(),private:n})});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.detail||`Failed to initialize repository (${r.status})`)}return await r.json()}async function d(e){let t=await fetch(`/api/github/push-solution`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.detail||`Failed to commit solution (${t.status})`)}return await t.json()}async function f(t,n,r=`main`){let{data:{session:i}}=await e.auth.getSession(),a=i?`Bearer ${i.access_token}`:`Bearer sandbox`,o=await fetch(`/api/github/sync-all`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:a},body:JSON.stringify({token:t.trim(),repo:n.trim(),branch:r.trim()})});if(!o.ok){let e=await o.json().catch(()=>({}));throw Error(e.detail||`Sync failed (${o.status})`)}return await o.json()}export{u as a,f as c,a as i,l,c as n,d as o,i as r,o as s,s as t,n as u};
|
algospaced-ui/dist/assets/{index-BjHs_aR9.js → index-CPCBFJ0E.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
algospaced-ui/dist/assets/{info-DoO2J6qy.js → info-CZH6IVe4.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{H as e}from"./index-
|
|
|
|
| 1 |
+
import{H as e}from"./index-CPCBFJ0E.js";var t=e(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]);export{t};
|
algospaced-ui/dist/assets/{save-_CuJzOt0.js → save-DFA_q4GT.js}
RENAMED
|
@@ -1 +1 @@
|
|
| 1 |
-
import{H as e}from"./index-
|
|
|
|
| 1 |
+
import{H as e}from"./index-CPCBFJ0E.js";var t=e(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]);export{t};
|
algospaced-ui/dist/index.html
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
<link
|
| 14 |
href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,700;12..96,800&family=Be+Vietnam+Pro:wght@500;700&family=Courier+Prime:wght@400;700&family=Press+Start+2P&family=Cinzel:wght@500;700;900&family=Cinzel+Decorative:wght@700;900&family=EB+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=Kalam:wght@400;700&display=swap"
|
| 15 |
rel="stylesheet" />
|
| 16 |
-
<script type="module" crossorigin src="/assets/index-
|
| 17 |
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-j9uSgrFF.js">
|
| 18 |
<link rel="stylesheet" crossorigin href="/assets/index-DeCNEAUd.css">
|
| 19 |
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
|
|
|
|
| 13 |
<link
|
| 14 |
href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,700;12..96,800&family=Be+Vietnam+Pro:wght@500;700&family=Courier+Prime:wght@400;700&family=Press+Start+2P&family=Cinzel:wght@500;700;900&family=Cinzel+Decorative:wght@700;900&family=EB+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=Kalam:wght@400;700&display=swap"
|
| 15 |
rel="stylesheet" />
|
| 16 |
+
<script type="module" crossorigin src="/assets/index-CPCBFJ0E.js"></script>
|
| 17 |
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-j9uSgrFF.js">
|
| 18 |
<link rel="stylesheet" crossorigin href="/assets/index-DeCNEAUd.css">
|
| 19 |
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
|
algospaced-ui/dist/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
if(!self.define){let s,e={};const l=(l,
|
|
|
|
| 1 |
+
if(!self.define){let s,e={};const l=(l,n)=>(l=new URL(l+".js",n).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(n,i)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let u={};const t=s=>l(s,r),o={module:{uri:r},exports:u,require:t};e[r]=Promise.all(n.map(s=>o[s]||t(s))).then(s=>(i(...s),u))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"c3843c34b82a10479eb3ffb6fd6dc550"},{url:"assets/TerminalEmulator-CI1oWIOR.js",revision:null},{url:"assets/Settings-DCDc0IAI.js",revision:null},{url:"assets/save-DFA_q4GT.js",revision:null},{url:"assets/ReviewQueue-LqZVd9BQ.js",revision:null},{url:"assets/PythonChallenge-O0le9Y-n.js",revision:null},{url:"assets/PrincessChamber-DMbQcfRj.js",revision:null},{url:"assets/MySQLPlayground-BdJWX3_8.js",revision:null},{url:"assets/jsx-runtime-j9uSgrFF.js",revision:null},{url:"assets/JourneyPath-BOxOnYvR.js",revision:null},{url:"assets/info-CZH6IVe4.js",revision:null},{url:"assets/index-DeCNEAUd.css",revision:null},{url:"assets/index-CPCBFJ0E.js",revision:null},{url:"assets/GitHubSyncWindow-CPAEU3Yo.js",revision:null},{url:"assets/githubSyncService-CjQshwem.js",revision:null},{url:"assets/FileExplorer-CRW7B6yJ.js",revision:null},{url:"assets/eye-DYmzmFTZ.js",revision:null},{url:"assets/external-link-D_lyOHrp.js",revision:null},{url:"assets/CreateProblemForm-BKf7x66j.js",revision:null},{url:"assets/confetti.module-CexOBsNI.js",revision:null},{url:"manifest.webmanifest",revision:"7c8ff056d2e188c868d851bcb349e28e"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))});
|
algospaced-ui/src/data/neetcode150Data.ts
CHANGED
|
@@ -206,7 +206,7 @@ export const NEETCODE_150_DATA: CatalogProblem[] = [
|
|
| 206 |
"description": "Determine if a 9 x 9 Sudoku board is valid according to Sudoku rules.",
|
| 207 |
"examples": [
|
| 208 |
{
|
| 209 |
-
"input": "board =
|
| 210 |
"output": "true"
|
| 211 |
}
|
| 212 |
],
|
|
@@ -1836,7 +1836,7 @@ export const NEETCODE_150_DATA: CatalogProblem[] = [
|
|
| 1836 |
"description": "Return the maximum area of an island in grid. If there is no island, return 0.",
|
| 1837 |
"examples": [
|
| 1838 |
{
|
| 1839 |
-
"input": "grid = [[0,0,1,0,0,0,0,1,0,0,0,0,0],
|
| 1840 |
"output": "6"
|
| 1841 |
}
|
| 1842 |
],
|
|
@@ -1881,8 +1881,8 @@ export const NEETCODE_150_DATA: CatalogProblem[] = [
|
|
| 1881 |
"description": "Fill each empty room with the distance to its nearest gate. A gate is 0, a wall is -1, an empty room is 2147483647.",
|
| 1882 |
"examples": [
|
| 1883 |
{
|
| 1884 |
-
"input": "rooms = [[2147483647,-1,0,2147483647],
|
| 1885 |
-
"output": "[[3,-1,0,1],
|
| 1886 |
}
|
| 1887 |
],
|
| 1888 |
"constraints": [
|
|
|
|
| 206 |
"description": "Determine if a 9 x 9 Sudoku board is valid according to Sudoku rules.",
|
| 207 |
"examples": [
|
| 208 |
{
|
| 209 |
+
"input": "board = [[\"5\",\"3\",\".\",\".\",\"7\",\".\",\".\",\".\",\".\"],[\"6\",\".\",\".\",\"1\",\"9\",\"5\",\".\",\".\",.\"],[\".\",\"9\",\"8\",\".\",\".\",\".\",\".\",\"6\",.\"],[\"8\",\".\",\".\",\".\",\"6\",\".\",\".\",\".\",\"3\"],[\"4\",\".\",\".\",\"8\",\".\",\"3\",\".\",\".\",\"1\"],[\"7\",\".\",\".\",\".\",\"2\",\".\",\".\",\".\",\"6\"],[\".\",\"6\",\".\",\".\",\".\",\".\",\"2\",\"8\",.\"],[\".\",\".\",\".\",\"4\",\"1\",\"9\",\".\",\".\",\"5\"],[\".\",\".\",\".\",\".\",\"8\",\".\",\".\",\"7\",\"9\"]]",
|
| 210 |
"output": "true"
|
| 211 |
}
|
| 212 |
],
|
|
|
|
| 1836 |
"description": "Return the maximum area of an island in grid. If there is no island, return 0.",
|
| 1837 |
"examples": [
|
| 1838 |
{
|
| 1839 |
+
"input": "grid = [[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,1,1,0,0,1,0,1,0,0],[0,1,0,0,1,1,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0]]",
|
| 1840 |
"output": "6"
|
| 1841 |
}
|
| 1842 |
],
|
|
|
|
| 1881 |
"description": "Fill each empty room with the distance to its nearest gate. A gate is 0, a wall is -1, an empty room is 2147483647.",
|
| 1882 |
"examples": [
|
| 1883 |
{
|
| 1884 |
+
"input": "rooms = [[2147483647,-1,0,2147483647],[2147483647,2147483647,2147483647,-1],[2147483647,-1,2147483647,-1],[0,-1,2147483647,2147483647]]",
|
| 1885 |
+
"output": "[[3,-1,0,1],[2,2,1,-1],[1,-1,2,-1],[0,-1,3,4]]"
|
| 1886 |
}
|
| 1887 |
],
|
| 1888 |
"constraints": [
|
algospaced-ui/src/hooks/useSandboxRunner.ts
CHANGED
|
@@ -29,13 +29,16 @@ export function useSandboxRunner() {
|
|
| 29 |
return { input: ex?.input ?? '', expected: ex?.output ?? '' };
|
| 30 |
});
|
| 31 |
|
|
|
|
|
|
|
|
|
|
| 32 |
setSandboxRunning(true);
|
| 33 |
setSandboxResults(null);
|
| 34 |
setSandboxError(null);
|
| 35 |
setSavedRefSuccess(false);
|
| 36 |
|
| 37 |
try {
|
| 38 |
-
const res = await runSandboxTests(code, formattedCases);
|
| 39 |
setSandboxResults(res);
|
| 40 |
} catch (err: unknown) {
|
| 41 |
const msg = err instanceof Error ? err.message : 'Execution failed';
|
|
|
|
| 29 |
return { input: ex?.input ?? '', expected: ex?.output ?? '' };
|
| 30 |
});
|
| 31 |
|
| 32 |
+
const starterCode = problem?.starter_code || catalogProb?.starter_code;
|
| 33 |
+
const problemName = problem?.name || catalogProb?.name;
|
| 34 |
+
|
| 35 |
setSandboxRunning(true);
|
| 36 |
setSandboxResults(null);
|
| 37 |
setSandboxError(null);
|
| 38 |
setSavedRefSuccess(false);
|
| 39 |
|
| 40 |
try {
|
| 41 |
+
const res = await runSandboxTests(code, formattedCases, 4.0, starterCode, problemName);
|
| 42 |
setSandboxResults(res);
|
| 43 |
} catch (err: unknown) {
|
| 44 |
const msg = err instanceof Error ? err.message : 'Execution failed';
|
algospaced-ui/src/services/reviewService.ts
CHANGED
|
@@ -177,7 +177,9 @@ export async function getOrGenerateAiSolution(params: {
|
|
| 177 |
export async function runSandboxTests(
|
| 178 |
code: string,
|
| 179 |
testCases: Array<{ input: unknown; expected: unknown }>,
|
| 180 |
-
timeout = 4.0
|
|
|
|
|
|
|
| 181 |
): Promise<SandboxRunResult> {
|
| 182 |
const token = await getAuthToken();
|
| 183 |
const res = await fetch(`${import.meta.env.VITE_API_BASE_URL}/api/reviews/test-run`, {
|
|
@@ -189,7 +191,9 @@ export async function runSandboxTests(
|
|
| 189 |
body: JSON.stringify({
|
| 190 |
code,
|
| 191 |
test_cases: testCases,
|
| 192 |
-
timeout
|
|
|
|
|
|
|
| 193 |
})
|
| 194 |
});
|
| 195 |
|
|
|
|
| 177 |
export async function runSandboxTests(
|
| 178 |
code: string,
|
| 179 |
testCases: Array<{ input: unknown; expected: unknown }>,
|
| 180 |
+
timeout = 4.0,
|
| 181 |
+
starterCode?: string,
|
| 182 |
+
problemName?: string
|
| 183 |
): Promise<SandboxRunResult> {
|
| 184 |
const token = await getAuthToken();
|
| 185 |
const res = await fetch(`${import.meta.env.VITE_API_BASE_URL}/api/reviews/test-run`, {
|
|
|
|
| 191 |
body: JSON.stringify({
|
| 192 |
code,
|
| 193 |
test_cases: testCases,
|
| 194 |
+
timeout,
|
| 195 |
+
starter_code: starterCode,
|
| 196 |
+
problem_name: problemName
|
| 197 |
})
|
| 198 |
});
|
| 199 |
|
routers/reviews.py
CHANGED
|
@@ -404,15 +404,24 @@ class TestRunRequest(BaseModel):
|
|
| 404 |
code: str
|
| 405 |
test_cases: list[dict]
|
| 406 |
timeout: float | None = 4.0
|
|
|
|
|
|
|
| 407 |
|
| 408 |
|
| 409 |
@router.post("/api/reviews/test-run")
|
| 410 |
def run_test_cases(req: TestRunRequest, client: Client = Depends(get_auth_session)):
|
| 411 |
-
res = sandbox.run_python_sandbox(
|
|
|
|
|
|
|
| 412 |
if res.get("success") and "results" in res:
|
| 413 |
results = res["results"]
|
| 414 |
total = len(results)
|
| 415 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
res["total_tests"] = total
|
| 417 |
res["passed_count"] = passed
|
| 418 |
res["status"] = "passed" if (total > 0 and passed == total) else "failed"
|
|
|
|
| 404 |
code: str
|
| 405 |
test_cases: list[dict]
|
| 406 |
timeout: float | None = 4.0
|
| 407 |
+
starter_code: str | None = None
|
| 408 |
+
problem_name: str | None = None
|
| 409 |
|
| 410 |
|
| 411 |
@router.post("/api/reviews/test-run")
|
| 412 |
def run_test_cases(req: TestRunRequest, client: Client = Depends(get_auth_session)):
|
| 413 |
+
res = sandbox.run_python_sandbox(
|
| 414 |
+
req.code, req.test_cases, timeout=req.timeout, starter_code=req.starter_code
|
| 415 |
+
)
|
| 416 |
if res.get("success") and "results" in res:
|
| 417 |
results = res["results"]
|
| 418 |
total = len(results)
|
| 419 |
+
for r in results:
|
| 420 |
+
if "passed" not in r:
|
| 421 |
+
r["passed"] = r.get("status") == "passed"
|
| 422 |
+
if "output" not in r and "got" in r:
|
| 423 |
+
r["output"] = r.get("got")
|
| 424 |
+
passed = sum(1 for r in results if r.get("passed") is True or r.get("status") == "passed")
|
| 425 |
res["total_tests"] = total
|
| 426 |
res["passed_count"] = passed
|
| 427 |
res["status"] = "passed" if (total > 0 and passed == total) else "failed"
|
sandbox.py
CHANGED
|
@@ -6,87 +6,389 @@ EXECUTION_TEMPLATE = """
|
|
| 6 |
import sys
|
| 7 |
import json
|
| 8 |
import traceback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
true = True
|
| 11 |
false = False
|
| 12 |
null = None
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# --- User Code Start ---
|
| 15 |
-
|
| 16 |
# --- User Code End ---
|
| 17 |
|
| 18 |
def run_tests():
|
| 19 |
try:
|
| 20 |
-
test_cases = json.loads(
|
| 21 |
except Exception:
|
| 22 |
-
test_cases =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
results = []
|
| 24 |
|
| 25 |
-
# Locate entry point function
|
| 26 |
func = None
|
| 27 |
if 'Solution' in globals() and isinstance(globals()['Solution'], type):
|
| 28 |
try:
|
| 29 |
sol_instance = globals()['Solution']()
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
except Exception:
|
| 37 |
pass
|
| 38 |
|
| 39 |
if not func:
|
| 40 |
-
if
|
|
|
|
|
|
|
| 41 |
func = globals()['solve']
|
| 42 |
else:
|
|
|
|
| 43 |
for name, obj in list(globals().items()):
|
| 44 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
func = obj
|
| 46 |
break
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
if not func:
|
| 49 |
-
print(json.dumps([ {
|
| 50 |
return
|
| 51 |
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
try:
|
| 54 |
sig = inspect.signature(func)
|
| 55 |
-
|
|
|
|
| 56 |
except Exception:
|
| 57 |
-
|
| 58 |
|
| 59 |
for idx, tc in enumerate(test_cases):
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
if not isinstance(inputs, list):
|
| 63 |
-
inputs = [inputs]
|
| 64 |
-
elif param_count == 1 and len(inputs) > 1:
|
| 65 |
-
inputs = [inputs]
|
| 66 |
try:
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
res = func(*args)
|
| 70 |
|
| 71 |
-
#
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
"index": idx,
|
| 75 |
"status": "passed" if is_match else "failed",
|
| 76 |
-
"
|
| 77 |
-
"
|
| 78 |
-
"
|
| 79 |
-
|
|
|
|
|
|
|
| 80 |
except Exception as e:
|
| 81 |
-
results.append({
|
| 82 |
"index": idx,
|
| 83 |
"status": "error",
|
| 84 |
-
"
|
| 85 |
-
"
|
|
|
|
|
|
|
|
|
|
| 86 |
"error": str(e),
|
| 87 |
"traceback": traceback.format_exc().splitlines()[-2:]
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
print(json.dumps(results))
|
| 91 |
|
| 92 |
if __name__ == '__main__':
|
|
@@ -94,13 +396,21 @@ if __name__ == '__main__':
|
|
| 94 |
"""
|
| 95 |
|
| 96 |
|
| 97 |
-
def run_python_sandbox(
|
|
|
|
|
|
|
| 98 |
"""
|
| 99 |
Executes user code against test cases in an isolated sandbox.
|
| 100 |
Attempts Docker execution first, then falls back to restricted subprocess.
|
| 101 |
"""
|
| 102 |
test_cases_json = json.dumps(test_cases)
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
# Try Docker execution
|
| 106 |
try:
|
|
|
|
| 6 |
import sys
|
| 7 |
import json
|
| 8 |
import traceback
|
| 9 |
+
import math
|
| 10 |
+
import heapq
|
| 11 |
+
import bisect
|
| 12 |
+
import collections
|
| 13 |
+
from collections import defaultdict, deque, Counter
|
| 14 |
+
import copy
|
| 15 |
+
import re
|
| 16 |
+
import inspect
|
| 17 |
+
from typing import List, Dict, Set, Tuple, Optional, Any, Union
|
| 18 |
|
| 19 |
true = True
|
| 20 |
false = False
|
| 21 |
null = None
|
| 22 |
|
| 23 |
+
class ListNode:
|
| 24 |
+
def __init__(self, val=0, next=None):
|
| 25 |
+
self.val = val
|
| 26 |
+
self.next = next
|
| 27 |
+
|
| 28 |
+
class TreeNode:
|
| 29 |
+
def __init__(self, val=0, left=None, right=None):
|
| 30 |
+
self.val = val
|
| 31 |
+
self.left = left
|
| 32 |
+
self.right = right
|
| 33 |
+
|
| 34 |
+
class Node:
|
| 35 |
+
def __init__(self, val=0, neighbors=None):
|
| 36 |
+
self.val = val
|
| 37 |
+
self.neighbors = neighbors if neighbors is not None else []
|
| 38 |
+
|
| 39 |
+
def list_to_linked_list(arr):
|
| 40 |
+
if not arr or not isinstance(arr, (list, tuple)):
|
| 41 |
+
return None
|
| 42 |
+
dummy = ListNode(0)
|
| 43 |
+
curr = dummy
|
| 44 |
+
for v in arr:
|
| 45 |
+
curr.next = ListNode(v)
|
| 46 |
+
curr = curr.next
|
| 47 |
+
return dummy.next
|
| 48 |
+
|
| 49 |
+
def linked_list_to_list(head):
|
| 50 |
+
res = []
|
| 51 |
+
curr = head
|
| 52 |
+
visited = set()
|
| 53 |
+
while curr is not None:
|
| 54 |
+
if id(curr) in visited:
|
| 55 |
+
break
|
| 56 |
+
visited.add(id(curr))
|
| 57 |
+
res.append(curr.val)
|
| 58 |
+
curr = curr.next
|
| 59 |
+
return res
|
| 60 |
+
|
| 61 |
+
def list_to_tree(arr):
|
| 62 |
+
if not arr or not isinstance(arr, (list, tuple)) or len(arr) == 0 or arr[0] is None:
|
| 63 |
+
return None
|
| 64 |
+
root = TreeNode(arr[0])
|
| 65 |
+
queue = deque([root])
|
| 66 |
+
i = 1
|
| 67 |
+
while queue and i < len(arr):
|
| 68 |
+
node = queue.popleft()
|
| 69 |
+
if i < len(arr) and arr[i] is not None:
|
| 70 |
+
node.left = TreeNode(arr[i])
|
| 71 |
+
queue.append(node.left)
|
| 72 |
+
i += 1
|
| 73 |
+
if i < len(arr) and arr[i] is not None:
|
| 74 |
+
node.right = TreeNode(arr[i])
|
| 75 |
+
queue.append(node.right)
|
| 76 |
+
i += 1
|
| 77 |
+
return root
|
| 78 |
+
|
| 79 |
+
def tree_to_list(root):
|
| 80 |
+
if not root:
|
| 81 |
+
return []
|
| 82 |
+
res = []
|
| 83 |
+
queue = deque([root])
|
| 84 |
+
while queue:
|
| 85 |
+
node = queue.popleft()
|
| 86 |
+
if node:
|
| 87 |
+
res.append(node.val)
|
| 88 |
+
queue.append(node.left)
|
| 89 |
+
queue.append(node.right)
|
| 90 |
+
else:
|
| 91 |
+
res.append(None)
|
| 92 |
+
while res and res[-1] is None:
|
| 93 |
+
res.pop()
|
| 94 |
+
return res
|
| 95 |
+
|
| 96 |
+
def split_assignments(s):
|
| 97 |
+
lines = []
|
| 98 |
+
current = []
|
| 99 |
+
in_quote = None
|
| 100 |
+
depth = 0
|
| 101 |
+
i = 0
|
| 102 |
+
while i < len(s):
|
| 103 |
+
ch = s[i]
|
| 104 |
+
if in_quote:
|
| 105 |
+
if ch == '\\\\':
|
| 106 |
+
current.append(ch)
|
| 107 |
+
if i + 1 < len(s):
|
| 108 |
+
i += 1
|
| 109 |
+
current.append(s[i])
|
| 110 |
+
elif ch == in_quote:
|
| 111 |
+
in_quote = None
|
| 112 |
+
current.append(ch)
|
| 113 |
+
else:
|
| 114 |
+
current.append(ch)
|
| 115 |
+
else:
|
| 116 |
+
if ch in ('\"', \"'\"):
|
| 117 |
+
in_quote = ch
|
| 118 |
+
current.append(ch)
|
| 119 |
+
elif ch in ('(', '[', '{'):
|
| 120 |
+
depth += 1
|
| 121 |
+
current.append(ch)
|
| 122 |
+
elif ch in (')', ']', '}'):
|
| 123 |
+
depth = max(0, depth - 1)
|
| 124 |
+
current.append(ch)
|
| 125 |
+
elif ch in (',', ';') and depth == 0:
|
| 126 |
+
rest = s[i+1:].lstrip()
|
| 127 |
+
if re.match(r'^[a-zA-Z_]\\w*\\s*=', rest):
|
| 128 |
+
lines.append(''.join(current).strip())
|
| 129 |
+
current = []
|
| 130 |
+
else:
|
| 131 |
+
current.append(ch)
|
| 132 |
+
else:
|
| 133 |
+
current.append(ch)
|
| 134 |
+
i += 1
|
| 135 |
+
if current:
|
| 136 |
+
lines.append(''.join(current).strip())
|
| 137 |
+
return lines
|
| 138 |
+
|
| 139 |
+
def parse_input_case(raw_input):
|
| 140 |
+
if isinstance(raw_input, (list, tuple)):
|
| 141 |
+
return list(raw_input), None
|
| 142 |
+
if isinstance(raw_input, dict):
|
| 143 |
+
return None, raw_input
|
| 144 |
+
if not isinstance(raw_input, str):
|
| 145 |
+
return [raw_input], None
|
| 146 |
+
s = raw_input.strip()
|
| 147 |
+
if not s:
|
| 148 |
+
return [], None
|
| 149 |
+
lines = split_assignments(s)
|
| 150 |
+
has_assignments = any('=' in line and re.match(r'^[a-zA-Z_]\\w*\\s*=', line.strip()) for line in lines)
|
| 151 |
+
if has_assignments:
|
| 152 |
+
loc = {}
|
| 153 |
+
env = {'true': True, 'false': False, 'null': None, 'ListNode': ListNode, 'TreeNode': TreeNode, 'Node': Node}
|
| 154 |
+
try:
|
| 155 |
+
exec('\\n'.join(lines), env, loc)
|
| 156 |
+
return None, loc
|
| 157 |
+
except Exception:
|
| 158 |
+
pass
|
| 159 |
+
try:
|
| 160 |
+
val = eval(s, {'true': True, 'false': False, 'null': None, 'ListNode': ListNode, 'TreeNode': TreeNode, 'Node': Node})
|
| 161 |
+
if isinstance(val, tuple):
|
| 162 |
+
return list(val), None
|
| 163 |
+
return [val], None
|
| 164 |
+
except Exception:
|
| 165 |
+
return [s], None
|
| 166 |
+
|
| 167 |
+
def parse_expected(raw_exp):
|
| 168 |
+
if not isinstance(raw_exp, str):
|
| 169 |
+
return raw_exp
|
| 170 |
+
s = raw_exp.strip()
|
| 171 |
+
try:
|
| 172 |
+
return eval(s, {'true': True, 'false': False, 'null': None, 'ListNode': ListNode, 'TreeNode': TreeNode, 'Node': Node})
|
| 173 |
+
except Exception:
|
| 174 |
+
return s
|
| 175 |
+
|
| 176 |
+
def check_match(got, exp, original_args=None):
|
| 177 |
+
if got == exp:
|
| 178 |
+
return True
|
| 179 |
+
if got is None and original_args and len(original_args) > 0:
|
| 180 |
+
mutated_arg = original_args[0]
|
| 181 |
+
if isinstance(mutated_arg, ListNode):
|
| 182 |
+
mutated_arg = linked_list_to_list(mutated_arg)
|
| 183 |
+
elif isinstance(mutated_arg, TreeNode):
|
| 184 |
+
mutated_arg = tree_to_list(mutated_arg)
|
| 185 |
+
if mutated_arg == exp:
|
| 186 |
+
return True
|
| 187 |
+
if isinstance(got, bool) and isinstance(exp, str):
|
| 188 |
+
if (got and exp.lower() == 'true') or (not got and exp.lower() == 'false'):
|
| 189 |
+
return True
|
| 190 |
+
if isinstance(exp, bool) and isinstance(got, str):
|
| 191 |
+
if (exp and got.lower() == 'true') or (not exp and got.lower() == 'false'):
|
| 192 |
+
return True
|
| 193 |
+
if isinstance(got, (int, float)) and isinstance(exp, (int, float)):
|
| 194 |
+
if math.isclose(got, exp, rel_tol=1e-5, abs_tol=1e-5):
|
| 195 |
+
return True
|
| 196 |
+
if isinstance(got, list) and isinstance(exp, list):
|
| 197 |
+
if len(got) == len(exp):
|
| 198 |
+
try:
|
| 199 |
+
if sorted(got) == sorted(exp):
|
| 200 |
+
return True
|
| 201 |
+
except Exception:
|
| 202 |
+
pass
|
| 203 |
+
try:
|
| 204 |
+
def normalize(item):
|
| 205 |
+
if isinstance(item, list):
|
| 206 |
+
return tuple(sorted(normalize(x) for x in item))
|
| 207 |
+
return str(item)
|
| 208 |
+
if sorted(normalize(x) for x in got) == sorted(normalize(x) for x in exp):
|
| 209 |
+
return True
|
| 210 |
+
except Exception:
|
| 211 |
+
pass
|
| 212 |
+
return False
|
| 213 |
+
|
| 214 |
+
_initial_globals = set(globals().keys())
|
| 215 |
+
|
| 216 |
# --- User Code Start ---
|
| 217 |
+
__USER_CODE__
|
| 218 |
# --- User Code End ---
|
| 219 |
|
| 220 |
def run_tests():
|
| 221 |
try:
|
| 222 |
+
test_cases = json.loads(__TEST_CASES_JSON__)
|
| 223 |
except Exception:
|
| 224 |
+
test_cases = []
|
| 225 |
+
|
| 226 |
+
starter_code = __STARTER_CODE_JSON__
|
| 227 |
+
target_method_name = None
|
| 228 |
+
if starter_code:
|
| 229 |
+
m = re.search(r'def\\s+([a-zA-Z_]\\w*)\\s*\\(', starter_code)
|
| 230 |
+
if m:
|
| 231 |
+
target_method_name = m.group(1)
|
| 232 |
+
|
| 233 |
results = []
|
| 234 |
|
| 235 |
+
# Locate entry point function or class
|
| 236 |
func = None
|
| 237 |
if 'Solution' in globals() and isinstance(globals()['Solution'], type):
|
| 238 |
try:
|
| 239 |
sol_instance = globals()['Solution']()
|
| 240 |
+
if target_method_name and hasattr(sol_instance, target_method_name):
|
| 241 |
+
func = getattr(sol_instance, target_method_name)
|
| 242 |
+
else:
|
| 243 |
+
for attr_name in dir(sol_instance):
|
| 244 |
+
if not attr_name.startswith('_'):
|
| 245 |
+
attr = getattr(sol_instance, attr_name)
|
| 246 |
+
if callable(attr):
|
| 247 |
+
func = attr
|
| 248 |
+
break
|
| 249 |
except Exception:
|
| 250 |
pass
|
| 251 |
|
| 252 |
if not func:
|
| 253 |
+
if target_method_name and target_method_name in globals() and callable(globals()[target_method_name]):
|
| 254 |
+
func = globals()[target_method_name]
|
| 255 |
+
elif 'solve' in globals() and callable(globals()['solve']):
|
| 256 |
func = globals()['solve']
|
| 257 |
else:
|
| 258 |
+
# First look for newly defined functions in user code
|
| 259 |
for name, obj in list(globals().items()):
|
| 260 |
+
if (
|
| 261 |
+
name not in _initial_globals
|
| 262 |
+
and name != 'run_tests'
|
| 263 |
+
and not name.startswith('_')
|
| 264 |
+
and callable(obj)
|
| 265 |
+
and not isinstance(obj, type)
|
| 266 |
+
):
|
| 267 |
func = obj
|
| 268 |
break
|
| 269 |
+
# If no function found, look for newly defined classes (e.g. design problems)
|
| 270 |
+
if not func:
|
| 271 |
+
for name, obj in list(globals().items()):
|
| 272 |
+
if (
|
| 273 |
+
name not in _initial_globals
|
| 274 |
+
and name != 'run_tests'
|
| 275 |
+
and not name.startswith('_')
|
| 276 |
+
and callable(obj)
|
| 277 |
+
):
|
| 278 |
+
func = obj
|
| 279 |
+
break
|
| 280 |
+
|
| 281 |
if not func:
|
| 282 |
+
print(json.dumps([ {"index": 0, "status": "error", "passed": False, "error": "No callable function found in your code. Please define a function or class Solution."} ]))
|
| 283 |
return
|
| 284 |
|
| 285 |
+
sig = None
|
| 286 |
+
params = []
|
| 287 |
+
param_names = []
|
| 288 |
try:
|
| 289 |
sig = inspect.signature(func)
|
| 290 |
+
params = [p for p in sig.parameters.values() if p.kind in (p.POSITIONAL_ONLY, p.POSITIONAL_OR_KEYWORD) and p.name != 'self']
|
| 291 |
+
param_names = [p.name for p in params]
|
| 292 |
except Exception:
|
| 293 |
+
pass
|
| 294 |
|
| 295 |
for idx, tc in enumerate(test_cases):
|
| 296 |
+
raw_input = tc.get("input", [])
|
| 297 |
+
raw_expected = tc.get("expected")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
try:
|
| 299 |
+
pos_args, kw_args = parse_input_case(raw_input)
|
| 300 |
+
call_args = []
|
|
|
|
| 301 |
|
| 302 |
+
# Check for design pattern (commands & args)
|
| 303 |
+
if kw_args is not None and "commands" in kw_args and "args" in kw_args:
|
| 304 |
+
cmds = kw_args["commands"]
|
| 305 |
+
c_args = kw_args["args"]
|
| 306 |
+
cls_name = cmds[0]
|
| 307 |
+
cls = globals().get(cls_name)
|
| 308 |
+
if cls and isinstance(cls, type):
|
| 309 |
+
inst = cls(*c_args[0])
|
| 310 |
+
got = [None]
|
| 311 |
+
for cmd, m_args in zip(cmds[1:], c_args[1:]):
|
| 312 |
+
m = getattr(inst, cmd)
|
| 313 |
+
got.append(m(*m_args))
|
| 314 |
+
exp = parse_expected(raw_expected)
|
| 315 |
+
is_match = check_match(got, exp)
|
| 316 |
+
results.append({
|
| 317 |
+
"index": idx,
|
| 318 |
+
"status": "passed" if is_match else "failed",
|
| 319 |
+
"passed": is_match,
|
| 320 |
+
"input": raw_input,
|
| 321 |
+
"expected": exp,
|
| 322 |
+
"output": got,
|
| 323 |
+
"got": got
|
| 324 |
+
})
|
| 325 |
+
continue
|
| 326 |
+
|
| 327 |
+
if kw_args is not None:
|
| 328 |
+
matched = [kw_args[name] for name in param_names if name in kw_args]
|
| 329 |
+
if len(matched) == len(param_names) and len(param_names) > 0:
|
| 330 |
+
call_args = matched
|
| 331 |
+
else:
|
| 332 |
+
call_args = list(kw_args.values())
|
| 333 |
+
else:
|
| 334 |
+
if len(params) == 1 and len(pos_args) > 1 and not (len(pos_args) == 1):
|
| 335 |
+
call_args = [pos_args]
|
| 336 |
+
else:
|
| 337 |
+
call_args = pos_args
|
| 338 |
+
|
| 339 |
+
# Convert ListNode / TreeNode arguments where applicable
|
| 340 |
+
for i, arg in enumerate(call_args):
|
| 341 |
+
p_name = param_names[i] if i < len(param_names) else ''
|
| 342 |
+
p_anno = str(params[i].annotation) if i < len(params) else ''
|
| 343 |
+
if isinstance(arg, (list, tuple)):
|
| 344 |
+
if 'ListNode' in p_anno or p_name.lower() in ('head', 'list1', 'list2', 'l1', 'l2', 'node'):
|
| 345 |
+
call_args[i] = list_to_linked_list(arg)
|
| 346 |
+
elif 'TreeNode' in p_anno or p_name.lower() in ('root', 'tree', 't1', 't2'):
|
| 347 |
+
call_args[i] = list_to_tree(arg)
|
| 348 |
+
|
| 349 |
+
args = copy.deepcopy(call_args)
|
| 350 |
+
res = func(*args)
|
| 351 |
+
|
| 352 |
+
res_serialized = res
|
| 353 |
+
if isinstance(res, ListNode):
|
| 354 |
+
res_serialized = linked_list_to_list(res)
|
| 355 |
+
elif isinstance(res, TreeNode):
|
| 356 |
+
res_serialized = tree_to_list(res)
|
| 357 |
+
|
| 358 |
+
exp = parse_expected(raw_expected)
|
| 359 |
+
is_match = check_match(res_serialized, exp, original_args=args)
|
| 360 |
+
|
| 361 |
+
# If match was found via in-place mutation, surface mutated arg in output
|
| 362 |
+
if is_match and res is None and args and len(args) > 0:
|
| 363 |
+
mutated_arg = args[0]
|
| 364 |
+
if isinstance(mutated_arg, ListNode):
|
| 365 |
+
mutated_arg = linked_list_to_list(mutated_arg)
|
| 366 |
+
elif isinstance(mutated_arg, TreeNode):
|
| 367 |
+
mutated_arg = tree_to_list(mutated_arg)
|
| 368 |
+
res_serialized = mutated_arg
|
| 369 |
+
|
| 370 |
+
results.append({
|
| 371 |
"index": idx,
|
| 372 |
"status": "passed" if is_match else "failed",
|
| 373 |
+
"passed": is_match,
|
| 374 |
+
"input": raw_input,
|
| 375 |
+
"expected": exp,
|
| 376 |
+
"output": res_serialized,
|
| 377 |
+
"got": res_serialized
|
| 378 |
+
})
|
| 379 |
except Exception as e:
|
| 380 |
+
results.append({
|
| 381 |
"index": idx,
|
| 382 |
"status": "error",
|
| 383 |
+
"passed": False,
|
| 384 |
+
"input": raw_input,
|
| 385 |
+
"expected": raw_expected,
|
| 386 |
+
"output": None,
|
| 387 |
+
"got": None,
|
| 388 |
"error": str(e),
|
| 389 |
"traceback": traceback.format_exc().splitlines()[-2:]
|
| 390 |
+
})
|
| 391 |
+
|
| 392 |
print(json.dumps(results))
|
| 393 |
|
| 394 |
if __name__ == '__main__':
|
|
|
|
| 396 |
"""
|
| 397 |
|
| 398 |
|
| 399 |
+
def run_python_sandbox(
|
| 400 |
+
user_code: str, test_cases: list, timeout: float = 4.0, starter_code: str | None = None
|
| 401 |
+
) -> dict:
|
| 402 |
"""
|
| 403 |
Executes user code against test cases in an isolated sandbox.
|
| 404 |
Attempts Docker execution first, then falls back to restricted subprocess.
|
| 405 |
"""
|
| 406 |
test_cases_json = json.dumps(test_cases)
|
| 407 |
+
starter_code_str = starter_code or ""
|
| 408 |
+
full_script = (
|
| 409 |
+
EXECUTION_TEMPLATE
|
| 410 |
+
.replace("__USER_CODE__", user_code)
|
| 411 |
+
.replace("__TEST_CASES_JSON__", json.dumps(test_cases_json))
|
| 412 |
+
.replace("__STARTER_CODE_JSON__", json.dumps(starter_code_str))
|
| 413 |
+
)
|
| 414 |
|
| 415 |
# Try Docker execution
|
| 416 |
try:
|
tests/unit/test_sandbox_advanced.py
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sandbox import run_python_sandbox
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class TestSandboxAdvancedFeatures:
|
| 5 |
+
def test_leetcode_string_input_two_sum(self):
|
| 6 |
+
"""LeetCode-style assignment strings should bind to method parameters."""
|
| 7 |
+
user_code = """
|
| 8 |
+
class Solution:
|
| 9 |
+
def twoSum(self, nums: list[int], target: int) -> list[int]:
|
| 10 |
+
lookup = {}
|
| 11 |
+
for i, num in enumerate(nums):
|
| 12 |
+
diff = target - num
|
| 13 |
+
if diff in lookup:
|
| 14 |
+
return [lookup[diff], i]
|
| 15 |
+
lookup[num] = i
|
| 16 |
+
return []
|
| 17 |
+
"""
|
| 18 |
+
test_cases = [
|
| 19 |
+
{"input": "nums = [2,7,11,15], target = 9", "expected": "[0,1]"},
|
| 20 |
+
{"input": "nums = [3,2,4], target = 6", "expected": "[1,2]"},
|
| 21 |
+
]
|
| 22 |
+
result = run_python_sandbox(user_code, test_cases)
|
| 23 |
+
assert result["success"] is True
|
| 24 |
+
results = result["results"]
|
| 25 |
+
assert len(results) == 2
|
| 26 |
+
assert results[0]["status"] == "passed"
|
| 27 |
+
assert results[0]["passed"] is True
|
| 28 |
+
assert results[0]["output"] == [0, 1]
|
| 29 |
+
assert results[1]["status"] == "passed"
|
| 30 |
+
assert results[1]["passed"] is True
|
| 31 |
+
assert results[1]["output"] == [1, 2]
|
| 32 |
+
|
| 33 |
+
def test_leetcode_boolean_string_comparison(self):
|
| 34 |
+
"""String outputs 'true' and 'false' should match Python booleans True and False."""
|
| 35 |
+
user_code = """
|
| 36 |
+
class Solution:
|
| 37 |
+
def containsDuplicate(self, nums: list[int]) -> bool:
|
| 38 |
+
seen = set()
|
| 39 |
+
for n in nums:
|
| 40 |
+
if n in seen:
|
| 41 |
+
return True
|
| 42 |
+
seen.add(n)
|
| 43 |
+
return False
|
| 44 |
+
"""
|
| 45 |
+
test_cases = [
|
| 46 |
+
{"input": "nums = [1,2,3,1]", "expected": "true"},
|
| 47 |
+
{"input": "nums = [1,2,3,4]", "expected": "false"},
|
| 48 |
+
]
|
| 49 |
+
result = run_python_sandbox(user_code, test_cases)
|
| 50 |
+
assert result["success"] is True
|
| 51 |
+
results = result["results"]
|
| 52 |
+
assert len(results) == 2
|
| 53 |
+
assert results[0]["status"] == "passed"
|
| 54 |
+
assert results[0]["passed"] is True
|
| 55 |
+
assert results[0]["output"] is True
|
| 56 |
+
assert results[1]["status"] == "passed"
|
| 57 |
+
assert results[1]["passed"] is True
|
| 58 |
+
assert results[1]["output"] is False
|
| 59 |
+
|
| 60 |
+
def test_linked_list_conversion(self):
|
| 61 |
+
"""Standard LeetCode ListNode conversion for inputs and outputs."""
|
| 62 |
+
user_code = """
|
| 63 |
+
class Solution:
|
| 64 |
+
def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
|
| 65 |
+
prev = None
|
| 66 |
+
curr = head
|
| 67 |
+
while curr:
|
| 68 |
+
nxt = curr.next
|
| 69 |
+
curr.next = prev
|
| 70 |
+
prev = curr
|
| 71 |
+
curr = nxt
|
| 72 |
+
return prev
|
| 73 |
+
"""
|
| 74 |
+
test_cases = [
|
| 75 |
+
{"input": "head = [1,2,3,4,5]", "expected": "[5,4,3,2,1]"},
|
| 76 |
+
{"input": "head = [1,2]", "expected": "[2,1]"},
|
| 77 |
+
]
|
| 78 |
+
result = run_python_sandbox(user_code, test_cases)
|
| 79 |
+
assert result["success"] is True
|
| 80 |
+
results = result["results"]
|
| 81 |
+
assert len(results) == 2
|
| 82 |
+
assert results[0]["status"] == "passed"
|
| 83 |
+
assert results[0]["passed"] is True
|
| 84 |
+
assert results[0]["output"] == [5, 4, 3, 2, 1]
|
| 85 |
+
assert results[1]["status"] == "passed"
|
| 86 |
+
assert results[1]["passed"] is True
|
| 87 |
+
assert results[1]["output"] == [2, 1]
|
| 88 |
+
|
| 89 |
+
def test_binary_tree_conversion(self):
|
| 90 |
+
"""Standard LeetCode TreeNode conversion for inputs and outputs."""
|
| 91 |
+
user_code = """
|
| 92 |
+
class Solution:
|
| 93 |
+
def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
|
| 94 |
+
if not root:
|
| 95 |
+
return None
|
| 96 |
+
root.left, root.right = self.invertTree(root.right), self.invertTree(root.left)
|
| 97 |
+
return root
|
| 98 |
+
"""
|
| 99 |
+
test_cases = [
|
| 100 |
+
{"input": "root = [4,2,7,1,3,6,9]", "expected": "[4,7,2,9,6,3,1]"},
|
| 101 |
+
{"input": "root = [2,1,3]", "expected": "[2,3,1]"},
|
| 102 |
+
]
|
| 103 |
+
result = run_python_sandbox(user_code, test_cases)
|
| 104 |
+
assert result["success"] is True
|
| 105 |
+
results = result["results"]
|
| 106 |
+
assert len(results) == 2
|
| 107 |
+
assert results[0]["status"] == "passed"
|
| 108 |
+
assert results[0]["passed"] is True
|
| 109 |
+
assert results[0]["output"] == [4, 7, 2, 9, 6, 3, 1]
|
| 110 |
+
assert results[1]["status"] == "passed"
|
| 111 |
+
assert results[1]["passed"] is True
|
| 112 |
+
assert results[1]["output"] == [2, 3, 1]
|
| 113 |
+
|
| 114 |
+
def test_in_place_mutation(self):
|
| 115 |
+
"""Functions mutating inputs in-place and returning None should be verified."""
|
| 116 |
+
user_code = """
|
| 117 |
+
class Solution:
|
| 118 |
+
def rotate(self, matrix: list[list[int]]) -> None:
|
| 119 |
+
matrix.reverse()
|
| 120 |
+
for i in range(len(matrix)):
|
| 121 |
+
for j in range(i):
|
| 122 |
+
matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
|
| 123 |
+
"""
|
| 124 |
+
test_cases = [
|
| 125 |
+
{
|
| 126 |
+
"input": "matrix = [[1,2,3],[4,5,6],[7,8,9]]",
|
| 127 |
+
"expected": "[[7,4,1],[8,5,2],[9,6,3]]",
|
| 128 |
+
}
|
| 129 |
+
]
|
| 130 |
+
result = run_python_sandbox(user_code, test_cases)
|
| 131 |
+
assert result["success"] is True
|
| 132 |
+
results = result["results"]
|
| 133 |
+
assert len(results) == 1
|
| 134 |
+
assert results[0]["status"] == "passed"
|
| 135 |
+
assert results[0]["passed"] is True
|
| 136 |
+
assert results[0]["output"] == [[7, 4, 1], [8, 5, 2], [9, 6, 3]]
|
| 137 |
+
|
| 138 |
+
def test_order_independent_group_anagrams(self):
|
| 139 |
+
"""Unordered lists of lists should compare correctly regardless of permutations."""
|
| 140 |
+
user_code = """
|
| 141 |
+
from collections import defaultdict
|
| 142 |
+
|
| 143 |
+
class Solution:
|
| 144 |
+
def groupAnagrams(self, strs: list[str]) -> list[list[str]]:
|
| 145 |
+
ans = defaultdict(list)
|
| 146 |
+
for s in strs:
|
| 147 |
+
ans[tuple(sorted(s))].append(s)
|
| 148 |
+
return list(ans.values())
|
| 149 |
+
"""
|
| 150 |
+
test_cases = [
|
| 151 |
+
{
|
| 152 |
+
"input": 'strs = ["eat","tea","tan","ate","nat","bat"]',
|
| 153 |
+
"expected": '[["bat"],["nat","tan"],["ate","eat","tea"]]',
|
| 154 |
+
}
|
| 155 |
+
]
|
| 156 |
+
result = run_python_sandbox(user_code, test_cases)
|
| 157 |
+
assert result["success"] is True
|
| 158 |
+
results = result["results"]
|
| 159 |
+
assert len(results) == 1
|
| 160 |
+
assert results[0]["status"] == "passed"
|
| 161 |
+
assert results[0]["passed"] is True
|
| 162 |
+
|
| 163 |
+
def test_design_pattern_min_stack(self):
|
| 164 |
+
"""Design problem execution with commands and arguments."""
|
| 165 |
+
user_code = """
|
| 166 |
+
class MinStack:
|
| 167 |
+
def __init__(self):
|
| 168 |
+
self.stack = []
|
| 169 |
+
self.min_stack = []
|
| 170 |
+
|
| 171 |
+
def push(self, val: int) -> None:
|
| 172 |
+
self.stack.append(val)
|
| 173 |
+
val = min(val, self.min_stack[-1] if self.min_stack else val)
|
| 174 |
+
self.min_stack.append(val)
|
| 175 |
+
|
| 176 |
+
def pop(self) -> None:
|
| 177 |
+
self.stack.pop()
|
| 178 |
+
self.min_stack.pop()
|
| 179 |
+
|
| 180 |
+
def top(self) -> int:
|
| 181 |
+
return self.stack[-1]
|
| 182 |
+
|
| 183 |
+
def getMin(self) -> int:
|
| 184 |
+
return self.min_stack[-1]
|
| 185 |
+
"""
|
| 186 |
+
test_cases = [
|
| 187 |
+
{
|
| 188 |
+
"input": 'commands = ["MinStack","push","push","push","getMin","pop","top","getMin"], args = [[],[-2],[0],[-3],[],[],[],[]]',
|
| 189 |
+
"expected": "[null,null,null,null,-3,null,0,-2]",
|
| 190 |
+
}
|
| 191 |
+
]
|
| 192 |
+
result = run_python_sandbox(user_code, test_cases)
|
| 193 |
+
assert result["success"] is True
|
| 194 |
+
results = result["results"]
|
| 195 |
+
assert len(results) == 1
|
| 196 |
+
assert results[0]["status"] == "passed"
|
| 197 |
+
assert results[0]["passed"] is True
|
| 198 |
+
assert results[0]["output"] == [None, None, None, None, -3, None, 0, -2]
|