ccdeck 3.81.1 → 3.81.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{BrowserWatchModal-BcvsD8Np.js → BrowserWatchModal-BahEbWu-.js} +1 -1
- package/dist/web/assets/{IntegrationModal-BMtv2XWR.js → IntegrationModal-DzIizEQd.js} +1 -1
- package/dist/web/assets/{RadioPanel-k65VVqTb.js → RadioPanel-DKmUHqxX.js} +1 -1
- package/dist/web/assets/{TrafficRadar-BNw0skS3.js → TrafficRadar-B2G1nwSK.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-CYxrrwCl.js → UsageHistoryModal-M0A1co-v.js} +1 -1
- package/dist/web/assets/{app-DCoamBD4.js → app-uL65pD1B.js} +6 -6
- package/dist/web/assets/{index-BMX8nr4f.js → index-4-WbGg1k.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/release-notes.json +9 -0
- package/src/server/codex-live-engine.mjs +11 -0
|
@@ -126,7 +126,7 @@ ${e.sessionTitle}`:e.sessionTitle:e.cwd,g=yA(e),f=m.useRef(null),b=m.useRef(null
|
|
|
126
126
|
${t("board.node.modelCovers")}
|
|
127
127
|
${g.join(`
|
|
128
128
|
`)}`:Tu(e.model,e.effort)),T=Um(e.sessionName,e.sessionTitle),q=mU(e),_=(q==null?void 0:q.note)??null,I=q?q.key:null,z=hte(I),F=q!=null&&!z,U=(_==null?void 0:_.kind)==="recap",P=hee(e);return s.jsxs("div",{className:i,style:{"--session-hue":c},children:[s.jsx("span",{className:"accent-stripe"}),s.jsx(Pr,{type:"target",position:it.Left,style:{background:"transparent",border:"none"}}),s.jsxs("div",{className:"head",children:[s.jsxs("div",{className:"title",children:[s.jsx(Nne,{state:a}),s.jsx("span",{className:"label",title:h,children:e.label}),e.restoredFromLog&&s.jsx("span",{className:"synth-tag",title:e.provider==="claude"?t("board.node.restoredRegistry"):t("board.node.restoredLog"),children:t("board.node.restored")}),e.synthetic&&s.jsx("span",{className:"synth-tag",title:t("board.node.synthesised"),children:"?"}),q&&I&&s.jsx("button",{type:"button",className:"glyph-btn recap-pin","aria-label":U?t("board.node.recapLabel"):_?t("board.node.noteLabel",{tag:Rl(_.kind)}):t("board.node.notePlan"),"aria-expanded":F,title:t(U?F?"board.node.hideRecap":"board.node.showRecap":_?F?"board.node.hideNote":"board.node.showNote":F?"board.node.hidePlan":"board.node.showPlan"),onClick:O=>{O.stopPropagation(),ute(I)},children:s.jsx(Gg,{recap:U})})]}),s.jsx("div",{className:"head-right",children:u&&e.onOpenContext&&s.jsx(ate,{currentContextTokens:d,modelId:e.model,contextWindow:e.contextWindow,onClick:()=>e.onOpenContext(e.sessionId)})})]}),s.jsxs("div",{className:"sub",title:zee(e,t),children:[s.jsxs("span",{className:"sub-details",ref:f,children:[S.kind&&s.jsx("span",{children:Fm(e,t)}),e.childCount>0&&s.jsxs("span",{className:"spawn-badge",title:_ee(e.childCount,t),children:["→ ",e.childCount]}),e.cwdBasename&&e.kind==="subagent"&&s.jsxs("span",{className:"sub-folder",ref:b,children:[S.kind?"· ":"",e.cwdBasename]}),e.model?s.jsxs("span",{className:"model-chip","data-family":Mm(e.model),title:A,children:[Im(e.model,S.effort?e.effort:void 0),g.length>0?` +${g.length}`:""]}):e.provider==="codex"?s.jsx("span",{className:"model-chip",title:t("board.node.codexNoModel"),children:"Codex"}):null]}),s.jsxs("span",{className:"time",title:e.synthetic?t("board.node.joinedLate",{time:new Date(e.startedAt).toLocaleTimeString(n)}):t("board.node.started",{time:new Date(e.startedAt).toLocaleTimeString(n)}),children:[e.synthetic?"≥ ":"",s.jsx(Sne,{start:e.startedAt,end:e.endedAt})]})]}),e.kind==="root"&&T.face&&s.jsx("div",{className:"session-name",title:T.tooltip,children:T.face}),e.kind==="root"&&e.stopFailure&&s.jsx(jne,{data:e,stop:e.stopFailure}),e.kind==="root"&&!e.stopFailure&&s.jsx(vne,{data:e}),e.waiting&&!(e.stopFailure&&e.waiting.kind==="idle")&&s.jsx(Ane,{waiting:e.waiting}),(()=>{const O=X2(e);return O?s.jsxs("div",{className:"approval-blind-row",title:O.detail,children:[s.jsx("span",{className:"approval-blind-dot","aria-hidden":!0}),s.jsx("span",{className:"approval-blind-said",children:O.label})]}):null})(),(()=>{const O=ai(e.plan);return O&&e.plan?s.jsx(xne,{plan:O,items:e.plan.items}):null})(),(e.tools.length>0||(((R=e.outputs)==null?void 0:R.length)??0)>0)&&s.jsx(Tne,{tools:e.tools,outputs:e.outputs}),s.jsxs("div",{className:"meta",children:[s.jsxs("span",{children:[s.jsx("b",{children:e.toolCount})," ",t("board.meta.tools",{count:e.toolCount})]}),r>0&&s.jsxs("span",{className:"failed-meta",title:t("board.meta.errTitle",{count:r}),children:[s.jsx("b",{children:r})," ",t("board.meta.err")]}),o>0&&s.jsxs("span",{className:"inflight-meta",children:[s.jsx("b",{children:o})," ",t("board.meta.inflight")]}),e.usage.inputTokens+e.usage.outputTokens>0&&s.jsxs("span",{className:"tokens-meta",title:`${t("board.meta.tokensTitle",{input:e.usage.inputTokens,output:e.usage.outputTokens,cacheR:e.usage.cacheReadTokens,cacheC:e.usage.cacheCreateTokens})}${(e.usage.reasoningOutputTokens??0)>0?` ${t("board.meta.reasoning",{n:e.usage.reasoningOutputTokens??0})}`:""}`,children:[s.jsx("b",{children:Dt(e.usage.inputTokens+e.usage.outputTokens)})," ",t("board.meta.tok")]}),(P==null?void 0:P.kind)==="unpriced"&&s.jsx("span",{className:"cost-unpriced",title:P.tt,children:t("insights.cost.notPriced")}),(P==null?void 0:P.kind)==="spent"&&s.jsx("span",{className:"cost-meta",title:P.tt,children:s.jsxs("b",{children:[Nt(P.total),P.floor?"+":""]})})]}),s.jsx(Cne,{data:e,title:e.kind==="root"?T.face:void 0}),s.jsx(Pr,{type:"source",position:it.Right,style:{background:"transparent",border:"none"}})]})}const yne=m.memo(wne);function xne({plan:e,items:t}){const n=se();return s.jsxs("div",{className:e.allDone?"plan-row plan-done":"plan-row",title:zm(t),children:[s.jsx("span",{className:"plan-meter","aria-hidden":!0,style:{"--plan-done":e.done/e.total}}),s.jsxs("span",{className:"plan-count",children:[e.done,"/",e.total]}),s.jsx("span",{className:"plan-step",children:e.allDone||!e.current?n("board.state.done"):s.jsxs(s.Fragment,{children:[e.next&&s.jsx("span",{className:"plan-next",children:n("board.plan.next")}),e.current]})})]})}function Cne({data:e,title:t}){const n=se(),a=e.kind==="root"&&ea(e.waiting),i=wte(e,e.branch,{sayWaiting:o=>Bg(o,n),describeCall:o=>({name:jA(o.name).label,subject:$te(o.name,o.input)})},n);return s.jsxs("div",{className:"lod-face","data-kind":e.kind,"data-alarm":a?"":void 0,"data-signal":i?"":void 0,"aria-hidden":!0,children:[s.jsxs("div",{className:"lod-id",children:[s.jsx(CU,{kind:yN(al(e))}),s.jsx("span",{className:"lod-name",children:e.label}),i&&s.jsx("span",{className:"lod-inline","data-tone":i.tone,children:i.short}),a&&s.jsx(TA,{})]}),t&&s.jsx("div",{className:"lod-title",children:t}),i&&s.jsxs("div",{className:"lod-signal","data-tone":i.tone,children:[s.jsx("span",{className:"lod-long",children:i.long}),s.jsx("span",{className:"lod-short",children:i.short})]})]})}function Sne({start:e,end:t}){const n=si(1e3);return s.jsx(s.Fragment,{children:bl(e,t,n)})}function Nne({state:e}){const t=se();return s.jsx("span",{className:`state-pill state-${e}`,children:No(e,t)})}function jne({data:e,stop:t}){const n=se();return s.jsxs("div",{className:"stop-row",title:Tee(t,e.job!=null,n),"data-kind":t.kind,children:[s.jsx("span",{className:"waiting-dot","aria-hidden":!0}),s.jsx("span",{className:"stop-said",children:tU(t,n)}),s.jsx(bne,{data:e})]})}function Ane({waiting:e}){const t=se(),n=si(1e3),a=ea(e),i=fl(e,t);return s.jsxs("div",{className:a?"waiting-row permission":"waiting-row idle",title:`${i}
|
|
129
|
-
${t("board.node.blockedFor",{time:bl(e.since,void 0,n)})}`,children:[a?s.jsx("span",{className:"ap-pulse","aria-hidden":!0}):s.jsx("span",{className:"waiting-dot","aria-hidden":!0}),s.jsx("span",{className:"waiting-said",children:Bg(e,t)}),s.jsx("b",{children:bl(e.since,void 0,n)})]})}function Tne({tools:e,outputs:t}){const n=se(),a=si(1e3),{counts:i,title:o}=Qte(e,t,a,n),r=Bv/sl;return s.jsxs("div",{className:"tool-spark-row",title:o,children:[s.jsx("svg",{className:"tool-spark",width:Bv,height:bg,viewBox:`0 0 ${Bv} ${bg}`,"aria-hidden":!0,children:i.map((c,d)=>{const u=tne(c),h=d===sl-1&&c>0,f=`tool-spark-bar${c>0?" active":""}${h?" latest":""}`;return s.jsx("rect",{x:d*r+.4,y:bg-u,width:Math.max(.5,r-1),height:u,rx:.8,className:f},h?`landed:${c}`:d)})}),s.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function Rne({enableAutoFitAndRefit:e}){const t=se();return s.jsxs("div",{className:"autofit-chip",children:[s.jsx("span",{className:"autofit-state",title:t("accounts.autoFit.offTip"),children:t("accounts.autoFit.off")}),s.jsx("button",{type:"button",className:"autofit-resume",onClick:e,title:t("accounts.autoFit.resumeTip"),"aria-label":t("accounts.autoFit.resumeLabel"),children:t("accounts.autoFit.resume")})]})}const LA="agent-dag.single-key-shortcuts";function LU(e){return e!=="0"}function OU(e){return e.length===1}function Ene(e,t){return!t&&OU(e)}function zn(e,t,n){return n?`${e} (${t})`:e}let Rr=null;const Yd=new Set;function PU(){for(const e of Yd)e()}function jN(){return Rr===null&&(Rr=LU(ht(LA))),Rr}function qne(e){Rr!==e&&(Rr=e,pt(LA,e?"1":"0"),PU())}function M1(e){if(e.key!==LA)return;const t=LU(e.newValue);t!==Rr&&(Rr=t,PU())}function _ne(e){var t;return Yd.add(e),Yd.size===1&&typeof window<"u"&&((t=window.addEventListener)==null||t.call(window,"storage",M1)),()=>{var n;Yd.delete(e),Yd.size===0&&typeof window<"u"&&((n=window.removeEventListener)==null||n.call(window,"storage",M1))}}function Kg(e,t=x){const n=Math.max(0,Math.floor(e));return t("board.pill.events",{count:n})}const I1=99;function zne(e){const t=Math.max(0,Math.floor(e));return t>I1?`${I1}+`:String(t)}const Lne=(e=x)=>e("board.pill.pause");function One(e,t=x){const n=e.singleKeys??!0;if(!e.paused)return zn(t("board.pill.title.pause"),"Space",n);const a=Math.max(0,Math.floor(e.dropped??0));return a>0?zn(t("board.pill.title.full",{held:Kg(e.held,t),count:a}),"Space",n):e.held<=0?zn(t("board.pill.title.nothing"),"Space",n):zn(t("board.pill.title.arrived",{held:Kg(e.held,t)}),"Space",n)}function Pne(e,t=x){return e.connected||!e.paused?null:t("board.pill.outage")}const MU=e=>e("board.pill.pausedFull"),Mne=(e,t,n)=>t>0?MU(n):e>0?n("board.pill.pausedCount",{held:zne(e)}):n("board.pill.paused");function Ine(e,t=x){const n=Math.max(0,Math.floor(e.dropped??0)),a=e.singleKeys??!0;return e.connected?e.paused?{tone:"paused",resting:!1,label:Mne(e.held,n,t),widest:MU(t),title:zn(n>0?t("board.pill.title.connectedFull",{held:Kg(e.held,t)}):e.held>0?t("board.pill.title.connectedHeld",{held:Kg(e.held,t)}):t("board.pill.title.connectedNone"),"Space",a)}:{tone:"live",resting:!0,label:t("board.pill.live"),widest:t("board.pill.live"),title:t("board.pill.title.live")}:{tone:"dead",resting:!1,label:t("board.pill.offline"),widest:t("board.pill.offline"),title:e.paused?t("board.pill.title.offlinePaused"):t("board.pill.title.offline")}}function On(){return m.useSyncExternalStore(_ne,jN,jN)}const Dne=e=>e.transform[2]>=e.maxZoom,Fne=e=>e.transform[2]<=e.minZoom;function Une({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:a,togglePause:i,handleRelayout:o,requestClear:r,setKeyHelpOpen:c}){const d=se(),u=Cl(),h=jt(Dne),g=jt(Fne),f=On();return s.jsxs(x8,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[s.jsx(Ga,{onClick:()=>{h||u.zoomIn()},title:d("board.controls.zoomIn"),"aria-label":d("board.controls.zoomIn"),"aria-disabled":h||void 0,children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:s.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),s.jsx(Ga,{onClick:()=>{g||u.zoomOut()},title:d("board.controls.zoomOut"),"aria-label":d("board.controls.zoomOut"),"aria-disabled":g||void 0,children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:s.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),s.jsx(Ga,{onClick:t,title:d(e?"board.controls.recenterOn":"board.controls.recenterAuto"),"aria-label":d("board.controls.recenter"),"data-nudge":e?"":void 0,children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),s.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),s.jsx(Ga,{"data-group-start":"",onClick:i,title:One({paused:n,held:a.size,dropped:a.dropped,singleKeys:f},d),"aria-label":Lne(d),"aria-pressed":n,children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:s.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),s.jsx(Ga,{onClick:o,title:zn(d("board.controls.arrange"),"R",f),"aria-label":d("board.controls.arrangeLabel"),children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[s.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),s.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),s.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),s.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),s.jsx(Ga,{"data-group-start":"","data-danger":"",onClick:()=>r("button"),title:zn(d("board.controls.clear"),"C",f),"aria-label":d("board.controls.clearLabel"),children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[s.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),s.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"}),s.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"}),s.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),s.jsx(Ga,{"data-group-start":"",onClick:()=>c(b=>!b),title:f?zn(d("board.controls.keys"),"?",!0):d("board.controls.keysOff"),"aria-label":d("board.controls.keysLabel"),"aria-haspopup":"dialog",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[s.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"}),s.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]})}const Bne="modulepreload",Hne=function(e){return"/"+e},D1={},Hr=function(t,n,a){let i=Promise.resolve();if(n&&n.length>0){let r=function(u){return Promise.all(u.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=r(n.map(u=>{if(u=Hne(u),u in D1)return;D1[u]=!0;const h=u.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${g}`))return;const f=document.createElement("link");if(f.rel=h?"stylesheet":Bne,h||(f.as="script"),f.crossOrigin="",f.href=u,d&&f.setAttribute("nonce",d),document.head.appendChild(f),h)return new Promise((b,k)=>{f.addEventListener("load",b),f.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(r){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=r,window.dispatchEvent(c),!c.defaultPrevented)throw r}return i.then(r=>{for(const c of r||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})},F1="agent-dag.fm-custom-stations",U1="agent-dag.fm-muted",AN="custom:",Wne=/^UC[A-Za-z0-9_-]{22}$/,Gne=/^[A-Za-z0-9_-]{11}$/,IU=/^[A-Za-z0-9_-]{1,80}$/,$ne=/\.(mp3|aac|ogg)$/i,Vne=/\.m3u8$/i,Kne=2048,DU=80;function kl(e){return`${AN}${e}`}function Jm(e){if(!e.startsWith(AN))return null;const t=e.slice(AN.length);return IU.test(t)?t:null}function B1(e){return Jm(e)??e}function OA(e){var r,c;const t=e.trim();if(t.length>Kne)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!=="https:"||n.username||n.password)return null;const a=n.toString(),i=n.hostname.toLowerCase();if(i==="youtube.com"||i==="www.youtube.com"||i==="m.youtube.com"){if(n.port)return null;const d=(r=/^\/channel\/([^/]+)(?:\/live)?\/?$/.exec(n.pathname))==null?void 0:r[1];if(d&&Wne.test(d))return{kind:"youtube-channel",url:a,channel:d};const u=(c=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:c[1];if(u&&/^[A-Za-z0-9._-]{1,64}$/.test(u))return{kind:"youtube-handle",url:a,handle:u};if(n.pathname==="/watch"){const h=n.searchParams.get("v")??"";if(Gne.test(h))return{kind:"youtube-video",url:a,video:h}}return null}return Vne.test(n.pathname)?{kind:"direct-audio",url:a,format:"hls"}:$ne.test(n.pathname)?{kind:"direct-audio",url:a,format:"audio"}:/\.(html?|pls|m3u)$/i.test(n.pathname)?null:{kind:"direct-audio",url:a,format:"audio"}}function Jne(e){return e==="1"}function Yne(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];const n=new Set,a=[];for(const i of t){if(!i||typeof i!="object")continue;const o=typeof i.id=="string"?i.id:"",r=typeof i.name=="string"?i.name.trim():"",c=typeof i.url=="string"?i.url.trim():"",d=OA(c);if(!IU.test(o)||n.has(o)||!r||r.length>DU||!d)continue;n.add(o);const u=FU(i.radio);a.push({id:o,name:r,url:d.url,...u?{radio:u}:{}})}return a}function Zne(e,t,n){const a=Jm(e??"");return a&&t.some(i=>i.id===a)?kl(a):n(e)}function Xne(e,t){return e===kl(t)?"claude-fm":e}function FU(e){if(!e||typeof e!="object")return null;const t=e,n=(i,o)=>typeof t[i]=="string"?t[i].slice(0,o):"",a=(i,o)=>typeof t[i]=="number"&&Number.isFinite(t[i])&&Math.abs(t[i])<=o?t[i]: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:a("lat",90),lon:a("lon",180)}}const TN="https://www.youtube-nocookie.com";function Qne(e,t,n){const a=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${TN}/embed/${n?encodeURIComponent(n):"live_stream"}?${a.toString()}`}function _c(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function eae(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const tae=[1],nae=[0,2],aae=[2,5,100,101,150,153];function sae(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:a}=t;if(n==="onReady")return{kind:"ready"};if(n==="onAutoplayBlocked")return{kind:"blocked"};if(n==="onError"){const i=typeof a=="number"?a:Number(a==null?void 0:a.errorCode);return Number.isFinite(i)?{kind:"error",code:i}:null}if(n==="onStateChange"||n==="infoDelivery"){const i=typeof a=="number"?a:a==null?void 0:a.playerState;return typeof i!="number"||!Number.isFinite(i)?null:tae.includes(i)?{kind:"playing",playing:!0}:i===3?{kind:"buffering"}:nae.includes(i)?{kind:"playing",playing:!1}:null}return null}const zd=new Set;let H1="";function W1(e){const t=new Date().toISOString().slice(0,10);if(t!==H1&&(zd.clear(),H1=t),!zd.has(e)){zd.add(e);try{const n=typeof navigator>"u"?void 0:navigator;(!n||typeof n.sendBeacon!="function"||!n.sendBeacon("/api/feature",JSON.stringify({name:e})))&&zd.delete(e)}catch{zd.delete(e)}}}const G1=864e5,iae=6e4;function An(e,t=!0){m.useEffect(()=>{if(!t)return;W1(e);let n;const a=()=>{n=setTimeout(()=>{W1(e),a()},G1-Date.now()%G1+iae)};return a(),()=>clearTimeout(n)},[e,t])}const oae={"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 rae({fetchImpl:e,enabled:t=!0,volume:n,muted:a,source:i,playRequest:o,customStation:r,onAvailabilityChange:c}){var L;const[d,u]=m.useState(null),[h,g]=m.useState(!1),[f,b]=m.useState(!1),[k,y]=m.useState(!1),[N,w]=m.useState(!1);An("claude-fm",k);const j=m.useRef(o),S=m.useRef(null),A=m.useRef(null),T=m.useRef(void 0),q=m.useRef(null),_=m.useCallback(()=>{var O;clearTimeout(T.current),(O=A.current)==null||O.destroy(),A.current=null;const R=S.current;R&&(R.pause(),R.removeAttribute("src"),R.load(),S.current=null)},[]),I=m.useCallback(R=>{var O,D;(D=(O=q.current)==null?void 0:O.contentWindow)==null||D.postMessage(R,TN)},[]),z=m.useRef(n);z.current=n;const F=m.useRef(a);F.current=a;const U=m.useCallback((R,O,D)=>{_();const $=new Audio;$.preload="none",$.volume=z.current/100,$.muted=F.current,S.current=$,b(!0),y(!1),w(!1);let B=!1;const G=()=>S.current===$,Z=()=>{clearTimeout(T.current),_(),b(!1),y(!1),w(!1)},W=()=>{G()&&(Z(),g(!0),c==null||c(D,!0))},H=V=>{if(G()&&!(V instanceof DOMException&&V.name==="AbortError")){if(V instanceof DOMException&&V.name==="NotAllowedError"){Z();return}W()}};T.current=setTimeout(()=>{G()&&!B&&W()},15e3),$.addEventListener("playing",()=>{G()&&(clearTimeout(T.current),B=!0,y(!0),w(!1),c==null||c(D,!1))});const X=()=>{G()&&(y(!1),w(B),clearTimeout(T.current),T.current=setTimeout(()=>{G()&&W()},15e3))};$.addEventListener("waiting",X),$.addEventListener("stalled",X),$.addEventListener("ended",()=>{G()&&Z()}),$.addEventListener("error",W,{once:!0}),O&&!$.canPlayType("application/vnd.apple.mpegurl")?Hr(async()=>{const{default:V}=await import("./hls-BFpXDghs.js");return{default:V}},[]).then(({default:V})=>{if(!G())return;if(!V.isSupported()){W();return}const Q=new V;A.current=Q,Q.on(V.Events.ERROR,(Y,K)=>{K.fatal&&W()}),Q.on(V.Events.MEDIA_ATTACHED,()=>Q.loadSource(R)),Q.on(V.Events.MANIFEST_PARSED,()=>{$.play().catch(H)}),Q.attachMedia($)},W):($.src=R,$.play().catch(H))},[c,_]);m.useEffect(()=>{f&&(I(_c("setVolume",[n])),I(_c(a?"mute":"unMute")),S.current&&(S.current.volume=n/100,S.current.muted=a))},[n,a,f,I]),m.useEffect(()=>{var Z;let R=!0;const O=e??fetch,D=j.current!==o;if(j.current=o,u(null),g(!1),w(!1),b(D),y(!1),_(),!t){b(!1),y(!1);return}const $=r&&kl(r.id)===i?OA(r.url):null;if($){if($.kind==="direct-audio"){const W=$.format==="hls"||((Z=r==null?void 0:r.radio)==null?void 0:Z.hls)===!0;return u({live:!0,channel:"",audio:$.url,hls:W}),c==null||c(i,!1),D&&U($.url,W,i),()=>{R=!1}}return O(`/api/fm-station?url=${encodeURIComponent($.url)}`).then(W=>W.ok?W.json():null).then(W=>{R&&(W!=null&&W.channel||W!=null&&W.video?(u({live:!0,channel:W.channel??"",video:W.video??void 0}),c==null||c(i,!1)):(g(!0),b(!1),y(!1),w(!1),c==null||c(i,!0)))}).catch(()=>{R&&(g(!0),b(!1),y(!1),w(!1),c==null||c(i,!0))}),()=>{R=!1}}if(Jm(i))return g(!0),c==null||c(i,!0),()=>{R=!1};const B=i,G=oae[B];if(G)O(G).then(W=>W.ok?W.json():null).then(W=>{R&&(W!=null&&W.video&&u({live:!0,channel:"",video:W.video}),W!=null&&W.video||(g(!0),b(!1),y(!1)),c==null||c(i,!(W!=null&&W.video)))}).catch(()=>{R&&(g(!0),b(!1),y(!1),c==null||c(i,!0))});else if(B!=="claude-fm"){const W=B.replace("lofi-","");O(`/api/lofi-girl?station=${encodeURIComponent(W)}`).then(H=>H.ok?H.json():null).then(H=>{R&&(H!=null&&H.video&&u({live:!0,channel:"",video:H.video}),H!=null&&H.video||(g(!0),b(!1),y(!1)),c==null||c(i,!(H!=null&&H.video)))}).catch(()=>{R&&(g(!0),b(!1),y(!1),c==null||c(i,!0))})}else O("/api/claude-fm").then(W=>W.ok?W.json():null).then(W=>{if(!R)return;const H=!!(W!=null&&W.live&&(W!=null&&W.channel));H&&u({live:!0,channel:W.channel}),H||(g(!0),b(!1),y(!1)),c==null||c(i,!H)}).catch(()=>{R&&(g(!0),b(!1),y(!1),c==null||c(i,!0))});return()=>{R=!1}},[r==null?void 0:r.id,r==null?void 0:r.url,(L=r==null?void 0:r.radio)==null?void 0:L.hls,t,e,c,o,i,U,_]),m.useEffect(()=>()=>_(),[_]),m.useEffect(()=>{if(!f||d!=null&&d.audio)return;let R;const O=()=>{clearTimeout(R),R=void 0,b(!1),y(!1),w(!1),g(!0),c==null||c(i,!0)},D=()=>{R??(R=setTimeout(O,15e3))};D();const $=B=>{var Z;if(B.origin!==TN||B.source!==((Z=q.current)==null?void 0:Z.contentWindow))return;const G=sae(B.data);if(G){if(G.kind==="ready"){I(_c("setVolume",[z.current])),I(_c(F.current?"mute":"unMute")),I(_c("playVideo"));return}if(G.kind==="blocked"){clearTimeout(R),R=void 0,b(!1),y(!1),w(!1);return}if(G.kind==="buffering"){y(!1),w(!0),D();return}if(G.kind==="playing"){clearTimeout(R),R=void 0,y(G.playing),w(!1),G.playing||b(!1);return}aae.includes(G.code)&&O()}};return window.addEventListener("message",$),()=>{clearTimeout(R),window.removeEventListener("message",$)}},[f,d==null?void 0:d.audio,o,c,I,i]);const P=m.useCallback(()=>{if(d){if(d.audio){if(f){_(),b(!1),y(!1),w(!1);return}U(d.audio,d.hls===!0,i);return}if(!f){b(!0),y(!1),w(!1);return}I(_c("pauseVideo")),b(!1),y(!1),w(!1)}},[d,f,k,i,I,U,_]);return m.useMemo(()=>({probe:d,dead:h,armed:f,playing:k,buffering:N,frame:q,say:I,press:P}),[d,h,f,k,N,I,P])}const $1="agent-dag.radio-favorites",V1="agent-dag.radio-recent",K1="agent-dag.radio-catalogue";function cae(e){if(!Array.isArray(e))return[];const t=new Set;return e.slice(0,300).flatMap(n=>{if(!n||typeof n!="object")return[];const a=n,i=typeof a.id=="string"?a.id:"",o=typeof a.name=="string"?a.name.trim().slice(0,80):"",r=typeof a.url=="string"?OA(a.url):null,c=FU(a.radio??a);return!/^radio-[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(i)||!o||!c||!r||r.kind!=="direct-audio"||t.has(i)?[]:(t.add(i),[{id:i,name:o,url:r.url,radio:c}])})}function J1(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 lae(e,t){return[t,...e.filter(n=>n!==t)].slice(0,50)}function o1e(e,t,n=Math.random){const a=e.filter(i=>i.id!==t);return a.length?a[Math.min(a.length-1,Math.floor(Math.max(0,n())*a.length))]:null}function r1e(e,t,n){if(!e.length)return null;const a=e.findIndex(o=>o.id===t),i=e[a<0?n===1?0:e.length-1:(a+n+e.length)%e.length];return i.id===t?null:i}function UU(e,t,n){const a=e.findIndex(i=>i.id===t);for(let i=1;i<=e.length;i++){const o=e[(a+i)%e.length];if(o.id!==t&&!n.has(o.id))return o}return null}function c1e(e,t){if(!e.length)return null;const n=[...e].sort((i,o)=>i.id.localeCompare(o.id));let a=0;for(const i of t)a=Math.imul(a,31)+i.charCodeAt(0)>>>0;return n[a%n.length]}function l1e(e,t,n,a,i){return(!t||`${e.name} ${e.radio.country} ${e.radio.region} ${e.radio.tags}`.toLowerCase().includes(t.toLowerCase()))&&(!n||e.radio.countryCode===n)&&(!a||e.radio.tags.toLowerCase().includes(a.toLowerCase()))&&(!i||e.radio.language.toLowerCase().includes(i.toLowerCase()))}function dae(){const[e,t]=m.useState(()=>J1(ht($1))),[n,a]=m.useState(()=>J1(ht(V1))),[i,o]=m.useState(()=>{try{return cae(JSON.parse(ht(K1)??"[]"))}catch{return[]}});m.useEffect(()=>{pt($1,JSON.stringify(e))},[e]),m.useEffect(()=>{pt(V1,JSON.stringify(n))},[n]);const r=m.useCallback(u=>a(h=>lae(h,u)),[]),c=m.useCallback(u=>t(h=>h.includes(u)?h.filter(g=>g!==u):[...h,u].slice(-100)),[]),d=m.useCallback(u=>{o(u),pt(K1,JSON.stringify(u))},[]);return{favorites:e,recent:n,catalogue:i,remember:r,toggleFavorite:c,updateCatalogue:d}}function uae(e,t,n,a){const i=UU(e,t,n);if(!i)return()=>{};const o=setTimeout(()=>{n.add(t),a(i)},1e3);return()=>clearTimeout(o)}const Ym=148,Y1=6e3,hae=16e3,BU=46,wo=34;function pae(e,t,n=Ym){let a=-Math.round(t()*n);if(Math.abs(a-e)<wo){const i=e-wo>=-n?-wo:wo;a=Math.max(-n,Math.min(0,Math.round(e+i)))}return{to:a,ms:Math.round(Math.abs(a-e)*BU)}}function gae(e){return Math.round(Y1+e()*(hae-Y1))}const Z1=[{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 mae(e){const t=Z1.reduce((a,i)=>a+i.weight,0);let n=e()*t;for(const a of Z1)if(n-=a.weight,n<0)return a.kind;return"stroll"}const fae=720,bae=260,vae=620,kae=220,X1=520,HU=1600,Q1=7e3,wae=15e3,eq=6e3,yae=14e3;function zc(e,t,n=Ym){let a=-Math.round(t()*n);if(Math.abs(a-e)<wo){const i=e-wo>=-n?-wo:wo;a=Math.max(-n,Math.min(0,Math.round(e+i)))}return a}const vn=(e,t)=>Math.round(Math.abs(t-e)*BU),xae=120,Dp=0;function Cae(e,t){const n=a=>({kind:"litter",at:t,...a});return[{x:t,prop:n({}),act:"walk",ms:vn(e,t)},{x:t,prop:n({}),act:"stoop",ms:fae},{x:Dp,prop:n({held:!0}),act:"carry",ms:vn(t,Dp)},{x:Dp,prop:n({held:!0}),act:"windup",ms:bae},{x:Dp,prop:n({held:!0,leaving:!0}),act:"toss",ms:vae}]}function Sae(e,t){const n=t>e?1:-1,a=t-n*Math.min(15,Math.abs(t-e)),i=(o={})=>({kind:"ball",at:t,...o});return[{x:a,prop:i(),act:"walk",ms:vn(e,a)},{x:a,prop:i(),act:"windup",ms:kae,facing:n>0?"right":"left"},{x:a,prop:i({leaving:!0}),act:"kick",ms:X1,facing:n>0?"right":"left"},{x:a,prop:i({leaving:!0}),act:"stand",ms:HU-X1}]}const WU=640;function Nae(e,t,n){const a=Math.max(-70,Math.min(-20,t)),i={x:a,prop:null,facing:"left"};return[{x:a,prop:null,act:"walk",ms:vn(e,a)},{...i,act:"sit",ms:600},{...i,act:"cast",ms:900},{...i,act:"fish",ms:6e3+Math.round(n()*4e3)},{...i,act:"reel",ms:1200},{...i,act:"stow",ms:500},{...i,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:vn(a,0)}]}function jae(e,t,n){const a=Math.max(-110,Math.min(-30,t)),i={x:a,prop:null};return[{...i,act:"walk",ms:vn(e,a)},{...i,act:"skip-ready",ms:500},{...i,act:"skip",ms:WU*(6+Math.floor(n()*5))},{...i,act:"skip-rest",ms:600},{...i,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:vn(a,0)}]}function Aae(e,t,n){return[{x:t,prop:null,act:"walk",ms:vn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(eq+n()*(yae-eq))},{x:t,prop:null,act:"stand",ms:400}]}function Tae(e,t,n){t=Math.max(-110,Math.min(0,t));const a=()=>({kind:"scope",at:t,held:!0});return[{x:t,prop:null,act:"walk",ms:vn(e,t)},{x:t,prop:a(),act:"watch",ms:Math.round(Q1+n()*(wae-Q1))},{x:t,prop:a(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function Wv(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 Rae=1500,Eae=e=>Math.round(1e3*Math.sqrt(2*e/Rae)),qae=115,_ae=e=>Math.round(e/qae*1e3),zae=620,Lae=200,Oae=760,Pae=600,Mae=240;function Iae(e,t,n){const i=-(t.ledgeSpan??Ym),o=Eae(t.ledgeH),r=_ae(t.ledgeH),c=n(),d=n(),u=-Math.round(c*t.floorSpan),h=-Math.round(d*t.floorSpan);return[{x:i,act:"walk",prop:null,ms:vn(e,i)},{x:i,act:"peer",prop:null,ms:zae},{x:i,act:"fall",prop:null,ms:o,place:"floor"},{x:i,act:"land",prop:null,ms:Lae,place:"floor"},{x:u,act:"walk",prop:null,ms:vn(i,u),place:"floor",floorFrac:c},{x:h,act:"walk",prop:null,ms:vn(u,h),place:"floor",floorFrac:d},{x:i,act:"walk",prop:null,ms:vn(h,i),place:"floor"},{x:i,act:"lasso",prop:null,ms:Oae,place:"floor"},{x:i,act:"rope-throw",prop:null,ms:Pae,place:"floor"},{x:i,act:"rope-catch",prop:null,ms:Mae,place:"floor"},{x:i,act:"climb",prop:null,ms:r},{x:i,act:"pull-up",prop:null,ms:480}]}function Dae(e,t,n){const a=(n==null?void 0:n.ledgeSpan)??Ym;switch(mae(t)){case"tidy":return Cae(e,zc(e,t,a));case"kick":return Sae(e,zc(e,t,a));case"sit":return Aae(e,zc(e,t,a),t);case"watch":return Tae(e,zc(e,t,a),t);case"fish":return Nae(e,zc(e,t,a),t);case"skip":return jae(e,zc(e,t,a),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return Iae(e,n,t)}}const o=pae(e,t,a);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const Fae=420;function Uae(e,t,n){const a=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(Fae,Math.max(0,a))}const Bae=260,Hae=200;function Wae(e,t,n){const a=(h,g=vn(e,h))=>({x:h,prop:null,act:"walk",ms:g,place:"floor"});if(!n||n.height<=0)return[a(t)];const i=Math.min(e,t);if(Math.max(e,t)<=n.left||i>=n.right)return[a(t)];const r=t>e,c=r?n.left:n.right,d=r?n.right:n.left,u={place:"floor",riser:n.height,prop:null};return[a(c,vn(e,c)),{...u,x:c,act:"mount",ms:Bae},{...u,x:d,act:"walk",ms:vn(c,d)},{x:d,prop:null,act:"dismount",ms:Hae,place:"floor"},{x:t,prop:null,act:"walk",ms:vn(d,t),place:"floor"}]}const GU=["bob","sway","groove"],tq=9e3,Gae=16e3,$U=1e3,$ae=.08;function Vae(e,t){const n=GU.filter(o=>o!==e),a=n[Math.min(n.length-1,Math.floor(t()*n.length))],i=(t()*2-1)*$ae;return{dance:a,beatMs:Math.round($U*(1+i))}}function Kae(e){return Math.round(tq+e()*(Gae-tq))}const PA=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],nq=18,Jae=PA.length,VU="M6 9H4V1H5V0H7V-1H9V1H7V2H5V7H6V8H7V9Z",KU="M12 9H14V6H13V3H11V2H9V4H12Z",MA=new Set(["a","c","p"]);function Oo(e=PA){const t=[];return e.forEach((n,a)=>{let i=0;for(;i<n.length;){const o=n[i];if(o==="."){i+=1;continue}let r=1;for(;i+r<n.length&&n[i+r]===o;)r+=1;t.push({x:i,y:a,w:r,cell:o}),i+=r}}),t}const Yae=[".xx.","xxxx",".xx."],Zae=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],Xae=["...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."],Gv={litter:Yae,ball:Zae,scope:Xae},Qae=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],ese=3,tse=-1,RN=11,aq=9;function sq(e){let t=null,n=null,a=0,i=0,o=!1;const r=()=>{t!==null&&clearTimeout(t),t=null},c=()=>{o||e.hidden||!n||t!==null||(i=performance.now(),t=setTimeout(()=>{t=null;const u=n;n=null,u==null||u()},a))},d=()=>{e.hidden&&t!==null?(a=Math.max(0,a-(performance.now()-i)),r()):e.hidden||c()};return e.addEventListener("visibilitychange",d),{schedule(u,h){o||(r(),n=u,a=Math.max(0,h),c())},dispose(){o=!0,r(),n=null,e.removeEventListener("visibilitychange",d)}}}function nse(e,t,n){const[a,i]=m.useState(0),[o,r]=m.useState(0),[c,d]=m.useState(null),[u,h]=m.useState(null),[g,f]=m.useState({x:0,drop:0}),[b,k]=m.useState("ledge"),[y,N]=m.useState("left"),[w,j]=m.useState(0),S=m.useRef(null),[A,T]=m.useState(()=>document.hidden);m.useEffect(()=>{const P=new Set,L=()=>{var R;if(document.hidden){for(const O of((R=S.current)==null?void 0:R.getAnimations({subtree:!0}))??[])if(O.playState==="running"||O.pending){const D=O.currentTime;O.pause(),D!==null&&(O.currentTime=D),P.add(O)}}else{for(const O of P)O.playState==="paused"&&O.play();P.clear()}T(document.hidden)};return L(),document.addEventListener("visibilitychange",L),()=>document.removeEventListener("visibilitychange",L)},[e,t]);const[q,_]=m.useState(null),[I,z]=m.useState($U),[F,U]=m.useState(()=>{var P;return((P=window.matchMedia)==null?void 0:P.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return m.useEffect(()=>{var R;const P=(R=window.matchMedia)==null?void 0:R.call(window,"(prefers-reduced-motion: reduce)");if(!P)return;const L=()=>U(P.matches);return L(),P.addEventListener("change",L),()=>P.removeEventListener("change",L)},[]),m.useEffect(()=>{var K;if(!e||t||F)return;const P=sq(document);let L=0;i(ee=>L=ee);let R=null,O=0,D=0;const $=ee=>{var pe,ae;const[te,...ce]=ee;if(!te){R=null,d(null),h(null),V();return}d(te.act),h(te.prop),k(te.place??"ledge"),j(te.riser??0);const ge=L,ve=H(te);if(te.act==="kick"){const le=(ae=(pe=S.current)==null?void 0:pe.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:ae.getBoundingClientRect();le&&f({x:Uae(le.x,Wv(te,ge,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-le.y+24)})}D=te.act==="walk"?Math.max(vn(ge,ve),xae):te.ms,te.act==="carry"&&(D=vn(ge,ve)),r(D),N(le=>Wv({...te,x:ve},ge,le)),i(ve),L=ve,R=te,O=Date.now(),P.schedule(()=>$(ce),D)},B=()=>{const ee=S.current,te=ee==null?void 0:ee.querySelector(".fm-sprite"),ce=ee==null?void 0:ee.parentElement;if(!ee||!te||!ce)return null;const ge=ee.getBoundingClientRect(),ve=ce.getBoundingClientRect(),pe=ve.right-ge.right,ae=ve.width-pe*2-te.offsetWidth;return ae>0?ae:null},G=()=>{const ee=S.current,te=ee==null?void 0:ee.querySelector(".fm-sprite");return!ee||!te?0:Math.max(0,ee.getBoundingClientRect().width-te.offsetWidth)},Z=()=>{const ee=S.current,te=ee==null?void 0:ee.querySelector(".fm-walker"),ce=B();if(!ee||!te||ce==null)return;const ge=ee.getBoundingClientRect().bottom-te.getBoundingClientRect().bottom;if(ge>0)return{ledgeH:ge,floorSpan:ce,ledgeSpan:G()}},W=()=>{const ee=S.current,te=document.querySelector(".canvas-notices");if(!ee||!te)return null;const ce=ee.getBoundingClientRect(),ge=te.getBoundingClientRect();return ge.width<=0||ge.height<=0?null:{left:ge.left-ce.right,right:ge.right-ce.right,height:ge.height}},H=ee=>{const te=(ee.place??"ledge")==="floor",ce=te?B()??G():G(),ge=te&&ee.floorFrac!=null?-Math.round(ee.floorFrac*ce):ee.x;return Math.max(-ce,Math.min(0,ge))},X=()=>{if(!R)return;const ee=H(R);ee!==L&&(r(Math.max(0,O+D-Date.now())),N(te=>Wv({...R,x:ee},L,te)),i(ee),L=ee)},V=()=>{P.schedule(()=>{const ee=Dae(L,Math.random,Z()),te=ee.some(ve=>ve.place==="floor")?W():null;let ce=L;const ge=ee.flatMap(ve=>{const pe=ce;if(ce=ve.x,!(ve.place==="floor"&&ve.act==="walk"))return[ve];const ae=Wae(pe,ve.x,te),le=ae.length-1;return ve.floorFrac==null?ae:ae.map((Se,ke)=>ke===le?{...Se,floorFrac:ve.floorFrac}:Se)});$(ge)},gae(Math.random))},Q=(K=S.current)==null?void 0:K.parentElement,Y=typeof ResizeObserver>"u"?null:new ResizeObserver(X);return Q&&Y&&Y.observe(Q),V(),()=>{P.dispose(),Y==null||Y.disconnect(),k("ledge"),i(ee=>Math.max(-G(),Math.min(0,ee))),r(0),d(null),h(null),j(0)}},[e,t,F]),m.useEffect(()=>{if(!n||F){_(null);return}const P=sq(document),L=R=>{const O=Vae(R,Math.random);_(O.dance),z(O.beatMs),P.schedule(()=>L(O.dance),Kae(Math.random))};return L(null),()=>P.dispose()},[n,F]),{scene:S,suspended:A,x:a,walkMs:o,act:c,prop:u,ballFlight:g,place:b,facing:y,riser:w,dance:q,beatMs:I}}const $v={e:"fm-eye",s:"fm-shade",p:"fm-pad"},Jg=Oo().filter(e=>!MA.has(e.cell)),ase=Oo().filter(e=>MA.has(e.cell)),iq=Jg.filter(e=>e.cell==="e"),sse=Oo(Qae),ise=Jg.filter(e=>e.y<RN&&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),ose={left:Jg.filter(e=>e.y>=RN&&e.x<aq),right:Jg.filter(e=>e.y>=RN&&e.x>=aq)},rse=m.memo(function({act:t,facing:n}){return s.jsxs("svg",{viewBox:`0 0 ${nq} ${Jae}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsx("g",{className:"fm-gear",children:s.jsx("g",{className:"fm-gear-motion",children:ase.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:$v[a.cell]},`g${a.y}-${a.x}`))})}),s.jsxs("g",{className:"fm-body",children:[iq.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:"var(--accent)"},`eye-bed-${a.x}`)),ise.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:$v[a.cell]},`b${a.y}-${a.x}`)),s.jsxs("g",{className:"fm-arms",children:[s.jsx("rect",{x:4,y:8,width:2,height:2}),s.jsx("rect",{x:12,y:8,width:1,height:2}),s.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),iq.map(a=>s.jsx("rect",{x:a.x-(a.x>=nq/2?1:0)+(n==="right"?1:0),y:a.y,width:a.w,height:1,className:"fm-eye"},`eye-${a.x}`))]}),s.jsx("g",{className:"fm-hat",children:sse.map(a=>s.jsx("rect",{x:ese+a.x,y:tse+a.y,width:a.w,height:1,className:a.cell==="k"?"fm-hatband":void 0},`h${a.y}-${a.x}`))}),(t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up")&&s.jsxs("g",{className:"fm-grip",children:[s.jsx("path",{className:"fm-grip-left",d:VU}),s.jsx("path",{className:"fm-grip-right",d:KU})]}),(t==="land"||t==="dismount")&&s.jsxs("g",{className:"fm-crouch-legs",children:[s.jsx("path",{d:"M6 11H8V13H6Z"}),s.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(t)&&s.jsxs("g",{className:"fm-seated-legs",children:[s.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),s.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(a=>s.jsx("g",{className:"fm-leg","data-side":a,children:ose[a].map(i=>s.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,className:$v[i.cell]},`${a}${i.y}-${i.x}`))},a))]})}),cse=["...o........o.....","...of......fo.....","...owffffffwo.....","...offfffffso.....","...ofefffefso.....","....owwnwwso......",".....wwwww........",".....fwwwfs.......","....ffwwwffs...ww.","....ffwwwffs..wfs.","......fwwfssfffs..","......ff..fsffs...","......ff..fs......","......oo..oo......"],lse=[".....aaaaaaa......","...aa.......aa....","..a...........a...","..cp.........pc...","..cp.........pc...","..cp.........pc...","..c...........c..."],Gs={f:"#d88735",s:"#a55b24",o:"#63351e",w:"#ffe2aa",n:"#372821"},dse={p:"fm-pad"},Ru=Oo(cse),use=Oo(lse);function EN(e,t,n){return e.map(a=>({...a,x:Math.max(t,a.x),w:Math.max(0,Math.min(n,a.x+a.w)-Math.max(t,a.x))})).filter(a=>a.w>0)}const hse=EN(Ru.filter(e=>e.y>=8),12,18),pse=Ru.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),oq=Ru.filter(e=>e.cell==="e"),gse={left:EN(Ru.filter(e=>e.y>=11),0,9),right:EN(Ru.filter(e=>e.y>=11),9,12)},mse=m.memo(function({act:t,facing:n}){const a=t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up",i=t==="land"||t==="dismount",o=t==="sit"||t==="cast"||t==="fish"||t==="reel"||t==="stow";return s.jsxs("svg",{"data-character":"fox",viewBox:"0 0 18 14",shapeRendering:"crispEdges","aria-hidden":!0,focusable:"false",children:[s.jsx("g",{className:"fm-body","data-part":"tail",children:hse.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:Gs[r.cell]},`t${r.y}-${r.x}`))}),s.jsx("g",{className:"fm-gear",children:s.jsx("g",{className:"fm-gear-motion",children:use.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:dse[r.cell]},`g${r.y}-${r.x}`))})}),s.jsxs("g",{className:"fm-body",children:[pse.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:Gs[r.cell]},`b${r.y}-${r.x}`)),oq.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:Gs.f},`bed${r.x}`)),s.jsxs("g",{className:"fm-arms",fill:Gs.f,children:[s.jsx("rect",{x:4,y:8,width:2,height:2}),s.jsx("rect",{x:12,y:8,width:1,height:2})]}),oq.map(r=>s.jsx("rect",{x:r.x+(n==="right"?1:0)-(r.x>=9?1:0),y:r.y,width:r.w,height:1,className:"fm-eye",style:{fill:Gs.n}},`e${r.x}`))]}),a&&s.jsxs("g",{className:"fm-grip",style:{fill:Gs.f},children:[s.jsx("path",{className:"fm-grip-left",d:VU}),s.jsx("path",{className:"fm-grip-right",d:KU})]}),i&&s.jsxs("g",{className:"fm-crouch-legs",style:{fill:Gs.f},children:[s.jsx("path",{d:"M6 11H8V13H6Z"}),s.jsx("path",{d:"M10 11H12V13H10Z"})]}),o&&s.jsxs("g",{className:"fm-seated-legs",style:{fill:Gs.f},children:[s.jsx("path",{className:"fm-seated-far",style:{fill:Gs.s},d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),s.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(r=>s.jsx("g",{className:"fm-leg","data-side":r,children:gse[r].map(c=>s.jsx("rect",{x:c.x,y:c.y,width:c.w,height:1,fill:Gs[c.cell]},`${c.y}-${c.x}`))},r))]})}),fse=[".......dddd.......","......dhhhhd......",".....dhhhhhhd.....","....dhwwhhwwhd....","....dhwewwewhd....","....dhwwbbwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....",".....dhwwwwhd.....",".....dhwwwwhd.....","......dhhhhd......","......bb..bb......",".....bbb..bbb....."],xi={d:"#3b4855",h:"#657b8b",w:"#f4f0df",e:"#19242b",b:"#f0b44b",s:"#c88736"},bse={p:"fm-pad"},Yg=Oo(fse),vse=Oo(PA).filter(e=>MA.has(e.cell)),rq=Yg.filter(e=>e.cell==="e"),kse=Yg.filter(e=>e.y<12&&e.cell!=="e"),wse={left:Yg.filter(e=>e.y>=12&&e.x<9),right:Yg.filter(e=>e.y>=12&&e.x>=9)},yse=m.memo(function({act:t}){const n=t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up",a=t==="land"||t==="dismount",i=t==="sit"||t==="cast"||t==="fish"||t==="reel"||t==="stow";return s.jsxs("svg",{"data-character":"penguin",viewBox:"0 0 18 14",shapeRendering:"crispEdges","aria-hidden":!0,focusable:"false",children:[s.jsx("g",{className:"fm-gear",children:s.jsx("g",{className:"fm-gear-motion",children:vse.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:bse[o.cell]},`g${o.y}-${o.x}`))})}),s.jsxs("g",{className:"fm-body",children:[kse.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:xi[o.cell]},`b${o.y}-${o.x}`)),rq.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:xi.w},`bed${o.x}`)),s.jsxs("g",{className:"fm-arms",fill:xi.d,children:[s.jsx("path",{d:"M4 8H6V10H5V11H4Z"}),s.jsx("path",{d:"M12 8H14V11H13V10H12Z"})]}),rq.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:"fm-eye",style:{fill:xi.e}},`e${o.x}`))]}),n&&s.jsxs("g",{className:"fm-grip",style:{fill:xi.h},children:[s.jsx("path",{className:"fm-grip-left",d:"M5 10H4V4H5V2H6V1H7V0H9V2H7V3H6V10Z"}),s.jsx("path",{className:"fm-grip-right",d:"M12 10H14V6H13V3H11V2H9V4H12Z"})]}),a&&s.jsxs("g",{className:"fm-crouch-legs",style:{fill:xi.b},children:[s.jsx("path",{d:"M5 12H8V13H5Z"}),s.jsx("path",{d:"M10 12H13V13H10Z"})]}),i&&s.jsxs("g",{className:"fm-seated-legs",style:{fill:xi.b},children:[s.jsx("path",{className:"fm-seated-far",style:{fill:xi.s},d:"M10 11H12V12H13V14H10V13H11V12H10Z"}),s.jsx("path",{d:"M6 11H8V12H7V13H8V14H4V13H5V12H6Z"})]}),["left","right"].map(o=>s.jsx("g",{className:"fm-leg","data-side":o,children:wse[o].map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:xi.b},`${r.y}-${r.x}`))},o))]})});function JU({character:e,act:t,facing:n}){return e==="penguin"?s.jsx(yse,{act:t,facing:n}):e==="fox"?s.jsx(mse,{act:t,facing:n}):s.jsx(rse,{act:t,facing:n})}const xse={"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 YU(e,t,n=x){return t&&kl(t.id)===e?t.name:Jm(e)?n("radio.fm.custom"):xse[e]}function Vv(e,t){var a;const n=((a=e[0])==null?void 0:a.length)??0;return s.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:Oo(e).map(i=>s.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:i.cell==="s"?"var(--fm-prop-shadow, var(--bg))":i.cell==="l"?"var(--fm-prop-light, var(--text))":i.cell==="a"?"var(--accent)":void 0},`${t}${i.y}-${i.x}`))})}const cq={litter:Vv(Gv.litter,"litter"),ball:Vv(Gv.ball,"ball"),scope:Vv(Gv.scope,"scope")};function Cse(e,t=x){try{return new URL(e).host}catch{return t("radio.fm.server")}}const Sse=m.memo(function({player:t,source:n,customStation:a,character:i="deck"}){const o=se(),{probe:r,dead:c,playing:d,press:u}=t,{scene:h,suspended:g,x:f,walkMs:b,act:k,prop:y,ballFlight:N,place:w,facing:j,riser:S,dance:A,beatMs:T}=nse(r,c,d);if(!r||c)return null;const q=YU(n,a,o),_=r.audio?Cse(r.audio,o):"YouTube";return s.jsxs("div",{ref:h,className:"fm","data-suspended":g?"":void 0,"data-place":w,style:{"--fm-beat":`${T}ms`},children:[y&&!y.held&&s.jsx("div",{className:"fm-prop","data-prop":y.kind,"data-leaving":y.leaving?"":void 0,style:{"--fm-prop-x":`${y.at}px`,"--fm-roll-to":`${N.x}px`,"--fm-ball-drop":`${N.drop}px`,"--fm-ball-flight-ms":`${HU}ms`,"--fm-ball-turn":j==="right"?"1080deg":"-1080deg"},children:cq[y.kind]}),(k==="lasso"||k==="rope-throw"||k==="rope-catch"||k==="climb"||k==="pull-up")&&s.jsxs("div",{className:"fm-rope","data-act":k,style:{"--fm-rope-x":`${f}px`,"--fm-rope-ms":`${b}ms`},children:[s.jsx("div",{className:"fm-rope-line"}),s.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),s.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),s.jsxs("div",{className:"fm-walker","data-act":k??void 0,"data-place":w,"data-facing":j,style:{"--fm-x":`${f}px`,"--fm-walk-ms":`${b}ms`,"--fm-riser":`${S}px`,"--fm-skip-beat":`${WU}ms`},children:[(y==null?void 0:y.held)&&s.jsx("div",{className:"fm-held","data-prop":y.kind,"data-toss":y.leaving?"":void 0,children:cq[y.kind]}),["cast","fish","reel","stow"].includes(k)&&s.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsxs("g",{children:[s.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),s.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),s.jsxs("g",{className:"fm-fishing-line",children:[s.jsx("path",{d:"M8 2V26"}),s.jsxs("g",{className:"fm-float",children:[s.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),s.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),s.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(k)&&s.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),s.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),s.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),s.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),s.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),s.jsx("button",{type:"button",className:"fm-sprite","data-playing":d?"":void 0,"data-dance":d?A??GU[0]:void 0,onClick:u,title:d?o("radio.fm.stop",{label:q}):o("radio.fm.playTitle",{label:q,from:_}),"aria-label":d?o("radio.fm.stop",{label:q}):o("radio.fm.play",{label:q}),children:s.jsx(JU,{character:i,act:k,facing:j})})]})]})});function Nse({player:e,label:t}){const{probe:n,armed:a,frame:i,say:o}=e;return n?s.jsx(s.Fragment,{children:a&&!n.audio&&(n.channel||n.video)&&s.jsx("iframe",{ref:i,className:"fm-frame",title:t,src:Qne(n.channel,window.location.origin,n.video),onLoad:()=>o(eae()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})}):null}const jse={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 Ase({name:e}){return s.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:s.jsx("path",{d:jse[e]})})}function Tse({opening:e=!1}){const t=se(),[n,a]=m.useState(()=>document.hidden);return m.useEffect(()=>{const i=()=>a(document.hidden);return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)},[]),s.jsxs("div",{className:"radio-tuning",role:"status","data-paused":n||void 0,children:[s.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:[s.jsxs("g",{className:"radio-tuning-tower",children:[s.jsx("circle",{cx:"40",cy:"24",r:"4"}),s.jsx("path",{d:"M40 28v60 M40 36L24 88h32L40 36 M31 66h18 M28 77h24 M20 92h40"}),s.jsx("path",{d:"M29 17a15 15 0 0 0 0 14 M51 17a15 15 0 0 1 0 14"})]}),s.jsxs("g",{className:"radio-tuning-send",children:[s.jsx("path",{d:"M75 26q7 8 0 16"}),s.jsx("path",{d:"M102 26q7 8 0 16"}),s.jsx("path",{d:"M129 26q7 8 0 16"})]}),s.jsxs("g",{className:"radio-tuning-receiver",children:[s.jsx("path",{d:"M165 49l30-22"}),s.jsx("rect",{x:"154",y:"49",width:"66",height:"43",rx:"7"}),s.jsx("path",{d:"M161 92v3 M213 92v3 M163 60h17 M163 66h17 M163 72h17 M163 78h17"}),s.jsx("circle",{cx:"202",cy:"65",r:"7"}),s.jsx("path",{d:"M202 62v3l3 2 M197 81h10"})]})]}),s.jsx("strong",{children:t(e?"radio.loading.opening":"radio.loading.tuning")}),s.jsx("span",{children:t(e?"radio.loading.ready":"radio.loading.finding")})]})}function Rse({onClose:e}){const t=se(),[n]=m.useState(()=>{var i;return((i=document.activeElement)==null?void 0:i.matches(":focus-visible"))??!1}),a=Tt(e);return s.jsxs("div",{ref:a,className:"radio-loading nodrag nopan",role:"dialog","aria-modal":"true","aria-label":t("radio.loading.opening"),"data-keyboard-interaction":n||void 0,onKeyDown:Wee,children:[s.jsx("button",{type:"button",className:"icon-btn","aria-label":t("radio.close"),onClick:e,children:s.jsx(Ase,{name:"close"})}),s.jsx(Tse,{opening:!0})]})}const Ese=m.lazy(()=>Hr(()=>import("./RadioPanel-k65VVqTb.js"),[]));function qse({fm:e,characterEnabled:t,character:n,open:a,onClose:i}){const[o,r]=m.useState(!1),c=se(),[d,u]=m.useState("connecting"),h=c(`radio.disabled.${d}`),g=dae(),[f,b]=m.useState(null),k=m.useRef(new Set);m.useEffect(()=>{const z=new AbortController;return fetch("/api/music-config",{signal:z.signal}).then(F=>F.ok?F.json():null).then(F=>{z.signal.aborted||(r((F==null?void 0:F.enabled)===!0),u(F?"off":"unreachable"))}).catch(()=>{z.signal.aborted||u("unreachable")}),()=>z.abort()},[a]);const y=e.customFmStations.find(z=>kl(z.id)===e.fmSource),N=y!=null&&y.radio?y:void 0,w=rae({volume:e.fmVolume,muted:e.fmMuted,source:e.fmSource,playRequest:e.fmPlayRequest,customStation:y,enabled:o,onAvailabilityChange:e.markFmStationAvailability}),j=YU(e.fmSource,y,c),S=o&&N&&w.dead&&e.fmPlayRequest>0?UU(f??g.catalogue,N.id,k.current):null,{remember:A}=g,T=(y==null?void 0:y.id)??e.fmSource;m.useEffect(()=>{w.playing&&A(T)},[T,w.playing,A]);const q=i,_=Rt(i),I=m.useCallback((z,F=!1)=>{var R;if(!o)return;F||k.current.clear();const U=kl(z.id),P=U===e.fmSource;if(P&&w.armed&&!w.dead){w.press();return}const L=P&&!!y&&(y.url!==z.url||((R=y.radio)==null?void 0:R.hls)!==z.radio.hls);e.addFmStation(z,!0),P&&!w.dead&&!L?w.press():e.pickFmSource(U,L),fetch(`/api/radio-click?id=${encodeURIComponent(z.id)}`).catch(()=>{})},[o,y,e.addFmStation,e.fmSource,e.pickFmSource,w.armed,w.dead,w.press]);return m.useEffect(()=>{w.playing&&!w.dead&&k.current.clear()},[w.playing,w.dead]),m.useEffect(()=>{if(!(!o||!N||!w.dead||e.fmPlayRequest===0))return uae(f??g.catalogue,N.id,k.current,z=>I(z,!0))},[o,N==null?void 0:N.id,w.dead,e.fmPlayRequest,f,g.catalogue,I]),s.jsxs(s.Fragment,{children:[t&&s.jsx(Sse,{character:n,player:w,source:e.fmSource,customStation:y}),s.jsx(Nse,{player:w,label:j}),a&&_t.createPortal(s.jsx("div",{className:"modal-backdrop radio-backdrop",..._,children:s.jsx(m.Suspense,{fallback:s.jsx(Rse,{onClose:q}),children:s.jsx(Ese,{fm:e,player:w,library:g,selected:N,label:j,enabled:o,disabledReason:h,autoNext:S==null?void 0:S.name,onPick:I,onQueueChange:b,onClose:q})})}),document.body)]})}function _se({data:e}){const t=se(),n=si(3e4),a=e.note,i=e.plan??null,o=(a==null?void 0:a.kind)==="recap",r=$g((a==null?void 0:a.at)??(i==null?void 0:i.at)??n,n),c=`${o?"recap-note":`recap-note is-status status-${(a==null?void 0:a.kind)??"plan"}`}${i?" has-plan":""}`,d=o||!a?void 0:Gm(a),u=ai(i),h=a?Rl(a.kind):`${t("board.detail.plan").toLowerCase()} ${u?`${u.done}/${u.total}`:""}`.trim();return s.jsxs("div",{className:c,role:"note","aria-label":o?t("board.node.recapLabel"):t("board.node.noteLabel",{tag:h}),"aria-description":d,style:{"--session-hue":e.hue},children:[s.jsxs("div",{className:"recap-note-head",title:d,children:[s.jsxs("span",{className:"recap-note-mark",children:[s.jsx(Gg,{recap:o}),h]}),s.jsx("span",{className:"recap-note-age",title:r.title,children:r.label}),s.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":t(o?"board.node.hideRecap":a?"board.node.hideNote":"board.node.hidePlan"),title:t("board.note.hideTitle"),onClick:g=>{g.stopPropagation(),dte(e.noteKey)},children:"×"})]}),a&&s.jsx("p",{className:"recap-note-text",title:yte(a.text,d),children:a.text}),(a==null?void 0:a.reply)&&s.jsx("p",{className:"recap-note-reply",title:t("board.list.reply",{reply:a.reply}),children:t("board.list.reply",{reply:a.reply})}),i&&s.jsx(lq,{plan:i,head:a!=null}),s.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[s.jsxs("div",{className:"lod-id",children:[s.jsxs("span",{className:"recap-note-mark",children:[s.jsx(Gg,{recap:o}),h]}),s.jsx("span",{className:"recap-face-age",children:r.label})]}),a&&s.jsx("p",{className:"recap-face-text",children:a.text}),i&&s.jsx(lq,{plan:i,head:a!=null,face:!0})]}),s.jsx(Pr,{type:"source",position:it.Right,style:{background:"transparent",border:"none"}})]})}const zse={completed:"board.state.done",in_progress:"board.detail.now",pending:"board.detail.todo"};function lq({plan:e,head:t,face:n=!1}){const a=se(),i=ai(e);if(!i)return null;const o=hQ(e.items);return s.jsxs("div",{className:n?"recap-face-plan":"recap-note-plan",title:n?void 0:zm(e.items),children:[t&&s.jsxs("div",{className:"recap-note-plan-head",children:[a("board.detail.plan")," ",s.jsxs("span",{className:"recap-note-plan-count",children:[i.done,"/",i.total,i.allDone?` · ${a("board.state.done")}`:""]})]}),!i.allDone&&s.jsxs("ol",{className:"plan-list",children:[o.shown.map((r,c)=>s.jsxs("li",{className:"plan-item","data-status":r.status,children:[s.jsx("span",{className:"plan-mark","aria-hidden":!0}),!n&&s.jsxs("span",{className:"vis-hidden",children:[a(zse[r.status]),a("board.detail.colon")]}),s.jsx("span",{className:"plan-text",children:r.status==="in_progress"&&r.active?r.active:r.text}),r.status==="in_progress"&&s.jsx("span",{className:"plan-now","aria-hidden":!0,children:a("board.detail.now")})]},r.id??`${c}:${r.text}`)),(o.before>0||o.after>0)&&s.jsx("li",{className:"recap-note-plan-more",children:[o.before>0?a("board.note.earlier",{n:o.before}):null,o.after>0?a("board.note.more",{n:o.after}):null].filter(Boolean).join(" · ")})]})]})}function Ao(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function Po(e){return/mac|iphone|ipad/i.test(e)}const Zg=e=>new Map([...e].map(([t,n])=>[t,{x:n.x,y:n.y}]));function Lse(e,t,n){return{positions:Zg(e.positions),pinned:Zg(e.pinned),provisional:new Set(e.provisional),layoutSig:e.layoutSig.current,stored:{...t},viewport:n?{...n}:null}}function Ose(e,t){t.positions.clear();for(const[n,a]of Zg(e.positions))t.positions.set(n,a);t.pinned.clear();for(const[n,a]of Zg(e.pinned))t.pinned.set(n,a);t.provisional.clear();for(const n of e.provisional)t.provisional.add(n);t.layoutSig.current=e.layoutSig}const dq=7e3,Pse=2e3,Mse=140,Ise=(e=x)=>e("board.rearrange.text"),Dse=(e=x)=>e("board.rearrange.said"),uq=(e=x)=>e("board.rearrange.restored"),Fse={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e),now:()=>Date.now()};function Use(e,t=Fse){let n=null,a=null,i=0,o=dq;const r=new Set,c=()=>{a!==null&&t.clear(a),a=null},d=()=>{c(),!(n===null||r.size>0)&&(i=t.now()+o,a=t.set(()=>{a=null,u()},o))};function u(){c(),r.clear(),n!==null&&(n=null,e(!1))}return{open(h){const g=n===null;n=h,o=dq,d(),g&&e(!0)},take(){const h=n;return u(),h},close:u,hold(h){n!==null&&(r.size===0&&a!==null&&(o=Math.max(0,i-t.now()),c()),r.add(h))},release(h){!r.delete(h)||r.size>0||n===null||(o=Math.max(o,Pse),d())},get isOpen(){return n!==null},get snapshot(){return n}}}function Bse(e){return(e.key==="z"||e.key==="Z")&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey}function Hse(e){return Po(e)?"⌘Z":"Ctrl+Z"}function Wse({undo:e}){const t=se(),{open:n,said:a,undo:i,dismiss:o,hold:r,release:c}=e,d=Vc(n,Mse),u=m.useRef(null);return m.useEffect(()=>n?jn.push(o,0,"popover"):void 0,[n,o]),m.useEffect(()=>{var g;if(n)return;const h=u.current;h&&h.contains(document.activeElement)&&((g=h.closest("main"))==null||g.focus({preventScroll:!0}))},[n]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:a}),ko(d)&&s.jsxs("div",{ref:u,className:d==="leaving"?"rearrange-undo leaving":"rearrange-undo",onPointerEnter:()=>r("hover"),onPointerLeave:()=>c("hover"),onFocus:()=>r("focus"),onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||c("focus")},children:[s.jsx("span",{id:"rearrange-undo-state",className:"rearrange-undo-state",children:Ise(t)}),s.jsxs("button",{type:"button",className:"rearrange-undo-act",onClick:i,"aria-describedby":"rearrange-undo-state","aria-keyshortcuts":"Meta+Z Control+Z",children:[t("board.rearrange.undo"),s.jsx("span",{className:"rearrange-undo-key","aria-hidden":"true",children:Hse(Ao())})]})]})]})}function Gse({sourceX:e,sourceY:t,targetX:n,targetY:a,sourcePosition:i,targetPosition:o,style:r}){const[c]=Qj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:a,targetPosition:o,curvature:.35});return s.jsxs("g",{className:"recap-tie",style:r,children:[s.jsx("path",{className:"recap-tie-thread",d:c,vectorEffect:"non-scaling-stroke"}),s.jsx("path",{className:"recap-tie-beads",d:c,vectorEffect:"non-scaling-stroke"}),s.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),s.jsx("circle",{className:"recap-tie-end",cx:n,cy:a,r:3.5})]})}function qN(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function Xg(e,t){const n=qN(e);return n?n.slice(-t):e.slice(-t)}function ZU(e,t,n=4){const a=qN(e);if(!a)return Xg(e,n);let i=n;for(const o of t){if(o===e)continue;const r=qN(o);let c=0;for(;c<a.length&&c<r.length&&a[a.length-1-c]===r[r.length-1-c];)c++;i=Math.max(i,c+1)}return a.slice(-i)}function XU(e,t=x){const n=[e.tipWorkspace,e.planLine?t("board.cluster.plan",{plan:e.planLine}):void 0,e.tipRest||void 0].filter(Boolean).join(xr);return`${e.alarm?t("board.cluster.waitingOnYou"):""}${n}
|
|
129
|
+
${t("board.node.blockedFor",{time:bl(e.since,void 0,n)})}`,children:[a?s.jsx("span",{className:"ap-pulse","aria-hidden":!0}):s.jsx("span",{className:"waiting-dot","aria-hidden":!0}),s.jsx("span",{className:"waiting-said",children:Bg(e,t)}),s.jsx("b",{children:bl(e.since,void 0,n)})]})}function Tne({tools:e,outputs:t}){const n=se(),a=si(1e3),{counts:i,title:o}=Qte(e,t,a,n),r=Bv/sl;return s.jsxs("div",{className:"tool-spark-row",title:o,children:[s.jsx("svg",{className:"tool-spark",width:Bv,height:bg,viewBox:`0 0 ${Bv} ${bg}`,"aria-hidden":!0,children:i.map((c,d)=>{const u=tne(c),h=d===sl-1&&c>0,f=`tool-spark-bar${c>0?" active":""}${h?" latest":""}`;return s.jsx("rect",{x:d*r+.4,y:bg-u,width:Math.max(.5,r-1),height:u,rx:.8,className:f},h?`landed:${c}`:d)})}),s.jsx("span",{className:"tool-spark-label",children:"60s"})]})}function Rne({enableAutoFitAndRefit:e}){const t=se();return s.jsxs("div",{className:"autofit-chip",children:[s.jsx("span",{className:"autofit-state",title:t("accounts.autoFit.offTip"),children:t("accounts.autoFit.off")}),s.jsx("button",{type:"button",className:"autofit-resume",onClick:e,title:t("accounts.autoFit.resumeTip"),"aria-label":t("accounts.autoFit.resumeLabel"),children:t("accounts.autoFit.resume")})]})}const LA="agent-dag.single-key-shortcuts";function LU(e){return e!=="0"}function OU(e){return e.length===1}function Ene(e,t){return!t&&OU(e)}function zn(e,t,n){return n?`${e} (${t})`:e}let Rr=null;const Yd=new Set;function PU(){for(const e of Yd)e()}function jN(){return Rr===null&&(Rr=LU(ht(LA))),Rr}function qne(e){Rr!==e&&(Rr=e,pt(LA,e?"1":"0"),PU())}function M1(e){if(e.key!==LA)return;const t=LU(e.newValue);t!==Rr&&(Rr=t,PU())}function _ne(e){var t;return Yd.add(e),Yd.size===1&&typeof window<"u"&&((t=window.addEventListener)==null||t.call(window,"storage",M1)),()=>{var n;Yd.delete(e),Yd.size===0&&typeof window<"u"&&((n=window.removeEventListener)==null||n.call(window,"storage",M1))}}function Kg(e,t=x){const n=Math.max(0,Math.floor(e));return t("board.pill.events",{count:n})}const I1=99;function zne(e){const t=Math.max(0,Math.floor(e));return t>I1?`${I1}+`:String(t)}const Lne=(e=x)=>e("board.pill.pause");function One(e,t=x){const n=e.singleKeys??!0;if(!e.paused)return zn(t("board.pill.title.pause"),"Space",n);const a=Math.max(0,Math.floor(e.dropped??0));return a>0?zn(t("board.pill.title.full",{held:Kg(e.held,t),count:a}),"Space",n):e.held<=0?zn(t("board.pill.title.nothing"),"Space",n):zn(t("board.pill.title.arrived",{held:Kg(e.held,t)}),"Space",n)}function Pne(e,t=x){return e.connected||!e.paused?null:t("board.pill.outage")}const MU=e=>e("board.pill.pausedFull"),Mne=(e,t,n)=>t>0?MU(n):e>0?n("board.pill.pausedCount",{held:zne(e)}):n("board.pill.paused");function Ine(e,t=x){const n=Math.max(0,Math.floor(e.dropped??0)),a=e.singleKeys??!0;return e.connected?e.paused?{tone:"paused",resting:!1,label:Mne(e.held,n,t),widest:MU(t),title:zn(n>0?t("board.pill.title.connectedFull",{held:Kg(e.held,t)}):e.held>0?t("board.pill.title.connectedHeld",{held:Kg(e.held,t)}):t("board.pill.title.connectedNone"),"Space",a)}:{tone:"live",resting:!0,label:t("board.pill.live"),widest:t("board.pill.live"),title:t("board.pill.title.live")}:{tone:"dead",resting:!1,label:t("board.pill.offline"),widest:t("board.pill.offline"),title:e.paused?t("board.pill.title.offlinePaused"):t("board.pill.title.offline")}}function On(){return m.useSyncExternalStore(_ne,jN,jN)}const Dne=e=>e.transform[2]>=e.maxZoom,Fne=e=>e.transform[2]<=e.minZoom;function Une({autoFitDisabled:e,enableAutoFitAndRefit:t,paused:n,pauseGate:a,togglePause:i,handleRelayout:o,requestClear:r,setKeyHelpOpen:c}){const d=se(),u=Cl(),h=jt(Dne),g=jt(Fne),f=On();return s.jsxs(x8,{showInteractive:!1,showFitView:!1,showZoom:!1,children:[s.jsx(Ga,{onClick:()=>{h||u.zoomIn()},title:d("board.controls.zoomIn"),"aria-label":d("board.controls.zoomIn"),"aria-disabled":h||void 0,children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:s.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),s.jsx(Ga,{onClick:()=>{g||u.zoomOut()},title:d("board.controls.zoomOut"),"aria-label":d("board.controls.zoomOut"),"aria-disabled":g||void 0,children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:s.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),s.jsx(Ga,{onClick:t,title:d(e?"board.controls.recenterOn":"board.controls.recenterAuto"),"aria-label":d("board.controls.recenter"),"data-nudge":e?"":void 0,children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"12",r:"3.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),s.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),s.jsx(Ga,{"data-group-start":"",onClick:i,title:One({paused:n,held:a.size,dropped:a.dropped,singleKeys:f},d),"aria-label":Lne(d),"aria-pressed":n,children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:s.jsx("path",{d:"M9 5.5v13M15 5.5v13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})})}),s.jsx(Ga,{onClick:o,title:zn(d("board.controls.arrange"),"R",f),"aria-label":d("board.controls.arrangeLabel"),children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[s.jsx("rect",{x:"8.5",y:"2",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),s.jsx("rect",{x:"1.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),s.jsx("rect",{x:"15.5",y:"17",width:"7",height:"5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),s.jsx("path",{d:"M12 7v6.5M5 17v-3.5h14V17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),s.jsx(Ga,{"data-group-start":"","data-danger":"",onClick:()=>r("button"),title:zn(d("board.controls.clear"),"C",f),"aria-label":d("board.controls.clearLabel"),children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[s.jsx("path",{d:"M4 6.2h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),s.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"}),s.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"}),s.jsx("path",{d:"M10.3 10.6v6.8M13.7 10.6v6.8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",fill:"none"})]})}),s.jsx(Ga,{"data-group-start":"",onClick:()=>c(b=>!b),title:f?zn(d("board.controls.keys"),"?",!0):d("board.controls.keysOff"),"aria-label":d("board.controls.keysLabel"),"aria-haspopup":"dialog",children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":!0,children:[s.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"}),s.jsx("path",{d:"M12 18.4v.2",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",fill:"none"})]})})]})}const Bne="modulepreload",Hne=function(e){return"/"+e},D1={},Hr=function(t,n,a){let i=Promise.resolve();if(n&&n.length>0){let r=function(u){return Promise.all(u.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=r(n.map(u=>{if(u=Hne(u),u in D1)return;D1[u]=!0;const h=u.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${g}`))return;const f=document.createElement("link");if(f.rel=h?"stylesheet":Bne,h||(f.as="script"),f.crossOrigin="",f.href=u,d&&f.setAttribute("nonce",d),document.head.appendChild(f),h)return new Promise((b,k)=>{f.addEventListener("load",b),f.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(r){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=r,window.dispatchEvent(c),!c.defaultPrevented)throw r}return i.then(r=>{for(const c of r||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})},F1="agent-dag.fm-custom-stations",U1="agent-dag.fm-muted",AN="custom:",Wne=/^UC[A-Za-z0-9_-]{22}$/,Gne=/^[A-Za-z0-9_-]{11}$/,IU=/^[A-Za-z0-9_-]{1,80}$/,$ne=/\.(mp3|aac|ogg)$/i,Vne=/\.m3u8$/i,Kne=2048,DU=80;function kl(e){return`${AN}${e}`}function Jm(e){if(!e.startsWith(AN))return null;const t=e.slice(AN.length);return IU.test(t)?t:null}function B1(e){return Jm(e)??e}function OA(e){var r,c;const t=e.trim();if(t.length>Kne)return null;let n;try{n=new URL(t)}catch{return null}if(n.protocol!=="https:"||n.username||n.password)return null;const a=n.toString(),i=n.hostname.toLowerCase();if(i==="youtube.com"||i==="www.youtube.com"||i==="m.youtube.com"){if(n.port)return null;const d=(r=/^\/channel\/([^/]+)(?:\/live)?\/?$/.exec(n.pathname))==null?void 0:r[1];if(d&&Wne.test(d))return{kind:"youtube-channel",url:a,channel:d};const u=(c=/^\/@([^/]+)\/live\/?$/.exec(n.pathname))==null?void 0:c[1];if(u&&/^[A-Za-z0-9._-]{1,64}$/.test(u))return{kind:"youtube-handle",url:a,handle:u};if(n.pathname==="/watch"){const h=n.searchParams.get("v")??"";if(Gne.test(h))return{kind:"youtube-video",url:a,video:h}}return null}return Vne.test(n.pathname)?{kind:"direct-audio",url:a,format:"hls"}:$ne.test(n.pathname)?{kind:"direct-audio",url:a,format:"audio"}:/\.(html?|pls|m3u)$/i.test(n.pathname)?null:{kind:"direct-audio",url:a,format:"audio"}}function Jne(e){return e==="1"}function Yne(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];const n=new Set,a=[];for(const i of t){if(!i||typeof i!="object")continue;const o=typeof i.id=="string"?i.id:"",r=typeof i.name=="string"?i.name.trim():"",c=typeof i.url=="string"?i.url.trim():"",d=OA(c);if(!IU.test(o)||n.has(o)||!r||r.length>DU||!d)continue;n.add(o);const u=FU(i.radio);a.push({id:o,name:r,url:d.url,...u?{radio:u}:{}})}return a}function Zne(e,t,n){const a=Jm(e??"");return a&&t.some(i=>i.id===a)?kl(a):n(e)}function Xne(e,t){return e===kl(t)?"claude-fm":e}function FU(e){if(!e||typeof e!="object")return null;const t=e,n=(i,o)=>typeof t[i]=="string"?t[i].slice(0,o):"",a=(i,o)=>typeof t[i]=="number"&&Number.isFinite(t[i])&&Math.abs(t[i])<=o?t[i]: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:a("lat",90),lon:a("lon",180)}}const TN="https://www.youtube-nocookie.com";function Qne(e,t,n){const a=new URLSearchParams({...n?{}:{channel:e},enablejsapi:"1",autoplay:"1",playsinline:"1",rel:"0",modestbranding:"1",origin:t});return`${TN}/embed/${n?encodeURIComponent(n):"live_stream"}?${a.toString()}`}function _c(e,t=[]){return JSON.stringify({event:"command",func:e,args:t})}function eae(e="claude-fm"){return JSON.stringify({event:"listening",id:e,channel:"widget"})}const tae=[1],nae=[0,2],aae=[2,5,100,101,150,153];function sae(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:a}=t;if(n==="onReady")return{kind:"ready"};if(n==="onAutoplayBlocked")return{kind:"blocked"};if(n==="onError"){const i=typeof a=="number"?a:Number(a==null?void 0:a.errorCode);return Number.isFinite(i)?{kind:"error",code:i}:null}if(n==="onStateChange"||n==="infoDelivery"){const i=typeof a=="number"?a:a==null?void 0:a.playerState;return typeof i!="number"||!Number.isFinite(i)?null:tae.includes(i)?{kind:"playing",playing:!0}:i===3?{kind:"buffering"}:nae.includes(i)?{kind:"playing",playing:!1}:null}return null}const zd=new Set;let H1="";function W1(e){const t=new Date().toISOString().slice(0,10);if(t!==H1&&(zd.clear(),H1=t),!zd.has(e)){zd.add(e);try{const n=typeof navigator>"u"?void 0:navigator;(!n||typeof n.sendBeacon!="function"||!n.sendBeacon("/api/feature",JSON.stringify({name:e})))&&zd.delete(e)}catch{zd.delete(e)}}}const G1=864e5,iae=6e4;function An(e,t=!0){m.useEffect(()=>{if(!t)return;W1(e);let n;const a=()=>{n=setTimeout(()=>{W1(e),a()},G1-Date.now()%G1+iae)};return a(),()=>clearTimeout(n)},[e,t])}const oae={"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 rae({fetchImpl:e,enabled:t=!0,volume:n,muted:a,source:i,playRequest:o,customStation:r,onAvailabilityChange:c}){var L;const[d,u]=m.useState(null),[h,g]=m.useState(!1),[f,b]=m.useState(!1),[k,y]=m.useState(!1),[N,w]=m.useState(!1);An("claude-fm",k);const j=m.useRef(o),S=m.useRef(null),A=m.useRef(null),T=m.useRef(void 0),q=m.useRef(null),_=m.useCallback(()=>{var O;clearTimeout(T.current),(O=A.current)==null||O.destroy(),A.current=null;const R=S.current;R&&(R.pause(),R.removeAttribute("src"),R.load(),S.current=null)},[]),I=m.useCallback(R=>{var O,D;(D=(O=q.current)==null?void 0:O.contentWindow)==null||D.postMessage(R,TN)},[]),z=m.useRef(n);z.current=n;const F=m.useRef(a);F.current=a;const U=m.useCallback((R,O,D)=>{_();const $=new Audio;$.preload="none",$.volume=z.current/100,$.muted=F.current,S.current=$,b(!0),y(!1),w(!1);let B=!1;const G=()=>S.current===$,Z=()=>{clearTimeout(T.current),_(),b(!1),y(!1),w(!1)},W=()=>{G()&&(Z(),g(!0),c==null||c(D,!0))},H=V=>{if(G()&&!(V instanceof DOMException&&V.name==="AbortError")){if(V instanceof DOMException&&V.name==="NotAllowedError"){Z();return}W()}};T.current=setTimeout(()=>{G()&&!B&&W()},15e3),$.addEventListener("playing",()=>{G()&&(clearTimeout(T.current),B=!0,y(!0),w(!1),c==null||c(D,!1))});const X=()=>{G()&&(y(!1),w(B),clearTimeout(T.current),T.current=setTimeout(()=>{G()&&W()},15e3))};$.addEventListener("waiting",X),$.addEventListener("stalled",X),$.addEventListener("ended",()=>{G()&&Z()}),$.addEventListener("error",W,{once:!0}),O&&!$.canPlayType("application/vnd.apple.mpegurl")?Hr(async()=>{const{default:V}=await import("./hls-BFpXDghs.js");return{default:V}},[]).then(({default:V})=>{if(!G())return;if(!V.isSupported()){W();return}const Q=new V;A.current=Q,Q.on(V.Events.ERROR,(Y,K)=>{K.fatal&&W()}),Q.on(V.Events.MEDIA_ATTACHED,()=>Q.loadSource(R)),Q.on(V.Events.MANIFEST_PARSED,()=>{$.play().catch(H)}),Q.attachMedia($)},W):($.src=R,$.play().catch(H))},[c,_]);m.useEffect(()=>{f&&(I(_c("setVolume",[n])),I(_c(a?"mute":"unMute")),S.current&&(S.current.volume=n/100,S.current.muted=a))},[n,a,f,I]),m.useEffect(()=>{var Z;let R=!0;const O=e??fetch,D=j.current!==o;if(j.current=o,u(null),g(!1),w(!1),b(D),y(!1),_(),!t){b(!1),y(!1);return}const $=r&&kl(r.id)===i?OA(r.url):null;if($){if($.kind==="direct-audio"){const W=$.format==="hls"||((Z=r==null?void 0:r.radio)==null?void 0:Z.hls)===!0;return u({live:!0,channel:"",audio:$.url,hls:W}),c==null||c(i,!1),D&&U($.url,W,i),()=>{R=!1}}return O(`/api/fm-station?url=${encodeURIComponent($.url)}`).then(W=>W.ok?W.json():null).then(W=>{R&&(W!=null&&W.channel||W!=null&&W.video?(u({live:!0,channel:W.channel??"",video:W.video??void 0}),c==null||c(i,!1)):(g(!0),b(!1),y(!1),w(!1),c==null||c(i,!0)))}).catch(()=>{R&&(g(!0),b(!1),y(!1),w(!1),c==null||c(i,!0))}),()=>{R=!1}}if(Jm(i))return g(!0),c==null||c(i,!0),()=>{R=!1};const B=i,G=oae[B];if(G)O(G).then(W=>W.ok?W.json():null).then(W=>{R&&(W!=null&&W.video&&u({live:!0,channel:"",video:W.video}),W!=null&&W.video||(g(!0),b(!1),y(!1)),c==null||c(i,!(W!=null&&W.video)))}).catch(()=>{R&&(g(!0),b(!1),y(!1),c==null||c(i,!0))});else if(B!=="claude-fm"){const W=B.replace("lofi-","");O(`/api/lofi-girl?station=${encodeURIComponent(W)}`).then(H=>H.ok?H.json():null).then(H=>{R&&(H!=null&&H.video&&u({live:!0,channel:"",video:H.video}),H!=null&&H.video||(g(!0),b(!1),y(!1)),c==null||c(i,!(H!=null&&H.video)))}).catch(()=>{R&&(g(!0),b(!1),y(!1),c==null||c(i,!0))})}else O("/api/claude-fm").then(W=>W.ok?W.json():null).then(W=>{if(!R)return;const H=!!(W!=null&&W.live&&(W!=null&&W.channel));H&&u({live:!0,channel:W.channel}),H||(g(!0),b(!1),y(!1)),c==null||c(i,!H)}).catch(()=>{R&&(g(!0),b(!1),y(!1),c==null||c(i,!0))});return()=>{R=!1}},[r==null?void 0:r.id,r==null?void 0:r.url,(L=r==null?void 0:r.radio)==null?void 0:L.hls,t,e,c,o,i,U,_]),m.useEffect(()=>()=>_(),[_]),m.useEffect(()=>{if(!f||d!=null&&d.audio)return;let R;const O=()=>{clearTimeout(R),R=void 0,b(!1),y(!1),w(!1),g(!0),c==null||c(i,!0)},D=()=>{R??(R=setTimeout(O,15e3))};D();const $=B=>{var Z;if(B.origin!==TN||B.source!==((Z=q.current)==null?void 0:Z.contentWindow))return;const G=sae(B.data);if(G){if(G.kind==="ready"){I(_c("setVolume",[z.current])),I(_c(F.current?"mute":"unMute")),I(_c("playVideo"));return}if(G.kind==="blocked"){clearTimeout(R),R=void 0,b(!1),y(!1),w(!1);return}if(G.kind==="buffering"){y(!1),w(!0),D();return}if(G.kind==="playing"){clearTimeout(R),R=void 0,y(G.playing),w(!1),G.playing||b(!1);return}aae.includes(G.code)&&O()}};return window.addEventListener("message",$),()=>{clearTimeout(R),window.removeEventListener("message",$)}},[f,d==null?void 0:d.audio,o,c,I,i]);const P=m.useCallback(()=>{if(d){if(d.audio){if(f){_(),b(!1),y(!1),w(!1);return}U(d.audio,d.hls===!0,i);return}if(!f){b(!0),y(!1),w(!1);return}I(_c("pauseVideo")),b(!1),y(!1),w(!1)}},[d,f,k,i,I,U,_]);return m.useMemo(()=>({probe:d,dead:h,armed:f,playing:k,buffering:N,frame:q,say:I,press:P}),[d,h,f,k,N,I,P])}const $1="agent-dag.radio-favorites",V1="agent-dag.radio-recent",K1="agent-dag.radio-catalogue";function cae(e){if(!Array.isArray(e))return[];const t=new Set;return e.slice(0,300).flatMap(n=>{if(!n||typeof n!="object")return[];const a=n,i=typeof a.id=="string"?a.id:"",o=typeof a.name=="string"?a.name.trim().slice(0,80):"",r=typeof a.url=="string"?OA(a.url):null,c=FU(a.radio??a);return!/^radio-[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(i)||!o||!c||!r||r.kind!=="direct-audio"||t.has(i)?[]:(t.add(i),[{id:i,name:o,url:r.url,radio:c}])})}function J1(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 lae(e,t){return[t,...e.filter(n=>n!==t)].slice(0,50)}function o1e(e,t,n=Math.random){const a=e.filter(i=>i.id!==t);return a.length?a[Math.min(a.length-1,Math.floor(Math.max(0,n())*a.length))]:null}function r1e(e,t,n){if(!e.length)return null;const a=e.findIndex(o=>o.id===t),i=e[a<0?n===1?0:e.length-1:(a+n+e.length)%e.length];return i.id===t?null:i}function UU(e,t,n){const a=e.findIndex(i=>i.id===t);for(let i=1;i<=e.length;i++){const o=e[(a+i)%e.length];if(o.id!==t&&!n.has(o.id))return o}return null}function c1e(e,t){if(!e.length)return null;const n=[...e].sort((i,o)=>i.id.localeCompare(o.id));let a=0;for(const i of t)a=Math.imul(a,31)+i.charCodeAt(0)>>>0;return n[a%n.length]}function l1e(e,t,n,a,i){return(!t||`${e.name} ${e.radio.country} ${e.radio.region} ${e.radio.tags}`.toLowerCase().includes(t.toLowerCase()))&&(!n||e.radio.countryCode===n)&&(!a||e.radio.tags.toLowerCase().includes(a.toLowerCase()))&&(!i||e.radio.language.toLowerCase().includes(i.toLowerCase()))}function dae(){const[e,t]=m.useState(()=>J1(ht($1))),[n,a]=m.useState(()=>J1(ht(V1))),[i,o]=m.useState(()=>{try{return cae(JSON.parse(ht(K1)??"[]"))}catch{return[]}});m.useEffect(()=>{pt($1,JSON.stringify(e))},[e]),m.useEffect(()=>{pt(V1,JSON.stringify(n))},[n]);const r=m.useCallback(u=>a(h=>lae(h,u)),[]),c=m.useCallback(u=>t(h=>h.includes(u)?h.filter(g=>g!==u):[...h,u].slice(-100)),[]),d=m.useCallback(u=>{o(u),pt(K1,JSON.stringify(u))},[]);return{favorites:e,recent:n,catalogue:i,remember:r,toggleFavorite:c,updateCatalogue:d}}function uae(e,t,n,a){const i=UU(e,t,n);if(!i)return()=>{};const o=setTimeout(()=>{n.add(t),a(i)},1e3);return()=>clearTimeout(o)}const Ym=148,Y1=6e3,hae=16e3,BU=46,wo=34;function pae(e,t,n=Ym){let a=-Math.round(t()*n);if(Math.abs(a-e)<wo){const i=e-wo>=-n?-wo:wo;a=Math.max(-n,Math.min(0,Math.round(e+i)))}return{to:a,ms:Math.round(Math.abs(a-e)*BU)}}function gae(e){return Math.round(Y1+e()*(hae-Y1))}const Z1=[{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 mae(e){const t=Z1.reduce((a,i)=>a+i.weight,0);let n=e()*t;for(const a of Z1)if(n-=a.weight,n<0)return a.kind;return"stroll"}const fae=720,bae=260,vae=620,kae=220,X1=520,HU=1600,Q1=7e3,wae=15e3,eq=6e3,yae=14e3;function zc(e,t,n=Ym){let a=-Math.round(t()*n);if(Math.abs(a-e)<wo){const i=e-wo>=-n?-wo:wo;a=Math.max(-n,Math.min(0,Math.round(e+i)))}return a}const vn=(e,t)=>Math.round(Math.abs(t-e)*BU),xae=120,Dp=0;function Cae(e,t){const n=a=>({kind:"litter",at:t,...a});return[{x:t,prop:n({}),act:"walk",ms:vn(e,t)},{x:t,prop:n({}),act:"stoop",ms:fae},{x:Dp,prop:n({held:!0}),act:"carry",ms:vn(t,Dp)},{x:Dp,prop:n({held:!0}),act:"windup",ms:bae},{x:Dp,prop:n({held:!0,leaving:!0}),act:"toss",ms:vae}]}function Sae(e,t){const n=t>e?1:-1,a=t-n*Math.min(15,Math.abs(t-e)),i=(o={})=>({kind:"ball",at:t,...o});return[{x:a,prop:i(),act:"walk",ms:vn(e,a)},{x:a,prop:i(),act:"windup",ms:kae,facing:n>0?"right":"left"},{x:a,prop:i({leaving:!0}),act:"kick",ms:X1,facing:n>0?"right":"left"},{x:a,prop:i({leaving:!0}),act:"stand",ms:HU-X1}]}const WU=640;function Nae(e,t,n){const a=Math.max(-70,Math.min(-20,t)),i={x:a,prop:null,facing:"left"};return[{x:a,prop:null,act:"walk",ms:vn(e,a)},{...i,act:"sit",ms:600},{...i,act:"cast",ms:900},{...i,act:"fish",ms:6e3+Math.round(n()*4e3)},{...i,act:"reel",ms:1200},{...i,act:"stow",ms:500},{...i,act:"stand",ms:400},{x:0,prop:null,act:"walk",ms:vn(a,0)}]}function jae(e,t,n){const a=Math.max(-110,Math.min(-30,t)),i={x:a,prop:null};return[{...i,act:"walk",ms:vn(e,a)},{...i,act:"skip-ready",ms:500},{...i,act:"skip",ms:WU*(6+Math.floor(n()*5))},{...i,act:"skip-rest",ms:600},{...i,act:"stand",ms:350},{x:0,prop:null,act:"walk",ms:vn(a,0)}]}function Aae(e,t,n){return[{x:t,prop:null,act:"walk",ms:vn(e,t)},{x:t,prop:null,act:"sit",ms:Math.round(eq+n()*(yae-eq))},{x:t,prop:null,act:"stand",ms:400}]}function Tae(e,t,n){t=Math.max(-110,Math.min(0,t));const a=()=>({kind:"scope",at:t,held:!0});return[{x:t,prop:null,act:"walk",ms:vn(e,t)},{x:t,prop:a(),act:"watch",ms:Math.round(Q1+n()*(wae-Q1))},{x:t,prop:a(),act:"scope-pack",ms:480},{x:t,prop:null,act:"stand",ms:240}]}function Wv(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 Rae=1500,Eae=e=>Math.round(1e3*Math.sqrt(2*e/Rae)),qae=115,_ae=e=>Math.round(e/qae*1e3),zae=620,Lae=200,Oae=760,Pae=600,Mae=240;function Iae(e,t,n){const i=-(t.ledgeSpan??Ym),o=Eae(t.ledgeH),r=_ae(t.ledgeH),c=n(),d=n(),u=-Math.round(c*t.floorSpan),h=-Math.round(d*t.floorSpan);return[{x:i,act:"walk",prop:null,ms:vn(e,i)},{x:i,act:"peer",prop:null,ms:zae},{x:i,act:"fall",prop:null,ms:o,place:"floor"},{x:i,act:"land",prop:null,ms:Lae,place:"floor"},{x:u,act:"walk",prop:null,ms:vn(i,u),place:"floor",floorFrac:c},{x:h,act:"walk",prop:null,ms:vn(u,h),place:"floor",floorFrac:d},{x:i,act:"walk",prop:null,ms:vn(h,i),place:"floor"},{x:i,act:"lasso",prop:null,ms:Oae,place:"floor"},{x:i,act:"rope-throw",prop:null,ms:Pae,place:"floor"},{x:i,act:"rope-catch",prop:null,ms:Mae,place:"floor"},{x:i,act:"climb",prop:null,ms:r},{x:i,act:"pull-up",prop:null,ms:480}]}function Dae(e,t,n){const a=(n==null?void 0:n.ledgeSpan)??Ym;switch(mae(t)){case"tidy":return Cae(e,zc(e,t,a));case"kick":return Sae(e,zc(e,t,a));case"sit":return Aae(e,zc(e,t,a),t);case"watch":return Tae(e,zc(e,t,a),t);case"fish":return Nae(e,zc(e,t,a),t);case"skip":return jae(e,zc(e,t,a),t);case"leave":{if(!n||!(n.ledgeH>0)||!(n.floorSpan>0))break;return Iae(e,n,t)}}const o=pae(e,t,a);return[{x:o.to,prop:null,act:"walk",ms:o.ms}]}const Fae=420;function Uae(e,t,n){const a=t==="right"?n-e-18:e-18;return(t==="right"?1:-1)*Math.min(Fae,Math.max(0,a))}const Bae=260,Hae=200;function Wae(e,t,n){const a=(h,g=vn(e,h))=>({x:h,prop:null,act:"walk",ms:g,place:"floor"});if(!n||n.height<=0)return[a(t)];const i=Math.min(e,t);if(Math.max(e,t)<=n.left||i>=n.right)return[a(t)];const r=t>e,c=r?n.left:n.right,d=r?n.right:n.left,u={place:"floor",riser:n.height,prop:null};return[a(c,vn(e,c)),{...u,x:c,act:"mount",ms:Bae},{...u,x:d,act:"walk",ms:vn(c,d)},{x:d,prop:null,act:"dismount",ms:Hae,place:"floor"},{x:t,prop:null,act:"walk",ms:vn(d,t),place:"floor"}]}const GU=["bob","sway","groove"],tq=9e3,Gae=16e3,$U=1e3,$ae=.08;function Vae(e,t){const n=GU.filter(o=>o!==e),a=n[Math.min(n.length-1,Math.floor(t()*n.length))],i=(t()*2-1)*$ae;return{dance:a,beatMs:Math.round($U*(1+i))}}function Kae(e){return Math.round(tq+e()*(Gae-tq))}const PA=["......aaaaaa......","....aa......aa....","...a..bbbbbs..a...","...cpcbbbbbscpc...","...cpcbebbescpc...","...cpcbbbbbscpc...","...cpcbbbbbscpc...","....ccbbbbbscc....","....bbbbbbbbbs....","....bbbbbbbbbs....","......bbbbbs......","......bb..bs......","......bb..bs......","......bb..bs......"],nq=18,Jae=PA.length,VU="M6 9H4V1H5V0H7V-1H9V1H7V2H5V7H6V8H7V9Z",KU="M12 9H14V6H13V3H11V2H9V4H12Z",MA=new Set(["a","c","p"]);function Oo(e=PA){const t=[];return e.forEach((n,a)=>{let i=0;for(;i<n.length;){const o=n[i];if(o==="."){i+=1;continue}let r=1;for(;i+r<n.length&&n[i+r]===o;)r+=1;t.push({x:i,y:a,w:r,cell:o}),i+=r}}),t}const Yae=[".xx.","xxxx",".xx."],Zae=["..xx..",".xsxx.","xssxxx","xxxxsx",".xxxx.","..xx.."],Xae=["...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."],Gv={litter:Yae,ball:Zae,scope:Xae},Qae=["...hhhhhh...","...hhhhhh...","...kkkkkk...","hhhhhhhhhhhh"],ese=3,tse=-1,RN=11,aq=9;function sq(e){let t=null,n=null,a=0,i=0,o=!1;const r=()=>{t!==null&&clearTimeout(t),t=null},c=()=>{o||e.hidden||!n||t!==null||(i=performance.now(),t=setTimeout(()=>{t=null;const u=n;n=null,u==null||u()},a))},d=()=>{e.hidden&&t!==null?(a=Math.max(0,a-(performance.now()-i)),r()):e.hidden||c()};return e.addEventListener("visibilitychange",d),{schedule(u,h){o||(r(),n=u,a=Math.max(0,h),c())},dispose(){o=!0,r(),n=null,e.removeEventListener("visibilitychange",d)}}}function nse(e,t,n){const[a,i]=m.useState(0),[o,r]=m.useState(0),[c,d]=m.useState(null),[u,h]=m.useState(null),[g,f]=m.useState({x:0,drop:0}),[b,k]=m.useState("ledge"),[y,N]=m.useState("left"),[w,j]=m.useState(0),S=m.useRef(null),[A,T]=m.useState(()=>document.hidden);m.useEffect(()=>{const P=new Set,L=()=>{var R;if(document.hidden){for(const O of((R=S.current)==null?void 0:R.getAnimations({subtree:!0}))??[])if(O.playState==="running"||O.pending){const D=O.currentTime;O.pause(),D!==null&&(O.currentTime=D),P.add(O)}}else{for(const O of P)O.playState==="paused"&&O.play();P.clear()}T(document.hidden)};return L(),document.addEventListener("visibilitychange",L),()=>document.removeEventListener("visibilitychange",L)},[e,t]);const[q,_]=m.useState(null),[I,z]=m.useState($U),[F,U]=m.useState(()=>{var P;return((P=window.matchMedia)==null?void 0:P.call(window,"(prefers-reduced-motion: reduce)").matches)??!1});return m.useEffect(()=>{var R;const P=(R=window.matchMedia)==null?void 0:R.call(window,"(prefers-reduced-motion: reduce)");if(!P)return;const L=()=>U(P.matches);return L(),P.addEventListener("change",L),()=>P.removeEventListener("change",L)},[]),m.useEffect(()=>{var K;if(!e||t||F)return;const P=sq(document);let L=0;i(ee=>L=ee);let R=null,O=0,D=0;const $=ee=>{var pe,ae;const[te,...ce]=ee;if(!te){R=null,d(null),h(null),V();return}d(te.act),h(te.prop),k(te.place??"ledge"),j(te.riser??0);const ge=L,ve=H(te);if(te.act==="kick"){const le=(ae=(pe=S.current)==null?void 0:pe.querySelector('.fm-prop[data-prop="ball"]'))==null?void 0:ae.getBoundingClientRect();le&&f({x:Uae(le.x,Wv(te,ge,"left"),window.innerWidth),drop:Math.max(48,window.innerHeight-le.y+24)})}D=te.act==="walk"?Math.max(vn(ge,ve),xae):te.ms,te.act==="carry"&&(D=vn(ge,ve)),r(D),N(le=>Wv({...te,x:ve},ge,le)),i(ve),L=ve,R=te,O=Date.now(),P.schedule(()=>$(ce),D)},B=()=>{const ee=S.current,te=ee==null?void 0:ee.querySelector(".fm-sprite"),ce=ee==null?void 0:ee.parentElement;if(!ee||!te||!ce)return null;const ge=ee.getBoundingClientRect(),ve=ce.getBoundingClientRect(),pe=ve.right-ge.right,ae=ve.width-pe*2-te.offsetWidth;return ae>0?ae:null},G=()=>{const ee=S.current,te=ee==null?void 0:ee.querySelector(".fm-sprite");return!ee||!te?0:Math.max(0,ee.getBoundingClientRect().width-te.offsetWidth)},Z=()=>{const ee=S.current,te=ee==null?void 0:ee.querySelector(".fm-walker"),ce=B();if(!ee||!te||ce==null)return;const ge=ee.getBoundingClientRect().bottom-te.getBoundingClientRect().bottom;if(ge>0)return{ledgeH:ge,floorSpan:ce,ledgeSpan:G()}},W=()=>{const ee=S.current,te=document.querySelector(".canvas-notices");if(!ee||!te)return null;const ce=ee.getBoundingClientRect(),ge=te.getBoundingClientRect();return ge.width<=0||ge.height<=0?null:{left:ge.left-ce.right,right:ge.right-ce.right,height:ge.height}},H=ee=>{const te=(ee.place??"ledge")==="floor",ce=te?B()??G():G(),ge=te&&ee.floorFrac!=null?-Math.round(ee.floorFrac*ce):ee.x;return Math.max(-ce,Math.min(0,ge))},X=()=>{if(!R)return;const ee=H(R);ee!==L&&(r(Math.max(0,O+D-Date.now())),N(te=>Wv({...R,x:ee},L,te)),i(ee),L=ee)},V=()=>{P.schedule(()=>{const ee=Dae(L,Math.random,Z()),te=ee.some(ve=>ve.place==="floor")?W():null;let ce=L;const ge=ee.flatMap(ve=>{const pe=ce;if(ce=ve.x,!(ve.place==="floor"&&ve.act==="walk"))return[ve];const ae=Wae(pe,ve.x,te),le=ae.length-1;return ve.floorFrac==null?ae:ae.map((Se,ke)=>ke===le?{...Se,floorFrac:ve.floorFrac}:Se)});$(ge)},gae(Math.random))},Q=(K=S.current)==null?void 0:K.parentElement,Y=typeof ResizeObserver>"u"?null:new ResizeObserver(X);return Q&&Y&&Y.observe(Q),V(),()=>{P.dispose(),Y==null||Y.disconnect(),k("ledge"),i(ee=>Math.max(-G(),Math.min(0,ee))),r(0),d(null),h(null),j(0)}},[e,t,F]),m.useEffect(()=>{if(!n||F){_(null);return}const P=sq(document),L=R=>{const O=Vae(R,Math.random);_(O.dance),z(O.beatMs),P.schedule(()=>L(O.dance),Kae(Math.random))};return L(null),()=>P.dispose()},[n,F]),{scene:S,suspended:A,x:a,walkMs:o,act:c,prop:u,ballFlight:g,place:b,facing:y,riser:w,dance:q,beatMs:I}}const $v={e:"fm-eye",s:"fm-shade",p:"fm-pad"},Jg=Oo().filter(e=>!MA.has(e.cell)),ase=Oo().filter(e=>MA.has(e.cell)),iq=Jg.filter(e=>e.cell==="e"),sse=Oo(Qae),ise=Jg.filter(e=>e.y<RN&&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),ose={left:Jg.filter(e=>e.y>=RN&&e.x<aq),right:Jg.filter(e=>e.y>=RN&&e.x>=aq)},rse=m.memo(function({act:t,facing:n}){return s.jsxs("svg",{viewBox:`0 0 ${nq} ${Jae}`,shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsx("g",{className:"fm-gear",children:s.jsx("g",{className:"fm-gear-motion",children:ase.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:$v[a.cell]},`g${a.y}-${a.x}`))})}),s.jsxs("g",{className:"fm-body",children:[iq.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,fill:"var(--accent)"},`eye-bed-${a.x}`)),ise.map(a=>s.jsx("rect",{x:a.x,y:a.y,width:a.w,height:1,className:$v[a.cell]},`b${a.y}-${a.x}`)),s.jsxs("g",{className:"fm-arms",children:[s.jsx("rect",{x:4,y:8,width:2,height:2}),s.jsx("rect",{x:12,y:8,width:1,height:2}),s.jsx("rect",{x:13,y:8,width:1,height:2,className:"fm-shade"})]}),iq.map(a=>s.jsx("rect",{x:a.x-(a.x>=nq/2?1:0)+(n==="right"?1:0),y:a.y,width:a.w,height:1,className:"fm-eye"},`eye-${a.x}`))]}),s.jsx("g",{className:"fm-hat",children:sse.map(a=>s.jsx("rect",{x:ese+a.x,y:tse+a.y,width:a.w,height:1,className:a.cell==="k"?"fm-hatband":void 0},`h${a.y}-${a.x}`))}),(t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up")&&s.jsxs("g",{className:"fm-grip",children:[s.jsx("path",{className:"fm-grip-left",d:VU}),s.jsx("path",{className:"fm-grip-right",d:KU})]}),(t==="land"||t==="dismount")&&s.jsxs("g",{className:"fm-crouch-legs",children:[s.jsx("path",{d:"M6 11H8V13H6Z"}),s.jsx("path",{d:"M10 11H12V13H10Z"})]}),["sit","cast","fish","reel","stow"].includes(t)&&s.jsxs("g",{className:"fm-seated-legs",children:[s.jsx("path",{className:"fm-seated-far",d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),s.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(a=>s.jsx("g",{className:"fm-leg","data-side":a,children:ose[a].map(i=>s.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,className:$v[i.cell]},`${a}${i.y}-${i.x}`))},a))]})}),cse=["...o........o.....","...of......fo.....","...owffffffwo.....","...offfffffso.....","...ofefffefso.....","....owwnwwso......",".....wwwww........",".....fwwwfs.......","....ffwwwffs...ww.","....ffwwwffs..wfs.","......fwwfssfffs..","......ff..fsffs...","......ff..fs......","......oo..oo......"],lse=[".....aaaaaaa......","...aa.......aa....","..a...........a...","..cp.........pc...","..cp.........pc...","..cp.........pc...","..c...........c..."],Gs={f:"#d88735",s:"#a55b24",o:"#63351e",w:"#ffe2aa",n:"#372821"},dse={p:"fm-pad"},Ru=Oo(cse),use=Oo(lse);function EN(e,t,n){return e.map(a=>({...a,x:Math.max(t,a.x),w:Math.max(0,Math.min(n,a.x+a.w)-Math.max(t,a.x))})).filter(a=>a.w>0)}const hse=EN(Ru.filter(e=>e.y>=8),12,18),pse=Ru.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),oq=Ru.filter(e=>e.cell==="e"),gse={left:EN(Ru.filter(e=>e.y>=11),0,9),right:EN(Ru.filter(e=>e.y>=11),9,12)},mse=m.memo(function({act:t,facing:n}){const a=t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up",i=t==="land"||t==="dismount",o=t==="sit"||t==="cast"||t==="fish"||t==="reel"||t==="stow";return s.jsxs("svg",{"data-character":"fox",viewBox:"0 0 18 14",shapeRendering:"crispEdges","aria-hidden":!0,focusable:"false",children:[s.jsx("g",{className:"fm-body","data-part":"tail",children:hse.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:Gs[r.cell]},`t${r.y}-${r.x}`))}),s.jsx("g",{className:"fm-gear",children:s.jsx("g",{className:"fm-gear-motion",children:use.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,className:dse[r.cell]},`g${r.y}-${r.x}`))})}),s.jsxs("g",{className:"fm-body",children:[pse.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:Gs[r.cell]},`b${r.y}-${r.x}`)),oq.map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:Gs.f},`bed${r.x}`)),s.jsxs("g",{className:"fm-arms",fill:Gs.f,children:[s.jsx("rect",{x:4,y:8,width:2,height:2}),s.jsx("rect",{x:12,y:8,width:1,height:2})]}),oq.map(r=>s.jsx("rect",{x:r.x+(n==="right"?1:0)-(r.x>=9?1:0),y:r.y,width:r.w,height:1,className:"fm-eye",style:{fill:Gs.n}},`e${r.x}`))]}),a&&s.jsxs("g",{className:"fm-grip",style:{fill:Gs.f},children:[s.jsx("path",{className:"fm-grip-left",d:VU}),s.jsx("path",{className:"fm-grip-right",d:KU})]}),i&&s.jsxs("g",{className:"fm-crouch-legs",style:{fill:Gs.f},children:[s.jsx("path",{d:"M6 11H8V13H6Z"}),s.jsx("path",{d:"M10 11H12V13H10Z"})]}),o&&s.jsxs("g",{className:"fm-seated-legs",style:{fill:Gs.f},children:[s.jsx("path",{className:"fm-seated-far",style:{fill:Gs.s},d:"M10 10H12V11H11V14H8V13H9V11H10Z"}),s.jsx("path",{d:"M6 10H9V11H7V15H4V14H5V11H6Z"})]}),["left","right"].map(r=>s.jsx("g",{className:"fm-leg","data-side":r,children:gse[r].map(c=>s.jsx("rect",{x:c.x,y:c.y,width:c.w,height:1,fill:Gs[c.cell]},`${c.y}-${c.x}`))},r))]})}),fse=[".......dddd.......","......dhhhhd......",".....dhhhhhhd.....","....dhwwhhwwhd....","....dhwewwewhd....","....dhwwbbwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....","....dhwwwwwwhd....",".....dhwwwwhd.....",".....dhwwwwhd.....","......dhhhhd......","......bb..bb......",".....bbb..bbb....."],xi={d:"#3b4855",h:"#657b8b",w:"#f4f0df",e:"#19242b",b:"#f0b44b",s:"#c88736"},bse={p:"fm-pad"},Yg=Oo(fse),vse=Oo(PA).filter(e=>MA.has(e.cell)),rq=Yg.filter(e=>e.cell==="e"),kse=Yg.filter(e=>e.y<12&&e.cell!=="e"),wse={left:Yg.filter(e=>e.y>=12&&e.x<9),right:Yg.filter(e=>e.y>=12&&e.x>=9)},yse=m.memo(function({act:t}){const n=t==="climb"||t==="rope-throw"||t==="rope-catch"||t==="pull-up",a=t==="land"||t==="dismount",i=t==="sit"||t==="cast"||t==="fish"||t==="reel"||t==="stow";return s.jsxs("svg",{"data-character":"penguin",viewBox:"0 0 18 14",shapeRendering:"crispEdges","aria-hidden":!0,focusable:"false",children:[s.jsx("g",{className:"fm-gear",children:s.jsx("g",{className:"fm-gear-motion",children:vse.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:bse[o.cell]},`g${o.y}-${o.x}`))})}),s.jsxs("g",{className:"fm-body",children:[kse.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:xi[o.cell]},`b${o.y}-${o.x}`)),rq.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,fill:xi.w},`bed${o.x}`)),s.jsxs("g",{className:"fm-arms",fill:xi.d,children:[s.jsx("path",{d:"M4 8H6V10H5V11H4Z"}),s.jsx("path",{d:"M12 8H14V11H13V10H12Z"})]}),rq.map(o=>s.jsx("rect",{x:o.x,y:o.y,width:o.w,height:1,className:"fm-eye",style:{fill:xi.e}},`e${o.x}`))]}),n&&s.jsxs("g",{className:"fm-grip",style:{fill:xi.h},children:[s.jsx("path",{className:"fm-grip-left",d:"M5 10H4V4H5V2H6V1H7V0H9V2H7V3H6V10Z"}),s.jsx("path",{className:"fm-grip-right",d:"M12 10H14V6H13V3H11V2H9V4H12Z"})]}),a&&s.jsxs("g",{className:"fm-crouch-legs",style:{fill:xi.b},children:[s.jsx("path",{d:"M5 12H8V13H5Z"}),s.jsx("path",{d:"M10 12H13V13H10Z"})]}),i&&s.jsxs("g",{className:"fm-seated-legs",style:{fill:xi.b},children:[s.jsx("path",{className:"fm-seated-far",style:{fill:xi.s},d:"M10 11H12V12H13V14H10V13H11V12H10Z"}),s.jsx("path",{d:"M6 11H8V12H7V13H8V14H4V13H5V12H6Z"})]}),["left","right"].map(o=>s.jsx("g",{className:"fm-leg","data-side":o,children:wse[o].map(r=>s.jsx("rect",{x:r.x,y:r.y,width:r.w,height:1,fill:xi.b},`${r.y}-${r.x}`))},o))]})});function JU({character:e,act:t,facing:n}){return e==="penguin"?s.jsx(yse,{act:t,facing:n}):e==="fox"?s.jsx(mse,{act:t,facing:n}):s.jsx(rse,{act:t,facing:n})}const xse={"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 YU(e,t,n=x){return t&&kl(t.id)===e?t.name:Jm(e)?n("radio.fm.custom"):xse[e]}function Vv(e,t){var a;const n=((a=e[0])==null?void 0:a.length)??0;return s.jsx("svg",{viewBox:`0 0 ${n} ${e.length}`,shapeRendering:"crispEdges","aria-hidden":!0,children:Oo(e).map(i=>s.jsx("rect",{x:i.x,y:i.y,width:i.w,height:1,fill:i.cell==="s"?"var(--fm-prop-shadow, var(--bg))":i.cell==="l"?"var(--fm-prop-light, var(--text))":i.cell==="a"?"var(--accent)":void 0},`${t}${i.y}-${i.x}`))})}const cq={litter:Vv(Gv.litter,"litter"),ball:Vv(Gv.ball,"ball"),scope:Vv(Gv.scope,"scope")};function Cse(e,t=x){try{return new URL(e).host}catch{return t("radio.fm.server")}}const Sse=m.memo(function({player:t,source:n,customStation:a,character:i="deck"}){const o=se(),{probe:r,dead:c,playing:d,press:u}=t,{scene:h,suspended:g,x:f,walkMs:b,act:k,prop:y,ballFlight:N,place:w,facing:j,riser:S,dance:A,beatMs:T}=nse(r,c,d);if(!r||c)return null;const q=YU(n,a,o),_=r.audio?Cse(r.audio,o):"YouTube";return s.jsxs("div",{ref:h,className:"fm","data-suspended":g?"":void 0,"data-place":w,style:{"--fm-beat":`${T}ms`},children:[y&&!y.held&&s.jsx("div",{className:"fm-prop","data-prop":y.kind,"data-leaving":y.leaving?"":void 0,style:{"--fm-prop-x":`${y.at}px`,"--fm-roll-to":`${N.x}px`,"--fm-ball-drop":`${N.drop}px`,"--fm-ball-flight-ms":`${HU}ms`,"--fm-ball-turn":j==="right"?"1080deg":"-1080deg"},children:cq[y.kind]}),(k==="lasso"||k==="rope-throw"||k==="rope-catch"||k==="climb"||k==="pull-up")&&s.jsxs("div",{className:"fm-rope","data-act":k,style:{"--fm-rope-x":`${f}px`,"--fm-rope-ms":`${b}ms`},children:[s.jsx("div",{className:"fm-rope-line"}),s.jsxs("svg",{className:"fm-rope-hook",viewBox:"0 0 9 9",shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsx("path",{d:"M4 8V3H3V1H1V3H0V5H2V4H3V6H5V4H6V5H8V3H7V1H5V3H4"}),s.jsx("rect",{className:"fm-rope-knot",x:"3",y:"6",width:"3",height:"2"})]})]}),s.jsxs("div",{className:"fm-walker","data-act":k??void 0,"data-place":w,"data-facing":j,style:{"--fm-x":`${f}px`,"--fm-walk-ms":`${b}ms`,"--fm-riser":`${S}px`,"--fm-skip-beat":`${WU}ms`},children:[(y==null?void 0:y.held)&&s.jsx("div",{className:"fm-held","data-prop":y.kind,"data-toss":y.leaving?"":void 0,children:cq[y.kind]}),["cast","fish","reel","stow"].includes(k)&&s.jsxs("svg",{className:"fm-fishing",viewBox:"0 0 24 32",shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsxs("g",{children:[s.jsx("path",{d:"M24 11H22V9H20V7H18V5H16V3H13V2H8"}),s.jsx("rect",{className:"fm-fishing-grip",x:"21",y:"9",width:"3",height:"3"})]}),s.jsxs("g",{className:"fm-fishing-line",children:[s.jsx("path",{d:"M8 2V26"}),s.jsxs("g",{className:"fm-float",children:[s.jsx("rect",{x:"7",y:"25",width:"3",height:"2"}),s.jsx("rect",{x:"8",y:"24",width:"1",height:"1"})]})]}),s.jsx("path",{className:"fm-ripple",d:"M3 28H6M10 28H14M5 30H12"})]}),["skip-ready","skip","skip-rest"].includes(k)&&s.jsxs("svg",{className:"fm-skipping-rope",viewBox:"0 0 26 26",shapeRendering:"crispEdges","aria-hidden":!0,children:[s.jsx("path",{className:"fm-skip-back",d:"M5 18H3V8H5V5H8V2H18V5H21V8H23V18H21"}),s.jsx("path",{className:"fm-skip-forward",d:"M5 18H3V14H5V11H8V9H18V11H21V14H23V18H21"}),s.jsx("path",{className:"fm-skip-front",d:"M5 18H3V21H5V23H8V25H18V23H21V21H23V18H21"}),s.jsx("path",{className:"fm-skip-return",d:"M5 18H3V19H8V20H18V19H23V18H21"}),s.jsx("path",{className:"fm-skip-handles",d:"M5 17V19M21 17V19"})]}),s.jsx("button",{type:"button",className:"fm-sprite","data-playing":d?"":void 0,"data-dance":d?A??GU[0]:void 0,onClick:u,title:d?o("radio.fm.stop",{label:q}):o("radio.fm.playTitle",{label:q,from:_}),"aria-label":d?o("radio.fm.stop",{label:q}):o("radio.fm.play",{label:q}),children:s.jsx(JU,{character:i,act:k,facing:j})})]})]})});function Nse({player:e,label:t}){const{probe:n,armed:a,frame:i,say:o}=e;return n?s.jsx(s.Fragment,{children:a&&!n.audio&&(n.channel||n.video)&&s.jsx("iframe",{ref:i,className:"fm-frame",title:t,src:Qne(n.channel,window.location.origin,n.video),onLoad:()=>o(eae()),allow:"autoplay; encrypted-media",sandbox:"allow-scripts allow-same-origin allow-presentation"})}):null}const jse={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 Ase({name:e}){return s.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:s.jsx("path",{d:jse[e]})})}function Tse({opening:e=!1}){const t=se(),[n,a]=m.useState(()=>document.hidden);return m.useEffect(()=>{const i=()=>a(document.hidden);return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)},[]),s.jsxs("div",{className:"radio-tuning",role:"status","data-paused":n||void 0,children:[s.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:[s.jsxs("g",{className:"radio-tuning-tower",children:[s.jsx("circle",{cx:"40",cy:"24",r:"4"}),s.jsx("path",{d:"M40 28v60 M40 36L24 88h32L40 36 M31 66h18 M28 77h24 M20 92h40"}),s.jsx("path",{d:"M29 17a15 15 0 0 0 0 14 M51 17a15 15 0 0 1 0 14"})]}),s.jsxs("g",{className:"radio-tuning-send",children:[s.jsx("path",{d:"M75 26q7 8 0 16"}),s.jsx("path",{d:"M102 26q7 8 0 16"}),s.jsx("path",{d:"M129 26q7 8 0 16"})]}),s.jsxs("g",{className:"radio-tuning-receiver",children:[s.jsx("path",{d:"M165 49l30-22"}),s.jsx("rect",{x:"154",y:"49",width:"66",height:"43",rx:"7"}),s.jsx("path",{d:"M161 92v3 M213 92v3 M163 60h17 M163 66h17 M163 72h17 M163 78h17"}),s.jsx("circle",{cx:"202",cy:"65",r:"7"}),s.jsx("path",{d:"M202 62v3l3 2 M197 81h10"})]})]}),s.jsx("strong",{children:t(e?"radio.loading.opening":"radio.loading.tuning")}),s.jsx("span",{children:t(e?"radio.loading.ready":"radio.loading.finding")})]})}function Rse({onClose:e}){const t=se(),[n]=m.useState(()=>{var i;return((i=document.activeElement)==null?void 0:i.matches(":focus-visible"))??!1}),a=Tt(e);return s.jsxs("div",{ref:a,className:"radio-loading nodrag nopan",role:"dialog","aria-modal":"true","aria-label":t("radio.loading.opening"),"data-keyboard-interaction":n||void 0,onKeyDown:Wee,children:[s.jsx("button",{type:"button",className:"icon-btn","aria-label":t("radio.close"),onClick:e,children:s.jsx(Ase,{name:"close"})}),s.jsx(Tse,{opening:!0})]})}const Ese=m.lazy(()=>Hr(()=>import("./RadioPanel-DKmUHqxX.js"),[]));function qse({fm:e,characterEnabled:t,character:n,open:a,onClose:i}){const[o,r]=m.useState(!1),c=se(),[d,u]=m.useState("connecting"),h=c(`radio.disabled.${d}`),g=dae(),[f,b]=m.useState(null),k=m.useRef(new Set);m.useEffect(()=>{const z=new AbortController;return fetch("/api/music-config",{signal:z.signal}).then(F=>F.ok?F.json():null).then(F=>{z.signal.aborted||(r((F==null?void 0:F.enabled)===!0),u(F?"off":"unreachable"))}).catch(()=>{z.signal.aborted||u("unreachable")}),()=>z.abort()},[a]);const y=e.customFmStations.find(z=>kl(z.id)===e.fmSource),N=y!=null&&y.radio?y:void 0,w=rae({volume:e.fmVolume,muted:e.fmMuted,source:e.fmSource,playRequest:e.fmPlayRequest,customStation:y,enabled:o,onAvailabilityChange:e.markFmStationAvailability}),j=YU(e.fmSource,y,c),S=o&&N&&w.dead&&e.fmPlayRequest>0?UU(f??g.catalogue,N.id,k.current):null,{remember:A}=g,T=(y==null?void 0:y.id)??e.fmSource;m.useEffect(()=>{w.playing&&A(T)},[T,w.playing,A]);const q=i,_=Rt(i),I=m.useCallback((z,F=!1)=>{var R;if(!o)return;F||k.current.clear();const U=kl(z.id),P=U===e.fmSource;if(P&&w.armed&&!w.dead){w.press();return}const L=P&&!!y&&(y.url!==z.url||((R=y.radio)==null?void 0:R.hls)!==z.radio.hls);e.addFmStation(z,!0),P&&!w.dead&&!L?w.press():e.pickFmSource(U,L),fetch(`/api/radio-click?id=${encodeURIComponent(z.id)}`).catch(()=>{})},[o,y,e.addFmStation,e.fmSource,e.pickFmSource,w.armed,w.dead,w.press]);return m.useEffect(()=>{w.playing&&!w.dead&&k.current.clear()},[w.playing,w.dead]),m.useEffect(()=>{if(!(!o||!N||!w.dead||e.fmPlayRequest===0))return uae(f??g.catalogue,N.id,k.current,z=>I(z,!0))},[o,N==null?void 0:N.id,w.dead,e.fmPlayRequest,f,g.catalogue,I]),s.jsxs(s.Fragment,{children:[t&&s.jsx(Sse,{character:n,player:w,source:e.fmSource,customStation:y}),s.jsx(Nse,{player:w,label:j}),a&&_t.createPortal(s.jsx("div",{className:"modal-backdrop radio-backdrop",..._,children:s.jsx(m.Suspense,{fallback:s.jsx(Rse,{onClose:q}),children:s.jsx(Ese,{fm:e,player:w,library:g,selected:N,label:j,enabled:o,disabledReason:h,autoNext:S==null?void 0:S.name,onPick:I,onQueueChange:b,onClose:q})})}),document.body)]})}function _se({data:e}){const t=se(),n=si(3e4),a=e.note,i=e.plan??null,o=(a==null?void 0:a.kind)==="recap",r=$g((a==null?void 0:a.at)??(i==null?void 0:i.at)??n,n),c=`${o?"recap-note":`recap-note is-status status-${(a==null?void 0:a.kind)??"plan"}`}${i?" has-plan":""}`,d=o||!a?void 0:Gm(a),u=ai(i),h=a?Rl(a.kind):`${t("board.detail.plan").toLowerCase()} ${u?`${u.done}/${u.total}`:""}`.trim();return s.jsxs("div",{className:c,role:"note","aria-label":o?t("board.node.recapLabel"):t("board.node.noteLabel",{tag:h}),"aria-description":d,style:{"--session-hue":e.hue},children:[s.jsxs("div",{className:"recap-note-head",title:d,children:[s.jsxs("span",{className:"recap-note-mark",children:[s.jsx(Gg,{recap:o}),h]}),s.jsx("span",{className:"recap-note-age",title:r.title,children:r.label}),s.jsx("button",{type:"button",className:"glyph-btn recap-note-close","aria-label":t(o?"board.node.hideRecap":a?"board.node.hideNote":"board.node.hidePlan"),title:t("board.note.hideTitle"),onClick:g=>{g.stopPropagation(),dte(e.noteKey)},children:"×"})]}),a&&s.jsx("p",{className:"recap-note-text",title:yte(a.text,d),children:a.text}),(a==null?void 0:a.reply)&&s.jsx("p",{className:"recap-note-reply",title:t("board.list.reply",{reply:a.reply}),children:t("board.list.reply",{reply:a.reply})}),i&&s.jsx(lq,{plan:i,head:a!=null}),s.jsxs("div",{className:"lod-face recap-face","aria-hidden":!0,children:[s.jsxs("div",{className:"lod-id",children:[s.jsxs("span",{className:"recap-note-mark",children:[s.jsx(Gg,{recap:o}),h]}),s.jsx("span",{className:"recap-face-age",children:r.label})]}),a&&s.jsx("p",{className:"recap-face-text",children:a.text}),i&&s.jsx(lq,{plan:i,head:a!=null,face:!0})]}),s.jsx(Pr,{type:"source",position:it.Right,style:{background:"transparent",border:"none"}})]})}const zse={completed:"board.state.done",in_progress:"board.detail.now",pending:"board.detail.todo"};function lq({plan:e,head:t,face:n=!1}){const a=se(),i=ai(e);if(!i)return null;const o=hQ(e.items);return s.jsxs("div",{className:n?"recap-face-plan":"recap-note-plan",title:n?void 0:zm(e.items),children:[t&&s.jsxs("div",{className:"recap-note-plan-head",children:[a("board.detail.plan")," ",s.jsxs("span",{className:"recap-note-plan-count",children:[i.done,"/",i.total,i.allDone?` · ${a("board.state.done")}`:""]})]}),!i.allDone&&s.jsxs("ol",{className:"plan-list",children:[o.shown.map((r,c)=>s.jsxs("li",{className:"plan-item","data-status":r.status,children:[s.jsx("span",{className:"plan-mark","aria-hidden":!0}),!n&&s.jsxs("span",{className:"vis-hidden",children:[a(zse[r.status]),a("board.detail.colon")]}),s.jsx("span",{className:"plan-text",children:r.status==="in_progress"&&r.active?r.active:r.text}),r.status==="in_progress"&&s.jsx("span",{className:"plan-now","aria-hidden":!0,children:a("board.detail.now")})]},r.id??`${c}:${r.text}`)),(o.before>0||o.after>0)&&s.jsx("li",{className:"recap-note-plan-more",children:[o.before>0?a("board.note.earlier",{n:o.before}):null,o.after>0?a("board.note.more",{n:o.after}):null].filter(Boolean).join(" · ")})]})]})}function Ao(){var t;return typeof navigator>"u"?"":((t=navigator.userAgentData)==null?void 0:t.platform)||navigator.platform||""}function Po(e){return/mac|iphone|ipad/i.test(e)}const Zg=e=>new Map([...e].map(([t,n])=>[t,{x:n.x,y:n.y}]));function Lse(e,t,n){return{positions:Zg(e.positions),pinned:Zg(e.pinned),provisional:new Set(e.provisional),layoutSig:e.layoutSig.current,stored:{...t},viewport:n?{...n}:null}}function Ose(e,t){t.positions.clear();for(const[n,a]of Zg(e.positions))t.positions.set(n,a);t.pinned.clear();for(const[n,a]of Zg(e.pinned))t.pinned.set(n,a);t.provisional.clear();for(const n of e.provisional)t.provisional.add(n);t.layoutSig.current=e.layoutSig}const dq=7e3,Pse=2e3,Mse=140,Ise=(e=x)=>e("board.rearrange.text"),Dse=(e=x)=>e("board.rearrange.said"),uq=(e=x)=>e("board.rearrange.restored"),Fse={set:(e,t)=>setTimeout(e,t),clear:e=>clearTimeout(e),now:()=>Date.now()};function Use(e,t=Fse){let n=null,a=null,i=0,o=dq;const r=new Set,c=()=>{a!==null&&t.clear(a),a=null},d=()=>{c(),!(n===null||r.size>0)&&(i=t.now()+o,a=t.set(()=>{a=null,u()},o))};function u(){c(),r.clear(),n!==null&&(n=null,e(!1))}return{open(h){const g=n===null;n=h,o=dq,d(),g&&e(!0)},take(){const h=n;return u(),h},close:u,hold(h){n!==null&&(r.size===0&&a!==null&&(o=Math.max(0,i-t.now()),c()),r.add(h))},release(h){!r.delete(h)||r.size>0||n===null||(o=Math.max(o,Pse),d())},get isOpen(){return n!==null},get snapshot(){return n}}}function Bse(e){return(e.key==="z"||e.key==="Z")&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey}function Hse(e){return Po(e)?"⌘Z":"Ctrl+Z"}function Wse({undo:e}){const t=se(),{open:n,said:a,undo:i,dismiss:o,hold:r,release:c}=e,d=Vc(n,Mse),u=m.useRef(null);return m.useEffect(()=>n?jn.push(o,0,"popover"):void 0,[n,o]),m.useEffect(()=>{var g;if(n)return;const h=u.current;h&&h.contains(document.activeElement)&&((g=h.closest("main"))==null||g.focus({preventScroll:!0}))},[n]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:a}),ko(d)&&s.jsxs("div",{ref:u,className:d==="leaving"?"rearrange-undo leaving":"rearrange-undo",onPointerEnter:()=>r("hover"),onPointerLeave:()=>c("hover"),onFocus:()=>r("focus"),onBlur:h=>{h.currentTarget.contains(h.relatedTarget)||c("focus")},children:[s.jsx("span",{id:"rearrange-undo-state",className:"rearrange-undo-state",children:Ise(t)}),s.jsxs("button",{type:"button",className:"rearrange-undo-act",onClick:i,"aria-describedby":"rearrange-undo-state","aria-keyshortcuts":"Meta+Z Control+Z",children:[t("board.rearrange.undo"),s.jsx("span",{className:"rearrange-undo-key","aria-hidden":"true",children:Hse(Ao())})]})]})]})}function Gse({sourceX:e,sourceY:t,targetX:n,targetY:a,sourcePosition:i,targetPosition:o,style:r}){const[c]=Qj({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:a,targetPosition:o,curvature:.35});return s.jsxs("g",{className:"recap-tie",style:r,children:[s.jsx("path",{className:"recap-tie-thread",d:c,vectorEffect:"non-scaling-stroke"}),s.jsx("path",{className:"recap-tie-beads",d:c,vectorEffect:"non-scaling-stroke"}),s.jsx("circle",{className:"recap-tie-end",cx:e,cy:t,r:3.5}),s.jsx("circle",{className:"recap-tie-end",cx:n,cy:a,r:3.5})]})}function qN(e){return e.replace(/[^a-zA-Z0-9]/g,"")}function Xg(e,t){const n=qN(e);return n?n.slice(-t):e.slice(-t)}function ZU(e,t,n=4){const a=qN(e);if(!a)return Xg(e,n);let i=n;for(const o of t){if(o===e)continue;const r=qN(o);let c=0;for(;c<a.length&&c<r.length&&a[a.length-1-c]===r[r.length-1-c];)c++;i=Math.max(i,c+1)}return a.slice(-i)}function XU(e,t=x){const n=[e.tipWorkspace,e.planLine?t("board.cluster.plan",{plan:e.planLine}):void 0,e.tipRest||void 0].filter(Boolean).join(xr);return`${e.alarm?t("board.cluster.waitingOnYou"):""}${n}
|
|
130
130
|
${t("board.cluster.zoomTo")}
|
|
131
131
|
${t("board.cluster.dragWrapper")}`}const xr=" · ",$se=32,Vse=/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA000-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;function hq(e){return Vse.test(e)?2:1}function pq(e,t=$se){const n=[...e];let a=0;for(const r of n)a+=hq(r);if(a<=t)return e;const i=[];let o=0;for(const r of n){const c=hq(r);if(o+c>t-1)break;i.push(r),o+=c}for(;i.length&&/[\s\-_.:/]/.test(i[i.length-1]);)i.pop();return`${i.join("")}…`}function Kse(e,t,n,a,i=[],{branch:o,plan:r,alarm:c=!1}={}){const d=(t==null?void 0:t.trim())??"",u=a?ZU(n,i):void 0,h=[e,d||void 0,u].filter(Boolean),g=[o,d||void 0,u].filter(Boolean).join(xr);return{label:pq(e),name:d?pq(d):void 0,shortId:u,fullLabel:h.join(xr),title:XU({alarm:c,tipWorkspace:e,tipRest:g,planLine:r}),tipWorkspace:e,tipRest:g}}const Cr=18,_N=26,IA=12,Eu=240,DA=130,zN=Cr*2+_N+IA,Jse=72,il=zN+Jse,kg=24,QU=70,Qg=Cr*2+kg,wl=il;function eB(e,t){var a;let n=Eu;for(const i of e)n=Math.max(n,((a=t.get(i.id))==null?void 0:a.width)??Eu);return n}const ol=420,wg=300,em=130,tB=160,nB=1;function Yse(e,t,n,a){return Math.min(nB,n/Math.max(1,e),a/Math.max(1,t))}function Tn(e){const t=e.data;return(t==null?void 0:t.canvasSessionId)??(t==null?void 0:t.sessionId)??"_default"}function Zm(e,t=()=>!0){const n=new Map;for(const a of e){if(!t(a))continue;const i=Tn(a),o=n.get(i);o?o.push(a):n.set(i,[a])}return n}function Zse(e,t){return((t==null?void 0:t.get(e))??0)>0?ol:0}function Xse(e,t){const n=(t==null?void 0:t.get(e))??0;return n>0?6+n*36:0}function qu(e,t){const n=t.get(e);return{w:(n==null?void 0:n.width)??Eu,h:(n==null?void 0:n.height)??DA}}function El(e,t,n){const a=qu(e,t);return{w:a.w+Zse(e,n),h:Math.max(a.h,Xse(e,n))}}function Qse(e){return[...e.keys()].sort().map(t=>`${t}:${e.get(t)}`).join("|")}const eie=240,aB=16;function sB(e,t){return(e+eie)*(t||1)}function tie(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 nie(e,t,n,a){return{position:"absolute",left:e.x+aB,top:e.y-IA/(t||1),transform:`scale(${1/(t||1)})`,transformOrigin:"left top",maxWidth:a??sB(e.w,t),"--session-hue":n}}function aie(e){const t=new Map;for(const i of e){if(i.type!=="agent"&&i.type!=="recapNote")continue;const o=i.data;if(!(o!=null&&o.sessionId)||o.exitAt!=null||i.width==null||i.height==null)continue;const r=i.position.x,c=i.position.y,d=r+i.width,u=c+i.height,h=t.get(Tn(i)),g=o.canvasSessionId&&o.canvasSessionId!==o.sessionId?null:sie(o);h?(h.minX=Math.min(h.minX,r),h.minY=Math.min(h.minY,c),h.maxX=Math.max(h.maxX,d),h.maxY=Math.max(h.maxY,u),g&&(h.label=g.label??h.label,h.name=g.name,h.alarm=g.alarm,h.branch=g.branch,h.plan=g.plan,h.planLine=g.planLine)):t.set(Tn(i),{minX:r,minY:c,maxX:d,maxY:u,label:(g==null?void 0:g.label)??o.sessionId,name:g==null?void 0:g.name,alarm:(g==null?void 0:g.alarm)??!1,branch:g==null?void 0:g.branch,plan:g==null?void 0:g.plan,planLine:g==null?void 0:g.planLine})}const n=new Map;for(const[i,o]of t){const r=n.get(o.label);r?r.push(i):n.set(o.label,[i])}const a=[];for(const[i,o]of t){const r=n.get(o.label)??[],c=r.length>1;a.push({sessionId:i,...Kse(o.label,o.name,i,c,r,{branch:o.branch,plan:o.planLine,alarm:o.alarm}),x:o.minX-Cr,y:o.minY-Cr-_N,w:o.maxX-o.minX+Cr*2,h:o.maxY-o.minY+Cr*2+_N,...o.alarm?{alarm:!0}:null,...o.branch?{branch:o.branch}:null,...o.plan?{plan:o.plan,planLine:o.planLine}:null})}return a}function sie(e){if(e.kind!=="root")return null;const t=e.branch,n=ai(e.plan);return{label:e.label,name:Um(e.sessionName,e.sessionTitle).face,alarm:ea(e.waiting),branch:t&&t.total>0?bU(t):void 0,plan:n?`plan ${n.done}/${n.total}`:void 0,planLine:n?fA(n):void 0}}function iie(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const a=e[n],i=t[n];if(a.sessionId!==i.sessionId||a.label!==i.label||a.name!==i.name||a.shortId!==i.shortId||a.alarm!==i.alarm||a.branch!==i.branch||a.plan!==i.plan||a.planLine!==i.planLine||a.fullLabel!==i.fullLabel||a.title!==i.title||a.x!==i.x||a.y!==i.y||a.w!==i.w||a.h!==i.h)return!1}return!0}const oie=20,Ci=4,rie=64,cie=".cat-filter-bar, .react-flow__panel, .autofit-chip, .rearrange-undo, .usage-panel, .sysdetail, .detail";function lie(e,t,n,a){const i=t.zoom||1,o=sB(e.w,i);if(n.width<=0||n.height<=0)return{maxWidth:o,hidden:!1};const r=(e.x+aB)*i+t.x,c=e.y*i+t.y-IA,d=c+oie;let u=Math.min(o,n.width-Ci-r),h=r<Ci||c<Ci||d>n.height-Ci;for(const g of a)if(!(g.top-Ci>=d||g.bottom+Ci<=c)&&!(g.right+Ci<=r)){if(g.left-Ci<=r){h=!0;break}u=Math.min(u,g.left-Ci-r)}return u<rie&&(h=!0),{maxWidth:Math.max(0,u),hidden:h}}function die(e){const t=e.getBoundingClientRect(),n=[];for(const a of e.ownerDocument.querySelectorAll(cie)){const i=a.getBoundingClientRect(),o=Math.max(i.left,t.left)-t.left,r=Math.max(i.top,t.top)-t.top,c=Math.min(i.right,t.right)-t.left,d=Math.min(i.bottom,t.bottom)-t.top;c-o<1||d-r<1||n.push({left:Math.round(o),top:Math.round(r),right:Math.round(c),bottom:Math.round(d)})}return n}function uie(e,t){return e.length===t.length&&e.every((n,a)=>{const i=t[a];return n.left===i.left&&n.top===i.top&&n.right===i.right&&n.bottom===i.bottom})}const hie=500;function iB({focus:e,setTimeout:t,clearTimeout:n,ms:a=hie}){let i=null;const o=()=>{i!==null&&(n(i),i=null)};return{hold(r){o(),i=t(()=>{i=null;try{e(r)}catch{}},a)},cancel:o}}function pie(e){return aie(e.nodeInternals.values())}const gie=e=>e.width,mie=e=>e.height,fie=e=>{var t;return((t=e.domNode)==null?void 0:t.querySelector(".react-flow__viewport"))??null};function bie({onFocusSession:e}){const t=se(),{x:n,y:a,zoom:i}=a2(),o=jt(pie,iie),r=jt(gie),c=jt(mie),d={width:r,height:c},u=m.useRef(null),h=jt(fie),[g,f]=m.useState([]);m.useLayoutEffect(()=>{var _;const A=(_=u.current)==null?void 0:_.parentElement;if(!A)return;const T=die(A),q=requestAnimationFrame(()=>{f(I=>uie(I,T)?I:T)});return()=>cancelAnimationFrame(q)});const b=m.useRef(e);b.current=e;const[k]=m.useState(()=>iB({focus:A=>{var T;return(T=b.current)==null?void 0:T.call(b,A)},setTimeout:(A,T)=>window.setTimeout(A,T),clearTimeout:A=>window.clearTimeout(A)}));if(m.useEffect(()=>()=>k.cancel(),[k]),o.length<=1)return null;const y=A=>{try{e==null||e(A)}catch{}},N=(A,T)=>{A.detail>0&&Sl()?k.hold(T):y(T)},w={transform:`translate(${n}px, ${a}px) scale(${i})`},j=s.jsx("div",{className:"session-clusters",style:w,ref:u,children:o.map(A=>{const T=ju(A.sessionId),q=tie(A,T);return s.jsx("div",{className:"cluster-card",style:q,"aria-hidden":!0},A.sessionId)})}),S=h&&_t.createPortal(s.jsx("div",{className:"cluster-labels nopan",children:o.map(A=>{const T=ju(A.sessionId),q=lie(A,{x:n,y:a,zoom:i},d,g),_=nie(A,i,T,q.maxWidth);return s.jsxs("button",{type:"button",className:"cluster-label","data-alarm":A.alarm?"":void 0,"data-offpane":q.hidden?"":void 0,style:_,title:XU(A,t),onClick:I=>N(I,A.sessionId),children:[A.alarm?s.jsxs(s.Fragment,{children:[s.jsx(TA,{}),s.jsx("span",{className:"cluster-label-said",children:t("board.cluster.waitingOnYou")})]}):null,A.label,A.plan?s.jsx("span",{className:"cluster-label-plan",children:xr+t("board.cluster.planCount",{progress:A.plan.replace(/^plan /,"")})}):null,A.branch?s.jsx("span",{className:"cluster-label-branch",children:xr+A.branch}):null,A.name?s.jsx("span",{className:"cluster-label-name",children:xr+A.name}):null,A.shortId?s.jsx("span",{className:"cluster-label-id",children:xr+A.shortId}):null]},A.sessionId)})}),h);return s.jsxs(s.Fragment,{children:[j,S]})}function vie({data:e}){return s.jsx("div",{className:"session-group-handle",style:{width:(e==null?void 0:e.w)??0,height:(e==null?void 0:e.h)??0}})}const oB=600,kie=4,wie=36,tm=14,yie=60,xie=6,gq=220,Cie=96,Sie=28;function Nie(e,t){return Math.max(Cie,61+[...t].length*6.8)}function jie(e){return e.endedAt==null?"inflight":e.ok===!1?"err":"done"}function Aie(e,t){if(t==null)return 1;const n=e-t;return n<0?1:Math.max(0,1-n/oB)}function Tie(e,t){const n=[],a=new Set;for(let i=e.length-1;i>=0&&n.length<t;i--){const o=e[i];a.has(o.id)||(a.add(o.id),n.push(o))}return n.reverse()}function Rie(e,t,n,a,i,o){const r=[];for(const c of e.values()){if(!t.has(c.id)||c.exitAt!=null&&o-c.exitAt>oB)continue;const d=a.get(c.id)??n.get(c.id);if(!d)continue;const u=Tie(c.tools,kie);if(u.length===0)continue;const h=c.exitAt??null,g=i.get(c.id),f=Math.max((g==null?void 0:g.width)??gq,gq),b=(g==null?void 0:g.height)??130,k=d.x,y=d.y,N=k+f,w=y+b/2;u.forEach((j,S)=>{const A=S*wie,T=k+f+yie,q=y+xie+A,_=Aie(o,h),I=j.inputPreview??"",z=jie(j),F=_<.999,U=jA(j.name);r.push({id:`${c.id}::${j.id}`,toolId:j.id,agentId:c.id,toolName:j.name,name:U.label,emoji:U.emoji,status:z,category:vU(j.name),mcpHue:U.hue,inputPreview:I,fade:_,fading:F,worldX:T,worldY:q,anchorX:N,anchorY:w,spawnDx:N-T,spawnDy:w-(q+tm)});const P=xU(j.name,j.input);if(P){const L=Nie(j.name,U.label),R=T+L+Sie,O=q,D=T+L,$=q+tm;r.push({id:`sub:${c.id}::${j.id}`,toolId:j.id,agentId:c.id,toolName:j.name,name:Jte(P.label,P.category),fullName:P.label,emoji:P.emoji,isSub:!0,status:z,category:P.category,inputPreview:P.detail??I,fade:_,fading:F,worldX:R,worldY:O,anchorX:D,anchorY:$,spawnDx:D-R,spawnDy:0})}})}return r}function Eie({agents:e,visibleAgentIds:t,positions:n,pinned:a,measured:i,spotlight:o,hiddenCategories:r,now:c,onOpenTool:d}){const u=Rie(e,t,n,a,i,c),h=r&&r.size>0?u.filter(g=>!r.has(g.category)):u;return s.jsx(qie,{bursts:h,spotlight:o,onOpenTool:d})}function qie({bursts:e,spotlight:t,onOpenTool:n}){const a=e.map(o=>{const r=o.anchorX,c=o.anchorY,d=o.worldX+6,u=o.worldY+tm,h=Math.max(1,d-r),g=Math.min(1,Math.abs(u-c)/h),f=r+h*(.55-.22*g),b=c+(u-c)*.12,k=d-h*.25,y=t!=null&&!t.has(o.agentId),N=o.fade*(y?.14:1);return s.jsx("path",{d:`M ${r} ${c} C ${f} ${b}, ${k} ${u}, ${d} ${u}`,className:`tool-conn status-${o.status}${o.fading?" fading":""}`,opacity:N,vectorEffect:"non-scaling-stroke"},`l:${o.id}`)}),i=e.map(o=>s.jsx(Lie,{b:o,dim:t!=null&&!t.has(o.agentId),onOpenTool:n},o.id));return s.jsx(_ie,{connectors:a,bubbles:i})}function _ie({connectors:e,bubbles:t}){const{x:n,y:a,zoom:i}=a2();return s.jsxs("div",{className:"tool-bursts-layer","aria-hidden":!0,style:{"--tool-burst-height":`${2*tm}px`},children:[s.jsx("svg",{className:"tool-bursts-svg",children:s.jsx("g",{transform:`translate(${n} ${a}) scale(${i})`,children:e})}),s.jsx("div",{className:"tool-bursts-world",style:{transform:`translate(${n}px, ${a}px) scale(${i})`},children:t})]})}function zie(e,t){const n=e.b,a=t.b;return e.dim===t.dim&&e.onOpenTool===t.onOpenTool&&n.id===a.id&&n.toolId===a.toolId&&n.worldX===a.worldX&&n.worldY===a.worldY&&n.spawnDx===a.spawnDx&&n.spawnDy===a.spawnDy&&n.status===a.status&&n.fading===a.fading&&n.category===a.category&&n.mcpHue===a.mcpHue&&n.isSub===a.isSub&&n.emoji===a.emoji&&n.name===a.name&&n.fullName===a.fullName&&n.toolName===a.toolName&&n.inputPreview===a.inputPreview}const Lie=m.memo(function({b:t,dim:n,onOpenTool:a}){const i={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,r=t.inputPreview?`${o} · ${t.inputPreview}`:o,c=a!=null,d=t.mcpHue!=null?{"--mcp-hue":t.mcpHue}:{},u=n?" dim":"";return s.jsx("div",{className:"tool-burst-wrap",style:i,children:s.jsxs("div",{className:`tool-burst cat-${t.category}${t.mcpHue!=null?" mcp-hue":""} status-${t.status}${t.fading?" fading":""}${c?" clickable":""}${t.isSub?" sub":""}${u}`,style:d,title:r,onClick:c?()=>a(t.agentId,t.toolId):void 0,children:[s.jsx("span",{className:"tb-emoji",children:t.emoji}),s.jsx("span",{className:"tb-name",children:t.name}),t.status==="inflight"&&s.jsx("span",{className:"tb-spin"}),t.status==="done"&&s.jsx("span",{className:"tb-mark done",children:"✓"}),t.status==="err"&&s.jsx("span",{className:"tb-mark err",children:"×"})]})})},zie),Oie={width:140,height:105},Pie={agent:yne,sessionGroup:vie,recapNote:_se},Mie={recapTie:Gse},mq=400;function Iie({graph:e,layout:t,viewport:n,clicks:a,drag:i,appearance:o,fm:r,radioOpen:c,onRadioClose:d,autoFit:u,pause:h,stateRef:g,measuredRef:f,hiddenCats:b,now:k,openTool:y,focusAgent:N,requestClear:w,setKeyHelpOpen:j}){const S=se(),{allNodes:A,edges:T,visibleAgentIds:q,spotlightSet:_}=e,{positionsRef:I,pinnedRef:z,handleRelayout:F,rearrangeUndo:U}=t,{restoredViewport:P,onMoveStart:L,onMove:R}=n,{onNodeClick:O,onPaneClick:D,onNodeDoubleClick:$,onNodeMouseEnter:B,onNodeMouseLeave:G}=a,{onNodeDragStart:Z,onNodeDrag:W,onNodeDragStop:H}=i,{palette:X,minimapNodeFill:V,characterEnabled:Q}=o,{autoFitDisabled:Y,enableAutoFitAndRefit:K}=u,{paused:ee,pauseGate:te,togglePause:ce}=h;return s.jsxs(n2,{nodes:A,edges:T,nodeTypes:Pie,edgesFocusable:!1,edgeTypes:Mie,fitView:!P,fitViewOptions:{padding:.25,duration:mN({durationMs:mq,documentHidden:document.hidden})?mq:0},minZoom:c2,maxZoom:l2,panOnScroll:!0,panActivationKeyCode:null,nodesDraggable:!0,nodesConnectable:!1,selectionOnDrag:!1,nodeDragThreshold:5,disableKeyboardA11y:!0,deleteKeyCode:null,onNodeClick:O,onPaneClick:D,onNodeDoubleClick:$,onNodeMouseEnter:B,onNodeMouseLeave:G,onMoveStart:L,onMove:R,onNodeDragStart:(ge,ve,pe)=>{U.dismiss(),Z(ge,ve,pe)},onNodeDrag:W,onNodeDragStop:H,children:[s.jsx(T8,{gap:28,size:1,color:X["--grid-line"]}),s.jsx(bie,{onFocusSession:N}),s.jsx(Eie,{agents:g.current.agents,visibleAgentIds:q,positions:I.current,pinned:z.current,measured:f.current,spotlight:_,hiddenCategories:b,now:k,onOpenTool:y}),s.jsxs("div",{className:"canvas-notices",children:[Y&&s.jsx(Rne,{enableAutoFitAndRefit:K}),s.jsx(Wse,{undo:U})]}),s.jsx(Une,{autoFitDisabled:Y,enableAutoFitAndRefit:K,paused:ee,pauseGate:te,togglePause:ce,handleRelayout:F,requestClear:w,setKeyHelpOpen:j}),s.jsx(m8,{ariaLabel:S("board.minimap"),style:Oie,zoomable:!0,pannable:!0,nodeColor:V,nodeStrokeWidth:2,maskColor:X["--minimap-mask"],maskStrokeColor:X["--line"]}),s.jsx(qse,{fm:r,character:o.character,characterEnabled:Q,open:c,onClose:d})]})}function Die(){const e=se(),t=window.ccdeckWindow;return m.useEffect(()=>{if(!t)return;const n=()=>{const i=document.querySelector(".topbar");if(!i)return;const o=getComputedStyle(i),r=c=>{var u;const d=(u=c.match(/\d+/g))==null?void 0:u.slice(0,3);return(d==null?void 0:d.length)===3?`#${d.map(h=>Number(h).toString(16).padStart(2,"0")).join("")}`:"#191a1c"};t.colors({color:r(o.backgroundColor),symbolColor:r(o.color)}).catch(()=>{})};n();const a=new MutationObserver(n);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-color-scheme"]}),()=>a.disconnect()},[t]),!t||t.platform==="darwin"?null:s.jsx("button",{type:"button",className:"desktop-menu btn","aria-label":e("shell.appMenu"),title:e("shell.appMenu"),"aria-haspopup":"menu",onClick:()=>{t.menu().catch(()=>{})},children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M3 4h10M3 8h10M3 12h10",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})})})}const Fie=600;function Xm(e,t){return!(e.exitAt!=null&&t-e.exitAt>Fie||e.kind==="root"&&e.state==="done"&&e.tools.length===0&&e.endedAt!=null&&e.endedAt-e.startedAt<3e3&&!e.stopFailure)}function Uie(e,t){const n=new Set;for(const a of e.agents.values())Xm(a,t)&&n.add(a.id);return n}function Bie(e,t,n=0){return e.right+n>t.left&&e.left-n<t.right&&e.bottom+n>t.top&&e.top-n<t.bottom}function Hie(e,t,n=0){if(!e)return!1;for(const a of t)if(Bie(e,a,n))return!0;return!1}function fq(e){return e.waiting?ea(e.waiting)?0:1:e.state==="active"?2:3}function rB(e,t){var a;const n=[];for(const i of e.agents.values()){if(i.kind!=="root")continue;let o=i.toolCount,r=pa(i).total,c=i.endedAt??i.startedAt;for(const g of e.agents.values()){if(g.sessionId!==i.sessionId||g.kind==="root")continue;o+=g.toolCount,r+=pa(g).total;const f=g.endedAt??g.startedAt;f>c&&(c=f)}const d=SA(i),u=(d==null?void 0:d.kind)==="recap"?{text:d.text,at:d.at}:null,h=d&&d.kind!=="recap"?d:null;n.push({sessionId:i.sessionId,label:i.label||i.cwdBasename||x("board.kind.session"),cwdBasename:i.cwdBasename,state:al(i),waiting:i.waiting,recap:u,status:h,modelId:i.model,effort:i.effort,plan:ai(i.plan),planTitle:zm(((a=i.plan)==null?void 0:a.items)??[]),toolCount:o,cost:r,startedAt:i.startedAt,lastActivity:c})}return n.sort((i,o)=>{const r=fq(i),c=fq(o);return r!==c?r-c:i.waiting&&o.waiting?i.waiting.since-o.waiting.since:o.lastActivity-i.lastActivity}),n}function Wie(e,t){return[e.text,e.reply?t("board.list.suggestedReply",{reply:e.reply}):"",Gm(e)].filter(Boolean).join(`
|
|
132
132
|
`)}function _u(e,t,n){const a=(t??n)-e;if(a<1e3)return"<1s";const i=Math.floor(a/1e3);if(i<60)return`${i}s`;const o=Math.floor(i/60);return o<60?`${o}m`:`${Math.floor(o/60)}h ${o%60}m`}function Gie({state:e,now:t,selectedIds:n,onSelect:a,onClose:i,removedIds:o,onBringBackAll:r,leaving:c=!1}){const d=se(),u=Aa(),h=On(),g=m.useMemo(()=>rB(e),[e,e.revision,t]),f=g.filter(k=>k.state==="active").length,b=g.filter(k=>ea(k.waiting)).length;return s.jsxs("aside",{className:`session-list${c?" leaving":""}`,id:"session-list","aria-label":d("board.list.title"),children:[s.jsxs("div",{className:"sl-header",children:[s.jsxs("h2",{children:[d("board.list.title")," ",s.jsx("span",{className:"sl-count",children:g.length})]}),b>0&&s.jsx("span",{className:"sl-waiting-count",children:d("board.list.waitingCount",{n:b})}),f>0&&s.jsx("span",{className:"sl-live-count",children:d("board.list.liveCount",{n:f})}),s.jsx("button",{className:"glyph-btn sl-close",onClick:i,title:zn(d("board.list.hideSidebar"),"L",h),"aria-label":d("board.list.hide"),children:"‹"})]}),s.jsxs("ul",{className:"sl-rows",children:[g.length===0&&s.jsx("li",{className:"sl-empty",children:d("board.list.empty")}),g.map(k=>{var w;const y=n.has(k.sessionId),N=(o==null?void 0:o.has(k.sessionId))??!1;return s.jsx("li",{className:"sl-row-item",children:s.jsxs("button",{type:"button",className:`sl-row state-${k.state}${y?" selected":""}${N?" removed":""}`,"aria-current":y?"true":void 0,onClick:()=>a(k.sessionId),title:N?d("board.list.bring",{label:k.label}):d("board.list.focus",{label:k.label}),children:[s.jsx("span",{className:`sl-dot state-${k.state}`,"aria-hidden":!0}),s.jsx("span",{className:"vis-hidden",children:No(k.state,d)}),s.jsxs("div",{className:"sl-row-body",children:[s.jsxs("div",{className:"sl-row-head",children:[s.jsx("span",{className:"sl-label",children:k.label}),N&&s.jsx("span",{className:"sl-removed",children:d("board.list.offBoard")}),k.modelId&&s.jsx("span",{className:"model-chip","data-family":Mm(k.modelId),title:Tu(k.modelId,k.effort),children:Im(k.modelId,k.effort)})]}),s.jsxs("div",{className:"sl-row-meta",children:[s.jsxs("span",{title:d("board.list.toolCalls"),children:[s.jsx("b",{children:k.toolCount})," ",d("board.meta.tools",{count:k.toolCount})]}),k.cost>0&&s.jsx("span",{className:"sl-cost",title:d("insights.board.sessionSpend"),children:s.jsx("b",{children:Nt(k.cost)})}),k.waiting?s.jsxs("span",{className:"sl-waiting",title:[fl(k.waiting,d),aU(k.waiting,fl(k.waiting,d),d),d(ea(k.waiting)?"board.list.blockedSince":"board.list.turnSince",{since:new Date(k.waiting.since).toLocaleTimeString(u),started:new Date(k.startedAt).toLocaleString(u)})].filter(Boolean).join(`
|
|
@@ -148,11 +148,11 @@ ${zm(e.plan.items)}`]}),s.jsx("p",{className:"node-peek-hint",children:a("insigh
|
|
|
148
148
|
${c("board.detail.modelCovers")}
|
|
149
149
|
${S.join(`
|
|
150
150
|
`)}`:Tu(e.model,e.effort),children:[Im(e.model,e.effort),S.length>0?` +${S.length}`:""]})]})})()]}),g&&s.jsxs("div",{className:"hero-cost",children:[s.jsxs("div",{className:"hero-cost-headline",children:[s.jsx("span",{className:"hero-cost-value",children:Nt(h.total)}),s.jsx("span",{className:"hero-cost-label",children:c("board.detail.spend")})]}),s.jsx(tT,{cost:h})]}),s.jsxs("div",{className:"hero-actions",children:[e.kind==="root"&&e.state==="done"&&a&&s.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>a(e.sessionId),title:c("board.detail.recapTitle"),children:c("board.detail.recap")}),i&&s.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:()=>i(e.sessionId),title:c("board.detail.exportTitle"),children:c("board.detail.export")}),o&&s.jsx("button",{type:"button",className:"btn hero-action-btn",onClick:o,title:e.kind==="root"?c("board.detail.removeRoot",{list:zn(c("board.detail.listLower"),"L",r)}):c("board.detail.removeSub",{list:zn(c("board.detail.listUpper"),"L",r)}),children:c("board.detail.remove")})]})]}),s.jsx(kne,{agent:e}),(()=>{const S=SA(e);if(!S)return null;const A=$g(S.at,t),T=S.kind==="recap"?c("board.detail.recapHeading"):Rl(S.kind).replace(/^./,q=>q.toUpperCase());return s.jsxs("section",{className:"detail-section",children:[s.jsxs("h3",{children:[T," ",s.jsx("span",{className:"section-count",title:A.title,children:A.label})]}),s.jsx("p",{className:"detail-recap",title:Gm(S),children:S.text}),S.reply&&s.jsx("p",{className:"detail-recap detail-note-reply",children:c("board.detail.suggestedReply",{reply:S.reply})})]})})(),(()=>{const S=ai(e.plan);return!S||!e.plan?null:s.jsxs("section",{className:"detail-section",children:[s.jsxs("h3",{children:[c("board.detail.plan")," ",s.jsxs("span",{className:"section-count","aria-hidden":!0,children:[S.done,"/",S.total]}),s.jsx("span",{className:"vis-hidden",children:c("board.detail.planDone",{done:S.done,total:S.total})})]}),e.plan.note&&s.jsx("p",{className:"detail-plan-note",children:e.plan.note}),s.jsx("ol",{className:"plan-list",children:e.plan.items.map((A,T)=>s.jsxs("li",{className:"plan-item","data-status":A.status,children:[s.jsx("span",{className:"plan-mark","aria-hidden":!0}),s.jsxs("span",{className:"vis-hidden",children:[c(QCe[A.status]),c("board.detail.colon")]}),s.jsx("span",{className:"plan-text",children:A.status==="in_progress"&&A.active?A.active:A.text}),A.status==="in_progress"&&s.jsx("span",{className:"plan-now","aria-hidden":!0,children:c("board.detail.now")})]},A.id??`${T}:${A.text}`))})]})})(),e.tools.length>0&&s.jsxs("section",{className:"detail-section",children:[s.jsx("h3",{children:c("board.detail.activity")}),s.jsxs("div",{className:"activity-row",children:[s.jsxs("div",{className:"activity-counters",children:[s.jsxs("span",{className:"ac-item",children:[s.jsx("b",{children:e.toolCount})," ",c("board.detail.calls")]}),y>0&&s.jsxs("span",{className:"ac-item ac-live",children:[s.jsx("b",{children:y})," ",c("board.state.live")]}),k>0&&s.jsxs("span",{className:"ac-item ac-err",children:[s.jsx("b",{children:k})," ",c("board.meta.err")]})]}),s.jsx("div",{className:"cat-strip",children:N.map(([S,A])=>{const T=S==="mcp"?w:null,q=T==null?void 0:T.hue,_=c("board.detail.catCalls",{count:A,cat:Hg(S,c)});return s.jsxs("span",{className:`cat-chip cat-${S}${q!=null?" mcp-hue":""}`,style:q!=null?{"--mcp-hue":q}:void 0,title:T?c("board.detail.catAllTo",{calls:_,server:T.label}):_,children:[s.jsx("span",{className:"cat-emoji","aria-hidden":!0,children:xW[S]}),s.jsx("span",{className:"cat-name",children:Hg(S,c)}),s.jsx("span",{className:"cat-count",children:A}),T&&s.jsx("span",{className:"cat-server",children:T.label})]},S)})})]})]}),f>0&&s.jsxs("section",{className:"detail-section",children:[s.jsx("h3",{children:c("board.detail.tokens")}),s.jsxs("div",{className:"tokens-grid",children:[s.jsxs("div",{children:[s.jsx("span",{className:"k",children:c("board.tokens.in")}),s.jsx("b",{title:e.usage.inputTokens.toLocaleString(),children:Dt(e.usage.inputTokens)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"k",children:c("board.tokens.out")}),s.jsx("b",{title:e.usage.outputTokens.toLocaleString(),children:Dt(e.usage.outputTokens)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"k",children:c("board.tokens.cacheR")}),s.jsx("b",{title:e.usage.cacheReadTokens.toLocaleString(),children:Dt(e.usage.cacheReadTokens)})]}),s.jsxs("div",{children:[s.jsx("span",{className:"k",children:c("board.tokens.cacheC")}),s.jsx("b",{title:e.usage.cacheCreateTokens.toLocaleString(),children:Dt(e.usage.cacheCreateTokens)})]})]})]}),s.jsxs("section",{className:"detail-section",children:[s.jsx("h3",{children:c("board.detail.identity")}),s.jsxs("div",{children:[e.cwd&&s.jsxs("div",{className:"row",children:[s.jsx("span",{className:"k",children:"cwd"}),s.jsx("span",{className:"v",title:e.cwd,children:e.cwd})]}),s.jsxs("div",{className:"row",children:[s.jsx("span",{className:"k",children:c("board.kind.session")}),s.jsxs("span",{className:"v",children:[e.sessionId.slice(0,12),"…"]})]}),e.parentId&&s.jsxs("div",{className:"row",children:[s.jsx("span",{className:"k",children:c("board.detail.parent")}),s.jsxs("span",{className:"v",children:[e.parentId.slice(0,12),"…"]})]})]})]}),e.prompts.length>0&&s.jsxs("section",{className:"detail-section",children:[s.jsxs("h3",{children:[c("board.detail.prompts")," ",s.jsx("span",{className:"section-count",children:S2(e.prompts).length})]}),s.jsx("div",{className:"prompts",children:YCe(e.prompts).reverse().map(({pr:S,key:A})=>{const T=$g(S.at,t),q=_m(S.text);return q?s.jsxs("details",{className:"prompt-entry prompt-injected",children:[s.jsxs("summary",{children:[s.jsx("span",{className:"prompt-time",title:T.title,children:T.label}),s.jsx("span",{className:"prompt-injected-label",children:q.label})]}),q.detail&&s.jsx("div",{className:"prompt-injected-detail",children:q.detail})]},A):s.jsxs("div",{className:"prompt-entry",children:[s.jsx("div",{className:"prompt-time",title:T.title,children:T.label}),s.jsx("div",{className:"prompt-text",children:S.text})]},A)})})]}),s.jsxs("section",{className:"detail-section",children:[s.jsxs("h3",{children:[c("board.detail.toolCalls")," ",s.jsx("span",{className:"section-count",children:e.tools.length})]}),e.tools.length===0&&s.jsx("div",{className:"empty",children:c("board.detail.noTools")}),s.jsx("div",{children:e.tools.slice().reverse().map(S=>s.jsx(XCe,{call:S,onClick:()=>n(e.id,S.id)},S.id))})]})]})}function YCe(e){const t=new Map;return e.map(n=>{const a=t.get(n.at)??0;return t.set(n.at,a+1),{pr:n,key:a===0?String(n.at):`${n.at}:${a}`}})}const ZCe={inflight:"board.toolStatus.inflight",done:"board.toolStatus.done",err:"board.toolStatus.err"};function XCe({call:e,onClick:t}){const n=se(),a=e.endedAt==null?"inflight":e.ok===!1?"err":"done",i=sU(e,"…");return s.jsxs("button",{className:"tool clickable",title:e.inputPreview||e.name,onClick:t,children:[s.jsxs("span",{className:"name",children:[s.jsx("span",{className:`status-dot ${a}`,"aria-hidden":!0}),s.jsx("span",{className:"vis-hidden",children:n(ZCe[a])}),e.name]}),s.jsx("span",{style:{color:"var(--muted)"},children:i})]})}const QCe={completed:"board.state.done",in_progress:"board.detail.now",pending:"board.detail.todo"};function eSe(e,t){const n=GCe(e,t,new Date().toISOString());if(!n)return;const a=JSON.stringify(n,null,2),i=new Blob([a],{type:"application/json"}),o=URL.createObjectURL(i),r=document.createElement("a");r.href=o,r.download=$Ce(n.label,t),document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>URL.revokeObjectURL(o),1e3)}function tSe({selected:e,now:t,openTool:n,setSummaryFor:a,onClose:i,stateRef:o,removeSelectedNode:r}){const c=se();An("detail-panel");const d=On();return s.jsxs("aside",{className:"detail","aria-label":c("board.detailPanel.title"),children:[s.jsx("button",{type:"button",className:"glyph-btn detail-close",title:c("board.detailPanel.close"),"aria-label":c("board.detailPanel.closeLabel"),onClick:i,children:"×"}),s.jsx(JCe,{agent:e,now:t,onOpenTool:n,onShowSummary:a,onExportSession:u=>eSe(o.current,u),onRemove:r,singleKeys:d})]})}const nSe={"Boards, sprints, and issues":"integrations.provider.jira.detail","Jira Cloud, or Jira Server / Data Center 8.14 and newer.":"integrations.provider.jira.blurb","Repositories, pull requests, and Actions":"integrations.provider.github.detail","github.com, read-only, with a personal access token.":"integrations.provider.github.blurb","Projects, merge requests, and pipelines":"integrations.provider.gitlab.detail","GitLab.com or your own instance, read-only.":"integrations.provider.gitlab.blurb","Which Jira":"integrations.field.whichJira","Jira URL":"integrations.field.jiraUrl","The address you open Jira at, with its path if it has one (…/jira). https only.":"integrations.field.jiraUrlHint","Site URL":"integrations.field.siteUrl","The address you open Jira at. Your site name alone is enough.":"integrations.field.siteUrlHint","Atlassian account email":"integrations.field.email","Personal access token":"integrations.field.pat","API token":"integrations.field.apiToken","Paste the token":"integrations.field.pasteToken","Paste the API token":"integrations.field.pasteApiToken","Which GitLab":"integrations.field.whichGitlab","Self-managed":"integrations.field.selfManaged","GitLab URL":"integrations.field.gitlabUrl","The address you open GitLab at, with its path if it has one. https only.":"integrations.field.gitlabUrlHint"};function nu(e,t){const n=t===void 0?void 0:nSe[t];return n?e(n):t}function aSe(e,t,n=x){const a=n(e?"board.rail.watch.on":"board.rail.watch.off");return t>0?`${a}
|
|
151
|
-
${n("board.rail.unreadCount",{n:t})}`:a}function cg(e,t){return t.map(n=>({...n,group:e}))}function sSe({providers:e,sessionListOpen:t,toggleSessionList:n,accountsPanelOpen:a,toggleAccountsPanel:i,accountsPanelId:o="accounts-panel",codexPanelOpen:r=!1,toggleCodexPanel:c=()=>{},usagePanelOpen:d,setUsagePanelOpen:u,machinePanelOpen:h,setMachinePanelOpen:g,setUsageHistoryOpen:f,watchOn:b,watchUnseen:k,setBrowserWatchOpen:y,setTrafficRadarOpen:N,setRadioOpen:w,openToolActivity:j,openSettings:S,onFeedback:A,toggles:T,openCapacity:q,integrations:_=[],openExploreIntegrations:I,openQuickOpen:z}){const F=nre(Ao()),U=Po(Ao()),P={id:"session-list",label:x("board.rail.sessionList"),short:x("board.rail.sessionList.short"),key:{cap:"L",aria:"L",single:!0},ariaLabel:x("board.rail.sessionList"),glyph:s.jsx(pB,{}),kind:"panel",open:t,controls:"session-list",onPress:n,buttonRef:T.sessionList},L={id:"accounts",label:x("board.rail.accounts"),short:x("board.rail.accounts"),key:{cap:"A",aria:"A",single:!0},ariaLabel:x("board.rail.accounts"),hint:e.codex?void 0:x("board.rail.accounts.hint"),glyph:s.jsx(gB,{}),kind:"panel",open:a,controls:o,onPress:i,buttonRef:T.accounts},R=q?[{id:"account-capacity",label:x("board.rail.capacity"),short:x("board.rail.capacity.short"),ariaLabel:x("board.rail.capacity"),detail:x("board.rail.capacity.detail"),glyph:s.jsx(goe,{}),kind:"dialog",onPress:()=>q("accounts")},{id:"reset-calendar",label:x("board.rail.calendar"),short:x("board.rail.calendar.short"),ariaLabel:x("board.rail.calendar"),detail:x("board.rail.calendar.detail"),glyph:s.jsx(moe,{}),kind:"dialog",onPress:()=>q("calendar")}]:[],O={id:"codex-accounts",label:"Codex accounts",short:"Codex",ariaLabel:"Codex accounts",glyph:s.jsx(Soe,{}),kind:"panel",open:r,controls:"codex-accounts-panel",onPress:c,buttonRef:T.codex},D={id:"usage",label:x("board.rail.usage"),short:x("board.rail.usage"),key:{cap:"U",aria:"U",single:!0},ariaLabel:x("board.rail.usage"),glyph:s.jsx(noe,{}),kind:"panel",open:d,controls:"usage-panel",onPress:()=>u(Y=>!Y),buttonRef:T.usage},$={id:"machine",label:x("board.rail.machine"),short:x("board.rail.machine"),key:{cap:"S",aria:"S",single:!0},ariaLabel:x("board.rail.machine"),hint:x("board.rail.machine.hint"),glyph:s.jsx(soe,{}),kind:"panel",open:h,controls:"system-panel",onPress:()=>g(Y=>!Y),buttonRef:T.machine},B={id:"history",label:x("board.rail.history"),short:x("board.rail.history.short"),key:{cap:"H",aria:"H",single:!0},ariaLabel:x("board.rail.history"),glyph:s.jsx(aoe,{}),kind:"dialog",onPress:()=>f(Y=>!Y)},G={id:"browser-watch",label:x("board.rail.browserWatch"),short:x("board.rail.browserWatch.short"),key:{cap:"B",aria:"B",single:!0},ariaLabel:`${x("board.rail.browserWatch")}${x("board.listSep")}${x(b?"board.rail.watching":"board.rail.notWatching")}${k>0?`${x("board.listSep")}${x("board.rail.unreadCount",{n:k})}`:""}`,detail:aSe(b,k,x),glyph:s.jsx(ooe,{watching:b===!0||k>0}),kind:"dialog",onPress:()=>y(Y=>!Y),badge:k},Z={id:"settings",label:x("board.rail.settings"),short:x("board.rail.settings.short"),key:{cap:F,aria:"Control+, Meta+,",single:!1},ariaLabel:x("board.rail.settings"),glyph:s.jsx(roe,{}),kind:"dialog",onPress:()=>S()},W={id:"quick-open",label:x("board.rail.search"),short:x("board.rail.search"),key:{cap:eoe(U),aria:U?"Meta+K":"Control+K",single:!1},ariaLabel:x("board.rail.search"),detail:x("board.rail.search.detail"),glyph:s.jsx(fB,{}),kind:"dialog",onPress:z},H={id:"feedback",label:x("board.rail.feedback"),short:x("board.rail.feedback"),menu:x("board.rail.feedback.menu"),ariaLabel:x("board.rail.feedback.menu"),glyph:s.jsx(coe,{}),kind:"dialog",onPress:A},X=j?[{id:"tool-activity",label:x("board.rail.tools.activity"),short:x("board.rail.tools.short"),ariaLabel:x("board.rail.tools.activity"),glyph:s.jsx(poe,{}),kind:"dialog",detail:x("board.rail.tools.detail"),onPress:()=>j("tools")},{id:"skill-activity",label:x("board.rail.skills"),short:x("board.rail.skills.short"),ariaLabel:x("board.rail.skills"),glyph:s.jsx(mB,{}),kind:"dialog",detail:x("board.rail.skills.detail"),onPress:()=>j("skills")}]:[],V=N?[{id:"traffic-radar",label:x("board.rail.radar"),short:x("board.rail.radar.short"),ariaLabel:x("board.rail.radar"),glyph:s.jsx(ioe,{}),kind:"dialog",detail:x("board.rail.radar.detail"),onPress:()=>N(!0)}]:[],Q=w?[{id:"radio",label:x("board.rail.radio"),short:x("board.rail.radio"),ariaLabel:x("board.rail.radio"),glyph:s.jsx(hoe,{}),kind:"dialog",detail:x("board.rail.radio.detail"),onPress:()=>w(!0)}]:[];return{left:e.claude?[L,P]:e.codex?[O,P]:[P],codexDoor:e.claude&&e.codex?[O]:[],leftStripe:[...e.claude?[cg(e.codex?x("board.rail.accounts"):x("board.rail.group.accounts"),[L,...R])]:[],...e.codex&&!e.claude?[[O]]:[],[P]],capacity:e.claude?R:[],right:[cg(x("board.rail.group.usage"),[D,$]),cg(x("board.rail.group.activity"),[B,...X]),cg(x("board.rail.group.watchers"),[G,...V]),Q].filter(Y=>Y.length>0),utilities:[Z,H],search:W,explore:I?[{id:"explore-integrations",label:x("board.rail.explore"),short:x("board.rail.explore.short"),ariaLabel:x("board.rail.explore"),glyph:s.jsx(toe,{}),kind:"dialog",onPress:I}]:[],integrations:_.map(({provider:Y,onPress:K})=>({id:`integration-${Y.kind}`,label:Y.label,short:Y.label,ariaLabel:Y.label,detail:nu(x,Y.detail),key:Y.shortcut?{cap:Y.shortcut.toUpperCase(),aria:Y.shortcut.toUpperCase(),single:!0}:void 0,glyph:s.jsx(Y.Glyph,{}),kind:"dialog",onPress:K}))}}function lg(e,t){return e.split(/\{(\w+)\}/).map((a,i)=>i%2===0?a:s.jsx(m.Fragment,{children:a in t?t[a]:`{${a}}`},i))}const bm=[{value:"bug",get label(){return x("shell.feedback.kind.bug")},get question(){return x("shell.feedback.q.bug")},get placeholder(){return x("shell.feedback.ph.bug")}},{value:"idea",get label(){return x("shell.feedback.kind.idea")},get question(){return x("shell.feedback.q.idea")},get placeholder(){return x("shell.feedback.ph.idea")}},{value:"other",get label(){return x("shell.feedback.kind.other")},get question(){return x("shell.feedback.q.other")},get placeholder(){return x("shell.feedback.ph.other")}}];function SW(e){return bm.find(t=>t.value===e)??bm[0]}const jj=3,MS=120,NW=1e4,jW=200,iSe=()=>x("shell.feedback.missing");function II(e){return e.trim()!==""}function oSe(e){var o;const t=e.trim();if(t==="")return"";const n=DI(t.split(/\r?\n/,1)[0]),a=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,i=IS(a).length>=jj?IS(a):IS(n);return cSe(i.length>=jj?i:DI(t))}function rSe(e,t){const n=oSe(t);return n.length>=jj?n:x("shell.feedback.titleKind",{kind:SW(e).label,text:n})}function DI(e){return e.replace(/\s+/g," ").trim()}function IS(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function cSe(e){if(e.length<=MS)return e;const t=e.slice(0,MS-1),n=t.lastIndexOf(" ");return`${(n>=MS/2?t.slice(0,n):t).replace(/[\uD800-\uDBFF]$/,"").replace(/[\s,;:.\-–—]+$/,"")}…`}function lSe({kind:e,body:t,contact:n}){const a={kind:e,title:rSe(e,t),body:t.trim()};return n.trim()!==""&&(a.contact=n.trim()),a}function dSe(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 uSe={darwin:"macOS",win32:"Windows",linux:"Linux"};function hSe(e){const t=e.indexOf("-"),n=t===-1?e:e.slice(0,t),a=t===-1?"":e.slice(t+1),i=uSe[n]??n;return a?`${i} · ${a}`:i}function pSe(e){return e?`ccdeck ${e.appVersion} · ${hSe(e.platform)}`:null}const gSe=()=>x("shell.feedback.factsWith"),mSe=()=>x("shell.feedback.factsUnknown"),fSe=()=>x("shell.feedback.addDetails"),bSe=()=>x("shell.feedback.contact"),vSe=()=>x("shell.feedback.contactPh"),kSe=()=>x("shell.feedback.contactHint"),wSe=()=>[x("shell.feedback.where1"),x("shell.feedback.where2")];function ySe(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function XT(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function xSe(e){return Po(e)?["⌘","Enter"]:["Ctrl","Enter"]}function CSe(e){return[...e].length===1}const AW=()=>x("shell.feedback.sent");function SSe(e){const t=/^At most (\d+) images\.$/.exec(e);if(t)return x("shell.feedback.problem.count",{n:t[1]});const n=/^Image (\d+) is over (\d+) MB\.$/.exec(e);if(n)return x("shell.feedback.problem.size",{n:n[1],mb:n[2]});const a=/^Image (\d+) is not a PNG or a JPEG\.$/.exec(e);return a?x("shell.feedback.problem.format",{n:a[1]}):e}function FI(e,t,n){if(t==="vetoed")return x("shell.feedback.fail.vetoed");if(e===429||t==="too_many")return x("shell.feedback.fail.tooMany");if(e===413||t==="too_large")return x("shell.feedback.fail.tooLarge");const a=n==null?void 0:n.images;return e===400&&Array.isArray(a)&&typeof a[0]=="string"?x("shell.feedback.fail.image",{reason:SSe(a[0])}):x(e===400?"shell.feedback.fail.rejected":"shell.feedback.fail.unreachable")}function NSe(e){return e==="sending"?x("shell.feedback.sending"):e==="sent"?AW():""}const UI=1400,jSe=160,TW=m.createContext({values:{}});function RW(){return m.useContext(TW)}function ASe(e,t){const n=e.variants;return n?{...e,...n.by[t[n.field]??""]??{}}:e}const BI=(e,t)=>!e.when||e.when.is.includes(t[e.when.field]??"");function TSe({def:e,existing:t,busy:n,error:a,onSubmit:i,onCancel:o,onDirtyChange:r}){var R,O;const c=se(),d=m.useId(),[u,h]=m.useState(()=>Object.fromEntries(e.fields.map(D=>{var $,B,G;return[D.name,D.secret?"":(($=D.initial)==null?void 0:$.call(D,t))??(D.type==="choice"?((G=(B=D.options)==null?void 0:B[0])==null?void 0:G.value)??"":"")]}))),[g,f]=m.useState((t==null?void 0:t.name)??""),b=m.useRef(null),k=m.useRef(new Map),y=!!t,N=m.useRef(u),w=m.useRef(g);m.useEffect(()=>{r==null||r(g!==w.current||Object.keys(u).some(D=>u[D]!==N.current[D]))},[g,u,r]);const j=e.fields.filter(D=>D.type==="choice").every(D=>u[D.name]===N.current[D.name]),S=y&&t.tokenSaved&&j,A=(D,$)=>{n||h(B=>({...B,[D]:$}))},T=D=>{var B;if(D.preventDefault(),n)return;const $={};for(const G of e.fields)BI(G,u)&&($[G.name]=(u[G.name]??"").trim());(B=D.currentTarget.querySelector('button[type="submit"]'))==null||B.focus(),i($,g.trim()),h(G=>Object.fromEntries(Object.entries(G).map(([Z,W])=>{var H;return[Z,(H=e.fields.find(X=>X.name===Z))!=null&&H.secret?"":W]})))},q=m.useMemo(()=>{const D=u.baseUrl??"";try{return D?new URL(/^[a-z]+:\/\//i.test(D)?D:`https://${D}`).host:""}catch{return""}},[u.baseUrl]),_=m.useMemo(()=>({values:u,existing:t}),[u,t]),I=e.fields.filter(D=>BI(D,u)),z=(R=I.find(D=>!D.secret&&D.type!=="choice"))==null?void 0:R.name,F=(O=I.find(D=>D.secret))==null?void 0:O.name,U=a!=null&&a.field&&I.some(D=>D.name===a.field&&D.type!=="choice")?a.field:null,P=`${d}-error`;m.useEffect(()=>{var $,B,G;const D=y?F:z??F;D&&(($=k.current.get(D))==null||$.focus()),(G=(B=b.current)==null?void 0:B.scrollIntoView)==null||G.call(B,{block:"nearest"})},[y]),m.useEffect(()=>{var D;U&&((D=k.current.get(U))==null||D.focus())},[a,U]);const L=a&&s.jsxs(s.Fragment,{children:[a.message,a.detail&&s.jsxs("span",{className:"ig-form-detail",children:[" ",c("integrations.failure.said",{provider:e.label,said:a.detail})]}),a.kind==="rate-limit"&&a.retryAfter?s.jsxs("span",{children:[" ",c("integrations.form.retryIn",{n:a.retryAfter})]}):null]});return s.jsx(TW.Provider,{value:_,children:s.jsxs("form",{ref:b,className:"ig-form",onSubmit:T,"aria-labelledby":`${d}-title`,noValidate:!0,children:[s.jsxs("header",{className:"ig-managed-header",children:[s.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:s.jsx(e.Glyph,{})}),s.jsxs("div",{className:"ig-managed-identity",children:[s.jsx("h2",{className:"ig-form-title",id:`${d}-title`,children:y?c("integrations.form.edit",{name:t.name}):c("integrations.form.connect",{provider:e.label})}),y&&s.jsx("p",{children:c("integrations.form.connectionOf",{provider:e.label})})]})]}),I.map(D=>{const $=ASe(D,u),B={...$,label:nu(c,$.label),hint:nu(c,$.hint),placeholder:nu(c,$.placeholder)},G=(a==null?void 0:a.field)===B.name,Z=[B.hint?`${d}-${B.name}-hint`:"",G?P:""].filter(Boolean).join(" ")||void 0;if(B.type==="choice")return s.jsxs("fieldset",{className:"fb-kinds","aria-invalid":G||void 0,children:[s.jsx("legend",{className:"vis-hidden",children:B.label}),(B.options??[]).map(X=>s.jsxs("label",{className:"fb-kind",children:[s.jsx("input",{type:"radio",name:`${d}-${B.name}`,value:X.value,checked:u[B.name]===X.value,"aria-disabled":n||void 0,onChange:()=>A(B.name,X.value),onKeyDown:V=>{XT(V.nativeEvent)&&V.preventDefault()}}),nu(c,X.label)]},X.value))]},B.name);const W=B.secret&&S,H=`${d}-${B.name}`;return s.jsxs("div",{className:"fb-field",children:[s.jsxs("label",{className:"fb-field-label",htmlFor:H,children:[B.label,B.optional&&s.jsxs("span",{className:"fb-optional",children:[" ",c("integrations.form.optional")]})]}),s.jsx("input",{id:H,className:`ap-manage-input ig-input${B.secret?" ig-mono":""}`,ref:X=>{X?k.current.set(B.name,X):k.current.delete(B.name)},type:B.type,inputMode:B.type==="url"?"url":B.type==="email"?"email":void 0,autoComplete:B.autoComplete??"off",spellCheck:!1,value:u[B.name]??"",onChange:X=>A(B.name,X.target.value),placeholder:W?c("integrations.form.keepSaved"):B.placeholder,readOnly:n,"aria-invalid":G||void 0,"aria-describedby":Z,"aria-required":!B.optional&&!W||void 0}),B.hint&&s.jsx("span",{className:"ig-hint",id:`${d}-${B.name}-hint`,children:B.hint}),G&&U===B.name&&s.jsx("span",{className:"ig-form-error",id:P,role:"alert",children:L})]},B.name)}),s.jsxs("details",{className:"ig-help ig-token-help",children:[s.jsx("summary",{children:c("integrations.form.howTo",{provider:e.label})}),e.tokenHelp]}),s.jsxs("div",{className:"fb-field",children:[s.jsxs("label",{className:"fb-field-label",htmlFor:`${d}-name`,children:[c("integrations.form.name")," ",s.jsx("span",{className:"fb-optional",children:c("integrations.form.optional")})]}),s.jsx("input",{id:`${d}-name`,className:"ap-manage-input ig-input",type:"text",autoComplete:"off",maxLength:120,readOnly:n,value:g,onChange:D=>f(D.target.value),placeholder:q||e.label})]}),a&&!U&&s.jsx("p",{className:"ig-form-error",id:P,role:"alert",children:L}),s.jsxs("div",{className:"ig-form-actions",children:[s.jsx("button",{type:"submit",className:"btn primary","aria-disabled":n,"aria-busy":n,children:c(n?"integrations.form.checking":y?"integrations.form.save":"integrations.form.connectBtn")}),s.jsx("button",{type:"button",className:"btn","aria-disabled":n||void 0,onClick:()=>{n||o()},children:c("integrations.cancel")})]})]})})}const RSe="https://id.atlassian.com/manage-profile/security/api-tokens",ESe="https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/",qSe="https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html",_Se=[{scope:"read:jira-work",why:"issues, comments, search",whyKey:"integrations.token.why.work"},{scope:"read:jira-user",why:"your account and avatars",whyKey:"integrations.token.why.user"},{scope:"read:board-scope:jira-software",why:"boards and backlogs",whyKey:"integrations.token.why.board"},{scope:"read:board-scope.admin:jira-software",why:"a board's estimation and quick filters",whyKey:"integrations.token.why.boardAdmin"},{scope:"read:sprint:jira-software",why:"sprints",whyKey:"integrations.token.why.sprint"},{scope:"read:epic:jira-software",why:"epic names and colours",whyKey:"integrations.token.why.epic"},{scope:"read:issue-details:jira",why:"issue lists",whyKey:"integrations.token.why.issueDetails"},{scope:"read:jql:jira",why:"filtered lists",whyKey:"integrations.token.why.jql"}];function zSe(e){const t=e.trim();if(!t)return null;try{const n=new URL(/^[a-z]+:\/\//i.test(t)?t:`https://${t}`),a=n.hostname==="localhost"||n.hostname==="127.0.0.1";return n.protocol!=="https:"&&!a||!n.hostname.includes(".")&&!a?null:`${n.origin}${n.pathname.replace(/\/+$/,"")}/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens`}catch{return null}}function LSe(){const e=se(),{values:t}=RW(),n=t.deployment==="cloud",a=n?null:zSe(t.baseUrl??"");let i="";try{i=a?new URL(a).host:""}catch{}return s.jsxs(s.Fragment,{children:[n?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:lg(e("integrations.token.cloud.intro"),{link:s.jsx("a",{href:RSe,target:"_blank",rel:"noreferrer noopener",children:"id.atlassian.com → Security → API tokens"}),scoped:s.jsx("em",{children:e("integrations.token.cloud.scoped")})})}),s.jsx("ul",{className:"ig-scopes",children:_Se.map(o=>s.jsxs("li",{children:[s.jsx("code",{children:o.scope})," ",s.jsx("span",{children:e(o.whyKey)})]},o.scope))}),s.jsx("p",{children:s.jsx("a",{href:ESe,target:"_blank",rel:"noreferrer noopener",children:e("integrations.token.cloud.docs")})})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{children:lg(e("integrations.token.server.intro"),{profile:s.jsx("strong",{children:"Profile"}),pats:s.jsx("strong",{children:"Personal Access Tokens"}),create:s.jsx("strong",{children:"Create token"}),page:a?lg(e("integrations.token.server.page"),{link:s.jsx("a",{href:a,target:"_blank",rel:"noreferrer noopener",children:e("integrations.token.server.openOn",{host:i})})}):""})}),s.jsx("p",{children:s.jsx("a",{href:qSe,target:"_blank",rel:"noreferrer noopener",children:e("integrations.token.server.docs")})})]}),s.jsx("p",{className:"ig-dim",children:e("integrations.token.reads")}),n&&s.jsx("p",{className:"ig-dim",children:lg(e("integrations.token.scopedWrite"),{rank:s.jsx("code",{children:"write:issue:jira-software"}),sprint:s.jsx("code",{children:"write:sprint:jira-software"}),backlog:s.jsx("code",{children:"write:board-scope:jira-software"})})})]})}function DS(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 a=(t??"").trim()||"https://gitlab.com";let i;try{i=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(a)?a:`https://${a}`)}catch{return null}return i.protocol!=="https:"&&i.protocol!=="http:"||!i.hostname.includes(".")&&i.hostname!=="localhost"?null:`${i.origin}${i.pathname.replace(/\/+$/,"")}/-/user_settings/personal_access_tokens?name=ccdeck&scopes=read_api`}function HI(e,t){return e.split(/(\{\w+\})/).map((n,a)=>{var o;const i=(o=/^\{(\w+)\}$/.exec(n))==null?void 0:o[1];return i&&i in t?s.jsx("span",{children:t[i]},a):n})}function FS({href:e,children:t}){return e?s.jsxs("a",{className:"fg-token-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t," ",s.jsx(xl,{})]}):null}function EW({kind:e,baseUrl:t}){const{values:n}=RW(),a=se();if(e==="github")return s.jsxs("div",{className:"fg-token-help",children:[s.jsx("p",{children:a("forge.token.gh.intro")}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:a("forge.token.gh.classicName")})," ",HI(a("forge.token.gh.classic"),{repo:s.jsx("code",{children:"repo"}),org:s.jsx("code",{children:"read:org"})})," ",s.jsx(FS,{href:DS("github"),children:a("forge.token.makeOne")})]}),s.jsxs("li",{children:[s.jsx("strong",{children:a("forge.token.gh.fineName")})," ",a("forge.token.gh.fine")," ",s.jsx(FS,{href:DS("github",null,"fine-grained"),children:a("forge.token.makeOne")})]})]}),s.jsx("p",{children:a("forge.token.gh.approval")})]});const i=DS("gitlab",t??(n.where==="self"?n.baseUrl:null));return s.jsxs("div",{className:"fg-token-help",children:[s.jsxs("p",{children:[HI(a("forge.token.gl.scope"),{scope:s.jsx("code",{children:"read_api"})})," ",s.jsx(FS,{href:i,children:a("forge.token.makeOn",{host:i?new URL(i).host:"GitLab"})})]}),s.jsx("p",{children:a("forge.token.gl.expire")})]})}const qW={name:"token",type:"password",secret:!0,get label(){return x("forge.field.token")},get placeholder(){return x("forge.field.tokenPlaceholder")}},OSe=[qW],WI=e=>{try{return e?new URL(e.baseUrl).host!=="gitlab.com":!1}catch{return!1}},PSe=[{name:"where",type:"choice",get label(){return x("forge.field.which")},get options(){return[{value:"cloud",label:"GitLab.com"},{value:"self",label:x("forge.field.selfManaged")}]},initial:e=>WI(e)?"self":"cloud"},{name:"baseUrl",type:"url",placeholder:"https://gitlab.example.com",get label(){return x("forge.field.url")},get hint(){return x("forge.field.urlHint")},when:{field:"where",is:["self"]},initial:e=>WI(e)?e.baseUrl:""},qW],MSe=m.createElement(EW,{kind:"github"}),ISe=m.createElement(EW,{kind:"gitlab"}),DSe=e=>{var t;return((t=e==null?void 0:e.meta)==null?void 0:t.deployment)==="cloud"?"cloud":"server"},FSe={kind:"jira",label:"Jira",Glyph:boe,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:DSe},{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:m.createElement(LSe)},USe={kind:"github",label:"GitHub",Glyph:voe,detail:"Repositories, pull requests, and Actions",blurb:"github.com, read-only, with a personal access token.",fields:OSe,tokenHelp:MSe},BSe={kind:"gitlab",label:"GitLab",Glyph:koe,detail:"Projects, merge requests, and pipelines",blurb:"GitLab.com or your own instance, read-only.",fields:PSe,tokenHelp:ISe},Aj={jira:FSe,github:USe,gitlab:BSe},QT=()=>Object.values(Aj).filter(e=>!!e);function au(e){return(Object.hasOwn(Aj,e)?Aj[e]:void 0)??null}function Uf(e,t){const n=a=>typeof t=="string"?t:t(a);return m.lazy(()=>e().catch(a=>(console.warn(`ccdeck could not load ${typeof t=="string"?t:"a dialog"}`,a),{default:i=>s.jsx(HSe,{name:n(i),onClose:i.onClose})})))}function HSe({name:e,onClose:t}){const n=se(),a=m.useRef(null),i=Tt(t,{focusRef:a}),o=Rt(t);return s.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:s.jsxs("div",{ref:i,className:"modal dialog-missing",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"dialog-missing-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"dialog-missing-title",className:"modal-tool-name",children:e})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":n("shell.closeEsc"),title:n("shell.closeEsc"),children:"×"})})]}),s.jsxs("section",{className:"modal-body",children:[s.jsx("p",{className:"dm-note",children:n("shell.lazy.didNotLoad",{name:e})}),s.jsxs("div",{className:"dm-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:t,children:n("shell.close")}),s.jsx("button",{type:"button",ref:a,className:"btn primary",onClick:()=>window.location.reload(),children:n("shell.reload")})]})]})]})})}const _W=()=>Hr(()=>import("./IntegrationModal-BMtv2XWR.js"),[]);function WSe(){_W().catch(()=>{})}const GSe=Uf(_W,e=>{var t;return((t=au(e.kind))==null?void 0:t.label)??x("integrations.modal.tracker")});function $Se({onClose:e}){return m.useEffect(()=>jn.push(e,0,"dialog"),[e]),null}function VSe(e){return s.jsx(m.Suspense,{fallback:s.jsx($Se,{onClose:e.onClose}),children:s.jsx(GSe,{...e})})}const GI={"The deck failed while reading the tracker.":"integrations.srv.deckFailed","The answer was larger than the deck accepts.":"integrations.srv.tooLarge","Enter a token.":"integrations.srv.enterToken","Enter an API token.":"integrations.srv.enterApiToken","Enter a personal access token.":"integrations.srv.enterPat","The token has a space in it. Paste it again.":"integrations.srv.tokenSpace","Enter the email address of your Atlassian account.":"integrations.srv.enterEmail","Choose Jira Cloud or Jira Server / Data Center.":"integrations.srv.chooseDeployment","Enter your Jira site URL.":"integrations.srv.enterSiteUrl","Enter your Jira URL.":"integrations.srv.enterJiraUrl","Enter your GitLab's address.":"integrations.srv.enterGitlabUrl","Your Jira site URL is not a valid URL.":"integrations.srv.badSiteUrl","Your Jira URL is not a valid URL.":"integrations.srv.badJiraUrl","Your GitLab's address is not a valid URL.":"integrations.srv.badGitlabUrl","Leave the user name and password out of the address.":"integrations.srv.urlUser","Use an https:// address. Plain http is only accepted for a server on this machine.":"integrations.srv.httpsOnly","Use an https:// address.":"integrations.srv.httpsAddress","That connection is not there any more.":"integrations.srv.connectionGone","No token is saved for this connection. Edit it and enter one.":"integrations.srv.noTokenEdit","No token is saved for this connection. Reconnect it in Settings.":"integrations.srv.noTokenReconnect","Enter a comment of up to 10,000 characters.":"integrations.srv.commentLength","This Jira write is outside the connection's token origins.":"integrations.srv.writeOutside","Jira redirected the comment. Refresh the issue before sending again.":"integrations.srv.commentRedirected","The comment could not be confirmed. Refresh the issue before sending again.":"integrations.srv.commentUnconfirmed","Jira redirected the write. It was not replayed; refresh the board before trying again.":"integrations.srv.writeRedirected","Jira's rank result was too large. Refresh the board to check its position.":"integrations.srv.rankTooLarge","Jira did not confirm every requested issue update. Some issues may have changed; refresh the board to check them.":"integrations.srv.updateUnconfirmed","Jira did not confirm the write. Refresh the board to check the issue.":"integrations.srv.writeUnconfirmed","Jira refused the move: the account or token needs permission to edit and schedule this issue.":"integrations.srv.moveRefused","Jira did not return its available transitions.":"integrations.srv.transitionsMissing","Choose a valid transition.":"integrations.srv.transitionChoose","This transition is unavailable or requires additional fields in Jira.":"integrations.srv.transitionUnavailable","Jira redirected the transition. Refresh the issue before trying again.":"integrations.srv.transitionRedirected","Jira did not confirm the transition. Refresh the issue.":"integrations.srv.transitionUnconfirmed","There is no Jira REST API at this address. Check the URL — some servers live under a path such as /jira.":"integrations.srv.noRestApi","This is a Jira Cloud site. Choose Jira Cloud and connect with your email and an API token.":"integrations.srv.isCloud","This is Jira Server or Data Center, not Cloud. Choose Jira Server / Data Center and use a personal access token.":"integrations.srv.isServer","Jira did not accept this email and API token, on the site or through api.atlassian.com. Check both, and that the token has not expired.":"integrations.srv.emailTokenRefused","Jira wants a CAPTCHA after too many failed sign-ins. Sign in to Jira once in your browser, then test the connection again.":"integrations.srv.captcha","Jira did not accept this personal access token: it answered as an anonymous visitor. Check that the token is right and has not expired or been revoked.":"integrations.srv.patAnonymous","That quick filter is not on this board any more. Refresh the board.":"integrations.srv.quickFilterGone","Jira writes are unavailable because this system cannot safely coordinate them.":"integrations.srv.writesUnavailable","Supply either one issueKey or 2–50 ordered issueKeys and a sprint or backlog target.":"integrations.srv.moveWhere","Supply unique, valid issue keys (2–50 for a batch).":"integrations.srv.moveKeys","Not a valid issue key or move target.":"integrations.srv.moveTarget","Use at most one other issue as the rank anchor.":"integrations.srv.moveAnchor","The issues and anchor must all belong to this board.":"integrations.srv.moveSameBoard","The issues and rank anchor must be top-level issues.":"integrations.srv.moveTopLevel","Only top-level non-epic issues with a known status can be moved.":"integrations.srv.moveEpicStatus","Done issues cannot be moved to the backlog because Jira hides them there. Change the status first.":"integrations.srv.moveDone","Every issue must be in the backlog or one active or future sprint.":"integrations.srv.moveSource","The source and target must be active or future sprints on this board.":"integrations.srv.moveSprints","An issue's source changed or is a closed sprint. Refresh the board.":"integrations.srv.moveSourceChanged","Could not determine the destination's last issue. Refresh and try again.":"integrations.srv.moveLastIssue","Could not verify the destination order. Refresh and try again.":"integrations.srv.moveOrder","The destination is too large to determine the last issue. Refresh and try again.":"integrations.srv.moveDestinationLarge","The rank anchor must be in the target group. Refresh the board.":"integrations.srv.moveAnchorGroup","This server runs Jira of an unknown version. Personal access tokens need Jira Server or Data Center 8.14 or newer, so the deck cannot connect to it.":"integrations.srv.serverOldUnknown","too many redirects":"forge.srv.redirects","answer too large":"forge.srv.answerLarge","answer cut off":"forge.srv.answerCut","unreadable JSON":"forge.srv.badJson","log too large to read the end of":"forge.srv.logLarge","image too large":"forge.srv.imageLarge","image cut off":"forge.srv.imageCut","that cursor is not a page of this list":"forge.srv.cursorPage","that cursor is not one of this list":"forge.srv.cursorList"},KSe=[[/^The deck could not verify (Jira|GitHub|GitLab)'s HTTPS certificate \((.+?)\)\. Check that the address is right and that the server's certificate is valid for it\.$/,"integrations.srv.tlsCert",["provider","code"]],[/^(Jira|GitHub|GitLab) did not answer in time\.$/,"integrations.srv.timeout",["provider"]],[/^The deck could not find (Jira|GitHub|GitLab)'s address\. Check the URL and your network\.$/,"integrations.srv.noAddress",["provider"]],[/^The deck could not reach (Jira|GitHub|GitLab) \((.+?)\)\. Check the URL, your network or VPN\.$/,"integrations.srv.cannotReachCode",["provider","code"]],[/^The deck could not reach (Jira|GitHub|GitLab)\. Check the URL, your network or VPN\.$/,"integrations.srv.cannotReach",["provider"]],[/^(Jira|GitHub|GitLab) did not accept these credentials\.$/,"integrations.srv.noCredentials",["provider"]],[/^(Jira|GitHub|GitLab) no longer accepts the saved token\. It may have expired or been revoked — reconnect with a new one\.$/,"integrations.srv.tokenGone",["provider"]],[/^(Jira|GitHub|GitLab) refused: the account or token is not allowed to read this\.$/,"integrations.srv.notAllowed",["provider"]],[/^(Jira|GitHub|GitLab) is limiting requests\. Try again in (\d+) s\.$/,"integrations.srv.limiting",["provider","n"]],[/^(Jira|GitHub|GitLab) has no such page or record, or this account cannot see it\.$/,"integrations.srv.noSuchPage",["provider"]],[/^(Jira|GitHub|GitLab) refused the request\.$/,"integrations.srv.refusedRequest",["provider"]],[/^(Jira|GitHub|GitLab) is not answering right now \((\d+)\)\. Try again shortly\.$/,"integrations.srv.notAnswering",["provider","status"]],[/^(Jira|GitHub|GitLab) answered (\d+)\.$/,"integrations.srv.answered",["provider","status"]],[/^The deck only sends this connection's token to (.+)\.$/,"integrations.srv.tokenOrigins",["origins"]],[/^(Jira|GitHub|GitLab) redirected to (\S+?), and the deck does not send the token there\. Check the address you connected\.$/,"integrations.srv.redirectedAway",["provider","origin"]],[/^(Jira|GitHub|GitLab) redirected too many times\.$/,"integrations.srv.redirectedMany",["provider"]],[/^(Jira|GitHub|GitLab) answered with something that is not JSON\. Check that the address is the \1 site itself\.$/,"integrations.srv.notJson",["provider"]],[/^The deck will not send a token to (\S+?)\.$/,"integrations.srv.noTokenTo",["origin"]],[/^This server runs Jira (.+?)\. Personal access tokens need Jira Server or Data Center 8\.14 or newer, so the deck cannot connect to it\.$/,"integrations.srv.serverOld",["version"]],[/^(Jira|GitHub|GitLab) is not available on this deck\.$/,"integrations.srv.notOnDeck",["provider"]],[/^(\S+?) did not answer in time$/,"forge.srv.timeout",["origin"]],[/^(\S+?): the certificate is not trusted \((.+?)\)$/,"forge.srv.cert",["origin","code"]],[/^(\S+?): no answer$/,"forge.srv.noAnswer",["origin"]],[/^(\S+?) is not a host this connection reads from$/,"forge.srv.notHost",["origin"]],[/^(\S+?) sent this read to (\S+?), not to this connection's address$/,"forge.srv.sentElsewhere",["origin","next"]],[/^(\S+?) answered (.+?), not the API$/,"forge.srv.notApi",["origin","type"]],[/^not an image \((.+?)\)$/,"forge.srv.notImage",["type"]]];function JSe(e,t=x){if(!e)return"";const n=e.replace(/\u2019/g,"'"),a=Object.hasOwn(GI,n)?GI[n]:void 0;if(a)return t(a);for(const[i,o,r]of KSe){const c=i.exec(n);if(!c)continue;const d={};return r.forEach((u,h)=>{d[u]=c[h+1]}),t(o,d)}return e}function YSe(e){if(!e||typeof e!="object")return;const t=e;if(!(typeof t.operationId!="string"||!/^[0-9a-f-]{36}$/.test(t.operationId)||typeof t.connectionId!="string"||!["comment","status","move"].includes(t.kind)||!["pending","uncertain","confirmed"].includes(t.state))&&!(t.kind==="move"?!Array.isArray(t.issueKeys)||!t.issueKeys.every(n=>typeof n=="string"):typeof t.issueKey!="string"))return t}class Za extends kn{constructor(n,a,i={}){super(a);Ba(this,"kind");Ba(this,"operation");Ba(this,"status");Ba(this,"retryAfter");Ba(this,"field");Ba(this,"detail");Ba(this,"refreshRequired");Ba(this,"outcomes");Ba(this,"moveOutcome");this.name="IntegrationFailure",this.kind=n,Object.assign(this,i)}}async function zW(e){try{const t=await e.json(),n=t==null?void 0:t.error,a=YSe(t==null?void 0:t.operation);if((t==null?void 0:t.code)==="jira_write_guard_conflict")return new Za("upstream",x("integrations.error.writeAwaiting"),{status:e.status,operation:a});if(n&&typeof n.kind=="string"&&typeof n.message=="string"){const i=Array.isArray(t.outcomes)?t.outcomes.slice(0,50).filter(c=>{if(!c||typeof c!="object")return!1;const d=c;return typeof d.issueKey=="string"&&/^[A-Z][A-Z0-9_]{0,40}-[1-9]\d{0,11}$/.test(d.issueKey)&&["moved","unchanged","unknown"].includes(String(d.membership))&&["ranked","unchanged","failed","unknown"].includes(String(d.rank))}).map(c=>({issueKey:c.issueKey,membership:c.membership,rank:c.rank})):[],o=t.outcome,r=o&&["moved","unchanged","unknown"].includes(o.membership)&&["ranked","unchanged","failed","unknown"].includes(o.rank)?{membership:o.membership,rank:o.rank}:void 0;return new Za(n.kind,JSe(n.message),{status:n.status,retryAfter:n.retryAfter,field:n.field,detail:n.detail,...t.refresh===!0?{refreshRequired:!0}:{},...i.length?{outcomes:i}:{},...r?{moveOutcome:r}:{},...a?{operation:a}:{}})}}catch{}return new Za(e.status===401?"auth":"upstream",x("integrations.error.deckAnswered",{status:e.status}))}async function uh(e,t={}){const{timeoutMs:n=3e4,...a}=t;return LW(a.signal,n,async i=>{let o;try{o=await fetch(e,{...a,signal:i,headers:a.body?{"Content-Type":"application/json",...a.headers??{}}:a.headers})}catch(r){throw i.aborted?r:new Za("network",x("integrations.error.unreachable"))}if(!o.ok)throw await zW(o);return o.json()})}async function LW(e,t,n){const a=new AbortController,i=window.setTimeout(()=>a.abort(),t),o=()=>a.abort(e==null?void 0:e.reason);e==null||e.addEventListener("abort",o,{once:!0}),e!=null&&e.aborted&&o();try{return a.signal.throwIfAborted(),await n(a.signal)}catch(r){throw e!=null&&e.aborted?e.reason??r:a.signal.aborted?new Za("network",x("integrations.error.timeout")):r}finally{window.clearTimeout(i),e==null||e.removeEventListener("abort",o)}}const OW=e=>`/api/integrations/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.id)}/`;function p1e(e){const t=OW(e);return(n,a)=>fetch(`${t}${n.replace(/^\/+/,"")}`,a)}function g1e(e){const t=OW(e);return n=>`${t}asset?url=${encodeURIComponent(n)}`}function m1e(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 f1e(e){const t=new URLSearchParams;for(const[a,i]of Object.entries(e))i===void 0||i===""||i===!1||t.set(a,i===!0?"1":String(i));const n=t.toString();return n?`?${n}`:""}async function b1e(e,t,{signal:n,timeoutMs:a=45e3}={}){return LW(n,a,async i=>{let o;try{o=await e(t,{signal:i,headers:{Accept:"application/json"}})}catch(r){throw i.aborted?r:new Za("network",x("integrations.error.unreachable"))}if(!o.ok)throw await zW(o);try{return await o.json()}catch(r){throw i.aborted?r:new Za("upstream",x("integrations.error.notJson"))}})}let qi={connections:null,providers:[],error:""};const Qc=new Set;let dg=null,Bd=null,dl=null,$I=0;const ZSe=5e3,XSe=3;function vm(e){qi={...qi,...e},Qc.forEach(t=>t(qi))}function Bf(){return Bd||(Bd=(async()=>{try{const e=await uh("/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 Za("upstream",x("integrations.error.notList"));vm({connections:t,providers:n,error:""})}catch(e){vm({error:Pi(e,x("integrations.error.readConnections"))}),qi.connections===null&&Qc.size>0&&dl===null&&$I<XSe&&(dl=window.setTimeout(()=>{dl=null,Bf()},ZSe*2**$I++))}finally{Bd=null}})(),Bd)}function QSe(e){return e.connections===null||e.providers.length>0||e.connections.length>0}function VI(){QSe(qi)&&Bf()}function e0(e){const t=qi.connections??[],n=t.findIndex(a=>a.id===e.id);vm({connections:n<0?[...t,e]:t.map(a=>a.id===e.id?e:a)})}function eNe(e){vm({connections:(qi.connections??[]).filter(t=>t.id!==e)})}function hh(){const[e,t]=m.useState(qi);return m.useEffect(()=>{Qc.add(t),t(qi);const n=()=>{document.visibilityState==="visible"&&VI()};return Qc.size===1&&(Bf(),dg=window.setInterval(VI,6e4),document.addEventListener("visibilitychange",n)),()=>{Qc.delete(t),Qc.size===0&&(dg!==null&&window.clearInterval(dg),dg=null,dl!==null&&window.clearTimeout(dl),dl=null,document.removeEventListener("visibilitychange",n))}},[]),e}function km(e,t){return(e.connections??[]).filter(n=>n.kind===t)}function ph(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 Ai(e,t){return ph(e).has(t)}function Tj(e,t){return Ai(e,t)&&km(e,t).length>0}function t0(e){return ph(e).size>0?"all":(e.connections??[]).length>0?"connections":"none"}async function tNe(e,t,n){const a=await uh("/api/integrations/connections",{method:"POST",body:JSON.stringify({kind:e,name:n,input:t}),timeoutMs:6e4});return e0(a.connection),a.connection}async function nNe(e,t){const n=await uh(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t),timeoutMs:6e4});return e0(n.connection),n}async function aNe(e){const t=await uh(`/api/integrations/connections/${encodeURIComponent(e)}/test`,{method:"POST",body:"{}",timeoutMs:6e4});return e0(t.connection),t.connection}async function sNe(e){await uh(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"DELETE"}),eNe(e)}function pr(e){try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function v1e(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 wm=null,ym=null;function KI(e){ym=null,wm=e}function iNe(e){wm=null,ym=e}function oNe(){const e=ym;return ym=null,e}function rNe(){const e=wm;return wm=null,e}const cNe={jira:"integrations.explore.cap.jira",github:"integrations.explore.cap.github",gitlab:"integrations.explore.cap.gitlab"},lNe={jira:"integrations.explore.access.jira",github:"integrations.explore.access.read",gitlab:"integrations.explore.access.read"};function dNe(){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 uNe({integrations:e,onClose:t,onOpen:n,onConnect:a,onManage:i}){const o=se(),r=Tt(t,{restoreFocusFallback:dNe}),c=Rt(t),d=QT().filter(g=>e.providers.some(f=>f.kind===g.kind)||km(e,g.kind).length>0),u=d.filter(g=>Tj(e,g.kind)).length,h=g=>{t(),g()};return _t.createPortal(s.jsx("div",{className:"modal-backdrop",role:"presentation",...c,children:s.jsxs("div",{ref:r,className:"modal explore-integrations",role:"dialog","aria-modal":"true","aria-labelledby":"explore-integrations-title","aria-describedby":"explore-integrations-description",children:[s.jsxs("div",{className:"modal-head explore-head",children:[s.jsx("h2",{id:"explore-integrations-title",children:o("integrations.explore.title")}),s.jsx("button",{type:"button",className:"glyph-btn","aria-label":o("integrations.explore.closeAria"),title:o("integrations.closeEsc"),onClick:t,children:"×"})]}),s.jsxs("div",{className:"explore-body",children:[s.jsx("p",{id:"explore-integrations-description",className:"explore-intro",children:o("integrations.explore.intro")}),e.error&&s.jsxs("p",{className:"explore-status",role:"alert",children:[e.error," ",o("integrations.explore.stale")]}),e.connections===null?s.jsx("p",{className:"explore-status",role:"status",children:e.error?o("integrations.explore.statusUnavailable"):o("integrations.explore.reading")}):d.length===0?s.jsx("p",{className:"explore-status",role:"status",children:o("integrations.explore.none")}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"explore-caption",children:[s.jsx("span",{children:o("integrations.explore.available")}),s.jsx("span",{children:o("integrations.explore.connectedCount",{n:u})})]}),s.jsx("ul",{className:"explore-providers",children:d.map(g=>{const f=Ai(e,g.kind),b=Tj(e,g.kind),k=km(e,g.kind)[0];return s.jsxs("li",{className:"explore-provider",children:[s.jsx("span",{className:"explore-glyph","aria-hidden":!0,children:s.jsx(g.Glyph,{})}),s.jsxs("div",{className:"explore-info",children:[s.jsx("h3",{children:g.label}),s.jsx("p",{children:o(cNe[g.kind])}),s.jsxs("span",{className:"explore-connection","data-connected":b||void 0,children:[o(f?b?"integrations.explore.connected":"integrations.explore.notConnected":"integrations.explore.unavailableOnDeck")," · ",o(lNe[g.kind])]})]}),s.jsx("div",{className:"explore-actions",children:b?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn","aria-label":o("integrations.explore.openAria",{label:g.label}),onClick:()=>h(()=>n(g.kind)),children:[o("integrations.explore.open")," ",s.jsx(xl,{})]}),s.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":o("integrations.manageProvider",{label:g.label}),onClick:()=>h(()=>i(k==null?void 0:k.id)),children:o("integrations.manage")})]}):f?s.jsx("button",{type:"button",className:"btn primary","aria-label":o("integrations.form.connect",{provider:g.label}),onClick:()=>h(()=>a(g.kind)),children:o("integrations.form.connectBtn")}):k?s.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":o("integrations.manageProvider",{label:g.label}),onClick:()=>h(()=>i(k.id)),children:o("integrations.manage")}):s.jsx("span",{className:"explore-unavailable",children:o("integrations.explore.notAvailable")})})]},g.kind)})})]})]}),s.jsxs("div",{className:"explore-footer",children:[s.jsx("span",{children:o("integrations.explore.footer")}),s.jsxs("button",{type:"button",className:"btn explore-text-action",onClick:()=>h(()=>i()),children:[o("integrations.explore.manageInSettings")," ",s.jsx(xl,{})]})]})]})}),document.body)}function hNe({widths:e,room:t,gap:n,more:a}){let i=0,o=0;for(let r=0;r<e.length;r++){i+=(r>0?n:0)+e[r];const c=r+1<e.length?n+a:0;if(i+c>t)break;o=r+1}return o}function PW(e,t=x){return e.tool?e.tool.name:e.kind==="asked"?t("board.queue.question"):t("board.queue.permission")}const pNe=20;function gNe(e,t=pNe){if(e.length<=t)return e;const n=Math.floor((t-1)*.4),a=t-1-n;return`${e.slice(0,a)}…${e.slice(e.length-n)}`}function mNe(e,t=x){const n=Math.floor(Math.max(0,e)/6e4);if(n<1)return t("board.queue.lessThanMinute");if(n<60)return t("board.queue.minutes",{count:n});const a=Math.floor(n/60),i=n%60;return i===0?t("board.queue.hours",{count:a}):t("board.queue.hoursMinutes",{h:t("board.queue.hours",{count:a}),m:t("board.queue.minutes",{count:i})})}function fNe(e,t,n,a=x){var r;const i=mNe(n,a),o=t.tool?"board.queue.entry.tool":t.kind==="asked"?"board.queue.entry.answer":"board.queue.entry.permission";return a(o,{label:e,wait:i,tool:((r=t.tool)==null?void 0:r.name)??""})}function bNe(e,t=x){const n=fl(e,t),a=aU(e,n,t);return a?`${n}
|
|
151
|
+
${n("board.rail.unreadCount",{n:t})}`:a}function cg(e,t){return t.map(n=>({...n,group:e}))}function sSe({providers:e,sessionListOpen:t,toggleSessionList:n,accountsPanelOpen:a,toggleAccountsPanel:i,accountsPanelId:o="accounts-panel",codexPanelOpen:r=!1,toggleCodexPanel:c=()=>{},usagePanelOpen:d,setUsagePanelOpen:u,machinePanelOpen:h,setMachinePanelOpen:g,setUsageHistoryOpen:f,watchOn:b,watchUnseen:k,setBrowserWatchOpen:y,setTrafficRadarOpen:N,setRadioOpen:w,openToolActivity:j,openSettings:S,onFeedback:A,toggles:T,openCapacity:q,integrations:_=[],openExploreIntegrations:I,openQuickOpen:z}){const F=nre(Ao()),U=Po(Ao()),P={id:"session-list",label:x("board.rail.sessionList"),short:x("board.rail.sessionList.short"),key:{cap:"L",aria:"L",single:!0},ariaLabel:x("board.rail.sessionList"),glyph:s.jsx(pB,{}),kind:"panel",open:t,controls:"session-list",onPress:n,buttonRef:T.sessionList},L={id:"accounts",label:x("board.rail.accounts"),short:x("board.rail.accounts"),key:{cap:"A",aria:"A",single:!0},ariaLabel:x("board.rail.accounts"),hint:e.codex?void 0:x("board.rail.accounts.hint"),glyph:s.jsx(gB,{}),kind:"panel",open:a,controls:o,onPress:i,buttonRef:T.accounts},R=q?[{id:"account-capacity",label:x("board.rail.capacity"),short:x("board.rail.capacity.short"),ariaLabel:x("board.rail.capacity"),detail:x("board.rail.capacity.detail"),glyph:s.jsx(goe,{}),kind:"dialog",onPress:()=>q("accounts")},{id:"reset-calendar",label:x("board.rail.calendar"),short:x("board.rail.calendar.short"),ariaLabel:x("board.rail.calendar"),detail:x("board.rail.calendar.detail"),glyph:s.jsx(moe,{}),kind:"dialog",onPress:()=>q("calendar")}]:[],O={id:"codex-accounts",label:"Codex accounts",short:"Codex",ariaLabel:"Codex accounts",glyph:s.jsx(Soe,{}),kind:"panel",open:r,controls:"codex-accounts-panel",onPress:c,buttonRef:T.codex},D={id:"usage",label:x("board.rail.usage"),short:x("board.rail.usage"),key:{cap:"U",aria:"U",single:!0},ariaLabel:x("board.rail.usage"),glyph:s.jsx(noe,{}),kind:"panel",open:d,controls:"usage-panel",onPress:()=>u(Y=>!Y),buttonRef:T.usage},$={id:"machine",label:x("board.rail.machine"),short:x("board.rail.machine"),key:{cap:"S",aria:"S",single:!0},ariaLabel:x("board.rail.machine"),hint:x("board.rail.machine.hint"),glyph:s.jsx(soe,{}),kind:"panel",open:h,controls:"system-panel",onPress:()=>g(Y=>!Y),buttonRef:T.machine},B={id:"history",label:x("board.rail.history"),short:x("board.rail.history.short"),key:{cap:"H",aria:"H",single:!0},ariaLabel:x("board.rail.history"),glyph:s.jsx(aoe,{}),kind:"dialog",onPress:()=>f(Y=>!Y)},G={id:"browser-watch",label:x("board.rail.browserWatch"),short:x("board.rail.browserWatch.short"),key:{cap:"B",aria:"B",single:!0},ariaLabel:`${x("board.rail.browserWatch")}${x("board.listSep")}${x(b?"board.rail.watching":"board.rail.notWatching")}${k>0?`${x("board.listSep")}${x("board.rail.unreadCount",{n:k})}`:""}`,detail:aSe(b,k,x),glyph:s.jsx(ooe,{watching:b===!0||k>0}),kind:"dialog",onPress:()=>y(Y=>!Y),badge:k},Z={id:"settings",label:x("board.rail.settings"),short:x("board.rail.settings.short"),key:{cap:F,aria:"Control+, Meta+,",single:!1},ariaLabel:x("board.rail.settings"),glyph:s.jsx(roe,{}),kind:"dialog",onPress:()=>S()},W={id:"quick-open",label:x("board.rail.search"),short:x("board.rail.search"),key:{cap:eoe(U),aria:U?"Meta+K":"Control+K",single:!1},ariaLabel:x("board.rail.search"),detail:x("board.rail.search.detail"),glyph:s.jsx(fB,{}),kind:"dialog",onPress:z},H={id:"feedback",label:x("board.rail.feedback"),short:x("board.rail.feedback"),menu:x("board.rail.feedback.menu"),ariaLabel:x("board.rail.feedback.menu"),glyph:s.jsx(coe,{}),kind:"dialog",onPress:A},X=j?[{id:"tool-activity",label:x("board.rail.tools.activity"),short:x("board.rail.tools.short"),ariaLabel:x("board.rail.tools.activity"),glyph:s.jsx(poe,{}),kind:"dialog",detail:x("board.rail.tools.detail"),onPress:()=>j("tools")},{id:"skill-activity",label:x("board.rail.skills"),short:x("board.rail.skills.short"),ariaLabel:x("board.rail.skills"),glyph:s.jsx(mB,{}),kind:"dialog",detail:x("board.rail.skills.detail"),onPress:()=>j("skills")}]:[],V=N?[{id:"traffic-radar",label:x("board.rail.radar"),short:x("board.rail.radar.short"),ariaLabel:x("board.rail.radar"),glyph:s.jsx(ioe,{}),kind:"dialog",detail:x("board.rail.radar.detail"),onPress:()=>N(!0)}]:[],Q=w?[{id:"radio",label:x("board.rail.radio"),short:x("board.rail.radio"),ariaLabel:x("board.rail.radio"),glyph:s.jsx(hoe,{}),kind:"dialog",detail:x("board.rail.radio.detail"),onPress:()=>w(!0)}]:[];return{left:e.claude?[L,P]:e.codex?[O,P]:[P],codexDoor:e.claude&&e.codex?[O]:[],leftStripe:[...e.claude?[cg(e.codex?x("board.rail.accounts"):x("board.rail.group.accounts"),[L,...R])]:[],...e.codex&&!e.claude?[[O]]:[],[P]],capacity:e.claude?R:[],right:[cg(x("board.rail.group.usage"),[D,$]),cg(x("board.rail.group.activity"),[B,...X]),cg(x("board.rail.group.watchers"),[G,...V]),Q].filter(Y=>Y.length>0),utilities:[Z,H],search:W,explore:I?[{id:"explore-integrations",label:x("board.rail.explore"),short:x("board.rail.explore.short"),ariaLabel:x("board.rail.explore"),glyph:s.jsx(toe,{}),kind:"dialog",onPress:I}]:[],integrations:_.map(({provider:Y,onPress:K})=>({id:`integration-${Y.kind}`,label:Y.label,short:Y.label,ariaLabel:Y.label,detail:nu(x,Y.detail),key:Y.shortcut?{cap:Y.shortcut.toUpperCase(),aria:Y.shortcut.toUpperCase(),single:!0}:void 0,glyph:s.jsx(Y.Glyph,{}),kind:"dialog",onPress:K}))}}function lg(e,t){return e.split(/\{(\w+)\}/).map((a,i)=>i%2===0?a:s.jsx(m.Fragment,{children:a in t?t[a]:`{${a}}`},i))}const bm=[{value:"bug",get label(){return x("shell.feedback.kind.bug")},get question(){return x("shell.feedback.q.bug")},get placeholder(){return x("shell.feedback.ph.bug")}},{value:"idea",get label(){return x("shell.feedback.kind.idea")},get question(){return x("shell.feedback.q.idea")},get placeholder(){return x("shell.feedback.ph.idea")}},{value:"other",get label(){return x("shell.feedback.kind.other")},get question(){return x("shell.feedback.q.other")},get placeholder(){return x("shell.feedback.ph.other")}}];function SW(e){return bm.find(t=>t.value===e)??bm[0]}const jj=3,MS=120,NW=1e4,jW=200,iSe=()=>x("shell.feedback.missing");function II(e){return e.trim()!==""}function oSe(e){var o;const t=e.trim();if(t==="")return"";const n=DI(t.split(/\r?\n/,1)[0]),a=((o=/^(.+?[.!?])(?=\s|$)/.exec(n))==null?void 0:o[1])??n,i=IS(a).length>=jj?IS(a):IS(n);return cSe(i.length>=jj?i:DI(t))}function rSe(e,t){const n=oSe(t);return n.length>=jj?n:x("shell.feedback.titleKind",{kind:SW(e).label,text:n})}function DI(e){return e.replace(/\s+/g," ").trim()}function IS(e){return/[^.]\.$/.test(e)?e.slice(0,-1):e}function cSe(e){if(e.length<=MS)return e;const t=e.slice(0,MS-1),n=t.lastIndexOf(" ");return`${(n>=MS/2?t.slice(0,n):t).replace(/[\uD800-\uDBFF]$/,"").replace(/[\s,;:.\-–—]+$/,"")}…`}function lSe({kind:e,body:t,contact:n}){const a={kind:e,title:rSe(e,t),body:t.trim()};return n.trim()!==""&&(a.contact=n.trim()),a}function dSe(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 uSe={darwin:"macOS",win32:"Windows",linux:"Linux"};function hSe(e){const t=e.indexOf("-"),n=t===-1?e:e.slice(0,t),a=t===-1?"":e.slice(t+1),i=uSe[n]??n;return a?`${i} · ${a}`:i}function pSe(e){return e?`ccdeck ${e.appVersion} · ${hSe(e.platform)}`:null}const gSe=()=>x("shell.feedback.factsWith"),mSe=()=>x("shell.feedback.factsUnknown"),fSe=()=>x("shell.feedback.addDetails"),bSe=()=>x("shell.feedback.contact"),vSe=()=>x("shell.feedback.contactPh"),kSe=()=>x("shell.feedback.contactHint"),wSe=()=>[x("shell.feedback.where1"),x("shell.feedback.where2")];function ySe(e){return e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&!e.isComposing}function XT(e){return e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.isComposing}function xSe(e){return Po(e)?["⌘","Enter"]:["Ctrl","Enter"]}function CSe(e){return[...e].length===1}const AW=()=>x("shell.feedback.sent");function SSe(e){const t=/^At most (\d+) images\.$/.exec(e);if(t)return x("shell.feedback.problem.count",{n:t[1]});const n=/^Image (\d+) is over (\d+) MB\.$/.exec(e);if(n)return x("shell.feedback.problem.size",{n:n[1],mb:n[2]});const a=/^Image (\d+) is not a PNG or a JPEG\.$/.exec(e);return a?x("shell.feedback.problem.format",{n:a[1]}):e}function FI(e,t,n){if(t==="vetoed")return x("shell.feedback.fail.vetoed");if(e===429||t==="too_many")return x("shell.feedback.fail.tooMany");if(e===413||t==="too_large")return x("shell.feedback.fail.tooLarge");const a=n==null?void 0:n.images;return e===400&&Array.isArray(a)&&typeof a[0]=="string"?x("shell.feedback.fail.image",{reason:SSe(a[0])}):x(e===400?"shell.feedback.fail.rejected":"shell.feedback.fail.unreachable")}function NSe(e){return e==="sending"?x("shell.feedback.sending"):e==="sent"?AW():""}const UI=1400,jSe=160,TW=m.createContext({values:{}});function RW(){return m.useContext(TW)}function ASe(e,t){const n=e.variants;return n?{...e,...n.by[t[n.field]??""]??{}}:e}const BI=(e,t)=>!e.when||e.when.is.includes(t[e.when.field]??"");function TSe({def:e,existing:t,busy:n,error:a,onSubmit:i,onCancel:o,onDirtyChange:r}){var R,O;const c=se(),d=m.useId(),[u,h]=m.useState(()=>Object.fromEntries(e.fields.map(D=>{var $,B,G;return[D.name,D.secret?"":(($=D.initial)==null?void 0:$.call(D,t))??(D.type==="choice"?((G=(B=D.options)==null?void 0:B[0])==null?void 0:G.value)??"":"")]}))),[g,f]=m.useState((t==null?void 0:t.name)??""),b=m.useRef(null),k=m.useRef(new Map),y=!!t,N=m.useRef(u),w=m.useRef(g);m.useEffect(()=>{r==null||r(g!==w.current||Object.keys(u).some(D=>u[D]!==N.current[D]))},[g,u,r]);const j=e.fields.filter(D=>D.type==="choice").every(D=>u[D.name]===N.current[D.name]),S=y&&t.tokenSaved&&j,A=(D,$)=>{n||h(B=>({...B,[D]:$}))},T=D=>{var B;if(D.preventDefault(),n)return;const $={};for(const G of e.fields)BI(G,u)&&($[G.name]=(u[G.name]??"").trim());(B=D.currentTarget.querySelector('button[type="submit"]'))==null||B.focus(),i($,g.trim()),h(G=>Object.fromEntries(Object.entries(G).map(([Z,W])=>{var H;return[Z,(H=e.fields.find(X=>X.name===Z))!=null&&H.secret?"":W]})))},q=m.useMemo(()=>{const D=u.baseUrl??"";try{return D?new URL(/^[a-z]+:\/\//i.test(D)?D:`https://${D}`).host:""}catch{return""}},[u.baseUrl]),_=m.useMemo(()=>({values:u,existing:t}),[u,t]),I=e.fields.filter(D=>BI(D,u)),z=(R=I.find(D=>!D.secret&&D.type!=="choice"))==null?void 0:R.name,F=(O=I.find(D=>D.secret))==null?void 0:O.name,U=a!=null&&a.field&&I.some(D=>D.name===a.field&&D.type!=="choice")?a.field:null,P=`${d}-error`;m.useEffect(()=>{var $,B,G;const D=y?F:z??F;D&&(($=k.current.get(D))==null||$.focus()),(G=(B=b.current)==null?void 0:B.scrollIntoView)==null||G.call(B,{block:"nearest"})},[y]),m.useEffect(()=>{var D;U&&((D=k.current.get(U))==null||D.focus())},[a,U]);const L=a&&s.jsxs(s.Fragment,{children:[a.message,a.detail&&s.jsxs("span",{className:"ig-form-detail",children:[" ",c("integrations.failure.said",{provider:e.label,said:a.detail})]}),a.kind==="rate-limit"&&a.retryAfter?s.jsxs("span",{children:[" ",c("integrations.form.retryIn",{n:a.retryAfter})]}):null]});return s.jsx(TW.Provider,{value:_,children:s.jsxs("form",{ref:b,className:"ig-form",onSubmit:T,"aria-labelledby":`${d}-title`,noValidate:!0,children:[s.jsxs("header",{className:"ig-managed-header",children:[s.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:s.jsx(e.Glyph,{})}),s.jsxs("div",{className:"ig-managed-identity",children:[s.jsx("h2",{className:"ig-form-title",id:`${d}-title`,children:y?c("integrations.form.edit",{name:t.name}):c("integrations.form.connect",{provider:e.label})}),y&&s.jsx("p",{children:c("integrations.form.connectionOf",{provider:e.label})})]})]}),I.map(D=>{const $=ASe(D,u),B={...$,label:nu(c,$.label),hint:nu(c,$.hint),placeholder:nu(c,$.placeholder)},G=(a==null?void 0:a.field)===B.name,Z=[B.hint?`${d}-${B.name}-hint`:"",G?P:""].filter(Boolean).join(" ")||void 0;if(B.type==="choice")return s.jsxs("fieldset",{className:"fb-kinds","aria-invalid":G||void 0,children:[s.jsx("legend",{className:"vis-hidden",children:B.label}),(B.options??[]).map(X=>s.jsxs("label",{className:"fb-kind",children:[s.jsx("input",{type:"radio",name:`${d}-${B.name}`,value:X.value,checked:u[B.name]===X.value,"aria-disabled":n||void 0,onChange:()=>A(B.name,X.value),onKeyDown:V=>{XT(V.nativeEvent)&&V.preventDefault()}}),nu(c,X.label)]},X.value))]},B.name);const W=B.secret&&S,H=`${d}-${B.name}`;return s.jsxs("div",{className:"fb-field",children:[s.jsxs("label",{className:"fb-field-label",htmlFor:H,children:[B.label,B.optional&&s.jsxs("span",{className:"fb-optional",children:[" ",c("integrations.form.optional")]})]}),s.jsx("input",{id:H,className:`ap-manage-input ig-input${B.secret?" ig-mono":""}`,ref:X=>{X?k.current.set(B.name,X):k.current.delete(B.name)},type:B.type,inputMode:B.type==="url"?"url":B.type==="email"?"email":void 0,autoComplete:B.autoComplete??"off",spellCheck:!1,value:u[B.name]??"",onChange:X=>A(B.name,X.target.value),placeholder:W?c("integrations.form.keepSaved"):B.placeholder,readOnly:n,"aria-invalid":G||void 0,"aria-describedby":Z,"aria-required":!B.optional&&!W||void 0}),B.hint&&s.jsx("span",{className:"ig-hint",id:`${d}-${B.name}-hint`,children:B.hint}),G&&U===B.name&&s.jsx("span",{className:"ig-form-error",id:P,role:"alert",children:L})]},B.name)}),s.jsxs("details",{className:"ig-help ig-token-help",children:[s.jsx("summary",{children:c("integrations.form.howTo",{provider:e.label})}),e.tokenHelp]}),s.jsxs("div",{className:"fb-field",children:[s.jsxs("label",{className:"fb-field-label",htmlFor:`${d}-name`,children:[c("integrations.form.name")," ",s.jsx("span",{className:"fb-optional",children:c("integrations.form.optional")})]}),s.jsx("input",{id:`${d}-name`,className:"ap-manage-input ig-input",type:"text",autoComplete:"off",maxLength:120,readOnly:n,value:g,onChange:D=>f(D.target.value),placeholder:q||e.label})]}),a&&!U&&s.jsx("p",{className:"ig-form-error",id:P,role:"alert",children:L}),s.jsxs("div",{className:"ig-form-actions",children:[s.jsx("button",{type:"submit",className:"btn primary","aria-disabled":n,"aria-busy":n,children:c(n?"integrations.form.checking":y?"integrations.form.save":"integrations.form.connectBtn")}),s.jsx("button",{type:"button",className:"btn","aria-disabled":n||void 0,onClick:()=>{n||o()},children:c("integrations.cancel")})]})]})})}const RSe="https://id.atlassian.com/manage-profile/security/api-tokens",ESe="https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/",qSe="https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html",_Se=[{scope:"read:jira-work",why:"issues, comments, search",whyKey:"integrations.token.why.work"},{scope:"read:jira-user",why:"your account and avatars",whyKey:"integrations.token.why.user"},{scope:"read:board-scope:jira-software",why:"boards and backlogs",whyKey:"integrations.token.why.board"},{scope:"read:board-scope.admin:jira-software",why:"a board's estimation and quick filters",whyKey:"integrations.token.why.boardAdmin"},{scope:"read:sprint:jira-software",why:"sprints",whyKey:"integrations.token.why.sprint"},{scope:"read:epic:jira-software",why:"epic names and colours",whyKey:"integrations.token.why.epic"},{scope:"read:issue-details:jira",why:"issue lists",whyKey:"integrations.token.why.issueDetails"},{scope:"read:jql:jira",why:"filtered lists",whyKey:"integrations.token.why.jql"}];function zSe(e){const t=e.trim();if(!t)return null;try{const n=new URL(/^[a-z]+:\/\//i.test(t)?t:`https://${t}`),a=n.hostname==="localhost"||n.hostname==="127.0.0.1";return n.protocol!=="https:"&&!a||!n.hostname.includes(".")&&!a?null:`${n.origin}${n.pathname.replace(/\/+$/,"")}/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens`}catch{return null}}function LSe(){const e=se(),{values:t}=RW(),n=t.deployment==="cloud",a=n?null:zSe(t.baseUrl??"");let i="";try{i=a?new URL(a).host:""}catch{}return s.jsxs(s.Fragment,{children:[n?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:lg(e("integrations.token.cloud.intro"),{link:s.jsx("a",{href:RSe,target:"_blank",rel:"noreferrer noopener",children:"id.atlassian.com → Security → API tokens"}),scoped:s.jsx("em",{children:e("integrations.token.cloud.scoped")})})}),s.jsx("ul",{className:"ig-scopes",children:_Se.map(o=>s.jsxs("li",{children:[s.jsx("code",{children:o.scope})," ",s.jsx("span",{children:e(o.whyKey)})]},o.scope))}),s.jsx("p",{children:s.jsx("a",{href:ESe,target:"_blank",rel:"noreferrer noopener",children:e("integrations.token.cloud.docs")})})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{children:lg(e("integrations.token.server.intro"),{profile:s.jsx("strong",{children:"Profile"}),pats:s.jsx("strong",{children:"Personal Access Tokens"}),create:s.jsx("strong",{children:"Create token"}),page:a?lg(e("integrations.token.server.page"),{link:s.jsx("a",{href:a,target:"_blank",rel:"noreferrer noopener",children:e("integrations.token.server.openOn",{host:i})})}):""})}),s.jsx("p",{children:s.jsx("a",{href:qSe,target:"_blank",rel:"noreferrer noopener",children:e("integrations.token.server.docs")})})]}),s.jsx("p",{className:"ig-dim",children:e("integrations.token.reads")}),n&&s.jsx("p",{className:"ig-dim",children:lg(e("integrations.token.scopedWrite"),{rank:s.jsx("code",{children:"write:issue:jira-software"}),sprint:s.jsx("code",{children:"write:sprint:jira-software"}),backlog:s.jsx("code",{children:"write:board-scope:jira-software"})})})]})}function DS(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 a=(t??"").trim()||"https://gitlab.com";let i;try{i=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(a)?a:`https://${a}`)}catch{return null}return i.protocol!=="https:"&&i.protocol!=="http:"||!i.hostname.includes(".")&&i.hostname!=="localhost"?null:`${i.origin}${i.pathname.replace(/\/+$/,"")}/-/user_settings/personal_access_tokens?name=ccdeck&scopes=read_api`}function HI(e,t){return e.split(/(\{\w+\})/).map((n,a)=>{var o;const i=(o=/^\{(\w+)\}$/.exec(n))==null?void 0:o[1];return i&&i in t?s.jsx("span",{children:t[i]},a):n})}function FS({href:e,children:t}){return e?s.jsxs("a",{className:"fg-token-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t," ",s.jsx(xl,{})]}):null}function EW({kind:e,baseUrl:t}){const{values:n}=RW(),a=se();if(e==="github")return s.jsxs("div",{className:"fg-token-help",children:[s.jsx("p",{children:a("forge.token.gh.intro")}),s.jsxs("ul",{children:[s.jsxs("li",{children:[s.jsx("strong",{children:a("forge.token.gh.classicName")})," ",HI(a("forge.token.gh.classic"),{repo:s.jsx("code",{children:"repo"}),org:s.jsx("code",{children:"read:org"})})," ",s.jsx(FS,{href:DS("github"),children:a("forge.token.makeOne")})]}),s.jsxs("li",{children:[s.jsx("strong",{children:a("forge.token.gh.fineName")})," ",a("forge.token.gh.fine")," ",s.jsx(FS,{href:DS("github",null,"fine-grained"),children:a("forge.token.makeOne")})]})]}),s.jsx("p",{children:a("forge.token.gh.approval")})]});const i=DS("gitlab",t??(n.where==="self"?n.baseUrl:null));return s.jsxs("div",{className:"fg-token-help",children:[s.jsxs("p",{children:[HI(a("forge.token.gl.scope"),{scope:s.jsx("code",{children:"read_api"})})," ",s.jsx(FS,{href:i,children:a("forge.token.makeOn",{host:i?new URL(i).host:"GitLab"})})]}),s.jsx("p",{children:a("forge.token.gl.expire")})]})}const qW={name:"token",type:"password",secret:!0,get label(){return x("forge.field.token")},get placeholder(){return x("forge.field.tokenPlaceholder")}},OSe=[qW],WI=e=>{try{return e?new URL(e.baseUrl).host!=="gitlab.com":!1}catch{return!1}},PSe=[{name:"where",type:"choice",get label(){return x("forge.field.which")},get options(){return[{value:"cloud",label:"GitLab.com"},{value:"self",label:x("forge.field.selfManaged")}]},initial:e=>WI(e)?"self":"cloud"},{name:"baseUrl",type:"url",placeholder:"https://gitlab.example.com",get label(){return x("forge.field.url")},get hint(){return x("forge.field.urlHint")},when:{field:"where",is:["self"]},initial:e=>WI(e)?e.baseUrl:""},qW],MSe=m.createElement(EW,{kind:"github"}),ISe=m.createElement(EW,{kind:"gitlab"}),DSe=e=>{var t;return((t=e==null?void 0:e.meta)==null?void 0:t.deployment)==="cloud"?"cloud":"server"},FSe={kind:"jira",label:"Jira",Glyph:boe,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:DSe},{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:m.createElement(LSe)},USe={kind:"github",label:"GitHub",Glyph:voe,detail:"Repositories, pull requests, and Actions",blurb:"github.com, read-only, with a personal access token.",fields:OSe,tokenHelp:MSe},BSe={kind:"gitlab",label:"GitLab",Glyph:koe,detail:"Projects, merge requests, and pipelines",blurb:"GitLab.com or your own instance, read-only.",fields:PSe,tokenHelp:ISe},Aj={jira:FSe,github:USe,gitlab:BSe},QT=()=>Object.values(Aj).filter(e=>!!e);function au(e){return(Object.hasOwn(Aj,e)?Aj[e]:void 0)??null}function Uf(e,t){const n=a=>typeof t=="string"?t:t(a);return m.lazy(()=>e().catch(a=>(console.warn(`ccdeck could not load ${typeof t=="string"?t:"a dialog"}`,a),{default:i=>s.jsx(HSe,{name:n(i),onClose:i.onClose})})))}function HSe({name:e,onClose:t}){const n=se(),a=m.useRef(null),i=Tt(t,{focusRef:a}),o=Rt(t);return s.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:s.jsxs("div",{ref:i,className:"modal dialog-missing",onClick:r=>r.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"dialog-missing-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"dialog-missing-title",className:"modal-tool-name",children:e})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:t,"aria-label":n("shell.closeEsc"),title:n("shell.closeEsc"),children:"×"})})]}),s.jsxs("section",{className:"modal-body",children:[s.jsx("p",{className:"dm-note",children:n("shell.lazy.didNotLoad",{name:e})}),s.jsxs("div",{className:"dm-actions",children:[s.jsx("button",{type:"button",className:"btn",onClick:t,children:n("shell.close")}),s.jsx("button",{type:"button",ref:a,className:"btn primary",onClick:()=>window.location.reload(),children:n("shell.reload")})]})]})]})})}const _W=()=>Hr(()=>import("./IntegrationModal-DzIizEQd.js"),[]);function WSe(){_W().catch(()=>{})}const GSe=Uf(_W,e=>{var t;return((t=au(e.kind))==null?void 0:t.label)??x("integrations.modal.tracker")});function $Se({onClose:e}){return m.useEffect(()=>jn.push(e,0,"dialog"),[e]),null}function VSe(e){return s.jsx(m.Suspense,{fallback:s.jsx($Se,{onClose:e.onClose}),children:s.jsx(GSe,{...e})})}const GI={"The deck failed while reading the tracker.":"integrations.srv.deckFailed","The answer was larger than the deck accepts.":"integrations.srv.tooLarge","Enter a token.":"integrations.srv.enterToken","Enter an API token.":"integrations.srv.enterApiToken","Enter a personal access token.":"integrations.srv.enterPat","The token has a space in it. Paste it again.":"integrations.srv.tokenSpace","Enter the email address of your Atlassian account.":"integrations.srv.enterEmail","Choose Jira Cloud or Jira Server / Data Center.":"integrations.srv.chooseDeployment","Enter your Jira site URL.":"integrations.srv.enterSiteUrl","Enter your Jira URL.":"integrations.srv.enterJiraUrl","Enter your GitLab's address.":"integrations.srv.enterGitlabUrl","Your Jira site URL is not a valid URL.":"integrations.srv.badSiteUrl","Your Jira URL is not a valid URL.":"integrations.srv.badJiraUrl","Your GitLab's address is not a valid URL.":"integrations.srv.badGitlabUrl","Leave the user name and password out of the address.":"integrations.srv.urlUser","Use an https:// address. Plain http is only accepted for a server on this machine.":"integrations.srv.httpsOnly","Use an https:// address.":"integrations.srv.httpsAddress","That connection is not there any more.":"integrations.srv.connectionGone","No token is saved for this connection. Edit it and enter one.":"integrations.srv.noTokenEdit","No token is saved for this connection. Reconnect it in Settings.":"integrations.srv.noTokenReconnect","Enter a comment of up to 10,000 characters.":"integrations.srv.commentLength","This Jira write is outside the connection's token origins.":"integrations.srv.writeOutside","Jira redirected the comment. Refresh the issue before sending again.":"integrations.srv.commentRedirected","The comment could not be confirmed. Refresh the issue before sending again.":"integrations.srv.commentUnconfirmed","Jira redirected the write. It was not replayed; refresh the board before trying again.":"integrations.srv.writeRedirected","Jira's rank result was too large. Refresh the board to check its position.":"integrations.srv.rankTooLarge","Jira did not confirm every requested issue update. Some issues may have changed; refresh the board to check them.":"integrations.srv.updateUnconfirmed","Jira did not confirm the write. Refresh the board to check the issue.":"integrations.srv.writeUnconfirmed","Jira refused the move: the account or token needs permission to edit and schedule this issue.":"integrations.srv.moveRefused","Jira did not return its available transitions.":"integrations.srv.transitionsMissing","Choose a valid transition.":"integrations.srv.transitionChoose","This transition is unavailable or requires additional fields in Jira.":"integrations.srv.transitionUnavailable","Jira redirected the transition. Refresh the issue before trying again.":"integrations.srv.transitionRedirected","Jira did not confirm the transition. Refresh the issue.":"integrations.srv.transitionUnconfirmed","There is no Jira REST API at this address. Check the URL — some servers live under a path such as /jira.":"integrations.srv.noRestApi","This is a Jira Cloud site. Choose Jira Cloud and connect with your email and an API token.":"integrations.srv.isCloud","This is Jira Server or Data Center, not Cloud. Choose Jira Server / Data Center and use a personal access token.":"integrations.srv.isServer","Jira did not accept this email and API token, on the site or through api.atlassian.com. Check both, and that the token has not expired.":"integrations.srv.emailTokenRefused","Jira wants a CAPTCHA after too many failed sign-ins. Sign in to Jira once in your browser, then test the connection again.":"integrations.srv.captcha","Jira did not accept this personal access token: it answered as an anonymous visitor. Check that the token is right and has not expired or been revoked.":"integrations.srv.patAnonymous","That quick filter is not on this board any more. Refresh the board.":"integrations.srv.quickFilterGone","Jira writes are unavailable because this system cannot safely coordinate them.":"integrations.srv.writesUnavailable","Supply either one issueKey or 2–50 ordered issueKeys and a sprint or backlog target.":"integrations.srv.moveWhere","Supply unique, valid issue keys (2–50 for a batch).":"integrations.srv.moveKeys","Not a valid issue key or move target.":"integrations.srv.moveTarget","Use at most one other issue as the rank anchor.":"integrations.srv.moveAnchor","The issues and anchor must all belong to this board.":"integrations.srv.moveSameBoard","The issues and rank anchor must be top-level issues.":"integrations.srv.moveTopLevel","Only top-level non-epic issues with a known status can be moved.":"integrations.srv.moveEpicStatus","Done issues cannot be moved to the backlog because Jira hides them there. Change the status first.":"integrations.srv.moveDone","Every issue must be in the backlog or one active or future sprint.":"integrations.srv.moveSource","The source and target must be active or future sprints on this board.":"integrations.srv.moveSprints","An issue's source changed or is a closed sprint. Refresh the board.":"integrations.srv.moveSourceChanged","Could not determine the destination's last issue. Refresh and try again.":"integrations.srv.moveLastIssue","Could not verify the destination order. Refresh and try again.":"integrations.srv.moveOrder","The destination is too large to determine the last issue. Refresh and try again.":"integrations.srv.moveDestinationLarge","The rank anchor must be in the target group. Refresh the board.":"integrations.srv.moveAnchorGroup","This server runs Jira of an unknown version. Personal access tokens need Jira Server or Data Center 8.14 or newer, so the deck cannot connect to it.":"integrations.srv.serverOldUnknown","too many redirects":"forge.srv.redirects","answer too large":"forge.srv.answerLarge","answer cut off":"forge.srv.answerCut","unreadable JSON":"forge.srv.badJson","log too large to read the end of":"forge.srv.logLarge","image too large":"forge.srv.imageLarge","image cut off":"forge.srv.imageCut","that cursor is not a page of this list":"forge.srv.cursorPage","that cursor is not one of this list":"forge.srv.cursorList"},KSe=[[/^The deck could not verify (Jira|GitHub|GitLab)'s HTTPS certificate \((.+?)\)\. Check that the address is right and that the server's certificate is valid for it\.$/,"integrations.srv.tlsCert",["provider","code"]],[/^(Jira|GitHub|GitLab) did not answer in time\.$/,"integrations.srv.timeout",["provider"]],[/^The deck could not find (Jira|GitHub|GitLab)'s address\. Check the URL and your network\.$/,"integrations.srv.noAddress",["provider"]],[/^The deck could not reach (Jira|GitHub|GitLab) \((.+?)\)\. Check the URL, your network or VPN\.$/,"integrations.srv.cannotReachCode",["provider","code"]],[/^The deck could not reach (Jira|GitHub|GitLab)\. Check the URL, your network or VPN\.$/,"integrations.srv.cannotReach",["provider"]],[/^(Jira|GitHub|GitLab) did not accept these credentials\.$/,"integrations.srv.noCredentials",["provider"]],[/^(Jira|GitHub|GitLab) no longer accepts the saved token\. It may have expired or been revoked — reconnect with a new one\.$/,"integrations.srv.tokenGone",["provider"]],[/^(Jira|GitHub|GitLab) refused: the account or token is not allowed to read this\.$/,"integrations.srv.notAllowed",["provider"]],[/^(Jira|GitHub|GitLab) is limiting requests\. Try again in (\d+) s\.$/,"integrations.srv.limiting",["provider","n"]],[/^(Jira|GitHub|GitLab) has no such page or record, or this account cannot see it\.$/,"integrations.srv.noSuchPage",["provider"]],[/^(Jira|GitHub|GitLab) refused the request\.$/,"integrations.srv.refusedRequest",["provider"]],[/^(Jira|GitHub|GitLab) is not answering right now \((\d+)\)\. Try again shortly\.$/,"integrations.srv.notAnswering",["provider","status"]],[/^(Jira|GitHub|GitLab) answered (\d+)\.$/,"integrations.srv.answered",["provider","status"]],[/^The deck only sends this connection's token to (.+)\.$/,"integrations.srv.tokenOrigins",["origins"]],[/^(Jira|GitHub|GitLab) redirected to (\S+?), and the deck does not send the token there\. Check the address you connected\.$/,"integrations.srv.redirectedAway",["provider","origin"]],[/^(Jira|GitHub|GitLab) redirected too many times\.$/,"integrations.srv.redirectedMany",["provider"]],[/^(Jira|GitHub|GitLab) answered with something that is not JSON\. Check that the address is the \1 site itself\.$/,"integrations.srv.notJson",["provider"]],[/^The deck will not send a token to (\S+?)\.$/,"integrations.srv.noTokenTo",["origin"]],[/^This server runs Jira (.+?)\. Personal access tokens need Jira Server or Data Center 8\.14 or newer, so the deck cannot connect to it\.$/,"integrations.srv.serverOld",["version"]],[/^(Jira|GitHub|GitLab) is not available on this deck\.$/,"integrations.srv.notOnDeck",["provider"]],[/^(\S+?) did not answer in time$/,"forge.srv.timeout",["origin"]],[/^(\S+?): the certificate is not trusted \((.+?)\)$/,"forge.srv.cert",["origin","code"]],[/^(\S+?): no answer$/,"forge.srv.noAnswer",["origin"]],[/^(\S+?) is not a host this connection reads from$/,"forge.srv.notHost",["origin"]],[/^(\S+?) sent this read to (\S+?), not to this connection's address$/,"forge.srv.sentElsewhere",["origin","next"]],[/^(\S+?) answered (.+?), not the API$/,"forge.srv.notApi",["origin","type"]],[/^not an image \((.+?)\)$/,"forge.srv.notImage",["type"]]];function JSe(e,t=x){if(!e)return"";const n=e.replace(/\u2019/g,"'"),a=Object.hasOwn(GI,n)?GI[n]:void 0;if(a)return t(a);for(const[i,o,r]of KSe){const c=i.exec(n);if(!c)continue;const d={};return r.forEach((u,h)=>{d[u]=c[h+1]}),t(o,d)}return e}function YSe(e){if(!e||typeof e!="object")return;const t=e;if(!(typeof t.operationId!="string"||!/^[0-9a-f-]{36}$/.test(t.operationId)||typeof t.connectionId!="string"||!["comment","status","move"].includes(t.kind)||!["pending","uncertain","confirmed"].includes(t.state))&&!(t.kind==="move"?!Array.isArray(t.issueKeys)||!t.issueKeys.every(n=>typeof n=="string"):typeof t.issueKey!="string"))return t}class Za extends kn{constructor(n,a,i={}){super(a);Ba(this,"kind");Ba(this,"operation");Ba(this,"status");Ba(this,"retryAfter");Ba(this,"field");Ba(this,"detail");Ba(this,"refreshRequired");Ba(this,"outcomes");Ba(this,"moveOutcome");this.name="IntegrationFailure",this.kind=n,Object.assign(this,i)}}async function zW(e){try{const t=await e.json(),n=t==null?void 0:t.error,a=YSe(t==null?void 0:t.operation);if((t==null?void 0:t.code)==="jira_write_guard_conflict")return new Za("upstream",x("integrations.error.writeAwaiting"),{status:e.status,operation:a});if(n&&typeof n.kind=="string"&&typeof n.message=="string"){const i=Array.isArray(t.outcomes)?t.outcomes.slice(0,50).filter(c=>{if(!c||typeof c!="object")return!1;const d=c;return typeof d.issueKey=="string"&&/^[A-Z][A-Z0-9_]{0,40}-[1-9]\d{0,11}$/.test(d.issueKey)&&["moved","unchanged","unknown"].includes(String(d.membership))&&["ranked","unchanged","failed","unknown"].includes(String(d.rank))}).map(c=>({issueKey:c.issueKey,membership:c.membership,rank:c.rank})):[],o=t.outcome,r=o&&["moved","unchanged","unknown"].includes(o.membership)&&["ranked","unchanged","failed","unknown"].includes(o.rank)?{membership:o.membership,rank:o.rank}:void 0;return new Za(n.kind,JSe(n.message),{status:n.status,retryAfter:n.retryAfter,field:n.field,detail:n.detail,...t.refresh===!0?{refreshRequired:!0}:{},...i.length?{outcomes:i}:{},...r?{moveOutcome:r}:{},...a?{operation:a}:{}})}}catch{}return new Za(e.status===401?"auth":"upstream",x("integrations.error.deckAnswered",{status:e.status}))}async function uh(e,t={}){const{timeoutMs:n=3e4,...a}=t;return LW(a.signal,n,async i=>{let o;try{o=await fetch(e,{...a,signal:i,headers:a.body?{"Content-Type":"application/json",...a.headers??{}}:a.headers})}catch(r){throw i.aborted?r:new Za("network",x("integrations.error.unreachable"))}if(!o.ok)throw await zW(o);return o.json()})}async function LW(e,t,n){const a=new AbortController,i=window.setTimeout(()=>a.abort(),t),o=()=>a.abort(e==null?void 0:e.reason);e==null||e.addEventListener("abort",o,{once:!0}),e!=null&&e.aborted&&o();try{return a.signal.throwIfAborted(),await n(a.signal)}catch(r){throw e!=null&&e.aborted?e.reason??r:a.signal.aborted?new Za("network",x("integrations.error.timeout")):r}finally{window.clearTimeout(i),e==null||e.removeEventListener("abort",o)}}const OW=e=>`/api/integrations/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.id)}/`;function p1e(e){const t=OW(e);return(n,a)=>fetch(`${t}${n.replace(/^\/+/,"")}`,a)}function g1e(e){const t=OW(e);return n=>`${t}asset?url=${encodeURIComponent(n)}`}function m1e(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 f1e(e){const t=new URLSearchParams;for(const[a,i]of Object.entries(e))i===void 0||i===""||i===!1||t.set(a,i===!0?"1":String(i));const n=t.toString();return n?`?${n}`:""}async function b1e(e,t,{signal:n,timeoutMs:a=45e3}={}){return LW(n,a,async i=>{let o;try{o=await e(t,{signal:i,headers:{Accept:"application/json"}})}catch(r){throw i.aborted?r:new Za("network",x("integrations.error.unreachable"))}if(!o.ok)throw await zW(o);try{return await o.json()}catch(r){throw i.aborted?r:new Za("upstream",x("integrations.error.notJson"))}})}let qi={connections:null,providers:[],error:""};const Qc=new Set;let dg=null,Bd=null,dl=null,$I=0;const ZSe=5e3,XSe=3;function vm(e){qi={...qi,...e},Qc.forEach(t=>t(qi))}function Bf(){return Bd||(Bd=(async()=>{try{const e=await uh("/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 Za("upstream",x("integrations.error.notList"));vm({connections:t,providers:n,error:""})}catch(e){vm({error:Pi(e,x("integrations.error.readConnections"))}),qi.connections===null&&Qc.size>0&&dl===null&&$I<XSe&&(dl=window.setTimeout(()=>{dl=null,Bf()},ZSe*2**$I++))}finally{Bd=null}})(),Bd)}function QSe(e){return e.connections===null||e.providers.length>0||e.connections.length>0}function VI(){QSe(qi)&&Bf()}function e0(e){const t=qi.connections??[],n=t.findIndex(a=>a.id===e.id);vm({connections:n<0?[...t,e]:t.map(a=>a.id===e.id?e:a)})}function eNe(e){vm({connections:(qi.connections??[]).filter(t=>t.id!==e)})}function hh(){const[e,t]=m.useState(qi);return m.useEffect(()=>{Qc.add(t),t(qi);const n=()=>{document.visibilityState==="visible"&&VI()};return Qc.size===1&&(Bf(),dg=window.setInterval(VI,6e4),document.addEventListener("visibilitychange",n)),()=>{Qc.delete(t),Qc.size===0&&(dg!==null&&window.clearInterval(dg),dg=null,dl!==null&&window.clearTimeout(dl),dl=null,document.removeEventListener("visibilitychange",n))}},[]),e}function km(e,t){return(e.connections??[]).filter(n=>n.kind===t)}function ph(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 Ai(e,t){return ph(e).has(t)}function Tj(e,t){return Ai(e,t)&&km(e,t).length>0}function t0(e){return ph(e).size>0?"all":(e.connections??[]).length>0?"connections":"none"}async function tNe(e,t,n){const a=await uh("/api/integrations/connections",{method:"POST",body:JSON.stringify({kind:e,name:n,input:t}),timeoutMs:6e4});return e0(a.connection),a.connection}async function nNe(e,t){const n=await uh(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t),timeoutMs:6e4});return e0(n.connection),n}async function aNe(e){const t=await uh(`/api/integrations/connections/${encodeURIComponent(e)}/test`,{method:"POST",body:"{}",timeoutMs:6e4});return e0(t.connection),t.connection}async function sNe(e){await uh(`/api/integrations/connections/${encodeURIComponent(e)}`,{method:"DELETE"}),eNe(e)}function pr(e){try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function v1e(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 wm=null,ym=null;function KI(e){ym=null,wm=e}function iNe(e){wm=null,ym=e}function oNe(){const e=ym;return ym=null,e}function rNe(){const e=wm;return wm=null,e}const cNe={jira:"integrations.explore.cap.jira",github:"integrations.explore.cap.github",gitlab:"integrations.explore.cap.gitlab"},lNe={jira:"integrations.explore.access.jira",github:"integrations.explore.access.read",gitlab:"integrations.explore.access.read"};function dNe(){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 uNe({integrations:e,onClose:t,onOpen:n,onConnect:a,onManage:i}){const o=se(),r=Tt(t,{restoreFocusFallback:dNe}),c=Rt(t),d=QT().filter(g=>e.providers.some(f=>f.kind===g.kind)||km(e,g.kind).length>0),u=d.filter(g=>Tj(e,g.kind)).length,h=g=>{t(),g()};return _t.createPortal(s.jsx("div",{className:"modal-backdrop",role:"presentation",...c,children:s.jsxs("div",{ref:r,className:"modal explore-integrations",role:"dialog","aria-modal":"true","aria-labelledby":"explore-integrations-title","aria-describedby":"explore-integrations-description",children:[s.jsxs("div",{className:"modal-head explore-head",children:[s.jsx("h2",{id:"explore-integrations-title",children:o("integrations.explore.title")}),s.jsx("button",{type:"button",className:"glyph-btn","aria-label":o("integrations.explore.closeAria"),title:o("integrations.closeEsc"),onClick:t,children:"×"})]}),s.jsxs("div",{className:"explore-body",children:[s.jsx("p",{id:"explore-integrations-description",className:"explore-intro",children:o("integrations.explore.intro")}),e.error&&s.jsxs("p",{className:"explore-status",role:"alert",children:[e.error," ",o("integrations.explore.stale")]}),e.connections===null?s.jsx("p",{className:"explore-status",role:"status",children:e.error?o("integrations.explore.statusUnavailable"):o("integrations.explore.reading")}):d.length===0?s.jsx("p",{className:"explore-status",role:"status",children:o("integrations.explore.none")}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"explore-caption",children:[s.jsx("span",{children:o("integrations.explore.available")}),s.jsx("span",{children:o("integrations.explore.connectedCount",{n:u})})]}),s.jsx("ul",{className:"explore-providers",children:d.map(g=>{const f=Ai(e,g.kind),b=Tj(e,g.kind),k=km(e,g.kind)[0];return s.jsxs("li",{className:"explore-provider",children:[s.jsx("span",{className:"explore-glyph","aria-hidden":!0,children:s.jsx(g.Glyph,{})}),s.jsxs("div",{className:"explore-info",children:[s.jsx("h3",{children:g.label}),s.jsx("p",{children:o(cNe[g.kind])}),s.jsxs("span",{className:"explore-connection","data-connected":b||void 0,children:[o(f?b?"integrations.explore.connected":"integrations.explore.notConnected":"integrations.explore.unavailableOnDeck")," · ",o(lNe[g.kind])]})]}),s.jsx("div",{className:"explore-actions",children:b?s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"btn","aria-label":o("integrations.explore.openAria",{label:g.label}),onClick:()=>h(()=>n(g.kind)),children:[o("integrations.explore.open")," ",s.jsx(xl,{})]}),s.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":o("integrations.manageProvider",{label:g.label}),onClick:()=>h(()=>i(k==null?void 0:k.id)),children:o("integrations.manage")})]}):f?s.jsx("button",{type:"button",className:"btn primary","aria-label":o("integrations.form.connect",{provider:g.label}),onClick:()=>h(()=>a(g.kind)),children:o("integrations.form.connectBtn")}):k?s.jsx("button",{type:"button",className:"btn explore-text-action","aria-label":o("integrations.manageProvider",{label:g.label}),onClick:()=>h(()=>i(k.id)),children:o("integrations.manage")}):s.jsx("span",{className:"explore-unavailable",children:o("integrations.explore.notAvailable")})})]},g.kind)})})]})]}),s.jsxs("div",{className:"explore-footer",children:[s.jsx("span",{children:o("integrations.explore.footer")}),s.jsxs("button",{type:"button",className:"btn explore-text-action",onClick:()=>h(()=>i()),children:[o("integrations.explore.manageInSettings")," ",s.jsx(xl,{})]})]})]})}),document.body)}function hNe({widths:e,room:t,gap:n,more:a}){let i=0,o=0;for(let r=0;r<e.length;r++){i+=(r>0?n:0)+e[r];const c=r+1<e.length?n+a:0;if(i+c>t)break;o=r+1}return o}function PW(e,t=x){return e.tool?e.tool.name:e.kind==="asked"?t("board.queue.question"):t("board.queue.permission")}const pNe=20;function gNe(e,t=pNe){if(e.length<=t)return e;const n=Math.floor((t-1)*.4),a=t-1-n;return`${e.slice(0,a)}…${e.slice(e.length-n)}`}function mNe(e,t=x){const n=Math.floor(Math.max(0,e)/6e4);if(n<1)return t("board.queue.lessThanMinute");if(n<60)return t("board.queue.minutes",{count:n});const a=Math.floor(n/60),i=n%60;return i===0?t("board.queue.hours",{count:a}):t("board.queue.hoursMinutes",{h:t("board.queue.hours",{count:a}),m:t("board.queue.minutes",{count:i})})}function fNe(e,t,n,a=x){var r;const i=mNe(n,a),o=t.tool?"board.queue.entry.tool":t.kind==="asked"?"board.queue.entry.answer":"board.queue.entry.permission";return a(o,{label:e,wait:i,tool:((r=t.tool)==null?void 0:r.name)??""})}function bNe(e,t=x){const n=fl(e,t),a=aU(e,n,t);return a?`${n}
|
|
152
152
|
${a}`:n}const vNe=new Set(["idle","checking","current","downloading","ready","error"]);function JI(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.status!="string"||!vNe.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 kNe(e){return(e==null?void 0:e.status)==="ready"&&e.version?{version:e.version}:null}function MW(e=typeof navigator>"u"?"":navigator.userAgent){var t;return((t=/\bccdeck-desktop\/(\d[^\s]*)/.exec(e))==null?void 0:t[1])??null}const Hu=()=>x("shell.desktop.restartToUpdate"),IW=3e4;function DW(e=typeof navigator>"u"?"":navigator.userAgent){return/\bMac OS X\b|\bMacintosh\b/.test(e)?x("shell.desktop.menuMac"):x("shell.desktop.menuTray")}function wNe(e,t){const n=`v${e} → v${t}`;return{text:n,label:x("shell.desktop.chipLabel",{text:n}),title:x("shell.desktop.chipTitle",{to:t,action:Hu()})}}function FW(e,t=!1){return{text:t?x("shell.notes.restarting"):Hu(),label:t?void 0:x("shell.desktop.restartLabel",{action:Hu(),to:e}),title:x("shell.desktop.restartTitle",{to:e})}}function yNe(e){const t=e==null?void 0:e.reason;return t==="app_disconnected"||t==="update_not_ready"?t:"refused"}function UW(e,t,n=typeof navigator>"u"?"":navigator.userAgent){const a=DW(n),i=Hu(),o=x("shell.desktop.way",{action:i,menu:a});switch(e){case"app_disconnected":return x("shell.desktop.fail.app_disconnected",{way:o});case"update_not_ready":return x("shell.desktop.fail.update_not_ready",{version:t,action:i,menu:a});case"timeout":return x("shell.desktop.fail.timeout",{seconds:IW/1e3,way:o});case"refused":return x("shell.desktop.fail.refused",{way:o});case"unreachable":return x("shell.desktop.fail.unreachable",{way:o})}}function YI(e){const t=Math.max(0,Math.floor(e/1e3));return t<60?x("shell.ago.now"):t<3600?x("shell.ago.m",{n:Math.floor(t/60)}):t<86400?x("shell.ago.h",{n:Math.floor(t/3600)}):x("shell.ago.d",{n:Math.floor(t/86400)})}function xNe(e){const t=Math.max(0,Math.round(e/1e3));if(t<5)return x("shell.ago.now");if(t<60)return x("shell.ago.sec",{n:t});const n=Math.round(t/60);return n<60?x("shell.ago.min",{n}):x("shell.ago.hrSpelled",{n:Math.round(n/60)})}const CNe=()=>x("shell.chip.checksOff"),US=()=>x("shell.chip.notesClick");function SNe(e){if(e.checkDisabled)return x("shell.chip.titleOff",{off:CNe(),click:US()});if(e.checking)return x("shell.chip.titleBusy",{asking:x("shell.chip.asking"),click:US()});const t=e.latest?x("shell.chip.npmHas",{latest:e.latest}):e.latestPending?x("shell.chip.pendingTag",{pending:e.latestPending}):x("shell.chip.notReached"),n=e.checkFailedAgo?` · ${x("shell.chip.couldNotReach",{ago:e.checkFailedAgo})}`:e.checkedAgo?` · ${x("shell.chip.checked",{ago:e.checkedAgo})}`:"";return x("shell.chip.title",{state:t,age:n,click:US()})}function NNe(e){const t=x("shell.chip.label",{running:e.running});return e.checkDisabled?x("shell.chip.labelOff",{base:t}):e.checking?x("shell.chip.labelChecking",{base:t}):e.checkFailedAgo?x("shell.chip.labelFailed",{base:t,ago:e.checkFailedAgo}):x("shell.chip.labelPlain",{base:t})}function jNe(e){const t=e.kind==="restart"?x("shell.chip.noticeRestart",{to:e.to}):x("shell.chip.noticeUpgrade",{to:e.to}),n=e.open?x("shell.chip.noticeShow"):x("shell.chip.noticeShowBanner");return x("shell.chip.noticeLabel",{from:e.from,what:t,does:n})}function BW(e){return e?`${e.kind}:${e.to}`:""}function ANe(e,t){return e!=null&&t!==BW(e)}function TNe({readyAppUpdate:e,notice:t,noticeOpen:n,version:a,chipVersion:i,versionChecking:o,now:r,openReleaseNotes:c,showNotice:d,loadVersion:u,restartToUpdate:h,updateRestarting:g=!1}){return Aa(),s.jsx(s.Fragment,{children:e?(()=>{const f=wNe(MW()??i,e.version),b=h&&FW(e.version,g);return s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"v ready",onClick:c,"aria-haspopup":"dialog","aria-label":f.label,title:f.title,children:[f.text,s.jsx("span",{className:"v-dot","aria-hidden":!0})]}),b&&s.jsx("button",{type:"button",className:"v ready v-update",onClick:()=>h(e.version),"aria-busy":g||void 0,"aria-label":b.label,title:b.title,children:b.text})]})})():t?s.jsxs("button",{type:"button",className:"v stale",onClick:()=>{c(),d()},"aria-haspopup":"dialog","aria-label":jNe({...t,open:n}),title:t.kind==="restart"?x("shell.chip.runningRestart",{from:t.from,to:t.to}):x("shell.chip.runningUpgrade",{from:t.from,to:t.to}),children:["v",t.from,s.jsx("span",{className:"v-dot","aria-hidden":!0})]}):(()=>{const f={running:i,latest:a==null?void 0:a.latest,latestPending:a==null?void 0:a.latestPending,checkedAgo:a!=null&&a.checkedAt?YI(r-a.checkedAt):null,checkFailedAgo:a!=null&&a.checkFailedAt&&a.checkFailedAt>(a.checkedAt??0)?YI(r-a.checkFailedAt):null,checkDisabled:a==null?void 0:a.checkDisabled,checking:o};return s.jsxs("button",{type:"button",className:o?"v checking":"v",onClick:()=>{c(),u(!0)},"aria-busy":o||void 0,"aria-haspopup":"dialog","aria-label":NNe(f),title:SNe(f),children:["v",f.running]})})()})}function RNe({live:e,paused:t,pauseGate:n}){const a=se(),i=On();return s.jsx("span",{className:"status",children:(()=>{const o=Ine({connected:e,paused:t,held:n.size,dropped:n.dropped,singleKeys:i},a);return o.resting?null:s.jsx("span",{className:`pill ${o.tone}`,title:o.title,children:s.jsxs("span",{className:"pill-box",children:[s.jsx("span",{className:"pill-widest","aria-hidden":!0,children:o.widest}),s.jsx("span",{className:"pill-label",children:o.label})]})})})()})}function ENe(e,t,n){return`${e.label} — ${PW(e.waiting,n)} · ${_u(e.waiting.since,void 0,t)}`}function HW(e,t,n){const a=e.slice(0,6).map(i=>ENe(i,t,n));return e.length>6&&a.push(n("board.queue.andMore",{n:e.length-6})),a.join(`
|
|
153
153
|
`)}function qNe({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:a,named:i}){const o=se(),r=On(),c=ql("below"),d=e.slice(i),u=e.length;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"waiting-stat",onClick:()=>{t.current=e[0].id,n(e[0].id)},"aria-label":o("board.queue.waitingForYou",{count:u}),"aria-keyshortcuts":r?"W":void 0,...c.bind({label:o("board.queue.longest"),keys:r?"W":void 0,detail:d.length>0?HW(d,a,o):void 0}),children:[s.jsx("span",{className:"ap-pulse","aria-hidden":!0}),s.jsx("b",{children:u})," ",o("board.queue.waiting")]}),c.node]})}function ZI({w:e,now:t}){const n=se();return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"we-name",children:gNe(e.label)}),s.jsx("span",{className:"we-wait",children:_u(e.waiting.since,void 0,t)}),s.jsxs("span",{className:"we-what",children:["· ",PW(e.waiting,n)]})]})}const _Ne=12,zNe=2e3,LNe=4;function ONe({waitingSessions:e,waitingCursorRef:t,focusSession:n,now:a,onFit:i,onMore:o}){const r=se(),c=On(),d=ql("below"),u=m.useRef(null),h=m.useRef(null),[g,f]=m.useState(0),b=e.map(w=>w.id).join(`
|
|
154
154
|
`);m.useLayoutEffect(()=>{const w=u.current,j=h.current;if(!w||!j)return;const S=()=>{const T=Array.from(j.children),q=T.pop();f(hNe({widths:T.map(_=>_.getBoundingClientRect().width),room:w.clientWidth-_Ne,gap:LNe,more:(q==null?void 0:q.getBoundingClientRect().width)??0}))};if(S(),typeof ResizeObserver>"u")return;const A=new ResizeObserver(S);return A.observe(w),A.observe(j),()=>A.disconnect()},[b]);const k=e.slice(0,g),y=e.slice(g);m.useEffect(()=>{i(k.length)},[k.length,i]);const N=w=>{t.current=w,n(w)};return s.jsxs("div",{className:"wait-names",ref:u,children:[s.jsxs("ul",{className:"wait-list",children:[k.map(w=>s.jsx("li",{"data-fresh":a-w.waiting.since<zNe||void 0,children:s.jsx("button",{type:"button",className:"wait-entry",onClick:()=>N(w.id),"aria-label":fNe(w.label,w.waiting,a-w.waiting.since,r),...d.bind({label:w.label,detail:bNe(w.waiting,r)}),children:s.jsx(ZI,{w,now:a})})},w.id)),k.length>0&&y.length>0&&s.jsx("li",{children:s.jsx("button",{type:"button",className:"wait-more",onClick:o,"aria-label":r("board.queue.moreLabel",{n:y.length}),"aria-keyshortcuts":c?"L":void 0,...d.bind({label:r("board.queue.openList"),keys:c?"L":void 0,detail:HW(y,a,r)}),children:r("board.note.more",{n:y.length})})})]}),e.length>0&&s.jsxs("span",{className:"wait-ruler",ref:h,"aria-hidden":!0,children:[e.map(w=>s.jsx("span",{className:"wait-entry",children:s.jsx(ZI,{w,now:a})},w.id)),s.jsx("span",{className:"wait-more",children:r("board.note.more",{n:e.length})})]}),d.node]})}const PNe={on:"board.notify.means.on",blocked:"board.notify.means.blocked"};function MNe(e,t=x){return e==="on"?t("board.notify.said.on"):e==="blocked"?t("board.notify.said.blocked"):""}function INe({notifySaid:e}){const t=se();return s.jsx("span",{className:e==="on"?"notify-said":"notify-said notify-said-blocked","aria-hidden":!0,title:t(PNe[e]),children:t(e==="on"?"board.notify.on":"board.notify.blocked")})}function DNe({versionCheck:e,welcome:t,desktopUpdate:n,pause:a,announcements:i,notify:o,waitingSessions:r,waitingCursorRef:c,focusSession:d,live:u,now:h,incidents:g,queueNamed:f}){const{version:b,notice:k,noticeOpen:y,showNotice:N,versionChecking:w,loadVersion:j}=e,{chipVersion:S,openReleaseNotes:A}=t,{readyAppUpdate:T,desktopUpdateRestarting:q,desktopUpdateFailure:_,askDesktopUpdateRestart:I}=n,z=m.useRef(!1);m.useEffect(()=>{q||!z.current||(z.current=!1,_&&A())},[q,_,A]);const F=B=>{z.current=!0,I(B)},{paused:U,pauseGate:P}=a,L=se(),{blockedSaid:R,watchSaid:O,incidentSaid:D}=i,{notifySaid:$}=o;return s.jsxs("div",{className:"readout",children:[s.jsxs("div",{className:"brand",children:[s.jsx("img",{className:"logo logo-on-dark",src:Wle,width:19,height:16,alt:""}),s.jsx("img",{className:"logo logo-on-light",src:Gle,width:19,height:16,alt:""}),s.jsx("h1",{children:qt}),s.jsx(TNe,{readyAppUpdate:T,notice:k,noticeOpen:y,version:b,chipVersion:S,versionChecking:w,now:h,openReleaseNotes:A,showNotice:N,loadVersion:j,restartToUpdate:F,updateRestarting:q})]}),s.jsx(RNe,{live:u,paused:U,pauseGate:P}),s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:R}),s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:O}),s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:D}),s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:MNe($,L)}),s.jsx(tde,{incidents:g}),r.length>0&&s.jsx(qNe,{waitingSessions:r,waitingCursorRef:c,focusSession:d,now:h,named:f}),$&&s.jsx(INe,{notifySaid:$})]})}function FNe({selected:e,now:t,selectedIds:n,focusAgent:a,clearSelection:i}){const o=se(),r=On(),c=pa(e),d=Math.max(0,((e.endedAt??t)-e.startedAt)/1e3),u=e.state==="active"&&!e.synthetic?wA(c.total,d):null,h=n.size-1;return s.jsxs("button",{type:"button",className:"selected-ribbon",title:`${zn(o("board.ribbon.zoom",{label:e.label}),"Z",r)}${c.total>0?`
|
|
155
|
-
${o("board.ribbon.spent",{cost:Nt(c.total)})}${u?` · ${u}`:""}`:""}`,onClick:()=>{try{a(e.id)}catch{}},children:[s.jsx("span",{className:`state-pill state-${e.state}`,children:No(e.state,o)}),s.jsx("span",{className:"selected-label",children:e.label}),c.total>0&&s.jsxs("span",{className:"selected-cost",children:[Nt(c.total),u?s.jsxs("span",{className:"selected-rate",children:[" · ",u]}):null]}),h>0&&s.jsxs("span",{className:"selected-extra",children:["+",h]}),s.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:g=>{g.stopPropagation(),i()},children:"×"})]})}function UNe({catBarRef:e,catBarOccluded:t,presentCats:n,hiddenCats:a,toggleCat:i}){const o=se();return s.jsx("div",{ref:e,className:`cat-filter-bar${t?" occluded":""}`,role:"group","aria-label":o("board.cat.filter"),children:n.map(r=>{const c=a.has(r);return s.jsxs("button",{type:"button",className:`cat-filter${c?" off":""}`,onClick:()=>i(r),"aria-pressed":!c,title:o(c?"board.cat.show":"board.cat.hide",{cat:Hg(r,o)}),children:[s.jsx(KCe,{cat:r}),s.jsx("span",{className:"cat-name",children:Hg(r,o)})]},r)})})}const BNe=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(",");function HNe(e){var n,a;const t=e.target;!(t!=null&&t.closest)||t.closest(BNe)!==e.currentTarget||(e.preventDefault(),(a=(n=document.activeElement)==null?void 0:n.blur)==null||a.call(n))}function WNe({trashZoneRef:e,trashState:t,trashPhase:n,trashLabel:a}){const i=se(),o=On();return s.jsxs("div",{ref:e,className:`drag-trash-zone ${t}${n==="leaving"?" leaving":""}`,role:"status",children:[s.jsx("svg",{className:"drag-trash-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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"})}),s.jsxs("span",{className:"drag-trash-copy",children:[s.jsx("span",{className:"drag-trash-text",children:t==="over"?s.jsxs(s.Fragment,{children:[i("board.trash.release")," ",s.jsx("strong",{className:"drag-trash-name",children:a||i("board.trash.thisCard")})]}):i("board.trash.drop")}),s.jsx("span",{className:"drag-trash-hint",children:t==="over"?i("board.trash.bringsBack",{list:zn(i("board.detail.listUpper"),"L",o)}):i("board.trash.keepsRunning")})]})]})}function GNe({canvasRef:e,bubbling:t,dragging:n,trash:a,zoom:i,viewport:o,stateRef:r,peek:c,children:d}){const{trashDragging:u,trashState:h,trashPhase:g,trashZoneRef:f,trashLabel:b}=a,{lod:k,lodRef:y}=i,{markCanvasInput:N}=o,{peekAgent:w,peekLabel:j,peekRecap:S,peekBounds:A}=c;return s.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${t?" bubbling":""}${n?" dragging-any":""}${u&&h==="over"?" trash-hover":""}`,"data-lod":k,ref:e,onMouseDownCapture:HNe,onPointerDownCapture:N,onPointerUpCapture:N,onWheelCapture:N,onFocusCapture:T=>{const q=T.target;if(!VT(q)||y.current==null||y.current==="detail")return;const _=q.getAttribute("data-id");_&&r.current.agents.has(_)&&q.matches(":focus-visible")&&iW(_,q,"focus")},onBlurCapture:T=>{var _,I;const q=(I=(_=T.target).getAttribute)==null?void 0:I.call(_,"data-id");q&&qo(q)},children:[d,ko(g)&&s.jsx(WNe,{trashZoneRef:f,trashState:h,trashPhase:g,trashLabel:b}),s.jsx(wxe,{agentFor:w,recapFor:S,labelFor:j,bounds:A})]})}function $Ne({restarting:e,restartMode:t,live:n,paused:a}){const i=se();return s.jsxs("div",{className:"conn-banner",role:"alert",children:[s.jsx("span",{className:"conn-dot"}),e?t==="npx"?i("shell.banner.fetchingNpx"):i("shell.banner.restartingProduct",{product:qt}):(()=>{const o=Pne({connected:n,paused:a});return s.jsxs(s.Fragment,{children:[i("shell.banner.lost",{product:qt}),o&&s.jsx("span",{className:"conn-sub",children:o})]})})()]})}function VNe({oldName:e,version:t,dismissOldName:n}){const a=se();return s.jsxs("div",{className:"ver-banner",role:"status",children:[s.jsx("span",{className:"ver-dot"}),s.jsx("strong",{children:a("shell.banner.oldName",{old:e,product:qt})}),t!=null&&t.renameFix?s.jsx("span",{className:"ver-sub",children:t.renameFix}):null,s.jsx("button",{type:"button","aria-label":a("shell.dismiss"),className:"ver-close",onClick:n,children:"×"})]})}const WW=()=>x("shell.rating.thanks"),KNe=Array.from({length:11},(e,t)=>t);function JNe(e){return e===0?x("shell.rating.score0"):e===10?x("shell.rating.score10"):x("shell.rating.score",{n:e})}const YNe=6;function ZNe(e){const t=m.useRef(null);return m.useLayoutEffect(()=>{const n=t.current,a=n==null?void 0:n.closest(".app");if(!n||!a)return;const i=()=>a.style.setProperty("--rating-h",`${Math.ceil(n.getBoundingClientRect().height)}px`);i();const o=typeof ResizeObserver>"u"?null:new ResizeObserver(i);return o==null||o.observe(n),()=>{o==null||o.disconnect(),a.style.removeProperty("--rating-h")}},[e]),t}function XNe(){var e;(e=document.getElementById("canvas"))==null||e.focus()}function QNe({phase:e,score:t,onAnswer:n,onLater:a,onClose:i,onFeedback:o,onHold:r}){se();const c=ZNe(e),d=m.useRef(null),u=m.useRef(null),h=m.useRef(!1);m.useEffect(()=>{var f,b;e!=="thanks"||!h.current||(h.current=!1,ta(((f=document.activeElement)==null?void 0:f.tagName)??null)&&((b=d.current??u.current)==null||b.focus()))},[e]);const g=f=>{var b;(b=c.current)!=null&&b.contains(document.activeElement)&&XNe(),f()};return e==="thanks"?s.jsxs("div",{ref:c,className:"ver-banner note rating-banner",onFocus:()=>r(!0),onBlur:f=>{f.currentTarget.contains(f.relatedTarget)||r(!1)},children:[s.jsx("span",{className:"ver-dot"}),s.jsx("strong",{children:WW()}),t!==null&&t<=YNe?s.jsx("button",{ref:d,type:"button",className:"ver-act",onClick:o,children:x("shell.rating.better")}):null,s.jsx("button",{ref:u,type:"button","aria-label":x("shell.dismiss"),className:"ver-close",onClick:()=>g(i),children:"×"})]}):s.jsxs("div",{ref:c,className:"ver-banner note rating-banner",role:"group","aria-labelledby":"rating-question",children:[s.jsx("span",{className:"ver-dot"}),s.jsx("strong",{id:"rating-question",children:x("shell.rating.question")}),s.jsx("span",{className:"rating-scale",children:KNe.map(f=>s.jsx("button",{type:"button",className:"rating-pick","aria-label":JNe(f),onClick:b=>{h.current=b.detail===0||b.currentTarget.matches(":focus-visible"),n(f)},children:f},f))}),s.jsx("span",{className:"ver-sub rating-ends","aria-hidden":"true",children:x("shell.rating.ends")}),s.jsx("button",{type:"button",className:"ver-act",onClick:()=>g(a),children:x("shell.rating.later")})]})}const eje=3e4;function tje({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function nje({bundle:e,running:t,pending:n,lastTried:a}){return t?tje({bundle:e,running:t,lastTried:a})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function aje(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function sje({asked:e,reported:t}){return t?t!==e:!1}function GW(e){const t=e.thresholdMs??eje;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 ije(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 oje(e,t){return e?t==null?x("shell.banner.autoIdle"):x("shell.banner.autoIn",{time:ije(t)}):x("shell.banner.autoOff")}function XI(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function rje(e,t=!1){return e<=0&&t?{label:x("shell.banner.restartAnyway"),clause:x("shell.banner.clausePaused")}:e<=0?{label:x("shell.banner.restartNow"),clause:x("shell.banner.clauseIdle")}:{label:x("shell.banner.restartAnyway"),clause:x("shell.banner.clauseAgents",{count:e})}}function cje(e){const t=GW(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 Rj={get git_checkout(){return x("shell.banner.block.git_checkout")},get npx(){return x("shell.banner.block.npx")},get one_off(){return x("shell.banner.block.one_off")},get not_writable(){return x("shell.banner.block.not_writable")},get opted_out(){return x("shell.banner.block.opted_out")},get retired_name(){return x("shell.banner.block.retired_name")}};function lje({notice:e,version:t,dismissNotice:n,upgradeState:a,startUpgrade:i,copyCommand:o,cmdCopied:r,autoRestart:c,toggleAutoRestart:d,askRestart:u,restartCopy:h,restartFuseMs:g,restarting:f}){var k,y,N;const b=se();return s.jsxs("div",{className:`ver-banner ${e.kind}`,role:"status",children:[s.jsx("span",{className:`ver-dot${g==null?"":" armed"}`}),e.kind==="restart"?s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:b("shell.banner.installedStale",{to:e.to,from:e.from})}),t!=null&&t.canRestart?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"ver-act",onClick:()=>u(),...ua(f),title:b("shell.banner.restartTitle"),children:f?b("shell.banner.restarting"):h.label}),!f&&s.jsx("span",{className:"ver-sub",children:h.clause}),s.jsxs("label",{className:"ver-auto",children:[s.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":c,onClick:d,"aria-label":b("shell.banner.autoRestart"),title:b(c?"shell.banner.autoOnTitle":"shell.banner.autoOffTitle"),children:s.jsx("span",{className:"switch-knob"})}),s.jsx("span",{"aria-hidden":!0,children:oje(c,g)})]})]}):s.jsx("span",{className:"ver-sub",title:b("shell.banner.restartNeededTitle"),children:b("shell.banner.restartNeeded")})]}):s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:b("shell.banner.isOut",{product:qt,to:e.to,from:e.from})}),(t==null?void 0:t.upgradeMode)==="install"&&a!=="failed"&&s.jsx("button",{type:"button",className:"ver-act",onClick:i,...ua(a==="running",a==="done"),title:b("shell.banner.installTitle",{command:((k=t==null?void 0:t.upgrade)==null?void 0:k.command)??(t==null?void 0:t.command)??"npm i -g"}),children:b(a==="running"?"shell.banner.installing":a==="done"?"shell.banner.installed":"shell.update.now")}),(t==null?void 0:t.upgradeMode)==="npx"&&(t==null?void 0:t.canRestart)&&s.jsx("button",{type:"button",className:"ver-act",onClick:()=>u({upgrade:!0}),...ua(f),title:b("shell.banner.npxTitle",{command:(t==null?void 0:t.command)??""}),children:b(f?"shell.banner.fetching":a==="failed"?"shell.update.retry":"shell.update.andRestart")}),a==="failed"?s.jsx("span",{className:"ver-sub fail",title:((y=t==null?void 0:t.upgrade)==null?void 0:y.error)??"",children:b("shell.banner.failedLine",{what:(t==null?void 0:t.upgradeMode)==="npx"?b("shell.banner.updateFailed"):b("shell.banner.installFailed"),error:((N=t==null?void 0:t.upgrade)==null?void 0:N.error)??b("shell.banner.unknownError")})}):(t==null?void 0:t.upgradeMode)==="npx"?s.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?b("shell.banner.npxRerun"):Rj.npx}):t!=null&&t.upgradeBlocked?s.jsx("span",{className:"ver-sub",children:un(Rj,t.upgradeBlocked)??b("shell.banner.cannotInstall")}):null,s.jsxs("button",{type:"button",className:"ver-cmd",onClick:o,title:b("shell.banner.copyTitle"),children:[s.jsx("code",{children:t==null?void 0:t.command}),s.jsx("span",{className:"ver-cmd-hint",children:b(r?"shell.banner.copiedHint":"shell.banner.copyHint")})]})]}),s.jsx("button",{type:"button","aria-label":b("shell.dismiss"),className:"ver-close",onClick:n,children:"×"})]})}function dje({restart:e,versionCheck:t,upgrade:n,oldNameNotice:a,rating:i,onFeedback:o,everConnected:r,live:c,paused:d}){const u=se(),{autoRestart:h,toggleAutoRestart:g,restarting:f,restartMode:b,restartedTo:k,askRestart:y,restartCopy:N,restartFuseMs:w}=e,{version:j,notice:S,noticeOpen:A,dismissNotice:T}=t,{upgradeState:q,startUpgrade:_,copyCommand:I,cmdCopied:z}=n,{oldName:F,oldNameOpen:U,dismissOldName:P}=a,{ratingPhase:L,ratingScore:R,answerRating:O,rateLater:D,closeRating:$,holdThanks:B}=i,G=k?s.jsxs("div",{className:"ver-banner done",role:"status",children:[s.jsx("span",{className:"ver-dot"}),s.jsx("strong",{children:u("shell.banner.restartedTo",{version:k})}),s.jsx("span",{className:"ver-sub",children:u("shell.banner.replayed")})]}):r&&!c?s.jsx($Ne,{restarting:f,restartMode:b,live:c,paused:d}):A&&S?s.jsx(lje,{notice:S,version:j,dismissNotice:T,upgradeState:q,startUpgrade:_,copyCommand:I,cmdCopied:z,autoRestart:h,toggleAutoRestart:g,askRestart:y,restartCopy:N,restartFuseMs:w,restarting:f}):U&&F?s.jsx(VNe,{oldName:F,version:j,dismissOldName:P}):L!=="hidden"?s.jsx(QNe,{phase:L,score:R,onAnswer:O,onLater:D,onClose:$,onFeedback:o,onHold:B}):null;return s.jsxs(s.Fragment,{children:[G,s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:L==="thanks"?WW():""})]})}function uje(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function hje(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 pje(e,t){return e<=0?null:t("board.clear.goes.agents",{count:e})}function gje(e,t,n=x){const a=pje(e,n),i=(...d)=>[a,...d,n("board.clear.goes.view")].filter(u=>u!==null),o=n("board.clear.final"),r=n("board.clear.confirmAll");if(!t)return{goes:i(n("board.clear.goes.logUnknown")),stays:[],final:o,confirm:r};if(!t.path)return{goes:i(),stays:[],final:n("board.clear.final.noLog",{final:o}),confirm:r};if(!t.mine){const d=t.ownerPort===null?n("board.clear.owner.other"):n("board.clear.owner.port",{port:t.ownerPort}),u=t.decks>2?n("board.clear.owner.shared",{decks:t.decks}):"";return{goes:i(),stays:[n("board.clear.stays.log",{owner:d,shared:u}),n("board.clear.stays.replay")],final:null,confirm:n("board.clear.confirmCanvas")}}if(t.decks<=1)return{goes:i(n("board.clear.goes.logOwn")),stays:[],final:o,confirm:r};const c=t.decks-1;return{goes:i(n("board.clear.goes.logShared",{count:c})),stays:[n("board.clear.stays.shared",{count:c})],final:o,confirm:r}}function mje({agentCount:e,onConfirm:t,onCancel:n}){const a=se(),i=m.useRef(null),o=Tt(n,{focusRef:i,layer:Dee}),r=Rt(n),[c,d]=m.useState(null);m.useEffect(()=>{let b=!1;return fetch("/api/clear").then(k=>k.ok?k.json():null).then(k=>{b||d(hje(k))}).catch(()=>{}),()=>{b=!0}},[]);const{goes:u,stays:h,final:g,confirm:f}=gje(e,c,a);return s.jsx("div",{className:"modal-backdrop",...r,role:"presentation",children:s.jsxs("div",{ref:o,className:"modal clear-confirm",onClick:b=>b.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("span",{className:"status-dot err","aria-hidden":!0}),s.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:a("board.clear.title")})]}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":a("board.clear.cancelEsc"),title:a("board.clear.cancelEsc"),children:"×"})})]}),s.jsxs("section",{className:"modal-body",children:[s.jsxs("dl",{className:"cc-plan",children:[s.jsx("dt",{children:a("board.clear.goes")}),s.jsx("dd",{children:u.map(b=>s.jsx("span",{children:b},b))}),s.jsx("dt",{children:a("board.clear.stays")}),s.jsx("dd",{children:h.length>0?h.map(b=>s.jsx("span",{children:b},b)):s.jsx("span",{children:a("board.clear.nothing")})})]}),g&&s.jsx("p",{className:"cc-final",children:g}),s.jsxs("div",{className:"cc-actions",children:[s.jsx("button",{type:"button",ref:i,className:"btn",onClick:n,children:a("board.clear.cancel")}),s.jsx("button",{type:"button",className:"btn danger",onClick:t,children:f})]})]})]})})}function Ej(e,t,n){const a=`{${t}}`,i=e.indexOf(a);return i<0?e:s.jsxs(m.Fragment,{children:[e.slice(0,i),n,e.slice(i+a.length)]})}function fje({kind:e,onChange:t}){const n=se();return s.jsxs("fieldset",{className:"fb-kinds",children:[s.jsx("legend",{className:"vis-hidden",children:n("shell.feedback.kinds")}),bm.map(a=>s.jsxs("label",{className:"fb-kind",children:[s.jsx("input",{type:"radio",name:"feedback-kind",value:a.value,checked:e===a.value,onChange:()=>t(a.value),onKeyDown:i=>{XT(i.nativeEvent)&&i.preventDefault()}}),a.label]},a.value))]})}const $W="fb-details";function bje({open:e,onToggle:t}){return se(),s.jsxs("button",{type:"button",className:"fb-tool fb-more","aria-expanded":e,"aria-controls":$W,onClick:t,children:[fSe(),s.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:s.jsx("path",{d:"M2.5 3.75 5 6.25l2.5-2.5"})})]})}function vje({open:e,contact:t,onContact:n}){const a=se(),i=m.useId();return s.jsx("div",{id:$W,className:"fb-details","data-open":e||void 0,children:s.jsx("div",{className:"fb-details-clip",children:s.jsxs("div",{className:"fb-details-body",children:[s.jsxs("div",{className:"fb-field",children:[s.jsxs("label",{className:"fb-field-label",htmlFor:"fb-contact",children:[bSe(),s.jsx("span",{className:"fb-optional",children:a("shell.feedback.optional")})]}),s.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:t,maxLength:jW,autoComplete:"email",placeholder:vSe(),"aria-describedby":i,onChange:o=>n(o.target.value),onKeyDown:o=>{XT(o.nativeEvent)&&o.preventDefault()}}),s.jsx("p",{id:i,className:"fb-hint",children:kSe()})]}),s.jsx("div",{className:"fb-where",children:wSe().map(o=>s.jsx("p",{children:o},o))})]})})})}const Sr=3,kje=5*1024*1024,wje=12*1024*1024,qj=8192,yje=64*1024,xje=256*1024,Cje=.92,Sje=640,VW=.9,Nje=.85,jje=6,Aje=512*1024,xm={png:"image/png",jpeg:"image/jpeg"},Tje={png:"png",jpeg:"jpg"},Rje=[137,80,78,71,13,10,26,10],Eje=[255,216,255];function KW(e){const t=n=>e.length>=n.length&&n.every((a,i)=>e[i]===a);return t(Rje)?"png":t(Eje)?"jpeg":null}function qje(e){const t=KW(e);return t==="png"?_je(e):t==="jpeg"?Lje(e):null}function _je(e){const t=[73,72,68,82];if(e.length<24||!t.every((a,i)=>e[12+i]===a))return null;const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:n.getUint32(16),height:n.getUint32(20)}}function zje(e){return e>=192&&e<=207&&e!==196&&e!==200&&e!==204}function Lje(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 a=e[t]<<8|e[t+1];if(a<2)return null;if(zje(n))return t+7>e.length?null:{height:e[t+3]<<8|e[t+4],width:e[t+5]<<8|e[t+6]};t+=a}return null}function QI(e,t){return e.bytes>t||e.width>qj||e.height>qj}function Oje(e){return Math.min(kje,wje-yje-e)}function JW(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function Pje(e,t){const n=qj/Math.max(e.width,e.height),a=e.bytes>t?Math.sqrt(t/e.bytes)*VW:1;return JW(e,Math.min(1,n,a))}async function Mje(e,t,n){let a=Pje(e,t),i=e.format;for(let o=0;o<jje;o++){const r=await n(a,i,i==="jpeg"?Cje:void 0);if(!r)return null;if(r.size<=t)return{...a,blob:r,format:i};if(i==="png"){i="jpeg";continue}if(a=JW(a,Math.min(Nje,Math.sqrt(t/r.size)*VW)),Math.max(a.width,a.height)<Sje)return null}return null}async function Ije(e,t,n){const a=new Uint8Array(await e.slice(0,Aje).arrayBuffer()),i=KW(a);if(!i)return{ok:!1,problem:"type"};if(t<xje)return{ok:!1,problem:"no_room"};const o=e.type===xm[i]?e:new Blob([e],{type:xm[i]}),r=qje(a);if(r&&!QI({...r,bytes:e.size},t))return{ok:!0,blob:o,resized:null};const c=await n(e).catch(()=>null);if(!c)return{ok:!1,problem:"unreadable"};try{const d={width:c.width,height:c.height,bytes:e.size,format:i};if(!QI(d,t))return{ok:!0,blob:o,resized:null};const u=await Mje(d,t,c.encoder);return u?{ok:!0,blob:u.blob,resized:{width:u.width,height:u.height}}:{ok:!1,problem:"too_large"}}finally{c.release()}}function Dje(e){return({width:t,height:n},a,i)=>new Promise(o=>{const r=document.createElement("canvas");r.width=t,r.height=n;const c=r.getContext("2d");if(!c)return o(null);a==="jpeg"&&(c.fillStyle="white",c.fillRect(0,0,t,n)),c.imageSmoothingQuality="high",c.drawImage(e,0,0,t,n),r.toBlob(d=>{r.width=0,r.height=0,o(d)},xm[a],i)})}const Fje=async e=>{const t=await createImageBitmap(e);return{width:t.width,height:t.height,encoder:Dje(t),release:()=>t.close()}};function Uje(e){return e.includes("Files")}function Bje({files:e,hasText:t,intoTextField:n}){return e>0&&(!t||!n)}function Hje(e,t){const n=e.indexOf(t);return e[n+1]??e[n-1]??null}function Wje(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((a,i)=>{const o=a.type===xm.jpeg?"jpeg":"png";n.append("images",a,`image-${i+1}.${Tje[o]}`)}),{method:"POST",body:n}}const Gje=()=>x("shell.feedback.addShot"),eD=()=>x("shell.feedback.addHint"),$je=()=>x("shell.feedback.shotsNote"),tD=()=>x("shell.feedback.full"),Vje=()=>x("shell.feedback.refusedWhileSending");function Kje(e,t,n){const a=n?x("shell.feedback.resized",{width:n.width,height:n.height}):"";return x("shell.feedback.replaceLabel",{n:e+1,name:t,fit:a})}function Jje(e,t){const n=x("shell.feedback.shotsCount",{count:e,max:Sr});return t>0?x("shell.feedback.shotsResized",{of:n,resized:t}):n}function Yje(e){return x("shell.feedback.leftOut",{count:e})}function Zje(e){return`“${e.length>40?`${e.slice(0,30)}…${e.slice(-9)}`:e}”`}function Xje(e,t){const n=Zje(t);return e==="type"?x("shell.feedback.problem.type",{file:n}):e==="no_room"?x("shell.feedback.problem.noRoom",{file:n}):e==="unreadable"?x("shell.feedback.problem.unreadable",{file:n}):x("shell.feedback.problem.tooLarge",{file:n})}const YW="image/png,image/jpeg";function ZW({className:e="fb-glyph"}){return s.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:[s.jsx("rect",{x:"1.8",y:"2.4",width:"10.4",height:"9.2",rx:"1.6"}),s.jsx("circle",{cx:"5",cy:"5.6",r:"1"}),s.jsx("path",{d:"M2.4 10.4 5.5 7.6l2.1 1.8 1.5-1.3 2.5 2.2"})]})}function Qje({images:e,buttonRef:t}){se();const n=m.useRef(null),a=e.shots.length>=Sr;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:eD(),"aria-describedby":"fb-attach-hint",onClick:()=>{var i;return a?e.sayFull():(i=n.current)==null?void 0:i.click()},children:[s.jsx(ZW,{}),Gje()]}),s.jsx("span",{id:"fb-attach-hint",hidden:!0,children:eD()}),s.jsx("input",{ref:n,type:"file",accept:YW,multiple:!0,hidden:!0,onChange:i=>{e.add(Array.from(i.target.files??[])),i.target.value=""}})]})}function eAe({images:e,addRef:t}){const n=se(),a=m.useRef(new Map),i=m.useRef(null),o=m.useRef(null),r=m.useRef(null),[c,d]=m.useState(null),{shots:u}=e,h=Jje(u.length,u.filter(b=>b.resized).length);m.useLayoutEffect(()=>{var b;c!==null&&((b=c==="add"?t.current:a.current.get(c))==null||b.focus(),d(null))},[c,t]),m.useEffect(()=>{var b;e.problem&&((b=i.current)==null||b.scrollIntoView({block:"nearest"}))},[e.problem,e.problemId]);function g(b){d(Hje(u.map(k=>k.id),b)??"add"),e.remove(b)}function f(b){var k;r.current=b,(k=o.current)==null||k.click()}return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"vis-hidden",role:"status",children:e.announcement}),s.jsx("input",{ref:o,type:"file",accept:YW,hidden:!0,onChange:b=>{const k=r.current;k!==null&&e.replace(k,Array.from(b.target.files??[])),r.current=null,b.target.value=""}}),u.length>0&&s.jsxs("div",{className:"fb-shots",children:[s.jsxs("div",{className:"fb-shots-row",children:[s.jsx("ul",{className:"fb-shots-list",children:u.map((b,k)=>s.jsxs("li",{className:"fb-shot","data-fitting":b.blob?void 0:!0,children:[s.jsxs("button",{type:"button",className:"fb-shot-pick","aria-label":Kje(k,b.name,b.resized),onClick:()=>f(b.id),children:[s.jsx("img",{className:"fb-shot-img",src:b.url,alt:""}),b.blob?s.jsx("span",{className:"fb-shot-cue","aria-hidden":"true",children:n("shell.feedback.replace")}):s.jsx("span",{className:"fb-shot-busy","aria-hidden":"true",children:n("shell.feedback.resizing")})]}),s.jsx("button",{ref:y=>{y?a.current.set(b.id,y):a.current.delete(b.id)},type:"button",className:"glyph-btn fb-shot-remove","aria-label":n("shell.feedback.removeImage",{n:k+1}),title:n("shell.feedback.removeImage",{n:k+1}),onClick:()=>g(b.id),children:s.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:s.jsx("path",{d:"M2.5 2.5 7.5 7.5M7.5 2.5 2.5 7.5"})})})]},b.id))}),s.jsx("span",{className:"fb-shots-count",children:h})]}),s.jsx("p",{className:"fb-hint",children:$je()})]}),e.problem&&s.jsx("p",{ref:i,className:"fb-error",role:"alert",children:e.problem},e.problemId)]})}function tAe(e,t){return e.map((n,a)=>({id:t+a,name:n.name,url:URL.createObjectURL(n.blob),blob:n.blob,resized:n.resized}))}function nAe(e,t,n){return n?e.map(a=>a.id===t.id?t:a):[...e,t]}function aAe(e,t,n){return n?e.map(a=>a.id===t?n:a):e.filter(a=>a.id!==t)}function sAe(e){const[t,n]=m.useState(()=>tAe((e==null?void 0:e.ready)??[],1)),[a,i]=m.useState({problem:"",id:0}),o=m.useRef(0),r=m.useCallback(P=>{P&&o.current++,i(L=>P?{problem:P,id:L.id+1}:L.problem?{problem:"",id:L.id}:L)},[]),[c,d]=m.useState(""),u=m.useRef(t),h=m.useRef(null),g=m.useRef(t.length),f=m.useRef(!0),b=m.useRef(new Map),k=m.useRef([]),y=m.useRef(0),N=m.useCallback(P=>{u.current=P(u.current),n(u.current)},[]);m.useEffect(()=>(f.current=!0,()=>{f.current=!1;for(const P of u.current)URL.revokeObjectURL(P.url)}),[]);const w=m.useCallback(async(P,L)=>{const R=u.current.reduce((X,V)=>{var Q;return X+(V.id===(L==null?void 0:L.id)?0:((Q=V.blob)==null?void 0:Q.size)??0)},0),O=(L==null?void 0:L.id)??++g.current,D=URL.createObjectURL(P),$={id:O,name:P.name||"image",url:D,blob:null,resized:null},B=y.current;b.current.set(O,P);let G=!1;const Z=()=>{G||(G=!0,N(X=>nAe(X,$,L!==void 0)))},W=await Ije(P,Oje(R),async X=>(Z(),Fje(X))).catch(()=>({ok:!1,problem:"unreadable"})),H=u.current.some(X=>X.id===O);return!f.current||y.current!==B||!H&&(G||L)?(URL.revokeObjectURL(D),L&&URL.revokeObjectURL(L.url),f.current&&b.current.delete(O),""):(b.current.delete(O),W.ok?(Z(),L&&URL.revokeObjectURL(L.url),N(X=>X.map(V=>V.id===O?{...V,blob:W.blob,resized:W.resized}:V)),""):(URL.revokeObjectURL(D),G&&N(X=>aAe(X,O,L)),Xje(W.problem,P.name||"image")))},[N]),j=m.useCallback(async P=>{r("");const L=y.current,R=[];let O=0,D=0;for(const B of P){if(!f.current||y.current!==L)return;const G=k.current.indexOf(B);if(G!==-1&&k.current.splice(G,1),u.current.length>=Sr){O++;continue}const Z=u.current.length,W=await w(B);W&&R.push(W),u.current.length>Z&&D++}if(!f.current||y.current!==L)return;O>0&&R.push(D===0&&R.length===0?tD():Yje(O)),r(R.join(" "));const $=u.current.length;D>0&&d(x("shell.feedback.imagesAdded",{count:D,total:$,max:Sr}))},[w,r]),S=m.useCallback(async(P,L)=>{r("");const R=u.current.find($=>$.id===P);if(!R)return j([L]);const O=await w(L,R);if(!f.current)return;r(O);const D=u.current.findIndex($=>$.id===P);!O&&D!==-1&&d(x("shell.feedback.imageReplaced",{n:D+1,total:u.current.length,max:Sr}))},[j,w,r]),A=m.useCallback(P=>{const L=y.current;h.current=(h.current??Promise.resolve()).then(()=>y.current===L?P():void 0).catch(()=>{})},[]),T=m.useCallback(P=>{P.length!==0&&(k.current.push(...P),A(()=>j(P)))},[j,A]);m.useEffect(()=>{e&&e.waiting.length>0&&T(e.waiting)},[]);const q=m.useCallback((P,L)=>{const R=L[0];R&&A(()=>S(P,R))},[A,S]),_=m.useCallback(P=>{const L=u.current.find(R=>R.id===P);L&&(URL.revokeObjectURL(L.url),b.current.delete(P),N(R=>R.filter(O=>O.id!==P)),r(""),d(x("shell.feedback.imageRemoved",{count:u.current.length,max:Sr})))},[N,r]),I=m.useCallback(()=>r(tD()),[r]),z=m.useCallback(async()=>{const P=o.current;return await h.current,o.current!==P?null:u.current.flatMap(L=>L.blob?[L.blob]:[])},[]),F=m.useCallback(()=>({ready:u.current.flatMap(P=>P.blob&&!b.current.has(P.id)?[{name:P.name,blob:P.blob,resized:P.resized}]:[]),waiting:[...b.current.values(),...k.current]}),[]),U=m.useCallback(()=>{y.current++;for(const P of u.current)URL.revokeObjectURL(P.url);b.current.clear(),k.current=[],N(()=>[]),r("")},[N,r]);return{shots:t,problem:a.problem,problemId:a.id,announcement:c,add:T,replace:q,remove:_,sayFull:I,ready:z,kept:F,clear:U}}function iAe(){const[e,t]=m.useState(null);return m.useEffect(()=>{let n=!0;return fetch("/api/feedback").then(a=>a.ok?a.json():null).then(a=>{n&&t(dSe(a))}).catch(()=>{}),()=>{n=!1}},[]),e}function oAe(e){const[t,n]=m.useState({state:"idle"}),a=m.useRef(!1),i=m.useRef(null);m.useEffect(()=>()=>{var c;return(c=i.current)==null?void 0:c.abort()},[]);async function o(c){if(!Qn(a.current))return;a.current=!0;const{signal:d}=i.current=new AbortController;n({state:"sending"});try{const u=await e.ready();if(d.aborted)return;if(!u){n({state:"failed",message:Vje()});return}const h=await fetch("/api/feedback",{...Wje(lSe(c),u),signal:d}),g=await h.json().catch(()=>null);n(h.ok&&(g!=null&&g.ok)?{state:"sent"}:{state:"failed",message:FI(h.status,g==null?void 0:g.reason,g==null?void 0:g.errors)})}catch{d.aborted||n({state:"failed",message:FI(0,null)})}finally{a.current=!1}}const r=()=>n(c=>c.state==="failed"?{state:"idle"}:c);return{outcome:t,sending:t.state==="sending",send:o,clearFailure:r}}function rAe(e,t){const[n,a]=m.useState(!1),i=m.useRef(t);return i.current=t,m.useEffect(()=>{if(!e)return;const o=window.setTimeout(()=>a(!0),UI),r=window.setTimeout(()=>i.current(),UI+jSe);return()=>{window.clearTimeout(o),window.clearTimeout(r)}},[e]),n}const BS="agent-dag.feedbackDrafts",nD=4;function cAe({initialKind:e,initialBody:t}){return{kind:e??"bug",body:t??""}}function lAe(e){return JSON.stringify([e.kind,e.body])}function dAe(e){return e.ready.length+e.waiting.length}function XW(e,t){return e.body.trim()!==t.body.trim()||e.contact.trim()!==""||e.images>0}function uAe(e){return x("shell.feedback.lost",{count:e})}const hAe=()=>x("shell.feedback.discard"),pAe=()=>x("shell.feedback.discardConfirm"),gAe=()=>x("shell.feedback.discardTitle"),aD=()=>x("shell.feedback.discardArmed"),mAe={ready:[],waiting:[]};function fAe(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:a,contact:i,images:o}=t;return!bm.some(r=>r.value===n)||typeof a!="string"||a.length>NW||typeof i!="string"||i.length>jW||typeof o!="number"||!Number.isInteger(o)||o<0||o>Sr?null:[e[0],{kind:n,body:a,contact:i,images:o}]}function bAe(e){let t=null;function n(){var o;if(t)return t;t=new Map;try{const r=(o=e())==null?void 0:o.getItem(BS),c=r?JSON.parse(r):[];if(Array.isArray(c))for(const d of c.slice(-nD)){const u=fAe(d);u&&t.set(u[0],{...u[1],images:null,imageCount:u[1].images})}}catch{}return t}function a(){try{const o=e();if(!o)return;const r=[...n()].map(([c,d])=>[c,{kind:d.kind,body:d.body,contact:d.contact,images:d.imageCount}]);r.length===0?o.removeItem(BS):o.setItem(BS,JSON.stringify(r))}catch{}}function i(o){n().delete(o)&&a()}return{read(o){const r=n().get(o);return r?{kind:r.kind,body:r.body,contact:r.contact,images:r.images??mAe,imagesLost:r.images?0:r.imageCount}:null},keep(o,r,c){const d=dAe(r.images);if(!XW({body:r.body,contact:r.contact,images:d},c)){i(o);return}const u=n();u.delete(o),u.set(o,{kind:r.kind,body:r.body,contact:r.contact,images:r.images,imageCount:d});for(const h of u.keys()){if(u.size<=nD)break;u.delete(h)}a()},forget:i}}function vAe(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}const _j=bAe(vAe),kAe=4e3;function wAe(e,t,n,a,i){const o=m.useRef(null);o.current={key:e,seed:t,words:n,images:a,sent:i};const r=m.useCallback(()=>{const c=o.current;!c||c.sent||_j.keep(c.key,{...c.words,images:c.images.kept()},c.seed)},[]);m.useEffect(r,[r,n.kind,n.body,n.contact,a.shots]),m.useEffect(()=>r,[r]),m.useEffect(()=>{i&&_j.forget(e)},[i,e])}const sD="draft";function yAe(e){const[t,n]=m.useState(!1),a=m.useRef(0);m.useEffect(()=>{if(!t)return;const o=window.setTimeout(()=>n(!1),kAe);return()=>window.clearTimeout(o)},[t]);function i(){const o=Date.now(),r=Fr({armedFor:t?sD:null,target:sD,armedAt:a.current,now:o,gapMs:Dr});if(r==="arm"){n(!0),a.current=o;return}r!=="ignore"&&(n(!1),e())}return{armed:t,press:i}}function QW({onClose:e,initialKind:t,initialBody:n}){const a=se(),i=m.useRef(null),o=m.useRef(null),r=m.useRef(null),c=m.useRef(null),d=m.useRef(null),u=m.useRef(null),h=m.useRef(null),g=m.useRef(null),f=m.useRef(0),b=Tt(e,{focusRef:i}),k=Rt(e),y=cAe({initialKind:t,initialBody:n}),N=lAe(y),[w]=m.useState(()=>_j.read(N)),[j,S]=m.useState((w==null?void 0:w.kind)??y.kind),[A,T]=m.useState((w==null?void 0:w.body)??y.body),[q,_]=m.useState((w==null?void 0:w.contact)??""),[I,z]=m.useState((w==null?void 0:w.imagesLost)??0),[F,U]=m.useState(!1),[P,L]=m.useState(!1),[R,O]=m.useState(!1),D=sAe(w==null?void 0:w.images),$=pSe(iAe()),{outcome:B,sending:G,send:Z,clearFailure:W}=oAe(D),H=B.state==="sent",X=rAe(H,e);wAe(N,y,{kind:j,body:A,contact:q},D,H);const V=XW({body:A,contact:q,images:D.shots.length},y),Q=yAe(()=>{var Re;S(y.kind),T(y.body),_(""),z(0),L(!1),D.clear(),W(),(Re=i.current)==null||Re.focus()}),Y=SW(j),K=P&&!II(A),ee=I>0&&D.shots.length===0,te=[K&&"fb-body-error",ee&&"fb-images-lost"].filter(Boolean).join(" ")||void 0,[ce,ge]=xSe(Ao());m.useEffect(()=>{var Pe,Ae;const Re=c.current;if(!Re)return;const Je=Re.contains(document.activeElement)||ta(((Pe=document.activeElement)==null?void 0:Pe.tagName)??null);Re.inert=H,H&&Je&&((Ae=o.current)==null||Ae.focus())},[H]),m.useEffect(()=>{var xe,ze;const Re=d.current;if(!Re)return;const Je=h.current;if(G){const Ce=document.activeElement,Me=Ce!=null&&(Re.contains(Ce)||Ce===Je);g.current=Me?Ce:null,Re.inert=!0,Je&&(Je.inert=!0),g.current&&((xe=u.current)==null||xe.focus());return}Re.inert=!1,Je&&(Je.inert=!1);const Pe=g.current;g.current=null;const Ae=document.activeElement===u.current||ta(((ze=document.activeElement)==null?void 0:ze.tagName)??null);!H&&Pe&&Ae&&Pe.focus()},[G,H]);function ve(Re){var Je;if(Re.preventDefault(),!II(A)){L(!0),(Je=i.current)==null||Je.focus();return}Z({kind:j,body:A,contact:q})}const pe=!H&&!G,ae=Re=>Uje(Array.from(Re.dataTransfer.types));function le(Re){!ae(Re)||!pe||(Re.preventDefault(),f.current++,O(!0))}function Se(Re){ae(Re)&&(Re.preventDefault(),Re.dataTransfer.dropEffect=pe?"copy":"none")}function ke(Re){ae(Re)&&(f.current=Math.max(0,f.current-1),f.current===0&&O(!1))}function ye(Re){ae(Re)&&(Re.preventDefault(),f.current=0,O(!1),pe&&D.add(Array.from(Re.dataTransfer.files)))}function We(Re){Re.target!==Re.currentTarget||!ae(Re)||(Re.preventDefault(),Re.dataTransfer.dropEffect="none")}function He(Re){ae(Re)&&Re.preventDefault()}function Ke(Re){if(!pe)return;const Je=Array.from(Re.clipboardData.files),Pe=Re.target,Ae=Pe instanceof HTMLTextAreaElement||Pe instanceof HTMLInputElement,xe=Array.from(Re.clipboardData.types).includes("text/plain");Bje({files:Je.length,hasText:xe,intoTextField:Ae})&&(Re.preventDefault(),D.add(Je))}return s.jsx("div",{className:"modal-backdrop",...k,role:"presentation",onDragOver:We,onDrop:He,"data-leaving":X||void 0,children:s.jsxs("div",{ref:b,className:"modal feedback-dialog",onClick:Re=>Re.stopPropagation(),onDragEnter:le,onDragOver:Se,onDragLeave:ke,onDrop:ye,onPaste:Ke,role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"feedback-title",className:"modal-tool-name",children:a("shell.feedback.title")})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{ref:o,type:"button",className:"glyph-btn",onClick:e,"aria-label":a("shell.closeEsc"),title:a("shell.closeEsc"),children:"×"})})]}),s.jsx("p",{className:"vis-hidden",role:"status",children:Q.armed?aD():NSe(B.state)}),s.jsxs("div",{className:"fb-stage",children:[s.jsxs("form",{ref:c,className:"fb-form",onSubmit:ve,onKeyDown:Re=>{ySe(Re.nativeEvent)&&(Re.preventDefault(),Re.currentTarget.requestSubmit())},noValidate:!0,children:[s.jsxs("section",{ref:d,className:"modal-body fb-body",children:[s.jsx(fje,{kind:j,onChange:S}),s.jsxs("div",{className:"fb-compose",children:[s.jsx("label",{className:"fb-label",htmlFor:"fb-body",children:Y.question}),s.jsx("textarea",{ref:i,id:"fb-body",className:"ap-manage-input fb-message",value:A,maxLength:NW,rows:5,placeholder:Y.placeholder,onChange:Re=>T(Re.target.value),"aria-invalid":K||void 0,"aria-describedby":te,required:!0}),K&&s.jsx("p",{id:"fb-body-error",className:"fb-error",children:iSe()}),s.jsx(eAe,{images:D,addRef:r}),ee&&s.jsx("p",{id:"fb-images-lost",className:"fb-hint",children:uAe(I)}),s.jsxs("div",{className:"fb-tools",children:[s.jsx(Qje,{images:D,buttonRef:r}),s.jsx(bje,{open:F,onToggle:()=>U(Re=>!Re)})]}),s.jsx(vje,{open:F,contact:q,onContact:_})]}),s.jsx("p",{className:"fb-facts",children:$?Ej(gSe(),"facts",s.jsx("span",{className:"fb-facts-value",children:$})):mSe()}),B.state==="failed"&&s.jsx("p",{className:"fb-error",role:"alert",children:B.message})]}),s.jsxs("div",{className:"fb-foot",children:[V&&s.jsx("button",{ref:h,type:"button",className:`btn danger fb-discard${Q.armed?" armed":""}`,onKeyDown:Re=>{Re.repeat&&Re.preventDefault()},onClick:Q.press,title:Q.armed?aD():gAe(),children:Q.armed?pAe():hAe()}),s.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[s.jsx("kbd",{"data-symbol":CSe(ce)||void 0,children:ce}),s.jsx("kbd",{children:ge})," ",a("shell.feedback.toSend")]}),s.jsx("button",{type:"button",className:"btn",onClick:e,children:a("shell.cancel")}),s.jsx("button",{ref:u,type:"submit",className:"btn primary fb-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...ua(G),children:s.jsxs("span",{className:"fb-send-label",children:[s.jsx("span",{className:"fb-send-idle",children:a("shell.feedback.send")}),s.jsx("span",{className:"fb-send-busy",children:a("shell.feedback.sending")})]})})]})]}),H&&s.jsxs("div",{className:"fb-done",children:[s.jsx(Bu,{}),s.jsx("p",{className:"fb-done-line",children:AW()})]})]}),s.jsx("div",{className:"fb-drop","aria-hidden":"true","data-active":R||void 0,children:s.jsxs("div",{className:"fb-drop-frame",children:[s.jsx(ZW,{className:"fb-drop-glyph"}),s.jsx("p",{className:"fb-drop-title",children:a("shell.feedback.dropTitle")}),s.jsx("p",{className:"fb-drop-note",children:a("shell.feedback.dropNote")})]})})]})})}const HS=[{id:"canvas",get title(){return x("settings.key.group.canvas")},rows:[{cap:"Space",get action(){return x("settings.key.pause")},binds:[" "]},{cap:"J",get action(){return x("settings.key.next")},binds:["j","J"]},{cap:"K",get action(){return x("settings.key.prev")},binds:["k","K"]},{cap:"W",get action(){return x("settings.key.waiting")},binds:["w","W"]},{cap:"F",get action(){return x("settings.key.fit")},binds:["f","F"]},{cap:"Z",get action(){return x("settings.key.zoom")},binds:["z","Z"]},{cap:"Delete",get action(){return x("settings.key.delete")},binds:["Delete"]},{cap:"R",get action(){return x("settings.key.rearrange")},binds:["r","R"]},{cap:"Ctrl + Z",macCap:"⌘ Z",get action(){return x("settings.key.undo")},binds:["z","Z"],chord:!0},{cap:"C",get action(){return x("settings.key.clear")},binds:["c","C"]}]},{id:"panels-and-dialogs",get title(){return x("settings.key.group.panels")},rows:[{cap:"Ctrl + K",macCap:"⌘ K",get action(){return x("settings.key.quick")},binds:["k","K"],chord:!0},{cap:"U",get action(){return x("settings.key.usage")},binds:["u","U"]},{cap:"L",get action(){return x("settings.key.sessions")},binds:["l","L"]},{cap:"D",get action(){return x("settings.key.detail")},binds:["d","D"]},{cap:"H",get action(){return x("settings.key.history")},binds:["h","H"]},{cap:"A",get action(){return x("settings.key.accounts")},binds:["a","A"]},{cap:"S",get action(){return x("settings.key.machine")},binds:["s","S"]},{cap:"B",get action(){return x("settings.key.bw")},binds:["b","B"]},{cap:"I",get action(){return x("settings.key.jira")},binds:["i","I"],integration:"jira"},{cap:"?",get action(){return x("settings.key.sheet")},binds:["?"]}]},{id:"settings",get title(){return x("settings.key.group.settings")},rows:[{cap:"Ctrl + ,",macCap:"⌘ ,",get action(){return x("settings.key.all")},binds:[","],chord:!0},{cap:"V",get action(){return x("settings.key.sound")},binds:["v","V"]},{cap:"M",get action(){return x("settings.key.mute")},binds:["m","M"]},{cap:"T",get action(){return x("settings.key.theme")},binds:["t","T"]}]},{id:"focus-and-selection",get title(){return x("settings.key.group.focus")},rows:[{cap:"Tab",get action(){return x("settings.key.tab")},binds:[]},{cap:"Enter",get action(){return x("settings.key.enter")},binds:["Enter"]},{cap:"Shift + Enter",get action(){return x("settings.key.shiftEnter")},binds:["Enter"]},{cap:"Esc",get action(){return x("settings.key.esc")},binds:["Escape"]}]},{id:"mouse",get title(){return x("settings.key.group.mouse")},rows:[{get cap(){return x("settings.key.cap.drag")},get action(){return x("settings.key.drag")},binds:[]},{get cap(){return x("settings.key.cap.shiftClick")},get action(){return x("settings.key.shiftClick")},binds:[]},{get cap(){return x("settings.key.cap.click")},get action(){return x("settings.key.click")},binds:[]},{get cap(){return x("settings.key.cap.doubleClick")},get action(){return x("settings.key.doubleClick")},binds:[]},{get cap(){return x("settings.key.cap.hover")},get action(){return x("settings.key.hover")},binds:[]}]}],xAe=/ ?\([A-Z?]\)/g;function e5(e,t=()=>!0){const n=a=>a.integration===void 0||t(a.integration);return e&&HS.every(a=>a.rows.every(n))?HS:HS.map(a=>({...a,rows:a.rows.filter(n).filter(i=>e||i.chord||!i.binds.some(OU)).map(i=>e?i:{...i,action:i.action.replace(xAe,"")})})).filter(a=>a.rows.length>0)}function CAe(e,t){return e.split(/\{(\w+)\}/g).map((a,i)=>i%2===1&&a in t?s.jsx(m.Fragment,{children:t[a]},i):a===""?null:s.jsx(m.Fragment,{children:i%2===1?`{${a}}`:a},i))}function SAe({onClose:e,onTour:t,onSettings:n}){const a=se(),i=Tt(e),o=Rt(e),r=Po(Ao()),c=On(),d=hh(),u=e5(c,h=>Ai(d,h));return s.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:s.jsxs("div",{ref:i,className:"modal key-help",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title","aria-describedby":c?void 0:"key-help-off",children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:a("settings.key.title")})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":a("settings.key.close"),title:a("settings.key.close"),children:"×"})})]}),s.jsxs("section",{className:"modal-body",children:[!c&&s.jsxs("div",{className:"kh-off",children:[s.jsx("p",{className:"kh-off-text",id:"key-help-off",children:CAe(a("settings.key.offText",{title:"{title}",place:"{place}"}),{title:s.jsx("strong",{children:a("settings.key.offTitle")}),place:s.jsx("span",{className:"kh-place",children:a("settings.key.place")})})}),n&&s.jsx("button",{type:"button",className:"btn",onClick:n,children:a("settings.key.openSettings")})]}),t&&s.jsxs("div",{className:"guide-door",children:[s.jsx("span",{children:a("settings.key.tourText")}),s.jsx("button",{type:"button",className:"btn",onClick:t,children:a("settings.key.tour")})]}),s.jsx("div",{className:"shortcuts",children:u.map(h=>s.jsxs(m.Fragment,{children:[s.jsx("h3",{className:"kh-group",children:h.title}),h.rows.map(g=>s.jsxs("div",{className:"sc",children:[s.jsx("kbd",{children:r&&g.macCap?g.macCap:g.cap}),s.jsx("span",{children:g.action})]},`${h.id}:${g.cap}:${g.action}`))]},h.id))}),c&&s.jsxs("p",{className:"kh-foot",children:[a("settings.key.note")," ",a("settings.key.switchNote",{place:a("settings.key.place")})]})]})]})})}function NAe(e,t){return`${e}#${t}`}function jAe(e,{lan:t,now:n,closed:a}){if(t===void 0)return[];const i=[];for(const o of e??[]){const r=o.reauth;if(!r||r.dismissed||o.origin!=="ccdeck_signin")continue;const c=NAe(r.key,r.since);if(a.has(c)||ype(r.key,o.email,t,n))continue;const d=o.email??"";i.push({id:c,key:r.key,since:r.since,num:o.num,email:d,name:d||o.alias||x("accounts.accountN",{n:o.num}),alias:d&&o.alias?o.alias:null})}return i}function AAe(e,t){const n=String((t==null?void 0:t.email)??"").trim().toLowerCase();return n?e.filter(a=>a.email.toLowerCase()===n&&((t==null?void 0:t.num)==null||String(a.num)===String(t.num))).map(a=>a.id):[]}function t5({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function TAe(e,t=x){return t("accounts.reauth.title",{count:e})}function RAe(e,t=x){return t("accounts.reauth.lead",{count:e})}const EAe=(e=x)=>e("accounts.reauth.expired"),qAe=(e=x)=>e("accounts.reauth.singleNote"),_Ae=(e=x)=>e("accounts.reauth.laterTip");function zAe(e,t){const n=(e??[]).filter(i=>i&&typeof i.fp=="string"&&!t.has(i.fp));if(!n.length)return{request:null,waiting:0};const a=[...n].sort((i,o)=>(i.at??0)-(o.at??0));return{request:a[0],waiting:a.length-1}}function LAe({request:e,waiting:t,busy:n,now:a,onAccept:i,onDecline:o,onLater:r}){const c=se(),d=m.useRef(null),u=Tt(r,{focusRef:d}),h=Rt(r),g=jo(n,"accept"),f=jo(n,"dismiss");return s.jsx("div",{className:"modal-backdrop",...h,role:"presentation",children:s.jsxs("div",{ref:u,className:"modal lan-ask",onClick:b=>b.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title","aria-describedby":"lan-ask-who",children:[s.jsxs("header",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("i",{className:"ap-pulse","aria-hidden":!0}),s.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:c("lan.ask.title")})]}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:r,"aria-label":c("lan.ask.later"),title:c("lan.ask.later"),children:"×"})})]}),s.jsxs("section",{className:"modal-body",children:[s.jsx("p",{id:"lan-ask-who",className:"lan-ask-who",children:s.jsx(Br,{text:c("lan.ask.who",{when:bT(e.at,a)}),parts:{name:s.jsx("strong",{className:"lan-ask-name",children:e.name}),addr:s.jsx("code",{className:"ap-lan-code",children:e.addr})}})}),s.jsx("p",{className:"modal-note",children:c("lan.ask.note")}),s.jsx("p",{className:"lan-ask-fp",children:s.jsx(Br,{text:c("lan.ask.fp"),parts:{fp:s.jsx("code",{className:"ap-lan-code",children:e.fp})}})}),t>0&&s.jsx("p",{className:"lan-ask-more",children:c("lan.ask.more",{count:t})}),s.jsxs("div",{className:"lan-ask-acts",children:[s.jsx("button",{type:"button",ref:d,className:"btn",disabled:f.disabled,"aria-busy":f.busy,onClick:o,title:c("lan.ask.declineTitle"),children:c(n==="dismiss"?"lan.ask.declining":"lan.ask.decline")}),s.jsx("button",{type:"button",className:"btn primary",disabled:g.disabled,"aria-busy":g.busy,onClick:i,title:c("lan.ask.acceptTitle"),children:c(n==="accept"?"lan.ask.accepting":"lan.ask.accept")})]})]})]})})}function OAe(e){const t=m.useRef(!1),n=PAe(e),a=t5({rows:n?1:0,ours:t.current,dialogs:jn.dialogDepth()});return t.current=a,a?n:null}function PAe({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:a,deferLanPair:i}){const{request:o,waiting:r}=zAe(e,t.current);return o?s.jsx(LAe,{request:o,waiting:r,busy:n,now:Date.now(),onAccept:()=>void a("accept",o.fp),onDecline:()=>void a("dismiss",o.fp),onLater:()=>i(o.fp)},o.fp):null}function MAe({rows:e,onSignIn:t,onLater:n,firstRef:a}){const i=se(),o=e.length===1?e[0]:null;return s.jsxs("section",{className:"modal-body",children:[o?s.jsxs(s.Fragment,{children:[s.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:kT(i,"accounts.reauth.leadOne",{name:s.jsxs(s.Fragment,{children:[s.jsx("strong",{className:"reauth-name",children:o.name}),o.alias?s.jsxs("span",{className:"reauth-alias",children:[" (",o.alias,")"]}):null]})})}),s.jsx("p",{className:"reauth-note",children:qAe(i)})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:RAe(e.length,i)}),s.jsx("ul",{className:"reauth-list",children:e.map((r,c)=>s.jsxs("li",{className:"reauth-row",children:[s.jsxs("span",{className:"reauth-who",title:r.alias?`${r.alias} — ${r.name}`:r.name,children:[r.name,r.alias?s.jsxs("span",{className:"reauth-alias",children:[" ",r.alias]}):null]}),s.jsx("span",{className:"reauth-what",children:EAe(i)}),s.jsx("button",{type:"button",className:"btn",ref:c===0?a:void 0,"aria-label":i("accounts.reauth.againAs",{name:r.name}),onClick:()=>t(r),children:i("accounts.reauth.again")})]},r.id))}),s.jsx("p",{className:"reauth-note",children:i("accounts.reauth.keeps")})]}),s.jsxs("div",{className:"reauth-acts",children:[s.jsx("button",{type:"button",className:"btn",title:_Ae(i),onClick:n,children:i("accounts.reauth.later")}),o&&s.jsx("button",{type:"button",className:"btn primary",ref:a,onClick:()=>t(o),children:i("accounts.reauth.again")})]})]})}function IAe({rows:e,onSignIn:t,onLater:n}){const a=se(),i=m.useRef(null),o=Tt(n,{focusRef:i}),r=Rt(n);return s.jsx("div",{className:"modal-backdrop",...r,role:"presentation",children:s.jsxs("div",{ref:o,className:"modal reauth-ask",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"reauth-title","aria-describedby":"reauth-lead",children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"reauth-title",className:"modal-tool-name",children:TAe(e.length,a)})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":a("accounts.reauth.laterEsc"),title:a("accounts.reauth.laterEsc"),children:"×"})})]}),s.jsx(MAe,{rows:e,onSignIn:t,onLater:n,firstRef:i})]})})}function DAe({rows:e,signingIn:t,signIn:n,signedIn:a,refresh:i,closeSignIn:o,later:r,pairing:c=!1}){const d=m.useRef(!1),u=jn.dialogDepth()+(c?1:0),h=t!=null||t5({rows:e.length,ours:d.current,dialogs:u});return d.current=h,t?s.jsx(iH,{email:t.email||null,onClose:o,onChanged:i,onSignedIn:a}):h?s.jsx(IAe,{rows:e,onSignIn:n,onLater:r},e.length===1?"one":"many"):null}const FAe={"//":["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.81.1":"Codex reconnection and Windows fixes","3.81.0":"Codex accounts on a par with Claude's, Codex over Local network, and ccdeck tui for the whole deck","3.80.0":"Codex account switching, continuation and sharing","3.53.0":"Codex accounts, with sign-in, switching and Auto-switch","3.52.0":"ccdeck in nine more languages","3.51.0":"Jira integration updates","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.53.1","3.53.3"],"3.81.1":[{title:"Fix Codex sharing on Windows",body:"Codex logins blocked by Windows folder permissions can now be prepared for sharing from the Share dialog.",priority:"highlight",icon:"accounts",noticeLabel:"Folder permissions",notice:"Secure permissions and share is optional and restricts the selected Codex folders and auth.json to your Windows user, including changes to inherited access for their contents. Your login, settings and active account stay in place. Automatic network sync never changes folder permissions."},{title:"Windows updates reach the copy you use",body:"Global npm updates now target the active installation and confirm that newer files arrived before showing installed.",priority:"highlight",noticeLabel:"Already stuck?",notice:"An older Windows installation already stuck at installed may need one manual update to receive this fix. For the desktop app, run the latest Windows installer. For npm, follow the Windows recovery steps in README, then restart ccdeck. Accounts and settings are kept."},{title:"Reconnect Codex without a false login-change warning",body:"Connecting to an unchanged Codex account no longer pauses control because of its initial account update.",priority:"highlight",icon:"accounts"},{title:"See why a shared login did not arrive",body:"The network map now shows a failed transfer instead of promising that the login will arrive next round."}],"3.81.0":[{title:"👥 Codex accounts work the way Claude's do",body:"A Codex account's menu now has Set as home, Share and Projects, and Auto-switch shows even when you have only one Codex account.",priority:"highlight",icon:"accounts",details:"Auto-switch moves back to the home account once it has room again, and a notification says each move it makes. Projects shows where that account's work went, per project and per day."},{title:"📡 Share Codex logins with your paired decks",body:"Local network now lists Codex logins beside Claude's, and a paired deck adds a login you tick as a Codex account of its own.",priority:"highlight",icon:"accounts",noticeLabel:"Login privacy",notice:"Only the logins you tick are sent, and the one this deck is using stays here unless Send the login this deck is using too is on. A copy another deck renewed is repaired in place; a separate sign-in is never replaced.",details:"Codex rows show which paired decks a login is offered to, as Claude rows do, and Local network opens from the Codex side too."},{title:"⌨️ ccdeck tui looks after the whole deck over SSH",body:"The terminal view now draws the machine live, manages Claude and Codex accounts from a menu, and pairs and shares decks on a Local network tab.",priority:"highlight",details:"A Codex account signs in with a link and a code you type into any browser."},{title:"➕ Paste a Codex share from the + button",body:"Import Codex accounts is now the Paste a share tab under + in the Codex accounts panel, as on Claude's side."},{title:"🪟 The desktop window comes back the way you closed it",body:"Reopened from the tray, the Dock or a second launch, the window keeps its size and place, and stays maximized or full screen if it was.",details:"On macOS, a window reopened after an update or at login never enters full screen."}],"3.80.0":[{title:"Switch Codex accounts without losing your place",body:"Move supported running Codex conversations and their subagents to another account, then continue the same work.",priority:"highlight",icon:"accounts",noticeLabel:"Compatibility",notice:"Requires Codex 0.166.0 or newer and a private auth.json login on a supported shared native server. Conversations connected to that server switch together. ccdeck waits for tools and approvals, and must stay open to renew the selected login. After a lost connection or restart, a server that cannot confirm the workspace identity requires Reconnect selected account. If continuation is unconfirmed, check the conversation before continuing manually; uncertain sends are never repeated automatically."},{title:"Share Codex logins between your machines",body:"Choose accounts to export, then paste the code into Import Codex accounts on another machine, including Windows.",priority:"highlight",icon:"accounts",noticeLabel:"Login privacy",notice:"Sharing is optional and exports live ChatGPT credentials, including the renewal token, from file-backed logins. The code is encoded, not encrypted, and has no automatic expiry or ccdeck revocation. Use a trusted private channel and delete clipboard or message copies afterward. Renewal on one machine can invalidate the other copy and require signing in again. Configuration and conversation history are not transferred."},{title:"See your available Codex resets",body:"Usage shows saved rate-limit resets and their nearest expiry when the selected account provides them.",priority:"highlight",noticeLabel:"Availability",notice:"Reset inventory requires a validated file-backed login and an available provider reading. Checking the inventory never spends a reset."},{title:"Continue managed terminal tasks on another account",body:"With Codex Auto-switch enabled, supported terminal tasks can resume the same conversation on an account with quota after a usage-limit failure.",priority:"required",noticeLabel:"Terminal setup",notice:"Update an existing setup with Enable in terminal, then open a new terminal. Interactive continuation requires Codex 0.166.0 or newer with the native remote transport. Only supported commands launched through ccdeck terminal selection are covered; explicit CODEX_HOME pins, independent sessions and incompatible profile settings require manual handling."},{title:"Help us improve Codex support",body:"We are continuing to improve Codex support, and feedback on switching, subagents and sharing is welcome through the Feedback button in ccdeck."}],"3.53.2":[{title:"🔁 The deck stays up on machines without Codex",body:"Since 3.53.0 a deck with no Codex restarted itself every few seconds, and it now stays up."}],"3.53.0":[{title:"👥 Codex accounts: sign in, switch and Auto-switch",body:"Add Codex accounts from ccdeck with the official sign-in, see each one's usage, choose the default for new sessions and, if you turn it on, let Auto-switch move to the account with room.",priority:"highlight",noticeLabel:"Codex accounts",notice:"Each account keeps its own Codex folder, and ccdeck never copies, logs or refreshes its tokens. Removing an account moves its folder to codex-profiles-removed instead of deleting it. Auto-switch is off by default and acts only on a reading taken now."},{title:"🔀 One Accounts panel for Claude and Codex",body:"With both CLIs installed, a Claude | Codex switch in the panel's header changes the view, never the account in use, and ccdeck remembers it."},{title:"🕐 Reset times fit in every language",body:"The time until a reset beside each quota bar is no longer cut where a language's words run longer."},{title:"🛠️ Tool and Skill activity work when the deck's folder is gone",body:"Both open again when the folder ccdeck was started from has been deleted."}],"3.52.0":[{title:"🌍 ccdeck in your language",body:"Choose Traditional or Simplified Chinese, German, Japanese, Korean, French, Spanish, Brazilian Portuguese or Romanian in Settings › General › Language. Until you choose, ccdeck follows your browser's language.",priority:"highlight",noticeLabel:"Language",notice:"What's new and text written by Jira, GitHub or GitLab stay as they were written, and anything without a translation shows in English."},{title:"📅 Codex 30-day windows say what a day may cost",body:"A Codex window reported as 30 days is paced over its real length, and its pace note says what a day may cost to last until the reset."}],"3.51.0":[{title:"✏️ Comment and change status in Jira",body:"Add a comment or change an issue’s status from its details in ccdeck.",priority:"highlight",noticeLabel:"Jira edits",notice:"Changes are sent to your connected Jira account and follow its permissions. Jira edits require a supported native build and filesystem; if safe coordination is unavailable, ccdeck refuses the edit and you can still browse your board."},{title:"📍 Jira moves follow your selection",body:"Drag the issue you select, move completed issues between sprints, and place issues at the end by default.",priority:"highlight"},{title:"🛠️ Reduced memory use during long sessions",body:"ccdeck releases more unused memory, and Jira edits recover more reliably when a connection is interrupted."}],"3.50.0":[{title:"🤝 Paired decks no longer each read a shared account's usage",body:"No more rate limits from every machine reading it: one deck reads the account and passes the numbers to the others. Hover the reading's age to see which deck read it."}],"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.
|
|
155
|
+
${o("board.ribbon.spent",{cost:Nt(c.total)})}${u?` · ${u}`:""}`:""}`,onClick:()=>{try{a(e.id)}catch{}},children:[s.jsx("span",{className:`state-pill state-${e.state}`,children:No(e.state,o)}),s.jsx("span",{className:"selected-label",children:e.label}),c.total>0&&s.jsxs("span",{className:"selected-cost",children:[Nt(c.total),u?s.jsxs("span",{className:"selected-rate",children:[" · ",u]}):null]}),h>0&&s.jsxs("span",{className:"selected-extra",children:["+",h]}),s.jsx("span",{"aria-hidden":!0,className:"selected-close",onClick:g=>{g.stopPropagation(),i()},children:"×"})]})}function UNe({catBarRef:e,catBarOccluded:t,presentCats:n,hiddenCats:a,toggleCat:i}){const o=se();return s.jsx("div",{ref:e,className:`cat-filter-bar${t?" occluded":""}`,role:"group","aria-label":o("board.cat.filter"),children:n.map(r=>{const c=a.has(r);return s.jsxs("button",{type:"button",className:`cat-filter${c?" off":""}`,onClick:()=>i(r),"aria-pressed":!c,title:o(c?"board.cat.show":"board.cat.hide",{cat:Hg(r,o)}),children:[s.jsx(KCe,{cat:r}),s.jsx("span",{className:"cat-name",children:Hg(r,o)})]},r)})})}const BNe=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)","summary","[tabindex]"].join(",");function HNe(e){var n,a;const t=e.target;!(t!=null&&t.closest)||t.closest(BNe)!==e.currentTarget||(e.preventDefault(),(a=(n=document.activeElement)==null?void 0:n.blur)==null||a.call(n))}function WNe({trashZoneRef:e,trashState:t,trashPhase:n,trashLabel:a}){const i=se(),o=On();return s.jsxs("div",{ref:e,className:`drag-trash-zone ${t}${n==="leaving"?" leaving":""}`,role:"status",children:[s.jsx("svg",{className:"drag-trash-icon",viewBox:"0 0 24 24","aria-hidden":"true",children:s.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"})}),s.jsxs("span",{className:"drag-trash-copy",children:[s.jsx("span",{className:"drag-trash-text",children:t==="over"?s.jsxs(s.Fragment,{children:[i("board.trash.release")," ",s.jsx("strong",{className:"drag-trash-name",children:a||i("board.trash.thisCard")})]}):i("board.trash.drop")}),s.jsx("span",{className:"drag-trash-hint",children:t==="over"?i("board.trash.bringsBack",{list:zn(i("board.detail.listUpper"),"L",o)}):i("board.trash.keepsRunning")})]})]})}function GNe({canvasRef:e,bubbling:t,dragging:n,trash:a,zoom:i,viewport:o,stateRef:r,peek:c,children:d}){const{trashDragging:u,trashState:h,trashPhase:g,trashZoneRef:f,trashLabel:b}=a,{lod:k,lodRef:y}=i,{markCanvasInput:N}=o,{peekAgent:w,peekLabel:j,peekRecap:S,peekBounds:A}=c;return s.jsxs("main",{id:"canvas",tabIndex:-1,className:`canvas-wrap${t?" bubbling":""}${n?" dragging-any":""}${u&&h==="over"?" trash-hover":""}`,"data-lod":k,ref:e,onMouseDownCapture:HNe,onPointerDownCapture:N,onPointerUpCapture:N,onWheelCapture:N,onFocusCapture:T=>{const q=T.target;if(!VT(q)||y.current==null||y.current==="detail")return;const _=q.getAttribute("data-id");_&&r.current.agents.has(_)&&q.matches(":focus-visible")&&iW(_,q,"focus")},onBlurCapture:T=>{var _,I;const q=(I=(_=T.target).getAttribute)==null?void 0:I.call(_,"data-id");q&&qo(q)},children:[d,ko(g)&&s.jsx(WNe,{trashZoneRef:f,trashState:h,trashPhase:g,trashLabel:b}),s.jsx(wxe,{agentFor:w,recapFor:S,labelFor:j,bounds:A})]})}function $Ne({restarting:e,restartMode:t,live:n,paused:a}){const i=se();return s.jsxs("div",{className:"conn-banner",role:"alert",children:[s.jsx("span",{className:"conn-dot"}),e?t==="npx"?i("shell.banner.fetchingNpx"):i("shell.banner.restartingProduct",{product:qt}):(()=>{const o=Pne({connected:n,paused:a});return s.jsxs(s.Fragment,{children:[i("shell.banner.lost",{product:qt}),o&&s.jsx("span",{className:"conn-sub",children:o})]})})()]})}function VNe({oldName:e,version:t,dismissOldName:n}){const a=se();return s.jsxs("div",{className:"ver-banner",role:"status",children:[s.jsx("span",{className:"ver-dot"}),s.jsx("strong",{children:a("shell.banner.oldName",{old:e,product:qt})}),t!=null&&t.renameFix?s.jsx("span",{className:"ver-sub",children:t.renameFix}):null,s.jsx("button",{type:"button","aria-label":a("shell.dismiss"),className:"ver-close",onClick:n,children:"×"})]})}const WW=()=>x("shell.rating.thanks"),KNe=Array.from({length:11},(e,t)=>t);function JNe(e){return e===0?x("shell.rating.score0"):e===10?x("shell.rating.score10"):x("shell.rating.score",{n:e})}const YNe=6;function ZNe(e){const t=m.useRef(null);return m.useLayoutEffect(()=>{const n=t.current,a=n==null?void 0:n.closest(".app");if(!n||!a)return;const i=()=>a.style.setProperty("--rating-h",`${Math.ceil(n.getBoundingClientRect().height)}px`);i();const o=typeof ResizeObserver>"u"?null:new ResizeObserver(i);return o==null||o.observe(n),()=>{o==null||o.disconnect(),a.style.removeProperty("--rating-h")}},[e]),t}function XNe(){var e;(e=document.getElementById("canvas"))==null||e.focus()}function QNe({phase:e,score:t,onAnswer:n,onLater:a,onClose:i,onFeedback:o,onHold:r}){se();const c=ZNe(e),d=m.useRef(null),u=m.useRef(null),h=m.useRef(!1);m.useEffect(()=>{var f,b;e!=="thanks"||!h.current||(h.current=!1,ta(((f=document.activeElement)==null?void 0:f.tagName)??null)&&((b=d.current??u.current)==null||b.focus()))},[e]);const g=f=>{var b;(b=c.current)!=null&&b.contains(document.activeElement)&&XNe(),f()};return e==="thanks"?s.jsxs("div",{ref:c,className:"ver-banner note rating-banner",onFocus:()=>r(!0),onBlur:f=>{f.currentTarget.contains(f.relatedTarget)||r(!1)},children:[s.jsx("span",{className:"ver-dot"}),s.jsx("strong",{children:WW()}),t!==null&&t<=YNe?s.jsx("button",{ref:d,type:"button",className:"ver-act",onClick:o,children:x("shell.rating.better")}):null,s.jsx("button",{ref:u,type:"button","aria-label":x("shell.dismiss"),className:"ver-close",onClick:()=>g(i),children:"×"})]}):s.jsxs("div",{ref:c,className:"ver-banner note rating-banner",role:"group","aria-labelledby":"rating-question",children:[s.jsx("span",{className:"ver-dot"}),s.jsx("strong",{id:"rating-question",children:x("shell.rating.question")}),s.jsx("span",{className:"rating-scale",children:KNe.map(f=>s.jsx("button",{type:"button",className:"rating-pick","aria-label":JNe(f),onClick:b=>{h.current=b.detail===0||b.currentTarget.matches(":focus-visible"),n(f)},children:f},f))}),s.jsx("span",{className:"ver-sub rating-ends","aria-hidden":"true",children:x("shell.rating.ends")}),s.jsx("button",{type:"button",className:"ver-act",onClick:()=>g(a),children:x("shell.rating.later")})]})}const eje=3e4;function tje({bundle:e,running:t,lastTried:n}){return!t||e===t?!1:n!==t}function nje({bundle:e,running:t,pending:n,lastTried:a}){return t?tje({bundle:e,running:t,lastTried:a})?"reload":n==null||n&&n!==t?"wait":"confirm":"wait"}function aje(e){return!e||e.state!=="failed"?null:`${typeof e.at=="number"?e.at:0}:${e.error??""}`}function sje({asked:e,reported:t}){return t?t!==e:!1}function GW(e){const t=e.thresholdMs??eje;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 ije(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 oje(e,t){return e?t==null?x("shell.banner.autoIdle"):x("shell.banner.autoIn",{time:ije(t)}):x("shell.banner.autoOff")}function XI(e){let t=0;for(const n of e)n.state==="active"&&t++;return t}function rje(e,t=!1){return e<=0&&t?{label:x("shell.banner.restartAnyway"),clause:x("shell.banner.clausePaused")}:e<=0?{label:x("shell.banner.restartNow"),clause:x("shell.banner.clauseIdle")}:{label:x("shell.banner.restartAnyway"),clause:x("shell.banner.clauseAgents",{count:e})}}function cje(e){const t=GW(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 Rj={get git_checkout(){return x("shell.banner.block.git_checkout")},get npx(){return x("shell.banner.block.npx")},get one_off(){return x("shell.banner.block.one_off")},get not_writable(){return x("shell.banner.block.not_writable")},get opted_out(){return x("shell.banner.block.opted_out")},get retired_name(){return x("shell.banner.block.retired_name")}};function lje({notice:e,version:t,dismissNotice:n,upgradeState:a,startUpgrade:i,copyCommand:o,cmdCopied:r,autoRestart:c,toggleAutoRestart:d,askRestart:u,restartCopy:h,restartFuseMs:g,restarting:f}){var k,y,N;const b=se();return s.jsxs("div",{className:`ver-banner ${e.kind}`,role:"status",children:[s.jsx("span",{className:`ver-dot${g==null?"":" armed"}`}),e.kind==="restart"?s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:b("shell.banner.installedStale",{to:e.to,from:e.from})}),t!=null&&t.canRestart?s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"ver-act",onClick:()=>u(),...ua(f),title:b("shell.banner.restartTitle"),children:f?b("shell.banner.restarting"):h.label}),!f&&s.jsx("span",{className:"ver-sub",children:h.clause}),s.jsxs("label",{className:"ver-auto",children:[s.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":c,onClick:d,"aria-label":b("shell.banner.autoRestart"),title:b(c?"shell.banner.autoOnTitle":"shell.banner.autoOffTitle"),children:s.jsx("span",{className:"switch-knob"})}),s.jsx("span",{"aria-hidden":!0,children:oje(c,g)})]})]}):s.jsx("span",{className:"ver-sub",title:b("shell.banner.restartNeededTitle"),children:b("shell.banner.restartNeeded")})]}):s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:b("shell.banner.isOut",{product:qt,to:e.to,from:e.from})}),(t==null?void 0:t.upgradeMode)==="install"&&a!=="failed"&&s.jsx("button",{type:"button",className:"ver-act",onClick:i,...ua(a==="running",a==="done"),title:b("shell.banner.installTitle",{command:((k=t==null?void 0:t.upgrade)==null?void 0:k.command)??(t==null?void 0:t.command)??"npm i -g"}),children:b(a==="running"?"shell.banner.installing":a==="done"?"shell.banner.installed":"shell.update.now")}),(t==null?void 0:t.upgradeMode)==="npx"&&(t==null?void 0:t.canRestart)&&s.jsx("button",{type:"button",className:"ver-act",onClick:()=>u({upgrade:!0}),...ua(f),title:b("shell.banner.npxTitle",{command:(t==null?void 0:t.command)??""}),children:b(f?"shell.banner.fetching":a==="failed"?"shell.update.retry":"shell.update.andRestart")}),a==="failed"?s.jsx("span",{className:"ver-sub fail",title:((y=t==null?void 0:t.upgrade)==null?void 0:y.error)??"",children:b("shell.banner.failedLine",{what:(t==null?void 0:t.upgradeMode)==="npx"?b("shell.banner.updateFailed"):b("shell.banner.installFailed"),error:((N=t==null?void 0:t.upgrade)==null?void 0:N.error)??b("shell.banner.unknownError")})}):(t==null?void 0:t.upgradeMode)==="npx"?s.jsx("span",{className:"ver-sub",children:t!=null&&t.canRestart?b("shell.banner.npxRerun"):Rj.npx}):t!=null&&t.upgradeBlocked?s.jsx("span",{className:"ver-sub",children:un(Rj,t.upgradeBlocked)??b("shell.banner.cannotInstall")}):null,s.jsxs("button",{type:"button",className:"ver-cmd",onClick:o,title:b("shell.banner.copyTitle"),children:[s.jsx("code",{children:t==null?void 0:t.command}),s.jsx("span",{className:"ver-cmd-hint",children:b(r?"shell.banner.copiedHint":"shell.banner.copyHint")})]})]}),s.jsx("button",{type:"button","aria-label":b("shell.dismiss"),className:"ver-close",onClick:n,children:"×"})]})}function dje({restart:e,versionCheck:t,upgrade:n,oldNameNotice:a,rating:i,onFeedback:o,everConnected:r,live:c,paused:d}){const u=se(),{autoRestart:h,toggleAutoRestart:g,restarting:f,restartMode:b,restartedTo:k,askRestart:y,restartCopy:N,restartFuseMs:w}=e,{version:j,notice:S,noticeOpen:A,dismissNotice:T}=t,{upgradeState:q,startUpgrade:_,copyCommand:I,cmdCopied:z}=n,{oldName:F,oldNameOpen:U,dismissOldName:P}=a,{ratingPhase:L,ratingScore:R,answerRating:O,rateLater:D,closeRating:$,holdThanks:B}=i,G=k?s.jsxs("div",{className:"ver-banner done",role:"status",children:[s.jsx("span",{className:"ver-dot"}),s.jsx("strong",{children:u("shell.banner.restartedTo",{version:k})}),s.jsx("span",{className:"ver-sub",children:u("shell.banner.replayed")})]}):r&&!c?s.jsx($Ne,{restarting:f,restartMode:b,live:c,paused:d}):A&&S?s.jsx(lje,{notice:S,version:j,dismissNotice:T,upgradeState:q,startUpgrade:_,copyCommand:I,cmdCopied:z,autoRestart:h,toggleAutoRestart:g,askRestart:y,restartCopy:N,restartFuseMs:w,restarting:f}):U&&F?s.jsx(VNe,{oldName:F,version:j,dismissOldName:P}):L!=="hidden"?s.jsx(QNe,{phase:L,score:R,onAnswer:O,onLater:D,onClose:$,onFeedback:o,onHold:B}):null;return s.jsxs(s.Fragment,{children:[G,s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:L==="thanks"?WW():""})]})}function uje(e,t){return e==="confirmation"?t.confirmOpen?"clear":"ignore":t.modalOpen||t.confirmOpen?"ignore":"confirm"}function hje(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 pje(e,t){return e<=0?null:t("board.clear.goes.agents",{count:e})}function gje(e,t,n=x){const a=pje(e,n),i=(...d)=>[a,...d,n("board.clear.goes.view")].filter(u=>u!==null),o=n("board.clear.final"),r=n("board.clear.confirmAll");if(!t)return{goes:i(n("board.clear.goes.logUnknown")),stays:[],final:o,confirm:r};if(!t.path)return{goes:i(),stays:[],final:n("board.clear.final.noLog",{final:o}),confirm:r};if(!t.mine){const d=t.ownerPort===null?n("board.clear.owner.other"):n("board.clear.owner.port",{port:t.ownerPort}),u=t.decks>2?n("board.clear.owner.shared",{decks:t.decks}):"";return{goes:i(),stays:[n("board.clear.stays.log",{owner:d,shared:u}),n("board.clear.stays.replay")],final:null,confirm:n("board.clear.confirmCanvas")}}if(t.decks<=1)return{goes:i(n("board.clear.goes.logOwn")),stays:[],final:o,confirm:r};const c=t.decks-1;return{goes:i(n("board.clear.goes.logShared",{count:c})),stays:[n("board.clear.stays.shared",{count:c})],final:o,confirm:r}}function mje({agentCount:e,onConfirm:t,onCancel:n}){const a=se(),i=m.useRef(null),o=Tt(n,{focusRef:i,layer:Dee}),r=Rt(n),[c,d]=m.useState(null);m.useEffect(()=>{let b=!1;return fetch("/api/clear").then(k=>k.ok?k.json():null).then(k=>{b||d(hje(k))}).catch(()=>{}),()=>{b=!0}},[]);const{goes:u,stays:h,final:g,confirm:f}=gje(e,c,a);return s.jsx("div",{className:"modal-backdrop",...r,role:"presentation",children:s.jsxs("div",{ref:o,className:"modal clear-confirm",onClick:b=>b.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"clear-confirm-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("span",{className:"status-dot err","aria-hidden":!0}),s.jsx("span",{id:"clear-confirm-title",className:"modal-tool-name",children:a("board.clear.title")})]}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":a("board.clear.cancelEsc"),title:a("board.clear.cancelEsc"),children:"×"})})]}),s.jsxs("section",{className:"modal-body",children:[s.jsxs("dl",{className:"cc-plan",children:[s.jsx("dt",{children:a("board.clear.goes")}),s.jsx("dd",{children:u.map(b=>s.jsx("span",{children:b},b))}),s.jsx("dt",{children:a("board.clear.stays")}),s.jsx("dd",{children:h.length>0?h.map(b=>s.jsx("span",{children:b},b)):s.jsx("span",{children:a("board.clear.nothing")})})]}),g&&s.jsx("p",{className:"cc-final",children:g}),s.jsxs("div",{className:"cc-actions",children:[s.jsx("button",{type:"button",ref:i,className:"btn",onClick:n,children:a("board.clear.cancel")}),s.jsx("button",{type:"button",className:"btn danger",onClick:t,children:f})]})]})]})})}function Ej(e,t,n){const a=`{${t}}`,i=e.indexOf(a);return i<0?e:s.jsxs(m.Fragment,{children:[e.slice(0,i),n,e.slice(i+a.length)]})}function fje({kind:e,onChange:t}){const n=se();return s.jsxs("fieldset",{className:"fb-kinds",children:[s.jsx("legend",{className:"vis-hidden",children:n("shell.feedback.kinds")}),bm.map(a=>s.jsxs("label",{className:"fb-kind",children:[s.jsx("input",{type:"radio",name:"feedback-kind",value:a.value,checked:e===a.value,onChange:()=>t(a.value),onKeyDown:i=>{XT(i.nativeEvent)&&i.preventDefault()}}),a.label]},a.value))]})}const $W="fb-details";function bje({open:e,onToggle:t}){return se(),s.jsxs("button",{type:"button",className:"fb-tool fb-more","aria-expanded":e,"aria-controls":$W,onClick:t,children:[fSe(),s.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:s.jsx("path",{d:"M2.5 3.75 5 6.25l2.5-2.5"})})]})}function vje({open:e,contact:t,onContact:n}){const a=se(),i=m.useId();return s.jsx("div",{id:$W,className:"fb-details","data-open":e||void 0,children:s.jsx("div",{className:"fb-details-clip",children:s.jsxs("div",{className:"fb-details-body",children:[s.jsxs("div",{className:"fb-field",children:[s.jsxs("label",{className:"fb-field-label",htmlFor:"fb-contact",children:[bSe(),s.jsx("span",{className:"fb-optional",children:a("shell.feedback.optional")})]}),s.jsx("input",{id:"fb-contact",className:"ap-manage-input",type:"text",value:t,maxLength:jW,autoComplete:"email",placeholder:vSe(),"aria-describedby":i,onChange:o=>n(o.target.value),onKeyDown:o=>{XT(o.nativeEvent)&&o.preventDefault()}}),s.jsx("p",{id:i,className:"fb-hint",children:kSe()})]}),s.jsx("div",{className:"fb-where",children:wSe().map(o=>s.jsx("p",{children:o},o))})]})})})}const Sr=3,kje=5*1024*1024,wje=12*1024*1024,qj=8192,yje=64*1024,xje=256*1024,Cje=.92,Sje=640,VW=.9,Nje=.85,jje=6,Aje=512*1024,xm={png:"image/png",jpeg:"image/jpeg"},Tje={png:"png",jpeg:"jpg"},Rje=[137,80,78,71,13,10,26,10],Eje=[255,216,255];function KW(e){const t=n=>e.length>=n.length&&n.every((a,i)=>e[i]===a);return t(Rje)?"png":t(Eje)?"jpeg":null}function qje(e){const t=KW(e);return t==="png"?_je(e):t==="jpeg"?Lje(e):null}function _je(e){const t=[73,72,68,82];if(e.length<24||!t.every((a,i)=>e[12+i]===a))return null;const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return{width:n.getUint32(16),height:n.getUint32(20)}}function zje(e){return e>=192&&e<=207&&e!==196&&e!==200&&e!==204}function Lje(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 a=e[t]<<8|e[t+1];if(a<2)return null;if(zje(n))return t+7>e.length?null:{height:e[t+3]<<8|e[t+4],width:e[t+5]<<8|e[t+6]};t+=a}return null}function QI(e,t){return e.bytes>t||e.width>qj||e.height>qj}function Oje(e){return Math.min(kje,wje-yje-e)}function JW(e,t){return{width:Math.max(1,Math.floor(e.width*t)),height:Math.max(1,Math.floor(e.height*t))}}function Pje(e,t){const n=qj/Math.max(e.width,e.height),a=e.bytes>t?Math.sqrt(t/e.bytes)*VW:1;return JW(e,Math.min(1,n,a))}async function Mje(e,t,n){let a=Pje(e,t),i=e.format;for(let o=0;o<jje;o++){const r=await n(a,i,i==="jpeg"?Cje:void 0);if(!r)return null;if(r.size<=t)return{...a,blob:r,format:i};if(i==="png"){i="jpeg";continue}if(a=JW(a,Math.min(Nje,Math.sqrt(t/r.size)*VW)),Math.max(a.width,a.height)<Sje)return null}return null}async function Ije(e,t,n){const a=new Uint8Array(await e.slice(0,Aje).arrayBuffer()),i=KW(a);if(!i)return{ok:!1,problem:"type"};if(t<xje)return{ok:!1,problem:"no_room"};const o=e.type===xm[i]?e:new Blob([e],{type:xm[i]}),r=qje(a);if(r&&!QI({...r,bytes:e.size},t))return{ok:!0,blob:o,resized:null};const c=await n(e).catch(()=>null);if(!c)return{ok:!1,problem:"unreadable"};try{const d={width:c.width,height:c.height,bytes:e.size,format:i};if(!QI(d,t))return{ok:!0,blob:o,resized:null};const u=await Mje(d,t,c.encoder);return u?{ok:!0,blob:u.blob,resized:{width:u.width,height:u.height}}:{ok:!1,problem:"too_large"}}finally{c.release()}}function Dje(e){return({width:t,height:n},a,i)=>new Promise(o=>{const r=document.createElement("canvas");r.width=t,r.height=n;const c=r.getContext("2d");if(!c)return o(null);a==="jpeg"&&(c.fillStyle="white",c.fillRect(0,0,t,n)),c.imageSmoothingQuality="high",c.drawImage(e,0,0,t,n),r.toBlob(d=>{r.width=0,r.height=0,o(d)},xm[a],i)})}const Fje=async e=>{const t=await createImageBitmap(e);return{width:t.width,height:t.height,encoder:Dje(t),release:()=>t.close()}};function Uje(e){return e.includes("Files")}function Bje({files:e,hasText:t,intoTextField:n}){return e>0&&(!t||!n)}function Hje(e,t){const n=e.indexOf(t);return e[n+1]??e[n-1]??null}function Wje(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((a,i)=>{const o=a.type===xm.jpeg?"jpeg":"png";n.append("images",a,`image-${i+1}.${Tje[o]}`)}),{method:"POST",body:n}}const Gje=()=>x("shell.feedback.addShot"),eD=()=>x("shell.feedback.addHint"),$je=()=>x("shell.feedback.shotsNote"),tD=()=>x("shell.feedback.full"),Vje=()=>x("shell.feedback.refusedWhileSending");function Kje(e,t,n){const a=n?x("shell.feedback.resized",{width:n.width,height:n.height}):"";return x("shell.feedback.replaceLabel",{n:e+1,name:t,fit:a})}function Jje(e,t){const n=x("shell.feedback.shotsCount",{count:e,max:Sr});return t>0?x("shell.feedback.shotsResized",{of:n,resized:t}):n}function Yje(e){return x("shell.feedback.leftOut",{count:e})}function Zje(e){return`“${e.length>40?`${e.slice(0,30)}…${e.slice(-9)}`:e}”`}function Xje(e,t){const n=Zje(t);return e==="type"?x("shell.feedback.problem.type",{file:n}):e==="no_room"?x("shell.feedback.problem.noRoom",{file:n}):e==="unreadable"?x("shell.feedback.problem.unreadable",{file:n}):x("shell.feedback.problem.tooLarge",{file:n})}const YW="image/png,image/jpeg";function ZW({className:e="fb-glyph"}){return s.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:[s.jsx("rect",{x:"1.8",y:"2.4",width:"10.4",height:"9.2",rx:"1.6"}),s.jsx("circle",{cx:"5",cy:"5.6",r:"1"}),s.jsx("path",{d:"M2.4 10.4 5.5 7.6l2.1 1.8 1.5-1.3 2.5 2.2"})]})}function Qje({images:e,buttonRef:t}){se();const n=m.useRef(null),a=e.shots.length>=Sr;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:t,type:"button",className:"fb-tool",title:eD(),"aria-describedby":"fb-attach-hint",onClick:()=>{var i;return a?e.sayFull():(i=n.current)==null?void 0:i.click()},children:[s.jsx(ZW,{}),Gje()]}),s.jsx("span",{id:"fb-attach-hint",hidden:!0,children:eD()}),s.jsx("input",{ref:n,type:"file",accept:YW,multiple:!0,hidden:!0,onChange:i=>{e.add(Array.from(i.target.files??[])),i.target.value=""}})]})}function eAe({images:e,addRef:t}){const n=se(),a=m.useRef(new Map),i=m.useRef(null),o=m.useRef(null),r=m.useRef(null),[c,d]=m.useState(null),{shots:u}=e,h=Jje(u.length,u.filter(b=>b.resized).length);m.useLayoutEffect(()=>{var b;c!==null&&((b=c==="add"?t.current:a.current.get(c))==null||b.focus(),d(null))},[c,t]),m.useEffect(()=>{var b;e.problem&&((b=i.current)==null||b.scrollIntoView({block:"nearest"}))},[e.problem,e.problemId]);function g(b){d(Hje(u.map(k=>k.id),b)??"add"),e.remove(b)}function f(b){var k;r.current=b,(k=o.current)==null||k.click()}return s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"vis-hidden",role:"status",children:e.announcement}),s.jsx("input",{ref:o,type:"file",accept:YW,hidden:!0,onChange:b=>{const k=r.current;k!==null&&e.replace(k,Array.from(b.target.files??[])),r.current=null,b.target.value=""}}),u.length>0&&s.jsxs("div",{className:"fb-shots",children:[s.jsxs("div",{className:"fb-shots-row",children:[s.jsx("ul",{className:"fb-shots-list",children:u.map((b,k)=>s.jsxs("li",{className:"fb-shot","data-fitting":b.blob?void 0:!0,children:[s.jsxs("button",{type:"button",className:"fb-shot-pick","aria-label":Kje(k,b.name,b.resized),onClick:()=>f(b.id),children:[s.jsx("img",{className:"fb-shot-img",src:b.url,alt:""}),b.blob?s.jsx("span",{className:"fb-shot-cue","aria-hidden":"true",children:n("shell.feedback.replace")}):s.jsx("span",{className:"fb-shot-busy","aria-hidden":"true",children:n("shell.feedback.resizing")})]}),s.jsx("button",{ref:y=>{y?a.current.set(b.id,y):a.current.delete(b.id)},type:"button",className:"glyph-btn fb-shot-remove","aria-label":n("shell.feedback.removeImage",{n:k+1}),title:n("shell.feedback.removeImage",{n:k+1}),onClick:()=>g(b.id),children:s.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:s.jsx("path",{d:"M2.5 2.5 7.5 7.5M7.5 2.5 2.5 7.5"})})})]},b.id))}),s.jsx("span",{className:"fb-shots-count",children:h})]}),s.jsx("p",{className:"fb-hint",children:$je()})]}),e.problem&&s.jsx("p",{ref:i,className:"fb-error",role:"alert",children:e.problem},e.problemId)]})}function tAe(e,t){return e.map((n,a)=>({id:t+a,name:n.name,url:URL.createObjectURL(n.blob),blob:n.blob,resized:n.resized}))}function nAe(e,t,n){return n?e.map(a=>a.id===t.id?t:a):[...e,t]}function aAe(e,t,n){return n?e.map(a=>a.id===t?n:a):e.filter(a=>a.id!==t)}function sAe(e){const[t,n]=m.useState(()=>tAe((e==null?void 0:e.ready)??[],1)),[a,i]=m.useState({problem:"",id:0}),o=m.useRef(0),r=m.useCallback(P=>{P&&o.current++,i(L=>P?{problem:P,id:L.id+1}:L.problem?{problem:"",id:L.id}:L)},[]),[c,d]=m.useState(""),u=m.useRef(t),h=m.useRef(null),g=m.useRef(t.length),f=m.useRef(!0),b=m.useRef(new Map),k=m.useRef([]),y=m.useRef(0),N=m.useCallback(P=>{u.current=P(u.current),n(u.current)},[]);m.useEffect(()=>(f.current=!0,()=>{f.current=!1;for(const P of u.current)URL.revokeObjectURL(P.url)}),[]);const w=m.useCallback(async(P,L)=>{const R=u.current.reduce((X,V)=>{var Q;return X+(V.id===(L==null?void 0:L.id)?0:((Q=V.blob)==null?void 0:Q.size)??0)},0),O=(L==null?void 0:L.id)??++g.current,D=URL.createObjectURL(P),$={id:O,name:P.name||"image",url:D,blob:null,resized:null},B=y.current;b.current.set(O,P);let G=!1;const Z=()=>{G||(G=!0,N(X=>nAe(X,$,L!==void 0)))},W=await Ije(P,Oje(R),async X=>(Z(),Fje(X))).catch(()=>({ok:!1,problem:"unreadable"})),H=u.current.some(X=>X.id===O);return!f.current||y.current!==B||!H&&(G||L)?(URL.revokeObjectURL(D),L&&URL.revokeObjectURL(L.url),f.current&&b.current.delete(O),""):(b.current.delete(O),W.ok?(Z(),L&&URL.revokeObjectURL(L.url),N(X=>X.map(V=>V.id===O?{...V,blob:W.blob,resized:W.resized}:V)),""):(URL.revokeObjectURL(D),G&&N(X=>aAe(X,O,L)),Xje(W.problem,P.name||"image")))},[N]),j=m.useCallback(async P=>{r("");const L=y.current,R=[];let O=0,D=0;for(const B of P){if(!f.current||y.current!==L)return;const G=k.current.indexOf(B);if(G!==-1&&k.current.splice(G,1),u.current.length>=Sr){O++;continue}const Z=u.current.length,W=await w(B);W&&R.push(W),u.current.length>Z&&D++}if(!f.current||y.current!==L)return;O>0&&R.push(D===0&&R.length===0?tD():Yje(O)),r(R.join(" "));const $=u.current.length;D>0&&d(x("shell.feedback.imagesAdded",{count:D,total:$,max:Sr}))},[w,r]),S=m.useCallback(async(P,L)=>{r("");const R=u.current.find($=>$.id===P);if(!R)return j([L]);const O=await w(L,R);if(!f.current)return;r(O);const D=u.current.findIndex($=>$.id===P);!O&&D!==-1&&d(x("shell.feedback.imageReplaced",{n:D+1,total:u.current.length,max:Sr}))},[j,w,r]),A=m.useCallback(P=>{const L=y.current;h.current=(h.current??Promise.resolve()).then(()=>y.current===L?P():void 0).catch(()=>{})},[]),T=m.useCallback(P=>{P.length!==0&&(k.current.push(...P),A(()=>j(P)))},[j,A]);m.useEffect(()=>{e&&e.waiting.length>0&&T(e.waiting)},[]);const q=m.useCallback((P,L)=>{const R=L[0];R&&A(()=>S(P,R))},[A,S]),_=m.useCallback(P=>{const L=u.current.find(R=>R.id===P);L&&(URL.revokeObjectURL(L.url),b.current.delete(P),N(R=>R.filter(O=>O.id!==P)),r(""),d(x("shell.feedback.imageRemoved",{count:u.current.length,max:Sr})))},[N,r]),I=m.useCallback(()=>r(tD()),[r]),z=m.useCallback(async()=>{const P=o.current;return await h.current,o.current!==P?null:u.current.flatMap(L=>L.blob?[L.blob]:[])},[]),F=m.useCallback(()=>({ready:u.current.flatMap(P=>P.blob&&!b.current.has(P.id)?[{name:P.name,blob:P.blob,resized:P.resized}]:[]),waiting:[...b.current.values(),...k.current]}),[]),U=m.useCallback(()=>{y.current++;for(const P of u.current)URL.revokeObjectURL(P.url);b.current.clear(),k.current=[],N(()=>[]),r("")},[N,r]);return{shots:t,problem:a.problem,problemId:a.id,announcement:c,add:T,replace:q,remove:_,sayFull:I,ready:z,kept:F,clear:U}}function iAe(){const[e,t]=m.useState(null);return m.useEffect(()=>{let n=!0;return fetch("/api/feedback").then(a=>a.ok?a.json():null).then(a=>{n&&t(dSe(a))}).catch(()=>{}),()=>{n=!1}},[]),e}function oAe(e){const[t,n]=m.useState({state:"idle"}),a=m.useRef(!1),i=m.useRef(null);m.useEffect(()=>()=>{var c;return(c=i.current)==null?void 0:c.abort()},[]);async function o(c){if(!Qn(a.current))return;a.current=!0;const{signal:d}=i.current=new AbortController;n({state:"sending"});try{const u=await e.ready();if(d.aborted)return;if(!u){n({state:"failed",message:Vje()});return}const h=await fetch("/api/feedback",{...Wje(lSe(c),u),signal:d}),g=await h.json().catch(()=>null);n(h.ok&&(g!=null&&g.ok)?{state:"sent"}:{state:"failed",message:FI(h.status,g==null?void 0:g.reason,g==null?void 0:g.errors)})}catch{d.aborted||n({state:"failed",message:FI(0,null)})}finally{a.current=!1}}const r=()=>n(c=>c.state==="failed"?{state:"idle"}:c);return{outcome:t,sending:t.state==="sending",send:o,clearFailure:r}}function rAe(e,t){const[n,a]=m.useState(!1),i=m.useRef(t);return i.current=t,m.useEffect(()=>{if(!e)return;const o=window.setTimeout(()=>a(!0),UI),r=window.setTimeout(()=>i.current(),UI+jSe);return()=>{window.clearTimeout(o),window.clearTimeout(r)}},[e]),n}const BS="agent-dag.feedbackDrafts",nD=4;function cAe({initialKind:e,initialBody:t}){return{kind:e??"bug",body:t??""}}function lAe(e){return JSON.stringify([e.kind,e.body])}function dAe(e){return e.ready.length+e.waiting.length}function XW(e,t){return e.body.trim()!==t.body.trim()||e.contact.trim()!==""||e.images>0}function uAe(e){return x("shell.feedback.lost",{count:e})}const hAe=()=>x("shell.feedback.discard"),pAe=()=>x("shell.feedback.discardConfirm"),gAe=()=>x("shell.feedback.discardTitle"),aD=()=>x("shell.feedback.discardArmed"),mAe={ready:[],waiting:[]};function fAe(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:a,contact:i,images:o}=t;return!bm.some(r=>r.value===n)||typeof a!="string"||a.length>NW||typeof i!="string"||i.length>jW||typeof o!="number"||!Number.isInteger(o)||o<0||o>Sr?null:[e[0],{kind:n,body:a,contact:i,images:o}]}function bAe(e){let t=null;function n(){var o;if(t)return t;t=new Map;try{const r=(o=e())==null?void 0:o.getItem(BS),c=r?JSON.parse(r):[];if(Array.isArray(c))for(const d of c.slice(-nD)){const u=fAe(d);u&&t.set(u[0],{...u[1],images:null,imageCount:u[1].images})}}catch{}return t}function a(){try{const o=e();if(!o)return;const r=[...n()].map(([c,d])=>[c,{kind:d.kind,body:d.body,contact:d.contact,images:d.imageCount}]);r.length===0?o.removeItem(BS):o.setItem(BS,JSON.stringify(r))}catch{}}function i(o){n().delete(o)&&a()}return{read(o){const r=n().get(o);return r?{kind:r.kind,body:r.body,contact:r.contact,images:r.images??mAe,imagesLost:r.images?0:r.imageCount}:null},keep(o,r,c){const d=dAe(r.images);if(!XW({body:r.body,contact:r.contact,images:d},c)){i(o);return}const u=n();u.delete(o),u.set(o,{kind:r.kind,body:r.body,contact:r.contact,images:r.images,imageCount:d});for(const h of u.keys()){if(u.size<=nD)break;u.delete(h)}a()},forget:i}}function vAe(){try{return typeof window>"u"?null:window.sessionStorage}catch{return null}}const _j=bAe(vAe),kAe=4e3;function wAe(e,t,n,a,i){const o=m.useRef(null);o.current={key:e,seed:t,words:n,images:a,sent:i};const r=m.useCallback(()=>{const c=o.current;!c||c.sent||_j.keep(c.key,{...c.words,images:c.images.kept()},c.seed)},[]);m.useEffect(r,[r,n.kind,n.body,n.contact,a.shots]),m.useEffect(()=>r,[r]),m.useEffect(()=>{i&&_j.forget(e)},[i,e])}const sD="draft";function yAe(e){const[t,n]=m.useState(!1),a=m.useRef(0);m.useEffect(()=>{if(!t)return;const o=window.setTimeout(()=>n(!1),kAe);return()=>window.clearTimeout(o)},[t]);function i(){const o=Date.now(),r=Fr({armedFor:t?sD:null,target:sD,armedAt:a.current,now:o,gapMs:Dr});if(r==="arm"){n(!0),a.current=o;return}r!=="ignore"&&(n(!1),e())}return{armed:t,press:i}}function QW({onClose:e,initialKind:t,initialBody:n}){const a=se(),i=m.useRef(null),o=m.useRef(null),r=m.useRef(null),c=m.useRef(null),d=m.useRef(null),u=m.useRef(null),h=m.useRef(null),g=m.useRef(null),f=m.useRef(0),b=Tt(e,{focusRef:i}),k=Rt(e),y=cAe({initialKind:t,initialBody:n}),N=lAe(y),[w]=m.useState(()=>_j.read(N)),[j,S]=m.useState((w==null?void 0:w.kind)??y.kind),[A,T]=m.useState((w==null?void 0:w.body)??y.body),[q,_]=m.useState((w==null?void 0:w.contact)??""),[I,z]=m.useState((w==null?void 0:w.imagesLost)??0),[F,U]=m.useState(!1),[P,L]=m.useState(!1),[R,O]=m.useState(!1),D=sAe(w==null?void 0:w.images),$=pSe(iAe()),{outcome:B,sending:G,send:Z,clearFailure:W}=oAe(D),H=B.state==="sent",X=rAe(H,e);wAe(N,y,{kind:j,body:A,contact:q},D,H);const V=XW({body:A,contact:q,images:D.shots.length},y),Q=yAe(()=>{var Re;S(y.kind),T(y.body),_(""),z(0),L(!1),D.clear(),W(),(Re=i.current)==null||Re.focus()}),Y=SW(j),K=P&&!II(A),ee=I>0&&D.shots.length===0,te=[K&&"fb-body-error",ee&&"fb-images-lost"].filter(Boolean).join(" ")||void 0,[ce,ge]=xSe(Ao());m.useEffect(()=>{var Pe,Ae;const Re=c.current;if(!Re)return;const Je=Re.contains(document.activeElement)||ta(((Pe=document.activeElement)==null?void 0:Pe.tagName)??null);Re.inert=H,H&&Je&&((Ae=o.current)==null||Ae.focus())},[H]),m.useEffect(()=>{var xe,ze;const Re=d.current;if(!Re)return;const Je=h.current;if(G){const Ce=document.activeElement,Me=Ce!=null&&(Re.contains(Ce)||Ce===Je);g.current=Me?Ce:null,Re.inert=!0,Je&&(Je.inert=!0),g.current&&((xe=u.current)==null||xe.focus());return}Re.inert=!1,Je&&(Je.inert=!1);const Pe=g.current;g.current=null;const Ae=document.activeElement===u.current||ta(((ze=document.activeElement)==null?void 0:ze.tagName)??null);!H&&Pe&&Ae&&Pe.focus()},[G,H]);function ve(Re){var Je;if(Re.preventDefault(),!II(A)){L(!0),(Je=i.current)==null||Je.focus();return}Z({kind:j,body:A,contact:q})}const pe=!H&&!G,ae=Re=>Uje(Array.from(Re.dataTransfer.types));function le(Re){!ae(Re)||!pe||(Re.preventDefault(),f.current++,O(!0))}function Se(Re){ae(Re)&&(Re.preventDefault(),Re.dataTransfer.dropEffect=pe?"copy":"none")}function ke(Re){ae(Re)&&(f.current=Math.max(0,f.current-1),f.current===0&&O(!1))}function ye(Re){ae(Re)&&(Re.preventDefault(),f.current=0,O(!1),pe&&D.add(Array.from(Re.dataTransfer.files)))}function We(Re){Re.target!==Re.currentTarget||!ae(Re)||(Re.preventDefault(),Re.dataTransfer.dropEffect="none")}function He(Re){ae(Re)&&Re.preventDefault()}function Ke(Re){if(!pe)return;const Je=Array.from(Re.clipboardData.files),Pe=Re.target,Ae=Pe instanceof HTMLTextAreaElement||Pe instanceof HTMLInputElement,xe=Array.from(Re.clipboardData.types).includes("text/plain");Bje({files:Je.length,hasText:xe,intoTextField:Ae})&&(Re.preventDefault(),D.add(Je))}return s.jsx("div",{className:"modal-backdrop",...k,role:"presentation",onDragOver:We,onDrop:He,"data-leaving":X||void 0,children:s.jsxs("div",{ref:b,className:"modal feedback-dialog",onClick:Re=>Re.stopPropagation(),onDragEnter:le,onDragOver:Se,onDragLeave:ke,onDrop:ye,onPaste:Ke,role:"dialog","aria-modal":"true","aria-labelledby":"feedback-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"feedback-title",className:"modal-tool-name",children:a("shell.feedback.title")})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{ref:o,type:"button",className:"glyph-btn",onClick:e,"aria-label":a("shell.closeEsc"),title:a("shell.closeEsc"),children:"×"})})]}),s.jsx("p",{className:"vis-hidden",role:"status",children:Q.armed?aD():NSe(B.state)}),s.jsxs("div",{className:"fb-stage",children:[s.jsxs("form",{ref:c,className:"fb-form",onSubmit:ve,onKeyDown:Re=>{ySe(Re.nativeEvent)&&(Re.preventDefault(),Re.currentTarget.requestSubmit())},noValidate:!0,children:[s.jsxs("section",{ref:d,className:"modal-body fb-body",children:[s.jsx(fje,{kind:j,onChange:S}),s.jsxs("div",{className:"fb-compose",children:[s.jsx("label",{className:"fb-label",htmlFor:"fb-body",children:Y.question}),s.jsx("textarea",{ref:i,id:"fb-body",className:"ap-manage-input fb-message",value:A,maxLength:NW,rows:5,placeholder:Y.placeholder,onChange:Re=>T(Re.target.value),"aria-invalid":K||void 0,"aria-describedby":te,required:!0}),K&&s.jsx("p",{id:"fb-body-error",className:"fb-error",children:iSe()}),s.jsx(eAe,{images:D,addRef:r}),ee&&s.jsx("p",{id:"fb-images-lost",className:"fb-hint",children:uAe(I)}),s.jsxs("div",{className:"fb-tools",children:[s.jsx(Qje,{images:D,buttonRef:r}),s.jsx(bje,{open:F,onToggle:()=>U(Re=>!Re)})]}),s.jsx(vje,{open:F,contact:q,onContact:_})]}),s.jsx("p",{className:"fb-facts",children:$?Ej(gSe(),"facts",s.jsx("span",{className:"fb-facts-value",children:$})):mSe()}),B.state==="failed"&&s.jsx("p",{className:"fb-error",role:"alert",children:B.message})]}),s.jsxs("div",{className:"fb-foot",children:[V&&s.jsx("button",{ref:h,type:"button",className:`btn danger fb-discard${Q.armed?" armed":""}`,onKeyDown:Re=>{Re.repeat&&Re.preventDefault()},onClick:Q.press,title:Q.armed?aD():gAe(),children:Q.armed?pAe():hAe()}),s.jsxs("span",{className:"fb-shortcut","aria-hidden":"true",children:[s.jsx("kbd",{"data-symbol":CSe(ce)||void 0,children:ce}),s.jsx("kbd",{children:ge})," ",a("shell.feedback.toSend")]}),s.jsx("button",{type:"button",className:"btn",onClick:e,children:a("shell.cancel")}),s.jsx("button",{ref:u,type:"submit",className:"btn primary fb-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...ua(G),children:s.jsxs("span",{className:"fb-send-label",children:[s.jsx("span",{className:"fb-send-idle",children:a("shell.feedback.send")}),s.jsx("span",{className:"fb-send-busy",children:a("shell.feedback.sending")})]})})]})]}),H&&s.jsxs("div",{className:"fb-done",children:[s.jsx(Bu,{}),s.jsx("p",{className:"fb-done-line",children:AW()})]})]}),s.jsx("div",{className:"fb-drop","aria-hidden":"true","data-active":R||void 0,children:s.jsxs("div",{className:"fb-drop-frame",children:[s.jsx(ZW,{className:"fb-drop-glyph"}),s.jsx("p",{className:"fb-drop-title",children:a("shell.feedback.dropTitle")}),s.jsx("p",{className:"fb-drop-note",children:a("shell.feedback.dropNote")})]})})]})})}const HS=[{id:"canvas",get title(){return x("settings.key.group.canvas")},rows:[{cap:"Space",get action(){return x("settings.key.pause")},binds:[" "]},{cap:"J",get action(){return x("settings.key.next")},binds:["j","J"]},{cap:"K",get action(){return x("settings.key.prev")},binds:["k","K"]},{cap:"W",get action(){return x("settings.key.waiting")},binds:["w","W"]},{cap:"F",get action(){return x("settings.key.fit")},binds:["f","F"]},{cap:"Z",get action(){return x("settings.key.zoom")},binds:["z","Z"]},{cap:"Delete",get action(){return x("settings.key.delete")},binds:["Delete"]},{cap:"R",get action(){return x("settings.key.rearrange")},binds:["r","R"]},{cap:"Ctrl + Z",macCap:"⌘ Z",get action(){return x("settings.key.undo")},binds:["z","Z"],chord:!0},{cap:"C",get action(){return x("settings.key.clear")},binds:["c","C"]}]},{id:"panels-and-dialogs",get title(){return x("settings.key.group.panels")},rows:[{cap:"Ctrl + K",macCap:"⌘ K",get action(){return x("settings.key.quick")},binds:["k","K"],chord:!0},{cap:"U",get action(){return x("settings.key.usage")},binds:["u","U"]},{cap:"L",get action(){return x("settings.key.sessions")},binds:["l","L"]},{cap:"D",get action(){return x("settings.key.detail")},binds:["d","D"]},{cap:"H",get action(){return x("settings.key.history")},binds:["h","H"]},{cap:"A",get action(){return x("settings.key.accounts")},binds:["a","A"]},{cap:"S",get action(){return x("settings.key.machine")},binds:["s","S"]},{cap:"B",get action(){return x("settings.key.bw")},binds:["b","B"]},{cap:"I",get action(){return x("settings.key.jira")},binds:["i","I"],integration:"jira"},{cap:"?",get action(){return x("settings.key.sheet")},binds:["?"]}]},{id:"settings",get title(){return x("settings.key.group.settings")},rows:[{cap:"Ctrl + ,",macCap:"⌘ ,",get action(){return x("settings.key.all")},binds:[","],chord:!0},{cap:"V",get action(){return x("settings.key.sound")},binds:["v","V"]},{cap:"M",get action(){return x("settings.key.mute")},binds:["m","M"]},{cap:"T",get action(){return x("settings.key.theme")},binds:["t","T"]}]},{id:"focus-and-selection",get title(){return x("settings.key.group.focus")},rows:[{cap:"Tab",get action(){return x("settings.key.tab")},binds:[]},{cap:"Enter",get action(){return x("settings.key.enter")},binds:["Enter"]},{cap:"Shift + Enter",get action(){return x("settings.key.shiftEnter")},binds:["Enter"]},{cap:"Esc",get action(){return x("settings.key.esc")},binds:["Escape"]}]},{id:"mouse",get title(){return x("settings.key.group.mouse")},rows:[{get cap(){return x("settings.key.cap.drag")},get action(){return x("settings.key.drag")},binds:[]},{get cap(){return x("settings.key.cap.shiftClick")},get action(){return x("settings.key.shiftClick")},binds:[]},{get cap(){return x("settings.key.cap.click")},get action(){return x("settings.key.click")},binds:[]},{get cap(){return x("settings.key.cap.doubleClick")},get action(){return x("settings.key.doubleClick")},binds:[]},{get cap(){return x("settings.key.cap.hover")},get action(){return x("settings.key.hover")},binds:[]}]}],xAe=/ ?\([A-Z?]\)/g;function e5(e,t=()=>!0){const n=a=>a.integration===void 0||t(a.integration);return e&&HS.every(a=>a.rows.every(n))?HS:HS.map(a=>({...a,rows:a.rows.filter(n).filter(i=>e||i.chord||!i.binds.some(OU)).map(i=>e?i:{...i,action:i.action.replace(xAe,"")})})).filter(a=>a.rows.length>0)}function CAe(e,t){return e.split(/\{(\w+)\}/g).map((a,i)=>i%2===1&&a in t?s.jsx(m.Fragment,{children:t[a]},i):a===""?null:s.jsx(m.Fragment,{children:i%2===1?`{${a}}`:a},i))}function SAe({onClose:e,onTour:t,onSettings:n}){const a=se(),i=Tt(e),o=Rt(e),r=Po(Ao()),c=On(),d=hh(),u=e5(c,h=>Ai(d,h));return s.jsx("div",{className:"modal-backdrop",...o,role:"presentation",children:s.jsxs("div",{ref:i,className:"modal key-help",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"key-help-title","aria-describedby":c?void 0:"key-help-off",children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"key-help-title",className:"modal-tool-name",children:a("settings.key.title")})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:e,"aria-label":a("settings.key.close"),title:a("settings.key.close"),children:"×"})})]}),s.jsxs("section",{className:"modal-body",children:[!c&&s.jsxs("div",{className:"kh-off",children:[s.jsx("p",{className:"kh-off-text",id:"key-help-off",children:CAe(a("settings.key.offText",{title:"{title}",place:"{place}"}),{title:s.jsx("strong",{children:a("settings.key.offTitle")}),place:s.jsx("span",{className:"kh-place",children:a("settings.key.place")})})}),n&&s.jsx("button",{type:"button",className:"btn",onClick:n,children:a("settings.key.openSettings")})]}),t&&s.jsxs("div",{className:"guide-door",children:[s.jsx("span",{children:a("settings.key.tourText")}),s.jsx("button",{type:"button",className:"btn",onClick:t,children:a("settings.key.tour")})]}),s.jsx("div",{className:"shortcuts",children:u.map(h=>s.jsxs(m.Fragment,{children:[s.jsx("h3",{className:"kh-group",children:h.title}),h.rows.map(g=>s.jsxs("div",{className:"sc",children:[s.jsx("kbd",{children:r&&g.macCap?g.macCap:g.cap}),s.jsx("span",{children:g.action})]},`${h.id}:${g.cap}:${g.action}`))]},h.id))}),c&&s.jsxs("p",{className:"kh-foot",children:[a("settings.key.note")," ",a("settings.key.switchNote",{place:a("settings.key.place")})]})]})]})})}function NAe(e,t){return`${e}#${t}`}function jAe(e,{lan:t,now:n,closed:a}){if(t===void 0)return[];const i=[];for(const o of e??[]){const r=o.reauth;if(!r||r.dismissed||o.origin!=="ccdeck_signin")continue;const c=NAe(r.key,r.since);if(a.has(c)||ype(r.key,o.email,t,n))continue;const d=o.email??"";i.push({id:c,key:r.key,since:r.since,num:o.num,email:d,name:d||o.alias||x("accounts.accountN",{n:o.num}),alias:d&&o.alias?o.alias:null})}return i}function AAe(e,t){const n=String((t==null?void 0:t.email)??"").trim().toLowerCase();return n?e.filter(a=>a.email.toLowerCase()===n&&((t==null?void 0:t.num)==null||String(a.num)===String(t.num))).map(a=>a.id):[]}function t5({rows:e,ours:t,dialogs:n}){return e===0?!1:t||n===0}function TAe(e,t=x){return t("accounts.reauth.title",{count:e})}function RAe(e,t=x){return t("accounts.reauth.lead",{count:e})}const EAe=(e=x)=>e("accounts.reauth.expired"),qAe=(e=x)=>e("accounts.reauth.singleNote"),_Ae=(e=x)=>e("accounts.reauth.laterTip");function zAe(e,t){const n=(e??[]).filter(i=>i&&typeof i.fp=="string"&&!t.has(i.fp));if(!n.length)return{request:null,waiting:0};const a=[...n].sort((i,o)=>(i.at??0)-(o.at??0));return{request:a[0],waiting:a.length-1}}function LAe({request:e,waiting:t,busy:n,now:a,onAccept:i,onDecline:o,onLater:r}){const c=se(),d=m.useRef(null),u=Tt(r,{focusRef:d}),h=Rt(r),g=jo(n,"accept"),f=jo(n,"dismiss");return s.jsx("div",{className:"modal-backdrop",...h,role:"presentation",children:s.jsxs("div",{ref:u,className:"modal lan-ask",onClick:b=>b.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"lan-ask-title","aria-describedby":"lan-ask-who",children:[s.jsxs("header",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("i",{className:"ap-pulse","aria-hidden":!0}),s.jsx("span",{id:"lan-ask-title",className:"modal-tool-name",children:c("lan.ask.title")})]}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:r,"aria-label":c("lan.ask.later"),title:c("lan.ask.later"),children:"×"})})]}),s.jsxs("section",{className:"modal-body",children:[s.jsx("p",{id:"lan-ask-who",className:"lan-ask-who",children:s.jsx(Br,{text:c("lan.ask.who",{when:bT(e.at,a)}),parts:{name:s.jsx("strong",{className:"lan-ask-name",children:e.name}),addr:s.jsx("code",{className:"ap-lan-code",children:e.addr})}})}),s.jsx("p",{className:"modal-note",children:c("lan.ask.note")}),s.jsx("p",{className:"lan-ask-fp",children:s.jsx(Br,{text:c("lan.ask.fp"),parts:{fp:s.jsx("code",{className:"ap-lan-code",children:e.fp})}})}),t>0&&s.jsx("p",{className:"lan-ask-more",children:c("lan.ask.more",{count:t})}),s.jsxs("div",{className:"lan-ask-acts",children:[s.jsx("button",{type:"button",ref:d,className:"btn",disabled:f.disabled,"aria-busy":f.busy,onClick:o,title:c("lan.ask.declineTitle"),children:c(n==="dismiss"?"lan.ask.declining":"lan.ask.decline")}),s.jsx("button",{type:"button",className:"btn primary",disabled:g.disabled,"aria-busy":g.busy,onClick:i,title:c("lan.ask.acceptTitle"),children:c(n==="accept"?"lan.ask.accepting":"lan.ask.accept")})]})]})]})})}function OAe(e){const t=m.useRef(!1),n=PAe(e),a=t5({rows:n?1:0,ours:t.current,dialogs:jn.dialogDepth()});return t.current=a,a?n:null}function PAe({lanPending:e,lanDeferred:t,lanBusy:n,answerLanPair:a,deferLanPair:i}){const{request:o,waiting:r}=zAe(e,t.current);return o?s.jsx(LAe,{request:o,waiting:r,busy:n,now:Date.now(),onAccept:()=>void a("accept",o.fp),onDecline:()=>void a("dismiss",o.fp),onLater:()=>i(o.fp)},o.fp):null}function MAe({rows:e,onSignIn:t,onLater:n,firstRef:a}){const i=se(),o=e.length===1?e[0]:null;return s.jsxs("section",{className:"modal-body",children:[o?s.jsxs(s.Fragment,{children:[s.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:kT(i,"accounts.reauth.leadOne",{name:s.jsxs(s.Fragment,{children:[s.jsx("strong",{className:"reauth-name",children:o.name}),o.alias?s.jsxs("span",{className:"reauth-alias",children:[" (",o.alias,")"]}):null]})})}),s.jsx("p",{className:"reauth-note",children:qAe(i)})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{id:"reauth-lead",className:"reauth-lead",children:RAe(e.length,i)}),s.jsx("ul",{className:"reauth-list",children:e.map((r,c)=>s.jsxs("li",{className:"reauth-row",children:[s.jsxs("span",{className:"reauth-who",title:r.alias?`${r.alias} — ${r.name}`:r.name,children:[r.name,r.alias?s.jsxs("span",{className:"reauth-alias",children:[" ",r.alias]}):null]}),s.jsx("span",{className:"reauth-what",children:EAe(i)}),s.jsx("button",{type:"button",className:"btn",ref:c===0?a:void 0,"aria-label":i("accounts.reauth.againAs",{name:r.name}),onClick:()=>t(r),children:i("accounts.reauth.again")})]},r.id))}),s.jsx("p",{className:"reauth-note",children:i("accounts.reauth.keeps")})]}),s.jsxs("div",{className:"reauth-acts",children:[s.jsx("button",{type:"button",className:"btn",title:_Ae(i),onClick:n,children:i("accounts.reauth.later")}),o&&s.jsx("button",{type:"button",className:"btn primary",ref:a,onClick:()=>t(o),children:i("accounts.reauth.again")})]})]})}function IAe({rows:e,onSignIn:t,onLater:n}){const a=se(),i=m.useRef(null),o=Tt(n,{focusRef:i}),r=Rt(n);return s.jsx("div",{className:"modal-backdrop",...r,role:"presentation",children:s.jsxs("div",{ref:o,className:"modal reauth-ask",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"reauth-title","aria-describedby":"reauth-lead",children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"reauth-title",className:"modal-tool-name",children:TAe(e.length,a)})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:n,"aria-label":a("accounts.reauth.laterEsc"),title:a("accounts.reauth.laterEsc"),children:"×"})})]}),s.jsx(MAe,{rows:e,onSignIn:t,onLater:n,firstRef:i})]})})}function DAe({rows:e,signingIn:t,signIn:n,signedIn:a,refresh:i,closeSignIn:o,later:r,pairing:c=!1}){const d=m.useRef(!1),u=jn.dialogDepth()+(c?1:0),h=t!=null||t5({rows:e.length,ours:d.current,dialogs:u});return d.current=h,t?s.jsx(iH,{email:t.email||null,onClose:o,onChanged:i,onSignedIn:a}):h?s.jsx(IAe,{rows:e,onSignIn:n,onLater:r},e.length===1?"one":"many"):null}const FAe={"//":["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.81.2":"Codex account switches wait through activity changes","3.81.1":"Codex reconnection and Windows fixes","3.81.0":"Codex accounts on a par with Claude's, Codex over Local network, and ccdeck tui for the whole deck","3.80.0":"Codex account switching, continuation and sharing","3.53.0":"Codex accounts, with sign-in, switching and Auto-switch","3.52.0":"ccdeck in nine more languages","3.51.0":"Jira integration updates","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.53.1","3.53.3"],"3.81.2":[{title:"Codex account switches wait through activity changes",body:"If new work starts while a switch is being prepared, ccdeck now waits and retries safely instead of leaving the switch failed.",priority:"highlight",icon:"accounts"}],"3.81.1":[{title:"Fix Codex sharing on Windows",body:"Codex logins blocked by Windows folder permissions can now be prepared for sharing from the Share dialog.",priority:"highlight",icon:"accounts",noticeLabel:"Folder permissions",notice:"Secure permissions and share is optional and restricts the selected Codex folders and auth.json to your Windows user, including changes to inherited access for their contents. Your login, settings and active account stay in place. Automatic network sync never changes folder permissions."},{title:"Windows updates reach the copy you use",body:"Global npm updates now target the active installation and confirm that newer files arrived before showing installed.",priority:"highlight",noticeLabel:"Already stuck?",notice:"An older Windows installation already stuck at installed may need one manual update to receive this fix. For the desktop app, run the latest Windows installer. For npm, follow the Windows recovery steps in README, then restart ccdeck. Accounts and settings are kept."},{title:"Reconnect Codex without a false login-change warning",body:"Connecting to an unchanged Codex account no longer pauses control because of its initial account update.",priority:"highlight",icon:"accounts"},{title:"See why a shared login did not arrive",body:"The network map now shows a failed transfer instead of promising that the login will arrive next round."}],"3.81.0":[{title:"👥 Codex accounts work the way Claude's do",body:"A Codex account's menu now has Set as home, Share and Projects, and Auto-switch shows even when you have only one Codex account.",priority:"highlight",icon:"accounts",details:"Auto-switch moves back to the home account once it has room again, and a notification says each move it makes. Projects shows where that account's work went, per project and per day."},{title:"📡 Share Codex logins with your paired decks",body:"Local network now lists Codex logins beside Claude's, and a paired deck adds a login you tick as a Codex account of its own.",priority:"highlight",icon:"accounts",noticeLabel:"Login privacy",notice:"Only the logins you tick are sent, and the one this deck is using stays here unless Send the login this deck is using too is on. A copy another deck renewed is repaired in place; a separate sign-in is never replaced.",details:"Codex rows show which paired decks a login is offered to, as Claude rows do, and Local network opens from the Codex side too."},{title:"⌨️ ccdeck tui looks after the whole deck over SSH",body:"The terminal view now draws the machine live, manages Claude and Codex accounts from a menu, and pairs and shares decks on a Local network tab.",priority:"highlight",details:"A Codex account signs in with a link and a code you type into any browser."},{title:"➕ Paste a Codex share from the + button",body:"Import Codex accounts is now the Paste a share tab under + in the Codex accounts panel, as on Claude's side."},{title:"🪟 The desktop window comes back the way you closed it",body:"Reopened from the tray, the Dock or a second launch, the window keeps its size and place, and stays maximized or full screen if it was.",details:"On macOS, a window reopened after an update or at login never enters full screen."}],"3.80.0":[{title:"Switch Codex accounts without losing your place",body:"Move supported running Codex conversations and their subagents to another account, then continue the same work.",priority:"highlight",icon:"accounts",noticeLabel:"Compatibility",notice:"Requires Codex 0.166.0 or newer and a private auth.json login on a supported shared native server. Conversations connected to that server switch together. ccdeck waits for tools and approvals, and must stay open to renew the selected login. After a lost connection or restart, a server that cannot confirm the workspace identity requires Reconnect selected account. If continuation is unconfirmed, check the conversation before continuing manually; uncertain sends are never repeated automatically."},{title:"Share Codex logins between your machines",body:"Choose accounts to export, then paste the code into Import Codex accounts on another machine, including Windows.",priority:"highlight",icon:"accounts",noticeLabel:"Login privacy",notice:"Sharing is optional and exports live ChatGPT credentials, including the renewal token, from file-backed logins. The code is encoded, not encrypted, and has no automatic expiry or ccdeck revocation. Use a trusted private channel and delete clipboard or message copies afterward. Renewal on one machine can invalidate the other copy and require signing in again. Configuration and conversation history are not transferred."},{title:"See your available Codex resets",body:"Usage shows saved rate-limit resets and their nearest expiry when the selected account provides them.",priority:"highlight",noticeLabel:"Availability",notice:"Reset inventory requires a validated file-backed login and an available provider reading. Checking the inventory never spends a reset."},{title:"Continue managed terminal tasks on another account",body:"With Codex Auto-switch enabled, supported terminal tasks can resume the same conversation on an account with quota after a usage-limit failure.",priority:"required",noticeLabel:"Terminal setup",notice:"Update an existing setup with Enable in terminal, then open a new terminal. Interactive continuation requires Codex 0.166.0 or newer with the native remote transport. Only supported commands launched through ccdeck terminal selection are covered; explicit CODEX_HOME pins, independent sessions and incompatible profile settings require manual handling."},{title:"Help us improve Codex support",body:"We are continuing to improve Codex support, and feedback on switching, subagents and sharing is welcome through the Feedback button in ccdeck."}],"3.53.2":[{title:"🔁 The deck stays up on machines without Codex",body:"Since 3.53.0 a deck with no Codex restarted itself every few seconds, and it now stays up."}],"3.53.0":[{title:"👥 Codex accounts: sign in, switch and Auto-switch",body:"Add Codex accounts from ccdeck with the official sign-in, see each one's usage, choose the default for new sessions and, if you turn it on, let Auto-switch move to the account with room.",priority:"highlight",noticeLabel:"Codex accounts",notice:"Each account keeps its own Codex folder, and ccdeck never copies, logs or refreshes its tokens. Removing an account moves its folder to codex-profiles-removed instead of deleting it. Auto-switch is off by default and acts only on a reading taken now."},{title:"🔀 One Accounts panel for Claude and Codex",body:"With both CLIs installed, a Claude | Codex switch in the panel's header changes the view, never the account in use, and ccdeck remembers it."},{title:"🕐 Reset times fit in every language",body:"The time until a reset beside each quota bar is no longer cut where a language's words run longer."},{title:"🛠️ Tool and Skill activity work when the deck's folder is gone",body:"Both open again when the folder ccdeck was started from has been deleted."}],"3.52.0":[{title:"🌍 ccdeck in your language",body:"Choose Traditional or Simplified Chinese, German, Japanese, Korean, French, Spanish, Brazilian Portuguese or Romanian in Settings › General › Language. Until you choose, ccdeck follows your browser's language.",priority:"highlight",noticeLabel:"Language",notice:"What's new and text written by Jira, GitHub or GitLab stay as they were written, and anything without a translation shows in English."},{title:"📅 Codex 30-day windows say what a day may cost",body:"A Codex window reported as 30 days is paced over its real length, and its pace note says what a day may cost to last until the reset."}],"3.51.0":[{title:"✏️ Comment and change status in Jira",body:"Add a comment or change an issue’s status from its details in ccdeck.",priority:"highlight",noticeLabel:"Jira edits",notice:"Changes are sent to your connected Jira account and follow its permissions. Jira edits require a supported native build and filesystem; if safe coordination is unavailable, ccdeck refuses the edit and you can still browse your board."},{title:"📍 Jira moves follow your selection",body:"Drag the issue you select, move completed issues between sprints, and place issues at the end by default.",priority:"highlight"},{title:"🛠️ Reduced memory use during long sessions",body:"ccdeck releases more unused memory, and Jira edits recover more reliably when a connection is interrupted."}],"3.50.0":[{title:"🤝 Paired decks no longer each read a shared account's usage",body:"No more rate limits from every machine reading it: one deck reads the account and passes the numbers to the others. Hover the reading's age to see which deck read it."}],"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.
|
|
156
156
|
|
|
157
157
|
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.
|
|
158
158
|
|
|
@@ -348,11 +348,11 @@ While it is open it polls this machine once every few seconds, and it stops the
|
|
|
348
348
|
|
|
349
349
|
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.
|
|
350
350
|
|
|
351
|
-
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.`}]},n0="agent-dag.releaseNotesSeen";function iD(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function _o(e,t){const n=iD(e),a=iD(t);for(let i=0;i<Math.max(n.length,a.length);i++){const o=(n[i]??0)-(a[i]??0);if(o!==0)return o<0?-1:1}return 0}function ti(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function UAe(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 BAe(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,a]of Object.entries(e)){if(!ti(n)||!Array.isArray(a))continue;const i=a.filter(UAe).map(c=>({title:c.title,body:c.body,...typeof c.details=="string"&&c.details.trim()?{details:c.details}:{},...c.priority==="highlight"||c.priority==="required"?{priority:c.priority}:{},...typeof c.notice=="string"&&c.notice.trim()?{notice:c.notice}:{},...typeof c.notice=="string"&&c.notice.trim()&&typeof c.noticeLabel=="string"&&c.noticeLabel.trim()&&c.noticeLabel.length<=32?{noticeLabel:c.noticeLabel}:{},...c.icon==="plans"||c.icon==="accounts"||c.icon==="skills"?{icon:c.icon}:{}})),o=e["//summaries"],r=o&&typeof o=="object"&&Object.hasOwn(o,n)?o[n]:void 0;i.length&&t.push({version:n,notes:i,...typeof r=="string"&&r.trim()?{summary:r}:{}})}return t.sort((n,a)=>_o(a.version,n.version))}function HAe(e){const t=e.filter(o=>o.priority==="highlight").slice(0,3),n=t.length>0,a=e.filter(o=>!t.includes(o)&&(!n||o.priority==="required"||o.priority==="highlight"||!!o.notice)),i=e.filter(o=>!t.includes(o)&&!a.includes(o));return{highlights:t,visible:a,more:i}}function WAe(e,t,n){const[a,...i]=e;if(!t)return{latest:ti(n)?e.find(c=>_o(c.version,n)===0):a,visiblePrevious:[],history:[]};const o=[],r=[];for(const c of i){const d=c.notes.some(g=>g.priority==="highlight"||g.priority==="required"||!!g.notice),u=c.notes.filter(g=>!d||g.priority==="required"||!!g.notice);u.length&&o.push({version:c.version,notes:u});const h=c.notes.filter(g=>!u.includes(g));h.length&&r.push({...c,notes:h})}return{latest:a,visiblePrevious:o,history:r}}const oD=BAe(FAe);function n5(e,t,n){return e.filter(a=>_o(a.version,n)<=0&&(t===null||_o(a.version,t)>0))}function GAe(e,t){return e.filter(n=>_o(n.version,t)===0)}function $Ae(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 VAe=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function a5(e){const t=VAe.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function KAe(e){if(!e)return null;let t=null;try{t=e.getItem(n0)}catch{return null}return ti(t)?t:null}function JAe(e){if(!e)return!1;try{return e.getItem(n0),!0}catch{return!1}}function YAe(e,t){if(!e)return!1;try{return e.setItem(n0,t),!0}catch{return!1}}const s5="agent-dag.tourSeen";function ZAe(e){if(!e)return!1;try{return e.getItem(s5)==="1"}catch{return!1}}function XAe(e){if(!e)return!1;try{return e.setItem(s5,"1"),!0}catch{return!1}}function QAe({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 eTe({stored:e,running:t,notes:n,remembers:a=!0}){if(!ti(t))return{show:[],record:null,reason:"no-version"};if(!ti(e)){if(!a)return{show:[],record:t,reason:"cannot-remember"};const r=GAe(n,t);return r.length?{show:r,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=_o(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const o=n5(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function tTe(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const a=e.indexOf("`",n+1);if(a<0)break;n=a+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function mu(e,t=!0){const n=[];let a="";const i=()=>{a&&(n.push({kind:"text",text:a}),a="")};let o=0;for(;o<e.length;){if(e[o]==="`"){const r=e.indexOf("`",o+1);if(r>o+1){i(),n.push({kind:"code",text:e.slice(o+1,r)}),o=r+1;continue}}else if(t&&e.startsWith("**",o)){const r=tTe(e,o);if(r>0){i(),n.push({kind:"bold",kids:mu(e.slice(o+2,r),!1)}),o=r+2;continue}}a+=e[o],o+=1}return i(),n}function zo(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const nTe=()=>x("shell.update.checkWhy"),rD=()=>x("shell.update.checking"),aTe=()=>x("shell.update.npmUnreachable"),sTe=()=>x("shell.update.deckUnreachable"),iTe=()=>x("shell.update.checksOff"),oTe=()=>x("shell.update.pendingRetry");function rTe(e,t,n,a){const i=a?t.npx:n?un(t,n):void 0;return i?x("shell.update.outBlocked",{to:e,reason:i}):x("shell.update.outRun",{to:e})}const ca=(e,t={})=>({said:e,tone:"answer",age:null,command:null,action:null,...t}),br=e=>ca(e,{tone:"note"});function cD(e,t){return xNe(t-e)}function cTe(e,t){const n=e.update;return(n==null?void 0:n.status)==="ready"?br(x("shell.update.appReady",{version:n.version??""})):(n==null?void 0:n.status)==="checking"?br(x("shell.update.appChecking")):(n==null?void 0:n.status)==="downloading"?br(n.version?x("shell.update.appDownloadingVersion",{version:n.version}):x("shell.update.appDownloading")):(n==null?void 0:n.status)==="current"?br(x("shell.update.appCurrent",{version:e.version??t})):(n==null?void 0:n.status)==="error"?br(x("shell.update.appError")):br(x("shell.update.appIdle"))}function lTe(e,t,n){var r;const a=e.version;if((a==null?void 0:a.upgradeMode)==="install"&&e.upgradeState!=="failed"){if(e.upgradeState==="done")return ca(x("shell.update.installed",{to:t}));const c=e.upgradeState==="running",d=x("shell.update.installWhy",{command:((r=a.upgrade)==null?void 0:r.command)??a.command});return ca(c?x("shell.update.installing",{to:t}):x("shell.update.out",{to:t}),{action:{kind:"install",label:x("shell.update.now"),busy:c,why:d}})}if((a==null?void 0:a.upgradeMode)==="npx"&&a.canRestart){const c=e.upgradeState==="failed";return ca(c?x("shell.update.npxFailedBack",{to:t,running:e.running}):x("shell.update.out",{to:t}),{action:{kind:"npx",label:x(c?"shell.update.retry":"shell.update.andRestart"),busy:e.restarting,why:x("shell.update.npxWhy",{command:a.command})}})}const i=e.upgradeState==="failed"?x("shell.update.installFailed",{to:t}):rTe(t,n,a==null?void 0:a.upgradeBlocked,(a==null?void 0:a.upgradeMode)==="npx"),o=(a==null?void 0:a.command)??null;return ca(i,{command:o,action:o?{kind:"copy",label:e.copied?x("shell.copied"):x("shell.copy"),busy:!1}:null})}function dTe(e){const t=e.version;if(e.unreachable)return ca(sTe(),{tone:"warn"});const n=t!=null&&t.checkFailedAt&&t.checkFailedAt>(t.checkedAt??0)?t.checkFailedAt:null;if(n)return ca(aTe(),{tone:"warn",age:e.answered?null:x("shell.update.lastTried",{ago:cD(n,e.now)})});const a=t!=null&&t.latestPending&&t.latestPending!==e.running?t.latestPending:null;if(a)return ca(x("shell.update.pending",{pending:a,retry:oTe()}));const i=t!=null&&t.checkedAt?cD(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)&&ti(t.latest)&&ti(e.running)){const r=_o(t.latest,e.running),c=r===0?x("shell.update.latest",{version:e.running}):r<0?x("shell.update.ahead",{running:e.running,latest:t.latest}):x("shell.update.out",{to:t.latest});return ca(c,{age:i?x("shell.update.checkedAgo",{ago:i}):null})}return ca(x(i?"shell.update.mayHaveChanged":"shell.update.noneYet"),{age:i?x("shell.update.lastChecked",{ago:i}):null})}function uTe(e,t){var i,o;const n=e.version;if((i=e.app)!=null&&i.inApp&&(n!=null&&n.checkDisabled)){const r=cTe(e.app,e.running);return r&&{canCheck:!0,checking:e.checking||((o=e.app.update)==null?void 0:o.status)==="checking",line:e.unreachable?ca(x("shell.update.appRefused"),{tone:"warn"}):e.checking?ca(rD()):r}}if(n!=null&&n.checkDisabled)return{canCheck:!1,checking:!1,line:br(iTe())};const a=(n==null?void 0:n.notice)??null;if((a==null?void 0:a.kind)==="upgrade")return{canCheck:!0,checking:e.checking,line:lTe(e,a.to,t)};if((a==null?void 0:a.kind)==="restart"){const r=n!=null&&n.canRestart?x("shell.update.restartDeck",{to:a.to}):x("shell.update.restartApp",{to:a.to});return{canCheck:!0,checking:e.checking,line:ca(r)}}return e.checking?{canCheck:!0,checking:!0,line:ca(rD())}:{canCheck:!0,checking:!1,line:dTe(e)}}const i5=450;async function hTe(e,t=n=>new Promise(a=>setTimeout(a,n))){const[n]=await Promise.all([e(!0),t(i5)]);return n?"answered":"unreachable"}async function pTe(e=fetch){try{const[t]=await Promise.all([e("/api/desktop-update/check",{method:"POST",signal:AbortSignal.timeout(8e3)}),new Promise(n=>setTimeout(n,i5))]);return t.ok?"answered":"unreachable"}catch{return"unreachable"}}const gTe=()=>x("shell.notes.restartWhy");function mTe(e){var _,I,z;Aa();const t=(e==null?void 0:e.versionCheck.versionChecking)??!1,n=si(3e4),[a,i]=m.useState(!1),o=m.useRef(!1),[r,c]=m.useState(!1),[d,u]=m.useState(!1),h=m.useRef(t);if(m.useEffect(()=>{h.current&&!t&&u(!0),h.current=t},[t]),!e)return null;const{versionCheck:g,upgrade:f,restart:b,desktopUpdate:k,running:y,onHandOff:N}=e,w=uTe({version:g.version,running:y,checking:a||t,answered:d,unreachable:r,now:Math.max(n,Date.now()),upgradeState:f.upgradeState,copied:f.cmdCopied,restarting:b.restarting,app:{inApp:zo(),update:k.appUpdate,version:MW(),menu:DW()}},Rj);if(!w)return null;const j=zo()&&((_=g.version)==null?void 0:_.checkDisabled),S=j?x("shell.update.checkWhyApp"):nTe(),A=async()=>{var U;if(!Qn(o.current||t)||j&&((U=k.appUpdate)==null?void 0:U.status)==="checking")return;o.current=!0,i(!0);const F=j?await pTe():await hTe(g.loadVersion);o.current=!1,i(!1),c(F==="unreachable"),u(!0)},T=F=>{if(F.kind==="copy")return void f.copyCommand();N(),g.showNotice(),F.kind==="install"?f.startUpgrade():b.askRestart({upgrade:!0})},q=w.line.tone==="warn"||!!w.line.action||!!((I=g.version)!=null&&I.notice)||((z=k.appUpdate)==null?void 0:z.status)==="downloading";return{state:w,check:A,act:T,checkWhy:S,needsAttention:q}}function fTe({update:e}){const t=ql("above","dialog"),n=m.useId();return Aa(),s.jsxs("div",{className:"rn-status-row",children:[e?s.jsx(bTe,{line:e.state.line,onAct:e.act,bindHint:t.bind,whyId:`${n}-action`,announce:!1}):s.jsx("p",{className:"rn-update-line",children:s.jsx("span",{role:"status",children:x("shell.notes.statusUnavailable")})}),t.node]})}function bTe({line:e,onAct:t,bindHint:n,whyId:a,announce:i=!0}){const{action:o}=e,r=o&&s.jsx(vTe,{action:o,onAct:t,bindHint:n,whyId:a});return s.jsxs("p",{className:"rn-update-line","data-tone":e.tone,children:[s.jsx("span",{className:"rn-update-what",role:i?"status":void 0,children:e.said}),e.age&&s.jsx("span",{className:"rn-update-age",children:e.age}),e.command?s.jsxs("span",{className:"rn-update-cmd",children:[s.jsx("code",{className:"rn-code",children:e.command}),r]}):r]})}function vTe({action:e,onAct:t,bindHint:n,whyId:a}){const i=e.kind==="copy"?null:e.why;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:i?"btn primary rn-line-act":"btn rn-line-act",onClick:()=>t(e),"aria-busy":e.busy||void 0,"aria-describedby":i&&a?a:void 0,...i&&n?n({label:i}):{},children:e.label}),i&&a&&s.jsx("span",{hidden:!0,id:a,children:i})]})}function kTe({entries:e,since:t,running:n,firstRun:a,onClose:i,onTour:o,updateVersion:r,updateBusy:c,onUpdateRestart:d,updateFailure:u,onRestart:h,updateCheck:g}){var O,D;const f=se(),b=gTe(),k=Tt(i),y=m.useRef(null),N=Rt(i),w=m.useId(),[j,S]=m.useState(null),A=mTe(g),T=((O=A==null?void 0:A.state.line.action)==null?void 0:O.kind)==="install"||((D=A==null?void 0:A.state.line.action)==null?void 0:D.kind)==="npx",q=h&&!r&&!T,{latest:_,visiblePrevious:I,history:z}=WAe(e,t!==null,n),F=`${w}-history`,U=!!q||!!(A!=null&&A.state.canCheck)&&!r;m.useEffect(()=>{var $;!U&&j&&(S(null),document.activeElement===document.body&&(($=y.current)==null||$.focus()))},[U,j]);const P=ti(n)?`v${n}`:$Ae(e.slice(0,1)),L=a&&n?f("shell.notes.contextFirst",{version:n}):t?f("shell.notes.contextSince",{since:t}):null,R=I.some($=>$.notes.some(B=>!B.priority&&!B.notice));return s.jsx("div",{className:"modal-backdrop",...N,role:"presentation",children:s.jsxs("div",{ref:k,className:"modal release-notes",id:`${w}-dialog`,onClick:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:f("shell.notes.title")}),P&&s.jsx("span",{className:"modal-tool-id",children:P})]}),s.jsxs("div",{className:"modal-actions",children:[U&&s.jsx("button",{id:`${w}-options`,type:"button",className:"glyph-btn","aria-label":f("shell.notes.moreOptions"),"aria-haspopup":"menu","aria-expanded":j!==null,"aria-controls":j?`${w}-menu`:void 0,onClick:()=>S(j?null:"first"),onKeyDown:$=>{($.key==="ArrowDown"||$.key==="ArrowUp")&&($.preventDefault(),S($.key==="ArrowUp"?"last":"first"))},children:s.jsxs("svg",{className:"glyph",viewBox:"0 0 14 14",width:"14",height:"14",fill:"currentColor","aria-hidden":"true",children:[s.jsx("circle",{cx:"3",cy:"7",r:"1"}),s.jsx("circle",{cx:"7",cy:"7",r:"1"}),s.jsx("circle",{cx:"11",cy:"7",r:"1"})]})}),s.jsx("button",{ref:y,type:"button",className:"glyph-btn",onClick:i,"aria-label":f("shell.closeEsc"),title:f("shell.closeEsc"),children:"×"})]})]}),s.jsx("span",{className:"rn-live-status",role:"status",children:r?f("shell.notes.downloaded",{version:r}):A==null?void 0:A.state.line.said}),s.jsxs("section",{className:"modal-body",role:"region","aria-label":f("shell.notes.region"),tabIndex:0,children:[r?s.jsxs("div",{className:"rn-ready",children:[s.jsx("p",{children:f("shell.notes.downloaded",{version:r})}),s.jsx("p",{className:"rn-update-said",role:"status",children:u})]}):s.jsxs(s.Fragment,{children:[(A==null?void 0:A.needsAttention)&&s.jsx(fTe,{update:A}),s.jsx("p",{className:"rn-update-said",role:"status",children:u})]}),L&&s.jsx("p",{className:"rn-context",children:L}),!(_!=null&&_.notes.length)&&!I.length&&s.jsx("p",{className:"rn-empty",children:f("shell.notes.empty")}),_&&s.jsx(WS,{entry:_,showVersion:t!==null&&e.length>1},_.version),I.length>0&&s.jsxs("section",{className:"rn-upgrade-history","aria-label":f("shell.notes.earlierLabel"),children:[s.jsx("h2",{className:"rn-group-title",children:f("shell.notes.earlierTitle")}),R&&s.jsx("p",{className:"rn-context",children:f("shell.notes.legacy")}),I.map($=>s.jsx(WS,{entry:$,showVersion:!0},$.version))]}),z.length>0&&s.jsxs("details",{className:"rn-history",children:[s.jsx("summary",{"aria-controls":F,children:f("shell.notes.otherSince",{since:t??""})}),s.jsx("div",{id:F,children:z.map($=>s.jsx(WS,{entry:$,showVersion:!0},$.version))})]})]}),s.jsxs("footer",{className:"rn-footer",children:[s.jsxs("div",{className:"rn-footer-links",children:[s.jsxs("a",{href:"https://ccdeck.dev/changelog/",target:"_blank",rel:"noopener noreferrer","aria-label":f("shell.notes.historyLabel"),children:[f("shell.notes.history")," ",s.jsx(xl,{})]}),o&&!r&&s.jsx("button",{className:"rn-text-button",type:"button",onClick:o,children:f("shell.notes.tour")})]}),r&&d?s.jsx("button",{className:"btn primary",type:"button",onClick:d,"aria-busy":c||void 0,children:c?f("shell.notes.restarting"):Hu()}):s.jsx("button",{className:"btn primary",type:"button",onClick:i,children:f("shell.done")})]}),j&&U&&s.jsxs(Wr,{anchorId:`${w}-options`,portalRootId:`${w}-dialog`,id:`${w}-menu`,role:"menu",labelledBy:`${w}-options`,start:j,className:"ap-pop rn-options-menu",onClose:()=>S(null),children:[A&&s.jsxs("p",{className:"rn-menu-status",id:`${w}-check-status`,children:[A.state.line.said,A.state.line.age&&s.jsx("span",{children:A.state.line.age})]}),(A==null?void 0:A.state.canCheck)&&s.jsxs("button",{type:"button",className:"ap-menu-item rn-act",role:"menuitem",title:A.checkWhy,"aria-describedby":`${w}-check-status`,"aria-busy":A.state.checking||void 0,onClick:()=>void A.check(),children:[s.jsx(doe,{}),f("shell.notes.check")]}),(A==null?void 0:A.state.canCheck)&&q&&s.jsx("div",{className:"rn-menu-separator",role:"separator"}),q&&s.jsxs("button",{type:"button",className:"ap-menu-item",role:"menuitem",title:b,"aria-describedby":`${w}-restart-why`,onClick:()=>{S(null),h==null||h()},children:[s.jsx(uoe,{}),f("shell.notes.restart")]}),s.jsx("span",{hidden:!0,id:`${w}-restart-why`,children:b})]})]})})}function WS({entry:e,showVersion:t}){const n=se(),{highlights:a,visible:i,more:o}=HAe(e.notes),r=a.filter(d=>d.details),c=m.useId();return s.jsxs("section",{className:"rn-release",children:[t&&s.jsxs("h2",{className:"rn-version",children:["v",e.version]}),e.summary&&s.jsx("h2",{className:"rn-summary",children:e.summary}),s.jsxs("ul",{className:"rn-notes",children:[a.map((d,u)=>s.jsx(GS,{note:d,highlight:!0},`h${u}`)),i.map((d,u)=>s.jsx(GS,{note:d},`v${u}`))]}),(o.length>0||r.length>0)&&s.jsxs("details",{className:"rn-more",children:[s.jsxs("summary",{"aria-controls":c,children:[s.jsxs("span",{className:"rn-more-start",children:[s.jsx("span",{className:"rn-chevron","aria-hidden":"true",children:"›"}),s.jsx("span",{className:"rn-more-label",children:o.length?n("shell.notes.more",{count:o.length}):n("shell.notes.moreDetails")})]}),s.jsxs("span",{className:"rn-more-hint",children:[s.jsx("span",{className:"rn-show-details",children:n("shell.notes.show")}),s.jsx("span",{className:"rn-hide-details",children:n("shell.notes.hide")})]})]}),s.jsxs("div",{id:c,children:[s.jsx("ul",{className:"rn-notes",children:o.map((d,u)=>s.jsx(GS,{note:d},u))}),r.length>0&&s.jsxs("div",{className:"rn-highlight-details",role:"group","aria-labelledby":`${c}-highlights`,children:[s.jsx("h3",{id:`${c}-highlights`,className:"rn-details-title",children:n("shell.notes.aboutHighlights")}),r.map((d,u)=>s.jsxs("p",{className:"rn-note-body",children:[s.jsxs("strong",{className:"rn-strong",children:[a5(d.title).rest.trimStart(),": "]}),fu(mu(d.details))]},u))]})]})]})]})}const wTe={plans:pB,accounts:gB,skills:mB};function GS({note:e,highlight:t}){const n=se(),{icon:a,rest:i}=a5(e.title),o=!a&&e.icon?un(wTe,e.icon):void 0;return s.jsxs("li",{className:"rn-note","data-highlight":t||void 0,"data-required":e.priority==="required"||void 0,"data-has-icon":!!o||void 0,children:[o&&s.jsx("span",{className:"rn-title-icon","aria-hidden":"true",children:s.jsx(o,{})}),s.jsxs("div",{children:[s.jsxs("h3",{className:"rn-note-title",children:[a&&s.jsx("span",{className:"rn-note-icon",children:a}),a?i:i.trimStart()]}),s.jsx("p",{className:"rn-note-body",children:fu(mu(e.body))}),!t&&e.details&&s.jsx("p",{className:"rn-note-body rn-extra-detail",children:fu(mu(e.details))}),e.notice&&s.jsxs("p",{className:"rn-note-notice",children:[s.jsxs("strong",{children:[e.noticeLabel??n("shell.notes.important"),": "]}),fu(mu(e.notice))]})]})]})}function fu(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?s.jsx("code",{className:"rn-code",children:t.text},n):s.jsx("strong",{className:"rn-strong",children:fu(t.kids)},n))}function yTe({state:e,sessionId:t,onClose:n}){const a=se(),i=m.useMemo(()=>xTe(e,t),[e,e.revision,t]),o=m.useRef(null),r=Tt(n,{focusRef:o}),c=Rt(n);return i?s.jsx("div",{className:"modal-backdrop",...c,role:"presentation",children:s.jsxs("div",{ref:r,className:"modal session-summary",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[s.jsxs("div",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:a("insights.summary.done")}),s.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),s.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("span",{className:"modal-dur",title:a("insights.summary.wall"),children:i.durationLabel}),s.jsx("button",{type:"button",ref:o,className:"glyph-btn",onClick:n,"aria-label":a("insights.audit.closeEsc"),title:a("insights.audit.closeEsc"),children:"×"})]})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("section",{className:"ss-hero",children:[s.jsxs("div",{className:"ss-hero-left",children:[s.jsx("div",{className:"ss-cost-label",children:Sle()}),s.jsx("div",{className:"ss-cost",children:Nt(i.cost.total)}),i.modelChips.length>0&&s.jsx("div",{className:"ss-models",children:i.modelChips.map(d=>s.jsx("span",{className:"model-chip","data-family":Mm(d),title:d,children:So(d)},d))})]}),s.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&s.jsxs(s.Fragment,{children:[s.jsx(tT,{cost:i.cost,size:"lg"}),s.jsxs("div",{className:"ss-cost-legend",children:[s.jsxs("span",{className:"ssl ssl-in",children:[a("insights.cost.input")," ",s.jsx("b",{children:Nt(i.cost.input)})]}),s.jsxs("span",{className:"ssl ssl-out",children:[a("insights.cost.output")," ",s.jsx("b",{children:Nt(i.cost.output)})]}),s.jsxs("span",{className:"ssl ssl-cr",children:[a("insights.summary.cacheR")," ",s.jsx("b",{children:Nt(i.cost.cacheRead)})]}),s.jsxs("span",{className:"ssl ssl-cw",children:[a("insights.summary.cacheW")," ",s.jsx("b",{children:Nt(i.cost.cacheWrite)})]})]})]})})]}),s.jsxs("section",{className:"ss-stats",children:[s.jsx(Fc,{label:a("insights.summary.agents"),value:i.agentCount}),s.jsx(Fc,{label:a("insights.summary.subagents"),value:i.subagentCount}),s.jsx(Fc,{label:a("insights.summary.toolCalls"),value:i.toolCount}),s.jsx(Fc,{label:a("insights.summary.prompts"),value:i.promptCount}),s.jsx(Fc,{label:a("insights.usage.tokens"),value:i.tokensSum.toLocaleString(Le())}),i.errCount>0&&s.jsx(Fc,{label:a("insights.summary.errors"),value:i.errCount,tone:"err"})]}),i.topTools.length>0&&s.jsxs("section",{className:"modal-section",children:[s.jsx("h4",{children:a("insights.summary.topTools")}),s.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([d,u])=>s.jsxs("div",{className:"ss-tt",children:[s.jsx("span",{className:"ss-tt-name",children:d}),s.jsx("span",{className:"ss-tt-bar",children:s.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/i.topTools[0][1]*100}%`}})}),s.jsx("span",{className:"ss-tt-count",children:u})]},d))})]}),i.firstPrompt&&s.jsxs("section",{className:"modal-section",children:[s.jsx("h4",{children:a("insights.summary.opening")}),s.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function Fc({label:e,value:t,tone:n}){return s.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[s.jsx("div",{className:"ss-stat-value",children:t}),s.jsx("div",{className:"ss-stat-label",children:e})]})}function xTe(e,t){const n=e.agents.get(t);if(!n)return null;const a=[];for(const S of e.agents.values())S.sessionId===t&&a.push(S);if(a.length===0)return null;const i={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},o=new Set,r=new Map;let c=0,d=0,u=0,h=0,g=0,f,b=1/0,k=0;for(const S of a){const A=pa(S);i.input+=A.input,i.output+=A.output,i.cacheRead+=A.cacheRead,i.cacheWrite+=A.cacheWrite,i.total+=A.total;for(const q of Y2(S))o.add(q);S.model&&o.add(S.model),S.kind==="subagent"&&g++;const T=S2(S.prompts);d+=T.length,!f&&T.length>0&&(f=T[0].text),u+=S.usage.inputTokens+S.usage.outputTokens,c+=S.toolCount,h+=S.toolErrorCount??0;for(const[q,_]of S.toolCountByName??[])r.set(q,(r.get(q)??0)+_);b=Math.min(b,S.startedAt),k=Math.max(k,S.endedAt??Date.now())}const y=Math.max(0,k-b),N=Math.floor(y/1e3),w=N<60?`${N}s`:N<3600?`${Math.floor(N/60)}m ${String(N%60).padStart(2,"0")}s`:`${Math.floor(N/3600)}h ${Math.floor(N%3600/60)}m`,j=Array.from(r.entries()).sort((S,A)=>A[1]-S[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||x("insights.summary.session"),cwd:n.cwd,durationLabel:w,cost:i,modelChips:Array.from(o),agentCount:a.length,subagentCount:g,toolCount:c,promptCount:d,tokensSum:u,errCount:h,topTools:j,firstPrompt:f}}function Kt({id:e,title:t,note:n,noteId:a,aside:i,list:o=!0,settingId:r,className:c,children:d}){const u=c?`settings-group ${c}`:"settings-group",h=o?s.jsx("div",{className:"settings-list",children:d}):d;return t===void 0?s.jsx("div",{className:u,"data-setting":r,children:h}):s.jsxs("section",{className:u,"aria-labelledby":e,"data-setting":r,children:[s.jsxs("div",{className:"settings-caption",children:[s.jsxs("div",{className:"settings-caption-text",children:[s.jsx("h3",{id:e,children:t}),n&&s.jsx("p",{className:"settings-caption-note",id:a,children:n})]}),i]}),h]})}function Ct({name:e,nameId:t,note:n,noteId:a,control:i,as:o="label",settingId:r,className:c,details:d,children:u}){const h=se(),g=o,f=s.jsxs(g,{className:c?`settings-row ${c}`:"settings-row","data-setting":r,children:[s.jsx("span",{className:"settings-row-name",id:t,children:e}),n&&s.jsx("span",{className:"settings-row-note",id:a,children:n}),i!==void 0&&s.jsx("span",{className:"settings-row-control",children:i}),u]});return d?s.jsxs("div",{className:"settings-row-with-details",children:[f,s.jsxs("details",{className:"settings-row-details",children:[s.jsxs("summary",{children:[h("common.details"),s.jsxs("span",{className:"vis-hidden",children:[h("common.aboutBefore"),e,h("common.aboutAfter")]})]}),s.jsx("div",{children:d})]})]}):f}function CTe(){const e=se(),t=Aa();return s.jsx(Kt,{id:"settings-language-caption",title:e("settings.language.group"),children:s.jsx(Ct,{settingId:"language",name:e("settings.language.name"),nameId:"settings-language-label",note:e("settings.language.note"),noteId:"settings-language-note",control:s.jsx("select",{className:"sm-select",value:t,"aria-labelledby":"settings-language-label","aria-describedby":"settings-language-note",onChange:n=>JX(n.target.value),children:Al.map(n=>s.jsx("option",{value:n.code,lang:n.code,dir:n.dir,children:WX(n)},n.code))})})})}function o5(e,t,n){const[a,i]=m.useState(null),[o,r]=m.useState(!1),[c,d]=m.useState(""),u=m.useRef(!1),h=f=>typeof f=="boolean"?f:t;return m.useEffect(()=>{let f=!0;return fetch("/api/prefs").then(b=>{if(!b.ok)throw new Error;return b.json()}).then(b=>{var k;if(!b.ok)throw new Error;f&&i(h((k=b.prefs)==null?void 0:k[e]))}).catch(()=>{f&&d(n("settings.recover.readFail"))}),()=>{f=!1}},[e]),{enabled:a,busy:o,error:c,change:async()=>{if(!(a===null||!Qn(u.current))){u.current=!0,r(!0),d("");try{const f=await fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[e]:!a})});if(!f.ok)throw new Error;const b=await f.json();if(!b.ok)throw new Error;i(h(b.prefs[e]))}catch{d(n("settings.recover.saveFail"))}finally{u.current=!1,r(!1)}}}}}function lD({provider:e}){const t=e==="Codex"?"recoverCodexSessions":"recoverClaudeSessions",n=`${e.toLowerCase()}-session-recovery`,a=se(),i=o5(t,!0,a);return s.jsxs(Kt,{id:`${n}-title`,title:a("settings.recover.group",{provider:e}),children:[s.jsx(Ct,{settingId:n,name:a("settings.recover.name"),note:a(e==="Codex"?"settings.recover.codexNote":"settings.recover.claudeNote"),details:a(e==="Codex"?"settings.recover.codexDetails":"settings.recover.claudeDetails"),control:s.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":a(e==="Codex"?"settings.recover.codexAria":"settings.recover.claudeAria"),"aria-checked":i.enabled===!0,...ua(i.busy,i.enabled===null),onClick:()=>{i.change()},children:s.jsx("span",{className:"switch-knob"})})}),i.error&&s.jsx("p",{role:"alert",children:i.error}),e==="Claude"&&s.jsx(STe,{t:a})]})}function STe({t:e}){const t=o5("continueStopped",!1,e);return s.jsxs(s.Fragment,{children:[s.jsx(Ct,{settingId:"claude-continue-stopped",name:e("settings.recover.continueName"),note:e("settings.recover.continueNote"),details:e("settings.recover.continueDetails"),control:s.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":e("settings.recover.continueAria"),"aria-checked":t.enabled===!0,...ua(t.busy,t.enabled===null),onClick:()=>{t.change()},children:s.jsx("span",{className:"switch-knob"})})}),t.error&&s.jsx("p",{role:"alert",children:t.error})]})}function NTe(){const e=se(),t=bW();return s.jsx(Kt,{id:"settings-board-caption",title:e("settings.board.title"),children:s.jsx(Ct,{settingId:"hide-finished",name:e("settings.board.hideLabel"),nameId:"settings-hide-finished-label",note:e("settings.board.hideNote"),details:e("settings.board.hideDetails"),noteId:"settings-hide-finished-note",control:s.jsx("select",{className:"sm-select",value:t,"aria-labelledby":"settings-hide-finished-label","aria-describedby":"settings-hide-finished-note",onChange:n=>gCe(Number(n.target.value)),children:pW.map(n=>s.jsx("option",{value:n,children:n===0?e("settings.board.never"):e("settings.board.minutes",{n})},n))})})})}const jTe="Codex accounts",ATe="Your Codex profiles and what each has left, and which one new sessions use.";function TTe({claudeHere:e,codexHere:t=!1,singleKeys:n,doors:a}){const i=se();return s.jsxs(Kt,{id:"settings-elsewhere-caption",title:i("lan.ew.group"),children:[(e||t)&&s.jsx($S,{settingId:"accounts",name:e?i("lan.ew.accounts"):jTe,note:e?i("lan.ew.accountsNote"):ATe,onOpen:a.accounts,cap:n?{key:"A",title:i("lan.ew.pressA")}:null}),e&&s.jsx($S,{settingId:"local-network",name:i("lan.ew.lan"),note:i("lan.ew.lanNote"),onOpen:a.localNetwork,cap:null}),s.jsx($S,{settingId:"browser-watch",name:i("lan.ew.watch"),note:i("lan.ew.watchNote"),onOpen:a.browserWatch,dialog:!0,cap:n?{key:"B",title:i("lan.ew.pressB")}:null})]})}function $S({settingId:e,name:t,note:n,onOpen:a,cap:i,dialog:o=!1}){const r=se(),c=`settings-${e}`;return s.jsx(Ct,{as:"div",settingId:e,name:t,nameId:`${c}-name`,note:n,control:s.jsxs(s.Fragment,{children:[i&&s.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:i.title,children:i.key}),s.jsx("button",{type:"button",className:"btn",id:`${c}-open`,"aria-labelledby":`${c}-open ${c}-name`,"aria-haspopup":o?"dialog":void 0,"aria-keyshortcuts":i?i.key:void 0,onClick:a,children:r("lan.ew.open")})]})})}function RTe(e){const t=e.binds.includes("?")?x("settings.keyboard.sheetName"):e.action;return t.charAt(0).toUpperCase()+t.slice(1)}function ETe(e,t){const n=t.trim().toLowerCase();return n?[e.action,e.cap,e.macCap??""].some(a=>a.toLowerCase().includes(n)):!0}function qTe({singleKeys:e,onToggleSingleKeys:t}){const n=se(),a=Po(Ao()),[i,o]=m.useState(""),r=m.useId(),c=hh(),d=e5(e,u=>Ai(c,u)).map(u=>({...u,rows:u.rows.filter(h=>ETe(h,i))})).filter(u=>u.rows.length>0);return s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Ct,{settingId:"single-keys",name:n("settings.keyboard.singleKeys"),nameId:"settings-single-keys-label",note:n("settings.keyboard.singleKeysNote"),noteId:"settings-single-keys-note",control:s.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:s.jsx("span",{className:"switch-knob"})})})}),s.jsxs("div",{className:"settings-filter",children:[s.jsx("label",{className:"vis-hidden",htmlFor:r,children:n("settings.keyboard.filter")}),s.jsx("input",{id:r,type:"search",className:"settings-filter-field",placeholder:n("settings.keyboard.filter"),autoComplete:"off",spellCheck:!1,value:i,onChange:u=>o(u.target.value),onKeyDown:u=>{Bm(u.key)&&i&&(u.stopPropagation(),o(""))}})]}),d.map(u=>{const h=`settings-keys-${u.id}`;return s.jsx(Kt,{id:h,title:u.title,className:"settings-keys",children:u.rows.map(g=>s.jsx(Ct,{as:"div",name:RTe(g),control:s.jsx("kbd",{className:"settings-key",children:a&&g.macCap?g.macCap:g.cap})},`${g.cap}:${g.action}`))},u.id)}),d.length===0&&s.jsx("p",{className:"settings-empty",role:"status",children:n("settings.keyboard.noMatch",{query:i.trim()})}),i.trim()===""&&s.jsx("p",{className:"settings-foot",children:n("settings.key.note")})]})}function _Te({notifyOn:e,onToggleNotify:t,notifyVetoed:n,notifyPermission:a,onAskNotify:i,accountNotify:o,onToggleAccountNotify:r}){const c=se(),d=dre(a,c),u=zo(),h=e&&!n&&!u,g=m.useRef(null),f=Vs(!d.ask,g);return s.jsxs(s.Fragment,{children:[s.jsxs(Kt,{id:"sm-closed-caption",title:c("settings.notify.closedGroup"),children:[s.jsx(Ct,{settingId:"notify-closed",name:c("settings.notify.closedName"),nameId:"sm-notify-label",note:n?c("settings.notify.veto"):lre(u,c),noteId:"sm-notify-note",control:s.jsx("button",{ref:g,type:"button",role:"switch","aria-checked":e,"aria-labelledby":"sm-notify-label","aria-describedby":"sm-notify-note",className:"switch",onClick:t,children:s.jsx("span",{className:"switch-knob"})})}),h&&s.jsx(Ct,{as:"div",name:c("settings.notify.browserName"),nameId:"sm-channel-name",note:d.note,control:d.ask?s.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:()=>{f(),i()},children:c("settings.notify.enable")}):s.jsxs("span",{className:"sm-channel-state","data-ok":d.ok||void 0,children:[d.ok&&s.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:s.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),d.status]})})]}),s.jsx(Kt,{id:"sm-accounts-caption",title:c("settings.notify.accountsGroup"),note:c(n?"settings.notify.accountsVeto":"settings.notify.accountsNote"),children:ON.map(({kind:b,label:k,title:y})=>s.jsx(Ct,{settingId:b,name:k,nameId:`sm-${b}-label`,note:y,noteId:`sm-${b}-note`,control:s.jsx("button",{type:"button",role:"switch","aria-checked":o[b],"aria-labelledby":`sm-${b}-label`,"aria-describedby":`sm-${b}-note`,className:"switch",onClick:()=>r(b),children:s.jsx("span",{className:"switch-knob"})})},b))})]})}const zTe=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function LTe(e){return zTe.find(t=>e(t))}const OTe=4400;function PTe(e){const t=e.split(";")[0],n=t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm";return{name:`${x("radio.rec.name")}.${n}`,type:t}}function MTe({full:e,setCustomError:t,runCustom:n,onImportCustom:a}){const[i,o]=m.useState(!1),r=m.useRef(null),c=m.useRef(null),d=m.useRef(!1),u=()=>{var g;c.current!==null&&clearTimeout(c.current),c.current=null,((g=r.current)==null?void 0:g.state)==="recording"&&r.current.stop()},h=async()=>{var f;if(e)return;if(t(""),!((f=navigator.mediaDevices)!=null&&f.getUserMedia)||typeof MediaRecorder>"u"){t(x("radio.rec.noMic"));return}let g;try{g=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{d.current||t(x("radio.rec.denied"));return}if(d.current||r.current){g.getTracks().forEach(b=>b.stop());return}try{const b=LTe(N=>MediaRecorder.isTypeSupported(N)),k=new MediaRecorder(g,b?{mimeType:b}:void 0),y=[];r.current=k,k.ondataavailable=N=>{N.data.size&&y.push(N.data)},k.onerror=()=>t(x("radio.rec.failed")),k.onstop=()=>{g.getTracks().forEach(S=>S.stop()),c.current!==null&&clearTimeout(c.current),c.current=null;const N=r.current===k;if(N&&(r.current=null),o(!1),!N||!y.length)return;const w=PTe(k.mimeType),j=new File(y,w.name,{type:w.type});n(()=>a(j))},k.start(200),o(!0),c.current=setTimeout(u,OTe)}catch{r.current=null,g.getTracks().forEach(b=>b.stop()),t(x("radio.rec.format"))}};return m.useEffect(()=>(d.current=!1,()=>{d.current=!0,c.current!==null&&clearTimeout(c.current);const g=r.current;r.current=null,(g==null?void 0:g.state)==="recording"&&g.stop()}),[]),{recording:i,startRecording:h,stopRecording:u}}function ITe({full:e,fullProps:t,runCustom:n,onCreateVoice:a}){const i=se(),[o,r]=m.useState(()=>i("settings.sounds.voice.defaultName")),[c,d]=m.useState(()=>i("settings.sounds.voice.defaultText")),[u,h]=m.useState(""),[g,f]=m.useState("1"),[b,k]=m.useState("1"),[y,N]=m.useState([]);return m.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const w=()=>{N(window.speechSynthesis.getVoices())};return w(),window.speechSynthesis.addEventListener("voiceschanged",w),()=>window.speechSynthesis.removeEventListener("voiceschanged",w)},[]),s.jsxs("details",{className:"sm-voice",children:[s.jsxs("summary",{className:"settings-row",...t,onClick:w=>{const j=w.currentTarget.parentElement;e&&j&&!j.open&&w.preventDefault()},children:[s.jsx("span",{className:"settings-row-name",children:i("settings.sounds.voice.title")}),s.jsx("span",{className:"settings-row-note",children:i("settings.sounds.voice.note")}),s.jsx("span",{className:"settings-row-control",children:s.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:s.jsx("path",{d:"M5.5 3.5 9 7l-3.5 3.5"})})})]}),s.jsxs("div",{className:"sm-voice-fields",children:[s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.name")}),s.jsx("input",{className:"ap-manage-input",value:o,maxLength:80,onChange:w=>r(w.target.value)})]}),s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.text")}),s.jsx("input",{className:"ap-manage-input",value:c,maxLength:180,onChange:w=>d(w.target.value)})]}),s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.voice")}),s.jsxs("select",{className:"sm-select",value:u,onChange:w=>h(w.target.value),children:[s.jsx("option",{value:"",children:i("settings.sounds.voice.default")}),y.map(w=>s.jsx("option",{value:w.voiceURI,children:w.name},w.voiceURI))]})]}),s.jsxs("div",{className:"sm-voice-pair",children:[s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.rate")}),s.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:g,onChange:w=>f(w.target.value)})]}),s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.pitch")}),s.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:b,onChange:w=>k(w.target.value)})]})]}),s.jsx("button",{type:"button",className:"btn sm-custom-action",...t,onClick:()=>{e||n(async()=>{await a({name:o,text:c,voiceURI:u,rate:parseFloat(g),pitch:parseFloat(b)}),d(i("settings.sounds.voice.defaultText"))})},children:i("settings.sounds.voice.add")})]})]})}function DTe({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:a,onPreviewCustom:i,onDeleteCustom:o}){const r=se(),[c,d]=m.useState(""),u=e.length,h=MN(u),g=h!==null,f=g?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[b,k]=m.useState(null),y=m.useRef(0),N=m.useRef(new Map),w=m.useRef(null),j=m.useRef(null);m.useEffect(()=>{if(!b)return;const I=window.setTimeout(()=>k(null),4e3);return()=>window.clearTimeout(I)},[b]);const S=async I=>{d("");try{await I()}catch(z){d(Pi(z,r("settings.sounds.custom.saveFail")))}},A=(I,z)=>{const F=Date.now(),U=Fr({armedFor:b,target:I,armedAt:y.current,now:F,gapMs:Dr});if(U==="arm"){k(I),y.current=F;return}if(U==="ignore")return;k(null);const P=vre(e.map(L=>L.id),I);S(async()=>{var R;await o(I);const L=document.activeElement;L!==z&&!ta((L==null?void 0:L.tagName)??null)||(R=P?N.current.get(P):w.current)==null||R.focus()})},{recording:T,startRecording:q,stopRecording:_}=MTe({full:g,setCustomError:d,runCustom:S,onImportCustom:t});return s.jsxs(Kt,{id:"sm-custom-title",title:r("settings.sounds.custom.title"),note:r("settings.sounds.custom.note"),aside:s.jsx("span",{className:"settings-caption-count",children:r("settings.sounds.custom.count",{count:u,max:PN})}),className:"sm-custom",settingId:"custom-sounds",children:[g&&s.jsx("p",{className:"settings-row settings-row-status",id:"sm-custom-full",children:h}),s.jsx(Ct,{as:"div",settingId:"custom-import",name:r("settings.sounds.custom.import"),note:r("settings.sounds.custom.importNote"),control:s.jsx("button",{ref:w,type:"button",className:"btn sm-custom-action",...f,onClick:()=>{var I;g||(I=j.current)==null||I.click()},children:r("settings.sounds.custom.chooseFile")}),children:s.jsx("input",{ref:j,type:"file",hidden:!0,accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",onChange:I=>{var F;const z=(F=I.target.files)==null?void 0:F[0];I.currentTarget.value="",z&&!g&&S(()=>t(z))}})}),s.jsx(Ct,{as:"div",settingId:"custom-record",name:r("settings.sounds.custom.record"),note:r(T?"settings.sounds.custom.recording":"settings.sounds.custom.upTo5"),control:T?s.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:_,children:r("settings.sounds.custom.stopSave")}):s.jsx("button",{type:"button",className:"btn sm-custom-action",...f,onClick:()=>void q(),children:r("settings.sounds.custom.recordBtn")})}),s.jsx(ITe,{full:g,fullProps:f,runCustom:S,onCreateVoice:n}),e.map(I=>s.jsxs("div",{className:"sm-custom-item",children:[s.jsx("input",{className:"ap-manage-input","aria-label":r("settings.sounds.custom.rename",{name:I.name}),defaultValue:I.name,maxLength:80,onBlur:z=>{if(!z.target.value.trim()){z.target.value=I.name;return}S(()=>a(I.id,z.target.value))},onKeyDown:z=>{z.key==="Enter"&&z.currentTarget.blur()}}),s.jsx("span",{children:I.kind==="audio"?`${AA(I.duration,1)}s`:r("settings.sounds.custom.voice")}),s.jsx("button",{type:"button",className:"btn sm-custom-icon","aria-label":r("settings.sounds.custom.playName",{name:I.name}),onClick:()=>i(I.id),children:r("settings.sounds.custom.play")}),s.jsx("button",{type:"button",ref:z=>{z?N.current.set(I.id,z):N.current.delete(I.id)},className:`btn sm-custom-icon${b===I.id?" armed":""}`,onKeyDown:z=>{z.repeat&&z.preventDefault()},onClick:z=>A(I.id,z.currentTarget),"aria-label":b===I.id?r("settings.sounds.custom.confirmName",{name:I.name}):r("settings.sounds.custom.deleteName",{name:I.name}),title:b===I.id?r("settings.sounds.custom.deleteAgain"):r("settings.sounds.custom.deleteTip"),children:b===I.id?r("settings.sounds.custom.confirm"):r("settings.sounds.custom.delete")})]},I.id)),c&&s.jsx("p",{className:"settings-row settings-row-status sm-custom-error",role:"alert",children:c})]})}function FTe({soundOn:e,onToggleSound:t}){const n=se(),a=m.useId(),i=On(),o=m.useId();return s.jsx(Kt,{children:s.jsx(Ct,{settingId:"play-sounds",name:n("radio.sound.name"),nameId:a,note:n("radio.sound.note"),noteId:o,control:s.jsxs(s.Fragment,{children:[i&&s.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:n("radio.sound.keyTitle"),children:"M"}),s.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-labelledby":a,"aria-describedby":o,"aria-keyshortcuts":i?"M":void 0,className:"switch",onClick:t,children:s.jsx("span",{className:"switch-knob"})})]})})})}const zj="custom:";function dD(e){return`${zj}${e}`}function UTe(e){return e.startsWith(zj)?e.slice(zj.length):null}function BTe({id:e,label:t,value:n,step:a=GA,onLevel:i,"aria-describedby":o}){const r=se();return s.jsxs("div",{className:"sm-row",children:[s.jsx("label",{htmlFor:e,children:t??r("radio.volume")}),s.jsx("input",{id:e,type:"range",min:xg,max:am,step:a,value:n,"aria-describedby":o,onChange:c=>i(Number(c.target.value)),style:{"--sm-level":`${(n-xg)/(am-xg)*100}%`}}),s.jsxs("span",{className:"sm-read",children:[n,"%"]})]})}const uD={get done(){return x("settings.sounds.tone.done")},get"needs-input"(){return x("settings.sounds.tone.needsInput")}},HTe={get done(){return x("settings.sounds.tone.doneNote")},get"needs-input"(){return x("settings.sounds.tone.needsInputNote")}};function WTe({chime:e,tone:t,soundOn:n,customAssets:a,customSelections:i,onLevel:o,onFigure:r,onPreview:c,onBuiltInSelected:d,onCustomSelected:u}){const h=se(),g=`sm-level-${e}`,f=`sm-figure-${e}`,b=i[e];return s.jsxs(Kt,{id:`sm-name-${e}`,title:uD[e],note:HTe[e],settingId:`tone-${e}`,aside:s.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(e),"aria-label":h("settings.sounds.hearAria",{tone:uD[e]}),title:h(n?"settings.sounds.hearTip":"settings.sounds.hearTipMuted"),"aria-describedby":n?void 0:"sm-preview-note",children:[s.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),h("settings.sounds.hear")]}),children:[s.jsx(BTe,{id:g,value:t.level,onLevel:k=>o(e,k)}),s.jsxs("div",{className:"sm-row",children:[s.jsx("label",{htmlFor:f,children:h("settings.sounds.toneLabel")}),s.jsxs("select",{id:f,className:"sm-select",value:b?dD(b):t.figure,onChange:k=>{const y=k.target.value,N=UTe(y);N!==null?u(e,N):(d(e),r(e,y))},children:[WA[e].map(k=>s.jsx("option",{value:k.id,children:k.label},k.id)),a.length>0&&s.jsx("optgroup",{label:h("settings.sounds.customGroup"),children:a.map(k=>s.jsx("option",{value:dD(k.id),children:k.name},k.id))})]})]})]})}function GTe({soundOn:e,onToggleSound:t,prefs:n,claudeHere:a,onLevel:i,onFigure:o,onPreview:r,customAssets:c,customSelections:d,onBuiltInSelected:u,onCustomSelected:h,onImportCustom:g,onCreateVoice:f,onRenameCustom:b,onPreviewCustom:k,onDeleteCustom:y}){var A;const N=se(),w=fre(d),j=((A=c.find(T=>T.id===w))==null?void 0:A.name)??N("settings.sounds.sharedName"),S=w?N("settings.sounds.sharedNote",{name:j}):"";return s.jsxs("div",{className:"sm-sounds",children:[s.jsx(FTe,{soundOn:e,onToggleSound:t}),!a&&s.jsx("p",{className:"sm-note",children:N("settings.sounds.codexOnly")}),!e&&s.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:N("settings.sounds.previewNote")}),s.jsx("div",{className:"sm-tones",children:cu.map(T=>s.jsx(WTe,{chime:T,tone:n[T],soundOn:e,customAssets:c,customSelections:d,onLevel:i,onFigure:o,onPreview:r,onBuiltInSelected:u,onCustomSelected:h},T))}),S&&s.jsx("p",{className:"sm-note","aria-hidden":!0,children:S}),s.jsx("p",{className:"vis-hidden",role:"status",children:S}),s.jsx(DTe,{customAssets:c,onImportCustom:g,onCreateVoice:f,onRenameCustom:b,onPreviewCustom:k,onDeleteCustom:y})]})}function $Te({onOpen:e}){const t=se();return s.jsx(Kt,{children:s.jsx(Ct,{as:"div",settingId:"radar-open",name:t("radar.name"),nameId:"settings-radar-open-name",note:t("radar.note"),control:s.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:t("radar.open")})})})}const VTe=6500,KTe=1e4;let zr={reading:null,saving:null,error:"",undone:null};const Rg=new Set;let Hd=null,Wd=null,_i=null,VS=!1,Eg=0;const kr=e=>{zr={...zr,...e},Rg.forEach(t=>t(zr))};function r5(e){const t=e;return!!t&&t.ok===!0&&Array.isArray(t.settings)&&typeof t.present=="object"}async function c5(e){const t=await fetch("/api/claude-settings",{signal:e}),n=await t.json();if(!t.ok||!r5(n))throw new Error;return n}async function Lj(){if(VS||zr.saving)return;VS=!0;const e=Eg,t=new AbortController;_i=t;let n=!1;const a=setTimeout(()=>{n=!0,t.abort()},5e3);try{const i=await c5(t.signal);e===Eg&&!t.signal.aborted&&kr({reading:i,error:""})}catch{e===Eg&&(n||!t.signal.aborted)&&kr({error:x("settings.claude.readFail")})}finally{clearTimeout(a),VS=!1,_i===t&&(_i=null)}}function hD(e,t){var n;return(n=e==null?void 0:e.settings.find(a=>a.id===t))==null?void 0:n.value}async function pD(e,t){if(zr.saving)return;Eg++,_i==null||_i.abort(),Wd&&(clearTimeout(Wd),Wd=null),kr({saving:e,error:"",undone:null});const n=new AbortController,a=setTimeout(()=>n.abort(),15e3);try{const i=await fetch("/api/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,value:t}),signal:n.signal}),o=await i.json().catch(()=>null);if(!i.ok||!r5(o))throw new kn(typeof(o==null?void 0:o.error)=="string"&&o.error?qg(o.error):x("settings.claude.saveFail"));kr({reading:o});const r=hD(o,e);Wd=setTimeout(()=>{Wd=null;const c=new AbortController,d=setTimeout(()=>c.abort(),5e3);c5(c.signal).then(u=>{kr({reading:u,undone:hD(u,e)===r?null:{id:e}})}).catch(()=>{}).finally(()=>clearTimeout(d))},VTe)}catch(i){kr({error:Pi(i,x("settings.claude.saveFail"))})}finally{clearTimeout(a),kr({saving:null})}}const JTe={"Your settings.json is not valid JSON, so Claude Code skips all of it, hooks included. Fix it in an editor; this section reads it again by itself.":"settings.claude.reason.invalid","Your settings.json could not be read here, so nothing is shown or changed until it can.":"settings.claude.reason.unreadable","Your organization's settings could not be read, so nothing here can be changed until they can.":"settings.claude.reason.othersUnknown","Set by your organization. Ask your administrator to change it.":"settings.claude.reason.locked","Your settings.json holds a custom value. Edit it there.":"settings.claude.reason.custom","Choose a setting this section offers and one of its values.":"settings.claude.reason.choose","Your settings.json could not be read as JSON. No changes were saved.":"settings.claude.reason.parse","Your settings.json changed while saving. Nothing was written. Try again.":"settings.claude.reason.changed","Claude Code settings can be changed on this computer only.":"settings.claude.reason.localOnly","Could not read Claude Code settings. Try again.":"settings.claude.reason.readFail","Could not save the change. Your settings.json was not modified.":"settings.claude.reason.notSaved","Your settings.json has a permissions value that is not an object. No changes were saved.":"settings.claude.reason.permissionsShape","Your settings.json has a permissions.deny value that is not a list. No changes were saved.":"settings.claude.reason.denyShape","Your settings.json holds a custom attribution. Edit it there.":"settings.claude.reason.attribution"};function qg(e,t=x){const n=JTe[e];if(n)return t(n);const a=/^Needs Claude Code (\S+) or newer(, and the version installed here could not be read)?\.$/.exec(e);return a?t(a[2]?"settings.claude.reason.needsUnread":"settings.claude.reason.needs",{version:a[1]}):g3(e,t)}function YTe(){const[e,t]=m.useState(zr);return m.useEffect(()=>(Rg.add(t),t(zr),Hd||(Lj(),Hd=setInterval(()=>void Lj(),KTe)),()=>{Rg.delete(t),Rg.size||(Hd&&clearInterval(Hd),Hd=null,_i==null||_i.abort())}),[]),e}const KS=40,ZTe=(e,t)=>{const n=`settings.claudeTopic.${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}`,a=t(n);return a===n?e:a},XTe={boolean:"settings.claudeIndex.kind.boolean",choice:"settings.claudeIndex.kind.choice",number:"settings.claudeIndex.kind.number",text:"settings.claudeIndex.kind.text",structured:"settings.claudeIndex.kind.structured"};function QTe(e,t=x){const n=e.scope==="Global config"?t("settings.claudeIndex.globalConfig"):e.scope==="Managed"?t("settings.claudeIndex.managedOnly"):null;return[e.topic?ZTe(e.topic,t):e.topic,t(XTe[e.kind]),n,e.since?t("settings.claudeIndex.since",{since:e.since}):null].filter(Boolean).join(" · ")}function e0e(e,t){const n=t.trim().toLowerCase();if(!n)return[];const a=e.filter(o=>o.key.toLowerCase().includes(n)),i=e.filter(o=>!a.includes(o)&&(o.topic??"").toLowerCase().includes(n));return[...a,...i]}let l5=null;const t0e=()=>l5??(l5=Hr(()=>import("./claude-settings-index-1Qg1AUda.js"),[]).then(e=>e.default.keys));function n0e({present:e,noFile:t=!1}){const n=se(),a=Aa(),[i,o]=m.useState(null),[r,c]=m.useState(""),d=m.useId();m.useEffect(()=>{let f=!0;return t0e().then(b=>{f&&o(b)},()=>{l5=null}),()=>{f=!1}},[]);const u=m.useMemo(()=>{if(!i)return[];if(r.trim())return e0e(i,r);if(!e)return[];const f=i.filter(k=>Object.hasOwn(e,k.key)),b=Object.keys(e).filter(k=>!i.some(y=>y.key===k)).sort().map(k=>({key:k,topic:x("settings.claudeIndex.notInRef"),scope:null,kind:"structured",default:null,since:null,anchor:""}));return[...f,...b]},[i,e,r,a]),h=u.slice(0,KS),g=r.trim()!=="";return s.jsxs(Kt,{id:"claude-group-all",settingId:"claude-all-settings",title:n("settings.claudeIndex.title"),note:g?void 0:n(e&&!t?"settings.claudeIndex.notePresent":"settings.claudeIndex.noteAll"),aside:i?s.jsx("span",{className:"settings-caption-count",children:i.length}):void 0,list:!1,children:[s.jsxs("div",{className:"settings-filter",children:[s.jsx("label",{className:"vis-hidden",htmlFor:d,children:n("settings.claudeIndex.filterLabel")}),s.jsx("input",{id:d,type:"search",className:"settings-filter-field",placeholder:i?n("settings.claudeIndex.filterCount",{count:i.length}):n("settings.claudeIndex.filter"),autoComplete:"off",spellCheck:!1,value:r,onChange:f=>c(f.target.value),onKeyDown:f=>{Bm(f.key)&&r&&(f.stopPropagation(),c(""))}})]}),h.length>0&&s.jsx("div",{className:"settings-list settings-keys",children:h.map(f=>{const b=e&&Object.hasOwn(e,f.key)?e[f.key]:null;return s.jsx(Ct,{as:"div",name:s.jsx("code",{className:"claude-key",children:f.key}),note:QTe(f,n),control:s.jsxs(s.Fragment,{children:[b!==null&&s.jsx("span",{className:"settings-read",title:n("settings.claudeIndex.inFile"),children:b}),f.anchor&&s.jsx("a",{className:"settings-link",href:`${sre}#${f.anchor}`,target:"_blank",rel:"noreferrer","aria-label":n("settings.claudeIndex.referenceAria",{key:f.key}),children:n("settings.claudeIndex.reference")})]})},f.key)})}),g&&u.length===0&&i&&s.jsx("p",{className:"settings-empty",role:"status",children:n("settings.claudeIndex.noMatch",{query:r.trim()})}),u.length>KS&&s.jsx("p",{className:"settings-foot",role:"status",children:n("settings.claudeIndex.more",{count:u.length-KS})}),!g&&e&&!t&&i&&u.length===0&&s.jsx("p",{className:"settings-empty",children:n("settings.claudeIndex.empty")})]})}function a0e(e,t=x){return t("settings.claude.foot",{file:e??t("settings.claude.footDefault")})}const gD={Off:"settings.claude.effect.off",On:"settings.claude.effect.on","Updates are off":"settings.claude.effect.updatesOff","Background updates are off":"settings.claude.effect.bgUpdatesOff"};function s0e(e,t=x){const n=`${e.env}=${e.value}`,a=gD[e.effect]?t(gD[e.effect]):e.effect;return e.where==="environment"?t("settings.claude.overrideEnv",{effect:a,set:n}):t(e.where==="user"?"settings.claude.overrideUser":"settings.claude.overrideOrg",{effect:a,set:n})}const mD="\0custom";function i0e({entry:e,row:t,saving:n,nameId:a,noteId:i}){const o=se(),r=!!t&&t.editable&&!n,c=!t||n===e.id,d=t?!t.editable:void 0;if(e.kind==="choice"||e.kind==="days"){const h=e.kind==="days"?e.options.map(b=>({value:String(b),label:Nq(b,o)})):e.options.map(b=>({...b,label:ore(e.id,b.value,b.label,o)})),g=t?t.custom?mD:t.value===null?"":String(t.value):"",f=e.kind==="days"&&t&&!t.custom&&!h.some(b=>b.value===g)?[...h,{value:g,label:Nq(Number(g),o)}].sort((b,k)=>Number(b.value)-Number(k.value)):h;return s.jsxs("select",{className:"sm-select","aria-labelledby":a,"aria-describedby":i,"aria-busy":c,disabled:d,value:g,onChange:b=>{if(!r)return;const k=b.target.value;pD(e.id,e.kind==="days"?Number(k):k===""?null:k)},children:[(t==null?void 0:t.custom)&&s.jsx("option",{value:mD,disabled:!0,children:o("settings.claude.customValue")}),f.map(b=>s.jsx("option",{value:b.value??"",children:b.label},b.value??""))]})}const u=(t==null?void 0:t.value)===!0;return s.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":u,"aria-labelledby":a,"aria-describedby":i,"aria-busy":c,disabled:d,onClick:()=>{r&&pD(e.id,!u)},children:s.jsx("span",{className:"switch-knob"})})}function o0e(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 r0e(){return s.jsx(c0e,{state:YTe()})}function c0e({state:e}){const t=se(),{reading:n,saving:a,error:i,undone:o}=e,r=o0e(n),c=(n==null?void 0:n.userFile)==="absent",d=n?n.userFile!=="invalid"&&n.userFile!=="unreadable":!i;return s.jsxs(s.Fragment,{children:[(n===null||i||r||c)&&s.jsxs(Kt,{children:[n===null&&!i&&s.jsx("p",{className:"settings-row settings-row-status",role:"status",children:t("settings.claude.reading")}),r&&s.jsx("p",{className:"settings-row settings-row-status",role:"status",children:qg(r,t)}),c&&!r&&s.jsx("p",{className:"settings-row settings-row-status",role:"status",children:t("settings.claude.noFile")}),i&&s.jsxs("div",{className:"settings-row",role:"alert",children:[s.jsx("span",{className:"settings-row-name",children:qg(i,t)}),s.jsx("span",{className:"settings-row-control",children:s.jsx("button",{type:"button",className:"btn","aria-busy":!!a,onClick:()=>void Lj(),children:t("settings.claude.retry")})})]})]}),d&&yB.map(u=>s.jsx(Kt,{id:`claude-group-${u.id}`,title:CB(u.id,u.title,t),children:xB.filter(h=>h.group===u.id).map(h=>{const g=n==null?void 0:n.settings.find(y=>y.id===h.id),f=`claude-${h.id}-label`,b=`claude-${h.id}-note`,k=g&&!g.editable&&!r?qg(g.reason??"",t):(o==null?void 0:o.id)===h.id?t("settings.claude.undone"):g!=null&&g.override?s0e(g.override,t):"";return s.jsx(Ct,{settingId:`claude-${h.id}`,name:SB(h,t),nameId:f,note:ire(h,t),noteId:b,control:s.jsx(i0e,{entry:h,row:g,saving:a,nameId:f,noteId:b}),children:s.jsx("span",{className:"settings-row-said settings-row-said-quiet",role:"status",children:k})},h.id)})},u.id)),d&&s.jsx("p",{className:"settings-foot",children:a0e(n==null?void 0:n.fileShown,t)}),s.jsx(n0e,{present:(n==null?void 0:n.present)??null,noFile:c})]})}function l0e(){const e=se(),[t,n]=m.useState(null),[a,i]=m.useState(""),[o,r]=m.useState(!1),[c,d]=m.useState(null),[u,h]=m.useState(""),g=m.useRef(!1),f=m.useRef(!0),b=async()=>{if(g.current)return;g.current=!0,r(!0),i("");const N=new AbortController,w=window.setTimeout(()=>N.abort(),12e3);try{const j=await fetch("/api/tool-audit/storage",{signal:N.signal}),S=await j.json();if(!j.ok||!S.ok)throw new Error;f.current&&n(S)}catch{f.current&&i(e("settings.tools.readFail"))}finally{window.clearTimeout(w),g.current=!1,f.current&&r(!1)}};m.useEffect(()=>(f.current=!0,b(),()=>{f.current=!1}),[]);const k=async(N,w)=>{if(g.current)return;g.current=!0,r(!0),i(""),h("");let j=!1;const S=new AbortController,A=window.setTimeout(()=>S.abort(),15e3);try{const T=await fetch("/api/tool-audit/storage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N==="clear"?{action:N,confirm:!0}:{action:N,days:w}),signal:S.signal}),q=await T.json();if(!T.ok||!q.ok)throw new Error;j=!0,f.current&&(d(null),h(N==="clear"?e("settings.tools.cleared"):e("settings.tools.retentionChanged",{days:w??0})))}catch{f.current&&i(e("settings.tools.updateFail"))}finally{window.clearTimeout(A),g.current=!1,f.current&&(r(!1),j&&b())}},y=c!==null&&s.jsxs("div",{className:"settings-row settings-row-wide ta-confirm",role:"group","aria-label":e("settings.tools.confirm"),children:[s.jsx("p",{children:c==="clear"?e("settings.tools.confirmClear"):e("settings.tools.confirmKeep",{days:c})}),s.jsxs("div",{children:[s.jsx("button",{type:"button",className:"btn danger","aria-busy":o,onClick:()=>{k(c==="clear"?"clear":"retention",typeof c=="number"?c:void 0)},children:e(c==="clear"?"settings.tools.deleteBtn":"settings.tools.applyBtn")}),s.jsx("button",{type:"button",className:"btn","aria-busy":o,onClick:()=>{g.current||d(null)},children:e("settings.tools.cancel")})]})]});return s.jsxs(Kt,{id:"tool-history-settings-title",title:e("settings.tools.title"),note:e("settings.tools.note"),className:"ta-settings",children:[t?s.jsxs(s.Fragment,{children:[s.jsx(Ct,{settingId:"tool-history-retention",name:e("settings.tools.keep"),nameId:"ta-keep-label",note:e("settings.tools.keepNote"),control:s.jsx("select",{className:"sm-select","aria-labelledby":"ta-keep-label",value:t.retentionDays,"aria-busy":o,onChange:N=>{if(g.current)return;const w=Number(N.target.value);w<t.retentionDays?d(w):k("retention",w)},children:[30,60,90].map(N=>s.jsx("option",{value:N,children:e("settings.tools.days",{count:N})},N))})}),typeof c=="number"&&y,s.jsx(Ct,{as:"div",settingId:"tool-history-size",name:e("settings.tools.space"),note:e("settings.tools.since",{date:lce(t.startedAt)}),control:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"settings-read",children:cce(t.bytes)}),s.jsx("button",{type:"button",className:"btn","aria-busy":o,onClick:()=>{b()},children:e("settings.tools.refresh")})]})}),s.jsx(Ct,{as:"div",settingId:"tool-history-clear",name:e("settings.tools.clear"),note:e("settings.tools.clearNote"),control:s.jsx("button",{type:"button",className:"btn danger","aria-busy":o,onClick:()=>{g.current||d("clear")},children:e("settings.tools.clearBtn")})}),c==="clear"&&y,!t.storageOk&&s.jsx(Ct,{as:"div",name:e("settings.tools.unsaved"),note:e("settings.tools.unsavedNote")})]}):s.jsx(Ct,{as:"div",name:e(o?"settings.tools.reading":"settings.tools.unavailable")}),a&&s.jsxs("div",{className:"settings-row",role:"alert",children:[s.jsx("span",{className:"settings-row-name",children:a}),s.jsx("span",{className:"settings-row-control",children:s.jsx("button",{type:"button",className:"btn","aria-busy":o,onClick:()=>{b()},children:e("settings.tools.retry")})})]}),u&&s.jsx("p",{className:"settings-row settings-row-status",role:"status",children:u})]})}const Oj="agent-dag.integrations.active",a0=(e,t)=>`agent-dag.integrations.prefs.${e}:${t}`,d0e=32e3;function fD(e,t){const n=ht(a0(e,t));if(!n)return{};try{const a=JSON.parse(n);return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function k1e(e,t){return{read(n,a){const i=fD(e,t)[n];return a(i)?i:void 0},write(n,a){const i=fD(e,t);a===void 0?delete i[n]:i[n]=a;const o=JSON.stringify(i);o.length<=d0e&&pt(a0(e,t),o)}}}function u0e(e,t){Xa(a0(e,t))}function w1e(e){const t=ht(Oj);if(!t)return null;try{const n=JSON.parse(t),a=n&&typeof n=="object"?n[e]:null;return typeof a=="string"&&a.length<=80?a:null}catch{return null}}function y1e(e,t){let n={};try{const a=ht(Oj),i=a?JSON.parse(a):{};i&&typeof i=="object"&&!Array.isArray(i)&&(n=Object.fromEntries(Object.entries(i).filter(([,o])=>typeof o=="string").slice(0,20)))}catch{}n[e]=t,pt(Oj,JSON.stringify(n))}function Pj(e){var a;const t=(a=e.meta)==null?void 0:a.checkedAt;if(!t)return null;const n=new Date(String(t));return Number.isNaN(n.getTime())?null:n.toLocaleString(Le(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...n.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}function Mj(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 h0e({connection:e,provider:t,available:n,busy:a,armed:i,note:o,headingRef:r,onTest:c,onEdit:d,onDisconnect:u,onCancelDisconnect:h}){var T;const g=se(),f=m.useRef(null),b=(t==null?void 0:t.label)??e.kind,k=e.account.name||e.account.login||g("integrations.conn.noAccount"),y=e.account.name&&e.account.login!==e.account.name?e.account.login:"",N=Pj(e),w=Mj(e),j=Array.isArray((T=e.meta)==null?void 0:T.warnings)?e.meta.warnings.filter(q=>typeof q=="string"):[],S=a===`test:${e.id}`,A=a===`delete:${e.id}`;return s.jsxs("section",{className:"ig-connection-details","aria-labelledby":"ig-managed-title",children:[s.jsxs("header",{className:"ig-managed-header",children:[t&&s.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:s.jsx(t.Glyph,{})}),s.jsxs("div",{className:"ig-managed-identity",children:[s.jsx("h2",{ref:r,tabIndex:-1,id:"ig-managed-title",className:"ig-managed-title",children:e.name||e.baseUrl}),s.jsx("p",{children:g("integrations.conn.saved",{label:b})})]})]}),s.jsxs("dl",{className:"ig-detail-facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.host")}),s.jsx("dd",{children:e.baseUrl})]}),s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.account")}),s.jsxs("dd",{children:[k,y?` (${y})`:""]})]}),s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.lastVerified")}),s.jsx("dd",{children:N??g("integrations.conn.noVerificationTime")})]}),s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.credentials")}),s.jsx("dd",{children:e.tokenSaved?g("integrations.conn.storedLocally"):g("integrations.conn.noToken")})]}),w&&s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.server")}),s.jsx("dd",{children:w})]})]}),!n&&s.jsx("p",{className:"ig-stranded",children:g("integrations.conn.strandedDisconnect",{label:b})}),j.length>0&&s.jsx("ul",{className:"ig-warnings",children:j.map(q=>s.jsx("li",{children:q},q))}),n&&s.jsxs("div",{className:"ig-manage-actions",children:[s.jsx("button",{type:"button",className:"btn","aria-busy":S,"aria-disabled":a!==null||void 0,onClick:c,children:g(S?"integrations.conn.testing":"integrations.conn.test")}),s.jsx("button",{type:"button",className:"btn","aria-disabled":a!==null||void 0,onClick:q=>{a===null&&d(q.currentTarget)},children:g("integrations.conn.edit")})]}),o&&o.scope!=="disconnect"&&s.jsx("p",{className:"ig-note","data-tone":o.tone,role:o.tone==="err"?"alert":"status",children:o.text}),s.jsxs("div",{className:"ig-disconnect-section",children:[s.jsx("h3",{children:g("integrations.conn.removeTitle")}),s.jsx("p",{children:g("integrations.conn.removeBody")}),s.jsxs("div",{className:"ig-manage-actions","data-integration-disconnect-actions":!0,onBlur:q=>{i&&!q.currentTarget.contains(q.relatedTarget)&&h()},children:[s.jsx("button",{ref:f,type:"button","data-integration-disconnect":!0,className:`btn danger${i?" armed":""}`,"aria-busy":A,"aria-disabled":a!==null||void 0,onKeyDown:q=>{q.repeat&&q.preventDefault()},"aria-label":i?g("integrations.conn.confirmAria",{name:e.name}):g("integrations.conn.disconnectAria",{name:e.name}),onClick:q=>u(q.currentTarget),children:g(A?"integrations.conn.disconnecting":i?"integrations.conn.confirmDisconnect":"integrations.conn.disconnect")}),i&&s.jsx("button",{type:"button",className:"btn","data-integration-cancel-disconnect":!0,"aria-disabled":a!==null||void 0,"aria-label":g("integrations.conn.cancelDisconnect"),onClick:()=>{var q;a===null&&(h(),(q=f.current)==null||q.focus())},children:g("integrations.cancel")})]}),i&&s.jsx("p",{className:"ig-note",role:"status",children:g("integrations.conn.pressConfirm")}),(o==null?void 0:o.scope)==="disconnect"&&s.jsx("p",{className:"ig-note","data-tone":o.tone,role:o.tone==="err"?"alert":"status",children:o.text})]})]})}function p0e({onBeforeLeaveChange:e}={}){var tt;const t=se(),n=hh(),{connections:a,error:i}=n,[o,r]=m.useState(null),c=m.useRef(null),d=m.useRef(new Map),u=m.useRef(null),h=m.useRef(0),[g,f]=m.useState(null),[b,k]=m.useState(""),y=m.useRef(null),N=m.useRef(null),[w,j]=m.useState(null),[S,A]=m.useState(null),T=m.useRef(null),[q,_]=m.useState(null),[I,z]=m.useState([]),[F,U]=m.useState(null),P=m.useRef(0),[L,R]=m.useState(null),O=m.useRef(null),D=m.useRef(new Map),$=m.useRef(null),B=m.useRef(0),[G,Z]=m.useState(!1),[W,H]=m.useState(null),X=m.useRef(null),V=m.useRef(new Map),Q=m.useRef(new Map);m.useEffect(()=>{const ie=rNe();ie&&($.current=V.current.get(ie)??null,f(ie),R(ie),j({mode:"edit",id:ie}));const je=oNe();je&&j({mode:"add",kind:je})},[]),m.useEffect(()=>{var ie,je;!L||!a||(je=(ie=Q.current.get(L))==null?void 0:ie.scrollIntoView)==null||je.call(ie,{block:"nearest"})},[L,a]),m.useEffect(()=>{if(!F)return;const ie=()=>{var Ge,Te;(Ge=document.activeElement)!=null&&Ge.hasAttribute("data-integration-cancel-disconnect")&&((Te=document.querySelector(".ig-manage-view [data-integration-disconnect]"))==null||Te.focus()),U(null)},je=()=>{document.hidden&&ie()},Fe=window.setTimeout(()=>{var Ge;(Ge=document.querySelector("[data-integration-disconnect-actions]"))!=null&&Ge.contains(document.activeElement)||ie()},4e3);return window.addEventListener("blur",ie),document.addEventListener("visibilitychange",je),()=>{window.clearTimeout(Fe),window.removeEventListener("blur",ie),document.removeEventListener("visibilitychange",je)}},[F]);const Y=(ie,je,Fe,Ge)=>z(Te=>[...Te.filter(nt=>nt.id!==ie),{id:ie,tone:je,text:Fe,scope:Ge}]),K=ie=>z(je=>je.filter(Fe=>Fe.id!==ie)),ee=async(ie,je)=>{if(!T.current){T.current=ie,A(ie);try{await je()}finally{T.current=null,A(null)}}},te=ie=>(je,Fe)=>void ee("form",async()=>{_(null);try{const Ge=await tNe(ie,je,Fe||void 0);j(null),H(null),Z(!1),f(null),r(null),k(t("integrations.settings.added")),Y(Ge.id,"ok",t("integrations.settings.savedTested",{name:Ge.account.name||Ge.account.login})),R(Ge.id),O.current=()=>{var nt;const Te=d.current.get(Ge.kind)??V.current.get(Ge.id);return(nt=Te==null?void 0:Te.scrollIntoView)==null||nt.call(Te,{block:"nearest"}),Te}}catch(Ge){_(Ge instanceof Za?Ge:new Za("upstream",t("integrations.settings.saveFailed")))}}),ce=ie=>(je,Fe)=>void ee("form",async()=>{_(null);try{const{connection:Ge,validated:Te}=await nNe(ie.id,{name:Fe,input:je});j(null),H(null),Z(!1),O.current=()=>N.current??(g?y.current:V.current.get(Ge.id)),Y(Ge.id,"ok",Te?t("integrations.settings.savedPassed",{name:Ge.account.name||Ge.account.login}):t("integrations.settings.saved"))}catch(Ge){_(Ge instanceof Za?Ge:new Za("upstream",t("integrations.settings.changeFailed")))}}),ge=ie=>void ee(`test:${ie.id}`,async()=>{U(null),K(ie.id);try{const je=await aNe(ie.id);Y(ie.id,"ok",t("integrations.settings.testPassed",{name:je.account.name||je.account.login}))}catch(je){Y(ie.id,"err",Pi(je,t("integrations.settings.testFailed")))}}),ve=(ie,je)=>{if(T.current)return;const Fe=Date.now(),Ge=Fr({armedFor:F,target:ie.id,armedAt:P.current,now:Fe,gapMs:Dr});if(Ge==="arm"){je.focus({preventScroll:!0}),U(ie.id),P.current=Fe;return}Ge!=="ignore"&&(U(null),ee(`delete:${ie.id}`,async()=>{try{await sNe(ie.id),u0e(ie.kind,ie.id),K(ie.id),(w==null?void 0:w.mode)==="edit"&&w.id===ie.id&&j(null),f(null);const Te=(a??[]).filter(fe=>fe.kind===ie.kind&&fe.id!==ie.id);(!o||Te.length===0)&&r(null),k(t("integrations.settings.disconnected"));const nt=document.activeElement;(nt===je||ta((nt==null?void 0:nt.tagName)??null))&&(O.current=()=>{var Ve;const fe=(o&&Te[0]?V.current.get(Te[0].id):d.current.get(ie.kind))??D.current.get(ie.kind)??document.getElementById("settings-tab-integrations");return(Ve=fe==null?void 0:fe.scrollIntoView)==null||Ve.call(fe,{block:"nearest"}),fe})}catch(Te){Y(ie.id,"err",Pi(Te,t("integrations.settings.removeFailed")),"disconnect")}}))};m.useEffect(()=>{if(S!==null||W||!O.current)return;const ie=O.current();O.current=null,ie!=null&&ie.isConnected&&(ie.checkVisibility?ie.checkVisibility():ie.getClientRects().length>0)&&ie.focus({preventScroll:!0})},[a,g,o,w,S,W]);const pe=a??[],ae=ph(n),le=["github","gitlab","jira"],Se=QT().filter(ie=>ae.has(ie.kind)||pe.some(je=>je.kind===ie.kind)).sort((ie,je)=>le.indexOf(ie.kind)-le.indexOf(je.kind)),ke=t0(n),ye=m.useCallback(()=>{j(null),f(null),r(null),Z(!1),H(null),_(null),U(null),O.current=()=>{const ie=$.current,je=ie==null?void 0:ie.closest(".settings-pane");return je&&(je.scrollTop=B.current),ie!=null&&ie.isConnected?ie:document.getElementById("settings-tab-integrations")}},[]),We=m.useCallback(()=>{if(!o){ye();return}f(null),j(null),Z(!1),H(null),_(null),U(null),O.current=()=>{var Fe;const ie=(Fe=u.current)!=null&&Fe.isConnected?u.current:c.current,je=ie==null?void 0:ie.closest(".settings-pane");return je&&(je.scrollTop=ie===c.current?0:h.current),ie}},[o,ye]),He=m.useCallback(()=>{if(!g&&!o){ye();return}j(null),Z(!1),H(null),_(null),O.current=()=>N.current??(g?y.current:c.current)},[g,o,ye]),Ke=m.useCallback((ie,je=!1)=>{if(T.current)return;if(W&&je){H(null),requestAnimationFrame(()=>{var Ge;return(Ge=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:Ge.focus()});return}const Fe=je?w?He:g?We:ye:()=>{j(null),f(null),r(null),ie()};G?H(()=>Fe):(Z(!1),Fe())},[G,W,w,g,He,We,ye]);m.useEffect(()=>(e==null||e(w||g||o?Ke:null),()=>e==null?void 0:e(null)),[w,g,o,Ke,e]),m.useEffect(()=>{var ie;W&&((ie=X.current)==null||ie.focus())},[W]),m.useEffect(()=>{var ie;g&&((ie=y.current)==null||ie.focus())},[g]),m.useEffect(()=>{var ie;o&&((ie=c.current)==null||ie.focus())},[o]);const Re=(ie,je)=>{var Ge;if(T.current)return;O.current=null,H(null),k(""),U(null),g||o?N.current=je:(B.current=((Ge=je.closest(".settings-pane"))==null?void 0:Ge.scrollTop)??0,$.current=je,N.current=null),Z(!1),_(null),j(ie);const Fe=je.closest(".settings-pane");Fe&&(Fe.scrollTop=0)},Je=(ie,je)=>{var Ge,Te;if(T.current)return;O.current=null,o?(u.current=je,h.current=((Ge=je.closest(".settings-pane"))==null?void 0:Ge.scrollTop)??0):(B.current=((Te=je.closest(".settings-pane"))==null?void 0:Te.scrollTop)??0,$.current=je),N.current=null,k(""),U(null),f(ie.id);const Fe=je.closest(".settings-pane");Fe&&(Fe.scrollTop=0)},Pe=(ie,je)=>{var Te;const Fe=pe.filter(nt=>nt.kind===ie);if(Fe.length===1){Je(Fe[0],je);return}if(T.current)return;O.current=null,B.current=((Te=je.closest(".settings-pane"))==null?void 0:Te.scrollTop)??0,$.current=je,u.current=null,h.current=0,k(""),U(null),r(ie);const Ge=je.closest(".settings-pane");Ge&&(Ge.scrollTop=0)},Ae=(ie,je=!1)=>{const Fe=au(ie.kind),Ge=!Ai(n,ie.kind),Te=Pj(ie),nt=ie.account.login||ie.account.name,fe=ie.kind==="jira"?Mj(ie):null;return s.jsx("div",{className:"ig-conn",ref:Ve=>{Ve?Q.current.set(ie.id,Ve):Q.current.delete(ie.id)},children:s.jsxs("div",{className:"ig-summary-row",children:[s.jsxs("div",{className:"ig-summary-text",children:[s.jsx("span",{className:"ig-conn-name",children:je&&ie.name||pr(ie)}),s.jsx("span",{className:"ig-conn-line",children:[je&&ie.name!==pr(ie)?pr(ie):"",nt,fe||(Te?t("integrations.conn.lastVerifiedAt",{when:Te}):t("integrations.conn.notVerified"))].filter(Boolean).join(" · ")||t("integrations.conn.noAccount")}),!ie.tokenSaved&&s.jsx("span",{className:"ig-bad",children:t("integrations.conn.noToken")}),Ge&&s.jsx("span",{className:"ig-stranded",children:t("integrations.conn.strandedManage",{label:(Fe==null?void 0:Fe.label)??ie.kind})})]}),s.jsxs("button",{type:"button",className:"btn ig-manage",ref:Ve=>{Ve?V.current.set(ie.id,Ve):V.current.delete(ie.id)},"aria-label":t("integrations.settings.manageAria",{label:(Fe==null?void 0:Fe.label)??ie.kind,name:ie.name,account:nt||pr(ie)}),onClick:Ve=>Je(ie,Ve.currentTarget),children:[t("integrations.manage")," ",s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m6 4 4 4-4 4"})})]})]})},ie.id)},xe=pe.filter(ie=>!Se.some(je=>je.kind===ie.kind)),ze=o?au(o):null,Ce=pe.filter(ie=>ie.kind===o),Me=pe.find(ie=>ie.id===g),Ee=(w==null?void 0:w.mode)==="edit"?pe.find(ie=>ie.id===w.id):void 0,Be=(w==null?void 0:w.mode)==="add"?Se.find(ie=>ae.has(ie.kind)&&ie.kind===w.kind):Ee&&Se.find(ie=>ae.has(ie.kind)&&ie.kind===Ee.kind);return s.jsxs("div",{className:"ig-settings","data-view":w?"form":g?"connection":o?"provider":"overview",children:[w&&s.jsxs("div",{className:"ig-config-view",children:[s.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":S!==null||void 0,onClick:()=>Ke(He,!0),children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),g?t("integrations.settings.backToConn"):o?t("integrations.settings.backToList",{label:(ze==null?void 0:ze.label)??o}):t("integrations.settings.all")]}),W&&s.jsxs("div",{className:"ig-leave-confirm",role:"group","aria-labelledby":"ig-leave-title",children:[s.jsx("strong",{id:"ig-leave-title",children:t("integrations.settings.discardTitle")}),s.jsx("p",{children:t("integrations.settings.discardBody")}),s.jsxs("div",{className:"ig-form-actions",children:[s.jsx("button",{ref:X,type:"button",className:"btn",onClick:()=>{H(null),requestAnimationFrame(()=>{var ie;return(ie=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:ie.focus()})},children:t("integrations.settings.keepEditing")}),s.jsx("button",{type:"button",className:"btn danger",onClick:()=>{const ie=W;H(null),Z(!1),j(null),ie()},children:t("integrations.settings.discard")})]})]}),s.jsx("div",{hidden:!!W,children:Be?s.jsx(TSe,{def:Be,existing:Ee,busy:S==="form",error:q,onDirtyChange:Z,onSubmit:w.mode==="add"?te(w.kind):ce(Ee),onCancel:()=>Ke(He,!0)},w.mode==="add"?w.kind:w.id):s.jsxs("div",{role:"status",children:[s.jsx("p",{children:t("integrations.settings.gone")}),s.jsx("button",{type:"button",className:"btn",onClick:He,children:t("integrations.settings.backToIntegrations")})]})})]}),o&&s.jsxs("div",{className:"ig-provider-view",hidden:w!==null||g!==null,children:[s.jsxs("div",{className:"ig-manage-navigation",children:[s.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":S!==null||void 0,onClick:()=>Ke(ye,!0),children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),t("integrations.settings.all")]}),Ai(n,o)&&s.jsx("button",{type:"button",className:"btn","aria-disabled":S!==null||void 0,onClick:ie=>Re({mode:"add",kind:o},ie.currentTarget),children:t("integrations.settings.addConn",{label:(ze==null?void 0:ze.label)??o})})]}),s.jsx("h2",{ref:c,tabIndex:-1,className:"ig-managed-title",children:t("integrations.settings.connsTitle",{label:(ze==null?void 0:ze.label)??o})}),b&&s.jsx("p",{className:"ig-note",role:"status",children:b}),Ce.length?s.jsx("div",{className:"ig-provider-connections",children:Ce.map(ie=>Ae(ie,!0))}):s.jsx("p",{role:"status",children:t("integrations.settings.noSaved")})]}),g&&s.jsxs("div",{className:"ig-manage-view",hidden:w!==null,children:[s.jsxs("div",{className:"ig-manage-navigation",children:[s.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":S!==null||void 0,onClick:()=>Ke(We,!0),children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),o?t("integrations.settings.backToList",{label:(ze==null?void 0:ze.label)??o}):t("integrations.settings.all")]}),Me&&Ai(n,Me.kind)&&s.jsx("button",{type:"button",className:"btn","aria-disabled":S!==null||void 0,onClick:ie=>Re({mode:"add",kind:Me.kind},ie.currentTarget),children:t("integrations.settings.addConn",{label:((tt=au(Me.kind))==null?void 0:tt.label)??Me.kind})})]}),Me?s.jsx(h0e,{connection:Me,provider:au(Me.kind),available:Ai(n,Me.kind),busy:S,armed:F===g,note:I.find(ie=>ie.id===g),headingRef:y,onTest:()=>ge(Me),onEdit:ie=>Re({mode:"edit",id:Me.id},ie),onDisconnect:ie=>ve(Me,ie),onCancelDisconnect:()=>U(null)}):s.jsx("p",{role:"status",children:t("integrations.settings.noLongerSaved")})]}),s.jsxs("div",{className:"ig-overview",hidden:w!==null||g!==null||o!==null,children:[i&&s.jsxs("div",{className:"ig-list-error",role:"alert",children:[s.jsx("p",{children:i}),s.jsx("button",{type:"button",className:"btn",onClick:()=>void Bf(),children:t("integrations.retry")})]}),a===null&&!i&&s.jsx("p",{role:"status",children:t("integrations.settings.reading")}),b&&s.jsx("p",{className:"ig-note",role:"status",children:b}),s.jsxs("div",{className:"ig-connection-list","data-setting":"integrations-connections",children:[a!==null&&s.jsx("div",{className:"ig-providers","data-setting":"integrations-add",id:ke==="all"?"integrations-add-title":void 0,children:Se.map(ie=>{const je=pe.filter(fe=>fe.kind===ie.kind),Fe=je.length===1?je[0]:null,Ge=[...new Set(je.map(pr))],Te=Fe&&Pj(Fe),nt=(Fe==null?void 0:Fe.kind)==="jira"?Mj(Fe):null;return s.jsxs("section",{className:"ig-provider",id:`ig-provider-${ie.kind}`,"aria-labelledby":`ig-provider-name-${ie.kind}`,"data-setting":`integration-${ie.kind}`,children:[s.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:s.jsx(ie.Glyph,{})}),s.jsxs("div",{className:"ig-summary-text ig-provider-content",children:[s.jsx("h3",{id:`ig-provider-name-${ie.kind}`,children:ie.label}),je.length===0?s.jsx("span",{className:"ig-conn-line",children:t("integrations.settings.notConnected")}):Fe?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ig-conn-name",children:pr(Fe)}),s.jsx("span",{className:"ig-conn-line",children:[Fe.account.login||Fe.account.name,nt||(Te?t("integrations.conn.lastVerifiedAt",{when:Te}):t("integrations.conn.notVerified"))].filter(Boolean).join(" · ")}),!Fe.tokenSaved&&s.jsx("span",{className:"ig-bad",children:t("integrations.conn.noToken")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ig-conn-name",children:t("integrations.settings.count",{count:je.length})}),s.jsxs("span",{className:"ig-conn-line",children:[Ge.slice(0,2).join(" · "),Ge.length>2?` · ${t("integrations.settings.moreInstances",{n:Ge.length-2})}`:""]})]}),!ae.has(ie.kind)&&s.jsx("span",{className:"ig-stranded",children:t("integrations.conn.unavailable",{label:ie.label})})]}),s.jsx("button",{type:"button",className:`btn ig-manage${je.length?"":" primary"}`,"aria-disabled":S!==null||void 0,ref:fe=>{const Ve=je.length?d.current:D.current;fe?Ve.set(ie.kind,fe):Ve.delete(ie.kind)},"aria-label":je.length?t("integrations.manageProvider",{label:ie.label}):t("integrations.form.connect",{provider:ie.label}),onClick:fe=>je.length?Pe(ie.kind,fe.currentTarget):Re({mode:"add",kind:ie.kind},fe.currentTarget),children:je.length?s.jsxs(s.Fragment,{children:[t("integrations.manage")," ",s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m6 4 4 4-4 4"})})]}):t("integrations.form.connectBtn")})]},ie.kind)})}),(xe.length>0||Se.length===0&&ke!=="all"&&a!==null)&&s.jsxs(Kt,{id:"integrations-list-title",title:t("integrations.settings.connections"),aside:s.jsx("span",{className:"settings-caption-count",children:xe.length}),children:[xe.map(ie=>Ae(ie,!0)),pe.length===0&&s.jsx("p",{className:"settings-row settings-row-status",children:t("integrations.settings.nothing")})]})]}),ke==="all"&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"ig-overview-info",children:s.jsxs("details",{className:"ig-access",children:[s.jsx("summary",{children:t("integrations.settings.accessSummary")}),s.jsx("p",{children:t("integrations.settings.accessBody")})]})})})]})]})}function g0e({theme:e}){return s.jsx("span",{className:"appearance-preview","data-swatch":e,children:s.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[s.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),s.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),s.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),s.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),s.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),s.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),s.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),s.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),s.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),s.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function m0e({theme:e,onTheme:t,singleKeys:n}){const a=se(),i=c=>{var g,f;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(c.key))return;c.preventDefault();const d=(g=c.target.closest("[data-theme-choice]"))==null?void 0:g.dataset.themeChoice,h=(Ks.indexOf(d??e)+(c.key==="ArrowLeft"||c.key==="ArrowUp"?-1:1)+Ks.length)%Ks.length;t(Ks[h]),(f=c.currentTarget.querySelectorAll('[role="radio"]')[h])==null||f.focus()},o=m.useRef(null),r=m.useRef(e);return m.useEffect(()=>{var u,h;const c=r.current;r.current=e;const d=document.activeElement;c===e||!d||!((u=o.current)!=null&&u.contains(d))||d.dataset.themeChoice!==c||(h=o.current.querySelector(`[data-theme-choice="${e}"]`))==null||h.focus()},[e]),s.jsx(Kt,{id:"appearance-theme-caption",title:a("settings.theme.title"),list:!1,settingId:"theme",aside:n&&s.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:a("settings.theme.keyTip"),children:"T"}),children:s.jsx("div",{ref:o,className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":n?"T":void 0,onKeyDown:i,children:Ks.map(c=>s.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","data-theme-choice":c,"data-setting":`theme-${c}`,"aria-checked":e===c,tabIndex:e===c?0:-1,onClick:()=>t(c),children:[s.jsx(g0e,{theme:c}),s.jsxs("span",{className:"appearance-theme-name",children:[OB(c,a),s.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:s.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},c))})})}const f0e=[["smallest","settings.reading.size.smallest","11 px"],["smaller","settings.reading.size.smaller","12 px"],["default","settings.reading.size.default","13 px"],["larger","settings.reading.size.larger","15 px"],["largest","settings.reading.size.largest","17 px"]],b0e=[["tightest","settings.reading.density.tightest","30%"],["tighter","settings.reading.density.tighter","50%"],["compact","settings.reading.density.compact","70%"],["default","settings.reading.density.default","100%"],["comfortable","settings.reading.density.comfortable","140%"]];function bD(){return s.jsx("svg",{className:"reading-selected-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",children:s.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 v0e({textSize:e,density:t,onTextSize:n,onDensity:a}){const i=se(),o=e!=="default"||t!=="default";return s.jsx("button",{type:"button",className:"btn",disabled:!o,onClick:()=>{n("default"),a("default")},children:i("settings.reading.reset")})}function k0e({textSize:e,density:t,onTextSize:n,onDensity:a}){const i=se();return s.jsxs(s.Fragment,{children:[s.jsxs("fieldset",{className:"reading-group",children:[s.jsx("legend",{children:i("settings.reading.sizeTitle")}),s.jsx("p",{id:"reading-size-help",children:i("settings.reading.sizeHelp")}),s.jsx("div",{className:"reading-options reading-segmented","aria-describedby":"reading-size-help","data-setting":"text-size",style:{"--reading-count":zq.length,"--reading-selected":zq.indexOf(e)},children:f0e.map(([o,r,c])=>{const d=i(r);return s.jsxs("label",{className:"reading-choice","data-size":o,children:[s.jsx("input",{type:"radio",name:"text-size","aria-label":`${d} ${c}`,value:o,checked:e===o,onChange:()=>n(o)}),s.jsx("span",{className:"reading-type-sample","aria-hidden":"true",children:"Aa"}),s.jsxs("span",{className:"reading-label",children:[s.jsx("strong",{children:d}),s.jsx("small",{children:c})]}),s.jsx(bD,{})]},o)})})]}),s.jsxs("fieldset",{className:"reading-group",children:[s.jsx("legend",{children:i("settings.reading.densityTitle")}),s.jsx("p",{id:"reading-density-help",children:i("settings.reading.densityHelp")}),s.jsx("div",{className:"reading-options reading-segmented","aria-describedby":"reading-density-help","data-setting":"density",style:{"--reading-count":Lq.length,"--reading-selected":Lq.indexOf(t)},children:b0e.map(([o,r,c])=>{const d=i(r);return s.jsxs("label",{className:"reading-choice",children:[s.jsx("input",{type:"radio",name:"density","aria-label":i("settings.reading.spacing",{label:d,note:c}),value:o,checked:t===o,onChange:()=>a(o)}),s.jsxs("span",{className:"reading-density-sample","data-density":o,"aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("span",{className:"reading-label",children:[s.jsx("strong",{children:d}),s.jsx("small",{children:c})]}),s.jsx(bD,{})]},o)})})]}),s.jsxs(Kt,{id:"reading-preview-title",title:i("settings.reading.preview"),children:[s.jsxs("div",{className:"reading-preview-row",children:[s.jsxs("div",{children:[s.jsx("strong",{children:i("settings.reading.sample1")}),s.jsx("span",{children:i("settings.reading.sample1State")})]}),s.jsx("span",{className:"reading-preview-time",children:"4m"})]}),s.jsxs("div",{className:"reading-preview-row",children:[s.jsxs("div",{children:[s.jsx("strong",{children:i("settings.reading.sample2")}),s.jsx("span",{children:i("settings.reading.sample2State")})]}),s.jsx("span",{className:"reading-preview-time",children:"12m"})]})]}),s.jsx("p",{className:"settings-foot",children:i("settings.reading.foot")})]})}function w0e({cli:e,running:t}){const n=se(),a=n("shell.terminal.versions",{product:qt,cli:e.version,running:t}),i=s.jsx("code",{children:e.command});return e.auto==="pending"||e.auto==="running"?s.jsx(Ct,{as:"div",name:n("shell.terminal.name"),note:a,control:s.jsx("span",{className:"settings-read",children:e.auto==="running"?n("shell.terminal.updating"):n("shell.terminal.updatingSoon")}),children:s.jsx("span",{className:"settings-row-said",children:e.auto==="running"?n("shell.terminal.updatingNow"):Ej(n("shell.terminal.soon"),"cmd",i)})}):s.jsx(Ct,{as:"div",name:n("shell.terminal.name"),note:e.auto==="failed"?a:n("shell.terminal.notUpdated",{versions:a}),control:s.jsx("span",{className:"settings-read",children:n("shell.terminal.needed")}),children:s.jsxs("span",{className:"settings-row-said",children:[e.auto==="failed"&&s.jsxs(s.Fragment,{children:[e.error?n("shell.terminal.failedWith",{error:e.error}):n("shell.terminal.failed")," "]}),Ej(n("shell.terminal.run"),"cmd",i)]})})}const y0e="AGPL-3.0-only",x0e="https://github.com/BarganConstantin/ccdeck",C0e="https://github.com/sponsors/BarganConstantin";function S0e(e,t=x){return t("settings.about.pageBehind",{bundle:e})}function N0e(e,t){return ti(e)&&ti(t)&&_o(e,t)<0}function j0e(e,t,n=x){return e?{kind:"ready",to:e.version,name:n("settings.about.updateReady"),note:n("settings.about.updateReadyNote",{product:qt,version:e.version})}:t?t.kind==="restart"?{kind:"notice",name:n("settings.about.updateInstalled"),note:n("settings.about.updateInstalledNote",{to:t.to,from:t.from})}:{kind:"notice",name:n("settings.about.updateAvailable"),note:n("settings.about.updateAvailableNote",{product:qt,to:t.to,from:t.from})}:null}function A0e({version:e,notice:t,readyAppUpdate:n,updateRestarting:a,updateFailure:i,onUpdateRestart:o,doors:r,bundle:c="3.81.1"}){const d=se(),u=(e==null?void 0:e.running)??c,h=j0e(n,t,d);return s.jsxs(s.Fragment,{children:[s.jsxs(Kt,{id:"settings-about-caption",title:qt,children:[s.jsx(Ct,{as:"div",settingId:"version",name:d("settings.about.version"),note:N0e(c,e==null?void 0:e.running)?S0e(c,d):void 0,control:s.jsx("span",{className:"settings-read",children:u})}),(e==null?void 0:e.terminalCli)&&s.jsx(w0e,{cli:e.terminalCli,running:u}),h&&s.jsx(T0e,{offer:h,restarting:a,failure:i,onRestart:o,onUpdate:r.update}),s.jsx(Ct,{as:"div",settingId:"whats-new",name:d("settings.about.whatsNew"),note:d("settings.about.whatsNewNote"),control:s.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":d("settings.about.openWhatsNew"),onClick:r.whatsNew,children:d("settings.about.open")})}),s.jsx(Ct,{as:"div",settingId:"licence",name:d("settings.about.licence"),note:d("settings.about.licenceNote"),control:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"settings-read",children:y0e}),s.jsxs("a",{className:"settings-link",href:x0e,target:"_blank",rel:"noreferrer",children:[d("settings.about.source"),s.jsx("span",{className:"vis-hidden",children:d("settings.about.sourceHidden")})]})]})}),s.jsx(Ct,{as:"div",settingId:"sponsor",name:d("settings.about.sponsor"),note:d("settings.about.sponsorNote"),control:s.jsxs("a",{className:"settings-link",href:C0e,target:"_blank",rel:"noreferrer",children:[d("settings.about.sponsorLink"),s.jsx("span",{className:"vis-hidden",children:d("settings.about.sponsorHidden")})]})})]}),s.jsxs(Kt,{id:"settings-about-help-caption",title:d("settings.about.helpGroup"),children:[s.jsx(Ct,{as:"div",settingId:"tour",name:d("settings.about.tour"),note:d("settings.key.tourText"),control:s.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":d("settings.about.startTour"),onClick:r.tour,children:d("settings.about.start")})}),s.jsx(Ct,{as:"div",settingId:"feedback",name:d("settings.about.feedback"),note:d("settings.about.feedbackNote"),control:s.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":d("settings.about.openFeedback"),onClick:r.feedback,children:d("settings.about.open")})})]})]})}function T0e({offer:e,restarting:t,failure:n,onRestart:a,onUpdate:i}){const o=se();if(e.kind==="notice")return s.jsx(Ct,{as:"div",name:e.name,note:e.note,control:s.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog",onClick:i,children:o("settings.about.updateBtn")})});const r=FW(e.to,t),c=n&&n.version===e.to?UW(n.failure,n.version):"";return s.jsx(Ct,{as:"div",name:e.name,note:e.note,control:s.jsx("button",{type:"button",className:"btn",onClick:()=>a(e.to),"aria-busy":t||void 0,"aria-label":r.label,title:r.title,children:r.text}),children:s.jsx("span",{className:"settings-row-said",role:"status",children:c})})}function R0e(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 E0e={plain:"settings.updates.plainDetails","checks-off":"settings.updates.checksOffDetails","no-restart":"settings.updates.noRestartDetails"};function q0e({autoRestart:e,onToggleAutoRestart:t,version:n,inApp:a=zo()}){const i=se(),o=R0e(n,a);return s.jsx(Kt,{id:"settings-updates-caption",title:i("settings.updates.title"),children:o==="app"?s.jsx(Ct,{as:"div",settingId:"auto-update",name:i("settings.updates.title"),note:i("settings.updates.appNote")}):s.jsx(Ct,{settingId:"auto-update",name:i("settings.updates.label"),nameId:"settings-auto-update-label",note:i(o==="no-restart"?"settings.updates.noRestartNote":o==="checks-off"?"settings.updates.checksOffNote":"settings.updates.plainNote"),details:i(E0e[o]),noteId:"settings-auto-update-note",control:s.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:s.jsx("span",{className:"switch-knob"})})})})}function _0e({character:e,onCharacter:t}){const n=se(),a=m.useRef([]);function i(o,r){var d;const c=yf(o,r,yg.length,"vertical");c.kind==="select"&&(o.preventDefault(),t(yg[c.index].id),(d=a.current[c.index])==null||d.focus())}return s.jsx("div",{className:"character-picker",role:"radiogroup","aria-label":n("settings.character.choose"),"data-setting":"character-choice",children:yg.map((o,r)=>s.jsxs("button",{type:"button",className:"character-choice",role:"radio","aria-checked":e===o.id,tabIndex:e===o.id?0:-1,ref:c=>{a.current[r]=c},onClick:()=>t(o.id),onKeyDown:c=>i(c,r),children:[s.jsx("span",{className:"character-preview",children:s.jsx(JU,{character:o.id,act:null,facing:"right"})}),s.jsx("span",{children:o.name}),s.jsx("svg",{className:"character-check",viewBox:"0 0 16 16","aria-hidden":!0,focusable:"false",children:s.jsx("path",{d:"m3 8 3 3 7-7",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})})]},o.id))})}function z0e({characterEnabled:e,onToggleCharacter:t,character:n="deck",onCharacter:a}){const i=se();return s.jsxs(Kt,{id:"appearance-character-caption",title:i("settings.character.title"),list:!1,children:[s.jsx("div",{className:"settings-list",children:s.jsx(Ct,{settingId:"character",name:i("settings.character.show"),nameId:"appearance-character-label",note:i("settings.character.note"),noteId:"appearance-character-note",control:s.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":e,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:t,children:s.jsx("span",{className:"switch-knob"})})})}),s.jsx(_0e,{character:n,onCharacter:a})]})}const vD="settings-search-field",d5="settings-search-results",Ij=e=>`settings-result-${e}`;function L0e({inputRef:e,query:t,onQuery:n,results:a,active:i,onActive:o,onOpen:r}){const c=se(),d=t.trim()!=="",u=d&&a.length>0,h=g=>{if(g.nativeEvent.isComposing)return;const f=tce(g.key,t,d?a.length:0,i);f.kind!=="pass"&&(g.preventDefault(),f.kind==="move"?o(f.index):f.kind==="open"?r(a[f.index]):(g.stopPropagation(),n("")))};return s.jsxs("div",{className:"settings-search",children:[s.jsx("label",{className:"vis-hidden",htmlFor:vD,children:c("settings.search.label")}),s.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:[s.jsx("circle",{cx:"6",cy:"6",r:"4.2"}),s.jsx("path",{d:"m9.2 9.2 3.3 3.3"})]}),s.jsx("input",{ref:e,id:vD,type:"search",className:"settings-filter-field settings-search-field",placeholder:c("settings.search.label"),autoComplete:"off",spellCheck:!1,role:"combobox","aria-autocomplete":"list","aria-expanded":u,"aria-controls":u?d5:void 0,"aria-activedescendant":u?Ij(Math.min(i,a.length-1)):void 0,"aria-keyshortcuts":"Control+F Meta+F",value:t,onChange:g=>n(g.target.value),onKeyDown:h})]})}function O0e({query:e,results:t,active:n,onOpen:a}){const i=se(),o=DB(t.length,e);return m.useEffect(()=>{var r,c;(c=(r=document.getElementById(Ij(n)))==null?void 0:r.scrollIntoView)==null||c.call(r,{block:"nearest"})},[n]),s.jsxs("div",{className:"settings-pane",role:"region","aria-labelledby":"settings-search-title",children:[s.jsx("div",{className:"settings-pane-head",children:s.jsxs("div",{className:"settings-pane-heading",children:[s.jsx("h2",{className:"settings-pane-title",id:"settings-search-title",children:i("settings.search.title")}),s.jsx("p",{className:"settings-pane-note","aria-hidden":!0,children:o})]})}),t.length>0&&s.jsx("div",{className:"settings-group",children:s.jsx("div",{className:"settings-list",id:d5,role:"listbox","aria-label":i("settings.search.results"),children:t.map((r,c)=>s.jsxs("button",{type:"button",role:"option",id:Ij(c),className:"settings-result",tabIndex:-1,"aria-selected":c===n,"aria-label":Zre(r),"data-highlighted":c===n,onMouseDown:d=>d.preventDefault(),onClick:()=>a(r),children:[s.jsx(sf,{section:r.section}),s.jsxs("span",{className:"settings-result-text",children:[s.jsx("span",{className:"settings-result-name",children:r.label}),s.jsx("span",{className:"settings-result-place",children:KA(r)})]})]},r.id))})})]})}function P0e({query:e,count:t}){return s.jsx("p",{className:"vis-hidden",role:"status",children:e.trim()?DB(t,e):""})}const M0e=1500,I0e=3e3,D0e=e=>e.checkVisibility?e.checkVisibility():e.getClientRects().length>0;function F0e(e){if(e.matches(Wg)&&!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(Wg)).filter(a=>oU({disabled:a.disabled,tabIndex:a.tabIndex,rendered:D0e(a)}));return n.find(a=>a.closest(".settings-list")!=null)??n[0]??null}function U0e(e,t,n){const[a,i]=m.useState(null),o=m.useRef(void 0),r=m.useRef(null);return m.useEffect(()=>()=>{var c;window.clearTimeout(o.current),(c=r.current)==null||c.removeAttribute("data-jumped")},[]),m.useEffect(()=>{const c=e.current;if(!a||!t||!c)return;const d=()=>c.querySelector(`[data-setting="${CSS.escape(a)}"]`),u=b=>{var y,N;i(null);const k=b.offsetHeight>c.clientHeight-48;b.scrollIntoView({block:k?"start":"center"}),(y=F0e(b))==null||y.focus({preventScroll:!0}),window.clearTimeout(o.current),(N=r.current)==null||N.removeAttribute("data-jumped"),b.offsetWidth,b.setAttribute("data-jumped",""),r.current=b,o.current=window.setTimeout(()=>{b.removeAttribute("data-jumped"),r.current===b&&(r.current=null)},M0e)},h=d();if(h){u(h);return}const g=new MutationObserver(()=>{const b=d();b&&(g.disconnect(),window.clearTimeout(f),u(b))});g.observe(c,{childList:!0,subtree:!0});const f=window.setTimeout(()=>{g.disconnect(),i(null)},I0e);return()=>{g.disconnect(),window.clearTimeout(f)}},[e,a,t,n]),i}function B0e({section:e,landOn:t,onSection:n,onClose:a,providers:i,sound:o,tones:r,customTones:c,notify:d,appearance:u,versionCheck:h,desktopUpdate:g,restart:f,doors:b}){const k=se(),y=m.useRef(null),N=m.useCallback(Te=>{y.current=Te},[]);function w(Te,nt=!1){y.current?(W(""),y.current(Te,nt),requestAnimationFrame(()=>{var fe,Ve;return(Ve=(fe=S.current)==null?void 0:fe.scrollIntoView)==null?void 0:Ve.call(fe,{block:"nearest",inline:"nearest"})})):Te()}const j=()=>w(a,!0),S=m.useRef(null),A=Tt(j,{focusRef:S}),T=Rt(()=>w(a)),q=m.useRef([]),_=hh(),I=t0(_),z=Zoe(I,e,i.claude),F=Math.max(0,z.findIndex(Te=>Te.id===e)),U=_l("(max-width: 640px)"),[P,L]=m.useState(""),[R,O]=m.useState(0),D=m.useRef(null),$=m.useRef(null),B=P.trim()!=="",G=m.useMemo(()=>ece(P,IB(i.claude,I,ph(_))),[P,i.claude,I,_,k]),Z=U0e($,!B,e),W=Te=>{L(Te),O(0)};m.useEffect(()=>{t&&Z(t)},[t,Z]);const H=Te=>{w(()=>{W(""),n(Te),requestAnimationFrame(()=>{var nt;return(nt=document.getElementById(`settings-tab-${Te}`))==null?void 0:nt.focus()})})},X=Te=>{w(()=>{W(""),n(Te.section),af(Te)||Z(Te.id)})};m.useEffect(()=>{const Te=nt=>{var gt,mt;if(!are(nt))return;const fe=A.current,Ve=nt.target;!fe||!(Ve===document.body||Ve===document.documentElement||Ve&&fe.contains(Ve))||(nt.preventDefault(),(gt=D.current)==null||gt.focus(),(mt=D.current)==null||mt.select())};return window.addEventListener("keydown",Te),()=>window.removeEventListener("keydown",Te)},[A]),m.useEffect(()=>{var Te,nt,fe,Ve;Xoe((Te=document.activeElement)==null?void 0:Te.id,e)&&((nt=S.current)==null||nt.focus()),(Ve=(fe=S.current)==null?void 0:fe.scrollIntoView)==null||Ve.call(fe,{block:"nearest",inline:"nearest"})},[e]);const{theme:V,setTheme:Q,characterEnabled:Y,setCharacterEnabled:K,character:ee,setCharacter:te}=u,ce=On(),ge=Te=>{const nt=yf(Te,F,z.length,"vertical");nt.kind!=="pass"&&(Te.preventDefault(),w(()=>{var fe;W(""),n(z[nt.index].id),(fe=q.current[nt.index])==null||fe.focus()}))},ve=Te=>{Te.key===" "&&Te.stopPropagation()},{soundOn:pe,toggleSound:ae}=o,{tonePrefs:le,previewTone:Se,changeTone:ke}=r,{customSelections:ye,customAssets:We,clearCustomOnly:He,selectCustomTone:Ke,importNotificationAudio:Re,createNotificationVoice:Je,renameCustomAsset:Pe,deleteCustomAsset:Ae,previewCustomAsset:xe}=c,{notifyPermission:ze,notifyOn:Ce,notifyVetoed:Me,toggleNotify:Ee,notifySupported:Be,askForNotifications:tt,accountNotify:ie,toggleAccountNotify:je}=d,Fe=(()=>{switch(e){case"radar":return s.jsx($Te,{onOpen:b.radar});case"claude":return s.jsx(r0e,{});case"appearance":return s.jsxs(s.Fragment,{children:[s.jsx(m0e,{theme:V,onTheme:Q,singleKeys:ce}),s.jsx(z0e,{characterEnabled:Y,character:ee,onCharacter:te,onToggleCharacter:()=>K(Te=>!Te)})]});case"reading":return s.jsx(k0e,{textSize:u.textSize,density:u.density,onTextSize:u.setTextSize,onDensity:u.setDensity});case"keyboard":return s.jsx(qTe,{singleKeys:ce,onToggleSingleKeys:()=>qne(!ce)});case"notifications":return s.jsx(_Te,{notifyOn:Ce,onToggleNotify:Ee,notifyVetoed:Me,notifyPermission:Be?ze:"unsupported",onAskNotify:tt,accountNotify:ie,onToggleAccountNotify:je});case"sounds":return s.jsx(GTe,{soundOn:pe===!0,onToggleSound:ae,prefs:le,claudeHere:i.claude,onLevel:(Te,nt)=>ke(Te,{level:nt}),onFigure:(Te,nt)=>ke(Te,{figure:nt}),onPreview:Te=>Se(Te),customAssets:We,customSelections:ye,onBuiltInSelected:He,onCustomSelected:Ke,onImportCustom:Re,onCreateVoice:Je,onRenameCustom:Pe,onPreviewCustom:xe,onDeleteCustom:Ae});case"integrations":return s.jsx(p0e,{onBeforeLeaveChange:N});case"data":return s.jsx(l0e,{});case"about":return s.jsx(A0e,{version:h.version,notice:h.notice,readyAppUpdate:g.readyAppUpdate,updateRestarting:g.desktopUpdateRestarting,updateFailure:g.desktopUpdateFailure,onUpdateRestart:Te=>{g.askDesktopUpdateRestart(Te)},doors:b});default:return s.jsxs(s.Fragment,{children:[s.jsx(CTe,{}),s.jsx(NTe,{}),s.jsx(lD,{provider:"Codex"}),i.claude&&s.jsx(lD,{provider:"Claude"}),s.jsx(q0e,{autoRestart:f.autoRestart,onToggleAutoRestart:f.toggleAutoRestart,version:h.version}),s.jsx(TTe,{claudeHere:i.claude,codexHere:i.codex,singleKeys:ce,doors:b})]})}})(),Ge=e==="reading"?s.jsx(v0e,{textSize:u.textSize,density:u.density,onTextSize:u.setTextSize,onDensity:u.setDensity}):e==="integrations"&&_.connections!==null?s.jsx("span",{className:"ig-total",children:k("settings.savedConnections",{count:_.connections.length})}):null;return s.jsx("div",{className:"modal-backdrop",...T,role:"presentation",children:s.jsxs("div",{ref:A,id:"settings",className:"modal settings-modal",role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",onClick:Te=>Te.stopPropagation(),onKeyDown:ve,children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"settings-title",className:"modal-tool-name",children:k("settings.title")})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>w(a),"aria-label":k("settings.close"),title:k("settings.closeTip"),children:"×"})})]}),s.jsxs("div",{className:"settings-body",children:[s.jsxs("div",{className:"settings-side",children:[s.jsx(L0e,{inputRef:D,query:P,onQuery:W,results:G,active:R,onActive:O,onOpen:X}),s.jsx(P0e,{query:P,count:G.length}),s.jsx("div",{className:"settings-nav",role:"tablist","aria-label":k("settings.sections"),"aria-orientation":U?"horizontal":"vertical",onKeyDown:ge,children:z.map((Te,nt)=>s.jsxs("button",{ref:fe=>{q.current[nt]=fe,Te.id===e&&(S.current=fe)},type:"button",role:"tab",id:`settings-tab-${Te.id}`,className:"settings-tab","aria-selected":Te.id===e,"aria-controls":"settings-pane",tabIndex:Te.id===e?0:-1,onClick:()=>H(Te.id),children:[s.jsx(sf,{section:Te.id}),s.jsx("span",{className:"settings-tab-label",children:k(`settings.section.${Te.id}.label`)})]},Te.id))})]}),s.jsxs("div",{ref:$,className:"settings-pane",role:"tabpanel",id:"settings-pane","aria-labelledby":`settings-tab-${e}`,hidden:B||void 0,children:[s.jsxs("div",{className:"settings-pane-head",children:[s.jsxs("div",{className:"settings-pane-heading",children:[s.jsx("h2",{className:"settings-pane-title",children:k(`settings.section.${z[F].id}.label`)}),s.jsx("p",{className:"settings-pane-note",children:k(`settings.section.${z[F].id}.note`)})]}),Ge]}),Fe]},e),B&&s.jsx(O0e,{query:P,results:G,active:R,onOpen:X})]})]})})}function H0e({tool:e,onClose:t}){const n=se(),a=Tt(t),i=Rt(t),o=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=m.useRef({of:null});r.current.of!==e&&(r.current={of:e}),e.input!==void 0&&(r.current.input=e.input),e.response!==void 0&&(r.current.response=e.response);const c=r.current.input??e.inputPreview,d=r.current.response??e.errorPreview,u=e.trimmed===!0&&r.current.input===void 0&&r.current.response===void 0,h=m.useMemo(()=>{const g=oQ(e.name,c,d);return{input:g.input.map((f,b)=>s.jsx(kD,{block:f},b)),response:g.response.map((f,b)=>s.jsx(kD,{block:f},b)),copyInput:d1(e.name,"input",c),copyResponse:d1(e.name,"response",d)}},[e.name,c,d]);return s.jsx("div",{className:"modal-backdrop",...i,role:"presentation",children:s.jsxs("div",{ref:a,className:"modal tool-modal",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("span",{className:`status-dot ${o}`,"aria-hidden":!0}),s.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),s.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("span",{className:"modal-dur",children:sU(e,n("insights.tool.inflight"))}),s.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":n("insights.audit.closeEsc"),title:n("insights.audit.closeEsc"),children:"×"})]})]}),s.jsxs("section",{className:"modal-body",children:[u&&s.jsx("div",{className:"modal-section",children:s.jsx("p",{className:"modal-note",children:n("insights.tool.released")})}),s.jsxs("div",{className:"modal-section",children:[s.jsxs("div",{className:"tm-head",children:[s.jsx("h4",{children:n("insights.cost.inputTitle")}),s.jsx(wD,{text:h.copyInput,what:"input"})]}),h.input]}),s.jsxs("div",{className:"modal-section",children:[s.jsxs("div",{className:"tm-head",children:[s.jsxs("h4",{children:[n("insights.tool.response")," ",o==="err"&&s.jsx("span",{className:"err-tag",children:n("insights.tool.error")})]}),e.endedAt!=null&&s.jsx(wD,{text:h.copyResponse,what:"response"})]}),e.endedAt==null?s.jsx("pre",{children:n("insights.tool.waiting")}):h.response]})]})]})})}const W0e={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function kD({block:e}){const[t,n]=m.useState(!1);if(e.inline)return s.jsxs("p",{className:"tm-inline",children:[e.label&&s.jsx("span",{className:"tm-label",children:e.label}),s.jsx("code",{children:e.text})]});const a=m.useMemo(()=>QX(e),[e]),{shown:i}=q2(a,t),o=eQ(a,t);return s.jsxs("div",{className:"tm-block",children:[e.label&&s.jsx("span",{className:"tm-label",children:e.label}),s.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?i.map((r,c)=>s.jsxs("span",{className:r.tone?W0e[r.tone]:void 0,children:[r.text,c<i.length-1?`
|
|
351
|
+
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.`}]},n0="agent-dag.releaseNotesSeen";function iD(e){return e.split(/[.\-+]/).map(t=>parseInt(t,10)).map(t=>Number.isNaN(t)?0:t)}function _o(e,t){const n=iD(e),a=iD(t);for(let i=0;i<Math.max(n.length,a.length);i++){const o=(n[i]??0)-(a[i]??0);if(o!==0)return o<0?-1:1}return 0}function ti(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function UAe(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 BAe(e){if(!e||typeof e!="object")return[];const t=[];for(const[n,a]of Object.entries(e)){if(!ti(n)||!Array.isArray(a))continue;const i=a.filter(UAe).map(c=>({title:c.title,body:c.body,...typeof c.details=="string"&&c.details.trim()?{details:c.details}:{},...c.priority==="highlight"||c.priority==="required"?{priority:c.priority}:{},...typeof c.notice=="string"&&c.notice.trim()?{notice:c.notice}:{},...typeof c.notice=="string"&&c.notice.trim()&&typeof c.noticeLabel=="string"&&c.noticeLabel.trim()&&c.noticeLabel.length<=32?{noticeLabel:c.noticeLabel}:{},...c.icon==="plans"||c.icon==="accounts"||c.icon==="skills"?{icon:c.icon}:{}})),o=e["//summaries"],r=o&&typeof o=="object"&&Object.hasOwn(o,n)?o[n]:void 0;i.length&&t.push({version:n,notes:i,...typeof r=="string"&&r.trim()?{summary:r}:{}})}return t.sort((n,a)=>_o(a.version,n.version))}function HAe(e){const t=e.filter(o=>o.priority==="highlight").slice(0,3),n=t.length>0,a=e.filter(o=>!t.includes(o)&&(!n||o.priority==="required"||o.priority==="highlight"||!!o.notice)),i=e.filter(o=>!t.includes(o)&&!a.includes(o));return{highlights:t,visible:a,more:i}}function WAe(e,t,n){const[a,...i]=e;if(!t)return{latest:ti(n)?e.find(c=>_o(c.version,n)===0):a,visiblePrevious:[],history:[]};const o=[],r=[];for(const c of i){const d=c.notes.some(g=>g.priority==="highlight"||g.priority==="required"||!!g.notice),u=c.notes.filter(g=>!d||g.priority==="required"||!!g.notice);u.length&&o.push({version:c.version,notes:u});const h=c.notes.filter(g=>!u.includes(g));h.length&&r.push({...c,notes:h})}return{latest:a,visiblePrevious:o,history:r}}const oD=BAe(FAe);function n5(e,t,n){return e.filter(a=>_o(a.version,n)<=0&&(t===null||_o(a.version,t)>0))}function GAe(e,t){return e.filter(n=>_o(n.version,t)===0)}function $Ae(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 VAe=new RegExp("^(?:\\p{Extended_Pictographic}|\\p{Emoji_Modifier}|\\p{Regional_Indicator}|[\\u200D\\uFE0F])+(?= \\S)","u");function a5(e){const t=VAe.exec(e);return t?{icon:t[0],rest:e.slice(t[0].length)}:{icon:null,rest:e}}function KAe(e){if(!e)return null;let t=null;try{t=e.getItem(n0)}catch{return null}return ti(t)?t:null}function JAe(e){if(!e)return!1;try{return e.getItem(n0),!0}catch{return!1}}function YAe(e,t){if(!e)return!1;try{return e.setItem(n0,t),!0}catch{return!1}}const s5="agent-dag.tourSeen";function ZAe(e){if(!e)return!1;try{return e.getItem(s5)==="1"}catch{return!1}}function XAe(e){if(!e)return!1;try{return e.setItem(s5,"1"),!0}catch{return!1}}function QAe({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 eTe({stored:e,running:t,notes:n,remembers:a=!0}){if(!ti(t))return{show:[],record:null,reason:"no-version"};if(!ti(e)){if(!a)return{show:[],record:t,reason:"cannot-remember"};const r=GAe(n,t);return r.length?{show:r,record:t,reason:"welcome"}:{show:[],record:t,reason:"first-run"}}const i=_o(e,t);if(i===0)return{show:[],record:null,reason:"seen"};if(i>0)return{show:[],record:null,reason:"ahead"};const o=n5(n,e,t);return o.length?{show:o,record:t,reason:"new-notes"}:{show:[],record:t,reason:"nothing-new"}}function tTe(e,t){if(/\s|^$/.test(e[t+2]??""))return-1;let n=t+2;for(;n<e.length;){if(e[n]==="`"){const a=e.indexOf("`",n+1);if(a<0)break;n=a+1;continue}if(e.startsWith("**",n)&&!/\s/.test(e[n-1]??" "))return n;n++}return-1}function mu(e,t=!0){const n=[];let a="";const i=()=>{a&&(n.push({kind:"text",text:a}),a="")};let o=0;for(;o<e.length;){if(e[o]==="`"){const r=e.indexOf("`",o+1);if(r>o+1){i(),n.push({kind:"code",text:e.slice(o+1,r)}),o=r+1;continue}}else if(t&&e.startsWith("**",o)){const r=tTe(e,o);if(r>0){i(),n.push({kind:"bold",kids:mu(e.slice(o+2,r),!1)}),o=r+2;continue}}a+=e[o],o+=1}return i(),n}function zo(e=typeof navigator>"u"?"":navigator.userAgent){return/\bccdeck-desktop\/\d/.test(e)}const nTe=()=>x("shell.update.checkWhy"),rD=()=>x("shell.update.checking"),aTe=()=>x("shell.update.npmUnreachable"),sTe=()=>x("shell.update.deckUnreachable"),iTe=()=>x("shell.update.checksOff"),oTe=()=>x("shell.update.pendingRetry");function rTe(e,t,n,a){const i=a?t.npx:n?un(t,n):void 0;return i?x("shell.update.outBlocked",{to:e,reason:i}):x("shell.update.outRun",{to:e})}const ca=(e,t={})=>({said:e,tone:"answer",age:null,command:null,action:null,...t}),br=e=>ca(e,{tone:"note"});function cD(e,t){return xNe(t-e)}function cTe(e,t){const n=e.update;return(n==null?void 0:n.status)==="ready"?br(x("shell.update.appReady",{version:n.version??""})):(n==null?void 0:n.status)==="checking"?br(x("shell.update.appChecking")):(n==null?void 0:n.status)==="downloading"?br(n.version?x("shell.update.appDownloadingVersion",{version:n.version}):x("shell.update.appDownloading")):(n==null?void 0:n.status)==="current"?br(x("shell.update.appCurrent",{version:e.version??t})):(n==null?void 0:n.status)==="error"?br(x("shell.update.appError")):br(x("shell.update.appIdle"))}function lTe(e,t,n){var r;const a=e.version;if((a==null?void 0:a.upgradeMode)==="install"&&e.upgradeState!=="failed"){if(e.upgradeState==="done")return ca(x("shell.update.installed",{to:t}));const c=e.upgradeState==="running",d=x("shell.update.installWhy",{command:((r=a.upgrade)==null?void 0:r.command)??a.command});return ca(c?x("shell.update.installing",{to:t}):x("shell.update.out",{to:t}),{action:{kind:"install",label:x("shell.update.now"),busy:c,why:d}})}if((a==null?void 0:a.upgradeMode)==="npx"&&a.canRestart){const c=e.upgradeState==="failed";return ca(c?x("shell.update.npxFailedBack",{to:t,running:e.running}):x("shell.update.out",{to:t}),{action:{kind:"npx",label:x(c?"shell.update.retry":"shell.update.andRestart"),busy:e.restarting,why:x("shell.update.npxWhy",{command:a.command})}})}const i=e.upgradeState==="failed"?x("shell.update.installFailed",{to:t}):rTe(t,n,a==null?void 0:a.upgradeBlocked,(a==null?void 0:a.upgradeMode)==="npx"),o=(a==null?void 0:a.command)??null;return ca(i,{command:o,action:o?{kind:"copy",label:e.copied?x("shell.copied"):x("shell.copy"),busy:!1}:null})}function dTe(e){const t=e.version;if(e.unreachable)return ca(sTe(),{tone:"warn"});const n=t!=null&&t.checkFailedAt&&t.checkFailedAt>(t.checkedAt??0)?t.checkFailedAt:null;if(n)return ca(aTe(),{tone:"warn",age:e.answered?null:x("shell.update.lastTried",{ago:cD(n,e.now)})});const a=t!=null&&t.latestPending&&t.latestPending!==e.running?t.latestPending:null;if(a)return ca(x("shell.update.pending",{pending:a,retry:oTe()}));const i=t!=null&&t.checkedAt?cD(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)&&ti(t.latest)&&ti(e.running)){const r=_o(t.latest,e.running),c=r===0?x("shell.update.latest",{version:e.running}):r<0?x("shell.update.ahead",{running:e.running,latest:t.latest}):x("shell.update.out",{to:t.latest});return ca(c,{age:i?x("shell.update.checkedAgo",{ago:i}):null})}return ca(x(i?"shell.update.mayHaveChanged":"shell.update.noneYet"),{age:i?x("shell.update.lastChecked",{ago:i}):null})}function uTe(e,t){var i,o;const n=e.version;if((i=e.app)!=null&&i.inApp&&(n!=null&&n.checkDisabled)){const r=cTe(e.app,e.running);return r&&{canCheck:!0,checking:e.checking||((o=e.app.update)==null?void 0:o.status)==="checking",line:e.unreachable?ca(x("shell.update.appRefused"),{tone:"warn"}):e.checking?ca(rD()):r}}if(n!=null&&n.checkDisabled)return{canCheck:!1,checking:!1,line:br(iTe())};const a=(n==null?void 0:n.notice)??null;if((a==null?void 0:a.kind)==="upgrade")return{canCheck:!0,checking:e.checking,line:lTe(e,a.to,t)};if((a==null?void 0:a.kind)==="restart"){const r=n!=null&&n.canRestart?x("shell.update.restartDeck",{to:a.to}):x("shell.update.restartApp",{to:a.to});return{canCheck:!0,checking:e.checking,line:ca(r)}}return e.checking?{canCheck:!0,checking:!0,line:ca(rD())}:{canCheck:!0,checking:!1,line:dTe(e)}}const i5=450;async function hTe(e,t=n=>new Promise(a=>setTimeout(a,n))){const[n]=await Promise.all([e(!0),t(i5)]);return n?"answered":"unreachable"}async function pTe(e=fetch){try{const[t]=await Promise.all([e("/api/desktop-update/check",{method:"POST",signal:AbortSignal.timeout(8e3)}),new Promise(n=>setTimeout(n,i5))]);return t.ok?"answered":"unreachable"}catch{return"unreachable"}}const gTe=()=>x("shell.notes.restartWhy");function mTe(e){var _,I,z;Aa();const t=(e==null?void 0:e.versionCheck.versionChecking)??!1,n=si(3e4),[a,i]=m.useState(!1),o=m.useRef(!1),[r,c]=m.useState(!1),[d,u]=m.useState(!1),h=m.useRef(t);if(m.useEffect(()=>{h.current&&!t&&u(!0),h.current=t},[t]),!e)return null;const{versionCheck:g,upgrade:f,restart:b,desktopUpdate:k,running:y,onHandOff:N}=e,w=uTe({version:g.version,running:y,checking:a||t,answered:d,unreachable:r,now:Math.max(n,Date.now()),upgradeState:f.upgradeState,copied:f.cmdCopied,restarting:b.restarting,app:{inApp:zo(),update:k.appUpdate,version:MW(),menu:DW()}},Rj);if(!w)return null;const j=zo()&&((_=g.version)==null?void 0:_.checkDisabled),S=j?x("shell.update.checkWhyApp"):nTe(),A=async()=>{var U;if(!Qn(o.current||t)||j&&((U=k.appUpdate)==null?void 0:U.status)==="checking")return;o.current=!0,i(!0);const F=j?await pTe():await hTe(g.loadVersion);o.current=!1,i(!1),c(F==="unreachable"),u(!0)},T=F=>{if(F.kind==="copy")return void f.copyCommand();N(),g.showNotice(),F.kind==="install"?f.startUpgrade():b.askRestart({upgrade:!0})},q=w.line.tone==="warn"||!!w.line.action||!!((I=g.version)!=null&&I.notice)||((z=k.appUpdate)==null?void 0:z.status)==="downloading";return{state:w,check:A,act:T,checkWhy:S,needsAttention:q}}function fTe({update:e}){const t=ql("above","dialog"),n=m.useId();return Aa(),s.jsxs("div",{className:"rn-status-row",children:[e?s.jsx(bTe,{line:e.state.line,onAct:e.act,bindHint:t.bind,whyId:`${n}-action`,announce:!1}):s.jsx("p",{className:"rn-update-line",children:s.jsx("span",{role:"status",children:x("shell.notes.statusUnavailable")})}),t.node]})}function bTe({line:e,onAct:t,bindHint:n,whyId:a,announce:i=!0}){const{action:o}=e,r=o&&s.jsx(vTe,{action:o,onAct:t,bindHint:n,whyId:a});return s.jsxs("p",{className:"rn-update-line","data-tone":e.tone,children:[s.jsx("span",{className:"rn-update-what",role:i?"status":void 0,children:e.said}),e.age&&s.jsx("span",{className:"rn-update-age",children:e.age}),e.command?s.jsxs("span",{className:"rn-update-cmd",children:[s.jsx("code",{className:"rn-code",children:e.command}),r]}):r]})}function vTe({action:e,onAct:t,bindHint:n,whyId:a}){const i=e.kind==="copy"?null:e.why;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:i?"btn primary rn-line-act":"btn rn-line-act",onClick:()=>t(e),"aria-busy":e.busy||void 0,"aria-describedby":i&&a?a:void 0,...i&&n?n({label:i}):{},children:e.label}),i&&a&&s.jsx("span",{hidden:!0,id:a,children:i})]})}function kTe({entries:e,since:t,running:n,firstRun:a,onClose:i,onTour:o,updateVersion:r,updateBusy:c,onUpdateRestart:d,updateFailure:u,onRestart:h,updateCheck:g}){var O,D;const f=se(),b=gTe(),k=Tt(i),y=m.useRef(null),N=Rt(i),w=m.useId(),[j,S]=m.useState(null),A=mTe(g),T=((O=A==null?void 0:A.state.line.action)==null?void 0:O.kind)==="install"||((D=A==null?void 0:A.state.line.action)==null?void 0:D.kind)==="npx",q=h&&!r&&!T,{latest:_,visiblePrevious:I,history:z}=WAe(e,t!==null,n),F=`${w}-history`,U=!!q||!!(A!=null&&A.state.canCheck)&&!r;m.useEffect(()=>{var $;!U&&j&&(S(null),document.activeElement===document.body&&(($=y.current)==null||$.focus()))},[U,j]);const P=ti(n)?`v${n}`:$Ae(e.slice(0,1)),L=a&&n?f("shell.notes.contextFirst",{version:n}):t?f("shell.notes.contextSince",{since:t}):null,R=I.some($=>$.notes.some(B=>!B.priority&&!B.notice));return s.jsx("div",{className:"modal-backdrop",...N,role:"presentation",children:s.jsxs("div",{ref:k,className:"modal release-notes",id:`${w}-dialog`,onClick:$=>$.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"release-notes-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("span",{id:"release-notes-title",className:"modal-tool-name",children:f("shell.notes.title")}),P&&s.jsx("span",{className:"modal-tool-id",children:P})]}),s.jsxs("div",{className:"modal-actions",children:[U&&s.jsx("button",{id:`${w}-options`,type:"button",className:"glyph-btn","aria-label":f("shell.notes.moreOptions"),"aria-haspopup":"menu","aria-expanded":j!==null,"aria-controls":j?`${w}-menu`:void 0,onClick:()=>S(j?null:"first"),onKeyDown:$=>{($.key==="ArrowDown"||$.key==="ArrowUp")&&($.preventDefault(),S($.key==="ArrowUp"?"last":"first"))},children:s.jsxs("svg",{className:"glyph",viewBox:"0 0 14 14",width:"14",height:"14",fill:"currentColor","aria-hidden":"true",children:[s.jsx("circle",{cx:"3",cy:"7",r:"1"}),s.jsx("circle",{cx:"7",cy:"7",r:"1"}),s.jsx("circle",{cx:"11",cy:"7",r:"1"})]})}),s.jsx("button",{ref:y,type:"button",className:"glyph-btn",onClick:i,"aria-label":f("shell.closeEsc"),title:f("shell.closeEsc"),children:"×"})]})]}),s.jsx("span",{className:"rn-live-status",role:"status",children:r?f("shell.notes.downloaded",{version:r}):A==null?void 0:A.state.line.said}),s.jsxs("section",{className:"modal-body",role:"region","aria-label":f("shell.notes.region"),tabIndex:0,children:[r?s.jsxs("div",{className:"rn-ready",children:[s.jsx("p",{children:f("shell.notes.downloaded",{version:r})}),s.jsx("p",{className:"rn-update-said",role:"status",children:u})]}):s.jsxs(s.Fragment,{children:[(A==null?void 0:A.needsAttention)&&s.jsx(fTe,{update:A}),s.jsx("p",{className:"rn-update-said",role:"status",children:u})]}),L&&s.jsx("p",{className:"rn-context",children:L}),!(_!=null&&_.notes.length)&&!I.length&&s.jsx("p",{className:"rn-empty",children:f("shell.notes.empty")}),_&&s.jsx(WS,{entry:_,showVersion:t!==null&&e.length>1},_.version),I.length>0&&s.jsxs("section",{className:"rn-upgrade-history","aria-label":f("shell.notes.earlierLabel"),children:[s.jsx("h2",{className:"rn-group-title",children:f("shell.notes.earlierTitle")}),R&&s.jsx("p",{className:"rn-context",children:f("shell.notes.legacy")}),I.map($=>s.jsx(WS,{entry:$,showVersion:!0},$.version))]}),z.length>0&&s.jsxs("details",{className:"rn-history",children:[s.jsx("summary",{"aria-controls":F,children:f("shell.notes.otherSince",{since:t??""})}),s.jsx("div",{id:F,children:z.map($=>s.jsx(WS,{entry:$,showVersion:!0},$.version))})]})]}),s.jsxs("footer",{className:"rn-footer",children:[s.jsxs("div",{className:"rn-footer-links",children:[s.jsxs("a",{href:"https://ccdeck.dev/changelog/",target:"_blank",rel:"noopener noreferrer","aria-label":f("shell.notes.historyLabel"),children:[f("shell.notes.history")," ",s.jsx(xl,{})]}),o&&!r&&s.jsx("button",{className:"rn-text-button",type:"button",onClick:o,children:f("shell.notes.tour")})]}),r&&d?s.jsx("button",{className:"btn primary",type:"button",onClick:d,"aria-busy":c||void 0,children:c?f("shell.notes.restarting"):Hu()}):s.jsx("button",{className:"btn primary",type:"button",onClick:i,children:f("shell.done")})]}),j&&U&&s.jsxs(Wr,{anchorId:`${w}-options`,portalRootId:`${w}-dialog`,id:`${w}-menu`,role:"menu",labelledBy:`${w}-options`,start:j,className:"ap-pop rn-options-menu",onClose:()=>S(null),children:[A&&s.jsxs("p",{className:"rn-menu-status",id:`${w}-check-status`,children:[A.state.line.said,A.state.line.age&&s.jsx("span",{children:A.state.line.age})]}),(A==null?void 0:A.state.canCheck)&&s.jsxs("button",{type:"button",className:"ap-menu-item rn-act",role:"menuitem",title:A.checkWhy,"aria-describedby":`${w}-check-status`,"aria-busy":A.state.checking||void 0,onClick:()=>void A.check(),children:[s.jsx(doe,{}),f("shell.notes.check")]}),(A==null?void 0:A.state.canCheck)&&q&&s.jsx("div",{className:"rn-menu-separator",role:"separator"}),q&&s.jsxs("button",{type:"button",className:"ap-menu-item",role:"menuitem",title:b,"aria-describedby":`${w}-restart-why`,onClick:()=>{S(null),h==null||h()},children:[s.jsx(uoe,{}),f("shell.notes.restart")]}),s.jsx("span",{hidden:!0,id:`${w}-restart-why`,children:b})]})]})})}function WS({entry:e,showVersion:t}){const n=se(),{highlights:a,visible:i,more:o}=HAe(e.notes),r=a.filter(d=>d.details),c=m.useId();return s.jsxs("section",{className:"rn-release",children:[t&&s.jsxs("h2",{className:"rn-version",children:["v",e.version]}),e.summary&&s.jsx("h2",{className:"rn-summary",children:e.summary}),s.jsxs("ul",{className:"rn-notes",children:[a.map((d,u)=>s.jsx(GS,{note:d,highlight:!0},`h${u}`)),i.map((d,u)=>s.jsx(GS,{note:d},`v${u}`))]}),(o.length>0||r.length>0)&&s.jsxs("details",{className:"rn-more",children:[s.jsxs("summary",{"aria-controls":c,children:[s.jsxs("span",{className:"rn-more-start",children:[s.jsx("span",{className:"rn-chevron","aria-hidden":"true",children:"›"}),s.jsx("span",{className:"rn-more-label",children:o.length?n("shell.notes.more",{count:o.length}):n("shell.notes.moreDetails")})]}),s.jsxs("span",{className:"rn-more-hint",children:[s.jsx("span",{className:"rn-show-details",children:n("shell.notes.show")}),s.jsx("span",{className:"rn-hide-details",children:n("shell.notes.hide")})]})]}),s.jsxs("div",{id:c,children:[s.jsx("ul",{className:"rn-notes",children:o.map((d,u)=>s.jsx(GS,{note:d},u))}),r.length>0&&s.jsxs("div",{className:"rn-highlight-details",role:"group","aria-labelledby":`${c}-highlights`,children:[s.jsx("h3",{id:`${c}-highlights`,className:"rn-details-title",children:n("shell.notes.aboutHighlights")}),r.map((d,u)=>s.jsxs("p",{className:"rn-note-body",children:[s.jsxs("strong",{className:"rn-strong",children:[a5(d.title).rest.trimStart(),": "]}),fu(mu(d.details))]},u))]})]})]})]})}const wTe={plans:pB,accounts:gB,skills:mB};function GS({note:e,highlight:t}){const n=se(),{icon:a,rest:i}=a5(e.title),o=!a&&e.icon?un(wTe,e.icon):void 0;return s.jsxs("li",{className:"rn-note","data-highlight":t||void 0,"data-required":e.priority==="required"||void 0,"data-has-icon":!!o||void 0,children:[o&&s.jsx("span",{className:"rn-title-icon","aria-hidden":"true",children:s.jsx(o,{})}),s.jsxs("div",{children:[s.jsxs("h3",{className:"rn-note-title",children:[a&&s.jsx("span",{className:"rn-note-icon",children:a}),a?i:i.trimStart()]}),s.jsx("p",{className:"rn-note-body",children:fu(mu(e.body))}),!t&&e.details&&s.jsx("p",{className:"rn-note-body rn-extra-detail",children:fu(mu(e.details))}),e.notice&&s.jsxs("p",{className:"rn-note-notice",children:[s.jsxs("strong",{children:[e.noticeLabel??n("shell.notes.important"),": "]}),fu(mu(e.notice))]})]})]})}function fu(e){return e.map((t,n)=>t.kind==="text"?t.text:t.kind==="code"?s.jsx("code",{className:"rn-code",children:t.text},n):s.jsx("strong",{className:"rn-strong",children:fu(t.kids)},n))}function yTe({state:e,sessionId:t,onClose:n}){const a=se(),i=m.useMemo(()=>xTe(e,t),[e,e.revision,t]),o=m.useRef(null),r=Tt(n,{focusRef:o}),c=Rt(n);return i?s.jsx("div",{className:"modal-backdrop",...c,role:"presentation",children:s.jsxs("div",{ref:r,className:"modal session-summary",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"ss-title",children:[s.jsxs("div",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("span",{className:"state-pill state-done","aria-hidden":!0,children:a("insights.summary.done")}),s.jsx("span",{id:"ss-title",className:"modal-tool-name",title:i.cwd??i.sessionId,children:i.label}),s.jsxs("span",{className:"modal-tool-id",children:["· ",i.sessionId.slice(0,8)]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("span",{className:"modal-dur",title:a("insights.summary.wall"),children:i.durationLabel}),s.jsx("button",{type:"button",ref:o,className:"glyph-btn",onClick:n,"aria-label":a("insights.audit.closeEsc"),title:a("insights.audit.closeEsc"),children:"×"})]})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("section",{className:"ss-hero",children:[s.jsxs("div",{className:"ss-hero-left",children:[s.jsx("div",{className:"ss-cost-label",children:Sle()}),s.jsx("div",{className:"ss-cost",children:Nt(i.cost.total)}),i.modelChips.length>0&&s.jsx("div",{className:"ss-models",children:i.modelChips.map(d=>s.jsx("span",{className:"model-chip","data-family":Mm(d),title:d,children:So(d)},d))})]}),s.jsx("div",{className:"ss-hero-right",children:i.cost.total>0&&s.jsxs(s.Fragment,{children:[s.jsx(tT,{cost:i.cost,size:"lg"}),s.jsxs("div",{className:"ss-cost-legend",children:[s.jsxs("span",{className:"ssl ssl-in",children:[a("insights.cost.input")," ",s.jsx("b",{children:Nt(i.cost.input)})]}),s.jsxs("span",{className:"ssl ssl-out",children:[a("insights.cost.output")," ",s.jsx("b",{children:Nt(i.cost.output)})]}),s.jsxs("span",{className:"ssl ssl-cr",children:[a("insights.summary.cacheR")," ",s.jsx("b",{children:Nt(i.cost.cacheRead)})]}),s.jsxs("span",{className:"ssl ssl-cw",children:[a("insights.summary.cacheW")," ",s.jsx("b",{children:Nt(i.cost.cacheWrite)})]})]})]})})]}),s.jsxs("section",{className:"ss-stats",children:[s.jsx(Fc,{label:a("insights.summary.agents"),value:i.agentCount}),s.jsx(Fc,{label:a("insights.summary.subagents"),value:i.subagentCount}),s.jsx(Fc,{label:a("insights.summary.toolCalls"),value:i.toolCount}),s.jsx(Fc,{label:a("insights.summary.prompts"),value:i.promptCount}),s.jsx(Fc,{label:a("insights.usage.tokens"),value:i.tokensSum.toLocaleString(Le())}),i.errCount>0&&s.jsx(Fc,{label:a("insights.summary.errors"),value:i.errCount,tone:"err"})]}),i.topTools.length>0&&s.jsxs("section",{className:"modal-section",children:[s.jsx("h4",{children:a("insights.summary.topTools")}),s.jsx("div",{className:"ss-top-tools",children:i.topTools.map(([d,u])=>s.jsxs("div",{className:"ss-tt",children:[s.jsx("span",{className:"ss-tt-name",children:d}),s.jsx("span",{className:"ss-tt-bar",children:s.jsx("span",{className:"ss-tt-bar-fill",style:{width:`${u/i.topTools[0][1]*100}%`}})}),s.jsx("span",{className:"ss-tt-count",children:u})]},d))})]}),i.firstPrompt&&s.jsxs("section",{className:"modal-section",children:[s.jsx("h4",{children:a("insights.summary.opening")}),s.jsx("div",{className:"ss-prompt",children:i.firstPrompt})]})]})]})}):null}function Fc({label:e,value:t,tone:n}){return s.jsxs("div",{className:`ss-stat${n?` tone-${n}`:""}`,children:[s.jsx("div",{className:"ss-stat-value",children:t}),s.jsx("div",{className:"ss-stat-label",children:e})]})}function xTe(e,t){const n=e.agents.get(t);if(!n)return null;const a=[];for(const S of e.agents.values())S.sessionId===t&&a.push(S);if(a.length===0)return null;const i={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},o=new Set,r=new Map;let c=0,d=0,u=0,h=0,g=0,f,b=1/0,k=0;for(const S of a){const A=pa(S);i.input+=A.input,i.output+=A.output,i.cacheRead+=A.cacheRead,i.cacheWrite+=A.cacheWrite,i.total+=A.total;for(const q of Y2(S))o.add(q);S.model&&o.add(S.model),S.kind==="subagent"&&g++;const T=S2(S.prompts);d+=T.length,!f&&T.length>0&&(f=T[0].text),u+=S.usage.inputTokens+S.usage.outputTokens,c+=S.toolCount,h+=S.toolErrorCount??0;for(const[q,_]of S.toolCountByName??[])r.set(q,(r.get(q)??0)+_);b=Math.min(b,S.startedAt),k=Math.max(k,S.endedAt??Date.now())}const y=Math.max(0,k-b),N=Math.floor(y/1e3),w=N<60?`${N}s`:N<3600?`${Math.floor(N/60)}m ${String(N%60).padStart(2,"0")}s`:`${Math.floor(N/3600)}h ${Math.floor(N%3600/60)}m`,j=Array.from(r.entries()).sort((S,A)=>A[1]-S[1]).slice(0,5);return{sessionId:t,label:n.label||n.cwdBasename||x("insights.summary.session"),cwd:n.cwd,durationLabel:w,cost:i,modelChips:Array.from(o),agentCount:a.length,subagentCount:g,toolCount:c,promptCount:d,tokensSum:u,errCount:h,topTools:j,firstPrompt:f}}function Kt({id:e,title:t,note:n,noteId:a,aside:i,list:o=!0,settingId:r,className:c,children:d}){const u=c?`settings-group ${c}`:"settings-group",h=o?s.jsx("div",{className:"settings-list",children:d}):d;return t===void 0?s.jsx("div",{className:u,"data-setting":r,children:h}):s.jsxs("section",{className:u,"aria-labelledby":e,"data-setting":r,children:[s.jsxs("div",{className:"settings-caption",children:[s.jsxs("div",{className:"settings-caption-text",children:[s.jsx("h3",{id:e,children:t}),n&&s.jsx("p",{className:"settings-caption-note",id:a,children:n})]}),i]}),h]})}function Ct({name:e,nameId:t,note:n,noteId:a,control:i,as:o="label",settingId:r,className:c,details:d,children:u}){const h=se(),g=o,f=s.jsxs(g,{className:c?`settings-row ${c}`:"settings-row","data-setting":r,children:[s.jsx("span",{className:"settings-row-name",id:t,children:e}),n&&s.jsx("span",{className:"settings-row-note",id:a,children:n}),i!==void 0&&s.jsx("span",{className:"settings-row-control",children:i}),u]});return d?s.jsxs("div",{className:"settings-row-with-details",children:[f,s.jsxs("details",{className:"settings-row-details",children:[s.jsxs("summary",{children:[h("common.details"),s.jsxs("span",{className:"vis-hidden",children:[h("common.aboutBefore"),e,h("common.aboutAfter")]})]}),s.jsx("div",{children:d})]})]}):f}function CTe(){const e=se(),t=Aa();return s.jsx(Kt,{id:"settings-language-caption",title:e("settings.language.group"),children:s.jsx(Ct,{settingId:"language",name:e("settings.language.name"),nameId:"settings-language-label",note:e("settings.language.note"),noteId:"settings-language-note",control:s.jsx("select",{className:"sm-select",value:t,"aria-labelledby":"settings-language-label","aria-describedby":"settings-language-note",onChange:n=>JX(n.target.value),children:Al.map(n=>s.jsx("option",{value:n.code,lang:n.code,dir:n.dir,children:WX(n)},n.code))})})})}function o5(e,t,n){const[a,i]=m.useState(null),[o,r]=m.useState(!1),[c,d]=m.useState(""),u=m.useRef(!1),h=f=>typeof f=="boolean"?f:t;return m.useEffect(()=>{let f=!0;return fetch("/api/prefs").then(b=>{if(!b.ok)throw new Error;return b.json()}).then(b=>{var k;if(!b.ok)throw new Error;f&&i(h((k=b.prefs)==null?void 0:k[e]))}).catch(()=>{f&&d(n("settings.recover.readFail"))}),()=>{f=!1}},[e]),{enabled:a,busy:o,error:c,change:async()=>{if(!(a===null||!Qn(u.current))){u.current=!0,r(!0),d("");try{const f=await fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[e]:!a})});if(!f.ok)throw new Error;const b=await f.json();if(!b.ok)throw new Error;i(h(b.prefs[e]))}catch{d(n("settings.recover.saveFail"))}finally{u.current=!1,r(!1)}}}}}function lD({provider:e}){const t=e==="Codex"?"recoverCodexSessions":"recoverClaudeSessions",n=`${e.toLowerCase()}-session-recovery`,a=se(),i=o5(t,!0,a);return s.jsxs(Kt,{id:`${n}-title`,title:a("settings.recover.group",{provider:e}),children:[s.jsx(Ct,{settingId:n,name:a("settings.recover.name"),note:a(e==="Codex"?"settings.recover.codexNote":"settings.recover.claudeNote"),details:a(e==="Codex"?"settings.recover.codexDetails":"settings.recover.claudeDetails"),control:s.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":a(e==="Codex"?"settings.recover.codexAria":"settings.recover.claudeAria"),"aria-checked":i.enabled===!0,...ua(i.busy,i.enabled===null),onClick:()=>{i.change()},children:s.jsx("span",{className:"switch-knob"})})}),i.error&&s.jsx("p",{role:"alert",children:i.error}),e==="Claude"&&s.jsx(STe,{t:a})]})}function STe({t:e}){const t=o5("continueStopped",!1,e);return s.jsxs(s.Fragment,{children:[s.jsx(Ct,{settingId:"claude-continue-stopped",name:e("settings.recover.continueName"),note:e("settings.recover.continueNote"),details:e("settings.recover.continueDetails"),control:s.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":e("settings.recover.continueAria"),"aria-checked":t.enabled===!0,...ua(t.busy,t.enabled===null),onClick:()=>{t.change()},children:s.jsx("span",{className:"switch-knob"})})}),t.error&&s.jsx("p",{role:"alert",children:t.error})]})}function NTe(){const e=se(),t=bW();return s.jsx(Kt,{id:"settings-board-caption",title:e("settings.board.title"),children:s.jsx(Ct,{settingId:"hide-finished",name:e("settings.board.hideLabel"),nameId:"settings-hide-finished-label",note:e("settings.board.hideNote"),details:e("settings.board.hideDetails"),noteId:"settings-hide-finished-note",control:s.jsx("select",{className:"sm-select",value:t,"aria-labelledby":"settings-hide-finished-label","aria-describedby":"settings-hide-finished-note",onChange:n=>gCe(Number(n.target.value)),children:pW.map(n=>s.jsx("option",{value:n,children:n===0?e("settings.board.never"):e("settings.board.minutes",{n})},n))})})})}const jTe="Codex accounts",ATe="Your Codex profiles and what each has left, and which one new sessions use.";function TTe({claudeHere:e,codexHere:t=!1,singleKeys:n,doors:a}){const i=se();return s.jsxs(Kt,{id:"settings-elsewhere-caption",title:i("lan.ew.group"),children:[(e||t)&&s.jsx($S,{settingId:"accounts",name:e?i("lan.ew.accounts"):jTe,note:e?i("lan.ew.accountsNote"):ATe,onOpen:a.accounts,cap:n?{key:"A",title:i("lan.ew.pressA")}:null}),e&&s.jsx($S,{settingId:"local-network",name:i("lan.ew.lan"),note:i("lan.ew.lanNote"),onOpen:a.localNetwork,cap:null}),s.jsx($S,{settingId:"browser-watch",name:i("lan.ew.watch"),note:i("lan.ew.watchNote"),onOpen:a.browserWatch,dialog:!0,cap:n?{key:"B",title:i("lan.ew.pressB")}:null})]})}function $S({settingId:e,name:t,note:n,onOpen:a,cap:i,dialog:o=!1}){const r=se(),c=`settings-${e}`;return s.jsx(Ct,{as:"div",settingId:e,name:t,nameId:`${c}-name`,note:n,control:s.jsxs(s.Fragment,{children:[i&&s.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:i.title,children:i.key}),s.jsx("button",{type:"button",className:"btn",id:`${c}-open`,"aria-labelledby":`${c}-open ${c}-name`,"aria-haspopup":o?"dialog":void 0,"aria-keyshortcuts":i?i.key:void 0,onClick:a,children:r("lan.ew.open")})]})})}function RTe(e){const t=e.binds.includes("?")?x("settings.keyboard.sheetName"):e.action;return t.charAt(0).toUpperCase()+t.slice(1)}function ETe(e,t){const n=t.trim().toLowerCase();return n?[e.action,e.cap,e.macCap??""].some(a=>a.toLowerCase().includes(n)):!0}function qTe({singleKeys:e,onToggleSingleKeys:t}){const n=se(),a=Po(Ao()),[i,o]=m.useState(""),r=m.useId(),c=hh(),d=e5(e,u=>Ai(c,u)).map(u=>({...u,rows:u.rows.filter(h=>ETe(h,i))})).filter(u=>u.rows.length>0);return s.jsxs(s.Fragment,{children:[s.jsx(Kt,{children:s.jsx(Ct,{settingId:"single-keys",name:n("settings.keyboard.singleKeys"),nameId:"settings-single-keys-label",note:n("settings.keyboard.singleKeysNote"),noteId:"settings-single-keys-note",control:s.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:s.jsx("span",{className:"switch-knob"})})})}),s.jsxs("div",{className:"settings-filter",children:[s.jsx("label",{className:"vis-hidden",htmlFor:r,children:n("settings.keyboard.filter")}),s.jsx("input",{id:r,type:"search",className:"settings-filter-field",placeholder:n("settings.keyboard.filter"),autoComplete:"off",spellCheck:!1,value:i,onChange:u=>o(u.target.value),onKeyDown:u=>{Bm(u.key)&&i&&(u.stopPropagation(),o(""))}})]}),d.map(u=>{const h=`settings-keys-${u.id}`;return s.jsx(Kt,{id:h,title:u.title,className:"settings-keys",children:u.rows.map(g=>s.jsx(Ct,{as:"div",name:RTe(g),control:s.jsx("kbd",{className:"settings-key",children:a&&g.macCap?g.macCap:g.cap})},`${g.cap}:${g.action}`))},u.id)}),d.length===0&&s.jsx("p",{className:"settings-empty",role:"status",children:n("settings.keyboard.noMatch",{query:i.trim()})}),i.trim()===""&&s.jsx("p",{className:"settings-foot",children:n("settings.key.note")})]})}function _Te({notifyOn:e,onToggleNotify:t,notifyVetoed:n,notifyPermission:a,onAskNotify:i,accountNotify:o,onToggleAccountNotify:r}){const c=se(),d=dre(a,c),u=zo(),h=e&&!n&&!u,g=m.useRef(null),f=Vs(!d.ask,g);return s.jsxs(s.Fragment,{children:[s.jsxs(Kt,{id:"sm-closed-caption",title:c("settings.notify.closedGroup"),children:[s.jsx(Ct,{settingId:"notify-closed",name:c("settings.notify.closedName"),nameId:"sm-notify-label",note:n?c("settings.notify.veto"):lre(u,c),noteId:"sm-notify-note",control:s.jsx("button",{ref:g,type:"button",role:"switch","aria-checked":e,"aria-labelledby":"sm-notify-label","aria-describedby":"sm-notify-note",className:"switch",onClick:t,children:s.jsx("span",{className:"switch-knob"})})}),h&&s.jsx(Ct,{as:"div",name:c("settings.notify.browserName"),nameId:"sm-channel-name",note:d.note,control:d.ask?s.jsx("button",{type:"button",className:"btn sm-channel-action",onClick:()=>{f(),i()},children:c("settings.notify.enable")}):s.jsxs("span",{className:"sm-channel-state","data-ok":d.ok||void 0,children:[d.ok&&s.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:s.jsx("path",{d:"M1.5 5.2 3.9 7.6 8.5 2.4"})}),d.status]})})]}),s.jsx(Kt,{id:"sm-accounts-caption",title:c("settings.notify.accountsGroup"),note:c(n?"settings.notify.accountsVeto":"settings.notify.accountsNote"),children:ON.map(({kind:b,label:k,title:y})=>s.jsx(Ct,{settingId:b,name:k,nameId:`sm-${b}-label`,note:y,noteId:`sm-${b}-note`,control:s.jsx("button",{type:"button",role:"switch","aria-checked":o[b],"aria-labelledby":`sm-${b}-label`,"aria-describedby":`sm-${b}-note`,className:"switch",onClick:()=>r(b),children:s.jsx("span",{className:"switch-knob"})})},b))})]})}const zTe=["audio/webm;codecs=opus","audio/ogg;codecs=opus","audio/mp4"];function LTe(e){return zTe.find(t=>e(t))}const OTe=4400;function PTe(e){const t=e.split(";")[0],n=t==="audio/mp4"?"m4a":t==="audio/ogg"?"ogg":"webm";return{name:`${x("radio.rec.name")}.${n}`,type:t}}function MTe({full:e,setCustomError:t,runCustom:n,onImportCustom:a}){const[i,o]=m.useState(!1),r=m.useRef(null),c=m.useRef(null),d=m.useRef(!1),u=()=>{var g;c.current!==null&&clearTimeout(c.current),c.current=null,((g=r.current)==null?void 0:g.state)==="recording"&&r.current.stop()},h=async()=>{var f;if(e)return;if(t(""),!((f=navigator.mediaDevices)!=null&&f.getUserMedia)||typeof MediaRecorder>"u"){t(x("radio.rec.noMic"));return}let g;try{g=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{d.current||t(x("radio.rec.denied"));return}if(d.current||r.current){g.getTracks().forEach(b=>b.stop());return}try{const b=LTe(N=>MediaRecorder.isTypeSupported(N)),k=new MediaRecorder(g,b?{mimeType:b}:void 0),y=[];r.current=k,k.ondataavailable=N=>{N.data.size&&y.push(N.data)},k.onerror=()=>t(x("radio.rec.failed")),k.onstop=()=>{g.getTracks().forEach(S=>S.stop()),c.current!==null&&clearTimeout(c.current),c.current=null;const N=r.current===k;if(N&&(r.current=null),o(!1),!N||!y.length)return;const w=PTe(k.mimeType),j=new File(y,w.name,{type:w.type});n(()=>a(j))},k.start(200),o(!0),c.current=setTimeout(u,OTe)}catch{r.current=null,g.getTracks().forEach(b=>b.stop()),t(x("radio.rec.format"))}};return m.useEffect(()=>(d.current=!1,()=>{d.current=!0,c.current!==null&&clearTimeout(c.current);const g=r.current;r.current=null,(g==null?void 0:g.state)==="recording"&&g.stop()}),[]),{recording:i,startRecording:h,stopRecording:u}}function ITe({full:e,fullProps:t,runCustom:n,onCreateVoice:a}){const i=se(),[o,r]=m.useState(()=>i("settings.sounds.voice.defaultName")),[c,d]=m.useState(()=>i("settings.sounds.voice.defaultText")),[u,h]=m.useState(""),[g,f]=m.useState("1"),[b,k]=m.useState("1"),[y,N]=m.useState([]);return m.useEffect(()=>{if(typeof window>"u"||!("speechSynthesis"in window))return;const w=()=>{N(window.speechSynthesis.getVoices())};return w(),window.speechSynthesis.addEventListener("voiceschanged",w),()=>window.speechSynthesis.removeEventListener("voiceschanged",w)},[]),s.jsxs("details",{className:"sm-voice",children:[s.jsxs("summary",{className:"settings-row",...t,onClick:w=>{const j=w.currentTarget.parentElement;e&&j&&!j.open&&w.preventDefault()},children:[s.jsx("span",{className:"settings-row-name",children:i("settings.sounds.voice.title")}),s.jsx("span",{className:"settings-row-note",children:i("settings.sounds.voice.note")}),s.jsx("span",{className:"settings-row-control",children:s.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:s.jsx("path",{d:"M5.5 3.5 9 7l-3.5 3.5"})})})]}),s.jsxs("div",{className:"sm-voice-fields",children:[s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.name")}),s.jsx("input",{className:"ap-manage-input",value:o,maxLength:80,onChange:w=>r(w.target.value)})]}),s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.text")}),s.jsx("input",{className:"ap-manage-input",value:c,maxLength:180,onChange:w=>d(w.target.value)})]}),s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.voice")}),s.jsxs("select",{className:"sm-select",value:u,onChange:w=>h(w.target.value),children:[s.jsx("option",{value:"",children:i("settings.sounds.voice.default")}),y.map(w=>s.jsx("option",{value:w.voiceURI,children:w.name},w.voiceURI))]})]}),s.jsxs("div",{className:"sm-voice-pair",children:[s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.rate")}),s.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:g,onChange:w=>f(w.target.value)})]}),s.jsxs("label",{children:[s.jsx("span",{children:i("settings.sounds.voice.pitch")}),s.jsx("input",{className:"ap-manage-input",type:"number",min:"0.5",max:"2",step:"0.1",value:b,onChange:w=>k(w.target.value)})]})]}),s.jsx("button",{type:"button",className:"btn sm-custom-action",...t,onClick:()=>{e||n(async()=>{await a({name:o,text:c,voiceURI:u,rate:parseFloat(g),pitch:parseFloat(b)}),d(i("settings.sounds.voice.defaultText"))})},children:i("settings.sounds.voice.add")})]})]})}function DTe({customAssets:e,onImportCustom:t,onCreateVoice:n,onRenameCustom:a,onPreviewCustom:i,onDeleteCustom:o}){const r=se(),[c,d]=m.useState(""),u=e.length,h=MN(u),g=h!==null,f=g?{"aria-disabled":!0,"aria-describedby":"sm-custom-full"}:{},[b,k]=m.useState(null),y=m.useRef(0),N=m.useRef(new Map),w=m.useRef(null),j=m.useRef(null);m.useEffect(()=>{if(!b)return;const I=window.setTimeout(()=>k(null),4e3);return()=>window.clearTimeout(I)},[b]);const S=async I=>{d("");try{await I()}catch(z){d(Pi(z,r("settings.sounds.custom.saveFail")))}},A=(I,z)=>{const F=Date.now(),U=Fr({armedFor:b,target:I,armedAt:y.current,now:F,gapMs:Dr});if(U==="arm"){k(I),y.current=F;return}if(U==="ignore")return;k(null);const P=vre(e.map(L=>L.id),I);S(async()=>{var R;await o(I);const L=document.activeElement;L!==z&&!ta((L==null?void 0:L.tagName)??null)||(R=P?N.current.get(P):w.current)==null||R.focus()})},{recording:T,startRecording:q,stopRecording:_}=MTe({full:g,setCustomError:d,runCustom:S,onImportCustom:t});return s.jsxs(Kt,{id:"sm-custom-title",title:r("settings.sounds.custom.title"),note:r("settings.sounds.custom.note"),aside:s.jsx("span",{className:"settings-caption-count",children:r("settings.sounds.custom.count",{count:u,max:PN})}),className:"sm-custom",settingId:"custom-sounds",children:[g&&s.jsx("p",{className:"settings-row settings-row-status",id:"sm-custom-full",children:h}),s.jsx(Ct,{as:"div",settingId:"custom-import",name:r("settings.sounds.custom.import"),note:r("settings.sounds.custom.importNote"),control:s.jsx("button",{ref:w,type:"button",className:"btn sm-custom-action",...f,onClick:()=>{var I;g||(I=j.current)==null||I.click()},children:r("settings.sounds.custom.chooseFile")}),children:s.jsx("input",{ref:j,type:"file",hidden:!0,accept:"audio/wav,audio/x-wav,audio/mpeg,audio/mp3,audio/ogg,.wav,.mp3,.ogg",onChange:I=>{var F;const z=(F=I.target.files)==null?void 0:F[0];I.currentTarget.value="",z&&!g&&S(()=>t(z))}})}),s.jsx(Ct,{as:"div",settingId:"custom-record",name:r("settings.sounds.custom.record"),note:r(T?"settings.sounds.custom.recording":"settings.sounds.custom.upTo5"),control:T?s.jsx("button",{type:"button",className:"btn sm-custom-action",onClick:_,children:r("settings.sounds.custom.stopSave")}):s.jsx("button",{type:"button",className:"btn sm-custom-action",...f,onClick:()=>void q(),children:r("settings.sounds.custom.recordBtn")})}),s.jsx(ITe,{full:g,fullProps:f,runCustom:S,onCreateVoice:n}),e.map(I=>s.jsxs("div",{className:"sm-custom-item",children:[s.jsx("input",{className:"ap-manage-input","aria-label":r("settings.sounds.custom.rename",{name:I.name}),defaultValue:I.name,maxLength:80,onBlur:z=>{if(!z.target.value.trim()){z.target.value=I.name;return}S(()=>a(I.id,z.target.value))},onKeyDown:z=>{z.key==="Enter"&&z.currentTarget.blur()}}),s.jsx("span",{children:I.kind==="audio"?`${AA(I.duration,1)}s`:r("settings.sounds.custom.voice")}),s.jsx("button",{type:"button",className:"btn sm-custom-icon","aria-label":r("settings.sounds.custom.playName",{name:I.name}),onClick:()=>i(I.id),children:r("settings.sounds.custom.play")}),s.jsx("button",{type:"button",ref:z=>{z?N.current.set(I.id,z):N.current.delete(I.id)},className:`btn sm-custom-icon${b===I.id?" armed":""}`,onKeyDown:z=>{z.repeat&&z.preventDefault()},onClick:z=>A(I.id,z.currentTarget),"aria-label":b===I.id?r("settings.sounds.custom.confirmName",{name:I.name}):r("settings.sounds.custom.deleteName",{name:I.name}),title:b===I.id?r("settings.sounds.custom.deleteAgain"):r("settings.sounds.custom.deleteTip"),children:b===I.id?r("settings.sounds.custom.confirm"):r("settings.sounds.custom.delete")})]},I.id)),c&&s.jsx("p",{className:"settings-row settings-row-status sm-custom-error",role:"alert",children:c})]})}function FTe({soundOn:e,onToggleSound:t}){const n=se(),a=m.useId(),i=On(),o=m.useId();return s.jsx(Kt,{children:s.jsx(Ct,{settingId:"play-sounds",name:n("radio.sound.name"),nameId:a,note:n("radio.sound.note"),noteId:o,control:s.jsxs(s.Fragment,{children:[i&&s.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:n("radio.sound.keyTitle"),children:"M"}),s.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-labelledby":a,"aria-describedby":o,"aria-keyshortcuts":i?"M":void 0,className:"switch",onClick:t,children:s.jsx("span",{className:"switch-knob"})})]})})})}const zj="custom:";function dD(e){return`${zj}${e}`}function UTe(e){return e.startsWith(zj)?e.slice(zj.length):null}function BTe({id:e,label:t,value:n,step:a=GA,onLevel:i,"aria-describedby":o}){const r=se();return s.jsxs("div",{className:"sm-row",children:[s.jsx("label",{htmlFor:e,children:t??r("radio.volume")}),s.jsx("input",{id:e,type:"range",min:xg,max:am,step:a,value:n,"aria-describedby":o,onChange:c=>i(Number(c.target.value)),style:{"--sm-level":`${(n-xg)/(am-xg)*100}%`}}),s.jsxs("span",{className:"sm-read",children:[n,"%"]})]})}const uD={get done(){return x("settings.sounds.tone.done")},get"needs-input"(){return x("settings.sounds.tone.needsInput")}},HTe={get done(){return x("settings.sounds.tone.doneNote")},get"needs-input"(){return x("settings.sounds.tone.needsInputNote")}};function WTe({chime:e,tone:t,soundOn:n,customAssets:a,customSelections:i,onLevel:o,onFigure:r,onPreview:c,onBuiltInSelected:d,onCustomSelected:u}){const h=se(),g=`sm-level-${e}`,f=`sm-figure-${e}`,b=i[e];return s.jsxs(Kt,{id:`sm-name-${e}`,title:uD[e],note:HTe[e],settingId:`tone-${e}`,aside:s.jsxs("button",{type:"button",className:"btn sm-hear",onClick:()=>c(e),"aria-label":h("settings.sounds.hearAria",{tone:uD[e]}),title:h(n?"settings.sounds.hearTip":"settings.sounds.hearTipMuted"),"aria-describedby":n?void 0:"sm-preview-note",children:[s.jsx("svg",{width:"11",height:"11",viewBox:"0 0 12 12",fill:"currentColor","aria-hidden":!0,children:s.jsx("path",{d:"M3 1.6v8.8l7-4.4z"})}),h("settings.sounds.hear")]}),children:[s.jsx(BTe,{id:g,value:t.level,onLevel:k=>o(e,k)}),s.jsxs("div",{className:"sm-row",children:[s.jsx("label",{htmlFor:f,children:h("settings.sounds.toneLabel")}),s.jsxs("select",{id:f,className:"sm-select",value:b?dD(b):t.figure,onChange:k=>{const y=k.target.value,N=UTe(y);N!==null?u(e,N):(d(e),r(e,y))},children:[WA[e].map(k=>s.jsx("option",{value:k.id,children:k.label},k.id)),a.length>0&&s.jsx("optgroup",{label:h("settings.sounds.customGroup"),children:a.map(k=>s.jsx("option",{value:dD(k.id),children:k.name},k.id))})]})]})]})}function GTe({soundOn:e,onToggleSound:t,prefs:n,claudeHere:a,onLevel:i,onFigure:o,onPreview:r,customAssets:c,customSelections:d,onBuiltInSelected:u,onCustomSelected:h,onImportCustom:g,onCreateVoice:f,onRenameCustom:b,onPreviewCustom:k,onDeleteCustom:y}){var A;const N=se(),w=fre(d),j=((A=c.find(T=>T.id===w))==null?void 0:A.name)??N("settings.sounds.sharedName"),S=w?N("settings.sounds.sharedNote",{name:j}):"";return s.jsxs("div",{className:"sm-sounds",children:[s.jsx(FTe,{soundOn:e,onToggleSound:t}),!a&&s.jsx("p",{className:"sm-note",children:N("settings.sounds.codexOnly")}),!e&&s.jsx("span",{id:"sm-preview-note",className:"vis-hidden",children:N("settings.sounds.previewNote")}),s.jsx("div",{className:"sm-tones",children:cu.map(T=>s.jsx(WTe,{chime:T,tone:n[T],soundOn:e,customAssets:c,customSelections:d,onLevel:i,onFigure:o,onPreview:r,onBuiltInSelected:u,onCustomSelected:h},T))}),S&&s.jsx("p",{className:"sm-note","aria-hidden":!0,children:S}),s.jsx("p",{className:"vis-hidden",role:"status",children:S}),s.jsx(DTe,{customAssets:c,onImportCustom:g,onCreateVoice:f,onRenameCustom:b,onPreviewCustom:k,onDeleteCustom:y})]})}function $Te({onOpen:e}){const t=se();return s.jsx(Kt,{children:s.jsx(Ct,{as:"div",settingId:"radar-open",name:t("radar.name"),nameId:"settings-radar-open-name",note:t("radar.note"),control:s.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:t("radar.open")})})})}const VTe=6500,KTe=1e4;let zr={reading:null,saving:null,error:"",undone:null};const Rg=new Set;let Hd=null,Wd=null,_i=null,VS=!1,Eg=0;const kr=e=>{zr={...zr,...e},Rg.forEach(t=>t(zr))};function r5(e){const t=e;return!!t&&t.ok===!0&&Array.isArray(t.settings)&&typeof t.present=="object"}async function c5(e){const t=await fetch("/api/claude-settings",{signal:e}),n=await t.json();if(!t.ok||!r5(n))throw new Error;return n}async function Lj(){if(VS||zr.saving)return;VS=!0;const e=Eg,t=new AbortController;_i=t;let n=!1;const a=setTimeout(()=>{n=!0,t.abort()},5e3);try{const i=await c5(t.signal);e===Eg&&!t.signal.aborted&&kr({reading:i,error:""})}catch{e===Eg&&(n||!t.signal.aborted)&&kr({error:x("settings.claude.readFail")})}finally{clearTimeout(a),VS=!1,_i===t&&(_i=null)}}function hD(e,t){var n;return(n=e==null?void 0:e.settings.find(a=>a.id===t))==null?void 0:n.value}async function pD(e,t){if(zr.saving)return;Eg++,_i==null||_i.abort(),Wd&&(clearTimeout(Wd),Wd=null),kr({saving:e,error:"",undone:null});const n=new AbortController,a=setTimeout(()=>n.abort(),15e3);try{const i=await fetch("/api/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,value:t}),signal:n.signal}),o=await i.json().catch(()=>null);if(!i.ok||!r5(o))throw new kn(typeof(o==null?void 0:o.error)=="string"&&o.error?qg(o.error):x("settings.claude.saveFail"));kr({reading:o});const r=hD(o,e);Wd=setTimeout(()=>{Wd=null;const c=new AbortController,d=setTimeout(()=>c.abort(),5e3);c5(c.signal).then(u=>{kr({reading:u,undone:hD(u,e)===r?null:{id:e}})}).catch(()=>{}).finally(()=>clearTimeout(d))},VTe)}catch(i){kr({error:Pi(i,x("settings.claude.saveFail"))})}finally{clearTimeout(a),kr({saving:null})}}const JTe={"Your settings.json is not valid JSON, so Claude Code skips all of it, hooks included. Fix it in an editor; this section reads it again by itself.":"settings.claude.reason.invalid","Your settings.json could not be read here, so nothing is shown or changed until it can.":"settings.claude.reason.unreadable","Your organization's settings could not be read, so nothing here can be changed until they can.":"settings.claude.reason.othersUnknown","Set by your organization. Ask your administrator to change it.":"settings.claude.reason.locked","Your settings.json holds a custom value. Edit it there.":"settings.claude.reason.custom","Choose a setting this section offers and one of its values.":"settings.claude.reason.choose","Your settings.json could not be read as JSON. No changes were saved.":"settings.claude.reason.parse","Your settings.json changed while saving. Nothing was written. Try again.":"settings.claude.reason.changed","Claude Code settings can be changed on this computer only.":"settings.claude.reason.localOnly","Could not read Claude Code settings. Try again.":"settings.claude.reason.readFail","Could not save the change. Your settings.json was not modified.":"settings.claude.reason.notSaved","Your settings.json has a permissions value that is not an object. No changes were saved.":"settings.claude.reason.permissionsShape","Your settings.json has a permissions.deny value that is not a list. No changes were saved.":"settings.claude.reason.denyShape","Your settings.json holds a custom attribution. Edit it there.":"settings.claude.reason.attribution"};function qg(e,t=x){const n=JTe[e];if(n)return t(n);const a=/^Needs Claude Code (\S+) or newer(, and the version installed here could not be read)?\.$/.exec(e);return a?t(a[2]?"settings.claude.reason.needsUnread":"settings.claude.reason.needs",{version:a[1]}):g3(e,t)}function YTe(){const[e,t]=m.useState(zr);return m.useEffect(()=>(Rg.add(t),t(zr),Hd||(Lj(),Hd=setInterval(()=>void Lj(),KTe)),()=>{Rg.delete(t),Rg.size||(Hd&&clearInterval(Hd),Hd=null,_i==null||_i.abort())}),[]),e}const KS=40,ZTe=(e,t)=>{const n=`settings.claudeTopic.${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}`,a=t(n);return a===n?e:a},XTe={boolean:"settings.claudeIndex.kind.boolean",choice:"settings.claudeIndex.kind.choice",number:"settings.claudeIndex.kind.number",text:"settings.claudeIndex.kind.text",structured:"settings.claudeIndex.kind.structured"};function QTe(e,t=x){const n=e.scope==="Global config"?t("settings.claudeIndex.globalConfig"):e.scope==="Managed"?t("settings.claudeIndex.managedOnly"):null;return[e.topic?ZTe(e.topic,t):e.topic,t(XTe[e.kind]),n,e.since?t("settings.claudeIndex.since",{since:e.since}):null].filter(Boolean).join(" · ")}function e0e(e,t){const n=t.trim().toLowerCase();if(!n)return[];const a=e.filter(o=>o.key.toLowerCase().includes(n)),i=e.filter(o=>!a.includes(o)&&(o.topic??"").toLowerCase().includes(n));return[...a,...i]}let l5=null;const t0e=()=>l5??(l5=Hr(()=>import("./claude-settings-index-1Qg1AUda.js"),[]).then(e=>e.default.keys));function n0e({present:e,noFile:t=!1}){const n=se(),a=Aa(),[i,o]=m.useState(null),[r,c]=m.useState(""),d=m.useId();m.useEffect(()=>{let f=!0;return t0e().then(b=>{f&&o(b)},()=>{l5=null}),()=>{f=!1}},[]);const u=m.useMemo(()=>{if(!i)return[];if(r.trim())return e0e(i,r);if(!e)return[];const f=i.filter(k=>Object.hasOwn(e,k.key)),b=Object.keys(e).filter(k=>!i.some(y=>y.key===k)).sort().map(k=>({key:k,topic:x("settings.claudeIndex.notInRef"),scope:null,kind:"structured",default:null,since:null,anchor:""}));return[...f,...b]},[i,e,r,a]),h=u.slice(0,KS),g=r.trim()!=="";return s.jsxs(Kt,{id:"claude-group-all",settingId:"claude-all-settings",title:n("settings.claudeIndex.title"),note:g?void 0:n(e&&!t?"settings.claudeIndex.notePresent":"settings.claudeIndex.noteAll"),aside:i?s.jsx("span",{className:"settings-caption-count",children:i.length}):void 0,list:!1,children:[s.jsxs("div",{className:"settings-filter",children:[s.jsx("label",{className:"vis-hidden",htmlFor:d,children:n("settings.claudeIndex.filterLabel")}),s.jsx("input",{id:d,type:"search",className:"settings-filter-field",placeholder:i?n("settings.claudeIndex.filterCount",{count:i.length}):n("settings.claudeIndex.filter"),autoComplete:"off",spellCheck:!1,value:r,onChange:f=>c(f.target.value),onKeyDown:f=>{Bm(f.key)&&r&&(f.stopPropagation(),c(""))}})]}),h.length>0&&s.jsx("div",{className:"settings-list settings-keys",children:h.map(f=>{const b=e&&Object.hasOwn(e,f.key)?e[f.key]:null;return s.jsx(Ct,{as:"div",name:s.jsx("code",{className:"claude-key",children:f.key}),note:QTe(f,n),control:s.jsxs(s.Fragment,{children:[b!==null&&s.jsx("span",{className:"settings-read",title:n("settings.claudeIndex.inFile"),children:b}),f.anchor&&s.jsx("a",{className:"settings-link",href:`${sre}#${f.anchor}`,target:"_blank",rel:"noreferrer","aria-label":n("settings.claudeIndex.referenceAria",{key:f.key}),children:n("settings.claudeIndex.reference")})]})},f.key)})}),g&&u.length===0&&i&&s.jsx("p",{className:"settings-empty",role:"status",children:n("settings.claudeIndex.noMatch",{query:r.trim()})}),u.length>KS&&s.jsx("p",{className:"settings-foot",role:"status",children:n("settings.claudeIndex.more",{count:u.length-KS})}),!g&&e&&!t&&i&&u.length===0&&s.jsx("p",{className:"settings-empty",children:n("settings.claudeIndex.empty")})]})}function a0e(e,t=x){return t("settings.claude.foot",{file:e??t("settings.claude.footDefault")})}const gD={Off:"settings.claude.effect.off",On:"settings.claude.effect.on","Updates are off":"settings.claude.effect.updatesOff","Background updates are off":"settings.claude.effect.bgUpdatesOff"};function s0e(e,t=x){const n=`${e.env}=${e.value}`,a=gD[e.effect]?t(gD[e.effect]):e.effect;return e.where==="environment"?t("settings.claude.overrideEnv",{effect:a,set:n}):t(e.where==="user"?"settings.claude.overrideUser":"settings.claude.overrideOrg",{effect:a,set:n})}const mD="\0custom";function i0e({entry:e,row:t,saving:n,nameId:a,noteId:i}){const o=se(),r=!!t&&t.editable&&!n,c=!t||n===e.id,d=t?!t.editable:void 0;if(e.kind==="choice"||e.kind==="days"){const h=e.kind==="days"?e.options.map(b=>({value:String(b),label:Nq(b,o)})):e.options.map(b=>({...b,label:ore(e.id,b.value,b.label,o)})),g=t?t.custom?mD:t.value===null?"":String(t.value):"",f=e.kind==="days"&&t&&!t.custom&&!h.some(b=>b.value===g)?[...h,{value:g,label:Nq(Number(g),o)}].sort((b,k)=>Number(b.value)-Number(k.value)):h;return s.jsxs("select",{className:"sm-select","aria-labelledby":a,"aria-describedby":i,"aria-busy":c,disabled:d,value:g,onChange:b=>{if(!r)return;const k=b.target.value;pD(e.id,e.kind==="days"?Number(k):k===""?null:k)},children:[(t==null?void 0:t.custom)&&s.jsx("option",{value:mD,disabled:!0,children:o("settings.claude.customValue")}),f.map(b=>s.jsx("option",{value:b.value??"",children:b.label},b.value??""))]})}const u=(t==null?void 0:t.value)===!0;return s.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":u,"aria-labelledby":a,"aria-describedby":i,"aria-busy":c,disabled:d,onClick:()=>{r&&pD(e.id,!u)},children:s.jsx("span",{className:"switch-knob"})})}function o0e(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 r0e(){return s.jsx(c0e,{state:YTe()})}function c0e({state:e}){const t=se(),{reading:n,saving:a,error:i,undone:o}=e,r=o0e(n),c=(n==null?void 0:n.userFile)==="absent",d=n?n.userFile!=="invalid"&&n.userFile!=="unreadable":!i;return s.jsxs(s.Fragment,{children:[(n===null||i||r||c)&&s.jsxs(Kt,{children:[n===null&&!i&&s.jsx("p",{className:"settings-row settings-row-status",role:"status",children:t("settings.claude.reading")}),r&&s.jsx("p",{className:"settings-row settings-row-status",role:"status",children:qg(r,t)}),c&&!r&&s.jsx("p",{className:"settings-row settings-row-status",role:"status",children:t("settings.claude.noFile")}),i&&s.jsxs("div",{className:"settings-row",role:"alert",children:[s.jsx("span",{className:"settings-row-name",children:qg(i,t)}),s.jsx("span",{className:"settings-row-control",children:s.jsx("button",{type:"button",className:"btn","aria-busy":!!a,onClick:()=>void Lj(),children:t("settings.claude.retry")})})]})]}),d&&yB.map(u=>s.jsx(Kt,{id:`claude-group-${u.id}`,title:CB(u.id,u.title,t),children:xB.filter(h=>h.group===u.id).map(h=>{const g=n==null?void 0:n.settings.find(y=>y.id===h.id),f=`claude-${h.id}-label`,b=`claude-${h.id}-note`,k=g&&!g.editable&&!r?qg(g.reason??"",t):(o==null?void 0:o.id)===h.id?t("settings.claude.undone"):g!=null&&g.override?s0e(g.override,t):"";return s.jsx(Ct,{settingId:`claude-${h.id}`,name:SB(h,t),nameId:f,note:ire(h,t),noteId:b,control:s.jsx(i0e,{entry:h,row:g,saving:a,nameId:f,noteId:b}),children:s.jsx("span",{className:"settings-row-said settings-row-said-quiet",role:"status",children:k})},h.id)})},u.id)),d&&s.jsx("p",{className:"settings-foot",children:a0e(n==null?void 0:n.fileShown,t)}),s.jsx(n0e,{present:(n==null?void 0:n.present)??null,noFile:c})]})}function l0e(){const e=se(),[t,n]=m.useState(null),[a,i]=m.useState(""),[o,r]=m.useState(!1),[c,d]=m.useState(null),[u,h]=m.useState(""),g=m.useRef(!1),f=m.useRef(!0),b=async()=>{if(g.current)return;g.current=!0,r(!0),i("");const N=new AbortController,w=window.setTimeout(()=>N.abort(),12e3);try{const j=await fetch("/api/tool-audit/storage",{signal:N.signal}),S=await j.json();if(!j.ok||!S.ok)throw new Error;f.current&&n(S)}catch{f.current&&i(e("settings.tools.readFail"))}finally{window.clearTimeout(w),g.current=!1,f.current&&r(!1)}};m.useEffect(()=>(f.current=!0,b(),()=>{f.current=!1}),[]);const k=async(N,w)=>{if(g.current)return;g.current=!0,r(!0),i(""),h("");let j=!1;const S=new AbortController,A=window.setTimeout(()=>S.abort(),15e3);try{const T=await fetch("/api/tool-audit/storage",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N==="clear"?{action:N,confirm:!0}:{action:N,days:w}),signal:S.signal}),q=await T.json();if(!T.ok||!q.ok)throw new Error;j=!0,f.current&&(d(null),h(N==="clear"?e("settings.tools.cleared"):e("settings.tools.retentionChanged",{days:w??0})))}catch{f.current&&i(e("settings.tools.updateFail"))}finally{window.clearTimeout(A),g.current=!1,f.current&&(r(!1),j&&b())}},y=c!==null&&s.jsxs("div",{className:"settings-row settings-row-wide ta-confirm",role:"group","aria-label":e("settings.tools.confirm"),children:[s.jsx("p",{children:c==="clear"?e("settings.tools.confirmClear"):e("settings.tools.confirmKeep",{days:c})}),s.jsxs("div",{children:[s.jsx("button",{type:"button",className:"btn danger","aria-busy":o,onClick:()=>{k(c==="clear"?"clear":"retention",typeof c=="number"?c:void 0)},children:e(c==="clear"?"settings.tools.deleteBtn":"settings.tools.applyBtn")}),s.jsx("button",{type:"button",className:"btn","aria-busy":o,onClick:()=>{g.current||d(null)},children:e("settings.tools.cancel")})]})]});return s.jsxs(Kt,{id:"tool-history-settings-title",title:e("settings.tools.title"),note:e("settings.tools.note"),className:"ta-settings",children:[t?s.jsxs(s.Fragment,{children:[s.jsx(Ct,{settingId:"tool-history-retention",name:e("settings.tools.keep"),nameId:"ta-keep-label",note:e("settings.tools.keepNote"),control:s.jsx("select",{className:"sm-select","aria-labelledby":"ta-keep-label",value:t.retentionDays,"aria-busy":o,onChange:N=>{if(g.current)return;const w=Number(N.target.value);w<t.retentionDays?d(w):k("retention",w)},children:[30,60,90].map(N=>s.jsx("option",{value:N,children:e("settings.tools.days",{count:N})},N))})}),typeof c=="number"&&y,s.jsx(Ct,{as:"div",settingId:"tool-history-size",name:e("settings.tools.space"),note:e("settings.tools.since",{date:lce(t.startedAt)}),control:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"settings-read",children:cce(t.bytes)}),s.jsx("button",{type:"button",className:"btn","aria-busy":o,onClick:()=>{b()},children:e("settings.tools.refresh")})]})}),s.jsx(Ct,{as:"div",settingId:"tool-history-clear",name:e("settings.tools.clear"),note:e("settings.tools.clearNote"),control:s.jsx("button",{type:"button",className:"btn danger","aria-busy":o,onClick:()=>{g.current||d("clear")},children:e("settings.tools.clearBtn")})}),c==="clear"&&y,!t.storageOk&&s.jsx(Ct,{as:"div",name:e("settings.tools.unsaved"),note:e("settings.tools.unsavedNote")})]}):s.jsx(Ct,{as:"div",name:e(o?"settings.tools.reading":"settings.tools.unavailable")}),a&&s.jsxs("div",{className:"settings-row",role:"alert",children:[s.jsx("span",{className:"settings-row-name",children:a}),s.jsx("span",{className:"settings-row-control",children:s.jsx("button",{type:"button",className:"btn","aria-busy":o,onClick:()=>{b()},children:e("settings.tools.retry")})})]}),u&&s.jsx("p",{className:"settings-row settings-row-status",role:"status",children:u})]})}const Oj="agent-dag.integrations.active",a0=(e,t)=>`agent-dag.integrations.prefs.${e}:${t}`,d0e=32e3;function fD(e,t){const n=ht(a0(e,t));if(!n)return{};try{const a=JSON.parse(n);return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}catch{return{}}}function k1e(e,t){return{read(n,a){const i=fD(e,t)[n];return a(i)?i:void 0},write(n,a){const i=fD(e,t);a===void 0?delete i[n]:i[n]=a;const o=JSON.stringify(i);o.length<=d0e&&pt(a0(e,t),o)}}}function u0e(e,t){Xa(a0(e,t))}function w1e(e){const t=ht(Oj);if(!t)return null;try{const n=JSON.parse(t),a=n&&typeof n=="object"?n[e]:null;return typeof a=="string"&&a.length<=80?a:null}catch{return null}}function y1e(e,t){let n={};try{const a=ht(Oj),i=a?JSON.parse(a):{};i&&typeof i=="object"&&!Array.isArray(i)&&(n=Object.fromEntries(Object.entries(i).filter(([,o])=>typeof o=="string").slice(0,20)))}catch{}n[e]=t,pt(Oj,JSON.stringify(n))}function Pj(e){var a;const t=(a=e.meta)==null?void 0:a.checkedAt;if(!t)return null;const n=new Date(String(t));return Number.isNaN(n.getTime())?null:n.toLocaleString(Le(),{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",...n.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}})}function Mj(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 h0e({connection:e,provider:t,available:n,busy:a,armed:i,note:o,headingRef:r,onTest:c,onEdit:d,onDisconnect:u,onCancelDisconnect:h}){var T;const g=se(),f=m.useRef(null),b=(t==null?void 0:t.label)??e.kind,k=e.account.name||e.account.login||g("integrations.conn.noAccount"),y=e.account.name&&e.account.login!==e.account.name?e.account.login:"",N=Pj(e),w=Mj(e),j=Array.isArray((T=e.meta)==null?void 0:T.warnings)?e.meta.warnings.filter(q=>typeof q=="string"):[],S=a===`test:${e.id}`,A=a===`delete:${e.id}`;return s.jsxs("section",{className:"ig-connection-details","aria-labelledby":"ig-managed-title",children:[s.jsxs("header",{className:"ig-managed-header",children:[t&&s.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:s.jsx(t.Glyph,{})}),s.jsxs("div",{className:"ig-managed-identity",children:[s.jsx("h2",{ref:r,tabIndex:-1,id:"ig-managed-title",className:"ig-managed-title",children:e.name||e.baseUrl}),s.jsx("p",{children:g("integrations.conn.saved",{label:b})})]})]}),s.jsxs("dl",{className:"ig-detail-facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.host")}),s.jsx("dd",{children:e.baseUrl})]}),s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.account")}),s.jsxs("dd",{children:[k,y?` (${y})`:""]})]}),s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.lastVerified")}),s.jsx("dd",{children:N??g("integrations.conn.noVerificationTime")})]}),s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.credentials")}),s.jsx("dd",{children:e.tokenSaved?g("integrations.conn.storedLocally"):g("integrations.conn.noToken")})]}),w&&s.jsxs("div",{children:[s.jsx("dt",{children:g("integrations.conn.server")}),s.jsx("dd",{children:w})]})]}),!n&&s.jsx("p",{className:"ig-stranded",children:g("integrations.conn.strandedDisconnect",{label:b})}),j.length>0&&s.jsx("ul",{className:"ig-warnings",children:j.map(q=>s.jsx("li",{children:q},q))}),n&&s.jsxs("div",{className:"ig-manage-actions",children:[s.jsx("button",{type:"button",className:"btn","aria-busy":S,"aria-disabled":a!==null||void 0,onClick:c,children:g(S?"integrations.conn.testing":"integrations.conn.test")}),s.jsx("button",{type:"button",className:"btn","aria-disabled":a!==null||void 0,onClick:q=>{a===null&&d(q.currentTarget)},children:g("integrations.conn.edit")})]}),o&&o.scope!=="disconnect"&&s.jsx("p",{className:"ig-note","data-tone":o.tone,role:o.tone==="err"?"alert":"status",children:o.text}),s.jsxs("div",{className:"ig-disconnect-section",children:[s.jsx("h3",{children:g("integrations.conn.removeTitle")}),s.jsx("p",{children:g("integrations.conn.removeBody")}),s.jsxs("div",{className:"ig-manage-actions","data-integration-disconnect-actions":!0,onBlur:q=>{i&&!q.currentTarget.contains(q.relatedTarget)&&h()},children:[s.jsx("button",{ref:f,type:"button","data-integration-disconnect":!0,className:`btn danger${i?" armed":""}`,"aria-busy":A,"aria-disabled":a!==null||void 0,onKeyDown:q=>{q.repeat&&q.preventDefault()},"aria-label":i?g("integrations.conn.confirmAria",{name:e.name}):g("integrations.conn.disconnectAria",{name:e.name}),onClick:q=>u(q.currentTarget),children:g(A?"integrations.conn.disconnecting":i?"integrations.conn.confirmDisconnect":"integrations.conn.disconnect")}),i&&s.jsx("button",{type:"button",className:"btn","data-integration-cancel-disconnect":!0,"aria-disabled":a!==null||void 0,"aria-label":g("integrations.conn.cancelDisconnect"),onClick:()=>{var q;a===null&&(h(),(q=f.current)==null||q.focus())},children:g("integrations.cancel")})]}),i&&s.jsx("p",{className:"ig-note",role:"status",children:g("integrations.conn.pressConfirm")}),(o==null?void 0:o.scope)==="disconnect"&&s.jsx("p",{className:"ig-note","data-tone":o.tone,role:o.tone==="err"?"alert":"status",children:o.text})]})]})}function p0e({onBeforeLeaveChange:e}={}){var tt;const t=se(),n=hh(),{connections:a,error:i}=n,[o,r]=m.useState(null),c=m.useRef(null),d=m.useRef(new Map),u=m.useRef(null),h=m.useRef(0),[g,f]=m.useState(null),[b,k]=m.useState(""),y=m.useRef(null),N=m.useRef(null),[w,j]=m.useState(null),[S,A]=m.useState(null),T=m.useRef(null),[q,_]=m.useState(null),[I,z]=m.useState([]),[F,U]=m.useState(null),P=m.useRef(0),[L,R]=m.useState(null),O=m.useRef(null),D=m.useRef(new Map),$=m.useRef(null),B=m.useRef(0),[G,Z]=m.useState(!1),[W,H]=m.useState(null),X=m.useRef(null),V=m.useRef(new Map),Q=m.useRef(new Map);m.useEffect(()=>{const ie=rNe();ie&&($.current=V.current.get(ie)??null,f(ie),R(ie),j({mode:"edit",id:ie}));const je=oNe();je&&j({mode:"add",kind:je})},[]),m.useEffect(()=>{var ie,je;!L||!a||(je=(ie=Q.current.get(L))==null?void 0:ie.scrollIntoView)==null||je.call(ie,{block:"nearest"})},[L,a]),m.useEffect(()=>{if(!F)return;const ie=()=>{var Ge,Te;(Ge=document.activeElement)!=null&&Ge.hasAttribute("data-integration-cancel-disconnect")&&((Te=document.querySelector(".ig-manage-view [data-integration-disconnect]"))==null||Te.focus()),U(null)},je=()=>{document.hidden&&ie()},Fe=window.setTimeout(()=>{var Ge;(Ge=document.querySelector("[data-integration-disconnect-actions]"))!=null&&Ge.contains(document.activeElement)||ie()},4e3);return window.addEventListener("blur",ie),document.addEventListener("visibilitychange",je),()=>{window.clearTimeout(Fe),window.removeEventListener("blur",ie),document.removeEventListener("visibilitychange",je)}},[F]);const Y=(ie,je,Fe,Ge)=>z(Te=>[...Te.filter(nt=>nt.id!==ie),{id:ie,tone:je,text:Fe,scope:Ge}]),K=ie=>z(je=>je.filter(Fe=>Fe.id!==ie)),ee=async(ie,je)=>{if(!T.current){T.current=ie,A(ie);try{await je()}finally{T.current=null,A(null)}}},te=ie=>(je,Fe)=>void ee("form",async()=>{_(null);try{const Ge=await tNe(ie,je,Fe||void 0);j(null),H(null),Z(!1),f(null),r(null),k(t("integrations.settings.added")),Y(Ge.id,"ok",t("integrations.settings.savedTested",{name:Ge.account.name||Ge.account.login})),R(Ge.id),O.current=()=>{var nt;const Te=d.current.get(Ge.kind)??V.current.get(Ge.id);return(nt=Te==null?void 0:Te.scrollIntoView)==null||nt.call(Te,{block:"nearest"}),Te}}catch(Ge){_(Ge instanceof Za?Ge:new Za("upstream",t("integrations.settings.saveFailed")))}}),ce=ie=>(je,Fe)=>void ee("form",async()=>{_(null);try{const{connection:Ge,validated:Te}=await nNe(ie.id,{name:Fe,input:je});j(null),H(null),Z(!1),O.current=()=>N.current??(g?y.current:V.current.get(Ge.id)),Y(Ge.id,"ok",Te?t("integrations.settings.savedPassed",{name:Ge.account.name||Ge.account.login}):t("integrations.settings.saved"))}catch(Ge){_(Ge instanceof Za?Ge:new Za("upstream",t("integrations.settings.changeFailed")))}}),ge=ie=>void ee(`test:${ie.id}`,async()=>{U(null),K(ie.id);try{const je=await aNe(ie.id);Y(ie.id,"ok",t("integrations.settings.testPassed",{name:je.account.name||je.account.login}))}catch(je){Y(ie.id,"err",Pi(je,t("integrations.settings.testFailed")))}}),ve=(ie,je)=>{if(T.current)return;const Fe=Date.now(),Ge=Fr({armedFor:F,target:ie.id,armedAt:P.current,now:Fe,gapMs:Dr});if(Ge==="arm"){je.focus({preventScroll:!0}),U(ie.id),P.current=Fe;return}Ge!=="ignore"&&(U(null),ee(`delete:${ie.id}`,async()=>{try{await sNe(ie.id),u0e(ie.kind,ie.id),K(ie.id),(w==null?void 0:w.mode)==="edit"&&w.id===ie.id&&j(null),f(null);const Te=(a??[]).filter(fe=>fe.kind===ie.kind&&fe.id!==ie.id);(!o||Te.length===0)&&r(null),k(t("integrations.settings.disconnected"));const nt=document.activeElement;(nt===je||ta((nt==null?void 0:nt.tagName)??null))&&(O.current=()=>{var Ve;const fe=(o&&Te[0]?V.current.get(Te[0].id):d.current.get(ie.kind))??D.current.get(ie.kind)??document.getElementById("settings-tab-integrations");return(Ve=fe==null?void 0:fe.scrollIntoView)==null||Ve.call(fe,{block:"nearest"}),fe})}catch(Te){Y(ie.id,"err",Pi(Te,t("integrations.settings.removeFailed")),"disconnect")}}))};m.useEffect(()=>{if(S!==null||W||!O.current)return;const ie=O.current();O.current=null,ie!=null&&ie.isConnected&&(ie.checkVisibility?ie.checkVisibility():ie.getClientRects().length>0)&&ie.focus({preventScroll:!0})},[a,g,o,w,S,W]);const pe=a??[],ae=ph(n),le=["github","gitlab","jira"],Se=QT().filter(ie=>ae.has(ie.kind)||pe.some(je=>je.kind===ie.kind)).sort((ie,je)=>le.indexOf(ie.kind)-le.indexOf(je.kind)),ke=t0(n),ye=m.useCallback(()=>{j(null),f(null),r(null),Z(!1),H(null),_(null),U(null),O.current=()=>{const ie=$.current,je=ie==null?void 0:ie.closest(".settings-pane");return je&&(je.scrollTop=B.current),ie!=null&&ie.isConnected?ie:document.getElementById("settings-tab-integrations")}},[]),We=m.useCallback(()=>{if(!o){ye();return}f(null),j(null),Z(!1),H(null),_(null),U(null),O.current=()=>{var Fe;const ie=(Fe=u.current)!=null&&Fe.isConnected?u.current:c.current,je=ie==null?void 0:ie.closest(".settings-pane");return je&&(je.scrollTop=ie===c.current?0:h.current),ie}},[o,ye]),He=m.useCallback(()=>{if(!g&&!o){ye();return}j(null),Z(!1),H(null),_(null),O.current=()=>N.current??(g?y.current:c.current)},[g,o,ye]),Ke=m.useCallback((ie,je=!1)=>{if(T.current)return;if(W&&je){H(null),requestAnimationFrame(()=>{var Ge;return(Ge=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:Ge.focus()});return}const Fe=je?w?He:g?We:ye:()=>{j(null),f(null),r(null),ie()};G?H(()=>Fe):(Z(!1),Fe())},[G,W,w,g,He,We,ye]);m.useEffect(()=>(e==null||e(w||g||o?Ke:null),()=>e==null?void 0:e(null)),[w,g,o,Ke,e]),m.useEffect(()=>{var ie;W&&((ie=X.current)==null||ie.focus())},[W]),m.useEffect(()=>{var ie;g&&((ie=y.current)==null||ie.focus())},[g]),m.useEffect(()=>{var ie;o&&((ie=c.current)==null||ie.focus())},[o]);const Re=(ie,je)=>{var Ge;if(T.current)return;O.current=null,H(null),k(""),U(null),g||o?N.current=je:(B.current=((Ge=je.closest(".settings-pane"))==null?void 0:Ge.scrollTop)??0,$.current=je,N.current=null),Z(!1),_(null),j(ie);const Fe=je.closest(".settings-pane");Fe&&(Fe.scrollTop=0)},Je=(ie,je)=>{var Ge,Te;if(T.current)return;O.current=null,o?(u.current=je,h.current=((Ge=je.closest(".settings-pane"))==null?void 0:Ge.scrollTop)??0):(B.current=((Te=je.closest(".settings-pane"))==null?void 0:Te.scrollTop)??0,$.current=je),N.current=null,k(""),U(null),f(ie.id);const Fe=je.closest(".settings-pane");Fe&&(Fe.scrollTop=0)},Pe=(ie,je)=>{var Te;const Fe=pe.filter(nt=>nt.kind===ie);if(Fe.length===1){Je(Fe[0],je);return}if(T.current)return;O.current=null,B.current=((Te=je.closest(".settings-pane"))==null?void 0:Te.scrollTop)??0,$.current=je,u.current=null,h.current=0,k(""),U(null),r(ie);const Ge=je.closest(".settings-pane");Ge&&(Ge.scrollTop=0)},Ae=(ie,je=!1)=>{const Fe=au(ie.kind),Ge=!Ai(n,ie.kind),Te=Pj(ie),nt=ie.account.login||ie.account.name,fe=ie.kind==="jira"?Mj(ie):null;return s.jsx("div",{className:"ig-conn",ref:Ve=>{Ve?Q.current.set(ie.id,Ve):Q.current.delete(ie.id)},children:s.jsxs("div",{className:"ig-summary-row",children:[s.jsxs("div",{className:"ig-summary-text",children:[s.jsx("span",{className:"ig-conn-name",children:je&&ie.name||pr(ie)}),s.jsx("span",{className:"ig-conn-line",children:[je&&ie.name!==pr(ie)?pr(ie):"",nt,fe||(Te?t("integrations.conn.lastVerifiedAt",{when:Te}):t("integrations.conn.notVerified"))].filter(Boolean).join(" · ")||t("integrations.conn.noAccount")}),!ie.tokenSaved&&s.jsx("span",{className:"ig-bad",children:t("integrations.conn.noToken")}),Ge&&s.jsx("span",{className:"ig-stranded",children:t("integrations.conn.strandedManage",{label:(Fe==null?void 0:Fe.label)??ie.kind})})]}),s.jsxs("button",{type:"button",className:"btn ig-manage",ref:Ve=>{Ve?V.current.set(ie.id,Ve):V.current.delete(ie.id)},"aria-label":t("integrations.settings.manageAria",{label:(Fe==null?void 0:Fe.label)??ie.kind,name:ie.name,account:nt||pr(ie)}),onClick:Ve=>Je(ie,Ve.currentTarget),children:[t("integrations.manage")," ",s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m6 4 4 4-4 4"})})]})]})},ie.id)},xe=pe.filter(ie=>!Se.some(je=>je.kind===ie.kind)),ze=o?au(o):null,Ce=pe.filter(ie=>ie.kind===o),Me=pe.find(ie=>ie.id===g),Ee=(w==null?void 0:w.mode)==="edit"?pe.find(ie=>ie.id===w.id):void 0,Be=(w==null?void 0:w.mode)==="add"?Se.find(ie=>ae.has(ie.kind)&&ie.kind===w.kind):Ee&&Se.find(ie=>ae.has(ie.kind)&&ie.kind===Ee.kind);return s.jsxs("div",{className:"ig-settings","data-view":w?"form":g?"connection":o?"provider":"overview",children:[w&&s.jsxs("div",{className:"ig-config-view",children:[s.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":S!==null||void 0,onClick:()=>Ke(He,!0),children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),g?t("integrations.settings.backToConn"):o?t("integrations.settings.backToList",{label:(ze==null?void 0:ze.label)??o}):t("integrations.settings.all")]}),W&&s.jsxs("div",{className:"ig-leave-confirm",role:"group","aria-labelledby":"ig-leave-title",children:[s.jsx("strong",{id:"ig-leave-title",children:t("integrations.settings.discardTitle")}),s.jsx("p",{children:t("integrations.settings.discardBody")}),s.jsxs("div",{className:"ig-form-actions",children:[s.jsx("button",{ref:X,type:"button",className:"btn",onClick:()=>{H(null),requestAnimationFrame(()=>{var ie;return(ie=document.querySelector(".ig-config-view input:not([disabled])"))==null?void 0:ie.focus()})},children:t("integrations.settings.keepEditing")}),s.jsx("button",{type:"button",className:"btn danger",onClick:()=>{const ie=W;H(null),Z(!1),j(null),ie()},children:t("integrations.settings.discard")})]})]}),s.jsx("div",{hidden:!!W,children:Be?s.jsx(TSe,{def:Be,existing:Ee,busy:S==="form",error:q,onDirtyChange:Z,onSubmit:w.mode==="add"?te(w.kind):ce(Ee),onCancel:()=>Ke(He,!0)},w.mode==="add"?w.kind:w.id):s.jsxs("div",{role:"status",children:[s.jsx("p",{children:t("integrations.settings.gone")}),s.jsx("button",{type:"button",className:"btn",onClick:He,children:t("integrations.settings.backToIntegrations")})]})})]}),o&&s.jsxs("div",{className:"ig-provider-view",hidden:w!==null||g!==null,children:[s.jsxs("div",{className:"ig-manage-navigation",children:[s.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":S!==null||void 0,onClick:()=>Ke(ye,!0),children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),t("integrations.settings.all")]}),Ai(n,o)&&s.jsx("button",{type:"button",className:"btn","aria-disabled":S!==null||void 0,onClick:ie=>Re({mode:"add",kind:o},ie.currentTarget),children:t("integrations.settings.addConn",{label:(ze==null?void 0:ze.label)??o})})]}),s.jsx("h2",{ref:c,tabIndex:-1,className:"ig-managed-title",children:t("integrations.settings.connsTitle",{label:(ze==null?void 0:ze.label)??o})}),b&&s.jsx("p",{className:"ig-note",role:"status",children:b}),Ce.length?s.jsx("div",{className:"ig-provider-connections",children:Ce.map(ie=>Ae(ie,!0))}):s.jsx("p",{role:"status",children:t("integrations.settings.noSaved")})]}),g&&s.jsxs("div",{className:"ig-manage-view",hidden:w!==null,children:[s.jsxs("div",{className:"ig-manage-navigation",children:[s.jsxs("button",{type:"button",className:"btn ig-back-to-overview","aria-disabled":S!==null||void 0,onClick:()=>Ke(We,!0),children:[s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m7 3-5 5 5 5M2 8h12"})}),o?t("integrations.settings.backToList",{label:(ze==null?void 0:ze.label)??o}):t("integrations.settings.all")]}),Me&&Ai(n,Me.kind)&&s.jsx("button",{type:"button",className:"btn","aria-disabled":S!==null||void 0,onClick:ie=>Re({mode:"add",kind:Me.kind},ie.currentTarget),children:t("integrations.settings.addConn",{label:((tt=au(Me.kind))==null?void 0:tt.label)??Me.kind})})]}),Me?s.jsx(h0e,{connection:Me,provider:au(Me.kind),available:Ai(n,Me.kind),busy:S,armed:F===g,note:I.find(ie=>ie.id===g),headingRef:y,onTest:()=>ge(Me),onEdit:ie=>Re({mode:"edit",id:Me.id},ie),onDisconnect:ie=>ve(Me,ie),onCancelDisconnect:()=>U(null)}):s.jsx("p",{role:"status",children:t("integrations.settings.noLongerSaved")})]}),s.jsxs("div",{className:"ig-overview",hidden:w!==null||g!==null||o!==null,children:[i&&s.jsxs("div",{className:"ig-list-error",role:"alert",children:[s.jsx("p",{children:i}),s.jsx("button",{type:"button",className:"btn",onClick:()=>void Bf(),children:t("integrations.retry")})]}),a===null&&!i&&s.jsx("p",{role:"status",children:t("integrations.settings.reading")}),b&&s.jsx("p",{className:"ig-note",role:"status",children:b}),s.jsxs("div",{className:"ig-connection-list","data-setting":"integrations-connections",children:[a!==null&&s.jsx("div",{className:"ig-providers","data-setting":"integrations-add",id:ke==="all"?"integrations-add-title":void 0,children:Se.map(ie=>{const je=pe.filter(fe=>fe.kind===ie.kind),Fe=je.length===1?je[0]:null,Ge=[...new Set(je.map(pr))],Te=Fe&&Pj(Fe),nt=(Fe==null?void 0:Fe.kind)==="jira"?Mj(Fe):null;return s.jsxs("section",{className:"ig-provider",id:`ig-provider-${ie.kind}`,"aria-labelledby":`ig-provider-name-${ie.kind}`,"data-setting":`integration-${ie.kind}`,children:[s.jsx("span",{className:"ig-provider-glyph","aria-hidden":!0,children:s.jsx(ie.Glyph,{})}),s.jsxs("div",{className:"ig-summary-text ig-provider-content",children:[s.jsx("h3",{id:`ig-provider-name-${ie.kind}`,children:ie.label}),je.length===0?s.jsx("span",{className:"ig-conn-line",children:t("integrations.settings.notConnected")}):Fe?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ig-conn-name",children:pr(Fe)}),s.jsx("span",{className:"ig-conn-line",children:[Fe.account.login||Fe.account.name,nt||(Te?t("integrations.conn.lastVerifiedAt",{when:Te}):t("integrations.conn.notVerified"))].filter(Boolean).join(" · ")}),!Fe.tokenSaved&&s.jsx("span",{className:"ig-bad",children:t("integrations.conn.noToken")})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"ig-conn-name",children:t("integrations.settings.count",{count:je.length})}),s.jsxs("span",{className:"ig-conn-line",children:[Ge.slice(0,2).join(" · "),Ge.length>2?` · ${t("integrations.settings.moreInstances",{n:Ge.length-2})}`:""]})]}),!ae.has(ie.kind)&&s.jsx("span",{className:"ig-stranded",children:t("integrations.conn.unavailable",{label:ie.label})})]}),s.jsx("button",{type:"button",className:`btn ig-manage${je.length?"":" primary"}`,"aria-disabled":S!==null||void 0,ref:fe=>{const Ve=je.length?d.current:D.current;fe?Ve.set(ie.kind,fe):Ve.delete(ie.kind)},"aria-label":je.length?t("integrations.manageProvider",{label:ie.label}):t("integrations.form.connect",{provider:ie.label}),onClick:fe=>je.length?Pe(ie.kind,fe.currentTarget):Re({mode:"add",kind:ie.kind},fe.currentTarget),children:je.length?s.jsxs(s.Fragment,{children:[t("integrations.manage")," ",s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:s.jsx("path",{d:"m6 4 4 4-4 4"})})]}):t("integrations.form.connectBtn")})]},ie.kind)})}),(xe.length>0||Se.length===0&&ke!=="all"&&a!==null)&&s.jsxs(Kt,{id:"integrations-list-title",title:t("integrations.settings.connections"),aside:s.jsx("span",{className:"settings-caption-count",children:xe.length}),children:[xe.map(ie=>Ae(ie,!0)),pe.length===0&&s.jsx("p",{className:"settings-row settings-row-status",children:t("integrations.settings.nothing")})]})]}),ke==="all"&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"ig-overview-info",children:s.jsxs("details",{className:"ig-access",children:[s.jsx("summary",{children:t("integrations.settings.accessSummary")}),s.jsx("p",{children:t("integrations.settings.accessBody")})]})})})]})]})}function g0e({theme:e}){return s.jsx("span",{className:"appearance-preview","data-swatch":e,children:s.jsxs("svg",{viewBox:"0 0 112 56","aria-hidden":!0,focusable:"false",children:[s.jsx("rect",{className:"tp-canvas",width:"112",height:"56"}),s.jsx("rect",{className:"tp-surface",width:"112",height:"7"}),s.jsx("rect",{className:"tp-rule",y:"7",width:"112",height:"1"}),s.jsx("rect",{className:"tp-surface",y:"8",width:"25",height:"48"}),s.jsx("rect",{className:"tp-rule",x:"25",y:"8",width:"1",height:"48"}),s.jsx("rect",{className:"tp-card",x:"36.5",y:"27.5",width:"28",height:"14",rx:"2.5"}),s.jsx("rect",{className:"tp-tag",x:"39.5",y:"25.5",width:"13",height:"4",rx:"2"}),s.jsx("rect",{className:"tp-card",x:"76.5",y:"14.5",width:"29",height:"20",rx:"2.5"}),s.jsx("rect",{className:"tp-rule",x:"81",y:"23",width:"20",height:"2",rx:"1"}),s.jsx("rect",{className:"tp-accent",x:"81",y:"23",width:"12",height:"2",rx:"1"})]})})}function m0e({theme:e,onTheme:t,singleKeys:n}){const a=se(),i=c=>{var g,f;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(c.key))return;c.preventDefault();const d=(g=c.target.closest("[data-theme-choice]"))==null?void 0:g.dataset.themeChoice,h=(Ks.indexOf(d??e)+(c.key==="ArrowLeft"||c.key==="ArrowUp"?-1:1)+Ks.length)%Ks.length;t(Ks[h]),(f=c.currentTarget.querySelectorAll('[role="radio"]')[h])==null||f.focus()},o=m.useRef(null),r=m.useRef(e);return m.useEffect(()=>{var u,h;const c=r.current;r.current=e;const d=document.activeElement;c===e||!d||!((u=o.current)!=null&&u.contains(d))||d.dataset.themeChoice!==c||(h=o.current.querySelector(`[data-theme-choice="${e}"]`))==null||h.focus()},[e]),s.jsx(Kt,{id:"appearance-theme-caption",title:a("settings.theme.title"),list:!1,settingId:"theme",aside:n&&s.jsx("kbd",{className:"settings-key","aria-hidden":!0,title:a("settings.theme.keyTip"),children:"T"}),children:s.jsx("div",{ref:o,className:"appearance-themes",role:"radiogroup","aria-labelledby":"appearance-theme-caption","aria-keyshortcuts":n?"T":void 0,onKeyDown:i,children:Ks.map(c=>s.jsxs("button",{type:"button",className:"appearance-theme",role:"radio","data-theme-choice":c,"data-setting":`theme-${c}`,"aria-checked":e===c,tabIndex:e===c?0:-1,onClick:()=>t(c),children:[s.jsx(g0e,{theme:c}),s.jsxs("span",{className:"appearance-theme-name",children:[OB(c,a),s.jsx("svg",{className:"appearance-check",viewBox:"0 0 12 12","aria-hidden":!0,focusable:"false",children:s.jsx("path",{d:"M2.5 6.4 4.9 8.7 9.5 3.6"})})]})]},c))})})}const f0e=[["smallest","settings.reading.size.smallest","11 px"],["smaller","settings.reading.size.smaller","12 px"],["default","settings.reading.size.default","13 px"],["larger","settings.reading.size.larger","15 px"],["largest","settings.reading.size.largest","17 px"]],b0e=[["tightest","settings.reading.density.tightest","30%"],["tighter","settings.reading.density.tighter","50%"],["compact","settings.reading.density.compact","70%"],["default","settings.reading.density.default","100%"],["comfortable","settings.reading.density.comfortable","140%"]];function bD(){return s.jsx("svg",{className:"reading-selected-mark",viewBox:"0 0 12 12",width:"12",height:"12","aria-hidden":"true",children:s.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 v0e({textSize:e,density:t,onTextSize:n,onDensity:a}){const i=se(),o=e!=="default"||t!=="default";return s.jsx("button",{type:"button",className:"btn",disabled:!o,onClick:()=>{n("default"),a("default")},children:i("settings.reading.reset")})}function k0e({textSize:e,density:t,onTextSize:n,onDensity:a}){const i=se();return s.jsxs(s.Fragment,{children:[s.jsxs("fieldset",{className:"reading-group",children:[s.jsx("legend",{children:i("settings.reading.sizeTitle")}),s.jsx("p",{id:"reading-size-help",children:i("settings.reading.sizeHelp")}),s.jsx("div",{className:"reading-options reading-segmented","aria-describedby":"reading-size-help","data-setting":"text-size",style:{"--reading-count":zq.length,"--reading-selected":zq.indexOf(e)},children:f0e.map(([o,r,c])=>{const d=i(r);return s.jsxs("label",{className:"reading-choice","data-size":o,children:[s.jsx("input",{type:"radio",name:"text-size","aria-label":`${d} ${c}`,value:o,checked:e===o,onChange:()=>n(o)}),s.jsx("span",{className:"reading-type-sample","aria-hidden":"true",children:"Aa"}),s.jsxs("span",{className:"reading-label",children:[s.jsx("strong",{children:d}),s.jsx("small",{children:c})]}),s.jsx(bD,{})]},o)})})]}),s.jsxs("fieldset",{className:"reading-group",children:[s.jsx("legend",{children:i("settings.reading.densityTitle")}),s.jsx("p",{id:"reading-density-help",children:i("settings.reading.densityHelp")}),s.jsx("div",{className:"reading-options reading-segmented","aria-describedby":"reading-density-help","data-setting":"density",style:{"--reading-count":Lq.length,"--reading-selected":Lq.indexOf(t)},children:b0e.map(([o,r,c])=>{const d=i(r);return s.jsxs("label",{className:"reading-choice",children:[s.jsx("input",{type:"radio",name:"density","aria-label":i("settings.reading.spacing",{label:d,note:c}),value:o,checked:t===o,onChange:()=>a(o)}),s.jsxs("span",{className:"reading-density-sample","data-density":o,"aria-hidden":"true",children:[s.jsx("i",{}),s.jsx("i",{}),s.jsx("i",{})]}),s.jsxs("span",{className:"reading-label",children:[s.jsx("strong",{children:d}),s.jsx("small",{children:c})]}),s.jsx(bD,{})]},o)})})]}),s.jsxs(Kt,{id:"reading-preview-title",title:i("settings.reading.preview"),children:[s.jsxs("div",{className:"reading-preview-row",children:[s.jsxs("div",{children:[s.jsx("strong",{children:i("settings.reading.sample1")}),s.jsx("span",{children:i("settings.reading.sample1State")})]}),s.jsx("span",{className:"reading-preview-time",children:"4m"})]}),s.jsxs("div",{className:"reading-preview-row",children:[s.jsxs("div",{children:[s.jsx("strong",{children:i("settings.reading.sample2")}),s.jsx("span",{children:i("settings.reading.sample2State")})]}),s.jsx("span",{className:"reading-preview-time",children:"12m"})]})]}),s.jsx("p",{className:"settings-foot",children:i("settings.reading.foot")})]})}function w0e({cli:e,running:t}){const n=se(),a=n("shell.terminal.versions",{product:qt,cli:e.version,running:t}),i=s.jsx("code",{children:e.command});return e.auto==="pending"||e.auto==="running"?s.jsx(Ct,{as:"div",name:n("shell.terminal.name"),note:a,control:s.jsx("span",{className:"settings-read",children:e.auto==="running"?n("shell.terminal.updating"):n("shell.terminal.updatingSoon")}),children:s.jsx("span",{className:"settings-row-said",children:e.auto==="running"?n("shell.terminal.updatingNow"):Ej(n("shell.terminal.soon"),"cmd",i)})}):s.jsx(Ct,{as:"div",name:n("shell.terminal.name"),note:e.auto==="failed"?a:n("shell.terminal.notUpdated",{versions:a}),control:s.jsx("span",{className:"settings-read",children:n("shell.terminal.needed")}),children:s.jsxs("span",{className:"settings-row-said",children:[e.auto==="failed"&&s.jsxs(s.Fragment,{children:[e.error?n("shell.terminal.failedWith",{error:e.error}):n("shell.terminal.failed")," "]}),Ej(n("shell.terminal.run"),"cmd",i)]})})}const y0e="AGPL-3.0-only",x0e="https://github.com/BarganConstantin/ccdeck",C0e="https://github.com/sponsors/BarganConstantin";function S0e(e,t=x){return t("settings.about.pageBehind",{bundle:e})}function N0e(e,t){return ti(e)&&ti(t)&&_o(e,t)<0}function j0e(e,t,n=x){return e?{kind:"ready",to:e.version,name:n("settings.about.updateReady"),note:n("settings.about.updateReadyNote",{product:qt,version:e.version})}:t?t.kind==="restart"?{kind:"notice",name:n("settings.about.updateInstalled"),note:n("settings.about.updateInstalledNote",{to:t.to,from:t.from})}:{kind:"notice",name:n("settings.about.updateAvailable"),note:n("settings.about.updateAvailableNote",{product:qt,to:t.to,from:t.from})}:null}function A0e({version:e,notice:t,readyAppUpdate:n,updateRestarting:a,updateFailure:i,onUpdateRestart:o,doors:r,bundle:c="3.81.2"}){const d=se(),u=(e==null?void 0:e.running)??c,h=j0e(n,t,d);return s.jsxs(s.Fragment,{children:[s.jsxs(Kt,{id:"settings-about-caption",title:qt,children:[s.jsx(Ct,{as:"div",settingId:"version",name:d("settings.about.version"),note:N0e(c,e==null?void 0:e.running)?S0e(c,d):void 0,control:s.jsx("span",{className:"settings-read",children:u})}),(e==null?void 0:e.terminalCli)&&s.jsx(w0e,{cli:e.terminalCli,running:u}),h&&s.jsx(T0e,{offer:h,restarting:a,failure:i,onRestart:o,onUpdate:r.update}),s.jsx(Ct,{as:"div",settingId:"whats-new",name:d("settings.about.whatsNew"),note:d("settings.about.whatsNewNote"),control:s.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":d("settings.about.openWhatsNew"),onClick:r.whatsNew,children:d("settings.about.open")})}),s.jsx(Ct,{as:"div",settingId:"licence",name:d("settings.about.licence"),note:d("settings.about.licenceNote"),control:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"settings-read",children:y0e}),s.jsxs("a",{className:"settings-link",href:x0e,target:"_blank",rel:"noreferrer",children:[d("settings.about.source"),s.jsx("span",{className:"vis-hidden",children:d("settings.about.sourceHidden")})]})]})}),s.jsx(Ct,{as:"div",settingId:"sponsor",name:d("settings.about.sponsor"),note:d("settings.about.sponsorNote"),control:s.jsxs("a",{className:"settings-link",href:C0e,target:"_blank",rel:"noreferrer",children:[d("settings.about.sponsorLink"),s.jsx("span",{className:"vis-hidden",children:d("settings.about.sponsorHidden")})]})})]}),s.jsxs(Kt,{id:"settings-about-help-caption",title:d("settings.about.helpGroup"),children:[s.jsx(Ct,{as:"div",settingId:"tour",name:d("settings.about.tour"),note:d("settings.key.tourText"),control:s.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":d("settings.about.startTour"),onClick:r.tour,children:d("settings.about.start")})}),s.jsx(Ct,{as:"div",settingId:"feedback",name:d("settings.about.feedback"),note:d("settings.about.feedbackNote"),control:s.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog","aria-label":d("settings.about.openFeedback"),onClick:r.feedback,children:d("settings.about.open")})})]})]})}function T0e({offer:e,restarting:t,failure:n,onRestart:a,onUpdate:i}){const o=se();if(e.kind==="notice")return s.jsx(Ct,{as:"div",name:e.name,note:e.note,control:s.jsx("button",{type:"button",className:"btn","aria-haspopup":"dialog",onClick:i,children:o("settings.about.updateBtn")})});const r=FW(e.to,t),c=n&&n.version===e.to?UW(n.failure,n.version):"";return s.jsx(Ct,{as:"div",name:e.name,note:e.note,control:s.jsx("button",{type:"button",className:"btn",onClick:()=>a(e.to),"aria-busy":t||void 0,"aria-label":r.label,title:r.title,children:r.text}),children:s.jsx("span",{className:"settings-row-said",role:"status",children:c})})}function R0e(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 E0e={plain:"settings.updates.plainDetails","checks-off":"settings.updates.checksOffDetails","no-restart":"settings.updates.noRestartDetails"};function q0e({autoRestart:e,onToggleAutoRestart:t,version:n,inApp:a=zo()}){const i=se(),o=R0e(n,a);return s.jsx(Kt,{id:"settings-updates-caption",title:i("settings.updates.title"),children:o==="app"?s.jsx(Ct,{as:"div",settingId:"auto-update",name:i("settings.updates.title"),note:i("settings.updates.appNote")}):s.jsx(Ct,{settingId:"auto-update",name:i("settings.updates.label"),nameId:"settings-auto-update-label",note:i(o==="no-restart"?"settings.updates.noRestartNote":o==="checks-off"?"settings.updates.checksOffNote":"settings.updates.plainNote"),details:i(E0e[o]),noteId:"settings-auto-update-note",control:s.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:s.jsx("span",{className:"switch-knob"})})})})}function _0e({character:e,onCharacter:t}){const n=se(),a=m.useRef([]);function i(o,r){var d;const c=yf(o,r,yg.length,"vertical");c.kind==="select"&&(o.preventDefault(),t(yg[c.index].id),(d=a.current[c.index])==null||d.focus())}return s.jsx("div",{className:"character-picker",role:"radiogroup","aria-label":n("settings.character.choose"),"data-setting":"character-choice",children:yg.map((o,r)=>s.jsxs("button",{type:"button",className:"character-choice",role:"radio","aria-checked":e===o.id,tabIndex:e===o.id?0:-1,ref:c=>{a.current[r]=c},onClick:()=>t(o.id),onKeyDown:c=>i(c,r),children:[s.jsx("span",{className:"character-preview",children:s.jsx(JU,{character:o.id,act:null,facing:"right"})}),s.jsx("span",{children:o.name}),s.jsx("svg",{className:"character-check",viewBox:"0 0 16 16","aria-hidden":!0,focusable:"false",children:s.jsx("path",{d:"m3 8 3 3 7-7",fill:"none",stroke:"currentColor",strokeWidth:"1.5"})})]},o.id))})}function z0e({characterEnabled:e,onToggleCharacter:t,character:n="deck",onCharacter:a}){const i=se();return s.jsxs(Kt,{id:"appearance-character-caption",title:i("settings.character.title"),list:!1,children:[s.jsx("div",{className:"settings-list",children:s.jsx(Ct,{settingId:"character",name:i("settings.character.show"),nameId:"appearance-character-label",note:i("settings.character.note"),noteId:"appearance-character-note",control:s.jsx("button",{type:"button",className:"switch",role:"switch","aria-checked":e,"aria-labelledby":"appearance-character-label","aria-describedby":"appearance-character-note",onClick:t,children:s.jsx("span",{className:"switch-knob"})})})}),s.jsx(_0e,{character:n,onCharacter:a})]})}const vD="settings-search-field",d5="settings-search-results",Ij=e=>`settings-result-${e}`;function L0e({inputRef:e,query:t,onQuery:n,results:a,active:i,onActive:o,onOpen:r}){const c=se(),d=t.trim()!=="",u=d&&a.length>0,h=g=>{if(g.nativeEvent.isComposing)return;const f=tce(g.key,t,d?a.length:0,i);f.kind!=="pass"&&(g.preventDefault(),f.kind==="move"?o(f.index):f.kind==="open"?r(a[f.index]):(g.stopPropagation(),n("")))};return s.jsxs("div",{className:"settings-search",children:[s.jsx("label",{className:"vis-hidden",htmlFor:vD,children:c("settings.search.label")}),s.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:[s.jsx("circle",{cx:"6",cy:"6",r:"4.2"}),s.jsx("path",{d:"m9.2 9.2 3.3 3.3"})]}),s.jsx("input",{ref:e,id:vD,type:"search",className:"settings-filter-field settings-search-field",placeholder:c("settings.search.label"),autoComplete:"off",spellCheck:!1,role:"combobox","aria-autocomplete":"list","aria-expanded":u,"aria-controls":u?d5:void 0,"aria-activedescendant":u?Ij(Math.min(i,a.length-1)):void 0,"aria-keyshortcuts":"Control+F Meta+F",value:t,onChange:g=>n(g.target.value),onKeyDown:h})]})}function O0e({query:e,results:t,active:n,onOpen:a}){const i=se(),o=DB(t.length,e);return m.useEffect(()=>{var r,c;(c=(r=document.getElementById(Ij(n)))==null?void 0:r.scrollIntoView)==null||c.call(r,{block:"nearest"})},[n]),s.jsxs("div",{className:"settings-pane",role:"region","aria-labelledby":"settings-search-title",children:[s.jsx("div",{className:"settings-pane-head",children:s.jsxs("div",{className:"settings-pane-heading",children:[s.jsx("h2",{className:"settings-pane-title",id:"settings-search-title",children:i("settings.search.title")}),s.jsx("p",{className:"settings-pane-note","aria-hidden":!0,children:o})]})}),t.length>0&&s.jsx("div",{className:"settings-group",children:s.jsx("div",{className:"settings-list",id:d5,role:"listbox","aria-label":i("settings.search.results"),children:t.map((r,c)=>s.jsxs("button",{type:"button",role:"option",id:Ij(c),className:"settings-result",tabIndex:-1,"aria-selected":c===n,"aria-label":Zre(r),"data-highlighted":c===n,onMouseDown:d=>d.preventDefault(),onClick:()=>a(r),children:[s.jsx(sf,{section:r.section}),s.jsxs("span",{className:"settings-result-text",children:[s.jsx("span",{className:"settings-result-name",children:r.label}),s.jsx("span",{className:"settings-result-place",children:KA(r)})]})]},r.id))})})]})}function P0e({query:e,count:t}){return s.jsx("p",{className:"vis-hidden",role:"status",children:e.trim()?DB(t,e):""})}const M0e=1500,I0e=3e3,D0e=e=>e.checkVisibility?e.checkVisibility():e.getClientRects().length>0;function F0e(e){if(e.matches(Wg)&&!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(Wg)).filter(a=>oU({disabled:a.disabled,tabIndex:a.tabIndex,rendered:D0e(a)}));return n.find(a=>a.closest(".settings-list")!=null)??n[0]??null}function U0e(e,t,n){const[a,i]=m.useState(null),o=m.useRef(void 0),r=m.useRef(null);return m.useEffect(()=>()=>{var c;window.clearTimeout(o.current),(c=r.current)==null||c.removeAttribute("data-jumped")},[]),m.useEffect(()=>{const c=e.current;if(!a||!t||!c)return;const d=()=>c.querySelector(`[data-setting="${CSS.escape(a)}"]`),u=b=>{var y,N;i(null);const k=b.offsetHeight>c.clientHeight-48;b.scrollIntoView({block:k?"start":"center"}),(y=F0e(b))==null||y.focus({preventScroll:!0}),window.clearTimeout(o.current),(N=r.current)==null||N.removeAttribute("data-jumped"),b.offsetWidth,b.setAttribute("data-jumped",""),r.current=b,o.current=window.setTimeout(()=>{b.removeAttribute("data-jumped"),r.current===b&&(r.current=null)},M0e)},h=d();if(h){u(h);return}const g=new MutationObserver(()=>{const b=d();b&&(g.disconnect(),window.clearTimeout(f),u(b))});g.observe(c,{childList:!0,subtree:!0});const f=window.setTimeout(()=>{g.disconnect(),i(null)},I0e);return()=>{g.disconnect(),window.clearTimeout(f)}},[e,a,t,n]),i}function B0e({section:e,landOn:t,onSection:n,onClose:a,providers:i,sound:o,tones:r,customTones:c,notify:d,appearance:u,versionCheck:h,desktopUpdate:g,restart:f,doors:b}){const k=se(),y=m.useRef(null),N=m.useCallback(Te=>{y.current=Te},[]);function w(Te,nt=!1){y.current?(W(""),y.current(Te,nt),requestAnimationFrame(()=>{var fe,Ve;return(Ve=(fe=S.current)==null?void 0:fe.scrollIntoView)==null?void 0:Ve.call(fe,{block:"nearest",inline:"nearest"})})):Te()}const j=()=>w(a,!0),S=m.useRef(null),A=Tt(j,{focusRef:S}),T=Rt(()=>w(a)),q=m.useRef([]),_=hh(),I=t0(_),z=Zoe(I,e,i.claude),F=Math.max(0,z.findIndex(Te=>Te.id===e)),U=_l("(max-width: 640px)"),[P,L]=m.useState(""),[R,O]=m.useState(0),D=m.useRef(null),$=m.useRef(null),B=P.trim()!=="",G=m.useMemo(()=>ece(P,IB(i.claude,I,ph(_))),[P,i.claude,I,_,k]),Z=U0e($,!B,e),W=Te=>{L(Te),O(0)};m.useEffect(()=>{t&&Z(t)},[t,Z]);const H=Te=>{w(()=>{W(""),n(Te),requestAnimationFrame(()=>{var nt;return(nt=document.getElementById(`settings-tab-${Te}`))==null?void 0:nt.focus()})})},X=Te=>{w(()=>{W(""),n(Te.section),af(Te)||Z(Te.id)})};m.useEffect(()=>{const Te=nt=>{var gt,mt;if(!are(nt))return;const fe=A.current,Ve=nt.target;!fe||!(Ve===document.body||Ve===document.documentElement||Ve&&fe.contains(Ve))||(nt.preventDefault(),(gt=D.current)==null||gt.focus(),(mt=D.current)==null||mt.select())};return window.addEventListener("keydown",Te),()=>window.removeEventListener("keydown",Te)},[A]),m.useEffect(()=>{var Te,nt,fe,Ve;Xoe((Te=document.activeElement)==null?void 0:Te.id,e)&&((nt=S.current)==null||nt.focus()),(Ve=(fe=S.current)==null?void 0:fe.scrollIntoView)==null||Ve.call(fe,{block:"nearest",inline:"nearest"})},[e]);const{theme:V,setTheme:Q,characterEnabled:Y,setCharacterEnabled:K,character:ee,setCharacter:te}=u,ce=On(),ge=Te=>{const nt=yf(Te,F,z.length,"vertical");nt.kind!=="pass"&&(Te.preventDefault(),w(()=>{var fe;W(""),n(z[nt.index].id),(fe=q.current[nt.index])==null||fe.focus()}))},ve=Te=>{Te.key===" "&&Te.stopPropagation()},{soundOn:pe,toggleSound:ae}=o,{tonePrefs:le,previewTone:Se,changeTone:ke}=r,{customSelections:ye,customAssets:We,clearCustomOnly:He,selectCustomTone:Ke,importNotificationAudio:Re,createNotificationVoice:Je,renameCustomAsset:Pe,deleteCustomAsset:Ae,previewCustomAsset:xe}=c,{notifyPermission:ze,notifyOn:Ce,notifyVetoed:Me,toggleNotify:Ee,notifySupported:Be,askForNotifications:tt,accountNotify:ie,toggleAccountNotify:je}=d,Fe=(()=>{switch(e){case"radar":return s.jsx($Te,{onOpen:b.radar});case"claude":return s.jsx(r0e,{});case"appearance":return s.jsxs(s.Fragment,{children:[s.jsx(m0e,{theme:V,onTheme:Q,singleKeys:ce}),s.jsx(z0e,{characterEnabled:Y,character:ee,onCharacter:te,onToggleCharacter:()=>K(Te=>!Te)})]});case"reading":return s.jsx(k0e,{textSize:u.textSize,density:u.density,onTextSize:u.setTextSize,onDensity:u.setDensity});case"keyboard":return s.jsx(qTe,{singleKeys:ce,onToggleSingleKeys:()=>qne(!ce)});case"notifications":return s.jsx(_Te,{notifyOn:Ce,onToggleNotify:Ee,notifyVetoed:Me,notifyPermission:Be?ze:"unsupported",onAskNotify:tt,accountNotify:ie,onToggleAccountNotify:je});case"sounds":return s.jsx(GTe,{soundOn:pe===!0,onToggleSound:ae,prefs:le,claudeHere:i.claude,onLevel:(Te,nt)=>ke(Te,{level:nt}),onFigure:(Te,nt)=>ke(Te,{figure:nt}),onPreview:Te=>Se(Te),customAssets:We,customSelections:ye,onBuiltInSelected:He,onCustomSelected:Ke,onImportCustom:Re,onCreateVoice:Je,onRenameCustom:Pe,onPreviewCustom:xe,onDeleteCustom:Ae});case"integrations":return s.jsx(p0e,{onBeforeLeaveChange:N});case"data":return s.jsx(l0e,{});case"about":return s.jsx(A0e,{version:h.version,notice:h.notice,readyAppUpdate:g.readyAppUpdate,updateRestarting:g.desktopUpdateRestarting,updateFailure:g.desktopUpdateFailure,onUpdateRestart:Te=>{g.askDesktopUpdateRestart(Te)},doors:b});default:return s.jsxs(s.Fragment,{children:[s.jsx(CTe,{}),s.jsx(NTe,{}),s.jsx(lD,{provider:"Codex"}),i.claude&&s.jsx(lD,{provider:"Claude"}),s.jsx(q0e,{autoRestart:f.autoRestart,onToggleAutoRestart:f.toggleAutoRestart,version:h.version}),s.jsx(TTe,{claudeHere:i.claude,codexHere:i.codex,singleKeys:ce,doors:b})]})}})(),Ge=e==="reading"?s.jsx(v0e,{textSize:u.textSize,density:u.density,onTextSize:u.setTextSize,onDensity:u.setDensity}):e==="integrations"&&_.connections!==null?s.jsx("span",{className:"ig-total",children:k("settings.savedConnections",{count:_.connections.length})}):null;return s.jsx("div",{className:"modal-backdrop",...T,role:"presentation",children:s.jsxs("div",{ref:A,id:"settings",className:"modal settings-modal",role:"dialog","aria-modal":"true","aria-labelledby":"settings-title",onClick:Te=>Te.stopPropagation(),onKeyDown:ve,children:[s.jsxs("header",{className:"modal-head",children:[s.jsx("div",{className:"modal-title",children:s.jsx("span",{id:"settings-title",className:"modal-tool-name",children:k("settings.title")})}),s.jsx("div",{className:"modal-actions",children:s.jsx("button",{type:"button",className:"glyph-btn",onClick:()=>w(a),"aria-label":k("settings.close"),title:k("settings.closeTip"),children:"×"})})]}),s.jsxs("div",{className:"settings-body",children:[s.jsxs("div",{className:"settings-side",children:[s.jsx(L0e,{inputRef:D,query:P,onQuery:W,results:G,active:R,onActive:O,onOpen:X}),s.jsx(P0e,{query:P,count:G.length}),s.jsx("div",{className:"settings-nav",role:"tablist","aria-label":k("settings.sections"),"aria-orientation":U?"horizontal":"vertical",onKeyDown:ge,children:z.map((Te,nt)=>s.jsxs("button",{ref:fe=>{q.current[nt]=fe,Te.id===e&&(S.current=fe)},type:"button",role:"tab",id:`settings-tab-${Te.id}`,className:"settings-tab","aria-selected":Te.id===e,"aria-controls":"settings-pane",tabIndex:Te.id===e?0:-1,onClick:()=>H(Te.id),children:[s.jsx(sf,{section:Te.id}),s.jsx("span",{className:"settings-tab-label",children:k(`settings.section.${Te.id}.label`)})]},Te.id))})]}),s.jsxs("div",{ref:$,className:"settings-pane",role:"tabpanel",id:"settings-pane","aria-labelledby":`settings-tab-${e}`,hidden:B||void 0,children:[s.jsxs("div",{className:"settings-pane-head",children:[s.jsxs("div",{className:"settings-pane-heading",children:[s.jsx("h2",{className:"settings-pane-title",children:k(`settings.section.${z[F].id}.label`)}),s.jsx("p",{className:"settings-pane-note",children:k(`settings.section.${z[F].id}.note`)})]}),Ge]}),Fe]},e),B&&s.jsx(O0e,{query:P,results:G,active:R,onOpen:X})]})]})})}function H0e({tool:e,onClose:t}){const n=se(),a=Tt(t),i=Rt(t),o=e.endedAt==null?"inflight":e.ok===!1?"err":"done",r=m.useRef({of:null});r.current.of!==e&&(r.current={of:e}),e.input!==void 0&&(r.current.input=e.input),e.response!==void 0&&(r.current.response=e.response);const c=r.current.input??e.inputPreview,d=r.current.response??e.errorPreview,u=e.trimmed===!0&&r.current.input===void 0&&r.current.response===void 0,h=m.useMemo(()=>{const g=oQ(e.name,c,d);return{input:g.input.map((f,b)=>s.jsx(kD,{block:f},b)),response:g.response.map((f,b)=>s.jsx(kD,{block:f},b)),copyInput:d1(e.name,"input",c),copyResponse:d1(e.name,"response",d)}},[e.name,c,d]);return s.jsx("div",{className:"modal-backdrop",...i,role:"presentation",children:s.jsxs("div",{ref:a,className:"modal tool-modal",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"tool-modal-title",children:[s.jsxs("header",{className:"modal-head",children:[s.jsxs("div",{className:"modal-title",children:[s.jsx("span",{className:`status-dot ${o}`,"aria-hidden":!0}),s.jsx("span",{id:"tool-modal-title",className:"modal-tool-name",children:e.name}),s.jsxs("span",{className:"modal-tool-id",title:e.id,children:[e.id.slice(0,12),"…"]})]}),s.jsxs("div",{className:"modal-actions",children:[s.jsx("span",{className:"modal-dur",children:sU(e,n("insights.tool.inflight"))}),s.jsx("button",{className:"glyph-btn",onClick:t,"aria-label":n("insights.audit.closeEsc"),title:n("insights.audit.closeEsc"),children:"×"})]})]}),s.jsxs("section",{className:"modal-body",children:[u&&s.jsx("div",{className:"modal-section",children:s.jsx("p",{className:"modal-note",children:n("insights.tool.released")})}),s.jsxs("div",{className:"modal-section",children:[s.jsxs("div",{className:"tm-head",children:[s.jsx("h4",{children:n("insights.cost.inputTitle")}),s.jsx(wD,{text:h.copyInput,what:"input"})]}),h.input]}),s.jsxs("div",{className:"modal-section",children:[s.jsxs("div",{className:"tm-head",children:[s.jsxs("h4",{children:[n("insights.tool.response")," ",o==="err"&&s.jsx("span",{className:"err-tag",children:n("insights.tool.error")})]}),e.endedAt!=null&&s.jsx(wD,{text:h.copyResponse,what:"response"})]}),e.endedAt==null?s.jsx("pre",{children:n("insights.tool.waiting")}):h.response]})]})]})})}const W0e={del:"tm-del",add:"tm-add",ctx:"tm-ctx"};function kD({block:e}){const[t,n]=m.useState(!1);if(e.inline)return s.jsxs("p",{className:"tm-inline",children:[e.label&&s.jsx("span",{className:"tm-label",children:e.label}),s.jsx("code",{children:e.text})]});const a=m.useMemo(()=>QX(e),[e]),{shown:i}=q2(a,t),o=eQ(a,t);return s.jsxs("div",{className:"tm-block",children:[e.label&&s.jsx("span",{className:"tm-label",children:e.label}),s.jsx("pre",{className:e.err?"tm-err":void 0,children:e.lines?i.map((r,c)=>s.jsxs("span",{className:r.tone?W0e[r.tone]:void 0,children:[r.text,c<i.length-1?`
|
|
352
352
|
`:""]},c)):i.map(r=>r.text).join(`
|
|
353
|
-
`)}),o&&s.jsx("button",{type:"button",className:"btn tm-more","aria-expanded":o.expanded,onClick:()=>n(r=>!r),children:o.label})]})}function wD({text:e,what:t}){const n=se(),[a,i]=m.useState(!1),o=m.useRef(!0);return m.useEffect(()=>()=>{o.current=!1},[]),s.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n(a?`insights.tool.copied.${t}`:`insights.tool.copy.${t}`),onClick:()=>void Rs(e).then(r=>{!r||!o.current||(i(!0),window.setTimeout(()=>{o.current&&i(!1)},1600))}),children:n(a?"insights.tool.copiedWord":"insights.tool.copyWord")})}const G0e=Uf(()=>Hr(()=>import("./UsageHistoryModal-
|
|
353
|
+
`)}),o&&s.jsx("button",{type:"button",className:"btn tm-more","aria-expanded":o.expanded,onClick:()=>n(r=>!r),children:o.label})]})}function wD({text:e,what:t}){const n=se(),[a,i]=m.useState(!1),o=m.useRef(!0);return m.useEffect(()=>()=>{o.current=!1},[]),s.jsx("button",{type:"button",className:"btn tm-copy",disabled:!e,"aria-label":n(a?`insights.tool.copied.${t}`:`insights.tool.copy.${t}`),onClick:()=>void Rs(e).then(r=>{!r||!o.current||(i(!0),window.setTimeout(()=>{o.current&&i(!1)},1600))}),children:n(a?"insights.tool.copiedWord":"insights.tool.copyWord")})}const G0e=Uf(()=>Hr(()=>import("./UsageHistoryModal-M0A1co-v.js"),[]),()=>x("shell.lazy.usageHistory")),$0e=Uf(()=>Hr(()=>import("./BrowserWatchModal-BahEbWu-.js"),[]),()=>x("shell.lazy.browserWatch")),V0e=Uf(()=>Hr(()=>import("./TrafficRadar-B2G1nwSK.js"),[]),()=>x("shell.lazy.radar"));function K0e({dialogs:e,welcome:t,desktopUpdate:n,versionCheck:a,restart:i,upgrade:o,lanPairs:r,attention:c,clearFlow:d,watchBadge:u,announcements:h,appearance:g,providers:f,stateRef:b,agentCount:k,menus:y,sound:N,tones:w,customTones:j,notify:S,panelDoors:A}){Aa();const{openedTool:T,setOpenedToolKey:q,usageHistoryOpen:_,setUsageHistoryOpen:I,browserWatchOpen:z,setBrowserWatchOpen:F,contextAgent:U,setContextFor:P,summaryFor:L,setSummaryFor:R,keyHelpOpen:O,setKeyHelpOpen:D,feedbackOpen:$,setFeedbackOpen:B,feedbackPrefill:G,setFeedbackPrefill:Z,openFeedback:W}=e,{trafficRadarOpen:H,setTrafficRadarOpen:X}=e,{tourOpen:V,openTour:Q,closeTour:Y,releaseNotes:K,closeReleaseNotes:ee,chipVersion:te,openReleaseNotes:ce}=t,{desktopUpdateRestarting:ge,desktopUpdateFailure:ve,readyAppUpdate:pe,askDesktopUpdateRestart:ae}=n,{version:le,showNotice:Se}=a,{askRestart:ke}=i,{clearConfirmOpen:ye,setClearConfirmOpen:We,requestClear:He}=d,{setWatchOn:Ke,markWatchSeen:Re}=u,{setWatchSaid:Je}=h,{palette:Pe}=g,{settingsOpen:Ae,settingsSection:xe,settingsLandOn:ze,showSection:Ce,closeSettings:Me,openSettings:Ee}=y;return s.jsxs(s.Fragment,{children:[T&&s.jsx(H0e,{tool:T,onClose:()=>q(null)}),_&&s.jsx(m.Suspense,{fallback:null,children:s.jsx(G0e,{providers:f,onClose:()=>I(!1)})}),z&&s.jsx(m.Suspense,{fallback:null,children:s.jsx($0e,{onClose:()=>F(!1),onSeen:Be=>{Je(""),Re(Be)},onWatching:Ke,palette:Pe})}),U&&s.jsx(nte,{agent:U,onClose:()=>P(null)}),H&&s.jsx(m.Suspense,{fallback:null,children:s.jsx(V0e,{sessions:[...b.current.agents.values()].filter(Be=>Be.kind==="root"&&Be.provider!=="codex").map(Be=>({id:Be.sessionId,label:Um(Be.sessionName,Be.sessionTitle).face??Be.cwdBasename??Be.label,project:Be.cwdBasename??Be.label,workspace:Be.cwd})),onClose:()=>X(!1)})}),$&&s.jsx(QW,{initialKind:G==null?void 0:G.initialKind,initialBody:G==null?void 0:G.initialBody,onClose:()=>{B(!1),Z(null)}}),L&&s.jsx(yTe,{state:b.current,sessionId:L,onClose:()=>R(null)}),Ae&&s.jsx(B0e,{section:xe,landOn:ze,onSection:Ce,onClose:Me,providers:f,sound:N,tones:w,customTones:j,notify:S,appearance:g,versionCheck:a,desktopUpdate:n,restart:i,doors:{whatsNew:lo(Me,ce),update:lo(Me,()=>{ce(),Se()}),tour:lo(Me,Q),feedback:lo(Me,()=>W()),accounts:lo(Me,A.accounts),localNetwork:lo(Me,A.localNetwork),browserWatch:lo(Me,()=>F(!0)),radar:lo(Me,()=>X(!0))}}),K&&s.jsx(kTe,{entries:K.entries,since:K.since,firstRun:K.firstRun,running:te,onClose:ee,onTour:()=>{ee(),Q()},updateVersion:pe==null?void 0:pe.version,updateBusy:ge,updateFailure:ve&&(!pe||pe.version===ve.version)?UW(ve.failure,ve.version):void 0,onUpdateRestart:pe?()=>{ae(pe.version)}:void 0,onRestart:!pe&&(le!=null&&le.canRestart)?()=>{ee(),ke()}:void 0,updateCheck:{versionCheck:a,upgrade:o,restart:i,desktopUpdate:n,running:te,onHandOff:ee}}),s.jsx(J0e,{lanPairs:r,attention:c}),O&&s.jsx(SAe,{onClose:()=>D(!1),onTour:()=>{D(!1),Q()},onSettings:()=>{D(!1),Ee("keyboard")}}),V&&s.jsx(dH,{title:x("shell.guide.welcome.title"),steps:Qge,onClose:Y}),ye&&s.jsx(mje,{agentCount:k,onConfirm:()=>He("confirmation"),onCancel:()=>We(!1)})]})}function J0e({lanPairs:e,attention:t}){const n=OAe(e);return s.jsxs(s.Fragment,{children:[n,s.jsx(DAe,{...t,pairing:n!=null})]})}const Y0e=10,u5=500,h5=4e3,Z0e=[/ResizeObserver loop/i,/^Script error\.?$/i],yD=/^(?:[a-z][\w+.-]*-extension|webkit-masked-url):\/\//i,X0e=/[a-z][\w+.-]*:\/\/[^\s()]+/gi;function Q0e(e,t){const n=typeof e=="string"?e.split(`
|
|
354
354
|
`):[],a=n.some(o=>/^\s*at\s/.test(o)),i=n.flatMap(o=>!a||/^\s*at\s/.test(o)?o.match(X0e)??[]:[]);return i.length?i.every(o=>yD.test(o)):typeof t=="string"&&yD.test(t)}const Cm=String.raw`[^\s\\/:'"\`<>|?*;,]`,eRe=String.raw`${Cm}(?:[^\\/\r\n:'"\`<>|?*;,]*${Cm})?[\\/]`,tRe=String.raw`[^\s\\/:'"\`<>|?*;,()]+`,Gd=String.raw`(?:${eRe})*(?:${tRe})?`,nRe=String.raw`(?<![\w.~/\\\]-]|<(?:deck|host)>)(?:file://(?:/[A-Za-z]:)?[^\s:'"\`<>()]*|~[\\/]${Gd}|[A-Za-z]:[\\/]${Gd}|\\\\(?:[?.]\\)?(?:[A-Za-z]:\\)?${Gd}|/(?=${Cm})${Gd}|(?<!:)//(?=${Cm})${Gd})`,aRe=String.raw`(?<![\w-])(?:[A-Za-z]--|-[A-Za-z0-9][\w.]*-)[\w.-]*`,sRe=new Set([".claude",".codex"]);function iRe(e){if(!e.startsWith("~"))return"<path>";const t=e[1],[n,...a]=e.slice(2).split(/[\\/]/);return n?sRe.has(n)?a.join("")?`~${t}${n}${t}<path>`:e:`~${t}<path>`:e}const oRe=String.raw`\b(https?|wss?)://[^\s/?#\\'"\x60<>(),;]+(?=(/assets/)?)`;function rRe(e,t,n){return n?"<deck>":`${t}://<host>`}const xD=String.raw`(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)`,p5=String.raw`${xD}(?:\.${xD}){3}`,JS=String.raw`[0-9A-Fa-f]{1,4}`,CD=String.raw`(?=[0-9A-Fa-f:]*\d)(?=[0-9A-Fa-f:]*::|(?:${JS}:){7})(?:(?:${JS})?:)+(?:${p5}|${JS})?`,SD=String.raw`%[\w-]+(?:\.[\w-]+)*`,ND=String.raw`(?:::1?|::ffff:(?:127(?:\.\d{1,3}){3}|0\.0\.0\.0))`,cRe=String.raw`(?<![\w:.%-])(?:\[(?!${ND}\])${CD}(?:${SD})?\]|(?!${ND}(?::\d{1,5})?(?![\w:%]|\.\d))${CD}(?:${SD})?(?![\w%]|\.\d))|(?<![\w./-])(?!127\.|0\.0\.0\.0\b)${p5}(?![\w-]|\.\d)`,YS=String.raw`(?=[\w.-]*[A-Za-z])[A-Za-z0-9][\w-]*(?:\.[\w-]+)*`,lRe=String.raw`(?<![\w.@/\\%-])(?!localhost(?![\w-]|\.\w))(?:(?<=\b(?:(?:getaddrinfo|connect) E[A-Z_]+|ENOTFOUND|EAI_AGAIN) )${YS}|${YS}(?=:\d{1,5}(?![\w:-]|\.\w))|${YS}\.(?:local|lan|home|internal|ts\.net)(?![\w-]|\.\w))`;function jD(e){return String(e??"").replace(/\/(?:home|Users)\/[^/\s:'"]+/g,"~").replace(/[A-Za-z]:\\(?:Users|Documents and Settings)\\[^\\\r\n:'"]+/gi,"~").replace(new RegExp(nRe,"g"),iRe).replace(new RegExp(aRe,"g"),"<project>").replace(new RegExp(oRe,"g"),rRe).replace(new RegExp(cRe,"g"),"<host>").replace(new RegExp(lRe,"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 g5=e=>{fetch("/api/client-error",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e),keepalive:!0}).catch(()=>{})};function dRe(e,t,n=g5){const a=String(e??"").slice(0,u5).trim();a&&n({message:a,stack:typeof t=="string"?t.slice(0,h5):void 0})}function uRe(e,t=window,n=g5){let a=0;const i=new Set,o=(d,u,h)=>{const g=String(d??"").slice(0,u5).trim();!e()||!g||a>=Y0e||i.has(g)||Z0e.some(f=>f.test(g))||Q0e(u,h)||(i.add(g),a++,n({message:g,stack:typeof u=="string"?u.slice(0,h5):void 0}))},r=d=>{var u,h;return o(((u=d.error)==null?void 0:u.message)??d.message,(h=d.error)==null?void 0:h.stack,d.filename)},c=d=>typeof d.reason=="object"&&d.reason!==null?o(d.reason.message,d.reason.stack):o(d.reason,void 0);return t.addEventListener("error",r),t.addEventListener("unhandledrejection",c),()=>{t.removeEventListener("error",r),t.removeEventListener("unhandledrejection",c)}}const hRe=12;function pRe(e,t){const n=[jD(e).trim()||x("shell.error.noMessage")],a=t==null?void 0:t.trim();if(a){const i=a.split(`
|
|
355
355
|
`).slice(0,hRe).join(`
|
|
356
356
|
`);n.push("",jD(i).trim())}return n.join(`
|
|
357
357
|
`)}class gRe extends m.Component{constructor(){super(...arguments);Ba(this,"state",{error:null,componentStack:null,reportOpen:!1});Ba(this,"onKey",n=>{Bm(n.key)&&jn.dismissTop()})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,a){console.error("ccdeck hit a render error it could not draw past",n,a.componentStack),this.setState({componentStack:a.componentStack??null}),dRe(n.message,n.stack),wW("offline")}componentDidUpdate(n,a){this.state.reportOpen!==a.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:a,reportOpen:i}=this.state;return n?s.jsxs("div",{className:"error-fallback",children:[s.jsxs("div",{className:"error-fallback-card",role:"alert",children:[s.jsx("p",{className:"error-fallback-title",children:x("shell.error.title")}),s.jsx("p",{className:"error-fallback-note",children:x("shell.error.note")}),s.jsxs("div",{className:"error-fallback-actions",children:[s.jsx("button",{type:"button",className:"btn primary",onClick:()=>window.location.reload(),children:x("shell.reload")}),s.jsx("button",{type:"button",className:"btn",onClick:()=>this.setState({reportOpen:!0}),"aria-haspopup":"dialog",children:x("shell.error.report")})]})]}),i&&s.jsx(QW,{initialKind:"bug",initialBody:pRe(n.message,a),onClose:()=>this.setState({reportOpen:!1})})]}):this.props.children}}const mRe=1e3;function fRe(e={}){const t=Math.max(1,Math.floor(e.limit??mRe)),n=e.protect;let a=!1,i=[],o=new Set,r=0,c=0,d=null;return{get paused(){return a},get size(){return i.length},get dropped(){return r},get overflowed(){return r>0},get through(){return c},accept(u){const h=typeof(u==null?void 0:u.seq)=="number"?u.seq:null,g=(u==null?void 0:u.epoch)??null,f=g!==null&&g!==d;f&&(d=g,c=0);const b=h!==null&&!f&&h<=c;if(h!==null&&h>c&&(c=h),!a)return!0;if(b)return!1;if(i.push(u),n!=null&&n(u)&&o.add(u),i.length>t){let k=0;if(o.size<i.length)for(;o.has(i[k]);)k++;const[y]=i.splice(k,1);o.delete(y),r++}return!1},setPaused(u){if(a=u,u)return[];const h=i;return i=[],o=new Set,r=0,h}}}function bRe(e){const t=m.useState(()=>fRe({protect:o=>bQ(e.current,o)}))[0],[n,a]=m.useState(!1),i=m.useCallback(()=>{const o=t.paused&&t.dropped>0,r=t.setPaused(!t.paused);o&&nee(e.current);for(const c of r)e.current=H2(e.current,c);a(t.paused)},[t,e]);return{pauseGate:t,paused:n,togglePause:i}}const AD="agent-dag.accountPanelProvider",vRe=400,kRe={claude:!1,codex:!1};function wRe(e,t){const[n,a]=m.useState(()=>ht(AD)==="codex"?"codex":"claude"),i=e.claude&&!!e.codex,o=i?n:e.codex?"codex":"claude",[r,c]=m.useState(!1);m.useEffect(()=>{if(!i||!t){c(!1);return}const y=setTimeout(()=>c(!0),vRe);return()=>clearTimeout(y)},[i,t]);const d=m.useCallback(y=>{a(y),pt(AD,y)},[]),u=m.useRef(!1),h=m.useCallback(y=>{y!==o&&(u.current=!0,c(!0),d(y))},[d,o]);m.useLayoutEffect(()=>{var y;u.current&&(u.current=!1,(y=document.querySelector(`#${m5(o)} [role="radio"][aria-checked="true"]`))==null||y.focus())},[o]);const[g,f]=m.useState(kRe),b=m.useCallback(y=>f(N=>({...N,claude:y})),[]),k=m.useCallback(y=>f(N=>({...N,codex:y})),[]);return{both:i,shown:o,bothMounted:r,remember:d,pick:h,notices:g,noteClaude:b,noteCodex:k}}function m5(e){return e==="codex"?"codex-accounts-panel":"accounts-panel"}const Dj={kind:"assumed",claude:!0,codex:!0};function yRe(e){if(!e||typeof e!="object")return Dj;const t=e.providers;if(!t||typeof t!="object")return Dj;const n=t;return{kind:"reported",claude:n.claude!==!1,codex:n.codex!==!1}}function xRe(e){const[t,n]=m.useState(null),[a,i]=m.useState(Dj);m.useEffect(()=>{let r=!1;return fetch("/api/health").then(c=>c.ok?c.json():null).then(c=>{r||(i(yRe(c)),!(!c||typeof c.workspace!="string")&&n(c.workspace))}).catch(()=>{}),()=>{r=!0}},[e]);const o=da(a);return{workspace:t,providers:a,providersRef:o}}const f5=3*6e4,CRe=2e4;function SRe({fetchReport:e,visible:t,now:n,onReport:a}){let i=0,o=!0;const r=async()=>{if(!t())return;const c=await e();!o||!c||(i=n(),a(c))};return{tick:r,wake:async()=>{t()&&n()-i>=f5&&await r()},stop:()=>{o=!1}}}async function NRe(){try{const e=await fetch("/api/provider-status",{signal:AbortSignal.timeout(CRe)});return e.ok?await e.json():null}catch{return null}}function jRe(e){const[t,n]=m.useState(null);return m.useEffect(()=>{if(!e){n(null);return}const a=SRe({fetchReport:NRe,visible:()=>document.visibilityState==="visible",now:()=>Date.now(),onReport:n});a.tick();const i=window.setInterval(a.tick,f5),o=()=>{a.wake()};return document.addEventListener("visibilitychange",o),()=>{a.stop(),window.clearInterval(i),document.removeEventListener("visibilitychange",o)}},[e]),t}const ARe={degraded:"shell.incident.words.degraded",partial_outage:"shell.incident.words.partial_outage",major_outage:"shell.incident.words.major_outage",maintenance:"shell.incident.words.maintenance"},TRe={degraded:"shell.incident.chip.degraded",partial_outage:"shell.incident.chip.partial_outage",major_outage:"shell.incident.chip.major_outage",maintenance:"shell.incident.chip.maintenance"},RRe={degraded:"shell.incident.short.degraded",partial_outage:"shell.incident.short.partial_outage",major_outage:"shell.incident.short.major_outage",maintenance:"shell.incident.short.maintenance"},ERe={claude:"Claude",codex:"Codex"},qRe=new Set(["status.claude.com","status.openai.com"]),_Re=30*6e4,zRe=10*6e4;function LRe(e){if(typeof e!="string")return null;try{const t=new URL(e);return t.protocol==="https:"&&qRe.has(t.hostname)?t:null}catch{return null}}function TD(e){return new Date(e).toLocaleTimeString(Le(),{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})}function ORe(e){const t=Math.floor(e/6e4);return t<1?x("shell.ago.now"):t<60?x("shell.ago.min",{n:t}):x("shell.ago.hr",{n:Math.floor(t/60)})}function PRe(e,t){if(!e||typeof e!="object")return null;const n=un(ARe,e.state),a=n&&x(n),i=un(ERe,e.provider);if(!a||!i||typeof e.checkedAt!="number"||t-e.checkedAt>_Re)return null;const o=LRe(e.statusPageUrl);if(!o)return null;const r=Array.isArray(e.components)?e.components:[],c=e.stale===!0||t-e.checkedAt>zRe,d=[`${i}: ${a}${e.summary?` — ${e.summary}`:""}`,r.length>0?x("shell.incident.affected",{components:r.join(", ")}):null,e.scope==="page"?x("shell.incident.scopePage",{name:i}):null,c?x("shell.incident.lastRead",{host:o.hostname,time:TD(e.checkedAt)}):x("shell.incident.reported",{host:o.hostname,ago:ORe(t-e.checkedAt)}),x("shell.incident.opensPage")],u=c?TD(e.checkedAt):null,h=un(TRe,e.state),g=un(RRe,e.state);return{provider:e.provider,state:e.state,name:i,label:`${i} · ${a}${u?` · ${x("shell.incident.asOf",{time:u})}`:""}`,words:a,chipWords:h?x(h):a,shortWords:g?x(g):a,asOf:u,what:e.summary||(r.length>0?r.join(", "):null),href:o.href,host:o.hostname,stale:c,detail:d.filter(Boolean).join(`
|
|
358
|
-
`)}}function MRe(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>PRe(n,t)).filter(n=>n!==null)}function IRe(e){return e.map(t=>x(t.state.endsWith("outage")?"shell.incident.sentenceA":"shell.incident.sentence",{name:t.name,words:t.words})).join(" ")}const DRe=()=>x("shell.incident.clear");function FRe({version:e,loadVersion:t}){var u;const[n,a]=m.useState(!1),i=((u=e==null?void 0:e.upgrade)==null?void 0:u.state)??"idle",o=aje(e==null?void 0:e.upgrade),r=m.useRef(!1),c=m.useCallback(async()=>{if(Qn(r.current||i==="running")){r.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),r.current=!1}},[i,t]);m.useEffect(()=>{if(i!=="running")return;const h=window.setInterval(t,3e3);return()=>window.clearInterval(h)},[i,t]);const d=m.useCallback(async()=>{const h=e==null?void 0:e.command;!h||!await Rs(h)||(a(!0),window.setTimeout(()=>a(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:i,upgradeFailure:o,startUpgrade:c,copyCommand:d,cmdCopied:n}}const RD="agent-dag.browserWatch.seenMs";function URe(e,t){return e.filter(n=>n.startMs>t)}function BRe(){const[e,t]=m.useState(()=>Number(ht(RD))||0),[n,a]=m.useState([]),[i,o]=m.useState(!1);m.useEffect(()=>{let d=!0;const u=()=>{fetch("/api/browser-watch?live=0").then(g=>g.ok?g.json():null).then(g=>{var f;!d||!(g!=null&&g.ok)||(a(g.episodes??[]),o(((f=g.settings)==null?void 0:f.enabled)===!0))}).catch(()=>{})};u();const h=setInterval(u,5*6e4);return()=>{d=!1,clearInterval(h)}},[]);const r=m.useMemo(()=>URe(n,e).length,[n,e]),c=m.useCallback(d=>{t(d),pt(RD,String(d))},[]);return{watchOn:i,setWatchOn:o,watchUnseen:r,markWatchSeen:c}}const b5="agent-dag.character-enabled",v5="agent-dag.fm-volume",HRe=1,ED="agent-dag.fm-source",x1e=[{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 WRe(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 GRe(e){return e!=="0"}function $Re(){return GRe(ht(b5))}function VRe(e){return _B(e,HRe)}function KRe(){return VRe(ht(v5))}const k5=["--err","--inflight","--ok","--warn","--muted","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function qD(e){const t={};for(const n of k5)t[n]=e(n);return t}function JRe(e){return t=>e[t]??""}function YRe(e,t){return k5.every(n=>e[n]===t[n])}function ZRe(e,t){let n=null,a=0;function i(){a++,n==null||n.skipTransition(),n=null,delete e.documentElement.dataset.themeTransition}return{cancel:i,run(o){i();const r=a;let c=!1;const d=()=>{r!==a||c||(c=!0,o())};if(!e.startViewTransition||e.hidden||t()){d();return}e.documentElement.dataset.themeTransition="true";try{const u=e.startViewTransition(d);n=u,u.ready.catch(()=>{}),u.updateCallbackDone.catch(()=>{d()}),u.finished.then(()=>{n===u&&(n=null,delete e.documentElement.dataset.themeTransition)},()=>{n===u&&(d(),n=null,delete e.documentElement.dataset.themeTransition)})}catch{delete e.documentElement.dataset.themeTransition,d()}}}}function _D(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function XRe(){const[e,t]=m.useState(Ace),[n,a]=m.useState(Tce),[i,o]=m.useState($re),r=m.useRef(i),[c]=m.useState(()=>ZRe(document,()=>{try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!0}})),d=m.useCallback(w=>{const j=typeof w=="function"?w(r.current):w;j!==r.current&&(r.current=j,c.run(()=>_t.flushSync(()=>o(j))))},[c]);m.useEffect(()=>()=>c.cancel(),[c]);const[u,h]=m.useState($Re),[g,f]=m.useState(cre),[b,k]=m.useState(()=>qD(_D)),y=m.useMemo(()=>JRe(b),[b]),N=m.useCallback(w=>tCe(w,y),[y]);return m.useEffect(()=>{document.documentElement.dataset.textSize=e,pt(UN,e)},[e]),m.useEffect(()=>{document.documentElement.dataset.density=n,pt(BN,n)},[n]),m.useEffect(()=>{const w=j=>{j.storageArea===Js()&&((j.key===UN||j.key===null)&&t(XA(j.newValue)),(j.key===BN||j.key===null)&&a(KB(j.newValue)))};return window.addEventListener("storage",w),()=>window.removeEventListener("storage",w)},[]),m.useLayoutEffect(()=>{document.documentElement.dataset.theme=i,document.documentElement.dataset.colorScheme=Xu[i].colorScheme,pt(LB,i),k(w=>{const j=qD(_D);return YRe(w,j)?w:j})},[i]),m.useEffect(()=>{pt(b5,u?"1":"0")},[u]),m.useEffect(()=>{pt(NB,g)},[g]),m.useEffect(()=>{const w=document.querySelector('meta[name="theme-color"]'),j=b["--panel"];w&&j&&w.setAttribute("content",j)},[b]),{textSize:e,setTextSize:t,density:n,setDensity:a,theme:i,setTheme:d,characterEnabled:u,setCharacterEnabled:h,character:g,setCharacter:f,palette:b,minimapNodeFill:N}}function QRe(e){const t=m.useRef(null),[n,a]=m.useState(!1),[i,o]=m.useState(()=>new Set),r=m.useMemo(()=>{const d=new Set;for(const u of e.current.agents.values())for(const h of u.tools)d.add(CW(h.name));return Object.keys(xW).filter(u=>d.has(u))},[e.current,e.current.revision]);m.useEffect(()=>{if(r.length<=1){a(!1);return}let d=0;const u=()=>{const h=t.current;if(h&&!document.hidden){const g=h.getBoundingClientRect(),f=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(k=>k.getBoundingClientRect()),b=Hie(g,f,8);a(k=>k===b?k:b)}d=window.setTimeout(u,300)};return u(),()=>window.clearTimeout(d)},[r.length]);const c=m.useCallback(d=>{o(u=>{const h=new Set(u);return h.has(d)?h.delete(d):h.add(d),h})},[]);return{presentCats:r,hiddenCats:i,toggleCat:c,catBarRef:t,catBarOccluded:n}}function eEe(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null;const a=new Set,i=()=>e.enabled()?(n==null?void 0:n.state)==="running"?"ready":"locked":"off",o=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,i())};function r(){var f,b;if(!(!t||(n==null?void 0:n.state)==="running"))try{n||(n=new t,(f=n.addEventListener)==null||f.call(n,"statechange",o)),(b=n.resume)==null||b.call(n).then(o,()=>{}),o()}catch{}}function c(f,b,k=b.figure){if(!n||n.state!=="running")return!1;const y=IN(f,k),N=qre(b.level,y),w=n.currentTime;for(const j of y.notes){const S=n.createOscillator(),A=n.createGain();S.type=y.type??"sine",S.frequency.value=j.hz;const T=w+j.at,q=T+j.ms/1e3;A.gain.setValueAtTime(qq,T),A.gain.exponentialRampToValueAtTime(N,T+_re),A.gain.exponentialRampToValueAtTime(qq,q),S.connect(A).connect(n.destination),S.start(T),S.stop(q+.02)}return!0}async function d(f,b){var N;if(!e.loadCustom)return"unavailable";let k;try{k=await e.loadCustom(f)}catch{return"unavailable"}if(!k)return"missing";if(k.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const w=new SpeechSynthesisUtterance(k.text),j=window.speechSynthesis.getVoices();w.voice=j.find(S=>S.voiceURI===k.voiceURI)??null,w.rate=k.rate,w.pitch=k.pitch,w.volume=zre(b.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(w),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let y;try{y=await n.decodeAudioData(k.bytes.slice(0))}catch{return"broken"}try{const w=n.createBufferSource(),j=n.createGain();return w.buffer=y,j.gain.setValueAtTime(Lre(k.normalizationGain,b.level),n.currentTime),w.connect(j).connect(n.destination),a.add(w),(N=w.addEventListener)==null||N.call(w,"ended",()=>a.delete(w)),w.start(n.currentTime),"played"}catch{return"unavailable"}}function u(f,b=!1){var N,w;if(!b&&!e.enabled())return!1;const k=Ure((N=e.prefs)==null?void 0:N.call(e),f),y=((w=e.customSelection)==null?void 0:w.call(e)[f])??null;return y&&e.loadCustom?(d(y,k).then(j=>{var S;j==="played"||j==="locked"||((j==="missing"||j==="broken")&&((S=e.onCustomFailure)==null||S.call(e,f,y)),c(f,{...k,figure:Sa},Sa))}),!0):!n||n.state!=="running"?!1:c(f,k)}function h(f,b=Ur){return d(f,{level:nf(b),figure:Sa}),!0}function g(){try{typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel()}catch{}for(const f of a)try{f.stop()}catch{}a.clear()}return{unlock:r,play:u,previewCustom:h,silence:g,state:i,get context(){return n}}}function tEe({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:a,fallbackCustomRef:i}){m.useEffect(()=>{const o=eEe({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>a.current,loadCustom:jre,onCustomFailure:(u,h)=>i.current(u,h)});e.current=o;const r=["pointerdown","pointerup","keydown"],c=()=>{for(const u of r)window.removeEventListener(u,d,{capture:!0})},d=()=>{var u;o.unlock(),((u=o.context)==null?void 0:u.state)==="running"&&c()};for(const u of r)window.addEventListener(u,d,{capture:!0});return c},[])}function nEe(){const[e,t]=m.useState(KRe),[n,a]=m.useState(()=>Yne(ht(F1))),[i,o]=m.useState(()=>Jne(ht(U1))),[r,c]=m.useState(()=>Zne(ht(ED),n,WRe)),[d,u]=m.useState(()=>new Set),[h,g]=m.useState(0);m.useEffect(()=>{pt(v5,String(e))},[e]),m.useEffect(()=>{pt(U1,i?"1":"0")},[i]),m.useEffect(()=>{pt(F1,JSON.stringify(n))},[n]),m.useEffect(()=>{pt(ED,r)},[r]);const f=m.useCallback((w,j=!1)=>{a(S=>{const A=S.find(T=>T.id===w.id);return A?!j||!w.radio||!A.radio||A.url===w.url&&JSON.stringify(A.radio)===JSON.stringify(w.radio)?S:S.map(T=>T.id===w.id?{...T,url:w.url,radio:w.radio}:T):[...S,w]}),u(S=>{if(!S.has(w.id))return S;const A=new Set(S);return A.delete(w.id),A})},[]),b=m.useCallback((w,j)=>{const S=j.trim();!S||S.length>DU||a(A=>A.map(T=>T.id===w?{...T,name:S}:T))},[]),k=m.useCallback(w=>{a(j=>j.filter(S=>S.id!==w)),c(j=>Xne(j,w)),u(j=>{if(!j.has(w))return j;const S=new Set(j);return S.delete(w),S})},[]),y=m.useCallback((w,j=!1)=>{const S=B1(w),A=d.has(S);w===r&&!A&&!j||(A&&u(T=>{const q=new Set(T);return q.delete(S),q}),c(w),g(T=>T+1))},[r,d]),N=m.useCallback((w,j)=>{const S=B1(w);u(A=>{if(A.has(S)===j)return A;const q=new Set(A);return j?q.add(S):q.delete(S),q})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:i,setFmMuted:o,fmSource:r,customFmStations:n,unavailableFmStations:d,fmPlayRequest:h,addFmStation:f,renameFmStation:b,removeFmStation:k,pickFmSource:y,markFmStationAvailability:N}}function aEe(e){const[t,n]=m.useState(null),[a,i]=m.useState(!1),[o,r]=m.useState(null),c=m.useRef(0);m.useEffect(()=>{if(!e||!zo())return;let k=!1;const y=c.current;return fetch("/api/desktop-update").then(N=>N.ok?N.json():null).then(N=>{if(k||c.current!==y)return;const w=JI(N);w&&n(w)}).catch(()=>{}),()=>{k=!0}},[e]);const d=kNe(t),u=m.useRef(!1),h=m.useRef(0),g=m.useRef(0);m.useEffect(()=>()=>window.clearTimeout(h.current),[]);const f=m.useCallback(async k=>{if(!Qn(u.current))return;const y=++g.current;window.clearTimeout(h.current),u.current=!0,i(!0),r(null);const N=w=>{y===g.current&&(window.clearTimeout(h.current),u.current=!1,i(!1),r({failure:w,version:k}))};try{const w=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:k})});if(!w.ok)return N(yNe(await w.json().catch(()=>null)))}catch{return N("unreachable")}y===g.current&&(h.current=window.setTimeout(()=>N("timeout"),IW))},[]),b=m.useCallback(k=>{if(zo())try{const y=JI(JSON.parse(k));y&&(c.current++,n(y),y.status!=="ready"&&(g.current++,window.clearTimeout(h.current),u.current=!1,i(!1)))}catch{}},[]);return{desktopUpdateRestarting:a,desktopUpdateFailure:o,readyAppUpdate:d,appUpdate:t,askDesktopUpdateRestart:f,onDesktopUpdateEvent:b}}const ug="agent-dag.autoRestart",zD="agent-dag.bundleReloadedFor";function sEe({now:e,stateRef:t,version:n,notice:a,noticeOpen:i,upgradeFailure:o,paused:r}){const[c,d]=m.useState(()=>ht(ug)!=="0"),u=m.useRef(!1),h=m.useCallback(()=>{const F=!c;u.current=!0,Xa(ug),d(F),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:F})}).then(U=>U.ok?U.json():null).then(U=>{var P;U!=null&&U.ok&&d(((P=U.prefs)==null?void 0:P.autoUpdate)!==!1)}).catch(()=>{})},[c]),[g,f]=m.useState(!1),[b,k]=m.useState("restart"),[y,N]=m.useState(null),w=m.useRef(!1),j=m.useRef(null),S=m.useRef(0),A=m.useRef(null),T=m.useCallback(async F=>{if(!Qn(w.current))return;const U=(F==null?void 0:F.upgrade)===!0,P=(F==null?void 0:F.whenIdle)===!0;w.current=!0,j.current=o;const L=++S.current,R=()=>{k(U?"npx":"restart"),f(!0)};P||R();try{window.sessionStorage.setItem("agent-dag.restartPending",(a==null?void 0:a.to)??"")}catch{}let O=!1;try{const D=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P?{upgrade:U,whenIdle:P}:{upgrade:U})});O=P&&D.status===409}catch{}if(O){w.current=!1,A.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}P&&R(),window.setTimeout(()=>{if(S.current===L&&w.current){w.current=!1,f(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},U?18e4:3e4)},[a==null?void 0:a.to,o]);m.useEffect(()=>{const F=XI(t.current.agents.values())>0,U=cje({enabled:c,kind:a==null?void 0:a.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:i,visible:document.visibilityState==="visible",busy:F,idleSince:A.current,now:e});A.current=U.idleSince,U.restart&&T({whenIdle:!0})},[c,a==null?void 0:a.kind,n==null?void 0:n.canRestart,i,e,T]);const q=XI(t.current.agents.values()),_=rje(q,r),I=GW({enabled:c,kind:a==null?void 0:a.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:i,visible:document.visibilityState==="visible",busy:q>0,idleSince:A.current,now:e});m.useEffect(()=>{const F=n==null?void 0:n.running;let U=null,P=null;try{U=window.sessionStorage.getItem("agent-dag.restartPending"),P=window.sessionStorage.getItem(zD)}catch{return}const L=nje({bundle:"3.81.1",running:F,pending:U,lastTried:P});if(L==="reload"){try{window.sessionStorage.setItem(zD,F??"")}catch{return}window.location.reload();return}if(L!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}w.current=!1,f(!1),N(F??null);const R=window.setTimeout(()=>N(null),6e3);return()=>window.clearTimeout(R)},[n==null?void 0:n.running]),m.useEffect(()=>{if(g&&sje({asked:j.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}w.current=!1,f(!1)}},[g,o]);const z=m.useCallback(F=>{var U,P;if(!u.current){const L=ht(ug)==="0";Xa(ug),L&&((U=F.prefs)==null?void 0:U.autoUpdate)!==!1?(d(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):d(((P=F.prefs)==null?void 0:P.autoUpdate)!==!1)}},[]);return{autoRestart:c,toggleAutoRestart:h,restarting:g,restartMode:b,restartedTo:y,askRestart:T,restartCopy:_,restartFuseMs:I,loadAutoRestartPrefs:z}}function iEe(){const[e,t]=m.useState([]),n=m.useRef(new Set),[a,i]=m.useState(null),[o,r]=m.useState(void 0);m.useEffect(()=>{let u=!0,h=0;const g=()=>{fetch("/api/lan").then(f=>f.ok?f.json():null).then(f=>u?(f!=null&&f.ok&&t(k_(Array.isArray(f.pending)?f.pending:[],f.aliases)),f):null).catch(()=>null).then(f=>{u&&(r(b=>f!=null&&f.ok?f:b===void 0?null:b),h=window.setTimeout(g,(f==null?void 0:f.enabled)===!0?hj:lH))})};return g(),()=>{u=!1,window.clearTimeout(h)}},[]);const c=m.useCallback(async(u,h)=>{if(!a){i(u);try{const f=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:u,fp:h})})).json().catch(()=>null);f&&Array.isArray(f.pending)?t(k_(f.pending,f.aliases)):t(b=>b.filter(k=>k.fp!==h))}catch{}finally{i(null)}}},[a]),d=m.useCallback(u=>{a||(n.current.add(u),t(h=>[...h]))},[a]);return{lanPending:e,lanDeferred:n,lanBusy:a,answerLanPair:c,deferLanPair:d,lanStatus:o}}const oEe=6e4;function rEe({enabled:e,lanStatus:t,now:n}){const[a,i]=m.useState(null),[o,r]=m.useState(()=>new Set),[c,d]=m.useState(null),u=m.useCallback(w=>{w!=null&&w.ok&&Array.isArray(w.accounts)&&i(w.accounts)},[]),h=m.useCallback(async w=>{try{const j=await fetch(`/api/claude-accounts${w?"?refresh=1":""}`);j.ok&&u(await j.json())}catch{}},[u]);m.useEffect(()=>{e&&h(!1)},[e,h]),m.useEffect(()=>{if(!e)return;let w=Date.now();const j=()=>{document.visibilityState!=="visible"||Date.now()-w<oEe||(w=Date.now(),h(!1))};return document.addEventListener("visibilitychange",j),window.addEventListener("focus",j),()=>{document.removeEventListener("visibilitychange",j),window.removeEventListener("focus",j)}},[e,h]);const g=m.useMemo(()=>e?jAe(a,{lan:t,now:n,closed:o}):[],[e,a,t,n,o]),f=m.useRef(g);f.current=g;const b=m.useCallback(w=>{w.length&&r(j=>new Set([...j,...w]))},[]),k=m.useCallback(()=>{const w=f.current;w.length&&(b(w.map(j=>j.id)),fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reauth-later",incidents:w.map(j=>({key:j.key,since:j.since}))})}).catch(()=>{}))},[b]),y=m.useRef(c);y.current=c;const N=m.useCallback(w=>{const j=y.current;b(AAe(j?[j,...f.current]:f.current,w))},[b]);return{rows:g,signingIn:c,observe:u,signIn:d,signedIn:N,refresh:m.useCallback(()=>{h(!0)},[h]),closeSignIn:m.useCallback(()=>d(null),[]),later:k}}const w5=288,cEe=w5;function lEe(e,t,n){return e?"session-list":t||n?"accounts":null}function LD(e){return e==="session-list"?cEe:e==="accounts"?w5:0}const dEe=240,uEe=20;function hEe(e){const t=m.useRef(0),n=m.useRef(e);return m.useLayoutEffect(()=>{n.current!==e&&(n.current=e,t.current=Sl()?0:performance.now()+dEe+uEe)},[e]),t}const y5="agent-dag.sessionListOpen",x5="agent-dag.accountsPanelOpen";function pEe(){return ht(y5)==="1"}function gEe(e){pt(y5,e?"1":"0")}function mEe(){const e=ht(x5);return e===null?!0:e==="1"}function fEe(){const e=m.useRef(!1),t=m.useRef(!1),[n,a]=m.useState(()=>{const k=pEe();return k&&LN()?(e.current=!0,!1):k});m.useEffect(()=>{if(n)e.current=!1;else if(e.current)return;gEe(n)},[n]);const i=m.useRef(!1),[o,r]=m.useState(()=>{const k=mEe();return k&&n?(i.current=!0,!1):k&&LN()?(t.current=!0,!1):k});m.useEffect(()=>{if(o)t.current=!1;else if(t.current)return;!o&&i.current||pt(x5,o?"1":"0")},[o]),m.useEffect(()=>{!n&&i.current&&(i.current=!1,r(!0))},[n]);const c=m.useCallback(()=>{a(k=>(k||r(y=>(y&&(i.current=!0),!1)),!k))},[]),d=m.useCallback(()=>{i.current=!1,r(k=>(k||a(!1),!k))},[]),u=m.useCallback(()=>{i.current=!1,r(k=>(k||a(!1),!0))},[]),h=m.useCallback(()=>a(!1),[]),g=m.useCallback(()=>{i.current=!1,a(!1)},[]),f=m.useCallback(()=>r(!1),[]),b=lEe(n,o,i.current);return{sessionListOpen:n,accountsPanelOpen:o,panel:b,toggleSessionList:c,toggleAccountsPanel:d,openAccountsPanel:u,closeSessionList:h,closeSessionListToCanvas:g,closeAccountsPanel:f}}const C5="agent-dag.detailOpen",S5="agent-dag.usagePanelOpen",N5="agent-dag.systemPanelOpen";function bEe(){return ht(C5)==="1"}function vEe(e){pt(C5,e?"1":"0")}function kEe(){const e=ht(S5);return e===null?!0:e==="1"}function wEe(e){pt(S5,e?"1":"0")}function yEe(){const e=ht(N5);return e===null?!0:e==="1"}function xEe(e){pt(N5,e?"1":"0")}function CEe(e=0){const[t,n]=m.useState(bEe);m.useEffect(()=>{vEe(t)},[t]);const[a,i]=m.useState(kEe);m.useEffect(()=>{wEe(a)},[a]);const o=m.useRef(!1),[r,c]=m.useState(()=>{const d=yEe();return d&&a&&(LN()||Boe(e))?(o.current=!0,!1):d});return m.useEffect(()=>{if(r)o.current=!1;else if(o.current)return;xEe(r)},[r]),An("usage-panel",a),An("machine-panel",r),{detailOpen:t,setDetailOpen:n,usagePanelOpen:a,setUsagePanelOpen:i,machinePanelOpen:r,setMachinePanelOpen:c}}const SEe={permission:"permission",asked:"answer"},NEe=()=>x("shell.announce.allClear");function jEe(e){if(e.length===0)return"";const[t,...n]=e,a=t.waiting.kind,i=n.every(o=>o.waiting.kind===a)?SEe[a]??"you":"you";return n.length===0?x(`shell.announce.block.${i}`,{label:t.label}):x(`shell.announce.blockMore.${i}`,{label:t.label,count:n.length})}function ZS(e,t,n=NEe()){return t!==""?t:e===""?"":n}function AEe({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[a,i]=m.useState(""),o=jEe(e);m.useEffect(()=>{i(f=>ZS(f,o))},[o]);const[r,c]=m.useState(""),d=t>0?x("shell.announce.watch",{count:t}):"";m.useEffect(()=>{c(f=>ZS(f,d,x("shell.announce.watchNone")))},[d]);const[u,h]=m.useState(""),g=IRe(n);return m.useEffect(()=>{h(f=>ZS(f,g,DRe()))},[g]),{blockedSaid:a,watchSaid:r,setWatchSaid:c,incidentSaid:u}}const TEe="/icon-192.png",j5=Object.freeze({notifySwap:!0,notifyQuota:!1,notifyReset:!1,notifyStopped:!0});function OD(e){const t=n=>typeof(e==null?void 0:e[n])=="boolean"?e[n]:j5[n];return{notifySwap:t("notifySwap"),notifyQuota:t("notifyQuota"),notifyReset:t("notifyReset"),notifyStopped:t("notifyStopped")}}function REe({waitingSessions:e,liveSince:t,focusSession:n}){const[a,i]=m.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[o,r]=m.useState(null),[c,d]=m.useState(!1),[u,h]=m.useState(!1),[g,f]=m.useState(j5),b=m.useCallback(I=>{const z=!g[I];f(F=>({...F,[I]:z})),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[I]:z})}).then(F=>F.ok?F.json():null).then(F=>{F!=null&&F.ok&&f(OD(F.prefs))}).catch(()=>{})},[g]),k=m.useRef(()=>{}),y=m.useRef(new Set),N=da(e),w=m.useCallback(()=>{const I=!c;d(I),I&&(y.current=Mp(N.current)),I&&typeof Notification<"u"&&Notification.permission==="default"&&k.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:I})}).then(z=>z.ok?z.json():null).then(z=>{var F;z!=null&&z.ok&&(d(((F=z.prefs)==null?void 0:F.notifications)===!0),h(z.notificationsVetoed===!0))}).catch(()=>{})},[c]),j=typeof Notification<"u";m.useEffect(()=>{if(!o)return;const z=setTimeout(()=>r(null),o==="blocked"?8e3:4e3);return()=>clearTimeout(z)},[o]);const S=m.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(I=>{const z=I;i(z),z==="granted"?r("on"):z==="denied"&&r("blocked")})},[]);k.current=S;const A=m.useRef(null),T=e.map(I=>Dm(I.id,I.waiting)).join("|");m.useEffect(()=>{Cee(A.current,a)&&(A.current=a,y.current=Mp(e))},[a]);const q=m.useRef(!1);m.useEffect(()=>{See(q.current,t)&&(q.current=!0,y.current=Mp(e))},[t]),m.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!Nee(A.current,t))return;const I=typeof document>"u"||!document.hidden,z=yee(e,y.current,I,c);for(const F of z)try{const U=new Notification(F.title,{body:F.body,tag:F.key,icon:TEe});U.onclick=()=>{window.focus(),n(F.sessionId),U.close()}}catch{}y.current=I?Mp(e):xee(e,z,y.current)},[T,t]);const _=m.useCallback(I=>{var z;d(((z=I.prefs)==null?void 0:z.notifications)===!0),h(I.notificationsVetoed===!0),f(OD(I.prefs))},[]);return{notifyPermission:a,notifySaid:o,notifyOn:c,notifyVetoed:u,toggleNotify:w,notifySupported:j,askForNotifications:S,loadNotifyPrefs:_,accountNotify:g,toggleAccountNotify:b}}function EEe({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:a,summaryFor:i,browserWatchOpen:o,keyHelpOpen:r,releaseNotes:c,feedbackOpen:d,trafficRadarOpen:u=!1}){const h=da(r),g=m.useRef(!1);return g.current=e!=null||t||n!=null||a||i!=null||o||r||c!=null||d||u,{keyHelpOpenRef:h,modalOpenRef:g}}function qEe({stateRef:e,tourOpen:t,releaseNotes:n}){const[a,i]=m.useState(null),o=m.useCallback((P,L)=>i({agentId:P,toolId:L}),[]),[r,c]=m.useState(null),[d,u]=m.useState(null),h=m.useCallback(P=>u(P),[]),[g,f]=m.useState(!1),[b,k]=m.useState(!1),[y,N]=m.useState(!1),[w,j]=m.useState(!1),[S,A]=m.useState(!1),[T,q]=m.useState(null),_=m.useCallback(P=>{q(P??null),A(!0)},[]);An("tool-detail",a!==null),An("session-summary",r!==null),An("context-window",d!==null),An("keyboard-help",g),An("usage-history",b),An("browser-watch",y),An("feedback",S);const I=a?pQ(e.current.agents,a.agentId,a.toolId):null,z=d?e.current.agents.get(d):void 0,{keyHelpOpenRef:F,modalOpenRef:U}=EEe({openedTool:I,usageHistoryOpen:b,contextFor:d,tourOpen:t,summaryFor:r,browserWatchOpen:y,keyHelpOpen:g,releaseNotes:n,feedbackOpen:S,trafficRadarOpen:w});return{setOpenedToolKey:i,openTool:o,openedTool:I,summaryFor:r,setSummaryFor:c,contextFor:d,setContextFor:u,openContext:h,contextAgent:z,keyHelpOpen:g,setKeyHelpOpen:f,usageHistoryOpen:b,setUsageHistoryOpen:k,browserWatchOpen:y,setBrowserWatchOpen:N,trafficRadarOpen:w,setTrafficRadarOpen:j,feedbackOpen:S,setFeedbackOpen:A,feedbackPrefill:T,setFeedbackPrefill:q,openFeedback:_,keyHelpOpenRef:F,modalOpenRef:U}}function _Ee({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:a,lastLayoutSigRef:i,forgetRemovals:o,clearSelection:r,rerender:c,modalOpenRef:d}){const[u,h]=m.useState(!1),g=m.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=iA(),t.current.clear(),n.current.clear(),a.current.clear(),i.current="",dW(),o(),r(),c()},[c,r,o]),f=da(u),b=m.useCallback(k=>{const y=uje(k,{confirmOpen:f.current,modalOpen:d.current});y==="confirm"?h(!0):y==="clear"&&(h(!1),g())},[g]);return{clearConfirmOpen:u,setClearConfirmOpen:h,requestClear:b}}const PD="agent-dag.oldNameNoticeDismissed";function zEe(e){const[t,n]=m.useState(()=>ht(PD)??""),a=e!=null&&e.invokedAs&&e.invokedAs!==qt?e.invokedAs:null,i=a!=null&&t!==a,o=m.useCallback(()=>{a&&(n(a),pt(PD,a))},[a]);return{oldName:a,oldNameOpen:i,dismissOldName:o}}const LEe=300*1e3,OEe=1800*1e3,PEe=8e3,MEe=3e4;function MD(e){return fetch("/api/rating",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}).catch(()=>null)}function IEe({modalOpenRef:e}){const t=m.useCallback(()=>Uc({appModal:e.current,dialogDepth:jn.dialogDepth()}),[e]),[n,a]=m.useState("hidden"),[i,o]=m.useState(null),[r,c]=m.useState(!1),d=m.useRef(n);d.current=n,m.useEffect(()=>{let b=!1;const k=async()=>{if(d.current==="thanks"||d.current==="hidden"&&(document.hidden||t()))return;const w=await fetch("/api/rating").then(j=>j.ok?j.json():null).catch(()=>null);b||!w||a(j=>j==="thanks"?j:w.ask===!0?"asking":"hidden")},y=window.setTimeout(k,LEe),N=window.setInterval(k,OEe);return()=>{b=!0,window.clearTimeout(y),window.clearInterval(N)}},[t]),m.useEffect(()=>{if(n!=="thanks"||r)return;const b=i!==null&&i<=6?MEe:PEe;let k=0;const y=()=>{t()?k=window.setTimeout(y,b):a("hidden")};return k=window.setTimeout(y,b),()=>window.clearTimeout(k)},[n,i,r,t]);const u=m.useCallback(b=>{o(b),c(!1),a("thanks"),MD({score:b})},[]),h=m.useCallback(b=>c(b),[]),g=m.useCallback(()=>{a("hidden"),MD({later:!0})},[]),f=m.useCallback(()=>a("hidden"),[]);return{ratingPhase:n,ratingScore:i,answerRating:u,rateLater:g,closeRating:f,holdThanks:h}}function DEe({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:a}){const[i,o]=m.useState(()=>gre(ht)),r=da(i),[c,d]=m.useState([]),u=m.useCallback(j=>{o(S=>{const A={...S,[j]:null};return r.current=A,A}),Xa(ru[j])},[]),h=m.useCallback((j,S)=>{const A=r.current[j];S&&A!==S||(u(j),t(T=>{const q={...T,[j]:{...T[j],figure:Sa}};return n.current=q,q}),pt(sm[j],Sa))},[u]),g=da(h);m.useEffect(()=>{let j=!0;return Nre().then(S=>{if(!j)return;d(S);const A=new Set(S.map(T=>T.id));for(const T of cu){const q=r.current[T];q&&!A.has(q)&&g.current(T,q)}},()=>{}),()=>{j=!1}},[]);const f=m.useCallback((j,S)=>{if(!c.some(T=>T.id===S))return;const A={...r.current,[j]:S};r.current=A,o(A),pt(ru[j],S),a(j,!0)},[c,a]),b=m.useCallback(async j=>{var q;const S=MN(c.length);if(S)throw new kn(S);const A=window.AudioContext??window.webkitAudioContext;if(!A)throw new kn(x("settings.sounds.custom.decodeFail"));const T=new A;try{const _=await wre(j,z=>T.decodeAudioData(z));await Rq(_);const I=zu(_);d(z=>[...z.filter(F=>F.id!==I.id),I])}finally{(q=T.close)==null||q.call(T)}},[c.length]),k=m.useCallback(async j=>{const S=MN(c.length);if(S)throw new kn(S);const A=yre(j);await Rq(A);const T=zu(A);d(q=>[...q.filter(_=>_.id!==T.id),T])},[c.length]),y=m.useCallback(async(j,S)=>{const A=c.find(q=>q.id===j),T=S.trim().slice(0,80);!A||!T||T===A.name||(await Are(j,T),d(q=>q.map(_=>_.id===j?{..._,name:T}:_)))},[c]),N=m.useCallback(async j=>{await Tre(j),d(q=>q.filter(_=>_.id!==j));const S=r.current,A=mre(S,j);r.current=A,o(A);const T=cu.filter(q=>S[q]===j);for(const q of T)Xa(ru[q]),pt(sm[q],Sa);T.length>0&&t(q=>{const _={...q};for(const I of T)_[I]={..._[I],figure:Sa};return n.current=_,_})},[]),w=m.useCallback(j=>{var T,q;const S=cu.find(_=>r.current[_]===j),A=S?n.current[S].level:Ur;(T=e.current)==null||T.unlock(),(q=e.current)==null||q.previewCustom(j,A)},[]);return{customSelections:i,customSelectionsRef:r,customAssets:c,clearCustomOnly:u,fallbackCustomRef:g,selectCustomTone:f,importNotificationAudio:b,createNotificationVoice:k,renameCustomAsset:y,deleteCustomAsset:N,previewCustomAsset:w}}function FEe(e){const[t,n]=m.useState(()=>Fre(ht)),a=da(t),i=m.useRef(null),o=m.useCallback((c,d=!1)=>{var u,h;if((u=e.current)==null||u.unlock(),i.current!==null&&clearTimeout(i.current),i.current=null,!d){(h=e.current)==null||h.play(c,!0);return}i.current=setTimeout(()=>{var g;i.current=null,(g=e.current)==null||g.play(c,!0)},Ore)},[]),r=m.useCallback((c,d)=>{n(u=>{const h={level:nf(d.level??u[c].level),figure:EB(c,d.figure??u[c].figure)};return pt(zB[c],String(h.level)),pt(sm[c],h.figure),{...u,[c]:h}}),o(c,!0)},[o]);return m.useEffect(()=>()=>{i.current!==null&&clearTimeout(i.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:a,previewTone:o,changeTone:r}}const UEe=15e3;function BEe(e){return e.visibilityState==="visible"&&e.hasFocus()}function HEe(e,t){return t||e===!0}function WEe(){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 GEe(){m.useEffect(()=>{const e=WEe();let t=null;const n=r=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:e,looking:r}),keepalive:!0}).catch(()=>{})},a=()=>{const r=BEe(document);HEe(t,r)&&n(r),t=r},i=()=>{t&&n(!1),t=!1};a();const o=window.setInterval(a,UEe);return window.addEventListener("focus",a),window.addEventListener("blur",a),document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",i),()=>{window.clearInterval(o),window.removeEventListener("focus",a),window.removeEventListener("blur",a),document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",i),i()}},[])}function $Ee({loadAutoRestartPrefs:e,loadNotifyPrefs:t,loadReportsPrefs:n}){m.useEffect(()=>{let a=!0;return fetch("/api/prefs").then(i=>i.ok?i.json():null).then(i=>{!a||!(i!=null&&i.ok)||(e(i),t(i),n(i))}).catch(()=>{}),()=>{a=!1}},[])}const XS="agent-dag.versionNoticeDismissed",VEe=15*6e4;function KEe(e){const[t,n]=m.useState(null),[a,i]=m.useState(()=>ht(XS)??""),o=m.useRef(0),[r,c]=m.useState(!1),d=m.useCallback((y=!1)=>(y&&(o.current=Date.now(),c(!0)),fetch(y?"/api/version?refresh=1":"/api/version").then(N=>N.ok?N.json():null).then(N=>(N&&n(N),N??null)).catch(()=>null).finally(()=>{y&&c(!1)})),[]),u=m.useCallback(()=>{d(Date.now()-o.current>=VEe)},[d]);m.useEffect(()=>{d();const y=window.setInterval(u,5*6e4),N=()=>{document.visibilityState==="visible"&&u()};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(y),document.removeEventListener("visibilitychange",N)}},[d,u]),m.useEffect(()=>{e&&d()},[e,d]);const h=(t==null?void 0:t.notice)??null,g=BW(h),f=ANe(h,a),b=m.useCallback(()=>{i(""),pt(XS,"")},[]),k=m.useCallback(()=>{h&&(i(g),pt(XS,g))},[h,g]);return{version:t,notice:h,noticeOpen:f,showNotice:b,dismissNotice:k,versionChecking:r,loadVersion:d}}function JEe({version:e,readyAppUpdate:t}){const[n,a]=m.useState(!1),i=m.useRef(null),[o,r]=m.useState(null),c=o&&t?t.version:null,d=m.useRef(null);m.useEffect(()=>{!c||d.current===c||(d.current=c,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:c})}).catch(()=>{}))},[c]);const u=m.useRef(!1);m.useEffect(()=>{if(u.current)return;const N=Js(),w=KAe(N),j=eTe({stored:w,running:(e==null?void 0:e.running)??null,notes:oD,remembers:JAe(N)});if(j.reason==="no-version")return;u.current=!0,j.record&&YAe(N,j.record);let S=!0;return(async()=>{var I;let T=ZAe(N);if(zo())try{const z=await fetch("/api/prefs");if(!z.ok)throw new Error("desktop tour preferences unavailable");const F=await z.json();if(!(F!=null&&F.ok))throw new Error("desktop tour preferences unavailable");const U=((I=F.prefs)==null?void 0:I.tourSeen)===!0;T&&!U&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),T=T||U}catch{T=!0}if(!S)return;const q=QAe({tourSeen:T,decision:j}),_=j.show.length?{entries:j.show,since:w,firstRun:!1}:null;q.tour&&a(!0),q.notes==="now"?r(_):q.notes==="after"&&(i.current=_)})(),()=>{S=!1}},[e==null?void 0:e.running]);const h=(e==null?void 0:e.running)??"3.81.1",g=m.useMemo(()=>n5(oD,null,h),[h]),f=m.useCallback(()=>{r({entries:g,since:null,firstRun:!1})},[g]),b=m.useCallback(()=>a(!0),[]),k=m.useCallback(()=>r(null),[]),y=m.useCallback(()=>{a(!1),XAe(Js()),zo()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const N=i.current;i.current=null,N&&r(N)},[]);return{tourOpen:n,openTour:b,closeTour:y,releaseNotes:o,closeReleaseNotes:k,chipVersion:h,openReleaseNotes:f}}function YEe(){const[e,t]=m.useState(void 0),[n,a]=m.useState(!1),i=m.useRef(!1);return i.current=e===!0&&!n,m.useEffect(()=>uRe(()=>i.current),[]),{loadReportsPrefs:m.useCallback(r=>{var c;t(((c=r.prefs)==null?void 0:c.reports)!==!1),a(r.reportsVetoed===!0)},[])}}function ZEe(e){const[t,n]=m.useState(null);m.useEffect(()=>{const c=ht("agent-dag.sound");n(c===null?!0:c==="on")},[]);const a=m.useCallback(()=>{n(c=>{var u,h;const d=c!==!0;return pt("agent-dag.sound",d?"on":"off"),d?(u=e.current)==null||u.unlock():(h=e.current)==null||h.silence(),d})},[]),i=m.useCallback(c=>{a()},[a]),o=da(i),r=da(t);return{soundOn:t,toggleSound:a,activateSoundRef:o,soundOnRef:r}}function XEe(){const[e,t]=m.useState(Qoe),n=m.useCallback((o,r)=>{t(c=>ere(c,o,r))},[]),a=m.useCallback(()=>t(o=>({...o,open:!1})),[]),i=m.useCallback(o=>t(r=>({...r,section:o})),[]);return{settingsOpen:e.open,settingsSection:e.section,settingsLandOn:e.landOn,openSettings:n,closeSettings:a,showSection:i}}const QEe="agent-dag.autoFitDisabled";function e1e(e){const t=m.useRef(!1),[n,a]=m.useState(!1);m.useEffect(()=>{Xa(QEe)},[]);const i=m.useCallback(()=>{t.current||(t.current=!0,a(!0))},[]),o=m.useCallback(()=>{t.current=!1,a(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:i,enableAutoFitAndRefit:o}}function t1e(){return s.jsx(sA,{children:s.jsx(gRe,{children:s.jsx(n1e,{})})})}function n1e(){var cc;const e=se(),t=Cl(),n=m.useState(iA)[0],a=m.useRef(n),[,i]=m.useState(0),o=m.useCallback(()=>i(xt=>xt+1),[]),{sessionListOpen:r,accountsPanelOpen:c,panel:d,toggleSessionList:u,toggleAccountsPanel:h,openAccountsPanel:g,closeSessionList:f,closeSessionListToCanvas:b,closeAccountsPanel:k}=fEe(),{detailOpen:y,setDetailOpen:N,usagePanelOpen:w,setUsagePanelOpen:j,machinePanelOpen:S,setMachinePanelOpen:A}=CEe(LD(d)),{selectedIds:T,primarySelectedId:q,selectAgent:_,clearSelection:I,pruneSelectionToBoard:z}=Rve(a,N),F=Vc(c,200),U=Vc(r,200),P=QE(r,U),L=Vc(w,130),R=Vc(S,130),O=m.useRef(null),D=ZEe(O),{activateSoundRef:$,soundOnRef:B}=D,G=FEe(O),{setTonePrefs:Z,tonePrefsRef:W,previewTone:H}=G,X=DEe({chimesRef:O,setTonePrefs:Z,tonePrefsRef:W,previewTone:H}),{customSelectionsRef:V,fallbackCustomRef:Q}=X,Y=XEe(),{openSettings:K}=Y;tEe({chimesRef:O,soundOnRef:B,tonePrefsRef:W,customSelectionsRef:V,fallbackCustomRef:Q});const ee=bRe(a),{pauseGate:te,paused:ce,togglePause:ge}=ee,ve=m.useRef(()=>{}),{live:pe,tabCapped:ae,everConnected:le,liveSince:Se}=kve({stateRef:a,rerender:o,pauseGate:te,chimesRef:O,desktopUpdateRef:ve}),ke=KEe(pe),{version:ye,notice:We,noticeOpen:He,loadVersion:Ke}=ke,Re=aEe(pe),{readyAppUpdate:Je,onDesktopUpdateEvent:Pe}=Re;ve.current=Pe,GEe();const Ae=JEe({version:ye,readyAppUpdate:Je}),{tourOpen:xe,openTour:ze,releaseNotes:Ce}=Ae,{workspace:Me,providers:Ee,providersRef:Be}=xRe(pe),tt=wRe(Ee,c),ie=tt.shown,je=xt=>{tt.remember(xt),(!c||ie===xt)&&h()},Fe=LD(d==="accounts"&&!(Ee.claude||Ee.codex)?null:d),Ge=hEe(Fe),Te=QE(c,F)&&(Ee.claude||Ee.codex),[nt,fe]=m.useState(!1),Ve=tt.remember,gt=m.useCallback(()=>{Ve(Ee.claude?"claude":"codex"),g()},[g,Ee.claude,Ve]),mt=m.useCallback(()=>{g(),fe(!0)},[g]),[ft,Xt]=m.useState(null),[Pn,Ta]=m.useState([]),ga=m.useMemo(()=>[...ft??[],...Pn],[ft,Pn]);m.useEffect(()=>{c||fe(!1)},[c]);const Hn=m.useCallback(()=>fe(!1),[]),Ra=zEe(ye),Mt=FRe({version:ye,loadVersion:Ke}),{upgradeFailure:Wn}=Mt,Jt=qEe({stateRef:a,tourOpen:xe,releaseNotes:Ce}),$e=IEe({modalOpenRef:Jt.modalOpenRef}),{openTool:Qe,setSummaryFor:lt,setContextFor:kt,openContext:zt,setKeyHelpOpen:Gt,setUsageHistoryOpen:Bt,setBrowserWatchOpen:ma,keyHelpOpenRef:pn,modalOpenRef:Qt}=Jt,Ea=YEe(),qa=BRe(),{watchOn:en,watchUnseen:tn}=qa,rn=hh(),[Mn,Rn]=m.useState(null),[ss,Et]=m.useState(!1),_a=m.useCallback(()=>Et(!1),[]),za=xt=>{iNe(xt),K("integrations")},is=xt=>{xt&&KI(xt),K("integrations")},La=m.useCallback(()=>Rn(null),[]),Gn=QT().filter(xt=>Tj(rn,xt.kind)),qs=da(xt=>{const $i=Gn.find(Vi=>Vi.kind===xt);$i&&Rn($i.kind)}),fa=m.useCallback(xt=>{KI(xt),K("integrations")},[K]),nn=Gn.length>0;m.useEffect(()=>{nn&&WSe()},[nn]);const $n=iEe(),[an,Io]=m.useState(0),{presentCats:_s,hiddenCats:os,toggleCat:yn,catBarRef:rs,catBarOccluded:cn}=QRe(a),ba=m.useRef(null),[oi,de]=m.useState(0),Ne=Eve({stateRef:a,rerender:o,pruneSelectionToBoard:z,setContextFor:kt,setSummaryFor:lt});fne({stateRef:a,now:Ne,enabled:Ee.claude});const Ue=jRe(Ee.claude||Ee.codex),ue=MRe(Ue,Ne),Ie=rEe({enabled:Ee.claude,lanStatus:$n.lanStatus,now:Ne}),st=sEe({now:Ne,stateRef:a,version:ye,notice:We,noticeOpen:He,upgradeFailure:Wn,paused:ee.paused}),{askRestart:bt,loadAutoRestartPrefs:ut}=st,En=XRe(),{setTheme:cs,palette:Yr}=En,Do=nEe(),zs=Exe(),{applyViewport:gh,moveCamera:Il,fitLeft:ri,cameraEpochRef:Ls,lastFitTimeRef:ls}=zs,Vn=Wxe(zs),{pinnedRef:Os,positionsRef:Ps,lastLayoutSigRef:Ms,handleRelayout:mh,rearrangeUndo:fh}=Vn,Fi=m.useRef(null),bh=m.useRef(()=>{}),Dl=Se!==null,Fo=m.useRef(0),Fl=m.useCallback(()=>{Fo.current=Date.now()},[]),{canvasRef:Is,canvasSize:Uo,paneSizeRef:Bo}=qCe(Ge),ci=e1e(ri),{autoFitDisabledRef:Ho,disableAutoFit:Ul}=ci,Bl=m.useRef(!1),{measuredRef:ds,measuredVersionRef:Zr,sizeVersion:Hl,domSizeVersion:vh}=_Ce(Bl,a),{removedNodes:Oa,removedAgentIds:Ds,removeNode:Xr,removeSelectedNode:Wl,removalNotice:Wo,hideSessions:Qr,bringBack:ec,bringBackAll:Kn,forgetRemovals:Ui}=dCe({stateRef:a,pinnedRef:Os,positionsRef:Ps,returningRef:Vn.returningRef,canvasRef:Is,clearSelection:I,primarySelectedId:q});wCe({stateRef:a,removedNodes:Oa,hideSessions:Qr,ready:Dl,keepSessionId:q?((cc=a.current.agents.get(q))==null?void 0:cc.sessionId)??q:null});const Go=iCe({stateRef:a,now:Ne,removedAgentIds:Ds,sizeVersion:Hl,domSizeVersion:vh});Gxe(Go,Vn),lCe({layoutSig:Go,rf:t,stateRef:a,measuredRef:ds,pinnedRef:Os,positionsRef:Ps,paneSizeRef:Bo,lastInteractRef:Fo,autoFitDisabledRef:Ho,lastFitTimeRef:ls,fitLeft:ri});const Bi=zCe(),{bubbling:Hf,endBubble:Gl,onBubble:$l}=sve(),[li,tc]=m.useState(!1),Vl=nve(),{beginTrashDrag:Wf,trackTrashDrag:Gf,endTrashDrag:$f}=Vl,nc=uve({stateRef:a,measuredRef:ds,measuredVersionRef:Zr,canvasRef:Is}),{lodRef:Vf,applyZoom:Kf}=nc,kh=TCe({applyViewport:gh,lastFitTimeRef:ls,cameraEpochRef:Ls,disableAutoFit:Ul,markInteract:Fl,canvasRef:Is,applyZoom:Kf}),$o=q?a.current.agents.get(q):null,Kl=y&&$o!=null,Fs=MCe({sessionListShown:P,usageShown:ko(L),machineShown:ko(R),accountsShown:Te&&Ee.claude,codexShown:Te&&!Ee.claude,detailShown:Kl,primarySelectedId:q,canvasRef:Is}),{railInsetRef:ac,availableWidth:wh,availableHeight:yh}=Nxe({canvasRef:Is,canvasSize:Uo,machinePhase:R,usagePhase:L,usagePanelOpen:w,detailShown:Kl}),xh=oCe({stateRef:a,now:Ne,availableWidth:wh,availableHeight:yh,layout:Vn,measuredRef:ds,onBubble:$l,settled:Bi,dragging:li,layoutSig:Go,selectedIds:T,openContext:zt,historyReplayed:Dl,removedNodes:Oa,removedAgentIds:Ds,dragTick:an,dragPatchRef:ba,dragMoveTick:oi}),{nodes:Vo,edges:Jf}=xh,Jl=da(q);$xe({nodes:Vo,edges:Jf,settled:Bi,dragging:li,availableWidth:wh,availableHeight:yh,layout:Vn,camera:zs,rf:t,measuredRef:ds,stateRef:a,lastFocusRef:Fi,primarySelectedIdRef:Jl,focusAgentRef:bh,autoFitDisabledRef:Ho});const Ch=_Ee({stateRef:a,pinnedRef:Os,measuredRef:ds,positionsRef:Ps,lastLayoutSigRef:Ms,forgetRemovals:Ui,clearSelection:I,rerender:o,modalOpenRef:Qt}),{requestClear:sc}=Ch,Yf=ICe({nodes:Vo,stateRef:a,pinnedRef:Os,positionsRef:Ps,draggingRef:Bl,dragPatchRef:ba,setDragging:tc,setDragMoveTick:de,setDragTick:Io,endBubble:Gl,markInteract:Fl,disableAutoFit:Ul,beginTrashDrag:Wf,trackTrashDrag:Gf,endTrashDrag:$f,removeNode:Xr}),Sh=m.useCallback(()=>ri(500),[ri]),Yl=da(Vo),{focusAgent:ic,stepAgent:Zf,focusSession:Hi}=_xe({canvasRef:Is,stateRef:a,measuredRef:ds,nodesRef:Yl,railInsetRef:ac,moveCamera:Il,disableAutoFit:Ul,lastFocusRef:Fi,focusAgentRef:bh,selectAgent:_,primarySelectedIdRef:Jl}),Xf=RCe({clearSelection:I,selectAgent:_,detailOpen:y,setDetailOpen:N,detailShown:Kl,focusAgent:ic,draggingRef:Bl,lodRef:Vf}),Zl=zxe({nodesRef:Yl,stateRef:a,canvasRef:Is,railInsetRef:ac}),Ko=da(Wl),Xl=m.useRef(null),Jo=m.useCallback(xt=>{Ds.has(xt)&&ec([xt]),Hi(xt)},[Ds,ec,Hi]),Nh=LCe(),[jh,oc]=m.useState(!1),Ql=m.useCallback(()=>oc(!0),[]),Wi=m.useCallback(()=>oc(!1),[]),Qf=m.useCallback(xt=>{oc(!1),xt.run()},[]),eb=On();OCe({pointerFocusRef:Nh,nodesRef:Yl,stateRef:a,primarySelectedIdRef:Jl,providersRef:Be,soundOnRef:B,keyHelpOpenRef:pn,modalOpenRef:Qt,waitingCursorRef:Xl,removeSelectedRef:Ko,activateSoundRef:$,clearSelection:I,selectAgent:_,focusAgent:ic,stepAgent:Zf,focusSession:Hi,requestClear:sc,handleRelayout:mh,undoRearrange:fh.undo,handleFit:Sh,togglePause:ge,toggleSessionList:u,toggleAccountsPanel:h,setDetailOpen:N,setUsageHistoryOpen:Bt,setUsagePanelOpen:j,setMachinePanelOpen:A,setBrowserWatchOpen:ma,setKeyHelpOpen:Gt,setTheme:cs,openSettings:K,openIntegrationRef:qs,openQuickOpen:Ql});const ed=a.current.agents.size,di=m.useMemo(()=>kN(a.current.agents.values()),[a.current,a.current.revision]);uCe({stateRef:a,waitingSessions:di,removedAgentIds:Ds,removedNodes:Oa,bringBack:ec}),NCe({stateRef:a,waitingSessions:di,live:pe});const td=AEe({waitingSessions:di,watchUnseen:tn,incidents:ue}),ui=REe({waitingSessions:di,liveSince:Se,focusSession:Hi}),{loadNotifyPrefs:Yo}=ui;$Ee({loadAutoRestartPrefs:ut,loadNotifyPrefs:Yo,loadReportsPrefs:Ea.loadReportsPrefs});const hi=_l(ef),[rc,Ah]=m.useState(!1),[nd,Zo]=m.useState(null),ad=m.useCallback(()=>Zo(null),[]),Th=m.useCallback(xt=>{const $i=a.current.agents.get(xt);return $i?$i.label||$i.cwdBasename||"session":null},[]),Rh=m.useCallback(xt=>{Zo(null),Jo(xt)},[Jo]),Eh=m.useCallback(()=>Ah(!1),[]),[qh,_h]=m.useState(null),tb=m.useCallback(()=>_h(null),[]),xn=sSe({providers:Ee,sessionListOpen:r,toggleSessionList:u,accountsPanelOpen:c,toggleAccountsPanel:h,accountsPanelId:m5(ie),codexPanelOpen:c&&ie==="codex",toggleCodexPanel:()=>je("codex"),usagePanelOpen:w,setUsagePanelOpen:j,machinePanelOpen:S,setMachinePanelOpen:A,setUsageHistoryOpen:Bt,watchOn:en,watchUnseen:tn,setBrowserWatchOpen:ma,setTrafficRadarOpen:Jt.setTrafficRadarOpen,openSettings:K,onFeedback:Jt.openFeedback,setRadioOpen:Ah,openToolActivity:Zo,openCapacity:_h,toggles:Fs.toggles,integrations:Gn.map(xt=>({provider:xt,onPress:()=>Rn(xt.kind)})),openExploreIntegrations:()=>Et(!0),openQuickOpen:Ql}),[nb,va]=m.useState(0),Gi=m.useCallback(xt=>{Jo(xt),hi&&b()},[Jo,hi,b]),zh=m.useCallback(()=>{r||u(),requestAnimationFrame(()=>{var xt;return(xt=document.querySelector("#session-list .sl-row"))==null?void 0:xt.focus()})},[r,u]),sd=()=>{(Ee.claude?Fs.accounts:Fs.codex)(),k()},id=tt.both?s.jsx(gbe,{shown:ie,notices:tt.notices,onPick:tt.pick}):void 0,od=xt=>tt.bothMounted?xt===ie?"shown":"hidden":void 0;return s.jsxs("div",{className:"app",children:[s.jsx("a",{className:"skip-link",href:"#canvas",children:e("shell.skipToCanvas")}),s.jsxs("header",{className:"topbar",children:[s.jsx(Die,{}),s.jsx(DNe,{versionCheck:ke,welcome:Ae,desktopUpdate:Re,pause:ee,announcements:td,notify:ui,waitingSessions:di,waitingCursorRef:Xl,focusSession:Hi,live:pe,now:Ne,incidents:ue,queueNamed:hi?0:nb}),!hi&&s.jsx(ONe,{waitingSessions:di,waitingCursorRef:Xl,focusSession:Hi,now:Ne,onFit:va,onMore:zh}),$o&&s.jsx(FNe,{selected:$o,now:Ne,selectedIds:T,focusAgent:ic,clearSelection:I}),!hi&&s.jsx("div",{className:"actions",children:s.jsx(Joe,{items:[xn.search,...xn.utilities]})})]}),hi?s.jsx(Koe,{items:[...xn.left,...xn.right[0],xn.utilities[0]],more:[xn.search,...xn.capacity,...xn.right.slice(1).flat(),...xn.integrations,...xn.explore,xn.utilities[1]]}):s.jsx(xq,{side:"left",label:e("shell.rail.left"),groups:[...xn.leftStripe,xn.integrations,xn.explore]}),s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Wo?e("shell.board.removed",{label:Wo.label}):""}),s.jsx(dje,{restart:st,versionCheck:ke,upgrade:Mt,oldNameNotice:Ra,rating:$e,onFeedback:Jt.openFeedback,everConnected:le,live:pe,paused:ce}),(P||Te)&&s.jsxs(Jbe,{width:Fe,children:[Te&&(ie==="claude"||tt.bothMounted)&&s.jsx(hbe,{leaving:Iv(c,F),onReport:Jt.openFeedback,onRoster:Ie.observe,onClose:sd,lanWanted:nt,onLanShown:Hn,onLanAccounts:Xt,codexLanAccounts:Pn,switcher:id,side:od("claude"),onNotice:tt.noteClaude}),Te&&(ie==="codex"||tt.bothMounted)&&s.jsx(Kbe,{leaving:Iv(c,F),onClose:sd,switcher:id,side:od("codex"),onNotice:tt.noteCodex,lanAccounts:ga,lanReady:!Ee.claude||ft!=null,lanWanted:nt,onLanShown:Hn,onLanAccounts:Ta}),P&&s.jsx(Gie,{leaving:Iv(r,U),state:a.current,now:Ne,selectedIds:T,onSelect:Gi,onClose:()=>{Fs.sessionList(),f()},removedIds:Ds,onBringBackAll:Kn})]}),s.jsxs(GNe,{canvasRef:Is,bubbling:Hf,dragging:li,trash:Vl,zoom:nc,viewport:kh,stateRef:a,peek:Zl,children:[ed===0&&(!pe&&ae?s.jsx(FCe,{reservedRight:ac.current}):s.jsx(UCe,{live:pe,everConnected:le,providers:Ee,workspace:Me,onTour:ze,reservedRight:ac.current})),(_s.length>1||os.size>0)&&s.jsx(UNe,{catBarRef:rs,catBarOccluded:cn,presentCats:_s,hiddenCats:os,toggleCat:yn}),s.jsx(Iie,{graph:xh,layout:Vn,viewport:kh,clicks:Xf,drag:Yf,appearance:En,fm:Do,radioOpen:rc,onRadioClose:Eh,autoFit:ci,pause:ee,stateRef:a,measuredRef:ds,hiddenCats:os,now:Ne,openTool:Qe,focusAgent:ic,requestClear:sc,setKeyHelpOpen:Gt})]}),!hi&&s.jsx(xq,{side:"right",label:e("shell.rail.right"),groups:xn.right}),nd&&s.jsx(vle,{view:nd,onClose:ad,sessionLabel:Th,onOpenSession:Rh}),qh&&s.jsx(Rbe,{view:qh,onClose:tb}),Mn&&s.jsx(VSe,{kind:Mn,connections:Ai(rn,Mn)?km(rn,Mn):[],onClose:La,onReconnect:fa}),ss&&s.jsx(uNe,{integrations:rn,onClose:_a,onOpen:Rn,onConnect:za,onManage:is}),jh&&s.jsx(Aoe,{onClose:Wi,onRun:Qf,items:rce({rails:xn,sessions:rB(a.current),now:Ne,openSession:Gi,settings:IB(Ee.claude,t0(rn),ph(rn)),openSettings:K,singleKeys:eb,fit:Sh,rearrange:mh,paused:ce,togglePause:ge,clear:ed>0?()=>sc("button"):void 0,keyHelp:()=>Gt(!0),tour:ze,theme:En.theme,setTheme:cs})}),ko(L)&&s.jsx(Zde,{state:a.current,now:Ne,providers:Ee,incidents:ue,liveSince:Se,leaving:L==="leaving",onClose:()=>{Fs.usage(),j(!1)}}),ko(R)&&s.jsx(Lue,{usageOpen:w,leaving:R==="leaving",onClose:()=>{Fs.machine(),A(!1)}}),y&&$o?s.jsx(tSe,{selected:$o,now:Ne,openTool:Qe,setSummaryFor:lt,stateRef:a,removeSelectedNode:Wl,onClose:()=>{Fs.detail(),N(!1)}}):null,s.jsx(K0e,{dialogs:Jt,welcome:Ae,desktopUpdate:Re,versionCheck:ke,restart:st,upgrade:Mt,lanPairs:$n,attention:Ie,clearFlow:Ch,watchBadge:qa,announcements:td,appearance:En,providers:Ee,stateRef:a,agentCount:ed,menus:Y,sound:D,tones:G,customTones:X,notify:ui,panelDoors:{accounts:gt,localNetwork:mt}})]})}function ID(){try{fetch("/api/ui-language",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:Le()})}).catch(()=>null)}catch{}}function a1e(){ID();try{return E2(ID)}catch{return()=>{}}}try{Q8(window.localStorage)}catch{}T2();a1e();const s1e=AG.createRoot(document.getElementById("root"));window.ccdeckWindow&&(document.documentElement.dataset.desktopChrome="true",document.documentElement.dataset.desktopPlatform=window.ccdeckWindow.platform);s1e.render(s.jsx(t1e,{}));export{h1e as $,Wr as A,oU as B,Tt as C,Rt as D,xl as E,An as F,w1e as G,phe as H,Za as I,k1e as J,g1e as K,p1e as L,_t as M,au as N,y1e as O,h3 as P,Nt as Q,c3 as R,$N as S,Wg as T,Bq as U,VN as V,d1e as W,Dt as X,So as Y,Vs as Z,u1e as _,Xa as a,Fu as a0,ta as a1,vre as a2,Ka as a3,CAe as a4,Ej as a5,kn as a6,Vm as a7,g3 as a8,we as a9,Fr as aa,jo as ab,Ase as ac,x1e as ad,OA as ae,kl as af,cae as ag,l1e as ah,r1e as ai,c1e as aj,Jm as ak,Wee as al,BTe as am,HRe as an,o1e as ao,Tse as ap,m as b,_l as c,b1e as d,Le as e,zW as f,AA as g,YSe as h,ua as i,s as j,v1e as k,JSe as l,jn as m,pr as n,Pi as o,Sl as p,f1e as q,ht as r,Qn as s,x as t,se as u,Aa as v,pt as w,Rs as x,m1e as y,yf as z};
|
|
358
|
+
`)}}function MRe(e,t){return!(e!=null&&e.ok)||e.disabled||!Array.isArray(e.providers)?[]:e.providers.map(n=>PRe(n,t)).filter(n=>n!==null)}function IRe(e){return e.map(t=>x(t.state.endsWith("outage")?"shell.incident.sentenceA":"shell.incident.sentence",{name:t.name,words:t.words})).join(" ")}const DRe=()=>x("shell.incident.clear");function FRe({version:e,loadVersion:t}){var u;const[n,a]=m.useState(!1),i=((u=e==null?void 0:e.upgrade)==null?void 0:u.state)??"idle",o=aje(e==null?void 0:e.upgrade),r=m.useRef(!1),c=m.useCallback(async()=>{if(Qn(r.current||i==="running")){r.current=!0;try{await fetch("/api/upgrade",{method:"POST"})}catch{}await t(),r.current=!1}},[i,t]);m.useEffect(()=>{if(i!=="running")return;const h=window.setInterval(t,3e3);return()=>window.clearInterval(h)},[i,t]);const d=m.useCallback(async()=>{const h=e==null?void 0:e.command;!h||!await Rs(h)||(a(!0),window.setTimeout(()=>a(!1),1600))},[e==null?void 0:e.command]);return{upgradeState:i,upgradeFailure:o,startUpgrade:c,copyCommand:d,cmdCopied:n}}const RD="agent-dag.browserWatch.seenMs";function URe(e,t){return e.filter(n=>n.startMs>t)}function BRe(){const[e,t]=m.useState(()=>Number(ht(RD))||0),[n,a]=m.useState([]),[i,o]=m.useState(!1);m.useEffect(()=>{let d=!0;const u=()=>{fetch("/api/browser-watch?live=0").then(g=>g.ok?g.json():null).then(g=>{var f;!d||!(g!=null&&g.ok)||(a(g.episodes??[]),o(((f=g.settings)==null?void 0:f.enabled)===!0))}).catch(()=>{})};u();const h=setInterval(u,5*6e4);return()=>{d=!1,clearInterval(h)}},[]);const r=m.useMemo(()=>URe(n,e).length,[n,e]),c=m.useCallback(d=>{t(d),pt(RD,String(d))},[]);return{watchOn:i,setWatchOn:o,watchUnseen:r,markWatchSeen:c}}const b5="agent-dag.character-enabled",v5="agent-dag.fm-volume",HRe=1,ED="agent-dag.fm-source",x1e=[{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 WRe(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 GRe(e){return e!=="0"}function $Re(){return GRe(ht(b5))}function VRe(e){return _B(e,HRe)}function KRe(){return VRe(ht(v5))}const k5=["--err","--inflight","--ok","--warn","--muted","--grid-line","--minimap-mask","--panel","--line","--accent","--text-dim","--bg"];function qD(e){const t={};for(const n of k5)t[n]=e(n);return t}function JRe(e){return t=>e[t]??""}function YRe(e,t){return k5.every(n=>e[n]===t[n])}function ZRe(e,t){let n=null,a=0;function i(){a++,n==null||n.skipTransition(),n=null,delete e.documentElement.dataset.themeTransition}return{cancel:i,run(o){i();const r=a;let c=!1;const d=()=>{r!==a||c||(c=!0,o())};if(!e.startViewTransition||e.hidden||t()){d();return}e.documentElement.dataset.themeTransition="true";try{const u=e.startViewTransition(d);n=u,u.ready.catch(()=>{}),u.updateCallbackDone.catch(()=>{d()}),u.finished.then(()=>{n===u&&(n=null,delete e.documentElement.dataset.themeTransition)},()=>{n===u&&(d(),n=null,delete e.documentElement.dataset.themeTransition)})}catch{delete e.documentElement.dataset.themeTransition,d()}}}}function _D(e){return typeof window>"u"?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()||""}function XRe(){const[e,t]=m.useState(Ace),[n,a]=m.useState(Tce),[i,o]=m.useState($re),r=m.useRef(i),[c]=m.useState(()=>ZRe(document,()=>{try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!0}})),d=m.useCallback(w=>{const j=typeof w=="function"?w(r.current):w;j!==r.current&&(r.current=j,c.run(()=>_t.flushSync(()=>o(j))))},[c]);m.useEffect(()=>()=>c.cancel(),[c]);const[u,h]=m.useState($Re),[g,f]=m.useState(cre),[b,k]=m.useState(()=>qD(_D)),y=m.useMemo(()=>JRe(b),[b]),N=m.useCallback(w=>tCe(w,y),[y]);return m.useEffect(()=>{document.documentElement.dataset.textSize=e,pt(UN,e)},[e]),m.useEffect(()=>{document.documentElement.dataset.density=n,pt(BN,n)},[n]),m.useEffect(()=>{const w=j=>{j.storageArea===Js()&&((j.key===UN||j.key===null)&&t(XA(j.newValue)),(j.key===BN||j.key===null)&&a(KB(j.newValue)))};return window.addEventListener("storage",w),()=>window.removeEventListener("storage",w)},[]),m.useLayoutEffect(()=>{document.documentElement.dataset.theme=i,document.documentElement.dataset.colorScheme=Xu[i].colorScheme,pt(LB,i),k(w=>{const j=qD(_D);return YRe(w,j)?w:j})},[i]),m.useEffect(()=>{pt(b5,u?"1":"0")},[u]),m.useEffect(()=>{pt(NB,g)},[g]),m.useEffect(()=>{const w=document.querySelector('meta[name="theme-color"]'),j=b["--panel"];w&&j&&w.setAttribute("content",j)},[b]),{textSize:e,setTextSize:t,density:n,setDensity:a,theme:i,setTheme:d,characterEnabled:u,setCharacterEnabled:h,character:g,setCharacter:f,palette:b,minimapNodeFill:N}}function QRe(e){const t=m.useRef(null),[n,a]=m.useState(!1),[i,o]=m.useState(()=>new Set),r=m.useMemo(()=>{const d=new Set;for(const u of e.current.agents.values())for(const h of u.tools)d.add(CW(h.name));return Object.keys(xW).filter(u=>d.has(u))},[e.current,e.current.revision]);m.useEffect(()=>{if(r.length<=1){a(!1);return}let d=0;const u=()=>{const h=t.current;if(h&&!document.hidden){const g=h.getBoundingClientRect(),f=Array.from(document.querySelectorAll(".react-flow__node, .tool-burst")).map(k=>k.getBoundingClientRect()),b=Hie(g,f,8);a(k=>k===b?k:b)}d=window.setTimeout(u,300)};return u(),()=>window.clearTimeout(d)},[r.length]);const c=m.useCallback(d=>{o(u=>{const h=new Set(u);return h.has(d)?h.delete(d):h.add(d),h})},[]);return{presentCats:r,hiddenCats:i,toggleCat:c,catBarRef:t,catBarOccluded:n}}function eEe(e={enabled:()=>!0}){const t=e.ctor??(typeof window<"u"?window.AudioContext??window.webkitAudioContext??null:null);let n=null;const a=new Set,i=()=>e.enabled()?(n==null?void 0:n.state)==="running"?"ready":"locked":"off",o=()=>{var f;return(f=e.onState)==null?void 0:f.call(e,i())};function r(){var f,b;if(!(!t||(n==null?void 0:n.state)==="running"))try{n||(n=new t,(f=n.addEventListener)==null||f.call(n,"statechange",o)),(b=n.resume)==null||b.call(n).then(o,()=>{}),o()}catch{}}function c(f,b,k=b.figure){if(!n||n.state!=="running")return!1;const y=IN(f,k),N=qre(b.level,y),w=n.currentTime;for(const j of y.notes){const S=n.createOscillator(),A=n.createGain();S.type=y.type??"sine",S.frequency.value=j.hz;const T=w+j.at,q=T+j.ms/1e3;A.gain.setValueAtTime(qq,T),A.gain.exponentialRampToValueAtTime(N,T+_re),A.gain.exponentialRampToValueAtTime(qq,q),S.connect(A).connect(n.destination),S.start(T),S.stop(q+.02)}return!0}async function d(f,b){var N;if(!e.loadCustom)return"unavailable";let k;try{k=await e.loadCustom(f)}catch{return"unavailable"}if(!k)return"missing";if(k.kind==="tts"){if(typeof window>"u"||!("speechSynthesis"in window)||typeof SpeechSynthesisUtterance>"u")return"unavailable";const w=new SpeechSynthesisUtterance(k.text),j=window.speechSynthesis.getVoices();w.voice=j.find(S=>S.voiceURI===k.voiceURI)??null,w.rate=k.rate,w.pitch=k.pitch,w.volume=zre(b.level);try{return window.speechSynthesis.cancel(),window.speechSynthesis.speak(w),"played"}catch{return"unavailable"}}if(!n||n.state!=="running")return"locked";let y;try{y=await n.decodeAudioData(k.bytes.slice(0))}catch{return"broken"}try{const w=n.createBufferSource(),j=n.createGain();return w.buffer=y,j.gain.setValueAtTime(Lre(k.normalizationGain,b.level),n.currentTime),w.connect(j).connect(n.destination),a.add(w),(N=w.addEventListener)==null||N.call(w,"ended",()=>a.delete(w)),w.start(n.currentTime),"played"}catch{return"unavailable"}}function u(f,b=!1){var N,w;if(!b&&!e.enabled())return!1;const k=Ure((N=e.prefs)==null?void 0:N.call(e),f),y=((w=e.customSelection)==null?void 0:w.call(e)[f])??null;return y&&e.loadCustom?(d(y,k).then(j=>{var S;j==="played"||j==="locked"||((j==="missing"||j==="broken")&&((S=e.onCustomFailure)==null||S.call(e,f,y)),c(f,{...k,figure:Sa},Sa))}),!0):!n||n.state!=="running"?!1:c(f,k)}function h(f,b=Ur){return d(f,{level:nf(b),figure:Sa}),!0}function g(){try{typeof window<"u"&&"speechSynthesis"in window&&window.speechSynthesis.cancel()}catch{}for(const f of a)try{f.stop()}catch{}a.clear()}return{unlock:r,play:u,previewCustom:h,silence:g,state:i,get context(){return n}}}function tEe({chimesRef:e,soundOnRef:t,tonePrefsRef:n,customSelectionsRef:a,fallbackCustomRef:i}){m.useEffect(()=>{const o=eEe({enabled:()=>t.current===!0,prefs:()=>n.current,customSelection:()=>a.current,loadCustom:jre,onCustomFailure:(u,h)=>i.current(u,h)});e.current=o;const r=["pointerdown","pointerup","keydown"],c=()=>{for(const u of r)window.removeEventListener(u,d,{capture:!0})},d=()=>{var u;o.unlock(),((u=o.context)==null?void 0:u.state)==="running"&&c()};for(const u of r)window.addEventListener(u,d,{capture:!0});return c},[])}function nEe(){const[e,t]=m.useState(KRe),[n,a]=m.useState(()=>Yne(ht(F1))),[i,o]=m.useState(()=>Jne(ht(U1))),[r,c]=m.useState(()=>Zne(ht(ED),n,WRe)),[d,u]=m.useState(()=>new Set),[h,g]=m.useState(0);m.useEffect(()=>{pt(v5,String(e))},[e]),m.useEffect(()=>{pt(U1,i?"1":"0")},[i]),m.useEffect(()=>{pt(F1,JSON.stringify(n))},[n]),m.useEffect(()=>{pt(ED,r)},[r]);const f=m.useCallback((w,j=!1)=>{a(S=>{const A=S.find(T=>T.id===w.id);return A?!j||!w.radio||!A.radio||A.url===w.url&&JSON.stringify(A.radio)===JSON.stringify(w.radio)?S:S.map(T=>T.id===w.id?{...T,url:w.url,radio:w.radio}:T):[...S,w]}),u(S=>{if(!S.has(w.id))return S;const A=new Set(S);return A.delete(w.id),A})},[]),b=m.useCallback((w,j)=>{const S=j.trim();!S||S.length>DU||a(A=>A.map(T=>T.id===w?{...T,name:S}:T))},[]),k=m.useCallback(w=>{a(j=>j.filter(S=>S.id!==w)),c(j=>Xne(j,w)),u(j=>{if(!j.has(w))return j;const S=new Set(j);return S.delete(w),S})},[]),y=m.useCallback((w,j=!1)=>{const S=B1(w),A=d.has(S);w===r&&!A&&!j||(A&&u(T=>{const q=new Set(T);return q.delete(S),q}),c(w),g(T=>T+1))},[r,d]),N=m.useCallback((w,j)=>{const S=B1(w);u(A=>{if(A.has(S)===j)return A;const q=new Set(A);return j?q.add(S):q.delete(S),q})},[]);return{fmVolume:e,setFmVolume:t,fmMuted:i,setFmMuted:o,fmSource:r,customFmStations:n,unavailableFmStations:d,fmPlayRequest:h,addFmStation:f,renameFmStation:b,removeFmStation:k,pickFmSource:y,markFmStationAvailability:N}}function aEe(e){const[t,n]=m.useState(null),[a,i]=m.useState(!1),[o,r]=m.useState(null),c=m.useRef(0);m.useEffect(()=>{if(!e||!zo())return;let k=!1;const y=c.current;return fetch("/api/desktop-update").then(N=>N.ok?N.json():null).then(N=>{if(k||c.current!==y)return;const w=JI(N);w&&n(w)}).catch(()=>{}),()=>{k=!0}},[e]);const d=kNe(t),u=m.useRef(!1),h=m.useRef(0),g=m.useRef(0);m.useEffect(()=>()=>window.clearTimeout(h.current),[]);const f=m.useCallback(async k=>{if(!Qn(u.current))return;const y=++g.current;window.clearTimeout(h.current),u.current=!0,i(!0),r(null);const N=w=>{y===g.current&&(window.clearTimeout(h.current),u.current=!1,i(!1),r({failure:w,version:k}))};try{const w=await fetch("/api/desktop-update/restart",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:k})});if(!w.ok)return N(yNe(await w.json().catch(()=>null)))}catch{return N("unreachable")}y===g.current&&(h.current=window.setTimeout(()=>N("timeout"),IW))},[]),b=m.useCallback(k=>{if(zo())try{const y=JI(JSON.parse(k));y&&(c.current++,n(y),y.status!=="ready"&&(g.current++,window.clearTimeout(h.current),u.current=!1,i(!1)))}catch{}},[]);return{desktopUpdateRestarting:a,desktopUpdateFailure:o,readyAppUpdate:d,appUpdate:t,askDesktopUpdateRestart:f,onDesktopUpdateEvent:b}}const ug="agent-dag.autoRestart",zD="agent-dag.bundleReloadedFor";function sEe({now:e,stateRef:t,version:n,notice:a,noticeOpen:i,upgradeFailure:o,paused:r}){const[c,d]=m.useState(()=>ht(ug)!=="0"),u=m.useRef(!1),h=m.useCallback(()=>{const F=!c;u.current=!0,Xa(ug),d(F),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:F})}).then(U=>U.ok?U.json():null).then(U=>{var P;U!=null&&U.ok&&d(((P=U.prefs)==null?void 0:P.autoUpdate)!==!1)}).catch(()=>{})},[c]),[g,f]=m.useState(!1),[b,k]=m.useState("restart"),[y,N]=m.useState(null),w=m.useRef(!1),j=m.useRef(null),S=m.useRef(0),A=m.useRef(null),T=m.useCallback(async F=>{if(!Qn(w.current))return;const U=(F==null?void 0:F.upgrade)===!0,P=(F==null?void 0:F.whenIdle)===!0;w.current=!0,j.current=o;const L=++S.current,R=()=>{k(U?"npx":"restart"),f(!0)};P||R();try{window.sessionStorage.setItem("agent-dag.restartPending",(a==null?void 0:a.to)??"")}catch{}let O=!1;try{const D=await fetch("/api/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P?{upgrade:U,whenIdle:P}:{upgrade:U})});O=P&&D.status===409}catch{}if(O){w.current=!1,A.current=null;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}return}P&&R(),window.setTimeout(()=>{if(S.current===L&&w.current){w.current=!1,f(!1);try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}}},U?18e4:3e4)},[a==null?void 0:a.to,o]);m.useEffect(()=>{const F=XI(t.current.agents.values())>0,U=cje({enabled:c,kind:a==null?void 0:a.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:i,visible:document.visibilityState==="visible",busy:F,idleSince:A.current,now:e});A.current=U.idleSince,U.restart&&T({whenIdle:!0})},[c,a==null?void 0:a.kind,n==null?void 0:n.canRestart,i,e,T]);const q=XI(t.current.agents.values()),_=rje(q,r),I=GW({enabled:c,kind:a==null?void 0:a.kind,canRestart:(n==null?void 0:n.canRestart)===!0,noticeOpen:i,visible:document.visibilityState==="visible",busy:q>0,idleSince:A.current,now:e});m.useEffect(()=>{const F=n==null?void 0:n.running;let U=null,P=null;try{U=window.sessionStorage.getItem("agent-dag.restartPending"),P=window.sessionStorage.getItem(zD)}catch{return}const L=nje({bundle:"3.81.2",running:F,pending:U,lastTried:P});if(L==="reload"){try{window.sessionStorage.setItem(zD,F??"")}catch{return}window.location.reload();return}if(L!=="confirm")return;try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}w.current=!1,f(!1),N(F??null);const R=window.setTimeout(()=>N(null),6e3);return()=>window.clearTimeout(R)},[n==null?void 0:n.running]),m.useEffect(()=>{if(g&&sje({asked:j.current,reported:o})){try{window.sessionStorage.removeItem("agent-dag.restartPending")}catch{}w.current=!1,f(!1)}},[g,o]);const z=m.useCallback(F=>{var U,P;if(!u.current){const L=ht(ug)==="0";Xa(ug),L&&((U=F.prefs)==null?void 0:U.autoUpdate)!==!1?(d(!1),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({autoUpdate:!1})}).catch(()=>{})):d(((P=F.prefs)==null?void 0:P.autoUpdate)!==!1)}},[]);return{autoRestart:c,toggleAutoRestart:h,restarting:g,restartMode:b,restartedTo:y,askRestart:T,restartCopy:_,restartFuseMs:I,loadAutoRestartPrefs:z}}function iEe(){const[e,t]=m.useState([]),n=m.useRef(new Set),[a,i]=m.useState(null),[o,r]=m.useState(void 0);m.useEffect(()=>{let u=!0,h=0;const g=()=>{fetch("/api/lan").then(f=>f.ok?f.json():null).then(f=>u?(f!=null&&f.ok&&t(k_(Array.isArray(f.pending)?f.pending:[],f.aliases)),f):null).catch(()=>null).then(f=>{u&&(r(b=>f!=null&&f.ok?f:b===void 0?null:b),h=window.setTimeout(g,(f==null?void 0:f.enabled)===!0?hj:lH))})};return g(),()=>{u=!1,window.clearTimeout(h)}},[]);const c=m.useCallback(async(u,h)=>{if(!a){i(u);try{const f=await(await fetch("/api/lan/peer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:u,fp:h})})).json().catch(()=>null);f&&Array.isArray(f.pending)?t(k_(f.pending,f.aliases)):t(b=>b.filter(k=>k.fp!==h))}catch{}finally{i(null)}}},[a]),d=m.useCallback(u=>{a||(n.current.add(u),t(h=>[...h]))},[a]);return{lanPending:e,lanDeferred:n,lanBusy:a,answerLanPair:c,deferLanPair:d,lanStatus:o}}const oEe=6e4;function rEe({enabled:e,lanStatus:t,now:n}){const[a,i]=m.useState(null),[o,r]=m.useState(()=>new Set),[c,d]=m.useState(null),u=m.useCallback(w=>{w!=null&&w.ok&&Array.isArray(w.accounts)&&i(w.accounts)},[]),h=m.useCallback(async w=>{try{const j=await fetch(`/api/claude-accounts${w?"?refresh=1":""}`);j.ok&&u(await j.json())}catch{}},[u]);m.useEffect(()=>{e&&h(!1)},[e,h]),m.useEffect(()=>{if(!e)return;let w=Date.now();const j=()=>{document.visibilityState!=="visible"||Date.now()-w<oEe||(w=Date.now(),h(!1))};return document.addEventListener("visibilitychange",j),window.addEventListener("focus",j),()=>{document.removeEventListener("visibilitychange",j),window.removeEventListener("focus",j)}},[e,h]);const g=m.useMemo(()=>e?jAe(a,{lan:t,now:n,closed:o}):[],[e,a,t,n,o]),f=m.useRef(g);f.current=g;const b=m.useCallback(w=>{w.length&&r(j=>new Set([...j,...w]))},[]),k=m.useCallback(()=>{const w=f.current;w.length&&(b(w.map(j=>j.id)),fetch("/api/claude-accounts/admin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reauth-later",incidents:w.map(j=>({key:j.key,since:j.since}))})}).catch(()=>{}))},[b]),y=m.useRef(c);y.current=c;const N=m.useCallback(w=>{const j=y.current;b(AAe(j?[j,...f.current]:f.current,w))},[b]);return{rows:g,signingIn:c,observe:u,signIn:d,signedIn:N,refresh:m.useCallback(()=>{h(!0)},[h]),closeSignIn:m.useCallback(()=>d(null),[]),later:k}}const w5=288,cEe=w5;function lEe(e,t,n){return e?"session-list":t||n?"accounts":null}function LD(e){return e==="session-list"?cEe:e==="accounts"?w5:0}const dEe=240,uEe=20;function hEe(e){const t=m.useRef(0),n=m.useRef(e);return m.useLayoutEffect(()=>{n.current!==e&&(n.current=e,t.current=Sl()?0:performance.now()+dEe+uEe)},[e]),t}const y5="agent-dag.sessionListOpen",x5="agent-dag.accountsPanelOpen";function pEe(){return ht(y5)==="1"}function gEe(e){pt(y5,e?"1":"0")}function mEe(){const e=ht(x5);return e===null?!0:e==="1"}function fEe(){const e=m.useRef(!1),t=m.useRef(!1),[n,a]=m.useState(()=>{const k=pEe();return k&&LN()?(e.current=!0,!1):k});m.useEffect(()=>{if(n)e.current=!1;else if(e.current)return;gEe(n)},[n]);const i=m.useRef(!1),[o,r]=m.useState(()=>{const k=mEe();return k&&n?(i.current=!0,!1):k&&LN()?(t.current=!0,!1):k});m.useEffect(()=>{if(o)t.current=!1;else if(t.current)return;!o&&i.current||pt(x5,o?"1":"0")},[o]),m.useEffect(()=>{!n&&i.current&&(i.current=!1,r(!0))},[n]);const c=m.useCallback(()=>{a(k=>(k||r(y=>(y&&(i.current=!0),!1)),!k))},[]),d=m.useCallback(()=>{i.current=!1,r(k=>(k||a(!1),!k))},[]),u=m.useCallback(()=>{i.current=!1,r(k=>(k||a(!1),!0))},[]),h=m.useCallback(()=>a(!1),[]),g=m.useCallback(()=>{i.current=!1,a(!1)},[]),f=m.useCallback(()=>r(!1),[]),b=lEe(n,o,i.current);return{sessionListOpen:n,accountsPanelOpen:o,panel:b,toggleSessionList:c,toggleAccountsPanel:d,openAccountsPanel:u,closeSessionList:h,closeSessionListToCanvas:g,closeAccountsPanel:f}}const C5="agent-dag.detailOpen",S5="agent-dag.usagePanelOpen",N5="agent-dag.systemPanelOpen";function bEe(){return ht(C5)==="1"}function vEe(e){pt(C5,e?"1":"0")}function kEe(){const e=ht(S5);return e===null?!0:e==="1"}function wEe(e){pt(S5,e?"1":"0")}function yEe(){const e=ht(N5);return e===null?!0:e==="1"}function xEe(e){pt(N5,e?"1":"0")}function CEe(e=0){const[t,n]=m.useState(bEe);m.useEffect(()=>{vEe(t)},[t]);const[a,i]=m.useState(kEe);m.useEffect(()=>{wEe(a)},[a]);const o=m.useRef(!1),[r,c]=m.useState(()=>{const d=yEe();return d&&a&&(LN()||Boe(e))?(o.current=!0,!1):d});return m.useEffect(()=>{if(r)o.current=!1;else if(o.current)return;xEe(r)},[r]),An("usage-panel",a),An("machine-panel",r),{detailOpen:t,setDetailOpen:n,usagePanelOpen:a,setUsagePanelOpen:i,machinePanelOpen:r,setMachinePanelOpen:c}}const SEe={permission:"permission",asked:"answer"},NEe=()=>x("shell.announce.allClear");function jEe(e){if(e.length===0)return"";const[t,...n]=e,a=t.waiting.kind,i=n.every(o=>o.waiting.kind===a)?SEe[a]??"you":"you";return n.length===0?x(`shell.announce.block.${i}`,{label:t.label}):x(`shell.announce.blockMore.${i}`,{label:t.label,count:n.length})}function ZS(e,t,n=NEe()){return t!==""?t:e===""?"":n}function AEe({waitingSessions:e,watchUnseen:t,incidents:n=[]}){const[a,i]=m.useState(""),o=jEe(e);m.useEffect(()=>{i(f=>ZS(f,o))},[o]);const[r,c]=m.useState(""),d=t>0?x("shell.announce.watch",{count:t}):"";m.useEffect(()=>{c(f=>ZS(f,d,x("shell.announce.watchNone")))},[d]);const[u,h]=m.useState(""),g=IRe(n);return m.useEffect(()=>{h(f=>ZS(f,g,DRe()))},[g]),{blockedSaid:a,watchSaid:r,setWatchSaid:c,incidentSaid:u}}const TEe="/icon-192.png",j5=Object.freeze({notifySwap:!0,notifyQuota:!1,notifyReset:!1,notifyStopped:!0});function OD(e){const t=n=>typeof(e==null?void 0:e[n])=="boolean"?e[n]:j5[n];return{notifySwap:t("notifySwap"),notifyQuota:t("notifyQuota"),notifyReset:t("notifyReset"),notifyStopped:t("notifyStopped")}}function REe({waitingSessions:e,liveSince:t,focusSession:n}){const[a,i]=m.useState(()=>typeof Notification>"u"?"denied":Notification.permission),[o,r]=m.useState(null),[c,d]=m.useState(!1),[u,h]=m.useState(!1),[g,f]=m.useState(j5),b=m.useCallback(I=>{const z=!g[I];f(F=>({...F,[I]:z})),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[I]:z})}).then(F=>F.ok?F.json():null).then(F=>{F!=null&&F.ok&&f(OD(F.prefs))}).catch(()=>{})},[g]),k=m.useRef(()=>{}),y=m.useRef(new Set),N=da(e),w=m.useCallback(()=>{const I=!c;d(I),I&&(y.current=Mp(N.current)),I&&typeof Notification<"u"&&Notification.permission==="default"&&k.current(),fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({notifications:I})}).then(z=>z.ok?z.json():null).then(z=>{var F;z!=null&&z.ok&&(d(((F=z.prefs)==null?void 0:F.notifications)===!0),h(z.notificationsVetoed===!0))}).catch(()=>{})},[c]),j=typeof Notification<"u";m.useEffect(()=>{if(!o)return;const z=setTimeout(()=>r(null),o==="blocked"?8e3:4e3);return()=>clearTimeout(z)},[o]);const S=m.useCallback(()=>{typeof Notification>"u"||Notification.requestPermission().then(I=>{const z=I;i(z),z==="granted"?r("on"):z==="denied"&&r("blocked")})},[]);k.current=S;const A=m.useRef(null),T=e.map(I=>Dm(I.id,I.waiting)).join("|");m.useEffect(()=>{Cee(A.current,a)&&(A.current=a,y.current=Mp(e))},[a]);const q=m.useRef(!1);m.useEffect(()=>{See(q.current,t)&&(q.current=!0,y.current=Mp(e))},[t]),m.useEffect(()=>{if(typeof Notification>"u"||Notification.permission!=="granted"||!Nee(A.current,t))return;const I=typeof document>"u"||!document.hidden,z=yee(e,y.current,I,c);for(const F of z)try{const U=new Notification(F.title,{body:F.body,tag:F.key,icon:TEe});U.onclick=()=>{window.focus(),n(F.sessionId),U.close()}}catch{}y.current=I?Mp(e):xee(e,z,y.current)},[T,t]);const _=m.useCallback(I=>{var z;d(((z=I.prefs)==null?void 0:z.notifications)===!0),h(I.notificationsVetoed===!0),f(OD(I.prefs))},[]);return{notifyPermission:a,notifySaid:o,notifyOn:c,notifyVetoed:u,toggleNotify:w,notifySupported:j,askForNotifications:S,loadNotifyPrefs:_,accountNotify:g,toggleAccountNotify:b}}function EEe({openedTool:e,usageHistoryOpen:t,contextFor:n,tourOpen:a,summaryFor:i,browserWatchOpen:o,keyHelpOpen:r,releaseNotes:c,feedbackOpen:d,trafficRadarOpen:u=!1}){const h=da(r),g=m.useRef(!1);return g.current=e!=null||t||n!=null||a||i!=null||o||r||c!=null||d||u,{keyHelpOpenRef:h,modalOpenRef:g}}function qEe({stateRef:e,tourOpen:t,releaseNotes:n}){const[a,i]=m.useState(null),o=m.useCallback((P,L)=>i({agentId:P,toolId:L}),[]),[r,c]=m.useState(null),[d,u]=m.useState(null),h=m.useCallback(P=>u(P),[]),[g,f]=m.useState(!1),[b,k]=m.useState(!1),[y,N]=m.useState(!1),[w,j]=m.useState(!1),[S,A]=m.useState(!1),[T,q]=m.useState(null),_=m.useCallback(P=>{q(P??null),A(!0)},[]);An("tool-detail",a!==null),An("session-summary",r!==null),An("context-window",d!==null),An("keyboard-help",g),An("usage-history",b),An("browser-watch",y),An("feedback",S);const I=a?pQ(e.current.agents,a.agentId,a.toolId):null,z=d?e.current.agents.get(d):void 0,{keyHelpOpenRef:F,modalOpenRef:U}=EEe({openedTool:I,usageHistoryOpen:b,contextFor:d,tourOpen:t,summaryFor:r,browserWatchOpen:y,keyHelpOpen:g,releaseNotes:n,feedbackOpen:S,trafficRadarOpen:w});return{setOpenedToolKey:i,openTool:o,openedTool:I,summaryFor:r,setSummaryFor:c,contextFor:d,setContextFor:u,openContext:h,contextAgent:z,keyHelpOpen:g,setKeyHelpOpen:f,usageHistoryOpen:b,setUsageHistoryOpen:k,browserWatchOpen:y,setBrowserWatchOpen:N,trafficRadarOpen:w,setTrafficRadarOpen:j,feedbackOpen:S,setFeedbackOpen:A,feedbackPrefill:T,setFeedbackPrefill:q,openFeedback:_,keyHelpOpenRef:F,modalOpenRef:U}}function _Ee({stateRef:e,pinnedRef:t,measuredRef:n,positionsRef:a,lastLayoutSigRef:i,forgetRemovals:o,clearSelection:r,rerender:c,modalOpenRef:d}){const[u,h]=m.useState(!1),g=m.useCallback(async()=>{try{await fetch("/api/clear",{method:"POST"})}catch{}e.current=iA(),t.current.clear(),n.current.clear(),a.current.clear(),i.current="",dW(),o(),r(),c()},[c,r,o]),f=da(u),b=m.useCallback(k=>{const y=uje(k,{confirmOpen:f.current,modalOpen:d.current});y==="confirm"?h(!0):y==="clear"&&(h(!1),g())},[g]);return{clearConfirmOpen:u,setClearConfirmOpen:h,requestClear:b}}const PD="agent-dag.oldNameNoticeDismissed";function zEe(e){const[t,n]=m.useState(()=>ht(PD)??""),a=e!=null&&e.invokedAs&&e.invokedAs!==qt?e.invokedAs:null,i=a!=null&&t!==a,o=m.useCallback(()=>{a&&(n(a),pt(PD,a))},[a]);return{oldName:a,oldNameOpen:i,dismissOldName:o}}const LEe=300*1e3,OEe=1800*1e3,PEe=8e3,MEe=3e4;function MD(e){return fetch("/api/rating",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}).catch(()=>null)}function IEe({modalOpenRef:e}){const t=m.useCallback(()=>Uc({appModal:e.current,dialogDepth:jn.dialogDepth()}),[e]),[n,a]=m.useState("hidden"),[i,o]=m.useState(null),[r,c]=m.useState(!1),d=m.useRef(n);d.current=n,m.useEffect(()=>{let b=!1;const k=async()=>{if(d.current==="thanks"||d.current==="hidden"&&(document.hidden||t()))return;const w=await fetch("/api/rating").then(j=>j.ok?j.json():null).catch(()=>null);b||!w||a(j=>j==="thanks"?j:w.ask===!0?"asking":"hidden")},y=window.setTimeout(k,LEe),N=window.setInterval(k,OEe);return()=>{b=!0,window.clearTimeout(y),window.clearInterval(N)}},[t]),m.useEffect(()=>{if(n!=="thanks"||r)return;const b=i!==null&&i<=6?MEe:PEe;let k=0;const y=()=>{t()?k=window.setTimeout(y,b):a("hidden")};return k=window.setTimeout(y,b),()=>window.clearTimeout(k)},[n,i,r,t]);const u=m.useCallback(b=>{o(b),c(!1),a("thanks"),MD({score:b})},[]),h=m.useCallback(b=>c(b),[]),g=m.useCallback(()=>{a("hidden"),MD({later:!0})},[]),f=m.useCallback(()=>a("hidden"),[]);return{ratingPhase:n,ratingScore:i,answerRating:u,rateLater:g,closeRating:f,holdThanks:h}}function DEe({chimesRef:e,setTonePrefs:t,tonePrefsRef:n,previewTone:a}){const[i,o]=m.useState(()=>gre(ht)),r=da(i),[c,d]=m.useState([]),u=m.useCallback(j=>{o(S=>{const A={...S,[j]:null};return r.current=A,A}),Xa(ru[j])},[]),h=m.useCallback((j,S)=>{const A=r.current[j];S&&A!==S||(u(j),t(T=>{const q={...T,[j]:{...T[j],figure:Sa}};return n.current=q,q}),pt(sm[j],Sa))},[u]),g=da(h);m.useEffect(()=>{let j=!0;return Nre().then(S=>{if(!j)return;d(S);const A=new Set(S.map(T=>T.id));for(const T of cu){const q=r.current[T];q&&!A.has(q)&&g.current(T,q)}},()=>{}),()=>{j=!1}},[]);const f=m.useCallback((j,S)=>{if(!c.some(T=>T.id===S))return;const A={...r.current,[j]:S};r.current=A,o(A),pt(ru[j],S),a(j,!0)},[c,a]),b=m.useCallback(async j=>{var q;const S=MN(c.length);if(S)throw new kn(S);const A=window.AudioContext??window.webkitAudioContext;if(!A)throw new kn(x("settings.sounds.custom.decodeFail"));const T=new A;try{const _=await wre(j,z=>T.decodeAudioData(z));await Rq(_);const I=zu(_);d(z=>[...z.filter(F=>F.id!==I.id),I])}finally{(q=T.close)==null||q.call(T)}},[c.length]),k=m.useCallback(async j=>{const S=MN(c.length);if(S)throw new kn(S);const A=yre(j);await Rq(A);const T=zu(A);d(q=>[...q.filter(_=>_.id!==T.id),T])},[c.length]),y=m.useCallback(async(j,S)=>{const A=c.find(q=>q.id===j),T=S.trim().slice(0,80);!A||!T||T===A.name||(await Are(j,T),d(q=>q.map(_=>_.id===j?{..._,name:T}:_)))},[c]),N=m.useCallback(async j=>{await Tre(j),d(q=>q.filter(_=>_.id!==j));const S=r.current,A=mre(S,j);r.current=A,o(A);const T=cu.filter(q=>S[q]===j);for(const q of T)Xa(ru[q]),pt(sm[q],Sa);T.length>0&&t(q=>{const _={...q};for(const I of T)_[I]={..._[I],figure:Sa};return n.current=_,_})},[]),w=m.useCallback(j=>{var T,q;const S=cu.find(_=>r.current[_]===j),A=S?n.current[S].level:Ur;(T=e.current)==null||T.unlock(),(q=e.current)==null||q.previewCustom(j,A)},[]);return{customSelections:i,customSelectionsRef:r,customAssets:c,clearCustomOnly:u,fallbackCustomRef:g,selectCustomTone:f,importNotificationAudio:b,createNotificationVoice:k,renameCustomAsset:y,deleteCustomAsset:N,previewCustomAsset:w}}function FEe(e){const[t,n]=m.useState(()=>Fre(ht)),a=da(t),i=m.useRef(null),o=m.useCallback((c,d=!1)=>{var u,h;if((u=e.current)==null||u.unlock(),i.current!==null&&clearTimeout(i.current),i.current=null,!d){(h=e.current)==null||h.play(c,!0);return}i.current=setTimeout(()=>{var g;i.current=null,(g=e.current)==null||g.play(c,!0)},Ore)},[]),r=m.useCallback((c,d)=>{n(u=>{const h={level:nf(d.level??u[c].level),figure:EB(c,d.figure??u[c].figure)};return pt(zB[c],String(h.level)),pt(sm[c],h.figure),{...u,[c]:h}}),o(c,!0)},[o]);return m.useEffect(()=>()=>{i.current!==null&&clearTimeout(i.current)},[]),{tonePrefs:t,setTonePrefs:n,tonePrefsRef:a,previewTone:o,changeTone:r}}const UEe=15e3;function BEe(e){return e.visibilityState==="visible"&&e.hasFocus()}function HEe(e,t){return t||e===!0}function WEe(){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 GEe(){m.useEffect(()=>{const e=WEe();let t=null;const n=r=>{fetch("/api/presence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tab:e,looking:r}),keepalive:!0}).catch(()=>{})},a=()=>{const r=BEe(document);HEe(t,r)&&n(r),t=r},i=()=>{t&&n(!1),t=!1};a();const o=window.setInterval(a,UEe);return window.addEventListener("focus",a),window.addEventListener("blur",a),document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",i),()=>{window.clearInterval(o),window.removeEventListener("focus",a),window.removeEventListener("blur",a),document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",i),i()}},[])}function $Ee({loadAutoRestartPrefs:e,loadNotifyPrefs:t,loadReportsPrefs:n}){m.useEffect(()=>{let a=!0;return fetch("/api/prefs").then(i=>i.ok?i.json():null).then(i=>{!a||!(i!=null&&i.ok)||(e(i),t(i),n(i))}).catch(()=>{}),()=>{a=!1}},[])}const XS="agent-dag.versionNoticeDismissed",VEe=15*6e4;function KEe(e){const[t,n]=m.useState(null),[a,i]=m.useState(()=>ht(XS)??""),o=m.useRef(0),[r,c]=m.useState(!1),d=m.useCallback((y=!1)=>(y&&(o.current=Date.now(),c(!0)),fetch(y?"/api/version?refresh=1":"/api/version").then(N=>N.ok?N.json():null).then(N=>(N&&n(N),N??null)).catch(()=>null).finally(()=>{y&&c(!1)})),[]),u=m.useCallback(()=>{d(Date.now()-o.current>=VEe)},[d]);m.useEffect(()=>{d();const y=window.setInterval(u,5*6e4),N=()=>{document.visibilityState==="visible"&&u()};return document.addEventListener("visibilitychange",N),()=>{window.clearInterval(y),document.removeEventListener("visibilitychange",N)}},[d,u]),m.useEffect(()=>{e&&d()},[e,d]);const h=(t==null?void 0:t.notice)??null,g=BW(h),f=ANe(h,a),b=m.useCallback(()=>{i(""),pt(XS,"")},[]),k=m.useCallback(()=>{h&&(i(g),pt(XS,g))},[h,g]);return{version:t,notice:h,noticeOpen:f,showNotice:b,dismissNotice:k,versionChecking:r,loadVersion:d}}function JEe({version:e,readyAppUpdate:t}){const[n,a]=m.useState(!1),i=m.useRef(null),[o,r]=m.useState(null),c=o&&t?t.version:null,d=m.useRef(null);m.useEffect(()=>{!c||d.current===c||(d.current=c,fetch("/api/desktop-update/seen",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({version:c})}).catch(()=>{}))},[c]);const u=m.useRef(!1);m.useEffect(()=>{if(u.current)return;const N=Js(),w=KAe(N),j=eTe({stored:w,running:(e==null?void 0:e.running)??null,notes:oD,remembers:JAe(N)});if(j.reason==="no-version")return;u.current=!0,j.record&&YAe(N,j.record);let S=!0;return(async()=>{var I;let T=ZAe(N);if(zo())try{const z=await fetch("/api/prefs");if(!z.ok)throw new Error("desktop tour preferences unavailable");const F=await z.json();if(!(F!=null&&F.ok))throw new Error("desktop tour preferences unavailable");const U=((I=F.prefs)==null?void 0:I.tourSeen)===!0;T&&!U&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{}),T=T||U}catch{T=!0}if(!S)return;const q=QAe({tourSeen:T,decision:j}),_=j.show.length?{entries:j.show,since:w,firstRun:!1}:null;q.tour&&a(!0),q.notes==="now"?r(_):q.notes==="after"&&(i.current=_)})(),()=>{S=!1}},[e==null?void 0:e.running]);const h=(e==null?void 0:e.running)??"3.81.2",g=m.useMemo(()=>n5(oD,null,h),[h]),f=m.useCallback(()=>{r({entries:g,since:null,firstRun:!1})},[g]),b=m.useCallback(()=>a(!0),[]),k=m.useCallback(()=>r(null),[]),y=m.useCallback(()=>{a(!1),XAe(Js()),zo()&&fetch("/api/prefs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({tourSeen:!0}),keepalive:!0}).catch(()=>{});const N=i.current;i.current=null,N&&r(N)},[]);return{tourOpen:n,openTour:b,closeTour:y,releaseNotes:o,closeReleaseNotes:k,chipVersion:h,openReleaseNotes:f}}function YEe(){const[e,t]=m.useState(void 0),[n,a]=m.useState(!1),i=m.useRef(!1);return i.current=e===!0&&!n,m.useEffect(()=>uRe(()=>i.current),[]),{loadReportsPrefs:m.useCallback(r=>{var c;t(((c=r.prefs)==null?void 0:c.reports)!==!1),a(r.reportsVetoed===!0)},[])}}function ZEe(e){const[t,n]=m.useState(null);m.useEffect(()=>{const c=ht("agent-dag.sound");n(c===null?!0:c==="on")},[]);const a=m.useCallback(()=>{n(c=>{var u,h;const d=c!==!0;return pt("agent-dag.sound",d?"on":"off"),d?(u=e.current)==null||u.unlock():(h=e.current)==null||h.silence(),d})},[]),i=m.useCallback(c=>{a()},[a]),o=da(i),r=da(t);return{soundOn:t,toggleSound:a,activateSoundRef:o,soundOnRef:r}}function XEe(){const[e,t]=m.useState(Qoe),n=m.useCallback((o,r)=>{t(c=>ere(c,o,r))},[]),a=m.useCallback(()=>t(o=>({...o,open:!1})),[]),i=m.useCallback(o=>t(r=>({...r,section:o})),[]);return{settingsOpen:e.open,settingsSection:e.section,settingsLandOn:e.landOn,openSettings:n,closeSettings:a,showSection:i}}const QEe="agent-dag.autoFitDisabled";function e1e(e){const t=m.useRef(!1),[n,a]=m.useState(!1);m.useEffect(()=>{Xa(QEe)},[]);const i=m.useCallback(()=>{t.current||(t.current=!0,a(!0))},[]),o=m.useCallback(()=>{t.current=!1,a(!1),e(400)},[e]);return{autoFitDisabled:n,autoFitDisabledRef:t,disableAutoFit:i,enableAutoFitAndRefit:o}}function t1e(){return s.jsx(sA,{children:s.jsx(gRe,{children:s.jsx(n1e,{})})})}function n1e(){var cc;const e=se(),t=Cl(),n=m.useState(iA)[0],a=m.useRef(n),[,i]=m.useState(0),o=m.useCallback(()=>i(xt=>xt+1),[]),{sessionListOpen:r,accountsPanelOpen:c,panel:d,toggleSessionList:u,toggleAccountsPanel:h,openAccountsPanel:g,closeSessionList:f,closeSessionListToCanvas:b,closeAccountsPanel:k}=fEe(),{detailOpen:y,setDetailOpen:N,usagePanelOpen:w,setUsagePanelOpen:j,machinePanelOpen:S,setMachinePanelOpen:A}=CEe(LD(d)),{selectedIds:T,primarySelectedId:q,selectAgent:_,clearSelection:I,pruneSelectionToBoard:z}=Rve(a,N),F=Vc(c,200),U=Vc(r,200),P=QE(r,U),L=Vc(w,130),R=Vc(S,130),O=m.useRef(null),D=ZEe(O),{activateSoundRef:$,soundOnRef:B}=D,G=FEe(O),{setTonePrefs:Z,tonePrefsRef:W,previewTone:H}=G,X=DEe({chimesRef:O,setTonePrefs:Z,tonePrefsRef:W,previewTone:H}),{customSelectionsRef:V,fallbackCustomRef:Q}=X,Y=XEe(),{openSettings:K}=Y;tEe({chimesRef:O,soundOnRef:B,tonePrefsRef:W,customSelectionsRef:V,fallbackCustomRef:Q});const ee=bRe(a),{pauseGate:te,paused:ce,togglePause:ge}=ee,ve=m.useRef(()=>{}),{live:pe,tabCapped:ae,everConnected:le,liveSince:Se}=kve({stateRef:a,rerender:o,pauseGate:te,chimesRef:O,desktopUpdateRef:ve}),ke=KEe(pe),{version:ye,notice:We,noticeOpen:He,loadVersion:Ke}=ke,Re=aEe(pe),{readyAppUpdate:Je,onDesktopUpdateEvent:Pe}=Re;ve.current=Pe,GEe();const Ae=JEe({version:ye,readyAppUpdate:Je}),{tourOpen:xe,openTour:ze,releaseNotes:Ce}=Ae,{workspace:Me,providers:Ee,providersRef:Be}=xRe(pe),tt=wRe(Ee,c),ie=tt.shown,je=xt=>{tt.remember(xt),(!c||ie===xt)&&h()},Fe=LD(d==="accounts"&&!(Ee.claude||Ee.codex)?null:d),Ge=hEe(Fe),Te=QE(c,F)&&(Ee.claude||Ee.codex),[nt,fe]=m.useState(!1),Ve=tt.remember,gt=m.useCallback(()=>{Ve(Ee.claude?"claude":"codex"),g()},[g,Ee.claude,Ve]),mt=m.useCallback(()=>{g(),fe(!0)},[g]),[ft,Xt]=m.useState(null),[Pn,Ta]=m.useState([]),ga=m.useMemo(()=>[...ft??[],...Pn],[ft,Pn]);m.useEffect(()=>{c||fe(!1)},[c]);const Hn=m.useCallback(()=>fe(!1),[]),Ra=zEe(ye),Mt=FRe({version:ye,loadVersion:Ke}),{upgradeFailure:Wn}=Mt,Jt=qEe({stateRef:a,tourOpen:xe,releaseNotes:Ce}),$e=IEe({modalOpenRef:Jt.modalOpenRef}),{openTool:Qe,setSummaryFor:lt,setContextFor:kt,openContext:zt,setKeyHelpOpen:Gt,setUsageHistoryOpen:Bt,setBrowserWatchOpen:ma,keyHelpOpenRef:pn,modalOpenRef:Qt}=Jt,Ea=YEe(),qa=BRe(),{watchOn:en,watchUnseen:tn}=qa,rn=hh(),[Mn,Rn]=m.useState(null),[ss,Et]=m.useState(!1),_a=m.useCallback(()=>Et(!1),[]),za=xt=>{iNe(xt),K("integrations")},is=xt=>{xt&&KI(xt),K("integrations")},La=m.useCallback(()=>Rn(null),[]),Gn=QT().filter(xt=>Tj(rn,xt.kind)),qs=da(xt=>{const $i=Gn.find(Vi=>Vi.kind===xt);$i&&Rn($i.kind)}),fa=m.useCallback(xt=>{KI(xt),K("integrations")},[K]),nn=Gn.length>0;m.useEffect(()=>{nn&&WSe()},[nn]);const $n=iEe(),[an,Io]=m.useState(0),{presentCats:_s,hiddenCats:os,toggleCat:yn,catBarRef:rs,catBarOccluded:cn}=QRe(a),ba=m.useRef(null),[oi,de]=m.useState(0),Ne=Eve({stateRef:a,rerender:o,pruneSelectionToBoard:z,setContextFor:kt,setSummaryFor:lt});fne({stateRef:a,now:Ne,enabled:Ee.claude});const Ue=jRe(Ee.claude||Ee.codex),ue=MRe(Ue,Ne),Ie=rEe({enabled:Ee.claude,lanStatus:$n.lanStatus,now:Ne}),st=sEe({now:Ne,stateRef:a,version:ye,notice:We,noticeOpen:He,upgradeFailure:Wn,paused:ee.paused}),{askRestart:bt,loadAutoRestartPrefs:ut}=st,En=XRe(),{setTheme:cs,palette:Yr}=En,Do=nEe(),zs=Exe(),{applyViewport:gh,moveCamera:Il,fitLeft:ri,cameraEpochRef:Ls,lastFitTimeRef:ls}=zs,Vn=Wxe(zs),{pinnedRef:Os,positionsRef:Ps,lastLayoutSigRef:Ms,handleRelayout:mh,rearrangeUndo:fh}=Vn,Fi=m.useRef(null),bh=m.useRef(()=>{}),Dl=Se!==null,Fo=m.useRef(0),Fl=m.useCallback(()=>{Fo.current=Date.now()},[]),{canvasRef:Is,canvasSize:Uo,paneSizeRef:Bo}=qCe(Ge),ci=e1e(ri),{autoFitDisabledRef:Ho,disableAutoFit:Ul}=ci,Bl=m.useRef(!1),{measuredRef:ds,measuredVersionRef:Zr,sizeVersion:Hl,domSizeVersion:vh}=_Ce(Bl,a),{removedNodes:Oa,removedAgentIds:Ds,removeNode:Xr,removeSelectedNode:Wl,removalNotice:Wo,hideSessions:Qr,bringBack:ec,bringBackAll:Kn,forgetRemovals:Ui}=dCe({stateRef:a,pinnedRef:Os,positionsRef:Ps,returningRef:Vn.returningRef,canvasRef:Is,clearSelection:I,primarySelectedId:q});wCe({stateRef:a,removedNodes:Oa,hideSessions:Qr,ready:Dl,keepSessionId:q?((cc=a.current.agents.get(q))==null?void 0:cc.sessionId)??q:null});const Go=iCe({stateRef:a,now:Ne,removedAgentIds:Ds,sizeVersion:Hl,domSizeVersion:vh});Gxe(Go,Vn),lCe({layoutSig:Go,rf:t,stateRef:a,measuredRef:ds,pinnedRef:Os,positionsRef:Ps,paneSizeRef:Bo,lastInteractRef:Fo,autoFitDisabledRef:Ho,lastFitTimeRef:ls,fitLeft:ri});const Bi=zCe(),{bubbling:Hf,endBubble:Gl,onBubble:$l}=sve(),[li,tc]=m.useState(!1),Vl=nve(),{beginTrashDrag:Wf,trackTrashDrag:Gf,endTrashDrag:$f}=Vl,nc=uve({stateRef:a,measuredRef:ds,measuredVersionRef:Zr,canvasRef:Is}),{lodRef:Vf,applyZoom:Kf}=nc,kh=TCe({applyViewport:gh,lastFitTimeRef:ls,cameraEpochRef:Ls,disableAutoFit:Ul,markInteract:Fl,canvasRef:Is,applyZoom:Kf}),$o=q?a.current.agents.get(q):null,Kl=y&&$o!=null,Fs=MCe({sessionListShown:P,usageShown:ko(L),machineShown:ko(R),accountsShown:Te&&Ee.claude,codexShown:Te&&!Ee.claude,detailShown:Kl,primarySelectedId:q,canvasRef:Is}),{railInsetRef:ac,availableWidth:wh,availableHeight:yh}=Nxe({canvasRef:Is,canvasSize:Uo,machinePhase:R,usagePhase:L,usagePanelOpen:w,detailShown:Kl}),xh=oCe({stateRef:a,now:Ne,availableWidth:wh,availableHeight:yh,layout:Vn,measuredRef:ds,onBubble:$l,settled:Bi,dragging:li,layoutSig:Go,selectedIds:T,openContext:zt,historyReplayed:Dl,removedNodes:Oa,removedAgentIds:Ds,dragTick:an,dragPatchRef:ba,dragMoveTick:oi}),{nodes:Vo,edges:Jf}=xh,Jl=da(q);$xe({nodes:Vo,edges:Jf,settled:Bi,dragging:li,availableWidth:wh,availableHeight:yh,layout:Vn,camera:zs,rf:t,measuredRef:ds,stateRef:a,lastFocusRef:Fi,primarySelectedIdRef:Jl,focusAgentRef:bh,autoFitDisabledRef:Ho});const Ch=_Ee({stateRef:a,pinnedRef:Os,measuredRef:ds,positionsRef:Ps,lastLayoutSigRef:Ms,forgetRemovals:Ui,clearSelection:I,rerender:o,modalOpenRef:Qt}),{requestClear:sc}=Ch,Yf=ICe({nodes:Vo,stateRef:a,pinnedRef:Os,positionsRef:Ps,draggingRef:Bl,dragPatchRef:ba,setDragging:tc,setDragMoveTick:de,setDragTick:Io,endBubble:Gl,markInteract:Fl,disableAutoFit:Ul,beginTrashDrag:Wf,trackTrashDrag:Gf,endTrashDrag:$f,removeNode:Xr}),Sh=m.useCallback(()=>ri(500),[ri]),Yl=da(Vo),{focusAgent:ic,stepAgent:Zf,focusSession:Hi}=_xe({canvasRef:Is,stateRef:a,measuredRef:ds,nodesRef:Yl,railInsetRef:ac,moveCamera:Il,disableAutoFit:Ul,lastFocusRef:Fi,focusAgentRef:bh,selectAgent:_,primarySelectedIdRef:Jl}),Xf=RCe({clearSelection:I,selectAgent:_,detailOpen:y,setDetailOpen:N,detailShown:Kl,focusAgent:ic,draggingRef:Bl,lodRef:Vf}),Zl=zxe({nodesRef:Yl,stateRef:a,canvasRef:Is,railInsetRef:ac}),Ko=da(Wl),Xl=m.useRef(null),Jo=m.useCallback(xt=>{Ds.has(xt)&&ec([xt]),Hi(xt)},[Ds,ec,Hi]),Nh=LCe(),[jh,oc]=m.useState(!1),Ql=m.useCallback(()=>oc(!0),[]),Wi=m.useCallback(()=>oc(!1),[]),Qf=m.useCallback(xt=>{oc(!1),xt.run()},[]),eb=On();OCe({pointerFocusRef:Nh,nodesRef:Yl,stateRef:a,primarySelectedIdRef:Jl,providersRef:Be,soundOnRef:B,keyHelpOpenRef:pn,modalOpenRef:Qt,waitingCursorRef:Xl,removeSelectedRef:Ko,activateSoundRef:$,clearSelection:I,selectAgent:_,focusAgent:ic,stepAgent:Zf,focusSession:Hi,requestClear:sc,handleRelayout:mh,undoRearrange:fh.undo,handleFit:Sh,togglePause:ge,toggleSessionList:u,toggleAccountsPanel:h,setDetailOpen:N,setUsageHistoryOpen:Bt,setUsagePanelOpen:j,setMachinePanelOpen:A,setBrowserWatchOpen:ma,setKeyHelpOpen:Gt,setTheme:cs,openSettings:K,openIntegrationRef:qs,openQuickOpen:Ql});const ed=a.current.agents.size,di=m.useMemo(()=>kN(a.current.agents.values()),[a.current,a.current.revision]);uCe({stateRef:a,waitingSessions:di,removedAgentIds:Ds,removedNodes:Oa,bringBack:ec}),NCe({stateRef:a,waitingSessions:di,live:pe});const td=AEe({waitingSessions:di,watchUnseen:tn,incidents:ue}),ui=REe({waitingSessions:di,liveSince:Se,focusSession:Hi}),{loadNotifyPrefs:Yo}=ui;$Ee({loadAutoRestartPrefs:ut,loadNotifyPrefs:Yo,loadReportsPrefs:Ea.loadReportsPrefs});const hi=_l(ef),[rc,Ah]=m.useState(!1),[nd,Zo]=m.useState(null),ad=m.useCallback(()=>Zo(null),[]),Th=m.useCallback(xt=>{const $i=a.current.agents.get(xt);return $i?$i.label||$i.cwdBasename||"session":null},[]),Rh=m.useCallback(xt=>{Zo(null),Jo(xt)},[Jo]),Eh=m.useCallback(()=>Ah(!1),[]),[qh,_h]=m.useState(null),tb=m.useCallback(()=>_h(null),[]),xn=sSe({providers:Ee,sessionListOpen:r,toggleSessionList:u,accountsPanelOpen:c,toggleAccountsPanel:h,accountsPanelId:m5(ie),codexPanelOpen:c&&ie==="codex",toggleCodexPanel:()=>je("codex"),usagePanelOpen:w,setUsagePanelOpen:j,machinePanelOpen:S,setMachinePanelOpen:A,setUsageHistoryOpen:Bt,watchOn:en,watchUnseen:tn,setBrowserWatchOpen:ma,setTrafficRadarOpen:Jt.setTrafficRadarOpen,openSettings:K,onFeedback:Jt.openFeedback,setRadioOpen:Ah,openToolActivity:Zo,openCapacity:_h,toggles:Fs.toggles,integrations:Gn.map(xt=>({provider:xt,onPress:()=>Rn(xt.kind)})),openExploreIntegrations:()=>Et(!0),openQuickOpen:Ql}),[nb,va]=m.useState(0),Gi=m.useCallback(xt=>{Jo(xt),hi&&b()},[Jo,hi,b]),zh=m.useCallback(()=>{r||u(),requestAnimationFrame(()=>{var xt;return(xt=document.querySelector("#session-list .sl-row"))==null?void 0:xt.focus()})},[r,u]),sd=()=>{(Ee.claude?Fs.accounts:Fs.codex)(),k()},id=tt.both?s.jsx(gbe,{shown:ie,notices:tt.notices,onPick:tt.pick}):void 0,od=xt=>tt.bothMounted?xt===ie?"shown":"hidden":void 0;return s.jsxs("div",{className:"app",children:[s.jsx("a",{className:"skip-link",href:"#canvas",children:e("shell.skipToCanvas")}),s.jsxs("header",{className:"topbar",children:[s.jsx(Die,{}),s.jsx(DNe,{versionCheck:ke,welcome:Ae,desktopUpdate:Re,pause:ee,announcements:td,notify:ui,waitingSessions:di,waitingCursorRef:Xl,focusSession:Hi,live:pe,now:Ne,incidents:ue,queueNamed:hi?0:nb}),!hi&&s.jsx(ONe,{waitingSessions:di,waitingCursorRef:Xl,focusSession:Hi,now:Ne,onFit:va,onMore:zh}),$o&&s.jsx(FNe,{selected:$o,now:Ne,selectedIds:T,focusAgent:ic,clearSelection:I}),!hi&&s.jsx("div",{className:"actions",children:s.jsx(Joe,{items:[xn.search,...xn.utilities]})})]}),hi?s.jsx(Koe,{items:[...xn.left,...xn.right[0],xn.utilities[0]],more:[xn.search,...xn.capacity,...xn.right.slice(1).flat(),...xn.integrations,...xn.explore,xn.utilities[1]]}):s.jsx(xq,{side:"left",label:e("shell.rail.left"),groups:[...xn.leftStripe,xn.integrations,xn.explore]}),s.jsx("div",{className:"vis-hidden",role:"status","aria-atomic":"true",children:Wo?e("shell.board.removed",{label:Wo.label}):""}),s.jsx(dje,{restart:st,versionCheck:ke,upgrade:Mt,oldNameNotice:Ra,rating:$e,onFeedback:Jt.openFeedback,everConnected:le,live:pe,paused:ce}),(P||Te)&&s.jsxs(Jbe,{width:Fe,children:[Te&&(ie==="claude"||tt.bothMounted)&&s.jsx(hbe,{leaving:Iv(c,F),onReport:Jt.openFeedback,onRoster:Ie.observe,onClose:sd,lanWanted:nt,onLanShown:Hn,onLanAccounts:Xt,codexLanAccounts:Pn,switcher:id,side:od("claude"),onNotice:tt.noteClaude}),Te&&(ie==="codex"||tt.bothMounted)&&s.jsx(Kbe,{leaving:Iv(c,F),onClose:sd,switcher:id,side:od("codex"),onNotice:tt.noteCodex,lanAccounts:ga,lanReady:!Ee.claude||ft!=null,lanWanted:nt,onLanShown:Hn,onLanAccounts:Ta}),P&&s.jsx(Gie,{leaving:Iv(r,U),state:a.current,now:Ne,selectedIds:T,onSelect:Gi,onClose:()=>{Fs.sessionList(),f()},removedIds:Ds,onBringBackAll:Kn})]}),s.jsxs(GNe,{canvasRef:Is,bubbling:Hf,dragging:li,trash:Vl,zoom:nc,viewport:kh,stateRef:a,peek:Zl,children:[ed===0&&(!pe&&ae?s.jsx(FCe,{reservedRight:ac.current}):s.jsx(UCe,{live:pe,everConnected:le,providers:Ee,workspace:Me,onTour:ze,reservedRight:ac.current})),(_s.length>1||os.size>0)&&s.jsx(UNe,{catBarRef:rs,catBarOccluded:cn,presentCats:_s,hiddenCats:os,toggleCat:yn}),s.jsx(Iie,{graph:xh,layout:Vn,viewport:kh,clicks:Xf,drag:Yf,appearance:En,fm:Do,radioOpen:rc,onRadioClose:Eh,autoFit:ci,pause:ee,stateRef:a,measuredRef:ds,hiddenCats:os,now:Ne,openTool:Qe,focusAgent:ic,requestClear:sc,setKeyHelpOpen:Gt})]}),!hi&&s.jsx(xq,{side:"right",label:e("shell.rail.right"),groups:xn.right}),nd&&s.jsx(vle,{view:nd,onClose:ad,sessionLabel:Th,onOpenSession:Rh}),qh&&s.jsx(Rbe,{view:qh,onClose:tb}),Mn&&s.jsx(VSe,{kind:Mn,connections:Ai(rn,Mn)?km(rn,Mn):[],onClose:La,onReconnect:fa}),ss&&s.jsx(uNe,{integrations:rn,onClose:_a,onOpen:Rn,onConnect:za,onManage:is}),jh&&s.jsx(Aoe,{onClose:Wi,onRun:Qf,items:rce({rails:xn,sessions:rB(a.current),now:Ne,openSession:Gi,settings:IB(Ee.claude,t0(rn),ph(rn)),openSettings:K,singleKeys:eb,fit:Sh,rearrange:mh,paused:ce,togglePause:ge,clear:ed>0?()=>sc("button"):void 0,keyHelp:()=>Gt(!0),tour:ze,theme:En.theme,setTheme:cs})}),ko(L)&&s.jsx(Zde,{state:a.current,now:Ne,providers:Ee,incidents:ue,liveSince:Se,leaving:L==="leaving",onClose:()=>{Fs.usage(),j(!1)}}),ko(R)&&s.jsx(Lue,{usageOpen:w,leaving:R==="leaving",onClose:()=>{Fs.machine(),A(!1)}}),y&&$o?s.jsx(tSe,{selected:$o,now:Ne,openTool:Qe,setSummaryFor:lt,stateRef:a,removeSelectedNode:Wl,onClose:()=>{Fs.detail(),N(!1)}}):null,s.jsx(K0e,{dialogs:Jt,welcome:Ae,desktopUpdate:Re,versionCheck:ke,restart:st,upgrade:Mt,lanPairs:$n,attention:Ie,clearFlow:Ch,watchBadge:qa,announcements:td,appearance:En,providers:Ee,stateRef:a,agentCount:ed,menus:Y,sound:D,tones:G,customTones:X,notify:ui,panelDoors:{accounts:gt,localNetwork:mt}})]})}function ID(){try{fetch("/api/ui-language",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:Le()})}).catch(()=>null)}catch{}}function a1e(){ID();try{return E2(ID)}catch{return()=>{}}}try{Q8(window.localStorage)}catch{}T2();a1e();const s1e=AG.createRoot(document.getElementById("root"));window.ccdeckWindow&&(document.documentElement.dataset.desktopChrome="true",document.documentElement.dataset.desktopPlatform=window.ccdeckWindow.platform);s1e.render(s.jsx(t1e,{}));export{h1e as $,Wr as A,oU as B,Tt as C,Rt as D,xl as E,An as F,w1e as G,phe as H,Za as I,k1e as J,g1e as K,p1e as L,_t as M,au as N,y1e as O,h3 as P,Nt as Q,c3 as R,$N as S,Wg as T,Bq as U,VN as V,d1e as W,Dt as X,So as Y,Vs as Z,u1e as _,Xa as a,Fu as a0,ta as a1,vre as a2,Ka as a3,CAe as a4,Ej as a5,kn as a6,Vm as a7,g3 as a8,we as a9,Fr as aa,jo as ab,Ase as ac,x1e as ad,OA as ae,kl as af,cae as ag,l1e as ah,r1e as ai,c1e as aj,Jm as ak,Wee as al,BTe as am,HRe as an,o1e as ao,Tse as ap,m as b,_l as c,b1e as d,Le as e,zW as f,AA as g,YSe as h,ua as i,s as j,v1e as k,JSe as l,jn as m,pr as n,Pi as o,Sl as p,f1e as q,ht as r,Qn as s,x as t,se as u,Aa as v,pt as w,Rs as x,m1e as y,yf as z};
|