ai-agent-session-center 2.8.2 → 2.9.2

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.
@@ -1 +1 @@
1
- import{y as j,h as i,k as e,o as M}from"./index-CCOZp8gY.js";const A="_container_pmjze_6",F="_filterBar_pmjze_15",P="_toggleLabel_pmjze_42",$="_taskList_pmjze_61",U="_groupHeader_pmjze_69",Y="_groupChevron_pmjze_78",G="_collapsed_pmjze_86",V="_groupLabel_pmjze_90",W="_groupCount_pmjze_99",q="_taskCard_pmjze_107",K="_completed_pmjze_124",J="_taskTitle_pmjze_128",Q="_overdue_pmjze_133",X="_dueToday_pmjze_138",Z="_checkbox_pmjze_145",ee="_taskContent_pmjze_160",te="_taskHeader_pmjze_165",se="_taskTitleInput_pmjze_189",ae="_priorityBadge_pmjze_204",ne="_priorityUrgent_pmjze_215",oe="_priorityHigh_pmjze_221",le="_priorityMedium_pmjze_227",ie="_priorityLow_pmjze_233",re="_taskMeta_pmjze_241",ce="_dueDate_pmjze_249",de="_dueDateOverdue_pmjze_255",ue="_dueDateToday_pmjze_259",pe="_tag_pmjze_263",me="_tagInput_pmjze_278",ge="_addTagBtn_pmjze_291",he="_description_pmjze_311",_e="_descriptionToggle_pmjze_321",je="_deleteBtn_pmjze_338",fe="_addForm_pmjze_359",ve="_titleInput_pmjze_402",xe="_tagsInput_pmjze_407",ye="_addBtn_pmjze_412",Te="_emptyState_pmjze_438",Ce="_loading_pmjze_459",ke="_stats_pmjze_472",De="_statsSep_pmjze_482",be="_confirmOverlay_pmjze_488",we="_confirmBtn_pmjze_497",ze="_cancelBtn_pmjze_512",s={container:A,filterBar:F,toggleLabel:P,taskList:$,groupHeader:U,groupChevron:Y,collapsed:G,groupLabel:V,groupCount:W,taskCard:q,completed:K,taskTitle:J,overdue:Q,dueToday:X,checkbox:Z,taskContent:ee,taskHeader:te,taskTitleInput:se,priorityBadge:ae,priorityUrgent:ne,priorityHigh:oe,priorityMedium:le,priorityLow:ie,taskMeta:re,dueDate:ce,dueDateOverdue:de,dueDateToday:ue,tag:pe,tagInput:me,addTagBtn:ge,description:he,descriptionToggle:_e,deleteBtn:je,addForm:fe,titleInput:ve,tagsInput:xe,addBtn:ye,emptyState:Te,loading:Ce,stats:ke,statsSep:De,confirmOverlay:be,confirmBtn:we,cancelBtn:ze},Se=[{value:"all",label:"All priorities"},{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],Ne=[{value:"priority",label:"Priority"},{value:"dueDate",label:"Due date"},{value:"createdAt",label:"Created"}];function Be(){const t=j(l=>l.filter),o=j(l=>l.setFilter),n=i.useCallback(l=>o({search:l}),[o]),c=i.useCallback(l=>o({priority:l.target.value}),[o]),d=i.useCallback(l=>o({sortBy:l.target.value}),[o]),p=i.useCallback(()=>o({showCompleted:!t.showCompleted}),[o,t.showCompleted]);return e.jsxs("div",{className:s.filterBar,children:[e.jsx(M,{value:t.search,onChange:n,placeholder:"Search tasks...",debounceMs:200}),e.jsx("select",{value:t.priority,onChange:c,children:Se.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsx("select",{value:t.sortBy,onChange:d,children:Ne.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsxs("label",{className:s.toggleLabel,children:[e.jsx("input",{type:"checkbox",checked:t.showCompleted,onChange:p}),"Show completed"]})]})}const Ie={urgent:s.priorityUrgent,high:s.priorityHigh,medium:s.priorityMedium,low:s.priorityLow};function Le(t){if(!t)return null;const o=new Date;o.setHours(0,0,0,0);const n=new Date(t+"T00:00:00");return n<o?"overdue":n.getTime()===o.getTime()?"today":"future"}function He(t){return new Date(t+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric"})}function N({task:t}){const o=j(a=>a.toggleTask),n=j(a=>a.updateTask),c=j(a=>a.deleteTask),[d,p]=i.useState(!1),[l,h]=i.useState(t.title),[_,v]=i.useState(!1),[u,y]=i.useState(""),[T,r]=i.useState(!1),[f,g]=i.useState(!1),C=i.useRef(null),b=i.useRef(null);i.useEffect(()=>{d&&(C.current?.focus(),C.current?.select())},[d]),i.useEffect(()=>{_&&b.current?.focus()},[_]),i.useEffect(()=>{d||h(t.title)},[t.title,d]);const k=i.useCallback(()=>{p(!1);const a=l.trim();a&&a!==t.title?n(t.id,{title:a}):h(t.title)},[l,t.id,t.title,n]),w=i.useCallback(()=>{o(t.id)},[o,t.id]),m=i.useCallback(()=>{c(t.id),g(!1)},[c,t.id]),x=i.useCallback(()=>{y(t.tags.join(", ")),v(!0)},[t.tags]),S=i.useCallback(()=>{v(!1);const a=u.split(",").map(R=>R.trim()).filter(Boolean),O=t.tags.join(","),E=a.join(",");O!==E&&n(t.id,{tags:a})},[u,t.id,t.tags,n]),D=Le(t.dueDate),z=[s.taskCard];return t.completed&&z.push(s.completed),!t.completed&&D==="overdue"&&z.push(s.overdue),!t.completed&&D==="today"&&z.push(s.dueToday),e.jsxs("div",{className:z.join(" "),children:[e.jsx("input",{type:"checkbox",className:s.checkbox,checked:t.completed,onChange:w,"aria-label":`Mark "${t.title}" as ${t.completed?"incomplete":"complete"}`}),e.jsxs("div",{className:s.taskContent,children:[e.jsxs("div",{className:s.taskHeader,children:[d?e.jsx("input",{ref:C,className:s.taskTitleInput,value:l,onChange:a=>h(a.target.value),onBlur:k,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),k()),a.key==="Escape"&&(h(t.title),p(!1))},onClick:a=>a.stopPropagation()}):e.jsx("span",{className:s.taskTitle,onClick:()=>{h(t.title),p(!0)},title:"Click to edit",children:t.title}),e.jsx("span",{className:`${s.priorityBadge} ${Ie[t.priority]}`,children:t.priority})]}),e.jsxs("div",{className:s.taskMeta,children:[t.dueDate&&e.jsxs("span",{className:`${s.dueDate} ${D==="overdue"?s.dueDateOverdue:""} ${D==="today"?s.dueDateToday:""}`,children:[D==="overdue"&&"Overdue: ",D==="today"&&"Today: ",He(t.dueDate)]}),_?e.jsx("input",{ref:b,className:s.tagInput,value:u,onChange:a=>y(a.target.value),onBlur:S,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),S()),a.key==="Escape"&&v(!1)},onClick:a=>a.stopPropagation(),placeholder:"tag1, tag2, ..."}):e.jsxs(e.Fragment,{children:[t.tags.map(a=>e.jsx("span",{className:s.tag,onClick:x,title:"Click to edit tags",style:{cursor:"pointer"},children:a},a)),e.jsx("button",{className:s.addTagBtn,onClick:x,title:"Add / edit tags",children:"+"})]})]}),t.description&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:s.descriptionToggle,onClick:()=>r(a=>!a),children:T?"- Hide details":"+ Show details"}),T&&e.jsx("div",{className:s.description,children:t.description})]})]}),f?e.jsxs("div",{className:s.confirmOverlay,children:[e.jsx("span",{children:"Delete?"}),e.jsx("button",{className:s.confirmBtn,onClick:m,children:"Yes"}),e.jsx("button",{className:s.cancelBtn,onClick:()=>g(!1),children:"No"})]}):e.jsx("button",{className:s.deleteBtn,onClick:()=>g(!0),"aria-label":`Delete "${t.title}"`,title:"Delete task",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})}function Oe(){const t=j(u=>u.createTask),[o,n]=i.useState(""),[c,d]=i.useState("medium"),[p,l]=i.useState(""),[h,_]=i.useState(""),v=i.useCallback(u=>{u.preventDefault();const y=o.trim();if(!y)return;const T=h.split(",").map(r=>r.trim()).filter(Boolean);t({title:y,priority:c,tags:T,dueDate:p||void 0}),n(""),d("medium"),l(""),_("")},[o,c,p,h,t]);return e.jsxs("form",{className:s.addForm,onSubmit:v,children:[e.jsx("input",{type:"text",className:s.titleInput,placeholder:"New task title...",value:o,onChange:u=>n(u.target.value),required:!0}),e.jsxs("select",{value:c,onChange:u=>d(u.target.value),children:[e.jsx("option",{value:"urgent",children:"Urgent"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"low",children:"Low"})]}),e.jsx("input",{type:"date",value:p,onChange:u=>l(u.target.value),title:"Due date (optional)"}),e.jsx("input",{type:"text",className:s.tagsInput,placeholder:"Tags (comma-sep)",value:h,onChange:u=>_(u.target.value)}),e.jsx("button",{type:"submit",className:s.addBtn,disabled:!o.trim(),children:"ADD"})]})}const B=["urgent","high","medium","low"],I={urgent:0,high:1,medium:2,low:3},Ee={urgent:"Urgent",high:"High",medium:"Medium",low:"Low"};function Re(t,o,n,c){if(n!=="all"&&t.priority!==n||c!=="all"&&!t.tags.includes(c))return!1;if(o){const d=o.toLowerCase(),p=t.title.toLowerCase().includes(d),l=(t.description??"").toLowerCase().includes(d);if(!p&&!l)return!1}return!0}function L(t,o){return[...t].sort((n,c)=>{if(o==="priority"){const d=I[n.priority],p=I[c.priority];return d!==p?d-p:new Date(c.createdAt).getTime()-new Date(n.createdAt).getTime()}return o==="dueDate"?!n.dueDate&&!c.dueDate?0:n.dueDate?c.dueDate?n.dueDate.localeCompare(c.dueDate):-1:1:new Date(c.createdAt).getTime()-new Date(n.createdAt).getTime()})}function H({label:t,count:o,collapsed:n,onToggle:c}){return e.jsxs("div",{className:s.groupHeader,onClick:c,children:[e.jsx("svg",{className:`${s.groupChevron} ${n?s.collapsed:""}`,width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),e.jsx("span",{className:s.groupLabel,children:t}),e.jsx("span",{className:s.groupCount,children:o})]})}function Ae(){const t=j(r=>r.tasks),o=j(r=>r.loading),n=j(r=>r.filter),c=j(r=>r.fetchTasks),[d,p]=i.useState(new Set);i.useEffect(()=>{c()},[c]);const l=i.useCallback(r=>{p(f=>{const g=new Set(f);return g.has(r)?g.delete(r):g.add(r),g})},[]),{groups:h,completedTasks:_,totalIncomplete:v,totalCompleted:u}=i.useMemo(()=>{const f=[...t.values()].filter(m=>Re(m,n.search,n.priority,n.tag)),g=f.filter(m=>!m.completed),C=f.filter(m=>m.completed),b=L(g,n.sortBy),k=new Map;for(const m of B)k.set(m,[]);for(const m of b){const x=k.get(m.priority);x&&x.push(m)}const w=[];for(const m of B){const x=k.get(m)??[];x.length>0&&w.push({id:m,label:Ee[m],tasks:x})}return{groups:w,completedTasks:L(C,n.sortBy),totalIncomplete:g.length,totalCompleted:C.length}},[t,n]);if(o)return e.jsx("div",{className:s.container,children:e.jsx("div",{className:s.loading,children:"Loading tasks..."})});const y=h.length===0&&_.length===0,T=t.size===0;return e.jsxs("div",{className:s.container,"data-testid":"agenda-view",children:[e.jsx(Be,{}),e.jsxs("div",{className:s.stats,children:[e.jsxs("span",{children:[v," task",v!==1?"s":""]}),e.jsx("span",{className:s.statsSep,children:"|"}),e.jsxs("span",{children:[u," completed"]})]}),e.jsx("div",{className:s.taskList,children:T?e.jsxs("div",{className:s.emptyState,children:[e.jsx("div",{children:"No tasks yet"}),e.jsx("span",{children:"Add your first task below"})]}):y?e.jsxs("div",{className:s.emptyState,children:[e.jsx("div",{children:"No tasks match the current filter"}),e.jsx("span",{children:"Try adjusting your search or filter criteria"})]}):e.jsxs(e.Fragment,{children:[h.map(r=>{const f=d.has(r.id);return e.jsxs("div",{children:[e.jsx(H,{label:r.label,count:r.tasks.length,collapsed:f,onToggle:()=>l(r.id)}),!f&&r.tasks.map(g=>e.jsx(N,{task:g},g.id))]},r.id)}),n.showCompleted&&_.length>0&&e.jsxs("div",{children:[e.jsx(H,{label:"Completed",count:_.length,collapsed:d.has("__completed__"),onToggle:()=>l("__completed__")}),!d.has("__completed__")&&_.map(r=>e.jsx(N,{task:r},r.id))]})]})}),e.jsx(Oe,{})]})}export{Ae as default};
1
+ import{y as j,h as i,k as e,o as M}from"./index-DI0_qhqI.js";const A="_container_pmjze_6",F="_filterBar_pmjze_15",P="_toggleLabel_pmjze_42",$="_taskList_pmjze_61",U="_groupHeader_pmjze_69",Y="_groupChevron_pmjze_78",G="_collapsed_pmjze_86",V="_groupLabel_pmjze_90",W="_groupCount_pmjze_99",q="_taskCard_pmjze_107",K="_completed_pmjze_124",J="_taskTitle_pmjze_128",Q="_overdue_pmjze_133",X="_dueToday_pmjze_138",Z="_checkbox_pmjze_145",ee="_taskContent_pmjze_160",te="_taskHeader_pmjze_165",se="_taskTitleInput_pmjze_189",ae="_priorityBadge_pmjze_204",ne="_priorityUrgent_pmjze_215",oe="_priorityHigh_pmjze_221",le="_priorityMedium_pmjze_227",ie="_priorityLow_pmjze_233",re="_taskMeta_pmjze_241",ce="_dueDate_pmjze_249",de="_dueDateOverdue_pmjze_255",ue="_dueDateToday_pmjze_259",pe="_tag_pmjze_263",me="_tagInput_pmjze_278",ge="_addTagBtn_pmjze_291",he="_description_pmjze_311",_e="_descriptionToggle_pmjze_321",je="_deleteBtn_pmjze_338",fe="_addForm_pmjze_359",ve="_titleInput_pmjze_402",xe="_tagsInput_pmjze_407",ye="_addBtn_pmjze_412",Te="_emptyState_pmjze_438",Ce="_loading_pmjze_459",ke="_stats_pmjze_472",De="_statsSep_pmjze_482",be="_confirmOverlay_pmjze_488",we="_confirmBtn_pmjze_497",ze="_cancelBtn_pmjze_512",s={container:A,filterBar:F,toggleLabel:P,taskList:$,groupHeader:U,groupChevron:Y,collapsed:G,groupLabel:V,groupCount:W,taskCard:q,completed:K,taskTitle:J,overdue:Q,dueToday:X,checkbox:Z,taskContent:ee,taskHeader:te,taskTitleInput:se,priorityBadge:ae,priorityUrgent:ne,priorityHigh:oe,priorityMedium:le,priorityLow:ie,taskMeta:re,dueDate:ce,dueDateOverdue:de,dueDateToday:ue,tag:pe,tagInput:me,addTagBtn:ge,description:he,descriptionToggle:_e,deleteBtn:je,addForm:fe,titleInput:ve,tagsInput:xe,addBtn:ye,emptyState:Te,loading:Ce,stats:ke,statsSep:De,confirmOverlay:be,confirmBtn:we,cancelBtn:ze},Se=[{value:"all",label:"All priorities"},{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],Ne=[{value:"priority",label:"Priority"},{value:"dueDate",label:"Due date"},{value:"createdAt",label:"Created"}];function Be(){const t=j(l=>l.filter),o=j(l=>l.setFilter),n=i.useCallback(l=>o({search:l}),[o]),c=i.useCallback(l=>o({priority:l.target.value}),[o]),d=i.useCallback(l=>o({sortBy:l.target.value}),[o]),p=i.useCallback(()=>o({showCompleted:!t.showCompleted}),[o,t.showCompleted]);return e.jsxs("div",{className:s.filterBar,children:[e.jsx(M,{value:t.search,onChange:n,placeholder:"Search tasks...",debounceMs:200}),e.jsx("select",{value:t.priority,onChange:c,children:Se.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsx("select",{value:t.sortBy,onChange:d,children:Ne.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsxs("label",{className:s.toggleLabel,children:[e.jsx("input",{type:"checkbox",checked:t.showCompleted,onChange:p}),"Show completed"]})]})}const Ie={urgent:s.priorityUrgent,high:s.priorityHigh,medium:s.priorityMedium,low:s.priorityLow};function Le(t){if(!t)return null;const o=new Date;o.setHours(0,0,0,0);const n=new Date(t+"T00:00:00");return n<o?"overdue":n.getTime()===o.getTime()?"today":"future"}function He(t){return new Date(t+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric"})}function N({task:t}){const o=j(a=>a.toggleTask),n=j(a=>a.updateTask),c=j(a=>a.deleteTask),[d,p]=i.useState(!1),[l,h]=i.useState(t.title),[_,v]=i.useState(!1),[u,y]=i.useState(""),[T,r]=i.useState(!1),[f,g]=i.useState(!1),C=i.useRef(null),b=i.useRef(null);i.useEffect(()=>{d&&(C.current?.focus(),C.current?.select())},[d]),i.useEffect(()=>{_&&b.current?.focus()},[_]),i.useEffect(()=>{d||h(t.title)},[t.title,d]);const k=i.useCallback(()=>{p(!1);const a=l.trim();a&&a!==t.title?n(t.id,{title:a}):h(t.title)},[l,t.id,t.title,n]),w=i.useCallback(()=>{o(t.id)},[o,t.id]),m=i.useCallback(()=>{c(t.id),g(!1)},[c,t.id]),x=i.useCallback(()=>{y(t.tags.join(", ")),v(!0)},[t.tags]),S=i.useCallback(()=>{v(!1);const a=u.split(",").map(R=>R.trim()).filter(Boolean),O=t.tags.join(","),E=a.join(",");O!==E&&n(t.id,{tags:a})},[u,t.id,t.tags,n]),D=Le(t.dueDate),z=[s.taskCard];return t.completed&&z.push(s.completed),!t.completed&&D==="overdue"&&z.push(s.overdue),!t.completed&&D==="today"&&z.push(s.dueToday),e.jsxs("div",{className:z.join(" "),children:[e.jsx("input",{type:"checkbox",className:s.checkbox,checked:t.completed,onChange:w,"aria-label":`Mark "${t.title}" as ${t.completed?"incomplete":"complete"}`}),e.jsxs("div",{className:s.taskContent,children:[e.jsxs("div",{className:s.taskHeader,children:[d?e.jsx("input",{ref:C,className:s.taskTitleInput,value:l,onChange:a=>h(a.target.value),onBlur:k,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),k()),a.key==="Escape"&&(h(t.title),p(!1))},onClick:a=>a.stopPropagation()}):e.jsx("span",{className:s.taskTitle,onClick:()=>{h(t.title),p(!0)},title:"Click to edit",children:t.title}),e.jsx("span",{className:`${s.priorityBadge} ${Ie[t.priority]}`,children:t.priority})]}),e.jsxs("div",{className:s.taskMeta,children:[t.dueDate&&e.jsxs("span",{className:`${s.dueDate} ${D==="overdue"?s.dueDateOverdue:""} ${D==="today"?s.dueDateToday:""}`,children:[D==="overdue"&&"Overdue: ",D==="today"&&"Today: ",He(t.dueDate)]}),_?e.jsx("input",{ref:b,className:s.tagInput,value:u,onChange:a=>y(a.target.value),onBlur:S,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),S()),a.key==="Escape"&&v(!1)},onClick:a=>a.stopPropagation(),placeholder:"tag1, tag2, ..."}):e.jsxs(e.Fragment,{children:[t.tags.map(a=>e.jsx("span",{className:s.tag,onClick:x,title:"Click to edit tags",style:{cursor:"pointer"},children:a},a)),e.jsx("button",{className:s.addTagBtn,onClick:x,title:"Add / edit tags",children:"+"})]})]}),t.description&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:s.descriptionToggle,onClick:()=>r(a=>!a),children:T?"- Hide details":"+ Show details"}),T&&e.jsx("div",{className:s.description,children:t.description})]})]}),f?e.jsxs("div",{className:s.confirmOverlay,children:[e.jsx("span",{children:"Delete?"}),e.jsx("button",{className:s.confirmBtn,onClick:m,children:"Yes"}),e.jsx("button",{className:s.cancelBtn,onClick:()=>g(!1),children:"No"})]}):e.jsx("button",{className:s.deleteBtn,onClick:()=>g(!0),"aria-label":`Delete "${t.title}"`,title:"Delete task",children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})}function Oe(){const t=j(u=>u.createTask),[o,n]=i.useState(""),[c,d]=i.useState("medium"),[p,l]=i.useState(""),[h,_]=i.useState(""),v=i.useCallback(u=>{u.preventDefault();const y=o.trim();if(!y)return;const T=h.split(",").map(r=>r.trim()).filter(Boolean);t({title:y,priority:c,tags:T,dueDate:p||void 0}),n(""),d("medium"),l(""),_("")},[o,c,p,h,t]);return e.jsxs("form",{className:s.addForm,onSubmit:v,children:[e.jsx("input",{type:"text",className:s.titleInput,placeholder:"New task title...",value:o,onChange:u=>n(u.target.value),required:!0}),e.jsxs("select",{value:c,onChange:u=>d(u.target.value),children:[e.jsx("option",{value:"urgent",children:"Urgent"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"low",children:"Low"})]}),e.jsx("input",{type:"date",value:p,onChange:u=>l(u.target.value),title:"Due date (optional)"}),e.jsx("input",{type:"text",className:s.tagsInput,placeholder:"Tags (comma-sep)",value:h,onChange:u=>_(u.target.value)}),e.jsx("button",{type:"submit",className:s.addBtn,disabled:!o.trim(),children:"ADD"})]})}const B=["urgent","high","medium","low"],I={urgent:0,high:1,medium:2,low:3},Ee={urgent:"Urgent",high:"High",medium:"Medium",low:"Low"};function Re(t,o,n,c){if(n!=="all"&&t.priority!==n||c!=="all"&&!t.tags.includes(c))return!1;if(o){const d=o.toLowerCase(),p=t.title.toLowerCase().includes(d),l=(t.description??"").toLowerCase().includes(d);if(!p&&!l)return!1}return!0}function L(t,o){return[...t].sort((n,c)=>{if(o==="priority"){const d=I[n.priority],p=I[c.priority];return d!==p?d-p:new Date(c.createdAt).getTime()-new Date(n.createdAt).getTime()}return o==="dueDate"?!n.dueDate&&!c.dueDate?0:n.dueDate?c.dueDate?n.dueDate.localeCompare(c.dueDate):-1:1:new Date(c.createdAt).getTime()-new Date(n.createdAt).getTime()})}function H({label:t,count:o,collapsed:n,onToggle:c}){return e.jsxs("div",{className:s.groupHeader,onClick:c,children:[e.jsx("svg",{className:`${s.groupChevron} ${n?s.collapsed:""}`,width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),e.jsx("span",{className:s.groupLabel,children:t}),e.jsx("span",{className:s.groupCount,children:o})]})}function Ae(){const t=j(r=>r.tasks),o=j(r=>r.loading),n=j(r=>r.filter),c=j(r=>r.fetchTasks),[d,p]=i.useState(new Set);i.useEffect(()=>{c()},[c]);const l=i.useCallback(r=>{p(f=>{const g=new Set(f);return g.has(r)?g.delete(r):g.add(r),g})},[]),{groups:h,completedTasks:_,totalIncomplete:v,totalCompleted:u}=i.useMemo(()=>{const f=[...t.values()].filter(m=>Re(m,n.search,n.priority,n.tag)),g=f.filter(m=>!m.completed),C=f.filter(m=>m.completed),b=L(g,n.sortBy),k=new Map;for(const m of B)k.set(m,[]);for(const m of b){const x=k.get(m.priority);x&&x.push(m)}const w=[];for(const m of B){const x=k.get(m)??[];x.length>0&&w.push({id:m,label:Ee[m],tasks:x})}return{groups:w,completedTasks:L(C,n.sortBy),totalIncomplete:g.length,totalCompleted:C.length}},[t,n]);if(o)return e.jsx("div",{className:s.container,children:e.jsx("div",{className:s.loading,children:"Loading tasks..."})});const y=h.length===0&&_.length===0,T=t.size===0;return e.jsxs("div",{className:s.container,"data-testid":"agenda-view",children:[e.jsx(Be,{}),e.jsxs("div",{className:s.stats,children:[e.jsxs("span",{children:[v," task",v!==1?"s":""]}),e.jsx("span",{className:s.statsSep,children:"|"}),e.jsxs("span",{children:[u," completed"]})]}),e.jsx("div",{className:s.taskList,children:T?e.jsxs("div",{className:s.emptyState,children:[e.jsx("div",{children:"No tasks yet"}),e.jsx("span",{children:"Add your first task below"})]}):y?e.jsxs("div",{className:s.emptyState,children:[e.jsx("div",{children:"No tasks match the current filter"}),e.jsx("span",{children:"Try adjusting your search or filter criteria"})]}):e.jsxs(e.Fragment,{children:[h.map(r=>{const f=d.has(r.id);return e.jsxs("div",{children:[e.jsx(H,{label:r.label,count:r.tasks.length,collapsed:f,onToggle:()=>l(r.id)}),!f&&r.tasks.map(g=>e.jsx(N,{task:g},g.id))]},r.id)}),n.showCompleted&&_.length>0&&e.jsxs("div",{children:[e.jsx(H,{label:"Completed",count:_.length,collapsed:d.has("__completed__"),onToggle:()=>l("__completed__")}),!d.has("__completed__")&&_.map(r=>e.jsx(N,{task:r},r.id))]})]})}),e.jsx(Oe,{})]})}export{Ae as default};
@@ -1,4 +1,4 @@
1
- import{U as _r,B as Cm,N as xr,C as ql,V as wn,D as Ot,F as Bf,M as ki,E as ft,R as Rm,G as Yt,H as Vt,I as Nu,J as wl,W as Fu,K as Hr,L as tn,O as fo,Q as ci,T as Sr,X as dr,Y as mo,Z as xo,_ as z_,$ as Ta,a0 as Ou,a1 as wm,a2 as br,a3 as va,a4 as Xt,a5 as Pm,a6 as kt,a7 as si,a8 as Lm,a9 as _l,aa as Dr,ab as ma,ac as ba,ad as go,ae as Bi,af as ps,ag as H_,ah as Um,ai as vo,aj as Vn,ak as Pl,al as pa,am as hs,an as Dm,ao as Im,ap as co,aq as Nm,ar as Fm,as as Om,at as km,au as Bm,av as Gm,aw as zm,ax as Hm,ay as Vm,az as Wm,aA as jm,aB as Xm,aC as Ym,aD as qm,aE as Km,aF as Zm,aG as Qm,aH as Sl,aI as os,aJ as Jm,aK as Fi,aL as $m,aM as eg,aN as Kl,aO as tg,aP as Zl,aQ as ng,aR as rg,aS as ig,aT as Gf,aU as Ut,aV as zf,aW as Hf,aX as ui,aY as _a,aZ as po,a_ as ho,a$ as li,b0 as ga,b1 as oi,b2 as Vf,b3 as ag,b4 as Wf,b5 as jf,b6 as Xf,b7 as ms,b8 as Yf,b9 as qf,ba as Kf,bb as bo,bc as og,bd as sg,be as lg,bf as cg,bg as Zf,bh as ug,bi as fg,bj as dg,bk as xl,bl,bm as El,bn as Ml,bo as ku,bp as Bu,bq as Gu,br as zu,bs as Hu,bt as Vu,bu as Wu,bv as ju,bw as Xu,bx as Yu,by as qu,bz as Ku,bA as Zu,bB as Qu,bC as Ju,bD as $u,bE as ef,bF as tf,bG as nf,bH as rf,bI as af,bJ as of,bK as sf,bL as lf,bM as cf,bN as uf,bO as ff,bP as df,bQ as pf,bR as hf,bS as mf,bT as gf,bU as Ll,bV as Ul,bW as Dl,bX as Il,bY as Nl,bZ as Fl,b_ as Ol,b$ as pg,c0 as vf,c1 as hg,c2 as cs,c3 as mg,c4 as _f,c5 as Sf,c6 as kl,c7 as Bl,c8 as Gl,c9 as Qf,ca as Jf,cb as Ss,cc as gg,cd as vg,ce as _g,cf as $f,cg as mh,ch as ed,ci as td,cj as nd,ck as rd,cl as xs,cm as id,cn as ad,co as od,cp as gh,cq as sd,cr as _o,cs as Ea,ct as ld,cu as Sg,cv as xg,cw as V_,cx as xf,cy as Kn,cz as zl,cA as bg,cB as Eg,cC as W_,cD as Mg,cE as Tg,cF as yg,cG as cd,cH as Ag,cI as Cg,cJ as j_,cK as X_,cL as Y_,cM as q_,cN as K_,cO as Z_,cP as Q_,cQ as J_,cR as $_,cS as eS,cT as tS,cU as nS,cV as rS,cW as iS,cX as aS,cY as oS,cZ as sS,c_ as lS,c$ as cS,d0 as Rg,d1 as uS,d2 as fS,d3 as dS,d4 as pS,d5 as ud,d6 as hS,d7 as mS,d8 as gS,d9 as vS,da as _S,db as SS,dc as xS,dd as bS,de as ES,df as MS,dg as wg,dh as TS,di as yS,dj as AS,dk as CS,dl as RS,dm as wS,dn as PS,dp as LS,dq as US,dr as DS,ds as IS,dt as NS,du as FS,dv as OS,dw as kS,dx as BS,dy as GS,dz as zS,dA as HS,dB as VS,dC as WS,dD as jS,dE as XS,dF as YS,dG as qS,dH as KS,dI as ZS,dJ as QS,dK as JS,dL as $S,dM as ua,dN as ex,dO as tx,dP as nx,dQ as rx,dR as ix,dS as ax,dT as bf,dU as ox,dV as sx,dW as lx,dX as cx,dY as ux,dZ as fx,d_ as dx,d$ as px,e0 as hx,e1 as mx,e2 as gx,e3 as vx,e4 as _x,e5 as Sx,e6 as xx,e7 as bx,e8 as Pg,e9 as Lg,ea as Ex,eb as Mx,ec as Tx,ed as yx,ee as Ax,ef as Cx,eg as Rx,eh as wx,ei as Px,ej as Lx,ek as Ux,el as Dx,em as Ix,en as Nx,eo as Fx,ep as Ox,eq as kx,er as Bx,es as Gx,et as zx,eu as Hx,ev as Vx,ew as Ug,ex as Wx,ey as jx,ez as Xx,eA as Yx,eB as Dg,eC as qx,eD as Kx,eE as Zx,eF as Qx,eG as Jx,eH as $x,eI as eb,eJ as tb,eK as nb,eL as rb,eM as ib,eN as fa,eO as ab,eP as ob,eQ as Ef,eR as sb,eS as lb,eT as cb,eU as ub,eV as fb,eW as db,eX as fr,eY as pb,eZ as hb,e_ as mb,e$ as gb,f0 as vb,f1 as _b,f2 as Sb,f3 as xb,f4 as bb,f5 as Eb,f6 as Mb,f7 as Tb,f8 as yb,f9 as Ab,fa as Cb,fb as Rb,fc as wb,fd as Pb,fe as Ig,ff as Lb,fg as Ub,fh as Db,fi as Ib,fj as Nb,fk as Fb,fl as Ob,fm as Hl,fn as kb,fo as Bb,fp as Ng,fq as Gb,fr as zb,fs as Hb,ft as Fg,fu as Og,fv as Vb,fw as Wb,fx as jb,fy as Xb,fz as Yb,fA as kg,fB as qb,fC as Kb,fD as Zb,fE as Qb,fF as Jb,fG as $b,fH as eE,fI as tE,fJ as nE,fK as Bg,fL as rE,fM as Mf,fN as iE,fO as aE,fP as oE,fQ as sE,fR as lE,fS as cE,fT as uE,fU as fE,fV as dE,fW as pE,fX as hE,fY as mE,fZ as gE,f_ as vE,f$ as da,g0 as _E,g1 as SE,g2 as xE,g3 as bE,g4 as EE,g5 as ME,g6 as TE,g7 as yE,g8 as AE,g9 as CE,ga as RE,gb as wE,gc as PE,gd as LE,ge as UE,gf as DE,gg as IE,gh as NE,gi as FE,gj as OE,gk as kE,gl as BE,gm as GE,gn as zE,go as HE,gp as VE,gq as WE,gr as jE,gs as XE,gt as YE,gu as Gg,gv as zg,gw as qE,gx as Hg,gy as KE,h as oe,k as Q,gz as ZE,gA as QE,gB as fi,gC as oa,gD as Vg,gE as JE,gF as sl,gG as vh,gH as $E,gI as e1,gJ as t1,gK as n1,gL as Ql,gM as ll,gN as Tl,gO as kn,gP as es,gQ as _h,gR as Tf,gS as pu,gT as r1,gU as i1,gV as a1,gW as o1,gX as Vl,w as Sh,gY as s1,gZ as l1,g_ as c1,g$ as u1,h0 as f1,h1 as d1,h2 as p1,h3 as h1,h4 as m1}from"./index-CCOZp8gY.js";function Wg(){let n=null,r=!1,s=null,l=null;function a(i,f){s(i,f),l=n.requestAnimationFrame(a)}return{start:function(){r!==!0&&s!==null&&(l=n.requestAnimationFrame(a),r=!0)},stop:function(){n.cancelAnimationFrame(l),r=!1},setAnimationLoop:function(i){s=i},setContext:function(i){n=i}}}function g1(n){const r=new WeakMap;function s(u,d){const p=u.array,h=u.usage,v=p.byteLength,S=n.createBuffer();n.bindBuffer(d,S),n.bufferData(d,p,h),u.onUploadCallback();let x;if(p instanceof Float32Array)x=n.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)x=n.HALF_FLOAT;else if(p instanceof Uint16Array)u.isFloat16BufferAttribute?x=n.HALF_FLOAT:x=n.UNSIGNED_SHORT;else if(p instanceof Int16Array)x=n.SHORT;else if(p instanceof Uint32Array)x=n.UNSIGNED_INT;else if(p instanceof Int32Array)x=n.INT;else if(p instanceof Int8Array)x=n.BYTE;else if(p instanceof Uint8Array)x=n.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)x=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:S,type:x,bytesPerElement:p.BYTES_PER_ELEMENT,version:u.version,size:v}}function l(u,d,p){const h=d.array,v=d.updateRanges;if(n.bindBuffer(p,u),v.length===0)n.bufferSubData(p,0,h);else{v.sort((x,A)=>x.start-A.start);let S=0;for(let x=1;x<v.length;x++){const A=v[S],P=v[x];P.start<=A.start+A.count+1?A.count=Math.max(A.count,P.start+P.count-A.start):(++S,v[S]=P)}v.length=S+1;for(let x=0,A=v.length;x<A;x++){const P=v[x];n.bufferSubData(p,P.start*h.BYTES_PER_ELEMENT,h,P.start,P.count)}d.clearUpdateRanges()}d.onUploadCallback()}function a(u){return u.isInterleavedBufferAttribute&&(u=u.data),r.get(u)}function i(u){u.isInterleavedBufferAttribute&&(u=u.data);const d=r.get(u);d&&(n.deleteBuffer(d.buffer),r.delete(u))}function f(u,d){if(u.isInterleavedBufferAttribute&&(u=u.data),u.isGLBufferAttribute){const h=r.get(u);(!h||h.version<u.version)&&r.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}const p=r.get(u);if(p===void 0)r.set(u,s(u,d));else if(p.version<u.version){if(p.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");l(p.buffer,u,d),p.version=u.version}}return{get:a,remove:i,update:f}}var v1=`#ifdef USE_ALPHAHASH
1
+ import{U as _r,B as Cm,N as xr,C as ql,V as wn,D as Ot,F as Bf,M as ki,E as ft,R as Rm,G as Yt,H as Vt,I as Nu,J as wl,W as Fu,K as Hr,L as tn,O as fo,Q as ci,T as Sr,X as dr,Y as mo,Z as xo,_ as z_,$ as Ta,a0 as Ou,a1 as wm,a2 as br,a3 as va,a4 as Xt,a5 as Pm,a6 as kt,a7 as si,a8 as Lm,a9 as _l,aa as Dr,ab as ma,ac as ba,ad as go,ae as Bi,af as ps,ag as H_,ah as Um,ai as vo,aj as Vn,ak as Pl,al as pa,am as hs,an as Dm,ao as Im,ap as co,aq as Nm,ar as Fm,as as Om,at as km,au as Bm,av as Gm,aw as zm,ax as Hm,ay as Vm,az as Wm,aA as jm,aB as Xm,aC as Ym,aD as qm,aE as Km,aF as Zm,aG as Qm,aH as Sl,aI as os,aJ as Jm,aK as Fi,aL as $m,aM as eg,aN as Kl,aO as tg,aP as Zl,aQ as ng,aR as rg,aS as ig,aT as Gf,aU as Ut,aV as zf,aW as Hf,aX as ui,aY as _a,aZ as po,a_ as ho,a$ as li,b0 as ga,b1 as oi,b2 as Vf,b3 as ag,b4 as Wf,b5 as jf,b6 as Xf,b7 as ms,b8 as Yf,b9 as qf,ba as Kf,bb as bo,bc as og,bd as sg,be as lg,bf as cg,bg as Zf,bh as ug,bi as fg,bj as dg,bk as xl,bl,bm as El,bn as Ml,bo as ku,bp as Bu,bq as Gu,br as zu,bs as Hu,bt as Vu,bu as Wu,bv as ju,bw as Xu,bx as Yu,by as qu,bz as Ku,bA as Zu,bB as Qu,bC as Ju,bD as $u,bE as ef,bF as tf,bG as nf,bH as rf,bI as af,bJ as of,bK as sf,bL as lf,bM as cf,bN as uf,bO as ff,bP as df,bQ as pf,bR as hf,bS as mf,bT as gf,bU as Ll,bV as Ul,bW as Dl,bX as Il,bY as Nl,bZ as Fl,b_ as Ol,b$ as pg,c0 as vf,c1 as hg,c2 as cs,c3 as mg,c4 as _f,c5 as Sf,c6 as kl,c7 as Bl,c8 as Gl,c9 as Qf,ca as Jf,cb as Ss,cc as gg,cd as vg,ce as _g,cf as $f,cg as mh,ch as ed,ci as td,cj as nd,ck as rd,cl as xs,cm as id,cn as ad,co as od,cp as gh,cq as sd,cr as _o,cs as Ea,ct as ld,cu as Sg,cv as xg,cw as V_,cx as xf,cy as Kn,cz as zl,cA as bg,cB as Eg,cC as W_,cD as Mg,cE as Tg,cF as yg,cG as cd,cH as Ag,cI as Cg,cJ as j_,cK as X_,cL as Y_,cM as q_,cN as K_,cO as Z_,cP as Q_,cQ as J_,cR as $_,cS as eS,cT as tS,cU as nS,cV as rS,cW as iS,cX as aS,cY as oS,cZ as sS,c_ as lS,c$ as cS,d0 as Rg,d1 as uS,d2 as fS,d3 as dS,d4 as pS,d5 as ud,d6 as hS,d7 as mS,d8 as gS,d9 as vS,da as _S,db as SS,dc as xS,dd as bS,de as ES,df as MS,dg as wg,dh as TS,di as yS,dj as AS,dk as CS,dl as RS,dm as wS,dn as PS,dp as LS,dq as US,dr as DS,ds as IS,dt as NS,du as FS,dv as OS,dw as kS,dx as BS,dy as GS,dz as zS,dA as HS,dB as VS,dC as WS,dD as jS,dE as XS,dF as YS,dG as qS,dH as KS,dI as ZS,dJ as QS,dK as JS,dL as $S,dM as ua,dN as ex,dO as tx,dP as nx,dQ as rx,dR as ix,dS as ax,dT as bf,dU as ox,dV as sx,dW as lx,dX as cx,dY as ux,dZ as fx,d_ as dx,d$ as px,e0 as hx,e1 as mx,e2 as gx,e3 as vx,e4 as _x,e5 as Sx,e6 as xx,e7 as bx,e8 as Pg,e9 as Lg,ea as Ex,eb as Mx,ec as Tx,ed as yx,ee as Ax,ef as Cx,eg as Rx,eh as wx,ei as Px,ej as Lx,ek as Ux,el as Dx,em as Ix,en as Nx,eo as Fx,ep as Ox,eq as kx,er as Bx,es as Gx,et as zx,eu as Hx,ev as Vx,ew as Ug,ex as Wx,ey as jx,ez as Xx,eA as Yx,eB as Dg,eC as qx,eD as Kx,eE as Zx,eF as Qx,eG as Jx,eH as $x,eI as eb,eJ as tb,eK as nb,eL as rb,eM as ib,eN as fa,eO as ab,eP as ob,eQ as Ef,eR as sb,eS as lb,eT as cb,eU as ub,eV as fb,eW as db,eX as fr,eY as pb,eZ as hb,e_ as mb,e$ as gb,f0 as vb,f1 as _b,f2 as Sb,f3 as xb,f4 as bb,f5 as Eb,f6 as Mb,f7 as Tb,f8 as yb,f9 as Ab,fa as Cb,fb as Rb,fc as wb,fd as Pb,fe as Ig,ff as Lb,fg as Ub,fh as Db,fi as Ib,fj as Nb,fk as Fb,fl as Ob,fm as Hl,fn as kb,fo as Bb,fp as Ng,fq as Gb,fr as zb,fs as Hb,ft as Fg,fu as Og,fv as Vb,fw as Wb,fx as jb,fy as Xb,fz as Yb,fA as kg,fB as qb,fC as Kb,fD as Zb,fE as Qb,fF as Jb,fG as $b,fH as eE,fI as tE,fJ as nE,fK as Bg,fL as rE,fM as Mf,fN as iE,fO as aE,fP as oE,fQ as sE,fR as lE,fS as cE,fT as uE,fU as fE,fV as dE,fW as pE,fX as hE,fY as mE,fZ as gE,f_ as vE,f$ as da,g0 as _E,g1 as SE,g2 as xE,g3 as bE,g4 as EE,g5 as ME,g6 as TE,g7 as yE,g8 as AE,g9 as CE,ga as RE,gb as wE,gc as PE,gd as LE,ge as UE,gf as DE,gg as IE,gh as NE,gi as FE,gj as OE,gk as kE,gl as BE,gm as GE,gn as zE,go as HE,gp as VE,gq as WE,gr as jE,gs as XE,gt as YE,gu as Gg,gv as zg,gw as qE,gx as Hg,gy as KE,h as oe,k as Q,gz as ZE,gA as QE,gB as fi,gC as oa,gD as Vg,gE as JE,gF as sl,gG as vh,gH as $E,gI as e1,gJ as t1,gK as n1,gL as Ql,gM as ll,gN as Tl,gO as kn,gP as es,gQ as _h,gR as Tf,gS as pu,gT as r1,gU as i1,gV as a1,gW as o1,gX as Vl,w as Sh,gY as s1,gZ as l1,g_ as c1,g$ as u1,h0 as f1,h1 as d1,h2 as p1,h3 as h1,h4 as m1}from"./index-DI0_qhqI.js";function Wg(){let n=null,r=!1,s=null,l=null;function a(i,f){s(i,f),l=n.requestAnimationFrame(a)}return{start:function(){r!==!0&&s!==null&&(l=n.requestAnimationFrame(a),r=!0)},stop:function(){n.cancelAnimationFrame(l),r=!1},setAnimationLoop:function(i){s=i},setContext:function(i){n=i}}}function g1(n){const r=new WeakMap;function s(u,d){const p=u.array,h=u.usage,v=p.byteLength,S=n.createBuffer();n.bindBuffer(d,S),n.bufferData(d,p,h),u.onUploadCallback();let x;if(p instanceof Float32Array)x=n.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)x=n.HALF_FLOAT;else if(p instanceof Uint16Array)u.isFloat16BufferAttribute?x=n.HALF_FLOAT:x=n.UNSIGNED_SHORT;else if(p instanceof Int16Array)x=n.SHORT;else if(p instanceof Uint32Array)x=n.UNSIGNED_INT;else if(p instanceof Int32Array)x=n.INT;else if(p instanceof Int8Array)x=n.BYTE;else if(p instanceof Uint8Array)x=n.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)x=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:S,type:x,bytesPerElement:p.BYTES_PER_ELEMENT,version:u.version,size:v}}function l(u,d,p){const h=d.array,v=d.updateRanges;if(n.bindBuffer(p,u),v.length===0)n.bufferSubData(p,0,h);else{v.sort((x,A)=>x.start-A.start);let S=0;for(let x=1;x<v.length;x++){const A=v[S],P=v[x];P.start<=A.start+A.count+1?A.count=Math.max(A.count,P.start+P.count-A.start):(++S,v[S]=P)}v.length=S+1;for(let x=0,A=v.length;x<A;x++){const P=v[x];n.bufferSubData(p,P.start*h.BYTES_PER_ELEMENT,h,P.start,P.count)}d.clearUpdateRanges()}d.onUploadCallback()}function a(u){return u.isInterleavedBufferAttribute&&(u=u.data),r.get(u)}function i(u){u.isInterleavedBufferAttribute&&(u=u.data);const d=r.get(u);d&&(n.deleteBuffer(d.buffer),r.delete(u))}function f(u,d){if(u.isInterleavedBufferAttribute&&(u=u.data),u.isGLBufferAttribute){const h=r.get(u);(!h||h.version<u.version)&&r.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}const p=r.get(u);if(p===void 0)r.set(u,s(u,d));else if(p.version<u.version){if(p.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");l(p.buffer,u,d),p.version=u.version}}return{get:a,remove:i,update:f}}var v1=`#ifdef USE_ALPHAHASH
2
2
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
3
3
  #endif`,_1=`#ifdef USE_ALPHAHASH
4
4
  const float ALPHA_HASH_SCALE = 0.05;
@@ -1 +1 @@
1
- import{S as ae,p as G,r as g,s as F,a as R,n as U,i as Q,b as W,t as ie,c as D,f as ne,d as re,e as z,g as X,h as v,j as Y,u as ee,k as s,l as C,m as M,o as oe,q as k}from"./index-CCOZp8gY.js";var le=class extends ae{constructor(e,t){super(),this.options=t,this.#s=e,this.#i=null,this.#a=G(),this.bindMethods(),this.setOptions(t)}#s;#e=void 0;#m=void 0;#t=void 0;#r;#d;#a;#i;#f;#u;#h;#o;#l;#n;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),K(this.#e,this.options)?this.#c():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return L(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return L(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#x(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,a=this.#e;if(this.options=this.#s.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof g(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#e.setOptions(this.options),t._defaulted&&!F(this.options,t)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&V(this.#e,a,this.options,t)&&this.#c(),this.updateResult(),r&&(this.#e!==a||g(this.options.enabled,this.#e)!==g(t.enabled,this.#e)||R(this.options.staleTime,this.#e)!==R(t.staleTime,this.#e))&&this.#v();const n=this.#_();r&&(this.#e!==a||g(this.options.enabled,this.#e)!==g(t.enabled,this.#e)||n!==this.#n)&&this.#y(n)}getOptimisticResult(e){const t=this.#s.getQueryCache().build(this.#s,e),a=this.createResult(t,e);return de(this,a)&&(this.#t=a,this.#d=this.options,this.#r=this.#e.state),a}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(a,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#s.defaultQueryOptions(e),a=this.#s.getQueryCache().build(this.#s,t);return a.fetch().then(()=>this.createResult(a,t))}fetch(e){return this.#c({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#c(e){this.#j();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(U)),t}#v(){this.#g();const e=R(this.options.staleTime,this.#e);if(Q||this.#t.isStale||!W(e))return;const a=ie(this.#t.dataUpdatedAt,e)+1;this.#o=D.setTimeout(()=>{this.#t.isStale||this.updateResult()},a)}#_(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#x(),this.#n=e,!(Q||g(this.options.enabled,this.#e)===!1||!W(this.#n)||this.#n===0)&&(this.#l=D.setInterval(()=>{(this.options.refetchIntervalInBackground||ne.isFocused())&&this.#c()},this.#n))}#b(){this.#v(),this.#y(this.#_())}#g(){this.#o&&(D.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#l&&(D.clearInterval(this.#l),this.#l=void 0)}createResult(e,t){const a=this.#e,r=this.options,n=this.#t,h=this.#r,o=this.#d,f=e!==a?e.state:this.#m,{state:d}=e;let u={...d},x=!1,p;if(t._optimisticResults){const b=this.hasListeners(),w=!b&&K(e,t),E=b&&V(e,a,t,r);(w||E)&&(u={...u,...re(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:c,errorUpdatedAt:_,status:l}=u;p=u.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&l==="pending"){let b;n?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(b=n.data,y=!0):b=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,b!==void 0&&(l="success",p=z(n?.data,b,t),x=!0)}if(t.select&&p!==void 0&&!y)if(n&&p===h?.data&&t.select===this.#f)p=this.#u;else try{this.#f=t.select,p=t.select(p),p=z(n?.data,p,t),this.#u=p,this.#i=null}catch(b){this.#i=b}this.#i&&(c=this.#i,p=this.#u,_=Date.now(),l="error");const j=u.fetchStatus==="fetching",T=l==="pending",I=l==="error",$=T&&j,H=p!==void 0,S={status:l,fetchStatus:u.fetchStatus,isPending:T,isSuccess:l==="success",isError:I,isInitialLoading:$,isLoading:$,data:p,dataUpdatedAt:u.dataUpdatedAt,error:c,errorUpdatedAt:_,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>f.dataUpdateCount||u.errorUpdateCount>f.errorUpdateCount,isFetching:j,isRefetching:j&&!T,isLoadingError:I&&!H,isPaused:u.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:I&&H,isStale:A(e,t),refetch:this.refetch,promise:this.#a,isEnabled:g(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const b=S.data!==void 0,w=S.status==="error"&&!b,E=B=>{w?B.reject(S.error):b&&B.resolve(S.data)},q=()=>{const B=this.#a=S.promise=G();E(B)},N=this.#a;switch(N.status){case"pending":e.queryHash===a.queryHash&&E(N);break;case"fulfilled":(w||S.data!==N.value)&&q();break;case"rejected":(!w||S.error!==N.reason)&&q();break}}return S}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#d=this.options,this.#r.data!==void 0&&(this.#h=this.#e),F(t,e))return;this.#t=t;const a=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,n=typeof r=="function"?r():r;if(n==="all"||!n&&!this.#p.size)return!0;const h=new Set(n??this.#p);return this.options.throwOnError&&h.add("error"),Object.keys(this.#t).some(o=>{const m=o;return this.#t[m]!==e[m]&&h.has(m)})};this.#S({listeners:a()})}#j(){const e=this.#s.getQueryCache().build(this.#s,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#m=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){X.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#s.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function ce(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function K(e,t){return ce(e,t)||e.state.data!==void 0&&L(e,t,t.refetchOnMount)}function L(e,t,a){if(g(t.enabled,e)!==!1&&R(t.staleTime,e)!=="static"){const r=typeof a=="function"?a(e):a;return r==="always"||r!==!1&&A(e,t)}return!1}function V(e,t,a,r){return(e!==t||g(r.enabled,e)===!1)&&(!a.suspense||e.state.status!=="error")&&A(e,a)}function A(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(R(t.staleTime,e))}function de(e,t){return!F(e.getCurrentResult(),t)}var te=v.createContext(!1),ue=()=>v.useContext(te);te.Provider;function he(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pe=v.createContext(he()),me=()=>v.useContext(pe),fe=(e,t,a)=>{const r=a?.state.error&&typeof e.throwOnError=="function"?Y(e.throwOnError,[a.state.error,a]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ve=e=>{v.useEffect(()=>{e.clearReset()},[e])},_e=({result:e,errorResetBoundary:t,throwOnError:a,query:r,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(n&&e.data===void 0||Y(a,[e.error,r])),ye=e=>{if(e.suspense){const a=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>a(r(...n)):a(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},be=(e,t)=>e.isLoading&&e.isFetching&&!t,ge=(e,t)=>e?.suspense&&t.isPending,Z=(e,t,a)=>t.fetchOptimistic(e).catch(()=>{a.clearReset()});function xe(e,t,a){const r=ue(),n=me(),h=ee(),o=h.defaultQueryOptions(e);h.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const m=h.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",ye(o),fe(o,n,m),ve(n);const f=!h.getQueryCache().get(o.queryHash),[d]=v.useState(()=>new t(h,o)),u=d.getOptimisticResult(o),x=!r&&e.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(p=>{const c=x?d.subscribe(X.batchCalls(p)):U;return d.updateResult(),c},[d,x]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),v.useEffect(()=>{d.setOptions(o)},[o,d]),ge(o,u))throw Z(o,d,n);if(_e({result:u,errorResetBoundary:n,throwOnError:o.throwOnError,query:m,suspense:o.suspense}))throw u.error;return h.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Q&&be(u,r)&&(f?Z(o,d,n):m?.promise)?.catch(U).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?u:d.trackResult(u)}function P(e,t){return xe(e,le)}function je({tabs:e,activeTab:t,onTabChange:a,containerClassName:r,panelClassName:n,tabListClassName:h,tabClassName:o,activeTabClassName:m}){return s.jsxs("div",{className:r,children:[s.jsx("div",{role:"tablist",className:h,style:h?void 0:{display:"flex",gap:"2px",borderBottom:"1px solid var(--border-subtle, rgba(255,255,255,0.06))",marginBottom:"12px"},children:e.map(f=>{const d=t===f.id,u=[o,d&&m].filter(Boolean).join(" ");return s.jsx("button",{role:"tab","aria-selected":d,onClick:()=>a(f.id),className:u||void 0,style:u?void 0:{padding:"8px 16px",background:d?"var(--bg-accent, rgba(0,229,255,0.1))":"transparent",border:"none",borderBottom:d?"2px solid var(--accent-cyan, #00e5ff)":"2px solid transparent",color:d?"var(--accent-cyan, #00e5ff)":"var(--text-secondary, #8888aa)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"var(--font-mono, monospace)",transition:"color 0.15s, background 0.15s"},children:f.label},f.id)})}),s.jsx("div",{role:"tabpanel",className:n,children:e.find(f=>f.id===t)?.content})]})}const Se="_container_1uen7_5",Te="_filters_1uen7_15",we="_filterGroup_1uen7_22",Ce="_filterLabel_1uen7_28",Re="_filterInput_1uen7_36",Ee="_sortToggle_1uen7_54",Ne="_results_1uen7_72",Be="_emptyState_1uen7_80",De="_row_1uen7_89",Oe="_rowTitle_1uen7_107",Ie="_rowProject_1uen7_115",Me="_rowDate_1uen7_123",ke="_rowDuration_1uen7_129",Pe="_rowStatus_1uen7_135",Fe="_rowMeta_1uen7_165",Ue="_resumeBtn_1uen7_171",Qe="_deleteBtn_1uen7_189",Le="_pagination_1uen7_207",Ae="_pageBtn_1uen7_215",$e="_pageBtnActive_1uen7_236",He="_pageEllipsis_1uen7_242",qe="_detailOverlay_1uen7_249",Ge="_detailCard_1uen7_259",We="_detailTabs_1uen7_273",ze="_detailTabPanel_1uen7_281",Ke="_detailHeader_1uen7_289",Ve="_detailTitle_1uen7_296",Ze="_detailMeta_1uen7_302",Je="_detailCloseBtn_1uen7_309",Xe="_detailBody_1uen7_322",Ye="_convoEntry_1uen7_327",et="_convoEntryHeader_1uen7_335",tt="_copyBtn_1uen7_342",st="_convoPrompt_1uen7_364",at="_convoResponse_1uen7_369",it="_convoTime_1uen7_374",nt="_convoText_1uen7_380",rt="_activityEntry_1uen7_387",ot="_activityTime_1uen7_395",lt="_activityBadge_1uen7_401",ct="_activityBadgeTool_1uen7_410",dt="_activityBadgeEvent_1uen7_415",ut="_activityDetail_1uen7_420",i={container:Se,filters:Te,filterGroup:we,filterLabel:Ce,filterInput:Re,sortToggle:Ee,results:Ne,emptyState:Be,row:De,rowTitle:Oe,rowProject:Ie,rowDate:Me,rowDuration:ke,rowStatus:Pe,rowMeta:Fe,resumeBtn:Ue,deleteBtn:Qe,pagination:Le,pageBtn:Ae,pageBtnActive:$e,pageEllipsis:He,detailOverlay:qe,detailCard:Ge,detailTabs:We,detailTabPanel:ze,detailHeader:Ke,detailTitle:Ve,detailMeta:Ze,detailCloseBtn:Je,detailBody:Xe,convoEntry:Ye,convoEntryHeader:et,copyBtn:tt,convoPrompt:st,convoResponse:at,convoTime:it,convoText:nt,activityEntry:rt,activityTime:ot,activityBadge:lt,activityBadgeTool:ct,activityBadgeEvent:dt,activityDetail:ut},se=50;function O(e){if(e<1e3)return"<1s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const a=Math.floor(t/60);return a<60?`${a}m ${t%60}s`:`${Math.floor(a/60)}h ${a%60}m`}function ht(e){return e?new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):"--"}function J(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}function pt(e){const t=new URLSearchParams;e.query&&t.set("query",e.query),e.project&&t.set("project",e.project),e.status==="archived"?t.set("archived","true"):e.status&&t.set("status",e.status),e.dateFrom&&t.set("dateFrom",String(new Date(e.dateFrom).getTime())),e.dateTo&&t.set("dateTo",String(new Date(e.dateTo+"T23:59:59").getTime()));const a={date:"started_at",duration:"last_activity_at",prompts:"started_at",tools:"started_at"};return t.set("sortBy",a[e.sortBy]||"started_at"),t.set("sortDir",e.sortDir),t.set("page",String(e.page)),t.set("pageSize",String(se)),t.toString()}function xt(){const e=ee(),[t,a]=v.useState({query:"",project:"",status:"",dateFrom:"",dateTo:"",sortBy:"date",sortDir:"desc",page:1}),[r,n]=v.useState(null),{data:h}=P({queryKey:["db-projects"],queryFn:async()=>{const l=await C("/api/db/projects");if(!l.ok)throw new Error("Failed to load projects");return l.json()},staleTime:6e4}),{data:o,isLoading:m}=P({queryKey:["db-sessions",t],queryFn:async()=>{const l=await C(`/api/db/sessions?${pt(t)}`);if(!l.ok)throw new Error("Failed to load sessions");return l.json()}}),{data:f}=P({queryKey:["db-session-detail",r],queryFn:async()=>{if(!r)return null;const l=await C(`/api/db/sessions/${encodeURIComponent(r)}`);if(!l.ok)throw new Error("Failed to load session detail");return l.json()},enabled:!!r}),d=v.useCallback((l,y)=>{a(j=>({...j,[l]:y,page:l==="page"?y:1}))},[]),u=v.useCallback(async(l,y)=>{l.stopPropagation(),window.confirm("Delete this session from history? This cannot be undone.")&&(await C(`/api/db/sessions/${encodeURIComponent(y)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["db-sessions"]}))},[e]),x=v.useCallback(async(l,y)=>{l.stopPropagation();try{const T=await(await C(`/api/sessions/${encodeURIComponent(y)}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();T.ok?M("Resuming Claude session in terminal","success"):M(T.error||"Resume failed","error")}catch(j){M(j.message,"error")}},[]),p=o?.sessions??[],c=o?.total??0,_=Math.ceil(c/se);return s.jsxs("div",{className:i.container,"data-testid":"history-view",children:[s.jsxs("div",{className:i.filters,children:[s.jsx(oe,{value:t.query,onChange:l=>d("query",l),placeholder:"Search prompts..."}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Project"}),s.jsx(k,{value:t.project,onChange:l=>d("project",l),options:[{value:"",label:"All"},...h?.map(l=>({value:l.project_path,label:l.project_name}))??[]]})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Status"}),s.jsx(k,{value:t.status,onChange:l=>d("status",l),options:[{value:"",label:"All"},{value:"idle",label:"Idle"},{value:"working",label:"Working"},{value:"waiting",label:"Waiting"},{value:"ended",label:"Ended"},{value:"archived",label:"Archived"}]})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"From"}),s.jsx("input",{type:"date",className:i.filterInput,value:t.dateFrom,onChange:l=>d("dateFrom",l.target.value)})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"To"}),s.jsx("input",{type:"date",className:i.filterInput,value:t.dateTo,onChange:l=>d("dateTo",l.target.value)})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Sort"}),s.jsx(k,{value:t.sortBy,onChange:l=>d("sortBy",l),options:[{value:"date",label:"Date"},{value:"duration",label:"Activity"},{value:"prompts",label:"Prompts"},{value:"tools",label:"Tools"}]}),s.jsx("button",{className:i.sortToggle,onClick:()=>d("sortDir",t.sortDir==="desc"?"asc":"desc"),children:t.sortDir.toUpperCase()})]})]}),s.jsxs("div",{className:i.results,children:[m&&s.jsx("div",{className:i.emptyState,children:"Loading..."}),!m&&p.length===0&&s.jsx("div",{className:i.emptyState,children:"No sessions found"}),p.map(l=>s.jsx(ft,{session:l,onClick:()=>n(l.id),onResume:y=>x(y,l.id),onDelete:y=>u(y,l.id)},l.id))]}),_>1&&s.jsx(vt,{currentPage:t.page,totalPages:_,onPageChange:l=>d("page",l)}),r&&f&&s.jsx(yt,{detail:f,onClose:()=>n(null)})]})}function mt(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("polyline",{points:"1 4 1 10 7 10"}),s.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})}function ft({session:e,onClick:t,onResume:a,onDelete:r}){const n=e.ended_at&&e.started_at?O(e.ended_at-e.started_at):e.started_at?O(Date.now()-e.started_at):"--";return s.jsxs("div",{className:i.row,onClick:t,children:[s.jsx("span",{className:i.rowTitle,children:e.title||e.project_name||e.id}),s.jsx("span",{className:i.rowProject,children:e.project_name}),s.jsx("span",{className:i.rowDate,children:ht(e.started_at)}),s.jsx("span",{className:i.rowDuration,children:n}),s.jsx("span",{className:i.rowStatus,"data-status":e.status,children:e.status.toUpperCase()}),s.jsxs("span",{className:i.rowMeta,children:[e.total_prompts," prompts"]}),s.jsxs("span",{className:i.rowMeta,children:[e.total_tool_calls," tools"]}),s.jsx("button",{className:i.resumeBtn,onClick:a,title:"Resume session","aria-label":"Resume session",children:s.jsx(mt,{})}),s.jsx("button",{className:i.deleteBtn,onClick:r,title:"Delete session","aria-label":"Delete session",children:"x"})]})}function vt({currentPage:e,totalPages:t,onPageChange:a}){const r=[];for(let o=1;o<=t;o++)(o===1||o===t||o>=e-2&&o<=e+2)&&r.push(o);const n=[];let h=0;for(const o of r)typeof o=="number"&&(h&&o-h>1&&n.push("ellipsis"),n.push(o),h=o);return s.jsxs("div",{className:i.pagination,children:[s.jsx("button",{className:i.pageBtn,disabled:e<=1,onClick:()=>a(e-1),children:"Prev"}),n.map((o,m)=>o==="ellipsis"?s.jsx("span",{className:i.pageEllipsis,children:"..."},`e-${m}`):s.jsx("button",{className:`${i.pageBtn} ${o===e?i.pageBtnActive:""}`,onClick:()=>a(o),children:o},o)),s.jsx("button",{className:i.pageBtn,disabled:e>=t,onClick:()=>a(e+1),children:"Next"})]})}function _t({text:e}){const[t,a]=v.useState(!1),r=n=>{n.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{a(!0),setTimeout(()=>a(!1),1500)})};return s.jsx("button",{className:i.copyBtn,onClick:r,"aria-label":"Copy to clipboard",title:"Copy to clipboard",children:t?"✓":"⎘"})}function yt({detail:e,onClose:t}){const[a,r]=v.useState("conversation"),{session:n,prompts:h,responses:o,tool_calls:m,events:f}=e,d=[...h.map(c=>({type:"prompt",timestamp:c.timestamp,text:c.text})),...o.map(c=>({type:"response",timestamp:c.timestamp,text:c.text_excerpt}))].sort((c,_)=>c.timestamp-_.timestamp),u=[...m.map(c=>({kind:"tool",label:c.tool_name,detail:c.tool_input_summary,timestamp:c.timestamp})),...f.map(c=>({kind:"event",label:c.event_type,detail:c.detail,timestamp:c.timestamp}))].sort((c,_)=>_.timestamp-c.timestamp),x=n.ended_at&&n.started_at?O(n.ended_at-n.started_at):n.started_at?O(Date.now()-n.started_at):"--",p=[{id:"conversation",label:`Conversation (${d.length})`,content:s.jsxs("div",{className:i.detailBody,children:[d.length===0&&s.jsx("div",{className:i.emptyState,children:"No conversation recorded"}),d.map((c,_)=>s.jsxs("div",{className:`${i.convoEntry} ${c.type==="prompt"?i.convoPrompt:i.convoResponse}`,children:[s.jsxs("div",{className:i.convoEntryHeader,children:[s.jsx("div",{className:i.convoTime,children:J(c.timestamp)}),s.jsx(_t,{text:c.text})]}),s.jsx("div",{className:i.convoText,children:c.text})]},_))]})},{id:"activity",label:`Activity (${u.length})`,content:s.jsxs("div",{className:i.detailBody,children:[u.length===0&&s.jsx("div",{className:i.emptyState,children:"No activity recorded"}),u.map((c,_)=>s.jsxs("div",{className:i.activityEntry,children:[s.jsx("span",{className:i.activityTime,children:J(c.timestamp)}),s.jsx("span",{className:`${i.activityBadge} ${c.kind==="tool"?i.activityBadgeTool:i.activityBadgeEvent}`,children:c.label}),s.jsx("span",{className:i.activityDetail,children:c.detail})]},_))]})}];return s.jsx("div",{className:i.detailOverlay,onClick:t,children:s.jsxs("div",{className:i.detailCard,onClick:c=>c.stopPropagation(),children:[s.jsxs("div",{className:i.detailHeader,children:[s.jsxs("div",{children:[s.jsx("h2",{className:i.detailTitle,children:n.project_name||n.id}),s.jsxs("div",{className:i.detailMeta,children:[s.jsxs("span",{children:["Status: ",n.status.toUpperCase()]}),s.jsxs("span",{children:["Model: ",n.model||"--"]}),s.jsxs("span",{children:["Duration: ",x]}),s.jsxs("span",{children:[n.total_prompts," prompts / ",n.total_tool_calls," tools"]})]})]}),s.jsx("button",{className:i.detailCloseBtn,onClick:t,"aria-label":"Close",children:"x"})]}),s.jsx(je,{tabs:p,activeTab:a,onTabChange:r,containerClassName:i.detailTabs,panelClassName:i.detailTabPanel})]})})}export{xt as default};
1
+ import{S as ae,p as G,r as g,s as F,a as R,n as U,i as Q,b as W,t as ie,c as D,f as ne,d as re,e as z,g as X,h as v,j as Y,u as ee,k as s,l as C,m as M,o as oe,q as k}from"./index-DI0_qhqI.js";var le=class extends ae{constructor(e,t){super(),this.options=t,this.#s=e,this.#i=null,this.#a=G(),this.bindMethods(),this.setOptions(t)}#s;#e=void 0;#m=void 0;#t=void 0;#r;#d;#a;#i;#f;#u;#h;#o;#l;#n;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),K(this.#e,this.options)?this.#c():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return L(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return L(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#x(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,a=this.#e;if(this.options=this.#s.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof g(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#e.setOptions(this.options),t._defaulted&&!F(this.options,t)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&V(this.#e,a,this.options,t)&&this.#c(),this.updateResult(),r&&(this.#e!==a||g(this.options.enabled,this.#e)!==g(t.enabled,this.#e)||R(this.options.staleTime,this.#e)!==R(t.staleTime,this.#e))&&this.#v();const n=this.#_();r&&(this.#e!==a||g(this.options.enabled,this.#e)!==g(t.enabled,this.#e)||n!==this.#n)&&this.#y(n)}getOptimisticResult(e){const t=this.#s.getQueryCache().build(this.#s,e),a=this.createResult(t,e);return de(this,a)&&(this.#t=a,this.#d=this.options,this.#r=this.#e.state),a}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(a,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#s.defaultQueryOptions(e),a=this.#s.getQueryCache().build(this.#s,t);return a.fetch().then(()=>this.createResult(a,t))}fetch(e){return this.#c({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#c(e){this.#j();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(U)),t}#v(){this.#g();const e=R(this.options.staleTime,this.#e);if(Q||this.#t.isStale||!W(e))return;const a=ie(this.#t.dataUpdatedAt,e)+1;this.#o=D.setTimeout(()=>{this.#t.isStale||this.updateResult()},a)}#_(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#x(),this.#n=e,!(Q||g(this.options.enabled,this.#e)===!1||!W(this.#n)||this.#n===0)&&(this.#l=D.setInterval(()=>{(this.options.refetchIntervalInBackground||ne.isFocused())&&this.#c()},this.#n))}#b(){this.#v(),this.#y(this.#_())}#g(){this.#o&&(D.clearTimeout(this.#o),this.#o=void 0)}#x(){this.#l&&(D.clearInterval(this.#l),this.#l=void 0)}createResult(e,t){const a=this.#e,r=this.options,n=this.#t,h=this.#r,o=this.#d,f=e!==a?e.state:this.#m,{state:d}=e;let u={...d},x=!1,p;if(t._optimisticResults){const b=this.hasListeners(),w=!b&&K(e,t),E=b&&V(e,a,t,r);(w||E)&&(u={...u,...re(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:c,errorUpdatedAt:_,status:l}=u;p=u.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&l==="pending"){let b;n?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(b=n.data,y=!0):b=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,b!==void 0&&(l="success",p=z(n?.data,b,t),x=!0)}if(t.select&&p!==void 0&&!y)if(n&&p===h?.data&&t.select===this.#f)p=this.#u;else try{this.#f=t.select,p=t.select(p),p=z(n?.data,p,t),this.#u=p,this.#i=null}catch(b){this.#i=b}this.#i&&(c=this.#i,p=this.#u,_=Date.now(),l="error");const j=u.fetchStatus==="fetching",T=l==="pending",I=l==="error",$=T&&j,H=p!==void 0,S={status:l,fetchStatus:u.fetchStatus,isPending:T,isSuccess:l==="success",isError:I,isInitialLoading:$,isLoading:$,data:p,dataUpdatedAt:u.dataUpdatedAt,error:c,errorUpdatedAt:_,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>f.dataUpdateCount||u.errorUpdateCount>f.errorUpdateCount,isFetching:j,isRefetching:j&&!T,isLoadingError:I&&!H,isPaused:u.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:I&&H,isStale:A(e,t),refetch:this.refetch,promise:this.#a,isEnabled:g(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const b=S.data!==void 0,w=S.status==="error"&&!b,E=B=>{w?B.reject(S.error):b&&B.resolve(S.data)},q=()=>{const B=this.#a=S.promise=G();E(B)},N=this.#a;switch(N.status){case"pending":e.queryHash===a.queryHash&&E(N);break;case"fulfilled":(w||S.data!==N.value)&&q();break;case"rejected":(!w||S.error!==N.reason)&&q();break}}return S}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#d=this.options,this.#r.data!==void 0&&(this.#h=this.#e),F(t,e))return;this.#t=t;const a=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,n=typeof r=="function"?r():r;if(n==="all"||!n&&!this.#p.size)return!0;const h=new Set(n??this.#p);return this.options.throwOnError&&h.add("error"),Object.keys(this.#t).some(o=>{const m=o;return this.#t[m]!==e[m]&&h.has(m)})};this.#S({listeners:a()})}#j(){const e=this.#s.getQueryCache().build(this.#s,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#m=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){X.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#s.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function ce(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function K(e,t){return ce(e,t)||e.state.data!==void 0&&L(e,t,t.refetchOnMount)}function L(e,t,a){if(g(t.enabled,e)!==!1&&R(t.staleTime,e)!=="static"){const r=typeof a=="function"?a(e):a;return r==="always"||r!==!1&&A(e,t)}return!1}function V(e,t,a,r){return(e!==t||g(r.enabled,e)===!1)&&(!a.suspense||e.state.status!=="error")&&A(e,a)}function A(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(R(t.staleTime,e))}function de(e,t){return!F(e.getCurrentResult(),t)}var te=v.createContext(!1),ue=()=>v.useContext(te);te.Provider;function he(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pe=v.createContext(he()),me=()=>v.useContext(pe),fe=(e,t,a)=>{const r=a?.state.error&&typeof e.throwOnError=="function"?Y(e.throwOnError,[a.state.error,a]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ve=e=>{v.useEffect(()=>{e.clearReset()},[e])},_e=({result:e,errorResetBoundary:t,throwOnError:a,query:r,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(n&&e.data===void 0||Y(a,[e.error,r])),ye=e=>{if(e.suspense){const a=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>a(r(...n)):a(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},be=(e,t)=>e.isLoading&&e.isFetching&&!t,ge=(e,t)=>e?.suspense&&t.isPending,Z=(e,t,a)=>t.fetchOptimistic(e).catch(()=>{a.clearReset()});function xe(e,t,a){const r=ue(),n=me(),h=ee(),o=h.defaultQueryOptions(e);h.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const m=h.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",ye(o),fe(o,n,m),ve(n);const f=!h.getQueryCache().get(o.queryHash),[d]=v.useState(()=>new t(h,o)),u=d.getOptimisticResult(o),x=!r&&e.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(p=>{const c=x?d.subscribe(X.batchCalls(p)):U;return d.updateResult(),c},[d,x]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),v.useEffect(()=>{d.setOptions(o)},[o,d]),ge(o,u))throw Z(o,d,n);if(_e({result:u,errorResetBoundary:n,throwOnError:o.throwOnError,query:m,suspense:o.suspense}))throw u.error;return h.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Q&&be(u,r)&&(f?Z(o,d,n):m?.promise)?.catch(U).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?u:d.trackResult(u)}function P(e,t){return xe(e,le)}function je({tabs:e,activeTab:t,onTabChange:a,containerClassName:r,panelClassName:n,tabListClassName:h,tabClassName:o,activeTabClassName:m}){return s.jsxs("div",{className:r,children:[s.jsx("div",{role:"tablist",className:h,style:h?void 0:{display:"flex",gap:"2px",borderBottom:"1px solid var(--border-subtle, rgba(255,255,255,0.06))",marginBottom:"12px"},children:e.map(f=>{const d=t===f.id,u=[o,d&&m].filter(Boolean).join(" ");return s.jsx("button",{role:"tab","aria-selected":d,onClick:()=>a(f.id),className:u||void 0,style:u?void 0:{padding:"8px 16px",background:d?"var(--bg-accent, rgba(0,229,255,0.1))":"transparent",border:"none",borderBottom:d?"2px solid var(--accent-cyan, #00e5ff)":"2px solid transparent",color:d?"var(--accent-cyan, #00e5ff)":"var(--text-secondary, #8888aa)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"var(--font-mono, monospace)",transition:"color 0.15s, background 0.15s"},children:f.label},f.id)})}),s.jsx("div",{role:"tabpanel",className:n,children:e.find(f=>f.id===t)?.content})]})}const Se="_container_1uen7_5",Te="_filters_1uen7_15",we="_filterGroup_1uen7_22",Ce="_filterLabel_1uen7_28",Re="_filterInput_1uen7_36",Ee="_sortToggle_1uen7_54",Ne="_results_1uen7_72",Be="_emptyState_1uen7_80",De="_row_1uen7_89",Oe="_rowTitle_1uen7_107",Ie="_rowProject_1uen7_115",Me="_rowDate_1uen7_123",ke="_rowDuration_1uen7_129",Pe="_rowStatus_1uen7_135",Fe="_rowMeta_1uen7_165",Ue="_resumeBtn_1uen7_171",Qe="_deleteBtn_1uen7_189",Le="_pagination_1uen7_207",Ae="_pageBtn_1uen7_215",$e="_pageBtnActive_1uen7_236",He="_pageEllipsis_1uen7_242",qe="_detailOverlay_1uen7_249",Ge="_detailCard_1uen7_259",We="_detailTabs_1uen7_273",ze="_detailTabPanel_1uen7_281",Ke="_detailHeader_1uen7_289",Ve="_detailTitle_1uen7_296",Ze="_detailMeta_1uen7_302",Je="_detailCloseBtn_1uen7_309",Xe="_detailBody_1uen7_322",Ye="_convoEntry_1uen7_327",et="_convoEntryHeader_1uen7_335",tt="_copyBtn_1uen7_342",st="_convoPrompt_1uen7_364",at="_convoResponse_1uen7_369",it="_convoTime_1uen7_374",nt="_convoText_1uen7_380",rt="_activityEntry_1uen7_387",ot="_activityTime_1uen7_395",lt="_activityBadge_1uen7_401",ct="_activityBadgeTool_1uen7_410",dt="_activityBadgeEvent_1uen7_415",ut="_activityDetail_1uen7_420",i={container:Se,filters:Te,filterGroup:we,filterLabel:Ce,filterInput:Re,sortToggle:Ee,results:Ne,emptyState:Be,row:De,rowTitle:Oe,rowProject:Ie,rowDate:Me,rowDuration:ke,rowStatus:Pe,rowMeta:Fe,resumeBtn:Ue,deleteBtn:Qe,pagination:Le,pageBtn:Ae,pageBtnActive:$e,pageEllipsis:He,detailOverlay:qe,detailCard:Ge,detailTabs:We,detailTabPanel:ze,detailHeader:Ke,detailTitle:Ve,detailMeta:Ze,detailCloseBtn:Je,detailBody:Xe,convoEntry:Ye,convoEntryHeader:et,copyBtn:tt,convoPrompt:st,convoResponse:at,convoTime:it,convoText:nt,activityEntry:rt,activityTime:ot,activityBadge:lt,activityBadgeTool:ct,activityBadgeEvent:dt,activityDetail:ut},se=50;function O(e){if(e<1e3)return"<1s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const a=Math.floor(t/60);return a<60?`${a}m ${t%60}s`:`${Math.floor(a/60)}h ${a%60}m`}function ht(e){return e?new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):"--"}function J(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}function pt(e){const t=new URLSearchParams;e.query&&t.set("query",e.query),e.project&&t.set("project",e.project),e.status==="archived"?t.set("archived","true"):e.status&&t.set("status",e.status),e.dateFrom&&t.set("dateFrom",String(new Date(e.dateFrom).getTime())),e.dateTo&&t.set("dateTo",String(new Date(e.dateTo+"T23:59:59").getTime()));const a={date:"started_at",duration:"last_activity_at",prompts:"started_at",tools:"started_at"};return t.set("sortBy",a[e.sortBy]||"started_at"),t.set("sortDir",e.sortDir),t.set("page",String(e.page)),t.set("pageSize",String(se)),t.toString()}function xt(){const e=ee(),[t,a]=v.useState({query:"",project:"",status:"",dateFrom:"",dateTo:"",sortBy:"date",sortDir:"desc",page:1}),[r,n]=v.useState(null),{data:h}=P({queryKey:["db-projects"],queryFn:async()=>{const l=await C("/api/db/projects");if(!l.ok)throw new Error("Failed to load projects");return l.json()},staleTime:6e4}),{data:o,isLoading:m}=P({queryKey:["db-sessions",t],queryFn:async()=>{const l=await C(`/api/db/sessions?${pt(t)}`);if(!l.ok)throw new Error("Failed to load sessions");return l.json()}}),{data:f}=P({queryKey:["db-session-detail",r],queryFn:async()=>{if(!r)return null;const l=await C(`/api/db/sessions/${encodeURIComponent(r)}`);if(!l.ok)throw new Error("Failed to load session detail");return l.json()},enabled:!!r}),d=v.useCallback((l,y)=>{a(j=>({...j,[l]:y,page:l==="page"?y:1}))},[]),u=v.useCallback(async(l,y)=>{l.stopPropagation(),window.confirm("Delete this session from history? This cannot be undone.")&&(await C(`/api/db/sessions/${encodeURIComponent(y)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["db-sessions"]}))},[e]),x=v.useCallback(async(l,y)=>{l.stopPropagation();try{const T=await(await C(`/api/sessions/${encodeURIComponent(y)}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}})).json();T.ok?M("Resuming Claude session in terminal","success"):M(T.error||"Resume failed","error")}catch(j){M(j.message,"error")}},[]),p=o?.sessions??[],c=o?.total??0,_=Math.ceil(c/se);return s.jsxs("div",{className:i.container,"data-testid":"history-view",children:[s.jsxs("div",{className:i.filters,children:[s.jsx(oe,{value:t.query,onChange:l=>d("query",l),placeholder:"Search prompts..."}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Project"}),s.jsx(k,{value:t.project,onChange:l=>d("project",l),options:[{value:"",label:"All"},...h?.map(l=>({value:l.project_path,label:l.project_name}))??[]]})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Status"}),s.jsx(k,{value:t.status,onChange:l=>d("status",l),options:[{value:"",label:"All"},{value:"idle",label:"Idle"},{value:"working",label:"Working"},{value:"waiting",label:"Waiting"},{value:"ended",label:"Ended"},{value:"archived",label:"Archived"}]})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"From"}),s.jsx("input",{type:"date",className:i.filterInput,value:t.dateFrom,onChange:l=>d("dateFrom",l.target.value)})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"To"}),s.jsx("input",{type:"date",className:i.filterInput,value:t.dateTo,onChange:l=>d("dateTo",l.target.value)})]}),s.jsxs("div",{className:i.filterGroup,children:[s.jsx("span",{className:i.filterLabel,children:"Sort"}),s.jsx(k,{value:t.sortBy,onChange:l=>d("sortBy",l),options:[{value:"date",label:"Date"},{value:"duration",label:"Activity"},{value:"prompts",label:"Prompts"},{value:"tools",label:"Tools"}]}),s.jsx("button",{className:i.sortToggle,onClick:()=>d("sortDir",t.sortDir==="desc"?"asc":"desc"),children:t.sortDir.toUpperCase()})]})]}),s.jsxs("div",{className:i.results,children:[m&&s.jsx("div",{className:i.emptyState,children:"Loading..."}),!m&&p.length===0&&s.jsx("div",{className:i.emptyState,children:"No sessions found"}),p.map(l=>s.jsx(ft,{session:l,onClick:()=>n(l.id),onResume:y=>x(y,l.id),onDelete:y=>u(y,l.id)},l.id))]}),_>1&&s.jsx(vt,{currentPage:t.page,totalPages:_,onPageChange:l=>d("page",l)}),r&&f&&s.jsx(yt,{detail:f,onClose:()=>n(null)})]})}function mt(){return s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("polyline",{points:"1 4 1 10 7 10"}),s.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})}function ft({session:e,onClick:t,onResume:a,onDelete:r}){const n=e.ended_at&&e.started_at?O(e.ended_at-e.started_at):e.started_at?O(Date.now()-e.started_at):"--";return s.jsxs("div",{className:i.row,onClick:t,children:[s.jsx("span",{className:i.rowTitle,children:e.title||e.project_name||e.id}),s.jsx("span",{className:i.rowProject,children:e.project_name}),s.jsx("span",{className:i.rowDate,children:ht(e.started_at)}),s.jsx("span",{className:i.rowDuration,children:n}),s.jsx("span",{className:i.rowStatus,"data-status":e.status,children:e.status.toUpperCase()}),s.jsxs("span",{className:i.rowMeta,children:[e.total_prompts," prompts"]}),s.jsxs("span",{className:i.rowMeta,children:[e.total_tool_calls," tools"]}),s.jsx("button",{className:i.resumeBtn,onClick:a,title:"Resume session","aria-label":"Resume session",children:s.jsx(mt,{})}),s.jsx("button",{className:i.deleteBtn,onClick:r,title:"Delete session","aria-label":"Delete session",children:"x"})]})}function vt({currentPage:e,totalPages:t,onPageChange:a}){const r=[];for(let o=1;o<=t;o++)(o===1||o===t||o>=e-2&&o<=e+2)&&r.push(o);const n=[];let h=0;for(const o of r)typeof o=="number"&&(h&&o-h>1&&n.push("ellipsis"),n.push(o),h=o);return s.jsxs("div",{className:i.pagination,children:[s.jsx("button",{className:i.pageBtn,disabled:e<=1,onClick:()=>a(e-1),children:"Prev"}),n.map((o,m)=>o==="ellipsis"?s.jsx("span",{className:i.pageEllipsis,children:"..."},`e-${m}`):s.jsx("button",{className:`${i.pageBtn} ${o===e?i.pageBtnActive:""}`,onClick:()=>a(o),children:o},o)),s.jsx("button",{className:i.pageBtn,disabled:e>=t,onClick:()=>a(e+1),children:"Next"})]})}function _t({text:e}){const[t,a]=v.useState(!1),r=n=>{n.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{a(!0),setTimeout(()=>a(!1),1500)})};return s.jsx("button",{className:i.copyBtn,onClick:r,"aria-label":"Copy to clipboard",title:"Copy to clipboard",children:t?"✓":"⎘"})}function yt({detail:e,onClose:t}){const[a,r]=v.useState("conversation"),{session:n,prompts:h,responses:o,tool_calls:m,events:f}=e,d=[...h.map(c=>({type:"prompt",timestamp:c.timestamp,text:c.text})),...o.map(c=>({type:"response",timestamp:c.timestamp,text:c.text_excerpt}))].sort((c,_)=>c.timestamp-_.timestamp),u=[...m.map(c=>({kind:"tool",label:c.tool_name,detail:c.tool_input_summary,timestamp:c.timestamp})),...f.map(c=>({kind:"event",label:c.event_type,detail:c.detail,timestamp:c.timestamp}))].sort((c,_)=>_.timestamp-c.timestamp),x=n.ended_at&&n.started_at?O(n.ended_at-n.started_at):n.started_at?O(Date.now()-n.started_at):"--",p=[{id:"conversation",label:`Conversation (${d.length})`,content:s.jsxs("div",{className:i.detailBody,children:[d.length===0&&s.jsx("div",{className:i.emptyState,children:"No conversation recorded"}),d.map((c,_)=>s.jsxs("div",{className:`${i.convoEntry} ${c.type==="prompt"?i.convoPrompt:i.convoResponse}`,children:[s.jsxs("div",{className:i.convoEntryHeader,children:[s.jsx("div",{className:i.convoTime,children:J(c.timestamp)}),s.jsx(_t,{text:c.text})]}),s.jsx("div",{className:i.convoText,children:c.text})]},_))]})},{id:"activity",label:`Activity (${u.length})`,content:s.jsxs("div",{className:i.detailBody,children:[u.length===0&&s.jsx("div",{className:i.emptyState,children:"No activity recorded"}),u.map((c,_)=>s.jsxs("div",{className:i.activityEntry,children:[s.jsx("span",{className:i.activityTime,children:J(c.timestamp)}),s.jsx("span",{className:`${i.activityBadge} ${c.kind==="tool"?i.activityBadgeTool:i.activityBadgeEvent}`,children:c.label}),s.jsx("span",{className:i.activityDetail,children:c.detail})]},_))]})}];return s.jsx("div",{className:i.detailOverlay,onClick:t,children:s.jsxs("div",{className:i.detailCard,onClick:c=>c.stopPropagation(),children:[s.jsxs("div",{className:i.detailHeader,children:[s.jsxs("div",{children:[s.jsx("h2",{className:i.detailTitle,children:n.project_name||n.id}),s.jsxs("div",{className:i.detailMeta,children:[s.jsxs("span",{children:["Status: ",n.status.toUpperCase()]}),s.jsxs("span",{children:["Model: ",n.model||"--"]}),s.jsxs("span",{children:["Duration: ",x]}),s.jsxs("span",{children:[n.total_prompts," prompts / ",n.total_tool_calls," tools"]})]})]}),s.jsx("button",{className:i.detailCloseBtn,onClick:t,"aria-label":"Close",children:"x"})]}),s.jsx(je,{tabs:p,activeTab:a,onTabChange:r,containerClassName:i.detailTabs,panelClassName:i.detailTabPanel})]})})}export{xt as default};
@@ -1 +1 @@
1
- import{z as o,k as s,A as e,P as r}from"./index-CCOZp8gY.js";function l(){const[t]=o(),a=t.get("path");if(!a)return s.jsx("div",{className:e.standalone,children:s.jsxs("div",{className:e.standaloneEmpty,children:["No project path specified. Use ",s.jsx("code",{children:"?path=/your/project"})," to open a project."]})});const n=a.split("/").filter(Boolean).pop()||a;return s.jsxs("div",{className:e.standalone,children:[s.jsxs("div",{className:e.standaloneHeader,children:[s.jsx("span",{className:e.standaloneTitle,children:n}),s.jsx("span",{className:e.standalonePath,children:a})]}),s.jsx("div",{className:e.standaloneContent,children:s.jsx(r,{projectPath:a})})]})}export{l as default};
1
+ import{z as o,k as s,A as e,P as r}from"./index-DI0_qhqI.js";function l(){const[t]=o(),a=t.get("path");if(!a)return s.jsx("div",{className:e.standalone,children:s.jsxs("div",{className:e.standaloneEmpty,children:["No project path specified. Use ",s.jsx("code",{children:"?path=/your/project"})," to open a project."]})});const n=a.split("/").filter(Boolean).pop()||a;return s.jsxs("div",{className:e.standalone,children:[s.jsxs("div",{className:e.standaloneHeader,children:[s.jsx("span",{className:e.standaloneTitle,children:n}),s.jsx("span",{className:e.standalonePath,children:a})]}),s.jsx("div",{className:e.standaloneContent,children:s.jsx(r,{projectPath:a})})]})}export{l as default};
@@ -1 +1 @@
1
- import{v as x,w as $,h as d,m as S,k as e,x as a,q as D}from"./index-CCOZp8gY.js";const B="_controls_uyjqd_6",E="_title_uyjqd_11",M="_stats_uyjqd_13",T="_statsSep_uyjqd_17",H="_content_uyjqd_19",P="_viewGroup_uyjqd_21",z="_groupHeader_uyjqd_22",G="_sessionName_uyjqd_23",R="_label_uyjqd_24",U="_sid_uyjqd_25",K="_itemCount_uyjqd_26",L="_table_uyjqd_28",O="_pos_uyjqd_34",Q="_text_uyjqd_36",V="_date_uyjqd_37",W="_deleteBtn_uyjqd_38",t={controls:B,title:E,stats:M,statsSep:T,content:H,viewGroup:P,groupHeader:z,sessionName:G,label:R,sid:U,itemCount:K,table:L,pos:O,text:Q,date:V,deleteBtn:W};let F=Date.now();function Y(){return F++}function J(o){return new Date(o).toLocaleTimeString("en-US",{hour12:!1})}function Z(){const o=x(s=>s.queues),y=x(s=>s.add),w=x(s=>s.remove),b=x(s=>s.moveToSession),h=$(s=>s.sessions),[l,k]=d.useState(""),[m,g]=d.useState(""),[i,f]=d.useState(null),p=Array.from(new Set([...o.keys(),...h.keys()])).filter(s=>{const n=o.get(s);return n&&n.length>0}),q=Array.from(o.values()).reduce((s,n)=>s+n.length,0),N=d.useCallback(()=>{const s=m.trim();if(!s||!l)return;const n=o.get(l)??[],c={id:Y(),sessionId:l,text:s,position:n.length,createdAt:Date.now()};y(l,c),g(""),S("Prompt added to queue","info",2e3)},[m,l,o,y]),A=d.useCallback(s=>{i&&(b([i.itemId],i.fromSessionId,s),f(null),S("Prompt moved","info",2e3))},[i,b]),j=Array.from(h.entries()),C=d.useMemo(()=>[{value:"",label:"Select session..."},...j.map(([s,n])=>({value:s,label:`${n.projectName||s.slice(0,8)}${n.title?` — ${n.title}`:""}`}))],[j]);return e.jsxs("div",{"data-testid":"queue-view",style:{height:"100%",overflow:"auto"},children:[e.jsx("div",{className:t.controls,children:e.jsx("h2",{className:t.title,children:"PROMPT QUEUE"})}),e.jsxs("div",{className:t.stats,children:[e.jsxs("span",{children:[q," queued prompt",q!==1?"s":""]}),e.jsx("span",{className:t.statsSep,children:"|"}),e.jsxs("span",{children:[p.length," session",p.length!==1?"s":""]})]}),e.jsx("div",{style:{padding:"0 24px 16px"},children:e.jsxs("div",{className:a.queueCompose,children:[e.jsx(D,{value:l,onChange:k,options:C,placeholder:"Select session...",style:{minWidth:"180px",fontSize:"11px"}}),e.jsx("textarea",{className:a.queueTextarea,placeholder:"Add a prompt to the queue...",rows:2,value:m,onChange:s=>g(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),N())}}),e.jsx("button",{className:`${a.toolbarBtn} ${a.queueAddBtn}`,onClick:N,disabled:!m.trim()||!l,children:"ADD"})]})}),e.jsx("div",{className:t.content,children:p.length===0?e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:"var(--text-dim)",fontSize:"13px"},children:"No prompts in queue. Add prompts from session detail panels or above."}):p.map(s=>{const n=o.get(s)??[],c=h.get(s);return e.jsxs("div",{className:t.viewGroup,children:[e.jsxs("div",{className:t.groupHeader,children:[e.jsx("span",{className:t.sessionName,children:c?.projectName||"Unknown"}),c?.label&&e.jsx("span",{className:t.label,children:c.label}),e.jsx("span",{className:t.sid,children:s.slice(0,8)}),e.jsxs("span",{className:t.itemCount,children:[n.length," item",n.length!==1?"s":""]})]}),e.jsxs("table",{className:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:t.pos,children:"#"}),e.jsx("th",{children:"Prompt"}),e.jsx("th",{children:"Added"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:n.map((r,I)=>e.jsxs("tr",{children:[e.jsx("td",{className:t.pos,children:I+1}),e.jsx("td",{className:t.text,children:r.text}),e.jsx("td",{className:t.date,children:J(r.createdAt)}),e.jsxs("td",{children:[e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[e.jsx("button",{className:`${a.queueActionBtn} ${a.queueMove}`,onClick:()=>f(i?.itemId===r.id?null:{itemId:r.id,fromSessionId:s}),children:"MOVE"}),e.jsx("button",{className:`${a.queueActionBtn} ${a.queueDelete} ${t.deleteBtn}`,onClick:()=>w(s,r.id),children:"DEL"})]}),i?.itemId===r.id&&e.jsx("div",{style:{position:"absolute",zIndex:10,background:"var(--surface-card, #12122a)",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))",borderRadius:"4px",padding:"4px",maxHeight:"160px",overflowY:"auto",minWidth:"180px"},children:j.filter(([u])=>u!==s).map(([u,_])=>e.jsxs("button",{onClick:()=>A(u),style:{display:"block",width:"100%",padding:"4px 8px",background:"transparent",border:"none",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:"10px",textAlign:"left",cursor:"pointer",borderRadius:"3px"},onMouseEnter:v=>{v.target.style.background="rgba(0,229,255,0.1)"},onMouseLeave:v=>{v.target.style.background="transparent"},children:[_.projectName||u.slice(0,8),_.title?` — ${_.title}`:""]},u))})]})]},r.id))})]})]},s)})})]})}export{Z as default};
1
+ import{v as x,w as $,h as d,m as S,k as e,x as a,q as D}from"./index-DI0_qhqI.js";const B="_controls_uyjqd_6",E="_title_uyjqd_11",M="_stats_uyjqd_13",T="_statsSep_uyjqd_17",H="_content_uyjqd_19",P="_viewGroup_uyjqd_21",z="_groupHeader_uyjqd_22",G="_sessionName_uyjqd_23",R="_label_uyjqd_24",U="_sid_uyjqd_25",K="_itemCount_uyjqd_26",L="_table_uyjqd_28",O="_pos_uyjqd_34",Q="_text_uyjqd_36",V="_date_uyjqd_37",W="_deleteBtn_uyjqd_38",t={controls:B,title:E,stats:M,statsSep:T,content:H,viewGroup:P,groupHeader:z,sessionName:G,label:R,sid:U,itemCount:K,table:L,pos:O,text:Q,date:V,deleteBtn:W};let F=Date.now();function Y(){return F++}function J(o){return new Date(o).toLocaleTimeString("en-US",{hour12:!1})}function Z(){const o=x(s=>s.queues),y=x(s=>s.add),w=x(s=>s.remove),b=x(s=>s.moveToSession),h=$(s=>s.sessions),[l,k]=d.useState(""),[m,g]=d.useState(""),[i,f]=d.useState(null),p=Array.from(new Set([...o.keys(),...h.keys()])).filter(s=>{const n=o.get(s);return n&&n.length>0}),q=Array.from(o.values()).reduce((s,n)=>s+n.length,0),N=d.useCallback(()=>{const s=m.trim();if(!s||!l)return;const n=o.get(l)??[],c={id:Y(),sessionId:l,text:s,position:n.length,createdAt:Date.now()};y(l,c),g(""),S("Prompt added to queue","info",2e3)},[m,l,o,y]),A=d.useCallback(s=>{i&&(b([i.itemId],i.fromSessionId,s),f(null),S("Prompt moved","info",2e3))},[i,b]),j=Array.from(h.entries()),C=d.useMemo(()=>[{value:"",label:"Select session..."},...j.map(([s,n])=>({value:s,label:`${n.projectName||s.slice(0,8)}${n.title?` — ${n.title}`:""}`}))],[j]);return e.jsxs("div",{"data-testid":"queue-view",style:{height:"100%",overflow:"auto"},children:[e.jsx("div",{className:t.controls,children:e.jsx("h2",{className:t.title,children:"PROMPT QUEUE"})}),e.jsxs("div",{className:t.stats,children:[e.jsxs("span",{children:[q," queued prompt",q!==1?"s":""]}),e.jsx("span",{className:t.statsSep,children:"|"}),e.jsxs("span",{children:[p.length," session",p.length!==1?"s":""]})]}),e.jsx("div",{style:{padding:"0 24px 16px"},children:e.jsxs("div",{className:a.queueCompose,children:[e.jsx(D,{value:l,onChange:k,options:C,placeholder:"Select session...",style:{minWidth:"180px",fontSize:"11px"}}),e.jsx("textarea",{className:a.queueTextarea,placeholder:"Add a prompt to the queue...",rows:2,value:m,onChange:s=>g(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),N())}}),e.jsx("button",{className:`${a.toolbarBtn} ${a.queueAddBtn}`,onClick:N,disabled:!m.trim()||!l,children:"ADD"})]})}),e.jsx("div",{className:t.content,children:p.length===0?e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:"var(--text-dim)",fontSize:"13px"},children:"No prompts in queue. Add prompts from session detail panels or above."}):p.map(s=>{const n=o.get(s)??[],c=h.get(s);return e.jsxs("div",{className:t.viewGroup,children:[e.jsxs("div",{className:t.groupHeader,children:[e.jsx("span",{className:t.sessionName,children:c?.projectName||"Unknown"}),c?.label&&e.jsx("span",{className:t.label,children:c.label}),e.jsx("span",{className:t.sid,children:s.slice(0,8)}),e.jsxs("span",{className:t.itemCount,children:[n.length," item",n.length!==1?"s":""]})]}),e.jsxs("table",{className:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:t.pos,children:"#"}),e.jsx("th",{children:"Prompt"}),e.jsx("th",{children:"Added"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:n.map((r,I)=>e.jsxs("tr",{children:[e.jsx("td",{className:t.pos,children:I+1}),e.jsx("td",{className:t.text,children:r.text}),e.jsx("td",{className:t.date,children:J(r.createdAt)}),e.jsxs("td",{children:[e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[e.jsx("button",{className:`${a.queueActionBtn} ${a.queueMove}`,onClick:()=>f(i?.itemId===r.id?null:{itemId:r.id,fromSessionId:s}),children:"MOVE"}),e.jsx("button",{className:`${a.queueActionBtn} ${a.queueDelete} ${t.deleteBtn}`,onClick:()=>w(s,r.id),children:"DEL"})]}),i?.itemId===r.id&&e.jsx("div",{style:{position:"absolute",zIndex:10,background:"var(--surface-card, #12122a)",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))",borderRadius:"4px",padding:"4px",maxHeight:"160px",overflowY:"auto",minWidth:"180px"},children:j.filter(([u])=>u!==s).map(([u,_])=>e.jsxs("button",{onClick:()=>A(u),style:{display:"block",width:"100%",padding:"4px 8px",background:"transparent",border:"none",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:"10px",textAlign:"left",cursor:"pointer",borderRadius:"3px"},onMouseEnter:v=>{v.target.style.background="rgba(0,229,255,0.1)"},onMouseLeave:v=>{v.target.style.background="transparent"},children:[_.projectName||u.slice(0,8),_.title?` — ${_.title}`:""]},u))})]})]},r.id))})]})]},s)})})]})}export{Z as default};