ccdeck 3.48.0 → 3.48.1
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/README.md +1 -1
- package/dist/web/assets/{BrowserWatchModal-DuopT2Oa.js → BrowserWatchModal-Dfsuy2cT.js} +1 -1
- package/dist/web/assets/{IntegrationModal-CszT-tts.js → IntegrationModal-CcSR7YB-.js} +1 -1
- package/dist/web/assets/{RadioPanel-Cn3WvPUG.js → RadioPanel-s7WXdS6v.js} +1 -1
- package/dist/web/assets/{TrafficRadar-DZA8XSi7.js → TrafficRadar-C5GXMIwi.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-MgZJLXbF.js → UsageHistoryModal-CiExD9wF.js} +1 -1
- package/dist/web/assets/{app-F1xryJpn.js → app-BFaxhiED.js} +6 -6
- package/dist/web/assets/{index-BK9avF1k.js → index-ByovgZ_7.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +2 -1
- package/src/server/deck-prefs.mjs +23 -13
- package/src/server/lan-deck.mjs +2 -1
|
@@ -86,7 +86,7 @@ ${e.sessionTitle}`:e.sessionTitle:e.cwd,h=pN(e),f=g.useRef(null),p=g.useRef(null
|
|
|
86
86
|
spend on this card also covers:
|
|
87
87
|
${h.join(`
|
|
88
88
|
`)}`:Yu(e.model,e.effort)),C=tm(e.sessionName,e.sessionTitle),S=DP(e),_=(S==null?void 0:S.note)??null,$=S?S.key:null,A=xK($),O=S!=null&&!A,M=(_==null?void 0:_.kind)==="recap",W=gG(e);return r.jsxs("div",{className:n,style:{"--session-hue":o},children:[r.jsx("span",{className:"accent-stripe"}),r.jsx(fi,{type:"target",position:Ye.Left,style:{background:"transparent",border:"none"}}),r.jsxs("div",{className:"head",children:[r.jsxs("div",{className:"title",children:[r.jsx(AY,{state:t}),r.jsx("span",{className:"label",title:u,children:e.label}),e.restoredFromLog&&r.jsx("span",{className:"synth-tag",title:e.provider==="claude"?"Restored from Claude’s busy-session registry after verifying the process identity. Earlier tool history is partial.":"Restored from a log with no recorded ending. Process status is not confirmed.",children:"restored"}),e.synthetic&&r.jsx("span",{className:"synth-tag",title:"No SessionStart captured — synthesised",children:"?"}),S&&$&&r.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":M?"Claude Code's recap":_?`Session note: ${rc(_.kind)}`:"Session note: plan","aria-expanded":O,title:M?O?"Hide the recap":"Show Claude Code's recap":_?O?"Hide this note":"Show what this session is doing":O?"Hide the plan":"Show the plan",onClick:q=>{q.stopPropagation(),wK($)},children:r.jsx(sp,{recap:M})})]}),r.jsx("div",{className:"head-right",children:l&&e.onOpenContext&&r.jsx(iK,{currentContextTokens:i,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)})})]}),r.jsxs("div",{className:"sub",title:PG(e),children:[r.jsxs("span",{className:"sub-details",ref:f,children:[N.kind&&r.jsx("span",{children:em(e)}),e.childCount>0&&r.jsxs("span",{className:"spawn-badge",title:OG(e.childCount),children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"&&r.jsxs("span",{className:"sub-folder",ref:p,children:[N.kind?"· ":"",e.cwdBasename]}),e.model?r.jsxs("span",{className:"model-chip","data-family":Zp(e.model),title:x,children:[Jp(e.model,N.effort?e.effort:void 0),h.length>0?` +${h.length}`:""]}):e.provider==="codex"?r.jsx("span",{className:"model-chip",title:"OpenAI Codex — no model reported yet",children:"Codex"}):null]}),r.jsxs("span",{className:"time",title:e.synthetic?`The deck joined this session after it began, so it has run at least this long — first seen ${new Date(e.startedAt).toLocaleTimeString()}`:`Started ${new Date(e.startedAt).toLocaleTimeString()}`,children:[e.synthetic?"≥ ":"",r.jsx(TY,{start:e.startedAt,end:e.endedAt})]})]}),e.kind==="root"&&C.face&&r.jsx("div",{className:"session-name",title:C.tooltip,children:C.face}),e.kind==="root"&&e.stopFailure&&r.jsx(RY,{data:e,stop:e.stopFailure}),e.kind==="root"&&!e.stopFailure&&r.jsx(jY,{data:e}),e.waiting&&!(e.stopFailure&&e.waiting.kind==="idle")&&r.jsx(MY,{waiting:e.waiting}),(()=>{const q=jP(e);return q?r.jsxs("div",{className:"approval-blind-row",title:q.detail,children:[r.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),r.jsx("span",{className:"approval-blind-said",children:q.label})]}):null})(),(()=>{const q=Cr(e.plan);return q&&e.plan?r.jsx(_Y,{plan:q,items:e.plan.items}):null})(),(e.tools.length>0||(((R=e.outputs)==null?void 0:R.length)??0)>0)&&r.jsx($Y,{tools:e.tools,outputs:e.outputs}),r.jsxs("div",{className:"meta",children:[r.jsxs("span",{children:[r.jsx("b",{children:e.toolCount})," ",e.toolCount===1?"tool":"tools"]}),a>0&&r.jsxs("span",{className:"failed-meta",title:`${a} tool ${a===1?"call":"calls"} returned an error`,children:[r.jsx("b",{children:a})," err"]}),s>0&&r.jsxs("span",{className:"inflight-meta",children:[r.jsx("b",{children:s})," in-flight"]}),e.usage.inputTokens+e.usage.outputTokens>0&&r.jsxs("span",{className:"tokens-meta",title:`in:${e.usage.inputTokens} out:${e.usage.outputTokens} cache-r:${e.usage.cacheReadTokens} cache-c:${e.usage.cacheCreateTokens}${(e.usage.reasoningOutputTokens??0)>0?` reasoning:${e.usage.reasoningOutputTokens}`:""}`,children:[r.jsx("b",{children:Ct(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),(W==null?void 0:W.kind)==="unpriced"&&r.jsx("span",{className:"cost-unpriced",title:W.tt,children:ha}),(W==null?void 0:W.kind)==="spent"&&r.jsx("span",{className:"cost-meta",title:W.tt,children:r.jsxs("b",{children:[ct(W.total),W.floor?"+":""]})})]}),r.jsx(EY,{data:e,title:e.kind==="root"?C.face:void 0}),r.jsx(fi,{type:"source",position:Ye.Right,style:{background:"transparent",border:"none"}})]})}const CY=g.memo(SY);function _Y({plan:e,items:t}){return r.jsxs("div",{className:e.allDone?"plan-row plan-done":"plan-row",title:Kp(t),children:[r.jsx("span",{className:"plan-meter","aria-hidden":!0,style:{"--plan-done":e.done/e.total}}),r.jsxs("span",{className:"plan-count",children:[e.done,"/",e.total]}),r.jsx("span",{className:"plan-step",children:e.allDone||!e.current?"done":r.jsxs(r.Fragment,{children:[e.next&&r.jsx("span",{className:"plan-next",children:"next: "}),e.current]})})]})}function EY({data:e,title:t}){const n=e.kind==="root"&&En(e.waiting),s=_K(e,e.branch,{sayWaiting:tp,describeCall:a=>({name:vN(a.name).label,subject:QK(a.name,a.input)})});return r.jsxs("div",{className:"lod-face","data-kind":e.kind,"data-alarm":n?"":void 0,"data-signal":s?"":void 0,"aria-hidden":!0,children:[r.jsxs("div",{className:"lod-id",children:[r.jsx(VP,{kind:C1($l(e))}),r.jsx("span",{className:"lod-name",children:e.label}),s&&r.jsx("span",{className:"lod-inline","data-tone":s.tone,children:s.short}),n&&r.jsx(bN,{})]}),t&&r.jsx("div",{className:"lod-title",children:t}),s&&r.jsxs("div",{className:"lod-signal","data-tone":s.tone,children:[r.jsx("span",{className:"lod-long",children:s.long}),r.jsx("span",{className:"lod-short",children:s.short})]})]})}function TY({start:e,end:t}){const n=_r(1e3);return r.jsx(r.Fragment,{children:Kl(e,t,n)})}function AY({state:e}){return r.jsx("span",{className:`state-pill state-${e}`,children:Vl(e)})}function RY({data:e,stop:t}){return r.jsxs("div",{className:"stop-row",title:MG(t,e.job!=null),"data-kind":t.kind,children:[r.jsx("span",{className:"waiting-dot","aria-hidden":!0}),r.jsx("span",{className:"stop-said",children:SP(t)}),r.jsx(kY,{data:e})]})}function MY({waiting:e}){const t=_r(1e3),n=En(e),s=Gl(e);return r.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
89
|
-
Blocked for ${Kl(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?r.jsx("span",{className:"ap-pulse","aria-hidden":!0}):r.jsx("span",{className:"waiting-dot","aria-hidden":!0}),r.jsx("span",{className:"waiting-said",children:tp(e)}),r.jsx("b",{children:Kl(e.since,void 0,t)})]})}function $Y({tools:e,outputs:t}){const n=_r(1e3),{counts:s,title:a}=rY(e,t,n),o=Xy/Ll;return r.jsxs("div",{className:"tool-spark-row",title:a,children:[r.jsx("svg",{className:"tool-spark",width:Xy,height:Mf,viewBox:`0 0 ${Xy} ${Mf}`,"aria-hidden":!0,children:s.map((i,l)=>{const u=oY(i),h=l===Ll-1&&i>0,p=`tool-spark-bar${i>0?" active":""}${h?" latest":""}`;return r.jsx("rect",{x:l*o+.4,y:Mf-u,width:Math.max(.5,o-1),height:u,rx:.8,className:p},h?`landed:${i}`:l)})}),r.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function LY({enableAutoFitAndRefit:e}){return r.jsxs("div",{className:"autofit-chip",children:[r.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),r.jsx("button",{type:"button",className:"autofit-resume",onClick:e,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]})}const _N="agent-dag.single-key-shortcuts";function nD(e){return e!=="0"}function sD(e){return e.length===1}function IY(e,t){return!t&&sD(e)}function _n(e,t,n){return n?`${e} (${t})`:e}let oi=null;const vu=new Set;function rD(){for(const e of vu)e()}function R1(){return oi===null&&(oi=nD(nt(_N))),oi}function OY(e){oi!==e&&(oi=e,st(_N,e?"1":"0"),rD())}function NT(e){if(e.key!==_N)return;const t=nD(e.newValue);t!==oi&&(oi=t,rD())}function PY(e){var t;return vu.add(e),vu.size===1&&typeof window<"u"&&((t=window.addEventListener)==null||t.call(window,"storage",NT)),()=>{var n;vu.delete(e),vu.size===0&&typeof window<"u"&&((n=window.removeEventListener)==null||n.call(window,"storage",NT))}}function ip(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const ST=99;function DY(e){const t=Math.max(0,Math.floor(e));return t>ST?`${ST}+`:String(t)}const FY="Pause the canvas";function BY(e){const t=e.singleKeys??!0;if(!e.paused)return _n("Pause live updates — events keep arriving and are applied when you resume","Space",t);const n=Math.max(0,Math.floor(e.dropped??0));return n>0?_n(`The pause is full — ${ip(e.held)} held and ${n} older ${n===1?"one":"ones"} already dropped. Resume to follow the canvas again`,"Space",t):e.held<=0?_n("Nothing has arrived since you paused. Resume to follow the canvas again","Space",t):_n(`${ip(e.held)} arrived while paused and will be applied in order when you resume`,"Space",t)}function qY(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const aD="paused · full",UY=(e,t)=>t>0?aD:e>0?`paused · ${DY(e)}`:"paused";function WY(e){const t=Math.max(0,Math.floor(e.dropped??0)),n=e.singleKeys??!0;return e.connected?e.paused?{tone:"paused",resting:!1,label:UY(e.held,t),widest:aD,title:_n(t>0?`Connected — the pause is full at ${ip(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up`:e.held>0?`Connected — ${ip(e.held)} held until you resume`:"Connected — updates held until you resume","Space",n)}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function An(){return g.useSyncExternalStore(PY,R1,R1)}const HY=e=>e.transform[2]>=e.maxZoom,zY=e=>e.transform[2]<=e.minZoom;function VY({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:s,togglePause:a,handleRelayout:o,requestClear:i,setKeyHelpOpen:l}){const u=ec(),h=ht(HY),f=ht(zY),p=An();return r.jsxs(S9,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[r.jsx(ms,{onClick:()=>{h||u.zoomIn()},title:"Zoom in","aria-label":"Zoom in","aria-disabled":h||void 0,children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:r.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),r.jsx(ms,{onClick:()=>{f||u.zoomOut()},title:"Zoom out","aria-label":"Zoom out","aria-disabled":f||void 0,children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:r.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),r.jsx(ms,{onClick:t,title:e?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":e?"":void 0,children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[r.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),r.jsx(ms,{"data-group-start":"",onClick:a,title:BY({paused:n,held:s.size,dropped:s.dropped,singleKeys:p}),"aria-label":FY,"aria-pressed":n,children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:r.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),r.jsx(ms,{onClick:o,title:_n("Auto-arrange — clear pins","R",p),"aria-label":"Re-arrange the canvas",children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[r.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),r.jsx(ms,{"data-group-start":"","data-danger":"",onClick:()=>i("button"),title:_n("Clear the canvas and the server's event log — asks first","C",p),"aria-label":"Clear the canvas",children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[r.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),r.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),r.jsx(ms,{"data-group-start":"",onClick:()=>l(m=>!m),title:p?_n("Keyboard shortcuts","?",!0):"Keyboard shortcuts — the single-key ones are off","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[r.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]})}const GY="modulepreload",KY=function(e){return"/"+e},CT={},bi=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let i=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=i(n.map(h=>{if(h=KY(h),h in CT)return;CT[h]=!0;const f=h.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":GY,f||(m.as="script"),m.crossOrigin="",m.href=h,u&&m.setAttribute("nonce",u),document.head.appendChild(m),f)return new Promise((w,b)=>{m.addEventListener("load",w),m.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return a.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},_T="agent-dag.fm-custom-stations",ET="agent-dag.fm-muted",M1="custom:",YY=/^UC[A-Za-z0-9_-]{22}$/,XY=/^[A-Za-z0-9_-]{11}$/,oD=/^[A-Za-z0-9_-]{1,80}$/,ZY=/\.(mp3|aac|ogg)$/i,JY=/\.m3u8$/i,QY=2048,iD=80;function Xl(e){return`${M1}${e}`}function lm(e){if(!e.startsWith(M1))return null;const t=e.slice(M1.length);return oD.test(t)?t:null}function TT(e){return lm(e)??e}function EN(e){var i,l;const t=e.trim();if(t.length>QY)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!=="https:"||n.username||n.password)return null;const s=n.toString(),a=n.hostname.toLowerCase();if(a==="youtube.com"||a==="www.youtube.com"||a==="m.youtube.com"){if(n.port)return null;const u=(i=/^\/channel\/([^/]+)(?:\/live)?\/?$/.exec(n.pathname))==null?void 0:i[1];if(u&&YY.test(u))return{kind:"youtube-channel",url:s,channel:u};const h=(l=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:l[1];if(h&&/^[A-Za-z0-9._-]{1,64}$/.test(h))return{kind:"youtube-handle",url:s,handle:h};if(n.pathname==="/watch"){const f=n.searchParams.get("v")??"";if(XY.test(f))return{kind:"youtube-video",url:s,video:f}}return null}return JY.test(n.pathname)?{kind:"direct-audio",url:s,format:"hls"}:ZY.test(n.pathname)?{kind:"direct-audio",url:s,format:"audio"}:/\.(html?|pls|m3u)$/i.test(n.pathname)?null:{kind:"direct-audio",url:s,format:"audio"}}function eX(e){return e==="1"}function tX(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];const n=new Set,s=[];for(const a of t){if(!a||typeof a!="object")continue;const o=typeof a.id=="string"?a.id:"",i=typeof a.name=="string"?a.name.trim():"",l=typeof a.url=="string"?a.url.trim():"",u=EN(l);if(!oD.test(o)||n.has(o)||!i||i.length>iD||!u)continue;n.add(o);const h=lD(a.radio);s.push({id:o,name:i,url:u.url,...h?{radio:h}:{}})}return s}function nX(e,t,n){const s=lm(e??"");return s&&t.some(a=>a.id===s)?Xl(s):n(e)}function sX(e,t){return e===Xl(t)?"claude-fm":e}function lD(e){if(!e||typeof e!="object")return null;const t=e,n=(a,o)=>typeof t[a]=="string"?t[a].slice(0,o):"",s=(a,o)=>typeof t[a]=="number"&&Number.isFinite(t[a])&&Math.abs(t[a])<=o?t[a]:null;return{...t.hls===!0?{hls:!0}:{},country:n("country",80),countryCode:n("countryCode",2),region:n("region",80),tags:n("tags",180),language:n("language",80),codec:n("codec",12),bitrate:typeof t.bitrate=="number"&&Number.isFinite(t.bitrate)?Math.max(0,Math.min(1e3,t.bitrate)):0,lat:s("lat",90),lon:s("lon",180)}}const $1="https://www.youtube-nocookie.com";function rX(e,t,n){const s=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${$1}/embed/${n?encodeURIComponent(n):"live_stream"}?${s.toString()}`}function cl(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function aX(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const oX=[1],iX=[0,2],lX=[2,5,100,101,150,153];function cX(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{event:n,info:s}=t;if(n==="onReady")return{kind:"ready"};if(n==="onAutoplayBlocked")return{kind:"blocked"};if(n==="onError"){const a=typeof s=="number"?s:Number(s==null?void 0:s.errorCode);return Number.isFinite(a)?{kind:"error",code:a}:null}if(n==="onStateChange"||n==="infoDelivery"){const a=typeof s=="number"?s:s==null?void 0:s.playerState;return typeof a!="number"||!Number.isFinite(a)?null:oX.includes(a)?{kind:"playing",playing:!0}:a===3?{kind:"buffering"}:iX.includes(a)?{kind:"playing",playing:!1}:null}return null}const ou=new Set;let AT="";function RT(e){const t=new Date().toISOString().slice(0,10);if(t!==AT&&(ou.clear(),AT=t),!ou.has(e)){ou.add(e);try{const n=typeof navigator>"u"?void 0:navigator;(!n||typeof n.sendBeacon!="function"||!n.sendBeacon("/api/feature",JSON.stringify({name:e})))&&ou.delete(e)}catch{ou.delete(e)}}}const MT=864e5,uX=6e4;function an(e,t=!0){g.useEffect(()=>{if(!t)return;RT(e);let n;const s=()=>{n=setTimeout(()=>{RT(e),s()},MT-Date.now()%MT+uX)};return s(),()=>clearTimeout(n)},[e,t])}const dX={"claude-fm":null,"lofi-relax":null,"lofi-game":null,"lofi-vibe":null,"lofi-sleep":null,"radio-mix":"/api/live-radio-mix","best-of-nostalgia":"/api/best-of-nostalgia","good-life-radio":"/api/good-life-radio","cafe-music-bgm":"/api/cafe-music-bgm"};function hX({fetchImpl:e,enabled:t=!0,volume:n,muted:s,source:a,playRequest:o,customStation:i,onAvailabilityChange:l}){var q;const[u,h]=g.useState(null),[f,p]=g.useState(!1),[m,w]=g.useState(!1),[b,k]=g.useState(!1),[v,N]=g.useState(!1);an("claude-fm",b);const x=g.useRef(o),C=g.useRef(null),S=g.useRef(null),_=g.useRef(void 0),$=g.useRef(null),A=g.useCallback(()=>{var F;clearTimeout(_.current),(F=S.current)==null||F.destroy(),S.current=null;const T=C.current;T&&(T.pause(),T.removeAttribute("src"),T.load(),C.current=null)},[]),O=g.useCallback(T=>{var F,D;(D=(F=$.current)==null?void 0:F.contentWindow)==null||D.postMessage(T,$1)},[]),M=g.useRef(n);M.current=n;const W=g.useRef(s);W.current=s;const B=g.useCallback((T,F,D)=>{A();const K=new Audio;K.preload="none",K.volume=M.current/100,K.muted=W.current,C.current=K,w(!0),k(!1),N(!1);let V=!1;const H=()=>C.current===K,P=()=>{clearTimeout(_.current),A(),w(!1),k(!1),N(!1)},I=()=>{H()&&(P(),p(!0),l==null||l(D,!0))},U=z=>{if(H()&&!(z instanceof DOMException&&z.name==="AbortError")){if(z instanceof DOMException&&z.name==="NotAllowedError"){P();return}I()}};_.current=setTimeout(()=>{H()&&!V&&I()},15e3),K.addEventListener("playing",()=>{H()&&(clearTimeout(_.current),V=!0,k(!0),N(!1),l==null||l(D,!1))});const Z=()=>{H()&&(k(!1),N(V),clearTimeout(_.current),_.current=setTimeout(()=>{H()&&I()},15e3))};K.addEventListener("waiting",Z),K.addEventListener("stalled",Z),K.addEventListener("ended",()=>{H()&&P()}),K.addEventListener("error",I,{once:!0}),F&&!K.canPlayType("application/vnd.apple.mpegurl")?bi(async()=>{const{default:z}=await import("./hls-BFpXDghs.js");return{default:z}},[]).then(({default:z})=>{if(!H())return;if(!z.isSupported()){I();return}const X=new z;S.current=X,X.on(z.Events.ERROR,(Y,J)=>{J.fatal&&I()}),X.on(z.Events.MEDIA_ATTACHED,()=>X.loadSource(T)),X.on(z.Events.MANIFEST_PARSED,()=>{K.play().catch(U)}),X.attachMedia(K)},I):(K.src=T,K.play().catch(U))},[l,A]);g.useEffect(()=>{m&&(O(cl("setVolume",[n])),O(cl(s?"mute":"unMute")),C.current&&(C.current.volume=n/100,C.current.muted=s))},[n,s,m,O]),g.useEffect(()=>{var P;let T=!0;const F=e??fetch,D=x.current!==o;if(x.current=o,h(null),p(!1),N(!1),w(D),k(!1),A(),!t){w(!1),k(!1);return}const K=i&&Xl(i.id)===a?EN(i.url):null;if(K){if(K.kind==="direct-audio"){const I=K.format==="hls"||((P=i==null?void 0:i.radio)==null?void 0:P.hls)===!0;return h({live:!0,channel:"",audio:K.url,hls:I}),l==null||l(a,!1),D&&B(K.url,I,a),()=>{T=!1}}return F(`/api/fm-station?url=${encodeURIComponent(K.url)}`).then(I=>I.ok?I.json():null).then(I=>{T&&(I!=null&&I.channel||I!=null&&I.video?(h({live:!0,channel:I.channel??"",video:I.video??void 0}),l==null||l(a,!1)):(p(!0),w(!1),k(!1),N(!1),l==null||l(a,!0)))}).catch(()=>{T&&(p(!0),w(!1),k(!1),N(!1),l==null||l(a,!0))}),()=>{T=!1}}if(lm(a))return p(!0),l==null||l(a,!0),()=>{T=!1};const V=a,H=dX[V];if(H)F(H).then(I=>I.ok?I.json():null).then(I=>{T&&(I!=null&&I.video&&h({live:!0,channel:"",video:I.video}),I!=null&&I.video||(p(!0),w(!1),k(!1)),l==null||l(a,!(I!=null&&I.video)))}).catch(()=>{T&&(p(!0),w(!1),k(!1),l==null||l(a,!0))});else if(V!=="claude-fm"){const I=V.replace("lofi-","");F(`/api/lofi-girl?station=${encodeURIComponent(I)}`).then(U=>U.ok?U.json():null).then(U=>{T&&(U!=null&&U.video&&h({live:!0,channel:"",video:U.video}),U!=null&&U.video||(p(!0),w(!1),k(!1)),l==null||l(a,!(U!=null&&U.video)))}).catch(()=>{T&&(p(!0),w(!1),k(!1),l==null||l(a,!0))})}else F("/api/claude-fm").then(I=>I.ok?I.json():null).then(I=>{if(!T)return;const U=!!(I!=null&&I.live&&(I!=null&&I.channel));U&&h({live:!0,channel:I.channel}),U||(p(!0),w(!1),k(!1)),l==null||l(a,!U)}).catch(()=>{T&&(p(!0),w(!1),k(!1),l==null||l(a,!0))});return()=>{T=!1}},[i==null?void 0:i.id,i==null?void 0:i.url,(q=i==null?void 0:i.radio)==null?void 0:q.hls,t,e,l,o,a,B,A]),g.useEffect(()=>()=>A(),[A]),g.useEffect(()=>{if(!m||u!=null&&u.audio)return;let T;const F=()=>{clearTimeout(T),T=void 0,w(!1),k(!1),N(!1),p(!0),l==null||l(a,!0)},D=()=>{T??(T=setTimeout(F,15e3))};D();const K=V=>{var P;if(V.origin!==$1||V.source!==((P=$.current)==null?void 0:P.contentWindow))return;const H=cX(V.data);if(H){if(H.kind==="ready"){O(cl("setVolume",[M.current])),O(cl(W.current?"mute":"unMute")),O(cl("playVideo"));return}if(H.kind==="blocked"){clearTimeout(T),T=void 0,w(!1),k(!1),N(!1);return}if(H.kind==="buffering"){k(!1),N(!0),D();return}if(H.kind==="playing"){clearTimeout(T),T=void 0,k(H.playing),N(!1),H.playing||w(!1);return}lX.includes(H.code)&&F()}};return window.addEventListener("message",K),()=>{clearTimeout(T),window.removeEventListener("message",K)}},[m,u==null?void 0:u.audio,o,l,O,a]);const R=g.useCallback(()=>{if(u){if(u.audio){if(m){A(),w(!1),k(!1),N(!1);return}B(u.audio,u.hls===!0,a);return}if(!m){w(!0),k(!1),N(!1);return}O(cl("pauseVideo")),w(!1),k(!1),N(!1)}},[u,m,b,a,O,B,A]);return g.useMemo(()=>({probe:u,dead:f,armed:m,playing:b,buffering:v,frame:$,say:O,press:R}),[u,f,m,b,v,O,R])}const $T="agent-dag.radio-favorites",LT="agent-dag.radio-recent",IT="agent-dag.radio-catalogue";function fX(e){if(!Array.isArray(e))return[];const t=new Set;return e.slice(0,300).flatMap(n=>{if(!n||typeof n!="object")return[];const s=n,a=typeof s.id=="string"?s.id:"",o=typeof s.name=="string"?s.name.trim().slice(0,80):"",i=typeof s.url=="string"?EN(s.url):null,l=lD(s.radio??s);return!/^radio-[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(a)||!o||!l||!i||i.kind!=="direct-audio"||t.has(a)?[]:(t.add(a),[{id:a,name:o,url:i.url,radio:l}])})}function OT(e){try{const t=JSON.parse(e??"[]");return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"&&/^[A-Za-z0-9_-]{1,80}$/.test(n)))].slice(0,100):[]}catch{return[]}}function pX(e,t){return[t,...e.filter(n=>n!==t)].slice(0,50)}function rje(e,t,n=Math.random){const s=e.filter(a=>a.id!==t);return s.length?s[Math.min(s.length-1,Math.floor(Math.max(0,n())*s.length))]:null}function aje(e,t,n){if(!e.length)return null;const s=e.findIndex(o=>o.id===t),a=e[s<0?n===1?0:e.length-1:(s+n+e.length)%e.length];return a.id===t?null:a}function cD(e,t,n){const s=e.findIndex(a=>a.id===t);for(let a=1;a<=e.length;a++){const o=e[(s+a)%e.length];if(o.id!==t&&!n.has(o.id))return o}return null}function oje(e,t){if(!e.length)return null;const n=[...e].sort((a,o)=>a.id.localeCompare(o.id));let s=0;for(const a of t)s=Math.imul(s,31)+a.charCodeAt(0)>>>0;return n[s%n.length]}function ije(e,t,n,s,a){return(!t||`${e.name} ${e.radio.country} ${e.radio.region} ${e.radio.tags}`.toLowerCase().includes(t.toLowerCase()))&&(!n||e.radio.countryCode===n)&&(!s||e.radio.tags.toLowerCase().includes(s.toLowerCase()))&&(!a||e.radio.language.toLowerCase().includes(a.toLowerCase()))}function mX(){const[e,t]=g.useState(()=>OT(nt($T))),[n,s]=g.useState(()=>OT(nt(LT))),[a,o]=g.useState(()=>{try{return fX(JSON.parse(nt(IT)??"[]"))}catch{return[]}});g.useEffect(()=>{st($T,JSON.stringify(e))},[e]),g.useEffect(()=>{st(LT,JSON.stringify(n))},[n]);const i=g.useCallback(h=>s(f=>pX(f,h)),[]),l=g.useCallback(h=>t(f=>f.includes(h)?f.filter(p=>p!==h):[...f,h].slice(-100)),[]),u=g.useCallback(h=>{o(h),st(IT,JSON.stringify(h))},[]);return{favorites:e,recent:n,catalogue:a,remember:i,toggleFavorite:l,updateCatalogue:u}}function gX(e,t,n,s){const a=cD(e,t,n);if(!a)return()=>{};const o=setTimeout(()=>{n.add(t),s(a)},1e3);return()=>clearTimeout(o)}const cm=148,PT=6e3,yX=16e3,uD=46,Qa=34;function wX(e,t,n=cm){let s=-Math.round(t()*n);if(Math.abs(s-e)<Qa){const a=e-Qa>=-n?-Qa:Qa;s=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:s,ms:Math.round(Math.abs(s-e)*uD)}}function xX(e){return Math.round(PT+e()*(yX-PT))}const DT=[{kind:"stroll",weight:44},{kind:"tidy",weight:17},{kind:"kick",weight:17},{kind:"sit",weight:12},{kind:"watch",weight:16},{kind:"leave",weight:7},{kind:"fish",weight:12},{kind:"skip",weight:10}];function vX(e){const t=DT.reduce((s,a)=>s+a.weight,0);let n=e()*t;for(const s of DT)if(n-=s.weight,n<0)return s.kind;return"stroll"}const bX=720,kX=260,jX=620,NX=220,FT=520,dD=1600,BT=7e3,SX=15e3,qT=6e3,CX=14e3;function ul(e,t,n=cm){let s=-Math.round(t()*n);if(Math.abs(s-e)<Qa){const a=e-Qa>=-n?-Qa:Qa;s=Math.max(-n,Math.min(0,Math.round(e+a)))}return s}const Qt=(e,t)=>Math.round(Math.abs(t-e)*uD),_X=120,nf=0;function EX(e,t){const n=s=>({kind:"litter",at:t,...s});return[{x:t,prop:n({}),act:"walk",ms:Qt(e,t)},{x:t,prop:n({}),act:"stoop",ms:bX},{x:nf,prop:n({held:!0}),act:"carry",ms:Qt(t,nf)},{x:nf,prop:n({held:!0}),act:"windup",ms:kX},{x:nf,prop:n({held:!0,leaving:!0}),act:"toss",ms:jX}]}function TX(e,t){const n=t>e?1:-1,s=t-n*Math.min(15,Math.abs(t-e)),a=(o={})=>({kind:"ball",at:t,...o});return[{x:s,prop:a(),act:"walk",ms:Qt(e,s)},{x:s,prop:a(),act:"windup",ms:NX,facing:n>0?"right":"left"},{x:s,prop:a({leaving:!0}),act:"kick",ms:FT,facing:n>0?"right":"left"},{x:s,prop:a({leaving:!0}),act:"stand",ms:dD-FT}]}const hD=640;function AX(e,t,n){const s=Math.max(-70,Math.min(-20,t)),a={x:s,prop:null,facing:"left"};return[{x:s,prop:null,act:"walk",ms:Qt(e,s)},{...a,act:"sit",ms:600},{...a,act:"cast",ms:900},{...a,act:"fish",ms:6e3+Math.round(n()*4e3)},{...a,act:"reel",ms:1200},{...a,act:"stow",ms:500},{...a,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:Qt(s,0)}]}function RX(e,t,n){const s=Math.max(-110,Math.min(-30,t)),a={x:s,prop:null};return[{...a,act:"walk",ms:Qt(e,s)},{...a,act:"skip-ready",ms:500},{...a,act:"skip",ms:hD*(6+Math.floor(n()*5))},{...a,act:"skip-rest",ms:600},{...a,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:Qt(s,0)}]}function MX(e,t,n){return[{x:t,prop:null,act:"walk",ms:Qt(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(qT+n()*(CX-qT))},{x:t,prop:null,act:"stand",ms:400}]}function $X(e,t,n){t=Math.max(-110,Math.min(0,t));const s=()=>({kind:"scope",at:t,held:!0});return[{x:t,prop:null,act:"walk",ms:Qt(e,t)},{x:t,prop:s(),act:"watch",ms:Math.round(BT+n()*(SX-BT))},{x:t,prop:s(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function Jy(e,t,n){return e.facing?e.facing:e.act==="watch"||e.act==="scope-pack"?"left":e.x===t?n:e.x>t?"right":"left"}const LX=1500,IX=e=>Math.round(1e3*Math.sqrt(2*e/LX)),OX=115,PX=e=>Math.round(e/OX*1e3),DX=620,FX=200,BX=760,qX=600,UX=240;function WX(e,t,n){const a=-(t.ledgeSpan??cm),o=IX(t.ledgeH),i=PX(t.ledgeH),l=n(),u=n(),h=-Math.round(l*t.floorSpan),f=-Math.round(u*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:Qt(e,a)},{x:a,act:"peer",prop:null,ms:DX},{x:a,act:"fall",prop:null,ms:o,place:"floor"},{x:a,act:"land",prop:null,ms:FX,place:"floor"},{x:h,act:"walk",prop:null,ms:Qt(a,h),place:"floor",floorFrac:l},{x:f,act:"walk",prop:null,ms:Qt(h,f),place:"floor",floorFrac:u},{x:a,act:"walk",prop:null,ms:Qt(f,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:BX,place:"floor"},{x:a,act:"rope-throw",prop:null,ms:qX,place:"floor"},{x:a,act:"rope-catch",prop:null,ms:UX,place:"floor"},{x:a,act:"climb",prop:null,ms:i},{x:a,act:"pull-up",prop:null,ms:480}]}function HX(e,t,n){const s=(n==null?void 0:n.ledgeSpan)??cm;switch(vX(t)){case"tidy":return EX(e,ul(e,t,s));case"kick":return TX(e,ul(e,t,s));case"sit":return MX(e,ul(e,t,s),t);case"watch":return $X(e,ul(e,t,s),t);case"fish":return AX(e,ul(e,t,s),t);case"skip":return RX(e,ul(e,t,s),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return WX(e,n,t)}}const o=wX(e,t,s);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const zX=420;function VX(e,t,n){const s=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(zX,Math.max(0,s))}const GX=260,KX=200;function YX(e,t,n){const s=(f,p=Qt(e,f))=>({x:f,prop:null,act:"walk",ms:p,place:"floor"});if(!n||n.height<=0)return[s(t)];const a=Math.min(e,t);if(Math.max(e,t)<=n.left||a>=n.right)return[s(t)];const i=t>e,l=i?n.left:n.right,u=i?n.right:n.left,h={place:"floor",riser:n.height,prop:null};return[s(l,Qt(e,l)),{...h,x:l,act:"mount",ms:GX},{...h,x:u,act:"walk",ms:Qt(l,u)},{x:u,prop:null,act:"dismount",ms:KX,place:"floor"},{x:t,prop:null,act:"walk",ms:Qt(u,t),place:"floor"}]}const fD=["bob","sway","groove"],UT=9e3,XX=16e3,pD=1e3,ZX=.08;function JX(e,t){const n=fD.filter(o=>o!==e),s=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*ZX;return{dance:s,beatMs:Math.round(pD*(1+a))}}function QX(e){return Math.round(UT+e()*(XX-UT))}const TN=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],WT=18,eZ=TN.length,mD="M6 9H4V1H5V0H7V-1H9V1H7V2H5V7H6V8H7V9Z",gD="M12 9H14V6H13V3H11V2H9V4H12Z",AN=new Set(["a","c","p"]);function fo(e=TN){const t=[];return e.forEach((n,s)=>{let a=0;for(;a<n.length;){const o=n[a];if(o==="."){a+=1;continue}let i=1;for(;a+i<n.length&&n[a+i]===o;)i+=1;t.push({x:a,y:s,w:i,cell:o}),a+=i}}),t}const tZ=[".xx.","xxxx",".xx."],nZ=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],sZ=["...xx...............","..xaax..............",".xaallx.............","xaallllx............",".xllllllx...........","..xllllllx..........","...xllllllx.........","....xllllllxx.......",".....xllllxsxx..xx..","......xllxsssx.xllxx",".......xxssssxxxllxx","........xssssssxx...",".........xssssx.....","..........xxxx......","..........xax.......",".........xxxxx......","........xx.x.xx.....","........xl.x.lx.....",".......xl..x..lx....",".......xl..x..lx....","......xl...x...lx...","......xl...x...lx...",".....xl....x....lx..","....xxx...xxx...xxx."],Qy={litter:tZ,ball:nZ,scope:sZ},rZ=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],aZ=3,oZ=-1,L1=11,HT=9;function zT(e){let t=null,n=null,s=0,a=0,o=!1;const i=()=>{t!==null&&clearTimeout(t),t=null},l=()=>{o||e.hidden||!n||t!==null||(a=performance.now(),t=setTimeout(()=>{t=null;const h=n;n=null,h==null||h()},s))},u=()=>{e.hidden&&t!==null?(s=Math.max(0,s-(performance.now()-a)),i()):e.hidden||l()};return e.addEventListener("visibilitychange",u),{schedule(h,f){o||(i(),n=h,s=Math.max(0,f),l())},dispose(){o=!0,i(),n=null,e.removeEventListener("visibilitychange",u)}}}function iZ(e,t,n){const[s,a]=g.useState(0),[o,i]=g.useState(0),[l,u]=g.useState(null),[h,f]=g.useState(null),[p,m]=g.useState({x:0,drop:0}),[w,b]=g.useState("ledge"),[k,v]=g.useState("left"),[N,x]=g.useState(0),C=g.useRef(null),[S,_]=g.useState(()=>document.hidden);g.useEffect(()=>{const R=new Set,q=()=>{var T;if(document.hidden){for(const F of((T=C.current)==null?void 0:T.getAnimations({subtree:!0}))??[])if(F.playState==="running"||F.pending){const D=F.currentTime;F.pause(),D!==null&&(F.currentTime=D),R.add(F)}}else{for(const F of R)F.playState==="paused"&&F.play();R.clear()}_(document.hidden)};return q(),document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[e,t]);const[$,A]=g.useState(null),[O,M]=g.useState(pD),[W,B]=g.useState(()=>{var R;return((R=window.matchMedia)==null?void 0:R.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return g.useEffect(()=>{var T;const R=(T=window.matchMedia)==null?void 0:T.call(window,"(prefers-reduced-motion: reduce)");if(!R)return;const q=()=>B(R.matches);return q(),R.addEventListener("change",q),()=>R.removeEventListener("change",q)},[]),g.useEffect(()=>{var J;if(!e||t||W)return;const R=zT(document);let q=0;a(Q=>q=Q);let T=null,F=0,D=0;const K=Q=>{var re,he;const[te,...le]=Q;if(!te){T=null,u(null),f(null),z();return}u(te.act),f(te.prop),b(te.place??"ledge"),x(te.riser??0);const de=q,oe=U(te);if(te.act==="kick"){const pe=(he=(re=C.current)==null?void 0:re.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:he.getBoundingClientRect();pe&&m({x:VX(pe.x,Jy(te,de,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-pe.y+24)})}D=te.act==="walk"?Math.max(Qt(de,oe),_X):te.ms,te.act==="carry"&&(D=Qt(de,oe)),i(D),v(pe=>Jy({...te,x:oe},de,pe)),a(oe),q=oe,T=te,F=Date.now(),R.schedule(()=>K(le),D)},V=()=>{const Q=C.current,te=Q==null?void 0:Q.querySelector(".fm-sprite"),le=Q==null?void 0:Q.parentElement;if(!Q||!te||!le)return null;const de=Q.getBoundingClientRect(),oe=le.getBoundingClientRect(),re=oe.right-de.right,he=oe.width-re*2-te.offsetWidth;return he>0?he:null},H=()=>{const Q=C.current,te=Q==null?void 0:Q.querySelector(".fm-sprite");return!Q||!te?0:Math.max(0,Q.getBoundingClientRect().width-te.offsetWidth)},P=()=>{const Q=C.current,te=Q==null?void 0:Q.querySelector(".fm-walker"),le=V();if(!Q||!te||le==null)return;const de=Q.getBoundingClientRect().bottom-te.getBoundingClientRect().bottom;if(de>0)return{ledgeH:de,floorSpan:le,ledgeSpan:H()}},I=()=>{const Q=C.current,te=document.querySelector(".canvas-notices");if(!Q||!te)return null;const le=Q.getBoundingClientRect(),de=te.getBoundingClientRect();return de.width<=0||de.height<=0?null:{left:de.left-le.right,right:de.right-le.right,height:de.height}},U=Q=>{const te=(Q.place??"ledge")==="floor",le=te?V()??H():H(),de=te&&Q.floorFrac!=null?-Math.round(Q.floorFrac*le):Q.x;return Math.max(-le,Math.min(0,de))},Z=()=>{if(!T)return;const Q=U(T);Q!==q&&(i(Math.max(0,F+D-Date.now())),v(te=>Jy({...T,x:Q},q,te)),a(Q),q=Q)},z=()=>{R.schedule(()=>{const Q=HX(q,Math.random,P()),te=Q.some(oe=>oe.place==="floor")?I():null;let le=q;const de=Q.flatMap(oe=>{const re=le;if(le=oe.x,!(oe.place==="floor"&&oe.act==="walk"))return[oe];const he=YX(re,oe.x,te),pe=he.length-1;return oe.floorFrac==null?he:he.map((Le,ge)=>ge===pe?{...Le,floorFrac:oe.floorFrac}:Le)});K(de)},xX(Math.random))},X=(J=C.current)==null?void 0:J.parentElement,Y=typeof ResizeObserver>"u"?null:new ResizeObserver(Z);return X&&Y&&Y.observe(X),z(),()=>{R.dispose(),Y==null||Y.disconnect(),b("ledge"),a(Q=>Math.max(-H(),Math.min(0,Q))),i(0),u(null),f(null),x(0)}},[e,t,W]),g.useEffect(()=>{if(!n||W){A(null);return}const R=zT(document),q=T=>{const F=JX(T,Math.random);A(F.dance),M(F.beatMs),R.schedule(()=>q(F.dance),QX(Math.random))};return q(null),()=>R.dispose()},[n,W]),{scene:C,suspended:S,x:s,walkMs:o,act:l,prop:h,ballFlight:p,place:w,facing:k,riser:N,dance:$,beatMs:O}}const ew={e:"fm-eye",s:"fm-shade",p:"fm-pad"},lp=fo().filter(e=>!AN.has(e.cell)),lZ=fo().filter(e=>AN.has(e.cell)),VT=lp.filter(e=>e.cell==="e"),cZ=fo(rZ),uZ=lp.filter(e=>e.y<L1&&e.cell!=="e").map(e=>{if(e.y!==8&&e.y!==9)return e;const t=Math.max(6,e.x);return{...e,x:t,w:Math.max(0,Math.min(12,e.x+e.w)-t)}}).filter(e=>e.w>0),dZ={left:lp.filter(e=>e.y>=L1&&e.x<HT),right:lp.filter(e=>e.y>=L1&&e.x>=HT)},hZ=g.memo(function({act:t,facing:n}){return r.jsxs("svg",{viewBox:`0 0 ${WT} ${eZ}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:lZ.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:ew[s.cell]},`g${s.y}-${s.x}`))})}),r.jsxs("g",{className:"fm-body",children:[VT.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,fill:"var(--accent)"},`eye-bed-${s.x}`)),uZ.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:ew[s.cell]},`b${s.y}-${s.x}`)),r.jsxs("g",{className:"fm-arms",children:[r.jsx("rect",{x:4,y:8,width:2,height:2}),r.jsx("rect",{x:12,y:8,width:1,height:2}),r.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),VT.map(s=>r.jsx("rect",{x:s.x-(s.x>=WT/2?1:0)+(n==="right"?1:0),y:s.y,width:s.w,height:1,className:"fm-eye"},`eye-${s.x}`))]}),r.jsx("g",{className:"fm-hat",children:cZ.map(s=>r.jsx("rect",{x:aZ+s.x,y:oZ+s.y,width:s.w,height:1,className:s.cell==="k"?"fm-hatband":void 0},`h${s.y}-${s.x}`))}),(t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up")&&r.jsxs("g",{className:"fm-grip",children:[r.jsx("path",{className:"fm-grip-left",d:mD}),r.jsx("path",{className:"fm-grip-right",d:gD})]}),(t==="land"||t==="dismount")&&r.jsxs("g",{className:"fm-crouch-legs",children:[r.jsx("path",{d:"M6 11H8V13H6Z"}),r.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(t)&&r.jsxs("g",{className:"fm-seated-legs",children:[r.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),r.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(s=>r.jsx("g",{className:"fm-leg","data-side":s,children:dZ[s].map(a=>r.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:ew[a.cell]},`${s}${a.y}-${a.x}`))},s))]})}),fZ=["...o........o.....","...of......fo.....","...owffffffwo.....","...offfffffso.....","...ofefffefso.....","....owwnwwso......",".....wwwww........",".....fwwwfs.......","....ffwwwffs...ww.","....ffwwwffs..wfs.","......fwwfssfffs..","......ff..fsffs...","......ff..fs......","......oo..oo......"],pZ=[".....aaaaaaa......","...aa.......aa....","..a...........a...","..cp.........pc...","..cp.........pc...","..cp.........pc...","..c...........c..."],fr={f:"#d88735",s:"#a55b24",o:"#63351e",w:"#ffe2aa",n:"#372821"},mZ={p:"fm-pad"},Xu=fo(fZ),gZ=fo(pZ);function I1(e,t,n){return e.map(s=>({...s,x:Math.max(t,s.x),w:Math.max(0,Math.min(n,s.x+s.w)-Math.max(t,s.x))})).filter(s=>s.w>0)}const yZ=I1(Xu.filter(e=>e.y>=8),12,18),wZ=Xu.filter(e=>e.y<11&&e.cell!=="e").map(e=>e.y===8||e.y===9?{...e,x:Math.max(6,e.x),w:Math.max(0,Math.min(12,e.x+e.w)-Math.max(6,e.x))}:e.y===10?{...e,w:Math.max(0,Math.min(12,e.x+e.w)-e.x)}:e).filter(e=>e.w>0),GT=Xu.filter(e=>e.cell==="e"),xZ={left:I1(Xu.filter(e=>e.y>=11),0,9),right:I1(Xu.filter(e=>e.y>=11),9,12)},vZ=g.memo(function({act:t,facing:n}){const s=t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up",a=t==="land"||t==="dismount",o=t==="sit"||t==="cast"||t==="fish"||t==="reel"||t==="stow";return r.jsxs("svg",{"data-character":"fox",viewBox:"0 0 18 14",shapeRendering:"crispEdges","aria-hidden":!0,focusable:"false",children:[r.jsx("g",{className:"fm-body","data-part":"tail",children:yZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:fr[i.cell]},`t${i.y}-${i.x}`))}),r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:gZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,className:mZ[i.cell]},`g${i.y}-${i.x}`))})}),r.jsxs("g",{className:"fm-body",children:[wZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:fr[i.cell]},`b${i.y}-${i.x}`)),GT.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:fr.f},`bed${i.x}`)),r.jsxs("g",{className:"fm-arms",fill:fr.f,children:[r.jsx("rect",{x:4,y:8,width:2,height:2}),r.jsx("rect",{x:12,y:8,width:1,height:2})]}),GT.map(i=>r.jsx("rect",{x:i.x+(n==="right"?1:0)-(i.x>=9?1:0),y:i.y,width:i.w,height:1,className:"fm-eye",style:{fill:fr.n}},`e${i.x}`))]}),s&&r.jsxs("g",{className:"fm-grip",style:{fill:fr.f},children:[r.jsx("path",{className:"fm-grip-left",d:mD}),r.jsx("path",{className:"fm-grip-right",d:gD})]}),a&&r.jsxs("g",{className:"fm-crouch-legs",style:{fill:fr.f},children:[r.jsx("path",{d:"M6 11H8V13H6Z"}),r.jsx("path",{d:"M10 11H12V13H10Z"})]}),o&&r.jsxs("g",{className:"fm-seated-legs",style:{fill:fr.f},children:[r.jsx("path",{className:"fm-seated-far",style:{fill:fr.s},d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),r.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(i=>r.jsx("g",{className:"fm-leg","data-side":i,children:xZ[i].map(l=>r.jsx("rect",{x:l.x,y:l.y,width:l.w,height:1,fill:fr[l.cell]},`${l.y}-${l.x}`))},i))]})}),bZ=[".......dddd.......","......dhhhhd......",".....dhhhhhhd.....","....dhwwhhwwhd....","....dhwewwewhd....","....dhwwbbwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....",".....dhwwwwhd.....",".....dhwwwwhd.....","......dhhhhd......","......bb..bb......",".....bbb..bbb....."],Jr={d:"#3b4855",h:"#657b8b",w:"#f4f0df",e:"#19242b",b:"#f0b44b",s:"#c88736"},kZ={p:"fm-pad"},cp=fo(bZ),jZ=fo(TN).filter(e=>AN.has(e.cell)),KT=cp.filter(e=>e.cell==="e"),NZ=cp.filter(e=>e.y<12&&e.cell!=="e"),SZ={left:cp.filter(e=>e.y>=12&&e.x<9),right:cp.filter(e=>e.y>=12&&e.x>=9)},CZ=g.memo(function({act:t}){const n=t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up",s=t==="land"||t==="dismount",a=t==="sit"||t==="cast"||t==="fish"||t==="reel"||t==="stow";return r.jsxs("svg",{"data-character":"penguin",viewBox:"0 0 18 14",shapeRendering:"crispEdges","aria-hidden":!0,focusable:"false",children:[r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:jZ.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:kZ[o.cell]},`g${o.y}-${o.x}`))})}),r.jsxs("g",{className:"fm-body",children:[NZ.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Jr[o.cell]},`b${o.y}-${o.x}`)),KT.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Jr.w},`bed${o.x}`)),r.jsxs("g",{className:"fm-arms",fill:Jr.d,children:[r.jsx("path",{d:"M4 8H6V10H5V11H4Z"}),r.jsx("path",{d:"M12 8H14V11H13V10H12Z"})]}),KT.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:"fm-eye",style:{fill:Jr.e}},`e${o.x}`))]}),n&&r.jsxs("g",{className:"fm-grip",style:{fill:Jr.h},children:[r.jsx("path",{className:"fm-grip-left",d:"M5 10H4V4H5V2H6V1H7V0H9V2H7V3H6V10Z"}),r.jsx("path",{className:"fm-grip-right",d:"M12 10H14V6H13V3H11V2H9V4H12Z"})]}),s&&r.jsxs("g",{className:"fm-crouch-legs",style:{fill:Jr.b},children:[r.jsx("path",{d:"M5 12H8V13H5Z"}),r.jsx("path",{d:"M10 12H13V13H10Z"})]}),a&&r.jsxs("g",{className:"fm-seated-legs",style:{fill:Jr.b},children:[r.jsx("path",{className:"fm-seated-far",style:{fill:Jr.s},d:"M10 11H12V12H13V14H10V13H11V12H10Z"}),r.jsx("path",{d:"M6 11H8V12H7V13H8V14H4V13H5V12H6Z"})]}),["left","right"].map(o=>r.jsx("g",{className:"fm-leg","data-side":o,children:SZ[o].map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:Jr.b},`${i.y}-${i.x}`))},o))]})});function yD({character:e,act:t,facing:n}){return e==="penguin"?r.jsx(CZ,{act:t,facing:n}):e==="fox"?r.jsx(vZ,{act:t,facing:n}):r.jsx(hZ,{act:t,facing:n})}const _Z={"claude-fm":"Claude FM","lofi-relax":"Lofi Girl relax/study","lofi-game":"Lofi Girl chill/game","lofi-vibe":"Lofi Girl vibe/chill","lofi-sleep":"Lofi Girl sleep/chill","radio-mix":"Radio Mix Live","best-of-nostalgia":"Best of Nostalgia Live","good-life-radio":"The Good Life Radio Live","cafe-music-bgm":"Cafe Music BGM Live"};function wD(e,t){return t&&Xl(t.id)===e?t.name:lm(e)?"Custom FM":_Z[e]}function tw(e,t){var s;const n=((s=e[0])==null?void 0:s.length)??0;return r.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:fo(e).map(a=>r.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:a.cell==="s"?"var(--fm-prop-shadow, var(--bg))":a.cell==="l"?"var(--fm-prop-light, var(--text))":a.cell==="a"?"var(--accent)":void 0},`${t}${a.y}-${a.x}`))})}const YT={litter:tw(Qy.litter,"litter"),ball:tw(Qy.ball,"ball"),scope:tw(Qy.scope,"scope")};function EZ(e){try{return new URL(e).host}catch{return"the station's server"}}const TZ=g.memo(function({player:t,source:n,customStation:s,character:a="deck"}){const{probe:o,dead:i,playing:l,press:u}=t,{scene:h,suspended:f,x:p,walkMs:m,act:w,prop:b,ballFlight:k,place:v,facing:N,riser:x,dance:C,beatMs:S}=iZ(o,i,l);if(!o||i)return null;const _=wD(n,s),$=o.audio?EZ(o.audio):"YouTube";return r.jsxs("div",{ref:h,className:"fm","data-suspended":f?"":void 0,"data-place":v,style:{"--fm-beat":`${S}ms`},children:[b&&!b.held&&r.jsx("div",{className:"fm-prop","data-prop":b.kind,"data-leaving":b.leaving?"":void 0,style:{"--fm-prop-x":`${b.at}px`,"--fm-roll-to":`${k.x}px`,"--fm-ball-drop":`${k.drop}px`,"--fm-ball-flight-ms":`${dD}ms`,"--fm-ball-turn":N==="right"?"1080deg":"-1080deg"},children:YT[b.kind]}),(w==="lasso"||w==="rope-throw"||w==="rope-catch"||w==="climb"||w==="pull-up")&&r.jsxs("div",{className:"fm-rope","data-act":w,style:{"--fm-rope-x":`${p}px`,"--fm-rope-ms":`${m}ms`},children:[r.jsx("div",{className:"fm-rope-line"}),r.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),r.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),r.jsxs("div",{className:"fm-walker","data-act":w??void 0,"data-place":v,"data-facing":N,style:{"--fm-x":`${p}px`,"--fm-walk-ms":`${m}ms`,"--fm-riser":`${x}px`,"--fm-skip-beat":`${hD}ms`},children:[(b==null?void 0:b.held)&&r.jsx("div",{className:"fm-held","data-prop":b.kind,"data-toss":b.leaving?"":void 0,children:YT[b.kind]}),["cast","fish","reel","stow"].includes(w)&&r.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsxs("g",{children:[r.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),r.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),r.jsxs("g",{className:"fm-fishing-line",children:[r.jsx("path",{d:"M8 2V26"}),r.jsxs("g",{className:"fm-float",children:[r.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),r.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),r.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(w)&&r.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),r.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),r.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),r.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),r.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),r.jsx("button",{type:"button",className:"fm-sprite","data-playing":l?"":void 0,"data-dance":l?C??fD[0]:void 0,onClick:u,title:l?`Stop ${_}`:`Play ${_} — streams from ${$}`,"aria-label":l?`Stop ${_}`:`Play ${_}`,children:r.jsx(yD,{character:a,act:w,facing:N})})]})]})});function AZ({player:e,label:t}){const{probe:n,armed:s,frame:a,say:o}=e;return n?r.jsx(r.Fragment,{children:s&&!n.audio&&(n.channel||n.video)&&r.jsx("iframe",{ref:a,className:"fm-frame",title:t,src:rX(n.channel,window.location.origin,n.video),onLoad:()=>o(aX()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})}):null}const RZ={radio:"M4 8h16v12H4z M7 8l10-5 M7 12h5 M15 12h2 M7 16h2 M13 16h4",play:"M8 5l11 7-11 7z",pause:"M8 5v14 M16 5v14",shuffle:"M3 6h3c5 0 7 12 12 12h3 M17 14l4 4-4 4 M3 18h3c2 0 4-3 6-6s4-6 6-6h3 M17 2l4 4-4 4",heart:"M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1.1-1.1a5.5 5.5 0 0 0-7.8 7.8L12 21l8.8-8.6a5.5 5.5 0 0 0 0-7.8z",close:"M6 6l12 12 M6 18L18 6",search:"M10.5 3a7.5 7.5 0 1 0 0 15 7.5 7.5 0 0 0 0-15 M16 16l5 5",globe:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20 M2 12h20 M12 2c-6 6-6 14 0 20 M12 2c6 6 6 14 0 20",back:"M16 5l-7 7 7 7",previous:"M5 5v14 M19 5l-10 7 10 7z",next:"M19 5v14 M5 5l10 7-10 7z",volume:"M11 4L6 8H3v8h3l5 4z M15 8a6 6 0 0 1 0 8 M18 5a10 10 0 0 1 0 14",muted:"M11 4L6 8H3v8h3l5 4z M16 9l6 6 M16 15l6-6",headphones:"M4 14v-3a8 8 0 0 1 16 0v3 M4 12h3v8H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 1-2 M20 12h-3v8h2a2 2 0 0 0 2-2v-4a2 2 0 0 0-1-2",book:"M12 6v15 M12 6C9 4 6 3 3 4v15c3-1 6 0 9 2 3-2 6-3 9-2V4c-3-1-6 0-9 2",gamepad:"M8 7h8c3 0 4 2 5 8 1 5-2 6-5 2H8c-3 4-6 3-5-2 1-6 2-8 5-8z M6 11h4 M8 9v4 M16 10h.01 M18 13h.01",sunset:"M3 17h18 M5 21h14 M7 17a5 5 0 0 1 10 0 M12 3v3 M4 8l2 2 M20 8l-2 2",moon:"M20 14A9 9 0 0 1 10 3a9 9 0 1 0 10 11z",cassette:"M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z M7 8h10v5H7z M7 20l2-4h6l2 4 M9 10.5h.01 M15 10.5h.01",palm:"M12 8c2 4 3 8 2 13 M12 8C8 3 4 4 2 8c4-1 7-1 10 0 M12 8c1-6 6-7 10-2-4-1-7 0-10 2 M12 8c-5 0-7 3-7 7 2-3 4-5 7-7 M12 8c4 0 7 3 7 7-2-3-4-5-7-7 M10 21h8",coffee:"M4 8h12v8a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4z M16 9h2a3 3 0 0 1 0 6h-2 M7 3v2 M11 3v2 M3 22h15",check:"M5 12l4 4L19 6",filters:"M4 6h4 M12 6h8 M4 12h10 M18 12h2 M4 18h2 M10 18h10 M8 4v4 M14 10v4 M6 16v4"};function MZ({name:e}){return r.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:RZ[e]})})}function $Z({opening:e=!1}){const[t,n]=g.useState(()=>document.hidden);return g.useEffect(()=>{const s=()=>n(document.hidden);return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[]),r.jsxs("div",{className:"radio-tuning",role:"status","data-paused":t||void 0,children:[r.jsxs("svg",{className:"radio-tuning-art",viewBox:"0 0 240 112",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsxs("g",{className:"radio-tuning-tower",children:[r.jsx("circle",{cx:"40",cy:"24",r:"4"}),r.jsx("path",{d:"M40 28v60 M40 36L24 88h32L40 36 M31 66h18 M28 77h24 M20 92h40"}),r.jsx("path",{d:"M29 17a15 15 0 0 0 0 14 M51 17a15 15 0 0 1 0 14"})]}),r.jsxs("g",{className:"radio-tuning-send",children:[r.jsx("path",{d:"M75 26q7 8 0 16"}),r.jsx("path",{d:"M102 26q7 8 0 16"}),r.jsx("path",{d:"M129 26q7 8 0 16"})]}),r.jsxs("g",{className:"radio-tuning-receiver",children:[r.jsx("path",{d:"M165 49l30-22"}),r.jsx("rect",{x:"154",y:"49",width:"66",height:"43",rx:"7"}),r.jsx("path",{d:"M161 92v3 M213 92v3 M163 60h17 M163 66h17 M163 72h17 M163 78h17"}),r.jsx("circle",{cx:"202",cy:"65",r:"7"}),r.jsx("path",{d:"M202 62v3l3 2 M197 81h10"})]})]}),r.jsx("strong",{children:e?"Opening Radio":"Tuning into the world"}),r.jsx("span",{children:e?"Getting your explorer ready…":"Finding stations…"})]})}function LZ({onClose:e}){const[t]=g.useState(()=>{var s;return((s=document.activeElement)==null?void 0:s.matches(":focus-visible"))??!1}),n=gt(e);return r.jsxs("div",{ref:n,className:"radio-loading nodrag nopan",role:"dialog","aria-modal":"true","aria-label":"Opening Radio","data-keyboard-interaction":t||void 0,onKeyDown:KG,children:[r.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close radio",onClick:e,children:r.jsx(MZ,{name:"close"})}),r.jsx($Z,{opening:!0})]})}const IZ=g.lazy(()=>bi(()=>import("./RadioPanel-Cn3WvPUG.js"),[]));function OZ({fm:e,characterEnabled:t,character:n,open:s,onClose:a}){const[o,i]=g.useState(!1),[l,u]=g.useState("Connecting to the deck…"),h=mX(),[f,p]=g.useState(null),m=g.useRef(new Set);g.useEffect(()=>{const A=new AbortController;return fetch("/api/music-config",{signal:A.signal}).then(O=>O.ok?O.json():null).then(O=>{A.signal.aborted||(i((O==null?void 0:O.enabled)===!0),u(O?"Music is turned off on this deck.":"Cannot reach the deck. Reopen Radio when it reconnects."))}).catch(()=>{A.signal.aborted||u("Cannot reach the deck. Reopen Radio when it reconnects.")}),()=>A.abort()},[s]);const w=e.customFmStations.find(A=>Xl(A.id)===e.fmSource),b=w!=null&&w.radio?w:void 0,k=hX({volume:e.fmVolume,muted:e.fmMuted,source:e.fmSource,playRequest:e.fmPlayRequest,customStation:w,enabled:o,onAvailabilityChange:e.markFmStationAvailability}),v=wD(e.fmSource,w),N=o&&b&&k.dead&&e.fmPlayRequest>0?cD(f??h.catalogue,b.id,m.current):null,{remember:x}=h,C=(w==null?void 0:w.id)??e.fmSource;g.useEffect(()=>{k.playing&&x(C)},[C,k.playing,x]);const S=a,_=yt(a),$=g.useCallback((A,O=!1)=>{var R;if(!o)return;O||m.current.clear();const M=Xl(A.id),W=M===e.fmSource;if(W&&k.armed&&!k.dead){k.press();return}const B=W&&!!w&&(w.url!==A.url||((R=w.radio)==null?void 0:R.hls)!==A.radio.hls);e.addFmStation(A,!0),W&&!k.dead&&!B?k.press():e.pickFmSource(M,B),fetch(`/api/radio-click?id=${encodeURIComponent(A.id)}`).catch(()=>{})},[o,w,e.addFmStation,e.fmSource,e.pickFmSource,k.armed,k.dead,k.press]);return g.useEffect(()=>{k.playing&&!k.dead&&m.current.clear()},[k.playing,k.dead]),g.useEffect(()=>{if(!(!o||!b||!k.dead||e.fmPlayRequest===0))return gX(f??h.catalogue,b.id,m.current,A=>$(A,!0))},[o,b==null?void 0:b.id,k.dead,e.fmPlayRequest,f,h.catalogue,$]),r.jsxs(r.Fragment,{children:[t&&r.jsx(TZ,{character:n,player:k,source:e.fmSource,customStation:w}),r.jsx(AZ,{player:k,label:v}),s&&vt.createPortal(r.jsx("div",{className:"modal-backdrop radio-backdrop",..._,children:r.jsx(g.Suspense,{fallback:r.jsx(LZ,{onClose:S}),children:r.jsx(IZ,{fm:e,player:k,library:h,selected:b,label:v,enabled:o,disabledReason:l,autoNext:N==null?void 0:N.name,onPick:$,onQueueChange:p,onClose:S})})}),document.body)]})}function PZ({data:e}){const t=_r(3e4),n=e.note,s=e.plan??null,a=(n==null?void 0:n.kind)==="recap",o=ap((n==null?void 0:n.at)??(s==null?void 0:s.at)??t,t),i=`${a?"recap-note":`recap-note is-status status-${(n==null?void 0:n.kind)??"plan"}`}${s?" has-plan":""}`,l=a||!n?void 0:am(n),u=Cr(s),h=n?rc(n.kind):`plan ${u?`${u.done}/${u.total}`:""}`.trim();return r.jsxs("div",{className:i,role:"note","aria-label":a?"Claude Code's recap":`Session note: ${h}`,"aria-description":l,style:{"--session-hue":e.hue},children:[r.jsxs("div",{className:"recap-note-head",title:l,children:[r.jsxs("span",{className:"recap-note-mark",children:[r.jsx(sp,{recap:a}),h]}),r.jsx("span",{className:"recap-note-age",title:o.title,children:o.label}),r.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":a?"Hide the recap":n?"Hide this note":"Hide the plan",title:"Hide — the mark on the card brings it back",onClick:f=>{f.stopPropagation(),yK(e.noteKey)},children:"×"})]}),n&&r.jsx("p",{className:"recap-note-text",title:EK(n.text,l),children:n.text}),(n==null?void 0:n.reply)&&r.jsxs("p",{className:"recap-note-reply",title:`suggested reply “${n.reply}”`,children:["suggested reply “",n.reply,"”"]}),s&&r.jsx(XT,{plan:s,head:n!=null}),r.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[r.jsxs("div",{className:"lod-id",children:[r.jsxs("span",{className:"recap-note-mark",children:[r.jsx(sp,{recap:a}),h]}),r.jsx("span",{className:"recap-face-age",children:o.label})]}),n&&r.jsx("p",{className:"recap-face-text",children:n.text}),s&&r.jsx(XT,{plan:s,head:n!=null,face:!0})]}),r.jsx(fi,{type:"source",position:Ye.Right,style:{background:"transparent",border:"none"}})]})}const DZ={completed:"done",in_progress:"now",pending:"to do"};function XT({plan:e,head:t,face:n=!1}){const s=Cr(e);if(!s)return null;const a=gV(e.items);return r.jsxs("div",{className:n?"recap-face-plan":"recap-note-plan",title:n?void 0:Kp(e.items),children:[t&&r.jsxs("div",{className:"recap-note-plan-head",children:["Plan ",r.jsxs("span",{className:"recap-note-plan-count",children:[s.done,"/",s.total,s.allDone?" · done":""]})]}),!s.allDone&&r.jsxs("ol",{className:"plan-list",children:[a.shown.map((o,i)=>r.jsxs("li",{className:"plan-item","data-status":o.status,children:[r.jsx("span",{className:"plan-mark","aria-hidden":!0}),!n&&r.jsxs("span",{className:"vis-hidden",children:[DZ[o.status],": "]}),r.jsx("span",{className:"plan-text",children:o.status==="in_progress"&&o.active?o.active:o.text}),o.status==="in_progress"&&r.jsx("span",{className:"plan-now","aria-hidden":!0,children:"now"})]},o.id??`${i}:${o.text}`)),(a.before>0||a.after>0)&&r.jsx("li",{className:"recap-note-plan-more",children:[a.before>0?`${a.before} earlier`:null,a.after>0?`+${a.after} more`:null].filter(Boolean).join(" · ")})]})]})}function ro(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function po(e){return/mac|iphone|ipad/i.test(e)}const up=e=>new Map([...e].map(([t,n])=>[t,{x:n.x,y:n.y}]));function FZ(e,t,n){return{positions:up(e.positions),pinned:up(e.pinned),provisional:new Set(e.provisional),layoutSig:e.layoutSig.current,stored:{...t},viewport:n?{...n}:null}}function BZ(e,t){t.positions.clear();for(const[n,s]of up(e.positions))t.positions.set(n,s);t.pinned.clear();for(const[n,s]of up(e.pinned))t.pinned.set(n,s);t.provisional.clear();for(const n of e.provisional)t.provisional.add(n);t.layoutSig.current=e.layoutSig}const ZT=7e3,qZ=2e3,UZ=140,WZ="Layout re-arranged",HZ="Layout re-arranged. Undo available.",JT="Layout restored.",zZ={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e),now:()=>Date.now()};function VZ(e,t=zZ){let n=null,s=null,a=0,o=ZT;const i=new Set,l=()=>{s!==null&&t.clear(s),s=null},u=()=>{l(),!(n===null||i.size>0)&&(a=t.now()+o,s=t.set(()=>{s=null,h()},o))};function h(){l(),i.clear(),n!==null&&(n=null,e(!1))}return{open(f){const p=n===null;n=f,o=ZT,u(),p&&e(!0)},take(){const f=n;return h(),f},close:h,hold(f){n!==null&&(i.size===0&&s!==null&&(o=Math.max(0,a-t.now()),l()),i.add(f))},release(f){!i.delete(f)||i.size>0||n===null||(o=Math.max(o,qZ),u())},get isOpen(){return n!==null},get snapshot(){return n}}}function GZ(e){return(e.key==="z"||e.key==="Z")&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey}function KZ(e){return po(e)?"⌘Z":"Ctrl+Z"}function YZ({undo:e}){const{open:t,said:n,undo:s,dismiss:a,hold:o,release:i}=e,l=Nl(t,UZ),u=g.useRef(null);return g.useEffect(()=>t?rn.push(a,0,"popover"):void 0,[t,a]),g.useEffect(()=>{var f;if(t)return;const h=u.current;h&&h.contains(document.activeElement)&&((f=h.closest("main"))==null||f.focus({preventScroll:!0}))},[t]),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:n}),Ja(l)&&r.jsxs("div",{ref:u,className:l==="leaving"?"rearrange-undo leaving":"rearrange-undo",onPointerEnter:()=>o("hover"),onPointerLeave:()=>i("hover"),onFocus:()=>o("focus"),onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||i("focus")},children:[r.jsx("span",{id:"rearrange-undo-state",className:"rearrange-undo-state",children:WZ}),r.jsxs("button",{type:"button",className:"rearrange-undo-act",onClick:s,"aria-describedby":"rearrange-undo-state","aria-keyshortcuts":"Meta+Z Control+Z",children:["Undo",r.jsx("span",{className:"rearrange-undo-key","aria-hidden":"true",children:KZ(ro())})]})]})]})}function XZ({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a,targetPosition:o,style:i}){const[l]=Jj({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:o,curvature:.35});return r.jsxs("g",{className:"recap-tie",style:i,children:[r.jsx("path",{className:"recap-tie-thread",d:l,vectorEffect:"non-scaling-stroke"}),r.jsx("path",{className:"recap-tie-beads",d:l,vectorEffect:"non-scaling-stroke"}),r.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),r.jsx("circle",{className:"recap-tie-end",cx:n,cy:s,r:3.5})]})}function O1(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function dp(e,t){const n=O1(e);return n?n.slice(-t):e.slice(-t)}function xD(e,t,n=4){const s=O1(e);if(!s)return dp(e,n);let a=n;for(const o of t){if(o===e)continue;const i=O1(o);let l=0;for(;l<s.length&&l<i.length&&s[s.length-1-l]===i[i.length-1-l];)l++;a=Math.max(a,l+1)}return s.slice(-a)}const Sl=" · ",ZZ=32,JZ=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function QT(e){return JZ.test(e)?2:1}function eA(e,t=ZZ){const n=[...e];let s=0;for(const i of n)s+=QT(i);if(s<=t)return e;const a=[];let o=0;for(const i of n){const l=QT(i);if(o+l>t-1)break;a.push(i),o+=l}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function QZ(e,t,n,s,a=[],{branch:o,plan:i,alarm:l=!1}={}){const u=(t==null?void 0:t.trim())??"",h=s?xD(n,a):void 0,f=[e,u||void 0,h].filter(Boolean),p=[e,i?`plan ${i}`:void 0,o,u||void 0,h].filter(Boolean).join(Sl);return{label:eA(e),name:u?eA(u):void 0,shortId:h,fullLabel:f.join(Sl),title:`${l?"waiting on you: ":""}${p}
|
|
89
|
+
Blocked for ${Kl(e.since,void 0,t)} — the answer goes in the terminal, not here.`,children:[n?r.jsx("span",{className:"ap-pulse","aria-hidden":!0}):r.jsx("span",{className:"waiting-dot","aria-hidden":!0}),r.jsx("span",{className:"waiting-said",children:tp(e)}),r.jsx("b",{children:Kl(e.since,void 0,t)})]})}function $Y({tools:e,outputs:t}){const n=_r(1e3),{counts:s,title:a}=rY(e,t,n),o=Xy/Ll;return r.jsxs("div",{className:"tool-spark-row",title:a,children:[r.jsx("svg",{className:"tool-spark",width:Xy,height:Mf,viewBox:`0 0 ${Xy} ${Mf}`,"aria-hidden":!0,children:s.map((i,l)=>{const u=oY(i),h=l===Ll-1&&i>0,p=`tool-spark-bar${i>0?" active":""}${h?" latest":""}`;return r.jsx("rect",{x:l*o+.4,y:Mf-u,width:Math.max(.5,o-1),height:u,rx:.8,className:p},h?`landed:${i}`:l)})}),r.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function LY({enableAutoFitAndRefit:e}){return r.jsxs("div",{className:"autofit-chip",children:[r.jsx("span",{className:"autofit-state",title:"New sessions are not brought into view while you are moving it yourself",children:"Auto-fit off"}),r.jsx("button",{type:"button",className:"autofit-resume",onClick:e,title:"Bring new sessions into view again","aria-label":"Resume auto-fit",children:"Resume"})]})}const _N="agent-dag.single-key-shortcuts";function nD(e){return e!=="0"}function sD(e){return e.length===1}function IY(e,t){return!t&&sD(e)}function _n(e,t,n){return n?`${e} (${t})`:e}let oi=null;const vu=new Set;function rD(){for(const e of vu)e()}function R1(){return oi===null&&(oi=nD(nt(_N))),oi}function OY(e){oi!==e&&(oi=e,st(_N,e?"1":"0"),rD())}function NT(e){if(e.key!==_N)return;const t=nD(e.newValue);t!==oi&&(oi=t,rD())}function PY(e){var t;return vu.add(e),vu.size===1&&typeof window<"u"&&((t=window.addEventListener)==null||t.call(window,"storage",NT)),()=>{var n;vu.delete(e),vu.size===0&&typeof window<"u"&&((n=window.removeEventListener)==null||n.call(window,"storage",NT))}}function ip(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const ST=99;function DY(e){const t=Math.max(0,Math.floor(e));return t>ST?`${ST}+`:String(t)}const FY="Pause the canvas";function BY(e){const t=e.singleKeys??!0;if(!e.paused)return _n("Pause live updates — events keep arriving and are applied when you resume","Space",t);const n=Math.max(0,Math.floor(e.dropped??0));return n>0?_n(`The pause is full — ${ip(e.held)} held and ${n} older ${n===1?"one":"ones"} already dropped. Resume to follow the canvas again`,"Space",t):e.held<=0?_n("Nothing has arrived since you paused. Resume to follow the canvas again","Space",t):_n(`${ip(e.held)} arrived while paused and will be applied in order when you resume`,"Space",t)}function qY(e){return e.connected||!e.paused?null:"The canvas is paused as well — Space resumes it, but nothing new arrives until the stream is back."}const aD="paused · full",UY=(e,t)=>t>0?aD:e>0?`paused · ${DY(e)}`:"paused";function WY(e){const t=Math.max(0,Math.floor(e.dropped??0)),n=e.singleKeys??!0;return e.connected?e.paused?{tone:"paused",resting:!1,label:UY(e.held,t),widest:aD,title:_n(t>0?`Connected — the pause is full at ${ip(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up`:e.held>0?`Connected — ${ip(e.held)} held until you resume`:"Connected — updates held until you resume","Space",n)}:{tone:"live",resting:!0,label:"live",widest:"live",title:"Receiving events"}:{tone:"dead",resting:!1,label:"offline",widest:"offline",title:e.paused?"SSE disconnected — and the canvas is paused, so resuming will not bring events back until it reconnects":"SSE disconnected"}}function An(){return g.useSyncExternalStore(PY,R1,R1)}const HY=e=>e.transform[2]>=e.maxZoom,zY=e=>e.transform[2]<=e.minZoom;function VY({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:s,togglePause:a,handleRelayout:o,requestClear:i,setKeyHelpOpen:l}){const u=ec(),h=ht(HY),f=ht(zY),p=An();return r.jsxs(S9,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[r.jsx(ms,{onClick:()=>{h||u.zoomIn()},title:"Zoom in","aria-label":"Zoom in","aria-disabled":h||void 0,children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:r.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),r.jsx(ms,{onClick:()=>{f||u.zoomOut()},title:"Zoom out","aria-label":"Zoom out","aria-disabled":f||void 0,children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:r.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),r.jsx(ms,{onClick:t,title:e?"Recenter view + re-enable autofit":"Recenter view (autofit already on)","aria-label":"Recenter view","data-nudge":e?"":void 0,children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[r.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),r.jsx(ms,{"data-group-start":"",onClick:a,title:BY({paused:n,held:s.size,dropped:s.dropped,singleKeys:p}),"aria-label":FY,"aria-pressed":n,children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:r.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),r.jsx(ms,{onClick:o,title:_n("Auto-arrange — clear pins","R",p),"aria-label":"Re-arrange the canvas",children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[r.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),r.jsx(ms,{"data-group-start":"","data-danger":"",onClick:()=>i("button"),title:_n("Clear the canvas and the server's event log — asks first","C",p),"aria-label":"Clear the canvas",children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[r.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),r.jsx("path",{d:"M9 6.2V4.4a1.6 1.6 0 0 1 1.6-1.6h2.8a1.6 1.6 0 0 1 1.6 1.6v1.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("path",{d:"M17.4 6.4 16.7 20a2 2 0 0 1-2 1.9H9.3a2 2 0 0 1-2-1.9L6.6 6.4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),r.jsx(ms,{"data-group-start":"",onClick:()=>l(m=>!m),title:p?_n("Keyboard shortcuts","?",!0):"Keyboard shortcuts — the single-key ones are off","aria-label":"Open the keyboard shortcuts","aria-haspopup":"dialog",children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[r.jsx("path",{d:"M8.6 8.4a3.5 3.5 0 1 1 4.6 3.35c-.85.3-1.2 1-1.2 1.85v1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),r.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]})}const GY="modulepreload",KY=function(e){return"/"+e},CT={},bi=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let i=function(h){return Promise.all(h.map(f=>Promise.resolve(f).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=i(n.map(h=>{if(h=KY(h),h in CT)return;CT[h]=!0;const f=h.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":GY,f||(m.as="script"),m.crossOrigin="",m.href=h,u&&m.setAttribute("nonce",u),document.head.appendChild(m),f)return new Promise((w,b)=>{m.addEventListener("load",w),m.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return a.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},_T="agent-dag.fm-custom-stations",ET="agent-dag.fm-muted",M1="custom:",YY=/^UC[A-Za-z0-9_-]{22}$/,XY=/^[A-Za-z0-9_-]{11}$/,oD=/^[A-Za-z0-9_-]{1,80}$/,ZY=/\.(mp3|aac|ogg)$/i,JY=/\.m3u8$/i,QY=2048,iD=80;function Xl(e){return`${M1}${e}`}function lm(e){if(!e.startsWith(M1))return null;const t=e.slice(M1.length);return oD.test(t)?t:null}function TT(e){return lm(e)??e}function EN(e){var i,l;const t=e.trim();if(t.length>QY)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!=="https:"||n.username||n.password)return null;const s=n.toString(),a=n.hostname.toLowerCase();if(a==="youtube.com"||a==="www.youtube.com"||a==="m.youtube.com"){if(n.port)return null;const u=(i=/^\/channel\/([^/]+)(?:\/live)?\/?$/.exec(n.pathname))==null?void 0:i[1];if(u&&YY.test(u))return{kind:"youtube-channel",url:s,channel:u};const h=(l=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:l[1];if(h&&/^[A-Za-z0-9._-]{1,64}$/.test(h))return{kind:"youtube-handle",url:s,handle:h};if(n.pathname==="/watch"){const f=n.searchParams.get("v")??"";if(XY.test(f))return{kind:"youtube-video",url:s,video:f}}return null}return JY.test(n.pathname)?{kind:"direct-audio",url:s,format:"hls"}:ZY.test(n.pathname)?{kind:"direct-audio",url:s,format:"audio"}:/\.(html?|pls|m3u)$/i.test(n.pathname)?null:{kind:"direct-audio",url:s,format:"audio"}}function eX(e){return e==="1"}function tX(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];const n=new Set,s=[];for(const a of t){if(!a||typeof a!="object")continue;const o=typeof a.id=="string"?a.id:"",i=typeof a.name=="string"?a.name.trim():"",l=typeof a.url=="string"?a.url.trim():"",u=EN(l);if(!oD.test(o)||n.has(o)||!i||i.length>iD||!u)continue;n.add(o);const h=lD(a.radio);s.push({id:o,name:i,url:u.url,...h?{radio:h}:{}})}return s}function nX(e,t,n){const s=lm(e??"");return s&&t.some(a=>a.id===s)?Xl(s):n(e)}function sX(e,t){return e===Xl(t)?"claude-fm":e}function lD(e){if(!e||typeof e!="object")return null;const t=e,n=(a,o)=>typeof t[a]=="string"?t[a].slice(0,o):"",s=(a,o)=>typeof t[a]=="number"&&Number.isFinite(t[a])&&Math.abs(t[a])<=o?t[a]:null;return{...t.hls===!0?{hls:!0}:{},country:n("country",80),countryCode:n("countryCode",2),region:n("region",80),tags:n("tags",180),language:n("language",80),codec:n("codec",12),bitrate:typeof t.bitrate=="number"&&Number.isFinite(t.bitrate)?Math.max(0,Math.min(1e3,t.bitrate)):0,lat:s("lat",90),lon:s("lon",180)}}const $1="https://www.youtube-nocookie.com";function rX(e,t,n){const s=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${$1}/embed/${n?encodeURIComponent(n):"live_stream"}?${s.toString()}`}function cl(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function aX(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const oX=[1],iX=[0,2],lX=[2,5,100,101,150,153];function cX(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const{event:n,info:s}=t;if(n==="onReady")return{kind:"ready"};if(n==="onAutoplayBlocked")return{kind:"blocked"};if(n==="onError"){const a=typeof s=="number"?s:Number(s==null?void 0:s.errorCode);return Number.isFinite(a)?{kind:"error",code:a}:null}if(n==="onStateChange"||n==="infoDelivery"){const a=typeof s=="number"?s:s==null?void 0:s.playerState;return typeof a!="number"||!Number.isFinite(a)?null:oX.includes(a)?{kind:"playing",playing:!0}:a===3?{kind:"buffering"}:iX.includes(a)?{kind:"playing",playing:!1}:null}return null}const ou=new Set;let AT="";function RT(e){const t=new Date().toISOString().slice(0,10);if(t!==AT&&(ou.clear(),AT=t),!ou.has(e)){ou.add(e);try{const n=typeof navigator>"u"?void 0:navigator;(!n||typeof n.sendBeacon!="function"||!n.sendBeacon("/api/feature",JSON.stringify({name:e})))&&ou.delete(e)}catch{ou.delete(e)}}}const MT=864e5,uX=6e4;function an(e,t=!0){g.useEffect(()=>{if(!t)return;RT(e);let n;const s=()=>{n=setTimeout(()=>{RT(e),s()},MT-Date.now()%MT+uX)};return s(),()=>clearTimeout(n)},[e,t])}const dX={"claude-fm":null,"lofi-relax":null,"lofi-game":null,"lofi-vibe":null,"lofi-sleep":null,"radio-mix":"/api/live-radio-mix","best-of-nostalgia":"/api/best-of-nostalgia","good-life-radio":"/api/good-life-radio","cafe-music-bgm":"/api/cafe-music-bgm"};function hX({fetchImpl:e,enabled:t=!0,volume:n,muted:s,source:a,playRequest:o,customStation:i,onAvailabilityChange:l}){var q;const[u,h]=g.useState(null),[f,p]=g.useState(!1),[m,w]=g.useState(!1),[b,k]=g.useState(!1),[v,N]=g.useState(!1);an("claude-fm",b);const x=g.useRef(o),C=g.useRef(null),S=g.useRef(null),_=g.useRef(void 0),$=g.useRef(null),A=g.useCallback(()=>{var F;clearTimeout(_.current),(F=S.current)==null||F.destroy(),S.current=null;const T=C.current;T&&(T.pause(),T.removeAttribute("src"),T.load(),C.current=null)},[]),O=g.useCallback(T=>{var F,D;(D=(F=$.current)==null?void 0:F.contentWindow)==null||D.postMessage(T,$1)},[]),M=g.useRef(n);M.current=n;const W=g.useRef(s);W.current=s;const B=g.useCallback((T,F,D)=>{A();const K=new Audio;K.preload="none",K.volume=M.current/100,K.muted=W.current,C.current=K,w(!0),k(!1),N(!1);let V=!1;const H=()=>C.current===K,P=()=>{clearTimeout(_.current),A(),w(!1),k(!1),N(!1)},I=()=>{H()&&(P(),p(!0),l==null||l(D,!0))},U=z=>{if(H()&&!(z instanceof DOMException&&z.name==="AbortError")){if(z instanceof DOMException&&z.name==="NotAllowedError"){P();return}I()}};_.current=setTimeout(()=>{H()&&!V&&I()},15e3),K.addEventListener("playing",()=>{H()&&(clearTimeout(_.current),V=!0,k(!0),N(!1),l==null||l(D,!1))});const Z=()=>{H()&&(k(!1),N(V),clearTimeout(_.current),_.current=setTimeout(()=>{H()&&I()},15e3))};K.addEventListener("waiting",Z),K.addEventListener("stalled",Z),K.addEventListener("ended",()=>{H()&&P()}),K.addEventListener("error",I,{once:!0}),F&&!K.canPlayType("application/vnd.apple.mpegurl")?bi(async()=>{const{default:z}=await import("./hls-BFpXDghs.js");return{default:z}},[]).then(({default:z})=>{if(!H())return;if(!z.isSupported()){I();return}const X=new z;S.current=X,X.on(z.Events.ERROR,(Y,J)=>{J.fatal&&I()}),X.on(z.Events.MEDIA_ATTACHED,()=>X.loadSource(T)),X.on(z.Events.MANIFEST_PARSED,()=>{K.play().catch(U)}),X.attachMedia(K)},I):(K.src=T,K.play().catch(U))},[l,A]);g.useEffect(()=>{m&&(O(cl("setVolume",[n])),O(cl(s?"mute":"unMute")),C.current&&(C.current.volume=n/100,C.current.muted=s))},[n,s,m,O]),g.useEffect(()=>{var P;let T=!0;const F=e??fetch,D=x.current!==o;if(x.current=o,h(null),p(!1),N(!1),w(D),k(!1),A(),!t){w(!1),k(!1);return}const K=i&&Xl(i.id)===a?EN(i.url):null;if(K){if(K.kind==="direct-audio"){const I=K.format==="hls"||((P=i==null?void 0:i.radio)==null?void 0:P.hls)===!0;return h({live:!0,channel:"",audio:K.url,hls:I}),l==null||l(a,!1),D&&B(K.url,I,a),()=>{T=!1}}return F(`/api/fm-station?url=${encodeURIComponent(K.url)}`).then(I=>I.ok?I.json():null).then(I=>{T&&(I!=null&&I.channel||I!=null&&I.video?(h({live:!0,channel:I.channel??"",video:I.video??void 0}),l==null||l(a,!1)):(p(!0),w(!1),k(!1),N(!1),l==null||l(a,!0)))}).catch(()=>{T&&(p(!0),w(!1),k(!1),N(!1),l==null||l(a,!0))}),()=>{T=!1}}if(lm(a))return p(!0),l==null||l(a,!0),()=>{T=!1};const V=a,H=dX[V];if(H)F(H).then(I=>I.ok?I.json():null).then(I=>{T&&(I!=null&&I.video&&h({live:!0,channel:"",video:I.video}),I!=null&&I.video||(p(!0),w(!1),k(!1)),l==null||l(a,!(I!=null&&I.video)))}).catch(()=>{T&&(p(!0),w(!1),k(!1),l==null||l(a,!0))});else if(V!=="claude-fm"){const I=V.replace("lofi-","");F(`/api/lofi-girl?station=${encodeURIComponent(I)}`).then(U=>U.ok?U.json():null).then(U=>{T&&(U!=null&&U.video&&h({live:!0,channel:"",video:U.video}),U!=null&&U.video||(p(!0),w(!1),k(!1)),l==null||l(a,!(U!=null&&U.video)))}).catch(()=>{T&&(p(!0),w(!1),k(!1),l==null||l(a,!0))})}else F("/api/claude-fm").then(I=>I.ok?I.json():null).then(I=>{if(!T)return;const U=!!(I!=null&&I.live&&(I!=null&&I.channel));U&&h({live:!0,channel:I.channel}),U||(p(!0),w(!1),k(!1)),l==null||l(a,!U)}).catch(()=>{T&&(p(!0),w(!1),k(!1),l==null||l(a,!0))});return()=>{T=!1}},[i==null?void 0:i.id,i==null?void 0:i.url,(q=i==null?void 0:i.radio)==null?void 0:q.hls,t,e,l,o,a,B,A]),g.useEffect(()=>()=>A(),[A]),g.useEffect(()=>{if(!m||u!=null&&u.audio)return;let T;const F=()=>{clearTimeout(T),T=void 0,w(!1),k(!1),N(!1),p(!0),l==null||l(a,!0)},D=()=>{T??(T=setTimeout(F,15e3))};D();const K=V=>{var P;if(V.origin!==$1||V.source!==((P=$.current)==null?void 0:P.contentWindow))return;const H=cX(V.data);if(H){if(H.kind==="ready"){O(cl("setVolume",[M.current])),O(cl(W.current?"mute":"unMute")),O(cl("playVideo"));return}if(H.kind==="blocked"){clearTimeout(T),T=void 0,w(!1),k(!1),N(!1);return}if(H.kind==="buffering"){k(!1),N(!0),D();return}if(H.kind==="playing"){clearTimeout(T),T=void 0,k(H.playing),N(!1),H.playing||w(!1);return}lX.includes(H.code)&&F()}};return window.addEventListener("message",K),()=>{clearTimeout(T),window.removeEventListener("message",K)}},[m,u==null?void 0:u.audio,o,l,O,a]);const R=g.useCallback(()=>{if(u){if(u.audio){if(m){A(),w(!1),k(!1),N(!1);return}B(u.audio,u.hls===!0,a);return}if(!m){w(!0),k(!1),N(!1);return}O(cl("pauseVideo")),w(!1),k(!1),N(!1)}},[u,m,b,a,O,B,A]);return g.useMemo(()=>({probe:u,dead:f,armed:m,playing:b,buffering:v,frame:$,say:O,press:R}),[u,f,m,b,v,O,R])}const $T="agent-dag.radio-favorites",LT="agent-dag.radio-recent",IT="agent-dag.radio-catalogue";function fX(e){if(!Array.isArray(e))return[];const t=new Set;return e.slice(0,300).flatMap(n=>{if(!n||typeof n!="object")return[];const s=n,a=typeof s.id=="string"?s.id:"",o=typeof s.name=="string"?s.name.trim().slice(0,80):"",i=typeof s.url=="string"?EN(s.url):null,l=lD(s.radio??s);return!/^radio-[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(a)||!o||!l||!i||i.kind!=="direct-audio"||t.has(a)?[]:(t.add(a),[{id:a,name:o,url:i.url,radio:l}])})}function OT(e){try{const t=JSON.parse(e??"[]");return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"&&/^[A-Za-z0-9_-]{1,80}$/.test(n)))].slice(0,100):[]}catch{return[]}}function pX(e,t){return[t,...e.filter(n=>n!==t)].slice(0,50)}function rje(e,t,n=Math.random){const s=e.filter(a=>a.id!==t);return s.length?s[Math.min(s.length-1,Math.floor(Math.max(0,n())*s.length))]:null}function aje(e,t,n){if(!e.length)return null;const s=e.findIndex(o=>o.id===t),a=e[s<0?n===1?0:e.length-1:(s+n+e.length)%e.length];return a.id===t?null:a}function cD(e,t,n){const s=e.findIndex(a=>a.id===t);for(let a=1;a<=e.length;a++){const o=e[(s+a)%e.length];if(o.id!==t&&!n.has(o.id))return o}return null}function oje(e,t){if(!e.length)return null;const n=[...e].sort((a,o)=>a.id.localeCompare(o.id));let s=0;for(const a of t)s=Math.imul(s,31)+a.charCodeAt(0)>>>0;return n[s%n.length]}function ije(e,t,n,s,a){return(!t||`${e.name} ${e.radio.country} ${e.radio.region} ${e.radio.tags}`.toLowerCase().includes(t.toLowerCase()))&&(!n||e.radio.countryCode===n)&&(!s||e.radio.tags.toLowerCase().includes(s.toLowerCase()))&&(!a||e.radio.language.toLowerCase().includes(a.toLowerCase()))}function mX(){const[e,t]=g.useState(()=>OT(nt($T))),[n,s]=g.useState(()=>OT(nt(LT))),[a,o]=g.useState(()=>{try{return fX(JSON.parse(nt(IT)??"[]"))}catch{return[]}});g.useEffect(()=>{st($T,JSON.stringify(e))},[e]),g.useEffect(()=>{st(LT,JSON.stringify(n))},[n]);const i=g.useCallback(h=>s(f=>pX(f,h)),[]),l=g.useCallback(h=>t(f=>f.includes(h)?f.filter(p=>p!==h):[...f,h].slice(-100)),[]),u=g.useCallback(h=>{o(h),st(IT,JSON.stringify(h))},[]);return{favorites:e,recent:n,catalogue:a,remember:i,toggleFavorite:l,updateCatalogue:u}}function gX(e,t,n,s){const a=cD(e,t,n);if(!a)return()=>{};const o=setTimeout(()=>{n.add(t),s(a)},1e3);return()=>clearTimeout(o)}const cm=148,PT=6e3,yX=16e3,uD=46,Qa=34;function wX(e,t,n=cm){let s=-Math.round(t()*n);if(Math.abs(s-e)<Qa){const a=e-Qa>=-n?-Qa:Qa;s=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:s,ms:Math.round(Math.abs(s-e)*uD)}}function xX(e){return Math.round(PT+e()*(yX-PT))}const DT=[{kind:"stroll",weight:44},{kind:"tidy",weight:17},{kind:"kick",weight:17},{kind:"sit",weight:12},{kind:"watch",weight:16},{kind:"leave",weight:7},{kind:"fish",weight:12},{kind:"skip",weight:10}];function vX(e){const t=DT.reduce((s,a)=>s+a.weight,0);let n=e()*t;for(const s of DT)if(n-=s.weight,n<0)return s.kind;return"stroll"}const bX=720,kX=260,jX=620,NX=220,FT=520,dD=1600,BT=7e3,SX=15e3,qT=6e3,CX=14e3;function ul(e,t,n=cm){let s=-Math.round(t()*n);if(Math.abs(s-e)<Qa){const a=e-Qa>=-n?-Qa:Qa;s=Math.max(-n,Math.min(0,Math.round(e+a)))}return s}const Qt=(e,t)=>Math.round(Math.abs(t-e)*uD),_X=120,nf=0;function EX(e,t){const n=s=>({kind:"litter",at:t,...s});return[{x:t,prop:n({}),act:"walk",ms:Qt(e,t)},{x:t,prop:n({}),act:"stoop",ms:bX},{x:nf,prop:n({held:!0}),act:"carry",ms:Qt(t,nf)},{x:nf,prop:n({held:!0}),act:"windup",ms:kX},{x:nf,prop:n({held:!0,leaving:!0}),act:"toss",ms:jX}]}function TX(e,t){const n=t>e?1:-1,s=t-n*Math.min(15,Math.abs(t-e)),a=(o={})=>({kind:"ball",at:t,...o});return[{x:s,prop:a(),act:"walk",ms:Qt(e,s)},{x:s,prop:a(),act:"windup",ms:NX,facing:n>0?"right":"left"},{x:s,prop:a({leaving:!0}),act:"kick",ms:FT,facing:n>0?"right":"left"},{x:s,prop:a({leaving:!0}),act:"stand",ms:dD-FT}]}const hD=640;function AX(e,t,n){const s=Math.max(-70,Math.min(-20,t)),a={x:s,prop:null,facing:"left"};return[{x:s,prop:null,act:"walk",ms:Qt(e,s)},{...a,act:"sit",ms:600},{...a,act:"cast",ms:900},{...a,act:"fish",ms:6e3+Math.round(n()*4e3)},{...a,act:"reel",ms:1200},{...a,act:"stow",ms:500},{...a,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:Qt(s,0)}]}function RX(e,t,n){const s=Math.max(-110,Math.min(-30,t)),a={x:s,prop:null};return[{...a,act:"walk",ms:Qt(e,s)},{...a,act:"skip-ready",ms:500},{...a,act:"skip",ms:hD*(6+Math.floor(n()*5))},{...a,act:"skip-rest",ms:600},{...a,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:Qt(s,0)}]}function MX(e,t,n){return[{x:t,prop:null,act:"walk",ms:Qt(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(qT+n()*(CX-qT))},{x:t,prop:null,act:"stand",ms:400}]}function $X(e,t,n){t=Math.max(-110,Math.min(0,t));const s=()=>({kind:"scope",at:t,held:!0});return[{x:t,prop:null,act:"walk",ms:Qt(e,t)},{x:t,prop:s(),act:"watch",ms:Math.round(BT+n()*(SX-BT))},{x:t,prop:s(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function Jy(e,t,n){return e.facing?e.facing:e.act==="watch"||e.act==="scope-pack"?"left":e.x===t?n:e.x>t?"right":"left"}const LX=1500,IX=e=>Math.round(1e3*Math.sqrt(2*e/LX)),OX=115,PX=e=>Math.round(e/OX*1e3),DX=620,FX=200,BX=760,qX=600,UX=240;function WX(e,t,n){const a=-(t.ledgeSpan??cm),o=IX(t.ledgeH),i=PX(t.ledgeH),l=n(),u=n(),h=-Math.round(l*t.floorSpan),f=-Math.round(u*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:Qt(e,a)},{x:a,act:"peer",prop:null,ms:DX},{x:a,act:"fall",prop:null,ms:o,place:"floor"},{x:a,act:"land",prop:null,ms:FX,place:"floor"},{x:h,act:"walk",prop:null,ms:Qt(a,h),place:"floor",floorFrac:l},{x:f,act:"walk",prop:null,ms:Qt(h,f),place:"floor",floorFrac:u},{x:a,act:"walk",prop:null,ms:Qt(f,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:BX,place:"floor"},{x:a,act:"rope-throw",prop:null,ms:qX,place:"floor"},{x:a,act:"rope-catch",prop:null,ms:UX,place:"floor"},{x:a,act:"climb",prop:null,ms:i},{x:a,act:"pull-up",prop:null,ms:480}]}function HX(e,t,n){const s=(n==null?void 0:n.ledgeSpan)??cm;switch(vX(t)){case"tidy":return EX(e,ul(e,t,s));case"kick":return TX(e,ul(e,t,s));case"sit":return MX(e,ul(e,t,s),t);case"watch":return $X(e,ul(e,t,s),t);case"fish":return AX(e,ul(e,t,s),t);case"skip":return RX(e,ul(e,t,s),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return WX(e,n,t)}}const o=wX(e,t,s);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const zX=420;function VX(e,t,n){const s=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(zX,Math.max(0,s))}const GX=260,KX=200;function YX(e,t,n){const s=(f,p=Qt(e,f))=>({x:f,prop:null,act:"walk",ms:p,place:"floor"});if(!n||n.height<=0)return[s(t)];const a=Math.min(e,t);if(Math.max(e,t)<=n.left||a>=n.right)return[s(t)];const i=t>e,l=i?n.left:n.right,u=i?n.right:n.left,h={place:"floor",riser:n.height,prop:null};return[s(l,Qt(e,l)),{...h,x:l,act:"mount",ms:GX},{...h,x:u,act:"walk",ms:Qt(l,u)},{x:u,prop:null,act:"dismount",ms:KX,place:"floor"},{x:t,prop:null,act:"walk",ms:Qt(u,t),place:"floor"}]}const fD=["bob","sway","groove"],UT=9e3,XX=16e3,pD=1e3,ZX=.08;function JX(e,t){const n=fD.filter(o=>o!==e),s=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*ZX;return{dance:s,beatMs:Math.round(pD*(1+a))}}function QX(e){return Math.round(UT+e()*(XX-UT))}const TN=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],WT=18,eZ=TN.length,mD="M6 9H4V1H5V0H7V-1H9V1H7V2H5V7H6V8H7V9Z",gD="M12 9H14V6H13V3H11V2H9V4H12Z",AN=new Set(["a","c","p"]);function fo(e=TN){const t=[];return e.forEach((n,s)=>{let a=0;for(;a<n.length;){const o=n[a];if(o==="."){a+=1;continue}let i=1;for(;a+i<n.length&&n[a+i]===o;)i+=1;t.push({x:a,y:s,w:i,cell:o}),a+=i}}),t}const tZ=[".xx.","xxxx",".xx."],nZ=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],sZ=["...xx...............","..xaax..............",".xaallx.............","xaallllx............",".xllllllx...........","..xllllllx..........","...xllllllx.........","....xllllllxx.......",".....xllllxsxx..xx..","......xllxsssx.xllxx",".......xxssssxxxllxx","........xssssssxx...",".........xssssx.....","..........xxxx......","..........xax.......",".........xxxxx......","........xx.x.xx.....","........xl.x.lx.....",".......xl..x..lx....",".......xl..x..lx....","......xl...x...lx...","......xl...x...lx...",".....xl....x....lx..","....xxx...xxx...xxx."],Qy={litter:tZ,ball:nZ,scope:sZ},rZ=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],aZ=3,oZ=-1,L1=11,HT=9;function zT(e){let t=null,n=null,s=0,a=0,o=!1;const i=()=>{t!==null&&clearTimeout(t),t=null},l=()=>{o||e.hidden||!n||t!==null||(a=performance.now(),t=setTimeout(()=>{t=null;const h=n;n=null,h==null||h()},s))},u=()=>{e.hidden&&t!==null?(s=Math.max(0,s-(performance.now()-a)),i()):e.hidden||l()};return e.addEventListener("visibilitychange",u),{schedule(h,f){o||(i(),n=h,s=Math.max(0,f),l())},dispose(){o=!0,i(),n=null,e.removeEventListener("visibilitychange",u)}}}function iZ(e,t,n){const[s,a]=g.useState(0),[o,i]=g.useState(0),[l,u]=g.useState(null),[h,f]=g.useState(null),[p,m]=g.useState({x:0,drop:0}),[w,b]=g.useState("ledge"),[k,v]=g.useState("left"),[N,x]=g.useState(0),C=g.useRef(null),[S,_]=g.useState(()=>document.hidden);g.useEffect(()=>{const R=new Set,q=()=>{var T;if(document.hidden){for(const F of((T=C.current)==null?void 0:T.getAnimations({subtree:!0}))??[])if(F.playState==="running"||F.pending){const D=F.currentTime;F.pause(),D!==null&&(F.currentTime=D),R.add(F)}}else{for(const F of R)F.playState==="paused"&&F.play();R.clear()}_(document.hidden)};return q(),document.addEventListener("visibilitychange",q),()=>document.removeEventListener("visibilitychange",q)},[e,t]);const[$,A]=g.useState(null),[O,M]=g.useState(pD),[W,B]=g.useState(()=>{var R;return((R=window.matchMedia)==null?void 0:R.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return g.useEffect(()=>{var T;const R=(T=window.matchMedia)==null?void 0:T.call(window,"(prefers-reduced-motion: reduce)");if(!R)return;const q=()=>B(R.matches);return q(),R.addEventListener("change",q),()=>R.removeEventListener("change",q)},[]),g.useEffect(()=>{var J;if(!e||t||W)return;const R=zT(document);let q=0;a(Q=>q=Q);let T=null,F=0,D=0;const K=Q=>{var re,he;const[te,...le]=Q;if(!te){T=null,u(null),f(null),z();return}u(te.act),f(te.prop),b(te.place??"ledge"),x(te.riser??0);const de=q,oe=U(te);if(te.act==="kick"){const pe=(he=(re=C.current)==null?void 0:re.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:he.getBoundingClientRect();pe&&m({x:VX(pe.x,Jy(te,de,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-pe.y+24)})}D=te.act==="walk"?Math.max(Qt(de,oe),_X):te.ms,te.act==="carry"&&(D=Qt(de,oe)),i(D),v(pe=>Jy({...te,x:oe},de,pe)),a(oe),q=oe,T=te,F=Date.now(),R.schedule(()=>K(le),D)},V=()=>{const Q=C.current,te=Q==null?void 0:Q.querySelector(".fm-sprite"),le=Q==null?void 0:Q.parentElement;if(!Q||!te||!le)return null;const de=Q.getBoundingClientRect(),oe=le.getBoundingClientRect(),re=oe.right-de.right,he=oe.width-re*2-te.offsetWidth;return he>0?he:null},H=()=>{const Q=C.current,te=Q==null?void 0:Q.querySelector(".fm-sprite");return!Q||!te?0:Math.max(0,Q.getBoundingClientRect().width-te.offsetWidth)},P=()=>{const Q=C.current,te=Q==null?void 0:Q.querySelector(".fm-walker"),le=V();if(!Q||!te||le==null)return;const de=Q.getBoundingClientRect().bottom-te.getBoundingClientRect().bottom;if(de>0)return{ledgeH:de,floorSpan:le,ledgeSpan:H()}},I=()=>{const Q=C.current,te=document.querySelector(".canvas-notices");if(!Q||!te)return null;const le=Q.getBoundingClientRect(),de=te.getBoundingClientRect();return de.width<=0||de.height<=0?null:{left:de.left-le.right,right:de.right-le.right,height:de.height}},U=Q=>{const te=(Q.place??"ledge")==="floor",le=te?V()??H():H(),de=te&&Q.floorFrac!=null?-Math.round(Q.floorFrac*le):Q.x;return Math.max(-le,Math.min(0,de))},Z=()=>{if(!T)return;const Q=U(T);Q!==q&&(i(Math.max(0,F+D-Date.now())),v(te=>Jy({...T,x:Q},q,te)),a(Q),q=Q)},z=()=>{R.schedule(()=>{const Q=HX(q,Math.random,P()),te=Q.some(oe=>oe.place==="floor")?I():null;let le=q;const de=Q.flatMap(oe=>{const re=le;if(le=oe.x,!(oe.place==="floor"&&oe.act==="walk"))return[oe];const he=YX(re,oe.x,te),pe=he.length-1;return oe.floorFrac==null?he:he.map((Le,ge)=>ge===pe?{...Le,floorFrac:oe.floorFrac}:Le)});K(de)},xX(Math.random))},X=(J=C.current)==null?void 0:J.parentElement,Y=typeof ResizeObserver>"u"?null:new ResizeObserver(Z);return X&&Y&&Y.observe(X),z(),()=>{R.dispose(),Y==null||Y.disconnect(),b("ledge"),a(Q=>Math.max(-H(),Math.min(0,Q))),i(0),u(null),f(null),x(0)}},[e,t,W]),g.useEffect(()=>{if(!n||W){A(null);return}const R=zT(document),q=T=>{const F=JX(T,Math.random);A(F.dance),M(F.beatMs),R.schedule(()=>q(F.dance),QX(Math.random))};return q(null),()=>R.dispose()},[n,W]),{scene:C,suspended:S,x:s,walkMs:o,act:l,prop:h,ballFlight:p,place:w,facing:k,riser:N,dance:$,beatMs:O}}const ew={e:"fm-eye",s:"fm-shade",p:"fm-pad"},lp=fo().filter(e=>!AN.has(e.cell)),lZ=fo().filter(e=>AN.has(e.cell)),VT=lp.filter(e=>e.cell==="e"),cZ=fo(rZ),uZ=lp.filter(e=>e.y<L1&&e.cell!=="e").map(e=>{if(e.y!==8&&e.y!==9)return e;const t=Math.max(6,e.x);return{...e,x:t,w:Math.max(0,Math.min(12,e.x+e.w)-t)}}).filter(e=>e.w>0),dZ={left:lp.filter(e=>e.y>=L1&&e.x<HT),right:lp.filter(e=>e.y>=L1&&e.x>=HT)},hZ=g.memo(function({act:t,facing:n}){return r.jsxs("svg",{viewBox:`0 0 ${WT} ${eZ}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:lZ.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:ew[s.cell]},`g${s.y}-${s.x}`))})}),r.jsxs("g",{className:"fm-body",children:[VT.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,fill:"var(--accent)"},`eye-bed-${s.x}`)),uZ.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:ew[s.cell]},`b${s.y}-${s.x}`)),r.jsxs("g",{className:"fm-arms",children:[r.jsx("rect",{x:4,y:8,width:2,height:2}),r.jsx("rect",{x:12,y:8,width:1,height:2}),r.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),VT.map(s=>r.jsx("rect",{x:s.x-(s.x>=WT/2?1:0)+(n==="right"?1:0),y:s.y,width:s.w,height:1,className:"fm-eye"},`eye-${s.x}`))]}),r.jsx("g",{className:"fm-hat",children:cZ.map(s=>r.jsx("rect",{x:aZ+s.x,y:oZ+s.y,width:s.w,height:1,className:s.cell==="k"?"fm-hatband":void 0},`h${s.y}-${s.x}`))}),(t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up")&&r.jsxs("g",{className:"fm-grip",children:[r.jsx("path",{className:"fm-grip-left",d:mD}),r.jsx("path",{className:"fm-grip-right",d:gD})]}),(t==="land"||t==="dismount")&&r.jsxs("g",{className:"fm-crouch-legs",children:[r.jsx("path",{d:"M6 11H8V13H6Z"}),r.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(t)&&r.jsxs("g",{className:"fm-seated-legs",children:[r.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),r.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(s=>r.jsx("g",{className:"fm-leg","data-side":s,children:dZ[s].map(a=>r.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:ew[a.cell]},`${s}${a.y}-${a.x}`))},s))]})}),fZ=["...o........o.....","...of......fo.....","...owffffffwo.....","...offfffffso.....","...ofefffefso.....","....owwnwwso......",".....wwwww........",".....fwwwfs.......","....ffwwwffs...ww.","....ffwwwffs..wfs.","......fwwfssfffs..","......ff..fsffs...","......ff..fs......","......oo..oo......"],pZ=[".....aaaaaaa......","...aa.......aa....","..a...........a...","..cp.........pc...","..cp.........pc...","..cp.........pc...","..c...........c..."],fr={f:"#d88735",s:"#a55b24",o:"#63351e",w:"#ffe2aa",n:"#372821"},mZ={p:"fm-pad"},Xu=fo(fZ),gZ=fo(pZ);function I1(e,t,n){return e.map(s=>({...s,x:Math.max(t,s.x),w:Math.max(0,Math.min(n,s.x+s.w)-Math.max(t,s.x))})).filter(s=>s.w>0)}const yZ=I1(Xu.filter(e=>e.y>=8),12,18),wZ=Xu.filter(e=>e.y<11&&e.cell!=="e").map(e=>e.y===8||e.y===9?{...e,x:Math.max(6,e.x),w:Math.max(0,Math.min(12,e.x+e.w)-Math.max(6,e.x))}:e.y===10?{...e,w:Math.max(0,Math.min(12,e.x+e.w)-e.x)}:e).filter(e=>e.w>0),GT=Xu.filter(e=>e.cell==="e"),xZ={left:I1(Xu.filter(e=>e.y>=11),0,9),right:I1(Xu.filter(e=>e.y>=11),9,12)},vZ=g.memo(function({act:t,facing:n}){const s=t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up",a=t==="land"||t==="dismount",o=t==="sit"||t==="cast"||t==="fish"||t==="reel"||t==="stow";return r.jsxs("svg",{"data-character":"fox",viewBox:"0 0 18 14",shapeRendering:"crispEdges","aria-hidden":!0,focusable:"false",children:[r.jsx("g",{className:"fm-body","data-part":"tail",children:yZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:fr[i.cell]},`t${i.y}-${i.x}`))}),r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:gZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,className:mZ[i.cell]},`g${i.y}-${i.x}`))})}),r.jsxs("g",{className:"fm-body",children:[wZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:fr[i.cell]},`b${i.y}-${i.x}`)),GT.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:fr.f},`bed${i.x}`)),r.jsxs("g",{className:"fm-arms",fill:fr.f,children:[r.jsx("rect",{x:4,y:8,width:2,height:2}),r.jsx("rect",{x:12,y:8,width:1,height:2})]}),GT.map(i=>r.jsx("rect",{x:i.x+(n==="right"?1:0)-(i.x>=9?1:0),y:i.y,width:i.w,height:1,className:"fm-eye",style:{fill:fr.n}},`e${i.x}`))]}),s&&r.jsxs("g",{className:"fm-grip",style:{fill:fr.f},children:[r.jsx("path",{className:"fm-grip-left",d:mD}),r.jsx("path",{className:"fm-grip-right",d:gD})]}),a&&r.jsxs("g",{className:"fm-crouch-legs",style:{fill:fr.f},children:[r.jsx("path",{d:"M6 11H8V13H6Z"}),r.jsx("path",{d:"M10 11H12V13H10Z"})]}),o&&r.jsxs("g",{className:"fm-seated-legs",style:{fill:fr.f},children:[r.jsx("path",{className:"fm-seated-far",style:{fill:fr.s},d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),r.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(i=>r.jsx("g",{className:"fm-leg","data-side":i,children:xZ[i].map(l=>r.jsx("rect",{x:l.x,y:l.y,width:l.w,height:1,fill:fr[l.cell]},`${l.y}-${l.x}`))},i))]})}),bZ=[".......dddd.......","......dhhhhd......",".....dhhhhhhd.....","....dhwwhhwwhd....","....dhwewwewhd....","....dhwwbbwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....",".....dhwwwwhd.....",".....dhwwwwhd.....","......dhhhhd......","......bb..bb......",".....bbb..bbb....."],Jr={d:"#3b4855",h:"#657b8b",w:"#f4f0df",e:"#19242b",b:"#f0b44b",s:"#c88736"},kZ={p:"fm-pad"},cp=fo(bZ),jZ=fo(TN).filter(e=>AN.has(e.cell)),KT=cp.filter(e=>e.cell==="e"),NZ=cp.filter(e=>e.y<12&&e.cell!=="e"),SZ={left:cp.filter(e=>e.y>=12&&e.x<9),right:cp.filter(e=>e.y>=12&&e.x>=9)},CZ=g.memo(function({act:t}){const n=t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up",s=t==="land"||t==="dismount",a=t==="sit"||t==="cast"||t==="fish"||t==="reel"||t==="stow";return r.jsxs("svg",{"data-character":"penguin",viewBox:"0 0 18 14",shapeRendering:"crispEdges","aria-hidden":!0,focusable:"false",children:[r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:jZ.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:kZ[o.cell]},`g${o.y}-${o.x}`))})}),r.jsxs("g",{className:"fm-body",children:[NZ.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Jr[o.cell]},`b${o.y}-${o.x}`)),KT.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Jr.w},`bed${o.x}`)),r.jsxs("g",{className:"fm-arms",fill:Jr.d,children:[r.jsx("path",{d:"M4 8H6V10H5V11H4Z"}),r.jsx("path",{d:"M12 8H14V11H13V10H12Z"})]}),KT.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:"fm-eye",style:{fill:Jr.e}},`e${o.x}`))]}),n&&r.jsxs("g",{className:"fm-grip",style:{fill:Jr.h},children:[r.jsx("path",{className:"fm-grip-left",d:"M5 10H4V4H5V2H6V1H7V0H9V2H7V3H6V10Z"}),r.jsx("path",{className:"fm-grip-right",d:"M12 10H14V6H13V3H11V2H9V4H12Z"})]}),s&&r.jsxs("g",{className:"fm-crouch-legs",style:{fill:Jr.b},children:[r.jsx("path",{d:"M5 12H8V13H5Z"}),r.jsx("path",{d:"M10 12H13V13H10Z"})]}),a&&r.jsxs("g",{className:"fm-seated-legs",style:{fill:Jr.b},children:[r.jsx("path",{className:"fm-seated-far",style:{fill:Jr.s},d:"M10 11H12V12H13V14H10V13H11V12H10Z"}),r.jsx("path",{d:"M6 11H8V12H7V13H8V14H4V13H5V12H6Z"})]}),["left","right"].map(o=>r.jsx("g",{className:"fm-leg","data-side":o,children:SZ[o].map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:Jr.b},`${i.y}-${i.x}`))},o))]})});function yD({character:e,act:t,facing:n}){return e==="penguin"?r.jsx(CZ,{act:t,facing:n}):e==="fox"?r.jsx(vZ,{act:t,facing:n}):r.jsx(hZ,{act:t,facing:n})}const _Z={"claude-fm":"Claude FM","lofi-relax":"Lofi Girl relax/study","lofi-game":"Lofi Girl chill/game","lofi-vibe":"Lofi Girl vibe/chill","lofi-sleep":"Lofi Girl sleep/chill","radio-mix":"Radio Mix Live","best-of-nostalgia":"Best of Nostalgia Live","good-life-radio":"The Good Life Radio Live","cafe-music-bgm":"Cafe Music BGM Live"};function wD(e,t){return t&&Xl(t.id)===e?t.name:lm(e)?"Custom FM":_Z[e]}function tw(e,t){var s;const n=((s=e[0])==null?void 0:s.length)??0;return r.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:fo(e).map(a=>r.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:a.cell==="s"?"var(--fm-prop-shadow, var(--bg))":a.cell==="l"?"var(--fm-prop-light, var(--text))":a.cell==="a"?"var(--accent)":void 0},`${t}${a.y}-${a.x}`))})}const YT={litter:tw(Qy.litter,"litter"),ball:tw(Qy.ball,"ball"),scope:tw(Qy.scope,"scope")};function EZ(e){try{return new URL(e).host}catch{return"the station's server"}}const TZ=g.memo(function({player:t,source:n,customStation:s,character:a="deck"}){const{probe:o,dead:i,playing:l,press:u}=t,{scene:h,suspended:f,x:p,walkMs:m,act:w,prop:b,ballFlight:k,place:v,facing:N,riser:x,dance:C,beatMs:S}=iZ(o,i,l);if(!o||i)return null;const _=wD(n,s),$=o.audio?EZ(o.audio):"YouTube";return r.jsxs("div",{ref:h,className:"fm","data-suspended":f?"":void 0,"data-place":v,style:{"--fm-beat":`${S}ms`},children:[b&&!b.held&&r.jsx("div",{className:"fm-prop","data-prop":b.kind,"data-leaving":b.leaving?"":void 0,style:{"--fm-prop-x":`${b.at}px`,"--fm-roll-to":`${k.x}px`,"--fm-ball-drop":`${k.drop}px`,"--fm-ball-flight-ms":`${dD}ms`,"--fm-ball-turn":N==="right"?"1080deg":"-1080deg"},children:YT[b.kind]}),(w==="lasso"||w==="rope-throw"||w==="rope-catch"||w==="climb"||w==="pull-up")&&r.jsxs("div",{className:"fm-rope","data-act":w,style:{"--fm-rope-x":`${p}px`,"--fm-rope-ms":`${m}ms`},children:[r.jsx("div",{className:"fm-rope-line"}),r.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),r.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),r.jsxs("div",{className:"fm-walker","data-act":w??void 0,"data-place":v,"data-facing":N,style:{"--fm-x":`${p}px`,"--fm-walk-ms":`${m}ms`,"--fm-riser":`${x}px`,"--fm-skip-beat":`${hD}ms`},children:[(b==null?void 0:b.held)&&r.jsx("div",{className:"fm-held","data-prop":b.kind,"data-toss":b.leaving?"":void 0,children:YT[b.kind]}),["cast","fish","reel","stow"].includes(w)&&r.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsxs("g",{children:[r.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),r.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),r.jsxs("g",{className:"fm-fishing-line",children:[r.jsx("path",{d:"M8 2V26"}),r.jsxs("g",{className:"fm-float",children:[r.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),r.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),r.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(w)&&r.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),r.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),r.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),r.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),r.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),r.jsx("button",{type:"button",className:"fm-sprite","data-playing":l?"":void 0,"data-dance":l?C??fD[0]:void 0,onClick:u,title:l?`Stop ${_}`:`Play ${_} — streams from ${$}`,"aria-label":l?`Stop ${_}`:`Play ${_}`,children:r.jsx(yD,{character:a,act:w,facing:N})})]})]})});function AZ({player:e,label:t}){const{probe:n,armed:s,frame:a,say:o}=e;return n?r.jsx(r.Fragment,{children:s&&!n.audio&&(n.channel||n.video)&&r.jsx("iframe",{ref:a,className:"fm-frame",title:t,src:rX(n.channel,window.location.origin,n.video),onLoad:()=>o(aX()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})}):null}const RZ={radio:"M4 8h16v12H4z M7 8l10-5 M7 12h5 M15 12h2 M7 16h2 M13 16h4",play:"M8 5l11 7-11 7z",pause:"M8 5v14 M16 5v14",shuffle:"M3 6h3c5 0 7 12 12 12h3 M17 14l4 4-4 4 M3 18h3c2 0 4-3 6-6s4-6 6-6h3 M17 2l4 4-4 4",heart:"M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1.1-1.1a5.5 5.5 0 0 0-7.8 7.8L12 21l8.8-8.6a5.5 5.5 0 0 0 0-7.8z",close:"M6 6l12 12 M6 18L18 6",search:"M10.5 3a7.5 7.5 0 1 0 0 15 7.5 7.5 0 0 0 0-15 M16 16l5 5",globe:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20 M2 12h20 M12 2c-6 6-6 14 0 20 M12 2c6 6 6 14 0 20",back:"M16 5l-7 7 7 7",previous:"M5 5v14 M19 5l-10 7 10 7z",next:"M19 5v14 M5 5l10 7-10 7z",volume:"M11 4L6 8H3v8h3l5 4z M15 8a6 6 0 0 1 0 8 M18 5a10 10 0 0 1 0 14",muted:"M11 4L6 8H3v8h3l5 4z M16 9l6 6 M16 15l6-6",headphones:"M4 14v-3a8 8 0 0 1 16 0v3 M4 12h3v8H5a2 2 0 0 1-2-2v-4a2 2 0 0 1 1-2 M20 12h-3v8h2a2 2 0 0 0 2-2v-4a2 2 0 0 0-1-2",book:"M12 6v15 M12 6C9 4 6 3 3 4v15c3-1 6 0 9 2 3-2 6-3 9-2V4c-3-1-6 0-9 2",gamepad:"M8 7h8c3 0 4 2 5 8 1 5-2 6-5 2H8c-3 4-6 3-5-2 1-6 2-8 5-8z M6 11h4 M8 9v4 M16 10h.01 M18 13h.01",sunset:"M3 17h18 M5 21h14 M7 17a5 5 0 0 1 10 0 M12 3v3 M4 8l2 2 M20 8l-2 2",moon:"M20 14A9 9 0 0 1 10 3a9 9 0 1 0 10 11z",cassette:"M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z M7 8h10v5H7z M7 20l2-4h6l2 4 M9 10.5h.01 M15 10.5h.01",palm:"M12 8c2 4 3 8 2 13 M12 8C8 3 4 4 2 8c4-1 7-1 10 0 M12 8c1-6 6-7 10-2-4-1-7 0-10 2 M12 8c-5 0-7 3-7 7 2-3 4-5 7-7 M12 8c4 0 7 3 7 7-2-3-4-5-7-7 M10 21h8",coffee:"M4 8h12v8a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4z M16 9h2a3 3 0 0 1 0 6h-2 M7 3v2 M11 3v2 M3 22h15",check:"M5 12l4 4L19 6",filters:"M4 6h4 M12 6h8 M4 12h10 M18 12h2 M4 18h2 M10 18h10 M8 4v4 M14 10v4 M6 16v4"};function MZ({name:e}){return r.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:RZ[e]})})}function $Z({opening:e=!1}){const[t,n]=g.useState(()=>document.hidden);return g.useEffect(()=>{const s=()=>n(document.hidden);return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[]),r.jsxs("div",{className:"radio-tuning",role:"status","data-paused":t||void 0,children:[r.jsxs("svg",{className:"radio-tuning-art",viewBox:"0 0 240 112",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[r.jsxs("g",{className:"radio-tuning-tower",children:[r.jsx("circle",{cx:"40",cy:"24",r:"4"}),r.jsx("path",{d:"M40 28v60 M40 36L24 88h32L40 36 M31 66h18 M28 77h24 M20 92h40"}),r.jsx("path",{d:"M29 17a15 15 0 0 0 0 14 M51 17a15 15 0 0 1 0 14"})]}),r.jsxs("g",{className:"radio-tuning-send",children:[r.jsx("path",{d:"M75 26q7 8 0 16"}),r.jsx("path",{d:"M102 26q7 8 0 16"}),r.jsx("path",{d:"M129 26q7 8 0 16"})]}),r.jsxs("g",{className:"radio-tuning-receiver",children:[r.jsx("path",{d:"M165 49l30-22"}),r.jsx("rect",{x:"154",y:"49",width:"66",height:"43",rx:"7"}),r.jsx("path",{d:"M161 92v3 M213 92v3 M163 60h17 M163 66h17 M163 72h17 M163 78h17"}),r.jsx("circle",{cx:"202",cy:"65",r:"7"}),r.jsx("path",{d:"M202 62v3l3 2 M197 81h10"})]})]}),r.jsx("strong",{children:e?"Opening Radio":"Tuning into the world"}),r.jsx("span",{children:e?"Getting your explorer ready…":"Finding stations…"})]})}function LZ({onClose:e}){const[t]=g.useState(()=>{var s;return((s=document.activeElement)==null?void 0:s.matches(":focus-visible"))??!1}),n=gt(e);return r.jsxs("div",{ref:n,className:"radio-loading nodrag nopan",role:"dialog","aria-modal":"true","aria-label":"Opening Radio","data-keyboard-interaction":t||void 0,onKeyDown:KG,children:[r.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close radio",onClick:e,children:r.jsx(MZ,{name:"close"})}),r.jsx($Z,{opening:!0})]})}const IZ=g.lazy(()=>bi(()=>import("./RadioPanel-s7WXdS6v.js"),[]));function OZ({fm:e,characterEnabled:t,character:n,open:s,onClose:a}){const[o,i]=g.useState(!1),[l,u]=g.useState("Connecting to the deck…"),h=mX(),[f,p]=g.useState(null),m=g.useRef(new Set);g.useEffect(()=>{const A=new AbortController;return fetch("/api/music-config",{signal:A.signal}).then(O=>O.ok?O.json():null).then(O=>{A.signal.aborted||(i((O==null?void 0:O.enabled)===!0),u(O?"Music is turned off on this deck.":"Cannot reach the deck. Reopen Radio when it reconnects."))}).catch(()=>{A.signal.aborted||u("Cannot reach the deck. Reopen Radio when it reconnects.")}),()=>A.abort()},[s]);const w=e.customFmStations.find(A=>Xl(A.id)===e.fmSource),b=w!=null&&w.radio?w:void 0,k=hX({volume:e.fmVolume,muted:e.fmMuted,source:e.fmSource,playRequest:e.fmPlayRequest,customStation:w,enabled:o,onAvailabilityChange:e.markFmStationAvailability}),v=wD(e.fmSource,w),N=o&&b&&k.dead&&e.fmPlayRequest>0?cD(f??h.catalogue,b.id,m.current):null,{remember:x}=h,C=(w==null?void 0:w.id)??e.fmSource;g.useEffect(()=>{k.playing&&x(C)},[C,k.playing,x]);const S=a,_=yt(a),$=g.useCallback((A,O=!1)=>{var R;if(!o)return;O||m.current.clear();const M=Xl(A.id),W=M===e.fmSource;if(W&&k.armed&&!k.dead){k.press();return}const B=W&&!!w&&(w.url!==A.url||((R=w.radio)==null?void 0:R.hls)!==A.radio.hls);e.addFmStation(A,!0),W&&!k.dead&&!B?k.press():e.pickFmSource(M,B),fetch(`/api/radio-click?id=${encodeURIComponent(A.id)}`).catch(()=>{})},[o,w,e.addFmStation,e.fmSource,e.pickFmSource,k.armed,k.dead,k.press]);return g.useEffect(()=>{k.playing&&!k.dead&&m.current.clear()},[k.playing,k.dead]),g.useEffect(()=>{if(!(!o||!b||!k.dead||e.fmPlayRequest===0))return gX(f??h.catalogue,b.id,m.current,A=>$(A,!0))},[o,b==null?void 0:b.id,k.dead,e.fmPlayRequest,f,h.catalogue,$]),r.jsxs(r.Fragment,{children:[t&&r.jsx(TZ,{character:n,player:k,source:e.fmSource,customStation:w}),r.jsx(AZ,{player:k,label:v}),s&&vt.createPortal(r.jsx("div",{className:"modal-backdrop radio-backdrop",..._,children:r.jsx(g.Suspense,{fallback:r.jsx(LZ,{onClose:S}),children:r.jsx(IZ,{fm:e,player:k,library:h,selected:b,label:v,enabled:o,disabledReason:l,autoNext:N==null?void 0:N.name,onPick:$,onQueueChange:p,onClose:S})})}),document.body)]})}function PZ({data:e}){const t=_r(3e4),n=e.note,s=e.plan??null,a=(n==null?void 0:n.kind)==="recap",o=ap((n==null?void 0:n.at)??(s==null?void 0:s.at)??t,t),i=`${a?"recap-note":`recap-note is-status status-${(n==null?void 0:n.kind)??"plan"}`}${s?" has-plan":""}`,l=a||!n?void 0:am(n),u=Cr(s),h=n?rc(n.kind):`plan ${u?`${u.done}/${u.total}`:""}`.trim();return r.jsxs("div",{className:i,role:"note","aria-label":a?"Claude Code's recap":`Session note: ${h}`,"aria-description":l,style:{"--session-hue":e.hue},children:[r.jsxs("div",{className:"recap-note-head",title:l,children:[r.jsxs("span",{className:"recap-note-mark",children:[r.jsx(sp,{recap:a}),h]}),r.jsx("span",{className:"recap-note-age",title:o.title,children:o.label}),r.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":a?"Hide the recap":n?"Hide this note":"Hide the plan",title:"Hide — the mark on the card brings it back",onClick:f=>{f.stopPropagation(),yK(e.noteKey)},children:"×"})]}),n&&r.jsx("p",{className:"recap-note-text",title:EK(n.text,l),children:n.text}),(n==null?void 0:n.reply)&&r.jsxs("p",{className:"recap-note-reply",title:`suggested reply “${n.reply}”`,children:["suggested reply “",n.reply,"”"]}),s&&r.jsx(XT,{plan:s,head:n!=null}),r.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[r.jsxs("div",{className:"lod-id",children:[r.jsxs("span",{className:"recap-note-mark",children:[r.jsx(sp,{recap:a}),h]}),r.jsx("span",{className:"recap-face-age",children:o.label})]}),n&&r.jsx("p",{className:"recap-face-text",children:n.text}),s&&r.jsx(XT,{plan:s,head:n!=null,face:!0})]}),r.jsx(fi,{type:"source",position:Ye.Right,style:{background:"transparent",border:"none"}})]})}const DZ={completed:"done",in_progress:"now",pending:"to do"};function XT({plan:e,head:t,face:n=!1}){const s=Cr(e);if(!s)return null;const a=gV(e.items);return r.jsxs("div",{className:n?"recap-face-plan":"recap-note-plan",title:n?void 0:Kp(e.items),children:[t&&r.jsxs("div",{className:"recap-note-plan-head",children:["Plan ",r.jsxs("span",{className:"recap-note-plan-count",children:[s.done,"/",s.total,s.allDone?" · done":""]})]}),!s.allDone&&r.jsxs("ol",{className:"plan-list",children:[a.shown.map((o,i)=>r.jsxs("li",{className:"plan-item","data-status":o.status,children:[r.jsx("span",{className:"plan-mark","aria-hidden":!0}),!n&&r.jsxs("span",{className:"vis-hidden",children:[DZ[o.status],": "]}),r.jsx("span",{className:"plan-text",children:o.status==="in_progress"&&o.active?o.active:o.text}),o.status==="in_progress"&&r.jsx("span",{className:"plan-now","aria-hidden":!0,children:"now"})]},o.id??`${i}:${o.text}`)),(a.before>0||a.after>0)&&r.jsx("li",{className:"recap-note-plan-more",children:[a.before>0?`${a.before} earlier`:null,a.after>0?`+${a.after} more`:null].filter(Boolean).join(" · ")})]})]})}function ro(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function po(e){return/mac|iphone|ipad/i.test(e)}const up=e=>new Map([...e].map(([t,n])=>[t,{x:n.x,y:n.y}]));function FZ(e,t,n){return{positions:up(e.positions),pinned:up(e.pinned),provisional:new Set(e.provisional),layoutSig:e.layoutSig.current,stored:{...t},viewport:n?{...n}:null}}function BZ(e,t){t.positions.clear();for(const[n,s]of up(e.positions))t.positions.set(n,s);t.pinned.clear();for(const[n,s]of up(e.pinned))t.pinned.set(n,s);t.provisional.clear();for(const n of e.provisional)t.provisional.add(n);t.layoutSig.current=e.layoutSig}const ZT=7e3,qZ=2e3,UZ=140,WZ="Layout re-arranged",HZ="Layout re-arranged. Undo available.",JT="Layout restored.",zZ={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e),now:()=>Date.now()};function VZ(e,t=zZ){let n=null,s=null,a=0,o=ZT;const i=new Set,l=()=>{s!==null&&t.clear(s),s=null},u=()=>{l(),!(n===null||i.size>0)&&(a=t.now()+o,s=t.set(()=>{s=null,h()},o))};function h(){l(),i.clear(),n!==null&&(n=null,e(!1))}return{open(f){const p=n===null;n=f,o=ZT,u(),p&&e(!0)},take(){const f=n;return h(),f},close:h,hold(f){n!==null&&(i.size===0&&s!==null&&(o=Math.max(0,a-t.now()),l()),i.add(f))},release(f){!i.delete(f)||i.size>0||n===null||(o=Math.max(o,qZ),u())},get isOpen(){return n!==null},get snapshot(){return n}}}function GZ(e){return(e.key==="z"||e.key==="Z")&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey}function KZ(e){return po(e)?"⌘Z":"Ctrl+Z"}function YZ({undo:e}){const{open:t,said:n,undo:s,dismiss:a,hold:o,release:i}=e,l=Nl(t,UZ),u=g.useRef(null);return g.useEffect(()=>t?rn.push(a,0,"popover"):void 0,[t,a]),g.useEffect(()=>{var f;if(t)return;const h=u.current;h&&h.contains(document.activeElement)&&((f=h.closest("main"))==null||f.focus({preventScroll:!0}))},[t]),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:n}),Ja(l)&&r.jsxs("div",{ref:u,className:l==="leaving"?"rearrange-undo leaving":"rearrange-undo",onPointerEnter:()=>o("hover"),onPointerLeave:()=>i("hover"),onFocus:()=>o("focus"),onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||i("focus")},children:[r.jsx("span",{id:"rearrange-undo-state",className:"rearrange-undo-state",children:WZ}),r.jsxs("button",{type:"button",className:"rearrange-undo-act",onClick:s,"aria-describedby":"rearrange-undo-state","aria-keyshortcuts":"Meta+Z Control+Z",children:["Undo",r.jsx("span",{className:"rearrange-undo-key","aria-hidden":"true",children:KZ(ro())})]})]})]})}function XZ({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a,targetPosition:o,style:i}){const[l]=Jj({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:s,targetPosition:o,curvature:.35});return r.jsxs("g",{className:"recap-tie",style:i,children:[r.jsx("path",{className:"recap-tie-thread",d:l,vectorEffect:"non-scaling-stroke"}),r.jsx("path",{className:"recap-tie-beads",d:l,vectorEffect:"non-scaling-stroke"}),r.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),r.jsx("circle",{className:"recap-tie-end",cx:n,cy:s,r:3.5})]})}function O1(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function dp(e,t){const n=O1(e);return n?n.slice(-t):e.slice(-t)}function xD(e,t,n=4){const s=O1(e);if(!s)return dp(e,n);let a=n;for(const o of t){if(o===e)continue;const i=O1(o);let l=0;for(;l<s.length&&l<i.length&&s[s.length-1-l]===i[i.length-1-l];)l++;a=Math.max(a,l+1)}return s.slice(-a)}const Sl=" · ",ZZ=32,JZ=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function QT(e){return JZ.test(e)?2:1}function eA(e,t=ZZ){const n=[...e];let s=0;for(const i of n)s+=QT(i);if(s<=t)return e;const a=[];let o=0;for(const i of n){const l=QT(i);if(o+l>t-1)break;a.push(i),o+=l}for(;a.length&&/[\s\-_.:/]/.test(a[a.length-1]);)a.pop();return`${a.join("")}…`}function QZ(e,t,n,s,a=[],{branch:o,plan:i,alarm:l=!1}={}){const u=(t==null?void 0:t.trim())??"",h=s?xD(n,a):void 0,f=[e,u||void 0,h].filter(Boolean),p=[e,i?`plan ${i}`:void 0,o,u||void 0,h].filter(Boolean).join(Sl);return{label:eA(e),name:u?eA(u):void 0,shortId:h,fullLabel:f.join(Sl),title:`${l?"waiting on you: ":""}${p}
|
|
90
90
|
Zoom to this session
|
|
91
91
|
drag the wrapper to move the whole session`}}const ti=18,P1=26,RN=12,Zu=240,MN=130,D1=ti*2+P1+RN,eJ=72,Il=D1+eJ,Lf=24,vD=70,bD=ti*2+Lf,hp=Il;function kD(e,t){var s;let n=Zu;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??Zu);return n}const Ol=420,If=300,fp=130,jD=160,ND=1;function tJ(e,t,n,s){return Math.min(ND,n/Math.max(1,e),s/Math.max(1,t))}function Tn(e){const t=e.data;return(t==null?void 0:t.canvasSessionId)??(t==null?void 0:t.sessionId)??"_default"}function um(e,t=()=>!0){const n=new Map;for(const s of e){if(!t(s))continue;const a=Tn(s),o=n.get(a);o?o.push(s):n.set(a,[s])}return n}function nJ(e,t){return((t==null?void 0:t.get(e))??0)>0?Ol:0}function sJ(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function Ju(e,t){const n=t.get(e);return{w:(n==null?void 0:n.width)??Zu,h:(n==null?void 0:n.height)??MN}}function xd(e,t,n){const s=Ju(e,t);return{w:s.w+nJ(e,n),h:Math.max(s.h,sJ(e,n))}}function rJ(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}const aJ=240,SD=16;function CD(e,t){return(e+aJ)*(t||1)}function oJ(e,t){return{position:"absolute",left:0,top:0,transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,"--session-hue":t}}function iJ(e,t,n,s){return{position:"absolute",left:e.x+SD,top:e.y-RN/(t||1),transform:`scale(${1/(t||1)})`,transformOrigin:"left top",maxWidth:s??CD(e.w,t),"--session-hue":n}}function lJ(e){const t=new Map;for(const a of e){if(a.type!=="agent"&&a.type!=="recapNote")continue;const o=a.data;if(!(o!=null&&o.sessionId)||o.exitAt!=null||a.width==null||a.height==null)continue;const i=a.position.x,l=a.position.y,u=i+a.width,h=l+a.height,f=t.get(Tn(a)),p=o.canvasSessionId&&o.canvasSessionId!==o.sessionId?null:cJ(o);f?(f.minX=Math.min(f.minX,i),f.minY=Math.min(f.minY,l),f.maxX=Math.max(f.maxX,u),f.maxY=Math.max(f.maxY,h),p&&(f.label=p.label??f.label,f.name=p.name,f.alarm=p.alarm,f.branch=p.branch,f.plan=p.plan,f.planLine=p.planLine)):t.set(Tn(a),{minX:i,minY:l,maxX:u,maxY:h,label:(p==null?void 0:p.label)??o.sessionId,name:p==null?void 0:p.name,alarm:(p==null?void 0:p.alarm)??!1,branch:p==null?void 0:p.branch,plan:p==null?void 0:p.plan,planLine:p==null?void 0:p.planLine})}const n=new Map;for(const[a,o]of t){const i=n.get(o.label);i?i.push(a):n.set(o.label,[a])}const s=[];for(const[a,o]of t){const i=n.get(o.label)??[],l=i.length>1;s.push({sessionId:a,...QZ(o.label,o.name,a,l,i,{branch:o.branch,plan:o.planLine,alarm:o.alarm}),x:o.minX-ti,y:o.minY-ti-P1,w:o.maxX-o.minX+ti*2,h:o.maxY-o.minY+ti*2+P1,...o.alarm?{alarm:!0}:null,...o.branch?{branch:o.branch}:null,...o.plan?{plan:o.plan,planLine:o.planLine}:null})}return s}function cJ(e){if(e.kind!=="root")return null;const t=e.branch,n=Cr(e.plan);return{label:e.label,name:tm(e.sessionName,e.sessionTitle).face,alarm:En(e.waiting),branch:t&&t.total>0?BP(t):void 0,plan:n?`plan ${n.done}/${n.total}`:void 0,planLine:n?uN(n):void 0}}function uJ(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.sessionId!==a.sessionId||s.label!==a.label||s.name!==a.name||s.shortId!==a.shortId||s.alarm!==a.alarm||s.branch!==a.branch||s.plan!==a.plan||s.planLine!==a.planLine||s.fullLabel!==a.fullLabel||s.title!==a.title||s.x!==a.x||s.y!==a.y||s.w!==a.w||s.h!==a.h)return!1}return!0}const dJ=20,Qr=4,hJ=64,fJ=".cat-filter-bar, .react-flow__panel, .autofit-chip, .rearrange-undo, .usage-panel, .sysdetail, .detail";function pJ(e,t,n,s){const a=t.zoom||1,o=CD(e.w,a);if(n.width<=0||n.height<=0)return{maxWidth:o,hidden:!1};const i=(e.x+SD)*a+t.x,l=e.y*a+t.y-RN,u=l+dJ;let h=Math.min(o,n.width-Qr-i),f=i<Qr||l<Qr||u>n.height-Qr;for(const p of s)if(!(p.top-Qr>=u||p.bottom+Qr<=l)&&!(p.right+Qr<=i)){if(p.left-Qr<=i){f=!0;break}h=Math.min(h,p.left-Qr-i)}return h<hJ&&(f=!0),{maxWidth:Math.max(0,h),hidden:f}}function mJ(e){const t=e.getBoundingClientRect(),n=[];for(const s of e.ownerDocument.querySelectorAll(fJ)){const a=s.getBoundingClientRect(),o=Math.max(a.left,t.left)-t.left,i=Math.max(a.top,t.top)-t.top,l=Math.min(a.right,t.right)-t.left,u=Math.min(a.bottom,t.bottom)-t.top;l-o<1||u-i<1||n.push({left:Math.round(o),top:Math.round(i),right:Math.round(l),bottom:Math.round(u)})}return n}function gJ(e,t){return e.length===t.length&&e.every((n,s)=>{const a=t[s];return n.left===a.left&&n.top===a.top&&n.right===a.right&&n.bottom===a.bottom})}const yJ=500;function _D({focus:e,setTimeout:t,clearTimeout:n,ms:s=yJ}){let a=null;const o=()=>{a!==null&&(n(a),a=null)};return{hold(i){o(),a=t(()=>{a=null;try{e(i)}catch{}},s)},cancel:o}}function wJ(e){return lJ(e.nodeInternals.values())}const xJ=e=>e.width,vJ=e=>e.height,bJ=e=>{var t;return((t=e.domNode)==null?void 0:t.querySelector(".react-flow__viewport"))??null};function kJ({onFocusSession:e}){const{x:t,y:n,zoom:s}=L4(),a=ht(wJ,uJ),o=ht(xJ),i=ht(vJ),l={width:o,height:i},u=g.useRef(null),h=ht(bJ),[f,p]=g.useState([]);g.useLayoutEffect(()=>{var $;const C=($=u.current)==null?void 0:$.parentElement;if(!C)return;const S=mJ(C),_=requestAnimationFrame(()=>{p(A=>gJ(A,S)?A:S)});return()=>cancelAnimationFrame(_)});const m=g.useRef(e);m.current=e;const[w]=g.useState(()=>_D({focus:C=>{var S;return(S=m.current)==null?void 0:S.call(m,C)},setTimeout:(C,S)=>window.setTimeout(C,S),clearTimeout:C=>window.clearTimeout(C)}));if(g.useEffect(()=>()=>w.cancel(),[w]),a.length<=1)return null;const b=C=>{try{e==null||e(C)}catch{}},k=(C,S)=>{C.detail>0&&md()?w.hold(S):b(S)},v={transform:`translate(${t}px, ${n}px) scale(${s})`},N=r.jsx("div",{className:"session-clusters",style:v,ref:u,children:a.map(C=>{const S=Gu(C.sessionId),_=oJ(C,S);return r.jsx("div",{className:"cluster-card",style:_,"aria-hidden":!0},C.sessionId)})}),x=h&&vt.createPortal(r.jsx("div",{className:"cluster-labels nopan",children:a.map(C=>{const S=Gu(C.sessionId),_=pJ(C,{x:t,y:n,zoom:s},l,f),$=iJ(C,s,S,_.maxWidth);return r.jsxs("button",{type:"button",className:"cluster-label","data-alarm":C.alarm?"":void 0,"data-offpane":_.hidden?"":void 0,style:$,title:C.title,onClick:A=>k(A,C.sessionId),children:[C.alarm?r.jsxs(r.Fragment,{children:[r.jsx(bN,{}),r.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,C.label,C.plan?r.jsx("span",{className:"cluster-label-plan",children:Sl+C.plan}):null,C.branch?r.jsx("span",{className:"cluster-label-branch",children:Sl+C.branch}):null,C.name?r.jsx("span",{className:"cluster-label-name",children:Sl+C.name}):null,C.shortId?r.jsx("span",{className:"cluster-label-id",children:Sl+C.shortId}):null]},C.sessionId)})}),h);return r.jsxs(r.Fragment,{children:[N,x]})}function jJ({data:e}){return r.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const ED=600,NJ=4,SJ=36,pp=14,CJ=60,_J=6,tA=220,EJ=96,TJ=28;function AJ(e,t){return Math.max(EJ,61+[...t].length*6.8)}function RJ(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function MJ(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/ED)}function $J(e,t){const n=[],s=new Set;for(let a=e.length-1;a>=0&&n.length<t;a--){const o=e[a];s.has(o.id)||(s.add(o.id),n.push(o))}return n.reverse()}function LJ(e,t,n,s,a,o){const i=[];for(const l of e.values()){if(!t.has(l.id)||l.exitAt!=null&&o-l.exitAt>ED)continue;const u=s.get(l.id)??n.get(l.id);if(!u)continue;const h=$J(l.tools,NJ);if(h.length===0)continue;const f=l.exitAt??null,p=a.get(l.id),m=Math.max((p==null?void 0:p.width)??tA,tA),w=(p==null?void 0:p.height)??130,b=u.x,k=u.y,v=b+m,N=k+w/2;h.forEach((x,C)=>{const S=C*SJ,_=b+m+CJ,$=k+_J+S,A=MJ(o,f),O=x.inputPreview??"",M=RJ(x),W=A<.999,B=vN(x.name);i.push({id:`${l.id}::${x.id}`,toolId:x.id,agentId:l.id,toolName:x.name,name:B.label,emoji:B.emoji,status:M,category:qP(x.name),mcpHue:B.hue,inputPreview:O,fade:A,fading:W,worldX:_,worldY:$,anchorX:v,anchorY:N,spawnDx:v-_,spawnDy:N-($+pp)});const R=zP(x.name,x.input);if(R){const q=AJ(x.name,B.label),T=_+q+TJ,F=$,D=_+q,K=$+pp;i.push({id:`sub:${l.id}::${x.id}`,toolId:x.id,agentId:l.id,toolName:x.name,name:nY(R.label,R.category),fullName:R.label,emoji:R.emoji,isSub:!0,status:M,category:R.category,inputPreview:R.detail??O,fade:A,fading:W,worldX:T,worldY:F,anchorX:D,anchorY:K,spawnDx:D-T,spawnDy:0})}})}return i}function IJ({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:o,hiddenCategories:i,now:l,onOpenTool:u}){const h=LJ(e,t,n,s,a,l),f=i&&i.size>0?h.filter(p=>!i.has(p.category)):h;return r.jsx(OJ,{bursts:f,spotlight:o,onOpenTool:u})}function OJ({bursts:e,spotlight:t,onOpenTool:n}){const s=e.map(o=>{const i=o.anchorX,l=o.anchorY,u=o.worldX+6,h=o.worldY+pp,f=Math.max(1,u-i),p=Math.min(1,Math.abs(h-l)/f),m=i+f*(.55-.22*p),w=l+(h-l)*.12,b=u-f*.25,k=t!=null&&!t.has(o.agentId),v=o.fade*(k?.14:1);return r.jsx("path",{d:`M ${i} ${l} C ${m} ${w}, ${b} ${h}, ${u} ${h}`,className:`tool-conn status-${o.status}${o.fading?" fading":""}`,opacity:v,vectorEffect:"non-scaling-stroke"},`l:${o.id}`)}),a=e.map(o=>r.jsx(FJ,{b:o,dim:t!=null&&!t.has(o.agentId),onOpenTool:n},o.id));return r.jsx(PJ,{connectors:s,bubbles:a})}function PJ({connectors:e,bubbles:t}){const{x:n,y:s,zoom:a}=L4();return r.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,style:{"--tool-burst-height":`${2*pp}px`},children:[r.jsx("svg",{className:"tool-bursts-svg",children:r.jsx("g",{transform:`translate(${n} ${s}) scale(${a})`,children:e})}),r.jsx("div",{className:"tool-bursts-world",style:{transform:`translate(${n}px, ${s}px) scale(${a})`},children:t})]})}function DJ(e,t){const n=e.b,s=t.b;return e.dim===t.dim&&e.onOpenTool===t.onOpenTool&&n.id===s.id&&n.toolId===s.toolId&&n.worldX===s.worldX&&n.worldY===s.worldY&&n.spawnDx===s.spawnDx&&n.spawnDy===s.spawnDy&&n.status===s.status&&n.fading===s.fading&&n.category===s.category&&n.mcpHue===s.mcpHue&&n.isSub===s.isSub&&n.emoji===s.emoji&&n.name===s.name&&n.fullName===s.fullName&&n.toolName===s.toolName&&n.inputPreview===s.inputPreview}const FJ=g.memo(function({b:t,dim:n,onOpenTool:s}){const a={left:`${t.worldX}px`,top:`${t.worldY}px`,"--spawn-dx":`${t.spawnDx}px`,"--spawn-dy":`${t.spawnDy}px`},o=t.isSub?`${t.toolName} · ${t.fullName??t.name}`:t.toolName,i=t.inputPreview?`${o} · ${t.inputPreview}`:o,l=s!=null,u=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},h=n?" dim":"";return r.jsx("div",{className:"tool-burst-wrap",style:a,children:r.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${l?" clickable":""}${t.isSub?" sub":""}${h}`,style:u,title:i,onClick:l?()=>s(t.agentId,t.toolId):void 0,children:[r.jsx("span",{className:"tb-emoji",children:t.emoji}),r.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&r.jsx("span",{className:"tb-spin"}),t.status==="done"&&r.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&r.jsx("span",{className:"tb-mark err",children:"×"})]})})},DJ),BJ={width:140,height:105},qJ={agent:CY,sessionGroup:jJ,recapNote:PZ},UJ={recapTie:XZ},nA=400;function WJ({graph:e,layout:t,viewport:n,clicks:s,drag:a,appearance:o,fm:i,radioOpen:l,onRadioClose:u,autoFit:h,pause:f,stateRef:p,measuredRef:m,hiddenCats:w,now:b,openTool:k,focusAgent:v,requestClear:N,setKeyHelpOpen:x}){const{allNodes:C,edges:S,visibleAgentIds:_,spotlightSet:$}=e,{positionsRef:A,pinnedRef:O,handleRelayout:M,rearrangeUndo:W}=t,{restoredViewport:B,onMoveStart:R,onMove:q}=n,{onNodeClick:T,onPaneClick:F,onNodeDoubleClick:D,onNodeMouseEnter:K,onNodeMouseLeave:V}=s,{onNodeDragStart:H,onNodeDrag:P,onNodeDragStop:I}=a,{palette:U,minimapNodeFill:Z,characterEnabled:z}=o,{autoFitDisabled:X,enableAutoFitAndRefit:Y}=h,{paused:J,pauseGate:Q,togglePause:te}=f;return r.jsxs($4,{nodes:C,edges:S,nodeTypes:qJ,edgesFocusable:!1,edgeTypes:UJ,fitView:!B,fitViewOptions:{padding:.25,duration:v1({durationMs:nA,documentHidden:document.hidden})?nA:0},minZoom:F4,maxZoom:B4,panOnScroll:!0,panActivationKeyCode:null,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:T,onPaneClick:F,onNodeDoubleClick:D,onNodeMouseEnter:K,onNodeMouseLeave:V,onMoveStart:R,onMove:q,onNodeDragStart:(le,de,oe)=>{W.dismiss(),H(le,de,oe)},onNodeDrag:P,onNodeDragStop:I,children:[r.jsx(R9,{gap:28,size:1,color:U["--grid-line"]}),r.jsx(kJ,{onFocusSession:v}),r.jsx(IJ,{agents:p.current.agents,visibleAgentIds:_,positions:A.current,pinned:O.current,measured:m.current,spotlight:$,hiddenCategories:w,now:b,onOpenTool:k}),r.jsxs("div",{className:"canvas-notices",children:[X&&r.jsx(LY,{enableAutoFitAndRefit:Y}),r.jsx(YZ,{undo:W})]}),r.jsx(VY,{autoFitDisabled:X,enableAutoFitAndRefit:Y,paused:J,pauseGate:Q,togglePause:te,handleRelayout:M,requestClear:N,setKeyHelpOpen:x}),r.jsx(w9,{style:BJ,zoomable:!0,pannable:!0,nodeColor:Z,nodeStrokeWidth:2,maskColor:U["--minimap-mask"],maskStrokeColor:U["--line"]}),r.jsx(OZ,{fm:i,character:o.character,characterEnabled:z,open:l,onClose:u})]})}function HJ(){const e=window.ccdeckWindow;return g.useEffect(()=>{if(!e)return;const t=()=>{const s=document.querySelector(".topbar");if(!s)return;const a=getComputedStyle(s),o=i=>{var u;const l=(u=i.match(/\d+/g))==null?void 0:u.slice(0,3);return(l==null?void 0:l.length)===3?`#${l.map(h=>Number(h).toString(16).padStart(2,"0")).join("")}`:"#191a1c"};e.colors({color:o(a.backgroundColor),symbolColor:o(a.color)}).catch(()=>{})};t();const n=new MutationObserver(t);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-color-scheme"]}),()=>n.disconnect()},[e]),!e||e.platform==="darwin"?null:r.jsx("button",{type:"button",className:"desktop-menu btn","aria-label":"Application menu",title:"Application menu","aria-haspopup":"menu",onClick:()=>{e.menu().catch(()=>{})},children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M3 4h10M3 8h10M3 12h10",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})})})}function zJ(e){const t={input:0,output:0,cacheRead:0,cacheWrite:0,total:0};let n=0,s=0,a=0,o=0;for(const i of e){const l=Un(i);t.input+=l.input,t.output+=l.output,t.cacheRead+=l.cacheRead,t.cacheWrite+=l.cacheWrite,t.total+=l.total,n+=i.usage.inputTokens,s+=i.usage.outputTokens,a+=i.usage.cacheReadTokens,o+=i.usage.cacheCreateTokens}return{cost:t,inputTokens:n,outputTokens:s,cacheReadTokens:a,cacheCreateTokens:o,sum:n+s}}const VJ="spend on this board",GJ="on this board",TD=`Everything on the board right now, and only that.
|
|
92
92
|
Finished sessions are evicted from the canvas a couple of minutes after they end, and their tokens and dollars leave with them — so this figure falls on its own.
|
|
@@ -109,13 +109,13 @@ spend on this panel also covers:
|
|
|
109
109
|
${N.join(`
|
|
110
110
|
`)}`:Yu(e.model,e.effort),children:[Jp(e.model,e.effort),N.length>0?` +${N.length}`:""]})]})})()]}),h&&r.jsxs("div",{className:"hero-cost",children:[r.jsxs("div",{className:"hero-cost-headline",children:[r.jsx("span",{className:"hero-cost-value",children:ct(u.total)}),r.jsx("span",{className:"hero-cost-label",children:"spend"})]}),r.jsx(GN,{cost:u})]}),r.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&s&&r.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>s(e.sessionId),title:"Reopen the end-of-session recap modal",children:"Show recap"}),a&&r.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:"Download this session as JSON",children:"Export JSON"}),o&&r.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:o,title:e.kind==="root"?`Take this session's cards off the board (Delete). The session carries on; ${_n("the session list","L",i)} brings it back`:`Take this card and the ones under it off the board (Delete). ${_n("The session list","L",i)} brings it back`,children:"Remove from board"})]})]}),r.jsx(NY,{agent:e}),(()=>{const N=wN(e);if(!N)return null;const x=ap(N.at,t),C=N.kind==="recap"?"Recap":rc(N.kind).replace(/^./,S=>S.toUpperCase());return r.jsxs("section",{className:"detail-section",children:[r.jsxs("h3",{children:[C," ",r.jsx("span",{className:"section-count",title:x.title,children:x.label})]}),r.jsx("p",{className:"detail-recap",title:am(N),children:N.text}),N.reply&&r.jsxs("p",{className:"detail-recap detail-note-reply",children:["Suggested reply: “",N.reply,"”"]})]})})(),(()=>{const N=Cr(e.plan);return!N||!e.plan?null:r.jsxs("section",{className:"detail-section",children:[r.jsxs("h3",{children:["Plan"," ",r.jsxs("span",{className:"section-count","aria-hidden":!0,children:[N.done,"/",N.total]}),r.jsxs("span",{className:"vis-hidden",children:[N.done," of ",N.total," done"]})]}),e.plan.note&&r.jsx("p",{className:"detail-plan-note",children:e.plan.note}),r.jsx("ol",{className:"plan-list",children:e.plan.items.map((x,C)=>r.jsxs("li",{className:"plan-item","data-status":x.status,children:[r.jsx("span",{className:"plan-mark","aria-hidden":!0}),r.jsxs("span",{className:"vis-hidden",children:[Vge[x.status],": "]}),r.jsx("span",{className:"plan-text",children:x.status==="in_progress"&&x.active?x.active:x.text}),x.status==="in_progress"&&r.jsx("span",{className:"plan-now","aria-hidden":!0,children:"now"})]},x.id??`${C}:${x.text}`))})]})})(),e.tools.length>0&&r.jsxs("section",{className:"detail-section",children:[r.jsx("h3",{children:"Activity"}),r.jsxs("div",{className:"activity-row",children:[r.jsxs("div",{className:"activity-counters",children:[r.jsxs("span",{className:"ac-item",children:[r.jsx("b",{children:e.toolCount})," calls"]}),w>0&&r.jsxs("span",{className:"ac-item ac-live",children:[r.jsx("b",{children:w})," live"]}),m>0&&r.jsxs("span",{className:"ac-item ac-err",children:[r.jsx("b",{children:m})," err"]})]}),r.jsx("div",{className:"cat-strip",children:b.map(([N,x])=>{const C=N==="mcp"?k:null,S=C==null?void 0:C.hue,_=`${x} ${Rp[N]} call${x===1?"":"s"}`;return r.jsxs("span",{className:`cat-chip cat-${N}${S!=null?" mcp-hue":""}`,style:S!=null?{"--mcp-hue":S}:void 0,title:C?`${_}, all to ${C.label}`:_,children:[r.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:w8[N]}),r.jsx("span",{className:"cat-name",children:Rp[N]}),r.jsx("span",{className:"cat-count",children:x}),C&&r.jsx("span",{className:"cat-server",children:C.label})]},N)})})]})]}),f>0&&r.jsxs("section",{className:"detail-section",children:[r.jsx("h3",{children:"Tokens"}),r.jsxs("div",{className:"tokens-grid",children:[r.jsxs("div",{children:[r.jsx("span",{className:"k",children:"in"}),r.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:Ct(e.usage.inputTokens)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"k",children:"out"}),r.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:Ct(e.usage.outputTokens)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"k",children:"cache r"}),r.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:Ct(e.usage.cacheReadTokens)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"k",children:"cache c"}),r.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:Ct(e.usage.cacheCreateTokens)})]})]})]}),r.jsxs("section",{className:"detail-section",children:[r.jsx("h3",{children:"Identity"}),r.jsxs("div",{children:[e.cwd&&r.jsxs("div",{className:"row",children:[r.jsx("span",{className:"k",children:"cwd"}),r.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),r.jsxs("div",{className:"row",children:[r.jsx("span",{className:"k",children:"session"}),r.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&r.jsxs("div",{className:"row",children:[r.jsx("span",{className:"k",children:"parent"}),r.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&r.jsxs("section",{className:"detail-section",children:[r.jsxs("h3",{children:["Prompts ",r.jsx("span",{className:"section-count",children:tP(e.prompts).length})]}),r.jsx("div",{className:"prompts",children:Wge(e.prompts).reverse().map(({pr:N,key:x})=>{const C=ap(N.at,t),S=Gp(N.text);return S?r.jsxs("details",{className:"prompt-entry prompt-injected",children:[r.jsxs("summary",{children:[r.jsx("span",{className:"prompt-time",title:C.title,children:C.label}),r.jsx("span",{className:"prompt-injected-label",children:S.label})]}),S.detail&&r.jsx("div",{className:"prompt-injected-detail",children:S.detail})]},x):r.jsxs("div",{className:"prompt-entry",children:[r.jsx("div",{className:"prompt-time",title:C.title,children:C.label}),r.jsx("div",{className:"prompt-text",children:N.text})]},x)})})]}),r.jsxs("section",{className:"detail-section",children:[r.jsxs("h3",{children:["Tool calls ",r.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&r.jsx("div",{className:"empty",children:"No tool calls yet."}),r.jsx("div",{children:e.tools.slice().reverse().map(N=>r.jsx(zge,{t:N,onClick:()=>n(e.id,N.id)},N.id))})]})]})}function Wge(e){const t=new Map;return e.map(n=>{const s=t.get(n.at)??0;return t.set(n.at,s+1),{pr:n,key:s===0?String(n.at):`${n.at}:${s}`}})}const Hge={inflight:"in-flight",done:"done",err:"error"};function zge({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=EP(e,"…");return r.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[r.jsxs("span",{className:"name",children:[r.jsx("span",{className:`status-dot ${n}`,"aria-hidden":!0}),r.jsx("span",{className:"vis-hidden",children:Hge[n]}),e.name]}),r.jsx("span",{style:{color:"var(--muted)"},children:s})]})}const Vge={completed:"done",in_progress:"now",pending:"to do"};function Gge(e,t){const n=Dge(e,t,new Date().toISOString());if(!n)return;const s=JSON.stringify(n,null,2),a=new Blob([s],{type:"application/json"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=Fge(n.label,t),document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function Kge({selected:e,now:t,openTool:n,setSummaryFor:s,onClose:a,stateRef:o,removeSelectedNode:i}){an("detail-panel");const l=An();return r.jsxs("aside",{className:"detail","aria-label":"Detail",children:[r.jsx("button",{type:"button",className:"glyph-btn detail-close",title:"Close panel","aria-label":"Close detail panel",onClick:a,children:"×"}),r.jsx(Uge,{agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:u=>Gge(o.current,u),onRemove:i,singleKeys:l})]})}function Yge(e,t){const n=e?"Watching — the deck keeps its own copy of the history":"Not watching — reads the browser's history when opened";return t>0?`${n}
|
|
111
111
|
${t} unread`:n}function Nf(e,t){return t.map(n=>({...n,group:e}))}function Xge({providers:e,sessionListOpen:t,toggleSessionList:n,accountsPanelOpen:s,toggleAccountsPanel:a,usagePanelOpen:o,setUsagePanelOpen:i,machinePanelOpen:l,setMachinePanelOpen:u,setUsageHistoryOpen:h,watchOn:f,watchUnseen:p,setBrowserWatchOpen:m,setTrafficRadarOpen:w,setRadioOpen:b,openToolActivity:k,openSettings:v,onFeedback:N,toggles:x,openCapacity:C,integrations:S=[],openExploreIntegrations:_,openQuickOpen:$}){const A=gee(ro()),O=po(ro()),M={id:"session-list",label:"Session list",short:"Sessions",key:{cap:"L",aria:"L",single:!0},ariaLabel:"Session list",glyph:r.jsx(pQ,{}),kind:"panel",open:t,controls:"session-list",onPress:n,buttonRef:x.sessionList},W={id:"accounts",label:"Accounts",short:"Accounts",key:{cap:"A",aria:"A",single:!0},ariaLabel:"Accounts",hint:"Claude accounts",glyph:r.jsx(gQ,{}),kind:"panel",open:s,controls:"accounts-panel",onPress:a,buttonRef:x.accounts},B=C?[{id:"account-capacity",label:"Account capacity",short:"Capacity",ariaLabel:"Account capacity",detail:"How many accounts are ready, and what the 5h and 7d windows have left",glyph:r.jsx(TQ,{}),kind:"dialog",onPress:()=>C("accounts")},{id:"reset-calendar",label:"Reset calendar",short:"Calendar",ariaLabel:"Reset calendar",detail:"When each account's 5h and 7d windows come back",glyph:r.jsx(AQ,{}),kind:"dialog",onPress:()=>C("calendar")}]:[],R={id:"usage",label:"Usage",short:"Usage",key:{cap:"U",aria:"U",single:!0},ariaLabel:"Usage",glyph:r.jsx(yQ,{}),kind:"panel",open:o,controls:"usage-panel",onPress:()=>i(U=>!U),buttonRef:x.usage},q={id:"machine",label:"Machine",short:"Machine",key:{cap:"S",aria:"S",single:!0},ariaLabel:"Machine",hint:"This machine",glyph:r.jsx(xQ,{}),kind:"panel",open:l,controls:"system-panel",onPress:()=>u(U=>!U),buttonRef:x.machine},T={id:"history",label:"Usage history",short:"History",key:{cap:"H",aria:"H",single:!0},ariaLabel:"Usage history",glyph:r.jsx(wQ,{}),kind:"dialog",onPress:()=>h(U=>!U)},F={id:"browser-watch",label:"Browser watch",short:"Watch",key:{cap:"B",aria:"B",single:!0},ariaLabel:`Browser watch, ${f?"watching":"not watching"}${p>0?`, ${p} unread`:""}`,detail:Yge(f,p),glyph:r.jsx(bQ,{watching:f===!0||p>0}),kind:"dialog",onPress:()=>m(U=>!U),badge:p},D={id:"settings",label:"Settings",short:"Settings",key:{cap:A,aria:"Control+, Meta+,",single:!1},ariaLabel:"Settings",glyph:r.jsx(kQ,{}),kind:"dialog",onPress:()=>v()},K={id:"quick-open",label:"Search",short:"Search",key:{cap:fQ(O),aria:O?"Meta+K":"Control+K",single:!1},ariaLabel:"Search",detail:"Panels, sessions, settings, actions and themes",glyph:r.jsx(PD,{}),kind:"dialog",onPress:$},V={id:"feedback",label:"Feedback",short:"Feedback",menu:"Send feedback",ariaLabel:"Send feedback",glyph:r.jsx(jQ,{}),kind:"dialog",onPress:N},H=k?[{id:"tool-activity",label:"Tool activity",short:"Tools",ariaLabel:"Tool activity",glyph:r.jsx(_Q,{}),kind:"dialog",detail:"Which tools your agents run, how long they take and what fails",onPress:()=>k("tools")},{id:"skill-activity",label:"Skill activity",short:"Skills",ariaLabel:"Skill activity",glyph:r.jsx(EQ,{}),kind:"dialog",detail:"Which skills your agents use, whether you typed them or the agent called them",onPress:()=>k("skills")}]:[],P=w?[{id:"traffic-radar",label:"Telemetry Radar",short:"Radar",ariaLabel:"Telemetry Radar",glyph:r.jsx(vQ,{}),kind:"dialog",detail:"Claude telemetry configuration and observed connections",onPress:()=>w(!0)}]:[],I=b?[{id:"radio",label:"Radio",short:"Radio",ariaLabel:"Radio",glyph:r.jsx(CQ,{}),kind:"dialog",detail:"Explore stations around the world",onPress:()=>b(!0)}]:[];return{left:e.claude?[W,M]:[M],leftStripe:e.claude?[Nf("Claude accounts",[W,...B]),[M]]:[[M]],capacity:e.claude?B:[],right:[Nf("Usage and machine",[R,q]),Nf("Activity history",[T,...H]),Nf("Watchers",[F,...P]),I].filter(U=>U.length>0),utilities:[D,V],search:K,explore:_?[{id:"explore-integrations",label:"Explore integrations",short:"Integrations",ariaLabel:"Explore integrations",glyph:r.jsx(mQ,{}),kind:"dialog",onPress:_}]:[],integrations:S.map(({provider:U,onPress:Z})=>({id:`integration-${U.kind}`,label:U.label,short:U.label,ariaLabel:U.label,detail:U.detail,key:U.shortcut?{cap:U.shortcut.toUpperCase(),aria:U.shortcut.toUpperCase(),single:!0}:void 0,glyph:r.jsx(U.Glyph,{}),kind:"dialog",onPress:Z}))}}const Mp=[{value:"bug",label:"Bug",question:"What happened?",placeholder:`I was trying to…
|
|
112
|
-
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 v8(e){return Mp.find(t=>t.value===e)??Mp[0]}const Nj=3,H0=120,b8=1e4,k8=200,Zge="Write something first.";function vO(e){return e.trim()!==""}function Jge(e){var o;const t=e.trim();if(t==="")return"";const n=bO(t.split(/\r?\n/,1)[0]),s=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,a=z0(s).length>=Nj?z0(s):z0(n);return eye(a.length>=Nj?a:bO(t))}function Qge(e,t){const n=Jge(t);return n.length>=Nj?n:`${v8(e).label}: ${n}`}function bO(e){return e.replace(/\s+/g," ").trim()}function z0(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function eye(e){if(e.length<=H0)return e;const t=e.slice(0,H0-1),n=t.lastIndexOf(" ");return`${(n>=H0/2?t.slice(0,n):t).replace(/[\uD800-\uDBFF]$/,"").replace(/[\s,;:.\-–—]+$/,"")}…`}function tye({kind:e,body:t,contact:n}){const s={kind:e,title:Qge(e,t),body:t.trim()};return n.trim()!==""&&(s.contact=n.trim()),s}function nye(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 sye={darwin:"macOS",win32:"Windows",linux:"Linux"};function rye(e){const t=e.indexOf("-"),n=t===-1?e:e.slice(0,t),s=t===-1?"":e.slice(t+1),a=sye[n]??n;return s?`${a} · ${s}`:a}function aye(e){return e?`ccdeck ${e.appVersion} · ${rye(e.platform)}`:null}const oye="sent with it",iye="Your ccdeck version and system are sent with it.",lye="Add details",cye="How to reach you",uye="Email or GitHub @name",dye="Only if you would like an answer.",hye=["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 fye(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function BS(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function pye(e){return po(e)?["⌘","Enter"]:["Ctrl","Enter"]}function mye(e){return[...e].length===1}const j8="Thanks — feedback sent.";function kO(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 s=n==null?void 0:n.images;return e===400&&Array.isArray(s)&&typeof s[0]=="string"?`The server did not accept an image. ${s[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."}function gye(e){return e==="sending"?"Sending…":e==="sent"?j8:""}const jO=1400,yye=160,N8=g.createContext({values:{}});function S8(){return g.useContext(N8)}function wye(e,t){const n=e.variants;return n?{...e,...n.by[t[n.field]??""]??{}}:e}const NO=(e,t)=>!e.when||e.when.is.includes(t[e.when.field]??"");function xye({def:e,existing:t,busy:n,error:s,onSubmit:a,onCancel:o,onDirtyChange:i}){var q,T;const l=g.useId(),[u,h]=g.useState(()=>Object.fromEntries(e.fields.map(F=>{var D,K,V;return[F.name,F.secret?"":((D=F.initial)==null?void 0:D.call(F,t))??(F.type==="choice"?((V=(K=F.options)==null?void 0:K[0])==null?void 0:V.value)??"":"")]}))),[f,p]=g.useState((t==null?void 0:t.name)??""),m=g.useRef(null),w=g.useRef(new Map),b=!!t,k=g.useRef(u),v=g.useRef(f);g.useEffect(()=>{i==null||i(f!==v.current||Object.keys(u).some(F=>u[F]!==k.current[F]))},[f,u,i]);const N=e.fields.filter(F=>F.type==="choice").every(F=>u[F.name]===k.current[F.name]),x=b&&t.tokenSaved&&N,C=(F,D)=>{n||h(K=>({...K,[F]:D}))},S=F=>{var K;if(F.preventDefault(),n)return;const D={};for(const V of e.fields)NO(V,u)&&(D[V.name]=(u[V.name]??"").trim());(K=F.currentTarget.querySelector('button[type="submit"]'))==null||K.focus(),a(D,f.trim()),h(V=>Object.fromEntries(Object.entries(V).map(([H,P])=>{var I;return[H,(I=e.fields.find(U=>U.name===H))!=null&&I.secret?"":P]})))},_=g.useMemo(()=>{const F=u.baseUrl??"";try{return F?new URL(/^[a-z]+:\/\//i.test(F)?F:`https://${F}`).host:""}catch{return""}},[u.baseUrl]),$=g.useMemo(()=>({values:u,existing:t}),[u,t]),A=e.fields.filter(F=>NO(F,u)),O=(q=A.find(F=>!F.secret&&F.type!=="choice"))==null?void 0:q.name,M=(T=A.find(F=>F.secret))==null?void 0:T.name,W=s!=null&&s.field&&A.some(F=>F.name===s.field&&F.type!=="choice")?s.field:null,B=`${l}-error`;g.useEffect(()=>{var D,K,V;const F=b?M:O??M;F&&((D=w.current.get(F))==null||D.focus()),(V=(K=m.current)==null?void 0:K.scrollIntoView)==null||V.call(K,{block:"nearest"})},[b]),g.useEffect(()=>{var F;W&&((F=w.current.get(W))==null||F.focus())},[s,W]);const R=s&&r.jsxs(r.Fragment,{children:[s.message,s.detail&&r.jsxs("span",{className:"ig-form-detail",children:[" ",e.label," said: ",s.detail]}),s.kind==="rate-limit"&&s.retryAfter?r.jsxs("span",{children:[" Try again in ",s.retryAfter," s."]}):null]});return r.jsx(N8.Provider,{value:$,children:r.jsxs("form",{ref:m,className:"ig-form",onSubmit:S,"aria-labelledby":`${l}-title`,noValidate:!0,children:[r.jsxs("header",{className:"ig-managed-header",children:[r.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:r.jsx(e.Glyph,{})}),r.jsxs("div",{className:"ig-managed-identity",children:[r.jsx("h2",{className:"ig-form-title",id:`${l}-title`,children:b?`Edit ${t.name}`:`Connect ${e.label}`}),b&&r.jsxs("p",{children:[e.label," connection"]})]})]}),A.map(F=>{const D=wye(F,u),K=(s==null?void 0:s.field)===D.name,V=[D.hint?`${l}-${D.name}-hint`:"",K?B:""].filter(Boolean).join(" ")||void 0;if(D.type==="choice")return r.jsxs("fieldset",{className:"fb-kinds","aria-invalid":K||void 0,children:[r.jsx("legend",{className:"vis-hidden",children:D.label}),(D.options??[]).map(I=>r.jsxs("label",{className:"fb-kind",children:[r.jsx("input",{type:"radio",name:`${l}-${D.name}`,value:I.value,checked:u[D.name]===I.value,"aria-disabled":n||void 0,onChange:()=>C(D.name,I.value),onKeyDown:U=>{BS(U.nativeEvent)&&U.preventDefault()}}),I.label]},I.value))]},D.name);const H=D.secret&&x,P=`${l}-${D.name}`;return r.jsxs("div",{className:"fb-field",children:[r.jsxs("label",{className:"fb-field-label",htmlFor:P,children:[D.label,D.optional&&r.jsx("span",{className:"fb-optional",children:" optional"})]}),r.jsx("input",{id:P,className:`ap-manage-input ig-input${D.secret?" ig-mono":""}`,ref:I=>{I?w.current.set(D.name,I):w.current.delete(D.name)},type:D.type,inputMode:D.type==="url"?"url":D.type==="email"?"email":void 0,autoComplete:D.autoComplete??"off",spellCheck:!1,value:u[D.name]??"",onChange:I=>C(D.name,I.target.value),placeholder:H?"Saved. Leave blank to keep it":D.placeholder,readOnly:n,"aria-invalid":K||void 0,"aria-describedby":V,"aria-required":!D.optional&&!H||void 0}),D.hint&&r.jsx("span",{className:"ig-hint",id:`${l}-${D.name}-hint`,children:D.hint}),K&&W===D.name&&r.jsx("span",{className:"ig-form-error",id:B,role:"alert",children:R})]},D.name)}),r.jsxs("details",{className:"ig-help ig-token-help",children:[r.jsxs("summary",{children:["How to create a ",e.label," token"]}),e.tokenHelp]}),r.jsxs("div",{className:"fb-field",children:[r.jsxs("label",{className:"fb-field-label",htmlFor:`${l}-name`,children:["Name ",r.jsx("span",{className:"fb-optional",children:"optional"})]}),r.jsx("input",{id:`${l}-name`,className:"ap-manage-input ig-input",type:"text",autoComplete:"off",maxLength:120,readOnly:n,value:f,onChange:F=>p(F.target.value),placeholder:_||e.label})]}),s&&!W&&r.jsx("p",{className:"ig-form-error",id:B,role:"alert",children:R}),r.jsxs("div",{className:"ig-form-actions",children:[r.jsx("button",{type:"submit",className:"btn primary","aria-disabled":n,"aria-busy":n,children:n?"Checking…":b?"Save":"Connect"}),r.jsx("button",{type:"button",className:"btn","aria-disabled":n||void 0,onClick:()=>{n||o()},children:"Cancel"})]})]})})}const vye="https://id.atlassian.com/manage-profile/security/api-tokens",bye="https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/",kye="https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html",jye=[{scope:"read:jira-work",why:"issues, comments, search"},{scope:"read:jira-user",why:"your account and avatars"},{scope:"read:board-scope:jira-software",why:"boards and backlogs"},{scope:"read:board-scope.admin:jira-software",why:"a board's estimation and quick filters"},{scope:"read:sprint:jira-software",why:"sprints"},{scope:"read:epic:jira-software",why:"epic names and colours"},{scope:"read:issue-details:jira",why:"issue lists"},{scope:"read:jql:jira",why:"filtered lists"}];function Nye(e){const t=e.trim();if(!t)return null;try{const n=new URL(/^[a-z]+:\/\//i.test(t)?t:`https://${t}`),s=n.hostname==="localhost"||n.hostname==="127.0.0.1";return n.protocol!=="https:"&&!s||!n.hostname.includes(".")&&!s?null:`${n.origin}${n.pathname.replace(/\/+$/,"")}/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens`}catch{return null}}function Sye(){const{values:e}=S8(),t=e.deployment==="cloud",n=t?null:Nye(e.baseUrl??"");let s="";try{s=n?new URL(n).host:""}catch{}return r.jsxs(r.Fragment,{children:[t?r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["Make one at ",r.jsx("a",{href:vye,target:"_blank",rel:"noreferrer noopener",children:"id.atlassian.com → Security → API tokens"}),". A classic token reads Jira as you. A token ",r.jsx("em",{children:"with scopes"})," works too: the deck finds your site’s api.atlassian.com address itself, and needs these read scopes:"]}),r.jsx("ul",{className:"ig-scopes",children:jye.map(a=>r.jsxs("li",{children:[r.jsx("code",{children:a.scope})," ",r.jsx("span",{children:a.why})]},a.scope))}),r.jsx("p",{children:r.jsx("a",{href:bye,target:"_blank",rel:"noreferrer noopener",children:"How Atlassian API tokens work"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["In Jira, open your avatar → ",r.jsx("strong",{children:"Profile"})," → ",r.jsx("strong",{children:"Personal Access Tokens"})," → ",r.jsx("strong",{children:"Create token"}),n&&r.jsxs(r.Fragment,{children:[" (",r.jsxs("a",{href:n,target:"_blank",rel:"noreferrer noopener",children:["open it on ",s]}),")"]}),". The token reads what your account can read. Give it an expiry you are comfortable with. Needs Jira 8.14 or newer."]}),r.jsx("p",{children:r.jsx("a",{href:kye,target:"_blank",rel:"noreferrer noopener",children:"How personal access tokens work"})})]}),r.jsx("p",{className:"ig-dim",children:"Browsing only reads Jira. Dragging an issue or confirming Move saves its sprint and rank in Jira, using your account’s permissions. The token stays on this machine and is never shown again."}),t&&r.jsxs("p",{className:"ig-dim",children:["For moving with a scoped Cloud token, also allow ",r.jsx("code",{children:"write:issue:jira-software"})," (rank), ",r.jsx("code",{children:"write:sprint:jira-software"})," (sprint) and ",r.jsx("code",{children:"write:board-scope:jira-software"})," (backlog). Read-only tokens can still browse."]})]})}function V0(e,t,n="classic"){if(e==="github")return n==="classic"?"https://github.com/settings/tokens/new?scopes=repo,read:org&description=ccdeck":"https://github.com/settings/personal-access-tokens/new";const s=(t??"").trim()||"https://gitlab.com";let a;try{a=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(s)?s:`https://${s}`)}catch{return null}return a.protocol!=="https:"&&a.protocol!=="http:"||!a.hostname.includes(".")&&a.hostname!=="localhost"?null:`${a.origin}${a.pathname.replace(/\/+$/,"")}/-/user_settings/personal_access_tokens?name=ccdeck&scopes=read_api`}function G0({href:e,children:t}){return e?r.jsxs("a",{className:"fg-token-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t," ",r.jsx(rd,{})]}):null}function C8({kind:e,baseUrl:t}){const{values:n}=S8();if(e==="github")return r.jsxs("div",{className:"fg-token-help",children:[r.jsx("p",{children:"A personal access token. Either kind works:"}),r.jsxs("ul",{children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Classic"})," — the ",r.jsx("code",{children:"repo"})," and ",r.jsx("code",{children:"read:org"})," scopes."," ",r.jsx(G0,{href:V0("github"),children:"Make one"})]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Fine-grained"})," — the repositories you want to see, with read-only access to Actions, Checks, Commit statuses, Contents, Issues, Metadata and Pull requests. Contents is for branches and commits; the panel never opens your files."," ",r.jsx(G0,{href:V0("github",null,"fine-grained"),children:"Make one"})]})]}),r.jsx("p",{children:"An organization may have to approve a fine-grained token, or a classic one be authorized for its single sign-on, before its repositories show."})]});const s=V0("gitlab",t??(n.where==="self"?n.baseUrl:null));return r.jsxs("div",{className:"fg-token-help",children:[r.jsxs("p",{children:["A personal access token with the ",r.jsx("code",{children:"read_api"})," scope, and nothing more."," ",r.jsx(G0,{href:s,children:`Make one on ${s?new URL(s).host:"GitLab"}`})]}),r.jsx("p",{children:"GitLab tokens expire. When this one does, the panel says so and brings you back here."})]})}const _8={name:"token",label:"Personal access token",type:"password",secret:!0,placeholder:"Paste the token"},Cye=[_8],SO=e=>{try{return e?new URL(e.baseUrl).host!=="gitlab.com":!1}catch{return!1}},_ye=[{name:"where",label:"Which GitLab",type:"choice",options:[{value:"cloud",label:"GitLab.com"},{value:"self",label:"Self-managed"}],initial:e=>SO(e)?"self":"cloud"},{name:"baseUrl",label:"GitLab URL",type:"url",placeholder:"https://gitlab.example.com",hint:"The address you open GitLab at, with its path if it has one. https only.",when:{field:"where",is:["self"]},initial:e=>SO(e)?e.baseUrl:""},_8],Eye=g.createElement(C8,{kind:"github"}),Tye=g.createElement(C8,{kind:"gitlab"}),Aye=e=>{var t;return((t=e==null?void 0:e.meta)==null?void 0:t.deployment)==="cloud"?"cloud":"server"},Rye={kind:"jira",label:"Jira",Glyph:MQ,shortcut:"I",detail:"Boards, sprints, and issues",blurb:"Jira Cloud, or Jira Server / Data Center 8.14 and newer.",fields:[{name:"deployment",label:"Which Jira",type:"choice",options:[{value:"server",label:"Jira Server / Data Center"},{value:"cloud",label:"Jira Cloud"}],initial:Aye},{name:"baseUrl",label:"Jira URL",type:"url",initial:e=>(e==null?void 0:e.baseUrl)??"",variants:{field:"deployment",by:{server:{label:"Jira URL",placeholder:"https://jira.example.com",hint:"The address you open Jira at, with its path if it has one (…/jira). https only."},cloud:{label:"Site URL",placeholder:"your-site.atlassian.net",hint:"The address you open Jira at. Your site name alone is enough."}}}},{name:"email",label:"Atlassian account email",type:"email",placeholder:"you@example.com",autoComplete:"username",secret:!0,when:{field:"deployment",is:["cloud"]}},{name:"token",label:"Personal access token",type:"password",secret:!0,variants:{field:"deployment",by:{server:{label:"Personal access token",placeholder:"Paste the token"},cloud:{label:"API token",placeholder:"Paste the API token"}}}}],tokenHelp:g.createElement(Sye)},Mye={kind:"github",label:"GitHub",Glyph:$Q,detail:"Repositories, pull requests, and Actions",blurb:"github.com, read-only, with a personal access token.",fields:Cye,tokenHelp:Eye},$ye={kind:"gitlab",label:"GitLab",Glyph:LQ,detail:"Projects, merge requests, and pipelines",blurb:"GitLab.com or your own instance, read-only.",fields:_ye,tokenHelp:Tye},Sj={jira:Rye,github:Mye,gitlab:$ye},qS=()=>Object.values(Sj).filter(e=>!!e);function _u(e){return(Object.hasOwn(Sj,e)?Sj[e]:void 0)??null}function Vm(e,t){const n=s=>typeof t=="string"?t:t(s);return g.lazy(()=>e().catch(s=>(console.warn(`ccdeck could not load ${typeof t=="string"?t:"a dialog"}`,s),{default:a=>r.jsx(Lye,{name:n(a),onClose:a.onClose})})))}function Lye({name:e,onClose:t}){const n=g.useRef(null),s=gt(t,{focusRef:n}),a=yt(t);return r.jsx("div",{className:"modal-backdrop",...a,role:"presentation",children:r.jsxs("div",{ref:s,className:"modal dialog-missing",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"dialog-missing-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"dialog-missing-title",className:"modal-tool-name",children:e})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[r.jsxs("p",{className:"dm-note",children:[e," did not load. The deck has most likely been updated since this tab opened, and a reload picks up the new version."]}),r.jsxs("div",{className:"dm-actions",children:[r.jsx("button",{type:"button",className:"btn",onClick:t,children:"Close"}),r.jsx("button",{type:"button",ref:n,className:"btn primary",onClick:()=>window.location.reload(),children:"Reload"})]})]})]})})}const E8=()=>bi(()=>import("./IntegrationModal-CszT-tts.js"),[]);function Iye(){E8().catch(()=>{})}const Oye=Vm(E8,e=>{var t;return((t=_u(e.kind))==null?void 0:t.label)??"The tracker"});function Pye({onClose:e}){return g.useEffect(()=>rn.push(e,0,"dialog"),[e]),null}function Dye(e){return r.jsx(g.Suspense,{fallback:r.jsx(Pye,{onClose:e.onClose}),children:r.jsx(Oye,{...e})})}class vr extends Error{constructor(n,s,a={}){super(s);qa(this,"kind");qa(this,"status");qa(this,"retryAfter");qa(this,"field");qa(this,"detail");this.name="IntegrationFailure",this.kind=n,Object.assign(this,a)}}async function T8(e){try{const t=await e.json(),n=t==null?void 0:t.error;if(n&&typeof n.kind=="string"&&typeof n.message=="string")return new vr(n.kind,n.message,{status:n.status,retryAfter:n.retryAfter,field:n.field,detail:n.detail})}catch{}return new vr(e.status===401?"auth":"upstream",`The deck answered ${e.status}.`)}async function Md(e,t={}){const{timeoutMs:n=3e4,...s}=t,a=new AbortController,o=window.setTimeout(()=>a.abort(),n),i=s.signal,l=()=>a.abort();i==null||i.addEventListener("abort",l,{once:!0});let u;try{u=await fetch(e,{...s,signal:a.signal,headers:s.body?{"Content-Type":"application/json",...s.headers??{}}:s.headers})}catch(h){throw i!=null&&i.aborted?h:new vr("network",a.signal.aborted?"The deck took too long to answer.":"The deck could not be reached.")}finally{window.clearTimeout(o),i==null||i.removeEventListener("abort",l)}if(!u.ok)throw await T8(u);return u.json()}const A8=e=>`/api/integrations/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.id)}/`;function dje(e){const t=A8(e);return(n,s)=>fetch(`${t}${n.replace(/^\/+/,"")}`,s)}function hje(e){const t=A8(e);return n=>`${t}asset?url=${encodeURIComponent(n)}`}function fje(e,t){if(!t)return null;try{const n=new URL(t);return n.username||n.password||n.protocol!=="https:"&&n.protocol!=="http:"?null:n.origin===new URL(e.baseUrl).origin?n.href:null}catch{return null}}function pje(e){const t=new URLSearchParams;for(const[s,a]of Object.entries(e))a===void 0||a===""||a===!1||t.set(s,a===!0?"1":String(a));const n=t.toString();return n?`?${n}`:""}async function mje(e,t,{signal:n,timeoutMs:s=45e3}={}){const a=new AbortController,o=window.setTimeout(()=>a.abort(),s),i=()=>a.abort();n==null||n.addEventListener("abort",i,{once:!0});let l;try{l=await e(t,{signal:a.signal,headers:{Accept:"application/json"}})}catch(u){throw n!=null&&n.aborted?u:new vr("network",a.signal.aborted?"The deck took too long to answer.":"The deck could not be reached.")}finally{window.clearTimeout(o),n==null||n.removeEventListener("abort",i)}if(!l.ok)throw await T8(l);try{return await l.json()}catch{throw new vr("upstream","The deck answered with something that is not JSON.")}}let ia={connections:null,providers:[],error:""};const Tl=new Set;let Sf=null,fu=null,Bl=null,CO=0;const Fye=5e3,Bye=3;function $p(e){ia={...ia,...e},Tl.forEach(t=>t(ia))}function Gm(){return fu||(fu=(async()=>{try{const e=await Md("/api/integrations",{timeoutMs:1e4}),t=e==null?void 0:e.connections,n=e==null?void 0:e.providers;if(!Array.isArray(t)||!Array.isArray(n))throw new vr("upstream","The deck answered with something that is not the list of connections.");$p({connections:t,providers:n,error:""})}catch(e){$p({error:e instanceof Error?e.message:"Could not read the connections."}),ia.connections===null&&Tl.size>0&&Bl===null&&CO<Bye&&(Bl=window.setTimeout(()=>{Bl=null,Gm()},Fye*2**CO++))}finally{fu=null}})(),fu)}function qye(e){return e.connections===null||e.providers.length>0||e.connections.length>0}function _O(){qye(ia)&&Gm()}function US(e){const t=ia.connections??[],n=t.findIndex(s=>s.id===e.id);$p({connections:n<0?[...t,e]:t.map(s=>s.id===e.id?e:s)})}function Uye(e){$p({connections:(ia.connections??[]).filter(t=>t.id!==e)})}function $d(){const[e,t]=g.useState(ia);return g.useEffect(()=>{Tl.add(t),t(ia);const n=()=>{document.visibilityState==="visible"&&_O()};return Tl.size===1&&(Gm(),Sf=window.setInterval(_O,6e4),document.addEventListener("visibilitychange",n)),()=>{Tl.delete(t),Tl.size===0&&(Sf!==null&&window.clearInterval(Sf),Sf=null,Bl!==null&&window.clearTimeout(Bl),Bl=null,document.removeEventListener("visibilitychange",n))}},[]),e}function Lp(e,t){return(e.connections??[]).filter(n=>n.kind===t)}function Ld(e){return e.connections===null?new Set:new Set(e.providers.filter(t=>(t==null?void 0:t.available)===!0).map(t=>t.kind))}function ra(e,t){return Ld(e).has(t)}function Cj(e,t){return ra(e,t)&&Lp(e,t).length>0}function WS(e){return Ld(e).size>0?"all":(e.connections??[]).length>0?"connections":"none"}async function Wye(e,t,n){const s=await Md("/api/integrations/connections",{method:"POST",body:JSON.stringify({kind:e,name:n,input:t}),timeoutMs:6e4});return US(s.connection),s.connection}async function Hye(e,t){const n=await Md(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t),timeoutMs:6e4});return US(n.connection),n}async function zye(e){const t=await Md(`/api/integrations/connections/${encodeURIComponent(e)}/test`,{method:"POST",body:"{}",timeoutMs:6e4});return US(t.connection),t.connection}async function Vye(e){await Md(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"DELETE"}),Uye(e)}function Vo(e){try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function gje(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length?(t.length===1?t[0].slice(0,2):`${t[0][0]}${t[t.length-1][0]}`).toUpperCase():"?"}let Ip=null,Op=null;function EO(e){Op=null,Ip=e}function Gye(e){Ip=null,Op=e}function Kye(){const e=Op;return Op=null,e}function Yye(){const e=Ip;return Ip=null,e}const Xye={jira:"Boards, sprints, backlog and issues",github:"Repositories, pull requests and Actions",gitlab:"Projects, merge requests and pipelines"};function Zye(){return Array.from(document.querySelectorAll('[data-rail-item="explore-integrations"], [data-rail-item="more"]')).find(e=>e.checkVisibility?e.checkVisibility():e.getClientRects().length>0)??null}function Jye({integrations:e,onClose:t,onOpen:n,onConnect:s,onManage:a}){const o=gt(t,{restoreFocusFallback:Zye}),i=yt(t),l=qS().filter(f=>e.providers.some(p=>p.kind===f.kind)||Lp(e,f.kind).length>0),u=l.filter(f=>Cj(e,f.kind)).length,h=f=>{t(),f()};return vt.createPortal(r.jsx("div",{className:"modal-backdrop",role:"presentation",...i,children:r.jsxs("div",{ref:o,className:"modal explore-integrations",role:"dialog","aria-modal":"true","aria-labelledby":"explore-integrations-title","aria-describedby":"explore-integrations-description",children:[r.jsxs("div",{className:"modal-head explore-head",children:[r.jsx("h2",{id:"explore-integrations-title",children:"Explore integrations"}),r.jsx("button",{type:"button",className:"glyph-btn","aria-label":"Close Explore integrations",title:"Close (Esc)",onClick:t,children:"×"})]}),r.jsxs("div",{className:"explore-body",children:[r.jsx("p",{id:"explore-integrations-description",className:"explore-intro",children:"Connect your project tools and keep the work behind each agent close by."}),e.error&&r.jsxs("p",{className:"explore-status",role:"alert",children:[e.error," Connection status may be out of date. Manage connections in Settings."]}),e.connections===null?r.jsx("p",{className:"explore-status",role:"status",children:e.error?"Connection status is unavailable.":"Reading integrations…"}):l.length===0?r.jsx("p",{className:"explore-status",role:"status",children:"No integrations are available on this deck."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"explore-caption",children:[r.jsx("span",{children:"Available integrations"}),r.jsxs("span",{children:[u," connected"]})]}),r.jsx("ul",{className:"explore-providers",children:l.map(f=>{const p=ra(e,f.kind),m=Cj(e,f.kind),w=Lp(e,f.kind)[0];return r.jsxs("li",{className:"explore-provider",children:[r.jsx("span",{className:"explore-glyph","aria-hidden":!0,children:r.jsx(f.Glyph,{})}),r.jsxs("div",{className:"explore-info",children:[r.jsx("h3",{children:f.label}),r.jsx("p",{children:Xye[f.kind]}),r.jsxs("span",{className:"explore-connection","data-connected":m||void 0,children:[p?m?"Connected":"Not connected":"Unavailable on this deck"," · Read only"]})]}),r.jsx("div",{className:"explore-actions",children:m?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn","aria-label":`Open ${f.label}`,onClick:()=>h(()=>n(f.kind)),children:["Open ",r.jsx(rd,{})]}),r.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":`Manage ${f.label}`,onClick:()=>h(()=>a(w==null?void 0:w.id)),children:"Manage"})]}):p?r.jsx("button",{type:"button",className:"btn primary","aria-label":`Connect ${f.label}`,onClick:()=>h(()=>s(f.kind)),children:"Connect"}):w?r.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":`Manage ${f.label}`,onClick:()=>h(()=>a(w.id)),children:"Manage"}):r.jsx("span",{className:"explore-unavailable",children:"Not available"})})]},f.kind)})})]})]}),r.jsxs("div",{className:"explore-footer",children:[r.jsx("span",{children:"Read only · Tokens stay on this machine"}),r.jsxs("button",{type:"button",className:"btn explore-text-action",onClick:()=>h(()=>a()),children:["Manage in Settings ",r.jsx(rd,{})]})]})]})}),document.body)}function Qye({widths:e,room:t,gap:n,more:s}){let a=0,o=0;for(let i=0;i<e.length;i++){a+=(i>0?n:0)+e[i];const l=i+1<e.length?n+s:0;if(a+l>t)break;o=i+1}return o}function R8(e){return e.tool?e.tool.name:e.kind==="asked"?"question":"permission"}const ewe=20;function twe(e,t=ewe){if(e.length<=t)return e;const n=Math.floor((t-1)*.4),s=t-1-n;return`${e.slice(0,s)}…${e.slice(e.length-n)}`}function nwe(e){const t=Math.floor(Math.max(0,e)/6e4);if(t<1)return"less than a minute";const n=(o,i)=>`${o} ${i}${o===1?"":"s"}`;if(t<60)return n(t,"minute");const s=Math.floor(t/60),a=t%60;return a===0?n(s,"hour"):`${n(s,"hour")} ${n(a,"minute")}`}function swe(e,t,n){const s=t.tool?`on ${t.tool.name}`:t.kind==="asked"?"for an answer":"for permission";return`${e}, waiting ${nwe(n)} ${s}; go to session`}function rwe(e){const t=Gl(e),n=_P(e,t);return n?`${t}
|
|
112
|
+
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 v8(e){return Mp.find(t=>t.value===e)??Mp[0]}const Nj=3,H0=120,b8=1e4,k8=200,Zge="Write something first.";function vO(e){return e.trim()!==""}function Jge(e){var o;const t=e.trim();if(t==="")return"";const n=bO(t.split(/\r?\n/,1)[0]),s=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,a=z0(s).length>=Nj?z0(s):z0(n);return eye(a.length>=Nj?a:bO(t))}function Qge(e,t){const n=Jge(t);return n.length>=Nj?n:`${v8(e).label}: ${n}`}function bO(e){return e.replace(/\s+/g," ").trim()}function z0(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function eye(e){if(e.length<=H0)return e;const t=e.slice(0,H0-1),n=t.lastIndexOf(" ");return`${(n>=H0/2?t.slice(0,n):t).replace(/[\uD800-\uDBFF]$/,"").replace(/[\s,;:.\-–—]+$/,"")}…`}function tye({kind:e,body:t,contact:n}){const s={kind:e,title:Qge(e,t),body:t.trim()};return n.trim()!==""&&(s.contact=n.trim()),s}function nye(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 sye={darwin:"macOS",win32:"Windows",linux:"Linux"};function rye(e){const t=e.indexOf("-"),n=t===-1?e:e.slice(0,t),s=t===-1?"":e.slice(t+1),a=sye[n]??n;return s?`${a} · ${s}`:a}function aye(e){return e?`ccdeck ${e.appVersion} · ${rye(e.platform)}`:null}const oye="sent with it",iye="Your ccdeck version and system are sent with it.",lye="Add details",cye="How to reach you",uye="Email or GitHub @name",dye="Only if you would like an answer.",hye=["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 fye(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function BS(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function pye(e){return po(e)?["⌘","Enter"]:["Ctrl","Enter"]}function mye(e){return[...e].length===1}const j8="Thanks — feedback sent.";function kO(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 s=n==null?void 0:n.images;return e===400&&Array.isArray(s)&&typeof s[0]=="string"?`The server did not accept an image. ${s[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."}function gye(e){return e==="sending"?"Sending…":e==="sent"?j8:""}const jO=1400,yye=160,N8=g.createContext({values:{}});function S8(){return g.useContext(N8)}function wye(e,t){const n=e.variants;return n?{...e,...n.by[t[n.field]??""]??{}}:e}const NO=(e,t)=>!e.when||e.when.is.includes(t[e.when.field]??"");function xye({def:e,existing:t,busy:n,error:s,onSubmit:a,onCancel:o,onDirtyChange:i}){var q,T;const l=g.useId(),[u,h]=g.useState(()=>Object.fromEntries(e.fields.map(F=>{var D,K,V;return[F.name,F.secret?"":((D=F.initial)==null?void 0:D.call(F,t))??(F.type==="choice"?((V=(K=F.options)==null?void 0:K[0])==null?void 0:V.value)??"":"")]}))),[f,p]=g.useState((t==null?void 0:t.name)??""),m=g.useRef(null),w=g.useRef(new Map),b=!!t,k=g.useRef(u),v=g.useRef(f);g.useEffect(()=>{i==null||i(f!==v.current||Object.keys(u).some(F=>u[F]!==k.current[F]))},[f,u,i]);const N=e.fields.filter(F=>F.type==="choice").every(F=>u[F.name]===k.current[F.name]),x=b&&t.tokenSaved&&N,C=(F,D)=>{n||h(K=>({...K,[F]:D}))},S=F=>{var K;if(F.preventDefault(),n)return;const D={};for(const V of e.fields)NO(V,u)&&(D[V.name]=(u[V.name]??"").trim());(K=F.currentTarget.querySelector('button[type="submit"]'))==null||K.focus(),a(D,f.trim()),h(V=>Object.fromEntries(Object.entries(V).map(([H,P])=>{var I;return[H,(I=e.fields.find(U=>U.name===H))!=null&&I.secret?"":P]})))},_=g.useMemo(()=>{const F=u.baseUrl??"";try{return F?new URL(/^[a-z]+:\/\//i.test(F)?F:`https://${F}`).host:""}catch{return""}},[u.baseUrl]),$=g.useMemo(()=>({values:u,existing:t}),[u,t]),A=e.fields.filter(F=>NO(F,u)),O=(q=A.find(F=>!F.secret&&F.type!=="choice"))==null?void 0:q.name,M=(T=A.find(F=>F.secret))==null?void 0:T.name,W=s!=null&&s.field&&A.some(F=>F.name===s.field&&F.type!=="choice")?s.field:null,B=`${l}-error`;g.useEffect(()=>{var D,K,V;const F=b?M:O??M;F&&((D=w.current.get(F))==null||D.focus()),(V=(K=m.current)==null?void 0:K.scrollIntoView)==null||V.call(K,{block:"nearest"})},[b]),g.useEffect(()=>{var F;W&&((F=w.current.get(W))==null||F.focus())},[s,W]);const R=s&&r.jsxs(r.Fragment,{children:[s.message,s.detail&&r.jsxs("span",{className:"ig-form-detail",children:[" ",e.label," said: ",s.detail]}),s.kind==="rate-limit"&&s.retryAfter?r.jsxs("span",{children:[" Try again in ",s.retryAfter," s."]}):null]});return r.jsx(N8.Provider,{value:$,children:r.jsxs("form",{ref:m,className:"ig-form",onSubmit:S,"aria-labelledby":`${l}-title`,noValidate:!0,children:[r.jsxs("header",{className:"ig-managed-header",children:[r.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:r.jsx(e.Glyph,{})}),r.jsxs("div",{className:"ig-managed-identity",children:[r.jsx("h2",{className:"ig-form-title",id:`${l}-title`,children:b?`Edit ${t.name}`:`Connect ${e.label}`}),b&&r.jsxs("p",{children:[e.label," connection"]})]})]}),A.map(F=>{const D=wye(F,u),K=(s==null?void 0:s.field)===D.name,V=[D.hint?`${l}-${D.name}-hint`:"",K?B:""].filter(Boolean).join(" ")||void 0;if(D.type==="choice")return r.jsxs("fieldset",{className:"fb-kinds","aria-invalid":K||void 0,children:[r.jsx("legend",{className:"vis-hidden",children:D.label}),(D.options??[]).map(I=>r.jsxs("label",{className:"fb-kind",children:[r.jsx("input",{type:"radio",name:`${l}-${D.name}`,value:I.value,checked:u[D.name]===I.value,"aria-disabled":n||void 0,onChange:()=>C(D.name,I.value),onKeyDown:U=>{BS(U.nativeEvent)&&U.preventDefault()}}),I.label]},I.value))]},D.name);const H=D.secret&&x,P=`${l}-${D.name}`;return r.jsxs("div",{className:"fb-field",children:[r.jsxs("label",{className:"fb-field-label",htmlFor:P,children:[D.label,D.optional&&r.jsx("span",{className:"fb-optional",children:" optional"})]}),r.jsx("input",{id:P,className:`ap-manage-input ig-input${D.secret?" ig-mono":""}`,ref:I=>{I?w.current.set(D.name,I):w.current.delete(D.name)},type:D.type,inputMode:D.type==="url"?"url":D.type==="email"?"email":void 0,autoComplete:D.autoComplete??"off",spellCheck:!1,value:u[D.name]??"",onChange:I=>C(D.name,I.target.value),placeholder:H?"Saved. Leave blank to keep it":D.placeholder,readOnly:n,"aria-invalid":K||void 0,"aria-describedby":V,"aria-required":!D.optional&&!H||void 0}),D.hint&&r.jsx("span",{className:"ig-hint",id:`${l}-${D.name}-hint`,children:D.hint}),K&&W===D.name&&r.jsx("span",{className:"ig-form-error",id:B,role:"alert",children:R})]},D.name)}),r.jsxs("details",{className:"ig-help ig-token-help",children:[r.jsxs("summary",{children:["How to create a ",e.label," token"]}),e.tokenHelp]}),r.jsxs("div",{className:"fb-field",children:[r.jsxs("label",{className:"fb-field-label",htmlFor:`${l}-name`,children:["Name ",r.jsx("span",{className:"fb-optional",children:"optional"})]}),r.jsx("input",{id:`${l}-name`,className:"ap-manage-input ig-input",type:"text",autoComplete:"off",maxLength:120,readOnly:n,value:f,onChange:F=>p(F.target.value),placeholder:_||e.label})]}),s&&!W&&r.jsx("p",{className:"ig-form-error",id:B,role:"alert",children:R}),r.jsxs("div",{className:"ig-form-actions",children:[r.jsx("button",{type:"submit",className:"btn primary","aria-disabled":n,"aria-busy":n,children:n?"Checking…":b?"Save":"Connect"}),r.jsx("button",{type:"button",className:"btn","aria-disabled":n||void 0,onClick:()=>{n||o()},children:"Cancel"})]})]})})}const vye="https://id.atlassian.com/manage-profile/security/api-tokens",bye="https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/",kye="https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html",jye=[{scope:"read:jira-work",why:"issues, comments, search"},{scope:"read:jira-user",why:"your account and avatars"},{scope:"read:board-scope:jira-software",why:"boards and backlogs"},{scope:"read:board-scope.admin:jira-software",why:"a board's estimation and quick filters"},{scope:"read:sprint:jira-software",why:"sprints"},{scope:"read:epic:jira-software",why:"epic names and colours"},{scope:"read:issue-details:jira",why:"issue lists"},{scope:"read:jql:jira",why:"filtered lists"}];function Nye(e){const t=e.trim();if(!t)return null;try{const n=new URL(/^[a-z]+:\/\//i.test(t)?t:`https://${t}`),s=n.hostname==="localhost"||n.hostname==="127.0.0.1";return n.protocol!=="https:"&&!s||!n.hostname.includes(".")&&!s?null:`${n.origin}${n.pathname.replace(/\/+$/,"")}/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens`}catch{return null}}function Sye(){const{values:e}=S8(),t=e.deployment==="cloud",n=t?null:Nye(e.baseUrl??"");let s="";try{s=n?new URL(n).host:""}catch{}return r.jsxs(r.Fragment,{children:[t?r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["Make one at ",r.jsx("a",{href:vye,target:"_blank",rel:"noreferrer noopener",children:"id.atlassian.com → Security → API tokens"}),". A classic token reads Jira as you. A token ",r.jsx("em",{children:"with scopes"})," works too: the deck finds your site’s api.atlassian.com address itself, and needs these read scopes:"]}),r.jsx("ul",{className:"ig-scopes",children:jye.map(a=>r.jsxs("li",{children:[r.jsx("code",{children:a.scope})," ",r.jsx("span",{children:a.why})]},a.scope))}),r.jsx("p",{children:r.jsx("a",{href:bye,target:"_blank",rel:"noreferrer noopener",children:"How Atlassian API tokens work"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:["In Jira, open your avatar → ",r.jsx("strong",{children:"Profile"})," → ",r.jsx("strong",{children:"Personal Access Tokens"})," → ",r.jsx("strong",{children:"Create token"}),n&&r.jsxs(r.Fragment,{children:[" (",r.jsxs("a",{href:n,target:"_blank",rel:"noreferrer noopener",children:["open it on ",s]}),")"]}),". The token reads what your account can read. Give it an expiry you are comfortable with. Needs Jira 8.14 or newer."]}),r.jsx("p",{children:r.jsx("a",{href:kye,target:"_blank",rel:"noreferrer noopener",children:"How personal access tokens work"})})]}),r.jsx("p",{className:"ig-dim",children:"Browsing only reads Jira. Dragging an issue or confirming Move saves its sprint and rank in Jira, using your account’s permissions. The token stays on this machine and is never shown again."}),t&&r.jsxs("p",{className:"ig-dim",children:["For moving with a scoped Cloud token, also allow ",r.jsx("code",{children:"write:issue:jira-software"})," (rank), ",r.jsx("code",{children:"write:sprint:jira-software"})," (sprint) and ",r.jsx("code",{children:"write:board-scope:jira-software"})," (backlog). Read-only tokens can still browse."]})]})}function V0(e,t,n="classic"){if(e==="github")return n==="classic"?"https://github.com/settings/tokens/new?scopes=repo,read:org&description=ccdeck":"https://github.com/settings/personal-access-tokens/new";const s=(t??"").trim()||"https://gitlab.com";let a;try{a=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(s)?s:`https://${s}`)}catch{return null}return a.protocol!=="https:"&&a.protocol!=="http:"||!a.hostname.includes(".")&&a.hostname!=="localhost"?null:`${a.origin}${a.pathname.replace(/\/+$/,"")}/-/user_settings/personal_access_tokens?name=ccdeck&scopes=read_api`}function G0({href:e,children:t}){return e?r.jsxs("a",{className:"fg-token-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t," ",r.jsx(rd,{})]}):null}function C8({kind:e,baseUrl:t}){const{values:n}=S8();if(e==="github")return r.jsxs("div",{className:"fg-token-help",children:[r.jsx("p",{children:"A personal access token. Either kind works:"}),r.jsxs("ul",{children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Classic"})," — the ",r.jsx("code",{children:"repo"})," and ",r.jsx("code",{children:"read:org"})," scopes."," ",r.jsx(G0,{href:V0("github"),children:"Make one"})]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Fine-grained"})," — the repositories you want to see, with read-only access to Actions, Checks, Commit statuses, Contents, Issues, Metadata and Pull requests. Contents is for branches and commits; the panel never opens your files."," ",r.jsx(G0,{href:V0("github",null,"fine-grained"),children:"Make one"})]})]}),r.jsx("p",{children:"An organization may have to approve a fine-grained token, or a classic one be authorized for its single sign-on, before its repositories show."})]});const s=V0("gitlab",t??(n.where==="self"?n.baseUrl:null));return r.jsxs("div",{className:"fg-token-help",children:[r.jsxs("p",{children:["A personal access token with the ",r.jsx("code",{children:"read_api"})," scope, and nothing more."," ",r.jsx(G0,{href:s,children:`Make one on ${s?new URL(s).host:"GitLab"}`})]}),r.jsx("p",{children:"GitLab tokens expire. When this one does, the panel says so and brings you back here."})]})}const _8={name:"token",label:"Personal access token",type:"password",secret:!0,placeholder:"Paste the token"},Cye=[_8],SO=e=>{try{return e?new URL(e.baseUrl).host!=="gitlab.com":!1}catch{return!1}},_ye=[{name:"where",label:"Which GitLab",type:"choice",options:[{value:"cloud",label:"GitLab.com"},{value:"self",label:"Self-managed"}],initial:e=>SO(e)?"self":"cloud"},{name:"baseUrl",label:"GitLab URL",type:"url",placeholder:"https://gitlab.example.com",hint:"The address you open GitLab at, with its path if it has one. https only.",when:{field:"where",is:["self"]},initial:e=>SO(e)?e.baseUrl:""},_8],Eye=g.createElement(C8,{kind:"github"}),Tye=g.createElement(C8,{kind:"gitlab"}),Aye=e=>{var t;return((t=e==null?void 0:e.meta)==null?void 0:t.deployment)==="cloud"?"cloud":"server"},Rye={kind:"jira",label:"Jira",Glyph:MQ,shortcut:"I",detail:"Boards, sprints, and issues",blurb:"Jira Cloud, or Jira Server / Data Center 8.14 and newer.",fields:[{name:"deployment",label:"Which Jira",type:"choice",options:[{value:"server",label:"Jira Server / Data Center"},{value:"cloud",label:"Jira Cloud"}],initial:Aye},{name:"baseUrl",label:"Jira URL",type:"url",initial:e=>(e==null?void 0:e.baseUrl)??"",variants:{field:"deployment",by:{server:{label:"Jira URL",placeholder:"https://jira.example.com",hint:"The address you open Jira at, with its path if it has one (…/jira). https only."},cloud:{label:"Site URL",placeholder:"your-site.atlassian.net",hint:"The address you open Jira at. Your site name alone is enough."}}}},{name:"email",label:"Atlassian account email",type:"email",placeholder:"you@example.com",autoComplete:"username",secret:!0,when:{field:"deployment",is:["cloud"]}},{name:"token",label:"Personal access token",type:"password",secret:!0,variants:{field:"deployment",by:{server:{label:"Personal access token",placeholder:"Paste the token"},cloud:{label:"API token",placeholder:"Paste the API token"}}}}],tokenHelp:g.createElement(Sye)},Mye={kind:"github",label:"GitHub",Glyph:$Q,detail:"Repositories, pull requests, and Actions",blurb:"github.com, read-only, with a personal access token.",fields:Cye,tokenHelp:Eye},$ye={kind:"gitlab",label:"GitLab",Glyph:LQ,detail:"Projects, merge requests, and pipelines",blurb:"GitLab.com or your own instance, read-only.",fields:_ye,tokenHelp:Tye},Sj={jira:Rye,github:Mye,gitlab:$ye},qS=()=>Object.values(Sj).filter(e=>!!e);function _u(e){return(Object.hasOwn(Sj,e)?Sj[e]:void 0)??null}function Vm(e,t){const n=s=>typeof t=="string"?t:t(s);return g.lazy(()=>e().catch(s=>(console.warn(`ccdeck could not load ${typeof t=="string"?t:"a dialog"}`,s),{default:a=>r.jsx(Lye,{name:n(a),onClose:a.onClose})})))}function Lye({name:e,onClose:t}){const n=g.useRef(null),s=gt(t,{focusRef:n}),a=yt(t);return r.jsx("div",{className:"modal-backdrop",...a,role:"presentation",children:r.jsxs("div",{ref:s,className:"modal dialog-missing",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"dialog-missing-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"dialog-missing-title",className:"modal-tool-name",children:e})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[r.jsxs("p",{className:"dm-note",children:[e," did not load. The deck has most likely been updated since this tab opened, and a reload picks up the new version."]}),r.jsxs("div",{className:"dm-actions",children:[r.jsx("button",{type:"button",className:"btn",onClick:t,children:"Close"}),r.jsx("button",{type:"button",ref:n,className:"btn primary",onClick:()=>window.location.reload(),children:"Reload"})]})]})]})})}const E8=()=>bi(()=>import("./IntegrationModal-CcSR7YB-.js"),[]);function Iye(){E8().catch(()=>{})}const Oye=Vm(E8,e=>{var t;return((t=_u(e.kind))==null?void 0:t.label)??"The tracker"});function Pye({onClose:e}){return g.useEffect(()=>rn.push(e,0,"dialog"),[e]),null}function Dye(e){return r.jsx(g.Suspense,{fallback:r.jsx(Pye,{onClose:e.onClose}),children:r.jsx(Oye,{...e})})}class vr extends Error{constructor(n,s,a={}){super(s);qa(this,"kind");qa(this,"status");qa(this,"retryAfter");qa(this,"field");qa(this,"detail");this.name="IntegrationFailure",this.kind=n,Object.assign(this,a)}}async function T8(e){try{const t=await e.json(),n=t==null?void 0:t.error;if(n&&typeof n.kind=="string"&&typeof n.message=="string")return new vr(n.kind,n.message,{status:n.status,retryAfter:n.retryAfter,field:n.field,detail:n.detail})}catch{}return new vr(e.status===401?"auth":"upstream",`The deck answered ${e.status}.`)}async function Md(e,t={}){const{timeoutMs:n=3e4,...s}=t,a=new AbortController,o=window.setTimeout(()=>a.abort(),n),i=s.signal,l=()=>a.abort();i==null||i.addEventListener("abort",l,{once:!0});let u;try{u=await fetch(e,{...s,signal:a.signal,headers:s.body?{"Content-Type":"application/json",...s.headers??{}}:s.headers})}catch(h){throw i!=null&&i.aborted?h:new vr("network",a.signal.aborted?"The deck took too long to answer.":"The deck could not be reached.")}finally{window.clearTimeout(o),i==null||i.removeEventListener("abort",l)}if(!u.ok)throw await T8(u);return u.json()}const A8=e=>`/api/integrations/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.id)}/`;function dje(e){const t=A8(e);return(n,s)=>fetch(`${t}${n.replace(/^\/+/,"")}`,s)}function hje(e){const t=A8(e);return n=>`${t}asset?url=${encodeURIComponent(n)}`}function fje(e,t){if(!t)return null;try{const n=new URL(t);return n.username||n.password||n.protocol!=="https:"&&n.protocol!=="http:"?null:n.origin===new URL(e.baseUrl).origin?n.href:null}catch{return null}}function pje(e){const t=new URLSearchParams;for(const[s,a]of Object.entries(e))a===void 0||a===""||a===!1||t.set(s,a===!0?"1":String(a));const n=t.toString();return n?`?${n}`:""}async function mje(e,t,{signal:n,timeoutMs:s=45e3}={}){const a=new AbortController,o=window.setTimeout(()=>a.abort(),s),i=()=>a.abort();n==null||n.addEventListener("abort",i,{once:!0});let l;try{l=await e(t,{signal:a.signal,headers:{Accept:"application/json"}})}catch(u){throw n!=null&&n.aborted?u:new vr("network",a.signal.aborted?"The deck took too long to answer.":"The deck could not be reached.")}finally{window.clearTimeout(o),n==null||n.removeEventListener("abort",i)}if(!l.ok)throw await T8(l);try{return await l.json()}catch{throw new vr("upstream","The deck answered with something that is not JSON.")}}let ia={connections:null,providers:[],error:""};const Tl=new Set;let Sf=null,fu=null,Bl=null,CO=0;const Fye=5e3,Bye=3;function $p(e){ia={...ia,...e},Tl.forEach(t=>t(ia))}function Gm(){return fu||(fu=(async()=>{try{const e=await Md("/api/integrations",{timeoutMs:1e4}),t=e==null?void 0:e.connections,n=e==null?void 0:e.providers;if(!Array.isArray(t)||!Array.isArray(n))throw new vr("upstream","The deck answered with something that is not the list of connections.");$p({connections:t,providers:n,error:""})}catch(e){$p({error:e instanceof Error?e.message:"Could not read the connections."}),ia.connections===null&&Tl.size>0&&Bl===null&&CO<Bye&&(Bl=window.setTimeout(()=>{Bl=null,Gm()},Fye*2**CO++))}finally{fu=null}})(),fu)}function qye(e){return e.connections===null||e.providers.length>0||e.connections.length>0}function _O(){qye(ia)&&Gm()}function US(e){const t=ia.connections??[],n=t.findIndex(s=>s.id===e.id);$p({connections:n<0?[...t,e]:t.map(s=>s.id===e.id?e:s)})}function Uye(e){$p({connections:(ia.connections??[]).filter(t=>t.id!==e)})}function $d(){const[e,t]=g.useState(ia);return g.useEffect(()=>{Tl.add(t),t(ia);const n=()=>{document.visibilityState==="visible"&&_O()};return Tl.size===1&&(Gm(),Sf=window.setInterval(_O,6e4),document.addEventListener("visibilitychange",n)),()=>{Tl.delete(t),Tl.size===0&&(Sf!==null&&window.clearInterval(Sf),Sf=null,Bl!==null&&window.clearTimeout(Bl),Bl=null,document.removeEventListener("visibilitychange",n))}},[]),e}function Lp(e,t){return(e.connections??[]).filter(n=>n.kind===t)}function Ld(e){return e.connections===null?new Set:new Set(e.providers.filter(t=>(t==null?void 0:t.available)===!0).map(t=>t.kind))}function ra(e,t){return Ld(e).has(t)}function Cj(e,t){return ra(e,t)&&Lp(e,t).length>0}function WS(e){return Ld(e).size>0?"all":(e.connections??[]).length>0?"connections":"none"}async function Wye(e,t,n){const s=await Md("/api/integrations/connections",{method:"POST",body:JSON.stringify({kind:e,name:n,input:t}),timeoutMs:6e4});return US(s.connection),s.connection}async function Hye(e,t){const n=await Md(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t),timeoutMs:6e4});return US(n.connection),n}async function zye(e){const t=await Md(`/api/integrations/connections/${encodeURIComponent(e)}/test`,{method:"POST",body:"{}",timeoutMs:6e4});return US(t.connection),t.connection}async function Vye(e){await Md(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"DELETE"}),Uye(e)}function Vo(e){try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function gje(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length?(t.length===1?t[0].slice(0,2):`${t[0][0]}${t[t.length-1][0]}`).toUpperCase():"?"}let Ip=null,Op=null;function EO(e){Op=null,Ip=e}function Gye(e){Ip=null,Op=e}function Kye(){const e=Op;return Op=null,e}function Yye(){const e=Ip;return Ip=null,e}const Xye={jira:"Boards, sprints, backlog and issues",github:"Repositories, pull requests and Actions",gitlab:"Projects, merge requests and pipelines"};function Zye(){return Array.from(document.querySelectorAll('[data-rail-item="explore-integrations"], [data-rail-item="more"]')).find(e=>e.checkVisibility?e.checkVisibility():e.getClientRects().length>0)??null}function Jye({integrations:e,onClose:t,onOpen:n,onConnect:s,onManage:a}){const o=gt(t,{restoreFocusFallback:Zye}),i=yt(t),l=qS().filter(f=>e.providers.some(p=>p.kind===f.kind)||Lp(e,f.kind).length>0),u=l.filter(f=>Cj(e,f.kind)).length,h=f=>{t(),f()};return vt.createPortal(r.jsx("div",{className:"modal-backdrop",role:"presentation",...i,children:r.jsxs("div",{ref:o,className:"modal explore-integrations",role:"dialog","aria-modal":"true","aria-labelledby":"explore-integrations-title","aria-describedby":"explore-integrations-description",children:[r.jsxs("div",{className:"modal-head explore-head",children:[r.jsx("h2",{id:"explore-integrations-title",children:"Explore integrations"}),r.jsx("button",{type:"button",className:"glyph-btn","aria-label":"Close Explore integrations",title:"Close (Esc)",onClick:t,children:"×"})]}),r.jsxs("div",{className:"explore-body",children:[r.jsx("p",{id:"explore-integrations-description",className:"explore-intro",children:"Connect your project tools and keep the work behind each agent close by."}),e.error&&r.jsxs("p",{className:"explore-status",role:"alert",children:[e.error," Connection status may be out of date. Manage connections in Settings."]}),e.connections===null?r.jsx("p",{className:"explore-status",role:"status",children:e.error?"Connection status is unavailable.":"Reading integrations…"}):l.length===0?r.jsx("p",{className:"explore-status",role:"status",children:"No integrations are available on this deck."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"explore-caption",children:[r.jsx("span",{children:"Available integrations"}),r.jsxs("span",{children:[u," connected"]})]}),r.jsx("ul",{className:"explore-providers",children:l.map(f=>{const p=ra(e,f.kind),m=Cj(e,f.kind),w=Lp(e,f.kind)[0];return r.jsxs("li",{className:"explore-provider",children:[r.jsx("span",{className:"explore-glyph","aria-hidden":!0,children:r.jsx(f.Glyph,{})}),r.jsxs("div",{className:"explore-info",children:[r.jsx("h3",{children:f.label}),r.jsx("p",{children:Xye[f.kind]}),r.jsxs("span",{className:"explore-connection","data-connected":m||void 0,children:[p?m?"Connected":"Not connected":"Unavailable on this deck"," · Read only"]})]}),r.jsx("div",{className:"explore-actions",children:m?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"btn","aria-label":`Open ${f.label}`,onClick:()=>h(()=>n(f.kind)),children:["Open ",r.jsx(rd,{})]}),r.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":`Manage ${f.label}`,onClick:()=>h(()=>a(w==null?void 0:w.id)),children:"Manage"})]}):p?r.jsx("button",{type:"button",className:"btn primary","aria-label":`Connect ${f.label}`,onClick:()=>h(()=>s(f.kind)),children:"Connect"}):w?r.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":`Manage ${f.label}`,onClick:()=>h(()=>a(w.id)),children:"Manage"}):r.jsx("span",{className:"explore-unavailable",children:"Not available"})})]},f.kind)})})]})]}),r.jsxs("div",{className:"explore-footer",children:[r.jsx("span",{children:"Read only · Tokens stay on this machine"}),r.jsxs("button",{type:"button",className:"btn explore-text-action",onClick:()=>h(()=>a()),children:["Manage in Settings ",r.jsx(rd,{})]})]})]})}),document.body)}function Qye({widths:e,room:t,gap:n,more:s}){let a=0,o=0;for(let i=0;i<e.length;i++){a+=(i>0?n:0)+e[i];const l=i+1<e.length?n+s:0;if(a+l>t)break;o=i+1}return o}function R8(e){return e.tool?e.tool.name:e.kind==="asked"?"question":"permission"}const ewe=20;function twe(e,t=ewe){if(e.length<=t)return e;const n=Math.floor((t-1)*.4),s=t-1-n;return`${e.slice(0,s)}…${e.slice(e.length-n)}`}function nwe(e){const t=Math.floor(Math.max(0,e)/6e4);if(t<1)return"less than a minute";const n=(o,i)=>`${o} ${i}${o===1?"":"s"}`;if(t<60)return n(t,"minute");const s=Math.floor(t/60),a=t%60;return a===0?n(s,"hour"):`${n(s,"hour")} ${n(a,"minute")}`}function swe(e,t,n){const s=t.tool?`on ${t.tool.name}`:t.kind==="asked"?"for an answer":"for permission";return`${e}, waiting ${nwe(n)} ${s}; go to session`}function rwe(e){const t=Gl(e),n=_P(e,t);return n?`${t}
|
|
113
113
|
${n}`:t}const awe=new Set(["idle","checking","current","downloading","ready","error"]);function TO(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.status!="string"||!awe.has(t.status))return null;const n=typeof t.version=="string"&&t.version.trim()?t.version.trim():null;return t.status==="ready"&&!n?null:{status:t.status,version:n}}function owe(e){return(e==null?void 0:e.status)==="ready"&&e.version?{version:e.version}:null}function M8(e=typeof navigator>"u"?"":navigator.userAgent){var t;return((t=/\bccdeck-desktop\/(\d[^\s]*)/.exec(e))==null?void 0:t[1])??null}const Ql="Restart to update",$8=3e4;function L8(e=typeof navigator>"u"?"":navigator.userAgent){return/\bMac OS X\b|\bMacintosh\b/.test(e)?"the ccdeck menu in the menu bar":"the ccdeck tray menu"}function iwe(e,t){const n=`v${e} → v${t}`;return{text:n,label:`${n}, update downloaded and verified`,title:`ccdeck v${t} is downloaded and verified · click to open What's new, where ${Ql} comes first`}}function I8(e,t=!1){return{text:t?"Restarting…":Ql,label:t?void 0:`${Ql} to v${e}`,title:`Install ccdeck v${e} now: ccdeck restarts and is back in a few seconds. Your Claude Code and Codex sessions keep running.`}}function lwe(e){const t=e==null?void 0:e.reason;return t==="app_disconnected"||t==="update_not_ready"?t:"refused"}function O8(e,t,n=typeof navigator>"u"?"":navigator.userAgent){const s=L8(n),a=`Use ${Ql} in ${s}.`;switch(e){case"app_disconnected":return`Nothing restarted: the app is not connected to this deck, so the request had nowhere to go. ${a}`;case"update_not_ready":return`Nothing restarted: the app no longer has v${t} ready. When it has one, ${Ql} is in ${s}.`;case"timeout":return`ccdeck has not restarted after ${$8/1e3} seconds. ${a}`;case"refused":return`Nothing restarted: the deck turned the request down. ${a}`;case"unreachable":return`Nothing restarted: the request did not reach the deck. ${a}`}}const cwe="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",K0="click for what's new";function uwe(e){if(e.checkDisabled)return`${cwe} · ${K0}`;if(e.checking)return`Asking npm for the newest release… · ${K0}`;const t=e.latest?`npm has v${e.latest}`:e.latestPending?`npm's latest tag names v${e.latestPending}, which it cannot serve yet`:"npm not reached yet",n=e.checkFailedAgo?` · could not reach npm ${e.checkFailedAgo}`:e.checkedAgo?` · checked ${e.checkedAgo}`:"";return`${t}${n} · re-checked periodically · ${K0}, and to check npm now`}function dwe(e){const t=`Version v${e.running}, show what's new`;return e.checkDisabled?`${t} — update checks are off`:e.checking?`${t} — checking npm for a newer release`:e.checkFailedAgo?`${t} — npm could not be reached ${e.checkFailedAgo}, check again`:`${t} and check npm for a newer release`}function hwe(e){const t=e.kind==="restart"?`v${e.to} is installed and waiting for a restart`:`v${e.to} is available on npm`,n=e.open?"show what's new":"show what's new and the notice";return`Version v${e.from}, ${t} — ${n}`}function P8(e){return e?`${e.kind}:${e.to}`:""}function fwe(e,t){return e!=null&&t!==P8(e)}function pwe({readyAppUpdate:e,notice:t,noticeOpen:n,version:s,chipVersion:a,versionChecking:o,now:i,openReleaseNotes:l,showNotice:u,loadVersion:h,restartToUpdate:f,updateRestarting:p=!1}){return r.jsx(r.Fragment,{children:e?(()=>{const m=iwe(M8()??a,e.version),w=f&&I8(e.version,p);return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"v ready",onClick:l,"aria-haspopup":"dialog","aria-label":m.label,title:m.title,children:[m.text,r.jsx("span",{className:"v-dot","aria-hidden":!0})]}),w&&r.jsx("button",{type:"button",className:"v ready v-update",onClick:()=>f(e.version),"aria-busy":p||void 0,"aria-label":w.label,title:w.title,children:w.text})]})})():t?r.jsxs("button",{type:"button",className:"v stale",onClick:()=>{l(),u()},"aria-haspopup":"dialog","aria-label":hwe({...t,open:n}),title:t.kind==="restart"?`Running v${t.from}; v${t.to} is installed on disk. Restart to pick it up · click for what's new`:`Running v${t.from}; v${t.to} is on npm · click for what's new`,children:["v",t.from,r.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const m={running:a,latest:s==null?void 0:s.latest,latestPending:s==null?void 0:s.latestPending,checkedAgo:s!=null&&s.checkedAt?rp(i-s.checkedAt):null,checkFailedAgo:s!=null&&s.checkFailedAt&&s.checkFailedAt>(s.checkedAt??0)?rp(i-s.checkFailedAt):null,checkDisabled:s==null?void 0:s.checkDisabled,checking:o};return r.jsxs("button",{type:"button",className:o?"v checking":"v",onClick:()=>{l(),h(!0)},"aria-busy":o||void 0,"aria-haspopup":"dialog","aria-label":dwe(m),title:uwe(m),children:["v",m.running]})})()})}function mwe({live:e,paused:t,pauseGate:n}){const s=An();return r.jsx("span",{className:"status",children:(()=>{const a=WY({connected:e,paused:t,held:n.size,dropped:n.dropped,singleKeys:s});return a.resting?null:r.jsx("span",{className:`pill ${a.tone}`,title:a.title,children:r.jsxs("span",{className:"pill-box",children:[r.jsx("span",{className:"pill-widest","aria-hidden":!0,children:a.widest}),r.jsx("span",{className:"pill-label",children:a.label})]})})})()})}function gwe(e,t){return`${e.label} — ${R8(e.waiting)} · ${Qu(e.waiting.since,void 0,t)}`}function D8(e,t){const n=e.slice(0,6).map(s=>gwe(s,t));return e.length>6&&n.push(`and ${e.length-6} more`),n.join(`
|
|
114
114
|
`)}function ywe({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:s,named:a}){const o=An(),i=ac("below"),l=e.slice(a),u=e.length;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{t.current=e[0].id,n(e[0].id)},"aria-label":`${u} session${u===1?"":"s"} waiting for you`,"aria-keyshortcuts":o?"W":void 0,...i.bind({label:"Go to the longest wait",keys:o?"W":void 0,detail:l.length>0?D8(l,s):void 0}),children:[r.jsx("span",{className:"ap-pulse","aria-hidden":!0}),r.jsx("b",{children:u})," waiting"]}),i.node]})}function AO({w:e,now:t}){return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"we-name",children:twe(e.label)}),r.jsx("span",{className:"we-wait",children:Qu(e.waiting.since,void 0,t)}),r.jsxs("span",{className:"we-what",children:["· ",R8(e.waiting)]})]})}const wwe=12,xwe=2e3,vwe=4;function bwe({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:s,onFit:a,onMore:o}){const i=An(),l=ac("below"),u=g.useRef(null),h=g.useRef(null),[f,p]=g.useState(0),m=e.map(v=>v.id).join(`
|
|
115
115
|
`);g.useLayoutEffect(()=>{const v=u.current,N=h.current;if(!v||!N)return;const x=()=>{const S=Array.from(N.children),_=S.pop();p(Qye({widths:S.map($=>$.getBoundingClientRect().width),room:v.clientWidth-wwe,gap:vwe,more:(_==null?void 0:_.getBoundingClientRect().width)??0}))};if(x(),typeof ResizeObserver>"u")return;const C=new ResizeObserver(x);return C.observe(v),C.observe(N),()=>C.disconnect()},[m]);const w=e.slice(0,f),b=e.slice(f);g.useEffect(()=>{a(w.length)},[w.length,a]);const k=v=>{t.current=v,n(v)};return r.jsxs("div",{className:"wait-names",ref:u,children:[r.jsxs("ul",{className:"wait-list",children:[w.map(v=>r.jsx("li",{"data-fresh":s-v.waiting.since<xwe||void 0,children:r.jsx("button",{type:"button",className:"wait-entry",onClick:()=>k(v.id),"aria-label":swe(v.label,v.waiting,s-v.waiting.since),...l.bind({label:v.label,detail:rwe(v.waiting)}),children:r.jsx(AO,{w:v,now:s})})},v.id)),w.length>0&&b.length>0&&r.jsx("li",{children:r.jsxs("button",{type:"button",className:"wait-more",onClick:o,"aria-label":`${b.length} more waiting; open the session list`,"aria-keyshortcuts":i?"L":void 0,...l.bind({label:"Open the session list",keys:i?"L":void 0,detail:D8(b,s)}),children:["+",b.length," more"]})})]}),e.length>0&&r.jsxs("span",{className:"wait-ruler",ref:h,"aria-hidden":!0,children:[e.map(v=>r.jsx("span",{className:"wait-entry",children:r.jsx(AO,{w:v,now:s})},v.id)),r.jsxs("span",{className:"wait-more",children:["+",e.length," more"]})]}),l.node]})}const _j={on:"The deck will raise a system notification when a session blocks on you and this tab is in the background",blocked:"Notifications are blocked for this page. Only your browser can undo that — its site settings for this address"};function kwe(e){return e==="on"?`Notifications on. ${_j.on}.`:e==="blocked"?`${_j.blocked}.`:""}function jwe({notifySaid:e}){return r.jsx("span",{className:e==="on"?"notify-said":"notify-said notify-said-blocked","aria-hidden":!0,title:_j[e],children:e==="on"?"notifications on":"notifications blocked"})}function Nwe({versionCheck:e,welcome:t,desktopUpdate:n,pause:s,announcements:a,notify:o,waitingSessions:i,waitingCursorRef:l,focusSession:u,live:h,now:f,incidents:p,queueNamed:m}){const{version:w,notice:b,noticeOpen:k,showNotice:v,versionChecking:N,loadVersion:x}=e,{chipVersion:C,openReleaseNotes:S}=t,{readyAppUpdate:_,desktopUpdateRestarting:$,desktopUpdateFailure:A,askDesktopUpdateRestart:O}=n,M=g.useRef(!1);g.useEffect(()=>{$||!M.current||(M.current=!1,A&&S())},[$,A,S]);const W=K=>{M.current=!0,O(K)},{paused:B,pauseGate:R}=s,{blockedSaid:q,watchSaid:T,incidentSaid:F}=a,{notifySaid:D}=o;return r.jsxs("div",{className:"readout",children:[r.jsxs("div",{className:"brand",children:[r.jsx("img",{className:"logo logo-on-dark",src:Vne,width:19,height:16,alt:""}),r.jsx("img",{className:"logo logo-on-light",src:Gne,width:19,height:16,alt:""}),r.jsx("h1",{children:Pt}),r.jsx(pwe,{readyAppUpdate:_,notice:b,noticeOpen:k,version:w,chipVersion:C,versionChecking:N,now:f,openReleaseNotes:S,showNotice:v,loadVersion:x,restartToUpdate:W,updateRestarting:$})]}),r.jsx(mwe,{live:h,paused:B,pauseGate:R}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:q}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:T}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:F}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:kwe(D)}),r.jsx(sse,{incidents:p}),i.length>0&&r.jsx(ywe,{waitingSessions:i,waitingCursorRef:l,focusSession:u,now:f,named:m}),D&&r.jsx(jwe,{notifySaid:D})]})}function Swe({selected:e,now:t,selectedIds:n,focusAgent:s,clearSelection:a}){const o=An(),i=Un(e),l=Math.max(0,((e.endedAt??t)-e.startedAt)/1e3),u=e.state==="active"&&!e.synthetic?fN(i.total,l):null,h=n.size-1;return r.jsxs("button",{type:"button",className:"selected-ribbon",title:`${_n(`Zoom to ${e.label} and its session`,"Z",o)}${i.total>0?`
|
|
116
116
|
${ct(i.total)} spent${u?` · ${u}`:""}`:""}`,onClick:()=>{try{s(e.id)}catch{}},children:[r.jsx("span",{className:`state-pill state-${e.state}`,children:e.state==="active"?"live":e.state}),r.jsx("span",{className:"selected-label",children:e.label}),i.total>0&&r.jsxs("span",{className:"selected-cost",children:[ct(i.total),u?r.jsxs("span",{className:"selected-rate",children:[" · ",u]}):null]}),h>0&&r.jsxs("span",{className:"selected-extra",children:["+",h]}),r.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:f=>{f.stopPropagation(),a()},children:"×"})]})}function Cwe({catBarRef:e,catBarOccluded:t,presentCats:n,hiddenCats:s,toggleCat:a}){return r.jsx("div",{ref:e,className:`cat-filter-bar${t?" occluded":""}`,role:"group","aria-label":"Filter tools by category",children:n.map(o=>{const i=s.has(o);return r.jsxs("button",{type:"button",className:`cat-filter${i?" off":""}`,onClick:()=>a(o),"aria-pressed":!i,title:`${i?"Show":"Hide"} ${Rp[o]} tools`,children:[r.jsx(qge,{cat:o}),r.jsx("span",{className:"cat-name",children:Rp[o]})]},o)})})}const _we=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(",");function Ewe(e){var n,s;const t=e.target;!(t!=null&&t.closest)||t.closest(_we)!==e.currentTarget||(e.preventDefault(),(s=(n=document.activeElement)==null?void 0:n.blur)==null||s.call(n))}function Twe({trashZoneRef:e,trashState:t,trashPhase:n,trashLabel:s}){const a=An();return r.jsxs("div",{ref:e,className:`drag-trash-zone ${t}${n==="leaving"?" leaving":""}`,role:"status",children:[r.jsx("svg",{className:"drag-trash-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:r.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"})}),r.jsxs("span",{className:"drag-trash-copy",children:[r.jsx("span",{className:"drag-trash-text",children:t==="over"?r.jsxs(r.Fragment,{children:["Release to remove ",r.jsx("strong",{className:"drag-trash-name",children:s||"this card"})]}):"Drop here to remove from the board"}),r.jsx("span",{className:"drag-trash-hint",children:t==="over"?`${_n("The session list","L",a)} brings it back`:"The session keeps running"})]})]})}function Awe({canvasRef:e,bubbling:t,dragging:n,trash:s,zoom:a,viewport:o,stateRef:i,peek:l,children:u}){const{trashDragging:h,trashState:f,trashPhase:p,trashZoneRef:m,trashLabel:w}=s,{lod:b,lodRef:k}=a,{markCanvasInput:v}=o,{peekAgent:N,peekLabel:x,peekRecap:C,peekBounds:S}=l;return r.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${t?" bubbling":""}${n?" dragging-any":""}${h&&f==="over"?" trash-hover":""}`,"data-lod":b,ref:e,onMouseDownCapture:Ewe,onPointerDownCapture:v,onPointerUpCapture:v,onWheelCapture:v,onFocusCapture:_=>{const $=_.target;if(!OS($)||k.current==null||k.current==="detail")return;const A=$.getAttribute("data-id");A&&i.current.agents.has(A)&&$.matches(":focus-visible")&&n8(A,$,"focus")},onBlurCapture:_=>{var A,O;const $=(O=(A=_.target).getAttribute)==null?void 0:O.call(A,"data-id");$&&io($)},children:[u,Ja(p)&&r.jsx(Twe,{trashZoneRef:m,trashState:f,trashPhase:p,trashLabel:w}),r.jsx(hme,{agentFor:N,recapFor:C,labelFor:x,bounds:S})]})}function Rwe({restarting:e,restartMode:t,live:n,paused:s}){return r.jsxs("div",{className:"conn-banner",role:"alert",children:[r.jsx("span",{className:"conn-dot"}),e?t==="npx"?"Fetching the new version with npx — this can take a minute…":`Restarting ${Pt}…`:(()=>{const a=qY({connected:n,paused:s});return r.jsxs(r.Fragment,{children:[`Lost connection to the ${Pt} server. Reconnecting…`,a&&r.jsx("span",{className:"conn-sub",children:a})]})})()]})}function Mwe({oldName:e,version:t,dismissOldName:n}){return r.jsxs("div",{className:"ver-banner",role:"status",children:[r.jsx("span",{className:"ver-dot"}),r.jsxs("strong",{children:[e," still works — the deck is called ",Pt," now."]}),t!=null&&t.renameFix?r.jsx("span",{className:"ver-sub",children:t.renameFix}):null,r.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}const F8="Thanks — that helps.",$we=Array.from({length:11},(e,t)=>t);function Lwe(e){return e===0?"0 out of 10, not useful":e===10?"10 out of 10, extremely useful":`${e} out of 10`}const Iwe=6;function Owe(e){const t=g.useRef(null);return g.useLayoutEffect(()=>{const n=t.current,s=n==null?void 0:n.closest(".app");if(!n||!s)return;const a=()=>s.style.setProperty("--rating-h",`${Math.ceil(n.getBoundingClientRect().height)}px`);a();const o=typeof ResizeObserver>"u"?null:new ResizeObserver(a);return o==null||o.observe(n),()=>{o==null||o.disconnect(),s.style.removeProperty("--rating-h")}},[e]),t}function Pwe(){var e;(e=document.getElementById("canvas"))==null||e.focus()}function Dwe({phase:e,score:t,onAnswer:n,onLater:s,onClose:a,onFeedback:o,onHold:i}){const l=Owe(e),u=g.useRef(null),h=g.useRef(null),f=g.useRef(!1);g.useEffect(()=>{var m,w;e!=="thanks"||!f.current||(f.current=!1,Wn(((m=document.activeElement)==null?void 0:m.tagName)??null)&&((w=u.current??h.current)==null||w.focus()))},[e]);const p=m=>{var w;(w=l.current)!=null&&w.contains(document.activeElement)&&Pwe(),m()};return e==="thanks"?r.jsxs("div",{ref:l,className:"ver-banner note rating-banner",onFocus:()=>i(!0),onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||i(!1)},children:[r.jsx("span",{className:"ver-dot"}),r.jsx("strong",{children:F8}),t!==null&&t<=Iwe?r.jsx("button",{ref:u,type:"button",className:"ver-act",onClick:o,children:"Tell us what would make it better"}):null,r.jsx("button",{ref:h,type:"button","aria-label":"Dismiss",className:"ver-close",onClick:()=>p(a),children:"×"})]}):r.jsxs("div",{ref:l,className:"ver-banner note rating-banner",role:"group","aria-labelledby":"rating-question",children:[r.jsx("span",{className:"ver-dot"}),r.jsx("strong",{id:"rating-question",children:"How useful is ccdeck to you?"}),r.jsx("span",{className:"rating-scale",children:$we.map(m=>r.jsx("button",{type:"button",className:"rating-pick","aria-label":Lwe(m),onClick:w=>{f.current=w.detail===0||w.currentTarget.matches(":focus-visible"),n(m)},children:m},m))}),r.jsx("span",{className:"ver-sub rating-ends","aria-hidden":"true",children:"0 not at all · 10 extremely"}),r.jsx("button",{type:"button",className:"ver-act",onClick:()=>p(s),children:"Not now"})]})}const Fwe=3e4;function Bwe({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function qwe({bundle:e,running:t,pending:n,lastTried:s}){return t?Bwe({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Uwe(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function Wwe({asked:e,reported:t}){return t?t!==e:!1}function B8(e){const t=e.thresholdMs??Fwe;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 Hwe(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 zwe(e,t){return e?t==null?"auto when idle":`auto in ${Hwe(t)}`:"auto-restart off"}function RO(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Vwe(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 Gwe(e){const t=B8(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 Ej={git_checkout:"this deck runs from a git checkout — pull instead:",npx:"npx runs from a cache that cannot be upgraded in place — run:",one_off:"this deck runs from a one-off pnpm dlx, bunx or yarn dlx copy that cannot be upgraded in place — to keep one, 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 Kwe({notice:e,version:t,dismissNotice:n,upgradeState:s,startUpgrade:a,copyCommand:o,cmdCopied:i,autoRestart:l,toggleAutoRestart:u,askRestart:h,restartCopy:f,restartFuseMs:p,restarting:m}){var w,b,k;return r.jsxs("div",{className:`ver-banner ${e.kind}`,role:"status",children:[r.jsx("span",{className:`ver-dot${p==null?"":" armed"}`}),e.kind==="restart"?r.jsxs(r.Fragment,{children:[r.jsxs("strong",{children:["v",e.to," is installed — this deck still runs v",e.from,"."]}),t!=null&&t.canRestart?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:"ver-act",onClick:()=>h(),...Bn(m),title:`Stop this process and bring it back on the same port. The canvas replays from the event log.
|
|
117
117
|
|
|
118
|
-
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:m?"restarting…":f.label}),!m&&r.jsx("span",{className:"ver-sub",children:f.clause}),r.jsxs("label",{className:"ver-auto",children:[r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":l,onClick:u,"aria-label":"Auto-restart when idle",title:l?"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:r.jsx("span",{className:"switch-knob"})}),r.jsx("span",{"aria-hidden":!0,children:zwe(l,p)})]})]}):r.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."})]}):r.jsxs(r.Fragment,{children:[r.jsxs("strong",{children:[Pt," v",e.to," is out — you are on v",e.from,"."]}),(t==null?void 0:t.upgradeMode)==="install"&&s!=="failed"&&r.jsx("button",{type:"button",className:"ver-act",onClick:a,...Bn(s==="running",s==="done"),title:`Runs ${((w=t==null?void 0:t.upgrade)==null?void 0:w.command)??(t==null?void 0:t.command)??"npm i -g"} here, then restarts once nothing is running.`,children:s==="running"?"installing…":s==="done"?"installed":"Update now"}),(t==null?void 0:t.upgradeMode)==="npx"&&(t==null?void 0:t.canRestart)&&r.jsx("button",{type:"button",className:"ver-act",onClick:()=>h({upgrade:!0}),...Bn(m),title:`Runs ${t==null?void 0:t.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:m?"fetching…":s==="failed"?"Retry update":"Update & restart"}),s==="failed"?r.jsxs("span",{className:"ver-sub fail",title:((b=t==null?void 0:t.upgrade)==null?void 0:b.error)??"",children:[(t==null?void 0:t.upgradeMode)==="npx"?"update failed":"install failed",": ",((k=t==null?void 0:t.upgrade)==null?void 0:k.error)??"unknown error"," — run it yourself:"]}):(t==null?void 0:t.upgradeMode)==="npx"?r.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Ej.npx}):t!=null&&t.upgradeBlocked?r.jsx("span",{className:"ver-sub",children:Jt(Ej,t.upgradeBlocked)??"cannot install from here"}):null,r.jsxs("button",{type:"button",className:"ver-cmd",onClick:o,title:"Copy to clipboard",children:[r.jsx("code",{children:t==null?void 0:t.command}),r.jsx("span",{className:"ver-cmd-hint",children:i?"copied":"copy"})]})]}),r.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}function Ywe({restart:e,versionCheck:t,upgrade:n,oldNameNotice:s,rating:a,onFeedback:o,everConnected:i,live:l,paused:u}){const{autoRestart:h,toggleAutoRestart:f,restarting:p,restartMode:m,restartedTo:w,askRestart:b,restartCopy:k,restartFuseMs:v}=e,{version:N,notice:x,noticeOpen:C,dismissNotice:S}=t,{upgradeState:_,startUpgrade:$,copyCommand:A,cmdCopied:O}=n,{oldName:M,oldNameOpen:W,dismissOldName:B}=s,{ratingPhase:R,ratingScore:q,answerRating:T,rateLater:F,closeRating:D,holdThanks:K}=a,V=w?r.jsxs("div",{className:"ver-banner done",role:"status",children:[r.jsx("span",{className:"ver-dot"}),r.jsxs("strong",{children:["Restarted — now running v",w,"."]}),r.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):i&&!l?r.jsx(Rwe,{restarting:p,restartMode:m,live:l,paused:u}):C&&x?r.jsx(Kwe,{notice:x,version:N,dismissNotice:S,upgradeState:_,startUpgrade:$,copyCommand:A,cmdCopied:O,autoRestart:h,toggleAutoRestart:f,askRestart:b,restartCopy:k,restartFuseMs:v,restarting:p}):W&&M?r.jsx(Mwe,{oldName:M,version:N,dismissOldName:B}):R!=="hidden"?r.jsx(Dwe,{phase:R,score:q,onAnswer:T,onLater:F,onClose:D,onFeedback:o,onHold:K}):null;return r.jsxs(r.Fragment,{children:[V,r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:R==="thanks"?F8:""})]})}function Xwe(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function Zwe(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 Jwe(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function Qwe(e,t){const n=Jwe(e),s=(...i)=>[n?`${n} on the canvas`:null,...i,"layout, pins and selection"].filter(l=>l!==null),a="This cannot be undone.";if(!t)return{goes:s("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:a,confirm:"Clear everything"};if(!t.path)return{goes:s(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const i=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,l=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:s(),stays:[`the event log — ${i}${l}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:s("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const o=t.decks-1;return{goes:s(`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:a,confirm:"Clear everything"}}function exe({agentCount:e,onConfirm:t,onCancel:n}){const s=g.useRef(null),a=gt(n,{focusRef:s,layer:WG}),o=yt(n),[i,l]=g.useState(null);g.useEffect(()=>{let m=!1;return fetch("/api/clear").then(w=>w.ok?w.json():null).then(w=>{m||l(Zwe(w))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:h,final:f,confirm:p}=Qwe(e,i);return r.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:r.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("span",{className:"status-dot err","aria-hidden":!0}),r.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[r.jsxs("dl",{className:"cc-plan",children:[r.jsx("dt",{children:"Goes"}),r.jsx("dd",{children:u.map(m=>r.jsx("span",{children:m},m))}),r.jsx("dt",{children:"Stays"}),r.jsx("dd",{children:h.length>0?h.map(m=>r.jsx("span",{children:m},m)):r.jsx("span",{children:"nothing"})})]}),f&&r.jsx("p",{className:"cc-final",children:f}),r.jsxs("div",{className:"cc-actions",children:[r.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),r.jsx("button",{type:"button",className:"btn danger",onClick:t,children:p})]})]})]})})}function txe({kind:e,onChange:t}){return r.jsxs("fieldset",{className:"fb-kinds",children:[r.jsx("legend",{className:"vis-hidden",children:"Kind of feedback"}),Mp.map(n=>r.jsxs("label",{className:"fb-kind",children:[r.jsx("input",{type:"radio",name:"feedback-kind",value:n.value,checked:e===n.value,onChange:()=>t(n.value),onKeyDown:s=>{BS(s.nativeEvent)&&s.preventDefault()}}),n.label]},n.value))]})}const q8="fb-details";function nxe({open:e,onToggle:t}){return r.jsxs("button",{type:"button",className:"fb-tool fb-more","aria-expanded":e,"aria-controls":q8,onClick:t,children:[lye,r.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:r.jsx("path",{d:"M2.5 3.75 5 6.25l2.5-2.5"})})]})}function sxe({open:e,contact:t,onContact:n}){const s=g.useId();return r.jsx("div",{id:q8,className:"fb-details","data-open":e||void 0,children:r.jsx("div",{className:"fb-details-clip",children:r.jsxs("div",{className:"fb-details-body",children:[r.jsxs("div",{className:"fb-field",children:[r.jsxs("label",{className:"fb-field-label",htmlFor:"fb-contact",children:[cye,r.jsx("span",{className:"fb-optional",children:"optional"})]}),r.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:t,maxLength:k8,autoComplete:"email",placeholder:uye,"aria-describedby":s,onChange:a=>n(a.target.value),onKeyDown:a=>{BS(a.nativeEvent)&&a.preventDefault()}}),r.jsx("p",{id:s,className:"fb-hint",children:dye})]}),r.jsx("div",{className:"fb-where",children:hye.map(a=>r.jsx("p",{children:a},a))})]})})})}const ni=3,rxe=5*1024*1024,axe=12*1024*1024,Tj=8192,oxe=64*1024,ixe=256*1024,lxe=.92,cxe=640,U8=.9,uxe=.85,dxe=6,hxe=512*1024,Pp={png:"image/png",jpeg:"image/jpeg"},fxe={png:"png",jpeg:"jpg"},pxe=[137,80,78,71,13,10,26,10],mxe=[255,216,255];function W8(e){const t=n=>e.length>=n.length&&n.every((s,a)=>e[a]===s);return t(pxe)?"png":t(mxe)?"jpeg":null}function gxe(e){const t=W8(e);return t==="png"?yxe(e):t==="jpeg"?xxe(e):null}function yxe(e){const t=[73,72,68,82];if(e.length<24||!t.every((s,a)=>e[12+a]===s))return null;const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:n.getUint32(16),height:n.getUint32(20)}}function wxe(e){return e>=192&&e<=207&&e!==196&&e!==200&&e!==204}function xxe(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 s=e[t]<<8|e[t+1];if(s<2)return null;if(wxe(n))return t+7>e.length?null:{height:e[t+3]<<8|e[t+4],width:e[t+5]<<8|e[t+6]};t+=s}return null}function MO(e,t){return e.bytes>t||e.width>Tj||e.height>Tj}function vxe(e){return Math.min(rxe,axe-oxe-e)}function H8(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function bxe(e,t){const n=Tj/Math.max(e.width,e.height),s=e.bytes>t?Math.sqrt(t/e.bytes)*U8:1;return H8(e,Math.min(1,n,s))}async function kxe(e,t,n){let s=bxe(e,t),a=e.format;for(let o=0;o<dxe;o++){const i=await n(s,a,a==="jpeg"?lxe:void 0);if(!i)return null;if(i.size<=t)return{...s,blob:i,format:a};if(a==="png"){a="jpeg";continue}if(s=H8(s,Math.min(uxe,Math.sqrt(t/i.size)*U8)),Math.max(s.width,s.height)<cxe)return null}return null}async function jxe(e,t,n){const s=new Uint8Array(await e.slice(0,hxe).arrayBuffer()),a=W8(s);if(!a)return{ok:!1,problem:"type"};if(t<ixe)return{ok:!1,problem:"no_room"};const o=e.type===Pp[a]?e:new Blob([e],{type:Pp[a]}),i=gxe(s);if(i&&!MO({...i,bytes:e.size},t))return{ok:!0,blob:o,resized:null};const l=await n(e).catch(()=>null);if(!l)return{ok:!1,problem:"unreadable"};try{const u={width:l.width,height:l.height,bytes:e.size,format:a};if(!MO(u,t))return{ok:!0,blob:o,resized:null};const h=await kxe(u,t,l.encoder);return h?{ok:!0,blob:h.blob,resized:{width:h.width,height:h.height}}:{ok:!1,problem:"too_large"}}finally{l.release()}}function Nxe(e){return({width:t,height:n},s,a)=>new Promise(o=>{const i=document.createElement("canvas");i.width=t,i.height=n;const l=i.getContext("2d");if(!l)return o(null);s==="jpeg"&&(l.fillStyle="white",l.fillRect(0,0,t,n)),l.imageSmoothingQuality="high",l.drawImage(e,0,0,t,n),i.toBlob(u=>{i.width=0,i.height=0,o(u)},Pp[s],a)})}const Sxe=async e=>{const t=await createImageBitmap(e);return{width:t.width,height:t.height,encoder:Nxe(t),release:()=>t.close()}};function Cxe(e){return e.includes("Files")}function _xe({files:e,hasText:t,intoTextField:n}){return e>0&&(!t||!n)}function Exe(e,t){const n=e.indexOf(t);return e[n+1]??e[n-1]??null}function Txe(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((s,a)=>{const o=s.type===Pp.jpeg?"jpeg":"png";n.append("images",s,`image-${a+1}.${fxe[o]}`)}),{method:"POST",body:n}}const Axe="Add screenshot",$O="PNG or JPEG, up to three. You can also paste one, or drop it on this dialog.",Rxe="A screenshot can show emails, costs and paths. Crop out what should not be seen.",LO="Three images at most. Remove one to add another.",Mxe="An image could not be attached, so nothing was sent. Check the images and send again; your text is still here.";function $xe(e,t,n){const s=n?`, resized to ${n.width} × ${n.height} to fit`:"";return`Replace image ${e+1}: ${t}${s}`}function Lxe(e,t){const n=`${e} of ${ni}`;return t>0?`${n} · ${t} resized to fit`:n}function Ixe(e){return`Three images at most, so ${e===1?"one was":`${e} were`} left out.`}function Oxe(e){return`“${e.length>40?`${e.slice(0,30)}…${e.slice(-9)}`:e}”`}function Pxe(e,t){const n=Oxe(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 z8="image/png,image/jpeg";function V8({className:e="fb-glyph"}){return r.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:[r.jsx("rect",{x:"1.8",y:"2.4",width:"10.4",height:"9.2",rx:"1.6"}),r.jsx("circle",{cx:"5",cy:"5.6",r:"1"}),r.jsx("path",{d:"M2.4 10.4 5.5 7.6l2.1 1.8 1.5-1.3 2.5 2.2"})]})}function Dxe({images:e,buttonRef:t}){const n=g.useRef(null),s=e.shots.length>=ni;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:$O,"aria-describedby":"fb-attach-hint",onClick:()=>{var a;return s?e.sayFull():(a=n.current)==null?void 0:a.click()},children:[r.jsx(V8,{}),Axe]}),r.jsx("span",{id:"fb-attach-hint",hidden:!0,children:$O}),r.jsx("input",{ref:n,type:"file",accept:z8,multiple:!0,hidden:!0,onChange:a=>{e.add(Array.from(a.target.files??[])),a.target.value=""}})]})}function Fxe({images:e,addRef:t}){const n=g.useRef(new Map),s=g.useRef(null),a=g.useRef(null),o=g.useRef(null),[i,l]=g.useState(null),{shots:u}=e,h=Lxe(u.length,u.filter(m=>m.resized).length);g.useLayoutEffect(()=>{var m;i!==null&&((m=i==="add"?t.current:n.current.get(i))==null||m.focus(),l(null))},[i,t]),g.useEffect(()=>{var m;e.problem&&((m=s.current)==null||m.scrollIntoView({block:"nearest"}))},[e.problem,e.problemId]);function f(m){l(Exe(u.map(w=>w.id),m)??"add"),e.remove(m)}function p(m){var w;o.current=m,(w=a.current)==null||w.click()}return r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"vis-hidden",role:"status",children:e.announcement}),r.jsx("input",{ref:a,type:"file",accept:z8,hidden:!0,onChange:m=>{const w=o.current;w!==null&&e.replace(w,Array.from(m.target.files??[])),o.current=null,m.target.value=""}}),u.length>0&&r.jsxs("div",{className:"fb-shots",children:[r.jsxs("div",{className:"fb-shots-row",children:[r.jsx("ul",{className:"fb-shots-list",children:u.map((m,w)=>r.jsxs("li",{className:"fb-shot","data-fitting":m.blob?void 0:!0,children:[r.jsxs("button",{type:"button",className:"fb-shot-pick","aria-label":$xe(w,m.name,m.resized),onClick:()=>p(m.id),children:[r.jsx("img",{className:"fb-shot-img",src:m.url,alt:""}),m.blob?r.jsx("span",{className:"fb-shot-cue","aria-hidden":"true",children:"Replace"}):r.jsx("span",{className:"fb-shot-busy","aria-hidden":"true",children:"Resizing…"})]}),r.jsx("button",{ref:b=>{b?n.current.set(m.id,b):n.current.delete(m.id)},type:"button",className:"glyph-btn fb-shot-remove","aria-label":`Remove image ${w+1}`,title:`Remove image ${w+1}`,onClick:()=>f(m.id),children:r.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:r.jsx("path",{d:"M2.5 2.5 7.5 7.5M7.5 2.5 2.5 7.5"})})})]},m.id))}),r.jsx("span",{className:"fb-shots-count",children:h})]}),r.jsx("p",{className:"fb-hint",children:Rxe})]}),e.problem&&r.jsx("p",{ref:s,className:"fb-error",role:"alert",children:e.problem},e.problemId)]})}function Bxe(e,t){return e.map((n,s)=>({id:t+s,name:n.name,url:URL.createObjectURL(n.blob),blob:n.blob,resized:n.resized}))}function qxe(e,t,n){return n?e.map(s=>s.id===t.id?t:s):[...e,t]}function Uxe(e,t,n){return n?e.map(s=>s.id===t?n:s):e.filter(s=>s.id!==t)}function Wxe(e){const[t,n]=g.useState(()=>Bxe((e==null?void 0:e.ready)??[],1)),[s,a]=g.useState({problem:"",id:0}),o=g.useRef(0),i=g.useCallback(R=>{R&&o.current++,a(q=>R?{problem:R,id:q.id+1}:q.problem?{problem:"",id:q.id}:q)},[]),[l,u]=g.useState(""),h=g.useRef(t),f=g.useRef(null),p=g.useRef(t.length),m=g.useRef(!0),w=g.useRef(new Map),b=g.useRef([]),k=g.useRef(0),v=g.useCallback(R=>{h.current=R(h.current),n(h.current)},[]);g.useEffect(()=>(m.current=!0,()=>{m.current=!1;for(const R of h.current)URL.revokeObjectURL(R.url)}),[]);const N=g.useCallback(async(R,q)=>{const T=h.current.reduce((Z,z)=>{var X;return Z+(z.id===(q==null?void 0:q.id)?0:((X=z.blob)==null?void 0:X.size)??0)},0),F=(q==null?void 0:q.id)??++p.current,D=URL.createObjectURL(R),K={id:F,name:R.name||"image",url:D,blob:null,resized:null},V=k.current;w.current.set(F,R);let H=!1;const P=()=>{H||(H=!0,v(Z=>qxe(Z,K,q!==void 0)))},I=await jxe(R,vxe(T),async Z=>(P(),Sxe(Z))).catch(()=>({ok:!1,problem:"unreadable"})),U=h.current.some(Z=>Z.id===F);return!m.current||k.current!==V||!U&&(H||q)?(URL.revokeObjectURL(D),q&&URL.revokeObjectURL(q.url),m.current&&w.current.delete(F),""):(w.current.delete(F),I.ok?(P(),q&&URL.revokeObjectURL(q.url),v(Z=>Z.map(z=>z.id===F?{...z,blob:I.blob,resized:I.resized}:z)),""):(URL.revokeObjectURL(D),H&&v(Z=>Uxe(Z,F,q)),Pxe(I.problem,R.name||"image")))},[v]),x=g.useCallback(async R=>{i("");const q=k.current,T=[];let F=0,D=0;for(const V of R){if(!m.current||k.current!==q)return;const H=b.current.indexOf(V);if(H!==-1&&b.current.splice(H,1),h.current.length>=ni){F++;continue}const P=h.current.length,I=await N(V);I&&T.push(I),h.current.length>P&&D++}if(!m.current||k.current!==q)return;F>0&&T.push(D===0&&T.length===0?LO:Ixe(F)),i(T.join(" "));const K=h.current.length;D>0&&u(`${D===1?"Image":`${D} images`} added, ${K} of ${ni}.`)},[N,i]),C=g.useCallback(async(R,q)=>{i("");const T=h.current.find(K=>K.id===R);if(!T)return x([q]);const F=await N(q,T);if(!m.current)return;i(F);const D=h.current.findIndex(K=>K.id===R);!F&&D!==-1&&u(`Image ${D+1} replaced, ${h.current.length} of ${ni}.`)},[x,N,i]),S=g.useCallback(R=>{const q=k.current;f.current=(f.current??Promise.resolve()).then(()=>k.current===q?R():void 0).catch(()=>{})},[]),_=g.useCallback(R=>{R.length!==0&&(b.current.push(...R),S(()=>x(R)))},[x,S]);g.useEffect(()=>{e&&e.waiting.length>0&&_(e.waiting)},[]);const $=g.useCallback((R,q)=>{const T=q[0];T&&S(()=>C(R,T))},[S,C]),A=g.useCallback(R=>{const q=h.current.find(T=>T.id===R);q&&(URL.revokeObjectURL(q.url),w.current.delete(R),v(T=>T.filter(F=>F.id!==R)),i(""),u(`Image removed, ${h.current.length} of ${ni}.`))},[v,i]),O=g.useCallback(()=>i(LO),[i]),M=g.useCallback(async()=>{const R=o.current;return await f.current,o.current!==R?null:h.current.flatMap(q=>q.blob?[q.blob]:[])},[]),W=g.useCallback(()=>({ready:h.current.flatMap(R=>R.blob&&!w.current.has(R.id)?[{name:R.name,blob:R.blob,resized:R.resized}]:[]),waiting:[...w.current.values(),...b.current]}),[]),B=g.useCallback(()=>{k.current++;for(const R of h.current)URL.revokeObjectURL(R.url);w.current.clear(),b.current=[],v(()=>[]),i("")},[v,i]);return{shots:t,problem:s.problem,problemId:s.id,announcement:l,add:_,replace:$,remove:A,sayFull:O,ready:M,kept:W,clear:B}}function Hxe(){const[e,t]=g.useState(null);return g.useEffect(()=>{let n=!0;return fetch("/api/feedback").then(s=>s.ok?s.json():null).then(s=>{n&&t(nye(s))}).catch(()=>{}),()=>{n=!1}},[]),e}function zxe(e){const[t,n]=g.useState({state:"idle"}),s=g.useRef(!1),a=g.useRef(null);g.useEffect(()=>()=>{var l;return(l=a.current)==null?void 0:l.abort()},[]);async function o(l){if(!Cn(s.current))return;s.current=!0;const{signal:u}=a.current=new AbortController;n({state:"sending"});try{const h=await e.ready();if(u.aborted)return;if(!h){n({state:"failed",message:Mxe});return}const f=await fetch("/api/feedback",{...Txe(tye(l),h),signal:u}),p=await f.json().catch(()=>null);n(f.ok&&(p!=null&&p.ok)?{state:"sent"}:{state:"failed",message:kO(f.status,p==null?void 0:p.reason,p==null?void 0:p.errors)})}catch{u.aborted||n({state:"failed",message:kO(0,null)})}finally{s.current=!1}}const i=()=>n(l=>l.state==="failed"?{state:"idle"}:l);return{outcome:t,sending:t.state==="sending",send:o,clearFailure:i}}function Vxe(e,t){const[n,s]=g.useState(!1),a=g.useRef(t);return a.current=t,g.useEffect(()=>{if(!e)return;const o=window.setTimeout(()=>s(!0),jO),i=window.setTimeout(()=>a.current(),jO+yye);return()=>{window.clearTimeout(o),window.clearTimeout(i)}},[e]),n}const Y0="agent-dag.feedbackDrafts",IO=4;function Gxe({initialKind:e,initialBody:t}){return{kind:e??"bug",body:t??""}}function Kxe(e){return JSON.stringify([e.kind,e.body])}function Yxe(e){return e.ready.length+e.waiting.length}function G8(e,t){return e.body.trim()!==t.body.trim()||e.contact.trim()!==""||e.images>0}function Xxe(e){return e===1?"The screenshot was not kept through the page reload. Add it again to send it.":`The ${e} screenshots were not kept through the page reload. Add them again to send them.`}const Zxe="Discard",Jxe="Confirm discard",Qxe="Clear the message, the screenshots and the contact",OO="Press again to clear this draft. It cannot be brought back.",eve={ready:[],waiting:[]};function tve(e){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;const t=e[1];if(!t||typeof t!="object")return null;const{kind:n,body:s,contact:a,images:o}=t;return!Mp.some(i=>i.value===n)||typeof s!="string"||s.length>b8||typeof a!="string"||a.length>k8||typeof o!="number"||!Number.isInteger(o)||o<0||o>ni?null:[e[0],{kind:n,body:s,contact:a,images:o}]}function nve(e){let t=null;function n(){var o;if(t)return t;t=new Map;try{const i=(o=e())==null?void 0:o.getItem(Y0),l=i?JSON.parse(i):[];if(Array.isArray(l))for(const u of l.slice(-IO)){const h=tve(u);h&&t.set(h[0],{...h[1],images:null,imageCount:h[1].images})}}catch{}return t}function s(){try{const o=e();if(!o)return;const i=[...n()].map(([l,u])=>[l,{kind:u.kind,body:u.body,contact:u.contact,images:u.imageCount}]);i.length===0?o.removeItem(Y0):o.setItem(Y0,JSON.stringify(i))}catch{}}function a(o){n().delete(o)&&s()}return{read(o){const i=n().get(o);return i?{kind:i.kind,body:i.body,contact:i.contact,images:i.images??eve,imagesLost:i.images?0:i.imageCount}:null},keep(o,i,l){const u=Yxe(i.images);if(!G8({body:i.body,contact:i.contact,images:u},l)){a(o);return}const h=n();h.delete(o),h.set(o,{kind:i.kind,body:i.body,contact:i.contact,images:i.images,imageCount:u});for(const f of h.keys()){if(h.size<=IO)break;h.delete(f)}s()},forget:a}}function sve(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}const Aj=nve(sve),rve=4e3;function ave(e,t,n,s,a){const o=g.useRef(null);o.current={key:e,seed:t,words:n,images:s,sent:a};const i=g.useCallback(()=>{const l=o.current;!l||l.sent||Aj.keep(l.key,{...l.words,images:l.images.kept()},l.seed)},[]);g.useEffect(i,[i,n.kind,n.body,n.contact,s.shots]),g.useEffect(()=>i,[i]),g.useEffect(()=>{a&&Aj.forget(e)},[a,e])}const PO="draft";function ove(e){const[t,n]=g.useState(!1),s=g.useRef(0);g.useEffect(()=>{if(!t)return;const o=window.setTimeout(()=>n(!1),rve);return()=>window.clearTimeout(o)},[t]);function a(){const o=Date.now(),i=yi({armedFor:t?PO:null,target:PO,armedAt:s.current,now:o,gapMs:gi});if(i==="arm"){n(!0),s.current=o;return}i!=="ignore"&&(n(!1),e())}return{armed:t,press:a}}function K8({onClose:e,initialKind:t,initialBody:n}){const s=g.useRef(null),a=g.useRef(null),o=g.useRef(null),i=g.useRef(null),l=g.useRef(null),u=g.useRef(null),h=g.useRef(null),f=g.useRef(null),p=g.useRef(0),m=gt(e,{focusRef:s}),w=yt(e),b=Gxe({initialKind:t,initialBody:n}),k=Kxe(b),[v]=g.useState(()=>Aj.read(k)),[N,x]=g.useState((v==null?void 0:v.kind)??b.kind),[C,S]=g.useState((v==null?void 0:v.body)??b.body),[_,$]=g.useState((v==null?void 0:v.contact)??""),[A,O]=g.useState((v==null?void 0:v.imagesLost)??0),[M,W]=g.useState(!1),[B,R]=g.useState(!1),[q,T]=g.useState(!1),F=Wxe(v==null?void 0:v.images),D=aye(Hxe()),{outcome:K,sending:V,send:H,clearFailure:P}=zxe(F),I=K.state==="sent",U=Vxe(I,e);ave(k,b,{kind:N,body:C,contact:_},F,I);const Z=G8({body:C,contact:_,images:F.shots.length},b),z=ove(()=>{var xe;x(b.kind),S(b.body),$(""),O(0),R(!1),F.clear(),P(),(xe=s.current)==null||xe.focus()}),X=v8(N),Y=B&&!vO(C),J=A>0&&F.shots.length===0,Q=[Y&&"fb-body-error",J&&"fb-images-lost"].filter(Boolean).join(" ")||void 0,[te,le]=pye(ro());g.useEffect(()=>{var De,We;const xe=i.current;if(!xe)return;const Ie=xe.contains(document.activeElement)||Wn(((De=document.activeElement)==null?void 0:De.tagName)??null);xe.inert=I,I&&Ie&&((We=a.current)==null||We.focus())},[I]),g.useEffect(()=>{var Ke,ye;const xe=l.current;if(!xe)return;const Ie=h.current;if(V){const Fe=document.activeElement,$e=Fe!=null&&(xe.contains(Fe)||Fe===Ie);f.current=$e?Fe:null,xe.inert=!0,Ie&&(Ie.inert=!0),f.current&&((Ke=u.current)==null||Ke.focus());return}xe.inert=!1,Ie&&(Ie.inert=!1);const De=f.current;f.current=null;const We=document.activeElement===u.current||Wn(((ye=document.activeElement)==null?void 0:ye.tagName)??null);!I&&De&&We&&De.focus()},[V,I]);function de(xe){var Ie;if(xe.preventDefault(),!vO(C)){R(!0),(Ie=s.current)==null||Ie.focus();return}H({kind:N,body:C,contact:_})}const oe=!I&&!V,re=xe=>Cxe(Array.from(xe.dataTransfer.types));function he(xe){!re(xe)||!oe||(xe.preventDefault(),p.current++,T(!0))}function pe(xe){re(xe)&&(xe.preventDefault(),xe.dataTransfer.dropEffect=oe?"copy":"none")}function Le(xe){re(xe)&&(p.current=Math.max(0,p.current-1),p.current===0&&T(!1))}function ge(xe){re(xe)&&(xe.preventDefault(),p.current=0,T(!1),oe&&F.add(Array.from(xe.dataTransfer.files)))}function ve(xe){xe.target!==xe.currentTarget||!re(xe)||(xe.preventDefault(),xe.dataTransfer.dropEffect="none")}function je(xe){re(xe)&&xe.preventDefault()}function Ee(xe){if(!oe)return;const Ie=Array.from(xe.clipboardData.files),De=xe.target,We=De instanceof HTMLTextAreaElement||De instanceof HTMLInputElement,Ke=Array.from(xe.clipboardData.types).includes("text/plain");_xe({files:Ie.length,hasText:Ke,intoTextField:We})&&(xe.preventDefault(),F.add(Ie))}return r.jsx("div",{className:"modal-backdrop",...w,role:"presentation",onDragOver:ve,onDrop:je,"data-leaving":U||void 0,children:r.jsxs("div",{ref:m,className:"modal feedback-dialog",onClick:xe=>xe.stopPropagation(),onDragEnter:he,onDragOver:pe,onDragLeave:Le,onDrop:ge,onPaste:Ee,role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"feedback-title",className:"modal-tool-name",children:"Send feedback"})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{ref:a,type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),r.jsx("p",{className:"vis-hidden",role:"status",children:z.armed?OO:gye(K.state)}),r.jsxs("div",{className:"fb-stage",children:[r.jsxs("form",{ref:i,className:"fb-form",onSubmit:de,onKeyDown:xe=>{fye(xe.nativeEvent)&&(xe.preventDefault(),xe.currentTarget.requestSubmit())},noValidate:!0,children:[r.jsxs("section",{ref:l,className:"modal-body fb-body",children:[r.jsx(txe,{kind:N,onChange:x}),r.jsxs("div",{className:"fb-compose",children:[r.jsx("label",{className:"fb-label",htmlFor:"fb-body",children:X.question}),r.jsx("textarea",{ref:s,id:"fb-body",className:"ap-manage-input fb-message",value:C,maxLength:b8,rows:5,placeholder:X.placeholder,onChange:xe=>S(xe.target.value),"aria-invalid":Y||void 0,"aria-describedby":Q,required:!0}),Y&&r.jsx("p",{id:"fb-body-error",className:"fb-error",children:Zge}),r.jsx(Fxe,{images:F,addRef:o}),J&&r.jsx("p",{id:"fb-images-lost",className:"fb-hint",children:Xxe(A)}),r.jsxs("div",{className:"fb-tools",children:[r.jsx(Dxe,{images:F,buttonRef:o}),r.jsx(nxe,{open:M,onToggle:()=>W(xe=>!xe)})]}),r.jsx(sxe,{open:M,contact:_,onContact:$})]}),r.jsx("p",{className:"fb-facts",children:D?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"fb-facts-value",children:D})," — ",oye]}):iye}),K.state==="failed"&&r.jsx("p",{className:"fb-error",role:"alert",children:K.message})]}),r.jsxs("div",{className:"fb-foot",children:[Z&&r.jsx("button",{ref:h,type:"button",className:`btn danger fb-discard${z.armed?" armed":""}`,onKeyDown:xe=>{xe.repeat&&xe.preventDefault()},onClick:z.press,title:z.armed?OO:Qxe,children:z.armed?Jxe:Zxe}),r.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[r.jsx("kbd",{"data-symbol":mye(te)||void 0,children:te}),r.jsx("kbd",{children:le})," to send"]}),r.jsx("button",{type:"button",className:"btn",onClick:e,children:"Cancel"}),r.jsx("button",{ref:u,type:"submit",className:"btn primary fb-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...Bn(V),children:r.jsxs("span",{className:"fb-send-label",children:[r.jsx("span",{className:"fb-send-idle",children:"Send feedback"}),r.jsx("span",{className:"fb-send-busy",children:"Sending…"})]})})]})]}),I&&r.jsxs("div",{className:"fb-done",children:[r.jsx(Np,{}),r.jsx("p",{className:"fb-done-line",children:j8})]})]}),r.jsx("div",{className:"fb-drop","aria-hidden":"true","data-active":q||void 0,children:r.jsxs("div",{className:"fb-drop-frame",children:[r.jsx(V8,{className:"fb-drop-glyph"}),r.jsx("p",{className:"fb-drop-title",children:"Drop to attach"}),r.jsx("p",{className:"fb-drop-note",children:"PNG or JPEG, up to three"})]})})]})})}const Y8="Press Esc first if a key does nothing.",X0=[{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 — the session list (L) brings it back",binds:["Delete"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"Ctrl + Z",macCap:"⌘ Z",action:"undo a re-arrange, while the canvas offers it",binds:["z","Z"],chord:!0},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"Ctrl + K",macCap:"⌘ K",action:"search panels, sessions, settings, actions and themes",binds:["k","K"],chord:!0},{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:"I",action:"Jira, once it is connected in Settings › Integrations",binds:["i","I"],integration:"jira"},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"Ctrl + ,",macCap:"⌘ ,",action:"all settings",binds:[","],chord:!0},{cap:"V",action:"sound settings — the switch, and each tone's volume and sound",binds:["v","V"]},{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"next 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:[]}]}],ive=/ \([A-Z?]\)/g;function X8(e,t=()=>!0){const n=s=>s.integration===void 0||t(s.integration);return e&&X0.every(s=>s.rows.every(n))?X0:X0.map(s=>({...s,rows:s.rows.filter(n).filter(a=>e||a.chord||!a.binds.some(sD)).map(a=>e?a:{...a,action:a.action.replace(ive,"")})})).filter(s=>s.rows.length>0)}const lve="Single-key shortcuts are off.",Z8="Settings › Keyboard",cve=`Single-key shortcuts can be turned off in ${Z8}.`;function uve({onClose:e,onTour:t,onSettings:n}){const s=gt(e),a=yt(e),o=po(ro()),i=An(),l=$d(),u=X8(i,h=>ra(l,h));return r.jsx("div",{className:"modal-backdrop",...a,role:"presentation",children:r.jsxs("div",{ref:s,className:"modal key-help",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title","aria-describedby":i?void 0:"key-help-off",children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[!i&&r.jsxs("div",{className:"kh-off",children:[r.jsxs("p",{className:"kh-off-text",id:"key-help-off",children:[r.jsx("strong",{children:lve})," Turn them back on in"," ",r.jsx("span",{className:"kh-place",children:Z8}),". Everything below still works."]}),n&&r.jsx("button",{type:"button",className:"btn",onClick:n,children:"Open Settings"})]}),t&&r.jsxs("div",{className:"guide-door",children:[r.jsx("span",{children:"Eight pictures of what the deck shows."}),r.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),r.jsx("div",{className:"shortcuts",children:u.map(h=>r.jsxs(g.Fragment,{children:[r.jsx("h3",{className:"kh-group",children:h.title}),h.rows.map(f=>r.jsxs("div",{className:"sc",children:[r.jsx("kbd",{children:o&&f.macCap?f.macCap:f.cap}),r.jsx("span",{children:f.action})]},`${h.title}:${f.cap}:${f.action}`))]},h.title))}),i&&r.jsxs("p",{className:"kh-foot",children:[Y8," ",cve]})]})]})})}function dve(e,t){return`${e}#${t}`}function hve(e,{lan:t,now:n,closed:s}){if(t===void 0)return[];const a=[];for(const o of e??[]){const i=o.reauth;if(!i||i.dismissed||o.origin!=="ccdeck_signin")continue;const l=dve(i.key,i.since);if(s.has(l)||Soe(i.key,o.email,t,n))continue;const u=o.email??"";a.push({id:l,key:i.key,since:i.since,num:o.num,email:u,name:u||o.alias||`Account ${o.num}`,alias:u&&o.alias?o.alias:null})}return a}function fve(e,t){const n=String((t==null?void 0:t.email)??"").trim().toLowerCase();return n?e.filter(s=>s.email.toLowerCase()===n&&((t==null?void 0:t.num)==null||String(s.num)===String(t.num))).map(s=>s.id):[]}function J8({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function pve(e){return e===1?"Account needs your attention":"Accounts need your attention"}function mve(e){return`${e===1?"One Claude account needs":`${e} Claude accounts need`} you to sign in again.`}const gve="Login expired",yve="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.",wve="The account stays marked in the Accounts panel. This will not ask again until it has worked and stopped again.";function xve(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,o)=>(a.at??0)-(o.at??0));return{request:s[0],waiting:s.length-1}}function vve({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:o,onLater:i}){const l=g.useRef(null),u=gt(i,{focusRef:l}),h=yt(i),f=so(n,"accept"),p=so(n,"dismiss");return r.jsx("div",{className:"modal-backdrop",...h,role:"presentation",children:r.jsxs("div",{ref:u,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title","aria-describedby":"lan-ask-who",children:[r.jsxs("header",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("i",{className:"ap-pulse","aria-hidden":!0}),r.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:i,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[r.jsxs("p",{id:"lan-ask-who",className:"lan-ask-who",children:[r.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",r.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",lS(e.at,s)]}),r.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."}),r.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",r.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&&r.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.`}),r.jsxs("div",{className:"lan-ask-acts",children:[r.jsx("button",{type:"button",ref:l,className:"btn",disabled:p.disabled,"aria-busy":p.busy,onClick:o,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),r.jsx("button",{type:"button",className:"btn primary",disabled:f.disabled,"aria-busy":f.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function bve(e){const t=g.useRef(!1),n=kve(e),s=J8({rows:n?1:0,ours:t.current,dialogs:rn.dialogDepth()});return t.current=s,s?n:null}function kve({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:s,deferLanPair:a}){const{request:o,waiting:i}=xve(e,t.current);return o?r.jsx(vve,{request:o,waiting:i,busy:n,now:Date.now(),onAccept:()=>void s("accept",o.fp),onDecline:()=>void s("dismiss",o.fp),onLater:()=>a(o.fp)},o.fp):null}function jve({rows:e,onSignIn:t,onLater:n,firstRef:s}){const a=e.length===1?e[0]:null;return r.jsxs("section",{className:"modal-body",children:[a?r.jsxs(r.Fragment,{children:[r.jsxs("p",{id:"reauth-lead",className:"reauth-lead",children:["The Claude login for ",r.jsx("strong",{className:"reauth-name",children:a.name}),a.alias?r.jsxs("span",{className:"reauth-alias",children:[" (",a.alias,")"]}):null," ","has expired and needs a new sign","‑","in."]}),r.jsx("p",{className:"reauth-note",children:yve})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:mve(e.length)}),r.jsx("ul",{className:"reauth-list",children:e.map((o,i)=>r.jsxs("li",{className:"reauth-row",children:[r.jsxs("span",{className:"reauth-who",title:o.alias?`${o.alias} — ${o.name}`:o.name,children:[o.name,o.alias?r.jsxs("span",{className:"reauth-alias",children:[" ",o.alias]}):null]}),r.jsx("span",{className:"reauth-what",children:gve}),r.jsx("button",{type:"button",className:"btn",ref:i===0?s:void 0,"aria-label":`Sign in again as ${o.name}`,onClick:()=>t(o),children:"Sign in again"})]},o.id))}),r.jsx("p",{className:"reauth-note",children:"Each keeps its slot, its alias and its history."})]}),r.jsxs("div",{className:"reauth-acts",children:[r.jsx("button",{type:"button",className:"btn",title:wve,onClick:n,children:"Not now"}),a&&r.jsx("button",{type:"button",className:"btn primary",ref:s,onClick:()=>t(a),children:"Sign in again"})]})]})}function Nve({rows:e,onSignIn:t,onLater:n}){const s=g.useRef(null),a=gt(n,{focusRef:s}),o=yt(n);return r.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:r.jsxs("div",{ref:a,className:"modal reauth-ask",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"reauth-title","aria-describedby":"reauth-lead",children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"reauth-title",className:"modal-tool-name",children:pve(e.length)})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Not now (Esc)",title:"Not now (Esc)",children:"×"})})]}),r.jsx(jve,{rows:e,onSignIn:t,onLater:n,firstRef:s})]})})}function Sve({rows:e,signingIn:t,signIn:n,signedIn:s,refresh:a,closeSignIn:o,later:i,pairing:l=!1}){const u=g.useRef(!1),h=rn.dialogDepth()+(l?1:0),f=t!=null||J8({rows:e.length,ours:u.current,dialogs:h});return u.current=f,t?r.jsx(g6,{email:t.email||null,onClose:o,onChanged:a,onSignedIn:s}):f?r.jsx(Nve,{rows:e,onSignIn:n,onLater:i},e.length===1?"one":"many"):null}const Cve={"//":["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 one line the deck shows them, so it has to stand on","its own; `body` is the fuller account, kept here for the release text.","","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.4","3.36.5","3.36.6","3.36.7","3.36.8","3.36.9","3.37.0","3.38.0","3.38.1","3.38.2","3.38.6","3.39.4","3.40.1","3.41.3","3.43.1","3.43.3"],"3.48.0":[{title:"🗂️ Jira: move issues between sprints and the backlog",body:"On a Scrum board ordered by Rank, drag issues or use Move to reorder them or send them to another sprint or the backlog, one at a time or up to 50 together. Browsing still only reads."},{title:"🔎 The Jira list is easier to scan",body:"Titles keep more room, a row's preview no longer covers the next row, the issue key shows once in the detail, and Clear filters stays in reach on a phone."},{title:"⌨️ ccdeck tui keeps your Claude accounts on one screen over SSH",body:"Switch accounts, turn Auto-switch on or off, and sign an account in with a link you open in any browser, all from the terminal."},{title:"🎮 Machine shows NVIDIA GPU readings",body:"On Linux and Windows with nvidia-smi: each GPU's utilization, video memory, temperature and power."},{title:"👤 Claude accounts are quieter, and an expired login has a Sign in button",body:"Telemetry is a small shield explained on hover or focus, and an account whose login expired shows Sign in on its own row."},{title:"🩹 Fewer page errors from browser extensions and translation",body:"The Accounts panel recovers when an extension breaks its requests, and Local network keeps working while the browser translates the page."}],"3.47.0":[{title:"⌨️ Quick open: Cmd/Ctrl+K reaches any panel, setting, session or theme by name",body:"Type a few letters to open a panel, land on a setting inside Settings, jump to a session or switch the theme. It is also Search on the bar."},{title:"⚙️ Settings › Claude Code changes Claude Code's own settings from the deck",body:"Twelve settings in five groups, from auto memory and compaction to the Co-Authored-By credit and the update channel, written to your settings.json on this computer."},{title:"📡 Radar monitors all the time, and packet capture is one explained step",body:"There is no Start or Stop any more: Radar finds Claude Code's collector by itself. Where capture needs a permission, Allow packet capture once asks for it on your press only."},{title:"⏱️ Tool activity shows where the time went, and Skill activity who starts your skills",body:"Tool activity splits the turns' time between Claude, this machine and you. Skill activity shows how many skill uses Claude, Codex or you started, overall and per skill."},{title:"📊 Usage remembers how full each quota week ended, and names your Claude plan",body:"Under each 7-day bar a line says how full the last weeks were at their reset. The Claude quota card shows your plan beside its title, as the Codex card does."},{title:"🗂️ Stripes, dialogs and floating panels are organized more evenly",body:"The doors on both edge stripes sit in named groups, dialogs share one frame, and T switches the theme inside any dialog too."},{title:"🪟 The desktop app works on a first run without Node, and integrations got fixes",body:"Usage no longer needs npm, and Claude Code installed while the app is open is picked up. Jira and GitLab avatars load, and panels reopen where you left them."}],"3.46.0":[{title:"🔗 Jira, GitHub and GitLab panels are easier to read and navigate",body:"Jira rows show each issue's status, lists answer the arrow keys and fit a phone, and a failed refresh says “Not updated”."},{title:"📡 Radar finds more Claude Code processes on Linux",body:"It now sees Claude Code started from its versioned install folder, plus connection attempts that got no reply and the telemetry variables it was launched with."},{title:"🗺️ Plans are easier to follow on the session canvas",body:"A session's plan now shows on its note and as “plan 2/5” at every zoom. Subagents line up in one column, closer to their parent."},{title:"✅ The active account follows your Claude Code login",body:"After a /login, the accounts panel, Switch, Auto-switch and Usage use the account Claude Code is signed in to. Auto-switch can now be set up while it is off."},{title:"📊 Account capacity and the Reset calendar have their own buttons",body:"Both open from the left stripe, under Claude accounts, instead of from the small gauge in the accounts panel's header."},{title:"🧩 Skill activity has its own button and counts typed skills",body:"It opens from the right stripe. To count skills you start with a slash command, the deck now adds a UserPromptExpansion hook to Claude Code's settings.json (2.1.116 or newer); AGENTS_DECK_SKILL_HOOK=0 leaves it out."},{title:"📈 Load history keeps the reading you click",body:"Click a minute on a chart to keep its reading. Saved limit resets now show their expiry time, and Tool activity has a clearer icon."}],"3.45.0":[{title:"🔗 Read-only Jira, GitHub and GitLab panels beside your agents",body:"Settings › Integrations connects Jira (Cloud, Server or Data Center), GitHub, and GitLab.com or your own GitLab, each with a token, and a control on the left stripe opens its panel: a Jira board's backlog in Jira's own order, or a project's branches, pull or merge requests, pipelines and issues, with the item beside the list. The panels only read: they never comment, merge, re-run a job or change an issue. The token stays on this machine, in a file only you can read, and goes only to that connection's own API. Nothing is read until you connect a tracker, and then only while its panel is open."},{title:"📤 Each account says what its organization's telemetry sends",body:"A Team or Enterprise organization can turn on Claude Code's telemetry for every member, and Claude Code applies it without asking. Each account of such an organization now carries a line under its name: “Telemetry · usage data”, or “Telemetry · prompts, tool details” in the warning colour when your prompts and tool details are sent too. Its tooltip names the organization and where the data goes. After a switch, Auto-switch's notification and the row's “Now active” note say it too. The deck changes nothing; it learns what the organization turns on from a Claude Code session run on one of its accounts, and until then that account shows no line."},{title:"⚠️ A warning when a paired deck is on the same Claude login",body:"A Claude login renews once, so when two machines use one copied login, the one that renews second is signed out. When a paired deck on Local network says it is on the login this deck is using, the live account's row now says “Also active on” and names that deck, with what to do: use a different account on one of the machines, or sign in on each one separately. A switch onto such a login says so too, and so does one desktop notification per incident, “Login active on another deck” in Settings › Notifications, which is on by default."},{title:"📱 A phone opens one panel at most when the deck loads",body:"On a window 640 px wide or less, a reload used to open Accounts, Usage and the machine panel on top of each other, with none of the board in sight. It now opens at most one of them, preferring Usage over the machine panel, and Accounts and the session list open from the dock. A wider window loads exactly as before, and nothing you chose is forgotten."}],"3.44.0":[{title:"⛔ A turn that stops on an error now shows as stopped",body:"When Claude Code ends a turn on an API error, such as an expired login or a usage limit, it sends StopFailure instead of Stop. The deck now adds StopFailure to the hooks it writes in Claude Code's settings.json, but only when every Claude Code it finds is 2.1.78 or newer; with an older one, or one whose version it cannot read, nothing changes. The card then says “Stopped · login expired”, “Stopped · usage limit” or “Stopped · API error”, and the sessions one expired login stops together arrive as one notification that names them. Each needs a “continue” once a working login is active."},{title:"🔑 Auto-switch leaves an expired login, and nothing switches onto one",body:"When Claude Code has signed a login out and claude-swap's saved copy is dead too, Auto-switch now moves to another account under your home and weekly-reset rules, and its notification says why. Neither Auto-switch nor Switch moves onto a login that is already known to be expired: that account's row says its login expired, with Sign in again, and nothing moves."},{title:"💲 Usage totals say how complete they are",body:"The usage headline is always shown now, by the rule History and the model table already used: an exact total when every cost is known, a known $0 included; the known part with “+” when some tokens could not be priced; and “not priced”, never a bare $0, when no cost is known. Sessions whose cost is a known zero show it too."},{title:"📡 Radar: a resizable inspector, prompt previews and a JSON view",body:"Radar's inspector can be resized and shows prompt previews, highlights and each record as a JSON tree, beside the File view. Settings › Radar has a new Monitor automatically switch. It is off, so Radar still watches only after you press Start, as before; turn it on to have the deck start monitoring by itself."},{title:"🧰 Tool activity opens over the deck, with the first tool's details open",body:"Tool activity now opens as a dialog over the deck instead of a page of its own, with the first tool selected and its details beside the list. Escape closes the details first, then the dialog. On a phone the details open as a sheet."},{title:"🧩 Tool activity counts skills, and the slash commands you type if you opt in",body:"Tool activity's Skills tab ranks the skills your Claude Code and Codex agents used. Counting the slash commands you type needs Claude Code's UserPromptExpansion hook, which the deck adds to settings.json only when you start it with AGENTS_DECK_SKILL_HOOK=1 and every Claude Code it finds is 2.1.116 or newer. Without that variable nothing in settings.json changes."},{title:"▶️ Continue a background session that stopped",body:"A background session that stopped on an error has a Continue button on its card and panel: the deck stops it if Claude Code still lists it, then resumes it in its own folder with “Continue from where you left off.” Continue stopped background sessions, in Settings › General, presses it for you once per stop. It is off until you turn it on."},{title:"⌨️ ccdeck commands for your terminal",body:"ccdeck accounts, ccdeck switch, ccdeck usage, ccdeck sessions and ccdeck open work from any terminal. ccdeck switch --best goes where Auto-switch would, and every switch follows the deck's own rules. Over SSH, ccdeck open prints the line that opens the deck on your own computer. Each command takes --json for scripts."}],"3.43.4":[{title:"🔐 Local network no longer sends the login a deck is signed in to",body:`Two machines on one Claude login race to renew it, and the one that renews second is signed out with “Login expired”. So paired decks no longer receive the login a deck is signed in to right now. Every other login you tick is shared as before, and this one goes out once the deck switches to another account.
|
|
118
|
+
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:m?"restarting…":f.label}),!m&&r.jsx("span",{className:"ver-sub",children:f.clause}),r.jsxs("label",{className:"ver-auto",children:[r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":l,onClick:u,"aria-label":"Auto-restart when idle",title:l?"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:r.jsx("span",{className:"switch-knob"})}),r.jsx("span",{"aria-hidden":!0,children:zwe(l,p)})]})]}):r.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."})]}):r.jsxs(r.Fragment,{children:[r.jsxs("strong",{children:[Pt," v",e.to," is out — you are on v",e.from,"."]}),(t==null?void 0:t.upgradeMode)==="install"&&s!=="failed"&&r.jsx("button",{type:"button",className:"ver-act",onClick:a,...Bn(s==="running",s==="done"),title:`Runs ${((w=t==null?void 0:t.upgrade)==null?void 0:w.command)??(t==null?void 0:t.command)??"npm i -g"} here, then restarts once nothing is running.`,children:s==="running"?"installing…":s==="done"?"installed":"Update now"}),(t==null?void 0:t.upgradeMode)==="npx"&&(t==null?void 0:t.canRestart)&&r.jsx("button",{type:"button",className:"ver-act",onClick:()=>h({upgrade:!0}),...Bn(m),title:`Runs ${t==null?void 0:t.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`,children:m?"fetching…":s==="failed"?"Retry update":"Update & restart"}),s==="failed"?r.jsxs("span",{className:"ver-sub fail",title:((b=t==null?void 0:t.upgrade)==null?void 0:b.error)??"",children:[(t==null?void 0:t.upgradeMode)==="npx"?"update failed":"install failed",": ",((k=t==null?void 0:t.upgrade)==null?void 0:k.error)??"unknown error"," — run it yourself:"]}):(t==null?void 0:t.upgradeMode)==="npx"?r.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?"npx cannot upgrade in place, so the deck re-runs:":Ej.npx}):t!=null&&t.upgradeBlocked?r.jsx("span",{className:"ver-sub",children:Jt(Ej,t.upgradeBlocked)??"cannot install from here"}):null,r.jsxs("button",{type:"button",className:"ver-cmd",onClick:o,title:"Copy to clipboard",children:[r.jsx("code",{children:t==null?void 0:t.command}),r.jsx("span",{className:"ver-cmd-hint",children:i?"copied":"copy"})]})]}),r.jsx("button",{type:"button","aria-label":"Dismiss",className:"ver-close",onClick:n,children:"×"})]})}function Ywe({restart:e,versionCheck:t,upgrade:n,oldNameNotice:s,rating:a,onFeedback:o,everConnected:i,live:l,paused:u}){const{autoRestart:h,toggleAutoRestart:f,restarting:p,restartMode:m,restartedTo:w,askRestart:b,restartCopy:k,restartFuseMs:v}=e,{version:N,notice:x,noticeOpen:C,dismissNotice:S}=t,{upgradeState:_,startUpgrade:$,copyCommand:A,cmdCopied:O}=n,{oldName:M,oldNameOpen:W,dismissOldName:B}=s,{ratingPhase:R,ratingScore:q,answerRating:T,rateLater:F,closeRating:D,holdThanks:K}=a,V=w?r.jsxs("div",{className:"ver-banner done",role:"status",children:[r.jsx("span",{className:"ver-dot"}),r.jsxs("strong",{children:["Restarted — now running v",w,"."]}),r.jsx("span",{className:"ver-sub",children:"The canvas replayed from the event log."})]}):i&&!l?r.jsx(Rwe,{restarting:p,restartMode:m,live:l,paused:u}):C&&x?r.jsx(Kwe,{notice:x,version:N,dismissNotice:S,upgradeState:_,startUpgrade:$,copyCommand:A,cmdCopied:O,autoRestart:h,toggleAutoRestart:f,askRestart:b,restartCopy:k,restartFuseMs:v,restarting:p}):W&&M?r.jsx(Mwe,{oldName:M,version:N,dismissOldName:B}):R!=="hidden"?r.jsx(Dwe,{phase:R,score:q,onAnswer:T,onLater:F,onClose:D,onFeedback:o,onHold:K}):null;return r.jsxs(r.Fragment,{children:[V,r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:R==="thanks"?F8:""})]})}function Xwe(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function Zwe(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 Jwe(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function Qwe(e,t){const n=Jwe(e),s=(...i)=>[n?`${n} on the canvas`:null,...i,"layout, pins and selection"].filter(l=>l!==null),a="This cannot be undone.";if(!t)return{goes:s("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:a,confirm:"Clear everything"};if(!t.path)return{goes:s(),stays:[],final:`This deck keeps no event log, so nothing on disk changes — and nothing can bring the canvas back. ${a}`,confirm:"Clear everything"};if(!t.mine){const i=t.ownerPort===null?"another running deck owns that file":`the deck on port ${t.ownerPort} owns that file`,l=t.decks>2?`, one of ${t.decks} decks sharing it`:"";return{goes:s(),stays:[`the event log — ${i}${l}`,"restart this deck and the log replays back onto it"],final:null,confirm:"Clear this canvas"}}if(t.decks<=1)return{goes:s("this deck's event log — the file a restarted deck replays to rebuild what you see"),stays:[],final:a,confirm:"Clear everything"};const o=t.decks-1;return{goes:s(`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:a,confirm:"Clear everything"}}function exe({agentCount:e,onConfirm:t,onCancel:n}){const s=g.useRef(null),a=gt(n,{focusRef:s,layer:WG}),o=yt(n),[i,l]=g.useState(null);g.useEffect(()=>{let m=!1;return fetch("/api/clear").then(w=>w.ok?w.json():null).then(w=>{m||l(Zwe(w))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:h,final:f,confirm:p}=Qwe(e,i);return r.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:r.jsxs("div",{ref:a,className:"modal clear-confirm",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("span",{className:"status-dot err","aria-hidden":!0}),r.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:"Clear the deck?"})]}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Cancel (Esc)",title:"Cancel (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[r.jsxs("dl",{className:"cc-plan",children:[r.jsx("dt",{children:"Goes"}),r.jsx("dd",{children:u.map(m=>r.jsx("span",{children:m},m))}),r.jsx("dt",{children:"Stays"}),r.jsx("dd",{children:h.length>0?h.map(m=>r.jsx("span",{children:m},m)):r.jsx("span",{children:"nothing"})})]}),f&&r.jsx("p",{className:"cc-final",children:f}),r.jsxs("div",{className:"cc-actions",children:[r.jsx("button",{type:"button",ref:s,className:"btn",onClick:n,children:"Cancel"}),r.jsx("button",{type:"button",className:"btn danger",onClick:t,children:p})]})]})]})})}function txe({kind:e,onChange:t}){return r.jsxs("fieldset",{className:"fb-kinds",children:[r.jsx("legend",{className:"vis-hidden",children:"Kind of feedback"}),Mp.map(n=>r.jsxs("label",{className:"fb-kind",children:[r.jsx("input",{type:"radio",name:"feedback-kind",value:n.value,checked:e===n.value,onChange:()=>t(n.value),onKeyDown:s=>{BS(s.nativeEvent)&&s.preventDefault()}}),n.label]},n.value))]})}const q8="fb-details";function nxe({open:e,onToggle:t}){return r.jsxs("button",{type:"button",className:"fb-tool fb-more","aria-expanded":e,"aria-controls":q8,onClick:t,children:[lye,r.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:r.jsx("path",{d:"M2.5 3.75 5 6.25l2.5-2.5"})})]})}function sxe({open:e,contact:t,onContact:n}){const s=g.useId();return r.jsx("div",{id:q8,className:"fb-details","data-open":e||void 0,children:r.jsx("div",{className:"fb-details-clip",children:r.jsxs("div",{className:"fb-details-body",children:[r.jsxs("div",{className:"fb-field",children:[r.jsxs("label",{className:"fb-field-label",htmlFor:"fb-contact",children:[cye,r.jsx("span",{className:"fb-optional",children:"optional"})]}),r.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:t,maxLength:k8,autoComplete:"email",placeholder:uye,"aria-describedby":s,onChange:a=>n(a.target.value),onKeyDown:a=>{BS(a.nativeEvent)&&a.preventDefault()}}),r.jsx("p",{id:s,className:"fb-hint",children:dye})]}),r.jsx("div",{className:"fb-where",children:hye.map(a=>r.jsx("p",{children:a},a))})]})})})}const ni=3,rxe=5*1024*1024,axe=12*1024*1024,Tj=8192,oxe=64*1024,ixe=256*1024,lxe=.92,cxe=640,U8=.9,uxe=.85,dxe=6,hxe=512*1024,Pp={png:"image/png",jpeg:"image/jpeg"},fxe={png:"png",jpeg:"jpg"},pxe=[137,80,78,71,13,10,26,10],mxe=[255,216,255];function W8(e){const t=n=>e.length>=n.length&&n.every((s,a)=>e[a]===s);return t(pxe)?"png":t(mxe)?"jpeg":null}function gxe(e){const t=W8(e);return t==="png"?yxe(e):t==="jpeg"?xxe(e):null}function yxe(e){const t=[73,72,68,82];if(e.length<24||!t.every((s,a)=>e[12+a]===s))return null;const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:n.getUint32(16),height:n.getUint32(20)}}function wxe(e){return e>=192&&e<=207&&e!==196&&e!==200&&e!==204}function xxe(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 s=e[t]<<8|e[t+1];if(s<2)return null;if(wxe(n))return t+7>e.length?null:{height:e[t+3]<<8|e[t+4],width:e[t+5]<<8|e[t+6]};t+=s}return null}function MO(e,t){return e.bytes>t||e.width>Tj||e.height>Tj}function vxe(e){return Math.min(rxe,axe-oxe-e)}function H8(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function bxe(e,t){const n=Tj/Math.max(e.width,e.height),s=e.bytes>t?Math.sqrt(t/e.bytes)*U8:1;return H8(e,Math.min(1,n,s))}async function kxe(e,t,n){let s=bxe(e,t),a=e.format;for(let o=0;o<dxe;o++){const i=await n(s,a,a==="jpeg"?lxe:void 0);if(!i)return null;if(i.size<=t)return{...s,blob:i,format:a};if(a==="png"){a="jpeg";continue}if(s=H8(s,Math.min(uxe,Math.sqrt(t/i.size)*U8)),Math.max(s.width,s.height)<cxe)return null}return null}async function jxe(e,t,n){const s=new Uint8Array(await e.slice(0,hxe).arrayBuffer()),a=W8(s);if(!a)return{ok:!1,problem:"type"};if(t<ixe)return{ok:!1,problem:"no_room"};const o=e.type===Pp[a]?e:new Blob([e],{type:Pp[a]}),i=gxe(s);if(i&&!MO({...i,bytes:e.size},t))return{ok:!0,blob:o,resized:null};const l=await n(e).catch(()=>null);if(!l)return{ok:!1,problem:"unreadable"};try{const u={width:l.width,height:l.height,bytes:e.size,format:a};if(!MO(u,t))return{ok:!0,blob:o,resized:null};const h=await kxe(u,t,l.encoder);return h?{ok:!0,blob:h.blob,resized:{width:h.width,height:h.height}}:{ok:!1,problem:"too_large"}}finally{l.release()}}function Nxe(e){return({width:t,height:n},s,a)=>new Promise(o=>{const i=document.createElement("canvas");i.width=t,i.height=n;const l=i.getContext("2d");if(!l)return o(null);s==="jpeg"&&(l.fillStyle="white",l.fillRect(0,0,t,n)),l.imageSmoothingQuality="high",l.drawImage(e,0,0,t,n),i.toBlob(u=>{i.width=0,i.height=0,o(u)},Pp[s],a)})}const Sxe=async e=>{const t=await createImageBitmap(e);return{width:t.width,height:t.height,encoder:Nxe(t),release:()=>t.close()}};function Cxe(e){return e.includes("Files")}function _xe({files:e,hasText:t,intoTextField:n}){return e>0&&(!t||!n)}function Exe(e,t){const n=e.indexOf(t);return e[n+1]??e[n-1]??null}function Txe(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((s,a)=>{const o=s.type===Pp.jpeg?"jpeg":"png";n.append("images",s,`image-${a+1}.${fxe[o]}`)}),{method:"POST",body:n}}const Axe="Add screenshot",$O="PNG or JPEG, up to three. You can also paste one, or drop it on this dialog.",Rxe="A screenshot can show emails, costs and paths. Crop out what should not be seen.",LO="Three images at most. Remove one to add another.",Mxe="An image could not be attached, so nothing was sent. Check the images and send again; your text is still here.";function $xe(e,t,n){const s=n?`, resized to ${n.width} × ${n.height} to fit`:"";return`Replace image ${e+1}: ${t}${s}`}function Lxe(e,t){const n=`${e} of ${ni}`;return t>0?`${n} · ${t} resized to fit`:n}function Ixe(e){return`Three images at most, so ${e===1?"one was":`${e} were`} left out.`}function Oxe(e){return`“${e.length>40?`${e.slice(0,30)}…${e.slice(-9)}`:e}”`}function Pxe(e,t){const n=Oxe(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 z8="image/png,image/jpeg";function V8({className:e="fb-glyph"}){return r.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:[r.jsx("rect",{x:"1.8",y:"2.4",width:"10.4",height:"9.2",rx:"1.6"}),r.jsx("circle",{cx:"5",cy:"5.6",r:"1"}),r.jsx("path",{d:"M2.4 10.4 5.5 7.6l2.1 1.8 1.5-1.3 2.5 2.2"})]})}function Dxe({images:e,buttonRef:t}){const n=g.useRef(null),s=e.shots.length>=ni;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:$O,"aria-describedby":"fb-attach-hint",onClick:()=>{var a;return s?e.sayFull():(a=n.current)==null?void 0:a.click()},children:[r.jsx(V8,{}),Axe]}),r.jsx("span",{id:"fb-attach-hint",hidden:!0,children:$O}),r.jsx("input",{ref:n,type:"file",accept:z8,multiple:!0,hidden:!0,onChange:a=>{e.add(Array.from(a.target.files??[])),a.target.value=""}})]})}function Fxe({images:e,addRef:t}){const n=g.useRef(new Map),s=g.useRef(null),a=g.useRef(null),o=g.useRef(null),[i,l]=g.useState(null),{shots:u}=e,h=Lxe(u.length,u.filter(m=>m.resized).length);g.useLayoutEffect(()=>{var m;i!==null&&((m=i==="add"?t.current:n.current.get(i))==null||m.focus(),l(null))},[i,t]),g.useEffect(()=>{var m;e.problem&&((m=s.current)==null||m.scrollIntoView({block:"nearest"}))},[e.problem,e.problemId]);function f(m){l(Exe(u.map(w=>w.id),m)??"add"),e.remove(m)}function p(m){var w;o.current=m,(w=a.current)==null||w.click()}return r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"vis-hidden",role:"status",children:e.announcement}),r.jsx("input",{ref:a,type:"file",accept:z8,hidden:!0,onChange:m=>{const w=o.current;w!==null&&e.replace(w,Array.from(m.target.files??[])),o.current=null,m.target.value=""}}),u.length>0&&r.jsxs("div",{className:"fb-shots",children:[r.jsxs("div",{className:"fb-shots-row",children:[r.jsx("ul",{className:"fb-shots-list",children:u.map((m,w)=>r.jsxs("li",{className:"fb-shot","data-fitting":m.blob?void 0:!0,children:[r.jsxs("button",{type:"button",className:"fb-shot-pick","aria-label":$xe(w,m.name,m.resized),onClick:()=>p(m.id),children:[r.jsx("img",{className:"fb-shot-img",src:m.url,alt:""}),m.blob?r.jsx("span",{className:"fb-shot-cue","aria-hidden":"true",children:"Replace"}):r.jsx("span",{className:"fb-shot-busy","aria-hidden":"true",children:"Resizing…"})]}),r.jsx("button",{ref:b=>{b?n.current.set(m.id,b):n.current.delete(m.id)},type:"button",className:"glyph-btn fb-shot-remove","aria-label":`Remove image ${w+1}`,title:`Remove image ${w+1}`,onClick:()=>f(m.id),children:r.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:r.jsx("path",{d:"M2.5 2.5 7.5 7.5M7.5 2.5 2.5 7.5"})})})]},m.id))}),r.jsx("span",{className:"fb-shots-count",children:h})]}),r.jsx("p",{className:"fb-hint",children:Rxe})]}),e.problem&&r.jsx("p",{ref:s,className:"fb-error",role:"alert",children:e.problem},e.problemId)]})}function Bxe(e,t){return e.map((n,s)=>({id:t+s,name:n.name,url:URL.createObjectURL(n.blob),blob:n.blob,resized:n.resized}))}function qxe(e,t,n){return n?e.map(s=>s.id===t.id?t:s):[...e,t]}function Uxe(e,t,n){return n?e.map(s=>s.id===t?n:s):e.filter(s=>s.id!==t)}function Wxe(e){const[t,n]=g.useState(()=>Bxe((e==null?void 0:e.ready)??[],1)),[s,a]=g.useState({problem:"",id:0}),o=g.useRef(0),i=g.useCallback(R=>{R&&o.current++,a(q=>R?{problem:R,id:q.id+1}:q.problem?{problem:"",id:q.id}:q)},[]),[l,u]=g.useState(""),h=g.useRef(t),f=g.useRef(null),p=g.useRef(t.length),m=g.useRef(!0),w=g.useRef(new Map),b=g.useRef([]),k=g.useRef(0),v=g.useCallback(R=>{h.current=R(h.current),n(h.current)},[]);g.useEffect(()=>(m.current=!0,()=>{m.current=!1;for(const R of h.current)URL.revokeObjectURL(R.url)}),[]);const N=g.useCallback(async(R,q)=>{const T=h.current.reduce((Z,z)=>{var X;return Z+(z.id===(q==null?void 0:q.id)?0:((X=z.blob)==null?void 0:X.size)??0)},0),F=(q==null?void 0:q.id)??++p.current,D=URL.createObjectURL(R),K={id:F,name:R.name||"image",url:D,blob:null,resized:null},V=k.current;w.current.set(F,R);let H=!1;const P=()=>{H||(H=!0,v(Z=>qxe(Z,K,q!==void 0)))},I=await jxe(R,vxe(T),async Z=>(P(),Sxe(Z))).catch(()=>({ok:!1,problem:"unreadable"})),U=h.current.some(Z=>Z.id===F);return!m.current||k.current!==V||!U&&(H||q)?(URL.revokeObjectURL(D),q&&URL.revokeObjectURL(q.url),m.current&&w.current.delete(F),""):(w.current.delete(F),I.ok?(P(),q&&URL.revokeObjectURL(q.url),v(Z=>Z.map(z=>z.id===F?{...z,blob:I.blob,resized:I.resized}:z)),""):(URL.revokeObjectURL(D),H&&v(Z=>Uxe(Z,F,q)),Pxe(I.problem,R.name||"image")))},[v]),x=g.useCallback(async R=>{i("");const q=k.current,T=[];let F=0,D=0;for(const V of R){if(!m.current||k.current!==q)return;const H=b.current.indexOf(V);if(H!==-1&&b.current.splice(H,1),h.current.length>=ni){F++;continue}const P=h.current.length,I=await N(V);I&&T.push(I),h.current.length>P&&D++}if(!m.current||k.current!==q)return;F>0&&T.push(D===0&&T.length===0?LO:Ixe(F)),i(T.join(" "));const K=h.current.length;D>0&&u(`${D===1?"Image":`${D} images`} added, ${K} of ${ni}.`)},[N,i]),C=g.useCallback(async(R,q)=>{i("");const T=h.current.find(K=>K.id===R);if(!T)return x([q]);const F=await N(q,T);if(!m.current)return;i(F);const D=h.current.findIndex(K=>K.id===R);!F&&D!==-1&&u(`Image ${D+1} replaced, ${h.current.length} of ${ni}.`)},[x,N,i]),S=g.useCallback(R=>{const q=k.current;f.current=(f.current??Promise.resolve()).then(()=>k.current===q?R():void 0).catch(()=>{})},[]),_=g.useCallback(R=>{R.length!==0&&(b.current.push(...R),S(()=>x(R)))},[x,S]);g.useEffect(()=>{e&&e.waiting.length>0&&_(e.waiting)},[]);const $=g.useCallback((R,q)=>{const T=q[0];T&&S(()=>C(R,T))},[S,C]),A=g.useCallback(R=>{const q=h.current.find(T=>T.id===R);q&&(URL.revokeObjectURL(q.url),w.current.delete(R),v(T=>T.filter(F=>F.id!==R)),i(""),u(`Image removed, ${h.current.length} of ${ni}.`))},[v,i]),O=g.useCallback(()=>i(LO),[i]),M=g.useCallback(async()=>{const R=o.current;return await f.current,o.current!==R?null:h.current.flatMap(q=>q.blob?[q.blob]:[])},[]),W=g.useCallback(()=>({ready:h.current.flatMap(R=>R.blob&&!w.current.has(R.id)?[{name:R.name,blob:R.blob,resized:R.resized}]:[]),waiting:[...w.current.values(),...b.current]}),[]),B=g.useCallback(()=>{k.current++;for(const R of h.current)URL.revokeObjectURL(R.url);w.current.clear(),b.current=[],v(()=>[]),i("")},[v,i]);return{shots:t,problem:s.problem,problemId:s.id,announcement:l,add:_,replace:$,remove:A,sayFull:O,ready:M,kept:W,clear:B}}function Hxe(){const[e,t]=g.useState(null);return g.useEffect(()=>{let n=!0;return fetch("/api/feedback").then(s=>s.ok?s.json():null).then(s=>{n&&t(nye(s))}).catch(()=>{}),()=>{n=!1}},[]),e}function zxe(e){const[t,n]=g.useState({state:"idle"}),s=g.useRef(!1),a=g.useRef(null);g.useEffect(()=>()=>{var l;return(l=a.current)==null?void 0:l.abort()},[]);async function o(l){if(!Cn(s.current))return;s.current=!0;const{signal:u}=a.current=new AbortController;n({state:"sending"});try{const h=await e.ready();if(u.aborted)return;if(!h){n({state:"failed",message:Mxe});return}const f=await fetch("/api/feedback",{...Txe(tye(l),h),signal:u}),p=await f.json().catch(()=>null);n(f.ok&&(p!=null&&p.ok)?{state:"sent"}:{state:"failed",message:kO(f.status,p==null?void 0:p.reason,p==null?void 0:p.errors)})}catch{u.aborted||n({state:"failed",message:kO(0,null)})}finally{s.current=!1}}const i=()=>n(l=>l.state==="failed"?{state:"idle"}:l);return{outcome:t,sending:t.state==="sending",send:o,clearFailure:i}}function Vxe(e,t){const[n,s]=g.useState(!1),a=g.useRef(t);return a.current=t,g.useEffect(()=>{if(!e)return;const o=window.setTimeout(()=>s(!0),jO),i=window.setTimeout(()=>a.current(),jO+yye);return()=>{window.clearTimeout(o),window.clearTimeout(i)}},[e]),n}const Y0="agent-dag.feedbackDrafts",IO=4;function Gxe({initialKind:e,initialBody:t}){return{kind:e??"bug",body:t??""}}function Kxe(e){return JSON.stringify([e.kind,e.body])}function Yxe(e){return e.ready.length+e.waiting.length}function G8(e,t){return e.body.trim()!==t.body.trim()||e.contact.trim()!==""||e.images>0}function Xxe(e){return e===1?"The screenshot was not kept through the page reload. Add it again to send it.":`The ${e} screenshots were not kept through the page reload. Add them again to send them.`}const Zxe="Discard",Jxe="Confirm discard",Qxe="Clear the message, the screenshots and the contact",OO="Press again to clear this draft. It cannot be brought back.",eve={ready:[],waiting:[]};function tve(e){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;const t=e[1];if(!t||typeof t!="object")return null;const{kind:n,body:s,contact:a,images:o}=t;return!Mp.some(i=>i.value===n)||typeof s!="string"||s.length>b8||typeof a!="string"||a.length>k8||typeof o!="number"||!Number.isInteger(o)||o<0||o>ni?null:[e[0],{kind:n,body:s,contact:a,images:o}]}function nve(e){let t=null;function n(){var o;if(t)return t;t=new Map;try{const i=(o=e())==null?void 0:o.getItem(Y0),l=i?JSON.parse(i):[];if(Array.isArray(l))for(const u of l.slice(-IO)){const h=tve(u);h&&t.set(h[0],{...h[1],images:null,imageCount:h[1].images})}}catch{}return t}function s(){try{const o=e();if(!o)return;const i=[...n()].map(([l,u])=>[l,{kind:u.kind,body:u.body,contact:u.contact,images:u.imageCount}]);i.length===0?o.removeItem(Y0):o.setItem(Y0,JSON.stringify(i))}catch{}}function a(o){n().delete(o)&&s()}return{read(o){const i=n().get(o);return i?{kind:i.kind,body:i.body,contact:i.contact,images:i.images??eve,imagesLost:i.images?0:i.imageCount}:null},keep(o,i,l){const u=Yxe(i.images);if(!G8({body:i.body,contact:i.contact,images:u},l)){a(o);return}const h=n();h.delete(o),h.set(o,{kind:i.kind,body:i.body,contact:i.contact,images:i.images,imageCount:u});for(const f of h.keys()){if(h.size<=IO)break;h.delete(f)}s()},forget:a}}function sve(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}const Aj=nve(sve),rve=4e3;function ave(e,t,n,s,a){const o=g.useRef(null);o.current={key:e,seed:t,words:n,images:s,sent:a};const i=g.useCallback(()=>{const l=o.current;!l||l.sent||Aj.keep(l.key,{...l.words,images:l.images.kept()},l.seed)},[]);g.useEffect(i,[i,n.kind,n.body,n.contact,s.shots]),g.useEffect(()=>i,[i]),g.useEffect(()=>{a&&Aj.forget(e)},[a,e])}const PO="draft";function ove(e){const[t,n]=g.useState(!1),s=g.useRef(0);g.useEffect(()=>{if(!t)return;const o=window.setTimeout(()=>n(!1),rve);return()=>window.clearTimeout(o)},[t]);function a(){const o=Date.now(),i=yi({armedFor:t?PO:null,target:PO,armedAt:s.current,now:o,gapMs:gi});if(i==="arm"){n(!0),s.current=o;return}i!=="ignore"&&(n(!1),e())}return{armed:t,press:a}}function K8({onClose:e,initialKind:t,initialBody:n}){const s=g.useRef(null),a=g.useRef(null),o=g.useRef(null),i=g.useRef(null),l=g.useRef(null),u=g.useRef(null),h=g.useRef(null),f=g.useRef(null),p=g.useRef(0),m=gt(e,{focusRef:s}),w=yt(e),b=Gxe({initialKind:t,initialBody:n}),k=Kxe(b),[v]=g.useState(()=>Aj.read(k)),[N,x]=g.useState((v==null?void 0:v.kind)??b.kind),[C,S]=g.useState((v==null?void 0:v.body)??b.body),[_,$]=g.useState((v==null?void 0:v.contact)??""),[A,O]=g.useState((v==null?void 0:v.imagesLost)??0),[M,W]=g.useState(!1),[B,R]=g.useState(!1),[q,T]=g.useState(!1),F=Wxe(v==null?void 0:v.images),D=aye(Hxe()),{outcome:K,sending:V,send:H,clearFailure:P}=zxe(F),I=K.state==="sent",U=Vxe(I,e);ave(k,b,{kind:N,body:C,contact:_},F,I);const Z=G8({body:C,contact:_,images:F.shots.length},b),z=ove(()=>{var xe;x(b.kind),S(b.body),$(""),O(0),R(!1),F.clear(),P(),(xe=s.current)==null||xe.focus()}),X=v8(N),Y=B&&!vO(C),J=A>0&&F.shots.length===0,Q=[Y&&"fb-body-error",J&&"fb-images-lost"].filter(Boolean).join(" ")||void 0,[te,le]=pye(ro());g.useEffect(()=>{var De,We;const xe=i.current;if(!xe)return;const Ie=xe.contains(document.activeElement)||Wn(((De=document.activeElement)==null?void 0:De.tagName)??null);xe.inert=I,I&&Ie&&((We=a.current)==null||We.focus())},[I]),g.useEffect(()=>{var Ke,ye;const xe=l.current;if(!xe)return;const Ie=h.current;if(V){const Fe=document.activeElement,$e=Fe!=null&&(xe.contains(Fe)||Fe===Ie);f.current=$e?Fe:null,xe.inert=!0,Ie&&(Ie.inert=!0),f.current&&((Ke=u.current)==null||Ke.focus());return}xe.inert=!1,Ie&&(Ie.inert=!1);const De=f.current;f.current=null;const We=document.activeElement===u.current||Wn(((ye=document.activeElement)==null?void 0:ye.tagName)??null);!I&&De&&We&&De.focus()},[V,I]);function de(xe){var Ie;if(xe.preventDefault(),!vO(C)){R(!0),(Ie=s.current)==null||Ie.focus();return}H({kind:N,body:C,contact:_})}const oe=!I&&!V,re=xe=>Cxe(Array.from(xe.dataTransfer.types));function he(xe){!re(xe)||!oe||(xe.preventDefault(),p.current++,T(!0))}function pe(xe){re(xe)&&(xe.preventDefault(),xe.dataTransfer.dropEffect=oe?"copy":"none")}function Le(xe){re(xe)&&(p.current=Math.max(0,p.current-1),p.current===0&&T(!1))}function ge(xe){re(xe)&&(xe.preventDefault(),p.current=0,T(!1),oe&&F.add(Array.from(xe.dataTransfer.files)))}function ve(xe){xe.target!==xe.currentTarget||!re(xe)||(xe.preventDefault(),xe.dataTransfer.dropEffect="none")}function je(xe){re(xe)&&xe.preventDefault()}function Ee(xe){if(!oe)return;const Ie=Array.from(xe.clipboardData.files),De=xe.target,We=De instanceof HTMLTextAreaElement||De instanceof HTMLInputElement,Ke=Array.from(xe.clipboardData.types).includes("text/plain");_xe({files:Ie.length,hasText:Ke,intoTextField:We})&&(xe.preventDefault(),F.add(Ie))}return r.jsx("div",{className:"modal-backdrop",...w,role:"presentation",onDragOver:ve,onDrop:je,"data-leaving":U||void 0,children:r.jsxs("div",{ref:m,className:"modal feedback-dialog",onClick:xe=>xe.stopPropagation(),onDragEnter:he,onDragOver:pe,onDragLeave:Le,onDrop:ge,onPaste:Ee,role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"feedback-title",className:"modal-tool-name",children:"Send feedback"})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{ref:a,type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),r.jsx("p",{className:"vis-hidden",role:"status",children:z.armed?OO:gye(K.state)}),r.jsxs("div",{className:"fb-stage",children:[r.jsxs("form",{ref:i,className:"fb-form",onSubmit:de,onKeyDown:xe=>{fye(xe.nativeEvent)&&(xe.preventDefault(),xe.currentTarget.requestSubmit())},noValidate:!0,children:[r.jsxs("section",{ref:l,className:"modal-body fb-body",children:[r.jsx(txe,{kind:N,onChange:x}),r.jsxs("div",{className:"fb-compose",children:[r.jsx("label",{className:"fb-label",htmlFor:"fb-body",children:X.question}),r.jsx("textarea",{ref:s,id:"fb-body",className:"ap-manage-input fb-message",value:C,maxLength:b8,rows:5,placeholder:X.placeholder,onChange:xe=>S(xe.target.value),"aria-invalid":Y||void 0,"aria-describedby":Q,required:!0}),Y&&r.jsx("p",{id:"fb-body-error",className:"fb-error",children:Zge}),r.jsx(Fxe,{images:F,addRef:o}),J&&r.jsx("p",{id:"fb-images-lost",className:"fb-hint",children:Xxe(A)}),r.jsxs("div",{className:"fb-tools",children:[r.jsx(Dxe,{images:F,buttonRef:o}),r.jsx(nxe,{open:M,onToggle:()=>W(xe=>!xe)})]}),r.jsx(sxe,{open:M,contact:_,onContact:$})]}),r.jsx("p",{className:"fb-facts",children:D?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"fb-facts-value",children:D})," — ",oye]}):iye}),K.state==="failed"&&r.jsx("p",{className:"fb-error",role:"alert",children:K.message})]}),r.jsxs("div",{className:"fb-foot",children:[Z&&r.jsx("button",{ref:h,type:"button",className:`btn danger fb-discard${z.armed?" armed":""}`,onKeyDown:xe=>{xe.repeat&&xe.preventDefault()},onClick:z.press,title:z.armed?OO:Qxe,children:z.armed?Jxe:Zxe}),r.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[r.jsx("kbd",{"data-symbol":mye(te)||void 0,children:te}),r.jsx("kbd",{children:le})," to send"]}),r.jsx("button",{type:"button",className:"btn",onClick:e,children:"Cancel"}),r.jsx("button",{ref:u,type:"submit",className:"btn primary fb-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...Bn(V),children:r.jsxs("span",{className:"fb-send-label",children:[r.jsx("span",{className:"fb-send-idle",children:"Send feedback"}),r.jsx("span",{className:"fb-send-busy",children:"Sending…"})]})})]})]}),I&&r.jsxs("div",{className:"fb-done",children:[r.jsx(Np,{}),r.jsx("p",{className:"fb-done-line",children:j8})]})]}),r.jsx("div",{className:"fb-drop","aria-hidden":"true","data-active":q||void 0,children:r.jsxs("div",{className:"fb-drop-frame",children:[r.jsx(V8,{className:"fb-drop-glyph"}),r.jsx("p",{className:"fb-drop-title",children:"Drop to attach"}),r.jsx("p",{className:"fb-drop-note",children:"PNG or JPEG, up to three"})]})})]})})}const Y8="Press Esc first if a key does nothing.",X0=[{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 — the session list (L) brings it back",binds:["Delete"]},{cap:"R",action:"re-arrange the canvas and drop the pins",binds:["r","R"]},{cap:"Ctrl + Z",macCap:"⌘ Z",action:"undo a re-arrange, while the canvas offers it",binds:["z","Z"],chord:!0},{cap:"C",action:"clear the canvas and the event log — asks first",binds:["c","C"]}]},{title:"Panels and dialogs",rows:[{cap:"Ctrl + K",macCap:"⌘ K",action:"search panels, sessions, settings, actions and themes",binds:["k","K"],chord:!0},{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:"I",action:"Jira, once it is connected in Settings › Integrations",binds:["i","I"],integration:"jira"},{cap:"?",action:"this sheet",binds:["?"]}]},{title:"Settings",rows:[{cap:"Ctrl + ,",macCap:"⌘ ,",action:"all settings",binds:[","],chord:!0},{cap:"V",action:"sound settings — the switch, and each tone's volume and sound",binds:["v","V"]},{cap:"M",action:"sound on or off",binds:["m","M"]},{cap:"T",action:"next 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:[]}]}],ive=/ \([A-Z?]\)/g;function X8(e,t=()=>!0){const n=s=>s.integration===void 0||t(s.integration);return e&&X0.every(s=>s.rows.every(n))?X0:X0.map(s=>({...s,rows:s.rows.filter(n).filter(a=>e||a.chord||!a.binds.some(sD)).map(a=>e?a:{...a,action:a.action.replace(ive,"")})})).filter(s=>s.rows.length>0)}const lve="Single-key shortcuts are off.",Z8="Settings › Keyboard",cve=`Single-key shortcuts can be turned off in ${Z8}.`;function uve({onClose:e,onTour:t,onSettings:n}){const s=gt(e),a=yt(e),o=po(ro()),i=An(),l=$d(),u=X8(i,h=>ra(l,h));return r.jsx("div",{className:"modal-backdrop",...a,role:"presentation",children:r.jsxs("div",{ref:s,className:"modal key-help",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title","aria-describedby":i?void 0:"key-help-off",children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:"Keyboard shortcuts"})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[!i&&r.jsxs("div",{className:"kh-off",children:[r.jsxs("p",{className:"kh-off-text",id:"key-help-off",children:[r.jsx("strong",{children:lve})," Turn them back on in"," ",r.jsx("span",{className:"kh-place",children:Z8}),". Everything below still works."]}),n&&r.jsx("button",{type:"button",className:"btn",onClick:n,children:"Open Settings"})]}),t&&r.jsxs("div",{className:"guide-door",children:[r.jsx("span",{children:"Eight pictures of what the deck shows."}),r.jsx("button",{type:"button",className:"btn",onClick:t,children:"Take the tour"})]}),r.jsx("div",{className:"shortcuts",children:u.map(h=>r.jsxs(g.Fragment,{children:[r.jsx("h3",{className:"kh-group",children:h.title}),h.rows.map(f=>r.jsxs("div",{className:"sc",children:[r.jsx("kbd",{children:o&&f.macCap?f.macCap:f.cap}),r.jsx("span",{children:f.action})]},`${h.title}:${f.cap}:${f.action}`))]},h.title))}),i&&r.jsxs("p",{className:"kh-foot",children:[Y8," ",cve]})]})]})})}function dve(e,t){return`${e}#${t}`}function hve(e,{lan:t,now:n,closed:s}){if(t===void 0)return[];const a=[];for(const o of e??[]){const i=o.reauth;if(!i||i.dismissed||o.origin!=="ccdeck_signin")continue;const l=dve(i.key,i.since);if(s.has(l)||Soe(i.key,o.email,t,n))continue;const u=o.email??"";a.push({id:l,key:i.key,since:i.since,num:o.num,email:u,name:u||o.alias||`Account ${o.num}`,alias:u&&o.alias?o.alias:null})}return a}function fve(e,t){const n=String((t==null?void 0:t.email)??"").trim().toLowerCase();return n?e.filter(s=>s.email.toLowerCase()===n&&((t==null?void 0:t.num)==null||String(s.num)===String(t.num))).map(s=>s.id):[]}function J8({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function pve(e){return e===1?"Account needs your attention":"Accounts need your attention"}function mve(e){return`${e===1?"One Claude account needs":`${e} Claude accounts need`} you to sign in again.`}const gve="Login expired",yve="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.",wve="The account stays marked in the Accounts panel. This will not ask again until it has worked and stopped again.";function xve(e,t){const n=(e??[]).filter(a=>a&&typeof a.fp=="string"&&!t.has(a.fp));if(!n.length)return{request:null,waiting:0};const s=[...n].sort((a,o)=>(a.at??0)-(o.at??0));return{request:s[0],waiting:s.length-1}}function vve({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:o,onLater:i}){const l=g.useRef(null),u=gt(i,{focusRef:l}),h=yt(i),f=so(n,"accept"),p=so(n,"dismiss");return r.jsx("div",{className:"modal-backdrop",...h,role:"presentation",children:r.jsxs("div",{ref:u,className:"modal lan-ask",onClick:m=>m.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title","aria-describedby":"lan-ask-who",children:[r.jsxs("header",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("i",{className:"ap-pulse","aria-hidden":!0}),r.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:"A deck wants to pair"})]}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:i,"aria-label":"Answer later (Esc)",title:"Answer later (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[r.jsxs("p",{id:"lan-ask-who",className:"lan-ask-who",children:[r.jsx("strong",{className:"lan-ask-name",children:e.name})," at ",r.jsx("code",{className:"ap-lan-code",children:e.addr})," · asked ",lS(e.at,s)]}),r.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."}),r.jsxs("p",{className:"lan-ask-fp",children:["Its fingerprint is ",r.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&&r.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.`}),r.jsxs("div",{className:"lan-ask-acts",children:[r.jsx("button",{type:"button",ref:l,className:"btn",disabled:p.disabled,"aria-busy":p.busy,onClick:o,title:"Nothing is shared. If that deck asks again, this comes back.",children:n==="dismiss"?"declining…":"Decline"}),r.jsx("button",{type:"button",className:"btn primary",disabled:f.disabled,"aria-busy":f.busy,onClick:a,title:"Talk to this deck from now on, and repair its expired logins with this deck's own.",children:n==="accept"?"accepting…":"Accept"})]})]})]})})}function bve(e){const t=g.useRef(!1),n=kve(e),s=J8({rows:n?1:0,ours:t.current,dialogs:rn.dialogDepth()});return t.current=s,s?n:null}function kve({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:s,deferLanPair:a}){const{request:o,waiting:i}=xve(e,t.current);return o?r.jsx(vve,{request:o,waiting:i,busy:n,now:Date.now(),onAccept:()=>void s("accept",o.fp),onDecline:()=>void s("dismiss",o.fp),onLater:()=>a(o.fp)},o.fp):null}function jve({rows:e,onSignIn:t,onLater:n,firstRef:s}){const a=e.length===1?e[0]:null;return r.jsxs("section",{className:"modal-body",children:[a?r.jsxs(r.Fragment,{children:[r.jsxs("p",{id:"reauth-lead",className:"reauth-lead",children:["The Claude login for ",r.jsx("strong",{className:"reauth-name",children:a.name}),a.alias?r.jsxs("span",{className:"reauth-alias",children:[" (",a.alias,")"]}):null," ","has expired and needs a new sign","‑","in."]}),r.jsx("p",{className:"reauth-note",children:yve})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:mve(e.length)}),r.jsx("ul",{className:"reauth-list",children:e.map((o,i)=>r.jsxs("li",{className:"reauth-row",children:[r.jsxs("span",{className:"reauth-who",title:o.alias?`${o.alias} — ${o.name}`:o.name,children:[o.name,o.alias?r.jsxs("span",{className:"reauth-alias",children:[" ",o.alias]}):null]}),r.jsx("span",{className:"reauth-what",children:gve}),r.jsx("button",{type:"button",className:"btn",ref:i===0?s:void 0,"aria-label":`Sign in again as ${o.name}`,onClick:()=>t(o),children:"Sign in again"})]},o.id))}),r.jsx("p",{className:"reauth-note",children:"Each keeps its slot, its alias and its history."})]}),r.jsxs("div",{className:"reauth-acts",children:[r.jsx("button",{type:"button",className:"btn",title:wve,onClick:n,children:"Not now"}),a&&r.jsx("button",{type:"button",className:"btn primary",ref:s,onClick:()=>t(a),children:"Sign in again"})]})]})}function Nve({rows:e,onSignIn:t,onLater:n}){const s=g.useRef(null),a=gt(n,{focusRef:s}),o=yt(n);return r.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:r.jsxs("div",{ref:a,className:"modal reauth-ask",onClick:i=>i.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"reauth-title","aria-describedby":"reauth-lead",children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"reauth-title",className:"modal-tool-name",children:pve(e.length)})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":"Not now (Esc)",title:"Not now (Esc)",children:"×"})})]}),r.jsx(jve,{rows:e,onSignIn:t,onLater:n,firstRef:s})]})})}function Sve({rows:e,signingIn:t,signIn:n,signedIn:s,refresh:a,closeSignIn:o,later:i,pairing:l=!1}){const u=g.useRef(!1),h=rn.dialogDepth()+(l?1:0),f=t!=null||J8({rows:e.length,ours:u.current,dialogs:h});return u.current=f,t?r.jsx(g6,{email:t.email||null,onClose:o,onChanged:a,onSignedIn:s}):f?r.jsx(Nve,{rows:e,onSignIn:n,onLater:i},e.length===1?"one":"many"):null}const Cve={"//":["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 one line the deck shows them, so it has to stand on","its own; `body` is the fuller account, kept here for the release text.","","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.4","3.36.5","3.36.6","3.36.7","3.36.8","3.36.9","3.37.0","3.38.0","3.38.1","3.38.2","3.38.6","3.39.4","3.40.1","3.41.3","3.43.1","3.43.3","3.48.1"],"3.48.0":[{title:"🗂️ Jira: move issues between sprints and the backlog",body:"On a Scrum board ordered by Rank, drag issues or use Move to reorder them or send them to another sprint or the backlog, one at a time or up to 50 together. Browsing still only reads."},{title:"🔎 The Jira list is easier to scan",body:"Titles keep more room, a row's preview no longer covers the next row, the issue key shows once in the detail, and Clear filters stays in reach on a phone."},{title:"⌨️ ccdeck tui keeps your Claude accounts on one screen over SSH",body:"Switch accounts, turn Auto-switch on or off, and sign an account in with a link you open in any browser, all from the terminal."},{title:"🎮 Machine shows NVIDIA GPU readings",body:"On Linux and Windows with nvidia-smi: each GPU's utilization, video memory, temperature and power."},{title:"👤 Claude accounts are quieter, and an expired login has a Sign in button",body:"Telemetry is a small shield explained on hover or focus, and an account whose login expired shows Sign in on its own row."},{title:"🩹 Fewer page errors from browser extensions and translation",body:"The Accounts panel recovers when an extension breaks its requests, and Local network keeps working while the browser translates the page."}],"3.47.0":[{title:"⌨️ Quick open: Cmd/Ctrl+K reaches any panel, setting, session or theme by name",body:"Type a few letters to open a panel, land on a setting inside Settings, jump to a session or switch the theme. It is also Search on the bar."},{title:"⚙️ Settings › Claude Code changes Claude Code's own settings from the deck",body:"Twelve settings in five groups, from auto memory and compaction to the Co-Authored-By credit and the update channel, written to your settings.json on this computer."},{title:"📡 Radar monitors all the time, and packet capture is one explained step",body:"There is no Start or Stop any more: Radar finds Claude Code's collector by itself. Where capture needs a permission, Allow packet capture once asks for it on your press only."},{title:"⏱️ Tool activity shows where the time went, and Skill activity who starts your skills",body:"Tool activity splits the turns' time between Claude, this machine and you. Skill activity shows how many skill uses Claude, Codex or you started, overall and per skill."},{title:"📊 Usage remembers how full each quota week ended, and names your Claude plan",body:"Under each 7-day bar a line says how full the last weeks were at their reset. The Claude quota card shows your plan beside its title, as the Codex card does."},{title:"🗂️ Stripes, dialogs and floating panels are organized more evenly",body:"The doors on both edge stripes sit in named groups, dialogs share one frame, and T switches the theme inside any dialog too."},{title:"🪟 The desktop app works on a first run without Node, and integrations got fixes",body:"Usage no longer needs npm, and Claude Code installed while the app is open is picked up. Jira and GitLab avatars load, and panels reopen where you left them."}],"3.46.0":[{title:"🔗 Jira, GitHub and GitLab panels are easier to read and navigate",body:"Jira rows show each issue's status, lists answer the arrow keys and fit a phone, and a failed refresh says “Not updated”."},{title:"📡 Radar finds more Claude Code processes on Linux",body:"It now sees Claude Code started from its versioned install folder, plus connection attempts that got no reply and the telemetry variables it was launched with."},{title:"🗺️ Plans are easier to follow on the session canvas",body:"A session's plan now shows on its note and as “plan 2/5” at every zoom. Subagents line up in one column, closer to their parent."},{title:"✅ The active account follows your Claude Code login",body:"After a /login, the accounts panel, Switch, Auto-switch and Usage use the account Claude Code is signed in to. Auto-switch can now be set up while it is off."},{title:"📊 Account capacity and the Reset calendar have their own buttons",body:"Both open from the left stripe, under Claude accounts, instead of from the small gauge in the accounts panel's header."},{title:"🧩 Skill activity has its own button and counts typed skills",body:"It opens from the right stripe. To count skills you start with a slash command, the deck now adds a UserPromptExpansion hook to Claude Code's settings.json (2.1.116 or newer); AGENTS_DECK_SKILL_HOOK=0 leaves it out."},{title:"📈 Load history keeps the reading you click",body:"Click a minute on a chart to keep its reading. Saved limit resets now show their expiry time, and Tool activity has a clearer icon."}],"3.45.0":[{title:"🔗 Read-only Jira, GitHub and GitLab panels beside your agents",body:"Settings › Integrations connects Jira (Cloud, Server or Data Center), GitHub, and GitLab.com or your own GitLab, each with a token, and a control on the left stripe opens its panel: a Jira board's backlog in Jira's own order, or a project's branches, pull or merge requests, pipelines and issues, with the item beside the list. The panels only read: they never comment, merge, re-run a job or change an issue. The token stays on this machine, in a file only you can read, and goes only to that connection's own API. Nothing is read until you connect a tracker, and then only while its panel is open."},{title:"📤 Each account says what its organization's telemetry sends",body:"A Team or Enterprise organization can turn on Claude Code's telemetry for every member, and Claude Code applies it without asking. Each account of such an organization now carries a line under its name: “Telemetry · usage data”, or “Telemetry · prompts, tool details” in the warning colour when your prompts and tool details are sent too. Its tooltip names the organization and where the data goes. After a switch, Auto-switch's notification and the row's “Now active” note say it too. The deck changes nothing; it learns what the organization turns on from a Claude Code session run on one of its accounts, and until then that account shows no line."},{title:"⚠️ A warning when a paired deck is on the same Claude login",body:"A Claude login renews once, so when two machines use one copied login, the one that renews second is signed out. When a paired deck on Local network says it is on the login this deck is using, the live account's row now says “Also active on” and names that deck, with what to do: use a different account on one of the machines, or sign in on each one separately. A switch onto such a login says so too, and so does one desktop notification per incident, “Login active on another deck” in Settings › Notifications, which is on by default."},{title:"📱 A phone opens one panel at most when the deck loads",body:"On a window 640 px wide or less, a reload used to open Accounts, Usage and the machine panel on top of each other, with none of the board in sight. It now opens at most one of them, preferring Usage over the machine panel, and Accounts and the session list open from the dock. A wider window loads exactly as before, and nothing you chose is forgotten."}],"3.44.0":[{title:"⛔ A turn that stops on an error now shows as stopped",body:"When Claude Code ends a turn on an API error, such as an expired login or a usage limit, it sends StopFailure instead of Stop. The deck now adds StopFailure to the hooks it writes in Claude Code's settings.json, but only when every Claude Code it finds is 2.1.78 or newer; with an older one, or one whose version it cannot read, nothing changes. The card then says “Stopped · login expired”, “Stopped · usage limit” or “Stopped · API error”, and the sessions one expired login stops together arrive as one notification that names them. Each needs a “continue” once a working login is active."},{title:"🔑 Auto-switch leaves an expired login, and nothing switches onto one",body:"When Claude Code has signed a login out and claude-swap's saved copy is dead too, Auto-switch now moves to another account under your home and weekly-reset rules, and its notification says why. Neither Auto-switch nor Switch moves onto a login that is already known to be expired: that account's row says its login expired, with Sign in again, and nothing moves."},{title:"💲 Usage totals say how complete they are",body:"The usage headline is always shown now, by the rule History and the model table already used: an exact total when every cost is known, a known $0 included; the known part with “+” when some tokens could not be priced; and “not priced”, never a bare $0, when no cost is known. Sessions whose cost is a known zero show it too."},{title:"📡 Radar: a resizable inspector, prompt previews and a JSON view",body:"Radar's inspector can be resized and shows prompt previews, highlights and each record as a JSON tree, beside the File view. Settings › Radar has a new Monitor automatically switch. It is off, so Radar still watches only after you press Start, as before; turn it on to have the deck start monitoring by itself."},{title:"🧰 Tool activity opens over the deck, with the first tool's details open",body:"Tool activity now opens as a dialog over the deck instead of a page of its own, with the first tool selected and its details beside the list. Escape closes the details first, then the dialog. On a phone the details open as a sheet."},{title:"🧩 Tool activity counts skills, and the slash commands you type if you opt in",body:"Tool activity's Skills tab ranks the skills your Claude Code and Codex agents used. Counting the slash commands you type needs Claude Code's UserPromptExpansion hook, which the deck adds to settings.json only when you start it with AGENTS_DECK_SKILL_HOOK=1 and every Claude Code it finds is 2.1.116 or newer. Without that variable nothing in settings.json changes."},{title:"▶️ Continue a background session that stopped",body:"A background session that stopped on an error has a Continue button on its card and panel: the deck stops it if Claude Code still lists it, then resumes it in its own folder with “Continue from where you left off.” Continue stopped background sessions, in Settings › General, presses it for you once per stop. It is off until you turn it on."},{title:"⌨️ ccdeck commands for your terminal",body:"ccdeck accounts, ccdeck switch, ccdeck usage, ccdeck sessions and ccdeck open work from any terminal. ccdeck switch --best goes where Auto-switch would, and every switch follows the deck's own rules. Over SSH, ccdeck open prints the line that opens the deck on your own computer. Each command takes --json for scripts."}],"3.43.4":[{title:"🔐 Local network no longer sends the login a deck is signed in to",body:`Two machines on one Claude login race to renew it, and the one that renews second is signed out with “Login expired”. So paired decks no longer receive the login a deck is signed in to right now. Every other login you tick is shared as before, and this one goes out once the deck switches to another account.
|
|
119
119
|
|
|
120
120
|
Update every paired deck: an older deck still sends the login it is using, and the decks paired with it still take it. To send it anyway, as before, turn on Send the login this deck is using too in the Local network dialog. Not covered yet: a paired deck that already holds a copy of that login, from before this deck switched to it, can still renew it first and sign this deck out. Auto-switch can also still move a deck onto a login another paired deck is using, if the deck already holds a copy of it.`}],"3.43.0":[{title:"🏠 Auto-switch can come back to a home account",body:"Choose Set as home in an account’s ⋯ menu. With Auto-switch on, Next account › Soonest weekly reset uses up quota that resets within 4 days first."},{title:"🔄 Sessions already running appear when ccdeck starts",body:"Busy Codex sessions, and Claude ones on macOS and Linux, show up again after a restart. Restore unfinished sessions, in Settings › General, turns it off."},{title:"⚙️ Settings, reorganized and searchable",body:"Search every setting from the top of the list. Keyboard, Data and About have sections of their own."},{title:"📋 Plan progress and reasoning effort on agent cards",body:"Cards show how far an agent is through its plan, and the effort beside the model. Finished sessions can hide themselves after a delay you choose."},{title:"✨ Calmer desktop updates, marked shared accounts, Codex sub-agents kept together",body:"The desktop app installs an update only when no agent is working or waiting. Accounts shared on Local network are marked."}],"3.42.0":[{title:"🔠 Text size and density, in Settings",body:"Five text sizes and five spacing levels, under Settings › Text & density."},{title:"🛠️ Tool activity: which tools your agents use, how long they take and what fails",body:"A new page on the stripe on the right. Its history is kept on this device only."},{title:"🎨 Gruvbox Dark, Light and Material themes",body:"Pick one in Settings › General. Switching themes now fades instead of snapping."},{title:"✨ A session-list drawer on phones, whole dates in usage history, the waiting session in the minimap",body:"Smaller fixes for the phone layout, the usage history chart and the canvas minimap."}],"3.41.1":[{title:"🪟 More reliable Windows updates",body:"Restart to update stops the app’s background server before installation begins."},{title:"📊 More accurate account capacity",body:"Elapsed resets and older readings no longer imply newly available quota. Account refreshes keep the latest valid readings."},{title:"🖥️ Better layouts on portrait displays",body:"Sessions fill the right columns, and the canvas starts near the top. Usage history controls stay reachable in narrow windows."},{title:"✨ Clearer load history and consistent icons",body:"Load history includes the current core-capacity multiplier below the charts. Refresh and external-link icons look consistent across system fonts."}],"3.41.0":[{title:"📅 Plan account resets",body:"See the next seven days of resets, account capacity and which readings need refreshing."},{title:"📊 Follow quota history",body:"Inspect recorded Claude and Codex quota readings to see how remaining capacity changes over time."},{title:"♻️ See cached input reuse",body:"Session usage details now show the percentage of measured input reused from cache."},{title:"📻 A more polished Radio Explorer",body:"Find radio stations with compact search and filters, explore workspace streams separately, and save favorites from either source. Playback and keyboard navigation are more reliable."},{title:"🌍 Radio flags on Windows",body:"Country flags now display correctly in the radio station list on Windows."},{title:"🔧 Clearer Telemetry Radar controls",body:"Change individual telemetry flags and use a simpler Monitor view."}],"3.40.2":[{title:"📻 Music is in Radio now, not in Settings",body:"Settings no longer has a Music section. Claude FM, Lofi Girl and the streams you added are under Workspace streams in Radio, on the right sidebar, and Radio’s player has the volume and mute. Your station, volume and streams are kept. Adding, renaming or removing a stream link is no longer offered."}],"3.40.0":[{title:"📻 Explore radio around the world",body:"Open Radio from the right sidebar to discover stations on a world map, filter by country, sound or language, and save your favorites. Recent listening, a daily pick and Surprise me make it easier to find something to play. Music keeps playing when you close the explorer. Volume now adjusts in 1% steps, and an unavailable stream automatically advances to the next station after one second."},{title:"🦊 Choose your canvas companion",body:"Choose Deck companion, Fox or Penguin in Settings › General. Your companion shares the existing canvas movements and music controls, and your choice stays saved."},{title:"📊 See what each session used",body:"Open a session’s usage details to inspect tokens, models and estimated cost. For Codex, compare Automatic, Standard, Fast and Flex pricing estimates without changing your Codex settings or billing."},{title:"A clearer canvas",body:"Session cards, tool traces and connections are easier to scan. The canvas reframes more reliably when resizing to portrait or rearranging sessions, and model cost estimates use updated pricing."}],"3.39.3":[{title:"A cleaner desktop window",body:"The desktop app now has one compact toolbar that follows your theme, with native window controls and an application menu. Wider side rails give icons more room; the Local network footer and unread badges are more compact."},{title:"Clearer account usage and Telemetry Radar",body:"Account usage shows reset times together with capacity. Telemetry Radar has a clearer monitoring workspace and keeps history for up to 24 hours. Radar remains Beta."},{title:"🔎 Telemetry Radar on Linux and Windows, with no Terminal step",body:"Radar now works on macOS, Linux and Windows. Press Start monitoring and ccdeck runs the capture itself, with no command to paste into Terminal, and keeps listening until you stop it. Capture needs a one-time setup for your user: Wireshark’s ChmodBPF helper on macOS, tcpdump with capture permission on Linux, or Wireshark with Npcap on Windows. Radar says what is missing, and once permission is granted it starts listening by itself."}],"3.39.1":[{title:"🎨 More themes, with clearer contrast",body:"Choose Omarchy, Matrix, Black Contrast, White Contrast or Catppuccin Mocha in Settings › General. Fresh installations start with Rider Black; your saved theme choice is preserved."},{title:"A little more room on the canvas",body:"The minimap is smaller, leaving more room for the character and your sessions. Undo and Resume now sit beside each other at the bottom of the canvas. Telemetry Radar is marked Beta while it is being tested and improved."}],"3.39.0":[{title:"🔎 Inspect Claude Code telemetry on macOS",body:"Telemetry Radar shows Claude Code's configured telemetry and can inspect traffic at destinations you choose. When settings are absent, it can show observed connections separately; a connection alone does not prove telemetry or reveal message contents. Captured telemetry can contain prompt or response content, and other apps sending to the same destination may appear too. Captured messages stay in ccdeck's memory, and no capture file is written."},{title:"🧭 Open panels from the edges",body:"Open the session list, Claude accounts, Usage, This machine, Usage history and Browser Watch from the window edges. You can keep several panels open beside the canvas; on a phone, the same controls sit in a bottom dock."},{title:"More control while you work",body:"Turn off single-key shortcuts if typed letters should not control the deck, see each stage while adding a Claude account, and undo a recent rearrangement. The topbar also names the Claude Code session waiting on you."},{title:"🎨 Two new dark themes",body:"Choose Rider Black or VS Code Black in Settings › General. Both add a darker canvas with flatter panels and distinct focus accents; your existing Light or Dark choice stays as it was."}],"3.38.5":[{title:"🔧 Settings are in one place now",body:"The theme, the sounds, notifications and the minimap character are all in Settings, behind the gear at the right of the topbar, or Cmd+, (Ctrl+, on Windows and Linux). V opens it at Sounds, with each tone's volume and sound, and M turns sounds off or on from anywhere. Nothing you had set has changed, it has only moved, and T still switches the theme. The auto-switch threshold also takes a custom value now: pick Custom… and type a whole percent from 50 to 99."},{title:"Windows: no more temperature stuck at 28 °C",body:"On many Windows laptops the only temperature Windows offers is a thermal zone wired to nothing, which reads a fixed 28 °C however hot the CPU is, and the machine panel showed it as a reading. A thermal zone is now drawn only once its value has changed. Until then the panel shows LibreHardwareMonitor's readings if its web server is running, and otherwise no Thermal section at all: the deck never invents a reading."}],"3.38.4":[{title:"🔔 A notification when Auto-switch changes your account",body:'When Auto-switch moves Claude Code to another account, ccdeck now tells you once, with where it went and why, for example "Switched to work · personal@example.com reached 90%". You can turn it off in Settings › Notifications, where two more wait, off until you turn them on: one when a quota window of the Claude or Codex account you are on reaches 90% and again at 100%, and one when a window that had reached 90% is available again. Each is said once per window and a restart does not repeat it. With either quota notification on, the deck reads quota about every two minutes even while no page is open.'}],"3.38.3":[{title:"🧾 Subagent costs count their whole reply",body:"A subagent's request was counted from the first moment of its reply, before most of it had been written, so much of its output was left out of the deck's token and cost counts, and a subagent turn in fast mode was priced at the standard rate. Each request is now counted from its finished reply. Days with subagents will read higher than before: that is the part that was missing, not a new charge. Projects counts its history again once after the update, so past days come out right too. Codex sessions on GPT-6 Sol, GPT-6.1 Sol and GPT-6 Luna now show a cost instead of not priced."}],"3.37.1":[{title:"🔁 Expired logins repair from your other machines",body:"When a login stops working on this machine and a machine you paired with still has it working and ticked, Local network now copies it back on the next round, whether or not the account is ticked here. Before, it stayed marked expired until the account was ticked here as well, or deleted so that it arrived again. A machine that paired on its own, through Say yes to every deck that asks, still repairs only the accounts ticked here."}],"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:"Feedback, beside Settings at the right of the topbar (under More on a phone), opens a short form: pick what kind it is, write a few lines, and add a way to reach you under Add details 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 desktop app can also 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:"Settings › General shows a small preview of the deck in each theme. 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.
|
|
121
121
|
|
|
@@ -311,11 +311,11 @@ While it is open it polls this machine once every few seconds, and it stops the
|
|
|
311
311
|
|
|
312
312
|
It marks that work now. A chart with bars in it means the agent is doing something, whether or not it has called a tool in the last minute; a flat chart means it genuinely is not. Hover it for the split — how many tool calls and how many blocks of thinking and writing landed in the last 60 seconds.
|
|
313
313
|
|
|
314
|
-
Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},HS="agent-dag.releaseNotesSeen";function DO(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function vi(e,t){const n=DO(e),s=DO(t);for(let a=0;a<Math.max(n.length,s.length);a++){const o=(n[a]??0)-(s[a]??0);if(o!==0)return o<0?-1:1}return 0}function lo(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function _ve(e){if(!e||typeof e!="object")return!1;const{title:t,body:n}=e;return typeof t=="string"&&t.trim()!==""&&typeof n=="string"&&n.trim()!==""}function Eve(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!lo(n)||!Array.isArray(s))continue;const a=s.filter(_ve);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>vi(s.version,n.version))}const FO=Eve(Cve);function Q8(e,t,n){return e.filter(s=>vi(s.version,n)<=0&&(t===null||vi(s.version,t)>0))}function Tve(e,t){return e.filter(n=>vi(n.version,t)===0)}function Ave(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function Rve({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const i=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${i} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&lo(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const a=n[0].version;if(!lo(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const o=vi(a,t);return o<0?`v${t} · 🐛 Bug fixes and performance improvements. Earlier release notes are shown below.`:o>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const Mve=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function $ve(e){const t=Mve.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function Lve(e){if(!e)return null;let t=null;try{t=e.getItem(HS)}catch{return null}return lo(t)?t:null}function Ive(e){if(!e)return!1;try{return e.getItem(HS),!0}catch{return!1}}function Ove(e,t){if(!e)return!1;try{return e.setItem(HS,t),!0}catch{return!1}}const eB="agent-dag.tourSeen";function Pve(e){if(!e)return!1;try{return e.getItem(eB)==="1"}catch{return!1}}function Dve(e){if(!e)return!1;try{return e.setItem(eB,"1"),!0}catch{return!1}}function Fve({tourSeen:e,decision:t}){if(t.reason==="no-version"||t.reason==="cannot-remember")return{tour:!1,notes:"none"};if(t.reason==="welcome"||t.reason==="first-run")return{tour:!e,notes:"none"};const n=t.show.length>0;return e?{tour:!1,notes:n?"now":"none"}:{tour:!0,notes:n?"after":"none"}}function Bve({stored:e,running:t,notes:n,remembers:s=!0}){if(!lo(t))return{show:[],record:null,reason:"no-version"};if(!lo(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const i=Tve(n,t);return i.length?{show:i,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=vi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const o=Q8(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function co(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}function yje(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function wje(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function qve(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function xje(e){return!Number.isFinite(e)||e<=0?"empty":Qn(e)}function vje(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,a)=>s+a.programVisits,0)}))}function Uve(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function bje(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],a=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(a>0?`, and ${a} more`:"")+". The watch continues on the profiles it can read."}}const n=qve(e.browsers);return n.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."}:n.some(s=>s.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."}}const Wve="Check for updates",tB="Ask npm now whether a newer ccdeck is out.",BO="Checking…",Hve="Couldn't reach npm. Try again.",zve="Couldn't reach the deck. Try again.",nB="Update checks are off on this deck (AGENTS_DECK_NO_UPDATE_CHECK or AGENTS_DECK_NO_INSTALL).",Vve="The deck looks again in five minutes.";function Gve(e,t,n,s){const a=s?t.npx:n?Jt(t,n):void 0;return a?`${e} is out, but ${a}`:`${e} is out. Run:`}const Pn=(e,t={})=>({said:e,tone:"answer",age:null,command:null,action:null,...t}),Xo=e=>Pn(e,{tone:"note"});function qO(e,t){return Uve(e,t)??"just now"}function Kve(e,t){const n=e.update;return(n==null?void 0:n.status)==="ready"?Xo(`${n.version} is ready. Restart to update.`):(n==null?void 0:n.status)==="checking"?Xo("The app is checking for updates…"):(n==null?void 0:n.status)==="downloading"?Xo(n.version?`${n.version} is out. The app is downloading it.`:"The app is downloading an update."):(n==null?void 0:n.status)==="current"?Xo(`You're on the latest, ${e.version??t}. You can check again here.`):(n==null?void 0:n.status)==="error"?Xo("The app's last update check failed. Try Check for updates again."):Xo("The app keeps itself up to date. Check for updates here.")}function Yve(e,t,n){var i;const s=e.version;if((s==null?void 0:s.upgradeMode)==="install"&&e.upgradeState!=="failed"){if(e.upgradeState==="done")return Pn(`${t} is installed.`);const l=e.upgradeState==="running",u=`Runs ${((i=s.upgrade)==null?void 0:i.command)??s.command} here, then restarts once nothing is running.`;return Pn(l?`Installing ${t}…`:`${t} is out.`,{action:{kind:"install",label:"Update now",busy:l,why:u}})}if((s==null?void 0:s.upgradeMode)==="npx"&&s.canRestart){const l=e.upgradeState==="failed";return Pn(l?`The last update to ${t} came back on ${e.running}.`:`${t} is out.`,{action:{kind:"npx",label:l?"Retry update":"Update & restart",busy:e.restarting,why:`Runs ${s.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`}})}const a=e.upgradeState==="failed"?`Installing ${t} failed. Run it yourself:`:Gve(t,n,s==null?void 0:s.upgradeBlocked,(s==null?void 0:s.upgradeMode)==="npx"),o=(s==null?void 0:s.command)??null;return Pn(a,{command:o,action:o?{kind:"copy",label:e.copied?"Copied":"Copy",busy:!1}:null})}function Xve(e){const t=e.version;if(e.unreachable)return Pn(zve,{tone:"warn"});const n=t!=null&&t.checkFailedAt&&t.checkFailedAt>(t.checkedAt??0)?t.checkFailedAt:null;if(n)return Pn(Hve,{tone:"warn",age:e.answered?null:`Last tried ${qO(n,e.now)}.`});const s=t!=null&&t.latestPending&&t.latestPending!==e.running?t.latestPending:null;if(s)return Pn(`${s} is tagged on npm but can't be installed yet. ${Vve}`);const a=t!=null&&t.checkedAt?qO(t.checkedAt,e.now):null;if(e.answered&&(t!=null&&t.latest)){const o=t.latest===e.running?`You're on the latest, ${e.running}.`:`You're on ${e.running}, ahead of npm's ${t.latest}.`;return Pn(o,{age:a?`Checked ${a}.`:null})}return Pn("",{age:a?`Last checked ${a}.`:null})}function Zve(e,t){var a,o;const n=e.version;if((a=e.app)!=null&&a.inApp&&(n!=null&&n.checkDisabled)){const i=Kve(e.app,e.running);return i&&{canCheck:!0,checking:e.checking||((o=e.app.update)==null?void 0:o.status)==="checking",line:e.unreachable?Pn("The desktop updater did not accept the check. Try the ccdeck menu or update the desktop app.",{tone:"warn"}):e.checking?Pn(BO):i}}if(n!=null&&n.checkDisabled)return{canCheck:!1,checking:!1,line:Xo(nB)};const s=(n==null?void 0:n.notice)??null;if((s==null?void 0:s.kind)==="upgrade")return{canCheck:!0,checking:e.checking,line:Yve(e,s.to,t)};if((s==null?void 0:s.kind)==="restart"){const i=n!=null&&n.canRestart?`${s.to} is installed. Restart the deck to start running it.`:`${s.to} is installed. Restart ccdeck to start running it.`;return{canCheck:!0,checking:e.checking,line:Pn(i)}}return e.checking?{canCheck:!0,checking:!0,line:Pn(BO)}:{canCheck:!0,checking:!1,line:Xve(e)}}const sB=450;async function Jve(e,t=n=>new Promise(s=>setTimeout(s,n))){const[n]=await Promise.all([e(!0),t(sB)]);return n?"answered":"unreachable"}async function Qve(e=fetch){try{const[t]=await Promise.all([e("/api/desktop-update/check",{method:"POST",signal:AbortSignal.timeout(8e3)}),new Promise(n=>setTimeout(n,sB))]);return t.ok?"answered":"unreachable"}catch{return"unreachable"}}const Rj="Eight pictures of what the deck shows.",UO="Restart the deck. Sessions, settings and pairings come back as they were.";function ebe(e){var $;const t=(e==null?void 0:e.versionCheck.versionChecking)??!1,n=_r(3e4),[s,a]=g.useState(!1),o=g.useRef(!1),[i,l]=g.useState(!1),[u,h]=g.useState(!1),f=g.useRef(t);if(g.useEffect(()=>{f.current&&!t&&h(!0),f.current=t},[t]),!e)return null;const{versionCheck:p,upgrade:m,restart:w,desktopUpdate:b,running:k,onHandOff:v}=e,N=Zve({version:p.version,running:k,checking:s||t,answered:u,unreachable:i,now:n,upgradeState:m.upgradeState,copied:m.cmdCopied,restarting:w.restarting,app:{inApp:co(),update:b.appUpdate,version:M8(),menu:L8()}},Ej);if(!N)return null;const x=co()&&(($=p.version)==null?void 0:$.checkDisabled);return{state:N,check:async()=>{var O;if(!Cn(o.current||t)||x&&((O=b.appUpdate)==null?void 0:O.status)==="checking")return;o.current=!0,a(!0);const A=x?await Qve():await Jve(p.loadVersion);o.current=!1,a(!1),l(A==="unreachable"),h(!0)},act:A=>{if(A.kind==="copy")return void m.copyCommand();v(),p.showNotice(),A.kind==="install"?m.startUpgrade():w.askRestart({upgrade:!0})},checkWhy:x?"Ask the desktop app whether a newer ccdeck is out.":tB}}function tbe({onTour:e,onRestart:t,updateCheck:n}){var h,f;const s=ac("above","dialog"),a=ebe(n),o=g.useId(),i=(a==null?void 0:a.state.canCheck)??!1,u=((h=a==null?void 0:a.state.line.action)==null?void 0:h.kind)==="install"||((f=a==null?void 0:a.state.line.action)==null?void 0:f.kind)==="npx"?void 0:t;return!e&&!i&&!u&&!a?null:r.jsxs("div",{className:"rn-actions",children:[(e||i||u)&&r.jsxs("div",{className:"rn-acts",children:[e&&r.jsxs("button",{type:"button",className:"btn rn-act",onClick:e,"aria-describedby":`${o}-tour`,...s.bind({label:Rj}),children:[r.jsx(OD,{}),"Take the tour"]}),a&&i&&r.jsxs("button",{type:"button",className:"btn rn-act",onClick:()=>void a.check(),"aria-busy":a.state.checking||void 0,"aria-describedby":`${o}-check`,...s.bind({label:a.checkWhy}),children:[r.jsx(NQ,{}),Wve]}),u&&r.jsxs("button",{type:"button",className:"btn rn-act rn-act-restart",onClick:u,"aria-describedby":`${o}-restart`,...s.bind({label:UO}),children:[r.jsx(SQ,{}),"Restart"]})]}),a&&r.jsx(nbe,{line:a.state.line,onAct:a.act,bindHint:s.bind,whyId:`${o}-act`}),r.jsx("span",{hidden:!0,id:`${o}-tour`,children:Rj}),r.jsx("span",{hidden:!0,id:`${o}-check`,children:(a==null?void 0:a.checkWhy)??tB}),r.jsx("span",{hidden:!0,id:`${o}-restart`,children:UO}),s.node]})}function nbe({line:e,onAct:t,bindHint:n,whyId:s}){const{action:a}=e,o=a&&r.jsx(sbe,{action:a,onAct:t,bindHint:n,whyId:s});return r.jsxs("p",{className:"rn-update-line","data-tone":e.tone,children:[r.jsx("span",{className:"rn-update-what",role:"status",children:e.said}),e.age&&r.jsx("span",{className:"rn-update-age",children:e.age}),e.command?r.jsxs("span",{className:"rn-update-cmd",children:[r.jsx("code",{className:"rn-code",children:e.command}),o]}):o]})}function sbe({action:e,onAct:t,bindHint:n,whyId:s}){const a=e.kind==="copy"?null:e.why;return r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:a?"btn primary rn-line-act":"btn rn-line-act",onClick:()=>t(e),"aria-busy":e.busy||void 0,"aria-describedby":a&&s?s:void 0,...a&&n?n({label:a}):{},children:e.label}),a&&s&&r.jsx("span",{hidden:!0,id:s,children:a})]})}function rbe({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:o,updateVersion:i,updateBusy:l,onUpdateRestart:u,updateFailure:h,onRestart:f,updateCheck:p}){const m=gt(a),w=yt(a),b=Ave(e);return r.jsx("div",{className:"modal-backdrop",...w,role:"presentation",children:r.jsxs("div",{ref:m,className:"modal release-notes",onClick:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),b&&r.jsx("span",{className:"modal-tool-id",children:b})]}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[(i||h)&&r.jsxs("div",{className:"rn-update",children:[i&&u&&r.jsxs("div",{className:"guide-door",children:[r.jsxs("span",{children:["ccdeck v",i," is downloaded and verified."]}),r.jsx("button",{type:"button",className:"btn",onClick:u,"aria-busy":l||void 0,children:l?"Restarting…":Ql})]}),r.jsx("p",{className:"rn-update-said",role:"status",children:h})]}),r.jsx("p",{className:"modal-note",children:Rve({since:t,running:n,firstRun:s,entries:e})}),r.jsx(tbe,{onTour:i?void 0:o,onRestart:f,updateCheck:p}),e.map(k=>r.jsxs("section",{className:"modal-section",children:[r.jsxs("h3",{className:"rn-version",children:["v",k.version]}),r.jsx("ul",{className:"rn-notes",children:k.notes.map((v,N)=>{const{icon:x,rest:C}=$ve(v.title);return r.jsx("li",{className:"rn-note",children:r.jsxs("p",{className:"rn-note-title",children:[x&&r.jsx("span",{className:"rn-note-icon",children:x}),C]})},N)})})]},k.version))]})]})})}function abe({state:e,sessionId:t,onClose:n}){const s=g.useMemo(()=>obe(e,t),[e,e.revision,t]),a=g.useRef(null),o=gt(n,{focusRef:a}),i=yt(n);return s?r.jsx("div",{className:"modal-backdrop",...i,role:"presentation",children:r.jsxs("div",{ref:o,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[r.jsxs("div",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),r.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),r.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),r.jsxs("div",{className:"modal-actions",children:[r.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),r.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),r.jsxs("div",{className:"modal-body",children:[r.jsxs("section",{className:"ss-hero",children:[r.jsxs("div",{className:"ss-hero-left",children:[r.jsx("div",{className:"ss-cost-label",children:AD}),r.jsx("div",{className:"ss-cost",children:ct(s.cost.total)}),s.modelChips.length>0&&r.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>r.jsx("span",{className:"model-chip","data-family":Zp(l),title:l,children:no(l)},l))})]}),r.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&r.jsxs(r.Fragment,{children:[r.jsx(GN,{cost:s.cost,size:"lg"}),r.jsxs("div",{className:"ss-cost-legend",children:[r.jsxs("span",{className:"ssl ssl-in",children:["input ",r.jsx("b",{children:ct(s.cost.input)})]}),r.jsxs("span",{className:"ssl ssl-out",children:["output ",r.jsx("b",{children:ct(s.cost.output)})]}),r.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",r.jsx("b",{children:ct(s.cost.cacheRead)})]}),r.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",r.jsx("b",{children:ct(s.cost.cacheWrite)})]})]})]})})]}),r.jsxs("section",{className:"ss-stats",children:[r.jsx(yl,{label:"agents",value:s.agentCount}),r.jsx(yl,{label:"subagents",value:s.subagentCount}),r.jsx(yl,{label:"tool calls",value:s.toolCount}),r.jsx(yl,{label:"prompts",value:s.promptCount}),r.jsx(yl,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&r.jsx(yl,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&r.jsxs("section",{className:"modal-section",children:[r.jsx("h4",{children:"Most-used tools"}),r.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,u])=>r.jsxs("div",{className:"ss-tt",children:[r.jsx("span",{className:"ss-tt-name",children:l}),r.jsx("span",{className:"ss-tt-bar",children:r.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),r.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),s.firstPrompt&&r.jsxs("section",{className:"modal-section",children:[r.jsx("h4",{children:"Opening prompt"}),r.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function yl({label:e,value:t,tone:n}){return r.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[r.jsx("div",{className:"ss-stat-value",children:t}),r.jsx("div",{className:"ss-stat-label",children:e})]})}function obe(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const C of e.agents.values())C.sessionId===t&&s.push(C);if(s.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},o=new Set,i=new Map;let l=0,u=0,h=0,f=0,p=0,m,w=1/0,b=0;for(const C of s){const S=Un(C);a.input+=S.input,a.output+=S.output,a.cacheRead+=S.cacheRead,a.cacheWrite+=S.cacheWrite,a.total+=S.total;for(const $ of bP(C))o.add($);C.model&&o.add(C.model),C.kind==="subagent"&&p++;const _=tP(C.prompts);u+=_.length,!m&&_.length>0&&(m=_[0].text),h+=C.usage.inputTokens+C.usage.outputTokens,l+=C.toolCount,f+=C.toolErrorCount??0;for(const[$,A]of C.toolCountByName??[])i.set($,(i.get($)??0)+A);w=Math.min(w,C.startedAt),b=Math.max(b,C.endedAt??Date.now())}const k=Math.max(0,b-w),v=Math.floor(k/1e3),N=v<60?`${v}s`:v<3600?`${Math.floor(v/60)}m ${String(v%60).padStart(2,"0")}s`:`${Math.floor(v/3600)}h ${Math.floor(v%3600/60)}m`,x=Array.from(i.entries()).sort((C,S)=>S[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:N,cost:a,modelChips:Array.from(o),agentCount:s.length,subagentCount:p,toolCount:l,promptCount:u,tokensSum:h,errCount:f,topTools:x,firstPrompt:m}}function Bt({id:e,title:t,note:n,noteId:s,aside:a,list:o=!0,settingId:i,className:l,children:u}){const h=l?`settings-group ${l}`:"settings-group",f=o?r.jsx("div",{className:"settings-list",children:u}):u;return t===void 0?r.jsx("div",{className:h,"data-setting":i,children:f}):r.jsxs("section",{className:h,"aria-labelledby":e,"data-setting":i,children:[r.jsxs("div",{className:"settings-caption",children:[r.jsxs("div",{className:"settings-caption-text",children:[r.jsx("h3",{id:e,children:t}),n&&r.jsx("p",{className:"settings-caption-note",id:s,children:n})]}),a]}),f]})}function mt({name:e,nameId:t,note:n,noteId:s,control:a,as:o="label",settingId:i,className:l,details:u,children:h}){const f=o,p=r.jsxs(f,{className:l?`settings-row ${l}`:"settings-row","data-setting":i,children:[r.jsx("span",{className:"settings-row-name",id:t,children:e}),n&&r.jsx("span",{className:"settings-row-note",id:s,children:n}),a!==void 0&&r.jsx("span",{className:"settings-row-control",children:a}),h]});return u?r.jsxs("div",{className:"settings-row-with-details",children:[p,r.jsxs("details",{className:"settings-row-details",children:[r.jsxs("summary",{children:["Details",r.jsxs("span",{className:"vis-hidden",children:[" about ",e]})]}),r.jsx("div",{children:u})]})]}):p}function rB(e,t){const[n,s]=g.useState(null),[a,o]=g.useState(!1),[i,l]=g.useState(""),u=g.useRef(!1),h=p=>typeof p=="boolean"?p:t;return g.useEffect(()=>{let p=!0;return fetch("/api/prefs").then(m=>{if(!m.ok)throw new Error;return m.json()}).then(m=>{var w;if(!m.ok)throw new Error;p&&s(h((w=m.prefs)==null?void 0:w[e]))}).catch(()=>{p&&l("Could not read this setting. Reopen Settings to retry.")}),()=>{p=!1}},[e]),{enabled:n,busy:a,error:i,change:async()=>{if(!(n===null||!Cn(u.current))){u.current=!0,o(!0),l("");try{const p=await fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[e]:!n})});if(!p.ok)throw new Error;const m=await p.json();if(!m.ok)throw new Error;s(h(m.prefs[e]))}catch{l("Could not save this setting. Try again.")}finally{u.current=!1,o(!1)}}}}}function WO({provider:e}){const t=e==="Codex"?"recoverCodexSessions":"recoverClaudeSessions",n=`${e.toLowerCase()}-session-recovery`,s=rB(t,!0);return r.jsxs(Bt,{id:`${n}-title`,title:`${e} sessions`,children:[r.jsx(mt,{settingId:n,name:"Restore unfinished sessions",note:e==="Codex"?"Restore recent unfinished turns on startup; their processes may have stopped.":"Restore verified busy sessions on the next start.",details:e==="Codex"?"Find unfinished turns in recent local Codex logs on the next start. A missing ending does not confirm the process is still running.":"On the next start, find busy local Claude sessions whose process identity can be verified.",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":`Restore unfinished ${e} sessions`,"aria-checked":s.enabled===!0,...Bn(s.busy,s.enabled===null),onClick:()=>{s.change()},children:r.jsx("span",{className:"switch-knob"})})}),s.error&&r.jsx("p",{role:"alert",children:s.error}),e==="Claude"&&r.jsx(ibe,{})]})}function ibe(){const e=rB("continueStopped",!1);return r.jsxs(r.Fragment,{children:[r.jsx(mt,{settingId:"claude-continue-stopped",name:"Continue stopped background sessions",note:"Resume once a working login with room becomes available.",details:"When a background session stops on an expired login or a usage limit, continue it once a working login with room is active. Once per stop; a session that stops again right after waits for you.",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":"Continue stopped background sessions automatically","aria-checked":e.enabled===!0,...Bn(e.busy,e.enabled===null),onClick:()=>{e.change()},children:r.jsx("span",{className:"switch-knob"})})}),e.error&&r.jsx("p",{role:"alert",children:e.error})]})}const lbe="Hide finished sessions after",cbe="A finished session leaves the canvas after this long. It stays in the session list (L), and comes back when it starts working again or needs you.";function ube(){const e=f8();return r.jsx(Bt,{id:"settings-board-caption",title:"Board",children:r.jsx(mt,{settingId:"hide-finished",name:lbe,nameId:"settings-hide-finished-label",note:"Hidden sessions stay available in the session list.",details:cbe,noteId:"settings-hide-finished-note",control:r.jsx("select",{className:"sm-select",value:e,"aria-labelledby":"settings-hide-finished-label","aria-describedby":"settings-hide-finished-note",onChange:t=>lge(Number(t.target.value)),children:c8.map(t=>r.jsx("option",{value:t,children:ige(t)},t))})})})}const dbe="Accounts and auto-switch",hbe="Your Claude accounts, and Auto-switch, which moves Claude Code to another one before the account in use runs out.",fbe="Local network",pbe="Pairing with the decks on your other machines, so a login that expires on one is repaired from another.",mbe="Browser Watch",gbe="Whether something drove your browser while you were away, and what the deck does about it.";function ybe({claudeHere:e,singleKeys:t,doors:n}){return r.jsxs(Bt,{id:"settings-elsewhere-caption",title:"Elsewhere on the deck",children:[e&&r.jsx(Z0,{settingId:"accounts",name:dbe,note:hbe,onOpen:n.accounts,cap:t?{key:"A",title:"Press A anywhere to show or hide the accounts panel"}:null}),e&&r.jsx(Z0,{settingId:"local-network",name:fbe,note:pbe,onOpen:n.localNetwork,cap:null}),r.jsx(Z0,{settingId:"browser-watch",name:mbe,note:gbe,onOpen:n.browserWatch,dialog:!0,cap:t?{key:"B",title:"Press B anywhere to open or close Browser Watch"}:null})]})}function Z0({settingId:e,name:t,note:n,onOpen:s,cap:a,dialog:o=!1}){const i=`settings-${e}`;return r.jsx(mt,{as:"div",settingId:e,name:t,nameId:`${i}-name`,note:n,control:r.jsxs(r.Fragment,{children:[a&&r.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:a.title,children:a.key}),r.jsx("button",{type:"button",className:"btn",id:`${i}-open`,"aria-labelledby":`${i}-open ${i}-name`,"aria-haspopup":o?"dialog":void 0,"aria-keyshortcuts":a?a.key:void 0,onClick:s,children:"Open"})]})})}const wbe="Single-key shortcuts",xbe="Keys like L, U, M, ? and Space open panels and toggle things. Turn this off if you use voice control or press them by accident.";function vbe(e){const t=e.binds.includes("?")?"the keyboard shortcuts sheet":e.action;return t.charAt(0).toUpperCase()+t.slice(1)}function bbe(e,t){const n=t.trim().toLowerCase();return n?[e.action,e.cap,e.macCap??""].some(s=>s.toLowerCase().includes(n)):!0}function kbe({singleKeys:e,onToggleSingleKeys:t}){const n=po(ro()),[s,a]=g.useState(""),o=g.useId(),i=$d(),l=X8(e,u=>ra(i,u)).map(u=>({...u,rows:u.rows.filter(h=>bbe(h,s))})).filter(u=>u.rows.length>0);return r.jsxs(r.Fragment,{children:[r.jsx(Bt,{children:r.jsx(mt,{settingId:"single-keys",name:wbe,nameId:"settings-single-keys-label",note:xbe,noteId:"settings-single-keys-note",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":e,"aria-labelledby":"settings-single-keys-label","aria-describedby":"settings-single-keys-note",onClick:t,children:r.jsx("span",{className:"switch-knob"})})})}),r.jsxs("div",{className:"settings-filter",children:[r.jsx("label",{className:"vis-hidden",htmlFor:o,children:"Filter shortcuts"}),r.jsx("input",{id:o,type:"search",className:"settings-filter-field",placeholder:"Filter shortcuts",autoComplete:"off",spellCheck:!1,value:s,onChange:u=>a(u.target.value),onKeyDown:u=>{nm(u.key)&&s&&(u.stopPropagation(),a(""))}})]}),l.map(u=>{const h=`settings-keys-${u.title.toLowerCase().replace(/[^a-z]+/g,"-")}`;return r.jsx(Bt,{id:h,title:u.title,className:"settings-keys",children:u.rows.map(f=>r.jsx(mt,{as:"div",name:vbe(f),control:r.jsx("kbd",{className:"settings-key",children:n&&f.macCap?f.macCap:f.cap})},`${f.cap}:${f.action}`))},u.title)}),l.length===0&&r.jsxs("p",{className:"settings-empty",role:"status",children:["No shortcut matches “",s.trim(),"”."]}),s.trim()===""&&r.jsx("p",{className:"settings-foot",children:Y8})]})}function jbe({notifyOn:e,onToggleNotify:t,notifyVetoed:n,notifyPermission:s,onAskNotify:a,accountNotify:o,onToggleAccountNotify:i}){const l=_ee(s),u=co(),h=e&&!n&&!u,f=g.useRef(null),p=na(!l.ask,f);return r.jsxs(r.Fragment,{children:[r.jsxs(Bt,{id:"sm-closed-caption",title:"While the deck is closed",children:[r.jsx(mt,{settingId:"notify-closed",name:"Notifications while closed",nameId:"sm-notify-label",note:n?Nee:jee(u),noteId:"sm-notify-note",control:r.jsx("button",{ref:f,type:"button",role:"switch","aria-checked":e,"aria-labelledby":"sm-notify-label","aria-describedby":"sm-notify-note",className:"switch",onClick:t,children:r.jsx("span",{className:"switch-knob"})})}),h&&r.jsx(mt,{as:"div",name:"Browser notifications",nameId:"sm-channel-name",note:l.note,control:l.ask?r.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:()=>{p(),a()},children:"Enable"}):r.jsxs("span",{className:"sm-channel-state","data-ok":l.ok||void 0,children:[l.ok&&r.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:r.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),l.status]})})]}),r.jsx(Bt,{id:"sm-accounts-caption",title:"Accounts",note:n?Cee:See,children:zD.map(({kind:m,label:w,title:b})=>r.jsx(mt,{settingId:m,name:w,nameId:`sm-${m}-label`,note:b,noteId:`sm-${m}-note`,control:r.jsx("button",{type:"button",role:"switch","aria-checked":o[m],"aria-labelledby":`sm-${m}-label`,"aria-describedby":`sm-${m}-note`,className:"switch",onClick:()=>i(m),children:r.jsx("span",{className:"switch-knob"})})},m))})]})}const Nbe=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function Sbe(e){return Nbe.find(t=>e(t))}const Cbe=4400;function _be(e){const t=e.split(";")[0];return{name:`Recorded voice.${t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm"}`,type:t}}function Ebe({full:e,setCustomError:t,runCustom:n,onImportCustom:s}){const[a,o]=g.useState(!1),i=g.useRef(null),l=g.useRef(null),u=g.useRef(!1),h=()=>{var p;l.current!==null&&clearTimeout(l.current),l.current=null,((p=i.current)==null?void 0:p.state)==="recording"&&i.current.stop()},f=async()=>{var m;if(e)return;if(t(""),!((m=navigator.mediaDevices)!=null&&m.getUserMedia)||typeof MediaRecorder>"u"){t("Microphone recording is unavailable in this browser.");return}let p;try{p=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{u.current||t("Microphone access was denied or unavailable.");return}if(u.current||i.current){p.getTracks().forEach(w=>w.stop());return}try{const w=Sbe(v=>MediaRecorder.isTypeSupported(v)),b=new MediaRecorder(p,w?{mimeType:w}:void 0),k=[];i.current=b,b.ondataavailable=v=>{v.data.size&&k.push(v.data)},b.onerror=()=>t("Recording failed. Please try again."),b.onstop=()=>{p.getTracks().forEach(C=>C.stop()),l.current!==null&&clearTimeout(l.current),l.current=null;const v=i.current===b;if(v&&(i.current=null),o(!1),!v||!k.length)return;const N=_be(b.mimeType),x=new File(k,N.name,{type:N.type});n(()=>s(x))},b.start(200),o(!0),l.current=setTimeout(h,Cbe)}catch{i.current=null,p.getTracks().forEach(w=>w.stop()),t("This browser cannot record a supported audio format.")}};return g.useEffect(()=>(u.current=!1,()=>{u.current=!0,l.current!==null&&clearTimeout(l.current);const p=i.current;i.current=null,(p==null?void 0:p.state)==="recording"&&p.stop()}),[]),{recording:a,startRecording:f,stopRecording:h}}function Tbe({full:e,fullProps:t,runCustom:n,onCreateVoice:s}){const[a,o]=g.useState("Custom voice"),[i,l]=g.useState("Your turn"),[u,h]=g.useState(""),[f,p]=g.useState("1"),[m,w]=g.useState("1"),[b,k]=g.useState([]);return g.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const v=()=>{k(window.speechSynthesis.getVoices())};return v(),window.speechSynthesis.addEventListener("voiceschanged",v),()=>window.speechSynthesis.removeEventListener("voiceschanged",v)},[]),r.jsxs("details",{className:"sm-voice",children:[r.jsxs("summary",{className:"settings-row",...t,onClick:v=>{const N=v.currentTarget.parentElement;e&&N&&!N.open&&v.preventDefault()},children:[r.jsx("span",{className:"settings-row-name",children:"Spoken voice"}),r.jsx("span",{className:"settings-row-note",children:"Create from text"}),r.jsx("span",{className:"settings-row-control",children:r.jsx("svg",{className:"sm-voice-chevron",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:r.jsx("path",{d:"M5.5 3.5 9 7l-3.5 3.5"})})})]}),r.jsxs("div",{className:"sm-voice-fields",children:[r.jsxs("label",{children:[r.jsx("span",{children:"Name"}),r.jsx("input",{className:"ap-manage-input",value:a,maxLength:80,onChange:v=>o(v.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Text"}),r.jsx("input",{className:"ap-manage-input",value:i,maxLength:180,onChange:v=>l(v.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Voice"}),r.jsxs("select",{className:"sm-select",value:u,onChange:v=>h(v.target.value),children:[r.jsx("option",{value:"",children:"System default"}),b.map(v=>r.jsx("option",{value:v.voiceURI,children:v.name},v.voiceURI))]})]}),r.jsxs("div",{className:"sm-voice-pair",children:[r.jsxs("label",{children:[r.jsx("span",{children:"Rate"}),r.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:f,onChange:v=>p(v.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Pitch"}),r.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:m,onChange:v=>w(v.target.value)})]})]}),r.jsx("button",{type:"button",className:"btn sm-custom-action",...t,onClick:()=>{e||n(async()=>{await s({name:a,text:i,voiceURI:u,rate:parseFloat(f),pitch:parseFloat(m)}),l("Your turn")})},children:"Add spoken voice"})]})]})}function Abe({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:s,onPreviewCustom:a,onDeleteCustom:o}){const[i,l]=g.useState(""),u=e.length,h=U1(u),f=h!==null,p=f?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[m,w]=g.useState(null),b=g.useRef(0),k=g.useRef(new Map),v=g.useRef(null),N=g.useRef(null);g.useEffect(()=>{if(!m)return;const A=window.setTimeout(()=>w(null),4e3);return()=>window.clearTimeout(A)},[m]);const x=async A=>{l("");try{await A()}catch(O){l(O instanceof Error?O.message:"Custom audio could not be saved.")}},C=(A,O)=>{const M=Date.now(),W=yi({armedFor:m,target:A,armedAt:b.current,now:M,gapMs:gi});if(W==="arm"){w(A),b.current=M;return}if(W==="ignore")return;w(null);const B=Iee(e.map(R=>R.id),A);x(async()=>{var q;await o(A);const R=document.activeElement;R!==O&&!Wn((R==null?void 0:R.tagName)??null)||(q=B?k.current.get(B):v.current)==null||q.focus()})},{recording:S,startRecording:_,stopRecording:$}=Ebe({full:f,setCustomError:l,runCustom:x,onImportCustom:t});return r.jsxs(Bt,{id:"sm-custom-title",title:"Custom sounds",note:"Your own files, clips and voices, kept on this machine. Either tone above can play one.",aside:r.jsxs("span",{className:"settings-caption-count",children:[u," of ",q1]}),className:"sm-custom",settingId:"custom-sounds",children:[f&&r.jsx("p",{className:"settings-row settings-row-status",id:"sm-custom-full",children:h}),r.jsx(mt,{as:"div",settingId:"custom-import",name:"Import audio",note:"WAV, MP3 or OGG",control:r.jsx("button",{ref:v,type:"button",className:"btn sm-custom-action",...p,onClick:()=>{var A;f||(A=N.current)==null||A.click()},children:"Choose file"}),children:r.jsx("input",{ref:N,type:"file",hidden:!0,accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",onChange:A=>{var M;const O=(M=A.target.files)==null?void 0:M[0];A.currentTarget.value="",O&&!f&&x(()=>t(O))}})}),r.jsx(mt,{as:"div",settingId:"custom-record",name:"Record a clip",note:S?"Recording…":"Up to 5 seconds",control:S?r.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:$,children:"Stop & save"}):r.jsx("button",{type:"button",className:"btn sm-custom-action",...p,onClick:()=>void _(),children:"Record"})}),r.jsx(Tbe,{full:f,fullProps:p,runCustom:x,onCreateVoice:n}),e.map(A=>r.jsxs("div",{className:"sm-custom-item",children:[r.jsx("input",{className:"ap-manage-input","aria-label":`Rename ${A.name}`,defaultValue:A.name,maxLength:80,onBlur:O=>{if(!O.target.value.trim()){O.target.value=A.name;return}x(()=>s(A.id,O.target.value))},onKeyDown:O=>{O.key==="Enter"&&O.currentTarget.blur()}}),r.jsx("span",{children:A.kind==="audio"?`${A.duration.toFixed(1)}s`:"Voice"}),r.jsx("button",{type:"button",className:"btn sm-custom-icon","aria-label":`Play ${A.name}`,onClick:()=>a(A.id),children:"Play"}),r.jsx("button",{type:"button",ref:O=>{O?k.current.set(A.id,O):k.current.delete(A.id)},className:`btn sm-custom-icon${m===A.id?" armed":""}`,onKeyDown:O=>{O.repeat&&O.preventDefault()},onClick:O=>C(A.id,O.currentTarget),"aria-label":m===A.id?`Confirm deleting ${A.name}`:`Delete ${A.name}`,title:m===A.id?"Press again to delete this sound. It cannot be brought back.":"Delete this sound",children:m===A.id?"Confirm":"Delete"})]},A.id)),i&&r.jsx("p",{className:"settings-row settings-row-status sm-custom-error",role:"alert",children:i})]})}const Rbe="A tone when a turn finishes, and when Claude asks for something.";function Mbe({soundOn:e,onToggleSound:t}){const n=g.useId(),s=An(),a=g.useId();return r.jsx(Bt,{children:r.jsx(mt,{settingId:"play-sounds",name:"Play sounds",nameId:n,note:Rbe,noteId:a,control:r.jsxs(r.Fragment,{children:[s&&r.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:"Press M anywhere to mute or unmute",children:"M"}),r.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-labelledby":n,"aria-describedby":a,"aria-keyshortcuts":s?"M":void 0,className:"switch",onClick:t,children:r.jsx("span",{className:"switch-knob"})})]})})})}const Mj="custom:";function HO(e){return`${Mj}${e}`}function $be(e){return e.startsWith(Mj)?e.slice(Mj.length):null}function Lbe({id:e,label:t="Volume",value:n,step:s=DN,onLevel:a,"aria-describedby":o}){return r.jsxs("div",{className:"sm-row",children:[r.jsx("label",{htmlFor:e,children:t}),r.jsx("input",{id:e,type:"range",min:Pf,max:mp,step:s,value:n,"aria-describedby":o,onChange:i=>a(Number(i.target.value)),style:{"--sm-level":`${(n-Pf)/(mp-Pf)*100}%`}}),r.jsxs("span",{className:"sm-read",children:[n,"%"]})]})}const zO={done:"Turn finished","needs-input":"Claude is asking"},Ibe={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function Obe({chime:e,tone:t,soundOn:n,customAssets:s,customSelections:a,onLevel:o,onFigure:i,onPreview:l,onBuiltInSelected:u,onCustomSelected:h}){const f=`sm-level-${e}`,p=`sm-figure-${e}`,m=a[e];return r.jsxs(Bt,{id:`sm-name-${e}`,title:zO[e],note:Ibe[e],settingId:`tone-${e}`,aside:r.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(e),"aria-label":`Hear the ${zO[e].toLowerCase()} tone`,title:n?"Play this tone now, at what it is set to":"Plays even when sounds are off","aria-describedby":n?void 0:"sm-preview-note",children:[r.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]}),children:[r.jsx(Lbe,{id:f,value:t.level,onLevel:w=>o(e,w)}),r.jsxs("div",{className:"sm-row",children:[r.jsx("label",{htmlFor:p,children:"Tone"}),r.jsxs("select",{id:p,className:"sm-select",value:m?HO(m):t.figure,onChange:w=>{const b=w.target.value,k=$be(b);k!==null?h(e,k):(u(e),i(e,b))},children:[PN[e].map(w=>r.jsx("option",{value:w.id,children:w.label},w.id)),s.length>0&&r.jsx("optgroup",{label:"Custom",children:s.map(w=>r.jsx("option",{value:HO(w.id),children:w.name},w.id))})]})]})]})}const Pbe="Claude Code isn't on this machine, so only Turn finished plays here — for Codex turns.";function Dbe({soundOn:e,onToggleSound:t,prefs:n,claudeHere:s,onLevel:a,onFigure:o,onPreview:i,customAssets:l,customSelections:u,onBuiltInSelected:h,onCustomSelected:f,onImportCustom:p,onCreateVoice:m,onRenameCustom:w,onPreviewCustom:b,onDeleteCustom:k}){var C;const v=$ee(u),N=((C=l.find(S=>S.id===v))==null?void 0:C.name)??"the same custom sound",x=v?`Both tones use “${N}”. They may be harder to tell apart.`:"";return r.jsxs("div",{className:"sm-sounds",children:[r.jsx(Mbe,{soundOn:e,onToggleSound:t}),!s&&r.jsx("p",{className:"sm-note",children:Pbe}),!e&&r.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when sounds are off, so you can set a tone before turning sounds back on."}),r.jsx("div",{className:"sm-tones",children:Mu.map(S=>r.jsx(Obe,{chime:S,tone:n[S],soundOn:e,customAssets:l,customSelections:u,onLevel:a,onFigure:o,onPreview:i,onBuiltInSelected:h,onCustomSelected:f},S))}),x&&r.jsx("p",{className:"sm-note","aria-hidden":!0,children:x}),r.jsx("p",{className:"vis-hidden",role:"status",children:x}),r.jsx(Abe,{customAssets:l,onImportCustom:p,onCreateVoice:m,onRenameCustom:w,onPreviewCustom:b,onDeleteCustom:k})]})}const Fbe="Watches the telemetry Claude Code sends to its collector, always and in the background, even while Radar is closed. What it reads stays on this machine.";function Bbe({onOpen:e}){return r.jsx(Bt,{children:r.jsx(mt,{as:"div",settingId:"radar-open",name:"Radar",nameId:"settings-radar-open-name",note:Fbe,control:r.jsx("button",{type:"button",className:"btn",id:"settings-radar-open","aria-labelledby":"settings-radar-open settings-radar-open-name","aria-haspopup":"dialog",onClick:e,children:"Open"})})})}const qbe=6500,Ube=1e4;let ui={reading:null,saving:null,error:"",undone:null};const Wf=new Set;let pu=null,mu=null,la=null,J0=!1,Hf=0;const Jo=e=>{ui={...ui,...e},Wf.forEach(t=>t(ui))};function aB(e){const t=e;return!!t&&t.ok===!0&&Array.isArray(t.settings)&&typeof t.present=="object"}async function oB(e){const t=await fetch("/api/claude-settings",{signal:e}),n=await t.json();if(!t.ok||!aB(n))throw new Error;return n}async function $j(){if(J0||ui.saving)return;J0=!0;const e=Hf,t=new AbortController;la=t;let n=!1;const s=setTimeout(()=>{n=!0,t.abort()},5e3);try{const a=await oB(t.signal);e===Hf&&!t.signal.aborted&&Jo({reading:a,error:""})}catch{e===Hf&&(n||!t.signal.aborted)&&Jo({error:"Could not read Claude Code settings. Try again."})}finally{clearTimeout(s),J0=!1,la===t&&(la=null)}}function VO(e,t){var n;return(n=e==null?void 0:e.settings.find(s=>s.id===t))==null?void 0:n.value}async function GO(e,t){if(ui.saving)return;Hf++,la==null||la.abort(),mu&&(clearTimeout(mu),mu=null),Jo({saving:e,error:"",undone:null});const n=new AbortController,s=setTimeout(()=>n.abort(),15e3);try{const a=await fetch("/api/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,value:t}),signal:n.signal}),o=await a.json().catch(()=>null);if(!a.ok||!aB(o))throw new Error(typeof(o==null?void 0:o.error)=="string"?o.error:"Could not save the change. Try again.");Jo({reading:o});const i=VO(o,e);mu=setTimeout(()=>{mu=null;const l=new AbortController,u=setTimeout(()=>l.abort(),5e3);oB(l.signal).then(h=>{Jo({reading:h,undone:VO(h,e)===i?null:{id:e}})}).catch(()=>{}).finally(()=>clearTimeout(u))},qbe)}catch(a){Jo({error:a instanceof Error&&a.message?a.message:"Could not save the change. Try again."})}finally{clearTimeout(s),Jo({saving:null})}}function Wbe(){const[e,t]=g.useState(ui);return g.useEffect(()=>(Wf.add(t),t(ui),pu||($j(),pu=setInterval(()=>void $j(),Ube)),()=>{Wf.delete(t),Wf.size||(pu&&clearInterval(pu),pu=null,la==null||la.abort())}),[]),e}const Q0=40,Hbe={boolean:"on or off",choice:"a choice",number:"a number",text:"text",structured:"a list or object"};function zbe(e){const t=e.scope==="Global config"?"kept in ~/.claude.json":e.scope==="Managed"?"managed settings only":null;return[e.topic,Hbe[e.kind],t,e.since?`Claude Code ${e.since}+`:null].filter(Boolean).join(" · ")}function Vbe(e,t){const n=t.trim().toLowerCase();if(!n)return[];const s=e.filter(o=>o.key.toLowerCase().includes(n)),a=e.filter(o=>!s.includes(o)&&(o.topic??"").toLowerCase().includes(n));return[...s,...a]}let iB=null;const Gbe=()=>iB??(iB=bi(()=>import("./claude-settings-index-1Qg1AUda.js"),[]).then(e=>e.default.keys));function Kbe({present:e,noFile:t=!1}){const[n,s]=g.useState(null),[a,o]=g.useState(""),i=g.useId();g.useEffect(()=>{let f=!0;return Gbe().then(p=>{f&&s(p)},()=>{iB=null}),()=>{f=!1}},[]);const l=g.useMemo(()=>{if(!n)return[];if(a.trim())return Vbe(n,a);if(!e)return[];const f=n.filter(m=>Object.hasOwn(e,m.key)),p=Object.keys(e).filter(m=>!n.some(w=>w.key===m)).sort().map(m=>({key:m,topic:"Not in Claude Code's reference",scope:null,kind:"structured",default:null,since:null,anchor:""}));return[...f,...p]},[n,e,a]),u=l.slice(0,Q0),h=a.trim()!=="";return r.jsxs(Bt,{id:"claude-group-all",settingId:"claude-all-settings",title:"All Claude Code settings",note:h?void 0:e&&!t?"The keys your settings.json sets. Filter to look up any of them, and open the reference for what each does.":"Filter to look up any setting Claude Code documents, and open the reference for what each does.",aside:n?r.jsx("span",{className:"settings-caption-count",children:n.length}):void 0,list:!1,children:[r.jsxs("div",{className:"settings-filter",children:[r.jsx("label",{className:"vis-hidden",htmlFor:i,children:"Filter Claude Code settings"}),r.jsx("input",{id:i,type:"search",className:"settings-filter-field",placeholder:n?`Filter ${n.length} settings`:"Filter settings",autoComplete:"off",spellCheck:!1,value:a,onChange:f=>o(f.target.value),onKeyDown:f=>{nm(f.key)&&a&&(f.stopPropagation(),o(""))}})]}),u.length>0&&r.jsx("div",{className:"settings-list settings-keys",children:u.map(f=>{const p=e&&Object.hasOwn(e,f.key)?e[f.key]:null;return r.jsx(mt,{as:"div",name:r.jsx("code",{className:"claude-key",children:f.key}),note:zbe(f),control:r.jsxs(r.Fragment,{children:[p!==null&&r.jsx("span",{className:"settings-read",title:"In your settings.json",children:p}),f.anchor&&r.jsx("a",{className:"settings-link",href:`${wee}#${f.anchor}`,target:"_blank",rel:"noreferrer","aria-label":`${f.key} in Claude Code's settings reference`,children:"Reference"})]})},f.key)})}),h&&l.length===0&&n&&r.jsxs("p",{className:"settings-empty",role:"status",children:["No setting matches “",a.trim(),"”."]}),l.length>Q0&&r.jsxs("p",{className:"settings-foot",role:"status",children:[l.length-Q0," more. Type more of the name to narrow the list."]}),!h&&e&&!t&&n&&l.length===0&&r.jsx("p",{className:"settings-empty",children:"Your settings.json sets nothing yet."})]})}const Ybe="Changed back after saving, most likely by a running Claude Code session. Set it again to keep it.",Xbe="There is no settings.json yet, so Claude Code uses its defaults. The first change here creates it.";function Zbe(e){return`Saved in ${e??"your settings.json"}. A project's own .claude/settings.json, and policies set through MDM or the Windows registry, can override these rows and are not shown here.`}function Jbe(e){const t=`${e.env}=${e.value}`;return e.where==="environment"?`${e.effect} in sessions started with ${t}, as ccdeck was.`:`${e.effect} in every session: ${e.where==="user"?"your settings.json":"your organization"} sets ${t}.`}const KO="\0custom";function Qbe({entry:e,row:t,saving:n,nameId:s,noteId:a}){const o=!!t&&t.editable&&!n,i=!t||n===e.id,l=t?!t.editable:void 0;if(e.kind==="choice"||e.kind==="days"){const h=e.kind==="days"?e.options.map(m=>({value:String(m),label:fA(m)})):e.options,f=t?t.custom?KO:t.value===null?"":String(t.value):"",p=e.kind==="days"&&t&&!t.custom&&!h.some(m=>m.value===f)?[...h,{value:f,label:fA(Number(f))}].sort((m,w)=>Number(m.value)-Number(w.value)):h;return r.jsxs("select",{className:"sm-select","aria-labelledby":s,"aria-describedby":a,"aria-busy":i,disabled:l,value:f,onChange:m=>{if(!o)return;const w=m.target.value;GO(e.id,e.kind==="days"?Number(w):w===""?null:w)},children:[(t==null?void 0:t.custom)&&r.jsx("option",{value:KO,disabled:!0,children:"Custom value"}),p.map(m=>r.jsx("option",{value:m.value??"",children:m.label},m.value??""))]})}const u=(t==null?void 0:t.value)===!0;return r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":u,"aria-labelledby":s,"aria-describedby":a,"aria-busy":i,disabled:l,onClick:()=>{o&&GO(e.id,!u)},children:r.jsx("span",{className:"switch-knob"})})}function eke(e){if(!(e!=null&&e.settings.length)||e.settings.some(n=>n.editable))return null;const t=new Set(e.settings.map(n=>n.reason));return t.size===1?[...t][0]??null:null}function tke(){return r.jsx(nke,{state:Wbe()})}function nke({state:e}){const{reading:t,saving:n,error:s,undone:a}=e,o=eke(t),i=(t==null?void 0:t.userFile)==="absent",l=t?t.userFile!=="invalid"&&t.userFile!=="unreadable":!s;return r.jsxs(r.Fragment,{children:[(t===null||s||o||i)&&r.jsxs(Bt,{children:[t===null&&!s&&r.jsx("p",{className:"settings-row settings-row-status",role:"status",children:"Reading Claude Code settings…"}),o&&r.jsx("p",{className:"settings-row settings-row-status",role:"status",children:o}),i&&!o&&r.jsx("p",{className:"settings-row settings-row-status",role:"status",children:Xbe}),s&&r.jsxs("div",{className:"settings-row",role:"alert",children:[r.jsx("span",{className:"settings-row-name",children:s}),r.jsx("span",{className:"settings-row-control",children:r.jsx("button",{type:"button",className:"btn","aria-busy":!!n,onClick:()=>void $j(),children:"Retry"})})]})]}),l&&UD.map(u=>r.jsx(Bt,{id:`claude-group-${u.id}`,title:u.title,children:WD.filter(h=>h.group===u.id).map(h=>{const f=t==null?void 0:t.settings.find(b=>b.id===h.id),p=`claude-${h.id}-label`,m=`claude-${h.id}-note`,w=f&&!f.editable&&!o?f.reason:(a==null?void 0:a.id)===h.id?Ybe:f!=null&&f.override?Jbe(f.override):"";return r.jsx(mt,{settingId:`claude-${h.id}`,name:h.label,nameId:p,note:h.note,noteId:m,control:r.jsx(Qbe,{entry:h,row:f,saving:n,nameId:p,noteId:m}),children:r.jsx("span",{className:"settings-row-said settings-row-said-quiet",role:"status",children:w})},h.id)})},u.id)),l&&r.jsx("p",{className:"settings-foot",children:Zbe(t==null?void 0:t.fileShown)}),r.jsx(Kbe,{present:(t==null?void 0:t.present)??null,noFile:i})]})}const ske="Local statistics for Claude and Codex on this device. Commands are grouped by operation; raw arguments and outputs are not saved.";function rke(){const[e,t]=g.useState(null),[n,s]=g.useState(""),[a,o]=g.useState(!1),[i,l]=g.useState(null),[u,h]=g.useState(""),f=g.useRef(!1),p=g.useRef(!0),m=async()=>{if(f.current)return;f.current=!0,o(!0),s("");const k=new AbortController,v=window.setTimeout(()=>k.abort(),12e3);try{const N=await fetch("/api/tool-audit/storage",{signal:k.signal}),x=await N.json();if(!N.ok||!x.ok)throw new Error;p.current&&t(x)}catch{p.current&&s("Could not read tool history storage. Try again.")}finally{window.clearTimeout(v),f.current=!1,p.current&&o(!1)}};g.useEffect(()=>(p.current=!0,m(),()=>{p.current=!1}),[]);const w=async(k,v)=>{if(f.current)return;f.current=!0,o(!0),s(""),h("");let N=!1;const x=new AbortController,C=window.setTimeout(()=>x.abort(),15e3);try{const S=await fetch("/api/tool-audit/storage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k==="clear"?{action:k,confirm:!0}:{action:k,days:v}),signal:x.signal}),_=await S.json();if(!S.ok||!_.ok)throw new Error;N=!0,p.current&&(l(null),h(k==="clear"?"Tool history cleared. New calls will continue to be recorded.":`Retention changed to ${v} days.`))}catch{p.current&&s("Could not update tool history. Check storage permissions and try again.")}finally{window.clearTimeout(C),f.current=!1,p.current&&(o(!1),N&&m())}},b=i!==null&&r.jsxs("div",{className:"settings-row settings-row-wide ta-confirm",role:"group","aria-label":"Confirm",children:[r.jsx("p",{children:i==="clear"?"Delete all recorded tool statistics on this device? This cannot be undone.":`Keep ${i} days? Older calls will be permanently deleted.`}),r.jsxs("div",{children:[r.jsx("button",{type:"button",className:"btn danger","aria-busy":a,onClick:()=>{w(i==="clear"?"clear":"retention",typeof i=="number"?i:void 0)},children:i==="clear"?"Delete tool history":"Apply retention"}),r.jsx("button",{type:"button",className:"btn","aria-busy":a,onClick:()=>{f.current||l(null)},children:"Cancel"})]})]});return r.jsxs(Bt,{id:"tool-history-settings-title",title:"Tool history",note:ske,className:"ta-settings",children:[e?r.jsxs(r.Fragment,{children:[r.jsx(mt,{settingId:"tool-history-retention",name:"Keep history",nameId:"ta-keep-label",note:"Calls older than this are deleted.",control:r.jsx("select",{className:"sm-select","aria-labelledby":"ta-keep-label",value:e.retentionDays,"aria-busy":a,onChange:k=>{if(f.current)return;const v=Number(k.target.value);v<e.retentionDays?l(v):w("retention",v)},children:[30,60,90].map(k=>r.jsxs("option",{value:k,children:[k," days"]},k))})}),typeof i=="number"&&b,r.jsx(mt,{as:"div",settingId:"tool-history-size",name:"Space used",note:`Collected since ${Ete(e.startedAt)}`,control:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"settings-read",children:_te(e.bytes)}),r.jsx("button",{type:"button",className:"btn","aria-busy":a,onClick:()=>{m()},children:"Refresh"})]})}),r.jsx(mt,{as:"div",settingId:"tool-history-clear",name:"Clear history",note:"Deletes every recorded call on this device. New calls are still recorded.",control:r.jsx("button",{type:"button",className:"btn danger","aria-busy":a,onClick:()=>{f.current||l("clear")},children:"Clear…"})}),i==="clear"&&b,!e.storageOk&&r.jsx(mt,{as:"div",name:"Some calls could not be saved",note:"Check free space and storage permissions."})]}):r.jsx(mt,{as:"div",name:a?"Reading storage…":"Storage size unavailable."}),n&&r.jsxs("div",{className:"settings-row",role:"alert",children:[r.jsx("span",{className:"settings-row-name",children:n}),r.jsx("span",{className:"settings-row-control",children:r.jsx("button",{type:"button",className:"btn","aria-busy":a,onClick:()=>{m()},children:"Retry"})})]}),u&&r.jsx("p",{className:"settings-row settings-row-status",role:"status",children:u})]})}const Lj="agent-dag.integrations.active",zS=(e,t)=>`agent-dag.integrations.prefs.${e}:${t}`,ake=32e3;function YO(e,t){const n=nt(zS(e,t));if(!n)return{};try{const s=JSON.parse(n);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function kje(e,t){return{read(n,s){const a=YO(e,t)[n];return s(a)?a:void 0},write(n,s){const a=YO(e,t);s===void 0?delete a[n]:a[n]=s;const o=JSON.stringify(a);o.length<=ake&&st(zS(e,t),o)}}}function oke(e,t){ks(zS(e,t))}function jje(e){const t=nt(Lj);if(!t)return null;try{const n=JSON.parse(t),s=n&&typeof n=="object"?n[e]:null;return typeof s=="string"&&s.length<=80?s:null}catch{return null}}function Nje(e,t){let n={};try{const s=nt(Lj),a=s?JSON.parse(s):{};a&&typeof a=="object"&&!Array.isArray(a)&&(n=Object.fromEntries(Object.entries(a).filter(([,o])=>typeof o=="string").slice(0,20)))}catch{}n[e]=t,st(Lj,JSON.stringify(n))}function Ij(e){var s;const t=(s=e.meta)==null?void 0:s.checkedAt;if(!t)return null;const n=new Date(String(t));return Number.isNaN(n.getTime())?null:n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...n.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}function Oj(e){const t=e.meta??{};return e.kind==="gitlab"?typeof t.serverVersion=="string"&&t.serverVersion?`GitLab ${t.serverVersion}`:null:e.kind!=="jira"?null:t.deploymentType==="Cloud"?"Jira Cloud":t.deploymentType?`Jira ${t.deploymentType==="DataCenter"?"Data Center":String(t.deploymentType)}${t.serverVersion?` ${t.serverVersion}`:""}`:null}function ike({connection:e,provider:t,available:n,busy:s,armed:a,note:o,headingRef:i,onTest:l,onEdit:u,onDisconnect:h,onCancelDisconnect:f}){var S;const p=g.useRef(null),m=(t==null?void 0:t.label)??e.kind,w=e.account.name||e.account.login||"No account read yet",b=e.account.name&&e.account.login!==e.account.name?e.account.login:"",k=Ij(e),v=Oj(e),N=Array.isArray((S=e.meta)==null?void 0:S.warnings)?e.meta.warnings.filter(_=>typeof _=="string"):[],x=s===`test:${e.id}`,C=s===`delete:${e.id}`;return r.jsxs("section",{className:"ig-connection-details","aria-labelledby":"ig-managed-title",children:[r.jsxs("header",{className:"ig-managed-header",children:[t&&r.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:r.jsx(t.Glyph,{})}),r.jsxs("div",{className:"ig-managed-identity",children:[r.jsx("h2",{ref:i,tabIndex:-1,id:"ig-managed-title",className:"ig-managed-title",children:e.name||e.baseUrl}),r.jsxs("p",{children:[m," · Saved connection"]})]})]}),r.jsxs("dl",{className:"ig-detail-facts",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Host"}),r.jsx("dd",{children:e.baseUrl})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Account"}),r.jsxs("dd",{children:[w,b?` (${b})`:""]})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Last verified"}),r.jsx("dd",{children:k??"No verification time available"})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Credentials"}),r.jsx("dd",{children:e.tokenSaved?"Stored locally":"No token saved"})]}),v&&r.jsxs("div",{children:[r.jsx("dt",{children:"Server"}),r.jsx("dd",{children:v})]})]}),!n&&r.jsxs("p",{className:"ig-stranded",children:[m," is not available on this deck. Disconnect deletes this connection and its saved token."]}),N.length>0&&r.jsx("ul",{className:"ig-warnings",children:N.map(_=>r.jsx("li",{children:_},_))}),n&&r.jsxs("div",{className:"ig-manage-actions",children:[r.jsx("button",{type:"button",className:"btn","aria-busy":x,"aria-disabled":s!==null||void 0,onClick:l,children:x?"Testing…":"Test connection"}),r.jsx("button",{type:"button",className:"btn","aria-disabled":s!==null||void 0,onClick:_=>{s===null&&u(_.currentTarget)},children:"Edit connection"})]}),o&&o.scope!=="disconnect"&&r.jsx("p",{className:"ig-note","data-tone":o.tone,role:o.tone==="err"?"alert":"status",children:o.text}),r.jsxs("div",{className:"ig-disconnect-section",children:[r.jsx("h3",{children:"Remove connection"}),r.jsx("p",{children:"Remove this connection and its saved token from this machine."}),r.jsxs("div",{className:"ig-manage-actions","data-integration-disconnect-actions":!0,onBlur:_=>{a&&!_.currentTarget.contains(_.relatedTarget)&&f()},children:[r.jsx("button",{ref:p,type:"button","data-integration-disconnect":!0,className:`btn danger${a?" armed":""}`,"aria-busy":C,"aria-disabled":s!==null||void 0,onKeyDown:_=>{_.repeat&&_.preventDefault()},"aria-label":a?`Confirm disconnecting ${e.name}`:`Disconnect ${e.name}`,onClick:_=>h(_.currentTarget),children:C?"Disconnecting…":a?"Confirm disconnect":"Disconnect"}),a&&r.jsx("button",{type:"button",className:"btn","aria-disabled":s!==null||void 0,"aria-label":"Cancel disconnect",onClick:()=>{var _;s===null&&(f(),(_=p.current)==null||_.focus())},children:"Cancel"})]}),a&&r.jsx("p",{className:"ig-note",role:"status",children:"Press Confirm disconnect to delete this connection and its saved token, or Cancel to keep it."}),(o==null?void 0:o.scope)==="disconnect"&&r.jsx("p",{className:"ig-note","data-tone":o.tone,role:o.tone==="err"?"alert":"status",children:o.text})]})]})}function lke({onBeforeLeaveChange:e}={}){var He;const t=$d(),{connections:n,error:s}=t,[a,o]=g.useState(null),i=g.useRef(null),l=g.useRef(new Map),u=g.useRef(null),h=g.useRef(0),[f,p]=g.useState(null),[m,w]=g.useState(""),b=g.useRef(null),k=g.useRef(null),[v,N]=g.useState(null),[x,C]=g.useState(null),S=g.useRef(null),[_,$]=g.useState(null),[A,O]=g.useState([]),[M,W]=g.useState(null),B=g.useRef(0),[R,q]=g.useState(null),T=g.useRef(null),F=g.useRef(new Map),D=g.useRef(null),K=g.useRef(0),[V,H]=g.useState(!1),[P,I]=g.useState(null),U=g.useRef(null),Z=g.useRef(new Map),z=g.useRef(new Map);g.useEffect(()=>{const se=Yye();se&&(D.current=Z.current.get(se)??null,p(se),q(se),N({mode:"edit",id:se}));const ke=Kye();ke&&N({mode:"add",kind:ke})},[]),g.useEffect(()=>{var se,ke;!R||!n||(ke=(se=z.current.get(R))==null?void 0:se.scrollIntoView)==null||ke.call(se,{block:"nearest"})},[R,n]),g.useEffect(()=>{if(!M)return;const se=()=>{var Oe,be;((Oe=document.activeElement)==null?void 0:Oe.getAttribute("aria-label"))==="Cancel disconnect"&&((be=document.querySelector(".ig-manage-view [data-integration-disconnect]"))==null||be.focus()),W(null)},ke=()=>{document.hidden&&se()},Ae=window.setTimeout(()=>{var Oe;(Oe=document.querySelector("[data-integration-disconnect-actions]"))!=null&&Oe.contains(document.activeElement)||se()},4e3);return window.addEventListener("blur",se),document.addEventListener("visibilitychange",ke),()=>{window.clearTimeout(Ae),window.removeEventListener("blur",se),document.removeEventListener("visibilitychange",ke)}},[M]);const X=(se,ke,Ae,Oe)=>O(be=>[...be.filter(fe=>fe.id!==se),{id:se,tone:ke,text:Ae,scope:Oe}]),Y=se=>O(ke=>ke.filter(Ae=>Ae.id!==se)),J=async(se,ke)=>{if(!S.current){S.current=se,C(se);try{await ke()}finally{S.current=null,C(null)}}},Q=se=>(ke,Ae)=>void J("form",async()=>{$(null);try{const Oe=await Wye(se,ke,Ae||void 0);N(null),I(null),H(!1),p(null),o(null),w("Connection added."),X(Oe.id,"ok",`Connection saved and tested as ${Oe.account.name||Oe.account.login}.`),q(Oe.id),T.current=()=>{var fe;const be=l.current.get(Oe.kind)??Z.current.get(Oe.id);return(fe=be==null?void 0:be.scrollIntoView)==null||fe.call(be,{block:"nearest"}),be}}catch(Oe){$(Oe instanceof vr?Oe:new vr("upstream","The connection could not be saved."))}}),te=se=>(ke,Ae)=>void J("form",async()=>{$(null);try{const{connection:Oe,validated:be}=await Hye(se.id,{name:Ae,input:ke});N(null),I(null),H(!1),T.current=()=>k.current??(f?b.current:Z.current.get(Oe.id)),X(Oe.id,"ok",be?`Saved. Connection test passed as ${Oe.account.name||Oe.account.login}.`:"Saved.")}catch(Oe){$(Oe instanceof vr?Oe:new vr("upstream","The change could not be saved."))}}),le=se=>void J(`test:${se.id}`,async()=>{W(null),Y(se.id);try{const ke=await zye(se.id);X(se.id,"ok",`Connection test passed. Signed in as ${ke.account.name||ke.account.login}.`)}catch(ke){X(se.id,"err",ke instanceof Error?ke.message:"The test failed.")}}),de=(se,ke)=>{if(S.current)return;const Ae=Date.now(),Oe=yi({armedFor:M,target:se.id,armedAt:B.current,now:Ae,gapMs:gi});if(Oe==="arm"){ke.focus({preventScroll:!0}),W(se.id),B.current=Ae;return}Oe!=="ignore"&&(W(null),J(`delete:${se.id}`,async()=>{try{await Vye(se.id),oke(se.kind,se.id),Y(se.id),(v==null?void 0:v.mode)==="edit"&&v.id===se.id&&N(null),p(null);const be=(n??[]).filter(_e=>_e.kind===se.kind&&_e.id!==se.id);(!a||be.length===0)&&o(null),w("Connection disconnected.");const fe=document.activeElement;(fe===ke||Wn((fe==null?void 0:fe.tagName)??null))&&(T.current=()=>{var Ve;const _e=(a&&be[0]?Z.current.get(be[0].id):l.current.get(se.kind))??F.current.get(se.kind)??document.getElementById("settings-tab-integrations");return(Ve=_e==null?void 0:_e.scrollIntoView)==null||Ve.call(_e,{block:"nearest"}),_e})}catch(be){X(se.id,"err",be instanceof Error?be.message:"The connection could not be removed. Try again.","disconnect")}}))};g.useEffect(()=>{if(x!==null||P||!T.current)return;const se=T.current();T.current=null,se!=null&&se.isConnected&&(se.checkVisibility?se.checkVisibility():se.getClientRects().length>0)&&se.focus({preventScroll:!0})},[n,f,a,v,x,P]);const oe=n??[],re=Ld(t),he=["github","gitlab","jira"],pe=qS().filter(se=>re.has(se.kind)||oe.some(ke=>ke.kind===se.kind)).sort((se,ke)=>he.indexOf(se.kind)-he.indexOf(ke.kind)),Le=WS(t),ge=g.useCallback(()=>{N(null),p(null),o(null),H(!1),I(null),$(null),W(null),T.current=()=>{const se=D.current,ke=se==null?void 0:se.closest(".settings-pane");return ke&&(ke.scrollTop=K.current),se!=null&&se.isConnected?se:document.getElementById("settings-tab-integrations")}},[]),ve=g.useCallback(()=>{if(!a){ge();return}p(null),N(null),H(!1),I(null),$(null),W(null),T.current=()=>{var Ae;const se=(Ae=u.current)!=null&&Ae.isConnected?u.current:i.current,ke=se==null?void 0:se.closest(".settings-pane");return ke&&(ke.scrollTop=se===i.current?0:h.current),se}},[a,ge]),je=g.useCallback(()=>{if(!f&&!a){ge();return}N(null),H(!1),I(null),$(null),T.current=()=>k.current??(f?b.current:i.current)},[f,a,ge]),Ee=g.useCallback((se,ke=!1)=>{if(S.current)return;if(P&&ke){I(null),requestAnimationFrame(()=>{var Oe;return(Oe=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:Oe.focus()});return}const Ae=ke?v?je:f?ve:ge:()=>{N(null),p(null),o(null),se()};V?I(()=>Ae):(H(!1),Ae())},[V,P,v,f,je,ve,ge]);g.useEffect(()=>(e==null||e(v||f||a?Ee:null),()=>e==null?void 0:e(null)),[v,f,a,Ee,e]),g.useEffect(()=>{var se;P&&((se=U.current)==null||se.focus())},[P]),g.useEffect(()=>{var se;f&&((se=b.current)==null||se.focus())},[f]),g.useEffect(()=>{var se;a&&((se=i.current)==null||se.focus())},[a]);const xe=(se,ke)=>{var Oe;if(S.current)return;T.current=null,I(null),w(""),W(null),f||a?k.current=ke:(K.current=((Oe=ke.closest(".settings-pane"))==null?void 0:Oe.scrollTop)??0,D.current=ke,k.current=null),H(!1),$(null),N(se);const Ae=ke.closest(".settings-pane");Ae&&(Ae.scrollTop=0)},Ie=(se,ke)=>{var Oe,be;if(S.current)return;T.current=null,a?(u.current=ke,h.current=((Oe=ke.closest(".settings-pane"))==null?void 0:Oe.scrollTop)??0):(K.current=((be=ke.closest(".settings-pane"))==null?void 0:be.scrollTop)??0,D.current=ke),k.current=null,w(""),W(null),p(se.id);const Ae=ke.closest(".settings-pane");Ae&&(Ae.scrollTop=0)},De=(se,ke)=>{var be;const Ae=oe.filter(fe=>fe.kind===se);if(Ae.length===1){Ie(Ae[0],ke);return}if(S.current)return;T.current=null,K.current=((be=ke.closest(".settings-pane"))==null?void 0:be.scrollTop)??0,D.current=ke,u.current=null,h.current=0,w(""),W(null),o(se);const Oe=ke.closest(".settings-pane");Oe&&(Oe.scrollTop=0)},We=(se,ke=!1)=>{const Ae=_u(se.kind),Oe=!ra(t,se.kind),be=Ij(se),fe=se.account.login||se.account.name,_e=se.kind==="jira"?Oj(se):null;return r.jsx("div",{className:"ig-conn",ref:Ve=>{Ve?z.current.set(se.id,Ve):z.current.delete(se.id)},children:r.jsxs("div",{className:"ig-summary-row",children:[r.jsxs("div",{className:"ig-summary-text",children:[r.jsx("span",{className:"ig-conn-name",children:ke&&se.name||Vo(se)}),r.jsx("span",{className:"ig-conn-line",children:[ke&&se.name!==Vo(se)?Vo(se):"",fe,_e||(be?`Last verified ${be}`:"Not verified yet")].filter(Boolean).join(" · ")||"No account read yet"}),!se.tokenSaved&&r.jsx("span",{className:"ig-bad",children:"No token saved"}),Oe&&r.jsxs("span",{className:"ig-stranded",children:[(Ae==null?void 0:Ae.label)??se.kind," is not available on this deck. Manage this connection to disconnect it."]})]}),r.jsxs("button",{type:"button",className:"btn ig-manage",ref:Ve=>{Ve?Z.current.set(se.id,Ve):Z.current.delete(se.id)},"aria-label":`Manage ${(Ae==null?void 0:Ae.label)??se.kind}: ${se.name} (${fe||Vo(se)})`,onClick:Ve=>Ie(se,Ve.currentTarget),children:["Manage ",r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m6 4 4 4-4 4"})})]})]})},se.id)},Ke=oe.filter(se=>!pe.some(ke=>ke.kind===se.kind)),ye=a?_u(a):null,Fe=oe.filter(se=>se.kind===a),$e=oe.find(se=>se.id===f),Re=(v==null?void 0:v.mode)==="edit"?oe.find(se=>se.id===v.id):void 0,rt=(v==null?void 0:v.mode)==="add"?pe.find(se=>re.has(se.kind)&&se.kind===v.kind):Re&&pe.find(se=>re.has(se.kind)&&se.kind===Re.kind);return r.jsxs("div",{className:"ig-settings","data-view":v?"form":f?"connection":a?"provider":"overview",children:[v&&r.jsxs("div",{className:"ig-config-view",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":x!==null||void 0,onClick:()=>Ee(je,!0),children:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),f?"Back to connection":a?`Back to ${(ye==null?void 0:ye.label)??a} connections`:"All integrations"]}),P&&r.jsxs("div",{className:"ig-leave-confirm",role:"group","aria-labelledby":"ig-leave-title",children:[r.jsx("strong",{id:"ig-leave-title",children:"Discard unsaved changes?"}),r.jsx("p",{children:"Your changes have not been saved. Discarding clears this form, including any token you entered."}),r.jsxs("div",{className:"ig-form-actions",children:[r.jsx("button",{ref:U,type:"button",className:"btn",onClick:()=>{I(null),requestAnimationFrame(()=>{var se;return(se=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:se.focus()})},children:"Keep editing"}),r.jsx("button",{type:"button",className:"btn danger",onClick:()=>{const se=P;I(null),H(!1),N(null),se()},children:"Discard changes"})]})]}),r.jsx("div",{hidden:!!P,children:rt?r.jsx(xye,{def:rt,existing:Re,busy:x==="form",error:_,onDirtyChange:H,onSubmit:v.mode==="add"?Q(v.kind):te(Re),onCancel:()=>Ee(je,!0)},v.mode==="add"?v.kind:v.id):r.jsxs("div",{role:"status",children:[r.jsx("p",{children:"This provider or connection is no longer available."}),r.jsx("button",{type:"button",className:"btn",onClick:je,children:"Back to integrations"})]})})]}),a&&r.jsxs("div",{className:"ig-provider-view",hidden:v!==null||f!==null,children:[r.jsxs("div",{className:"ig-manage-navigation",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":x!==null||void 0,onClick:()=>Ee(ge,!0),children:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),"All integrations"]}),ra(t,a)&&r.jsxs("button",{type:"button",className:"btn","aria-disabled":x!==null||void 0,onClick:se=>xe({mode:"add",kind:a},se.currentTarget),children:["Add ",(ye==null?void 0:ye.label)??a," connection"]})]}),r.jsxs("h2",{ref:i,tabIndex:-1,className:"ig-managed-title",children:[(ye==null?void 0:ye.label)??a," connections"]}),m&&r.jsx("p",{className:"ig-note",role:"status",children:m}),Fe.length?r.jsx("div",{className:"ig-provider-connections",children:Fe.map(se=>We(se,!0))}):r.jsx("p",{role:"status",children:"No saved connections."})]}),f&&r.jsxs("div",{className:"ig-manage-view",hidden:v!==null,children:[r.jsxs("div",{className:"ig-manage-navigation",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":x!==null||void 0,onClick:()=>Ee(ve,!0),children:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),a?`Back to ${(ye==null?void 0:ye.label)??a} connections`:"All integrations"]}),$e&&ra(t,$e.kind)&&r.jsxs("button",{type:"button",className:"btn","aria-disabled":x!==null||void 0,onClick:se=>xe({mode:"add",kind:$e.kind},se.currentTarget),children:["Add ",((He=_u($e.kind))==null?void 0:He.label)??$e.kind," connection"]})]}),$e?r.jsx(ike,{connection:$e,provider:_u($e.kind),available:ra(t,$e.kind),busy:x,armed:M===f,note:A.find(se=>se.id===f),headingRef:b,onTest:()=>le($e),onEdit:se=>xe({mode:"edit",id:$e.id},se),onDisconnect:se=>de($e,se),onCancelDisconnect:()=>W(null)}):r.jsx("p",{role:"status",children:"This connection is no longer saved."})]}),r.jsxs("div",{className:"ig-overview",hidden:v!==null||f!==null||a!==null,children:[s&&r.jsxs("div",{className:"ig-list-error",role:"alert",children:[r.jsx("p",{children:s}),r.jsx("button",{type:"button",className:"btn",onClick:()=>void Gm(),children:"Retry"})]}),n===null&&!s&&r.jsx("p",{role:"status",children:"Reading connections…"}),m&&r.jsx("p",{className:"ig-note",role:"status",children:m}),r.jsxs("div",{className:"ig-connection-list","data-setting":"integrations-connections",children:[n!==null&&r.jsx("div",{className:"ig-providers","data-setting":"integrations-add",id:Le==="all"?"integrations-add-title":void 0,children:pe.map(se=>{const ke=oe.filter(_e=>_e.kind===se.kind),Ae=ke.length===1?ke[0]:null,Oe=[...new Set(ke.map(Vo))],be=Ae&&Ij(Ae),fe=(Ae==null?void 0:Ae.kind)==="jira"?Oj(Ae):null;return r.jsxs("section",{className:"ig-provider",id:`ig-provider-${se.kind}`,"aria-labelledby":`ig-provider-name-${se.kind}`,"data-setting":`integration-${se.kind}`,children:[r.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:r.jsx(se.Glyph,{})}),r.jsxs("div",{className:"ig-summary-text ig-provider-content",children:[r.jsx("h3",{id:`ig-provider-name-${se.kind}`,children:se.label}),ke.length===0?r.jsx("span",{className:"ig-conn-line",children:"Not connected"}):Ae?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"ig-conn-name",children:Vo(Ae)}),r.jsx("span",{className:"ig-conn-line",children:[Ae.account.login||Ae.account.name,fe||(be?`Last verified ${be}`:"Not verified yet")].filter(Boolean).join(" · ")}),!Ae.tokenSaved&&r.jsx("span",{className:"ig-bad",children:"No token saved"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"ig-conn-name",children:[ke.length," saved connections"]}),r.jsxs("span",{className:"ig-conn-line",children:[Oe.slice(0,2).join(" · "),Oe.length>2?` · +${Oe.length-2} more instances`:""]})]}),!re.has(se.kind)&&r.jsxs("span",{className:"ig-stranded",children:[se.label," is not available on this deck."]})]}),r.jsx("button",{type:"button",className:`btn ig-manage${ke.length?"":" primary"}`,"aria-disabled":x!==null||void 0,ref:_e=>{const Ve=ke.length?l.current:F.current;_e?Ve.set(se.kind,_e):Ve.delete(se.kind)},"aria-label":`${ke.length?"Manage":"Connect"} ${se.label}`,onClick:_e=>ke.length?De(se.kind,_e.currentTarget):xe({mode:"add",kind:se.kind},_e.currentTarget),children:ke.length?r.jsxs(r.Fragment,{children:["Manage ",r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m6 4 4 4-4 4"})})]}):"Connect"})]},se.kind)})}),(Ke.length>0||pe.length===0&&Le!=="all"&&n!==null)&&r.jsxs(Bt,{id:"integrations-list-title",title:"Connections",aside:r.jsx("span",{className:"settings-caption-count",children:Ke.length}),children:[Ke.map(se=>We(se,!0)),oe.length===0&&r.jsx("p",{className:"settings-row settings-row-status",children:"Nothing connected."})]})]}),Le==="all"&&r.jsx(r.Fragment,{children:r.jsx("div",{className:"ig-overview-info",children:r.jsxs("details",{className:"ig-access",children:[r.jsx("summary",{children:"Access and token storage"}),r.jsx("p",{children:"Browsing integrations only reads. Jira also saves sprint and rank changes when you drag an issue or confirm Move, subject to your Jira permissions. GitHub and GitLab remain read-only. Tokens stay on this machine and are never shown again or shared with paired decks."})]})})})]})]})}function cke({theme:e}){return r.jsx("span",{className:"appearance-preview","data-swatch":e,children:r.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[r.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),r.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),r.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),r.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),r.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),r.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),r.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),r.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),r.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),r.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function uke({theme:e,onTheme:t,singleKeys:n}){const s=i=>{var f,p;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(i.key))return;i.preventDefault();const l=(f=i.target.closest("[data-theme-choice]"))==null?void 0:f.dataset.themeChoice,h=(gr.indexOf(l??e)+(i.key==="ArrowLeft"||i.key==="ArrowUp"?-1:1)+gr.length)%gr.length;t(gr[h]),(p=i.currentTarget.querySelectorAll('[role="radio"]')[h])==null||p.focus()},a=g.useRef(null),o=g.useRef(e);return g.useEffect(()=>{var u,h;const i=o.current;o.current=e;const l=document.activeElement;i===e||!l||!((u=a.current)!=null&&u.contains(l))||l.dataset.themeChoice!==i||(h=a.current.querySelector(`[data-theme-choice="${e}"]`))==null||h.focus()},[e]),r.jsx(Bt,{id:"appearance-theme-caption",title:"Theme",list:!1,settingId:"theme",aside:n&&r.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:"Press T anywhere to switch themes",children:"T"}),children:r.jsx("div",{ref:a,className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":n?"T":void 0,onKeyDown:s,children:gr.map(i=>r.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","data-theme-choice":i,"data-setting":`theme-${i}`,"aria-checked":e===i,tabIndex:e===i?0:-1,onClick:()=>t(i),children:[r.jsx(cke,{theme:i}),r.jsxs("span",{className:"appearance-theme-name",children:[oc[i].name,r.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:r.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},i))})})}const dke=[["smallest","Smallest","11 px"],["smaller","Smaller","12 px"],["default","Default","13 px"],["larger","Larger","15 px"],["largest","Largest","17 px"]],hke=[["tightest","Tightest","30%"],["tighter","Tighter","50%"],["compact","Compact","70%"],["default","Default","100%"],["comfortable","Comfortable","140%"]];function XO(){return r.jsx("svg",{className:"reading-selected-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",children:r.jsx("path",{d:"m2.5 6 2.2 2.2 4.8-4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fke({textSize:e,density:t,onTextSize:n,onDensity:s}){const a=e!=="default"||t!=="default";return r.jsx("button",{type:"button",className:"btn",disabled:!a,onClick:()=>{n("default"),s("default")},children:"Reset to defaults"})}function pke({textSize:e,density:t,onTextSize:n,onDensity:s}){return r.jsxs(r.Fragment,{children:[r.jsxs("fieldset",{className:"reading-group",children:[r.jsx("legend",{children:"Text size"}),r.jsx("p",{id:"reading-size-help",children:"Adjust interface text without changing your browser zoom."}),r.jsx("div",{className:"reading-options reading-segmented","aria-describedby":"reading-size-help","data-setting":"text-size",style:{"--reading-count":jA.length,"--reading-selected":jA.indexOf(e)},children:dke.map(([a,o,i])=>r.jsxs("label",{className:"reading-choice","data-size":a,children:[r.jsx("input",{type:"radio",name:"text-size","aria-label":`${o} ${i}`,value:a,checked:e===a,onChange:()=>n(a)}),r.jsx("span",{className:"reading-type-sample","aria-hidden":"true",children:"Aa"}),r.jsxs("span",{className:"reading-label",children:[r.jsx("strong",{children:o}),r.jsx("small",{children:i})]}),r.jsx(XO,{})]},a))})]}),r.jsxs("fieldset",{className:"reading-group",children:[r.jsx("legend",{children:"Density"}),r.jsx("p",{id:"reading-density-help",children:"Choose the spacing in lists, panels and controls. Text size stays the same."}),r.jsx("div",{className:"reading-options reading-segmented","aria-describedby":"reading-density-help","data-setting":"density",style:{"--reading-count":NA.length,"--reading-selected":NA.indexOf(t)},children:hke.map(([a,o,i])=>r.jsxs("label",{className:"reading-choice",children:[r.jsx("input",{type:"radio",name:"density","aria-label":`${o} ${i} spacing`,value:a,checked:t===a,onChange:()=>s(a)}),r.jsxs("span",{className:"reading-density-sample","data-density":a,"aria-hidden":"true",children:[r.jsx("i",{}),r.jsx("i",{}),r.jsx("i",{})]}),r.jsxs("span",{className:"reading-label",children:[r.jsx("strong",{children:o}),r.jsx("small",{children:i})]}),r.jsx(XO,{})]},a))})]}),r.jsxs(Bt,{id:"reading-preview-title",title:"Preview",children:[r.jsxs("div",{className:"reading-preview-row",children:[r.jsxs("div",{children:[r.jsx("strong",{children:"Frontend session"}),r.jsx("span",{children:"Waiting for your review"})]}),r.jsx("span",{className:"reading-preview-time",children:"4m"})]}),r.jsxs("div",{className:"reading-preview-row",children:[r.jsxs("div",{children:[r.jsx("strong",{children:"API integration"}),r.jsx("span",{children:"Working · 3 tool calls"})]}),r.jsx("span",{className:"reading-preview-time",children:"12m"})]})]}),r.jsx("p",{className:"settings-foot",children:"Preferences stay in this browser when storage is available. Default restores the existing ccdeck appearance."})]})}const mke="AGPL-3.0-only",gke="GNU Affero General Public License, version 3 only.",yke="https://github.com/BarganConstantin/ccdeck",wke="What changed in each release, newest first.",xke="Tell the people who make ccdeck what works and what does not.";function vke(e){return`This page is from v${e}. The deck has most likely been updated since this tab opened, and a reload picks up the new version.`}function bke(e,t){return lo(e)&&lo(t)&&vi(e,t)<0}function kke(e,t){return e?{kind:"ready",to:e.version,name:"Update ready",note:`${Pt} v${e.version} is downloaded and verified.`}:t?t.kind==="restart"?{kind:"notice",name:"Update installed",note:`v${t.to} is installed — this deck still runs v${t.from}.`}:{kind:"notice",name:"Update available",note:`${Pt} v${t.to} is out — you are on v${t.from}.`}:null}function jke({version:e,notice:t,readyAppUpdate:n,updateRestarting:s,updateFailure:a,onUpdateRestart:o,doors:i,bundle:l="3.48.0"}){const u=(e==null?void 0:e.running)??l,h=kke(n,t);return r.jsxs(r.Fragment,{children:[r.jsxs(Bt,{id:"settings-about-caption",title:Pt,children:[r.jsx(mt,{as:"div",settingId:"version",name:"Version",note:bke(l,e==null?void 0:e.running)?vke(l):void 0,control:r.jsx("span",{className:"settings-read",children:u})}),h&&r.jsx(Nke,{offer:h,restarting:s,failure:a,onRestart:o,onUpdate:i.update}),r.jsx(mt,{as:"div",settingId:"whats-new",name:"What's new",note:wke,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":"Open What's new",onClick:i.whatsNew,children:"Open"})}),r.jsx(mt,{as:"div",settingId:"licence",name:"Licence",note:gke,control:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"settings-read",children:mke}),r.jsxs("a",{className:"settings-link",href:yke,target:"_blank",rel:"noreferrer",children:["Source",r.jsx("span",{className:"vis-hidden",children:": the source code, opens in your browser"})]})]})})]}),r.jsxs(Bt,{id:"settings-about-help-caption",title:"Tour and feedback",children:[r.jsx(mt,{as:"div",settingId:"tour",name:"Take the tour",note:Rj,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":"Start the tour",onClick:i.tour,children:"Start"})}),r.jsx(mt,{as:"div",settingId:"feedback",name:"Send feedback",note:xke,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":"Open the feedback dialog",onClick:i.feedback,children:"Open"})})]})]})}function Nke({offer:e,restarting:t,failure:n,onRestart:s,onUpdate:a}){if(e.kind==="notice")return r.jsx(mt,{as:"div",name:e.name,note:e.note,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog",onClick:a,children:"Update…"})});const o=I8(e.to,t),i=n&&n.version===e.to?O8(n.failure,n.version):"";return r.jsx(mt,{as:"div",name:e.name,note:e.note,control:r.jsx("button",{type:"button",className:"btn",onClick:()=>s(e.to),"aria-busy":t||void 0,"aria-label":o.label,title:o.title,children:o.text}),children:r.jsx("span",{className:"settings-row-said",role:"status",children:i})})}const Ske="Update when idle",Cke="When nothing has been running for 30 seconds, the deck restarts into a newer version. While you are looking at it, that is one already installed, and only while its notice is up; while nobody is, it installs the new version first. Off, it updates only when you press.",_ke=`${nB} It hears of no new release from npm, and restarts only into a version installed some other way, once nothing has been running for 30 seconds.`,Eke="This deck cannot restart itself (it runs without its supervisor, with --no-persist, or cannot write its event log), so nothing updates on its own here. Your choice is saved for the next start.",Tke="The desktop app keeps itself up to date. It installs a new version once it has been left alone and no agent has been working for a minute, or after waiting a day for that.";function Ake(e,t){return t&&(e!=null&&e.checkDisabled)?"app":(e==null?void 0:e.canRestart)===!1?"no-restart":e!=null&&e.checkDisabled?"checks-off":"plain"}const Rke={plain:Cke,"checks-off":_ke,"no-restart":Eke};function Mke({autoRestart:e,onToggleAutoRestart:t,version:n,inApp:s=co()}){const a=Ake(n,s);return r.jsx(Bt,{id:"settings-updates-caption",title:"Updates",children:a==="app"?r.jsx(mt,{as:"div",settingId:"auto-update",name:"Updates",note:Tke}):r.jsx(mt,{settingId:"auto-update",name:Ske,nameId:"settings-auto-update-label",note:a==="no-restart"?"Automatic updates are unavailable in this session. Your choice is saved for the next start.":a==="checks-off"?"Update checks are disabled. Only versions installed another way can be applied.":"Restart into a newer version after 30 seconds without active agents.",details:Rke[a],noteId:"settings-auto-update-note",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":e,"aria-labelledby":"settings-auto-update-label","aria-describedby":"settings-auto-update-note",onClick:t,children:r.jsx("span",{className:"switch-knob"})})})})}function $ke({character:e,onCharacter:t}){const n=g.useRef([]);function s(a,o){var l;const i=uS(a,o,Of.length,"vertical");i.kind==="select"&&(a.preventDefault(),t(Of[i.index].id),(l=n.current[i.index])==null||l.focus())}return r.jsx("div",{className:"character-picker",role:"radiogroup","aria-label":"Choose character","data-setting":"character-choice",children:Of.map((a,o)=>r.jsxs("button",{type:"button",className:"character-choice",role:"radio","aria-checked":e===a.id,tabIndex:e===a.id?0:-1,ref:i=>{n.current[o]=i},onClick:()=>t(a.id),onKeyDown:i=>s(i,o),children:[r.jsx("span",{className:"character-preview",children:r.jsx(yD,{character:a.id,act:null,facing:"right"})}),r.jsx("span",{children:a.name}),r.jsx("svg",{className:"character-check",viewBox:"0 0 16 16","aria-hidden":!0,focusable:"false",children:r.jsx("path",{d:"m3 8 3 3 7-7",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})})]},a.id))})}const Lke="Stands beside the minimap. Press it to play the radio.";function Ike({characterEnabled:e,onToggleCharacter:t,character:n="deck",onCharacter:s}){return r.jsxs(Bt,{id:"appearance-character-caption",title:"Character",list:!1,children:[r.jsx("div",{className:"settings-list",children:r.jsx(mt,{settingId:"character",name:"Show the character",nameId:"appearance-character-label",note:Lke,noteId:"appearance-character-note",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":e,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:t,children:r.jsx("span",{className:"switch-knob"})})})}),r.jsx($ke,{character:n,onCharacter:s})]})}const ZO="settings-search-field",lB="settings-search-results",Pj=e=>`settings-result-${e}`;function Oke({inputRef:e,query:t,onQuery:n,results:s,active:a,onActive:o,onOpen:i}){const l=t.trim()!=="",u=l&&s.length>0,h=f=>{if(f.nativeEvent.isComposing)return;const p=vte(f.key,t,l?s.length:0,a);p.kind!=="pass"&&(f.preventDefault(),p.kind==="move"?o(p.index):p.kind==="open"?i(s[p.index]):(f.stopPropagation(),n("")))};return r.jsxs("div",{className:"settings-search",children:[r.jsx("label",{className:"vis-hidden",htmlFor:ZO,children:"Search settings"}),r.jsxs("svg",{className:"settings-search-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":!0,focusable:"false",children:[r.jsx("circle",{cx:"6",cy:"6",r:"4.2"}),r.jsx("path",{d:"m9.2 9.2 3.3 3.3"})]}),r.jsx("input",{ref:e,id:ZO,type:"search",className:"settings-filter-field settings-search-field",placeholder:"Search settings",autoComplete:"off",spellCheck:!1,role:"combobox","aria-autocomplete":"list","aria-expanded":u,"aria-controls":u?lB:void 0,"aria-activedescendant":u?Pj(Math.min(a,s.length-1)):void 0,"aria-keyshortcuts":"Control+F Meta+F",value:t,onChange:f=>n(f.target.value),onKeyDown:h})]})}function Pke({query:e,results:t,active:n,onOpen:s}){const a=s5(t.length,e);return g.useEffect(()=>{var o,i;(i=(o=document.getElementById(Pj(n)))==null?void 0:o.scrollIntoView)==null||i.call(o,{block:"nearest"})},[n]),r.jsxs("div",{className:"settings-pane",role:"region","aria-labelledby":"settings-search-title",children:[r.jsx("div",{className:"settings-pane-head",children:r.jsxs("div",{className:"settings-pane-heading",children:[r.jsx("h2",{className:"settings-pane-title",id:"settings-search-title",children:"Search"}),r.jsx("p",{className:"settings-pane-note","aria-hidden":!0,children:a})]})}),t.length>0&&r.jsx("div",{className:"settings-group",children:r.jsx("div",{className:"settings-list",id:lB,role:"listbox","aria-label":"Matching settings",children:t.map((o,i)=>r.jsxs("button",{type:"button",role:"option",id:Pj(i),className:"settings-result",tabIndex:-1,"aria-selected":i===n,"aria-label":gte(o),"data-highlighted":i===n,onMouseDown:l=>l.preventDefault(),onClick:()=>s(o),children:[r.jsx(gm,{section:o.section}),r.jsxs("span",{className:"settings-result-text",children:[r.jsx("span",{className:"settings-result-name",children:o.label}),r.jsx("span",{className:"settings-result-place",children:qN(o)})]})]},o.id))})})]})}function Dke({query:e,count:t}){return r.jsx("p",{className:"vis-hidden",role:"status",children:e.trim()?s5(t,e):""})}const Fke=1500,Bke=3e3,qke=e=>e.checkVisibility?e.checkVisibility():e.getClientRects().length>0;function Uke(e){if(e.matches(np)&&!e.disabled)return e;const t=e.querySelector('input[type="radio"]:checked, [role="radio"][aria-checked="true"]');if(t)return t;const n=Array.from(e.querySelectorAll(np)).filter(s=>AP({disabled:s.disabled,tabIndex:s.tabIndex,rendered:qke(s)}));return n.find(s=>s.closest(".settings-list")!=null)??n[0]??null}function Wke(e,t,n){const[s,a]=g.useState(null),o=g.useRef(void 0),i=g.useRef(null);return g.useEffect(()=>()=>{var l;window.clearTimeout(o.current),(l=i.current)==null||l.removeAttribute("data-jumped")},[]),g.useEffect(()=>{const l=e.current;if(!s||!t||!l)return;const u=()=>l.querySelector(`[data-setting="${CSS.escape(s)}"]`),h=w=>{var k,v;a(null);const b=w.offsetHeight>l.clientHeight-48;w.scrollIntoView({block:b?"start":"center"}),(k=Uke(w))==null||k.focus({preventScroll:!0}),window.clearTimeout(o.current),(v=i.current)==null||v.removeAttribute("data-jumped"),w.offsetWidth,w.setAttribute("data-jumped",""),i.current=w,o.current=window.setTimeout(()=>{w.removeAttribute("data-jumped"),i.current===w&&(i.current=null)},Fke)},f=u();if(f){h(f);return}const p=new MutationObserver(()=>{const w=u();w&&(p.disconnect(),window.clearTimeout(m),h(w))});p.observe(l,{childList:!0,subtree:!0});const m=window.setTimeout(()=>{p.disconnect(),a(null)},Bke);return()=>{p.disconnect(),window.clearTimeout(m)}},[e,s,t,n]),a}function Hke({section:e,landOn:t,onSection:n,onClose:s,providers:a,sound:o,tones:i,customTones:l,notify:u,appearance:h,versionCheck:f,desktopUpdate:p,restart:m,doors:w}){const b=g.useRef(null),k=g.useCallback(be=>{b.current=be},[]);function v(be,fe=!1){b.current?(P(""),b.current(be,fe),requestAnimationFrame(()=>{var _e,Ve;return(Ve=(_e=x.current)==null?void 0:_e.scrollIntoView)==null?void 0:Ve.call(_e,{block:"nearest",inline:"nearest"})})):be()}const N=()=>v(s,!0),x=g.useRef(null),C=gt(N,{focusRef:x}),S=yt(()=>v(s)),_=g.useRef([]),$=$d(),A=WS($),O=dee(A,e,a.claude),M=Math.max(0,O.findIndex(be=>be.id===e)),W=ic("(max-width: 640px)"),[B,R]=g.useState(""),[q,T]=g.useState(0),F=g.useRef(null),D=g.useRef(null),K=B.trim()!=="",V=g.useMemo(()=>xte(B,n5(a.claude,A,Ld($))),[B,a.claude,A,$]),H=Wke(D,!K,e),P=be=>{R(be),T(0)};g.useEffect(()=>{t&&H(t)},[t,H]);const I=be=>{v(()=>{P(""),n(be),requestAnimationFrame(()=>{var fe;return(fe=document.getElementById(`settings-tab-${be}`))==null?void 0:fe.focus()})})},U=be=>{v(()=>{P(""),n(be.section),mm(be)||H(be.id)})};g.useEffect(()=>{const be=fe=>{var ot,tt;if(!yee(fe))return;const _e=C.current,Ve=fe.target;!_e||!(Ve===document.body||Ve===document.documentElement||Ve&&_e.contains(Ve))||(fe.preventDefault(),(ot=F.current)==null||ot.focus(),(tt=F.current)==null||tt.select())};return window.addEventListener("keydown",be),()=>window.removeEventListener("keydown",be)},[C]),g.useEffect(()=>{var be,fe,_e,Ve;hee((be=document.activeElement)==null?void 0:be.id,e)&&((fe=x.current)==null||fe.focus()),(Ve=(_e=x.current)==null?void 0:_e.scrollIntoView)==null||Ve.call(_e,{block:"nearest",inline:"nearest"})},[e]);const{theme:Z,setTheme:z,characterEnabled:X,setCharacterEnabled:Y,character:J,setCharacter:Q}=h,te=An(),le=be=>{const fe=uS(be,M,O.length,"vertical");fe.kind!=="pass"&&(be.preventDefault(),v(()=>{var _e;P(""),n(O[fe.index].id),(_e=_.current[fe.index])==null||_e.focus()}))},de=be=>{be.key===" "&&be.stopPropagation()},{soundOn:oe,toggleSound:re}=o,{tonePrefs:he,previewTone:pe,changeTone:Le}=i,{customSelections:ge,customAssets:ve,clearCustomOnly:je,selectCustomTone:Ee,importNotificationAudio:xe,createNotificationVoice:Ie,renameCustomAsset:De,deleteCustomAsset:We,previewCustomAsset:Ke}=l,{notifyPermission:ye,notifyOn:Fe,notifyVetoed:$e,toggleNotify:Re,notifySupported:rt,askForNotifications:He,accountNotify:se,toggleAccountNotify:ke}=u,Ae=(()=>{switch(e){case"radar":return r.jsx(Bbe,{onOpen:w.radar});case"claude":return r.jsx(tke,{});case"appearance":return r.jsxs(r.Fragment,{children:[r.jsx(uke,{theme:Z,onTheme:z,singleKeys:te}),r.jsx(Ike,{characterEnabled:X,character:J,onCharacter:Q,onToggleCharacter:()=>Y(be=>!be)})]});case"reading":return r.jsx(pke,{textSize:h.textSize,density:h.density,onTextSize:h.setTextSize,onDensity:h.setDensity});case"keyboard":return r.jsx(kbe,{singleKeys:te,onToggleSingleKeys:()=>OY(!te)});case"notifications":return r.jsx(jbe,{notifyOn:Fe,onToggleNotify:Re,notifyVetoed:$e,notifyPermission:rt?ye:"unsupported",onAskNotify:He,accountNotify:se,onToggleAccountNotify:ke});case"sounds":return r.jsx(Dbe,{soundOn:oe===!0,onToggleSound:re,prefs:he,claudeHere:a.claude,onLevel:(be,fe)=>Le(be,{level:fe}),onFigure:(be,fe)=>Le(be,{figure:fe}),onPreview:be=>pe(be),customAssets:ve,customSelections:ge,onBuiltInSelected:je,onCustomSelected:Ee,onImportCustom:xe,onCreateVoice:Ie,onRenameCustom:De,onPreviewCustom:Ke,onDeleteCustom:We});case"integrations":return r.jsx(lke,{onBeforeLeaveChange:k});case"data":return r.jsx(rke,{});case"about":return r.jsx(jke,{version:f.version,notice:f.notice,readyAppUpdate:p.readyAppUpdate,updateRestarting:p.desktopUpdateRestarting,updateFailure:p.desktopUpdateFailure,onUpdateRestart:be=>{p.askDesktopUpdateRestart(be)},doors:w});default:return r.jsxs(r.Fragment,{children:[r.jsx(ube,{}),r.jsx(WO,{provider:"Codex"}),a.claude&&r.jsx(WO,{provider:"Claude"}),r.jsx(Mke,{autoRestart:m.autoRestart,onToggleAutoRestart:m.toggleAutoRestart,version:f.version}),r.jsx(ybe,{claudeHere:a.claude,singleKeys:te,doors:w})]})}})(),Oe=e==="reading"?r.jsx(fke,{textSize:h.textSize,density:h.density,onTextSize:h.setTextSize,onDensity:h.setDensity}):e==="integrations"&&$.connections!==null?r.jsxs("span",{className:"ig-total",children:[$.connections.length," saved connection",$.connections.length===1?"":"s"]}):null;return r.jsx("div",{className:"modal-backdrop",...S,role:"presentation",children:r.jsxs("div",{ref:C,id:"settings",className:"modal settings-modal",role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",onClick:be=>be.stopPropagation(),onKeyDown:de,children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"settings-title",className:"modal-tool-name",children:"Settings"})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>v(s),"aria-label":"Close settings",title:"Close (Esc)",children:"×"})})]}),r.jsxs("div",{className:"settings-body",children:[r.jsxs("div",{className:"settings-side",children:[r.jsx(Oke,{inputRef:F,query:B,onQuery:P,results:V,active:q,onActive:T,onOpen:U}),r.jsx(Dke,{query:B,count:V.length}),r.jsx("div",{className:"settings-nav",role:"tablist","aria-label":"Settings sections","aria-orientation":W?"horizontal":"vertical",onKeyDown:le,children:O.map((be,fe)=>r.jsxs("button",{ref:_e=>{_.current[fe]=_e,be.id===e&&(x.current=_e)},type:"button",role:"tab",id:`settings-tab-${be.id}`,className:"settings-tab","aria-selected":be.id===e,"aria-controls":"settings-pane",tabIndex:be.id===e?0:-1,onClick:()=>I(be.id),children:[r.jsx(gm,{section:be.id}),r.jsx("span",{className:"settings-tab-label",children:be.label})]},be.id))})]}),r.jsxs("div",{ref:D,className:"settings-pane",role:"tabpanel",id:"settings-pane","aria-labelledby":`settings-tab-${e}`,hidden:K||void 0,children:[r.jsxs("div",{className:"settings-pane-head",children:[r.jsxs("div",{className:"settings-pane-heading",children:[r.jsx("h2",{className:"settings-pane-title",children:O[M].label}),r.jsx("p",{className:"settings-pane-note",children:O[M].note})]}),Oe]}),Ae]},e),K&&r.jsx(Pke,{query:B,results:V,active:q,onOpen:U})]})]})})}function zke({tool:e,onClose:t}){const n=gt(t),s=yt(t),a=e.endedAt==null?"inflight":e.ok===!1?"err":"done",o=g.useRef({of:null});o.current.of!==e&&(o.current={of:e}),e.input!==void 0&&(o.current.input=e.input),e.response!==void 0&&(o.current.response=e.response);const i=o.current.input??e.inputPreview,l=o.current.response??e.errorPreview,u=e.trimmed===!0&&o.current.input===void 0&&o.current.response===void 0,h=g.useMemo(()=>{const f=uV(e.name,i,l);return{input:f.input.map((p,m)=>r.jsx(JO,{block:p},m)),response:f.response.map((p,m)=>r.jsx(JO,{block:p},m)),copyInput:JE(e.name,"input",i),copyResponse:JE(e.name,"response",l)}},[e.name,i,l]);return r.jsx("div",{className:"modal-backdrop",...s,role:"presentation",children:r.jsxs("div",{ref:n,className:"modal tool-modal",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("span",{className:`status-dot ${a}`,"aria-hidden":!0}),r.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),r.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),r.jsxs("div",{className:"modal-actions",children:[r.jsx("span",{className:"modal-dur",children:EP(e,"in-flight…")}),r.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),r.jsxs("section",{className:"modal-body",children:[u&&r.jsx("div",{className:"modal-section",children:r.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),r.jsxs("div",{className:"modal-section",children:[r.jsxs("div",{className:"tm-head",children:[r.jsx("h4",{children:"Input"}),r.jsx(QO,{text:h.copyInput,what:"input"})]}),h.input]}),r.jsxs("div",{className:"modal-section",children:[r.jsxs("div",{className:"tm-head",children:[r.jsxs("h4",{children:["Response ",a==="err"&&r.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&r.jsx(QO,{text:h.copyResponse,what:"response"})]}),e.endedAt==null?r.jsx("pre",{children:"(waiting…)"}):h.response]})]})]})})}const Vke={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function JO({block:e}){const[t,n]=g.useState(!1);if(e.inline)return r.jsxs("p",{className:"tm-inline",children:[e.label&&r.jsx("span",{className:"tm-label",children:e.label}),r.jsx("code",{children:e.text})]});const s=g.useMemo(()=>sV(e),[e]),{shown:a}=nP(s,t),o=rV(s,t);return r.jsxs("div",{className:"tm-block",children:[e.label&&r.jsx("span",{className:"tm-label",children:e.label}),r.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?a.map((i,l)=>r.jsxs("span",{className:i.tone?Vke[i.tone]:void 0,children:[i.text,l<a.length-1?`
|
|
314
|
+
Nothing was added to the card and nothing new is polled. The deck already reads each session's transcript for its token counts; this reads the same file for what the model has finished writing, and a session that is quiet costs one file check per second and a half.`}]},HS="agent-dag.releaseNotesSeen";function DO(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function vi(e,t){const n=DO(e),s=DO(t);for(let a=0;a<Math.max(n.length,s.length);a++){const o=(n[a]??0)-(s[a]??0);if(o!==0)return o<0?-1:1}return 0}function lo(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function _ve(e){if(!e||typeof e!="object")return!1;const{title:t,body:n}=e;return typeof t=="string"&&t.trim()!==""&&typeof n=="string"&&n.trim()!==""}function Eve(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!lo(n)||!Array.isArray(s))continue;const a=s.filter(_ve);a.length&&t.push({version:n,notes:a})}return t.sort((n,s)=>vi(s.version,n.version))}const FO=Eve(Cve);function Q8(e,t,n){return e.filter(s=>vi(s.version,n)<=0&&(t===null||vi(s.version,t)>0))}function Tve(e,t){return e.filter(n=>vi(n.version,t)===0)}function Ave(e){if(!e.length)return"";const t=e[0].version,n=e[e.length-1].version;return t===n?`v${t}`:`v${n} – v${t}`}function Rve({since:e,running:t,entries:n,firstRun:s}){if(!n.length)return"Nothing in this build has anything to report yet. Most releases do not, which is the point.";if(e!==null){const i=n.length===1?"one release":`${n.length} releases`;return`You were last caught up at v${e}. Since then ${i} changed something you would notice. Clicking the version in the topbar brings this back.`}if(s&&lo(t))return`The deck has not run in this browser before, so this is what v${t} — the release you have — changed. Earlier releases are not repeated here; clicking the version in the topbar brings all of them back.`;const a=n[0].version;if(!lo(t))return"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.";const o=vi(a,t);return o<0?`v${t} · 🐛 Bug fixes and performance improvements. Earlier release notes are shown below.`:o>0?"Everything this build has to say, newest first. Most releases have nothing here, which is why the deck stays quiet about them.":`You are running v${t}, and this is what it changed — and everything before it, newest first. Most releases have nothing here, which is why the deck stays quiet about them.`}const Mve=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function $ve(e){const t=Mve.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function Lve(e){if(!e)return null;let t=null;try{t=e.getItem(HS)}catch{return null}return lo(t)?t:null}function Ive(e){if(!e)return!1;try{return e.getItem(HS),!0}catch{return!1}}function Ove(e,t){if(!e)return!1;try{return e.setItem(HS,t),!0}catch{return!1}}const eB="agent-dag.tourSeen";function Pve(e){if(!e)return!1;try{return e.getItem(eB)==="1"}catch{return!1}}function Dve(e){if(!e)return!1;try{return e.setItem(eB,"1"),!0}catch{return!1}}function Fve({tourSeen:e,decision:t}){if(t.reason==="no-version"||t.reason==="cannot-remember")return{tour:!1,notes:"none"};if(t.reason==="welcome"||t.reason==="first-run")return{tour:!e,notes:"none"};const n=t.show.length>0;return e?{tour:!1,notes:n?"now":"none"}:{tour:!0,notes:n?"after":"none"}}function Bve({stored:e,running:t,notes:n,remembers:s=!0}){if(!lo(t))return{show:[],record:null,reason:"no-version"};if(!lo(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const i=Tve(n,t);return i.length?{show:i,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=vi(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const o=Q8(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function co(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}function yje(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function wje(e){const t=Math.ceil(e/1e3),n=Math.floor(t/60),s=t%60;return n>0?`${n}m ${s}s`:`${s}s`}function qve(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function xje(e){return!Number.isFinite(e)||e<=0?"empty":Qn(e)}function vje(e,t){return e.map(n=>({key:n.key,name:n.name,running:n.running,visits:t.filter(s=>s.browser===n.key).reduce((s,a)=>s+a.programVisits,0)}))}function Uve(e,t){if(e===null)return null;const n=Math.max(0,Math.round((t-e)/1e3));if(n<5)return"just now";if(n<60)return`${n} sec ago`;const s=Math.round(n/60);return s<60?`${s} min ago`:`${Math.round(s/60)} hr ago`}function bje(e){const t=e.profiles.filter(s=>s.degraded);if(t.length>0){const s=t[0],a=t.length-1;return{kind:"unreadable",text:`${s.name}/${s.profile} could not be read — ${s.reason??"no reason given"}`+(a>0?`, and ${a} more`:"")+". The watch continues on the profiles it can read."}}const n=qve(e.browsers);return n.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."}:n.some(s=>s.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."}}const Wve="Check for updates",tB="Ask npm now whether a newer ccdeck is out.",BO="Checking…",Hve="Couldn't reach npm. Try again.",zve="Couldn't reach the deck. Try again.",nB="Update checks are off on this deck (AGENTS_DECK_NO_UPDATE_CHECK or AGENTS_DECK_NO_INSTALL).",Vve="The deck looks again in five minutes.";function Gve(e,t,n,s){const a=s?t.npx:n?Jt(t,n):void 0;return a?`${e} is out, but ${a}`:`${e} is out. Run:`}const Pn=(e,t={})=>({said:e,tone:"answer",age:null,command:null,action:null,...t}),Xo=e=>Pn(e,{tone:"note"});function qO(e,t){return Uve(e,t)??"just now"}function Kve(e,t){const n=e.update;return(n==null?void 0:n.status)==="ready"?Xo(`${n.version} is ready. Restart to update.`):(n==null?void 0:n.status)==="checking"?Xo("The app is checking for updates…"):(n==null?void 0:n.status)==="downloading"?Xo(n.version?`${n.version} is out. The app is downloading it.`:"The app is downloading an update."):(n==null?void 0:n.status)==="current"?Xo(`You're on the latest, ${e.version??t}. You can check again here.`):(n==null?void 0:n.status)==="error"?Xo("The app's last update check failed. Try Check for updates again."):Xo("The app keeps itself up to date. Check for updates here.")}function Yve(e,t,n){var i;const s=e.version;if((s==null?void 0:s.upgradeMode)==="install"&&e.upgradeState!=="failed"){if(e.upgradeState==="done")return Pn(`${t} is installed.`);const l=e.upgradeState==="running",u=`Runs ${((i=s.upgrade)==null?void 0:i.command)??s.command} here, then restarts once nothing is running.`;return Pn(l?`Installing ${t}…`:`${t} is out.`,{action:{kind:"install",label:"Update now",busy:l,why:u}})}if((s==null?void 0:s.upgradeMode)==="npx"&&s.canRestart){const l=e.upgradeState==="failed";return Pn(l?`The last update to ${t} came back on ${e.running}.`:`${t} is out.`,{action:{kind:"npx",label:l?"Retry update":"Update & restart",busy:e.restarting,why:`Runs ${s.command} and hands it this port. Nothing is installed globally — npx unpacks its own copy.`}})}const a=e.upgradeState==="failed"?`Installing ${t} failed. Run it yourself:`:Gve(t,n,s==null?void 0:s.upgradeBlocked,(s==null?void 0:s.upgradeMode)==="npx"),o=(s==null?void 0:s.command)??null;return Pn(a,{command:o,action:o?{kind:"copy",label:e.copied?"Copied":"Copy",busy:!1}:null})}function Xve(e){const t=e.version;if(e.unreachable)return Pn(zve,{tone:"warn"});const n=t!=null&&t.checkFailedAt&&t.checkFailedAt>(t.checkedAt??0)?t.checkFailedAt:null;if(n)return Pn(Hve,{tone:"warn",age:e.answered?null:`Last tried ${qO(n,e.now)}.`});const s=t!=null&&t.latestPending&&t.latestPending!==e.running?t.latestPending:null;if(s)return Pn(`${s} is tagged on npm but can't be installed yet. ${Vve}`);const a=t!=null&&t.checkedAt?qO(t.checkedAt,e.now):null;if(e.answered&&(t!=null&&t.latest)){const o=t.latest===e.running?`You're on the latest, ${e.running}.`:`You're on ${e.running}, ahead of npm's ${t.latest}.`;return Pn(o,{age:a?`Checked ${a}.`:null})}return Pn("",{age:a?`Last checked ${a}.`:null})}function Zve(e,t){var a,o;const n=e.version;if((a=e.app)!=null&&a.inApp&&(n!=null&&n.checkDisabled)){const i=Kve(e.app,e.running);return i&&{canCheck:!0,checking:e.checking||((o=e.app.update)==null?void 0:o.status)==="checking",line:e.unreachable?Pn("The desktop updater did not accept the check. Try the ccdeck menu or update the desktop app.",{tone:"warn"}):e.checking?Pn(BO):i}}if(n!=null&&n.checkDisabled)return{canCheck:!1,checking:!1,line:Xo(nB)};const s=(n==null?void 0:n.notice)??null;if((s==null?void 0:s.kind)==="upgrade")return{canCheck:!0,checking:e.checking,line:Yve(e,s.to,t)};if((s==null?void 0:s.kind)==="restart"){const i=n!=null&&n.canRestart?`${s.to} is installed. Restart the deck to start running it.`:`${s.to} is installed. Restart ccdeck to start running it.`;return{canCheck:!0,checking:e.checking,line:Pn(i)}}return e.checking?{canCheck:!0,checking:!0,line:Pn(BO)}:{canCheck:!0,checking:!1,line:Xve(e)}}const sB=450;async function Jve(e,t=n=>new Promise(s=>setTimeout(s,n))){const[n]=await Promise.all([e(!0),t(sB)]);return n?"answered":"unreachable"}async function Qve(e=fetch){try{const[t]=await Promise.all([e("/api/desktop-update/check",{method:"POST",signal:AbortSignal.timeout(8e3)}),new Promise(n=>setTimeout(n,sB))]);return t.ok?"answered":"unreachable"}catch{return"unreachable"}}const Rj="Eight pictures of what the deck shows.",UO="Restart the deck. Sessions, settings and pairings come back as they were.";function ebe(e){var $;const t=(e==null?void 0:e.versionCheck.versionChecking)??!1,n=_r(3e4),[s,a]=g.useState(!1),o=g.useRef(!1),[i,l]=g.useState(!1),[u,h]=g.useState(!1),f=g.useRef(t);if(g.useEffect(()=>{f.current&&!t&&h(!0),f.current=t},[t]),!e)return null;const{versionCheck:p,upgrade:m,restart:w,desktopUpdate:b,running:k,onHandOff:v}=e,N=Zve({version:p.version,running:k,checking:s||t,answered:u,unreachable:i,now:n,upgradeState:m.upgradeState,copied:m.cmdCopied,restarting:w.restarting,app:{inApp:co(),update:b.appUpdate,version:M8(),menu:L8()}},Ej);if(!N)return null;const x=co()&&(($=p.version)==null?void 0:$.checkDisabled);return{state:N,check:async()=>{var O;if(!Cn(o.current||t)||x&&((O=b.appUpdate)==null?void 0:O.status)==="checking")return;o.current=!0,a(!0);const A=x?await Qve():await Jve(p.loadVersion);o.current=!1,a(!1),l(A==="unreachable"),h(!0)},act:A=>{if(A.kind==="copy")return void m.copyCommand();v(),p.showNotice(),A.kind==="install"?m.startUpgrade():w.askRestart({upgrade:!0})},checkWhy:x?"Ask the desktop app whether a newer ccdeck is out.":tB}}function tbe({onTour:e,onRestart:t,updateCheck:n}){var h,f;const s=ac("above","dialog"),a=ebe(n),o=g.useId(),i=(a==null?void 0:a.state.canCheck)??!1,u=((h=a==null?void 0:a.state.line.action)==null?void 0:h.kind)==="install"||((f=a==null?void 0:a.state.line.action)==null?void 0:f.kind)==="npx"?void 0:t;return!e&&!i&&!u&&!a?null:r.jsxs("div",{className:"rn-actions",children:[(e||i||u)&&r.jsxs("div",{className:"rn-acts",children:[e&&r.jsxs("button",{type:"button",className:"btn rn-act",onClick:e,"aria-describedby":`${o}-tour`,...s.bind({label:Rj}),children:[r.jsx(OD,{}),"Take the tour"]}),a&&i&&r.jsxs("button",{type:"button",className:"btn rn-act",onClick:()=>void a.check(),"aria-busy":a.state.checking||void 0,"aria-describedby":`${o}-check`,...s.bind({label:a.checkWhy}),children:[r.jsx(NQ,{}),Wve]}),u&&r.jsxs("button",{type:"button",className:"btn rn-act rn-act-restart",onClick:u,"aria-describedby":`${o}-restart`,...s.bind({label:UO}),children:[r.jsx(SQ,{}),"Restart"]})]}),a&&r.jsx(nbe,{line:a.state.line,onAct:a.act,bindHint:s.bind,whyId:`${o}-act`}),r.jsx("span",{hidden:!0,id:`${o}-tour`,children:Rj}),r.jsx("span",{hidden:!0,id:`${o}-check`,children:(a==null?void 0:a.checkWhy)??tB}),r.jsx("span",{hidden:!0,id:`${o}-restart`,children:UO}),s.node]})}function nbe({line:e,onAct:t,bindHint:n,whyId:s}){const{action:a}=e,o=a&&r.jsx(sbe,{action:a,onAct:t,bindHint:n,whyId:s});return r.jsxs("p",{className:"rn-update-line","data-tone":e.tone,children:[r.jsx("span",{className:"rn-update-what",role:"status",children:e.said}),e.age&&r.jsx("span",{className:"rn-update-age",children:e.age}),e.command?r.jsxs("span",{className:"rn-update-cmd",children:[r.jsx("code",{className:"rn-code",children:e.command}),o]}):o]})}function sbe({action:e,onAct:t,bindHint:n,whyId:s}){const a=e.kind==="copy"?null:e.why;return r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",className:a?"btn primary rn-line-act":"btn rn-line-act",onClick:()=>t(e),"aria-busy":e.busy||void 0,"aria-describedby":a&&s?s:void 0,...a&&n?n({label:a}):{},children:e.label}),a&&s&&r.jsx("span",{hidden:!0,id:s,children:a})]})}function rbe({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:o,updateVersion:i,updateBusy:l,onUpdateRestart:u,updateFailure:h,onRestart:f,updateCheck:p}){const m=gt(a),w=yt(a),b=Ave(e);return r.jsx("div",{className:"modal-backdrop",...w,role:"presentation",children:r.jsxs("div",{ref:m,className:"modal release-notes",onClick:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:"What's new"}),b&&r.jsx("span",{className:"modal-tool-id",children:b})]}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})})]}),r.jsxs("section",{className:"modal-body",children:[(i||h)&&r.jsxs("div",{className:"rn-update",children:[i&&u&&r.jsxs("div",{className:"guide-door",children:[r.jsxs("span",{children:["ccdeck v",i," is downloaded and verified."]}),r.jsx("button",{type:"button",className:"btn",onClick:u,"aria-busy":l||void 0,children:l?"Restarting…":Ql})]}),r.jsx("p",{className:"rn-update-said",role:"status",children:h})]}),r.jsx("p",{className:"modal-note",children:Rve({since:t,running:n,firstRun:s,entries:e})}),r.jsx(tbe,{onTour:i?void 0:o,onRestart:f,updateCheck:p}),e.map(k=>r.jsxs("section",{className:"modal-section",children:[r.jsxs("h3",{className:"rn-version",children:["v",k.version]}),r.jsx("ul",{className:"rn-notes",children:k.notes.map((v,N)=>{const{icon:x,rest:C}=$ve(v.title);return r.jsx("li",{className:"rn-note",children:r.jsxs("p",{className:"rn-note-title",children:[x&&r.jsx("span",{className:"rn-note-icon",children:x}),C]})},N)})})]},k.version))]})]})})}function abe({state:e,sessionId:t,onClose:n}){const s=g.useMemo(()=>obe(e,t),[e,e.revision,t]),a=g.useRef(null),o=gt(n,{focusRef:a}),i=yt(n);return s?r.jsx("div",{className:"modal-backdrop",...i,role:"presentation",children:r.jsxs("div",{ref:o,className:"modal session-summary",onClick:l=>l.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[r.jsxs("div",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:"done"}),r.jsx("span",{id:"ss-title",className:"modal-tool-name",title:s.cwd??s.sessionId,children:s.label}),r.jsxs("span",{className:"modal-tool-id",children:["· ",s.sessionId.slice(0,8)]})]}),r.jsxs("div",{className:"modal-actions",children:[r.jsx("span",{className:"modal-dur",title:"Total wall time",children:s.durationLabel}),r.jsx("button",{type:"button",ref:a,className:"glyph-btn",onClick:n,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),r.jsxs("div",{className:"modal-body",children:[r.jsxs("section",{className:"ss-hero",children:[r.jsxs("div",{className:"ss-hero-left",children:[r.jsx("div",{className:"ss-cost-label",children:AD}),r.jsx("div",{className:"ss-cost",children:ct(s.cost.total)}),s.modelChips.length>0&&r.jsx("div",{className:"ss-models",children:s.modelChips.map(l=>r.jsx("span",{className:"model-chip","data-family":Zp(l),title:l,children:no(l)},l))})]}),r.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&r.jsxs(r.Fragment,{children:[r.jsx(GN,{cost:s.cost,size:"lg"}),r.jsxs("div",{className:"ss-cost-legend",children:[r.jsxs("span",{className:"ssl ssl-in",children:["input ",r.jsx("b",{children:ct(s.cost.input)})]}),r.jsxs("span",{className:"ssl ssl-out",children:["output ",r.jsx("b",{children:ct(s.cost.output)})]}),r.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",r.jsx("b",{children:ct(s.cost.cacheRead)})]}),r.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",r.jsx("b",{children:ct(s.cost.cacheWrite)})]})]})]})})]}),r.jsxs("section",{className:"ss-stats",children:[r.jsx(yl,{label:"agents",value:s.agentCount}),r.jsx(yl,{label:"subagents",value:s.subagentCount}),r.jsx(yl,{label:"tool calls",value:s.toolCount}),r.jsx(yl,{label:"prompts",value:s.promptCount}),r.jsx(yl,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&r.jsx(yl,{label:"errors",value:s.errCount,tone:"err"})]}),s.topTools.length>0&&r.jsxs("section",{className:"modal-section",children:[r.jsx("h4",{children:"Most-used tools"}),r.jsx("div",{className:"ss-top-tools",children:s.topTools.map(([l,u])=>r.jsxs("div",{className:"ss-tt",children:[r.jsx("span",{className:"ss-tt-name",children:l}),r.jsx("span",{className:"ss-tt-bar",children:r.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/s.topTools[0][1]*100}%`}})}),r.jsx("span",{className:"ss-tt-count",children:u})]},l))})]}),s.firstPrompt&&r.jsxs("section",{className:"modal-section",children:[r.jsx("h4",{children:"Opening prompt"}),r.jsx("div",{className:"ss-prompt",children:s.firstPrompt})]})]})]})}):null}function yl({label:e,value:t,tone:n}){return r.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[r.jsx("div",{className:"ss-stat-value",children:t}),r.jsx("div",{className:"ss-stat-label",children:e})]})}function obe(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const C of e.agents.values())C.sessionId===t&&s.push(C);if(s.length===0)return null;const a={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},o=new Set,i=new Map;let l=0,u=0,h=0,f=0,p=0,m,w=1/0,b=0;for(const C of s){const S=Un(C);a.input+=S.input,a.output+=S.output,a.cacheRead+=S.cacheRead,a.cacheWrite+=S.cacheWrite,a.total+=S.total;for(const $ of bP(C))o.add($);C.model&&o.add(C.model),C.kind==="subagent"&&p++;const _=tP(C.prompts);u+=_.length,!m&&_.length>0&&(m=_[0].text),h+=C.usage.inputTokens+C.usage.outputTokens,l+=C.toolCount,f+=C.toolErrorCount??0;for(const[$,A]of C.toolCountByName??[])i.set($,(i.get($)??0)+A);w=Math.min(w,C.startedAt),b=Math.max(b,C.endedAt??Date.now())}const k=Math.max(0,b-w),v=Math.floor(k/1e3),N=v<60?`${v}s`:v<3600?`${Math.floor(v/60)}m ${String(v%60).padStart(2,"0")}s`:`${Math.floor(v/3600)}h ${Math.floor(v%3600/60)}m`,x=Array.from(i.entries()).sort((C,S)=>S[1]-C[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:N,cost:a,modelChips:Array.from(o),agentCount:s.length,subagentCount:p,toolCount:l,promptCount:u,tokensSum:h,errCount:f,topTools:x,firstPrompt:m}}function Bt({id:e,title:t,note:n,noteId:s,aside:a,list:o=!0,settingId:i,className:l,children:u}){const h=l?`settings-group ${l}`:"settings-group",f=o?r.jsx("div",{className:"settings-list",children:u}):u;return t===void 0?r.jsx("div",{className:h,"data-setting":i,children:f}):r.jsxs("section",{className:h,"aria-labelledby":e,"data-setting":i,children:[r.jsxs("div",{className:"settings-caption",children:[r.jsxs("div",{className:"settings-caption-text",children:[r.jsx("h3",{id:e,children:t}),n&&r.jsx("p",{className:"settings-caption-note",id:s,children:n})]}),a]}),f]})}function mt({name:e,nameId:t,note:n,noteId:s,control:a,as:o="label",settingId:i,className:l,details:u,children:h}){const f=o,p=r.jsxs(f,{className:l?`settings-row ${l}`:"settings-row","data-setting":i,children:[r.jsx("span",{className:"settings-row-name",id:t,children:e}),n&&r.jsx("span",{className:"settings-row-note",id:s,children:n}),a!==void 0&&r.jsx("span",{className:"settings-row-control",children:a}),h]});return u?r.jsxs("div",{className:"settings-row-with-details",children:[p,r.jsxs("details",{className:"settings-row-details",children:[r.jsxs("summary",{children:["Details",r.jsxs("span",{className:"vis-hidden",children:[" about ",e]})]}),r.jsx("div",{children:u})]})]}):p}function rB(e,t){const[n,s]=g.useState(null),[a,o]=g.useState(!1),[i,l]=g.useState(""),u=g.useRef(!1),h=p=>typeof p=="boolean"?p:t;return g.useEffect(()=>{let p=!0;return fetch("/api/prefs").then(m=>{if(!m.ok)throw new Error;return m.json()}).then(m=>{var w;if(!m.ok)throw new Error;p&&s(h((w=m.prefs)==null?void 0:w[e]))}).catch(()=>{p&&l("Could not read this setting. Reopen Settings to retry.")}),()=>{p=!1}},[e]),{enabled:n,busy:a,error:i,change:async()=>{if(!(n===null||!Cn(u.current))){u.current=!0,o(!0),l("");try{const p=await fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[e]:!n})});if(!p.ok)throw new Error;const m=await p.json();if(!m.ok)throw new Error;s(h(m.prefs[e]))}catch{l("Could not save this setting. Try again.")}finally{u.current=!1,o(!1)}}}}}function WO({provider:e}){const t=e==="Codex"?"recoverCodexSessions":"recoverClaudeSessions",n=`${e.toLowerCase()}-session-recovery`,s=rB(t,!0);return r.jsxs(Bt,{id:`${n}-title`,title:`${e} sessions`,children:[r.jsx(mt,{settingId:n,name:"Restore unfinished sessions",note:e==="Codex"?"Restore recent unfinished turns on startup; their processes may have stopped.":"Restore verified busy sessions on the next start.",details:e==="Codex"?"Find unfinished turns in recent local Codex logs on the next start. A missing ending does not confirm the process is still running.":"On the next start, find busy local Claude sessions whose process identity can be verified.",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":`Restore unfinished ${e} sessions`,"aria-checked":s.enabled===!0,...Bn(s.busy,s.enabled===null),onClick:()=>{s.change()},children:r.jsx("span",{className:"switch-knob"})})}),s.error&&r.jsx("p",{role:"alert",children:s.error}),e==="Claude"&&r.jsx(ibe,{})]})}function ibe(){const e=rB("continueStopped",!1);return r.jsxs(r.Fragment,{children:[r.jsx(mt,{settingId:"claude-continue-stopped",name:"Continue stopped background sessions",note:"Resume once a working login with room becomes available.",details:"When a background session stops on an expired login or a usage limit, continue it once a working login with room is active. Once per stop; a session that stops again right after waits for you.",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":"Continue stopped background sessions automatically","aria-checked":e.enabled===!0,...Bn(e.busy,e.enabled===null),onClick:()=>{e.change()},children:r.jsx("span",{className:"switch-knob"})})}),e.error&&r.jsx("p",{role:"alert",children:e.error})]})}const lbe="Hide finished sessions after",cbe="A finished session leaves the canvas after this long. It stays in the session list (L), and comes back when it starts working again or needs you.";function ube(){const e=f8();return r.jsx(Bt,{id:"settings-board-caption",title:"Board",children:r.jsx(mt,{settingId:"hide-finished",name:lbe,nameId:"settings-hide-finished-label",note:"Hidden sessions stay available in the session list.",details:cbe,noteId:"settings-hide-finished-note",control:r.jsx("select",{className:"sm-select",value:e,"aria-labelledby":"settings-hide-finished-label","aria-describedby":"settings-hide-finished-note",onChange:t=>lge(Number(t.target.value)),children:c8.map(t=>r.jsx("option",{value:t,children:ige(t)},t))})})})}const dbe="Accounts and auto-switch",hbe="Your Claude accounts, and Auto-switch, which moves Claude Code to another one before the account in use runs out.",fbe="Local network",pbe="Pairing with the decks on your other machines, so a login that expires on one is repaired from another.",mbe="Browser Watch",gbe="Whether something drove your browser while you were away, and what the deck does about it.";function ybe({claudeHere:e,singleKeys:t,doors:n}){return r.jsxs(Bt,{id:"settings-elsewhere-caption",title:"Elsewhere on the deck",children:[e&&r.jsx(Z0,{settingId:"accounts",name:dbe,note:hbe,onOpen:n.accounts,cap:t?{key:"A",title:"Press A anywhere to show or hide the accounts panel"}:null}),e&&r.jsx(Z0,{settingId:"local-network",name:fbe,note:pbe,onOpen:n.localNetwork,cap:null}),r.jsx(Z0,{settingId:"browser-watch",name:mbe,note:gbe,onOpen:n.browserWatch,dialog:!0,cap:t?{key:"B",title:"Press B anywhere to open or close Browser Watch"}:null})]})}function Z0({settingId:e,name:t,note:n,onOpen:s,cap:a,dialog:o=!1}){const i=`settings-${e}`;return r.jsx(mt,{as:"div",settingId:e,name:t,nameId:`${i}-name`,note:n,control:r.jsxs(r.Fragment,{children:[a&&r.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:a.title,children:a.key}),r.jsx("button",{type:"button",className:"btn",id:`${i}-open`,"aria-labelledby":`${i}-open ${i}-name`,"aria-haspopup":o?"dialog":void 0,"aria-keyshortcuts":a?a.key:void 0,onClick:s,children:"Open"})]})})}const wbe="Single-key shortcuts",xbe="Keys like L, U, M, ? and Space open panels and toggle things. Turn this off if you use voice control or press them by accident.";function vbe(e){const t=e.binds.includes("?")?"the keyboard shortcuts sheet":e.action;return t.charAt(0).toUpperCase()+t.slice(1)}function bbe(e,t){const n=t.trim().toLowerCase();return n?[e.action,e.cap,e.macCap??""].some(s=>s.toLowerCase().includes(n)):!0}function kbe({singleKeys:e,onToggleSingleKeys:t}){const n=po(ro()),[s,a]=g.useState(""),o=g.useId(),i=$d(),l=X8(e,u=>ra(i,u)).map(u=>({...u,rows:u.rows.filter(h=>bbe(h,s))})).filter(u=>u.rows.length>0);return r.jsxs(r.Fragment,{children:[r.jsx(Bt,{children:r.jsx(mt,{settingId:"single-keys",name:wbe,nameId:"settings-single-keys-label",note:xbe,noteId:"settings-single-keys-note",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":e,"aria-labelledby":"settings-single-keys-label","aria-describedby":"settings-single-keys-note",onClick:t,children:r.jsx("span",{className:"switch-knob"})})})}),r.jsxs("div",{className:"settings-filter",children:[r.jsx("label",{className:"vis-hidden",htmlFor:o,children:"Filter shortcuts"}),r.jsx("input",{id:o,type:"search",className:"settings-filter-field",placeholder:"Filter shortcuts",autoComplete:"off",spellCheck:!1,value:s,onChange:u=>a(u.target.value),onKeyDown:u=>{nm(u.key)&&s&&(u.stopPropagation(),a(""))}})]}),l.map(u=>{const h=`settings-keys-${u.title.toLowerCase().replace(/[^a-z]+/g,"-")}`;return r.jsx(Bt,{id:h,title:u.title,className:"settings-keys",children:u.rows.map(f=>r.jsx(mt,{as:"div",name:vbe(f),control:r.jsx("kbd",{className:"settings-key",children:n&&f.macCap?f.macCap:f.cap})},`${f.cap}:${f.action}`))},u.title)}),l.length===0&&r.jsxs("p",{className:"settings-empty",role:"status",children:["No shortcut matches “",s.trim(),"”."]}),s.trim()===""&&r.jsx("p",{className:"settings-foot",children:Y8})]})}function jbe({notifyOn:e,onToggleNotify:t,notifyVetoed:n,notifyPermission:s,onAskNotify:a,accountNotify:o,onToggleAccountNotify:i}){const l=_ee(s),u=co(),h=e&&!n&&!u,f=g.useRef(null),p=na(!l.ask,f);return r.jsxs(r.Fragment,{children:[r.jsxs(Bt,{id:"sm-closed-caption",title:"While the deck is closed",children:[r.jsx(mt,{settingId:"notify-closed",name:"Notifications while closed",nameId:"sm-notify-label",note:n?Nee:jee(u),noteId:"sm-notify-note",control:r.jsx("button",{ref:f,type:"button",role:"switch","aria-checked":e,"aria-labelledby":"sm-notify-label","aria-describedby":"sm-notify-note",className:"switch",onClick:t,children:r.jsx("span",{className:"switch-knob"})})}),h&&r.jsx(mt,{as:"div",name:"Browser notifications",nameId:"sm-channel-name",note:l.note,control:l.ask?r.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:()=>{p(),a()},children:"Enable"}):r.jsxs("span",{className:"sm-channel-state","data-ok":l.ok||void 0,children:[l.ok&&r.jsx("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:r.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),l.status]})})]}),r.jsx(Bt,{id:"sm-accounts-caption",title:"Accounts",note:n?Cee:See,children:zD.map(({kind:m,label:w,title:b})=>r.jsx(mt,{settingId:m,name:w,nameId:`sm-${m}-label`,note:b,noteId:`sm-${m}-note`,control:r.jsx("button",{type:"button",role:"switch","aria-checked":o[m],"aria-labelledby":`sm-${m}-label`,"aria-describedby":`sm-${m}-note`,className:"switch",onClick:()=>i(m),children:r.jsx("span",{className:"switch-knob"})})},m))})]})}const Nbe=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function Sbe(e){return Nbe.find(t=>e(t))}const Cbe=4400;function _be(e){const t=e.split(";")[0];return{name:`Recorded voice.${t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm"}`,type:t}}function Ebe({full:e,setCustomError:t,runCustom:n,onImportCustom:s}){const[a,o]=g.useState(!1),i=g.useRef(null),l=g.useRef(null),u=g.useRef(!1),h=()=>{var p;l.current!==null&&clearTimeout(l.current),l.current=null,((p=i.current)==null?void 0:p.state)==="recording"&&i.current.stop()},f=async()=>{var m;if(e)return;if(t(""),!((m=navigator.mediaDevices)!=null&&m.getUserMedia)||typeof MediaRecorder>"u"){t("Microphone recording is unavailable in this browser.");return}let p;try{p=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{u.current||t("Microphone access was denied or unavailable.");return}if(u.current||i.current){p.getTracks().forEach(w=>w.stop());return}try{const w=Sbe(v=>MediaRecorder.isTypeSupported(v)),b=new MediaRecorder(p,w?{mimeType:w}:void 0),k=[];i.current=b,b.ondataavailable=v=>{v.data.size&&k.push(v.data)},b.onerror=()=>t("Recording failed. Please try again."),b.onstop=()=>{p.getTracks().forEach(C=>C.stop()),l.current!==null&&clearTimeout(l.current),l.current=null;const v=i.current===b;if(v&&(i.current=null),o(!1),!v||!k.length)return;const N=_be(b.mimeType),x=new File(k,N.name,{type:N.type});n(()=>s(x))},b.start(200),o(!0),l.current=setTimeout(h,Cbe)}catch{i.current=null,p.getTracks().forEach(w=>w.stop()),t("This browser cannot record a supported audio format.")}};return g.useEffect(()=>(u.current=!1,()=>{u.current=!0,l.current!==null&&clearTimeout(l.current);const p=i.current;i.current=null,(p==null?void 0:p.state)==="recording"&&p.stop()}),[]),{recording:a,startRecording:f,stopRecording:h}}function Tbe({full:e,fullProps:t,runCustom:n,onCreateVoice:s}){const[a,o]=g.useState("Custom voice"),[i,l]=g.useState("Your turn"),[u,h]=g.useState(""),[f,p]=g.useState("1"),[m,w]=g.useState("1"),[b,k]=g.useState([]);return g.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const v=()=>{k(window.speechSynthesis.getVoices())};return v(),window.speechSynthesis.addEventListener("voiceschanged",v),()=>window.speechSynthesis.removeEventListener("voiceschanged",v)},[]),r.jsxs("details",{className:"sm-voice",children:[r.jsxs("summary",{className:"settings-row",...t,onClick:v=>{const N=v.currentTarget.parentElement;e&&N&&!N.open&&v.preventDefault()},children:[r.jsx("span",{className:"settings-row-name",children:"Spoken voice"}),r.jsx("span",{className:"settings-row-note",children:"Create from text"}),r.jsx("span",{className:"settings-row-control",children:r.jsx("svg",{className:"sm-voice-chevron",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:r.jsx("path",{d:"M5.5 3.5 9 7l-3.5 3.5"})})})]}),r.jsxs("div",{className:"sm-voice-fields",children:[r.jsxs("label",{children:[r.jsx("span",{children:"Name"}),r.jsx("input",{className:"ap-manage-input",value:a,maxLength:80,onChange:v=>o(v.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Text"}),r.jsx("input",{className:"ap-manage-input",value:i,maxLength:180,onChange:v=>l(v.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Voice"}),r.jsxs("select",{className:"sm-select",value:u,onChange:v=>h(v.target.value),children:[r.jsx("option",{value:"",children:"System default"}),b.map(v=>r.jsx("option",{value:v.voiceURI,children:v.name},v.voiceURI))]})]}),r.jsxs("div",{className:"sm-voice-pair",children:[r.jsxs("label",{children:[r.jsx("span",{children:"Rate"}),r.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:f,onChange:v=>p(v.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Pitch"}),r.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:m,onChange:v=>w(v.target.value)})]})]}),r.jsx("button",{type:"button",className:"btn sm-custom-action",...t,onClick:()=>{e||n(async()=>{await s({name:a,text:i,voiceURI:u,rate:parseFloat(f),pitch:parseFloat(m)}),l("Your turn")})},children:"Add spoken voice"})]})]})}function Abe({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:s,onPreviewCustom:a,onDeleteCustom:o}){const[i,l]=g.useState(""),u=e.length,h=U1(u),f=h!==null,p=f?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[m,w]=g.useState(null),b=g.useRef(0),k=g.useRef(new Map),v=g.useRef(null),N=g.useRef(null);g.useEffect(()=>{if(!m)return;const A=window.setTimeout(()=>w(null),4e3);return()=>window.clearTimeout(A)},[m]);const x=async A=>{l("");try{await A()}catch(O){l(O instanceof Error?O.message:"Custom audio could not be saved.")}},C=(A,O)=>{const M=Date.now(),W=yi({armedFor:m,target:A,armedAt:b.current,now:M,gapMs:gi});if(W==="arm"){w(A),b.current=M;return}if(W==="ignore")return;w(null);const B=Iee(e.map(R=>R.id),A);x(async()=>{var q;await o(A);const R=document.activeElement;R!==O&&!Wn((R==null?void 0:R.tagName)??null)||(q=B?k.current.get(B):v.current)==null||q.focus()})},{recording:S,startRecording:_,stopRecording:$}=Ebe({full:f,setCustomError:l,runCustom:x,onImportCustom:t});return r.jsxs(Bt,{id:"sm-custom-title",title:"Custom sounds",note:"Your own files, clips and voices, kept on this machine. Either tone above can play one.",aside:r.jsxs("span",{className:"settings-caption-count",children:[u," of ",q1]}),className:"sm-custom",settingId:"custom-sounds",children:[f&&r.jsx("p",{className:"settings-row settings-row-status",id:"sm-custom-full",children:h}),r.jsx(mt,{as:"div",settingId:"custom-import",name:"Import audio",note:"WAV, MP3 or OGG",control:r.jsx("button",{ref:v,type:"button",className:"btn sm-custom-action",...p,onClick:()=>{var A;f||(A=N.current)==null||A.click()},children:"Choose file"}),children:r.jsx("input",{ref:N,type:"file",hidden:!0,accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",onChange:A=>{var M;const O=(M=A.target.files)==null?void 0:M[0];A.currentTarget.value="",O&&!f&&x(()=>t(O))}})}),r.jsx(mt,{as:"div",settingId:"custom-record",name:"Record a clip",note:S?"Recording…":"Up to 5 seconds",control:S?r.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:$,children:"Stop & save"}):r.jsx("button",{type:"button",className:"btn sm-custom-action",...p,onClick:()=>void _(),children:"Record"})}),r.jsx(Tbe,{full:f,fullProps:p,runCustom:x,onCreateVoice:n}),e.map(A=>r.jsxs("div",{className:"sm-custom-item",children:[r.jsx("input",{className:"ap-manage-input","aria-label":`Rename ${A.name}`,defaultValue:A.name,maxLength:80,onBlur:O=>{if(!O.target.value.trim()){O.target.value=A.name;return}x(()=>s(A.id,O.target.value))},onKeyDown:O=>{O.key==="Enter"&&O.currentTarget.blur()}}),r.jsx("span",{children:A.kind==="audio"?`${A.duration.toFixed(1)}s`:"Voice"}),r.jsx("button",{type:"button",className:"btn sm-custom-icon","aria-label":`Play ${A.name}`,onClick:()=>a(A.id),children:"Play"}),r.jsx("button",{type:"button",ref:O=>{O?k.current.set(A.id,O):k.current.delete(A.id)},className:`btn sm-custom-icon${m===A.id?" armed":""}`,onKeyDown:O=>{O.repeat&&O.preventDefault()},onClick:O=>C(A.id,O.currentTarget),"aria-label":m===A.id?`Confirm deleting ${A.name}`:`Delete ${A.name}`,title:m===A.id?"Press again to delete this sound. It cannot be brought back.":"Delete this sound",children:m===A.id?"Confirm":"Delete"})]},A.id)),i&&r.jsx("p",{className:"settings-row settings-row-status sm-custom-error",role:"alert",children:i})]})}const Rbe="A tone when a turn finishes, and when Claude asks for something.";function Mbe({soundOn:e,onToggleSound:t}){const n=g.useId(),s=An(),a=g.useId();return r.jsx(Bt,{children:r.jsx(mt,{settingId:"play-sounds",name:"Play sounds",nameId:n,note:Rbe,noteId:a,control:r.jsxs(r.Fragment,{children:[s&&r.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:"Press M anywhere to mute or unmute",children:"M"}),r.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-labelledby":n,"aria-describedby":a,"aria-keyshortcuts":s?"M":void 0,className:"switch",onClick:t,children:r.jsx("span",{className:"switch-knob"})})]})})})}const Mj="custom:";function HO(e){return`${Mj}${e}`}function $be(e){return e.startsWith(Mj)?e.slice(Mj.length):null}function Lbe({id:e,label:t="Volume",value:n,step:s=DN,onLevel:a,"aria-describedby":o}){return r.jsxs("div",{className:"sm-row",children:[r.jsx("label",{htmlFor:e,children:t}),r.jsx("input",{id:e,type:"range",min:Pf,max:mp,step:s,value:n,"aria-describedby":o,onChange:i=>a(Number(i.target.value)),style:{"--sm-level":`${(n-Pf)/(mp-Pf)*100}%`}}),r.jsxs("span",{className:"sm-read",children:[n,"%"]})]})}const zO={done:"Turn finished","needs-input":"Claude is asking"},Ibe={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function Obe({chime:e,tone:t,soundOn:n,customAssets:s,customSelections:a,onLevel:o,onFigure:i,onPreview:l,onBuiltInSelected:u,onCustomSelected:h}){const f=`sm-level-${e}`,p=`sm-figure-${e}`,m=a[e];return r.jsxs(Bt,{id:`sm-name-${e}`,title:zO[e],note:Ibe[e],settingId:`tone-${e}`,aside:r.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(e),"aria-label":`Hear the ${zO[e].toLowerCase()} tone`,title:n?"Play this tone now, at what it is set to":"Plays even when sounds are off","aria-describedby":n?void 0:"sm-preview-note",children:[r.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),"Hear it"]}),children:[r.jsx(Lbe,{id:f,value:t.level,onLevel:w=>o(e,w)}),r.jsxs("div",{className:"sm-row",children:[r.jsx("label",{htmlFor:p,children:"Tone"}),r.jsxs("select",{id:p,className:"sm-select",value:m?HO(m):t.figure,onChange:w=>{const b=w.target.value,k=$be(b);k!==null?h(e,k):(u(e),i(e,b))},children:[PN[e].map(w=>r.jsx("option",{value:w.id,children:w.label},w.id)),s.length>0&&r.jsx("optgroup",{label:"Custom",children:s.map(w=>r.jsx("option",{value:HO(w.id),children:w.name},w.id))})]})]})]})}const Pbe="Claude Code isn't on this machine, so only Turn finished plays here — for Codex turns.";function Dbe({soundOn:e,onToggleSound:t,prefs:n,claudeHere:s,onLevel:a,onFigure:o,onPreview:i,customAssets:l,customSelections:u,onBuiltInSelected:h,onCustomSelected:f,onImportCustom:p,onCreateVoice:m,onRenameCustom:w,onPreviewCustom:b,onDeleteCustom:k}){var C;const v=$ee(u),N=((C=l.find(S=>S.id===v))==null?void 0:C.name)??"the same custom sound",x=v?`Both tones use “${N}”. They may be harder to tell apart.`:"";return r.jsxs("div",{className:"sm-sounds",children:[r.jsx(Mbe,{soundOn:e,onToggleSound:t}),!s&&r.jsx("p",{className:"sm-note",children:Pbe}),!e&&r.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:"Plays even when sounds are off, so you can set a tone before turning sounds back on."}),r.jsx("div",{className:"sm-tones",children:Mu.map(S=>r.jsx(Obe,{chime:S,tone:n[S],soundOn:e,customAssets:l,customSelections:u,onLevel:a,onFigure:o,onPreview:i,onBuiltInSelected:h,onCustomSelected:f},S))}),x&&r.jsx("p",{className:"sm-note","aria-hidden":!0,children:x}),r.jsx("p",{className:"vis-hidden",role:"status",children:x}),r.jsx(Abe,{customAssets:l,onImportCustom:p,onCreateVoice:m,onRenameCustom:w,onPreviewCustom:b,onDeleteCustom:k})]})}const Fbe="Watches the telemetry Claude Code sends to its collector, always and in the background, even while Radar is closed. What it reads stays on this machine.";function Bbe({onOpen:e}){return r.jsx(Bt,{children:r.jsx(mt,{as:"div",settingId:"radar-open",name:"Radar",nameId:"settings-radar-open-name",note:Fbe,control:r.jsx("button",{type:"button",className:"btn",id:"settings-radar-open","aria-labelledby":"settings-radar-open settings-radar-open-name","aria-haspopup":"dialog",onClick:e,children:"Open"})})})}const qbe=6500,Ube=1e4;let ui={reading:null,saving:null,error:"",undone:null};const Wf=new Set;let pu=null,mu=null,la=null,J0=!1,Hf=0;const Jo=e=>{ui={...ui,...e},Wf.forEach(t=>t(ui))};function aB(e){const t=e;return!!t&&t.ok===!0&&Array.isArray(t.settings)&&typeof t.present=="object"}async function oB(e){const t=await fetch("/api/claude-settings",{signal:e}),n=await t.json();if(!t.ok||!aB(n))throw new Error;return n}async function $j(){if(J0||ui.saving)return;J0=!0;const e=Hf,t=new AbortController;la=t;let n=!1;const s=setTimeout(()=>{n=!0,t.abort()},5e3);try{const a=await oB(t.signal);e===Hf&&!t.signal.aborted&&Jo({reading:a,error:""})}catch{e===Hf&&(n||!t.signal.aborted)&&Jo({error:"Could not read Claude Code settings. Try again."})}finally{clearTimeout(s),J0=!1,la===t&&(la=null)}}function VO(e,t){var n;return(n=e==null?void 0:e.settings.find(s=>s.id===t))==null?void 0:n.value}async function GO(e,t){if(ui.saving)return;Hf++,la==null||la.abort(),mu&&(clearTimeout(mu),mu=null),Jo({saving:e,error:"",undone:null});const n=new AbortController,s=setTimeout(()=>n.abort(),15e3);try{const a=await fetch("/api/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,value:t}),signal:n.signal}),o=await a.json().catch(()=>null);if(!a.ok||!aB(o))throw new Error(typeof(o==null?void 0:o.error)=="string"?o.error:"Could not save the change. Try again.");Jo({reading:o});const i=VO(o,e);mu=setTimeout(()=>{mu=null;const l=new AbortController,u=setTimeout(()=>l.abort(),5e3);oB(l.signal).then(h=>{Jo({reading:h,undone:VO(h,e)===i?null:{id:e}})}).catch(()=>{}).finally(()=>clearTimeout(u))},qbe)}catch(a){Jo({error:a instanceof Error&&a.message?a.message:"Could not save the change. Try again."})}finally{clearTimeout(s),Jo({saving:null})}}function Wbe(){const[e,t]=g.useState(ui);return g.useEffect(()=>(Wf.add(t),t(ui),pu||($j(),pu=setInterval(()=>void $j(),Ube)),()=>{Wf.delete(t),Wf.size||(pu&&clearInterval(pu),pu=null,la==null||la.abort())}),[]),e}const Q0=40,Hbe={boolean:"on or off",choice:"a choice",number:"a number",text:"text",structured:"a list or object"};function zbe(e){const t=e.scope==="Global config"?"kept in ~/.claude.json":e.scope==="Managed"?"managed settings only":null;return[e.topic,Hbe[e.kind],t,e.since?`Claude Code ${e.since}+`:null].filter(Boolean).join(" · ")}function Vbe(e,t){const n=t.trim().toLowerCase();if(!n)return[];const s=e.filter(o=>o.key.toLowerCase().includes(n)),a=e.filter(o=>!s.includes(o)&&(o.topic??"").toLowerCase().includes(n));return[...s,...a]}let iB=null;const Gbe=()=>iB??(iB=bi(()=>import("./claude-settings-index-1Qg1AUda.js"),[]).then(e=>e.default.keys));function Kbe({present:e,noFile:t=!1}){const[n,s]=g.useState(null),[a,o]=g.useState(""),i=g.useId();g.useEffect(()=>{let f=!0;return Gbe().then(p=>{f&&s(p)},()=>{iB=null}),()=>{f=!1}},[]);const l=g.useMemo(()=>{if(!n)return[];if(a.trim())return Vbe(n,a);if(!e)return[];const f=n.filter(m=>Object.hasOwn(e,m.key)),p=Object.keys(e).filter(m=>!n.some(w=>w.key===m)).sort().map(m=>({key:m,topic:"Not in Claude Code's reference",scope:null,kind:"structured",default:null,since:null,anchor:""}));return[...f,...p]},[n,e,a]),u=l.slice(0,Q0),h=a.trim()!=="";return r.jsxs(Bt,{id:"claude-group-all",settingId:"claude-all-settings",title:"All Claude Code settings",note:h?void 0:e&&!t?"The keys your settings.json sets. Filter to look up any of them, and open the reference for what each does.":"Filter to look up any setting Claude Code documents, and open the reference for what each does.",aside:n?r.jsx("span",{className:"settings-caption-count",children:n.length}):void 0,list:!1,children:[r.jsxs("div",{className:"settings-filter",children:[r.jsx("label",{className:"vis-hidden",htmlFor:i,children:"Filter Claude Code settings"}),r.jsx("input",{id:i,type:"search",className:"settings-filter-field",placeholder:n?`Filter ${n.length} settings`:"Filter settings",autoComplete:"off",spellCheck:!1,value:a,onChange:f=>o(f.target.value),onKeyDown:f=>{nm(f.key)&&a&&(f.stopPropagation(),o(""))}})]}),u.length>0&&r.jsx("div",{className:"settings-list settings-keys",children:u.map(f=>{const p=e&&Object.hasOwn(e,f.key)?e[f.key]:null;return r.jsx(mt,{as:"div",name:r.jsx("code",{className:"claude-key",children:f.key}),note:zbe(f),control:r.jsxs(r.Fragment,{children:[p!==null&&r.jsx("span",{className:"settings-read",title:"In your settings.json",children:p}),f.anchor&&r.jsx("a",{className:"settings-link",href:`${wee}#${f.anchor}`,target:"_blank",rel:"noreferrer","aria-label":`${f.key} in Claude Code's settings reference`,children:"Reference"})]})},f.key)})}),h&&l.length===0&&n&&r.jsxs("p",{className:"settings-empty",role:"status",children:["No setting matches “",a.trim(),"”."]}),l.length>Q0&&r.jsxs("p",{className:"settings-foot",role:"status",children:[l.length-Q0," more. Type more of the name to narrow the list."]}),!h&&e&&!t&&n&&l.length===0&&r.jsx("p",{className:"settings-empty",children:"Your settings.json sets nothing yet."})]})}const Ybe="Changed back after saving, most likely by a running Claude Code session. Set it again to keep it.",Xbe="There is no settings.json yet, so Claude Code uses its defaults. The first change here creates it.";function Zbe(e){return`Saved in ${e??"your settings.json"}. A project's own .claude/settings.json, and policies set through MDM or the Windows registry, can override these rows and are not shown here.`}function Jbe(e){const t=`${e.env}=${e.value}`;return e.where==="environment"?`${e.effect} in sessions started with ${t}, as ccdeck was.`:`${e.effect} in every session: ${e.where==="user"?"your settings.json":"your organization"} sets ${t}.`}const KO="\0custom";function Qbe({entry:e,row:t,saving:n,nameId:s,noteId:a}){const o=!!t&&t.editable&&!n,i=!t||n===e.id,l=t?!t.editable:void 0;if(e.kind==="choice"||e.kind==="days"){const h=e.kind==="days"?e.options.map(m=>({value:String(m),label:fA(m)})):e.options,f=t?t.custom?KO:t.value===null?"":String(t.value):"",p=e.kind==="days"&&t&&!t.custom&&!h.some(m=>m.value===f)?[...h,{value:f,label:fA(Number(f))}].sort((m,w)=>Number(m.value)-Number(w.value)):h;return r.jsxs("select",{className:"sm-select","aria-labelledby":s,"aria-describedby":a,"aria-busy":i,disabled:l,value:f,onChange:m=>{if(!o)return;const w=m.target.value;GO(e.id,e.kind==="days"?Number(w):w===""?null:w)},children:[(t==null?void 0:t.custom)&&r.jsx("option",{value:KO,disabled:!0,children:"Custom value"}),p.map(m=>r.jsx("option",{value:m.value??"",children:m.label},m.value??""))]})}const u=(t==null?void 0:t.value)===!0;return r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":u,"aria-labelledby":s,"aria-describedby":a,"aria-busy":i,disabled:l,onClick:()=>{o&&GO(e.id,!u)},children:r.jsx("span",{className:"switch-knob"})})}function eke(e){if(!(e!=null&&e.settings.length)||e.settings.some(n=>n.editable))return null;const t=new Set(e.settings.map(n=>n.reason));return t.size===1?[...t][0]??null:null}function tke(){return r.jsx(nke,{state:Wbe()})}function nke({state:e}){const{reading:t,saving:n,error:s,undone:a}=e,o=eke(t),i=(t==null?void 0:t.userFile)==="absent",l=t?t.userFile!=="invalid"&&t.userFile!=="unreadable":!s;return r.jsxs(r.Fragment,{children:[(t===null||s||o||i)&&r.jsxs(Bt,{children:[t===null&&!s&&r.jsx("p",{className:"settings-row settings-row-status",role:"status",children:"Reading Claude Code settings…"}),o&&r.jsx("p",{className:"settings-row settings-row-status",role:"status",children:o}),i&&!o&&r.jsx("p",{className:"settings-row settings-row-status",role:"status",children:Xbe}),s&&r.jsxs("div",{className:"settings-row",role:"alert",children:[r.jsx("span",{className:"settings-row-name",children:s}),r.jsx("span",{className:"settings-row-control",children:r.jsx("button",{type:"button",className:"btn","aria-busy":!!n,onClick:()=>void $j(),children:"Retry"})})]})]}),l&&UD.map(u=>r.jsx(Bt,{id:`claude-group-${u.id}`,title:u.title,children:WD.filter(h=>h.group===u.id).map(h=>{const f=t==null?void 0:t.settings.find(b=>b.id===h.id),p=`claude-${h.id}-label`,m=`claude-${h.id}-note`,w=f&&!f.editable&&!o?f.reason:(a==null?void 0:a.id)===h.id?Ybe:f!=null&&f.override?Jbe(f.override):"";return r.jsx(mt,{settingId:`claude-${h.id}`,name:h.label,nameId:p,note:h.note,noteId:m,control:r.jsx(Qbe,{entry:h,row:f,saving:n,nameId:p,noteId:m}),children:r.jsx("span",{className:"settings-row-said settings-row-said-quiet",role:"status",children:w})},h.id)})},u.id)),l&&r.jsx("p",{className:"settings-foot",children:Zbe(t==null?void 0:t.fileShown)}),r.jsx(Kbe,{present:(t==null?void 0:t.present)??null,noFile:i})]})}const ske="Local statistics for Claude and Codex on this device. Commands are grouped by operation; raw arguments and outputs are not saved.";function rke(){const[e,t]=g.useState(null),[n,s]=g.useState(""),[a,o]=g.useState(!1),[i,l]=g.useState(null),[u,h]=g.useState(""),f=g.useRef(!1),p=g.useRef(!0),m=async()=>{if(f.current)return;f.current=!0,o(!0),s("");const k=new AbortController,v=window.setTimeout(()=>k.abort(),12e3);try{const N=await fetch("/api/tool-audit/storage",{signal:k.signal}),x=await N.json();if(!N.ok||!x.ok)throw new Error;p.current&&t(x)}catch{p.current&&s("Could not read tool history storage. Try again.")}finally{window.clearTimeout(v),f.current=!1,p.current&&o(!1)}};g.useEffect(()=>(p.current=!0,m(),()=>{p.current=!1}),[]);const w=async(k,v)=>{if(f.current)return;f.current=!0,o(!0),s(""),h("");let N=!1;const x=new AbortController,C=window.setTimeout(()=>x.abort(),15e3);try{const S=await fetch("/api/tool-audit/storage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k==="clear"?{action:k,confirm:!0}:{action:k,days:v}),signal:x.signal}),_=await S.json();if(!S.ok||!_.ok)throw new Error;N=!0,p.current&&(l(null),h(k==="clear"?"Tool history cleared. New calls will continue to be recorded.":`Retention changed to ${v} days.`))}catch{p.current&&s("Could not update tool history. Check storage permissions and try again.")}finally{window.clearTimeout(C),f.current=!1,p.current&&(o(!1),N&&m())}},b=i!==null&&r.jsxs("div",{className:"settings-row settings-row-wide ta-confirm",role:"group","aria-label":"Confirm",children:[r.jsx("p",{children:i==="clear"?"Delete all recorded tool statistics on this device? This cannot be undone.":`Keep ${i} days? Older calls will be permanently deleted.`}),r.jsxs("div",{children:[r.jsx("button",{type:"button",className:"btn danger","aria-busy":a,onClick:()=>{w(i==="clear"?"clear":"retention",typeof i=="number"?i:void 0)},children:i==="clear"?"Delete tool history":"Apply retention"}),r.jsx("button",{type:"button",className:"btn","aria-busy":a,onClick:()=>{f.current||l(null)},children:"Cancel"})]})]});return r.jsxs(Bt,{id:"tool-history-settings-title",title:"Tool history",note:ske,className:"ta-settings",children:[e?r.jsxs(r.Fragment,{children:[r.jsx(mt,{settingId:"tool-history-retention",name:"Keep history",nameId:"ta-keep-label",note:"Calls older than this are deleted.",control:r.jsx("select",{className:"sm-select","aria-labelledby":"ta-keep-label",value:e.retentionDays,"aria-busy":a,onChange:k=>{if(f.current)return;const v=Number(k.target.value);v<e.retentionDays?l(v):w("retention",v)},children:[30,60,90].map(k=>r.jsxs("option",{value:k,children:[k," days"]},k))})}),typeof i=="number"&&b,r.jsx(mt,{as:"div",settingId:"tool-history-size",name:"Space used",note:`Collected since ${Ete(e.startedAt)}`,control:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"settings-read",children:_te(e.bytes)}),r.jsx("button",{type:"button",className:"btn","aria-busy":a,onClick:()=>{m()},children:"Refresh"})]})}),r.jsx(mt,{as:"div",settingId:"tool-history-clear",name:"Clear history",note:"Deletes every recorded call on this device. New calls are still recorded.",control:r.jsx("button",{type:"button",className:"btn danger","aria-busy":a,onClick:()=>{f.current||l("clear")},children:"Clear…"})}),i==="clear"&&b,!e.storageOk&&r.jsx(mt,{as:"div",name:"Some calls could not be saved",note:"Check free space and storage permissions."})]}):r.jsx(mt,{as:"div",name:a?"Reading storage…":"Storage size unavailable."}),n&&r.jsxs("div",{className:"settings-row",role:"alert",children:[r.jsx("span",{className:"settings-row-name",children:n}),r.jsx("span",{className:"settings-row-control",children:r.jsx("button",{type:"button",className:"btn","aria-busy":a,onClick:()=>{m()},children:"Retry"})})]}),u&&r.jsx("p",{className:"settings-row settings-row-status",role:"status",children:u})]})}const Lj="agent-dag.integrations.active",zS=(e,t)=>`agent-dag.integrations.prefs.${e}:${t}`,ake=32e3;function YO(e,t){const n=nt(zS(e,t));if(!n)return{};try{const s=JSON.parse(n);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function kje(e,t){return{read(n,s){const a=YO(e,t)[n];return s(a)?a:void 0},write(n,s){const a=YO(e,t);s===void 0?delete a[n]:a[n]=s;const o=JSON.stringify(a);o.length<=ake&&st(zS(e,t),o)}}}function oke(e,t){ks(zS(e,t))}function jje(e){const t=nt(Lj);if(!t)return null;try{const n=JSON.parse(t),s=n&&typeof n=="object"?n[e]:null;return typeof s=="string"&&s.length<=80?s:null}catch{return null}}function Nje(e,t){let n={};try{const s=nt(Lj),a=s?JSON.parse(s):{};a&&typeof a=="object"&&!Array.isArray(a)&&(n=Object.fromEntries(Object.entries(a).filter(([,o])=>typeof o=="string").slice(0,20)))}catch{}n[e]=t,st(Lj,JSON.stringify(n))}function Ij(e){var s;const t=(s=e.meta)==null?void 0:s.checkedAt;if(!t)return null;const n=new Date(String(t));return Number.isNaN(n.getTime())?null:n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...n.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}function Oj(e){const t=e.meta??{};return e.kind==="gitlab"?typeof t.serverVersion=="string"&&t.serverVersion?`GitLab ${t.serverVersion}`:null:e.kind!=="jira"?null:t.deploymentType==="Cloud"?"Jira Cloud":t.deploymentType?`Jira ${t.deploymentType==="DataCenter"?"Data Center":String(t.deploymentType)}${t.serverVersion?` ${t.serverVersion}`:""}`:null}function ike({connection:e,provider:t,available:n,busy:s,armed:a,note:o,headingRef:i,onTest:l,onEdit:u,onDisconnect:h,onCancelDisconnect:f}){var S;const p=g.useRef(null),m=(t==null?void 0:t.label)??e.kind,w=e.account.name||e.account.login||"No account read yet",b=e.account.name&&e.account.login!==e.account.name?e.account.login:"",k=Ij(e),v=Oj(e),N=Array.isArray((S=e.meta)==null?void 0:S.warnings)?e.meta.warnings.filter(_=>typeof _=="string"):[],x=s===`test:${e.id}`,C=s===`delete:${e.id}`;return r.jsxs("section",{className:"ig-connection-details","aria-labelledby":"ig-managed-title",children:[r.jsxs("header",{className:"ig-managed-header",children:[t&&r.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:r.jsx(t.Glyph,{})}),r.jsxs("div",{className:"ig-managed-identity",children:[r.jsx("h2",{ref:i,tabIndex:-1,id:"ig-managed-title",className:"ig-managed-title",children:e.name||e.baseUrl}),r.jsxs("p",{children:[m," · Saved connection"]})]})]}),r.jsxs("dl",{className:"ig-detail-facts",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Host"}),r.jsx("dd",{children:e.baseUrl})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Account"}),r.jsxs("dd",{children:[w,b?` (${b})`:""]})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Last verified"}),r.jsx("dd",{children:k??"No verification time available"})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Credentials"}),r.jsx("dd",{children:e.tokenSaved?"Stored locally":"No token saved"})]}),v&&r.jsxs("div",{children:[r.jsx("dt",{children:"Server"}),r.jsx("dd",{children:v})]})]}),!n&&r.jsxs("p",{className:"ig-stranded",children:[m," is not available on this deck. Disconnect deletes this connection and its saved token."]}),N.length>0&&r.jsx("ul",{className:"ig-warnings",children:N.map(_=>r.jsx("li",{children:_},_))}),n&&r.jsxs("div",{className:"ig-manage-actions",children:[r.jsx("button",{type:"button",className:"btn","aria-busy":x,"aria-disabled":s!==null||void 0,onClick:l,children:x?"Testing…":"Test connection"}),r.jsx("button",{type:"button",className:"btn","aria-disabled":s!==null||void 0,onClick:_=>{s===null&&u(_.currentTarget)},children:"Edit connection"})]}),o&&o.scope!=="disconnect"&&r.jsx("p",{className:"ig-note","data-tone":o.tone,role:o.tone==="err"?"alert":"status",children:o.text}),r.jsxs("div",{className:"ig-disconnect-section",children:[r.jsx("h3",{children:"Remove connection"}),r.jsx("p",{children:"Remove this connection and its saved token from this machine."}),r.jsxs("div",{className:"ig-manage-actions","data-integration-disconnect-actions":!0,onBlur:_=>{a&&!_.currentTarget.contains(_.relatedTarget)&&f()},children:[r.jsx("button",{ref:p,type:"button","data-integration-disconnect":!0,className:`btn danger${a?" armed":""}`,"aria-busy":C,"aria-disabled":s!==null||void 0,onKeyDown:_=>{_.repeat&&_.preventDefault()},"aria-label":a?`Confirm disconnecting ${e.name}`:`Disconnect ${e.name}`,onClick:_=>h(_.currentTarget),children:C?"Disconnecting…":a?"Confirm disconnect":"Disconnect"}),a&&r.jsx("button",{type:"button",className:"btn","aria-disabled":s!==null||void 0,"aria-label":"Cancel disconnect",onClick:()=>{var _;s===null&&(f(),(_=p.current)==null||_.focus())},children:"Cancel"})]}),a&&r.jsx("p",{className:"ig-note",role:"status",children:"Press Confirm disconnect to delete this connection and its saved token, or Cancel to keep it."}),(o==null?void 0:o.scope)==="disconnect"&&r.jsx("p",{className:"ig-note","data-tone":o.tone,role:o.tone==="err"?"alert":"status",children:o.text})]})]})}function lke({onBeforeLeaveChange:e}={}){var He;const t=$d(),{connections:n,error:s}=t,[a,o]=g.useState(null),i=g.useRef(null),l=g.useRef(new Map),u=g.useRef(null),h=g.useRef(0),[f,p]=g.useState(null),[m,w]=g.useState(""),b=g.useRef(null),k=g.useRef(null),[v,N]=g.useState(null),[x,C]=g.useState(null),S=g.useRef(null),[_,$]=g.useState(null),[A,O]=g.useState([]),[M,W]=g.useState(null),B=g.useRef(0),[R,q]=g.useState(null),T=g.useRef(null),F=g.useRef(new Map),D=g.useRef(null),K=g.useRef(0),[V,H]=g.useState(!1),[P,I]=g.useState(null),U=g.useRef(null),Z=g.useRef(new Map),z=g.useRef(new Map);g.useEffect(()=>{const se=Yye();se&&(D.current=Z.current.get(se)??null,p(se),q(se),N({mode:"edit",id:se}));const ke=Kye();ke&&N({mode:"add",kind:ke})},[]),g.useEffect(()=>{var se,ke;!R||!n||(ke=(se=z.current.get(R))==null?void 0:se.scrollIntoView)==null||ke.call(se,{block:"nearest"})},[R,n]),g.useEffect(()=>{if(!M)return;const se=()=>{var Oe,be;((Oe=document.activeElement)==null?void 0:Oe.getAttribute("aria-label"))==="Cancel disconnect"&&((be=document.querySelector(".ig-manage-view [data-integration-disconnect]"))==null||be.focus()),W(null)},ke=()=>{document.hidden&&se()},Ae=window.setTimeout(()=>{var Oe;(Oe=document.querySelector("[data-integration-disconnect-actions]"))!=null&&Oe.contains(document.activeElement)||se()},4e3);return window.addEventListener("blur",se),document.addEventListener("visibilitychange",ke),()=>{window.clearTimeout(Ae),window.removeEventListener("blur",se),document.removeEventListener("visibilitychange",ke)}},[M]);const X=(se,ke,Ae,Oe)=>O(be=>[...be.filter(fe=>fe.id!==se),{id:se,tone:ke,text:Ae,scope:Oe}]),Y=se=>O(ke=>ke.filter(Ae=>Ae.id!==se)),J=async(se,ke)=>{if(!S.current){S.current=se,C(se);try{await ke()}finally{S.current=null,C(null)}}},Q=se=>(ke,Ae)=>void J("form",async()=>{$(null);try{const Oe=await Wye(se,ke,Ae||void 0);N(null),I(null),H(!1),p(null),o(null),w("Connection added."),X(Oe.id,"ok",`Connection saved and tested as ${Oe.account.name||Oe.account.login}.`),q(Oe.id),T.current=()=>{var fe;const be=l.current.get(Oe.kind)??Z.current.get(Oe.id);return(fe=be==null?void 0:be.scrollIntoView)==null||fe.call(be,{block:"nearest"}),be}}catch(Oe){$(Oe instanceof vr?Oe:new vr("upstream","The connection could not be saved."))}}),te=se=>(ke,Ae)=>void J("form",async()=>{$(null);try{const{connection:Oe,validated:be}=await Hye(se.id,{name:Ae,input:ke});N(null),I(null),H(!1),T.current=()=>k.current??(f?b.current:Z.current.get(Oe.id)),X(Oe.id,"ok",be?`Saved. Connection test passed as ${Oe.account.name||Oe.account.login}.`:"Saved.")}catch(Oe){$(Oe instanceof vr?Oe:new vr("upstream","The change could not be saved."))}}),le=se=>void J(`test:${se.id}`,async()=>{W(null),Y(se.id);try{const ke=await zye(se.id);X(se.id,"ok",`Connection test passed. Signed in as ${ke.account.name||ke.account.login}.`)}catch(ke){X(se.id,"err",ke instanceof Error?ke.message:"The test failed.")}}),de=(se,ke)=>{if(S.current)return;const Ae=Date.now(),Oe=yi({armedFor:M,target:se.id,armedAt:B.current,now:Ae,gapMs:gi});if(Oe==="arm"){ke.focus({preventScroll:!0}),W(se.id),B.current=Ae;return}Oe!=="ignore"&&(W(null),J(`delete:${se.id}`,async()=>{try{await Vye(se.id),oke(se.kind,se.id),Y(se.id),(v==null?void 0:v.mode)==="edit"&&v.id===se.id&&N(null),p(null);const be=(n??[]).filter(_e=>_e.kind===se.kind&&_e.id!==se.id);(!a||be.length===0)&&o(null),w("Connection disconnected.");const fe=document.activeElement;(fe===ke||Wn((fe==null?void 0:fe.tagName)??null))&&(T.current=()=>{var Ve;const _e=(a&&be[0]?Z.current.get(be[0].id):l.current.get(se.kind))??F.current.get(se.kind)??document.getElementById("settings-tab-integrations");return(Ve=_e==null?void 0:_e.scrollIntoView)==null||Ve.call(_e,{block:"nearest"}),_e})}catch(be){X(se.id,"err",be instanceof Error?be.message:"The connection could not be removed. Try again.","disconnect")}}))};g.useEffect(()=>{if(x!==null||P||!T.current)return;const se=T.current();T.current=null,se!=null&&se.isConnected&&(se.checkVisibility?se.checkVisibility():se.getClientRects().length>0)&&se.focus({preventScroll:!0})},[n,f,a,v,x,P]);const oe=n??[],re=Ld(t),he=["github","gitlab","jira"],pe=qS().filter(se=>re.has(se.kind)||oe.some(ke=>ke.kind===se.kind)).sort((se,ke)=>he.indexOf(se.kind)-he.indexOf(ke.kind)),Le=WS(t),ge=g.useCallback(()=>{N(null),p(null),o(null),H(!1),I(null),$(null),W(null),T.current=()=>{const se=D.current,ke=se==null?void 0:se.closest(".settings-pane");return ke&&(ke.scrollTop=K.current),se!=null&&se.isConnected?se:document.getElementById("settings-tab-integrations")}},[]),ve=g.useCallback(()=>{if(!a){ge();return}p(null),N(null),H(!1),I(null),$(null),W(null),T.current=()=>{var Ae;const se=(Ae=u.current)!=null&&Ae.isConnected?u.current:i.current,ke=se==null?void 0:se.closest(".settings-pane");return ke&&(ke.scrollTop=se===i.current?0:h.current),se}},[a,ge]),je=g.useCallback(()=>{if(!f&&!a){ge();return}N(null),H(!1),I(null),$(null),T.current=()=>k.current??(f?b.current:i.current)},[f,a,ge]),Ee=g.useCallback((se,ke=!1)=>{if(S.current)return;if(P&&ke){I(null),requestAnimationFrame(()=>{var Oe;return(Oe=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:Oe.focus()});return}const Ae=ke?v?je:f?ve:ge:()=>{N(null),p(null),o(null),se()};V?I(()=>Ae):(H(!1),Ae())},[V,P,v,f,je,ve,ge]);g.useEffect(()=>(e==null||e(v||f||a?Ee:null),()=>e==null?void 0:e(null)),[v,f,a,Ee,e]),g.useEffect(()=>{var se;P&&((se=U.current)==null||se.focus())},[P]),g.useEffect(()=>{var se;f&&((se=b.current)==null||se.focus())},[f]),g.useEffect(()=>{var se;a&&((se=i.current)==null||se.focus())},[a]);const xe=(se,ke)=>{var Oe;if(S.current)return;T.current=null,I(null),w(""),W(null),f||a?k.current=ke:(K.current=((Oe=ke.closest(".settings-pane"))==null?void 0:Oe.scrollTop)??0,D.current=ke,k.current=null),H(!1),$(null),N(se);const Ae=ke.closest(".settings-pane");Ae&&(Ae.scrollTop=0)},Ie=(se,ke)=>{var Oe,be;if(S.current)return;T.current=null,a?(u.current=ke,h.current=((Oe=ke.closest(".settings-pane"))==null?void 0:Oe.scrollTop)??0):(K.current=((be=ke.closest(".settings-pane"))==null?void 0:be.scrollTop)??0,D.current=ke),k.current=null,w(""),W(null),p(se.id);const Ae=ke.closest(".settings-pane");Ae&&(Ae.scrollTop=0)},De=(se,ke)=>{var be;const Ae=oe.filter(fe=>fe.kind===se);if(Ae.length===1){Ie(Ae[0],ke);return}if(S.current)return;T.current=null,K.current=((be=ke.closest(".settings-pane"))==null?void 0:be.scrollTop)??0,D.current=ke,u.current=null,h.current=0,w(""),W(null),o(se);const Oe=ke.closest(".settings-pane");Oe&&(Oe.scrollTop=0)},We=(se,ke=!1)=>{const Ae=_u(se.kind),Oe=!ra(t,se.kind),be=Ij(se),fe=se.account.login||se.account.name,_e=se.kind==="jira"?Oj(se):null;return r.jsx("div",{className:"ig-conn",ref:Ve=>{Ve?z.current.set(se.id,Ve):z.current.delete(se.id)},children:r.jsxs("div",{className:"ig-summary-row",children:[r.jsxs("div",{className:"ig-summary-text",children:[r.jsx("span",{className:"ig-conn-name",children:ke&&se.name||Vo(se)}),r.jsx("span",{className:"ig-conn-line",children:[ke&&se.name!==Vo(se)?Vo(se):"",fe,_e||(be?`Last verified ${be}`:"Not verified yet")].filter(Boolean).join(" · ")||"No account read yet"}),!se.tokenSaved&&r.jsx("span",{className:"ig-bad",children:"No token saved"}),Oe&&r.jsxs("span",{className:"ig-stranded",children:[(Ae==null?void 0:Ae.label)??se.kind," is not available on this deck. Manage this connection to disconnect it."]})]}),r.jsxs("button",{type:"button",className:"btn ig-manage",ref:Ve=>{Ve?Z.current.set(se.id,Ve):Z.current.delete(se.id)},"aria-label":`Manage ${(Ae==null?void 0:Ae.label)??se.kind}: ${se.name} (${fe||Vo(se)})`,onClick:Ve=>Ie(se,Ve.currentTarget),children:["Manage ",r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m6 4 4 4-4 4"})})]})]})},se.id)},Ke=oe.filter(se=>!pe.some(ke=>ke.kind===se.kind)),ye=a?_u(a):null,Fe=oe.filter(se=>se.kind===a),$e=oe.find(se=>se.id===f),Re=(v==null?void 0:v.mode)==="edit"?oe.find(se=>se.id===v.id):void 0,rt=(v==null?void 0:v.mode)==="add"?pe.find(se=>re.has(se.kind)&&se.kind===v.kind):Re&&pe.find(se=>re.has(se.kind)&&se.kind===Re.kind);return r.jsxs("div",{className:"ig-settings","data-view":v?"form":f?"connection":a?"provider":"overview",children:[v&&r.jsxs("div",{className:"ig-config-view",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":x!==null||void 0,onClick:()=>Ee(je,!0),children:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),f?"Back to connection":a?`Back to ${(ye==null?void 0:ye.label)??a} connections`:"All integrations"]}),P&&r.jsxs("div",{className:"ig-leave-confirm",role:"group","aria-labelledby":"ig-leave-title",children:[r.jsx("strong",{id:"ig-leave-title",children:"Discard unsaved changes?"}),r.jsx("p",{children:"Your changes have not been saved. Discarding clears this form, including any token you entered."}),r.jsxs("div",{className:"ig-form-actions",children:[r.jsx("button",{ref:U,type:"button",className:"btn",onClick:()=>{I(null),requestAnimationFrame(()=>{var se;return(se=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:se.focus()})},children:"Keep editing"}),r.jsx("button",{type:"button",className:"btn danger",onClick:()=>{const se=P;I(null),H(!1),N(null),se()},children:"Discard changes"})]})]}),r.jsx("div",{hidden:!!P,children:rt?r.jsx(xye,{def:rt,existing:Re,busy:x==="form",error:_,onDirtyChange:H,onSubmit:v.mode==="add"?Q(v.kind):te(Re),onCancel:()=>Ee(je,!0)},v.mode==="add"?v.kind:v.id):r.jsxs("div",{role:"status",children:[r.jsx("p",{children:"This provider or connection is no longer available."}),r.jsx("button",{type:"button",className:"btn",onClick:je,children:"Back to integrations"})]})})]}),a&&r.jsxs("div",{className:"ig-provider-view",hidden:v!==null||f!==null,children:[r.jsxs("div",{className:"ig-manage-navigation",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":x!==null||void 0,onClick:()=>Ee(ge,!0),children:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),"All integrations"]}),ra(t,a)&&r.jsxs("button",{type:"button",className:"btn","aria-disabled":x!==null||void 0,onClick:se=>xe({mode:"add",kind:a},se.currentTarget),children:["Add ",(ye==null?void 0:ye.label)??a," connection"]})]}),r.jsxs("h2",{ref:i,tabIndex:-1,className:"ig-managed-title",children:[(ye==null?void 0:ye.label)??a," connections"]}),m&&r.jsx("p",{className:"ig-note",role:"status",children:m}),Fe.length?r.jsx("div",{className:"ig-provider-connections",children:Fe.map(se=>We(se,!0))}):r.jsx("p",{role:"status",children:"No saved connections."})]}),f&&r.jsxs("div",{className:"ig-manage-view",hidden:v!==null,children:[r.jsxs("div",{className:"ig-manage-navigation",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":x!==null||void 0,onClick:()=>Ee(ve,!0),children:[r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),a?`Back to ${(ye==null?void 0:ye.label)??a} connections`:"All integrations"]}),$e&&ra(t,$e.kind)&&r.jsxs("button",{type:"button",className:"btn","aria-disabled":x!==null||void 0,onClick:se=>xe({mode:"add",kind:$e.kind},se.currentTarget),children:["Add ",((He=_u($e.kind))==null?void 0:He.label)??$e.kind," connection"]})]}),$e?r.jsx(ike,{connection:$e,provider:_u($e.kind),available:ra(t,$e.kind),busy:x,armed:M===f,note:A.find(se=>se.id===f),headingRef:b,onTest:()=>le($e),onEdit:se=>xe({mode:"edit",id:$e.id},se),onDisconnect:se=>de($e,se),onCancelDisconnect:()=>W(null)}):r.jsx("p",{role:"status",children:"This connection is no longer saved."})]}),r.jsxs("div",{className:"ig-overview",hidden:v!==null||f!==null||a!==null,children:[s&&r.jsxs("div",{className:"ig-list-error",role:"alert",children:[r.jsx("p",{children:s}),r.jsx("button",{type:"button",className:"btn",onClick:()=>void Gm(),children:"Retry"})]}),n===null&&!s&&r.jsx("p",{role:"status",children:"Reading connections…"}),m&&r.jsx("p",{className:"ig-note",role:"status",children:m}),r.jsxs("div",{className:"ig-connection-list","data-setting":"integrations-connections",children:[n!==null&&r.jsx("div",{className:"ig-providers","data-setting":"integrations-add",id:Le==="all"?"integrations-add-title":void 0,children:pe.map(se=>{const ke=oe.filter(_e=>_e.kind===se.kind),Ae=ke.length===1?ke[0]:null,Oe=[...new Set(ke.map(Vo))],be=Ae&&Ij(Ae),fe=(Ae==null?void 0:Ae.kind)==="jira"?Oj(Ae):null;return r.jsxs("section",{className:"ig-provider",id:`ig-provider-${se.kind}`,"aria-labelledby":`ig-provider-name-${se.kind}`,"data-setting":`integration-${se.kind}`,children:[r.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:r.jsx(se.Glyph,{})}),r.jsxs("div",{className:"ig-summary-text ig-provider-content",children:[r.jsx("h3",{id:`ig-provider-name-${se.kind}`,children:se.label}),ke.length===0?r.jsx("span",{className:"ig-conn-line",children:"Not connected"}):Ae?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"ig-conn-name",children:Vo(Ae)}),r.jsx("span",{className:"ig-conn-line",children:[Ae.account.login||Ae.account.name,fe||(be?`Last verified ${be}`:"Not verified yet")].filter(Boolean).join(" · ")}),!Ae.tokenSaved&&r.jsx("span",{className:"ig-bad",children:"No token saved"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"ig-conn-name",children:[ke.length," saved connections"]}),r.jsxs("span",{className:"ig-conn-line",children:[Oe.slice(0,2).join(" · "),Oe.length>2?` · +${Oe.length-2} more instances`:""]})]}),!re.has(se.kind)&&r.jsxs("span",{className:"ig-stranded",children:[se.label," is not available on this deck."]})]}),r.jsx("button",{type:"button",className:`btn ig-manage${ke.length?"":" primary"}`,"aria-disabled":x!==null||void 0,ref:_e=>{const Ve=ke.length?l.current:F.current;_e?Ve.set(se.kind,_e):Ve.delete(se.kind)},"aria-label":`${ke.length?"Manage":"Connect"} ${se.label}`,onClick:_e=>ke.length?De(se.kind,_e.currentTarget):xe({mode:"add",kind:se.kind},_e.currentTarget),children:ke.length?r.jsxs(r.Fragment,{children:["Manage ",r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:r.jsx("path",{d:"m6 4 4 4-4 4"})})]}):"Connect"})]},se.kind)})}),(Ke.length>0||pe.length===0&&Le!=="all"&&n!==null)&&r.jsxs(Bt,{id:"integrations-list-title",title:"Connections",aside:r.jsx("span",{className:"settings-caption-count",children:Ke.length}),children:[Ke.map(se=>We(se,!0)),oe.length===0&&r.jsx("p",{className:"settings-row settings-row-status",children:"Nothing connected."})]})]}),Le==="all"&&r.jsx(r.Fragment,{children:r.jsx("div",{className:"ig-overview-info",children:r.jsxs("details",{className:"ig-access",children:[r.jsx("summary",{children:"Access and token storage"}),r.jsx("p",{children:"Browsing integrations only reads. Jira also saves sprint and rank changes when you drag an issue or confirm Move, subject to your Jira permissions. GitHub and GitLab remain read-only. Tokens stay on this machine and are never shown again or shared with paired decks."})]})})})]})]})}function cke({theme:e}){return r.jsx("span",{className:"appearance-preview","data-swatch":e,children:r.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[r.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),r.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),r.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),r.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),r.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),r.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),r.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),r.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),r.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),r.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function uke({theme:e,onTheme:t,singleKeys:n}){const s=i=>{var f,p;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(i.key))return;i.preventDefault();const l=(f=i.target.closest("[data-theme-choice]"))==null?void 0:f.dataset.themeChoice,h=(gr.indexOf(l??e)+(i.key==="ArrowLeft"||i.key==="ArrowUp"?-1:1)+gr.length)%gr.length;t(gr[h]),(p=i.currentTarget.querySelectorAll('[role="radio"]')[h])==null||p.focus()},a=g.useRef(null),o=g.useRef(e);return g.useEffect(()=>{var u,h;const i=o.current;o.current=e;const l=document.activeElement;i===e||!l||!((u=a.current)!=null&&u.contains(l))||l.dataset.themeChoice!==i||(h=a.current.querySelector(`[data-theme-choice="${e}"]`))==null||h.focus()},[e]),r.jsx(Bt,{id:"appearance-theme-caption",title:"Theme",list:!1,settingId:"theme",aside:n&&r.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:"Press T anywhere to switch themes",children:"T"}),children:r.jsx("div",{ref:a,className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":n?"T":void 0,onKeyDown:s,children:gr.map(i=>r.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","data-theme-choice":i,"data-setting":`theme-${i}`,"aria-checked":e===i,tabIndex:e===i?0:-1,onClick:()=>t(i),children:[r.jsx(cke,{theme:i}),r.jsxs("span",{className:"appearance-theme-name",children:[oc[i].name,r.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:r.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},i))})})}const dke=[["smallest","Smallest","11 px"],["smaller","Smaller","12 px"],["default","Default","13 px"],["larger","Larger","15 px"],["largest","Largest","17 px"]],hke=[["tightest","Tightest","30%"],["tighter","Tighter","50%"],["compact","Compact","70%"],["default","Default","100%"],["comfortable","Comfortable","140%"]];function XO(){return r.jsx("svg",{className:"reading-selected-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",children:r.jsx("path",{d:"m2.5 6 2.2 2.2 4.8-4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function fke({textSize:e,density:t,onTextSize:n,onDensity:s}){const a=e!=="default"||t!=="default";return r.jsx("button",{type:"button",className:"btn",disabled:!a,onClick:()=>{n("default"),s("default")},children:"Reset to defaults"})}function pke({textSize:e,density:t,onTextSize:n,onDensity:s}){return r.jsxs(r.Fragment,{children:[r.jsxs("fieldset",{className:"reading-group",children:[r.jsx("legend",{children:"Text size"}),r.jsx("p",{id:"reading-size-help",children:"Adjust interface text without changing your browser zoom."}),r.jsx("div",{className:"reading-options reading-segmented","aria-describedby":"reading-size-help","data-setting":"text-size",style:{"--reading-count":jA.length,"--reading-selected":jA.indexOf(e)},children:dke.map(([a,o,i])=>r.jsxs("label",{className:"reading-choice","data-size":a,children:[r.jsx("input",{type:"radio",name:"text-size","aria-label":`${o} ${i}`,value:a,checked:e===a,onChange:()=>n(a)}),r.jsx("span",{className:"reading-type-sample","aria-hidden":"true",children:"Aa"}),r.jsxs("span",{className:"reading-label",children:[r.jsx("strong",{children:o}),r.jsx("small",{children:i})]}),r.jsx(XO,{})]},a))})]}),r.jsxs("fieldset",{className:"reading-group",children:[r.jsx("legend",{children:"Density"}),r.jsx("p",{id:"reading-density-help",children:"Choose the spacing in lists, panels and controls. Text size stays the same."}),r.jsx("div",{className:"reading-options reading-segmented","aria-describedby":"reading-density-help","data-setting":"density",style:{"--reading-count":NA.length,"--reading-selected":NA.indexOf(t)},children:hke.map(([a,o,i])=>r.jsxs("label",{className:"reading-choice",children:[r.jsx("input",{type:"radio",name:"density","aria-label":`${o} ${i} spacing`,value:a,checked:t===a,onChange:()=>s(a)}),r.jsxs("span",{className:"reading-density-sample","data-density":a,"aria-hidden":"true",children:[r.jsx("i",{}),r.jsx("i",{}),r.jsx("i",{})]}),r.jsxs("span",{className:"reading-label",children:[r.jsx("strong",{children:o}),r.jsx("small",{children:i})]}),r.jsx(XO,{})]},a))})]}),r.jsxs(Bt,{id:"reading-preview-title",title:"Preview",children:[r.jsxs("div",{className:"reading-preview-row",children:[r.jsxs("div",{children:[r.jsx("strong",{children:"Frontend session"}),r.jsx("span",{children:"Waiting for your review"})]}),r.jsx("span",{className:"reading-preview-time",children:"4m"})]}),r.jsxs("div",{className:"reading-preview-row",children:[r.jsxs("div",{children:[r.jsx("strong",{children:"API integration"}),r.jsx("span",{children:"Working · 3 tool calls"})]}),r.jsx("span",{className:"reading-preview-time",children:"12m"})]})]}),r.jsx("p",{className:"settings-foot",children:"Preferences stay in this browser when storage is available. Default restores the existing ccdeck appearance."})]})}const mke="AGPL-3.0-only",gke="GNU Affero General Public License, version 3 only.",yke="https://github.com/BarganConstantin/ccdeck",wke="What changed in each release, newest first.",xke="Tell the people who make ccdeck what works and what does not.";function vke(e){return`This page is from v${e}. The deck has most likely been updated since this tab opened, and a reload picks up the new version.`}function bke(e,t){return lo(e)&&lo(t)&&vi(e,t)<0}function kke(e,t){return e?{kind:"ready",to:e.version,name:"Update ready",note:`${Pt} v${e.version} is downloaded and verified.`}:t?t.kind==="restart"?{kind:"notice",name:"Update installed",note:`v${t.to} is installed — this deck still runs v${t.from}.`}:{kind:"notice",name:"Update available",note:`${Pt} v${t.to} is out — you are on v${t.from}.`}:null}function jke({version:e,notice:t,readyAppUpdate:n,updateRestarting:s,updateFailure:a,onUpdateRestart:o,doors:i,bundle:l="3.48.1"}){const u=(e==null?void 0:e.running)??l,h=kke(n,t);return r.jsxs(r.Fragment,{children:[r.jsxs(Bt,{id:"settings-about-caption",title:Pt,children:[r.jsx(mt,{as:"div",settingId:"version",name:"Version",note:bke(l,e==null?void 0:e.running)?vke(l):void 0,control:r.jsx("span",{className:"settings-read",children:u})}),h&&r.jsx(Nke,{offer:h,restarting:s,failure:a,onRestart:o,onUpdate:i.update}),r.jsx(mt,{as:"div",settingId:"whats-new",name:"What's new",note:wke,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":"Open What's new",onClick:i.whatsNew,children:"Open"})}),r.jsx(mt,{as:"div",settingId:"licence",name:"Licence",note:gke,control:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"settings-read",children:mke}),r.jsxs("a",{className:"settings-link",href:yke,target:"_blank",rel:"noreferrer",children:["Source",r.jsx("span",{className:"vis-hidden",children:": the source code, opens in your browser"})]})]})})]}),r.jsxs(Bt,{id:"settings-about-help-caption",title:"Tour and feedback",children:[r.jsx(mt,{as:"div",settingId:"tour",name:"Take the tour",note:Rj,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":"Start the tour",onClick:i.tour,children:"Start"})}),r.jsx(mt,{as:"div",settingId:"feedback",name:"Send feedback",note:xke,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":"Open the feedback dialog",onClick:i.feedback,children:"Open"})})]})]})}function Nke({offer:e,restarting:t,failure:n,onRestart:s,onUpdate:a}){if(e.kind==="notice")return r.jsx(mt,{as:"div",name:e.name,note:e.note,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog",onClick:a,children:"Update…"})});const o=I8(e.to,t),i=n&&n.version===e.to?O8(n.failure,n.version):"";return r.jsx(mt,{as:"div",name:e.name,note:e.note,control:r.jsx("button",{type:"button",className:"btn",onClick:()=>s(e.to),"aria-busy":t||void 0,"aria-label":o.label,title:o.title,children:o.text}),children:r.jsx("span",{className:"settings-row-said",role:"status",children:i})})}const Ske="Update when idle",Cke="When nothing has been running for 30 seconds, the deck restarts into a newer version. While you are looking at it, that is one already installed, and only while its notice is up; while nobody is, it installs the new version first. Off, it updates only when you press.",_ke=`${nB} It hears of no new release from npm, and restarts only into a version installed some other way, once nothing has been running for 30 seconds.`,Eke="This deck cannot restart itself (it runs without its supervisor, with --no-persist, or cannot write its event log), so nothing updates on its own here. Your choice is saved for the next start.",Tke="The desktop app keeps itself up to date. It installs a new version once it has been left alone and no agent has been working for a minute, or after waiting a day for that.";function Ake(e,t){return t&&(e!=null&&e.checkDisabled)?"app":(e==null?void 0:e.canRestart)===!1?"no-restart":e!=null&&e.checkDisabled?"checks-off":"plain"}const Rke={plain:Cke,"checks-off":_ke,"no-restart":Eke};function Mke({autoRestart:e,onToggleAutoRestart:t,version:n,inApp:s=co()}){const a=Ake(n,s);return r.jsx(Bt,{id:"settings-updates-caption",title:"Updates",children:a==="app"?r.jsx(mt,{as:"div",settingId:"auto-update",name:"Updates",note:Tke}):r.jsx(mt,{settingId:"auto-update",name:Ske,nameId:"settings-auto-update-label",note:a==="no-restart"?"Automatic updates are unavailable in this session. Your choice is saved for the next start.":a==="checks-off"?"Update checks are disabled. Only versions installed another way can be applied.":"Restart into a newer version after 30 seconds without active agents.",details:Rke[a],noteId:"settings-auto-update-note",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":e,"aria-labelledby":"settings-auto-update-label","aria-describedby":"settings-auto-update-note",onClick:t,children:r.jsx("span",{className:"switch-knob"})})})})}function $ke({character:e,onCharacter:t}){const n=g.useRef([]);function s(a,o){var l;const i=uS(a,o,Of.length,"vertical");i.kind==="select"&&(a.preventDefault(),t(Of[i.index].id),(l=n.current[i.index])==null||l.focus())}return r.jsx("div",{className:"character-picker",role:"radiogroup","aria-label":"Choose character","data-setting":"character-choice",children:Of.map((a,o)=>r.jsxs("button",{type:"button",className:"character-choice",role:"radio","aria-checked":e===a.id,tabIndex:e===a.id?0:-1,ref:i=>{n.current[o]=i},onClick:()=>t(a.id),onKeyDown:i=>s(i,o),children:[r.jsx("span",{className:"character-preview",children:r.jsx(yD,{character:a.id,act:null,facing:"right"})}),r.jsx("span",{children:a.name}),r.jsx("svg",{className:"character-check",viewBox:"0 0 16 16","aria-hidden":!0,focusable:"false",children:r.jsx("path",{d:"m3 8 3 3 7-7",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})})]},a.id))})}const Lke="Stands beside the minimap. Press it to play the radio.";function Ike({characterEnabled:e,onToggleCharacter:t,character:n="deck",onCharacter:s}){return r.jsxs(Bt,{id:"appearance-character-caption",title:"Character",list:!1,children:[r.jsx("div",{className:"settings-list",children:r.jsx(mt,{settingId:"character",name:"Show the character",nameId:"appearance-character-label",note:Lke,noteId:"appearance-character-note",control:r.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":e,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:t,children:r.jsx("span",{className:"switch-knob"})})})}),r.jsx($ke,{character:n,onCharacter:s})]})}const ZO="settings-search-field",lB="settings-search-results",Pj=e=>`settings-result-${e}`;function Oke({inputRef:e,query:t,onQuery:n,results:s,active:a,onActive:o,onOpen:i}){const l=t.trim()!=="",u=l&&s.length>0,h=f=>{if(f.nativeEvent.isComposing)return;const p=vte(f.key,t,l?s.length:0,a);p.kind!=="pass"&&(f.preventDefault(),p.kind==="move"?o(p.index):p.kind==="open"?i(s[p.index]):(f.stopPropagation(),n("")))};return r.jsxs("div",{className:"settings-search",children:[r.jsx("label",{className:"vis-hidden",htmlFor:ZO,children:"Search settings"}),r.jsxs("svg",{className:"settings-search-glyph",width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":!0,focusable:"false",children:[r.jsx("circle",{cx:"6",cy:"6",r:"4.2"}),r.jsx("path",{d:"m9.2 9.2 3.3 3.3"})]}),r.jsx("input",{ref:e,id:ZO,type:"search",className:"settings-filter-field settings-search-field",placeholder:"Search settings",autoComplete:"off",spellCheck:!1,role:"combobox","aria-autocomplete":"list","aria-expanded":u,"aria-controls":u?lB:void 0,"aria-activedescendant":u?Pj(Math.min(a,s.length-1)):void 0,"aria-keyshortcuts":"Control+F Meta+F",value:t,onChange:f=>n(f.target.value),onKeyDown:h})]})}function Pke({query:e,results:t,active:n,onOpen:s}){const a=s5(t.length,e);return g.useEffect(()=>{var o,i;(i=(o=document.getElementById(Pj(n)))==null?void 0:o.scrollIntoView)==null||i.call(o,{block:"nearest"})},[n]),r.jsxs("div",{className:"settings-pane",role:"region","aria-labelledby":"settings-search-title",children:[r.jsx("div",{className:"settings-pane-head",children:r.jsxs("div",{className:"settings-pane-heading",children:[r.jsx("h2",{className:"settings-pane-title",id:"settings-search-title",children:"Search"}),r.jsx("p",{className:"settings-pane-note","aria-hidden":!0,children:a})]})}),t.length>0&&r.jsx("div",{className:"settings-group",children:r.jsx("div",{className:"settings-list",id:lB,role:"listbox","aria-label":"Matching settings",children:t.map((o,i)=>r.jsxs("button",{type:"button",role:"option",id:Pj(i),className:"settings-result",tabIndex:-1,"aria-selected":i===n,"aria-label":gte(o),"data-highlighted":i===n,onMouseDown:l=>l.preventDefault(),onClick:()=>s(o),children:[r.jsx(gm,{section:o.section}),r.jsxs("span",{className:"settings-result-text",children:[r.jsx("span",{className:"settings-result-name",children:o.label}),r.jsx("span",{className:"settings-result-place",children:qN(o)})]})]},o.id))})})]})}function Dke({query:e,count:t}){return r.jsx("p",{className:"vis-hidden",role:"status",children:e.trim()?s5(t,e):""})}const Fke=1500,Bke=3e3,qke=e=>e.checkVisibility?e.checkVisibility():e.getClientRects().length>0;function Uke(e){if(e.matches(np)&&!e.disabled)return e;const t=e.querySelector('input[type="radio"]:checked, [role="radio"][aria-checked="true"]');if(t)return t;const n=Array.from(e.querySelectorAll(np)).filter(s=>AP({disabled:s.disabled,tabIndex:s.tabIndex,rendered:qke(s)}));return n.find(s=>s.closest(".settings-list")!=null)??n[0]??null}function Wke(e,t,n){const[s,a]=g.useState(null),o=g.useRef(void 0),i=g.useRef(null);return g.useEffect(()=>()=>{var l;window.clearTimeout(o.current),(l=i.current)==null||l.removeAttribute("data-jumped")},[]),g.useEffect(()=>{const l=e.current;if(!s||!t||!l)return;const u=()=>l.querySelector(`[data-setting="${CSS.escape(s)}"]`),h=w=>{var k,v;a(null);const b=w.offsetHeight>l.clientHeight-48;w.scrollIntoView({block:b?"start":"center"}),(k=Uke(w))==null||k.focus({preventScroll:!0}),window.clearTimeout(o.current),(v=i.current)==null||v.removeAttribute("data-jumped"),w.offsetWidth,w.setAttribute("data-jumped",""),i.current=w,o.current=window.setTimeout(()=>{w.removeAttribute("data-jumped"),i.current===w&&(i.current=null)},Fke)},f=u();if(f){h(f);return}const p=new MutationObserver(()=>{const w=u();w&&(p.disconnect(),window.clearTimeout(m),h(w))});p.observe(l,{childList:!0,subtree:!0});const m=window.setTimeout(()=>{p.disconnect(),a(null)},Bke);return()=>{p.disconnect(),window.clearTimeout(m)}},[e,s,t,n]),a}function Hke({section:e,landOn:t,onSection:n,onClose:s,providers:a,sound:o,tones:i,customTones:l,notify:u,appearance:h,versionCheck:f,desktopUpdate:p,restart:m,doors:w}){const b=g.useRef(null),k=g.useCallback(be=>{b.current=be},[]);function v(be,fe=!1){b.current?(P(""),b.current(be,fe),requestAnimationFrame(()=>{var _e,Ve;return(Ve=(_e=x.current)==null?void 0:_e.scrollIntoView)==null?void 0:Ve.call(_e,{block:"nearest",inline:"nearest"})})):be()}const N=()=>v(s,!0),x=g.useRef(null),C=gt(N,{focusRef:x}),S=yt(()=>v(s)),_=g.useRef([]),$=$d(),A=WS($),O=dee(A,e,a.claude),M=Math.max(0,O.findIndex(be=>be.id===e)),W=ic("(max-width: 640px)"),[B,R]=g.useState(""),[q,T]=g.useState(0),F=g.useRef(null),D=g.useRef(null),K=B.trim()!=="",V=g.useMemo(()=>xte(B,n5(a.claude,A,Ld($))),[B,a.claude,A,$]),H=Wke(D,!K,e),P=be=>{R(be),T(0)};g.useEffect(()=>{t&&H(t)},[t,H]);const I=be=>{v(()=>{P(""),n(be),requestAnimationFrame(()=>{var fe;return(fe=document.getElementById(`settings-tab-${be}`))==null?void 0:fe.focus()})})},U=be=>{v(()=>{P(""),n(be.section),mm(be)||H(be.id)})};g.useEffect(()=>{const be=fe=>{var ot,tt;if(!yee(fe))return;const _e=C.current,Ve=fe.target;!_e||!(Ve===document.body||Ve===document.documentElement||Ve&&_e.contains(Ve))||(fe.preventDefault(),(ot=F.current)==null||ot.focus(),(tt=F.current)==null||tt.select())};return window.addEventListener("keydown",be),()=>window.removeEventListener("keydown",be)},[C]),g.useEffect(()=>{var be,fe,_e,Ve;hee((be=document.activeElement)==null?void 0:be.id,e)&&((fe=x.current)==null||fe.focus()),(Ve=(_e=x.current)==null?void 0:_e.scrollIntoView)==null||Ve.call(_e,{block:"nearest",inline:"nearest"})},[e]);const{theme:Z,setTheme:z,characterEnabled:X,setCharacterEnabled:Y,character:J,setCharacter:Q}=h,te=An(),le=be=>{const fe=uS(be,M,O.length,"vertical");fe.kind!=="pass"&&(be.preventDefault(),v(()=>{var _e;P(""),n(O[fe.index].id),(_e=_.current[fe.index])==null||_e.focus()}))},de=be=>{be.key===" "&&be.stopPropagation()},{soundOn:oe,toggleSound:re}=o,{tonePrefs:he,previewTone:pe,changeTone:Le}=i,{customSelections:ge,customAssets:ve,clearCustomOnly:je,selectCustomTone:Ee,importNotificationAudio:xe,createNotificationVoice:Ie,renameCustomAsset:De,deleteCustomAsset:We,previewCustomAsset:Ke}=l,{notifyPermission:ye,notifyOn:Fe,notifyVetoed:$e,toggleNotify:Re,notifySupported:rt,askForNotifications:He,accountNotify:se,toggleAccountNotify:ke}=u,Ae=(()=>{switch(e){case"radar":return r.jsx(Bbe,{onOpen:w.radar});case"claude":return r.jsx(tke,{});case"appearance":return r.jsxs(r.Fragment,{children:[r.jsx(uke,{theme:Z,onTheme:z,singleKeys:te}),r.jsx(Ike,{characterEnabled:X,character:J,onCharacter:Q,onToggleCharacter:()=>Y(be=>!be)})]});case"reading":return r.jsx(pke,{textSize:h.textSize,density:h.density,onTextSize:h.setTextSize,onDensity:h.setDensity});case"keyboard":return r.jsx(kbe,{singleKeys:te,onToggleSingleKeys:()=>OY(!te)});case"notifications":return r.jsx(jbe,{notifyOn:Fe,onToggleNotify:Re,notifyVetoed:$e,notifyPermission:rt?ye:"unsupported",onAskNotify:He,accountNotify:se,onToggleAccountNotify:ke});case"sounds":return r.jsx(Dbe,{soundOn:oe===!0,onToggleSound:re,prefs:he,claudeHere:a.claude,onLevel:(be,fe)=>Le(be,{level:fe}),onFigure:(be,fe)=>Le(be,{figure:fe}),onPreview:be=>pe(be),customAssets:ve,customSelections:ge,onBuiltInSelected:je,onCustomSelected:Ee,onImportCustom:xe,onCreateVoice:Ie,onRenameCustom:De,onPreviewCustom:Ke,onDeleteCustom:We});case"integrations":return r.jsx(lke,{onBeforeLeaveChange:k});case"data":return r.jsx(rke,{});case"about":return r.jsx(jke,{version:f.version,notice:f.notice,readyAppUpdate:p.readyAppUpdate,updateRestarting:p.desktopUpdateRestarting,updateFailure:p.desktopUpdateFailure,onUpdateRestart:be=>{p.askDesktopUpdateRestart(be)},doors:w});default:return r.jsxs(r.Fragment,{children:[r.jsx(ube,{}),r.jsx(WO,{provider:"Codex"}),a.claude&&r.jsx(WO,{provider:"Claude"}),r.jsx(Mke,{autoRestart:m.autoRestart,onToggleAutoRestart:m.toggleAutoRestart,version:f.version}),r.jsx(ybe,{claudeHere:a.claude,singleKeys:te,doors:w})]})}})(),Oe=e==="reading"?r.jsx(fke,{textSize:h.textSize,density:h.density,onTextSize:h.setTextSize,onDensity:h.setDensity}):e==="integrations"&&$.connections!==null?r.jsxs("span",{className:"ig-total",children:[$.connections.length," saved connection",$.connections.length===1?"":"s"]}):null;return r.jsx("div",{className:"modal-backdrop",...S,role:"presentation",children:r.jsxs("div",{ref:C,id:"settings",className:"modal settings-modal",role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",onClick:be=>be.stopPropagation(),onKeyDown:de,children:[r.jsxs("header",{className:"modal-head",children:[r.jsx("div",{className:"modal-title",children:r.jsx("span",{id:"settings-title",className:"modal-tool-name",children:"Settings"})}),r.jsx("div",{className:"modal-actions",children:r.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>v(s),"aria-label":"Close settings",title:"Close (Esc)",children:"×"})})]}),r.jsxs("div",{className:"settings-body",children:[r.jsxs("div",{className:"settings-side",children:[r.jsx(Oke,{inputRef:F,query:B,onQuery:P,results:V,active:q,onActive:T,onOpen:U}),r.jsx(Dke,{query:B,count:V.length}),r.jsx("div",{className:"settings-nav",role:"tablist","aria-label":"Settings sections","aria-orientation":W?"horizontal":"vertical",onKeyDown:le,children:O.map((be,fe)=>r.jsxs("button",{ref:_e=>{_.current[fe]=_e,be.id===e&&(x.current=_e)},type:"button",role:"tab",id:`settings-tab-${be.id}`,className:"settings-tab","aria-selected":be.id===e,"aria-controls":"settings-pane",tabIndex:be.id===e?0:-1,onClick:()=>I(be.id),children:[r.jsx(gm,{section:be.id}),r.jsx("span",{className:"settings-tab-label",children:be.label})]},be.id))})]}),r.jsxs("div",{ref:D,className:"settings-pane",role:"tabpanel",id:"settings-pane","aria-labelledby":`settings-tab-${e}`,hidden:K||void 0,children:[r.jsxs("div",{className:"settings-pane-head",children:[r.jsxs("div",{className:"settings-pane-heading",children:[r.jsx("h2",{className:"settings-pane-title",children:O[M].label}),r.jsx("p",{className:"settings-pane-note",children:O[M].note})]}),Oe]}),Ae]},e),K&&r.jsx(Pke,{query:B,results:V,active:q,onOpen:U})]})]})})}function zke({tool:e,onClose:t}){const n=gt(t),s=yt(t),a=e.endedAt==null?"inflight":e.ok===!1?"err":"done",o=g.useRef({of:null});o.current.of!==e&&(o.current={of:e}),e.input!==void 0&&(o.current.input=e.input),e.response!==void 0&&(o.current.response=e.response);const i=o.current.input??e.inputPreview,l=o.current.response??e.errorPreview,u=e.trimmed===!0&&o.current.input===void 0&&o.current.response===void 0,h=g.useMemo(()=>{const f=uV(e.name,i,l);return{input:f.input.map((p,m)=>r.jsx(JO,{block:p},m)),response:f.response.map((p,m)=>r.jsx(JO,{block:p},m)),copyInput:JE(e.name,"input",i),copyResponse:JE(e.name,"response",l)}},[e.name,i,l]);return r.jsx("div",{className:"modal-backdrop",...s,role:"presentation",children:r.jsxs("div",{ref:n,className:"modal tool-modal",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[r.jsxs("header",{className:"modal-head",children:[r.jsxs("div",{className:"modal-title",children:[r.jsx("span",{className:`status-dot ${a}`,"aria-hidden":!0}),r.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),r.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),r.jsxs("div",{className:"modal-actions",children:[r.jsx("span",{className:"modal-dur",children:EP(e,"in-flight…")}),r.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),r.jsxs("section",{className:"modal-body",children:[u&&r.jsx("div",{className:"modal-section",children:r.jsx("p",{className:"modal-note",children:"Full payloads for this call were released to keep memory bounded — only the previews below are still held."})}),r.jsxs("div",{className:"modal-section",children:[r.jsxs("div",{className:"tm-head",children:[r.jsx("h4",{children:"Input"}),r.jsx(QO,{text:h.copyInput,what:"input"})]}),h.input]}),r.jsxs("div",{className:"modal-section",children:[r.jsxs("div",{className:"tm-head",children:[r.jsxs("h4",{children:["Response ",a==="err"&&r.jsx("span",{className:"err-tag",children:"error"})]}),e.endedAt!=null&&r.jsx(QO,{text:h.copyResponse,what:"response"})]}),e.endedAt==null?r.jsx("pre",{children:"(waiting…)"}):h.response]})]})]})})}const Vke={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function JO({block:e}){const[t,n]=g.useState(!1);if(e.inline)return r.jsxs("p",{className:"tm-inline",children:[e.label&&r.jsx("span",{className:"tm-label",children:e.label}),r.jsx("code",{children:e.text})]});const s=g.useMemo(()=>sV(e),[e]),{shown:a}=nP(s,t),o=rV(s,t);return r.jsxs("div",{className:"tm-block",children:[e.label&&r.jsx("span",{className:"tm-label",children:e.label}),r.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?a.map((i,l)=>r.jsxs("span",{className:i.tone?Vke[i.tone]:void 0,children:[i.text,l<a.length-1?`
|
|
315
315
|
`:""]},l)):a.map(i=>i.text).join(`
|
|
316
|
-
`)}),o&&r.jsx("button",{type:"button",className:"btn tm-more","aria-expanded":o.expanded,onClick:()=>n(i=>!i),children:o.label})]})}function QO({text:e,what:t}){const[n,s]=g.useState(!1),a=g.useRef(!0);return g.useEffect(()=>()=>{a.current=!1},[]),r.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void ho(e).then(o=>{!o||!a.current||(s(!0),window.setTimeout(()=>{a.current&&s(!1)},1600))}),children:n?"copied":"copy"})}const Gke=Vm(()=>bi(()=>import("./UsageHistoryModal-
|
|
316
|
+
`)}),o&&r.jsx("button",{type:"button",className:"btn tm-more","aria-expanded":o.expanded,onClick:()=>n(i=>!i),children:o.label})]})}function QO({text:e,what:t}){const[n,s]=g.useState(!1),a=g.useRef(!0);return g.useEffect(()=>()=>{a.current=!1},[]),r.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n?`The ${t} was copied`:`Copy the ${t}`,onClick:()=>void ho(e).then(o=>{!o||!a.current||(s(!0),window.setTimeout(()=>{a.current&&s(!1)},1600))}),children:n?"copied":"copy"})}const Gke=Vm(()=>bi(()=>import("./UsageHistoryModal-CiExD9wF.js"),[]),"Usage history"),Kke=Vm(()=>bi(()=>import("./BrowserWatchModal-Dfsuy2cT.js"),[]),"Browser Watch"),Yke=Vm(()=>bi(()=>import("./TrafficRadar-C5GXMIwi.js"),[]),"Telemetry Radar");function Xke({dialogs:e,welcome:t,desktopUpdate:n,versionCheck:s,restart:a,upgrade:o,lanPairs:i,attention:l,clearFlow:u,watchBadge:h,announcements:f,appearance:p,providers:m,stateRef:w,agentCount:b,menus:k,sound:v,tones:N,customTones:x,notify:C,panelDoors:S}){const{openedTool:_,setOpenedToolKey:$,usageHistoryOpen:A,setUsageHistoryOpen:O,browserWatchOpen:M,setBrowserWatchOpen:W,contextAgent:B,setContextFor:R,summaryFor:q,setSummaryFor:T,keyHelpOpen:F,setKeyHelpOpen:D,feedbackOpen:K,setFeedbackOpen:V,feedbackPrefill:H,setFeedbackPrefill:P,openFeedback:I}=e,{trafficRadarOpen:U,setTrafficRadarOpen:Z}=e,{tourOpen:z,openTour:X,closeTour:Y,releaseNotes:J,closeReleaseNotes:Q,chipVersion:te,openReleaseNotes:le}=t,{desktopUpdateRestarting:de,desktopUpdateFailure:oe,readyAppUpdate:re,askDesktopUpdateRestart:he}=n,{version:pe,showNotice:Le}=s,{askRestart:ge}=a,{clearConfirmOpen:ve,setClearConfirmOpen:je,requestClear:Ee}=u,{setWatchOn:xe,markWatchSeen:Ie}=h,{setWatchSaid:De}=f,{palette:We}=p,{settingsOpen:Ke,settingsSection:ye,settingsLandOn:Fe,showSection:$e,closeSettings:Re,openSettings:rt}=k;return r.jsxs(r.Fragment,{children:[_&&r.jsx(zke,{tool:_,onClose:()=>$(null)}),A&&r.jsx(g.Suspense,{fallback:null,children:r.jsx(Gke,{providers:m,onClose:()=>O(!1)})}),M&&r.jsx(g.Suspense,{fallback:null,children:r.jsx(Kke,{onClose:()=>W(!1),onSeen:He=>{De(""),Ie(He)},onWatching:xe,palette:We})}),B&&r.jsx(oK,{agent:B,onClose:()=>R(null)}),U&&r.jsx(g.Suspense,{fallback:null,children:r.jsx(Yke,{sessions:[...w.current.agents.values()].filter(He=>He.kind==="root"&&He.provider!=="codex").map(He=>({id:He.sessionId,label:tm(He.sessionName,He.sessionTitle).face??He.cwdBasename??He.label,project:He.cwdBasename??He.label,workspace:He.cwd})),onClose:()=>Z(!1)})}),K&&r.jsx(K8,{initialKind:H==null?void 0:H.initialKind,initialBody:H==null?void 0:H.initialBody,onClose:()=>{V(!1),P(null)}}),q&&r.jsx(abe,{state:w.current,sessionId:q,onClose:()=>T(null)}),Ke&&r.jsx(Hke,{section:ye,landOn:Fe,onSection:$e,onClose:Re,providers:m,sound:v,tones:N,customTones:x,notify:C,appearance:p,versionCheck:s,desktopUpdate:n,restart:a,doors:{whatsNew:Wa(Re,le),update:Wa(Re,()=>{le(),Le()}),tour:Wa(Re,X),feedback:Wa(Re,()=>I()),accounts:Wa(Re,S.accounts),localNetwork:Wa(Re,S.localNetwork),browserWatch:Wa(Re,()=>W(!0)),radar:Wa(Re,()=>Z(!0))}}),J&&r.jsx(rbe,{entries:J.entries,since:J.since,firstRun:J.firstRun,running:te,onClose:Q,onTour:()=>{Q(),X()},updateVersion:re==null?void 0:re.version,updateBusy:de,updateFailure:oe&&(!re||re.version===oe.version)?O8(oe.failure,oe.version):void 0,onUpdateRestart:re?()=>{he(re.version)}:void 0,onRestart:!re&&(pe!=null&&pe.canRestart)?()=>{Q(),ge()}:void 0,updateCheck:{versionCheck:s,upgrade:o,restart:a,desktopUpdate:n,running:te,onHandOff:Q}}),r.jsx(Zke,{lanPairs:i,attention:l}),F&&r.jsx(uve,{onClose:()=>D(!1),onTour:()=>{D(!1),X()},onSettings:()=>{D(!1),rt("keyboard")}}),z&&r.jsx(v6,{title:"What the deck shows you",steps:nle,onClose:Y}),ve&&r.jsx(exe,{agentCount:b,onConfirm:()=>Ee("confirmation"),onCancel:()=>je(!1)})]})}function Zke({lanPairs:e,attention:t}){const n=bve(e);return r.jsxs(r.Fragment,{children:[n,r.jsx(Sve,{...t,pairing:n!=null})]})}const Jke=10,cB=500,uB=4e3,Qke=[/ResizeObserver loop/i,/^Script error\.?$/i],e3=/^(?:[a-z][\w+.-]*-extension|webkit-masked-url):\/\//i,e0e=/[a-z][\w+.-]*:\/\/[^\s()]+/gi;function t0e(e,t){const n=typeof e=="string"?e.split(`
|
|
317
317
|
`):[],s=n.some(o=>/^\s*at\s/.test(o)),a=n.flatMap(o=>!s||/^\s*at\s/.test(o)?o.match(e0e)??[]:[]);return a.length?a.every(o=>e3.test(o)):typeof t=="string"&&e3.test(t)}const Dp=String.raw`[^\s\\/:'"\`<>|?*;,]`,n0e=String.raw`${Dp}(?:[^\\/\r\n:'"\`<>|?*;,]*${Dp})?[\\/]`,s0e=String.raw`[^\s\\/:'"\`<>|?*;,()]+`,gu=String.raw`(?:${n0e})*(?:${s0e})?`,r0e=String.raw`(?<![\w.~/\\\]-]|<(?:deck|host)>)(?:file://(?:/[A-Za-z]:)?[^\s:'"\`<>()]*|~[\\/]${gu}|[A-Za-z]:[\\/]${gu}|\\\\(?:[?.]\\)?(?:[A-Za-z]:\\)?${gu}|/(?=${Dp})${gu}|(?<!:)//(?=${Dp})${gu})`,a0e=String.raw`(?<![\w-])(?:[A-Za-z]--|-[A-Za-z0-9][\w.]*-)[\w.-]*`,o0e=new Set([".claude",".codex"]);function i0e(e){if(!e.startsWith("~"))return"<path>";const t=e[1],[n,...s]=e.slice(2).split(/[\\/]/);return n?o0e.has(n)?s.join("")?`~${t}${n}${t}<path>`:e:`~${t}<path>`:e}const l0e=String.raw`\b(https?|wss?)://[^\s/?#\\'"\x60<>(),;]+(?=(/assets/)?)`;function c0e(e,t,n){return n?"<deck>":`${t}://<host>`}const t3=String.raw`(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)`,dB=String.raw`${t3}(?:\.${t3}){3}`,e1=String.raw`[0-9A-Fa-f]{1,4}`,n3=String.raw`(?=[0-9A-Fa-f:]*\d)(?=[0-9A-Fa-f:]*::|(?:${e1}:){7})(?:(?:${e1})?:)+(?:${dB}|${e1})?`,s3=String.raw`%[\w-]+(?:\.[\w-]+)*`,r3=String.raw`(?:::1?|::ffff:(?:127(?:\.\d{1,3}){3}|0\.0\.0\.0))`,u0e=String.raw`(?<![\w:.%-])(?:\[(?!${r3}\])${n3}(?:${s3})?\]|(?!${r3}(?::\d{1,5})?(?![\w:%]|\.\d))${n3}(?:${s3})?(?![\w%]|\.\d))|(?<![\w./-])(?!127\.|0\.0\.0\.0\b)${dB}(?![\w-]|\.\d)`,t1=String.raw`(?=[\w.-]*[A-Za-z])[A-Za-z0-9][\w-]*(?:\.[\w-]+)*`,d0e=String.raw`(?<![\w.@/\\%-])(?!localhost(?![\w-]|\.\w))(?:(?<=\b(?:(?:getaddrinfo|connect) E[A-Z_]+|ENOTFOUND|EAI_AGAIN) )${t1}|${t1}(?=:\d{1,5}(?![\w:-]|\.\w))|${t1}\.(?:local|lan|home|internal|ts\.net)(?![\w-]|\.\w))`;function a3(e){return String(e??"").replace(/\/(?:home|Users)\/[^/\s:'"]+/g,"~").replace(/[A-Za-z]:\\(?:Users|Documents and Settings)\\[^\\\r\n:'"]+/gi,"~").replace(new RegExp(r0e,"g"),i0e).replace(new RegExp(a0e,"g"),"<project>").replace(new RegExp(l0e,"g"),c0e).replace(new RegExp(u0e,"g"),"<host>").replace(new RegExp(d0e,"g"),"<host>").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,}|github_pat_[A-Za-z0-9_]{20,}|gl(?:pat|dt|rt|cbt|ptt|ft|imt|agent|oas|soat)-[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 hB=e=>{fetch("/api/client-error",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),keepalive:!0}).catch(()=>{})};function h0e(e,t,n=hB){const s=String(e??"").slice(0,cB).trim();s&&n({message:s,stack:typeof t=="string"?t.slice(0,uB):void 0})}function f0e(e,t=window,n=hB){let s=0;const a=new Set,o=(u,h,f)=>{const p=String(u??"").slice(0,cB).trim();!e()||!p||s>=Jke||a.has(p)||Qke.some(m=>m.test(p))||t0e(h,f)||(a.add(p),s++,n({message:p,stack:typeof h=="string"?h.slice(0,uB):void 0}))},i=u=>{var h,f;return o(((h=u.error)==null?void 0:h.message)??u.message,(f=u.error)==null?void 0:f.stack,u.filename)},l=u=>typeof u.reason=="object"&&u.reason!==null?o(u.reason.message,u.reason.stack):o(u.reason,void 0);return t.addEventListener("error",i),t.addEventListener("unhandledrejection",l),()=>{t.removeEventListener("error",i),t.removeEventListener("unhandledrejection",l)}}const p0e=12;function m0e(e,t){const n=[a3(e).trim()||"The deck threw an error with no message."],s=t==null?void 0:t.trim();if(s){const a=s.split(`
|
|
318
318
|
`).slice(0,p0e).join(`
|
|
319
319
|
`);n.push("",a3(a).trim())}return n.join(`
|
|
320
320
|
`)}class g0e extends g.Component{constructor(){super(...arguments);qa(this,"state",{error:null,componentStack:null,reportOpen:!1});qa(this,"onKey",n=>{nm(n.key)&&rn.dismissTop()})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,s){console.error("ccdeck hit a render error it could not draw past",n,s.componentStack),this.setState({componentStack:s.componentStack??null}),h0e(n.message,n.stack),g8("offline")}componentDidUpdate(n,s){this.state.reportOpen!==s.reportOpen&&(this.state.reportOpen?window.addEventListener("keydown",this.onKey):window.removeEventListener("keydown",this.onKey))}componentWillUnmount(){window.removeEventListener("keydown",this.onKey)}render(){const{error:n,componentStack:s,reportOpen:a}=this.state;return n?r.jsxs("div",{className:"error-fallback",children:[r.jsxs("div",{className:"error-fallback-card",role:"alert",children:[r.jsx("p",{className:"error-fallback-title",children:"Something went wrong"}),r.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."}),r.jsxs("div",{className:"error-fallback-actions",children:[r.jsx("button",{type:"button",className:"btn primary",onClick:()=>window.location.reload(),children:"Reload"}),r.jsx("button",{type:"button",className:"btn",onClick:()=>this.setState({reportOpen:!0}),"aria-haspopup":"dialog",children:"Send report"})]})]}),a&&r.jsx(K8,{initialKind:"bug",initialBody:m0e(n.message,s),onClose:()=>this.setState({reportOpen:!1})})]}):this.props.children}}const y0e=1e3;function w0e(e={}){const t=Math.max(1,Math.floor(e.limit??y0e)),n=e.protect;let s=!1,a=[],o=new Set,i=0,l=0,u=null;return{get paused(){return s},get size(){return a.length},get dropped(){return i},get overflowed(){return i>0},get through(){return l},accept(h){const f=typeof(h==null?void 0:h.seq)=="number"?h.seq:null,p=(h==null?void 0:h.epoch)??null,m=p!==null&&p!==u;m&&(u=p,l=0);const w=f!==null&&!m&&f<=l;if(f!==null&&f>l&&(l=f),!s)return!0;if(w)return!1;if(a.push(h),n!=null&&n(h)&&o.add(h),a.length>t){let b=0;if(o.size<a.length)for(;o.has(a[b]);)b++;const[k]=a.splice(b,1);o.delete(k),i++}return!1},setPaused(h){if(s=h,h)return[];const f=a;return a=[],o=new Set,i=0,f}}}function x0e(e){const t=g.useState(()=>w0e({protect:o=>bV(e.current,o)}))[0],[n,s]=g.useState(!1),a=g.useCallback(()=>{const o=t.paused&&t.dropped>0,i=t.setPaused(!t.paused);o&&oG(e.current);for(const l of i)e.current=pP(e.current,l);s(t.paused)},[t,e]);return{pauseGate:t,paused:n,togglePause:a}}const Dj={kind:"assumed",claude:!0,codex:!0};function v0e(e){if(!e||typeof e!="object")return Dj;const t=e.providers;if(!t||typeof t!="object")return Dj;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function b0e(e){const[t,n]=g.useState(null),[s,a]=g.useState(Dj);g.useEffect(()=>{let i=!1;return fetch("/api/health").then(l=>l.ok?l.json():null).then(l=>{i||(a(v0e(l)),!(!l||typeof l.workspace!="string")&&n(l.workspace))}).catch(()=>{}),()=>{i=!0}},[e]);const o=Fn(s);return{workspace:t,providers:s,providersRef:o}}const fB=3*6e4,k0e=2e4;function j0e({fetchReport:e,visible:t,now:n,onReport:s}){let a=0,o=!0;const i=async()=>{if(!t())return;const l=await e();!o||!l||(a=n(),s(l))};return{tick:i,wake:async()=>{t()&&n()-a>=fB&&await i()},stop:()=>{o=!1}}}async function N0e(){try{const e=await fetch("/api/provider-status",{signal:AbortSignal.timeout(k0e)});return e.ok?await e.json():null}catch{return null}}function S0e(e){const[t,n]=g.useState(null);return g.useEffect(()=>{if(!e){n(null);return}const s=j0e({fetchReport:N0e,visible:()=>document.visibilityState==="visible",now:()=>Date.now(),onReport:n});s.tick();const a=window.setInterval(s.tick,fB),o=()=>{s.wake()};return document.addEventListener("visibilitychange",o),()=>{s.stop(),window.clearInterval(a),document.removeEventListener("visibilitychange",o)}},[e]),t}const C0e={degraded:"degraded performance",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},_0e={degraded:"degraded",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},E0e={degraded:"degraded",partial_outage:"outage",major_outage:"outage",maintenance:"maint."},T0e={claude:"Claude",codex:"Codex"},A0e=new Set(["status.claude.com","status.openai.com"]),R0e=30*6e4,M0e=10*6e4;function $0e(e){if(typeof e!="string")return null;try{const t=new URL(e);return t.protocol==="https:"&&A0e.has(t.hostname)?t:null}catch{return null}}function o3(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})}function L0e(e){const t=Math.floor(e/6e4);return t<1?"just now":t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`}function I0e(e,t){if(!e||typeof e!="object")return null;const n=Jt(C0e,e.state),s=Jt(T0e,e.provider);if(!n||!s||typeof e.checkedAt!="number"||t-e.checkedAt>R0e)return null;const a=$0e(e.statusPageUrl);if(!a)return null;const o=Array.isArray(e.components)?e.components:[],i=e.stale===!0||t-e.checkedAt>M0e,l=[`${s}: ${n}${e.summary?` — ${e.summary}`:""}`,o.length>0?`Affected: ${o.join(", ")}`:null,e.scope==="page"?`The page's overall status: it names none of ${s}'s components`:null,i?`Last read from ${a.hostname} at ${o3(e.checkedAt)}; this is the last thing it said`:`Reported by ${a.hostname}, checked ${L0e(t-e.checkedAt)}`,"Opens the status page"],u=i?o3(e.checkedAt):null;return{provider:e.provider,state:e.state,name:s,label:`${s} · ${n}${u?` · as of ${u}`:""}`,words:n,chipWords:Jt(_0e,e.state)??n,shortWords:Jt(E0e,e.state)??n,asOf:u,what:e.summary||(o.length>0?o.join(", "):null),href:a.href,host:a.hostname,stale:i,detail:l.filter(Boolean).join(`
|
|
321
|
-
`)}}function O0e(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>I0e(n,t)).filter(n=>n!==null)}function P0e(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const D0e="The providers' status pages report no incident.";function F0e({version:e,loadVersion:t}){var h;const[n,s]=g.useState(!1),a=((h=e==null?void 0:e.upgrade)==null?void 0:h.state)??"idle",o=Uwe(e==null?void 0:e.upgrade),i=g.useRef(!1),l=g.useCallback(async()=>{if(Cn(i.current||a==="running")){i.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),i.current=!1}},[a,t]);g.useEffect(()=>{if(a!=="running")return;const f=window.setInterval(t,3e3);return()=>window.clearInterval(f)},[a,t]);const u=g.useCallback(async()=>{const f=e==null?void 0:e.command;!f||!await ho(f)||(s(!0),window.setTimeout(()=>s(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:a,upgradeFailure:o,startUpgrade:l,copyCommand:u,cmdCopied:n}}const i3="agent-dag.browserWatch.seenMs";function B0e(e,t){return e.filter(n=>n.startMs>t)}function q0e(){const[e,t]=g.useState(()=>Number(nt(i3))||0),[n,s]=g.useState([]),[a,o]=g.useState(!1);g.useEffect(()=>{let u=!0;const h=()=>{fetch("/api/browser-watch?live=0").then(p=>p.ok?p.json():null).then(p=>{var m;!u||!(p!=null&&p.ok)||(s(p.episodes??[]),o(((m=p.settings)==null?void 0:m.enabled)===!0))}).catch(()=>{})};h();const f=setInterval(h,5*6e4);return()=>{u=!1,clearInterval(f)}},[]);const i=g.useMemo(()=>B0e(n,e).length,[n,e]),l=g.useCallback(u=>{t(u),st(i3,String(u))},[]);return{watchOn:a,setWatchOn:o,watchUnseen:i,markWatchSeen:l}}const pB="agent-dag.character-enabled",mB="agent-dag.fm-volume",U0e=1,l3="agent-dag.fm-source",Sje=[{value:"claude-fm",label:"🎧 Claude FM"},{group:"📻 Lofi Girl",value:"lofi-relax",label:"📚 Relax / study"},{group:"📻 Lofi Girl",value:"lofi-game",label:"🎮 Chill / game"},{group:"📻 Lofi Girl",value:"lofi-vibe",label:"🌅 Vibe / chill"},{group:"📻 Lofi Girl",value:"lofi-sleep",label:"💤 Sleep / chill"},{group:"📻 Radio Mix",value:"radio-mix",label:"📡 Live radio mix"},{group:"📻 The Good Life Radio",value:"good-life-radio",label:"🌴 The Good Life Radio"}];function W0e(e){return e==="lofi-relax"||e==="lofi-game"||e==="lofi-vibe"||e==="lofi-sleep"||e==="radio-mix"||e==="best-of-nostalgia"||e==="good-life-radio"||e==="cafe-music-bgm"?e:"claude-fm"}function H0e(e){return e!=="0"}function z0e(){return H0e(nt(pB))}function V0e(e){return JD(e,U0e)}function G0e(){return V0e(nt(mB))}const gB=["--err","--inflight","--ok","--warn","--muted","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function c3(e){const t={};for(const n of gB)t[n]=e(n);return t}function K0e(e){return t=>e[t]??""}function Y0e(e,t){return gB.every(n=>e[n]===t[n])}function X0e(e,t){let n=null,s=0;function a(){s++,n==null||n.skipTransition(),n=null,delete e.documentElement.dataset.themeTransition}return{cancel:a,run(o){a();const i=s;let l=!1;const u=()=>{i!==s||l||(l=!0,o())};if(!e.startViewTransition||e.hidden||t()){u();return}e.documentElement.dataset.themeTransition="true";try{const h=e.startViewTransition(u);n=h,h.ready.catch(()=>{}),h.updateCallbackDone.catch(()=>{u()}),h.finished.then(()=>{n===h&&(n=null,delete e.documentElement.dataset.themeTransition)},()=>{n===h&&(u(),n=null,delete e.documentElement.dataset.themeTransition)})}catch{delete e.documentElement.dataset.themeTransition,u()}}}}function u3(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function Z0e(){const[e,t]=g.useState(Ute),[n,s]=g.useState(Wte),[a,o]=g.useState(cte),i=g.useRef(a),[l]=g.useState(()=>X0e(document,()=>{try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!0}})),u=g.useCallback(N=>{const x=typeof N=="function"?N(i.current):N;x!==i.current&&(i.current=x,l.run(()=>vt.flushSync(()=>o(x))))},[l]);g.useEffect(()=>()=>l.cancel(),[l]);const[h,f]=g.useState(z0e),[p,m]=g.useState(vee),[w,b]=g.useState(()=>c3(u3)),k=g.useMemo(()=>K0e(w),[w]),v=g.useCallback(N=>Kme(N,k),[k]);return g.useEffect(()=>{document.documentElement.dataset.textSize=e,st(V1,e)},[e]),g.useEffect(()=>{document.documentElement.dataset.density=n,st(G1,n)},[n]),g.useEffect(()=>{const N=x=>{x.storageArea===wr()&&((x.key===V1||x.key===null)&&t(HN(x.newValue)),(x.key===G1||x.key===null)&&s(u5(x.newValue)))};return window.addEventListener("storage",N),()=>window.removeEventListener("storage",N)},[]),g.useLayoutEffect(()=>{document.documentElement.dataset.theme=a,document.documentElement.dataset.colorScheme=oc[a].colorScheme,st(e5,a),b(N=>{const x=c3(u3);return Y0e(N,x)?N:x})},[a]),g.useEffect(()=>{st(pB,h?"1":"0")},[h]),g.useEffect(()=>{st(HD,p)},[p]),g.useEffect(()=>{const N=document.querySelector('meta[name="theme-color"]'),x=w["--panel"];N&&x&&N.setAttribute("content",x)},[w]),{textSize:e,setTextSize:t,density:n,setDensity:s,theme:a,setTheme:u,characterEnabled:h,setCharacterEnabled:f,character:p,setCharacter:m,palette:w,minimapNodeFill:v}}function J0e(e){const t=g.useRef(null),[n,s]=g.useState(!1),[a,o]=g.useState(()=>new Set),i=g.useMemo(()=>{const u=new Set;for(const h of e.current.agents.values())for(const f of h.tools)u.add(x8(f.name));return Object.keys(w8).filter(h=>u.has(h))},[e.current,e.current.revision]);g.useEffect(()=>{if(i.length<=1){s(!1);return}let u=0;const h=()=>{const f=t.current;if(f&&!document.hidden){const p=f.getBoundingClientRect(),m=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(b=>b.getBoundingClientRect()),w=tQ(p,m,8);s(b=>b===w?b:w)}u=window.setTimeout(h,300)};return h(),()=>window.clearTimeout(u)},[i.length]);const l=g.useCallback(u=>{o(h=>{const f=new Set(h);return f.has(u)?f.delete(u):f.add(u),f})},[]);return{presentCats:i,hiddenCats:a,toggleCat:l,catBarRef:t,catBarOccluded:n}}function Q0e(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null;const s=new Set,a=()=>e.enabled()?(n==null?void 0:n.state)==="running"?"ready":"locked":"off",o=()=>{var m;return(m=e.onState)==null?void 0:m.call(e,a())};function i(){var m,w;if(!(!t||(n==null?void 0:n.state)==="running"))try{n||(n=new t,(m=n.addEventListener)==null||m.call(n,"statechange",o)),(w=n.resume)==null||w.call(n).then(o,()=>{}),o()}catch{}}function l(m,w,b=w.figure){if(!n||n.state!=="running")return!1;const k=W1(m,b),v=Kee(w.level,k),N=n.currentTime;for(const x of k.notes){const C=n.createOscillator(),S=n.createGain();C.type=k.type??"sine",C.frequency.value=x.hz;const _=N+x.at,$=_+x.ms/1e3;S.gain.setValueAtTime(vA,_),S.gain.exponentialRampToValueAtTime(v,_+Yee),S.gain.exponentialRampToValueAtTime(vA,$),C.connect(S).connect(n.destination),C.start(_),C.stop($+.02)}return!0}async function u(m,w){var v;if(!e.loadCustom)return"unavailable";let b;try{b=await e.loadCustom(m)}catch{return"unavailable"}if(!b)return"missing";if(b.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const N=new SpeechSynthesisUtterance(b.text),x=window.speechSynthesis.getVoices();N.voice=x.find(C=>C.voiceURI===b.voiceURI)??null,N.rate=b.rate,N.pitch=b.pitch,N.volume=Xee(w.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(N),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let k;try{k=await n.decodeAudioData(b.bytes.slice(0))}catch{return"broken"}try{const N=n.createBufferSource(),x=n.createGain();return N.buffer=k,x.gain.setValueAtTime(Zee(b.normalizationGain,w.level),n.currentTime),N.connect(x).connect(n.destination),s.add(N),(v=N.addEventListener)==null||v.call(N,"ended",()=>s.delete(N)),N.start(n.currentTime),"played"}catch{return"unavailable"}}function h(m,w=!1){var v,N;if(!w&&!e.enabled())return!1;const b=rte((v=e.prefs)==null?void 0:v.call(e),m),k=((N=e.customSelection)==null?void 0:N.call(e)[m])??null;return k&&e.loadCustom?(u(k,b).then(x=>{var C;x==="played"||x==="locked"||((x==="missing"||x==="broken")&&((C=e.onCustomFailure)==null||C.call(e,m,k)),l(m,{...b,figure:es},es))}),!0):!n||n.state!=="running"?!1:l(m,b)}function f(m,w=wi){return u(m,{level:pm(w),figure:es}),!0}function p(){try{typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel()}catch{}for(const m of s)try{m.stop()}catch{}s.clear()}return{unlock:i,play:h,previewCustom:f,silence:p,state:a,get context(){return n}}}function e1e({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:s,fallbackCustomRef:a}){g.useEffect(()=>{const o=Q0e({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>s.current,loadCustom:Wee,onCustomFailure:(h,f)=>a.current(h,f)});e.current=o;const i=["pointerdown","pointerup","keydown"],l=()=>{for(const h of i)window.removeEventListener(h,u,{capture:!0})},u=()=>{var h;o.unlock(),((h=o.context)==null?void 0:h.state)==="running"&&l()};for(const h of i)window.addEventListener(h,u,{capture:!0});return l},[])}function t1e(){const[e,t]=g.useState(G0e),[n,s]=g.useState(()=>tX(nt(_T))),[a,o]=g.useState(()=>eX(nt(ET))),[i,l]=g.useState(()=>nX(nt(l3),n,W0e)),[u,h]=g.useState(()=>new Set),[f,p]=g.useState(0);g.useEffect(()=>{st(mB,String(e))},[e]),g.useEffect(()=>{st(ET,a?"1":"0")},[a]),g.useEffect(()=>{st(_T,JSON.stringify(n))},[n]),g.useEffect(()=>{st(l3,i)},[i]);const m=g.useCallback((N,x=!1)=>{s(C=>{const S=C.find(_=>_.id===N.id);return S?!x||!N.radio||!S.radio||S.url===N.url&&JSON.stringify(S.radio)===JSON.stringify(N.radio)?C:C.map(_=>_.id===N.id?{..._,url:N.url,radio:N.radio}:_):[...C,N]}),h(C=>{if(!C.has(N.id))return C;const S=new Set(C);return S.delete(N.id),S})},[]),w=g.useCallback((N,x)=>{const C=x.trim();!C||C.length>iD||s(S=>S.map(_=>_.id===N?{..._,name:C}:_))},[]),b=g.useCallback(N=>{s(x=>x.filter(C=>C.id!==N)),l(x=>sX(x,N)),h(x=>{if(!x.has(N))return x;const C=new Set(x);return C.delete(N),C})},[]),k=g.useCallback((N,x=!1)=>{const C=TT(N),S=u.has(C);N===i&&!S&&!x||(S&&h(_=>{const $=new Set(_);return $.delete(C),$}),l(N),p(_=>_+1))},[i,u]),v=g.useCallback((N,x)=>{const C=TT(N);h(S=>{if(S.has(C)===x)return S;const $=new Set(S);return x?$.add(C):$.delete(C),$})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:a,setFmMuted:o,fmSource:i,customFmStations:n,unavailableFmStations:u,fmPlayRequest:f,addFmStation:m,renameFmStation:w,removeFmStation:b,pickFmSource:k,markFmStationAvailability:v}}function n1e(e){const[t,n]=g.useState(null),[s,a]=g.useState(!1),[o,i]=g.useState(null),l=g.useRef(0);g.useEffect(()=>{if(!e||!co())return;let b=!1;const k=l.current;return fetch("/api/desktop-update").then(v=>v.ok?v.json():null).then(v=>{if(b||l.current!==k)return;const N=TO(v);N&&n(N)}).catch(()=>{}),()=>{b=!0}},[e]);const u=owe(t),h=g.useRef(!1),f=g.useRef(0),p=g.useRef(0);g.useEffect(()=>()=>window.clearTimeout(f.current),[]);const m=g.useCallback(async b=>{if(!Cn(h.current))return;const k=++p.current;window.clearTimeout(f.current),h.current=!0,a(!0),i(null);const v=N=>{k===p.current&&(window.clearTimeout(f.current),h.current=!1,a(!1),i({failure:N,version:b}))};try{const N=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:b})});if(!N.ok)return v(lwe(await N.json().catch(()=>null)))}catch{return v("unreachable")}k===p.current&&(f.current=window.setTimeout(()=>v("timeout"),$8))},[]),w=g.useCallback(b=>{if(co())try{const k=TO(JSON.parse(b));k&&(l.current++,n(k),k.status!=="ready"&&(p.current++,window.clearTimeout(f.current),h.current=!1,a(!1)))}catch{}},[]);return{desktopUpdateRestarting:s,desktopUpdateFailure:o,readyAppUpdate:u,appUpdate:t,askDesktopUpdateRestart:m,onDesktopUpdateEvent:w}}const Cf="agent-dag.autoRestart",d3="agent-dag.bundleReloadedFor";function s1e({now:e,stateRef:t,version:n,notice:s,noticeOpen:a,upgradeFailure:o,paused:i}){const[l,u]=g.useState(()=>nt(Cf)!=="0"),h=g.useRef(!1),f=g.useCallback(()=>{const W=!l;h.current=!0,ks(Cf),u(W),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:W})}).then(B=>B.ok?B.json():null).then(B=>{var R;B!=null&&B.ok&&u(((R=B.prefs)==null?void 0:R.autoUpdate)!==!1)}).catch(()=>{})},[l]),[p,m]=g.useState(!1),[w,b]=g.useState("restart"),[k,v]=g.useState(null),N=g.useRef(!1),x=g.useRef(null),C=g.useRef(0),S=g.useRef(null),_=g.useCallback(async W=>{if(!Cn(N.current))return;const B=(W==null?void 0:W.upgrade)===!0,R=(W==null?void 0:W.whenIdle)===!0;N.current=!0,x.current=o;const q=++C.current,T=()=>{b(B?"npx":"restart"),m(!0)};R||T();try{window.sessionStorage.setItem("agent-dag.restartPending",(s==null?void 0:s.to)??"")}catch{}let F=!1;try{const D=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R?{upgrade:B,whenIdle:R}:{upgrade:B})});F=R&&D.status===409}catch{}if(F){N.current=!1,S.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}R&&T(),window.setTimeout(()=>{if(C.current===q&&N.current){N.current=!1,m(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},B?18e4:3e4)},[s==null?void 0:s.to,o]);g.useEffect(()=>{const W=RO(t.current.agents.values())>0,B=Gwe({enabled:l,kind:s==null?void 0:s.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:a,visible:document.visibilityState==="visible",busy:W,idleSince:S.current,now:e});S.current=B.idleSince,B.restart&&_({whenIdle:!0})},[l,s==null?void 0:s.kind,n==null?void 0:n.canRestart,a,e,_]);const $=RO(t.current.agents.values()),A=Vwe($,i),O=B8({enabled:l,kind:s==null?void 0:s.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:a,visible:document.visibilityState==="visible",busy:$>0,idleSince:S.current,now:e});g.useEffect(()=>{const W=n==null?void 0:n.running;let B=null,R=null;try{B=window.sessionStorage.getItem("agent-dag.restartPending"),R=window.sessionStorage.getItem(d3)}catch{return}const q=qwe({bundle:"3.48.0",running:W,pending:B,lastTried:R});if(q==="reload"){try{window.sessionStorage.setItem(d3,W??"")}catch{return}window.location.reload();return}if(q!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,m(!1),v(W??null);const T=window.setTimeout(()=>v(null),6e3);return()=>window.clearTimeout(T)},[n==null?void 0:n.running]),g.useEffect(()=>{if(p&&Wwe({asked:x.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,m(!1)}},[p,o]);const M=g.useCallback(W=>{var B,R;if(!h.current){const q=nt(Cf)==="0";ks(Cf),q&&((B=W.prefs)==null?void 0:B.autoUpdate)!==!1?(u(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):u(((R=W.prefs)==null?void 0:R.autoUpdate)!==!1)}},[]);return{autoRestart:l,toggleAutoRestart:f,restarting:p,restartMode:w,restartedTo:k,askRestart:_,restartCopy:A,restartFuseMs:O,loadAutoRestartPrefs:M}}function r1e(){const[e,t]=g.useState([]),n=g.useRef(new Set),[s,a]=g.useState(null),[o,i]=g.useState(void 0);g.useEffect(()=>{let h=!0,f=0;const p=()=>{fetch("/api/lan").then(m=>m.ok?m.json():null).then(m=>h?(m!=null&&m.ok&&t(oR(Array.isArray(m.pending)?m.pending:[],m.aliases)),m):null).catch(()=>null).then(m=>{h&&(i(w=>m!=null&&m.ok?m:w===void 0?null:w),f=window.setTimeout(p,(m==null?void 0:m.enabled)===!0?hj:x6))})};return p(),()=>{h=!1,window.clearTimeout(f)}},[]);const l=g.useCallback(async(h,f)=>{if(!s){a(h);try{const m=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:h,fp:f})})).json().catch(()=>null);m&&Array.isArray(m.pending)?t(oR(m.pending,m.aliases)):t(w=>w.filter(b=>b.fp!==f))}catch{}finally{a(null)}}},[s]),u=g.useCallback(h=>{s||(n.current.add(h),t(f=>[...f]))},[s]);return{lanPending:e,lanDeferred:n,lanBusy:s,answerLanPair:l,deferLanPair:u,lanStatus:o}}const a1e=6e4;function o1e({enabled:e,lanStatus:t,now:n}){const[s,a]=g.useState(null),[o,i]=g.useState(()=>new Set),[l,u]=g.useState(null),h=g.useCallback(N=>{N!=null&&N.ok&&Array.isArray(N.accounts)&&a(N.accounts)},[]),f=g.useCallback(async N=>{try{const x=await fetch(`/api/claude-accounts${N?"?refresh=1":""}`);x.ok&&h(await x.json())}catch{}},[h]);g.useEffect(()=>{e&&f(!1)},[e,f]),g.useEffect(()=>{if(!e)return;let N=Date.now();const x=()=>{document.visibilityState!=="visible"||Date.now()-N<a1e||(N=Date.now(),f(!1))};return document.addEventListener("visibilitychange",x),window.addEventListener("focus",x),()=>{document.removeEventListener("visibilitychange",x),window.removeEventListener("focus",x)}},[e,f]);const p=g.useMemo(()=>e?hve(s,{lan:t,now:n,closed:o}):[],[e,s,t,n,o]),m=g.useRef(p);m.current=p;const w=g.useCallback(N=>{N.length&&i(x=>new Set([...x,...N]))},[]),b=g.useCallback(()=>{const N=m.current;N.length&&(w(N.map(x=>x.id)),fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reauth-later",incidents:N.map(x=>({key:x.key,since:x.since}))})}).catch(()=>{}))},[w]),k=g.useRef(l);k.current=l;const v=g.useCallback(N=>{const x=k.current;w(fve(x?[x,...m.current]:m.current,N))},[w]);return{rows:p,signingIn:l,observe:h,signIn:u,signedIn:v,refresh:g.useCallback(()=>{f(!0)},[f]),closeSignIn:g.useCallback(()=>u(null),[]),later:b}}const yB=288,i1e=yB;function l1e(e,t,n){return e?"session-list":t||n?"accounts":null}function h3(e){return e==="session-list"?i1e:e==="accounts"?yB:0}const c1e=240,u1e=20;function d1e(e){const t=g.useRef(0),n=g.useRef(e);return g.useLayoutEffect(()=>{n.current!==e&&(n.current=e,t.current=md()?0:performance.now()+c1e+u1e)},[e]),t}const wB="agent-dag.sessionListOpen",xB="agent-dag.accountsPanelOpen";function h1e(){return nt(wB)==="1"}function f1e(e){st(wB,e?"1":"0")}function p1e(){const e=nt(xB);return e===null?!0:e==="1"}function m1e(){const e=g.useRef(!1),t=g.useRef(!1),[n,s]=g.useState(()=>{const b=h1e();return b&&B1()?(e.current=!0,!1):b});g.useEffect(()=>{if(n)e.current=!1;else if(e.current)return;f1e(n)},[n]);const a=g.useRef(!1),[o,i]=g.useState(()=>{const b=p1e();return b&&n?(a.current=!0,!1):b&&B1()?(t.current=!0,!1):b});g.useEffect(()=>{if(o)t.current=!1;else if(t.current)return;!o&&a.current||st(xB,o?"1":"0")},[o]),g.useEffect(()=>{!n&&a.current&&(a.current=!1,i(!0))},[n]);const l=g.useCallback(()=>{s(b=>(b||i(k=>(k&&(a.current=!0),!1)),!b))},[]),u=g.useCallback(()=>{a.current=!1,i(b=>(b||s(!1),!b))},[]),h=g.useCallback(()=>{a.current=!1,i(b=>(b||s(!1),!0))},[]),f=g.useCallback(()=>s(!1),[]),p=g.useCallback(()=>{a.current=!1,s(!1)},[]),m=g.useCallback(()=>i(!1),[]),w=l1e(n,o,a.current);return{sessionListOpen:n,accountsPanelOpen:o,panel:w,toggleSessionList:l,toggleAccountsPanel:u,openAccountsPanel:h,closeSessionList:f,closeSessionListToCanvas:p,closeAccountsPanel:m}}const vB="agent-dag.detailOpen",bB="agent-dag.usagePanelOpen",kB="agent-dag.systemPanelOpen";function g1e(){return nt(vB)==="1"}function y1e(e){st(vB,e?"1":"0")}function w1e(){const e=nt(bB);return e===null?!0:e==="1"}function x1e(e){st(bB,e?"1":"0")}function v1e(){const e=nt(kB);return e===null?!0:e==="1"}function b1e(e){st(kB,e?"1":"0")}function k1e(e=0){const[t,n]=g.useState(g1e);g.useEffect(()=>{y1e(t)},[t]);const[s,a]=g.useState(w1e);g.useEffect(()=>{x1e(s)},[s]);const o=g.useRef(!1),[i,l]=g.useState(()=>{const u=v1e();return u&&s&&(B1()||nee(e))?(o.current=!0,!1):u});return g.useEffect(()=>{if(i)o.current=!1;else if(o.current)return;b1e(i)},[i]),an("usage-panel",s),an("machine-panel",i),{detailOpen:t,setDetailOpen:n,usagePanelOpen:s,setUsagePanelOpen:a,machinePanelOpen:i,setMachinePanelOpen:l}}const j1e={permission:"your permission",asked:"your answer"},N1e="No sessions are waiting for you.";function S1e(e){if(e.length===0)return"";const[t,...n]=e,s=t.waiting.kind,a=n.every(i=>i.waiting.kind===s)?j1e[s]??"you":"you";if(n.length===0)return`${t.label} is waiting for ${a}.`;const o=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${o} are waiting for ${a}.`}function n1(e,t,n=N1e){return t!==""?t:e===""?"":n}function C1e({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[s,a]=g.useState(""),o=S1e(e);g.useEffect(()=>{a(m=>n1(m,o))},[o]);const[i,l]=g.useState(""),u=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";g.useEffect(()=>{l(m=>n1(m,u,"Browser watch has no unread findings."))},[u]);const[h,f]=g.useState(""),p=P0e(n);return g.useEffect(()=>{f(m=>n1(m,p,D0e))},[p]),{blockedSaid:s,watchSaid:i,setWatchSaid:l,incidentSaid:h}}const _1e="/icon-192.png",jB=Object.freeze({notifySwap:!0,notifyQuota:!1,notifyReset:!1,notifyStopped:!0,notifyElsewhere:!0});function f3(e){const t=n=>typeof(e==null?void 0:e[n])=="boolean"?e[n]:jB[n];return{notifySwap:t("notifySwap"),notifyQuota:t("notifyQuota"),notifyReset:t("notifyReset"),notifyStopped:t("notifyStopped"),notifyElsewhere:t("notifyElsewhere")}}function E1e({waitingSessions:e,liveSince:t,focusSession:n}){const[s,a]=g.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[o,i]=g.useState(null),[l,u]=g.useState(!1),[h,f]=g.useState(!1),[p,m]=g.useState(jB),w=g.useCallback(O=>{const M=!p[O];m(W=>({...W,[O]:M})),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[O]:M})}).then(W=>W.ok?W.json():null).then(W=>{W!=null&&W.ok&&m(f3(W.prefs))}).catch(()=>{})},[p]),b=g.useRef(()=>{}),k=g.useRef(new Set),v=Fn(e),N=g.useCallback(()=>{const O=!l;u(O),O&&(k.current=ef(v.current)),O&&typeof Notification<"u"&&Notification.permission==="default"&&b.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:O})}).then(M=>M.ok?M.json():null).then(M=>{var W;M!=null&&M.ok&&(u(((W=M.prefs)==null?void 0:W.notifications)===!0),f(M.notificationsVetoed===!0))}).catch(()=>{})},[l]),x=typeof Notification<"u";g.useEffect(()=>{if(!o)return;const M=setTimeout(()=>i(null),o==="blocked"?8e3:4e3);return()=>clearTimeout(M)},[o]);const C=g.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(O=>{const M=O;a(M),M==="granted"?i("on"):M==="denied"&&i("blocked")})},[]);b.current=C;const S=g.useRef(null),_=e.map(O=>Qp(O.id,O.waiting)).join("|");g.useEffect(()=>{_G(S.current,s)&&(S.current=s,k.current=ef(e))},[s]);const $=g.useRef(!1);g.useEffect(()=>{EG($.current,t)&&($.current=!0,k.current=ef(e))},[t]),g.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!TG(S.current,t))return;const O=typeof document>"u"||!document.hidden,M=SG(e,k.current,O,l);for(const W of M)try{const B=new Notification(W.title,{body:W.body,tag:W.key,icon:_1e});B.onclick=()=>{window.focus(),n(W.sessionId),B.close()}}catch{}k.current=O?ef(e):CG(e,M,k.current)},[_,t]);const A=g.useCallback(O=>{var M;u(((M=O.prefs)==null?void 0:M.notifications)===!0),f(O.notificationsVetoed===!0),m(f3(O.prefs))},[]);return{notifyPermission:s,notifySaid:o,notifyOn:l,notifyVetoed:h,toggleNotify:N,notifySupported:x,askForNotifications:C,loadNotifyPrefs:A,accountNotify:p,toggleAccountNotify:w}}function T1e({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:s,summaryFor:a,browserWatchOpen:o,keyHelpOpen:i,releaseNotes:l,feedbackOpen:u,trafficRadarOpen:h=!1}){const f=Fn(i),p=g.useRef(!1);return p.current=e!=null||t||n!=null||s||a!=null||o||i||l!=null||u||h,{keyHelpOpenRef:f,modalOpenRef:p}}function A1e({stateRef:e,tourOpen:t,releaseNotes:n}){const[s,a]=g.useState(null),o=g.useCallback((R,q)=>a({agentId:R,toolId:q}),[]),[i,l]=g.useState(null),[u,h]=g.useState(null),f=g.useCallback(R=>h(R),[]),[p,m]=g.useState(!1),[w,b]=g.useState(!1),[k,v]=g.useState(!1),[N,x]=g.useState(!1),[C,S]=g.useState(!1),[_,$]=g.useState(null),A=g.useCallback(R=>{$(R??null),S(!0)},[]);an("tool-detail",s!==null),an("session-summary",i!==null),an("context-window",u!==null),an("keyboard-help",p),an("usage-history",w),an("browser-watch",k),an("feedback",C);const O=s?yV(e.current.agents,s.agentId,s.toolId):null,M=u?e.current.agents.get(u):void 0,{keyHelpOpenRef:W,modalOpenRef:B}=T1e({openedTool:O,usageHistoryOpen:w,contextFor:u,tourOpen:t,summaryFor:i,browserWatchOpen:k,keyHelpOpen:p,releaseNotes:n,feedbackOpen:C,trafficRadarOpen:N});return{setOpenedToolKey:a,openTool:o,openedTool:O,summaryFor:i,setSummaryFor:l,contextFor:u,setContextFor:h,openContext:f,contextAgent:M,keyHelpOpen:p,setKeyHelpOpen:m,usageHistoryOpen:w,setUsageHistoryOpen:b,browserWatchOpen:k,setBrowserWatchOpen:v,trafficRadarOpen:N,setTrafficRadarOpen:x,feedbackOpen:C,setFeedbackOpen:S,feedbackPrefill:_,setFeedbackPrefill:$,openFeedback:A,keyHelpOpenRef:W,modalOpenRef:B}}function R1e({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:s,lastLayoutSigRef:a,forgetRemovals:o,clearSelection:i,rerender:l,modalOpenRef:u}){const[h,f]=g.useState(!1),p=g.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=rN(),t.current.clear(),n.current.clear(),s.current.clear(),a.current="",i8(),o(),i(),l()},[l,i,o]),m=Fn(h),w=g.useCallback(b=>{const k=Xwe(b,{confirmOpen:m.current,modalOpen:u.current});k==="confirm"?f(!0):k==="clear"&&(f(!1),p())},[p]);return{clearConfirmOpen:h,setClearConfirmOpen:f,requestClear:w}}const p3="agent-dag.oldNameNoticeDismissed";function M1e(e){const[t,n]=g.useState(()=>nt(p3)??""),s=e!=null&&e.invokedAs&&e.invokedAs!==Pt?e.invokedAs:null,a=s!=null&&t!==s,o=g.useCallback(()=>{s&&(n(s),st(p3,s))},[s]);return{oldName:s,oldNameOpen:a,dismissOldName:o}}const $1e=300*1e3,L1e=1800*1e3,I1e=8e3,O1e=3e4;function m3(e){return fetch("/api/rating",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}).catch(()=>null)}function P1e({modalOpenRef:e}){const t=g.useCallback(()=>wl({appModal:e.current,dialogDepth:rn.dialogDepth()}),[e]),[n,s]=g.useState("hidden"),[a,o]=g.useState(null),[i,l]=g.useState(!1),u=g.useRef(n);u.current=n,g.useEffect(()=>{let w=!1;const b=async()=>{if(u.current==="thanks"||u.current==="hidden"&&(document.hidden||t()))return;const N=await fetch("/api/rating").then(x=>x.ok?x.json():null).catch(()=>null);w||!N||s(x=>x==="thanks"?x:N.ask===!0?"asking":"hidden")},k=window.setTimeout(b,$1e),v=window.setInterval(b,L1e);return()=>{w=!0,window.clearTimeout(k),window.clearInterval(v)}},[t]),g.useEffect(()=>{if(n!=="thanks"||i)return;const w=a!==null&&a<=6?O1e:I1e;let b=0;const k=()=>{t()?b=window.setTimeout(k,w):s("hidden")};return b=window.setTimeout(k,w),()=>window.clearTimeout(b)},[n,a,i,t]);const h=g.useCallback(w=>{o(w),l(!1),s("thanks"),m3({score:w})},[]),f=g.useCallback(w=>l(w),[]),p=g.useCallback(()=>{s("hidden"),m3({later:!0})},[]),m=g.useCallback(()=>s("hidden"),[]);return{ratingPhase:n,ratingScore:a,answerRating:h,rateLater:p,closeRating:m,holdThanks:f}}function D1e({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:s}){const[a,o]=g.useState(()=>Ree(nt)),i=Fn(a),[l,u]=g.useState([]),h=g.useCallback(x=>{o(C=>{const S={...C,[x]:null};return i.current=S,S}),ks(Ru[x])},[]),f=g.useCallback((x,C)=>{const S=i.current[x];C&&S!==C||(h(x),t(_=>{const $={..._,[x]:{..._[x],figure:es}};return n.current=$,$}),st(gp[x],es))},[h]),p=Fn(f);g.useEffect(()=>{let x=!0;return Uee().then(C=>{if(!x)return;u(C);const S=new Set(C.map(_=>_.id));for(const _ of Mu){const $=i.current[_];$&&!S.has($)&&p.current(_,$)}},()=>{}),()=>{x=!1}},[]);const m=g.useCallback((x,C)=>{if(!l.some(_=>_.id===C))return;const S={...i.current,[x]:C};i.current=S,o(S),st(Ru[x],C),s(x,!0)},[l,s]),w=g.useCallback(async x=>{var $;const C=U1(l.length);if(C)throw new Error(C);const S=window.AudioContext??window.webkitAudioContext;if(!S)throw new Error("This browser cannot decode audio files.");const _=new S;try{const A=await Pee(x,M=>_.decodeAudioData(M));await wA(A);const O=td(A);u(M=>[...M.filter(W=>W.id!==O.id),O])}finally{($=_.close)==null||$.call(_)}},[l.length]),b=g.useCallback(async x=>{const C=U1(l.length);if(C)throw new Error(C);const S=Dee(x);await wA(S);const _=td(S);u($=>[...$.filter(A=>A.id!==_.id),_])},[l.length]),k=g.useCallback(async(x,C)=>{const S=l.find($=>$.id===x),_=C.trim().slice(0,80);!S||!_||_===S.name||(await Hee(x,_),u($=>$.map(A=>A.id===x?{...A,name:_}:A)))},[l]),v=g.useCallback(async x=>{await zee(x),u($=>$.filter(A=>A.id!==x));const C=i.current,S=Mee(C,x);i.current=S,o(S);const _=Mu.filter($=>C[$]===x);for(const $ of _)ks(Ru[$]),st(gp[$],es);_.length>0&&t($=>{const A={...$};for(const O of _)A[O]={...A[O],figure:es};return n.current=A,A})},[]),N=g.useCallback(x=>{var _,$;const C=Mu.find(A=>i.current[A]===x),S=C?n.current[C].level:wi;(_=e.current)==null||_.unlock(),($=e.current)==null||$.previewCustom(x,S)},[]);return{customSelections:a,customSelectionsRef:i,customAssets:l,clearCustomOnly:h,fallbackCustomRef:p,selectCustomTone:m,importNotificationAudio:w,createNotificationVoice:b,renameCustomAsset:k,deleteCustomAsset:v,previewCustomAsset:N}}function F1e(e){const[t,n]=g.useState(()=>ste(nt)),s=Fn(t),a=g.useRef(null),o=g.useCallback((l,u=!1)=>{var h,f;if((h=e.current)==null||h.unlock(),a.current!==null&&clearTimeout(a.current),a.current=null,!u){(f=e.current)==null||f.play(l,!0);return}a.current=setTimeout(()=>{var p;a.current=null,(p=e.current)==null||p.play(l,!0)},Jee)},[]),i=g.useCallback((l,u)=>{n(h=>{const f={level:pm(u.level??h[l].level),figure:XD(l,u.figure??h[l].figure)};return st(QD[l],String(f.level)),st(gp[l],f.figure),{...h,[l]:f}}),o(l,!0)},[o]);return g.useEffect(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:s,previewTone:o,changeTone:i}}const B1e=15e3;function q1e(e){return e.visibilityState==="visible"&&e.hasFocus()}function U1e(e,t){return t||e===!0}function W1e(){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 H1e(){g.useEffect(()=>{const e=W1e();let t=null;const n=i=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:e,looking:i}),keepalive:!0}).catch(()=>{})},s=()=>{const i=q1e(document);U1e(t,i)&&n(i),t=i},a=()=>{t&&n(!1),t=!1};s();const o=window.setInterval(s,B1e);return window.addEventListener("focus",s),window.addEventListener("blur",s),document.addEventListener("visibilitychange",s),window.addEventListener("pagehide",a),()=>{window.clearInterval(o),window.removeEventListener("focus",s),window.removeEventListener("blur",s),document.removeEventListener("visibilitychange",s),window.removeEventListener("pagehide",a),a()}},[])}function z1e({loadAutoRestartPrefs:e,loadNotifyPrefs:t,loadReportsPrefs:n}){g.useEffect(()=>{let s=!0;return fetch("/api/prefs").then(a=>a.ok?a.json():null).then(a=>{!s||!(a!=null&&a.ok)||(e(a),t(a),n(a))}).catch(()=>{}),()=>{s=!1}},[])}const s1="agent-dag.versionNoticeDismissed",V1e=15*6e4;function G1e(e){const[t,n]=g.useState(null),[s,a]=g.useState(()=>nt(s1)??""),o=g.useRef(0),[i,l]=g.useState(!1),u=g.useCallback((k=!1)=>(k&&(o.current=Date.now(),l(!0)),fetch(k?"/api/version?refresh=1":"/api/version").then(v=>v.ok?v.json():null).then(v=>(v&&n(v),v??null)).catch(()=>null).finally(()=>{k&&l(!1)})),[]),h=g.useCallback(()=>{u(Date.now()-o.current>=V1e)},[u]);g.useEffect(()=>{u();const k=window.setInterval(h,5*6e4),v=()=>{document.visibilityState==="visible"&&h()};return document.addEventListener("visibilitychange",v),()=>{window.clearInterval(k),document.removeEventListener("visibilitychange",v)}},[u,h]),g.useEffect(()=>{e&&u()},[e,u]);const f=(t==null?void 0:t.notice)??null,p=P8(f),m=fwe(f,s),w=g.useCallback(()=>{a(""),st(s1,"")},[]),b=g.useCallback(()=>{f&&(a(p),st(s1,p))},[f,p]);return{version:t,notice:f,noticeOpen:m,showNotice:w,dismissNotice:b,versionChecking:i,loadVersion:u}}function K1e({version:e,readyAppUpdate:t}){const[n,s]=g.useState(!1),a=g.useRef(null),[o,i]=g.useState(null),l=o&&t?t.version:null,u=g.useRef(null);g.useEffect(()=>{!l||u.current===l||(u.current=l,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:l})}).catch(()=>{}))},[l]);const h=g.useRef(!1);g.useEffect(()=>{if(h.current)return;const v=wr(),N=Lve(v),x=Bve({stored:N,running:(e==null?void 0:e.running)??null,notes:FO,remembers:Ive(v)});if(x.reason==="no-version")return;h.current=!0,x.record&&Ove(v,x.record);let C=!0;return(async()=>{var O;let _=Pve(v);if(co())try{const M=await fetch("/api/prefs");if(!M.ok)throw new Error("desktop tour preferences unavailable");const W=await M.json();if(!(W!=null&&W.ok))throw new Error("desktop tour preferences unavailable");const B=((O=W.prefs)==null?void 0:O.tourSeen)===!0;_&&!B&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),_=_||B}catch{_=!0}if(!C)return;const $=Fve({tourSeen:_,decision:x}),A=x.show.length?{entries:x.show,since:N,firstRun:!1}:null;$.tour&&s(!0),$.notes==="now"?i(A):$.notes==="after"&&(a.current=A)})(),()=>{C=!1}},[e==null?void 0:e.running]);const f=(e==null?void 0:e.running)??"3.48.0",p=g.useMemo(()=>Q8(FO,null,f),[f]),m=g.useCallback(()=>{i({entries:p,since:null,firstRun:!1})},[p]),w=g.useCallback(()=>s(!0),[]),b=g.useCallback(()=>i(null),[]),k=g.useCallback(()=>{s(!1),Dve(wr()),co()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const v=a.current;a.current=null,v&&i(v)},[]);return{tourOpen:n,openTour:w,closeTour:k,releaseNotes:o,closeReleaseNotes:b,chipVersion:f,openReleaseNotes:m}}function Y1e(){const[e,t]=g.useState(void 0),[n,s]=g.useState(!1),a=g.useRef(!1);return a.current=e===!0&&!n,g.useEffect(()=>f0e(()=>a.current),[]),{loadReportsPrefs:g.useCallback(i=>{var l;t(((l=i.prefs)==null?void 0:l.reports)!==!1),s(i.reportsVetoed===!0)},[])}}function X1e(e){const[t,n]=g.useState(null);g.useEffect(()=>{const l=nt("agent-dag.sound");n(l===null?!0:l==="on")},[]);const s=g.useCallback(()=>{n(l=>{var h,f;const u=l!==!0;return st("agent-dag.sound",u?"on":"off"),u?(h=e.current)==null||h.unlock():(f=e.current)==null||f.silence(),u})},[]),a=g.useCallback(l=>{s()},[s]),o=Fn(a),i=Fn(t);return{soundOn:t,toggleSound:s,activateSoundRef:o,soundOnRef:i}}function Z1e(){const[e,t]=g.useState(fee),n=g.useCallback((o,i)=>{t(l=>pee(l,o,i))},[]),s=g.useCallback(()=>t(o=>({...o,open:!1})),[]),a=g.useCallback(o=>t(i=>({...i,section:o})),[]);return{settingsOpen:e.open,settingsSection:e.section,settingsLandOn:e.landOn,openSettings:n,closeSettings:s,showSection:a}}const J1e="agent-dag.autoFitDisabled";function Q1e(e){const t=g.useRef(!1),[n,s]=g.useState(!1);g.useEffect(()=>{ks(J1e)},[]);const a=g.useCallback(()=>{t.current||(t.current=!0,s(!0))},[]),o=g.useCallback(()=>{t.current=!1,s(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:a,enableAutoFitAndRefit:o}}function eje(){return r.jsx(sN,{children:r.jsx(g0e,{children:r.jsx(tje,{})})})}function tje(){var Mc;const e=ec(),t=g.useState(rN)[0],n=g.useRef(t),[,s]=g.useState(0),a=g.useCallback(()=>s(ut=>ut+1),[]),{sessionListOpen:o,accountsPanelOpen:i,panel:l,toggleSessionList:u,toggleAccountsPanel:h,openAccountsPanel:f,closeSessionList:p,closeSessionListToCanvas:m,closeAccountsPanel:w}=m1e(),{detailOpen:b,setDetailOpen:k,usagePanelOpen:v,setUsagePanelOpen:N,machinePanelOpen:x,setMachinePanelOpen:C}=k1e(h3(l)),{selectedIds:S,primarySelectedId:_,selectAgent:$,clearSelection:A,pruneSelectionToBoard:O}=Nde(n,k),M=Nl(i,200),W=Nl(o,200),B=zE(o,W),R=Nl(v,130),q=Nl(x,130),T=g.useRef(null),F=X1e(T),{activateSoundRef:D,soundOnRef:K}=F,V=F1e(T),{setTonePrefs:H,tonePrefsRef:P,previewTone:I}=V,U=D1e({chimesRef:T,setTonePrefs:H,tonePrefsRef:P,previewTone:I}),{customSelectionsRef:Z,fallbackCustomRef:z}=U,X=Z1e(),{openSettings:Y}=X;e1e({chimesRef:T,soundOnRef:K,tonePrefsRef:P,customSelectionsRef:Z,fallbackCustomRef:z});const J=x0e(n),{pauseGate:Q,paused:te,togglePause:le}=J,de=g.useRef(()=>{}),{live:oe,tabCapped:re,everConnected:he,liveSince:pe}=pde({stateRef:n,rerender:a,pauseGate:Q,chimesRef:T,desktopUpdateRef:de}),Le=G1e(oe),{version:ge,notice:ve,noticeOpen:je,loadVersion:Ee}=Le,xe=n1e(oe),{readyAppUpdate:Ie,onDesktopUpdateEvent:De}=xe;de.current=De,H1e();const We=K1e({version:ge,readyAppUpdate:Ie}),{tourOpen:Ke,openTour:ye,releaseNotes:Fe}=We,{workspace:$e,providers:Re,providersRef:rt}=b0e(oe),He=h3(l==="accounts"&&!Re.claude?null:l),se=d1e(He),ke=zE(i,M)&&Re.claude,[Ae,Oe]=g.useState(!1),be=g.useCallback(()=>{f(),Oe(!0)},[f]);g.useEffect(()=>{i||Oe(!1)},[i]);const fe=g.useCallback(()=>Oe(!1),[]),_e=M1e(ge),Ve=F0e({version:ge,loadVersion:Ee}),{upgradeFailure:ot}=Ve,tt=A1e({stateRef:n,tourOpen:Ke,releaseNotes:Fe}),wt=P1e({modalOpenRef:tt.modalOpenRef}),{openTool:$t,setSummaryFor:Gt,setContextFor:nr,openContext:_s,setKeyHelpOpen:Hn,setUsageHistoryOpen:ns,setBrowserWatchOpen:Es,keyHelpOpenRef:wn,modalOpenRef:zn}=tt,Me=Y1e(),qe=q0e(),{watchOn:Je,watchUnseen:_t}=qe,Nt=$d(),[ss,Vn]=g.useState(null),[xn,Tr]=g.useState(!1),vn=g.useCallback(()=>Tr(!1),[]),on=ut=>{Gye(ut),Y("integrations")},Ts=ut=>{ut&&EO(ut),Y("integrations")},sr=g.useCallback(()=>Vn(null),[]),rs=qS().filter(ut=>Cj(Nt,ut.kind)),As=Fn(ut=>{const Ur=rs.find(ug=>ug.kind===ut);Ur&&Vn(Ur.kind)}),Ar=g.useCallback(ut=>{EO(ut),Y("integrations")},[Y]),Rr=rs.length>0;g.useEffect(()=>{Rr&&Iye()},[Rr]);const Rs=r1e(),[ya,xt]=g.useState(0),{presentCats:wa,hiddenCats:Ms,toggleCat:xa,catBarRef:rr,catBarOccluded:ar}=J0e(n),Mr=g.useRef(null),[$s,hn]=g.useState(0),Lt=Sde({stateRef:n,rerender:a,pruneSelectionToBoard:O,setContextFor:nr,setSummaryFor:Gt});bY({stateRef:n,now:Lt,enabled:Re.claude});const fn=S0e(Re.claude||Re.codex),va=O0e(fn,Lt),go=o1e({enabled:Re.claude,lanStatus:Rs.lanStatus,now:Lt}),ba=s1e({now:Lt,stateRef:n,version:ge,notice:ve,noticeOpen:je,upgradeFailure:ot,paused:J.paused}),{askRestart:ka,loadAutoRestartPrefs:$r}=ba,Gn=Z0e(),{setTheme:we,palette:et}=Gn,pt=t1e(),Et=kme(),{applyViewport:or,moveCamera:Lr,fitLeft:as,cameraEpochRef:fc,lastFitTimeRef:Ir}=Et,at=Ome(Et),{pinnedRef:yo,positionsRef:wo,lastLayoutSigRef:pc,handleRelayout:mc,rearrangeUndo:Id}=at,gc=g.useRef(null),_i=g.useRef(()=>{}),xo=pe!==null,Ls=g.useRef(0),Is=g.useCallback(()=>{Ls.current=Date.now()},[]),{canvasRef:ln,canvasSize:vo,paneSizeRef:bo}=Nge(se),Os=Q1e(as),{autoFitDisabledRef:Od,disableAutoFit:Ei}=Os,Or=g.useRef(!1),{measuredRef:Pr,measuredVersionRef:Pd,sizeVersion:Ti,domSizeVersion:Dd}=Sge(Or),{removedNodes:yc,removedAgentIds:os,removeNode:ko,removeSelectedNode:Dr,removalNotice:jo,hideSessions:Km,bringBack:wc,bringBackAll:xc,forgetRemovals:Ai}=sge({stateRef:n,pinnedRef:yo,positionsRef:wo,canvasRef:ln,clearSelection:A,primarySelectedId:_});fge({stateRef:n,removedNodes:yc,hideSessions:Km,ready:xo,keepSessionId:_?((Mc=n.current.agents.get(_))==null?void 0:Mc.sessionId)??_:null});const No=Jme({stateRef:n,now:Lt,removedAgentIds:os,sizeVersion:Ti,domSizeVersion:Dd});Pme(No,at),nge({layoutSig:No,rf:e,stateRef:n,measuredRef:Pr,pinnedRef:yo,positionsRef:wo,paneSizeRef:bo,lastInteractRef:Ls,autoFitDisabledRef:Od,lastFitTimeRef:Ir,fitLeft:as});const vc=Cge(),{bubbling:ir,endBubble:bc,onBubble:Ri}=Que(),[Mi,$i]=g.useState(!1),So=Zue(),{beginTrashDrag:Fd,trackTrashDrag:bn,endTrashDrag:ja}=So,Li=ode({stateRef:n,measuredRef:Pr,measuredVersionRef:Pd,canvasRef:ln}),{lodRef:Co,applyZoom:Ym}=Li,Ii=bge({applyViewport:or,lastFitTimeRef:Ir,cameraEpochRef:fc,disableAutoFit:Ei,markInteract:Is,canvasRef:ln,applyZoom:Ym}),Fr=_?n.current.agents.get(_):null,Br=b&&Fr!=null,Ps=Age({sessionListShown:B,usageShown:Ja(R),machineShown:Ja(q),accountsShown:ke,detailShown:Br,primarySelectedId:_,canvasRef:ln}),{railInsetRef:_o,availableWidth:Bd,availableHeight:qd}=yme({canvasRef:ln,canvasSize:vo,machinePhase:q,usagePhase:R,usagePanelOpen:v,detailShown:Br}),Ud=Qme({stateRef:n,now:Lt,availableWidth:Bd,availableHeight:qd,layout:at,measuredRef:Pr,onBubble:Ri,settled:vc,dragging:Mi,layoutSig:No,selectedIds:S,openContext:_s,historyReplayed:xo,removedNodes:yc,removedAgentIds:os,dragTick:ya,dragPatchRef:Mr,dragMoveTick:$s}),{nodes:Eo,edges:Xm}=Ud,kc=Fn(_);Dme({nodes:Eo,edges:Xm,settled:vc,dragging:Mi,availableWidth:Bd,availableHeight:qd,layout:at,camera:Et,rf:e,measuredRef:Pr,stateRef:n,lastFocusRef:gc,primarySelectedIdRef:kc,focusAgentRef:_i,autoFitDisabledRef:Od});const Wd=R1e({stateRef:n,pinnedRef:yo,measuredRef:Pr,positionsRef:wo,lastLayoutSigRef:pc,forgetRemovals:Ai,clearSelection:A,rerender:a,modalOpenRef:zn}),{requestClear:jc}=Wd,Zm=Rge({nodes:Eo,stateRef:n,pinnedRef:yo,positionsRef:wo,draggingRef:Or,dragPatchRef:Mr,setDragging:$i,setDragMoveTick:hn,setDragTick:xt,endBubble:bc,markInteract:Is,disableAutoFit:Ei,beginTrashDrag:Fd,trackTrashDrag:bn,endTrashDrag:ja,removeNode:ko}),Nc=g.useCallback(()=>as(500),[as]),Sc=Fn(Eo),{focusAgent:Oi,stepAgent:Jm,focusSession:Na}=Nme({canvasRef:ln,stateRef:n,measuredRef:Pr,nodesRef:Sc,railInsetRef:_o,moveCamera:Lr,disableAutoFit:Ei,lastFocusRef:gc,focusAgentRef:_i,selectAgent:$,primarySelectedIdRef:kc}),Cc=kge({clearSelection:A,selectAgent:$,detailOpen:b,setDetailOpen:k,detailShown:Br,focusAgent:Oi,draggingRef:Or,lodRef:Co}),Qm=Sme({nodesRef:Sc,stateRef:n,canvasRef:ln,railInsetRef:_o}),eg=Fn(Dr),_c=g.useRef(null),To=g.useCallback(ut=>{os.has(ut)&&wc([ut]),Na(ut)},[os,wc,Na]),tg=_ge(),[ng,Ec]=g.useState(!1),Hd=g.useCallback(()=>Ec(!0),[]),sg=g.useCallback(()=>Ec(!1),[]),rg=g.useCallback(ut=>{Ec(!1),ut.run()},[]),ag=An();Ege({pointerFocusRef:tg,nodesRef:Sc,stateRef:n,primarySelectedIdRef:kc,providersRef:rt,soundOnRef:K,keyHelpOpenRef:wn,modalOpenRef:zn,waitingCursorRef:_c,removeSelectedRef:eg,activateSoundRef:D,clearSelection:A,selectAgent:$,focusAgent:Oi,stepAgent:Jm,focusSession:Na,requestClear:jc,handleRelayout:mc,undoRearrange:Id.undo,handleFit:Nc,togglePause:le,toggleSessionList:u,toggleAccountsPanel:h,setDetailOpen:k,setUsageHistoryOpen:ns,setUsagePanelOpen:N,setMachinePanelOpen:C,setBrowserWatchOpen:Es,setKeyHelpOpen:Hn,setTheme:we,openSettings:Y,openIntegrationRef:As,openQuickOpen:Hd});const Ao=n.current.agents.size,is=g.useMemo(()=>N1(n.current.agents.values()),[n.current,n.current.revision]);rge({stateRef:n,waitingSessions:is,removedAgentIds:os,removedNodes:yc,bringBack:wc}),wge({stateRef:n,waitingSessions:is,live:oe});const zd=C1e({waitingSessions:is,watchUnseen:_t,incidents:va}),Pi=E1e({waitingSessions:is,liveSince:pe,focusSession:Na}),{loadNotifyPrefs:Vd}=Pi;z1e({loadAutoRestartPrefs:$r,loadNotifyPrefs:Vd,loadReportsPrefs:Me.loadReportsPrefs});const lr=ic(fm),[Gd,Tc]=g.useState(!1),[qr,Ac]=g.useState(null),og=g.useCallback(()=>Ac(null),[]),ig=g.useCallback(ut=>{const Ur=n.current.agents.get(ut);return Ur?Ur.label||Ur.cwdBasename||"session":null},[]),Kd=g.useCallback(ut=>{Ac(null),To(ut)},[To]),Yd=g.useCallback(()=>Tc(!1),[]),[Sa,Ca]=g.useState(null),lg=g.useCallback(()=>Ca(null),[]),qt=Xge({providers:Re,sessionListOpen:o,toggleSessionList:u,accountsPanelOpen:i,toggleAccountsPanel:h,usagePanelOpen:v,setUsagePanelOpen:N,machinePanelOpen:x,setMachinePanelOpen:C,setUsageHistoryOpen:ns,watchOn:Je,watchUnseen:_t,setBrowserWatchOpen:Es,setTrafficRadarOpen:tt.setTrafficRadarOpen,openSettings:Y,onFeedback:tt.openFeedback,setRadioOpen:Tc,openToolActivity:Ac,openCapacity:Ca,toggles:Ps.toggles,integrations:rs.map(ut=>({provider:ut,onPress:()=>Vn(ut.kind)})),openExploreIntegrations:()=>Tr(!0),openQuickOpen:Hd}),[cg,Xd]=g.useState(0),Di=g.useCallback(ut=>{To(ut),lr&&m()},[To,lr,m]),Rc=g.useCallback(()=>{o||u(),requestAnimationFrame(()=>{var ut;return(ut=document.querySelector("#session-list .sl-row"))==null?void 0:ut.focus()})},[o,u]);return r.jsxs("div",{className:"app",children:[r.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),r.jsxs("header",{className:"topbar",children:[r.jsx(HJ,{}),r.jsx(Nwe,{versionCheck:Le,welcome:We,desktopUpdate:xe,pause:J,announcements:zd,notify:Pi,waitingSessions:is,waitingCursorRef:_c,focusSession:Na,live:oe,now:Lt,incidents:va,queueNamed:lr?0:cg}),!lr&&r.jsx(bwe,{waitingSessions:is,waitingCursorRef:_c,focusSession:Na,now:Lt,onFit:Xd,onMore:Rc}),Fr&&r.jsx(Swe,{selected:Fr,now:Lt,selectedIds:S,focusAgent:Oi,clearSelection:A}),!lr&&r.jsx("div",{className:"actions",children:r.jsx(cee,{items:[qt.search,...qt.utilities]})})]}),lr?r.jsx(lee,{items:[...qt.left,...qt.right[0],qt.utilities[0]],more:[qt.search,...qt.capacity,...qt.right.slice(1).flat(),...qt.integrations,...qt.explore,qt.utilities[1]]}):r.jsx(uA,{side:"left",label:"Accounts and sessions",groups:[...qt.leftStripe,qt.integrations,qt.explore]}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:jo?`${jo.label} removed from the board.`:""}),r.jsx(Ywe,{restart:ba,versionCheck:Le,upgrade:Ve,oldNameNotice:_e,rating:wt,onFeedback:tt.openFeedback,everConnected:he,live:oe,paused:te}),(B||ke)&&r.jsxs(Hue,{width:He,children:[ke&&r.jsx(_ue,{leaving:VE(i,M),onReport:tt.openFeedback,onRoster:go.observe,onClose:()=>{Ps.accounts(),w()},lanWanted:Ae,onLanShown:fe}),B&&r.jsx(sQ,{leaving:VE(o,W),state:n.current,now:Lt,selectedIds:S,onSelect:Di,onClose:()=>{Ps.sessionList(),p()},removedIds:os,onBringBackAll:xc})]}),r.jsxs(Awe,{canvasRef:ln,bubbling:ir,dragging:Mi,trash:So,zoom:Li,viewport:Ii,stateRef:n,peek:Qm,children:[Ao===0&&(!oe&&re?r.jsx($ge,{reservedRight:_o.current}):r.jsx(Lge,{live:oe,everConnected:he,providers:Re,workspace:$e,onTour:ye,reservedRight:_o.current})),(wa.length>1||Ms.size>0)&&r.jsx(Cwe,{catBarRef:rr,catBarOccluded:ar,presentCats:wa,hiddenCats:Ms,toggleCat:xa}),r.jsx(WJ,{graph:Ud,layout:at,viewport:Ii,clicks:Cc,drag:Zm,appearance:Gn,fm:pt,radioOpen:Gd,onRadioClose:Yd,autoFit:Os,pause:J,stateRef:n,measuredRef:Pr,hiddenCats:Ms,now:Lt,openTool:$t,focusAgent:Oi,requestClear:jc,setKeyHelpOpen:Hn})]}),!lr&&r.jsx(uA,{side:"right",label:"Usage and activity",groups:qt.right}),qr&&r.jsx(Tne,{view:qr,onClose:og,sessionLabel:ig,onOpenSession:Kd}),Sa&&r.jsx(Wue,{view:Sa,onClose:lg}),ss&&r.jsx(Dye,{kind:ss,connections:ra(Nt,ss)?Lp(Nt,ss):[],onClose:sr,onReconnect:Ar}),xn&&r.jsx(Jye,{integrations:Nt,onClose:vn,onOpen:Vn,onConnect:on,onManage:Ts}),ng&&r.jsx(qQ,{onClose:sg,onRun:rg,items:Cte({rails:qt,sessions:RD(n.current),now:Lt,openSession:Di,settings:n5(Re.claude,WS(Nt),Ld(Nt)),openSettings:Y,singleKeys:ag,fit:Nc,rearrange:mc,paused:te,togglePause:le,clear:Ao>0?()=>jc("button"):void 0,keyHelp:()=>Hn(!0),tour:ye,theme:Gn.theme,setTheme:we})}),Ja(R)&&r.jsx(Qse,{state:n.current,now:Lt,providers:Re,incidents:va,liveSince:pe,leaving:R==="leaving",onClose:()=>{Ps.usage(),N(!1)}}),Ja(q)&&r.jsx(Ire,{usageOpen:v,leaving:q==="leaving",onClose:()=>{Ps.machine(),C(!1)}}),b&&Fr?r.jsx(Kge,{selected:Fr,now:Lt,openTool:$t,setSummaryFor:Gt,stateRef:n,removeSelectedNode:Dr,onClose:()=>{Ps.detail(),k(!1)}}):null,r.jsx(Xke,{dialogs:tt,welcome:We,desktopUpdate:xe,versionCheck:Le,restart:ba,upgrade:Ve,lanPairs:Rs,attention:go,clearFlow:Wd,watchBadge:qe,announcements:zd,appearance:Gn,providers:Re,stateRef:n,agentCount:Ao,menus:X,sound:F,tones:V,customTones:U,notify:Pi,panelDoors:{accounts:f,localNetwork:be}})]})}try{fK(window.localStorage)}catch{}const nje=Aq.createRoot(document.getElementById("root"));window.ccdeckWindow&&(document.documentElement.dataset.desktopChrome="true",document.documentElement.dataset.desktopPlatform=window.ccdeckWindow.platform);nje.render(r.jsx(eje,{}));export{wje as $,vd as A,dje as B,vt as C,_u as D,rd as E,Nje as F,T5 as G,pae as H,vr as I,ct as J,X1 as K,RA as L,Z1 as M,lje as N,Ct as O,no as P,na as Q,S5 as R,cje as S,np as T,uje as U,cd as V,Wn as W,Iee as X,yje as Y,vje as Z,Uve as _,ks as a,xje as a0,qve as a1,bje as a2,im as a3,me as a4,yi as a5,so as a6,MZ as a7,Sje as a8,EN as a9,Xl as aa,fX as ab,ije as ac,aje as ad,oje as ae,lm as af,KG as ag,Lbe as ah,U0e as ai,rje as aj,$Z as ak,g as b,mje as c,Bn as d,rp as e,T8 as f,Vo as g,ho as h,gje as i,r as j,uS as k,AP as l,rn as m,gt as n,yt as o,md as p,pje as q,nt as r,Cn as s,fje as t,ic as u,an as v,st as w,jje as x,kje as y,hje as z};
|
|
321
|
+
`)}}function O0e(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>I0e(n,t)).filter(n=>n!==null)}function P0e(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const D0e="The providers' status pages report no incident.";function F0e({version:e,loadVersion:t}){var h;const[n,s]=g.useState(!1),a=((h=e==null?void 0:e.upgrade)==null?void 0:h.state)??"idle",o=Uwe(e==null?void 0:e.upgrade),i=g.useRef(!1),l=g.useCallback(async()=>{if(Cn(i.current||a==="running")){i.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),i.current=!1}},[a,t]);g.useEffect(()=>{if(a!=="running")return;const f=window.setInterval(t,3e3);return()=>window.clearInterval(f)},[a,t]);const u=g.useCallback(async()=>{const f=e==null?void 0:e.command;!f||!await ho(f)||(s(!0),window.setTimeout(()=>s(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:a,upgradeFailure:o,startUpgrade:l,copyCommand:u,cmdCopied:n}}const i3="agent-dag.browserWatch.seenMs";function B0e(e,t){return e.filter(n=>n.startMs>t)}function q0e(){const[e,t]=g.useState(()=>Number(nt(i3))||0),[n,s]=g.useState([]),[a,o]=g.useState(!1);g.useEffect(()=>{let u=!0;const h=()=>{fetch("/api/browser-watch?live=0").then(p=>p.ok?p.json():null).then(p=>{var m;!u||!(p!=null&&p.ok)||(s(p.episodes??[]),o(((m=p.settings)==null?void 0:m.enabled)===!0))}).catch(()=>{})};h();const f=setInterval(h,5*6e4);return()=>{u=!1,clearInterval(f)}},[]);const i=g.useMemo(()=>B0e(n,e).length,[n,e]),l=g.useCallback(u=>{t(u),st(i3,String(u))},[]);return{watchOn:a,setWatchOn:o,watchUnseen:i,markWatchSeen:l}}const pB="agent-dag.character-enabled",mB="agent-dag.fm-volume",U0e=1,l3="agent-dag.fm-source",Sje=[{value:"claude-fm",label:"🎧 Claude FM"},{group:"📻 Lofi Girl",value:"lofi-relax",label:"📚 Relax / study"},{group:"📻 Lofi Girl",value:"lofi-game",label:"🎮 Chill / game"},{group:"📻 Lofi Girl",value:"lofi-vibe",label:"🌅 Vibe / chill"},{group:"📻 Lofi Girl",value:"lofi-sleep",label:"💤 Sleep / chill"},{group:"📻 Radio Mix",value:"radio-mix",label:"📡 Live radio mix"},{group:"📻 The Good Life Radio",value:"good-life-radio",label:"🌴 The Good Life Radio"}];function W0e(e){return e==="lofi-relax"||e==="lofi-game"||e==="lofi-vibe"||e==="lofi-sleep"||e==="radio-mix"||e==="best-of-nostalgia"||e==="good-life-radio"||e==="cafe-music-bgm"?e:"claude-fm"}function H0e(e){return e!=="0"}function z0e(){return H0e(nt(pB))}function V0e(e){return JD(e,U0e)}function G0e(){return V0e(nt(mB))}const gB=["--err","--inflight","--ok","--warn","--muted","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function c3(e){const t={};for(const n of gB)t[n]=e(n);return t}function K0e(e){return t=>e[t]??""}function Y0e(e,t){return gB.every(n=>e[n]===t[n])}function X0e(e,t){let n=null,s=0;function a(){s++,n==null||n.skipTransition(),n=null,delete e.documentElement.dataset.themeTransition}return{cancel:a,run(o){a();const i=s;let l=!1;const u=()=>{i!==s||l||(l=!0,o())};if(!e.startViewTransition||e.hidden||t()){u();return}e.documentElement.dataset.themeTransition="true";try{const h=e.startViewTransition(u);n=h,h.ready.catch(()=>{}),h.updateCallbackDone.catch(()=>{u()}),h.finished.then(()=>{n===h&&(n=null,delete e.documentElement.dataset.themeTransition)},()=>{n===h&&(u(),n=null,delete e.documentElement.dataset.themeTransition)})}catch{delete e.documentElement.dataset.themeTransition,u()}}}}function u3(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function Z0e(){const[e,t]=g.useState(Ute),[n,s]=g.useState(Wte),[a,o]=g.useState(cte),i=g.useRef(a),[l]=g.useState(()=>X0e(document,()=>{try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!0}})),u=g.useCallback(N=>{const x=typeof N=="function"?N(i.current):N;x!==i.current&&(i.current=x,l.run(()=>vt.flushSync(()=>o(x))))},[l]);g.useEffect(()=>()=>l.cancel(),[l]);const[h,f]=g.useState(z0e),[p,m]=g.useState(vee),[w,b]=g.useState(()=>c3(u3)),k=g.useMemo(()=>K0e(w),[w]),v=g.useCallback(N=>Kme(N,k),[k]);return g.useEffect(()=>{document.documentElement.dataset.textSize=e,st(V1,e)},[e]),g.useEffect(()=>{document.documentElement.dataset.density=n,st(G1,n)},[n]),g.useEffect(()=>{const N=x=>{x.storageArea===wr()&&((x.key===V1||x.key===null)&&t(HN(x.newValue)),(x.key===G1||x.key===null)&&s(u5(x.newValue)))};return window.addEventListener("storage",N),()=>window.removeEventListener("storage",N)},[]),g.useLayoutEffect(()=>{document.documentElement.dataset.theme=a,document.documentElement.dataset.colorScheme=oc[a].colorScheme,st(e5,a),b(N=>{const x=c3(u3);return Y0e(N,x)?N:x})},[a]),g.useEffect(()=>{st(pB,h?"1":"0")},[h]),g.useEffect(()=>{st(HD,p)},[p]),g.useEffect(()=>{const N=document.querySelector('meta[name="theme-color"]'),x=w["--panel"];N&&x&&N.setAttribute("content",x)},[w]),{textSize:e,setTextSize:t,density:n,setDensity:s,theme:a,setTheme:u,characterEnabled:h,setCharacterEnabled:f,character:p,setCharacter:m,palette:w,minimapNodeFill:v}}function J0e(e){const t=g.useRef(null),[n,s]=g.useState(!1),[a,o]=g.useState(()=>new Set),i=g.useMemo(()=>{const u=new Set;for(const h of e.current.agents.values())for(const f of h.tools)u.add(x8(f.name));return Object.keys(w8).filter(h=>u.has(h))},[e.current,e.current.revision]);g.useEffect(()=>{if(i.length<=1){s(!1);return}let u=0;const h=()=>{const f=t.current;if(f&&!document.hidden){const p=f.getBoundingClientRect(),m=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(b=>b.getBoundingClientRect()),w=tQ(p,m,8);s(b=>b===w?b:w)}u=window.setTimeout(h,300)};return h(),()=>window.clearTimeout(u)},[i.length]);const l=g.useCallback(u=>{o(h=>{const f=new Set(h);return f.has(u)?f.delete(u):f.add(u),f})},[]);return{presentCats:i,hiddenCats:a,toggleCat:l,catBarRef:t,catBarOccluded:n}}function Q0e(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null;const s=new Set,a=()=>e.enabled()?(n==null?void 0:n.state)==="running"?"ready":"locked":"off",o=()=>{var m;return(m=e.onState)==null?void 0:m.call(e,a())};function i(){var m,w;if(!(!t||(n==null?void 0:n.state)==="running"))try{n||(n=new t,(m=n.addEventListener)==null||m.call(n,"statechange",o)),(w=n.resume)==null||w.call(n).then(o,()=>{}),o()}catch{}}function l(m,w,b=w.figure){if(!n||n.state!=="running")return!1;const k=W1(m,b),v=Kee(w.level,k),N=n.currentTime;for(const x of k.notes){const C=n.createOscillator(),S=n.createGain();C.type=k.type??"sine",C.frequency.value=x.hz;const _=N+x.at,$=_+x.ms/1e3;S.gain.setValueAtTime(vA,_),S.gain.exponentialRampToValueAtTime(v,_+Yee),S.gain.exponentialRampToValueAtTime(vA,$),C.connect(S).connect(n.destination),C.start(_),C.stop($+.02)}return!0}async function u(m,w){var v;if(!e.loadCustom)return"unavailable";let b;try{b=await e.loadCustom(m)}catch{return"unavailable"}if(!b)return"missing";if(b.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const N=new SpeechSynthesisUtterance(b.text),x=window.speechSynthesis.getVoices();N.voice=x.find(C=>C.voiceURI===b.voiceURI)??null,N.rate=b.rate,N.pitch=b.pitch,N.volume=Xee(w.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(N),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let k;try{k=await n.decodeAudioData(b.bytes.slice(0))}catch{return"broken"}try{const N=n.createBufferSource(),x=n.createGain();return N.buffer=k,x.gain.setValueAtTime(Zee(b.normalizationGain,w.level),n.currentTime),N.connect(x).connect(n.destination),s.add(N),(v=N.addEventListener)==null||v.call(N,"ended",()=>s.delete(N)),N.start(n.currentTime),"played"}catch{return"unavailable"}}function h(m,w=!1){var v,N;if(!w&&!e.enabled())return!1;const b=rte((v=e.prefs)==null?void 0:v.call(e),m),k=((N=e.customSelection)==null?void 0:N.call(e)[m])??null;return k&&e.loadCustom?(u(k,b).then(x=>{var C;x==="played"||x==="locked"||((x==="missing"||x==="broken")&&((C=e.onCustomFailure)==null||C.call(e,m,k)),l(m,{...b,figure:es},es))}),!0):!n||n.state!=="running"?!1:l(m,b)}function f(m,w=wi){return u(m,{level:pm(w),figure:es}),!0}function p(){try{typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel()}catch{}for(const m of s)try{m.stop()}catch{}s.clear()}return{unlock:i,play:h,previewCustom:f,silence:p,state:a,get context(){return n}}}function e1e({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:s,fallbackCustomRef:a}){g.useEffect(()=>{const o=Q0e({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>s.current,loadCustom:Wee,onCustomFailure:(h,f)=>a.current(h,f)});e.current=o;const i=["pointerdown","pointerup","keydown"],l=()=>{for(const h of i)window.removeEventListener(h,u,{capture:!0})},u=()=>{var h;o.unlock(),((h=o.context)==null?void 0:h.state)==="running"&&l()};for(const h of i)window.addEventListener(h,u,{capture:!0});return l},[])}function t1e(){const[e,t]=g.useState(G0e),[n,s]=g.useState(()=>tX(nt(_T))),[a,o]=g.useState(()=>eX(nt(ET))),[i,l]=g.useState(()=>nX(nt(l3),n,W0e)),[u,h]=g.useState(()=>new Set),[f,p]=g.useState(0);g.useEffect(()=>{st(mB,String(e))},[e]),g.useEffect(()=>{st(ET,a?"1":"0")},[a]),g.useEffect(()=>{st(_T,JSON.stringify(n))},[n]),g.useEffect(()=>{st(l3,i)},[i]);const m=g.useCallback((N,x=!1)=>{s(C=>{const S=C.find(_=>_.id===N.id);return S?!x||!N.radio||!S.radio||S.url===N.url&&JSON.stringify(S.radio)===JSON.stringify(N.radio)?C:C.map(_=>_.id===N.id?{..._,url:N.url,radio:N.radio}:_):[...C,N]}),h(C=>{if(!C.has(N.id))return C;const S=new Set(C);return S.delete(N.id),S})},[]),w=g.useCallback((N,x)=>{const C=x.trim();!C||C.length>iD||s(S=>S.map(_=>_.id===N?{..._,name:C}:_))},[]),b=g.useCallback(N=>{s(x=>x.filter(C=>C.id!==N)),l(x=>sX(x,N)),h(x=>{if(!x.has(N))return x;const C=new Set(x);return C.delete(N),C})},[]),k=g.useCallback((N,x=!1)=>{const C=TT(N),S=u.has(C);N===i&&!S&&!x||(S&&h(_=>{const $=new Set(_);return $.delete(C),$}),l(N),p(_=>_+1))},[i,u]),v=g.useCallback((N,x)=>{const C=TT(N);h(S=>{if(S.has(C)===x)return S;const $=new Set(S);return x?$.add(C):$.delete(C),$})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:a,setFmMuted:o,fmSource:i,customFmStations:n,unavailableFmStations:u,fmPlayRequest:f,addFmStation:m,renameFmStation:w,removeFmStation:b,pickFmSource:k,markFmStationAvailability:v}}function n1e(e){const[t,n]=g.useState(null),[s,a]=g.useState(!1),[o,i]=g.useState(null),l=g.useRef(0);g.useEffect(()=>{if(!e||!co())return;let b=!1;const k=l.current;return fetch("/api/desktop-update").then(v=>v.ok?v.json():null).then(v=>{if(b||l.current!==k)return;const N=TO(v);N&&n(N)}).catch(()=>{}),()=>{b=!0}},[e]);const u=owe(t),h=g.useRef(!1),f=g.useRef(0),p=g.useRef(0);g.useEffect(()=>()=>window.clearTimeout(f.current),[]);const m=g.useCallback(async b=>{if(!Cn(h.current))return;const k=++p.current;window.clearTimeout(f.current),h.current=!0,a(!0),i(null);const v=N=>{k===p.current&&(window.clearTimeout(f.current),h.current=!1,a(!1),i({failure:N,version:b}))};try{const N=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:b})});if(!N.ok)return v(lwe(await N.json().catch(()=>null)))}catch{return v("unreachable")}k===p.current&&(f.current=window.setTimeout(()=>v("timeout"),$8))},[]),w=g.useCallback(b=>{if(co())try{const k=TO(JSON.parse(b));k&&(l.current++,n(k),k.status!=="ready"&&(p.current++,window.clearTimeout(f.current),h.current=!1,a(!1)))}catch{}},[]);return{desktopUpdateRestarting:s,desktopUpdateFailure:o,readyAppUpdate:u,appUpdate:t,askDesktopUpdateRestart:m,onDesktopUpdateEvent:w}}const Cf="agent-dag.autoRestart",d3="agent-dag.bundleReloadedFor";function s1e({now:e,stateRef:t,version:n,notice:s,noticeOpen:a,upgradeFailure:o,paused:i}){const[l,u]=g.useState(()=>nt(Cf)!=="0"),h=g.useRef(!1),f=g.useCallback(()=>{const W=!l;h.current=!0,ks(Cf),u(W),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:W})}).then(B=>B.ok?B.json():null).then(B=>{var R;B!=null&&B.ok&&u(((R=B.prefs)==null?void 0:R.autoUpdate)!==!1)}).catch(()=>{})},[l]),[p,m]=g.useState(!1),[w,b]=g.useState("restart"),[k,v]=g.useState(null),N=g.useRef(!1),x=g.useRef(null),C=g.useRef(0),S=g.useRef(null),_=g.useCallback(async W=>{if(!Cn(N.current))return;const B=(W==null?void 0:W.upgrade)===!0,R=(W==null?void 0:W.whenIdle)===!0;N.current=!0,x.current=o;const q=++C.current,T=()=>{b(B?"npx":"restart"),m(!0)};R||T();try{window.sessionStorage.setItem("agent-dag.restartPending",(s==null?void 0:s.to)??"")}catch{}let F=!1;try{const D=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R?{upgrade:B,whenIdle:R}:{upgrade:B})});F=R&&D.status===409}catch{}if(F){N.current=!1,S.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}R&&T(),window.setTimeout(()=>{if(C.current===q&&N.current){N.current=!1,m(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},B?18e4:3e4)},[s==null?void 0:s.to,o]);g.useEffect(()=>{const W=RO(t.current.agents.values())>0,B=Gwe({enabled:l,kind:s==null?void 0:s.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:a,visible:document.visibilityState==="visible",busy:W,idleSince:S.current,now:e});S.current=B.idleSince,B.restart&&_({whenIdle:!0})},[l,s==null?void 0:s.kind,n==null?void 0:n.canRestart,a,e,_]);const $=RO(t.current.agents.values()),A=Vwe($,i),O=B8({enabled:l,kind:s==null?void 0:s.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:a,visible:document.visibilityState==="visible",busy:$>0,idleSince:S.current,now:e});g.useEffect(()=>{const W=n==null?void 0:n.running;let B=null,R=null;try{B=window.sessionStorage.getItem("agent-dag.restartPending"),R=window.sessionStorage.getItem(d3)}catch{return}const q=qwe({bundle:"3.48.1",running:W,pending:B,lastTried:R});if(q==="reload"){try{window.sessionStorage.setItem(d3,W??"")}catch{return}window.location.reload();return}if(q!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,m(!1),v(W??null);const T=window.setTimeout(()=>v(null),6e3);return()=>window.clearTimeout(T)},[n==null?void 0:n.running]),g.useEffect(()=>{if(p&&Wwe({asked:x.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}N.current=!1,m(!1)}},[p,o]);const M=g.useCallback(W=>{var B,R;if(!h.current){const q=nt(Cf)==="0";ks(Cf),q&&((B=W.prefs)==null?void 0:B.autoUpdate)!==!1?(u(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):u(((R=W.prefs)==null?void 0:R.autoUpdate)!==!1)}},[]);return{autoRestart:l,toggleAutoRestart:f,restarting:p,restartMode:w,restartedTo:k,askRestart:_,restartCopy:A,restartFuseMs:O,loadAutoRestartPrefs:M}}function r1e(){const[e,t]=g.useState([]),n=g.useRef(new Set),[s,a]=g.useState(null),[o,i]=g.useState(void 0);g.useEffect(()=>{let h=!0,f=0;const p=()=>{fetch("/api/lan").then(m=>m.ok?m.json():null).then(m=>h?(m!=null&&m.ok&&t(oR(Array.isArray(m.pending)?m.pending:[],m.aliases)),m):null).catch(()=>null).then(m=>{h&&(i(w=>m!=null&&m.ok?m:w===void 0?null:w),f=window.setTimeout(p,(m==null?void 0:m.enabled)===!0?hj:x6))})};return p(),()=>{h=!1,window.clearTimeout(f)}},[]);const l=g.useCallback(async(h,f)=>{if(!s){a(h);try{const m=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:h,fp:f})})).json().catch(()=>null);m&&Array.isArray(m.pending)?t(oR(m.pending,m.aliases)):t(w=>w.filter(b=>b.fp!==f))}catch{}finally{a(null)}}},[s]),u=g.useCallback(h=>{s||(n.current.add(h),t(f=>[...f]))},[s]);return{lanPending:e,lanDeferred:n,lanBusy:s,answerLanPair:l,deferLanPair:u,lanStatus:o}}const a1e=6e4;function o1e({enabled:e,lanStatus:t,now:n}){const[s,a]=g.useState(null),[o,i]=g.useState(()=>new Set),[l,u]=g.useState(null),h=g.useCallback(N=>{N!=null&&N.ok&&Array.isArray(N.accounts)&&a(N.accounts)},[]),f=g.useCallback(async N=>{try{const x=await fetch(`/api/claude-accounts${N?"?refresh=1":""}`);x.ok&&h(await x.json())}catch{}},[h]);g.useEffect(()=>{e&&f(!1)},[e,f]),g.useEffect(()=>{if(!e)return;let N=Date.now();const x=()=>{document.visibilityState!=="visible"||Date.now()-N<a1e||(N=Date.now(),f(!1))};return document.addEventListener("visibilitychange",x),window.addEventListener("focus",x),()=>{document.removeEventListener("visibilitychange",x),window.removeEventListener("focus",x)}},[e,f]);const p=g.useMemo(()=>e?hve(s,{lan:t,now:n,closed:o}):[],[e,s,t,n,o]),m=g.useRef(p);m.current=p;const w=g.useCallback(N=>{N.length&&i(x=>new Set([...x,...N]))},[]),b=g.useCallback(()=>{const N=m.current;N.length&&(w(N.map(x=>x.id)),fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reauth-later",incidents:N.map(x=>({key:x.key,since:x.since}))})}).catch(()=>{}))},[w]),k=g.useRef(l);k.current=l;const v=g.useCallback(N=>{const x=k.current;w(fve(x?[x,...m.current]:m.current,N))},[w]);return{rows:p,signingIn:l,observe:h,signIn:u,signedIn:v,refresh:g.useCallback(()=>{f(!0)},[f]),closeSignIn:g.useCallback(()=>u(null),[]),later:b}}const yB=288,i1e=yB;function l1e(e,t,n){return e?"session-list":t||n?"accounts":null}function h3(e){return e==="session-list"?i1e:e==="accounts"?yB:0}const c1e=240,u1e=20;function d1e(e){const t=g.useRef(0),n=g.useRef(e);return g.useLayoutEffect(()=>{n.current!==e&&(n.current=e,t.current=md()?0:performance.now()+c1e+u1e)},[e]),t}const wB="agent-dag.sessionListOpen",xB="agent-dag.accountsPanelOpen";function h1e(){return nt(wB)==="1"}function f1e(e){st(wB,e?"1":"0")}function p1e(){const e=nt(xB);return e===null?!0:e==="1"}function m1e(){const e=g.useRef(!1),t=g.useRef(!1),[n,s]=g.useState(()=>{const b=h1e();return b&&B1()?(e.current=!0,!1):b});g.useEffect(()=>{if(n)e.current=!1;else if(e.current)return;f1e(n)},[n]);const a=g.useRef(!1),[o,i]=g.useState(()=>{const b=p1e();return b&&n?(a.current=!0,!1):b&&B1()?(t.current=!0,!1):b});g.useEffect(()=>{if(o)t.current=!1;else if(t.current)return;!o&&a.current||st(xB,o?"1":"0")},[o]),g.useEffect(()=>{!n&&a.current&&(a.current=!1,i(!0))},[n]);const l=g.useCallback(()=>{s(b=>(b||i(k=>(k&&(a.current=!0),!1)),!b))},[]),u=g.useCallback(()=>{a.current=!1,i(b=>(b||s(!1),!b))},[]),h=g.useCallback(()=>{a.current=!1,i(b=>(b||s(!1),!0))},[]),f=g.useCallback(()=>s(!1),[]),p=g.useCallback(()=>{a.current=!1,s(!1)},[]),m=g.useCallback(()=>i(!1),[]),w=l1e(n,o,a.current);return{sessionListOpen:n,accountsPanelOpen:o,panel:w,toggleSessionList:l,toggleAccountsPanel:u,openAccountsPanel:h,closeSessionList:f,closeSessionListToCanvas:p,closeAccountsPanel:m}}const vB="agent-dag.detailOpen",bB="agent-dag.usagePanelOpen",kB="agent-dag.systemPanelOpen";function g1e(){return nt(vB)==="1"}function y1e(e){st(vB,e?"1":"0")}function w1e(){const e=nt(bB);return e===null?!0:e==="1"}function x1e(e){st(bB,e?"1":"0")}function v1e(){const e=nt(kB);return e===null?!0:e==="1"}function b1e(e){st(kB,e?"1":"0")}function k1e(e=0){const[t,n]=g.useState(g1e);g.useEffect(()=>{y1e(t)},[t]);const[s,a]=g.useState(w1e);g.useEffect(()=>{x1e(s)},[s]);const o=g.useRef(!1),[i,l]=g.useState(()=>{const u=v1e();return u&&s&&(B1()||nee(e))?(o.current=!0,!1):u});return g.useEffect(()=>{if(i)o.current=!1;else if(o.current)return;b1e(i)},[i]),an("usage-panel",s),an("machine-panel",i),{detailOpen:t,setDetailOpen:n,usagePanelOpen:s,setUsagePanelOpen:a,machinePanelOpen:i,setMachinePanelOpen:l}}const j1e={permission:"your permission",asked:"your answer"},N1e="No sessions are waiting for you.";function S1e(e){if(e.length===0)return"";const[t,...n]=e,s=t.waiting.kind,a=n.every(i=>i.waiting.kind===s)?j1e[s]??"you":"you";if(n.length===0)return`${t.label} is waiting for ${a}.`;const o=`${n.length} more session${n.length===1?"":"s"}`;return`${t.label} and ${o} are waiting for ${a}.`}function n1(e,t,n=N1e){return t!==""?t:e===""?"":n}function C1e({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[s,a]=g.useState(""),o=S1e(e);g.useEffect(()=>{a(m=>n1(m,o))},[o]);const[i,l]=g.useState(""),u=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";g.useEffect(()=>{l(m=>n1(m,u,"Browser watch has no unread findings."))},[u]);const[h,f]=g.useState(""),p=P0e(n);return g.useEffect(()=>{f(m=>n1(m,p,D0e))},[p]),{blockedSaid:s,watchSaid:i,setWatchSaid:l,incidentSaid:h}}const _1e="/icon-192.png",jB=Object.freeze({notifySwap:!0,notifyQuota:!1,notifyReset:!1,notifyStopped:!0,notifyElsewhere:!0});function f3(e){const t=n=>typeof(e==null?void 0:e[n])=="boolean"?e[n]:jB[n];return{notifySwap:t("notifySwap"),notifyQuota:t("notifyQuota"),notifyReset:t("notifyReset"),notifyStopped:t("notifyStopped"),notifyElsewhere:t("notifyElsewhere")}}function E1e({waitingSessions:e,liveSince:t,focusSession:n}){const[s,a]=g.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[o,i]=g.useState(null),[l,u]=g.useState(!1),[h,f]=g.useState(!1),[p,m]=g.useState(jB),w=g.useCallback(O=>{const M=!p[O];m(W=>({...W,[O]:M})),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[O]:M})}).then(W=>W.ok?W.json():null).then(W=>{W!=null&&W.ok&&m(f3(W.prefs))}).catch(()=>{})},[p]),b=g.useRef(()=>{}),k=g.useRef(new Set),v=Fn(e),N=g.useCallback(()=>{const O=!l;u(O),O&&(k.current=ef(v.current)),O&&typeof Notification<"u"&&Notification.permission==="default"&&b.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:O})}).then(M=>M.ok?M.json():null).then(M=>{var W;M!=null&&M.ok&&(u(((W=M.prefs)==null?void 0:W.notifications)===!0),f(M.notificationsVetoed===!0))}).catch(()=>{})},[l]),x=typeof Notification<"u";g.useEffect(()=>{if(!o)return;const M=setTimeout(()=>i(null),o==="blocked"?8e3:4e3);return()=>clearTimeout(M)},[o]);const C=g.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(O=>{const M=O;a(M),M==="granted"?i("on"):M==="denied"&&i("blocked")})},[]);b.current=C;const S=g.useRef(null),_=e.map(O=>Qp(O.id,O.waiting)).join("|");g.useEffect(()=>{_G(S.current,s)&&(S.current=s,k.current=ef(e))},[s]);const $=g.useRef(!1);g.useEffect(()=>{EG($.current,t)&&($.current=!0,k.current=ef(e))},[t]),g.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!TG(S.current,t))return;const O=typeof document>"u"||!document.hidden,M=SG(e,k.current,O,l);for(const W of M)try{const B=new Notification(W.title,{body:W.body,tag:W.key,icon:_1e});B.onclick=()=>{window.focus(),n(W.sessionId),B.close()}}catch{}k.current=O?ef(e):CG(e,M,k.current)},[_,t]);const A=g.useCallback(O=>{var M;u(((M=O.prefs)==null?void 0:M.notifications)===!0),f(O.notificationsVetoed===!0),m(f3(O.prefs))},[]);return{notifyPermission:s,notifySaid:o,notifyOn:l,notifyVetoed:h,toggleNotify:N,notifySupported:x,askForNotifications:C,loadNotifyPrefs:A,accountNotify:p,toggleAccountNotify:w}}function T1e({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:s,summaryFor:a,browserWatchOpen:o,keyHelpOpen:i,releaseNotes:l,feedbackOpen:u,trafficRadarOpen:h=!1}){const f=Fn(i),p=g.useRef(!1);return p.current=e!=null||t||n!=null||s||a!=null||o||i||l!=null||u||h,{keyHelpOpenRef:f,modalOpenRef:p}}function A1e({stateRef:e,tourOpen:t,releaseNotes:n}){const[s,a]=g.useState(null),o=g.useCallback((R,q)=>a({agentId:R,toolId:q}),[]),[i,l]=g.useState(null),[u,h]=g.useState(null),f=g.useCallback(R=>h(R),[]),[p,m]=g.useState(!1),[w,b]=g.useState(!1),[k,v]=g.useState(!1),[N,x]=g.useState(!1),[C,S]=g.useState(!1),[_,$]=g.useState(null),A=g.useCallback(R=>{$(R??null),S(!0)},[]);an("tool-detail",s!==null),an("session-summary",i!==null),an("context-window",u!==null),an("keyboard-help",p),an("usage-history",w),an("browser-watch",k),an("feedback",C);const O=s?yV(e.current.agents,s.agentId,s.toolId):null,M=u?e.current.agents.get(u):void 0,{keyHelpOpenRef:W,modalOpenRef:B}=T1e({openedTool:O,usageHistoryOpen:w,contextFor:u,tourOpen:t,summaryFor:i,browserWatchOpen:k,keyHelpOpen:p,releaseNotes:n,feedbackOpen:C,trafficRadarOpen:N});return{setOpenedToolKey:a,openTool:o,openedTool:O,summaryFor:i,setSummaryFor:l,contextFor:u,setContextFor:h,openContext:f,contextAgent:M,keyHelpOpen:p,setKeyHelpOpen:m,usageHistoryOpen:w,setUsageHistoryOpen:b,browserWatchOpen:k,setBrowserWatchOpen:v,trafficRadarOpen:N,setTrafficRadarOpen:x,feedbackOpen:C,setFeedbackOpen:S,feedbackPrefill:_,setFeedbackPrefill:$,openFeedback:A,keyHelpOpenRef:W,modalOpenRef:B}}function R1e({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:s,lastLayoutSigRef:a,forgetRemovals:o,clearSelection:i,rerender:l,modalOpenRef:u}){const[h,f]=g.useState(!1),p=g.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=rN(),t.current.clear(),n.current.clear(),s.current.clear(),a.current="",i8(),o(),i(),l()},[l,i,o]),m=Fn(h),w=g.useCallback(b=>{const k=Xwe(b,{confirmOpen:m.current,modalOpen:u.current});k==="confirm"?f(!0):k==="clear"&&(f(!1),p())},[p]);return{clearConfirmOpen:h,setClearConfirmOpen:f,requestClear:w}}const p3="agent-dag.oldNameNoticeDismissed";function M1e(e){const[t,n]=g.useState(()=>nt(p3)??""),s=e!=null&&e.invokedAs&&e.invokedAs!==Pt?e.invokedAs:null,a=s!=null&&t!==s,o=g.useCallback(()=>{s&&(n(s),st(p3,s))},[s]);return{oldName:s,oldNameOpen:a,dismissOldName:o}}const $1e=300*1e3,L1e=1800*1e3,I1e=8e3,O1e=3e4;function m3(e){return fetch("/api/rating",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}).catch(()=>null)}function P1e({modalOpenRef:e}){const t=g.useCallback(()=>wl({appModal:e.current,dialogDepth:rn.dialogDepth()}),[e]),[n,s]=g.useState("hidden"),[a,o]=g.useState(null),[i,l]=g.useState(!1),u=g.useRef(n);u.current=n,g.useEffect(()=>{let w=!1;const b=async()=>{if(u.current==="thanks"||u.current==="hidden"&&(document.hidden||t()))return;const N=await fetch("/api/rating").then(x=>x.ok?x.json():null).catch(()=>null);w||!N||s(x=>x==="thanks"?x:N.ask===!0?"asking":"hidden")},k=window.setTimeout(b,$1e),v=window.setInterval(b,L1e);return()=>{w=!0,window.clearTimeout(k),window.clearInterval(v)}},[t]),g.useEffect(()=>{if(n!=="thanks"||i)return;const w=a!==null&&a<=6?O1e:I1e;let b=0;const k=()=>{t()?b=window.setTimeout(k,w):s("hidden")};return b=window.setTimeout(k,w),()=>window.clearTimeout(b)},[n,a,i,t]);const h=g.useCallback(w=>{o(w),l(!1),s("thanks"),m3({score:w})},[]),f=g.useCallback(w=>l(w),[]),p=g.useCallback(()=>{s("hidden"),m3({later:!0})},[]),m=g.useCallback(()=>s("hidden"),[]);return{ratingPhase:n,ratingScore:a,answerRating:h,rateLater:p,closeRating:m,holdThanks:f}}function D1e({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:s}){const[a,o]=g.useState(()=>Ree(nt)),i=Fn(a),[l,u]=g.useState([]),h=g.useCallback(x=>{o(C=>{const S={...C,[x]:null};return i.current=S,S}),ks(Ru[x])},[]),f=g.useCallback((x,C)=>{const S=i.current[x];C&&S!==C||(h(x),t(_=>{const $={..._,[x]:{..._[x],figure:es}};return n.current=$,$}),st(gp[x],es))},[h]),p=Fn(f);g.useEffect(()=>{let x=!0;return Uee().then(C=>{if(!x)return;u(C);const S=new Set(C.map(_=>_.id));for(const _ of Mu){const $=i.current[_];$&&!S.has($)&&p.current(_,$)}},()=>{}),()=>{x=!1}},[]);const m=g.useCallback((x,C)=>{if(!l.some(_=>_.id===C))return;const S={...i.current,[x]:C};i.current=S,o(S),st(Ru[x],C),s(x,!0)},[l,s]),w=g.useCallback(async x=>{var $;const C=U1(l.length);if(C)throw new Error(C);const S=window.AudioContext??window.webkitAudioContext;if(!S)throw new Error("This browser cannot decode audio files.");const _=new S;try{const A=await Pee(x,M=>_.decodeAudioData(M));await wA(A);const O=td(A);u(M=>[...M.filter(W=>W.id!==O.id),O])}finally{($=_.close)==null||$.call(_)}},[l.length]),b=g.useCallback(async x=>{const C=U1(l.length);if(C)throw new Error(C);const S=Dee(x);await wA(S);const _=td(S);u($=>[...$.filter(A=>A.id!==_.id),_])},[l.length]),k=g.useCallback(async(x,C)=>{const S=l.find($=>$.id===x),_=C.trim().slice(0,80);!S||!_||_===S.name||(await Hee(x,_),u($=>$.map(A=>A.id===x?{...A,name:_}:A)))},[l]),v=g.useCallback(async x=>{await zee(x),u($=>$.filter(A=>A.id!==x));const C=i.current,S=Mee(C,x);i.current=S,o(S);const _=Mu.filter($=>C[$]===x);for(const $ of _)ks(Ru[$]),st(gp[$],es);_.length>0&&t($=>{const A={...$};for(const O of _)A[O]={...A[O],figure:es};return n.current=A,A})},[]),N=g.useCallback(x=>{var _,$;const C=Mu.find(A=>i.current[A]===x),S=C?n.current[C].level:wi;(_=e.current)==null||_.unlock(),($=e.current)==null||$.previewCustom(x,S)},[]);return{customSelections:a,customSelectionsRef:i,customAssets:l,clearCustomOnly:h,fallbackCustomRef:p,selectCustomTone:m,importNotificationAudio:w,createNotificationVoice:b,renameCustomAsset:k,deleteCustomAsset:v,previewCustomAsset:N}}function F1e(e){const[t,n]=g.useState(()=>ste(nt)),s=Fn(t),a=g.useRef(null),o=g.useCallback((l,u=!1)=>{var h,f;if((h=e.current)==null||h.unlock(),a.current!==null&&clearTimeout(a.current),a.current=null,!u){(f=e.current)==null||f.play(l,!0);return}a.current=setTimeout(()=>{var p;a.current=null,(p=e.current)==null||p.play(l,!0)},Jee)},[]),i=g.useCallback((l,u)=>{n(h=>{const f={level:pm(u.level??h[l].level),figure:XD(l,u.figure??h[l].figure)};return st(QD[l],String(f.level)),st(gp[l],f.figure),{...h,[l]:f}}),o(l,!0)},[o]);return g.useEffect(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:s,previewTone:o,changeTone:i}}const B1e=15e3;function q1e(e){return e.visibilityState==="visible"&&e.hasFocus()}function U1e(e,t){return t||e===!0}function W1e(){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 H1e(){g.useEffect(()=>{const e=W1e();let t=null;const n=i=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:e,looking:i}),keepalive:!0}).catch(()=>{})},s=()=>{const i=q1e(document);U1e(t,i)&&n(i),t=i},a=()=>{t&&n(!1),t=!1};s();const o=window.setInterval(s,B1e);return window.addEventListener("focus",s),window.addEventListener("blur",s),document.addEventListener("visibilitychange",s),window.addEventListener("pagehide",a),()=>{window.clearInterval(o),window.removeEventListener("focus",s),window.removeEventListener("blur",s),document.removeEventListener("visibilitychange",s),window.removeEventListener("pagehide",a),a()}},[])}function z1e({loadAutoRestartPrefs:e,loadNotifyPrefs:t,loadReportsPrefs:n}){g.useEffect(()=>{let s=!0;return fetch("/api/prefs").then(a=>a.ok?a.json():null).then(a=>{!s||!(a!=null&&a.ok)||(e(a),t(a),n(a))}).catch(()=>{}),()=>{s=!1}},[])}const s1="agent-dag.versionNoticeDismissed",V1e=15*6e4;function G1e(e){const[t,n]=g.useState(null),[s,a]=g.useState(()=>nt(s1)??""),o=g.useRef(0),[i,l]=g.useState(!1),u=g.useCallback((k=!1)=>(k&&(o.current=Date.now(),l(!0)),fetch(k?"/api/version?refresh=1":"/api/version").then(v=>v.ok?v.json():null).then(v=>(v&&n(v),v??null)).catch(()=>null).finally(()=>{k&&l(!1)})),[]),h=g.useCallback(()=>{u(Date.now()-o.current>=V1e)},[u]);g.useEffect(()=>{u();const k=window.setInterval(h,5*6e4),v=()=>{document.visibilityState==="visible"&&h()};return document.addEventListener("visibilitychange",v),()=>{window.clearInterval(k),document.removeEventListener("visibilitychange",v)}},[u,h]),g.useEffect(()=>{e&&u()},[e,u]);const f=(t==null?void 0:t.notice)??null,p=P8(f),m=fwe(f,s),w=g.useCallback(()=>{a(""),st(s1,"")},[]),b=g.useCallback(()=>{f&&(a(p),st(s1,p))},[f,p]);return{version:t,notice:f,noticeOpen:m,showNotice:w,dismissNotice:b,versionChecking:i,loadVersion:u}}function K1e({version:e,readyAppUpdate:t}){const[n,s]=g.useState(!1),a=g.useRef(null),[o,i]=g.useState(null),l=o&&t?t.version:null,u=g.useRef(null);g.useEffect(()=>{!l||u.current===l||(u.current=l,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:l})}).catch(()=>{}))},[l]);const h=g.useRef(!1);g.useEffect(()=>{if(h.current)return;const v=wr(),N=Lve(v),x=Bve({stored:N,running:(e==null?void 0:e.running)??null,notes:FO,remembers:Ive(v)});if(x.reason==="no-version")return;h.current=!0,x.record&&Ove(v,x.record);let C=!0;return(async()=>{var O;let _=Pve(v);if(co())try{const M=await fetch("/api/prefs");if(!M.ok)throw new Error("desktop tour preferences unavailable");const W=await M.json();if(!(W!=null&&W.ok))throw new Error("desktop tour preferences unavailable");const B=((O=W.prefs)==null?void 0:O.tourSeen)===!0;_&&!B&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),_=_||B}catch{_=!0}if(!C)return;const $=Fve({tourSeen:_,decision:x}),A=x.show.length?{entries:x.show,since:N,firstRun:!1}:null;$.tour&&s(!0),$.notes==="now"?i(A):$.notes==="after"&&(a.current=A)})(),()=>{C=!1}},[e==null?void 0:e.running]);const f=(e==null?void 0:e.running)??"3.48.1",p=g.useMemo(()=>Q8(FO,null,f),[f]),m=g.useCallback(()=>{i({entries:p,since:null,firstRun:!1})},[p]),w=g.useCallback(()=>s(!0),[]),b=g.useCallback(()=>i(null),[]),k=g.useCallback(()=>{s(!1),Dve(wr()),co()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const v=a.current;a.current=null,v&&i(v)},[]);return{tourOpen:n,openTour:w,closeTour:k,releaseNotes:o,closeReleaseNotes:b,chipVersion:f,openReleaseNotes:m}}function Y1e(){const[e,t]=g.useState(void 0),[n,s]=g.useState(!1),a=g.useRef(!1);return a.current=e===!0&&!n,g.useEffect(()=>f0e(()=>a.current),[]),{loadReportsPrefs:g.useCallback(i=>{var l;t(((l=i.prefs)==null?void 0:l.reports)!==!1),s(i.reportsVetoed===!0)},[])}}function X1e(e){const[t,n]=g.useState(null);g.useEffect(()=>{const l=nt("agent-dag.sound");n(l===null?!0:l==="on")},[]);const s=g.useCallback(()=>{n(l=>{var h,f;const u=l!==!0;return st("agent-dag.sound",u?"on":"off"),u?(h=e.current)==null||h.unlock():(f=e.current)==null||f.silence(),u})},[]),a=g.useCallback(l=>{s()},[s]),o=Fn(a),i=Fn(t);return{soundOn:t,toggleSound:s,activateSoundRef:o,soundOnRef:i}}function Z1e(){const[e,t]=g.useState(fee),n=g.useCallback((o,i)=>{t(l=>pee(l,o,i))},[]),s=g.useCallback(()=>t(o=>({...o,open:!1})),[]),a=g.useCallback(o=>t(i=>({...i,section:o})),[]);return{settingsOpen:e.open,settingsSection:e.section,settingsLandOn:e.landOn,openSettings:n,closeSettings:s,showSection:a}}const J1e="agent-dag.autoFitDisabled";function Q1e(e){const t=g.useRef(!1),[n,s]=g.useState(!1);g.useEffect(()=>{ks(J1e)},[]);const a=g.useCallback(()=>{t.current||(t.current=!0,s(!0))},[]),o=g.useCallback(()=>{t.current=!1,s(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:a,enableAutoFitAndRefit:o}}function eje(){return r.jsx(sN,{children:r.jsx(g0e,{children:r.jsx(tje,{})})})}function tje(){var Mc;const e=ec(),t=g.useState(rN)[0],n=g.useRef(t),[,s]=g.useState(0),a=g.useCallback(()=>s(ut=>ut+1),[]),{sessionListOpen:o,accountsPanelOpen:i,panel:l,toggleSessionList:u,toggleAccountsPanel:h,openAccountsPanel:f,closeSessionList:p,closeSessionListToCanvas:m,closeAccountsPanel:w}=m1e(),{detailOpen:b,setDetailOpen:k,usagePanelOpen:v,setUsagePanelOpen:N,machinePanelOpen:x,setMachinePanelOpen:C}=k1e(h3(l)),{selectedIds:S,primarySelectedId:_,selectAgent:$,clearSelection:A,pruneSelectionToBoard:O}=Nde(n,k),M=Nl(i,200),W=Nl(o,200),B=zE(o,W),R=Nl(v,130),q=Nl(x,130),T=g.useRef(null),F=X1e(T),{activateSoundRef:D,soundOnRef:K}=F,V=F1e(T),{setTonePrefs:H,tonePrefsRef:P,previewTone:I}=V,U=D1e({chimesRef:T,setTonePrefs:H,tonePrefsRef:P,previewTone:I}),{customSelectionsRef:Z,fallbackCustomRef:z}=U,X=Z1e(),{openSettings:Y}=X;e1e({chimesRef:T,soundOnRef:K,tonePrefsRef:P,customSelectionsRef:Z,fallbackCustomRef:z});const J=x0e(n),{pauseGate:Q,paused:te,togglePause:le}=J,de=g.useRef(()=>{}),{live:oe,tabCapped:re,everConnected:he,liveSince:pe}=pde({stateRef:n,rerender:a,pauseGate:Q,chimesRef:T,desktopUpdateRef:de}),Le=G1e(oe),{version:ge,notice:ve,noticeOpen:je,loadVersion:Ee}=Le,xe=n1e(oe),{readyAppUpdate:Ie,onDesktopUpdateEvent:De}=xe;de.current=De,H1e();const We=K1e({version:ge,readyAppUpdate:Ie}),{tourOpen:Ke,openTour:ye,releaseNotes:Fe}=We,{workspace:$e,providers:Re,providersRef:rt}=b0e(oe),He=h3(l==="accounts"&&!Re.claude?null:l),se=d1e(He),ke=zE(i,M)&&Re.claude,[Ae,Oe]=g.useState(!1),be=g.useCallback(()=>{f(),Oe(!0)},[f]);g.useEffect(()=>{i||Oe(!1)},[i]);const fe=g.useCallback(()=>Oe(!1),[]),_e=M1e(ge),Ve=F0e({version:ge,loadVersion:Ee}),{upgradeFailure:ot}=Ve,tt=A1e({stateRef:n,tourOpen:Ke,releaseNotes:Fe}),wt=P1e({modalOpenRef:tt.modalOpenRef}),{openTool:$t,setSummaryFor:Gt,setContextFor:nr,openContext:_s,setKeyHelpOpen:Hn,setUsageHistoryOpen:ns,setBrowserWatchOpen:Es,keyHelpOpenRef:wn,modalOpenRef:zn}=tt,Me=Y1e(),qe=q0e(),{watchOn:Je,watchUnseen:_t}=qe,Nt=$d(),[ss,Vn]=g.useState(null),[xn,Tr]=g.useState(!1),vn=g.useCallback(()=>Tr(!1),[]),on=ut=>{Gye(ut),Y("integrations")},Ts=ut=>{ut&&EO(ut),Y("integrations")},sr=g.useCallback(()=>Vn(null),[]),rs=qS().filter(ut=>Cj(Nt,ut.kind)),As=Fn(ut=>{const Ur=rs.find(ug=>ug.kind===ut);Ur&&Vn(Ur.kind)}),Ar=g.useCallback(ut=>{EO(ut),Y("integrations")},[Y]),Rr=rs.length>0;g.useEffect(()=>{Rr&&Iye()},[Rr]);const Rs=r1e(),[ya,xt]=g.useState(0),{presentCats:wa,hiddenCats:Ms,toggleCat:xa,catBarRef:rr,catBarOccluded:ar}=J0e(n),Mr=g.useRef(null),[$s,hn]=g.useState(0),Lt=Sde({stateRef:n,rerender:a,pruneSelectionToBoard:O,setContextFor:nr,setSummaryFor:Gt});bY({stateRef:n,now:Lt,enabled:Re.claude});const fn=S0e(Re.claude||Re.codex),va=O0e(fn,Lt),go=o1e({enabled:Re.claude,lanStatus:Rs.lanStatus,now:Lt}),ba=s1e({now:Lt,stateRef:n,version:ge,notice:ve,noticeOpen:je,upgradeFailure:ot,paused:J.paused}),{askRestart:ka,loadAutoRestartPrefs:$r}=ba,Gn=Z0e(),{setTheme:we,palette:et}=Gn,pt=t1e(),Et=kme(),{applyViewport:or,moveCamera:Lr,fitLeft:as,cameraEpochRef:fc,lastFitTimeRef:Ir}=Et,at=Ome(Et),{pinnedRef:yo,positionsRef:wo,lastLayoutSigRef:pc,handleRelayout:mc,rearrangeUndo:Id}=at,gc=g.useRef(null),_i=g.useRef(()=>{}),xo=pe!==null,Ls=g.useRef(0),Is=g.useCallback(()=>{Ls.current=Date.now()},[]),{canvasRef:ln,canvasSize:vo,paneSizeRef:bo}=Nge(se),Os=Q1e(as),{autoFitDisabledRef:Od,disableAutoFit:Ei}=Os,Or=g.useRef(!1),{measuredRef:Pr,measuredVersionRef:Pd,sizeVersion:Ti,domSizeVersion:Dd}=Sge(Or),{removedNodes:yc,removedAgentIds:os,removeNode:ko,removeSelectedNode:Dr,removalNotice:jo,hideSessions:Km,bringBack:wc,bringBackAll:xc,forgetRemovals:Ai}=sge({stateRef:n,pinnedRef:yo,positionsRef:wo,canvasRef:ln,clearSelection:A,primarySelectedId:_});fge({stateRef:n,removedNodes:yc,hideSessions:Km,ready:xo,keepSessionId:_?((Mc=n.current.agents.get(_))==null?void 0:Mc.sessionId)??_:null});const No=Jme({stateRef:n,now:Lt,removedAgentIds:os,sizeVersion:Ti,domSizeVersion:Dd});Pme(No,at),nge({layoutSig:No,rf:e,stateRef:n,measuredRef:Pr,pinnedRef:yo,positionsRef:wo,paneSizeRef:bo,lastInteractRef:Ls,autoFitDisabledRef:Od,lastFitTimeRef:Ir,fitLeft:as});const vc=Cge(),{bubbling:ir,endBubble:bc,onBubble:Ri}=Que(),[Mi,$i]=g.useState(!1),So=Zue(),{beginTrashDrag:Fd,trackTrashDrag:bn,endTrashDrag:ja}=So,Li=ode({stateRef:n,measuredRef:Pr,measuredVersionRef:Pd,canvasRef:ln}),{lodRef:Co,applyZoom:Ym}=Li,Ii=bge({applyViewport:or,lastFitTimeRef:Ir,cameraEpochRef:fc,disableAutoFit:Ei,markInteract:Is,canvasRef:ln,applyZoom:Ym}),Fr=_?n.current.agents.get(_):null,Br=b&&Fr!=null,Ps=Age({sessionListShown:B,usageShown:Ja(R),machineShown:Ja(q),accountsShown:ke,detailShown:Br,primarySelectedId:_,canvasRef:ln}),{railInsetRef:_o,availableWidth:Bd,availableHeight:qd}=yme({canvasRef:ln,canvasSize:vo,machinePhase:q,usagePhase:R,usagePanelOpen:v,detailShown:Br}),Ud=Qme({stateRef:n,now:Lt,availableWidth:Bd,availableHeight:qd,layout:at,measuredRef:Pr,onBubble:Ri,settled:vc,dragging:Mi,layoutSig:No,selectedIds:S,openContext:_s,historyReplayed:xo,removedNodes:yc,removedAgentIds:os,dragTick:ya,dragPatchRef:Mr,dragMoveTick:$s}),{nodes:Eo,edges:Xm}=Ud,kc=Fn(_);Dme({nodes:Eo,edges:Xm,settled:vc,dragging:Mi,availableWidth:Bd,availableHeight:qd,layout:at,camera:Et,rf:e,measuredRef:Pr,stateRef:n,lastFocusRef:gc,primarySelectedIdRef:kc,focusAgentRef:_i,autoFitDisabledRef:Od});const Wd=R1e({stateRef:n,pinnedRef:yo,measuredRef:Pr,positionsRef:wo,lastLayoutSigRef:pc,forgetRemovals:Ai,clearSelection:A,rerender:a,modalOpenRef:zn}),{requestClear:jc}=Wd,Zm=Rge({nodes:Eo,stateRef:n,pinnedRef:yo,positionsRef:wo,draggingRef:Or,dragPatchRef:Mr,setDragging:$i,setDragMoveTick:hn,setDragTick:xt,endBubble:bc,markInteract:Is,disableAutoFit:Ei,beginTrashDrag:Fd,trackTrashDrag:bn,endTrashDrag:ja,removeNode:ko}),Nc=g.useCallback(()=>as(500),[as]),Sc=Fn(Eo),{focusAgent:Oi,stepAgent:Jm,focusSession:Na}=Nme({canvasRef:ln,stateRef:n,measuredRef:Pr,nodesRef:Sc,railInsetRef:_o,moveCamera:Lr,disableAutoFit:Ei,lastFocusRef:gc,focusAgentRef:_i,selectAgent:$,primarySelectedIdRef:kc}),Cc=kge({clearSelection:A,selectAgent:$,detailOpen:b,setDetailOpen:k,detailShown:Br,focusAgent:Oi,draggingRef:Or,lodRef:Co}),Qm=Sme({nodesRef:Sc,stateRef:n,canvasRef:ln,railInsetRef:_o}),eg=Fn(Dr),_c=g.useRef(null),To=g.useCallback(ut=>{os.has(ut)&&wc([ut]),Na(ut)},[os,wc,Na]),tg=_ge(),[ng,Ec]=g.useState(!1),Hd=g.useCallback(()=>Ec(!0),[]),sg=g.useCallback(()=>Ec(!1),[]),rg=g.useCallback(ut=>{Ec(!1),ut.run()},[]),ag=An();Ege({pointerFocusRef:tg,nodesRef:Sc,stateRef:n,primarySelectedIdRef:kc,providersRef:rt,soundOnRef:K,keyHelpOpenRef:wn,modalOpenRef:zn,waitingCursorRef:_c,removeSelectedRef:eg,activateSoundRef:D,clearSelection:A,selectAgent:$,focusAgent:Oi,stepAgent:Jm,focusSession:Na,requestClear:jc,handleRelayout:mc,undoRearrange:Id.undo,handleFit:Nc,togglePause:le,toggleSessionList:u,toggleAccountsPanel:h,setDetailOpen:k,setUsageHistoryOpen:ns,setUsagePanelOpen:N,setMachinePanelOpen:C,setBrowserWatchOpen:Es,setKeyHelpOpen:Hn,setTheme:we,openSettings:Y,openIntegrationRef:As,openQuickOpen:Hd});const Ao=n.current.agents.size,is=g.useMemo(()=>N1(n.current.agents.values()),[n.current,n.current.revision]);rge({stateRef:n,waitingSessions:is,removedAgentIds:os,removedNodes:yc,bringBack:wc}),wge({stateRef:n,waitingSessions:is,live:oe});const zd=C1e({waitingSessions:is,watchUnseen:_t,incidents:va}),Pi=E1e({waitingSessions:is,liveSince:pe,focusSession:Na}),{loadNotifyPrefs:Vd}=Pi;z1e({loadAutoRestartPrefs:$r,loadNotifyPrefs:Vd,loadReportsPrefs:Me.loadReportsPrefs});const lr=ic(fm),[Gd,Tc]=g.useState(!1),[qr,Ac]=g.useState(null),og=g.useCallback(()=>Ac(null),[]),ig=g.useCallback(ut=>{const Ur=n.current.agents.get(ut);return Ur?Ur.label||Ur.cwdBasename||"session":null},[]),Kd=g.useCallback(ut=>{Ac(null),To(ut)},[To]),Yd=g.useCallback(()=>Tc(!1),[]),[Sa,Ca]=g.useState(null),lg=g.useCallback(()=>Ca(null),[]),qt=Xge({providers:Re,sessionListOpen:o,toggleSessionList:u,accountsPanelOpen:i,toggleAccountsPanel:h,usagePanelOpen:v,setUsagePanelOpen:N,machinePanelOpen:x,setMachinePanelOpen:C,setUsageHistoryOpen:ns,watchOn:Je,watchUnseen:_t,setBrowserWatchOpen:Es,setTrafficRadarOpen:tt.setTrafficRadarOpen,openSettings:Y,onFeedback:tt.openFeedback,setRadioOpen:Tc,openToolActivity:Ac,openCapacity:Ca,toggles:Ps.toggles,integrations:rs.map(ut=>({provider:ut,onPress:()=>Vn(ut.kind)})),openExploreIntegrations:()=>Tr(!0),openQuickOpen:Hd}),[cg,Xd]=g.useState(0),Di=g.useCallback(ut=>{To(ut),lr&&m()},[To,lr,m]),Rc=g.useCallback(()=>{o||u(),requestAnimationFrame(()=>{var ut;return(ut=document.querySelector("#session-list .sl-row"))==null?void 0:ut.focus()})},[o,u]);return r.jsxs("div",{className:"app",children:[r.jsx("a",{className:"skip-link",href:"#canvas",children:"Skip to the canvas"}),r.jsxs("header",{className:"topbar",children:[r.jsx(HJ,{}),r.jsx(Nwe,{versionCheck:Le,welcome:We,desktopUpdate:xe,pause:J,announcements:zd,notify:Pi,waitingSessions:is,waitingCursorRef:_c,focusSession:Na,live:oe,now:Lt,incidents:va,queueNamed:lr?0:cg}),!lr&&r.jsx(bwe,{waitingSessions:is,waitingCursorRef:_c,focusSession:Na,now:Lt,onFit:Xd,onMore:Rc}),Fr&&r.jsx(Swe,{selected:Fr,now:Lt,selectedIds:S,focusAgent:Oi,clearSelection:A}),!lr&&r.jsx("div",{className:"actions",children:r.jsx(cee,{items:[qt.search,...qt.utilities]})})]}),lr?r.jsx(lee,{items:[...qt.left,...qt.right[0],qt.utilities[0]],more:[qt.search,...qt.capacity,...qt.right.slice(1).flat(),...qt.integrations,...qt.explore,qt.utilities[1]]}):r.jsx(uA,{side:"left",label:"Accounts and sessions",groups:[...qt.leftStripe,qt.integrations,qt.explore]}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:jo?`${jo.label} removed from the board.`:""}),r.jsx(Ywe,{restart:ba,versionCheck:Le,upgrade:Ve,oldNameNotice:_e,rating:wt,onFeedback:tt.openFeedback,everConnected:he,live:oe,paused:te}),(B||ke)&&r.jsxs(Hue,{width:He,children:[ke&&r.jsx(_ue,{leaving:VE(i,M),onReport:tt.openFeedback,onRoster:go.observe,onClose:()=>{Ps.accounts(),w()},lanWanted:Ae,onLanShown:fe}),B&&r.jsx(sQ,{leaving:VE(o,W),state:n.current,now:Lt,selectedIds:S,onSelect:Di,onClose:()=>{Ps.sessionList(),p()},removedIds:os,onBringBackAll:xc})]}),r.jsxs(Awe,{canvasRef:ln,bubbling:ir,dragging:Mi,trash:So,zoom:Li,viewport:Ii,stateRef:n,peek:Qm,children:[Ao===0&&(!oe&&re?r.jsx($ge,{reservedRight:_o.current}):r.jsx(Lge,{live:oe,everConnected:he,providers:Re,workspace:$e,onTour:ye,reservedRight:_o.current})),(wa.length>1||Ms.size>0)&&r.jsx(Cwe,{catBarRef:rr,catBarOccluded:ar,presentCats:wa,hiddenCats:Ms,toggleCat:xa}),r.jsx(WJ,{graph:Ud,layout:at,viewport:Ii,clicks:Cc,drag:Zm,appearance:Gn,fm:pt,radioOpen:Gd,onRadioClose:Yd,autoFit:Os,pause:J,stateRef:n,measuredRef:Pr,hiddenCats:Ms,now:Lt,openTool:$t,focusAgent:Oi,requestClear:jc,setKeyHelpOpen:Hn})]}),!lr&&r.jsx(uA,{side:"right",label:"Usage and activity",groups:qt.right}),qr&&r.jsx(Tne,{view:qr,onClose:og,sessionLabel:ig,onOpenSession:Kd}),Sa&&r.jsx(Wue,{view:Sa,onClose:lg}),ss&&r.jsx(Dye,{kind:ss,connections:ra(Nt,ss)?Lp(Nt,ss):[],onClose:sr,onReconnect:Ar}),xn&&r.jsx(Jye,{integrations:Nt,onClose:vn,onOpen:Vn,onConnect:on,onManage:Ts}),ng&&r.jsx(qQ,{onClose:sg,onRun:rg,items:Cte({rails:qt,sessions:RD(n.current),now:Lt,openSession:Di,settings:n5(Re.claude,WS(Nt),Ld(Nt)),openSettings:Y,singleKeys:ag,fit:Nc,rearrange:mc,paused:te,togglePause:le,clear:Ao>0?()=>jc("button"):void 0,keyHelp:()=>Hn(!0),tour:ye,theme:Gn.theme,setTheme:we})}),Ja(R)&&r.jsx(Qse,{state:n.current,now:Lt,providers:Re,incidents:va,liveSince:pe,leaving:R==="leaving",onClose:()=>{Ps.usage(),N(!1)}}),Ja(q)&&r.jsx(Ire,{usageOpen:v,leaving:q==="leaving",onClose:()=>{Ps.machine(),C(!1)}}),b&&Fr?r.jsx(Kge,{selected:Fr,now:Lt,openTool:$t,setSummaryFor:Gt,stateRef:n,removeSelectedNode:Dr,onClose:()=>{Ps.detail(),k(!1)}}):null,r.jsx(Xke,{dialogs:tt,welcome:We,desktopUpdate:xe,versionCheck:Le,restart:ba,upgrade:Ve,lanPairs:Rs,attention:go,clearFlow:Wd,watchBadge:qe,announcements:zd,appearance:Gn,providers:Re,stateRef:n,agentCount:Ao,menus:X,sound:F,tones:V,customTones:U,notify:Pi,panelDoors:{accounts:f,localNetwork:be}})]})}try{fK(window.localStorage)}catch{}const nje=Aq.createRoot(document.getElementById("root"));window.ccdeckWindow&&(document.documentElement.dataset.desktopChrome="true",document.documentElement.dataset.desktopPlatform=window.ccdeckWindow.platform);nje.render(r.jsx(eje,{}));export{wje as $,vd as A,dje as B,vt as C,_u as D,rd as E,Nje as F,T5 as G,pae as H,vr as I,ct as J,X1 as K,RA as L,Z1 as M,lje as N,Ct as O,no as P,na as Q,S5 as R,cje as S,np as T,uje as U,cd as V,Wn as W,Iee as X,yje as Y,vje as Z,Uve as _,ks as a,xje as a0,qve as a1,bje as a2,im as a3,me as a4,yi as a5,so as a6,MZ as a7,Sje as a8,EN as a9,Xl as aa,fX as ab,ije as ac,aje as ad,oje as ae,lm as af,KG as ag,Lbe as ah,U0e as ai,rje as aj,$Z as ak,g as b,mje as c,Bn as d,rp as e,T8 as f,Vo as g,ho as h,gje as i,r as j,uS as k,AP as l,rn as m,gt as n,yt as o,md as p,pje as q,nt as r,Cn as s,fje as t,ic as u,an as v,st as w,jje as x,kje as y,hje as z};
|