ccdeck 3.36.1 → 3.36.3
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/web/assets/{BrowserWatchModal-BstUWM6G.js → BrowserWatchModal-BJKk2x-P.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-CruUCLJM.js → UsageHistoryModal-ClT1-0hN.js} +1 -1
- package/dist/web/assets/{index-D09Vu58F.js → index-Dj4JHRcG.js} +3 -3
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/release-notes.json +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as c,k as _,l as V,m as Y,n as z,s as X,u as Z,g as ee}from"./index-D09Vu58F.js";function se({snap:s}){return e.jsxs("section",{className:"bw-feed",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",e.jsxs("span",{className:"bw-feed-count",children:[s.log.length," ",s.log.length===1?"event":"events"]})]}),e.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),e.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:s.log.length===0?e.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):s.log.map(t=>e.jsxs("div",{className:`bw-log-line ${t.level}${t.parts?"":" sys"}`,children:[e.jsx("span",{className:"bw-log-time",children:new Date(t.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),t.parts?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bw-log-browser",children:t.parts.browser}),e.jsx("span",{className:"bw-log-profile",title:t.parts.profile,children:t.parts.profile}),e.jsxs("span",{className:"bw-log-value",children:[t.parts.value,t.parts.flagged>0&&e.jsxs("span",{className:"bw-log-flag",children:[" · ",t.parts.flagged," flagged"]})]})]}):e.jsx("span",{className:"bw-log-sys",children:t.text})]},`${t.atMs}-${t.level}-${t.text}`))})]})}const E=s=>`${s.host}-${s.startMs}`;function te(s){const t=l=>new Date(l).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return s.count===1||s.endMs-s.startMs<6e4?t(s.startMs):`${t(s.startMs)} → ${t(s.endMs)}`}function ne(s){return new Date(s).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function U(s){const t=Math.round((s.endMs-s.startMs)/6e4);return t<1?"":`${t} min`}function ae({snap:s,dismiss:t,refreshRef:l}){const[r,h]=c.useState(null),o=c.useRef(new Map),a=c.useRef(null);c.useEffect(()=>{var i,w;const d=a.current;!d||s.episodes.some(m=>E(m)===d.id)||(a.current=null,_(((i=document.activeElement)==null?void 0:i.tagName)??null)&&((w=(d.next?o.current.get(d.next):void 0)??l.current)==null||w.focus()))},[s]);const n=d=>{a.current={id:E(d),next:V(s.episodes.map(E),E(d))},t(d)},u=c.useMemo(()=>{const d=[];for(const i of s.episodes){const w=ne(i.startMs),m=d[d.length-1];m&&m.label===w?m.episodes.push(i):d.push({label:w,episodes:[i]})}return d},[s]);return e.jsxs("section",{className:"bw-findings",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",s.episodes.length>0&&e.jsxs("span",{className:"bw-feed-count",children:[s.episodes.length," ",s.episodes.length===1?"episode":"episodes"]})]}),e.jsx("div",{className:"bw-eps",children:u.length===0?e.jsxs("div",{className:"bw-empty",children:[e.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),e.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",s.settings.quietMinutes," ",s.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!s.settings.enabled&&e.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):u.map(d=>e.jsxs("div",{className:"bw-day",children:[e.jsx("h4",{className:"bw-sec-head",children:d.label}),d.episodes.map(i=>{const w=E(i),m=r===w;return e.jsxs("div",{className:`bw-ep${m?" open":""}`,children:[e.jsxs("div",{className:"bw-ep-row",children:[e.jsxs("button",{className:"bw-ep-head",ref:b=>{b?o.current.set(w,b):o.current.delete(w)},onClick:()=>h(m?null:w),"aria-expanded":m,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:m?"▾":"▸"}),e.jsx("span",{className:"bw-ep-host",children:i.host}),e.jsxs("span",{className:"bw-ep-meta",children:[te(i),U(i)&&e.jsxs(e.Fragment,{children:[" · ",U(i)]}),i.provisional&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{title:"Its quiet window has not closed yet. If somebody used the browser in the minutes after it, it is withdrawn; until then it is not written down and no reaction runs.",children:"provisional"})]})]}),e.jsxs("span",{className:"bw-ep-count",children:[i.count," ",i.count===1?"page":"pages"]})]}),e.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>n(i),"aria-label":`Dismiss ${i.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),m&&e.jsx("ul",{className:"bw-urls",children:i.urls.map((b,y)=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-url-time",children:new Date(b.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),e.jsx("span",{className:"bw-url",children:b.url})]},`${b.url}-${b.timeMs}-${y}`))})]},w)})]},d.label))})]})}function re(s){const t=/^#?([0-9a-f]{6})$/i.exec((s??"").trim());if(!t)return!1;const l=parseInt(t[1],16),r=[l>>16&255,l>>8&255,l&255].map(h=>{const o=h/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]>.5}const G=1e4,ie=12e3;function oe({browsers:s,findings:t,watching:l,palette:r}){const h=c.useRef(null),o=c.useRef(null);return o.current={browsers:s,findings:t,watching:l},c.useEffect(()=>{var m;const a=h.current;if(!a)return;const n=a.getContext("2d");if(!n)return;const u=((m=window.matchMedia)==null?void 0:m.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let d=0,i=!1;const w=()=>{var q;if(i)return;const b=o.current;if(!b)return;const{browsers:y,findings:p,watching:P}=b,R=r["--accent"]||"#7dd3fc",f=r["--line"]||"#1f2229",j=r["--text-dim"]||"#6e727c",C=re(r["--bg"]),N=C?42:26,v=C?.85:.65,I=Date.now(),$=Math.min(window.devicePixelRatio||1,2),W=a.clientWidth,k=a.clientHeight;(a.width!==W*$||a.height!==k*$)&&(a.width=W*$,a.height=k*$),n.setTransform($,0,0,$,0,0),n.clearRect(0,0,W,k);const x=W/2,M=k/2,S=Math.min(W,k)/2-6;n.strokeStyle=f,n.lineWidth=1,n.globalAlpha=C?1:.9;for(const g of[.4,.7,1])n.beginPath(),n.arc(x,M,S*g,0,Math.PI*2),n.stroke();n.beginPath(),n.moveTo(x-S,M),n.lineTo(x+S,M),n.moveTo(x,M-S),n.lineTo(x,M+S),n.stroke(),n.globalAlpha=1;const A=(P&&!u?I%G/G:0)*Math.PI*2-Math.PI/2;if(P){const g=(q=n.createConicGradient)==null?void 0:q.call(n,A-.85,x,M);g&&(g.addColorStop(0,"transparent"),g.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${R} ${N}%, transparent)`),g.addColorStop(1,"transparent"),n.fillStyle=g,n.beginPath(),n.moveTo(x,M),n.arc(x,M,S,A-.85,A),n.closePath(),n.fill()),n.strokeStyle=R,n.globalAlpha=v,n.beginPath(),n.moveTo(x,M),n.lineTo(x+Math.cos(A)*S,M+Math.sin(A)*S),n.stroke(),n.globalAlpha=1}y.forEach((g,T)=>{const B=T/Math.max(y.length,1)*Math.PI*2-Math.PI/2,D=g.lastReadMs===null?1:Math.min(1,(I-g.lastReadMs)/12e4),O=S*(.42+D*.5),F=x+Math.cos(B)*O,L=M+Math.sin(B)*O,Q=Math.abs((A-B+Math.PI*3)%(Math.PI*2)-Math.PI),K=P?Math.max(0,1-Q/.55):0;n.beginPath(),n.arc(F,L,3+K*1.6,0,Math.PI*2),n.fillStyle=g.running?R:j,n.globalAlpha=g.running?.55+K*.45:.35,n.fill(),n.globalAlpha=1});for(const g of p){const T=(I-g.atMs)/ie;if(T<0||T>1)continue;const D=Math.max(0,y.findIndex(L=>L.key===g.browser))/Math.max(y.length,1)*Math.PI*2-Math.PI/2,O=x+Math.cos(D)*S*.6,F=M+Math.sin(D)*S*.6;n.beginPath(),n.arc(O,F,4+T*22,0,Math.PI*2),n.strokeStyle=R,n.globalAlpha=(1-T)*.8,n.lineWidth=1.5,n.stroke(),n.globalAlpha=1}d=requestAnimationFrame(w)};return w(),()=>{i=!0,cancelAnimationFrame(d)}},[r]),e.jsx("canvas",{ref:h,className:"bw-radar",role:"img","aria-label":l?`Watching ${s.length} browser${s.length===1?"":"s"}`:"Not watching"})}function le(s,t,l){if(s===null)return null;const r=s+t-l;return r>0?r:null}function ce(s){const t=Math.ceil(s/1e3),l=Math.floor(t/60),r=t%60;return l>0?`${l}m ${r}s`:`${r}s`}function J(s){return(s??[]).filter(t=>t.installed&&t.profiles>0)}function de(s){return!Number.isFinite(s)||s<=0?"empty":Y(s)}function he(s,t){return s.map(l=>({key:l.key,name:l.name,running:l.running,visits:t.filter(r=>r.browser===l.key).reduce((r,h)=>r+h.programVisits,0)}))}function ue(s,t){if(s===null)return null;const l=Math.max(0,Math.round((t-s)/1e3));if(l<5)return"just now";if(l<60)return`${l} sec ago`;const r=Math.round(l/60);return r<60?`${r} min ago`:`${Math.round(r/60)} hr ago`}function we(s){const t=s.profiles.filter(r=>r.degraded);if(t.length>0){const r=t[0],h=t.length-1;return{kind:"unreadable",text:`${r.name}/${r.profile} could not be read — ${r.reason??"no reason given"}`+(h>0?`, and ${h} more`:"")+". The watch continues on the profiles it can read."}}const l=J(s.browsers);return l.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:l.some(r=>r.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function me({snap:s,watching:t,palette:l}){const[r,h]=c.useState(!1),[o,a]=c.useState(()=>Date.now());c.useEffect(()=>{const u=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(u)},[]);const n=le(s.coverage.lastHumanMs,s.coverage.quietMs,o);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",e.jsx("button",{className:"bw-help",onClick:()=>h(u=>!u),"aria-expanded":r,"aria-label":"What the sweep and the dots mean",children:"?"})]}),e.jsxs("div",{className:"bw-glance",children:[e.jsx(oe,{browsers:t.map(u=>{var d;return{key:u.key,name:u.name,running:u.running,lastReadMs:((d=s.profiles.find(i=>i.browser===u.key))==null?void 0:d.lastWrittenMs)??null}}),findings:s.episodes.slice(0,6).map(u=>({browser:u.browser??null,atMs:u.endMs})),watching:s.settings.enabled,palette:l}),e.jsx("ul",{className:"bw-counts",children:he(t,s.profiles).map(u=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-count-n",children:u.visits.toLocaleString("en-US")}),e.jsx("span",{className:"bw-count-of",children:u.name})]},u.key))})]}),e.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),s.coverage.checkedMs>0&&e.jsxs("p",{className:"bw-since",children:["Last checked ",ue(s.coverage.checkedMs,o),s.coverage.checks>0&&e.jsxs(e.Fragment,{children:[" · ",s.coverage.checks.toLocaleString("en-US")," ",s.coverage.checks===1?"check":"checks"]})]}),n!==null&&e.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",ce(n)]}),r&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:"Sweep"}),e.jsx("dd",{children:"one poll of every watched profile"}),e.jsx("dt",{children:"Dot"}),e.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),e.jsx("dt",{children:"Ring"}),e.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]})}function be({watching:s,rest:t}){const[l,r]=c.useState(!1),[h,o]=c.useState(!1);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",e.jsx("button",{className:"bw-help",onClick:()=>r(a=>!a),"aria-expanded":l,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),l&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:"Running"}),e.jsx("dd",{children:"the browser has a process on this machine right now"}),e.jsx("dt",{children:"Connected"}),e.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),e.jsx("ul",{className:"bw-profiles",children:s.map(a=>e.jsxs("li",{children:[e.jsx("span",{className:`bw-prof-dot${a.running?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-prof-name",children:a.name}),e.jsx("span",{className:"bw-prof-state",children:a.running?"running":"idle"}),a.running&&a.relay.state==="live"&&e.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},a.key))}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>o(a=>!a),"aria-expanded":h,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:h?"▾":"▸"})," ",t.length," not watched"]}),h&&e.jsxs("p",{className:"bw-rest",children:[t.map(a=>a.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]})}function fe({snap:s,quiet:t,setQuiet:l,save:r,access:h,setAccess:o}){return e.jsxs("div",{className:"bw-settings",children:[e.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[e.jsx("span",{children:"Nobody browsing for"}),e.jsxs("select",{value:t??s.settings.quietMinutes,onChange:a=>{l(Number(a.target.value)),r({quietMinutes:Number(a.target.value)})},children:[e.jsx("option",{value:1,children:"1 min"}),e.jsx("option",{value:5,children:"5 min"}),e.jsx("option",{value:15,children:"15 min"}),e.jsx("option",{value:30,children:"30 min"}),e.jsx("option",{value:60,children:"60 min"})]})]}),e.jsxs("label",{children:[e.jsx("span",{children:"When it finds one"}),e.jsx("select",{value:s.settings.reaction,onChange:a=>void r({reaction:a.target.value}),disabled:!s.settings.enabled,title:s.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(s.reactions??["notify"]).map(a=>e.jsx("option",{value:a,children:a==="notify"?"notify me":a==="close-tab"?"close the tab":"quit the browser"},a))})]}),e.jsxs("div",{className:"bw-settings-note",children:[e.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",e.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),e.jsxs("button",{className:"bw-why",onClick:()=>o(a=>!a),"aria-expanded":h,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:h?"▾":"▸"})," What Browser Watch can access"]}),h&&e.jsxs("dl",{className:"bw-access",children:[e.jsx("dt",{children:"Reads"}),e.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(s.coverage.startedMs).toLocaleString(),"."]}),e.jsx("dt",{children:"Keeps"}),e.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",e.jsx("code",{className:"bw-path",children:s.coverage.logPath}),typeof s.coverage.logBytes=="number"?` (${de(s.coverage.logBytes)})`:"",", with every address written in full so you can check it yourself."]}),e.jsx("dt",{children:"Sends"}),e.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),e.jsx("dt",{children:"Never reads"}),e.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]})}function H(s,t){return t?{kind:"saving",word:"Saving"}:s.settings.enabled?{kind:"on",word:"Watching"}:{kind:"off",word:"Paused"}}function ge({snap:s,saving:t,save:l,why:r,setWhy:h}){return e.jsxs("footer",{className:"bw-status",children:[e.jsx("span",{className:`bw-mode-dot${s.settings.enabled?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-mode-word",children:H(s,t).word},H(s,t).kind),e.jsx("span",{className:"bw-status-text",children:s.coverage.archived===0?s.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${s.coverage.archived} ${s.coverage.archived===1?"episode":"episodes"} on disk`}),e.jsx("button",{className:`glyph-btn bw-gear${r?" on":""}`,onClick:()=>h(o=>!o),"aria-expanded":r,"aria-label":"Settings",title:"Settings",children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[e.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),e.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),e.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[e.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),e.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":s.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"switch",onClick:()=>void l({enabled:!s.settings.enabled}),title:s.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:e.jsx("span",{className:"switch-knob"})})]})]})}function pe({relay:s}){const[t,l]=c.useState(!1),[r,h]=c.useState(!1),o=s.killswitch.blocked?"unblock":"block",a=s.command[o],n=c.useCallback(async()=>{await z(a.command)&&(h(!0),window.setTimeout(()=>h(!1),1600))},[a.command]),u=s.profiles.filter(i=>{var w;return(w=i.report)==null?void 0:w.present}),d=s.profiles.filter(i=>i.report===null);return e.jsxs("section",{className:"bw-sec",children:[e.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),e.jsx("p",{className:`bw-rc-verdict ${s.verdict}`,role:"status",children:s.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":s.verdict==="protected"?`The relay is black-holed in ${s.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),s.killswitch.foreign.length>0&&e.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",s.hostsPath,", and ccdeck will not touch it:",s.killswitch.foreign.map(i=>e.jsx("code",{className:"bw-path",children:i},i))]}),e.jsxs("button",{className:"bw-why",onClick:()=>l(i=>!i),"aria-expanded":t,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",s.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&e.jsxs("div",{className:"bw-rc-body",children:[u.length>0&&e.jsx("dl",{className:"bw-key",children:u.map(i=>e.jsxs(c.Fragment,{children:[e.jsxs("dt",{children:[i.name,i.profile==="Default"?"":` · ${i.profile}`]}),e.jsxs("dd",{children:[i.report.enabled?"enabled":"installed but switched off",i.report.allUrls?", can act on every site":", limited to the sites it was granted",i.report.sensitiveApis.length>0&&e.jsxs(e.Fragment,{children:[" — ",i.report.sensitiveApis.join(", ")]})]})]},`${i.browser}/${i.profile}`))}),d.length>0&&e.jsxs("p",{className:"bw-rc-note",children:[d.map(i=>i.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!s.hostsRead&&e.jsxs("p",{className:"bw-rc-note",children:[s.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),u.some(i=>i.report.allUrls)&&e.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",e.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),e.jsxs("div",{className:"bw-rc-cmd",children:[e.jsx("code",{children:a.command}),e.jsx("button",{className:"btn bw-rc-copy",onClick:n,children:r?"Copied":"Copy"})]}),e.jsx("p",{className:"bw-rc-note",children:a.note})]})]})}function xe(s){const[t,l]=c.useState(null),[r,h]=c.useState(null),[o,a]=c.useState(null),[n,u]=c.useState(!1),d=c.useRef(!1),[i,w]=c.useState(null),[m,b]=c.useState(!1),y=c.useRef(!1),p=c.useCallback(async f=>{var j,C;if(!(f&&!X(d.current))){f&&(d.current=!0,u(!0));try{const N=await fetch(`/api/browser-watch${f?"?refresh=1":""}`);if(!N.ok)throw new Error(`the deck answered ${N.status}`);const v=await N.json();l(v),y.current||w(((j=v==null?void 0:v.settings)==null?void 0:j.quietMinutes)??15),s(((C=v==null?void 0:v.settings)==null?void 0:C.enabled)===!0),h(null)}catch(N){h(N instanceof Error?N.message:String(N))}finally{f&&(d.current=!1,u(!1))}}},[s]);c.useEffect(()=>{p(!1)},[p]),c.useEffect(()=>{const f=setInterval(()=>{p(!1)},1e4);return()=>clearInterval(f)},[p]);const P=c.useCallback(async f=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:f.host,startMs:f.startMs})})}finally{await p(!1)}},[p]),R=c.useCallback(async f=>{y.current=!0,b(!0);try{const j=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(f)});if(!j.ok)throw new Error(`the deck answered ${j.status}`);await p(!1),a(null)}catch(j){a(j instanceof Error?j.message:String(j))}finally{y.current=!1,b(!1)}},[p]);return{snap:t,error:r,writeError:o,setWriteError:a,busy:n,quiet:i,setQuiet:w,saving:m,load:p,dismiss:P,save:R}}function ye({onClose:s,onSeen:t,onWatching:l,palette:r}){const h=Z(s),{snap:o,error:a,writeError:n,setWriteError:u,busy:d,quiet:i,setQuiet:w,saving:m,load:b,dismiss:y,save:p}=xe(l),[P,R]=c.useState(!1),[f,j]=c.useState(!1),C=c.useRef(null),N=c.useRef(t);N.current=t,c.useEffect(()=>()=>N.current(Date.now()),[]);const v=J(o==null?void 0:o.browsers),I=((o==null?void 0:o.browsers)??[]).filter(k=>!(k.installed&&k.profiles>0)),$=o?we(o):null,W=v.reduce((k,x)=>k+x.profiles,0);return e.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:e.jsxs("div",{ref:h,className:"modal bw-modal",onClick:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[e.jsxs("header",{className:"modal-head",children:[e.jsxs("div",{className:"modal-title",children:[e.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),e.jsx("span",{className:"modal-tool-id",children:o?`${W} ${W===1?"profile":"profiles"} · local only`:"local only"})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{ref:C,className:"glyph-btn",onClick:()=>void b(!0),...ee(d),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:d?"…":"↻"}),e.jsx("button",{className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),e.jsxs("div",{className:"modal-body bw-body",children:[!o&&!a&&e.jsxs("div",{className:"bw-loading",children:[e.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),e.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),a&&e.jsx("div",{className:"bw-state",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:"Could not read"}),e.jsx("span",{className:"bw-row-detail",children:a})]})}),o&&$&&e.jsx("p",{className:`bw-trouble ${$.kind}`,role:"status",children:$.text}),o&&e.jsxs("div",{className:"bw-work",children:[e.jsxs("aside",{className:"bw-side",children:[e.jsx(me,{snap:o,watching:v,palette:r}),e.jsx(be,{watching:v,rest:I}),o.relay&&e.jsx(pe,{relay:o.relay})]}),e.jsxs("div",{className:"bw-main",children:[e.jsx(ae,{snap:o,dismiss:y,refreshRef:C}),e.jsx(se,{snap:o})]})]}),o&&P&&e.jsx(fe,{snap:o,quiet:i,setQuiet:w,save:p,access:f,setAccess:j}),n&&e.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),e.jsxs("span",{className:"bw-row-detail",children:[n," — the switches below show what is stored, not what you pressed."]}),e.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>u(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),o&&e.jsx(ge,{snap:o,saving:m,save:p,why:P,setWhy:R})]})]})})}export{ye as default};
|
|
1
|
+
import{j as e,r as c,k as _,l as V,m as Y,n as z,s as X,u as Z,g as ee}from"./index-Dj4JHRcG.js";function se({snap:s}){return e.jsxs("section",{className:"bw-feed",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Live activity",e.jsxs("span",{className:"bw-feed-count",children:[s.log.length," ",s.log.length===1?"event":"events"]})]}),e.jsx("p",{className:"bw-since bw-feed-note",children:"Pages you opened yourself — counted to run the rule, never written down. Addresses appear under Findings, and only for pages a program opened."}),e.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:s.log.length===0?e.jsx("p",{className:"bw-note",children:"The deck writes a line here each time it looks at a profile."}):s.log.map(t=>e.jsxs("div",{className:`bw-log-line ${t.level}${t.parts?"":" sys"}`,children:[e.jsx("span",{className:"bw-log-time",children:new Date(t.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),t.parts?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bw-log-browser",children:t.parts.browser}),e.jsx("span",{className:"bw-log-profile",title:t.parts.profile,children:t.parts.profile}),e.jsxs("span",{className:"bw-log-value",children:[t.parts.value,t.parts.flagged>0&&e.jsxs("span",{className:"bw-log-flag",children:[" · ",t.parts.flagged," flagged"]})]})]}):e.jsx("span",{className:"bw-log-sys",children:t.text})]},`${t.atMs}-${t.level}-${t.text}`))})]})}const E=s=>`${s.host}-${s.startMs}`;function te(s){const t=l=>new Date(l).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return s.count===1||s.endMs-s.startMs<6e4?t(s.startMs):`${t(s.startMs)} → ${t(s.endMs)}`}function ne(s){return new Date(s).toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short"})}function U(s){const t=Math.round((s.endMs-s.startMs)/6e4);return t<1?"":`${t} min`}function ae({snap:s,dismiss:t,refreshRef:l}){const[r,h]=c.useState(null),o=c.useRef(new Map),a=c.useRef(null);c.useEffect(()=>{var i,w;const d=a.current;!d||s.episodes.some(m=>E(m)===d.id)||(a.current=null,_(((i=document.activeElement)==null?void 0:i.tagName)??null)&&((w=(d.next?o.current.get(d.next):void 0)??l.current)==null||w.focus()))},[s]);const n=d=>{a.current={id:E(d),next:V(s.episodes.map(E),E(d))},t(d)},u=c.useMemo(()=>{const d=[];for(const i of s.episodes){const w=ne(i.startMs),m=d[d.length-1];m&&m.label===w?m.episodes.push(i):d.push({label:w,episodes:[i]})}return d},[s]);return e.jsxs("section",{className:"bw-findings",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:["Findings",s.episodes.length>0&&e.jsxs("span",{className:"bw-feed-count",children:[s.episodes.length," ",s.episodes.length===1?"episode":"episodes"]})]}),e.jsx("div",{className:"bw-eps",children:u.length===0?e.jsxs("div",{className:"bw-empty",children:[e.jsx("p",{className:"bw-empty-head",children:"Nothing found yet"}),e.jsxs("p",{className:"bw-empty-note",children:["An episode lands here when a program opens pages in a browser nobody has touched for"," ",s.settings.quietMinutes," ",s.settings.quietMinutes===1?"minute":"minutes",". On most machines that is rare, so an empty list is the ordinary result rather than a sign something is wrong."]}),!s.settings.enabled&&e.jsx("p",{className:"bw-empty-note",children:"Watching is off, so this shows only what this deck has seen since it started. Anything an earlier run recorded comes back when you switch it on."})]}):u.map(d=>e.jsxs("div",{className:"bw-day",children:[e.jsx("h4",{className:"bw-sec-head",children:d.label}),d.episodes.map(i=>{const w=E(i),m=r===w;return e.jsxs("div",{className:`bw-ep${m?" open":""}`,children:[e.jsxs("div",{className:"bw-ep-row",children:[e.jsxs("button",{className:"bw-ep-head",ref:b=>{b?o.current.set(w,b):o.current.delete(w)},onClick:()=>h(m?null:w),"aria-expanded":m,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:m?"▾":"▸"}),e.jsx("span",{className:"bw-ep-host",children:i.host}),e.jsxs("span",{className:"bw-ep-meta",children:[te(i),U(i)&&e.jsxs(e.Fragment,{children:[" · ",U(i)]}),i.provisional&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{title:"Its quiet window has not closed yet. If somebody used the browser in the minutes after it, it is withdrawn; until then it is not written down and no reaction runs.",children:"provisional"})]})]}),e.jsxs("span",{className:"bw-ep-count",children:[i.count," ",i.count===1?"page":"pages"]})]}),e.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>n(i),"aria-label":`Dismiss ${i.host}`,title:"Dismiss — it leaves this list for good, and stays in the log file",children:"×"})]}),m&&e.jsx("ul",{className:"bw-urls",children:i.urls.map((b,y)=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-url-time",children:new Date(b.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),e.jsx("span",{className:"bw-url",children:b.url})]},`${b.url}-${b.timeMs}-${y}`))})]},w)})]},d.label))})]})}function re(s){const t=/^#?([0-9a-f]{6})$/i.exec((s??"").trim());if(!t)return!1;const l=parseInt(t[1],16),r=[l>>16&255,l>>8&255,l&255].map(h=>{const o=h/255;return o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)});return .2126*r[0]+.7152*r[1]+.0722*r[2]>.5}const G=1e4,ie=12e3;function oe({browsers:s,findings:t,watching:l,palette:r}){const h=c.useRef(null),o=c.useRef(null);return o.current={browsers:s,findings:t,watching:l},c.useEffect(()=>{var m;const a=h.current;if(!a)return;const n=a.getContext("2d");if(!n)return;const u=((m=window.matchMedia)==null?void 0:m.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let d=0,i=!1;const w=()=>{var q;if(i)return;const b=o.current;if(!b)return;const{browsers:y,findings:p,watching:P}=b,R=r["--accent"]||"#7dd3fc",f=r["--line"]||"#1f2229",j=r["--text-dim"]||"#6e727c",C=re(r["--bg"]),N=C?42:26,v=C?.85:.65,I=Date.now(),$=Math.min(window.devicePixelRatio||1,2),W=a.clientWidth,k=a.clientHeight;(a.width!==W*$||a.height!==k*$)&&(a.width=W*$,a.height=k*$),n.setTransform($,0,0,$,0,0),n.clearRect(0,0,W,k);const x=W/2,M=k/2,S=Math.min(W,k)/2-6;n.strokeStyle=f,n.lineWidth=1,n.globalAlpha=C?1:.9;for(const g of[.4,.7,1])n.beginPath(),n.arc(x,M,S*g,0,Math.PI*2),n.stroke();n.beginPath(),n.moveTo(x-S,M),n.lineTo(x+S,M),n.moveTo(x,M-S),n.lineTo(x,M+S),n.stroke(),n.globalAlpha=1;const A=(P&&!u?I%G/G:0)*Math.PI*2-Math.PI/2;if(P){const g=(q=n.createConicGradient)==null?void 0:q.call(n,A-.85,x,M);g&&(g.addColorStop(0,"transparent"),g.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${R} ${N}%, transparent)`),g.addColorStop(1,"transparent"),n.fillStyle=g,n.beginPath(),n.moveTo(x,M),n.arc(x,M,S,A-.85,A),n.closePath(),n.fill()),n.strokeStyle=R,n.globalAlpha=v,n.beginPath(),n.moveTo(x,M),n.lineTo(x+Math.cos(A)*S,M+Math.sin(A)*S),n.stroke(),n.globalAlpha=1}y.forEach((g,T)=>{const B=T/Math.max(y.length,1)*Math.PI*2-Math.PI/2,D=g.lastReadMs===null?1:Math.min(1,(I-g.lastReadMs)/12e4),O=S*(.42+D*.5),F=x+Math.cos(B)*O,L=M+Math.sin(B)*O,Q=Math.abs((A-B+Math.PI*3)%(Math.PI*2)-Math.PI),K=P?Math.max(0,1-Q/.55):0;n.beginPath(),n.arc(F,L,3+K*1.6,0,Math.PI*2),n.fillStyle=g.running?R:j,n.globalAlpha=g.running?.55+K*.45:.35,n.fill(),n.globalAlpha=1});for(const g of p){const T=(I-g.atMs)/ie;if(T<0||T>1)continue;const D=Math.max(0,y.findIndex(L=>L.key===g.browser))/Math.max(y.length,1)*Math.PI*2-Math.PI/2,O=x+Math.cos(D)*S*.6,F=M+Math.sin(D)*S*.6;n.beginPath(),n.arc(O,F,4+T*22,0,Math.PI*2),n.strokeStyle=R,n.globalAlpha=(1-T)*.8,n.lineWidth=1.5,n.stroke(),n.globalAlpha=1}d=requestAnimationFrame(w)};return w(),()=>{i=!0,cancelAnimationFrame(d)}},[r]),e.jsx("canvas",{ref:h,className:"bw-radar",role:"img","aria-label":l?`Watching ${s.length} browser${s.length===1?"":"s"}`:"Not watching"})}function le(s,t,l){if(s===null)return null;const r=s+t-l;return r>0?r:null}function ce(s){const t=Math.ceil(s/1e3),l=Math.floor(t/60),r=t%60;return l>0?`${l}m ${r}s`:`${r}s`}function J(s){return(s??[]).filter(t=>t.installed&&t.profiles>0)}function de(s){return!Number.isFinite(s)||s<=0?"empty":Y(s)}function he(s,t){return s.map(l=>({key:l.key,name:l.name,running:l.running,visits:t.filter(r=>r.browser===l.key).reduce((r,h)=>r+h.programVisits,0)}))}function ue(s,t){if(s===null)return null;const l=Math.max(0,Math.round((t-s)/1e3));if(l<5)return"just now";if(l<60)return`${l} sec ago`;const r=Math.round(l/60);return r<60?`${r} min ago`:`${Math.round(r/60)} hr ago`}function we(s){const t=s.profiles.filter(r=>r.degraded);if(t.length>0){const r=t[0],h=t.length-1;return{kind:"unreadable",text:`${r.name}/${r.profile} could not be read — ${r.reason??"no reason given"}`+(h>0?`, and ${h} more`:"")+". The watch continues on the profiles it can read."}}const l=J(s.browsers);return l.length===0?{kind:"no-profiles",text:"No browser on this machine has a profile to read. Open one of the browsers below once and it will be watched from then on."}:l.some(r=>r.running)?null:{kind:"none-running",text:"No watched browser is running, so nothing can be navigated right now. Their history is still read, and anything found while they were open is still here."}}function me({snap:s,watching:t,palette:l}){const[r,h]=c.useState(!1),[o,a]=c.useState(()=>Date.now());c.useEffect(()=>{const u=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(u)},[]);const n=le(s.coverage.lastHumanMs,s.coverage.quietMs,o);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:["Activity overview",e.jsx("button",{className:"bw-help",onClick:()=>h(u=>!u),"aria-expanded":r,"aria-label":"What the sweep and the dots mean",children:"?"})]}),e.jsxs("div",{className:"bw-glance",children:[e.jsx(oe,{browsers:t.map(u=>{var d;return{key:u.key,name:u.name,running:u.running,lastReadMs:((d=s.profiles.find(i=>i.browser===u.key))==null?void 0:d.lastWrittenMs)??null}}),findings:s.episodes.slice(0,6).map(u=>({browser:u.browser??null,atMs:u.endMs})),watching:s.settings.enabled,palette:l}),e.jsx("ul",{className:"bw-counts",children:he(t,s.profiles).map(u=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-count-n",children:u.visits.toLocaleString("en-US")}),e.jsx("span",{className:"bw-count-of",children:u.name})]},u.key))})]}),e.jsx("p",{className:"bw-since",children:"Pages a program opened, since this deck started"}),s.coverage.checkedMs>0&&e.jsxs("p",{className:"bw-since",children:["Last checked ",ue(s.coverage.checkedMs,o),s.coverage.checks>0&&e.jsxs(e.Fragment,{children:[" · ",s.coverage.checks.toLocaleString("en-US")," ",s.coverage.checks===1?"check":"checks"]})]}),n!==null&&e.jsxs("p",{className:"bw-gate",children:["You are browsing — a program page would count in ",ce(n)]}),r&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:"Sweep"}),e.jsx("dd",{children:"one poll of every watched profile"}),e.jsx("dt",{children:"Dot"}),e.jsx("dd",{children:"a browser, further out the longer since it last wrote history"}),e.jsx("dt",{children:"Ring"}),e.jsx("dd",{children:"a finding, leaving the browser it came from"})]})]})}function be({watching:s,rest:t}){const[l,r]=c.useState(!1),[h,o]=c.useState(!1);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:["Watched profiles",e.jsx("button",{className:"bw-help",onClick:()=>r(a=>!a),"aria-expanded":l,"aria-label":"What running, idle and connected to Anthropic mean",children:"?"})]}),l&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:"Running"}),e.jsx("dd",{children:"the browser has a process on this machine right now"}),e.jsx("dt",{children:"Connected"}),e.jsx("dd",{children:"an open connection to an address Anthropic's relay uses — which it shares with claude.ai, so an open tab looks the same as an agent channel"})]}),e.jsx("ul",{className:"bw-profiles",children:s.map(a=>e.jsxs("li",{children:[e.jsx("span",{className:`bw-prof-dot${a.running?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-prof-name",children:a.name}),e.jsx("span",{className:"bw-prof-state",children:a.running?"running":"idle"}),a.running&&a.relay.state==="live"&&e.jsx("span",{className:"bw-relay",children:"connected to Anthropic"})]},a.key))}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>o(a=>!a),"aria-expanded":h,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:h?"▾":"▸"})," ",t.length," not watched"]}),h&&e.jsxs("p",{className:"bw-rest",children:[t.map(a=>a.name).join(", ")," — not installed, or installed and never opened, so there is no history to read."]})]})]})}function fe({snap:s,quiet:t,setQuiet:l,save:r,access:h,setAccess:o}){return e.jsxs("div",{className:"bw-settings",children:[e.jsxs("label",{title:"A program opening a page counts as a finding only if nobody had touched the browser for this long. Shorter catches more and reports more of your own work; longer is quieter.",children:[e.jsx("span",{children:"Nobody browsing for"}),e.jsxs("select",{value:t??s.settings.quietMinutes,onChange:a=>{l(Number(a.target.value)),r({quietMinutes:Number(a.target.value)})},children:[e.jsx("option",{value:1,children:"1 min"}),e.jsx("option",{value:5,children:"5 min"}),e.jsx("option",{value:15,children:"15 min"}),e.jsx("option",{value:30,children:"30 min"}),e.jsx("option",{value:60,children:"60 min"})]})]}),e.jsxs("label",{children:[e.jsx("span",{children:"When it finds one"}),e.jsx("select",{value:s.settings.reaction,onChange:a=>void r({reaction:a.target.value}),disabled:!s.settings.enabled,title:s.settings.enabled?"What to do besides writing it down.":"Turn watching on to arm a reaction.",children:(s.reactions??["notify"]).map(a=>e.jsx("option",{value:a,children:a==="notify"?"notify me":a==="close-tab"?"close the tab":"quit the browser"},a))})]}),e.jsxs("div",{className:"bw-settings-note",children:[e.jsxs("p",{children:["Chrome marks a navigation that came from an extension or a command rather than from a click. These are the ones that happened while nobody had touched the browser for the time above. ",e.jsx("strong",{children:"Usually that is your own agent doing what you asked."})]}),e.jsxs("button",{className:"bw-why",onClick:()=>o(a=>!a),"aria-expanded":h,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:h?"▾":"▸"})," What Browser Watch can access"]}),h&&e.jsxs("dl",{className:"bw-access",children:[e.jsx("dt",{children:"Reads"}),e.jsxs("dd",{children:["A copy of each browser's own history database — the live file is locked while the browser holds it. Only rows newer than the moment this deck started:"," ",new Date(s.coverage.startedMs).toLocaleString(),"."]}),e.jsx("dt",{children:"Keeps"}),e.jsxs("dd",{children:["Only while the switch is on, and only the episodes it flagged — never your ordinary browsing. In ",e.jsx("code",{className:"bw-path",children:s.coverage.logPath}),typeof s.coverage.logBytes=="number"?` (${de(s.coverage.logBytes)})`:"",", with every address written in full so you can check it yourself."]}),e.jsx("dt",{children:"Sends"}),e.jsx("dd",{children:"Nothing. No part of this reads or writes over the network; the deck serves on 127.0.0.1 and this panel talks only to it."}),e.jsx("dt",{children:"Never reads"}),e.jsx("dd",{children:"Anything from before this deck started, cookies, saved passwords, page contents, or any browser profile with no history file."})]})]})]})}function H(s,t){return t?{kind:"saving",word:"Saving"}:s.settings.enabled?{kind:"on",word:"Watching"}:{kind:"off",word:"Paused"}}function ge({snap:s,saving:t,save:l,why:r,setWhy:h}){return e.jsxs("footer",{className:"bw-status",children:[e.jsx("span",{className:`bw-mode-dot${s.settings.enabled?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-mode-word",children:H(s,t).word},H(s,t).kind),e.jsx("span",{className:"bw-status-text",children:s.coverage.archived===0?s.settings.enabled?"No episodes recorded yet":"No episodes on disk":`${s.coverage.archived} ${s.coverage.archived===1?"episode":"episodes"} on disk`}),e.jsx("button",{className:`glyph-btn bw-gear${r?" on":""}`,onClick:()=>h(o=>!o),"aria-expanded":r,"aria-label":"Settings",title:"Settings",children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[e.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),e.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),e.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[e.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:"Watch browser activity"}),e.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":s.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"switch",onClick:()=>void l({enabled:!s.settings.enabled}),title:s.settings.enabled?"On — every episode it finds is written down, so the list outlives the browsing history being cleared":"Off — showing only what this deck has seen since it started. Anything an earlier run archived is hidden until you switch back on, and nothing new is kept",children:e.jsx("span",{className:"switch-knob"})})]})]})}function pe({relay:s}){const[t,l]=c.useState(!1),[r,h]=c.useState(!1),o=s.killswitch.blocked?"unblock":"block",a=s.command[o],n=c.useCallback(async()=>{await z(a.command)&&(h(!0),window.setTimeout(()=>h(!1),1600))},[a.command]),u=s.profiles.filter(i=>{var w;return(w=i.report)==null?void 0:w.present}),d=s.profiles.filter(i=>i.report===null);return e.jsxs("section",{className:"bw-sec",children:[e.jsx("h4",{className:"bw-sec-head",children:"Remote control"}),e.jsx("p",{className:`bw-rc-verdict ${s.verdict}`,role:"status",children:s.verdict==="exposed"?"Claude in Chrome is live here, so any Claude Code session signed in to your Anthropic account can drive this browser — from any machine, with no prompt on this one.":s.verdict==="protected"?`The relay is black-holed in ${s.hostsPath}, so no new connection to it can be made from this machine.`:"Claude in Chrome is not installed and enabled in any profile here, so there is nothing for the relay to drive."}),s.killswitch.foreign.length>0&&e.jsxs("p",{className:"bw-rc-foreign",children:["Another entry for this host is already in ",s.hostsPath,", and ccdeck will not touch it:",s.killswitch.foreign.map(i=>e.jsx("code",{className:"bw-path",children:i},i))]}),e.jsxs("button",{className:"bw-why",onClick:()=>l(i=>!i),"aria-expanded":t,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",s.verdict==="protected"?"How to undo the block":"What it can reach, and how to stop it"]}),t&&e.jsxs("div",{className:"bw-rc-body",children:[u.length>0&&e.jsx("dl",{className:"bw-key",children:u.map(i=>e.jsxs(c.Fragment,{children:[e.jsxs("dt",{children:[i.name,i.profile==="Default"?"":` · ${i.profile}`]}),e.jsxs("dd",{children:[i.report.enabled?"enabled":"installed but switched off",i.report.allUrls?", can act on every site":", limited to the sites it was granted",i.report.sensitiveApis.length>0&&e.jsxs(e.Fragment,{children:[" — ",i.report.sensitiveApis.join(", ")]})]})]},`${i.browser}/${i.profile}`))}),d.length>0&&e.jsxs("p",{className:"bw-rc-note",children:[d.map(i=>i.name).join(", ")," — its settings file could not be read, so nothing is claimed about it either way."]}),!s.hostsRead&&e.jsxs("p",{className:"bw-rc-note",children:[s.hostsPath," could not be read, so whether the relay is already blocked is unknown."]}),u.some(i=>i.report.allUrls)&&e.jsxs("p",{className:"bw-rc-note",children:["Narrowing the sites in ",e.jsx("code",{className:"bw-path",children:"chrome://extensions"})," does not change this: the grant is held at the browser level and the per-site list is enforced inside the extension, by the extension."]}),e.jsxs("div",{className:"bw-rc-cmd",children:[e.jsx("code",{children:a.command}),e.jsx("button",{className:"btn bw-rc-copy",onClick:n,children:r?"Copied":"Copy"})]}),e.jsx("p",{className:"bw-rc-note",children:a.note})]})]})}function xe(s){const[t,l]=c.useState(null),[r,h]=c.useState(null),[o,a]=c.useState(null),[n,u]=c.useState(!1),d=c.useRef(!1),[i,w]=c.useState(null),[m,b]=c.useState(!1),y=c.useRef(!1),p=c.useCallback(async f=>{var j,C;if(!(f&&!X(d.current))){f&&(d.current=!0,u(!0));try{const N=await fetch(`/api/browser-watch${f?"?refresh=1":""}`);if(!N.ok)throw new Error(`the deck answered ${N.status}`);const v=await N.json();l(v),y.current||w(((j=v==null?void 0:v.settings)==null?void 0:j.quietMinutes)??15),s(((C=v==null?void 0:v.settings)==null?void 0:C.enabled)===!0),h(null)}catch(N){h(N instanceof Error?N.message:String(N))}finally{f&&(d.current=!1,u(!1))}}},[s]);c.useEffect(()=>{p(!1)},[p]),c.useEffect(()=>{const f=setInterval(()=>{p(!1)},1e4);return()=>clearInterval(f)},[p]);const P=c.useCallback(async f=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:f.host,startMs:f.startMs})})}finally{await p(!1)}},[p]),R=c.useCallback(async f=>{y.current=!0,b(!0);try{const j=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(f)});if(!j.ok)throw new Error(`the deck answered ${j.status}`);await p(!1),a(null)}catch(j){a(j instanceof Error?j.message:String(j))}finally{y.current=!1,b(!1)}},[p]);return{snap:t,error:r,writeError:o,setWriteError:a,busy:n,quiet:i,setQuiet:w,saving:m,load:p,dismiss:P,save:R}}function ye({onClose:s,onSeen:t,onWatching:l,palette:r}){const h=Z(s),{snap:o,error:a,writeError:n,setWriteError:u,busy:d,quiet:i,setQuiet:w,saving:m,load:b,dismiss:y,save:p}=xe(l),[P,R]=c.useState(!1),[f,j]=c.useState(!1),C=c.useRef(null),N=c.useRef(t);N.current=t,c.useEffect(()=>()=>N.current(Date.now()),[]);const v=J(o==null?void 0:o.browsers),I=((o==null?void 0:o.browsers)??[]).filter(k=>!(k.installed&&k.profiles>0)),$=o?we(o):null,W=v.reduce((k,x)=>k+x.profiles,0);return e.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:e.jsxs("div",{ref:h,className:"modal bw-modal",onClick:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"bw-title",children:[e.jsxs("header",{className:"modal-head",children:[e.jsxs("div",{className:"modal-title",children:[e.jsx("span",{className:"modal-tool-name",id:"bw-title",children:"Browser watch"}),e.jsx("span",{className:"modal-tool-id",children:o?`${W} ${W===1?"profile":"profiles"} · local only`:"local only"})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{ref:C,className:"glyph-btn",onClick:()=>void b(!0),...ee(d),"aria-label":"Re-read every profile now",title:"Re-read every profile now",children:d?"…":"↻"}),e.jsx("button",{className:"glyph-btn",onClick:s,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),e.jsxs("div",{className:"modal-body bw-body",children:[!o&&!a&&e.jsxs("div",{className:"bw-loading",children:[e.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),e.jsx("p",{children:"Reading each browser's history. The first look copies the file, which takes a moment."})]}),a&&e.jsx("div",{className:"bw-state",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:"Could not read"}),e.jsx("span",{className:"bw-row-detail",children:a})]})}),o&&$&&e.jsx("p",{className:`bw-trouble ${$.kind}`,role:"status",children:$.text}),o&&e.jsxs("div",{className:"bw-work",children:[e.jsxs("aside",{className:"bw-side",children:[e.jsx(me,{snap:o,watching:v,palette:r}),e.jsx(be,{watching:v,rest:I}),o.relay&&e.jsx(pe,{relay:o.relay})]}),e.jsxs("div",{className:"bw-main",children:[e.jsx(ae,{snap:o,dismiss:y,refreshRef:C}),e.jsx(se,{snap:o})]})]}),o&&P&&e.jsx(fe,{snap:o,quiet:i,setQuiet:w,save:p,access:f,setAccess:j}),n&&e.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:"Could not save that setting"}),e.jsxs("span",{className:"bw-row-detail",children:[n," — the switches below show what is stored, not what you pressed."]}),e.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>u(null),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]})}),o&&e.jsx(ge,{snap:o,saving:m,save:p,why:P,setWhy:R})]})]})})}export{ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U,f as p,r as c,s as Z,p as _,j as a,b as g,c as O,u as D,d as ee,e as se,g as E,h as ae,i as te}from"./index-
|
|
1
|
+
import{a as U,f as p,r as c,s as Z,p as _,j as a,b as g,c as O,u as D,d as ee,e as se,g as E,h as ae,i as te}from"./index-Dj4JHRcG.js";function ne(s){return!s.answer||s.answer.range!==s.want?{phase:"busy",stale:!1}:s.answer.ok?{phase:s.answer.days>0?"chart":"empty",stale:s.loading}:{phase:"error",stale:s.loading}}function I(s){const e=new Map;for(const n of s)for(const o of n.agents??[]){if(!o||typeof o.agent!="string"||o.agent==="")continue;const r=e.get(o.agent)??{id:o.agent,cost:0,tokens:0};r.cost+=Number.isFinite(o.totalCost)?o.totalCost:0,r.tokens+=Number.isFinite(o.totalTokens)?o.totalTokens:0,e.set(o.agent,r)}return[...e.values()].sort((n,o)=>o.cost-n.cost||n.id.localeCompare(o.id))}function oe(s){const e=I([{agents:s}]);return e.length<2?null:e.map(n=>`${U(n.id)} ${p(n.cost)}`).join(" · ")}function F(s){switch(s.toLowerCase()){case"claude":return"var(--model-opus)";case"codex":return"var(--model-codex)";case"gemini":return"var(--model-gemini)";case"copilot":return"var(--model-haiku)";default:return"var(--model-other)"}}function le(s,e){if(!(e>0)||!(s>0))return"0%";const n=s/e*100;return n<.1?"<0.1%":`${n.toFixed(1)}%`}const u=s=>typeof s=="number"&&Number.isFinite(s)?s:0,M=s=>typeof s=="string"?s:"",P=s=>Array.isArray(s)?s.filter(e=>typeof e=="string"):[];function re(s){const e=s??{};return{modelName:M(e.modelName),cost:u(e.cost),inputTokens:u(e.inputTokens),outputTokens:u(e.outputTokens),cacheCreationTokens:u(e.cacheCreationTokens),cacheReadTokens:u(e.cacheReadTokens)}}function ce(s){const e=s??{},n=Array.isArray(e.agents)?e.agents.map(o=>{const r=o??{};return{agent:M(r.agent),totalCost:u(r.totalCost),totalTokens:u(r.totalTokens)}}):void 0;return{period:M(e.period),totalCost:u(e.totalCost),totalTokens:u(e.totalTokens),inputTokens:u(e.inputTokens),outputTokens:u(e.outputTokens),cacheCreationTokens:u(e.cacheCreationTokens),cacheReadTokens:u(e.cacheReadTokens),modelsUsed:P(e.modelsUsed),modelBreakdowns:Array.isArray(e.modelBreakdowns)?e.modelBreakdowns.map(re):[],...n?{agents:n}:{},...e.metadata&&typeof e.metadata=="object"?{metadata:{agents:P(e.metadata.agents)}}:{}}}function ie(s){const e=s??{};return{...e,ok:e.ok===!0,days:Array.isArray(e.days)?e.days.map(ce):void 0}}function T(s){const e=s.toLowerCase();return e.includes("opus")?"var(--model-opus)":e.includes("sonnet")?"var(--model-sonnet)":e.includes("haiku")?"var(--model-haiku)":e.includes("gpt-5")||e.includes("gpt5")?"var(--model-gpt5)":e.includes("gpt")?"var(--model-gpt)":e.includes("gemini")?"var(--model-gemini)":e.includes("codex")?"var(--model-codex)":e.includes("fable")||e.includes("mythos")?"var(--model-fable)":"var(--model-other)"}function ue(s){let e=0,n=0,o=0,r=0;const m=new Map;for(const l of s){e+=l.totalCost,n+=l.totalTokens,o+=l.inputTokens+l.outputTokens,r+=l.cacheReadTokens;for(const d of l.modelBreakdowns)m.set(d.modelName,(m.get(d.modelName)??0)+d.cost)}return{totalCost:e,totalTok:n,inOut:o,cacheRead:r,modelCosts:m}}function de(s){return Array.from(s.entries()).sort((e,n)=>n[1]-e[1])}function q(s){return s.slice().sort((e,n)=>n.cost-e.cost)}function C(s,e){return e>0?s/e*100:0}function he(s){var n,o;return oe(s.agents)??((o=(n=s.metadata)==null?void 0:n.agents)!=null&&o.length?s.metadata.agents.join(" · "):null)}function me(){let s=0;return{begin(){const e=++s;return()=>e===s},cancel(){s++}}}function pe(s){const[e,n]=c.useState(null),[o,r]=c.useState(!1),m=c.useState(me)[0],l=c.useRef(!1),d=(f=!1)=>{if(f&&!Z(l.current))return;const x=m.begin();l.current=f;const k=s;r(!0);const i=`/api/ccusage?since=${_(k)}${f?"&refresh=1":""}`;fetch(i).then(j=>j.json()).then(j=>{x()&&n({range:k,resp:ie(j)})}).catch(()=>{x()&&n({range:k,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{x()&&(l.current=!1,r(!1))})};return c.useEffect(()=>(d(!1),()=>m.cancel()),[s]),{landed:e,loading:o,reload:()=>d(!0)}}function ge({selectedDay:s}){const e=he(s);return a.jsxs("div",{className:"uh-detail",children:[a.jsxs("div",{className:"uh-detail-head",children:[a.jsx("span",{className:"uh-detail-date",children:s.period}),a.jsx("span",{className:"uh-detail-cost",children:p(s.totalCost)}),e&&a.jsx("span",{className:"uh-detail-agents",title:e,children:e})]}),a.jsxs("div",{className:"uh-detail-mini",children:[a.jsx(y,{label:"input",val:g(s.inputTokens)}),a.jsx(y,{label:"output",val:g(s.outputTokens)}),a.jsx(y,{label:"cache write",val:g(s.cacheCreationTokens)}),a.jsx(y,{label:"cache read",val:g(s.cacheReadTokens)})]}),a.jsx("div",{className:"uh-detail-models",children:q(s.modelBreakdowns).map(n=>{const o=C(n.cost,s.totalCost);return a.jsxs("div",{className:"uh-model-row",title:n.modelName,children:[a.jsxs("span",{className:"uh-model-name",children:[a.jsx("span",{className:"uh-legend-dot",style:{background:T(n.modelName)}}),a.jsx("span",{className:"uh-model-label",children:O(n.modelName)})]}),a.jsx("span",{className:"uh-model-bar",children:a.jsx("span",{className:"uh-model-bar-fill",style:{width:`${o}%`,background:T(n.modelName)}})}),a.jsx("span",{className:"uh-model-cost",children:p(n.cost)})]},n.modelName)})})]})}function y({label:s,val:e}){return a.jsxs("div",{className:"uh-ministat",children:[a.jsx("span",{className:"uh-ministat-val",children:e}),a.jsx("span",{className:"uh-ministat-label",children:s})]})}const fe=[7,14,30,90];function je({onClose:s,providers:e}){var B;const[n,o]=c.useState(30),[r,m]=c.useState(null),{landed:l,loading:d,reload:f}=pe(n),x=c.useRef(null),k=D(s,{focusRef:x}),h=ne({loading:d,want:n,answer:l&&{range:l.range,ok:l.resp.ok===!0,days:((B=l.resp.days)==null?void 0:B.length)??0}}),i=h.phase==="chart"?l.resp.days??[]:[],j=c.useRef(null),G=ee(h.phase!=="error",j),H=c.useMemo(()=>i.reduce((t,N)=>Math.max(t,N.totalCost),0),[i]),S=c.useRef(null);c.useLayoutEffect(()=>{const t=S.current;t&&(t.scrollLeft=t.scrollWidth)},[i]);const{totalCost:w,totalTok:V,inOut:W,cacheRead:z,modelCosts:A}=c.useMemo(()=>ue(i),[i]),J=c.useMemo(()=>de(A),[A]),b=c.useMemo(()=>I(i),[i]),K=b.length>1,L=r?i.find(t=>t.period===r)??null:null;return a.jsx("div",{className:"modal-backdrop",onClick:s,role:"presentation",children:a.jsxs("div",{ref:k,className:"modal uh-modal",onClick:t=>t.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Usage history",children:[a.jsxs("header",{className:"uh-head",children:[a.jsxs("div",{className:"uh-titlewrap",children:[a.jsx("div",{className:"uh-title",children:"Usage history"}),a.jsx("div",{className:"uh-sub",children:h.stale?"running ccusage…":se(e,b.map(t=>t.id))})]}),a.jsx("div",{className:"uh-range",role:"group","aria-label":"Range",children:fe.map(t=>a.jsxs("button",{type:"button","aria-pressed":n===t,className:"uh-range-btn",onClick:()=>{o(t),m(null)},children:[t,"d"]},t))}),a.jsx("button",{ref:j,className:"glyph-btn uh-reload",onClick:f,...E(d),title:"Re-run ccusage","aria-label":"Reload",children:d?"…":"↻"}),a.jsx("button",{ref:x,className:"glyph-btn uh-close",onClick:s,"aria-label":"Close",children:"×"})]}),h.phase==="busy"?a.jsxs("div",{className:"uh-status uh-status-wait","aria-busy":"true",children:[a.jsx("span",{className:"uh-wait-word",children:l?"running ccusage…":"running ccusage… (first run downloads the package)"}),a.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):h.phase==="error"?a.jsxs("div",{className:"uh-status uh-err",title:te(l.resp)||void 0,children:[ae(l.resp,"ccusage did not report usage"),a.jsx("div",{children:a.jsx("button",{className:"btn uh-retry",onClick:()=>{G(),f()},...E(d),children:d?"trying…":"Try again"})})]}):h.phase==="empty"?a.jsx("div",{className:`uh-status${h.stale?" uh-stale":""}`,"aria-busy":h.stale||void 0,children:"no usage in this range"}):a.jsxs("div",{className:h.stale?"uh-stale":void 0,"aria-busy":h.stale||void 0,children:[a.jsxs("div",{className:"uh-totals",children:[a.jsx(v,{label:"total cost",val:p(w),accent:!0}),a.jsx(v,{label:"tokens",val:g(V)}),a.jsx(v,{label:"input+output",val:g(W)}),a.jsx(v,{label:"cache reads",val:g(z)})]}),K&&a.jsxs("div",{className:"uh-agents",role:"group","aria-label":"Cost by CLI",children:[a.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:b.map(t=>a.jsx("span",{className:"uh-agent-seg",style:{width:`${C(t.cost,w)}%`,background:F(t.id)}},t.id))}),a.jsx("div",{className:"uh-agent-keys",children:b.map(t=>a.jsxs("span",{className:"uh-agent-key",title:`${t.id} · ${g(t.tokens)} tokens`,children:[a.jsx("span",{className:"uh-legend-dot",style:{background:F(t.id)}}),U(t.id),a.jsx("span",{className:"uh-agent-cost",children:p(t.cost)}),a.jsx("span",{className:"uh-agent-share",children:le(t.cost,w)})]},t.id))})]}),a.jsx("div",{ref:S,className:"uh-chart",role:"group","aria-label":"Daily cost by model",children:i.map((t,N)=>{const Q=C(t.totalCost,H),R=t.period===r,X=`${t.period}, ${p(t.totalCost)}`;return a.jsxs("button",{className:`uh-bar-col${R?" sel":""}`,onClick:()=>m(R?null:t.period),"aria-pressed":R,"aria-label":X,title:`${t.period} · ${p(t.totalCost)}`,style:{flexBasis:`${100/i.length}%`,"--uh-i":N,"--uh-step":`${Math.min(10,200/Math.max(i.length,1))}ms`},children:[a.jsx("div",{className:"uh-bar",style:{height:`${Math.max(Q,t.totalCost>0?2:0)}%`},children:q(t.modelBreakdowns).map($=>{const Y=C($.cost,t.totalCost);return a.jsx("div",{className:"uh-bar-seg",style:{height:`${Y}%`,background:T($.modelName)}},$.modelName)})}),a.jsx("span",{className:"uh-bar-label",children:t.period.slice(5)})]},t.period)})}),a.jsx("div",{className:"uh-legend",children:J.map(([t,N])=>a.jsxs("span",{className:"uh-legend-item",title:t,children:[a.jsx("span",{className:"uh-legend-dot",style:{background:T(t)}}),O(t)," ",a.jsx("span",{className:"uh-legend-cost",children:p(N)})]},t))}),L&&a.jsx(ge,{selectedDay:L})]})]})})}function v({label:s,val:e,accent:n}){return a.jsxs("div",{className:"uh-stat",children:[a.jsx("span",{className:`uh-stat-val${n?" accent":""}`,children:e}),a.jsx("span",{className:"uh-stat-label",children:s})]})}export{je as default};
|
|
@@ -97,7 +97,7 @@ ${e.map(s=>` ${s.label}: ${ii(s.waiting)} (${id(r-s.waiting.since)})`).join(`
|
|
|
97
97
|
${qe(o.total)} spent${u?` · ${u}`:""}`:""}`,onClick:()=>{try{r(e.id)}catch{}},children:[a.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),a.jsx("span",{className:"selected-label",children:e.label}),o.total>0&&a.jsxs("span",{className:"selected-cost",children:[qe(o.total),u?a.jsxs("span",{className:"selected-rate",children:[" · ",u]}):null]}),d>0&&a.jsxs("span",{className:"selected-extra",children:["+",d]}),a.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:h=>{h.stopPropagation(),s()},children:"×"})]})}function Hne({catBarRef:e,catBarOccluded:t,presentCats:n,hiddenCats:r,toggleCat:s}){return a.jsx("div",{ref:e,className:`cat-filter-bar${t?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:n.map(o=>{const l=r.has(o);return a.jsxs("button",{type:"button",className:`cat-filter${l?" off":""}`,onClick:()=>s(o),"aria-pressed":!l,title:`${l?"Show":"Hide"} ${Nd[o]} tools`,children:[a.jsx(Bte,{cat:o}),a.jsx("span",{className:"cat-name",children:Nd[o]})]},o)})})}const Vne=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(",");function Gne(e){var n,r;const t=e.target;!(t!=null&&t.closest)||t.closest(Vne)!==e.currentTarget||(e.preventDefault(),(r=(n=document.activeElement)==null?void 0:n.blur)==null||r.call(n))}function Kne({trashZoneRef:e,trashState:t,trashPhase:n,trashLabel:r}){return a.jsxs("div",{ref:e,className:`drag-trash-zone ${t}${n==="leaving"?" leaving":""}`,role:"status",children:[a.jsx("svg",{className:"drag-trash-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:a.jsx("path",{d:"M8 7V5.8C8 4.8 8.8 4 9.8 4h4.4c1 0 1.8.8 1.8 1.8V7m-10 0h12M8 10v8m4-8v8m4-8v8M7 7l.7 13h8.6L17 7"})}),a.jsxs("span",{className:"drag-trash-copy",children:[a.jsx("span",{className:"drag-trash-text",children:t==="over"?a.jsxs(a.Fragment,{children:["Release to remove ",a.jsx("strong",{className:"drag-trash-name",children:r||"this card"})]}):"Drop here to remove from the board"}),a.jsx("span",{className:"drag-trash-hint",children:t==="over"?"The session list (L) brings it back":"The session keeps running"})]})]})}function Yne({canvasRef:e,bubbling:t,dragging:n,trash:r,zoom:s,viewport:o,stateRef:l,peek:u,children:d}){const{trashDragging:h,trashState:f,trashPhase:p,trashZoneRef:g,trashLabel:v}=r,{lod:k,lodRef:b}=s,{markCanvasInput:x}=o,{peekAgent:N,peekLabel:S,peekRecap:_,peekBounds:E}=u;return a.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${t?" bubbling":""}${n?" dragging-any":""}${h&&f==="over"?" trash-hover":""}`,"data-lod":k,ref:e,onMouseDownCapture:Gne,onPointerDownCapture:x,onPointerUpCapture:x,onWheelCapture:x,onFocusCapture:T=>{const A=T.target;if(!j0(A)||b.current==null||b.current==="detail")return;const R=A.getAttribute("data-id");R&&l.current.agents.has(R)&&A.matches(":focus-visible")&&OO(R,A,"focus")},onBlurCapture:T=>{var R,B;const A=(B=(R=T.target).getAttribute)==null?void 0:B.call(R,"data-id");A&&ea(A)},children:[d,Du(p)&&a.jsx(Kne,{trashZoneRef:g,trashState:f,trashPhase:p,trashLabel:v}),a.jsx(xee,{agentFor:N,recapFor:_,labelFor:S,bounds:E})]})}function Xne({restarting:e,restartMode:t,live:n,paused:r}){return a.jsxs("div",{className:"conn-banner",role:"alert",children:[a.jsx("span",{className:"conn-dot"}),e?t==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${bt}…`:(()=>{const s=wU({connected:n,paused:r});return a.jsxs(a.Fragment,{children:[`Lost connection to the ${bt} server. Reconnecting…`,s&&a.jsx("span",{className:"conn-sub",children:s})]})})()]})}function Zne({oldName:e,version:t,dismissOldName:n}){return a.jsxs("div",{className:"ver-banner",role:"status",children:[a.jsx("span",{className:"ver-dot"}),a.jsxs("strong",{children:[e," still works — the deck is called ",bt," now."]}),t!=null&&t.renameFix?a.jsx("span",{className:"ver-sub",children:t.renameFix}):null,a.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}const Jne=3e4;function Qne({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function ere({bundle:e,running:t,pending:n,lastTried:r}){return t?Qne({bundle:e,running:t,lastTried:r})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function tre(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function nre({asked:e,reported:t}){return t?t!==e:!1}function XO(e){const t=e.thresholdMs??Jne;return!e.enabled||e.kind!=="restart"||!e.canRestart||!e.noticeOpen||!e.visible||e.busy?null:e.idleSince==null||e.now<e.idleSince?t:Math.max(0,t-(e.now-e.idleSince))}function rre(e){const t=Math.max(0,Math.ceil(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function sre(e,t){return e?t==null?"auto when idle":`auto in ${rre(t)}`:"auto-restart off"}function fR(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function are(e,t=!1){return e<=0&&t?{label:"Restart anyway",clause:"the canvas is paused — running agents cannot be seen"}:e<=0?{label:"Restart now",clause:"nothing is running"}:{label:"Restart anyway",clause:`${e===1?"1 agent is running":`${e} agents are running`} — their events during the restart are lost`}}function ore(e){const t=XO(e);return t==null?{idleSince:null,restart:!1,remainingMs:null}:e.idleSince==null||e.now<e.idleSince?{idleSince:e.now,restart:!1,remainingMs:t}:{idleSince:e.idleSince,restart:t===0,remainingMs:t}}const pR={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",not_writable:"the install directory is not writable by this user — run:",opted_out:"installs are off (AGENTS_DECK_NO_INSTALL=1) — run:",retired_name:"this install came from a name that is no longer published — run:"};function ire({notice:e,version:t,dismissNotice:n,upgradeState:r,startUpgrade:s,copyCommand:o,cmdCopied:l,autoRestart:u,toggleAutoRestart:d,askRestart:h,restartCopy:f,restartFuseMs:p,restarting:g}){var v,k,b;return a.jsxs("div",{className:`ver-banner ${e.kind}`,role:"status",children:[a.jsx("span",{className:`ver-dot${p==null?"":" armed"}`}),e.kind==="restart"?a.jsxs(a.Fragment,{children:[a.jsxs("strong",{children:["v",e.to," is installed — this deck still runs v",e.from,"."]}),t!=null&&t.canRestart?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"ver-act",onClick:()=>h(),...Ir(g),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
98
98
|
|
|
99
99
|
Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.`,children:g?"restarting…":f.label}),!g&&a.jsx("span",{className:"ver-sub",children:f.clause}),a.jsxs("label",{className:"ver-auto",children:[a.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":u,onClick:d,"aria-label":"Auto-restart when idle",title:u?"Updates on its own. While you are here it restarts once nothing has been running for 30 seconds; while you are away it also installs the new version first. Click to require a click instead.":"Only updates when you click. Click to let it update itself when idle or while you are away.",children:a.jsx("span",{className:"switch-knob"})}),a.jsx("span",{"aria-hidden":!0,children:sre(u,p)})]})]}):a.jsx("span",{className:"ver-sub",title:"Node loads every module once, at startup. An upgrade replaces the files on disk but not the code already in memory, so this process keeps running the old version until it is restarted.",children:"Restart it to pick up the new code."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("strong",{children:[bt," v",e.to," is out — you are on v",e.from,"."]}),(t==null?void 0:t.upgradeMode)==="install"&&r!=="failed"&&a.jsx("button",{type:"button",className:"ver-act",onClick:s,...Ir(r==="running",r==="done"),title:`Runs ${((v=t==null?void 0:t.upgrade)==null?void 0:v.command)??(t==null?void 0:t.command)??"npm i -g"} here, then restarts once nothing is running.`,children:r==="running"?"installing…":r==="done"?"installed":"Update now"}),(t==null?void 0:t.upgradeMode)==="npx"&&(t==null?void 0:t.canRestart)&&a.jsx("button",{type:"button",className:"ver-act",onClick:()=>h({upgrade:!0}),...Ir(g),title:`Runs ${t==null?void 0:t.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:g?"fetching…":r==="failed"?"Retry update":"Update & restart"}),r==="failed"?a.jsxs("span",{className:"ver-sub fail",title:((k=t==null?void 0:t.upgrade)==null?void 0:k.error)??"",children:[(t==null?void 0:t.upgradeMode)==="npx"?"update failed":"install failed",": ",((b=t==null?void 0:t.upgrade)==null?void 0:b.error)??"unknown error"," — run it yourself:"]}):(t==null?void 0:t.upgradeMode)==="npx"?a.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?"npx cannot upgrade in place, so the deck re-runs:":pR.npx}):t!=null&&t.upgradeBlocked?a.jsx("span",{className:"ver-sub",children:Ot(pR,t.upgradeBlocked)??"cannot install from here"}):null,a.jsxs("button",{type:"button",className:"ver-cmd",onClick:o,title:"Copy to clipboard",children:[a.jsx("code",{children:t==null?void 0:t.command}),a.jsx("span",{className:"ver-cmd-hint",children:l?"copied":"copy"})]})]}),a.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}function lre({restart:e,versionCheck:t,upgrade:n,oldNameNotice:r,everConnected:s,live:o,paused:l}){const{autoRestart:u,toggleAutoRestart:d,restarting:h,restartMode:f,restartedTo:p,askRestart:g,restartCopy:v,restartFuseMs:k}=e,{version:b,notice:x,noticeOpen:N,dismissNotice:S}=t,{upgradeState:_,startUpgrade:E,copyCommand:T,cmdCopied:A}=n,{oldName:R,oldNameOpen:B,dismissOldName:P}=r;return p?a.jsxs("div",{className:"ver-banner done",role:"status",children:[a.jsx("span",{className:"ver-dot"}),a.jsxs("strong",{children:["Restarted — now running v",p,"."]}),a.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):s&&!o?a.jsx(Xne,{restarting:h,restartMode:f,live:o,paused:l}):N&&x?a.jsx(ire,{notice:x,version:b,dismissNotice:S,upgradeState:_,startUpgrade:E,copyCommand:T,cmdCopied:A,autoRestart:u,toggleAutoRestart:d,askRestart:g,restartCopy:v,restartFuseMs:k,restarting:h}):B&&R?a.jsx(Zne,{oldName:R,version:b,dismissOldName:P}):null}function cre(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function ure(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.decks!="number"||typeof t.mine!="boolean")return null;const n=t.owner&&typeof t.owner=="object"?t.owner.port:null;return{path:typeof t.path=="string"&&t.path!==""?t.path:null,decks:t.decks,mine:t.mine,ownerPort:typeof n=="number"?n:null}}function dre(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function hre(e,t){const n=dre(e),r=(...l)=>[n?`${n} on the canvas`:null,...l,"layout, pins and selection"].filter(u=>u!==null),s="This cannot be undone.";if(!t)return{goes:r("the event log on disk — the file a restarted deck replays to rebuild what you see, and the file every deck on this machine shares unless one was told otherwise"),stays:[],final:s,confirm:"Clear everything"};if(!t.path)return{goes:r(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${s}`,confirm:"Clear everything"};if(!t.mine){const l=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,u=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:r(),stays:[`the event log — ${l}${u}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:r("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:s,confirm:"Clear everything"};const o=t.decks-1;return{goes:r(`the event log ${o===1?"1 other running deck shares":`${o} other running decks share`} with this one — every session recorded in it, not just the ones drawn here`),stays:[o===1?"what that deck shows, until it restarts — then it is gone there too":"what those decks show, until they restart — then it is gone there too"],final:s,confirm:"Clear everything"}}function fre({agentCount:e,onConfirm:t,onCancel:n}){const r=w.useRef(null),s=ft(n,{focusRef:r,layer:Kq}),[o,l]=w.useState(null);w.useEffect(()=>{let p=!1;return fetch("/api/clear").then(g=>g.ok?g.json():null).then(g=>{p||l(ure(g))}).catch(()=>{}),()=>{p=!0}},[]);const{goes:u,stays:d,final:h,confirm:f}=hre(e,o);return a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:s,className:"modal clear-confirm",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{className:"status-dot err","aria-hidden":!0}),a.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsxs("dl",{className:"cc-plan",children:[a.jsx("dt",{children:"Goes"}),a.jsx("dd",{children:u.map(p=>a.jsx("span",{children:p},p))}),a.jsx("dt",{children:"Stays"}),a.jsx("dd",{children:d.length>0?d.map(p=>a.jsx("span",{children:p},p)):a.jsx("span",{children:"nothing"})})]}),h&&a.jsx("p",{className:"cc-final",children:h}),a.jsxs("div",{className:"cc-actions",children:[a.jsx("button",{type:"button",ref:r,className:"btn",onClick:n,children:"Cancel"}),a.jsx("button",{type:"button",className:"btn danger",onClick:t,children:f})]})]})]})})}const eb=[{value:"bug",label:"Bug",question:"What happened?",placeholder:`I was trying to…
|
|
100
|
-
What did you expect to happen?`},{value:"idea",label:"Idea",question:"What would make ccdeck better?",placeholder:"It would be useful if…"},{value:"other",label:"Other",question:"What would you like to tell us?",placeholder:"Write anything…"}];function ZO(e){return eb.find(t=>t.value===e)??eb[0]}const tb=3,Hv=120,pre=1e4,mre=200,gre="Write something first.";function mR(e){return e.trim()!==""}function yre(e){var o;const t=e.trim();if(t==="")return"";const n=gR(t.split(/\r?\n/,1)[0]),r=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,s=Vv(r).length>=tb?Vv(r):Vv(n);return vre(s.length>=tb?s:gR(t))}function wre(e,t){const n=yre(t);return n.length>=tb?n:`${ZO(e).label}: ${n}`}function gR(e){return e.replace(/\s+/g," ").trim()}function Vv(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function vre(e){if(e.length<=Hv)return e;const t=e.slice(0,Hv-1),n=t.lastIndexOf(" ");return`${(n>=Hv/2?t.slice(0,n):t).replace(/[\uD800-\uDBFF]$/,"").replace(/[\s,;:.\-–—]+$/,"")}…`}function xre({kind:e,body:t,contact:n}){const r={kind:e,title:wre(e,t),body:t.trim()};return n.trim()!==""&&(r.contact=n.trim()),r}function bre(e){const t=e;return(t==null?void 0:t.ok)!==!0||typeof t.appVersion!="string"||typeof t.platform!="string"||t.appVersion===""||t.platform===""?null:{appVersion:t.appVersion,platform:t.platform}}const kre={darwin:"macOS",win32:"Windows",linux:"Linux"};function Nre(e){const t=e.indexOf("-"),n=t===-1?e:e.slice(0,t),r=t===-1?"":e.slice(t+1),s=kre[n]??n;return r?`${s} · ${r}`:s}function jre(e){return e?`ccdeck ${e.appVersion} · ${Nre(e.platform)}`:null}const Sre="sent with it",_re="Your ccdeck version and system are sent with it.",Ere="Add details",Cre="How to reach you",Tre="Email or GitHub @name",Are="Only if you would like an answer.",Rre=["It all goes to the people who make ccdeck, with the version and system below.","Nothing becomes public by being sent. They may open a public GitHub issue from it, choosing its title and text; your contact and screenshots are never put on one."];function Mre(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function $re(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function Ire(e){return/mac|iphone|ipad/i.test(e)?["⌘","Enter"]:["Ctrl","Enter"]}function Ore(e){return[...e].length===1}const JO="Thanks — feedback sent.";function yR(e,t,n){if(t==="vetoed")return"This deck was started with AGENTS_DECK_NO_INSTALL=1, which keeps it off the network, so nothing was sent.";if(e===429||t==="too_many")return"Too much feedback from this network in the last hour. Try again later; your text is still here.";if(e===413||t==="too_large")return"The images are too large to send together. Remove one and send again; your text is still here.";const r=n==null?void 0:n.images;return e===400&&Array.isArray(r)&&typeof r[0]=="string"?`The server did not accept an image. ${r[0]} Remove it and send again; your text is still here.`:e===400?"The server did not accept the message. It is still here; check it and send again.":"ccdeck's server could not be reached. Nothing was sent; your text is still here, so try again in a moment."}function Lre(e){return e==="sending"?"Sending…":e==="sent"?JO:""}const wR=1400,Pre=160;function Dre({kind:e,onChange:t}){return a.jsxs("fieldset",{className:"fb-kinds",children:[a.jsx("legend",{className:"vis-hidden",children:"Kind of feedback"}),eb.map(n=>a.jsxs("label",{className:"fb-kind",children:[a.jsx("input",{type:"radio",name:"feedback-kind",value:n.value,checked:e===n.value,onChange:()=>t(n.value)}),n.label]},n.value))]})}const QO="fb-details";function Fre({open:e,onToggle:t}){return a.jsxs("button",{type:"button",className:"fb-tool fb-more","aria-expanded":e,"aria-controls":QO,onClick:t,children:[Ere,a.jsx("svg",{className:"fb-chev",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:"false",children:a.jsx("path",{d:"M2.5 3.75 5 6.25l2.5-2.5"})})]})}function Bre({open:e,contact:t,onContact:n}){const r=w.useId();return a.jsx("div",{id:QO,className:"fb-details","data-open":e||void 0,children:a.jsx("div",{className:"fb-details-clip",children:a.jsxs("div",{className:"fb-details-body",children:[a.jsxs("div",{className:"fb-field",children:[a.jsxs("label",{className:"fb-field-label",htmlFor:"fb-contact",children:[Cre,a.jsx("span",{className:"fb-optional",children:"optional"})]}),a.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:t,maxLength:mre,autoComplete:"email",placeholder:Tre,"aria-describedby":r,onChange:s=>n(s.target.value),onKeyDown:s=>{$re(s.nativeEvent)&&s.preventDefault()}}),a.jsx("p",{id:r,className:"fb-hint",children:Are})]}),a.jsx("div",{className:"fb-where",children:Rre.map(s=>a.jsx("p",{children:s},s))})]})})})}const Go=3,qre=5*1024*1024,Ure=12*1024*1024,nb=8192,zre=64*1024,Wre=256*1024,Hre=.92,Vre=640,eL=.9,Gre=.85,Kre=6,Yre=512*1024,Sd={png:"image/png",jpeg:"image/jpeg"},Xre={png:"png",jpeg:"jpg"},Zre=[137,80,78,71,13,10,26,10],Jre=[255,216,255];function tL(e){const t=n=>e.length>=n.length&&n.every((r,s)=>e[s]===r);return t(Zre)?"png":t(Jre)?"jpeg":null}function Qre(e){const t=tL(e);return t==="png"?ese(e):t==="jpeg"?nse(e):null}function ese(e){const t=[73,72,68,82];if(e.length<24||!t.every((r,s)=>e[12+s]===r))return null;const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:n.getUint32(16),height:n.getUint32(20)}}function tse(e){return e>=192&&e<=207&&e!==196&&e!==200&&e!==204}function nse(e){let t=2;for(;t<e.length;){if(e[t]!==255)return null;for(;t<e.length&&e[t]===255;)t++;const n=e[t++];if(n===void 0||n===217||n===218)return null;if(n===1||n>=208&&n<=215)continue;if(t+2>e.length)return null;const r=e[t]<<8|e[t+1];if(r<2)return null;if(tse(n))return t+7>e.length?null:{height:e[t+3]<<8|e[t+4],width:e[t+5]<<8|e[t+6]};t+=r}return null}function vR(e,t){return e.bytes>t||e.width>nb||e.height>nb}function rse(e){return Math.min(qre,Ure-zre-e)}function nL(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function sse(e,t){const n=nb/Math.max(e.width,e.height),r=e.bytes>t?Math.sqrt(t/e.bytes)*eL:1;return nL(e,Math.min(1,n,r))}async function ase(e,t,n){let r=sse(e,t),s=e.format;for(let o=0;o<Kre;o++){const l=await n(r,s,s==="jpeg"?Hre:void 0);if(!l)return null;if(l.size<=t)return{...r,blob:l,format:s};if(s==="png"){s="jpeg";continue}if(r=nL(r,Math.min(Gre,Math.sqrt(t/l.size)*eL)),Math.max(r.width,r.height)<Vre)return null}return null}async function ose(e,t,n){const r=new Uint8Array(await e.slice(0,Yre).arrayBuffer()),s=tL(r);if(!s)return{ok:!1,problem:"type"};if(t<Wre)return{ok:!1,problem:"no_room"};const o=e.type===Sd[s]?e:new Blob([e],{type:Sd[s]}),l=Qre(r);if(l&&!vR({...l,bytes:e.size},t))return{ok:!0,blob:o,resized:null};const u=await n(e).catch(()=>null);if(!u)return{ok:!1,problem:"unreadable"};try{const d={width:u.width,height:u.height,bytes:e.size,format:s};if(!vR(d,t))return{ok:!0,blob:o,resized:null};const h=await ase(d,t,u.encoder);return h?{ok:!0,blob:h.blob,resized:{width:h.width,height:h.height}}:{ok:!1,problem:"too_large"}}finally{u.release()}}function ise(e){return({width:t,height:n},r,s)=>new Promise(o=>{const l=document.createElement("canvas");l.width=t,l.height=n;const u=l.getContext("2d");if(!u)return o(null);r==="jpeg"&&(u.fillStyle="white",u.fillRect(0,0,t,n)),u.imageSmoothingQuality="high",u.drawImage(e,0,0,t,n),l.toBlob(d=>{l.width=0,l.height=0,o(d)},Sd[r],s)})}const lse=async e=>{const t=await createImageBitmap(e);return{width:t.width,height:t.height,encoder:ise(t),release:()=>t.close()}};function cse(e){return e.includes("Files")}function use({files:e,hasText:t,intoTextField:n}){return e>0&&(!t||!n)}function dse(e,t){const n=e.indexOf(t);return e[n+1]??e[n-1]??null}function hse(e,t){if(t.length===0)return{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)};const n=new FormData;return n.append("kind",e.kind),n.append("title",e.title),n.append("body",e.body),e.contact!==void 0&&n.append("contact",e.contact),t.forEach((r,s)=>{const o=r.type===Sd.jpeg?"jpeg":"png";n.append("images",r,`image-${s+1}.${Xre[o]}`)}),{method:"POST",body:n}}const fse="Add screenshot",xR="PNG or JPEG, up to three. You can also paste one, or drop it on this dialog.",pse="A screenshot can show emails, costs and paths. Crop out what should not be seen.",bR="Three images at most. Remove one to add another.";function mse(e,t,n){const r=n?`, resized to ${n.width} × ${n.height} to fit`:"";return`Replace image ${e+1}: ${t}${r}`}function gse(e,t){const n=`${e} of ${Go}`;return t>0?`${n} · ${t} resized to fit`:n}function yse(e){return`Three images at most, so ${e===1?"one was":`${e} were`} left out.`}function wse(e){return`“${e.length>40?`${e.slice(0,30)}…${e.slice(-9)}`:e}”`}function vse(e,t){const n=wse(t);return e==="type"?`${n} is not a PNG or a JPEG, so it was not added. GIF, WebP and HEIC are not converted; save it as a PNG or a JPEG first.`:e==="no_room"?`There is no room left for ${n}: images go at up to 12 MB in all. Remove one to add it.`:e==="unreadable"?`${n} could not be read as an image.`:`${n} could not be made small enough to send: images go at up to 5 MB each.`}const rL="image/png,image/jpeg";function sL({className:e="fb-glyph"}){return a.jsxs("svg",{className:e,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:"false",children:[a.jsx("rect",{x:"1.8",y:"2.4",width:"10.4",height:"9.2",rx:"1.6"}),a.jsx("circle",{cx:"5",cy:"5.6",r:"1"}),a.jsx("path",{d:"M2.4 10.4 5.5 7.6l2.1 1.8 1.5-1.3 2.5 2.2"})]})}function xse({images:e,buttonRef:t}){const n=w.useRef(null),r=e.shots.length>=Go;return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:xR,"aria-describedby":"fb-attach-hint",onClick:()=>{var s;return r?e.sayFull():(s=n.current)==null?void 0:s.click()},children:[a.jsx(sL,{}),fse]}),a.jsx("span",{id:"fb-attach-hint",hidden:!0,children:xR}),a.jsx("input",{ref:n,type:"file",accept:rL,multiple:!0,hidden:!0,onChange:s=>{e.add(Array.from(s.target.files??[])),s.target.value=""}})]})}function bse({images:e,addRef:t}){const n=w.useRef(new Map),r=w.useRef(null),s=w.useRef(null),o=w.useRef(null),[l,u]=w.useState(null),{shots:d}=e,h=gse(d.length,d.filter(g=>g.resized).length);w.useLayoutEffect(()=>{var g;l!==null&&((g=l==="add"?t.current:n.current.get(l))==null||g.focus(),u(null))},[l,t]),w.useEffect(()=>{var g;e.problem&&((g=r.current)==null||g.scrollIntoView({block:"nearest"}))},[e.problem]);function f(g){u(dse(d.map(v=>v.id),g)??"add"),e.remove(g)}function p(g){var v;o.current=g,(v=s.current)==null||v.click()}return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"vis-hidden",role:"status",children:e.announcement}),a.jsx("input",{ref:s,type:"file",accept:rL,hidden:!0,onChange:g=>{const v=o.current;v!==null&&e.replace(v,Array.from(g.target.files??[])),o.current=null,g.target.value=""}}),d.length>0&&a.jsxs("div",{className:"fb-shots",children:[a.jsxs("div",{className:"fb-shots-row",children:[a.jsx("ul",{className:"fb-shots-list",children:d.map((g,v)=>a.jsxs("li",{className:"fb-shot","data-fitting":g.blob?void 0:!0,children:[a.jsxs("button",{type:"button",className:"fb-shot-pick","aria-label":mse(v,g.name,g.resized),onClick:()=>p(g.id),children:[a.jsx("img",{className:"fb-shot-img",src:g.url,alt:""}),g.blob?a.jsx("span",{className:"fb-shot-cue","aria-hidden":"true",children:"Replace"}):a.jsx("span",{className:"fb-shot-busy","aria-hidden":"true",children:"Resizing…"})]}),a.jsx("button",{ref:k=>{k?n.current.set(g.id,k):n.current.delete(g.id)},type:"button",className:"glyph-btn fb-shot-remove","aria-label":`Remove image ${v+1}`,title:`Remove image ${v+1}`,onClick:()=>f(g.id),children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":!0,focusable:"false",children:a.jsx("path",{d:"M2.5 2.5 7.5 7.5M7.5 2.5 2.5 7.5"})})})]},g.id))}),a.jsx("span",{className:"fb-shots-count",children:h})]}),a.jsx("p",{className:"fb-hint",children:pse})]}),e.problem&&a.jsx("p",{ref:r,className:"fb-error",role:"alert",children:e.problem})]})}function kse(e,t,n){return n?e.map(r=>r.id===t.id?t:r):[...e,t]}function Nse(e,t,n){return n?e.map(r=>r.id===t?n:r):e.filter(r=>r.id!==t)}function jse(){const[e,t]=w.useState([]),[n,r]=w.useState(""),[s,o]=w.useState(""),l=w.useRef([]),u=w.useRef(null),d=w.useRef(1),h=w.useRef(!0),f=w.useCallback(E=>{l.current=E(l.current),t(l.current)},[]);w.useEffect(()=>(h.current=!0,()=>{h.current=!1;for(const E of l.current)URL.revokeObjectURL(E.url)}),[]);const p=w.useCallback(async(E,T)=>{const A=l.current.reduce((M,$)=>{var q;return M+($.id===(T==null?void 0:T.id)?0:((q=$.blob)==null?void 0:q.size)??0)},0),R=(T==null?void 0:T.id)??d.current++,B=URL.createObjectURL(E),P={id:R,name:E.name||"image",url:B,blob:null,resized:null};let D=!1;const O=()=>{D||(D=!0,f(M=>kse(M,P,T!==void 0)))},L=await ose(E,rse(A),async M=>(O(),lse(M))).catch(()=>({ok:!1,problem:"unreadable"})),z=l.current.some(M=>M.id===R);return!h.current||!z&&(D||T)?(URL.revokeObjectURL(B),T&&URL.revokeObjectURL(T.url),""):L.ok?(O(),T&&URL.revokeObjectURL(T.url),f(M=>M.map($=>$.id===R?{...$,blob:L.blob,resized:L.resized}:$)),""):(URL.revokeObjectURL(B),D&&f(M=>Nse(M,R,T)),vse(L.problem,E.name||"image"))},[f]),g=w.useCallback(async E=>{r("");const T=[];let A=0,R=0;for(const P of E){if(!h.current)return;if(l.current.length>=Go){A++;continue}const D=l.current.length,O=await p(P);O&&T.push(O),l.current.length>D&&R++}if(!h.current)return;A>0&&T.push(R===0&&T.length===0?bR:yse(A)),r(T.join(" "));const B=l.current.length;R>0&&o(`${R===1?"Image":`${R} images`} added, ${B} of ${Go}.`)},[p]),v=w.useCallback(async(E,T)=>{r("");const A=l.current.find(P=>P.id===E);if(!A)return g([T]);const R=await p(T,A);if(!h.current)return;r(R);const B=l.current.findIndex(P=>P.id===E);!R&&B!==-1&&o(`Image ${B+1} replaced, ${l.current.length} of ${Go}.`)},[g,p]),k=w.useCallback(E=>{u.current=(u.current??Promise.resolve()).then(E).catch(()=>{})},[]),b=w.useCallback(E=>{E.length>0&&k(()=>g(E))},[g,k]),x=w.useCallback((E,T)=>{const A=T[0];A&&k(()=>v(E,A))},[k,v]),N=w.useCallback(E=>{const T=l.current.find(A=>A.id===E);T&&(URL.revokeObjectURL(T.url),f(A=>A.filter(R=>R.id!==E)),r(""),o(`Image removed, ${l.current.length} of ${Go}.`))},[f]),S=w.useCallback(()=>r(bR),[]),_=w.useCallback(async()=>(await u.current,l.current.flatMap(E=>E.blob?[E.blob]:[])),[]);return{shots:e,problem:n,announcement:s,add:b,replace:x,remove:N,sayFull:S,ready:_}}function Sse(){const[e,t]=w.useState(null);return w.useEffect(()=>{let n=!0;return fetch("/api/feedback").then(r=>r.ok?r.json():null).then(r=>{n&&t(bre(r))}).catch(()=>{}),()=>{n=!1}},[]),e}function _se(e){const[t,n]=w.useState({state:"idle"}),r=w.useRef(!1);async function s(o){if(ir(r.current)){r.current=!0,n({state:"sending"});try{const l=await e.ready(),u=await fetch("/api/feedback",hse(xre(o),l)),d=await u.json().catch(()=>null);n(u.ok&&(d!=null&&d.ok)?{state:"sent"}:{state:"failed",message:yR(u.status,d==null?void 0:d.reason,d==null?void 0:d.errors)})}catch{n({state:"failed",message:yR(0,null)})}finally{r.current=!1}}}return{outcome:t,sending:t.state==="sending",send:s}}function Ese(e,t){const[n,r]=w.useState(!1),s=w.useRef(t);return s.current=t,w.useEffect(()=>{if(!e)return;const o=window.setTimeout(()=>r(!0),wR),l=window.setTimeout(()=>s.current(),wR+Pre);return()=>{window.clearTimeout(o),window.clearTimeout(l)}},[e]),n}function Cse(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function aL({onClose:e,initialKind:t,initialBody:n}){const r=w.useRef(null),s=w.useRef(null),o=w.useRef(null),l=w.useRef(null),u=w.useRef(0),d=ft(e,{focusRef:r}),[h,f]=w.useState(t??"bug"),[p,g]=w.useState(n??""),[v,k]=w.useState(""),[b,x]=w.useState(!1),[N,S]=w.useState(!1),[_,E]=w.useState(!1),T=jse(),A=jre(Sse()),{outcome:R,sending:B,send:P}=_se(T),D=R.state==="sent",O=Ese(D,e),L=ZO(h),z=N&&!mR(p),[M,$]=Ire(Cse());w.useEffect(()=>{var ee,re;const K=l.current;if(!K)return;const Z=K.contains(document.activeElement)||Pr(((ee=document.activeElement)==null?void 0:ee.tagName)??null);K.inert=D,D&&Z&&((re=s.current)==null||re.focus())},[D]);function q(K){var Z;if(K.preventDefault(),!mR(p)){S(!0),(Z=r.current)==null||Z.focus();return}P({kind:h,body:p,contact:v})}const X=!D,H=K=>cse(Array.from(K.dataTransfer.types));function I(K){!H(K)||!X||(K.preventDefault(),u.current++,E(!0))}function W(K){H(K)&&(K.preventDefault(),K.dataTransfer.dropEffect=X?"copy":"none")}function F(K){H(K)&&(u.current=Math.max(0,u.current-1),u.current===0&&E(!1))}function Y(K){H(K)&&(K.preventDefault(),u.current=0,E(!1),X&&T.add(Array.from(K.dataTransfer.files)))}function J(K){K.target!==K.currentTarget||!H(K)||(K.preventDefault(),K.dataTransfer.dropEffect="none")}function V(K){H(K)&&K.preventDefault()}function G(K){if(!X)return;const Z=Array.from(K.clipboardData.files),ee=K.target,re=ee instanceof HTMLTextAreaElement||ee instanceof HTMLInputElement,ue=Array.from(K.clipboardData.types).includes("text/plain");use({files:Z.length,hasText:ue,intoTextField:re})&&(K.preventDefault(),T.add(Z))}return a.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",onDragOver:J,onDrop:V,"data-leaving":O||void 0,children:a.jsxs("div",{ref:d,className:"modal feedback-dialog",onClick:K=>K.stopPropagation(),onDragEnter:I,onDragOver:W,onDragLeave:F,onDrop:Y,onPaste:G,role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"feedback-title",className:"modal-tool-name",children:"Send feedback"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{ref:s,type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsx("p",{className:"vis-hidden",role:"status",children:Lre(R.state)}),a.jsxs("div",{className:"fb-stage",children:[a.jsxs("form",{ref:l,className:"fb-form",onSubmit:q,onKeyDown:K=>{Mre(K.nativeEvent)&&(K.preventDefault(),K.currentTarget.requestSubmit())},noValidate:!0,children:[a.jsxs("section",{className:"modal-body fb-body",children:[a.jsx(Dre,{kind:h,onChange:f}),a.jsxs("div",{className:"fb-compose",children:[a.jsx("label",{className:"fb-label",htmlFor:"fb-body",children:L.question}),a.jsx("textarea",{ref:r,id:"fb-body",className:"ap-manage-input fb-message",value:p,maxLength:pre,rows:5,placeholder:L.placeholder,onChange:K=>g(K.target.value),"aria-invalid":z||void 0,"aria-describedby":z?"fb-body-error":void 0,required:!0}),z&&a.jsx("p",{id:"fb-body-error",className:"fb-error",children:gre}),a.jsx(bse,{images:T,addRef:o}),a.jsxs("div",{className:"fb-tools",children:[a.jsx(xse,{images:T,buttonRef:o}),a.jsx(Fre,{open:b,onToggle:()=>x(K=>!K)})]}),a.jsx(Bre,{open:b,contact:v,onContact:k})]}),a.jsx("p",{className:"fb-facts",children:A?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"fb-facts-value",children:A})," — ",Sre]}):_re}),R.state==="failed"&&a.jsx("p",{className:"fb-error",role:"alert",children:R.message})]}),a.jsxs("div",{className:"fb-foot",children:[a.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[a.jsx("kbd",{"data-symbol":Ore(M)||void 0,children:M}),a.jsx("kbd",{children:$})," to send"]}),a.jsx("button",{type:"button",className:"btn",onClick:e,children:"Cancel"}),a.jsx("button",{type:"submit",className:"btn primary fb-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...Ir(B),children:a.jsxs("span",{className:"fb-send-label",children:[a.jsx("span",{className:"fb-send-idle",children:"Send feedback"}),a.jsx("span",{className:"fb-send-busy",children:"Sending…"})]})})]})]}),D&&a.jsxs("div",{className:"fb-done",children:[a.jsx(dd,{}),a.jsx("p",{className:"fb-done-line",children:JO})]})]}),a.jsx("div",{className:"fb-drop","aria-hidden":"true","data-active":_||void 0,children:a.jsxs("div",{className:"fb-drop-frame",children:[a.jsx(sL,{className:"fb-drop-glyph"}),a.jsx("p",{className:"fb-drop-title",children:"Drop to attach"}),a.jsx("p",{className:"fb-drop-note",children:"PNG or JPEG, up to three"})]})})]})})}const Tse="Press Esc first if a key does nothing.",Ase=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"Z",action:"zoom to the selected agent and its session",binds:["z","Z"]},{cap:"Delete",action:"take the selected card off the board — Undo brings it back",binds:["Delete"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"a card: go to it and its session",binds:[]},{cap:"double-click",action:"a card: its prompt, every tool call, tokens and timing",binds:[]},{cap:"hover",action:"zoomed out, a card's name, state and numbers",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function Rse({onClose:e,onTour:t}){const n=ft(e);return a.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:a.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[t&&a.jsxs("div",{className:"guide-door",children:[a.jsx("span",{children:"Eight pictures of what the deck shows."}),a.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),a.jsx("div",{className:"shortcuts",children:Ase.map(r=>a.jsxs(w.Fragment,{children:[a.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(s=>a.jsxs("div",{className:"sc",children:[a.jsx("kbd",{children:s.cap}),a.jsx("span",{children:s.action})]},`${r.title}:${s.cap}:${s.action}`))]},r.title))}),a.jsx("p",{className:"kh-foot",children:Tse})]})]})})}function Mse(e,t){const n=(e??[]).filter(s=>s&&typeof s.fp=="string"&&!t.has(s.fp));if(!n.length)return{request:null,waiting:0};const r=[...n].sort((s,o)=>(s.at??0)-(o.at??0));return{request:r[0],waiting:r.length-1}}function $se({request:e,waiting:t,busy:n,now:r,onAccept:s,onDecline:o,onLater:l}){const u=w.useRef(null),d=ft(l,{focusRef:u}),h=Qs(n,"accept"),f=Qs(n,"dismiss");return a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:d,className:"modal lan-ask",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title","aria-describedby":"lan-ask-who",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("i",{className:"ap-pulse","aria-hidden":!0}),a.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:l,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsxs("p",{id:"lan-ask-who",className:"lan-ask-who",children:[a.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",a.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",Jb(e.at,r)]}),a.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),a.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",a.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&a.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),a.jsxs("div",{className:"lan-ask-acts",children:[a.jsx("button",{type:"button",ref:u,className:"btn",disabled:f.disabled,"aria-busy":f.busy,onClick:o,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),a.jsx("button",{type:"button",className:"btn primary",disabled:h.disabled,"aria-busy":h.busy,onClick:s,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function Ise({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:r,deferLanPair:s}){const{request:o,waiting:l}=Mse(e,t.current);return o?a.jsx($se,{request:o,waiting:l,busy:n,now:Date.now(),onAccept:()=>void r("accept",o.fp),onDecline:()=>void r("dismiss",o.fp),onLater:()=>s(o.fp)},o.fp):null}function Ose(e,t){return`${e}#${t}`}function Lse(e,{lan:t,now:n,closed:r}){if(t===void 0)return[];const s=[];for(const o of e??[]){const l=o.reauth;if(!l||l.dismissed||o.origin!=="ccdeck_signin")continue;const u=Ose(l.key,l.since);if(r.has(u)||CV(l.key,o.email,t,n))continue;const d=o.email??"";s.push({id:u,key:l.key,since:l.since,num:o.num,email:d,name:d||o.alias||`Account ${o.num}`,alias:d&&o.alias?o.alias:null})}return s}function Pse(e,t){const n=String((t==null?void 0:t.email)??"").trim().toLowerCase();return n?e.filter(r=>r.email.toLowerCase()===n&&((t==null?void 0:t.num)==null||String(r.num)===String(t.num))).map(r=>r.id):[]}function Dse({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function Fse(e){return e===1?"Account needs your attention":"Accounts need your attention"}function Bse(e){return`${e===1?"One Claude account needs":`${e} Claude accounts need`} you to sign in again.`}const qse="Login expired",Use="Until then the deck cannot read its usage or switch to it. Signing in again brings it back — it keeps its slot, its alias and its history.",zse="The account stays marked in the Accounts panel. This will not ask again until it has worked and stopped again.";function Wse({rows:e,onSignIn:t,onLater:n,firstRef:r}){const s=e.length===1?e[0]:null;return a.jsxs("section",{className:"modal-body",children:[s?a.jsxs(a.Fragment,{children:[a.jsxs("p",{id:"reauth-lead",className:"reauth-lead",children:["The Claude login for ",a.jsx("strong",{className:"reauth-name",children:s.name}),s.alias?a.jsxs("span",{className:"reauth-alias",children:[" (",s.alias,")"]}):null," ","has expired and needs a new sign","‑","in."]}),a.jsx("p",{className:"reauth-note",children:Use})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:Bse(e.length)}),a.jsx("ul",{className:"reauth-list",children:e.map((o,l)=>a.jsxs("li",{className:"reauth-row",children:[a.jsxs("span",{className:"reauth-who",title:o.alias?`${o.alias} — ${o.name}`:o.name,children:[o.name,o.alias?a.jsxs("span",{className:"reauth-alias",children:[" ",o.alias]}):null]}),a.jsx("span",{className:"reauth-what",children:qse}),a.jsx("button",{type:"button",className:"btn",ref:l===0?r:void 0,"aria-label":`Sign in again as ${o.name}`,onClick:()=>t(o),children:"Sign in again"})]},o.id))}),a.jsx("p",{className:"reauth-note",children:"Each keeps its slot, its alias and its history."})]}),a.jsxs("div",{className:"reauth-acts",children:[a.jsx("button",{type:"button",className:"btn",title:zse,onClick:n,children:"Not now"}),s&&a.jsx("button",{type:"button",className:"btn primary",ref:r,onClick:()=>t(s),children:"Sign in again"})]})]})}function Hse({rows:e,onSignIn:t,onLater:n}){const r=w.useRef(null),s=ft(n,{focusRef:r});return a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:s,className:"modal reauth-ask",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"reauth-title","aria-describedby":"reauth-lead",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"reauth-title",className:"modal-tool-name",children:Fse(e.length)})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Not now (Esc)",title:"Not now (Esc)",children:"×"})})]}),a.jsx(Wse,{rows:e,onSignIn:t,onLater:n,firstRef:r})]})})}function Vse({rows:e,signingIn:t,signIn:n,signedIn:r,refresh:s,closeSignIn:o,later:l}){const u=w.useRef(!1),d=t!=null||Dse({rows:e.length,ours:u.current,dialogs:Jo.dialogDepth()});return u.current=d,t?a.jsx(W$,{email:t.email||null,onClose:o,onChanged:s,onSignedIn:r}):d?a.jsx(Hse,{rows:e,onSignIn:n,onLater:l},e.length===1?"one":"many"):null}const Gse={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is a","note to the author and never a release."],"//nothing-to-say":["3.23.1","3.23.2","3.23.3","3.23.4","3.26.0","3.26.1","3.26.3","3.26.4","3.26.5","3.27.6","3.27.7","3.28.0","3.28.1","3.29.3","3.29.4","3.29.6","3.29.7","3.29.9","3.33.1","3.35.0","3.35.1","3.36.0","3.36.1"],"3.34.1":[{title:"🗂️ The tray menu stays open while you read it",body:"On Linux the menu behind the tray icon could close by itself while agents were working, often before the row you pressed took the click, so it had to be opened and pressed again. It now changes only when something it says has changed, and stays open while you choose."}],"3.34.0":[{title:"🗺️ The network map shows who you are connected to",body:"Paired decks that are on stand closest to this one, and a light runs along their wires. Paired decks that are away come next, in a colour of their own, with how long they have been gone, and machines that are not paired stand outside in grey. Decks reached over Tailscale sit together in their own shaded slice instead of on dashed wires. Pointing at a deck opens its details beside the map: whether it is there, what to do next if anything, its address and what it runs, and every login the two share, the ones that need a look first."},{title:"🔑 A login that expired everywhere says so",body:`When a shared login expired on this deck and every paired deck that is on held an expired copy too, the row said "Login expired" and waited for a repair that could never come. It now says "Login expired on all online decks". Claude retires a login's other copies each time one machine refreshes it, so shared copies expire together: sign in again on any one machine and the others repair from it on their next round.`},{title:"💬 Send feedback from inside the deck",body:'Appearance settings has a "Send feedback…" button: pick what kind it is, write a title and a few lines, and add a way to reach you if you want an answer. It goes to the people who make ccdeck, who may open a public issue from it, never with your contact in it. If it cannot be sent, the form stays filled in and says why.'}],"3.33.0":[{title:"🪝 Hooks you add in Claude Code are no longer removed",body:"Claude Code's hook editor often files a new hook into the same group as the deck's own. Starting the deck, or uninstalling it, then removed the whole group, and your hook went with it without a word. The deck now takes out only its own command and leaves yours where it was, and the same goes for the old finish-sound hook. `ccdeck --uninstall` also stops the decks that are running, so an update in the background cannot put the hooks back."},{title:"🧵 Resumed Codex sessions show up again",body:"A Codex session picked up with `codex resume`, or one that ran for days, could go dark on the canvas and drop out of the 5-hour and 7-day usage, because the deck only looked in the two newest day folders. It now follows those sessions and counts their tokens. Two Codex sessions in the same folder get different id suffixes, and a `bash -lc` call shows the command it runs."},{title:"🤝 A deck paired by the accept switch brings in less",body:'A deck that paired through the automatic accept switch, and not through an invite, now brings in only the logins you have ticked on this deck, and nothing from it is ticked for sharing onward. Its dialog says "paired automatically — pair by invite to take it". Pairing by invite works as before. A typed address is no longer dropped after one failed round, and the sync port stays the same after a rename.'},{title:"⬆️ Desktop updates install when you expect them",body:'On Windows and Linux a downloaded update now installs when you quit. On a Mac, Quit installs it and the app stays closed. The Linux .deb needs an administrator password to install, so it no longer does that by itself: it waits for "Restart to update" and says a password is coming. "Start at login" now works on Linux, and "Restart ccdeck" stops a deck that has hung.'},{title:"🕵️ Browser Watch waits before it acts, and quits only its own browser",body:"A program's visit is now logged and reacted to once its quiet window has closed, about 16 minutes after it, and not on the first poll, so a visit that is withdrawn no longer quits the browser. On Linux the quit reaction ends only the browser that holds the watched profile; other Chrome channels and headless browsers keep running. When it cannot tell which process that is, it does nothing and says so, which includes a Flatpak Brave."},{title:"🧮 Figures that were off are right",body:`Spend by labelled and workflow subagents counts toward a session's tokens and cost. The Projects report prices 1-hour cache writes the way ccusage does, so its dollars match the Usage panel. After a restart the deck rebuilds its whole event history, where it used to rebuild about a third. On Linux the process list shows what each process is using now, not its lifetime average. A count near a boundary reads "1.00M", and a full quota window says "used up".`},{title:"🔑 The Usage panel's reads answer the deck's own page only",body:"The routes behind the Usage panel (/api/quota, /api/ccusage, /api/codex-usage, /api/codex-quota and /api/cswap-auto) now answer the deck's own page, or a client that sends the deck's token. A script that read them with a plain request gets 401 from this version on. The hook, the desktop app and the `ccdeck` command are not affected."},{title:"🛠️ Smaller fixes you may notice",body:"With the canvas paused, an update no longer restarts the server while an agent is working: it waits until no turn is open. `ccdeck --stop -p4317` stops that one deck. A deck started at login can update itself on Homebrew and nvm setups. Dialogs keep keyboard focus after a button goes away, screen readers hear pairing requests by deck name and the machine panel's readings, dim text is readable in both themes, Windows High Contrast shows what is selected, and below 640px the detail panel opens over the canvas."}],"3.32.2":[{title:"🔒 Self-updates wait until your screen is unlocked",body:"On Linux with GNOME, the app installs an update by itself when you leave it alone, which is often while your screen is locked. GNOME switches the panel's tray off under the lock screen, and a version that started then never showed its icon. The app now waits until you are back before restarting by itself, so its icon comes back with it."}],"3.32.1":[{title:"🔔 The tray icon comes back on Linux",body:"On Linux the app could lose its icon in the panel, after it updated itself or when the panel restarted, and stay without it until it was quit. It now notices within a minute and restarts by itself the next time you are away from its window, the way it installs an update. It does this at most once every six hours, and not again if a restart did not help."},{title:"🔕 A window you closed stays closed after a self-update",body:"When the app restarted by itself to install an update, it opened its window again even if you had closed it, and while that window was open the deck held back its notifications. A window you closed now stays closed."},{title:"🪟 No empty icon when ccdeck is already open",body:'Opening ccdeck again while it was running flashed an empty "…" icon in the Linux panel before bringing the window forward. It now only brings the window forward.'}],"3.32.0":[{title:"🗺️ A map of your network",body:"A new button on the Local network row, and in its view's header, opens a map of every deck around this one. This deck is at the centre and the paired decks that are on stand around it. Further out are the quiet ones, the machines nearby and any deck asking to pair. Wires are solid on your local network and dashed over Tailscale. Pointing at a deck says how it is reached, what it runs and which logins the two share, and pressing it opens that deck's own dialog."}],"3.31.0":[{title:"📊 Account capacity",body:"A gauge button in the accounts panel's header opens Account capacity: how many of your Claude accounts are ready now, what the 5-hour and 7-day windows have left across all of them, and a row for each account with its use, its state (Ready, Limited, Exhausted or Stale) and when it was last read. Each window also says whose reset comes next."},{title:"🚦 Claude and Codex incidents",body:"When Anthropic's or OpenAI's status page reports an incident on something your sessions use, the deck says so in the topbar, the Usage panel and the tray, and every mark links to the status page. A provider with nothing wrong draws nothing."},{title:"↕️ Order your other accounts",body:"The Other accounts row can sort the list by slot, by how full a window is, or by most room, and open every account at once. Both stay as you left them after a reload."},{title:"🔐 A settings folder left by sudo can be given back",body:'On a Mac, running ccdeck once with sudo left its settings folder owned by another user, and every settings change was refused, sharing an account included. The message now offers "give it back": macOS asks for your password, the folder is yours again, and the deck reads its settings back without a restart.'}],"3.30.0":[{title:"🧮 Token counts and costs are no longer doubled",body:"Claude Code writes a reply that has thinking, text and tool calls as several transcript lines, each carrying the whole request's usage. The deck added up every line, so a session's tokens and cost on its card came out close to twice what it was billed, and the context panel counted each part of a reply as its own message. Each request is now counted once. Expect the totals on your cards to come down."},{title:"⏳ Claude's saved limit resets on the Usage panel",body:`When your Claude account has free limit resets to spend ("Reset for free" in Claude's Settings → Usage), the Claude card now says how many there are and when the first one expires, the way the Codex card already did. The deck only reports them; you spend them in Claude's own settings.`},{title:"🔑 LAN invites need the other deck updated",body:`An invite's code is now a long random secret instead of six digits, so nobody else on the network can work it out and pair in your place, and a wrong code is refused by name. An invite made on this version can only be joined from a deck on this version or later: an older deck answers "That is not an invite". Update that deck, or make the invite on the older one and join it here.`},{title:"🔕 AGENTS_DECK_NO_NOTIFY keeps Browser Watch quiet too",body:"A deck started with AGENTS_DECK_NO_NOTIFY=1 still raised a desktop notification for every new Browser Watch finding. It no longer does. The finding is still in the Browser Watch panel and its log, which says why no notification came."},{title:"🛠️ Smaller fixes",body:'Delete removes the card you just clicked. A LAN address you typed stays in the list when a round cannot reach it, and the status line under the LAN switch now agrees with the rows below it. In the desktop app, a dismissed "update is ready" notice stays dismissed after you answer the first-launch question. Sizes read the same in every panel ("1.1 KB"). Faded text stays readable, a keyboard can see the scrollbar, and numbers use a monospaced font on Windows and Linux as well.'}],"3.29.11":[{title:"💲 Claude Sonnet 5.5 has a price",body:`Sessions on Claude Sonnet 5.5 showed "not priced" on the board, and the Projects report could only show a minimum for them. They are now priced at Anthropic's published rate, the same as Sonnet 5: $2 per million input tokens and $10 per million output tokens.`}],"3.29.10":[{title:"💲 Claude Opus 5.5 has a price",body:`Sessions on Claude Opus 5.5 showed "not priced" on the board, and the Projects report counted them as costing nothing, so its totals read far too low. They are now priced at Anthropic's published rate. If a model still has no price, Projects shows its total as a minimum, like $11.19+, and names the model, instead of a total that looks complete.`}],"3.29.8":[{title:"🔁 Removed cards come back when their agent works again",body:"Remove from board is for finished work. If the agent behind a card you removed starts a tool call, gets a new prompt or starts a subagent, the card returns on its own, together with the card it hangs from, and it stays back after a reload. Cards whose agents stay idle stay removed."}],"3.29.1":[{title:"🗂️ One row per project in Projects",body:"The Projects report now counts a session's work under the folder you started it in, the same name its card has on the canvas, instead of adding a row for every folder the agent moved into. The first start after updating re-reads your transcripts once to regroup the report."},{title:"🔔 Tidier custom sounds",body:"Importing a sound, recording one and choosing a spoken voice now sit in compact cards that respond to clicks and focus like the rest of the deck."}],"3.29.0":[{title:"🎵 Your own stations in Claude FM",body:"Add any YouTube live link or radio stream as a station in Appearance, next to the built-in ones, and mute the music without losing your volume. When a station is not live, the picker now says so instead of staying silent."},{title:"🔔 Notification sounds and voices of your own",body:"Pick a local audio file or a spoken voice for each alert, so the sound that means an agent is waiting is one you will recognise."},{title:"🗑️ Drag a card off the board to remove it",body:"Drag a card to the target at the bottom of the canvas to take it off the board, or use Remove from board in the detail panel (Delete). The session keeps running, and the session list (L) brings it back."},{title:"🔐 Optional invite-only pairing",body:"Pairing works as before, with or without an invite. If you want, Local network can now be set to accept only decks that join with an invite you created, so a nearby machine cannot ask to pair on its own."},{title:"🌐 Account sharing between your machines is more reliable",body:"A locked macOS Keychain is explained instead of failing silently, a login that is broken or belongs to another account is never shared, and a sync that stops partway keeps what already arrived."},{title:"📅 Projects opens on Today",body:"The Projects report per account starts with today's work, and an empty window offers the next wider one. The topbar also shows this month's usage, and the desktop app can restart into an update from its own window."}],"3.27.0":[{title:"📊 Projects: where each account spent its work",body:"Each account card's ⋯ menu now breaks its cost down by project, over 7d / 30d / all."}],"3.27.1":[{title:"🎨 Make Appearance easier to tune",body:"The Appearance dialog now has clearer sections, stronger selection states, and a calmer layout for choosing a theme and configuring music. Your existing settings and keyboard shortcuts continue to work."}],"3.27.2":[{title:"💰 Project costs now match Usage",body:"Project cost totals no longer count the same Claude request once for every content block. Existing project history is rebuilt automatically so the totals align with the Usage panel."}],"3.27.3":[{title:"🎵 Station selection works in the desktop app",body:"The music station picker now opens inside ccdeck instead of relying on the operating system popup, so choosing a station works reliably in the Electron app."}],"3.27.4":[{title:"✅ Desktop picker release checks are green",body:"The station picker now keeps the same keyboard, motion, focus, and layout behavior as the rest of ccdeck across desktop and browser builds."}],"3.27.5":[{title:"🧭 The welcome tour stays dismissed",body:"Electron now remembers that you completed the onboarding tour at the deck level, so an update or loopback port change no longer shows the same tour again."},{title:"🎵 The station picker has a clearer finish",body:"The music selector has a tighter trigger, a purposeful chevron, and more deliberate option spacing so it reads like a native part of Appearance."}],"3.25.0":[{title:"🖱️ A click goes to the session, a double-click opens the details",body:"Clicking a card frames it with the rest of its session and leaves the detail panel shut. Double-click a card to open its details; `j`/`k`, the session list, Enter and `D` still open them too."},{title:"🔭 Cards stay readable when you zoom out",body:"At every zoom a card shows its name, its state and anything waiting on you, instead of shrinking to a coloured pill. Hover or focus a card to see it whole. Recap notes read at a distance too, and show the full recap on hover."},{title:"🌐 The Machine panel shows your network",body:"A new Network section shows download, upload and the round trip to Claude's API, and names the route when traffic goes through a VPN or a Tailscale exit node. Those checks run only while the panel is open. The panel is regrouped into CPU, Memory, Network and Thermal, with a flag at the top when something needs attention."},{title:"🎨 See each theme before you pick it",body:"The Appearance menu shows a small preview of the deck in Light and in Dark. Claude FM also keeps its volume when a notification chime plays, instead of dipping under it."}],"3.24.1":[{title:"🎛️ Appearance is one small menu now",body:"The topbar's appearance control opens a compact menu where you can choose Light or Dark and show or hide the character. The character stays on by default, and your choice is remembered."}],"3.24.0":[{title:"🎧 Claude FM plays from the minimap",body:"A small character stands on the minimap's top edge. Press it and the Claude channel's live stream plays; press it again and it stops. It only turns up when the channel is actually broadcasting, so a deck with no network never shows it at all."},{title:"🤠 And it gets on with its day",body:"It walks that edge, tidies up what it finds, kicks a ball along it, sits with its legs over the side, and watches the board through a scope. Now and then it drops onto the canvas and ropes its way back up. Headphones on while the music plays, a hat when it does not."}],"3.23.5":[{title:"🧭 The accounts panel opens on the account you are on",body:"Its windows, its resets and how old the numbers are — whole, at the top of the column. Every other account stands behind one row that says how many of them a switch could actually reach; press it to see them, or rest on it to be shown their names and how much room each has left."},{title:"⚙️ Auto-switch moved in there with them",body:"It is behind that same row now, after the accounts it switches between, rather than at the foot of the panel. The row says `auto 90%` or `auto off` so you can tell what the policy is doing without opening it — and says so in amber when it is armed with nowhere left to go."}],"3.23.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
|
|
100
|
+
What did you expect to happen?`},{value:"idea",label:"Idea",question:"What would make ccdeck better?",placeholder:"It would be useful if…"},{value:"other",label:"Other",question:"What would you like to tell us?",placeholder:"Write anything…"}];function ZO(e){return eb.find(t=>t.value===e)??eb[0]}const tb=3,Hv=120,pre=1e4,mre=200,gre="Write something first.";function mR(e){return e.trim()!==""}function yre(e){var o;const t=e.trim();if(t==="")return"";const n=gR(t.split(/\r?\n/,1)[0]),r=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,s=Vv(r).length>=tb?Vv(r):Vv(n);return vre(s.length>=tb?s:gR(t))}function wre(e,t){const n=yre(t);return n.length>=tb?n:`${ZO(e).label}: ${n}`}function gR(e){return e.replace(/\s+/g," ").trim()}function Vv(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function vre(e){if(e.length<=Hv)return e;const t=e.slice(0,Hv-1),n=t.lastIndexOf(" ");return`${(n>=Hv/2?t.slice(0,n):t).replace(/[\uD800-\uDBFF]$/,"").replace(/[\s,;:.\-–—]+$/,"")}…`}function xre({kind:e,body:t,contact:n}){const r={kind:e,title:wre(e,t),body:t.trim()};return n.trim()!==""&&(r.contact=n.trim()),r}function bre(e){const t=e;return(t==null?void 0:t.ok)!==!0||typeof t.appVersion!="string"||typeof t.platform!="string"||t.appVersion===""||t.platform===""?null:{appVersion:t.appVersion,platform:t.platform}}const kre={darwin:"macOS",win32:"Windows",linux:"Linux"};function Nre(e){const t=e.indexOf("-"),n=t===-1?e:e.slice(0,t),r=t===-1?"":e.slice(t+1),s=kre[n]??n;return r?`${s} · ${r}`:s}function jre(e){return e?`ccdeck ${e.appVersion} · ${Nre(e.platform)}`:null}const Sre="sent with it",_re="Your ccdeck version and system are sent with it.",Ere="Add details",Cre="How to reach you",Tre="Email or GitHub @name",Are="Only if you would like an answer.",Rre=["It all goes to the people who make ccdeck, with the version and system below.","Nothing becomes public by being sent. They may open a public GitHub issue from it, choosing its title and text; your contact and screenshots are never put on one."];function Mre(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function $re(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function Ire(e){return/mac|iphone|ipad/i.test(e)?["⌘","Enter"]:["Ctrl","Enter"]}function Ore(e){return[...e].length===1}const JO="Thanks — feedback sent.";function yR(e,t,n){if(t==="vetoed")return"This deck was started with AGENTS_DECK_NO_INSTALL=1, which keeps it off the network, so nothing was sent.";if(e===429||t==="too_many")return"Too much feedback from this network in the last hour. Try again later; your text is still here.";if(e===413||t==="too_large")return"The images are too large to send together. Remove one and send again; your text is still here.";const r=n==null?void 0:n.images;return e===400&&Array.isArray(r)&&typeof r[0]=="string"?`The server did not accept an image. ${r[0]} Remove it and send again; your text is still here.`:e===400?"The server did not accept the message. It is still here; check it and send again.":"ccdeck's server could not be reached. Nothing was sent; your text is still here, so try again in a moment."}function Lre(e){return e==="sending"?"Sending…":e==="sent"?JO:""}const wR=1400,Pre=160;function Dre({kind:e,onChange:t}){return a.jsxs("fieldset",{className:"fb-kinds",children:[a.jsx("legend",{className:"vis-hidden",children:"Kind of feedback"}),eb.map(n=>a.jsxs("label",{className:"fb-kind",children:[a.jsx("input",{type:"radio",name:"feedback-kind",value:n.value,checked:e===n.value,onChange:()=>t(n.value)}),n.label]},n.value))]})}const QO="fb-details";function Fre({open:e,onToggle:t}){return a.jsxs("button",{type:"button",className:"fb-tool fb-more","aria-expanded":e,"aria-controls":QO,onClick:t,children:[Ere,a.jsx("svg",{className:"fb-chev",width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:"false",children:a.jsx("path",{d:"M2.5 3.75 5 6.25l2.5-2.5"})})]})}function Bre({open:e,contact:t,onContact:n}){const r=w.useId();return a.jsx("div",{id:QO,className:"fb-details","data-open":e||void 0,children:a.jsx("div",{className:"fb-details-clip",children:a.jsxs("div",{className:"fb-details-body",children:[a.jsxs("div",{className:"fb-field",children:[a.jsxs("label",{className:"fb-field-label",htmlFor:"fb-contact",children:[Cre,a.jsx("span",{className:"fb-optional",children:"optional"})]}),a.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:t,maxLength:mre,autoComplete:"email",placeholder:Tre,"aria-describedby":r,onChange:s=>n(s.target.value),onKeyDown:s=>{$re(s.nativeEvent)&&s.preventDefault()}}),a.jsx("p",{id:r,className:"fb-hint",children:Are})]}),a.jsx("div",{className:"fb-where",children:Rre.map(s=>a.jsx("p",{children:s},s))})]})})})}const Go=3,qre=5*1024*1024,Ure=12*1024*1024,nb=8192,zre=64*1024,Wre=256*1024,Hre=.92,Vre=640,eL=.9,Gre=.85,Kre=6,Yre=512*1024,Sd={png:"image/png",jpeg:"image/jpeg"},Xre={png:"png",jpeg:"jpg"},Zre=[137,80,78,71,13,10,26,10],Jre=[255,216,255];function tL(e){const t=n=>e.length>=n.length&&n.every((r,s)=>e[s]===r);return t(Zre)?"png":t(Jre)?"jpeg":null}function Qre(e){const t=tL(e);return t==="png"?ese(e):t==="jpeg"?nse(e):null}function ese(e){const t=[73,72,68,82];if(e.length<24||!t.every((r,s)=>e[12+s]===r))return null;const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:n.getUint32(16),height:n.getUint32(20)}}function tse(e){return e>=192&&e<=207&&e!==196&&e!==200&&e!==204}function nse(e){let t=2;for(;t<e.length;){if(e[t]!==255)return null;for(;t<e.length&&e[t]===255;)t++;const n=e[t++];if(n===void 0||n===217||n===218)return null;if(n===1||n>=208&&n<=215)continue;if(t+2>e.length)return null;const r=e[t]<<8|e[t+1];if(r<2)return null;if(tse(n))return t+7>e.length?null:{height:e[t+3]<<8|e[t+4],width:e[t+5]<<8|e[t+6]};t+=r}return null}function vR(e,t){return e.bytes>t||e.width>nb||e.height>nb}function rse(e){return Math.min(qre,Ure-zre-e)}function nL(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function sse(e,t){const n=nb/Math.max(e.width,e.height),r=e.bytes>t?Math.sqrt(t/e.bytes)*eL:1;return nL(e,Math.min(1,n,r))}async function ase(e,t,n){let r=sse(e,t),s=e.format;for(let o=0;o<Kre;o++){const l=await n(r,s,s==="jpeg"?Hre:void 0);if(!l)return null;if(l.size<=t)return{...r,blob:l,format:s};if(s==="png"){s="jpeg";continue}if(r=nL(r,Math.min(Gre,Math.sqrt(t/l.size)*eL)),Math.max(r.width,r.height)<Vre)return null}return null}async function ose(e,t,n){const r=new Uint8Array(await e.slice(0,Yre).arrayBuffer()),s=tL(r);if(!s)return{ok:!1,problem:"type"};if(t<Wre)return{ok:!1,problem:"no_room"};const o=e.type===Sd[s]?e:new Blob([e],{type:Sd[s]}),l=Qre(r);if(l&&!vR({...l,bytes:e.size},t))return{ok:!0,blob:o,resized:null};const u=await n(e).catch(()=>null);if(!u)return{ok:!1,problem:"unreadable"};try{const d={width:u.width,height:u.height,bytes:e.size,format:s};if(!vR(d,t))return{ok:!0,blob:o,resized:null};const h=await ase(d,t,u.encoder);return h?{ok:!0,blob:h.blob,resized:{width:h.width,height:h.height}}:{ok:!1,problem:"too_large"}}finally{u.release()}}function ise(e){return({width:t,height:n},r,s)=>new Promise(o=>{const l=document.createElement("canvas");l.width=t,l.height=n;const u=l.getContext("2d");if(!u)return o(null);r==="jpeg"&&(u.fillStyle="white",u.fillRect(0,0,t,n)),u.imageSmoothingQuality="high",u.drawImage(e,0,0,t,n),l.toBlob(d=>{l.width=0,l.height=0,o(d)},Sd[r],s)})}const lse=async e=>{const t=await createImageBitmap(e);return{width:t.width,height:t.height,encoder:ise(t),release:()=>t.close()}};function cse(e){return e.includes("Files")}function use({files:e,hasText:t,intoTextField:n}){return e>0&&(!t||!n)}function dse(e,t){const n=e.indexOf(t);return e[n+1]??e[n-1]??null}function hse(e,t){if(t.length===0)return{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)};const n=new FormData;return n.append("kind",e.kind),n.append("title",e.title),n.append("body",e.body),e.contact!==void 0&&n.append("contact",e.contact),t.forEach((r,s)=>{const o=r.type===Sd.jpeg?"jpeg":"png";n.append("images",r,`image-${s+1}.${Xre[o]}`)}),{method:"POST",body:n}}const fse="Add screenshot",xR="PNG or JPEG, up to three. You can also paste one, or drop it on this dialog.",pse="A screenshot can show emails, costs and paths. Crop out what should not be seen.",bR="Three images at most. Remove one to add another.";function mse(e,t,n){const r=n?`, resized to ${n.width} × ${n.height} to fit`:"";return`Replace image ${e+1}: ${t}${r}`}function gse(e,t){const n=`${e} of ${Go}`;return t>0?`${n} · ${t} resized to fit`:n}function yse(e){return`Three images at most, so ${e===1?"one was":`${e} were`} left out.`}function wse(e){return`“${e.length>40?`${e.slice(0,30)}…${e.slice(-9)}`:e}”`}function vse(e,t){const n=wse(t);return e==="type"?`${n} is not a PNG or a JPEG, so it was not added. GIF, WebP and HEIC are not converted; save it as a PNG or a JPEG first.`:e==="no_room"?`There is no room left for ${n}: images go at up to 12 MB in all. Remove one to add it.`:e==="unreadable"?`${n} could not be read as an image.`:`${n} could not be made small enough to send: images go at up to 5 MB each.`}const rL="image/png,image/jpeg";function sL({className:e="fb-glyph"}){return a.jsxs("svg",{className:e,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:"false",children:[a.jsx("rect",{x:"1.8",y:"2.4",width:"10.4",height:"9.2",rx:"1.6"}),a.jsx("circle",{cx:"5",cy:"5.6",r:"1"}),a.jsx("path",{d:"M2.4 10.4 5.5 7.6l2.1 1.8 1.5-1.3 2.5 2.2"})]})}function xse({images:e,buttonRef:t}){const n=w.useRef(null),r=e.shots.length>=Go;return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:xR,"aria-describedby":"fb-attach-hint",onClick:()=>{var s;return r?e.sayFull():(s=n.current)==null?void 0:s.click()},children:[a.jsx(sL,{}),fse]}),a.jsx("span",{id:"fb-attach-hint",hidden:!0,children:xR}),a.jsx("input",{ref:n,type:"file",accept:rL,multiple:!0,hidden:!0,onChange:s=>{e.add(Array.from(s.target.files??[])),s.target.value=""}})]})}function bse({images:e,addRef:t}){const n=w.useRef(new Map),r=w.useRef(null),s=w.useRef(null),o=w.useRef(null),[l,u]=w.useState(null),{shots:d}=e,h=gse(d.length,d.filter(g=>g.resized).length);w.useLayoutEffect(()=>{var g;l!==null&&((g=l==="add"?t.current:n.current.get(l))==null||g.focus(),u(null))},[l,t]),w.useEffect(()=>{var g;e.problem&&((g=r.current)==null||g.scrollIntoView({block:"nearest"}))},[e.problem]);function f(g){u(dse(d.map(v=>v.id),g)??"add"),e.remove(g)}function p(g){var v;o.current=g,(v=s.current)==null||v.click()}return a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"vis-hidden",role:"status",children:e.announcement}),a.jsx("input",{ref:s,type:"file",accept:rL,hidden:!0,onChange:g=>{const v=o.current;v!==null&&e.replace(v,Array.from(g.target.files??[])),o.current=null,g.target.value=""}}),d.length>0&&a.jsxs("div",{className:"fb-shots",children:[a.jsxs("div",{className:"fb-shots-row",children:[a.jsx("ul",{className:"fb-shots-list",children:d.map((g,v)=>a.jsxs("li",{className:"fb-shot","data-fitting":g.blob?void 0:!0,children:[a.jsxs("button",{type:"button",className:"fb-shot-pick","aria-label":mse(v,g.name,g.resized),onClick:()=>p(g.id),children:[a.jsx("img",{className:"fb-shot-img",src:g.url,alt:""}),g.blob?a.jsx("span",{className:"fb-shot-cue","aria-hidden":"true",children:"Replace"}):a.jsx("span",{className:"fb-shot-busy","aria-hidden":"true",children:"Resizing…"})]}),a.jsx("button",{ref:k=>{k?n.current.set(g.id,k):n.current.delete(g.id)},type:"button",className:"glyph-btn fb-shot-remove","aria-label":`Remove image ${v+1}`,title:`Remove image ${v+1}`,onClick:()=>f(g.id),children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":!0,focusable:"false",children:a.jsx("path",{d:"M2.5 2.5 7.5 7.5M7.5 2.5 2.5 7.5"})})})]},g.id))}),a.jsx("span",{className:"fb-shots-count",children:h})]}),a.jsx("p",{className:"fb-hint",children:pse})]}),e.problem&&a.jsx("p",{ref:r,className:"fb-error",role:"alert",children:e.problem})]})}function kse(e,t,n){return n?e.map(r=>r.id===t.id?t:r):[...e,t]}function Nse(e,t,n){return n?e.map(r=>r.id===t?n:r):e.filter(r=>r.id!==t)}function jse(){const[e,t]=w.useState([]),[n,r]=w.useState(""),[s,o]=w.useState(""),l=w.useRef([]),u=w.useRef(null),d=w.useRef(1),h=w.useRef(!0),f=w.useCallback(E=>{l.current=E(l.current),t(l.current)},[]);w.useEffect(()=>(h.current=!0,()=>{h.current=!1;for(const E of l.current)URL.revokeObjectURL(E.url)}),[]);const p=w.useCallback(async(E,T)=>{const A=l.current.reduce((M,$)=>{var q;return M+($.id===(T==null?void 0:T.id)?0:((q=$.blob)==null?void 0:q.size)??0)},0),R=(T==null?void 0:T.id)??d.current++,B=URL.createObjectURL(E),P={id:R,name:E.name||"image",url:B,blob:null,resized:null};let D=!1;const O=()=>{D||(D=!0,f(M=>kse(M,P,T!==void 0)))},L=await ose(E,rse(A),async M=>(O(),lse(M))).catch(()=>({ok:!1,problem:"unreadable"})),z=l.current.some(M=>M.id===R);return!h.current||!z&&(D||T)?(URL.revokeObjectURL(B),T&&URL.revokeObjectURL(T.url),""):L.ok?(O(),T&&URL.revokeObjectURL(T.url),f(M=>M.map($=>$.id===R?{...$,blob:L.blob,resized:L.resized}:$)),""):(URL.revokeObjectURL(B),D&&f(M=>Nse(M,R,T)),vse(L.problem,E.name||"image"))},[f]),g=w.useCallback(async E=>{r("");const T=[];let A=0,R=0;for(const P of E){if(!h.current)return;if(l.current.length>=Go){A++;continue}const D=l.current.length,O=await p(P);O&&T.push(O),l.current.length>D&&R++}if(!h.current)return;A>0&&T.push(R===0&&T.length===0?bR:yse(A)),r(T.join(" "));const B=l.current.length;R>0&&o(`${R===1?"Image":`${R} images`} added, ${B} of ${Go}.`)},[p]),v=w.useCallback(async(E,T)=>{r("");const A=l.current.find(P=>P.id===E);if(!A)return g([T]);const R=await p(T,A);if(!h.current)return;r(R);const B=l.current.findIndex(P=>P.id===E);!R&&B!==-1&&o(`Image ${B+1} replaced, ${l.current.length} of ${Go}.`)},[g,p]),k=w.useCallback(E=>{u.current=(u.current??Promise.resolve()).then(E).catch(()=>{})},[]),b=w.useCallback(E=>{E.length>0&&k(()=>g(E))},[g,k]),x=w.useCallback((E,T)=>{const A=T[0];A&&k(()=>v(E,A))},[k,v]),N=w.useCallback(E=>{const T=l.current.find(A=>A.id===E);T&&(URL.revokeObjectURL(T.url),f(A=>A.filter(R=>R.id!==E)),r(""),o(`Image removed, ${l.current.length} of ${Go}.`))},[f]),S=w.useCallback(()=>r(bR),[]),_=w.useCallback(async()=>(await u.current,l.current.flatMap(E=>E.blob?[E.blob]:[])),[]);return{shots:e,problem:n,announcement:s,add:b,replace:x,remove:N,sayFull:S,ready:_}}function Sse(){const[e,t]=w.useState(null);return w.useEffect(()=>{let n=!0;return fetch("/api/feedback").then(r=>r.ok?r.json():null).then(r=>{n&&t(bre(r))}).catch(()=>{}),()=>{n=!1}},[]),e}function _se(e){const[t,n]=w.useState({state:"idle"}),r=w.useRef(!1);async function s(o){if(ir(r.current)){r.current=!0,n({state:"sending"});try{const l=await e.ready(),u=await fetch("/api/feedback",hse(xre(o),l)),d=await u.json().catch(()=>null);n(u.ok&&(d!=null&&d.ok)?{state:"sent"}:{state:"failed",message:yR(u.status,d==null?void 0:d.reason,d==null?void 0:d.errors)})}catch{n({state:"failed",message:yR(0,null)})}finally{r.current=!1}}}return{outcome:t,sending:t.state==="sending",send:s}}function Ese(e,t){const[n,r]=w.useState(!1),s=w.useRef(t);return s.current=t,w.useEffect(()=>{if(!e)return;const o=window.setTimeout(()=>r(!0),wR),l=window.setTimeout(()=>s.current(),wR+Pre);return()=>{window.clearTimeout(o),window.clearTimeout(l)}},[e]),n}function Cse(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function aL({onClose:e,initialKind:t,initialBody:n}){const r=w.useRef(null),s=w.useRef(null),o=w.useRef(null),l=w.useRef(null),u=w.useRef(0),d=ft(e,{focusRef:r}),[h,f]=w.useState(t??"bug"),[p,g]=w.useState(n??""),[v,k]=w.useState(""),[b,x]=w.useState(!1),[N,S]=w.useState(!1),[_,E]=w.useState(!1),T=jse(),A=jre(Sse()),{outcome:R,sending:B,send:P}=_se(T),D=R.state==="sent",O=Ese(D,e),L=ZO(h),z=N&&!mR(p),[M,$]=Ire(Cse());w.useEffect(()=>{var ee,re;const K=l.current;if(!K)return;const Z=K.contains(document.activeElement)||Pr(((ee=document.activeElement)==null?void 0:ee.tagName)??null);K.inert=D,D&&Z&&((re=s.current)==null||re.focus())},[D]);function q(K){var Z;if(K.preventDefault(),!mR(p)){S(!0),(Z=r.current)==null||Z.focus();return}P({kind:h,body:p,contact:v})}const X=!D,H=K=>cse(Array.from(K.dataTransfer.types));function I(K){!H(K)||!X||(K.preventDefault(),u.current++,E(!0))}function W(K){H(K)&&(K.preventDefault(),K.dataTransfer.dropEffect=X?"copy":"none")}function F(K){H(K)&&(u.current=Math.max(0,u.current-1),u.current===0&&E(!1))}function Y(K){H(K)&&(K.preventDefault(),u.current=0,E(!1),X&&T.add(Array.from(K.dataTransfer.files)))}function J(K){K.target!==K.currentTarget||!H(K)||(K.preventDefault(),K.dataTransfer.dropEffect="none")}function V(K){H(K)&&K.preventDefault()}function G(K){if(!X)return;const Z=Array.from(K.clipboardData.files),ee=K.target,re=ee instanceof HTMLTextAreaElement||ee instanceof HTMLInputElement,ue=Array.from(K.clipboardData.types).includes("text/plain");use({files:Z.length,hasText:ue,intoTextField:re})&&(K.preventDefault(),T.add(Z))}return a.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",onDragOver:J,onDrop:V,"data-leaving":O||void 0,children:a.jsxs("div",{ref:d,className:"modal feedback-dialog",onClick:K=>K.stopPropagation(),onDragEnter:I,onDragOver:W,onDragLeave:F,onDrop:Y,onPaste:G,role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"feedback-title",className:"modal-tool-name",children:"Send feedback"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{ref:s,type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsx("p",{className:"vis-hidden",role:"status",children:Lre(R.state)}),a.jsxs("div",{className:"fb-stage",children:[a.jsxs("form",{ref:l,className:"fb-form",onSubmit:q,onKeyDown:K=>{Mre(K.nativeEvent)&&(K.preventDefault(),K.currentTarget.requestSubmit())},noValidate:!0,children:[a.jsxs("section",{className:"modal-body fb-body",children:[a.jsx(Dre,{kind:h,onChange:f}),a.jsxs("div",{className:"fb-compose",children:[a.jsx("label",{className:"fb-label",htmlFor:"fb-body",children:L.question}),a.jsx("textarea",{ref:r,id:"fb-body",className:"ap-manage-input fb-message",value:p,maxLength:pre,rows:5,placeholder:L.placeholder,onChange:K=>g(K.target.value),"aria-invalid":z||void 0,"aria-describedby":z?"fb-body-error":void 0,required:!0}),z&&a.jsx("p",{id:"fb-body-error",className:"fb-error",children:gre}),a.jsx(bse,{images:T,addRef:o}),a.jsxs("div",{className:"fb-tools",children:[a.jsx(xse,{images:T,buttonRef:o}),a.jsx(Fre,{open:b,onToggle:()=>x(K=>!K)})]}),a.jsx(Bre,{open:b,contact:v,onContact:k})]}),a.jsx("p",{className:"fb-facts",children:A?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"fb-facts-value",children:A})," — ",Sre]}):_re}),R.state==="failed"&&a.jsx("p",{className:"fb-error",role:"alert",children:R.message})]}),a.jsxs("div",{className:"fb-foot",children:[a.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[a.jsx("kbd",{"data-symbol":Ore(M)||void 0,children:M}),a.jsx("kbd",{children:$})," to send"]}),a.jsx("button",{type:"button",className:"btn",onClick:e,children:"Cancel"}),a.jsx("button",{type:"submit",className:"btn primary fb-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...Ir(B),children:a.jsxs("span",{className:"fb-send-label",children:[a.jsx("span",{className:"fb-send-idle",children:"Send feedback"}),a.jsx("span",{className:"fb-send-busy",children:"Sending…"})]})})]})]}),D&&a.jsxs("div",{className:"fb-done",children:[a.jsx(dd,{}),a.jsx("p",{className:"fb-done-line",children:JO})]})]}),a.jsx("div",{className:"fb-drop","aria-hidden":"true","data-active":_||void 0,children:a.jsxs("div",{className:"fb-drop-frame",children:[a.jsx(sL,{className:"fb-drop-glyph"}),a.jsx("p",{className:"fb-drop-title",children:"Drop to attach"}),a.jsx("p",{className:"fb-drop-note",children:"PNG or JPEG, up to three"})]})})]})})}const Tse="Press Esc first if a key does nothing.",Ase=[{title:"Canvas",rows:[{cap:"Space",action:"pause or resume the stream",binds:[" "]},{cap:"J",action:"next agent",binds:["j","J"]},{cap:"K",action:"previous agent",binds:["k","K"]},{cap:"W",action:"the session waiting on you — oldest first, again for the next",binds:["w","W"]},{cap:"F",action:"fit every agent on screen",binds:["f","F"]},{cap:"Z",action:"zoom to the selected agent and its session",binds:["z","Z"]},{cap:"Delete",action:"take the selected card off the board — Undo brings it back",binds:["Delete"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"U",action:"usage panel",binds:["u","U"]},{cap:"L",action:"session list",binds:["l","L"]},{cap:"D",action:"detail panel",binds:["d","D"]},{cap:"H",action:"usage history",binds:["h","H"]},{cap:"A",action:"Claude accounts, where Claude Code is installed",binds:["a","A"]},{cap:"S",action:"this machine — cores, memory, temperature",binds:["s","S"]},{cap:"B",action:"Browser Watch",binds:["b","B"]},{cap:"V",action:"the sound menu — volume, tones, notifications",binds:["v","V"]},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"light or dark theme",binds:["t","T"]}]},{title:"Focus and selection",rows:[{cap:"Tab",action:"reach the agent cards",binds:[]},{cap:"Enter",action:"select the focused card",binds:["Enter"]},{cap:"Shift + Enter",action:"add the focused card to the selection",binds:["Enter"]},{cap:"Esc",action:"close what is open, deselect, release focus",binds:["Escape"]}]},{title:"Mouse",rows:[{cap:"drag",action:"move a node, and pin it where you dropped it",binds:[]},{cap:"shift-click",action:"add an agent to the selection",binds:[]},{cap:"click",action:"a card: go to it and its session",binds:[]},{cap:"double-click",action:"a card: its prompt, every tool call, tokens and timing",binds:[]},{cap:"hover",action:"zoomed out, a card's name, state and numbers",binds:[]},{cap:"click",action:"the topbar speaker opens volume and sound settings",binds:[]}]}];function Rse({onClose:e,onTour:t}){const n=ft(e);return a.jsx("div",{className:"modal-backdrop",onClick:e,role:"presentation",children:a.jsxs("div",{ref:n,className:"modal key-help",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[t&&a.jsxs("div",{className:"guide-door",children:[a.jsx("span",{children:"Eight pictures of what the deck shows."}),a.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),a.jsx("div",{className:"shortcuts",children:Ase.map(r=>a.jsxs(w.Fragment,{children:[a.jsx("h3",{className:"kh-group",children:r.title}),r.rows.map(s=>a.jsxs("div",{className:"sc",children:[a.jsx("kbd",{children:s.cap}),a.jsx("span",{children:s.action})]},`${r.title}:${s.cap}:${s.action}`))]},r.title))}),a.jsx("p",{className:"kh-foot",children:Tse})]})]})})}function Mse(e,t){const n=(e??[]).filter(s=>s&&typeof s.fp=="string"&&!t.has(s.fp));if(!n.length)return{request:null,waiting:0};const r=[...n].sort((s,o)=>(s.at??0)-(o.at??0));return{request:r[0],waiting:r.length-1}}function $se({request:e,waiting:t,busy:n,now:r,onAccept:s,onDecline:o,onLater:l}){const u=w.useRef(null),d=ft(l,{focusRef:u}),h=Qs(n,"accept"),f=Qs(n,"dismiss");return a.jsx("div",{className:"modal-backdrop",onClick:l,role:"presentation",children:a.jsxs("div",{ref:d,className:"modal lan-ask",onClick:p=>p.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title","aria-describedby":"lan-ask-who",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("i",{className:"ap-pulse","aria-hidden":!0}),a.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:l,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),a.jsxs("section",{className:"modal-body",children:[a.jsxs("p",{id:"lan-ask-who",className:"lan-ask-who",children:[a.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",a.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",Jb(e.at,r)]}),a.jsx("p",{className:"modal-note",children:"Paired decks repair each other's expired logins. Accept only if you know this machine — what it shares is an account, not a screen."}),a.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",a.jsx("code",{className:"ap-lan-code",children:e.fp})," — that machine shows its own under This deck on the network; the two should match."]}),t>0&&a.jsx("p",{className:"lan-ask-more",children:t===1?"One more deck is waiting behind this one.":`${t} more decks are waiting behind this one.`}),a.jsxs("div",{className:"lan-ask-acts",children:[a.jsx("button",{type:"button",ref:u,className:"btn",disabled:f.disabled,"aria-busy":f.busy,onClick:o,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),a.jsx("button",{type:"button",className:"btn primary",disabled:h.disabled,"aria-busy":h.busy,onClick:s,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function Ise({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:r,deferLanPair:s}){const{request:o,waiting:l}=Mse(e,t.current);return o?a.jsx($se,{request:o,waiting:l,busy:n,now:Date.now(),onAccept:()=>void r("accept",o.fp),onDecline:()=>void r("dismiss",o.fp),onLater:()=>s(o.fp)},o.fp):null}function Ose(e,t){return`${e}#${t}`}function Lse(e,{lan:t,now:n,closed:r}){if(t===void 0)return[];const s=[];for(const o of e??[]){const l=o.reauth;if(!l||l.dismissed||o.origin!=="ccdeck_signin")continue;const u=Ose(l.key,l.since);if(r.has(u)||CV(l.key,o.email,t,n))continue;const d=o.email??"";s.push({id:u,key:l.key,since:l.since,num:o.num,email:d,name:d||o.alias||`Account ${o.num}`,alias:d&&o.alias?o.alias:null})}return s}function Pse(e,t){const n=String((t==null?void 0:t.email)??"").trim().toLowerCase();return n?e.filter(r=>r.email.toLowerCase()===n&&((t==null?void 0:t.num)==null||String(r.num)===String(t.num))).map(r=>r.id):[]}function Dse({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function Fse(e){return e===1?"Account needs your attention":"Accounts need your attention"}function Bse(e){return`${e===1?"One Claude account needs":`${e} Claude accounts need`} you to sign in again.`}const qse="Login expired",Use="Until then the deck cannot read its usage or switch to it. Signing in again brings it back — it keeps its slot, its alias and its history.",zse="The account stays marked in the Accounts panel. This will not ask again until it has worked and stopped again.";function Wse({rows:e,onSignIn:t,onLater:n,firstRef:r}){const s=e.length===1?e[0]:null;return a.jsxs("section",{className:"modal-body",children:[s?a.jsxs(a.Fragment,{children:[a.jsxs("p",{id:"reauth-lead",className:"reauth-lead",children:["The Claude login for ",a.jsx("strong",{className:"reauth-name",children:s.name}),s.alias?a.jsxs("span",{className:"reauth-alias",children:[" (",s.alias,")"]}):null," ","has expired and needs a new sign","‑","in."]}),a.jsx("p",{className:"reauth-note",children:Use})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:Bse(e.length)}),a.jsx("ul",{className:"reauth-list",children:e.map((o,l)=>a.jsxs("li",{className:"reauth-row",children:[a.jsxs("span",{className:"reauth-who",title:o.alias?`${o.alias} — ${o.name}`:o.name,children:[o.name,o.alias?a.jsxs("span",{className:"reauth-alias",children:[" ",o.alias]}):null]}),a.jsx("span",{className:"reauth-what",children:qse}),a.jsx("button",{type:"button",className:"btn",ref:l===0?r:void 0,"aria-label":`Sign in again as ${o.name}`,onClick:()=>t(o),children:"Sign in again"})]},o.id))}),a.jsx("p",{className:"reauth-note",children:"Each keeps its slot, its alias and its history."})]}),a.jsxs("div",{className:"reauth-acts",children:[a.jsx("button",{type:"button",className:"btn",title:zse,onClick:n,children:"Not now"}),s&&a.jsx("button",{type:"button",className:"btn primary",ref:r,onClick:()=>t(s),children:"Sign in again"})]})]})}function Hse({rows:e,onSignIn:t,onLater:n}){const r=w.useRef(null),s=ft(n,{focusRef:r});return a.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:a.jsxs("div",{ref:s,className:"modal reauth-ask",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"reauth-title","aria-describedby":"reauth-lead",children:[a.jsxs("header",{className:"modal-head",children:[a.jsx("div",{className:"modal-title",children:a.jsx("span",{id:"reauth-title",className:"modal-tool-name",children:Fse(e.length)})}),a.jsx("div",{className:"modal-actions",children:a.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Not now (Esc)",title:"Not now (Esc)",children:"×"})})]}),a.jsx(Wse,{rows:e,onSignIn:t,onLater:n,firstRef:r})]})})}function Vse({rows:e,signingIn:t,signIn:n,signedIn:r,refresh:s,closeSignIn:o,later:l}){const u=w.useRef(!1),d=t!=null||Dse({rows:e.length,ours:u.current,dialogs:Jo.dialogDepth()});return u.current=d,t?a.jsx(W$,{email:t.email||null,onClose:o,onChanged:s,onSignedIn:r}):d?a.jsx(Hse,{rows:e,onSignIn:n,onLater:l},e.length===1?"one":"many"):null}const Gse={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is a","note to the author and never a release."],"//nothing-to-say":["3.23.1","3.23.2","3.23.3","3.23.4","3.26.0","3.26.1","3.26.3","3.26.4","3.26.5","3.27.6","3.27.7","3.28.0","3.28.1","3.29.3","3.29.4","3.29.6","3.29.7","3.29.9","3.33.1","3.35.0","3.35.1","3.36.0","3.36.1"],"3.36.3":[{title:"🔑 An expired login asks to be signed in again",body:"When an account you added with + → Sign in stops working, the deck now tells you in one dialog, with every affected account together and Sign in again beside each. That opens the usual sign-in with the address already filled in, and the account keeps its slot, its alias and its history. Not now leaves it marked in the Accounts panel and does not ask again until it has worked and stopped again. A paired deck holding a working copy gets to repair it first, and accounts that came from a share or Local network are never asked about."}],"3.34.1":[{title:"🗂️ The tray menu stays open while you read it",body:"On Linux the menu behind the tray icon could close by itself while agents were working, often before the row you pressed took the click, so it had to be opened and pressed again. It now changes only when something it says has changed, and stays open while you choose."}],"3.34.0":[{title:"🗺️ The network map shows who you are connected to",body:"Paired decks that are on stand closest to this one, and a light runs along their wires. Paired decks that are away come next, in a colour of their own, with how long they have been gone, and machines that are not paired stand outside in grey. Decks reached over Tailscale sit together in their own shaded slice instead of on dashed wires. Pointing at a deck opens its details beside the map: whether it is there, what to do next if anything, its address and what it runs, and every login the two share, the ones that need a look first."},{title:"🔑 A login that expired everywhere says so",body:`When a shared login expired on this deck and every paired deck that is on held an expired copy too, the row said "Login expired" and waited for a repair that could never come. It now says "Login expired on all online decks". Claude retires a login's other copies each time one machine refreshes it, so shared copies expire together: sign in again on any one machine and the others repair from it on their next round.`},{title:"💬 Send feedback from inside the deck",body:'Appearance settings has a "Send feedback…" button: pick what kind it is, write a title and a few lines, and add a way to reach you if you want an answer. It goes to the people who make ccdeck, who may open a public issue from it, never with your contact in it. If it cannot be sent, the form stays filled in and says why.'}],"3.33.0":[{title:"🪝 Hooks you add in Claude Code are no longer removed",body:"Claude Code's hook editor often files a new hook into the same group as the deck's own. Starting the deck, or uninstalling it, then removed the whole group, and your hook went with it without a word. The deck now takes out only its own command and leaves yours where it was, and the same goes for the old finish-sound hook. `ccdeck --uninstall` also stops the decks that are running, so an update in the background cannot put the hooks back."},{title:"🧵 Resumed Codex sessions show up again",body:"A Codex session picked up with `codex resume`, or one that ran for days, could go dark on the canvas and drop out of the 5-hour and 7-day usage, because the deck only looked in the two newest day folders. It now follows those sessions and counts their tokens. Two Codex sessions in the same folder get different id suffixes, and a `bash -lc` call shows the command it runs."},{title:"🤝 A deck paired by the accept switch brings in less",body:'A deck that paired through the automatic accept switch, and not through an invite, now brings in only the logins you have ticked on this deck, and nothing from it is ticked for sharing onward. Its dialog says "paired automatically — pair by invite to take it". Pairing by invite works as before. A typed address is no longer dropped after one failed round, and the sync port stays the same after a rename.'},{title:"⬆️ Desktop updates install when you expect them",body:'On Windows and Linux a downloaded update now installs when you quit. On a Mac, Quit installs it and the app stays closed. The Linux .deb needs an administrator password to install, so it no longer does that by itself: it waits for "Restart to update" and says a password is coming. "Start at login" now works on Linux, and "Restart ccdeck" stops a deck that has hung.'},{title:"🕵️ Browser Watch waits before it acts, and quits only its own browser",body:"A program's visit is now logged and reacted to once its quiet window has closed, about 16 minutes after it, and not on the first poll, so a visit that is withdrawn no longer quits the browser. On Linux the quit reaction ends only the browser that holds the watched profile; other Chrome channels and headless browsers keep running. When it cannot tell which process that is, it does nothing and says so, which includes a Flatpak Brave."},{title:"🧮 Figures that were off are right",body:`Spend by labelled and workflow subagents counts toward a session's tokens and cost. The Projects report prices 1-hour cache writes the way ccusage does, so its dollars match the Usage panel. After a restart the deck rebuilds its whole event history, where it used to rebuild about a third. On Linux the process list shows what each process is using now, not its lifetime average. A count near a boundary reads "1.00M", and a full quota window says "used up".`},{title:"🔑 The Usage panel's reads answer the deck's own page only",body:"The routes behind the Usage panel (/api/quota, /api/ccusage, /api/codex-usage, /api/codex-quota and /api/cswap-auto) now answer the deck's own page, or a client that sends the deck's token. A script that read them with a plain request gets 401 from this version on. The hook, the desktop app and the `ccdeck` command are not affected."},{title:"🛠️ Smaller fixes you may notice",body:"With the canvas paused, an update no longer restarts the server while an agent is working: it waits until no turn is open. `ccdeck --stop -p4317` stops that one deck. A deck started at login can update itself on Homebrew and nvm setups. Dialogs keep keyboard focus after a button goes away, screen readers hear pairing requests by deck name and the machine panel's readings, dim text is readable in both themes, Windows High Contrast shows what is selected, and below 640px the detail panel opens over the canvas."}],"3.32.2":[{title:"🔒 Self-updates wait until your screen is unlocked",body:"On Linux with GNOME, the app installs an update by itself when you leave it alone, which is often while your screen is locked. GNOME switches the panel's tray off under the lock screen, and a version that started then never showed its icon. The app now waits until you are back before restarting by itself, so its icon comes back with it."}],"3.32.1":[{title:"🔔 The tray icon comes back on Linux",body:"On Linux the app could lose its icon in the panel, after it updated itself or when the panel restarted, and stay without it until it was quit. It now notices within a minute and restarts by itself the next time you are away from its window, the way it installs an update. It does this at most once every six hours, and not again if a restart did not help."},{title:"🔕 A window you closed stays closed after a self-update",body:"When the app restarted by itself to install an update, it opened its window again even if you had closed it, and while that window was open the deck held back its notifications. A window you closed now stays closed."},{title:"🪟 No empty icon when ccdeck is already open",body:'Opening ccdeck again while it was running flashed an empty "…" icon in the Linux panel before bringing the window forward. It now only brings the window forward.'}],"3.32.0":[{title:"🗺️ A map of your network",body:"A new button on the Local network row, and in its view's header, opens a map of every deck around this one. This deck is at the centre and the paired decks that are on stand around it. Further out are the quiet ones, the machines nearby and any deck asking to pair. Wires are solid on your local network and dashed over Tailscale. Pointing at a deck says how it is reached, what it runs and which logins the two share, and pressing it opens that deck's own dialog."}],"3.31.0":[{title:"📊 Account capacity",body:"A gauge button in the accounts panel's header opens Account capacity: how many of your Claude accounts are ready now, what the 5-hour and 7-day windows have left across all of them, and a row for each account with its use, its state (Ready, Limited, Exhausted or Stale) and when it was last read. Each window also says whose reset comes next."},{title:"🚦 Claude and Codex incidents",body:"When Anthropic's or OpenAI's status page reports an incident on something your sessions use, the deck says so in the topbar, the Usage panel and the tray, and every mark links to the status page. A provider with nothing wrong draws nothing."},{title:"↕️ Order your other accounts",body:"The Other accounts row can sort the list by slot, by how full a window is, or by most room, and open every account at once. Both stay as you left them after a reload."},{title:"🔐 A settings folder left by sudo can be given back",body:'On a Mac, running ccdeck once with sudo left its settings folder owned by another user, and every settings change was refused, sharing an account included. The message now offers "give it back": macOS asks for your password, the folder is yours again, and the deck reads its settings back without a restart.'}],"3.30.0":[{title:"🧮 Token counts and costs are no longer doubled",body:"Claude Code writes a reply that has thinking, text and tool calls as several transcript lines, each carrying the whole request's usage. The deck added up every line, so a session's tokens and cost on its card came out close to twice what it was billed, and the context panel counted each part of a reply as its own message. Each request is now counted once. Expect the totals on your cards to come down."},{title:"⏳ Claude's saved limit resets on the Usage panel",body:`When your Claude account has free limit resets to spend ("Reset for free" in Claude's Settings → Usage), the Claude card now says how many there are and when the first one expires, the way the Codex card already did. The deck only reports them; you spend them in Claude's own settings.`},{title:"🔑 LAN invites need the other deck updated",body:`An invite's code is now a long random secret instead of six digits, so nobody else on the network can work it out and pair in your place, and a wrong code is refused by name. An invite made on this version can only be joined from a deck on this version or later: an older deck answers "That is not an invite". Update that deck, or make the invite on the older one and join it here.`},{title:"🔕 AGENTS_DECK_NO_NOTIFY keeps Browser Watch quiet too",body:"A deck started with AGENTS_DECK_NO_NOTIFY=1 still raised a desktop notification for every new Browser Watch finding. It no longer does. The finding is still in the Browser Watch panel and its log, which says why no notification came."},{title:"🛠️ Smaller fixes",body:'Delete removes the card you just clicked. A LAN address you typed stays in the list when a round cannot reach it, and the status line under the LAN switch now agrees with the rows below it. In the desktop app, a dismissed "update is ready" notice stays dismissed after you answer the first-launch question. Sizes read the same in every panel ("1.1 KB"). Faded text stays readable, a keyboard can see the scrollbar, and numbers use a monospaced font on Windows and Linux as well.'}],"3.29.11":[{title:"💲 Claude Sonnet 5.5 has a price",body:`Sessions on Claude Sonnet 5.5 showed "not priced" on the board, and the Projects report could only show a minimum for them. They are now priced at Anthropic's published rate, the same as Sonnet 5: $2 per million input tokens and $10 per million output tokens.`}],"3.29.10":[{title:"💲 Claude Opus 5.5 has a price",body:`Sessions on Claude Opus 5.5 showed "not priced" on the board, and the Projects report counted them as costing nothing, so its totals read far too low. They are now priced at Anthropic's published rate. If a model still has no price, Projects shows its total as a minimum, like $11.19+, and names the model, instead of a total that looks complete.`}],"3.29.8":[{title:"🔁 Removed cards come back when their agent works again",body:"Remove from board is for finished work. If the agent behind a card you removed starts a tool call, gets a new prompt or starts a subagent, the card returns on its own, together with the card it hangs from, and it stays back after a reload. Cards whose agents stay idle stay removed."}],"3.29.1":[{title:"🗂️ One row per project in Projects",body:"The Projects report now counts a session's work under the folder you started it in, the same name its card has on the canvas, instead of adding a row for every folder the agent moved into. The first start after updating re-reads your transcripts once to regroup the report."},{title:"🔔 Tidier custom sounds",body:"Importing a sound, recording one and choosing a spoken voice now sit in compact cards that respond to clicks and focus like the rest of the deck."}],"3.29.0":[{title:"🎵 Your own stations in Claude FM",body:"Add any YouTube live link or radio stream as a station in Appearance, next to the built-in ones, and mute the music without losing your volume. When a station is not live, the picker now says so instead of staying silent."},{title:"🔔 Notification sounds and voices of your own",body:"Pick a local audio file or a spoken voice for each alert, so the sound that means an agent is waiting is one you will recognise."},{title:"🗑️ Drag a card off the board to remove it",body:"Drag a card to the target at the bottom of the canvas to take it off the board, or use Remove from board in the detail panel (Delete). The session keeps running, and the session list (L) brings it back."},{title:"🔐 Optional invite-only pairing",body:"Pairing works as before, with or without an invite. If you want, Local network can now be set to accept only decks that join with an invite you created, so a nearby machine cannot ask to pair on its own."},{title:"🌐 Account sharing between your machines is more reliable",body:"A locked macOS Keychain is explained instead of failing silently, a login that is broken or belongs to another account is never shared, and a sync that stops partway keeps what already arrived."},{title:"📅 Projects opens on Today",body:"The Projects report per account starts with today's work, and an empty window offers the next wider one. The topbar also shows this month's usage, and the desktop app can restart into an update from its own window."}],"3.27.0":[{title:"📊 Projects: where each account spent its work",body:"Each account card's ⋯ menu now breaks its cost down by project, over 7d / 30d / all."}],"3.27.1":[{title:"🎨 Make Appearance easier to tune",body:"The Appearance dialog now has clearer sections, stronger selection states, and a calmer layout for choosing a theme and configuring music. Your existing settings and keyboard shortcuts continue to work."}],"3.27.2":[{title:"💰 Project costs now match Usage",body:"Project cost totals no longer count the same Claude request once for every content block. Existing project history is rebuilt automatically so the totals align with the Usage panel."}],"3.27.3":[{title:"🎵 Station selection works in the desktop app",body:"The music station picker now opens inside ccdeck instead of relying on the operating system popup, so choosing a station works reliably in the Electron app."}],"3.27.4":[{title:"✅ Desktop picker release checks are green",body:"The station picker now keeps the same keyboard, motion, focus, and layout behavior as the rest of ccdeck across desktop and browser builds."}],"3.27.5":[{title:"🧭 The welcome tour stays dismissed",body:"Electron now remembers that you completed the onboarding tour at the deck level, so an update or loopback port change no longer shows the same tour again."},{title:"🎵 The station picker has a clearer finish",body:"The music selector has a tighter trigger, a purposeful chevron, and more deliberate option spacing so it reads like a native part of Appearance."}],"3.25.0":[{title:"🖱️ A click goes to the session, a double-click opens the details",body:"Clicking a card frames it with the rest of its session and leaves the detail panel shut. Double-click a card to open its details; `j`/`k`, the session list, Enter and `D` still open them too."},{title:"🔭 Cards stay readable when you zoom out",body:"At every zoom a card shows its name, its state and anything waiting on you, instead of shrinking to a coloured pill. Hover or focus a card to see it whole. Recap notes read at a distance too, and show the full recap on hover."},{title:"🌐 The Machine panel shows your network",body:"A new Network section shows download, upload and the round trip to Claude's API, and names the route when traffic goes through a VPN or a Tailscale exit node. Those checks run only while the panel is open. The panel is regrouped into CPU, Memory, Network and Thermal, with a flag at the top when something needs attention."},{title:"🎨 See each theme before you pick it",body:"The Appearance menu shows a small preview of the deck in Light and in Dark. Claude FM also keeps its volume when a notification chime plays, instead of dipping under it."}],"3.24.1":[{title:"🎛️ Appearance is one small menu now",body:"The topbar's appearance control opens a compact menu where you can choose Light or Dark and show or hide the character. The character stays on by default, and your choice is remembered."}],"3.24.0":[{title:"🎧 Claude FM plays from the minimap",body:"A small character stands on the minimap's top edge. Press it and the Claude channel's live stream plays; press it again and it stops. It only turns up when the channel is actually broadcasting, so a deck with no network never shows it at all."},{title:"🤠 And it gets on with its day",body:"It walks that edge, tidies up what it finds, kicks a ball along it, sits with its legs over the side, and watches the board through a scope. Now and then it drops onto the canvas and ropes its way back up. Headphones on while the music plays, a hat when it does not."}],"3.23.5":[{title:"🧭 The accounts panel opens on the account you are on",body:"Its windows, its resets and how old the numbers are — whole, at the top of the column. Every other account stands behind one row that says how many of them a switch could actually reach; press it to see them, or rest on it to be shown their names and how much room each has left."},{title:"⚙️ Auto-switch moved in there with them",body:"It is behind that same row now, after the accounts it switches between, rather than at the foot of the panel. The row says `auto 90%` or `auto off` so you can tell what the policy is doing without opening it — and says so in amber when it is armed with nowhere left to go."}],"3.23.0":[{title:"🧭 The accounts column leads with accounts",body:`The live account is the open row: its windows as bars, when each one resets, and how old the numbers are. Every other account rests on the two figures a switch is decided by, and opens with a click when you want the rest.
|
|
101
101
|
|
|
102
102
|
A problem stays on the row — an expired login, one that was never stored, a keychain the deck cannot open — with the reason and the sign-in one press away. Auto-switch is one row now: its threshold and its switch. Local network moved out of the column into a view of its own, reached from a row at the foot that says how many of the paired machines are on right now, and shows which ones when you hover it.`},{title:"💬 A resting session shows Claude Code's recap beside its card",body:"When a session stops, Claude Code's own recap of what it did is drawn beside the card — so a board you come back to says what happened without opening anything."},{title:"🪟 The chrome went quiet",body:`The topbar is borderless, one set of corners runs through the app, the canvas ground is flat, and the minimap, the zoom controls, the type filter and the Machine and Usage panels read as tooling rather than as cards.
|
|
103
103
|
|
|
@@ -299,8 +299,8 @@ Nothing was added to the card and nothing new is polled. The deck already reads
|
|
|
299
299
|
`).map(n=>({text:`+ ${n}`,tone:"add"}))]}function yae(e){if(!Array.isArray(e)||e.length===0)return null;const t=[];for(const n of e){if(!Lr(n)||!Array.isArray(n.lines))return null;t.push({text:`@@ -${n.oldStart},${n.oldLines} +${n.newStart},${n.newLines} @@`,tone:"ctx"});for(const r of n.lines){const s=String(r);t.push(s.startsWith("+")?{text:s,tone:"add"}:s.startsWith("-")?{text:s,tone:"del"}:{text:s})}}return t}function jR(e){if(typeof e=="string")return[Jt(void 0,e)];if(!Lr(e))return[Jt(void 0,Ua(e))];const t=[],n=yn(e.type);n==="create"&&t.push(wn("result","created the file"));const r=yae(e.structuredPatch);return r&&t.push(dL("applied",r)),e.userModified===!0&&t.push(wn("note","the user changed it before it was applied")),t.length?t:[wn("result",n==="update"?"updated the file":"done")]}function wae(e){const t=typeof e.offset=="number"?e.offset:null,n=typeof e.limit=="number"?e.limit:null;if(t==null&&n==null)return null;const r=t??1;return n!=null?`${r}–${r+n-1}`:`from ${r}`}function vae(e){if(typeof e=="string")return[Jt(void 0,e)];const t=Lr(e)&&Lr(e.file)?e.file:null,n=yn(t==null?void 0:t.content);if(t&&n!=null){const s=[],o=Number(t.numLines),l=Number(t.totalLines),u=Number(t.startLine);return Number.isFinite(o)&&Number.isFinite(l)&&l>0&&s.push(wn("lines",o>=l?`all ${l}`:Number.isFinite(u)?`${u}–${u+o-1} of ${l}`:`${o} of ${l}`)),s.push(Jt("content",n)),s}const r=Lr(e)?yn(e.type):null;return r&&r!=="text"?[wn("result",`${/^[aeiou]/i.test(r)?"an":"a"} ${r} file`)]:[Jt(void 0,Ua(e))]}function xae(e){if(typeof e=="string")return[Jt("output",e)];if(!Lr(e))return[Jt(void 0,Ua(e))];const t=yn(e.stdout),n=yn(e.stderr);if(t==null&&n==null)return[Jt(void 0,Ua(e))];const r=[];return t&&r.push(Jt("output",t.replace(/\n$/,""))),n&&r.push(Jt("errors",n.replace(/\n$/,""),!0)),e.interrupted===!0&&r.push(wn("note","interrupted before it finished")),r.length?r:[wn("output","none")]}function bae(e,t,n){const r=Lr(t)?t:null;if(r&&(e==="Edit"||e==="MultiEdit")){const s=yn(r.file_path),o=(e==="MultiEdit"?Array.isArray(r.edits)?r.edits:[]:[r]).filter(Lr).filter(l=>yn(l.old_string)!=null&&yn(l.new_string)!=null);if(s&&o.length){const l=[wn("file",s)];return o.forEach((u,d)=>{const h=u.replace_all===!0?", every occurrence":"";l.push(dL(o.length>1?`change ${d+1}${h}`:`change${h}`,gae(u.old_string,u.new_string)))}),{input:l,response:jR(n)}}}if(r&&e==="Write"){const s=yn(r.file_path),o=yn(r.content);if(s&&o!=null)return{input:[wn("file",s),Jt("content",o)],response:jR(n)}}if(r&&e==="Read"){const s=yn(r.file_path);if(s){const o=wae(r);return{input:o?[wn("file",s),wn("lines",o)]:[wn("file",s)],response:vae(n)}}}if(r&&e==="Bash"){const s=yn(r.command);if(s!=null){const o=yn(r.description);return{input:o?[Jt("command",s),wn("why",o)]:[Jt("command",s)],response:xae(n)}}}return{input:[Jt(void 0,Ua(t))],response:[Jt(void 0,Ua(n))]}}function SR(e,t,n){if(n==null)return"";if(typeof n=="string")return n;if(Lr(n)){if(e==="Bash"&&t==="input"&&typeof n.command=="string")return n.command;if(e==="Bash"&&t==="response"&&(typeof n.stdout=="string"||typeof n.stderr=="string"))return[n.stdout,n.stderr].filter(r=>typeof r=="string"&&r!=="").join(`
|
|
300
300
|
`);if(e==="Read"&&t==="response"&&Lr(n.file)&&typeof n.file.content=="string")return n.file.content}try{return JSON.stringify(n,null,2)??String(n)}catch{return String(n)}}function kae({tool:e,onClose:t}){const n=ft(t),r=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=e.input??e.inputPreview,o=e.response??e.errorPreview,l=bae(e.name,s,o);return a.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:a.jsxs("div",{ref:n,className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[a.jsxs("header",{className:"modal-head",children:[a.jsxs("div",{className:"modal-title",children:[a.jsx("span",{className:`status-dot ${r}`,"aria-hidden":!0}),a.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),a.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),a.jsxs("div",{className:"modal-actions",children:[a.jsx("span",{className:"modal-dur",children:RM(e,"in-flight…")}),a.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),a.jsxs("section",{className:"modal-body",children:[e.trimmed&&a.jsx("div",{className:"modal-section",children:a.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("div",{className:"tm-head",children:[a.jsx("h4",{children:"Input"}),a.jsx(ER,{text:SR(e.name,"input",s),what:"input"})]}),l.input.map((u,d)=>a.jsx(_R,{block:u},d))]}),a.jsxs("div",{className:"modal-section",children:[a.jsxs("div",{className:"tm-head",children:[a.jsxs("h4",{children:["Response ",r==="err"&&a.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&a.jsx(ER,{text:SR(e.name,"response",o),what:"response"})]}),e.endedAt==null?a.jsx("pre",{children:"(waiting…)"}):l.response.map((u,d)=>a.jsx(_R,{block:u},d))]})]})]})})}const Nae={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function _R({block:e}){const[t,n]=w.useState(!1);if(e.inline)return a.jsxs("p",{className:"tm-inline",children:[e.label&&a.jsx("span",{className:"tm-label",children:e.label}),a.jsx("code",{children:e.text})]});const r=pae(e),{shown:s}=uL(r,t),o=mae(r,t);return a.jsxs("div",{className:"tm-block",children:[e.label&&a.jsx("span",{className:"tm-label",children:e.label}),a.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?s.map((l,u)=>a.jsxs("span",{className:l.tone?Nae[l.tone]:void 0,children:[l.text,u<s.length-1?`
|
|
301
301
|
`:""]},u)):s.map(l=>l.text).join(`
|
|
302
|
-
`)}),o&&a.jsx("button",{type:"button",className:"btn tm-more","aria-expanded":o.expanded,onClick:()=>n(l=>!l),children:o.label})]})}function ER({text:e,what:t}){const[n,r]=w.useState(!1),s=w.useRef(!0);return w.useEffect(()=>()=>{s.current=!1},[]),a.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void Wa(e).then(o=>{!o||!s.current||(r(!0),window.setTimeout(()=>{s.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const jae=w.lazy(()=>Fb(()=>import("./UsageHistoryModal-
|
|
302
|
+
`)}),o&&a.jsx("button",{type:"button",className:"btn tm-more","aria-expanded":o.expanded,onClick:()=>n(l=>!l),children:o.label})]})}function ER({text:e,what:t}){const[n,r]=w.useState(!1),s=w.useRef(!0);return w.useEffect(()=>()=>{s.current=!1},[]),a.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void Wa(e).then(o=>{!o||!s.current||(r(!0),window.setTimeout(()=>{s.current&&r(!1)},1600))}),children:n?"copied":"copy"})}const jae=w.lazy(()=>Fb(()=>import("./UsageHistoryModal-ClT1-0hN.js"),[])),Sae=w.lazy(()=>Fb(()=>import("./BrowserWatchModal-BJKk2x-P.js"),[]));function _ae({dialogs:e,welcome:t,desktopUpdate:n,versionCheck:r,restart:s,lanPairs:o,attention:l,clearFlow:u,watchBadge:d,announcements:h,appearance:f,providers:p,stateRef:g,agentCount:v}){const{openedTool:k,setOpenedToolKey:b,usageHistoryOpen:x,setUsageHistoryOpen:N,browserWatchOpen:S,setBrowserWatchOpen:_,contextAgent:E,setContextFor:T,summaryFor:A,setSummaryFor:R,keyHelpOpen:B,setKeyHelpOpen:P,feedbackOpen:D,setFeedbackOpen:O,feedbackPrefill:L,setFeedbackPrefill:z}=e,{tourOpen:M,openTour:$,closeTour:q,releaseNotes:X,closeReleaseNotes:H,chipVersion:I}=t,{desktopUpdateRestarting:W,desktopUpdateFailure:F,readyAppUpdate:Y,askDesktopUpdateRestart:J}=n,{version:V}=r,{askRestart:G}=s,{clearConfirmOpen:K,setClearConfirmOpen:Z,requestClear:ee}=u,{setWatchOn:re,markWatchSeen:ue}=d,{setWatchSaid:me}=h,{palette:ae}=f;return a.jsxs(a.Fragment,{children:[k&&a.jsx(kae,{tool:k,onClose:()=>b(null)}),x&&a.jsx(w.Suspense,{fallback:null,children:a.jsx(jae,{providers:p,onClose:()=>N(!1)})}),S&&a.jsx(w.Suspense,{fallback:null,children:a.jsx(Sae,{onClose:()=>_(!1),onSeen:pe=>{me(""),ue(pe)},onWatching:re,palette:ae})}),E&&a.jsx(f8,{agent:E,onClose:()=>T(null)}),D&&a.jsx(aL,{initialKind:L==null?void 0:L.initialKind,initialBody:L==null?void 0:L.initialBody,onClose:()=>{O(!1),z(null)}}),A&&a.jsx(uae,{state:g.current,sessionId:A,onClose:()=>R(null)}),X&&a.jsx(cae,{entries:X.entries,since:X.since,firstRun:X.firstRun,running:I,onClose:H,onTour:()=>{H(),$()},updateVersion:Y==null?void 0:Y.version,updateBusy:W,updateFailure:F&&(!Y||Y.version===F.version)?Mne(F.failure,F.version):void 0,onUpdateRestart:Y?()=>{J(Y.version)}:void 0,onRestart:!Y&&(V!=null&&V.canRestart)?()=>{H(),G()}:void 0}),a.jsx(Ise,{...o}),a.jsx(Vse,{...l}),B&&a.jsx(Rse,{onClose:()=>P(!1),onTour:()=>{P(!1),$()}}),M&&a.jsx(Z$,{title:"What the deck shows you",steps:KV,onClose:q}),K&&a.jsx(fre,{agentCount:v,onConfirm:()=>ee("confirmation"),onCancel:()=>Z(!1)})]})}const Eae=10,hL=500,fL=4e3,Cae=[/ResizeObserver loop/i,/^Script error\.?$/i];function CR(e){return String(e??"").replace(/\/(?:home|Users)\/[^/\s:'"]+/g,"~").replace(/[A-Za-z]:\\(?:Users|Documents and Settings)\\[^\\\r\n:'"]+/gi,"~").replace(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,"<email>").replace(/\b(?:sk-ant-[A-Za-z0-9_-]{8,}|sk-[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{20,}|xox[abpr]-[A-Za-z0-9-]{10,}|eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}|[A-Fa-f0-9]{40,}|[A-Za-z0-9+_=-]{48,})/g,"<secret>")}const pL=e=>{fetch("/api/client-error",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),keepalive:!0}).catch(()=>{})};function Tae(e,t,n=pL){const r=String(e??"").slice(0,hL).trim();r&&n({message:r,stack:typeof t=="string"?t.slice(0,fL):void 0})}function Aae(e,t=window,n=pL){let r=0;const s=new Set,o=(d,h)=>{const f=String(d??"").slice(0,hL).trim();!e()||!f||r>=Eae||s.has(f)||Cae.some(p=>p.test(f))||(s.add(f),r++,n({message:f,stack:typeof h=="string"?h.slice(0,fL):void 0}))},l=d=>{var h,f;return o(((h=d.error)==null?void 0:h.message)??d.message,(f=d.error)==null?void 0:f.stack)},u=d=>typeof d.reason=="object"&&d.reason!==null?o(d.reason.message,d.reason.stack):o(d.reason,void 0);return t.addEventListener("error",l),t.addEventListener("unhandledrejection",u),()=>{t.removeEventListener("error",l),t.removeEventListener("unhandledrejection",u)}}const Rae=12;function Mae(e,t){const n=[CR(e).trim()||"The deck threw an error with no message."],r=t==null?void 0:t.trim();if(r){const s=r.split(`
|
|
303
303
|
`).slice(0,Rae).join(`
|
|
304
304
|
`);n.push("",CR(s).trim())}return n.join(`
|
|
305
305
|
`)}class $ae extends w.Component{constructor(){super(...arguments);U1(this,"state",{error:null,componentStack:null,reportOpen:!1})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("ccdeck hit a render error it could not draw past",n,r.componentStack),this.setState({componentStack:r.componentStack??null}),Tae(n.message,n.stack)}render(){const{error:n,componentStack:r,reportOpen:s}=this.state;return n?a.jsxs("div",{className:"error-fallback",role:"alert",children:[a.jsxs("div",{className:"error-fallback-card",children:[a.jsx("p",{className:"error-fallback-title",children:"Something went wrong"}),a.jsx("p",{className:"error-fallback-note",children:"The deck hit an error it could not draw past. Reloading usually clears it — and if it keeps happening, a report tells the people who make ccdeck what broke."}),a.jsxs("div",{className:"error-fallback-actions",children:[a.jsx("button",{type:"button",className:"btn primary",onClick:()=>window.location.reload(),children:"Reload"}),a.jsx("button",{type:"button",className:"btn",onClick:()=>this.setState({reportOpen:!0}),"aria-haspopup":"dialog",children:"Send report"})]})]}),s&&a.jsx(aL,{initialKind:"bug",initialBody:Mae(n.message,r),onClose:()=>this.setState({reportOpen:!1})})]}):this.props.children}}const Iae=1e3;function Oae(e={}){const t=Math.max(1,Math.floor(e.limit??Iae)),n=e.protect;let r=!1,s=[],o=new Set,l=0,u=0,d=null;return{get paused(){return r},get size(){return s.length},get dropped(){return l},get overflowed(){return l>0},get through(){return u},accept(h){const f=typeof(h==null?void 0:h.seq)=="number"?h.seq:null,p=(h==null?void 0:h.epoch)??null,g=p!==null&&p!==d;g&&(d=p,u=0);const v=f!==null&&!g&&f<=u;if(f!==null&&f>u&&(u=f),!r)return!0;if(v)return!1;if(s.push(h),n!=null&&n(h)&&o.add(h),s.length>t){let k=0;if(o.size<s.length)for(;o.has(s[k]);)k++;const[b]=s.splice(k,1);o.delete(b),l++}return!1},setPaused(h){if(r=h,h)return[];const f=s;return s=[],o=new Set,l=0,f}}}function Lae(e){const t=w.useState(()=>Oae({protect:o=>UB(e.current,o)}))[0],[n,r]=w.useState(!1),s=w.useCallback(()=>{const o=t.paused&&t.dropped>0,l=t.setPaused(!t.paused);o&&wq(e.current);for(const u of l)e.current=NM(e.current,u);r(t.paused)},[t,e]);return{pauseGate:t,paused:n,togglePause:s}}const rb={kind:"assumed",claude:!0,codex:!0};function Pae(e){if(!e||typeof e!="object")return rb;const t=e.providers;if(!t||typeof t!="object")return rb;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function Dae(e){const[t,n]=w.useState(null),[r,s]=w.useState(rb);w.useEffect(()=>{let l=!1;return fetch("/api/health").then(u=>u.ok?u.json():null).then(u=>{l||(s(Pae(u)),!(!u||typeof u.workspace!="string")&&n(u.workspace))}).catch(()=>{}),()=>{l=!0}},[e]);const o=xn(r);return{workspace:t,providers:r,providersRef:o}}const mL=3*6e4,Fae=2e4;function Bae({fetchReport:e,visible:t,now:n,onReport:r}){let s=0,o=!0;const l=async()=>{if(!t())return;const u=await e();!o||!u||(s=n(),r(u))};return{tick:l,wake:async()=>{t()&&n()-s>=mL&&await l()},stop:()=>{o=!1}}}async function qae(){try{const e=await fetch("/api/provider-status",{signal:AbortSignal.timeout(Fae)});return e.ok?await e.json():null}catch{return null}}function Uae(e){const[t,n]=w.useState(null);return w.useEffect(()=>{if(!e){n(null);return}const r=Bae({fetchReport:qae,visible:()=>document.visibilityState==="visible",now:()=>Date.now(),onReport:n});r.tick();const s=window.setInterval(r.tick,mL),o=()=>{r.wake()};return document.addEventListener("visibilitychange",o),()=>{r.stop(),window.clearInterval(s),document.removeEventListener("visibilitychange",o)}},[e]),t}const zae={degraded:"degraded performance",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},Wae={degraded:"degraded",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},Hae={degraded:"degraded",partial_outage:"outage",major_outage:"outage",maintenance:"maint."},Vae={claude:"Claude",codex:"Codex"},Gae=new Set(["status.claude.com","status.openai.com"]),Kae=30*6e4,Yae=10*6e4;function Xae(e){if(typeof e!="string")return null;try{const t=new URL(e);return t.protocol==="https:"&&Gae.has(t.hostname)?t:null}catch{return null}}function TR(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})}function Zae(e){const t=Math.floor(e/6e4);return t<1?"just now":t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`}function Jae(e,t){if(!e||typeof e!="object")return null;const n=Ot(zae,e.state),r=Ot(Vae,e.provider);if(!n||!r||typeof e.checkedAt!="number"||t-e.checkedAt>Kae)return null;const s=Xae(e.statusPageUrl);if(!s)return null;const o=Array.isArray(e.components)?e.components:[],l=e.stale===!0||t-e.checkedAt>Yae,u=[`${r}: ${n}${e.summary?` — ${e.summary}`:""}`,o.length>0?`Affected: ${o.join(", ")}`:null,e.scope==="page"?`The page's overall status: it names none of ${r}'s components`:null,l?`Last read from ${s.hostname} at ${TR(e.checkedAt)}; this is the last thing it said`:`Reported by ${s.hostname}, checked ${Zae(t-e.checkedAt)}`,"Opens the status page"],d=l?TR(e.checkedAt):null;return{provider:e.provider,state:e.state,name:r,label:`${r} · ${n}${d?` · as of ${d}`:""}`,words:n,chipWords:Ot(Wae,e.state)??n,shortWords:Ot(Hae,e.state)??n,asOf:d,what:e.summary||(o.length>0?o.join(", "):null),href:s.href,host:s.hostname,stale:l,detail:u.filter(Boolean).join(`
|
|
306
|
-
`)}}function Qae(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>Jae(n,t)).filter(n=>n!==null)}function eoe(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const toe="The providers' status pages report no incident.";function noe({version:e,loadVersion:t}){var h;const[n,r]=w.useState(!1),s=((h=e==null?void 0:e.upgrade)==null?void 0:h.state)??"idle",o=tre(e==null?void 0:e.upgrade),l=w.useRef(!1),u=w.useCallback(async()=>{if(ir(l.current||s==="running")){l.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),l.current=!1}},[s,t]);w.useEffect(()=>{if(s!=="running")return;const f=window.setInterval(t,3e3);return()=>window.clearInterval(f)},[s,t]);const d=w.useCallback(async()=>{const f=e==null?void 0:e.command;!f||!await Wa(f)||(r(!0),window.setTimeout(()=>r(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:s,upgradeFailure:o,startUpgrade:u,copyCommand:d,cmdCopied:n}}const AR="agent-dag.browserWatch.seenMs";function roe(e,t){return e.filter(n=>n.startMs>t)}function soe(){const[e,t]=w.useState(()=>Number(et(AR))||0),[n,r]=w.useState([]),[s,o]=w.useState(!1);w.useEffect(()=>{let d=!0;const h=()=>{fetch("/api/browser-watch?live=0").then(p=>p.ok?p.json():null).then(p=>{var g;!d||!(p!=null&&p.ok)||(r(p.episodes??[]),o(((g=p.settings)==null?void 0:g.enabled)===!0))}).catch(()=>{})};h();const f=setInterval(h,5*6e4);return()=>{d=!1,clearInterval(f)}},[]);const l=w.useMemo(()=>roe(n,e).length,[n,e]),u=w.useCallback(d=>{t(d),Xe(AR,String(d))},[]);return{watchOn:s,setWatchOn:o,watchUnseen:l,markWatchSeen:u}}const gL=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function RR(e){const t={};for(const n of gL)t[n]=e(n);return t}function aoe(e){return t=>e[t]??""}function ooe(e,t){return gL.every(n=>e[n]===t[n])}const yL="agent-dag.theme";function ioe(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function loe(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function coe(){return ioe(et(yL),loe())}function MR(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function uoe(){const[e,t]=w.useState(coe),[n,r]=w.useState(Xte),[s,o]=w.useState(()=>RR(MR)),l=w.useMemo(()=>aoe(s),[s]),u=w.useCallback(d=>ete(d,l),[l]);return w.useEffect(()=>{document.documentElement.dataset.theme=e,Xe(yL,e),o(d=>{const h=RR(MR);return ooe(d,h)?d:h})},[e]),w.useEffect(()=>{Xe(VO,n?"1":"0")},[n]),w.useEffect(()=>{const d=document.querySelector('meta[name="theme-color"]'),h=s["--panel"];d&&h&&d.setAttribute("content",h)},[s]),{theme:e,setTheme:t,characterEnabled:n,setCharacterEnabled:r,palette:s,minimapNodeFill:u}}function doe(e){const t=w.useRef(null),[n,r]=w.useState(!1),[s,o]=w.useState(()=>new Set),l=w.useMemo(()=>{const d=new Set;for(const h of e.current.agents.values())for(const f of h.tools)d.add(WO(f.name));return Object.keys(zO).filter(h=>d.has(h))},[e.current,e.current.revision]);w.useEffect(()=>{if(l.length<=1){r(!1);return}let d=0;const h=()=>{const f=t.current;if(f&&!document.hidden){const p=f.getBoundingClientRect(),g=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(k=>k.getBoundingClientRect()),v=Wee(p,g,8);r(k=>k===v?k:v)}d=window.setTimeout(h,300)};return h(),()=>window.clearTimeout(d)},[l.length]);const u=w.useCallback(d=>{o(h=>{const f=new Set(h);return f.has(d)?f.delete(d):f.add(d),f})},[]);return{presentCats:l,hiddenCats:s,toggleCat:u,catBarRef:t,catBarOccluded:n}}function hoe(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null;const r=()=>e.enabled()?(n==null?void 0:n.state)==="running"?"ready":"locked":"off",s=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,r())};function o(){var f,p;if(!(!t||(n==null?void 0:n.state)==="running"))try{n||(n=new t,(f=n.addEventListener)==null||f.call(n,"statechange",s)),(p=n.resume)==null||p.call(n).then(s,()=>{}),s()}catch{}}function l(f,p,g=p.figure){if(!n||n.state!=="running")return!1;const v=zx(f,g),k=tX(p.level,v),b=n.currentTime;for(const x of v.notes){const N=n.createOscillator(),S=n.createGain();N.type=v.type??"sine",N.frequency.value=x.hz;const _=b+x.at,E=_+x.ms/1e3;S.gain.setValueAtTime(RS,_),S.gain.exponentialRampToValueAtTime(k,_+nX),S.gain.exponentialRampToValueAtTime(RS,E),N.connect(S).connect(n.destination),N.start(_),N.stop(E+.02)}return!0}async function u(f,p){if(!e.loadCustom)return"unavailable";let g;try{g=await e.loadCustom(f)}catch{return"unavailable"}if(!g)return"missing";if(g.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const k=new SpeechSynthesisUtterance(g.text),b=window.speechSynthesis.getVoices();k.voice=b.find(x=>x.voiceURI===g.voiceURI)??null,k.rate=g.rate,k.pitch=g.pitch,k.volume=rX(p.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(k),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let v;try{v=await n.decodeAudioData(g.bytes.slice(0))}catch{return"broken"}try{const k=n.createBufferSource(),b=n.createGain();return k.buffer=v,b.gain.setValueAtTime(sX(g.normalizationGain,p.level),n.currentTime),k.connect(b).connect(n.destination),k.start(n.currentTime),"played"}catch{return"unavailable"}}function d(f,p=!1){var k,b;if(!p&&!e.enabled())return!1;const g=dX((k=e.prefs)==null?void 0:k.call(e),f),v=((b=e.customSelection)==null?void 0:b.call(e)[f])??null;return v&&e.loadCustom?(u(v,g).then(x=>{var N;x==="played"||x==="locked"||((x==="missing"||x==="broken")&&((N=e.onCustomFailure)==null||N.call(e,f,v)),l(f,{...g,figure:vn},vn))}),!0):!n||n.state!=="running"?!1:l(f,g)}function h(f,p=qa){return u(f,{level:hi(p),figure:vn}),!0}return{unlock:o,play:d,previewCustom:h,state:r,get context(){return n}}}function foe({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:r,fallbackCustomRef:s}){const[o,l]=w.useState("locked");return w.useEffect(()=>{const u=hoe({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>r.current,loadCustom:XY,onCustomFailure:(p,g)=>s.current(p,g),onState:l});e.current=u,l(u.state());const d=["pointerdown","pointerup","keydown"],h=()=>{for(const p of d)window.removeEventListener(p,f,{capture:!0})},f=()=>{var p;u.unlock(),((p=u.context)==null?void 0:p.state)==="running"&&h()};for(const p of d)window.addEventListener(p,f,{capture:!0});return h},[]),{chimeState:o}}function poe(){const[e,t]=w.useState(Jte),[n,r]=w.useState(()=>fB(et(HN))),[s,o]=w.useState(()=>hB(et(VN))),[l,u]=w.useState(()=>pB(et(aR),n,Kte)),[d,h]=w.useState(()=>new Set),[f,p]=w.useState(0);w.useEffect(()=>{Xe(GO,String(e))},[e]),w.useEffect(()=>{Xe(VN,s?"1":"0")},[s]),w.useEffect(()=>{Xe(HN,JSON.stringify(n))},[n]),w.useEffect(()=>{Xe(aR,l)},[l]);const g=w.useCallback(N=>{r(S=>S.some(_=>_.id===N.id)?S:[...S,N]),h(S=>{if(!S.has(N.id))return S;const _=new Set(S);return _.delete(N.id),_})},[]),v=w.useCallback((N,S)=>{const _=S.trim();!_||_.length>Ll||r(E=>E.map(T=>T.id===N?{...T,name:_}:T))},[]),k=w.useCallback(N=>{r(S=>S.filter(_=>_.id!==N)),u(S=>mB(S,N)),h(S=>{if(!S.has(N))return S;const _=new Set(S);return _.delete(N),_})},[]),b=w.useCallback(N=>{const S=GN(N),_=d.has(S);N===l&&!_||(_&&h(E=>{const T=new Set(E);return T.delete(S),T}),u(N),p(E=>E+1))},[l,d]),x=w.useCallback((N,S)=>{const _=GN(N);h(E=>{if(E.has(_)===S)return E;const A=new Set(E);return S?A.add(_):A.delete(_),A})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:s,setFmMuted:o,fmSource:l,customFmStations:n,unavailableFmStations:d,fmPlayRequest:f,addFmStation:g,renameFmStation:v,removeFmStation:k,pickFmSource:b,markFmStationAvailability:x}}function moe(e){const[t,n]=w.useState(null),[r,s]=w.useState(!1),[o,l]=w.useState(null),u=w.useRef(0);w.useEffect(()=>{if(!e||!Yl())return;let k=!1;const b=u.current;return fetch("/api/desktop-update").then(x=>x.ok?x.json():null).then(x=>{if(k||u.current!==b)return;const N=hR(x);N&&n(N)}).catch(()=>{}),()=>{k=!0}},[e]);const d=Ene(t),h=w.useRef(!1),f=w.useRef(0),p=w.useRef(0);w.useEffect(()=>()=>window.clearTimeout(f.current),[]);const g=w.useCallback(async k=>{if(!ir(h.current))return;const b=++p.current;window.clearTimeout(f.current),h.current=!0,s(!0),l(null);const x=N=>{b===p.current&&(window.clearTimeout(f.current),h.current=!1,s(!1),l({failure:N,version:k}))};try{const N=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:k})});if(!N.ok)return x(Rne(await N.json().catch(()=>null)))}catch{return x("unreachable")}b===p.current&&(f.current=window.setTimeout(()=>x("timeout"),KO))},[]),v=w.useCallback(k=>{if(Yl())try{const b=hR(JSON.parse(k));b&&(u.current++,n(b),b.status!=="ready"&&(p.current++,window.clearTimeout(f.current),h.current=!1,s(!1)))}catch{}},[]);return{desktopUpdateRestarting:r,desktopUpdateFailure:o,readyAppUpdate:d,askDesktopUpdateRestart:g,onDesktopUpdateEvent:v}}const $u="agent-dag.autoRestart",$R="agent-dag.bundleReloadedFor";function goe({now:e,stateRef:t,version:n,notice:r,noticeOpen:s,upgradeFailure:o,paused:l}){const[u,d]=w.useState(()=>et($u)!=="0"),h=w.useRef(!1),f=w.useCallback(()=>{const D=!u;h.current=!0,cs($u),d(D),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:D})}).then(O=>O.ok?O.json():null).then(O=>{var L;O!=null&&O.ok&&d(((L=O.prefs)==null?void 0:L.autoUpdate)!==!1)}).catch(()=>{})},[u]),[p,g]=w.useState(!1),[v,k]=w.useState("restart"),[b,x]=w.useState(null),N=w.useRef(!1),S=w.useRef(null),_=w.useRef(0),E=w.useRef(null),T=w.useCallback(async D=>{if(!ir(N.current))return;const O=(D==null?void 0:D.upgrade)===!0,L=(D==null?void 0:D.whenIdle)===!0;N.current=!0,S.current=o;const z=++_.current,M=()=>{k(O?"npx":"restart"),g(!0)};L||M();try{window.sessionStorage.setItem("agent-dag.restartPending",(r==null?void 0:r.to)??"")}catch{}let $=!1;try{const q=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L?{upgrade:O,whenIdle:L}:{upgrade:O})});$=L&&q.status===409}catch{}if($){N.current=!1,E.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}L&&M(),window.setTimeout(()=>{if(_.current===z&&N.current){N.current=!1,g(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},O?18e4:3e4)},[r==null?void 0:r.to,o]);w.useEffect(()=>{const D=fR(t.current.agents.values())>0,O=ore({enabled:u,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:D,idleSince:E.current,now:e});E.current=O.idleSince,O.restart&&T({whenIdle:!0})},[u,r==null?void 0:r.kind,n==null?void 0:n.canRestart,s,e,T]);const A=fR(t.current.agents.values()),R=are(A,l),B=XO({enabled:u,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:A>0,idleSince:E.current,now:e});w.useEffect(()=>{const D=n==null?void 0:n.running;let O=null,L=null;try{O=window.sessionStorage.getItem("agent-dag.restartPending"),L=window.sessionStorage.getItem($R)}catch{return}const z=ere({bundle:"3.36.1",running:D,pending:O,lastTried:L});if(z==="reload"){try{window.sessionStorage.setItem($R,D??"")}catch{return}window.location.reload();return}if(z!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,g(!1),x(D??null);const M=window.setTimeout(()=>x(null),6e3);return()=>window.clearTimeout(M)},[n==null?void 0:n.running]),w.useEffect(()=>{if(p&&nre({asked:S.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,g(!1)}},[p,o]);const P=w.useCallback(D=>{var O,L;if(!h.current){const z=et($u)==="0";cs($u),z&&((O=D.prefs)==null?void 0:O.autoUpdate)!==!1?(d(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):d(((L=D.prefs)==null?void 0:L.autoUpdate)!==!1)}},[]);return{autoRestart:u,toggleAutoRestart:f,restarting:p,restartMode:v,restartedTo:b,askRestart:T,restartCopy:R,restartFuseMs:B,loadAutoRestartPrefs:P}}function yoe(){const[e,t]=w.useState([]),n=w.useRef(new Set),[r,s]=w.useState(null),[o,l]=w.useState(void 0);w.useEffect(()=>{let h=!0,f=0;const p=()=>{fetch("/api/lan").then(g=>g.ok?g.json():null).then(g=>h?(g!=null&&g.ok&&t(sS(Array.isArray(g.pending)?g.pending:[],g.aliases)),g):null).catch(()=>null).then(g=>{h&&(l(v=>g!=null&&g.ok?g:v===void 0?null:v),f=window.setTimeout(p,(g==null?void 0:g.enabled)===!0?Lx:X$))})};return p(),()=>{h=!1,window.clearTimeout(f)}},[]);const u=w.useCallback(async(h,f)=>{if(!r){s(h);try{const g=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:h,fp:f})})).json().catch(()=>null);g&&Array.isArray(g.pending)?t(sS(g.pending,g.aliases)):t(v=>v.filter(k=>k.fp!==f))}catch{}finally{s(null)}}},[r]),d=w.useCallback(h=>{r||(n.current.add(h),t(f=>[...f]))},[r]);return{lanPending:e,lanDeferred:n,lanBusy:r,answerLanPair:u,deferLanPair:d,lanStatus:o}}const woe=6e4;function voe({enabled:e,lanStatus:t,now:n}){const[r,s]=w.useState(null),[o,l]=w.useState(()=>new Set),[u,d]=w.useState(null),h=w.useCallback(N=>{N!=null&&N.ok&&Array.isArray(N.accounts)&&s(N.accounts)},[]),f=w.useCallback(async N=>{try{const S=await fetch(`/api/claude-accounts${N?"?refresh=1":""}`);S.ok&&h(await S.json())}catch{}},[h]);w.useEffect(()=>{e&&f(!1)},[e,f]),w.useEffect(()=>{if(!e)return;let N=Date.now();const S=()=>{document.visibilityState!=="visible"||Date.now()-N<woe||(N=Date.now(),f(!1))};return document.addEventListener("visibilitychange",S),window.addEventListener("focus",S),()=>{document.removeEventListener("visibilitychange",S),window.removeEventListener("focus",S)}},[e,f]);const p=w.useMemo(()=>e?Lse(r,{lan:t,now:n,closed:o}):[],[e,r,t,n,o]),g=w.useRef(p);g.current=p;const v=w.useCallback(N=>{N.length&&l(S=>new Set([...S,...N]))},[]),k=w.useCallback(()=>{const N=g.current;N.length&&(v(N.map(S=>S.id)),fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reauth-later",incidents:N.map(S=>({key:S.key,since:S.since}))})}).catch(()=>{}))},[v]),b=w.useRef(u);b.current=u;const x=w.useCallback(N=>{const S=b.current;v(Pse(S?[S,...g.current]:g.current,N))},[v]);return{rows:p,signingIn:u,observe:h,signIn:d,signedIn:x,refresh:w.useCallback(()=>{f(!0)},[f]),closeSignIn:w.useCallback(()=>d(null),[]),later:k}}const wL="agent-dag.sessionListOpen",vL="agent-dag.accountsPanelOpen";function xoe(){return et(wL)==="1"}function boe(e){Xe(wL,e?"1":"0")}function koe(){const e=et(vL);return e===null?!0:e==="1"}function Noe(){const[e,t]=w.useState(xoe);w.useEffect(()=>{boe(e)},[e]);const n=w.useRef(!1),[r,s]=w.useState(()=>{const h=koe();return h&&e?(n.current=!0,!1):h});w.useEffect(()=>{!r&&n.current||Xe(vL,r?"1":"0")},[r]),w.useEffect(()=>{!e&&n.current&&(n.current=!1,s(!0))},[e]);const o=w.useCallback(()=>{t(h=>(h||s(f=>(f&&(n.current=!0),!1)),!h))},[]),l=w.useCallback(()=>{n.current=!1,s(h=>(h||t(!1),!h))},[]),u=w.useCallback(()=>t(!1),[]),d=w.useCallback(()=>s(!1),[]);return{sessionListOpen:e,accountsPanelOpen:r,toggleSessionList:o,toggleAccountsPanel:l,closeSessionList:u,closeAccountsPanel:d}}const xL="agent-dag.detailOpen",bL="agent-dag.usagePanelOpen",kL="agent-dag.systemPanelOpen";function joe(){return et(xL)==="1"}function Soe(e){Xe(xL,e?"1":"0")}function _oe(){const e=et(bL);return e===null?!0:e==="1"}function Eoe(e){Xe(bL,e?"1":"0")}function Coe(){const e=et(kL);return e===null?!0:e==="1"}function Toe(e){Xe(kL,e?"1":"0")}function Aoe(){const[e,t]=w.useState(joe);w.useEffect(()=>{Soe(e)},[e]);const[n,r]=w.useState(_oe);w.useEffect(()=>{Eoe(n)},[n]);const[s,o]=w.useState(Coe);return w.useEffect(()=>{Toe(s)},[s]),{detailOpen:e,setDetailOpen:t,usagePanelOpen:n,setUsagePanelOpen:r,machinePanelOpen:s,setMachinePanelOpen:o}}const Roe={permission:"your permission",asked:"your answer"},Moe="No sessions are waiting for you.";function $oe(e){if(e.length===0)return"";const[t,...n]=e,r=t.waiting.kind,s=n.every(l=>l.waiting.kind===r)?Roe[r]??"you":"you";if(n.length===0)return`${t.label} is waiting for ${s}.`;const o=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${o} are waiting for ${s}.`}function Gv(e,t,n=Moe){return t!==""?t:e===""?"":n}function Ioe({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[r,s]=w.useState(""),o=$oe(e);w.useEffect(()=>{s(g=>Gv(g,o))},[o]);const[l,u]=w.useState(""),d=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";w.useEffect(()=>{u(g=>Gv(g,d,"Browser watch has no unread findings."))},[d]);const[h,f]=w.useState(""),p=eoe(n);return w.useEffect(()=>{f(g=>Gv(g,p,toe))},[p]),{blockedSaid:r,watchSaid:l,setWatchSaid:u,incidentSaid:h}}const Ooe="/icon-192.png";function Loe({waitingSessions:e,liveSince:t,focusSession:n}){const[r,s]=w.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[o,l]=w.useState(null),[u,d]=w.useState(!1),[h,f]=w.useState(!1),p=w.useRef(()=>{}),g=w.useRef(new Set),v=xn(e),k=w.useCallback(()=>{const T=!u;d(T),T&&(g.current=vu(v.current)),T&&typeof Notification<"u"&&Notification.permission==="default"&&p.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:T})}).then(A=>A.ok?A.json():null).then(A=>{var R;A!=null&&A.ok&&(d(((R=A.prefs)==null?void 0:R.notifications)===!0),f(A.notificationsVetoed===!0))}).catch(()=>{})},[u]),b=typeof Notification<"u";w.useEffect(()=>{if(!o)return;const A=setTimeout(()=>l(null),o==="blocked"?8e3:4e3);return()=>clearTimeout(A)},[o]);const x=w.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(T=>{const A=T;s(A),A==="granted"?l("on"):A==="denied"&&l("blocked")})},[]);p.current=x;const N=w.useRef(null),S=e.map(T=>Id(T.id,T.waiting)).join("|");w.useEffect(()=>{Dq(N.current,r)&&(N.current=r,g.current=vu(e))},[r]);const _=w.useRef(!1);w.useEffect(()=>{Fq(_.current,t)&&(_.current=!0,g.current=vu(e))},[t]),w.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!Bq(N.current,t))return;const T=typeof document>"u"||!document.hidden,A=Lq(e,g.current,T,u);for(const R of A)try{const B=new Notification(R.title,{body:R.body,tag:R.key,icon:Ooe});B.onclick=()=>{window.focus(),n(R.sessionId),B.close()}}catch{}g.current=T?vu(e):Pq(e,A,g.current)},[S,t]);const E=w.useCallback(T=>{var A;d(((A=T.prefs)==null?void 0:A.notifications)===!0),f(T.notificationsVetoed===!0)},[]);return{notifyPermission:r,notifySaid:o,notifyOn:u,notifyVetoed:h,toggleNotify:k,notifySupported:b,askForNotifications:x,loadNotifyPrefs:E}}function Poe({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:r,summaryFor:s,browserWatchOpen:o,keyHelpOpen:l,releaseNotes:u,feedbackOpen:d}){const h=xn(l),f=w.useRef(!1);return f.current=e!=null||t||n!=null||r||s!=null||o||l||u!=null||d,{keyHelpOpenRef:h,modalOpenRef:f}}function Doe({stateRef:e,tourOpen:t,releaseNotes:n}){const[r,s]=w.useState(null),o=w.useCallback((D,O)=>s({agentId:D,toolId:O}),[]),[l,u]=w.useState(null),[d,h]=w.useState(null),f=w.useCallback(D=>h(D),[]),[p,g]=w.useState(!1),[v,k]=w.useState(!1),[b,x]=w.useState(!1),[N,S]=w.useState(!1),[_,E]=w.useState(null),T=w.useCallback(D=>{E(D??null),S(!0)},[]),A=r?PB(e.current.agents,r.agentId,r.toolId):null,R=d?e.current.agents.get(d):void 0,{keyHelpOpenRef:B,modalOpenRef:P}=Poe({openedTool:A,usageHistoryOpen:v,contextFor:d,tourOpen:t,summaryFor:l,browserWatchOpen:b,keyHelpOpen:p,releaseNotes:n,feedbackOpen:N});return{setOpenedToolKey:s,openTool:o,openedTool:A,summaryFor:l,setSummaryFor:u,contextFor:d,setContextFor:h,openContext:f,contextAgent:R,keyHelpOpen:p,setKeyHelpOpen:g,usageHistoryOpen:v,setUsageHistoryOpen:k,browserWatchOpen:b,setBrowserWatchOpen:x,feedbackOpen:N,setFeedbackOpen:S,feedbackPrefill:_,setFeedbackPrefill:E,openFeedback:T,keyHelpOpenRef:B,modalOpenRef:P}}function Foe({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:r,lastLayoutSigRef:s,forgetRemovals:o,clearSelection:l,rerender:u,modalOpenRef:d}){const[h,f]=w.useState(!1),p=w.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=Sb(),t.current.clear(),n.current.clear(),r.current.clear(),s.current="",BO(),o(),l(),u()},[u,l,o]),g=xn(h),v=w.useCallback(k=>{const b=cre(k,{confirmOpen:g.current,modalOpen:d.current});b==="confirm"?f(!0):b==="clear"&&(f(!1),p())},[p]);return{clearConfirmOpen:h,setClearConfirmOpen:f,requestClear:v}}const IR="agent-dag.oldNameNoticeDismissed";function Boe(e){const[t,n]=w.useState(()=>et(IR)??""),r=e!=null&&e.invokedAs&&e.invokedAs!==bt?e.invokedAs:null,s=r!=null&&t!==r,o=w.useCallback(()=>{r&&(n(r),Xe(IR,r))},[r]);return{oldName:r,oldNameOpen:s,dismissOldName:o}}function qoe({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:r}){const[s,o]=w.useState(()=>DY(et)),l=xn(s),[u,d]=w.useState([]),h=w.useCallback(S=>{o(_=>{const E={..._,[S]:null};return l.current=E,E}),cs(El[S])},[]),f=w.useCallback((S,_)=>{const E=l.current[S];_&&E!==_||(h(S),t(T=>{const A={...T,[S]:{...T[S],figure:vn}};return n.current=A,A}),Xe(yd[S],vn))},[h]),p=xn(f);w.useEffect(()=>{let S=!0;return YY().then(_=>{if(!S)return;d(_);const E=new Set(_.map(T=>T.id));for(const T of zu){const A=l.current[T];A&&!E.has(A)&&p.current(T,A)}},()=>{}),()=>{S=!1}},[]);const g=w.useCallback((S,_)=>{if(!u.some(T=>T.id===_))return;const E={...l.current,[S]:_};l.current=E,o(E),Xe(El[S],_),r(S,!0)},[u,r]),v=w.useCallback(async S=>{var A;const _=Ux(u.length);if(_)throw new Error(_);const E=window.AudioContext??window.webkitAudioContext;if(!E)throw new Error("This browser cannot decode audio files.");const T=new E;try{const R=await WY(S,P=>T.decodeAudioData(P));await TS(R);const B=Vl(R);d(P=>[...P.filter(D=>D.id!==B.id),B])}finally{(A=T.close)==null||A.call(T)}},[u.length]),k=w.useCallback(async S=>{const _=Ux(u.length);if(_)throw new Error(_);const E=HY(S);await TS(E);const T=Vl(E);d(A=>[...A.filter(R=>R.id!==T.id),T])},[u.length]),b=w.useCallback(async(S,_)=>{const E=u.find(A=>A.id===S),T=_.trim().slice(0,80);!E||!T||T===E.name||(await ZY(S,T),d(A=>A.map(R=>R.id===S?{...R,name:T}:R)))},[u]),x=w.useCallback(async S=>{await JY(S),d(A=>A.filter(R=>R.id!==S));const _=l.current,E=FY(_,S);l.current=E,o(E);const T=zu.filter(A=>_[A]===S);for(const A of T)cs(El[A]),Xe(yd[A],vn);T.length>0&&t(A=>{const R={...A};for(const B of T)R[B]={...R[B],figure:vn};return n.current=R,R})},[]),N=w.useCallback(S=>{var T,A;const _=zu.find(R=>l.current[R]===S),E=_?n.current[_].level:qa;(T=e.current)==null||T.unlock(),(A=e.current)==null||A.previewCustom(S,E)},[]);return{customSelections:s,customSelectionsRef:l,customAssets:u,clearCustomOnly:h,fallbackCustomRef:p,selectCustomTone:g,importNotificationAudio:v,createNotificationVoice:k,renameCustomAsset:b,deleteCustomAsset:x,previewCustomAsset:N}}function Uoe(e){const[t,n]=w.useState(()=>uX(et)),r=xn(t),s=w.useRef(null),o=w.useCallback((u,d=!1)=>{var h,f;if((h=e.current)==null||h.unlock(),s.current!==null&&clearTimeout(s.current),s.current=null,!d){(f=e.current)==null||f.play(u,!0);return}s.current=setTimeout(()=>{var p;s.current=null,(p=e.current)==null||p.play(u,!0)},aX)},[]),l=w.useCallback((u,d)=>{n(h=>{const f={level:hi(d.level??h[u].level),figure:jI(u,d.figure??h[u].figure)};return Xe(EI[u],String(f.level)),Xe(yd[u],f.figure),{...h,[u]:f}}),o(u,!0)},[o]);return w.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:r,previewTone:o,changeTone:l}}const zoe=15e3;function Woe(e){return e.visibilityState==="visible"&&e.hasFocus()}function Hoe(e,t){return t||e===!0}function Voe(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function Goe(){w.useEffect(()=>{const e=Voe();let t=null;const n=l=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:e,looking:l}),keepalive:!0}).catch(()=>{})},r=()=>{const l=Woe(document);Hoe(t,l)&&n(l),t=l},s=()=>{t&&n(!1),t=!1};r();const o=window.setInterval(r,zoe);return window.addEventListener("focus",r),window.addEventListener("blur",r),document.addEventListener("visibilitychange",r),window.addEventListener("pagehide",s),()=>{window.clearInterval(o),window.removeEventListener("focus",r),window.removeEventListener("blur",r),document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",s),s()}},[])}function Koe({loadAutoRestartPrefs:e,loadNotifyPrefs:t,loadReportsPrefs:n}){w.useEffect(()=>{let r=!0;return fetch("/api/prefs").then(s=>s.ok?s.json():null).then(s=>{!r||!(s!=null&&s.ok)||(e(s),t(s),n(s))}).catch(()=>{}),()=>{r=!1}},[])}const Kv="agent-dag.versionNoticeDismissed",Yoe=15*6e4;function Xoe(e){const[t,n]=w.useState(null),[r,s]=w.useState(()=>et(Kv)??""),o=w.useRef(0),[l,u]=w.useState(!1),d=w.useCallback((b=!1)=>(b&&(o.current=Date.now(),u(!0)),fetch(b?"/api/version?refresh=1":"/api/version").then(x=>x.ok?x.json():null).then(x=>{x&&n(x)}).catch(()=>{}).finally(()=>{b&&u(!1)})),[]),h=w.useCallback(()=>{d(Date.now()-o.current>=Yoe)},[d]);w.useEffect(()=>{d();const b=window.setInterval(h,5*6e4),x=()=>{document.visibilityState==="visible"&&h()};return document.addEventListener("visibilitychange",x),()=>{window.clearInterval(b),document.removeEventListener("visibilitychange",x)}},[d,h]),w.useEffect(()=>{e&&d()},[e,d]);const f=(t==null?void 0:t.notice)??null,p=YO(f),g=Pne(f,r),v=w.useCallback(()=>{s(""),Xe(Kv,"")},[]),k=w.useCallback(()=>{f&&(s(p),Xe(Kv,p))},[f,p]);return{version:t,notice:f,noticeOpen:g,showNotice:v,dismissNotice:k,versionChecking:l,loadVersion:d}}function Zoe({version:e,readyAppUpdate:t}){const[n,r]=w.useState(!1),s=w.useRef(null),[o,l]=w.useState(null),u=o&&t?t.version:null,d=w.useRef(null);w.useEffect(()=>{!u||d.current===u||(d.current=u,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:u})}).catch(()=>{}))},[u]);const h=w.useRef(!1);w.useEffect(()=>{if(h.current)return;const x=Sl(),N=tae(x),S=iae({stored:N,running:(e==null?void 0:e.running)??null,notes:NR,remembers:nae(x)});if(S.reason==="no-version")return;h.current=!0,S.record&&rae(x,S.record);let _=!0;return(async()=>{var B;let T=sae(x);if(Yl())try{const P=await fetch("/api/prefs");if(!P.ok)throw new Error("desktop tour preferences unavailable");const D=await P.json();if(!(D!=null&&D.ok))throw new Error("desktop tour preferences unavailable");const O=((B=D.prefs)==null?void 0:B.tourSeen)===!0;T&&!O&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),T=T||O}catch{T=!0}if(!_)return;const A=oae({tourSeen:T,decision:S}),R=S.show.length?{entries:S.show,since:N,firstRun:!1}:null;A.tour&&r(!0),A.notes==="now"?l(R):A.notes==="after"&&(s.current=R)})(),()=>{_=!1}},[e==null?void 0:e.running]);const f=(e==null?void 0:e.running)??"3.36.1",p=w.useMemo(()=>oL(NR,null,f),[f]),g=w.useCallback(()=>{l({entries:p,since:null,firstRun:!1})},[p]),v=w.useCallback(()=>r(!0),[]),k=w.useCallback(()=>l(null),[]),b=w.useCallback(()=>{r(!1),aae(Sl()),Yl()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const x=s.current;s.current=null,x&&l(x)},[]);return{tourOpen:n,openTour:v,closeTour:b,releaseNotes:o,closeReleaseNotes:k,chipVersion:f,openReleaseNotes:g}}function Joe(){const[e,t]=w.useState(void 0),[n,r]=w.useState(!1),s=w.useRef(!1);s.current=e===!0&&!n,w.useEffect(()=>Aae(()=>s.current),[]);const o=w.useCallback(u=>{var d;t(((d=u.prefs)==null?void 0:d.reports)!==!1),r(u.reportsVetoed===!0)},[]),l=w.useCallback(async u=>{t(u);try{const h=await(await fetch("/api/reports",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({on:u})})).json();h!=null&&h.ok&&(t(h.reports!==!1),r(h.reportsVetoed===!0))}catch{}},[]);return{reportsOn:e,reportsVetoed:n,loadReportsPrefs:o,answerReports:l}}function Qoe(){const[e,t]=w.useState(null),[n,r]=w.useState(!1),s=w.useRef(null);return w.useEffect(()=>{let o=!0,l=!1,u=null,d=null,h="";const f=b=>{o&&(r(!0),b!==h&&t(null))},p=()=>{if(l)return;l=!0,u=Date.now();const b=uR();d=b,fetch(`/api/ccusage?since=${b}`).then(x=>x.ok?x.json():null).then(x=>{if(o){if(!(x!=null&&x.ok)){f(b);return}h=b,t(Sne(x)),r(!1)}}).catch(()=>f(b)).finally(()=>{l=!1})},g=()=>{const b=s.current;jne({shown:!!b&&b.getClientRects().length>0,tabVisible:document.visibilityState==="visible",lastSince:d,since:uR(),lastReadAt:u,now:Date.now()})&&p()};g();const v=window.setInterval(g,Nne);document.addEventListener("visibilitychange",g);let k=null;return s.current&&typeof ResizeObserver<"u"&&(k=new ResizeObserver(g),k.observe(s.current)),()=>{o=!1,window.clearInterval(v),document.removeEventListener("visibilitychange",g),k==null||k.disconnect()}},[]),{monthlyUsage:e,monthlyUsageUnavailable:n,monthUsageRef:s}}function eie(e){const[t,n]=w.useState(null);w.useEffect(()=>{const u=et("agent-dag.sound");n(u===null?!0:u==="on")},[]);const r=w.useCallback(()=>{n(u=>{var h;const d=u!==!0;return Xe("agent-dag.sound",d?"on":"off"),d&&((h=e.current)==null||h.unlock()),d})},[]),s=w.useCallback(u=>{r()},[r]),o=xn(s),l=xn(t);return{soundOn:t,toggleSound:r,activateSoundRef:o,soundOnRef:l}}function tie(){const[e,t]=w.useState(!1),n=w.useRef(null),[r,s]=w.useState(!1),o=w.useRef(null);return w.useEffect(()=>{e&&s(!1)},[e]),{soundMenuOpen:e,setSoundMenuOpen:t,soundButtonRef:n,appearanceMenuOpen:r,setAppearanceMenuOpen:s,appearanceButtonRef:o}}const nie="agent-dag.autoFitDisabled";function rie(e){const t=w.useRef(!1),[n,r]=w.useState(!1);w.useEffect(()=>{cs(nie)},[]);const s=w.useCallback(()=>{t.current||(t.current=!0,r(!0))},[]),o=w.useCallback(()=>{t.current=!1,r(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:s,enableAutoFitAndRefit:o}}function sie(){return a.jsx(kb,{children:a.jsx($ae,{children:a.jsx(aie,{})})})}function aie(){const e=mi(),t=w.useState(Sb)[0],n=w.useRef(t),[,r]=w.useState(0),s=w.useCallback(()=>r(Sr=>Sr+1),[]),{detailOpen:o,setDetailOpen:l,usagePanelOpen:u,setUsagePanelOpen:d,machinePanelOpen:h,setMachinePanelOpen:f}=Aoe(),{selectedIds:p,primarySelectedId:g,selectAgent:v,clearSelection:k,pruneSelectionToBoard:b}=CX(n,l),{sessionListOpen:x,accountsPanelOpen:N,toggleSessionList:S,toggleAccountsPanel:_,closeSessionList:E,closeAccountsPanel:T}=Noe(),A=Qoe(),R=Fu(N,200),B=Fu(u,130),P=Fu(h,130),D=w.useRef(null),O=eie(D),{activateSoundRef:L,soundOnRef:z}=O,M=Uoe(D),{setTonePrefs:$,tonePrefsRef:q,previewTone:X}=M,H=qoe({chimesRef:D,setTonePrefs:$,tonePrefsRef:q,previewTone:X}),{customSelectionsRef:I,fallbackCustomRef:W}=H,F=tie(),{setSoundMenuOpen:Y}=F,{chimeState:J}=foe({chimesRef:D,soundOnRef:z,tonePrefsRef:q,customSelectionsRef:I,fallbackCustomRef:W}),V=Lae(n),{pauseGate:G,paused:K,togglePause:Z}=V,ee=w.useRef(()=>{}),{live:re,tabCapped:ue,everConnected:me,liveSince:ae}=wX({stateRef:n,rerender:s,pauseGate:G,chimesRef:D,desktopUpdateRef:ee}),pe=Xoe(re),{version:xe,notice:se,noticeOpen:ve,loadVersion:fe}=pe,he=moe(re),{readyAppUpdate:_e,onDesktopUpdateEvent:Fe}=he;ee.current=Fe,Goe();const Le=Zoe({version:xe,readyAppUpdate:_e}),{tourOpen:Ve,openTour:le,releaseNotes:je}=Le,{workspace:$e,providers:Oe,providersRef:ze}=Dae(re),nt=Boe(xe),it=noe({version:xe,loadVersion:fe}),{upgradeFailure:At}=it,Ue=Doe({stateRef:n,tourOpen:Ve,releaseNotes:je}),{openTool:Ze,setSummaryFor:Je,setContextFor:rt,openContext:gt,setKeyHelpOpen:Rt,setUsageHistoryOpen:yt,setBrowserWatchOpen:lt,keyHelpOpenRef:Qt,modalOpenRef:Pt}=Ue,Dt=Joe(),Ft=soe(),{watchOn:Kt,watchUnseen:qr}=Ft,Un=yoe(),[Ur,zr]=w.useState(0),{presentCats:zn,hiddenCats:mr,toggleCat:Wn,catBarRef:Wr,catBarOccluded:kn}=doe(n),ms=w.useRef(null),[Nn,gr]=w.useState(0),vt=TX({stateRef:n,rerender:s,pruneSelectionToBoard:b,setContextFor:rt,setSummaryFor:Je}),yr=Uae(Oe.claude||Oe.codex),wr=Qae(yr,vt),Hr=voe({enabled:Oe.claude,lanStatus:Un.lanStatus,now:vt}),Hn=goe({now:vt,stateRef:n,version:xe,notice:se,noticeOpen:ve,upgradeFailure:At,paused:V.paused}),{askRestart:fn,loadAutoRestartPrefs:Vr}=Hn,jn=uoe(),{setTheme:we,palette:Be}=jn,We=poe(),en=_ee(),{applyViewport:gs,moveCamera:vr,fitLeft:Vn,cameraEpochRef:Qe,lastFitTimeRef:xr}=en,Gn=Dee(Vn),{pinnedRef:Gr,positionsRef:Kn,lastLayoutSigRef:Ya,handleRelayout:Xa}=Gn,Kr=w.useRef(null),Yt=w.useRef(()=>{}),ra=ae!==null,tn=w.useRef(0),uc=w.useCallback(()=>{tn.current=Date.now()},[]),{canvasRef:Yr,canvasSize:gh,paneSizeRef:Za}=vte(),sa=rie(Vn),{autoFitDisabledRef:ys,disableAutoFit:ws}=sa,Si=w.useRef(!1),{measuredRef:Xr,measuredVersionRef:_i,sizeVersion:dc,domSizeVersion:Ei}=xte(Si),{removedNodes:vs,removedAgentIds:xs,removeNode:Ci,removeSelectedNode:Ge,removalNotice:Ti,bringBack:Ja,bringBackAll:Ai,forgetRemovals:hc}=cte({stateRef:n,pinnedRef:Gr,positionsRef:Kn,canvasRef:Yr,clearSelection:k,primarySelectedId:g}),Qa=ste({stateRef:n,now:vt,removedAgentIds:xs,sizeVersion:dc,domSizeVersion:Ei});Fee(Qa,Gn),lte({layoutSig:Qa,rf:e,stateRef:n,measuredRef:Xr,pinnedRef:Gr,positionsRef:Kn,paneSizeRef:Za,lastInteractRef:tn,autoFitDisabledRef:ys,lastFitTimeRef:xr,fitLeft:Vn});const Ri=bte(),{bubbling:Mi,endBubble:eo,onBubble:br}=kY(),[Sn,kr]=w.useState(!1),bs=xY(),{beginTrashDrag:aa,trackTrashDrag:Nr,endTrashDrag:yh}=bs,$i=RY({stateRef:n,measuredRef:Xr,measuredVersionRef:_i,canvasRef:Yr}),{lodRef:oa,applyZoom:wh}=$i,Ii=yte({applyViewport:gs,lastFitTimeRef:xr,cameraEpochRef:Qe,disableAutoFit:ws,markInteract:uc,canvasRef:Yr,applyZoom:wh}),jr=g?n.current.agents.get(g):null,Oi=o&&jr!=null,{railInsetRef:fc,availableWidth:ks,availableHeight:Ns}=See({canvasRef:Yr,canvasSize:gh,machinePhase:P,usagePhase:B,usagePanelOpen:u,detailShown:Oi}),Zr=ate({stateRef:n,now:vt,availableWidth:ks,availableHeight:Ns,layout:Gn,measuredRef:Xr,onBubble:br,settled:Ri,dragging:Sn,layoutSig:Qa,selectedIds:p,openContext:gt,historyReplayed:ra,removedNodes:vs,removedAgentIds:xs,dragTick:Ur,dragPatchRef:ms,dragMoveTick:Nn}),{nodes:js,edges:vh}=Zr,Li=xn(g);Bee({nodes:js,edges:vh,settled:Ri,dragging:Sn,availableWidth:ks,availableHeight:Ns,layout:Gn,camera:en,rf:e,measuredRef:Xr,stateRef:n,lastFocusRef:Kr,primarySelectedIdRef:Li,focusAgentRef:Yt,autoFitDisabledRef:ys});const to=Foe({stateRef:n,pinnedRef:Gr,measuredRef:Xr,positionsRef:Kn,lastLayoutSigRef:Ya,forgetRemovals:hc,clearSelection:k,rerender:s,modalOpenRef:Pt}),{requestClear:ia}=to,Pi=jte({nodes:js,stateRef:n,pinnedRef:Gr,positionsRef:Kn,draggingRef:Si,dragPatchRef:ms,setDragging:kr,setDragMoveTick:gr,setDragTick:zr,endBubble:eo,markInteract:uc,disableAutoFit:ws,beginTrashDrag:aa,trackTrashDrag:Nr,endTrashDrag:yh,removeNode:Ci}),pc=w.useCallback(()=>Vn(500),[Vn]),_n=xn(js),{focusAgent:Ss,stepAgent:no,focusSession:_s}=Cee({canvasRef:Yr,stateRef:n,measuredRef:Xr,nodesRef:_n,railInsetRef:fc,moveCamera:vr,disableAutoFit:ws,lastFocusRef:Kr,focusAgentRef:Yt,selectAgent:v,primarySelectedIdRef:Li}),ro=wte({clearSelection:k,selectAgent:v,detailOpen:o,setDetailOpen:l,detailShown:Oi,focusAgent:Ss,draggingRef:Si,lodRef:oa}),so=Tee({nodesRef:_n,stateRef:n,canvasRef:Yr,railInsetRef:fc}),mc=xn(Ge),zt=w.useRef(null),Es=w.useCallback(Sr=>{xs.has(Sr)&&Ja([Sr]),_s(Sr)},[xs,Ja,_s]),Di=kte();Nte({pointerFocusRef:Di,nodesRef:_n,stateRef:n,primarySelectedIdRef:Li,providersRef:ze,soundOnRef:z,keyHelpOpenRef:Qt,modalOpenRef:Pt,waitingCursorRef:zt,removeSelectedRef:mc,activateSoundRef:L,clearSelection:k,selectAgent:v,focusAgent:Ss,stepAgent:no,focusSession:_s,requestClear:ia,handleRelayout:Xa,handleFit:pc,togglePause:Z,toggleSessionList:S,toggleAccountsPanel:_,setDetailOpen:l,setUsageHistoryOpen:yt,setUsagePanelOpen:d,setMachinePanelOpen:f,setBrowserWatchOpen:lt,setSoundMenuOpen:Y,setKeyHelpOpen:Rt,setTheme:we});const Cs=n.current.agents.size,la=w.useMemo(()=>fx(n.current.agents.values()),[n.current,n.current.revision]);ute({stateRef:n,waitingSessions:la,removedAgentIds:xs,removedNodes:vs,bringBack:Ja}),pte({stateRef:n,waitingSessions:la,live:re});const ao=Ioe({waitingSessions:la,watchUnseen:qr,incidents:wr}),ca=Loe({waitingSessions:la,liveSince:ae,focusSession:_s}),{loadNotifyPrefs:ua}=ca;return Koe({loadAutoRestartPrefs:Vr,loadNotifyPrefs:ua,loadReportsPrefs:Dt.loadReportsPrefs}),a.jsxs("div",{className:"app",children:[a.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),a.jsxs("header",{className:"topbar",children:[a.jsx(zne,{versionCheck:pe,welcome:Le,desktopUpdate:he,pause:V,monthly:A,announcements:ao,notify:ca,waitingSessions:la,waitingCursorRef:zt,focusSession:_s,live:re,now:vt,incidents:wr}),jr&&a.jsx(Wne,{selected:jr,now:vt,selectedIds:p,focusAgent:Ss,clearSelection:k}),a.jsxs("div",{className:"actions",children:[a.jsx(vne,{sessionListOpen:x,toggleSessionList:S,usagePanelOpen:u,setUsagePanelOpen:d,setUsageHistoryOpen:yt}),a.jsx(xne,{providers:Oe,accountsPanelOpen:N,toggleAccountsPanel:_,machinePanelOpen:h,setMachinePanelOpen:f,watchOn:Kt,watchUnseen:qr,setBrowserWatchOpen:lt}),a.jsx(bne,{providers:Oe,sound:O,tones:M,customTones:H,notify:ca,chimeState:J,menus:F,appearance:jn,fm:We,reports:Dt,onFeedback:()=>Ue.openFeedback()})]})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Ti?`${Ti.label} removed from the board.`:""}),a.jsx(lre,{restart:Hn,versionCheck:pe,upgrade:it,oldNameNotice:nt,everConnected:me,live:re,paused:K}),Du(R)&&Oe.claude&&a.jsx(fY,{leaving:R==="leaving",onClose:T,onReport:Ue.openFeedback,onRoster:Hr.observe}),x&&a.jsx(bW,{state:n.current,now:vt,selectedIds:p,onSelect:Es,onClose:E,removedIds:xs,onBringBackAll:Ai}),a.jsxs(Yne,{canvasRef:Yr,bubbling:Mi,dragging:Sn,trash:bs,zoom:$i,viewport:Ii,stateRef:n,peek:so,children:[Cs===0&&(!re&&ue?a.jsx(Mte,{}):a.jsx($te,{live:re,everConnected:me,providers:Oe,workspace:$e,onTour:le})),(zn.length>1||mr.size>0)&&a.jsx(Hne,{catBarRef:Wr,catBarOccluded:kn,presentCats:zn,hiddenCats:mr,toggleCat:Wn}),a.jsx(fW,{graph:Zr,layout:Gn,viewport:Ii,clicks:ro,drag:Pi,appearance:jn,fm:We,autoFit:sa,pause:V,stateRef:n,measuredRef:Xr,hiddenCats:mr,now:vt,openTool:Ze,focusAgent:Ss,requestClear:ia,setKeyHelpOpen:Rt})]}),Du(B)&&a.jsx(mH,{state:n.current,now:vt,providers:Oe,incidents:wr,liveSince:ae,leaving:B==="leaving",onClose:()=>d(!1)}),Du(P)&&a.jsx(JH,{usageOpen:u,leaving:P==="leaving",onClose:()=>f(!1)}),o&&jr?a.jsx(Vte,{selected:jr,now:vt,openTool:Ze,setSummaryFor:Je,setDetailOpen:l,stateRef:n,removeSelectedNode:Ge}):null,a.jsx(_ae,{dialogs:Ue,welcome:Le,desktopUpdate:he,versionCheck:pe,restart:Hn,lanPairs:Un,attention:Hr,clearFlow:to,watchBadge:Ft,announcements:ao,appearance:jn,providers:Oe,stateRef:n,agentCount:Cs})]})}try{v8(window.localStorage)}catch{}const oie=s3.createRoot(document.getElementById("root"));oie.render(a.jsx(sie,{}));export{Ete as a,ot as b,Js as c,md as d,cie as e,qe as f,Ir as g,lie as h,Wl as i,a as j,Pr as k,UY as l,Sa as m,Wa as n,Sx as p,w as r,ir as s,ft as u};
|
|
306
|
+
`)}}function Qae(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>Jae(n,t)).filter(n=>n!==null)}function eoe(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const toe="The providers' status pages report no incident.";function noe({version:e,loadVersion:t}){var h;const[n,r]=w.useState(!1),s=((h=e==null?void 0:e.upgrade)==null?void 0:h.state)??"idle",o=tre(e==null?void 0:e.upgrade),l=w.useRef(!1),u=w.useCallback(async()=>{if(ir(l.current||s==="running")){l.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),l.current=!1}},[s,t]);w.useEffect(()=>{if(s!=="running")return;const f=window.setInterval(t,3e3);return()=>window.clearInterval(f)},[s,t]);const d=w.useCallback(async()=>{const f=e==null?void 0:e.command;!f||!await Wa(f)||(r(!0),window.setTimeout(()=>r(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:s,upgradeFailure:o,startUpgrade:u,copyCommand:d,cmdCopied:n}}const AR="agent-dag.browserWatch.seenMs";function roe(e,t){return e.filter(n=>n.startMs>t)}function soe(){const[e,t]=w.useState(()=>Number(et(AR))||0),[n,r]=w.useState([]),[s,o]=w.useState(!1);w.useEffect(()=>{let d=!0;const h=()=>{fetch("/api/browser-watch?live=0").then(p=>p.ok?p.json():null).then(p=>{var g;!d||!(p!=null&&p.ok)||(r(p.episodes??[]),o(((g=p.settings)==null?void 0:g.enabled)===!0))}).catch(()=>{})};h();const f=setInterval(h,5*6e4);return()=>{d=!1,clearInterval(f)}},[]);const l=w.useMemo(()=>roe(n,e).length,[n,e]),u=w.useCallback(d=>{t(d),Xe(AR,String(d))},[]);return{watchOn:s,setWatchOn:o,watchUnseen:l,markWatchSeen:u}}const gL=["--err","--inflight","--ok","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function RR(e){const t={};for(const n of gL)t[n]=e(n);return t}function aoe(e){return t=>e[t]??""}function ooe(e,t){return gL.every(n=>e[n]===t[n])}const yL="agent-dag.theme";function ioe(e,t=!1){return e==="light"||e==="dark"?e:t?"light":"dark"}function loe(){try{return window.matchMedia("(prefers-color-scheme: light)").matches}catch{return!1}}function coe(){return ioe(et(yL),loe())}function MR(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function uoe(){const[e,t]=w.useState(coe),[n,r]=w.useState(Xte),[s,o]=w.useState(()=>RR(MR)),l=w.useMemo(()=>aoe(s),[s]),u=w.useCallback(d=>ete(d,l),[l]);return w.useEffect(()=>{document.documentElement.dataset.theme=e,Xe(yL,e),o(d=>{const h=RR(MR);return ooe(d,h)?d:h})},[e]),w.useEffect(()=>{Xe(VO,n?"1":"0")},[n]),w.useEffect(()=>{const d=document.querySelector('meta[name="theme-color"]'),h=s["--panel"];d&&h&&d.setAttribute("content",h)},[s]),{theme:e,setTheme:t,characterEnabled:n,setCharacterEnabled:r,palette:s,minimapNodeFill:u}}function doe(e){const t=w.useRef(null),[n,r]=w.useState(!1),[s,o]=w.useState(()=>new Set),l=w.useMemo(()=>{const d=new Set;for(const h of e.current.agents.values())for(const f of h.tools)d.add(WO(f.name));return Object.keys(zO).filter(h=>d.has(h))},[e.current,e.current.revision]);w.useEffect(()=>{if(l.length<=1){r(!1);return}let d=0;const h=()=>{const f=t.current;if(f&&!document.hidden){const p=f.getBoundingClientRect(),g=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(k=>k.getBoundingClientRect()),v=Wee(p,g,8);r(k=>k===v?k:v)}d=window.setTimeout(h,300)};return h(),()=>window.clearTimeout(d)},[l.length]);const u=w.useCallback(d=>{o(h=>{const f=new Set(h);return f.has(d)?f.delete(d):f.add(d),f})},[]);return{presentCats:l,hiddenCats:s,toggleCat:u,catBarRef:t,catBarOccluded:n}}function hoe(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null;const r=()=>e.enabled()?(n==null?void 0:n.state)==="running"?"ready":"locked":"off",s=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,r())};function o(){var f,p;if(!(!t||(n==null?void 0:n.state)==="running"))try{n||(n=new t,(f=n.addEventListener)==null||f.call(n,"statechange",s)),(p=n.resume)==null||p.call(n).then(s,()=>{}),s()}catch{}}function l(f,p,g=p.figure){if(!n||n.state!=="running")return!1;const v=zx(f,g),k=tX(p.level,v),b=n.currentTime;for(const x of v.notes){const N=n.createOscillator(),S=n.createGain();N.type=v.type??"sine",N.frequency.value=x.hz;const _=b+x.at,E=_+x.ms/1e3;S.gain.setValueAtTime(RS,_),S.gain.exponentialRampToValueAtTime(k,_+nX),S.gain.exponentialRampToValueAtTime(RS,E),N.connect(S).connect(n.destination),N.start(_),N.stop(E+.02)}return!0}async function u(f,p){if(!e.loadCustom)return"unavailable";let g;try{g=await e.loadCustom(f)}catch{return"unavailable"}if(!g)return"missing";if(g.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const k=new SpeechSynthesisUtterance(g.text),b=window.speechSynthesis.getVoices();k.voice=b.find(x=>x.voiceURI===g.voiceURI)??null,k.rate=g.rate,k.pitch=g.pitch,k.volume=rX(p.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(k),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let v;try{v=await n.decodeAudioData(g.bytes.slice(0))}catch{return"broken"}try{const k=n.createBufferSource(),b=n.createGain();return k.buffer=v,b.gain.setValueAtTime(sX(g.normalizationGain,p.level),n.currentTime),k.connect(b).connect(n.destination),k.start(n.currentTime),"played"}catch{return"unavailable"}}function d(f,p=!1){var k,b;if(!p&&!e.enabled())return!1;const g=dX((k=e.prefs)==null?void 0:k.call(e),f),v=((b=e.customSelection)==null?void 0:b.call(e)[f])??null;return v&&e.loadCustom?(u(v,g).then(x=>{var N;x==="played"||x==="locked"||((x==="missing"||x==="broken")&&((N=e.onCustomFailure)==null||N.call(e,f,v)),l(f,{...g,figure:vn},vn))}),!0):!n||n.state!=="running"?!1:l(f,g)}function h(f,p=qa){return u(f,{level:hi(p),figure:vn}),!0}return{unlock:o,play:d,previewCustom:h,state:r,get context(){return n}}}function foe({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:r,fallbackCustomRef:s}){const[o,l]=w.useState("locked");return w.useEffect(()=>{const u=hoe({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>r.current,loadCustom:XY,onCustomFailure:(p,g)=>s.current(p,g),onState:l});e.current=u,l(u.state());const d=["pointerdown","pointerup","keydown"],h=()=>{for(const p of d)window.removeEventListener(p,f,{capture:!0})},f=()=>{var p;u.unlock(),((p=u.context)==null?void 0:p.state)==="running"&&h()};for(const p of d)window.addEventListener(p,f,{capture:!0});return h},[]),{chimeState:o}}function poe(){const[e,t]=w.useState(Jte),[n,r]=w.useState(()=>fB(et(HN))),[s,o]=w.useState(()=>hB(et(VN))),[l,u]=w.useState(()=>pB(et(aR),n,Kte)),[d,h]=w.useState(()=>new Set),[f,p]=w.useState(0);w.useEffect(()=>{Xe(GO,String(e))},[e]),w.useEffect(()=>{Xe(VN,s?"1":"0")},[s]),w.useEffect(()=>{Xe(HN,JSON.stringify(n))},[n]),w.useEffect(()=>{Xe(aR,l)},[l]);const g=w.useCallback(N=>{r(S=>S.some(_=>_.id===N.id)?S:[...S,N]),h(S=>{if(!S.has(N.id))return S;const _=new Set(S);return _.delete(N.id),_})},[]),v=w.useCallback((N,S)=>{const _=S.trim();!_||_.length>Ll||r(E=>E.map(T=>T.id===N?{...T,name:_}:T))},[]),k=w.useCallback(N=>{r(S=>S.filter(_=>_.id!==N)),u(S=>mB(S,N)),h(S=>{if(!S.has(N))return S;const _=new Set(S);return _.delete(N),_})},[]),b=w.useCallback(N=>{const S=GN(N),_=d.has(S);N===l&&!_||(_&&h(E=>{const T=new Set(E);return T.delete(S),T}),u(N),p(E=>E+1))},[l,d]),x=w.useCallback((N,S)=>{const _=GN(N);h(E=>{if(E.has(_)===S)return E;const A=new Set(E);return S?A.add(_):A.delete(_),A})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:s,setFmMuted:o,fmSource:l,customFmStations:n,unavailableFmStations:d,fmPlayRequest:f,addFmStation:g,renameFmStation:v,removeFmStation:k,pickFmSource:b,markFmStationAvailability:x}}function moe(e){const[t,n]=w.useState(null),[r,s]=w.useState(!1),[o,l]=w.useState(null),u=w.useRef(0);w.useEffect(()=>{if(!e||!Yl())return;let k=!1;const b=u.current;return fetch("/api/desktop-update").then(x=>x.ok?x.json():null).then(x=>{if(k||u.current!==b)return;const N=hR(x);N&&n(N)}).catch(()=>{}),()=>{k=!0}},[e]);const d=Ene(t),h=w.useRef(!1),f=w.useRef(0),p=w.useRef(0);w.useEffect(()=>()=>window.clearTimeout(f.current),[]);const g=w.useCallback(async k=>{if(!ir(h.current))return;const b=++p.current;window.clearTimeout(f.current),h.current=!0,s(!0),l(null);const x=N=>{b===p.current&&(window.clearTimeout(f.current),h.current=!1,s(!1),l({failure:N,version:k}))};try{const N=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:k})});if(!N.ok)return x(Rne(await N.json().catch(()=>null)))}catch{return x("unreachable")}b===p.current&&(f.current=window.setTimeout(()=>x("timeout"),KO))},[]),v=w.useCallback(k=>{if(Yl())try{const b=hR(JSON.parse(k));b&&(u.current++,n(b),b.status!=="ready"&&(p.current++,window.clearTimeout(f.current),h.current=!1,s(!1)))}catch{}},[]);return{desktopUpdateRestarting:r,desktopUpdateFailure:o,readyAppUpdate:d,askDesktopUpdateRestart:g,onDesktopUpdateEvent:v}}const $u="agent-dag.autoRestart",$R="agent-dag.bundleReloadedFor";function goe({now:e,stateRef:t,version:n,notice:r,noticeOpen:s,upgradeFailure:o,paused:l}){const[u,d]=w.useState(()=>et($u)!=="0"),h=w.useRef(!1),f=w.useCallback(()=>{const D=!u;h.current=!0,cs($u),d(D),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:D})}).then(O=>O.ok?O.json():null).then(O=>{var L;O!=null&&O.ok&&d(((L=O.prefs)==null?void 0:L.autoUpdate)!==!1)}).catch(()=>{})},[u]),[p,g]=w.useState(!1),[v,k]=w.useState("restart"),[b,x]=w.useState(null),N=w.useRef(!1),S=w.useRef(null),_=w.useRef(0),E=w.useRef(null),T=w.useCallback(async D=>{if(!ir(N.current))return;const O=(D==null?void 0:D.upgrade)===!0,L=(D==null?void 0:D.whenIdle)===!0;N.current=!0,S.current=o;const z=++_.current,M=()=>{k(O?"npx":"restart"),g(!0)};L||M();try{window.sessionStorage.setItem("agent-dag.restartPending",(r==null?void 0:r.to)??"")}catch{}let $=!1;try{const q=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L?{upgrade:O,whenIdle:L}:{upgrade:O})});$=L&&q.status===409}catch{}if($){N.current=!1,E.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}L&&M(),window.setTimeout(()=>{if(_.current===z&&N.current){N.current=!1,g(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},O?18e4:3e4)},[r==null?void 0:r.to,o]);w.useEffect(()=>{const D=fR(t.current.agents.values())>0,O=ore({enabled:u,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:D,idleSince:E.current,now:e});E.current=O.idleSince,O.restart&&T({whenIdle:!0})},[u,r==null?void 0:r.kind,n==null?void 0:n.canRestart,s,e,T]);const A=fR(t.current.agents.values()),R=are(A,l),B=XO({enabled:u,kind:r==null?void 0:r.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:s,visible:document.visibilityState==="visible",busy:A>0,idleSince:E.current,now:e});w.useEffect(()=>{const D=n==null?void 0:n.running;let O=null,L=null;try{O=window.sessionStorage.getItem("agent-dag.restartPending"),L=window.sessionStorage.getItem($R)}catch{return}const z=ere({bundle:"3.36.3",running:D,pending:O,lastTried:L});if(z==="reload"){try{window.sessionStorage.setItem($R,D??"")}catch{return}window.location.reload();return}if(z!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,g(!1),x(D??null);const M=window.setTimeout(()=>x(null),6e3);return()=>window.clearTimeout(M)},[n==null?void 0:n.running]),w.useEffect(()=>{if(p&&nre({asked:S.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,g(!1)}},[p,o]);const P=w.useCallback(D=>{var O,L;if(!h.current){const z=et($u)==="0";cs($u),z&&((O=D.prefs)==null?void 0:O.autoUpdate)!==!1?(d(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):d(((L=D.prefs)==null?void 0:L.autoUpdate)!==!1)}},[]);return{autoRestart:u,toggleAutoRestart:f,restarting:p,restartMode:v,restartedTo:b,askRestart:T,restartCopy:R,restartFuseMs:B,loadAutoRestartPrefs:P}}function yoe(){const[e,t]=w.useState([]),n=w.useRef(new Set),[r,s]=w.useState(null),[o,l]=w.useState(void 0);w.useEffect(()=>{let h=!0,f=0;const p=()=>{fetch("/api/lan").then(g=>g.ok?g.json():null).then(g=>h?(g!=null&&g.ok&&t(sS(Array.isArray(g.pending)?g.pending:[],g.aliases)),g):null).catch(()=>null).then(g=>{h&&(l(v=>g!=null&&g.ok?g:v===void 0?null:v),f=window.setTimeout(p,(g==null?void 0:g.enabled)===!0?Lx:X$))})};return p(),()=>{h=!1,window.clearTimeout(f)}},[]);const u=w.useCallback(async(h,f)=>{if(!r){s(h);try{const g=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:h,fp:f})})).json().catch(()=>null);g&&Array.isArray(g.pending)?t(sS(g.pending,g.aliases)):t(v=>v.filter(k=>k.fp!==f))}catch{}finally{s(null)}}},[r]),d=w.useCallback(h=>{r||(n.current.add(h),t(f=>[...f]))},[r]);return{lanPending:e,lanDeferred:n,lanBusy:r,answerLanPair:u,deferLanPair:d,lanStatus:o}}const woe=6e4;function voe({enabled:e,lanStatus:t,now:n}){const[r,s]=w.useState(null),[o,l]=w.useState(()=>new Set),[u,d]=w.useState(null),h=w.useCallback(N=>{N!=null&&N.ok&&Array.isArray(N.accounts)&&s(N.accounts)},[]),f=w.useCallback(async N=>{try{const S=await fetch(`/api/claude-accounts${N?"?refresh=1":""}`);S.ok&&h(await S.json())}catch{}},[h]);w.useEffect(()=>{e&&f(!1)},[e,f]),w.useEffect(()=>{if(!e)return;let N=Date.now();const S=()=>{document.visibilityState!=="visible"||Date.now()-N<woe||(N=Date.now(),f(!1))};return document.addEventListener("visibilitychange",S),window.addEventListener("focus",S),()=>{document.removeEventListener("visibilitychange",S),window.removeEventListener("focus",S)}},[e,f]);const p=w.useMemo(()=>e?Lse(r,{lan:t,now:n,closed:o}):[],[e,r,t,n,o]),g=w.useRef(p);g.current=p;const v=w.useCallback(N=>{N.length&&l(S=>new Set([...S,...N]))},[]),k=w.useCallback(()=>{const N=g.current;N.length&&(v(N.map(S=>S.id)),fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reauth-later",incidents:N.map(S=>({key:S.key,since:S.since}))})}).catch(()=>{}))},[v]),b=w.useRef(u);b.current=u;const x=w.useCallback(N=>{const S=b.current;v(Pse(S?[S,...g.current]:g.current,N))},[v]);return{rows:p,signingIn:u,observe:h,signIn:d,signedIn:x,refresh:w.useCallback(()=>{f(!0)},[f]),closeSignIn:w.useCallback(()=>d(null),[]),later:k}}const wL="agent-dag.sessionListOpen",vL="agent-dag.accountsPanelOpen";function xoe(){return et(wL)==="1"}function boe(e){Xe(wL,e?"1":"0")}function koe(){const e=et(vL);return e===null?!0:e==="1"}function Noe(){const[e,t]=w.useState(xoe);w.useEffect(()=>{boe(e)},[e]);const n=w.useRef(!1),[r,s]=w.useState(()=>{const h=koe();return h&&e?(n.current=!0,!1):h});w.useEffect(()=>{!r&&n.current||Xe(vL,r?"1":"0")},[r]),w.useEffect(()=>{!e&&n.current&&(n.current=!1,s(!0))},[e]);const o=w.useCallback(()=>{t(h=>(h||s(f=>(f&&(n.current=!0),!1)),!h))},[]),l=w.useCallback(()=>{n.current=!1,s(h=>(h||t(!1),!h))},[]),u=w.useCallback(()=>t(!1),[]),d=w.useCallback(()=>s(!1),[]);return{sessionListOpen:e,accountsPanelOpen:r,toggleSessionList:o,toggleAccountsPanel:l,closeSessionList:u,closeAccountsPanel:d}}const xL="agent-dag.detailOpen",bL="agent-dag.usagePanelOpen",kL="agent-dag.systemPanelOpen";function joe(){return et(xL)==="1"}function Soe(e){Xe(xL,e?"1":"0")}function _oe(){const e=et(bL);return e===null?!0:e==="1"}function Eoe(e){Xe(bL,e?"1":"0")}function Coe(){const e=et(kL);return e===null?!0:e==="1"}function Toe(e){Xe(kL,e?"1":"0")}function Aoe(){const[e,t]=w.useState(joe);w.useEffect(()=>{Soe(e)},[e]);const[n,r]=w.useState(_oe);w.useEffect(()=>{Eoe(n)},[n]);const[s,o]=w.useState(Coe);return w.useEffect(()=>{Toe(s)},[s]),{detailOpen:e,setDetailOpen:t,usagePanelOpen:n,setUsagePanelOpen:r,machinePanelOpen:s,setMachinePanelOpen:o}}const Roe={permission:"your permission",asked:"your answer"},Moe="No sessions are waiting for you.";function $oe(e){if(e.length===0)return"";const[t,...n]=e,r=t.waiting.kind,s=n.every(l=>l.waiting.kind===r)?Roe[r]??"you":"you";if(n.length===0)return`${t.label} is waiting for ${s}.`;const o=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${o} are waiting for ${s}.`}function Gv(e,t,n=Moe){return t!==""?t:e===""?"":n}function Ioe({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[r,s]=w.useState(""),o=$oe(e);w.useEffect(()=>{s(g=>Gv(g,o))},[o]);const[l,u]=w.useState(""),d=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";w.useEffect(()=>{u(g=>Gv(g,d,"Browser watch has no unread findings."))},[d]);const[h,f]=w.useState(""),p=eoe(n);return w.useEffect(()=>{f(g=>Gv(g,p,toe))},[p]),{blockedSaid:r,watchSaid:l,setWatchSaid:u,incidentSaid:h}}const Ooe="/icon-192.png";function Loe({waitingSessions:e,liveSince:t,focusSession:n}){const[r,s]=w.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[o,l]=w.useState(null),[u,d]=w.useState(!1),[h,f]=w.useState(!1),p=w.useRef(()=>{}),g=w.useRef(new Set),v=xn(e),k=w.useCallback(()=>{const T=!u;d(T),T&&(g.current=vu(v.current)),T&&typeof Notification<"u"&&Notification.permission==="default"&&p.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:T})}).then(A=>A.ok?A.json():null).then(A=>{var R;A!=null&&A.ok&&(d(((R=A.prefs)==null?void 0:R.notifications)===!0),f(A.notificationsVetoed===!0))}).catch(()=>{})},[u]),b=typeof Notification<"u";w.useEffect(()=>{if(!o)return;const A=setTimeout(()=>l(null),o==="blocked"?8e3:4e3);return()=>clearTimeout(A)},[o]);const x=w.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(T=>{const A=T;s(A),A==="granted"?l("on"):A==="denied"&&l("blocked")})},[]);p.current=x;const N=w.useRef(null),S=e.map(T=>Id(T.id,T.waiting)).join("|");w.useEffect(()=>{Dq(N.current,r)&&(N.current=r,g.current=vu(e))},[r]);const _=w.useRef(!1);w.useEffect(()=>{Fq(_.current,t)&&(_.current=!0,g.current=vu(e))},[t]),w.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!Bq(N.current,t))return;const T=typeof document>"u"||!document.hidden,A=Lq(e,g.current,T,u);for(const R of A)try{const B=new Notification(R.title,{body:R.body,tag:R.key,icon:Ooe});B.onclick=()=>{window.focus(),n(R.sessionId),B.close()}}catch{}g.current=T?vu(e):Pq(e,A,g.current)},[S,t]);const E=w.useCallback(T=>{var A;d(((A=T.prefs)==null?void 0:A.notifications)===!0),f(T.notificationsVetoed===!0)},[]);return{notifyPermission:r,notifySaid:o,notifyOn:u,notifyVetoed:h,toggleNotify:k,notifySupported:b,askForNotifications:x,loadNotifyPrefs:E}}function Poe({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:r,summaryFor:s,browserWatchOpen:o,keyHelpOpen:l,releaseNotes:u,feedbackOpen:d}){const h=xn(l),f=w.useRef(!1);return f.current=e!=null||t||n!=null||r||s!=null||o||l||u!=null||d,{keyHelpOpenRef:h,modalOpenRef:f}}function Doe({stateRef:e,tourOpen:t,releaseNotes:n}){const[r,s]=w.useState(null),o=w.useCallback((D,O)=>s({agentId:D,toolId:O}),[]),[l,u]=w.useState(null),[d,h]=w.useState(null),f=w.useCallback(D=>h(D),[]),[p,g]=w.useState(!1),[v,k]=w.useState(!1),[b,x]=w.useState(!1),[N,S]=w.useState(!1),[_,E]=w.useState(null),T=w.useCallback(D=>{E(D??null),S(!0)},[]),A=r?PB(e.current.agents,r.agentId,r.toolId):null,R=d?e.current.agents.get(d):void 0,{keyHelpOpenRef:B,modalOpenRef:P}=Poe({openedTool:A,usageHistoryOpen:v,contextFor:d,tourOpen:t,summaryFor:l,browserWatchOpen:b,keyHelpOpen:p,releaseNotes:n,feedbackOpen:N});return{setOpenedToolKey:s,openTool:o,openedTool:A,summaryFor:l,setSummaryFor:u,contextFor:d,setContextFor:h,openContext:f,contextAgent:R,keyHelpOpen:p,setKeyHelpOpen:g,usageHistoryOpen:v,setUsageHistoryOpen:k,browserWatchOpen:b,setBrowserWatchOpen:x,feedbackOpen:N,setFeedbackOpen:S,feedbackPrefill:_,setFeedbackPrefill:E,openFeedback:T,keyHelpOpenRef:B,modalOpenRef:P}}function Foe({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:r,lastLayoutSigRef:s,forgetRemovals:o,clearSelection:l,rerender:u,modalOpenRef:d}){const[h,f]=w.useState(!1),p=w.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=Sb(),t.current.clear(),n.current.clear(),r.current.clear(),s.current="",BO(),o(),l(),u()},[u,l,o]),g=xn(h),v=w.useCallback(k=>{const b=cre(k,{confirmOpen:g.current,modalOpen:d.current});b==="confirm"?f(!0):b==="clear"&&(f(!1),p())},[p]);return{clearConfirmOpen:h,setClearConfirmOpen:f,requestClear:v}}const IR="agent-dag.oldNameNoticeDismissed";function Boe(e){const[t,n]=w.useState(()=>et(IR)??""),r=e!=null&&e.invokedAs&&e.invokedAs!==bt?e.invokedAs:null,s=r!=null&&t!==r,o=w.useCallback(()=>{r&&(n(r),Xe(IR,r))},[r]);return{oldName:r,oldNameOpen:s,dismissOldName:o}}function qoe({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:r}){const[s,o]=w.useState(()=>DY(et)),l=xn(s),[u,d]=w.useState([]),h=w.useCallback(S=>{o(_=>{const E={..._,[S]:null};return l.current=E,E}),cs(El[S])},[]),f=w.useCallback((S,_)=>{const E=l.current[S];_&&E!==_||(h(S),t(T=>{const A={...T,[S]:{...T[S],figure:vn}};return n.current=A,A}),Xe(yd[S],vn))},[h]),p=xn(f);w.useEffect(()=>{let S=!0;return YY().then(_=>{if(!S)return;d(_);const E=new Set(_.map(T=>T.id));for(const T of zu){const A=l.current[T];A&&!E.has(A)&&p.current(T,A)}},()=>{}),()=>{S=!1}},[]);const g=w.useCallback((S,_)=>{if(!u.some(T=>T.id===_))return;const E={...l.current,[S]:_};l.current=E,o(E),Xe(El[S],_),r(S,!0)},[u,r]),v=w.useCallback(async S=>{var A;const _=Ux(u.length);if(_)throw new Error(_);const E=window.AudioContext??window.webkitAudioContext;if(!E)throw new Error("This browser cannot decode audio files.");const T=new E;try{const R=await WY(S,P=>T.decodeAudioData(P));await TS(R);const B=Vl(R);d(P=>[...P.filter(D=>D.id!==B.id),B])}finally{(A=T.close)==null||A.call(T)}},[u.length]),k=w.useCallback(async S=>{const _=Ux(u.length);if(_)throw new Error(_);const E=HY(S);await TS(E);const T=Vl(E);d(A=>[...A.filter(R=>R.id!==T.id),T])},[u.length]),b=w.useCallback(async(S,_)=>{const E=u.find(A=>A.id===S),T=_.trim().slice(0,80);!E||!T||T===E.name||(await ZY(S,T),d(A=>A.map(R=>R.id===S?{...R,name:T}:R)))},[u]),x=w.useCallback(async S=>{await JY(S),d(A=>A.filter(R=>R.id!==S));const _=l.current,E=FY(_,S);l.current=E,o(E);const T=zu.filter(A=>_[A]===S);for(const A of T)cs(El[A]),Xe(yd[A],vn);T.length>0&&t(A=>{const R={...A};for(const B of T)R[B]={...R[B],figure:vn};return n.current=R,R})},[]),N=w.useCallback(S=>{var T,A;const _=zu.find(R=>l.current[R]===S),E=_?n.current[_].level:qa;(T=e.current)==null||T.unlock(),(A=e.current)==null||A.previewCustom(S,E)},[]);return{customSelections:s,customSelectionsRef:l,customAssets:u,clearCustomOnly:h,fallbackCustomRef:p,selectCustomTone:g,importNotificationAudio:v,createNotificationVoice:k,renameCustomAsset:b,deleteCustomAsset:x,previewCustomAsset:N}}function Uoe(e){const[t,n]=w.useState(()=>uX(et)),r=xn(t),s=w.useRef(null),o=w.useCallback((u,d=!1)=>{var h,f;if((h=e.current)==null||h.unlock(),s.current!==null&&clearTimeout(s.current),s.current=null,!d){(f=e.current)==null||f.play(u,!0);return}s.current=setTimeout(()=>{var p;s.current=null,(p=e.current)==null||p.play(u,!0)},aX)},[]),l=w.useCallback((u,d)=>{n(h=>{const f={level:hi(d.level??h[u].level),figure:jI(u,d.figure??h[u].figure)};return Xe(EI[u],String(f.level)),Xe(yd[u],f.figure),{...h,[u]:f}}),o(u,!0)},[o]);return w.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:r,previewTone:o,changeTone:l}}const zoe=15e3;function Woe(e){return e.visibilityState==="visible"&&e.hasFocus()}function Hoe(e,t){return t||e===!0}function Voe(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function Goe(){w.useEffect(()=>{const e=Voe();let t=null;const n=l=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:e,looking:l}),keepalive:!0}).catch(()=>{})},r=()=>{const l=Woe(document);Hoe(t,l)&&n(l),t=l},s=()=>{t&&n(!1),t=!1};r();const o=window.setInterval(r,zoe);return window.addEventListener("focus",r),window.addEventListener("blur",r),document.addEventListener("visibilitychange",r),window.addEventListener("pagehide",s),()=>{window.clearInterval(o),window.removeEventListener("focus",r),window.removeEventListener("blur",r),document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",s),s()}},[])}function Koe({loadAutoRestartPrefs:e,loadNotifyPrefs:t,loadReportsPrefs:n}){w.useEffect(()=>{let r=!0;return fetch("/api/prefs").then(s=>s.ok?s.json():null).then(s=>{!r||!(s!=null&&s.ok)||(e(s),t(s),n(s))}).catch(()=>{}),()=>{r=!1}},[])}const Kv="agent-dag.versionNoticeDismissed",Yoe=15*6e4;function Xoe(e){const[t,n]=w.useState(null),[r,s]=w.useState(()=>et(Kv)??""),o=w.useRef(0),[l,u]=w.useState(!1),d=w.useCallback((b=!1)=>(b&&(o.current=Date.now(),u(!0)),fetch(b?"/api/version?refresh=1":"/api/version").then(x=>x.ok?x.json():null).then(x=>{x&&n(x)}).catch(()=>{}).finally(()=>{b&&u(!1)})),[]),h=w.useCallback(()=>{d(Date.now()-o.current>=Yoe)},[d]);w.useEffect(()=>{d();const b=window.setInterval(h,5*6e4),x=()=>{document.visibilityState==="visible"&&h()};return document.addEventListener("visibilitychange",x),()=>{window.clearInterval(b),document.removeEventListener("visibilitychange",x)}},[d,h]),w.useEffect(()=>{e&&d()},[e,d]);const f=(t==null?void 0:t.notice)??null,p=YO(f),g=Pne(f,r),v=w.useCallback(()=>{s(""),Xe(Kv,"")},[]),k=w.useCallback(()=>{f&&(s(p),Xe(Kv,p))},[f,p]);return{version:t,notice:f,noticeOpen:g,showNotice:v,dismissNotice:k,versionChecking:l,loadVersion:d}}function Zoe({version:e,readyAppUpdate:t}){const[n,r]=w.useState(!1),s=w.useRef(null),[o,l]=w.useState(null),u=o&&t?t.version:null,d=w.useRef(null);w.useEffect(()=>{!u||d.current===u||(d.current=u,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:u})}).catch(()=>{}))},[u]);const h=w.useRef(!1);w.useEffect(()=>{if(h.current)return;const x=Sl(),N=tae(x),S=iae({stored:N,running:(e==null?void 0:e.running)??null,notes:NR,remembers:nae(x)});if(S.reason==="no-version")return;h.current=!0,S.record&&rae(x,S.record);let _=!0;return(async()=>{var B;let T=sae(x);if(Yl())try{const P=await fetch("/api/prefs");if(!P.ok)throw new Error("desktop tour preferences unavailable");const D=await P.json();if(!(D!=null&&D.ok))throw new Error("desktop tour preferences unavailable");const O=((B=D.prefs)==null?void 0:B.tourSeen)===!0;T&&!O&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),T=T||O}catch{T=!0}if(!_)return;const A=oae({tourSeen:T,decision:S}),R=S.show.length?{entries:S.show,since:N,firstRun:!1}:null;A.tour&&r(!0),A.notes==="now"?l(R):A.notes==="after"&&(s.current=R)})(),()=>{_=!1}},[e==null?void 0:e.running]);const f=(e==null?void 0:e.running)??"3.36.3",p=w.useMemo(()=>oL(NR,null,f),[f]),g=w.useCallback(()=>{l({entries:p,since:null,firstRun:!1})},[p]),v=w.useCallback(()=>r(!0),[]),k=w.useCallback(()=>l(null),[]),b=w.useCallback(()=>{r(!1),aae(Sl()),Yl()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const x=s.current;s.current=null,x&&l(x)},[]);return{tourOpen:n,openTour:v,closeTour:b,releaseNotes:o,closeReleaseNotes:k,chipVersion:f,openReleaseNotes:g}}function Joe(){const[e,t]=w.useState(void 0),[n,r]=w.useState(!1),s=w.useRef(!1);s.current=e===!0&&!n,w.useEffect(()=>Aae(()=>s.current),[]);const o=w.useCallback(u=>{var d;t(((d=u.prefs)==null?void 0:d.reports)!==!1),r(u.reportsVetoed===!0)},[]),l=w.useCallback(async u=>{t(u);try{const h=await(await fetch("/api/reports",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({on:u})})).json();h!=null&&h.ok&&(t(h.reports!==!1),r(h.reportsVetoed===!0))}catch{}},[]);return{reportsOn:e,reportsVetoed:n,loadReportsPrefs:o,answerReports:l}}function Qoe(){const[e,t]=w.useState(null),[n,r]=w.useState(!1),s=w.useRef(null);return w.useEffect(()=>{let o=!0,l=!1,u=null,d=null,h="";const f=b=>{o&&(r(!0),b!==h&&t(null))},p=()=>{if(l)return;l=!0,u=Date.now();const b=uR();d=b,fetch(`/api/ccusage?since=${b}`).then(x=>x.ok?x.json():null).then(x=>{if(o){if(!(x!=null&&x.ok)){f(b);return}h=b,t(Sne(x)),r(!1)}}).catch(()=>f(b)).finally(()=>{l=!1})},g=()=>{const b=s.current;jne({shown:!!b&&b.getClientRects().length>0,tabVisible:document.visibilityState==="visible",lastSince:d,since:uR(),lastReadAt:u,now:Date.now()})&&p()};g();const v=window.setInterval(g,Nne);document.addEventListener("visibilitychange",g);let k=null;return s.current&&typeof ResizeObserver<"u"&&(k=new ResizeObserver(g),k.observe(s.current)),()=>{o=!1,window.clearInterval(v),document.removeEventListener("visibilitychange",g),k==null||k.disconnect()}},[]),{monthlyUsage:e,monthlyUsageUnavailable:n,monthUsageRef:s}}function eie(e){const[t,n]=w.useState(null);w.useEffect(()=>{const u=et("agent-dag.sound");n(u===null?!0:u==="on")},[]);const r=w.useCallback(()=>{n(u=>{var h;const d=u!==!0;return Xe("agent-dag.sound",d?"on":"off"),d&&((h=e.current)==null||h.unlock()),d})},[]),s=w.useCallback(u=>{r()},[r]),o=xn(s),l=xn(t);return{soundOn:t,toggleSound:r,activateSoundRef:o,soundOnRef:l}}function tie(){const[e,t]=w.useState(!1),n=w.useRef(null),[r,s]=w.useState(!1),o=w.useRef(null);return w.useEffect(()=>{e&&s(!1)},[e]),{soundMenuOpen:e,setSoundMenuOpen:t,soundButtonRef:n,appearanceMenuOpen:r,setAppearanceMenuOpen:s,appearanceButtonRef:o}}const nie="agent-dag.autoFitDisabled";function rie(e){const t=w.useRef(!1),[n,r]=w.useState(!1);w.useEffect(()=>{cs(nie)},[]);const s=w.useCallback(()=>{t.current||(t.current=!0,r(!0))},[]),o=w.useCallback(()=>{t.current=!1,r(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:s,enableAutoFitAndRefit:o}}function sie(){return a.jsx(kb,{children:a.jsx($ae,{children:a.jsx(aie,{})})})}function aie(){const e=mi(),t=w.useState(Sb)[0],n=w.useRef(t),[,r]=w.useState(0),s=w.useCallback(()=>r(Sr=>Sr+1),[]),{detailOpen:o,setDetailOpen:l,usagePanelOpen:u,setUsagePanelOpen:d,machinePanelOpen:h,setMachinePanelOpen:f}=Aoe(),{selectedIds:p,primarySelectedId:g,selectAgent:v,clearSelection:k,pruneSelectionToBoard:b}=CX(n,l),{sessionListOpen:x,accountsPanelOpen:N,toggleSessionList:S,toggleAccountsPanel:_,closeSessionList:E,closeAccountsPanel:T}=Noe(),A=Qoe(),R=Fu(N,200),B=Fu(u,130),P=Fu(h,130),D=w.useRef(null),O=eie(D),{activateSoundRef:L,soundOnRef:z}=O,M=Uoe(D),{setTonePrefs:$,tonePrefsRef:q,previewTone:X}=M,H=qoe({chimesRef:D,setTonePrefs:$,tonePrefsRef:q,previewTone:X}),{customSelectionsRef:I,fallbackCustomRef:W}=H,F=tie(),{setSoundMenuOpen:Y}=F,{chimeState:J}=foe({chimesRef:D,soundOnRef:z,tonePrefsRef:q,customSelectionsRef:I,fallbackCustomRef:W}),V=Lae(n),{pauseGate:G,paused:K,togglePause:Z}=V,ee=w.useRef(()=>{}),{live:re,tabCapped:ue,everConnected:me,liveSince:ae}=wX({stateRef:n,rerender:s,pauseGate:G,chimesRef:D,desktopUpdateRef:ee}),pe=Xoe(re),{version:xe,notice:se,noticeOpen:ve,loadVersion:fe}=pe,he=moe(re),{readyAppUpdate:_e,onDesktopUpdateEvent:Fe}=he;ee.current=Fe,Goe();const Le=Zoe({version:xe,readyAppUpdate:_e}),{tourOpen:Ve,openTour:le,releaseNotes:je}=Le,{workspace:$e,providers:Oe,providersRef:ze}=Dae(re),nt=Boe(xe),it=noe({version:xe,loadVersion:fe}),{upgradeFailure:At}=it,Ue=Doe({stateRef:n,tourOpen:Ve,releaseNotes:je}),{openTool:Ze,setSummaryFor:Je,setContextFor:rt,openContext:gt,setKeyHelpOpen:Rt,setUsageHistoryOpen:yt,setBrowserWatchOpen:lt,keyHelpOpenRef:Qt,modalOpenRef:Pt}=Ue,Dt=Joe(),Ft=soe(),{watchOn:Kt,watchUnseen:qr}=Ft,Un=yoe(),[Ur,zr]=w.useState(0),{presentCats:zn,hiddenCats:mr,toggleCat:Wn,catBarRef:Wr,catBarOccluded:kn}=doe(n),ms=w.useRef(null),[Nn,gr]=w.useState(0),vt=TX({stateRef:n,rerender:s,pruneSelectionToBoard:b,setContextFor:rt,setSummaryFor:Je}),yr=Uae(Oe.claude||Oe.codex),wr=Qae(yr,vt),Hr=voe({enabled:Oe.claude,lanStatus:Un.lanStatus,now:vt}),Hn=goe({now:vt,stateRef:n,version:xe,notice:se,noticeOpen:ve,upgradeFailure:At,paused:V.paused}),{askRestart:fn,loadAutoRestartPrefs:Vr}=Hn,jn=uoe(),{setTheme:we,palette:Be}=jn,We=poe(),en=_ee(),{applyViewport:gs,moveCamera:vr,fitLeft:Vn,cameraEpochRef:Qe,lastFitTimeRef:xr}=en,Gn=Dee(Vn),{pinnedRef:Gr,positionsRef:Kn,lastLayoutSigRef:Ya,handleRelayout:Xa}=Gn,Kr=w.useRef(null),Yt=w.useRef(()=>{}),ra=ae!==null,tn=w.useRef(0),uc=w.useCallback(()=>{tn.current=Date.now()},[]),{canvasRef:Yr,canvasSize:gh,paneSizeRef:Za}=vte(),sa=rie(Vn),{autoFitDisabledRef:ys,disableAutoFit:ws}=sa,Si=w.useRef(!1),{measuredRef:Xr,measuredVersionRef:_i,sizeVersion:dc,domSizeVersion:Ei}=xte(Si),{removedNodes:vs,removedAgentIds:xs,removeNode:Ci,removeSelectedNode:Ge,removalNotice:Ti,bringBack:Ja,bringBackAll:Ai,forgetRemovals:hc}=cte({stateRef:n,pinnedRef:Gr,positionsRef:Kn,canvasRef:Yr,clearSelection:k,primarySelectedId:g}),Qa=ste({stateRef:n,now:vt,removedAgentIds:xs,sizeVersion:dc,domSizeVersion:Ei});Fee(Qa,Gn),lte({layoutSig:Qa,rf:e,stateRef:n,measuredRef:Xr,pinnedRef:Gr,positionsRef:Kn,paneSizeRef:Za,lastInteractRef:tn,autoFitDisabledRef:ys,lastFitTimeRef:xr,fitLeft:Vn});const Ri=bte(),{bubbling:Mi,endBubble:eo,onBubble:br}=kY(),[Sn,kr]=w.useState(!1),bs=xY(),{beginTrashDrag:aa,trackTrashDrag:Nr,endTrashDrag:yh}=bs,$i=RY({stateRef:n,measuredRef:Xr,measuredVersionRef:_i,canvasRef:Yr}),{lodRef:oa,applyZoom:wh}=$i,Ii=yte({applyViewport:gs,lastFitTimeRef:xr,cameraEpochRef:Qe,disableAutoFit:ws,markInteract:uc,canvasRef:Yr,applyZoom:wh}),jr=g?n.current.agents.get(g):null,Oi=o&&jr!=null,{railInsetRef:fc,availableWidth:ks,availableHeight:Ns}=See({canvasRef:Yr,canvasSize:gh,machinePhase:P,usagePhase:B,usagePanelOpen:u,detailShown:Oi}),Zr=ate({stateRef:n,now:vt,availableWidth:ks,availableHeight:Ns,layout:Gn,measuredRef:Xr,onBubble:br,settled:Ri,dragging:Sn,layoutSig:Qa,selectedIds:p,openContext:gt,historyReplayed:ra,removedNodes:vs,removedAgentIds:xs,dragTick:Ur,dragPatchRef:ms,dragMoveTick:Nn}),{nodes:js,edges:vh}=Zr,Li=xn(g);Bee({nodes:js,edges:vh,settled:Ri,dragging:Sn,availableWidth:ks,availableHeight:Ns,layout:Gn,camera:en,rf:e,measuredRef:Xr,stateRef:n,lastFocusRef:Kr,primarySelectedIdRef:Li,focusAgentRef:Yt,autoFitDisabledRef:ys});const to=Foe({stateRef:n,pinnedRef:Gr,measuredRef:Xr,positionsRef:Kn,lastLayoutSigRef:Ya,forgetRemovals:hc,clearSelection:k,rerender:s,modalOpenRef:Pt}),{requestClear:ia}=to,Pi=jte({nodes:js,stateRef:n,pinnedRef:Gr,positionsRef:Kn,draggingRef:Si,dragPatchRef:ms,setDragging:kr,setDragMoveTick:gr,setDragTick:zr,endBubble:eo,markInteract:uc,disableAutoFit:ws,beginTrashDrag:aa,trackTrashDrag:Nr,endTrashDrag:yh,removeNode:Ci}),pc=w.useCallback(()=>Vn(500),[Vn]),_n=xn(js),{focusAgent:Ss,stepAgent:no,focusSession:_s}=Cee({canvasRef:Yr,stateRef:n,measuredRef:Xr,nodesRef:_n,railInsetRef:fc,moveCamera:vr,disableAutoFit:ws,lastFocusRef:Kr,focusAgentRef:Yt,selectAgent:v,primarySelectedIdRef:Li}),ro=wte({clearSelection:k,selectAgent:v,detailOpen:o,setDetailOpen:l,detailShown:Oi,focusAgent:Ss,draggingRef:Si,lodRef:oa}),so=Tee({nodesRef:_n,stateRef:n,canvasRef:Yr,railInsetRef:fc}),mc=xn(Ge),zt=w.useRef(null),Es=w.useCallback(Sr=>{xs.has(Sr)&&Ja([Sr]),_s(Sr)},[xs,Ja,_s]),Di=kte();Nte({pointerFocusRef:Di,nodesRef:_n,stateRef:n,primarySelectedIdRef:Li,providersRef:ze,soundOnRef:z,keyHelpOpenRef:Qt,modalOpenRef:Pt,waitingCursorRef:zt,removeSelectedRef:mc,activateSoundRef:L,clearSelection:k,selectAgent:v,focusAgent:Ss,stepAgent:no,focusSession:_s,requestClear:ia,handleRelayout:Xa,handleFit:pc,togglePause:Z,toggleSessionList:S,toggleAccountsPanel:_,setDetailOpen:l,setUsageHistoryOpen:yt,setUsagePanelOpen:d,setMachinePanelOpen:f,setBrowserWatchOpen:lt,setSoundMenuOpen:Y,setKeyHelpOpen:Rt,setTheme:we});const Cs=n.current.agents.size,la=w.useMemo(()=>fx(n.current.agents.values()),[n.current,n.current.revision]);ute({stateRef:n,waitingSessions:la,removedAgentIds:xs,removedNodes:vs,bringBack:Ja}),pte({stateRef:n,waitingSessions:la,live:re});const ao=Ioe({waitingSessions:la,watchUnseen:qr,incidents:wr}),ca=Loe({waitingSessions:la,liveSince:ae,focusSession:_s}),{loadNotifyPrefs:ua}=ca;return Koe({loadAutoRestartPrefs:Vr,loadNotifyPrefs:ua,loadReportsPrefs:Dt.loadReportsPrefs}),a.jsxs("div",{className:"app",children:[a.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),a.jsxs("header",{className:"topbar",children:[a.jsx(zne,{versionCheck:pe,welcome:Le,desktopUpdate:he,pause:V,monthly:A,announcements:ao,notify:ca,waitingSessions:la,waitingCursorRef:zt,focusSession:_s,live:re,now:vt,incidents:wr}),jr&&a.jsx(Wne,{selected:jr,now:vt,selectedIds:p,focusAgent:Ss,clearSelection:k}),a.jsxs("div",{className:"actions",children:[a.jsx(vne,{sessionListOpen:x,toggleSessionList:S,usagePanelOpen:u,setUsagePanelOpen:d,setUsageHistoryOpen:yt}),a.jsx(xne,{providers:Oe,accountsPanelOpen:N,toggleAccountsPanel:_,machinePanelOpen:h,setMachinePanelOpen:f,watchOn:Kt,watchUnseen:qr,setBrowserWatchOpen:lt}),a.jsx(bne,{providers:Oe,sound:O,tones:M,customTones:H,notify:ca,chimeState:J,menus:F,appearance:jn,fm:We,reports:Dt,onFeedback:()=>Ue.openFeedback()})]})]}),a.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Ti?`${Ti.label} removed from the board.`:""}),a.jsx(lre,{restart:Hn,versionCheck:pe,upgrade:it,oldNameNotice:nt,everConnected:me,live:re,paused:K}),Du(R)&&Oe.claude&&a.jsx(fY,{leaving:R==="leaving",onClose:T,onReport:Ue.openFeedback,onRoster:Hr.observe}),x&&a.jsx(bW,{state:n.current,now:vt,selectedIds:p,onSelect:Es,onClose:E,removedIds:xs,onBringBackAll:Ai}),a.jsxs(Yne,{canvasRef:Yr,bubbling:Mi,dragging:Sn,trash:bs,zoom:$i,viewport:Ii,stateRef:n,peek:so,children:[Cs===0&&(!re&&ue?a.jsx(Mte,{}):a.jsx($te,{live:re,everConnected:me,providers:Oe,workspace:$e,onTour:le})),(zn.length>1||mr.size>0)&&a.jsx(Hne,{catBarRef:Wr,catBarOccluded:kn,presentCats:zn,hiddenCats:mr,toggleCat:Wn}),a.jsx(fW,{graph:Zr,layout:Gn,viewport:Ii,clicks:ro,drag:Pi,appearance:jn,fm:We,autoFit:sa,pause:V,stateRef:n,measuredRef:Xr,hiddenCats:mr,now:vt,openTool:Ze,focusAgent:Ss,requestClear:ia,setKeyHelpOpen:Rt})]}),Du(B)&&a.jsx(mH,{state:n.current,now:vt,providers:Oe,incidents:wr,liveSince:ae,leaving:B==="leaving",onClose:()=>d(!1)}),Du(P)&&a.jsx(JH,{usageOpen:u,leaving:P==="leaving",onClose:()=>f(!1)}),o&&jr?a.jsx(Vte,{selected:jr,now:vt,openTool:Ze,setSummaryFor:Je,setDetailOpen:l,stateRef:n,removeSelectedNode:Ge}):null,a.jsx(_ae,{dialogs:Ue,welcome:Le,desktopUpdate:he,versionCheck:pe,restart:Hn,lanPairs:Un,attention:Hr,clearFlow:to,watchBadge:Ft,announcements:ao,appearance:jn,providers:Oe,stateRef:n,agentCount:Cs})]})}try{v8(window.localStorage)}catch{}const oie=s3.createRoot(document.getElementById("root"));oie.render(a.jsx(sie,{}));export{Ete as a,ot as b,Js as c,md as d,cie as e,qe as f,Ir as g,lie as h,Wl as i,a as j,Pr as k,UY as l,Sa as m,Wa as n,Sx as p,w as r,ir as s,ft as u};
|
package/dist/web/index.html
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
stored === "light" || (stored !== "dark" && light) ? "light" : "dark");
|
|
65
65
|
})();
|
|
66
66
|
</script>
|
|
67
|
-
<script type="module" crossorigin src="/assets/index-
|
|
67
|
+
<script type="module" crossorigin src="/assets/index-Dj4JHRcG.js"></script>
|
|
68
68
|
<link rel="stylesheet" crossorigin href="/assets/index-1U-Iz_x2.css">
|
|
69
69
|
</head>
|
|
70
70
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccdeck",
|
|
3
|
-
"version": "3.36.
|
|
3
|
+
"version": "3.36.3",
|
|
4
4
|
"description": "Local dashboard for Claude Code and Codex CLI sessions: which Claude Code session needs input, every tool call and Claude Code subagent live, token cost and quota, several Claude accounts. Run npx ccdeck.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/release-notes.json
CHANGED
|
@@ -64,6 +64,12 @@
|
|
|
64
64
|
"3.36.0",
|
|
65
65
|
"3.36.1"
|
|
66
66
|
],
|
|
67
|
+
"3.36.3": [
|
|
68
|
+
{
|
|
69
|
+
"title": "🔑 An expired login asks to be signed in again",
|
|
70
|
+
"body": "When an account you added with + → Sign in stops working, the deck now tells you in one dialog, with every affected account together and Sign in again beside each. That opens the usual sign-in with the address already filled in, and the account keeps its slot, its alias and its history. Not now leaves it marked in the Accounts panel and does not ask again until it has worked and stopped again. A paired deck holding a working copy gets to repair it first, and accounts that came from a share or Local network are never asked about."
|
|
71
|
+
}
|
|
72
|
+
],
|
|
67
73
|
"3.34.1": [
|
|
68
74
|
{
|
|
69
75
|
"title": "🗂️ The tray menu stays open while you read it",
|