ccdeck 3.49.0 → 3.49.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/dist/web/assets/{BrowserWatchModal-D-7rOvFP.js → BrowserWatchModal-CCARqAMn.js} +1 -1
- package/dist/web/assets/{IntegrationModal-BbiK7DiR.js → IntegrationModal-B8t53aE5.js} +1 -1
- package/dist/web/assets/{RadioPanel-BXbw3TO5.js → RadioPanel-gFYxdsBg.js} +1 -1
- package/dist/web/assets/{TrafficRadar-YQJ7dFlH.js → TrafficRadar-B9MfKca4.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-XO_w9pBD.js → UsageHistoryModal-DvYWhsYv.js} +1 -1
- package/dist/web/assets/{app-EEG3dpaG.js → app-D2NP6IPl.js} +6 -6
- package/dist/web/assets/app-DfGYllmZ.css +1 -0
- package/dist/web/assets/{index-DfCwddzR.js → index-Be6Ox-74.js} +1 -1
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/release-notes.json +7 -13
- package/dist/web/assets/app-DRbxoq7w.css +0 -1
|
@@ -86,7 +86,7 @@ ${e.sessionTitle}`:e.sessionTitle:e.cwd,d=wN(e),f=g.useRef(null),p=g.useRef(null
|
|
|
86
86
|
spend on this card also covers:
|
|
87
87
|
${d.join(`
|
|
88
88
|
`)}`:ed(e.model,e.effort)),S=sm(e.sessionName,e.sessionTitle),C=UP(e),_=(C==null?void 0:C.note)??null,R=C?C.key:null,A=jK(R),I=C!=null&&!A,$=(_==null?void 0:_.kind)==="recap",U=vG(e);return r.jsxs("div",{className:n,style:{"--session-hue":o},children:[r.jsx("span",{className:"accent-stripe"}),r.jsx(ci,{type:"target",position:Ye.Left,style:{background:"transparent",border:"none"}}),r.jsxs("div",{className:"head",children:[r.jsxs("div",{className:"title",children:[r.jsx(LY,{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:"?"}),C&&R&&r.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":$?"Claude Code's recap":_?`Session note: ${sc(_.kind)}`:"Session note: plan","aria-expanded":I,title:$?I?"Hide the recap":"Show Claude Code's recap":_?I?"Hide this note":"Show what this session is doing":I?"Hide the plan":"Show the plan",onClick:B=>{B.stopPropagation(),kK(R)},children:r.jsx(ap,{recap:$})})]}),r.jsx("div",{className:"head-right",children:l&&e.onOpenContext&&r.jsx(dK,{currentContextTokens:i,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)})})]}),r.jsxs("div",{className:"sub",title:qG(e),children:[r.jsxs("span",{className:"sub-details",ref:f,children:[k.kind&&r.jsx("span",{children:nm(e)}),e.childCount>0&&r.jsxs("span",{className:"spawn-badge",title:BG(e.childCount),children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"&&r.jsxs("span",{className:"sub-folder",ref:p,children:[k.kind?"· ":"",e.cwdBasename]}),e.model?r.jsxs("span",{className:"model-chip","data-family":Qp(e.model),title:v,children:[em(e.model,k.effort?e.effort:void 0),d.length>0?` +${d.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($Y,{start:e.startedAt,end:e.endedAt})]})]}),e.kind==="root"&&S.face&&r.jsx("div",{className:"session-name",title:S.tooltip,children:S.face}),e.kind==="root"&&e.stopFailure&&r.jsx(IY,{data:e,stop:e.stopFailure}),e.kind==="root"&&!e.stopFailure&&r.jsx(_Y,{data:e}),e.waiting&&!(e.stopFailure&&e.waiting.kind==="idle")&&r.jsx(OY,{waiting:e.waiting}),(()=>{const B=_P(e);return B?r.jsxs("div",{className:"approval-blind-row",title:B.detail,children:[r.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),r.jsx("span",{className:"approval-blind-said",children:B.label})]}):null})(),(()=>{const B=Nr(e.plan);return B&&e.plan?r.jsx(RY,{plan:B,items:e.plan.items}):null})(),(e.tools.length>0||(((M=e.outputs)==null?void 0:M.length)??0)>0)&&r.jsx(PY,{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:St(e.usage.inputTokens+e.usage.outputTokens)})," tok"]}),(U==null?void 0:U.kind)==="unpriced"&&r.jsx("span",{className:"cost-unpriced",title:U.tt,children:ua}),(U==null?void 0:U.kind)==="spent"&&r.jsx("span",{className:"cost-meta",title:U.tt,children:r.jsxs("b",{children:[lt(U.total),U.floor?"+":""]})})]}),r.jsx(MY,{data:e,title:e.kind==="root"?S.face:void 0}),r.jsx(ci,{type:"source",position:Ye.Right,style:{background:"transparent",border:"none"}})]})}const AY=g.memo(TY);function RY({plan:e,items:t}){return r.jsxs("div",{className:e.allDone?"plan-row plan-done":"plan-row",title:Xp(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 MY({data:e,title:t}){const n=e.kind==="root"&&Tn(e.waiting),s=RK(e,e.branch,{sayWaiting:sp,describeCall:a=>({name:NN(a.name).label,subject:sY(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(XP,{kind:R1(Al(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(SN,{})]}),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 $Y({start:e,end:t}){const n=Sr(1e3);return r.jsx(r.Fragment,{children:zl(e,t,n)})}function LY({state:e}){return r.jsx("span",{className:`state-pill state-${e}`,children:Wl(e)})}function IY({data:e,stop:t}){return r.jsxs("div",{className:"stop-row",title:OG(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:TP(t)}),r.jsx(CY,{data:e})]})}function OY({waiting:e}){const t=Sr(1e3),n=Tn(e),s=Hl(e);return r.jsxs("div",{className:n?"waiting-row permission":"waiting-row idle",title:`${s}
|
|
89
|
-
Blocked for ${zl(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:sp(e)}),r.jsx("b",{children:zl(e.since,void 0,t)})]})}function PY({tools:e,outputs:t}){const n=Sr(1e3),{counts:s,title:a}=lY(e,t,n),o=Qy/Rl;return r.jsxs("div",{className:"tool-spark-row",title:a,children:[r.jsx("svg",{className:"tool-spark",width:Qy,height:If,viewBox:`0 0 ${Qy} ${If}`,"aria-hidden":!0,children:s.map((i,l)=>{const u=uY(i),d=l===Rl-1&&i>0,p=`tool-spark-bar${i>0?" active":""}${d?" latest":""}`;return r.jsx("rect",{x:l*o+.4,y:If-u,width:Math.max(.5,o-1),height:u,rx:.8,className:p},d?`landed:${i}`:l)})}),r.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function DY({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 RN="agent-dag.single-key-shortcuts";function oD(e){return e!=="0"}function iD(e){return e.length===1}function FY(e,t){return!t&&iD(e)}function En(e,t,n){return n?`${e} (${t})`:e}let ni=null;const ku=new Set;function lD(){for(const e of ku)e()}function O1(){return ni===null&&(ni=oD(nt(RN))),ni}function BY(e){ni!==e&&(ni=e,st(RN,e?"1":"0"),lD())}function ET(e){if(e.key!==RN)return;const t=oD(e.newValue);t!==ni&&(ni=t,lD())}function qY(e){var t;return ku.add(e),ku.size===1&&typeof window<"u"&&((t=window.addEventListener)==null||t.call(window,"storage",ET)),()=>{var n;ku.delete(e),ku.size===0&&typeof window<"u"&&((n=window.removeEventListener)==null||n.call(window,"storage",ET))}}function cp(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const TT=99;function UY(e){const t=Math.max(0,Math.floor(e));return t>TT?`${TT}+`:String(t)}const WY="Pause the canvas";function HY(e){const t=e.singleKeys??!0;if(!e.paused)return En("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?En(`The pause is full — ${cp(e.held)} held and ${n} older ${n===1?"one":"ones"} already dropped. Resume to follow the canvas again`,"Space",t):e.held<=0?En("Nothing has arrived since you paused. Resume to follow the canvas again","Space",t):En(`${cp(e.held)} arrived while paused and will be applied in order when you resume`,"Space",t)}function zY(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 cD="paused · full",VY=(e,t)=>t>0?cD:e>0?`paused · ${UY(e)}`:"paused";function GY(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:VY(e.held,t),widest:cD,title:En(t>0?`Connected — the pause is full at ${cp(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up`:e.held>0?`Connected — ${cp(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(qY,O1,O1)}const KY=e=>e.transform[2]>=e.maxZoom,YY=e=>e.transform[2]<=e.minZoom;function XY({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:s,togglePause:a,handleRelayout:o,requestClear:i,setKeyHelpOpen:l}){const u=Ql(),d=ft(KY),f=ft(YY),p=An();return r.jsxs(T9,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[r.jsx(fs,{onClick:()=>{d||u.zoomIn()},title:"Zoom in","aria-label":"Zoom in","aria-disabled":d||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(fs,{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(fs,{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(fs,{"data-group-start":"",onClick:a,title:HY({paused:n,held:s.size,dropped:s.dropped,singleKeys:p}),"aria-label":WY,"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(fs,{onClick:o,title:En("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(fs,{"data-group-start":"","data-danger":"",onClick:()=>i("button"),title:En("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(fs,{"data-group-start":"",onClick:()=>l(m=>!m),title:p?En("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 ZY="modulepreload",JY=function(e){return"/"+e},AT={},gi=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let i=function(d){return Promise.all(d.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(d=>{if(d=JY(d),d in AT)return;AT[d]=!0;const f=d.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":ZY,f||(m.as="script"),m.crossOrigin="",m.href=d,u&&m.setAttribute("nonce",u),document.head.appendChild(m),f)return new Promise((w,x)=>{m.addEventListener("load",w),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${d}`)))})}))}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)})},RT="agent-dag.fm-custom-stations",MT="agent-dag.fm-muted",P1="custom:",QY=/^UC[A-Za-z0-9_-]{22}$/,eX=/^[A-Za-z0-9_-]{11}$/,uD=/^[A-Za-z0-9_-]{1,80}$/,tX=/\.(mp3|aac|ogg)$/i,nX=/\.m3u8$/i,sX=2048,dD=80;function Gl(e){return`${P1}${e}`}function um(e){if(!e.startsWith(P1))return null;const t=e.slice(P1.length);return uD.test(t)?t:null}function $T(e){return um(e)??e}function MN(e){var i,l;const t=e.trim();if(t.length>sX)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&&QY.test(u))return{kind:"youtube-channel",url:s,channel:u};const d=(l=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:l[1];if(d&&/^[A-Za-z0-9._-]{1,64}$/.test(d))return{kind:"youtube-handle",url:s,handle:d};if(n.pathname==="/watch"){const f=n.searchParams.get("v")??"";if(eX.test(f))return{kind:"youtube-video",url:s,video:f}}return null}return nX.test(n.pathname)?{kind:"direct-audio",url:s,format:"hls"}:tX.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 rX(e){return e==="1"}function aX(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=MN(l);if(!uD.test(o)||n.has(o)||!i||i.length>dD||!u)continue;n.add(o);const d=hD(a.radio);s.push({id:o,name:i,url:u.url,...d?{radio:d}:{}})}return s}function oX(e,t,n){const s=um(e??"");return s&&t.some(a=>a.id===s)?Gl(s):n(e)}function iX(e,t){return e===Gl(t)?"claude-fm":e}function hD(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 D1="https://www.youtube-nocookie.com";function lX(e,t,n){const s=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${D1}/embed/${n?encodeURIComponent(n):"live_stream"}?${s.toString()}`}function ol(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function cX(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const uX=[1],dX=[0,2],hX=[2,5,100,101,150,153];function fX(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:uX.includes(a)?{kind:"playing",playing:!0}:a===3?{kind:"buffering"}:dX.includes(a)?{kind:"playing",playing:!1}:null}return null}const iu=new Set;let LT="";function IT(e){const t=new Date().toISOString().slice(0,10);if(t!==LT&&(iu.clear(),LT=t),!iu.has(e)){iu.add(e);try{const n=typeof navigator>"u"?void 0:navigator;(!n||typeof n.sendBeacon!="function"||!n.sendBeacon("/api/feature",JSON.stringify({name:e})))&&iu.delete(e)}catch{iu.delete(e)}}}const OT=864e5,pX=6e4;function cn(e,t=!0){g.useEffect(()=>{if(!t)return;IT(e);let n;const s=()=>{n=setTimeout(()=>{IT(e),s()},OT-Date.now()%OT+pX)};return s(),()=>clearTimeout(n)},[e,t])}const mX={"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 gX({fetchImpl:e,enabled:t=!0,volume:n,muted:s,source:a,playRequest:o,customStation:i,onAvailabilityChange:l}){var B;const[u,d]=g.useState(null),[f,p]=g.useState(!1),[m,w]=g.useState(!1),[x,b]=g.useState(!1),[j,k]=g.useState(!1);cn("claude-fm",x);const v=g.useRef(o),S=g.useRef(null),C=g.useRef(null),_=g.useRef(void 0),R=g.useRef(null),A=g.useCallback(()=>{var P;clearTimeout(_.current),(P=C.current)==null||P.destroy(),C.current=null;const T=S.current;T&&(T.pause(),T.removeAttribute("src"),T.load(),S.current=null)},[]),I=g.useCallback(T=>{var P,q;(q=(P=R.current)==null?void 0:P.contentWindow)==null||q.postMessage(T,D1)},[]),$=g.useRef(n);$.current=n;const U=g.useRef(s);U.current=s;const F=g.useCallback((T,P,q)=>{A();const K=new Audio;K.preload="none",K.volume=$.current/100,K.muted=U.current,S.current=K,w(!0),b(!1),k(!1);let z=!1;const H=()=>S.current===K,D=()=>{clearTimeout(_.current),A(),w(!1),b(!1),k(!1)},O=()=>{H()&&(D(),p(!0),l==null||l(q,!0))},V=W=>{if(H()&&!(W instanceof DOMException&&W.name==="AbortError")){if(W instanceof DOMException&&W.name==="NotAllowedError"){D();return}O()}};_.current=setTimeout(()=>{H()&&!z&&O()},15e3),K.addEventListener("playing",()=>{H()&&(clearTimeout(_.current),z=!0,b(!0),k(!1),l==null||l(q,!1))});const Z=()=>{H()&&(b(!1),k(z),clearTimeout(_.current),_.current=setTimeout(()=>{H()&&O()},15e3))};K.addEventListener("waiting",Z),K.addEventListener("stalled",Z),K.addEventListener("ended",()=>{H()&&D()}),K.addEventListener("error",O,{once:!0}),P&&!K.canPlayType("application/vnd.apple.mpegurl")?gi(async()=>{const{default:W}=await import("./hls-BFpXDghs.js");return{default:W}},[]).then(({default:W})=>{if(!H())return;if(!W.isSupported()){O();return}const X=new W;C.current=X,X.on(W.Events.ERROR,(Y,J)=>{J.fatal&&O()}),X.on(W.Events.MEDIA_ATTACHED,()=>X.loadSource(T)),X.on(W.Events.MANIFEST_PARSED,()=>{K.play().catch(V)}),X.attachMedia(K)},O):(K.src=T,K.play().catch(V))},[l,A]);g.useEffect(()=>{m&&(I(ol("setVolume",[n])),I(ol(s?"mute":"unMute")),S.current&&(S.current.volume=n/100,S.current.muted=s))},[n,s,m,I]),g.useEffect(()=>{var D;let T=!0;const P=e??fetch,q=v.current!==o;if(v.current=o,d(null),p(!1),k(!1),w(q),b(!1),A(),!t){w(!1),b(!1);return}const K=i&&Gl(i.id)===a?MN(i.url):null;if(K){if(K.kind==="direct-audio"){const O=K.format==="hls"||((D=i==null?void 0:i.radio)==null?void 0:D.hls)===!0;return d({live:!0,channel:"",audio:K.url,hls:O}),l==null||l(a,!1),q&&F(K.url,O,a),()=>{T=!1}}return P(`/api/fm-station?url=${encodeURIComponent(K.url)}`).then(O=>O.ok?O.json():null).then(O=>{T&&(O!=null&&O.channel||O!=null&&O.video?(d({live:!0,channel:O.channel??"",video:O.video??void 0}),l==null||l(a,!1)):(p(!0),w(!1),b(!1),k(!1),l==null||l(a,!0)))}).catch(()=>{T&&(p(!0),w(!1),b(!1),k(!1),l==null||l(a,!0))}),()=>{T=!1}}if(um(a))return p(!0),l==null||l(a,!0),()=>{T=!1};const z=a,H=mX[z];if(H)P(H).then(O=>O.ok?O.json():null).then(O=>{T&&(O!=null&&O.video&&d({live:!0,channel:"",video:O.video}),O!=null&&O.video||(p(!0),w(!1),b(!1)),l==null||l(a,!(O!=null&&O.video)))}).catch(()=>{T&&(p(!0),w(!1),b(!1),l==null||l(a,!0))});else if(z!=="claude-fm"){const O=z.replace("lofi-","");P(`/api/lofi-girl?station=${encodeURIComponent(O)}`).then(V=>V.ok?V.json():null).then(V=>{T&&(V!=null&&V.video&&d({live:!0,channel:"",video:V.video}),V!=null&&V.video||(p(!0),w(!1),b(!1)),l==null||l(a,!(V!=null&&V.video)))}).catch(()=>{T&&(p(!0),w(!1),b(!1),l==null||l(a,!0))})}else P("/api/claude-fm").then(O=>O.ok?O.json():null).then(O=>{if(!T)return;const V=!!(O!=null&&O.live&&(O!=null&&O.channel));V&&d({live:!0,channel:O.channel}),V||(p(!0),w(!1),b(!1)),l==null||l(a,!V)}).catch(()=>{T&&(p(!0),w(!1),b(!1),l==null||l(a,!0))});return()=>{T=!1}},[i==null?void 0:i.id,i==null?void 0:i.url,(B=i==null?void 0:i.radio)==null?void 0:B.hls,t,e,l,o,a,F,A]),g.useEffect(()=>()=>A(),[A]),g.useEffect(()=>{if(!m||u!=null&&u.audio)return;let T;const P=()=>{clearTimeout(T),T=void 0,w(!1),b(!1),k(!1),p(!0),l==null||l(a,!0)},q=()=>{T??(T=setTimeout(P,15e3))};q();const K=z=>{var D;if(z.origin!==D1||z.source!==((D=R.current)==null?void 0:D.contentWindow))return;const H=fX(z.data);if(H){if(H.kind==="ready"){I(ol("setVolume",[$.current])),I(ol(U.current?"mute":"unMute")),I(ol("playVideo"));return}if(H.kind==="blocked"){clearTimeout(T),T=void 0,w(!1),b(!1),k(!1);return}if(H.kind==="buffering"){b(!1),k(!0),q();return}if(H.kind==="playing"){clearTimeout(T),T=void 0,b(H.playing),k(!1),H.playing||w(!1);return}hX.includes(H.code)&&P()}};return window.addEventListener("message",K),()=>{clearTimeout(T),window.removeEventListener("message",K)}},[m,u==null?void 0:u.audio,o,l,I,a]);const M=g.useCallback(()=>{if(u){if(u.audio){if(m){A(),w(!1),b(!1),k(!1);return}F(u.audio,u.hls===!0,a);return}if(!m){w(!0),b(!1),k(!1);return}I(ol("pauseVideo")),w(!1),b(!1),k(!1)}},[u,m,x,a,I,F,A]);return g.useMemo(()=>({probe:u,dead:f,armed:m,playing:x,buffering:j,frame:R,say:I,press:M}),[u,f,m,x,j,I,M])}const PT="agent-dag.radio-favorites",DT="agent-dag.radio-recent",FT="agent-dag.radio-catalogue";function yX(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"?MN(s.url):null,l=hD(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 BT(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 wX(e,t){return[t,...e.filter(n=>n!==t)].slice(0,50)}function hje(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 fje(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 fD(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 pje(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 mje(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 xX(){const[e,t]=g.useState(()=>BT(nt(PT))),[n,s]=g.useState(()=>BT(nt(DT))),[a,o]=g.useState(()=>{try{return yX(JSON.parse(nt(FT)??"[]"))}catch{return[]}});g.useEffect(()=>{st(PT,JSON.stringify(e))},[e]),g.useEffect(()=>{st(DT,JSON.stringify(n))},[n]);const i=g.useCallback(d=>s(f=>wX(f,d)),[]),l=g.useCallback(d=>t(f=>f.includes(d)?f.filter(p=>p!==d):[...f,d].slice(-100)),[]),u=g.useCallback(d=>{o(d),st(FT,JSON.stringify(d))},[]);return{favorites:e,recent:n,catalogue:a,remember:i,toggleFavorite:l,updateCatalogue:u}}function vX(e,t,n,s){const a=fD(e,t,n);if(!a)return()=>{};const o=setTimeout(()=>{n.add(t),s(a)},1e3);return()=>clearTimeout(o)}const dm=148,qT=6e3,bX=16e3,pD=46,Xa=34;function kX(e,t,n=dm){let s=-Math.round(t()*n);if(Math.abs(s-e)<Xa){const a=e-Xa>=-n?-Xa:Xa;s=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:s,ms:Math.round(Math.abs(s-e)*pD)}}function jX(e){return Math.round(qT+e()*(bX-qT))}const UT=[{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 NX(e){const t=UT.reduce((s,a)=>s+a.weight,0);let n=e()*t;for(const s of UT)if(n-=s.weight,n<0)return s.kind;return"stroll"}const SX=720,CX=260,_X=620,EX=220,WT=520,mD=1600,HT=7e3,TX=15e3,zT=6e3,AX=14e3;function il(e,t,n=dm){let s=-Math.round(t()*n);if(Math.abs(s-e)<Xa){const a=e-Xa>=-n?-Xa:Xa;s=Math.max(-n,Math.min(0,Math.round(e+a)))}return s}const tn=(e,t)=>Math.round(Math.abs(t-e)*pD),RX=120,of=0;function MX(e,t){const n=s=>({kind:"litter",at:t,...s});return[{x:t,prop:n({}),act:"walk",ms:tn(e,t)},{x:t,prop:n({}),act:"stoop",ms:SX},{x:of,prop:n({held:!0}),act:"carry",ms:tn(t,of)},{x:of,prop:n({held:!0}),act:"windup",ms:CX},{x:of,prop:n({held:!0,leaving:!0}),act:"toss",ms:_X}]}function $X(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:tn(e,s)},{x:s,prop:a(),act:"windup",ms:EX,facing:n>0?"right":"left"},{x:s,prop:a({leaving:!0}),act:"kick",ms:WT,facing:n>0?"right":"left"},{x:s,prop:a({leaving:!0}),act:"stand",ms:mD-WT}]}const gD=640;function LX(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:tn(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:tn(s,0)}]}function IX(e,t,n){const s=Math.max(-110,Math.min(-30,t)),a={x:s,prop:null};return[{...a,act:"walk",ms:tn(e,s)},{...a,act:"skip-ready",ms:500},{...a,act:"skip",ms:gD*(6+Math.floor(n()*5))},{...a,act:"skip-rest",ms:600},{...a,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:tn(s,0)}]}function OX(e,t,n){return[{x:t,prop:null,act:"walk",ms:tn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(zT+n()*(AX-zT))},{x:t,prop:null,act:"stand",ms:400}]}function PX(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:tn(e,t)},{x:t,prop:s(),act:"watch",ms:Math.round(HT+n()*(TX-HT))},{x:t,prop:s(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function tw(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 DX=1500,FX=e=>Math.round(1e3*Math.sqrt(2*e/DX)),BX=115,qX=e=>Math.round(e/BX*1e3),UX=620,WX=200,HX=760,zX=600,VX=240;function GX(e,t,n){const a=-(t.ledgeSpan??dm),o=FX(t.ledgeH),i=qX(t.ledgeH),l=n(),u=n(),d=-Math.round(l*t.floorSpan),f=-Math.round(u*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:tn(e,a)},{x:a,act:"peer",prop:null,ms:UX},{x:a,act:"fall",prop:null,ms:o,place:"floor"},{x:a,act:"land",prop:null,ms:WX,place:"floor"},{x:d,act:"walk",prop:null,ms:tn(a,d),place:"floor",floorFrac:l},{x:f,act:"walk",prop:null,ms:tn(d,f),place:"floor",floorFrac:u},{x:a,act:"walk",prop:null,ms:tn(f,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:HX,place:"floor"},{x:a,act:"rope-throw",prop:null,ms:zX,place:"floor"},{x:a,act:"rope-catch",prop:null,ms:VX,place:"floor"},{x:a,act:"climb",prop:null,ms:i},{x:a,act:"pull-up",prop:null,ms:480}]}function KX(e,t,n){const s=(n==null?void 0:n.ledgeSpan)??dm;switch(NX(t)){case"tidy":return MX(e,il(e,t,s));case"kick":return $X(e,il(e,t,s));case"sit":return OX(e,il(e,t,s),t);case"watch":return PX(e,il(e,t,s),t);case"fish":return LX(e,il(e,t,s),t);case"skip":return IX(e,il(e,t,s),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return GX(e,n,t)}}const o=kX(e,t,s);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const YX=420;function XX(e,t,n){const s=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(YX,Math.max(0,s))}const ZX=260,JX=200;function QX(e,t,n){const s=(f,p=tn(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,d={place:"floor",riser:n.height,prop:null};return[s(l,tn(e,l)),{...d,x:l,act:"mount",ms:ZX},{...d,x:u,act:"walk",ms:tn(l,u)},{x:u,prop:null,act:"dismount",ms:JX,place:"floor"},{x:t,prop:null,act:"walk",ms:tn(u,t),place:"floor"}]}const yD=["bob","sway","groove"],VT=9e3,eZ=16e3,wD=1e3,tZ=.08;function nZ(e,t){const n=yD.filter(o=>o!==e),s=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*tZ;return{dance:s,beatMs:Math.round(wD*(1+a))}}function sZ(e){return Math.round(VT+e()*(eZ-VT))}const $N=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],GT=18,rZ=$N.length,xD="M6 9H4V1H5V0H7V-1H9V1H7V2H5V7H6V8H7V9Z",vD="M12 9H14V6H13V3H11V2H9V4H12Z",LN=new Set(["a","c","p"]);function lo(e=$N){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 aZ=[".xx.","xxxx",".xx."],oZ=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],iZ=["...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."],nw={litter:aZ,ball:oZ,scope:iZ},lZ=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],cZ=3,uZ=-1,F1=11,KT=9;function YT(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 d=n;n=null,d==null||d()},s))},u=()=>{e.hidden&&t!==null?(s=Math.max(0,s-(performance.now()-a)),i()):e.hidden||l()};return e.addEventListener("visibilitychange",u),{schedule(d,f){o||(i(),n=d,s=Math.max(0,f),l())},dispose(){o=!0,i(),n=null,e.removeEventListener("visibilitychange",u)}}}function dZ(e,t,n){const[s,a]=g.useState(0),[o,i]=g.useState(0),[l,u]=g.useState(null),[d,f]=g.useState(null),[p,m]=g.useState({x:0,drop:0}),[w,x]=g.useState("ledge"),[b,j]=g.useState("left"),[k,v]=g.useState(0),S=g.useRef(null),[C,_]=g.useState(()=>document.hidden);g.useEffect(()=>{const M=new Set,B=()=>{var T;if(document.hidden){for(const P of((T=S.current)==null?void 0:T.getAnimations({subtree:!0}))??[])if(P.playState==="running"||P.pending){const q=P.currentTime;P.pause(),q!==null&&(P.currentTime=q),M.add(P)}}else{for(const P of M)P.playState==="paused"&&P.play();M.clear()}_(document.hidden)};return B(),document.addEventListener("visibilitychange",B),()=>document.removeEventListener("visibilitychange",B)},[e,t]);const[R,A]=g.useState(null),[I,$]=g.useState(wD),[U,F]=g.useState(()=>{var M;return((M=window.matchMedia)==null?void 0:M.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return g.useEffect(()=>{var T;const M=(T=window.matchMedia)==null?void 0:T.call(window,"(prefers-reduced-motion: reduce)");if(!M)return;const B=()=>F(M.matches);return B(),M.addEventListener("change",B),()=>M.removeEventListener("change",B)},[]),g.useEffect(()=>{var J;if(!e||t||U)return;const M=YT(document);let B=0;a(Q=>B=Q);let T=null,P=0,q=0;const K=Q=>{var re,he;const[te,...le]=Q;if(!te){T=null,u(null),f(null),W();return}u(te.act),f(te.prop),x(te.place??"ledge"),v(te.riser??0);const de=B,oe=V(te);if(te.act==="kick"){const fe=(he=(re=S.current)==null?void 0:re.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:he.getBoundingClientRect();fe&&m({x:XX(fe.x,tw(te,de,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-fe.y+24)})}q=te.act==="walk"?Math.max(tn(de,oe),RX):te.ms,te.act==="carry"&&(q=tn(de,oe)),i(q),j(fe=>tw({...te,x:oe},de,fe)),a(oe),B=oe,T=te,P=Date.now(),M.schedule(()=>K(le),q)},z=()=>{const Q=S.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=S.current,te=Q==null?void 0:Q.querySelector(".fm-sprite");return!Q||!te?0:Math.max(0,Q.getBoundingClientRect().width-te.offsetWidth)},D=()=>{const Q=S.current,te=Q==null?void 0:Q.querySelector(".fm-walker"),le=z();if(!Q||!te||le==null)return;const de=Q.getBoundingClientRect().bottom-te.getBoundingClientRect().bottom;if(de>0)return{ledgeH:de,floorSpan:le,ledgeSpan:H()}},O=()=>{const Q=S.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}},V=Q=>{const te=(Q.place??"ledge")==="floor",le=te?z()??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=V(T);Q!==B&&(i(Math.max(0,P+q-Date.now())),j(te=>tw({...T,x:Q},B,te)),a(Q),B=Q)},W=()=>{M.schedule(()=>{const Q=KX(B,Math.random,D()),te=Q.some(oe=>oe.place==="floor")?O():null;let le=B;const de=Q.flatMap(oe=>{const re=le;if(le=oe.x,!(oe.place==="floor"&&oe.act==="walk"))return[oe];const he=QX(re,oe.x,te),fe=he.length-1;return oe.floorFrac==null?he:he.map(($e,ye)=>ye===fe?{...$e,floorFrac:oe.floorFrac}:$e)});K(de)},jX(Math.random))},X=(J=S.current)==null?void 0:J.parentElement,Y=typeof ResizeObserver>"u"?null:new ResizeObserver(Z);return X&&Y&&Y.observe(X),W(),()=>{M.dispose(),Y==null||Y.disconnect(),x("ledge"),a(Q=>Math.max(-H(),Math.min(0,Q))),i(0),u(null),f(null),v(0)}},[e,t,U]),g.useEffect(()=>{if(!n||U){A(null);return}const M=YT(document),B=T=>{const P=nZ(T,Math.random);A(P.dance),$(P.beatMs),M.schedule(()=>B(P.dance),sZ(Math.random))};return B(null),()=>M.dispose()},[n,U]),{scene:S,suspended:C,x:s,walkMs:o,act:l,prop:d,ballFlight:p,place:w,facing:b,riser:k,dance:R,beatMs:I}}const sw={e:"fm-eye",s:"fm-shade",p:"fm-pad"},up=lo().filter(e=>!LN.has(e.cell)),hZ=lo().filter(e=>LN.has(e.cell)),XT=up.filter(e=>e.cell==="e"),fZ=lo(lZ),pZ=up.filter(e=>e.y<F1&&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),mZ={left:up.filter(e=>e.y>=F1&&e.x<KT),right:up.filter(e=>e.y>=F1&&e.x>=KT)},gZ=g.memo(function({act:t,facing:n}){return r.jsxs("svg",{viewBox:`0 0 ${GT} ${rZ}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:hZ.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:sw[s.cell]},`g${s.y}-${s.x}`))})}),r.jsxs("g",{className:"fm-body",children:[XT.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,fill:"var(--accent)"},`eye-bed-${s.x}`)),pZ.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:sw[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"})]}),XT.map(s=>r.jsx("rect",{x:s.x-(s.x>=GT/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:fZ.map(s=>r.jsx("rect",{x:cZ+s.x,y:uZ+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:xD}),r.jsx("path",{className:"fm-grip-right",d:vD})]}),(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:mZ[s].map(a=>r.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:sw[a.cell]},`${s}${a.y}-${a.x}`))},s))]})}),yZ=["...o........o.....","...of......fo.....","...owffffffwo.....","...offfffffso.....","...ofefffefso.....","....owwnwwso......",".....wwwww........",".....fwwwfs.......","....ffwwwffs...ww.","....ffwwwffs..wfs.","......fwwfssfffs..","......ff..fsffs...","......ff..fs......","......oo..oo......"],wZ=[".....aaaaaaa......","...aa.......aa....","..a...........a...","..cp.........pc...","..cp.........pc...","..cp.........pc...","..c...........c..."],dr={f:"#d88735",s:"#a55b24",o:"#63351e",w:"#ffe2aa",n:"#372821"},xZ={p:"fm-pad"},td=lo(yZ),vZ=lo(wZ);function B1(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 bZ=B1(td.filter(e=>e.y>=8),12,18),kZ=td.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),ZT=td.filter(e=>e.cell==="e"),jZ={left:B1(td.filter(e=>e.y>=11),0,9),right:B1(td.filter(e=>e.y>=11),9,12)},NZ=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:bZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:dr[i.cell]},`t${i.y}-${i.x}`))}),r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:vZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,className:xZ[i.cell]},`g${i.y}-${i.x}`))})}),r.jsxs("g",{className:"fm-body",children:[kZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:dr[i.cell]},`b${i.y}-${i.x}`)),ZT.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:dr.f},`bed${i.x}`)),r.jsxs("g",{className:"fm-arms",fill:dr.f,children:[r.jsx("rect",{x:4,y:8,width:2,height:2}),r.jsx("rect",{x:12,y:8,width:1,height:2})]}),ZT.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:dr.n}},`e${i.x}`))]}),s&&r.jsxs("g",{className:"fm-grip",style:{fill:dr.f},children:[r.jsx("path",{className:"fm-grip-left",d:xD}),r.jsx("path",{className:"fm-grip-right",d:vD})]}),a&&r.jsxs("g",{className:"fm-crouch-legs",style:{fill:dr.f},children:[r.jsx("path",{d:"M6 11H8V13H6Z"}),r.jsx("path",{d:"M10 11H12V13H10Z"})]}),o&&r.jsxs("g",{className:"fm-seated-legs",style:{fill:dr.f},children:[r.jsx("path",{className:"fm-seated-far",style:{fill:dr.s},d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),r.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(i=>r.jsx("g",{className:"fm-leg","data-side":i,children:jZ[i].map(l=>r.jsx("rect",{x:l.x,y:l.y,width:l.w,height:1,fill:dr[l.cell]},`${l.y}-${l.x}`))},i))]})}),SZ=[".......dddd.......","......dhhhhd......",".....dhhhhhhd.....","....dhwwhhwwhd....","....dhwewwewhd....","....dhwwbbwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....",".....dhwwwwhd.....",".....dhwwwwhd.....","......dhhhhd......","......bb..bb......",".....bbb..bbb....."],Xr={d:"#3b4855",h:"#657b8b",w:"#f4f0df",e:"#19242b",b:"#f0b44b",s:"#c88736"},CZ={p:"fm-pad"},dp=lo(SZ),_Z=lo($N).filter(e=>LN.has(e.cell)),JT=dp.filter(e=>e.cell==="e"),EZ=dp.filter(e=>e.y<12&&e.cell!=="e"),TZ={left:dp.filter(e=>e.y>=12&&e.x<9),right:dp.filter(e=>e.y>=12&&e.x>=9)},AZ=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:_Z.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:CZ[o.cell]},`g${o.y}-${o.x}`))})}),r.jsxs("g",{className:"fm-body",children:[EZ.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Xr[o.cell]},`b${o.y}-${o.x}`)),JT.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Xr.w},`bed${o.x}`)),r.jsxs("g",{className:"fm-arms",fill:Xr.d,children:[r.jsx("path",{d:"M4 8H6V10H5V11H4Z"}),r.jsx("path",{d:"M12 8H14V11H13V10H12Z"})]}),JT.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:"fm-eye",style:{fill:Xr.e}},`e${o.x}`))]}),n&&r.jsxs("g",{className:"fm-grip",style:{fill:Xr.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:Xr.b},children:[r.jsx("path",{d:"M5 12H8V13H5Z"}),r.jsx("path",{d:"M10 12H13V13H10Z"})]}),a&&r.jsxs("g",{className:"fm-seated-legs",style:{fill:Xr.b},children:[r.jsx("path",{className:"fm-seated-far",style:{fill:Xr.s},d:"M10 11H12V12H13V14H10V13H11V12H10Z"}),r.jsx("path",{d:"M6 11H8V12H7V13H8V14H4V13H5V12H6Z"})]}),["left","right"].map(o=>r.jsx("g",{className:"fm-leg","data-side":o,children:TZ[o].map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:Xr.b},`${i.y}-${i.x}`))},o))]})});function bD({character:e,act:t,facing:n}){return e==="penguin"?r.jsx(AZ,{act:t,facing:n}):e==="fox"?r.jsx(NZ,{act:t,facing:n}):r.jsx(gZ,{act:t,facing:n})}const RZ={"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 kD(e,t){return t&&Gl(t.id)===e?t.name:um(e)?"Custom FM":RZ[e]}function rw(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:lo(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 QT={litter:rw(nw.litter,"litter"),ball:rw(nw.ball,"ball"),scope:rw(nw.scope,"scope")};function MZ(e){try{return new URL(e).host}catch{return"the station's server"}}const $Z=g.memo(function({player:t,source:n,customStation:s,character:a="deck"}){const{probe:o,dead:i,playing:l,press:u}=t,{scene:d,suspended:f,x:p,walkMs:m,act:w,prop:x,ballFlight:b,place:j,facing:k,riser:v,dance:S,beatMs:C}=dZ(o,i,l);if(!o||i)return null;const _=kD(n,s),R=o.audio?MZ(o.audio):"YouTube";return r.jsxs("div",{ref:d,className:"fm","data-suspended":f?"":void 0,"data-place":j,style:{"--fm-beat":`${C}ms`},children:[x&&!x.held&&r.jsx("div",{className:"fm-prop","data-prop":x.kind,"data-leaving":x.leaving?"":void 0,style:{"--fm-prop-x":`${x.at}px`,"--fm-roll-to":`${b.x}px`,"--fm-ball-drop":`${b.drop}px`,"--fm-ball-flight-ms":`${mD}ms`,"--fm-ball-turn":k==="right"?"1080deg":"-1080deg"},children:QT[x.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":j,"data-facing":k,style:{"--fm-x":`${p}px`,"--fm-walk-ms":`${m}ms`,"--fm-riser":`${v}px`,"--fm-skip-beat":`${gD}ms`},children:[(x==null?void 0:x.held)&&r.jsx("div",{className:"fm-held","data-prop":x.kind,"data-toss":x.leaving?"":void 0,children:QT[x.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?S??yD[0]:void 0,onClick:u,title:l?`Stop ${_}`:`Play ${_} — streams from ${R}`,"aria-label":l?`Stop ${_}`:`Play ${_}`,children:r.jsx(bD,{character:a,act:w,facing:k})})]})]})});function LZ({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:lX(n.channel,window.location.origin,n.video),onLoad:()=>o(cX()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})}):null}const IZ={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 OZ({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:IZ[e]})})}function PZ({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 DZ({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:JG,children:[r.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close radio",onClick:e,children:r.jsx(OZ,{name:"close"})}),r.jsx(PZ,{opening:!0})]})}const FZ=g.lazy(()=>gi(()=>import("./RadioPanel-BXbw3TO5.js"),[]));function BZ({fm:e,characterEnabled:t,character:n,open:s,onClose:a}){const[o,i]=g.useState(!1),[l,u]=g.useState("Connecting to the deck…"),d=xX(),[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(I=>I.ok?I.json():null).then(I=>{A.signal.aborted||(i((I==null?void 0:I.enabled)===!0),u(I?"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=>Gl(A.id)===e.fmSource),x=w!=null&&w.radio?w:void 0,b=gX({volume:e.fmVolume,muted:e.fmMuted,source:e.fmSource,playRequest:e.fmPlayRequest,customStation:w,enabled:o,onAvailabilityChange:e.markFmStationAvailability}),j=kD(e.fmSource,w),k=o&&x&&b.dead&&e.fmPlayRequest>0?fD(f??d.catalogue,x.id,m.current):null,{remember:v}=d,S=(w==null?void 0:w.id)??e.fmSource;g.useEffect(()=>{b.playing&&v(S)},[S,b.playing,v]);const C=a,_=wt(a),R=g.useCallback((A,I=!1)=>{var M;if(!o)return;I||m.current.clear();const $=Gl(A.id),U=$===e.fmSource;if(U&&b.armed&&!b.dead){b.press();return}const F=U&&!!w&&(w.url!==A.url||((M=w.radio)==null?void 0:M.hls)!==A.radio.hls);e.addFmStation(A,!0),U&&!b.dead&&!F?b.press():e.pickFmSource($,F),fetch(`/api/radio-click?id=${encodeURIComponent(A.id)}`).catch(()=>{})},[o,w,e.addFmStation,e.fmSource,e.pickFmSource,b.armed,b.dead,b.press]);return g.useEffect(()=>{b.playing&&!b.dead&&m.current.clear()},[b.playing,b.dead]),g.useEffect(()=>{if(!(!o||!x||!b.dead||e.fmPlayRequest===0))return vX(f??d.catalogue,x.id,m.current,A=>R(A,!0))},[o,x==null?void 0:x.id,b.dead,e.fmPlayRequest,f,d.catalogue,R]),r.jsxs(r.Fragment,{children:[t&&r.jsx($Z,{character:n,player:b,source:e.fmSource,customStation:w}),r.jsx(LZ,{player:b,label:j}),s&&vt.createPortal(r.jsx("div",{className:"modal-backdrop radio-backdrop",..._,children:r.jsx(g.Suspense,{fallback:r.jsx(DZ,{onClose:C}),children:r.jsx(FZ,{fm:e,player:b,library:d,selected:x,label:j,enabled:o,disabledReason:l,autoNext:k==null?void 0:k.name,onPick:R,onQueueChange:p,onClose:C})})}),document.body)]})}function qZ({data:e}){const t=Sr(3e4),n=e.note,s=e.plan??null,a=(n==null?void 0:n.kind)==="recap",o=ip((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:im(n),u=Nr(s),d=n?sc(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: ${d}`,"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(ap,{recap:a}),d]}),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(),bK(e.noteKey)},children:"×"})]}),n&&r.jsx("p",{className:"recap-note-text",title:MK(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(eA,{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(ap,{recap:a}),d]}),r.jsx("span",{className:"recap-face-age",children:o.label})]}),n&&r.jsx("p",{className:"recap-face-text",children:n.text}),s&&r.jsx(eA,{plan:s,head:n!=null,face:!0})]}),r.jsx(ci,{type:"source",position:Ye.Right,style:{background:"transparent",border:"none"}})]})}const UZ={completed:"done",in_progress:"now",pending:"to do"};function eA({plan:e,head:t,face:n=!1}){const s=Nr(e);if(!s)return null;const a=vV(e.items);return r.jsxs("div",{className:n?"recap-face-plan":"recap-note-plan",title:n?void 0:Xp(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:[UZ[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 to(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function co(e){return/mac|iphone|ipad/i.test(e)}const hp=e=>new Map([...e].map(([t,n])=>[t,{x:n.x,y:n.y}]));function WZ(e,t,n){return{positions:hp(e.positions),pinned:hp(e.pinned),provisional:new Set(e.provisional),layoutSig:e.layoutSig.current,stored:{...t},viewport:n?{...n}:null}}function HZ(e,t){t.positions.clear();for(const[n,s]of hp(e.positions))t.positions.set(n,s);t.pinned.clear();for(const[n,s]of hp(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 tA=7e3,zZ=2e3,VZ=140,GZ="Layout re-arranged",KZ="Layout re-arranged. Undo available.",nA="Layout restored.",YZ={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e),now:()=>Date.now()};function XZ(e,t=YZ){let n=null,s=null,a=0,o=tA;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,d()},o))};function d(){l(),i.clear(),n!==null&&(n=null,e(!1))}return{open(f){const p=n===null;n=f,o=tA,u(),p&&e(!0)},take(){const f=n;return d(),f},close:d,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,zZ),u())},get isOpen(){return n!==null},get snapshot(){return n}}}function ZZ(e){return(e.key==="z"||e.key==="Z")&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey}function JZ(e){return co(e)?"⌘Z":"Ctrl+Z"}function QZ({undo:e}){const{open:t,said:n,undo:s,dismiss:a,hold:o,release:i}=e,l=bl(t,VZ),u=g.useRef(null);return g.useEffect(()=>t?ln.push(a,0,"popover"):void 0,[t,a]),g.useEffect(()=>{var f;if(t)return;const d=u.current;d&&d.contains(document.activeElement)&&((f=d.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}),Ya(l)&&r.jsxs("div",{ref:u,className:l==="leaving"?"rearrange-undo leaving":"rearrange-undo",onPointerEnter:()=>o("hover"),onPointerLeave:()=>i("hover"),onFocus:()=>o("focus"),onBlur:d=>{d.currentTarget.contains(d.relatedTarget)||i("focus")},children:[r.jsx("span",{id:"rearrange-undo-state",className:"rearrange-undo-state",children:GZ}),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:JZ(to())})]})]})]})}function eJ({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a,targetPosition:o,style:i}){const[l]=nN({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 q1(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function fp(e,t){const n=q1(e);return n?n.slice(-t):e.slice(-t)}function jD(e,t,n=4){const s=q1(e);if(!s)return fp(e,n);let a=n;for(const o of t){if(o===e)continue;const i=q1(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 kl=" · ",tJ=32,nJ=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function sA(e){return nJ.test(e)?2:1}function rA(e,t=tJ){const n=[...e];let s=0;for(const i of n)s+=sA(i);if(s<=t)return e;const a=[];let o=0;for(const i of n){const l=sA(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 sJ(e,t,n,s,a=[],{branch:o,plan:i,alarm:l=!1}={}){const u=(t==null?void 0:t.trim())??"",d=s?jD(n,a):void 0,f=[e,u||void 0,d].filter(Boolean),p=[e,i?`plan ${i}`:void 0,o,u||void 0,d].filter(Boolean).join(kl);return{label:rA(e),name:u?rA(u):void 0,shortId:d,fullLabel:f.join(kl),title:`${l?"waiting on you: ":""}${p}
|
|
89
|
+
Blocked for ${zl(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:sp(e)}),r.jsx("b",{children:zl(e.since,void 0,t)})]})}function PY({tools:e,outputs:t}){const n=Sr(1e3),{counts:s,title:a}=lY(e,t,n),o=Qy/Rl;return r.jsxs("div",{className:"tool-spark-row",title:a,children:[r.jsx("svg",{className:"tool-spark",width:Qy,height:If,viewBox:`0 0 ${Qy} ${If}`,"aria-hidden":!0,children:s.map((i,l)=>{const u=uY(i),d=l===Rl-1&&i>0,p=`tool-spark-bar${i>0?" active":""}${d?" latest":""}`;return r.jsx("rect",{x:l*o+.4,y:If-u,width:Math.max(.5,o-1),height:u,rx:.8,className:p},d?`landed:${i}`:l)})}),r.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function DY({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 RN="agent-dag.single-key-shortcuts";function oD(e){return e!=="0"}function iD(e){return e.length===1}function FY(e,t){return!t&&iD(e)}function En(e,t,n){return n?`${e} (${t})`:e}let ni=null;const ku=new Set;function lD(){for(const e of ku)e()}function O1(){return ni===null&&(ni=oD(nt(RN))),ni}function BY(e){ni!==e&&(ni=e,st(RN,e?"1":"0"),lD())}function ET(e){if(e.key!==RN)return;const t=oD(e.newValue);t!==ni&&(ni=t,lD())}function qY(e){var t;return ku.add(e),ku.size===1&&typeof window<"u"&&((t=window.addEventListener)==null||t.call(window,"storage",ET)),()=>{var n;ku.delete(e),ku.size===0&&typeof window<"u"&&((n=window.removeEventListener)==null||n.call(window,"storage",ET))}}function cp(e){const t=Math.max(0,Math.floor(e));return`${t} event${t===1?"":"s"}`}const TT=99;function UY(e){const t=Math.max(0,Math.floor(e));return t>TT?`${TT}+`:String(t)}const WY="Pause the canvas";function HY(e){const t=e.singleKeys??!0;if(!e.paused)return En("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?En(`The pause is full — ${cp(e.held)} held and ${n} older ${n===1?"one":"ones"} already dropped. Resume to follow the canvas again`,"Space",t):e.held<=0?En("Nothing has arrived since you paused. Resume to follow the canvas again","Space",t):En(`${cp(e.held)} arrived while paused and will be applied in order when you resume`,"Space",t)}function zY(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 cD="paused · full",VY=(e,t)=>t>0?cD:e>0?`paused · ${UY(e)}`:"paused";function GY(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:VY(e.held,t),widest:cD,title:En(t>0?`Connected — the pause is full at ${cp(e.held)}; the oldest are being dropped as new ones arrive. Resume to catch up`:e.held>0?`Connected — ${cp(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(qY,O1,O1)}const KY=e=>e.transform[2]>=e.maxZoom,YY=e=>e.transform[2]<=e.minZoom;function XY({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:s,togglePause:a,handleRelayout:o,requestClear:i,setKeyHelpOpen:l}){const u=Ql(),d=ft(KY),f=ft(YY),p=An();return r.jsxs(T9,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[r.jsx(fs,{onClick:()=>{d||u.zoomIn()},title:"Zoom in","aria-label":"Zoom in","aria-disabled":d||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(fs,{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(fs,{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(fs,{"data-group-start":"",onClick:a,title:HY({paused:n,held:s.size,dropped:s.dropped,singleKeys:p}),"aria-label":WY,"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(fs,{onClick:o,title:En("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(fs,{"data-group-start":"","data-danger":"",onClick:()=>i("button"),title:En("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(fs,{"data-group-start":"",onClick:()=>l(m=>!m),title:p?En("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 ZY="modulepreload",JY=function(e){return"/"+e},AT={},gi=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let i=function(d){return Promise.all(d.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(d=>{if(d=JY(d),d in AT)return;AT[d]=!0;const f=d.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${p}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":ZY,f||(m.as="script"),m.crossOrigin="",m.href=d,u&&m.setAttribute("nonce",u),document.head.appendChild(m),f)return new Promise((w,x)=>{m.addEventListener("load",w),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${d}`)))})}))}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)})},RT="agent-dag.fm-custom-stations",MT="agent-dag.fm-muted",P1="custom:",QY=/^UC[A-Za-z0-9_-]{22}$/,eX=/^[A-Za-z0-9_-]{11}$/,uD=/^[A-Za-z0-9_-]{1,80}$/,tX=/\.(mp3|aac|ogg)$/i,nX=/\.m3u8$/i,sX=2048,dD=80;function Gl(e){return`${P1}${e}`}function um(e){if(!e.startsWith(P1))return null;const t=e.slice(P1.length);return uD.test(t)?t:null}function $T(e){return um(e)??e}function MN(e){var i,l;const t=e.trim();if(t.length>sX)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&&QY.test(u))return{kind:"youtube-channel",url:s,channel:u};const d=(l=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:l[1];if(d&&/^[A-Za-z0-9._-]{1,64}$/.test(d))return{kind:"youtube-handle",url:s,handle:d};if(n.pathname==="/watch"){const f=n.searchParams.get("v")??"";if(eX.test(f))return{kind:"youtube-video",url:s,video:f}}return null}return nX.test(n.pathname)?{kind:"direct-audio",url:s,format:"hls"}:tX.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 rX(e){return e==="1"}function aX(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=MN(l);if(!uD.test(o)||n.has(o)||!i||i.length>dD||!u)continue;n.add(o);const d=hD(a.radio);s.push({id:o,name:i,url:u.url,...d?{radio:d}:{}})}return s}function oX(e,t,n){const s=um(e??"");return s&&t.some(a=>a.id===s)?Gl(s):n(e)}function iX(e,t){return e===Gl(t)?"claude-fm":e}function hD(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 D1="https://www.youtube-nocookie.com";function lX(e,t,n){const s=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${D1}/embed/${n?encodeURIComponent(n):"live_stream"}?${s.toString()}`}function ol(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function cX(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const uX=[1],dX=[0,2],hX=[2,5,100,101,150,153];function fX(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:uX.includes(a)?{kind:"playing",playing:!0}:a===3?{kind:"buffering"}:dX.includes(a)?{kind:"playing",playing:!1}:null}return null}const iu=new Set;let LT="";function IT(e){const t=new Date().toISOString().slice(0,10);if(t!==LT&&(iu.clear(),LT=t),!iu.has(e)){iu.add(e);try{const n=typeof navigator>"u"?void 0:navigator;(!n||typeof n.sendBeacon!="function"||!n.sendBeacon("/api/feature",JSON.stringify({name:e})))&&iu.delete(e)}catch{iu.delete(e)}}}const OT=864e5,pX=6e4;function cn(e,t=!0){g.useEffect(()=>{if(!t)return;IT(e);let n;const s=()=>{n=setTimeout(()=>{IT(e),s()},OT-Date.now()%OT+pX)};return s(),()=>clearTimeout(n)},[e,t])}const mX={"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 gX({fetchImpl:e,enabled:t=!0,volume:n,muted:s,source:a,playRequest:o,customStation:i,onAvailabilityChange:l}){var B;const[u,d]=g.useState(null),[f,p]=g.useState(!1),[m,w]=g.useState(!1),[x,b]=g.useState(!1),[j,k]=g.useState(!1);cn("claude-fm",x);const v=g.useRef(o),S=g.useRef(null),C=g.useRef(null),_=g.useRef(void 0),R=g.useRef(null),A=g.useCallback(()=>{var P;clearTimeout(_.current),(P=C.current)==null||P.destroy(),C.current=null;const T=S.current;T&&(T.pause(),T.removeAttribute("src"),T.load(),S.current=null)},[]),I=g.useCallback(T=>{var P,q;(q=(P=R.current)==null?void 0:P.contentWindow)==null||q.postMessage(T,D1)},[]),$=g.useRef(n);$.current=n;const U=g.useRef(s);U.current=s;const F=g.useCallback((T,P,q)=>{A();const K=new Audio;K.preload="none",K.volume=$.current/100,K.muted=U.current,S.current=K,w(!0),b(!1),k(!1);let z=!1;const H=()=>S.current===K,D=()=>{clearTimeout(_.current),A(),w(!1),b(!1),k(!1)},O=()=>{H()&&(D(),p(!0),l==null||l(q,!0))},V=W=>{if(H()&&!(W instanceof DOMException&&W.name==="AbortError")){if(W instanceof DOMException&&W.name==="NotAllowedError"){D();return}O()}};_.current=setTimeout(()=>{H()&&!z&&O()},15e3),K.addEventListener("playing",()=>{H()&&(clearTimeout(_.current),z=!0,b(!0),k(!1),l==null||l(q,!1))});const Z=()=>{H()&&(b(!1),k(z),clearTimeout(_.current),_.current=setTimeout(()=>{H()&&O()},15e3))};K.addEventListener("waiting",Z),K.addEventListener("stalled",Z),K.addEventListener("ended",()=>{H()&&D()}),K.addEventListener("error",O,{once:!0}),P&&!K.canPlayType("application/vnd.apple.mpegurl")?gi(async()=>{const{default:W}=await import("./hls-BFpXDghs.js");return{default:W}},[]).then(({default:W})=>{if(!H())return;if(!W.isSupported()){O();return}const X=new W;C.current=X,X.on(W.Events.ERROR,(Y,J)=>{J.fatal&&O()}),X.on(W.Events.MEDIA_ATTACHED,()=>X.loadSource(T)),X.on(W.Events.MANIFEST_PARSED,()=>{K.play().catch(V)}),X.attachMedia(K)},O):(K.src=T,K.play().catch(V))},[l,A]);g.useEffect(()=>{m&&(I(ol("setVolume",[n])),I(ol(s?"mute":"unMute")),S.current&&(S.current.volume=n/100,S.current.muted=s))},[n,s,m,I]),g.useEffect(()=>{var D;let T=!0;const P=e??fetch,q=v.current!==o;if(v.current=o,d(null),p(!1),k(!1),w(q),b(!1),A(),!t){w(!1),b(!1);return}const K=i&&Gl(i.id)===a?MN(i.url):null;if(K){if(K.kind==="direct-audio"){const O=K.format==="hls"||((D=i==null?void 0:i.radio)==null?void 0:D.hls)===!0;return d({live:!0,channel:"",audio:K.url,hls:O}),l==null||l(a,!1),q&&F(K.url,O,a),()=>{T=!1}}return P(`/api/fm-station?url=${encodeURIComponent(K.url)}`).then(O=>O.ok?O.json():null).then(O=>{T&&(O!=null&&O.channel||O!=null&&O.video?(d({live:!0,channel:O.channel??"",video:O.video??void 0}),l==null||l(a,!1)):(p(!0),w(!1),b(!1),k(!1),l==null||l(a,!0)))}).catch(()=>{T&&(p(!0),w(!1),b(!1),k(!1),l==null||l(a,!0))}),()=>{T=!1}}if(um(a))return p(!0),l==null||l(a,!0),()=>{T=!1};const z=a,H=mX[z];if(H)P(H).then(O=>O.ok?O.json():null).then(O=>{T&&(O!=null&&O.video&&d({live:!0,channel:"",video:O.video}),O!=null&&O.video||(p(!0),w(!1),b(!1)),l==null||l(a,!(O!=null&&O.video)))}).catch(()=>{T&&(p(!0),w(!1),b(!1),l==null||l(a,!0))});else if(z!=="claude-fm"){const O=z.replace("lofi-","");P(`/api/lofi-girl?station=${encodeURIComponent(O)}`).then(V=>V.ok?V.json():null).then(V=>{T&&(V!=null&&V.video&&d({live:!0,channel:"",video:V.video}),V!=null&&V.video||(p(!0),w(!1),b(!1)),l==null||l(a,!(V!=null&&V.video)))}).catch(()=>{T&&(p(!0),w(!1),b(!1),l==null||l(a,!0))})}else P("/api/claude-fm").then(O=>O.ok?O.json():null).then(O=>{if(!T)return;const V=!!(O!=null&&O.live&&(O!=null&&O.channel));V&&d({live:!0,channel:O.channel}),V||(p(!0),w(!1),b(!1)),l==null||l(a,!V)}).catch(()=>{T&&(p(!0),w(!1),b(!1),l==null||l(a,!0))});return()=>{T=!1}},[i==null?void 0:i.id,i==null?void 0:i.url,(B=i==null?void 0:i.radio)==null?void 0:B.hls,t,e,l,o,a,F,A]),g.useEffect(()=>()=>A(),[A]),g.useEffect(()=>{if(!m||u!=null&&u.audio)return;let T;const P=()=>{clearTimeout(T),T=void 0,w(!1),b(!1),k(!1),p(!0),l==null||l(a,!0)},q=()=>{T??(T=setTimeout(P,15e3))};q();const K=z=>{var D;if(z.origin!==D1||z.source!==((D=R.current)==null?void 0:D.contentWindow))return;const H=fX(z.data);if(H){if(H.kind==="ready"){I(ol("setVolume",[$.current])),I(ol(U.current?"mute":"unMute")),I(ol("playVideo"));return}if(H.kind==="blocked"){clearTimeout(T),T=void 0,w(!1),b(!1),k(!1);return}if(H.kind==="buffering"){b(!1),k(!0),q();return}if(H.kind==="playing"){clearTimeout(T),T=void 0,b(H.playing),k(!1),H.playing||w(!1);return}hX.includes(H.code)&&P()}};return window.addEventListener("message",K),()=>{clearTimeout(T),window.removeEventListener("message",K)}},[m,u==null?void 0:u.audio,o,l,I,a]);const M=g.useCallback(()=>{if(u){if(u.audio){if(m){A(),w(!1),b(!1),k(!1);return}F(u.audio,u.hls===!0,a);return}if(!m){w(!0),b(!1),k(!1);return}I(ol("pauseVideo")),w(!1),b(!1),k(!1)}},[u,m,x,a,I,F,A]);return g.useMemo(()=>({probe:u,dead:f,armed:m,playing:x,buffering:j,frame:R,say:I,press:M}),[u,f,m,x,j,I,M])}const PT="agent-dag.radio-favorites",DT="agent-dag.radio-recent",FT="agent-dag.radio-catalogue";function yX(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"?MN(s.url):null,l=hD(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 BT(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 wX(e,t){return[t,...e.filter(n=>n!==t)].slice(0,50)}function hje(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 fje(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 fD(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 pje(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 mje(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 xX(){const[e,t]=g.useState(()=>BT(nt(PT))),[n,s]=g.useState(()=>BT(nt(DT))),[a,o]=g.useState(()=>{try{return yX(JSON.parse(nt(FT)??"[]"))}catch{return[]}});g.useEffect(()=>{st(PT,JSON.stringify(e))},[e]),g.useEffect(()=>{st(DT,JSON.stringify(n))},[n]);const i=g.useCallback(d=>s(f=>wX(f,d)),[]),l=g.useCallback(d=>t(f=>f.includes(d)?f.filter(p=>p!==d):[...f,d].slice(-100)),[]),u=g.useCallback(d=>{o(d),st(FT,JSON.stringify(d))},[]);return{favorites:e,recent:n,catalogue:a,remember:i,toggleFavorite:l,updateCatalogue:u}}function vX(e,t,n,s){const a=fD(e,t,n);if(!a)return()=>{};const o=setTimeout(()=>{n.add(t),s(a)},1e3);return()=>clearTimeout(o)}const dm=148,qT=6e3,bX=16e3,pD=46,Xa=34;function kX(e,t,n=dm){let s=-Math.round(t()*n);if(Math.abs(s-e)<Xa){const a=e-Xa>=-n?-Xa:Xa;s=Math.max(-n,Math.min(0,Math.round(e+a)))}return{to:s,ms:Math.round(Math.abs(s-e)*pD)}}function jX(e){return Math.round(qT+e()*(bX-qT))}const UT=[{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 NX(e){const t=UT.reduce((s,a)=>s+a.weight,0);let n=e()*t;for(const s of UT)if(n-=s.weight,n<0)return s.kind;return"stroll"}const SX=720,CX=260,_X=620,EX=220,WT=520,mD=1600,HT=7e3,TX=15e3,zT=6e3,AX=14e3;function il(e,t,n=dm){let s=-Math.round(t()*n);if(Math.abs(s-e)<Xa){const a=e-Xa>=-n?-Xa:Xa;s=Math.max(-n,Math.min(0,Math.round(e+a)))}return s}const tn=(e,t)=>Math.round(Math.abs(t-e)*pD),RX=120,of=0;function MX(e,t){const n=s=>({kind:"litter",at:t,...s});return[{x:t,prop:n({}),act:"walk",ms:tn(e,t)},{x:t,prop:n({}),act:"stoop",ms:SX},{x:of,prop:n({held:!0}),act:"carry",ms:tn(t,of)},{x:of,prop:n({held:!0}),act:"windup",ms:CX},{x:of,prop:n({held:!0,leaving:!0}),act:"toss",ms:_X}]}function $X(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:tn(e,s)},{x:s,prop:a(),act:"windup",ms:EX,facing:n>0?"right":"left"},{x:s,prop:a({leaving:!0}),act:"kick",ms:WT,facing:n>0?"right":"left"},{x:s,prop:a({leaving:!0}),act:"stand",ms:mD-WT}]}const gD=640;function LX(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:tn(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:tn(s,0)}]}function IX(e,t,n){const s=Math.max(-110,Math.min(-30,t)),a={x:s,prop:null};return[{...a,act:"walk",ms:tn(e,s)},{...a,act:"skip-ready",ms:500},{...a,act:"skip",ms:gD*(6+Math.floor(n()*5))},{...a,act:"skip-rest",ms:600},{...a,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:tn(s,0)}]}function OX(e,t,n){return[{x:t,prop:null,act:"walk",ms:tn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(zT+n()*(AX-zT))},{x:t,prop:null,act:"stand",ms:400}]}function PX(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:tn(e,t)},{x:t,prop:s(),act:"watch",ms:Math.round(HT+n()*(TX-HT))},{x:t,prop:s(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function tw(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 DX=1500,FX=e=>Math.round(1e3*Math.sqrt(2*e/DX)),BX=115,qX=e=>Math.round(e/BX*1e3),UX=620,WX=200,HX=760,zX=600,VX=240;function GX(e,t,n){const a=-(t.ledgeSpan??dm),o=FX(t.ledgeH),i=qX(t.ledgeH),l=n(),u=n(),d=-Math.round(l*t.floorSpan),f=-Math.round(u*t.floorSpan);return[{x:a,act:"walk",prop:null,ms:tn(e,a)},{x:a,act:"peer",prop:null,ms:UX},{x:a,act:"fall",prop:null,ms:o,place:"floor"},{x:a,act:"land",prop:null,ms:WX,place:"floor"},{x:d,act:"walk",prop:null,ms:tn(a,d),place:"floor",floorFrac:l},{x:f,act:"walk",prop:null,ms:tn(d,f),place:"floor",floorFrac:u},{x:a,act:"walk",prop:null,ms:tn(f,a),place:"floor"},{x:a,act:"lasso",prop:null,ms:HX,place:"floor"},{x:a,act:"rope-throw",prop:null,ms:zX,place:"floor"},{x:a,act:"rope-catch",prop:null,ms:VX,place:"floor"},{x:a,act:"climb",prop:null,ms:i},{x:a,act:"pull-up",prop:null,ms:480}]}function KX(e,t,n){const s=(n==null?void 0:n.ledgeSpan)??dm;switch(NX(t)){case"tidy":return MX(e,il(e,t,s));case"kick":return $X(e,il(e,t,s));case"sit":return OX(e,il(e,t,s),t);case"watch":return PX(e,il(e,t,s),t);case"fish":return LX(e,il(e,t,s),t);case"skip":return IX(e,il(e,t,s),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return GX(e,n,t)}}const o=kX(e,t,s);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const YX=420;function XX(e,t,n){const s=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(YX,Math.max(0,s))}const ZX=260,JX=200;function QX(e,t,n){const s=(f,p=tn(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,d={place:"floor",riser:n.height,prop:null};return[s(l,tn(e,l)),{...d,x:l,act:"mount",ms:ZX},{...d,x:u,act:"walk",ms:tn(l,u)},{x:u,prop:null,act:"dismount",ms:JX,place:"floor"},{x:t,prop:null,act:"walk",ms:tn(u,t),place:"floor"}]}const yD=["bob","sway","groove"],VT=9e3,eZ=16e3,wD=1e3,tZ=.08;function nZ(e,t){const n=yD.filter(o=>o!==e),s=n[Math.min(n.length-1,Math.floor(t()*n.length))],a=(t()*2-1)*tZ;return{dance:s,beatMs:Math.round(wD*(1+a))}}function sZ(e){return Math.round(VT+e()*(eZ-VT))}const $N=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],GT=18,rZ=$N.length,xD="M6 9H4V1H5V0H7V-1H9V1H7V2H5V7H6V8H7V9Z",vD="M12 9H14V6H13V3H11V2H9V4H12Z",LN=new Set(["a","c","p"]);function lo(e=$N){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 aZ=[".xx.","xxxx",".xx."],oZ=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],iZ=["...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."],nw={litter:aZ,ball:oZ,scope:iZ},lZ=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],cZ=3,uZ=-1,F1=11,KT=9;function YT(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 d=n;n=null,d==null||d()},s))},u=()=>{e.hidden&&t!==null?(s=Math.max(0,s-(performance.now()-a)),i()):e.hidden||l()};return e.addEventListener("visibilitychange",u),{schedule(d,f){o||(i(),n=d,s=Math.max(0,f),l())},dispose(){o=!0,i(),n=null,e.removeEventListener("visibilitychange",u)}}}function dZ(e,t,n){const[s,a]=g.useState(0),[o,i]=g.useState(0),[l,u]=g.useState(null),[d,f]=g.useState(null),[p,m]=g.useState({x:0,drop:0}),[w,x]=g.useState("ledge"),[b,j]=g.useState("left"),[k,v]=g.useState(0),S=g.useRef(null),[C,_]=g.useState(()=>document.hidden);g.useEffect(()=>{const M=new Set,B=()=>{var T;if(document.hidden){for(const P of((T=S.current)==null?void 0:T.getAnimations({subtree:!0}))??[])if(P.playState==="running"||P.pending){const q=P.currentTime;P.pause(),q!==null&&(P.currentTime=q),M.add(P)}}else{for(const P of M)P.playState==="paused"&&P.play();M.clear()}_(document.hidden)};return B(),document.addEventListener("visibilitychange",B),()=>document.removeEventListener("visibilitychange",B)},[e,t]);const[R,A]=g.useState(null),[I,$]=g.useState(wD),[U,F]=g.useState(()=>{var M;return((M=window.matchMedia)==null?void 0:M.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return g.useEffect(()=>{var T;const M=(T=window.matchMedia)==null?void 0:T.call(window,"(prefers-reduced-motion: reduce)");if(!M)return;const B=()=>F(M.matches);return B(),M.addEventListener("change",B),()=>M.removeEventListener("change",B)},[]),g.useEffect(()=>{var J;if(!e||t||U)return;const M=YT(document);let B=0;a(Q=>B=Q);let T=null,P=0,q=0;const K=Q=>{var re,he;const[te,...le]=Q;if(!te){T=null,u(null),f(null),W();return}u(te.act),f(te.prop),x(te.place??"ledge"),v(te.riser??0);const de=B,oe=V(te);if(te.act==="kick"){const fe=(he=(re=S.current)==null?void 0:re.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:he.getBoundingClientRect();fe&&m({x:XX(fe.x,tw(te,de,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-fe.y+24)})}q=te.act==="walk"?Math.max(tn(de,oe),RX):te.ms,te.act==="carry"&&(q=tn(de,oe)),i(q),j(fe=>tw({...te,x:oe},de,fe)),a(oe),B=oe,T=te,P=Date.now(),M.schedule(()=>K(le),q)},z=()=>{const Q=S.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=S.current,te=Q==null?void 0:Q.querySelector(".fm-sprite");return!Q||!te?0:Math.max(0,Q.getBoundingClientRect().width-te.offsetWidth)},D=()=>{const Q=S.current,te=Q==null?void 0:Q.querySelector(".fm-walker"),le=z();if(!Q||!te||le==null)return;const de=Q.getBoundingClientRect().bottom-te.getBoundingClientRect().bottom;if(de>0)return{ledgeH:de,floorSpan:le,ledgeSpan:H()}},O=()=>{const Q=S.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}},V=Q=>{const te=(Q.place??"ledge")==="floor",le=te?z()??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=V(T);Q!==B&&(i(Math.max(0,P+q-Date.now())),j(te=>tw({...T,x:Q},B,te)),a(Q),B=Q)},W=()=>{M.schedule(()=>{const Q=KX(B,Math.random,D()),te=Q.some(oe=>oe.place==="floor")?O():null;let le=B;const de=Q.flatMap(oe=>{const re=le;if(le=oe.x,!(oe.place==="floor"&&oe.act==="walk"))return[oe];const he=QX(re,oe.x,te),fe=he.length-1;return oe.floorFrac==null?he:he.map(($e,ye)=>ye===fe?{...$e,floorFrac:oe.floorFrac}:$e)});K(de)},jX(Math.random))},X=(J=S.current)==null?void 0:J.parentElement,Y=typeof ResizeObserver>"u"?null:new ResizeObserver(Z);return X&&Y&&Y.observe(X),W(),()=>{M.dispose(),Y==null||Y.disconnect(),x("ledge"),a(Q=>Math.max(-H(),Math.min(0,Q))),i(0),u(null),f(null),v(0)}},[e,t,U]),g.useEffect(()=>{if(!n||U){A(null);return}const M=YT(document),B=T=>{const P=nZ(T,Math.random);A(P.dance),$(P.beatMs),M.schedule(()=>B(P.dance),sZ(Math.random))};return B(null),()=>M.dispose()},[n,U]),{scene:S,suspended:C,x:s,walkMs:o,act:l,prop:d,ballFlight:p,place:w,facing:b,riser:k,dance:R,beatMs:I}}const sw={e:"fm-eye",s:"fm-shade",p:"fm-pad"},up=lo().filter(e=>!LN.has(e.cell)),hZ=lo().filter(e=>LN.has(e.cell)),XT=up.filter(e=>e.cell==="e"),fZ=lo(lZ),pZ=up.filter(e=>e.y<F1&&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),mZ={left:up.filter(e=>e.y>=F1&&e.x<KT),right:up.filter(e=>e.y>=F1&&e.x>=KT)},gZ=g.memo(function({act:t,facing:n}){return r.jsxs("svg",{viewBox:`0 0 ${GT} ${rZ}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:hZ.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:sw[s.cell]},`g${s.y}-${s.x}`))})}),r.jsxs("g",{className:"fm-body",children:[XT.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,fill:"var(--accent)"},`eye-bed-${s.x}`)),pZ.map(s=>r.jsx("rect",{x:s.x,y:s.y,width:s.w,height:1,className:sw[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"})]}),XT.map(s=>r.jsx("rect",{x:s.x-(s.x>=GT/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:fZ.map(s=>r.jsx("rect",{x:cZ+s.x,y:uZ+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:xD}),r.jsx("path",{className:"fm-grip-right",d:vD})]}),(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:mZ[s].map(a=>r.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:sw[a.cell]},`${s}${a.y}-${a.x}`))},s))]})}),yZ=["...o........o.....","...of......fo.....","...owffffffwo.....","...offfffffso.....","...ofefffefso.....","....owwnwwso......",".....wwwww........",".....fwwwfs.......","....ffwwwffs...ww.","....ffwwwffs..wfs.","......fwwfssfffs..","......ff..fsffs...","......ff..fs......","......oo..oo......"],wZ=[".....aaaaaaa......","...aa.......aa....","..a...........a...","..cp.........pc...","..cp.........pc...","..cp.........pc...","..c...........c..."],dr={f:"#d88735",s:"#a55b24",o:"#63351e",w:"#ffe2aa",n:"#372821"},xZ={p:"fm-pad"},td=lo(yZ),vZ=lo(wZ);function B1(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 bZ=B1(td.filter(e=>e.y>=8),12,18),kZ=td.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),ZT=td.filter(e=>e.cell==="e"),jZ={left:B1(td.filter(e=>e.y>=11),0,9),right:B1(td.filter(e=>e.y>=11),9,12)},NZ=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:bZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:dr[i.cell]},`t${i.y}-${i.x}`))}),r.jsx("g",{className:"fm-gear",children:r.jsx("g",{className:"fm-gear-motion",children:vZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,className:xZ[i.cell]},`g${i.y}-${i.x}`))})}),r.jsxs("g",{className:"fm-body",children:[kZ.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:dr[i.cell]},`b${i.y}-${i.x}`)),ZT.map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:dr.f},`bed${i.x}`)),r.jsxs("g",{className:"fm-arms",fill:dr.f,children:[r.jsx("rect",{x:4,y:8,width:2,height:2}),r.jsx("rect",{x:12,y:8,width:1,height:2})]}),ZT.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:dr.n}},`e${i.x}`))]}),s&&r.jsxs("g",{className:"fm-grip",style:{fill:dr.f},children:[r.jsx("path",{className:"fm-grip-left",d:xD}),r.jsx("path",{className:"fm-grip-right",d:vD})]}),a&&r.jsxs("g",{className:"fm-crouch-legs",style:{fill:dr.f},children:[r.jsx("path",{d:"M6 11H8V13H6Z"}),r.jsx("path",{d:"M10 11H12V13H10Z"})]}),o&&r.jsxs("g",{className:"fm-seated-legs",style:{fill:dr.f},children:[r.jsx("path",{className:"fm-seated-far",style:{fill:dr.s},d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),r.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(i=>r.jsx("g",{className:"fm-leg","data-side":i,children:jZ[i].map(l=>r.jsx("rect",{x:l.x,y:l.y,width:l.w,height:1,fill:dr[l.cell]},`${l.y}-${l.x}`))},i))]})}),SZ=[".......dddd.......","......dhhhhd......",".....dhhhhhhd.....","....dhwwhhwwhd....","....dhwewwewhd....","....dhwwbbwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....",".....dhwwwwhd.....",".....dhwwwwhd.....","......dhhhhd......","......bb..bb......",".....bbb..bbb....."],Xr={d:"#3b4855",h:"#657b8b",w:"#f4f0df",e:"#19242b",b:"#f0b44b",s:"#c88736"},CZ={p:"fm-pad"},dp=lo(SZ),_Z=lo($N).filter(e=>LN.has(e.cell)),JT=dp.filter(e=>e.cell==="e"),EZ=dp.filter(e=>e.y<12&&e.cell!=="e"),TZ={left:dp.filter(e=>e.y>=12&&e.x<9),right:dp.filter(e=>e.y>=12&&e.x>=9)},AZ=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:_Z.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:CZ[o.cell]},`g${o.y}-${o.x}`))})}),r.jsxs("g",{className:"fm-body",children:[EZ.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Xr[o.cell]},`b${o.y}-${o.x}`)),JT.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:Xr.w},`bed${o.x}`)),r.jsxs("g",{className:"fm-arms",fill:Xr.d,children:[r.jsx("path",{d:"M4 8H6V10H5V11H4Z"}),r.jsx("path",{d:"M12 8H14V11H13V10H12Z"})]}),JT.map(o=>r.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:"fm-eye",style:{fill:Xr.e}},`e${o.x}`))]}),n&&r.jsxs("g",{className:"fm-grip",style:{fill:Xr.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:Xr.b},children:[r.jsx("path",{d:"M5 12H8V13H5Z"}),r.jsx("path",{d:"M10 12H13V13H10Z"})]}),a&&r.jsxs("g",{className:"fm-seated-legs",style:{fill:Xr.b},children:[r.jsx("path",{className:"fm-seated-far",style:{fill:Xr.s},d:"M10 11H12V12H13V14H10V13H11V12H10Z"}),r.jsx("path",{d:"M6 11H8V12H7V13H8V14H4V13H5V12H6Z"})]}),["left","right"].map(o=>r.jsx("g",{className:"fm-leg","data-side":o,children:TZ[o].map(i=>r.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:Xr.b},`${i.y}-${i.x}`))},o))]})});function bD({character:e,act:t,facing:n}){return e==="penguin"?r.jsx(AZ,{act:t,facing:n}):e==="fox"?r.jsx(NZ,{act:t,facing:n}):r.jsx(gZ,{act:t,facing:n})}const RZ={"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 kD(e,t){return t&&Gl(t.id)===e?t.name:um(e)?"Custom FM":RZ[e]}function rw(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:lo(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 QT={litter:rw(nw.litter,"litter"),ball:rw(nw.ball,"ball"),scope:rw(nw.scope,"scope")};function MZ(e){try{return new URL(e).host}catch{return"the station's server"}}const $Z=g.memo(function({player:t,source:n,customStation:s,character:a="deck"}){const{probe:o,dead:i,playing:l,press:u}=t,{scene:d,suspended:f,x:p,walkMs:m,act:w,prop:x,ballFlight:b,place:j,facing:k,riser:v,dance:S,beatMs:C}=dZ(o,i,l);if(!o||i)return null;const _=kD(n,s),R=o.audio?MZ(o.audio):"YouTube";return r.jsxs("div",{ref:d,className:"fm","data-suspended":f?"":void 0,"data-place":j,style:{"--fm-beat":`${C}ms`},children:[x&&!x.held&&r.jsx("div",{className:"fm-prop","data-prop":x.kind,"data-leaving":x.leaving?"":void 0,style:{"--fm-prop-x":`${x.at}px`,"--fm-roll-to":`${b.x}px`,"--fm-ball-drop":`${b.drop}px`,"--fm-ball-flight-ms":`${mD}ms`,"--fm-ball-turn":k==="right"?"1080deg":"-1080deg"},children:QT[x.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":j,"data-facing":k,style:{"--fm-x":`${p}px`,"--fm-walk-ms":`${m}ms`,"--fm-riser":`${v}px`,"--fm-skip-beat":`${gD}ms`},children:[(x==null?void 0:x.held)&&r.jsx("div",{className:"fm-held","data-prop":x.kind,"data-toss":x.leaving?"":void 0,children:QT[x.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?S??yD[0]:void 0,onClick:u,title:l?`Stop ${_}`:`Play ${_} — streams from ${R}`,"aria-label":l?`Stop ${_}`:`Play ${_}`,children:r.jsx(bD,{character:a,act:w,facing:k})})]})]})});function LZ({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:lX(n.channel,window.location.origin,n.video),onLoad:()=>o(cX()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})}):null}const IZ={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 OZ({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:IZ[e]})})}function PZ({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 DZ({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:JG,children:[r.jsx("button",{type:"button",className:"icon-btn","aria-label":"Close radio",onClick:e,children:r.jsx(OZ,{name:"close"})}),r.jsx(PZ,{opening:!0})]})}const FZ=g.lazy(()=>gi(()=>import("./RadioPanel-gFYxdsBg.js"),[]));function BZ({fm:e,characterEnabled:t,character:n,open:s,onClose:a}){const[o,i]=g.useState(!1),[l,u]=g.useState("Connecting to the deck…"),d=xX(),[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(I=>I.ok?I.json():null).then(I=>{A.signal.aborted||(i((I==null?void 0:I.enabled)===!0),u(I?"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=>Gl(A.id)===e.fmSource),x=w!=null&&w.radio?w:void 0,b=gX({volume:e.fmVolume,muted:e.fmMuted,source:e.fmSource,playRequest:e.fmPlayRequest,customStation:w,enabled:o,onAvailabilityChange:e.markFmStationAvailability}),j=kD(e.fmSource,w),k=o&&x&&b.dead&&e.fmPlayRequest>0?fD(f??d.catalogue,x.id,m.current):null,{remember:v}=d,S=(w==null?void 0:w.id)??e.fmSource;g.useEffect(()=>{b.playing&&v(S)},[S,b.playing,v]);const C=a,_=wt(a),R=g.useCallback((A,I=!1)=>{var M;if(!o)return;I||m.current.clear();const $=Gl(A.id),U=$===e.fmSource;if(U&&b.armed&&!b.dead){b.press();return}const F=U&&!!w&&(w.url!==A.url||((M=w.radio)==null?void 0:M.hls)!==A.radio.hls);e.addFmStation(A,!0),U&&!b.dead&&!F?b.press():e.pickFmSource($,F),fetch(`/api/radio-click?id=${encodeURIComponent(A.id)}`).catch(()=>{})},[o,w,e.addFmStation,e.fmSource,e.pickFmSource,b.armed,b.dead,b.press]);return g.useEffect(()=>{b.playing&&!b.dead&&m.current.clear()},[b.playing,b.dead]),g.useEffect(()=>{if(!(!o||!x||!b.dead||e.fmPlayRequest===0))return vX(f??d.catalogue,x.id,m.current,A=>R(A,!0))},[o,x==null?void 0:x.id,b.dead,e.fmPlayRequest,f,d.catalogue,R]),r.jsxs(r.Fragment,{children:[t&&r.jsx($Z,{character:n,player:b,source:e.fmSource,customStation:w}),r.jsx(LZ,{player:b,label:j}),s&&vt.createPortal(r.jsx("div",{className:"modal-backdrop radio-backdrop",..._,children:r.jsx(g.Suspense,{fallback:r.jsx(DZ,{onClose:C}),children:r.jsx(FZ,{fm:e,player:b,library:d,selected:x,label:j,enabled:o,disabledReason:l,autoNext:k==null?void 0:k.name,onPick:R,onQueueChange:p,onClose:C})})}),document.body)]})}function qZ({data:e}){const t=Sr(3e4),n=e.note,s=e.plan??null,a=(n==null?void 0:n.kind)==="recap",o=ip((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:im(n),u=Nr(s),d=n?sc(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: ${d}`,"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(ap,{recap:a}),d]}),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(),bK(e.noteKey)},children:"×"})]}),n&&r.jsx("p",{className:"recap-note-text",title:MK(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(eA,{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(ap,{recap:a}),d]}),r.jsx("span",{className:"recap-face-age",children:o.label})]}),n&&r.jsx("p",{className:"recap-face-text",children:n.text}),s&&r.jsx(eA,{plan:s,head:n!=null,face:!0})]}),r.jsx(ci,{type:"source",position:Ye.Right,style:{background:"transparent",border:"none"}})]})}const UZ={completed:"done",in_progress:"now",pending:"to do"};function eA({plan:e,head:t,face:n=!1}){const s=Nr(e);if(!s)return null;const a=vV(e.items);return r.jsxs("div",{className:n?"recap-face-plan":"recap-note-plan",title:n?void 0:Xp(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:[UZ[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 to(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function co(e){return/mac|iphone|ipad/i.test(e)}const hp=e=>new Map([...e].map(([t,n])=>[t,{x:n.x,y:n.y}]));function WZ(e,t,n){return{positions:hp(e.positions),pinned:hp(e.pinned),provisional:new Set(e.provisional),layoutSig:e.layoutSig.current,stored:{...t},viewport:n?{...n}:null}}function HZ(e,t){t.positions.clear();for(const[n,s]of hp(e.positions))t.positions.set(n,s);t.pinned.clear();for(const[n,s]of hp(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 tA=7e3,zZ=2e3,VZ=140,GZ="Layout re-arranged",KZ="Layout re-arranged. Undo available.",nA="Layout restored.",YZ={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e),now:()=>Date.now()};function XZ(e,t=YZ){let n=null,s=null,a=0,o=tA;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,d()},o))};function d(){l(),i.clear(),n!==null&&(n=null,e(!1))}return{open(f){const p=n===null;n=f,o=tA,u(),p&&e(!0)},take(){const f=n;return d(),f},close:d,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,zZ),u())},get isOpen(){return n!==null},get snapshot(){return n}}}function ZZ(e){return(e.key==="z"||e.key==="Z")&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey}function JZ(e){return co(e)?"⌘Z":"Ctrl+Z"}function QZ({undo:e}){const{open:t,said:n,undo:s,dismiss:a,hold:o,release:i}=e,l=bl(t,VZ),u=g.useRef(null);return g.useEffect(()=>t?ln.push(a,0,"popover"):void 0,[t,a]),g.useEffect(()=>{var f;if(t)return;const d=u.current;d&&d.contains(document.activeElement)&&((f=d.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}),Ya(l)&&r.jsxs("div",{ref:u,className:l==="leaving"?"rearrange-undo leaving":"rearrange-undo",onPointerEnter:()=>o("hover"),onPointerLeave:()=>i("hover"),onFocus:()=>o("focus"),onBlur:d=>{d.currentTarget.contains(d.relatedTarget)||i("focus")},children:[r.jsx("span",{id:"rearrange-undo-state",className:"rearrange-undo-state",children:GZ}),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:JZ(to())})]})]})]})}function eJ({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:a,targetPosition:o,style:i}){const[l]=nN({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 q1(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function fp(e,t){const n=q1(e);return n?n.slice(-t):e.slice(-t)}function jD(e,t,n=4){const s=q1(e);if(!s)return fp(e,n);let a=n;for(const o of t){if(o===e)continue;const i=q1(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 kl=" · ",tJ=32,nJ=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function sA(e){return nJ.test(e)?2:1}function rA(e,t=tJ){const n=[...e];let s=0;for(const i of n)s+=sA(i);if(s<=t)return e;const a=[];let o=0;for(const i of n){const l=sA(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 sJ(e,t,n,s,a=[],{branch:o,plan:i,alarm:l=!1}={}){const u=(t==null?void 0:t.trim())??"",d=s?jD(n,a):void 0,f=[e,u||void 0,d].filter(Boolean),p=[e,i?`plan ${i}`:void 0,o,u||void 0,d].filter(Boolean).join(kl);return{label:rA(e),name:u?rA(u):void 0,shortId:d,fullLabel:f.join(kl),title:`${l?"waiting on you: ":""}${p}
|
|
90
90
|
Zoom to this session
|
|
91
91
|
drag the wrapper to move the whole session`}}const Zo=18,U1=26,IN=12,nd=240,ON=130,W1=Zo*2+U1+IN,rJ=72,Ml=W1+rJ,Pf=24,ND=70,pp=Zo*2+Pf,Kl=Ml;function SD(e,t){var s;let n=nd;for(const a of e)n=Math.max(n,((s=t.get(a.id))==null?void 0:s.width)??nd);return n}const $l=420,Df=300,mp=130,CD=160,_D=1;function aJ(e,t,n,s){return Math.min(_D,n/Math.max(1,e),s/Math.max(1,t))}function un(e){const t=e.data;return(t==null?void 0:t.canvasSessionId)??(t==null?void 0:t.sessionId)??"_default"}function hm(e,t=()=>!0){const n=new Map;for(const s of e){if(!t(s))continue;const a=un(s),o=n.get(a);o?o.push(s):n.set(a,[s])}return n}function oJ(e,t){return((t==null?void 0:t.get(e))??0)>0?$l:0}function iJ(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function sd(e,t){const n=t.get(e);return{w:(n==null?void 0:n.width)??nd,h:(n==null?void 0:n.height)??ON}}function rc(e,t,n){const s=sd(e,t);return{w:s.w+oJ(e,n),h:Math.max(s.h,iJ(e,n))}}function lJ(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}const cJ=240,ED=16;function TD(e,t){return(e+cJ)*(t||1)}function uJ(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 dJ(e,t,n,s){return{position:"absolute",left:e.x+ED,top:e.y-IN/(t||1),transform:`scale(${1/(t||1)})`,transformOrigin:"left top",maxWidth:s??TD(e.w,t),"--session-hue":n}}function hJ(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,d=l+a.height,f=t.get(un(a)),p=o.canvasSessionId&&o.canvasSessionId!==o.sessionId?null:fJ(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,d),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(un(a),{minX:i,minY:l,maxX:u,maxY:d,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,...sJ(o.label,o.name,a,l,i,{branch:o.branch,plan:o.planLine,alarm:o.alarm}),x:o.minX-Zo,y:o.minY-Zo-U1,w:o.maxX-o.minX+Zo*2,h:o.maxY-o.minY+Zo*2+U1,...o.alarm?{alarm:!0}:null,...o.branch?{branch:o.branch}:null,...o.plan?{plan:o.plan,planLine:o.planLine}:null})}return s}function fJ(e){if(e.kind!=="root")return null;const t=e.branch,n=Nr(e.plan);return{label:e.label,name:sm(e.sessionName,e.sessionTitle).face,alarm:Tn(e.waiting),branch:t&&t.total>0?HP(t):void 0,plan:n?`plan ${n.done}/${n.total}`:void 0,planLine:n?pN(n):void 0}}function pJ(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 mJ=20,Zr=4,gJ=64,yJ=".cat-filter-bar, .react-flow__panel, .autofit-chip, .rearrange-undo, .usage-panel, .sysdetail, .detail";function wJ(e,t,n,s){const a=t.zoom||1,o=TD(e.w,a);if(n.width<=0||n.height<=0)return{maxWidth:o,hidden:!1};const i=(e.x+ED)*a+t.x,l=e.y*a+t.y-IN,u=l+mJ;let d=Math.min(o,n.width-Zr-i),f=i<Zr||l<Zr||u>n.height-Zr;for(const p of s)if(!(p.top-Zr>=u||p.bottom+Zr<=l)&&!(p.right+Zr<=i)){if(p.left-Zr<=i){f=!0;break}d=Math.min(d,p.left-Zr-i)}return d<gJ&&(f=!0),{maxWidth:Math.max(0,d),hidden:f}}function xJ(e){const t=e.getBoundingClientRect(),n=[];for(const s of e.ownerDocument.querySelectorAll(yJ)){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 vJ(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 bJ=500;function AD({focus:e,setTimeout:t,clearTimeout:n,ms:s=bJ}){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 kJ(e){return hJ(e.nodeInternals.values())}const jJ=e=>e.width,NJ=e=>e.height,SJ=e=>{var t;return((t=e.domNode)==null?void 0:t.querySelector(".react-flow__viewport"))??null};function CJ({onFocusSession:e}){const{x:t,y:n,zoom:s}=D4(),a=ft(kJ,pJ),o=ft(jJ),i=ft(NJ),l={width:o,height:i},u=g.useRef(null),d=ft(SJ),[f,p]=g.useState([]);g.useLayoutEffect(()=>{var R;const S=(R=u.current)==null?void 0:R.parentElement;if(!S)return;const C=xJ(S),_=requestAnimationFrame(()=>{p(A=>vJ(A,C)?A:C)});return()=>cancelAnimationFrame(_)});const m=g.useRef(e);m.current=e;const[w]=g.useState(()=>AD({focus:S=>{var C;return(C=m.current)==null?void 0:C.call(m,S)},setTimeout:(S,C)=>window.setTimeout(S,C),clearTimeout:S=>window.clearTimeout(S)}));if(g.useEffect(()=>()=>w.cancel(),[w]),a.length<=1)return null;const x=S=>{try{e==null||e(S)}catch{}},b=(S,C)=>{S.detail>0&&xd()?w.hold(C):x(C)},j={transform:`translate(${t}px, ${n}px) scale(${s})`},k=r.jsx("div",{className:"session-clusters",style:j,ref:u,children:a.map(S=>{const C=Ju(S.sessionId),_=uJ(S,C);return r.jsx("div",{className:"cluster-card",style:_,"aria-hidden":!0},S.sessionId)})}),v=d&&vt.createPortal(r.jsx("div",{className:"cluster-labels nopan",children:a.map(S=>{const C=Ju(S.sessionId),_=wJ(S,{x:t,y:n,zoom:s},l,f),R=dJ(S,s,C,_.maxWidth);return r.jsxs("button",{type:"button",className:"cluster-label","data-alarm":S.alarm?"":void 0,"data-offpane":_.hidden?"":void 0,style:R,title:S.title,onClick:A=>b(A,S.sessionId),children:[S.alarm?r.jsxs(r.Fragment,{children:[r.jsx(SN,{}),r.jsx("span",{className:"cluster-label-said",children:"waiting on you: "})]}):null,S.label,S.plan?r.jsx("span",{className:"cluster-label-plan",children:kl+S.plan}):null,S.branch?r.jsx("span",{className:"cluster-label-branch",children:kl+S.branch}):null,S.name?r.jsx("span",{className:"cluster-label-name",children:kl+S.name}):null,S.shortId?r.jsx("span",{className:"cluster-label-id",children:kl+S.shortId}):null]},S.sessionId)})}),d);return r.jsxs(r.Fragment,{children:[k,v]})}function _J({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 RD=600,EJ=4,TJ=36,gp=14,AJ=60,RJ=6,aA=220,MJ=96,$J=28;function LJ(e,t){return Math.max(MJ,61+[...t].length*6.8)}function IJ(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function OJ(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/RD)}function PJ(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 DJ(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>RD)continue;const u=s.get(l.id)??n.get(l.id);if(!u)continue;const d=PJ(l.tools,EJ);if(d.length===0)continue;const f=l.exitAt??null,p=a.get(l.id),m=Math.max((p==null?void 0:p.width)??aA,aA),w=(p==null?void 0:p.height)??130,x=u.x,b=u.y,j=x+m,k=b+w/2;d.forEach((v,S)=>{const C=S*TJ,_=x+m+AJ,R=b+RJ+C,A=OJ(o,f),I=v.inputPreview??"",$=IJ(v),U=A<.999,F=NN(v.name);i.push({id:`${l.id}::${v.id}`,toolId:v.id,agentId:l.id,toolName:v.name,name:F.label,emoji:F.emoji,status:$,category:zP(v.name),mcpHue:F.hue,inputPreview:I,fade:A,fading:U,worldX:_,worldY:R,anchorX:j,anchorY:k,spawnDx:j-_,spawnDy:k-(R+gp)});const M=YP(v.name,v.input);if(M){const B=LJ(v.name,F.label),T=_+B+$J,P=R,q=_+B,K=R+gp;i.push({id:`sub:${l.id}::${v.id}`,toolId:v.id,agentId:l.id,toolName:v.name,name:oY(M.label,M.category),fullName:M.label,emoji:M.emoji,isSub:!0,status:$,category:M.category,inputPreview:M.detail??I,fade:A,fading:U,worldX:T,worldY:P,anchorX:q,anchorY:K,spawnDx:q-T,spawnDy:0})}})}return i}function FJ({agents:e,visibleAgentIds:t,positions:n,pinned:s,measured:a,spotlight:o,hiddenCategories:i,now:l,onOpenTool:u}){const d=DJ(e,t,n,s,a,l),f=i&&i.size>0?d.filter(p=>!i.has(p.category)):d;return r.jsx(BJ,{bursts:f,spotlight:o,onOpenTool:u})}function BJ({bursts:e,spotlight:t,onOpenTool:n}){const s=e.map(o=>{const i=o.anchorX,l=o.anchorY,u=o.worldX+6,d=o.worldY+gp,f=Math.max(1,u-i),p=Math.min(1,Math.abs(d-l)/f),m=i+f*(.55-.22*p),w=l+(d-l)*.12,x=u-f*.25,b=t!=null&&!t.has(o.agentId),j=o.fade*(b?.14:1);return r.jsx("path",{d:`M ${i} ${l} C ${m} ${w}, ${x} ${d}, ${u} ${d}`,className:`tool-conn status-${o.status}${o.fading?" fading":""}`,opacity:j,vectorEffect:"non-scaling-stroke"},`l:${o.id}`)}),a=e.map(o=>r.jsx(WJ,{b:o,dim:t!=null&&!t.has(o.agentId),onOpenTool:n},o.id));return r.jsx(qJ,{connectors:s,bubbles:a})}function qJ({connectors:e,bubbles:t}){const{x:n,y:s,zoom:a}=D4();return r.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,style:{"--tool-burst-height":`${2*gp}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 UJ(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 WJ=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}:{},d=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":""}${d}`,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:"×"})]})})},UJ),HJ={width:140,height:105},zJ={agent:AY,sessionGroup:_J,recapNote:qZ},VJ={recapTie:eJ},oA=400;function GJ({graph:e,layout:t,viewport:n,clicks:s,drag:a,appearance:o,fm:i,radioOpen:l,onRadioClose:u,autoFit:d,pause:f,stateRef:p,measuredRef:m,hiddenCats:w,now:x,openTool:b,focusAgent:j,requestClear:k,setKeyHelpOpen:v}){const{allNodes:S,edges:C,visibleAgentIds:_,spotlightSet:R}=e,{positionsRef:A,pinnedRef:I,handleRelayout:$,rearrangeUndo:U}=t,{restoredViewport:F,onMoveStart:M,onMove:B}=n,{onNodeClick:T,onPaneClick:P,onNodeDoubleClick:q,onNodeMouseEnter:K,onNodeMouseLeave:z}=s,{onNodeDragStart:H,onNodeDrag:D,onNodeDragStop:O}=a,{palette:V,minimapNodeFill:Z,characterEnabled:W}=o,{autoFitDisabled:X,enableAutoFitAndRefit:Y}=d,{paused:J,pauseGate:Q,togglePause:te}=f;return r.jsxs(P4,{nodes:S,edges:C,nodeTypes:zJ,edgesFocusable:!1,edgeTypes:VJ,fitView:!F,fitViewOptions:{padding:.25,duration:S1({durationMs:oA,documentHidden:document.hidden})?oA:0},minZoom:W4,maxZoom:H4,panOnScroll:!0,panActivationKeyCode:null,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:T,onPaneClick:P,onNodeDoubleClick:q,onNodeMouseEnter:K,onNodeMouseLeave:z,onMoveStart:M,onMove:B,onNodeDragStart:(le,de,oe)=>{U.dismiss(),H(le,de,oe)},onNodeDrag:D,onNodeDragStop:O,children:[r.jsx(I9,{gap:28,size:1,color:V["--grid-line"]}),r.jsx(CJ,{onFocusSession:j}),r.jsx(FJ,{agents:p.current.agents,visibleAgentIds:_,positions:A.current,pinned:I.current,measured:m.current,spotlight:R,hiddenCategories:w,now:x,onOpenTool:b}),r.jsxs("div",{className:"canvas-notices",children:[X&&r.jsx(DY,{enableAutoFitAndRefit:Y}),r.jsx(QZ,{undo:U})]}),r.jsx(XY,{autoFitDisabled:X,enableAutoFitAndRefit:Y,paused:J,pauseGate:Q,togglePause:te,handleRelayout:$,requestClear:k,setKeyHelpOpen:v}),r.jsx(k9,{style:HJ,zoomable:!0,pannable:!0,nodeColor:Z,nodeStrokeWidth:2,maskColor:V["--minimap-mask"],maskStrokeColor:V["--line"]}),r.jsx(BZ,{fm:i,character:o.character,characterEnabled:W,open:l,onClose:u})]})}function KJ(){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(d=>Number(d).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 YJ(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=Wn(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 XJ="spend on this board",ZJ="on this board",MD=`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
|
${k.join(`
|
|
110
110
|
`)}`:ed(e.model,e.effort),children:[em(e.model,e.effort),k.length>0?` +${k.length}`:""]})]})})()]}),d&&r.jsxs("div",{className:"hero-cost",children:[r.jsxs("div",{className:"hero-cost-headline",children:[r.jsx("span",{className:"hero-cost-value",children:lt(u.total)}),r.jsx("span",{className:"hero-cost-label",children:"spend"})]}),r.jsx(ZN,{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; ${En("the session list","L",i)} brings it back`:`Take this card and the ones under it off the board (Delete). ${En("The session list","L",i)} brings it back`,children:"Remove from board"})]})]}),r.jsx(EY,{agent:e}),(()=>{const k=kN(e);if(!k)return null;const v=ip(k.at,t),S=k.kind==="recap"?"Recap":sc(k.kind).replace(/^./,C=>C.toUpperCase());return r.jsxs("section",{className:"detail-section",children:[r.jsxs("h3",{children:[S," ",r.jsx("span",{className:"section-count",title:v.title,children:v.label})]}),r.jsx("p",{className:"detail-recap",title:im(k),children:k.text}),k.reply&&r.jsxs("p",{className:"detail-recap detail-note-reply",children:["Suggested reply: “",k.reply,"”"]})]})})(),(()=>{const k=Nr(e.plan);return!k||!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:[k.done,"/",k.total]}),r.jsxs("span",{className:"vis-hidden",children:[k.done," of ",k.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((v,S)=>r.jsxs("li",{className:"plan-item","data-status":v.status,children:[r.jsx("span",{className:"plan-mark","aria-hidden":!0}),r.jsxs("span",{className:"vis-hidden",children:[Gge[v.status],": "]}),r.jsx("span",{className:"plan-text",children:v.status==="in_progress"&&v.active?v.active:v.text}),v.status==="in_progress"&&r.jsx("span",{className:"plan-now","aria-hidden":!0,children:"now"})]},v.id??`${S}:${v.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:x.map(([k,v])=>{const S=k==="mcp"?b:null,C=S==null?void 0:S.hue,_=`${v} ${$p[k]} call${v===1?"":"s"}`;return r.jsxs("span",{className:`cat-chip cat-${k}${C!=null?" mcp-hue":""}`,style:C!=null?{"--mcp-hue":C}:void 0,title:S?`${_}, all to ${S.label}`:_,children:[r.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:k8[k]}),r.jsx("span",{className:"cat-name",children:$p[k]}),r.jsx("span",{className:"cat-count",children:v}),S&&r.jsx("span",{className:"cat-server",children:S.label})]},k)})})]})]}),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:St(e.usage.inputTokens)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"k",children:"out"}),r.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:St(e.usage.outputTokens)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"k",children:"cache r"}),r.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:St(e.usage.cacheReadTokens)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"k",children:"cache c"}),r.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:St(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:aP(e.prompts).length})]}),r.jsx("div",{className:"prompts",children:Hge(e.prompts).reverse().map(({pr:k,key:v})=>{const S=ip(k.at,t),C=Yp(k.text);return C?r.jsxs("details",{className:"prompt-entry prompt-injected",children:[r.jsxs("summary",{children:[r.jsx("span",{className:"prompt-time",title:S.title,children:S.label}),r.jsx("span",{className:"prompt-injected-label",children:C.label})]}),C.detail&&r.jsx("div",{className:"prompt-injected-detail",children:C.detail})]},v):r.jsxs("div",{className:"prompt-entry",children:[r.jsx("div",{className:"prompt-time",title:S.title,children:S.label}),r.jsx("div",{className:"prompt-text",children:k.text})]},v)})})]}),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(k=>r.jsx(Vge,{t:k,onClick:()=>n(e.id,k.id)},k.id))})]})]})}function Hge(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 zge={inflight:"in-flight",done:"done",err:"error"};function Vge({t:e,onClick:t}){const n=e.endedAt==null?"inflight":e.ok===!1?"err":"done",s=MP(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:zge[n]}),e.name]}),r.jsx("span",{style:{color:"var(--muted)"},children:s})]})}const Gge={completed:"done",in_progress:"now",pending:"to do"};function Kge(e,t){const n=Fge(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=Bge(n.label,t),document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function Yge({selected:e,now:t,openTool:n,setSummaryFor:s,onClose:a,stateRef:o,removeSelectedNode:i}){cn("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(Wge,{agent:e,now:t,onOpenTool:n,onShowSummary:s,onExportSession:u=>Kge(o.current,u),onRemove:i,singleKeys:l})]})}function Xge(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 _f(e,t){return t.map(n=>({...n,group:e}))}function Zge({providers:e,sessionListOpen:t,toggleSessionList:n,accountsPanelOpen:s,toggleAccountsPanel:a,usagePanelOpen:o,setUsagePanelOpen:i,machinePanelOpen:l,setMachinePanelOpen:u,setUsageHistoryOpen:d,watchOn:f,watchUnseen:p,setBrowserWatchOpen:m,setTrafficRadarOpen:w,setRadioOpen:x,openToolActivity:b,openSettings:j,onFeedback:k,toggles:v,openCapacity:S,integrations:C=[],openExploreIntegrations:_,openQuickOpen:R}){const A=wee(to()),I=co(to()),$={id:"session-list",label:"Session list",short:"Sessions",key:{cap:"L",aria:"L",single:!0},ariaLabel:"Session list",glyph:r.jsx(FD,{}),kind:"panel",open:t,controls:"session-list",onPress:n,buttonRef:v.sessionList},U={id:"accounts",label:"Accounts",short:"Accounts",key:{cap:"A",aria:"A",single:!0},ariaLabel:"Accounts",hint:"Claude accounts",glyph:r.jsx(BD,{}),kind:"panel",open:s,controls:"accounts-panel",onPress:a,buttonRef:v.accounts},F=S?[{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(RQ,{}),kind:"dialog",onPress:()=>S("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(MQ,{}),kind:"dialog",onPress:()=>S("calendar")}]:[],M={id:"usage",label:"Usage",short:"Usage",key:{cap:"U",aria:"U",single:!0},ariaLabel:"Usage",glyph:r.jsx(xQ,{}),kind:"panel",open:o,controls:"usage-panel",onPress:()=>i(V=>!V),buttonRef:v.usage},B={id:"machine",label:"Machine",short:"Machine",key:{cap:"S",aria:"S",single:!0},ariaLabel:"Machine",hint:"This machine",glyph:r.jsx(bQ,{}),kind:"panel",open:l,controls:"system-panel",onPress:()=>u(V=>!V),buttonRef:v.machine},T={id:"history",label:"Usage history",short:"History",key:{cap:"H",aria:"H",single:!0},ariaLabel:"Usage history",glyph:r.jsx(vQ,{}),kind:"dialog",onPress:()=>d(V=>!V)},P={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:Xge(f,p),glyph:r.jsx(jQ,{watching:f===!0||p>0}),kind:"dialog",onPress:()=>m(V=>!V),badge:p},q={id:"settings",label:"Settings",short:"Settings",key:{cap:A,aria:"Control+, Meta+,",single:!1},ariaLabel:"Settings",glyph:r.jsx(NQ,{}),kind:"dialog",onPress:()=>j()},K={id:"quick-open",label:"Search",short:"Search",key:{cap:yQ(I),aria:I?"Meta+K":"Control+K",single:!1},ariaLabel:"Search",detail:"Panels, sessions, settings, actions and themes",glyph:r.jsx(UD,{}),kind:"dialog",onPress:R},z={id:"feedback",label:"Feedback",short:"Feedback",menu:"Send feedback",ariaLabel:"Send feedback",glyph:r.jsx(SQ,{}),kind:"dialog",onPress:k},H=b?[{id:"tool-activity",label:"Tool activity",short:"Tools",ariaLabel:"Tool activity",glyph:r.jsx(AQ,{}),kind:"dialog",detail:"Which tools your agents run, how long they take and what fails",onPress:()=>b("tools")},{id:"skill-activity",label:"Skill activity",short:"Skills",ariaLabel:"Skill activity",glyph:r.jsx(qD,{}),kind:"dialog",detail:"Which skills your agents use, whether you typed them or the agent called them",onPress:()=>b("skills")}]:[],D=w?[{id:"traffic-radar",label:"Telemetry Radar",short:"Radar",ariaLabel:"Telemetry Radar",glyph:r.jsx(kQ,{}),kind:"dialog",detail:"Claude telemetry configuration and observed connections",onPress:()=>w(!0)}]:[],O=x?[{id:"radio",label:"Radio",short:"Radio",ariaLabel:"Radio",glyph:r.jsx(TQ,{}),kind:"dialog",detail:"Explore stations around the world",onPress:()=>x(!0)}]:[];return{left:e.claude?[U,$]:[$],leftStripe:e.claude?[_f("Claude accounts",[U,...F]),[$]]:[[$]],capacity:e.claude?F:[],right:[_f("Usage and machine",[M,B]),_f("Activity history",[T,...H]),_f("Watchers",[P,...D]),O].filter(V=>V.length>0),utilities:[q,z],search:K,explore:_?[{id:"explore-integrations",label:"Explore integrations",short:"Integrations",ariaLabel:"Explore integrations",glyph:r.jsx(wQ,{}),kind:"dialog",onPress:_}]:[],integrations:C.map(({provider:V,onPress:Z})=>({id:`integration-${V.kind}`,label:V.label,short:V.label,ariaLabel:V.label,detail:V.detail,key:V.shortcut?{cap:V.shortcut.toUpperCase(),aria:V.shortcut.toUpperCase(),single:!0}:void 0,glyph:r.jsx(V.Glyph,{}),kind:"dialog",onPress:Z}))}}const Lp=[{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 N8(e){return Lp.find(t=>t.value===e)??Lp[0]}const Tj=3,G0=120,S8=1e4,C8=200,Jge="Write something first.";function NO(e){return e.trim()!==""}function Qge(e){var o;const t=e.trim();if(t==="")return"";const n=SO(t.split(/\r?\n/,1)[0]),s=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,a=K0(s).length>=Tj?K0(s):K0(n);return tye(a.length>=Tj?a:SO(t))}function eye(e,t){const n=Qge(t);return n.length>=Tj?n:`${N8(e).label}: ${n}`}function SO(e){return e.replace(/\s+/g," ").trim()}function K0(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function tye(e){if(e.length<=G0)return e;const t=e.slice(0,G0-1),n=t.lastIndexOf(" ");return`${(n>=G0/2?t.slice(0,n):t).replace(/[\uD800-\uDBFF]$/,"").replace(/[\s,;:.\-–—]+$/,"")}…`}function nye({kind:e,body:t,contact:n}){const s={kind:e,title:eye(e,t),body:t.trim()};return n.trim()!==""&&(s.contact=n.trim()),s}function sye(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 rye={darwin:"macOS",win32:"Windows",linux:"Linux"};function aye(e){const t=e.indexOf("-"),n=t===-1?e:e.slice(0,t),s=t===-1?"":e.slice(t+1),a=rye[n]??n;return s?`${a} · ${s}`:a}function oye(e){return e?`ccdeck ${e.appVersion} · ${aye(e.platform)}`:null}const iye="sent with it",lye="Your ccdeck version and system are sent with it.",cye="Add details",uye="How to reach you",dye="Email or GitHub @name",hye="Only if you would like an answer.",fye=["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 pye(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function HS(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function mye(e){return co(e)?["⌘","Enter"]:["Ctrl","Enter"]}function gye(e){return[...e].length===1}const _8="Thanks — feedback sent.";function CO(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 yye(e){return e==="sending"?"Sending…":e==="sent"?_8:""}const _O=1400,wye=160,E8=g.createContext({values:{}});function T8(){return g.useContext(E8)}function xye(e,t){const n=e.variants;return n?{...e,...n.by[t[n.field]??""]??{}}:e}const EO=(e,t)=>!e.when||e.when.is.includes(t[e.when.field]??"");function vye({def:e,existing:t,busy:n,error:s,onSubmit:a,onCancel:o,onDirtyChange:i}){var B,T;const l=g.useId(),[u,d]=g.useState(()=>Object.fromEntries(e.fields.map(P=>{var q,K,z;return[P.name,P.secret?"":((q=P.initial)==null?void 0:q.call(P,t))??(P.type==="choice"?((z=(K=P.options)==null?void 0:K[0])==null?void 0:z.value)??"":"")]}))),[f,p]=g.useState((t==null?void 0:t.name)??""),m=g.useRef(null),w=g.useRef(new Map),x=!!t,b=g.useRef(u),j=g.useRef(f);g.useEffect(()=>{i==null||i(f!==j.current||Object.keys(u).some(P=>u[P]!==b.current[P]))},[f,u,i]);const k=e.fields.filter(P=>P.type==="choice").every(P=>u[P.name]===b.current[P.name]),v=x&&t.tokenSaved&&k,S=(P,q)=>{n||d(K=>({...K,[P]:q}))},C=P=>{var K;if(P.preventDefault(),n)return;const q={};for(const z of e.fields)EO(z,u)&&(q[z.name]=(u[z.name]??"").trim());(K=P.currentTarget.querySelector('button[type="submit"]'))==null||K.focus(),a(q,f.trim()),d(z=>Object.fromEntries(Object.entries(z).map(([H,D])=>{var O;return[H,(O=e.fields.find(V=>V.name===H))!=null&&O.secret?"":D]})))},_=g.useMemo(()=>{const P=u.baseUrl??"";try{return P?new URL(/^[a-z]+:\/\//i.test(P)?P:`https://${P}`).host:""}catch{return""}},[u.baseUrl]),R=g.useMemo(()=>({values:u,existing:t}),[u,t]),A=e.fields.filter(P=>EO(P,u)),I=(B=A.find(P=>!P.secret&&P.type!=="choice"))==null?void 0:B.name,$=(T=A.find(P=>P.secret))==null?void 0:T.name,U=s!=null&&s.field&&A.some(P=>P.name===s.field&&P.type!=="choice")?s.field:null,F=`${l}-error`;g.useEffect(()=>{var q,K,z;const P=x?$:I??$;P&&((q=w.current.get(P))==null||q.focus()),(z=(K=m.current)==null?void 0:K.scrollIntoView)==null||z.call(K,{block:"nearest"})},[x]),g.useEffect(()=>{var P;U&&((P=w.current.get(U))==null||P.focus())},[s,U]);const M=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(E8.Provider,{value:R,children:r.jsxs("form",{ref:m,className:"ig-form",onSubmit:C,"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:x?`Edit ${t.name}`:`Connect ${e.label}`}),x&&r.jsxs("p",{children:[e.label," connection"]})]})]}),A.map(P=>{const q=xye(P,u),K=(s==null?void 0:s.field)===q.name,z=[q.hint?`${l}-${q.name}-hint`:"",K?F:""].filter(Boolean).join(" ")||void 0;if(q.type==="choice")return r.jsxs("fieldset",{className:"fb-kinds","aria-invalid":K||void 0,children:[r.jsx("legend",{className:"vis-hidden",children:q.label}),(q.options??[]).map(O=>r.jsxs("label",{className:"fb-kind",children:[r.jsx("input",{type:"radio",name:`${l}-${q.name}`,value:O.value,checked:u[q.name]===O.value,"aria-disabled":n||void 0,onChange:()=>S(q.name,O.value),onKeyDown:V=>{HS(V.nativeEvent)&&V.preventDefault()}}),O.label]},O.value))]},q.name);const H=q.secret&&v,D=`${l}-${q.name}`;return r.jsxs("div",{className:"fb-field",children:[r.jsxs("label",{className:"fb-field-label",htmlFor:D,children:[q.label,q.optional&&r.jsx("span",{className:"fb-optional",children:" optional"})]}),r.jsx("input",{id:D,className:`ap-manage-input ig-input${q.secret?" ig-mono":""}`,ref:O=>{O?w.current.set(q.name,O):w.current.delete(q.name)},type:q.type,inputMode:q.type==="url"?"url":q.type==="email"?"email":void 0,autoComplete:q.autoComplete??"off",spellCheck:!1,value:u[q.name]??"",onChange:O=>S(q.name,O.target.value),placeholder:H?"Saved. Leave blank to keep it":q.placeholder,readOnly:n,"aria-invalid":K||void 0,"aria-describedby":z,"aria-required":!q.optional&&!H||void 0}),q.hint&&r.jsx("span",{className:"ig-hint",id:`${l}-${q.name}-hint`,children:q.hint}),K&&U===q.name&&r.jsx("span",{className:"ig-form-error",id:F,role:"alert",children:M})]},q.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:P=>p(P.target.value),placeholder:_||e.label})]}),s&&!U&&r.jsx("p",{className:"ig-form-error",id:F,role:"alert",children:M}),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…":x?"Save":"Connect"}),r.jsx("button",{type:"button",className:"btn","aria-disabled":n||void 0,onClick:()=>{n||o()},children:"Cancel"})]})]})})}const bye="https://id.atlassian.com/manage-profile/security/api-tokens",kye="https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/",jye="https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html",Nye=[{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 Sye(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 Cye(){const{values:e}=T8(),t=e.deployment==="cloud",n=t?null:Sye(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:bye,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:Nye.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:kye,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:jye,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 Y0(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 X0({href:e,children:t}){return e?r.jsxs("a",{className:"fg-token-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t," ",r.jsx(Zl,{})]}):null}function A8({kind:e,baseUrl:t}){const{values:n}=T8();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(X0,{href:Y0("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(X0,{href:Y0("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=Y0("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(X0,{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 R8={name:"token",label:"Personal access token",type:"password",secret:!0,placeholder:"Paste the token"},_ye=[R8],TO=e=>{try{return e?new URL(e.baseUrl).host!=="gitlab.com":!1}catch{return!1}},Eye=[{name:"where",label:"Which GitLab",type:"choice",options:[{value:"cloud",label:"GitLab.com"},{value:"self",label:"Self-managed"}],initial:e=>TO(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=>TO(e)?e.baseUrl:""},R8],Tye=g.createElement(A8,{kind:"github"}),Aye=g.createElement(A8,{kind:"gitlab"}),Rye=e=>{var t;return((t=e==null?void 0:e.meta)==null?void 0:t.deployment)==="cloud"?"cloud":"server"},Mye={kind:"jira",label:"Jira",Glyph:LQ,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:Rye},{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(Cye)},$ye={kind:"github",label:"GitHub",Glyph:IQ,detail:"Repositories, pull requests, and Actions",blurb:"github.com, read-only, with a personal access token.",fields:_ye,tokenHelp:Tye},Lye={kind:"gitlab",label:"GitLab",Glyph:OQ,detail:"Projects, merge requests, and pipelines",blurb:"GitLab.com or your own instance, read-only.",fields:Eye,tokenHelp:Aye},Aj={jira:Mye,github:$ye,gitlab:Lye},zS=()=>Object.values(Aj).filter(e=>!!e);function Tu(e){return(Object.hasOwn(Aj,e)?Aj[e]:void 0)??null}function Km(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(Iye,{name:n(a),onClose:a.onClose})})))}function Iye({name:e,onClose:t}){const n=g.useRef(null),s=gt(t,{focusRef:n}),a=wt(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 M8=()=>gi(()=>import("./IntegrationModal-BbiK7DiR.js"),[]);function Oye(){M8().catch(()=>{})}const Pye=Km(M8,e=>{var t;return((t=Tu(e.kind))==null?void 0:t.label)??"The tracker"});function Dye({onClose:e}){return g.useEffect(()=>ln.push(e,0,"dialog"),[e]),null}function Fye(e){return r.jsx(g.Suspense,{fallback:r.jsx(Dye,{onClose:e.onClose}),children:r.jsx(Pye,{...e})})}class wr extends Error{constructor(n,s,a={}){super(s);Da(this,"kind");Da(this,"status");Da(this,"retryAfter");Da(this,"field");Da(this,"detail");this.name="IntegrationFailure",this.kind=n,Object.assign(this,a)}}async function $8(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 wr(n.kind,n.message,{status:n.status,retryAfter:n.retryAfter,field:n.field,detail:n.detail})}catch{}return new wr(e.status===401?"auth":"upstream",`The deck answered ${e.status}.`)}async function Ld(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(d){throw i!=null&&i.aborted?d:new wr("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 $8(u);return u.json()}const L8=e=>`/api/integrations/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.id)}/`;function xje(e){const t=L8(e);return(n,s)=>fetch(`${t}${n.replace(/^\/+/,"")}`,s)}function vje(e){const t=L8(e);return n=>`${t}asset?url=${encodeURIComponent(n)}`}function bje(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 kje(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 jje(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 wr("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 $8(l);try{return await l.json()}catch{throw new wr("upstream","The deck answered with something that is not JSON.")}}let aa={connections:null,providers:[],error:""};const Cl=new Set;let Ef=null,mu=null,Pl=null,AO=0;const Bye=5e3,qye=3;function Ip(e){aa={...aa,...e},Cl.forEach(t=>t(aa))}function Ym(){return mu||(mu=(async()=>{try{const e=await Ld("/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 wr("upstream","The deck answered with something that is not the list of connections.");Ip({connections:t,providers:n,error:""})}catch(e){Ip({error:e instanceof Error?e.message:"Could not read the connections."}),aa.connections===null&&Cl.size>0&&Pl===null&&AO<qye&&(Pl=window.setTimeout(()=>{Pl=null,Ym()},Bye*2**AO++))}finally{mu=null}})(),mu)}function Uye(e){return e.connections===null||e.providers.length>0||e.connections.length>0}function RO(){Uye(aa)&&Ym()}function VS(e){const t=aa.connections??[],n=t.findIndex(s=>s.id===e.id);Ip({connections:n<0?[...t,e]:t.map(s=>s.id===e.id?e:s)})}function Wye(e){Ip({connections:(aa.connections??[]).filter(t=>t.id!==e)})}function Id(){const[e,t]=g.useState(aa);return g.useEffect(()=>{Cl.add(t),t(aa);const n=()=>{document.visibilityState==="visible"&&RO()};return Cl.size===1&&(Ym(),Ef=window.setInterval(RO,6e4),document.addEventListener("visibilitychange",n)),()=>{Cl.delete(t),Cl.size===0&&(Ef!==null&&window.clearInterval(Ef),Ef=null,Pl!==null&&window.clearTimeout(Pl),Pl=null,document.removeEventListener("visibilitychange",n))}},[]),e}function Op(e,t){return(e.connections??[]).filter(n=>n.kind===t)}function Od(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 na(e,t){return Od(e).has(t)}function Rj(e,t){return na(e,t)&&Op(e,t).length>0}function GS(e){return Od(e).size>0?"all":(e.connections??[]).length>0?"connections":"none"}async function Hye(e,t,n){const s=await Ld("/api/integrations/connections",{method:"POST",body:JSON.stringify({kind:e,name:n,input:t}),timeoutMs:6e4});return VS(s.connection),s.connection}async function zye(e,t){const n=await Ld(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t),timeoutMs:6e4});return VS(n.connection),n}async function Vye(e){const t=await Ld(`/api/integrations/connections/${encodeURIComponent(e)}/test`,{method:"POST",body:"{}",timeoutMs:6e4});return VS(t.connection),t.connection}async function Gye(e){await Ld(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"DELETE"}),Wye(e)}function Uo(e){try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function Nje(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 Pp=null,Dp=null;function MO(e){Dp=null,Pp=e}function Kye(e){Pp=null,Dp=e}function Yye(){const e=Dp;return Dp=null,e}function Xye(){const e=Pp;return Pp=null,e}const Zye={jira:"Boards, sprints, backlog and issues",github:"Repositories, pull requests and Actions",gitlab:"Projects, merge requests and pipelines"},Jye={jira:"Can move issues",github:"Read only",gitlab:"Read only"};function Qye(){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 ewe({integrations:e,onClose:t,onOpen:n,onConnect:s,onManage:a}){const o=gt(t,{restoreFocusFallback:Qye}),i=wt(t),l=zS().filter(f=>e.providers.some(p=>p.kind===f.kind)||Op(e,f.kind).length>0),u=l.filter(f=>Rj(e,f.kind)).length,d=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=na(e,f.kind),m=Rj(e,f.kind),w=Op(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:Zye[f.kind]}),r.jsxs("span",{className:"explore-connection","data-connected":m||void 0,children:[p?m?"Connected":"Not connected":"Unavailable on this deck"," · ",Jye[f.kind]]})]}),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:()=>d(()=>n(f.kind)),children:["Open ",r.jsx(Zl,{})]}),r.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":`Manage ${f.label}`,onClick:()=>d(()=>a(w==null?void 0:w.id)),children:"Manage"})]}):p?r.jsx("button",{type:"button",className:"btn primary","aria-label":`Connect ${f.label}`,onClick:()=>d(()=>s(f.kind)),children:"Connect"}):w?r.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":`Manage ${f.label}`,onClick:()=>d(()=>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:"Browsing only reads · Tokens stay on this machine"}),r.jsxs("button",{type:"button",className:"btn explore-text-action",onClick:()=>d(()=>a()),children:["Manage in Settings ",r.jsx(Zl,{})]})]})]})}),document.body)}function twe({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 I8(e){return e.tool?e.tool.name:e.kind==="asked"?"question":"permission"}const nwe=20;function swe(e,t=nwe){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 rwe(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 awe(e,t,n){const s=t.tool?`on ${t.tool.name}`:t.kind==="asked"?"for an answer":"for permission";return`${e}, waiting ${rwe(n)} ${s}; go to session`}function owe(e){const t=Hl(e),n=RP(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 N8(e){return Lp.find(t=>t.value===e)??Lp[0]}const Tj=3,G0=120,S8=1e4,C8=200,Jge="Write something first.";function NO(e){return e.trim()!==""}function Qge(e){var o;const t=e.trim();if(t==="")return"";const n=SO(t.split(/\r?\n/,1)[0]),s=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,a=K0(s).length>=Tj?K0(s):K0(n);return tye(a.length>=Tj?a:SO(t))}function eye(e,t){const n=Qge(t);return n.length>=Tj?n:`${N8(e).label}: ${n}`}function SO(e){return e.replace(/\s+/g," ").trim()}function K0(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function tye(e){if(e.length<=G0)return e;const t=e.slice(0,G0-1),n=t.lastIndexOf(" ");return`${(n>=G0/2?t.slice(0,n):t).replace(/[\uD800-\uDBFF]$/,"").replace(/[\s,;:.\-–—]+$/,"")}…`}function nye({kind:e,body:t,contact:n}){const s={kind:e,title:eye(e,t),body:t.trim()};return n.trim()!==""&&(s.contact=n.trim()),s}function sye(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 rye={darwin:"macOS",win32:"Windows",linux:"Linux"};function aye(e){const t=e.indexOf("-"),n=t===-1?e:e.slice(0,t),s=t===-1?"":e.slice(t+1),a=rye[n]??n;return s?`${a} · ${s}`:a}function oye(e){return e?`ccdeck ${e.appVersion} · ${aye(e.platform)}`:null}const iye="sent with it",lye="Your ccdeck version and system are sent with it.",cye="Add details",uye="How to reach you",dye="Email or GitHub @name",hye="Only if you would like an answer.",fye=["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 pye(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function HS(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function mye(e){return co(e)?["⌘","Enter"]:["Ctrl","Enter"]}function gye(e){return[...e].length===1}const _8="Thanks — feedback sent.";function CO(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 yye(e){return e==="sending"?"Sending…":e==="sent"?_8:""}const _O=1400,wye=160,E8=g.createContext({values:{}});function T8(){return g.useContext(E8)}function xye(e,t){const n=e.variants;return n?{...e,...n.by[t[n.field]??""]??{}}:e}const EO=(e,t)=>!e.when||e.when.is.includes(t[e.when.field]??"");function vye({def:e,existing:t,busy:n,error:s,onSubmit:a,onCancel:o,onDirtyChange:i}){var B,T;const l=g.useId(),[u,d]=g.useState(()=>Object.fromEntries(e.fields.map(P=>{var q,K,z;return[P.name,P.secret?"":((q=P.initial)==null?void 0:q.call(P,t))??(P.type==="choice"?((z=(K=P.options)==null?void 0:K[0])==null?void 0:z.value)??"":"")]}))),[f,p]=g.useState((t==null?void 0:t.name)??""),m=g.useRef(null),w=g.useRef(new Map),x=!!t,b=g.useRef(u),j=g.useRef(f);g.useEffect(()=>{i==null||i(f!==j.current||Object.keys(u).some(P=>u[P]!==b.current[P]))},[f,u,i]);const k=e.fields.filter(P=>P.type==="choice").every(P=>u[P.name]===b.current[P.name]),v=x&&t.tokenSaved&&k,S=(P,q)=>{n||d(K=>({...K,[P]:q}))},C=P=>{var K;if(P.preventDefault(),n)return;const q={};for(const z of e.fields)EO(z,u)&&(q[z.name]=(u[z.name]??"").trim());(K=P.currentTarget.querySelector('button[type="submit"]'))==null||K.focus(),a(q,f.trim()),d(z=>Object.fromEntries(Object.entries(z).map(([H,D])=>{var O;return[H,(O=e.fields.find(V=>V.name===H))!=null&&O.secret?"":D]})))},_=g.useMemo(()=>{const P=u.baseUrl??"";try{return P?new URL(/^[a-z]+:\/\//i.test(P)?P:`https://${P}`).host:""}catch{return""}},[u.baseUrl]),R=g.useMemo(()=>({values:u,existing:t}),[u,t]),A=e.fields.filter(P=>EO(P,u)),I=(B=A.find(P=>!P.secret&&P.type!=="choice"))==null?void 0:B.name,$=(T=A.find(P=>P.secret))==null?void 0:T.name,U=s!=null&&s.field&&A.some(P=>P.name===s.field&&P.type!=="choice")?s.field:null,F=`${l}-error`;g.useEffect(()=>{var q,K,z;const P=x?$:I??$;P&&((q=w.current.get(P))==null||q.focus()),(z=(K=m.current)==null?void 0:K.scrollIntoView)==null||z.call(K,{block:"nearest"})},[x]),g.useEffect(()=>{var P;U&&((P=w.current.get(U))==null||P.focus())},[s,U]);const M=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(E8.Provider,{value:R,children:r.jsxs("form",{ref:m,className:"ig-form",onSubmit:C,"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:x?`Edit ${t.name}`:`Connect ${e.label}`}),x&&r.jsxs("p",{children:[e.label," connection"]})]})]}),A.map(P=>{const q=xye(P,u),K=(s==null?void 0:s.field)===q.name,z=[q.hint?`${l}-${q.name}-hint`:"",K?F:""].filter(Boolean).join(" ")||void 0;if(q.type==="choice")return r.jsxs("fieldset",{className:"fb-kinds","aria-invalid":K||void 0,children:[r.jsx("legend",{className:"vis-hidden",children:q.label}),(q.options??[]).map(O=>r.jsxs("label",{className:"fb-kind",children:[r.jsx("input",{type:"radio",name:`${l}-${q.name}`,value:O.value,checked:u[q.name]===O.value,"aria-disabled":n||void 0,onChange:()=>S(q.name,O.value),onKeyDown:V=>{HS(V.nativeEvent)&&V.preventDefault()}}),O.label]},O.value))]},q.name);const H=q.secret&&v,D=`${l}-${q.name}`;return r.jsxs("div",{className:"fb-field",children:[r.jsxs("label",{className:"fb-field-label",htmlFor:D,children:[q.label,q.optional&&r.jsx("span",{className:"fb-optional",children:" optional"})]}),r.jsx("input",{id:D,className:`ap-manage-input ig-input${q.secret?" ig-mono":""}`,ref:O=>{O?w.current.set(q.name,O):w.current.delete(q.name)},type:q.type,inputMode:q.type==="url"?"url":q.type==="email"?"email":void 0,autoComplete:q.autoComplete??"off",spellCheck:!1,value:u[q.name]??"",onChange:O=>S(q.name,O.target.value),placeholder:H?"Saved. Leave blank to keep it":q.placeholder,readOnly:n,"aria-invalid":K||void 0,"aria-describedby":z,"aria-required":!q.optional&&!H||void 0}),q.hint&&r.jsx("span",{className:"ig-hint",id:`${l}-${q.name}-hint`,children:q.hint}),K&&U===q.name&&r.jsx("span",{className:"ig-form-error",id:F,role:"alert",children:M})]},q.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:P=>p(P.target.value),placeholder:_||e.label})]}),s&&!U&&r.jsx("p",{className:"ig-form-error",id:F,role:"alert",children:M}),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…":x?"Save":"Connect"}),r.jsx("button",{type:"button",className:"btn","aria-disabled":n||void 0,onClick:()=>{n||o()},children:"Cancel"})]})]})})}const bye="https://id.atlassian.com/manage-profile/security/api-tokens",kye="https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/",jye="https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html",Nye=[{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 Sye(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 Cye(){const{values:e}=T8(),t=e.deployment==="cloud",n=t?null:Sye(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:bye,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:Nye.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:kye,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:jye,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 Y0(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 X0({href:e,children:t}){return e?r.jsxs("a",{className:"fg-token-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t," ",r.jsx(Zl,{})]}):null}function A8({kind:e,baseUrl:t}){const{values:n}=T8();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(X0,{href:Y0("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(X0,{href:Y0("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=Y0("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(X0,{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 R8={name:"token",label:"Personal access token",type:"password",secret:!0,placeholder:"Paste the token"},_ye=[R8],TO=e=>{try{return e?new URL(e.baseUrl).host!=="gitlab.com":!1}catch{return!1}},Eye=[{name:"where",label:"Which GitLab",type:"choice",options:[{value:"cloud",label:"GitLab.com"},{value:"self",label:"Self-managed"}],initial:e=>TO(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=>TO(e)?e.baseUrl:""},R8],Tye=g.createElement(A8,{kind:"github"}),Aye=g.createElement(A8,{kind:"gitlab"}),Rye=e=>{var t;return((t=e==null?void 0:e.meta)==null?void 0:t.deployment)==="cloud"?"cloud":"server"},Mye={kind:"jira",label:"Jira",Glyph:LQ,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:Rye},{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(Cye)},$ye={kind:"github",label:"GitHub",Glyph:IQ,detail:"Repositories, pull requests, and Actions",blurb:"github.com, read-only, with a personal access token.",fields:_ye,tokenHelp:Tye},Lye={kind:"gitlab",label:"GitLab",Glyph:OQ,detail:"Projects, merge requests, and pipelines",blurb:"GitLab.com or your own instance, read-only.",fields:Eye,tokenHelp:Aye},Aj={jira:Mye,github:$ye,gitlab:Lye},zS=()=>Object.values(Aj).filter(e=>!!e);function Tu(e){return(Object.hasOwn(Aj,e)?Aj[e]:void 0)??null}function Km(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(Iye,{name:n(a),onClose:a.onClose})})))}function Iye({name:e,onClose:t}){const n=g.useRef(null),s=gt(t,{focusRef:n}),a=wt(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 M8=()=>gi(()=>import("./IntegrationModal-B8t53aE5.js"),[]);function Oye(){M8().catch(()=>{})}const Pye=Km(M8,e=>{var t;return((t=Tu(e.kind))==null?void 0:t.label)??"The tracker"});function Dye({onClose:e}){return g.useEffect(()=>ln.push(e,0,"dialog"),[e]),null}function Fye(e){return r.jsx(g.Suspense,{fallback:r.jsx(Dye,{onClose:e.onClose}),children:r.jsx(Pye,{...e})})}class wr extends Error{constructor(n,s,a={}){super(s);Da(this,"kind");Da(this,"status");Da(this,"retryAfter");Da(this,"field");Da(this,"detail");this.name="IntegrationFailure",this.kind=n,Object.assign(this,a)}}async function $8(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 wr(n.kind,n.message,{status:n.status,retryAfter:n.retryAfter,field:n.field,detail:n.detail})}catch{}return new wr(e.status===401?"auth":"upstream",`The deck answered ${e.status}.`)}async function Ld(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(d){throw i!=null&&i.aborted?d:new wr("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 $8(u);return u.json()}const L8=e=>`/api/integrations/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.id)}/`;function xje(e){const t=L8(e);return(n,s)=>fetch(`${t}${n.replace(/^\/+/,"")}`,s)}function vje(e){const t=L8(e);return n=>`${t}asset?url=${encodeURIComponent(n)}`}function bje(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 kje(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 jje(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 wr("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 $8(l);try{return await l.json()}catch{throw new wr("upstream","The deck answered with something that is not JSON.")}}let aa={connections:null,providers:[],error:""};const Cl=new Set;let Ef=null,mu=null,Pl=null,AO=0;const Bye=5e3,qye=3;function Ip(e){aa={...aa,...e},Cl.forEach(t=>t(aa))}function Ym(){return mu||(mu=(async()=>{try{const e=await Ld("/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 wr("upstream","The deck answered with something that is not the list of connections.");Ip({connections:t,providers:n,error:""})}catch(e){Ip({error:e instanceof Error?e.message:"Could not read the connections."}),aa.connections===null&&Cl.size>0&&Pl===null&&AO<qye&&(Pl=window.setTimeout(()=>{Pl=null,Ym()},Bye*2**AO++))}finally{mu=null}})(),mu)}function Uye(e){return e.connections===null||e.providers.length>0||e.connections.length>0}function RO(){Uye(aa)&&Ym()}function VS(e){const t=aa.connections??[],n=t.findIndex(s=>s.id===e.id);Ip({connections:n<0?[...t,e]:t.map(s=>s.id===e.id?e:s)})}function Wye(e){Ip({connections:(aa.connections??[]).filter(t=>t.id!==e)})}function Id(){const[e,t]=g.useState(aa);return g.useEffect(()=>{Cl.add(t),t(aa);const n=()=>{document.visibilityState==="visible"&&RO()};return Cl.size===1&&(Ym(),Ef=window.setInterval(RO,6e4),document.addEventListener("visibilitychange",n)),()=>{Cl.delete(t),Cl.size===0&&(Ef!==null&&window.clearInterval(Ef),Ef=null,Pl!==null&&window.clearTimeout(Pl),Pl=null,document.removeEventListener("visibilitychange",n))}},[]),e}function Op(e,t){return(e.connections??[]).filter(n=>n.kind===t)}function Od(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 na(e,t){return Od(e).has(t)}function Rj(e,t){return na(e,t)&&Op(e,t).length>0}function GS(e){return Od(e).size>0?"all":(e.connections??[]).length>0?"connections":"none"}async function Hye(e,t,n){const s=await Ld("/api/integrations/connections",{method:"POST",body:JSON.stringify({kind:e,name:n,input:t}),timeoutMs:6e4});return VS(s.connection),s.connection}async function zye(e,t){const n=await Ld(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t),timeoutMs:6e4});return VS(n.connection),n}async function Vye(e){const t=await Ld(`/api/integrations/connections/${encodeURIComponent(e)}/test`,{method:"POST",body:"{}",timeoutMs:6e4});return VS(t.connection),t.connection}async function Gye(e){await Ld(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"DELETE"}),Wye(e)}function Uo(e){try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function Nje(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 Pp=null,Dp=null;function MO(e){Dp=null,Pp=e}function Kye(e){Pp=null,Dp=e}function Yye(){const e=Dp;return Dp=null,e}function Xye(){const e=Pp;return Pp=null,e}const Zye={jira:"Boards, sprints, backlog and issues",github:"Repositories, pull requests and Actions",gitlab:"Projects, merge requests and pipelines"},Jye={jira:"Can move issues",github:"Read only",gitlab:"Read only"};function Qye(){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 ewe({integrations:e,onClose:t,onOpen:n,onConnect:s,onManage:a}){const o=gt(t,{restoreFocusFallback:Qye}),i=wt(t),l=zS().filter(f=>e.providers.some(p=>p.kind===f.kind)||Op(e,f.kind).length>0),u=l.filter(f=>Rj(e,f.kind)).length,d=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=na(e,f.kind),m=Rj(e,f.kind),w=Op(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:Zye[f.kind]}),r.jsxs("span",{className:"explore-connection","data-connected":m||void 0,children:[p?m?"Connected":"Not connected":"Unavailable on this deck"," · ",Jye[f.kind]]})]}),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:()=>d(()=>n(f.kind)),children:["Open ",r.jsx(Zl,{})]}),r.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":`Manage ${f.label}`,onClick:()=>d(()=>a(w==null?void 0:w.id)),children:"Manage"})]}):p?r.jsx("button",{type:"button",className:"btn primary","aria-label":`Connect ${f.label}`,onClick:()=>d(()=>s(f.kind)),children:"Connect"}):w?r.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":`Manage ${f.label}`,onClick:()=>d(()=>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:"Browsing only reads · Tokens stay on this machine"}),r.jsxs("button",{type:"button",className:"btn explore-text-action",onClick:()=>d(()=>a()),children:["Manage in Settings ",r.jsx(Zl,{})]})]})]})}),document.body)}function twe({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 I8(e){return e.tool?e.tool.name:e.kind==="asked"?"question":"permission"}const nwe=20;function swe(e,t=nwe){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 rwe(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 awe(e,t,n){const s=t.tool?`on ${t.tool.name}`:t.kind==="asked"?"for an answer":"for permission";return`${e}, waiting ${rwe(n)} ${s}; go to session`}function owe(e){const t=Hl(e),n=RP(e,t);return n?`${t}
|
|
113
113
|
${n}`:t}const iwe=new Set(["idle","checking","current","downloading","ready","error"]);function $O(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.status!="string"||!iwe.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 lwe(e){return(e==null?void 0:e.status)==="ready"&&e.version?{version:e.version}:null}function O8(e=typeof navigator>"u"?"":navigator.userAgent){var t;return((t=/\bccdeck-desktop\/(\d[^\s]*)/.exec(e))==null?void 0:t[1])??null}const Jl="Restart to update",P8=3e4;function D8(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 cwe(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 ${Jl} comes first`}}function F8(e,t=!1){return{text:t?"Restarting…":Jl,label:t?void 0:`${Jl} 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 uwe(e){const t=e==null?void 0:e.reason;return t==="app_disconnected"||t==="update_not_ready"?t:"refused"}function B8(e,t,n=typeof navigator>"u"?"":navigator.userAgent){const s=D8(n),a=`Use ${Jl} 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, ${Jl} is in ${s}.`;case"timeout":return`ccdeck has not restarted after ${P8/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 dwe="Update checks are off (AGENTS_DECK_NO_UPDATE_CHECK=1)",Z0="click for what's new";function hwe(e){if(e.checkDisabled)return`${dwe} · ${Z0}`;if(e.checking)return`Asking npm for the newest release… · ${Z0}`;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 · ${Z0}, and to check npm now`}function fwe(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 pwe(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 q8(e){return e?`${e.kind}:${e.to}`:""}function mwe(e,t){return e!=null&&t!==q8(e)}function gwe({readyAppUpdate:e,notice:t,noticeOpen:n,version:s,chipVersion:a,versionChecking:o,now:i,openReleaseNotes:l,showNotice:u,loadVersion:d,restartToUpdate:f,updateRestarting:p=!1}){return r.jsx(r.Fragment,{children:e?(()=>{const m=cwe(O8()??a,e.version),w=f&&F8(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":pwe({...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?op(i-s.checkedAt):null,checkFailedAgo:s!=null&&s.checkFailedAt&&s.checkFailedAt>(s.checkedAt??0)?op(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(),d(!0)},"aria-busy":o||void 0,"aria-haspopup":"dialog","aria-label":fwe(m),title:hwe(m),children:["v",m.running]})})()})}function ywe({live:e,paused:t,pauseGate:n}){const s=An();return r.jsx("span",{className:"status",children:(()=>{const a=GY({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 wwe(e,t){return`${e.label} — ${I8(e.waiting)} · ${rd(e.waiting.since,void 0,t)}`}function U8(e,t){const n=e.slice(0,6).map(s=>wwe(s,t));return e.length>6&&n.push(`and ${e.length-6} more`),n.join(`
|
|
114
114
|
`)}function xwe({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:s,named:a}){const o=An(),i=oc("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?U8(l,s):void 0}),children:[r.jsx("span",{className:"ap-pulse","aria-hidden":!0}),r.jsx("b",{children:u})," waiting"]}),i.node]})}function LO({w:e,now:t}){return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"we-name",children:swe(e.label)}),r.jsx("span",{className:"we-wait",children:rd(e.waiting.since,void 0,t)}),r.jsxs("span",{className:"we-what",children:["· ",I8(e.waiting)]})]})}const vwe=12,bwe=2e3,kwe=4;function jwe({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:s,onFit:a,onMore:o}){const i=An(),l=oc("below"),u=g.useRef(null),d=g.useRef(null),[f,p]=g.useState(0),m=e.map(j=>j.id).join(`
|
|
115
115
|
`);g.useLayoutEffect(()=>{const j=u.current,k=d.current;if(!j||!k)return;const v=()=>{const C=Array.from(k.children),_=C.pop();p(twe({widths:C.map(R=>R.getBoundingClientRect().width),room:j.clientWidth-vwe,gap:kwe,more:(_==null?void 0:_.getBoundingClientRect().width)??0}))};if(v(),typeof ResizeObserver>"u")return;const S=new ResizeObserver(v);return S.observe(j),S.observe(k),()=>S.disconnect()},[m]);const w=e.slice(0,f),x=e.slice(f);g.useEffect(()=>{a(w.length)},[w.length,a]);const b=j=>{t.current=j,n(j)};return r.jsxs("div",{className:"wait-names",ref:u,children:[r.jsxs("ul",{className:"wait-list",children:[w.map(j=>r.jsx("li",{"data-fresh":s-j.waiting.since<bwe||void 0,children:r.jsx("button",{type:"button",className:"wait-entry",onClick:()=>b(j.id),"aria-label":awe(j.label,j.waiting,s-j.waiting.since),...l.bind({label:j.label,detail:owe(j.waiting)}),children:r.jsx(LO,{w:j,now:s})})},j.id)),w.length>0&&x.length>0&&r.jsx("li",{children:r.jsxs("button",{type:"button",className:"wait-more",onClick:o,"aria-label":`${x.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:U8(x,s)}),children:["+",x.length," more"]})})]}),e.length>0&&r.jsxs("span",{className:"wait-ruler",ref:d,"aria-hidden":!0,children:[e.map(j=>r.jsx("span",{className:"wait-entry",children:r.jsx(LO,{w:j,now:s})},j.id)),r.jsxs("span",{className:"wait-more",children:["+",e.length," more"]})]}),l.node]})}const Mj={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 Nwe(e){return e==="on"?`Notifications on. ${Mj.on}.`:e==="blocked"?`${Mj.blocked}.`:""}function Swe({notifySaid:e}){return r.jsx("span",{className:e==="on"?"notify-said":"notify-said notify-said-blocked","aria-hidden":!0,title:Mj[e],children:e==="on"?"notifications on":"notifications blocked"})}function Cwe({versionCheck:e,welcome:t,desktopUpdate:n,pause:s,announcements:a,notify:o,waitingSessions:i,waitingCursorRef:l,focusSession:u,live:d,now:f,incidents:p,queueNamed:m}){const{version:w,notice:x,noticeOpen:b,showNotice:j,versionChecking:k,loadVersion:v}=e,{chipVersion:S,openReleaseNotes:C}=t,{readyAppUpdate:_,desktopUpdateRestarting:R,desktopUpdateFailure:A,askDesktopUpdateRestart:I}=n,$=g.useRef(!1);g.useEffect(()=>{R||!$.current||($.current=!1,A&&C())},[R,A,C]);const U=K=>{$.current=!0,I(K)},{paused:F,pauseGate:M}=s,{blockedSaid:B,watchSaid:T,incidentSaid:P}=a,{notifySaid:q}=o;return r.jsxs("div",{className:"readout",children:[r.jsxs("div",{className:"brand",children:[r.jsx("img",{className:"logo logo-on-dark",src:Kne,width:19,height:16,alt:""}),r.jsx("img",{className:"logo logo-on-light",src:Yne,width:19,height:16,alt:""}),r.jsx("h1",{children:Pt}),r.jsx(gwe,{readyAppUpdate:_,notice:x,noticeOpen:b,version:w,chipVersion:S,versionChecking:k,now:f,openReleaseNotes:C,showNotice:j,loadVersion:v,restartToUpdate:U,updateRestarting:R})]}),r.jsx(ywe,{live:d,paused:F,pauseGate:M}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:B}),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:P}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Nwe(q)}),r.jsx(ase,{incidents:p}),i.length>0&&r.jsx(xwe,{waitingSessions:i,waitingCursorRef:l,focusSession:u,now:f,named:m}),q&&r.jsx(Swe,{notifySaid:q})]})}function _we({selected:e,now:t,selectedIds:n,focusAgent:s,clearSelection:a}){const o=An(),i=Wn(e),l=Math.max(0,((e.endedAt??t)-e.startedAt)/1e3),u=e.state==="active"&&!e.synthetic?yN(i.total,l):null,d=n.size-1;return r.jsxs("button",{type:"button",className:"selected-ribbon",title:`${En(`Zoom to ${e.label} and its session`,"Z",o)}${i.total>0?`
|
|
116
116
|
${lt(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:[lt(i.total),u?r.jsxs("span",{className:"selected-rate",children:[" · ",u]}):null]}),d>0&&r.jsxs("span",{className:"selected-extra",children:["+",d]}),r.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:f=>{f.stopPropagation(),a()},children:"×"})]})}function Ewe({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"} ${$p[o]} tools`,children:[r.jsx(Uge,{cat:o}),r.jsx("span",{className:"cat-name",children:$p[o]})]},o)})})}const Twe=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(",");function Awe(e){var n,s;const t=e.target;!(t!=null&&t.closest)||t.closest(Twe)!==e.currentTarget||(e.preventDefault(),(s=(n=document.activeElement)==null?void 0:n.blur)==null||s.call(n))}function Rwe({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"?`${En("The session list","L",a)} brings it back`:"The session keeps running"})]})]})}function Mwe({canvasRef:e,bubbling:t,dragging:n,trash:s,zoom:a,viewport:o,stateRef:i,peek:l,children:u}){const{trashDragging:d,trashState:f,trashPhase:p,trashZoneRef:m,trashLabel:w}=s,{lod:x,lodRef:b}=a,{markCanvasInput:j}=o,{peekAgent:k,peekLabel:v,peekRecap:S,peekBounds:C}=l;return r.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${t?" bubbling":""}${n?" dragging-any":""}${d&&f==="over"?" trash-hover":""}`,"data-lod":x,ref:e,onMouseDownCapture:Awe,onPointerDownCapture:j,onPointerUpCapture:j,onWheelCapture:j,onFocusCapture:_=>{const R=_.target;if(!BS(R)||b.current==null||b.current==="detail")return;const A=R.getAttribute("data-id");A&&i.current.agents.has(A)&&R.matches(":focus-visible")&&a8(A,R,"focus")},onBlurCapture:_=>{var A,I;const R=(I=(A=_.target).getAttribute)==null?void 0:I.call(A,"data-id");R&&ro(R)},children:[u,Ya(p)&&r.jsx(Rwe,{trashZoneRef:m,trashState:f,trashPhase:p,trashLabel:w}),r.jsx(fme,{agentFor:k,recapFor:S,labelFor:v,bounds:C})]})}function $we({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=zY({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 Lwe({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 W8="Thanks — that helps.",Iwe=Array.from({length:11},(e,t)=>t);function Owe(e){return e===0?"0 out of 10, not useful":e===10?"10 out of 10, extremely useful":`${e} out of 10`}const Pwe=6;function Dwe(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 Fwe(){var e;(e=document.getElementById("canvas"))==null||e.focus()}function Bwe({phase:e,score:t,onAnswer:n,onLater:s,onClose:a,onFeedback:o,onHold:i}){const l=Dwe(e),u=g.useRef(null),d=g.useRef(null),f=g.useRef(!1);g.useEffect(()=>{var m,w;e!=="thanks"||!f.current||(f.current=!1,Hn(((m=document.activeElement)==null?void 0:m.tagName)??null)&&((w=u.current??d.current)==null||w.focus()))},[e]);const p=m=>{var w;(w=l.current)!=null&&w.contains(document.activeElement)&&Fwe(),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:W8}),t!==null&&t<=Pwe?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:d,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:Iwe.map(m=>r.jsx("button",{type:"button",className:"rating-pick","aria-label":Owe(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 qwe=3e4;function Uwe({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function Wwe({bundle:e,running:t,pending:n,lastTried:s}){return t?Uwe({bundle:e,running:t,lastTried:s})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function Hwe(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function zwe({asked:e,reported:t}){return t?t!==e:!1}function H8(e){const t=e.thresholdMs??qwe;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 Vwe(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 Gwe(e,t){return e?t==null?"auto when idle":`auto in ${Vwe(t)}`:"auto-restart off"}function IO(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function Kwe(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 Ywe(e){const t=H8(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 $j={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 Xwe({notice:e,version:t,dismissNotice:n,upgradeState:s,startUpgrade:a,copyCommand:o,cmdCopied:i,autoRestart:l,toggleAutoRestart:u,askRestart:d,restartCopy:f,restartFuseMs:p,restarting:m}){var w,x,b;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:()=>d(),...qn(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:Gwe(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,...qn(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:()=>d({upgrade:!0}),...qn(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:((x=t==null?void 0:t.upgrade)==null?void 0:x.error)??"",children:[(t==null?void 0:t.upgradeMode)==="npx"?"update failed":"install failed",": ",((b=t==null?void 0:t.upgrade)==null?void 0:b.error)??"unknown error"," — run it yourself:"]}):(t==null?void 0:t.upgradeMode)==="npx"?r.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?"npx cannot upgrade in place, so the deck re-runs:":$j.npx}):t!=null&&t.upgradeBlocked?r.jsx("span",{className:"ver-sub",children:Kt($j,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 Zwe({restart:e,versionCheck:t,upgrade:n,oldNameNotice:s,rating:a,onFeedback:o,everConnected:i,live:l,paused:u}){const{autoRestart:d,toggleAutoRestart:f,restarting:p,restartMode:m,restartedTo:w,askRestart:x,restartCopy:b,restartFuseMs:j}=e,{version:k,notice:v,noticeOpen:S,dismissNotice:C}=t,{upgradeState:_,startUpgrade:R,copyCommand:A,cmdCopied:I}=n,{oldName:$,oldNameOpen:U,dismissOldName:F}=s,{ratingPhase:M,ratingScore:B,answerRating:T,rateLater:P,closeRating:q,holdThanks:K}=a,z=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($we,{restarting:p,restartMode:m,live:l,paused:u}):S&&v?r.jsx(Xwe,{notice:v,version:k,dismissNotice:C,upgradeState:_,startUpgrade:R,copyCommand:A,cmdCopied:I,autoRestart:d,toggleAutoRestart:f,askRestart:x,restartCopy:b,restartFuseMs:j,restarting:p}):U&&$?r.jsx(Lwe,{oldName:$,version:k,dismissOldName:F}):M!=="hidden"?r.jsx(Bwe,{phase:M,score:B,onAnswer:T,onLater:P,onClose:q,onFeedback:o,onHold:K}):null;return r.jsxs(r.Fragment,{children:[z,r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:M==="thanks"?W8:""})]})}function Jwe(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function Qwe(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 exe(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function txe(e,t){const n=exe(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 nxe({agentCount:e,onConfirm:t,onCancel:n}){const s=g.useRef(null),a=gt(n,{focusRef:s,layer:GG}),o=wt(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(Qwe(w))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:d,final:f,confirm:p}=txe(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:d.length>0?d.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 sxe({kind:e,onChange:t}){return r.jsxs("fieldset",{className:"fb-kinds",children:[r.jsx("legend",{className:"vis-hidden",children:"Kind of feedback"}),Lp.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=>{HS(s.nativeEvent)&&s.preventDefault()}}),n.label]},n.value))]})}const z8="fb-details";function rxe({open:e,onToggle:t}){return r.jsxs("button",{type:"button",className:"fb-tool fb-more","aria-expanded":e,"aria-controls":z8,onClick:t,children:[cye,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 axe({open:e,contact:t,onContact:n}){const s=g.useId();return r.jsx("div",{id:z8,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:[uye,r.jsx("span",{className:"fb-optional",children:"optional"})]}),r.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:t,maxLength:C8,autoComplete:"email",placeholder:dye,"aria-describedby":s,onChange:a=>n(a.target.value),onKeyDown:a=>{HS(a.nativeEvent)&&a.preventDefault()}}),r.jsx("p",{id:s,className:"fb-hint",children:hye})]}),r.jsx("div",{className:"fb-where",children:fye.map(a=>r.jsx("p",{children:a},a))})]})})})}const Jo=3,oxe=5*1024*1024,ixe=12*1024*1024,Lj=8192,lxe=64*1024,cxe=256*1024,uxe=.92,dxe=640,V8=.9,hxe=.85,fxe=6,pxe=512*1024,Fp={png:"image/png",jpeg:"image/jpeg"},mxe={png:"png",jpeg:"jpg"},gxe=[137,80,78,71,13,10,26,10],yxe=[255,216,255];function G8(e){const t=n=>e.length>=n.length&&n.every((s,a)=>e[a]===s);return t(gxe)?"png":t(yxe)?"jpeg":null}function wxe(e){const t=G8(e);return t==="png"?xxe(e):t==="jpeg"?bxe(e):null}function xxe(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 vxe(e){return e>=192&&e<=207&&e!==196&&e!==200&&e!==204}function bxe(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(vxe(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 OO(e,t){return e.bytes>t||e.width>Lj||e.height>Lj}function kxe(e){return Math.min(oxe,ixe-lxe-e)}function K8(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function jxe(e,t){const n=Lj/Math.max(e.width,e.height),s=e.bytes>t?Math.sqrt(t/e.bytes)*V8:1;return K8(e,Math.min(1,n,s))}async function Nxe(e,t,n){let s=jxe(e,t),a=e.format;for(let o=0;o<fxe;o++){const i=await n(s,a,a==="jpeg"?uxe:void 0);if(!i)return null;if(i.size<=t)return{...s,blob:i,format:a};if(a==="png"){a="jpeg";continue}if(s=K8(s,Math.min(hxe,Math.sqrt(t/i.size)*V8)),Math.max(s.width,s.height)<dxe)return null}return null}async function Sxe(e,t,n){const s=new Uint8Array(await e.slice(0,pxe).arrayBuffer()),a=G8(s);if(!a)return{ok:!1,problem:"type"};if(t<cxe)return{ok:!1,problem:"no_room"};const o=e.type===Fp[a]?e:new Blob([e],{type:Fp[a]}),i=wxe(s);if(i&&!OO({...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(!OO(u,t))return{ok:!0,blob:o,resized:null};const d=await Nxe(u,t,l.encoder);return d?{ok:!0,blob:d.blob,resized:{width:d.width,height:d.height}}:{ok:!1,problem:"too_large"}}finally{l.release()}}function Cxe(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)},Fp[s],a)})}const _xe=async e=>{const t=await createImageBitmap(e);return{width:t.width,height:t.height,encoder:Cxe(t),release:()=>t.close()}};function Exe(e){return e.includes("Files")}function Txe({files:e,hasText:t,intoTextField:n}){return e>0&&(!t||!n)}function Axe(e,t){const n=e.indexOf(t);return e[n+1]??e[n-1]??null}function Rxe(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===Fp.jpeg?"jpeg":"png";n.append("images",s,`image-${a+1}.${mxe[o]}`)}),{method:"POST",body:n}}const Mxe="Add screenshot",PO="PNG or JPEG, up to three. You can also paste one, or drop it on this dialog.",$xe="A screenshot can show emails, costs and paths. Crop out what should not be seen.",DO="Three images at most. Remove one to add another.",Lxe="An image could not be attached, so nothing was sent. Check the images and send again; your text is still here.";function Ixe(e,t,n){const s=n?`, resized to ${n.width} × ${n.height} to fit`:"";return`Replace image ${e+1}: ${t}${s}`}function Oxe(e,t){const n=`${e} of ${Jo}`;return t>0?`${n} · ${t} resized to fit`:n}function Pxe(e){return`Three images at most, so ${e===1?"one was":`${e} were`} left out.`}function Dxe(e){return`“${e.length>40?`${e.slice(0,30)}…${e.slice(-9)}`:e}”`}function Fxe(e,t){const n=Dxe(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 Y8="image/png,image/jpeg";function X8({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 Bxe({images:e,buttonRef:t}){const n=g.useRef(null),s=e.shots.length>=Jo;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:PO,"aria-describedby":"fb-attach-hint",onClick:()=>{var a;return s?e.sayFull():(a=n.current)==null?void 0:a.click()},children:[r.jsx(X8,{}),Mxe]}),r.jsx("span",{id:"fb-attach-hint",hidden:!0,children:PO}),r.jsx("input",{ref:n,type:"file",accept:Y8,multiple:!0,hidden:!0,onChange:a=>{e.add(Array.from(a.target.files??[])),a.target.value=""}})]})}function qxe({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,d=Oxe(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(Axe(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:Y8,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":Ixe(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:x=>{x?n.current.set(m.id,x):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:d})]}),r.jsx("p",{className:"fb-hint",children:$xe})]}),e.problem&&r.jsx("p",{ref:s,className:"fb-error",role:"alert",children:e.problem},e.problemId)]})}function Uxe(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 Wxe(e,t,n){return n?e.map(s=>s.id===t.id?t:s):[...e,t]}function Hxe(e,t,n){return n?e.map(s=>s.id===t?n:s):e.filter(s=>s.id!==t)}function zxe(e){const[t,n]=g.useState(()=>Uxe((e==null?void 0:e.ready)??[],1)),[s,a]=g.useState({problem:"",id:0}),o=g.useRef(0),i=g.useCallback(M=>{M&&o.current++,a(B=>M?{problem:M,id:B.id+1}:B.problem?{problem:"",id:B.id}:B)},[]),[l,u]=g.useState(""),d=g.useRef(t),f=g.useRef(null),p=g.useRef(t.length),m=g.useRef(!0),w=g.useRef(new Map),x=g.useRef([]),b=g.useRef(0),j=g.useCallback(M=>{d.current=M(d.current),n(d.current)},[]);g.useEffect(()=>(m.current=!0,()=>{m.current=!1;for(const M of d.current)URL.revokeObjectURL(M.url)}),[]);const k=g.useCallback(async(M,B)=>{const T=d.current.reduce((Z,W)=>{var X;return Z+(W.id===(B==null?void 0:B.id)?0:((X=W.blob)==null?void 0:X.size)??0)},0),P=(B==null?void 0:B.id)??++p.current,q=URL.createObjectURL(M),K={id:P,name:M.name||"image",url:q,blob:null,resized:null},z=b.current;w.current.set(P,M);let H=!1;const D=()=>{H||(H=!0,j(Z=>Wxe(Z,K,B!==void 0)))},O=await Sxe(M,kxe(T),async Z=>(D(),_xe(Z))).catch(()=>({ok:!1,problem:"unreadable"})),V=d.current.some(Z=>Z.id===P);return!m.current||b.current!==z||!V&&(H||B)?(URL.revokeObjectURL(q),B&&URL.revokeObjectURL(B.url),m.current&&w.current.delete(P),""):(w.current.delete(P),O.ok?(D(),B&&URL.revokeObjectURL(B.url),j(Z=>Z.map(W=>W.id===P?{...W,blob:O.blob,resized:O.resized}:W)),""):(URL.revokeObjectURL(q),H&&j(Z=>Hxe(Z,P,B)),Fxe(O.problem,M.name||"image")))},[j]),v=g.useCallback(async M=>{i("");const B=b.current,T=[];let P=0,q=0;for(const z of M){if(!m.current||b.current!==B)return;const H=x.current.indexOf(z);if(H!==-1&&x.current.splice(H,1),d.current.length>=Jo){P++;continue}const D=d.current.length,O=await k(z);O&&T.push(O),d.current.length>D&&q++}if(!m.current||b.current!==B)return;P>0&&T.push(q===0&&T.length===0?DO:Pxe(P)),i(T.join(" "));const K=d.current.length;q>0&&u(`${q===1?"Image":`${q} images`} added, ${K} of ${Jo}.`)},[k,i]),S=g.useCallback(async(M,B)=>{i("");const T=d.current.find(K=>K.id===M);if(!T)return v([B]);const P=await k(B,T);if(!m.current)return;i(P);const q=d.current.findIndex(K=>K.id===M);!P&&q!==-1&&u(`Image ${q+1} replaced, ${d.current.length} of ${Jo}.`)},[v,k,i]),C=g.useCallback(M=>{const B=b.current;f.current=(f.current??Promise.resolve()).then(()=>b.current===B?M():void 0).catch(()=>{})},[]),_=g.useCallback(M=>{M.length!==0&&(x.current.push(...M),C(()=>v(M)))},[v,C]);g.useEffect(()=>{e&&e.waiting.length>0&&_(e.waiting)},[]);const R=g.useCallback((M,B)=>{const T=B[0];T&&C(()=>S(M,T))},[C,S]),A=g.useCallback(M=>{const B=d.current.find(T=>T.id===M);B&&(URL.revokeObjectURL(B.url),w.current.delete(M),j(T=>T.filter(P=>P.id!==M)),i(""),u(`Image removed, ${d.current.length} of ${Jo}.`))},[j,i]),I=g.useCallback(()=>i(DO),[i]),$=g.useCallback(async()=>{const M=o.current;return await f.current,o.current!==M?null:d.current.flatMap(B=>B.blob?[B.blob]:[])},[]),U=g.useCallback(()=>({ready:d.current.flatMap(M=>M.blob&&!w.current.has(M.id)?[{name:M.name,blob:M.blob,resized:M.resized}]:[]),waiting:[...w.current.values(),...x.current]}),[]),F=g.useCallback(()=>{b.current++;for(const M of d.current)URL.revokeObjectURL(M.url);w.current.clear(),x.current=[],j(()=>[]),i("")},[j,i]);return{shots:t,problem:s.problem,problemId:s.id,announcement:l,add:_,replace:R,remove:A,sayFull:I,ready:$,kept:U,clear:F}}function Vxe(){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(sye(s))}).catch(()=>{}),()=>{n=!1}},[]),e}function Gxe(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(!_n(s.current))return;s.current=!0;const{signal:u}=a.current=new AbortController;n({state:"sending"});try{const d=await e.ready();if(u.aborted)return;if(!d){n({state:"failed",message:Lxe});return}const f=await fetch("/api/feedback",{...Rxe(nye(l),d),signal:u}),p=await f.json().catch(()=>null);n(f.ok&&(p!=null&&p.ok)?{state:"sent"}:{state:"failed",message:CO(f.status,p==null?void 0:p.reason,p==null?void 0:p.errors)})}catch{u.aborted||n({state:"failed",message:CO(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 Kxe(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),_O),i=window.setTimeout(()=>a.current(),_O+wye);return()=>{window.clearTimeout(o),window.clearTimeout(i)}},[e]),n}const J0="agent-dag.feedbackDrafts",FO=4;function Yxe({initialKind:e,initialBody:t}){return{kind:e??"bug",body:t??""}}function Xxe(e){return JSON.stringify([e.kind,e.body])}function Zxe(e){return e.ready.length+e.waiting.length}function Z8(e,t){return e.body.trim()!==t.body.trim()||e.contact.trim()!==""||e.images>0}function Jxe(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 Qxe="Discard",eve="Confirm discard",tve="Clear the message, the screenshots and the contact",BO="Press again to clear this draft. It cannot be brought back.",nve={ready:[],waiting:[]};function sve(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!Lp.some(i=>i.value===n)||typeof s!="string"||s.length>S8||typeof a!="string"||a.length>C8||typeof o!="number"||!Number.isInteger(o)||o<0||o>Jo?null:[e[0],{kind:n,body:s,contact:a,images:o}]}function rve(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(J0),l=i?JSON.parse(i):[];if(Array.isArray(l))for(const u of l.slice(-FO)){const d=sve(u);d&&t.set(d[0],{...d[1],images:null,imageCount:d[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(J0):o.setItem(J0,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??nve,imagesLost:i.images?0:i.imageCount}:null},keep(o,i,l){const u=Zxe(i.images);if(!Z8({body:i.body,contact:i.contact,images:u},l)){a(o);return}const d=n();d.delete(o),d.set(o,{kind:i.kind,body:i.body,contact:i.contact,images:i.images,imageCount:u});for(const f of d.keys()){if(d.size<=FO)break;d.delete(f)}s()},forget:a}}function ave(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}const Ij=rve(ave),ove=4e3;function ive(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||Ij.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&&Ij.forget(e)},[a,e])}const qO="draft";function lve(e){const[t,n]=g.useState(!1),s=g.useRef(0);g.useEffect(()=>{if(!t)return;const o=window.setTimeout(()=>n(!1),ove);return()=>window.clearTimeout(o)},[t]);function a(){const o=Date.now(),i=fi({armedFor:t?qO:null,target:qO,armedAt:s.current,now:o,gapMs:hi});if(i==="arm"){n(!0),s.current=o;return}i!=="ignore"&&(n(!1),e())}return{armed:t,press:a}}function J8({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),d=g.useRef(null),f=g.useRef(null),p=g.useRef(0),m=gt(e,{focusRef:s}),w=wt(e),x=Yxe({initialKind:t,initialBody:n}),b=Xxe(x),[j]=g.useState(()=>Ij.read(b)),[k,v]=g.useState((j==null?void 0:j.kind)??x.kind),[S,C]=g.useState((j==null?void 0:j.body)??x.body),[_,R]=g.useState((j==null?void 0:j.contact)??""),[A,I]=g.useState((j==null?void 0:j.imagesLost)??0),[$,U]=g.useState(!1),[F,M]=g.useState(!1),[B,T]=g.useState(!1),P=zxe(j==null?void 0:j.images),q=oye(Vxe()),{outcome:K,sending:z,send:H,clearFailure:D}=Gxe(P),O=K.state==="sent",V=Kxe(O,e);ive(b,x,{kind:k,body:S,contact:_},P,O);const Z=Z8({body:S,contact:_,images:P.shots.length},x),W=lve(()=>{var ke;v(x.kind),C(x.body),R(""),I(0),M(!1),P.clear(),D(),(ke=s.current)==null||ke.focus()}),X=N8(k),Y=F&&!NO(S),J=A>0&&P.shots.length===0,Q=[Y&&"fb-body-error",J&&"fb-images-lost"].filter(Boolean).join(" ")||void 0,[te,le]=mye(to());g.useEffect(()=>{var De,Ue;const ke=i.current;if(!ke)return;const Ie=ke.contains(document.activeElement)||Hn(((De=document.activeElement)==null?void 0:De.tagName)??null);ke.inert=O,O&&Ie&&((Ue=a.current)==null||Ue.focus())},[O]),g.useEffect(()=>{var Ke,we;const ke=l.current;if(!ke)return;const Ie=d.current;if(z){const Fe=document.activeElement,Re=Fe!=null&&(ke.contains(Fe)||Fe===Ie);f.current=Re?Fe:null,ke.inert=!0,Ie&&(Ie.inert=!0),f.current&&((Ke=u.current)==null||Ke.focus());return}ke.inert=!1,Ie&&(Ie.inert=!1);const De=f.current;f.current=null;const Ue=document.activeElement===u.current||Hn(((we=document.activeElement)==null?void 0:we.tagName)??null);!O&&De&&Ue&&De.focus()},[z,O]);function de(ke){var Ie;if(ke.preventDefault(),!NO(S)){M(!0),(Ie=s.current)==null||Ie.focus();return}H({kind:k,body:S,contact:_})}const oe=!O&&!z,re=ke=>Exe(Array.from(ke.dataTransfer.types));function he(ke){!re(ke)||!oe||(ke.preventDefault(),p.current++,T(!0))}function fe(ke){re(ke)&&(ke.preventDefault(),ke.dataTransfer.dropEffect=oe?"copy":"none")}function $e(ke){re(ke)&&(p.current=Math.max(0,p.current-1),p.current===0&&T(!1))}function ye(ke){re(ke)&&(ke.preventDefault(),p.current=0,T(!1),oe&&P.add(Array.from(ke.dataTransfer.files)))}function ge(ke){ke.target!==ke.currentTarget||!re(ke)||(ke.preventDefault(),ke.dataTransfer.dropEffect="none")}function je(ke){re(ke)&&ke.preventDefault()}function Le(ke){if(!oe)return;const Ie=Array.from(ke.clipboardData.files),De=ke.target,Ue=De instanceof HTMLTextAreaElement||De instanceof HTMLInputElement,Ke=Array.from(ke.clipboardData.types).includes("text/plain");Txe({files:Ie.length,hasText:Ke,intoTextField:Ue})&&(ke.preventDefault(),P.add(Ie))}return r.jsx("div",{className:"modal-backdrop",...w,role:"presentation",onDragOver:ge,onDrop:je,"data-leaving":V||void 0,children:r.jsxs("div",{ref:m,className:"modal feedback-dialog",onClick:ke=>ke.stopPropagation(),onDragEnter:he,onDragOver:fe,onDragLeave:$e,onDrop:ye,onPaste:Le,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:W.armed?BO:yye(K.state)}),r.jsxs("div",{className:"fb-stage",children:[r.jsxs("form",{ref:i,className:"fb-form",onSubmit:de,onKeyDown:ke=>{pye(ke.nativeEvent)&&(ke.preventDefault(),ke.currentTarget.requestSubmit())},noValidate:!0,children:[r.jsxs("section",{ref:l,className:"modal-body fb-body",children:[r.jsx(sxe,{kind:k,onChange:v}),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:S,maxLength:S8,rows:5,placeholder:X.placeholder,onChange:ke=>C(ke.target.value),"aria-invalid":Y||void 0,"aria-describedby":Q,required:!0}),Y&&r.jsx("p",{id:"fb-body-error",className:"fb-error",children:Jge}),r.jsx(qxe,{images:P,addRef:o}),J&&r.jsx("p",{id:"fb-images-lost",className:"fb-hint",children:Jxe(A)}),r.jsxs("div",{className:"fb-tools",children:[r.jsx(Bxe,{images:P,buttonRef:o}),r.jsx(rxe,{open:$,onToggle:()=>U(ke=>!ke)})]}),r.jsx(axe,{open:$,contact:_,onContact:R})]}),r.jsx("p",{className:"fb-facts",children:q?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"fb-facts-value",children:q})," — ",iye]}):lye}),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:d,type:"button",className:`btn danger fb-discard${W.armed?" armed":""}`,onKeyDown:ke=>{ke.repeat&&ke.preventDefault()},onClick:W.press,title:W.armed?BO:tve,children:W.armed?eve:Qxe}),r.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[r.jsx("kbd",{"data-symbol":gye(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",...qn(z),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…"})]})})]})]}),O&&r.jsxs("div",{className:"fb-done",children:[r.jsx(Cp,{}),r.jsx("p",{className:"fb-done-line",children:_8})]})]}),r.jsx("div",{className:"fb-drop","aria-hidden":"true","data-active":B||void 0,children:r.jsxs("div",{className:"fb-drop-frame",children:[r.jsx(X8,{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 Q8="Press Esc first if a key does nothing.",Q0=[{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:[]}]}],cve=/ \([A-Z?]\)/g;function eB(e,t=()=>!0){const n=s=>s.integration===void 0||t(s.integration);return e&&Q0.every(s=>s.rows.every(n))?Q0:Q0.map(s=>({...s,rows:s.rows.filter(n).filter(a=>e||a.chord||!a.binds.some(iD)).map(a=>e?a:{...a,action:a.action.replace(cve,"")})})).filter(s=>s.rows.length>0)}const uve="Single-key shortcuts are off.",tB="Settings › Keyboard",dve=`Single-key shortcuts can be turned off in ${tB}.`;function hve({onClose:e,onTour:t,onSettings:n}){const s=gt(e),a=wt(e),o=co(to()),i=An(),l=Id(),u=eB(i,d=>na(l,d));return r.jsx("div",{className:"modal-backdrop",...a,role:"presentation",children:r.jsxs("div",{ref:s,className:"modal key-help",onClick:d=>d.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:uve})," Turn them back on in"," ",r.jsx("span",{className:"kh-place",children:tB}),". 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(d=>r.jsxs(g.Fragment,{children:[r.jsx("h3",{className:"kh-group",children:d.title}),d.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})]},`${d.title}:${f.cap}:${f.action}`))]},d.title))}),i&&r.jsxs("p",{className:"kh-foot",children:[Q8," ",dve]})]})]})})}function fve(e,t){return`${e}#${t}`}function pve(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=fve(i.key,i.since);if(s.has(l)||Noe(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 mve(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 nB({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function gve(e){return e===1?"Account needs your attention":"Accounts need your attention"}function yve(e){return`${e===1?"One Claude account needs":`${e} Claude accounts need`} you to sign in again.`}const wve="Login expired",xve="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.",vve="The account stays marked in the Accounts panel. This will not ask again until it has worked and stopped again.";function bve(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 kve({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:o,onLater:i}){const l=g.useRef(null),u=gt(i,{focusRef:l}),d=wt(i),f=eo(n,"accept"),p=eo(n,"dismiss");return r.jsx("div",{className:"modal-backdrop",...d,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 ",hS(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 jve(e){const t=g.useRef(!1),n=Nve(e),s=nB({rows:n?1:0,ours:t.current,dialogs:ln.dialogDepth()});return t.current=s,s?n:null}function Nve({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:s,deferLanPair:a}){const{request:o,waiting:i}=bve(e,t.current);return o?r.jsx(kve,{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 Sve({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:xve})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:yve(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:wve}),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:vve,onClick:n,children:"Not now"}),a&&r.jsx("button",{type:"button",className:"btn primary",ref:s,onClick:()=>t(a),children:"Sign in again"})]})]})}function Cve({rows:e,onSignIn:t,onLater:n}){const s=g.useRef(null),a=gt(n,{focusRef:s}),o=wt(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:gve(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(Sve,{rows:e,onSignIn:t,onLater:n,firstRef:s})]})})}function _ve({rows:e,signingIn:t,signIn:n,signedIn:s,refresh:a,closeSignIn:o,later:i,pairing:l=!1}){const u=g.useRef(!1),d=ln.dialogDepth()+(l?1:0),f=t!=null||nB({rows:e.length,ours:u.current,dialogs:d});return u.current=f,t?r.jsx(x6,{email:t.email||null,onClose:o,onChanged:a,onSignedIn:s}):f?r.jsx(Cve,{rows:e,onSignIn:n,onLater:i},e.length===1?"one":"many"):null}const Eve={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is","author metadata and never a release.","","Editorial metadata: optional //summaries maps a release version to one","specific, verified headline (1–120 characters). No generic marketing claims.","A note may have priority: highlight or required. Choose at most 3 highlights,","only when warranted. Unmarked notes go under More improvements when highlights","exist. Legacy notes stay unabridged; legacy upgrade notes stay visible.","Use required for breaking changes, changed settings, privacy/security impact,","compatibility requirements or mandatory actions. A highlight with any such","impact must also carry a notice with all essential qualifications: highlight","alone is editorial placement, not an instruction to surface it across upgrades.","Required notes and notices stay visible across upgrades, never in a closed section.","Write a short benefit-led title and one useful sentence where possible; keep","opt-outs and limits. Avoid inflated adjectives, filler and generic claims.","Preserve original factual meaning. Never invent capabilities or results.","Retain setup instructions, compatibility minimums and privacy implications.","Verify each claim against the released diff and tests. No promotion","for invisible fixes. Do not rewrite historical releases to fit the layout.","","Keep highlight titles within 72 characters (excluding a leading emoji) and","benefit descriptions within 240 characters. These limits are validated.","Put essential compatibility, privacy or configuration details in optional","notice text, outside More improvements. Current/upgrade notices stay visible and","have no truncation limit. A notice also keeps its change visible across upgrades.","Optional noticeLabel gives it a short factual heading (1–32 characters), such","as Setup change or Compatibility. It requires notice text; default is Important.","Optional details holds secondary context, shown under the same improvements","disclosure for highlights and beside other notes. Keep the body to one useful","sentence. Never move setup, safety, privacy or compatibility conditions into","details: use notice for those, so they remain visible across upgrades.","The disclosure counts other improvements, not extra details of highlights.","Mark any other mandatory action as required. The manual digest shows only the","running release; Release history opens the full changelog. Upgrade notes keep","required/noticed changes visible and disclose the other notes in that range.","Unclassified legacy upgrade notes stay visible rather than guessing safety.","Before adding editorial metadata to a release, review every note: unmarked","changes will be treated as optional in later upgrades. Never infer safety","from a title, keyword, emoji, position or a shortened description.","","Optional icon is a semantic key: plans, accounts or skills. Use it only when","it matches the change; do not infer icons from versions, titles or emoji.","The modal uses native monochrome glyphs, so titles need no decorative emoji."],"//summaries":{"3.46.0":"Plans, accounts and skills at a glance"},"//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.49.0":[{title:"🗞️ What's new is shorter and easier to scan",body:"Up to three main changes come first and the rest wait under Show details; Check for updates moved to the dialog's More options menu."},{title:"👥 No warning when one account is in use on several decks",body:"The account row and the desktop no longer flag it, and the Login active on another deck switch is gone from Settings › Notifications; expired logins are still shown.",priority:"required"},{title:"📍 Auto-hidden sessions come back where they were",body:"With Hide finished sessions after on, a session that works again returns to its place, with its new subagents beside it rather than further down the board."},{title:"💻 Windows: About flags an outdated terminal CLI",body:"When the npm ccdeck on PATH is older than the desktop app, Settings › About shows the command that updates it."},{title:"✏️ Texts that fell behind are up to date",body:"Explore integrations says Jira can move issues, and the Radar and Where the time went tips match what the app does."},{title:"🛡️ AGENTS_DECK_NO_RADAR holds at login and in the desktop app",body:"A deck started at login or by the desktop app no longer watches Claude Code's telemetry collector when your shell sets the variable.",priority:"required"},{title:"📊 Usage reports name the trackers you connected",body:"The daily report says which of Jira, GitHub or GitLab has a saved connection, never its address, account or token; AGENTS_DECK_NO_REPORTS=1 still keeps reports off.",priority:"required"}],"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:"🗺️ Follow plans at any zoom",body:"See plan progress on session notes and directly on the canvas.",priority:"highlight",icon:"plans",details:"Subagents stay in one column beside their parent."},{title:"✅ Keep your Claude account in sync",body:"After `/login`, Accounts, Switch, Auto-switch and Usage follow your active Claude Code account.",priority:"highlight",icon:"accounts",details:"Auto-switch can also 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:"🧩 See which skills your agents use",body:"Review skill activity from the right sidebar, including typed slash commands.",priority:"highlight",notice:"Counting typed slash commands adds a `UserPromptExpansion` hook to Claude Code's `settings.json` on supported versions (2.1.116+). Set `AGENTS_DECK_SKILL_HOOK=0` to opt out.",icon:"skills",noticeLabel:"Setup change"},{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:Gwe(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,...qn(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:()=>d({upgrade:!0}),...qn(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:((x=t==null?void 0:t.upgrade)==null?void 0:x.error)??"",children:[(t==null?void 0:t.upgradeMode)==="npx"?"update failed":"install failed",": ",((b=t==null?void 0:t.upgrade)==null?void 0:b.error)??"unknown error"," — run it yourself:"]}):(t==null?void 0:t.upgradeMode)==="npx"?r.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?"npx cannot upgrade in place, so the deck re-runs:":$j.npx}):t!=null&&t.upgradeBlocked?r.jsx("span",{className:"ver-sub",children:Kt($j,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 Zwe({restart:e,versionCheck:t,upgrade:n,oldNameNotice:s,rating:a,onFeedback:o,everConnected:i,live:l,paused:u}){const{autoRestart:d,toggleAutoRestart:f,restarting:p,restartMode:m,restartedTo:w,askRestart:x,restartCopy:b,restartFuseMs:j}=e,{version:k,notice:v,noticeOpen:S,dismissNotice:C}=t,{upgradeState:_,startUpgrade:R,copyCommand:A,cmdCopied:I}=n,{oldName:$,oldNameOpen:U,dismissOldName:F}=s,{ratingPhase:M,ratingScore:B,answerRating:T,rateLater:P,closeRating:q,holdThanks:K}=a,z=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($we,{restarting:p,restartMode:m,live:l,paused:u}):S&&v?r.jsx(Xwe,{notice:v,version:k,dismissNotice:C,upgradeState:_,startUpgrade:R,copyCommand:A,cmdCopied:I,autoRestart:d,toggleAutoRestart:f,askRestart:x,restartCopy:b,restartFuseMs:j,restarting:p}):U&&$?r.jsx(Lwe,{oldName:$,version:k,dismissOldName:F}):M!=="hidden"?r.jsx(Bwe,{phase:M,score:B,onAnswer:T,onLater:P,onClose:q,onFeedback:o,onHold:K}):null;return r.jsxs(r.Fragment,{children:[z,r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:M==="thanks"?W8:""})]})}function Jwe(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function Qwe(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 exe(e){return e<=0?null:e===1?"the one agent":`all ${e} agents`}function txe(e,t){const n=exe(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 nxe({agentCount:e,onConfirm:t,onCancel:n}){const s=g.useRef(null),a=gt(n,{focusRef:s,layer:GG}),o=wt(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(Qwe(w))}).catch(()=>{}),()=>{m=!0}},[]);const{goes:u,stays:d,final:f,confirm:p}=txe(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:d.length>0?d.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 sxe({kind:e,onChange:t}){return r.jsxs("fieldset",{className:"fb-kinds",children:[r.jsx("legend",{className:"vis-hidden",children:"Kind of feedback"}),Lp.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=>{HS(s.nativeEvent)&&s.preventDefault()}}),n.label]},n.value))]})}const z8="fb-details";function rxe({open:e,onToggle:t}){return r.jsxs("button",{type:"button",className:"fb-tool fb-more","aria-expanded":e,"aria-controls":z8,onClick:t,children:[cye,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 axe({open:e,contact:t,onContact:n}){const s=g.useId();return r.jsx("div",{id:z8,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:[uye,r.jsx("span",{className:"fb-optional",children:"optional"})]}),r.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:t,maxLength:C8,autoComplete:"email",placeholder:dye,"aria-describedby":s,onChange:a=>n(a.target.value),onKeyDown:a=>{HS(a.nativeEvent)&&a.preventDefault()}}),r.jsx("p",{id:s,className:"fb-hint",children:hye})]}),r.jsx("div",{className:"fb-where",children:fye.map(a=>r.jsx("p",{children:a},a))})]})})})}const Jo=3,oxe=5*1024*1024,ixe=12*1024*1024,Lj=8192,lxe=64*1024,cxe=256*1024,uxe=.92,dxe=640,V8=.9,hxe=.85,fxe=6,pxe=512*1024,Fp={png:"image/png",jpeg:"image/jpeg"},mxe={png:"png",jpeg:"jpg"},gxe=[137,80,78,71,13,10,26,10],yxe=[255,216,255];function G8(e){const t=n=>e.length>=n.length&&n.every((s,a)=>e[a]===s);return t(gxe)?"png":t(yxe)?"jpeg":null}function wxe(e){const t=G8(e);return t==="png"?xxe(e):t==="jpeg"?bxe(e):null}function xxe(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 vxe(e){return e>=192&&e<=207&&e!==196&&e!==200&&e!==204}function bxe(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(vxe(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 OO(e,t){return e.bytes>t||e.width>Lj||e.height>Lj}function kxe(e){return Math.min(oxe,ixe-lxe-e)}function K8(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function jxe(e,t){const n=Lj/Math.max(e.width,e.height),s=e.bytes>t?Math.sqrt(t/e.bytes)*V8:1;return K8(e,Math.min(1,n,s))}async function Nxe(e,t,n){let s=jxe(e,t),a=e.format;for(let o=0;o<fxe;o++){const i=await n(s,a,a==="jpeg"?uxe:void 0);if(!i)return null;if(i.size<=t)return{...s,blob:i,format:a};if(a==="png"){a="jpeg";continue}if(s=K8(s,Math.min(hxe,Math.sqrt(t/i.size)*V8)),Math.max(s.width,s.height)<dxe)return null}return null}async function Sxe(e,t,n){const s=new Uint8Array(await e.slice(0,pxe).arrayBuffer()),a=G8(s);if(!a)return{ok:!1,problem:"type"};if(t<cxe)return{ok:!1,problem:"no_room"};const o=e.type===Fp[a]?e:new Blob([e],{type:Fp[a]}),i=wxe(s);if(i&&!OO({...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(!OO(u,t))return{ok:!0,blob:o,resized:null};const d=await Nxe(u,t,l.encoder);return d?{ok:!0,blob:d.blob,resized:{width:d.width,height:d.height}}:{ok:!1,problem:"too_large"}}finally{l.release()}}function Cxe(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)},Fp[s],a)})}const _xe=async e=>{const t=await createImageBitmap(e);return{width:t.width,height:t.height,encoder:Cxe(t),release:()=>t.close()}};function Exe(e){return e.includes("Files")}function Txe({files:e,hasText:t,intoTextField:n}){return e>0&&(!t||!n)}function Axe(e,t){const n=e.indexOf(t);return e[n+1]??e[n-1]??null}function Rxe(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===Fp.jpeg?"jpeg":"png";n.append("images",s,`image-${a+1}.${mxe[o]}`)}),{method:"POST",body:n}}const Mxe="Add screenshot",PO="PNG or JPEG, up to three. You can also paste one, or drop it on this dialog.",$xe="A screenshot can show emails, costs and paths. Crop out what should not be seen.",DO="Three images at most. Remove one to add another.",Lxe="An image could not be attached, so nothing was sent. Check the images and send again; your text is still here.";function Ixe(e,t,n){const s=n?`, resized to ${n.width} × ${n.height} to fit`:"";return`Replace image ${e+1}: ${t}${s}`}function Oxe(e,t){const n=`${e} of ${Jo}`;return t>0?`${n} · ${t} resized to fit`:n}function Pxe(e){return`Three images at most, so ${e===1?"one was":`${e} were`} left out.`}function Dxe(e){return`“${e.length>40?`${e.slice(0,30)}…${e.slice(-9)}`:e}”`}function Fxe(e,t){const n=Dxe(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 Y8="image/png,image/jpeg";function X8({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 Bxe({images:e,buttonRef:t}){const n=g.useRef(null),s=e.shots.length>=Jo;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:PO,"aria-describedby":"fb-attach-hint",onClick:()=>{var a;return s?e.sayFull():(a=n.current)==null?void 0:a.click()},children:[r.jsx(X8,{}),Mxe]}),r.jsx("span",{id:"fb-attach-hint",hidden:!0,children:PO}),r.jsx("input",{ref:n,type:"file",accept:Y8,multiple:!0,hidden:!0,onChange:a=>{e.add(Array.from(a.target.files??[])),a.target.value=""}})]})}function qxe({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,d=Oxe(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(Axe(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:Y8,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":Ixe(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:x=>{x?n.current.set(m.id,x):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:d})]}),r.jsx("p",{className:"fb-hint",children:$xe})]}),e.problem&&r.jsx("p",{ref:s,className:"fb-error",role:"alert",children:e.problem},e.problemId)]})}function Uxe(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 Wxe(e,t,n){return n?e.map(s=>s.id===t.id?t:s):[...e,t]}function Hxe(e,t,n){return n?e.map(s=>s.id===t?n:s):e.filter(s=>s.id!==t)}function zxe(e){const[t,n]=g.useState(()=>Uxe((e==null?void 0:e.ready)??[],1)),[s,a]=g.useState({problem:"",id:0}),o=g.useRef(0),i=g.useCallback(M=>{M&&o.current++,a(B=>M?{problem:M,id:B.id+1}:B.problem?{problem:"",id:B.id}:B)},[]),[l,u]=g.useState(""),d=g.useRef(t),f=g.useRef(null),p=g.useRef(t.length),m=g.useRef(!0),w=g.useRef(new Map),x=g.useRef([]),b=g.useRef(0),j=g.useCallback(M=>{d.current=M(d.current),n(d.current)},[]);g.useEffect(()=>(m.current=!0,()=>{m.current=!1;for(const M of d.current)URL.revokeObjectURL(M.url)}),[]);const k=g.useCallback(async(M,B)=>{const T=d.current.reduce((Z,W)=>{var X;return Z+(W.id===(B==null?void 0:B.id)?0:((X=W.blob)==null?void 0:X.size)??0)},0),P=(B==null?void 0:B.id)??++p.current,q=URL.createObjectURL(M),K={id:P,name:M.name||"image",url:q,blob:null,resized:null},z=b.current;w.current.set(P,M);let H=!1;const D=()=>{H||(H=!0,j(Z=>Wxe(Z,K,B!==void 0)))},O=await Sxe(M,kxe(T),async Z=>(D(),_xe(Z))).catch(()=>({ok:!1,problem:"unreadable"})),V=d.current.some(Z=>Z.id===P);return!m.current||b.current!==z||!V&&(H||B)?(URL.revokeObjectURL(q),B&&URL.revokeObjectURL(B.url),m.current&&w.current.delete(P),""):(w.current.delete(P),O.ok?(D(),B&&URL.revokeObjectURL(B.url),j(Z=>Z.map(W=>W.id===P?{...W,blob:O.blob,resized:O.resized}:W)),""):(URL.revokeObjectURL(q),H&&j(Z=>Hxe(Z,P,B)),Fxe(O.problem,M.name||"image")))},[j]),v=g.useCallback(async M=>{i("");const B=b.current,T=[];let P=0,q=0;for(const z of M){if(!m.current||b.current!==B)return;const H=x.current.indexOf(z);if(H!==-1&&x.current.splice(H,1),d.current.length>=Jo){P++;continue}const D=d.current.length,O=await k(z);O&&T.push(O),d.current.length>D&&q++}if(!m.current||b.current!==B)return;P>0&&T.push(q===0&&T.length===0?DO:Pxe(P)),i(T.join(" "));const K=d.current.length;q>0&&u(`${q===1?"Image":`${q} images`} added, ${K} of ${Jo}.`)},[k,i]),S=g.useCallback(async(M,B)=>{i("");const T=d.current.find(K=>K.id===M);if(!T)return v([B]);const P=await k(B,T);if(!m.current)return;i(P);const q=d.current.findIndex(K=>K.id===M);!P&&q!==-1&&u(`Image ${q+1} replaced, ${d.current.length} of ${Jo}.`)},[v,k,i]),C=g.useCallback(M=>{const B=b.current;f.current=(f.current??Promise.resolve()).then(()=>b.current===B?M():void 0).catch(()=>{})},[]),_=g.useCallback(M=>{M.length!==0&&(x.current.push(...M),C(()=>v(M)))},[v,C]);g.useEffect(()=>{e&&e.waiting.length>0&&_(e.waiting)},[]);const R=g.useCallback((M,B)=>{const T=B[0];T&&C(()=>S(M,T))},[C,S]),A=g.useCallback(M=>{const B=d.current.find(T=>T.id===M);B&&(URL.revokeObjectURL(B.url),w.current.delete(M),j(T=>T.filter(P=>P.id!==M)),i(""),u(`Image removed, ${d.current.length} of ${Jo}.`))},[j,i]),I=g.useCallback(()=>i(DO),[i]),$=g.useCallback(async()=>{const M=o.current;return await f.current,o.current!==M?null:d.current.flatMap(B=>B.blob?[B.blob]:[])},[]),U=g.useCallback(()=>({ready:d.current.flatMap(M=>M.blob&&!w.current.has(M.id)?[{name:M.name,blob:M.blob,resized:M.resized}]:[]),waiting:[...w.current.values(),...x.current]}),[]),F=g.useCallback(()=>{b.current++;for(const M of d.current)URL.revokeObjectURL(M.url);w.current.clear(),x.current=[],j(()=>[]),i("")},[j,i]);return{shots:t,problem:s.problem,problemId:s.id,announcement:l,add:_,replace:R,remove:A,sayFull:I,ready:$,kept:U,clear:F}}function Vxe(){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(sye(s))}).catch(()=>{}),()=>{n=!1}},[]),e}function Gxe(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(!_n(s.current))return;s.current=!0;const{signal:u}=a.current=new AbortController;n({state:"sending"});try{const d=await e.ready();if(u.aborted)return;if(!d){n({state:"failed",message:Lxe});return}const f=await fetch("/api/feedback",{...Rxe(nye(l),d),signal:u}),p=await f.json().catch(()=>null);n(f.ok&&(p!=null&&p.ok)?{state:"sent"}:{state:"failed",message:CO(f.status,p==null?void 0:p.reason,p==null?void 0:p.errors)})}catch{u.aborted||n({state:"failed",message:CO(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 Kxe(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),_O),i=window.setTimeout(()=>a.current(),_O+wye);return()=>{window.clearTimeout(o),window.clearTimeout(i)}},[e]),n}const J0="agent-dag.feedbackDrafts",FO=4;function Yxe({initialKind:e,initialBody:t}){return{kind:e??"bug",body:t??""}}function Xxe(e){return JSON.stringify([e.kind,e.body])}function Zxe(e){return e.ready.length+e.waiting.length}function Z8(e,t){return e.body.trim()!==t.body.trim()||e.contact.trim()!==""||e.images>0}function Jxe(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 Qxe="Discard",eve="Confirm discard",tve="Clear the message, the screenshots and the contact",BO="Press again to clear this draft. It cannot be brought back.",nve={ready:[],waiting:[]};function sve(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!Lp.some(i=>i.value===n)||typeof s!="string"||s.length>S8||typeof a!="string"||a.length>C8||typeof o!="number"||!Number.isInteger(o)||o<0||o>Jo?null:[e[0],{kind:n,body:s,contact:a,images:o}]}function rve(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(J0),l=i?JSON.parse(i):[];if(Array.isArray(l))for(const u of l.slice(-FO)){const d=sve(u);d&&t.set(d[0],{...d[1],images:null,imageCount:d[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(J0):o.setItem(J0,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??nve,imagesLost:i.images?0:i.imageCount}:null},keep(o,i,l){const u=Zxe(i.images);if(!Z8({body:i.body,contact:i.contact,images:u},l)){a(o);return}const d=n();d.delete(o),d.set(o,{kind:i.kind,body:i.body,contact:i.contact,images:i.images,imageCount:u});for(const f of d.keys()){if(d.size<=FO)break;d.delete(f)}s()},forget:a}}function ave(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}const Ij=rve(ave),ove=4e3;function ive(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||Ij.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&&Ij.forget(e)},[a,e])}const qO="draft";function lve(e){const[t,n]=g.useState(!1),s=g.useRef(0);g.useEffect(()=>{if(!t)return;const o=window.setTimeout(()=>n(!1),ove);return()=>window.clearTimeout(o)},[t]);function a(){const o=Date.now(),i=fi({armedFor:t?qO:null,target:qO,armedAt:s.current,now:o,gapMs:hi});if(i==="arm"){n(!0),s.current=o;return}i!=="ignore"&&(n(!1),e())}return{armed:t,press:a}}function J8({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),d=g.useRef(null),f=g.useRef(null),p=g.useRef(0),m=gt(e,{focusRef:s}),w=wt(e),x=Yxe({initialKind:t,initialBody:n}),b=Xxe(x),[j]=g.useState(()=>Ij.read(b)),[k,v]=g.useState((j==null?void 0:j.kind)??x.kind),[S,C]=g.useState((j==null?void 0:j.body)??x.body),[_,R]=g.useState((j==null?void 0:j.contact)??""),[A,I]=g.useState((j==null?void 0:j.imagesLost)??0),[$,U]=g.useState(!1),[F,M]=g.useState(!1),[B,T]=g.useState(!1),P=zxe(j==null?void 0:j.images),q=oye(Vxe()),{outcome:K,sending:z,send:H,clearFailure:D}=Gxe(P),O=K.state==="sent",V=Kxe(O,e);ive(b,x,{kind:k,body:S,contact:_},P,O);const Z=Z8({body:S,contact:_,images:P.shots.length},x),W=lve(()=>{var ke;v(x.kind),C(x.body),R(""),I(0),M(!1),P.clear(),D(),(ke=s.current)==null||ke.focus()}),X=N8(k),Y=F&&!NO(S),J=A>0&&P.shots.length===0,Q=[Y&&"fb-body-error",J&&"fb-images-lost"].filter(Boolean).join(" ")||void 0,[te,le]=mye(to());g.useEffect(()=>{var De,Ue;const ke=i.current;if(!ke)return;const Ie=ke.contains(document.activeElement)||Hn(((De=document.activeElement)==null?void 0:De.tagName)??null);ke.inert=O,O&&Ie&&((Ue=a.current)==null||Ue.focus())},[O]),g.useEffect(()=>{var Ke,we;const ke=l.current;if(!ke)return;const Ie=d.current;if(z){const Fe=document.activeElement,Re=Fe!=null&&(ke.contains(Fe)||Fe===Ie);f.current=Re?Fe:null,ke.inert=!0,Ie&&(Ie.inert=!0),f.current&&((Ke=u.current)==null||Ke.focus());return}ke.inert=!1,Ie&&(Ie.inert=!1);const De=f.current;f.current=null;const Ue=document.activeElement===u.current||Hn(((we=document.activeElement)==null?void 0:we.tagName)??null);!O&&De&&Ue&&De.focus()},[z,O]);function de(ke){var Ie;if(ke.preventDefault(),!NO(S)){M(!0),(Ie=s.current)==null||Ie.focus();return}H({kind:k,body:S,contact:_})}const oe=!O&&!z,re=ke=>Exe(Array.from(ke.dataTransfer.types));function he(ke){!re(ke)||!oe||(ke.preventDefault(),p.current++,T(!0))}function fe(ke){re(ke)&&(ke.preventDefault(),ke.dataTransfer.dropEffect=oe?"copy":"none")}function $e(ke){re(ke)&&(p.current=Math.max(0,p.current-1),p.current===0&&T(!1))}function ye(ke){re(ke)&&(ke.preventDefault(),p.current=0,T(!1),oe&&P.add(Array.from(ke.dataTransfer.files)))}function ge(ke){ke.target!==ke.currentTarget||!re(ke)||(ke.preventDefault(),ke.dataTransfer.dropEffect="none")}function je(ke){re(ke)&&ke.preventDefault()}function Le(ke){if(!oe)return;const Ie=Array.from(ke.clipboardData.files),De=ke.target,Ue=De instanceof HTMLTextAreaElement||De instanceof HTMLInputElement,Ke=Array.from(ke.clipboardData.types).includes("text/plain");Txe({files:Ie.length,hasText:Ke,intoTextField:Ue})&&(ke.preventDefault(),P.add(Ie))}return r.jsx("div",{className:"modal-backdrop",...w,role:"presentation",onDragOver:ge,onDrop:je,"data-leaving":V||void 0,children:r.jsxs("div",{ref:m,className:"modal feedback-dialog",onClick:ke=>ke.stopPropagation(),onDragEnter:he,onDragOver:fe,onDragLeave:$e,onDrop:ye,onPaste:Le,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:W.armed?BO:yye(K.state)}),r.jsxs("div",{className:"fb-stage",children:[r.jsxs("form",{ref:i,className:"fb-form",onSubmit:de,onKeyDown:ke=>{pye(ke.nativeEvent)&&(ke.preventDefault(),ke.currentTarget.requestSubmit())},noValidate:!0,children:[r.jsxs("section",{ref:l,className:"modal-body fb-body",children:[r.jsx(sxe,{kind:k,onChange:v}),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:S,maxLength:S8,rows:5,placeholder:X.placeholder,onChange:ke=>C(ke.target.value),"aria-invalid":Y||void 0,"aria-describedby":Q,required:!0}),Y&&r.jsx("p",{id:"fb-body-error",className:"fb-error",children:Jge}),r.jsx(qxe,{images:P,addRef:o}),J&&r.jsx("p",{id:"fb-images-lost",className:"fb-hint",children:Jxe(A)}),r.jsxs("div",{className:"fb-tools",children:[r.jsx(Bxe,{images:P,buttonRef:o}),r.jsx(rxe,{open:$,onToggle:()=>U(ke=>!ke)})]}),r.jsx(axe,{open:$,contact:_,onContact:R})]}),r.jsx("p",{className:"fb-facts",children:q?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"fb-facts-value",children:q})," — ",iye]}):lye}),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:d,type:"button",className:`btn danger fb-discard${W.armed?" armed":""}`,onKeyDown:ke=>{ke.repeat&&ke.preventDefault()},onClick:W.press,title:W.armed?BO:tve,children:W.armed?eve:Qxe}),r.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[r.jsx("kbd",{"data-symbol":gye(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",...qn(z),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…"})]})})]})]}),O&&r.jsxs("div",{className:"fb-done",children:[r.jsx(Cp,{}),r.jsx("p",{className:"fb-done-line",children:_8})]})]}),r.jsx("div",{className:"fb-drop","aria-hidden":"true","data-active":B||void 0,children:r.jsxs("div",{className:"fb-drop-frame",children:[r.jsx(X8,{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 Q8="Press Esc first if a key does nothing.",Q0=[{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:[]}]}],cve=/ \([A-Z?]\)/g;function eB(e,t=()=>!0){const n=s=>s.integration===void 0||t(s.integration);return e&&Q0.every(s=>s.rows.every(n))?Q0:Q0.map(s=>({...s,rows:s.rows.filter(n).filter(a=>e||a.chord||!a.binds.some(iD)).map(a=>e?a:{...a,action:a.action.replace(cve,"")})})).filter(s=>s.rows.length>0)}const uve="Single-key shortcuts are off.",tB="Settings › Keyboard",dve=`Single-key shortcuts can be turned off in ${tB}.`;function hve({onClose:e,onTour:t,onSettings:n}){const s=gt(e),a=wt(e),o=co(to()),i=An(),l=Id(),u=eB(i,d=>na(l,d));return r.jsx("div",{className:"modal-backdrop",...a,role:"presentation",children:r.jsxs("div",{ref:s,className:"modal key-help",onClick:d=>d.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:uve})," Turn them back on in"," ",r.jsx("span",{className:"kh-place",children:tB}),". 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(d=>r.jsxs(g.Fragment,{children:[r.jsx("h3",{className:"kh-group",children:d.title}),d.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})]},`${d.title}:${f.cap}:${f.action}`))]},d.title))}),i&&r.jsxs("p",{className:"kh-foot",children:[Q8," ",dve]})]})]})})}function fve(e,t){return`${e}#${t}`}function pve(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=fve(i.key,i.since);if(s.has(l)||Noe(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 mve(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 nB({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function gve(e){return e===1?"Account needs your attention":"Accounts need your attention"}function yve(e){return`${e===1?"One Claude account needs":`${e} Claude accounts need`} you to sign in again.`}const wve="Login expired",xve="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.",vve="The account stays marked in the Accounts panel. This will not ask again until it has worked and stopped again.";function bve(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 kve({request:e,waiting:t,busy:n,now:s,onAccept:a,onDecline:o,onLater:i}){const l=g.useRef(null),u=gt(i,{focusRef:l}),d=wt(i),f=eo(n,"accept"),p=eo(n,"dismiss");return r.jsx("div",{className:"modal-backdrop",...d,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 ",hS(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 jve(e){const t=g.useRef(!1),n=Nve(e),s=nB({rows:n?1:0,ours:t.current,dialogs:ln.dialogDepth()});return t.current=s,s?n:null}function Nve({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:s,deferLanPair:a}){const{request:o,waiting:i}=bve(e,t.current);return o?r.jsx(kve,{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 Sve({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:xve})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:yve(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:wve}),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:vve,onClick:n,children:"Not now"}),a&&r.jsx("button",{type:"button",className:"btn primary",ref:s,onClick:()=>t(a),children:"Sign in again"})]})]})}function Cve({rows:e,onSignIn:t,onLater:n}){const s=g.useRef(null),a=gt(n,{focusRef:s}),o=wt(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:gve(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(Sve,{rows:e,onSignIn:t,onLater:n,firstRef:s})]})})}function _ve({rows:e,signingIn:t,signIn:n,signedIn:s,refresh:a,closeSignIn:o,later:i,pairing:l=!1}){const u=g.useRef(!1),d=ln.dialogDepth()+(l?1:0),f=t!=null||nB({rows:e.length,ours:u.current,dialogs:d});return u.current=f,t?r.jsx(x6,{email:t.email||null,onClose:o,onChanged:a,onSignedIn:s}):f?r.jsx(Cve,{rows:e,onSignIn:n,onLater:i},e.length===1?"one":"many"):null}const Eve={"//":["What a user would NOTICE. One key per version that has something to say,","and no key at all for a version that has nothing — which is most of them.","","The rule this file exists to serve: before every release, ask 'what would a","user notice?' and write the answer here. 'Nothing user-visible' is a valid","and expected answer, and it is spelled by adding no key. A release with no","key shows no modal, and that silence is what keeps the modal worth reading","on the day it is not silent.","","What belongs here: something that changed on the user's machine or under","their hands — a hook written to or removed from settings.json, a default","that flipped, a control that moved or went away, a stored preference that","changed meaning. What does not: bounds, races, assertions that could not","fire, anything that is invisible when it is correct.","","Write it for the person running the deck, not for the person reading the","diff. `title` is the sentence they scan; `body` is what they need in order","to act on it, or to stop worrying about it.","","Keys are versions exactly as package.json spells them. A key that is not a","version, or an entry missing either field, fails the suite rather than","being quietly dropped — see src/web/__tests__/release-notes-file.test.ts.","Ordering here is for humans; the deck sorts by version itself.","","A title may open with an emoji, and if it does, put exactly ONE space after","it. Not two: the dialog gives a leading emoji its own optical gap, because","a colour glyph is drawn edge to edge inside its advance and one word space","after one reads as none. A second space here would be a lie in the data","about a defect in the type, and the suite refuses both it and no space at","all.","","A release that genuinely has nothing to say is spelled TWICE: no key here,",'and its version written into "//nothing-to-say" below. One spelling on its',"own is ambiguous — a missing key reads the same whether it was a decision","or a forgotten step, and five releases in a row were once forgotten. The list","is what tells the two apart, and release-notes-current-version.test.ts fails","the release whose version is in neither place. Any key opening with // is","author metadata and never a release.","","Editorial metadata: optional //summaries maps a release version to one","specific, verified headline (1–120 characters). No generic marketing claims.","A note may have priority: highlight or required. Choose at most 3 highlights,","only when warranted. Unmarked notes go under More improvements when highlights","exist. Legacy notes stay unabridged; legacy upgrade notes stay visible.","Use required for breaking changes, changed settings, privacy/security impact,","compatibility requirements or mandatory actions. A highlight with any such","impact must also carry a notice with all essential qualifications: highlight","alone is editorial placement, not an instruction to surface it across upgrades.","Required notes and notices stay visible across upgrades, never in a closed section.","Write a short benefit-led title and one useful sentence where possible; keep","opt-outs and limits. Avoid inflated adjectives, filler and generic claims.","Preserve original factual meaning. Never invent capabilities or results.","Retain setup instructions and compatibility minimums. Say only what a user","sees in the app: usage reports, telemetry and environment variables are for","README to explain, not for a note.","Verify each claim against the released diff and tests. No promotion","for invisible fixes. Do not rewrite historical releases to fit the layout.","","Keep highlight titles within 72 characters (excluding a leading emoji) and","benefit descriptions within 240 characters. These limits are validated.","Put essential compatibility, privacy or configuration details in optional","notice text, outside More improvements. Current/upgrade notices stay visible and","have no truncation limit. A notice also keeps its change visible across upgrades.","Optional noticeLabel gives it a short factual heading (1–32 characters), such","as Setup change or Compatibility. It requires notice text; default is Important.","Optional details holds secondary context, shown under the same improvements","disclosure for highlights and beside other notes. Keep the body to one useful","sentence. Never move setup, safety, privacy or compatibility conditions into","details: use notice for those, so they remain visible across upgrades.","The disclosure counts other improvements, not extra details of highlights.","Mark any other mandatory action as required. The manual digest shows only the","running release; Release history opens the full changelog. Upgrade notes keep","required/noticed changes visible and disclose the other notes in that range.","Unclassified legacy upgrade notes stay visible rather than guessing safety.","Before adding editorial metadata to a release, review every note: unmarked","changes will be treated as optional in later upgrades. Never infer safety","from a title, keyword, emoji, position or a shortened description.","","Optional icon is a semantic key: plans, accounts or skills. Use it only when","it matches the change; do not infer icons from versions, titles or emoji.","The modal shows a title's leading emoji; the glyph stands in only for a title","without one."],"//summaries":{"3.46.0":"Plans, accounts and skills at a glance"},"//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.49.1"],"3.49.0":[{title:"🗞️ What's new is shorter and easier to scan",body:"Up to three main changes come first and the rest wait under Show details; Check for updates moved to the dialog's More options menu."},{title:"👥 No warning when one account is in use on several decks",body:"The account row and the desktop no longer flag it, and the Login active on another deck switch is gone from Settings › Notifications; expired logins are still shown.",priority:"required"},{title:"📍 Auto-hidden sessions come back where they were",body:"With Hide finished sessions after on, a session that works again returns to its place, with its new subagents beside it rather than further down the board."},{title:"💻 Windows: About flags an outdated terminal CLI",body:"When the npm ccdeck on PATH is older than the desktop app, Settings › About shows the command that updates it."},{title:"✏️ Texts that fell behind are up to date",body:"Explore integrations says Jira can move issues, and the Radar and Where the time went tips match what the app does."}],"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:"🗺️ Follow plans at any zoom",body:"See plan progress on session notes and directly on the canvas.",priority:"highlight",icon:"plans",details:"Subagents stay in one column beside their parent."},{title:"✅ Keep your Claude account in sync",body:"After `/login`, Accounts, Switch, Auto-switch and Usage follow your active Claude Code account.",priority:"highlight",icon:"accounts",details:"Auto-switch can also 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:"🧩 See which skills your agents use",body:"Review skill activity from the right sidebar, including typed slash commands.",priority:"highlight",notice:"Counting typed slash commands adds a `UserPromptExpansion` hook to Claude Code's `settings.json` on supported versions (2.1.116+). Set `AGENTS_DECK_SKILL_HOOK=0` to opt out.",icon:"skills",noticeLabel:"Setup change"},{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.`}]},KS="agent-dag.releaseNotesSeen";function UO(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function ha(e,t){const n=UO(e),s=UO(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 ks(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function Tve(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 Ave(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!ks(n)||!Array.isArray(s))continue;const a=s.filter(Tve).map(l=>({title:l.title,body:l.body,...typeof l.details=="string"&&l.details.trim()?{details:l.details}:{},...l.priority==="highlight"||l.priority==="required"?{priority:l.priority}:{},...typeof l.notice=="string"&&l.notice.trim()?{notice:l.notice}:{},...typeof l.notice=="string"&&l.notice.trim()&&typeof l.noticeLabel=="string"&&l.noticeLabel.trim()&&l.noticeLabel.length<=32?{noticeLabel:l.noticeLabel}:{},...l.icon==="plans"||l.icon==="accounts"||l.icon==="skills"?{icon:l.icon}:{}})),o=e["//summaries"],i=o&&typeof o=="object"&&Object.hasOwn(o,n)?o[n]:void 0;a.length&&t.push({version:n,notes:a,...typeof i=="string"&&i.trim()?{summary:i}:{}})}return t.sort((n,s)=>ha(s.version,n.version))}function Rve(e){const t=e.filter(o=>o.priority==="highlight").slice(0,3),n=t.length>0,s=e.filter(o=>!t.includes(o)&&(!n||o.priority==="required"||o.priority==="highlight"||!!o.notice)),a=e.filter(o=>!t.includes(o)&&!s.includes(o));return{highlights:t,visible:s,more:a}}function Mve(e,t,n){const[s,...a]=e;if(!t)return{latest:ks(n)?e.find(l=>ha(l.version,n)===0):s,visiblePrevious:[],history:[]};const o=[],i=[];for(const l of a){const u=l.notes.some(p=>p.priority==="highlight"||p.priority==="required"||!!p.notice),d=l.notes.filter(p=>!u||p.priority==="required"||!!p.notice);d.length&&o.push({version:l.version,notes:d});const f=l.notes.filter(p=>!d.includes(p));f.length&&i.push({...l,notes:f})}return{latest:s,visiblePrevious:o,history:i}}const WO=Ave(Eve);function sB(e,t,n){return e.filter(s=>ha(s.version,n)<=0&&(t===null||ha(s.version,t)>0))}function $ve(e,t){return e.filter(n=>ha(n.version,t)===0)}function Lve(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}`}const Ive=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function rB(e){const t=Ive.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function Ove(e){if(!e)return null;let t=null;try{t=e.getItem(KS)}catch{return null}return ks(t)?t:null}function Pve(e){if(!e)return!1;try{return e.getItem(KS),!0}catch{return!1}}function Dve(e,t){if(!e)return!1;try{return e.setItem(KS,t),!0}catch{return!1}}const aB="agent-dag.tourSeen";function Fve(e){if(!e)return!1;try{return e.getItem(aB)==="1"}catch{return!1}}function Bve(e){if(!e)return!1;try{return e.setItem(aB,"1"),!0}catch{return!1}}function qve({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 Uve({stored:e,running:t,notes:n,remembers:s=!0}){if(!ks(t))return{show:[],record:null,reason:"no-version"};if(!ks(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const i=$ve(n,t);return i.length?{show:i,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=ha(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const o=sB(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function Wve(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const s=e.indexOf("`",n+1);if(s<0)break;n=s+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function qu(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let o=0;for(;o<e.length;){if(e[o]==="`"){const i=e.indexOf("`",o+1);if(i>o+1){a(),n.push({kind:"code",text:e.slice(o+1,i)}),o=i+1;continue}}else if(t&&e.startsWith("**",o)){const i=Wve(e,o);if(i>0){a(),n.push({kind:"bold",kids:qu(e.slice(o+2,i),!1)}),o=i+2;continue}}s+=e[o],o+=1}return a(),n}function ao(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}function Sje(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function Cje(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 Hve(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function _je(e){return!Number.isFinite(e)||e<=0?"empty":Jn(e)}function Eje(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 zve(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 Tje(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=Hve(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 Vve="Ask npm now whether a newer ccdeck is out.",HO="Checking…",Gve="Couldn't reach npm. Try again.",Kve="Couldn't reach the deck. Try again.",oB="Update checks are off on this deck (AGENTS_DECK_NO_UPDATE_CHECK or AGENTS_DECK_NO_INSTALL).",Yve="The deck looks again in five minutes.";function Xve(e,t,n,s){const a=s?t.npx:n?Kt(t,n):void 0;return a?`${e} is out, but ${a}`:`${e} is out. Run:`}const Dn=(e,t={})=>({said:e,tone:"answer",age:null,command:null,action:null,...t}),Vo=e=>Dn(e,{tone:"note"});function zO(e,t){return zve(e,t)??"just now"}function Zve(e,t){const n=e.update;return(n==null?void 0:n.status)==="ready"?Vo(`${n.version} is ready. Restart to update.`):(n==null?void 0:n.status)==="checking"?Vo("The app is checking for updates…"):(n==null?void 0:n.status)==="downloading"?Vo(n.version?`${n.version} is out. The app is downloading it.`:"The app is downloading an update."):(n==null?void 0:n.status)==="current"?Vo(`You're on the latest, ${e.version??t}. You can check again here.`):(n==null?void 0:n.status)==="error"?Vo("The app's last update check failed. Try Check for updates again."):Vo("The app keeps itself up to date. Check for updates here.")}function Jve(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 Dn(`${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 Dn(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 Dn(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:`:Xve(t,n,s==null?void 0:s.upgradeBlocked,(s==null?void 0:s.upgradeMode)==="npx"),o=(s==null?void 0:s.command)??null;return Dn(a,{command:o,action:o?{kind:"copy",label:e.copied?"Copied":"Copy",busy:!1}:null})}function Qve(e){const t=e.version;if(e.unreachable)return Dn(Kve,{tone:"warn"});const n=t!=null&&t.checkFailedAt&&t.checkFailedAt>(t.checkedAt??0)?t.checkFailedAt:null;if(n)return Dn(Gve,{tone:"warn",age:e.answered?null:`Last tried ${zO(n,e.now)}.`});const s=t!=null&&t.latestPending&&t.latestPending!==e.running?t.latestPending:null;if(s)return Dn(`${s} is tagged on npm but can't be installed yet. ${Yve}`);const a=t!=null&&t.checkedAt?zO(t.checkedAt,e.now):null;if((t==null?void 0:t.checkedAt)&&e.now>=t.checkedAt&&e.now-t.checkedAt<=60*6e4&&(t!=null&&t.latest)&&ks(t.latest)&&ks(e.running)){const i=ha(t.latest,e.running),l=i===0?`You're on the latest, ${e.running}.`:i<0?`You're on ${e.running}, ahead of npm's ${t.latest}.`:`${t.latest} is out.`;return Dn(l,{age:a?`Checked ${a}.`:null})}return Dn(a?"Update status may have changed.":"No update check yet.",{age:a?`Last checked ${a}.`:null})}function ebe(e,t){var a,o;const n=e.version;if((a=e.app)!=null&&a.inApp&&(n!=null&&n.checkDisabled)){const i=Zve(e.app,e.running);return i&&{canCheck:!0,checking:e.checking||((o=e.app.update)==null?void 0:o.status)==="checking",line:e.unreachable?Dn("The desktop updater did not accept the check. Try the ccdeck menu or update the desktop app.",{tone:"warn"}):e.checking?Dn(HO):i}}if(n!=null&&n.checkDisabled)return{canCheck:!1,checking:!1,line:Vo(oB)};const s=(n==null?void 0:n.notice)??null;if((s==null?void 0:s.kind)==="upgrade")return{canCheck:!0,checking:e.checking,line:Jve(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:Dn(i)}}return e.checking?{canCheck:!0,checking:!0,line:Dn(HO)}:{canCheck:!0,checking:!1,line:Qve(e)}}const iB=450;async function tbe(e,t=n=>new Promise(s=>setTimeout(s,n))){const[n]=await Promise.all([e(!0),t(iB)]);return n?"answered":"unreachable"}async function nbe(e=fetch){try{const[t]=await Promise.all([e("/api/desktop-update/check",{method:"POST",signal:AbortSignal.timeout(8e3)}),new Promise(n=>setTimeout(n,iB))]);return t.ok?"answered":"unreachable"}catch{return"unreachable"}}const sbe="Eight pictures of what the deck shows.",VO="Restart the deck. Sessions, settings and pairings come back as they were.";function rbe(e){var A,I,$;const t=(e==null?void 0:e.versionCheck.versionChecking)??!1,n=Sr(3e4),[s,a]=g.useState(!1),o=g.useRef(!1),[i,l]=g.useState(!1),[u,d]=g.useState(!1),f=g.useRef(t);if(g.useEffect(()=>{f.current&&!t&&d(!0),f.current=t},[t]),!e)return null;const{versionCheck:p,upgrade:m,restart:w,desktopUpdate:x,running:b,onHandOff:j}=e,k=ebe({version:p.version,running:b,checking:s||t,answered:u,unreachable:i,now:Math.max(n,Date.now()),upgradeState:m.upgradeState,copied:m.cmdCopied,restarting:w.restarting,app:{inApp:ao(),update:x.appUpdate,version:O8(),menu:D8()}},$j);if(!k)return null;const v=ao()&&((A=p.version)==null?void 0:A.checkDisabled),S=v?"Ask the desktop app whether a newer ccdeck is out.":Vve,C=async()=>{var F;if(!_n(o.current||t)||v&&((F=x.appUpdate)==null?void 0:F.status)==="checking")return;o.current=!0,a(!0);const U=v?await nbe():await tbe(p.loadVersion);o.current=!1,a(!1),l(U==="unreachable"),d(!0)},_=U=>{if(U.kind==="copy")return void m.copyCommand();j(),p.showNotice(),U.kind==="install"?m.startUpgrade():w.askRestart({upgrade:!0})},R=k.line.tone==="warn"||!!k.line.action||!!((I=p.version)!=null&&I.notice)||(($=x.appUpdate)==null?void 0:$.status)==="downloading";return{state:k,check:C,act:_,checkWhy:S,needsAttention:R}}function abe({update:e}){const t=oc("above","dialog"),n=g.useId();return r.jsxs("div",{className:"rn-status-row",children:[e?r.jsx(obe,{line:e.state.line,onAct:e.act,bindHint:t.bind,whyId:`${n}-action`,announce:!1}):r.jsx("p",{className:"rn-update-line",children:r.jsx("span",{role:"status",children:"Update status unavailable."})}),t.node]})}function obe({line:e,onAct:t,bindHint:n,whyId:s,announce:a=!0}){const{action:o}=e,i=o&&r.jsx(ibe,{action:o,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:a?"status":void 0,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}),i]}):i]})}function ibe({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 lbe({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:o,updateVersion:i,updateBusy:l,onUpdateRestart:u,updateFailure:d,onRestart:f,updateCheck:p}){var B,T;const m=gt(a),w=g.useRef(null),x=wt(a),b=g.useId(),[j,k]=g.useState(null),v=rbe(p),S=((B=v==null?void 0:v.state.line.action)==null?void 0:B.kind)==="install"||((T=v==null?void 0:v.state.line.action)==null?void 0:T.kind)==="npx",C=f&&!i&&!S,{latest:_,visiblePrevious:R,history:A}=Mve(e,t!==null,n),I=`${b}-history`,$=!!C||!!(v!=null&&v.state.canCheck)&&!i;g.useEffect(()=>{var P;!$&&j&&(k(null),document.activeElement===document.body&&((P=w.current)==null||P.focus()))},[$,j]);const U=ks(n)?`v${n}`:Lve(e.slice(0,1)),F=s&&n?`New in v${n}.`:t?`Changes since v${t}.`:null,M=R.some(P=>P.notes.some(q=>!q.priority&&!q.notice));return r.jsx("div",{className:"modal-backdrop",...x,role:"presentation",children:r.jsxs("div",{ref:m,className:"modal release-notes",id:`${b}-dialog`,onClick:P=>P.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"}),U&&r.jsx("span",{className:"modal-tool-id",children:U})]}),r.jsxs("div",{className:"modal-actions",children:[$&&r.jsx("button",{id:`${b}-options`,type:"button",className:"glyph-btn","aria-label":"More options","aria-haspopup":"menu","aria-expanded":j!==null,"aria-controls":j?`${b}-menu`:void 0,onClick:()=>k(j?null:"first"),onKeyDown:P=>{(P.key==="ArrowDown"||P.key==="ArrowUp")&&(P.preventDefault(),k(P.key==="ArrowUp"?"last":"first"))},children:r.jsxs("svg",{className:"glyph",viewBox:"0 0 14 14",width:"14",height:"14",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"3",cy:"7",r:"1"}),r.jsx("circle",{cx:"7",cy:"7",r:"1"}),r.jsx("circle",{cx:"11",cy:"7",r:"1"})]})}),r.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),r.jsx("span",{className:"rn-live-status",role:"status",children:i?`ccdeck v${i} is downloaded and verified.`:v==null?void 0:v.state.line.said}),r.jsxs("section",{className:"modal-body",role:"region","aria-label":"Release notes",tabIndex:0,children:[i?r.jsxs("div",{className:"rn-ready",children:[r.jsxs("p",{children:["ccdeck v",i," is downloaded and verified."]}),r.jsx("p",{className:"rn-update-said",role:"status",children:d})]}):r.jsxs(r.Fragment,{children:[(v==null?void 0:v.needsAttention)&&r.jsx(abe,{update:v}),r.jsx("p",{className:"rn-update-said",role:"status",children:d})]}),F&&r.jsx("p",{className:"rn-context",children:F}),!(_!=null&&_.notes.length)&&!R.length&&r.jsx("p",{className:"rn-empty",children:"No release notes for this build."}),_&&r.jsx(e1,{entry:_,showVersion:t!==null&&e.length>1},_.version),R.length>0&&r.jsxs("section",{className:"rn-upgrade-history","aria-label":"Earlier changes in this upgrade",children:[r.jsx("h2",{className:"rn-group-title",children:"Earlier in this upgrade"}),M&&r.jsx("p",{className:"rn-context",children:"Older notes are shown in full so setup and other important changes stay visible."}),R.map(P=>r.jsx(e1,{entry:P,showVersion:!0},P.version))]}),A.length>0&&r.jsxs("details",{className:"rn-history",children:[r.jsxs("summary",{"aria-controls":I,children:["Other changes since v",t]}),r.jsx("div",{id:I,children:A.map(P=>r.jsx(e1,{entry:P,showVersion:!0},P.version))})]})]}),r.jsxs("footer",{className:"rn-footer",children:[r.jsxs("div",{className:"rn-footer-links",children:[r.jsxs("a",{href:"https://ccdeck.dev/changelog/",target:"_blank",rel:"noopener noreferrer","aria-label":"Release history (opens in a new tab)",children:["Release history ",r.jsx(Zl,{})]}),o&&!i&&r.jsx("button",{className:"rn-text-button",type:"button",onClick:o,children:"Take the tour"})]}),i&&u?r.jsx("button",{className:"btn primary",type:"button",onClick:u,"aria-busy":l||void 0,children:l?"Restarting…":Jl}):r.jsx("button",{className:"btn primary",type:"button",onClick:a,children:"Done"})]}),j&&$&&r.jsxs(ac,{anchorId:`${b}-options`,portalRootId:`${b}-dialog`,id:`${b}-menu`,role:"menu",labelledBy:`${b}-options`,start:j,className:"ap-pop rn-options-menu",onClose:()=>k(null),children:[v&&r.jsxs("p",{className:"rn-menu-status",id:`${b}-check-status`,children:[v.state.line.said,v.state.line.age&&r.jsx("span",{children:v.state.line.age})]}),(v==null?void 0:v.state.canCheck)&&r.jsxs("button",{type:"button",className:"ap-menu-item rn-act",role:"menuitem",title:v.checkWhy,"aria-describedby":`${b}-check-status`,"aria-busy":v.state.checking||void 0,onClick:()=>void v.check(),children:[r.jsx(_Q,{}),"Check for updates"]}),(v==null?void 0:v.state.canCheck)&&C&&r.jsx("div",{className:"rn-menu-separator",role:"separator"}),C&&r.jsxs("button",{type:"button",className:"ap-menu-item",role:"menuitem",title:VO,"aria-describedby":`${b}-restart-why`,onClick:()=>{k(null),f==null||f()},children:[r.jsx(EQ,{}),"Restart ccdeck"]}),r.jsx("span",{hidden:!0,id:`${b}-restart-why`,children:VO})]})]})})}function e1({entry:e,showVersion:t}){const{highlights:n,visible:s,more:a}=Rve(e.notes),o=n.filter(l=>l.details),i=g.useId();return r.jsxs("section",{className:"rn-release",children:[t&&r.jsxs("h2",{className:"rn-version",children:["v",e.version]}),e.summary&&r.jsx("h2",{className:"rn-summary",children:e.summary}),r.jsxs("ul",{className:"rn-notes",children:[n.map((l,u)=>r.jsx(t1,{note:l,highlight:!0},`h${u}`)),s.map((l,u)=>r.jsx(t1,{note:l},`v${u}`))]}),(a.length>0||o.length>0)&&r.jsxs("details",{className:"rn-more",children:[r.jsxs("summary",{"aria-controls":i,children:[r.jsxs("span",{className:"rn-more-start",children:[r.jsx("span",{className:"rn-chevron","aria-hidden":"true",children:"›"}),r.jsx("span",{className:"rn-more-label",children:a.length?`${a.length} more ${a.length===1?"improvement":"improvements"}`:"More details"})]}),r.jsxs("span",{className:"rn-more-hint",children:[r.jsx("span",{className:"rn-show-details",children:"Show details"}),r.jsx("span",{className:"rn-hide-details",children:"Hide details"})]})]}),r.jsxs("div",{id:i,children:[r.jsx("ul",{className:"rn-notes",children:a.map((l,u)=>r.jsx(t1,{note:l},u))}),o.length>0&&r.jsxs("div",{className:"rn-highlight-details",role:"group","aria-labelledby":`${i}-highlights`,children:[r.jsx("h3",{id:`${i}-highlights`,className:"rn-details-title",children:"More about the highlights"}),o.map((l,u)=>r.jsxs("p",{className:"rn-note-body",children:[r.jsxs("strong",{className:"rn-strong",children:[rB(l.title).rest.trimStart(),": "]}),Uu(qu(l.details))]},u))]})]})]})]})}const cbe={plans:FD,accounts:BD,skills:qD};function t1({note:e,highlight:t}){const{rest:n}=rB(e.title),s=e.icon?Kt(cbe,e.icon):void 0;return r.jsxs("li",{className:"rn-note","data-highlight":t||void 0,"data-required":e.priority==="required"||void 0,"data-has-icon":!!s||void 0,children:[s&&r.jsx("span",{className:"rn-title-icon","aria-hidden":"true",children:r.jsx(s,{})}),r.jsxs("div",{children:[r.jsx("h3",{className:"rn-note-title",children:n.trimStart()}),r.jsx("p",{className:"rn-note-body",children:Uu(qu(e.body))}),!t&&e.details&&r.jsx("p",{className:"rn-note-body rn-extra-detail",children:Uu(qu(e.details))}),e.notice&&r.jsxs("p",{className:"rn-note-notice",children:[r.jsxs("strong",{children:[e.noticeLabel??"Important",": "]}),Uu(qu(e.notice))]})]})]})}function Uu(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?r.jsx("code",{className:"rn-code",children:t.text},n):r.jsx("strong",{className:"rn-strong",children:Uu(t.kids)},n))}function ube({state:e,sessionId:t,onClose:n}){const s=g.useMemo(()=>dbe(e,t),[e,e.revision,t]),a=g.useRef(null),o=gt(n,{focusRef:a}),i=wt(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:$D}),r.jsx("div",{className:"ss-cost",children:lt(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":Qp(l),title:l,children:Qa(l)},l))})]}),r.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&r.jsxs(r.Fragment,{children:[r.jsx(ZN,{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:lt(s.cost.input)})]}),r.jsxs("span",{className:"ssl ssl-out",children:["output ",r.jsx("b",{children:lt(s.cost.output)})]}),r.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",r.jsx("b",{children:lt(s.cost.cacheRead)})]}),r.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",r.jsx("b",{children:lt(s.cost.cacheWrite)})]})]})]})})]}),r.jsxs("section",{className:"ss-stats",children:[r.jsx(pl,{label:"agents",value:s.agentCount}),r.jsx(pl,{label:"subagents",value:s.subagentCount}),r.jsx(pl,{label:"tool calls",value:s.toolCount}),r.jsx(pl,{label:"prompts",value:s.promptCount}),r.jsx(pl,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&r.jsx(pl,{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 pl({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 dbe(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const S of e.agents.values())S.sessionId===t&&s.push(S);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,d=0,f=0,p=0,m,w=1/0,x=0;for(const S of s){const C=Wn(S);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const R of SP(S))o.add(R);S.model&&o.add(S.model),S.kind==="subagent"&&p++;const _=aP(S.prompts);u+=_.length,!m&&_.length>0&&(m=_[0].text),d+=S.usage.inputTokens+S.usage.outputTokens,l+=S.toolCount,f+=S.toolErrorCount??0;for(const[R,A]of S.toolCountByName??[])i.set(R,(i.get(R)??0)+A);w=Math.min(w,S.startedAt),x=Math.max(x,S.endedAt??Date.now())}const b=Math.max(0,x-w),j=Math.floor(b/1e3),k=j<60?`${j}s`:j<3600?`${Math.floor(j/60)}m ${String(j%60).padStart(2,"0")}s`:`${Math.floor(j/3600)}h ${Math.floor(j%3600/60)}m`,v=Array.from(i.entries()).sort((S,C)=>C[1]-S[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:a,modelChips:Array.from(o),agentCount:s.length,subagentCount:p,toolCount:l,promptCount:u,tokensSum:d,errCount:f,topTools:v,firstPrompt:m}}function Bt({id:e,title:t,note:n,noteId:s,aside:a,list:o=!0,settingId:i,className:l,children:u}){const d=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:d,"data-setting":i,children:f}):r.jsxs("section",{className:d,"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:d}){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}),d]});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 lB(e,t){const[n,s]=g.useState(null),[a,o]=g.useState(!1),[i,l]=g.useState(""),u=g.useRef(!1),d=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(d((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||!_n(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(d(m.prefs[e]))}catch{l("Could not save this setting. Try again.")}finally{u.current=!1,o(!1)}}}}}function GO({provider:e}){const t=e==="Codex"?"recoverCodexSessions":"recoverClaudeSessions",n=`${e.toLowerCase()}-session-recovery`,s=lB(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,...qn(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(hbe,{})]})}function hbe(){const e=lB("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,...qn(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 fbe="Hide finished sessions after",pbe="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 mbe(){const e=y8();return r.jsx(Bt,{id:"settings-board-caption",title:"Board",children:r.jsx(mt,{settingId:"hide-finished",name:fbe,nameId:"settings-hide-finished-label",note:"Hidden sessions stay available in the session list.",details:pbe,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:f8.map(t=>r.jsx("option",{value:t,children:ige(t)},t))})})})}const gbe="Accounts and auto-switch",ybe="Your Claude accounts, and Auto-switch, which moves Claude Code to another one before the account in use runs out.",wbe="Local network",xbe="Pairing with the decks on your other machines, so a login that expires on one is repaired from another.",vbe="Browser Watch",bbe="Whether something drove your browser while you were away, and what the deck does about it.";function kbe({claudeHere:e,singleKeys:t,doors:n}){return r.jsxs(Bt,{id:"settings-elsewhere-caption",title:"Elsewhere on the deck",children:[e&&r.jsx(n1,{settingId:"accounts",name:gbe,note:ybe,onOpen:n.accounts,cap:t?{key:"A",title:"Press A anywhere to show or hide the accounts panel"}:null}),e&&r.jsx(n1,{settingId:"local-network",name:wbe,note:xbe,onOpen:n.localNetwork,cap:null}),r.jsx(n1,{settingId:"browser-watch",name:vbe,note:bbe,onOpen:n.browserWatch,dialog:!0,cap:t?{key:"B",title:"Press B anywhere to open or close Browser Watch"}:null})]})}function n1({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 jbe="Single-key shortcuts",Nbe="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 Sbe(e){const t=e.binds.includes("?")?"the keyboard shortcuts sheet":e.action;return t.charAt(0).toUpperCase()+t.slice(1)}function Cbe(e,t){const n=t.trim().toLowerCase();return n?[e.action,e.cap,e.macCap??""].some(s=>s.toLowerCase().includes(n)):!0}function _be({singleKeys:e,onToggleSingleKeys:t}){const n=co(to()),[s,a]=g.useState(""),o=g.useId(),i=Id(),l=eB(e,u=>na(i,u)).map(u=>({...u,rows:u.rows.filter(d=>Cbe(d,s))})).filter(u=>u.rows.length>0);return r.jsxs(r.Fragment,{children:[r.jsx(Bt,{children:r.jsx(mt,{settingId:"single-keys",name:jbe,nameId:"settings-single-keys-label",note:Nbe,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=>{rm(u.key)&&s&&(u.stopPropagation(),a(""))}})]}),l.map(u=>{const d=`settings-keys-${u.title.toLowerCase().replace(/[^a-z]+/g,"-")}`;return r.jsx(Bt,{id:d,title:u.title,className:"settings-keys",children:u.rows.map(f=>r.jsx(mt,{as:"div",name:Sbe(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:Q8})]})}function Ebe({notifyOn:e,onToggleNotify:t,notifyVetoed:n,notifyPermission:s,onAskNotify:a,accountNotify:o,onToggleAccountNotify:i}){const l=Tee(s),u=ao(),d=e&&!n&&!u,f=g.useRef(null),p=ea(!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?Cee:See(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"})})}),d&&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?Eee:_ee,children:XD.map(({kind:m,label:w,title:x})=>r.jsx(mt,{settingId:m,name:w,nameId:`sm-${m}-label`,note:x,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 Tbe=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function Abe(e){return Tbe.find(t=>e(t))}const Rbe=4400;function Mbe(e){const t=e.split(";")[0];return{name:`Recorded voice.${t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm"}`,type:t}}function $be({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),d=()=>{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=Abe(j=>MediaRecorder.isTypeSupported(j)),x=new MediaRecorder(p,w?{mimeType:w}:void 0),b=[];i.current=x,x.ondataavailable=j=>{j.data.size&&b.push(j.data)},x.onerror=()=>t("Recording failed. Please try again."),x.onstop=()=>{p.getTracks().forEach(S=>S.stop()),l.current!==null&&clearTimeout(l.current),l.current=null;const j=i.current===x;if(j&&(i.current=null),o(!1),!j||!b.length)return;const k=Mbe(x.mimeType),v=new File(b,k.name,{type:k.type});n(()=>s(v))},x.start(200),o(!0),l.current=setTimeout(d,Rbe)}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:d}}function Lbe({full:e,fullProps:t,runCustom:n,onCreateVoice:s}){const[a,o]=g.useState("Custom voice"),[i,l]=g.useState("Your turn"),[u,d]=g.useState(""),[f,p]=g.useState("1"),[m,w]=g.useState("1"),[x,b]=g.useState([]);return g.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const j=()=>{b(window.speechSynthesis.getVoices())};return j(),window.speechSynthesis.addEventListener("voiceschanged",j),()=>window.speechSynthesis.removeEventListener("voiceschanged",j)},[]),r.jsxs("details",{className:"sm-voice",children:[r.jsxs("summary",{className:"settings-row",...t,onClick:j=>{const k=j.currentTarget.parentElement;e&&k&&!k.open&&j.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:j=>o(j.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Text"}),r.jsx("input",{className:"ap-manage-input",value:i,maxLength:180,onChange:j=>l(j.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Voice"}),r.jsxs("select",{className:"sm-select",value:u,onChange:j=>d(j.target.value),children:[r.jsx("option",{value:"",children:"System default"}),x.map(j=>r.jsx("option",{value:j.voiceURI,children:j.name},j.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:j=>p(j.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:j=>w(j.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 Ibe({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:s,onPreviewCustom:a,onDeleteCustom:o}){const[i,l]=g.useState(""),u=e.length,d=G1(u),f=d!==null,p=f?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[m,w]=g.useState(null),x=g.useRef(0),b=g.useRef(new Map),j=g.useRef(null),k=g.useRef(null);g.useEffect(()=>{if(!m)return;const A=window.setTimeout(()=>w(null),4e3);return()=>window.clearTimeout(A)},[m]);const v=async A=>{l("");try{await A()}catch(I){l(I instanceof Error?I.message:"Custom audio could not be saved.")}},S=(A,I)=>{const $=Date.now(),U=fi({armedFor:m,target:A,armedAt:x.current,now:$,gapMs:hi});if(U==="arm"){w(A),x.current=$;return}if(U==="ignore")return;w(null);const F=Pee(e.map(M=>M.id),A);v(async()=>{var B;await o(A);const M=document.activeElement;M!==I&&!Hn((M==null?void 0:M.tagName)??null)||(B=F?b.current.get(F):j.current)==null||B.focus()})},{recording:C,startRecording:_,stopRecording:R}=$be({full:f,setCustomError:l,runCustom:v,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 ",V1]}),className:"sm-custom",settingId:"custom-sounds",children:[f&&r.jsx("p",{className:"settings-row settings-row-status",id:"sm-custom-full",children:d}),r.jsx(mt,{as:"div",settingId:"custom-import",name:"Import audio",note:"WAV, MP3 or OGG",control:r.jsx("button",{ref:j,type:"button",className:"btn sm-custom-action",...p,onClick:()=>{var A;f||(A=k.current)==null||A.click()},children:"Choose file"}),children:r.jsx("input",{ref:k,type:"file",hidden:!0,accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",onChange:A=>{var $;const I=($=A.target.files)==null?void 0:$[0];A.currentTarget.value="",I&&!f&&v(()=>t(I))}})}),r.jsx(mt,{as:"div",settingId:"custom-record",name:"Record a clip",note:C?"Recording…":"Up to 5 seconds",control:C?r.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:R,children:"Stop & save"}):r.jsx("button",{type:"button",className:"btn sm-custom-action",...p,onClick:()=>void _(),children:"Record"})}),r.jsx(Lbe,{full:f,fullProps:p,runCustom:v,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:I=>{if(!I.target.value.trim()){I.target.value=A.name;return}v(()=>s(A.id,I.target.value))},onKeyDown:I=>{I.key==="Enter"&&I.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:I=>{I?b.current.set(A.id,I):b.current.delete(A.id)},className:`btn sm-custom-icon${m===A.id?" armed":""}`,onKeyDown:I=>{I.repeat&&I.preventDefault()},onClick:I=>S(A.id,I.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 Obe="A tone when a turn finishes, and when Claude asks for something.";function Pbe({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:Obe,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 Oj="custom:";function KO(e){return`${Oj}${e}`}function Dbe(e){return e.startsWith(Oj)?e.slice(Oj.length):null}function Fbe({id:e,label:t="Volume",value:n,step:s=UN,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:Bf,max:yp,step:s,value:n,"aria-describedby":o,onChange:i=>a(Number(i.target.value)),style:{"--sm-level":`${(n-Bf)/(yp-Bf)*100}%`}}),r.jsxs("span",{className:"sm-read",children:[n,"%"]})]})}const YO={done:"Turn finished","needs-input":"Claude is asking"},Bbe={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function qbe({chime:e,tone:t,soundOn:n,customAssets:s,customSelections:a,onLevel:o,onFigure:i,onPreview:l,onBuiltInSelected:u,onCustomSelected:d}){const f=`sm-level-${e}`,p=`sm-figure-${e}`,m=a[e];return r.jsxs(Bt,{id:`sm-name-${e}`,title:YO[e],note:Bbe[e],settingId:`tone-${e}`,aside:r.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(e),"aria-label":`Hear the ${YO[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(Fbe,{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?KO(m):t.figure,onChange:w=>{const x=w.target.value,b=Dbe(x);b!==null?d(e,b):(u(e),i(e,x))},children:[qN[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:KO(w.id),children:w.name},w.id))})]})]})]})}const Ube="Claude Code isn't on this machine, so only Turn finished plays here — for Codex turns.";function Wbe({soundOn:e,onToggleSound:t,prefs:n,claudeHere:s,onLevel:a,onFigure:o,onPreview:i,customAssets:l,customSelections:u,onBuiltInSelected:d,onCustomSelected:f,onImportCustom:p,onCreateVoice:m,onRenameCustom:w,onPreviewCustom:x,onDeleteCustom:b}){var S;const j=Iee(u),k=((S=l.find(C=>C.id===j))==null?void 0:S.name)??"the same custom sound",v=j?`Both tones use “${k}”. They may be harder to tell apart.`:"";return r.jsxs("div",{className:"sm-sounds",children:[r.jsx(Pbe,{soundOn:e,onToggleSound:t}),!s&&r.jsx("p",{className:"sm-note",children:Ube}),!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:Lu.map(C=>r.jsx(qbe,{chime:C,tone:n[C],soundOn:e,customAssets:l,customSelections:u,onLevel:a,onFigure:o,onPreview:i,onBuiltInSelected:d,onCustomSelected:f},C))}),v&&r.jsx("p",{className:"sm-note","aria-hidden":!0,children:v}),r.jsx("p",{className:"vis-hidden",role:"status",children:v}),r.jsx(Ibe,{customAssets:l,onImportCustom:p,onCreateVoice:m,onRenameCustom:w,onPreviewCustom:x,onDeleteCustom:b})]})}const Hbe="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 zbe({onOpen:e}){return r.jsx(Bt,{children:r.jsx(mt,{as:"div",settingId:"radar-open",name:"Radar",nameId:"settings-radar-open-name",note:Hbe,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 Vbe=6500,Gbe=1e4;let oi={reading:null,saving:null,error:"",undone:null};const zf=new Set;let gu=null,yu=null,oa=null,s1=!1,Vf=0;const Ko=e=>{oi={...oi,...e},zf.forEach(t=>t(oi))};function cB(e){const t=e;return!!t&&t.ok===!0&&Array.isArray(t.settings)&&typeof t.present=="object"}async function uB(e){const t=await fetch("/api/claude-settings",{signal:e}),n=await t.json();if(!t.ok||!cB(n))throw new Error;return n}async function Pj(){if(s1||oi.saving)return;s1=!0;const e=Vf,t=new AbortController;oa=t;let n=!1;const s=setTimeout(()=>{n=!0,t.abort()},5e3);try{const a=await uB(t.signal);e===Vf&&!t.signal.aborted&&Ko({reading:a,error:""})}catch{e===Vf&&(n||!t.signal.aborted)&&Ko({error:"Could not read Claude Code settings. Try again."})}finally{clearTimeout(s),s1=!1,oa===t&&(oa=null)}}function XO(e,t){var n;return(n=e==null?void 0:e.settings.find(s=>s.id===t))==null?void 0:n.value}async function ZO(e,t){if(oi.saving)return;Vf++,oa==null||oa.abort(),yu&&(clearTimeout(yu),yu=null),Ko({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||!cB(o))throw new Error(typeof(o==null?void 0:o.error)=="string"?o.error:"Could not save the change. Try again.");Ko({reading:o});const i=XO(o,e);yu=setTimeout(()=>{yu=null;const l=new AbortController,u=setTimeout(()=>l.abort(),5e3);uB(l.signal).then(d=>{Ko({reading:d,undone:XO(d,e)===i?null:{id:e}})}).catch(()=>{}).finally(()=>clearTimeout(u))},Vbe)}catch(a){Ko({error:a instanceof Error&&a.message?a.message:"Could not save the change. Try again."})}finally{clearTimeout(s),Ko({saving:null})}}function Kbe(){const[e,t]=g.useState(oi);return g.useEffect(()=>(zf.add(t),t(oi),gu||(Pj(),gu=setInterval(()=>void Pj(),Gbe)),()=>{zf.delete(t),zf.size||(gu&&clearInterval(gu),gu=null,oa==null||oa.abort())}),[]),e}const r1=40,Ybe={boolean:"on or off",choice:"a choice",number:"a number",text:"text",structured:"a list or object"};function Xbe(e){const t=e.scope==="Global config"?"kept in ~/.claude.json":e.scope==="Managed"?"managed settings only":null;return[e.topic,Ybe[e.kind],t,e.since?`Claude Code ${e.since}+`:null].filter(Boolean).join(" · ")}function Zbe(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 dB=null;const Jbe=()=>dB??(dB=gi(()=>import("./claude-settings-index-1Qg1AUda.js"),[]).then(e=>e.default.keys));function Qbe({present:e,noFile:t=!1}){const[n,s]=g.useState(null),[a,o]=g.useState(""),i=g.useId();g.useEffect(()=>{let f=!0;return Jbe().then(p=>{f&&s(p)},()=>{dB=null}),()=>{f=!1}},[]);const l=g.useMemo(()=>{if(!n)return[];if(a.trim())return Zbe(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,r1),d=a.trim()!=="";return r.jsxs(Bt,{id:"claude-group-all",settingId:"claude-all-settings",title:"All Claude Code settings",note:d?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=>{rm(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:Xbe(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:`${vee}#${f.anchor}`,target:"_blank",rel:"noreferrer","aria-label":`${f.key} in Claude Code's settings reference`,children:"Reference"})]})},f.key)})}),d&&l.length===0&&n&&r.jsxs("p",{className:"settings-empty",role:"status",children:["No setting matches “",a.trim(),"”."]}),l.length>r1&&r.jsxs("p",{className:"settings-foot",role:"status",children:[l.length-r1," more. Type more of the name to narrow the list."]}),!d&&e&&!t&&n&&l.length===0&&r.jsx("p",{className:"settings-empty",children:"Your settings.json sets nothing yet."})]})}const eke="Changed back after saving, most likely by a running Claude Code session. Set it again to keep it.",tke="There is no settings.json yet, so Claude Code uses its defaults. The first change here creates it.";function nke(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 ske(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 JO="\0custom";function rke({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 d=e.kind==="days"?e.options.map(m=>({value:String(m),label:yA(m)})):e.options,f=t?t.custom?JO:t.value===null?"":String(t.value):"",p=e.kind==="days"&&t&&!t.custom&&!d.some(m=>m.value===f)?[...d,{value:f,label:yA(Number(f))}].sort((m,w)=>Number(m.value)-Number(w.value)):d;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;ZO(e.id,e.kind==="days"?Number(w):w===""?null:w)},children:[(t==null?void 0:t.custom)&&r.jsx("option",{value:JO,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&&ZO(e.id,!u)},children:r.jsx("span",{className:"switch-knob"})})}function ake(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 oke(){return r.jsx(ike,{state:Kbe()})}function ike({state:e}){const{reading:t,saving:n,error:s,undone:a}=e,o=ake(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:tke}),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 Pj(),children:"Retry"})})]})]}),l&&GD.map(u=>r.jsx(Bt,{id:`claude-group-${u.id}`,title:u.title,children:KD.filter(d=>d.group===u.id).map(d=>{const f=t==null?void 0:t.settings.find(x=>x.id===d.id),p=`claude-${d.id}-label`,m=`claude-${d.id}-note`,w=f&&!f.editable&&!o?f.reason:(a==null?void 0:a.id)===d.id?eke:f!=null&&f.override?ske(f.override):"";return r.jsx(mt,{settingId:`claude-${d.id}`,name:d.label,nameId:p,note:d.note,noteId:m,control:r.jsx(rke,{entry:d,row:f,saving:n,nameId:p,noteId:m}),children:r.jsx("span",{className:"settings-row-said settings-row-said-quiet",role:"status",children:w})},d.id)})},u.id)),l&&r.jsx("p",{className:"settings-foot",children:nke(t==null?void 0:t.fileShown)}),r.jsx(Qbe,{present:(t==null?void 0:t.present)??null,noFile:i})]})}const lke="Local statistics for Claude and Codex on this device. Commands are grouped by operation; raw arguments and outputs are not saved.";function cke(){const[e,t]=g.useState(null),[n,s]=g.useState(""),[a,o]=g.useState(!1),[i,l]=g.useState(null),[u,d]=g.useState(""),f=g.useRef(!1),p=g.useRef(!0),m=async()=>{if(f.current)return;f.current=!0,o(!0),s("");const b=new AbortController,j=window.setTimeout(()=>b.abort(),12e3);try{const k=await fetch("/api/tool-audit/storage",{signal:b.signal}),v=await k.json();if(!k.ok||!v.ok)throw new Error;p.current&&t(v)}catch{p.current&&s("Could not read tool history storage. Try again.")}finally{window.clearTimeout(j),f.current=!1,p.current&&o(!1)}};g.useEffect(()=>(p.current=!0,m(),()=>{p.current=!1}),[]);const w=async(b,j)=>{if(f.current)return;f.current=!0,o(!0),s(""),d("");let k=!1;const v=new AbortController,S=window.setTimeout(()=>v.abort(),15e3);try{const C=await fetch("/api/tool-audit/storage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b==="clear"?{action:b,confirm:!0}:{action:b,days:j}),signal:v.signal}),_=await C.json();if(!C.ok||!_.ok)throw new Error;k=!0,p.current&&(l(null),d(b==="clear"?"Tool history cleared. New calls will continue to be recorded.":`Retention changed to ${j} days.`))}catch{p.current&&s("Could not update tool history. Check storage permissions and try again.")}finally{window.clearTimeout(S),f.current=!1,p.current&&(o(!1),k&&m())}},x=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:lke,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:b=>{if(f.current)return;const j=Number(b.target.value);j<e.retentionDays?l(j):w("retention",j)},children:[30,60,90].map(b=>r.jsxs("option",{value:b,children:[b," days"]},b))})}),typeof i=="number"&&x,r.jsx(mt,{as:"div",settingId:"tool-history-size",name:"Space used",note:`Collected since ${Ate(e.startedAt)}`,control:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"settings-read",children:Tte(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"&&x,!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 Dj="agent-dag.integrations.active",YS=(e,t)=>`agent-dag.integrations.prefs.${e}:${t}`,uke=32e3;function QO(e,t){const n=nt(YS(e,t));if(!n)return{};try{const s=JSON.parse(n);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function Aje(e,t){return{read(n,s){const a=QO(e,t)[n];return s(a)?a:void 0},write(n,s){const a=QO(e,t);s===void 0?delete a[n]:a[n]=s;const o=JSON.stringify(a);o.length<=uke&&st(YS(e,t),o)}}}function dke(e,t){vs(YS(e,t))}function Rje(e){const t=nt(Dj);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 Mje(e,t){let n={};try{const s=nt(Dj),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(Dj,JSON.stringify(n))}function Fj(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 Bj(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 hke({connection:e,provider:t,available:n,busy:s,armed:a,note:o,headingRef:i,onTest:l,onEdit:u,onDisconnect:d,onCancelDisconnect:f}){var C;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",x=e.account.name&&e.account.login!==e.account.name?e.account.login:"",b=Fj(e),j=Bj(e),k=Array.isArray((C=e.meta)==null?void 0:C.warnings)?e.meta.warnings.filter(_=>typeof _=="string"):[],v=s===`test:${e.id}`,S=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,x?` (${x})`:""]})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Last verified"}),r.jsx("dd",{children:b??"No verification time available"})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Credentials"}),r.jsx("dd",{children:e.tokenSaved?"Stored locally":"No token saved"})]}),j&&r.jsxs("div",{children:[r.jsx("dt",{children:"Server"}),r.jsx("dd",{children:j})]})]}),!n&&r.jsxs("p",{className:"ig-stranded",children:[m," is not available on this deck. Disconnect deletes this connection and its saved token."]}),k.length>0&&r.jsx("ul",{className:"ig-warnings",children:k.map(_=>r.jsx("li",{children:_},_))}),n&&r.jsxs("div",{className:"ig-manage-actions",children:[r.jsx("button",{type:"button",className:"btn","aria-busy":v,"aria-disabled":s!==null||void 0,onClick:l,children:v?"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":S,"aria-disabled":s!==null||void 0,onKeyDown:_=>{_.repeat&&_.preventDefault()},"aria-label":a?`Confirm disconnecting ${e.name}`:`Disconnect ${e.name}`,onClick:_=>d(_.currentTarget),children:S?"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 fke({onBeforeLeaveChange:e}={}){var We;const t=Id(),{connections:n,error:s}=t,[a,o]=g.useState(null),i=g.useRef(null),l=g.useRef(new Map),u=g.useRef(null),d=g.useRef(0),[f,p]=g.useState(null),[m,w]=g.useState(""),x=g.useRef(null),b=g.useRef(null),[j,k]=g.useState(null),[v,S]=g.useState(null),C=g.useRef(null),[_,R]=g.useState(null),[A,I]=g.useState([]),[$,U]=g.useState(null),F=g.useRef(0),[M,B]=g.useState(null),T=g.useRef(null),P=g.useRef(new Map),q=g.useRef(null),K=g.useRef(0),[z,H]=g.useState(!1),[D,O]=g.useState(null),V=g.useRef(null),Z=g.useRef(new Map),W=g.useRef(new Map);g.useEffect(()=>{const se=Xye();se&&(q.current=Z.current.get(se)??null,p(se),B(se),k({mode:"edit",id:se}));const be=Yye();be&&k({mode:"add",kind:be})},[]),g.useEffect(()=>{var se,be;!M||!n||(be=(se=W.current.get(M))==null?void 0:se.scrollIntoView)==null||be.call(se,{block:"nearest"})},[M,n]),g.useEffect(()=>{if(!$)return;const se=()=>{var Oe,ve;((Oe=document.activeElement)==null?void 0:Oe.getAttribute("aria-label"))==="Cancel disconnect"&&((ve=document.querySelector(".ig-manage-view [data-integration-disconnect]"))==null||ve.focus()),U(null)},be=()=>{document.hidden&&se()},Te=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",be),()=>{window.clearTimeout(Te),window.removeEventListener("blur",se),document.removeEventListener("visibilitychange",be)}},[$]);const X=(se,be,Te,Oe)=>I(ve=>[...ve.filter(pe=>pe.id!==se),{id:se,tone:be,text:Te,scope:Oe}]),Y=se=>I(be=>be.filter(Te=>Te.id!==se)),J=async(se,be)=>{if(!C.current){C.current=se,S(se);try{await be()}finally{C.current=null,S(null)}}},Q=se=>(be,Te)=>void J("form",async()=>{R(null);try{const Oe=await Hye(se,be,Te||void 0);k(null),O(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}.`),B(Oe.id),T.current=()=>{var pe;const ve=l.current.get(Oe.kind)??Z.current.get(Oe.id);return(pe=ve==null?void 0:ve.scrollIntoView)==null||pe.call(ve,{block:"nearest"}),ve}}catch(Oe){R(Oe instanceof wr?Oe:new wr("upstream","The connection could not be saved."))}}),te=se=>(be,Te)=>void J("form",async()=>{R(null);try{const{connection:Oe,validated:ve}=await zye(se.id,{name:Te,input:be});k(null),O(null),H(!1),T.current=()=>b.current??(f?x.current:Z.current.get(Oe.id)),X(Oe.id,"ok",ve?`Saved. Connection test passed as ${Oe.account.name||Oe.account.login}.`:"Saved.")}catch(Oe){R(Oe instanceof wr?Oe:new wr("upstream","The change could not be saved."))}}),le=se=>void J(`test:${se.id}`,async()=>{U(null),Y(se.id);try{const be=await Vye(se.id);X(se.id,"ok",`Connection test passed. Signed in as ${be.account.name||be.account.login}.`)}catch(be){X(se.id,"err",be instanceof Error?be.message:"The test failed.")}}),de=(se,be)=>{if(C.current)return;const Te=Date.now(),Oe=fi({armedFor:$,target:se.id,armedAt:F.current,now:Te,gapMs:hi});if(Oe==="arm"){be.focus({preventScroll:!0}),U(se.id),F.current=Te;return}Oe!=="ignore"&&(U(null),J(`delete:${se.id}`,async()=>{try{await Gye(se.id),dke(se.kind,se.id),Y(se.id),(j==null?void 0:j.mode)==="edit"&&j.id===se.id&&k(null),p(null);const ve=(n??[]).filter(_e=>_e.kind===se.kind&&_e.id!==se.id);(!a||ve.length===0)&&o(null),w("Connection disconnected.");const pe=document.activeElement;(pe===be||Hn((pe==null?void 0:pe.tagName)??null))&&(T.current=()=>{var ze;const _e=(a&&ve[0]?Z.current.get(ve[0].id):l.current.get(se.kind))??P.current.get(se.kind)??document.getElementById("settings-tab-integrations");return(ze=_e==null?void 0:_e.scrollIntoView)==null||ze.call(_e,{block:"nearest"}),_e})}catch(ve){X(se.id,"err",ve instanceof Error?ve.message:"The connection could not be removed. Try again.","disconnect")}}))};g.useEffect(()=>{if(v!==null||D||!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,j,v,D]);const oe=n??[],re=Od(t),he=["github","gitlab","jira"],fe=zS().filter(se=>re.has(se.kind)||oe.some(be=>be.kind===se.kind)).sort((se,be)=>he.indexOf(se.kind)-he.indexOf(be.kind)),$e=GS(t),ye=g.useCallback(()=>{k(null),p(null),o(null),H(!1),O(null),R(null),U(null),T.current=()=>{const se=q.current,be=se==null?void 0:se.closest(".settings-pane");return be&&(be.scrollTop=K.current),se!=null&&se.isConnected?se:document.getElementById("settings-tab-integrations")}},[]),ge=g.useCallback(()=>{if(!a){ye();return}p(null),k(null),H(!1),O(null),R(null),U(null),T.current=()=>{var Te;const se=(Te=u.current)!=null&&Te.isConnected?u.current:i.current,be=se==null?void 0:se.closest(".settings-pane");return be&&(be.scrollTop=se===i.current?0:d.current),se}},[a,ye]),je=g.useCallback(()=>{if(!f&&!a){ye();return}k(null),H(!1),O(null),R(null),T.current=()=>b.current??(f?x.current:i.current)},[f,a,ye]),Le=g.useCallback((se,be=!1)=>{if(C.current)return;if(D&&be){O(null),requestAnimationFrame(()=>{var Oe;return(Oe=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:Oe.focus()});return}const Te=be?j?je:f?ge:ye:()=>{k(null),p(null),o(null),se()};z?O(()=>Te):(H(!1),Te())},[z,D,j,f,je,ge,ye]);g.useEffect(()=>(e==null||e(j||f||a?Le:null),()=>e==null?void 0:e(null)),[j,f,a,Le,e]),g.useEffect(()=>{var se;D&&((se=V.current)==null||se.focus())},[D]),g.useEffect(()=>{var se;f&&((se=x.current)==null||se.focus())},[f]),g.useEffect(()=>{var se;a&&((se=i.current)==null||se.focus())},[a]);const ke=(se,be)=>{var Oe;if(C.current)return;T.current=null,O(null),w(""),U(null),f||a?b.current=be:(K.current=((Oe=be.closest(".settings-pane"))==null?void 0:Oe.scrollTop)??0,q.current=be,b.current=null),H(!1),R(null),k(se);const Te=be.closest(".settings-pane");Te&&(Te.scrollTop=0)},Ie=(se,be)=>{var Oe,ve;if(C.current)return;T.current=null,a?(u.current=be,d.current=((Oe=be.closest(".settings-pane"))==null?void 0:Oe.scrollTop)??0):(K.current=((ve=be.closest(".settings-pane"))==null?void 0:ve.scrollTop)??0,q.current=be),b.current=null,w(""),U(null),p(se.id);const Te=be.closest(".settings-pane");Te&&(Te.scrollTop=0)},De=(se,be)=>{var ve;const Te=oe.filter(pe=>pe.kind===se);if(Te.length===1){Ie(Te[0],be);return}if(C.current)return;T.current=null,K.current=((ve=be.closest(".settings-pane"))==null?void 0:ve.scrollTop)??0,q.current=be,u.current=null,d.current=0,w(""),U(null),o(se);const Oe=be.closest(".settings-pane");Oe&&(Oe.scrollTop=0)},Ue=(se,be=!1)=>{const Te=Tu(se.kind),Oe=!na(t,se.kind),ve=Fj(se),pe=se.account.login||se.account.name,_e=se.kind==="jira"?Bj(se):null;return r.jsx("div",{className:"ig-conn",ref:ze=>{ze?W.current.set(se.id,ze):W.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:be&&se.name||Uo(se)}),r.jsx("span",{className:"ig-conn-line",children:[be&&se.name!==Uo(se)?Uo(se):"",pe,_e||(ve?`Last verified ${ve}`:"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:[(Te==null?void 0:Te.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:ze=>{ze?Z.current.set(se.id,ze):Z.current.delete(se.id)},"aria-label":`Manage ${(Te==null?void 0:Te.label)??se.kind}: ${se.name} (${pe||Uo(se)})`,onClick:ze=>Ie(se,ze.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=>!fe.some(be=>be.kind===se.kind)),we=a?Tu(a):null,Fe=oe.filter(se=>se.kind===a),Re=oe.find(se=>se.id===f),Ae=(j==null?void 0:j.mode)==="edit"?oe.find(se=>se.id===j.id):void 0,rt=(j==null?void 0:j.mode)==="add"?fe.find(se=>re.has(se.kind)&&se.kind===j.kind):Ae&&fe.find(se=>re.has(se.kind)&&se.kind===Ae.kind);return r.jsxs("div",{className:"ig-settings","data-view":j?"form":f?"connection":a?"provider":"overview",children:[j&&r.jsxs("div",{className:"ig-config-view",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":v!==null||void 0,onClick:()=>Le(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 ${(we==null?void 0:we.label)??a} connections`:"All integrations"]}),D&&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:V,type:"button",className:"btn",onClick:()=>{O(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=D;O(null),H(!1),k(null),se()},children:"Discard changes"})]})]}),r.jsx("div",{hidden:!!D,children:rt?r.jsx(vye,{def:rt,existing:Ae,busy:v==="form",error:_,onDirtyChange:H,onSubmit:j.mode==="add"?Q(j.kind):te(Ae),onCancel:()=>Le(je,!0)},j.mode==="add"?j.kind:j.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:j!==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":v!==null||void 0,onClick:()=>Le(ye,!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"]}),na(t,a)&&r.jsxs("button",{type:"button",className:"btn","aria-disabled":v!==null||void 0,onClick:se=>ke({mode:"add",kind:a},se.currentTarget),children:["Add ",(we==null?void 0:we.label)??a," connection"]})]}),r.jsxs("h2",{ref:i,tabIndex:-1,className:"ig-managed-title",children:[(we==null?void 0:we.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=>Ue(se,!0))}):r.jsx("p",{role:"status",children:"No saved connections."})]}),f&&r.jsxs("div",{className:"ig-manage-view",hidden:j!==null,children:[r.jsxs("div",{className:"ig-manage-navigation",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":v!==null||void 0,onClick:()=>Le(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"})}),a?`Back to ${(we==null?void 0:we.label)??a} connections`:"All integrations"]}),Re&&na(t,Re.kind)&&r.jsxs("button",{type:"button",className:"btn","aria-disabled":v!==null||void 0,onClick:se=>ke({mode:"add",kind:Re.kind},se.currentTarget),children:["Add ",((We=Tu(Re.kind))==null?void 0:We.label)??Re.kind," connection"]})]}),Re?r.jsx(hke,{connection:Re,provider:Tu(Re.kind),available:na(t,Re.kind),busy:v,armed:$===f,note:A.find(se=>se.id===f),headingRef:x,onTest:()=>le(Re),onEdit:se=>ke({mode:"edit",id:Re.id},se),onDisconnect:se=>de(Re,se),onCancelDisconnect:()=>U(null)}):r.jsx("p",{role:"status",children:"This connection is no longer saved."})]}),r.jsxs("div",{className:"ig-overview",hidden:j!==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 Ym(),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:$e==="all"?"integrations-add-title":void 0,children:fe.map(se=>{const be=oe.filter(_e=>_e.kind===se.kind),Te=be.length===1?be[0]:null,Oe=[...new Set(be.map(Uo))],ve=Te&&Fj(Te),pe=(Te==null?void 0:Te.kind)==="jira"?Bj(Te):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}),be.length===0?r.jsx("span",{className:"ig-conn-line",children:"Not connected"}):Te?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"ig-conn-name",children:Uo(Te)}),r.jsx("span",{className:"ig-conn-line",children:[Te.account.login||Te.account.name,pe||(ve?`Last verified ${ve}`:"Not verified yet")].filter(Boolean).join(" · ")}),!Te.tokenSaved&&r.jsx("span",{className:"ig-bad",children:"No token saved"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"ig-conn-name",children:[be.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${be.length?"":" primary"}`,"aria-disabled":v!==null||void 0,ref:_e=>{const ze=be.length?l.current:P.current;_e?ze.set(se.kind,_e):ze.delete(se.kind)},"aria-label":`${be.length?"Manage":"Connect"} ${se.label}`,onClick:_e=>be.length?De(se.kind,_e.currentTarget):ke({mode:"add",kind:se.kind},_e.currentTarget),children:be.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||fe.length===0&&$e!=="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=>Ue(se,!0)),oe.length===0&&r.jsx("p",{className:"settings-row settings-row-status",children:"Nothing connected."})]})]}),$e==="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 pke({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 mke({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,d=(pr.indexOf(l??e)+(i.key==="ArrowLeft"||i.key==="ArrowUp"?-1:1)+pr.length)%pr.length;t(pr[d]),(p=i.currentTarget.querySelectorAll('[role="radio"]')[d])==null||p.focus()},a=g.useRef(null),o=g.useRef(e);return g.useEffect(()=>{var u,d;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||(d=a.current.querySelector(`[data-theme-choice="${e}"]`))==null||d.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:pr.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(pke,{theme:i}),r.jsxs("span",{className:"appearance-theme-name",children:[ic[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 gke=[["smallest","Smallest","11 px"],["smaller","Smaller","12 px"],["default","Default","13 px"],["larger","Larger","15 px"],["largest","Largest","17 px"]],yke=[["tightest","Tightest","30%"],["tighter","Tighter","50%"],["compact","Compact","70%"],["default","Default","100%"],["comfortable","Comfortable","140%"]];function e3(){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 wke({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 xke({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":_A.length,"--reading-selected":_A.indexOf(e)},children:gke.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(e3,{})]},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":EA.length,"--reading-selected":EA.indexOf(t)},children:yke.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(e3,{})]},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."})]})}function vke(e){return!!e&&ks(e.version)&&ks(e.desktopVersion)&&ha(e.version,e.desktopVersion)<0}function bke({info:e}){return r.jsx(mt,{as:"div",name:"Terminal CLI",note:`The npm CLI on Windows PATH is v${e.version}; the desktop app is v${e.desktopVersion}. Desktop updates do not update the npm CLI.`,control:r.jsx("span",{className:"settings-read",children:"Update needed"}),children:r.jsxs("span",{className:"settings-row-said",children:["Run ",r.jsx("code",{children:"npm install -g ccdeck@latest"}),", then reopen PowerShell and run ",r.jsx("code",{children:"ccdeck tui"}),"."]})})}function kke(){const[e,t]=g.useState(null);return g.useEffect(()=>{var s;let n=!0;return(s=window.ccdeckTerminalCli)==null||s.version().then(a=>{n&&vke(a)&&t(a)}).catch(()=>{}),()=>{n=!1}},[]),e?r.jsx(bke,{info:e}):null}const jke="AGPL-3.0-only",Nke="GNU Affero General Public License, version 3 only.",Ske="https://github.com/BarganConstantin/ccdeck",Cke="What changed in each release, newest first.",_ke="Tell the people who make ccdeck what works and what does not.";function Eke(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 Tke(e,t){return ks(e)&&ks(t)&&ha(e,t)<0}function Ake(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 Rke({version:e,notice:t,readyAppUpdate:n,updateRestarting:s,updateFailure:a,onUpdateRestart:o,doors:i,bundle:l="3.49.0"}){const u=(e==null?void 0:e.running)??l,d=Ake(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:Tke(l,e==null?void 0:e.running)?Eke(l):void 0,control:r.jsx("span",{className:"settings-read",children:u})}),typeof window<"u"&&window.ccdeckTerminalCli&&r.jsx(kke,{}),d&&r.jsx(Mke,{offer:d,restarting:s,failure:a,onRestart:o,onUpdate:i.update}),r.jsx(mt,{as:"div",settingId:"whats-new",name:"What's new",note:Cke,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:Nke,control:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"settings-read",children:jke}),r.jsxs("a",{className:"settings-link",href:Ske,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:sbe,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:_ke,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":"Open the feedback dialog",onClick:i.feedback,children:"Open"})})]})]})}function Mke({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=F8(e.to,t),i=n&&n.version===e.to?B8(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 $ke="Update when idle",Lke="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.",Ike=`${oB} 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.`,Oke="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.",Pke="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 Dke(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 Fke={plain:Lke,"checks-off":Ike,"no-restart":Oke};function Bke({autoRestart:e,onToggleAutoRestart:t,version:n,inApp:s=ao()}){const a=Dke(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:Pke}):r.jsx(mt,{settingId:"auto-update",name:$ke,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:Fke[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 qke({character:e,onCharacter:t}){const n=g.useRef([]);function s(a,o){var l;const i=pS(a,o,Ff.length,"vertical");i.kind==="select"&&(a.preventDefault(),t(Ff[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:Ff.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(bD,{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 Uke="Stands beside the minimap. Press it to play the radio.";function Wke({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:Uke,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(qke,{character:n,onCharacter:s})]})}const t3="settings-search-field",hB="settings-search-results",qj=e=>`settings-result-${e}`;function Hke({inputRef:e,query:t,onQuery:n,results:s,active:a,onActive:o,onOpen:i}){const l=t.trim()!=="",u=l&&s.length>0,d=f=>{if(f.nativeEvent.isComposing)return;const p=kte(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:t3,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:t3,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?hB:void 0,"aria-activedescendant":u?qj(Math.min(a,s.length-1)):void 0,"aria-keyshortcuts":"Control+F Meta+F",value:t,onChange:f=>n(f.target.value),onKeyDown:d})]})}function zke({query:e,results:t,active:n,onOpen:s}){const a=l5(t.length,e);return g.useEffect(()=>{var o,i;(i=(o=document.getElementById(qj(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:hB,role:"listbox","aria-label":"Matching settings",children:t.map((o,i)=>r.jsxs("button",{type:"button",role:"option",id:qj(i),className:"settings-result",tabIndex:-1,"aria-selected":i===n,"aria-label":wte(o),"data-highlighted":i===n,onMouseDown:l=>l.preventDefault(),onClick:()=>s(o),children:[r.jsx(wm,{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:zN(o)})]})]},o.id))})})]})}function Vke({query:e,count:t}){return r.jsx("p",{className:"vis-hidden",role:"status",children:e.trim()?l5(t,e):""})}const Gke=1500,Kke=3e3,Yke=e=>e.checkVisibility?e.checkVisibility():e.getClientRects().length>0;function Xke(e){if(e.matches(rp)&&!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(rp)).filter(s=>LP({disabled:s.disabled,tabIndex:s.tabIndex,rendered:Yke(s)}));return n.find(s=>s.closest(".settings-list")!=null)??n[0]??null}function Zke(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)}"]`),d=w=>{var b,j;a(null);const x=w.offsetHeight>l.clientHeight-48;w.scrollIntoView({block:x?"start":"center"}),(b=Xke(w))==null||b.focus({preventScroll:!0}),window.clearTimeout(o.current),(j=i.current)==null||j.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)},Gke)},f=u();if(f){d(f);return}const p=new MutationObserver(()=>{const w=u();w&&(p.disconnect(),window.clearTimeout(m),d(w))});p.observe(l,{childList:!0,subtree:!0});const m=window.setTimeout(()=>{p.disconnect(),a(null)},Kke);return()=>{p.disconnect(),window.clearTimeout(m)}},[e,s,t,n]),a}function Jke({section:e,landOn:t,onSection:n,onClose:s,providers:a,sound:o,tones:i,customTones:l,notify:u,appearance:d,versionCheck:f,desktopUpdate:p,restart:m,doors:w}){const x=g.useRef(null),b=g.useCallback(ve=>{x.current=ve},[]);function j(ve,pe=!1){x.current?(D(""),x.current(ve,pe),requestAnimationFrame(()=>{var _e,ze;return(ze=(_e=v.current)==null?void 0:_e.scrollIntoView)==null?void 0:ze.call(_e,{block:"nearest",inline:"nearest"})})):ve()}const k=()=>j(s,!0),v=g.useRef(null),S=gt(k,{focusRef:v}),C=wt(()=>j(s)),_=g.useRef([]),R=Id(),A=GS(R),I=fee(A,e,a.claude),$=Math.max(0,I.findIndex(ve=>ve.id===e)),U=lc("(max-width: 640px)"),[F,M]=g.useState(""),[B,T]=g.useState(0),P=g.useRef(null),q=g.useRef(null),K=F.trim()!=="",z=g.useMemo(()=>bte(F,i5(a.claude,A,Od(R))),[F,a.claude,A,R]),H=Zke(q,!K,e),D=ve=>{M(ve),T(0)};g.useEffect(()=>{t&&H(t)},[t,H]);const O=ve=>{j(()=>{D(""),n(ve),requestAnimationFrame(()=>{var pe;return(pe=document.getElementById(`settings-tab-${ve}`))==null?void 0:pe.focus()})})},V=ve=>{j(()=>{D(""),n(ve.section),ym(ve)||H(ve.id)})};g.useEffect(()=>{const ve=pe=>{var at,tt;if(!xee(pe))return;const _e=S.current,ze=pe.target;!_e||!(ze===document.body||ze===document.documentElement||ze&&_e.contains(ze))||(pe.preventDefault(),(at=P.current)==null||at.focus(),(tt=P.current)==null||tt.select())};return window.addEventListener("keydown",ve),()=>window.removeEventListener("keydown",ve)},[S]),g.useEffect(()=>{var ve,pe,_e,ze;pee((ve=document.activeElement)==null?void 0:ve.id,e)&&((pe=v.current)==null||pe.focus()),(ze=(_e=v.current)==null?void 0:_e.scrollIntoView)==null||ze.call(_e,{block:"nearest",inline:"nearest"})},[e]);const{theme:Z,setTheme:W,characterEnabled:X,setCharacterEnabled:Y,character:J,setCharacter:Q}=d,te=An(),le=ve=>{const pe=pS(ve,$,I.length,"vertical");pe.kind!=="pass"&&(ve.preventDefault(),j(()=>{var _e;D(""),n(I[pe.index].id),(_e=_.current[pe.index])==null||_e.focus()}))},de=ve=>{ve.key===" "&&ve.stopPropagation()},{soundOn:oe,toggleSound:re}=o,{tonePrefs:he,previewTone:fe,changeTone:$e}=i,{customSelections:ye,customAssets:ge,clearCustomOnly:je,selectCustomTone:Le,importNotificationAudio:ke,createNotificationVoice:Ie,renameCustomAsset:De,deleteCustomAsset:Ue,previewCustomAsset:Ke}=l,{notifyPermission:we,notifyOn:Fe,notifyVetoed:Re,toggleNotify:Ae,notifySupported:rt,askForNotifications:We,accountNotify:se,toggleAccountNotify:be}=u,Te=(()=>{switch(e){case"radar":return r.jsx(zbe,{onOpen:w.radar});case"claude":return r.jsx(oke,{});case"appearance":return r.jsxs(r.Fragment,{children:[r.jsx(mke,{theme:Z,onTheme:W,singleKeys:te}),r.jsx(Wke,{characterEnabled:X,character:J,onCharacter:Q,onToggleCharacter:()=>Y(ve=>!ve)})]});case"reading":return r.jsx(xke,{textSize:d.textSize,density:d.density,onTextSize:d.setTextSize,onDensity:d.setDensity});case"keyboard":return r.jsx(_be,{singleKeys:te,onToggleSingleKeys:()=>BY(!te)});case"notifications":return r.jsx(Ebe,{notifyOn:Fe,onToggleNotify:Ae,notifyVetoed:Re,notifyPermission:rt?we:"unsupported",onAskNotify:We,accountNotify:se,onToggleAccountNotify:be});case"sounds":return r.jsx(Wbe,{soundOn:oe===!0,onToggleSound:re,prefs:he,claudeHere:a.claude,onLevel:(ve,pe)=>$e(ve,{level:pe}),onFigure:(ve,pe)=>$e(ve,{figure:pe}),onPreview:ve=>fe(ve),customAssets:ge,customSelections:ye,onBuiltInSelected:je,onCustomSelected:Le,onImportCustom:ke,onCreateVoice:Ie,onRenameCustom:De,onPreviewCustom:Ke,onDeleteCustom:Ue});case"integrations":return r.jsx(fke,{onBeforeLeaveChange:b});case"data":return r.jsx(cke,{});case"about":return r.jsx(Rke,{version:f.version,notice:f.notice,readyAppUpdate:p.readyAppUpdate,updateRestarting:p.desktopUpdateRestarting,updateFailure:p.desktopUpdateFailure,onUpdateRestart:ve=>{p.askDesktopUpdateRestart(ve)},doors:w});default:return r.jsxs(r.Fragment,{children:[r.jsx(mbe,{}),r.jsx(GO,{provider:"Codex"}),a.claude&&r.jsx(GO,{provider:"Claude"}),r.jsx(Bke,{autoRestart:m.autoRestart,onToggleAutoRestart:m.toggleAutoRestart,version:f.version}),r.jsx(kbe,{claudeHere:a.claude,singleKeys:te,doors:w})]})}})(),Oe=e==="reading"?r.jsx(wke,{textSize:d.textSize,density:d.density,onTextSize:d.setTextSize,onDensity:d.setDensity}):e==="integrations"&&R.connections!==null?r.jsxs("span",{className:"ig-total",children:[R.connections.length," saved connection",R.connections.length===1?"":"s"]}):null;return r.jsx("div",{className:"modal-backdrop",...C,role:"presentation",children:r.jsxs("div",{ref:S,id:"settings",className:"modal settings-modal",role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",onClick:ve=>ve.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:()=>j(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(Hke,{inputRef:P,query:F,onQuery:D,results:z,active:B,onActive:T,onOpen:V}),r.jsx(Vke,{query:F,count:z.length}),r.jsx("div",{className:"settings-nav",role:"tablist","aria-label":"Settings sections","aria-orientation":U?"horizontal":"vertical",onKeyDown:le,children:I.map((ve,pe)=>r.jsxs("button",{ref:_e=>{_.current[pe]=_e,ve.id===e&&(v.current=_e)},type:"button",role:"tab",id:`settings-tab-${ve.id}`,className:"settings-tab","aria-selected":ve.id===e,"aria-controls":"settings-pane",tabIndex:ve.id===e?0:-1,onClick:()=>O(ve.id),children:[r.jsx(wm,{section:ve.id}),r.jsx("span",{className:"settings-tab-label",children:ve.label})]},ve.id))})]}),r.jsxs("div",{ref:q,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:I[$].label}),r.jsx("p",{className:"settings-pane-note",children:I[$].note})]}),Oe]}),Te]},e),K&&r.jsx(zke,{query:F,results:z,active:B,onOpen:V})]})]})})}function Qke({tool:e,onClose:t}){const n=gt(t),s=wt(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,d=g.useMemo(()=>{const f=pV(e.name,i,l);return{input:f.input.map((p,m)=>r.jsx(n3,{block:p},m)),response:f.response.map((p,m)=>r.jsx(n3,{block:p},m)),copyInput:nT(e.name,"input",i),copyResponse:nT(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:MP(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(s3,{text:d.copyInput,what:"input"})]}),d.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(s3,{text:d.copyResponse,what:"response"})]}),e.endedAt==null?r.jsx("pre",{children:"(waiting…)"}):d.response]})]})]})})}const e0e={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function n3({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(()=>iV(e),[e]),{shown:a}=oP(s,t),o=lV(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?e0e[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.`}]},KS="agent-dag.releaseNotesSeen";function UO(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function ha(e,t){const n=UO(e),s=UO(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 ks(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function Tve(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 Ave(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,s]of Object.entries(e)){if(!ks(n)||!Array.isArray(s))continue;const a=s.filter(Tve).map(l=>({title:l.title,body:l.body,...typeof l.details=="string"&&l.details.trim()?{details:l.details}:{},...l.priority==="highlight"||l.priority==="required"?{priority:l.priority}:{},...typeof l.notice=="string"&&l.notice.trim()?{notice:l.notice}:{},...typeof l.notice=="string"&&l.notice.trim()&&typeof l.noticeLabel=="string"&&l.noticeLabel.trim()&&l.noticeLabel.length<=32?{noticeLabel:l.noticeLabel}:{},...l.icon==="plans"||l.icon==="accounts"||l.icon==="skills"?{icon:l.icon}:{}})),o=e["//summaries"],i=o&&typeof o=="object"&&Object.hasOwn(o,n)?o[n]:void 0;a.length&&t.push({version:n,notes:a,...typeof i=="string"&&i.trim()?{summary:i}:{}})}return t.sort((n,s)=>ha(s.version,n.version))}function Rve(e){const t=e.filter(o=>o.priority==="highlight").slice(0,3),n=t.length>0,s=e.filter(o=>!t.includes(o)&&(!n||o.priority==="required"||o.priority==="highlight"||!!o.notice)),a=e.filter(o=>!t.includes(o)&&!s.includes(o));return{highlights:t,visible:s,more:a}}function Mve(e,t,n){const[s,...a]=e;if(!t)return{latest:ks(n)?e.find(l=>ha(l.version,n)===0):s,visiblePrevious:[],history:[]};const o=[],i=[];for(const l of a){const u=l.notes.some(p=>p.priority==="highlight"||p.priority==="required"||!!p.notice),d=l.notes.filter(p=>!u||p.priority==="required"||!!p.notice);d.length&&o.push({version:l.version,notes:d});const f=l.notes.filter(p=>!d.includes(p));f.length&&i.push({...l,notes:f})}return{latest:s,visiblePrevious:o,history:i}}const WO=Ave(Eve);function sB(e,t,n){return e.filter(s=>ha(s.version,n)<=0&&(t===null||ha(s.version,t)>0))}function $ve(e,t){return e.filter(n=>ha(n.version,t)===0)}function Lve(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}`}const Ive=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function rB(e){const t=Ive.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function Ove(e){if(!e)return null;let t=null;try{t=e.getItem(KS)}catch{return null}return ks(t)?t:null}function Pve(e){if(!e)return!1;try{return e.getItem(KS),!0}catch{return!1}}function Dve(e,t){if(!e)return!1;try{return e.setItem(KS,t),!0}catch{return!1}}const aB="agent-dag.tourSeen";function Fve(e){if(!e)return!1;try{return e.getItem(aB)==="1"}catch{return!1}}function Bve(e){if(!e)return!1;try{return e.setItem(aB,"1"),!0}catch{return!1}}function qve({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 Uve({stored:e,running:t,notes:n,remembers:s=!0}){if(!ks(t))return{show:[],record:null,reason:"no-version"};if(!ks(e)){if(!s)return{show:[],record:t,reason:"cannot-remember"};const i=$ve(n,t);return i.length?{show:i,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const a=ha(e,t);if(a===0)return{show:[],record:null,reason:"seen"};if(a>0)return{show:[],record:null,reason:"ahead"};const o=sB(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function Wve(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const s=e.indexOf("`",n+1);if(s<0)break;n=s+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function qu(e,t=!0){const n=[];let s="";const a=()=>{s&&(n.push({kind:"text",text:s}),s="")};let o=0;for(;o<e.length;){if(e[o]==="`"){const i=e.indexOf("`",o+1);if(i>o+1){a(),n.push({kind:"code",text:e.slice(o+1,i)}),o=i+1;continue}}else if(t&&e.startsWith("**",o)){const i=Wve(e,o);if(i>0){a(),n.push({kind:"bold",kids:qu(e.slice(o+2,i),!1)}),o=i+2;continue}}s+=e[o],o+=1}return a(),n}function ao(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}function Sje(e,t,n){if(e===null)return null;const s=e+t-n;return s>0?s:null}function Cje(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 Hve(e){return(e??[]).filter(t=>t.installed&&t.profiles>0)}function _je(e){return!Number.isFinite(e)||e<=0?"empty":Jn(e)}function Eje(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 zve(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 Tje(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=Hve(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 Vve="Ask npm now whether a newer ccdeck is out.",HO="Checking…",Gve="Couldn't reach npm. Try again.",Kve="Couldn't reach the deck. Try again.",oB="Update checks are off on this deck (AGENTS_DECK_NO_UPDATE_CHECK or AGENTS_DECK_NO_INSTALL).",Yve="The deck looks again in five minutes.";function Xve(e,t,n,s){const a=s?t.npx:n?Kt(t,n):void 0;return a?`${e} is out, but ${a}`:`${e} is out. Run:`}const Dn=(e,t={})=>({said:e,tone:"answer",age:null,command:null,action:null,...t}),Vo=e=>Dn(e,{tone:"note"});function zO(e,t){return zve(e,t)??"just now"}function Zve(e,t){const n=e.update;return(n==null?void 0:n.status)==="ready"?Vo(`${n.version} is ready. Restart to update.`):(n==null?void 0:n.status)==="checking"?Vo("The app is checking for updates…"):(n==null?void 0:n.status)==="downloading"?Vo(n.version?`${n.version} is out. The app is downloading it.`:"The app is downloading an update."):(n==null?void 0:n.status)==="current"?Vo(`You're on the latest, ${e.version??t}. You can check again here.`):(n==null?void 0:n.status)==="error"?Vo("The app's last update check failed. Try Check for updates again."):Vo("The app keeps itself up to date. Check for updates here.")}function Jve(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 Dn(`${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 Dn(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 Dn(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:`:Xve(t,n,s==null?void 0:s.upgradeBlocked,(s==null?void 0:s.upgradeMode)==="npx"),o=(s==null?void 0:s.command)??null;return Dn(a,{command:o,action:o?{kind:"copy",label:e.copied?"Copied":"Copy",busy:!1}:null})}function Qve(e){const t=e.version;if(e.unreachable)return Dn(Kve,{tone:"warn"});const n=t!=null&&t.checkFailedAt&&t.checkFailedAt>(t.checkedAt??0)?t.checkFailedAt:null;if(n)return Dn(Gve,{tone:"warn",age:e.answered?null:`Last tried ${zO(n,e.now)}.`});const s=t!=null&&t.latestPending&&t.latestPending!==e.running?t.latestPending:null;if(s)return Dn(`${s} is tagged on npm but can't be installed yet. ${Yve}`);const a=t!=null&&t.checkedAt?zO(t.checkedAt,e.now):null;if((t==null?void 0:t.checkedAt)&&e.now>=t.checkedAt&&e.now-t.checkedAt<=60*6e4&&(t!=null&&t.latest)&&ks(t.latest)&&ks(e.running)){const i=ha(t.latest,e.running),l=i===0?`You're on the latest, ${e.running}.`:i<0?`You're on ${e.running}, ahead of npm's ${t.latest}.`:`${t.latest} is out.`;return Dn(l,{age:a?`Checked ${a}.`:null})}return Dn(a?"Update status may have changed.":"No update check yet.",{age:a?`Last checked ${a}.`:null})}function ebe(e,t){var a,o;const n=e.version;if((a=e.app)!=null&&a.inApp&&(n!=null&&n.checkDisabled)){const i=Zve(e.app,e.running);return i&&{canCheck:!0,checking:e.checking||((o=e.app.update)==null?void 0:o.status)==="checking",line:e.unreachable?Dn("The desktop updater did not accept the check. Try the ccdeck menu or update the desktop app.",{tone:"warn"}):e.checking?Dn(HO):i}}if(n!=null&&n.checkDisabled)return{canCheck:!1,checking:!1,line:Vo(oB)};const s=(n==null?void 0:n.notice)??null;if((s==null?void 0:s.kind)==="upgrade")return{canCheck:!0,checking:e.checking,line:Jve(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:Dn(i)}}return e.checking?{canCheck:!0,checking:!0,line:Dn(HO)}:{canCheck:!0,checking:!1,line:Qve(e)}}const iB=450;async function tbe(e,t=n=>new Promise(s=>setTimeout(s,n))){const[n]=await Promise.all([e(!0),t(iB)]);return n?"answered":"unreachable"}async function nbe(e=fetch){try{const[t]=await Promise.all([e("/api/desktop-update/check",{method:"POST",signal:AbortSignal.timeout(8e3)}),new Promise(n=>setTimeout(n,iB))]);return t.ok?"answered":"unreachable"}catch{return"unreachable"}}const sbe="Eight pictures of what the deck shows.",VO="Restart the deck. Sessions, settings and pairings come back as they were.";function rbe(e){var A,I,$;const t=(e==null?void 0:e.versionCheck.versionChecking)??!1,n=Sr(3e4),[s,a]=g.useState(!1),o=g.useRef(!1),[i,l]=g.useState(!1),[u,d]=g.useState(!1),f=g.useRef(t);if(g.useEffect(()=>{f.current&&!t&&d(!0),f.current=t},[t]),!e)return null;const{versionCheck:p,upgrade:m,restart:w,desktopUpdate:x,running:b,onHandOff:j}=e,k=ebe({version:p.version,running:b,checking:s||t,answered:u,unreachable:i,now:Math.max(n,Date.now()),upgradeState:m.upgradeState,copied:m.cmdCopied,restarting:w.restarting,app:{inApp:ao(),update:x.appUpdate,version:O8(),menu:D8()}},$j);if(!k)return null;const v=ao()&&((A=p.version)==null?void 0:A.checkDisabled),S=v?"Ask the desktop app whether a newer ccdeck is out.":Vve,C=async()=>{var F;if(!_n(o.current||t)||v&&((F=x.appUpdate)==null?void 0:F.status)==="checking")return;o.current=!0,a(!0);const U=v?await nbe():await tbe(p.loadVersion);o.current=!1,a(!1),l(U==="unreachable"),d(!0)},_=U=>{if(U.kind==="copy")return void m.copyCommand();j(),p.showNotice(),U.kind==="install"?m.startUpgrade():w.askRestart({upgrade:!0})},R=k.line.tone==="warn"||!!k.line.action||!!((I=p.version)!=null&&I.notice)||(($=x.appUpdate)==null?void 0:$.status)==="downloading";return{state:k,check:C,act:_,checkWhy:S,needsAttention:R}}function abe({update:e}){const t=oc("above","dialog"),n=g.useId();return r.jsxs("div",{className:"rn-status-row",children:[e?r.jsx(obe,{line:e.state.line,onAct:e.act,bindHint:t.bind,whyId:`${n}-action`,announce:!1}):r.jsx("p",{className:"rn-update-line",children:r.jsx("span",{role:"status",children:"Update status unavailable."})}),t.node]})}function obe({line:e,onAct:t,bindHint:n,whyId:s,announce:a=!0}){const{action:o}=e,i=o&&r.jsx(ibe,{action:o,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:a?"status":void 0,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}),i]}):i]})}function ibe({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 lbe({entries:e,since:t,running:n,firstRun:s,onClose:a,onTour:o,updateVersion:i,updateBusy:l,onUpdateRestart:u,updateFailure:d,onRestart:f,updateCheck:p}){var B,T;const m=gt(a),w=g.useRef(null),x=wt(a),b=g.useId(),[j,k]=g.useState(null),v=rbe(p),S=((B=v==null?void 0:v.state.line.action)==null?void 0:B.kind)==="install"||((T=v==null?void 0:v.state.line.action)==null?void 0:T.kind)==="npx",C=f&&!i&&!S,{latest:_,visiblePrevious:R,history:A}=Mve(e,t!==null,n),I=`${b}-history`,$=!!C||!!(v!=null&&v.state.canCheck)&&!i;g.useEffect(()=>{var P;!$&&j&&(k(null),document.activeElement===document.body&&((P=w.current)==null||P.focus()))},[$,j]);const U=ks(n)?`v${n}`:Lve(e.slice(0,1)),F=s&&n?`New in v${n}.`:t?`Changes since v${t}.`:null,M=R.some(P=>P.notes.some(q=>!q.priority&&!q.notice));return r.jsx("div",{className:"modal-backdrop",...x,role:"presentation",children:r.jsxs("div",{ref:m,className:"modal release-notes",id:`${b}-dialog`,onClick:P=>P.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"}),U&&r.jsx("span",{className:"modal-tool-id",children:U})]}),r.jsxs("div",{className:"modal-actions",children:[$&&r.jsx("button",{id:`${b}-options`,type:"button",className:"glyph-btn","aria-label":"More options","aria-haspopup":"menu","aria-expanded":j!==null,"aria-controls":j?`${b}-menu`:void 0,onClick:()=>k(j?null:"first"),onKeyDown:P=>{(P.key==="ArrowDown"||P.key==="ArrowUp")&&(P.preventDefault(),k(P.key==="ArrowUp"?"last":"first"))},children:r.jsxs("svg",{className:"glyph",viewBox:"0 0 14 14",width:"14",height:"14",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"3",cy:"7",r:"1"}),r.jsx("circle",{cx:"7",cy:"7",r:"1"}),r.jsx("circle",{cx:"11",cy:"7",r:"1"})]})}),r.jsx("button",{ref:w,type:"button",className:"glyph-btn",onClick:a,"aria-label":"Close (Esc)",title:"Close (Esc)",children:"×"})]})]}),r.jsx("span",{className:"rn-live-status",role:"status",children:i?`ccdeck v${i} is downloaded and verified.`:v==null?void 0:v.state.line.said}),r.jsxs("section",{className:"modal-body",role:"region","aria-label":"Release notes",tabIndex:0,children:[i?r.jsxs("div",{className:"rn-ready",children:[r.jsxs("p",{children:["ccdeck v",i," is downloaded and verified."]}),r.jsx("p",{className:"rn-update-said",role:"status",children:d})]}):r.jsxs(r.Fragment,{children:[(v==null?void 0:v.needsAttention)&&r.jsx(abe,{update:v}),r.jsx("p",{className:"rn-update-said",role:"status",children:d})]}),F&&r.jsx("p",{className:"rn-context",children:F}),!(_!=null&&_.notes.length)&&!R.length&&r.jsx("p",{className:"rn-empty",children:"No release notes for this build."}),_&&r.jsx(e1,{entry:_,showVersion:t!==null&&e.length>1},_.version),R.length>0&&r.jsxs("section",{className:"rn-upgrade-history","aria-label":"Earlier changes in this upgrade",children:[r.jsx("h2",{className:"rn-group-title",children:"Earlier in this upgrade"}),M&&r.jsx("p",{className:"rn-context",children:"Older notes are shown in full so setup and other important changes stay visible."}),R.map(P=>r.jsx(e1,{entry:P,showVersion:!0},P.version))]}),A.length>0&&r.jsxs("details",{className:"rn-history",children:[r.jsxs("summary",{"aria-controls":I,children:["Other changes since v",t]}),r.jsx("div",{id:I,children:A.map(P=>r.jsx(e1,{entry:P,showVersion:!0},P.version))})]})]}),r.jsxs("footer",{className:"rn-footer",children:[r.jsxs("div",{className:"rn-footer-links",children:[r.jsxs("a",{href:"https://ccdeck.dev/changelog/",target:"_blank",rel:"noopener noreferrer","aria-label":"Release history (opens in a new tab)",children:["Release history ",r.jsx(Zl,{})]}),o&&!i&&r.jsx("button",{className:"rn-text-button",type:"button",onClick:o,children:"Take the tour"})]}),i&&u?r.jsx("button",{className:"btn primary",type:"button",onClick:u,"aria-busy":l||void 0,children:l?"Restarting…":Jl}):r.jsx("button",{className:"btn primary",type:"button",onClick:a,children:"Done"})]}),j&&$&&r.jsxs(ac,{anchorId:`${b}-options`,portalRootId:`${b}-dialog`,id:`${b}-menu`,role:"menu",labelledBy:`${b}-options`,start:j,className:"ap-pop rn-options-menu",onClose:()=>k(null),children:[v&&r.jsxs("p",{className:"rn-menu-status",id:`${b}-check-status`,children:[v.state.line.said,v.state.line.age&&r.jsx("span",{children:v.state.line.age})]}),(v==null?void 0:v.state.canCheck)&&r.jsxs("button",{type:"button",className:"ap-menu-item rn-act",role:"menuitem",title:v.checkWhy,"aria-describedby":`${b}-check-status`,"aria-busy":v.state.checking||void 0,onClick:()=>void v.check(),children:[r.jsx(_Q,{}),"Check for updates"]}),(v==null?void 0:v.state.canCheck)&&C&&r.jsx("div",{className:"rn-menu-separator",role:"separator"}),C&&r.jsxs("button",{type:"button",className:"ap-menu-item",role:"menuitem",title:VO,"aria-describedby":`${b}-restart-why`,onClick:()=>{k(null),f==null||f()},children:[r.jsx(EQ,{}),"Restart ccdeck"]}),r.jsx("span",{hidden:!0,id:`${b}-restart-why`,children:VO})]})]})})}function e1({entry:e,showVersion:t}){const{highlights:n,visible:s,more:a}=Rve(e.notes),o=n.filter(l=>l.details),i=g.useId();return r.jsxs("section",{className:"rn-release",children:[t&&r.jsxs("h2",{className:"rn-version",children:["v",e.version]}),e.summary&&r.jsx("h2",{className:"rn-summary",children:e.summary}),r.jsxs("ul",{className:"rn-notes",children:[n.map((l,u)=>r.jsx(t1,{note:l,highlight:!0},`h${u}`)),s.map((l,u)=>r.jsx(t1,{note:l},`v${u}`))]}),(a.length>0||o.length>0)&&r.jsxs("details",{className:"rn-more",children:[r.jsxs("summary",{"aria-controls":i,children:[r.jsxs("span",{className:"rn-more-start",children:[r.jsx("span",{className:"rn-chevron","aria-hidden":"true",children:"›"}),r.jsx("span",{className:"rn-more-label",children:a.length?`${a.length} more ${a.length===1?"improvement":"improvements"}`:"More details"})]}),r.jsxs("span",{className:"rn-more-hint",children:[r.jsx("span",{className:"rn-show-details",children:"Show details"}),r.jsx("span",{className:"rn-hide-details",children:"Hide details"})]})]}),r.jsxs("div",{id:i,children:[r.jsx("ul",{className:"rn-notes",children:a.map((l,u)=>r.jsx(t1,{note:l},u))}),o.length>0&&r.jsxs("div",{className:"rn-highlight-details",role:"group","aria-labelledby":`${i}-highlights`,children:[r.jsx("h3",{id:`${i}-highlights`,className:"rn-details-title",children:"More about the highlights"}),o.map((l,u)=>r.jsxs("p",{className:"rn-note-body",children:[r.jsxs("strong",{className:"rn-strong",children:[rB(l.title).rest.trimStart(),": "]}),Uu(qu(l.details))]},u))]})]})]})]})}const cbe={plans:FD,accounts:BD,skills:qD};function t1({note:e,highlight:t}){const{icon:n,rest:s}=rB(e.title),a=!n&&e.icon?Kt(cbe,e.icon):void 0;return r.jsxs("li",{className:"rn-note","data-highlight":t||void 0,"data-required":e.priority==="required"||void 0,"data-has-icon":!!a||void 0,children:[a&&r.jsx("span",{className:"rn-title-icon","aria-hidden":"true",children:r.jsx(a,{})}),r.jsxs("div",{children:[r.jsxs("h3",{className:"rn-note-title",children:[n&&r.jsx("span",{className:"rn-note-icon",children:n}),n?s:s.trimStart()]}),r.jsx("p",{className:"rn-note-body",children:Uu(qu(e.body))}),!t&&e.details&&r.jsx("p",{className:"rn-note-body rn-extra-detail",children:Uu(qu(e.details))}),e.notice&&r.jsxs("p",{className:"rn-note-notice",children:[r.jsxs("strong",{children:[e.noticeLabel??"Important",": "]}),Uu(qu(e.notice))]})]})]})}function Uu(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?r.jsx("code",{className:"rn-code",children:t.text},n):r.jsx("strong",{className:"rn-strong",children:Uu(t.kids)},n))}function ube({state:e,sessionId:t,onClose:n}){const s=g.useMemo(()=>dbe(e,t),[e,e.revision,t]),a=g.useRef(null),o=gt(n,{focusRef:a}),i=wt(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:$D}),r.jsx("div",{className:"ss-cost",children:lt(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":Qp(l),title:l,children:Qa(l)},l))})]}),r.jsx("div",{className:"ss-hero-right",children:s.cost.total>0&&r.jsxs(r.Fragment,{children:[r.jsx(ZN,{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:lt(s.cost.input)})]}),r.jsxs("span",{className:"ssl ssl-out",children:["output ",r.jsx("b",{children:lt(s.cost.output)})]}),r.jsxs("span",{className:"ssl ssl-cr",children:["cache r ",r.jsx("b",{children:lt(s.cost.cacheRead)})]}),r.jsxs("span",{className:"ssl ssl-cw",children:["cache w ",r.jsx("b",{children:lt(s.cost.cacheWrite)})]})]})]})})]}),r.jsxs("section",{className:"ss-stats",children:[r.jsx(pl,{label:"agents",value:s.agentCount}),r.jsx(pl,{label:"subagents",value:s.subagentCount}),r.jsx(pl,{label:"tool calls",value:s.toolCount}),r.jsx(pl,{label:"prompts",value:s.promptCount}),r.jsx(pl,{label:"tokens",value:s.tokensSum.toLocaleString()}),s.errCount>0&&r.jsx(pl,{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 pl({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 dbe(e,t){const n=e.agents.get(t);if(!n)return null;const s=[];for(const S of e.agents.values())S.sessionId===t&&s.push(S);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,d=0,f=0,p=0,m,w=1/0,x=0;for(const S of s){const C=Wn(S);a.input+=C.input,a.output+=C.output,a.cacheRead+=C.cacheRead,a.cacheWrite+=C.cacheWrite,a.total+=C.total;for(const R of SP(S))o.add(R);S.model&&o.add(S.model),S.kind==="subagent"&&p++;const _=aP(S.prompts);u+=_.length,!m&&_.length>0&&(m=_[0].text),d+=S.usage.inputTokens+S.usage.outputTokens,l+=S.toolCount,f+=S.toolErrorCount??0;for(const[R,A]of S.toolCountByName??[])i.set(R,(i.get(R)??0)+A);w=Math.min(w,S.startedAt),x=Math.max(x,S.endedAt??Date.now())}const b=Math.max(0,x-w),j=Math.floor(b/1e3),k=j<60?`${j}s`:j<3600?`${Math.floor(j/60)}m ${String(j%60).padStart(2,"0")}s`:`${Math.floor(j/3600)}h ${Math.floor(j%3600/60)}m`,v=Array.from(i.entries()).sort((S,C)=>C[1]-S[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||"session",cwd:n.cwd,durationLabel:k,cost:a,modelChips:Array.from(o),agentCount:s.length,subagentCount:p,toolCount:l,promptCount:u,tokensSum:d,errCount:f,topTools:v,firstPrompt:m}}function Bt({id:e,title:t,note:n,noteId:s,aside:a,list:o=!0,settingId:i,className:l,children:u}){const d=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:d,"data-setting":i,children:f}):r.jsxs("section",{className:d,"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:d}){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}),d]});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 lB(e,t){const[n,s]=g.useState(null),[a,o]=g.useState(!1),[i,l]=g.useState(""),u=g.useRef(!1),d=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(d((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||!_n(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(d(m.prefs[e]))}catch{l("Could not save this setting. Try again.")}finally{u.current=!1,o(!1)}}}}}function GO({provider:e}){const t=e==="Codex"?"recoverCodexSessions":"recoverClaudeSessions",n=`${e.toLowerCase()}-session-recovery`,s=lB(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,...qn(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(hbe,{})]})}function hbe(){const e=lB("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,...qn(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 fbe="Hide finished sessions after",pbe="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 mbe(){const e=y8();return r.jsx(Bt,{id:"settings-board-caption",title:"Board",children:r.jsx(mt,{settingId:"hide-finished",name:fbe,nameId:"settings-hide-finished-label",note:"Hidden sessions stay available in the session list.",details:pbe,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:f8.map(t=>r.jsx("option",{value:t,children:ige(t)},t))})})})}const gbe="Accounts and auto-switch",ybe="Your Claude accounts, and Auto-switch, which moves Claude Code to another one before the account in use runs out.",wbe="Local network",xbe="Pairing with the decks on your other machines, so a login that expires on one is repaired from another.",vbe="Browser Watch",bbe="Whether something drove your browser while you were away, and what the deck does about it.";function kbe({claudeHere:e,singleKeys:t,doors:n}){return r.jsxs(Bt,{id:"settings-elsewhere-caption",title:"Elsewhere on the deck",children:[e&&r.jsx(n1,{settingId:"accounts",name:gbe,note:ybe,onOpen:n.accounts,cap:t?{key:"A",title:"Press A anywhere to show or hide the accounts panel"}:null}),e&&r.jsx(n1,{settingId:"local-network",name:wbe,note:xbe,onOpen:n.localNetwork,cap:null}),r.jsx(n1,{settingId:"browser-watch",name:vbe,note:bbe,onOpen:n.browserWatch,dialog:!0,cap:t?{key:"B",title:"Press B anywhere to open or close Browser Watch"}:null})]})}function n1({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 jbe="Single-key shortcuts",Nbe="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 Sbe(e){const t=e.binds.includes("?")?"the keyboard shortcuts sheet":e.action;return t.charAt(0).toUpperCase()+t.slice(1)}function Cbe(e,t){const n=t.trim().toLowerCase();return n?[e.action,e.cap,e.macCap??""].some(s=>s.toLowerCase().includes(n)):!0}function _be({singleKeys:e,onToggleSingleKeys:t}){const n=co(to()),[s,a]=g.useState(""),o=g.useId(),i=Id(),l=eB(e,u=>na(i,u)).map(u=>({...u,rows:u.rows.filter(d=>Cbe(d,s))})).filter(u=>u.rows.length>0);return r.jsxs(r.Fragment,{children:[r.jsx(Bt,{children:r.jsx(mt,{settingId:"single-keys",name:jbe,nameId:"settings-single-keys-label",note:Nbe,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=>{rm(u.key)&&s&&(u.stopPropagation(),a(""))}})]}),l.map(u=>{const d=`settings-keys-${u.title.toLowerCase().replace(/[^a-z]+/g,"-")}`;return r.jsx(Bt,{id:d,title:u.title,className:"settings-keys",children:u.rows.map(f=>r.jsx(mt,{as:"div",name:Sbe(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:Q8})]})}function Ebe({notifyOn:e,onToggleNotify:t,notifyVetoed:n,notifyPermission:s,onAskNotify:a,accountNotify:o,onToggleAccountNotify:i}){const l=Tee(s),u=ao(),d=e&&!n&&!u,f=g.useRef(null),p=ea(!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?Cee:See(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"})})}),d&&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?Eee:_ee,children:XD.map(({kind:m,label:w,title:x})=>r.jsx(mt,{settingId:m,name:w,nameId:`sm-${m}-label`,note:x,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 Tbe=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function Abe(e){return Tbe.find(t=>e(t))}const Rbe=4400;function Mbe(e){const t=e.split(";")[0];return{name:`Recorded voice.${t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm"}`,type:t}}function $be({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),d=()=>{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=Abe(j=>MediaRecorder.isTypeSupported(j)),x=new MediaRecorder(p,w?{mimeType:w}:void 0),b=[];i.current=x,x.ondataavailable=j=>{j.data.size&&b.push(j.data)},x.onerror=()=>t("Recording failed. Please try again."),x.onstop=()=>{p.getTracks().forEach(S=>S.stop()),l.current!==null&&clearTimeout(l.current),l.current=null;const j=i.current===x;if(j&&(i.current=null),o(!1),!j||!b.length)return;const k=Mbe(x.mimeType),v=new File(b,k.name,{type:k.type});n(()=>s(v))},x.start(200),o(!0),l.current=setTimeout(d,Rbe)}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:d}}function Lbe({full:e,fullProps:t,runCustom:n,onCreateVoice:s}){const[a,o]=g.useState("Custom voice"),[i,l]=g.useState("Your turn"),[u,d]=g.useState(""),[f,p]=g.useState("1"),[m,w]=g.useState("1"),[x,b]=g.useState([]);return g.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const j=()=>{b(window.speechSynthesis.getVoices())};return j(),window.speechSynthesis.addEventListener("voiceschanged",j),()=>window.speechSynthesis.removeEventListener("voiceschanged",j)},[]),r.jsxs("details",{className:"sm-voice",children:[r.jsxs("summary",{className:"settings-row",...t,onClick:j=>{const k=j.currentTarget.parentElement;e&&k&&!k.open&&j.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:j=>o(j.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Text"}),r.jsx("input",{className:"ap-manage-input",value:i,maxLength:180,onChange:j=>l(j.target.value)})]}),r.jsxs("label",{children:[r.jsx("span",{children:"Voice"}),r.jsxs("select",{className:"sm-select",value:u,onChange:j=>d(j.target.value),children:[r.jsx("option",{value:"",children:"System default"}),x.map(j=>r.jsx("option",{value:j.voiceURI,children:j.name},j.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:j=>p(j.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:j=>w(j.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 Ibe({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:s,onPreviewCustom:a,onDeleteCustom:o}){const[i,l]=g.useState(""),u=e.length,d=G1(u),f=d!==null,p=f?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[m,w]=g.useState(null),x=g.useRef(0),b=g.useRef(new Map),j=g.useRef(null),k=g.useRef(null);g.useEffect(()=>{if(!m)return;const A=window.setTimeout(()=>w(null),4e3);return()=>window.clearTimeout(A)},[m]);const v=async A=>{l("");try{await A()}catch(I){l(I instanceof Error?I.message:"Custom audio could not be saved.")}},S=(A,I)=>{const $=Date.now(),U=fi({armedFor:m,target:A,armedAt:x.current,now:$,gapMs:hi});if(U==="arm"){w(A),x.current=$;return}if(U==="ignore")return;w(null);const F=Pee(e.map(M=>M.id),A);v(async()=>{var B;await o(A);const M=document.activeElement;M!==I&&!Hn((M==null?void 0:M.tagName)??null)||(B=F?b.current.get(F):j.current)==null||B.focus()})},{recording:C,startRecording:_,stopRecording:R}=$be({full:f,setCustomError:l,runCustom:v,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 ",V1]}),className:"sm-custom",settingId:"custom-sounds",children:[f&&r.jsx("p",{className:"settings-row settings-row-status",id:"sm-custom-full",children:d}),r.jsx(mt,{as:"div",settingId:"custom-import",name:"Import audio",note:"WAV, MP3 or OGG",control:r.jsx("button",{ref:j,type:"button",className:"btn sm-custom-action",...p,onClick:()=>{var A;f||(A=k.current)==null||A.click()},children:"Choose file"}),children:r.jsx("input",{ref:k,type:"file",hidden:!0,accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",onChange:A=>{var $;const I=($=A.target.files)==null?void 0:$[0];A.currentTarget.value="",I&&!f&&v(()=>t(I))}})}),r.jsx(mt,{as:"div",settingId:"custom-record",name:"Record a clip",note:C?"Recording…":"Up to 5 seconds",control:C?r.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:R,children:"Stop & save"}):r.jsx("button",{type:"button",className:"btn sm-custom-action",...p,onClick:()=>void _(),children:"Record"})}),r.jsx(Lbe,{full:f,fullProps:p,runCustom:v,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:I=>{if(!I.target.value.trim()){I.target.value=A.name;return}v(()=>s(A.id,I.target.value))},onKeyDown:I=>{I.key==="Enter"&&I.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:I=>{I?b.current.set(A.id,I):b.current.delete(A.id)},className:`btn sm-custom-icon${m===A.id?" armed":""}`,onKeyDown:I=>{I.repeat&&I.preventDefault()},onClick:I=>S(A.id,I.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 Obe="A tone when a turn finishes, and when Claude asks for something.";function Pbe({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:Obe,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 Oj="custom:";function KO(e){return`${Oj}${e}`}function Dbe(e){return e.startsWith(Oj)?e.slice(Oj.length):null}function Fbe({id:e,label:t="Volume",value:n,step:s=UN,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:Bf,max:yp,step:s,value:n,"aria-describedby":o,onChange:i=>a(Number(i.target.value)),style:{"--sm-level":`${(n-Bf)/(yp-Bf)*100}%`}}),r.jsxs("span",{className:"sm-read",children:[n,"%"]})]})}const YO={done:"Turn finished","needs-input":"Claude is asking"},Bbe={done:"Plays when Claude or Codex finishes a turn.","needs-input":"Available in Claude Code only."};function qbe({chime:e,tone:t,soundOn:n,customAssets:s,customSelections:a,onLevel:o,onFigure:i,onPreview:l,onBuiltInSelected:u,onCustomSelected:d}){const f=`sm-level-${e}`,p=`sm-figure-${e}`,m=a[e];return r.jsxs(Bt,{id:`sm-name-${e}`,title:YO[e],note:Bbe[e],settingId:`tone-${e}`,aside:r.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>l(e),"aria-label":`Hear the ${YO[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(Fbe,{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?KO(m):t.figure,onChange:w=>{const x=w.target.value,b=Dbe(x);b!==null?d(e,b):(u(e),i(e,x))},children:[qN[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:KO(w.id),children:w.name},w.id))})]})]})]})}const Ube="Claude Code isn't on this machine, so only Turn finished plays here — for Codex turns.";function Wbe({soundOn:e,onToggleSound:t,prefs:n,claudeHere:s,onLevel:a,onFigure:o,onPreview:i,customAssets:l,customSelections:u,onBuiltInSelected:d,onCustomSelected:f,onImportCustom:p,onCreateVoice:m,onRenameCustom:w,onPreviewCustom:x,onDeleteCustom:b}){var S;const j=Iee(u),k=((S=l.find(C=>C.id===j))==null?void 0:S.name)??"the same custom sound",v=j?`Both tones use “${k}”. They may be harder to tell apart.`:"";return r.jsxs("div",{className:"sm-sounds",children:[r.jsx(Pbe,{soundOn:e,onToggleSound:t}),!s&&r.jsx("p",{className:"sm-note",children:Ube}),!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:Lu.map(C=>r.jsx(qbe,{chime:C,tone:n[C],soundOn:e,customAssets:l,customSelections:u,onLevel:a,onFigure:o,onPreview:i,onBuiltInSelected:d,onCustomSelected:f},C))}),v&&r.jsx("p",{className:"sm-note","aria-hidden":!0,children:v}),r.jsx("p",{className:"vis-hidden",role:"status",children:v}),r.jsx(Ibe,{customAssets:l,onImportCustom:p,onCreateVoice:m,onRenameCustom:w,onPreviewCustom:x,onDeleteCustom:b})]})}const Hbe="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 zbe({onOpen:e}){return r.jsx(Bt,{children:r.jsx(mt,{as:"div",settingId:"radar-open",name:"Radar",nameId:"settings-radar-open-name",note:Hbe,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 Vbe=6500,Gbe=1e4;let oi={reading:null,saving:null,error:"",undone:null};const zf=new Set;let gu=null,yu=null,oa=null,s1=!1,Vf=0;const Ko=e=>{oi={...oi,...e},zf.forEach(t=>t(oi))};function cB(e){const t=e;return!!t&&t.ok===!0&&Array.isArray(t.settings)&&typeof t.present=="object"}async function uB(e){const t=await fetch("/api/claude-settings",{signal:e}),n=await t.json();if(!t.ok||!cB(n))throw new Error;return n}async function Pj(){if(s1||oi.saving)return;s1=!0;const e=Vf,t=new AbortController;oa=t;let n=!1;const s=setTimeout(()=>{n=!0,t.abort()},5e3);try{const a=await uB(t.signal);e===Vf&&!t.signal.aborted&&Ko({reading:a,error:""})}catch{e===Vf&&(n||!t.signal.aborted)&&Ko({error:"Could not read Claude Code settings. Try again."})}finally{clearTimeout(s),s1=!1,oa===t&&(oa=null)}}function XO(e,t){var n;return(n=e==null?void 0:e.settings.find(s=>s.id===t))==null?void 0:n.value}async function ZO(e,t){if(oi.saving)return;Vf++,oa==null||oa.abort(),yu&&(clearTimeout(yu),yu=null),Ko({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||!cB(o))throw new Error(typeof(o==null?void 0:o.error)=="string"?o.error:"Could not save the change. Try again.");Ko({reading:o});const i=XO(o,e);yu=setTimeout(()=>{yu=null;const l=new AbortController,u=setTimeout(()=>l.abort(),5e3);uB(l.signal).then(d=>{Ko({reading:d,undone:XO(d,e)===i?null:{id:e}})}).catch(()=>{}).finally(()=>clearTimeout(u))},Vbe)}catch(a){Ko({error:a instanceof Error&&a.message?a.message:"Could not save the change. Try again."})}finally{clearTimeout(s),Ko({saving:null})}}function Kbe(){const[e,t]=g.useState(oi);return g.useEffect(()=>(zf.add(t),t(oi),gu||(Pj(),gu=setInterval(()=>void Pj(),Gbe)),()=>{zf.delete(t),zf.size||(gu&&clearInterval(gu),gu=null,oa==null||oa.abort())}),[]),e}const r1=40,Ybe={boolean:"on or off",choice:"a choice",number:"a number",text:"text",structured:"a list or object"};function Xbe(e){const t=e.scope==="Global config"?"kept in ~/.claude.json":e.scope==="Managed"?"managed settings only":null;return[e.topic,Ybe[e.kind],t,e.since?`Claude Code ${e.since}+`:null].filter(Boolean).join(" · ")}function Zbe(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 dB=null;const Jbe=()=>dB??(dB=gi(()=>import("./claude-settings-index-1Qg1AUda.js"),[]).then(e=>e.default.keys));function Qbe({present:e,noFile:t=!1}){const[n,s]=g.useState(null),[a,o]=g.useState(""),i=g.useId();g.useEffect(()=>{let f=!0;return Jbe().then(p=>{f&&s(p)},()=>{dB=null}),()=>{f=!1}},[]);const l=g.useMemo(()=>{if(!n)return[];if(a.trim())return Zbe(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,r1),d=a.trim()!=="";return r.jsxs(Bt,{id:"claude-group-all",settingId:"claude-all-settings",title:"All Claude Code settings",note:d?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=>{rm(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:Xbe(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:`${vee}#${f.anchor}`,target:"_blank",rel:"noreferrer","aria-label":`${f.key} in Claude Code's settings reference`,children:"Reference"})]})},f.key)})}),d&&l.length===0&&n&&r.jsxs("p",{className:"settings-empty",role:"status",children:["No setting matches “",a.trim(),"”."]}),l.length>r1&&r.jsxs("p",{className:"settings-foot",role:"status",children:[l.length-r1," more. Type more of the name to narrow the list."]}),!d&&e&&!t&&n&&l.length===0&&r.jsx("p",{className:"settings-empty",children:"Your settings.json sets nothing yet."})]})}const eke="Changed back after saving, most likely by a running Claude Code session. Set it again to keep it.",tke="There is no settings.json yet, so Claude Code uses its defaults. The first change here creates it.";function nke(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 ske(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 JO="\0custom";function rke({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 d=e.kind==="days"?e.options.map(m=>({value:String(m),label:yA(m)})):e.options,f=t?t.custom?JO:t.value===null?"":String(t.value):"",p=e.kind==="days"&&t&&!t.custom&&!d.some(m=>m.value===f)?[...d,{value:f,label:yA(Number(f))}].sort((m,w)=>Number(m.value)-Number(w.value)):d;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;ZO(e.id,e.kind==="days"?Number(w):w===""?null:w)},children:[(t==null?void 0:t.custom)&&r.jsx("option",{value:JO,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&&ZO(e.id,!u)},children:r.jsx("span",{className:"switch-knob"})})}function ake(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 oke(){return r.jsx(ike,{state:Kbe()})}function ike({state:e}){const{reading:t,saving:n,error:s,undone:a}=e,o=ake(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:tke}),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 Pj(),children:"Retry"})})]})]}),l&&GD.map(u=>r.jsx(Bt,{id:`claude-group-${u.id}`,title:u.title,children:KD.filter(d=>d.group===u.id).map(d=>{const f=t==null?void 0:t.settings.find(x=>x.id===d.id),p=`claude-${d.id}-label`,m=`claude-${d.id}-note`,w=f&&!f.editable&&!o?f.reason:(a==null?void 0:a.id)===d.id?eke:f!=null&&f.override?ske(f.override):"";return r.jsx(mt,{settingId:`claude-${d.id}`,name:d.label,nameId:p,note:d.note,noteId:m,control:r.jsx(rke,{entry:d,row:f,saving:n,nameId:p,noteId:m}),children:r.jsx("span",{className:"settings-row-said settings-row-said-quiet",role:"status",children:w})},d.id)})},u.id)),l&&r.jsx("p",{className:"settings-foot",children:nke(t==null?void 0:t.fileShown)}),r.jsx(Qbe,{present:(t==null?void 0:t.present)??null,noFile:i})]})}const lke="Local statistics for Claude and Codex on this device. Commands are grouped by operation; raw arguments and outputs are not saved.";function cke(){const[e,t]=g.useState(null),[n,s]=g.useState(""),[a,o]=g.useState(!1),[i,l]=g.useState(null),[u,d]=g.useState(""),f=g.useRef(!1),p=g.useRef(!0),m=async()=>{if(f.current)return;f.current=!0,o(!0),s("");const b=new AbortController,j=window.setTimeout(()=>b.abort(),12e3);try{const k=await fetch("/api/tool-audit/storage",{signal:b.signal}),v=await k.json();if(!k.ok||!v.ok)throw new Error;p.current&&t(v)}catch{p.current&&s("Could not read tool history storage. Try again.")}finally{window.clearTimeout(j),f.current=!1,p.current&&o(!1)}};g.useEffect(()=>(p.current=!0,m(),()=>{p.current=!1}),[]);const w=async(b,j)=>{if(f.current)return;f.current=!0,o(!0),s(""),d("");let k=!1;const v=new AbortController,S=window.setTimeout(()=>v.abort(),15e3);try{const C=await fetch("/api/tool-audit/storage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b==="clear"?{action:b,confirm:!0}:{action:b,days:j}),signal:v.signal}),_=await C.json();if(!C.ok||!_.ok)throw new Error;k=!0,p.current&&(l(null),d(b==="clear"?"Tool history cleared. New calls will continue to be recorded.":`Retention changed to ${j} days.`))}catch{p.current&&s("Could not update tool history. Check storage permissions and try again.")}finally{window.clearTimeout(S),f.current=!1,p.current&&(o(!1),k&&m())}},x=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:lke,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:b=>{if(f.current)return;const j=Number(b.target.value);j<e.retentionDays?l(j):w("retention",j)},children:[30,60,90].map(b=>r.jsxs("option",{value:b,children:[b," days"]},b))})}),typeof i=="number"&&x,r.jsx(mt,{as:"div",settingId:"tool-history-size",name:"Space used",note:`Collected since ${Ate(e.startedAt)}`,control:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"settings-read",children:Tte(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"&&x,!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 Dj="agent-dag.integrations.active",YS=(e,t)=>`agent-dag.integrations.prefs.${e}:${t}`,uke=32e3;function QO(e,t){const n=nt(YS(e,t));if(!n)return{};try{const s=JSON.parse(n);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function Aje(e,t){return{read(n,s){const a=QO(e,t)[n];return s(a)?a:void 0},write(n,s){const a=QO(e,t);s===void 0?delete a[n]:a[n]=s;const o=JSON.stringify(a);o.length<=uke&&st(YS(e,t),o)}}}function dke(e,t){vs(YS(e,t))}function Rje(e){const t=nt(Dj);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 Mje(e,t){let n={};try{const s=nt(Dj),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(Dj,JSON.stringify(n))}function Fj(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 Bj(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 hke({connection:e,provider:t,available:n,busy:s,armed:a,note:o,headingRef:i,onTest:l,onEdit:u,onDisconnect:d,onCancelDisconnect:f}){var C;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",x=e.account.name&&e.account.login!==e.account.name?e.account.login:"",b=Fj(e),j=Bj(e),k=Array.isArray((C=e.meta)==null?void 0:C.warnings)?e.meta.warnings.filter(_=>typeof _=="string"):[],v=s===`test:${e.id}`,S=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,x?` (${x})`:""]})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Last verified"}),r.jsx("dd",{children:b??"No verification time available"})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Credentials"}),r.jsx("dd",{children:e.tokenSaved?"Stored locally":"No token saved"})]}),j&&r.jsxs("div",{children:[r.jsx("dt",{children:"Server"}),r.jsx("dd",{children:j})]})]}),!n&&r.jsxs("p",{className:"ig-stranded",children:[m," is not available on this deck. Disconnect deletes this connection and its saved token."]}),k.length>0&&r.jsx("ul",{className:"ig-warnings",children:k.map(_=>r.jsx("li",{children:_},_))}),n&&r.jsxs("div",{className:"ig-manage-actions",children:[r.jsx("button",{type:"button",className:"btn","aria-busy":v,"aria-disabled":s!==null||void 0,onClick:l,children:v?"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":S,"aria-disabled":s!==null||void 0,onKeyDown:_=>{_.repeat&&_.preventDefault()},"aria-label":a?`Confirm disconnecting ${e.name}`:`Disconnect ${e.name}`,onClick:_=>d(_.currentTarget),children:S?"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 fke({onBeforeLeaveChange:e}={}){var We;const t=Id(),{connections:n,error:s}=t,[a,o]=g.useState(null),i=g.useRef(null),l=g.useRef(new Map),u=g.useRef(null),d=g.useRef(0),[f,p]=g.useState(null),[m,w]=g.useState(""),x=g.useRef(null),b=g.useRef(null),[j,k]=g.useState(null),[v,S]=g.useState(null),C=g.useRef(null),[_,R]=g.useState(null),[A,I]=g.useState([]),[$,U]=g.useState(null),F=g.useRef(0),[M,B]=g.useState(null),T=g.useRef(null),P=g.useRef(new Map),q=g.useRef(null),K=g.useRef(0),[z,H]=g.useState(!1),[D,O]=g.useState(null),V=g.useRef(null),Z=g.useRef(new Map),W=g.useRef(new Map);g.useEffect(()=>{const se=Xye();se&&(q.current=Z.current.get(se)??null,p(se),B(se),k({mode:"edit",id:se}));const be=Yye();be&&k({mode:"add",kind:be})},[]),g.useEffect(()=>{var se,be;!M||!n||(be=(se=W.current.get(M))==null?void 0:se.scrollIntoView)==null||be.call(se,{block:"nearest"})},[M,n]),g.useEffect(()=>{if(!$)return;const se=()=>{var Oe,ve;((Oe=document.activeElement)==null?void 0:Oe.getAttribute("aria-label"))==="Cancel disconnect"&&((ve=document.querySelector(".ig-manage-view [data-integration-disconnect]"))==null||ve.focus()),U(null)},be=()=>{document.hidden&&se()},Te=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",be),()=>{window.clearTimeout(Te),window.removeEventListener("blur",se),document.removeEventListener("visibilitychange",be)}},[$]);const X=(se,be,Te,Oe)=>I(ve=>[...ve.filter(pe=>pe.id!==se),{id:se,tone:be,text:Te,scope:Oe}]),Y=se=>I(be=>be.filter(Te=>Te.id!==se)),J=async(se,be)=>{if(!C.current){C.current=se,S(se);try{await be()}finally{C.current=null,S(null)}}},Q=se=>(be,Te)=>void J("form",async()=>{R(null);try{const Oe=await Hye(se,be,Te||void 0);k(null),O(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}.`),B(Oe.id),T.current=()=>{var pe;const ve=l.current.get(Oe.kind)??Z.current.get(Oe.id);return(pe=ve==null?void 0:ve.scrollIntoView)==null||pe.call(ve,{block:"nearest"}),ve}}catch(Oe){R(Oe instanceof wr?Oe:new wr("upstream","The connection could not be saved."))}}),te=se=>(be,Te)=>void J("form",async()=>{R(null);try{const{connection:Oe,validated:ve}=await zye(se.id,{name:Te,input:be});k(null),O(null),H(!1),T.current=()=>b.current??(f?x.current:Z.current.get(Oe.id)),X(Oe.id,"ok",ve?`Saved. Connection test passed as ${Oe.account.name||Oe.account.login}.`:"Saved.")}catch(Oe){R(Oe instanceof wr?Oe:new wr("upstream","The change could not be saved."))}}),le=se=>void J(`test:${se.id}`,async()=>{U(null),Y(se.id);try{const be=await Vye(se.id);X(se.id,"ok",`Connection test passed. Signed in as ${be.account.name||be.account.login}.`)}catch(be){X(se.id,"err",be instanceof Error?be.message:"The test failed.")}}),de=(se,be)=>{if(C.current)return;const Te=Date.now(),Oe=fi({armedFor:$,target:se.id,armedAt:F.current,now:Te,gapMs:hi});if(Oe==="arm"){be.focus({preventScroll:!0}),U(se.id),F.current=Te;return}Oe!=="ignore"&&(U(null),J(`delete:${se.id}`,async()=>{try{await Gye(se.id),dke(se.kind,se.id),Y(se.id),(j==null?void 0:j.mode)==="edit"&&j.id===se.id&&k(null),p(null);const ve=(n??[]).filter(_e=>_e.kind===se.kind&&_e.id!==se.id);(!a||ve.length===0)&&o(null),w("Connection disconnected.");const pe=document.activeElement;(pe===be||Hn((pe==null?void 0:pe.tagName)??null))&&(T.current=()=>{var ze;const _e=(a&&ve[0]?Z.current.get(ve[0].id):l.current.get(se.kind))??P.current.get(se.kind)??document.getElementById("settings-tab-integrations");return(ze=_e==null?void 0:_e.scrollIntoView)==null||ze.call(_e,{block:"nearest"}),_e})}catch(ve){X(se.id,"err",ve instanceof Error?ve.message:"The connection could not be removed. Try again.","disconnect")}}))};g.useEffect(()=>{if(v!==null||D||!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,j,v,D]);const oe=n??[],re=Od(t),he=["github","gitlab","jira"],fe=zS().filter(se=>re.has(se.kind)||oe.some(be=>be.kind===se.kind)).sort((se,be)=>he.indexOf(se.kind)-he.indexOf(be.kind)),$e=GS(t),ye=g.useCallback(()=>{k(null),p(null),o(null),H(!1),O(null),R(null),U(null),T.current=()=>{const se=q.current,be=se==null?void 0:se.closest(".settings-pane");return be&&(be.scrollTop=K.current),se!=null&&se.isConnected?se:document.getElementById("settings-tab-integrations")}},[]),ge=g.useCallback(()=>{if(!a){ye();return}p(null),k(null),H(!1),O(null),R(null),U(null),T.current=()=>{var Te;const se=(Te=u.current)!=null&&Te.isConnected?u.current:i.current,be=se==null?void 0:se.closest(".settings-pane");return be&&(be.scrollTop=se===i.current?0:d.current),se}},[a,ye]),je=g.useCallback(()=>{if(!f&&!a){ye();return}k(null),H(!1),O(null),R(null),T.current=()=>b.current??(f?x.current:i.current)},[f,a,ye]),Le=g.useCallback((se,be=!1)=>{if(C.current)return;if(D&&be){O(null),requestAnimationFrame(()=>{var Oe;return(Oe=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:Oe.focus()});return}const Te=be?j?je:f?ge:ye:()=>{k(null),p(null),o(null),se()};z?O(()=>Te):(H(!1),Te())},[z,D,j,f,je,ge,ye]);g.useEffect(()=>(e==null||e(j||f||a?Le:null),()=>e==null?void 0:e(null)),[j,f,a,Le,e]),g.useEffect(()=>{var se;D&&((se=V.current)==null||se.focus())},[D]),g.useEffect(()=>{var se;f&&((se=x.current)==null||se.focus())},[f]),g.useEffect(()=>{var se;a&&((se=i.current)==null||se.focus())},[a]);const ke=(se,be)=>{var Oe;if(C.current)return;T.current=null,O(null),w(""),U(null),f||a?b.current=be:(K.current=((Oe=be.closest(".settings-pane"))==null?void 0:Oe.scrollTop)??0,q.current=be,b.current=null),H(!1),R(null),k(se);const Te=be.closest(".settings-pane");Te&&(Te.scrollTop=0)},Ie=(se,be)=>{var Oe,ve;if(C.current)return;T.current=null,a?(u.current=be,d.current=((Oe=be.closest(".settings-pane"))==null?void 0:Oe.scrollTop)??0):(K.current=((ve=be.closest(".settings-pane"))==null?void 0:ve.scrollTop)??0,q.current=be),b.current=null,w(""),U(null),p(se.id);const Te=be.closest(".settings-pane");Te&&(Te.scrollTop=0)},De=(se,be)=>{var ve;const Te=oe.filter(pe=>pe.kind===se);if(Te.length===1){Ie(Te[0],be);return}if(C.current)return;T.current=null,K.current=((ve=be.closest(".settings-pane"))==null?void 0:ve.scrollTop)??0,q.current=be,u.current=null,d.current=0,w(""),U(null),o(se);const Oe=be.closest(".settings-pane");Oe&&(Oe.scrollTop=0)},Ue=(se,be=!1)=>{const Te=Tu(se.kind),Oe=!na(t,se.kind),ve=Fj(se),pe=se.account.login||se.account.name,_e=se.kind==="jira"?Bj(se):null;return r.jsx("div",{className:"ig-conn",ref:ze=>{ze?W.current.set(se.id,ze):W.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:be&&se.name||Uo(se)}),r.jsx("span",{className:"ig-conn-line",children:[be&&se.name!==Uo(se)?Uo(se):"",pe,_e||(ve?`Last verified ${ve}`:"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:[(Te==null?void 0:Te.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:ze=>{ze?Z.current.set(se.id,ze):Z.current.delete(se.id)},"aria-label":`Manage ${(Te==null?void 0:Te.label)??se.kind}: ${se.name} (${pe||Uo(se)})`,onClick:ze=>Ie(se,ze.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=>!fe.some(be=>be.kind===se.kind)),we=a?Tu(a):null,Fe=oe.filter(se=>se.kind===a),Re=oe.find(se=>se.id===f),Ae=(j==null?void 0:j.mode)==="edit"?oe.find(se=>se.id===j.id):void 0,rt=(j==null?void 0:j.mode)==="add"?fe.find(se=>re.has(se.kind)&&se.kind===j.kind):Ae&&fe.find(se=>re.has(se.kind)&&se.kind===Ae.kind);return r.jsxs("div",{className:"ig-settings","data-view":j?"form":f?"connection":a?"provider":"overview",children:[j&&r.jsxs("div",{className:"ig-config-view",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":v!==null||void 0,onClick:()=>Le(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 ${(we==null?void 0:we.label)??a} connections`:"All integrations"]}),D&&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:V,type:"button",className:"btn",onClick:()=>{O(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=D;O(null),H(!1),k(null),se()},children:"Discard changes"})]})]}),r.jsx("div",{hidden:!!D,children:rt?r.jsx(vye,{def:rt,existing:Ae,busy:v==="form",error:_,onDirtyChange:H,onSubmit:j.mode==="add"?Q(j.kind):te(Ae),onCancel:()=>Le(je,!0)},j.mode==="add"?j.kind:j.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:j!==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":v!==null||void 0,onClick:()=>Le(ye,!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"]}),na(t,a)&&r.jsxs("button",{type:"button",className:"btn","aria-disabled":v!==null||void 0,onClick:se=>ke({mode:"add",kind:a},se.currentTarget),children:["Add ",(we==null?void 0:we.label)??a," connection"]})]}),r.jsxs("h2",{ref:i,tabIndex:-1,className:"ig-managed-title",children:[(we==null?void 0:we.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=>Ue(se,!0))}):r.jsx("p",{role:"status",children:"No saved connections."})]}),f&&r.jsxs("div",{className:"ig-manage-view",hidden:j!==null,children:[r.jsxs("div",{className:"ig-manage-navigation",children:[r.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":v!==null||void 0,onClick:()=>Le(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"})}),a?`Back to ${(we==null?void 0:we.label)??a} connections`:"All integrations"]}),Re&&na(t,Re.kind)&&r.jsxs("button",{type:"button",className:"btn","aria-disabled":v!==null||void 0,onClick:se=>ke({mode:"add",kind:Re.kind},se.currentTarget),children:["Add ",((We=Tu(Re.kind))==null?void 0:We.label)??Re.kind," connection"]})]}),Re?r.jsx(hke,{connection:Re,provider:Tu(Re.kind),available:na(t,Re.kind),busy:v,armed:$===f,note:A.find(se=>se.id===f),headingRef:x,onTest:()=>le(Re),onEdit:se=>ke({mode:"edit",id:Re.id},se),onDisconnect:se=>de(Re,se),onCancelDisconnect:()=>U(null)}):r.jsx("p",{role:"status",children:"This connection is no longer saved."})]}),r.jsxs("div",{className:"ig-overview",hidden:j!==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 Ym(),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:$e==="all"?"integrations-add-title":void 0,children:fe.map(se=>{const be=oe.filter(_e=>_e.kind===se.kind),Te=be.length===1?be[0]:null,Oe=[...new Set(be.map(Uo))],ve=Te&&Fj(Te),pe=(Te==null?void 0:Te.kind)==="jira"?Bj(Te):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}),be.length===0?r.jsx("span",{className:"ig-conn-line",children:"Not connected"}):Te?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"ig-conn-name",children:Uo(Te)}),r.jsx("span",{className:"ig-conn-line",children:[Te.account.login||Te.account.name,pe||(ve?`Last verified ${ve}`:"Not verified yet")].filter(Boolean).join(" · ")}),!Te.tokenSaved&&r.jsx("span",{className:"ig-bad",children:"No token saved"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"ig-conn-name",children:[be.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${be.length?"":" primary"}`,"aria-disabled":v!==null||void 0,ref:_e=>{const ze=be.length?l.current:P.current;_e?ze.set(se.kind,_e):ze.delete(se.kind)},"aria-label":`${be.length?"Manage":"Connect"} ${se.label}`,onClick:_e=>be.length?De(se.kind,_e.currentTarget):ke({mode:"add",kind:se.kind},_e.currentTarget),children:be.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||fe.length===0&&$e!=="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=>Ue(se,!0)),oe.length===0&&r.jsx("p",{className:"settings-row settings-row-status",children:"Nothing connected."})]})]}),$e==="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 pke({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 mke({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,d=(pr.indexOf(l??e)+(i.key==="ArrowLeft"||i.key==="ArrowUp"?-1:1)+pr.length)%pr.length;t(pr[d]),(p=i.currentTarget.querySelectorAll('[role="radio"]')[d])==null||p.focus()},a=g.useRef(null),o=g.useRef(e);return g.useEffect(()=>{var u,d;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||(d=a.current.querySelector(`[data-theme-choice="${e}"]`))==null||d.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:pr.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(pke,{theme:i}),r.jsxs("span",{className:"appearance-theme-name",children:[ic[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 gke=[["smallest","Smallest","11 px"],["smaller","Smaller","12 px"],["default","Default","13 px"],["larger","Larger","15 px"],["largest","Largest","17 px"]],yke=[["tightest","Tightest","30%"],["tighter","Tighter","50%"],["compact","Compact","70%"],["default","Default","100%"],["comfortable","Comfortable","140%"]];function e3(){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 wke({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 xke({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":_A.length,"--reading-selected":_A.indexOf(e)},children:gke.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(e3,{})]},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":EA.length,"--reading-selected":EA.indexOf(t)},children:yke.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(e3,{})]},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."})]})}function vke(e){return!!e&&ks(e.version)&&ks(e.desktopVersion)&&ha(e.version,e.desktopVersion)<0}function bke({info:e}){return r.jsx(mt,{as:"div",name:"Terminal CLI",note:`The npm CLI on Windows PATH is v${e.version}; the desktop app is v${e.desktopVersion}. Desktop updates do not update the npm CLI.`,control:r.jsx("span",{className:"settings-read",children:"Update needed"}),children:r.jsxs("span",{className:"settings-row-said",children:["Run ",r.jsx("code",{children:"npm install -g ccdeck@latest"}),", then reopen PowerShell and run ",r.jsx("code",{children:"ccdeck tui"}),"."]})})}function kke(){const[e,t]=g.useState(null);return g.useEffect(()=>{var s;let n=!0;return(s=window.ccdeckTerminalCli)==null||s.version().then(a=>{n&&vke(a)&&t(a)}).catch(()=>{}),()=>{n=!1}},[]),e?r.jsx(bke,{info:e}):null}const jke="AGPL-3.0-only",Nke="GNU Affero General Public License, version 3 only.",Ske="https://github.com/BarganConstantin/ccdeck",Cke="What changed in each release, newest first.",_ke="Tell the people who make ccdeck what works and what does not.";function Eke(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 Tke(e,t){return ks(e)&&ks(t)&&ha(e,t)<0}function Ake(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 Rke({version:e,notice:t,readyAppUpdate:n,updateRestarting:s,updateFailure:a,onUpdateRestart:o,doors:i,bundle:l="3.49.1"}){const u=(e==null?void 0:e.running)??l,d=Ake(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:Tke(l,e==null?void 0:e.running)?Eke(l):void 0,control:r.jsx("span",{className:"settings-read",children:u})}),typeof window<"u"&&window.ccdeckTerminalCli&&r.jsx(kke,{}),d&&r.jsx(Mke,{offer:d,restarting:s,failure:a,onRestart:o,onUpdate:i.update}),r.jsx(mt,{as:"div",settingId:"whats-new",name:"What's new",note:Cke,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:Nke,control:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"settings-read",children:jke}),r.jsxs("a",{className:"settings-link",href:Ske,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:sbe,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:_ke,control:r.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":"Open the feedback dialog",onClick:i.feedback,children:"Open"})})]})]})}function Mke({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=F8(e.to,t),i=n&&n.version===e.to?B8(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 $ke="Update when idle",Lke="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.",Ike=`${oB} 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.`,Oke="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.",Pke="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 Dke(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 Fke={plain:Lke,"checks-off":Ike,"no-restart":Oke};function Bke({autoRestart:e,onToggleAutoRestart:t,version:n,inApp:s=ao()}){const a=Dke(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:Pke}):r.jsx(mt,{settingId:"auto-update",name:$ke,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:Fke[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 qke({character:e,onCharacter:t}){const n=g.useRef([]);function s(a,o){var l;const i=pS(a,o,Ff.length,"vertical");i.kind==="select"&&(a.preventDefault(),t(Ff[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:Ff.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(bD,{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 Uke="Stands beside the minimap. Press it to play the radio.";function Wke({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:Uke,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(qke,{character:n,onCharacter:s})]})}const t3="settings-search-field",hB="settings-search-results",qj=e=>`settings-result-${e}`;function Hke({inputRef:e,query:t,onQuery:n,results:s,active:a,onActive:o,onOpen:i}){const l=t.trim()!=="",u=l&&s.length>0,d=f=>{if(f.nativeEvent.isComposing)return;const p=kte(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:t3,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:t3,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?hB:void 0,"aria-activedescendant":u?qj(Math.min(a,s.length-1)):void 0,"aria-keyshortcuts":"Control+F Meta+F",value:t,onChange:f=>n(f.target.value),onKeyDown:d})]})}function zke({query:e,results:t,active:n,onOpen:s}){const a=l5(t.length,e);return g.useEffect(()=>{var o,i;(i=(o=document.getElementById(qj(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:hB,role:"listbox","aria-label":"Matching settings",children:t.map((o,i)=>r.jsxs("button",{type:"button",role:"option",id:qj(i),className:"settings-result",tabIndex:-1,"aria-selected":i===n,"aria-label":wte(o),"data-highlighted":i===n,onMouseDown:l=>l.preventDefault(),onClick:()=>s(o),children:[r.jsx(wm,{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:zN(o)})]})]},o.id))})})]})}function Vke({query:e,count:t}){return r.jsx("p",{className:"vis-hidden",role:"status",children:e.trim()?l5(t,e):""})}const Gke=1500,Kke=3e3,Yke=e=>e.checkVisibility?e.checkVisibility():e.getClientRects().length>0;function Xke(e){if(e.matches(rp)&&!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(rp)).filter(s=>LP({disabled:s.disabled,tabIndex:s.tabIndex,rendered:Yke(s)}));return n.find(s=>s.closest(".settings-list")!=null)??n[0]??null}function Zke(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)}"]`),d=w=>{var b,j;a(null);const x=w.offsetHeight>l.clientHeight-48;w.scrollIntoView({block:x?"start":"center"}),(b=Xke(w))==null||b.focus({preventScroll:!0}),window.clearTimeout(o.current),(j=i.current)==null||j.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)},Gke)},f=u();if(f){d(f);return}const p=new MutationObserver(()=>{const w=u();w&&(p.disconnect(),window.clearTimeout(m),d(w))});p.observe(l,{childList:!0,subtree:!0});const m=window.setTimeout(()=>{p.disconnect(),a(null)},Kke);return()=>{p.disconnect(),window.clearTimeout(m)}},[e,s,t,n]),a}function Jke({section:e,landOn:t,onSection:n,onClose:s,providers:a,sound:o,tones:i,customTones:l,notify:u,appearance:d,versionCheck:f,desktopUpdate:p,restart:m,doors:w}){const x=g.useRef(null),b=g.useCallback(ve=>{x.current=ve},[]);function j(ve,pe=!1){x.current?(D(""),x.current(ve,pe),requestAnimationFrame(()=>{var _e,ze;return(ze=(_e=v.current)==null?void 0:_e.scrollIntoView)==null?void 0:ze.call(_e,{block:"nearest",inline:"nearest"})})):ve()}const k=()=>j(s,!0),v=g.useRef(null),S=gt(k,{focusRef:v}),C=wt(()=>j(s)),_=g.useRef([]),R=Id(),A=GS(R),I=fee(A,e,a.claude),$=Math.max(0,I.findIndex(ve=>ve.id===e)),U=lc("(max-width: 640px)"),[F,M]=g.useState(""),[B,T]=g.useState(0),P=g.useRef(null),q=g.useRef(null),K=F.trim()!=="",z=g.useMemo(()=>bte(F,i5(a.claude,A,Od(R))),[F,a.claude,A,R]),H=Zke(q,!K,e),D=ve=>{M(ve),T(0)};g.useEffect(()=>{t&&H(t)},[t,H]);const O=ve=>{j(()=>{D(""),n(ve),requestAnimationFrame(()=>{var pe;return(pe=document.getElementById(`settings-tab-${ve}`))==null?void 0:pe.focus()})})},V=ve=>{j(()=>{D(""),n(ve.section),ym(ve)||H(ve.id)})};g.useEffect(()=>{const ve=pe=>{var at,tt;if(!xee(pe))return;const _e=S.current,ze=pe.target;!_e||!(ze===document.body||ze===document.documentElement||ze&&_e.contains(ze))||(pe.preventDefault(),(at=P.current)==null||at.focus(),(tt=P.current)==null||tt.select())};return window.addEventListener("keydown",ve),()=>window.removeEventListener("keydown",ve)},[S]),g.useEffect(()=>{var ve,pe,_e,ze;pee((ve=document.activeElement)==null?void 0:ve.id,e)&&((pe=v.current)==null||pe.focus()),(ze=(_e=v.current)==null?void 0:_e.scrollIntoView)==null||ze.call(_e,{block:"nearest",inline:"nearest"})},[e]);const{theme:Z,setTheme:W,characterEnabled:X,setCharacterEnabled:Y,character:J,setCharacter:Q}=d,te=An(),le=ve=>{const pe=pS(ve,$,I.length,"vertical");pe.kind!=="pass"&&(ve.preventDefault(),j(()=>{var _e;D(""),n(I[pe.index].id),(_e=_.current[pe.index])==null||_e.focus()}))},de=ve=>{ve.key===" "&&ve.stopPropagation()},{soundOn:oe,toggleSound:re}=o,{tonePrefs:he,previewTone:fe,changeTone:$e}=i,{customSelections:ye,customAssets:ge,clearCustomOnly:je,selectCustomTone:Le,importNotificationAudio:ke,createNotificationVoice:Ie,renameCustomAsset:De,deleteCustomAsset:Ue,previewCustomAsset:Ke}=l,{notifyPermission:we,notifyOn:Fe,notifyVetoed:Re,toggleNotify:Ae,notifySupported:rt,askForNotifications:We,accountNotify:se,toggleAccountNotify:be}=u,Te=(()=>{switch(e){case"radar":return r.jsx(zbe,{onOpen:w.radar});case"claude":return r.jsx(oke,{});case"appearance":return r.jsxs(r.Fragment,{children:[r.jsx(mke,{theme:Z,onTheme:W,singleKeys:te}),r.jsx(Wke,{characterEnabled:X,character:J,onCharacter:Q,onToggleCharacter:()=>Y(ve=>!ve)})]});case"reading":return r.jsx(xke,{textSize:d.textSize,density:d.density,onTextSize:d.setTextSize,onDensity:d.setDensity});case"keyboard":return r.jsx(_be,{singleKeys:te,onToggleSingleKeys:()=>BY(!te)});case"notifications":return r.jsx(Ebe,{notifyOn:Fe,onToggleNotify:Ae,notifyVetoed:Re,notifyPermission:rt?we:"unsupported",onAskNotify:We,accountNotify:se,onToggleAccountNotify:be});case"sounds":return r.jsx(Wbe,{soundOn:oe===!0,onToggleSound:re,prefs:he,claudeHere:a.claude,onLevel:(ve,pe)=>$e(ve,{level:pe}),onFigure:(ve,pe)=>$e(ve,{figure:pe}),onPreview:ve=>fe(ve),customAssets:ge,customSelections:ye,onBuiltInSelected:je,onCustomSelected:Le,onImportCustom:ke,onCreateVoice:Ie,onRenameCustom:De,onPreviewCustom:Ke,onDeleteCustom:Ue});case"integrations":return r.jsx(fke,{onBeforeLeaveChange:b});case"data":return r.jsx(cke,{});case"about":return r.jsx(Rke,{version:f.version,notice:f.notice,readyAppUpdate:p.readyAppUpdate,updateRestarting:p.desktopUpdateRestarting,updateFailure:p.desktopUpdateFailure,onUpdateRestart:ve=>{p.askDesktopUpdateRestart(ve)},doors:w});default:return r.jsxs(r.Fragment,{children:[r.jsx(mbe,{}),r.jsx(GO,{provider:"Codex"}),a.claude&&r.jsx(GO,{provider:"Claude"}),r.jsx(Bke,{autoRestart:m.autoRestart,onToggleAutoRestart:m.toggleAutoRestart,version:f.version}),r.jsx(kbe,{claudeHere:a.claude,singleKeys:te,doors:w})]})}})(),Oe=e==="reading"?r.jsx(wke,{textSize:d.textSize,density:d.density,onTextSize:d.setTextSize,onDensity:d.setDensity}):e==="integrations"&&R.connections!==null?r.jsxs("span",{className:"ig-total",children:[R.connections.length," saved connection",R.connections.length===1?"":"s"]}):null;return r.jsx("div",{className:"modal-backdrop",...C,role:"presentation",children:r.jsxs("div",{ref:S,id:"settings",className:"modal settings-modal",role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",onClick:ve=>ve.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:()=>j(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(Hke,{inputRef:P,query:F,onQuery:D,results:z,active:B,onActive:T,onOpen:V}),r.jsx(Vke,{query:F,count:z.length}),r.jsx("div",{className:"settings-nav",role:"tablist","aria-label":"Settings sections","aria-orientation":U?"horizontal":"vertical",onKeyDown:le,children:I.map((ve,pe)=>r.jsxs("button",{ref:_e=>{_.current[pe]=_e,ve.id===e&&(v.current=_e)},type:"button",role:"tab",id:`settings-tab-${ve.id}`,className:"settings-tab","aria-selected":ve.id===e,"aria-controls":"settings-pane",tabIndex:ve.id===e?0:-1,onClick:()=>O(ve.id),children:[r.jsx(wm,{section:ve.id}),r.jsx("span",{className:"settings-tab-label",children:ve.label})]},ve.id))})]}),r.jsxs("div",{ref:q,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:I[$].label}),r.jsx("p",{className:"settings-pane-note",children:I[$].note})]}),Oe]}),Te]},e),K&&r.jsx(zke,{query:F,results:z,active:B,onOpen:V})]})]})})}function Qke({tool:e,onClose:t}){const n=gt(t),s=wt(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,d=g.useMemo(()=>{const f=pV(e.name,i,l);return{input:f.input.map((p,m)=>r.jsx(n3,{block:p},m)),response:f.response.map((p,m)=>r.jsx(n3,{block:p},m)),copyInput:nT(e.name,"input",i),copyResponse:nT(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:MP(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(s3,{text:d.copyInput,what:"input"})]}),d.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(s3,{text:d.copyResponse,what:"response"})]}),e.endedAt==null?r.jsx("pre",{children:"(waiting…)"}):d.response]})]})]})})}const e0e={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function n3({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(()=>iV(e),[e]),{shown:a}=oP(s,t),o=lV(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?e0e[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 s3({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 io(e).then(o=>{!o||!a.current||(s(!0),window.setTimeout(()=>{a.current&&s(!1)},1600))}),children:n?"copied":"copy"})}const t0e=Km(()=>gi(()=>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 s3({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 io(e).then(o=>{!o||!a.current||(s(!0),window.setTimeout(()=>{a.current&&s(!1)},1600))}),children:n?"copied":"copy"})}const t0e=Km(()=>gi(()=>import("./UsageHistoryModal-DvYWhsYv.js"),[]),"Usage history"),n0e=Km(()=>gi(()=>import("./BrowserWatchModal-CCARqAMn.js"),[]),"Browser Watch"),s0e=Km(()=>gi(()=>import("./TrafficRadar-B9MfKca4.js"),[]),"Telemetry Radar");function r0e({dialogs:e,welcome:t,desktopUpdate:n,versionCheck:s,restart:a,upgrade:o,lanPairs:i,attention:l,clearFlow:u,watchBadge:d,announcements:f,appearance:p,providers:m,stateRef:w,agentCount:x,menus:b,sound:j,tones:k,customTones:v,notify:S,panelDoors:C}){const{openedTool:_,setOpenedToolKey:R,usageHistoryOpen:A,setUsageHistoryOpen:I,browserWatchOpen:$,setBrowserWatchOpen:U,contextAgent:F,setContextFor:M,summaryFor:B,setSummaryFor:T,keyHelpOpen:P,setKeyHelpOpen:q,feedbackOpen:K,setFeedbackOpen:z,feedbackPrefill:H,setFeedbackPrefill:D,openFeedback:O}=e,{trafficRadarOpen:V,setTrafficRadarOpen:Z}=e,{tourOpen:W,openTour:X,closeTour:Y,releaseNotes:J,closeReleaseNotes:Q,chipVersion:te,openReleaseNotes:le}=t,{desktopUpdateRestarting:de,desktopUpdateFailure:oe,readyAppUpdate:re,askDesktopUpdateRestart:he}=n,{version:fe,showNotice:$e}=s,{askRestart:ye}=a,{clearConfirmOpen:ge,setClearConfirmOpen:je,requestClear:Le}=u,{setWatchOn:ke,markWatchSeen:Ie}=d,{setWatchSaid:De}=f,{palette:Ue}=p,{settingsOpen:Ke,settingsSection:we,settingsLandOn:Fe,showSection:Re,closeSettings:Ae,openSettings:rt}=b;return r.jsxs(r.Fragment,{children:[_&&r.jsx(Qke,{tool:_,onClose:()=>R(null)}),A&&r.jsx(g.Suspense,{fallback:null,children:r.jsx(t0e,{providers:m,onClose:()=>I(!1)})}),$&&r.jsx(g.Suspense,{fallback:null,children:r.jsx(n0e,{onClose:()=>U(!1),onSeen:We=>{De(""),Ie(We)},onWatching:ke,palette:Ue})}),F&&r.jsx(uK,{agent:F,onClose:()=>M(null)}),V&&r.jsx(g.Suspense,{fallback:null,children:r.jsx(s0e,{sessions:[...w.current.agents.values()].filter(We=>We.kind==="root"&&We.provider!=="codex").map(We=>({id:We.sessionId,label:sm(We.sessionName,We.sessionTitle).face??We.cwdBasename??We.label,project:We.cwdBasename??We.label,workspace:We.cwd})),onClose:()=>Z(!1)})}),K&&r.jsx(J8,{initialKind:H==null?void 0:H.initialKind,initialBody:H==null?void 0:H.initialBody,onClose:()=>{z(!1),D(null)}}),B&&r.jsx(ube,{state:w.current,sessionId:B,onClose:()=>T(null)}),Ke&&r.jsx(Jke,{section:we,landOn:Fe,onSection:Re,onClose:Ae,providers:m,sound:j,tones:k,customTones:v,notify:S,appearance:p,versionCheck:s,desktopUpdate:n,restart:a,doors:{whatsNew:Ba(Ae,le),update:Ba(Ae,()=>{le(),$e()}),tour:Ba(Ae,X),feedback:Ba(Ae,()=>O()),accounts:Ba(Ae,C.accounts),localNetwork:Ba(Ae,C.localNetwork),browserWatch:Ba(Ae,()=>U(!0)),radar:Ba(Ae,()=>Z(!0))}}),J&&r.jsx(lbe,{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)?B8(oe.failure,oe.version):void 0,onUpdateRestart:re?()=>{he(re.version)}:void 0,onRestart:!re&&(fe!=null&&fe.canRestart)?()=>{Q(),ye()}:void 0,updateCheck:{versionCheck:s,upgrade:o,restart:a,desktopUpdate:n,running:te,onHandOff:Q}}),r.jsx(a0e,{lanPairs:i,attention:l}),P&&r.jsx(hve,{onClose:()=>q(!1),onTour:()=>{q(!1),X()},onSettings:()=>{q(!1),rt("keyboard")}}),W&&r.jsx(j6,{title:"What the deck shows you",steps:ele,onClose:Y}),ge&&r.jsx(nxe,{agentCount:x,onConfirm:()=>Le("confirmation"),onCancel:()=>je(!1)})]})}function a0e({lanPairs:e,attention:t}){const n=jve(e);return r.jsxs(r.Fragment,{children:[n,r.jsx(_ve,{...t,pairing:n!=null})]})}const o0e=10,fB=500,pB=4e3,i0e=[/ResizeObserver loop/i,/^Script error\.?$/i],r3=/^(?:[a-z][\w+.-]*-extension|webkit-masked-url):\/\//i,l0e=/[a-z][\w+.-]*:\/\/[^\s()]+/gi;function c0e(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(l0e)??[]:[]);return a.length?a.every(o=>r3.test(o)):typeof t=="string"&&r3.test(t)}const Bp=String.raw`[^\s\\/:'"\`<>|?*;,]`,u0e=String.raw`${Bp}(?:[^\\/\r\n:'"\`<>|?*;,]*${Bp})?[\\/]`,d0e=String.raw`[^\s\\/:'"\`<>|?*;,()]+`,wu=String.raw`(?:${u0e})*(?:${d0e})?`,h0e=String.raw`(?<![\w.~/\\\]-]|<(?:deck|host)>)(?:file://(?:/[A-Za-z]:)?[^\s:'"\`<>()]*|~[\\/]${wu}|[A-Za-z]:[\\/]${wu}|\\\\(?:[?.]\\)?(?:[A-Za-z]:\\)?${wu}|/(?=${Bp})${wu}|(?<!:)//(?=${Bp})${wu})`,f0e=String.raw`(?<![\w-])(?:[A-Za-z]--|-[A-Za-z0-9][\w.]*-)[\w.-]*`,p0e=new Set([".claude",".codex"]);function m0e(e){if(!e.startsWith("~"))return"<path>";const t=e[1],[n,...s]=e.slice(2).split(/[\\/]/);return n?p0e.has(n)?s.join("")?`~${t}${n}${t}<path>`:e:`~${t}<path>`:e}const g0e=String.raw`\b(https?|wss?)://[^\s/?#\\'"\x60<>(),;]+(?=(/assets/)?)`;function y0e(e,t,n){return n?"<deck>":`${t}://<host>`}const a3=String.raw`(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)`,mB=String.raw`${a3}(?:\.${a3}){3}`,a1=String.raw`[0-9A-Fa-f]{1,4}`,o3=String.raw`(?=[0-9A-Fa-f:]*\d)(?=[0-9A-Fa-f:]*::|(?:${a1}:){7})(?:(?:${a1})?:)+(?:${mB}|${a1})?`,i3=String.raw`%[\w-]+(?:\.[\w-]+)*`,l3=String.raw`(?:::1?|::ffff:(?:127(?:\.\d{1,3}){3}|0\.0\.0\.0))`,w0e=String.raw`(?<![\w:.%-])(?:\[(?!${l3}\])${o3}(?:${i3})?\]|(?!${l3}(?::\d{1,5})?(?![\w:%]|\.\d))${o3}(?:${i3})?(?![\w%]|\.\d))|(?<![\w./-])(?!127\.|0\.0\.0\.0\b)${mB}(?![\w-]|\.\d)`,o1=String.raw`(?=[\w.-]*[A-Za-z])[A-Za-z0-9][\w-]*(?:\.[\w-]+)*`,x0e=String.raw`(?<![\w.@/\\%-])(?!localhost(?![\w-]|\.\w))(?:(?<=\b(?:(?:getaddrinfo|connect) E[A-Z_]+|ENOTFOUND|EAI_AGAIN) )${o1}|${o1}(?=:\d{1,5}(?![\w:-]|\.\w))|${o1}\.(?:local|lan|home|internal|ts\.net)(?![\w-]|\.\w))`;function c3(e){return String(e??"").replace(/\/(?:home|Users)\/[^/\s:'"]+/g,"~").replace(/[A-Za-z]:\\(?:Users|Documents and Settings)\\[^\\\r\n:'"]+/gi,"~").replace(new RegExp(h0e,"g"),m0e).replace(new RegExp(f0e,"g"),"<project>").replace(new RegExp(g0e,"g"),y0e).replace(new RegExp(w0e,"g"),"<host>").replace(new RegExp(x0e,"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 gB=e=>{fetch("/api/client-error",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),keepalive:!0}).catch(()=>{})};function v0e(e,t,n=gB){const s=String(e??"").slice(0,fB).trim();s&&n({message:s,stack:typeof t=="string"?t.slice(0,pB):void 0})}function b0e(e,t=window,n=gB){let s=0;const a=new Set,o=(u,d,f)=>{const p=String(u??"").slice(0,fB).trim();!e()||!p||s>=o0e||a.has(p)||i0e.some(m=>m.test(p))||c0e(d,f)||(a.add(p),s++,n({message:p,stack:typeof d=="string"?d.slice(0,pB):void 0}))},i=u=>{var d,f;return o(((d=u.error)==null?void 0:d.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 k0e=12;function j0e(e,t){const n=[c3(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,k0e).join(`
|
|
319
319
|
`);n.push("",c3(a).trim())}return n.join(`
|
|
320
320
|
`)}class N0e extends g.Component{constructor(){super(...arguments);Da(this,"state",{error:null,componentStack:null,reportOpen:!1});Da(this,"onKey",n=>{rm(n.key)&&ln.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}),v0e(n.message,n.stack),v8("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(J8,{initialKind:"bug",initialBody:j0e(n.message,s),onClose:()=>this.setState({reportOpen:!1})})]}):this.props.children}}const S0e=1e3;function C0e(e={}){const t=Math.max(1,Math.floor(e.limit??S0e)),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(d){const f=typeof(d==null?void 0:d.seq)=="number"?d.seq:null,p=(d==null?void 0:d.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(d),n!=null&&n(d)&&o.add(d),a.length>t){let x=0;if(o.size<a.length)for(;o.has(a[x]);)x++;const[b]=a.splice(x,1);o.delete(b),i++}return!1},setPaused(d){if(s=d,d)return[];const f=a;return a=[],o=new Set,i=0,f}}}function _0e(e){const t=g.useState(()=>C0e({protect:o=>SV(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&&uG(e.current);for(const l of i)e.current=wP(e.current,l);s(t.paused)},[t,e]);return{pauseGate:t,paused:n,togglePause:a}}const Uj={kind:"assumed",claude:!0,codex:!0};function E0e(e){if(!e||typeof e!="object")return Uj;const t=e.providers;if(!t||typeof t!="object")return Uj;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function T0e(e){const[t,n]=g.useState(null),[s,a]=g.useState(Uj);g.useEffect(()=>{let i=!1;return fetch("/api/health").then(l=>l.ok?l.json():null).then(l=>{i||(a(E0e(l)),!(!l||typeof l.workspace!="string")&&n(l.workspace))}).catch(()=>{}),()=>{i=!0}},[e]);const o=Bn(s);return{workspace:t,providers:s,providersRef:o}}const yB=3*6e4,A0e=2e4;function R0e({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>=yB&&await i()},stop:()=>{o=!1}}}async function M0e(){try{const e=await fetch("/api/provider-status",{signal:AbortSignal.timeout(A0e)});return e.ok?await e.json():null}catch{return null}}function $0e(e){const[t,n]=g.useState(null);return g.useEffect(()=>{if(!e){n(null);return}const s=R0e({fetchReport:M0e,visible:()=>document.visibilityState==="visible",now:()=>Date.now(),onReport:n});s.tick();const a=window.setInterval(s.tick,yB),o=()=>{s.wake()};return document.addEventListener("visibilitychange",o),()=>{s.stop(),window.clearInterval(a),document.removeEventListener("visibilitychange",o)}},[e]),t}const L0e={degraded:"degraded performance",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},I0e={degraded:"degraded",partial_outage:"partial outage",major_outage:"major outage",maintenance:"maintenance"},O0e={degraded:"degraded",partial_outage:"outage",major_outage:"outage",maintenance:"maint."},P0e={claude:"Claude",codex:"Codex"},D0e=new Set(["status.claude.com","status.openai.com"]),F0e=30*6e4,B0e=10*6e4;function q0e(e){if(typeof e!="string")return null;try{const t=new URL(e);return t.protocol==="https:"&&D0e.has(t.hostname)?t:null}catch{return null}}function u3(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})}function U0e(e){const t=Math.floor(e/6e4);return t<1?"just now":t<60?`${t} min ago`:`${Math.floor(t/60)} h ago`}function W0e(e,t){if(!e||typeof e!="object")return null;const n=Kt(L0e,e.state),s=Kt(P0e,e.provider);if(!n||!s||typeof e.checkedAt!="number"||t-e.checkedAt>F0e)return null;const a=q0e(e.statusPageUrl);if(!a)return null;const o=Array.isArray(e.components)?e.components:[],i=e.stale===!0||t-e.checkedAt>B0e,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 ${u3(e.checkedAt)}; this is the last thing it said`:`Reported by ${a.hostname}, checked ${U0e(t-e.checkedAt)}`,"Opens the status page"],u=i?u3(e.checkedAt):null;return{provider:e.provider,state:e.state,name:s,label:`${s} · ${n}${u?` · as of ${u}`:""}`,words:n,chipWords:Kt(I0e,e.state)??n,shortWords:Kt(O0e,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 H0e(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>W0e(n,t)).filter(n=>n!==null)}function z0e(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const V0e="The providers' status pages report no incident.";function G0e({version:e,loadVersion:t}){var d;const[n,s]=g.useState(!1),a=((d=e==null?void 0:e.upgrade)==null?void 0:d.state)??"idle",o=Hwe(e==null?void 0:e.upgrade),i=g.useRef(!1),l=g.useCallback(async()=>{if(_n(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 io(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 d3="agent-dag.browserWatch.seenMs";function K0e(e,t){return e.filter(n=>n.startMs>t)}function Y0e(){const[e,t]=g.useState(()=>Number(nt(d3))||0),[n,s]=g.useState([]),[a,o]=g.useState(!1);g.useEffect(()=>{let u=!0;const d=()=>{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(()=>{})};d();const f=setInterval(d,5*6e4);return()=>{u=!1,clearInterval(f)}},[]);const i=g.useMemo(()=>K0e(n,e).length,[n,e]),l=g.useCallback(u=>{t(u),st(d3,String(u))},[]);return{watchOn:a,setWatchOn:o,watchUnseen:i,markWatchSeen:l}}const wB="agent-dag.character-enabled",xB="agent-dag.fm-volume",X0e=1,h3="agent-dag.fm-source",$je=[{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 Z0e(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 J0e(e){return e!=="0"}function Q0e(){return J0e(nt(wB))}function e1e(e){return s5(e,X0e)}function t1e(){return e1e(nt(xB))}const vB=["--err","--inflight","--ok","--warn","--muted","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function f3(e){const t={};for(const n of vB)t[n]=e(n);return t}function n1e(e){return t=>e[t]??""}function s1e(e,t){return vB.every(n=>e[n]===t[n])}function r1e(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 d=e.startViewTransition(u);n=d,d.ready.catch(()=>{}),d.updateCallbackDone.catch(()=>{u()}),d.finished.then(()=>{n===d&&(n=null,delete e.documentElement.dataset.themeTransition)},()=>{n===d&&(u(),n=null,delete e.documentElement.dataset.themeTransition)})}catch{delete e.documentElement.dataset.themeTransition,u()}}}}function p3(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function a1e(){const[e,t]=g.useState(Hte),[n,s]=g.useState(zte),[a,o]=g.useState(dte),i=g.useRef(a),[l]=g.useState(()=>r1e(document,()=>{try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!0}})),u=g.useCallback(k=>{const v=typeof k=="function"?k(i.current):k;v!==i.current&&(i.current=v,l.run(()=>vt.flushSync(()=>o(v))))},[l]);g.useEffect(()=>()=>l.cancel(),[l]);const[d,f]=g.useState(Q0e),[p,m]=g.useState(kee),[w,x]=g.useState(()=>f3(p3)),b=g.useMemo(()=>n1e(w),[w]),j=g.useCallback(k=>Kme(k,b),[b]);return g.useEffect(()=>{document.documentElement.dataset.textSize=e,st(Z1,e)},[e]),g.useEffect(()=>{document.documentElement.dataset.density=n,st(J1,n)},[n]),g.useEffect(()=>{const k=v=>{v.storageArea===gr()&&((v.key===Z1||v.key===null)&&t(KN(v.newValue)),(v.key===J1||v.key===null)&&s(m5(v.newValue)))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),g.useLayoutEffect(()=>{document.documentElement.dataset.theme=a,document.documentElement.dataset.colorScheme=ic[a].colorScheme,st(a5,a),x(k=>{const v=f3(p3);return s1e(k,v)?k:v})},[a]),g.useEffect(()=>{st(wB,d?"1":"0")},[d]),g.useEffect(()=>{st(YD,p)},[p]),g.useEffect(()=>{const k=document.querySelector('meta[name="theme-color"]'),v=w["--panel"];k&&v&&k.setAttribute("content",v)},[w]),{textSize:e,setTextSize:t,density:n,setDensity:s,theme:a,setTheme:u,characterEnabled:d,setCharacterEnabled:f,character:p,setCharacter:m,palette:w,minimapNodeFill:j}}function o1e(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 d of e.current.agents.values())for(const f of d.tools)u.add(j8(f.name));return Object.keys(k8).filter(d=>u.has(d))},[e.current,e.current.revision]);g.useEffect(()=>{if(i.length<=1){s(!1);return}let u=0;const d=()=>{const f=t.current;if(f&&!document.hidden){const p=f.getBoundingClientRect(),m=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(x=>x.getBoundingClientRect()),w=aQ(p,m,8);s(x=>x===w?x:w)}u=window.setTimeout(d,300)};return d(),()=>window.clearTimeout(u)},[i.length]);const l=g.useCallback(u=>{o(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]);return{presentCats:i,hiddenCats:a,toggleCat:l,catBarRef:t,catBarOccluded:n}}function i1e(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,x=w.figure){if(!n||n.state!=="running")return!1;const b=K1(m,x),j=Xee(w.level,b),k=n.currentTime;for(const v of b.notes){const S=n.createOscillator(),C=n.createGain();S.type=b.type??"sine",S.frequency.value=v.hz;const _=k+v.at,R=_+v.ms/1e3;C.gain.setValueAtTime(NA,_),C.gain.exponentialRampToValueAtTime(j,_+Zee),C.gain.exponentialRampToValueAtTime(NA,R),S.connect(C).connect(n.destination),S.start(_),S.stop(R+.02)}return!0}async function u(m,w){var j;if(!e.loadCustom)return"unavailable";let x;try{x=await e.loadCustom(m)}catch{return"unavailable"}if(!x)return"missing";if(x.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const k=new SpeechSynthesisUtterance(x.text),v=window.speechSynthesis.getVoices();k.voice=v.find(S=>S.voiceURI===x.voiceURI)??null,k.rate=x.rate,k.pitch=x.pitch,k.volume=Jee(w.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(k),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let b;try{b=await n.decodeAudioData(x.bytes.slice(0))}catch{return"broken"}try{const k=n.createBufferSource(),v=n.createGain();return k.buffer=b,v.gain.setValueAtTime(Qee(x.normalizationGain,w.level),n.currentTime),k.connect(v).connect(n.destination),s.add(k),(j=k.addEventListener)==null||j.call(k,"ended",()=>s.delete(k)),k.start(n.currentTime),"played"}catch{return"unavailable"}}function d(m,w=!1){var j,k;if(!w&&!e.enabled())return!1;const x=ote((j=e.prefs)==null?void 0:j.call(e),m),b=((k=e.customSelection)==null?void 0:k.call(e)[m])??null;return b&&e.loadCustom?(u(b,x).then(v=>{var S;v==="played"||v==="locked"||((v==="missing"||v==="broken")&&((S=e.onCustomFailure)==null||S.call(e,m,b)),l(m,{...x,figure:Qn},Qn))}),!0):!n||n.state!=="running"?!1:l(m,x)}function f(m,w=pi){return u(m,{level:gm(w),figure:Qn}),!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:d,previewCustom:f,silence:p,state:a,get context(){return n}}}function l1e({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:s,fallbackCustomRef:a}){g.useEffect(()=>{const o=i1e({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>s.current,loadCustom:zee,onCustomFailure:(d,f)=>a.current(d,f)});e.current=o;const i=["pointerdown","pointerup","keydown"],l=()=>{for(const d of i)window.removeEventListener(d,u,{capture:!0})},u=()=>{var d;o.unlock(),((d=o.context)==null?void 0:d.state)==="running"&&l()};for(const d of i)window.addEventListener(d,u,{capture:!0});return l},[])}function c1e(){const[e,t]=g.useState(t1e),[n,s]=g.useState(()=>aX(nt(RT))),[a,o]=g.useState(()=>rX(nt(MT))),[i,l]=g.useState(()=>oX(nt(h3),n,Z0e)),[u,d]=g.useState(()=>new Set),[f,p]=g.useState(0);g.useEffect(()=>{st(xB,String(e))},[e]),g.useEffect(()=>{st(MT,a?"1":"0")},[a]),g.useEffect(()=>{st(RT,JSON.stringify(n))},[n]),g.useEffect(()=>{st(h3,i)},[i]);const m=g.useCallback((k,v=!1)=>{s(S=>{const C=S.find(_=>_.id===k.id);return C?!v||!k.radio||!C.radio||C.url===k.url&&JSON.stringify(C.radio)===JSON.stringify(k.radio)?S:S.map(_=>_.id===k.id?{..._,url:k.url,radio:k.radio}:_):[...S,k]}),d(S=>{if(!S.has(k.id))return S;const C=new Set(S);return C.delete(k.id),C})},[]),w=g.useCallback((k,v)=>{const S=v.trim();!S||S.length>dD||s(C=>C.map(_=>_.id===k?{..._,name:S}:_))},[]),x=g.useCallback(k=>{s(v=>v.filter(S=>S.id!==k)),l(v=>iX(v,k)),d(v=>{if(!v.has(k))return v;const S=new Set(v);return S.delete(k),S})},[]),b=g.useCallback((k,v=!1)=>{const S=$T(k),C=u.has(S);k===i&&!C&&!v||(C&&d(_=>{const R=new Set(_);return R.delete(S),R}),l(k),p(_=>_+1))},[i,u]),j=g.useCallback((k,v)=>{const S=$T(k);d(C=>{if(C.has(S)===v)return C;const R=new Set(C);return v?R.add(S):R.delete(S),R})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:a,setFmMuted:o,fmSource:i,customFmStations:n,unavailableFmStations:u,fmPlayRequest:f,addFmStation:m,renameFmStation:w,removeFmStation:x,pickFmSource:b,markFmStationAvailability:j}}function u1e(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||!ao())return;let x=!1;const b=l.current;return fetch("/api/desktop-update").then(j=>j.ok?j.json():null).then(j=>{if(x||l.current!==b)return;const k=$O(j);k&&n(k)}).catch(()=>{}),()=>{x=!0}},[e]);const u=lwe(t),d=g.useRef(!1),f=g.useRef(0),p=g.useRef(0);g.useEffect(()=>()=>window.clearTimeout(f.current),[]);const m=g.useCallback(async x=>{if(!_n(d.current))return;const b=++p.current;window.clearTimeout(f.current),d.current=!0,a(!0),i(null);const j=k=>{b===p.current&&(window.clearTimeout(f.current),d.current=!1,a(!1),i({failure:k,version:x}))};try{const k=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:x})});if(!k.ok)return j(uwe(await k.json().catch(()=>null)))}catch{return j("unreachable")}b===p.current&&(f.current=window.setTimeout(()=>j("timeout"),P8))},[]),w=g.useCallback(x=>{if(ao())try{const b=$O(JSON.parse(x));b&&(l.current++,n(b),b.status!=="ready"&&(p.current++,window.clearTimeout(f.current),d.current=!1,a(!1)))}catch{}},[]);return{desktopUpdateRestarting:s,desktopUpdateFailure:o,readyAppUpdate:u,appUpdate:t,askDesktopUpdateRestart:m,onDesktopUpdateEvent:w}}const Tf="agent-dag.autoRestart",m3="agent-dag.bundleReloadedFor";function d1e({now:e,stateRef:t,version:n,notice:s,noticeOpen:a,upgradeFailure:o,paused:i}){const[l,u]=g.useState(()=>nt(Tf)!=="0"),d=g.useRef(!1),f=g.useCallback(()=>{const U=!l;d.current=!0,vs(Tf),u(U),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:U})}).then(F=>F.ok?F.json():null).then(F=>{var M;F!=null&&F.ok&&u(((M=F.prefs)==null?void 0:M.autoUpdate)!==!1)}).catch(()=>{})},[l]),[p,m]=g.useState(!1),[w,x]=g.useState("restart"),[b,j]=g.useState(null),k=g.useRef(!1),v=g.useRef(null),S=g.useRef(0),C=g.useRef(null),_=g.useCallback(async U=>{if(!_n(k.current))return;const F=(U==null?void 0:U.upgrade)===!0,M=(U==null?void 0:U.whenIdle)===!0;k.current=!0,v.current=o;const B=++S.current,T=()=>{x(F?"npx":"restart"),m(!0)};M||T();try{window.sessionStorage.setItem("agent-dag.restartPending",(s==null?void 0:s.to)??"")}catch{}let P=!1;try{const q=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M?{upgrade:F,whenIdle:M}:{upgrade:F})});P=M&&q.status===409}catch{}if(P){k.current=!1,C.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}M&&T(),window.setTimeout(()=>{if(S.current===B&&k.current){k.current=!1,m(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},F?18e4:3e4)},[s==null?void 0:s.to,o]);g.useEffect(()=>{const U=IO(t.current.agents.values())>0,F=Ywe({enabled:l,kind:s==null?void 0:s.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:a,visible:document.visibilityState==="visible",busy:U,idleSince:C.current,now:e});C.current=F.idleSince,F.restart&&_({whenIdle:!0})},[l,s==null?void 0:s.kind,n==null?void 0:n.canRestart,a,e,_]);const R=IO(t.current.agents.values()),A=Kwe(R,i),I=H8({enabled:l,kind:s==null?void 0:s.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:a,visible:document.visibilityState==="visible",busy:R>0,idleSince:C.current,now:e});g.useEffect(()=>{const U=n==null?void 0:n.running;let F=null,M=null;try{F=window.sessionStorage.getItem("agent-dag.restartPending"),M=window.sessionStorage.getItem(m3)}catch{return}const B=Wwe({bundle:"3.49.0",running:U,pending:F,lastTried:M});if(B==="reload"){try{window.sessionStorage.setItem(m3,U??"")}catch{return}window.location.reload();return}if(B!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}k.current=!1,m(!1),j(U??null);const T=window.setTimeout(()=>j(null),6e3);return()=>window.clearTimeout(T)},[n==null?void 0:n.running]),g.useEffect(()=>{if(p&&zwe({asked:v.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}k.current=!1,m(!1)}},[p,o]);const $=g.useCallback(U=>{var F,M;if(!d.current){const B=nt(Tf)==="0";vs(Tf),B&&((F=U.prefs)==null?void 0:F.autoUpdate)!==!1?(u(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):u(((M=U.prefs)==null?void 0:M.autoUpdate)!==!1)}},[]);return{autoRestart:l,toggleAutoRestart:f,restarting:p,restartMode:w,restartedTo:b,askRestart:_,restartCopy:A,restartFuseMs:I,loadAutoRestartPrefs:$}}function h1e(){const[e,t]=g.useState([]),n=g.useRef(new Set),[s,a]=g.useState(null),[o,i]=g.useState(void 0);g.useEffect(()=>{let d=!0,f=0;const p=()=>{fetch("/api/lan").then(m=>m.ok?m.json():null).then(m=>d?(m!=null&&m.ok&&t(uR(Array.isArray(m.pending)?m.pending:[],m.aliases)),m):null).catch(()=>null).then(m=>{d&&(i(w=>m!=null&&m.ok?m:w===void 0?null:w),f=window.setTimeout(p,(m==null?void 0:m.enabled)===!0?yj:k6))})};return p(),()=>{d=!1,window.clearTimeout(f)}},[]);const l=g.useCallback(async(d,f)=>{if(!s){a(d);try{const m=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:d,fp:f})})).json().catch(()=>null);m&&Array.isArray(m.pending)?t(uR(m.pending,m.aliases)):t(w=>w.filter(x=>x.fp!==f))}catch{}finally{a(null)}}},[s]),u=g.useCallback(d=>{s||(n.current.add(d),t(f=>[...f]))},[s]);return{lanPending:e,lanDeferred:n,lanBusy:s,answerLanPair:l,deferLanPair:u,lanStatus:o}}const f1e=6e4;function p1e({enabled:e,lanStatus:t,now:n}){const[s,a]=g.useState(null),[o,i]=g.useState(()=>new Set),[l,u]=g.useState(null),d=g.useCallback(k=>{k!=null&&k.ok&&Array.isArray(k.accounts)&&a(k.accounts)},[]),f=g.useCallback(async k=>{try{const v=await fetch(`/api/claude-accounts${k?"?refresh=1":""}`);v.ok&&d(await v.json())}catch{}},[d]);g.useEffect(()=>{e&&f(!1)},[e,f]),g.useEffect(()=>{if(!e)return;let k=Date.now();const v=()=>{document.visibilityState!=="visible"||Date.now()-k<f1e||(k=Date.now(),f(!1))};return document.addEventListener("visibilitychange",v),window.addEventListener("focus",v),()=>{document.removeEventListener("visibilitychange",v),window.removeEventListener("focus",v)}},[e,f]);const p=g.useMemo(()=>e?pve(s,{lan:t,now:n,closed:o}):[],[e,s,t,n,o]),m=g.useRef(p);m.current=p;const w=g.useCallback(k=>{k.length&&i(v=>new Set([...v,...k]))},[]),x=g.useCallback(()=>{const k=m.current;k.length&&(w(k.map(v=>v.id)),fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reauth-later",incidents:k.map(v=>({key:v.key,since:v.since}))})}).catch(()=>{}))},[w]),b=g.useRef(l);b.current=l;const j=g.useCallback(k=>{const v=b.current;w(mve(v?[v,...m.current]:m.current,k))},[w]);return{rows:p,signingIn:l,observe:d,signIn:u,signedIn:j,refresh:g.useCallback(()=>{f(!0)},[f]),closeSignIn:g.useCallback(()=>u(null),[]),later:x}}const bB=288,m1e=bB;function g1e(e,t,n){return e?"session-list":t||n?"accounts":null}function g3(e){return e==="session-list"?m1e:e==="accounts"?bB:0}const y1e=240,w1e=20;function x1e(e){const t=g.useRef(0),n=g.useRef(e);return g.useLayoutEffect(()=>{n.current!==e&&(n.current=e,t.current=xd()?0:performance.now()+y1e+w1e)},[e]),t}const kB="agent-dag.sessionListOpen",jB="agent-dag.accountsPanelOpen";function v1e(){return nt(kB)==="1"}function b1e(e){st(kB,e?"1":"0")}function k1e(){const e=nt(jB);return e===null?!0:e==="1"}function j1e(){const e=g.useRef(!1),t=g.useRef(!1),[n,s]=g.useState(()=>{const x=v1e();return x&&z1()?(e.current=!0,!1):x});g.useEffect(()=>{if(n)e.current=!1;else if(e.current)return;b1e(n)},[n]);const a=g.useRef(!1),[o,i]=g.useState(()=>{const x=k1e();return x&&n?(a.current=!0,!1):x&&z1()?(t.current=!0,!1):x});g.useEffect(()=>{if(o)t.current=!1;else if(t.current)return;!o&&a.current||st(jB,o?"1":"0")},[o]),g.useEffect(()=>{!n&&a.current&&(a.current=!1,i(!0))},[n]);const l=g.useCallback(()=>{s(x=>(x||i(b=>(b&&(a.current=!0),!1)),!x))},[]),u=g.useCallback(()=>{a.current=!1,i(x=>(x||s(!1),!x))},[]),d=g.useCallback(()=>{a.current=!1,i(x=>(x||s(!1),!0))},[]),f=g.useCallback(()=>s(!1),[]),p=g.useCallback(()=>{a.current=!1,s(!1)},[]),m=g.useCallback(()=>i(!1),[]),w=g1e(n,o,a.current);return{sessionListOpen:n,accountsPanelOpen:o,panel:w,toggleSessionList:l,toggleAccountsPanel:u,openAccountsPanel:d,closeSessionList:f,closeSessionListToCanvas:p,closeAccountsPanel:m}}const NB="agent-dag.detailOpen",SB="agent-dag.usagePanelOpen",CB="agent-dag.systemPanelOpen";function N1e(){return nt(NB)==="1"}function S1e(e){st(NB,e?"1":"0")}function C1e(){const e=nt(SB);return e===null?!0:e==="1"}function _1e(e){st(SB,e?"1":"0")}function E1e(){const e=nt(CB);return e===null?!0:e==="1"}function T1e(e){st(CB,e?"1":"0")}function A1e(e=0){const[t,n]=g.useState(N1e);g.useEffect(()=>{S1e(t)},[t]);const[s,a]=g.useState(C1e);g.useEffect(()=>{_1e(s)},[s]);const o=g.useRef(!1),[i,l]=g.useState(()=>{const u=E1e();return u&&s&&(z1()||ree(e))?(o.current=!0,!1):u});return g.useEffect(()=>{if(i)o.current=!1;else if(o.current)return;T1e(i)},[i]),cn("usage-panel",s),cn("machine-panel",i),{detailOpen:t,setDetailOpen:n,usagePanelOpen:s,setUsagePanelOpen:a,machinePanelOpen:i,setMachinePanelOpen:l}}const R1e={permission:"your permission",asked:"your answer"},M1e="No sessions are waiting for you.";function $1e(e){if(e.length===0)return"";const[t,...n]=e,s=t.waiting.kind,a=n.every(i=>i.waiting.kind===s)?R1e[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 i1(e,t,n=M1e){return t!==""?t:e===""?"":n}function L1e({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[s,a]=g.useState(""),o=$1e(e);g.useEffect(()=>{a(m=>i1(m,o))},[o]);const[i,l]=g.useState(""),u=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";g.useEffect(()=>{l(m=>i1(m,u,"Browser watch has no unread findings."))},[u]);const[d,f]=g.useState(""),p=z0e(n);return g.useEffect(()=>{f(m=>i1(m,p,V0e))},[p]),{blockedSaid:s,watchSaid:i,setWatchSaid:l,incidentSaid:d}}const I1e="/icon-192.png",_B=Object.freeze({notifySwap:!0,notifyQuota:!1,notifyReset:!1,notifyStopped:!0});function y3(e){const t=n=>typeof(e==null?void 0:e[n])=="boolean"?e[n]:_B[n];return{notifySwap:t("notifySwap"),notifyQuota:t("notifyQuota"),notifyReset:t("notifyReset"),notifyStopped:t("notifyStopped")}}function O1e({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),[d,f]=g.useState(!1),[p,m]=g.useState(_B),w=g.useCallback(I=>{const $=!p[I];m(U=>({...U,[I]:$})),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[I]:$})}).then(U=>U.ok?U.json():null).then(U=>{U!=null&&U.ok&&m(y3(U.prefs))}).catch(()=>{})},[p]),x=g.useRef(()=>{}),b=g.useRef(new Set),j=Bn(e),k=g.useCallback(()=>{const I=!l;u(I),I&&(b.current=rf(j.current)),I&&typeof Notification<"u"&&Notification.permission==="default"&&x.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:I})}).then($=>$.ok?$.json():null).then($=>{var U;$!=null&&$.ok&&(u(((U=$.prefs)==null?void 0:U.notifications)===!0),f($.notificationsVetoed===!0))}).catch(()=>{})},[l]),v=typeof Notification<"u";g.useEffect(()=>{if(!o)return;const $=setTimeout(()=>i(null),o==="blocked"?8e3:4e3);return()=>clearTimeout($)},[o]);const S=g.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(I=>{const $=I;a($),$==="granted"?i("on"):$==="denied"&&i("blocked")})},[]);x.current=S;const C=g.useRef(null),_=e.map(I=>tm(I.id,I.waiting)).join("|");g.useEffect(()=>{RG(C.current,s)&&(C.current=s,b.current=rf(e))},[s]);const R=g.useRef(!1);g.useEffect(()=>{MG(R.current,t)&&(R.current=!0,b.current=rf(e))},[t]),g.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!$G(C.current,t))return;const I=typeof document>"u"||!document.hidden,$=TG(e,b.current,I,l);for(const U of $)try{const F=new Notification(U.title,{body:U.body,tag:U.key,icon:I1e});F.onclick=()=>{window.focus(),n(U.sessionId),F.close()}}catch{}b.current=I?rf(e):AG(e,$,b.current)},[_,t]);const A=g.useCallback(I=>{var $;u((($=I.prefs)==null?void 0:$.notifications)===!0),f(I.notificationsVetoed===!0),m(y3(I.prefs))},[]);return{notifyPermission:s,notifySaid:o,notifyOn:l,notifyVetoed:d,toggleNotify:k,notifySupported:v,askForNotifications:S,loadNotifyPrefs:A,accountNotify:p,toggleAccountNotify:w}}function P1e({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:s,summaryFor:a,browserWatchOpen:o,keyHelpOpen:i,releaseNotes:l,feedbackOpen:u,trafficRadarOpen:d=!1}){const f=Bn(i),p=g.useRef(!1);return p.current=e!=null||t||n!=null||s||a!=null||o||i||l!=null||u||d,{keyHelpOpenRef:f,modalOpenRef:p}}function D1e({stateRef:e,tourOpen:t,releaseNotes:n}){const[s,a]=g.useState(null),o=g.useCallback((M,B)=>a({agentId:M,toolId:B}),[]),[i,l]=g.useState(null),[u,d]=g.useState(null),f=g.useCallback(M=>d(M),[]),[p,m]=g.useState(!1),[w,x]=g.useState(!1),[b,j]=g.useState(!1),[k,v]=g.useState(!1),[S,C]=g.useState(!1),[_,R]=g.useState(null),A=g.useCallback(M=>{R(M??null),C(!0)},[]);cn("tool-detail",s!==null),cn("session-summary",i!==null),cn("context-window",u!==null),cn("keyboard-help",p),cn("usage-history",w),cn("browser-watch",b),cn("feedback",S);const I=s?bV(e.current.agents,s.agentId,s.toolId):null,$=u?e.current.agents.get(u):void 0,{keyHelpOpenRef:U,modalOpenRef:F}=P1e({openedTool:I,usageHistoryOpen:w,contextFor:u,tourOpen:t,summaryFor:i,browserWatchOpen:b,keyHelpOpen:p,releaseNotes:n,feedbackOpen:S,trafficRadarOpen:k});return{setOpenedToolKey:a,openTool:o,openedTool:I,summaryFor:i,setSummaryFor:l,contextFor:u,setContextFor:d,openContext:f,contextAgent:$,keyHelpOpen:p,setKeyHelpOpen:m,usageHistoryOpen:w,setUsageHistoryOpen:x,browserWatchOpen:b,setBrowserWatchOpen:j,trafficRadarOpen:k,setTrafficRadarOpen:v,feedbackOpen:S,setFeedbackOpen:C,feedbackPrefill:_,setFeedbackPrefill:R,openFeedback:A,keyHelpOpenRef:U,modalOpenRef:F}}function F1e({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:s,lastLayoutSigRef:a,forgetRemovals:o,clearSelection:i,rerender:l,modalOpenRef:u}){const[d,f]=g.useState(!1),p=g.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=lN(),t.current.clear(),n.current.clear(),s.current.clear(),a.current="",u8(),o(),i(),l()},[l,i,o]),m=Bn(d),w=g.useCallback(x=>{const b=Jwe(x,{confirmOpen:m.current,modalOpen:u.current});b==="confirm"?f(!0):b==="clear"&&(f(!1),p())},[p]);return{clearConfirmOpen:d,setClearConfirmOpen:f,requestClear:w}}const w3="agent-dag.oldNameNoticeDismissed";function B1e(e){const[t,n]=g.useState(()=>nt(w3)??""),s=e!=null&&e.invokedAs&&e.invokedAs!==Pt?e.invokedAs:null,a=s!=null&&t!==s,o=g.useCallback(()=>{s&&(n(s),st(w3,s))},[s]);return{oldName:s,oldNameOpen:a,dismissOldName:o}}const q1e=300*1e3,U1e=1800*1e3,W1e=8e3,H1e=3e4;function x3(e){return fetch("/api/rating",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}).catch(()=>null)}function z1e({modalOpenRef:e}){const t=g.useCallback(()=>ml({appModal:e.current,dialogDepth:ln.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 x=async()=>{if(u.current==="thanks"||u.current==="hidden"&&(document.hidden||t()))return;const k=await fetch("/api/rating").then(v=>v.ok?v.json():null).catch(()=>null);w||!k||s(v=>v==="thanks"?v:k.ask===!0?"asking":"hidden")},b=window.setTimeout(x,q1e),j=window.setInterval(x,U1e);return()=>{w=!0,window.clearTimeout(b),window.clearInterval(j)}},[t]),g.useEffect(()=>{if(n!=="thanks"||i)return;const w=a!==null&&a<=6?H1e:W1e;let x=0;const b=()=>{t()?x=window.setTimeout(b,w):s("hidden")};return x=window.setTimeout(b,w),()=>window.clearTimeout(x)},[n,a,i,t]);const d=g.useCallback(w=>{o(w),l(!1),s("thanks"),x3({score:w})},[]),f=g.useCallback(w=>l(w),[]),p=g.useCallback(()=>{s("hidden"),x3({later:!0})},[]),m=g.useCallback(()=>s("hidden"),[]);return{ratingPhase:n,ratingScore:a,answerRating:d,rateLater:p,closeRating:m,holdThanks:f}}function V1e({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:s}){const[a,o]=g.useState(()=>$ee(nt)),i=Bn(a),[l,u]=g.useState([]),d=g.useCallback(v=>{o(S=>{const C={...S,[v]:null};return i.current=C,C}),vs($u[v])},[]),f=g.useCallback((v,S)=>{const C=i.current[v];S&&C!==S||(d(v),t(_=>{const R={..._,[v]:{..._[v],figure:Qn}};return n.current=R,R}),st(wp[v],Qn))},[d]),p=Bn(f);g.useEffect(()=>{let v=!0;return Hee().then(S=>{if(!v)return;u(S);const C=new Set(S.map(_=>_.id));for(const _ of Lu){const R=i.current[_];R&&!C.has(R)&&p.current(_,R)}},()=>{}),()=>{v=!1}},[]);const m=g.useCallback((v,S)=>{if(!l.some(_=>_.id===S))return;const C={...i.current,[v]:S};i.current=C,o(C),st($u[v],S),s(v,!0)},[l,s]),w=g.useCallback(async v=>{var R;const S=G1(l.length);if(S)throw new Error(S);const C=window.AudioContext??window.webkitAudioContext;if(!C)throw new Error("This browser cannot decode audio files.");const _=new C;try{const A=await Fee(v,$=>_.decodeAudioData($));await kA(A);const I=od(A);u($=>[...$.filter(U=>U.id!==I.id),I])}finally{(R=_.close)==null||R.call(_)}},[l.length]),x=g.useCallback(async v=>{const S=G1(l.length);if(S)throw new Error(S);const C=Bee(v);await kA(C);const _=od(C);u(R=>[...R.filter(A=>A.id!==_.id),_])},[l.length]),b=g.useCallback(async(v,S)=>{const C=l.find(R=>R.id===v),_=S.trim().slice(0,80);!C||!_||_===C.name||(await Vee(v,_),u(R=>R.map(A=>A.id===v?{...A,name:_}:A)))},[l]),j=g.useCallback(async v=>{await Gee(v),u(R=>R.filter(A=>A.id!==v));const S=i.current,C=Lee(S,v);i.current=C,o(C);const _=Lu.filter(R=>S[R]===v);for(const R of _)vs($u[R]),st(wp[R],Qn);_.length>0&&t(R=>{const A={...R};for(const I of _)A[I]={...A[I],figure:Qn};return n.current=A,A})},[]),k=g.useCallback(v=>{var _,R;const S=Lu.find(A=>i.current[A]===v),C=S?n.current[S].level:pi;(_=e.current)==null||_.unlock(),(R=e.current)==null||R.previewCustom(v,C)},[]);return{customSelections:a,customSelectionsRef:i,customAssets:l,clearCustomOnly:d,fallbackCustomRef:p,selectCustomTone:m,importNotificationAudio:w,createNotificationVoice:x,renameCustomAsset:b,deleteCustomAsset:j,previewCustomAsset:k}}function G1e(e){const[t,n]=g.useState(()=>ate(nt)),s=Bn(t),a=g.useRef(null),o=g.useCallback((l,u=!1)=>{var d,f;if((d=e.current)==null||d.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)},ete)},[]),i=g.useCallback((l,u)=>{n(d=>{const f={level:gm(u.level??d[l].level),figure:t5(l,u.figure??d[l].figure)};return st(r5[l],String(f.level)),st(wp[l],f.figure),{...d,[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 K1e=15e3;function Y1e(e){return e.visibilityState==="visible"&&e.hasFocus()}function X1e(e,t){return t||e===!0}function Z1e(){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 J1e(){g.useEffect(()=>{const e=Z1e();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=Y1e(document);X1e(t,i)&&n(i),t=i},a=()=>{t&&n(!1),t=!1};s();const o=window.setInterval(s,K1e);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 Q1e({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 l1="agent-dag.versionNoticeDismissed",eje=15*6e4;function tje(e){const[t,n]=g.useState(null),[s,a]=g.useState(()=>nt(l1)??""),o=g.useRef(0),[i,l]=g.useState(!1),u=g.useCallback((b=!1)=>(b&&(o.current=Date.now(),l(!0)),fetch(b?"/api/version?refresh=1":"/api/version").then(j=>j.ok?j.json():null).then(j=>(j&&n(j),j??null)).catch(()=>null).finally(()=>{b&&l(!1)})),[]),d=g.useCallback(()=>{u(Date.now()-o.current>=eje)},[u]);g.useEffect(()=>{u();const b=window.setInterval(d,5*6e4),j=()=>{document.visibilityState==="visible"&&d()};return document.addEventListener("visibilitychange",j),()=>{window.clearInterval(b),document.removeEventListener("visibilitychange",j)}},[u,d]),g.useEffect(()=>{e&&u()},[e,u]);const f=(t==null?void 0:t.notice)??null,p=q8(f),m=mwe(f,s),w=g.useCallback(()=>{a(""),st(l1,"")},[]),x=g.useCallback(()=>{f&&(a(p),st(l1,p))},[f,p]);return{version:t,notice:f,noticeOpen:m,showNotice:w,dismissNotice:x,versionChecking:i,loadVersion:u}}function nje({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 d=g.useRef(!1);g.useEffect(()=>{if(d.current)return;const j=gr(),k=Ove(j),v=Uve({stored:k,running:(e==null?void 0:e.running)??null,notes:WO,remembers:Pve(j)});if(v.reason==="no-version")return;d.current=!0,v.record&&Dve(j,v.record);let S=!0;return(async()=>{var I;let _=Fve(j);if(ao())try{const $=await fetch("/api/prefs");if(!$.ok)throw new Error("desktop tour preferences unavailable");const U=await $.json();if(!(U!=null&&U.ok))throw new Error("desktop tour preferences unavailable");const F=((I=U.prefs)==null?void 0:I.tourSeen)===!0;_&&!F&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),_=_||F}catch{_=!0}if(!S)return;const R=qve({tourSeen:_,decision:v}),A=v.show.length?{entries:v.show,since:k,firstRun:!1}:null;R.tour&&s(!0),R.notes==="now"?i(A):R.notes==="after"&&(a.current=A)})(),()=>{S=!1}},[e==null?void 0:e.running]);const f=(e==null?void 0:e.running)??"3.49.0",p=g.useMemo(()=>sB(WO,null,f),[f]),m=g.useCallback(()=>{i({entries:p,since:null,firstRun:!1})},[p]),w=g.useCallback(()=>s(!0),[]),x=g.useCallback(()=>i(null),[]),b=g.useCallback(()=>{s(!1),Bve(gr()),ao()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const j=a.current;a.current=null,j&&i(j)},[]);return{tourOpen:n,openTour:w,closeTour:b,releaseNotes:o,closeReleaseNotes:x,chipVersion:f,openReleaseNotes:m}}function sje(){const[e,t]=g.useState(void 0),[n,s]=g.useState(!1),a=g.useRef(!1);return a.current=e===!0&&!n,g.useEffect(()=>b0e(()=>a.current),[]),{loadReportsPrefs:g.useCallback(i=>{var l;t(((l=i.prefs)==null?void 0:l.reports)!==!1),s(i.reportsVetoed===!0)},[])}}function rje(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 d,f;const u=l!==!0;return st("agent-dag.sound",u?"on":"off"),u?(d=e.current)==null||d.unlock():(f=e.current)==null||f.silence(),u})},[]),a=g.useCallback(l=>{s()},[s]),o=Bn(a),i=Bn(t);return{soundOn:t,toggleSound:s,activateSoundRef:o,soundOnRef:i}}function aje(){const[e,t]=g.useState(mee),n=g.useCallback((o,i)=>{t(l=>gee(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 oje="agent-dag.autoFitDisabled";function ije(e){const t=g.useRef(!1),[n,s]=g.useState(!1);g.useEffect(()=>{vs(oje)},[]);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 lje(){return r.jsx(iN,{children:r.jsx(N0e,{children:r.jsx(cje,{})})})}function cje(){var $c;const e=Ql(),t=g.useState(lN)[0],n=g.useRef(t),[,s]=g.useState(0),a=g.useCallback(()=>s(dt=>dt+1),[]),{sessionListOpen:o,accountsPanelOpen:i,panel:l,toggleSessionList:u,toggleAccountsPanel:d,openAccountsPanel:f,closeSessionList:p,closeSessionListToCanvas:m,closeAccountsPanel:w}=j1e(),{detailOpen:x,setDetailOpen:b,usagePanelOpen:j,setUsagePanelOpen:k,machinePanelOpen:v,setMachinePanelOpen:S}=A1e(g3(l)),{selectedIds:C,primarySelectedId:_,selectAgent:R,clearSelection:A,pruneSelectionToBoard:I}=kde(n,b),$=bl(i,200),U=bl(o,200),F=YE(o,U),M=bl(j,130),B=bl(v,130),T=g.useRef(null),P=rje(T),{activateSoundRef:q,soundOnRef:K}=P,z=G1e(T),{setTonePrefs:H,tonePrefsRef:D,previewTone:O}=z,V=V1e({chimesRef:T,setTonePrefs:H,tonePrefsRef:D,previewTone:O}),{customSelectionsRef:Z,fallbackCustomRef:W}=V,X=aje(),{openSettings:Y}=X;l1e({chimesRef:T,soundOnRef:K,tonePrefsRef:D,customSelectionsRef:Z,fallbackCustomRef:W});const J=_0e(n),{pauseGate:Q,paused:te,togglePause:le}=J,de=g.useRef(()=>{}),{live:oe,tabCapped:re,everConnected:he,liveSince:fe}=hde({stateRef:n,rerender:a,pauseGate:Q,chimesRef:T,desktopUpdateRef:de}),$e=tje(oe),{version:ye,notice:ge,noticeOpen:je,loadVersion:Le}=$e,ke=u1e(oe),{readyAppUpdate:Ie,onDesktopUpdateEvent:De}=ke;de.current=De,J1e();const Ue=nje({version:ye,readyAppUpdate:Ie}),{tourOpen:Ke,openTour:we,releaseNotes:Fe}=Ue,{workspace:Re,providers:Ae,providersRef:rt}=T0e(oe),We=g3(l==="accounts"&&!Ae.claude?null:l),se=x1e(We),be=YE(i,$)&&Ae.claude,[Te,Oe]=g.useState(!1),ve=g.useCallback(()=>{f(),Oe(!0)},[f]);g.useEffect(()=>{i||Oe(!1)},[i]);const pe=g.useCallback(()=>Oe(!1),[]),_e=B1e(ye),ze=G0e({version:ye,loadVersion:Le}),{upgradeFailure:at}=ze,tt=D1e({stateRef:n,tourOpen:Ke,releaseNotes:Fe}),xt=z1e({modalOpenRef:tt.modalOpenRef}),{openTool:Mt,setSummaryFor:Xt,setContextFor:tr,openContext:Cs,setKeyHelpOpen:zn,setUsageHistoryOpen:ts,setBrowserWatchOpen:_s,keyHelpOpenRef:sn,modalOpenRef:zt}=tt,Me=sje(),Ve=Y0e(),{watchOn:Xe,watchUnseen:Tt}=Ve,Ct=Id(),[qt,Vn]=g.useState(null),[nr,Es]=g.useState(!1),gn=g.useCallback(()=>Es(!1),[]),_r=dt=>{Kye(dt),Y("integrations")},ga=dt=>{dt&&MO(dt),Y("integrations")},Er=g.useCallback(()=>Vn(null),[]),Ts=zS().filter(dt=>Rj(Ct,dt.kind)),Tr=Bn(dt=>{const Br=Ts.find(fg=>fg.kind===dt);Br&&Vn(Br.kind)}),ya=g.useCallback(dt=>{MO(dt),Y("integrations")},[Y]),Ar=Ts.length>0;g.useEffect(()=>{Ar&&Oye()},[Ar]);const Rr=h1e(),[ho,yt]=g.useState(0),{presentCats:wa,hiddenCats:ns,toggleCat:xa,catBarRef:As,catBarOccluded:Mr}=o1e(n),sr=g.useRef(null),[Rs,dn]=g.useState(0),$t=jde({stateRef:n,rerender:a,pruneSelectionToBoard:I,setContextFor:tr,setSummaryFor:Xt});SY({stateRef:n,now:$t,enabled:Ae.claude});const yn=$0e(Ae.claude||Ae.codex),xe=H0e(yn,$t),Qe=p1e({enabled:Ae.claude,lanStatus:Rr.lanStatus,now:$t}),ut=d1e({now:$t,stateRef:n,version:ye,notice:ge,noticeOpen:je,upgradeFailure:at,paused:J.paused}),{askRestart:Lt,loadAutoRestartPrefs:ss}=ut,Rn=a1e(),{setTheme:$r,palette:Pd}=Rn,ki=c1e(),Ms=jme(),{applyViewport:Dd,moveCamera:pc,fitLeft:rr,cameraEpochRef:Xm,lastFitTimeRef:ji}=Ms,ct=Pme(Ms),{pinnedRef:fo,positionsRef:po,lastLayoutSigRef:mc,handleRelayout:gc,rearrangeUndo:Fd}=ct,yc=g.useRef(null),Ni=g.useRef(()=>{}),mo=fe!==null,$s=g.useRef(0),Ls=g.useCallback(()=>{$s.current=Date.now()},[]),{canvasRef:hn,canvasSize:go,paneSizeRef:yo}=Sge(se),Is=ije(rr),{autoFitDisabledRef:Bd,disableAutoFit:Si}=Is,Lr=g.useRef(!1),{measuredRef:Ir,measuredVersionRef:qd,sizeVersion:Ci,domSizeVersion:Ud}=Cge(Lr),{removedNodes:wc,removedAgentIds:rs,removeNode:wo,removeSelectedNode:Or,removalNotice:xo,hideSessions:Zm,bringBack:xc,bringBackAll:vc,forgetRemovals:_i}=sge({stateRef:n,pinnedRef:fo,positionsRef:po,returningRef:ct.returningRef,canvasRef:hn,clearSelection:A,primarySelectedId:_});pge({stateRef:n,removedNodes:wc,hideSessions:Zm,ready:mo,keepSessionId:_?(($c=n.current.agents.get(_))==null?void 0:$c.sessionId)??_:null});const vo=Jme({stateRef:n,now:$t,removedAgentIds:rs,sizeVersion:Ci,domSizeVersion:Ud});Dme(vo,ct),nge({layoutSig:vo,rf:e,stateRef:n,measuredRef:Ir,pinnedRef:fo,positionsRef:po,paneSizeRef:yo,lastInteractRef:$s,autoFitDisabledRef:Bd,lastFitTimeRef:ji,fitLeft:rr});const bc=_ge(),{bubbling:ar,endBubble:kc,onBubble:Ei}=Zue(),[Ti,Ai]=g.useState(!1),bo=Yue(),{beginTrashDrag:Wd,trackTrashDrag:kn,endTrashDrag:va}=bo,Ri=rde({stateRef:n,measuredRef:Ir,measuredVersionRef:qd,canvasRef:hn}),{lodRef:ko,applyZoom:Jm}=Ri,Mi=kge({applyViewport:Dd,lastFitTimeRef:ji,cameraEpochRef:Xm,disableAutoFit:Si,markInteract:Ls,canvasRef:hn,applyZoom:Jm}),Pr=_?n.current.agents.get(_):null,Dr=x&&Pr!=null,Os=Rge({sessionListShown:F,usageShown:Ya(M),machineShown:Ya(B),accountsShown:be,detailShown:Dr,primarySelectedId:_,canvasRef:hn}),{railInsetRef:jo,availableWidth:Hd,availableHeight:zd}=wme({canvasRef:hn,canvasSize:go,machinePhase:B,usagePhase:M,usagePanelOpen:j,detailShown:Dr}),Vd=Qme({stateRef:n,now:$t,availableWidth:Hd,availableHeight:zd,layout:ct,measuredRef:Ir,onBubble:Ei,settled:bc,dragging:Ti,layoutSig:vo,selectedIds:C,openContext:Cs,historyReplayed:mo,removedNodes:wc,removedAgentIds:rs,dragTick:ho,dragPatchRef:sr,dragMoveTick:Rs}),{nodes:No,edges:Qm}=Vd,jc=Bn(_);Fme({nodes:No,edges:Qm,settled:bc,dragging:Ti,availableWidth:Hd,availableHeight:zd,layout:ct,camera:Ms,rf:e,measuredRef:Ir,stateRef:n,lastFocusRef:yc,primarySelectedIdRef:jc,focusAgentRef:Ni,autoFitDisabledRef:Bd});const Gd=F1e({stateRef:n,pinnedRef:fo,measuredRef:Ir,positionsRef:po,lastLayoutSigRef:mc,forgetRemovals:_i,clearSelection:A,rerender:a,modalOpenRef:zt}),{requestClear:Nc}=Gd,eg=Mge({nodes:No,stateRef:n,pinnedRef:fo,positionsRef:po,draggingRef:Lr,dragPatchRef:sr,setDragging:Ai,setDragMoveTick:dn,setDragTick:yt,endBubble:kc,markInteract:Ls,disableAutoFit:Si,beginTrashDrag:Wd,trackTrashDrag:kn,endTrashDrag:va,removeNode:wo}),Sc=g.useCallback(()=>rr(500),[rr]),Cc=Bn(No),{focusAgent:$i,stepAgent:tg,focusSession:ba}=Sme({canvasRef:hn,stateRef:n,measuredRef:Ir,nodesRef:Cc,railInsetRef:jo,moveCamera:pc,disableAutoFit:Si,lastFocusRef:yc,focusAgentRef:Ni,selectAgent:R,primarySelectedIdRef:jc}),_c=jge({clearSelection:A,selectAgent:R,detailOpen:x,setDetailOpen:b,detailShown:Dr,focusAgent:$i,draggingRef:Lr,lodRef:ko}),ng=Cme({nodesRef:Cc,stateRef:n,canvasRef:hn,railInsetRef:jo}),sg=Bn(Or),Ec=g.useRef(null),So=g.useCallback(dt=>{rs.has(dt)&&xc([dt]),ba(dt)},[rs,xc,ba]),rg=Ege(),[ag,Tc]=g.useState(!1),Kd=g.useCallback(()=>Tc(!0),[]),og=g.useCallback(()=>Tc(!1),[]),ig=g.useCallback(dt=>{Tc(!1),dt.run()},[]),lg=An();Tge({pointerFocusRef:rg,nodesRef:Cc,stateRef:n,primarySelectedIdRef:jc,providersRef:rt,soundOnRef:K,keyHelpOpenRef:sn,modalOpenRef:zt,waitingCursorRef:Ec,removeSelectedRef:sg,activateSoundRef:q,clearSelection:A,selectAgent:R,focusAgent:$i,stepAgent:tg,focusSession:ba,requestClear:Nc,handleRelayout:gc,undoRearrange:Fd.undo,handleFit:Sc,togglePause:le,toggleSessionList:u,toggleAccountsPanel:d,setDetailOpen:b,setUsageHistoryOpen:ts,setUsagePanelOpen:k,setMachinePanelOpen:S,setBrowserWatchOpen:_s,setKeyHelpOpen:zn,setTheme:$r,openSettings:Y,openIntegrationRef:Tr,openQuickOpen:Kd});const Co=n.current.agents.size,as=g.useMemo(()=>T1(n.current.agents.values()),[n.current,n.current.revision]);rge({stateRef:n,waitingSessions:as,removedAgentIds:rs,removedNodes:wc,bringBack:xc}),xge({stateRef:n,waitingSessions:as,live:oe});const Yd=L1e({waitingSessions:as,watchUnseen:Tt,incidents:xe}),Li=O1e({waitingSessions:as,liveSince:fe,focusSession:ba}),{loadNotifyPrefs:Xd}=Li;Q1e({loadAutoRestartPrefs:ss,loadNotifyPrefs:Xd,loadReportsPrefs:Me.loadReportsPrefs});const or=lc(mm),[Zd,Ac]=g.useState(!1),[Fr,Rc]=g.useState(null),cg=g.useCallback(()=>Rc(null),[]),ug=g.useCallback(dt=>{const Br=n.current.agents.get(dt);return Br?Br.label||Br.cwdBasename||"session":null},[]),Jd=g.useCallback(dt=>{Rc(null),So(dt)},[So]),Qd=g.useCallback(()=>Ac(!1),[]),[ka,ja]=g.useState(null),dg=g.useCallback(()=>ja(null),[]),Ut=Zge({providers:Ae,sessionListOpen:o,toggleSessionList:u,accountsPanelOpen:i,toggleAccountsPanel:d,usagePanelOpen:j,setUsagePanelOpen:k,machinePanelOpen:v,setMachinePanelOpen:S,setUsageHistoryOpen:ts,watchOn:Xe,watchUnseen:Tt,setBrowserWatchOpen:_s,setTrafficRadarOpen:tt.setTrafficRadarOpen,openSettings:Y,onFeedback:tt.openFeedback,setRadioOpen:Ac,openToolActivity:Rc,openCapacity:ja,toggles:Os.toggles,integrations:Ts.map(dt=>({provider:dt,onPress:()=>Vn(dt.kind)})),openExploreIntegrations:()=>Es(!0),openQuickOpen:Kd}),[hg,eh]=g.useState(0),Ii=g.useCallback(dt=>{So(dt),or&&m()},[So,or,m]),Mc=g.useCallback(()=>{o||u(),requestAnimationFrame(()=>{var dt;return(dt=document.querySelector("#session-list .sl-row"))==null?void 0:dt.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(KJ,{}),r.jsx(Cwe,{versionCheck:$e,welcome:Ue,desktopUpdate:ke,pause:J,announcements:Yd,notify:Li,waitingSessions:as,waitingCursorRef:Ec,focusSession:ba,live:oe,now:$t,incidents:xe,queueNamed:or?0:hg}),!or&&r.jsx(jwe,{waitingSessions:as,waitingCursorRef:Ec,focusSession:ba,now:$t,onFit:eh,onMore:Mc}),Pr&&r.jsx(_we,{selected:Pr,now:$t,selectedIds:C,focusAgent:$i,clearSelection:A}),!or&&r.jsx("div",{className:"actions",children:r.jsx(dee,{items:[Ut.search,...Ut.utilities]})})]}),or?r.jsx(uee,{items:[...Ut.left,...Ut.right[0],Ut.utilities[0]],more:[Ut.search,...Ut.capacity,...Ut.right.slice(1).flat(),...Ut.integrations,...Ut.explore,Ut.utilities[1]]}):r.jsx(pA,{side:"left",label:"Accounts and sessions",groups:[...Ut.leftStripe,Ut.integrations,Ut.explore]}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:xo?`${xo.label} removed from the board.`:""}),r.jsx(Zwe,{restart:ut,versionCheck:$e,upgrade:ze,oldNameNotice:_e,rating:xt,onFeedback:tt.openFeedback,everConnected:he,live:oe,paused:te}),(F||be)&&r.jsxs(Uue,{width:We,children:[be&&r.jsx(Sue,{leaving:XE(i,$),onReport:tt.openFeedback,onRoster:Qe.observe,onClose:()=>{Os.accounts(),w()},lanWanted:Te,onLanShown:pe}),F&&r.jsx(iQ,{leaving:XE(o,U),state:n.current,now:$t,selectedIds:C,onSelect:Ii,onClose:()=>{Os.sessionList(),p()},removedIds:rs,onBringBackAll:vc})]}),r.jsxs(Mwe,{canvasRef:hn,bubbling:ar,dragging:Ti,trash:bo,zoom:Ri,viewport:Mi,stateRef:n,peek:ng,children:[Co===0&&(!oe&&re?r.jsx(Lge,{reservedRight:jo.current}):r.jsx(Ige,{live:oe,everConnected:he,providers:Ae,workspace:Re,onTour:we,reservedRight:jo.current})),(wa.length>1||ns.size>0)&&r.jsx(Ewe,{catBarRef:As,catBarOccluded:Mr,presentCats:wa,hiddenCats:ns,toggleCat:xa}),r.jsx(GJ,{graph:Vd,layout:ct,viewport:Mi,clicks:_c,drag:eg,appearance:Rn,fm:ki,radioOpen:Zd,onRadioClose:Qd,autoFit:Is,pause:J,stateRef:n,measuredRef:Ir,hiddenCats:ns,now:$t,openTool:Mt,focusAgent:$i,requestClear:Nc,setKeyHelpOpen:zn})]}),!or&&r.jsx(pA,{side:"right",label:"Usage and activity",groups:Ut.right}),Fr&&r.jsx(Rne,{view:Fr,onClose:cg,sessionLabel:ug,onOpenSession:Jd}),ka&&r.jsx(que,{view:ka,onClose:dg}),qt&&r.jsx(Fye,{kind:qt,connections:na(Ct,qt)?Op(Ct,qt):[],onClose:Er,onReconnect:ya}),nr&&r.jsx(ewe,{integrations:Ct,onClose:gn,onOpen:Vn,onConnect:_r,onManage:ga}),ag&&r.jsx(WQ,{onClose:og,onRun:ig,items:Ete({rails:Ut,sessions:LD(n.current),now:$t,openSession:Ii,settings:i5(Ae.claude,GS(Ct),Od(Ct)),openSettings:Y,singleKeys:lg,fit:Sc,rearrange:gc,paused:te,togglePause:le,clear:Co>0?()=>Nc("button"):void 0,keyHelp:()=>zn(!0),tour:we,theme:Rn.theme,setTheme:$r})}),Ya(M)&&r.jsx(tre,{state:n.current,now:$t,providers:Ae,incidents:xe,liveSince:fe,leaving:M==="leaving",onClose:()=>{Os.usage(),k(!1)}}),Ya(B)&&r.jsx(Pre,{usageOpen:j,leaving:B==="leaving",onClose:()=>{Os.machine(),S(!1)}}),x&&Pr?r.jsx(Yge,{selected:Pr,now:$t,openTool:Mt,setSummaryFor:Xt,stateRef:n,removeSelectedNode:Or,onClose:()=>{Os.detail(),b(!1)}}):null,r.jsx(r0e,{dialogs:tt,welcome:Ue,desktopUpdate:ke,versionCheck:$e,restart:ut,upgrade:ze,lanPairs:Rr,attention:Qe,clearFlow:Gd,watchBadge:Ve,announcements:Yd,appearance:Rn,providers:Ae,stateRef:n,agentCount:Co,menus:X,sound:P,tones:z,customTones:V,notify:Li,panelDoors:{accounts:f,localNetwork:ve}})]})}try{yK(window.localStorage)}catch{}const uje=Lq.createRoot(document.getElementById("root"));window.ccdeckWindow&&(document.documentElement.dataset.desktopChrome="true",document.documentElement.dataset.desktopPlatform=window.ccdeckWindow.platform);uje.render(r.jsx(lje,{}));export{Cje as $,ac as A,xje as B,vt as C,Tu as D,Zl as E,Mje as F,L5 as G,gae as H,wr as I,lt as J,tj as K,IA as L,nj as M,gje as N,St as O,Qa as P,ea as Q,A5 as R,yje as S,rp as T,wje as U,fd as V,Hn as W,Pee as X,Sje as Y,Eje as Z,zve as _,vs as a,_je as a0,Hve as a1,Tje as a2,cm as a3,me as a4,fi as a5,eo as a6,OZ as a7,$je as a8,MN as a9,Gl as aa,yX as ab,mje as ac,fje as ad,pje as ae,um as af,JG as ag,Fbe as ah,X0e as ai,hje as aj,PZ as ak,g as b,jje as c,qn as d,op as e,$8 as f,Uo as g,io as h,Nje as i,r as j,pS as k,LP as l,ln as m,gt as n,wt as o,xd as p,kje as q,nt as r,_n as s,bje as t,lc as u,cn as v,st as w,Rje as x,Aje as y,vje as z};
|
|
321
|
+
`)}}function H0e(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>W0e(n,t)).filter(n=>n!==null)}function z0e(e){return e.map(t=>`${t.name}'s status page reports ${t.state.endsWith("outage")?`a ${t.words}`:t.words}.`).join(" ")}const V0e="The providers' status pages report no incident.";function G0e({version:e,loadVersion:t}){var d;const[n,s]=g.useState(!1),a=((d=e==null?void 0:e.upgrade)==null?void 0:d.state)??"idle",o=Hwe(e==null?void 0:e.upgrade),i=g.useRef(!1),l=g.useCallback(async()=>{if(_n(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 io(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 d3="agent-dag.browserWatch.seenMs";function K0e(e,t){return e.filter(n=>n.startMs>t)}function Y0e(){const[e,t]=g.useState(()=>Number(nt(d3))||0),[n,s]=g.useState([]),[a,o]=g.useState(!1);g.useEffect(()=>{let u=!0;const d=()=>{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(()=>{})};d();const f=setInterval(d,5*6e4);return()=>{u=!1,clearInterval(f)}},[]);const i=g.useMemo(()=>K0e(n,e).length,[n,e]),l=g.useCallback(u=>{t(u),st(d3,String(u))},[]);return{watchOn:a,setWatchOn:o,watchUnseen:i,markWatchSeen:l}}const wB="agent-dag.character-enabled",xB="agent-dag.fm-volume",X0e=1,h3="agent-dag.fm-source",$je=[{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 Z0e(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 J0e(e){return e!=="0"}function Q0e(){return J0e(nt(wB))}function e1e(e){return s5(e,X0e)}function t1e(){return e1e(nt(xB))}const vB=["--err","--inflight","--ok","--warn","--muted","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function f3(e){const t={};for(const n of vB)t[n]=e(n);return t}function n1e(e){return t=>e[t]??""}function s1e(e,t){return vB.every(n=>e[n]===t[n])}function r1e(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 d=e.startViewTransition(u);n=d,d.ready.catch(()=>{}),d.updateCallbackDone.catch(()=>{u()}),d.finished.then(()=>{n===d&&(n=null,delete e.documentElement.dataset.themeTransition)},()=>{n===d&&(u(),n=null,delete e.documentElement.dataset.themeTransition)})}catch{delete e.documentElement.dataset.themeTransition,u()}}}}function p3(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function a1e(){const[e,t]=g.useState(Hte),[n,s]=g.useState(zte),[a,o]=g.useState(dte),i=g.useRef(a),[l]=g.useState(()=>r1e(document,()=>{try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!0}})),u=g.useCallback(k=>{const v=typeof k=="function"?k(i.current):k;v!==i.current&&(i.current=v,l.run(()=>vt.flushSync(()=>o(v))))},[l]);g.useEffect(()=>()=>l.cancel(),[l]);const[d,f]=g.useState(Q0e),[p,m]=g.useState(kee),[w,x]=g.useState(()=>f3(p3)),b=g.useMemo(()=>n1e(w),[w]),j=g.useCallback(k=>Kme(k,b),[b]);return g.useEffect(()=>{document.documentElement.dataset.textSize=e,st(Z1,e)},[e]),g.useEffect(()=>{document.documentElement.dataset.density=n,st(J1,n)},[n]),g.useEffect(()=>{const k=v=>{v.storageArea===gr()&&((v.key===Z1||v.key===null)&&t(KN(v.newValue)),(v.key===J1||v.key===null)&&s(m5(v.newValue)))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),g.useLayoutEffect(()=>{document.documentElement.dataset.theme=a,document.documentElement.dataset.colorScheme=ic[a].colorScheme,st(a5,a),x(k=>{const v=f3(p3);return s1e(k,v)?k:v})},[a]),g.useEffect(()=>{st(wB,d?"1":"0")},[d]),g.useEffect(()=>{st(YD,p)},[p]),g.useEffect(()=>{const k=document.querySelector('meta[name="theme-color"]'),v=w["--panel"];k&&v&&k.setAttribute("content",v)},[w]),{textSize:e,setTextSize:t,density:n,setDensity:s,theme:a,setTheme:u,characterEnabled:d,setCharacterEnabled:f,character:p,setCharacter:m,palette:w,minimapNodeFill:j}}function o1e(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 d of e.current.agents.values())for(const f of d.tools)u.add(j8(f.name));return Object.keys(k8).filter(d=>u.has(d))},[e.current,e.current.revision]);g.useEffect(()=>{if(i.length<=1){s(!1);return}let u=0;const d=()=>{const f=t.current;if(f&&!document.hidden){const p=f.getBoundingClientRect(),m=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(x=>x.getBoundingClientRect()),w=aQ(p,m,8);s(x=>x===w?x:w)}u=window.setTimeout(d,300)};return d(),()=>window.clearTimeout(u)},[i.length]);const l=g.useCallback(u=>{o(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]);return{presentCats:i,hiddenCats:a,toggleCat:l,catBarRef:t,catBarOccluded:n}}function i1e(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,x=w.figure){if(!n||n.state!=="running")return!1;const b=K1(m,x),j=Xee(w.level,b),k=n.currentTime;for(const v of b.notes){const S=n.createOscillator(),C=n.createGain();S.type=b.type??"sine",S.frequency.value=v.hz;const _=k+v.at,R=_+v.ms/1e3;C.gain.setValueAtTime(NA,_),C.gain.exponentialRampToValueAtTime(j,_+Zee),C.gain.exponentialRampToValueAtTime(NA,R),S.connect(C).connect(n.destination),S.start(_),S.stop(R+.02)}return!0}async function u(m,w){var j;if(!e.loadCustom)return"unavailable";let x;try{x=await e.loadCustom(m)}catch{return"unavailable"}if(!x)return"missing";if(x.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const k=new SpeechSynthesisUtterance(x.text),v=window.speechSynthesis.getVoices();k.voice=v.find(S=>S.voiceURI===x.voiceURI)??null,k.rate=x.rate,k.pitch=x.pitch,k.volume=Jee(w.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(k),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let b;try{b=await n.decodeAudioData(x.bytes.slice(0))}catch{return"broken"}try{const k=n.createBufferSource(),v=n.createGain();return k.buffer=b,v.gain.setValueAtTime(Qee(x.normalizationGain,w.level),n.currentTime),k.connect(v).connect(n.destination),s.add(k),(j=k.addEventListener)==null||j.call(k,"ended",()=>s.delete(k)),k.start(n.currentTime),"played"}catch{return"unavailable"}}function d(m,w=!1){var j,k;if(!w&&!e.enabled())return!1;const x=ote((j=e.prefs)==null?void 0:j.call(e),m),b=((k=e.customSelection)==null?void 0:k.call(e)[m])??null;return b&&e.loadCustom?(u(b,x).then(v=>{var S;v==="played"||v==="locked"||((v==="missing"||v==="broken")&&((S=e.onCustomFailure)==null||S.call(e,m,b)),l(m,{...x,figure:Qn},Qn))}),!0):!n||n.state!=="running"?!1:l(m,x)}function f(m,w=pi){return u(m,{level:gm(w),figure:Qn}),!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:d,previewCustom:f,silence:p,state:a,get context(){return n}}}function l1e({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:s,fallbackCustomRef:a}){g.useEffect(()=>{const o=i1e({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>s.current,loadCustom:zee,onCustomFailure:(d,f)=>a.current(d,f)});e.current=o;const i=["pointerdown","pointerup","keydown"],l=()=>{for(const d of i)window.removeEventListener(d,u,{capture:!0})},u=()=>{var d;o.unlock(),((d=o.context)==null?void 0:d.state)==="running"&&l()};for(const d of i)window.addEventListener(d,u,{capture:!0});return l},[])}function c1e(){const[e,t]=g.useState(t1e),[n,s]=g.useState(()=>aX(nt(RT))),[a,o]=g.useState(()=>rX(nt(MT))),[i,l]=g.useState(()=>oX(nt(h3),n,Z0e)),[u,d]=g.useState(()=>new Set),[f,p]=g.useState(0);g.useEffect(()=>{st(xB,String(e))},[e]),g.useEffect(()=>{st(MT,a?"1":"0")},[a]),g.useEffect(()=>{st(RT,JSON.stringify(n))},[n]),g.useEffect(()=>{st(h3,i)},[i]);const m=g.useCallback((k,v=!1)=>{s(S=>{const C=S.find(_=>_.id===k.id);return C?!v||!k.radio||!C.radio||C.url===k.url&&JSON.stringify(C.radio)===JSON.stringify(k.radio)?S:S.map(_=>_.id===k.id?{..._,url:k.url,radio:k.radio}:_):[...S,k]}),d(S=>{if(!S.has(k.id))return S;const C=new Set(S);return C.delete(k.id),C})},[]),w=g.useCallback((k,v)=>{const S=v.trim();!S||S.length>dD||s(C=>C.map(_=>_.id===k?{..._,name:S}:_))},[]),x=g.useCallback(k=>{s(v=>v.filter(S=>S.id!==k)),l(v=>iX(v,k)),d(v=>{if(!v.has(k))return v;const S=new Set(v);return S.delete(k),S})},[]),b=g.useCallback((k,v=!1)=>{const S=$T(k),C=u.has(S);k===i&&!C&&!v||(C&&d(_=>{const R=new Set(_);return R.delete(S),R}),l(k),p(_=>_+1))},[i,u]),j=g.useCallback((k,v)=>{const S=$T(k);d(C=>{if(C.has(S)===v)return C;const R=new Set(C);return v?R.add(S):R.delete(S),R})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:a,setFmMuted:o,fmSource:i,customFmStations:n,unavailableFmStations:u,fmPlayRequest:f,addFmStation:m,renameFmStation:w,removeFmStation:x,pickFmSource:b,markFmStationAvailability:j}}function u1e(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||!ao())return;let x=!1;const b=l.current;return fetch("/api/desktop-update").then(j=>j.ok?j.json():null).then(j=>{if(x||l.current!==b)return;const k=$O(j);k&&n(k)}).catch(()=>{}),()=>{x=!0}},[e]);const u=lwe(t),d=g.useRef(!1),f=g.useRef(0),p=g.useRef(0);g.useEffect(()=>()=>window.clearTimeout(f.current),[]);const m=g.useCallback(async x=>{if(!_n(d.current))return;const b=++p.current;window.clearTimeout(f.current),d.current=!0,a(!0),i(null);const j=k=>{b===p.current&&(window.clearTimeout(f.current),d.current=!1,a(!1),i({failure:k,version:x}))};try{const k=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:x})});if(!k.ok)return j(uwe(await k.json().catch(()=>null)))}catch{return j("unreachable")}b===p.current&&(f.current=window.setTimeout(()=>j("timeout"),P8))},[]),w=g.useCallback(x=>{if(ao())try{const b=$O(JSON.parse(x));b&&(l.current++,n(b),b.status!=="ready"&&(p.current++,window.clearTimeout(f.current),d.current=!1,a(!1)))}catch{}},[]);return{desktopUpdateRestarting:s,desktopUpdateFailure:o,readyAppUpdate:u,appUpdate:t,askDesktopUpdateRestart:m,onDesktopUpdateEvent:w}}const Tf="agent-dag.autoRestart",m3="agent-dag.bundleReloadedFor";function d1e({now:e,stateRef:t,version:n,notice:s,noticeOpen:a,upgradeFailure:o,paused:i}){const[l,u]=g.useState(()=>nt(Tf)!=="0"),d=g.useRef(!1),f=g.useCallback(()=>{const U=!l;d.current=!0,vs(Tf),u(U),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:U})}).then(F=>F.ok?F.json():null).then(F=>{var M;F!=null&&F.ok&&u(((M=F.prefs)==null?void 0:M.autoUpdate)!==!1)}).catch(()=>{})},[l]),[p,m]=g.useState(!1),[w,x]=g.useState("restart"),[b,j]=g.useState(null),k=g.useRef(!1),v=g.useRef(null),S=g.useRef(0),C=g.useRef(null),_=g.useCallback(async U=>{if(!_n(k.current))return;const F=(U==null?void 0:U.upgrade)===!0,M=(U==null?void 0:U.whenIdle)===!0;k.current=!0,v.current=o;const B=++S.current,T=()=>{x(F?"npx":"restart"),m(!0)};M||T();try{window.sessionStorage.setItem("agent-dag.restartPending",(s==null?void 0:s.to)??"")}catch{}let P=!1;try{const q=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M?{upgrade:F,whenIdle:M}:{upgrade:F})});P=M&&q.status===409}catch{}if(P){k.current=!1,C.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}M&&T(),window.setTimeout(()=>{if(S.current===B&&k.current){k.current=!1,m(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},F?18e4:3e4)},[s==null?void 0:s.to,o]);g.useEffect(()=>{const U=IO(t.current.agents.values())>0,F=Ywe({enabled:l,kind:s==null?void 0:s.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:a,visible:document.visibilityState==="visible",busy:U,idleSince:C.current,now:e});C.current=F.idleSince,F.restart&&_({whenIdle:!0})},[l,s==null?void 0:s.kind,n==null?void 0:n.canRestart,a,e,_]);const R=IO(t.current.agents.values()),A=Kwe(R,i),I=H8({enabled:l,kind:s==null?void 0:s.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:a,visible:document.visibilityState==="visible",busy:R>0,idleSince:C.current,now:e});g.useEffect(()=>{const U=n==null?void 0:n.running;let F=null,M=null;try{F=window.sessionStorage.getItem("agent-dag.restartPending"),M=window.sessionStorage.getItem(m3)}catch{return}const B=Wwe({bundle:"3.49.1",running:U,pending:F,lastTried:M});if(B==="reload"){try{window.sessionStorage.setItem(m3,U??"")}catch{return}window.location.reload();return}if(B!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}k.current=!1,m(!1),j(U??null);const T=window.setTimeout(()=>j(null),6e3);return()=>window.clearTimeout(T)},[n==null?void 0:n.running]),g.useEffect(()=>{if(p&&zwe({asked:v.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}k.current=!1,m(!1)}},[p,o]);const $=g.useCallback(U=>{var F,M;if(!d.current){const B=nt(Tf)==="0";vs(Tf),B&&((F=U.prefs)==null?void 0:F.autoUpdate)!==!1?(u(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):u(((M=U.prefs)==null?void 0:M.autoUpdate)!==!1)}},[]);return{autoRestart:l,toggleAutoRestart:f,restarting:p,restartMode:w,restartedTo:b,askRestart:_,restartCopy:A,restartFuseMs:I,loadAutoRestartPrefs:$}}function h1e(){const[e,t]=g.useState([]),n=g.useRef(new Set),[s,a]=g.useState(null),[o,i]=g.useState(void 0);g.useEffect(()=>{let d=!0,f=0;const p=()=>{fetch("/api/lan").then(m=>m.ok?m.json():null).then(m=>d?(m!=null&&m.ok&&t(uR(Array.isArray(m.pending)?m.pending:[],m.aliases)),m):null).catch(()=>null).then(m=>{d&&(i(w=>m!=null&&m.ok?m:w===void 0?null:w),f=window.setTimeout(p,(m==null?void 0:m.enabled)===!0?yj:k6))})};return p(),()=>{d=!1,window.clearTimeout(f)}},[]);const l=g.useCallback(async(d,f)=>{if(!s){a(d);try{const m=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:d,fp:f})})).json().catch(()=>null);m&&Array.isArray(m.pending)?t(uR(m.pending,m.aliases)):t(w=>w.filter(x=>x.fp!==f))}catch{}finally{a(null)}}},[s]),u=g.useCallback(d=>{s||(n.current.add(d),t(f=>[...f]))},[s]);return{lanPending:e,lanDeferred:n,lanBusy:s,answerLanPair:l,deferLanPair:u,lanStatus:o}}const f1e=6e4;function p1e({enabled:e,lanStatus:t,now:n}){const[s,a]=g.useState(null),[o,i]=g.useState(()=>new Set),[l,u]=g.useState(null),d=g.useCallback(k=>{k!=null&&k.ok&&Array.isArray(k.accounts)&&a(k.accounts)},[]),f=g.useCallback(async k=>{try{const v=await fetch(`/api/claude-accounts${k?"?refresh=1":""}`);v.ok&&d(await v.json())}catch{}},[d]);g.useEffect(()=>{e&&f(!1)},[e,f]),g.useEffect(()=>{if(!e)return;let k=Date.now();const v=()=>{document.visibilityState!=="visible"||Date.now()-k<f1e||(k=Date.now(),f(!1))};return document.addEventListener("visibilitychange",v),window.addEventListener("focus",v),()=>{document.removeEventListener("visibilitychange",v),window.removeEventListener("focus",v)}},[e,f]);const p=g.useMemo(()=>e?pve(s,{lan:t,now:n,closed:o}):[],[e,s,t,n,o]),m=g.useRef(p);m.current=p;const w=g.useCallback(k=>{k.length&&i(v=>new Set([...v,...k]))},[]),x=g.useCallback(()=>{const k=m.current;k.length&&(w(k.map(v=>v.id)),fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reauth-later",incidents:k.map(v=>({key:v.key,since:v.since}))})}).catch(()=>{}))},[w]),b=g.useRef(l);b.current=l;const j=g.useCallback(k=>{const v=b.current;w(mve(v?[v,...m.current]:m.current,k))},[w]);return{rows:p,signingIn:l,observe:d,signIn:u,signedIn:j,refresh:g.useCallback(()=>{f(!0)},[f]),closeSignIn:g.useCallback(()=>u(null),[]),later:x}}const bB=288,m1e=bB;function g1e(e,t,n){return e?"session-list":t||n?"accounts":null}function g3(e){return e==="session-list"?m1e:e==="accounts"?bB:0}const y1e=240,w1e=20;function x1e(e){const t=g.useRef(0),n=g.useRef(e);return g.useLayoutEffect(()=>{n.current!==e&&(n.current=e,t.current=xd()?0:performance.now()+y1e+w1e)},[e]),t}const kB="agent-dag.sessionListOpen",jB="agent-dag.accountsPanelOpen";function v1e(){return nt(kB)==="1"}function b1e(e){st(kB,e?"1":"0")}function k1e(){const e=nt(jB);return e===null?!0:e==="1"}function j1e(){const e=g.useRef(!1),t=g.useRef(!1),[n,s]=g.useState(()=>{const x=v1e();return x&&z1()?(e.current=!0,!1):x});g.useEffect(()=>{if(n)e.current=!1;else if(e.current)return;b1e(n)},[n]);const a=g.useRef(!1),[o,i]=g.useState(()=>{const x=k1e();return x&&n?(a.current=!0,!1):x&&z1()?(t.current=!0,!1):x});g.useEffect(()=>{if(o)t.current=!1;else if(t.current)return;!o&&a.current||st(jB,o?"1":"0")},[o]),g.useEffect(()=>{!n&&a.current&&(a.current=!1,i(!0))},[n]);const l=g.useCallback(()=>{s(x=>(x||i(b=>(b&&(a.current=!0),!1)),!x))},[]),u=g.useCallback(()=>{a.current=!1,i(x=>(x||s(!1),!x))},[]),d=g.useCallback(()=>{a.current=!1,i(x=>(x||s(!1),!0))},[]),f=g.useCallback(()=>s(!1),[]),p=g.useCallback(()=>{a.current=!1,s(!1)},[]),m=g.useCallback(()=>i(!1),[]),w=g1e(n,o,a.current);return{sessionListOpen:n,accountsPanelOpen:o,panel:w,toggleSessionList:l,toggleAccountsPanel:u,openAccountsPanel:d,closeSessionList:f,closeSessionListToCanvas:p,closeAccountsPanel:m}}const NB="agent-dag.detailOpen",SB="agent-dag.usagePanelOpen",CB="agent-dag.systemPanelOpen";function N1e(){return nt(NB)==="1"}function S1e(e){st(NB,e?"1":"0")}function C1e(){const e=nt(SB);return e===null?!0:e==="1"}function _1e(e){st(SB,e?"1":"0")}function E1e(){const e=nt(CB);return e===null?!0:e==="1"}function T1e(e){st(CB,e?"1":"0")}function A1e(e=0){const[t,n]=g.useState(N1e);g.useEffect(()=>{S1e(t)},[t]);const[s,a]=g.useState(C1e);g.useEffect(()=>{_1e(s)},[s]);const o=g.useRef(!1),[i,l]=g.useState(()=>{const u=E1e();return u&&s&&(z1()||ree(e))?(o.current=!0,!1):u});return g.useEffect(()=>{if(i)o.current=!1;else if(o.current)return;T1e(i)},[i]),cn("usage-panel",s),cn("machine-panel",i),{detailOpen:t,setDetailOpen:n,usagePanelOpen:s,setUsagePanelOpen:a,machinePanelOpen:i,setMachinePanelOpen:l}}const R1e={permission:"your permission",asked:"your answer"},M1e="No sessions are waiting for you.";function $1e(e){if(e.length===0)return"";const[t,...n]=e,s=t.waiting.kind,a=n.every(i=>i.waiting.kind===s)?R1e[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 i1(e,t,n=M1e){return t!==""?t:e===""?"":n}function L1e({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[s,a]=g.useState(""),o=$1e(e);g.useEffect(()=>{a(m=>i1(m,o))},[o]);const[i,l]=g.useState(""),u=t>0?`Browser watch has ${t} unread ${t===1?"finding":"findings"}.`:"";g.useEffect(()=>{l(m=>i1(m,u,"Browser watch has no unread findings."))},[u]);const[d,f]=g.useState(""),p=z0e(n);return g.useEffect(()=>{f(m=>i1(m,p,V0e))},[p]),{blockedSaid:s,watchSaid:i,setWatchSaid:l,incidentSaid:d}}const I1e="/icon-192.png",_B=Object.freeze({notifySwap:!0,notifyQuota:!1,notifyReset:!1,notifyStopped:!0});function y3(e){const t=n=>typeof(e==null?void 0:e[n])=="boolean"?e[n]:_B[n];return{notifySwap:t("notifySwap"),notifyQuota:t("notifyQuota"),notifyReset:t("notifyReset"),notifyStopped:t("notifyStopped")}}function O1e({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),[d,f]=g.useState(!1),[p,m]=g.useState(_B),w=g.useCallback(I=>{const $=!p[I];m(U=>({...U,[I]:$})),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[I]:$})}).then(U=>U.ok?U.json():null).then(U=>{U!=null&&U.ok&&m(y3(U.prefs))}).catch(()=>{})},[p]),x=g.useRef(()=>{}),b=g.useRef(new Set),j=Bn(e),k=g.useCallback(()=>{const I=!l;u(I),I&&(b.current=rf(j.current)),I&&typeof Notification<"u"&&Notification.permission==="default"&&x.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:I})}).then($=>$.ok?$.json():null).then($=>{var U;$!=null&&$.ok&&(u(((U=$.prefs)==null?void 0:U.notifications)===!0),f($.notificationsVetoed===!0))}).catch(()=>{})},[l]),v=typeof Notification<"u";g.useEffect(()=>{if(!o)return;const $=setTimeout(()=>i(null),o==="blocked"?8e3:4e3);return()=>clearTimeout($)},[o]);const S=g.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(I=>{const $=I;a($),$==="granted"?i("on"):$==="denied"&&i("blocked")})},[]);x.current=S;const C=g.useRef(null),_=e.map(I=>tm(I.id,I.waiting)).join("|");g.useEffect(()=>{RG(C.current,s)&&(C.current=s,b.current=rf(e))},[s]);const R=g.useRef(!1);g.useEffect(()=>{MG(R.current,t)&&(R.current=!0,b.current=rf(e))},[t]),g.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!$G(C.current,t))return;const I=typeof document>"u"||!document.hidden,$=TG(e,b.current,I,l);for(const U of $)try{const F=new Notification(U.title,{body:U.body,tag:U.key,icon:I1e});F.onclick=()=>{window.focus(),n(U.sessionId),F.close()}}catch{}b.current=I?rf(e):AG(e,$,b.current)},[_,t]);const A=g.useCallback(I=>{var $;u((($=I.prefs)==null?void 0:$.notifications)===!0),f(I.notificationsVetoed===!0),m(y3(I.prefs))},[]);return{notifyPermission:s,notifySaid:o,notifyOn:l,notifyVetoed:d,toggleNotify:k,notifySupported:v,askForNotifications:S,loadNotifyPrefs:A,accountNotify:p,toggleAccountNotify:w}}function P1e({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:s,summaryFor:a,browserWatchOpen:o,keyHelpOpen:i,releaseNotes:l,feedbackOpen:u,trafficRadarOpen:d=!1}){const f=Bn(i),p=g.useRef(!1);return p.current=e!=null||t||n!=null||s||a!=null||o||i||l!=null||u||d,{keyHelpOpenRef:f,modalOpenRef:p}}function D1e({stateRef:e,tourOpen:t,releaseNotes:n}){const[s,a]=g.useState(null),o=g.useCallback((M,B)=>a({agentId:M,toolId:B}),[]),[i,l]=g.useState(null),[u,d]=g.useState(null),f=g.useCallback(M=>d(M),[]),[p,m]=g.useState(!1),[w,x]=g.useState(!1),[b,j]=g.useState(!1),[k,v]=g.useState(!1),[S,C]=g.useState(!1),[_,R]=g.useState(null),A=g.useCallback(M=>{R(M??null),C(!0)},[]);cn("tool-detail",s!==null),cn("session-summary",i!==null),cn("context-window",u!==null),cn("keyboard-help",p),cn("usage-history",w),cn("browser-watch",b),cn("feedback",S);const I=s?bV(e.current.agents,s.agentId,s.toolId):null,$=u?e.current.agents.get(u):void 0,{keyHelpOpenRef:U,modalOpenRef:F}=P1e({openedTool:I,usageHistoryOpen:w,contextFor:u,tourOpen:t,summaryFor:i,browserWatchOpen:b,keyHelpOpen:p,releaseNotes:n,feedbackOpen:S,trafficRadarOpen:k});return{setOpenedToolKey:a,openTool:o,openedTool:I,summaryFor:i,setSummaryFor:l,contextFor:u,setContextFor:d,openContext:f,contextAgent:$,keyHelpOpen:p,setKeyHelpOpen:m,usageHistoryOpen:w,setUsageHistoryOpen:x,browserWatchOpen:b,setBrowserWatchOpen:j,trafficRadarOpen:k,setTrafficRadarOpen:v,feedbackOpen:S,setFeedbackOpen:C,feedbackPrefill:_,setFeedbackPrefill:R,openFeedback:A,keyHelpOpenRef:U,modalOpenRef:F}}function F1e({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:s,lastLayoutSigRef:a,forgetRemovals:o,clearSelection:i,rerender:l,modalOpenRef:u}){const[d,f]=g.useState(!1),p=g.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=lN(),t.current.clear(),n.current.clear(),s.current.clear(),a.current="",u8(),o(),i(),l()},[l,i,o]),m=Bn(d),w=g.useCallback(x=>{const b=Jwe(x,{confirmOpen:m.current,modalOpen:u.current});b==="confirm"?f(!0):b==="clear"&&(f(!1),p())},[p]);return{clearConfirmOpen:d,setClearConfirmOpen:f,requestClear:w}}const w3="agent-dag.oldNameNoticeDismissed";function B1e(e){const[t,n]=g.useState(()=>nt(w3)??""),s=e!=null&&e.invokedAs&&e.invokedAs!==Pt?e.invokedAs:null,a=s!=null&&t!==s,o=g.useCallback(()=>{s&&(n(s),st(w3,s))},[s]);return{oldName:s,oldNameOpen:a,dismissOldName:o}}const q1e=300*1e3,U1e=1800*1e3,W1e=8e3,H1e=3e4;function x3(e){return fetch("/api/rating",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}).catch(()=>null)}function z1e({modalOpenRef:e}){const t=g.useCallback(()=>ml({appModal:e.current,dialogDepth:ln.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 x=async()=>{if(u.current==="thanks"||u.current==="hidden"&&(document.hidden||t()))return;const k=await fetch("/api/rating").then(v=>v.ok?v.json():null).catch(()=>null);w||!k||s(v=>v==="thanks"?v:k.ask===!0?"asking":"hidden")},b=window.setTimeout(x,q1e),j=window.setInterval(x,U1e);return()=>{w=!0,window.clearTimeout(b),window.clearInterval(j)}},[t]),g.useEffect(()=>{if(n!=="thanks"||i)return;const w=a!==null&&a<=6?H1e:W1e;let x=0;const b=()=>{t()?x=window.setTimeout(b,w):s("hidden")};return x=window.setTimeout(b,w),()=>window.clearTimeout(x)},[n,a,i,t]);const d=g.useCallback(w=>{o(w),l(!1),s("thanks"),x3({score:w})},[]),f=g.useCallback(w=>l(w),[]),p=g.useCallback(()=>{s("hidden"),x3({later:!0})},[]),m=g.useCallback(()=>s("hidden"),[]);return{ratingPhase:n,ratingScore:a,answerRating:d,rateLater:p,closeRating:m,holdThanks:f}}function V1e({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:s}){const[a,o]=g.useState(()=>$ee(nt)),i=Bn(a),[l,u]=g.useState([]),d=g.useCallback(v=>{o(S=>{const C={...S,[v]:null};return i.current=C,C}),vs($u[v])},[]),f=g.useCallback((v,S)=>{const C=i.current[v];S&&C!==S||(d(v),t(_=>{const R={..._,[v]:{..._[v],figure:Qn}};return n.current=R,R}),st(wp[v],Qn))},[d]),p=Bn(f);g.useEffect(()=>{let v=!0;return Hee().then(S=>{if(!v)return;u(S);const C=new Set(S.map(_=>_.id));for(const _ of Lu){const R=i.current[_];R&&!C.has(R)&&p.current(_,R)}},()=>{}),()=>{v=!1}},[]);const m=g.useCallback((v,S)=>{if(!l.some(_=>_.id===S))return;const C={...i.current,[v]:S};i.current=C,o(C),st($u[v],S),s(v,!0)},[l,s]),w=g.useCallback(async v=>{var R;const S=G1(l.length);if(S)throw new Error(S);const C=window.AudioContext??window.webkitAudioContext;if(!C)throw new Error("This browser cannot decode audio files.");const _=new C;try{const A=await Fee(v,$=>_.decodeAudioData($));await kA(A);const I=od(A);u($=>[...$.filter(U=>U.id!==I.id),I])}finally{(R=_.close)==null||R.call(_)}},[l.length]),x=g.useCallback(async v=>{const S=G1(l.length);if(S)throw new Error(S);const C=Bee(v);await kA(C);const _=od(C);u(R=>[...R.filter(A=>A.id!==_.id),_])},[l.length]),b=g.useCallback(async(v,S)=>{const C=l.find(R=>R.id===v),_=S.trim().slice(0,80);!C||!_||_===C.name||(await Vee(v,_),u(R=>R.map(A=>A.id===v?{...A,name:_}:A)))},[l]),j=g.useCallback(async v=>{await Gee(v),u(R=>R.filter(A=>A.id!==v));const S=i.current,C=Lee(S,v);i.current=C,o(C);const _=Lu.filter(R=>S[R]===v);for(const R of _)vs($u[R]),st(wp[R],Qn);_.length>0&&t(R=>{const A={...R};for(const I of _)A[I]={...A[I],figure:Qn};return n.current=A,A})},[]),k=g.useCallback(v=>{var _,R;const S=Lu.find(A=>i.current[A]===v),C=S?n.current[S].level:pi;(_=e.current)==null||_.unlock(),(R=e.current)==null||R.previewCustom(v,C)},[]);return{customSelections:a,customSelectionsRef:i,customAssets:l,clearCustomOnly:d,fallbackCustomRef:p,selectCustomTone:m,importNotificationAudio:w,createNotificationVoice:x,renameCustomAsset:b,deleteCustomAsset:j,previewCustomAsset:k}}function G1e(e){const[t,n]=g.useState(()=>ate(nt)),s=Bn(t),a=g.useRef(null),o=g.useCallback((l,u=!1)=>{var d,f;if((d=e.current)==null||d.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)},ete)},[]),i=g.useCallback((l,u)=>{n(d=>{const f={level:gm(u.level??d[l].level),figure:t5(l,u.figure??d[l].figure)};return st(r5[l],String(f.level)),st(wp[l],f.figure),{...d,[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 K1e=15e3;function Y1e(e){return e.visibilityState==="visible"&&e.hasFocus()}function X1e(e,t){return t||e===!0}function Z1e(){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 J1e(){g.useEffect(()=>{const e=Z1e();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=Y1e(document);X1e(t,i)&&n(i),t=i},a=()=>{t&&n(!1),t=!1};s();const o=window.setInterval(s,K1e);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 Q1e({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 l1="agent-dag.versionNoticeDismissed",eje=15*6e4;function tje(e){const[t,n]=g.useState(null),[s,a]=g.useState(()=>nt(l1)??""),o=g.useRef(0),[i,l]=g.useState(!1),u=g.useCallback((b=!1)=>(b&&(o.current=Date.now(),l(!0)),fetch(b?"/api/version?refresh=1":"/api/version").then(j=>j.ok?j.json():null).then(j=>(j&&n(j),j??null)).catch(()=>null).finally(()=>{b&&l(!1)})),[]),d=g.useCallback(()=>{u(Date.now()-o.current>=eje)},[u]);g.useEffect(()=>{u();const b=window.setInterval(d,5*6e4),j=()=>{document.visibilityState==="visible"&&d()};return document.addEventListener("visibilitychange",j),()=>{window.clearInterval(b),document.removeEventListener("visibilitychange",j)}},[u,d]),g.useEffect(()=>{e&&u()},[e,u]);const f=(t==null?void 0:t.notice)??null,p=q8(f),m=mwe(f,s),w=g.useCallback(()=>{a(""),st(l1,"")},[]),x=g.useCallback(()=>{f&&(a(p),st(l1,p))},[f,p]);return{version:t,notice:f,noticeOpen:m,showNotice:w,dismissNotice:x,versionChecking:i,loadVersion:u}}function nje({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 d=g.useRef(!1);g.useEffect(()=>{if(d.current)return;const j=gr(),k=Ove(j),v=Uve({stored:k,running:(e==null?void 0:e.running)??null,notes:WO,remembers:Pve(j)});if(v.reason==="no-version")return;d.current=!0,v.record&&Dve(j,v.record);let S=!0;return(async()=>{var I;let _=Fve(j);if(ao())try{const $=await fetch("/api/prefs");if(!$.ok)throw new Error("desktop tour preferences unavailable");const U=await $.json();if(!(U!=null&&U.ok))throw new Error("desktop tour preferences unavailable");const F=((I=U.prefs)==null?void 0:I.tourSeen)===!0;_&&!F&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),_=_||F}catch{_=!0}if(!S)return;const R=qve({tourSeen:_,decision:v}),A=v.show.length?{entries:v.show,since:k,firstRun:!1}:null;R.tour&&s(!0),R.notes==="now"?i(A):R.notes==="after"&&(a.current=A)})(),()=>{S=!1}},[e==null?void 0:e.running]);const f=(e==null?void 0:e.running)??"3.49.1",p=g.useMemo(()=>sB(WO,null,f),[f]),m=g.useCallback(()=>{i({entries:p,since:null,firstRun:!1})},[p]),w=g.useCallback(()=>s(!0),[]),x=g.useCallback(()=>i(null),[]),b=g.useCallback(()=>{s(!1),Bve(gr()),ao()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const j=a.current;a.current=null,j&&i(j)},[]);return{tourOpen:n,openTour:w,closeTour:b,releaseNotes:o,closeReleaseNotes:x,chipVersion:f,openReleaseNotes:m}}function sje(){const[e,t]=g.useState(void 0),[n,s]=g.useState(!1),a=g.useRef(!1);return a.current=e===!0&&!n,g.useEffect(()=>b0e(()=>a.current),[]),{loadReportsPrefs:g.useCallback(i=>{var l;t(((l=i.prefs)==null?void 0:l.reports)!==!1),s(i.reportsVetoed===!0)},[])}}function rje(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 d,f;const u=l!==!0;return st("agent-dag.sound",u?"on":"off"),u?(d=e.current)==null||d.unlock():(f=e.current)==null||f.silence(),u})},[]),a=g.useCallback(l=>{s()},[s]),o=Bn(a),i=Bn(t);return{soundOn:t,toggleSound:s,activateSoundRef:o,soundOnRef:i}}function aje(){const[e,t]=g.useState(mee),n=g.useCallback((o,i)=>{t(l=>gee(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 oje="agent-dag.autoFitDisabled";function ije(e){const t=g.useRef(!1),[n,s]=g.useState(!1);g.useEffect(()=>{vs(oje)},[]);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 lje(){return r.jsx(iN,{children:r.jsx(N0e,{children:r.jsx(cje,{})})})}function cje(){var $c;const e=Ql(),t=g.useState(lN)[0],n=g.useRef(t),[,s]=g.useState(0),a=g.useCallback(()=>s(dt=>dt+1),[]),{sessionListOpen:o,accountsPanelOpen:i,panel:l,toggleSessionList:u,toggleAccountsPanel:d,openAccountsPanel:f,closeSessionList:p,closeSessionListToCanvas:m,closeAccountsPanel:w}=j1e(),{detailOpen:x,setDetailOpen:b,usagePanelOpen:j,setUsagePanelOpen:k,machinePanelOpen:v,setMachinePanelOpen:S}=A1e(g3(l)),{selectedIds:C,primarySelectedId:_,selectAgent:R,clearSelection:A,pruneSelectionToBoard:I}=kde(n,b),$=bl(i,200),U=bl(o,200),F=YE(o,U),M=bl(j,130),B=bl(v,130),T=g.useRef(null),P=rje(T),{activateSoundRef:q,soundOnRef:K}=P,z=G1e(T),{setTonePrefs:H,tonePrefsRef:D,previewTone:O}=z,V=V1e({chimesRef:T,setTonePrefs:H,tonePrefsRef:D,previewTone:O}),{customSelectionsRef:Z,fallbackCustomRef:W}=V,X=aje(),{openSettings:Y}=X;l1e({chimesRef:T,soundOnRef:K,tonePrefsRef:D,customSelectionsRef:Z,fallbackCustomRef:W});const J=_0e(n),{pauseGate:Q,paused:te,togglePause:le}=J,de=g.useRef(()=>{}),{live:oe,tabCapped:re,everConnected:he,liveSince:fe}=hde({stateRef:n,rerender:a,pauseGate:Q,chimesRef:T,desktopUpdateRef:de}),$e=tje(oe),{version:ye,notice:ge,noticeOpen:je,loadVersion:Le}=$e,ke=u1e(oe),{readyAppUpdate:Ie,onDesktopUpdateEvent:De}=ke;de.current=De,J1e();const Ue=nje({version:ye,readyAppUpdate:Ie}),{tourOpen:Ke,openTour:we,releaseNotes:Fe}=Ue,{workspace:Re,providers:Ae,providersRef:rt}=T0e(oe),We=g3(l==="accounts"&&!Ae.claude?null:l),se=x1e(We),be=YE(i,$)&&Ae.claude,[Te,Oe]=g.useState(!1),ve=g.useCallback(()=>{f(),Oe(!0)},[f]);g.useEffect(()=>{i||Oe(!1)},[i]);const pe=g.useCallback(()=>Oe(!1),[]),_e=B1e(ye),ze=G0e({version:ye,loadVersion:Le}),{upgradeFailure:at}=ze,tt=D1e({stateRef:n,tourOpen:Ke,releaseNotes:Fe}),xt=z1e({modalOpenRef:tt.modalOpenRef}),{openTool:Mt,setSummaryFor:Xt,setContextFor:tr,openContext:Cs,setKeyHelpOpen:zn,setUsageHistoryOpen:ts,setBrowserWatchOpen:_s,keyHelpOpenRef:sn,modalOpenRef:zt}=tt,Me=sje(),Ve=Y0e(),{watchOn:Xe,watchUnseen:Tt}=Ve,Ct=Id(),[qt,Vn]=g.useState(null),[nr,Es]=g.useState(!1),gn=g.useCallback(()=>Es(!1),[]),_r=dt=>{Kye(dt),Y("integrations")},ga=dt=>{dt&&MO(dt),Y("integrations")},Er=g.useCallback(()=>Vn(null),[]),Ts=zS().filter(dt=>Rj(Ct,dt.kind)),Tr=Bn(dt=>{const Br=Ts.find(fg=>fg.kind===dt);Br&&Vn(Br.kind)}),ya=g.useCallback(dt=>{MO(dt),Y("integrations")},[Y]),Ar=Ts.length>0;g.useEffect(()=>{Ar&&Oye()},[Ar]);const Rr=h1e(),[ho,yt]=g.useState(0),{presentCats:wa,hiddenCats:ns,toggleCat:xa,catBarRef:As,catBarOccluded:Mr}=o1e(n),sr=g.useRef(null),[Rs,dn]=g.useState(0),$t=jde({stateRef:n,rerender:a,pruneSelectionToBoard:I,setContextFor:tr,setSummaryFor:Xt});SY({stateRef:n,now:$t,enabled:Ae.claude});const yn=$0e(Ae.claude||Ae.codex),xe=H0e(yn,$t),Qe=p1e({enabled:Ae.claude,lanStatus:Rr.lanStatus,now:$t}),ut=d1e({now:$t,stateRef:n,version:ye,notice:ge,noticeOpen:je,upgradeFailure:at,paused:J.paused}),{askRestart:Lt,loadAutoRestartPrefs:ss}=ut,Rn=a1e(),{setTheme:$r,palette:Pd}=Rn,ki=c1e(),Ms=jme(),{applyViewport:Dd,moveCamera:pc,fitLeft:rr,cameraEpochRef:Xm,lastFitTimeRef:ji}=Ms,ct=Pme(Ms),{pinnedRef:fo,positionsRef:po,lastLayoutSigRef:mc,handleRelayout:gc,rearrangeUndo:Fd}=ct,yc=g.useRef(null),Ni=g.useRef(()=>{}),mo=fe!==null,$s=g.useRef(0),Ls=g.useCallback(()=>{$s.current=Date.now()},[]),{canvasRef:hn,canvasSize:go,paneSizeRef:yo}=Sge(se),Is=ije(rr),{autoFitDisabledRef:Bd,disableAutoFit:Si}=Is,Lr=g.useRef(!1),{measuredRef:Ir,measuredVersionRef:qd,sizeVersion:Ci,domSizeVersion:Ud}=Cge(Lr),{removedNodes:wc,removedAgentIds:rs,removeNode:wo,removeSelectedNode:Or,removalNotice:xo,hideSessions:Zm,bringBack:xc,bringBackAll:vc,forgetRemovals:_i}=sge({stateRef:n,pinnedRef:fo,positionsRef:po,returningRef:ct.returningRef,canvasRef:hn,clearSelection:A,primarySelectedId:_});pge({stateRef:n,removedNodes:wc,hideSessions:Zm,ready:mo,keepSessionId:_?(($c=n.current.agents.get(_))==null?void 0:$c.sessionId)??_:null});const vo=Jme({stateRef:n,now:$t,removedAgentIds:rs,sizeVersion:Ci,domSizeVersion:Ud});Dme(vo,ct),nge({layoutSig:vo,rf:e,stateRef:n,measuredRef:Ir,pinnedRef:fo,positionsRef:po,paneSizeRef:yo,lastInteractRef:$s,autoFitDisabledRef:Bd,lastFitTimeRef:ji,fitLeft:rr});const bc=_ge(),{bubbling:ar,endBubble:kc,onBubble:Ei}=Zue(),[Ti,Ai]=g.useState(!1),bo=Yue(),{beginTrashDrag:Wd,trackTrashDrag:kn,endTrashDrag:va}=bo,Ri=rde({stateRef:n,measuredRef:Ir,measuredVersionRef:qd,canvasRef:hn}),{lodRef:ko,applyZoom:Jm}=Ri,Mi=kge({applyViewport:Dd,lastFitTimeRef:ji,cameraEpochRef:Xm,disableAutoFit:Si,markInteract:Ls,canvasRef:hn,applyZoom:Jm}),Pr=_?n.current.agents.get(_):null,Dr=x&&Pr!=null,Os=Rge({sessionListShown:F,usageShown:Ya(M),machineShown:Ya(B),accountsShown:be,detailShown:Dr,primarySelectedId:_,canvasRef:hn}),{railInsetRef:jo,availableWidth:Hd,availableHeight:zd}=wme({canvasRef:hn,canvasSize:go,machinePhase:B,usagePhase:M,usagePanelOpen:j,detailShown:Dr}),Vd=Qme({stateRef:n,now:$t,availableWidth:Hd,availableHeight:zd,layout:ct,measuredRef:Ir,onBubble:Ei,settled:bc,dragging:Ti,layoutSig:vo,selectedIds:C,openContext:Cs,historyReplayed:mo,removedNodes:wc,removedAgentIds:rs,dragTick:ho,dragPatchRef:sr,dragMoveTick:Rs}),{nodes:No,edges:Qm}=Vd,jc=Bn(_);Fme({nodes:No,edges:Qm,settled:bc,dragging:Ti,availableWidth:Hd,availableHeight:zd,layout:ct,camera:Ms,rf:e,measuredRef:Ir,stateRef:n,lastFocusRef:yc,primarySelectedIdRef:jc,focusAgentRef:Ni,autoFitDisabledRef:Bd});const Gd=F1e({stateRef:n,pinnedRef:fo,measuredRef:Ir,positionsRef:po,lastLayoutSigRef:mc,forgetRemovals:_i,clearSelection:A,rerender:a,modalOpenRef:zt}),{requestClear:Nc}=Gd,eg=Mge({nodes:No,stateRef:n,pinnedRef:fo,positionsRef:po,draggingRef:Lr,dragPatchRef:sr,setDragging:Ai,setDragMoveTick:dn,setDragTick:yt,endBubble:kc,markInteract:Ls,disableAutoFit:Si,beginTrashDrag:Wd,trackTrashDrag:kn,endTrashDrag:va,removeNode:wo}),Sc=g.useCallback(()=>rr(500),[rr]),Cc=Bn(No),{focusAgent:$i,stepAgent:tg,focusSession:ba}=Sme({canvasRef:hn,stateRef:n,measuredRef:Ir,nodesRef:Cc,railInsetRef:jo,moveCamera:pc,disableAutoFit:Si,lastFocusRef:yc,focusAgentRef:Ni,selectAgent:R,primarySelectedIdRef:jc}),_c=jge({clearSelection:A,selectAgent:R,detailOpen:x,setDetailOpen:b,detailShown:Dr,focusAgent:$i,draggingRef:Lr,lodRef:ko}),ng=Cme({nodesRef:Cc,stateRef:n,canvasRef:hn,railInsetRef:jo}),sg=Bn(Or),Ec=g.useRef(null),So=g.useCallback(dt=>{rs.has(dt)&&xc([dt]),ba(dt)},[rs,xc,ba]),rg=Ege(),[ag,Tc]=g.useState(!1),Kd=g.useCallback(()=>Tc(!0),[]),og=g.useCallback(()=>Tc(!1),[]),ig=g.useCallback(dt=>{Tc(!1),dt.run()},[]),lg=An();Tge({pointerFocusRef:rg,nodesRef:Cc,stateRef:n,primarySelectedIdRef:jc,providersRef:rt,soundOnRef:K,keyHelpOpenRef:sn,modalOpenRef:zt,waitingCursorRef:Ec,removeSelectedRef:sg,activateSoundRef:q,clearSelection:A,selectAgent:R,focusAgent:$i,stepAgent:tg,focusSession:ba,requestClear:Nc,handleRelayout:gc,undoRearrange:Fd.undo,handleFit:Sc,togglePause:le,toggleSessionList:u,toggleAccountsPanel:d,setDetailOpen:b,setUsageHistoryOpen:ts,setUsagePanelOpen:k,setMachinePanelOpen:S,setBrowserWatchOpen:_s,setKeyHelpOpen:zn,setTheme:$r,openSettings:Y,openIntegrationRef:Tr,openQuickOpen:Kd});const Co=n.current.agents.size,as=g.useMemo(()=>T1(n.current.agents.values()),[n.current,n.current.revision]);rge({stateRef:n,waitingSessions:as,removedAgentIds:rs,removedNodes:wc,bringBack:xc}),xge({stateRef:n,waitingSessions:as,live:oe});const Yd=L1e({waitingSessions:as,watchUnseen:Tt,incidents:xe}),Li=O1e({waitingSessions:as,liveSince:fe,focusSession:ba}),{loadNotifyPrefs:Xd}=Li;Q1e({loadAutoRestartPrefs:ss,loadNotifyPrefs:Xd,loadReportsPrefs:Me.loadReportsPrefs});const or=lc(mm),[Zd,Ac]=g.useState(!1),[Fr,Rc]=g.useState(null),cg=g.useCallback(()=>Rc(null),[]),ug=g.useCallback(dt=>{const Br=n.current.agents.get(dt);return Br?Br.label||Br.cwdBasename||"session":null},[]),Jd=g.useCallback(dt=>{Rc(null),So(dt)},[So]),Qd=g.useCallback(()=>Ac(!1),[]),[ka,ja]=g.useState(null),dg=g.useCallback(()=>ja(null),[]),Ut=Zge({providers:Ae,sessionListOpen:o,toggleSessionList:u,accountsPanelOpen:i,toggleAccountsPanel:d,usagePanelOpen:j,setUsagePanelOpen:k,machinePanelOpen:v,setMachinePanelOpen:S,setUsageHistoryOpen:ts,watchOn:Xe,watchUnseen:Tt,setBrowserWatchOpen:_s,setTrafficRadarOpen:tt.setTrafficRadarOpen,openSettings:Y,onFeedback:tt.openFeedback,setRadioOpen:Ac,openToolActivity:Rc,openCapacity:ja,toggles:Os.toggles,integrations:Ts.map(dt=>({provider:dt,onPress:()=>Vn(dt.kind)})),openExploreIntegrations:()=>Es(!0),openQuickOpen:Kd}),[hg,eh]=g.useState(0),Ii=g.useCallback(dt=>{So(dt),or&&m()},[So,or,m]),Mc=g.useCallback(()=>{o||u(),requestAnimationFrame(()=>{var dt;return(dt=document.querySelector("#session-list .sl-row"))==null?void 0:dt.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(KJ,{}),r.jsx(Cwe,{versionCheck:$e,welcome:Ue,desktopUpdate:ke,pause:J,announcements:Yd,notify:Li,waitingSessions:as,waitingCursorRef:Ec,focusSession:ba,live:oe,now:$t,incidents:xe,queueNamed:or?0:hg}),!or&&r.jsx(jwe,{waitingSessions:as,waitingCursorRef:Ec,focusSession:ba,now:$t,onFit:eh,onMore:Mc}),Pr&&r.jsx(_we,{selected:Pr,now:$t,selectedIds:C,focusAgent:$i,clearSelection:A}),!or&&r.jsx("div",{className:"actions",children:r.jsx(dee,{items:[Ut.search,...Ut.utilities]})})]}),or?r.jsx(uee,{items:[...Ut.left,...Ut.right[0],Ut.utilities[0]],more:[Ut.search,...Ut.capacity,...Ut.right.slice(1).flat(),...Ut.integrations,...Ut.explore,Ut.utilities[1]]}):r.jsx(pA,{side:"left",label:"Accounts and sessions",groups:[...Ut.leftStripe,Ut.integrations,Ut.explore]}),r.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:xo?`${xo.label} removed from the board.`:""}),r.jsx(Zwe,{restart:ut,versionCheck:$e,upgrade:ze,oldNameNotice:_e,rating:xt,onFeedback:tt.openFeedback,everConnected:he,live:oe,paused:te}),(F||be)&&r.jsxs(Uue,{width:We,children:[be&&r.jsx(Sue,{leaving:XE(i,$),onReport:tt.openFeedback,onRoster:Qe.observe,onClose:()=>{Os.accounts(),w()},lanWanted:Te,onLanShown:pe}),F&&r.jsx(iQ,{leaving:XE(o,U),state:n.current,now:$t,selectedIds:C,onSelect:Ii,onClose:()=>{Os.sessionList(),p()},removedIds:rs,onBringBackAll:vc})]}),r.jsxs(Mwe,{canvasRef:hn,bubbling:ar,dragging:Ti,trash:bo,zoom:Ri,viewport:Mi,stateRef:n,peek:ng,children:[Co===0&&(!oe&&re?r.jsx(Lge,{reservedRight:jo.current}):r.jsx(Ige,{live:oe,everConnected:he,providers:Ae,workspace:Re,onTour:we,reservedRight:jo.current})),(wa.length>1||ns.size>0)&&r.jsx(Ewe,{catBarRef:As,catBarOccluded:Mr,presentCats:wa,hiddenCats:ns,toggleCat:xa}),r.jsx(GJ,{graph:Vd,layout:ct,viewport:Mi,clicks:_c,drag:eg,appearance:Rn,fm:ki,radioOpen:Zd,onRadioClose:Qd,autoFit:Is,pause:J,stateRef:n,measuredRef:Ir,hiddenCats:ns,now:$t,openTool:Mt,focusAgent:$i,requestClear:Nc,setKeyHelpOpen:zn})]}),!or&&r.jsx(pA,{side:"right",label:"Usage and activity",groups:Ut.right}),Fr&&r.jsx(Rne,{view:Fr,onClose:cg,sessionLabel:ug,onOpenSession:Jd}),ka&&r.jsx(que,{view:ka,onClose:dg}),qt&&r.jsx(Fye,{kind:qt,connections:na(Ct,qt)?Op(Ct,qt):[],onClose:Er,onReconnect:ya}),nr&&r.jsx(ewe,{integrations:Ct,onClose:gn,onOpen:Vn,onConnect:_r,onManage:ga}),ag&&r.jsx(WQ,{onClose:og,onRun:ig,items:Ete({rails:Ut,sessions:LD(n.current),now:$t,openSession:Ii,settings:i5(Ae.claude,GS(Ct),Od(Ct)),openSettings:Y,singleKeys:lg,fit:Sc,rearrange:gc,paused:te,togglePause:le,clear:Co>0?()=>Nc("button"):void 0,keyHelp:()=>zn(!0),tour:we,theme:Rn.theme,setTheme:$r})}),Ya(M)&&r.jsx(tre,{state:n.current,now:$t,providers:Ae,incidents:xe,liveSince:fe,leaving:M==="leaving",onClose:()=>{Os.usage(),k(!1)}}),Ya(B)&&r.jsx(Pre,{usageOpen:j,leaving:B==="leaving",onClose:()=>{Os.machine(),S(!1)}}),x&&Pr?r.jsx(Yge,{selected:Pr,now:$t,openTool:Mt,setSummaryFor:Xt,stateRef:n,removeSelectedNode:Or,onClose:()=>{Os.detail(),b(!1)}}):null,r.jsx(r0e,{dialogs:tt,welcome:Ue,desktopUpdate:ke,versionCheck:$e,restart:ut,upgrade:ze,lanPairs:Rr,attention:Qe,clearFlow:Gd,watchBadge:Ve,announcements:Yd,appearance:Rn,providers:Ae,stateRef:n,agentCount:Co,menus:X,sound:P,tones:z,customTones:V,notify:Li,panelDoors:{accounts:f,localNetwork:ve}})]})}try{yK(window.localStorage)}catch{}const uje=Lq.createRoot(document.getElementById("root"));window.ccdeckWindow&&(document.documentElement.dataset.desktopChrome="true",document.documentElement.dataset.desktopPlatform=window.ccdeckWindow.platform);uje.render(r.jsx(lje,{}));export{Cje as $,ac as A,xje as B,vt as C,Tu as D,Zl as E,Mje as F,L5 as G,gae as H,wr as I,lt as J,tj as K,IA as L,nj as M,gje as N,St as O,Qa as P,ea as Q,A5 as R,yje as S,rp as T,wje as U,fd as V,Hn as W,Pee as X,Sje as Y,Eje as Z,zve as _,vs as a,_je as a0,Hve as a1,Tje as a2,cm as a3,me as a4,fi as a5,eo as a6,OZ as a7,$je as a8,MN as a9,Gl as aa,yX as ab,mje as ac,fje as ad,pje as ae,um as af,JG as ag,Fbe as ah,X0e as ai,hje as aj,PZ as ak,g as b,jje as c,qn as d,op as e,$8 as f,Uo as g,io as h,Nje as i,r as j,pS as k,LP as l,ln as m,gt as n,wt as o,xd as p,kje as q,nt as r,_n as s,bje as t,lc as u,cn as v,st as w,Rje as x,Aje as y,vje as z};
|