Spaces:
Running
Running
feat: clean list mode with problem-centric details and action buttons
Browse files- algospaced-ui/dist/assets/GitHubSyncWindow-CpAcWvDz.js +1 -0
- algospaced-ui/dist/assets/JourneyPath-C_8vR7RH.js +0 -0
- algospaced-ui/dist/assets/PrincessChamber-OupPwibb.js +1 -0
- algospaced-ui/dist/assets/PythonChallenge-giqkVw87.js +0 -0
- algospaced-ui/dist/assets/ReviewQueue-D9FVo5rc.js +0 -0
- algospaced-ui/dist/assets/Settings-DpVXEE8k.js +1 -0
- algospaced-ui/dist/assets/confetti.module-CfS3ygcu.js +2 -0
- algospaced-ui/dist/assets/external-link-Cop9hfwL.js +1 -0
- algospaced-ui/dist/assets/eye-CiHjdcBj.js +1 -0
- algospaced-ui/dist/assets/githubSyncService-3ubmhkb5.js +1 -0
- algospaced-ui/dist/assets/index-CXawvZhN.js +0 -0
- algospaced-ui/dist/assets/index-DzBXTnSt.css +0 -0
- algospaced-ui/dist/assets/info-LgaoobGM.js +1 -0
- algospaced-ui/dist/assets/save-DW0DTANa.js +1 -0
- algospaced-ui/dist/index.html +2 -2
- algospaced-ui/dist/sw.js +1 -1
- algospaced-ui/src/components/JourneyPath.tsx +6 -4
- algospaced-ui/src/components/map/JourneyListView.tsx +185 -129
algospaced-ui/dist/assets/GitHubSyncWindow-CpAcWvDz.js
ADDED
|
@@ -0,0 +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-CiHjdcBj.js";import{t as o}from"./external-link-Cop9hfwL.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-3ubmhkb5.js";import{C as _,L as v,N as y,U as b,V as x}from"./index-CXawvZhN.js";var S=b(`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=b(`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=b(`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=b(`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,b]=(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();b(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),b(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}),b(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(),b(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)(y,{className:`w-3 h-3 animate-spin`}):(0,D.jsx)(x,{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;b(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;b(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)(_,{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)(y,{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)(y,{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)(y,{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)(y,{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)(x,{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)(v,{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-C_8vR7RH.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
algospaced-ui/dist/assets/PrincessChamber-OupPwibb.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{a as e,c as t,s as n,t as r}from"./jsx-runtime-j9uSgrFF.js";import{C as i,E as a,H as o,L as s,M as c,O as l,P as u,S as d,T as f,U as p,_ as m,b as h,g,h as _,k as v,v as y,w as b,x,y as S}from"./index-CXawvZhN.js";var C=p(`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=p(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),T=p(`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=p(`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=p(`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=p(`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=y[e]||y.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)(v,{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)(v,{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),p=(0,k.useRef)(0),m=(0,k.useRef)(o);(0,k.useEffect)(()=>{m.current=o},[o]);let h=y[n]||y.smiling_warmly,_=e=>{u(e),m.current?.(e)};return(0,k.useEffect)(()=>{if(i){d.current&&clearInterval(d.current),c(e),_(!0),e.length-p.current>=4&&(p.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),_(!1);else{c(``),_(!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),_(!1))},22)}}else!r&&e===f.current&&!i&&(c(e),l&&_(!1));return()=>{d.current&&clearInterval(d.current)}},[e,r,i]),(0,M.jsxs)(`div`,{onClick:()=>{l&&(d.current&&clearInterval(d.current),c(e),_(!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:h.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)(v,{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=d(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)(b,{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:a,recentToolTelemetry:c,onRemoveCodexItem:d,onClose:f}){let[p,m]=(0,k.useState)(`letters`),[h,g]=(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:f,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:f,className:`p-1 hover:bg-slate-200 rounded text-slate-700 cursor-pointer`,title:`Close`,children:(0,M.jsx)(b,{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:()=>m(`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 ${p===`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:()=>m(`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 ${p===`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)(o,{className:`w-3.5 h-3.5`}),(0,M.jsxs)(`span`,{children:[`Chronicles (`,t.length,`)`]})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>m(`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 ${p===`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)(v,{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:[p===`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=x[e],r=n>=e,i=h?.floor===e;return(0,M.jsxs)(`button`,{type:`button`,disabled:!r,onClick:()=>r&&g(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)(u,{className:`w-3 h-3`}),(0,M.jsxs)(`span`,{children:[`League `,e]})]},e)})}),h?(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:[h.chapterTitle,` • League `,h.floor]}),(0,M.jsx)(`h5`,{className:`font-headline-md font-bold text-sm text-amber-950 m-0`,children:h.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:h.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)(u,{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.`})]})]}),p===`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)(o,{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.`})]})}),p===`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)(v,{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,d&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>d(`strengths`,e),className:`hover:text-red-600 ml-0.5 cursor-pointer`,title:`Forget strength`,children:(0,M.jsx)(b,{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,d&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>d(`nemesisPatterns`,e),className:`hover:text-red-700 ml-0.5 cursor-pointer`,title:`Forget nemesis`,children:(0,M.jsx)(b,{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]}),d&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>d(`personalNotes`,e),className:`text-slate-400 hover:text-red-600 shrink-0 cursor-pointer p-0.5`,title:`Forget note`,children:(0,M.jsx)(l,{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.`})]}),a&&a.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:[a.length,` events`]})]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-2 max-h-40 overflow-y-auto custom-scrollbar`,children:a.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)(i,{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:[c?.length||0,` executed`]})]}),c&&c.length>0?(0,M.jsx)(`div`,{className:`flex flex-col gap-1.5 max-h-36 overflow-y-auto custom-scrollbar`,children:c.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:f,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=h(),[t,n]=(0,k.useState)(_()),[r,i]=(0,k.useState)(!1),[o,s]=(0,k.useState)(!1),[l,u]=(0,k.useState)(!1);(0,k.useEffect)(()=>{S.syncWithBackend(),S.triggerProactiveGreeting()},[]);let d=()=>{let e=!t;n(e),m(e)},p=()=>{window.confirm(`Clear conversation transcript with Princess Aurelia?`)&&S.clearTranscript()},g=(0,k.useCallback)(e=>{S.setIsTyping(e)},[]),y=(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)(v,{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:()=>i(!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:d,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)(f,{className:`w-3.5 h-3.5`}):(0,M.jsx)(a,{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:y?.text||`I believe in you, champion!`,characterName:e.companionSettings.name,emotion:e.activeEmotion,isLoading:e.isLoading,isStreaming:y?.isStreaming,toolCalls:y?.toolCalls,onTypingStatusChange:g})]}),(0,M.jsx)(I,{suggestions:y?.choiceSuggestions,isLoading:e.isLoading,onSendMessage:e=>S.sendMessage(e),placeholder:`Speak with ${e.companionSettings.name||`Princess Aurelia`}...`}),r&&(0,M.jsx)(L,{currentFloor:e.currentFloor,totalSolved:e.totalSolved,onClose:()=>i(!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:S.removeCodexItem,onClose:()=>s(!1)}),l&&(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)(c,{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)(b,{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-giqkVw87.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
algospaced-ui/dist/assets/ReviewQueue-D9FVo5rc.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
algospaced-ui/dist/assets/Settings-DpVXEE8k.js
ADDED
|
@@ -0,0 +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-CiHjdcBj.js";import{t as a}from"./external-link-Cop9hfwL.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-3ubmhkb5.js";import{t as f}from"./info-LgaoobGM.js";import{t as p}from"./save-DW0DTANa.js";import{A as m,C as h,D as ne,I as g,L as _,M as v,N as y,U as b,_ as x,d as S,f as C,k as w,m as T,p as E,u as D}from"./index-CXawvZhN.js";var O=b(`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`}]]),k=b(`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`}]]),A=t(e(),1),j=n(),M=[{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 N(){let[e,t]=(0,A.useState)(()=>localStorage.getItem(`algospaced_custom_ai_provider`)||`default`),[n,b]=(0,A.useState)(()=>localStorage.getItem(`algospaced_custom_api_key`)||localStorage.getItem(`sandbox_gemini_api_key`)||``),[N,re]=(0,A.useState)(!1),[P,F]=(0,A.useState)(null),[I,L]=(0,A.useState)(()=>D()),[R,z]=(0,A.useState)(null),[B,V]=(0,A.useState)(()=>S().currentFloor),[H,U]=(0,A.useState)(()=>c()),[W,G]=(0,A.useState)(()=>s()),[K,q]=(0,A.useState)(!1),[J,Y]=(0,A.useState)(null),X=!!(H.token&&(H.username||W?.login)),Z=!!(n.trim()&&e!=="default"),Q=e!=="default"&&!n.trim(),$=M.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`),b(``),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`),b(``),t(`default`),F({type:`info`,text:`Reset to Server Default provider.`}),setTimeout(()=>F(null),3e3)},ce=()=>{E(I),z({type:`success`,text:`Princess Companion settings saved!`}),setTimeout(()=>z(null),3e3)},le=()=>{L(T),E(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=C();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,j.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,j.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-b-[3px] border-ink-black pb-2.5`,children:[(0,j.jsxs)(`h3`,{className:`font-headline-md font-bold text-sm m-0 flex items-center gap-2 tracking-wide`,children:[(0,j.jsx)(k,{className:`w-4 h-4 text-ink-black`}),`API & AI Configuration`]}),(0,j.jsx)(`p`,{className:`text-[11px] text-trash-gray font-medium m-0`,children:`Configure your AI model provider..`})]}),(0,j.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,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Z?(0,j.jsx)(h,{className:`w-4 h-4 text-emerald-600 shrink-0`}):Q?(0,j.jsx)(i,{className:`w-4 h-4 text-rose-600 shrink-0`}):(0,j.jsx)(O,{className:`w-4 h-4 text-amber-600 shrink-0`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`text-xs font-bold font-headline-md text-ink-black flex items-center gap-1.5`,children:(0,j.jsxs)(`span`,{children:[`Active:`,` `,Z?`${e.toUpperCase()} (Custom Key)`:Q?`${e.toUpperCase()} (Key Required)`:`Default`]})}),(0,j.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,j.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,j.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,j.jsxs)(`div`,{children:[(0,j.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,j.jsx)(O,{className:`w-3.5 h-3.5 text-ink-black`}),`Select Provider`]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:M.map(t=>{let n=e===t.id;return(0,j.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,j.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,j.jsx)(`span`,{className:`text-xs font-bold font-headline-md`,children:t.name}),t.badge&&(0,j.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,j.jsx)(`span`,{className:`text-[9px] mt-1 text-slate-600 leading-tight block`,children:t.desc})]},t.id)})})]}),e==="default"?(0,j.jsxs)(`div`,{className:`p-3.5 bg-slate-50 border border-slate-200 rounded flex items-start gap-3`,children:[(0,j.jsx)(ne,{className:`w-4 h-4 text-amber-500 shrink-0 mt-0.5`}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs text-slate-700`,children:[(0,j.jsxs)(`span`,{className:`font-bold text-ink-black`,children:[`Shared Quotas (`,(0,j.jsx)(`i`,{children:`limited`}),`)`]}),(0,j.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,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.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,j.jsx)(k,{className:`w-3.5 h-3.5 text-ink-black`}),$?.name,` API Key`]}),$?.portalUrl&&(0,j.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,j.jsx)(`span`,{children:`Get API Key`}),(0,j.jsx)(a,{className:`w-3 h-3`})]})]}),(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`input`,{type:N?`text`:`password`,value:n,onChange:e=>b(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,j.jsx)(`button`,{type:`button`,onClick:()=>re(!N),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:N?`Hide API key`:`Show API key`,children:N?(0,j.jsx)(r,{className:`w-3.5 h-3.5`}):(0,j.jsx)(ee,{className:`w-3.5 h-3.5`})})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-trash-gray font-medium`,children:[(0,j.jsx)(m,{className:`w-3.5 h-3.5 text-emerald-600 shrink-0`}),(0,j.jsx)(`span`,{children:`Stored locally in your browser. Sent directly via request headers.`})]}),(0,j.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,j.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,j.jsx)(p,{className:`w-3.5 h-3.5`}),`Save Key`]}),n&&(0,j.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,j.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,j.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}):P.type===`error`?(0,j.jsx)(i,{className:`w-3.5 h-3.5 shrink-0`}):(0,j.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}),P.text]}),e!=="default"&&(0,j.jsx)(`div`,{className:`pt-2 border-t border-slate-200 flex justify-end`,children:(0,j.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,j.jsx)(v,{className:`w-3 h-3 text-slate-500`}),`Reset to Server Default`]})})]}),(0,j.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,j.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,j.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,j.jsx)(d,{className:`w-4 h-4 text-white`})}),(0,j.jsxs)(`div`,{children:[(0,j.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,j.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,j.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,j.jsxs)(`div`,{className:`space-y-3`,children:[(0,j.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,j.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[W?.avatar_url&&(0,j.jsx)(`img`,{src:W.avatar_url,alt:W.login,className:`w-7 h-7 rounded-full border border-ink-black`}),(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`span`,{className:`text-xs font-bold text-ink-black`,children:[`@`,W?.login||H.username]}),(0,j.jsxs)(`span`,{className:`text-[11px] text-slate-600 font-mono block`,children:[H.username,`/`,H.repoName,` (`,H.branch,`)`]})]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.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,j.jsx)(a,{className:`w-3 h-3`}),(0,j.jsx)(`span`,{children:`View Repo`})]}),(0,j.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,j.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,j.jsx)(`input`,{type:`checkbox`,checked:H.autoCommit,onChange:e=>pe(e.target.checked),className:`w-4 h-4 accent-emerald-600 cursor-pointer`}),(0,j.jsxs)(`div`,{className:`text-xs`,children:[(0,j.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Auto-commit on every submission`}),(0,j.jsxs)(`span`,{className:`text-[10px] text-trash-gray`,children:[`Automatically pushes your code to `,H.repoName,` whenever you grade a review card.`]})]})]})]}):(0,j.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,j.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,j.jsx)(`span`,{className:`text-xs font-bold text-ink-black block`,children:`Connect your GitHub Account (1-Click OAuth)`}),(0,j.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,j.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,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(y,{className:`w-3.5 h-3.5 animate-spin`}),(0,j.jsx)(`span`,{children:`CONNECTING...`})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d,{className:`w-3.5 h-3.5 text-yellow-300`}),(0,j.jsx)(`span`,{children:`CONNECT GITHUB`})]})})]}),J&&(0,j.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,j.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}):J.type===`error`?(0,j.jsx)(i,{className:`w-3.5 h-3.5 shrink-0`}):(0,j.jsx)(f,{className:`w-3.5 h-3.5 shrink-0`}),J.text]})]}),(0,j.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,j.jsxs)(`div`,{className:`flex items-center justify-between border-b-[2px] border-ink-black pb-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.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,j.jsx)(w,{className:`w-4 h-4 text-ink-black`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h4`,{className:`font-headline-md font-bold text-xs uppercase text-ink-black m-0`,children:`Princess AI Companion & RPG Settings`}),(0,j.jsx)(`p`,{className:`text-[10px] text-trash-gray font-medium m-0`,children:`Trapped Princess Persona, Study Break Timer & 8-bit RPG Audio`})]})]}),(0,j.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-bold text-ink-black font-headline-md uppercase`,children:I.enabled?`Enabled`:`Disabled`}),(0,j.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,j.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Companion Name`}),(0,j.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,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsxs)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md flex items-center gap-1`,children:[(0,j.jsx)(g,{className:`w-3.5 h-3.5 text-amber-700`}),`Study Break Reminder`]}),(0,j.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,j.jsx)(`option`,{value:25,children:`Every 25 Minutes (Classic Pomodoro)`}),(0,j.jsx)(`option`,{value:45,children:`Every 45 Minutes`}),(0,j.jsx)(`option`,{value:60,children:`Every 60 Minutes`}),(0,j.jsx)(`option`,{value:0,children:`Disabled (No automatic break popups)`})]})]})]}),(0,j.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,j.jsx)(`label`,{className:`block text-xs font-bold text-ink-black uppercase tracking-wider font-headline-md`,children:`Princess Backstory & Persona Prompt`}),(0,j.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,j.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1`,children:[(0,j.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,j.jsx)(`input`,{type:`checkbox`,checked:I.soundEnabled,onChange:e=>{let t=e.target.checked;L(e=>({...e,soundEnabled:t})),x(!t)},className:`w-4 h-4 accent-amber-500 cursor-pointer`}),(0,j.jsxs)(`div`,{className:`text-xs`,children:[(0,j.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`8-bit Sound Effects`}),(0,j.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Typewriter blips, chimes & fanfare`})]})]}),(0,j.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,j.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,j.jsxs)(`div`,{className:`text-xs`,children:[(0,j.jsx)(`span`,{className:`font-bold text-ink-black block`,children:`Spontaneous RPG Popups`}),(0,j.jsx)(`span`,{className:`text-[10px] text-trash-gray`,children:`Speech bubbles for breaks & milestones`})]})]})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-slate-200`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.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,j.jsx)(p,{className:`w-3.5 h-3.5`}),`Save Companion Settings`]}),(0,j.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,j.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,j.jsx)(v,{className:`w-3 h-3 text-rose-500`}),(0,j.jsxs)(`span`,{children:[`Reset Journey (`,B,`/150 LC)`]})]})]}),R&&(0,j.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,j.jsx)(_,{className:`w-3.5 h-3.5 shrink-0`}),R.text]})]}),(0,j.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,j.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,j.jsx)(f,{className:`w-3.5 h-3.5 text-[#0ea5e9]`}),(0,j.jsx)(`h4`,{className:`text-xs font-bold uppercase font-headline-md m-0`,children:`Get Free API Keys`})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-2 text-[10px]`,children:[(0,j.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,j.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,j.jsx)(`span`,{children:`Groq Cloud`}),(0,j.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,j.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Fast inference with generous free rate limits.`})]}),(0,j.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,j.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,j.jsx)(`span`,{children:`Google AI Studio`}),(0,j.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,j.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Free Gemini Flash API quota.`})]}),(0,j.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,j.jsxs)(`div`,{className:`flex items-center justify-between font-bold text-ink-black`,children:[(0,j.jsx)(`span`,{children:`OpenRouter`}),(0,j.jsx)(a,{className:`w-3 h-3 text-slate-400`})]}),(0,j.jsx)(`p`,{className:`m-0 text-trash-gray leading-normal`,children:`Unified API for open-weights models.`})]})]})]})]})}export{N as default};
|
algospaced-ui/dist/assets/confetti.module-CfS3ygcu.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{U as e}from"./index-CXawvZhN.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(`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`}]]),r=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`}]]),i=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`}]]),a={};(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||{}})(),a,!1);var o=a.exports;a.exports.create;export{t as a,n as i,i as n,r,o as t};
|
algospaced-ui/dist/assets/external-link-Cop9hfwL.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{U as e}from"./index-CXawvZhN.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-CiHjdcBj.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{U as e}from"./index-CXawvZhN.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-3ubmhkb5.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{i as e}from"./jsx-runtime-j9uSgrFF.js";import{U as t}from"./index-CXawvZhN.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-CXawvZhN.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
algospaced-ui/dist/assets/index-DzBXTnSt.css
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
algospaced-ui/dist/assets/info-LgaoobGM.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{U as e}from"./index-CXawvZhN.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-DW0DTANa.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
import{U as e}from"./index-CXawvZhN.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,9 +13,9 @@
|
|
| 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-
|
| 19 |
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
|
| 20 |
|
| 21 |
<body>
|
|
|
|
| 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-CXawvZhN.js"></script>
|
| 17 |
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-j9uSgrFF.js">
|
| 18 |
+
<link rel="stylesheet" crossorigin href="/assets/index-DzBXTnSt.css">
|
| 19 |
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
|
| 20 |
|
| 21 |
<body>
|
algospaced-ui/dist/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
if(!self.define){let s,e={};const
|
|
|
|
| 1 |
+
if(!self.define){let s,e={};const i=(i,l)=>(i=new URL(i+".js",l).href,e[i]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()}).then(()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s}));self.define=(l,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let u={};const t=s=>i(s,r),o={module:{uri:r},exports:u,require:t};e[r]=Promise.all(l.map(s=>o[s]||t(s))).then(s=>(n(...s),u))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"6d448396e4f6ccc50d86aae3997aad5a"},{url:"assets/TerminalEmulator-CI1oWIOR.js",revision:null},{url:"assets/Settings-DpVXEE8k.js",revision:null},{url:"assets/save-DW0DTANa.js",revision:null},{url:"assets/ReviewQueue-D9FVo5rc.js",revision:null},{url:"assets/PythonChallenge-giqkVw87.js",revision:null},{url:"assets/PrincessChamber-OupPwibb.js",revision:null},{url:"assets/MySQLPlayground-BdJWX3_8.js",revision:null},{url:"assets/jsx-runtime-j9uSgrFF.js",revision:null},{url:"assets/JourneyPath-C_8vR7RH.js",revision:null},{url:"assets/info-LgaoobGM.js",revision:null},{url:"assets/index-DzBXTnSt.css",revision:null},{url:"assets/index-CXawvZhN.js",revision:null},{url:"assets/GitHubSyncWindow-CpAcWvDz.js",revision:null},{url:"assets/githubSyncService-3ubmhkb5.js",revision:null},{url:"assets/FileExplorer-CRW7B6yJ.js",revision:null},{url:"assets/eye-CiHjdcBj.js",revision:null},{url:"assets/external-link-Cop9hfwL.js",revision:null},{url:"assets/CreateProblemForm-BKf7x66j.js",revision:null},{url:"assets/confetti.module-CfS3ygcu.js",revision:null},{url:"manifest.webmanifest",revision:"7c8ff056d2e188c868d851bcb349e28e"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))});
|
algospaced-ui/src/components/JourneyPath.tsx
CHANGED
|
@@ -407,14 +407,16 @@ export default function JourneyPath({ onSelectProblemForReview }: JourneyPathPro
|
|
| 407 |
}`}
|
| 408 |
>
|
| 409 |
<div className="p-1.5 rounded-xl bg-amber-500/20 text-amber-500 border border-amber-500/40">
|
| 410 |
-
<Compass className="w-4 h-4" />
|
| 411 |
</div>
|
| 412 |
<div>
|
| 413 |
<h1 className="font-cinzel-dec font-bold text-xs md:text-sm leading-tight tracking-wider text-amber-600 dark:text-amber-400">
|
| 414 |
-
{viewMode === 'map' ? 'Expedition Trail Map' : '
|
| 415 |
</h1>
|
| 416 |
<p className="font-garamond italic text-[11px] opacity-75">
|
| 417 |
-
{
|
|
|
|
|
|
|
| 418 |
</p>
|
| 419 |
</div>
|
| 420 |
</div>
|
|
@@ -447,7 +449,7 @@ export default function JourneyPath({ onSelectProblemForReview }: JourneyPathPro
|
|
| 447 |
<button
|
| 448 |
id="view-mode-list-btn"
|
| 449 |
onClick={() => setViewMode('list')}
|
| 450 |
-
title="Problem
|
| 451 |
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg font-cinzel text-xs font-bold transition-all cursor-pointer ${
|
| 452 |
viewMode === 'list'
|
| 453 |
? 'bg-amber-600 text-white shadow-sm'
|
|
|
|
| 407 |
}`}
|
| 408 |
>
|
| 409 |
<div className="p-1.5 rounded-xl bg-amber-500/20 text-amber-500 border border-amber-500/40">
|
| 410 |
+
{viewMode === 'map' ? <Compass className="w-4 h-4" /> : <ListIcon className="w-4 h-4" />}
|
| 411 |
</div>
|
| 412 |
<div>
|
| 413 |
<h1 className="font-cinzel-dec font-bold text-xs md:text-sm leading-tight tracking-wider text-amber-600 dark:text-amber-400">
|
| 414 |
+
{viewMode === 'map' ? 'Expedition Trail Map' : 'Problem Directory'}
|
| 415 |
</h1>
|
| 416 |
<p className="font-garamond italic text-[11px] opacity-75">
|
| 417 |
+
{viewMode === 'map'
|
| 418 |
+
? `${totalNodes} Milestones • Hand-Drawn Cartography`
|
| 419 |
+
: `${totalNodes} Problems • ${completions.size} Solved`}
|
| 420 |
</p>
|
| 421 |
</div>
|
| 422 |
</div>
|
|
|
|
| 449 |
<button
|
| 450 |
id="view-mode-list-btn"
|
| 451 |
onClick={() => setViewMode('list')}
|
| 452 |
+
title="Problem List View"
|
| 453 |
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg font-cinzel text-xs font-bold transition-all cursor-pointer ${
|
| 454 |
viewMode === 'list'
|
| 455 |
? 'bg-amber-600 text-white shadow-sm'
|
algospaced-ui/src/components/map/JourneyListView.tsx
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
| 4 |
Search,
|
| 5 |
CheckCircle2,
|
| 6 |
Circle,
|
| 7 |
-
Compass,
|
| 8 |
Star,
|
| 9 |
ExternalLink,
|
| 10 |
SlidersHorizontal,
|
|
@@ -13,12 +12,13 @@ import {
|
|
| 13 |
ChevronDown,
|
| 14 |
ChevronUp,
|
| 15 |
MapPin,
|
| 16 |
-
Flame,
|
| 17 |
Route,
|
| 18 |
RefreshCw,
|
|
|
|
|
|
|
| 19 |
} from 'lucide-react';
|
| 20 |
import { soundManager } from '../../utils/audio';
|
| 21 |
-
import { getCatalogProblemByNumber } from '../../services/catalogService';
|
| 22 |
import { supabase } from '../../firebaseClient';
|
| 23 |
import { activateCatalogProblem } from '../../services/reviewService';
|
| 24 |
|
|
@@ -40,7 +40,7 @@ interface JourneyListViewProps {
|
|
| 40 |
}
|
| 41 |
|
| 42 |
type StatusFilter = 'all' | 'solved' | 'unsolved';
|
| 43 |
-
type SortOption = '
|
| 44 |
|
| 45 |
export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
| 46 |
nodes,
|
|
@@ -60,20 +60,25 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 60 |
// Search & Filter State
|
| 61 |
const [searchQuery, setSearchQuery] = useState('');
|
| 62 |
const [statusFilter, setStatusFilter] = useState<StatusFilter>('all');
|
| 63 |
-
const [
|
| 64 |
-
const [
|
|
|
|
| 65 |
const [expandedNodeId, setExpandedNodeId] = useState<number | null>(null);
|
| 66 |
const [activatingProblemId, setActivatingProblemId] = useState<number | null>(null);
|
| 67 |
|
| 68 |
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
| 69 |
|
| 70 |
-
// Extract unique
|
| 71 |
-
const
|
| 72 |
-
const
|
| 73 |
nodes.forEach((n) => {
|
| 74 |
-
|
|
|
|
| 75 |
});
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
| 77 |
}, [nodes]);
|
| 78 |
|
| 79 |
// Overall Statistics
|
|
@@ -83,7 +88,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 83 |
}, [nodes, completions]);
|
| 84 |
const progressPercent = totalCount > 0 ? Math.round((solvedCount / totalCount) * 100) : 0;
|
| 85 |
|
| 86 |
-
// Filtered & Sorted Nodes
|
| 87 |
const filteredNodes = useMemo(() => {
|
| 88 |
const q = searchQuery.trim().toLowerCase();
|
| 89 |
const cleanNumQuery = q.replace(/^#/, '');
|
|
@@ -95,18 +100,23 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 95 |
if (statusFilter === 'solved' && !isSolved) return false;
|
| 96 |
if (statusFilter === 'unsolved' && isSolved) return false;
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
-
// Search Query filter (matches problem number,
|
| 102 |
if (q) {
|
| 103 |
const matchId = String(node.id).includes(cleanNumQuery);
|
| 104 |
const matchStep = String(node.sequenceIndex + 1) === cleanNumQuery;
|
| 105 |
const matchName = node.name.toLowerCase().includes(q);
|
| 106 |
-
const
|
| 107 |
-
const
|
| 108 |
|
| 109 |
-
if (!matchId && !matchStep && !matchName && !
|
| 110 |
return false;
|
| 111 |
}
|
| 112 |
}
|
|
@@ -121,12 +131,12 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 121 |
return b.id - a.id;
|
| 122 |
case 'name':
|
| 123 |
return a.name.localeCompare(b.name);
|
| 124 |
-
case '
|
| 125 |
default:
|
| 126 |
return a.sequenceIndex - b.sequenceIndex;
|
| 127 |
}
|
| 128 |
});
|
| 129 |
-
}, [nodes, completions, statusFilter,
|
| 130 |
|
| 131 |
// Launch or Activate Problem for SRS Review
|
| 132 |
const handleReviewNode = async (node: MapNode) => {
|
|
@@ -167,9 +177,9 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 167 |
}
|
| 168 |
};
|
| 169 |
|
| 170 |
-
// Jump to Current
|
| 171 |
const handleJumpToCurrent = () => {
|
| 172 |
-
const activeEl = document.getElementById(`
|
| 173 |
if (activeEl) {
|
| 174 |
activeEl.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
| 175 |
soundManager.playPencilScratch();
|
|
@@ -178,46 +188,22 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 178 |
|
| 179 |
// Scroll active node into view on initial mount if list is not filtered
|
| 180 |
useEffect(() => {
|
| 181 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
const timer = setTimeout(() => {
|
| 183 |
-
const activeEl = document.getElementById(`
|
| 184 |
if (activeEl) {
|
| 185 |
activeEl.scrollIntoView({ behavior: 'auto', block: 'center' });
|
| 186 |
}
|
| 187 |
}, 80);
|
| 188 |
return () => clearTimeout(timer);
|
| 189 |
}
|
| 190 |
-
}, [activeNodeIndex, searchQuery, statusFilter,
|
| 191 |
-
|
| 192 |
-
// Biome color styling badge helper
|
| 193 |
-
const getBiomeBadgeStyle = (biome: string) => {
|
| 194 |
-
switch (biome) {
|
| 195 |
-
case 'forest':
|
| 196 |
-
return isDark
|
| 197 |
-
? 'bg-emerald-950/80 text-emerald-300 border-emerald-500/40'
|
| 198 |
-
: 'bg-emerald-100 text-emerald-900 border-emerald-400';
|
| 199 |
-
case 'river':
|
| 200 |
-
return isDark
|
| 201 |
-
? 'bg-cyan-950/80 text-cyan-300 border-cyan-500/40'
|
| 202 |
-
: 'bg-cyan-100 text-cyan-900 border-cyan-400';
|
| 203 |
-
case 'mountain':
|
| 204 |
-
return isDark
|
| 205 |
-
? 'bg-stone-800 text-stone-300 border-stone-600'
|
| 206 |
-
: 'bg-stone-200 text-stone-800 border-stone-400';
|
| 207 |
-
case 'coast':
|
| 208 |
-
return isDark
|
| 209 |
-
? 'bg-sky-950/80 text-sky-300 border-sky-500/40'
|
| 210 |
-
: 'bg-sky-100 text-sky-900 border-sky-400';
|
| 211 |
-
case 'ancient_ruins':
|
| 212 |
-
return isDark
|
| 213 |
-
? 'bg-amber-950/80 text-amber-300 border-amber-500/40'
|
| 214 |
-
: 'bg-amber-100 text-amber-900 border-amber-400';
|
| 215 |
-
default:
|
| 216 |
-
return isDark
|
| 217 |
-
? 'bg-stone-900 text-stone-300 border-stone-700'
|
| 218 |
-
: 'bg-stone-100 text-stone-700 border-stone-300';
|
| 219 |
-
}
|
| 220 |
-
};
|
| 221 |
|
| 222 |
return (
|
| 223 |
<div
|
|
@@ -225,7 +211,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 225 |
isDark ? 'parchment-dark-bg text-[#f4ebd9]' : 'parchment-bg text-[#2c2014]'
|
| 226 |
}`}
|
| 227 |
>
|
| 228 |
-
{/* Decorative
|
| 229 |
<div
|
| 230 |
className={`absolute inset-0 pointer-events-none z-10 ${
|
| 231 |
isDark ? 'map-dark-vignette' : 'map-vignette'
|
|
@@ -241,7 +227,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 241 |
}`}
|
| 242 |
>
|
| 243 |
<div className="max-w-6xl mx-auto space-y-3">
|
| 244 |
-
{/* Row 1: Search Bar
|
| 245 |
<div className="flex flex-col sm:flex-row gap-2.5 items-stretch sm:items-center justify-between">
|
| 246 |
{/* Search Input */}
|
| 247 |
<div className="relative flex-1">
|
|
@@ -253,7 +239,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 253 |
type="text"
|
| 254 |
value={searchQuery}
|
| 255 |
onChange={(e) => setSearchQuery(e.target.value)}
|
| 256 |
-
placeholder="Search problem title
|
| 257 |
className={`w-full pl-9 pr-8 py-2 rounded-xl text-xs md:text-sm font-garamond font-semibold border-2 shadow-inner focus:outline-none transition-all ${
|
| 258 |
isDark
|
| 259 |
? 'bg-[#231e18] border-[#5a4836] text-[#f4ebd9] placeholder-stone-500 focus:border-amber-500/70'
|
|
@@ -271,7 +257,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 271 |
)}
|
| 272 |
</div>
|
| 273 |
|
| 274 |
-
{/* Right Controls: Track switcher & Current
|
| 275 |
<div className="flex items-center gap-2 flex-wrap">
|
| 276 |
{tracks && tracks.length > 0 && onTrackChange && (
|
| 277 |
<div
|
|
@@ -297,24 +283,24 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 297 |
</div>
|
| 298 |
)}
|
| 299 |
|
| 300 |
-
{/* Jump to Current
|
| 301 |
<button
|
| 302 |
onClick={handleJumpToCurrent}
|
| 303 |
-
title="Scroll to active
|
| 304 |
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-xl border text-xs font-cinzel font-bold transition-all shadow-sm active:scale-95 cursor-pointer ${
|
| 305 |
isDark
|
| 306 |
? 'bg-amber-500/20 border-amber-500/40 text-amber-300 hover:bg-amber-500/30'
|
| 307 |
: 'bg-amber-600/15 border-amber-600/30 text-amber-900 hover:bg-amber-600/25'
|
| 308 |
}`}
|
| 309 |
>
|
| 310 |
-
<
|
| 311 |
-
<span className="hidden sm:inline">Current
|
| 312 |
<span className="font-mono text-[11px]">#{activeNodeIndex + 1}</span>
|
| 313 |
</button>
|
| 314 |
</div>
|
| 315 |
</div>
|
| 316 |
|
| 317 |
-
{/* Row 2: Status Tabs,
|
| 318 |
<div className="flex flex-wrap items-center justify-between gap-2.5 pt-1 text-xs">
|
| 319 |
{/* Status Filter Tabs */}
|
| 320 |
<div className="flex items-center gap-1">
|
|
@@ -345,9 +331,9 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 345 |
})}
|
| 346 |
</div>
|
| 347 |
|
| 348 |
-
{/* Middle:
|
| 349 |
<div className="flex items-center gap-2 flex-wrap">
|
| 350 |
-
{/*
|
| 351 |
<div
|
| 352 |
className={`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${
|
| 353 |
isDark
|
|
@@ -356,23 +342,44 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 356 |
}`}
|
| 357 |
>
|
| 358 |
<SlidersHorizontal className="w-3 h-3 text-amber-500" />
|
| 359 |
-
<span className="text-[10px] font-cinzel uppercase opacity-75">
|
| 360 |
<select
|
| 361 |
-
value={
|
| 362 |
-
onChange={(e) =>
|
| 363 |
-
className="bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none max-w-[
|
| 364 |
>
|
| 365 |
<option value="all" className="bg-stone-900 text-stone-200">
|
| 366 |
-
All
|
| 367 |
</option>
|
| 368 |
-
{
|
| 369 |
-
<option key={
|
| 370 |
-
{
|
| 371 |
</option>
|
| 372 |
))}
|
| 373 |
</select>
|
| 374 |
</div>
|
| 375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
{/* Sort Option */}
|
| 377 |
<div
|
| 378 |
className={`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${
|
|
@@ -388,8 +395,8 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 388 |
onChange={(e) => setSortOption(e.target.value as SortOption)}
|
| 389 |
className="bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none"
|
| 390 |
>
|
| 391 |
-
<option value="
|
| 392 |
-
|
| 393 |
</option>
|
| 394 |
<option value="number_asc" className="bg-stone-900 text-stone-200">
|
| 395 |
Problem # (Asc)
|
|
@@ -438,20 +445,21 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 438 |
: 'border-amber-900/20 bg-[#f9f2e3]/80 text-stone-600'
|
| 439 |
}`}
|
| 440 |
>
|
| 441 |
-
<
|
| 442 |
<h3 className="font-cinzel font-bold text-base text-amber-700 dark:text-amber-400 mb-1">
|
| 443 |
-
No
|
| 444 |
</h3>
|
| 445 |
<p className="font-garamond italic text-sm max-w-md mx-auto mb-4">
|
| 446 |
-
No
|
| 447 |
your search keywords or filter criteria.
|
| 448 |
</p>
|
| 449 |
-
{(searchQuery || statusFilter !== 'all' ||
|
| 450 |
<button
|
| 451 |
onClick={() => {
|
| 452 |
setSearchQuery('');
|
| 453 |
setStatusFilter('all');
|
| 454 |
-
|
|
|
|
| 455 |
}}
|
| 456 |
className="px-4 py-1.5 rounded-xl bg-amber-600 hover:bg-amber-500 text-white font-cinzel text-xs font-bold transition-all shadow cursor-pointer"
|
| 457 |
>
|
|
@@ -471,7 +479,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 471 |
return (
|
| 472 |
<div
|
| 473 |
key={node.id}
|
| 474 |
-
id={`
|
| 475 |
className={`group relative rounded-xl border-2 transition-all duration-200 shadow-md ${
|
| 476 |
isActive
|
| 477 |
? isDark
|
|
@@ -482,16 +490,16 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 482 |
: 'bg-[#fcf8ef]/95 border-[#c8b28f] hover:border-amber-700/60 hover:bg-[#fcf5e6]'
|
| 483 |
}`}
|
| 484 |
>
|
| 485 |
-
{/*
|
| 486 |
{isActive && (
|
| 487 |
<div className="absolute -top-2.5 left-4 px-2 py-0.5 rounded-md bg-amber-600 text-white font-cinzel text-[9px] font-bold tracking-wider uppercase flex items-center gap-1 shadow">
|
| 488 |
-
<
|
| 489 |
-
Current
|
| 490 |
</div>
|
| 491 |
)}
|
| 492 |
|
| 493 |
<div className="p-3 sm:p-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
| 494 |
-
{/* Left: Completion Checkbox +
|
| 495 |
<div className="flex items-start sm:items-center gap-3 min-w-0 flex-1">
|
| 496 |
{/* Checkbox Button */}
|
| 497 |
<button
|
|
@@ -508,7 +516,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 508 |
)}
|
| 509 |
</button>
|
| 510 |
|
| 511 |
-
{/*
|
| 512 |
<div
|
| 513 |
className={`px-2 py-1 rounded-lg border font-cinzel text-[11px] font-bold text-center shrink-0 min-w-[54px] ${
|
| 514 |
isActive
|
|
@@ -519,7 +527,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 519 |
}`}
|
| 520 |
>
|
| 521 |
<span className="text-[9px] block uppercase opacity-75 leading-none">
|
| 522 |
-
|
| 523 |
</span>
|
| 524 |
<span>#{node.sequenceIndex + 1}</span>
|
| 525 |
</div>
|
|
@@ -591,19 +599,27 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 591 |
)}
|
| 592 |
</div>
|
| 593 |
|
| 594 |
-
{/*
|
| 595 |
-
|
| 596 |
-
<
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 607 |
</div>
|
| 608 |
</div>
|
| 609 |
|
|
@@ -616,7 +632,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 616 |
soundManager.playNodeLightUp(node.sequenceIndex, totalCount);
|
| 617 |
onSwitchToMap(node.sequenceIndex);
|
| 618 |
}}
|
| 619 |
-
title="
|
| 620 |
className={`flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-xs font-cinzel font-bold transition-all shadow-sm active:scale-95 cursor-pointer ${
|
| 621 |
isDark
|
| 622 |
? 'bg-amber-500/15 border-amber-500/40 text-amber-300 hover:bg-amber-500/25'
|
|
@@ -624,7 +640,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 624 |
}`}
|
| 625 |
>
|
| 626 |
<MapPin className="w-3.5 h-3.5 text-amber-500" />
|
| 627 |
-
<span className="hidden md:inline">
|
| 628 |
</button>
|
| 629 |
|
| 630 |
{/* Spaced-Repetition Review Button */}
|
|
@@ -647,13 +663,14 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 647 |
{/* External LeetCode Link */}
|
| 648 |
<a
|
| 649 |
href={
|
| 650 |
-
|
|
|
|
| 651 |
? `https://leetcode.com/problemset/?search=${node.id}`
|
| 652 |
-
: `https://www.google.com/search?q=${encodeURIComponent(node.name)}`
|
| 653 |
}
|
| 654 |
target="_blank"
|
| 655 |
rel="noreferrer"
|
| 656 |
-
title="Open on LeetCode
|
| 657 |
className={`p-1.5 rounded-lg border transition-all cursor-pointer ${
|
| 658 |
isDark
|
| 659 |
? 'border-stone-700 text-stone-400 hover:text-stone-200 hover:bg-white/5'
|
|
@@ -671,7 +688,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 671 |
setActiveNodeIndex(node.sequenceIndex);
|
| 672 |
}
|
| 673 |
}}
|
| 674 |
-
title={isExpanded ? 'Hide
|
| 675 |
className={`p-1.5 rounded-lg border transition-all cursor-pointer ${
|
| 676 |
isExpanded
|
| 677 |
? 'bg-amber-600/20 border-amber-500 text-amber-500'
|
|
@@ -689,7 +706,7 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 689 |
</div>
|
| 690 |
</div>
|
| 691 |
|
| 692 |
-
{/* Expanded Accordion:
|
| 693 |
{isExpanded && (
|
| 694 |
<div
|
| 695 |
className={`px-4 py-3 border-t text-xs font-garamond animate-fade-in ${
|
|
@@ -698,31 +715,68 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 698 |
: 'border-amber-900/15 bg-amber-950/5 text-stone-700'
|
| 699 |
}`}
|
| 700 |
>
|
| 701 |
-
<div className="space-y-
|
| 702 |
-
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
</span>
|
| 706 |
-
<span className="italic">{node.lore}</span>
|
| 707 |
-
</div>
|
| 708 |
-
|
| 709 |
-
{/* Canonical Description if present */}
|
| 710 |
-
{catalogProb?.description && (
|
| 711 |
-
<div className="p-2.5 rounded border border-amber-900/20 bg-amber-900/5 dark:bg-black/30 font-mono text-[11px] leading-relaxed whitespace-pre-line text-stone-600 dark:text-stone-300">
|
| 712 |
<div className="font-cinzel font-bold text-amber-600 dark:text-amber-400 text-[10px] uppercase mb-1 tracking-wider">
|
| 713 |
Canonical Problem Description
|
| 714 |
</div>
|
| 715 |
{catalogProb.description}
|
| 716 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 717 |
)}
|
| 718 |
|
| 719 |
-
|
| 720 |
-
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 726 |
{catalogProb?.time_complexity && (
|
| 727 |
<span>
|
| 728 |
Time: <strong className="font-mono text-amber-600 dark:text-amber-400">{catalogProb.time_complexity}</strong>
|
|
@@ -733,9 +787,11 @@ export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
|
| 733 |
Space: <strong className="font-mono text-purple-600 dark:text-purple-400">{catalogProb.space_complexity}</strong>
|
| 734 |
</span>
|
| 735 |
)}
|
| 736 |
-
|
| 737 |
-
|
| 738 |
-
|
|
|
|
|
|
|
| 739 |
</div>
|
| 740 |
</div>
|
| 741 |
</div>
|
|
|
|
| 4 |
Search,
|
| 5 |
CheckCircle2,
|
| 6 |
Circle,
|
|
|
|
| 7 |
Star,
|
| 8 |
ExternalLink,
|
| 9 |
SlidersHorizontal,
|
|
|
|
| 12 |
ChevronDown,
|
| 13 |
ChevronUp,
|
| 14 |
MapPin,
|
|
|
|
| 15 |
Route,
|
| 16 |
RefreshCw,
|
| 17 |
+
Target,
|
| 18 |
+
FileText,
|
| 19 |
} from 'lucide-react';
|
| 20 |
import { soundManager } from '../../utils/audio';
|
| 21 |
+
import { getCatalogProblemByNumber, getAllPatterns } from '../../services/catalogService';
|
| 22 |
import { supabase } from '../../firebaseClient';
|
| 23 |
import { activateCatalogProblem } from '../../services/reviewService';
|
| 24 |
|
|
|
|
| 40 |
}
|
| 41 |
|
| 42 |
type StatusFilter = 'all' | 'solved' | 'unsolved';
|
| 43 |
+
type SortOption = 'sequence' | 'number_asc' | 'number_desc' | 'name';
|
| 44 |
|
| 45 |
export const JourneyListView: React.FC<JourneyListViewProps> = ({
|
| 46 |
nodes,
|
|
|
|
| 60 |
// Search & Filter State
|
| 61 |
const [searchQuery, setSearchQuery] = useState('');
|
| 62 |
const [statusFilter, setStatusFilter] = useState<StatusFilter>('all');
|
| 63 |
+
const [selectedPattern, setSelectedPattern] = useState<string>('all');
|
| 64 |
+
const [selectedDifficulty, setSelectedDifficulty] = useState<string>('all');
|
| 65 |
+
const [sortOption, setSortOption] = useState<SortOption>('sequence');
|
| 66 |
const [expandedNodeId, setExpandedNodeId] = useState<number | null>(null);
|
| 67 |
const [activatingProblemId, setActivatingProblemId] = useState<number | null>(null);
|
| 68 |
|
| 69 |
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
| 70 |
|
| 71 |
+
// Extract unique DSA patterns for filter dropdown
|
| 72 |
+
const uniquePatterns = useMemo(() => {
|
| 73 |
+
const patternSet = new Set<string>();
|
| 74 |
nodes.forEach((n) => {
|
| 75 |
+
const p = getCatalogProblemByNumber(n.id);
|
| 76 |
+
if (p?.pattern) patternSet.add(p.pattern);
|
| 77 |
});
|
| 78 |
+
if (patternSet.size === 0) {
|
| 79 |
+
getAllPatterns().forEach((pat) => patternSet.add(pat));
|
| 80 |
+
}
|
| 81 |
+
return Array.from(patternSet);
|
| 82 |
}, [nodes]);
|
| 83 |
|
| 84 |
// Overall Statistics
|
|
|
|
| 88 |
}, [nodes, completions]);
|
| 89 |
const progressPercent = totalCount > 0 ? Math.round((solvedCount / totalCount) * 100) : 0;
|
| 90 |
|
| 91 |
+
// Filtered & Sorted Nodes (Clean, problem-focused logic)
|
| 92 |
const filteredNodes = useMemo(() => {
|
| 93 |
const q = searchQuery.trim().toLowerCase();
|
| 94 |
const cleanNumQuery = q.replace(/^#/, '');
|
|
|
|
| 100 |
if (statusFilter === 'solved' && !isSolved) return false;
|
| 101 |
if (statusFilter === 'unsolved' && isSolved) return false;
|
| 102 |
|
| 103 |
+
const catalogProb = getCatalogProblemByNumber(node.id);
|
| 104 |
+
|
| 105 |
+
// Pattern filter
|
| 106 |
+
if (selectedPattern !== 'all' && catalogProb?.pattern !== selectedPattern) return false;
|
| 107 |
+
|
| 108 |
+
// Difficulty filter
|
| 109 |
+
if (selectedDifficulty !== 'all' && catalogProb?.difficulty !== selectedDifficulty) return false;
|
| 110 |
|
| 111 |
+
// Search Query filter (matches problem number, sequence step, title, pattern, or difficulty)
|
| 112 |
if (q) {
|
| 113 |
const matchId = String(node.id).includes(cleanNumQuery);
|
| 114 |
const matchStep = String(node.sequenceIndex + 1) === cleanNumQuery;
|
| 115 |
const matchName = node.name.toLowerCase().includes(q);
|
| 116 |
+
const matchPattern = catalogProb?.pattern?.toLowerCase().includes(q) ?? false;
|
| 117 |
+
const matchDifficulty = catalogProb?.difficulty?.toLowerCase().includes(q) ?? false;
|
| 118 |
|
| 119 |
+
if (!matchId && !matchStep && !matchName && !matchPattern && !matchDifficulty) {
|
| 120 |
return false;
|
| 121 |
}
|
| 122 |
}
|
|
|
|
| 131 |
return b.id - a.id;
|
| 132 |
case 'name':
|
| 133 |
return a.name.localeCompare(b.name);
|
| 134 |
+
case 'sequence':
|
| 135 |
default:
|
| 136 |
return a.sequenceIndex - b.sequenceIndex;
|
| 137 |
}
|
| 138 |
});
|
| 139 |
+
}, [nodes, completions, statusFilter, selectedPattern, selectedDifficulty, searchQuery, sortOption]);
|
| 140 |
|
| 141 |
// Launch or Activate Problem for SRS Review
|
| 142 |
const handleReviewNode = async (node: MapNode) => {
|
|
|
|
| 177 |
}
|
| 178 |
};
|
| 179 |
|
| 180 |
+
// Jump to Current Active Problem
|
| 181 |
const handleJumpToCurrent = () => {
|
| 182 |
+
const activeEl = document.getElementById(`problem-item-${activeNodeIndex}`);
|
| 183 |
if (activeEl) {
|
| 184 |
activeEl.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
| 185 |
soundManager.playPencilScratch();
|
|
|
|
| 188 |
|
| 189 |
// Scroll active node into view on initial mount if list is not filtered
|
| 190 |
useEffect(() => {
|
| 191 |
+
if (
|
| 192 |
+
activeNodeIndex >= 0 &&
|
| 193 |
+
!searchQuery &&
|
| 194 |
+
statusFilter === 'all' &&
|
| 195 |
+
selectedPattern === 'all' &&
|
| 196 |
+
selectedDifficulty === 'all'
|
| 197 |
+
) {
|
| 198 |
const timer = setTimeout(() => {
|
| 199 |
+
const activeEl = document.getElementById(`problem-item-${activeNodeIndex}`);
|
| 200 |
if (activeEl) {
|
| 201 |
activeEl.scrollIntoView({ behavior: 'auto', block: 'center' });
|
| 202 |
}
|
| 203 |
}, 80);
|
| 204 |
return () => clearTimeout(timer);
|
| 205 |
}
|
| 206 |
+
}, [activeNodeIndex, searchQuery, statusFilter, selectedPattern, selectedDifficulty]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
return (
|
| 209 |
<div
|
|
|
|
| 211 |
isDark ? 'parchment-dark-bg text-[#f4ebd9]' : 'parchment-bg text-[#2c2014]'
|
| 212 |
}`}
|
| 213 |
>
|
| 214 |
+
{/* Decorative Border Vignette */}
|
| 215 |
<div
|
| 216 |
className={`absolute inset-0 pointer-events-none z-10 ${
|
| 217 |
isDark ? 'map-dark-vignette' : 'map-vignette'
|
|
|
|
| 227 |
}`}
|
| 228 |
>
|
| 229 |
<div className="max-w-6xl mx-auto space-y-3">
|
| 230 |
+
{/* Row 1: Search Bar, Track Selector & Jump to Current Problem */}
|
| 231 |
<div className="flex flex-col sm:flex-row gap-2.5 items-stretch sm:items-center justify-between">
|
| 232 |
{/* Search Input */}
|
| 233 |
<div className="relative flex-1">
|
|
|
|
| 239 |
type="text"
|
| 240 |
value={searchQuery}
|
| 241 |
onChange={(e) => setSearchQuery(e.target.value)}
|
| 242 |
+
placeholder="Search problem title, #number, or pattern (e.g. 1, Two Sum, Two Pointers)..."
|
| 243 |
className={`w-full pl-9 pr-8 py-2 rounded-xl text-xs md:text-sm font-garamond font-semibold border-2 shadow-inner focus:outline-none transition-all ${
|
| 244 |
isDark
|
| 245 |
? 'bg-[#231e18] border-[#5a4836] text-[#f4ebd9] placeholder-stone-500 focus:border-amber-500/70'
|
|
|
|
| 257 |
)}
|
| 258 |
</div>
|
| 259 |
|
| 260 |
+
{/* Right Controls: Track switcher & Current Problem jump */}
|
| 261 |
<div className="flex items-center gap-2 flex-wrap">
|
| 262 |
{tracks && tracks.length > 0 && onTrackChange && (
|
| 263 |
<div
|
|
|
|
| 283 |
</div>
|
| 284 |
)}
|
| 285 |
|
| 286 |
+
{/* Jump to Current Problem Button */}
|
| 287 |
<button
|
| 288 |
onClick={handleJumpToCurrent}
|
| 289 |
+
title="Scroll to active problem in list"
|
| 290 |
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-xl border text-xs font-cinzel font-bold transition-all shadow-sm active:scale-95 cursor-pointer ${
|
| 291 |
isDark
|
| 292 |
? 'bg-amber-500/20 border-amber-500/40 text-amber-300 hover:bg-amber-500/30'
|
| 293 |
: 'bg-amber-600/15 border-amber-600/30 text-amber-900 hover:bg-amber-600/25'
|
| 294 |
}`}
|
| 295 |
>
|
| 296 |
+
<Target className="w-3.5 h-3.5 text-amber-500" />
|
| 297 |
+
<span className="hidden sm:inline">Current Problem</span>
|
| 298 |
<span className="font-mono text-[11px]">#{activeNodeIndex + 1}</span>
|
| 299 |
</button>
|
| 300 |
</div>
|
| 301 |
</div>
|
| 302 |
|
| 303 |
+
{/* Row 2: Status Tabs, Pattern Filter, Difficulty Filter, Sort & Progress Count */}
|
| 304 |
<div className="flex flex-wrap items-center justify-between gap-2.5 pt-1 text-xs">
|
| 305 |
{/* Status Filter Tabs */}
|
| 306 |
<div className="flex items-center gap-1">
|
|
|
|
| 331 |
})}
|
| 332 |
</div>
|
| 333 |
|
| 334 |
+
{/* Middle: Pattern, Difficulty & Sort Dropdowns */}
|
| 335 |
<div className="flex items-center gap-2 flex-wrap">
|
| 336 |
+
{/* Pattern Filter */}
|
| 337 |
<div
|
| 338 |
className={`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${
|
| 339 |
isDark
|
|
|
|
| 342 |
}`}
|
| 343 |
>
|
| 344 |
<SlidersHorizontal className="w-3 h-3 text-amber-500" />
|
| 345 |
+
<span className="text-[10px] font-cinzel uppercase opacity-75">Pattern:</span>
|
| 346 |
<select
|
| 347 |
+
value={selectedPattern}
|
| 348 |
+
onChange={(e) => setSelectedPattern(e.target.value)}
|
| 349 |
+
className="bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none max-w-[150px] truncate"
|
| 350 |
>
|
| 351 |
<option value="all" className="bg-stone-900 text-stone-200">
|
| 352 |
+
All Patterns ({uniquePatterns.length})
|
| 353 |
</option>
|
| 354 |
+
{uniquePatterns.map((pat) => (
|
| 355 |
+
<option key={pat} value={pat} className="bg-stone-900 text-stone-200">
|
| 356 |
+
{pat}
|
| 357 |
</option>
|
| 358 |
))}
|
| 359 |
</select>
|
| 360 |
</div>
|
| 361 |
|
| 362 |
+
{/* Difficulty Filter */}
|
| 363 |
+
<div
|
| 364 |
+
className={`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${
|
| 365 |
+
isDark
|
| 366 |
+
? 'bg-[#231e18] border-[#4a392b] text-stone-300'
|
| 367 |
+
: 'bg-[#fcf7ee] border-[#cfbc9c] text-stone-800'
|
| 368 |
+
}`}
|
| 369 |
+
>
|
| 370 |
+
<span className="text-[10px] font-cinzel uppercase opacity-75">Diff:</span>
|
| 371 |
+
<select
|
| 372 |
+
value={selectedDifficulty}
|
| 373 |
+
onChange={(e) => setSelectedDifficulty(e.target.value)}
|
| 374 |
+
className="bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none"
|
| 375 |
+
>
|
| 376 |
+
<option value="all" className="bg-stone-900 text-stone-200">All</option>
|
| 377 |
+
<option value="Easy" className="bg-stone-900 text-stone-200">Easy</option>
|
| 378 |
+
<option value="Medium" className="bg-stone-900 text-stone-200">Medium</option>
|
| 379 |
+
<option value="Hard" className="bg-stone-900 text-stone-200">Hard</option>
|
| 380 |
+
</select>
|
| 381 |
+
</div>
|
| 382 |
+
|
| 383 |
{/* Sort Option */}
|
| 384 |
<div
|
| 385 |
className={`flex items-center gap-1 px-2 py-1 rounded-lg border text-xs font-garamond font-semibold ${
|
|
|
|
| 395 |
onChange={(e) => setSortOption(e.target.value as SortOption)}
|
| 396 |
className="bg-transparent border-none text-xs font-garamond font-bold cursor-pointer focus:outline-none"
|
| 397 |
>
|
| 398 |
+
<option value="sequence" className="bg-stone-900 text-stone-200">
|
| 399 |
+
Track Sequence
|
| 400 |
</option>
|
| 401 |
<option value="number_asc" className="bg-stone-900 text-stone-200">
|
| 402 |
Problem # (Asc)
|
|
|
|
| 445 |
: 'border-amber-900/20 bg-[#f9f2e3]/80 text-stone-600'
|
| 446 |
}`}
|
| 447 |
>
|
| 448 |
+
<FileText className="w-10 h-10 mx-auto mb-3 text-amber-500 opacity-60" />
|
| 449 |
<h3 className="font-cinzel font-bold text-base text-amber-700 dark:text-amber-400 mb-1">
|
| 450 |
+
No Problems Found
|
| 451 |
</h3>
|
| 452 |
<p className="font-garamond italic text-sm max-w-md mx-auto mb-4">
|
| 453 |
+
No problems matched "{searchQuery || 'the current filter settings'}". Try adjusting
|
| 454 |
your search keywords or filter criteria.
|
| 455 |
</p>
|
| 456 |
+
{(searchQuery || statusFilter !== 'all' || selectedPattern !== 'all' || selectedDifficulty !== 'all') && (
|
| 457 |
<button
|
| 458 |
onClick={() => {
|
| 459 |
setSearchQuery('');
|
| 460 |
setStatusFilter('all');
|
| 461 |
+
setSelectedPattern('all');
|
| 462 |
+
setSelectedDifficulty('all');
|
| 463 |
}}
|
| 464 |
className="px-4 py-1.5 rounded-xl bg-amber-600 hover:bg-amber-500 text-white font-cinzel text-xs font-bold transition-all shadow cursor-pointer"
|
| 465 |
>
|
|
|
|
| 479 |
return (
|
| 480 |
<div
|
| 481 |
key={node.id}
|
| 482 |
+
id={`problem-item-${node.sequenceIndex}`}
|
| 483 |
className={`group relative rounded-xl border-2 transition-all duration-200 shadow-md ${
|
| 484 |
isActive
|
| 485 |
? isDark
|
|
|
|
| 490 |
: 'bg-[#fcf8ef]/95 border-[#c8b28f] hover:border-amber-700/60 hover:bg-[#fcf5e6]'
|
| 491 |
}`}
|
| 492 |
>
|
| 493 |
+
{/* Active Problem Ribbon */}
|
| 494 |
{isActive && (
|
| 495 |
<div className="absolute -top-2.5 left-4 px-2 py-0.5 rounded-md bg-amber-600 text-white font-cinzel text-[9px] font-bold tracking-wider uppercase flex items-center gap-1 shadow">
|
| 496 |
+
<Target className="w-2.5 h-2.5 text-amber-200" />
|
| 497 |
+
Current Problem
|
| 498 |
</div>
|
| 499 |
)}
|
| 500 |
|
| 501 |
<div className="p-3 sm:p-3.5 flex flex-col sm:flex-row sm:items-center justify-between gap-3">
|
| 502 |
+
{/* Left: Completion Checkbox + Sequence Number + Problem Info */}
|
| 503 |
<div className="flex items-start sm:items-center gap-3 min-w-0 flex-1">
|
| 504 |
{/* Checkbox Button */}
|
| 505 |
<button
|
|
|
|
| 516 |
)}
|
| 517 |
</button>
|
| 518 |
|
| 519 |
+
{/* Sequence Number Pill */}
|
| 520 |
<div
|
| 521 |
className={`px-2 py-1 rounded-lg border font-cinzel text-[11px] font-bold text-center shrink-0 min-w-[54px] ${
|
| 522 |
isActive
|
|
|
|
| 527 |
}`}
|
| 528 |
>
|
| 529 |
<span className="text-[9px] block uppercase opacity-75 leading-none">
|
| 530 |
+
Seq
|
| 531 |
</span>
|
| 532 |
<span>#{node.sequenceIndex + 1}</span>
|
| 533 |
</div>
|
|
|
|
| 599 |
)}
|
| 600 |
</div>
|
| 601 |
|
| 602 |
+
{/* Problem Complexities (Clean, replacing map region and elevation) */}
|
| 603 |
+
{(catalogProb?.time_complexity || catalogProb?.space_complexity) && (
|
| 604 |
+
<div className="flex items-center gap-3 flex-wrap mt-1 text-[11px] font-mono">
|
| 605 |
+
{catalogProb.time_complexity && (
|
| 606 |
+
<span className="opacity-80">
|
| 607 |
+
Time:{' '}
|
| 608 |
+
<span className="text-amber-600 dark:text-amber-400 font-semibold">
|
| 609 |
+
{catalogProb.time_complexity}
|
| 610 |
+
</span>
|
| 611 |
+
</span>
|
| 612 |
+
)}
|
| 613 |
+
{catalogProb.space_complexity && (
|
| 614 |
+
<span className="opacity-80">
|
| 615 |
+
Space:{' '}
|
| 616 |
+
<span className="text-purple-600 dark:text-purple-400 font-semibold">
|
| 617 |
+
{catalogProb.space_complexity}
|
| 618 |
+
</span>
|
| 619 |
+
</span>
|
| 620 |
+
)}
|
| 621 |
+
</div>
|
| 622 |
+
)}
|
| 623 |
</div>
|
| 624 |
</div>
|
| 625 |
|
|
|
|
| 632 |
soundManager.playNodeLightUp(node.sequenceIndex, totalCount);
|
| 633 |
onSwitchToMap(node.sequenceIndex);
|
| 634 |
}}
|
| 635 |
+
title="View Problem on Hand-Drawn Map"
|
| 636 |
className={`flex items-center gap-1 px-2.5 py-1.5 rounded-lg border text-xs font-cinzel font-bold transition-all shadow-sm active:scale-95 cursor-pointer ${
|
| 637 |
isDark
|
| 638 |
? 'bg-amber-500/15 border-amber-500/40 text-amber-300 hover:bg-amber-500/25'
|
|
|
|
| 640 |
}`}
|
| 641 |
>
|
| 642 |
<MapPin className="w-3.5 h-3.5 text-amber-500" />
|
| 643 |
+
<span className="hidden md:inline">Map</span>
|
| 644 |
</button>
|
| 645 |
|
| 646 |
{/* Spaced-Repetition Review Button */}
|
|
|
|
| 663 |
{/* External LeetCode Link */}
|
| 664 |
<a
|
| 665 |
href={
|
| 666 |
+
catalogProb?.leetcode_url ||
|
| 667 |
+
(node.id > 0
|
| 668 |
? `https://leetcode.com/problemset/?search=${node.id}`
|
| 669 |
+
: `https://www.google.com/search?q=${encodeURIComponent(node.name)}`)
|
| 670 |
}
|
| 671 |
target="_blank"
|
| 672 |
rel="noreferrer"
|
| 673 |
+
title="Open Problem on LeetCode"
|
| 674 |
className={`p-1.5 rounded-lg border transition-all cursor-pointer ${
|
| 675 |
isDark
|
| 676 |
? 'border-stone-700 text-stone-400 hover:text-stone-200 hover:bg-white/5'
|
|
|
|
| 688 |
setActiveNodeIndex(node.sequenceIndex);
|
| 689 |
}
|
| 690 |
}}
|
| 691 |
+
title={isExpanded ? 'Hide Problem Details' : 'View Problem Details'}
|
| 692 |
className={`p-1.5 rounded-lg border transition-all cursor-pointer ${
|
| 693 |
isExpanded
|
| 694 |
? 'bg-amber-600/20 border-amber-500 text-amber-500'
|
|
|
|
| 706 |
</div>
|
| 707 |
</div>
|
| 708 |
|
| 709 |
+
{/* Expanded Accordion: Problem Description, Examples, Constraints & Complexity */}
|
| 710 |
{isExpanded && (
|
| 711 |
<div
|
| 712 |
className={`px-4 py-3 border-t text-xs font-garamond animate-fade-in ${
|
|
|
|
| 715 |
: 'border-amber-900/15 bg-amber-950/5 text-stone-700'
|
| 716 |
}`}
|
| 717 |
>
|
| 718 |
+
<div className="space-y-3">
|
| 719 |
+
{/* Canonical Problem Description */}
|
| 720 |
+
{catalogProb?.description ? (
|
| 721 |
+
<div className="p-3 rounded border border-amber-900/20 bg-amber-900/5 dark:bg-black/30 font-sans text-xs sm:text-[13px] leading-relaxed whitespace-pre-line text-stone-700 dark:text-stone-300">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 722 |
<div className="font-cinzel font-bold text-amber-600 dark:text-amber-400 text-[10px] uppercase mb-1 tracking-wider">
|
| 723 |
Canonical Problem Description
|
| 724 |
</div>
|
| 725 |
{catalogProb.description}
|
| 726 |
</div>
|
| 727 |
+
) : (
|
| 728 |
+
<p className="italic text-stone-500">
|
| 729 |
+
Review this problem in CodeStudio to access the full starter code, test suites, and review queue.
|
| 730 |
+
</p>
|
| 731 |
)}
|
| 732 |
|
| 733 |
+
{/* Examples */}
|
| 734 |
+
{catalogProb?.examples && catalogProb.examples.length > 0 && (
|
| 735 |
+
<div className="space-y-1.5">
|
| 736 |
+
<div className="font-cinzel font-bold text-amber-600 dark:text-amber-400 text-[10px] uppercase tracking-wider">
|
| 737 |
+
Examples
|
| 738 |
+
</div>
|
| 739 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
| 740 |
+
{catalogProb.examples.map((ex, exIdx) => (
|
| 741 |
+
<div
|
| 742 |
+
key={exIdx}
|
| 743 |
+
className="p-2.5 rounded border border-stone-300/40 dark:border-stone-700/50 bg-black/5 dark:bg-black/30 font-mono text-[11px] space-y-1"
|
| 744 |
+
>
|
| 745 |
+
<div>
|
| 746 |
+
<span className="text-stone-500">Input: </span>
|
| 747 |
+
<span className="font-semibold text-amber-700 dark:text-amber-300">
|
| 748 |
+
{ex.input}
|
| 749 |
+
</span>
|
| 750 |
+
</div>
|
| 751 |
+
<div>
|
| 752 |
+
<span className="text-stone-500">Output: </span>
|
| 753 |
+
<span className="font-semibold text-emerald-600 dark:text-emerald-400">
|
| 754 |
+
{ex.output}
|
| 755 |
+
</span>
|
| 756 |
+
</div>
|
| 757 |
+
{ex.explanation && (
|
| 758 |
+
<div className="text-[10px] text-stone-500 italic font-sans pt-0.5">
|
| 759 |
+
{ex.explanation}
|
| 760 |
+
</div>
|
| 761 |
+
)}
|
| 762 |
+
</div>
|
| 763 |
+
))}
|
| 764 |
+
</div>
|
| 765 |
+
</div>
|
| 766 |
+
)}
|
| 767 |
+
|
| 768 |
+
{/* Problem Specifications Summary Bar */}
|
| 769 |
+
<div className="flex items-center gap-4 text-[11px] pt-1 opacity-85 flex-wrap border-t border-stone-400/20 dark:border-stone-700/30">
|
| 770 |
+
{pattern && (
|
| 771 |
+
<span>
|
| 772 |
+
Pattern: <strong className="font-cinzel text-amber-600 dark:text-amber-400">{pattern}</strong>
|
| 773 |
+
</span>
|
| 774 |
+
)}
|
| 775 |
+
{difficulty && (
|
| 776 |
+
<span>
|
| 777 |
+
Difficulty: <strong>{difficulty}</strong>
|
| 778 |
+
</span>
|
| 779 |
+
)}
|
| 780 |
{catalogProb?.time_complexity && (
|
| 781 |
<span>
|
| 782 |
Time: <strong className="font-mono text-amber-600 dark:text-amber-400">{catalogProb.time_complexity}</strong>
|
|
|
|
| 787 |
Space: <strong className="font-mono text-purple-600 dark:text-purple-400">{catalogProb.space_complexity}</strong>
|
| 788 |
</span>
|
| 789 |
)}
|
| 790 |
+
{catalogProb?.constraints && catalogProb.constraints.length > 0 && (
|
| 791 |
+
<span>
|
| 792 |
+
Constraints: <strong className="font-mono text-[10px]">{catalogProb.constraints.join(' • ')}</strong>
|
| 793 |
+
</span>
|
| 794 |
+
)}
|
| 795 |
</div>
|
| 796 |
</div>
|
| 797 |
</div>
|