@devness/useai 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -684,7 +684,7 @@ var VERSION;
|
|
|
684
684
|
var init_version = __esm({
|
|
685
685
|
"../shared/dist/constants/version.js"() {
|
|
686
686
|
"use strict";
|
|
687
|
-
VERSION = "0.6.
|
|
687
|
+
VERSION = "0.6.5";
|
|
688
688
|
}
|
|
689
689
|
});
|
|
690
690
|
|
|
@@ -35054,7 +35054,7 @@ var pl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
|
|
|
35054
35054
|
*
|
|
35055
35055
|
* This source code is licensed under the ISC license.
|
|
35056
35056
|
* See the LICENSE file in the root directory of this source tree.
|
|
35057
|
-
*/function fc(e){if(ic[e])return e;return dc.filter(t=>e.startsWith(t)).sort((e,t)=>t.length-e.length)[0]??e}var hc=E();function pc(e){const t=e.filter(e=>e.session.evaluation);if(0===t.length)return null;let n=0,r=0,a=0,i=0,o=0,s=0;const l={};for(const u of t){const e=u.session.evaluation;n+=e.prompt_quality,r+=e.context_provided,a+=e.independence_level,i+=e.scope_quality,o+=e.tools_leveraged,s+=e.iteration_count,l[e.task_outcome]=(l[e.task_outcome]??0)+1}const c=t.length;return{prompt_quality:Math.round(n/c*10)/10,context_provided:Math.round(r/c*10)/10,independence_level:Math.round(a/c*10)/10,scope_quality:Math.round(i/c*10)/10,tools_leveraged:Math.round(o/c),total_iterations:s,outcomes:l,session_count:c}}function mc({sessions:e,timeScale:t,effectiveTime:n,isLive:r,onDayClick:a,highlightDate:i}){const o="24h"===t||"12h"===t,l=new Date(n).toISOString().slice(0,10),c=f.useMemo(()=>o?function(e,t){const n=new Date(\`\${t}T00:00:00\`).getTime(),r=n+864e5,a=[];for(let i=0;i<24;i++)a.push({hour:i,minutes:0});for(const i of e){const e=new Date(i.started_at).getTime(),t=new Date(i.ended_at).getTime();if(t<n||e>r)continue;const o=Math.max(e,n),s=Math.min(t,r);for(let r=0;r<24;r++){const e=n+36e5*r,t=e+36e5,i=Math.max(o,e),l=Math.min(s,t);l>i&&(a[r].minutes+=(l-i)/6e4)}}return a}(e,l):[],[e,l,o]),u=f.useMemo(()=>o?[]:function(e,t){const n=new Date,r=[];for(let a=t-1;a>=0;a--){const t=new Date(n);t.setDate(t.getDate()-a);const i=t.toISOString().slice(0,10);let o=0;for(const n of e)n.started_at.slice(0,10)===i&&(o+=n.duration_seconds);r.push({date:i,hours:o/3600})}return r}(e,7),[e,o]),d=o?\`Hourly \u2014 \${new Date(n).toLocaleDateString([],{month:"short",day:"numeric"})}\`:"Last 7 Days";if(o){const e=Math.max(...c.map(e=>e.minutes),1);return s.jsxs("div",{className:"mb-8 p-5 rounded-2xl bg-bg-surface-1/50 border border-border/50",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4 px-1",children:[s.jsx("div",{className:"text-xs text-text-muted uppercase tracking-widest font-bold",children:d}),s.jsxs("div",{className:"text-[10px] text-text-muted font-mono bg-bg-surface-2 px-2 py-0.5 rounded",children:[e.toFixed(0),"m peak"]})]}),s.jsx("div",{className:"flex items-end gap-[3px] h-16",children:c.map((t,n)=>{const r=e>0?t.minutes/e*100:0;return s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-end h-full group relative",children:[s.jsx("div",{className:"absolute -top-10 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-20 pointer-events-none",children:s.jsxs("div",{className:"bg-bg-surface-3 text-text-primary text-[10px] font-mono px-2 py-1.5 rounded-lg shadow-xl whitespace-nowrap border border-border flex flex-col items-center",children:[s.jsxs("span",{className:"font-bold",children:[t.hour,":00"]}),s.jsxs("span",{className:"text-accent",children:[t.minutes.toFixed(0),"m active"]}),s.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 w-2 h-2 bg-bg-surface-3 border-r border-b border-border rotate-45"})]})}),s.jsx(fl.div,{initial:{height:0},animate:{height:\`\${Math.max(r,t.minutes>0?8:0)}%\`},transition:{delay:.01*n,duration:.5},className:"w-full rounded-t-sm transition-all duration-300 group-hover:bg-accent relative overflow-hidden",style:{minHeight:t.minutes>0?"4px":"0px",backgroundColor:t.minutes>0?\`rgba(var(--accent-rgb), \${.4+t.minutes/e*.6})\`:"var(--color-bg-surface-2)"},children:t.minutes>.5*e&&s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-transparent to-white/10"})})]},t.hour)})}),s.jsx("div",{className:"flex gap-[3px] mt-2 border-t border-border/30 pt-2",children:c.map(e=>s.jsx("div",{className:"flex-1 text-center",children:e.hour%6==0&&s.jsx("span",{className:"text-[9px] text-text-muted font-bold font-mono uppercase",children:0===e.hour?"12a":e.hour<12?\`\${e.hour}a\`:12===e.hour?"12p":e.hour-12+"p"})},e.hour))})]})}const h=Math.max(...u.map(e=>e.hours),.1);return s.jsxs("div",{className:"mb-8 p-5 rounded-2xl bg-bg-surface-1/50 border border-border/50",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4 px-1",children:[s.jsx("div",{className:"text-xs text-text-muted uppercase tracking-widest font-bold",children:d}),s.jsx("div",{className:"text-[10px] text-text-muted font-mono bg-bg-surface-2 px-2 py-0.5 rounded",children:"Last 7 days"})]}),s.jsx("div",{className:"flex items-end gap-2 h-16",children:u.map((e,t)=>{const n=h>0?e.hours/h*100:0,r=e.date===i;return s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-end h-full group relative",children:[s.jsx("div",{className:"absolute -top-10 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-20 pointer-events-none",children:s.jsxs("div",{className:"bg-bg-surface-3 text-text-primary text-[10px] font-mono px-2 py-1.5 rounded-lg shadow-xl whitespace-nowrap border border-border flex flex-col items-center",children:[s.jsx("span",{className:"font-bold",children:e.date}),s.jsxs("span",{className:"text-accent",children:[e.hours.toFixed(1),"h active"]}),s.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 w-2 h-2 bg-bg-surface-3 border-r border-b border-border rotate-45"})]})}),s.jsx(fl.div,{initial:{height:0},animate:{height:\`\${Math.max(n,e.hours>0?8:0)}%\`},transition:{delay:.05*t,duration:.5},className:"w-full rounded-t-md cursor-pointer transition-all duration-300 group-hover:scale-x-110 origin-bottom "+(r?"ring-2 ring-accent ring-offset-2 ring-offset-bg-base":""),style:{minHeight:e.hours>0?"4px":"0px",backgroundColor:r?"var(--color-accent-bright)":e.hours>0?\`rgba(var(--accent-rgb), \${.4+e.hours/h*.6})\`:"var(--color-bg-surface-2)"},onClick:()=>a?.(e.date)})]},e.date)})}),s.jsx("div",{className:"flex gap-2 mt-2 border-t border-border/30 pt-2",children:u.map(e=>s.jsx("div",{className:"flex-1 text-center",children:s.jsx("span",{className:"text-[10px] text-text-muted font-bold uppercase tracking-tighter",children:new Date(e.date+"T12:00:00").toLocaleDateString([],{weekday:"short"})})},e.date))})]})}function gc({children:e}){return s.jsx("span",{className:"text-text-primary font-medium",children:e})}function yc(e){return e.reduce((e,t)=>e+t.duration_seconds,0)/3600}function vc(e,t){const n=e.filter(e=>null!=e.evaluation);if(n.length<2)return null;return n.reduce((e,n)=>e+n.evaluation[t],0)/n.length}function xc(e,t,n,r,a,i){var o;const l=[],c=a-(i-a),u=a,d=function(e,t,n){return e.filter(e=>{const r=new Date(e.started_at).getTime();return r>=t&&r<=n})}(n,c,u),f=function(e,t,n){return e.filter(e=>{const r=new Date(e.created_at).getTime();return r>=t&&r<=n})}(r,c,u),h=yc(e),p=yc(d),m=vc(e,"prompt_quality"),g=vc(d,"prompt_quality");if(null!==m&&null!==g&&m>g+.3&&l.push({priority:10,node:s.jsxs("span",{children:["Your prompt quality improved from ",s.jsx(gc,{children:g.toFixed(1)})," to"," ",s.jsx(gc,{children:m.toFixed(1)})," \u2014 clearer prompts mean faster results."]})}),d.length>0&&e.length>0){const e=t.length/Math.max(h,.1),n=f.length/Math.max(p,.1);e>1.2*n&&t.length>=2&&l.push({priority:9,node:s.jsxs("span",{children:["You're shipping ",s.jsxs(gc,{children:[Math.round(100*(e/n-1)),"% faster"]})," ","this period \u2014 great momentum."]})})}const y=t.filter(e=>"complex"===e.complexity).length,v=f.filter(e=>"complex"===e.complexity).length;y>v&&y>=2&&l.push({priority:8,node:s.jsxs("span",{children:[s.jsx(gc,{children:y})," complex ",1===y?"task":"tasks"," this period vs"," ",s.jsx(gc,{children:v})," before \u2014 you're taking on harder problems."]})});const x=e.filter(e=>null!=e.evaluation),b=x.filter(e=>"completed"===e.evaluation.task_outcome&&e.evaluation.iteration_count<=3);if(x.length>=3&&b.length>0){const e=Math.round(b.length/x.length*100);e>=50&&l.push({priority:7,node:s.jsxs("span",{children:[s.jsxs(gc,{children:[e,"%"]})," of your sessions completed in 3 or fewer turns \u2014 efficient prompting."]})})}const w=function(e){if(0===e.length)return null;const t={};for(const a of e){const e=a.task_type||"coding";t[e]=(t[e]??0)+a.duration_seconds}const n=e.reduce((e,t)=>e+t.duration_seconds,0),r=Object.entries(t).sort((e,t)=>t[1]-e[1])[0];return r&&0!==n?{type:r[0],pct:Math.round(r[1]/n*100)}:null}(e);if(w&&w.pct>=60&&e.length>=2){const e={coding:"building",debugging:"debugging",testing:"testing",planning:"planning",reviewing:"reviewing",documenting:"documenting",refactoring:"refactoring",research:"researching",analysis:"analyzing"}[w.type]??w.type;l.push({priority:6,node:s.jsxs("span",{children:["Deep focus: ",s.jsxs(gc,{children:[w.pct,"%"]})," of your time spent ",e,"."]})})}const k={};for(const s of e)s.client&&(k[o=s.client]??(k[o]=[])).push(s);const S=Object.entries(k).filter(([,e])=>e.length>=2);if(S.length>=2){const e=S.map(([e,n])=>{const r=yc(n),a=new Set(n.map(e=>e.session_id)),i=t.filter(e=>a.has(e.session_id));return{name:e,rate:i.length/Math.max(r,.1),count:i.length}}).filter(e=>e.count>0);if(e.length>=2){e.sort((e,t)=>t.rate-e.rate);const t=e[0],n=oc[t.name]??t.name;l.push({priority:5,node:s.jsxs("span",{children:[s.jsx(gc,{children:n})," is your most productive tool this period \u2014 ",t.count," ",1===t.count?"milestone":"milestones"," shipped."]})})}}const C=vc(e,"context_provided");if(null!==C&&C<3.5&&l.push({priority:4,node:s.jsxs("span",{children:["Tip: Your context score averages ",s.jsxs(gc,{children:[C.toFixed(1),"/5"]})," \u2014 try including specific files and error messages for faster results."]})}),x.length>=3){const e=x.filter(e=>"completed"===e.evaluation.task_outcome).length,t=Math.round(e/x.length*100);100===t?l.push({priority:3,node:s.jsxs("span",{children:[s.jsx(gc,{children:"100%"})," completion rate \u2014 every task landed."]})}):t<70&&l.push({priority:4,node:s.jsxs("span",{children:[s.jsxs(gc,{children:[t,"%"]})," completion rate \u2014 try breaking tasks into smaller, well-scoped pieces."]})})}return p>0&&h>1.5*p&&h>=1&&l.push({priority:2,node:s.jsxs("span",{children:[s.jsxs(gc,{children:[Math.round(100*(h/p-1)),"% more"]})," AI-paired time this period \u2014 you're leaning in."]})}),0===e.length&&l.push({priority:1,node:s.jsx("span",{className:"text-text-muted",children:"No sessions in this window. Start coding with AI to see insights here."})}),l.sort((e,t)=>t.priority-e.priority)}function bc({sessions:e,milestones:t,windowStart:n,windowEnd:r,allSessions:a,allMilestones:i}){const o=f.useMemo(()=>{const o=xc(e,t,a??e,i??t,n,r);return o[0]?.node??null},[e,t,a,i,n,r]);return o?s.jsx(fl.div,{initial:{opacity:0},animate:{opacity:1},className:"rounded-xl bg-bg-surface-1 border border-border/50 px-4 py-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Zl,{className:"w-4 h-4 text-accent flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-sm text-text-secondary leading-relaxed",children:o})]})}):null}function wc({onDelete:e,size:t="md",className:n=""}){const[r,a]=f.useState(!1),i=f.useRef(void 0);f.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const o=t=>{t.stopPropagation(),i.current&&clearTimeout(i.current),a(!1),e()},l=e=>{e.stopPropagation(),i.current&&clearTimeout(i.current),a(!1)},c="sm"===t?"w-3 h-3":"w-3.5 h-3.5",u="sm"===t?"p-1":"p-1.5";return r?s.jsxs("span",{className:\`inline-flex items-center gap-0.5 \${n}\`,onClick:e=>e.stopPropagation(),children:[s.jsx("button",{onClick:o,className:\`\${u} rounded-lg transition-all bg-error/15 text-error hover:bg-error/25\`,title:"Confirm delete",children:s.jsx(wl,{className:c})}),s.jsx("button",{onClick:l,className:\`\${u} rounded-lg transition-all text-text-muted hover:bg-bg-surface-2\`,title:"Cancel",children:s.jsx(rc,{className:c})})]}):s.jsx("button",{onClick:e=>{e.stopPropagation(),a(!0),i.current=setTimeout(()=>a(!1),5e3)},className:\`\${u} rounded-lg transition-all text-text-muted hover:text-error/70 hover:bg-error/5 \${n}\`,title:"Delete",children:s.jsx(Jl,{className:c})})}function kc({sessions:e}){const{scores:t,summaryLine:n}=f.useMemo(()=>{const t=e.filter(e=>null!=e.evaluation);if(0===t.length)return{scores:null,summaryLine:null};let n=0,r=0,a=0,i=0,o=0,s=0;for(const e of t){const t=e.evaluation;n+=t.prompt_quality,r+=t.context_provided,a+=t.independence_level,i+=t.scope_quality,s+=t.iteration_count,"completed"===t.task_outcome&&o++}const l=t.length,c=Math.round(o/l*100);return{scores:[{label:"Prompt Quality",value:n/l,max:5},{label:"Context",value:r/l,max:5},{label:"Independence",value:a/l,max:5},{label:"Scope",value:i/l,max:5},{label:"Completion",value:c/20,max:5}],summaryLine:\`\${l} session\${1===l?"":"s"} evaluated \xB7 \${c}% completed \xB7 avg \${(s/l).toFixed(1)} iterations\`}},[e]);return s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-bg-surface-2",children:s.jsx(Gl,{className:"w-3.5 h-3.5 text-text-muted"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"AI Proficiency"})]}),null===t?s.jsx("p",{className:"text-xs text-text-muted py-2",children:"No evaluation data yet"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"space-y-3",children:t.map((e,t)=>{const n=e.value/e.max*100,r="Completion"===e.label?\`\${Math.round(n)}%\`:e.value.toFixed(1);return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-text-secondary font-medium w-28 text-right shrink-0",children:e.label}),s.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-bg-surface-2/50 overflow-hidden",children:s.jsx(fl.div,{className:"h-full rounded-full",style:{backgroundColor:(a=e.value,a>=4?"var(--color-accent)":a>=3?"var(--color-success)":"var(--color-text-muted)")},initial:{width:0},animate:{width:\`\${n}%\`},transition:{duration:.6,delay:.05*t,ease:[.22,1,.36,1]}})}),s.jsx("span",{className:"text-xs text-text-muted font-mono w-10 text-right shrink-0",children:r})]},e.label);var a})}),s.jsx("p",{className:"text-[10px] text-text-muted mt-4 px-1 font-mono",children:n})]})]})}function Sc({label:e,active:t,onClick:n}){return s.jsx("button",{onClick:n,className:"text-[10px] font-bold uppercase tracking-wider px-3 py-1.5 rounded-full transition-all duration-200 cursor-pointer border "+(t?"bg-accent text-white border-accent scale-105":"bg-bg-surface-1 border-border text-text-muted hover:text-text-primary hover:border-text-muted/50"),style:t?{boxShadow:"0 2px 10px rgba(var(--accent-rgb), 0.4)"}:void 0,children:e})}function Cc({sessions:e,filters:t,onFilterChange:n}){const r=f.useMemo(()=>[...new Set(e.map(e=>e.client))].sort(),[e]),a=f.useMemo(()=>[...new Set(e.flatMap(e=>e.languages))].sort(),[e]),i=f.useMemo(()=>[...new Set(e.map(e=>e.project).filter(e=>{if(!e)return!1;const t=e.trim().toLowerCase();return!["untitled","mcp","unknown","default","none"].includes(t)}))].sort(),[e]);return r.length>0||a.length>0||i.length>0?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-1",children:[s.jsx(Sc,{label:"All",active:"all"===t.client&&"all"===t.language&&"all"===t.project,onClick:()=>{n("client","all"),n("language","all"),n("project","all")}}),r.map(e=>s.jsx(Sc,{label:oc[e]??e,active:t.client===e,onClick:()=>n("client",t.client===e?"all":e)},e)),a.map(e=>s.jsx(Sc,{label:e,active:t.language===e,onClick:()=>n("language",t.language===e?"all":e)},e)),i.map(e=>s.jsx(Sc,{label:e,active:t.project===e,onClick:()=>n("project",t.project===e?"all":e)},e))]}):null}function jc({text:e,words:t}){if(!t?.length||!e)return s.jsx(s.Fragment,{children:e});const n=t.map(e=>e.replace(/[.*+?^\${}()|[\\]\\\\]/g,"\\\\$&")),r=new RegExp(\`(\${n.join("|")})\`,"gi"),a=e.split(r);return s.jsx(s.Fragment,{children:a.map((e,t)=>t%2==1?s.jsx("mark",{className:"bg-accent/30 text-inherit rounded-sm px-px",children:e},t):s.jsx("span",{children:e},t))})}var Nc={feature:"bg-success/10 text-success border-success/20",bugfix:"bg-error/10 text-error border-error/20",refactor:"bg-purple/10 text-purple border-purple/20",test:"bg-blue/10 text-blue border-blue/20",docs:"bg-accent/10 text-accent border-accent/20",setup:"bg-text-muted/10 text-text-muted border-text-muted/20",deployment:"bg-emerald/10 text-emerald border-emerald/20"};function Tc(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);if(r<24)return\`\${r}h ago\`;const a=Math.floor(r/24);return 1===a?"yesterday":a<7?\`\${a}d ago\`:new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function Ec({milestones:e,showPublic:t=!1}){const n=[...e].sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()).slice(0,8);return s.jsxs(fl.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3 px-1",children:[s.jsx(ec,{className:"w-4 h-4 text-accent"}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Recent Achievements"}),s.jsxs("span",{className:"text-[10px] text-text-muted font-mono bg-bg-surface-2 px-2 py-0.5 rounded ml-auto",children:[e.length," total"]})]}),0===n.length?s.jsx("div",{className:"text-sm text-text-muted text-center py-6",children:"No milestones yet \u2014 complete your first session!"}):s.jsx("div",{className:"space-y-0.5",children:n.map((e,n)=>{const r=uc[e.category]??"#9c9588",a=Nc[e.category]??"bg-bg-surface-2 text-text-secondary border-border",i=sc[e.client]??e.client.slice(0,2).toUpperCase(),o=ic[e.client]??"#91919a",l=t?e.title:e.private_title||e.title,c="complex"===e.complexity;return s.jsxs(fl.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{duration:.25,delay:.04*n},className:"flex items-center gap-3 py-2 px-2 rounded-lg hover:bg-bg-surface-2/40 transition-colors",children:[s.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:r}}),s.jsx("span",{className:"text-sm font-medium text-text-secondary hover:text-text-primary truncate flex-1 min-w-0",children:l}),s.jsx("span",{className:\`text-[9px] uppercase tracking-wider font-bold px-1.5 py-0.5 rounded-full border flex-shrink-0 \${a}\`,children:e.category}),c&&s.jsxs("span",{className:"flex items-center gap-0.5 text-[9px] uppercase tracking-wider font-bold px-1.5 py-0.5 rounded-full border bg-purple/10 text-purple border-purple/20 flex-shrink-0",children:[s.jsx(vl,{className:"w-2.5 h-2.5"}),"complex"]}),s.jsx("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:Tc(e.created_at)}),s.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center text-[8px] font-bold font-mono flex-shrink-0",style:{backgroundColor:\`\${o}15\`,color:o,border:\`1px solid \${o}20\`},children:i})]},e.id)})})]})}function Pc(e,t){const n=e=>new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0});return\`\${n(e)} \u2014 \${n(t)}\`}function Mc(e){if(e<60)return\`\${e}s\`;const t=Math.round(e/60);if(t<60)return\`\${t}m\`;const n=Math.floor(t/60),r=t%60;return r>0?\`\${n}h \${r}m\`:\`\${n}h\`}var Lc={feature:"bg-success/15 text-success border-success/30",bugfix:"bg-error/15 text-error border-error/30",refactor:"bg-purple/15 text-purple border-purple/30",test:"bg-blue/15 text-blue border-blue/30",docs:"bg-accent/15 text-accent border-accent/30",setup:"bg-text-muted/15 text-text-muted border-text-muted/20",deployment:"bg-emerald/15 text-emerald border-emerald/30"};function Dc({category:e}){const t=Lc[e]??"bg-bg-surface-2 text-text-secondary border-border";return s.jsx("span",{className:\`text-[10px] px-1.5 py-0.5 rounded-full border font-bold uppercase tracking-wider \${t}\`,children:e})}function Ac({score:e}){const t=e/5*100,n=e>=4?"bg-success":e>=3?"bg-accent":"bg-error",r=e>=4?"bg-success/15":e>=3?"bg-accent/15":"bg-error/15";return s.jsx("span",{className:\`w-7 h-[4px] rounded-full \${r} flex-shrink-0 overflow-hidden\`,title:\`Quality: \${e.toFixed(1)}/5\`,children:s.jsx("span",{className:\`block h-full rounded-full \${n}\`,style:{width:\`\${t}%\`}})})}function _c({evaluation:e,showPublic:t=!1}){const n=[{label:"Prompt",value:e.prompt_quality,reason:e.prompt_quality_reason,Icon:Ul},{label:"Context",value:e.context_provided,reason:e.context_provided_reason,Icon:_l},{label:"Scope",value:e.scope_quality,reason:e.scope_quality_reason,Icon:Gl},{label:"Independence",value:e.independence_level,reason:e.independence_level_reason,Icon:El}],r=n.some(e=>e.reason)||e.task_outcome_reason;return s.jsxs("div",{className:"px-2 py-1.5 bg-bg-surface-2/30 rounded-md mb-2",children:[s.jsx("div",{className:"grid grid-cols-2 gap-x-6 gap-y-1.5",children:n.map(({label:e,value:t,Icon:n})=>s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(n,{className:"w-3 h-3 text-text-muted/50 flex-shrink-0"}),s.jsx("span",{className:"text-text-muted min-w-[58px]",children:e}),s.jsx(Ac,{score:t})]},e))}),!t&&r&&s.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-border/15 space-y-1",children:[e.task_outcome_reason&&s.jsxs("div",{className:"flex items-start gap-1.5 text-[10px]",children:[s.jsx("span",{className:"text-error font-bold flex-shrink-0",children:"Outcome:"}),s.jsx("span",{className:"text-text-muted leading-tight",children:e.task_outcome_reason})]}),n.filter(e=>e.reason).map(({label:e,reason:t})=>s.jsxs("div",{className:"flex items-start gap-1.5 text-[10px]",children:[s.jsxs("span",{className:"text-accent font-bold flex-shrink-0",children:[e,":"]}),s.jsx("span",{className:"text-text-muted leading-tight",children:t})]},e))]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1.5 pt-1.5 border-t border-border/15",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(Wl,{className:"w-3 h-3 text-text-muted/50"}),s.jsx("span",{className:"text-text-muted",children:"Iterations"}),s.jsx("span",{className:"text-text-secondary font-mono font-bold ml-0.5",children:e.iteration_count})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(nc,{className:"w-3 h-3 text-text-muted/50"}),s.jsx("span",{className:"text-text-muted",children:"Tools"}),s.jsx("span",{className:"text-text-secondary font-mono font-bold ml-0.5",children:e.tools_leveraged})]})]})]})}var zc=f.memo(function({session:e,milestones:t,defaultExpanded:n=!1,externalShowPublic:r,hideClientAvatar:a=!1,hideProject:i=!1,showFullDate:o=!1,highlightWords:l,onDeleteSession:c,onDeleteMilestone:u}){const[d,h]=f.useState(n),[p,m]=f.useState(!1),g=r??p,y=m,v=fc(e.client),x=ic[v]??"#91919a",b="cursor"===v,w=b?"var(--text-primary)":x,k=b?{backgroundColor:"var(--bg-surface-2)",color:"var(--text-primary)",border:"1px solid var(--border)"}:{backgroundColor:\`\${x}15\`,color:x,border:\`1px solid \${x}30\`},S=sc[v]??v.slice(0,2).toUpperCase(),C=cc[v],j=t.length>0||!!e.evaluation||!!e.model||!!e.tool_overhead,N=e.project?.trim()||"",T=!N||["untitled","mcp","unknown","default","none","null","undefined"].includes(N.toLowerCase()),E=t[0],P=T&&E?E.title:N,M=T&&E?E.private_title||E.title:N;let L=e.private_title||e.title||M||"Untitled Session",D=e.title||P||"Untitled Session";const A=L!==D;return s.jsxs("div",{className:"group/card mb-1 rounded-lg border transition-all duration-200 "+(d?"bg-bg-surface-1 border-accent/30 shadow-md":"bg-bg-surface-1/30 border-border/50 hover:border-accent/30"),children:[s.jsxs("div",{className:"flex items-center",children:[s.jsxs("button",{className:"flex-1 flex items-center gap-3 px-3 py-2 text-left min-w-0",onClick:()=>j&&h(!d),style:{cursor:j?"pointer":"default"},children:[!a&&s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-[11px] font-black font-mono flex-shrink-0 shadow-sm",style:k,title:oc[v]??v,children:C?s.jsx("div",{className:"w-4 h-4",style:{backgroundColor:w,maskImage:\`url(\${C})\`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskImage:\`url(\${C})\`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):S}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:s.jsx("div",{className:"flex items-center gap-1.5 min-w-0",children:s.jsx(Ko,{mode:"wait",children:s.jsxs(fl.div,{initial:{opacity:0,x:-5},animate:{opacity:1,x:0},exit:{opacity:0,x:5},transition:{duration:.1},className:"flex items-center gap-1.5 min-w-0",children:[g?s.jsx(Xl,{className:"w-3 h-3 text-success/60 flex-shrink-0"}):s.jsx(Il,{className:"w-3 h-3 text-accent/60 flex-shrink-0"}),s.jsx("span",{className:"text-sm font-bold truncate text-text-primary tracking-tight",children:s.jsx(jc,{text:g?D:L,words:l})})]},g?"public":"private")})})}),s.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-text-muted font-semibold",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Tl,{className:"w-3 h-3 opacity-60"}),Mc(e.duration_seconds)]}),e.duration_seconds>=900&&(()=>{const t=Math.floor(e.duration_seconds/900),n=t>0?Math.min(e.heartbeat_count/t,1):0,r=n>=.8?"text-success":n>=.5?"text-accent":"text-text-muted";return s.jsxs("span",{className:\`flex items-center gap-0.5 font-mono \${r}\`,title:\`Focus: \${Math.round(100*n)}%\`,children:[s.jsx(ac,{className:"w-2.5 h-2.5 fill-current opacity-70"}),Math.round(100*n),"%"]})})(),s.jsxs("span",{className:"opacity-50 font-mono tracking-tight",children:[o&&\`\${new Date(e.started_at).toLocaleDateString([],{month:"short",day:"numeric"})} \xB7 \`,Pc(e.started_at,e.ended_at).split(" \u2014 ")[0]]}),!g&&!T&&!i&&s.jsxs("span",{className:"flex items-center gap-0.5 text-text-muted/70",title:\`Project: \${N}\`,children:[s.jsx(Vl,{className:"w-2.5 h-2.5 opacity-60"}),s.jsx("span",{className:"max-w-[100px] truncate",children:N})]}),t.length>0&&s.jsxs("span",{className:"flex items-center gap-0.5",title:\`\${t.length} milestone\${1!==t.length?"s":""}\`,children:[s.jsx(Rl,{className:"w-2.5 h-2.5 opacity-60"}),t.length]}),e.evaluation&&s.jsx(Ac,{score:(_=e.evaluation,(_.prompt_quality+_.context_provided+_.scope_quality+_.independence_level)/4)})]})]})]}),s.jsxs("div",{className:"flex items-center px-2 gap-1.5 border-l border-border/30 h-8 self-center",children:[c&&s.jsx(wc,{onDelete:()=>c(e.session_id),className:"opacity-0 group-hover/card:opacity-100"}),A&&void 0===r&&s.jsx("button",{onClick:e=>{e.stopPropagation(),y(!g)},className:"p-1.5 rounded-lg transition-all "+(g?"bg-success/10 text-success":"text-text-muted hover:bg-bg-surface-2"),title:g?"Public Mode":"Private Mode",children:g?s.jsx(Dl,{className:"w-3.5 h-3.5"}):s.jsx(Ll,{className:"w-3.5 h-3.5"})}),j&&s.jsx("button",{onClick:()=>h(!d),className:"p-1.5 rounded-lg transition-all "+(d?"text-accent bg-accent/5":"text-text-muted hover:bg-bg-surface-2"),children:s.jsx(kl,{className:"w-4 h-4 transition-transform duration-200 "+(d?"rotate-180":"")})})]})]}),s.jsx(Ko,{children:d&&j&&s.jsx(fl.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:s.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-1",children:[s.jsx("div",{className:"h-px bg-border/20 mb-2 mx-1"}),(e.model||e.tool_overhead)&&s.jsxs("div",{className:"flex items-center gap-4 px-2 py-1.5 bg-bg-surface-2/30 rounded-md mb-2",children:[e.model&&s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(Ml,{className:"w-3 h-3 text-text-muted/50 flex-shrink-0"}),s.jsx("span",{className:"text-text-muted",children:"Model"}),s.jsx("span",{className:"text-text-secondary font-mono font-bold ml-0.5",children:e.model})]}),e.tool_overhead&&s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(yl,{className:"w-3 h-3 text-text-muted/50 flex-shrink-0"}),s.jsx("span",{className:"text-text-muted",children:"Tracking overhead"}),s.jsxs("span",{className:"text-text-secondary font-mono font-bold ml-0.5",children:["~",e.tool_overhead.total_tokens_est," tokens"]})]})]}),e.evaluation&&s.jsx(_c,{evaluation:e.evaluation,showPublic:g}),t.length>0&&s.jsx("div",{className:"space-y-0.5",children:t.map(e=>{const t=g?e.title:e.private_title||e.title,n=function(e){if(!e||e<=0)return"";if(e<60)return\`\${e}m\`;const t=Math.floor(e/60),n=e%60;return n>0?\`\${t}h \${n}m\`:\`\${t}h\`}(e.duration_minutes);return s.jsxs("div",{className:"group flex items-center gap-2 p-1.5 rounded-md hover:bg-bg-surface-2/40 transition-colors",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:uc[e.category]??"#9c9588"}}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-text-secondary group-hover:text-text-primary truncate",children:s.jsx(jc,{text:t,words:l})}),s.jsx(Dc,{category:e.category})]})}),n&&s.jsx("span",{className:"text-[10px] text-text-muted font-mono",children:n}),u&&s.jsx(wc,{onDelete:()=>u(e.id),size:"sm",className:"opacity-0 group-hover:opacity-100"})]},e.id)})})]})})})]});var _});function Rc(e){if(e<60)return\`\${e}s\`;const t=Math.round(e/60);if(t<60)return\`\${t}m\`;const n=Math.floor(t/60),r=t%60;return r>0?\`\${n}h \${r}m\`:\`\${n}h\`}function Vc({score:e}){const t=e/5*100,n=e>=4?"bg-success":e>=3?"bg-accent":"bg-error",r=e>=4?"bg-success/15":e>=3?"bg-accent/15":"bg-error/15";return s.jsx("span",{className:\`w-7 h-[4px] rounded-full \${r} flex-shrink-0 overflow-hidden\`,title:\`Quality: \${e.toFixed(1)}/5\`,children:s.jsx("span",{className:\`block h-full rounded-full \${n}\`,style:{width:\`\${t}%\`}})})}var Fc=f.memo(function({group:e,defaultExpanded:t,globalShowPublic:n,showFullDate:r,highlightWords:a,onDeleteSession:i,onDeleteMilestone:o,onDeleteConversation:l}){const[c,u]=f.useState(t),[d,h]=f.useState(!1),p=n||d;if(1===e.sessions.length){const l=e.sessions[0];return s.jsx(zc,{session:l.session,milestones:l.milestones,defaultExpanded:t&&l.milestones.length>0,externalShowPublic:n||void 0,showFullDate:r,highlightWords:a,onDeleteSession:i,onDeleteMilestone:o})}const m=fc(e.sessions[0].session.client),g=ic[m]??"#91919a",y="cursor"===m,v=y?"var(--text-primary)":g,x=y?{backgroundColor:"var(--bg-surface-2)",color:"var(--text-primary)",border:"1px solid var(--border)"}:{backgroundColor:\`\${g}15\`,color:g,border:\`1px solid \${g}30\`},b=sc[m]??m.slice(0,2).toUpperCase(),w=cc[m],k=e.aggregateEval,S=k?(k.prompt_quality+k.context_provided+k.scope_quality+k.independence_level)/4:0,C=e.sessions[0].session,j=C.private_title||C.title||C.project||"Conversation",N=C.title||C.project||"Conversation",T=j!==N,E=C.project?.trim()||"",P=!!E&&!["untitled","mcp","unknown","default","none","null","undefined"].includes(E.toLowerCase());return s.jsxs("div",{className:"group/conv mb-1 rounded-lg border transition-all duration-200 "+(c?"bg-bg-surface-1 border-accent/30 shadow-md":"bg-bg-surface-1/30 border-border/50 hover:border-accent/30"),children:[s.jsxs("div",{className:"flex items-center",children:[s.jsxs("button",{className:"flex-1 flex items-center gap-3 px-3 py-2 text-left min-w-0",onClick:()=>u(!c),children:[s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-[11px] font-black font-mono flex-shrink-0 shadow-sm",style:x,title:oc[m]??m,children:w?s.jsx("div",{className:"w-4 h-4",style:{backgroundColor:v,maskImage:\`url(\${w})\`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskImage:\`url(\${w})\`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):b}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("div",{className:"flex items-center gap-1.5 min-w-0",children:s.jsx(Ko,{mode:"wait",children:s.jsxs(fl.div,{initial:{opacity:0,x:-5},animate:{opacity:1,x:0},exit:{opacity:0,x:5},transition:{duration:.1},className:"flex items-center gap-1.5 min-w-0",children:[p?s.jsx(Xl,{className:"w-3 h-3 text-success/60 flex-shrink-0"}):s.jsx(Il,{className:"w-3 h-3 text-accent/60 flex-shrink-0"}),s.jsx("span",{className:"text-sm font-bold truncate text-text-primary tracking-tight",children:s.jsx(jc,{text:p?N:j,words:a})})]},p?"public":"private")})}),s.jsxs("span",{className:"text-[10px] font-bold text-accent/80 bg-accent/5 px-1.5 py-0.5 rounded border border-accent/10 flex-shrink-0",children:[e.sessions.length," prompts"]})]}),s.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-text-muted font-semibold",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Tl,{className:"w-3 h-3 opacity-60"}),Rc(e.totalDuration)]}),s.jsxs("span",{className:"opacity-50 font-mono tracking-tight",children:[r&&\`\${new Date(e.startedAt).toLocaleDateString([],{month:"short",day:"numeric"})} \xB7 \`,(M=e.startedAt,new Date(M).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}))]}),!p&&P&&s.jsxs("span",{className:"flex items-center gap-0.5 text-text-muted/70",title:\`Project: \${E}\`,children:[s.jsx(Vl,{className:"w-2.5 h-2.5 opacity-60"}),s.jsx("span",{className:"max-w-[100px] truncate",children:E})]}),e.totalMilestones>0&&s.jsxs("span",{className:"flex items-center gap-0.5",title:\`\${e.totalMilestones} milestone\${1!==e.totalMilestones?"s":""}\`,children:[s.jsx(Rl,{className:"w-2.5 h-2.5 opacity-60"}),e.totalMilestones]}),k&&s.jsx(Vc,{score:S})]})]})]}),s.jsxs("div",{className:"flex items-center px-2 gap-1.5 border-l border-border/30 h-8 self-center",children:[l&&e.conversationId&&s.jsx(wc,{onDelete:()=>l(e.conversationId),className:"opacity-0 group-hover/conv:opacity-100"}),T&&!n&&s.jsx("button",{onClick:()=>h(!d),className:"p-1.5 rounded-lg transition-all "+(p?"bg-success/10 text-success":"text-text-muted hover:bg-bg-surface-2"),title:p?"Public Mode":"Private Mode",children:p?s.jsx(Dl,{className:"w-3.5 h-3.5"}):s.jsx(Ll,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>u(!c),className:"p-1.5 rounded-lg transition-all "+(c?"text-accent bg-accent/5":"text-text-muted hover:bg-bg-surface-2"),children:s.jsx(kl,{className:"w-4 h-4 transition-transform duration-200 "+(c?"rotate-180":"")})})]})]}),s.jsx(Ko,{children:c&&s.jsx(fl.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:s.jsxs("div",{className:"px-3 pb-2 relative",children:[s.jsx("div",{className:"absolute left-[1.75rem] top-0 bottom-2 w-px",style:{backgroundColor:\`\${g}25\`}}),s.jsx("div",{className:"space-y-1 pl-10",children:e.sessions.map(e=>s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute -left-7 top-5 w-2 h-2 rounded-full border-2",style:{backgroundColor:g,borderColor:\`\${g}40\`}}),s.jsx(zc,{session:e.session,milestones:e.milestones,defaultExpanded:!1,externalShowPublic:p||void 0,hideClientAvatar:!0,hideProject:!0,showFullDate:r,highlightWords:a,onDeleteSession:i,onDeleteMilestone:o})]},e.session.session_id))})]})})})]});var M});function Oc({sessions:e,milestones:t,filters:n,globalShowPublic:r,showFullDate:a,highlightWords:i,outsideWindowCounts:o,onNavigateNewer:l,onNavigateOlder:c,onDeleteSession:u,onDeleteConversation:d,onDeleteMilestone:h}){const p=f.useMemo(()=>e.filter(e=>("all"===n.client||e.client===n.client)&&(!("all"!==n.language&&!e.languages.includes(n.language))&&("all"===n.project||(e.project??"")===n.project))),[e,n]),m=f.useMemo(()=>"all"===n.category?t:t.filter(e=>e.category===n.category),[t,n.category]),g=f.useMemo(()=>{const e=function(e,t){const n=new Map;for(const a of t){const e=n.get(a.session_id);e?e.push(a):n.set(a.session_id,[a])}const r=e.map(e=>({session:e,milestones:n.get(e.session_id)??[]}));return r.sort((e,t)=>new Date(t.session.started_at).getTime()-new Date(e.session.started_at).getTime()),r}(p,m);return function(e){const t=new Map,n=[];for(const a of e){const e=a.session.conversation_id;if(e){const n=t.get(e);n?n.push(a):t.set(e,[a])}else n.push(a)}const r=[];for(const[a,i]of t){i.sort((e,t)=>(e.session.conversation_index??0)-(t.session.conversation_index??0));const e=i.reduce((e,t)=>e+t.session.duration_seconds,0),t=i.reduce((e,t)=>e+t.milestones.length,0),n=i[0].session.started_at,o=i[i.length-1].session.ended_at;r.push({conversationId:a,sessions:i,aggregateEval:pc(i),totalDuration:e,totalMilestones:t,startedAt:n,endedAt:o})}for(const a of n)r.push({conversationId:null,sessions:[a],aggregateEval:a.session.evaluation?pc([a]):null,totalDuration:a.session.duration_seconds,totalMilestones:a.milestones.length,startedAt:a.session.started_at,endedAt:a.session.ended_at});return r.sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()),r}(e)},[p,m]),[y,v]=f.useState(25),x=f.useRef(null);if(f.useEffect(()=>{v(25)},[g]),f.useEffect(()=>{const e=x.current;if(!e)return;const t=new IntersectionObserver(([e])=>{e?.isIntersecting&&v(e=>e+25)},{rootMargin:"200px"});return t.observe(e),()=>t.disconnect()},[g,y]),0===g.length){const e=o&&o.before>0,t=o&&o.after>0;return s.jsxs("div",{className:"text-center text-text-muted py-8 text-sm mb-4 space-y-3",children:[t&&s.jsxs("button",{onClick:l,className:"flex flex-col items-center gap-0.5 mx-auto text-[11px] text-text-muted/60 hover:text-accent transition-colors group",children:[s.jsx(jl,{className:"w-3.5 h-3.5"}),s.jsxs("span",{children:[o.after," newer session",1!==o.after?"s":""]}),o.newerLabel&&s.jsx("span",{className:"text-[10px] opacity-70 group-hover:opacity-100",children:o.newerLabel})]}),s.jsx("div",{children:"No sessions in this window"}),e&&s.jsxs("button",{onClick:c,className:"flex flex-col items-center gap-0.5 mx-auto text-[11px] text-text-muted/60 hover:text-accent transition-colors group",children:[o.olderLabel&&s.jsx("span",{className:"text-[10px] opacity-70 group-hover:opacity-100",children:o.olderLabel}),s.jsxs("span",{children:[o.before," older session",1!==o.before?"s":""]}),s.jsx(kl,{className:"w-3.5 h-3.5"})]})]})}const b=y<g.length,w=b?g.slice(0,y):g;return s.jsxs("div",{className:"space-y-1.5 mb-4",children:[o&&o.after>0&&s.jsxs("button",{onClick:l,className:"flex flex-col items-center gap-0.5 w-full text-[11px] text-text-muted/60 hover:text-accent py-1.5 transition-colors group",children:[s.jsx(jl,{className:"w-3.5 h-3.5"}),s.jsxs("span",{children:[o.after," newer session",1!==o.after?"s":""]}),o.newerLabel&&s.jsx("span",{className:"text-[10px] opacity-70 group-hover:opacity-100",children:o.newerLabel})]}),w.map(e=>s.jsx(Fc,{group:e,defaultExpanded:!1,globalShowPublic:r,showFullDate:a,highlightWords:i,onDeleteSession:u,onDeleteMilestone:h,onDeleteConversation:d},e.conversationId??e.sessions[0].session.session_id)),b&&s.jsx("div",{ref:x,className:"h-px"}),g.length>25&&s.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 text-[11px] text-text-muted",children:[s.jsxs("span",{children:["Showing ",Math.min(y,g.length)," of ",g.length," conversations"]}),b&&s.jsx("button",{onClick:()=>v(g.length),className:"text-accent hover:text-accent/80 font-semibold transition-colors",children:"Show all"})]}),o&&o.before>0&&s.jsxs("button",{onClick:c,className:"flex flex-col items-center gap-0.5 w-full text-[11px] text-text-muted/60 hover:text-accent py-1.5 transition-colors group",children:[o.olderLabel&&s.jsx("span",{className:"text-[10px] opacity-70 group-hover:opacity-100",children:o.olderLabel}),s.jsxs("span",{children:[o.before," older session",1!==o.before?"s":""]}),s.jsx(kl,{className:"w-3.5 h-3.5"})]})]})}var Ic=["Output","Efficiency","Prompts","Consistency","Breadth"];function $c(e,t,n,r,a){const i=2*Math.PI*e/5-Math.PI/2;return[n+a*t*Math.cos(i),r+a*t*Math.sin(i)]}function Bc(e,t,n,r){const a=[];for(let i=0;i<5;i++){const[o,s]=$c(i,e,t,n,r);a.push(\`\${o},\${s}\`)}return a.join(" ")}function Uc({sessions:e,milestones:t,streak:n}){const{values:r,hasEvalData:a}=f.useMemo(()=>{const r={simple:1,medium:2,complex:4};let a=0;for(const e of t)a+=r[e.complexity]??1;const i=Math.min(1,a/10),o=e.reduce((e,t)=>e+t.files_touched,0),s=e.reduce((e,t)=>e+t.duration_seconds,0)/3600,l=Math.min(1,o/Math.max(s,1)/20),c=e.filter(e=>null!=e.evaluation);let u=0;const d=c.length>0;if(d){u=c.reduce((e,t)=>e+t.evaluation.prompt_quality,0)/c.length/5}const f=Math.min(1,n/14),h=new Set;for(const t of e)for(const e of t.languages)h.add(e);return{values:[i,l,u,f,Math.min(1,h.size/5)],hasEvalData:d}},[e,t,n]),i=100,o=100,l=[];for(let s=0;s<5;s++){const e=Math.max(r[s],.02),[t,n]=$c(s,e,i,o,70);l.push(\`\${t},\${n}\`)}const c=l.join(" ");return s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.15},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-bg-surface-2",children:s.jsx(vl,{className:"w-3.5 h-3.5 text-text-muted"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Skill Profile"})]}),s.jsx("div",{className:"flex justify-center",children:s.jsxs("svg",{viewBox:"0 0 200 200",width:200,height:200,className:"overflow-visible",children:[[.33,.66,1].map(e=>s.jsx("polygon",{points:Bc(e,i,o,70),fill:"none",stroke:"var(--color-bg-surface-3)",strokeWidth:.5,opacity:.6},e)),Array.from({length:5}).map((e,t)=>{const[n,r]=$c(t,1,i,o,70);return s.jsx("line",{x1:i,y1:o,x2:n,y2:r,stroke:"var(--color-bg-surface-3)",strokeWidth:.5,opacity:.4},\`axis-\${t}\`)}),s.jsx(fl.polygon,{points:c,fill:"var(--color-accent)",fillOpacity:.2,stroke:"var(--color-accent)",strokeWidth:1.5,strokeLinejoin:"round",initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{duration:.6,ease:[.22,1,.36,1]},style:{transformOrigin:"100px 100px"}}),r.map((e,t)=>{const n=Math.max(e,.02),[r,l]=$c(t,n,i,o,70),c=2===t&&!a;return s.jsx("circle",{cx:r,cy:l,r:2.5,fill:c?"var(--color-text-muted)":"var(--color-accent-bright)",opacity:c?.4:1},\`point-\${t}\`)}),Ic.map((e,t)=>{const n=function(e,t,n,r){const[a,i]=$c(e,1.28,t,n,r);let o="middle";return 1!==e&&2!==e||(o="start"),3!==e&&4!==e||(o="end"),{x:a,y:i,anchor:o}}(t,i,o,70),r=2===t&&!a;return s.jsx("text",{x:n.x,y:n.y,textAnchor:n.anchor,dominantBaseline:"central",className:"text-[9px] font-medium",fill:r?"var(--color-text-muted)":"var(--color-text-secondary)",opacity:r?.5:1,children:e},e)})]})}),s.jsx("div",{className:"flex justify-center gap-3 mt-2 flex-wrap",children:Ic.map((e,t)=>{const n=2===t&&!a,i=Math.round(100*r[t]);return s.jsxs("span",{className:"text-[10px] font-mono "+(n?"text-text-muted/50":"text-text-muted"),children:[i,"%"]},e)})})]})}var Hc={features:{title:"Features Shipped",icon:ql,filter:e=>"feature"===e.category,emptyText:"No features shipped in this time window.",accentColor:"#4ade80"},bugs:{title:"Bugs Fixed",icon:xl,filter:e=>"bugfix"===e.category,emptyText:"No bugs fixed in this time window.",accentColor:"#f87171"},complex:{title:"Complex Tasks",icon:vl,filter:e=>"complex"===e.complexity,emptyText:"No complex tasks in this time window.",accentColor:"#a78bfa"}},Wc={feature:"bg-success/10 text-success border-success/20",bugfix:"bg-error/10 text-error border-error/20",refactor:"bg-purple/10 text-purple border-purple/20",test:"bg-blue/10 text-blue border-blue/20",docs:"bg-accent/10 text-accent border-accent/20",setup:"bg-text-muted/10 text-text-muted border-text-muted/20",deployment:"bg-emerald/10 text-emerald border-emerald/20"};function qc(e){const t=new Date(e),n=(new Date).getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const a=Math.floor(r/60);if(a<24)return\`\${a}h ago\`;const i=Math.floor(a/24);return 1===i?"yesterday":i<7?\`\${i}d ago\`:t.toLocaleDateString([],{month:"short",day:"numeric"})}function Yc({type:e,milestones:t,showPublic:n=!1,onClose:r}){if(f.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const a=Hc[e],i=a.icon,o=t.filter(a.filter).sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()),l=new Map;for(const s of o){const e=new Date(s.created_at).toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"}),t=l.get(e);t?t.push(s):l.set(e,[s])}return s.jsx(Ko,{children:e&&s.jsxs(s.Fragment,{children:[s.jsx(fl.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-40",onClick:r}),s.jsxs(fl.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed top-0 right-0 h-full w-full max-w-md bg-bg-base border-l border-border/50 z-50 flex flex-col shadow-2xl",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border/50",children:[s.jsx("div",{className:"p-2 rounded-lg",style:{backgroundColor:\`\${a.accentColor}15\`},children:s.jsx(i,{className:"w-4 h-4",style:{color:a.accentColor}})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h2",{className:"text-sm font-bold text-text-primary",children:a.title}),s.jsxs("span",{className:"text-[10px] font-mono text-text-muted",children:[o.length," ",1===o.length?"item":"items"," in window"]})]}),s.jsx("button",{onClick:r,className:"p-1.5 rounded-md hover:bg-bg-surface-2 text-text-muted hover:text-text-primary transition-colors",children:s.jsx(rc,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto overscroll-contain px-5 py-4",children:0===o.length?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s.jsx(Zl,{className:"w-8 h-8 text-text-muted/30 mb-3"}),s.jsx("p",{className:"text-sm text-text-muted",children:a.emptyText})]}):s.jsx("div",{className:"space-y-5",children:[...l.entries()].map(([t,r])=>s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-mono text-text-muted uppercase tracking-wider mb-2 px-1",children:t}),s.jsx("div",{className:"space-y-1",children:r.map((t,r)=>{const a=uc[t.category]??"#9c9588",i=Wc[t.category]??"bg-bg-surface-2 text-text-secondary border-border",o=fc(t.client),l=sc[o]??o.slice(0,2).toUpperCase(),c=ic[o]??"#91919a",u="cursor"===o?"var(--text-primary)":c,d=cc[o],f=n?t.title:t.private_title||t.title,h="complex"===t.complexity;return s.jsxs(fl.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,delay:.03*r},className:"flex items-start gap-2.5 py-2 px-2 rounded-lg hover:bg-bg-surface-1 transition-colors group",children:[s.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 mt-1.5",style:{backgroundColor:a}}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm text-text-secondary group-hover:text-text-primary transition-colors leading-snug",children:f}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:["complex"===e&&s.jsx("span",{className:\`text-[8px] uppercase tracking-wider font-bold px-1.5 py-0.5 rounded-full border \${i}\`,children:t.category}),h&&"complex"!==e&&s.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] uppercase tracking-wider font-bold px-1.5 py-0.5 rounded-full border bg-purple/10 text-purple border-purple/20",children:[s.jsx(vl,{className:"w-2 h-2"}),"complex"]}),s.jsx("span",{className:"text-[10px] text-text-muted font-mono",children:qc(t.created_at)}),t.languages.length>0&&s.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:t.languages.join(", ")}),s.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center text-[7px] font-bold font-mono flex-shrink-0 ml-auto",style:{backgroundColor:\`\${c}15\`,color:c,border:\`1px solid \${c}20\`},children:d?s.jsx("div",{className:"w-2.5 h-2.5",style:{backgroundColor:u,maskImage:\`url(\${d})\`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskImage:\`url(\${d})\`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):l})]})]})]},t.id)})})]},t))})})]})]})})}function Qc({label:e,value:t,suffix:n,decimals:r=0,icon:a,delay:i=0,variant:o="default",clickable:l=!1,selected:c=!1,onClick:u}){const d=f.useRef(null),h=f.useRef(0);f.useEffect(()=>{d.current&&t!==h.current&&(!function(e,t,n){let r=null;requestAnimationFrame(function a(i){r||(r=i);const o=Math.min((i-r)/800,1),s=1-Math.pow(1-o,4),l=t*s;e.textContent=n>0?l.toFixed(n):String(Math.round(l)),o<1&&requestAnimationFrame(a)})}(d.current,t,r),h.current=t)},[t,r]);const p="accent"===o;return s.jsxs(fl.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:i},onClick:l&&t>0?u:void 0,className:\`px-3 py-2 rounded-lg border flex items-center gap-2.5 group transition-all duration-300 \${p?"shrink-0 bg-bg-surface-1 border-border/50 hover:border-accent/30":"flex-1 min-w-[120px] bg-bg-surface-1 border-border/50 hover:border-accent/30"} \${l&&t>0?"cursor-pointer":""} \${c?"border-accent/50 bg-accent/5":""}\`,children:[s.jsx("div",{className:"p-1.5 rounded-md transition-colors "+(c?"bg-accent/15":"bg-bg-surface-2 group-hover:bg-accent/10"),children:s.jsx(a,{className:"w-3.5 h-3.5 transition-colors "+(c?"text-accent":"text-text-muted group-hover:text-accent")})}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-baseline gap-0.5",children:[s.jsx("span",{ref:d,className:"text-lg font-bold text-text-primary tracking-tight leading-none",children:r>0?t.toFixed(r):t}),n&&s.jsx("span",{className:"text-[10px] text-text-muted font-medium",children:n})]}),s.jsx("span",{className:"text-[9px] font-mono text-text-muted uppercase tracking-wider leading-none mt-0.5",children:e})]})]})}function Kc({totalHours:e,featuresShipped:t,bugsFixed:n,complexSolved:r,currentStreak:a,filesTouched:i,selectedCard:o,onCardClick:l}){const c=e=>{l?.(o===e?null:e)};return s.jsxs("div",{className:"flex gap-2 mb-4",children:[s.jsxs("div",{className:"grid grid-cols-3 lg:grid-cols-5 gap-2 flex-1",children:[s.jsx(Qc,{label:"Active Hours",value:e,suffix:"hrs",decimals:1,icon:Tl,delay:.1}),s.jsx(Qc,{label:"Features",value:t,icon:ql,delay:.15,clickable:!0,selected:"features"===o,onClick:()=>c("features")}),s.jsx(Qc,{label:"Bugs Fixed",value:n,icon:xl,delay:.2,clickable:!0,selected:"bugs"===o,onClick:()=>c("bugs")}),s.jsx(Qc,{label:"Complex",value:r,icon:vl,delay:.25,clickable:!0,selected:"complex"===o,onClick:()=>c("complex")}),s.jsx(Qc,{label:"Files",value:i,icon:Al,delay:.3})]}),s.jsx("div",{className:"w-px bg-border/30 self-stretch my-1"}),s.jsx(Qc,{label:"Streak",value:a,suffix:"days",icon:ac,delay:.35,variant:"accent"})]})}function Xc(e){const t=e/3600;return t<.1?\`\${t.toFixed(2)}h\`:\`\${t.toFixed(1)}h\`}function Zc(e,t){return Object.entries(e).sort((e,t)=>t[1]-e[1]).slice(0,t)}function Gc({label:e,children:t}){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-widest font-bold whitespace-nowrap",children:e}),s.jsx("div",{className:"flex items-center gap-1.5 overflow-x-auto pb-1 no-scrollbar",children:t})]})}function Jc({stats:e}){const t=Zc(e.byClient,4),n=Zc(e.byLanguage,4);return 0===t.length&&0===n.length?null:s.jsxs("div",{className:"flex flex-col gap-4 mb-8 p-4 rounded-xl bg-bg-surface-1/30 border border-border/50",children:[t.length>0&&s.jsx(Gc,{label:"Top Clients",children:t.map(([e,t])=>{const n=ic[e];return s.jsxs("span",{className:"text-[11px] font-mono px-2.5 py-1 rounded-full bg-bg-surface-1 border border-border hover:border-accent/40 transition-colors shadow-sm whitespace-nowrap group cursor-default",style:n?{borderLeftWidth:"3px",borderLeftColor:n}:void 0,title:Xc(t),children:[oc[e]??e,s.jsx("span",{className:"ml-1.5 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:Xc(t)})]},e)})}),n.length>0&&s.jsx(Gc,{label:"Languages",children:n.map(([e,t])=>s.jsxs("span",{className:"text-[11px] font-mono px-2.5 py-1 rounded-full bg-bg-surface-1 border border-border hover:border-accent/40 transition-colors shadow-sm whitespace-nowrap group cursor-default",title:Xc(t),children:[e,s.jsx("span",{className:"ml-1.5 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:Xc(t)})]},e))})]})}var eu=[{id:"sessions",label:"Sessions"},{id:"insights",label:"Insights"}];function tu({activeTab:e,onTabChange:t}){return s.jsx("div",{className:"flex gap-0.5 p-0.5 rounded-lg bg-bg-surface-1 border border-border/40",children:eu.map(({id:n,label:r})=>{const a=e===n;return s.jsx("button",{onClick:()=>t(n),className:\`\\n px-3 py-1 rounded-md text-xs font-medium transition-all duration-150\\n \${a?"bg-bg-surface-2 text-text-primary shadow-sm":"text-text-muted hover:text-text-primary"}\\n \`,children:r},n)})})}var nu={coding:"#b4f82c",debugging:"#f87171",testing:"#60a5fa",planning:"#a78bfa",reviewing:"#34d399",documenting:"#fbbf24",learning:"#f472b6",deployment:"#fb923c",devops:"#e879f9",research:"#22d3ee",migration:"#facc15",design:"#c084fc",data:"#2dd4bf",security:"#f43f5e",configuration:"#a3e635",other:"#94a3b8"};function ru(e){if(e<60)return"<1m";const t=Math.round(e/60);if(t<60)return\`\${t}m\`;return\`\${(e/3600).toFixed(1)}h\`}function au({byTaskType:e}){const t=Object.entries(e).filter(([,e])=>e>0).sort((e,t)=>t[1]-e[1]);if(0===t.length)return null;const n=t[0][1];return s.jsxs("div",{className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4 mb-8",children:[s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest mb-4 px-1",children:"Task Types"}),s.jsx("div",{className:"space-y-2.5",children:t.map(([e,t],r)=>{const a=nu[e]??nu.other,i=t/n*100;return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-text-secondary font-medium w-24 text-right shrink-0",children:(o=e,o.charAt(0).toUpperCase()+o.slice(1))}),s.jsx("div",{className:"flex-1 h-5 rounded bg-bg-surface-2/50 overflow-hidden",children:s.jsx(fl.div,{className:"h-full rounded",style:{backgroundColor:a},initial:{width:0},animate:{width:\`\${i}%\`},transition:{duration:.6,delay:.05*r,ease:[.22,1,.36,1]}})}),s.jsx("span",{className:"text-xs text-text-muted font-mono w-12 text-right shrink-0",children:ru(t)})]},e);var o})})]})}var iu={"15m":{visibleDuration:9e5,majorTickInterval:3e5,minorTickInterval:6e4,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"30m":{visibleDuration:18e5,majorTickInterval:6e5,minorTickInterval:12e4,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"1h":{visibleDuration:36e5,majorTickInterval:9e5,minorTickInterval:3e5,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"12h":{visibleDuration:432e5,majorTickInterval:72e5,minorTickInterval:18e5,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"24h":{visibleDuration:864e5,majorTickInterval:144e5,minorTickInterval:36e5,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"7d":{visibleDuration:6048e5,majorTickInterval:864e5,minorTickInterval:216e5,labelFormat:e=>e.toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})},"30d":{visibleDuration:2592e6,majorTickInterval:6048e5,minorTickInterval:864e5,labelFormat:e=>e.toLocaleDateString([],{month:"short",day:"numeric"})}};function ou(e){if(e<60)return\`\${e}s\`;const t=Math.round(e/60);if(t<60)return\`\${t}m\`;const n=Math.floor(t/60),r=t%60;return r>0?\`\${n}h \${r}m\`:\`\${n}h\`}function su({value:e,onChange:t,scale:n,sessions:r=[],milestones:a=[],showPublic:i=!1}){const o=f.useRef(null),[l,c]=f.useState(0);f.useEffect(()=>{if(!o.current)return;const e=new ResizeObserver(e=>{for(const t of e)c(t.contentRect.width)});return e.observe(o.current),c(o.current.getBoundingClientRect().width),()=>e.disconnect()},[]);const u=iu[n],d=l>0?l/u.visibleDuration:0,[h,p]=f.useState(!1),m=f.useRef(0),g=f.useCallback(e=>{p(!0),m.current=e.clientX,e.currentTarget.setPointerCapture(e.pointerId)},[]),y=f.useCallback(n=>{if(!h||0===d)return;const r=n.clientX-m.current;m.current=n.clientX,t(e+-r/d)},[h,d,e,t]),v=f.useCallback(()=>{p(!1)},[]),x=f.useMemo(()=>{if(!l||0===d)return[];const t=e-u.visibleDuration,n=e,r=t-u.majorTickInterval,a=n+u.majorTickInterval,i=[];for(let o=Math.ceil(r/u.majorTickInterval)*u.majorTickInterval;o<=a;o+=u.majorTickInterval)i.push({type:"major",time:o,position:(o-e)*d,label:u.labelFormat(new Date(o))});for(let o=Math.ceil(r/u.minorTickInterval)*u.minorTickInterval;o<=a;o+=u.minorTickInterval)o%u.majorTickInterval!==0&&i.push({type:"minor",time:o,position:(o-e)*d});return i},[e,l,d,u]),b=f.useMemo(()=>r.map(e=>({session:e,start:new Date(e.started_at).getTime(),end:new Date(e.ended_at).getTime()})),[r]),w=f.useMemo(()=>{if(!l||0===d)return[];const t=e-u.visibleDuration,n=e;return b.filter(e=>e.start<=n&&e.end>=t).map(r=>({session:r.session,leftOffset:(Math.max(r.start,t)-e)*d,width:(Math.min(r.end,n)-Math.max(r.start,t))*d}))},[b,e,l,d,u]),k=f.useMemo(()=>a.map(e=>({milestone:e,time:new Date(e.created_at).getTime()})).sort((e,t)=>e.time-t.time),[a]),S=f.useMemo(()=>{if(!l||0===d||!k.length)return[];const t=e-u.visibleDuration,n=e;let r=0,a=k.length;for(;r<a;){const e=r+a>>1;k[e].time<t?r=e+1:a=e}const i=r;for(a=k.length;r<a;){const e=r+a>>1;k[e].time<=n?r=e+1:a=e}const o=r,s=[];for(let l=i;l<o;l++){const t=k[l];s.push({...t,offset:(t.time-e)*d})}return s},[k,e,l,d,u]),[C,j]=f.useState(null),N=f.useRef(e);return f.useEffect(()=>{C&&Math.abs(e-N.current)>1e3&&j(null),N.current=e},[e,C]),s.jsxs("div",{className:"relative h-16",children:[s.jsxs("div",{className:"absolute inset-0 bg-transparent border-t border-border/50 overflow-hidden select-none touch-none cursor-grab active:cursor-grabbing",ref:o,onPointerDown:g,onPointerMove:y,onPointerUp:v,style:{touchAction:"none"},children:[s.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[2px] bg-accent/40 z-30"}),s.jsxs("div",{className:"absolute right-0 top-0 bottom-0 w-0 pointer-events-none",children:[x.map(e=>s.jsx("div",{className:"absolute top-0 border-l "+("major"===e.type?"border-border/60":"border-border/30"),style:{left:e.position,height:"major"===e.type?"100%":"35%",bottom:0},children:"major"===e.type&&e.label&&s.jsx("span",{className:"absolute top-2 left-2 text-[9px] font-bold text-text-muted uppercase tracking-wider whitespace-nowrap bg-bg-surface-1/80 px-1 py-0.5 rounded",children:e.label})},e.time)),w.map(e=>s.jsx("div",{className:"absolute bottom-0 rounded-t-md pointer-events-auto cursor-pointer transition-opacity hover:opacity-80",style:{left:e.leftOffset,width:Math.max(e.width,3),height:"45%",backgroundColor:"rgba(var(--accent-rgb), 0.15)",borderTop:"2px solid rgba(var(--accent-rgb), 0.5)",boxShadow:"inset 0 1px 10px rgba(var(--accent-rgb), 0.05)"},onMouseEnter:t=>{const n=t.currentTarget.getBoundingClientRect();j({type:"session",data:e.session,x:n.left+n.width/2,y:n.top})},onMouseLeave:()=>j(null)},e.session.session_id)),S.map((e,n)=>s.jsx("div",{className:"absolute bottom-2 pointer-events-auto cursor-pointer z-40 transition-transform hover:scale-125",style:{left:e.offset,transform:"translateX(-50%)"},onMouseEnter:t=>{const n=t.currentTarget.getBoundingClientRect();j({type:"milestone",data:e.milestone,x:n.left+n.width/2,y:n.top})},onMouseLeave:()=>j(null),onClick:n=>{n.stopPropagation(),t(e.time)},children:s.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-bg-surface-1 shadow-lg",style:{backgroundColor:uc[e.milestone.category]??"#9c9588",boxShadow:\`0 0 10px \${uc[e.milestone.category]}50\`}})},n))]})]}),C&&hc.createPortal(s.jsx("div",{className:"fixed z-[9999] pointer-events-none",style:{left:C.x,top:C.y,transform:"translate(-50%, -100%)"},children:s.jsxs("div",{className:"mb-3 bg-bg-surface-3/95 backdrop-blur-md text-text-primary rounded-xl shadow-2xl px-3 py-2.5 text-[11px] min-w-[180px] max-w-[280px] border border-border/50 animate-in fade-in zoom-in-95 duration-200",children:["session"===C.type?s.jsx(lu,{session:C.data,showPublic:i}):s.jsx(cu,{milestone:C.data,showPublic:i}),s.jsx("div",{className:"absolute -bottom-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-bg-surface-3/95 border-r border-b border-border/50 rotate-45"})]})}),document.body)]})}function lu({session:e,showPublic:t}){const n=oc[e.client]??e.client,r=t?e.title||e.project||\`\${n} Session\`:e.private_title||e.title||e.project||\`\${n} Session\`;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-bold text-xs text-accent uppercase tracking-widest",children:n}),s.jsx("span",{className:"text-[10px] text-text-muted font-mono",children:ou(e.duration_seconds)})]}),s.jsx("div",{className:"h-px bg-border/50 my-0.5"}),s.jsx("div",{className:"text-text-primary font-medium",children:r}),s.jsx("div",{className:"text-text-secondary capitalize text-[10px]",children:e.task_type})]})}function cu({milestone:e,showPublic:t}){const n=t?e.title:e.private_title??e.title;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-bold text-[10px] uppercase tracking-widest",style:{color:uc[e.category]??"#9c9588"},children:e.category}),e.complexity&&s.jsx("span",{className:"text-[9px] font-mono text-text-muted font-bold border border-border/50 px-1 rounded uppercase",children:e.complexity})]}),s.jsx("div",{className:"h-px bg-border/50 my-0.5"}),s.jsx("div",{className:"font-bold text-xs break-words text-text-primary",children:n}),!t&&e.private_title&&s.jsxs("div",{className:"text-[10px] text-text-muted italic opacity-70",children:["Public: ",e.title]})]})}var uu={"15m":9e5,"30m":18e5,"1h":36e5,"12h":432e5,"24h":864e5,"7d":6048e5,"30d":2592e6},du={"15m":"15 Minutes","30m":"30 Minutes","1h":"1 Hour","12h":"12 Hours","24h":"24 Hours","7d":"7 Days","30d":"30 Days"};function fu(e,t){const n=e.trim();if(!n)return null;const r=new Date(t),a=n.match(/^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?\\s*(AM|PM)$/i);if(a){let e=parseInt(a[1],10);const t=parseInt(a[2],10),n=a[3]?parseInt(a[3],10):0,i=a[4].toUpperCase();return e<1||e>12||t>59||n>59?null:("AM"===i&&12===e&&(e=0),"PM"===i&&12!==e&&(e+=12),r.setHours(e,t,n,0),r.getTime())}const i=n.match(/^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/);if(i){const e=parseInt(i[1],10),t=parseInt(i[2],10),n=i[3]?parseInt(i[3],10):0;return e>23||t>59||n>59?null:(r.setHours(e,t,n,0),r.getTime())}return null}var hu=["15m","30m","1h","12h","24h","7d","30d"];function pu({value:e,onChange:t,scale:n,onScaleChange:r,sessions:a,showPublic:i=!1}){const o=null===e,[l,c]=f.useState(Date.now());f.useEffect(()=>{if(!o)return;const e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[o]);const u=o?l:e,[d,h]=f.useState(!1),[p,m]=f.useState(""),g=f.useRef(null),y=f.useRef(!1),v=f.useRef(""),x=f.useRef(!1),b=f.useRef(0),w=f.useCallback(e=>{const n=Date.now();if(e>=n-2e3)return x.current=!0,b.current=n,void t(null);x.current&&n-b.current<300||x.current&&e>=n-1e4?t(null):(x.current=!1,t(e))},[t]),k=e=>{const n=u+e;n>=Date.now()-6e4?t(null):t(n)},S=()=>{y.current=o,t(u);const e=new Date(u).toLocaleTimeString([],{hour12:!0,hour:"2-digit",minute:"2-digit",second:"2-digit"});v.current=e,m(e),h(!0),requestAnimationFrame(()=>g.current?.select())},C=()=>{if(h(!1),y.current&&p===v.current)return void t(null);const e=fu(p,u);null!==e&&t(Math.min(e,Date.now()))};return s.jsxs("div",{className:"flex flex-col bg-bg-surface-1 border border-border/50 rounded-2xl overflow-hidden mb-8 shadow-xl",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between px-6 py-3 border-b border-border/50 gap-4",children:[s.jsxs("div",{className:"flex flex-col items-start gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 h-8",children:[d?s.jsx("input",{ref:g,type:"text",value:p,onChange:e=>m(e.target.value),onBlur:C,onKeyDown:e=>{if("Enter"===e.key)return void C();if("Escape"===e.key)return e.preventDefault(),h(!1),void(y.current&&t(null));if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const n=g.current;if(!n)return;const r=n.selectionStart??0,a="ArrowUp"===e.key?1:-1,i=fu(p,u);if(null===i)return;const o=p.indexOf(":"),s=p.indexOf(":",o+1),l=p.lastIndexOf(" ");let c;c=r<=o?36e5*a:s>-1&&r<=s?6e4*a:l>-1&&r<=l?1e3*a:12*a*36e5;const d=Math.min(i+c,Date.now()),f=new Date(d).toLocaleTimeString([],{hour12:!0,hour:"2-digit",minute:"2-digit",second:"2-digit"});m(f),t(d),requestAnimationFrame(()=>{n&&n.setSelectionRange(r,r)})},className:"text-xl font-mono font-bold tracking-tight bg-bg-surface-2 border rounded-lg px-2 -ml-2 w-[155px] outline-none text-text-primary "+(o?"border-accent":"border-history"),style:{boxShadow:o?"0 0 10px rgba(var(--accent-rgb), 0.2)":"0 0 10px rgba(var(--history-rgb), 0.2)"}}):s.jsxs("button",{onClick:S,className:"group flex items-center gap-2 hover:bg-bg-surface-2/50 rounded-lg px-2 -ml-2 py-1 transition-all cursor-text",title:"Click to edit time",children:[s.jsx(Tl,{className:"w-5 h-5 "+(o?"text-text-muted":"text-history")}),s.jsx("span",{className:"text-xl font-mono font-bold tracking-tight tabular-nums "+(o?"text-text-primary":"text-history"),children:new Date(u).toLocaleTimeString([],{hour12:!0,hour:"2-digit",minute:"2-digit",second:"2-digit"})})]}),s.jsx("button",{onClick:d?C:S,className:"p-1.5 rounded-lg transition-colors flex-shrink-0 "+(d?o?"bg-accent text-white hover:bg-accent-bright":"bg-history text-white hover:brightness-110":"text-text-muted hover:text-text-primary hover:bg-bg-surface-2"),title:d?"Confirm time":"Edit time",children:s.jsx(Hl,{className:"w-3.5 h-3.5"})})]}),o?s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 text-[10px] font-bold uppercase tracking-widest bg-success/10 text-success rounded-full border border-success/20",style:{boxShadow:"0 0 10px rgba(var(--accent-rgb), 0.1)"},children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),"Live"]}):s.jsx("div",{className:"flex items-center gap-1.5 px-2.5 py-1 text-[10px] font-bold uppercase tracking-widest bg-history/10 text-history rounded-full border border-history/20",children:"History"})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-secondary font-medium px-0.5",children:[s.jsx(bl,{className:"w-3.5 h-3.5 text-text-muted"}),new Date(u).toLocaleDateString([],{weekday:"short",month:"long",day:"numeric",year:"numeric"})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[s.jsx("div",{className:"flex items-center bg-bg-surface-2/50 border border-border/50 rounded-xl p-1 shadow-inner",children:hu.map(e=>s.jsx("button",{onClick:()=>r(e),className:"px-3 py-1.5 text-[10px] font-bold uppercase tracking-wider rounded-lg transition-all "+(n===e?"bg-bg-surface-3 text-text-primary shadow-sm":"text-text-muted hover:text-text-primary hover:bg-bg-surface-2"),title:du[e],children:e},e))}),s.jsxs("div",{className:"flex items-center gap-2",children:[!o&&s.jsxs("button",{onClick:()=>t(null),className:"group flex items-center gap-2 px-4 py-2 text-[10px] font-bold uppercase tracking-widest bg-history/10 hover:bg-history text-history hover:text-white rounded-xl transition-all border border-history/20",children:[s.jsx(Yl,{className:"w-3.5 h-3.5 group-hover:-rotate-90 transition-transform duration-500"}),"Live"]}),s.jsxs("div",{className:"flex items-center gap-1 bg-bg-surface-2/50 border border-border/50 rounded-xl p-1",children:[s.jsx("button",{onClick:()=>k(-uu[n]),className:"p-2 text-text-muted hover:text-text-primary hover:bg-bg-surface-2 rounded-lg transition-colors",title:\`Back \${du[n]}\`,children:s.jsx(Sl,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>k(uu[n]),className:"p-2 text-text-muted hover:text-text-primary hover:bg-bg-surface-2 rounded-lg transition-colors disabled:opacity-20 disabled:cursor-not-allowed",title:\`Forward \${du[n]}\`,disabled:o||u>=Date.now()-1e3,children:s.jsx(Cl,{className:"w-4 h-4"})})]})]})]})]}),s.jsx(su,{value:u,onChange:w,scale:n,sessions:a,milestones:void 0,showPublic:i})]})}const mu=(gu=(e,t)=>({sessions:[],milestones:[],config:null,health:null,updateInfo:null,loading:!0,timeTravelTime:null,timeScale:(()=>{try{const e=localStorage.getItem("useai-time-scale");if(e&&["15m","30m","1h","12h","24h","7d","30d"].includes(e))return e}catch{}return"1h"})(),filters:{category:"all",client:"all",project:"all",language:"all"},activeTab:(()=>{try{const e=localStorage.getItem("useai-active-tab");if("sessions"===e||"insights"===e)return e}catch{}return"sessions"})(),loadAll:async()=>{try{const[t,n,r]=await Promise.all([_("/api/local/sessions"),_("/api/local/milestones"),_("/api/local/config")]);e({sessions:t,milestones:n,config:r,loading:!1})}catch{e({loading:!1})}},loadHealth:async()=>{try{const t=await _("/health");e({health:t})}catch{}},loadUpdateCheck:async()=>{try{const t=await _("/api/local/update-check");e({updateInfo:t})}catch{}},setTimeTravelTime:t=>e({timeTravelTime:t}),setTimeScale:t=>{try{localStorage.setItem("useai-time-scale",t)}catch{}e({timeScale:t})},setFilter:(t,n)=>e(e=>({filters:{...e.filters,[t]:n}})),setActiveTab:t=>{try{localStorage.setItem("useai-active-tab",t)}catch{}e({activeTab:t})},deleteSession:async n=>{const r={sessions:t().sessions,milestones:t().milestones};e({sessions:r.sessions.filter(e=>e.session_id!==n),milestones:r.milestones.filter(e=>e.session_id!==n)});try{await function(e){return R(\`/api/local/sessions/\${encodeURIComponent(e)}\`)}(n)}catch{e(r)}},deleteConversation:async n=>{const r={sessions:t().sessions,milestones:t().milestones},a=new Set(r.sessions.filter(e=>e.conversation_id===n).map(e=>e.session_id));e({sessions:r.sessions.filter(e=>e.conversation_id!==n),milestones:r.milestones.filter(e=>!a.has(e.session_id))});try{await function(e){return R(\`/api/local/conversations/\${encodeURIComponent(e)}\`)}(n)}catch{e(r)}},deleteMilestone:async n=>{const r={milestones:t().milestones};e({milestones:r.milestones.filter(e=>e.id!==n)});try{await function(e){return R(\`/api/local/milestones/\${encodeURIComponent(e)}\`)}(n)}catch{e(r)}}}))?A(gu):A;var gu;function yu(e){if(0===e.length)return 0;const t=new Set;for(const o of e)t.add(o.started_at.slice(0,10));const n=[...t].sort().reverse();if(0===n.length)return 0;const r=(new Date).toISOString().slice(0,10),a=new Date(Date.now()-864e5).toISOString().slice(0,10);if(n[0]!==r&&n[0]!==a)return 0;let i=1;for(let o=1;o<n.length;o++){const e=new Date(n[o-1]),t=new Date(n[o]);if(1!==(e.getTime()-t.getTime())/864e5)break;i++}return i}function vu({className:e}){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 611.54 143.47",className:e,children:[s.jsxs("g",{fill:"var(--text-primary)",children:[s.jsx("path",{d:"M21.4,121.85c-4.57-4.57-6.85-10.02-6.85-16.37V17.23c0-3.1,1.55-4.65,4.64-4.65h25.55c3.1,0,4.65,1.55,4.65,4.65v76.64c0,3.25,1.12,6,3.37,8.25,2.24,2.25,4.99,3.37,8.25,3.37h27.87c3.25,0,6-1.12,8.25-3.37,2.24-2.24,3.37-4.99,3.37-8.25V17.23c0-3.1,1.55-4.65,4.64-4.65h25.55c3.1,0,4.65,1.55,4.65,4.65v88.25c0,6.35-2.29,11.81-6.85,16.37-4.57,4.57-10.03,6.85-16.37,6.85H37.78c-6.35,0-11.81-2.28-16.37-6.85Z"}),s.jsx("path",{d:"M146.93,124.06v-13.93c0-3.1,1.55-4.65,4.64-4.65h69.67c3.25,0,6-1.12,8.25-3.37,2.24-2.24,3.37-4.99,3.37-8.25s-1.12-6-3.37-8.25c-2.25-2.24-4.99-3.37-8.25-3.37h-51.09c-6.35,0-11.81-2.28-16.37-6.85-4.57-4.57-6.85-10.02-6.85-16.37v-23.22c0-6.35,2.28-11.81,6.85-16.37,4.56-4.57,10.02-6.85,16.37-6.85h92.9c3.1,0,4.65,1.55,4.65,4.65v13.94c0,3.1-1.55,4.65-4.65,4.65h-69.67c-3.25,0-6,1.12-8.25,3.37-2.25,2.25-3.37,4.99-3.37,8.25s1.12,6,3.37,8.25c2.24,2.25,4.99,3.37,8.25,3.37h51.09c6.35,0,11.8,2.29,16.37,6.85,4.57,4.57,6.85,10.03,6.85,16.37v23.22c0,6.35-2.29,11.81-6.85,16.37-4.57,4.57-10.03,6.85-16.37,6.85h-92.9c-3.1,0-4.64-1.55-4.64-4.65Z"}),s.jsx("path",{d:"M286.16,121.85c-4.57-4.57-6.85-10.02-6.85-16.37V35.81c0-6.35,2.28-11.81,6.85-16.37,4.56-4.57,10.02-6.85,16.37-6.85h74.32c6.35,0,11.8,2.29,16.37,6.85,4.57,4.57,6.85,10.03,6.85,16.37v23.22c0,6.35-2.29,11.81-6.85,16.37-4.57,4.57-10.03,6.85-16.37,6.85h-62.71v11.61c0,3.25,1.12,6,3.37,8.25,2.24,2.25,4.99,3.37,8.25,3.37h69.67c3.1,0,4.65,1.55,4.65,4.65v13.93c0,3.1-1.55,4.65-4.65,4.65h-92.9c-6.35,0-11.81-2.28-16.37-6.85ZM361.87,55.66c2.24-2.24,3.37-4.99,3.37-8.25s-1.12-6-3.37-8.25c-2.25-2.24-4.99-3.37-8.25-3.37h-27.87c-3.25,0-6,1.12-8.25,3.37-2.25,2.25-3.37,4.99-3.37,8.25v11.61h39.48c3.25,0,6-1.12,8.25-3.37Z"})]}),s.jsxs("g",{fill:"var(--accent)",children:[s.jsx("path",{d:"M432.08,126.44c-4.76-4.76-7.14-10.44-7.14-17.06v-24.2c0-6.61,2.38-12.3,7.14-17.06,4.76-4.76,10.44-7.14,17.06-7.14h65.34v-12.1c0-3.39-1.17-6.25-3.51-8.59-2.34-2.34-5.2-3.51-8.59-3.51h-72.6c-3.23,0-4.84-1.61-4.84-4.84v-14.52c0-3.23,1.61-4.84,4.84-4.84h96.8c6.61,0,12.3,2.38,17.06,7.14,4.76,4.76,7.14,10.45,7.14,17.06v72.6c0,6.62-2.38,12.3-7.14,17.06-4.76,4.76-10.45,7.14-17.06,7.14h-77.44c-6.62,0-12.3-2.38-17.06-7.14ZM510.97,105.87c2.34-2.34,3.51-5.2,3.51-8.59v-12.1h-41.14c-3.39,0-6.25,1.17-8.59,3.51-2.34,2.34-3.51,5.2-3.51,8.59s1.17,6.25,3.51,8.59c2.34,2.34,5.2,3.51,8.59,3.51h29.04c3.39,0,6.25-1.17,8.59-3.51Z"}),s.jsx("path",{d:"M562.87,128.74V17.42c0-3.23,1.61-4.84,4.84-4.84h26.62c3.23,0,4.84,1.61,4.84,4.84v111.32c0,3.23-1.61,4.84-4.84,4.84h-26.62c-3.23,0-4.84-1.61-4.84-4.84Z"})]})]})}const xu="npx -y @devness/useai@latest update";function bu({updateInfo:e}){const[t,n]=f.useState(!1),[r,a]=f.useState(!1);return s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>n(e=>!e),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-accent/10 border border-accent/20 text-xs font-medium text-accent hover:bg-accent/15 transition-colors",children:[s.jsx(Nl,{className:"w-3 h-3"}),"v",e.latest," available"]}),t&&s.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-72 rounded-lg bg-bg-surface-1 border border-border shadow-lg p-3 space-y-2",children:[s.jsxs("p",{className:"text-xs text-text-muted",children:["Update from ",s.jsxs("span",{className:"font-mono text-text-secondary",children:["v",e.current]})," to ",s.jsxs("span",{className:"font-mono text-accent",children:["v",e.latest]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"flex-1 text-[11px] font-mono bg-bg-base px-2 py-1.5 rounded border border-border text-text-secondary truncate",children:xu}),s.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(xu),a(!0),setTimeout(()=>a(!1),2e3)}catch{}},className:"p-1.5 rounded-md border border-border bg-bg-base text-text-muted hover:text-text-primary hover:border-text-muted/50 transition-colors shrink-0",title:"Copy command",children:r?s.jsx(wl,{className:"w-3.5 h-3.5 text-success"}):s.jsx(Pl,{className:"w-3.5 h-3.5"})})]})]})]})}function wu({health:e,updateInfo:t,timeContextLabel:n,activeTab:r,onTabChange:a,onSearchOpen:i}){return s.jsx("header",{className:"sticky top-0 z-50 bg-bg-base/80 backdrop-blur-md border-b border-border mb-4",children:s.jsxs("div",{className:"max-w-[1000px] mx-auto px-6 py-3 flex items-center justify-between relative",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx(vu,{className:"h-6"})}),s.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:s.jsx(tu,{activeTab:r,onTabChange:a})}),s.jsxs("div",{className:"flex items-center gap-4",children:[i&&s.jsxs("button",{onClick:i,className:"flex items-center gap-2 px-2.5 py-1.5 rounded-md border border-border/50 bg-bg-surface-1 text-text-muted hover:text-text-primary hover:border-text-muted/50 transition-colors text-xs",children:[s.jsx(Ql,{className:"w-3 h-3"}),s.jsx("span",{className:"hidden sm:inline",children:"Search"}),s.jsx("kbd",{className:"hidden sm:inline-flex items-center px-1 py-0.5 rounded border border-border bg-bg-base text-[9px] font-mono leading-none",children:"\u2318K"})]}),t?.update_available&&s.jsx(bu,{updateInfo:t}),e&&e.active_sessions>0&&s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-success/10 border border-success/20",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-success animate-ping absolute inset-0"}),s.jsx("div",{className:"w-2 h-2 rounded-full bg-success relative"})]}),s.jsxs("span",{className:"text-xs font-medium text-success",children:[e.active_sessions," active session",1!==e.active_sessions?"s":""]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted font-mono bg-bg-surface-1 px-3 py-1.5 rounded-md border border-border",children:[s.jsx(yl,{className:"w-3 h-3"}),n]})]})]})})}const ku={category:"all",client:"all",project:"all",language:"all"};function Su({open:e,onClose:t,sessions:n,milestones:r,deleteSession:a,deleteConversation:i,deleteMilestone:o}){const[l,c]=f.useState(""),[u,d]=f.useState(""),[h,p]=f.useState(!1),m=f.useRef(null);f.useEffect(()=>{e&&(c(""),d(""),requestAnimationFrame(()=>m.current?.focus()))},[e]),f.useEffect(()=>{if(!e)return;const t=document.documentElement;return t.style.overflow="hidden",document.body.style.overflow="hidden",()=>{t.style.overflow="",document.body.style.overflow=""}},[e]),f.useEffect(()=>{if(!e)return;const n=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t]),f.useEffect(()=>{const e=setTimeout(()=>d(l),250);return()=>clearTimeout(e)},[l]);const g=f.useMemo(()=>{const e=new Map;for(const t of r){const n=e.get(t.session_id);n?n.push(t):e.set(t.session_id,[t])}return e},[r]),{filteredSessions:y,filteredMilestones:v,highlightWords:x}=f.useMemo(()=>{const e=u.trim().toLowerCase();if(!e)return{filteredSessions:[],filteredMilestones:[],highlightWords:[]};const t=e.split(/\\s+/),a=n.filter(e=>function(e,t,n,r){const a=(r?[e.title,e.client,e.task_type,...e.languages,...t.map(e=>e.title)]:[e.private_title,e.title,e.client,e.task_type,...e.languages,...t.map(e=>e.private_title),...t.map(e=>e.title)]).filter(Boolean).join(" ").toLowerCase();return n.every(e=>a.includes(e))}(e,g.get(e.session_id)??[],t,h)),i=new Set(a.map(e=>e.session_id));return{filteredSessions:a,filteredMilestones:r.filter(e=>i.has(e.session_id)),highlightWords:t}},[n,r,g,u,h]),b=u.trim().length>0;return s.jsx(Ko,{children:e&&s.jsxs(s.Fragment,{children:[s.jsx(fl.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-[60]",onClick:t}),s.jsx(fl.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15},className:"fixed inset-0 z-[61] flex items-start justify-center pt-[10vh] px-4 pointer-events-none",children:s.jsxs("div",{className:"w-full max-w-2xl bg-bg-base border border-border/50 rounded-xl shadow-2xl flex flex-col max-h-[75vh] pointer-events-auto",onClick:e=>e.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/50",children:[s.jsx(Ql,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),s.jsx("input",{ref:m,type:"text",value:l,onChange:e=>c(e.target.value),placeholder:h?"Search public titles...":"Search all sessions and milestones...",className:"flex-1 bg-transparent text-sm text-text-primary placeholder:text-text-muted/50 outline-none"}),l&&s.jsx("button",{onClick:()=>{c(""),m.current?.focus()},className:"p-1 rounded-md hover:bg-bg-surface-2 text-text-muted hover:text-text-primary transition-colors",children:s.jsx(rc,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>p(e=>!e),className:"p-1.5 rounded-md border transition-all duration-200 flex-shrink-0 "+(h?"bg-success/10 border-success/30 text-success":"bg-bg-surface-1 border-border/50 text-text-muted hover:text-text-primary hover:border-text-muted/50"),title:h?"Searching public titles":"Searching private titles",children:h?s.jsx(Dl,{className:"w-3.5 h-3.5"}):s.jsx(Ll,{className:"w-3.5 h-3.5"})}),s.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded border border-border bg-bg-surface-1 text-[10px] font-mono text-text-muted",children:"esc"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto overscroll-none px-4 py-3",children:b?0===y.length?s.jsxs("div",{className:"text-center py-12 text-sm text-text-muted/60",children:["No results for \u201C",u.trim(),"\u201D"]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-[10px] font-mono text-text-muted uppercase tracking-wider mb-3 px-1",children:[y.length," result",1!==y.length?"s":""]}),s.jsx(Oc,{sessions:y,milestones:v,filters:ku,globalShowPublic:h||void 0,showFullDate:!0,highlightWords:x,onDeleteSession:a,onDeleteConversation:i,onDeleteMilestone:o})]}):s.jsx("div",{className:"text-center py-12 text-sm text-text-muted/60",children:"Type to search across all sessions"})})]})})]})})}function Cu(e){if(!e)return"Never synced";const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"Just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);if(r<24)return\`\${r}h ago\`;return\`\${Math.floor(r/24)}d ago\`}function ju({config:e,onRefresh:t}){const[n,r]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState("email"),[c,u]=f.useState(!1),[d,h]=f.useState(null),p=f.useCallback(async()=>{if(n.includes("@")){u(!0),h(null);try{await function(e){return z("/api/local/auth/send-otp",{email:e})}(n),l("otp")}catch(e){h(e.message)}finally{u(!1)}}},[n]),m=f.useCallback(async()=>{if(/^\\d{6}$/.test(a)){u(!0),h(null);try{await function(e,t){return z("/api/local/auth/verify-otp",{email:e,code:t})}(n,a),t()}catch(e){h(e.message)}finally{u(!1)}}},[n,a,t]);if(!e)return null;if(e.authenticated){const n=async()=>{u(!0),h(null);try{const e=await z("/api/local/sync");e.success?(h("Synced!"),t(),setTimeout(()=>h(null),3e3)):h(e.error??"Sync failed")}catch(e){h(e.message)}finally{u(!1)}};return s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 p-4 mt-12 bg-bg-surface-1/50 rounded-2xl border border-border/50 backdrop-blur-sm",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-accent/10 flex items-center justify-center border border-accent/20",children:s.jsx(tc,{className:"w-4 h-4 text-accent"})}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-xs font-bold text-text-primary",children:e.email}),s.jsxs("span",{className:"text-[10px] text-text-muted font-mono uppercase tracking-tighter",children:["Last sync: ",Cu(e.last_sync_at)]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[d&&s.jsx("span",{className:\`text-[10px] font-bold uppercase tracking-widest \${"Synced!"===d?"text-success":"text-error"} mr-2\`,children:d}),s.jsxs("button",{onClick:n,disabled:c,className:"group flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent-bright text-white text-xs font-bold rounded-lg transition-all duration-300 shadow-lg shadow-accent/20 disabled:opacity-50 cursor-pointer overflow-hidden relative",children:[s.jsx(Wl,{className:"w-3.5 h-3.5 "+(c?"animate-spin":"group-hover:rotate-180 transition-transform duration-500")}),c?"Syncing...":"Sync Now"]}),s.jsx("button",{onClick:async()=>{await z("/api/local/auth/logout"),t()},title:"Sign out",className:"flex items-center justify-center w-9 h-9 rounded-lg border border-border/50 hover:border-error/50 hover:bg-error/10 text-text-muted hover:text-error transition-all duration-200 cursor-pointer",children:s.jsx($l,{className:"w-3.5 h-3.5"})})]})]})}return s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 p-4 mt-12 bg-bg-surface-1/50 rounded-2xl border border-border/50 backdrop-blur-sm",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-bg-surface-2 flex items-center justify-center border border-border",children:s.jsx(Kl,{className:"w-4 h-4 text-text-muted"})}),s.jsx("span",{className:"text-xs font-bold text-text-secondary uppercase tracking-widest",children:"Sign in to sync"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[d&&s.jsx("span",{className:"text-[10px] font-bold text-error uppercase tracking-widest mr-2",children:d}),"email"===o?s.jsxs("div",{className:"flex items-center bg-bg-base border border-border rounded-lg overflow-hidden focus-within:border-accent/50 focus-within:ring-1 focus-within:ring-accent/50 transition-all",children:[s.jsx("div",{className:"pl-3 py-2",children:s.jsx(Bl,{className:"w-3.5 h-3.5 text-text-muted"})}),s.jsx("input",{type:"email",placeholder:"you@email.com",value:n,onChange:e=>r(e.target.value),onKeyDown:e=>"Enter"===e.key&&p(),className:"px-3 py-2 text-xs bg-transparent text-text-primary outline-none w-40 placeholder:text-text-muted/50"}),s.jsx("button",{onClick:p,disabled:c||!n.includes("@"),className:"px-4 py-2 bg-bg-surface-2 hover:bg-bg-surface-3 text-text-primary text-[10px] font-bold uppercase tracking-wider transition-colors disabled:opacity-50 cursor-pointer border-l border-border",children:c?"...":"Send"})]}):s.jsxs("div",{className:"flex items-center bg-bg-base border border-border rounded-lg overflow-hidden focus-within:border-accent/50 focus-within:ring-1 focus-within:ring-accent/50 transition-all",children:[s.jsx("input",{type:"text",maxLength:6,placeholder:"000000",inputMode:"numeric",autoComplete:"one-time-code",value:a,onChange:e=>i(e.target.value),onKeyDown:e=>"Enter"===e.key&&m(),autoFocus:!0,className:"px-4 py-2 text-xs bg-transparent text-text-primary text-center font-mono tracking-widest outline-none w-32 placeholder:text-text-muted/50"}),s.jsx("button",{onClick:m,disabled:c||6!==a.length,className:"px-4 py-2 bg-accent hover:bg-accent-bright text-white text-[10px] font-bold uppercase tracking-wider transition-colors disabled:opacity-50 cursor-pointer",children:c?"...":"Verify"})]})]})]})}function Nu({evaluation:e}){const t=function(e){const t=[];return e.prompt_quality<4&&t.push({metric:"Prompt Quality",score:e.prompt_quality,priority:.3*(4-e.prompt_quality),message:e.prompt_quality<3?\`Your prompt_quality score averages \${e.prompt_quality.toFixed(1)}. Try including acceptance criteria and specific expected behavior in your prompts.\`:\`Your prompt_quality score averages \${e.prompt_quality.toFixed(1)}. Adding edge cases and constraints to your prompts could push this higher.\`}),e.context_provided<4&&t.push({metric:"Context",score:e.context_provided,priority:.25*(4-e.context_provided),message:e.context_provided<3?\`Try providing more file context -- your context_provided score averages \${e.context_provided.toFixed(1)}. Share relevant files, error logs, and constraints upfront.\`:\`Your context_provided score averages \${e.context_provided.toFixed(1)}. Including related config files or architecture notes could help.\`}),e.scope_quality<4&&t.push({metric:"Scope",score:e.scope_quality,priority:.2*(4-e.scope_quality),message:e.scope_quality<3?\`Your scope_quality averages \${e.scope_quality.toFixed(1)}. Try breaking large tasks into focused, well-defined subtasks before starting.\`:\`Your scope_quality averages \${e.scope_quality.toFixed(1)}. Defining clear boundaries for what is in and out of scope could improve efficiency.\`}),e.independence_level<4&&t.push({metric:"Independence",score:e.independence_level,priority:.25*(4-e.independence_level),message:e.independence_level<3?\`Your independence_level averages \${e.independence_level.toFixed(1)}. Providing a clear spec with decisions made upfront can reduce back-and-forth.\`:\`Your independence_level averages \${e.independence_level.toFixed(1)}. Pre-deciding ambiguous choices in your prompt can help the AI execute autonomously.\`}),t.sort((e,t)=>t.priority-e.priority),t.slice(0,3)}(e);return 0===t.length?s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-success/10",children:s.jsx(Ol,{className:"w-3.5 h-3.5 text-success"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Tips"})]}),s.jsx("p",{className:"text-xs text-success",children:"All evaluation scores are 4+ -- great work! Keep it up."})]}):s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-bg-surface-2",children:s.jsx(Ol,{className:"w-3.5 h-3.5 text-accent"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Improvement Tips"})]}),s.jsx("ul",{className:"space-y-3",children:t.map((e,t)=>{return s.jsxs(fl.li,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.25+.08*t},className:"flex gap-3",children:[s.jsxs("div",{className:"flex flex-col items-center shrink-0 mt-0.5",children:[s.jsx("span",{className:"text-xs font-mono font-bold "+(n=e.score,n>=4?"text-success":n>=3?"text-accent":"text-warning"),children:e.score.toFixed(1)}),s.jsx("span",{className:"text-[8px] text-text-muted font-mono uppercase",children:"/5"})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-[10px] font-mono text-text-muted uppercase tracking-wider",children:e.metric}),s.jsx("p",{className:"text-xs text-text-secondary leading-relaxed mt-0.5",children:e.message})]})]},e.metric);var n})})]})}const Tu=[{key:"simple",label:"Simple",color:"#34d399"},{key:"medium",label:"Medium",color:"#fbbf24"},{key:"complex",label:"Complex",color:"#f87171"}];function Eu({data:e}){const t=e.simple+e.medium+e.complex;if(0===t)return null;const n=Math.max(e.simple,e.medium,e.complex);return s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.15},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-bg-surface-2",children:s.jsx(Fl,{className:"w-3.5 h-3.5 text-text-muted"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Complexity"})]}),s.jsx("div",{className:"space-y-3",children:Tu.map((r,a)=>{const i=e[r.key],o=n>0?i/n*100:0,l=t>0?(i/t*100).toFixed(0):"0";return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-text-secondary font-medium w-16 text-right shrink-0",children:r.label}),s.jsx("div",{className:"flex-1 h-5 rounded bg-bg-surface-2/50 overflow-hidden",children:s.jsx(fl.div,{className:"h-full rounded",style:{backgroundColor:r.color},initial:{width:0},animate:{width:\`\${o}%\`},transition:{duration:.6,delay:.08*a,ease:[.22,1,.36,1]}})}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("span",{className:"text-xs text-text-primary font-mono font-bold w-6 text-right",children:i}),s.jsxs("span",{className:"text-[10px] text-text-muted/70 font-mono w-8 text-right",children:[l,"%"]})]})]},r.key)})}),s.jsx("div",{className:"mt-4 flex h-2 rounded-full overflow-hidden bg-bg-surface-2/30",children:Tu.map(n=>{const r=e[n.key],a=t>0?r/t*100:0;return 0===a?null:s.jsx(fl.div,{className:"h-full",style:{backgroundColor:n.color},initial:{width:0},animate:{width:\`\${a}%\`},transition:{duration:.8,ease:[.22,1,.36,1]}},n.key)})})]})}function Pu({filteredSessions:e,filteredMilestones:t,filters:n,onFilterChange:r,onDeleteSession:a,onDeleteConversation:i,onDeleteMilestone:o,globalShowPublic:l,onToggleShowPublic:c,showFullDate:u,outsideWindowCounts:d,onNavigateNewer:h,onNavigateOlder:p}){const[m,g]=f.useState(!1),y="all"!==n.client||"all"!==n.language||"all"!==n.project;return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Activity Feed"}),s.jsxs("span",{className:"text-[10px] text-text-muted font-mono bg-bg-surface-2 px-2 py-0.5 rounded",children:[e.length," Sessions"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:c,className:"p-1.5 rounded-md border transition-all duration-200 "+(l?"bg-success/10 border-success/30 text-success":"bg-bg-surface-1 border-border/50 text-text-muted hover:text-text-primary hover:border-text-muted/50"),title:l?"Showing public titles":"Showing private titles",children:l?s.jsx(Dl,{className:"w-3.5 h-3.5"}):s.jsx(Ll,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>g(e=>!e),className:"p-1.5 rounded-md border transition-all duration-200 "+(m||y?"bg-accent/10 border-accent/30 text-accent":"bg-bg-surface-1 border-border/50 text-text-muted hover:text-text-primary hover:border-text-muted/50"),children:s.jsx(zl,{className:"w-3.5 h-3.5"})})]})]}),m&&s.jsx(Cc,{sessions:e,filters:n,onFilterChange:r}),s.jsx(Oc,{sessions:e,milestones:t,filters:n,globalShowPublic:l,showFullDate:u,outsideWindowCounts:d,onNavigateNewer:h,onNavigateOlder:p,onDeleteSession:a,onDeleteConversation:i,onDeleteMilestone:o})]})}function Mu(){const{sessions:e,milestones:t,config:n,health:r,updateInfo:a,loading:i,timeTravelTime:o,timeScale:l,filters:c,activeTab:u,loadAll:d,loadHealth:h,loadUpdateCheck:p,setTimeTravelTime:m,setTimeScale:g,setFilter:y,setActiveTab:v,deleteSession:x,deleteConversation:b,deleteMilestone:w}=mu();f.useEffect(()=>{d(),h(),p()},[d,h,p]),f.useEffect(()=>{const e=setInterval(h,3e4);if(null!==o)return()=>clearInterval(e);const t=setInterval(d,3e4);return()=>{clearInterval(e),clearInterval(t)}},[o,d,h]);const[k,S]=f.useState(null),[C,j]=f.useState(!1),[N,T]=f.useState(!1);f.useEffect(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),T(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);const E=null===o,P=o??Date.now(),M=P-uu[l],L=P,D=f.useMemo(()=>function(e,t,n){return e.filter(e=>{const r=new Date(e.started_at).getTime(),a=new Date(e.ended_at).getTime();return r<=n&&a>=t})}(e,M,L),[e,M,L]),A=f.useMemo(()=>function(e,t,n){return e.filter(e=>{const r=new Date(e.created_at).getTime();return r>=t&&r<=n})}(t,M,L),[t,M,L]),_=f.useMemo(()=>{if(E)return;const t=function(e,t,n){let r=0,a=0;for(const i of e){const e=new Date(i.ended_at).getTime(),o=new Date(i.started_at).getTime();e<t?r++:o>n&&a++}return{before:r,after:a}}(e,M,L),n=uu[l],r=du[l],a=e=>new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}),i=n>=864e5?e=>\`\${new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})} \${a(e)}\`:a,o=L+n,s=M-n;return{...t,newerLabel:\`View next \${r} \xB7 \${i(L)} \u2013 \${i(o)}\`,olderLabel:\`View prev \${r} \xB7 \${i(s)} \u2013 \${i(M)}\`}},[e,M,L,E,l]),z=f.useCallback(()=>{const e=P+uu[l];e>=Date.now()-6e4?m(null):m(e)},[P,l,m]),R=f.useCallback(()=>{m(P-uu[l])},[P,l,m]),V=f.useMemo(()=>function(e,t=[]){let n=0,r=0;const a={},i={},o={},s={};for(const c of e){n+=c.duration_seconds,r+=c.files_touched,a[c.client]=(a[c.client]??0)+c.duration_seconds;for(const e of c.languages)i[e]=(i[e]??0)+c.duration_seconds;o[c.task_type]=(o[c.task_type]??0)+c.duration_seconds,c.project&&(s[c.project]=(s[c.project]??0)+c.duration_seconds)}const l=function(e){let t=0,n=0,r=0;for(const a of e)"feature"===a.category&&t++,"bugfix"===a.category&&n++,"complex"===a.complexity&&r++;return{featuresShipped:t,bugsFixed:n,complexSolved:r}}(t);return{totalHours:n/3600,totalSessions:e.length,currentStreak:yu(e),filesTouched:r,...l,byClient:a,byLanguage:i,byTaskType:o,byProject:s}}(D,A),[D,A]),F=f.useMemo(()=>yu(e),[e]),O=f.useMemo(()=>function(e,t,n){if(n)return"Live";const r=new Date((e+t)/2),a=new Date,i=new Date(Date.now()-864e5);return r.toDateString()===a.toDateString()?"Today":r.toDateString()===i.toDateString()?"Yesterday":r.toLocaleDateString([],{month:"short",day:"numeric"})}(M,L,E),[M,L,E]),I=f.useMemo(()=>{if(!E)return new Date(P).toISOString().slice(0,10)},[E,P]),$=f.useMemo(()=>{const e=D.filter(e=>null!=e.evaluation);if(0===e.length)return null;let t=0,n=0,r=0,a=0;for(const o of e){const e=o.evaluation;t+=e.prompt_quality,n+=e.context_provided,r+=e.scope_quality,a+=e.independence_level}const i=e.length;return{prompt_quality:Math.round(t/i*10)/10,context_provided:Math.round(n/i*10)/10,scope_quality:Math.round(r/i*10)/10,independence_level:Math.round(a/i*10)/10}},[D]),B=f.useMemo(()=>{let e=0,t=0,n=0;for(const r of A)"simple"===r.complexity?e++:"medium"===r.complexity?t++:"complex"===r.complexity&&n++;return{simple:e,medium:t,complex:n}},[A]);return i?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"text-text-muted text-sm",children:"Loading..."})}):s.jsxs("div",{className:"min-h-screen bg-bg-base selection:bg-accent/30 selection:text-text-primary",children:[s.jsx(wu,{health:r,updateInfo:a,timeContextLabel:O,activeTab:u,onTabChange:v,onSearchOpen:()=>T(!0)}),s.jsxs("div",{className:"max-w-[1000px] mx-auto px-6 pb-6",children:[s.jsx(Su,{open:N,onClose:()=>T(!1),sessions:e,milestones:t,deleteSession:x,deleteConversation:b,deleteMilestone:w}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(pu,{value:o,onChange:m,scale:l,onScaleChange:g,sessions:e,milestones:t,showPublic:C}),s.jsx(Kc,{totalHours:V.totalHours,totalSessions:V.totalSessions,currentStreak:F,filesTouched:V.filesTouched,featuresShipped:V.featuresShipped,bugsFixed:V.bugsFixed,complexSolved:V.complexSolved,selectedCard:k,onCardClick:S}),s.jsx(Yc,{type:k,milestones:A,showPublic:C,onClose:()=>S(null)}),"sessions"===u&&s.jsx(Pu,{filteredSessions:D,filteredMilestones:A,filters:c,onFilterChange:y,onDeleteSession:x,onDeleteConversation:b,onDeleteMilestone:w,globalShowPublic:C,onToggleShowPublic:()=>j(e=>!e),showFullDate:"7d"===l||"30d"===l,outsideWindowCounts:_,onNavigateNewer:z,onNavigateOlder:R}),"insights"===u&&s.jsxs("div",{className:"space-y-4 pt-2",children:[s.jsx(bc,{sessions:D,milestones:A,isLive:E,windowStart:M,windowEnd:L,allSessions:e,allMilestones:t}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(kc,{sessions:D}),s.jsx(Uc,{sessions:D,milestones:A,streak:F})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Eu,{data:B}),$&&s.jsx(Nu,{evaluation:$})]}),s.jsx(au,{byTaskType:V.byTaskType}),s.jsx(mc,{sessions:e,timeScale:l,effectiveTime:P,isLive:E,onDayClick:e=>{const t=new Date(\`\${e}T23:59:59\`).getTime();m(t),g("24h")},highlightDate:I}),s.jsx(Ec,{milestones:A,showPublic:C}),s.jsx(Jc,{stats:V})]}),s.jsx(ju,{config:n,onRefresh:d})]})]})]})}M.createRoot(document.getElementById("root")).render(s.jsx(f.StrictMode,{children:s.jsx(Mu,{})}));</script>
|
|
35057
|
+
*/function fc(e){if(ic[e])return e;return dc.filter(t=>e.startsWith(t)).sort((e,t)=>t.length-e.length)[0]??e}var hc=E();function pc(e){const t=e.filter(e=>e.session.evaluation);if(0===t.length)return null;let n=0,r=0,a=0,i=0,o=0,s=0;const l={};for(const u of t){const e=u.session.evaluation;n+=e.prompt_quality,r+=e.context_provided,a+=e.independence_level,i+=e.scope_quality,o+=e.tools_leveraged,s+=e.iteration_count,l[e.task_outcome]=(l[e.task_outcome]??0)+1}const c=t.length;return{prompt_quality:Math.round(n/c*10)/10,context_provided:Math.round(r/c*10)/10,independence_level:Math.round(a/c*10)/10,scope_quality:Math.round(i/c*10)/10,tools_leveraged:Math.round(o/c),total_iterations:s,outcomes:l,session_count:c}}function mc({sessions:e,timeScale:t,effectiveTime:n,isLive:r,onDayClick:a,highlightDate:i}){const o="24h"===t||"12h"===t,l=new Date(n).toISOString().slice(0,10),c=f.useMemo(()=>o?function(e,t){const n=new Date(\`\${t}T00:00:00\`).getTime(),r=n+864e5,a=[];for(let i=0;i<24;i++)a.push({hour:i,minutes:0});for(const i of e){const e=new Date(i.started_at).getTime(),t=new Date(i.ended_at).getTime();if(t<n||e>r)continue;const o=Math.max(e,n),s=Math.min(t,r);for(let r=0;r<24;r++){const e=n+36e5*r,t=e+36e5,i=Math.max(o,e),l=Math.min(s,t);l>i&&(a[r].minutes+=(l-i)/6e4)}}return a}(e,l):[],[e,l,o]),u=f.useMemo(()=>o?[]:function(e,t){const n=new Date,r=[];for(let a=t-1;a>=0;a--){const t=new Date(n);t.setDate(t.getDate()-a);const i=t.toISOString().slice(0,10);let o=0;for(const n of e)n.started_at.slice(0,10)===i&&(o+=n.duration_seconds);r.push({date:i,hours:o/3600})}return r}(e,7),[e,o]),d=o?\`Hourly \u2014 \${new Date(n).toLocaleDateString([],{month:"short",day:"numeric"})}\`:"Last 7 Days";if(o){const e=Math.max(...c.map(e=>e.minutes),1);return s.jsxs("div",{className:"mb-8 p-5 rounded-2xl bg-bg-surface-1/50 border border-border/50",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4 px-1",children:[s.jsx("div",{className:"text-xs text-text-muted uppercase tracking-widest font-bold",children:d}),s.jsxs("div",{className:"text-[10px] text-text-muted font-mono bg-bg-surface-2 px-2 py-0.5 rounded",children:[e.toFixed(0),"m peak"]})]}),s.jsx("div",{className:"flex items-end gap-[3px] h-16",children:c.map((t,n)=>{const r=e>0?t.minutes/e*100:0;return s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-end h-full group relative",children:[s.jsx("div",{className:"absolute -top-10 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-20 pointer-events-none",children:s.jsxs("div",{className:"bg-bg-surface-3 text-text-primary text-[10px] font-mono px-2 py-1.5 rounded-lg shadow-xl whitespace-nowrap border border-border flex flex-col items-center",children:[s.jsxs("span",{className:"font-bold",children:[t.hour,":00"]}),s.jsxs("span",{className:"text-accent",children:[t.minutes.toFixed(0),"m active"]}),s.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 w-2 h-2 bg-bg-surface-3 border-r border-b border-border rotate-45"})]})}),s.jsx(fl.div,{initial:{height:0},animate:{height:\`\${Math.max(r,t.minutes>0?8:0)}%\`},transition:{delay:.01*n,duration:.5},className:"w-full rounded-t-sm transition-all duration-300 group-hover:bg-accent relative overflow-hidden",style:{minHeight:t.minutes>0?"4px":"0px",backgroundColor:t.minutes>0?\`rgba(var(--accent-rgb), \${.4+t.minutes/e*.6})\`:"var(--color-bg-surface-2)"},children:t.minutes>.5*e&&s.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-transparent to-white/10"})})]},t.hour)})}),s.jsx("div",{className:"flex gap-[3px] mt-2 border-t border-border/30 pt-2",children:c.map(e=>s.jsx("div",{className:"flex-1 text-center",children:e.hour%6==0&&s.jsx("span",{className:"text-[9px] text-text-muted font-bold font-mono uppercase",children:0===e.hour?"12a":e.hour<12?\`\${e.hour}a\`:12===e.hour?"12p":e.hour-12+"p"})},e.hour))})]})}const h=Math.max(...u.map(e=>e.hours),.1);return s.jsxs("div",{className:"mb-8 p-5 rounded-2xl bg-bg-surface-1/50 border border-border/50",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4 px-1",children:[s.jsx("div",{className:"text-xs text-text-muted uppercase tracking-widest font-bold",children:d}),s.jsx("div",{className:"text-[10px] text-text-muted font-mono bg-bg-surface-2 px-2 py-0.5 rounded",children:"Last 7 days"})]}),s.jsx("div",{className:"flex items-end gap-2 h-16",children:u.map((e,t)=>{const n=h>0?e.hours/h*100:0,r=e.date===i;return s.jsxs("div",{className:"flex-1 flex flex-col items-center justify-end h-full group relative",children:[s.jsx("div",{className:"absolute -top-10 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-20 pointer-events-none",children:s.jsxs("div",{className:"bg-bg-surface-3 text-text-primary text-[10px] font-mono px-2 py-1.5 rounded-lg shadow-xl whitespace-nowrap border border-border flex flex-col items-center",children:[s.jsx("span",{className:"font-bold",children:e.date}),s.jsxs("span",{className:"text-accent",children:[e.hours.toFixed(1),"h active"]}),s.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 w-2 h-2 bg-bg-surface-3 border-r border-b border-border rotate-45"})]})}),s.jsx(fl.div,{initial:{height:0},animate:{height:\`\${Math.max(n,e.hours>0?8:0)}%\`},transition:{delay:.05*t,duration:.5},className:"w-full rounded-t-md cursor-pointer transition-all duration-300 group-hover:scale-x-110 origin-bottom "+(r?"ring-2 ring-accent ring-offset-2 ring-offset-bg-base":""),style:{minHeight:e.hours>0?"4px":"0px",backgroundColor:r?"var(--color-accent-bright)":e.hours>0?\`rgba(var(--accent-rgb), \${.4+e.hours/h*.6})\`:"var(--color-bg-surface-2)"},onClick:()=>a?.(e.date)})]},e.date)})}),s.jsx("div",{className:"flex gap-2 mt-2 border-t border-border/30 pt-2",children:u.map(e=>s.jsx("div",{className:"flex-1 text-center",children:s.jsx("span",{className:"text-[10px] text-text-muted font-bold uppercase tracking-tighter",children:new Date(e.date+"T12:00:00").toLocaleDateString([],{weekday:"short"})})},e.date))})]})}function gc({children:e}){return s.jsx("span",{className:"text-text-primary font-medium",children:e})}function yc(e){return e.reduce((e,t)=>e+t.duration_seconds,0)/3600}function vc(e,t){const n=e.filter(e=>null!=e.evaluation);if(n.length<2)return null;return n.reduce((e,n)=>e+n.evaluation[t],0)/n.length}function xc(e,t,n,r,a,i){var o;const l=[],c=a-(i-a),u=a,d=function(e,t,n){return e.filter(e=>{const r=new Date(e.started_at).getTime();return r>=t&&r<=n})}(n,c,u),f=function(e,t,n){return e.filter(e=>{const r=new Date(e.created_at).getTime();return r>=t&&r<=n})}(r,c,u),h=yc(e),p=yc(d),m=vc(e,"prompt_quality"),g=vc(d,"prompt_quality");if(null!==m&&null!==g&&m>g+.3&&l.push({priority:10,node:s.jsxs("span",{children:["Your prompt quality improved from ",s.jsx(gc,{children:g.toFixed(1)})," to"," ",s.jsx(gc,{children:m.toFixed(1)})," \u2014 clearer prompts mean faster results."]})}),d.length>0&&e.length>0){const e=t.length/Math.max(h,.1),n=f.length/Math.max(p,.1);e>1.2*n&&t.length>=2&&l.push({priority:9,node:s.jsxs("span",{children:["You're shipping ",s.jsxs(gc,{children:[Math.round(100*(e/n-1)),"% faster"]})," ","this period \u2014 great momentum."]})})}const y=t.filter(e=>"complex"===e.complexity).length,v=f.filter(e=>"complex"===e.complexity).length;y>v&&y>=2&&l.push({priority:8,node:s.jsxs("span",{children:[s.jsx(gc,{children:y})," complex ",1===y?"task":"tasks"," this period vs"," ",s.jsx(gc,{children:v})," before \u2014 you're taking on harder problems."]})});const x=e.filter(e=>null!=e.evaluation),b=x.filter(e=>"completed"===e.evaluation.task_outcome&&e.evaluation.iteration_count<=3);if(x.length>=3&&b.length>0){const e=Math.round(b.length/x.length*100);e>=50&&l.push({priority:7,node:s.jsxs("span",{children:[s.jsxs(gc,{children:[e,"%"]})," of your sessions completed in 3 or fewer turns \u2014 efficient prompting."]})})}const w=function(e){if(0===e.length)return null;const t={};for(const a of e){const e=a.task_type||"coding";t[e]=(t[e]??0)+a.duration_seconds}const n=e.reduce((e,t)=>e+t.duration_seconds,0),r=Object.entries(t).sort((e,t)=>t[1]-e[1])[0];return r&&0!==n?{type:r[0],pct:Math.round(r[1]/n*100)}:null}(e);if(w&&w.pct>=60&&e.length>=2){const e={coding:"building",debugging:"debugging",testing:"testing",planning:"planning",reviewing:"reviewing",documenting:"documenting",refactoring:"refactoring",research:"researching",analysis:"analyzing"}[w.type]??w.type;l.push({priority:6,node:s.jsxs("span",{children:["Deep focus: ",s.jsxs(gc,{children:[w.pct,"%"]})," of your time spent ",e,"."]})})}const k={};for(const s of e)s.client&&(k[o=s.client]??(k[o]=[])).push(s);const S=Object.entries(k).filter(([,e])=>e.length>=2);if(S.length>=2){const e=S.map(([e,n])=>{const r=yc(n),a=new Set(n.map(e=>e.session_id)),i=t.filter(e=>a.has(e.session_id));return{name:e,rate:i.length/Math.max(r,.1),count:i.length}}).filter(e=>e.count>0);if(e.length>=2){e.sort((e,t)=>t.rate-e.rate);const t=e[0],n=oc[t.name]??t.name;l.push({priority:5,node:s.jsxs("span",{children:[s.jsx(gc,{children:n})," is your most productive tool this period \u2014 ",t.count," ",1===t.count?"milestone":"milestones"," shipped."]})})}}const C=vc(e,"context_provided");if(null!==C&&C<3.5&&l.push({priority:4,node:s.jsxs("span",{children:["Tip: Your context score averages ",s.jsxs(gc,{children:[C.toFixed(1),"/5"]})," \u2014 try including specific files and error messages for faster results."]})}),x.length>=3){const e=x.filter(e=>"completed"===e.evaluation.task_outcome).length,t=Math.round(e/x.length*100);100===t?l.push({priority:3,node:s.jsxs("span",{children:[s.jsx(gc,{children:"100%"})," completion rate \u2014 every task landed."]})}):t<70&&l.push({priority:4,node:s.jsxs("span",{children:[s.jsxs(gc,{children:[t,"%"]})," completion rate \u2014 try breaking tasks into smaller, well-scoped pieces."]})})}return p>0&&h>1.5*p&&h>=1&&l.push({priority:2,node:s.jsxs("span",{children:[s.jsxs(gc,{children:[Math.round(100*(h/p-1)),"% more"]})," AI-paired time this period \u2014 you're leaning in."]})}),0===e.length&&l.push({priority:1,node:s.jsx("span",{className:"text-text-muted",children:"No sessions in this window. Start coding with AI to see insights here."})}),l.sort((e,t)=>t.priority-e.priority)}function bc({sessions:e,milestones:t,windowStart:n,windowEnd:r,allSessions:a,allMilestones:i}){const o=f.useMemo(()=>{const o=xc(e,t,a??e,i??t,n,r);return o[0]?.node??null},[e,t,a,i,n,r]);return o?s.jsx(fl.div,{initial:{opacity:0},animate:{opacity:1},className:"rounded-xl bg-bg-surface-1 border border-border/50 px-4 py-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Zl,{className:"w-4 h-4 text-accent flex-shrink-0 mt-0.5"}),s.jsx("p",{className:"text-sm text-text-secondary leading-relaxed",children:o})]})}):null}function wc({onDelete:e,size:t="md",className:n=""}){const[r,a]=f.useState(!1),i=f.useRef(void 0);f.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const o=t=>{t.stopPropagation(),i.current&&clearTimeout(i.current),a(!1),e()},l=e=>{e.stopPropagation(),i.current&&clearTimeout(i.current),a(!1)},c="sm"===t?"w-3 h-3":"w-3.5 h-3.5",u="sm"===t?"p-1":"p-1.5";return r?s.jsxs("span",{className:\`inline-flex items-center gap-0.5 \${n}\`,onClick:e=>e.stopPropagation(),children:[s.jsx("button",{onClick:o,className:\`\${u} rounded-lg transition-all bg-error/15 text-error hover:bg-error/25\`,title:"Confirm delete",children:s.jsx(wl,{className:c})}),s.jsx("button",{onClick:l,className:\`\${u} rounded-lg transition-all text-text-muted hover:bg-bg-surface-2\`,title:"Cancel",children:s.jsx(rc,{className:c})})]}):s.jsx("button",{onClick:e=>{e.stopPropagation(),a(!0),i.current=setTimeout(()=>a(!1),5e3)},className:\`\${u} rounded-lg transition-all text-text-muted hover:text-error/70 hover:bg-error/5 \${n}\`,title:"Delete",children:s.jsx(Jl,{className:c})})}function kc({sessions:e}){const{scores:t,summaryLine:n}=f.useMemo(()=>{const t=e.filter(e=>null!=e.evaluation);if(0===t.length)return{scores:null,summaryLine:null};let n=0,r=0,a=0,i=0,o=0,s=0;for(const e of t){const t=e.evaluation;n+=t.prompt_quality,r+=t.context_provided,a+=t.independence_level,i+=t.scope_quality,s+=t.iteration_count,"completed"===t.task_outcome&&o++}const l=t.length,c=Math.round(o/l*100);return{scores:[{label:"Prompt Quality",value:n/l,max:5},{label:"Context",value:r/l,max:5},{label:"Independence",value:a/l,max:5},{label:"Scope",value:i/l,max:5},{label:"Completion",value:c/20,max:5}],summaryLine:\`\${l} session\${1===l?"":"s"} evaluated \xB7 \${c}% completed \xB7 avg \${(s/l).toFixed(1)} iterations\`}},[e]);return s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-bg-surface-2",children:s.jsx(Gl,{className:"w-3.5 h-3.5 text-text-muted"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"AI Proficiency"})]}),null===t?s.jsx("p",{className:"text-xs text-text-muted py-2",children:"No evaluation data yet"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"space-y-3",children:t.map((e,t)=>{const n=e.value/e.max*100,r="Completion"===e.label?\`\${Math.round(n)}%\`:e.value.toFixed(1);return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-text-secondary font-medium w-28 text-right shrink-0",children:e.label}),s.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-bg-surface-2/50 overflow-hidden",children:s.jsx(fl.div,{className:"h-full rounded-full",style:{backgroundColor:(a=e.value,a>=4?"var(--color-accent)":a>=3?"var(--color-success)":"var(--color-text-muted)")},initial:{width:0},animate:{width:\`\${n}%\`},transition:{duration:.6,delay:.05*t,ease:[.22,1,.36,1]}})}),s.jsx("span",{className:"text-xs text-text-muted font-mono w-10 text-right shrink-0",children:r})]},e.label);var a})}),s.jsx("p",{className:"text-[10px] text-text-muted mt-4 px-1 font-mono",children:n})]})]})}function Sc({label:e,active:t,onClick:n}){return s.jsx("button",{onClick:n,className:"text-[10px] font-bold uppercase tracking-wider px-3 py-1.5 rounded-full transition-all duration-200 cursor-pointer border "+(t?"bg-accent text-white border-accent scale-105":"bg-bg-surface-1 border-border text-text-muted hover:text-text-primary hover:border-text-muted/50"),style:t?{boxShadow:"0 2px 10px rgba(var(--accent-rgb), 0.4)"}:void 0,children:e})}function Cc({sessions:e,filters:t,onFilterChange:n}){const r=f.useMemo(()=>[...new Set(e.map(e=>e.client))].sort(),[e]),a=f.useMemo(()=>[...new Set(e.flatMap(e=>e.languages))].sort(),[e]),i=f.useMemo(()=>[...new Set(e.map(e=>e.project).filter(e=>{if(!e)return!1;const t=e.trim().toLowerCase();return!["untitled","mcp","unknown","default","none"].includes(t)}))].sort(),[e]);return r.length>0||a.length>0||i.length>0?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-1",children:[s.jsx(Sc,{label:"All",active:"all"===t.client&&"all"===t.language&&"all"===t.project,onClick:()=>{n("client","all"),n("language","all"),n("project","all")}}),r.map(e=>s.jsx(Sc,{label:oc[e]??e,active:t.client===e,onClick:()=>n("client",t.client===e?"all":e)},e)),a.map(e=>s.jsx(Sc,{label:e,active:t.language===e,onClick:()=>n("language",t.language===e?"all":e)},e)),i.map(e=>s.jsx(Sc,{label:e,active:t.project===e,onClick:()=>n("project",t.project===e?"all":e)},e))]}):null}function jc({text:e,words:t}){if(!t?.length||!e)return s.jsx(s.Fragment,{children:e});const n=t.map(e=>e.replace(/[.*+?^\${}()|[\\]\\\\]/g,"\\\\$&")),r=new RegExp(\`(\${n.join("|")})\`,"gi"),a=e.split(r);return s.jsx(s.Fragment,{children:a.map((e,t)=>t%2==1?s.jsx("mark",{className:"bg-accent/30 text-inherit rounded-sm px-px",children:e},t):s.jsx("span",{children:e},t))})}var Nc={feature:"bg-success/10 text-success border-success/20",bugfix:"bg-error/10 text-error border-error/20",refactor:"bg-purple/10 text-purple border-purple/20",test:"bg-blue/10 text-blue border-blue/20",docs:"bg-accent/10 text-accent border-accent/20",setup:"bg-text-muted/10 text-text-muted border-text-muted/20",deployment:"bg-emerald/10 text-emerald border-emerald/20"};function Tc(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);if(r<24)return\`\${r}h ago\`;const a=Math.floor(r/24);return 1===a?"yesterday":a<7?\`\${a}d ago\`:new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})}function Ec({milestones:e,showPublic:t=!1}){const n=[...e].sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()).slice(0,8);return s.jsxs(fl.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,ease:[.22,1,.36,1]},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3 px-1",children:[s.jsx(ec,{className:"w-4 h-4 text-accent"}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Recent Achievements"}),s.jsxs("span",{className:"text-[10px] text-text-muted font-mono bg-bg-surface-2 px-2 py-0.5 rounded ml-auto",children:[e.length," total"]})]}),0===n.length?s.jsx("div",{className:"text-sm text-text-muted text-center py-6",children:"No milestones yet \u2014 complete your first session!"}):s.jsx("div",{className:"space-y-0.5",children:n.map((e,n)=>{const r=uc[e.category]??"#9c9588",a=Nc[e.category]??"bg-bg-surface-2 text-text-secondary border-border",i=sc[e.client]??e.client.slice(0,2).toUpperCase(),o=ic[e.client]??"#91919a",l=t?e.title:e.private_title||e.title,c="complex"===e.complexity;return s.jsxs(fl.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{duration:.25,delay:.04*n},className:"flex items-center gap-3 py-2 px-2 rounded-lg hover:bg-bg-surface-2/40 transition-colors",children:[s.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:r}}),s.jsx("span",{className:"text-sm font-medium text-text-secondary hover:text-text-primary truncate flex-1 min-w-0",children:l}),s.jsx("span",{className:\`text-[9px] uppercase tracking-wider font-bold px-1.5 py-0.5 rounded-full border flex-shrink-0 \${a}\`,children:e.category}),c&&s.jsxs("span",{className:"flex items-center gap-0.5 text-[9px] uppercase tracking-wider font-bold px-1.5 py-0.5 rounded-full border bg-purple/10 text-purple border-purple/20 flex-shrink-0",children:[s.jsx(vl,{className:"w-2.5 h-2.5"}),"complex"]}),s.jsx("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:Tc(e.created_at)}),s.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center text-[8px] font-bold font-mono flex-shrink-0",style:{backgroundColor:\`\${o}15\`,color:o,border:\`1px solid \${o}20\`},children:i})]},e.id)})})]})}function Pc(e,t){const n=e=>new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0});return\`\${n(e)} \u2014 \${n(t)}\`}function Mc(e){if(e<60)return\`\${e}s\`;const t=Math.round(e/60);if(t<60)return\`\${t}m\`;const n=Math.floor(t/60),r=t%60;return r>0?\`\${n}h \${r}m\`:\`\${n}h\`}var Lc={feature:"bg-success/15 text-success border-success/30",bugfix:"bg-error/15 text-error border-error/30",refactor:"bg-purple/15 text-purple border-purple/30",test:"bg-blue/15 text-blue border-blue/30",docs:"bg-accent/15 text-accent border-accent/30",setup:"bg-text-muted/15 text-text-muted border-text-muted/20",deployment:"bg-emerald/15 text-emerald border-emerald/30"};function Dc({category:e}){const t=Lc[e]??"bg-bg-surface-2 text-text-secondary border-border";return s.jsx("span",{className:\`text-[10px] px-1.5 py-0.5 rounded-full border font-bold uppercase tracking-wider \${t}\`,children:e})}function Ac({score:e}){const t=e/5*100,n=e>=4?"bg-success":e>=3?"bg-accent":"bg-error",r=e>=4?"bg-success/15":e>=3?"bg-accent/15":"bg-error/15";return s.jsx("span",{className:\`w-7 h-[4px] rounded-full \${r} flex-shrink-0 overflow-hidden\`,title:\`Quality: \${e.toFixed(1)}/5\`,children:s.jsx("span",{className:\`block h-full rounded-full \${n}\`,style:{width:\`\${t}%\`}})})}function _c({evaluation:e,showPublic:t=!1}){const n=[{label:"Prompt",value:e.prompt_quality,reason:e.prompt_quality_reason,Icon:Ul},{label:"Context",value:e.context_provided,reason:e.context_provided_reason,Icon:_l},{label:"Scope",value:e.scope_quality,reason:e.scope_quality_reason,Icon:Gl},{label:"Independence",value:e.independence_level,reason:e.independence_level_reason,Icon:El}],r=n.some(e=>e.reason)||e.task_outcome_reason;return s.jsxs("div",{className:"px-2 py-1.5 bg-bg-surface-2/30 rounded-md mb-2",children:[s.jsx("div",{className:"grid grid-cols-2 gap-x-6 gap-y-1.5",children:n.map(({label:e,value:t,Icon:n})=>s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(n,{className:"w-3 h-3 text-text-muted/50 flex-shrink-0"}),s.jsx("span",{className:"text-text-muted min-w-[58px]",children:e}),s.jsx(Ac,{score:t})]},e))}),!t&&r&&s.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-border/15 space-y-1",children:[e.task_outcome_reason&&s.jsxs("div",{className:"flex items-start gap-1.5 text-[10px]",children:[s.jsx("span",{className:"text-error font-bold flex-shrink-0",children:"Outcome:"}),s.jsx("span",{className:"text-text-muted leading-tight",children:e.task_outcome_reason})]}),n.filter(e=>e.reason).map(({label:e,reason:t})=>s.jsxs("div",{className:"flex items-start gap-1.5 text-[10px]",children:[s.jsxs("span",{className:"text-accent font-bold flex-shrink-0",children:[e,":"]}),s.jsx("span",{className:"text-text-muted leading-tight",children:t})]},e))]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1.5 pt-1.5 border-t border-border/15",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(Wl,{className:"w-3 h-3 text-text-muted/50"}),s.jsx("span",{className:"text-text-muted",children:"Iterations"}),s.jsx("span",{className:"text-text-secondary font-mono font-bold ml-0.5",children:e.iteration_count})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(nc,{className:"w-3 h-3 text-text-muted/50"}),s.jsx("span",{className:"text-text-muted",children:"Tools"}),s.jsx("span",{className:"text-text-secondary font-mono font-bold ml-0.5",children:e.tools_leveraged})]})]})]})}var zc=f.memo(function({session:e,milestones:t,defaultExpanded:n=!1,externalShowPublic:r,hideClientAvatar:a=!1,hideProject:i=!1,showFullDate:o=!1,highlightWords:l,onDeleteSession:c,onDeleteMilestone:u}){const[d,h]=f.useState(n),[p,m]=f.useState(!1),g=r??p,y=m,v=fc(e.client),x=ic[v]??"#91919a",b="cursor"===v,w=b?"var(--text-primary)":x,k=b?{backgroundColor:"var(--bg-surface-2)",color:"var(--text-primary)",border:"1px solid var(--border)"}:{backgroundColor:\`\${x}15\`,color:x,border:\`1px solid \${x}30\`},S=sc[v]??v.slice(0,2).toUpperCase(),C=cc[v],j=t.length>0||!!e.evaluation||!!e.model||!!e.tool_overhead,N=e.project?.trim()||"",T=!N||["untitled","mcp","unknown","default","none","null","undefined"].includes(N.toLowerCase()),E=t[0],P=T&&E?E.title:N,M=T&&E?E.private_title||E.title:N;let L=e.private_title||e.title||M||"Untitled Session",D=e.title||P||"Untitled Session";const A=L!==D;return s.jsxs("div",{className:"group/card mb-1 rounded-lg border transition-all duration-200 "+(d?"bg-bg-surface-1 border-accent/30 shadow-md":"bg-bg-surface-1/30 border-border/50 hover:border-accent/30"),children:[s.jsxs("div",{className:"flex items-center",children:[s.jsxs("button",{className:"flex-1 flex items-center gap-3 px-3 py-2 text-left min-w-0",onClick:()=>j&&h(!d),style:{cursor:j?"pointer":"default"},children:[!a&&s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-[11px] font-black font-mono flex-shrink-0 shadow-sm",style:k,title:oc[v]??v,children:C?s.jsx("div",{className:"w-4 h-4",style:{backgroundColor:w,maskImage:\`url(\${C})\`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskImage:\`url(\${C})\`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):S}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:s.jsx("div",{className:"flex items-center gap-1.5 min-w-0",children:s.jsx(Ko,{mode:"wait",children:s.jsxs(fl.div,{initial:{opacity:0,x:-5},animate:{opacity:1,x:0},exit:{opacity:0,x:5},transition:{duration:.1},className:"flex items-center gap-1.5 min-w-0",children:[g?s.jsx(Xl,{className:"w-3 h-3 text-success/60 flex-shrink-0"}):s.jsx(Il,{className:"w-3 h-3 text-accent/60 flex-shrink-0"}),s.jsx("span",{className:"text-sm font-bold truncate text-text-primary tracking-tight",children:s.jsx(jc,{text:g?D:L,words:l})})]},g?"public":"private")})})}),s.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-text-muted font-semibold",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Tl,{className:"w-3 h-3 opacity-60"}),Mc(e.duration_seconds)]}),e.duration_seconds>=900&&(()=>{const t=Math.floor(e.duration_seconds/900),n=t>0?Math.min(e.heartbeat_count/t,1):0,r=n>=.8?"text-success":n>=.5?"text-accent":"text-text-muted";return s.jsxs("span",{className:\`flex items-center gap-0.5 font-mono \${r}\`,title:\`Focus: \${Math.round(100*n)}%\`,children:[s.jsx(ac,{className:"w-2.5 h-2.5 fill-current opacity-70"}),Math.round(100*n),"%"]})})(),s.jsxs("span",{className:"opacity-50 font-mono tracking-tight",children:[o&&\`\${new Date(e.started_at).toLocaleDateString([],{month:"short",day:"numeric"})} \xB7 \`,Pc(e.started_at,e.ended_at).split(" \u2014 ")[0]]}),!g&&!T&&!i&&s.jsxs("span",{className:"flex items-center gap-0.5 text-text-muted/70",title:\`Project: \${N}\`,children:[s.jsx(Vl,{className:"w-2.5 h-2.5 opacity-60"}),s.jsx("span",{className:"max-w-[100px] truncate",children:N})]}),t.length>0&&s.jsxs("span",{className:"flex items-center gap-0.5",title:\`\${t.length} milestone\${1!==t.length?"s":""}\`,children:[s.jsx(Rl,{className:"w-2.5 h-2.5 opacity-60"}),t.length]}),e.evaluation&&s.jsx(Ac,{score:(_=e.evaluation,(_.prompt_quality+_.context_provided+_.scope_quality+_.independence_level)/4)})]})]})]}),s.jsxs("div",{className:"flex items-center px-2 gap-1.5 border-l border-border/30 h-8 self-center",children:[c&&s.jsx(wc,{onDelete:()=>c(e.session_id),className:"opacity-0 group-hover/card:opacity-100"}),A&&void 0===r&&s.jsx("button",{onClick:e=>{e.stopPropagation(),y(!g)},className:"p-1.5 rounded-lg transition-all "+(g?"bg-success/10 text-success":"text-text-muted hover:bg-bg-surface-2"),title:g?"Public Mode":"Private Mode",children:g?s.jsx(Dl,{className:"w-3.5 h-3.5"}):s.jsx(Ll,{className:"w-3.5 h-3.5"})}),j&&s.jsx("button",{onClick:()=>h(!d),className:"p-1.5 rounded-lg transition-all "+(d?"text-accent bg-accent/5":"text-text-muted hover:bg-bg-surface-2"),children:s.jsx(kl,{className:"w-4 h-4 transition-transform duration-200 "+(d?"rotate-180":"")})})]})]}),s.jsx(Ko,{children:d&&j&&s.jsx(fl.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:s.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-1",children:[s.jsx("div",{className:"h-px bg-border/20 mb-2 mx-1"}),(e.model||e.tool_overhead)&&s.jsxs("div",{className:"flex items-center gap-4 px-2 py-1.5 bg-bg-surface-2/30 rounded-md mb-2",children:[e.model&&s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(Ml,{className:"w-3 h-3 text-text-muted/50 flex-shrink-0"}),s.jsx("span",{className:"text-text-muted",children:"Model"}),s.jsx("span",{className:"text-text-secondary font-mono font-bold ml-0.5",children:e.model})]}),e.tool_overhead&&s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[s.jsx(yl,{className:"w-3 h-3 text-text-muted/50 flex-shrink-0"}),s.jsx("span",{className:"text-text-muted",children:"Tracking overhead"}),s.jsxs("span",{className:"text-text-secondary font-mono font-bold ml-0.5",children:["~",e.tool_overhead.total_tokens_est," tokens"]})]})]}),e.evaluation&&s.jsx(_c,{evaluation:e.evaluation,showPublic:g}),t.length>0&&s.jsx("div",{className:"space-y-0.5",children:t.map(e=>{const t=g?e.title:e.private_title||e.title,n=function(e){if(!e||e<=0)return"";if(e<60)return\`\${e}m\`;const t=Math.floor(e/60),n=e%60;return n>0?\`\${t}h \${n}m\`:\`\${t}h\`}(e.duration_minutes);return s.jsxs("div",{className:"group flex items-center gap-2 p-1.5 rounded-md hover:bg-bg-surface-2/40 transition-colors",children:[s.jsx("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:uc[e.category]??"#9c9588"}}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-text-secondary group-hover:text-text-primary truncate",children:s.jsx(jc,{text:t,words:l})}),s.jsx(Dc,{category:e.category})]})}),n&&s.jsx("span",{className:"text-[10px] text-text-muted font-mono",children:n}),u&&s.jsx(wc,{onDelete:()=>u(e.id),size:"sm",className:"opacity-0 group-hover:opacity-100"})]},e.id)})})]})})})]});var _});function Rc(e){if(e<60)return\`\${e}s\`;const t=Math.round(e/60);if(t<60)return\`\${t}m\`;const n=Math.floor(t/60),r=t%60;return r>0?\`\${n}h \${r}m\`:\`\${n}h\`}function Vc({score:e}){const t=e/5*100,n=e>=4?"bg-success":e>=3?"bg-accent":"bg-error",r=e>=4?"bg-success/15":e>=3?"bg-accent/15":"bg-error/15";return s.jsx("span",{className:\`w-7 h-[4px] rounded-full \${r} flex-shrink-0 overflow-hidden\`,title:\`Quality: \${e.toFixed(1)}/5\`,children:s.jsx("span",{className:\`block h-full rounded-full \${n}\`,style:{width:\`\${t}%\`}})})}var Fc=f.memo(function({group:e,defaultExpanded:t,globalShowPublic:n,showFullDate:r,highlightWords:a,onDeleteSession:i,onDeleteMilestone:o,onDeleteConversation:l}){const[c,u]=f.useState(t),[d,h]=f.useState(!1),p=n||d;if(1===e.sessions.length){const l=e.sessions[0];return s.jsx(zc,{session:l.session,milestones:l.milestones,defaultExpanded:t&&l.milestones.length>0,externalShowPublic:n||void 0,showFullDate:r,highlightWords:a,onDeleteSession:i,onDeleteMilestone:o})}const m=fc(e.sessions[0].session.client),g=ic[m]??"#91919a",y="cursor"===m,v=y?"var(--text-primary)":g,x=y?{backgroundColor:"var(--bg-surface-2)",color:"var(--text-primary)",border:"1px solid var(--border)"}:{backgroundColor:\`\${g}15\`,color:g,border:\`1px solid \${g}30\`},b=sc[m]??m.slice(0,2).toUpperCase(),w=cc[m],k=e.aggregateEval,S=k?(k.prompt_quality+k.context_provided+k.scope_quality+k.independence_level)/4:0,C=e.sessions[0].session,j=C.private_title||C.title||C.project||"Conversation",N=C.title||C.project||"Conversation",T=j!==N,E=C.project?.trim()||"",P=!!E&&!["untitled","mcp","unknown","default","none","null","undefined"].includes(E.toLowerCase());return s.jsxs("div",{className:"group/conv mb-1 rounded-lg border transition-all duration-200 "+(c?"bg-bg-surface-1 border-accent/30 shadow-md":"bg-bg-surface-1/30 border-border/50 hover:border-accent/30"),children:[s.jsxs("div",{className:"flex items-center",children:[s.jsxs("button",{className:"flex-1 flex items-center gap-3 px-3 py-2 text-left min-w-0",onClick:()=>u(!c),children:[s.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center text-[11px] font-black font-mono flex-shrink-0 shadow-sm",style:x,title:oc[m]??m,children:w?s.jsx("div",{className:"w-4 h-4",style:{backgroundColor:v,maskImage:\`url(\${w})\`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskImage:\`url(\${w})\`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):b}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("div",{className:"flex items-center gap-1.5 min-w-0",children:s.jsx(Ko,{mode:"wait",children:s.jsxs(fl.div,{initial:{opacity:0,x:-5},animate:{opacity:1,x:0},exit:{opacity:0,x:5},transition:{duration:.1},className:"flex items-center gap-1.5 min-w-0",children:[p?s.jsx(Xl,{className:"w-3 h-3 text-success/60 flex-shrink-0"}):s.jsx(Il,{className:"w-3 h-3 text-accent/60 flex-shrink-0"}),s.jsx("span",{className:"text-sm font-bold truncate text-text-primary tracking-tight",children:s.jsx(jc,{text:p?N:j,words:a})})]},p?"public":"private")})}),s.jsxs("span",{className:"text-[10px] font-bold text-accent/80 bg-accent/5 px-1.5 py-0.5 rounded border border-accent/10 flex-shrink-0",children:[e.sessions.length," prompts"]})]}),s.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-text-muted font-semibold",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Tl,{className:"w-3 h-3 opacity-60"}),Rc(e.totalDuration)]}),s.jsxs("span",{className:"opacity-50 font-mono tracking-tight",children:[r&&\`\${new Date(e.startedAt).toLocaleDateString([],{month:"short",day:"numeric"})} \xB7 \`,(M=e.startedAt,new Date(M).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}))]}),!p&&P&&s.jsxs("span",{className:"flex items-center gap-0.5 text-text-muted/70",title:\`Project: \${E}\`,children:[s.jsx(Vl,{className:"w-2.5 h-2.5 opacity-60"}),s.jsx("span",{className:"max-w-[100px] truncate",children:E})]}),e.totalMilestones>0&&s.jsxs("span",{className:"flex items-center gap-0.5",title:\`\${e.totalMilestones} milestone\${1!==e.totalMilestones?"s":""}\`,children:[s.jsx(Rl,{className:"w-2.5 h-2.5 opacity-60"}),e.totalMilestones]}),k&&s.jsx(Vc,{score:S})]})]})]}),s.jsxs("div",{className:"flex items-center px-2 gap-1.5 border-l border-border/30 h-8 self-center",children:[l&&e.conversationId&&s.jsx(wc,{onDelete:()=>l(e.conversationId),className:"opacity-0 group-hover/conv:opacity-100"}),T&&!n&&s.jsx("button",{onClick:()=>h(!d),className:"p-1.5 rounded-lg transition-all "+(p?"bg-success/10 text-success":"text-text-muted hover:bg-bg-surface-2"),title:p?"Public Mode":"Private Mode",children:p?s.jsx(Dl,{className:"w-3.5 h-3.5"}):s.jsx(Ll,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>u(!c),className:"p-1.5 rounded-lg transition-all "+(c?"text-accent bg-accent/5":"text-text-muted hover:bg-bg-surface-2"),children:s.jsx(kl,{className:"w-4 h-4 transition-transform duration-200 "+(c?"rotate-180":"")})})]})]}),s.jsx(Ko,{children:c&&s.jsx(fl.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:s.jsxs("div",{className:"px-3 pb-2 relative",children:[s.jsx("div",{className:"absolute left-[1.75rem] top-0 bottom-2 w-px",style:{backgroundColor:\`\${g}25\`}}),s.jsx("div",{className:"space-y-1 pl-10",children:e.sessions.map(e=>s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute -left-7 top-5 w-2 h-2 rounded-full border-2",style:{backgroundColor:g,borderColor:\`\${g}40\`}}),s.jsx(zc,{session:e.session,milestones:e.milestones,defaultExpanded:!1,externalShowPublic:p||void 0,hideClientAvatar:!0,hideProject:!0,showFullDate:r,highlightWords:a,onDeleteSession:i,onDeleteMilestone:o})]},e.session.session_id))})]})})})]});var M});function Oc({sessions:e,milestones:t,filters:n,globalShowPublic:r,showFullDate:a,highlightWords:i,outsideWindowCounts:o,onNavigateNewer:l,onNavigateOlder:c,onDeleteSession:u,onDeleteConversation:d,onDeleteMilestone:h}){const p=f.useMemo(()=>e.filter(e=>("all"===n.client||e.client===n.client)&&(!("all"!==n.language&&!e.languages.includes(n.language))&&("all"===n.project||(e.project??"")===n.project))),[e,n]),m=f.useMemo(()=>"all"===n.category?t:t.filter(e=>e.category===n.category),[t,n.category]),g=f.useMemo(()=>{const e=function(e,t){const n=new Map;for(const a of t){const e=n.get(a.session_id);e?e.push(a):n.set(a.session_id,[a])}const r=e.map(e=>({session:e,milestones:n.get(e.session_id)??[]}));return r.sort((e,t)=>new Date(t.session.started_at).getTime()-new Date(e.session.started_at).getTime()),r}(p,m);return function(e){const t=new Map,n=[];for(const a of e){const e=a.session.conversation_id;if(e){const n=t.get(e);n?n.push(a):t.set(e,[a])}else n.push(a)}const r=[];for(const[a,i]of t){i.sort((e,t)=>(e.session.conversation_index??0)-(t.session.conversation_index??0));const e=i.reduce((e,t)=>e+t.session.duration_seconds,0),t=i.reduce((e,t)=>e+t.milestones.length,0),n=i[0].session.started_at,o=i[i.length-1].session.ended_at;r.push({conversationId:a,sessions:i,aggregateEval:pc(i),totalDuration:e,totalMilestones:t,startedAt:n,endedAt:o})}for(const a of n)r.push({conversationId:null,sessions:[a],aggregateEval:a.session.evaluation?pc([a]):null,totalDuration:a.session.duration_seconds,totalMilestones:a.milestones.length,startedAt:a.session.started_at,endedAt:a.session.ended_at});return r.sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()),r}(e)},[p,m]),[y,v]=f.useState(25),x=f.useRef(null);if(f.useEffect(()=>{v(25)},[g]),f.useEffect(()=>{const e=x.current;if(!e)return;const t=new IntersectionObserver(([e])=>{e?.isIntersecting&&v(e=>e+25)},{rootMargin:"200px"});return t.observe(e),()=>t.disconnect()},[g,y]),0===g.length){const e=o&&o.before>0,t=o&&o.after>0;return s.jsxs("div",{className:"text-center text-text-muted py-8 text-sm mb-4 space-y-3",children:[t&&s.jsxs("button",{onClick:l,className:"flex flex-col items-center gap-0.5 mx-auto text-[11px] text-text-muted/60 hover:text-accent transition-colors group",children:[s.jsx(jl,{className:"w-3.5 h-3.5"}),s.jsxs("span",{children:[o.after," newer session",1!==o.after?"s":""]}),o.newerLabel&&s.jsx("span",{className:"text-[10px] opacity-70 group-hover:opacity-100",children:o.newerLabel})]}),s.jsx("div",{children:"No sessions in this window"}),e&&s.jsxs("button",{onClick:c,className:"flex flex-col items-center gap-0.5 mx-auto text-[11px] text-text-muted/60 hover:text-accent transition-colors group",children:[o.olderLabel&&s.jsx("span",{className:"text-[10px] opacity-70 group-hover:opacity-100",children:o.olderLabel}),s.jsxs("span",{children:[o.before," older session",1!==o.before?"s":""]}),s.jsx(kl,{className:"w-3.5 h-3.5"})]})]})}const b=y<g.length,w=b?g.slice(0,y):g;return s.jsxs("div",{className:"space-y-1.5 mb-4",children:[o&&o.after>0&&s.jsxs("button",{onClick:l,className:"flex flex-col items-center gap-0.5 w-full text-[11px] text-text-muted/60 hover:text-accent py-1.5 transition-colors group",children:[s.jsx(jl,{className:"w-3.5 h-3.5"}),s.jsxs("span",{children:[o.after," newer session",1!==o.after?"s":""]}),o.newerLabel&&s.jsx("span",{className:"text-[10px] opacity-70 group-hover:opacity-100",children:o.newerLabel})]}),w.map(e=>s.jsx(Fc,{group:e,defaultExpanded:!1,globalShowPublic:r,showFullDate:a,highlightWords:i,onDeleteSession:u,onDeleteMilestone:h,onDeleteConversation:d},e.conversationId??e.sessions[0].session.session_id)),b&&s.jsx("div",{ref:x,className:"h-px"}),g.length>25&&s.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 text-[11px] text-text-muted",children:[s.jsxs("span",{children:["Showing ",Math.min(y,g.length)," of ",g.length," conversations"]}),b&&s.jsx("button",{onClick:()=>v(g.length),className:"text-accent hover:text-accent/80 font-semibold transition-colors",children:"Show all"})]}),o&&o.before>0&&s.jsxs("button",{onClick:c,className:"flex flex-col items-center gap-0.5 w-full text-[11px] text-text-muted/60 hover:text-accent py-1.5 transition-colors group",children:[o.olderLabel&&s.jsx("span",{className:"text-[10px] opacity-70 group-hover:opacity-100",children:o.olderLabel}),s.jsxs("span",{children:[o.before," older session",1!==o.before?"s":""]}),s.jsx(kl,{className:"w-3.5 h-3.5"})]})]})}var Ic=["Output","Efficiency","Prompts","Consistency","Breadth"];function $c(e,t,n,r,a){const i=2*Math.PI*e/5-Math.PI/2;return[n+a*t*Math.cos(i),r+a*t*Math.sin(i)]}function Bc(e,t,n,r){const a=[];for(let i=0;i<5;i++){const[o,s]=$c(i,e,t,n,r);a.push(\`\${o},\${s}\`)}return a.join(" ")}function Uc({sessions:e,milestones:t,streak:n}){const{values:r,hasEvalData:a}=f.useMemo(()=>{const r={simple:1,medium:2,complex:4};let a=0;for(const e of t)a+=r[e.complexity]??1;const i=Math.min(1,a/10),o=e.reduce((e,t)=>e+t.files_touched,0),s=e.reduce((e,t)=>e+t.duration_seconds,0)/3600,l=Math.min(1,o/Math.max(s,1)/20),c=e.filter(e=>null!=e.evaluation);let u=0;const d=c.length>0;if(d){u=c.reduce((e,t)=>e+t.evaluation.prompt_quality,0)/c.length/5}const f=Math.min(1,n/14),h=new Set;for(const t of e)for(const e of t.languages)h.add(e);return{values:[i,l,u,f,Math.min(1,h.size/5)],hasEvalData:d}},[e,t,n]),i=100,o=100,l=[];for(let s=0;s<5;s++){const e=Math.max(r[s],.02),[t,n]=$c(s,e,i,o,70);l.push(\`\${t},\${n}\`)}const c=l.join(" ");return s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.15},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-bg-surface-2",children:s.jsx(vl,{className:"w-3.5 h-3.5 text-text-muted"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Skill Profile"})]}),s.jsx("div",{className:"flex justify-center",children:s.jsxs("svg",{viewBox:"0 0 200 200",width:200,height:200,className:"overflow-visible",children:[[.33,.66,1].map(e=>s.jsx("polygon",{points:Bc(e,i,o,70),fill:"none",stroke:"var(--color-bg-surface-3)",strokeWidth:.5,opacity:.6},e)),Array.from({length:5}).map((e,t)=>{const[n,r]=$c(t,1,i,o,70);return s.jsx("line",{x1:i,y1:o,x2:n,y2:r,stroke:"var(--color-bg-surface-3)",strokeWidth:.5,opacity:.4},\`axis-\${t}\`)}),s.jsx(fl.polygon,{points:c,fill:"var(--color-accent)",fillOpacity:.2,stroke:"var(--color-accent)",strokeWidth:1.5,strokeLinejoin:"round",initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{duration:.6,ease:[.22,1,.36,1]},style:{transformOrigin:"100px 100px"}}),r.map((e,t)=>{const n=Math.max(e,.02),[r,l]=$c(t,n,i,o,70),c=2===t&&!a;return s.jsx("circle",{cx:r,cy:l,r:2.5,fill:c?"var(--color-text-muted)":"var(--color-accent-bright)",opacity:c?.4:1},\`point-\${t}\`)}),Ic.map((e,t)=>{const n=function(e,t,n,r){const[a,i]=$c(e,1.28,t,n,r);let o="middle";return 1!==e&&2!==e||(o="start"),3!==e&&4!==e||(o="end"),{x:a,y:i,anchor:o}}(t,i,o,70),r=2===t&&!a;return s.jsx("text",{x:n.x,y:n.y,textAnchor:n.anchor,dominantBaseline:"central",className:"text-[9px] font-medium",fill:r?"var(--color-text-muted)":"var(--color-text-secondary)",opacity:r?.5:1,children:e},e)})]})}),s.jsx("div",{className:"flex justify-center gap-3 mt-2 flex-wrap",children:Ic.map((e,t)=>{const n=2===t&&!a,i=Math.round(100*r[t]);return s.jsxs("span",{className:"text-[10px] font-mono "+(n?"text-text-muted/50":"text-text-muted"),children:[i,"%"]},e)})})]})}var Hc={features:{title:"Features Shipped",icon:ql,filter:e=>"feature"===e.category,emptyText:"No features shipped in this time window.",accentColor:"#4ade80"},bugs:{title:"Bugs Fixed",icon:xl,filter:e=>"bugfix"===e.category,emptyText:"No bugs fixed in this time window.",accentColor:"#f87171"},complex:{title:"Complex Tasks",icon:vl,filter:e=>"complex"===e.complexity,emptyText:"No complex tasks in this time window.",accentColor:"#a78bfa"}},Wc={feature:"bg-success/10 text-success border-success/20",bugfix:"bg-error/10 text-error border-error/20",refactor:"bg-purple/10 text-purple border-purple/20",test:"bg-blue/10 text-blue border-blue/20",docs:"bg-accent/10 text-accent border-accent/20",setup:"bg-text-muted/10 text-text-muted border-text-muted/20",deployment:"bg-emerald/10 text-emerald border-emerald/20"};function qc(e){const t=new Date(e),n=(new Date).getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return\`\${r}m ago\`;const a=Math.floor(r/60);if(a<24)return\`\${a}h ago\`;const i=Math.floor(a/24);return 1===i?"yesterday":i<7?\`\${i}d ago\`:t.toLocaleDateString([],{month:"short",day:"numeric"})}function Yc({type:e,milestones:t,showPublic:n=!1,onClose:r}){if(f.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const a=Hc[e],i=a.icon,o=t.filter(a.filter).sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()),l=new Map;for(const s of o){const e=new Date(s.created_at).toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"}),t=l.get(e);t?t.push(s):l.set(e,[s])}return s.jsx(Ko,{children:e&&s.jsxs(s.Fragment,{children:[s.jsx(fl.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-40",onClick:r}),s.jsxs(fl.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed top-0 right-0 h-full w-full max-w-md bg-bg-base border-l border-border/50 z-50 flex flex-col shadow-2xl",children:[s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border/50",children:[s.jsx("div",{className:"p-2 rounded-lg",style:{backgroundColor:\`\${a.accentColor}15\`},children:s.jsx(i,{className:"w-4 h-4",style:{color:a.accentColor}})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h2",{className:"text-sm font-bold text-text-primary",children:a.title}),s.jsxs("span",{className:"text-[10px] font-mono text-text-muted",children:[o.length," ",1===o.length?"item":"items"," in window"]})]}),s.jsx("button",{onClick:r,className:"p-1.5 rounded-md hover:bg-bg-surface-2 text-text-muted hover:text-text-primary transition-colors",children:s.jsx(rc,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto overscroll-contain px-5 py-4",children:0===o.length?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s.jsx(Zl,{className:"w-8 h-8 text-text-muted/30 mb-3"}),s.jsx("p",{className:"text-sm text-text-muted",children:a.emptyText})]}):s.jsx("div",{className:"space-y-5",children:[...l.entries()].map(([t,r])=>s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] font-mono text-text-muted uppercase tracking-wider mb-2 px-1",children:t}),s.jsx("div",{className:"space-y-1",children:r.map((t,r)=>{const a=uc[t.category]??"#9c9588",i=Wc[t.category]??"bg-bg-surface-2 text-text-secondary border-border",o=fc(t.client),l=sc[o]??o.slice(0,2).toUpperCase(),c=ic[o]??"#91919a",u="cursor"===o?"var(--text-primary)":c,d=cc[o],f=n?t.title:t.private_title||t.title,h="complex"===t.complexity;return s.jsxs(fl.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,delay:.03*r},className:"flex items-start gap-2.5 py-2 px-2 rounded-lg hover:bg-bg-surface-1 transition-colors group",children:[s.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 mt-1.5",style:{backgroundColor:a}}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm text-text-secondary group-hover:text-text-primary transition-colors leading-snug",children:f}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:["complex"===e&&s.jsx("span",{className:\`text-[8px] uppercase tracking-wider font-bold px-1.5 py-0.5 rounded-full border \${i}\`,children:t.category}),h&&"complex"!==e&&s.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] uppercase tracking-wider font-bold px-1.5 py-0.5 rounded-full border bg-purple/10 text-purple border-purple/20",children:[s.jsx(vl,{className:"w-2 h-2"}),"complex"]}),s.jsx("span",{className:"text-[10px] text-text-muted font-mono",children:qc(t.created_at)}),t.languages.length>0&&s.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:t.languages.join(", ")}),s.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center text-[7px] font-bold font-mono flex-shrink-0 ml-auto",style:{backgroundColor:\`\${c}15\`,color:c,border:\`1px solid \${c}20\`},children:d?s.jsx("div",{className:"w-2.5 h-2.5",style:{backgroundColor:u,maskImage:\`url(\${d})\`,maskSize:"contain",maskRepeat:"no-repeat",maskPosition:"center",WebkitMaskImage:\`url(\${d})\`,WebkitMaskSize:"contain",WebkitMaskRepeat:"no-repeat",WebkitMaskPosition:"center"}}):l})]})]})]},t.id)})})]},t))})})]})]})})}function Qc({label:e,value:t,suffix:n,decimals:r=0,icon:a,delay:i=0,variant:o="default",clickable:l=!1,selected:c=!1,onClick:u}){const d=f.useRef(null),h=f.useRef(0);f.useEffect(()=>{d.current&&t!==h.current&&(!function(e,t,n){let r=null;requestAnimationFrame(function a(i){r||(r=i);const o=Math.min((i-r)/800,1),s=1-Math.pow(1-o,4),l=t*s;e.textContent=n>0?l.toFixed(n):String(Math.round(l)),o<1&&requestAnimationFrame(a)})}(d.current,t,r),h.current=t)},[t,r]);const p="accent"===o;return s.jsxs(fl.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:i},onClick:l&&t>0?u:void 0,className:\`px-3 py-2 rounded-lg border flex items-center gap-2.5 group transition-all duration-300 \${p?"shrink-0 bg-bg-surface-1 border-border/50 hover:border-accent/30":"flex-1 min-w-[120px] bg-bg-surface-1 border-border/50 hover:border-accent/30"} \${l&&t>0?"cursor-pointer":""} \${c?"border-accent/50 bg-accent/5":""}\`,children:[s.jsx("div",{className:"p-1.5 rounded-md transition-colors "+(c?"bg-accent/15":"bg-bg-surface-2 group-hover:bg-accent/10"),children:s.jsx(a,{className:"w-3.5 h-3.5 transition-colors "+(c?"text-accent":"text-text-muted group-hover:text-accent")})}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-baseline gap-0.5",children:[s.jsx("span",{ref:d,className:"text-lg font-bold text-text-primary tracking-tight leading-none",children:r>0?t.toFixed(r):t}),n&&s.jsx("span",{className:"text-[10px] text-text-muted font-medium",children:n})]}),s.jsx("span",{className:"text-[9px] font-mono text-text-muted uppercase tracking-wider leading-none mt-0.5",children:e})]})]})}function Kc({totalHours:e,featuresShipped:t,bugsFixed:n,complexSolved:r,currentStreak:a,filesTouched:i,selectedCard:o,onCardClick:l}){const c=e=>{l?.(o===e?null:e)};return s.jsxs("div",{className:"flex gap-2 mb-4",children:[s.jsxs("div",{className:"grid grid-cols-3 lg:grid-cols-5 gap-2 flex-1",children:[s.jsx(Qc,{label:"Active Hours",value:e,suffix:"hrs",decimals:1,icon:Tl,delay:.1}),s.jsx(Qc,{label:"Features",value:t,icon:ql,delay:.15,clickable:!0,selected:"features"===o,onClick:()=>c("features")}),s.jsx(Qc,{label:"Bugs Fixed",value:n,icon:xl,delay:.2,clickable:!0,selected:"bugs"===o,onClick:()=>c("bugs")}),s.jsx(Qc,{label:"Complex",value:r,icon:vl,delay:.25,clickable:!0,selected:"complex"===o,onClick:()=>c("complex")}),s.jsx(Qc,{label:"Files",value:i,icon:Al,delay:.3})]}),s.jsx("div",{className:"w-px bg-border/30 self-stretch my-1"}),s.jsx(Qc,{label:"Streak",value:a,suffix:"days",icon:ac,delay:.35,variant:"accent"})]})}function Xc(e){const t=e/3600;return t<.1?\`\${t.toFixed(2)}h\`:\`\${t.toFixed(1)}h\`}function Zc(e,t){return Object.entries(e).sort((e,t)=>t[1]-e[1]).slice(0,t)}function Gc({label:e,children:t}){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-widest font-bold whitespace-nowrap",children:e}),s.jsx("div",{className:"flex items-center gap-1.5 overflow-x-auto pb-1 no-scrollbar",children:t})]})}function Jc({stats:e}){const t=Zc(e.byClient,4),n=Zc(e.byLanguage,4);return 0===t.length&&0===n.length?null:s.jsxs("div",{className:"flex flex-col gap-4 mb-8 p-4 rounded-xl bg-bg-surface-1/30 border border-border/50",children:[t.length>0&&s.jsx(Gc,{label:"Top Clients",children:t.map(([e,t])=>{const n=ic[e];return s.jsxs("span",{className:"text-[11px] font-mono px-2.5 py-1 rounded-full bg-bg-surface-1 border border-border hover:border-accent/40 transition-colors shadow-sm whitespace-nowrap group cursor-default",style:n?{borderLeftWidth:"3px",borderLeftColor:n}:void 0,title:Xc(t),children:[oc[e]??e,s.jsx("span",{className:"ml-1.5 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:Xc(t)})]},e)})}),n.length>0&&s.jsx(Gc,{label:"Languages",children:n.map(([e,t])=>s.jsxs("span",{className:"text-[11px] font-mono px-2.5 py-1 rounded-full bg-bg-surface-1 border border-border hover:border-accent/40 transition-colors shadow-sm whitespace-nowrap group cursor-default",title:Xc(t),children:[e,s.jsx("span",{className:"ml-1.5 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:Xc(t)})]},e))})]})}var eu=[{id:"sessions",label:"Sessions"},{id:"insights",label:"Insights"}];function tu({activeTab:e,onTabChange:t}){return s.jsx("div",{className:"flex gap-0.5 p-0.5 rounded-lg bg-bg-surface-1 border border-border/40",children:eu.map(({id:n,label:r})=>{const a=e===n;return s.jsx("button",{onClick:()=>t(n),className:\`\\n px-3 py-1 rounded-md text-xs font-medium transition-all duration-150\\n \${a?"bg-bg-surface-2 text-text-primary shadow-sm":"text-text-muted hover:text-text-primary"}\\n \`,children:r},n)})})}var nu={coding:"#b4f82c",debugging:"#f87171",testing:"#60a5fa",planning:"#a78bfa",reviewing:"#34d399",documenting:"#fbbf24",learning:"#f472b6",deployment:"#fb923c",devops:"#e879f9",research:"#22d3ee",migration:"#facc15",design:"#c084fc",data:"#2dd4bf",security:"#f43f5e",configuration:"#a3e635",other:"#94a3b8"};function ru(e){if(e<60)return"<1m";const t=Math.round(e/60);if(t<60)return\`\${t}m\`;return\`\${(e/3600).toFixed(1)}h\`}function au({byTaskType:e}){const t=Object.entries(e).filter(([,e])=>e>0).sort((e,t)=>t[1]-e[1]);if(0===t.length)return null;const n=t[0][1];return s.jsxs("div",{className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4 mb-8",children:[s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest mb-4 px-1",children:"Task Types"}),s.jsx("div",{className:"space-y-2.5",children:t.map(([e,t],r)=>{const a=nu[e]??nu.other,i=t/n*100;return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-text-secondary font-medium w-24 text-right shrink-0",children:(o=e,o.charAt(0).toUpperCase()+o.slice(1))}),s.jsx("div",{className:"flex-1 h-5 rounded bg-bg-surface-2/50 overflow-hidden",children:s.jsx(fl.div,{className:"h-full rounded",style:{backgroundColor:a},initial:{width:0},animate:{width:\`\${i}%\`},transition:{duration:.6,delay:.05*r,ease:[.22,1,.36,1]}})}),s.jsx("span",{className:"text-xs text-text-muted font-mono w-12 text-right shrink-0",children:ru(t)})]},e);var o})})]})}var iu={"15m":{visibleDuration:9e5,majorTickInterval:3e5,minorTickInterval:6e4,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"30m":{visibleDuration:18e5,majorTickInterval:6e5,minorTickInterval:12e4,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"1h":{visibleDuration:36e5,majorTickInterval:9e5,minorTickInterval:3e5,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"12h":{visibleDuration:432e5,majorTickInterval:72e5,minorTickInterval:18e5,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"24h":{visibleDuration:864e5,majorTickInterval:144e5,minorTickInterval:36e5,labelFormat:e=>e.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})},"7d":{visibleDuration:6048e5,majorTickInterval:864e5,minorTickInterval:216e5,labelFormat:e=>e.toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})},"30d":{visibleDuration:2592e6,majorTickInterval:6048e5,minorTickInterval:864e5,labelFormat:e=>e.toLocaleDateString([],{month:"short",day:"numeric"})}};function ou(e){if(e<60)return\`\${e}s\`;const t=Math.round(e/60);if(t<60)return\`\${t}m\`;const n=Math.floor(t/60),r=t%60;return r>0?\`\${n}h \${r}m\`:\`\${n}h\`}function su({value:e,onChange:t,scale:n,sessions:r=[],milestones:a=[],showPublic:i=!1}){const o=f.useRef(null),[l,c]=f.useState(0);f.useEffect(()=>{if(!o.current)return;const e=new ResizeObserver(e=>{for(const t of e)c(t.contentRect.width)});return e.observe(o.current),c(o.current.getBoundingClientRect().width),()=>e.disconnect()},[]);const u=iu[n],d=l>0?l/u.visibleDuration:0,[h,p]=f.useState(!1),m=f.useRef(0),g=f.useCallback(e=>{p(!0),m.current=e.clientX,e.currentTarget.setPointerCapture(e.pointerId)},[]),y=f.useCallback(n=>{if(!h||0===d)return;const r=n.clientX-m.current;m.current=n.clientX,t(e+-r/d)},[h,d,e,t]),v=f.useCallback(()=>{p(!1)},[]),x=f.useMemo(()=>{if(!l||0===d)return[];const t=e-u.visibleDuration,n=e,r=t-u.majorTickInterval,a=n+u.majorTickInterval,i=[];for(let o=Math.ceil(r/u.majorTickInterval)*u.majorTickInterval;o<=a;o+=u.majorTickInterval)i.push({type:"major",time:o,position:(o-e)*d,label:u.labelFormat(new Date(o))});for(let o=Math.ceil(r/u.minorTickInterval)*u.minorTickInterval;o<=a;o+=u.minorTickInterval)o%u.majorTickInterval!==0&&i.push({type:"minor",time:o,position:(o-e)*d});return i},[e,l,d,u]),b=f.useMemo(()=>r.map(e=>({session:e,start:new Date(e.started_at).getTime(),end:new Date(e.ended_at).getTime()})),[r]),w=f.useMemo(()=>{if(!l||0===d)return[];const t=e-u.visibleDuration,n=e;return b.filter(e=>e.start<=n&&e.end>=t).map(r=>({session:r.session,leftOffset:(Math.max(r.start,t)-e)*d,width:(Math.min(r.end,n)-Math.max(r.start,t))*d}))},[b,e,l,d,u]),k=f.useMemo(()=>a.map(e=>({milestone:e,time:new Date(e.created_at).getTime()})).sort((e,t)=>e.time-t.time),[a]),S=f.useMemo(()=>{if(!l||0===d||!k.length)return[];const t=e-u.visibleDuration,n=e;let r=0,a=k.length;for(;r<a;){const e=r+a>>1;k[e].time<t?r=e+1:a=e}const i=r;for(a=k.length;r<a;){const e=r+a>>1;k[e].time<=n?r=e+1:a=e}const o=r,s=[];for(let l=i;l<o;l++){const t=k[l];s.push({...t,offset:(t.time-e)*d})}return s},[k,e,l,d,u]),[C,j]=f.useState(null),N=f.useRef(e);return f.useEffect(()=>{C&&Math.abs(e-N.current)>1e3&&j(null),N.current=e},[e,C]),s.jsxs("div",{className:"relative h-16",children:[s.jsxs("div",{className:"absolute inset-0 bg-transparent border-t border-border/50 overflow-hidden select-none touch-none cursor-grab active:cursor-grabbing",ref:o,onPointerDown:g,onPointerMove:y,onPointerUp:v,style:{touchAction:"none"},children:[s.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[2px] bg-accent/40 z-30"}),s.jsxs("div",{className:"absolute right-0 top-0 bottom-0 w-0 pointer-events-none",children:[x.map(e=>s.jsx("div",{className:"absolute top-0 border-l "+("major"===e.type?"border-border/60":"border-border/30"),style:{left:e.position,height:"major"===e.type?"100%":"35%",bottom:0},children:"major"===e.type&&e.label&&s.jsx("span",{className:"absolute top-2 left-2 text-[9px] font-bold text-text-muted uppercase tracking-wider whitespace-nowrap bg-bg-surface-1/80 px-1 py-0.5 rounded",children:e.label})},e.time)),w.map(e=>s.jsx("div",{className:"absolute bottom-0 rounded-t-md pointer-events-auto cursor-pointer transition-opacity hover:opacity-80",style:{left:e.leftOffset,width:Math.max(e.width,3),height:"45%",backgroundColor:"rgba(var(--accent-rgb), 0.15)",borderTop:"2px solid rgba(var(--accent-rgb), 0.5)",boxShadow:"inset 0 1px 10px rgba(var(--accent-rgb), 0.05)"},onMouseEnter:t=>{const n=t.currentTarget.getBoundingClientRect();j({type:"session",data:e.session,x:n.left+n.width/2,y:n.top})},onMouseLeave:()=>j(null)},e.session.session_id)),S.map((e,n)=>s.jsx("div",{className:"absolute bottom-2 pointer-events-auto cursor-pointer z-40 transition-transform hover:scale-125",style:{left:e.offset,transform:"translateX(-50%)"},onMouseEnter:t=>{const n=t.currentTarget.getBoundingClientRect();j({type:"milestone",data:e.milestone,x:n.left+n.width/2,y:n.top})},onMouseLeave:()=>j(null),onClick:n=>{n.stopPropagation(),t(e.time)},children:s.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-bg-surface-1 shadow-lg",style:{backgroundColor:uc[e.milestone.category]??"#9c9588",boxShadow:\`0 0 10px \${uc[e.milestone.category]}50\`}})},n))]})]}),C&&hc.createPortal(s.jsx("div",{className:"fixed z-[9999] pointer-events-none",style:{left:C.x,top:C.y,transform:"translate(-50%, -100%)"},children:s.jsxs("div",{className:"mb-3 bg-bg-surface-3/95 backdrop-blur-md text-text-primary rounded-xl shadow-2xl px-3 py-2.5 text-[11px] min-w-[180px] max-w-[280px] border border-border/50 animate-in fade-in zoom-in-95 duration-200",children:["session"===C.type?s.jsx(lu,{session:C.data,showPublic:i}):s.jsx(cu,{milestone:C.data,showPublic:i}),s.jsx("div",{className:"absolute -bottom-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-bg-surface-3/95 border-r border-b border-border/50 rotate-45"})]})}),document.body)]})}function lu({session:e,showPublic:t}){const n=oc[e.client]??e.client,r=t?e.title||e.project||\`\${n} Session\`:e.private_title||e.title||e.project||\`\${n} Session\`;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-bold text-xs text-accent uppercase tracking-widest",children:n}),s.jsx("span",{className:"text-[10px] text-text-muted font-mono",children:ou(e.duration_seconds)})]}),s.jsx("div",{className:"h-px bg-border/50 my-0.5"}),s.jsx("div",{className:"text-text-primary font-medium",children:r}),s.jsx("div",{className:"text-text-secondary capitalize text-[10px]",children:e.task_type})]})}function cu({milestone:e,showPublic:t}){const n=t?e.title:e.private_title??e.title;return s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-bold text-[10px] uppercase tracking-widest",style:{color:uc[e.category]??"#9c9588"},children:e.category}),e.complexity&&s.jsx("span",{className:"text-[9px] font-mono text-text-muted font-bold border border-border/50 px-1 rounded uppercase",children:e.complexity})]}),s.jsx("div",{className:"h-px bg-border/50 my-0.5"}),s.jsx("div",{className:"font-bold text-xs break-words text-text-primary",children:n}),!t&&e.private_title&&s.jsxs("div",{className:"text-[10px] text-text-muted italic opacity-70",children:["Public: ",e.title]})]})}var uu={"15m":9e5,"30m":18e5,"1h":36e5,"12h":432e5,"24h":864e5,"7d":6048e5,"30d":2592e6},du={"15m":"15 Minutes","30m":"30 Minutes","1h":"1 Hour","12h":"12 Hours","24h":"24 Hours","7d":"7 Days","30d":"30 Days"};function fu(e,t){const n=e.trim();if(!n)return null;const r=new Date(t),a=n.match(/^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?\\s*(AM|PM)$/i);if(a){let e=parseInt(a[1],10);const t=parseInt(a[2],10),n=a[3]?parseInt(a[3],10):0,i=a[4].toUpperCase();return e<1||e>12||t>59||n>59?null:("AM"===i&&12===e&&(e=0),"PM"===i&&12!==e&&(e+=12),r.setHours(e,t,n,0),r.getTime())}const i=n.match(/^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/);if(i){const e=parseInt(i[1],10),t=parseInt(i[2],10),n=i[3]?parseInt(i[3],10):0;return e>23||t>59||n>59?null:(r.setHours(e,t,n,0),r.getTime())}return null}var hu=["15m","30m","1h","12h","24h","7d","30d"];function pu({value:e,onChange:t,scale:n,onScaleChange:r,sessions:a,showPublic:i=!1}){const o=null===e,[l,c]=f.useState(Date.now());f.useEffect(()=>{if(!o)return;const e=setInterval(()=>c(Date.now()),1e3);return()=>clearInterval(e)},[o]);const u=o?l:e,[d,h]=f.useState(!1),[p,m]=f.useState(""),g=f.useRef(null),y=f.useRef(!1),v=f.useRef(""),x=f.useRef(!1),b=f.useRef(0),w=f.useCallback(e=>{const n=Date.now();if(e>=n-2e3)return x.current=!0,b.current=n,void t(null);x.current&&n-b.current<300||x.current&&e>=n-1e4?t(null):(x.current=!1,t(e))},[t]),k=e=>{const n=u+e;n>=Date.now()-6e4?t(null):t(n)},S=()=>{y.current=o,t(u);const e=new Date(u).toLocaleTimeString([],{hour12:!0,hour:"2-digit",minute:"2-digit",second:"2-digit"});v.current=e,m(e),h(!0),requestAnimationFrame(()=>g.current?.select())},C=()=>{if(h(!1),y.current&&p===v.current)return void t(null);const e=fu(p,u);null!==e&&t(Math.min(e,Date.now()))};return s.jsxs("div",{className:"flex flex-col bg-bg-surface-1 border border-border/50 rounded-2xl overflow-hidden mb-8 shadow-xl",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between px-6 py-3 border-b border-border/50 gap-4",children:[s.jsxs("div",{className:"flex flex-col items-start gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2 h-8",children:[d?s.jsx("input",{ref:g,type:"text",value:p,onChange:e=>m(e.target.value),onBlur:C,onKeyDown:e=>{if("Enter"===e.key)return void C();if("Escape"===e.key)return e.preventDefault(),h(!1),void(y.current&&t(null));if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const n=g.current;if(!n)return;const r=n.selectionStart??0,a="ArrowUp"===e.key?1:-1,i=fu(p,u);if(null===i)return;const o=p.indexOf(":"),s=p.indexOf(":",o+1),l=p.lastIndexOf(" ");let c;c=r<=o?36e5*a:s>-1&&r<=s?6e4*a:l>-1&&r<=l?1e3*a:12*a*36e5;const d=Math.min(i+c,Date.now()),f=new Date(d).toLocaleTimeString([],{hour12:!0,hour:"2-digit",minute:"2-digit",second:"2-digit"});m(f),t(d),requestAnimationFrame(()=>{n&&n.setSelectionRange(r,r)})},className:"text-xl font-mono font-bold tracking-tight bg-bg-surface-2 border rounded-lg px-2 -ml-2 w-[155px] outline-none text-text-primary "+(o?"border-accent":"border-history"),style:{boxShadow:o?"0 0 10px rgba(var(--accent-rgb), 0.2)":"0 0 10px rgba(var(--history-rgb), 0.2)"}}):s.jsxs("button",{onClick:S,className:"group flex items-center gap-2 hover:bg-bg-surface-2/50 rounded-lg px-2 -ml-2 py-1 transition-all cursor-text",title:"Click to edit time",children:[s.jsx(Tl,{className:"w-5 h-5 "+(o?"text-text-muted":"text-history")}),s.jsx("span",{className:"text-xl font-mono font-bold tracking-tight tabular-nums "+(o?"text-text-primary":"text-history"),children:new Date(u).toLocaleTimeString([],{hour12:!0,hour:"2-digit",minute:"2-digit",second:"2-digit"})})]}),s.jsx("button",{onClick:d?C:S,className:"p-1.5 rounded-lg transition-colors flex-shrink-0 "+(d?o?"bg-accent text-white hover:bg-accent-bright":"bg-history text-white hover:brightness-110":"text-text-muted hover:text-text-primary hover:bg-bg-surface-2"),title:d?"Confirm time":"Edit time",children:s.jsx(Hl,{className:"w-3.5 h-3.5"})})]}),o?s.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 text-[10px] font-bold uppercase tracking-widest bg-success/10 text-success rounded-full border border-success/20",style:{boxShadow:"0 0 10px rgba(var(--accent-rgb), 0.1)"},children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),"Live"]}):s.jsx("div",{className:"flex items-center gap-1.5 px-2.5 py-1 text-[10px] font-bold uppercase tracking-widest bg-history/10 text-history rounded-full border border-history/20",children:"History"})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-secondary font-medium px-0.5",children:[s.jsx(bl,{className:"w-3.5 h-3.5 text-text-muted"}),new Date(u).toLocaleDateString([],{weekday:"short",month:"long",day:"numeric",year:"numeric"})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[s.jsx("div",{className:"flex items-center bg-bg-surface-2/50 border border-border/50 rounded-xl p-1 shadow-inner",children:hu.map(e=>s.jsx("button",{onClick:()=>r(e),className:"px-3 py-1.5 text-[10px] font-bold uppercase tracking-wider rounded-lg transition-all "+(n===e?"bg-bg-surface-3 text-text-primary shadow-sm":"text-text-muted hover:text-text-primary hover:bg-bg-surface-2"),title:du[e],children:e},e))}),s.jsxs("div",{className:"flex items-center gap-2",children:[!o&&s.jsxs("button",{onClick:()=>t(null),className:"group flex items-center gap-2 px-4 py-2 text-[10px] font-bold uppercase tracking-widest bg-history/10 hover:bg-history text-history hover:text-white rounded-xl transition-all border border-history/20",children:[s.jsx(Yl,{className:"w-3.5 h-3.5 group-hover:-rotate-90 transition-transform duration-500"}),"Live"]}),s.jsxs("div",{className:"flex items-center gap-1 bg-bg-surface-2/50 border border-border/50 rounded-xl p-1",children:[s.jsx("button",{onClick:()=>k(-uu[n]),className:"p-2 text-text-muted hover:text-text-primary hover:bg-bg-surface-2 rounded-lg transition-colors",title:\`Back \${du[n]}\`,children:s.jsx(Sl,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>k(uu[n]),className:"p-2 text-text-muted hover:text-text-primary hover:bg-bg-surface-2 rounded-lg transition-colors disabled:opacity-20 disabled:cursor-not-allowed",title:\`Forward \${du[n]}\`,disabled:o||u>=Date.now()-1e3,children:s.jsx(Cl,{className:"w-4 h-4"})})]})]})]})]}),s.jsx(su,{value:u,onChange:w,scale:n,sessions:a,milestones:void 0,showPublic:i})]})}const mu=(gu=(e,t)=>({sessions:[],milestones:[],config:null,health:null,updateInfo:null,loading:!0,timeTravelTime:null,timeScale:(()=>{try{const e=localStorage.getItem("useai-time-scale");if(e&&["15m","30m","1h","12h","24h","7d","30d"].includes(e))return e}catch{}return"1h"})(),filters:{category:"all",client:"all",project:"all",language:"all"},activeTab:(()=>{try{const e=localStorage.getItem("useai-active-tab");if("sessions"===e||"insights"===e)return e}catch{}return"sessions"})(),loadAll:async()=>{try{const[t,n,r]=await Promise.all([_("/api/local/sessions"),_("/api/local/milestones"),_("/api/local/config")]);e({sessions:t,milestones:n,config:r,loading:!1})}catch{e({loading:!1})}},loadHealth:async()=>{try{const t=await _("/health");e({health:t})}catch{}},loadUpdateCheck:async()=>{try{const t=await _("/api/local/update-check");e({updateInfo:t})}catch{}},setTimeTravelTime:t=>e({timeTravelTime:t}),setTimeScale:t=>{try{localStorage.setItem("useai-time-scale",t)}catch{}e({timeScale:t})},setFilter:(t,n)=>e(e=>({filters:{...e.filters,[t]:n}})),setActiveTab:t=>{try{localStorage.setItem("useai-active-tab",t)}catch{}e({activeTab:t})},deleteSession:async n=>{const r={sessions:t().sessions,milestones:t().milestones};e({sessions:r.sessions.filter(e=>e.session_id!==n),milestones:r.milestones.filter(e=>e.session_id!==n)});try{await function(e){return R(\`/api/local/sessions/\${encodeURIComponent(e)}\`)}(n)}catch{e(r)}},deleteConversation:async n=>{const r={sessions:t().sessions,milestones:t().milestones},a=new Set(r.sessions.filter(e=>e.conversation_id===n).map(e=>e.session_id));e({sessions:r.sessions.filter(e=>e.conversation_id!==n),milestones:r.milestones.filter(e=>!a.has(e.session_id))});try{await function(e){return R(\`/api/local/conversations/\${encodeURIComponent(e)}\`)}(n)}catch{e(r)}},deleteMilestone:async n=>{const r={milestones:t().milestones};e({milestones:r.milestones.filter(e=>e.id!==n)});try{await function(e){return R(\`/api/local/milestones/\${encodeURIComponent(e)}\`)}(n)}catch{e(r)}}}))?A(gu):A;var gu;function yu(e){if(0===e.length)return 0;const t=new Set;for(const o of e)t.add(o.started_at.slice(0,10));const n=[...t].sort().reverse();if(0===n.length)return 0;const r=(new Date).toISOString().slice(0,10),a=new Date(Date.now()-864e5).toISOString().slice(0,10);if(n[0]!==r&&n[0]!==a)return 0;let i=1;for(let o=1;o<n.length;o++){const e=new Date(n[o-1]),t=new Date(n[o]);if(1!==(e.getTime()-t.getTime())/864e5)break;i++}return i}function vu({className:e}){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 611.54 143.47",className:e,children:[s.jsxs("g",{fill:"var(--text-primary)",children:[s.jsx("path",{d:"M21.4,121.85c-4.57-4.57-6.85-10.02-6.85-16.37V17.23c0-3.1,1.55-4.65,4.64-4.65h25.55c3.1,0,4.65,1.55,4.65,4.65v76.64c0,3.25,1.12,6,3.37,8.25,2.24,2.25,4.99,3.37,8.25,3.37h27.87c3.25,0,6-1.12,8.25-3.37,2.24-2.24,3.37-4.99,3.37-8.25V17.23c0-3.1,1.55-4.65,4.64-4.65h25.55c3.1,0,4.65,1.55,4.65,4.65v88.25c0,6.35-2.29,11.81-6.85,16.37-4.57,4.57-10.03,6.85-16.37,6.85H37.78c-6.35,0-11.81-2.28-16.37-6.85Z"}),s.jsx("path",{d:"M146.93,124.06v-13.93c0-3.1,1.55-4.65,4.64-4.65h69.67c3.25,0,6-1.12,8.25-3.37,2.24-2.24,3.37-4.99,3.37-8.25s-1.12-6-3.37-8.25c-2.25-2.24-4.99-3.37-8.25-3.37h-51.09c-6.35,0-11.81-2.28-16.37-6.85-4.57-4.57-6.85-10.02-6.85-16.37v-23.22c0-6.35,2.28-11.81,6.85-16.37,4.56-4.57,10.02-6.85,16.37-6.85h92.9c3.1,0,4.65,1.55,4.65,4.65v13.94c0,3.1-1.55,4.65-4.65,4.65h-69.67c-3.25,0-6,1.12-8.25,3.37-2.25,2.25-3.37,4.99-3.37,8.25s1.12,6,3.37,8.25c2.24,2.25,4.99,3.37,8.25,3.37h51.09c6.35,0,11.8,2.29,16.37,6.85,4.57,4.57,6.85,10.03,6.85,16.37v23.22c0,6.35-2.29,11.81-6.85,16.37-4.57,4.57-10.03,6.85-16.37,6.85h-92.9c-3.1,0-4.64-1.55-4.64-4.65Z"}),s.jsx("path",{d:"M286.16,121.85c-4.57-4.57-6.85-10.02-6.85-16.37V35.81c0-6.35,2.28-11.81,6.85-16.37,4.56-4.57,10.02-6.85,16.37-6.85h74.32c6.35,0,11.8,2.29,16.37,6.85,4.57,4.57,6.85,10.03,6.85,16.37v23.22c0,6.35-2.29,11.81-6.85,16.37-4.57,4.57-10.03,6.85-16.37,6.85h-62.71v11.61c0,3.25,1.12,6,3.37,8.25,2.24,2.25,4.99,3.37,8.25,3.37h69.67c3.1,0,4.65,1.55,4.65,4.65v13.93c0,3.1-1.55,4.65-4.65,4.65h-92.9c-6.35,0-11.81-2.28-16.37-6.85ZM361.87,55.66c2.24-2.24,3.37-4.99,3.37-8.25s-1.12-6-3.37-8.25c-2.25-2.24-4.99-3.37-8.25-3.37h-27.87c-3.25,0-6,1.12-8.25,3.37-2.25,2.25-3.37,4.99-3.37,8.25v11.61h39.48c3.25,0,6-1.12,8.25-3.37Z"})]}),s.jsxs("g",{fill:"var(--accent)",children:[s.jsx("path",{d:"M432.08,126.44c-4.76-4.76-7.14-10.44-7.14-17.06v-24.2c0-6.61,2.38-12.3,7.14-17.06,4.76-4.76,10.44-7.14,17.06-7.14h65.34v-12.1c0-3.39-1.17-6.25-3.51-8.59-2.34-2.34-5.2-3.51-8.59-3.51h-72.6c-3.23,0-4.84-1.61-4.84-4.84v-14.52c0-3.23,1.61-4.84,4.84-4.84h96.8c6.61,0,12.3,2.38,17.06,7.14,4.76,4.76,7.14,10.45,7.14,17.06v72.6c0,6.62-2.38,12.3-7.14,17.06-4.76,4.76-10.45,7.14-17.06,7.14h-77.44c-6.62,0-12.3-2.38-17.06-7.14ZM510.97,105.87c2.34-2.34,3.51-5.2,3.51-8.59v-12.1h-41.14c-3.39,0-6.25,1.17-8.59,3.51-2.34,2.34-3.51,5.2-3.51,8.59s1.17,6.25,3.51,8.59c2.34,2.34,5.2,3.51,8.59,3.51h29.04c3.39,0,6.25-1.17,8.59-3.51Z"}),s.jsx("path",{d:"M562.87,128.74V17.42c0-3.23,1.61-4.84,4.84-4.84h26.62c3.23,0,4.84,1.61,4.84,4.84v111.32c0,3.23-1.61,4.84-4.84,4.84h-26.62c-3.23,0-4.84-1.61-4.84-4.84Z"})]})]})}const xu="npx -y @devness/useai@latest update";function bu({updateInfo:e}){const[t,n]=f.useState(!1),[r,a]=f.useState(!1);return s.jsxs("div",{className:"relative",children:[s.jsxs("button",{onClick:()=>n(e=>!e),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-accent/10 border border-accent/20 text-xs font-medium text-accent hover:bg-accent/15 transition-colors",children:[s.jsx(Nl,{className:"w-3 h-3"}),"v",e.latest," available"]}),t&&s.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-72 rounded-lg bg-bg-surface-1 border border-border shadow-lg p-3 space-y-2",children:[s.jsxs("p",{className:"text-xs text-text-muted",children:["Update from ",s.jsxs("span",{className:"font-mono text-text-secondary",children:["v",e.current]})," to ",s.jsxs("span",{className:"font-mono text-accent",children:["v",e.latest]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"flex-1 text-[11px] font-mono bg-bg-base px-2 py-1.5 rounded border border-border text-text-secondary truncate",children:xu}),s.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(xu),a(!0),setTimeout(()=>a(!1),2e3)}catch{}},className:"p-1.5 rounded-md border border-border bg-bg-base text-text-muted hover:text-text-primary hover:border-text-muted/50 transition-colors shrink-0",title:"Copy command",children:r?s.jsx(wl,{className:"w-3.5 h-3.5 text-success"}):s.jsx(Pl,{className:"w-3.5 h-3.5"})})]})]})]})}function wu({health:e,updateInfo:t,timeContextLabel:n,activeTab:r,onTabChange:a,onSearchOpen:i}){return s.jsx("header",{className:"sticky top-0 z-50 bg-bg-base/80 backdrop-blur-md border-b border-border mb-4",children:s.jsxs("div",{className:"max-w-[1000px] mx-auto px-6 py-3 flex items-center justify-between relative",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx(vu,{className:"h-6"})}),s.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:s.jsx(tu,{activeTab:r,onTabChange:a})}),s.jsxs("div",{className:"flex items-center gap-4",children:[i&&s.jsxs("button",{onClick:i,className:"flex items-center gap-2 px-2.5 py-1.5 rounded-md border border-border/50 bg-bg-surface-1 text-text-muted hover:text-text-primary hover:border-text-muted/50 transition-colors text-xs",children:[s.jsx(Ql,{className:"w-3 h-3"}),s.jsx("span",{className:"hidden sm:inline",children:"Search"}),s.jsx("kbd",{className:"hidden sm:inline-flex items-center px-1 py-0.5 rounded border border-border bg-bg-base text-[9px] font-mono leading-none",children:"\u2318K"})]}),t?.update_available&&s.jsx(bu,{updateInfo:t}),e&&e.active_sessions>0&&s.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-success/10 border border-success/20",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-success animate-ping absolute inset-0"}),s.jsx("div",{className:"w-2 h-2 rounded-full bg-success relative"})]}),s.jsxs("span",{className:"text-xs font-medium text-success",children:[e.active_sessions," active session",1!==e.active_sessions?"s":""]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted font-mono bg-bg-surface-1 px-3 py-1.5 rounded-md border border-border",children:[s.jsx(yl,{className:"w-3 h-3"}),n]})]})]})})}const ku={category:"all",client:"all",project:"all",language:"all"};function Su({open:e,onClose:t,sessions:n,milestones:r,deleteSession:a,deleteConversation:i,deleteMilestone:o}){const[l,c]=f.useState(""),[u,d]=f.useState(""),[h,p]=f.useState(!1),m=f.useRef(null);f.useEffect(()=>{e&&(c(""),d(""),requestAnimationFrame(()=>m.current?.focus()))},[e]),f.useEffect(()=>{if(!e)return;const t=document.documentElement;return t.style.overflow="hidden",document.body.style.overflow="hidden",()=>{t.style.overflow="",document.body.style.overflow=""}},[e]),f.useEffect(()=>{if(!e)return;const n=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t]),f.useEffect(()=>{const e=setTimeout(()=>d(l),250);return()=>clearTimeout(e)},[l]);const g=f.useMemo(()=>{const e=new Map;for(const t of r){const n=e.get(t.session_id);n?n.push(t):e.set(t.session_id,[t])}return e},[r]),{filteredSessions:y,filteredMilestones:v,highlightWords:x}=f.useMemo(()=>{const e=u.trim().toLowerCase();if(!e)return{filteredSessions:[],filteredMilestones:[],highlightWords:[]};const t=e.split(/\\s+/),a=n.filter(e=>function(e,t,n,r){const a=(r?[e.title,e.client,e.task_type,...e.languages,...t.map(e=>e.title)]:[e.private_title,e.title,e.client,e.task_type,...e.languages,...t.map(e=>e.private_title),...t.map(e=>e.title)]).filter(Boolean).join(" ").toLowerCase();return n.every(e=>a.includes(e))}(e,g.get(e.session_id)??[],t,h)),i=new Set(a.map(e=>e.session_id));return{filteredSessions:a,filteredMilestones:r.filter(e=>i.has(e.session_id)),highlightWords:t}},[n,r,g,u,h]),b=u.trim().length>0;return s.jsx(Ko,{children:e&&s.jsxs(s.Fragment,{children:[s.jsx(fl.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-[60]",onClick:t}),s.jsx(fl.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15},className:"fixed inset-0 z-[61] flex items-start justify-center pt-[10vh] px-4 pointer-events-none",children:s.jsxs("div",{className:"w-full max-w-2xl bg-bg-base border border-border/50 rounded-xl shadow-2xl flex flex-col max-h-[75vh] pointer-events-auto",onClick:e=>e.stopPropagation(),children:[s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border/50",children:[s.jsx(Ql,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),s.jsx("input",{ref:m,type:"text",value:l,onChange:e=>c(e.target.value),placeholder:h?"Search public titles...":"Search all sessions and milestones...",className:"flex-1 bg-transparent text-sm text-text-primary placeholder:text-text-muted/50 outline-none"}),l&&s.jsx("button",{onClick:()=>{c(""),m.current?.focus()},className:"p-1 rounded-md hover:bg-bg-surface-2 text-text-muted hover:text-text-primary transition-colors",children:s.jsx(rc,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>p(e=>!e),className:"p-1.5 rounded-md border transition-all duration-200 flex-shrink-0 "+(h?"bg-success/10 border-success/30 text-success":"bg-bg-surface-1 border-border/50 text-text-muted hover:text-text-primary hover:border-text-muted/50"),title:h?"Searching public titles":"Searching private titles",children:h?s.jsx(Dl,{className:"w-3.5 h-3.5"}):s.jsx(Ll,{className:"w-3.5 h-3.5"})}),s.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded border border-border bg-bg-surface-1 text-[10px] font-mono text-text-muted",children:"esc"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto overscroll-none px-4 py-3",children:b?0===y.length?s.jsxs("div",{className:"text-center py-12 text-sm text-text-muted/60",children:["No results for \u201C",u.trim(),"\u201D"]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-[10px] font-mono text-text-muted uppercase tracking-wider mb-3 px-1",children:[y.length," result",1!==y.length?"s":""]}),s.jsx(Oc,{sessions:y,milestones:v,filters:ku,globalShowPublic:h||void 0,showFullDate:!0,highlightWords:x,onDeleteSession:a,onDeleteConversation:i,onDeleteMilestone:o})]}):s.jsx("div",{className:"text-center py-12 text-sm text-text-muted/60",children:"Type to search across all sessions"})})]})})]})})}function Cu(e){if(!e)return"Never synced";const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"Just now";if(n<60)return\`\${n}m ago\`;const r=Math.floor(n/60);if(r<24)return\`\${r}h ago\`;return\`\${Math.floor(r/24)}d ago\`}function ju({config:e,onRefresh:t}){const[n,r]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState("email"),[c,u]=f.useState(!1),[d,h]=f.useState(null),p=f.useCallback(async()=>{if(n.includes("@")){u(!0),h(null);try{await function(e){return z("/api/local/auth/send-otp",{email:e})}(n),l("otp")}catch(e){h(e.message)}finally{u(!1)}}},[n]),m=f.useCallback(async()=>{if(/^\\d{6}$/.test(a)){u(!0),h(null);try{await function(e,t){return z("/api/local/auth/verify-otp",{email:e,code:t})}(n,a),t()}catch(e){h(e.message)}finally{u(!1)}}},[n,a,t]);if(!e)return null;if(e.authenticated){const n=async()=>{u(!0),h(null);try{const e=await z("/api/local/sync");e.success?(h("Synced!"),t(),setTimeout(()=>h(null),3e3)):h(e.error??"Sync failed")}catch(e){h(e.message)}finally{u(!1)}};return s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 p-4 mt-12 bg-bg-surface-1/50 rounded-2xl border border-border/50 backdrop-blur-sm",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-accent/10 flex items-center justify-center border border-accent/20",children:s.jsx(tc,{className:"w-4 h-4 text-accent"})}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-xs font-bold text-text-primary",children:e.email}),s.jsxs("span",{className:"text-[10px] text-text-muted font-mono uppercase tracking-tighter",children:["Last sync: ",Cu(e.last_sync_at)]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[d&&s.jsx("span",{className:\`text-[10px] font-bold uppercase tracking-widest \${"Synced!"===d?"text-success":"text-error"} mr-2\`,children:d}),s.jsxs("button",{onClick:n,disabled:c,className:"group flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent-bright text-white text-xs font-bold rounded-lg transition-all duration-300 shadow-lg shadow-accent/20 disabled:opacity-50 cursor-pointer overflow-hidden relative",children:[s.jsx(Wl,{className:"w-3.5 h-3.5 "+(c?"animate-spin":"group-hover:rotate-180 transition-transform duration-500")}),c?"Syncing...":"Sync Now"]}),s.jsx("button",{onClick:async()=>{await z("/api/local/auth/logout"),t()},title:"Sign out",className:"flex items-center justify-center w-9 h-9 rounded-lg border border-border/50 hover:border-error/50 hover:bg-error/10 text-text-muted hover:text-error transition-all duration-200 cursor-pointer",children:s.jsx($l,{className:"w-3.5 h-3.5"})})]})]})}return s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 p-4 mt-12 bg-bg-surface-1/50 rounded-2xl border border-border/50 backdrop-blur-sm",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-bg-surface-2 flex items-center justify-center border border-border",children:s.jsx(Kl,{className:"w-4 h-4 text-text-muted"})}),s.jsx("span",{className:"text-xs font-bold text-text-secondary uppercase tracking-widest",children:"Sign in to sync"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[d&&s.jsx("span",{className:"text-[10px] font-bold text-error uppercase tracking-widest mr-2",children:d}),"email"===o?s.jsxs("div",{className:"flex items-center bg-bg-base border border-border rounded-lg overflow-hidden focus-within:border-accent/50 focus-within:ring-1 focus-within:ring-accent/50 transition-all",children:[s.jsx("div",{className:"pl-3 py-2",children:s.jsx(Bl,{className:"w-3.5 h-3.5 text-text-muted"})}),s.jsx("input",{type:"email",placeholder:"you@email.com",value:n,onChange:e=>r(e.target.value),onKeyDown:e=>"Enter"===e.key&&p(),className:"px-3 py-2 text-xs bg-transparent text-text-primary outline-none w-40 placeholder:text-text-muted/50"}),s.jsx("button",{onClick:p,disabled:c||!n.includes("@"),className:"px-4 py-2 bg-bg-surface-2 hover:bg-bg-surface-3 text-text-primary text-[10px] font-bold uppercase tracking-wider transition-colors disabled:opacity-50 cursor-pointer border-l border-border",children:c?"...":"Send"})]}):s.jsxs("div",{className:"flex items-center bg-bg-base border border-border rounded-lg overflow-hidden focus-within:border-accent/50 focus-within:ring-1 focus-within:ring-accent/50 transition-all",children:[s.jsx("input",{type:"text",maxLength:6,placeholder:"000000",inputMode:"numeric",autoComplete:"one-time-code",value:a,onChange:e=>i(e.target.value),onKeyDown:e=>"Enter"===e.key&&m(),autoFocus:!0,className:"px-4 py-2 text-xs bg-transparent text-text-primary text-center font-mono tracking-widest outline-none w-32 placeholder:text-text-muted/50"}),s.jsx("button",{onClick:m,disabled:c||6!==a.length,className:"px-4 py-2 bg-accent hover:bg-accent-bright text-white text-[10px] font-bold uppercase tracking-wider transition-colors disabled:opacity-50 cursor-pointer",children:c?"...":"Verify"})]})]})]})}function Nu({evaluation:e}){const t=function(e){const t=[];return e.prompt_quality<4&&t.push({metric:"Prompt Quality",score:e.prompt_quality,priority:.3*(4-e.prompt_quality),message:e.prompt_quality<3?\`Your prompt_quality score averages \${e.prompt_quality.toFixed(1)}. Try including acceptance criteria and specific expected behavior in your prompts.\`:\`Your prompt_quality score averages \${e.prompt_quality.toFixed(1)}. Adding edge cases and constraints to your prompts could push this higher.\`}),e.context_provided<4&&t.push({metric:"Context",score:e.context_provided,priority:.25*(4-e.context_provided),message:e.context_provided<3?\`Try providing more file context -- your context_provided score averages \${e.context_provided.toFixed(1)}. Share relevant files, error logs, and constraints upfront.\`:\`Your context_provided score averages \${e.context_provided.toFixed(1)}. Including related config files or architecture notes could help.\`}),e.scope_quality<4&&t.push({metric:"Scope",score:e.scope_quality,priority:.2*(4-e.scope_quality),message:e.scope_quality<3?\`Your scope_quality averages \${e.scope_quality.toFixed(1)}. Try breaking large tasks into focused, well-defined subtasks before starting.\`:\`Your scope_quality averages \${e.scope_quality.toFixed(1)}. Defining clear boundaries for what is in and out of scope could improve efficiency.\`}),e.independence_level<4&&t.push({metric:"Independence",score:e.independence_level,priority:.25*(4-e.independence_level),message:e.independence_level<3?\`Your independence_level averages \${e.independence_level.toFixed(1)}. Providing a clear spec with decisions made upfront can reduce back-and-forth.\`:\`Your independence_level averages \${e.independence_level.toFixed(1)}. Pre-deciding ambiguous choices in your prompt can help the AI execute autonomously.\`}),t.sort((e,t)=>t.priority-e.priority),t.slice(0,3)}(e);return 0===t.length?s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-success/10",children:s.jsx(Ol,{className:"w-3.5 h-3.5 text-success"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Tips"})]}),s.jsx("p",{className:"text-xs text-success",children:"All evaluation scores are 4+ -- great work! Keep it up."})]}):s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-bg-surface-2",children:s.jsx(Ol,{className:"w-3.5 h-3.5 text-accent"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Improvement Tips"})]}),s.jsx("ul",{className:"space-y-3",children:t.map((e,t)=>{return s.jsxs(fl.li,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.25+.08*t},className:"flex gap-3",children:[s.jsxs("div",{className:"flex flex-col items-center shrink-0 mt-0.5",children:[s.jsx("span",{className:"text-xs font-mono font-bold "+(n=e.score,n>=4?"text-success":n>=3?"text-accent":"text-warning"),children:e.score.toFixed(1)}),s.jsx("span",{className:"text-[8px] text-text-muted font-mono uppercase",children:"/5"})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-[10px] font-mono text-text-muted uppercase tracking-wider",children:e.metric}),s.jsx("p",{className:"text-xs text-text-secondary leading-relaxed mt-0.5",children:e.message})]})]},e.metric);var n})})]})}const Tu=[{key:"simple",label:"Simple",color:"#34d399"},{key:"medium",label:"Medium",color:"#fbbf24"},{key:"complex",label:"Complex",color:"#f87171"}];function Eu({data:e}){const t=e.simple+e.medium+e.complex;if(0===t)return null;const n=Math.max(e.simple,e.medium,e.complex);return s.jsxs(fl.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.15},className:"rounded-xl bg-bg-surface-1 border border-border/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-bg-surface-2",children:s.jsx(Fl,{className:"w-3.5 h-3.5 text-text-muted"})}),s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Complexity"})]}),s.jsx("div",{className:"space-y-3",children:Tu.map((r,a)=>{const i=e[r.key],o=n>0?i/n*100:0,l=t>0?(i/t*100).toFixed(0):"0";return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-text-secondary font-medium w-16 text-right shrink-0",children:r.label}),s.jsx("div",{className:"flex-1 h-5 rounded bg-bg-surface-2/50 overflow-hidden",children:s.jsx(fl.div,{className:"h-full rounded",style:{backgroundColor:r.color},initial:{width:0},animate:{width:\`\${o}%\`},transition:{duration:.6,delay:.08*a,ease:[.22,1,.36,1]}})}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("span",{className:"text-xs text-text-primary font-mono font-bold w-6 text-right",children:i}),s.jsxs("span",{className:"text-[10px] text-text-muted/70 font-mono w-8 text-right",children:[l,"%"]})]})]},r.key)})}),s.jsx("div",{className:"mt-4 flex h-2 rounded-full overflow-hidden bg-bg-surface-2/30",children:Tu.map(n=>{const r=e[n.key],a=t>0?r/t*100:0;return 0===a?null:s.jsx(fl.div,{className:"h-full",style:{backgroundColor:n.color},initial:{width:0},animate:{width:\`\${a}%\`},transition:{duration:.8,ease:[.22,1,.36,1]}},n.key)})})]})}function Pu({filteredSessions:e,filteredMilestones:t,filters:n,onFilterChange:r,onDeleteSession:a,onDeleteConversation:i,onDeleteMilestone:o,globalShowPublic:l,onToggleShowPublic:c,showFullDate:u,outsideWindowCounts:d,onNavigateNewer:h,onNavigateOlder:p}){const[m,g]=f.useState(!1),y="all"!==n.client||"all"!==n.language||"all"!==n.project;return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-sm font-bold text-text-muted uppercase tracking-widest",children:"Activity Feed"}),s.jsxs("span",{className:"text-[10px] text-text-muted font-mono bg-bg-surface-2 px-2 py-0.5 rounded",children:[e.length," Sessions"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:c,className:"p-1.5 rounded-md border transition-all duration-200 "+(l?"bg-success/10 border-success/30 text-success":"bg-bg-surface-1 border-border/50 text-text-muted hover:text-text-primary hover:border-text-muted/50"),title:l?"Showing public titles":"Showing private titles",children:l?s.jsx(Dl,{className:"w-3.5 h-3.5"}):s.jsx(Ll,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:()=>g(e=>!e),className:"p-1.5 rounded-md border transition-all duration-200 "+(m||y?"bg-accent/10 border-accent/30 text-accent":"bg-bg-surface-1 border-border/50 text-text-muted hover:text-text-primary hover:border-text-muted/50"),children:s.jsx(zl,{className:"w-3.5 h-3.5"})})]})]}),m&&s.jsx(Cc,{sessions:e,filters:n,onFilterChange:r}),s.jsx(Oc,{sessions:e,milestones:t,filters:n,globalShowPublic:l,showFullDate:u,outsideWindowCounts:d,onNavigateNewer:h,onNavigateOlder:p,onDeleteSession:a,onDeleteConversation:i,onDeleteMilestone:o})]})}function Mu(){const{sessions:e,milestones:t,config:n,health:r,updateInfo:a,loading:i,timeTravelTime:o,timeScale:l,filters:c,activeTab:u,loadAll:d,loadHealth:h,loadUpdateCheck:p,setTimeTravelTime:m,setTimeScale:g,setFilter:y,setActiveTab:v,deleteSession:x,deleteConversation:b,deleteMilestone:w}=mu();f.useEffect(()=>{d(),h(),p()},[d,h,p]),f.useEffect(()=>{const e=setInterval(h,3e4);if(null!==o)return()=>clearInterval(e);const t=setInterval(d,3e4);return()=>{clearInterval(e),clearInterval(t)}},[o,d,h]);const[k,S]=f.useState(null),[C,j]=f.useState(!1),[N,T]=f.useState(!1);f.useEffect(()=>{const e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),T(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]);const E=null===o,P=o??Date.now(),M=P-uu[l],L=P,D=f.useMemo(()=>function(e,t,n){return e.filter(e=>{const r=new Date(e.started_at).getTime(),a=new Date(e.ended_at).getTime();return r<=n&&a>=t})}(e,M,L),[e,M,L]),A=f.useMemo(()=>function(e,t,n){return e.filter(e=>{const r=new Date(e.created_at).getTime();return r>=t&&r<=n})}(t,M,L),[t,M,L]),_=f.useMemo(()=>{const t=function(e,t,n){let r=0,a=0;for(const i of e){const e=new Date(i.ended_at).getTime(),o=new Date(i.started_at).getTime();e<t?r++:o>n&&a++}return{before:r,after:a}}(e,M,L);if(E&&0===t.before)return;const n=uu[l],r=du[l],a=e=>new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}),i=n>=864e5?e=>\`\${new Date(e).toLocaleDateString([],{month:"short",day:"numeric"})} \${a(e)}\`:a,o=\`View prev \${r} \xB7 \${i(M-n)} \u2013 \${i(M)}\`;if(E)return{before:t.before,after:0,olderLabel:o};const s=L+n;return{...t,newerLabel:\`View next \${r} \xB7 \${i(L)} \u2013 \${i(s)}\`,olderLabel:o}},[e,M,L,E,l]),z=f.useCallback(()=>{const e=P+uu[l];e>=Date.now()-6e4?m(null):m(e)},[P,l,m]),R=f.useCallback(()=>{m(P-uu[l])},[P,l,m]),V=f.useMemo(()=>function(e,t=[]){let n=0,r=0;const a={},i={},o={},s={};for(const c of e){n+=c.duration_seconds,r+=c.files_touched,a[c.client]=(a[c.client]??0)+c.duration_seconds;for(const e of c.languages)i[e]=(i[e]??0)+c.duration_seconds;o[c.task_type]=(o[c.task_type]??0)+c.duration_seconds,c.project&&(s[c.project]=(s[c.project]??0)+c.duration_seconds)}const l=function(e){let t=0,n=0,r=0;for(const a of e)"feature"===a.category&&t++,"bugfix"===a.category&&n++,"complex"===a.complexity&&r++;return{featuresShipped:t,bugsFixed:n,complexSolved:r}}(t);return{totalHours:n/3600,totalSessions:e.length,currentStreak:yu(e),filesTouched:r,...l,byClient:a,byLanguage:i,byTaskType:o,byProject:s}}(D,A),[D,A]),F=f.useMemo(()=>yu(e),[e]),O=f.useMemo(()=>function(e,t,n){if(n)return"Live";const r=new Date((e+t)/2),a=new Date,i=new Date(Date.now()-864e5);return r.toDateString()===a.toDateString()?"Today":r.toDateString()===i.toDateString()?"Yesterday":r.toLocaleDateString([],{month:"short",day:"numeric"})}(M,L,E),[M,L,E]),I=f.useMemo(()=>{if(!E)return new Date(P).toISOString().slice(0,10)},[E,P]),$=f.useMemo(()=>{const e=D.filter(e=>null!=e.evaluation);if(0===e.length)return null;let t=0,n=0,r=0,a=0;for(const o of e){const e=o.evaluation;t+=e.prompt_quality,n+=e.context_provided,r+=e.scope_quality,a+=e.independence_level}const i=e.length;return{prompt_quality:Math.round(t/i*10)/10,context_provided:Math.round(n/i*10)/10,scope_quality:Math.round(r/i*10)/10,independence_level:Math.round(a/i*10)/10}},[D]),B=f.useMemo(()=>{let e=0,t=0,n=0;for(const r of A)"simple"===r.complexity?e++:"medium"===r.complexity?t++:"complex"===r.complexity&&n++;return{simple:e,medium:t,complex:n}},[A]);return i?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("div",{className:"text-text-muted text-sm",children:"Loading..."})}):s.jsxs("div",{className:"min-h-screen bg-bg-base selection:bg-accent/30 selection:text-text-primary",children:[s.jsx(wu,{health:r,updateInfo:a,timeContextLabel:O,activeTab:u,onTabChange:v,onSearchOpen:()=>T(!0)}),s.jsxs("div",{className:"max-w-[1000px] mx-auto px-6 pb-6",children:[s.jsx(Su,{open:N,onClose:()=>T(!1),sessions:e,milestones:t,deleteSession:x,deleteConversation:b,deleteMilestone:w}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(pu,{value:o,onChange:m,scale:l,onScaleChange:g,sessions:e,milestones:t,showPublic:C}),s.jsx(Kc,{totalHours:V.totalHours,totalSessions:V.totalSessions,currentStreak:F,filesTouched:V.filesTouched,featuresShipped:V.featuresShipped,bugsFixed:V.bugsFixed,complexSolved:V.complexSolved,selectedCard:k,onCardClick:S}),s.jsx(Yc,{type:k,milestones:A,showPublic:C,onClose:()=>S(null)}),"sessions"===u&&s.jsx(Pu,{filteredSessions:D,filteredMilestones:A,filters:c,onFilterChange:y,onDeleteSession:x,onDeleteConversation:b,onDeleteMilestone:w,globalShowPublic:C,onToggleShowPublic:()=>j(e=>!e),showFullDate:"7d"===l||"30d"===l,outsideWindowCounts:_,onNavigateNewer:z,onNavigateOlder:R}),"insights"===u&&s.jsxs("div",{className:"space-y-4 pt-2",children:[s.jsx(bc,{sessions:D,milestones:A,isLive:E,windowStart:M,windowEnd:L,allSessions:e,allMilestones:t}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(kc,{sessions:D}),s.jsx(Uc,{sessions:D,milestones:A,streak:F})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsx(Eu,{data:B}),$&&s.jsx(Nu,{evaluation:$})]}),s.jsx(au,{byTaskType:V.byTaskType}),s.jsx(mc,{sessions:e,timeScale:l,effectiveTime:P,isLive:E,onDayClick:e=>{const t=new Date(\`\${e}T23:59:59\`).getTime();m(t),g("24h")},highlightDate:I}),s.jsx(Ec,{milestones:A,showPublic:C}),s.jsx(Jc,{stats:V})]}),s.jsx(ju,{config:n,onRefresh:d})]})]})]})}M.createRoot(document.getElementById("root")).render(s.jsx(f.StrictMode,{children:s.jsx(Mu,{})}));</script>
|
|
35058
35058
|
<style rel="stylesheet" crossorigin>/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:"Geist Mono","JetBrains Mono","SF Mono","Fira Code",ui-monospace,monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-md:12px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--font-body:"Inter",system-ui,-apple-system,sans-serif;--color-bg-base:var(--bg-base);--color-bg-surface-1:var(--bg-surface-1);--color-bg-surface-2:var(--bg-surface-2);--color-bg-surface-3:var(--bg-surface-3);--color-text-primary:var(--text-primary);--color-text-secondary:var(--text-secondary);--color-text-muted:var(--text-muted);--color-accent:var(--accent);--color-accent-bright:var(--accent-bright);--color-border:var(--border);--color-history:var(--history);--color-success:var(--accent);--color-error:#ef4444;--color-blue:#3b82f6;--color-purple:#8b5cf6}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--color-border)}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-10{top:calc(var(--spacing)*-10)}.top-0{top:calc(var(--spacing)*0)}.top-2{top:calc(var(--spacing)*2)}.top-5{top:calc(var(--spacing)*5)}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.-bottom-1{bottom:calc(var(--spacing)*-1)}.-bottom-1\\.5{bottom:calc(var(--spacing)*-1.5)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-2{bottom:calc(var(--spacing)*2)}.-left-7{left:calc(var(--spacing)*-7)}.left-1\\/2{left:50%}.left-2{left:calc(var(--spacing)*2)}.left-\\[1\\.75rem\\]{left:1.75rem}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\\[60\\]{z-index:60}.z-\\[61\\]{z-index:61}.z-\\[9999\\]{z-index:9999}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-auto{margin-inline:auto}.my-0\\.5{margin-block:calc(var(--spacing)*.5)}.my-1{margin-block:calc(var(--spacing)*1)}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-12{margin-top:calc(var(--spacing)*12)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-0\\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.-ml-2{margin-left:calc(var(--spacing)*-2)}.ml-0\\.5{margin-left:calc(var(--spacing)*.5)}.ml-1\\.5{margin-left:calc(var(--spacing)*1.5)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-flex{display:inline-flex}.h-1\\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-16{height:calc(var(--spacing)*16)}.h-\\[4px\\]{height:4px}.h-full{height:100%}.h-px{height:1px}.max-h-\\[75vh\\]{max-height:75vh}.min-h-screen{min-height:100vh}.w-0{width:calc(var(--spacing)*0)}.w-1\\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-40{width:calc(var(--spacing)*40)}.w-72{width:calc(var(--spacing)*72)}.w-\\[2px\\]{width:2px}.w-\\[155px\\]{width:155px}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\\[100px\\]{max-width:100px}.max-w-\\[280px\\]{max-width:280px}.max-w-\\[1000px\\]{max-width:1000px}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\\[58px\\]{min-width:58px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[120px\\]{min-width:120px}.min-w-\\[180px\\]{min-width:180px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.origin-bottom{transform-origin:bottom}.-translate-x-1\\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.rotate-45{rotate:45deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-\\[3px\\]{gap:3px}:where(.space-y-0\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*5)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-6{column-gap:calc(var(--spacing)*6)}.gap-y-1\\.5{row-gap:calc(var(--spacing)*1.5)}.self-center{align-self:center}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.overscroll-none{overscroll-behavior:none}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-md{border-top-left-radius:var(--radius-md);border-top-right-radius:var(--radius-md)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-accent,.border-accent\\/10{border-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\\/10{border-color:color-mix(in oklab,var(--color-accent)10%,transparent)}}.border-accent\\/20{border-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\\/20{border-color:color-mix(in oklab,var(--color-accent)20%,transparent)}}.border-accent\\/30{border-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\\/30{border-color:color-mix(in oklab,var(--color-accent)30%,transparent)}}.border-accent\\/50{border-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.border-accent\\/50{border-color:color-mix(in oklab,var(--color-accent)50%,transparent)}}.border-bg-surface-1{border-color:var(--color-bg-surface-1)}.border-blue\\/20{border-color:#3b82f633}@supports (color:color-mix(in lab,red,red)){.border-blue\\/20{border-color:color-mix(in oklab,var(--color-blue)20%,transparent)}}.border-blue\\/30{border-color:#3b82f64d}@supports (color:color-mix(in lab,red,red)){.border-blue\\/30{border-color:color-mix(in oklab,var(--color-blue)30%,transparent)}}.border-border,.border-border\\/15{border-color:var(--color-border)}@supports (color:color-mix(in lab,red,red)){.border-border\\/15{border-color:color-mix(in oklab,var(--color-border)15%,transparent)}}.border-border\\/30{border-color:var(--color-border)}@supports (color:color-mix(in lab,red,red)){.border-border\\/30{border-color:color-mix(in oklab,var(--color-border)30%,transparent)}}.border-border\\/40{border-color:var(--color-border)}@supports (color:color-mix(in lab,red,red)){.border-border\\/40{border-color:color-mix(in oklab,var(--color-border)40%,transparent)}}.border-border\\/50{border-color:var(--color-border)}@supports (color:color-mix(in lab,red,red)){.border-border\\/50{border-color:color-mix(in oklab,var(--color-border)50%,transparent)}}.border-border\\/60{border-color:var(--color-border)}@supports (color:color-mix(in lab,red,red)){.border-border\\/60{border-color:color-mix(in oklab,var(--color-border)60%,transparent)}}.border-error\\/20{border-color:#ef444433}@supports (color:color-mix(in lab,red,red)){.border-error\\/20{border-color:color-mix(in oklab,var(--color-error)20%,transparent)}}.border-error\\/30{border-color:#ef44444d}@supports (color:color-mix(in lab,red,red)){.border-error\\/30{border-color:color-mix(in oklab,var(--color-error)30%,transparent)}}.border-history,.border-history\\/20{border-color:var(--color-history)}@supports (color:color-mix(in lab,red,red)){.border-history\\/20{border-color:color-mix(in oklab,var(--color-history)20%,transparent)}}.border-purple\\/20{border-color:#8b5cf633}@supports (color:color-mix(in lab,red,red)){.border-purple\\/20{border-color:color-mix(in oklab,var(--color-purple)20%,transparent)}}.border-purple\\/30{border-color:#8b5cf64d}@supports (color:color-mix(in lab,red,red)){.border-purple\\/30{border-color:color-mix(in oklab,var(--color-purple)30%,transparent)}}.border-success\\/20{border-color:var(--color-success)}@supports (color:color-mix(in lab,red,red)){.border-success\\/20{border-color:color-mix(in oklab,var(--color-success)20%,transparent)}}.border-success\\/30{border-color:var(--color-success)}@supports (color:color-mix(in lab,red,red)){.border-success\\/30{border-color:color-mix(in oklab,var(--color-success)30%,transparent)}}.border-text-muted\\/20{border-color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.border-text-muted\\/20{border-color:color-mix(in oklab,var(--color-text-muted)20%,transparent)}}.bg-accent,.bg-accent\\/5{background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\\/5{background-color:color-mix(in oklab,var(--color-accent)5%,transparent)}}.bg-accent\\/10{background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\\/10{background-color:color-mix(in oklab,var(--color-accent)10%,transparent)}}.bg-accent\\/15{background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\\/15{background-color:color-mix(in oklab,var(--color-accent)15%,transparent)}}.bg-accent\\/30{background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\\/30{background-color:color-mix(in oklab,var(--color-accent)30%,transparent)}}.bg-accent\\/40{background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.bg-accent\\/40{background-color:color-mix(in oklab,var(--color-accent)40%,transparent)}}.bg-bg-base,.bg-bg-base\\/80{background-color:var(--color-bg-base)}@supports (color:color-mix(in lab,red,red)){.bg-bg-base\\/80{background-color:color-mix(in oklab,var(--color-bg-base)80%,transparent)}}.bg-bg-surface-1,.bg-bg-surface-1\\/30{background-color:var(--color-bg-surface-1)}@supports (color:color-mix(in lab,red,red)){.bg-bg-surface-1\\/30{background-color:color-mix(in oklab,var(--color-bg-surface-1)30%,transparent)}}.bg-bg-surface-1\\/50{background-color:var(--color-bg-surface-1)}@supports (color:color-mix(in lab,red,red)){.bg-bg-surface-1\\/50{background-color:color-mix(in oklab,var(--color-bg-surface-1)50%,transparent)}}.bg-bg-surface-1\\/80{background-color:var(--color-bg-surface-1)}@supports (color:color-mix(in lab,red,red)){.bg-bg-surface-1\\/80{background-color:color-mix(in oklab,var(--color-bg-surface-1)80%,transparent)}}.bg-bg-surface-2,.bg-bg-surface-2\\/30{background-color:var(--color-bg-surface-2)}@supports (color:color-mix(in lab,red,red)){.bg-bg-surface-2\\/30{background-color:color-mix(in oklab,var(--color-bg-surface-2)30%,transparent)}}.bg-bg-surface-2\\/50{background-color:var(--color-bg-surface-2)}@supports (color:color-mix(in lab,red,red)){.bg-bg-surface-2\\/50{background-color:color-mix(in oklab,var(--color-bg-surface-2)50%,transparent)}}.bg-bg-surface-3,.bg-bg-surface-3\\/95{background-color:var(--color-bg-surface-3)}@supports (color:color-mix(in lab,red,red)){.bg-bg-surface-3\\/95{background-color:color-mix(in oklab,var(--color-bg-surface-3)95%,transparent)}}.bg-black\\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-blue\\/10{background-color:#3b82f61a}@supports (color:color-mix(in lab,red,red)){.bg-blue\\/10{background-color:color-mix(in oklab,var(--color-blue)10%,transparent)}}.bg-blue\\/15{background-color:#3b82f626}@supports (color:color-mix(in lab,red,red)){.bg-blue\\/15{background-color:color-mix(in oklab,var(--color-blue)15%,transparent)}}.bg-border\\/20{background-color:var(--color-border)}@supports (color:color-mix(in lab,red,red)){.bg-border\\/20{background-color:color-mix(in oklab,var(--color-border)20%,transparent)}}.bg-border\\/30{background-color:var(--color-border)}@supports (color:color-mix(in lab,red,red)){.bg-border\\/30{background-color:color-mix(in oklab,var(--color-border)30%,transparent)}}.bg-border\\/50{background-color:var(--color-border)}@supports (color:color-mix(in lab,red,red)){.bg-border\\/50{background-color:color-mix(in oklab,var(--color-border)50%,transparent)}}.bg-error{background-color:var(--color-error)}.bg-error\\/10{background-color:#ef44441a}@supports (color:color-mix(in lab,red,red)){.bg-error\\/10{background-color:color-mix(in oklab,var(--color-error)10%,transparent)}}.bg-error\\/15{background-color:#ef444426}@supports (color:color-mix(in lab,red,red)){.bg-error\\/15{background-color:color-mix(in oklab,var(--color-error)15%,transparent)}}.bg-history,.bg-history\\/10{background-color:var(--color-history)}@supports (color:color-mix(in lab,red,red)){.bg-history\\/10{background-color:color-mix(in oklab,var(--color-history)10%,transparent)}}.bg-purple\\/10{background-color:#8b5cf61a}@supports (color:color-mix(in lab,red,red)){.bg-purple\\/10{background-color:color-mix(in oklab,var(--color-purple)10%,transparent)}}.bg-purple\\/15{background-color:#8b5cf626}@supports (color:color-mix(in lab,red,red)){.bg-purple\\/15{background-color:color-mix(in oklab,var(--color-purple)15%,transparent)}}.bg-success,.bg-success\\/10{background-color:var(--color-success)}@supports (color:color-mix(in lab,red,red)){.bg-success\\/10{background-color:color-mix(in oklab,var(--color-success)10%,transparent)}}.bg-success\\/15{background-color:var(--color-success)}@supports (color:color-mix(in lab,red,red)){.bg-success\\/15{background-color:color-mix(in oklab,var(--color-success)15%,transparent)}}.bg-text-muted\\/10{background-color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.bg-text-muted\\/10{background-color:color-mix(in oklab,var(--color-text-muted)10%,transparent)}}.bg-text-muted\\/15{background-color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.bg-text-muted\\/15{background-color:color-mix(in oklab,var(--color-text-muted)15%,transparent)}}.bg-transparent{background-color:#0000}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-transparent{--tw-gradient-from:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-white\\/10{--tw-gradient-to:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.to-white\\/10{--tw-gradient-to:color-mix(in oklab,var(--color-white)10%,transparent)}}.to-white\\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.fill-current{fill:currentColor}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.px-0\\.5{padding-inline:calc(var(--spacing)*.5)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-px{padding-inline:1px}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-1\\.5{padding-top:calc(var(--spacing)*1.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-\\[10vh\\]{padding-top:10vh}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.pl-3{padding-left:calc(var(--spacing)*3)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[7px\\]{font-size:7px}.text-\\[8px\\]{font-size:8px}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking:var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.text-accent,.text-accent\\/60{color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.text-accent\\/60{color:color-mix(in oklab,var(--color-accent)60%,transparent)}}.text-accent\\/80{color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.text-accent\\/80{color:color-mix(in oklab,var(--color-accent)80%,transparent)}}.text-blue{color:var(--color-blue)}.text-error{color:var(--color-error)}.text-history{color:var(--color-history)}.text-inherit{color:inherit}.text-purple{color:var(--color-purple)}.text-success,.text-success\\/60{color:var(--color-success)}@supports (color:color-mix(in lab,red,red)){.text-success\\/60{color:color-mix(in oklab,var(--color-success)60%,transparent)}}.text-text-muted,.text-text-muted\\/30{color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.text-text-muted\\/30{color:color-mix(in oklab,var(--color-text-muted)30%,transparent)}}.text-text-muted\\/50{color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.text-text-muted\\/50{color:color-mix(in oklab,var(--color-text-muted)50%,transparent)}}.text-text-muted\\/60{color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.text-text-muted\\/60{color:color-mix(in oklab,var(--color-text-muted)60%,transparent)}}.text-text-muted\\/70{color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.text-text-muted\\/70{color:color-mix(in oklab,var(--color-text-muted)70%,transparent)}}.text-text-primary{color:var(--color-text-primary)}.text-text-secondary{color:var(--color-text-secondary)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-accent\\/20{--tw-shadow-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.shadow-accent\\/20{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-accent)20%,transparent)var(--tw-shadow-alpha),transparent)}}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.ring-offset-bg-base{--tw-ring-offset-color:var(--color-bg-base)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\\:scale-x-110:is(:where(.group):hover *){--tw-scale-x:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.group-hover\\:-rotate-90:is(:where(.group):hover *){rotate:-90deg}.group-hover\\:rotate-180:is(:where(.group):hover *){rotate:180deg}.group-hover\\:bg-accent:is(:where(.group):hover *),.group-hover\\:bg-accent\\/10:is(:where(.group):hover *){background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.group-hover\\:bg-accent\\/10:is(:where(.group):hover *){background-color:color-mix(in oklab,var(--color-accent)10%,transparent)}}.group-hover\\:text-accent:is(:where(.group):hover *){color:var(--color-accent)}.group-hover\\:text-text-primary:is(:where(.group):hover *){color:var(--color-text-primary)}.group-hover\\:opacity-100:is(:where(.group):hover *),.group-hover\\/card\\:opacity-100:is(:where(.group\\/card):hover *),.group-hover\\/conv\\:opacity-100:is(:where(.group\\/conv):hover *){opacity:1}}.selection\\:bg-accent\\/30 ::selection{background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.selection\\:bg-accent\\/30 ::selection{background-color:color-mix(in oklab,var(--color-accent)30%,transparent)}}.selection\\:bg-accent\\/30::selection{background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.selection\\:bg-accent\\/30::selection{background-color:color-mix(in oklab,var(--color-accent)30%,transparent)}}.selection\\:text-text-primary ::selection{color:var(--color-text-primary)}.selection\\:text-text-primary::selection{color:var(--color-text-primary)}.placeholder\\:text-text-muted\\/50::placeholder{color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.placeholder\\:text-text-muted\\/50::placeholder{color:color-mix(in oklab,var(--color-text-muted)50%,transparent)}}.focus-within\\:border-accent\\/50:focus-within{border-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.focus-within\\:border-accent\\/50:focus-within{border-color:color-mix(in oklab,var(--color-accent)50%,transparent)}}.focus-within\\:ring-1:focus-within{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\:ring-accent\\/50:focus-within{--tw-ring-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.focus-within\\:ring-accent\\/50:focus-within{--tw-ring-color:color-mix(in oklab,var(--color-accent)50%,transparent)}}@media(hover:hover){.hover\\:scale-125:hover{--tw-scale-x:125%;--tw-scale-y:125%;--tw-scale-z:125%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\\:border-accent\\/30:hover{border-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.hover\\:border-accent\\/30:hover{border-color:color-mix(in oklab,var(--color-accent)30%,transparent)}}.hover\\:border-accent\\/40:hover{border-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.hover\\:border-accent\\/40:hover{border-color:color-mix(in oklab,var(--color-accent)40%,transparent)}}.hover\\:border-error\\/50:hover{border-color:#ef444480}@supports (color:color-mix(in lab,red,red)){.hover\\:border-error\\/50:hover{border-color:color-mix(in oklab,var(--color-error)50%,transparent)}}.hover\\:border-text-muted\\/50:hover{border-color:var(--color-text-muted)}@supports (color:color-mix(in lab,red,red)){.hover\\:border-text-muted\\/50:hover{border-color:color-mix(in oklab,var(--color-text-muted)50%,transparent)}}.hover\\:bg-accent-bright:hover{background-color:var(--color-accent-bright)}.hover\\:bg-accent\\/15:hover{background-color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-accent\\/15:hover{background-color:color-mix(in oklab,var(--color-accent)15%,transparent)}}.hover\\:bg-bg-surface-1:hover{background-color:var(--color-bg-surface-1)}.hover\\:bg-bg-surface-2:hover,.hover\\:bg-bg-surface-2\\/40:hover{background-color:var(--color-bg-surface-2)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-bg-surface-2\\/40:hover{background-color:color-mix(in oklab,var(--color-bg-surface-2)40%,transparent)}}.hover\\:bg-bg-surface-2\\/50:hover{background-color:var(--color-bg-surface-2)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-bg-surface-2\\/50:hover{background-color:color-mix(in oklab,var(--color-bg-surface-2)50%,transparent)}}.hover\\:bg-bg-surface-3:hover{background-color:var(--color-bg-surface-3)}.hover\\:bg-error\\/5:hover{background-color:#ef44440d}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-error\\/5:hover{background-color:color-mix(in oklab,var(--color-error)5%,transparent)}}.hover\\:bg-error\\/10:hover{background-color:#ef44441a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-error\\/10:hover{background-color:color-mix(in oklab,var(--color-error)10%,transparent)}}.hover\\:bg-error\\/25:hover{background-color:#ef444440}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-error\\/25:hover{background-color:color-mix(in oklab,var(--color-error)25%,transparent)}}.hover\\:bg-history:hover{background-color:var(--color-history)}.hover\\:text-accent:hover,.hover\\:text-accent\\/80:hover{color:var(--color-accent)}@supports (color:color-mix(in lab,red,red)){.hover\\:text-accent\\/80:hover{color:color-mix(in oklab,var(--color-accent)80%,transparent)}}.hover\\:text-error:hover{color:var(--color-error)}.hover\\:text-error\\/70:hover{color:#ef4444b3}@supports (color:color-mix(in lab,red,red)){.hover\\:text-error\\/70:hover{color:color-mix(in oklab,var(--color-error)70%,transparent)}}.hover\\:text-text-primary:hover{color:var(--color-text-primary)}.hover\\:text-white:hover{color:var(--color-white)}.hover\\:opacity-80:hover{opacity:.8}.hover\\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.active\\:cursor-grabbing:active{cursor:grabbing}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-20:disabled{opacity:.2}.disabled\\:opacity-50:disabled{opacity:.5}@media(min-width:40rem){.sm\\:inline{display:inline}.sm\\:inline-flex{display:inline-flex}.sm\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:flex-row{flex-direction:row}}@media(min-width:48rem){.md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:flex-row{flex-direction:row}.md\\:items-center{align-items:center}}@media(min-width:64rem){.lg\\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}}:root{--bg-base:#09090b;--bg-surface-1:#18181b;--bg-surface-2:#27272a;--bg-surface-3:#3f3f46;--text-primary:#fafafa;--text-secondary:#a1a1aa;--text-muted:#71717a;--accent:#b4f82c;--accent-rgb:180,248,44;--accent-bright:#d4fc6e;--accent-dim:#4d7c0f;--border:#27272a;--border-accent:rgba(var(--accent-rgb),.2);--glass-bg:#18181bb3;--glass-border:#ffffff0d;--streak:#f59e0b;--streak-bg:#f59e0b0f;--streak-border:#f59e0b33;--streak-muted:#f59e0b80;--history:#60a5fa;--history-rgb:96,165,250}@media(prefers-color-scheme:light){:root{--bg-base:#fff;--bg-surface-1:#f4f4f5;--bg-surface-2:#e4e4e7;--bg-surface-3:#d4d4d8;--text-primary:#09090b;--text-secondary:#52525b;--text-muted:#71717a;--accent:#65a30d;--accent-rgb:101,163,13;--accent-bright:#84cc16;--accent-dim:#f7fee7;--border:#e4e4e7;--border-accent:rgba(var(--accent-rgb),.1);--glass-bg:#ffffffb3;--glass-border:#0000000d;--streak:#b45309;--streak-bg:#b453090f;--streak-border:#b4530933;--streak-muted:#b4530980;--history:#2563eb;--history-rgb:37,99,235}}::selection{background:rgba(var(--accent-rgb),.3);color:var(--color-text-primary)}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--color-bg-surface-3);border-radius:10px}::-webkit-scrollbar-thumb:hover{background:var(--color-text-muted)}body{font-family:var(--font-body);background:var(--color-bg-base);color:var(--color-text-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-height:100vh;margin:0;line-height:1.6}.glass-card{background:var(--glass-bg);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--glass-border);box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.subtle-glow{position:relative}.subtle-glow:after{content:"";background:linear-gradient(45deg,transparent,rgba(var(--accent-rgb),.1),transparent);border-radius:inherit;z-index:-1;pointer-events:none;position:absolute;inset:-1px}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}</style>
|
|
35059
35059
|
</head>
|
|
35060
35060
|
<body>
|
|
@@ -35246,9 +35246,10 @@ async function handleLocalSync(req, res) {
|
|
|
35246
35246
|
return;
|
|
35247
35247
|
}
|
|
35248
35248
|
}
|
|
35249
|
+
const MILESTONE_CHUNK = 50;
|
|
35249
35250
|
const milestones = readJson(MILESTONES_FILE, []);
|
|
35250
|
-
for (let i = 0; i < milestones.length; i +=
|
|
35251
|
-
const chunk = milestones.slice(i, i +
|
|
35251
|
+
for (let i = 0; i < milestones.length; i += MILESTONE_CHUNK) {
|
|
35252
|
+
const chunk = milestones.slice(i, i + MILESTONE_CHUNK);
|
|
35252
35253
|
const milestonesRes = await fetch(`${USEAI_API}/api/publish`, {
|
|
35253
35254
|
method: "POST",
|
|
35254
35255
|
headers,
|
|
@@ -36557,14 +36558,31 @@ var init_stdio2 = __esm({
|
|
|
36557
36558
|
});
|
|
36558
36559
|
|
|
36559
36560
|
// src/index.ts
|
|
36560
|
-
var
|
|
36561
|
-
if (
|
|
36562
|
-
const args =
|
|
36561
|
+
var command = process.argv[2];
|
|
36562
|
+
if (command === "mcp" || command?.startsWith("--")) {
|
|
36563
|
+
const args = command === "mcp" ? process.argv.slice(3) : process.argv.slice(2);
|
|
36563
36564
|
const { runSetup: runSetup2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
|
|
36564
36565
|
await runSetup2(args);
|
|
36565
36566
|
process.exit(0);
|
|
36566
36567
|
}
|
|
36567
|
-
if (
|
|
36568
|
+
if (!command && process.stdin.isTTY) {
|
|
36569
|
+
const { AI_TOOLS: AI_TOOLS2 } = await Promise.resolve().then(() => (init_tools2(), tools_exports));
|
|
36570
|
+
const isInstalled = AI_TOOLS2.some((t) => {
|
|
36571
|
+
try {
|
|
36572
|
+
return t.isConfigured();
|
|
36573
|
+
} catch {
|
|
36574
|
+
return false;
|
|
36575
|
+
}
|
|
36576
|
+
});
|
|
36577
|
+
if (isInstalled) {
|
|
36578
|
+
command = "update";
|
|
36579
|
+
} else {
|
|
36580
|
+
const { runSetup: runSetup2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
|
|
36581
|
+
await runSetup2([]);
|
|
36582
|
+
process.exit(0);
|
|
36583
|
+
}
|
|
36584
|
+
}
|
|
36585
|
+
if (command === "update") {
|
|
36568
36586
|
const { default: chalk2 } = await Promise.resolve().then(() => (init_source(), source_exports));
|
|
36569
36587
|
const { fetchLatestVersion: fetchLatestVersion2, fetchDaemonHealth: fetchDaemonHealth2, killDaemon: killDaemon2, ensureDaemon: ensureDaemon2, installClaudeCodeHooks: installClaudeCodeHooks2, VERSION: VERSION3 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
36570
36588
|
const { AI_TOOLS: AI_TOOLS2 } = await Promise.resolve().then(() => (init_tools2(), tools_exports));
|
|
@@ -36652,7 +36670,7 @@ if (subcommand === "update") {
|
|
|
36652
36670
|
`));
|
|
36653
36671
|
process.exit(0);
|
|
36654
36672
|
}
|
|
36655
|
-
if (
|
|
36673
|
+
if (command === "daemon") {
|
|
36656
36674
|
const { startDaemon: startDaemon2 } = await Promise.resolve().then(() => (init_daemon2(), daemon_exports));
|
|
36657
36675
|
const portArg = process.argv.indexOf("--port");
|
|
36658
36676
|
const port = portArg !== -1 ? parseInt(process.argv[portArg + 1], 10) : void 0;
|
|
@@ -36660,8 +36678,8 @@ if (subcommand === "daemon") {
|
|
|
36660
36678
|
await new Promise(() => {
|
|
36661
36679
|
});
|
|
36662
36680
|
}
|
|
36663
|
-
if (
|
|
36664
|
-
console.error(`Unknown
|
|
36681
|
+
if (command) {
|
|
36682
|
+
console.error(`Unknown command: "${command}"`);
|
|
36665
36683
|
console.error("Available commands: mcp, daemon, update");
|
|
36666
36684
|
process.exit(1);
|
|
36667
36685
|
}
|